diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..2f943554161f33ccad78d2a55dbd9aefc29475df 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,17 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +apps/assets/FiraMono-Bold-CLVRCuM9.ttf filter=lfs diff=lfs merge=lfs -text +apps/assets/FiraMono-Medium-DU3aDxX5.ttf filter=lfs diff=lfs merge=lfs -text +apps/assets/FiraMono-Regular-BTCkDNvf.ttf filter=lfs diff=lfs merge=lfs -text +apps/assets/Lora-VariableFont_wght-B2ootaw-.ttf filter=lfs diff=lfs merge=lfs -text +apps/assets/PTSans-Bold-D9fedIX3.ttf filter=lfs diff=lfs merge=lfs -text +apps/assets/PTSans-Regular-CxL0S8W7.ttf filter=lfs diff=lfs merge=lfs -text +apps/assets/gradient-yHQUC_QB.png filter=lfs diff=lfs merge=lfs -text +notebooks/assets/FiraMono-Bold-CLVRCuM9.ttf filter=lfs diff=lfs merge=lfs -text +notebooks/assets/FiraMono-Medium-DU3aDxX5.ttf filter=lfs diff=lfs merge=lfs -text +notebooks/assets/FiraMono-Regular-BTCkDNvf.ttf filter=lfs diff=lfs merge=lfs -text +notebooks/assets/Lora-VariableFont_wght-B2ootaw-.ttf filter=lfs diff=lfs merge=lfs -text +notebooks/assets/PTSans-Bold-D9fedIX3.ttf filter=lfs diff=lfs merge=lfs -text +notebooks/assets/PTSans-Regular-CxL0S8W7.ttf filter=lfs diff=lfs merge=lfs -text +notebooks/assets/gradient-yHQUC_QB.png filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index 9c91622e163de57455f763dd76e2f0eab92c1a8f..0866d0bc9d202883136684e7d63b08171e2c7dbf 100644 --- a/README.md +++ b/README.md @@ -1,12 +1 @@ ---- -title: Test Marimo Publish -emoji: 🚀 -colorFrom: blue -colorTo: pink -sdk: static -pinned: false -license: apache-2.0 -short_description: Testing of Marimo publishing ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +# Huggingface Target diff --git a/apps/.nojekyll b/apps/.nojekyll new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/apps/android-chrome-192x192.png b/apps/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..b8e595cb98236af54d85702265bfaf0bc2232158 Binary files /dev/null and b/apps/android-chrome-192x192.png differ diff --git a/apps/android-chrome-512x512.png b/apps/android-chrome-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..0667fbdd81bbfd925aa5aaf1d7e5c8059dce761f Binary files /dev/null and b/apps/android-chrome-512x512.png differ diff --git a/apps/apple-touch-icon.png b/apps/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b2a013bd102eb79ac10f78945bee20d1468cb066 Binary files /dev/null and b/apps/apple-touch-icon.png differ diff --git a/apps/assets/ConnectedDataExplorerComponent-4GM2STek.js b/apps/assets/ConnectedDataExplorerComponent-4GM2STek.js new file mode 100644 index 0000000000000000000000000000000000000000..6ee63786eab6e18addd7249b5b8c373fd300a041 --- /dev/null +++ b/apps/assets/ConnectedDataExplorerComponent-4GM2STek.js @@ -0,0 +1,19 @@ +import{u as Gn,y as zn,dm as po,j as x,dn as ho,dp as go,dq as mo,dr as yo,c as Ee,Q as Yn,ds as ke,V as vo,W as Qn,dt as pt,du as Vn,dv as ht,dw as Ke,dx as gt,L as bo,dy as xo,dz as Eo,_ as To,Z as Kt,dA as Kn,bt as So,dB as Jn,dC as wo,dD as No,dE as Co,dF as Ao,dG as Oo,aI as ko,U as Mo,aH as Io,E as Uo,a4 as Fo,dH as Do,aO as _o,dI as jo,a as Po}from"./index-DgI7bmFZ.js";import{U as Ro,e as $o,V as Bo}from"./compile-BapKxctZ.js";import{a as Xn}from"./VegaLite-BNmk2IVQ.js";import"./time-D5YMlIcS.js";import"./timer-Bqd5yn_a.js";import"./linear-aSIo3jFo.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./zoom-COrs4lFh.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./step-BwsUM5iJ.js";import"./arc-CfyY4LWz.js";import"./index-_uHhs6Sh.js";/** + * @license lucide-react v0.503.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lo=Gn("chart-column-big",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]),Wo=Gn("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */function $e(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(o=Object.getOwnPropertySymbols(e);it&&s(),u=t=n+1):o==="]"&&(u||Jt("Access path missing open bracket: "+e),u>0&&s(),u=0,t=n+1):n>t?s():t=n+1}return u&&Jt("Access path missing closing bracket: "+e),c&&Jt("Access path missing closing quote: "+e),n>t&&(n++,s()),i}const mt=Array.isArray;function rr(e){return e===Object(e)}function Zt(e){return typeof e=="string"}function en(e){return mt(e)?"["+e.map(en)+"]":rr(e)||Zt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var Je=[];function yt(e,t,n){var o=[t].concat([].slice.call(n));console[e](...o)}(function(e){var t=Xt(e),n="return _["+t.map(en).join("][")+"];";Be(Function("_",n),[e=t.length===1?t[0]:e],e)})("id"),Be(function(e){return e},Je,"identity"),Be(function(){return 0},Je,"zero"),Be(function(){return 1},Je,"one"),Be(function(){return!0},Je,"true"),Be(function(){return!1},Je,"false");function tn(e){return typeof e=="boolean"}function Le(e){for(var t={},n=0,o=e.length;nnr(e)).join(",")})`};const K=nr;function Y(e,t){return e.indexOf(t)>-1}const ue=Object.keys,ne="row",ee="column",ir="facet",D="x",_="y",nn="x2",rn="y2",or="latitude",ar="longitude",sr="latitude2",cr="longitude2",de="color",vt="fill",bt="stroke",Xe="shape",Te="size",xt="opacity",Et="fillOpacity",Tt="strokeOpacity",St="strokeWidth",on="text",lr="order",an="detail",ur="key",dr="tooltip",fr="href",sn=Object.assign({},{x:1,y:1,x2:1,y2:1},{longitude:1,longitude2:1,latitude:1,latitude2:1},{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});function wt(e){return e==="color"||e==="fill"||e==="stroke"}const Ze=Object.assign({},sn,{row:1,column:1,facet:1}),Go=ue(Ze),{order:vc,detail:bc}=Ze;$e(Ze,["order","detail"]);const{order:xc,detail:Ec,row:Tc,column:Sc,facet:wc}=Ze;$e(Ze,["order","detail","row","column","facet"]);const{x:Nc,y:Cc,x2:Ac,y2:Oc,latitude:kc,longitude:Mc,latitude2:Ic,longitude2:Uc}=sn,cn=$e(sn,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]),pr=ue(cn),{text:Fc,tooltip:Dc,href:_c,detail:jc,key:Pc,order:Rc}=cn,zo=$e(cn,["text","tooltip","href","detail","key","order"]),Yo=Object.assign({},{x:1,y:1},zo);function Qo(e,t){return function(n){switch(n){case de:case vt:case bt:case an:case ur:case dr:case fr:case lr:case xt:case Et:case Tt:case St:case ir:case ne:case ee:return ln;case D:case _:case or:case ar:return Vo;case nn:case rn:case sr:case cr:return{rule:"always",bar:"always",rect:"always",area:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Te:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Xe:return{point:"always",geoshape:"always"};case on:return{text:"always"}}}(e)[t]}const ln={area:"always",bar:"always",circle:"always",geoshape:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:$c}=ln,Vo=$e(ln,["geoshape"]);function un(e){switch(e){case D:case _:case Te:case St:case xt:case Et:case Tt:case nn:case rn:return;case ir:case ne:case ee:case Xe:case on:case dr:case fr:return"discrete";case de:case vt:case bt:return"flexible";case or:case ar:case sr:case cr:case an:case ur:case lr:return}throw new Error("rangeType not implemented for "+e)}const hr={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,zindex:1},Ko=Object.assign({},hr,{encoding:1});Object.assign({gridScale:1,scale:1},hr,{encode:1});const gr=ue(Ko),mr={clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1};Object.assign({},mr,{opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,encode:1});const yr=ue(mr),Jo=Object.freeze(Object.defineProperty({__proto__:null,BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL:"Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.",CANNOT_FIX_RANGE_STEP_WITH_FIT:'Cannot use a fixed value of "rangeStep" when "autosize" is "fit".',CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:"custom domain scale cannot be unioned with default field-based domain",CONCAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).",FIT_NON_SINGLE:'Autosize "fit" only works for single views and layered views.',INVALID_CHANNEL_FOR_AXIS:"Invalid channel for axis.",INVALID_SPEC:"Invalid spec",LINE_WITH_VARYING_SIZE:"Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.",MORE_THAN_ONE_SORT:"Domains that should be unioned has conflicting sort properties. Sort will be set to true.",NO_FIELDS_NEEDS_AS:'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.',NO_INIT_SCALE_BINDINGS:"Selections bound to scales cannot be separately initialized.",REPEAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).",SCALE_BINDINGS_CONTINUOUS:"Scale bindings are currently only supported for scales with unbinned, continuous domains.",UNABLE_TO_MERGE_DOMAINS:"Unable to merge domains",cannotApplySizeToNonOrientedMark:function(e){return`Cannot apply size to non-oriented mark "${e}".`},cannotProjectOnChannelWithoutField:function(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`},cannotStackNonLinearScale:function(e){return`Cannot stack non-linear scale (${e})`},cannotStackRangedMark:function(e){return`Cannot stack "${e}" if there is already "${e}2"`},cannotUseScalePropertyWithNonColor:function(e){return`Cannot use the scale property "${e}" with non-color channel.`},channelRequiredForBinned:function(e){return`Channel ${e} is required for "binned" bin`},columnsNotSupportByRowCol:function(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`},dayReplacedWithDate:function(e){return`Time unit "${e}" is not supported. We are replacing it with ${e.replace("day","date")}.`},differentParse:function(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`},discreteChannelCannotEncode:function(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`},domainRequiredForThresholdScale:function(e){return`Domain for ${e} is required for threshold scale`},domainSortDropped:function(e){return`Dropping sort property ${K(e)} as unioned domains only support boolean or op 'count'.`},droppedDay:function(e){return`Dropping day from datetime ${K(e)} as day cannot be combined with other units.`},droppingColor:function(e,t){const{fill:n,stroke:o}=t;return`Dropping color ${e} as the plot also has `+(n&&o?"fill and stroke":n?"fill":"stroke")},emptyFieldDef:function(e,t){return`Dropping ${K(e)} from channel "${t}" since it does not contain data field or value.`},encodingOverridden:function(e){return`Layer's shared ${e.join(",")} channel ${e.length===1?"is":"are"} overriden`},errorBand1DNotSupport:function(e){return`1D error band does not support ${e}`},errorBarCenterAndExtentAreNotNeeded:function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`},errorBarCenterIsNotNeeded:function(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`},errorBarCenterIsUsedWithWrongExtent:function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`},errorBarContinuousAxisHasCustomizedAggregate:function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`},facetChannelDropped:function(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`},facetChannelShouldBeDiscrete:function(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`},incompatibleChannel:function(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`},independentScaleMeansIndependentGuide:function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`},invalidAggregate:function(e){return`Invalid aggregation operator "${e}"`},invalidEncodingChannel:function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`},invalidFieldType:function(e){return`Invalid field type "${e}"`},invalidFieldTypeForCountAggregate:function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`},invalidTimeUnit:function(e,t){return`Invalid ${e}: ${K(t)}`},invalidTransformIgnored:function(e){return`Ignoring an invalid transform: ${K(e)}.`},latLongDeprecated:function(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`},lineWithRange:function(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`},mergeConflictingDomainProperty:function(e,t,n,o){return`Conflicting ${t.toString()} property "${e.toString()}" (${K(n)} and ${K(o)}). Using the union of the two domains.`},mergeConflictingProperty:function(e,t,n,o){return`Conflicting ${t.toString()} property "${e.toString()}" (${K(n)} and ${K(o)}). Using ${K(n)}.`},missingFieldType:function(e,t){return`Missing type for channel "${e}", using "${t}" instead.`},nearestNotSupportForContinuous:function(e){return`The "nearest" transform is not supported for ${e} marks.`},noSuchRepeatedValue:function(e){return`Unknown repeated value "${e}".`},nonZeroScaleUsedWithLengthMark:function(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${e}'s ${t}. This can be misleading as the ${t==="x"?"width":"height"} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`},orientOverridden:function(e,t){return`Specified orient "${e}" overridden with "${t}"`},primitiveChannelDef:function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${K(n)}}.`},projectionOverridden:function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${K(t)} is overridden by a child projection ${K(n)}.`},rangeStepDropped:function(e){return`rangeStep for "${e}" is dropped as top-level ${e==="x"?"width":"height"} is provided.`},scalePropertyNotWorkWithScaleType:function(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`},scaleTypeNotWorkWithChannel:function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`},scaleTypeNotWorkWithFieldDef:function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`},scaleTypeNotWorkWithMark:function(e,t){return`Scale type "${t}" does not work with mark "${e}".`},selectionNotFound:function(e){return`Cannot find a selection named "${e}"`},selectionNotSupported:function(e){return`Selection not supported for ${e} yet`},stackNonSummativeAggregate:function(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}")`},unaggregateDomainHasNoEffectForRawField:function(e){return`Using unaggregated domain with raw field has no effect (${K(e)}).`},unaggregateDomainWithNonSharedDomainOp:function(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`},unaggregatedDomainWithLogScale:function(e){return`Unaggregated domain is currently unsupported for log scale (${K(e)}).`},unrecognizedParse:function(e){return`Unrecognized parse "${e}".`}},Symbol.toStringTag,{value:"Module"})),re=Jo;var Me;let vr=(Me=2,{level:function(e){return arguments.length?(Me=+e,this):Me},error:function(){return Me>=1&&yt("error","ERROR",arguments),this},warn:function(){return Me>=2&&yt("warn","WARN",arguments),this},info:function(){return Me>=3&&yt("log","INFO",arguments),this},debug:function(){return Me>=4&&yt("log","DEBUG",arguments),this}});function Se(...e){vr.warn.apply(vr,arguments)}const Xo={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},R="quantitative",ce="ordinal",Q="temporal",ie="nominal";var j;(function(e){e.LINEAR="linear",e.LOG="log",e.POW="pow",e.SQRT="sqrt",e.SYMLOG="symlog",e.TIME="time",e.UTC="utc",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.BIN_ORDINAL="bin-ordinal",e.ORDINAL="ordinal",e.POINT="point",e.BAND="band"})(j||(j={}));const Zo=ue({linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"}),br=["linear","log","pow","sqrt","symlog","time","utc"],ea=Le(br),ta=Le(["quantile","quantize","threshold"]),na=Le(br.concat(["quantile","quantize","threshold"])),ra=Le(["ordinal","bin-ordinal","point","band"]);function Ie(e){return e in ra}function We(e){return e in ea}const dn={type:1,domain:1,align:1,range:1,rangeStep:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},xr=ue(dn),{type:Bc,domain:Lc,range:Wc,rangeStep:Hc,scheme:qc}=dn;function fn(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!Y(["point","band","identity"],e);case"bins":return!Y(["point","band","identity","ordinal"],e);case"round":return We(e)||e==="band"||e==="point";case"padding":return We(e)||Y(["point","band"],e);case"paddingOuter":case"rangeStep":case"align":return Y(["point","band"],e);case"paddingInner":return e==="band";case"clamp":return We(e);case"nice":return We(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return function(n){return n in na}(e)&&!Y(["log","time","utc","threshold","quantile"],e)}}function ia(e,t){switch(t){case"interpolate":case"scheme":return wt(e)?void 0:re.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeStep":case"reverse":case"round":case"clamp":case"zero":return}}function Er(e,t){return Y([ce,ie],t)?e===void 0||Ie(e):t===Q?Y([j.TIME,j.UTC,void 0],e):t!==R||Y([j.LOG,j.POW,j.SQRT,j.SYMLOG,j.QUANTILE,j.QUANTIZE,j.THRESHOLD,j.LINEAR,void 0],e)}function Tr(e,t){switch(e){case D:case _:return We(t)||Y(["band","point"],t);case Te:case St:case xt:case Et:case Tt:return We(t)||function(n){return n in ta}(t)||Y(["band","point"],t);case de:case vt:case bt:return t!=="band";case Xe:return t==="ordinal"}return!1}function oa(e,t){return e+"_"+t}$e(dn,["type","domain","range","rangeStep","scheme"]),function(){const e={};for(const t of Go)for(const n of ue(Xo))for(const o of Zo){const i=oa(t,n);Tr(t,o)&&Er(o,n)&&(e[i]=e[i]||[],e[i].push(o))}}();var Sr,wr={exports:{}};function et(){return Sr||(Sr=1,function(){var e=wr.exports,t="__name__";e.namedfunc=function(a,r){return r[t]=a,r},e.name=function(a){return a==null?null:a[t]},e.identity=function(a){return a},e.true=e.namedfunc("true",function(){return!0}),e.false=e.namedfunc("false",function(){return!1}),e.duplicate=function(a){return JSON.parse(JSON.stringify(a))},e.equal=function(a,r){return JSON.stringify(a)===JSON.stringify(r)},e.extend=function(a){for(var r,s,d=1,l=arguments.length;d1?function(s,d){for(var l=0;lr||r==null)&&a!=null?1:(r=r instanceof Date?+r:r,(a=a instanceof Date?+a:a)!==a&&r==r?-1:r!=r&&a==a?1:0)},e.numcmp=function(a,r){return a-r},e.stablesort=function(a,r,s){var d=a.reduce(function(l,f,p){return l[s(f)]=p,l},{});return a.sort(function(l,f){var p=r(l),h=r(f);return ph?1:d[s(l)]-d[s(f)]}),a},e.permute=function(a){for(var r,s,d=a.length;d;)s=Math.floor(Math.random()*d--),r=a[d],a[d]=a[s],a[s]=r},e.pad=function(a,r,s,d){d=d||" ";var l=r-a.length;if(l<=0)return a;switch(s){case"left":return i(l,d)+a;case"middle":case"center":return i(Math.floor(l/2),d)+a+i(Math.ceil(l/2),d);default:return a+i(l,d)}},e.truncate=function(a,r,s,d,l){var f=a.length;if(f<=r)return a;l=l!==void 0?String(l):"\u2026";var p=Math.max(0,r-l.length);switch(s){case"left":return l+(d?c(a,p,1):a.slice(f-p));case"middle":case"center":var h=Math.ceil(p/2),m=Math.floor(p/2);return(d?c(a,h):a.slice(0,h))+l+(d?c(a,m,1):a.slice(f-m));default:return(d?c(a,p):a.slice(0,p))+l}};var u=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/}()),wr.exports}var k=et();function te(e,t){return e.indexOf(t)!==-1}function fe(e,t){for(let n=0;n({parent:"bin",child:e})),gn=["field","op","order"].map(e=>({parent:"sort",child:e})),Nt=xr.map(e=>({parent:"scale",child:e})),Or=gr.map(e=>({parent:"axis",child:e})),kr=yr.map(e=>({parent:"legend",child:e})),Ct=[].concat(Ar,gn,Nt,Or,kr),Mr=["width","height","background","padding","title"];function At(e){return pe(e)?e.parent+"."+e.child:e}const sa=Ct.reduce((e,t)=>(e[t.parent]=e[t.parent]||[],e[t.parent][t.child]=t,e),{});function ge(e,t){return(sa[e]||{})[t]}function Ir(e){return function(t){return t in Nr}(e)||pe(e)}const ca=[].concat(pn,Ct),Ur=["type","field","bin","timeUnit","aggregate","autoCount","channel","mark","stack","scale","sort","axis","legend"].concat(Ar,Nt,Or,kr,gn);var g;(function(e){e.MARK="mark",e.TRANSFORM="transform",e.STACK="stack",e.FORMAT="format",e.CHANNEL="channel",e.AGGREGATE="aggregate",e.AUTOCOUNT="autoCount",e.BIN="bin",e.HAS_FN="hasFn",e.TIMEUNIT="timeUnit",e.FIELD="field",e.TYPE="type",e.SORT="sort",e.SCALE="scale",e.AXIS="axis",e.LEGEND="legend",e.WIDTH="width",e.HEIGHT="height",e.BACKGROUND="background",e.PADDING="padding",e.TITLE="title"})(g||(g={}));const Ue="area",me="bar",tt="line",nt="point",mn="rect",yn="rule",Ot="text",rt="tick",kt="circle",Mt="square";function la(e){return Y(["line","area","trail"],e)}Le(ue({area:1,bar:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1})),["january","february","march","april","may","june","july","august","september","october","november","december"].map(e=>e.substr(0,3));var W;["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].map(e=>e.substr(0,3)),function(e){e.YEAR="year",e.MONTH="month",e.DAY="day",e.DATE="date",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.MILLISECONDS="milliseconds",e.YEARMONTH="yearmonth",e.YEARMONTHDATE="yearmonthdate",e.YEARMONTHDATEHOURS="yearmonthdatehours",e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",e.MONTHDATE="monthdate",e.MONTHDATEHOURS="monthdatehours",e.HOURSMINUTES="hoursminutes",e.HOURSMINUTESSECONDS="hoursminutesseconds",e.MINUTESSECONDS="minutesseconds",e.SECONDSMILLISECONDS="secondsmilliseconds",e.QUARTER="quarter",e.YEARQUARTER="yearquarter",e.QUARTERMONTH="quartermonth",e.YEARQUARTERMONTH="yearquartermonth",e.UTCYEAR="utcyear",e.UTCMONTH="utcmonth",e.UTCDAY="utcday",e.UTCDATE="utcdate",e.UTCHOURS="utchours",e.UTCMINUTES="utcminutes",e.UTCSECONDS="utcseconds",e.UTCMILLISECONDS="utcmilliseconds",e.UTCYEARMONTH="utcyearmonth",e.UTCYEARMONTHDATE="utcyearmonthdate",e.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",e.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",e.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",e.UTCMONTHDATE="utcmonthdate",e.UTCMONTHDATEHOURS="utcmonthdatehours",e.UTCHOURSMINUTES="utchoursminutes",e.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",e.UTCMINUTESSECONDS="utcminutesseconds",e.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",e.UTCQUARTER="utcquarter",e.UTCYEARQUARTER="utcyearquarter",e.UTCQUARTERMONTH="utcquartermonth",e.UTCYEARQUARTERMONTH="utcyearquartermonth"}(W||(W={}));const vn={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Fr=ue(vn),bn={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1},Dr={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},ua=Object.assign({},bn,Dr),da=Object.assign({},vn,bn,{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},Dr),fa={year:"setFullYear",month:"setMonth",date:"setDate",hours:"setHours",minutes:"setMinutes",seconds:"setSeconds",milliseconds:"setMilliseconds",quarter:null,day:null};function pa(e,t){const n=!!ua[e],o=n?new Date(Date.UTC(1972,0,1,0,0,0,0)):new Date(1972,0,1,0,0,0,0);for(const i of Fr)if(jr(e,i))switch(i){case W.DAY:throw new Error("Cannot convert to TimeUnits containing 'day'");case W.QUARTER:{const{getDateMethod:c,setDateMethod:u}=_r("month",n);o[u](3*Math.floor(t[c]()/3));break}default:{const{getDateMethod:c,setDateMethod:u}=_r(i,n);o[u](t[c]())}}return o}function _r(e,t){const n=fa[e];return{setDateMethod:t?"setUTC"+n.substr(3):n,getDateMethod:"get"+(t?"UTC":"")+n.substr(3)}}function jr(e,t){const n=e.indexOf(t);return n>-1&&(t!==W.SECONDS||n===0||e.charAt(n-1)!=="i")}const P="?";function w(e){return It(e)||function(t){return!(t===void 0||t==null||!t.enum&&!t.name||k.isArray(t))}(e)}function It(e){return e===P}function xn(e,t,n){return k.extend({},{name:t,enum:n},e===P?{}:e)}function En(e){let t={},n={};for(const o of e){const i=[0];for(let u=0;uo.charAt(u)).join("").toLowerCase();if(n[c])if(i[i.length-1]===o.length-1||(c=i.concat([o.length-1]).map(u=>o.charAt(u)).join("").toLowerCase(),n[c]))for(let u=1;!t[o];u++){let a=c+"_"+u;if(!n[a]){t[o]=a,n[a]=!0;break}}else t[o]=c,n[c]=!0;else t[o]=c,n[c]=!0}return t}const Ut={mark:"m",channel:"c",aggregate:"a",autoCount:"#",hasFn:"h",bin:"b",sort:"so",stack:"st",scale:"s",format:"f",axis:"ax",legend:"l",value:"v",timeUnit:"tu",field:"f",type:"t",binProps:{maxbins:"mb",min:"mi",max:"ma",base:"b",step:"s",steps:"ss",minstep:"ms",divide:"d"},sortProps:{field:"f",op:"o",order:"or"},scaleProps:En(xr),axisProps:En(gr),legendProps:En(yr)};function it(e){if(pe(e))return Ut[e.parent]+"-"+Ut[e.parent+"Props"][e.child];if(Ut[e])return Ut[e];throw new Error("Default name undefined for "+e)}const X=[!1,!0],ha={maxbins:[5,10,20],extent:[void 0],base:[10],step:[void 0],steps:[void 0],minstep:[void 0],divide:[[5,2]],binned:[!1],anchor:[void 0],nice:[!0]},ga={field:[void 0],op:["min","mean"],order:["ascending","descending"]},ma={type:[void 0,j.LOG],domain:[void 0],base:[void 0],exponent:[1,2],constant:[void 0],bins:[void 0],clamp:X,nice:X,reverse:X,round:X,zero:X,padding:[void 0],paddingInner:[void 0],paddingOuter:[void 0],interpolate:[void 0],range:[void 0],rangeStep:[17,21],scheme:[void 0]},ya={zindex:[1,0],offset:[void 0],orient:[void 0],values:[void 0],bandPosition:[void 0],encoding:[void 0],domain:X,domainColor:[void 0],domainDash:[void 0],domainDashOffset:[void 0],domainOpacity:[void 0],domainWidth:[void 0],formatType:[void 0],grid:X,gridColor:[void 0],gridDash:[void 0],gridDashOffset:[void 0],gridOpacity:[void 0],gridWidth:[void 0],format:[void 0],labels:X,labelAlign:[void 0],labelAngle:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFlushOffset:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOpacity:[void 0],labelSeparation:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelBound:[void 0],labelFlush:[void 0],maxExtent:[void 0],minExtent:[void 0],position:[void 0],ticks:X,tickColor:[void 0],tickCount:[void 0],tickDash:[void 0],tickExtra:[void 0],tickDashOffset:[void 0],tickMinStep:[void 0],tickOffset:[void 0],tickOpacity:[void 0],tickRound:[void 0],tickSize:[void 0],tickWidth:[void 0],title:[void 0],titleAlign:[void 0],titleAnchor:[void 0],titleAngle:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titlePadding:[void 0],titleX:[void 0],titleY:[void 0]},va={orient:["left","right"],format:[void 0],type:[void 0],values:[void 0],zindex:[void 0],clipHeight:[void 0],columnPadding:[void 0],columns:[void 0],cornerRadius:[void 0],direction:[void 0],encoding:[void 0],fillColor:[void 0],formatType:[void 0],gridAlign:[void 0],offset:[void 0],padding:[void 0],rowPadding:[void 0],strokeColor:[void 0],labelAlign:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOffset:[void 0],labelOpacity:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelSeparation:[void 0],legendX:[void 0],legendY:[void 0],gradientLength:[void 0],gradientOpacity:[void 0],gradientStrokeColor:[void 0],gradientStrokeWidth:[void 0],gradientThickness:[void 0],symbolDash:[void 0],symbolDashOffset:[void 0],symbolFillColor:[void 0],symbolOffset:[void 0],symbolOpacity:[void 0],symbolSize:[void 0],symbolStrokeColor:[void 0],symbolStrokeWidth:[void 0],symbolType:[void 0],tickCount:[void 0],tickMinStep:[void 0],title:[void 0],titleAnchor:[void 0],titleAlign:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titleOrient:[void 0],titlePadding:[void 0]},ba={mark:[nt,me,tt,Ue,mn,rt,Ot],channel:[D,_,ne,ee,Te,de],aggregate:[void 0,"mean"],autoCount:X,bin:X,hasFn:X,timeUnit:[void 0,W.YEAR,W.MONTH,W.MINUTES,W.SECONDS],field:[void 0],type:[ie,ce,R,Q],sort:["ascending","descending"],stack:["zero","normalize","center",null],value:[void 0],format:[void 0],title:[void 0],scale:[!0],axis:X,legend:X,binProps:ha,sortProps:ga,scaleProps:ma,axisProps:ya,legendProps:va};function Tn(e,t,n){if(e==="field"||pe(e)&&e.parent==="sort"&&e.child==="field")return t.fieldNames();let o;if(o=pe(e)?n.enum[e.parent+"Props"][e.child]:n.enum[e],o!==void 0)return o;throw new Error("No default enumValues for "+JSON.stringify(e))}const ot={verbose:!1,defaultSpecConfig:{line:{point:!0},scale:{useUnaggregatedDomain:!0}},propertyPrecedence:Ur.map(At),enum:ba,numberNominalProportion:.05,numberNominalLimit:40,constraintManuallySpecifiedValue:!1,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregate:!1,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitAggregatePlotWithoutDimension:!1,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitMultipleNonPositionalChannels:!0,omitRaw:!1,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOrFacetOverPositionalChannels:!0,omitTableWithOcclusionIfAutoAddCount:!0,omitVerticalDotPlot:!1,omitInvalidStackSpec:!0,omitNonSumStack:!0,preferredBinAxis:D,preferredTemporalAxis:D,preferredOrdinalAxis:_,preferredNominalAxis:_,preferredFacet:ne,minCardinalityForBin:15,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:20,maxCardinalityForShape:6,timeUnitShouldHaveVariation:!0,typeMatchesSchemaType:!0,stylize:!0,smallRangeStepForHighCardinalityOrFacet:{maxCardinality:10,rangeStep:12},nominalColorScaleForHighCardinality:{maxCardinality:10,palette:"category20"},xAxisOnTopForHighYCardinalityWithoutColumn:{maxCardinality:30},maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7,minPercentUniqueForKey:.8,minCardinalityForKey:50},xa={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},Pr=["count","sum","distinct","valid","missing"];function Ea(e){return tn(e)&&(e=function(t,n){return tn(t)?{maxbins:Sn(n)}:t==="binned"?{binned:!0}:t.maxbins||t.step?t:Object.assign({},t,{maxbins:Sn(n)})}(e,void 0)),"bin"+ue(e).map(t=>function(n){const o=n.replace(/\W/g,"_");return(n.match(/^\d+/)?"_":"")+o}(`_${t}_${e[t]}`)).join("")}function Rr(e){return e===!0||function(t){return rr(t)}(e)&&!e.binned}function Sn(e){switch(e){case ne:case ee:case Te:case de:case vt:case bt:case St:case xt:case Et:case Tt:case Xe:return 6;default:return 10}}function $r(e){return!!e&&!!e.condition&&!mt(e.condition)&&we(e.condition)}function we(e){return!(!e||!e.field&&e.aggregate!=="count")}function wn(e){return we(e)&&Zt(e.field)}function Nn(e,t={}){let n=e.field;const o=t.prefix;let i=t.suffix,c="";if(function(a){return a.aggregate==="count"}(e))n=function(a){return function(r){return r.indexOf("__")===0}(a)?a:`__${a}`}("count");else{let a;if(!t.nofn)if(function(r){return!!r.op}(e))a=e.op;else{const{bin:r,aggregate:s,timeUnit:d}=e;Rr(r)?(a=Ea(r),i=(t.binSuffix||"")+(t.suffix||"")):s?(u=s)&&u.argmax?(c=`.${n}`,n=`argmax_${s.argmax}`):function(l){return!!l&&!!l.argmin}(s)?(c=`.${n}`,n=`argmin_${s.argmin}`):a=String(s):d&&(a=String(d))}a&&(n=n?`${a}_${n}`:a)}var u;return i&&(n=`${n}_${i}`),o&&(n=`${o}_${n}`),t.forAs?n:t.expr?function(a,r="datum"){return`${r}[${en(Xt(a).join("."))}]`}(n,t.expr)+c:`${Xt(n).map(a=>a.replace(".","\\.")).join("\\.")}`+c}function Br(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(re.invalidFieldType(e.type))}Le(["mean","average","median","q1","q3","min","max"]);const He={compatible:!0};function Ta(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case"row":case"column":case"facet":return function(o){return!Br(o)}(e)?{compatible:!1,warning:re.facetChannelShouldBeDiscrete(t)}:He;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":return He;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==R?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:He;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return n!=="nominal"||e.sort?He:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return Y(["ordinal","nominal","geojson"],e.type)?He:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return e.type!=="nominal"||"sort"in e?He:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}function Sa(e,t,n,o){const i=function(u,a,r){switch(a.type){case"nominal":case"ordinal":return wt(u)||un(u)==="discrete"?(u==="shape"&&a.type==="ordinal"&&Se(re.discreteChannelCannotEncode(u,"ordinal")),"ordinal"):Y(["x","y"],u)&&Y(["rect","bar","rule"],r)?"band":"point";case"temporal":return wt(u)?"time":un(u)==="discrete"?(Se(re.discreteChannelCannotEncode(u,"temporal")),"ordinal"):"time";case"quantitative":return wt(u)?Rr(a.bin)?"bin-ordinal":"linear":un(u)==="discrete"?(Se(re.discreteChannelCannotEncode(u,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(re.invalidFieldType(a.type))}(t,n,o),{type:c}=e;return function(u){return!!Yo[u]}(t)?c!==void 0?Tr(t,c)?Er(c,n.type)?c:(Se(re.scaleTypeNotWorkWithFieldDef(c,i)),i):(Se(re.scaleTypeNotWorkWithChannel(t,c,i)),i):i:null}var le;function Lr(e){return e===ce||e===ie||e===le.KEY}(function(e){e.QUANTITATIVE=R,e.ORDINAL=ce,e.TEMPORAL=Q,e.NOMINAL=ie,e.KEY="key"})(le||(le={}));class J{constructor(t=null){this.index=t?Object.assign({},t):{}}has(t){return At(t)in this.index}get(t){return this.index[At(t)]}set(t,n){return this.index[At(t)]=n,this}setByKey(t,n){this.index[t]=n}map(t){const n=new J;for(const o in this.index)n.index[o]=t(this.index[o]);return n}size(){return k.keys(this.index).length}duplicate(){return new J(this.index)}}function Wr(e,t){const n=e&&e[t];return!!n&&(mt(n)?function(o,i){let c=0;for(const[u,a]of o.entries())if(i(a,u,c++))return!0;return!1}(n,o=>!!o.field):we(n)||$r(n))}const wa={zero:1,center:1,normalize:1},Na=[me,Ue,yn,nt,kt,Mt,tt,Ot,rt],Ca=[me,Ue];function Aa(e,t,n,o={}){const i=function(p){return p.type}(e)?e.type:e;if(!Y(Na,i))return null;const c=function(p){const h=p.x,m=p.y;if(we(h)&&we(m))if(h.type==="quantitative"&&m.type==="quantitative"){if(h.stack)return"x";if(m.stack)return"y";if(!!h.aggregate!=!!m.aggregate)return h.aggregate?"x":"y"}else{if(h.type==="quantitative")return"x";if(m.type==="quantitative")return"y"}else{if(we(h)&&h.type==="quantitative")return"x";if(we(m)&&m.type==="quantitative")return"y"}}(t);if(!c)return null;const u=t[c],a=wn(u)?Nn(u,{}):void 0,r=c==="x"?"y":"x",s=t[r],d=wn(s)?Nn(s,{}):void 0,l=pr.reduce((p,h)=>{if(h!=="tooltip"&&Wr(t,h)){const m=t[h];(mt(m)?m:[m]).forEach(v=>{const b=function(E){return we(E)?E:$r(E)?E.condition:void 0}(v);if(b.aggregate)return;const y=wn(b)?Nn(b,{}):void 0;(!y||y!==d&&y!==a)&&p.push({channel:h,fieldDef:b})})}return p},[]);let f;if(u.stack!==void 0?f=tn(u.stack)?u.stack?"zero":null:u.stack:l.length>0&&(f=Y(Ca,i)?function(...p){for(const h of p)if(h!==void 0)return h}(n,"zero"):n),!f||!wa[f])return null;if(u.scale&&u.scale.type&&u.scale.type!==j.LINEAR){if(o.disallowNonLinearStack)return null;Se(re.cannotStackNonLinearScale(u.scale.type))}return Wr(t,c===D?nn:rn)?(u.stack!==void 0&&Se(re.cannotStackRangedMark(c)),null):(u.aggregate&&!Y(Pr,u.aggregate)&&Se(re.stackNonSummativeAggregate(u.aggregate)),{groupbyChannel:s?r:void 0,fieldChannel:c,impute:la(i),stackBy:l,offset:f})}function Hr(e){if(!function(n){if(w(n.mark))return!1;const o=[g.STACK,g.CHANNEL,g.MARK,g.FIELD,g.AGGREGATE,g.AUTOCOUNT,g.SCALE,ge("scale","type"),g.TYPE],i=k.toMap((u=ca,a=o,u.filter(function(r){return!te(a,r)}))),c=n.encodings.filter(r=>!ae(r));var u,a;for(const r of c)if(qr(r,{exclude:i}))return!1;return!0}(e))return null;const t=Qr(e.encodings,{schema:null,wildcardMode:"null"});return Aa(e.mark,t,void 0,{disallowNonLinearStack:!0})}function qr(e,t={}){if(!k.isObject(e))return!1;for(const n in e)if(e.hasOwnProperty(n)&&(w(e[n])&&(!t.exclude||!t.exclude[n])||qr(e[n],t)))return!0;return!1}function Oa(e){return e.map(t=>function(n){return o=>n[o]!==void 0?n[o]:o}(t))}function Fe(e,t){return w(e)?!It(e)&&e.enum?P+JSON.stringify(e.enum):P:t?t(e):e}function Ft(e,t){return t?t(e):e}const Cn=new J,An=[].concat(Ur,gn,[g.TRANSFORM,g.STACK],Mr).reduce((e,t)=>e.set(t,!0),new J),On={axis:{x:!0,y:!0,row:!0,column:!0},legend:{color:!0,opacity:!0,size:!0,shape:!0},scale:{x:!0,y:!0,color:!0,opacity:!0,row:!0,column:!0,size:!0,shape:!0},sort:{x:!0,y:!0,path:!0,order:!0},stack:{x:!0,y:!0}};function qe(e,t=An,n=Cn){const o=[];let i;if(t.get(g.MARK)&&o.push(Fe(e.mark,n.get(g.MARK))),e.transform&&e.transform.length>0&&o.push("transform:"+JSON.stringify(e.transform)),t.get(g.STACK)&&(i=Hr(e)),e.encodings){const c=e.encodings.reduce((u,a)=>{if(!ae(a)){let r;r=i&&a.channel===i.fieldChannel?Gr(Object.assign({},a,{stack:i.offset}),t,n):Gr(a,t,n),r&&u.push(r)}return u},[]).sort().join("|");c&&o.push(c)}for(let c of Mr){const u=c.toString();if(t.get(c)&&e[u]){const a=e[u];o.push(`${u}=${JSON.stringify(a)}`)}}return o.join("|")}function Gr(e,t=An,n=Cn){const o=[];if(t.get(g.CHANNEL)&&o.push(Fe(e.channel,n.get(g.CHANNEL))),A(e)){const i=zr(e,t,n);i&&o.push(i)}else oe(e)?o.push(e.value):H(e)&&o.push("autocount()");return o.join(":")}function zr(e,t=An,n=Cn){if(t.get(g.AGGREGATE)&&ae(e))return"-";const o=function(u,a,r){if(a.get(g.AGGREGATE)&&u.aggregate&&!w(u.aggregate))return Ft(u.aggregate,r.get(g.AGGREGATE));if(a.get(g.AGGREGATE)&&Dt(u))return Ft("count",r.get(g.AGGREGATE));if(a.get(g.TIMEUNIT)&&u.timeUnit&&!w(u.timeUnit))return Ft(u.timeUnit,r.get(g.TIMEUNIT));if(a.get(g.BIN)&&u.bin&&!w(u.bin))return"bin";{let s=null;for(const d of[g.AGGREGATE,g.AUTOCOUNT,g.TIMEUNIT,g.BIN]){const l=u[d];a.get(d)&&u[d]&&w(l)&&(s=s||{},s[d]=It(l)?l:l.enum)}return s&&u.hasFn&&(s.hasFn=!0),s}}(e,t,n),i=function(u,a,r){const s=[];if(!k.isBoolean(u.bin)&&!It(u.bin)){const d=u.bin;for(const l in d){const f=ge("bin",l);f&&a.get(f)&&d[l]!==void 0&&s.push({key:l,value:Fe(d[l],r.get(f))})}s.sort((l,f)=>l.key.localeCompare(f.key))}for(const d of[g.SCALE,g.SORT,g.STACK,g.AXIS,g.LEGEND])if((w(u.channel)||On[d][u.channel])&&a.get(d)&&u[d]!==void 0){const l=u[d];if(k.isBoolean(l)||l===null)s.push({key:d+"",value:l||!1});else if(k.isString(l))s.push({key:d+"",value:Ft(JSON.stringify(l),r.get(d))});else{let f=[];for(const p in l){const h=ge(d,p);h&&a.get(h)&&l[p]!==void 0&&f.push({key:p,value:Fe(l[p],r.get(h))})}if(f.length>0){const p=f.sort((h,m)=>h.key.localeCompare(m.key)).reduce((h,m)=>(h[m.key]=m.value,h),{});s.push({key:d+"",value:JSON.stringify(p)})}}}return s}(e,t,n);let c;return A(e)?(c=t.get("field")?Fe(e.field,n.get("field")):"...",t.get(g.TYPE)&&(w(e.type)?c+=","+Fe(e.type,n.get(g.TYPE)):c+=","+Fe(((e.type||R)+"").substr(0,1),n.get(g.TYPE))),c+=i.map(u=>{let a=u.value instanceof Array?"["+u.value+"]":u.value;return","+u.key+"="+a}).join("")):H(e)&&(c="*,q"),c?o?(k.isString(o)?o:P+(k.keys(o).length>0?JSON.stringify(o):""))+"("+c+")":c:null}function kn(e,t,n){let o=[],i=0;for(let c=0;c0))return r;for(t(c,1),e(c),c=0;)for(;t(u,1),!c(u););})},n&&(i.count=function(c,u){return In.setTime(+c),Un.setTime(+u),e(In),e(Un),Math.floor(n(In,Un))},i.every=function(c){return c=Math.floor(c),isFinite(c)&&c>0?c>1?i.filter(o?function(u){return o(u)%c===0}:function(u){return i.count(0,u)%c===0}):i:null}),i}var st=G(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});st.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?G(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):st:null};const Vr=G(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getSeconds()}),Kr=G(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4},function(e){return e.getMinutes()}),Jr=G(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()}),Xr=G(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5},function(e){return e.getDate()-1});function _e(e){return G(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}var jt=_e(0),Zr=_e(1),ei=_e(2),ti=_e(3),ni=_e(4),ri=_e(5),ii=_e(6);const oi=G(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),ai=G(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}),si=G(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),ci=G(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4},function(e){return e.getUTCMinutes()}),li=G(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()}),ui=G(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1});function je(e){return G(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/6048e5})}var Pt=je(0),di=je(1),fi=je(2),pi=je(3),hi=je(4),gi=je(5),mi=je(6);const yi=G(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),vi=G(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});var bi=st.range,Ia=Vr.range,Ua=Kr.range,Fa=Jr.range,Da=Xr.range,_a=jt.range,ja=Zr.range,Pa=ei.range,Ra=ti.range,$a=ni.range,Ba=ri.range,La=ii.range,Wa=jt.range,Ha=oi.range,qa=ai.range,Ga=st,za=bi,Ya=si.range,Qa=ci.range,Va=li.range,Ka=ui.range,Ja=Pt.range,Xa=di.range,Za=fi.range,es=pi.range,ts=hi.range,ns=gi.range,rs=mi.range,is=Pt.range,os=yi.range,as=vi.range;const ss=po(Object.freeze(Object.defineProperty({__proto__:null,day:Xr,days:Da,friday:ri,fridays:Ba,hour:Jr,hours:Fa,interval:G,millisecond:st,milliseconds:bi,minute:Kr,minutes:Ua,monday:Zr,mondays:ja,month:oi,months:Ha,saturday:ii,saturdays:La,second:Vr,seconds:Ia,sunday:jt,sundays:_a,thursday:ni,thursdays:$a,tuesday:ei,tuesdays:Pa,utcDay:ui,utcDays:Ka,utcFriday:gi,utcFridays:ns,utcHour:li,utcHours:Va,utcMillisecond:Ga,utcMilliseconds:za,utcMinute:ci,utcMinutes:Qa,utcMonday:di,utcMondays:Xa,utcMonth:yi,utcMonths:os,utcSaturday:mi,utcSaturdays:rs,utcSecond:si,utcSeconds:Ya,utcSunday:Pt,utcSundays:Ja,utcThursday:hi,utcThursdays:ts,utcTuesday:fi,utcTuesdays:Za,utcWednesday:pi,utcWednesdays:es,utcWeek:Pt,utcWeeks:is,utcYear:vi,utcYears:as,wednesday:ti,wednesdays:Ra,week:jt,weeks:Wa,year:ai,years:qa},Symbol.toStringTag,{value:"Module"})));var xi,Ei,Ti;function cs(){if(xi)return _t.exports;xi=1;var e=ss,t=new Date,n=new Date(0,0,1).setFullYear(0),o=new Date(Date.UTC(0,0,1)).setUTCFullYear(0);function i(l){return t.setTime(+l),t}function c(l,f,p,h,m,v){var b={type:l,date:f,unit:p};return h?b.step=h:b.minstep=1,m!=null&&(b.min=m),v!=null&&(b.max=v),b}function u(l,f,p,h,m,v){return c(l,function(b){return f.offset(p,b)},function(b){return f.count(p,b)},h,m,v)}var a=[u("second",e.second,n),u("minute",e.minute,n),u("hour",e.hour,n),u("day",e.day,n,[1,7]),u("month",e.month,n,[1,3,6]),u("year",e.year,n),c("seconds",function(l){return new Date(1970,0,1,0,0,l)},function(l){return i(l).getSeconds()},null,0,59),c("minutes",function(l){return new Date(1970,0,1,0,l)},function(l){return i(l).getMinutes()},null,0,59),c("hours",function(l){return new Date(1970,0,1,l)},function(l){return i(l).getHours()},null,0,23),c("weekdays",function(l){return new Date(1970,0,4+l)},function(l){return i(l).getDay()},[1],0,6),c("dates",function(l){return new Date(1970,0,l)},function(l){return i(l).getDate()},[1],1,31),c("months",function(l){return new Date(1970,l%12,1)},function(l){return i(l).getMonth()},[1],0,11)],r=[u("second",e.utcSecond,o),u("minute",e.utcMinute,o),u("hour",e.utcHour,o),u("day",e.utcDay,o,[1,7]),u("month",e.utcMonth,o,[1,3,6]),u("year",e.utcYear,o),c("seconds",function(l){return new Date(Date.UTC(1970,0,1,0,0,l))},function(l){return i(l).getUTCSeconds()},null,0,59),c("minutes",function(l){return new Date(Date.UTC(1970,0,1,0,l))},function(l){return i(l).getUTCMinutes()},null,0,59),c("hours",function(l){return new Date(Date.UTC(1970,0,1,l))},function(l){return i(l).getUTCHours()},null,0,23),c("weekdays",function(l){return new Date(Date.UTC(1970,0,4+l))},function(l){return i(l).getUTCDay()},[1],0,6),c("dates",function(l){return new Date(Date.UTC(1970,0,l))},function(l){return i(l).getUTCDate()},[1],1,31),c("months",function(l){return new Date(Date.UTC(1970,l%12,1))},function(l){return i(l).getUTCMonth()},[1],0,11)],s=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];function d(l){var f,p,h={};for(f=0,p=l.length;f(M=s[N])[0]){if((O=E/M[0])>S)return y[s[N-1][1]];if(O>=T)return y[M[1]]}return y[s[C-1][1]]}(l,m,v,b)},h}return _t.exports=d(a),_t.exports.utc=d(r),_t.exports}var ls=function(){if(Ti)return Ei;Ti=1;var e=et(),t=cs();function n(a){if(!a)throw Error("Missing binning options.");var r,s,d,l,f,p,h,m=a.maxbins||15,v=a.base||10,b=Math.log(v),y=a.div||[5,2],E=a.min,T=a.max,S=T-E;if(a.step)r=a.step;else if(a.steps)r=a.steps[Math.min(a.steps.length-1,function(N,C,O,M){for(;O>>1;e.cmp(N[U],C)<0?O=U+1:M=U}return O}(a.steps,S/m,0,a.steps.length))];else{for(s=Math.ceil(Math.log(m)/b),d=a.minstep||0,r=Math.max(d,Math.pow(v,Math.round(Math.log(S)/b)-s));Math.ceil(S/r)>m;)r*=v;for(p=0;p=d&&S/f<=m&&(r=f)}return l=(f=Math.log(r))>=0?0:1+~~(-f/b),h=Math.pow(v,-l-1),{start:E=Math.min(E,Math.floor(E/r+h)*r),stop:T=Math.ceil(T/r)*r,step:r,unit:{precision:l},value:o,index:i}}function o(a){return this.step*Math.floor(a/this.step+1e-15)}function i(a){return Math.floor((a-this.start)/this.step+1e-15)}function c(a){return this.unit.date(o.call(this,a))}function u(a){return i.call(this,this.unit.unit(a))}return n.date=function(a){if(!a)throw Error("Missing date binning options.");var r=a.utc?t.utc:t,s=a.min,d=a.max,l=a.maxbins||20,f=a.minbins||4,p=+d-+s,h=a.unit?r[a.unit]:r.find(p,f,l),m=n({min:h.min!=null?h.min:h.unit(s),max:h.max!=null?h.max:h.unit(d),maxbins:l,minstep:h.minstep,steps:h.step});return m.unit=h,m.index=u,a.raw||(m.value=c),m},Ei=n}();const us=zn(ls);var Si,wi;function Ni(){if(wi)return Si;wi=1;var e=et(),t="__types__",n={boolean:e.boolean,integer:e.number,number:e.number,date:e.date,string:function(r){return r==null||r===""?null:r+""}},o={boolean:function(r){return r==="true"||r==="false"||e.isBoolean(r)},integer:function(r){return o.number(r)&&(r=+r)===~~r},number:function(r){return!isNaN(+r)&&!e.isDate(r)},date:function(r){return!isNaN(Date.parse(r))}};function i(r){return e.keys(r)}function c(r){return"["+r+"]"}function u(r,s){var d,l,f;if(r=e.array(r),s=e.$(s),r[t]&&(d=s(r[t]),e.isString(d)))return d;for(l=0,f=r.length;!e.isValid(d)&&lf;)m.push(h);else for(;(h=l+p*++v)=l&&m<=f?1/p:0},h.cdf=function(m){return mf?1:(m-l)/p},h.icdf=function(m){return m>=0&&m<=1?l+m*p:NaN},h},d.random.integer=function(l,f){f===void 0&&(f=l,l=0);var p=f-l,h=function(){return l+Math.floor(p*Math.random())};return h.samples=function(m){return d.zeros(m).map(h)},h.pdf=function(m){return m===Math.floor(m)&&m>=l&&m=f?1:(v-l+1)/p},h.icdf=function(m){return m>=0&&m<=1?l-1+Math.floor(m*p):NaN},h},d.random.normal=function(l,f){var p;l=l||0,f=f||1;var h=function(){var m,v,b=0,y=0;if(p!==void 0)return b=p,p=void 0,b;do m=(b=2*Math.random()-1)*b+(y=2*Math.random()-1)*y;while(m===0||m>1);return v=Math.sqrt(-2*Math.log(m)/m),p=l+y*v*f,l+b*v*f};return h.samples=function(m){return d.zeros(m).map(h)},h.pdf=function(m){var v=Math.exp(Math.pow(m-l,2)/(-2*Math.pow(f,2)));return 1/(f*Math.sqrt(2*Math.PI))*v},h.cdf=function(m){var v,b=(m-l)/f,y=Math.abs(b);if(y>37)v=0;else{var E=Math.exp(-y*y/2);y<7.07106781186547?(v=E*((((((.0352624965998911*y+.700383064443688)*y+6.37396220353165)*y+33.912866078383)*y+112.079291497871)*y+221.213596169931)*y+220.206867912376),v/=((((((.0883883476483184*y+1.75566716318264)*y+16.064177579207)*y+86.7807322029461)*y+296.564248779674)*y+637.333633378831)*y+793.826512519948)*y+440.413735824752):v=E/(y+1/(y+2/(y+3/(y+4/(y+.65)))))/2.506628274631}return b>0?1-v:v},h.icdf=function(m){if(m<=0||m>=1)return NaN;var v=2*m-1,b=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),y=2/(Math.PI*b)+Math.log(1-Math.pow(v,2))/2,E=Math.log(1-v*v)/b,T=(v>0?1:-1)*Math.sqrt(Math.sqrt(y*y-E)-y);return l+f*Math.SQRT2*T},h},d.random.bootstrap=function(l,f){var p=l.filter(s.isValid),h=p.length,m=f?d.random.normal(0,f):null,v=function(){return p[~~(Math.random()*h)]+(m?m():0)};return v.samples=function(b){return d.zeros(b).map(v)},v}}(ki)),ki.exports),i=e.exports;function c(r,s,d){var l=r&&r.nullh||0,f=o.random.normal(0,1),p=i.mean(s,d),h=i.stdev(s,d)/Math.sqrt(i.count.valid(s,d));if(h===0)return p-l===0?1:0;var m=(p-l)/h;return 2*f.cdf(-Math.abs(m))}function u(r,s,d,l){var f,p=l?s.map(t.$(d)):s,h=l?s.map(t.$(l)):d,m=i.count(p),v=i.count(h),b=Array();if(m!==v)throw Error("Array lengths must match.");for(f=0;f0?Math.pow(h,1/d):0},i.mean.harmonic=function(r,s){s=t.$(s);var d,l,f,p,h=0;for(p=0,d=0,l=r.length;pl&&(l=f));return[d,l]},i.extent.index=function(r,s){s=t.$(s);var d,l,f,p,h=-1,m=-1,v=r.length;for(p=0;pl&&(l=f,m=p));return[h,m]},i.dot=function(r,s,d){var l,f,p=0;if(d)for(s=t.$(s),d=t.$(d),l=0;l-1&&b!==l){for(f=1+(d-1+v)/2;v-1)for(f=1+(h-1+v)/2;vT)&&(T=h),S+=(d=h-m)*(h-(m+=d/++v)),N.push(h));return S/=v-1,l=Math.sqrt(S),N.sort(t.cmp),{type:n(r,s),unique:C,count:r.length,valid:v,missing:b,distinct:y,min:E,max:T,mean:m,stdev:l,median:p=i.quantile(N,.5),q1:i.quantile(N,.25),q3:i.quantile(N,.75),modeskew:l===0?0:(m-p)/l}},i.summary=function(r,s){var d=(s=s||t.keys(r[0])).map(function(l){var f=i.profile(r,t.$(l));return f.field=l,f});return d.__summary__=!0,d}}(Oi)),Oi.exports);const ps=us,Rt={nominal:0,key:1,ordinal:2,temporal:3,quantitative:4};class hs{constructor(t){this._tableSchema=t,t.fields.sort(function(n,o){return Rt[n.vlType]Rt[o.vlType]?1:n.name.localeCompare(o.name)}),t.fields.forEach((n,o)=>n.index=o),this._fieldSchemaIndex=t.fields.reduce((n,o)=>(n[o.name]=o,n),{})}fieldNames(){return this._tableSchema.fields.map(t=>t.name)}get fieldSchemas(){return this._tableSchema.fields}fieldSchema(t){return this._fieldSchemaIndex[t]}tableSchema(){const t=k.duplicate(this._tableSchema);return t.fields.sort((n,o)=>n.originalIndex-o.originalIndex),t}primitiveType(t){return this._fieldSchemaIndex[t]?this._fieldSchemaIndex[t].type:null}vlType(t){return this._fieldSchemaIndex[t]?this._fieldSchemaIndex[t].vlType:null}cardinality(t,n=!0,o=!1){const i=this._fieldSchemaIndex[t.field];if(t.aggregate||H(t)&&t.autoCount)return 1;if(t.bin){let c;c=typeof t.bin=="boolean"?{maxbins:Sn(t.channel)}:t.bin==="?"?{enum:[!0,!1]}:t.bin;const u=c.maxbins;return i.binStats[u]||(i.binStats[u]=Mi(u,i.stats)),i.binStats[u].distinct}if(t.timeUnit){if(n)switch(t.timeUnit){case W.SECONDS:case W.MINUTES:return 60;case W.HOURS:return 24;case W.DAY:return 7;case W.DATE:return 31;case W.MONTH:return 12;case W.QUARTER:return 4;case W.MILLISECONDS:return 1e3}let c=t.timeUnit,u=i.timeStats;return u&&u[c]||(u=Object.assign({},u,{[c]:Ii(t.timeUnit,i.stats)})),o?u[c].distinct-Ui(u[c].unique,["Invalid Date",null]):u[c].distinct}return i?o?i.stats.distinct-Ui(i.stats.unique,[NaN,null]):i.stats.distinct:null}timeUnitHasVariation(t){if(!t.timeUnit)return;if(t.timeUnit===W.DAY){const o=k.extend({},t,{timeUnit:W.DATE});if(this.cardinality(o,!1,!0)<=1)return!1}let n=t.timeUnit;for(let o of Fr)if(jr(n,o)){const i=k.extend({},t,{timeUnit:o});if(this.cardinality(i,!1,!0)<=1)return!1}return!0}domain(t){const n=this._fieldSchemaIndex[t.field];let o=k.keys(n.stats.unique);return n.vlType===R?[+n.stats.min,+n.stats.max]:n.type===L.DATETIME?[n.stats.min,n.stats.max]:n.type===L.INTEGER||n.type===L.NUMBER?(o=o.map(i=>+i),o.sort(k.cmp)):n.vlType===ce&&n.ordinalDomain?n.ordinalDomain:o.map(i=>i==="null"?null:i).sort(k.cmp)}stats(t){const n=this._fieldSchemaIndex[t.field];return n?n.stats:null}}function Mi(e,t){const n=ps({min:t.min,max:t.max,maxbins:e}),o=k.extend({},t);return o.unique=function(i,c){const u={};for(let a in c){let r;r=a===null?null:isNaN(Number(a))?NaN:i.value(Number(a)),u[r]=(u[r]||0)+c[a]}return u}(n,t.unique),o.distinct=(n.stop-n.start)/n.step,o.min=n.start,o.max=n.stop,o}function Ii(e,t){const n=k.extend({},t);let o={};return k.keys(t.unique).forEach(function(i){let c,u=i==="null"?null:new Date(i);c=u===null?null:isNaN(u.getTime())?"Invalid Date":(e===W.DAY?u.getDay():pa(e,u)).toString(),o[c]=(o[c]||0)+t.unique[i]}),n.unique=o,n.distinct=k.keys(o).length,n}function Ui(e,t){return t.reduce(function(n,o){return e[o]?n+1:n},0)}var L;(function(e){e[e.STRING="string"]="STRING",e[e.NUMBER="number"]="NUMBER",e[e.INTEGER="integer"]="INTEGER",e[e.BOOLEAN="boolean"]="BOOLEAN",e[e.DATETIME="datetime"]="DATETIME"})(L||(L={}));class Fi{constructor(t){this.constraint=t}name(){return this.constraint.name}description(){return this.constraint.description}properties(){return this.constraint.properties}strict(){return this.constraint.strict}}class Di extends Fi{constructor(t){super(t)}hasAllRequiredPropertiesSpecific(t){return fe(this.constraint.properties,n=>{if(pe(n)){let o=n.parent,i=n.child;return!t[o]||!w(t[o][i])}return!t[n]||!w(t[n])})}satisfy(t,n,o,i){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(t)||this.constraint.satisfy(t,n,o,i)}}const _i=[{name:"aggregateOpSupportedByType",description:"Aggregate function should be supported by data type.",properties:[g.TYPE,g.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.aggregate||!Lr(e.type)},{name:"asteriskFieldWithCountOnly",description:'Field="*" should be disallowed except aggregate="count"',properties:[g.FIELD,g.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>e.field==="*"==(e.aggregate==="count")},{name:"minCardinalityForBin",description:"binned quantitative field should not have too low cardinality",properties:[g.BIN,g.FIELD,g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{if(e.bin&&e.type===R){let i={channel:e.channel,field:e.field,type:e.type};return t.cardinality(i)>=o.minCardinalityForBin}return!0}},{name:"binAppliedForQuantitative",description:"bin should be applied to quantitative field only.",properties:[g.TYPE,g.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.bin||e.type===R},{name:"channelFieldCompatible",description:"encoding channel's range type be compatible with channel type.",properties:[g.CHANNEL,g.TYPE,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{const i=Object.assign({field:"f"},Mn(e,{schema:t,props:["bin","timeUnit","type"]})),{compatible:c}=Ta(i,e.channel);if(c)return!0;return!(e.channel!=="row"&&e.channel!=="column"||(u=i.timeUnit,!vn[u]&&!function(a){return!!bn[a]}(i.timeUnit)));var u}},{name:"hasFn",description:"A field with as hasFn flag should have one of aggregate, timeUnit, or bin.",properties:[g.AGGREGATE,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>!e.hasFn||!!e.aggregate||!!e.bin||!!e.timeUnit},{name:"omitScaleZeroWithBinnedField",description:"Do not use scale zero with binned field",properties:[g.SCALE,ge("scale","zero"),g.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.bin||!e.scale||e.scale.zero!==!0},{name:"onlyOneTypeOfFunction",description:"Only of of aggregate, autoCount, timeUnit, or bin should be applied at the same time.",properties:[g.AGGREGATE,g.AUTOCOUNT,g.TIMEUNIT,g.BIN],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>A(e)?(!w(e.aggregate)&&e.aggregate?1:0)+(!w(e.bin)&&e.bin?1:0)+(!w(e.timeUnit)&&e.timeUnit?1:0)<=1:!0},{name:"timeUnitAppliedForTemporal",description:"Time unit should be applied to temporal field only.",properties:[g.TYPE,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.timeUnit||e.type===Q},{name:"timeUnitShouldHaveVariation",description:"A particular time unit should be applied only if they produce unique values.",properties:[g.TIMEUNIT,g.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>!e.timeUnit||e.type!==Q||!n.has("timeUnit")&&!o.constraintManuallySpecifiedValue||t.timeUnitHasVariation(e)},{name:"scalePropertiesSupportedByScaleType",description:"Scale properties must be supported by correct scale type",properties:[].concat(Nt,[g.SCALE,g.TYPE]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>{if(e.scale){const i=e.scale,c=De(e);if(c==null)return!0;for(let u in i){if(u==="type"||u==="name"||u==="enum")continue;const a=u;if(c==="point"){if(!fn("point",a)&&!fn("band",a))return!1}else if(!fn(c,a))return!1}}return!0}},{name:"scalePropertiesSupportedByChannel",description:"Not all scale properties are supported by all encoding channels",properties:[].concat(Nt,[g.SCALE,g.CHANNEL]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>{if(e){let i=e.channel,c=e.scale;if(i&&!w(i)&&c){if(i==="row"||i==="column")return!1;for(let u in c)if(c.hasOwnProperty(u)&&!(u==="type"||u==="name"||u==="enum")&&ia(i,u)!==void 0)return!1}}return!0}},{name:"typeMatchesPrimitiveType",description:"Data type should be supported by field's primitive type.",properties:[g.FIELD,g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{if(e.field==="*")return!0;const i=t.primitiveType(e.field),c=e.type;if(!n.has("field")&&!n.has("type")&&!o.constraintManuallySpecifiedValue)return!0;switch(i){case L.BOOLEAN:case L.STRING:return c!==R&&c!==Q;case L.NUMBER:case L.INTEGER:return c!==Q;case L.DATETIME:return c===Q;case null:return!1}throw new Error("Not implemented")}},{name:"typeMatchesSchemaType",description:"Enumerated data type of a field should match the field's type in the schema.",properties:[g.FIELD,g.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>!(n.has("field")||n.has("type")||o.constraintManuallySpecifiedValue)||(e.field==="*"?e.type===R:t.vlType(e.field)===e.type)},{name:"maxCardinalityForCategoricalColor",description:"Categorical channel should not have too high cardinality",properties:[g.CHANNEL,g.FIELD],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>e.channel!==de||e.type!==ie&&e.type!==le.KEY||t.cardinality(e)<=o.maxCardinalityForCategoricalColor},{name:"maxCardinalityForFacet",description:"Row/column channel should not have too high cardinality",properties:[g.CHANNEL,g.FIELD,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>e.channel!==ne&&e.channel!==ee||t.cardinality(e)<=o.maxCardinalityForFacet},{name:"maxCardinalityForShape",description:"Shape channel should not have too high cardinality",properties:[g.CHANNEL,g.FIELD,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>e.channel!==Xe||t.cardinality(e)<=o.maxCardinalityForShape},{name:"dataTypeAndFunctionMatchScaleType",description:"Scale type must match data type",properties:[g.TYPE,g.SCALE,ge("scale","type"),g.TIMEUNIT,g.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{if(e.scale){const i=e.type,c=De(e);if(Lr(i))return c===void 0||Ie(c);if(i===Q)return e.timeUnit?te([j.TIME,j.UTC,void 0],c)||Ie(c):te([j.TIME,j.UTC,void 0],c);if(i===R)return e.bin?te([j.LINEAR,void 0],c):te([j.LOG,j.POW,j.SQRT,j.QUANTILE,j.QUANTIZE,j.LINEAR,void 0],c)}return!0}},{name:"stackIsOnlyUsedWithXY",description:"stack should only be allowed for x and y channels",properties:[g.STACK,g.CHANNEL],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.stack||e.channel===D||e.channel===_}].map(e=>new Di(e));_i.reduce((e,t)=>(e[t.name()]=t,e),{});const gs=_i.reduce((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new J),ji=[{name:"doesNotSupportConstantValue",description:"row, column, x, y, order, and detail should not work with constant values.",properties:[g.TYPE,g.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!te(["row","column","x","y","detail","order"],e.channel)}].map(e=>new Di(e));ji.reduce((e,t)=>(e[t.name()]=t,e),{});const ms=ji.reduce((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new J),ys=pr.reduce((e,t)=>(e[t]=!0,e),{});class vs extends Fi{constructor(t){super(t)}hasAllRequiredPropertiesSpecific(t){return fe(this.constraint.properties,n=>{if(n===g.MARK)return!w(t.getMark());if(pe(n)){let o=n.parent,i=n.child;return fe(t.getEncodings(),c=>!c[o]||!w(c[o][i]))}if(!Ir(n))throw new Error("UNIMPLEMENTED");return fe(t.getEncodings(),o=>!o[n]||!w(o[n]))})}satisfy(t,n,o){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(t)||this.constraint.satisfy(t,n,o)}}const Pi=[{name:"noRepeatedChannel",description:"Each encoding channel should only be used once.",properties:[g.CHANNEL],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let o={};return fe(e.getEncodings(),i=>!!w(i.channel)||!o[i.channel]&&(o[i.channel]=!0,!0))}},{name:"alwaysIncludeZeroInScaleWithBarMark",description:"Do not recommend bar mark if scale does not start at zero",properties:[g.MARK,g.SCALE,ge("scale","zero"),g.CHANNEL,g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const o=e.getMark(),i=e.getEncodings();if(o===me){for(let c of i)if(A(c)&&(c.channel===D||c.channel===_)&&c.type===R&&c.scale&&c.scale.zero===!1)return!1}return!0}},{name:"autoAddCount",description:"Automatically adding count only for plots with only ordinal, binned quantitative, or temporal with timeunit fields.",properties:[g.BIN,g.TIMEUNIT,g.TYPE,g.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>he(e.getEncodings(),o=>Dt(o))?fe(e.getEncodings(),o=>{if(oe(o)||H(o))return!0;switch(o.type){case R:return!!o.bin;case Q:return!!o.timeUnit;case ce:case le.KEY:case ie:return!0}throw new Error("Unsupported Type")}):fe(e.wildcardIndex.encodingIndicesByProperty.get("autoCount")||[],o=>{let i=e.getEncodingQueryByIndex(o);return H(i)&&!w(i.autoCount)})?he(e.getEncodings(),o=>(A(o)||H(o))&&o.type===R?!ae(o)&&A(o)&&(!o.bin||w(o.bin)):!(!A(o)||o.type!==Q)&&(!o.timeUnit||w(o.timeUnit))):!0},{name:"channelPermittedByMarkType",description:"Each encoding channel should be supported by the mark type",properties:[g.CHANNEL,g.MARK],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{const o=e.getMark();return!!w(o)||fe(e.getEncodings(),i=>!!w(i.channel)||!!Qo(i.channel,o))}},{name:"hasAllRequiredChannelsForMark",description:"All required channels for the specified mark should be specified",properties:[g.CHANNEL,g.MARK],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const o=e.getMark();switch(o){case Ue:case tt:return e.channelUsed(D)&&e.channelUsed(_);case Ot:return e.channelUsed(on);case me:case kt:case Mt:case rt:case yn:case mn:return e.channelUsed(D)||e.channelUsed(_);case nt:return!e.wildcardIndex.hasProperty(g.CHANNEL)||e.channelUsed(D)||e.channelUsed(_)}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+JSON.stringify(o))}},{name:"omitAggregate",description:"Omit aggregate plots.",properties:[g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()},{name:"omitAggregatePlotWithDimensionOnlyOnFacet",description:"Omit aggregate plots with dimensions only on facets as that leads to inefficient use of space.",properties:[g.CHANNEL,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let o=!1,i=!1,c=!1;if(e.specQuery.encodings.forEach((u,a)=>{oe(u)||ae(u)||A(u)&&!u.aggregate&&(i=!0,te([ne,ee],u.channel)?e.wildcardIndex.hasEncodingProperty(a,g.CHANNEL)&&(c=!0):o=!0)}),i&&!o&&(c||n.constraintManuallySpecifiedValue))return!1}return!0}},{name:"omitAggregatePlotWithoutDimension",description:"Aggregate plots without dimension should be omitted",properties:[g.AGGREGATE,g.AUTOCOUNT,g.BIN,g.TIMEUNIT,g.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()||he(e.getEncodings(),o=>!!(Ne(o)||A(o)&&o.type==="temporal"))},{name:"omitBarLineAreaWithOcclusion",description:"Don't use bar, line or area to visualize raw plot as they often lead to occlusion.",properties:[g.MARK,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!te([me,tt,Ue],e.getMark())||e.isAggregate()},{name:"omitBarTickWithSize",description:"Do not map field to size channel with bar and tick mark",properties:[g.CHANNEL,g.MARK],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{const o=e.getMark();if(te([rt,me],o)&&e.channelEncodingField(Te)){if(n.constraintManuallySpecifiedValue)return!1;{const i=e.specQuery.encodings;for(let c=0;c{const o=e.getMark(),i=e.getEncodings();if(o===Ue||o===me){for(let c of i)if(A(c)&&(c.channel===D||c.channel===_)&&c.scale&&De(c)===j.LOG)return!1}return!0}},{name:"omitMultipleNonPositionalChannels",description:"Unless manually specified, do not use multiple non-positional encoding channel to avoid over-encoding.",properties:[g.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{const o=e.specQuery.encodings;let i=0,c=!1;for(let u=0;u1&&(c||n.constraintManuallySpecifiedValue)))return!1}return!0}},{name:"omitNonPositionalOrFacetOverPositionalChannels",description:"Do not use non-positional channels unless all positional channels are used",properties:[g.CHANNEL],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{const o=e.specQuery.encodings;let i=!1,c=!1,u=!1,a=!1;for(let r=0;r!!e.isAggregate()},{name:"omitRawContinuousFieldForAggregatePlot",description:"Aggregate plot should not use raw continuous field as group by values. (Quantitative should be binned. Temporal should have time unit.)",properties:[g.AGGREGATE,g.AUTOCOUNT,g.TIMEUNIT,g.BIN,g.TYPE],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){const o=e.specQuery.encodings;for(let i=0;i!!e.isAggregate()||fe(e.specQuery.encodings,(o,i)=>!(!oe(o)&&!ae(o))||o.channel!==an||!e.wildcardIndex.hasEncodingProperty(i,g.CHANNEL)&&!n.constraintManuallySpecifiedValue)},{name:"omitRepeatedField",description:"Each field should be mapped to only one channel",properties:[g.FIELD],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let o={},i={};const c=e.specQuery.encodings;for(let u=0;u{const o=e.getEncodings();return o.length!==1||o[0].channel!==_}},{name:"hasAppropriateGraphicTypeForMark",description:"Has appropriate graphic type for mark",properties:[g.CHANNEL,g.MARK,g.TYPE,g.TIMEUNIT,g.BIN,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{const o=e.getMark();switch(o){case Ue:case tt:if(e.isAggregate()){const l=e.getEncodingQueryByChannel(D),f=e.getEncodingQueryByChannel(_),p=at(l),h=at(f);return l&&f&&p!==h&&!(A(l)&&!p&&te(["nominal","key"],l.type))&&!(A(f)&&!h&&te(["nominal","key"],f.type))}return!0;case Ot:return!0;case me:case rt:if(e.channelEncodingField(Te))return!1;{const l=e.getEncodingQueryByChannel(D),f=e.getEncodingQueryByChannel(_);return at(l)!==at(f)}case mn:const i=e.getEncodingQueryByChannel(D),c=e.getEncodingQueryByChannel(_),u=Ne(i),a=Ne(c),r=e.getEncodingQueryByChannel(de),s=at(r),d=!!A(r)&&r.type===ce;return(u&&a||u&&!e.channelUsed(_)||a&&!e.channelUsed(D))&&(!r||r&&(s||d));case kt:case nt:case Mt:case yn:return!0}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+o)}},{name:"omitInvalidStackSpec",description:"If stack is specified, must follow Vega-Lite stack rules",properties:[g.STACK,g.FIELD,g.CHANNEL,g.MARK,g.AGGREGATE,g.AUTOCOUNT,g.SCALE,ge("scale","type"),g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{if(!e.wildcardIndex.hasProperty(g.STACK))return!0;const o=e.getVlStack();return(o!==null||e.getStackOffset()===null)&&o.fieldChannel===e.getStackChannel()}},{name:"omitNonSumStack",description:"Stack specifications that use non-summative aggregates should be omitted (even implicit ones)",properties:[g.CHANNEL,g.MARK,g.AGGREGATE,g.AUTOCOUNT,g.SCALE,ge("scale","type"),g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const o=e.getVlStack();if(o!=null){const i=e.getEncodingQueryByChannel(o.fieldChannel);if(!te(Pr,i.aggregate))return!1}return!0}},{name:"omitTableWithOcclusionIfAutoAddCount",description:"Plots without aggregation or autocount where x and y are both discrete should be omitted if autoAddCount is enabled as they often lead to occlusion",properties:[g.CHANNEL,g.TYPE,g.TIMEUNIT,g.BIN,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(n.autoAddCount){const o=e.getEncodingQueryByChannel("x"),i=e.getEncodingQueryByChannel("y");if((!A(o)||Ne(o))&&(!A(i)||Ne(i)))return!!e.isAggregate()&&fe(e.getEncodings(),c=>{let u=c.channel;return!(u!==D&&u!==_&&u!==ne&&u!==ee&&A(c)&&!c.aggregate)})}return!0}}].map(e=>new vs(e));Pi.reduce((e,t)=>(e[t.name()]=t,e),{});const bs=Pi.reduce((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new J);function Ri(e,t,n,o,i){const c=bs.get(e)||[];for(const u of c)if((u.strict()||i[u.name()])&&!u.satisfy(n,o,i)){let a="(spec) "+u.name();return i.verbose&&console.log(a+" failed with "+n.toShorthand()+" for "+t.name),a}return null}const $t=new J;function $i(e){return(t,n,o)=>(i,c)=>{const u=t.encodingIndicesByProperty.get(e);return function a(r){if(r===u.length)return void i.push(c.duplicate());const s=u[r],d=t.encodings[s].get(e),l=c.getEncodingQueryByIndex(s),f=c.getEncodingProperty(s,e);oe(l)||ae(l)||!f?a(r+1):(d.enum.forEach(p=>{p===null&&(p=void 0),c.setEncodingProperty(s,e,p,d),!function(m,v,b,y,E,T){const S=gs.get(m)||[],N=y.getEncodingQueryByIndex(b);for(const O of S)if((O.strict()||T[O.name()])&&!O.satisfy(N,E,y.wildcardIndex.encodings[b],T)){let M="(enc) "+O.name();return T.verbose&&console.log(M+" failed with "+y.toShorthand()+" for "+v.name),M}const C=ms.get(m)||[];for(const O of C)if((O.strict()||T[O.name()])&&oe(N)&&!O.satisfy(N,E,y.wildcardIndex.encodings[b],T)){let M="(enc) "+O.name();return T.verbose&&console.log(M+" failed with "+y.toShorthand()+" for "+v.name),M}return null}(e,d,s,c,n,o)&&(Ri(e,d,c,n,o)||a(r+1))}),c.resetEncodingProperty(s,e,d))}(0),i}}function ct(e,t,n){return t=t||new J,n=n||new J,e.forEach(o=>{var i;i=o,k.isObject(i)&&i.property?(t.setByKey(o.property,!0),n.setByKey(o.property,o.replace)):t.setByKey(o,!0)}),{include:t,replaceIndex:n,replacer:Oa(n)}}$t.set("mark",(e,t,n)=>(o,i)=>(i.getMark().enum.forEach(c=>{i.setMark(c),Ri("mark",e.mark,i,t,n)||o.push(i.duplicate())}),i.resetMark(),o)),pn.forEach(e=>{$t.set(e,$i(e))}),Ct.forEach(e=>{$t.set(e,$i(e))});const Bi=[g.FIELD,g.TYPE,g.AGGREGATE,g.BIN,g.TIMEUNIT,g.STACK],xs=Bi.concat([{property:g.CHANNEL,replace:{x:"xy",y:"xy",color:"style",size:"style",shape:"style",opacity:"style",row:"facet",column:"facet"}}]);let Fn={};function Bt(e,t){Fn[e]=t}const Li=ct([g.FIELD]);Bt("field",e=>qe(e,Li.include,Li.replacer));const Wi=ct(Bi);Bt("fieldTransform",e=>qe(e,Wi.include,Wi.replacer));const Hi=ct(xs);Bt("encoding",e=>qe(e,Hi.include,Hi.replacer)),Bt("spec",e=>JSON.stringify(e));class Es{constructor(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty=new J}setEncodingProperty(t,n,o){const i=this._encodings;(i[t]=i[t]||new J).set(n,o);const c=this._encodingIndicesByProperty;return c.set(n,c.get(n)||[]),c.get(n).push(t),this}hasEncodingProperty(t,n){return!!this._encodings[t]&&this._encodings[t].has(n)}hasProperty(t){if(Ir(t))return this.encodingIndicesByProperty.has(t);if(t==="mark")return!!this.mark;throw new Error("Unimplemented for property "+t)}isEmpty(){return!this.mark&&this.encodingIndicesByProperty.size()===0}setMark(t){return this._mark=t,this}get mark(){return this._mark}get encodings(){return this._encodings}get encodingIndicesByProperty(){return this._encodingIndicesByProperty}}class Qt{constructor(t,n,o,i,c){this._rankingScore={},this._spec=t,this._channelFieldCount=t.encodings.reduce((u,a)=>(w(a.channel)||H(a)&&a.autoCount===!1||(u[a.channel+""]=1),u),{}),this._wildcardIndex=n,this._assignedWildcardIndex=c,this._opt=i,this._schema=o}static build(t,n,o){let i=new Es;if(w(t.mark)){const c=it(g.MARK);t.mark=xn(t.mark,c,o.enum.mark),i.setMark(t.mark)}if(t.encodings.forEach((c,u)=>{H(c)&&(console.warn("A field with autoCount should not be included as autoCount meant to be an internal object."),c.type=R),A(c)&&c.type===void 0&&(c.type=P),pn.forEach(a=>{if(w(c[a])){const r=it(a)+u,s=Tn(a,n,o),d=c[a]=xn(c[a],r,s);i.setEncodingProperty(u,a,d)}}),Ct.forEach(a=>{const r=c[a.parent];if(r){const s=a.child;if(w(r[s])){const d=it(a)+u,l=Tn(a,n,o),f=r[s]=xn(r[s],d,l);i.setEncodingProperty(u,a,f)}}})}),o.autoAddCount){const c={name:it(g.CHANNEL)+t.encodings.length,enum:Tn(g.CHANNEL,n,o)},u={name:it(g.AUTOCOUNT)+t.encodings.length,enum:[!1,!0]},a={channel:c,autoCount:u,type:R};t.encodings.push(a);const r=t.encodings.length-1;i.setEncodingProperty(r,g.CHANNEL,c),i.setEncodingProperty(r,g.AUTOCOUNT,u)}return new Qt(t,i,n,o,{})}get wildcardIndex(){return this._wildcardIndex}get schema(){return this._schema}get specQuery(){return this._spec}duplicate(){return new Qt(k.duplicate(this._spec),this._wildcardIndex,this._schema,this._opt,k.duplicate(this._assignedWildcardIndex))}setMark(t){const n=this._wildcardIndex.mark.name;this._assignedWildcardIndex[n]=this._spec.mark=t}resetMark(){const t=this._spec.mark=this._wildcardIndex.mark;delete this._assignedWildcardIndex[t.name]}getMark(){return this._spec.mark}getEncodingProperty(t,n){const o=this._spec.encodings[t];return pe(n)?o[n.parent][n.child]:o[n]}setEncodingProperty(t,n,o,i){const c=this._spec.encodings[t];n===g.CHANNEL&&c.channel&&!w(c.channel)&&this._channelFieldCount[c.channel]--,pe(n)?c[n.parent][n.child]=o:hn(n)&&o===!0?c[n]=k.extend({},c[n],{enum:void 0,name:void 0}):c[n]=o,this._assignedWildcardIndex[i.name]=o,n===g.CHANNEL&&(this._channelFieldCount[o]=(this._channelFieldCount[o]||0)+1)}resetEncodingProperty(t,n,o){const i=this._spec.encodings[t];n===g.CHANNEL&&this._channelFieldCount[i.channel]--,pe(n)?i[n.parent][n.child]=o:i[n]=o,delete this._assignedWildcardIndex[o.name]}channelUsed(t){return this._channelFieldCount[t]>0}channelEncodingField(t){return A(this.getEncodingQueryByChannel(t))}getEncodings(){return this._spec.encodings.filter(t=>!ae(t))}getEncodingQueryByChannel(t){for(let n of this._spec.encodings)if(n.channel===t)return n}getEncodingQueryByIndex(t){return this._spec.encodings[t]}isAggregate(){return he(this._spec.encodings,t=>A(t)&&!w(t.aggregate)&&!!t.aggregate||Dt(t))}getVlStack(){return Hr(this._spec)}getStackOffset(){return function(t){for(const n of t.encodings)if(n[g.STACK]!==void 0&&!w(n[g.STACK]))return n[g.STACK]}(this._spec)}getStackChannel(){return function(t){for(const n of t.encodings)if(n[g.STACK]!==void 0&&!w(n.channel))return n.channel;return null}(this._spec)}toShorthand(t){if(t){if(k.isString(t))return function(o,i){return Fn[i](o)}(this.specQuery,t);const n=ct(t);return qe(this._spec,n.include,n.replacer)}return qe(this._spec)}toSpec(t){if(w(this._spec.mark))return null;let n={};return(t=t||this._spec.data)&&(n.data=t),this._spec.transform&&(n.transform=this._spec.transform),n.mark=this._spec.mark,n.encoding=Qr(this.specQuery.encodings,{schema:this._schema,wildcardMode:"null"}),this._spec.width&&(n.width=this._spec.width),this._spec.height&&(n.height=this._spec.height),this._spec.background&&(n.background=this._spec.background),this._spec.padding&&(n.padding=this._spec.padding),this._spec.title&&(n.title=this._spec.title),n.encoding===null?null:((this._spec.config||this._opt.defaultSpecConfig)&&(n.config=k.extend({},this._opt.defaultSpecConfig,this._spec.config)),n)}getRankingScore(t){return this._rankingScore[t]}setRankingScore(t,n){this._rankingScore[t]=n}}function qi(e){return e.items!==void 0}function Dn(e){let t=e.items[0];for(;t&&qi(t);)t=t.items[0];return t}class Ge{constructor(t){this.type=t,this.scoreIndex=this.initScore()}getFeatureScore(t){const n=this.type,o=this.scoreIndex[t];if(o!==void 0)return{type:n,feature:t,score:o}}}var Z;(function(e){e[e.Q=R]="Q",e[e.BIN_Q="bin_"+R]="BIN_Q",e[e.T=Q]="T",e[e.TIMEUNIT_T="timeUnit_time"]="TIMEUNIT_T",e[e.TIMEUNIT_O="timeUnit_"+ce]="TIMEUNIT_O",e[e.O=ce]="O",e[e.N=ie]="N",e[e.K=le.KEY]="K",e[e.NONE="-"]="NONE"})(Z||(Z={}));const Gi=Z.Q,Lt=Z.BIN_Q,_n=Z.T,ze=Z.TIMEUNIT_T,Wt=Z.TIMEUNIT_O,Ht=Z.O,qt=Z.N,jn=Z.K,Gt=Z.NONE;function zt(e){return e.bin?Z.BIN_Q:e.timeUnit?Ie(De(e))?Z.TIMEUNIT_O:Z.TIMEUNIT_T:e.type}const Pn=-10;function q(e,t,n,o){return e+"_"+t+"_"+n+"_"+o}const Ts=[new class extends Ge{constructor(){super("Axis")}initScore(e={}){e=Object.assign({},ot,e);let t={};return[{feature:Lt,opt:"preferredBinAxis"},{feature:_n,opt:"preferredTemporalAxis"},{feature:ze,opt:"preferredTemporalAxis"},{feature:Wt,opt:"preferredTemporalAxis"},{feature:Ht,opt:"preferredOrdinalAxis"},{feature:qt,opt:"preferredNominalAxis"}].forEach(n=>{e[n.opt]===D?t[n.feature+"_"+_]=-.01:e[n.opt]===_&&(t[n.feature+"_"+D]=-.01)}),t}featurize(e,t){return e+"_"+t}getScore(e,t,n){return e.getEncodings().reduce((o,i)=>{if(A(i)||H(i)){const c=zt(i),u=this.featurize(c,i.channel),a=this.getFeatureScore(u);a&&o.push(a)}return o},[])}},new class extends Ge{constructor(){super("Dimension")}initScore(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}getScore(e,t,n){return e.isAggregate()&&e.getEncodings().reduce((o,i)=>{if(H(i)||A(i)&&!i.aggregate){const c=this.getFeatureScore(i.channel+"");if(c&&c.score>o.score)return c}return o},{type:"Dimension",feature:"No Dimension",score:-5}),[]}},new class extends Ge{constructor(){super("Facet")}initScore(e){let t={};return(e=Object.assign({},ot,e)).preferredFacet===ne?t[ee]=-.01:e.preferredFacet===ee&&(t[ne]=-.01),t}getScore(e,t,n){return e.getEncodings().reduce((o,i)=>{if(A(i)||H(i)){const c=this.getFeatureScore(i.channel);c&&o.push(c)}return o},[])}},new class extends Ge{constructor(){super("Mark")}initScore(){return function(){const e=[Gi,_n],t=[Lt,Wt,Ht,qt,jn].concat([Gt]);let n={};e.forEach(o=>{e.forEach(i=>{V({point:0,text:-.2,tick:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!0,u);n[a]=c}),V({point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c})})}),e.forEach(o=>{t.forEach(i=>{V({tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!0,u);n[a]=c;const r=q(i,o,!0,u);n[r]=c})}),[ze].forEach(i=>{V({point:0,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!0,u);n[a]=c;const r=q(i,o,!0,u);n[r]=c})}),[Gt,qt,Ht,jn].forEach(i=>{V({bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c;const r=q(i,o,!1,u);n[r]=c})}),[Lt].forEach(i=>{V({bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c;const r=q(i,o,!1,u);n[r]=c})}),[ze,Wt].forEach(i=>{V({line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c;const r=q(i,o,!1,u);n[r]=c})})}),[ze].forEach(o=>{[ze].forEach(i=>{const c={point:0,rect:-.1,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};V(c,(u,a)=>{const r=q(o,i,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(o,i,!1,a);n[r]=u})}),t.forEach(i=>{const c={tick:0,point:-.2,text:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};V(c,(u,a)=>{const r=q(o,i,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(i,o,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(o,i,!1,a);n[r]=u}),V(c,(u,a)=>{const r=q(i,o,!1,a);n[r]=u})})});for(const o of t)for(const i of t){const c={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};V(c,(u,a)=>{const r=q(o,i,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(o,i,!1,a);n[r]=u})}return n}()}getScore(e,t,n){let o=e.getMark();o!==kt&&o!==Mt||(o=nt);const i=e.getEncodingQueryByChannel(D),c=i?zt(i):Gt,u=e.getEncodingQueryByChannel(_),a=c+"_"+(u?zt(u):Gt)+"_"+!e.isAggregate()+"_"+o,r=this.getFeatureScore(a);return r?[r]:(console.error("feature score missing for",a),[])}},new class extends Ge{constructor(){super("SizeChannel")}initScore(){return{bar_size:-2,tick_size:-2}}getScore(e,t,n){const o=e.getMark();return e.getEncodings().reduce((i,c)=>{if(A(c)||H(c)){const u=o+"_"+c.channel,a=this.getFeatureScore(u);a&&i.push(a)}return i},[])}},new class extends Ge{constructor(){super("TypeChannel")}initScore(){let e={};const t={x:0,y:0,size:-.575,color:-.725,text:-2,opacity:-3,shape:Pn,row:Pn,column:Pn,detail:-20};[Gi,_n,ze].forEach(i=>{k.keys(t).forEach(c=>{e[this.featurize(i,c)]=t[c]})});const n=k.extend({},t,{row:-.75,column:-.75,shape:-3.1,text:-3.2,detail:-4});[Lt,Wt,Ht].forEach(i=>{k.keys(n).forEach(c=>{e[this.featurize(i,c)]=n[c]})});const o={x:0,y:0,color:-.6,shape:-.65,row:-.7,column:-.7,text:-.8,detail:-2,size:-3,opacity:-3.1};return k.keys(o).forEach(i=>{e[this.featurize(qt,i)]=o[i],e[this.featurize(jn,i)]=te(["x","y","detail"],i)?-1:o[i]-2}),e}featurize(e,t){return e+"_"+t}getScore(e,t,n){const o=e.getEncodings().reduce((c,u)=>{if(A(u)||H(u)){const a=zr(u);(c[a]=c[a]||[]).push(u)}return c},{}),i=[];return V(o,c=>{const u=c.reduce((a,r)=>{if(A(r)||H(r)){const s=zt(r),d=this.featurize(s,r.channel),l=this.getFeatureScore(d);if(a===null||l.score>a.score)return l}return a},null);i.push(u)}),i}}],Ce="aggregationQuality";let zi={};function Rn(e,t){zi[e]=t}function Yi(e,t,n,o){return t.nest&&o!==t.nest.length?(e.items.forEach(i=>{Yi(i,t,n,o+1)}),t.nest[o].orderGroupBy&&e.items.sort(function(i,c,u){return(a,r)=>{const s=Dn(a),d=Dn(r);return Qi(i instanceof Array?i:[i],s,d,c,u)}}(t.nest[o].orderGroupBy,n,t.config))):(t.orderBy||t.chooseBy)&&(e.items.sort(function(i,c,u){return(a,r)=>Qi(i instanceof Array?i:[i],a,r,c,u)}(t.orderBy||t.chooseBy,n,t.config)),t.chooseBy&&e.items.length>0&&e.items.splice(1)),e}function Qi(e,t,n,o,i){for(let c of e){let u=Vi(n,c,o,i).score-Vi(t,c,o,i).score;if(u!==0)return u}return 0}function Vi(e,t,n,o){if(e.getRankingScore(t)!==void 0)return e.getRankingScore(t);const i=function(u){return zi[u]}(t),c=i(e,n,o);return e.setRankingScore(t,c),c}function Ss(e,t,n){let o={};return e=e.map(function(i){return n.smallRangeStepForHighCardinalityOrFacet&&(i=function(c,u,a,r){[ne,_,ee,D].forEach(l=>{a[l]=c.getEncodingQueryByChannel(l)});const s=a[_];if(s!==void 0&&A(s)&&(a[ne]||u.cardinality(s)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){s.scale===void 0&&(s.scale={});const l=De(s);s.scale&&(l===void 0||Ie(l))&&(s.scale.rangeStep||(s.scale.rangeStep=12))}const d=a[D];if(A(d)&&(a[ee]||u.cardinality(d)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){d.scale===void 0&&(d.scale={});const l=De(d);d.scale&&(l===void 0||Ie(l))&&(d.scale.rangeStep||(d.scale.rangeStep=12))}return c}(i,t,o,n)),n.nominalColorScaleForHighCardinality&&(i=function(c,u,a,r){a[de]=c.getEncodingQueryByChannel(de);const s=a[de];return A(s)&&s!==void 0&&(s.type===ie||s.type===le.KEY)&&u.cardinality(s)>r.nominalColorScaleForHighCardinality.maxCardinality&&(s.scale===void 0&&(s.scale={}),s.scale&&(s.scale.range||(s.scale.scheme=r.nominalColorScaleForHighCardinality.palette))),c}(i,t,o,n)),n.xAxisOnTopForHighYCardinalityWithoutColumn&&(i=function(c,u,a,r){if([ee,D,_].forEach(s=>{a[s]=c.getEncodingQueryByChannel(s)}),a[ee]===void 0){const s=a[D],d=a[_];A(s)&&A(d)&&d!==void 0&&d.field&&Ie(De(d))&&s!==void 0&&u.cardinality(d)>r.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality&&(s.axis===void 0&&(s.axis={}),s.axis&&!s.axis.orient&&(s.axis.orient="top"))}return c}(i,t,o,n)),i}),e}function ws(e,t,n=ot){const o=Qt.build(e,t,n),i=o.wildcardIndex;let c=[o];return n.propertyPrecedence.forEach(u=>{const a=function(r){const s=r.split(".");if(s.length===1)return r;if(s.length===2)return{parent:s[0],child:s[1]};throw"Invalid property key with "+s.length+" dots: "+r}(u);if(i.hasProperty(a)){const r=function(d){return $t.get(d)}(a),s=r(i,t,n);c=c.reduce(s,[])}}),!n.stylize||n.nominalColorScaleForHighCardinality===null&&n.smallRangeStepForHighCardinalityOrFacet===null&&n.xAxisOnTopForHighYCardinalityWithoutColumn===null?c:Ss(c,t,n)}function Ki(e,t,n){return e=Object.assign({},function(o){if(o.groupBy){let i={groupBy:o.groupBy};o.orderBy&&(i.orderGroupBy=o.orderBy);let c={spec:k.duplicate(o.spec),nest:[i]};return o.chooseBy&&(c.chooseBy=o.chooseBy),o.config&&(c.config=o.config),c}return k.duplicate(o)}(e),{config:Object.assign({},ot,n,e.config)}),{query:e,result:Yi(function(o,i){if(i){const c={name:"",path:"",items:[]};let u={},a=[],r=[],s=[];for(let d=0;d0?a[d-1].duplicate():new J),r.push(d>0?r[d-1].duplicate():new J);const l=i[d].groupBy;if(k.isArray(l)){let f=ct(l,a[d],r[d]);s.push(f.replacer)}}return o.forEach(d=>{let l="",f=c;for(let p=0;p{const u=c.getScore(e,t,n);return i.concat(u)},[]);return{score:o.reduce((i,c)=>i+c.score,0),features:o}}),Rn(Ce,function(e,t,n){const o=function(i){const c=i.getEncodings();if(i.isAggregate()){if(he(c,u=>A(u)&&(u.type===R&&!u.bin&&!u.aggregate||u.type===Q&&!u.timeUnit)))return{type:Ce,score:.1,feature:"Aggregate with raw continuous"};if(he(c,u=>A(u)&&Ne(u))){let u=he(c,r=>A(r)&&r.aggregate==="count"||Dt(r)),a=he(c,r=>A(r)&&!!r.bin);return u?{type:Ce,score:.8,feature:"Aggregate with count"}:a?{type:Ce,score:.7,feature:"Aggregate with bin but without count"}:{type:Ce,score:.9,feature:"Aggregate without count and without bin"}}return{type:Ce,score:.3,feature:"Aggregate without dimension"}}return he(c,u=>A(u)&&!Ne(u))?{type:Ce,score:1,feature:"Raw with measure"}:{type:Ce,score:.2,feature:"Raw without measure"}}(e);return{score:o.score,features:[o]}}),Rn("fieldOrder",function(e,t,n){const o=e.wildcardIndex.encodingIndicesByProperty.get("field");if(!o)return{score:0,features:[]};const i=e.specQuery.encodings,c=t.fieldSchemas.length,u=[];let a=0,r=1;for(let s=o.length-1;s>=0;s--){const d=o[s],l=i[d];let f;if(!A(l))continue;f=l.field;const p=e.wildcardIndex.encodings[d].get("field"),h=t.fieldSchema(f).index,m=-h*r;a+=m,u.push({score:m,type:"fieldOrder",feature:`field ${p.name} is ${f} (#${h} in the schema)`}),r*=c}return{score:a,features:u}});const Ye={[L.BOOLEAN]:x.jsx(yo,{className:"h-5 w-5 inline-flex opacity-60"}),[L.DATETIME]:x.jsx(mo,{className:"h-5 w-5 inline-flex opacity-60"}),[L.NUMBER]:x.jsx(go,{className:"h-5 w-5 inline-flex opacity-60"}),[L.STRING]:x.jsx(ho,{className:"h-5 w-5 inline-flex opacity-60"}),[L.INTEGER]:x.jsx(Wo,{className:"h-5 w-5 inline-flex opacity-60"})},Ns=e=>{const t=Ee.c(26),{schema:n}=e,[o,i]=Yn.useState(),[c,u]=Yn.useState();let a;if(t[0]!==n||t[1]!==o||t[2]!==c){const r=n.fieldNames(),s=o?n.stats({field:o,channel:"x"}):void 0;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=x.jsx(Lo,{className:"text-muted-foreground",width:40,height:40,strokeWidth:1.5}),t[4]=d):d=t[4];const l=d,f=c?r:r.slice(0,12),p=r.length>12,h=r.length>0?r.length:"No";let m,v;t[5]!==h?(m=x.jsxs("span",{className:"text-muted-foreground font-semibold",children:[h," fields"]}),t[5]=h,t[6]=m):m=t[6],t[7]!==n||t[8]!==o?(v=I=>{const F=n.cardinality({channel:"x",field:I});return x.jsxs("span",{className:vo("hover:bg-muted self-start px-2 py-2 rounded flex flex-row gap-1 items-center cursor-pointer lg:justify-center text-sm truncate flex-shrink-0 overflow-hidden",o===I&&"bg-muted"),onClick:()=>{i(o!==I?I:void 0)},children:[Ye[n.primitiveType(I)],I,F>1&&x.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",F,")"]})]},I)},t[7]=n,t[8]=o,t[9]=v):v=t[9];const b=f.map(v);let y,E;t[10]!==p||t[11]!==c?(y=p&&x.jsx(Qn,{"data-testid":"marimo-plugin-data-explorer-show-more-columns",variant:"link",size:"sm",className:"self-center col-span-3 -mt-1",onClick:()=>u(Os),children:c?"Show less":"Show more"}),t[10]=p,t[11]=c,t[12]=y):y=t[12],t[13]!==b||t[14]!==y?(E=x.jsxs("div",{className:"hidden lg:grid grid-cols-2 xl:grid-cols-3 gap-2 p-2 bg-[var(--slate-1)] border rounded lg:items-center items-start w-fit grid-flow-dense max-h-[300px] overflow-auto",children:[b,y]}),t[13]=b,t[14]=y,t[15]=E):E=t[15];const T=o||"",S=r.length===0;let N,C,O,M,U;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=I=>{i(I)},t[16]=N):N=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(C=x.jsx(pt,{className:"min-w-[210px] h-full",children:x.jsx(Vn,{placeholder:"Select a column"})}),t[17]=C):C=t[17],t[18]!==n?(O=n.fieldNames().map(I=>x.jsx(ke,{value:I.toString(),children:x.jsxs("span",{className:"flex items-center gap-2 flex-1",children:[Ye[n.primitiveType(I)],x.jsx("span",{className:"flex-1",children:I}),x.jsxs("span",{className:"text-muted-foreground text-xs font-semibold",children:["(",n.vlType(I),")"]})]})},I)),t[18]=n,t[19]=O):O=t[19],t[20]!==O?(M=x.jsx(ht,{children:x.jsx(Ke,{children:O})}),t[20]=O,t[21]=M):M=t[21],t[22]!==S||t[23]!==M||t[24]!==T?(U=x.jsx("div",{className:"lg:hidden",children:x.jsxs(gt,{"data-testid":"marimo-plugin-data-explorer-column-select",value:T,disabled:S,onValueChange:N,children:[C,M]})}),t[22]=S,t[23]=M,t[24]=T,t[25]=U):U=t[25],a=x.jsxs("div",{className:"flex flex-col justify-center items-center h-full flex-1 gap-2",children:[l,m,E,U,o&&x.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-2 p-2 text-sm",children:Cs.map(I=>x.jsxs("div",{className:"flex flex-row gap-2 min-w-[100px]",children:[x.jsx("span",{className:"font-semibold",children:I}),x.jsx("span",{children:As(s==null?void 0:s[I])})]},I))})]}),t[0]=n,t[1]=o,t[2]=c,t[3]=a}else a=t[3];return a},Cs=["distinct","min","max","mean","median","q1","q3","stdev"];function As(e){return typeof e=="number"?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):typeof e=="string"?e:typeof e=="object"&&e instanceof Date?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(e):String(e)}function Os(e){return!e}function ks(e){return e?e==="bin"?{bin:!0}:Ro(e)?{aggregate:e}:function(t){return t?Ji.includes(t)||Xi.includes(t):!1}(e)?{timeUnit:e}:{}:{}}const Ms=["bin","min","max","mean","median","sum"],Ji=["year","month","date","day","hours","minutes","seconds","milliseconds"],Xi=["yearmonth","yearmonthdate","monthdate"],Is=[P,"area","bar","circle","geoshape","line","point","rect","rule","square","text","tick","trail"],Us={type:"histograms",limit:12,createQuery:e=>({spec:{data:e.spec.data,mark:P,transform:e.spec.transform,encodings:[{channel:P,bin:P,timeUnit:P,field:P,type:P},{channel:P,aggregate:"count",field:"*",type:"quantitative"}]},groupBy:"fieldTransform",orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:{autoAddCount:!1}})};function Zi(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Fs(e){const{aggregate:t,bin:n,timeUnit:o,field:i,scale:c,legend:u,axis:a,sort:r,description:s}=e;let{type:d}=e;if(w(d))throw new Error("Wildcard not support");d==="ordinal"&&(bo.warn("Ordinal type is not supported. Using nominal type instead."),d="nominal");const l=function(f){const{aggregate:p,bin:h,timeUnit:m}=f;return h?"bin":p?p.toString():m?m.toString():void 0}({aggregate:t,bin:n,timeUnit:o});return xo(i!==void 0,"Field is required for fieldQ"),Zi({field:i,fn:l,type:d,sort:r,scale:c,axis:a,legend:u,description:s})}function Ds(e){return e?Object.entries(e).map(([t,n])=>function(o,i){const{fn:c,...u}=o;return{channel:i,...ks(c),...u}}(n,t)):[]}function $n(e){const{type:t,limit:n,additionalFieldQuery:o}=e;return{type:t,limit:n,createQuery:i=>({spec:{...i.spec,encodings:[...i.spec.encodings,o]},groupBy:"field",orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:{autoAddCount:!0}})}}const _s=$n({type:"addCategoricalField",limit:4,additionalFieldQuery:{channel:P,field:P,type:"nominal"}}),js=$n({type:"addQuantitativeField",limit:4,additionalFieldQuery:{channel:P,bin:P,aggregate:P,field:P,type:"quantitative"}}),Ps=$n({type:"addTemporalField",limit:2,additionalFieldQuery:{channel:P,hasFn:!0,timeUnit:P,field:P,type:"temporal"}});function eo(e){return e.encodings.length===0}function to(e){let t=!1,n=!1,o=!1;for(const i of e.encodings)oe(i)||(H(i)?w(i.autoCount)&&(n=!0):(w(i.field)&&(t=!0),(w(i.aggregate)||w(i.bin)||w(i.timeUnit))&&(n=!0),w(i.channel)&&(o=!0)));return{hasAnyWildcard:o||t||n,hasWildcardField:t,hasWildcardFn:n,hasWildcardChannel:o}}const no={name:"source"};function Rs(e,t){const n={},{hasOpenPosition:o,hasStyleChannel:i,hasOpenFacet:c}=function(u){let a=!1,r=!1,s=!1;return u.encodings.forEach(d=>{d.channel==="x"||d.channel==="y"?a=!0:d.channel==="row"||d.channel==="column"?s=!0:typeof d.channel=="string"&&$o(Bo,d.channel)&&(r=!0)}),{hasOpenPosition:a,hasStyleChannel:r,hasOpenFacet:s}}(e.spec);return(o||i)&&(n.addQuantitativeField=Yt(js,e,t)),(o||i||c)&&(n.addCategoricalField=Yt(_s,e,t)),o&&(n.addTemporalField=Yt(Ps,e,t)),n}function Bn(e,t){return eo(e.spec)?{plots:[],query:e,limit:1}:{plots:[ro(Ki(e,t).result,no)[0]],query:e,limit:1}}function Yt(e,t,n){const o=e.createQuery(t);return{plots:ro(Ki(o,n).result,no),query:o,limit:e.limit}}function ro(e,t){return e.items.map(n=>qi(n)?io(t,Dn(n)):io(t,n))}function io(e,t){return{fieldInfos:t.getEncodings().filter(A).map(n=>({fieldDef:Fs(n),channel:n.channel})),spec:t.toSpec(e)}}function $s(e){const{spec:t,autoAddCount:n}=e,o=function(r){return{mark:r.mark,encodings:Ds(r.encoding),config:r.config}}(t),{hasAnyWildcard:i,hasWildcardFn:c,hasWildcardField:u}=to(o),a=function(r){const{hasWildcardFn:s,hasWildcardField:d}=r;return s?"fieldTransform":d?"field":"encoding"}({hasWildcardFn:c,hasWildcardField:u});return{spec:o,groupBy:a,orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:i?{autoAddCount:n}:void 0}}const{valueAtom:Qe,useActions:Bs}=Eo(function(){return{mark:P,encoding:{},config:{},schema:null}},{setSchema:(e,t)=>({...e,schema:t}),setMark:(e,t)=>({...e,mark:t}),setEncoding:(e,t)=>{const n=Zi({...e.encoding,...t});return{...e,encoding:n}},set:(e,t)=>{const{schema:n,...o}=t;return{...e,...o}}});function oo(){return Bs()}const Ls=To(e=>{const t=e(Qe);if(!t.schema)return{};const n=$s({spec:t,autoAddCount:!0});return eo(n.spec)?{main:Bn(n,t.schema),histograms:Yt(Us,n,t.schema)}:function(o){return!to(o).hasAnyWildcard}(n.spec)&&!function(o){const i=new Set(o.encodings.map(a=>a.channel)),c=["x","y","color"].every(a=>i.has(a)),u=["row","column"].some(a=>i.has(a));return c&&u}(n.spec)?{main:Bn(n,t.schema),...Rs(n,t.schema)}:{main:Bn(n,t.schema)}}),Ws=["x","y","row","column"],Hs=["color","size","shape"],qs=e=>{const t=Ee.c(26),{schema:n,mark:o}=e,i=Kt(Qe),c=oo(),u=i.encoding.x&&i.encoding.y;let a;t[0]!==c||t[1]!==u||t[2]!==n||t[3]!==i.encoding?(a=S=>{const N=(S==="row"||S==="column")&&!u;return x.jsx(Gs,{schema:n,label:S,disabled:N,fieldDefinition:i.encoding[S],onChange:C=>c.setEncoding({[S]:C})},S)},t[0]=c,t[1]=u,t[2]=n,t[3]=i.encoding,t[4]=a):a=t[4];const r=a;let s,d,l,f,p;t[5]!==o?(s=o.toString(),t[5]=o,t[6]=s):s=t[6],t[7]!==c?(d=S=>c.setMark(S),t[7]=c,t[8]=d):d=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(l=x.jsx(pt,{children:x.jsx(Vn,{placeholder:"Mark"})}),t[9]=l):l=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(f=x.jsx(ht,{children:x.jsxs(Ke,{children:[x.jsx(Kn,{children:"Mark"}),Is.map(Ys)]})}),t[10]=f):f=t[10],t[11]!==s||t[12]!==d?(p=x.jsxs(gt,{"data-testid":"marimo-plugin-data-explorer-mark-select",value:s,onValueChange:d,children:[l,f]}),t[11]=s,t[12]=d,t[13]=p):p=t[13];const h=p;let m,v,b,y,E,T;return t[14]===Symbol.for("react.memo_cache_sentinel")?(m=x.jsx("span",{className:"col-span-2 flex items-center justify-between w-full",children:x.jsx("div",{className:"text-sm font-semibold",children:"Encodings"})}),t[14]=m):m=t[14],t[15]!==r?(v=Ws.map(r),t[15]=r,t[16]=v):v=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(b=x.jsx("div",{children:"Mark"}),t[17]=b):b=t[17],t[18]!==h?(y=x.jsxs("span",{className:"col-span-2 text-sm font-semibold w-full border-t border-divider flex items-center justify-between pt-2 pr-[30px]",children:[b,h]}),t[18]=h,t[19]=y):y=t[19],t[20]!==r?(E=Hs.map(r),t[20]=r,t[21]=E):E=t[21],t[22]!==y||t[23]!==E||t[24]!==v?(T=x.jsxs("div",{className:"grid gap-x-2 gap-y-4 justify-items-start py-3 pl-4 pr-2 bg-[var(--slate-1)] border rounded items-center grid-template-columns-[repeat(2,_minmax(0,_min-content))] self-start",children:[m,v,y,E]}),t[22]=y,t[23]=E,t[24]=v,t[25]=T):T=t[25],T},Gs=e=>{const t=Ee.c(43),{label:n,schema:o,fieldDefinition:i,disabled:c,onChange:u}=e;let a;t[0]!==i||t[1]!==o?(a=()=>{if(!i)return"--";if(i.field==="*")return x.jsxs("span",{className:"flex gap-2 flex-1",children:[Ye[L.NUMBER],x.jsx("span",{className:"text-left flex-1",children:"Count"})]});const F=i.field.toString();return x.jsxs("span",{className:"flex gap-2 flex-1",children:[Ye[o.primitiveType(F)],x.jsx("span",{className:"text-left flex-1",children:i.fn?`${i.fn}(${i.field})`:F})]})},t[0]=i,t[1]=o,t[2]=a):a=t[2];const r=a;let s;t[3]!==u?(s=()=>{u(void 0)},t[3]=u,t[4]=s):s=t[4];const d=s;let l;t[5]!==(i==null?void 0:i.field)?(l=(i==null?void 0:i.field.toString())??"",t[5]=i==null?void 0:i.field,t[6]=l):l=t[6];const f=l;let p,h;t[7]!==n?(p=x.jsx(So,{className:"text-[var(--slate-11)] font-semibold",children:n}),t[7]=n,t[8]=p):p=t[8],t[9]!==u||t[10]!==o?(h=F=>{u(F==="*"?{field:"*",fn:"count",type:"quantitative"}:{field:F,type:o.vlType(F)})},t[9]=u,t[10]=o,t[11]=h):h=t[11];const m=f?d:void 0;let v,b,y,E,T,S,N,C,O,M,U,I;return t[12]!==r?(v=r(),t[12]=r,t[13]=v):v=t[13],t[14]!==m||t[15]!==v?(b=x.jsx(pt,{className:"min-w-[140px] lg:min-w-[210px] h-full",onClear:m,children:v}),t[14]=m,t[15]=v,t[16]=b):b=t[16],t[17]!==o?(y=o.fieldNames().map(F=>x.jsx(ke,{value:F.toString(),children:x.jsxs("span",{className:"flex items-center gap-2 flex-1",children:[Ye[o.primitiveType(F)],x.jsx("span",{className:"flex-1",children:F}),x.jsxs("span",{className:"text-muted-foreground text-xs font-semibold",children:["(",o.vlType(F),")"]})]})},F)),t[17]=o,t[18]=y):y=t[18],t[19]!==o?(E=o.fieldNames().length===0&&x.jsx(ke,{disabled:!0,value:"--",children:"No columns"}),t[19]=o,t[20]=E):E=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(T=x.jsx(Jn,{}),t[21]=T):T=t[21],t[22]===Symbol.for("react.memo_cache_sentinel")?(S=x.jsx(ke,{value:"*",children:x.jsxs("span",{className:"flex items-center gap-1 flex-1",children:[Ye[L.NUMBER],x.jsx("span",{className:"flex-1",children:"Count"})]})},"*"),t[22]=S):S=t[22],t[23]!==E||t[24]!==y?(N=x.jsx(ht,{children:x.jsxs(Ke,{children:[y,E,T,S]})}),t[23]=E,t[24]=y,t[25]=N):N=t[25],t[26]!==c||t[27]!==f||t[28]!==N||t[29]!==h||t[30]!==b?(C=x.jsxs(gt,{value:f,disabled:c,onValueChange:h,children:[b,N]}),t[26]=c,t[27]=f,t[28]=N,t[29]=h,t[30]=b,t[31]=C):C=t[31],t[32]!==i||t[33]!==u?(O=i&&x.jsx(zs,{field:i,onChange:u}),t[32]=i,t[33]=u,t[34]=O):O=t[34],t[35]!==O?(M=x.jsx("div",{className:"w-[26px]",children:O}),t[35]=O,t[36]=M):M=t[36],t[37]!==C||t[38]!==M?(U=x.jsxs("div",{className:"flex flex-row gap-1 h-[26px]",children:[C,M]}),t[37]=C,t[38]=M,t[39]=U):U=t[39],t[40]!==U||t[41]!==p?(I=x.jsxs(x.Fragment,{children:[p,U]}),t[40]=U,t[41]=p,t[42]=I):I=t[42],I},Ln="__",zs=e=>{const t=Ee.c(15),{field:n,onChange:o}=e;if(n.field==="*")return null;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[0]=i):i=t[0];let c=i;if(n.type===le.QUANTITATIVE){let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=[["",Ms]],t[1]=u):u=t[1],c=u}if(n.type===le.TEMPORAL){let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=[["Single",Ji],["Multi",Xi]],t[2]=u):u=t[2],c=u}if(c.length>0){let u,a,r,s,d,l;return t[3]!==n||t[4]!==o?(u=f=>{o({...n,fn:f===Ln?void 0:f})},t[3]=n,t[4]=o,t[5]=u):u=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(a=x.jsx(pt,{className:"h-full px-1",hideChevron:!0,variant:"ghost",children:x.jsx(No,{size:14,strokeWidth:1.5})}),t[6]=a):a=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(r=x.jsx(Ke,{children:x.jsx(ke,{value:Ln,children:"None"})}),s=x.jsx(Jn,{}),t[7]=r,t[8]=s):(r=t[7],s=t[8]),t[9]!==c?(d=x.jsxs(ht,{children:[r,s,c.map(Vs)]}),t[9]=c,t[10]=d):d=t[10],t[11]!==n.fn||t[12]!==u||t[13]!==d?(l=x.jsxs(gt,{"data-testid":"marimo-plugin-data-explorer-field-options",value:n.fn,onValueChange:u,children:[a,d]}),t[11]=n.fn,t[12]=u,t[13]=d,t[14]=l):l=t[14],l}return null};function Ys(e){return x.jsx(ke,{value:e,children:e===P?"auto":e},e)}function Qs(e){return x.jsx(ke,{value:e??Ln,children:wo(e)},e)}function Vs(e){const[t,n]=e;return x.jsxs(Ke,{children:[t&&x.jsx(Kn,{children:t}),n.map(Qs)]},t)}const Ks=e=>{const t=Ee.c(5);let n,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=Co(),t[0]=o):o=t[0],n=o;const i=n;let c,u;return t[1]!==e?(c=()=>{const a=i.sub(Qe,()=>{const s=i.get(Qe),{schema:d,...l}=s;e.setValue(l)}),r=e.value;return r&&Object.keys(r).length>0&&i.set(Qe,r),a},t[1]=e,t[2]=c):c=t[2],Ao(c),t[3]!==e?(u=x.jsx(Oo,{store:i,children:x.jsx(ao,{...e})}),t[3]=e,t[4]=u):u=t[4],u},Js={export:{svg:!0,png:!0},source:!1,compiled:!1,editor:!1},Xs={left:20,right:20,top:20,bottom:20},ao=e=>{var Ae,ye,ve,be,lt,Wn;const t=Ee.c(43),{data:n}=e,o=oo();let i,c;t[0]!==o||t[1]!==n?(i=async()=>{if(!n)return{};const $=await Io(n,{type:"csv",parse:"auto"},{replacePeriod:!0}),Pe=function(xe,z={},Ve={fields:[]}){z=k.extend({},ot,z);let so=fs.summary(xe),Hn=ds.inferAll(xe),co=Ve.fields.reduce((B,se)=>(B[se.name]=se,B),{}),qn=so.map(function(B,se){const Re=B.field,ut=Hn[Re]==="date"?L.DATETIME:Hn[Re];let Oe,Vt=B.distinct;if(ut===L.NUMBER)Oe=R;else if(ut===L.INTEGER)Oe=VtB.max.getTime()&&(B.max=new Date(ft))}}else Oe=ie;Oe===ie&&Vt/B.count>z.minPercentUniqueForKey&&B.count>z.minCardinalityForKey&&(Oe=le.KEY);let dt={name:Re,originalIndex:se,vlType:Oe,type:ut,stats:B,timeStats:{},binStats:{}};const uo=co[dt.name];return dt=k.extend(dt,uo),dt});for(let B of qn)if(B.vlType===R)for(let se of z.enum.binProps.maxbins)B.binStats[se]=Mi(se,B.stats);else if(B.vlType===Q)for(let se of z.enum.timeUnit)se!==void 0&&(B.timeStats[se]=Ii(se,B.stats));const lo=Object.assign({},Ve,{fields:qn});return new hs(lo)}($);return o.setSchema(Pe),{chartData:$,schema:Pe}},t[0]=o,t[1]=n,t[2]=i):i=t[2],t[3]!==n?(c=[n],t[3]=n,t[4]=c):c=t[4];const{data:u,isPending:a,error:r}=ko(i,c),{mark:s}=Kt(Qe),d=Kt(Ls),{theme:l}=Mo();if(r){let $;return t[5]!==r?($=x.jsx(Uo,{error:r}),t[5]=r,t[6]=$):$=t[6],$}if(!u){let $;return t[7]===Symbol.for("react.memo_cache_sentinel")?($=x.jsx("div",{}),t[7]=$):$=t[7],$}const{chartData:f,schema:p}=u;if(a||!p){let $;return t[8]===Symbol.for("react.memo_cache_sentinel")?($=x.jsx("div",{}),t[8]=$):$=t[8],$}const h=(ye=(Ae=d.main)==null?void 0:Ae.plots)==null?void 0:ye[0];let m;t[9]!==(h==null?void 0:h.fieldInfos)?(m=new Set(h==null?void 0:h.fieldInfos.map(nc)),t[9]=h==null?void 0:h.fieldInfos,t[10]=m):m=t[10];const v=m;let b;t[11]!==f||t[12]!==h||t[13]!==p||t[14]!==l?(b=()=>h?x.jsx("div",{className:"flex overflow-y-auto justify-center items-center flex-1 w-[90%]",children:x.jsx(Xn,{data:{source:f},padding:Xs,actions:Js,spec:tc(h.spec),theme:l==="dark"?"dark":void 0})}):x.jsx(Ns,{schema:p}),t[11]=f,t[12]=h,t[13]=p,t[14]=l,t[15]=b):b=t[15];const y=b;let E,T,S;t[16]!==s||t[17]!==p?(E=x.jsx(qs,{mark:s,schema:p}),t[16]=s,t[17]=p,t[18]=E):E=t[18],t[19]!==y?(T=y(),t[19]=y,t[20]=T):T=t[20],t[21]!==E||t[22]!==T?(S=x.jsxs("div",{className:"flex items-center gap-2",children:[E,T]}),t[21]=E,t[22]=T,t[23]=S):S=t[23];const N=(ve=d.histograms)==null?void 0:ve.plots,C=(be=d.addCategoricalField)==null?void 0:be.plots,O=(lt=d.addQuantitativeField)==null?void 0:lt.plots,M=(Wn=d.addTemporalField)==null?void 0:Wn.plots;let U,I,F;if(t[24]!==o||t[25]!==f||t[26]!==v||t[27]!==O||t[28]!==M||t[29]!==N||t[30]!==C||t[31]!==l){let $;t[33]!==o||t[34]!==f||t[35]!==v||t[36]!==l?($=(Pe,xe)=>x.jsx(ec,{title:x.jsx("div",{className:"flex flex-row gap-1",children:Pe.fieldInfos.map(z=>{const Ve=z.fieldDef.field==="*"?"Count":z.fieldDef.fn?`${z.fieldDef.fn}(${z.fieldDef.field})`:z.fieldDef.field.toString();return x.jsx(jo,{variant:v.has(z.fieldDef.field)?"secondary":"defaultOutline",children:Ve},Ve)})}),actions:x.jsx(Fo,{content:"Make main plot",children:x.jsx(Qn,{"data-testid":"marimo-plugin-data-explorer-make-main-plot",variant:"text",size:"icon",onClick:()=>{const z=_o.fromEntries(Pe.fieldInfos.map(rc));o.setEncoding(z)},children:x.jsx(Do,{className:"w-4 h-4"})})}),children:x.jsx(Xn,{data:{source:f},actions:!1,spec:Pe.spec,theme:l==="dark"?"dark":void 0},xe)},xe),t[33]=o,t[34]=f,t[35]=v,t[36]=l,t[37]=$):$=t[37],U=[N,C,O,M].filter(Boolean).flat().map($),t[24]=o,t[25]=f,t[26]=v,t[27]=O,t[28]=M,t[29]=N,t[30]=C,t[31]=l,t[32]=U}else U=t[32];return t[38]!==U?(I=x.jsx(Zs,{children:U}),t[38]=U,t[39]=I):I=t[39],t[40]!==I||t[41]!==S?(F=x.jsxs("div",{className:"flex flex-col gap-2",children:[S,I]}),t[40]=I,t[41]=S,t[42]=F):F=t[42],F},Zs=e=>{const t=Ee.c(2),{children:n}=e;if(Po.Children.count(n)===0)return null;let o;return t[0]!==n?(o=x.jsx("div",{className:"flex flex-row overflow-x-auto overflow-y-hidden gap-4 snap-x pb-4",children:n}),t[0]=n,t[1]=o):o=t[1],o},ec=e=>{const t=Ee.c(10),{title:n,children:o,actions:i}=e;let c,u,a,r;return t[0]!==n?(c=x.jsx("div",{className:"text-sm font-medium",children:n}),t[0]=n,t[1]=c):c=t[1],t[2]!==i||t[3]!==c?(u=x.jsxs("div",{className:"flex flex-row justify-between items-center bg-[var(--slate-3)] py-0.5 px-2",children:[c,i]}),t[2]=i,t[3]=c,t[4]=u):u=t[4],t[5]!==o?(a=x.jsx("div",{className:"px-6 pt-2 max-h-[280px] overflow-y-auto",children:o}),t[5]=o,t[6]=a):a=t[6],t[7]!==u||t[8]!==a?(r=x.jsxs("div",{className:"flex-shrink-0 bg-card shadow-md border overflow-hidden rounded snap-start",children:[u,a]}),t[7]=u,t[8]=a,t[9]=r):r=t[9],r};function tc(e){var t,n;return(t=e.encoding)!=null&&t.row||(n=e.encoding)!=null&&n.column||(e.width="container"),e}function nc(e){return e.fieldDef.field}function rc(e){return[e.channel,e.fieldDef]}export{ao as DataExplorerComponent,Ks as default}; diff --git a/apps/assets/FiraMono-Bold-CLVRCuM9.ttf b/apps/assets/FiraMono-Bold-CLVRCuM9.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ed2698b9508ff7970268da7c24a69e71de8f1a7a --- /dev/null +++ b/apps/assets/FiraMono-Bold-CLVRCuM9.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:669c459f82d635c170caffb95b91e4b1d4d844b2e39b57009b9f865b06baa56c +size 201708 diff --git a/apps/assets/FiraMono-Medium-DU3aDxX5.ttf b/apps/assets/FiraMono-Medium-DU3aDxX5.ttf new file mode 100644 index 0000000000000000000000000000000000000000..f8b03cbae9e3df98d2f12104d77447a2d65ff850 --- /dev/null +++ b/apps/assets/FiraMono-Medium-DU3aDxX5.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ebf0b5802814edb228b711b70c02736506bb8bce32da2608dcbf9e0df45798d +size 169056 diff --git a/apps/assets/FiraMono-Regular-BTCkDNvf.ttf b/apps/assets/FiraMono-Regular-BTCkDNvf.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2a44d0766cb1624bd3185082a16d641e0559bdb8 --- /dev/null +++ b/apps/assets/FiraMono-Regular-BTCkDNvf.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c1c51abec8b9f7fa24bfb88ebe80b354cc6da9d4036d6bedeaf495d24933e42 +size 170204 diff --git a/apps/assets/ImageComparisonComponent-D9i_gkAF.js b/apps/assets/ImageComparisonComponent-D9i_gkAF.js new file mode 100644 index 0000000000000000000000000000000000000000..99540e1a64a27914906517736857294ca5a06941 --- /dev/null +++ b/apps/assets/ImageComparisonComponent-D9i_gkAF.js @@ -0,0 +1 @@ +import{aE as D,c as k,j as x}from"./index-DgI7bmFZ.js";var T,M,p={},L={},P=function(){if(M)return p;M=1;var E=p&&p.__createBinding||(Object.create?function(d,c,l,t){t===void 0&&(t=l),Object.defineProperty(d,t,{enumerable:!0,get:function(){return c[l]}})}:function(d,c,l,t){t===void 0&&(t=l),d[t]=c[l]}),i=p&&p.__setModuleDefault||(Object.create?function(d,c){Object.defineProperty(d,"default",{enumerable:!0,value:c})}:function(d,c){d.default=c}),y=p&&p.__importStar||function(d){if(d&&d.__esModule)return d;var c={};if(d!=null)for(var l in d)l!=="default"&&Object.prototype.hasOwnProperty.call(d,l)&&E(c,d,l);return i(c,d),c};Object.defineProperty(p,"__esModule",{value:!0}),p.ImgComparisonSlider=void 0;const w=D();return typeof document<"u"&&Promise.resolve().then(()=>y((T||(T=1,(()=>{var d={792:(t,a,r)=>{r.d(a,{Z:()=>v});var n=r(609),u=r.n(n)()(function(f){return f[1]});u.push([t.id,':host{--divider-width: 1px;--divider-color: #fff;--divider-shadow: none;--default-handle-width: 50px;--default-handle-color: #fff;--default-handle-opacity: 1;--default-handle-shadow: none;--handle-position-start: 50%;position:relative;display:inline-block;overflow:hidden;line-height:0;direction:ltr}@media screen and (-webkit-min-device-pixel-ratio: 0)and (min-resolution: 0.001dpcm){:host{outline-offset:1px}}:host(:focus){outline:2px solid -webkit-focus-ring-color}::slotted(*){-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;user-drag:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.first{position:absolute;left:0;top:0;right:0;line-height:normal;font-size:100%;max-height:100%;height:100%;width:100%;--exposure: 50%;--keyboard-transition-time: 0ms;--default-transition-time: 0ms;--transition-time: var(--default-transition-time)}.first .first-overlay-container{position:relative;clip-path:inset(0 var(--exposure) 0 0);transition:clip-path var(--transition-time);height:100%}.first .first-overlay{overflow:hidden;height:100%}.first.focused{will-change:clip-path}.first.focused .first-overlay-container{will-change:clip-path}.second{position:relative}.handle-container{transform:translateX(50%);position:absolute;top:0;right:var(--exposure);height:100%;transition:right var(--transition-time),bottom var(--transition-time)}.focused .handle-container{will-change:right}.divider{position:absolute;height:100%;width:100%;left:0;top:0;display:flex;align-items:center;justify-content:center;flex-direction:column}.divider:after{content:" ";display:block;height:100%;border-left-width:var(--divider-width);border-left-style:solid;border-left-color:var(--divider-color);box-shadow:var(--divider-shadow)}.handle{position:absolute;top:var(--handle-position-start);pointer-events:none;box-sizing:border-box;margin-left:1px;transform:translate(calc(-50% - 0.5px), -50%);line-height:0}.default-handle{width:var(--default-handle-width);opacity:var(--default-handle-opacity);transition:all 1s;filter:drop-shadow(var(--default-handle-shadow))}.default-handle path{stroke:var(--default-handle-color)}.vertical .first-overlay-container{clip-path:inset(0 0 var(--exposure) 0)}.vertical .handle-container{transform:translateY(50%);height:auto;top:unset;bottom:var(--exposure);width:100%;left:0;flex-direction:row}.vertical .divider:after{height:1px;width:100%;border-top-width:var(--divider-width);border-top-style:solid;border-top-color:var(--divider-color);border-left:0}.vertical .handle{top:auto;left:var(--handle-position-start);transform:translate(calc(-50% - 0.5px), -50%) rotate(90deg)}',""]);const v=u},609:t=>{t.exports=function(a){var r=[];return r.toString=function(){return this.map(function(n){var u=a(n);return n[2]?"@media ".concat(n[2]," {").concat(u,"}"):u}).join("")},r.i=function(n,u,v){typeof n=="string"&&(n=[[null,n,""]]);var f={};if(v)for(var m=0;m{var a=t&&t.__esModule?()=>t.default:()=>t;return l.d(a,{a}),a},l.d=(t,a)=>{for(var r in a)l.o(a,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},l.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),(()=>{var t=l(792);const a="rendered",r=(e,s)=>{const o=e.getBoundingClientRect();let h,b;return s.type==="mousedown"?(h=s.clientX,b=s.clientY):(h=s.touches[0].clientX,b=s.touches[0].clientY),h>=o.x&&h<=o.x+o.width&&b>=o.y&&b<=o.y+o.height};let n;const u={ArrowLeft:-1,ArrowRight:1},v=["horizontal","vertical"],f=e=>({x:e.touches[0].pageX,y:e.touches[0].pageY}),m=e=>({x:e.pageX,y:e.pageY}),g=typeof window<"u"&&(window==null?void 0:window.HTMLElement);typeof window<"u"&&(window.document&&(n=document.createElement("template"),n.innerHTML='
'),window.customElements.define("img-comparison-slider",class extends g{constructor(){super(),this.exposure=this.hasAttribute("value")?parseFloat(this.getAttribute("value")):50,this.slideOnHover=!1,this.slideDirection="horizontal",this.keyboard="enabled",this.isMouseDown=!1,this.animationDirection=0,this.isFocused=!1,this.dragByHandle=!1,this.onMouseMove=o=>{if(this.isMouseDown||this.slideOnHover){const h=m(o);this.slideToPage(h)}},this.bodyUserSelectStyle="",this.bodyWebkitUserSelectStyle="",this.onMouseDown=o=>{if(this.slideOnHover||this.handle&&!r(this.handleElement,o))return;o.preventDefault(),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onWindowMouseUp),this.isMouseDown=!0,this.enableTransition();const h=m(o);this.slideToPage(h),this.focus(),this.bodyUserSelectStyle=window.document.body.style.userSelect,this.bodyWebkitUserSelectStyle=window.document.body.style.webkitUserSelect,window.document.body.style.userSelect="none",window.document.body.style.webkitUserSelect="none"},this.onWindowMouseUp=()=>{this.isMouseDown=!1,window.document.body.style.userSelect=this.bodyUserSelectStyle,window.document.body.style.webkitUserSelect=this.bodyWebkitUserSelectStyle,window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onWindowMouseUp)},this.touchStartPoint=null,this.isTouchComparing=!1,this.hasTouchMoved=!1,this.onTouchStart=o=>{this.dragByHandle&&!r(this.handleElement,o)||(this.touchStartPoint=f(o),this.isFocused&&(this.enableTransition(),this.slideToPage(this.touchStartPoint)))},this.onTouchMove=o=>{if(this.touchStartPoint===null)return;const h=f(o);if(this.isTouchComparing)return this.slideToPage(h),o.preventDefault(),!1;if(!this.hasTouchMoved){const b=Math.abs(h.y-this.touchStartPoint.y),S=Math.abs(h.x-this.touchStartPoint.x);if(this.slideDirection==="horizontal"&&bS)return this.isTouchComparing=!0,this.focus(),this.slideToPage(h),o.preventDefault(),!1;this.hasTouchMoved=!0}},this.onTouchEnd=()=>{this.isTouchComparing=!1,this.hasTouchMoved=!1,this.touchStartPoint=null},this.onBlur=()=>{this.stopSlideAnimation(),this.isFocused=!1,this.firstElement.classList.remove("focused")},this.onFocus=()=>{this.isFocused=!0,this.firstElement.classList.add("focused")},this.onKeyDown=o=>{if(this.keyboard==="disabled")return;const h=u[o.key];this.animationDirection!==h&&h!==void 0&&(this.animationDirection=h,this.startSlideAnimation())},this.onKeyUp=o=>{if(this.keyboard==="disabled")return;const h=u[o.key];h!==void 0&&this.animationDirection===h&&this.stopSlideAnimation()},this.resetDimensions=()=>{this.imageWidth=this.offsetWidth,this.imageHeight=this.offsetHeight};const e=this.attachShadow({mode:"open"}),s=document.createElement("style");s.innerHTML=t.Z,this.getAttribute("nonce")&&s.setAttribute("nonce",this.getAttribute("nonce")),e.appendChild(s),e.appendChild(n.content.cloneNode(!0)),this.firstElement=e.getElementById("first"),this.handleElement=e.getElementById("handle")}set handle(e){this.dragByHandle=e.toString().toLowerCase()!=="false"}get handle(){return this.dragByHandle}get value(){return this.exposure}set value(e){const s=parseFloat(e);s!==this.exposure&&(this.exposure=s,this.enableTransition(),this.setExposure())}get hover(){return this.slideOnHover}set hover(e){this.slideOnHover=e.toString().toLowerCase()!=="false",this.removeEventListener("mousemove",this.onMouseMove),this.slideOnHover&&this.addEventListener("mousemove",this.onMouseMove)}get direction(){return this.slideDirection}set direction(e){this.slideDirection=e.toString().toLowerCase(),this.slide(0),this.firstElement.classList.remove(...v),v.includes(this.slideDirection)&&this.firstElement.classList.add(this.slideDirection)}static get observedAttributes(){return["hover","direction"]}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("dragstart",e=>(e.preventDefault(),!1)),new ResizeObserver(this.resetDimensions).observe(this),this.setExposure(0),this.keyboard=this.hasAttribute("keyboard")&&this.getAttribute("keyboard")==="disabled"?"disabled":"enabled",this.addEventListener("keydown",this.onKeyDown),this.addEventListener("keyup",this.onKeyUp),this.addEventListener("focus",this.onFocus),this.addEventListener("blur",this.onBlur),this.addEventListener("touchstart",this.onTouchStart,{passive:!0}),this.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.addEventListener("touchend",this.onTouchEnd),this.addEventListener("mousedown",this.onMouseDown),this.handle=this.hasAttribute("handle")?this.getAttribute("handle"):this.dragByHandle,this.hover=this.hasAttribute("hover")?this.getAttribute("hover"):this.slideOnHover,this.direction=this.hasAttribute("direction")?this.getAttribute("direction"):this.slideDirection,this.resetDimensions(),this.classList.contains(a)||this.classList.add(a)}disconnectedCallback(){this.transitionTimer&&window.clearTimeout(this.transitionTimer)}attributeChangedCallback(e,s,o){e==="hover"&&(this.hover=o),e==="direction"&&(this.direction=o),e==="keyboard"&&(this.keyboard=o==="disabled"?"disabled":"enabled")}setExposure(e=0){var s;this.exposure=(s=this.exposure+e)<0?0:s>100?100:s,this.firstElement.style.setProperty("--exposure",100-this.exposure+"%")}slide(e=0){this.setExposure(e);const s=new Event("slide");this.dispatchEvent(s)}slideToPage(e){this.slideDirection==="horizontal"&&this.slideToPageX(e.x),this.slideDirection==="vertical"&&this.slideToPageY(e.y)}slideToPageX(e){const s=e-this.getBoundingClientRect().left-window.scrollX;this.exposure=s/this.imageWidth*100,this.slide(0)}slideToPageY(e){const s=e-this.getBoundingClientRect().top-window.scrollY;this.exposure=s/this.imageHeight*100,this.slide(0)}enableTransition(){this.firstElement.style.setProperty("--transition-time","100ms"),this.transitionTimer=window.setTimeout(()=>{this.firstElement.style.setProperty("--transition-time","var(--default-transition-time)"),this.transitionTimer=null},100)}startSlideAnimation(){let e=null,s=this.animationDirection;this.firstElement.style.setProperty("--transition-time","var(--keyboard-transition-time)");const o=h=>{if(this.animationDirection===0||s!==this.animationDirection)return;e===null&&(e=h);const b=(h-e)/16.666666666666668*this.animationDirection;this.slide(b),setTimeout(()=>window.requestAnimationFrame(o),0),e=h};window.requestAnimationFrame(o)}stopSlideAnimation(){this.animationDirection=0,this.firstElement.style.setProperty("--transition-time","var(--default-transition-time)")}}))})()})()),L))),p.ImgComparisonSlider=(0,w.forwardRef)(({children:d,onSlide:c,value:l,className:t,...a},r)=>{const n=(0,w.useRef)();return(0,w.useEffect)(()=>{l!==void 0&&(n.current.value=parseFloat(l.toString()))},[l,n]),(0,w.useEffect)(()=>{c&&n.current.addEventListener("slide",c)},[]),(0,w.useImperativeHandle)(r,()=>n.current,[n]),(0,w.createElement)("img-comparison-slider",Object.assign({class:t?`${t} rendered`:"rendered",tabIndex:0,ref:n},a),d)}),p}();const A=E=>{const i=k.c(15),{beforeSrc:y,afterSrc:w,value:d,direction:c,width:l,height:t}=E,a=l||"100%",r=t||(c==="vertical"?"400px":"auto");let n;i[0]!==a||i[1]!==r?(n={width:a,height:r,maxWidth:"100%"},i[0]=a,i[1]=r,i[2]=n):n=i[2];const u=n;let v,f,m,g;return i[3]!==y?(v=x.jsx("img",{slot:"first",src:y,alt:"Before",width:"100%"}),i[3]=y,i[4]=v):v=i[4],i[5]!==w?(f=x.jsx("img",{slot:"second",src:w,alt:"After",width:"100%"}),i[5]=w,i[6]=f):f=i[6],i[7]!==c||i[8]!==v||i[9]!==f||i[10]!==d?(m=x.jsxs(P.ImgComparisonSlider,{value:d,direction:c,children:[v,f]}),i[7]=c,i[8]=v,i[9]=f,i[10]=d,i[11]=m):m=i[11],i[12]!==u||i[13]!==m?(g=x.jsx("div",{style:u,children:m}),i[12]=u,i[13]=m,i[14]=g):g=i[14],g};export{A as default}; diff --git a/apps/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 b/apps/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..0acaaff03d4bb7606de02a827aeee338e5a86910 Binary files /dev/null and b/apps/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 differ diff --git a/apps/assets/KaTeX_AMS-Regular-DMm9YOAa.woff b/apps/assets/KaTeX_AMS-Regular-DMm9YOAa.woff new file mode 100644 index 0000000000000000000000000000000000000000..b804d7b33a3fa5b2587d2d1d55006aed678e3eb2 Binary files /dev/null and b/apps/assets/KaTeX_AMS-Regular-DMm9YOAa.woff differ diff --git a/apps/assets/KaTeX_AMS-Regular-DRggAlZN.ttf b/apps/assets/KaTeX_AMS-Regular-DRggAlZN.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c6f9a5e7c03f9e64e9c7b4773a8e37ade8eaf406 Binary files /dev/null and b/apps/assets/KaTeX_AMS-Regular-DRggAlZN.ttf differ diff --git a/apps/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf b/apps/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9ff4a5e04421e5107f74c28e27354e0b2a4e7ef8 Binary files /dev/null and b/apps/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf differ diff --git a/apps/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff b/apps/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff new file mode 100644 index 0000000000000000000000000000000000000000..9759710d1d3e16eb10012d56babb73f2479ba9f0 Binary files /dev/null and b/apps/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff differ diff --git a/apps/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 b/apps/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..f390922eceffe1f6dfb81a3dc086a92d98171b02 Binary files /dev/null and b/apps/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 differ diff --git a/apps/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff b/apps/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff new file mode 100644 index 0000000000000000000000000000000000000000..9bdd534fd2beb9b878f0219da9d63ffba56677e2 Binary files /dev/null and b/apps/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff differ diff --git a/apps/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 b/apps/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..75344a1f98e37e2c631e178065854c3a81fb842f Binary files /dev/null and b/apps/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 differ diff --git a/apps/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf b/apps/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf new file mode 100644 index 0000000000000000000000000000000000000000..f522294ff0f3f8c52dfdaef7ebfaa06ebfcfaabf Binary files /dev/null and b/apps/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf differ diff --git a/apps/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf b/apps/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4e98259c3b54076d684bf3459baeaeae8dbce97a Binary files /dev/null and b/apps/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf differ diff --git a/apps/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff b/apps/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff new file mode 100644 index 0000000000000000000000000000000000000000..e7730f66275c87c28f26530d89264cffecf90be0 Binary files /dev/null and b/apps/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff differ diff --git a/apps/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 b/apps/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..395f28beac23c7b0f7f3a1e714bd8dac253dd3bc Binary files /dev/null and b/apps/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 differ diff --git a/apps/assets/KaTeX_Fraktur-Regular-CB_wures.ttf b/apps/assets/KaTeX_Fraktur-Regular-CB_wures.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b8461b275fae76efd0d21fd0f1aaa696a5b10f9a Binary files /dev/null and b/apps/assets/KaTeX_Fraktur-Regular-CB_wures.ttf differ diff --git a/apps/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 b/apps/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..735f6948d63c8cc7f8233735bb9c8d843c83d804 Binary files /dev/null and b/apps/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 differ diff --git a/apps/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff b/apps/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff new file mode 100644 index 0000000000000000000000000000000000000000..acab069f90b6fe6301a004e6f8beaf6a0db48bce Binary files /dev/null and b/apps/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff differ diff --git a/apps/assets/KaTeX_Main-Bold-Cx986IdX.woff2 b/apps/assets/KaTeX_Main-Bold-Cx986IdX.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..ab2ad21da6fbe6c171bb869240954d0ead8f68fd Binary files /dev/null and b/apps/assets/KaTeX_Main-Bold-Cx986IdX.woff2 differ diff --git a/apps/assets/KaTeX_Main-Bold-Jm3AIy58.woff b/apps/assets/KaTeX_Main-Bold-Jm3AIy58.woff new file mode 100644 index 0000000000000000000000000000000000000000..f38136ac1cc2dcdc9d9b10b8521487468b1f768c Binary files /dev/null and b/apps/assets/KaTeX_Main-Bold-Jm3AIy58.woff differ diff --git a/apps/assets/KaTeX_Main-Bold-waoOVXN0.ttf b/apps/assets/KaTeX_Main-Bold-waoOVXN0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4060e627dc341c1854260cbc3f7386e222a4d297 Binary files /dev/null and b/apps/assets/KaTeX_Main-Bold-waoOVXN0.ttf differ diff --git a/apps/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 b/apps/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..5931794de4a2a485fa70099bf2659b145976d043 Binary files /dev/null and b/apps/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 differ diff --git a/apps/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf b/apps/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dc007977ee709a236d9e82719cf7d4e5577a81b9 Binary files /dev/null and b/apps/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf differ diff --git a/apps/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff b/apps/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff new file mode 100644 index 0000000000000000000000000000000000000000..67807b0bd4f867853271f5917fb3adf377f93f53 Binary files /dev/null and b/apps/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff differ diff --git a/apps/assets/KaTeX_Main-Italic-3WenGoN9.ttf b/apps/assets/KaTeX_Main-Italic-3WenGoN9.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0e9b0f354ad460202bba554359f5adcc8da666b7 Binary files /dev/null and b/apps/assets/KaTeX_Main-Italic-3WenGoN9.ttf differ diff --git a/apps/assets/KaTeX_Main-Italic-BMLOBm91.woff b/apps/assets/KaTeX_Main-Italic-BMLOBm91.woff new file mode 100644 index 0000000000000000000000000000000000000000..6f43b594b6c1d863a0e3f93b001f8dd503316464 Binary files /dev/null and b/apps/assets/KaTeX_Main-Italic-BMLOBm91.woff differ diff --git a/apps/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 b/apps/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b50920e138807f385d0b0359f4f0f09891f18406 Binary files /dev/null and b/apps/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 differ diff --git a/apps/assets/KaTeX_Main-Regular-B22Nviop.woff2 b/apps/assets/KaTeX_Main-Regular-B22Nviop.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..eb24a7ba282b03d830fa6c63ee897d92a5188736 Binary files /dev/null and b/apps/assets/KaTeX_Main-Regular-B22Nviop.woff2 differ diff --git a/apps/assets/KaTeX_Main-Regular-Dr94JaBh.woff b/apps/assets/KaTeX_Main-Regular-Dr94JaBh.woff new file mode 100644 index 0000000000000000000000000000000000000000..21f5812968c42392a3eaea9b0c6320870b6b8b38 Binary files /dev/null and b/apps/assets/KaTeX_Main-Regular-Dr94JaBh.woff differ diff --git a/apps/assets/KaTeX_Main-Regular-ypZvNtVU.ttf b/apps/assets/KaTeX_Main-Regular-ypZvNtVU.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dd45e1ed2e18b32c516d9b481ebed3cb8bffa711 Binary files /dev/null and b/apps/assets/KaTeX_Main-Regular-ypZvNtVU.ttf differ diff --git a/apps/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf b/apps/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf new file mode 100644 index 0000000000000000000000000000000000000000..728ce7a1e2cb689df32c3a6c26e1bd072dcf2acb Binary files /dev/null and b/apps/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf differ diff --git a/apps/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 b/apps/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..29657023adc09956249f6295746c8ce4469b50d3 Binary files /dev/null and b/apps/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 differ diff --git a/apps/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff b/apps/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff new file mode 100644 index 0000000000000000000000000000000000000000..0ae390d74c9f665cf8b1e5ea5483395da7513444 Binary files /dev/null and b/apps/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff differ diff --git a/apps/assets/KaTeX_Math-Italic-DA0__PXp.woff b/apps/assets/KaTeX_Math-Italic-DA0__PXp.woff new file mode 100644 index 0000000000000000000000000000000000000000..eb5159d4c1ca83fb92b3190223698427df0e010c Binary files /dev/null and b/apps/assets/KaTeX_Math-Italic-DA0__PXp.woff differ diff --git a/apps/assets/KaTeX_Math-Italic-flOr_0UB.ttf b/apps/assets/KaTeX_Math-Italic-flOr_0UB.ttf new file mode 100644 index 0000000000000000000000000000000000000000..70d559b4e937ca1b805eb39f544cbebe3c58ca6f Binary files /dev/null and b/apps/assets/KaTeX_Math-Italic-flOr_0UB.ttf differ diff --git a/apps/assets/KaTeX_Math-Italic-t53AETM-.woff2 b/apps/assets/KaTeX_Math-Italic-t53AETM-.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..215c143fd7805a5c2b222bd7892a1a2b09610020 Binary files /dev/null and b/apps/assets/KaTeX_Math-Italic-t53AETM-.woff2 differ diff --git a/apps/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf b/apps/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2f65a8a3a6d3628d11ea9c26c9077cef672fe427 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf differ diff --git a/apps/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 b/apps/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..cfaa3bda59246b49e94298478d6de3b3208066c8 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 differ diff --git a/apps/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff b/apps/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff new file mode 100644 index 0000000000000000000000000000000000000000..8d47c02d9408d34b2a9d566c0fe0d42bf82fb735 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff differ diff --git a/apps/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 b/apps/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..349c06dc609f896392fd5bc8b364d3bc3efc9330 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 differ diff --git a/apps/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff b/apps/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff new file mode 100644 index 0000000000000000000000000000000000000000..7e02df963621a5e26d53d510f0b4992eebde1c60 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff differ diff --git a/apps/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf b/apps/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d5850df98ec19de2eee9ff922ef59586efe471d0 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf differ diff --git a/apps/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf b/apps/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf new file mode 100644 index 0000000000000000000000000000000000000000..537279f6bd2184ed32f1a5168850609147d58ee6 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf differ diff --git a/apps/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff b/apps/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff new file mode 100644 index 0000000000000000000000000000000000000000..31b84829b42edae20d0148eeec0d922dad2108c4 Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff differ diff --git a/apps/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 b/apps/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..a90eea85f6f7bded69ff5d40114447a6d8b48cfe Binary files /dev/null and b/apps/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 differ diff --git a/apps/assets/KaTeX_Script-Regular-C5JkGWo-.ttf b/apps/assets/KaTeX_Script-Regular-C5JkGWo-.ttf new file mode 100644 index 0000000000000000000000000000000000000000..fd679bf374af72f2a183b97b40c9c7e9e51fbe5e Binary files /dev/null and b/apps/assets/KaTeX_Script-Regular-C5JkGWo-.ttf differ diff --git a/apps/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 b/apps/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b3048fc115681ee6c1bc86b0aa158cfbbf59daa3 Binary files /dev/null and b/apps/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 differ diff --git a/apps/assets/KaTeX_Script-Regular-D5yQViql.woff b/apps/assets/KaTeX_Script-Regular-D5yQViql.woff new file mode 100644 index 0000000000000000000000000000000000000000..0e7da821eee0dd05a0a6f0b16c2c1345dc573a84 Binary files /dev/null and b/apps/assets/KaTeX_Script-Regular-D5yQViql.woff differ diff --git a/apps/assets/KaTeX_Size1-Regular-C195tn64.woff b/apps/assets/KaTeX_Size1-Regular-C195tn64.woff new file mode 100644 index 0000000000000000000000000000000000000000..7f292d91184f257054ef77cc1cd3443db757c9cc Binary files /dev/null and b/apps/assets/KaTeX_Size1-Regular-C195tn64.woff differ diff --git a/apps/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf b/apps/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf new file mode 100644 index 0000000000000000000000000000000000000000..871fd7d19d8658f64d8696ed9cdfc82c821ed76d Binary files /dev/null and b/apps/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf differ diff --git a/apps/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 b/apps/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..c5a8462fbfe2c39a7c1857b9e296e62500a8a8a5 Binary files /dev/null and b/apps/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 differ diff --git a/apps/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf b/apps/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf new file mode 100644 index 0000000000000000000000000000000000000000..7a212caf91c0007e826fee2d622bf48acbd30dde Binary files /dev/null and b/apps/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf differ diff --git a/apps/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 b/apps/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e1bccfe2403a4ed770c1697ae7c15b9e1cd9bc4e Binary files /dev/null and b/apps/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 differ diff --git a/apps/assets/KaTeX_Size2-Regular-oD1tc_U0.woff b/apps/assets/KaTeX_Size2-Regular-oD1tc_U0.woff new file mode 100644 index 0000000000000000000000000000000000000000..d241d9be2d317f7b39b401d96c8b18836acea0fa Binary files /dev/null and b/apps/assets/KaTeX_Size2-Regular-oD1tc_U0.woff differ diff --git a/apps/assets/KaTeX_Size3-Regular-CTq5MqoE.woff b/apps/assets/KaTeX_Size3-Regular-CTq5MqoE.woff new file mode 100644 index 0000000000000000000000000000000000000000..e6e9b658dcf1cd031ac82b6b8f312444c55d4fc0 Binary files /dev/null and b/apps/assets/KaTeX_Size3-Regular-CTq5MqoE.woff differ diff --git a/apps/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf b/apps/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf new file mode 100644 index 0000000000000000000000000000000000000000..00bff3495fa9d2f98c1c9ce436add6a1bcfe87fb Binary files /dev/null and b/apps/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf differ diff --git a/apps/assets/KaTeX_Size4-Regular-BF-4gkZK.woff b/apps/assets/KaTeX_Size4-Regular-BF-4gkZK.woff new file mode 100644 index 0000000000000000000000000000000000000000..e1ec5457664f438ce5a1cc6dd8409bf60ca7804b Binary files /dev/null and b/apps/assets/KaTeX_Size4-Regular-BF-4gkZK.woff differ diff --git a/apps/assets/KaTeX_Size4-Regular-DWFBv043.ttf b/apps/assets/KaTeX_Size4-Regular-DWFBv043.ttf new file mode 100644 index 0000000000000000000000000000000000000000..74f08921f00f71f413ca42c9d1c90202e672ef38 Binary files /dev/null and b/apps/assets/KaTeX_Size4-Regular-DWFBv043.ttf differ diff --git a/apps/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 b/apps/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..680c13085076a2f6c5a7e695935ec3f21cddb65f Binary files /dev/null and b/apps/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 differ diff --git a/apps/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff b/apps/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff new file mode 100644 index 0000000000000000000000000000000000000000..2432419f28936aff53ddfa2a732d027e6a6648fd Binary files /dev/null and b/apps/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff differ diff --git a/apps/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 b/apps/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..771f1af705f5cef5f578b3a1e7d8eff66f9b76b0 Binary files /dev/null and b/apps/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 differ diff --git a/apps/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf b/apps/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c83252c5714c71a3e0ec62195884167339a0129b Binary files /dev/null and b/apps/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf differ diff --git a/apps/assets/Lora-VariableFont_wght-B2ootaw-.ttf b/apps/assets/Lora-VariableFont_wght-B2ootaw-.ttf new file mode 100644 index 0000000000000000000000000000000000000000..105fb06b4c5fe476b590ab0a044b80ccc87436c7 --- /dev/null +++ b/apps/assets/Lora-VariableFont_wght-B2ootaw-.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9385192327b5347c17c50dd31f28a4cc5225e78b42f5ced4e185fc6b20b179a9 +size 212004 diff --git a/apps/assets/PTSans-Bold-D9fedIX3.ttf b/apps/assets/PTSans-Bold-D9fedIX3.ttf new file mode 100644 index 0000000000000000000000000000000000000000..5dd10098facb34f9fdcf067e80eeabd5a4450edb --- /dev/null +++ b/apps/assets/PTSans-Bold-D9fedIX3.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6233f84e139f226690649b3105c077b0f87ec24a23ca4a18ada298c962a06f4f +size 288340 diff --git a/apps/assets/PTSans-Regular-CxL0S8W7.ttf b/apps/assets/PTSans-Regular-CxL0S8W7.ttf new file mode 100644 index 0000000000000000000000000000000000000000..460df66687ae8060aa8ce166401e22bd9dfe0631 --- /dev/null +++ b/apps/assets/PTSans-Regular-CxL0S8W7.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23b91352992c21de231c39dd77441f7c5c3f3e684f4a06e31b65c63d33427560 +size 278612 diff --git a/apps/assets/VegaLite-BNmk2IVQ.js b/apps/assets/VegaLite-BNmk2IVQ.js new file mode 100644 index 0000000000000000000000000000000000000000..67b1b5343118d5288fa18c03316ece354fa297d2 --- /dev/null +++ b/apps/assets/VegaLite-BNmk2IVQ.js @@ -0,0 +1,189 @@ +var Ir;import{cG as xr,cH as Ar,cI as oe,cJ as $e,cK as ot,cL as Lr,cM as Rr,a as V,cN as st}from"./index-DgI7bmFZ.js";import{a as $r,b as Sr,d as Tr,c as Cr,e as Fr,f as Dr,g as Pr,h as kr,i as _r,j as Mr,k as jr,l as zr,m as Ur,n as Gr,o as Br,p as Vr,q as Wr,r as Xr,s as Hr,t as Yr,u as qr,v as Jr,w as Qr,x as Kr,y as Zr,z as en,A as tn,B as rn,C as nn,D as on,E as sn,F as an,G as ln,H as cn,I as dn,J as fn,K as pn,L as hn,N as un,O as mn,P as gn,Q as En,R as vn,S as bn,T as yn}from"./compile-BapKxctZ.js";import{e as wn}from"./index-_uHhs6Sh.js";const at={};function Se(e,t){e===void 0&&(e=at),t===void 0&&(t=at);const r=Object.keys(e),n=Object.keys(t);return e===t||r.length===n.length&&r.every(a=>e[a]===t[a])}const On=/("(?:[^\\"]|\\.)*")|[:,]/g;function Te(e,t={}){const r=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),n=r===""?1/0:t.maxLength===void 0?80:t.maxLength;let{replacer:a}=t;return function l(s,f,o){s&&typeof s.toJSON=="function"&&(s=s.toJSON());const i=JSON.stringify(s,a);if(i===void 0)return i;const u=n-f.length-o;if(i.length<=u){const c=i.replace(On,(d,b)=>b||`${d} `);if(c.length<=u)return c}if(a!=null&&(s=JSON.parse(i),a=void 0),typeof s=="object"&&s!==null){const c=f+r,d=[];let b,T,x=0;if(Array.isArray(s)){b="[",T="]";const{length:S}=s;for(;x0)return[b,r+d.join(`, +${c}`),T].join(` +${f}`)}return i}(e,"",0)}var In={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Nn={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},xn={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const An=Array.prototype.slice,W=(e,t,r)=>{const n=r?r(t[0]):t[0];return n[e].apply(n,An.call(t,1))};var Ln={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,r)=>Math.max(t,Math.min(r,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,r,n,a,l,s)=>new Date(e,t||0,r??1,n||0,a||0,l||0,s||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return W("join",arguments)},indexof:function(){return W("indexOf",arguments)},lastindexof:function(){return W("lastIndexOf",arguments)},slice:function(){return W("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(xr),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return W("substring",arguments,String)},split:function(){return W("split",arguments,String)},replace:function(){return W("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const Rn=["view","item","group","xy","x","y"],Ce=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&Ce.add(setImmediate);const $n={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const r=t.name;return e.memberDepth>0?r:r==="datum"?e.datum:r==="event"?e.event:r==="item"?e.item:In[r]||e.params["$"+r]},MemberExpression:(e,t)=>{const r=!t.computed,n=e(t.object);r&&(e.memberDepth+=1);const a=e(t.property);if(r&&(e.memberDepth-=1),!Ce.has(n[a]))return n[a];console.error(`Prevented interpretation of member "${a}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const r=t.arguments;let n=t.callee.name;return n.startsWith("_")&&(n=n.slice(1)),n==="if"?e(r[0])?e(r[1]):e(r[2]):(e.fn[n]||Ln[n]).apply(e.fn,r.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Nn[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>xn[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((r,n)=>{e.memberDepth+=1;const a=e(n.key);return e.memberDepth-=1,Ce.has(e(n.value))?console.error(`Prevented interpretation of property "${a}" which could lead to insecure code execution`):r[a]=e(n.value),r},{})};function se(e,t,r,n,a,l){const s=f=>$n[f.type](s,f);return s.memberDepth=0,s.fn=Object.create(t),s.params=r,s.datum=n,s.event=a,s.item=l,Rn.forEach(f=>s.fn[f]=function(){return a.vega[f](...arguments)}),s(e)}var Sn={operator(e,t){const r=t.ast,n=e.functions;return a=>se(r,n,a)},parameter(e,t){const r=t.ast,n=e.functions;return(a,l)=>se(r,n,l,a)},event(e,t){const r=t.ast,n=e.functions;return a=>se(r,n,void 0,void 0,a)},handler(e,t){const r=t.ast,n=e.functions;return(a,l)=>{const s=l.item&&l.item.datum;return se(r,n,a,s,l)}},encode(e,t){const{marktype:r,channels:n}=t,a=e.functions,l=r==="group"||r==="image"||r==="rect";return(s,f)=>{const o=s.datum;let i,u=0;for(const c in n)i=se(n[c].ast,a,f,o,void 0,s),s[c]!==i&&(s[c]=i,u=1);return r!=="rule"&&function(c,d,b){let T;d.x2&&(d.x?(b&&c.x>c.x2&&(T=c.x,c.x=c.x2,c.x2=T),c.width=c.x2-c.x):c.x=c.x2-(c.width||0)),d.xc&&(c.x=c.xc-(c.width||0)/2),d.y2&&(d.y?(b&&c.y>c.y2&&(T=c.y,c.y=c.y2,c.y2=T),c.height=c.y2-c.y):c.y=c.y2-(c.height||0)),d.yc&&(c.y=c.yc-(c.height||0)/2)}(s,n,l),u}}};const Tn="5.23.0",Cn=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:$r,accessPathWithDatum:Sr,accessWithDatumToUnescapedPath:Tr,compile:Cr,contains:Fr,deepEqual:Dr,deleteNestedProperty:Pr,duplicate:kr,entries:_r,every:Mr,fieldIntersection:jr,flatAccessWithDatum:zr,getFirstDefined:Ur,hasIntersection:Gr,hasProperty:Br,hash:Vr,internalField:Wr,isBoolean:Xr,isEmpty:Hr,isEqual:Yr,isInternalField:qr,isNullOrFalse:Jr,isNumeric:Qr,keys:Kr,logicalExpr:Zr,mergeDeep:en,never:tn,normalize:rn,normalizeAngle:nn,omit:on,pick:sn,prefixGenerator:an,removePathFromField:ln,replaceAll:cn,replacePathInField:dn,resetIdCounter:fn,setEqual:pn,some:hn,stringify:un,titleCase:mn,unique:gn,uniqueId:En,vals:vn,varName:bn,version:Tn},Symbol.toStringTag,{value:"Module"}));function lt(e){const[t,r]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:r}}var Fn="2.15.0";const re="#fff",ct="#888",Dn={background:"#333",view:{stroke:ct},title:{color:re,subtitleColor:re},style:{"guide-label":{fill:re},"guide-title":{fill:re}},axis:{domainColor:re,gridColor:ct,tickColor:re}},X="#4572a7",Pn={background:"#fff",arc:{fill:X},area:{fill:X},line:{stroke:X,strokeWidth:2},path:{stroke:X},rect:{fill:X},shape:{stroke:X},symbol:{fill:X,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},H="#30a2da",Fe="#cbcbcb",dt="#f0f0f0",ft="#333",kn={arc:{fill:H},area:{fill:H},axis:{domainColor:Fe,grid:!0,gridColor:Fe,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:Fe,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:dt,group:{fill:dt},legend:{labelColor:ft,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:ft,titleFontSize:14,titlePadding:10},line:{stroke:H,strokeWidth:2},path:{stroke:H,strokeWidth:.5},rect:{fill:H},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:H},bar:{binSpacing:2,fill:H,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Y="#000",_n={group:{fill:"#e5e5e5"},arc:{fill:Y},area:{fill:Y},line:{stroke:Y},path:{stroke:Y},rect:{fill:Y},shape:{stroke:Y},symbol:{fill:Y,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},pt="Benton Gothic, sans-serif",q="#82c6df",De="Benton Gothic Bold, sans-serif",ht="normal",ae={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},Mn={background:"#ffffff",title:{anchor:"start",color:"#000000",font:De,fontSize:22,fontWeight:"normal"},arc:{fill:q},area:{fill:q},line:{stroke:q,strokeWidth:2},path:{stroke:q},rect:{fill:q},shape:{stroke:q},symbol:{fill:q,size:30},axis:{labelFont:pt,labelFontSize:11.5,labelFontWeight:"normal",titleFont:De,titleFontSize:13,titleFontWeight:ht},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:pt,labelFontSize:11.5,symbolType:"square",titleFont:De,titleFontSize:13,titleFontWeight:ht},range:{category:ae["category-6"],diverging:ae["fireandice-6"],heatmap:ae["fire-7"],ordinal:ae["fire-7"],ramp:ae["fire-7"]}},J="#ab5787",ge="#979797",jn={background:"#f9f9f9",arc:{fill:J},area:{fill:J},line:{stroke:J},path:{stroke:J},rect:{fill:J},shape:{stroke:J},symbol:{fill:J,size:30},axis:{domainColor:ge,domainWidth:.5,gridWidth:.2,labelColor:ge,tickColor:ge,tickWidth:.2,titleColor:ge},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},Q="#3e5c69",zn={background:"#fff",arc:{fill:Q},area:{fill:Q},line:{stroke:Q},path:{stroke:Q},rect:{fill:Q},shape:{stroke:Q},symbol:{fill:Q},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},z="#1696d2",ut="#000000",Ee="Lato",Pe="Lato",le={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},Un={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:Ee},axisX:{domain:!0,domainColor:ut,domainWidth:1,grid:!1,labelFontSize:12,labelFont:Pe,labelAngle:0,tickColor:ut,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:Ee},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:Pe,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:Ee,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:Pe,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:Ee,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:le["six-groups-cat-1"],diverging:le["diverging-colors"],heatmap:le["diverging-colors"],ordinal:le["six-groups-seq"],ramp:le["shades-blue"]},area:{fill:z},rect:{fill:z},line:{color:z,stroke:z,strokeWidth:5},trail:{color:z,stroke:z,strokeWidth:0,size:1},path:{stroke:z,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:z,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:z,stroke:null}},arc:{fill:z},shape:{stroke:z},symbol:{fill:z,size:30}},K="#3366CC",mt="#ccc",ve="Arial, sans-serif",Gn={arc:{fill:K},area:{fill:K},path:{stroke:K},rect:{fill:K},shape:{stroke:K},symbol:{stroke:K},circle:{fill:K},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:ve,fontSize:12},"guide-title":{font:ve,fontSize:12},"group-title":{font:ve,fontSize:12}},title:{font:ve,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:mt,tickColor:mt,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},ke=e=>e*(1/3+1),gt=ke(9),Et=ke(10),vt=ke(12),ce="Segoe UI",bt="wf_standard-font, helvetica, arial, sans-serif",yt="#252423",de="#605E5C",wt="transparent",U="#118DFF",Ot="#DEEFFF",It=[Ot,U],Bn={view:{stroke:wt},background:wt,font:ce,header:{titleFont:bt,titleFontSize:vt,titleColor:yt,labelFont:ce,labelFontSize:Et,labelColor:de},axis:{ticks:!1,grid:!1,domain:!1,labelColor:de,labelFontSize:gt,titleFont:bt,titleColor:yt,titleFontSize:vt,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:U},line:{stroke:U,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:ce,fontSize:gt,fill:de},arc:{fill:U},area:{fill:U,line:!0,opacity:.6},path:{stroke:U},rect:{fill:U},point:{fill:U,filled:!0,size:75},shape:{stroke:U},symbol:{fill:U,strokeWidth:1.5,size:50},legend:{titleFont:ce,titleFontWeight:"bold",titleColor:de,labelFont:ce,labelFontSize:Et,labelColor:de,symbolType:"circle",symbolSize:75},range:{category:[U,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:It,heatmap:It,ordinal:[Ot,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",U]}},_e='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',be={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},Vn=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Wn=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function ye({theme:e,background:t}){const r=["white","g10"].includes(e)?"light":"dark",n=be.gridBg[e],a=be.textPrimary[e],l=be.textSecondary[e],s=r==="dark"?Vn:Wn,f=r==="dark"?"#d4bbff":"#6929c4";return{background:t,arc:{fill:f},area:{fill:f},path:{stroke:f},rect:{fill:f},shape:{stroke:f},symbol:{stroke:f},circle:{fill:f},view:{fill:n,stroke:n},group:{fill:n},title:{color:a,anchor:"start",dy:-15,fontSize:16,font:_e,fontWeight:600},axis:{labelColor:l,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:a,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:be.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:_e,fill:l,fontWeight:400},"guide-title":{font:_e,fill:l,fontWeight:400}},range:{category:s,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const Xn=ye({theme:"white",background:"#ffffff"}),Hn=ye({theme:"g10",background:"#f4f4f4"}),Yn=ye({theme:"g90",background:"#262626"}),qn=ye({theme:"g100",background:"#161616"}),Jn=Fn,Qn=Object.freeze(Object.defineProperty({__proto__:null,carbong10:Hn,carbong100:qn,carbong90:Yn,carbonwhite:Xn,dark:Dn,excel:Pn,fivethirtyeight:kn,ggplot2:_n,googlecharts:Gn,latimes:Mn,powerbi:Bn,quartz:jn,urbaninstitute:Un,version:Jn,vox:zn},Symbol.toStringTag,{value:"Module"}));function Nt(e,t){return JSON.stringify(e,function(r){const n=[];return function(a,l){if(typeof l!="object"||l===null)return l;const s=n.indexOf(this)+1;return n.length=s,n.length>r?"[Object]":n.indexOf(l)>=0?"[Circular]":(n.push(l),l)}}(t))}var Kn=`#vg-tooltip-element { + visibility: hidden; + padding: 8px; + position: fixed; + z-index: 1000; + font-family: sans-serif; + font-size: 11px; + border-radius: 3px; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); + /* The default theme is the light theme. */ + background-color: rgba(255, 255, 255, 0.95); + border: 1px solid #d9d9d9; + color: black; +} +#vg-tooltip-element.visible { + visibility: visible; +} +#vg-tooltip-element h2 { + margin-top: 0; + margin-bottom: 10px; + font-size: 13px; +} +#vg-tooltip-element table { + border-spacing: 0; +} +#vg-tooltip-element table tr { + border: none; +} +#vg-tooltip-element table tr td { + overflow: hidden; + text-overflow: ellipsis; + padding-top: 2px; + padding-bottom: 2px; +} +#vg-tooltip-element table tr td.key { + color: #808080; + max-width: 150px; + text-align: right; + padding-right: 4px; +} +#vg-tooltip-element table tr td.value { + display: block; + max-width: 300px; + max-height: 7em; + text-align: left; +} +#vg-tooltip-element.dark-theme { + background-color: rgba(32, 32, 32, 0.9); + border: 1px solid #f5f5f5; + color: white; +} +#vg-tooltip-element.dark-theme td.key { + color: #bfbfbf; +} +`;const xt="vg-tooltip-element",Zn={offsetX:10,offsetY:10,id:xt,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(oe(a)?a:Nt(a,r))).join(", ")}]`;if($e(e)){let a="";const{title:l,image:s,...f}=e;l&&(a+=`

${t(l)}

`),s&&(a+=``);const o=Object.keys(f);if(o.length>0){a+="";for(const i of o){let u=f[i];u!==void 0&&($e(u)&&(u=Nt(u,r)),a+=``)}a+="
${t(i)}${t(u)}
"}return a||"{}"}return t(e)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function At(e,t,{offsetX:r,offsetY:n}){const a=Lt({x1:e.clientX,x2:e.clientX,y1:e.clientY,y2:e.clientY},t,r,n),l=["bottom-right","bottom-left","top-right","top-left"];for(const s of l)if(Rt(a[s],t))return a[s];return a["top-left"]}function Lt(e,t,r,n){const a=(e.x1+e.x2)/2,l=(e.y1+e.y2)/2,s=e.x1-t.width-r,f=a-t.width/2,o=e.x2+r,i=e.y1-t.height-n,u=l-t.height/2,c=e.y2+n;return{top:{x:f,y:i},bottom:{x:f,y:c},left:{x:s,y:u},right:{x:o,y:u},"top-left":{x:s,y:i},"top-right":{x:o,y:i},"bottom-left":{x:s,y:c},"bottom-right":{x:o,y:c}}}function Rt(e,t){return e.x>=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function ei(e,t,r){return e.clientX>=t.x&&e.clientX<=t.x+r.width&&e.clientY>=t.y&&e.clientY<=t.y+r.height}class ti{constructor(t){this.options={...Zn,...t};const r=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const n=document.createElement("style");n.setAttribute("id",this.options.styleId),n.innerHTML=function(l){if(!/^[A-Za-z]+[-:.\w]*$/.test(l))throw new Error("Invalid HTML ID");return Kn.toString().replace(xt,l)}(r);const a=document.head;a.childNodes.length>0?a.insertBefore(n,a.childNodes[0]):a.appendChild(n)}}tooltipHandler(t,r,n,a){if(this.el=document.getElementById(this.options.id),!this.el&&(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),a==null||a==="")return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(a,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:l,y:s}=this.options.anchor==="mark"?function(f,o,i,u,c){const{position:d,offsetX:b,offsetY:T}=c,x=function(N,_,L){const C=L.isVoronoi?L.datum.bounds:L.bounds;let F=N.left+_[0]+C.x1,P=N.top+_[1]+C.y1,k=L;for(;k.mark.group;)k=k.mark.group,F+=k.x??0,P+=k.y??0;return{x1:F,x2:F+(C.x2-C.x1),y1:P,y2:P+(C.y2-C.y1)}}(f._el.getBoundingClientRect(),f._origin,i),S=Lt(x,u,b,T),G=Array.isArray(d)?d:[d];for(const N of G)if(Rt(S[N],u)&&!ei(o,S[N],u))return S[N];return At(o,u,c)}(t,r,n,this.el.getBoundingClientRect(),this.options):At(r,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${s}px`,this.el.style.left=`${l}px`}}var Me={},ri=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var l in a)a.hasOwnProperty(l)&&(n[l]=a[l])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),ni=Object.prototype.hasOwnProperty;/*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + */function je(e,t){return ni.call(e,t)}function ze(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r=48&&t<=57))return!1;r++}return!0}function Z(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function $t(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ge(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t0&&f[i-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&c===void 0&&(o[d]===void 0?c=f.slice(0,i).join("/"):i==u-1&&(c=t.path),c!==void 0&&b(t,0,e,c)),i++,Array.isArray(o)){if(d==="-")d=o.length;else{if(r&&!Ue(d))throw new $("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",l,t,e);Ue(d)&&(d=~~d)}if(i>=u){if(r&&t.op==="add"&&d>o.length)throw new $("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",l,t,e);if((s=oi[t.op].call(t,o,d,e)).test===!1)throw new $("Test operation failed","TEST_OPERATION_FAILED",l,t,e);return s}}else if(i>=u){if((s=ne[t.op].call(t,o,d,e)).test===!1)throw new $("Test operation failed","TEST_OPERATION_FAILED",l,t,e);return s}if(o=o[d],r&&i0)throw new $('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new $("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new $("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Ge(e.value))throw new $("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var a=e.path.split("/").length,l=n.split("/").length;if(a!==l+1&&a!==l)throw new $("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new $("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s=Ct([{op:"_get",path:e.from,value:void 0}],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new $("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}function Ct(e,t,r){try{if(!Array.isArray(e))throw new $("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Oe(M(t),M(e),r||!0);else{r=r||Ie;for(var n=0;n0&&(e.patches=[],e.callback&&e.callback(n)),n}function We(e,t,r,n,a){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var l=ze(t),s=ze(e),f=!1,o=s.length-1;o>=0;o--){var i=e[c=s[o]];if(!je(t,c)||t[c]===void 0&&i!==void 0&&Array.isArray(t)===!1)Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:n+"/"+Z(c),value:M(i)}),r.push({op:"remove",path:n+"/"+Z(c)}),f=!0):(a&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}));else{var u=t[c];typeof i=="object"&&i!=null&&typeof u=="object"&&u!=null&&Array.isArray(i)===Array.isArray(u)?We(i,u,r,n+"/"+Z(c),a):i!==u&&(a&&r.push({op:"test",path:n+"/"+Z(c),value:M(i)}),r.push({op:"replace",path:n+"/"+Z(c),value:M(u)}))}}if(f||l.length!=s.length)for(o=0;or?typeof r!="object"?e:r:t}Object.assign({},si,ci,{JsonPatchError:Tt,deepClone:M,escapePathComponent:Z,unescapePathComponent:$t});var _t,Mt,jt,zt,Ut,Gt,Bt,Vt,Wt,Xt,Ht,Yt,qt,Jt,Qt,Kt,Zt,er,tr,rr,nr,ir,or,sr,ar,He,lr,Ye,cr,dr,fr,qe={exports:{}};function Je(){return Mt?_t:(Mt=1,_t={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2})}function Ne(){return zt?jt:(zt=1,jt=typeof process=="object"&&Me&&Me.NODE_DEBUG&&/\bsemver\b/i.test(Me.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{})}function Qe(){return Ut||(Ut=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Je(),l=Ne(),s=(t=e.exports={}).re=[],f=t.safeRe=[],o=t.src=[],i=t.t={};let u=0;const c="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",a],[c,n]],b=(T,x,S)=>{const G=(_=>{for(const[L,C]of d)_=_.split(`${L}*`).join(`${L}{0,${C}}`).split(`${L}+`).join(`${L}{1,${C}}`);return _})(x),N=u++;l(T,N,x),i[T]=N,o[N]=x,s[N]=new RegExp(x,S?"g":void 0),f[N]=new RegExp(G,S?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*"),b("NUMERICIDENTIFIERLOOSE","\\d+"),b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),b("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`),b("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${c}+`),b("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`),b("FULL",`^${o[i.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`),b("LOOSE",`^${o[i.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?)?)?`),b("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),b("COERCE",`${o[i.COERCEPLAIN]}(?:$|[^\\d])`),b("COERCEFULL",o[i.COERCEPLAIN]+`(?:${o[i.PRERELEASE]})?(?:${o[i.BUILD]})?(?:$|[^\\d])`),b("COERCERTL",o[i.COERCE],!0),b("COERCERTLFULL",o[i.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",b("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",b("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})\\s+-\\s+(${o[i.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[i.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(qe,qe.exports)),qe.exports}function Ke(){if(Wt)return Vt;Wt=1;const e=Ne(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Je(),{safeRe:n,t:a}=Qe(),l=Xe(),{compareIdentifiers:s}=function(){if(Bt)return Gt;Bt=1;const o=/^[0-9]+$/,i=(u,c)=>{const d=o.test(u),b=o.test(c);return d&&b&&(u=+u,c=+c),u===c?0:d&&!b?-1:b&&!d?1:ui(c,u)}}();class f{constructor(i,u){if(u=l(u),i instanceof f){if(i.loose===!!u.loose&&i.includePrerelease===!!u.includePrerelease)return i;i=i.version}else if(typeof i!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);if(i.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",i,u),this.options=u,this.loose=!!u.loose,this.includePrerelease=!!u.includePrerelease;const c=i.trim().match(u.loose?n[a.LOOSE]:n[a.FULL]);if(!c)throw new TypeError(`Invalid Version: ${i}`);if(this.raw=i,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const b=+d;if(b>=0&&b=0;)typeof this.prerelease[b]=="number"&&(this.prerelease[b]++,b=-2);if(b===-1){if(u===this.prerelease.join(".")&&c===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(u){let b=[u,d];c===!1&&(b=[u]),s(this.prerelease[0],u)===0?isNaN(this.prerelease[1])&&(this.prerelease=b):this.prerelease=b}break}default:throw new Error(`invalid increment argument: ${i}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Vt=f}function ie(){if(Ht)return Xt;Ht=1;const e=Ke();return Xt=(t,r,n)=>new e(t,n).compare(new e(r,n))}function fi(){if(ar)return sr;ar=1;const e=function(){if(qt)return Yt;qt=1;const s=ie();return Yt=(f,o,i)=>s(f,o,i)===0}(),t=function(){if(Qt)return Jt;Qt=1;const s=ie();return Jt=(f,o,i)=>s(f,o,i)!==0}(),r=function(){if(Zt)return Kt;Zt=1;const s=ie();return Kt=(f,o,i)=>s(f,o,i)>0}(),n=function(){if(tr)return er;tr=1;const s=ie();return er=(f,o,i)=>s(f,o,i)>=0}(),a=function(){if(nr)return rr;nr=1;const s=ie();return rr=(f,o,i)=>s(f,o,i)<0}(),l=function(){if(or)return ir;or=1;const s=ie();return ir=(f,o,i)=>s(f,o,i)<=0}();return sr=(s,f,o,i)=>{switch(f){case"===":return typeof s=="object"&&(s=s.version),typeof o=="object"&&(o=o.version),s===o;case"!==":return typeof s=="object"&&(s=s.version),typeof o=="object"&&(o=o.version),s!==o;case"":case"=":case"==":return e(s,o,i);case"!=":return t(s,o,i);case">":return r(s,o,i);case">=":return n(s,o,i);case"<":return a(s,o,i);case"<=":return l(s,o,i);default:throw new TypeError(`Invalid operator: ${f}`)}}}function pr(){if(cr)return Ye;cr=1;const e=/\s+/g;class t{constructor(m,p){if(p=n(p),m instanceof t)return m.loose===!!p.loose&&m.includePrerelease===!!p.includePrerelease?m:new t(m.raw,p);if(m instanceof a)return this.raw=m.value,this.set=[[m]],this.formatted=void 0,this;if(this.options=p,this.loose=!!p.loose,this.includePrerelease=!!p.includePrerelease,this.raw=m.trim().replace(e," "),this.set=this.raw.split("||").map(g=>this.parseRange(g.trim())).filter(g=>g.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const g=this.set[0];if(this.set=this.set.filter(h=>!T(h[0])),this.set.length===0)this.set=[g];else if(this.set.length>1){for(const h of this.set)if(h.length===1&&x(h[0])){this.set=[h];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let m=0;m0&&(this.formatted+="||");const p=this.set[m];for(let g=0;g0&&(this.formatted+=" "),this.formatted+=p[g].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(m){const p=((this.options.includePrerelease&&d)|(this.options.loose&&b))+":"+m,g=r.get(p);if(g)return g;const h=this.options.loose,E=h?f[o.HYPHENRANGELOOSE]:f[o.HYPHENRANGE];m=m.replace(E,j(this.options.includePrerelease)),l("hyphen replace",m),m=m.replace(f[o.COMPARATORTRIM],i),l("comparator trim",m),m=m.replace(f[o.TILDETRIM],u),l("tilde trim",m),m=m.replace(f[o.CARETTRIM],c),l("caret trim",m);let w=m.split(" ").map(y=>G(y,this.options)).join(" ").split(/\s+/).map(y=>Le(y,this.options));h&&(w=w.filter(y=>(l("loose invalid filter",y,this.options),!!y.match(f[o.COMPARATORLOOSE])))),l("range list",w);const O=new Map,I=w.map(y=>new a(y,this.options));for(const y of I){if(T(y))return[y];O.set(y.value,y)}O.size>1&&O.has("")&&O.delete("");const R=[...O.values()];return r.set(p,R),R}intersects(m,p){if(!(m instanceof t))throw new TypeError("a Range is required");return this.set.some(g=>S(g,p)&&m.set.some(h=>S(h,p)&&g.every(E=>h.every(w=>E.intersects(w,p)))))}test(m){if(!m)return!1;if(typeof m=="string")try{m=new s(m,this.options)}catch{return!1}for(let p=0;p=this.max){const p=this.map.keys().next().value;this.delete(p)}this.map.set(v,m)}return this}})),n=Xe(),a=function(){if(lr)return He;lr=1;const v=Symbol("SemVer ANY");class m{static get ANY(){return v}constructor(y,A){if(A=p(A),y instanceof m){if(y.loose===!!A.loose)return y;y=y.value}y=y.trim().split(/\s+/).join(" "),w("comparator",y,A),this.options=A,this.loose=!!A.loose,this.parse(y),this.semver===v?this.value="":this.value=this.operator+this.semver.version,w("comp",this)}parse(y){const A=this.options.loose?g[h.COMPARATORLOOSE]:g[h.COMPARATOR],D=y.match(A);if(!D)throw new TypeError(`Invalid comparator: ${y}`);this.operator=D[1]!==void 0?D[1]:"",this.operator==="="&&(this.operator=""),D[2]?this.semver=new O(D[2],this.options.loose):this.semver=v}toString(){return this.value}test(y){if(w("Comparator.test",y,this.options.loose),this.semver===v||y===v)return!0;if(typeof y=="string")try{y=new O(y,this.options)}catch{return!1}return E(y,this.operator,this.semver,this.options)}intersects(y,A){if(!(y instanceof m))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""||new I(y.value,A).test(this.value):y.operator===""?y.value===""||new I(this.value,A).test(y.semver):!((A=p(A)).includePrerelease&&(this.value==="<0.0.0-0"||y.value==="<0.0.0-0")||!A.includePrerelease&&(this.value.startsWith("<0.0.0")||y.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!y.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!y.operator.startsWith("<"))&&(this.semver.version!==y.semver.version||!this.operator.includes("=")||!y.operator.includes("="))&&!(E(this.semver,"<",y.semver,A)&&this.operator.startsWith(">")&&y.operator.startsWith("<"))&&!(E(this.semver,">",y.semver,A)&&this.operator.startsWith("<")&&y.operator.startsWith(">")))}}He=m;const p=Xe(),{safeRe:g,t:h}=Qe(),E=fi(),w=Ne(),O=Ke(),I=pr();return He}(),l=Ne(),s=Ke(),{safeRe:f,t:o,comparatorTrimReplace:i,tildeTrimReplace:u,caretTrimReplace:c}=Qe(),{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:b}=Je(),T=v=>v.value==="<0.0.0-0",x=v=>v.value==="",S=(v,m)=>{let p=!0;const g=v.slice();let h=g.pop();for(;p&&g.length;)p=g.every(E=>h.intersects(E,m)),h=g.pop();return p},G=(v,m)=>(l("comp",v,m),v=C(v,m),l("caret",v),v=_(v,m),l("tildes",v),v=P(v,m),l("xrange",v),v=me(v,m),l("stars",v),v),N=v=>!v||v.toLowerCase()==="x"||v==="*",_=(v,m)=>v.trim().split(/\s+/).map(p=>L(p,m)).join(" "),L=(v,m)=>{const p=m.loose?f[o.TILDELOOSE]:f[o.TILDE];return v.replace(p,(g,h,E,w,O)=>{let I;return l("tilde",v,g,h,E,w,O),N(h)?I="":N(E)?I=`>=${h}.0.0 <${+h+1}.0.0-0`:N(w)?I=`>=${h}.${E}.0 <${h}.${+E+1}.0-0`:O?(l("replaceTilde pr",O),I=`>=${h}.${E}.${w}-${O} <${h}.${+E+1}.0-0`):I=`>=${h}.${E}.${w} <${h}.${+E+1}.0-0`,l("tilde return",I),I})},C=(v,m)=>v.trim().split(/\s+/).map(p=>F(p,m)).join(" "),F=(v,m)=>{l("caret",v,m);const p=m.loose?f[o.CARETLOOSE]:f[o.CARET],g=m.includePrerelease?"-0":"";return v.replace(p,(h,E,w,O,I)=>{let R;return l("caret",v,h,E,w,O,I),N(E)?R="":N(w)?R=`>=${E}.0.0${g} <${+E+1}.0.0-0`:N(O)?R=E==="0"?`>=${E}.${w}.0${g} <${E}.${+w+1}.0-0`:`>=${E}.${w}.0${g} <${+E+1}.0.0-0`:I?(l("replaceCaret pr",I),R=E==="0"?w==="0"?`>=${E}.${w}.${O}-${I} <${E}.${w}.${+O+1}-0`:`>=${E}.${w}.${O}-${I} <${E}.${+w+1}.0-0`:`>=${E}.${w}.${O}-${I} <${+E+1}.0.0-0`):(l("no pr"),R=E==="0"?w==="0"?`>=${E}.${w}.${O}${g} <${E}.${w}.${+O+1}-0`:`>=${E}.${w}.${O}${g} <${E}.${+w+1}.0-0`:`>=${E}.${w}.${O} <${+E+1}.0.0-0`),l("caret return",R),R})},P=(v,m)=>(l("replaceXRanges",v,m),v.split(/\s+/).map(p=>k(p,m)).join(" ")),k=(v,m)=>{v=v.trim();const p=m.loose?f[o.XRANGELOOSE]:f[o.XRANGE];return v.replace(p,(g,h,E,w,O,I)=>{l("xRange",v,g,h,E,w,O,I);const R=N(E),y=R||N(w),A=y||N(O),D=A;return h==="="&&D&&(h=""),I=m.includePrerelease?"-0":"",R?g=h===">"||h==="<"?"<0.0.0-0":"*":h&&D?(y&&(w=0),O=0,h===">"?(h=">=",y?(E=+E+1,w=0,O=0):(w=+w+1,O=0)):h==="<="&&(h="<",y?E=+E+1:w=+w+1),h==="<"&&(I="-0"),g=`${h+E}.${w}.${O}${I}`):y?g=`>=${E}.0.0${I} <${+E+1}.0.0-0`:A&&(g=`>=${E}.${w}.0${I} <${E}.${+w+1}.0-0`),l("xRange return",g),g})},me=(v,m)=>(l("replaceStars",v,m),v.trim().replace(f[o.STAR],"")),Le=(v,m)=>(l("replaceGTE0",v,m),v.trim().replace(f[m.includePrerelease?o.GTE0PRE:o.GTE0],"")),j=v=>(m,p,g,h,E,w,O,I,R,y,A,D)=>`${p=N(g)?"":N(h)?`>=${g}.0.0${v?"-0":""}`:N(E)?`>=${g}.${h}.0${v?"-0":""}`:w?`>=${p}`:`>=${p}${v?"-0":""}`} ${I=N(R)?"":N(y)?`<${+R+1}.0.0-0`:N(A)?`<${R}.${+y+1}.0-0`:D?`<=${R}.${y}.${A}-${D}`:v?`<${R}.${y}.${+A+1}-0`:`<=${I}`}`.trim(),te=(v,m,p)=>{for(let g=0;g0){const h=v[g].semver;if(h.major===m.major&&h.minor===m.minor&&h.patch===m.patch)return!0}return!1}return!0};return Ye}var hr=di(function(){if(fr)return dr;fr=1;const e=pr();return dr=(t,r,n)=>{try{r=new e(r,n)}catch{return!1}return r.test(t)}}()),pi=`.vega-embed { + position: relative; + display: inline-block; + box-sizing: border-box; +} +.vega-embed.has-actions { + padding-right: 38px; +} +.vega-embed details:not([open]) > :not(summary) { + display: none !important; +} +.vega-embed summary { + list-style: none; + position: absolute; + top: 0; + right: 0; + padding: 6px; + z-index: 1000; + background: white; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); + color: #1b1e23; + border: 1px solid #aaa; + border-radius: 999px; + opacity: 0.2; + transition: opacity 0.4s ease-in; + cursor: pointer; + line-height: 0px; +} +.vega-embed summary::-webkit-details-marker { + display: none; +} +.vega-embed summary:active { + box-shadow: #aaa 0px 0px 0px 1px inset; +} +.vega-embed summary svg { + width: 14px; + height: 14px; +} +.vega-embed details[open] summary { + opacity: 0.7; +} +.vega-embed:hover summary, .vega-embed:focus-within summary { + opacity: 1 !important; + transition: opacity 0.2s ease; +} +.vega-embed .vega-actions { + position: absolute; + z-index: 1001; + top: 35px; + right: -9px; + display: flex; + flex-direction: column; + padding-bottom: 8px; + padding-top: 8px; + border-radius: 4px; + box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); + border: 1px solid #d9d9d9; + background: white; + animation-duration: 0.15s; + animation-name: scale-in; + animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); + text-align: left; +} +.vega-embed .vega-actions a { + padding: 8px 16px; + font-family: sans-serif; + font-size: 14px; + font-weight: 600; + white-space: nowrap; + color: #434a56; + text-decoration: none; +} +.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus { + background-color: #f7f7f9; + color: black; +} +.vega-embed .vega-actions::before, .vega-embed .vega-actions::after { + content: ""; + display: inline-block; + position: absolute; +} +.vega-embed .vega-actions::before { + left: auto; + right: 14px; + top: -16px; + border: 8px solid rgba(0, 0, 0, 0); + border-bottom-color: #d9d9d9; +} +.vega-embed .vega-actions::after { + left: auto; + right: 15px; + top: -14px; + border: 7px solid rgba(0, 0, 0, 0); + border-bottom-color: #fff; +} +.vega-embed .chart-wrapper.fit-x { + width: 100%; +} +.vega-embed .chart-wrapper.fit-y { + height: 100%; +} + +.vega-embed-wrapper { + max-width: 100%; + overflow: auto; + padding-right: 14px; +} + +@keyframes scale-in { + from { + opacity: 0; + transform: scale(0.6); + } + to { + opacity: 1; + transform: scale(1); + } +} +`;function ur(e,...t){for(const r of t)hi(e,r);return e}function hi(e,t){for(const r of Object.keys(t))Rr(e,r,t[r],!0)}const B=yn;let pe=Cn;const xe=typeof window<"u"?window:void 0;pe===void 0&&((Ir=xe==null?void 0:xe.vl)!=null&&Ir.compile)&&(pe=xe.vl);const ui={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},mi={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},he={vega:"Vega","vega-lite":"Vega-Lite"},Ae={vega:B.version,"vega-lite":pe?pe.version:"not available"},gi={vega:e=>e,"vega-lite":(e,t)=>pe.compile(e,{config:t}).spec},Ei=` + + + + +`,vi="chart-wrapper";function mr(e,t,r,n){const a=`${t}
`,l=`
${r}`,s=window.open("");s.document.write(a+e+l),s.document.title=`${he[n]} JSON Source`}function gr(e){return!(!e||!("load"in e))}function Er(e){return gr(e)?e:B.loader(e)}async function bi(e,t,r={}){let n,a;oe(t)?(a=Er(r.loader),n=JSON.parse(await a.load(t))):n=t;const l=function(u){var d;const c=((d=u.usermeta)==null?void 0:d.embedOptions)??{};return oe(c.defaultStyle)&&(c.defaultStyle=!1),c}(n),s=l.loader;a&&!s||(a=Er(r.loader??s));const f=await vr(l,a),o=await vr(r,a),i={...ur(o,f),config:ot(o.config??{},f.config??{})};return await async function(u,c,d={},b){const T=d.theme?ot(Qn[d.theme],d.config??{}):d.config,x=Lr(d.actions)?d.actions:ur({},ui,d.actions??{}),S={...mi,...d.i18n},G=d.renderer??"canvas",N=d.logLevel??B.Warn,_=d.downloadFileName??"visualization",L=typeof u=="string"?document.querySelector(u):u;if(!L)throw new Error(`${u} does not exist`);if(d.defaultStyle!==!1){const p="vega-embed-style",{root:g,rootContainer:h}=function(E){const w=E.getRootNode?E.getRootNode():document;return w instanceof ShadowRoot?{root:w,rootContainer:w}:{root:document,rootContainer:document.head??document.body}}(L);if(!g.getElementById(p)){const E=document.createElement("style");E.id=p,E.innerHTML=d.defaultStyle===void 0||d.defaultStyle===!0?pi.toString():d.defaultStyle,h.appendChild(E)}}const C=function(p,g){if(p.$schema){const h=lt(p.$schema);g&&g!==h.library&&console.warn(`The given visualization spec is written in ${he[h.library]}, but mode argument sets ${he[g]??g}.`);const E=h.library;return hr(Ae[E],`^${h.version.slice(1)}`)||console.warn(`The input spec uses ${he[E]} ${h.version}, but the current version of ${he[E]} is v${Ae[E]}.`),E}return"mark"in p||"encoding"in p||"layer"in p||"hconcat"in p||"vconcat"in p||"facet"in p||"repeat"in p?"vega-lite":"marks"in p||"signals"in p||"scales"in p||"axes"in p?"vega":g??"vega"}(c,d.mode);let F=gi[C](c,T);if(C==="vega-lite"&&F.$schema){const p=lt(F.$schema);hr(Ae.vega,`^${p.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${p.version}, but current version is v${Ae.vega}.`)}L.classList.add("vega-embed"),x&&L.classList.add("has-actions"),L.innerHTML="";let P=L;if(x){const p=document.createElement("div");p.classList.add(vi),L.appendChild(p),P=p}const k=d.patch;if(k&&(F=k instanceof Function?k(F):Oe(F,k,!0,!1).newDocument),d.formatLocale&&B.formatLocale(d.formatLocale),d.timeFormatLocale&&B.timeFormatLocale(d.timeFormatLocale),d.expressionFunctions)for(const p in d.expressionFunctions){const g=d.expressionFunctions[p];"fn"in g?B.expressionFunction(p,g.fn,g.visitor):g instanceof Function&&B.expressionFunction(p,g)}const{ast:me}=d,Le=B.parse(F,C==="vega-lite"?{}:T,{ast:me}),j=new(d.viewClass||B.View)(Le,{loader:b,logLevel:N,renderer:G,...me?{expr:B.expressionInterpreter??d.expr??Sn}:{}});if(j.addSignalListener("autosize",(p,g)=>{const{type:h}=g;h=="fit-x"?(P.classList.add("fit-x"),P.classList.remove("fit-y")):h=="fit-y"?(P.classList.remove("fit-x"),P.classList.add("fit-y")):h=="fit"?P.classList.add("fit-x","fit-y"):P.classList.remove("fit-x","fit-y")}),d.tooltip!==!1){const{loader:p,tooltip:g}=d,h=p&&!gr(p)?p==null?void 0:p.baseURL:void 0,E=typeof g=="function"?g:new ti({baseURL:h,...g===!0?{}:g}).call;j.tooltip(E)}let te,{hover:v}=d;if(v===void 0&&(v=C==="vega"),v){const{hoverSet:p,updateSet:g}=typeof v=="boolean"?{}:v;j.hover(p,g)}if(d&&(d.width!=null&&j.width(d.width),d.height!=null&&j.height(d.height),d.padding!=null&&j.padding(d.padding)),await j.initialize(P,d.bind).runAsync(),x!==!1){let p=L;if(d.defaultStyle!==!1||d.forceActionsMenu){const h=document.createElement("details");h.title=S.CLICK_TO_VIEW_ACTIONS,L.append(h),p=h;const E=document.createElement("summary");E.innerHTML=Ei,h.append(E),te=w=>{h.contains(w.target)||h.removeAttribute("open")},document.addEventListener("click",te)}const g=document.createElement("div");if(p.append(g),g.classList.add("vega-actions"),x===!0||x.export!==!1){for(const h of["svg","png"])if(x===!0||x.export===!0||x.export[h]){const E=S[`${h.toUpperCase()}_ACTION`],w=document.createElement("a"),O=$e(d.scaleFactor)?d.scaleFactor[h]:d.scaleFactor;w.text=E,w.href="#",w.target="_blank",w.download=`${_}.${h}`,w.addEventListener("mousedown",async function(I){I.preventDefault();const R=await j.toImageURL(h,O);this.href=R}),g.append(w)}}if(x===!0||x.source!==!1){const h=document.createElement("a");h.text=S.SOURCE_ACTION,h.href="#",h.addEventListener("click",function(E){mr(Te(c),d.sourceHeader??"",d.sourceFooter??"",C),E.preventDefault()}),g.append(h)}if(C==="vega-lite"&&(x===!0||x.compiled!==!1)){const h=document.createElement("a");h.text=S.COMPILED_ACTION,h.href="#",h.addEventListener("click",function(E){mr(Te(F),d.sourceHeader??"",d.sourceFooter??"","vega"),E.preventDefault()}),g.append(h)}if(x===!0||x.editor!==!1){const h=d.editorUrl??"https://vega.github.io/editor/",E=document.createElement("a");E.text=S.EDITOR_ACTION,E.href="#",E.addEventListener("click",function(w){(function(O,I,R){const y=O.open(I),{origin:A}=new URL(I);let D=40;O.addEventListener("message",function Re(Nr){Nr.source===y&&(D=0,O.removeEventListener("message",Re,!1))},!1),setTimeout(function Re(){D<=0||(y.postMessage(R,A),setTimeout(Re,250),D-=1)},250)})(window,h,{config:T,mode:k?"vega":C,renderer:G,spec:Te(k?F:c)}),w.preventDefault()}),g.append(E)}}function m(){te&&document.removeEventListener("click",te),j.finalize()}return{view:j,spec:c,vgSpec:F,finalize:m,embedOptions:d}}(e,n,i,a)}async function vr(e,t){const r=oe(e.config)?JSON.parse(await t.load(e.config)):e.config??{},n=oe(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...n?{patch:n}:{},...r?{config:r}:{}}}function yi(e,t){Object.keys(t).forEach(r=>{(function(n,a,l){var s;l&&((s=l)&&{}.toString.call(s)==="[object Function]"?l(n.data(a)):n.change(a,B.changeset().remove(()=>!0).insert(l)))})(e,r,t[r])})}function br(e){const t=new Set;return e.forEach(r=>{Object.keys(r).forEach(n=>{t.add(n)})}),t}const yr=()=>{};function Ze(e,t){const r=Object.keys(t);return r.forEach(n=>{try{e.addSignalListener(n,t[n])}catch(a){console.warn("Cannot add invalid signal listener.",a)}}),r.length>0}function wr(e,t){const r=Object.keys(t);return r.forEach(n=>{try{e.removeSignalListener(n,t[n])}catch(a){console.warn("Cannot remove invalid signal listener.",a)}}),r.length>0}function et(e){const{spec:t,width:r,height:n}=e;return r!==void 0&&n!==void 0?{...t,width:r,height:n}:r!==void 0?{...t,width:r}:n!==void 0?{...t,height:n}:t}function ue(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Or extends V.PureComponent{constructor(){super(...arguments),ue(this,"containerRef",V.createRef()),ue(this,"resultPromise",void 0),ue(this,"handleError",t=>{const{onError:r=yr}=this.props;r(t,this.containerRef.current),console.warn(t)}),ue(this,"modifyView",t=>{this.resultPromise&&this.resultPromise.then(r=>(r&&t(r.view),!0)).catch(this.handleError)})}componentDidMount(){this.createView()}componentDidUpdate(t){const r=br([this.props,t]);if(r.delete("className"),r.delete("signalListeners"),r.delete("spec"),r.delete("style"),r.delete("width"),r.delete("height"),Array.from(r).some(n=>this.props[n]!==t[n]))this.clearView(),this.createView();else{const n=function(s,f){if(s===f)return!1;const o={width:!1,height:!1,isExpensive:!1},i=br([s,f]);return!i.has("width")||"width"in s&&"width"in f&&s.width===f.width||("width"in s&&typeof s.width=="number"?o.width=s.width:o.isExpensive=!0),!i.has("height")||"height"in s&&"height"in f&&s.height===f.height||("height"in s&&typeof s.height=="number"?o.height=s.height:o.isExpensive=!0),i.delete("width"),i.delete("height"),[...i].some(u=>!(u in s)||!(u in f)||!wn(s[u],f[u]))&&(o.isExpensive=!0),!(o.width===!1&&o.height===!1&&!o.isExpensive)&&o}(et(this.props),et(t)),{signalListeners:a}=this.props,{signalListeners:l}=t;if(n)if(n.isExpensive)this.clearView(),this.createView();else{const s=!Se(a,l);this.modifyView(f=>{n.width!==!1&&f.width(n.width),n.height!==!1&&f.height(n.height),s&&(l&&wr(f,l),a&&Ze(f,a)),f.run()})}else Se(a,l)||this.modifyView(s=>{l&&wr(s,l),a&&Ze(s,a),s.run()})}}componentWillUnmount(){this.clearView()}createView(){const{spec:t,onNewView:r,signalListeners:n={},width:a,height:l,...s}=this.props;if(this.containerRef.current){const f=et(this.props);this.resultPromise=bi(this.containerRef.current,f,s).then(o=>{if(o){const{view:i}=o;Ze(i,n)&&i.run()}return o}).catch(this.handleError),r&&this.modifyView(r)}}clearView(){return this.resultPromise&&this.resultPromise.then(t=>{t&&t.finalize()}).catch(this.handleError),this.resultPromise=void 0,this}render(){const{className:t,style:r}=this.props;return V.createElement("div",{ref:this.containerRef,className:t,style:r})}}function tt(){return tt=Object.assign||function(e){for(var t=1;t{this.update();const{onNewView:r=yr}=this.props;r(t)})}componentDidMount(){this.update()}componentDidUpdate(t){Se(this.props.data,t.data)||this.update()}update(){const{data:t}=this.props;this.vegaEmbed.current&&t&&Object.keys(t).length>0&&this.vegaEmbed.current.modifyView(r=>{yi(r,t),r.resize().run()})}render(){const{data:t,...r}=this.props;return V.createElement(Or,tt({ref:this.vegaEmbed},r,{onNewView:this.handleNewView}))}}function it(){return it=Object.assign||function(e){for(var t=1;t-1}var Y=Object.getOwnPropertySymbols?function(r){for(var e=[];r;)J(e,F(r)),r=K(r);return e}:H;function $(r){return rr(r,m,Y)}var dr=Object.prototype.hasOwnProperty,Ar=/\w*$/,z=M?M.prototype:void 0,G=z?z.valueOf:void 0;function hr(r,e,n){var u,i,a,c=r.constructor;switch(e){case"[object ArrayBuffer]":return B(r);case"[object Boolean]":case"[object Date]":return new c(+r);case"[object DataView]":return function(s,b){var v=b?B(s.buffer):s.buffer;return new s.constructor(v,s.byteOffset,s.byteLength)}(r,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return er(r,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(r);case"[object RegExp]":return(a=new(i=r).constructor(i.source,Ar.exec(i))).lastIndex=i.lastIndex,a;case"[object Symbol]":return u=r,G?Object(G.call(u)):{}}}var L=d&&d.isMap,gr=L?P(L):function(r){return D(r)&&S(r)=="[object Map]"},Q=d&&d.isSet,wr=Q?P(Q):function(r){return D(r)&&S(r)=="[object Set]"},T="[object Arguments]",X="[object Function]",Z="[object Object]",o={};function h(r,e,n,u,i,a){var c,s=1&e,b=2&e,v=4&e;if(c!==void 0)return c;if(!nr(r))return r;var l=A(r);if(l){if(c=function(t){var f=t.length,g=new t.constructor(f);return f&&typeof t[0]=="string"&&dr.call(t,"index")&&(g.index=t.index,g.input=t.input),g}(r),!s)return tr(r,c)}else{var j=S(r),y=j==X||j=="[object GeneratorFunction]";if(cr(r))return or(r,s);if(j==Z||j==T||y&&!i){if(c=b||y?{}:ar(r),!s)return b?function(t,f){return p(t,Y(t),f)}(r,function(t,f){return t&&p(f,m(f),t)}(c,r)):function(t,f){return p(t,F(t),f)}(r,function(t,f){return t&&p(f,w(f),t)}(c,r))}else{if(!o[j])return i?r:{};c=hr(r,j,s)}}a||(a=new ur);var O=a.get(r);if(O)return O;a.set(r,c),wr(r)?r.forEach(function(t){c.add(h(t,e,n,t,r,a))}):gr(r)&&r.forEach(function(t,f){c.set(f,h(t,e,n,f,r,a))});var E=l?void 0:(v?b?$:sr:b?m:w)(r);return R(E||r,function(t,f){E&&(t=r[f=t]),ir(c,f,h(t,e,n,f,r,a))}),c}function _(r){return typeof r=="function"?r:fr}function mr(r,e){return(A(r)?R:I)(r,_(e))}function q(r,e){var n=[];return I(r,function(u,i,a){e(u,i,a)&&n.push(u)}),n}function Sr(r,e){return(A(r)?br:q)(r,V(e))}function xr(r){return r==null?[]:function(e,n){return jr(n,function(u){return e[u]})}(r,w(r))}function Ir(r){return r===void 0}function Or(r,e,n,u,i){return i(r,function(a,c,s){n=u?(u=!1,a):e(n,a,c,s)}),n}function Er(r,e,n){var u=A(r)?lr:Or,i=arguments.length<3;return u(r,V(e),n,i,I)}o[T]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object DataView]"]=o["[object Boolean]"]=o["[object Date]"]=o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Map]"]=o["[object Number]"]=o[Z]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object Symbol]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Error]"]=o[X]=o["[object WeakMap]"]=!1;var Fr=x&&1/U(new x([,-0]))[1]==1/0?function(r){return new x(r)}:C;function Br(r,e,n){var u=-1,i=W,a=r.length,c=!0,s=[],b=s;if(a>=200){var v=e?null:Fr(r);if(v)return U(v);c=!1,i=yr,b=new vr}else b=e?[]:s;r:for(;++u{const o=h.c(26);let t,r,m,i,l;o[0]!==f?({language:t,showCopyButton:m,extensions:i,...r}=f,o[0]=f,o[1]=t,o[2]=r,o[3]=m,o[4]=i):(t=o[1],r=o[2],m=o[3],i=o[4]),o[5]!==i?(l=i===void 0?[]:i,o[5]=i,o[6]=l):l=o[6];const u=l,p=t&&!(t in b);let x;p&&C.warn(`Language ${t} not found in CodeMirror.`);o:{if(!t){x=u;break o}const v=t;let n,d;o[7]!==v?(n=L(v),o[7]=v,o[8]=n):n=o[8],o[9]!==u||o[10]!==n?(d=[n,...u].filter(Boolean),o[9]=u,o[10]=n,o[11]=d):d=o[11],x=d}const j=x;let e,a,s,c;return o[12]!==p||o[13]!==t?(e=p&&g.jsx(k,{className:"mb-1 rounded-sm",error:`Language ${t} not supported. + +Supported languages are: ${Object.keys(b).join(", ")}`}),o[12]=p,o[13]=t,o[14]=e):e=o[14],o[15]!==p||o[16]!==r||o[17]!==m?(a=m&&!p&&g.jsx(w,{tooltip:!1,className:"absolute top-2 right-2 p-1 hover-action z-10 text-muted-foreground",value:r.value||"",toastTitle:"Copied to clipboard"}),o[15]=p,o[16]=r,o[17]=m,o[18]=a):a=o[18],o[19]!==j||o[20]!==r?(s=g.jsx(y,{...r,extensions:j}),o[19]=j,o[20]=r,o[21]=s):s=o[21],o[22]!==e||o[23]!==a||o[24]!==s?(c=g.jsxs("div",{className:"relative w-full group hover-actions-parent",children:[e,a,s]}),o[22]=e,o[23]=a,o[24]=s,o[25]=c):c=o[25],c};export{N as default}; diff --git a/apps/assets/apl-CXdQSnD-.js b/apps/assets/apl-CXdQSnD-.js new file mode 100644 index 0000000000000000000000000000000000000000..364620f6dd7234d65f3db013f37db23bf0f3eec9 --- /dev/null +++ b/apps/assets/apl-CXdQSnD-.js @@ -0,0 +1 @@ +var o={"+":["conjugate","add"],"\u2212":["negate","subtract"],"\xD7":["signOf","multiply"],"\xF7":["reciprocal","divide"],"\u2308":["ceiling","greaterOf"],"\u230A":["floor","lesserOf"],"\u2223":["absolute","residue"],"\u2373":["indexGenerate","indexOf"],"?":["roll","deal"],"\u22C6":["exponentiate","toThePowerOf"],"\u235F":["naturalLog","logToTheBase"],"\u25CB":["piTimes","circularFuncs"],"!":["factorial","binomial"],"\u2339":["matrixInverse","matrixDivide"],"<":[null,"lessThan"],"\u2264":[null,"lessThanOrEqual"],"=":[null,"equals"],">":[null,"greaterThan"],"\u2265":[null,"greaterThanOrEqual"],"\u2260":[null,"notEqual"],"\u2261":["depth","match"],"\u2262":[null,"notMatch"],"\u2208":["enlist","membership"],"\u2377":[null,"find"],"\u222A":["unique","union"],"\u2229":[null,"intersection"],"\u223C":["not","without"],"\u2228":[null,"or"],"\u2227":[null,"and"],"\u2371":[null,"nor"],"\u2372":[null,"nand"],"\u2374":["shapeOf","reshape"],",":["ravel","catenate"],"\u236A":[null,"firstAxisCatenate"],"\u233D":["reverse","rotate"],"\u2296":["axis1Reverse","axis1Rotate"],"\u2349":["transpose",null],"\u2191":["first","take"],"\u2193":[null,"drop"],"\u2282":["enclose","partitionWithAxis"],"\u2283":["diclose","pick"],"\u2337":[null,"index"],"\u234B":["gradeUp",null],"\u2352":["gradeDown",null],"\u22A4":["encode",null],"\u22A5":["decode",null],"\u2355":["format","formatByExample"],"\u234E":["execute",null],"\u22A3":["stop","left"],"\u22A2":["pass","right"]},s=/[\.\/⌿⍀¨⍣]/,i=/⍬/,u=/[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/,c=/←/,p=/[⍝#].*$/;const d={name:"apl",startState:function(){return{prev:!1,func:!1,op:!1,string:!1,escape:!1}},token:function(t,n){var e,a,l;return t.eatSpace()?null:(e=t.next())==='"'||e==="'"?(t.eatWhile((a=e,l=!1,function(r){return l=r,r!==a||l==="\\"})),t.next(),n.prev=!0,"string"):/[\[{\(]/.test(e)?(n.prev=!1,null):/[\]}\)]/.test(e)?(n.prev=!0,null):i.test(e)?(n.prev=!1,"atom"):/[¯\d]/.test(e)?(n.func?(n.func=!1,n.prev=!1):n.prev=!0,t.eatWhile(/[\w\.]/),"number"):s.test(e)||c.test(e)?"operator":u.test(e)?(n.func=!0,n.prev=!1,o[e]?"variableName.function.standard":"variableName.function"):p.test(e)?(t.skipToEnd(),"comment"):e==="\u2218"&&t.peek()==="."?(t.next(),"variableName.function"):(t.eatWhile(/[\w\$_]/),n.prev=!0,"keyword")}};export{d as apl}; diff --git a/apps/assets/arc-CfyY4LWz.js b/apps/assets/arc-CfyY4LWz.js new file mode 100644 index 0000000000000000000000000000000000000000..c5dacffcbd647205f677609c2f33c151865812ad --- /dev/null +++ b/apps/assets/arc-CfyY4LWz.js @@ -0,0 +1 @@ +import{w as dt,p as lt,c as I,s as T,a as P,h as ft,e as f,t as Tt,b as D,m as rt,d as pt,f as o,g as gt,i as At,j as Rt}from"./step-BwsUM5iJ.js";function bt(i){return i.innerRadius}function jt(i){return i.outerRadius}function wt(i){return i.startAngle}function zt(i){return i.endAngle}function Pt(i){return i&&i.padAngle}function S(i,k,J,q,b,j,E){var e=i-J,V=k-q,c=(E?j:-j)/D(e*e+V*V),n=c*V,A=-c*e,u=i+n,a=k+A,y=J+n,l=q+A,H=(u+y)/2,s=(a+l)/2,t=y-u,r=l-a,m=t*t+r*r,h=b-j,p=u*l-y*a,v=(r<0?-1:1)*D(At(0,h*h*m-p*p)),w=(p*r-t*v)/m,z=(-p*t-r*v)/m,K=(p*r+t*v)/m,O=(-p*t+r*v)/m,d=w-H,g=z-s,x=K-H,Q=O-s;return d*d+g*g>x*x+Q*Q&&(w=K,z=O),{cx:w,cy:z,x01:-n,y01:-A,x11:w*(b/h-1),y11:z*(b/h-1)}}function kt(){var i=bt,k=jt,J=P(0),q=null,b=wt,j=zt,E=Pt,e=null,V=dt(c);function c(){var n,A,u=+i.apply(this,arguments),a=+k.apply(this,arguments),y=b.apply(this,arguments)-ft,l=j.apply(this,arguments)-ft,H=pt(l-y),s=l>y;if(e||(e=n=V()),af)if(H>Tt-f)e.moveTo(a*I(y),a*T(y)),e.arc(0,0,a,y,l,!s),u>f&&(e.moveTo(u*I(l),u*T(l)),e.arc(0,0,u,l,y,s));else{var t,r,m=y,h=l,p=y,v=l,w=H,z=H,K=E.apply(this,arguments)/2,O=K>f&&(q?+q.apply(this,arguments):D(u*u+a*a)),d=rt(pt(a-u)/2,+J.apply(this,arguments)),g=d,x=d;if(O>f){var Q=gt(O/u*T(K)),U=gt(O/a*T(K));(w-=2*Q)>f?(p+=Q*=s?1:-1,v-=Q):(w=0,p=v=(y+l)/2),(z-=2*U)>f?(m+=U*=s?1:-1,h-=U):(z=0,m=h=(y+l)/2)}var _=a*I(m),$=a*T(m),Y=u*I(v),Z=u*T(v);if(d>f){var R,F=a*I(h),G=a*T(h),L=u*I(p),M=u*T(p);if(Hf?x>f?(t=S(L,M,_,$,a,x,s),r=S(F,G,Y,Z,a,x,s),e.moveTo(t.cx+t.x01,t.cy+t.y01),xf&&w>f?g>f?(t=S(Y,Z,F,G,u,-g,s),r=S(_,$,L,M,u,-g,s),e.lineTo(t.cx+t.x01,t.cy+t.y01),gl?(this.rect.x-=(this.labelWidth-l)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(l+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(g+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>g?(this.rect.y-=(this.labelHeight-g)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(g+this.labelHeight))}}},i.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},i.prototype.transform=function(h){var l=this.rect.x;l>e.WORLD_BOUNDARY?l=e.WORLD_BOUNDARY:l<-e.WORLD_BOUNDARY&&(l=-e.WORLD_BOUNDARY);var g=this.rect.y;g>e.WORLD_BOUNDARY?g=e.WORLD_BOUNDARY:g<-e.WORLD_BOUNDARY&&(g=-e.WORLD_BOUNDARY);var d=new n(l,g),y=h.inverseTransformPoint(d);this.setLocation(y.x,y.y)},i.prototype.getLeft=function(){return this.rect.x},i.prototype.getRight=function(){return this.rect.x+this.rect.width},i.prototype.getTop=function(){return this.rect.y},i.prototype.getBottom=function(){return this.rect.y+this.rect.height},i.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},w.exports=i},function(w,_,T){var c=T(0);function o(){}for(var s in c)o[s]=c[s];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=3*o.MAX_NODE_DISPLACEMENT_INCREMENTAL,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,w.exports=o},function(w,_,T){function c(o,s){o==null&&s==null?(this.x=0,this.y=0):(this.x=o,this.y=s)}c.prototype.getX=function(){return this.x},c.prototype.getY=function(){return this.y},c.prototype.setX=function(o){this.x=o},c.prototype.setY=function(o){this.y=o},c.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},c.prototype.getCopy=function(){return new c(this.x,this.y)},c.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},w.exports=c},function(w,_,T){var c=T(2),o=T(10),s=T(0),e=T(7),r=T(3),n=T(1),i=T(13),t=T(12),h=T(11);function l(d,y,v){c.call(this,v),this.estimatedSize=o.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=d,y!=null&&y instanceof e?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}for(var g in l.prototype=Object.create(c.prototype),c)l[g]=c[g];l.prototype.getNodes=function(){return this.nodes},l.prototype.getEdges=function(){return this.edges},l.prototype.getGraphManager=function(){return this.graphManager},l.prototype.getParent=function(){return this.parent},l.prototype.getLeft=function(){return this.left},l.prototype.getRight=function(){return this.right},l.prototype.getTop=function(){return this.top},l.prototype.getBottom=function(){return this.bottom},l.prototype.isConnected=function(){return this.isConnected},l.prototype.add=function(d,y,v){if(y==null&&v==null){var E=d;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(E)>-1)throw"Node already in graph!";return E.owner=this,this.getNodes().push(E),E}var A=d;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(v)>-1))throw"Source or target not in graph!";if(y.owner!=v.owner||y.owner!=this)throw"Both owners must be this graph!";return y.owner!=v.owner?null:(A.source=y,A.target=v,A.isInterGraph=!1,this.getEdges().push(A),y.edges.push(A),v!=y&&v.edges.push(A),A)},l.prototype.remove=function(d){var y=d;if(d instanceof r){if(y==null)throw"Node is null!";if(y.owner==null||y.owner!=this)throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var v=y.edges.slice(),E=v.length,A=0;A-1&&Y>-1))throw"Source and/or target doesn't know this edge!";if(M.source.edges.splice(b,1),M.target!=M.source&&M.target.edges.splice(Y,1),(P=M.source.owner.getEdges().indexOf(M))==-1)throw"Not in owner's edge list!";M.source.owner.getEdges().splice(P,1)}},l.prototype.updateLeftTop=function(){for(var d,y,v,E=o.MAX_VALUE,A=o.MAX_VALUE,M=this.getNodes(),P=M.length,b=0;b(d=Y.getTop())&&(E=d),A>(y=Y.getLeft())&&(A=y)}return E==o.MAX_VALUE?null:(v=M[0].getParent().paddingLeft!=null?M[0].getParent().paddingLeft:this.margin,this.left=A-v,this.top=E-v,new t(this.left,this.top))},l.prototype.updateBounds=function(d){for(var y,v,E,A,M,P=o.MAX_VALUE,b=-o.MAX_VALUE,Y=o.MAX_VALUE,H=-o.MAX_VALUE,q=this.nodes,x=q.length,B=0;B(y=a.getLeft())&&(P=y),b<(v=a.getRight())&&(b=v),Y>(E=a.getTop())&&(Y=E),H<(A=a.getBottom())&&(H=A)}var m=new i(P,Y,b-P,H-Y);P==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),M=q[0].getParent().paddingLeft!=null?q[0].getParent().paddingLeft:this.margin,this.left=m.x-M,this.right=m.x+m.width+M,this.top=m.y-M,this.bottom=m.y+m.height+M},l.calculateBounds=function(d){for(var y,v,E,A,M=o.MAX_VALUE,P=-o.MAX_VALUE,b=o.MAX_VALUE,Y=-o.MAX_VALUE,H=d.length,q=0;q(y=x.getLeft())&&(M=y),P<(v=x.getRight())&&(P=v),b>(E=x.getTop())&&(b=E),Y<(A=x.getBottom())&&(Y=A)}return new i(M,b,P-M,Y-b)},l.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},l.prototype.calcEstimatedSize=function(){for(var d=0,y=this.nodes,v=y.length,E=0;E=this.nodes.length){var Y=0;A.forEach(function(H){H.owner==d&&Y++}),Y==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},w.exports=l},function(w,_,T){var c,o=T(1);function s(e){c=T(6),this.layout=e,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var e=this.layout.newGraph(),r=this.layout.newNode(null),n=this.add(e,r);return this.setRootGraph(n),this.rootGraph},s.prototype.add=function(e,r,n,i,t){if(n==null&&i==null&&t==null){if(e==null)throw"Graph is null!";if(r==null)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),e.parent!=null)throw"Already has a parent!";if(r.child!=null)throw"Already has a child!";return e.parent=r,r.child=e,e}t=n,n=e;var h=(i=r).getOwner(),l=t.getOwner();if(h==null||h.getGraphManager()!=this)throw"Source not in this graph mgr!";if(l==null||l.getGraphManager()!=this)throw"Target not in this graph mgr!";if(h==l)return n.isInterGraph=!1,h.add(n,i,t);if(n.isInterGraph=!0,n.source=i,n.target=t,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),n.source==null||n.target==null)throw"Edge source and/or target is null!";if(n.source.edges.indexOf(n)!=-1||n.target.edges.indexOf(n)!=-1)throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},s.prototype.remove=function(e){if(e instanceof c){var r=e;if(r.getGraphManager()!=this)throw"Graph not in this graph mgr";if(r!=this.rootGraph&&(r.parent==null||r.parent.graphManager!=this))throw"Invalid parent node!";for(var n,i=[],t=(i=i.concat(r.getEdges())).length,h=0;h=e.getRight()?r[0]+=Math.min(e.getX()-s.getX(),s.getRight()-e.getRight()):e.getX()<=s.getX()&&e.getRight()>=s.getRight()&&(r[0]+=Math.min(s.getX()-e.getX(),e.getRight()-s.getRight())),s.getY()<=e.getY()&&s.getBottom()>=e.getBottom()?r[1]+=Math.min(e.getY()-s.getY(),s.getBottom()-e.getBottom()):e.getY()<=s.getY()&&e.getBottom()>=s.getBottom()&&(r[1]+=Math.min(s.getY()-e.getY(),e.getBottom()-s.getBottom()));var t=Math.abs((e.getCenterY()-s.getCenterY())/(e.getCenterX()-s.getCenterX()));e.getCenterY()===s.getCenterY()&&e.getCenterX()===s.getCenterX()&&(t=1);var h=t*r[0],l=r[1]/t;r[0]h)return r[0]=n,r[1]=g,r[2]=t,r[3]=q,!1;if(it)return r[0]=l,r[1]=i,r[2]=Y,r[3]=h,!1;if(nt?(r[0]=y,r[1]=v,m=!0):(r[0]=d,r[1]=g,m=!0):f===I&&(n>t?(r[0]=l,r[1]=g,m=!0):(r[0]=E,r[1]=v,m=!0)),-p===I?t>n?(r[2]=H,r[3]=q,u=!0):(r[2]=Y,r[3]=b,u=!0):p===I&&(t>n?(r[2]=P,r[3]=b,u=!0):(r[2]=x,r[3]=q,u=!0)),m&&u)return!1;if(n>t?i>h?(L=this.getCardinalDirection(f,I,4),C=this.getCardinalDirection(p,I,2)):(L=this.getCardinalDirection(-f,I,3),C=this.getCardinalDirection(-p,I,1)):i>h?(L=this.getCardinalDirection(-f,I,1),C=this.getCardinalDirection(-p,I,3)):(L=this.getCardinalDirection(f,I,2),C=this.getCardinalDirection(p,I,4)),!m)switch(L){case 1:S=g,G=n+-M/I,r[0]=G,r[1]=S;break;case 2:G=E,S=i+A*I,r[0]=G,r[1]=S;break;case 3:S=v,G=n+M/I,r[0]=G,r[1]=S;break;case 4:G=y,S=i+-A*I,r[0]=G,r[1]=S}if(!u)switch(C){case 1:D=b,F=t+-a/I,r[2]=F,r[3]=D;break;case 2:F=x,D=h+B*I,r[2]=F,r[3]=D;break;case 3:D=q,F=t+a/I,r[2]=F,r[3]=D;break;case 4:F=H,D=h+-B*I,r[2]=F,r[3]=D}}return!1},o.getCardinalDirection=function(s,e,r){return s>e?r:1+r%4},o.getIntersection=function(s,e,r,n){if(n==null)return this.getIntersection2(s,e,r);var i,t,h,l,g,d,y,v=s.x,E=s.y,A=e.x,M=e.y,P=r.x,b=r.y,Y=n.x,H=n.y;return(y=(i=M-E)*(l=P-Y)-(t=H-b)*(h=v-A))===0?null:new c((h*(d=Y*b-P*H)-l*(g=A*E-v*M))/y,(t*g-i*d)/y)},o.angleOfVector=function(s,e,r,n){var i=void 0;return s!==r?(i=Math.atan((n-e)/(r-s)),r=0){var y=(-g+Math.sqrt(g*g-4*l*d))/(2*l),v=(-g-Math.sqrt(g*g-4*l*d))/(2*l);return y>=0&&y<=1?[y]:v>=0&&v<=1?[v]:null}return null},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,w.exports=o},function(w,_,T){function c(){}c.sign=function(o){return o>0?1:o<0?-1:0},c.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},c.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},w.exports=c},function(w,_,T){function c(){}c.MAX_VALUE=2147483647,c.MIN_VALUE=-2147483648,w.exports=c},function(w,_,T){var c=function(){function n(i,t){for(var h=0;h0&&d;){for(M.push(b[0]);M.length>0&&d;){var Y=M[0];M.splice(0,1),A.add(Y);var H=Y.getEdges();for(E=0;E-1&&b.splice(a,1)}A=new Set,P=new Map}else g=[]}return g},l.prototype.createDummyNodesForBendpoints=function(g){for(var d=[],y=g.source,v=this.graphManager.calcLowestCommonAncestor(g.source,g.target),E=0;E0){for(var v=this.edgeToDummyNodes.get(y),E=0;E=0&&d.splice(q,1),H.getNeighborsList().forEach(function(x){if(y.indexOf(x)<0){var B=v.get(x)-1;B==1&&b.push(x),v.set(x,B)}})}y=y.concat(b),d.length!=1&&d.length!=2||(E=!0,A=d[0])}return A},l.prototype.setGraphManager=function(g){this.graphManager=g},w.exports=l},function(w,_,T){function c(){}c.seed=1,c.x=0,c.nextDouble=function(){return c.x=1e4*Math.sin(c.seed++),c.x-Math.floor(c.x)},w.exports=c},function(w,_,T){var c=T(5);function o(s,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(s){this.lworldExtX=s},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(s){this.lworldExtY=s},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},o.prototype.transformX=function(s){var e=0,r=this.lworldExtX;return r!=0&&(e=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/r),e},o.prototype.transformY=function(s){var e=0,r=this.lworldExtY;return r!=0&&(e=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/r),e},o.prototype.inverseTransformX=function(s){var e=0,r=this.ldeviceExtX;return r!=0&&(e=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/r),e},o.prototype.inverseTransformY=function(s){var e=0,r=this.ldeviceExtY;return r!=0&&(e=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/r),e},o.prototype.inverseTransformPoint=function(s){return new c(this.inverseTransformX(s.x),this.inverseTransformY(s.y))},w.exports=o},function(w,_,T){var c=T(15),o=T(4),s=T(0),e=T(8),r=T(9);function n(){c.call(this),this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=o.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=o.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=o.MAX_ITERATIONS}for(var i in n.prototype=Object.create(c.prototype),c)n[i]=c[i];n.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},n.prototype.calcIdealEdgeLengths=function(){for(var t,h,l,g,d,y,v,E=this.getGraphManager().getAllEdges(),A=0;Ao.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*o.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-o.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>o.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(o.COOLING_ADAPTATION_FACTOR,1-(t-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*(1-o.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var t,h=this.getAllEdges(),l=0;l0&&arguments[0]!==void 0)||arguments[0],v=arguments.length>1&&arguments[1]!==void 0&&arguments[1],E=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&y&&this.updateGrid(),d=new Set,t=0;t(A=h.getEstimatedSize()*this.gravityRangeFactor)||E>A)&&(t.gravitationForceX=-this.gravityConstant*d,t.gravitationForceY=-this.gravityConstant*y):(v>(A=h.getEstimatedSize()*this.compoundGravityRangeFactor)||E>A)&&(t.gravitationForceX=-this.gravityConstant*d*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant)},n.prototype.isConverged=function(){var t,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=v.length||A>=v[0].length)){for(var M=0;Mr}}]),e}();w.exports=s},function(w,_,T){function c(){}c.svd=function(o){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=o.length,this.n=o[0].length;var s=Math.min(this.m,this.n);this.s=function(wt){for(var ut=[];wt-- >0;)ut.push(0);return ut}(Math.min(this.m+1,this.n)),this.U=function wt(ut){if(ut.length==0)return 0;for(var Ft=[],Mt=0;Mt0;)ut.push(0);return ut}(this.n),r=function(wt){for(var ut=[];wt-- >0;)ut.push(0);return ut}(this.m),n=Math.min(this.m-1,this.n),i=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;f--)if(this.s[f]!==0){for(var p=f+1;p=0;D--){if(function(wt,ut){return wt&&ut}(D0;){var V=void 0,Et=void 0;for(V=a-2;V>=-1&&V!==-1;V--)if(Math.abs(e[V])<=ot+tt*(Math.abs(this.s[V])+Math.abs(this.s[V+1]))){e[V]=0;break}if(V===a-2)Et=4;else{var Lt=void 0;for(Lt=a-1;Lt>=V&&Lt!==V;Lt--){var kt=(Lt!==a?Math.abs(e[Lt]):0)+(Lt!==V+1?Math.abs(e[Lt-1]):0);if(Math.abs(this.s[Lt])<=ot+tt*kt){this.s[Lt]=0;break}}Lt===V?Et=3:Lt===a-1?Et=1:(Et=2,V=Lt)}switch(V++,Et){case 1:var bt=e[a-2];e[a-2]=0;for(var K=a-2;K>=V;K--){var it=c.hypot(this.s[K],bt),pt=this.s[K]/it,ct=bt/it;this.s[K]=it,K!==V&&(bt=-ct*e[K-1],e[K-1]=pt*e[K-1]);for(var yt=0;yt=this.s[V+1]);){var Pt=this.s[V];if(this.s[V]=this.s[V+1],this.s[V+1]=Pt,VMath.abs(s)?(e=s/o,e=Math.abs(o)*Math.sqrt(1+e*e)):s!=0?(e=o/s,e=Math.abs(s)*Math.sqrt(1+e*e)):e=0,e},w.exports=c},function(w,_,T){var c=function(){function s(e,r){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;(function(y,v){if(!(y instanceof v))throw new TypeError("Cannot call a class as a function")})(this,s),this.sequence1=e,this.sequence2=r,this.match_score=n,this.mismatch_penalty=i,this.gap_penalty=t,this.iMax=e.length+1,this.jMax=r.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;r--){var n=this.listeners[r];n.event===s&&n.callback===e&&this.listeners.splice(r,1)}},o.emit=function(s,e){for(var r=0;r{var r={};r.layoutBase=e(551),r.CoSEConstants=e(806),r.CoSEEdge=e(767),r.CoSEGraph=e(880),r.CoSEGraphManager=e(578),r.CoSELayout=e(765),r.CoSENode=e(991),r.ConstraintHandler=e(902),o.exports=r},806:(o,s,e)=>{var r=e(551).FDLayoutConstants;function n(){}for(var i in r)n[i]=r[i];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,o.exports=n},767:(o,s,e)=>{var r=e(551).FDLayoutEdge;function n(t,h,l){r.call(this,t,h,l)}for(var i in n.prototype=Object.create(r.prototype),r)n[i]=r[i];o.exports=n},880:(o,s,e)=>{var r=e(551).LGraph;function n(t,h,l){r.call(this,t,h,l)}for(var i in n.prototype=Object.create(r.prototype),r)n[i]=r[i];o.exports=n},578:(o,s,e)=>{var r=e(551).LGraphManager;function n(t){r.call(this,t)}for(var i in n.prototype=Object.create(r.prototype),r)n[i]=r[i];o.exports=n},765:(o,s,e)=>{var r=e(551).FDLayout,n=e(578),i=e(880),t=e(991),h=e(767),l=e(806),g=e(902),d=e(551).FDLayoutConstants,y=e(551).LayoutConstants,v=e(551).Point,E=e(551).PointD,A=e(551).DimensionD,M=e(551).Layout,P=e(551).Integer,b=e(551).IGeometry,Y=e(551).LGraph,H=e(551).Transform,q=e(551).LinkedList;function x(){r.call(this),this.toBeTiled={},this.constraints={}}for(var B in x.prototype=Object.create(r.prototype),r)x[B]=r[B];x.prototype.newGraphManager=function(){var a=new n(this);return this.graphManager=a,a},x.prototype.newGraph=function(a){return new i(null,this.graphManager,a)},x.prototype.newNode=function(a){return new t(this.graphManager,a)},x.prototype.newEdge=function(a){return new h(null,null,a)},x.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},x.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},x.prototype.layout=function(){return y.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},x.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)l.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),m=new Set(this.getAllNodes()),u=this.nodesWithGravity.filter(function(f){return m.has(f)}),this.graphManager.setAllNodesToApplyGravitation(u));else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),u=this.nodesWithGravity.filter(function(f){return m.has(f)});this.graphManager.setAllNodesToApplyGravitation(u),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(g.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),l.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},x.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(p){return a.has(p)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),l.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),l.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var u=!this.isTreeGrowing&&!this.isGrowthFinished,f=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(u,f),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},x.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),m={},u=0;u0&&this.updateDisplacements(),m=0;m0&&(f.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var L=new Map,C=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var G=this.constraints.alignmentConstraint.vertical;for(u=0;u=2*O.length/3;tt--)X=Math.floor(Math.random()*(tt+1)),j=O[tt],O[tt]=O[X],O[X]=j;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var X=L.has(O.left)?L.get(O.left):O.left,j=L.has(O.right)?L.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(X)||(a.nodesInRelativeHorizontal.push(X),a.nodeToRelativeConstraintMapHorizontal.set(X,[]),a.dummyToNodeForVerticalAlignment.has(X)?a.nodeToTempPositionMapHorizontal.set(X,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(X,a.idToNodeMap.get(X).getCenterX())),a.nodesInRelativeHorizontal.includes(j)||(a.nodesInRelativeHorizontal.push(j),a.nodeToRelativeConstraintMapHorizontal.set(j,[]),a.dummyToNodeForVerticalAlignment.has(j)?a.nodeToTempPositionMapHorizontal.set(j,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(j)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(j,a.idToNodeMap.get(j).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(X).push({right:j,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(j).push({left:X,gap:O.gap})}else{var tt=C.has(O.top)?C.get(O.top):O.top,ot=C.has(O.bottom)?C.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ot)||(a.nodesInRelativeVertical.push(ot),a.nodeToRelativeConstraintMapVertical.set(ot,[]),a.dummyToNodeForHorizontalAlignment.has(ot)?a.nodeToTempPositionMapVertical.set(ot,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ot)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ot,a.idToNodeMap.get(ot).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ot,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ot).push({top:tt,gap:O.gap})}});else{var F=new Map,D=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var X=L.has(O.left)?L.get(O.left):O.left,j=L.has(O.right)?L.get(O.right):O.right;F.has(X)?F.get(X).push(j):F.set(X,[j]),F.has(j)?F.get(j).push(X):F.set(j,[X])}else{var tt=C.has(O.top)?C.get(O.top):O.top,ot=C.has(O.bottom)?C.get(O.bottom):O.bottom;D.has(tt)?D.get(tt).push(ot):D.set(tt,[ot]),D.has(ot)?D.get(ot).push(tt):D.set(ot,[tt])}});var z=function(O,X){var j=[],tt=[],ot=new q,V=new Set,Et=0;return O.forEach(function(Lt,kt){if(!V.has(kt)){j[Et]=[],tt[Et]=!1;var bt=kt;for(ot.push(bt),V.add(bt),j[Et].push(bt);ot.length!=0;)bt=ot.shift(),X.has(bt)&&(tt[Et]=!0),O.get(bt).forEach(function(K){V.has(K)||(ot.push(K),V.add(K),j[Et].push(K))});Et++}}),{components:j,isFixed:tt}},W=z(F,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=W.components,this.fixedComponentsOnHorizontal=W.isFixed;var U=z(D,a.fixedNodesOnVertical);this.componentsOnVertical=U.components,this.fixedComponentsOnVertical=U.isFixed}}},x.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(U){var O=a.idToNodeMap.get(U.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,u=0;u1)for(C=0;Cf&&(f=Math.floor(L.y)),I=Math.floor(L.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new E(y.WORLD_CENTER_X-L.x/2,y.WORLD_CENTER_Y-L.y/2))},x.radialLayout=function(a,m,u){var f=Math.max(this.maxDiagonalInTree(a),l.DEFAULT_RADIAL_SEPARATION);x.branchRadialLayout(m,null,0,359,0,f);var p=Y.calculateBounds(a),I=new H;I.setDeviceOrgX(p.getMinX()),I.setDeviceOrgY(p.getMinY()),I.setWorldOrgX(u.x),I.setWorldOrgY(u.y);for(var L=0;L1;){var X=O[0];O.splice(0,1);var j=F.indexOf(X);j>=0&&F.splice(j,1),U--,D--}z=m!=null?(F.indexOf(O[0])+1)%U:0;for(var tt=Math.abs(f-u)/D,ot=z;W!=D;ot=++ot%U){var V=F[ot].getOtherEnd(a);if(V!=m){var Et=(u+W*tt)%360,Lt=(Et+tt)%360;x.branchRadialLayout(V,a,Et,Lt,p+I,I),W++}}},x.maxDiagonalInTree=function(a){for(var m=P.MIN_VALUE,u=0;um&&(m=f)}return m},x.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},x.prototype.groupZeroDegreeMembers=function(){var a=this,m={};this.memberGroups={},this.idToDummyNode={};for(var u=[],f=this.graphManager.getAllNodes(),p=0;p1){var S="DummyCompound_"+G;a.memberGroups[S]=m[G];var F=m[G][0].getParent(),D=new t(a.graphManager);D.id=S,D.paddingLeft=F.paddingLeft||0,D.paddingRight=F.paddingRight||0,D.paddingBottom=F.paddingBottom||0,D.paddingTop=F.paddingTop||0,a.idToDummyNode[S]=D;var z=a.getGraphManager().add(a.newGraph(),D),W=F.getChild();W.add(D);for(var U=0;Up?(f.rect.x-=(f.labelWidth-p)/2,f.setWidth(f.labelWidth),f.labelMarginLeft=(f.labelWidth-p)/2):f.labelPosHorizontal=="right"&&f.setWidth(p+f.labelWidth)),f.labelHeight&&(f.labelPosVertical=="top"?(f.rect.y-=f.labelHeight,f.setHeight(I+f.labelHeight),f.labelMarginTop=f.labelHeight):f.labelPosVertical=="center"&&f.labelHeight>I?(f.rect.y-=(f.labelHeight-I)/2,f.setHeight(f.labelHeight),f.labelMarginTop=(f.labelHeight-I)/2):f.labelPosVertical=="bottom"&&f.setHeight(I+f.labelHeight))}})},x.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var m=this.compoundOrder[a],u=m.id,f=m.paddingLeft,p=m.paddingTop,I=m.labelMarginLeft,L=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[u],m.rect.x,m.rect.y,f,p,I,L)}},x.prototype.repopulateZeroDegreeMembers=function(){var a=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(u){var f=a.idToDummyNode[u],p=f.paddingLeft,I=f.paddingTop,L=f.labelMarginLeft,C=f.labelMarginTop;a.adjustLocations(m[u],f.rect.x,f.rect.y,p,I,L,C)})},x.prototype.getToBeTiled=function(a){var m=a.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var u=a.getChild();if(u==null)return this.toBeTiled[m]=!1,!1;for(var f=u.getNodes(),p=0;p0)return this.toBeTiled[m]=!1,!1;if(I.getChild()!=null){if(!this.getToBeTiled(I))return this.toBeTiled[m]=!1,!1}else this.toBeTiled[I.id]=!1}return this.toBeTiled[m]=!0,!0},x.prototype.getNodeDegree=function(a){a.id;for(var m=a.getEdges(),u=0,f=0;fF&&(F=z.rect.height)}u+=F+a.verticalPadding}},x.prototype.tileCompoundMembers=function(a,m){var u=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(f){var p=m[f];if(u.tiledMemberPack[f]=u.tileNodes(a[f],p.paddingLeft+p.paddingRight),p.rect.width=u.tiledMemberPack[f].width,p.rect.height=u.tiledMemberPack[f].height,p.setCenter(u.tiledMemberPack[f].centerX,u.tiledMemberPack[f].centerY),p.labelMarginLeft=0,p.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var I=p.rect.width,L=p.rect.height;p.labelWidth&&(p.labelPosHorizontal=="left"?(p.rect.x-=p.labelWidth,p.setWidth(I+p.labelWidth),p.labelMarginLeft=p.labelWidth):p.labelPosHorizontal=="center"&&p.labelWidth>I?(p.rect.x-=(p.labelWidth-I)/2,p.setWidth(p.labelWidth),p.labelMarginLeft=(p.labelWidth-I)/2):p.labelPosHorizontal=="right"&&p.setWidth(I+p.labelWidth)),p.labelHeight&&(p.labelPosVertical=="top"?(p.rect.y-=p.labelHeight,p.setHeight(L+p.labelHeight),p.labelMarginTop=p.labelHeight):p.labelPosVertical=="center"&&p.labelHeight>L?(p.rect.y-=(p.labelHeight-L)/2,p.setHeight(p.labelHeight),p.labelMarginTop=(p.labelHeight-L)/2):p.labelPosVertical=="bottom"&&p.setHeight(L+p.labelHeight))}})},x.prototype.tileNodes=function(a,m){var u=this.tileNodesByFavoringDim(a,m,!0),f=this.tileNodesByFavoringDim(a,m,!1),p=this.getOrgRatio(u);return this.getOrgRatio(f)C&&(C=U.getWidth())});var G,S=I/p,F=L/p,D=Math.pow(u-f,2)+4*(S+f)*(F+u)*p,z=(f-u+Math.sqrt(D))/(2*(S+f));m?(G=Math.ceil(z))==z&&G++:G=Math.floor(z);var W=G*(S+f)-f;return C>W&&(W=C),W+=2*f},x.prototype.tileNodesByFavoringDim=function(a,m,u){var f=l.TILING_PADDING_VERTICAL,p=l.TILING_PADDING_HORIZONTAL,I=l.TILING_COMPARE_BY,L={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:f,horizontalPadding:p,centerX:0,centerY:0};I&&(L.idealRowWidth=this.calcIdealRowWidth(a,u));var C=function(U){return U.rect.width*U.rect.height},G=function(U,O){return C(O)-C(U)};a.sort(function(U,O){var X=G;return L.idealRowWidth?(X=I)(U.id,O.id):X(U,O)});for(var S=0,F=0,D=0;D0&&(I+=a.horizontalPadding),a.rowWidth[u]=I,a.width0&&(L+=a.verticalPadding);var C=0;L>a.rowHeight[u]&&(C=a.rowHeight[u],a.rowHeight[u]=L,C=a.rowHeight[u]-C),a.height+=C,a.rows[u].push(m)},x.prototype.getShortestRowIndex=function(a){for(var m=-1,u=Number.MAX_VALUE,f=0;fu&&(m=f,u=a.rowWidth[f]);return m},x.prototype.canAddHorizontal=function(a,m,u){if(a.idealRowWidth){var f=a.rows.length-1;return a.rowWidth[f]+m+a.horizontalPadding<=a.idealRowWidth}var p=this.getShortestRowIndex(a);if(p<0)return!0;var I=a.rowWidth[p];if(I+a.horizontalPadding+m<=a.width)return!0;var L,C,G=0;return a.rowHeight[p]0&&(G=u+a.verticalPadding-a.rowHeight[p]),L=a.width-I>=m+a.horizontalPadding?(a.height+G)/(I+m+a.horizontalPadding):(a.height+G)/a.width,G=u+a.verticalPadding,(C=a.widthI&&m!=u){f.splice(-1,1),a.rows[u].push(p),a.rowWidth[m]=a.rowWidth[m]-I,a.rowWidth[u]=a.rowWidth[u]+I,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var L=Number.MIN_VALUE,C=0;CL&&(L=f[C].height);m>0&&(L+=a.verticalPadding);var G=a.rowHeight[m]+a.rowHeight[u];a.rowHeight[m]=L,a.rowHeight[u]0)for(var S=p;S<=I;S++)G[0]+=this.grid[S][L-1].length+this.grid[S][L].length-1;if(I0)for(S=L;S<=C;S++)G[3]+=this.grid[p-1][S].length+this.grid[p][S].length-1;for(var F,D,z=P.MAX_VALUE,W=0;W{var r=e(551).FDLayoutNode,n=e(551).IMath;function i(h,l,g,d){r.call(this,h,l,g,d)}for(var t in i.prototype=Object.create(r.prototype),r)i[t]=r[t];i.prototype.calculateDisplacement=function(){var h=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=h.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=h.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=h.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=h.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>h.coolingFactor*h.maxNodeDisplacement&&(this.displacementX=h.coolingFactor*h.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>h.coolingFactor*h.maxNodeDisplacement&&(this.displacementY=h.coolingFactor*h.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},i.prototype.propogateDisplacementToChildren=function(h,l){for(var g,d=this.getChild().getNodes(),y=0;y{function r(g){if(Array.isArray(g)){for(var d=0,y=Array(g.length);d0){var gt=0;$.forEach(function(st){k=="horizontal"?(nt.set(st,v.has(st)?E[v.get(st)]:Z.get(st)),gt+=nt.get(st)):(nt.set(st,v.has(st)?A[v.get(st)]:Z.get(st)),gt+=nt.get(st))}),gt/=$.length,lt.forEach(function(st){J.has(st)||nt.set(st,gt)})}else{var Tt=0;lt.forEach(function(st){Tt+=k=="horizontal"?v.has(st)?E[v.get(st)]:Z.get(st):v.has(st)?A[v.get(st)]:Z.get(st)}),Tt/=lt.length,lt.forEach(function(st){nt.set(st,Tt)})}});for(var Ut=function(){var lt=ft.shift();R.get(lt).forEach(function($){if(nt.get($.id)st&&(st=Ht),VtPt&&(Pt=Vt)}}catch(jt){Rt=!0,wt=jt}finally{try{!Gt&&Ft.return&&Ft.return()}finally{if(Rt)throw wt}}var ie=(gt+st)/2-(Tt+Pt)/2,Kt=!0,qt=!1,$t=void 0;try{for(var Zt,Bt=lt[Symbol.iterator]();!(Kt=(Zt=Bt.next()).done);Kt=!0){var ee=Zt.value;nt.set(ee,nt.get(ee)+ie)}}catch(jt){qt=!0,$t=jt}finally{try{!Kt&&Bt.return&&Bt.return()}finally{if(qt)throw $t}}})}return nt},x=function(R){var k=0,J=0,Z=0,at=0;if(R.forEach(function(ft){ft.left?E[v.get(ft.left)]-E[v.get(ft.right)]>=0?k++:J++:A[v.get(ft.top)]-A[v.get(ft.bottom)]>=0?Z++:at++}),k>J&&Z>at)for(var _t=0;_tJ)for(var nt=0;ntat)for(var vt=0;vt1)d.fixedNodeConstraint.forEach(function(R,k){u[k]=[R.position.x,R.position.y],f[k]=[E[v.get(R.nodeId)],A[v.get(R.nodeId)]]}),p=!0;else if(d.alignmentConstraint)(function(){var R=0;if(d.alignmentConstraint.vertical){for(var k=d.alignmentConstraint.vertical,J=function(vt){var ft=new Set;k[vt].forEach(function(mt){ft.add(mt)});var Ut=new Set([].concat(r(ft)).filter(function(mt){return L.has(mt)})),rt=void 0;rt=Ut.size>0?E[v.get(Ut.values().next().value)]:H(ft).x,k[vt].forEach(function(mt){u[R]=[rt,A[v.get(mt)]],f[R]=[E[v.get(mt)],A[v.get(mt)]],R++})},Z=0;Z0?E[v.get(Ut.values().next().value)]:H(ft).y,at[vt].forEach(function(mt){u[R]=[E[v.get(mt)],rt],f[R]=[E[v.get(mt)],A[v.get(mt)]],R++})},nt=0;ntF&&(F=S[z].length,D=z);if(F0){var ct={x:0,y:0};d.fixedNodeConstraint.forEach(function(R,k){var J,Z,at={x:E[v.get(R.nodeId)],y:A[v.get(R.nodeId)]},_t=R.position,nt=(Z=at,{x:(J=_t).x-Z.x,y:J.y-Z.y});ct.x+=nt.x,ct.y+=nt.y}),ct.x/=d.fixedNodeConstraint.length,ct.y/=d.fixedNodeConstraint.length,E.forEach(function(R,k){E[k]+=ct.x}),A.forEach(function(R,k){A[k]+=ct.y}),d.fixedNodeConstraint.forEach(function(R){E[v.get(R.nodeId)]=R.position.x,A[v.get(R.nodeId)]=R.position.y})}if(d.alignmentConstraint){if(d.alignmentConstraint.vertical)for(var yt=d.alignmentConstraint.vertical,Nt=function(R){var k=new Set;yt[R].forEach(function(at){k.add(at)});var J=new Set([].concat(r(k)).filter(function(at){return L.has(at)})),Z=void 0;Z=J.size>0?E[v.get(J.values().next().value)]:H(k).x,k.forEach(function(at){L.has(at)||(E[v.get(at)]=Z)})},ht=0;ht0?A[v.get(J.values().next().value)]:H(k).y,k.forEach(function(at){L.has(at)||(A[v.get(at)]=Z)})},Dt=0;Dt{o.exports=w}},T={},c=function o(s){var e=T[s];if(e!==void 0)return e.exports;var r=T[s]={exports:{}};return _[s](r,r.exports,o),r.exports}(45),c;var _,T,c},Le.exports=N(hr()));var N}var xe,Ce,Oe,ce;const dr=ar(xe?Ie.exports:(xe=1,Ie.exports=(Ce=lr(),Oe={658:N=>{N.exports=Object.assign!=null?Object.assign.bind(Object):function(w){for(var _=arguments.length,T=Array(_>1?_-1:0),c=1;c<_;c++)T[c-1]=arguments[c];return T.forEach(function(o){Object.keys(o).forEach(function(s){return w[s]=o[s]})}),w}},548:(N,w,_)=>{var T=function(s,e){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return function(r,n){var i=[],t=!0,h=!1,l=void 0;try{for(var g,d=r[Symbol.iterator]();!(t=(g=d.next()).done)&&(i.push(g.value),!n||i.length!==n);t=!0);}catch(y){h=!0,l=y}finally{try{!t&&d.return&&d.return()}finally{if(h)throw l}}return i}(s,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=_(140).layoutBase.LinkedList,o={getTopMostNodes:function(s){for(var e={},r=0;r0&&x.merge(m)});for(var B=0;B1){g=h[0],d=g.connectedEdges().length,h.forEach(function(x){x.connectedEdges().length0&&n.set("dummy"+(n.size+1),E),A},relocateComponent:function(s,e,r){if(!r.fixedNodeConstraint){var n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY;if(r.quality=="draft"){var l=!0,g=!1,d=void 0;try{for(var y,v=e.nodeIndexes[Symbol.iterator]();!(l=(y=v.next()).done);l=!0){var E=y.value,A=T(E,2),M=A[0],P=A[1],b=r.cy.getElementById(M);if(b){var Y=b.boundingBox(),H=e.xCoords[P]-Y.w/2,q=e.xCoords[P]+Y.w/2,x=e.yCoords[P]-Y.h/2,B=e.yCoords[P]+Y.h/2;Hi&&(i=q),xh&&(h=B)}}}catch(p){g=!0,d=p}finally{try{!l&&v.return&&v.return()}finally{if(g)throw d}}var a=s.x-(i+n)/2,m=s.y-(h+t)/2;e.xCoords=e.xCoords.map(function(p){return p+a}),e.yCoords=e.yCoords.map(function(p){return p+m})}else{Object.keys(e).forEach(function(p){var I=e[p],L=I.getRect().x,C=I.getRect().x+I.getRect().width,G=I.getRect().y,S=I.getRect().y+I.getRect().height;Li&&(i=C),Gh&&(h=S)});var u=s.x-(i+n)/2,f=s.y-(h+t)/2;Object.keys(e).forEach(function(p){var I=e[p];I.setCenter(I.getCenterX()+u,I.getCenterY()+f)})}}},calcBoundingBox:function(s,e,r,n){for(var i=Number.MAX_SAFE_INTEGER,t=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER,g=void 0,d=void 0,y=void 0,v=void 0,E=s.descendants().not(":parent"),A=E.length,M=0;M(g=e[n.get(P.id())]-P.width()/2)&&(i=g),t<(d=e[n.get(P.id())]+P.width()/2)&&(t=d),h>(y=r[n.get(P.id())]-P.height()/2)&&(h=y),l<(v=r[n.get(P.id())]+P.height()/2)&&(l=v)}var b={};return b.topLeftX=i,b.topLeftY=h,b.width=t-i,b.height=l-h,b},calcParentsWithoutChildren:function(s,e){var r=s.collection();return e.nodes(":parent").forEach(function(n){var i=!1;n.children().forEach(function(t){t.css("display")!="none"&&(i=!0)}),i||r.merge(n)}),r}};N.exports=o},816:(N,w,_)=>{var T=_(548),c=_(140).CoSELayout,o=_(140).CoSENode,s=_(140).layoutBase.PointD,e=_(140).layoutBase.DimensionD,r=_(140).layoutBase.LayoutConstants,n=_(140).layoutBase.FDLayoutConstants,i=_(140).CoSEConstants;N.exports={coseLayout:function(t,h){var l=t.cy,g=t.eles,d=g.nodes(),y=g.edges(),v=void 0,E=void 0,A=void 0,M={};t.randomize&&(v=h.nodeIndexes,E=h.xCoords,A=h.yCoords);var P=function(x){return typeof x=="function"},b=function(x,B){return P(x)?x(B):x},Y=T.calcParentsWithoutChildren(l,g);t.nestingFactor!=null&&(i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor),t.gravity!=null&&(i.DEFAULT_GRAVITY_STRENGTH=n.DEFAULT_GRAVITY_STRENGTH=t.gravity),t.numIter!=null&&(i.MAX_ITERATIONS=n.MAX_ITERATIONS=t.numIter),t.gravityRange!=null&&(i.DEFAULT_GRAVITY_RANGE_FACTOR=n.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange),t.gravityCompound!=null&&(i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound),t.gravityRangeCompound!=null&&(i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound),t.initialEnergyOnIncremental!=null&&(i.DEFAULT_COOLING_FACTOR_INCREMENTAL=n.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental),t.tilingCompareBy!=null&&(i.TILING_COMPARE_BY=t.tilingCompareBy),t.quality=="proof"?r.QUALITY=2:r.QUALITY=0,i.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!t.randomize,i.ANIMATE=n.ANIMATE=r.ANIMATE=t.animate,i.TILE=t.tile,i.TILING_PADDING_VERTICAL=typeof t.tilingPaddingVertical=="function"?t.tilingPaddingVertical.call():t.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof t.tilingPaddingHorizontal=="function"?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal,i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!0,i.PURE_INCREMENTAL=!t.randomize,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=t.uniformNodeDimensions,t.step=="transformed"&&(i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!1),t.step=="enforced"&&(i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!1),t.step=="cose"&&(i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!0),t.step=="all"&&(t.randomize?i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0),t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint?i.TREE_REDUCTION_ON_INCREMENTAL=!1:i.TREE_REDUCTION_ON_INCREMENTAL=!0;var H=new c,q=H.newGraphManager();return function x(B,a,m,u){for(var f=a.length,p=0;p0&&x(m.getGraphManager().add(m.newGraph(),C),L,m,u)}}(q.addRoot(),T.getTopMostNodes(d),H,t),function(x,B,a){for(var m=0,u=0,f=0;f0?i.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=m/u:P(t.idealEdgeLength)?i.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=50:i.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=t.idealEdgeLength,i.MIN_REPULSION_DIST=n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,i.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH)}(H,q,y),function(x,B){B.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=B.fixedNodeConstraint),B.alignmentConstraint&&(x.constraints.alignmentConstraint=B.alignmentConstraint),B.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=B.relativePlacementConstraint)}(H,t),H.runLayout(),M}}},212:(N,w,_)=>{var T=function(){function i(t,h){for(var l=0;l0)if(A){var M=o.getTopMostNodes(t.eles.nodes());if((y=o.connectComponents(h,t.eles,M)).forEach(function(F){var D=F.boundingBox();v.push({x:D.x1+D.w/2,y:D.y1+D.h/2})}),t.randomize&&y.forEach(function(F){t.eles=F,g.push(s(t))}),t.quality=="default"||t.quality=="proof"){var P=h.collection();if(t.tile){var b=new Map,Y=0,H={nodeIndexes:b,xCoords:[],yCoords:[]},q=[];if(y.forEach(function(F,D){F.edges().length==0&&(F.nodes().forEach(function(z,W){P.merge(F.nodes()[W]),z.isParent()||(H.nodeIndexes.set(F.nodes()[W].id(),Y++),H.xCoords.push(F.nodes()[0].position().x),H.yCoords.push(F.nodes()[0].position().y))}),q.push(D))}),P.length>1){var x=P.boundingBox();v.push({x:x.x1+x.w/2,y:x.y1+x.h/2}),y.push(P),g.push(H);for(var B=q.length-1;B>=0;B--)y.splice(q[B],1),g.splice(q[B],1),v.splice(q[B],1)}}y.forEach(function(F,D){t.eles=F,d.push(e(t,g[D])),o.relocateComponent(v[D],d[D],t)})}else y.forEach(function(F,D){o.relocateComponent(v[D],g[D],t)});var a=new Set;if(y.length>1){var m=[],u=l.filter(function(F){return F.css("display")=="none"});y.forEach(function(F,D){var z=void 0;if(t.quality=="draft"&&(z=g[D].nodeIndexes),F.nodes().not(u).length>0){var W={edges:[],nodes:[]},U=void 0;F.nodes().not(u).forEach(function(O){if(t.quality=="draft")if(O.isParent()){var X=o.calcBoundingBox(O,g[D].xCoords,g[D].yCoords,z);W.nodes.push({x:X.topLeftX,y:X.topLeftY,width:X.width,height:X.height})}else U=z.get(O.id()),W.nodes.push({x:g[D].xCoords[U]-O.boundingbox().w/2,y:g[D].yCoords[U]-O.boundingbox().h/2,width:O.boundingbox().w,height:O.boundingbox().h});else d[D][O.id()]&&W.nodes.push({x:d[D][O.id()].getLeft(),y:d[D][O.id()].getTop(),width:d[D][O.id()].getWidth(),height:d[D][O.id()].getHeight()})}),F.edges().forEach(function(O){var X=O.source(),j=O.target();if(X.css("display")!="none"&&j.css("display")!="none")if(t.quality=="draft"){var tt=z.get(X.id()),ot=z.get(j.id()),V=[],Et=[];if(X.isParent()){var Lt=o.calcBoundingBox(X,g[D].xCoords,g[D].yCoords,z);V.push(Lt.topLeftX+Lt.width/2),V.push(Lt.topLeftY+Lt.height/2)}else V.push(g[D].xCoords[tt]),V.push(g[D].yCoords[tt]);if(j.isParent()){var kt=o.calcBoundingBox(j,g[D].xCoords,g[D].yCoords,z);Et.push(kt.topLeftX+kt.width/2),Et.push(kt.topLeftY+kt.height/2)}else Et.push(g[D].xCoords[ot]),Et.push(g[D].yCoords[ot]);W.edges.push({startX:V[0],startY:V[1],endX:Et[0],endY:Et[1]})}else d[D][X.id()]&&d[D][j.id()]&&W.edges.push({startX:d[D][X.id()].getCenterX(),startY:d[D][X.id()].getCenterY(),endX:d[D][j.id()].getCenterX(),endY:d[D][j.id()].getCenterY()})}),W.nodes.length>0&&(m.push(W),a.add(D))}});var f=E.packComponents(m,t.randomize).shifts;if(t.quality=="draft")g.forEach(function(F,D){var z=F.xCoords.map(function(U){return U+f[D].dx}),W=F.yCoords.map(function(U){return U+f[D].dy});F.xCoords=z,F.yCoords=W});else{var p=0;a.forEach(function(F){Object.keys(d[F]).forEach(function(D){var z=d[F][D];z.setCenter(z.getCenterX()+f[p].dx,z.getCenterY()+f[p].dy)}),p++})}}}else{var I=t.eles.boundingBox();if(v.push({x:I.x1+I.w/2,y:I.y1+I.h/2}),t.randomize){var L=s(t);g.push(L)}t.quality=="default"||t.quality=="proof"?(d.push(e(t,g[0])),o.relocateComponent(v[0],d[0],t)):o.relocateComponent(v[0],g[0],t)}var C=function(F,D){if(t.quality=="default"||t.quality=="proof"){typeof F=="number"&&(F=D);var z=void 0,W=void 0,U=F.data("id");return d.forEach(function(X){U in X&&(z={x:X[U].getRect().getCenterX(),y:X[U].getRect().getCenterY()},W=X[U])}),t.nodeDimensionsIncludeLabels&&(W.labelWidth&&(W.labelPosHorizontal=="left"?z.x+=W.labelWidth/2:W.labelPosHorizontal=="right"&&(z.x-=W.labelWidth/2)),W.labelHeight&&(W.labelPosVertical=="top"?z.y+=W.labelHeight/2:W.labelPosVertical=="bottom"&&(z.y-=W.labelHeight/2))),z==null&&(z={x:F.position("x"),y:F.position("y")}),{x:z.x,y:z.y}}var O=void 0;return g.forEach(function(X){var j=X.nodeIndexes.get(F.id());j!=null&&(O={x:X.xCoords[j],y:X.yCoords[j]})}),O==null&&(O={x:F.position("x"),y:F.position("y")}),{x:O.x,y:O.y}};if(t.quality=="default"||t.quality=="proof"||t.randomize){var G=o.calcParentsWithoutChildren(h,l),S=l.filter(function(F){return F.css("display")=="none"});t.eles=l.not(S),l.nodes().not(":parent").not(S).layoutPositions(this,t,C),G.length>0&&G.forEach(function(F){F.position(C(F))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),i}();N.exports=n},657:(N,w,_)=>{var T=_(548),c=_(140).layoutBase.Matrix,o=_(140).layoutBase.SVD;N.exports={spectralLayout:function(s){var e=s.cy,r=s.eles,n=r.nodes(),i=r.nodes(":parent"),t=new Map,h=new Map,l=new Map,g=[],d=[],y=[],v=[],E=[],A=[],M=[],P=[],b=void 0,Y=1e8,H=1e-9,q=s.piTol,x=s.samplingType,B=s.nodeSeparation,a=void 0,m=function(K,it,pt){for(var ct=[],yt=0,Nt=0,ht=0,At=void 0,Ot=[],Dt=0,xt=1,Ct=0;Ct=yt;){ht=ct[yt++];for(var R=g[ht],k=0;kDt&&(Dt=E[Z],xt=Z)}return xt};T.connectComponents(e,r,T.getTopMostNodes(n),t),i.forEach(function(K){T.connectComponents(e,r,T.getTopMostNodes(K.descendants().intersection(r)),t)});for(var u=0,f=0;f0&&(pt.isParent()?g[it].push(l.get(pt.id())):g[it].push(pt.id()))})});var D=function(K){var it=h.get(K),pt=void 0;t.get(K).forEach(function(ct){pt=e.getElementById(ct).isParent()?l.get(ct):ct,g[it].push(pt),g[h.get(pt)].push(K)})},z=!0,W=!1,U=void 0;try{for(var O,X=t.keys()[Symbol.iterator]();!(z=(O=X.next()).done);z=!0)D(O.value)}catch(K){W=!0,U=K}finally{try{!z&&X.return&&X.return()}finally{if(W)throw U}}var j=void 0;if((b=h.size)>2){a=b=1)break;Ot=At}for(var Ct=0;Ct=1)break;Ot=At}for(var k=0;k{var T=_(212),c=function(o){o&&o("layout","fcose",T)};typeof cytoscape<"u"&&c(cytoscape),N.exports=c},140:N=>{N.exports=Ce}},ce={},function N(w){var _=ce[w];if(_!==void 0)return _.exports;var T=ce[w]={exports:{}};return Oe[w](T,T.exports,N),T.exports}(579))));var De={L:"left",R:"right",T:"top",B:"bottom"},Re={L:Q(N=>`${N},${N/2} 0,${N} 0,0`,"L"),R:Q(N=>`0,${N/2} ${N},0 ${N},${N}`,"R"),T:Q(N=>`0,0 ${N},0 ${N/2},${N}`,"T"),B:Q(N=>`${N/2},0 ${N},${N} 0,${N}`,"B")},ne={L:Q((N,w)=>N-w+2,"L"),R:Q((N,w)=>N-2,"R"),T:Q((N,w)=>N-w+2,"T"),B:Q((N,w)=>N-2,"B")},cr=Q(function(N){return Yt(N)?N==="L"?"R":"L":N==="T"?"B":"T"},"getOppositeArchitectureDirection"),be=Q(function(N){return N==="L"||N==="R"||N==="T"||N==="B"},"isArchitectureDirection"),Yt=Q(function(N){return N==="L"||N==="R"},"isArchitectureDirectionX"),Wt=Q(function(N){return N==="T"||N==="B"},"isArchitectureDirectionY"),ge=Q(function(N,w){const _=Yt(N)&&Wt(w),T=Wt(N)&&Yt(w);return _||T},"isArchitectureDirectionXY"),gr=Q(function(N){const w=N[0],_=N[1],T=Yt(w)&&Wt(_),c=Wt(w)&&Yt(_);return T||c},"isArchitecturePairXY"),ur=Q(function(N){return N!=="LL"&&N!=="RR"&&N!=="TT"&&N!=="BB"},"isValidArchitectureDirectionPair"),ue=Q(function(N,w){const _=`${N}${w}`;return ur(_)?_:void 0},"getArchitectureDirectionPair"),pr=Q(function([N,w],_){const T=_[0],c=_[1];return Yt(T)?Wt(c)?[N+(T==="L"?-1:1),w+(c==="T"?1:-1)]:[N+(T==="L"?-1:1),w]:Yt(c)?[N+(c==="L"?1:-1),w+(T==="T"?1:-1)]:[N,w+(T==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),fr=Q(function(N){return N==="LT"||N==="TL"?[1,1]:N==="BL"||N==="LB"?[1,-1]:N==="BR"||N==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),mr=Q(function(N,w){return ge(N,w)?"bend":Yt(N)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),vr=Q(function(N){return N.type==="service"},"isArchitectureService"),yr=Q(function(N){return N.type==="junction"},"isArchitectureJunction"),Ge=Q(N=>N.data(),"edgeData"),Qt=Q(N=>N.data(),"nodeData"),Se=tr.architecture,dt=new or(()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:Se,dataStructures:void 0,elements:{}})),Er=Q(()=>{dt.reset(),Ke()},"clear"),Nr=Q(function({id:N,icon:w,in:_,title:T,iconText:c}){if(dt.records.registeredIds[N]!==void 0)throw new Error(`The service id [${N}] is already in use by another ${dt.records.registeredIds[N]}`);if(_!==void 0){if(N===_)throw new Error(`The service [${N}] cannot be placed within itself`);if(dt.records.registeredIds[_]===void 0)throw new Error(`The service [${N}]'s parent does not exist. Please make sure the parent is created before this service`);if(dt.records.registeredIds[_]==="node")throw new Error(`The service [${N}]'s parent is not a group`)}dt.records.registeredIds[N]="node",dt.records.nodes[N]={id:N,type:"service",icon:w,iconText:c,title:T,edges:[],in:_}},"addService"),Tr=Q(()=>Object.values(dt.records.nodes).filter(vr),"getServices"),Ar=Q(function({id:N,in:w}){dt.records.registeredIds[N]="node",dt.records.nodes[N]={id:N,type:"junction",edges:[],in:w}},"addJunction"),wr=Q(()=>Object.values(dt.records.nodes).filter(yr),"getJunctions"),Ir=Q(()=>Object.values(dt.records.nodes),"getNodes"),pe=Q(N=>dt.records.nodes[N],"getNode"),Lr=Q(function({id:N,icon:w,in:_,title:T}){if(dt.records.registeredIds[N]!==void 0)throw new Error(`The group id [${N}] is already in use by another ${dt.records.registeredIds[N]}`);if(_!==void 0){if(N===_)throw new Error(`The group [${N}] cannot be placed within itself`);if(dt.records.registeredIds[_]===void 0)throw new Error(`The group [${N}]'s parent does not exist. Please make sure the parent is created before this group`);if(dt.records.registeredIds[_]==="node")throw new Error(`The group [${N}]'s parent is not a group`)}dt.records.registeredIds[N]="group",dt.records.groups[N]={id:N,icon:w,title:T,in:_}},"addGroup"),_r=Q(()=>Object.values(dt.records.groups),"getGroups"),Mr=Q(function({lhsId:N,rhsId:w,lhsDir:_,rhsDir:T,lhsInto:c,rhsInto:o,lhsGroup:s,rhsGroup:e,title:r}){if(!be(_))throw new Error(`Invalid direction given for left hand side of edge ${N}--${w}. Expected (L,R,T,B) got ${_}`);if(!be(T))throw new Error(`Invalid direction given for right hand side of edge ${N}--${w}. Expected (L,R,T,B) got ${T}`);if(dt.records.nodes[N]===void 0&&dt.records.groups[N]===void 0)throw new Error(`The left-hand id [${N}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(dt.records.nodes[w]===void 0&&dt.records.groups[N]===void 0)throw new Error(`The right-hand id [${w}] does not yet exist. Please create the service/group before declaring an edge to it.`);const n=dt.records.nodes[N].in,i=dt.records.nodes[w].in;if(s&&n&&i&&n==i)throw new Error(`The left-hand id [${N}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(e&&n&&i&&n==i)throw new Error(`The right-hand id [${w}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const t={lhsId:N,lhsDir:_,lhsInto:c,lhsGroup:s,rhsId:w,rhsDir:T,rhsInto:o,rhsGroup:e,title:r};dt.records.edges.push(t),dt.records.nodes[N]&&dt.records.nodes[w]&&(dt.records.nodes[N].edges.push(dt.records.edges[dt.records.edges.length-1]),dt.records.nodes[w].edges.push(dt.records.edges[dt.records.edges.length-1]))},"addEdge"),xr=Q(()=>dt.records.edges,"getEdges"),Cr=Q(()=>{if(dt.records.dataStructures===void 0){const N={},w=Object.entries(dt.records.nodes).reduce((e,[r,n])=>(e[r]=n.edges.reduce((i,t)=>{var g,d;const h=(g=pe(t.lhsId))==null?void 0:g.in,l=(d=pe(t.rhsId))==null?void 0:d.in;if(h&&l&&h!==l){const y=mr(t.lhsDir,t.rhsDir);y!=="bend"&&(N[h]??(N[h]={}),N[h][l]=y,N[l]??(N[l]={}),N[l][h]=y)}if(t.lhsId===r){const y=ue(t.lhsDir,t.rhsDir);y&&(i[y]=t.rhsId)}else{const y=ue(t.rhsDir,t.lhsDir);y&&(i[y]=t.lhsId)}return i},{}),e),{}),_=Object.keys(w)[0],T={[_]:1},c=Object.keys(w).reduce((e,r)=>r===_?e:{...e,[r]:1},{}),o=Q(e=>{const r={[e]:[0,0]},n=[e];for(;n.length>0;){const i=n.shift();if(i){T[i]=1,delete c[i];const t=w[i],[h,l]=r[i];Object.entries(t).forEach(([g,d])=>{T[d]||(r[d]=pr([h,l],g),n.push(d))})}}return r},"BFS"),s=[o(_)];for(;Object.keys(c).length>0;)s.push(o(Object.keys(c)[0]));dt.records.dataStructures={adjList:w,spatialMaps:s,groupAlignments:N}}return dt.records.dataStructures},"getDataStructures"),oe={clear:Er,setDiagramTitle:Ze,getDiagramTitle:$e,setAccTitle:qe,getAccTitle:je,setAccDescription:Be,getAccDescription:We,addService:Nr,getServices:Tr,addJunction:Ar,getJunctions:wr,getNodes:Ir,getNode:pe,addGroup:Lr,getGroups:_r,addEdge:Mr,getEdges:xr,setElementForId:Q((N,w)=>{dt.records.elements[N]=w},"setElementForId"),getElementById:Q(N=>dt.records.elements[N],"getElementById"),getDataStructures:Cr};function St(N){const w=re().architecture;return w!=null&&w[N]?w[N]:Se[N]}Q(St,"getConfigField");var Or=Q((N,w)=>{nr(N,w),N.groups.map(w.addGroup),N.services.map(_=>w.addService({..._,type:"service"})),N.junctions.map(_=>w.addJunction({..._,type:"junction"})),N.edges.map(w.addEdge)},"populateDb"),Dr={parse:Q(async N=>{const w=await ir("architecture",N);Te.debug(w),Or(w,oe)},"parse")},Rr=Q(N=>` + .edge { + stroke-width: ${N.archEdgeWidth}; + stroke: ${N.archEdgeColor}; + fill: none; + } + + .arrow { + fill: ${N.archEdgeArrowColor}; + } + + .node-bkg { + fill: none; + stroke: ${N.archGroupBorderColor}; + stroke-width: ${N.archGroupBorderWidth}; + stroke-dasharray: 8; + } + .node-icon-text { + display: flex; + align-items: center; + } + + .node-icon-text > div { + color: #fff; + margin: 1px; + height: fit-content; + text-align: center; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + } +`,"getStyles"),Jt=Q(N=>`${N}`,"wrapIcon"),te={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:Jt('')},server:{body:Jt('')},disk:{body:Jt('')},internet:{body:Jt('')},cloud:{body:Jt('')},unknown:rr,blank:{body:Jt("")}}},br=Q(async function(N,w){const _=St("padding"),T=St("iconSize"),c=T/2,o=T/6,s=o/2;await Promise.all(w.edges().map(async e=>{var H,q;const{source:r,sourceDir:n,sourceArrow:i,sourceGroup:t,target:h,targetDir:l,targetArrow:g,targetGroup:d,label:y}=Ge(e);let{x:v,y:E}=e[0].sourceEndpoint();const{x:A,y:M}=e[0].midpoint();let{x:P,y:b}=e[0].targetEndpoint();const Y=_+4;if(t&&(Yt(n)?v+=n==="L"?-Y:Y:E+=n==="T"?-Y:Y+18),d&&(Yt(l)?P+=l==="L"?-Y:Y:b+=l==="T"?-Y:Y+18),t||((H=oe.getNode(r))==null?void 0:H.type)!=="junction"||(Yt(n)?v+=n==="L"?c:-c:E+=n==="T"?c:-c),d||((q=oe.getNode(h))==null?void 0:q.type)!=="junction"||(Yt(l)?P+=l==="L"?c:-c:b+=l==="T"?c:-c),e[0]._private.rscratch){const x=N.insert("g");if(x.insert("path").attr("d",`M ${v},${E} L ${A},${M} L${P},${b} `).attr("class","edge"),i){const B=Yt(n)?ne[n](v,o):v-s,a=Wt(n)?ne[n](E,o):E-s;x.insert("polygon").attr("points",Re[n](o)).attr("transform",`translate(${B},${a})`).attr("class","arrow")}if(g){const B=Yt(l)?ne[l](P,o):P-s,a=Wt(l)?ne[l](b,o):b-s;x.insert("polygon").attr("points",Re[l](o)).attr("transform",`translate(${B},${a})`).attr("class","arrow")}if(y){const B=ge(n,l)?"XY":Yt(n)?"X":"Y";let a=0;a=B==="X"?Math.abs(v-P):B==="Y"?Math.abs(E-b)/1.5:Math.abs(v-P)/2;const m=x.append("g");if(await le(m,y,{useHtmlLabels:!1,width:a,classes:"architecture-service-label"},re()),m.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),B==="X")m.attr("transform","translate("+A+", "+M+")");else if(B==="Y")m.attr("transform","translate("+A+", "+M+") rotate(-90)");else if(B==="XY"){const u=ue(n,l);if(u&&gr(u)){const f=m.node().getBoundingClientRect(),[p,I]=fr(u);m.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*p*I*45})`);const L=m.node().getBoundingClientRect();m.attr("transform",` + translate(${A}, ${M-f.height/2}) + translate(${p*L.width/2}, ${I*L.height/2}) + rotate(${-1*p*I*45}, 0, ${f.height/2}) + `)}}}}}))},"drawEdges"),Gr=Q(async function(N,w){const _=.75*St("padding"),T=St("fontSize"),c=St("iconSize")/2;await Promise.all(w.nodes().map(async o=>{const s=Qt(o);if(s.type==="group"){const{h:e,w:r,x1:n,y1:i}=o.boundingBox();N.append("rect").attr("x",n+c).attr("y",i+c).attr("width",r).attr("height",e).attr("class","node-bkg");const t=N.append("g");let h=n,l=i;if(s.icon){const g=t.append("g");g.html(`${await de(s.icon,{height:_,width:_,fallbackPrefix:te.prefix})}`),g.attr("transform","translate("+(h+c+1)+", "+(l+c+1)+")"),h+=_,l+=T/2-1-2}if(s.label){const g=t.append("g");await le(g,s.label,{useHtmlLabels:!1,width:r,classes:"architecture-service-label"},re()),g.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),g.attr("transform","translate("+(h+c+4)+", "+(l+c+2)+")")}}}))},"drawGroups"),Sr=Q(async function(N,w,_){for(const T of _){const c=w.append("g"),o=St("iconSize");if(T.title){const n=c.append("g");await le(n,T.title,{useHtmlLabels:!1,width:1.5*o,classes:"architecture-service-label"},re()),n.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),n.attr("transform","translate("+o/2+", "+o+")")}const s=c.append("g");if(T.icon)s.html(`${await de(T.icon,{height:o,width:o,fallbackPrefix:te.prefix})}`);else if(T.iconText){s.html(`${await de("blank",{height:o,width:o,fallbackPrefix:te.prefix})}`);const n=s.append("g").append("foreignObject").attr("width",o).attr("height",o).append("div").attr("class","node-icon-text").attr("style",`height: ${o}px;`).append("div").html(T.iconText),i=parseInt(window.getComputedStyle(n.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;n.attr("style",`-webkit-line-clamp: ${Math.floor((o-2)/i)};`)}else s.append("path").attr("class","node-bkg").attr("id","node-"+T.id).attr("d",`M0 ${o} v${-o} q0,-5 5,-5 h${o} q5,0 5,5 v${o} H0 Z`);c.attr("class","architecture-service");const{width:e,height:r}=c._groups[0][0].getBBox();T.width=e,T.height=r,N.setElementForId(T.id,c)}return 0},"drawServices"),Pr=Q(function(N,w,_){_.forEach(T=>{const c=w.append("g"),o=St("iconSize");c.append("g").append("rect").attr("id","node-"+T.id).attr("fill-opacity","0").attr("width",o).attr("height",o),c.attr("class","architecture-junction");const{width:s,height:e}=c._groups[0][0].getBBox();c.width=s,c.height=e,N.setElementForId(T.id,c)})},"drawJunctions");function Pe(N,w){N.forEach(_=>{w.add({group:"nodes",data:{type:"service",id:_.id,icon:_.icon,label:_.title,parent:_.in,width:St("iconSize"),height:St("iconSize")},classes:"node-service"})})}function Fe(N,w){N.forEach(_=>{w.add({group:"nodes",data:{type:"junction",id:_.id,parent:_.in,width:St("iconSize"),height:St("iconSize")},classes:"node-junction"})})}function Ue(N,w){w.nodes().map(_=>{const T=Qt(_);T.type!=="group"&&(T.x=_.position().x,T.y=_.position().y,N.getElementById(T.id).attr("transform","translate("+(T.x||0)+","+(T.y||0)+")"))})}function Ye(N,w){N.forEach(_=>{w.add({group:"nodes",data:{type:"group",id:_.id,icon:_.icon,label:_.title,parent:_.in},classes:"node-group"})})}function ke(N,w){N.forEach(_=>{const{lhsId:T,rhsId:c,lhsInto:o,lhsGroup:s,rhsInto:e,lhsDir:r,rhsDir:n,rhsGroup:i,title:t}=_,h=ge(_.lhsDir,_.rhsDir)?"segments":"straight",l={id:`${T}-${c}`,label:t,source:T,sourceDir:r,sourceArrow:o,sourceGroup:s,sourceEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%",target:c,targetDir:n,targetArrow:e,targetGroup:i,targetEndpoint:n==="L"?"0 50%":n==="R"?"100% 50%":n==="T"?"50% 0":"50% 100%"};w.add({group:"edges",data:l,classes:h})})}function He(N,w,_){const T=Q((e,r)=>Object.entries(e).reduce((n,[i,t])=>{var g;let h=0;const l=Object.entries(t);if(l.length===1)return n[i]=l[0][1],n;for(let d=0;d{const r={},n={};return Object.entries(e).forEach(([i,[t,h]])=>{var g,d,y;const l=((g=N.getNode(i))==null?void 0:g.in)??"default";r[h]??(r[h]={}),(d=r[h])[l]??(d[l]=[]),r[h][l].push(i),n[t]??(n[t]={}),(y=n[t])[l]??(y[l]=[]),n[t][l].push(i)}),{horiz:Object.values(T(r,"horizontal")).filter(i=>i.length>1),vert:Object.values(T(n,"vertical")).filter(i=>i.length>1)}}),[o,s]=c.reduce(([e,r],{horiz:n,vert:i})=>[[...e,...n],[...r,...i]],[[],[]]);return{horizontal:o,vertical:s}}function Xe(N){const w=[],_=Q(c=>`${c[0]},${c[1]}`,"posToStr"),T=Q(c=>c.split(",").map(o=>parseInt(o)),"strToPos");return N.forEach(c=>{const o=Object.fromEntries(Object.entries(c).map(([n,i])=>[_(i),n])),s=[_([0,0])],e={},r={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;s.length>0;){const n=s.shift();if(n){e[n]=1;const i=o[n];if(i){const t=T(n);Object.entries(r).forEach(([h,l])=>{const g=_([t[0]+l[0],t[1]+l[1]]),d=o[g];d&&!e[g]&&(s.push(g),w.push({[De[h]]:d,[De[cr(h)]]:i,gap:1.5*St("iconSize")}))})}}}}),w}function ze(N,w,_,T,c,{spatialMaps:o,groupAlignments:s}){return new Promise(e=>{const r=sr("body").append("div").attr("id","cy").attr("style","display:none"),n=Ae({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${St("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${St("padding")}px`}}]});r.remove(),Ye(_,n),Pe(N,n),Fe(w,n),ke(T,n);const i=He(c,o,s),t=Xe(o),h=n.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(l){const[g,d]=l.connectedNodes(),{parent:y}=Qt(g),{parent:v}=Qt(d);return y===v?1.5*St("iconSize"):.5*St("iconSize")},edgeElasticity(l){const[g,d]=l.connectedNodes(),{parent:y}=Qt(g),{parent:v}=Qt(d);return y===v?.45:.001},alignmentConstraint:i,relativePlacementConstraint:t});h.one("layoutstop",()=>{var g;function l(d,y,v,E){let A,M;const{x:P,y:b}=d,{x:Y,y:H}=y;M=(E-b+(P-v)*(b-H)/(P-Y))/Math.sqrt(1+Math.pow((b-H)/(P-Y),2)),A=Math.sqrt(Math.pow(E-b,2)+Math.pow(v-P,2)-Math.pow(M,2)),A/=Math.sqrt(Math.pow(Y-P,2)+Math.pow(H-b,2));let q=(Y-P)*(E-b)-(H-b)*(v-P);switch(!0){case q>=0:q=1;break;case q<0:q=-1}let x=(Y-P)*(v-P)+(H-b)*(E-b);switch(!0){case x>=0:x=1;break;case x<0:x=-1}return M=Math.abs(M)*q,A*=x,{distances:M,weights:A}}Q(l,"getSegmentWeights"),n.startBatch();for(const d of Object.values(n.edges()))if((g=d.data)!=null&&g.call(d)){const{x:y,y:v}=d.source().position(),{x:E,y:A}=d.target().position();if(y!==E&&v!==A){const M=d.sourceEndpoint(),P=d.targetEndpoint(),{sourceDir:b}=Ge(d),[Y,H]=Wt(b)?[M.x,P.y]:[P.x,M.y],{weights:q,distances:x}=l(M,P,Y,H);d.style("segment-distances",x),d.style("segment-weights",q)}}n.endBatch(),h.run()}),h.run(),n.ready(l=>{Te.info("Ready",l),e(n)})})}er([{name:te.prefix,icons:te}]),Ae.use(dr),Q(Pe,"addServices"),Q(Fe,"addJunctions"),Q(Ue,"positionNodes"),Q(Ye,"addGroups"),Q(ke,"addEdges"),Q(He,"getAlignments"),Q(Xe,"getRelativeConstraints"),Q(ze,"layoutArchitecture");var Fr={parser:Dr,db:oe,renderer:{draw:Q(async(N,w,_,T)=>{const c=T.db,o=c.getServices(),s=c.getJunctions(),e=c.getGroups(),r=c.getEdges(),n=c.getDataStructures(),i=Qe(w),t=i.append("g");t.attr("class","architecture-edges");const h=i.append("g");h.attr("class","architecture-services");const l=i.append("g");l.attr("class","architecture-groups"),await Sr(c,h,o),Pr(c,h,s);const g=await ze(o,s,e,r,c,n);await br(t,g),await Gr(l,g),Ue(c,g),Je(void 0,i,St("padding"),St("useMaxWidth"))},"draw")},styles:Rr};export{Fr as diagram}; diff --git a/apps/assets/asciiarmor-D5V0T9Cu.js b/apps/assets/asciiarmor-D5V0T9Cu.js new file mode 100644 index 0000000000000000000000000000000000000000..a0eff9d49bc1783c601635750e22f29619ace457 --- /dev/null +++ b/apps/assets/asciiarmor-D5V0T9Cu.js @@ -0,0 +1 @@ +function s(t){var e=t.match(/^\s*\S/);return t.skipToEnd(),e?"error":null}const n={name:"asciiarmor",token:function(t,e){var r;if(e.state=="top")return t.sol()&&(r=t.match(/^-----BEGIN (.*)?-----\s*$/))?(e.state="headers",e.type=r[1],"tag"):s(t);if(e.state=="headers"){if(t.sol()&&t.match(/^\w+:/))return e.state="header","atom";var a=s(t);return a&&(e.state="body"),a}return e.state=="header"?(t.skipToEnd(),e.state="headers","string"):e.state=="body"?t.sol()&&(r=t.match(/^-----END (.*)?-----\s*$/))?r[1]!=e.type?"error":(e.state="end","tag"):t.eatWhile(/[A-Za-z0-9+\/=]/)?null:(t.next(),"error"):e.state=="end"?s(t):void 0},blankLine:function(t){t.state=="headers"&&(t.state="body")},startState:function(){return{state:"top",type:null}}};export{n as asciiArmor}; diff --git a/apps/assets/asn1-DWPaVWf6.js b/apps/assets/asn1-DWPaVWf6.js new file mode 100644 index 0000000000000000000000000000000000000000..78eb252e208a56f312e38312d038c0595fdcde42 --- /dev/null +++ b/apps/assets/asn1-DWPaVWf6.js @@ -0,0 +1 @@ +function E(i){for(var u={},l=i.split(" "),I=0;I?$/.test(r)?(t.extenExten=!0,t.extenStart=!1,"strong"):(t.extenStart=!1,a.skipToEnd(),"error")):t.extenExten?(t.extenExten=!1,t.extenPriority=!0,a.eatWhile(/[^,]/),t.extenInclude&&(a.skipToEnd(),t.extenPriority=!1,t.extenInclude=!1),t.extenSame&&(t.extenPriority=!1,t.extenSame=!1,t.extenApplication=!0),"tag"):t.extenPriority?(t.extenPriority=!1,t.extenApplication=!0,a.next(),t.extenSame?null:(a.eatWhile(/[^,]/),"number")):t.extenApplication?(a.eatWhile(/,/),(r=a.current())===","?null:(a.eatWhile(/\w/),r=a.current().toLowerCase(),t.extenApplication=!1,m.indexOf(r)!==-1?"def":null)):function(e,n){var o="",i=e.next();if(n.blockComment)return i=="-"&&e.match("-;",!0)?n.blockComment=!1:e.skipTo("--;")?(e.next(),e.next(),e.next(),n.blockComment=!1):e.skipToEnd(),"comment";if(i==";")return e.match("--",!0)&&!e.match("-",!1)?(n.blockComment=!0,"comment"):(e.skipToEnd(),"comment");if(i=="[")return e.skipTo("]"),e.eat("]"),"header";if(i=='"')return e.skipTo('"'),"string";if(i=="'")return e.skipTo("'"),"string.special";if(i=="#"&&(e.eatWhile(/\w/),o=e.current(),c.indexOf(o)!==-1))return e.skipToEnd(),"strong";if(i=="$"&&e.peek()=="{")return e.skipTo("}"),e.eat("}"),"variableName.special";if(e.eatWhile(/\w/),o=e.current(),s.indexOf(o)!==-1){switch(n.extenStart=!0,o){case"same":n.extenSame=!0;break;case"include":case"switch":case"ignorepat":n.extenInclude=!0}return"atom"}}(a,t)},languageData:{commentTokens:{line:";",block:{open:";--",close:"--;"}}}};export{l as asterisk}; diff --git a/apps/assets/blockDiagram-JOT3LUYC-D5EKpDOX.js b/apps/assets/blockDiagram-JOT3LUYC-D5EKpDOX.js new file mode 100644 index 0000000000000000000000000000000000000000..81ea03480f70a049e3fb3124a261debc4259ebff --- /dev/null +++ b/apps/assets/blockDiagram-JOT3LUYC-D5EKpDOX.js @@ -0,0 +1,121 @@ +var ae,se;import{_ as h,F as V,d as ie,l as w,y as oe,A as le,c as z,a1 as ce,a2 as q,a3 as Dt,a4 as de,u as Q,j as he,a5 as ge,a6 as gt,a7 as ye,h as $t}from"./mermaid-DwRBzUur.js";import{c as pe}from"./clone-Bj7S21pd.js";import{s as R}from"./transform-DetRMEbJ.js";import{G as ue}from"./graph-B7t7oBoL.js";import{c as xe}from"./channel-CWOR9f3f.js";import{l as be,k as fe}from"./step-BwsUM5iJ.js";import"./index-DgI7bmFZ.js";import"./_baseUniq-CR5yKjUQ.js";import"./_baseEach-DH7Slkql.js";import"./timer-Bqd5yn_a.js";var yt=function(){var e=h(function(d,u,k,b){for(k=k||{},b=d.length;b--;k[d[b]]=u);return k},"o"),t=[1,7],a=[1,13],n=[1,14],r=[1,15],s=[1,19],i=[1,16],o=[1,17],c=[1,18],p=[8,30],y=[8,21,28,29,30,31,32,40,44,47],x=[1,23],f=[1,24],_=[8,15,16,21,28,29,30,31,32,40,44,47],L=[8,15,16,21,27,28,29,30,31,32,40,44,47],E=[1,49],D={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,block:31,NODE_ID:32,nodeShapeNLabel:33,dirList:34,DIR:35,NODE_DSTART:36,NODE_DEND:37,BLOCK_ARROW_START:38,BLOCK_ARROW_END:39,classDef:40,CLASSDEF_ID:41,CLASSDEF_STYLEOPTS:42,DEFAULT:43,class:44,CLASSENTITY_IDS:45,STYLECLASS:46,style:47,STYLE_ENTITY_IDS:48,STYLE_DEFINITION_DATA:49,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"block",32:"NODE_ID",35:"DIR",36:"NODE_DSTART",37:"NODE_DEND",38:"BLOCK_ARROW_START",39:"BLOCK_ARROW_END",40:"classDef",41:"CLASSDEF_ID",42:"CLASSDEF_STYLEOPTS",43:"DEFAULT",44:"class",45:"CLASSENTITY_IDS",46:"STYLECLASS",47:"style",48:"STYLE_ENTITY_IDS",49:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[34,1],[34,2],[33,3],[33,4],[23,3],[23,3],[24,3],[25,3]],performAction:h(function(d,u,k,b,m,l,S){var g=l.length-1;switch(m){case 4:b.getLogger().debug("Rule: separator (NL) ");break;case 5:b.getLogger().debug("Rule: separator (Space) ");break;case 6:b.getLogger().debug("Rule: separator (EOF) ");break;case 7:b.getLogger().debug("Rule: hierarchy: ",l[g-1]),b.setHierarchy(l[g-1]);break;case 8:b.getLogger().debug("Stop NL ");break;case 9:b.getLogger().debug("Stop EOF ");break;case 10:b.getLogger().debug("Stop NL2 ");break;case 11:b.getLogger().debug("Stop EOF2 ");break;case 12:b.getLogger().debug("Rule: statement: ",l[g]),typeof l[g].length=="number"?this.$=l[g]:this.$=[l[g]];break;case 13:b.getLogger().debug("Rule: statement #2: ",l[g-1]),this.$=[l[g-1]].concat(l[g]);break;case 14:b.getLogger().debug("Rule: link: ",l[g],d),this.$={edgeTypeStr:l[g],label:""};break;case 15:b.getLogger().debug("Rule: LABEL link: ",l[g-3],l[g-1],l[g]),this.$={edgeTypeStr:l[g],label:l[g-1]};break;case 18:const $=parseInt(l[g]),H=b.generateId();this.$={id:H,type:"space",label:"",width:$,children:[]};break;case 23:b.getLogger().debug("Rule: (nodeStatement link node) ",l[g-2],l[g-1],l[g]," typestr: ",l[g-1].edgeTypeStr);const U=b.edgeStrToEdgeData(l[g-1].edgeTypeStr);this.$=[{id:l[g-2].id,label:l[g-2].label,type:l[g-2].type,directions:l[g-2].directions},{id:l[g-2].id+"-"+l[g].id,start:l[g-2].id,end:l[g].id,label:l[g-1].label,type:"edge",directions:l[g].directions,arrowTypeEnd:U,arrowTypeStart:"arrow_open"},{id:l[g].id,label:l[g].label,type:b.typeStr2Type(l[g].typeStr),directions:l[g].directions}];break;case 24:b.getLogger().debug("Rule: nodeStatement (abc88 node size) ",l[g-1],l[g]),this.$={id:l[g-1].id,label:l[g-1].label,type:b.typeStr2Type(l[g-1].typeStr),directions:l[g-1].directions,widthInColumns:parseInt(l[g],10)};break;case 25:b.getLogger().debug("Rule: nodeStatement (node) ",l[g]),this.$={id:l[g].id,label:l[g].label,type:b.typeStr2Type(l[g].typeStr),directions:l[g].directions,widthInColumns:1};break;case 26:b.getLogger().debug("APA123",this?this:"na"),b.getLogger().debug("COLUMNS: ",l[g]),this.$={type:"column-setting",columns:l[g]==="auto"?-1:parseInt(l[g])};break;case 27:b.getLogger().debug("Rule: id-block statement : ",l[g-2],l[g-1]),b.generateId(),this.$={...l[g-2],type:"composite",children:l[g-1]};break;case 28:b.getLogger().debug("Rule: blockStatement : ",l[g-2],l[g-1],l[g]);const T=b.generateId();this.$={id:T,type:"composite",label:"",children:l[g-1]};break;case 29:b.getLogger().debug("Rule: node (NODE_ID separator): ",l[g]),this.$={id:l[g]};break;case 30:b.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",l[g-1],l[g]),this.$={id:l[g-1],label:l[g].label,typeStr:l[g].typeStr,directions:l[g].directions};break;case 31:b.getLogger().debug("Rule: dirList: ",l[g]),this.$=[l[g]];break;case 32:b.getLogger().debug("Rule: dirList: ",l[g-1],l[g]),this.$=[l[g-1]].concat(l[g]);break;case 33:b.getLogger().debug("Rule: nodeShapeNLabel: ",l[g-2],l[g-1],l[g]),this.$={typeStr:l[g-2]+l[g],label:l[g-1]};break;case 34:b.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",l[g-3],l[g-2]," #3:",l[g-1],l[g]),this.$={typeStr:l[g-3]+l[g],label:l[g-2],directions:l[g-1]};break;case 35:case 36:this.$={type:"classDef",id:l[g-1].trim(),css:l[g].trim()};break;case 37:this.$={type:"applyClass",id:l[g-1].trim(),styleClass:l[g].trim()};break;case 38:this.$={type:"applyStyles",id:l[g-1].trim(),stylesStr:l[g].trim()}}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{11:3,13:4,19:5,20:6,21:t,22:8,23:9,24:10,25:11,26:12,28:a,29:n,31:r,32:s,40:i,44:o,47:c},{8:[1,20]},e(p,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,21:t,28:a,29:n,31:r,32:s,40:i,44:o,47:c}),e(y,[2,16],{14:22,15:x,16:f}),e(y,[2,17]),e(y,[2,18]),e(y,[2,19]),e(y,[2,20]),e(y,[2,21]),e(y,[2,22]),e(_,[2,25],{27:[1,25]}),e(y,[2,26]),{19:26,26:12,32:s},{11:27,13:4,19:5,20:6,21:t,22:8,23:9,24:10,25:11,26:12,28:a,29:n,31:r,32:s,40:i,44:o,47:c},{41:[1,28],43:[1,29]},{45:[1,30]},{48:[1,31]},e(L,[2,29],{33:32,36:[1,33],38:[1,34]}),{1:[2,7]},e(p,[2,13]),{26:35,32:s},{32:[2,14]},{17:[1,36]},e(_,[2,24]),{11:37,13:4,14:22,15:x,16:f,19:5,20:6,21:t,22:8,23:9,24:10,25:11,26:12,28:a,29:n,31:r,32:s,40:i,44:o,47:c},{30:[1,38]},{42:[1,39]},{42:[1,40]},{46:[1,41]},{49:[1,42]},e(L,[2,30]),{18:[1,43]},{18:[1,44]},e(_,[2,23]),{18:[1,45]},{30:[1,46]},e(y,[2,28]),e(y,[2,35]),e(y,[2,36]),e(y,[2,37]),e(y,[2,38]),{37:[1,47]},{34:48,35:E},{15:[1,50]},e(y,[2,27]),e(L,[2,33]),{39:[1,51]},{34:52,35:E,39:[2,31]},{32:[2,15]},e(L,[2,34]),{39:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:h(function(d,u){if(!u.recoverable){var k=new Error(d);throw k.hash=u,k}this.trace(d)},"parseError"),parse:h(function(d){var u=this,k=[0],b=[],m=[null],l=[],S=this.table,g="",$=0,H=0,U=l.slice.call(arguments,1),T=Object.create(this.lexer),M={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(M.yy[dt]=this.yy[dt]);T.setInput(d,M.yy),M.yy.lexer=T,M.yy.parser=this,T.yylloc===void 0&&(T.yylloc={});var ht=T.yylloc;l.push(ht);var ne=T.options&&T.options.ranges;function St(){var X;return typeof(X=b.pop()||T.lex()||1)!="number"&&(X instanceof Array&&(X=(b=X).pop()),X=u.symbols_[X]||X),X}typeof M.yy.parseError=="function"?this.parseError=M.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,h(function(X){k.length=k.length-2*X,m.length=m.length-X,l.length=l.length-X},"popStack"),h(St,"lex");for(var P,G,W,_t,rt,Z,Et,at,J={};;){if(G=k[k.length-1],this.defaultActions[G]?W=this.defaultActions[G]:(P==null&&(P=St()),W=S[G]&&S[G][P]),W===void 0||!W.length||!W[0]){var vt="";for(rt in at=[],S[G])this.terminals_[rt]&&rt>2&&at.push("'"+this.terminals_[rt]+"'");vt=T.showPosition?"Parse error on line "+($+1)+`: +`+T.showPosition()+` +Expecting `+at.join(", ")+", got '"+(this.terminals_[P]||P)+"'":"Parse error on line "+($+1)+": Unexpected "+(P==1?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(vt,{text:T.match,token:this.terminals_[P]||P,line:T.yylineno,loc:ht,expected:at})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+P);switch(W[0]){case 1:k.push(P),m.push(T.yytext),l.push(T.yylloc),k.push(W[1]),P=null,H=T.yyleng,g=T.yytext,$=T.yylineno,ht=T.yylloc;break;case 2:if(Z=this.productions_[W[1]][1],J.$=m[m.length-Z],J._$={first_line:l[l.length-(Z||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(Z||1)].first_column,last_column:l[l.length-1].last_column},ne&&(J._$.range=[l[l.length-(Z||1)].range[0],l[l.length-1].range[1]]),(_t=this.performAction.apply(J,[g,H,$,M.yy,W[1],m,l].concat(U)))!==void 0)return _t;Z&&(k=k.slice(0,-1*Z*2),m=m.slice(0,-1*Z),l=l.slice(0,-1*Z)),k.push(this.productions_[W[1]][0]),m.push(J.$),l.push(J._$),Et=S[k[k.length-2]][k[k.length-1]],k.push(Et);break;case 3:return!0}}return!0},"parse")},N=function(){return{EOF:1,parseError:h(function(d,u){if(!this.yy.parser)throw new Error(d);this.yy.parser.parseError(d,u)},"parseError"),setInput:h(function(d,u){return this.yy=u||this.yy||{},this._input=d,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var d=this._input[0];return this.yytext+=d,this.yyleng++,this.offset++,this.match+=d,this.matched+=d,d.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),d},"input"),unput:h(function(d){var u=d.length,k=d.split(/(?:\r\n?|\n)/g);this._input=d+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===b.length?this.yylloc.first_column:0)+b[b.length-k.length].length-k[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:h(function(d){this.unput(this.match.slice(d))},"less"),pastInput:h(function(){var d=this.matched.substr(0,this.matched.length-this.match.length);return(d.length>20?"...":"")+d.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var d=this.match;return d.length<20&&(d+=this._input.substr(0,20-d.length)),(d.substr(0,20)+(d.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var d=this.pastInput(),u=new Array(d.length+1).join("-");return d+this.upcomingInput()+` +`+u+"^"},"showPosition"),test_match:h(function(d,u){var k,b,m;if(this.options.backtrack_lexer&&(m={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(m.yylloc.range=this.yylloc.range.slice(0))),(b=d[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+d[0].length},this.yytext+=d[0],this.match+=d[0],this.matches=d,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(d[0].length),this.matched+=d[0],k=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),k)return k;if(this._backtrack){for(var l in m)this[l]=m[l];return!1}return!1},"test_match"),next:h(function(){if(this.done)return this.EOF;var d,u,k,b;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),l=0;lu[0].length)){if(u=k,b=l,this.options.backtrack_lexer){if((d=this.test_match(k,m[l]))!==!1)return d;if(this._backtrack){u=!1;continue}return!1}if(!this.options.flex)break}return u?(d=this.test_match(u,m[b]))!==!1&&d:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:h(function(){var d=this.next();return d||this.lex()},"lex"),begin:h(function(d){this.conditionStack.push(d)},"begin"),popState:h(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:h(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:h(function(d){return(d=this.conditionStack.length-1-Math.abs(d||0))>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:h(function(d){this.begin(d)},"pushState"),stateStackSize:h(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:h(function(d,u,k,b){switch(k){case 0:return 10;case 1:return d.getLogger().debug("Found space-block"),31;case 2:return d.getLogger().debug("Found nl-block"),31;case 3:return d.getLogger().debug("Found space-block"),29;case 4:d.getLogger().debug(".",u.yytext);break;case 5:d.getLogger().debug("_",u.yytext);break;case 6:return 5;case 7:return u.yytext=-1,28;case 8:return u.yytext=u.yytext.replace(/columns\s+/,""),d.getLogger().debug("COLUMNS (LEX)",u.yytext),28;case 9:case 77:case 78:case 100:this.pushState("md_string");break;case 10:return"MD_STR";case 11:case 35:case 80:this.popState();break;case 12:this.pushState("string");break;case 13:d.getLogger().debug("LEX: POPPING STR:",u.yytext),this.popState();break;case 14:return d.getLogger().debug("LEX: STR end:",u.yytext),"STR";case 15:return u.yytext=u.yytext.replace(/space\:/,""),d.getLogger().debug("SPACE NUM (LEX)",u.yytext),21;case 16:return u.yytext="1",d.getLogger().debug("COLUMNS (LEX)",u.yytext),21;case 17:return 43;case 18:return"LINKSTYLE";case 19:return"INTERPOLATE";case 20:return this.pushState("CLASSDEF"),40;case 21:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 22:return this.popState(),this.pushState("CLASSDEFID"),41;case 23:return this.popState(),42;case 24:return this.pushState("CLASS"),44;case 25:return this.popState(),this.pushState("CLASS_STYLE"),45;case 26:return this.popState(),46;case 27:return this.pushState("STYLE_STMNT"),47;case 28:return this.popState(),this.pushState("STYLE_DEFINITION"),48;case 29:return this.popState(),49;case 30:return this.pushState("acc_title"),"acc_title";case 31:return this.popState(),"acc_title_value";case 32:return this.pushState("acc_descr"),"acc_descr";case 33:return this.popState(),"acc_descr_value";case 34:this.pushState("acc_descr_multiline");break;case 36:return"acc_descr_multiline_value";case 37:return 30;case 38:case 39:case 41:case 42:case 45:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 40:return this.popState(),d.getLogger().debug("Lex: ))"),"NODE_DEND";case 43:return this.popState(),d.getLogger().debug("Lex: (-"),"NODE_DEND";case 44:return this.popState(),d.getLogger().debug("Lex: -)"),"NODE_DEND";case 46:return this.popState(),d.getLogger().debug("Lex: ]]"),"NODE_DEND";case 47:return this.popState(),d.getLogger().debug("Lex: ("),"NODE_DEND";case 48:return this.popState(),d.getLogger().debug("Lex: ])"),"NODE_DEND";case 49:case 50:return this.popState(),d.getLogger().debug("Lex: /]"),"NODE_DEND";case 51:return this.popState(),d.getLogger().debug("Lex: )]"),"NODE_DEND";case 52:return this.popState(),d.getLogger().debug("Lex: )"),"NODE_DEND";case 53:return this.popState(),d.getLogger().debug("Lex: ]>"),"NODE_DEND";case 54:return this.popState(),d.getLogger().debug("Lex: ]"),"NODE_DEND";case 55:return d.getLogger().debug("Lexa: -)"),this.pushState("NODE"),36;case 56:return d.getLogger().debug("Lexa: (-"),this.pushState("NODE"),36;case 57:return d.getLogger().debug("Lexa: ))"),this.pushState("NODE"),36;case 58:case 60:case 61:case 62:case 65:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;case 59:return d.getLogger().debug("Lex: ((("),this.pushState("NODE"),36;case 63:return d.getLogger().debug("Lexc: >"),this.pushState("NODE"),36;case 64:return d.getLogger().debug("Lexa: (["),this.pushState("NODE"),36;case 66:case 67:case 68:case 69:case 70:case 71:case 72:return this.pushState("NODE"),36;case 73:return d.getLogger().debug("Lexa: ["),this.pushState("NODE"),36;case 74:return this.pushState("BLOCK_ARROW"),d.getLogger().debug("LEX ARR START"),38;case 75:return d.getLogger().debug("Lex: NODE_ID",u.yytext),32;case 76:return d.getLogger().debug("Lex: EOF",u.yytext),8;case 79:return"NODE_DESCR";case 81:d.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 82:d.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 83:return d.getLogger().debug("LEX: NODE_DESCR:",u.yytext),"NODE_DESCR";case 84:d.getLogger().debug("LEX POPPING"),this.popState();break;case 85:d.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 86:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (right): dir:",u.yytext),"DIR";case 87:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (left):",u.yytext),"DIR";case 88:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (x):",u.yytext),"DIR";case 89:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (y):",u.yytext),"DIR";case 90:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (up):",u.yytext),"DIR";case 91:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (down):",u.yytext),"DIR";case 92:return u.yytext="]>",d.getLogger().debug("Lex (ARROW_DIR end):",u.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 93:return d.getLogger().debug("Lex: LINK","#"+u.yytext+"#"),15;case 94:case 95:case 96:return d.getLogger().debug("Lex: LINK",u.yytext),15;case 97:case 98:case 99:return d.getLogger().debug("Lex: START_LINK",u.yytext),this.pushState("LLABEL"),16;case 101:return d.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 102:return this.popState(),d.getLogger().debug("Lex: LINK","#"+u.yytext+"#"),15;case 103:case 104:return this.popState(),d.getLogger().debug("Lex: LINK",u.yytext),15;case 105:return d.getLogger().debug("Lex: COLON",u.yytext),u.yytext=u.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block\s+)/,/^(?:block\n+)/,/^(?:block:)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[29],inclusive:!1},STYLE_STMNT:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[23],inclusive:!1},CLASSDEF:{rules:[21,22],inclusive:!1},CLASS_STYLE:{rules:[26],inclusive:!1},CLASS:{rules:[25],inclusive:!1},LLABEL:{rules:[100,101,102,103,104],inclusive:!1},ARROW_DIR:{rules:[86,87,88,89,90,91,92],inclusive:!1},BLOCK_ARROW:{rules:[77,82,85],inclusive:!1},NODE:{rules:[38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,78,81],inclusive:!1},md_string:{rules:[10,11,79,80],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[13,14,83,84],inclusive:!1},acc_descr_multiline:{rules:[35,36],inclusive:!1},acc_descr:{rules:[33],inclusive:!1},acc_title:{rules:[31],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,12,15,16,17,18,19,20,24,27,30,32,34,37,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,93,94,95,96,97,98,99,105],inclusive:!0}}}}();function v(){this.yy={}}return D.lexer=N,h(v,"Parser"),v.prototype=D,D.Parser=v,new v}();yt.parser=yt;var me=yt,K=new Map,pt=[],ut=new Map,Tt="color",Ct="fill",we=z(),st=new Map,ke=h(e=>he.sanitizeText(e,we),"sanitizeText"),Le=h(function(e,t=""){let a=st.get(e);a||(a={id:e,styles:[],textStyles:[]},st.set(e,a)),t!=null&&t.split(",").forEach(n=>{const r=n.replace(/([^;]*);/,"$1").trim();if(RegExp(Tt).exec(n)){const s=r.replace(Ct,"bgFill").replace(Tt,Ct);a.textStyles.push(s)}a.styles.push(r)})},"addStyleClass"),Se=h(function(e,t=""){const a=K.get(e);t!=null&&(a.styles=t.split(","))},"addStyle2Node"),_e=h(function(e,t){e.split(",").forEach(function(a){let n=K.get(a);if(n===void 0){const r=a.trim();n={id:r,type:"na",children:[]},K.set(r,n)}n.classes||(n.classes=[]),n.classes.push(t)})},"setCssClass"),Nt=h((e,t)=>{const a=e.flat(),n=[];for(const r of a)if(r.label&&(r.label=ke(r.label)),r.type!=="classDef")if(r.type!=="applyClass")if(r.type!=="applyStyles")if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const s=(ut.get(r.id)??0)+1;ut.set(r.id,s),r.id=s+"-"+r.id,pt.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const s=K.get(r.id);if(s===void 0?K.set(r.id,r):(r.type!=="na"&&(s.type=r.type),r.label!==r.id&&(s.label=r.label)),r.children&&Nt(r.children,r),r.type==="space"){const i=r.width??1;for(let o=0;o{w.debug("Clear called"),oe(),tt={id:"root",type:"composite",children:[],columns:-1},K=new Map([["root",tt]]),xt=[],st=new Map,pt=[],ut=new Map},"clear");function It(e){switch(w.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return w.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function Bt(e){return w.debug("typeStr2Type",e),e==="=="?"thick":"normal"}function zt(e){switch(e.trim()){case"--x":return"arrow_cross";case"--o":return"arrow_circle";default:return"arrow_point"}}h(It,"typeStr2Type"),h(Bt,"edgeTypeStr2Type"),h(zt,"edgeStrToEdgeData");var Rt=0,ve=h(()=>(Rt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Rt),"generateId"),De=h(e=>{tt.children=e,Nt(e,tt),xt=tt.children},"setHierarchy"),$e=h(e=>{const t=K.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Te=h(()=>[...K.values()],"getBlocksFlat"),Ce=h(()=>xt||[],"getBlocks"),Ne=h(()=>pt,"getEdges"),Ie=h(e=>K.get(e),"getBlock"),Be=h(e=>{K.set(e.id,e)},"setBlock"),ze=h(()=>console,"getLogger"),Re=h(function(){return st},"getClasses"),Oe={getConfig:h(()=>V().block,"getConfig"),typeStr2Type:It,edgeTypeStr2Type:Bt,edgeStrToEdgeData:zt,getLogger:ze,getBlocksFlat:Te,getBlocks:Ce,getEdges:Ne,setHierarchy:De,getBlock:Ie,setBlock:Be,getColumns:$e,getClasses:Re,clear:Ee,generateId:ve},nt=h((e,t)=>{const a=xe,n=a(e,"r"),r=a(e,"g"),s=a(e,"b");return le(n,r,s,t)},"fade"),Ae=h(e=>`.label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span,p { + color: ${e.titleColor}; + } + + + + .label text,span,p { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + .flowchart-label text { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${nt(e.edgeLabelBackground,.5)}; + // background-color: + } + + .node .cluster { + // fill: ${nt(e.mainBkg,.5)}; + fill: ${nt(e.clusterBkg,.5)}; + stroke: ${nt(e.clusterBorder,.2)}; + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span,p { + color: ${e.titleColor}; + } + /* .cluster div { + color: ${e.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } +`,"getStyles"),Me=h((e,t,a,n)=>{t.forEach(r=>{Pe[r](e,a,n)})},"insertMarkers"),Pe={extension:h((e,t,a)=>{w.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),composition:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),aggregation:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),dependency:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),lollipop:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),point:h((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),circle:h((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),cross:h((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),barb:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb")},Ye=Me,B=((se=(ae=z())==null?void 0:ae.block)==null?void 0:se.padding)??8;function Ot(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);return e<0?{px:t,py:0}:e===1?{px:0,py:t}:{px:t%e,py:Math.floor(t/e)}}h(Ot,"calculateBlockPosition");var We=h(e=>{let t=0,a=0;for(const n of e.children){const{width:r,height:s,x:i,y:o}=n.size??{width:0,height:0,x:0,y:0};w.debug("getMaxChildSize abc95 child:",n.id,"width:",r,"height:",s,"x:",i,"y:",o,n.type),n.type!=="space"&&(r>t&&(t=r/(e.widthInColumns??1)),s>a&&(a=s))}return{width:t,height:a}},"getMaxChildSize");function it(e,t,a=0,n=0){var i,o,c,p,y,x,f,_,L,E,D;w.debug("setBlockSizes abc95 (start)",e.id,(i=e==null?void 0:e.size)==null?void 0:i.x,"block width =",e==null?void 0:e.size,"sieblingWidth",a),(o=e==null?void 0:e.size)!=null&&o.width||(e.size={width:a,height:n,x:0,y:0});let r=0,s=0;if(((c=e.children)==null?void 0:c.length)>0){for(const l of e.children)it(l,t);const N=We(e);r=N.width,s=N.height,w.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",r,s);for(const l of e.children)l.size&&(w.debug(`abc95 Setting size of children of ${e.id} id=${l.id} ${r} ${s} ${JSON.stringify(l.size)}`),l.size.width=r*(l.widthInColumns??1)+B*((l.widthInColumns??1)-1),l.size.height=s,l.size.x=0,l.size.y=0,w.debug(`abc95 updating size of ${e.id} children child:${l.id} maxWidth:${r} maxHeight:${s}`));for(const l of e.children)it(l,t,r,s);const v=e.columns??-1;let d=0;for(const l of e.children)d+=l.widthInColumns??1;let u=e.children.length;v>0&&v0?Math.min(e.children.length,v):e.children.length;if(l>0){const S=(b-l*B-B)/l;w.debug("abc95 (growing to fit) width",e.id,b,(f=e.size)==null?void 0:f.width,S);for(const g of e.children)g.size&&(g.size.width=S)}}e.size={width:b,height:m,x:0,y:0}}w.debug("setBlockSizes abc94 (done)",e.id,(_=e==null?void 0:e.size)==null?void 0:_.x,(L=e==null?void 0:e.size)==null?void 0:L.width,(E=e==null?void 0:e.size)==null?void 0:E.y,(D=e==null?void 0:e.size)==null?void 0:D.height)}function bt(e,t){var n,r,s,i,o,c,p,y,x,f,_,L,E,D,N,v,d;w.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(n=e==null?void 0:e.size)==null?void 0:n.x} y: ${(r=e==null?void 0:e.size)==null?void 0:r.y} width: ${(s=e==null?void 0:e.size)==null?void 0:s.width}`);const a=e.columns??-1;if(w.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const u=((o=(i=e==null?void 0:e.children[0])==null?void 0:i.size)==null?void 0:o.width)??0,k=e.children.length*u+(e.children.length-1)*B;w.debug("widthOfChildren 88",k,"posX");let b=0;w.debug("abc91 block?.size?.x",e.id,(c=e==null?void 0:e.size)==null?void 0:c.x);let m=(p=e==null?void 0:e.size)!=null&&p.x?((y=e==null?void 0:e.size)==null?void 0:y.x)+(-((x=e==null?void 0:e.size)==null?void 0:x.width)/2||0):-B,l=0;for(const S of e.children){const g=e;if(!S.size)continue;const{width:$,height:H}=S.size,{px:U,py:T}=Ot(a,b);if(T!=l&&(l=T,m=(f=e==null?void 0:e.size)!=null&&f.x?((_=e==null?void 0:e.size)==null?void 0:_.x)+(-((L=e==null?void 0:e.size)==null?void 0:L.width)/2||0):-B,w.debug("New row in layout for block",e.id," and child ",S.id,l)),w.debug(`abc89 layout blocks (child) id: ${S.id} Pos: ${b} (px, py) ${U},${T} (${(E=g==null?void 0:g.size)==null?void 0:E.x},${(D=g==null?void 0:g.size)==null?void 0:D.y}) parent: ${g.id} width: ${$}${B}`),g.size){const M=$/2;S.size.x=m+B+M,w.debug(`abc91 layout blocks (calc) px, pyid:${S.id} startingPos=X${m} new startingPosX${S.size.x} ${M} padding=${B} width=${$} halfWidth=${M} => x:${S.size.x} y:${S.size.y} ${S.widthInColumns} (width * (child?.w || 1)) / 2 ${$*((S==null?void 0:S.widthInColumns)??1)/2}`),m=S.size.x+M,S.size.y=g.size.y-g.size.height/2+T*(H+B)+H/2+B,w.debug(`abc88 layout blocks (calc) px, pyid:${S.id}startingPosX${m}${B}${M}=>x:${S.size.x}y:${S.size.y}${S.widthInColumns}(width * (child?.w || 1)) / 2${$*((S==null?void 0:S.widthInColumns)??1)/2}`)}S.children&&bt(S),b+=(S==null?void 0:S.widthInColumns)??1,w.debug("abc88 columnsPos",S,b)}}w.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(N=e==null?void 0:e.size)==null?void 0:N.x} y: ${(v=e==null?void 0:e.size)==null?void 0:v.y} width: ${(d=e==null?void 0:e.size)==null?void 0:d.width}`)}function ft(e,{minX:t,minY:a,maxX:n,maxY:r}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:s,y:i,width:o,height:c}=e.size;s-o/2n&&(n=s+o/2),i+c/2>r&&(r=i+c/2)}if(e.children)for(const s of e.children)({minX:t,minY:a,maxX:n,maxY:r}=ft(s,{minX:t,minY:a,maxX:n,maxY:r}));return{minX:t,minY:a,maxX:n,maxY:r}}function At(e){const t=e.getBlock("root");if(!t)return;it(t,e,0,0),bt(t),w.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:n,maxX:r,maxY:s}=ft(t);return{x:a,y:n,width:r-a,height:s-n}}function mt(e,t){t&&e.attr("style",t)}function Mt(e){const t=R(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),a=t.append("xhtml:div"),n=e.label,r=e.isNode?"nodeLabel":"edgeLabel",s=a.append("span");return s.html(n),mt(s,e.labelStyle),s.attr("class",r),mt(a,e.labelStyle),a.style("display","inline-block"),a.style("white-space","nowrap"),a.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}h(it,"setBlockSizes"),h(bt,"layoutBlocks"),h(ft,"findBounds"),h(At,"layout"),h(mt,"applyStyle"),h(Mt,"addHtmlLabel");var F=h((e,t,a,n)=>{let r=e||"";if(typeof r=="object"&&(r=r[0]),q(z().flowchart.htmlLabels))return r=r.replace(/\\n|\n/g,"
"),w.debug("vertexText"+r),Mt({isNode:n,label:ge(gt(r)),labelStyle:t.replace("fill:","color:")});{const s=document.createElementNS("http://www.w3.org/2000/svg","text");s.setAttribute("style",t.replace("color:","fill:"));let i=[];i=typeof r=="string"?r.split(/\\n|\n|/gi):Array.isArray(r)?r:[];for(const o of i){const c=document.createElementNS("http://www.w3.org/2000/svg","tspan");c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),c.setAttribute("dy","1em"),c.setAttribute("x","0"),a?c.setAttribute("class","title-row"):c.setAttribute("class","row"),c.textContent=o.trim(),s.appendChild(c)}return s}},"createLabel"),Xe=h((e,t,a,n,r)=>{t.arrowTypeStart&&Pt(e,"start",t.arrowTypeStart,a,n,r),t.arrowTypeEnd&&Pt(e,"end",t.arrowTypeEnd,a,n,r)},"addEdgeMarkers"),Fe={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Pt=h((e,t,a,n,r,s)=>{const i=Fe[a];if(!i)return void w.warn(`Unknown arrow type: ${a}`);const o=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${n}#${r}_${s}-${i}${o})`)},"addEdgeMarker"),wt={},A={},He=h((e,t)=>{const a=z(),n=q(a.flowchart.htmlLabels),r=t.labelType==="markdown"?Dt(e,t.label,{style:t.labelStyle,useHtmlLabels:n,addSvgBackground:!0},a):F(t.label,t.labelStyle),s=e.insert("g").attr("class","edgeLabel"),i=s.insert("g").attr("class","label");i.node().appendChild(r);let o,c=r.getBBox();if(n){const p=r.children[0],y=R(r);c=p.getBoundingClientRect(),y.attr("width",c.width),y.attr("height",c.height)}if(i.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),wt[t.id]=s,t.width=c.width,t.height=c.height,t.startLabelLeft){const p=F(t.startLabelLeft,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),A[t.id]||(A[t.id]={}),A[t.id].startLeft=y,et(o,t.startLabelLeft)}if(t.startLabelRight){const p=F(t.startLabelRight,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=y.node().appendChild(p),x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),A[t.id]||(A[t.id]={}),A[t.id].startRight=y,et(o,t.startLabelRight)}if(t.endLabelLeft){const p=F(t.endLabelLeft,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),y.node().appendChild(p),A[t.id]||(A[t.id]={}),A[t.id].endLeft=y,et(o,t.endLabelLeft)}if(t.endLabelRight){const p=F(t.endLabelRight,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),y.node().appendChild(p),A[t.id]||(A[t.id]={}),A[t.id].endRight=y,et(o,t.endLabelRight)}return r},"insertEdgeLabel");function et(e,t){z().flowchart.htmlLabels&&e&&(e.style.width=9*t.length+"px",e.style.height="12px")}h(et,"setTerminalWidth");var Ue=h((e,t)=>{w.debug("Moving label abc88 ",e.id,e.label,wt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const n=z(),{subGraphTitleTotalMargin:r}=de(n);if(e.label){const s=wt[e.id];let i=e.x,o=e.y;if(a){const c=Q.calcLabelPosition(a);w.debug("Moving label "+e.label+" from (",i,",",o,") to (",c.x,",",c.y,") abc88"),t.updatedPath&&(i=c.x,o=c.y)}s.attr("transform",`translate(${i}, ${o+r/2})`)}if(e.startLabelLeft){const s=A[e.id].startLeft;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}if(e.startLabelRight){const s=A[e.id].startRight;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}if(e.endLabelLeft){const s=A[e.id].endLeft;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}if(e.endLabelRight){const s=A[e.id].endRight;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}},"positionEdgeLabel"),Ke=h((e,t)=>{const a=e.x,n=e.y,r=Math.abs(t.x-a),s=Math.abs(t.y-n),i=e.width/2,o=e.height/2;return r>=i||s>=o},"outsideNode"),je=h((e,t,a)=>{w.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(a)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const n=e.x,r=e.y,s=Math.abs(n-a.x),i=e.width/2;let o=a.xMath.abs(n-t.x)*c){let x=a.y{w.debug("abc88 cutPathAtIntersect",e,t);let a=[],n=e[0],r=!1;return e.forEach(s=>{if(Ke(t,s)||r)n=s,r||a.push(s);else{const i=je(t,n,s);let o=!1;a.forEach(c=>{o=o||c.x===i.x&&c.y===i.y}),a.some(c=>c.x===i.x&&c.y===i.y)||a.push(i),r=!0}}),a},"cutPathAtIntersect"),qe=h(function(e,t,a,n,r,s,i){let o=a.points;w.debug("abc88 InsertEdge: edge=",a,"e=",t);let c=!1;const p=s.node(t.v);var y=s.node(t.w);y!=null&&y.intersect&&(p!=null&&p.intersect)&&(o=o.slice(1,a.points.length-1),o.unshift(p.intersect(o[0])),o.push(y.intersect(o[o.length-1]))),a.toCluster&&(w.debug("to cluster abc88",n[a.toCluster]),o=Yt(a.points,n[a.toCluster].node),c=!0),a.fromCluster&&(w.debug("from cluster abc88",n[a.fromCluster]),o=Yt(o.reverse(),n[a.fromCluster].node).reverse(),c=!0);const x=o.filter(u=>!Number.isNaN(u.y));let f=fe;!a.curve||r!=="graph"&&r!=="flowchart"||(f=a.curve);const{x:_,y:L}=ce(a),E=be().x(_).y(L).curve(f);let D;switch(a.thickness){case"normal":D="edge-thickness-normal";break;case"thick":case"invisible":D="edge-thickness-thick";break;default:D=""}switch(a.pattern){case"solid":D+=" edge-pattern-solid";break;case"dotted":D+=" edge-pattern-dotted";break;case"dashed":D+=" edge-pattern-dashed"}const N=e.append("path").attr("d",E(x)).attr("id",a.id).attr("class"," "+D+(a.classes?" "+a.classes:"")).attr("style",a.style);let v="";(z().flowchart.arrowMarkerAbsolute||z().state.arrowMarkerAbsolute)&&(v=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,v=v.replace(/\(/g,"\\("),v=v.replace(/\)/g,"\\)")),Xe(N,a,v,i,r);let d={};return c&&(d.updatedPath=o),d.originalPath=a.points,d},"insertEdge"),Ze=h(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a)}return t},"expandAndDeduplicateDirections"),Ge=h((e,t,a)=>{const n=Ze(e),r=t.height+2*a.padding,s=r/2,i=t.width+2*s+a.padding,o=a.padding/2;return n.has("right")&&n.has("left")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:s,y:0},{x:i/2,y:2*o},{x:i-s,y:0},{x:i,y:0},{x:i,y:-r/3},{x:i+2*o,y:-r/2},{x:i,y:-2*r/3},{x:i,y:-r},{x:i-s,y:-r},{x:i/2,y:-r-2*o},{x:s,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*o,y:-r/2},{x:0,y:-r/3}]:n.has("right")&&n.has("left")&&n.has("up")?[{x:s,y:0},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:s,y:-r},{x:0,y:-r/2}]:n.has("right")&&n.has("left")&&n.has("down")?[{x:0,y:0},{x:s,y:-r},{x:i-s,y:-r},{x:i,y:0}]:n.has("right")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:i,y:-s},{x:i,y:-r+s},{x:0,y:-r}]:n.has("left")&&n.has("up")&&n.has("down")?[{x:i,y:0},{x:0,y:-s},{x:0,y:-r+s},{x:i,y:-r}]:n.has("right")&&n.has("left")?[{x:s,y:0},{x:s,y:-o},{x:i-s,y:-o},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:i-s,y:-r+o},{x:s,y:-r+o},{x:s,y:-r},{x:0,y:-r/2}]:n.has("up")&&n.has("down")?[{x:i/2,y:0},{x:0,y:-o},{x:s,y:-o},{x:s,y:-r+o},{x:0,y:-r+o},{x:i/2,y:-r},{x:i,y:-r+o},{x:i-s,y:-r+o},{x:i-s,y:-o},{x:i,y:-o}]:n.has("right")&&n.has("up")?[{x:0,y:0},{x:i,y:-s},{x:0,y:-r}]:n.has("right")&&n.has("down")?[{x:0,y:0},{x:i,y:0},{x:0,y:-r}]:n.has("left")&&n.has("up")?[{x:i,y:0},{x:0,y:-s},{x:i,y:-r}]:n.has("left")&&n.has("down")?[{x:i,y:0},{x:0,y:0},{x:i,y:-r}]:n.has("right")?[{x:s,y:-o},{x:s,y:-o},{x:i-s,y:-o},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:i-s,y:-r+o},{x:s,y:-r+o},{x:s,y:-r+o}]:n.has("left")?[{x:s,y:0},{x:s,y:-o},{x:i-s,y:-o},{x:i-s,y:-r+o},{x:s,y:-r+o},{x:s,y:-r},{x:0,y:-r/2}]:n.has("up")?[{x:s,y:-o},{x:s,y:-r+o},{x:0,y:-r+o},{x:i/2,y:-r},{x:i,y:-r+o},{x:i-s,y:-r+o},{x:i-s,y:-o}]:n.has("down")?[{x:i/2,y:0},{x:0,y:-o},{x:s,y:-o},{x:s,y:-r+o},{x:i-s,y:-r+o},{x:i-s,y:-o},{x:i,y:-o}]:[{x:0,y:0}]},"getArrowPoints");function Wt(e,t){return e.intersect(t)}h(Wt,"intersectNode");var Je=Wt;function Xt(e,t,a,n){var r=e.x,s=e.y,i=r-n.x,o=s-n.y,c=Math.sqrt(t*t*o*o+a*a*i*i),p=Math.abs(t*a*i/c);n.x0}h(Ut,"intersectLine"),h(kt,"sameSign");var Qe=Ut,tr=Kt;function Kt(e,t,a){var n=e.x,r=e.y,s=[],i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(L){i=Math.min(i,L.x),o=Math.min(o,L.y)}):(i=Math.min(i,t.x),o=Math.min(o,t.y));for(var c=n-e.width/2-i,p=r-e.height/2-o,y=0;y1&&s.sort(function(L,E){var D=L.x-a.x,N=L.y-a.y,v=Math.sqrt(D*D+N*N),d=E.x-a.x,u=E.y-a.y,k=Math.sqrt(d*d+u*u);return v{var a,n,r=e.x,s=e.y,i=t.x-r,o=t.y-s,c=e.width/2,p=e.height/2;return Math.abs(o)*c>Math.abs(i)*p?(o<0&&(p=-p),a=o===0?0:p*i/o,n=p):(i<0&&(c=-c),a=c,n=i===0?0:c*o/i),{x:r+a,y:s+n}},"intersectRect")},O=h(async(e,t,a,n)=>{const r=z();let s;const i=t.useHtmlLabels||q(r.flowchart.htmlLabels);s=a||"node default";const o=e.insert("g").attr("class",s).attr("id",t.domId||t.id),c=o.insert("g").attr("class","label").attr("style",t.labelStyle);let p;p=t.labelText===void 0?"":typeof t.labelText=="string"?t.labelText:t.labelText[0];const y=c.node();let x;x=t.labelType==="markdown"?Dt(c,$t(gt(p),r),{useHtmlLabels:i,width:t.width||r.flowchart.wrappingWidth,classes:"markdown-node-label"},r):y.appendChild(F($t(gt(p),r),t.labelStyle,!1,n));let f=x.getBBox();const _=t.padding/2;if(q(r.flowchart.htmlLabels)){const L=x.children[0],E=R(x),D=L.getElementsByTagName("img");if(D){const N=p.replace(/]*>/g,"").trim()==="";await Promise.all([...D].map(v=>new Promise(d=>{function u(){if(v.style.display="flex",v.style.flexDirection="column",N){const k=r.fontSize?r.fontSize:window.getComputedStyle(document.body).fontSize,b=5,m=parseInt(k,10)*b+"px";v.style.minWidth=m,v.style.maxWidth=m}else v.style.width="100%";d(v)}h(u,"setupImage"),setTimeout(()=>{v.complete&&u()}),v.addEventListener("error",u),v.addEventListener("load",u)})))}f=L.getBoundingClientRect(),E.attr("width",f.width),E.attr("height",f.height)}return i?c.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):c.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&c.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),c.insert("rect",":first-child"),{shapeSvg:o,bbox:f,halfPadding:_,label:c}},"labelHelper"),I=h((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function j(e,t,a,n){return e.insert("polygon",":first-child").attr("points",n.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}h(j,"insertPolygonShape");var er=h(async(e,t)=>{t.useHtmlLabels||z().flowchart.htmlLabels||(t.centerLabel=!0);const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,"node "+t.classes,!0);w.info("Classes = ",t.classes);const s=a.insert("rect",":first-child");return s.attr("rx",t.rx).attr("ry",t.ry).attr("x",-n.width/2-r).attr("y",-n.height/2-r).attr("width",n.width+t.padding).attr("height",n.height+t.padding),I(t,s),t.intersect=function(i){return C.rect(t,i)},a},"note"),jt=h(e=>e?" "+e:"","formatClass"),Y=h((e,t)=>`${t||"node default"}${jt(e.classes)} ${jt(e.class)}`,"getClassesFromNode"),qt=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding+(n.height+t.padding),s=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];w.info("Question main (Circle)");const i=j(a,r,r,s);return i.attr("style",t.style),I(t,i),t.intersect=function(o){return w.warn("Intersect called"),C.polygon(t,s,o)},a},"question"),rr=h((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return a.insert("polygon",":first-child").attr("points",n.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return C.circle(t,14,r)},a},"choice"),ar=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.height+t.padding,s=r/4,i=n.width+2*s+t.padding,o=[{x:s,y:0},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:s,y:-r},{x:0,y:-r/2}],c=j(a,i,r,o);return c.attr("style",t.style),I(t,c),t.intersect=function(p){return C.polygon(t,o,p)},a},"hexagon"),sr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,void 0,!0),r=n.height+2*t.padding,s=r/2,i=n.width+2*s+t.padding,o=Ge(t.directions,n,t),c=j(a,i,r,o);return c.attr("style",t.style),I(t,c),t.intersect=function(p){return C.polygon(t,o,p)},a},"block_arrow"),nr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:-s/2,y:0},{x:r,y:0},{x:r,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return j(a,r,s,i).attr("style",t.style),t.width=r+s,t.height=s,t.intersect=function(o){return C.polygon(t,i,o)},a},"rect_left_inv_arrow"),ir=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:-2*s/6,y:0},{x:r-s/6,y:0},{x:r+2*s/6,y:-s},{x:s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"lean_right"),or=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:2*s/6,y:0},{x:r+s/6,y:0},{x:r-2*s/6,y:-s},{x:-s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"lean_left"),lr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:-2*s/6,y:0},{x:r+2*s/6,y:0},{x:r-s/6,y:-s},{x:s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"trapezoid"),cr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:s/6,y:0},{x:r-s/6,y:0},{x:r+2*s/6,y:-s},{x:-2*s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"inv_trapezoid"),dr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:0,y:0},{x:r+s/2,y:0},{x:r,y:-s/2},{x:r+s/2,y:-s},{x:0,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"rect_right_inv_arrow"),hr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=r/2,i=s/(2.5+r/50),o=n.height+i+t.padding,c="M 0,"+i+" a "+s+","+i+" 0,0,0 "+r+" 0 a "+s+","+i+" 0,0,0 "+-r+" 0 l 0,"+o+" a "+s+","+i+" 0,0,0 "+r+" 0 l 0,"+-o,p=a.attr("label-offset-y",i).insert("path",":first-child").attr("style",t.style).attr("d",c).attr("transform","translate("+-r/2+","+-(o/2+i)+")");return I(t,p),t.intersect=function(y){const x=C.rect(t,y),f=x.x-t.x;if(s!=0&&(Math.abs(f)t.height/2-i)){let _=i*i*(1-f*f/(s*s));_!=0&&(_=Math.sqrt(_)),_=i-_,y.y-t.y>0&&(_=-_),x.y+=_}return x},a},"cylinder"),gr=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,"node "+t.classes+" "+t.class,!0),s=a.insert("rect",":first-child"),i=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,c=t.positioned?-i/2:-n.width/2-r,p=t.positioned?-o/2:-n.height/2-r;if(s.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",p).attr("width",i).attr("height",o),t.props){const y=new Set(Object.keys(t.props));t.props.borders&&(ot(s,t.props.borders,i,o),y.delete("borders")),y.forEach(x=>{w.warn(`Unknown node property ${x}`)})}return I(t,s),t.intersect=function(y){return C.rect(t,y)},a},"rect"),yr=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,"node "+t.classes,!0),s=a.insert("rect",":first-child"),i=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,c=t.positioned?-i/2:-n.width/2-r,p=t.positioned?-o/2:-n.height/2-r;if(s.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",p).attr("width",i).attr("height",o),t.props){const y=new Set(Object.keys(t.props));t.props.borders&&(ot(s,t.props.borders,i,o),y.delete("borders")),y.forEach(x=>{w.warn(`Unknown node property ${x}`)})}return I(t,s),t.intersect=function(y){return C.rect(t,y)},a},"composite"),pr=h(async(e,t)=>{const{shapeSvg:a}=await O(e,t,"label",!0);w.trace("Classes = ",t.class);const n=a.insert("rect",":first-child");if(n.attr("width",0).attr("height",0),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(ot(n,t.props.borders,0,0),r.delete("borders")),r.forEach(s=>{w.warn(`Unknown node property ${s}`)})}return I(t,n),t.intersect=function(r){return C.rect(t,r)},a},"labelRect");function ot(e,t,a,n){const r=[],s=h(o=>{r.push(o,0)},"addBorder"),i=h(o=>{r.push(0,o)},"skipBorder");t.includes("t")?(w.debug("add top border"),s(a)):i(a),t.includes("r")?(w.debug("add right border"),s(n)):i(n),t.includes("b")?(w.debug("add bottom border"),s(a)):i(a),t.includes("l")?(w.debug("add left border"),s(n)):i(n),e.attr("stroke-dasharray",r.join(" "))}h(ot,"applyNodePropertyBorders");var ur=h((e,t)=>{let a;a=t.classes?"node "+t.classes:"node default";const n=e.insert("g").attr("class",a).attr("id",t.domId||t.id),r=n.insert("rect",":first-child"),s=n.insert("line"),i=n.insert("g").attr("class","label"),o=t.labelText.flat?t.labelText.flat():t.labelText;let c="";c=typeof o=="object"?o[0]:o,w.info("Label text abc79",c,o,typeof o=="object");const p=i.node().appendChild(F(c,t.labelStyle,!0,!0));let y={width:0,height:0};if(q(z().flowchart.htmlLabels)){const E=p.children[0],D=R(p);y=E.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}w.info("Text 2",o);const x=o.slice(1,o.length);let f=p.getBBox();const _=i.node().appendChild(F(x.join?x.join("
"):x,t.labelStyle,!0,!0));if(q(z().flowchart.htmlLabels)){const E=_.children[0],D=R(_);y=E.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}const L=t.padding/2;return R(_).attr("transform","translate( "+(y.width>f.width?0:(f.width-y.width)/2)+", "+(f.height+L+5)+")"),R(p).attr("transform","translate( "+(y.width{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.height+t.padding,s=n.width+r/4+t.padding,i=a.insert("rect",":first-child").attr("style",t.style).attr("rx",r/2).attr("ry",r/2).attr("x",-s/2).attr("y",-r/2).attr("width",s).attr("height",r);return I(t,i),t.intersect=function(o){return C.rect(t,o)},a},"stadium"),br=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,Y(t,void 0),!0),s=a.insert("circle",":first-child");return s.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+r).attr("width",n.width+t.padding).attr("height",n.height+t.padding),w.info("Circle main"),I(t,s),t.intersect=function(i){return w.info("Circle intersect",t,n.width/2+r,i),C.circle(t,n.width/2+r,i)},a},"circle"),fr=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,Y(t,void 0),!0),s=a.insert("g",":first-child"),i=s.insert("circle"),o=s.insert("circle");return s.attr("class",t.class),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+r+5).attr("width",n.width+t.padding+10).attr("height",n.height+t.padding+10),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+r).attr("width",n.width+t.padding).attr("height",n.height+t.padding),w.info("DoubleCircle main"),I(t,i),t.intersect=function(c){return w.info("DoubleCircle intersect",t,n.width/2+r+5,c),C.circle(t,n.width/2+r+5,c)},a},"doublecircle"),mr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:0,y:0},{x:r,y:0},{x:r,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:r+8,y:0},{x:r+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"subroutine"),wr=h((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=a.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),I(t,n),t.intersect=function(r){return C.circle(t,7,r)},a},"start"),Zt=h((e,t,a)=>{const n=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let r=70,s=10;a==="LR"&&(r=10,s=70);const i=n.append("rect").attr("x",-1*r/2).attr("y",-1*s/2).attr("width",r).attr("height",s).attr("class","fork-join");return I(t,i),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(o){return C.rect(t,o)},n},"forkJoin"),Gt={rhombus:qt,composite:yr,question:qt,rect:gr,labelRect:pr,rectWithTitle:ur,choice:rr,circle:br,doublecircle:fr,stadium:xr,hexagon:ar,block_arrow:sr,rect_left_inv_arrow:nr,lean_right:ir,lean_left:or,trapezoid:lr,inv_trapezoid:cr,rect_right_inv_arrow:dr,cylinder:hr,start:wr,end:h((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=a.insert("circle",":first-child"),r=a.insert("circle",":first-child");return r.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),n.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),I(t,r),t.intersect=function(s){return C.circle(t,7,s)},a},"end"),note:er,subroutine:mr,fork:Zt,join:Zt,class_box:h((e,t)=>{var b;const a=t.padding/2;let n;n=t.classes?"node "+t.classes:"node default";const r=e.insert("g").attr("class",n).attr("id",t.domId||t.id),s=r.insert("rect",":first-child"),i=r.insert("line"),o=r.insert("line");let c=0,p=4;const y=r.insert("g").attr("class","label");let x=0;const f=(b=t.classData.annotations)==null?void 0:b[0],_=t.classData.annotations[0]?"\xAB"+t.classData.annotations[0]+"\xBB":"",L=y.node().appendChild(F(_,t.labelStyle,!0,!0));let E=L.getBBox();if(q(z().flowchart.htmlLabels)){const m=L.children[0],l=R(L);E=m.getBoundingClientRect(),l.attr("width",E.width),l.attr("height",E.height)}t.classData.annotations[0]&&(p+=E.height+4,c+=E.width);let D=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(z().flowchart.htmlLabels?D+="<"+t.classData.type+">":D+="<"+t.classData.type+">");const N=y.node().appendChild(F(D,t.labelStyle,!0,!0));R(N).attr("class","classTitle");let v=N.getBBox();if(q(z().flowchart.htmlLabels)){const m=N.children[0],l=R(N);v=m.getBoundingClientRect(),l.attr("width",v.width),l.attr("height",v.height)}p+=v.height+4,v.width>c&&(c=v.width);const d=[];t.classData.members.forEach(m=>{const l=m.getDisplayDetails();let S=l.displayText;z().flowchart.htmlLabels&&(S=S.replace(//g,">"));const g=y.node().appendChild(F(S,l.cssStyle?l.cssStyle:t.labelStyle,!0,!0));let $=g.getBBox();if(q(z().flowchart.htmlLabels)){const H=g.children[0],U=R(g);$=H.getBoundingClientRect(),U.attr("width",$.width),U.attr("height",$.height)}$.width>c&&(c=$.width),p+=$.height+4,d.push(g)}),p+=8;const u=[];if(t.classData.methods.forEach(m=>{const l=m.getDisplayDetails();let S=l.displayText;z().flowchart.htmlLabels&&(S=S.replace(//g,">"));const g=y.node().appendChild(F(S,l.cssStyle?l.cssStyle:t.labelStyle,!0,!0));let $=g.getBBox();if(q(z().flowchart.htmlLabels)){const H=g.children[0],U=R(g);$=H.getBoundingClientRect(),U.attr("width",$.width),U.attr("height",$.height)}$.width>c&&(c=$.width),p+=$.height+4,u.push(g)}),p+=8,f){let m=(c-E.width)/2;R(L).attr("transform","translate( "+(-1*c/2+m)+", "+-1*p/2+")"),x=E.height+4}let k=(c-v.width)/2;return R(N).attr("transform","translate( "+(-1*c/2+k)+", "+(-1*p/2+x)+")"),x+=v.height+4,i.attr("class","divider").attr("x1",-c/2-a).attr("x2",c/2+a).attr("y1",-p/2-a+8+x).attr("y2",-p/2-a+8+x),x+=8,d.forEach(m=>{R(m).attr("transform","translate( "+-c/2+", "+(-1*p/2+x+4)+")");const l=m==null?void 0:m.getBBox();x+=((l==null?void 0:l.height)??0)+4}),x+=8,o.attr("class","divider").attr("x1",-c/2-a).attr("x2",c/2+a).attr("y1",-p/2-a+8+x).attr("y2",-p/2-a+8+x),x+=8,u.forEach(m=>{R(m).attr("transform","translate( "+-c/2+", "+(-1*p/2+x)+")");const l=m==null?void 0:m.getBBox();x+=((l==null?void 0:l.height)??0)+4}),s.attr("style",t.style).attr("class","outer title-state").attr("x",-c/2-a).attr("y",-p/2-a).attr("width",c+t.padding).attr("height",p+t.padding),I(t,s),t.intersect=function(m){return C.rect(t,m)},r},"class_box")},lt={},Jt=h(async(e,t,a)=>{let n,r;if(t.link){let s;z().securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s),r=await Gt[t.shape](n,t,a)}else r=await Gt[t.shape](e,t,a),n=r;return t.tooltip&&r.attr("title",t.tooltip),t.class&&r.attr("class","node default "+t.class),lt[t.id]=n,t.haveCallback&<[t.id].attr("class",lt[t.id].attr("class")+" clickable"),n},"insertNode"),kr=h(e=>{const t=lt[e.id];w.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+a-e.width/2)+", "+(e.y-e.height/2-8)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),a},"positionNode");function Lt(e,t,a=!1){var x,f,_;const n=e;let r="default";(((x=n==null?void 0:n.classes)==null?void 0:x.length)||0)>0&&(r=((n==null?void 0:n.classes)??[]).join(" ")),r+=" flowchart-label";let s,i=0,o="";switch(n.type){case"round":i=5,o="rect";break;case"composite":i=0,o="composite",s=0;break;case"square":case"group":default:o="rect";break;case"diamond":o="question";break;case"hexagon":o="hexagon";break;case"block_arrow":o="block_arrow";break;case"odd":case"rect_left_inv_arrow":o="rect_left_inv_arrow";break;case"lean_right":o="lean_right";break;case"lean_left":o="lean_left";break;case"trapezoid":o="trapezoid";break;case"inv_trapezoid":o="inv_trapezoid";break;case"circle":o="circle";break;case"ellipse":o="ellipse";break;case"stadium":o="stadium";break;case"subroutine":o="subroutine";break;case"cylinder":o="cylinder";break;case"doublecircle":o="doublecircle"}const c=ye((n==null?void 0:n.styles)??[]),p=n.label,y=n.size??{width:0,height:0,x:0,y:0};return{labelStyle:c.labelStyle,shape:o,labelText:p,rx:i,ry:i,class:r,style:c.style,id:n.id,directions:n.directions,width:y.width,height:y.height,x:y.x,y:y.y,positioned:a,intersect:void 0,type:n.type,padding:s??((_=(f=V())==null?void 0:f.block)==null?void 0:_.padding)??0}}async function Vt(e,t,a){const n=Lt(t,0,!1);if(n.type==="group")return;const r=V(),s=await Jt(e,n,{config:r}),i=s.node().getBBox(),o=a.getBlock(n.id);o.size={width:i.width,height:i.height,x:0,y:0,node:s},a.setBlock(o),s.remove()}async function Qt(e,t,a){const n=Lt(t,0,!0);if(a.getBlock(n.id).type!=="space"){const r=V();await Jt(e,n,{config:r}),t.intersect=n==null?void 0:n.intersect,kr(n)}}async function ct(e,t,a,n){for(const r of t)await n(e,r,a),r.children&&await ct(e,r.children,a,n)}async function te(e,t,a){await ct(e,t,a,Vt)}async function ee(e,t,a){await ct(e,t,a,Qt)}async function re(e,t,a,n,r){const s=new ue({multigraph:!0,compound:!0});s.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const i of a)i.size&&s.setNode(i.id,{width:i.size.width,height:i.size.height,intersect:i.intersect});for(const i of t)if(i.start&&i.end){const o=n.getBlock(i.start),c=n.getBlock(i.end);if(o!=null&&o.size&&(c!=null&&c.size)){const p=o.size,y=c.size,x=[{x:p.x,y:p.y},{x:p.x+(y.x-p.x)/2,y:p.y+(y.y-p.y)/2},{x:y.x,y:y.y}];qe(e,{v:i.start,w:i.end,name:i.id},{...i,arrowTypeEnd:i.arrowTypeEnd,arrowTypeStart:i.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",s,r),i.label&&(await He(e,{...i,label:i.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:i.arrowTypeEnd,arrowTypeStart:i.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),Ue({...i,x:x[1].x,y:x[1].y},{originalPath:x}))}}}h(Lt,"getNodeFromBlock"),h(Vt,"calculateBlockSize"),h(Qt,"insertBlockPositioned"),h(ct,"performOperations"),h(te,"calculateBlockSizes"),h(ee,"insertBlocks"),h(re,"insertEdges");var Lr=h(function(e,t){return t.db.getClasses()},"getClasses"),Sr={parser:me,db:Oe,renderer:{draw:h(async function(e,t,a,n){const{securityLevel:r,block:s}=V(),i=n.db;let o;r==="sandbox"&&(o=R("#i"+t));const c=R(r==="sandbox"?o.nodes()[0].contentDocument.body:"body"),p=r==="sandbox"?c.select(`[id="${t}"]`):R(`[id="${t}"]`);Ye(p,["point","circle","cross"],n.type,t);const y=i.getBlocks(),x=i.getBlocksFlat(),f=i.getEdges(),_=p.insert("g").attr("class","block");await te(_,y,i);const L=At(i);if(await ee(_,y,i),await re(_,f,x,i,t),L){const E=L,D=Math.max(1,Math.round(E.width/E.height*.125)),N=E.height+D+10,v=E.width+10,{useMaxWidth:d}=s;ie(p,N,v,!!d),w.debug("Here Bounds",L,E),p.attr("viewBox",`${E.x-5} ${E.y-5} ${E.width+10} ${E.height+10}`)}},"draw"),getClasses:Lr},styles:Ae};export{Sr as diagram}; diff --git a/apps/assets/brainfuck-CtZaYBKt.js b/apps/assets/brainfuck-CtZaYBKt.js new file mode 100644 index 0000000000000000000000000000000000000000..e693c70cae966bfb514c5b78f3eaa23b1edccedb --- /dev/null +++ b/apps/assets/brainfuck-CtZaYBKt.js @@ -0,0 +1 @@ +var o="><+-.,[]".split("");const m={name:"brainfuck",startState:function(){return{commentLine:!1,left:0,right:0,commentLoop:!1}},token:function(n,t){if(n.eatSpace())return null;n.sol()&&(t.commentLine=!1);var e=n.next().toString();return o.indexOf(e)===-1?(t.commentLine=!0,n.eol()&&(t.commentLine=!1),"comment"):t.commentLine===!0?(n.eol()&&(t.commentLine=!1),"comment"):e==="]"||e==="["?(e==="["?t.left++:t.right++,"bracket"):e==="+"||e==="-"?"keyword":e==="<"||e===">"?"atom":e==="."||e===","?"def":void(n.eol()&&(t.commentLine=!1))}};export{m as brainfuck}; diff --git a/apps/assets/c4Diagram-VJAJSXHY-Cl2yuyMh.js b/apps/assets/c4Diagram-VJAJSXHY-Cl2yuyMh.js new file mode 100644 index 0000000000000000000000000000000000000000..b08d31f30b07dc080ebcd6c8f3d648cce0a83413 --- /dev/null +++ b/apps/assets/c4Diagram-VJAJSXHY-Cl2yuyMh.js @@ -0,0 +1,10 @@ +var Ot,Tt;import{g as ke,d as Oe}from"./chunk-D6G4REZN-BESp3t-9.js";import{_ as f,s as Te,g as ve,a as Re,b as De,c as Dt,l as he,d as Ne,e as Pe,f as kt,h as de,i as Be,w as Me,j as Vt,k as ue}from"./mermaid-DwRBzUur.js";import{s as Gt}from"./transform-DetRMEbJ.js";import"./index-DgI7bmFZ.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var Lt=function(){var e=f(function(m,O,x,b){for(x=x||{},b=m.length;b--;x[m[b]]=O);return x},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],r=[1,63],n=[1,64],i=[1,65],d=[1,66],u=[1,67],p=[1,68],g=[1,69],w=[1,29],v=[1,30],R=[1,31],P=[1,32],X=[1,33],Y=[1,34],H=[1,35],q=[1,36],V=[1,37],G=[1,38],K=[1,39],J=[1,40],Z=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],rt=[1,47],st=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],dt=[1,54],ut=[1,55],pt=[1,56],yt=[1,57],ft=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],vt=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],E=[1,82],S=[1,83],A=[1,84],C=[1,85],k=[12,14,42],ne=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],xt=[12,33],Qt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],$t={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:f(function(m,O,x,b,T,h,Rt){var y=h.length-1;switch(T){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[y-3]);break;case 19:b.setTitle(h[y].substring(6)),this.$=h[y].substring(6);break;case 20:b.setAccDescription(h[y].substring(15)),this.$=h[y].substring(15);break;case 21:this.$=h[y].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[y].trim(),b.setAccDescription(this.$);break;case 28:h[y].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[y]),this.$=h[y];break;case 29:h[y].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[y]),this.$=h[y];break;case 30:b.addPersonOrSystemBoundary(...h[y]),this.$=h[y];break;case 31:h[y].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[y]),this.$=h[y];break;case 32:b.addDeploymentNode("node",...h[y]),this.$=h[y];break;case 33:b.addDeploymentNode("nodeL",...h[y]),this.$=h[y];break;case 34:b.addDeploymentNode("nodeR",...h[y]),this.$=h[y];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[y]),this.$=h[y];break;case 40:b.addPersonOrSystem("external_person",...h[y]),this.$=h[y];break;case 41:b.addPersonOrSystem("system",...h[y]),this.$=h[y];break;case 42:b.addPersonOrSystem("system_db",...h[y]),this.$=h[y];break;case 43:b.addPersonOrSystem("system_queue",...h[y]),this.$=h[y];break;case 44:b.addPersonOrSystem("external_system",...h[y]),this.$=h[y];break;case 45:b.addPersonOrSystem("external_system_db",...h[y]),this.$=h[y];break;case 46:b.addPersonOrSystem("external_system_queue",...h[y]),this.$=h[y];break;case 47:b.addContainer("container",...h[y]),this.$=h[y];break;case 48:b.addContainer("container_db",...h[y]),this.$=h[y];break;case 49:b.addContainer("container_queue",...h[y]),this.$=h[y];break;case 50:b.addContainer("external_container",...h[y]),this.$=h[y];break;case 51:b.addContainer("external_container_db",...h[y]),this.$=h[y];break;case 52:b.addContainer("external_container_queue",...h[y]),this.$=h[y];break;case 53:b.addComponent("component",...h[y]),this.$=h[y];break;case 54:b.addComponent("component_db",...h[y]),this.$=h[y];break;case 55:b.addComponent("component_queue",...h[y]),this.$=h[y];break;case 56:b.addComponent("external_component",...h[y]),this.$=h[y];break;case 57:b.addComponent("external_component_db",...h[y]),this.$=h[y];break;case 58:b.addComponent("external_component_queue",...h[y]),this.$=h[y];break;case 60:b.addRel("rel",...h[y]),this.$=h[y];break;case 61:b.addRel("birel",...h[y]),this.$=h[y];break;case 62:b.addRel("rel_u",...h[y]),this.$=h[y];break;case 63:b.addRel("rel_d",...h[y]),this.$=h[y];break;case 64:b.addRel("rel_l",...h[y]),this.$=h[y];break;case 65:b.addRel("rel_r",...h[y]),this.$=h[y];break;case 66:b.addRel("rel_b",...h[y]),this.$=h[y];break;case 67:h[y].splice(0,1),b.addRel("rel",...h[y]),this.$=h[y];break;case 68:b.updateElStyle("update_el_style",...h[y]),this.$=h[y];break;case 69:b.updateRelStyle("update_rel_style",...h[y]),this.$=h[y];break;case 70:b.updateLayoutConfig("update_layout_config",...h[y]),this.$=h[y];break;case 71:this.$=[h[y]];break;case 72:h[y].unshift(h[y-1]),this.$=h[y];break;case 73:case 75:this.$=h[y].trim();break;case 74:let Et={};Et[h[y-1].trim()]=h[y].trim(),this.$=Et;break;case 76:this.$=""}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:r,36:n,37:i,38:d,39:u,40:p,41:g,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt}),e(Ct,[2,14]),e(Wt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(vt,[2,19]),e(vt,[2,20]),{25:[1,78]},{27:[1,79]},e(vt,[2,23]),{35:80,75:81,76:E,77:S,79:A,80:C},{35:86,75:81,76:E,77:S,79:A,80:C},{35:87,75:81,76:E,77:S,79:A,80:C},{35:88,75:81,76:E,77:S,79:A,80:C},{35:89,75:81,76:E,77:S,79:A,80:C},{35:90,75:81,76:E,77:S,79:A,80:C},{35:91,75:81,76:E,77:S,79:A,80:C},{35:92,75:81,76:E,77:S,79:A,80:C},{35:93,75:81,76:E,77:S,79:A,80:C},{35:94,75:81,76:E,77:S,79:A,80:C},{35:95,75:81,76:E,77:S,79:A,80:C},{35:96,75:81,76:E,77:S,79:A,80:C},{35:97,75:81,76:E,77:S,79:A,80:C},{35:98,75:81,76:E,77:S,79:A,80:C},{35:99,75:81,76:E,77:S,79:A,80:C},{35:100,75:81,76:E,77:S,79:A,80:C},{35:101,75:81,76:E,77:S,79:A,80:C},{35:102,75:81,76:E,77:S,79:A,80:C},{35:103,75:81,76:E,77:S,79:A,80:C},{35:104,75:81,76:E,77:S,79:A,80:C},e(k,[2,59]),{35:105,75:81,76:E,77:S,79:A,80:C},{35:106,75:81,76:E,77:S,79:A,80:C},{35:107,75:81,76:E,77:S,79:A,80:C},{35:108,75:81,76:E,77:S,79:A,80:C},{35:109,75:81,76:E,77:S,79:A,80:C},{35:110,75:81,76:E,77:S,79:A,80:C},{35:111,75:81,76:E,77:S,79:A,80:C},{35:112,75:81,76:E,77:S,79:A,80:C},{35:113,75:81,76:E,77:S,79:A,80:C},{35:114,75:81,76:E,77:S,79:A,80:C},{35:115,75:81,76:E,77:S,79:A,80:C},{20:116,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:E,77:S,79:A,80:C},{35:120,75:81,76:E,77:S,79:A,80:C},{35:121,75:81,76:E,77:S,79:A,80:C},{35:122,75:81,76:E,77:S,79:A,80:C},{35:123,75:81,76:E,77:S,79:A,80:C},{35:124,75:81,76:E,77:S,79:A,80:C},{35:125,75:81,76:E,77:S,79:A,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Wt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:a}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:a,34:r,36:n,37:i,38:d,39:u,40:p,41:g,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt}),e(vt,[2,21]),e(vt,[2,22]),e(k,[2,39]),e(ne,[2,71],{75:81,35:132,76:E,77:S,79:A,80:C}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(k,[2,40]),e(k,[2,41]),e(k,[2,42]),e(k,[2,43]),e(k,[2,44]),e(k,[2,45]),e(k,[2,46]),e(k,[2,47]),e(k,[2,48]),e(k,[2,49]),e(k,[2,50]),e(k,[2,51]),e(k,[2,52]),e(k,[2,53]),e(k,[2,54]),e(k,[2,55]),e(k,[2,56]),e(k,[2,57]),e(k,[2,58]),e(k,[2,60]),e(k,[2,61]),e(k,[2,62]),e(k,[2,63]),e(k,[2,64]),e(k,[2,65]),e(k,[2,66]),e(k,[2,67]),e(k,[2,68]),e(k,[2,69]),e(k,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(xt,[2,28]),e(xt,[2,29]),e(xt,[2,30]),e(xt,[2,31]),e(xt,[2,32]),e(xt,[2,33]),e(xt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Wt,[2,18]),e(Ct,[2,38]),e(ne,[2,72]),e(Bt,[2,74]),e(k,[2,24]),e(k,[2,35]),e(Qt,[2,25]),e(Qt,[2,26],{12:[1,138]}),e(Qt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:f(function(m,O){if(!O.recoverable){var x=new Error(m);throw x.hash=O,x}this.trace(m)},"parseError"),parse:f(function(m){var O=this,x=[0],b=[],T=[null],h=[],Rt=this.table,y="",Et=0,re=0,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),St={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(St.yy[Ht]=this.yy[Ht]);D.setInput(m,St.yy),St.yy.lexer=D,St.yy.parser=this,D.yylloc===void 0&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;function se(){var j;return typeof(j=b.pop()||D.lex()||1)!="number"&&(j instanceof Array&&(j=(b=j).pop()),j=O.symbols_[j]||j),j}typeof St.yy.parseError=="function"?this.parseError=St.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,f(function(j){x.length=x.length-2*j,T.length=T.length-j,h.length=h.length-j},"popStack"),f(se,"lex");for(var B,At,M,le,jt,Q,oe,It,wt={};;){if(At=x[x.length-1],this.defaultActions[At]?M=this.defaultActions[At]:(B==null&&(B=se()),M=Rt[At]&&Rt[At][B]),M===void 0||!M.length||!M[0]){var ce="";for(jt in It=[],Rt[At])this.terminals_[jt]&&jt>2&&It.push("'"+this.terminals_[jt]+"'");ce=D.showPosition?"Parse error on line "+(Et+1)+`: +`+D.showPosition()+` +Expecting `+It.join(", ")+", got '"+(this.terminals_[B]||B)+"'":"Parse error on line "+(Et+1)+": Unexpected "+(B==1?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(ce,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:qt,expected:It})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+At+", token: "+B);switch(M[0]){case 1:x.push(B),T.push(D.yytext),h.push(D.yylloc),x.push(M[1]),B=null,re=D.yyleng,y=D.yytext,Et=D.yylineno,qt=D.yylloc;break;case 2:if(Q=this.productions_[M[1]][1],wt.$=T[T.length-Q],wt._$={first_line:h[h.length-(Q||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(Q||1)].first_column,last_column:h[h.length-1].last_column},we&&(wt._$.range=[h[h.length-(Q||1)].range[0],h[h.length-1].range[1]]),(le=this.performAction.apply(wt,[y,re,Et,St.yy,M[1],T,h].concat(Ce)))!==void 0)return le;Q&&(x=x.slice(0,-1*Q*2),T=T.slice(0,-1*Q),h=h.slice(0,-1*Q)),x.push(this.productions_[M[1]][0]),T.push(wt.$),h.push(wt._$),oe=Rt[x[x.length-2]][x[x.length-1]],x.push(oe);break;case 3:return!0}}return!0},"parse")},Ae=function(){return{EOF:1,parseError:f(function(m,O){if(!this.yy.parser)throw new Error(m);this.yy.parser.parseError(m,O)},"parseError"),setInput:f(function(m,O){return this.yy=O||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var m=this._input[0];return this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m,m.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:f(function(m){var O=m.length,x=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-O),this.offset-=O;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var T=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===b.length?this.yylloc.first_column:0)+b[b.length-x.length].length-x[0].length:this.yylloc.first_column-O},this.options.ranges&&(this.yylloc.range=[T[0],T[0]+this.yyleng-O]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:f(function(m){this.unput(this.match.slice(m))},"less"),pastInput:f(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var m=this.pastInput(),O=new Array(m.length+1).join("-");return m+this.upcomingInput()+` +`+O+"^"},"showPosition"),test_match:f(function(m,O){var x,b,T;if(this.options.backtrack_lexer&&(T={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(T.yylloc.range=this.yylloc.range.slice(0))),(b=m[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(m[0].length),this.matched+=m[0],x=this.performAction.call(this,this.yy,this,O,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),x)return x;if(this._backtrack){for(var h in T)this[h]=T[h];return!1}return!1},"test_match"),next:f(function(){if(this.done)return this.EOF;var m,O,x,b;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var T=this._currentRules(),h=0;hO[0].length)){if(O=x,b=h,this.options.backtrack_lexer){if((m=this.test_match(x,T[h]))!==!1)return m;if(this._backtrack){O=!1;continue}return!1}if(!this.options.flex)break}return O?(m=this.test_match(O,T[b]))!==!1&&m:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:f(function(){var m=this.next();return m||this.lex()},"lex"),begin:f(function(m){this.conditionStack.push(m)},"begin"),popState:f(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:f(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:f(function(m){return(m=this.conditionStack.length-1-Math.abs(m||0))>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:f(function(m){this.begin(m)},"pushState"),stateStackSize:f(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:f(function(m,O,x,b){switch(x){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 73:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 16:case 70:break;case 14:c;break;case 15:return 12;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:case 53:return this.begin("rel_u"),66;case 54:case 55:return this.begin("rel_d"),67;case 56:case 57:return this.begin("rel_l"),68;case 58:case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:case 79:this.popState(),this.popState();break;case 69:case 71:return 80;case 72:this.begin("string");break;case 74:case 80:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}}}();function Mt(){this.yy={}}return $t.lexer=Ae,f(Mt,"Parser"),Mt.prototype=$t,$t.Parser=Mt,new Mt}();Lt.parser=Lt;var pe,je=Lt,U=[],mt=[""],N="global",F="",z=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Nt=[],Kt="",Jt=!1,Yt=4,Ut=2,Ie=f(function(){return pe},"getC4Type"),Le=f(function(e){pe=de(e,Dt())},"setC4Type"),Ye=f(function(e,t,s,o,l,a,r,n,i){if(e==null||t==null||s==null||o==null)return;let d={};const u=Nt.find(p=>p.from===t&&p.to===s);if(u?d=u:Nt.push(d),d.type=e,d.from=t,d.to=s,d.label={text:o},l==null)d.techn={text:""};else if(typeof l=="object"){let[p,g]=Object.entries(l)[0];d[p]={text:g}}else d.techn={text:l};if(a==null)d.descr={text:""};else if(typeof a=="object"){let[p,g]=Object.entries(a)[0];d[p]={text:g}}else d.descr={text:a};if(typeof r=="object"){let[p,g]=Object.entries(r)[0];d[p]=g}else d.sprite=r;if(typeof n=="object"){let[p,g]=Object.entries(n)[0];d[p]=g}else d.tags=n;if(typeof i=="object"){let[p,g]=Object.entries(i)[0];d[p]=g}else d.link=i;d.wrap=_t()},"addRel"),Ue=f(function(e,t,s,o,l,a,r){if(t===null||s===null)return;let n={};const i=U.find(d=>d.alias===t);if(i&&t===i.alias?n=i:(n.alias=t,U.push(n)),n.label=s==null?{text:""}:{text:s},o==null)n.descr={text:""};else if(typeof o=="object"){let[d,u]=Object.entries(o)[0];n[d]={text:u}}else n.descr={text:o};if(typeof l=="object"){let[d,u]=Object.entries(l)[0];n[d]=u}else n.sprite=l;if(typeof a=="object"){let[d,u]=Object.entries(a)[0];n[d]=u}else n.tags=a;if(typeof r=="object"){let[d,u]=Object.entries(r)[0];n[d]=u}else n.link=r;n.typeC4Shape={text:e},n.parentBoundary=N,n.wrap=_t()},"addPersonOrSystem"),Fe=f(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const d=U.find(u=>u.alias===t);if(d&&t===d.alias?i=d:(i.alias=t,U.push(i)),i.label=s==null?{text:""}:{text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[u,p]=Object.entries(o)[0];i[u]={text:p}}else i.techn={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[u,p]=Object.entries(l)[0];i[u]={text:p}}else i.descr={text:l};if(typeof a=="object"){let[u,p]=Object.entries(a)[0];i[u]=p}else i.sprite=a;if(typeof r=="object"){let[u,p]=Object.entries(r)[0];i[u]=p}else i.tags=r;if(typeof n=="object"){let[u,p]=Object.entries(n)[0];i[u]=p}else i.link=n;i.wrap=_t(),i.typeC4Shape={text:e},i.parentBoundary=N},"addContainer"),Xe=f(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const d=U.find(u=>u.alias===t);if(d&&t===d.alias?i=d:(i.alias=t,U.push(i)),i.label=s==null?{text:""}:{text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[u,p]=Object.entries(o)[0];i[u]={text:p}}else i.techn={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[u,p]=Object.entries(l)[0];i[u]={text:p}}else i.descr={text:l};if(typeof a=="object"){let[u,p]=Object.entries(a)[0];i[u]=p}else i.sprite=a;if(typeof r=="object"){let[u,p]=Object.entries(r)[0];i[u]=p}else i.tags=r;if(typeof n=="object"){let[u,p]=Object.entries(n)[0];i[u]=p}else i.link=n;i.wrap=_t(),i.typeC4Shape={text:e},i.parentBoundary=N},"addComponent"),ze=f(function(e,t,s,o,l){if(e===null||t===null)return;let a={};const r=z.find(n=>n.alias===e);if(r&&e===r.alias?a=r:(a.alias=e,z.push(a)),a.label=t==null?{text:""}:{text:t},s==null)a.type={text:"system"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];a[n]={text:i}}else a.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];a[n]=i}else a.tags=o;if(typeof l=="object"){let[n,i]=Object.entries(l)[0];a[n]=i}else a.link=l;a.parentBoundary=N,a.wrap=_t(),F=N,N=e,mt.push(F)},"addPersonOrSystemBoundary"),We=f(function(e,t,s,o,l){if(e===null||t===null)return;let a={};const r=z.find(n=>n.alias===e);if(r&&e===r.alias?a=r:(a.alias=e,z.push(a)),a.label=t==null?{text:""}:{text:t},s==null)a.type={text:"container"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];a[n]={text:i}}else a.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];a[n]=i}else a.tags=o;if(typeof l=="object"){let[n,i]=Object.entries(l)[0];a[n]=i}else a.link=l;a.parentBoundary=N,a.wrap=_t(),F=N,N=e,mt.push(F)},"addContainerBoundary"),Qe=f(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const d=z.find(u=>u.alias===t);if(d&&t===d.alias?i=d:(i.alias=t,z.push(i)),i.label=s==null?{text:""}:{text:s},o==null)i.type={text:"node"};else if(typeof o=="object"){let[u,p]=Object.entries(o)[0];i[u]={text:p}}else i.type={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[u,p]=Object.entries(l)[0];i[u]={text:p}}else i.descr={text:l};if(typeof r=="object"){let[u,p]=Object.entries(r)[0];i[u]=p}else i.tags=r;if(typeof n=="object"){let[u,p]=Object.entries(n)[0];i[u]=p}else i.link=n;i.nodeType=e,i.parentBoundary=N,i.wrap=_t(),F=N,N=t,mt.push(F)},"addDeploymentNode"),$e=f(function(){N=F,mt.pop(),F=mt.pop(),mt.push(F)},"popBoundaryParseStack"),He=f(function(e,t,s,o,l,a,r,n,i,d,u){let p=U.find(g=>g.alias===t);if(p!==void 0||(p=z.find(g=>g.alias===t),p!==void 0)){if(s!=null)if(typeof s=="object"){let[g,w]=Object.entries(s)[0];p[g]=w}else p.bgColor=s;if(o!=null)if(typeof o=="object"){let[g,w]=Object.entries(o)[0];p[g]=w}else p.fontColor=o;if(l!=null)if(typeof l=="object"){let[g,w]=Object.entries(l)[0];p[g]=w}else p.borderColor=l;if(a!=null)if(typeof a=="object"){let[g,w]=Object.entries(a)[0];p[g]=w}else p.shadowing=a;if(r!=null)if(typeof r=="object"){let[g,w]=Object.entries(r)[0];p[g]=w}else p.shape=r;if(n!=null)if(typeof n=="object"){let[g,w]=Object.entries(n)[0];p[g]=w}else p.sprite=n;if(i!=null)if(typeof i=="object"){let[g,w]=Object.entries(i)[0];p[g]=w}else p.techn=i;if(d!=null)if(typeof d=="object"){let[g,w]=Object.entries(d)[0];p[g]=w}else p.legendText=d;if(u!=null)if(typeof u=="object"){let[g,w]=Object.entries(u)[0];p[g]=w}else p.legendSprite=u}},"updateElStyle"),qe=f(function(e,t,s,o,l,a,r){const n=Nt.find(i=>i.from===t&&i.to===s);if(n!==void 0){if(o!=null)if(typeof o=="object"){let[i,d]=Object.entries(o)[0];n[i]=d}else n.textColor=o;if(l!=null)if(typeof l=="object"){let[i,d]=Object.entries(l)[0];n[i]=d}else n.lineColor=l;if(a!=null)if(typeof a=="object"){let[i,d]=Object.entries(a)[0];n[i]=parseInt(d)}else n.offsetX=parseInt(a);if(r!=null)if(typeof r=="object"){let[i,d]=Object.entries(r)[0];n[i]=parseInt(d)}else n.offsetY=parseInt(r)}},"updateRelStyle"),Ve=f(function(e,t,s){let o=Yt,l=Ut;if(typeof t=="object"){const a=Object.values(t)[0];o=parseInt(a)}else o=parseInt(t);if(typeof s=="object"){const a=Object.values(s)[0];l=parseInt(a)}else l=parseInt(s);o>=1&&(Yt=o),l>=1&&(Ut=l)},"updateLayoutConfig"),Ge=f(function(){return Yt},"getC4ShapeInRow"),Ke=f(function(){return Ut},"getC4BoundaryInRow"),Je=f(function(){return N},"getCurrentBoundaryParse"),Ze=f(function(){return F},"getParentBoundaryParse"),ye=f(function(e){return e==null?U:U.filter(t=>t.parentBoundary===e)},"getC4ShapeArray"),t0=f(function(e){return U.find(t=>t.alias===e)},"getC4Shape"),e0=f(function(e){return Object.keys(ye(e))},"getC4ShapeKeys"),fe=f(function(e){return e==null?z:z.filter(t=>t.parentBoundary===e)},"getBoundaries"),a0=fe,i0=f(function(){return Nt},"getRels"),n0=f(function(){return Kt},"getTitle"),r0=f(function(e){Jt=e},"setWrap"),_t=f(function(){return Jt},"autoWrap"),s0=f(function(){U=[],z=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],F="",N="global",mt=[""],Nt=[],mt=[""],Kt="",Jt=!1,Yt=4,Ut=2},"clear"),l0=f(function(e){Kt=de(e,Dt())},"setTitle"),Zt={addPersonOrSystem:Ue,addPersonOrSystemBoundary:ze,addContainer:Fe,addContainerBoundary:We,addComponent:Xe,addDeploymentNode:Qe,popBoundaryParseStack:$e,addRel:Ye,updateElStyle:He,updateRelStyle:qe,updateLayoutConfig:Ve,autoWrap:_t,setWrap:r0,getC4ShapeArray:ye,getC4Shape:t0,getC4ShapeKeys:e0,getBoundaries:fe,getBoundarys:a0,getCurrentBoundaryParse:Je,getParentBoundaryParse:Ze,getRels:i0,getTitle:n0,getC4Type:Ie,getC4ShapeInRow:Ge,getC4BoundaryInRow:Ke,setAccTitle:De,getAccTitle:Re,getAccDescription:ve,setAccDescription:Te,getConfig:f(()=>Dt().c4,"getConfig"),clear:s0,LINETYPE:{SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},setTitle:l0,setC4Type:Le},te=f(function(e,t){return Oe(e,t)},"drawRect"),ge=f(function(e,t,s,o,l,a){const r=e.append("image");r.attr("width",t),r.attr("height",s),r.attr("x",o),r.attr("y",l);let n=a.startsWith("data:image/png;base64")?a:Be.sanitizeUrl(a);r.attr("xlink:href",n)},"drawImage"),o0=f((e,t,s)=>{const o=e.append("g");let l=0;for(let a of t){let r=a.textColor?a.textColor:"#444444",n=a.lineColor?a.lineColor:"#444444",i=a.offsetX?parseInt(a.offsetX):0,d=a.offsetY?parseInt(a.offsetY):0,u="";if(l===0){let g=o.append("line");g.attr("x1",a.startPoint.x),g.attr("y1",a.startPoint.y),g.attr("x2",a.endPoint.x),g.attr("y2",a.endPoint.y),g.attr("stroke-width","1"),g.attr("stroke",n),g.style("fill","none"),a.type!=="rel_b"&&g.attr("marker-end","url("+u+"#arrowhead)"),a.type!=="birel"&&a.type!=="rel_b"||g.attr("marker-start","url("+u+"#arrowend)"),l=-1}else{let g=o.append("path");g.attr("fill","none").attr("stroke-width","1").attr("stroke",n).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),a.type!=="rel_b"&&g.attr("marker-end","url("+u+"#arrowhead)"),a.type!=="birel"&&a.type!=="rel_b"||g.attr("marker-start","url("+u+"#arrowend)")}let p=s.messageFont();$(s)(a.label.text,o,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+i,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+d,a.label.width,a.label.height,{fill:r},p),a.techn&&a.techn.text!==""&&(p=s.messageFont(),$(s)("["+a.techn.text+"]",o,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+i,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+s.messageFontSize+5+d,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:r,"font-style":"italic"},p))}},"drawRels"),c0=f(function(e,t,s){const o=e.append("g");let l=t.bgColor?t.bgColor:"none",a=t.borderColor?t.borderColor:"#444444",r=t.fontColor?t.fontColor:"black",n={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(n={"stroke-width":1});let i={x:t.x,y:t.y,fill:l,stroke:a,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:n};te(o,i);let d=s.boundaryFont();d.fontWeight="bold",d.fontSize=d.fontSize+2,d.fontColor=r,$(s)(t.label.text,o,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},d),t.type&&t.type.text!==""&&(d=s.boundaryFont(),d.fontColor=r,$(s)(t.type.text,o,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},d)),t.descr&&t.descr.text!==""&&(d=s.boundaryFont(),d.fontSize=d.fontSize-2,d.fontColor=r,$(s)(t.descr.text,o,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},d))},"drawBoundary"),h0=f(function(e,t,s){var p;let o=t.bgColor?t.bgColor:s[t.typeC4Shape.text+"_bg_color"],l=t.borderColor?t.borderColor:s[t.typeC4Shape.text+"_border_color"],a=t.fontColor?t.fontColor:"#FFFFFF",r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="}const n=e.append("g");n.attr("class","person-man");const i=ke();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":i.x=t.x,i.y=t.y,i.fill=o,i.width=t.width,i.height=t.height,i.stroke=l,i.rx=2.5,i.ry=2.5,i.attrs={"stroke-width":.5},te(n,i);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2))}let d=_0(s,t.typeC4Shape.text);switch(n.append("text").attr("fill",a).attr("font-family",d.fontFamily).attr("font-size",d.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":ge(n,48,48,t.x+t.width/2-24,t.y+t.image.Y,r)}let u=s[t.typeC4Shape.text+"Font"]();return u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=a,$(s)(t.label.text,n,t.x,t.y+t.label.Y,t.width,t.height,{fill:a},u),u=s[t.typeC4Shape.text+"Font"](),u.fontColor=a,t.techn&&((p=t.techn)==null?void 0:p.text)!==""?$(s)(t.techn.text,n,t.x,t.y+t.techn.Y,t.width,t.height,{fill:a,"font-style":"italic"},u):t.type&&t.type.text!==""&&$(s)(t.type.text,n,t.x,t.y+t.type.Y,t.width,t.height,{fill:a,"font-style":"italic"},u),t.descr&&t.descr.text!==""&&(u=s.personFont(),u.fontColor=a,$(s)(t.descr.text,n,t.x,t.y+t.descr.Y,t.width,t.height,{fill:a},u)),t.height},"drawC4Shape"),d0=f(function(e){e.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),u0=f(function(e){e.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),p0=f(function(e){e.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),y0=f(function(e){e.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),f0=f(function(e){e.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),g0=f(function(e){e.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),b0=f(function(e){e.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertDynamicNumber"),m0=f(function(e){const t=e.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);t.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),t.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),_0=f((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"getC4ShapeFont"),$=function(){function e(l,a,r,n,i,d,u){o(a.append("text").attr("x",r+i/2).attr("y",n+d/2+5).style("text-anchor","middle").text(l),u)}function t(l,a,r,n,i,d,u,p){const{fontSize:g,fontFamily:w,fontWeight:v}=p,R=l.split(Vt.lineBreakRegex);for(let P=0;P=this.data.widthLimit||o>=this.data.widthLimit||this.nextData.cnt>be)&&(s=this.nextData.startx+t.margin+_.nextLinePaddingX,l=this.nextData.stopy+2*t.margin,this.nextData.stopx=o=s+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=a=l+t.height,this.nextData.cnt=1),t.x=s,t.y=l,this.updateVal(this.data,"startx",s,Math.min),this.updateVal(this.data,"starty",l,Math.min),this.updateVal(this.data,"stopx",o,Math.max),this.updateVal(this.data,"stopy",a,Math.max),this.updateVal(this.nextData,"startx",s,Math.min),this.updateVal(this.nextData,"starty",l,Math.min),this.updateVal(this.nextData,"stopx",o,Math.max),this.updateVal(this.nextData,"stopy",a,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},ae(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},f(Ot,"Bounds"),Ot),ae=f(function(e){Pe(_,e),e.fontFamily&&(_.personFontFamily=_.systemFontFamily=_.messageFontFamily=e.fontFamily),e.fontSize&&(_.personFontSize=_.systemFontSize=_.messageFontSize=e.fontSize),e.fontWeight&&(_.personFontWeight=_.systemFontWeight=_.messageFontWeight=e.fontWeight)},"setConf"),Pt=f((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"c4ShapeFont"),zt=f(e=>({fontFamily:e.boundaryFontFamily,fontSize:e.boundaryFontSize,fontWeight:e.boundaryFontWeight}),"boundaryFont"),x0=f(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont");function I(e,t,s,o,l){if(!t[e].width)if(s)t[e].text=Me(t[e].text,l,o),t[e].textLines=t[e].text.split(Vt.lineBreakRegex).length,t[e].width=l,t[e].height=ue(t[e].text,o);else{let a=t[e].text.split(Vt.lineBreakRegex);t[e].textLines=a.length;let r=0;t[e].height=0,t[e].width=0;for(const n of a)t[e].width=Math.max(kt(n,o),t[e].width),r=ue(n,o),t[e].height=t[e].height+r}}f(I,"calcC4ShapeTextWH");var _e=f(function(e,t,s){t.x=s.data.startx,t.y=s.data.starty,t.width=s.data.stopx-s.data.startx,t.height=s.data.stopy-s.data.starty,t.label.y=_.c4ShapeMargin-35;let o=t.wrap&&_.wrap,l=zt(_);l.fontSize=l.fontSize+2,l.fontWeight="bold",I("label",t,o,l,kt(t.label.text,l)),W.drawBoundary(e,t,_)},"drawBoundary"),xe=f(function(e,t,s,o){let l=0;for(const a of o){l=0;const r=s[a];let n=Pt(_,r.typeC4Shape.text);switch(n.fontSize=n.fontSize-2,r.typeC4Shape.width=kt("\xAB"+r.typeC4Shape.text+"\xBB",n),r.typeC4Shape.height=n.fontSize+2,r.typeC4Shape.Y=_.c4ShapePadding,l=r.typeC4Shape.Y+r.typeC4Shape.height-4,r.image={width:0,height:0,Y:0},r.typeC4Shape.text){case"person":case"external_person":r.image.width=48,r.image.height=48,r.image.Y=l,l=r.image.Y+r.image.height}r.sprite&&(r.image.width=48,r.image.height=48,r.image.Y=l,l=r.image.Y+r.image.height);let i=r.wrap&&_.wrap,d=_.width-2*_.c4ShapePadding,u=Pt(_,r.typeC4Shape.text);u.fontSize=u.fontSize+2,u.fontWeight="bold",I("label",r,i,u,d),r.label.Y=l+8,l=r.label.Y+r.label.height,r.type&&r.type.text!==""?(r.type.text="["+r.type.text+"]",I("type",r,i,Pt(_,r.typeC4Shape.text),d),r.type.Y=l+5,l=r.type.Y+r.type.height):r.techn&&r.techn.text!==""&&(r.techn.text="["+r.techn.text+"]",I("techn",r,i,Pt(_,r.techn.text),d),r.techn.Y=l+5,l=r.techn.Y+r.techn.height);let p=l,g=r.label.width;r.descr&&r.descr.text!==""&&(I("descr",r,i,Pt(_,r.typeC4Shape.text),d),r.descr.Y=l+20,l=r.descr.Y+r.descr.height,g=Math.max(r.label.width,r.descr.width),p=l-5*r.descr.textLines),g+=_.c4ShapePadding,r.width=Math.max(r.width||_.width,g,_.width),r.height=Math.max(r.height||_.height,p,_.height),r.margin=r.margin||_.c4ShapeMargin,e.insert(r),W.drawC4Shape(t,r,_)}e.bumpLastMargin(_.c4ShapeMargin)},"drawC4ShapeArray"),L=(Tt=class{constructor(t,s){this.x=t,this.y=s}},f(Tt,"Point"),Tt),Ee=f(function(e,t){let s=e.x,o=e.y,l=t.x,a=t.y,r=s+e.width/2,n=o+e.height/2,i=Math.abs(s-l),d=Math.abs(o-a),u=d/i,p=e.height/e.width,g=null;return o==a&&sl?g=new L(s,n):s==l&&oa&&(g=new L(r,o)),s>l&&o=u?new L(s,n+u*e.width/2):new L(r-i/d*e.height/2,o+e.height):s=u?new L(s+e.width,n+u*e.width/2):new L(r+i/d*e.height/2,o+e.height):sa?g=p>=u?new L(s+e.width,n-u*e.width/2):new L(r+e.height/2*i/d,o):s>l&&o>a&&(g=p>=u?new L(s,n-e.width/2*u):new L(r-e.height/2*i/d,o)),g},"getIntersectPoint"),E0=f(function(e,t){let s={x:0,y:0};s.x=t.x+t.width/2,s.y=t.y+t.height/2;let o=Ee(e,s);return s.x=e.x+e.width/2,s.y=e.y+e.height/2,{startPoint:o,endPoint:Ee(t,s)}},"getIntersectPoints"),S0=f(function(e,t,s,o){let l=0;for(let a of t){l+=1;let r=a.wrap&&_.wrap,n=x0(_);o.db.getC4Type()==="C4Dynamic"&&(a.label.text=l+": "+a.label.text);let i=kt(a.label.text,n);I("label",a,r,n,i),a.techn&&a.techn.text!==""&&(i=kt(a.techn.text,n),I("techn",a,r,n,i)),a.descr&&a.descr.text!==""&&(i=kt(a.descr.text,n),I("descr",a,r,n,i));let d=s(a.from),u=s(a.to),p=E0(d,u);a.startPoint=p.startPoint,a.endPoint=p.endPoint}W.drawRels(e,t,_)},"drawRels");function ie(e,t,s,o,l){let a=new me(l);a.data.widthLimit=s.data.widthLimit/Math.min(ee,o.length);for(let[r,n]of o.entries()){let i=0;n.image={width:0,height:0,Y:0},n.sprite&&(n.image.width=48,n.image.height=48,n.image.Y=i,i=n.image.Y+n.image.height);let d=n.wrap&&_.wrap,u=zt(_);if(u.fontSize=u.fontSize+2,u.fontWeight="bold",I("label",n,d,u,a.data.widthLimit),n.label.Y=i+8,i=n.label.Y+n.label.height,n.type&&n.type.text!==""&&(n.type.text="["+n.type.text+"]",I("type",n,d,zt(_),a.data.widthLimit),n.type.Y=i+5,i=n.type.Y+n.type.height),n.descr&&n.descr.text!==""){let v=zt(_);v.fontSize=v.fontSize-2,I("descr",n,d,v,a.data.widthLimit),n.descr.Y=i+20,i=n.descr.Y+n.descr.height}if(r==0||r%ee===0){let v=s.data.startx+_.diagramMarginX,R=s.data.stopy+_.diagramMarginY+i;a.setData(v,v,R,R)}else{let v=a.data.stopx!==a.data.startx?a.data.stopx+_.diagramMarginX:a.data.startx,R=a.data.starty;a.setData(v,v,R,R)}a.name=n.alias;let p=l.db.getC4ShapeArray(n.alias),g=l.db.getC4ShapeKeys(n.alias);g.length>0&&xe(a,e,p,g),t=n.alias;let w=l.db.getBoundarys(t);w.length>0&&ie(e,t,a,w,l),n.alias!=="global"&&_e(e,n,a),s.data.stopy=Math.max(a.data.stopy+_.c4ShapeMargin,s.data.stopy),s.data.stopx=Math.max(a.data.stopx+_.c4ShapeMargin,s.data.stopx),Ft=Math.max(Ft,s.data.stopx),Xt=Math.max(Xt,s.data.stopy)}}f(ie,"drawInsideBoundary");var Se={drawPersonOrSystemArray:xe,drawBoundary:_e,setConf:ae,draw:f(function(e,t,s,o){_=Dt().c4;const l=Dt().securityLevel;let a;l==="sandbox"&&(a=Gt("#i"+t));const r=Gt(l==="sandbox"?a.nodes()[0].contentDocument.body:"body");let n=o.db;o.db.setWrap(_.wrap),be=n.getC4ShapeInRow(),ee=n.getC4BoundaryInRow(),he.debug(`C:${JSON.stringify(_,null,2)}`);const i=l==="sandbox"?r.select(`[id="${t}"]`):Gt(`[id="${t}"]`);W.insertComputerIcon(i),W.insertDatabaseIcon(i),W.insertClockIcon(i);let d=new me(o);d.setData(_.diagramMarginX,_.diagramMarginX,_.diagramMarginY,_.diagramMarginY),d.data.widthLimit=screen.availWidth,Ft=_.diagramMarginX,Xt=_.diagramMarginY;const u=o.db.getTitle();ie(i,"",d,o.db.getBoundarys(""),o),W.insertArrowHead(i),W.insertArrowEnd(i),W.insertArrowCrossHead(i),W.insertArrowFilledHead(i),S0(i,o.db.getRels(),o.db.getC4Shape,o),d.data.stopx=Ft,d.data.stopy=Xt;const p=d.data;let g=p.stopy-p.starty+2*_.diagramMarginY;const w=p.stopx-p.startx+2*_.diagramMarginX;u&&i.append("text").text(u).attr("x",(p.stopx-p.startx)/2-4*_.diagramMarginX).attr("y",p.starty+_.diagramMarginY),Ne(i,g,w,_.useMaxWidth);const v=u?60:0;i.attr("viewBox",p.startx-_.diagramMarginX+" -"+(_.diagramMarginY+v)+" "+w+" "+(g+v)),he.debug("models:",p)},"draw")},A0={parser:je,db:Zt,renderer:Se,styles:f(e=>`.person { + stroke: ${e.personBorder}; + fill: ${e.personBkg}; + } +`,"getStyles"),init:f(({c4:e,wrap:t})=>{Se.setConf(e),Zt.setWrap(t)},"init")};export{A0 as diagram}; diff --git a/apps/assets/channel-CWOR9f3f.js b/apps/assets/channel-CWOR9f3f.js new file mode 100644 index 0000000000000000000000000000000000000000..51a27ec7abf5d40bd8c3dfc37b10e91f9cc3f3a9 --- /dev/null +++ b/apps/assets/channel-CWOR9f3f.js @@ -0,0 +1 @@ +import{U as s,C as o}from"./mermaid-DwRBzUur.js";const n=(a,r)=>s.lang.round(o.parse(a)[r]);export{n as c}; diff --git a/apps/assets/chunk-4BMEZGHF-CYzWMCfb.js b/apps/assets/chunk-4BMEZGHF-CYzWMCfb.js new file mode 100644 index 0000000000000000000000000000000000000000..06f49ca140b1f7d82d9651298c01094879d4d7a5 --- /dev/null +++ b/apps/assets/chunk-4BMEZGHF-CYzWMCfb.js @@ -0,0 +1 @@ +import{_ as l}from"./mermaid-DwRBzUur.js";function s(c,e){var i,a,o;c.accDescr&&((i=e.setAccDescription)==null||i.call(e,c.accDescr)),c.accTitle&&((a=e.setAccTitle)==null||a.call(e,c.accTitle)),c.title&&((o=e.setDiagramTitle)==null||o.call(e,c.title))}l(s,"populateCommonDb");export{s as p}; diff --git a/apps/assets/chunk-A2AXSNBT-LRmUxR_u.js b/apps/assets/chunk-A2AXSNBT-LRmUxR_u.js new file mode 100644 index 0000000000000000000000000000000000000000..9992ed4762c9ea6e24b4611526757fdb3b52d2ee --- /dev/null +++ b/apps/assets/chunk-A2AXSNBT-LRmUxR_u.js @@ -0,0 +1,164 @@ +var P,M;import{g as Ht,s as Vt}from"./chunk-RZ5BOZE2-Dd93pMgt.js";import{_ as A,l as $t,c as F,o as Jt,r as Zt,u as xt,b as te,a as ee,s as se,g as ie,p as ne,q as re,j as $,y as ae,x as ue,h as le,Q as R}from"./mermaid-DwRBzUur.js";import{s as V}from"./transform-DetRMEbJ.js";var It=function(){var s=A(function(o,y,p,r){for(p=p||{},r=o.length;r--;p[o[r]]=y);return p},"o"),i=[1,18],n=[1,19],a=[1,20],u=[1,41],l=[1,42],c=[1,26],d=[1,24],C=[1,25],B=[1,32],pt=[1,33],dt=[1,34],g=[1,45],At=[1,35],yt=[1,36],Ct=[1,37],mt=[1,38],gt=[1,27],bt=[1,28],Et=[1,29],Tt=[1,30],ft=[1,31],b=[1,44],E=[1,46],T=[1,43],k=[1,47],kt=[1,9],h=[1,8,9],J=[1,58],Z=[1,59],tt=[1,60],et=[1,61],st=[1,62],Ft=[1,63],Dt=[1,64],it=[1,8,9,41],Ot=[1,76],v=[1,8,9,12,13,22,39,41,44,66,67,68,69,70,71,72,77,79],nt=[1,8,9,12,13,17,20,22,39,41,44,48,58,66,67,68,69,70,71,72,77,79,84,99,101,102],rt=[13,58,84,99,101,102],G=[13,58,71,72,84,99,101,102],vt=[13,58,66,67,68,69,70,84,99,101,102],Bt=[1,98],U=[1,115],z=[1,107],K=[1,113],Y=[1,108],W=[1,109],j=[1,110],Q=[1,111],X=[1,112],q=[1,114],wt=[22,58,59,80,84,85,86,87,88,89],_t=[1,8,9,39,41,44],at=[1,8,9,22],Rt=[1,143],Pt=[1,8,9,59],N=[1,8,9,22,58,59,80,84,85,86,87,88,89],St={trace:A(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,DOT:17,className:18,classLiteralName:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,CLASS:46,ANNOTATION_START:47,ANNOTATION_END:48,MEMBER:49,SEPARATOR:50,relation:51,NOTE_FOR:52,noteText:53,NOTE:54,CLASSDEF:55,classList:56,stylesOpt:57,ALPHA:58,COMMA:59,direction_tb:60,direction_bt:61,direction_rl:62,direction_lr:63,relationType:64,lineType:65,AGGREGATION:66,EXTENSION:67,COMPOSITION:68,DEPENDENCY:69,LOLLIPOP:70,LINE:71,DOTTED_LINE:72,CALLBACK:73,LINK:74,LINK_TARGET:75,CLICK:76,CALLBACK_NAME:77,CALLBACK_ARGS:78,HREF:79,STYLE:80,CSSCLASS:81,style:82,styleComponent:83,NUM:84,COLON:85,UNIT:86,SPACE:87,BRKT:88,PCT:89,commentToken:90,textToken:91,graphCodeTokens:92,textNoTagsToken:93,TAGSTART:94,TAGEND:95,"==":96,"--":97,DEFAULT:98,MINUS:99,keywords:100,UNICODE_TEXT:101,BQUOTE_STR:102,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",17:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"CLASS",47:"ANNOTATION_START",48:"ANNOTATION_END",49:"MEMBER",50:"SEPARATOR",52:"NOTE_FOR",54:"NOTE",55:"CLASSDEF",58:"ALPHA",59:"COMMA",60:"direction_tb",61:"direction_bt",62:"direction_rl",63:"direction_lr",66:"AGGREGATION",67:"EXTENSION",68:"COMPOSITION",69:"DEPENDENCY",70:"LOLLIPOP",71:"LINE",72:"DOTTED_LINE",73:"CALLBACK",74:"LINK",75:"LINK_TARGET",76:"CLICK",77:"CALLBACK_NAME",78:"CALLBACK_ARGS",79:"HREF",80:"STYLE",81:"CSSCLASS",84:"NUM",85:"COLON",86:"UNIT",87:"SPACE",88:"BRKT",89:"PCT",92:"graphCodeTokens",94:"TAGSTART",95:"TAGEND",96:"==",97:"--",98:"DEFAULT",99:"MINUS",100:"keywords",101:"UNICODE_TEXT",102:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,3],[15,2],[18,1],[18,3],[18,1],[18,2],[18,2],[18,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,6],[43,2],[43,3],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[56,1],[56,3],[32,1],[32,1],[32,1],[32,1],[51,3],[51,2],[51,2],[51,1],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[57,1],[57,3],[82,1],[82,2],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[90,1],[90,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[93,1],[93,1],[93,1],[93,1],[16,1],[16,1],[16,1],[16,1],[19,1],[53,1]],performAction:A(function(o,y,p,r,m,t,H){var e=t.length-1;switch(m){case 8:this.$=t[e-1];break;case 9:case 12:case 14:this.$=t[e];break;case 10:case 13:this.$=t[e-2]+"."+t[e];break;case 11:case 15:case 95:this.$=t[e-1]+t[e];break;case 16:case 17:this.$=t[e-1]+"~"+t[e]+"~";break;case 18:r.addRelation(t[e]);break;case 19:t[e-1].title=r.cleanupLabel(t[e]),r.addRelation(t[e-1]);break;case 30:this.$=t[e].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=t[e].trim(),r.setAccDescription(this.$);break;case 33:r.addClassesToNamespace(t[e-3],t[e-1]);break;case 34:r.addClassesToNamespace(t[e-4],t[e-1]);break;case 35:this.$=t[e],r.addNamespace(t[e]);break;case 36:case 46:case 59:case 92:this.$=[t[e]];break;case 37:this.$=[t[e-1]];break;case 38:t[e].unshift(t[e-2]),this.$=t[e];break;case 40:r.setCssClass(t[e-2],t[e]);break;case 41:r.addMembers(t[e-3],t[e-1]);break;case 42:r.setCssClass(t[e-5],t[e-3]),r.addMembers(t[e-5],t[e-1]);break;case 43:this.$=t[e],r.addClass(t[e]);break;case 44:this.$=t[e-1],r.addClass(t[e-1]),r.setClassLabel(t[e-1],t[e]);break;case 45:r.addAnnotation(t[e],t[e-2]);break;case 47:t[e].push(t[e-1]),this.$=t[e];break;case 48:case 50:case 51:break;case 49:r.addMember(t[e-1],r.cleanupLabel(t[e]));break;case 52:this.$={id1:t[e-2],id2:t[e],relation:t[e-1],relationTitle1:"none",relationTitle2:"none"};break;case 53:this.$={id1:t[e-3],id2:t[e],relation:t[e-1],relationTitle1:t[e-2],relationTitle2:"none"};break;case 54:this.$={id1:t[e-3],id2:t[e],relation:t[e-2],relationTitle1:"none",relationTitle2:t[e-1]};break;case 55:this.$={id1:t[e-4],id2:t[e],relation:t[e-2],relationTitle1:t[e-3],relationTitle2:t[e-1]};break;case 56:r.addNote(t[e],t[e-1]);break;case 57:r.addNote(t[e]);break;case 58:this.$=t[e-2],r.defineClass(t[e-1],t[e]);break;case 60:this.$=t[e-2].concat([t[e]]);break;case 61:r.setDirection("TB");break;case 62:r.setDirection("BT");break;case 63:r.setDirection("RL");break;case 64:r.setDirection("LR");break;case 65:this.$={type1:t[e-2],type2:t[e],lineType:t[e-1]};break;case 66:this.$={type1:"none",type2:t[e],lineType:t[e-1]};break;case 67:this.$={type1:t[e-1],type2:"none",lineType:t[e]};break;case 68:this.$={type1:"none",type2:"none",lineType:t[e]};break;case 69:this.$=r.relationType.AGGREGATION;break;case 70:this.$=r.relationType.EXTENSION;break;case 71:this.$=r.relationType.COMPOSITION;break;case 72:this.$=r.relationType.DEPENDENCY;break;case 73:this.$=r.relationType.LOLLIPOP;break;case 74:this.$=r.lineType.LINE;break;case 75:this.$=r.lineType.DOTTED_LINE;break;case 76:case 82:this.$=t[e-2],r.setClickEvent(t[e-1],t[e]);break;case 77:case 83:this.$=t[e-3],r.setClickEvent(t[e-2],t[e-1]),r.setTooltip(t[e-2],t[e]);break;case 78:this.$=t[e-2],r.setLink(t[e-1],t[e]);break;case 79:this.$=t[e-3],r.setLink(t[e-2],t[e-1],t[e]);break;case 80:this.$=t[e-3],r.setLink(t[e-2],t[e-1]),r.setTooltip(t[e-2],t[e]);break;case 81:this.$=t[e-4],r.setLink(t[e-3],t[e-2],t[e]),r.setTooltip(t[e-3],t[e-1]);break;case 84:this.$=t[e-3],r.setClickEvent(t[e-2],t[e-1],t[e]);break;case 85:this.$=t[e-4],r.setClickEvent(t[e-3],t[e-2],t[e-1]),r.setTooltip(t[e-3],t[e]);break;case 86:this.$=t[e-3],r.setLink(t[e-2],t[e]);break;case 87:this.$=t[e-4],r.setLink(t[e-3],t[e-1],t[e]);break;case 88:this.$=t[e-4],r.setLink(t[e-3],t[e-1]),r.setTooltip(t[e-3],t[e]);break;case 89:this.$=t[e-5],r.setLink(t[e-4],t[e-2],t[e]),r.setTooltip(t[e-4],t[e-1]);break;case 90:this.$=t[e-2],r.setCssStyle(t[e-1],t[e]);break;case 91:r.setCssClass(t[e-1],t[e]);break;case 93:t[e-2].push(t[e]),this.$=t[e-2]}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:n,37:a,38:22,42:u,43:23,46:l,47:c,49:d,50:C,52:B,54:pt,55:dt,58:g,60:At,61:yt,62:Ct,63:mt,73:gt,74:bt,76:Et,80:Tt,81:ft,84:b,99:E,101:T,102:k},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(kt,[2,5],{8:[1,48]}),{8:[1,49]},s(h,[2,18],{22:[1,50]}),s(h,[2,20]),s(h,[2,21]),s(h,[2,22]),s(h,[2,23]),s(h,[2,24]),s(h,[2,25]),s(h,[2,26]),s(h,[2,27]),s(h,[2,28]),s(h,[2,29]),{34:[1,51]},{36:[1,52]},s(h,[2,32]),s(h,[2,48],{51:53,64:56,65:57,13:[1,54],22:[1,55],66:J,67:Z,68:tt,69:et,70:st,71:Ft,72:Dt}),{39:[1,65]},s(it,[2,39],{39:[1,67],44:[1,66]}),s(h,[2,50]),s(h,[2,51]),{16:68,58:g,84:b,99:E,101:T},{16:39,18:69,19:40,58:g,84:b,99:E,101:T,102:k},{16:39,18:70,19:40,58:g,84:b,99:E,101:T,102:k},{16:39,18:71,19:40,58:g,84:b,99:E,101:T,102:k},{58:[1,72]},{13:[1,73]},{16:39,18:74,19:40,58:g,84:b,99:E,101:T,102:k},{13:Ot,53:75},{56:77,58:[1,78]},s(h,[2,61]),s(h,[2,62]),s(h,[2,63]),s(h,[2,64]),s(v,[2,12],{16:39,19:40,18:80,17:[1,79],20:[1,81],58:g,84:b,99:E,101:T,102:k}),s(v,[2,14],{20:[1,82]}),{15:83,16:84,58:g,84:b,99:E,101:T},{16:39,18:85,19:40,58:g,84:b,99:E,101:T,102:k},s(nt,[2,118]),s(nt,[2,119]),s(nt,[2,120]),s(nt,[2,121]),s([1,8,9,12,13,20,22,39,41,44,66,67,68,69,70,71,72,77,79],[2,122]),s(kt,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,18:21,38:22,43:23,16:39,19:40,5:86,33:i,35:n,37:a,42:u,46:l,47:c,49:d,50:C,52:B,54:pt,55:dt,58:g,60:At,61:yt,62:Ct,63:mt,73:gt,74:bt,76:Et,80:Tt,81:ft,84:b,99:E,101:T,102:k}),{5:87,10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:n,37:a,38:22,42:u,43:23,46:l,47:c,49:d,50:C,52:B,54:pt,55:dt,58:g,60:At,61:yt,62:Ct,63:mt,73:gt,74:bt,76:Et,80:Tt,81:ft,84:b,99:E,101:T,102:k},s(h,[2,19]),s(h,[2,30]),s(h,[2,31]),{13:[1,89],16:39,18:88,19:40,58:g,84:b,99:E,101:T,102:k},{51:90,64:56,65:57,66:J,67:Z,68:tt,69:et,70:st,71:Ft,72:Dt},s(h,[2,49]),{65:91,71:Ft,72:Dt},s(rt,[2,68],{64:92,66:J,67:Z,68:tt,69:et,70:st}),s(G,[2,69]),s(G,[2,70]),s(G,[2,71]),s(G,[2,72]),s(G,[2,73]),s(vt,[2,74]),s(vt,[2,75]),{8:[1,94],24:95,40:93,43:23,46:l},{16:96,58:g,84:b,99:E,101:T},{45:97,49:Bt},{48:[1,99]},{13:[1,100]},{13:[1,101]},{77:[1,102],79:[1,103]},{22:U,57:104,58:z,80:K,82:105,83:106,84:Y,85:W,86:j,87:Q,88:X,89:q},{58:[1,116]},{13:Ot,53:117},s(h,[2,57]),s(h,[2,123]),{22:U,57:118,58:z,59:[1,119],80:K,82:105,83:106,84:Y,85:W,86:j,87:Q,88:X,89:q},s(wt,[2,59]),{16:39,18:120,19:40,58:g,84:b,99:E,101:T,102:k},s(v,[2,15]),s(v,[2,16]),s(v,[2,17]),{39:[2,35]},{15:122,16:84,17:[1,121],39:[2,9],58:g,84:b,99:E,101:T},s(_t,[2,43],{11:123,12:[1,124]}),s(kt,[2,7]),{9:[1,125]},s(at,[2,52]),{16:39,18:126,19:40,58:g,84:b,99:E,101:T,102:k},{13:[1,128],16:39,18:127,19:40,58:g,84:b,99:E,101:T,102:k},s(rt,[2,67],{64:129,66:J,67:Z,68:tt,69:et,70:st}),s(rt,[2,66]),{41:[1,130]},{24:95,40:131,43:23,46:l},{8:[1,132],41:[2,36]},s(it,[2,40],{39:[1,133]}),{41:[1,134]},{41:[2,46],45:135,49:Bt},{16:39,18:136,19:40,58:g,84:b,99:E,101:T,102:k},s(h,[2,76],{13:[1,137]}),s(h,[2,78],{13:[1,139],75:[1,138]}),s(h,[2,82],{13:[1,140],78:[1,141]}),{13:[1,142]},s(h,[2,90],{59:Rt}),s(Pt,[2,92],{83:144,22:U,58:z,80:K,84:Y,85:W,86:j,87:Q,88:X,89:q}),s(N,[2,94]),s(N,[2,96]),s(N,[2,97]),s(N,[2,98]),s(N,[2,99]),s(N,[2,100]),s(N,[2,101]),s(N,[2,102]),s(N,[2,103]),s(N,[2,104]),s(h,[2,91]),s(h,[2,56]),s(h,[2,58],{59:Rt}),{58:[1,145]},s(v,[2,13]),{15:146,16:84,58:g,84:b,99:E,101:T},{39:[2,11]},s(_t,[2,44]),{13:[1,147]},{1:[2,4]},s(at,[2,54]),s(at,[2,53]),{16:39,18:148,19:40,58:g,84:b,99:E,101:T,102:k},s(rt,[2,65]),s(h,[2,33]),{41:[1,149]},{24:95,40:150,41:[2,37],43:23,46:l},{45:151,49:Bt},s(it,[2,41]),{41:[2,47]},s(h,[2,45]),s(h,[2,77]),s(h,[2,79]),s(h,[2,80],{75:[1,152]}),s(h,[2,83]),s(h,[2,84],{13:[1,153]}),s(h,[2,86],{13:[1,155],75:[1,154]}),{22:U,58:z,80:K,82:156,83:106,84:Y,85:W,86:j,87:Q,88:X,89:q},s(N,[2,95]),s(wt,[2,60]),{39:[2,10]},{14:[1,157]},s(at,[2,55]),s(h,[2,34]),{41:[2,38]},{41:[1,158]},s(h,[2,81]),s(h,[2,85]),s(h,[2,87]),s(h,[2,88],{75:[1,159]}),s(Pt,[2,93],{83:144,22:U,58:z,80:K,84:Y,85:W,86:j,87:Q,88:X,89:q}),s(_t,[2,8]),s(it,[2,42]),s(h,[2,89])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],83:[2,35],122:[2,11],125:[2,4],135:[2,47],146:[2,10],150:[2,38]},parseError:A(function(o,y){if(!y.recoverable){var p=new Error(o);throw p.hash=y,p}this.trace(o)},"parseError"),parse:A(function(o){var y=this,p=[0],r=[],m=[null],t=[],H=this.table,e="",lt=0,Mt=0,Xt=t.slice.call(arguments,1),f=Object.create(this.lexer),x={yy:{}};for(var Nt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Nt)&&(x.yy[Nt]=this.yy[Nt]);f.setInput(o,x.yy),x.yy.lexer=f,x.yy.parser=this,f.yylloc===void 0&&(f.yylloc={});var Lt=f.yylloc;t.push(Lt);var qt=f.options&&f.options.ranges;function Gt(){var S;return typeof(S=r.pop()||f.lex()||1)!="number"&&(S instanceof Array&&(S=(r=S).pop()),S=y.symbols_[S]||S),S}typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,A(function(S){p.length=p.length-2*S,m.length=m.length-S,t.length=t.length-S},"popStack"),A(Gt,"lex");for(var D,I,_,Ut,ot,L,zt,ct,w={};;){if(I=p[p.length-1],this.defaultActions[I]?_=this.defaultActions[I]:(D==null&&(D=Gt()),_=H[I]&&H[I][D]),_===void 0||!_.length||!_[0]){var Kt="";for(ot in ct=[],H[I])this.terminals_[ot]&&ot>2&&ct.push("'"+this.terminals_[ot]+"'");Kt=f.showPosition?"Parse error on line "+(lt+1)+`: +`+f.showPosition()+` +Expecting `+ct.join(", ")+", got '"+(this.terminals_[D]||D)+"'":"Parse error on line "+(lt+1)+": Unexpected "+(D==1?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError(Kt,{text:f.match,token:this.terminals_[D]||D,line:f.yylineno,loc:Lt,expected:ct})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+D);switch(_[0]){case 1:p.push(D),m.push(f.yytext),t.push(f.yylloc),p.push(_[1]),D=null,Mt=f.yyleng,e=f.yytext,lt=f.yylineno,Lt=f.yylloc;break;case 2:if(L=this.productions_[_[1]][1],w.$=m[m.length-L],w._$={first_line:t[t.length-(L||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(L||1)].first_column,last_column:t[t.length-1].last_column},qt&&(w._$.range=[t[t.length-(L||1)].range[0],t[t.length-1].range[1]]),(Ut=this.performAction.apply(w,[e,Mt,lt,x.yy,_[1],m,t].concat(Xt)))!==void 0)return Ut;L&&(p=p.slice(0,-1*L*2),m=m.slice(0,-1*L),t=t.slice(0,-1*L)),p.push(this.productions_[_[1]][0]),m.push(w.$),t.push(w._$),zt=H[p[p.length-2]][p[p.length-1]],p.push(zt);break;case 3:return!0}}return!0},"parse")},Qt=function(){return{EOF:1,parseError:A(function(o,y){if(!this.yy.parser)throw new Error(o);this.yy.parser.parseError(o,y)},"parseError"),setInput:A(function(o,y){return this.yy=y||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:A(function(){var o=this._input[0];return this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o,o.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:A(function(o){var y=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-y),this.offset-=y;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===r.length?this.yylloc.first_column:0)+r[r.length-p.length].length-p[0].length:this.yylloc.first_column-y},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-y]),this.yyleng=this.yytext.length,this},"unput"),more:A(function(){return this._more=!0,this},"more"),reject:A(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:A(function(o){this.unput(this.match.slice(o))},"less"),pastInput:A(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:A(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:A(function(){var o=this.pastInput(),y=new Array(o.length+1).join("-");return o+this.upcomingInput()+` +`+y+"^"},"showPosition"),test_match:A(function(o,y){var p,r,m;if(this.options.backtrack_lexer&&(m={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(m.yylloc.range=this.yylloc.range.slice(0))),(r=o[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+o[0].length},this.yytext+=o[0],this.match+=o[0],this.matches=o,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(o[0].length),this.matched+=o[0],p=this.performAction.call(this,this.yy,this,y,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),p)return p;if(this._backtrack){for(var t in m)this[t]=m[t];return!1}return!1},"test_match"),next:A(function(){if(this.done)return this.EOF;var o,y,p,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),t=0;ty[0].length)){if(y=p,r=t,this.options.backtrack_lexer){if((o=this.test_match(p,m[t]))!==!1)return o;if(this._backtrack){y=!1;continue}return!1}if(!this.options.flex)break}return y?(o=this.test_match(y,m[r]))!==!1&&o:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:A(function(){var o=this.next();return o||this.lex()},"lex"),begin:A(function(o){this.conditionStack.push(o)},"begin"),popState:A(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:A(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:A(function(o){return(o=this.conditionStack.length-1-Math.abs(o||0))>=0?this.conditionStack[o]:"INITIAL"},"topState"),pushState:A(function(o){this.begin(o)},"pushState"),stateStackSize:A(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:A(function(o,y,p,r){switch(p){case 0:return 60;case 1:return 61;case 2:return 62;case 3:return 63;case 4:case 5:case 14:case 31:case 36:case 40:case 47:break;case 6:return this.begin("acc_title"),33;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),35;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 19:case 22:case 24:case 58:case 61:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 35:return 8;case 15:case 16:return 7;case 17:case 37:case 45:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 77;case 23:return 78;case 25:return"STR";case 26:this.begin("string");break;case 27:return 80;case 28:return 55;case 29:return this.begin("namespace"),42;case 30:case 39:return this.popState(),8;case 32:return this.begin("namespace-body"),39;case 33:case 43:return this.popState(),41;case 34:case 44:return"EOF_IN_STRUCT";case 38:return this.begin("class"),46;case 41:return this.popState(),this.popState(),41;case 42:return this.begin("class-body"),39;case 46:return"OPEN_IN_STRUCT";case 48:return"MEMBER";case 49:return 81;case 50:return 73;case 51:return 74;case 52:return 76;case 53:return 52;case 54:return 54;case 55:return 47;case 56:return 48;case 57:return 79;case 59:return"GENERICTYPE";case 60:this.begin("generic");break;case 62:return"BQUOTE_STR";case 63:this.begin("bqstring");break;case 64:case 65:case 66:case 67:return 75;case 68:case 69:return 67;case 70:case 71:return 69;case 72:return 68;case 73:return 66;case 74:return 70;case 75:return 71;case 76:return 72;case 77:return 22;case 78:return 44;case 79:return 99;case 80:return 17;case 81:return"PLUS";case 82:return 85;case 83:return 59;case 84:case 85:return 88;case 86:return 89;case 87:case 88:return"EQUALS";case 89:return 58;case 90:return 12;case 91:return 14;case 92:return"PUNCTUATION";case 93:return 84;case 94:return 101;case 95:case 96:return 87;case 97:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,33,34,35,36,37,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},namespace:{rules:[26,29,30,31,32,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},"class-body":{rules:[26,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},class:{rules:[26,39,40,41,42,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr:{rules:[9,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_title:{rules:[7,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_args:{rules:[22,23,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_name:{rules:[19,20,21,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},href:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},struct:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},generic:{rules:[26,49,50,51,52,53,54,55,56,57,58,59,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},bqstring:{rules:[26,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},string:{rules:[24,25,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],inclusive:!0}}}}();function ut(){this.yy={}}return St.lexer=Qt,A(ut,"Parser"),ut.prototype=St,St.Parser=ut,new ut}();It.parser=It;var oe=It,Yt=["#","+","~","-",""],Wt=(P=class{constructor(i,n){this.memberType=n,this.visibility="",this.classifier="",this.text="";const a=le(i,F());this.parseMember(a)}getDisplayDetails(){let i=this.visibility+R(this.id);return this.memberType==="method"&&(i+=`(${R(this.parameters.trim())})`,this.returnType&&(i+=" : "+R(this.returnType))),i=i.trim(),{displayText:i,cssStyle:this.parseClassifier()}}parseMember(i){let n="";if(this.memberType==="method"){const u=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(i);if(u){const l=u[1]?u[1].trim():"";if(Yt.includes(l)&&(this.visibility=l),this.id=u[2],this.parameters=u[3]?u[3].trim():"",n=u[4]?u[4].trim():"",this.returnType=u[5]?u[5].trim():"",n===""){const c=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(c)&&(n=c,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{const u=i.length,l=i.substring(0,1),c=i.substring(u-1);Yt.includes(l)&&(this.visibility=l),/[$*]/.exec(c)&&(n=c),this.id=i.substring(this.visibility===""?0:1,n===""?u:u-1)}this.classifier=n,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();const a=`${this.visibility?"\\"+this.visibility:""}${R(this.id)}${this.memberType==="method"?`(${R(this.parameters)})${this.returnType?" : "+R(this.returnType):""}`:""}`;this.text=a.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},A(P,"ClassMember"),P),ht="classId-",jt=0,O=A(s=>$.sanitizeText(s,F()),"sanitizeText"),ce=(M=class{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=[],this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=A(i=>{let n=V(".mermaidTooltip");(n._groups||n)[0][0]===null&&(n=V("body").append("div").attr("class","mermaidTooltip").style("opacity",0)),V(i).select("svg").selectAll("g.node").on("mouseover",a=>{const u=V(a.currentTarget);if(u.attr("title")===null)return;const l=this.getBoundingClientRect();n.transition().duration(200).style("opacity",".9"),n.text(u.attr("title")).style("left",window.scrollX+l.left+(l.right-l.left)/2+"px").style("top",window.scrollY+l.top-14+document.body.scrollTop+"px"),n.html(n.html().replace(/<br\/>/g,"
")),u.classed("hover",!0)}).on("mouseout",a=>{n.transition().duration(500).style("opacity",0),V(a.currentTarget).classed("hover",!1)})},"setupToolTips"),this.direction="TB",this.setAccTitle=te,this.getAccTitle=ee,this.setAccDescription=se,this.getAccDescription=ie,this.setDiagramTitle=ne,this.getDiagramTitle=re,this.getConfig=A(()=>F().class,"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}splitClassNameAndType(i){const n=$.sanitizeText(i,F());let a="",u=n;if(n.indexOf("~")>0){const l=n.split("~");u=O(l[0]),a=O(l[1])}return{className:u,type:a}}setClassLabel(i,n){const a=$.sanitizeText(i,F());n&&(n=O(n));const{className:u}=this.splitClassNameAndType(a);this.classes.get(u).label=n,this.classes.get(u).text=`${n}${this.classes.get(u).type?`<${this.classes.get(u).type}>`:""}`}addClass(i){const n=$.sanitizeText(i,F()),{className:a,type:u}=this.splitClassNameAndType(n);if(this.classes.has(a))return;const l=$.sanitizeText(a,F());this.classes.set(l,{id:l,type:u,label:l,text:`${l}${u?`<${u}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:ht+l+"-"+jt}),jt++}addInterface(i,n){const a={id:`interface${this.interfaces.length}`,label:i,classId:n};this.interfaces.push(a)}lookUpDomId(i){const n=$.sanitizeText(i,F());if(this.classes.has(n))return this.classes.get(n).domId;throw new Error("Class not found: "+n)}clear(){this.relations=[],this.classes=new Map,this.notes=[],this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.direction="TB",ae()}getClass(i){return this.classes.get(i)}getClasses(){return this.classes}getRelations(){return this.relations}getNotes(){return this.notes}addRelation(i){$t.debug("Adding relation: "+JSON.stringify(i));const n=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];i.relation.type1!==this.relationType.LOLLIPOP||n.includes(i.relation.type2)?i.relation.type2!==this.relationType.LOLLIPOP||n.includes(i.relation.type1)?(this.addClass(i.id1),this.addClass(i.id2)):(this.addClass(i.id1),this.addInterface(i.id2,i.id1),i.id2="interface"+(this.interfaces.length-1)):(this.addClass(i.id2),this.addInterface(i.id1,i.id2),i.id1="interface"+(this.interfaces.length-1)),i.id1=this.splitClassNameAndType(i.id1).className,i.id2=this.splitClassNameAndType(i.id2).className,i.relationTitle1=$.sanitizeText(i.relationTitle1.trim(),F()),i.relationTitle2=$.sanitizeText(i.relationTitle2.trim(),F()),this.relations.push(i)}addAnnotation(i,n){const a=this.splitClassNameAndType(i).className;this.classes.get(a).annotations.push(n)}addMember(i,n){this.addClass(i);const a=this.splitClassNameAndType(i).className,u=this.classes.get(a);if(typeof n=="string"){const l=n.trim();l.startsWith("<<")&&l.endsWith(">>")?u.annotations.push(O(l.substring(2,l.length-2))):l.indexOf(")")>0?u.methods.push(new Wt(l,"method")):l&&u.members.push(new Wt(l,"attribute"))}}addMembers(i,n){Array.isArray(n)&&(n.reverse(),n.forEach(a=>this.addMember(i,a)))}addNote(i,n){const a={id:`note${this.notes.length}`,class:n,text:i};this.notes.push(a)}cleanupLabel(i){return i.startsWith(":")&&(i=i.substring(1)),O(i.trim())}setCssClass(i,n){i.split(",").forEach(a=>{let u=a;/\d/.exec(a[0])&&(u=ht+u);const l=this.classes.get(u);l&&(l.cssClasses+=" "+n)})}defineClass(i,n){for(const a of i){let u=this.styleClasses.get(a);u===void 0&&(u={id:a,styles:[],textStyles:[]},this.styleClasses.set(a,u)),n&&n.forEach(l=>{if(/color/.exec(l)){const c=l.replace("fill","bgFill");u.textStyles.push(c)}u.styles.push(l)}),this.classes.forEach(l=>{l.cssClasses.includes(a)&&l.styles.push(...n.flatMap(c=>c.split(",")))})}}setTooltip(i,n){i.split(",").forEach(a=>{n!==void 0&&(this.classes.get(a).tooltip=O(n))})}getTooltip(i,n){return n&&this.namespaces.has(n)?this.namespaces.get(n).classes.get(i).tooltip:this.classes.get(i).tooltip}setLink(i,n,a){const u=F();i.split(",").forEach(l=>{let c=l;/\d/.exec(l[0])&&(c=ht+c);const d=this.classes.get(c);d&&(d.link=xt.formatUrl(n,u),u.securityLevel==="sandbox"?d.linkTarget="_top":d.linkTarget=typeof a=="string"?O(a):"_blank")}),this.setCssClass(i,"clickable")}setClickEvent(i,n,a){i.split(",").forEach(u=>{this.setClickFunc(u,n,a),this.classes.get(u).haveCallback=!0}),this.setCssClass(i,"clickable")}setClickFunc(i,n,a){const u=$.sanitizeText(i,F());if(F().securityLevel!=="loose"||n===void 0)return;const l=u;if(this.classes.has(l)){const c=this.lookUpDomId(l);let d=[];if(typeof a=="string"){d=a.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let C=0;C{const C=document.querySelector(`[id="${c}"]`);C!==null&&C.addEventListener("click",()=>{xt.runFunc(n,...d)},!1)})}}bindFunctions(i){this.functions.forEach(n=>{n(i)})}getDirection(){return this.direction}setDirection(i){this.direction=i}addNamespace(i){this.namespaces.has(i)||(this.namespaces.set(i,{id:i,classes:new Map,children:{},domId:ht+i+"-"+this.namespaceCounter}),this.namespaceCounter++)}getNamespace(i){return this.namespaces.get(i)}getNamespaces(){return this.namespaces}addClassesToNamespace(i,n){if(this.namespaces.has(i))for(const a of n){const{className:u}=this.splitClassNameAndType(a);this.classes.get(u).parent=i,this.namespaces.get(i).classes.set(u,this.classes.get(u))}}setCssStyle(i,n){const a=this.classes.get(i);if(n&&a)for(const u of n)u.includes(",")?a.styles.push(...u.split(",")):a.styles.push(u)}getArrowMarker(i){let n;switch(i){case 0:n="aggregation";break;case 1:n="extension";break;case 2:n="composition";break;case 3:n="dependency";break;case 4:n="lollipop";break;default:n="none"}return n}getData(){var l;const i=[],n=[],a=F();for(const c of this.namespaces.keys()){const d=this.namespaces.get(c);if(d){const C={id:d.id,label:d.id,isGroup:!0,padding:a.class.padding??16,shape:"rect",cssStyles:["fill: none","stroke: black"],look:a.look};i.push(C)}}for(const c of this.classes.keys()){const d=this.classes.get(c);if(d){const C=d;C.parentId=d.parent,C.look=a.look,i.push(C)}}let u=0;for(const c of this.notes){u++;const d={id:c.id,label:c.text,isGroup:!1,shape:"note",padding:a.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${a.themeVariables.noteBkgColor}`,`stroke: ${a.themeVariables.noteBorderColor}`],look:a.look};i.push(d);const C=((l=this.classes.get(c.class))==null?void 0:l.id)??"";if(C){const B={id:`edgeNote${u}`,start:c.id,end:C,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:a.look};n.push(B)}}for(const c of this.interfaces){const d={id:c.id,label:c.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:a.look};i.push(d)}u=0;for(const c of this.relations){u++;const d={id:ue(c.id1,c.id2,{prefix:"id",counter:u}),start:c.id1,end:c.id2,type:"normal",label:c.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(c.relation.type1),arrowTypeEnd:this.getArrowMarker(c.relation.type2),startLabelRight:c.relationTitle1==="none"?"":c.relationTitle1,endLabelLeft:c.relationTitle2==="none"?"":c.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:c.style||"",pattern:c.relation.lineType==1?"dashed":"solid",look:a.look};n.push(d)}return{nodes:i,edges:n,other:{},config:a,direction:this.getDirection()}}},A(M,"ClassDB"),M),he=A(s=>`g.classGroup text { + fill: ${s.nodeBorder||s.classText}; + stroke: none; + font-family: ${s.fontFamily}; + font-size: 10px; + + .title { + font-weight: bolder; + } + +} + +.nodeLabel, .edgeLabel { + color: ${s.classText}; +} +.edgeLabel .label rect { + fill: ${s.mainBkg}; +} +.label text { + fill: ${s.classText}; +} + +.labelBkg { + background: ${s.mainBkg}; +} +.edgeLabel .label span { + background: ${s.mainBkg}; +} + +.classTitle { + font-weight: bolder; +} +.node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; + stroke-width: 1px; + } + + +.divider { + stroke: ${s.nodeBorder}; + stroke-width: 1; +} + +g.clickable { + cursor: pointer; +} + +g.classGroup rect { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; +} + +g.classGroup line { + stroke: ${s.nodeBorder}; + stroke-width: 1; +} + +.classLabel .box { + stroke: none; + stroke-width: 0; + fill: ${s.mainBkg}; + opacity: 0.5; +} + +.classLabel .label { + fill: ${s.nodeBorder}; + font-size: 10px; +} + +.relation { + stroke: ${s.lineColor}; + stroke-width: 1; + fill: none; +} + +.dashed-line{ + stroke-dasharray: 3; +} + +.dotted-line{ + stroke-dasharray: 1 2; +} + +#compositionStart, .composition { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#compositionEnd, .composition { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#extensionStart, .extension { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#extensionEnd, .extension { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#aggregationStart, .aggregation { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#aggregationEnd, .aggregation { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#lollipopStart, .lollipop { + fill: ${s.mainBkg} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#lollipopEnd, .lollipop { + fill: ${s.mainBkg} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +.edgeTerminals { + font-size: 11px; + line-height: initial; +} + +.classTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${s.textColor}; +} +`,"getStyles"),pe=A((s,i="TB")=>{if(!s.doc)return i;let n=i;for(const a of s.doc)a.stmt==="dir"&&(n=a.value);return n},"getDir"),de={getClasses:A(function(s,i){return i.db.getClasses()},"getClasses"),draw:A(async function(s,i,n,a){$t.info("REF0:"),$t.info("Drawing class diagram (v3)",i);const{securityLevel:u,state:l,layout:c}=F(),d=a.db.getData(),C=Ht(i,u);d.type=a.type,d.layoutAlgorithm=Jt(c),d.nodeSpacing=(l==null?void 0:l.nodeSpacing)||50,d.rankSpacing=(l==null?void 0:l.rankSpacing)||50,d.markers=["aggregation","extension","composition","dependency","lollipop"],d.diagramId=i,await Zt(d,C),xt.insertTitle(C,"classDiagramTitleText",(l==null?void 0:l.titleTopMargin)??25,a.db.getDiagramTitle()),Vt(C,8,"classDiagram",(l==null?void 0:l.useMaxWidth)??!0)},"draw"),getDir:pe};export{ce as C,oe as a,de as c,he as s}; diff --git a/apps/assets/chunk-AEK57VVT-ClK8FMFn.js b/apps/assets/chunk-AEK57VVT-ClK8FMFn.js new file mode 100644 index 0000000000000000000000000000000000000000..b67e8980cf6e2e7ad6c2638c94923016c19fc78f --- /dev/null +++ b/apps/assets/chunk-AEK57VVT-ClK8FMFn.js @@ -0,0 +1,220 @@ +var Kt=Object.defineProperty;var qt=(e,t,s)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var k=(e,t,s)=>qt(e,typeof t!="symbol"?t+"":t,s);var M;import{g as Qt,s as Zt}from"./chunk-RZ5BOZE2-Dd93pMgt.js";import{_ as l,l as E,c as $,r as te,u as ee,R as se,j as U,y as ie,a as ne,b as re,g as ae,s as oe,p as ce,q as le}from"./mermaid-DwRBzUur.js";var mt=function(){var e=l(function(r,y,u,f){for(u=u||{},f=r.length;f--;u[r[f]]=y);return u},"o"),t=[1,2],s=[1,3],a=[1,4],o=[2,4],i=[1,9],g=[1,11],d=[1,16],c=[1,17],S=[1,18],b=[1,19],v=[1,32],F=[1,20],P=[1,21],L=[1,22],p=[1,23],I=[1,24],A=[1,26],Y=[1,27],G=[1,28],N=[1,29],R=[1,30],Q=[1,31],Z=[1,34],tt=[1,35],et=[1,36],st=[1,37],V=[1,33],m=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],it=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],Et=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],pt={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,classDef:38,CLASSDEF_ID:39,CLASSDEF_STYLEOPTS:40,DEFAULT:41,style:42,STYLE_IDS:43,STYLEDEF_STYLEOPTS:44,class:45,CLASSENTITY_IDS:46,STYLECLASS:47,direction_tb:48,direction_bt:49,direction_rl:50,direction_lr:51,eol:52,";":53,EDGE_STATE:54,STYLE_SEPARATOR:55,left_of:56,right_of:57,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"classDef",39:"CLASSDEF_ID",40:"CLASSDEF_STYLEOPTS",41:"DEFAULT",42:"style",43:"STYLE_IDS",44:"STYLEDEF_STYLEOPTS",45:"class",46:"CLASSENTITY_IDS",47:"STYLECLASS",48:"direction_tb",49:"direction_bt",50:"direction_rl",51:"direction_lr",53:";",54:"EDGE_STATE",55:"STYLE_SEPARATOR",56:"left_of",57:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[52,1],[52,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:l(function(r,y,u,f,_,n,W){var h=n.length-1;switch(_){case 3:return f.setRootDoc(n[h]),n[h];case 4:this.$=[];break;case 5:n[h]!="nl"&&(n[h-1].push(n[h]),this.$=n[h-1]);break;case 6:case 7:case 12:this.$=n[h];break;case 8:this.$="nl";break;case 13:const T=n[h-1];T.description=f.trimColon(n[h]),this.$=T;break;case 14:this.$={stmt:"relation",state1:n[h-2],state2:n[h]};break;case 15:const w=f.trimColon(n[h]);this.$={stmt:"relation",state1:n[h-3],state2:n[h-1],description:w};break;case 19:this.$={stmt:"state",id:n[h-3],type:"default",description:"",doc:n[h-1]};break;case 20:var j=n[h],X=n[h-2].trim();if(n[h].match(":")){var rt=n[h].split(":");j=rt[0],X=[X,rt[1]]}this.$={stmt:"state",id:j,type:"default",description:X};break;case 21:this.$={stmt:"state",id:n[h-3],type:"default",description:n[h-5],doc:n[h-1]};break;case 22:this.$={stmt:"state",id:n[h],type:"fork"};break;case 23:this.$={stmt:"state",id:n[h],type:"join"};break;case 24:this.$={stmt:"state",id:n[h],type:"choice"};break;case 25:this.$={stmt:"state",id:f.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:n[h-1].trim(),note:{position:n[h-2].trim(),text:n[h].trim()}};break;case 29:this.$=n[h].trim(),f.setAccTitle(this.$);break;case 30:case 31:this.$=n[h].trim(),f.setAccDescription(this.$);break;case 32:case 33:this.$={stmt:"classDef",id:n[h-1].trim(),classes:n[h].trim()};break;case 34:this.$={stmt:"style",id:n[h-1].trim(),styleClass:n[h].trim()};break;case 35:this.$={stmt:"applyClass",id:n[h-1].trim(),styleClass:n[h].trim()};break;case 36:f.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 37:f.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 38:f.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 39:f.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 42:case 43:this.$={stmt:"state",id:n[h].trim(),type:"default",description:""};break;case 44:case 45:this.$={stmt:"state",id:n[h-2].trim(),classes:[n[h].trim()],type:"default",description:""}}},"anonymous"),table:[{3:1,4:t,5:s,6:a},{1:[3]},{3:5,4:t,5:s,6:a},{3:6,4:t,5:s,6:a},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],o,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:i,5:g,8:8,9:10,10:12,11:13,12:14,13:15,16:d,17:c,19:S,22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,5]),{9:38,10:12,11:13,12:14,13:15,16:d,17:c,19:S,22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,7]),e(m,[2,8]),e(m,[2,9]),e(m,[2,10]),e(m,[2,11]),e(m,[2,12],{14:[1,39],15:[1,40]}),e(m,[2,16]),{18:[1,41]},e(m,[2,18],{20:[1,42]}),{23:[1,43]},e(m,[2,22]),e(m,[2,23]),e(m,[2,24]),e(m,[2,25]),{30:44,31:[1,45],56:[1,46],57:[1,47]},e(m,[2,28]),{34:[1,48]},{36:[1,49]},e(m,[2,31]),{39:[1,50],41:[1,51]},{43:[1,52]},{46:[1,53]},e(it,[2,42],{55:[1,54]}),e(it,[2,43],{55:[1,55]}),e(m,[2,36]),e(m,[2,37]),e(m,[2,38]),e(m,[2,39]),e(m,[2,6]),e(m,[2,13]),{13:56,24:v,54:V},e(m,[2,17]),e(Et,o,{7:57}),{24:[1,58]},{24:[1,59]},{23:[1,60]},{24:[2,46]},{24:[2,47]},e(m,[2,29]),e(m,[2,30]),{40:[1,61]},{40:[1,62]},{44:[1,63]},{47:[1,64]},{24:[1,65]},{24:[1,66]},e(m,[2,14],{14:[1,67]}),{4:i,5:g,8:8,9:10,10:12,11:13,12:14,13:15,16:d,17:c,19:S,21:[1,68],22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,20],{20:[1,69]}),{31:[1,70]},{24:[1,71]},e(m,[2,32]),e(m,[2,33]),e(m,[2,34]),e(m,[2,35]),e(it,[2,44]),e(it,[2,45]),e(m,[2,15]),e(m,[2,19]),e(Et,o,{7:72}),e(m,[2,26]),e(m,[2,27]),{4:i,5:g,8:8,9:10,10:12,11:13,12:14,13:15,16:d,17:c,19:S,21:[1,73],22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,21])],defaultActions:{5:[2,1],6:[2,2],46:[2,46],47:[2,47]},parseError:l(function(r,y){if(!y.recoverable){var u=new Error(r);throw u.hash=y,u}this.trace(r)},"parseError"),parse:l(function(r){var y=this,u=[0],f=[],_=[null],n=[],W=this.table,h="",j=0,X=0,rt=n.slice.call(arguments,1),T=Object.create(this.lexer),w={yy:{}};for(var yt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,yt)&&(w.yy[yt]=this.yy[yt]);T.setInput(r,w.yy),w.yy.lexer=T,w.yy.parser=this,T.yylloc===void 0&&(T.yylloc={});var gt=T.yylloc;n.push(gt);var Jt=T.options&&T.options.ranges;function Dt(){var C;return typeof(C=f.pop()||T.lex()||1)!="number"&&(C instanceof Array&&(C=(f=C).pop()),C=y.symbols_[C]||C),C}typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,l(function(C){u.length=u.length-2*C,_.length=_.length-C,n.length=n.length-C},"popStack"),l(Dt,"lex");for(var D,z,x,xt,at,O,Ct,ot,H={};;){if(z=u[u.length-1],this.defaultActions[z]?x=this.defaultActions[z]:(D==null&&(D=Dt()),x=W[z]&&W[z][D]),x===void 0||!x.length||!x[0]){var $t="";for(at in ot=[],W[z])this.terminals_[at]&&at>2&&ot.push("'"+this.terminals_[at]+"'");$t=T.showPosition?"Parse error on line "+(j+1)+`: +`+T.showPosition()+` +Expecting `+ot.join(", ")+", got '"+(this.terminals_[D]||D)+"'":"Parse error on line "+(j+1)+": Unexpected "+(D==1?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError($t,{text:T.match,token:this.terminals_[D]||D,line:T.yylineno,loc:gt,expected:ot})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+D);switch(x[0]){case 1:u.push(D),_.push(T.yytext),n.push(T.yylloc),u.push(x[1]),D=null,X=T.yyleng,h=T.yytext,j=T.yylineno,gt=T.yylloc;break;case 2:if(O=this.productions_[x[1]][1],H.$=_[_.length-O],H._$={first_line:n[n.length-(O||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(O||1)].first_column,last_column:n[n.length-1].last_column},Jt&&(H._$.range=[n[n.length-(O||1)].range[0],n[n.length-1].range[1]]),(xt=this.performAction.apply(H,[h,X,j,w.yy,x[1],_,n].concat(rt)))!==void 0)return xt;O&&(u=u.slice(0,-1*O*2),_=_.slice(0,-1*O),n=n.slice(0,-1*O)),u.push(this.productions_[x[1]][0]),_.push(H.$),n.push(H._$),Ct=W[u[u.length-2]][u[u.length-1]],u.push(Ct);break;case 3:return!0}}return!0},"parse")},Wt=function(){return{EOF:1,parseError:l(function(r,y){if(!this.yy.parser)throw new Error(r);this.yy.parser.parseError(r,y)},"parseError"),setInput:l(function(r,y){return this.yy=y||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:l(function(r){var y=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-y),this.offset-=y;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===f.length?this.yylloc.first_column:0)+f[f.length-u.length].length-u[0].length:this.yylloc.first_column-y},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-y]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:l(function(r){this.unput(this.match.slice(r))},"less"),pastInput:l(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var r=this.pastInput(),y=new Array(r.length+1).join("-");return r+this.upcomingInput()+` +`+y+"^"},"showPosition"),test_match:l(function(r,y){var u,f,_;if(this.options.backtrack_lexer&&(_={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(_.yylloc.range=this.yylloc.range.slice(0))),(f=r[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],u=this.performAction.call(this,this.yy,this,y,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var n in _)this[n]=_[n];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;var r,y,u,f;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),n=0;n<_.length;n++)if((u=this._input.match(this.rules[_[n]]))&&(!y||u[0].length>y[0].length)){if(y=u,f=n,this.options.backtrack_lexer){if((r=this.test_match(u,_[n]))!==!1)return r;if(this._backtrack){y=!1;continue}return!1}if(!this.options.flex)break}return y?(r=this.test_match(y,_[f]))!==!1&&r:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var r=this.next();return r||this.lex()},"lex"),begin:l(function(r){this.conditionStack.push(r)},"begin"),popState:l(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:l(function(r){return(r=this.conditionStack.length-1-Math.abs(r||0))>=0?this.conditionStack[r]:"INITIAL"},"topState"),pushState:l(function(r){this.begin(r)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(r,y,u,f){switch(u){case 0:return 41;case 1:case 42:return 48;case 2:case 43:return 49;case 3:case 44:return 50;case 4:case 45:return 51;case 5:case 6:case 8:case 9:case 10:case 11:case 54:case 56:case 62:break;case 7:case 77:return 5;case 12:case 32:return this.pushState("SCALE"),17;case 13:case 33:return 18;case 14:case 20:case 34:case 49:case 52:this.popState();break;case 15:return this.begin("acc_title"),33;case 16:return this.popState(),"acc_title_value";case 17:return this.begin("acc_descr"),35;case 18:return this.popState(),"acc_descr_value";case 19:this.begin("acc_descr_multiline");break;case 21:return"acc_descr_multiline_value";case 22:return this.pushState("CLASSDEF"),38;case 23:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 24:return this.popState(),this.pushState("CLASSDEFID"),39;case 25:return this.popState(),40;case 26:return this.pushState("CLASS"),45;case 27:return this.popState(),this.pushState("CLASS_STYLE"),46;case 28:return this.popState(),47;case 29:return this.pushState("STYLE"),42;case 30:return this.popState(),this.pushState("STYLEDEF_STYLES"),43;case 31:return this.popState(),44;case 35:this.pushState("STATE");break;case 36:case 39:return this.popState(),y.yytext=y.yytext.slice(0,-8).trim(),25;case 37:case 40:return this.popState(),y.yytext=y.yytext.slice(0,-8).trim(),26;case 38:case 41:return this.popState(),y.yytext=y.yytext.slice(0,-10).trim(),27;case 46:this.pushState("STATE_STRING");break;case 47:return this.pushState("STATE_ID"),"AS";case 48:case 64:return this.popState(),"ID";case 50:return"STATE_DESCR";case 51:return 19;case 53:return this.popState(),this.pushState("struct"),20;case 55:return this.popState(),21;case 57:return this.begin("NOTE"),29;case 58:return this.popState(),this.pushState("NOTE_ID"),56;case 59:return this.popState(),this.pushState("NOTE_ID"),57;case 60:this.popState(),this.pushState("FLOATING_NOTE");break;case 61:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 63:return"NOTE_TEXT";case 65:return this.popState(),this.pushState("NOTE_TEXT"),24;case 66:return this.popState(),y.yytext=y.yytext.substr(2).trim(),31;case 67:return this.popState(),y.yytext=y.yytext.slice(0,-8).trim(),31;case 68:case 69:return 6;case 70:return 16;case 71:return 54;case 72:return 24;case 73:return y.yytext=y.yytext.trim(),14;case 74:return 15;case 75:return 28;case 76:return 55;case 78:return"INVALID"}},"anonymous"),rules:[/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[9,10],inclusive:!1},struct:{rules:[9,10,22,26,29,35,42,43,44,45,54,55,56,57,71,72,73,74,75],inclusive:!1},FLOATING_NOTE_ID:{rules:[64],inclusive:!1},FLOATING_NOTE:{rules:[61,62,63],inclusive:!1},NOTE_TEXT:{rules:[66,67],inclusive:!1},NOTE_ID:{rules:[65],inclusive:!1},NOTE:{rules:[58,59,60],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[31],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[30],inclusive:!1},CLASS_STYLE:{rules:[28],inclusive:!1},CLASS:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[25],inclusive:!1},CLASSDEF:{rules:[23,24],inclusive:!1},acc_descr_multiline:{rules:[20,21],inclusive:!1},acc_descr:{rules:[18],inclusive:!1},acc_title:{rules:[16],inclusive:!1},SCALE:{rules:[13,14,33,34],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[48],inclusive:!1},STATE_STRING:{rules:[49,50],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[9,10,36,37,38,39,40,41,46,47,51,52,53],inclusive:!1},ID:{rules:[9,10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,10,11,12,15,17,19,22,26,29,32,35,53,57,68,69,70,71,72,73,74,76,77,78],inclusive:!0}}}}();function nt(){this.yy={}}return pt.lexer=Wt,l(nt,"Parser"),nt.prototype=pt,pt.Parser=nt,new nt}();mt.parser=mt;var he=mt,ct="state",St="relation",J="default",vt="divider",It="fill:none",Lt="fill: #333",At="text",wt="normal",ft="rect",_t="rectWithTitle",Ot="divider",Nt="roundedWithTitle",K="statediagram",de=`${K}-state`,Rt="transition",ue=`${Rt} note-edge`,pe=`${K}-note`,ye=`${K}-cluster`,ge=`${K}-cluster-alt`,Bt="parent",Ft="note",bt="----",me=`${bt}${Ft}`,Pt=`${bt}${Bt}`,Yt=l((e,t="TB")=>{if(!e.doc)return t;let s=t;for(const a of e.doc)a.stmt==="dir"&&(s=a.value);return s},"getDir"),Se={getClasses:l(function(e,t){return t.db.getClasses()},"getClasses"),draw:l(async function(e,t,s,a){E.info("REF0:"),E.info("Drawing state diagram (v2)",t);const{securityLevel:o,state:i,layout:g}=$();a.db.extract(a.db.getRootDocV2());const d=a.db.getData(),c=Qt(t,o);d.type=a.type,d.layoutAlgorithm=g,d.nodeSpacing=(i==null?void 0:i.nodeSpacing)||50,d.rankSpacing=(i==null?void 0:i.rankSpacing)||50,d.markers=["barb"],d.diagramId=t,await te(d,c),ee.insertTitle(c,"statediagramTitleText",(i==null?void 0:i.titleTopMargin)??25,a.db.getDiagramTitle()),Zt(c,8,K,(i==null?void 0:i.useMaxWidth)??!0)},"draw"),getDir:Yt},lt=new Map,B=0;function ht(e="",t=0,s="",a=bt){return`state-${e}${s!==null&&s.length>0?`${a}${s}`:""}-${t}`}l(ht,"stateDomId");var fe=l((e,t,s,a,o,i,g,d)=>{E.trace("items",t),t.forEach(c=>{switch(c.stmt){case ct:case J:dt(e,c,s,a,o,i,g,d);break;case St:{dt(e,c.state1,s,a,o,i,g,d),dt(e,c.state2,s,a,o,i,g,d);const S={id:"edge"+B,start:c.state1.id,end:c.state2.id,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:It,labelStyle:"",label:U.sanitizeText(c.description,$()),arrowheadStyle:Lt,labelpos:"c",labelType:At,thickness:wt,classes:Rt,look:g};o.push(S),B++}}})},"setupDoc"),Gt=l((e,t="TB")=>{let s=t;if(e.doc)for(const a of e.doc)a.stmt==="dir"&&(s=a.value);return s},"getDir");function q(e,t,s){if(!t.id||t.id===""||t.id==="")return;t.cssClasses&&(Array.isArray(t.cssCompiledStyles)||(t.cssCompiledStyles=[]),t.cssClasses.split(" ").forEach(o=>{if(s.get(o)){const i=s.get(o);t.cssCompiledStyles=[...t.cssCompiledStyles,...i.styles]}}));const a=e.find(o=>o.id===t.id);a?Object.assign(a,t):e.push(t)}function jt(e){var t;return((t=e==null?void 0:e.classes)==null?void 0:t.join(" "))??""}function zt(e){return(e==null?void 0:e.styles)??[]}l(q,"insertOrUpdateNode"),l(jt,"getClassesFromDbInfo"),l(zt,"getStylesFromDbInfo");var dt=l((e,t,s,a,o,i,g,d)=>{var F,P;const c=t.id,S=s.get(c),b=jt(S),v=zt(S);if(E.info("dataFetcher parsedItem",t,S,v),c!=="root"){let L=ft;t.start===!0?L="stateStart":t.start===!1&&(L="stateEnd"),t.type!==J&&(L=t.type),lt.get(c)||lt.set(c,{id:c,shape:L,description:U.sanitizeText(c,$()),cssClasses:`${b} ${de}`,cssStyles:v});const p=lt.get(c);t.description&&(Array.isArray(p.description)?(p.shape=_t,p.description.push(t.description)):((F=p.description)==null?void 0:F.length)>0?(p.shape=_t,p.description===c?p.description=[t.description]:p.description=[p.description,t.description]):(p.shape=ft,p.description=t.description),p.description=U.sanitizeTextOrArray(p.description,$())),((P=p.description)==null?void 0:P.length)===1&&p.shape===_t&&(p.type==="group"?p.shape=Nt:p.shape=ft),!p.type&&t.doc&&(E.info("Setting cluster for XCX",c,Gt(t)),p.type="group",p.isGroup=!0,p.dir=Gt(t),p.shape=t.type===vt?Ot:Nt,p.cssClasses=`${p.cssClasses} ${ye} ${i?ge:""}`);const I={labelStyle:"",shape:p.shape,label:p.description,cssClasses:p.cssClasses,cssCompiledStyles:[],cssStyles:p.cssStyles,id:c,dir:p.dir,domId:ht(c,B),type:p.type,isGroup:p.type==="group",padding:8,rx:10,ry:10,look:g};if(I.shape===Ot&&(I.label=""),e&&e.id!=="root"&&(E.trace("Setting node ",c," to be child of its parent ",e.id),I.parentId=e.id),I.centerLabel=!0,t.note){const A={labelStyle:"",shape:"note",label:t.note.text,cssClasses:pe,cssStyles:[],cssCompilesStyles:[],id:c+me+"-"+B,domId:ht(c,B,Ft),type:p.type,isGroup:p.type==="group",padding:$().flowchart.padding,look:g,position:t.note.position},Y=c+Pt,G={labelStyle:"",shape:"noteGroup",label:t.note.text,cssClasses:p.cssClasses,cssStyles:[],id:c+Pt,domId:ht(c,B,Bt),type:"group",isGroup:!0,padding:16,look:g,position:t.note.position};B++,G.id=Y,A.parentId=Y,q(a,G,d),q(a,A,d),q(a,I,d);let N=c,R=A.id;t.note.position==="left of"&&(N=A.id,R=c),o.push({id:N+"-"+R,start:N,end:R,arrowhead:"none",arrowTypeEnd:"",style:It,labelStyle:"",classes:ue,arrowheadStyle:Lt,labelpos:"c",labelType:At,thickness:wt,look:g})}else q(a,I,d)}t.doc&&(E.trace("Adding nodes children "),fe(t,t.doc,s,a,o,!i,g,d))},"dataFetcher"),_e=l(()=>{lt.clear(),B=0},"reset"),Tt="[*]",Ut="start",Mt=Tt,Xt="color",Ht="fill";function kt(){return new Map}l(kt,"newClassesList");var Vt=l(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),ut=l(e=>JSON.parse(JSON.stringify(e)),"clone"),be=(M=class{constructor(t){k(this,"version");k(this,"nodes",[]);k(this,"edges",[]);k(this,"rootDoc",[]);k(this,"classes",kt());k(this,"documents",{root:Vt()});k(this,"currentDocument",this.documents.root);k(this,"startEndCount",0);k(this,"dividerCnt",0);k(this,"getAccTitle",ne);k(this,"setAccTitle",re);k(this,"getAccDescription",ae);k(this,"setAccDescription",oe);k(this,"setDiagramTitle",ce);k(this,"getDiagramTitle",le);this.clear(),this.version=t,this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this)}setRootDoc(t){E.info("Setting root doc",t),this.rootDoc=t,this.version===1?this.extract(t):this.extract(this.getRootDocV2())}getRootDoc(){return this.rootDoc}docTranslator(t,s,a){if(s.stmt===St)this.docTranslator(t,s.state1,!0),this.docTranslator(t,s.state2,!1);else if(s.stmt===ct&&(s.id==="[*]"?(s.id=a?t.id+"_start":t.id+"_end",s.start=a):s.id=s.id.trim()),s.doc){const o=[];let i,g=[];for(i=0;i0&&g.length>0){const d={stmt:ct,id:se(),type:"divider",doc:ut(g)};o.push(ut(d)),s.doc=o}s.doc.forEach(d=>this.docTranslator(s,d,!0))}}getRootDocV2(){return this.docTranslator({id:"root"},{id:"root",doc:this.rootDoc},!0),{id:"root",doc:this.rootDoc}}extract(t){let s;s=t.doc?t.doc:t,E.info(s),this.clear(!0),E.info("Extract initial document:",s),s.forEach(i=>{switch(E.warn("Statement",i.stmt),i.stmt){case ct:this.addState(i.id.trim(),i.type,i.doc,i.description,i.note,i.classes,i.styles,i.textStyles);break;case St:this.addRelation(i.state1,i.state2,i.description);break;case"classDef":this.addStyleClass(i.id.trim(),i.classes);break;case"style":{const g=i.id.trim().split(","),d=i.styleClass.split(",");g.forEach(c=>{let S=this.getState(c);if(S===void 0){const b=c.trim();this.addState(b),S=this.getState(b)}S.styles=d.map(b=>{var v;return(v=b.replace(/;/g,""))==null?void 0:v.trim()})})}break;case"applyClass":this.setCssClass(i.id.trim(),i.styleClass)}});const a=this.getStates(),o=$().look;_e(),dt(void 0,this.getRootDocV2(),a,this.nodes,this.edges,!0,o,this.classes),this.nodes.forEach(i=>{if(Array.isArray(i.label)){if(i.description=i.label.slice(1),i.isGroup&&i.description.length>0)throw new Error("Group nodes can only have label. Remove the additional description for node ["+i.id+"]");i.label=i.label[0]}})}addState(t,s=J,a=null,o=null,i=null,g=null,d=null,c=null){const S=t==null?void 0:t.trim();if(this.currentDocument.states.has(S)?(this.currentDocument.states.get(S).doc||(this.currentDocument.states.get(S).doc=a),this.currentDocument.states.get(S).type||(this.currentDocument.states.get(S).type=s)):(E.info("Adding state ",S,o),this.currentDocument.states.set(S,{id:S,descriptions:[],type:s,doc:a,note:i,classes:[],styles:[],textStyles:[]})),o&&(E.info("Setting state description",S,o),typeof o=="string"&&this.addDescription(S,o.trim()),typeof o=="object"&&o.forEach(b=>this.addDescription(S,b.trim()))),i){const b=this.currentDocument.states.get(S);b.note=i,b.note.text=U.sanitizeText(b.note.text,$())}g&&(E.info("Setting state classes",S,g),(typeof g=="string"?[g]:g).forEach(b=>this.setCssClass(S,b.trim()))),d&&(E.info("Setting state styles",S,d),(typeof d=="string"?[d]:d).forEach(b=>this.setStyle(S,b.trim()))),c&&(E.info("Setting state styles",S,d),(typeof c=="string"?[c]:c).forEach(b=>this.setTextStyle(S,b.trim())))}clear(t){this.nodes=[],this.edges=[],this.documents={root:Vt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=kt(),t||ie()}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){E.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}startIdIfNeeded(t=""){let s=t;return t===Tt&&(this.startEndCount++,s=`${Ut}${this.startEndCount}`),s}startTypeIfNeeded(t="",s=J){return t===Tt?Ut:s}endIdIfNeeded(t=""){let s=t;return t===Mt&&(this.startEndCount++,s=`end${this.startEndCount}`),s}endTypeIfNeeded(t="",s=J){return t===Mt?"end":s}addRelationObjs(t,s,a){let o=this.startIdIfNeeded(t.id.trim()),i=this.startTypeIfNeeded(t.id.trim(),t.type),g=this.startIdIfNeeded(s.id.trim()),d=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(o,i,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(g,d,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:o,id2:g,relationTitle:U.sanitizeText(a,$())})}addRelation(t,s,a){if(typeof t=="object")this.addRelationObjs(t,s,a);else{const o=this.startIdIfNeeded(t.trim()),i=this.startTypeIfNeeded(t),g=this.endIdIfNeeded(s.trim()),d=this.endTypeIfNeeded(s);this.addState(o,i),this.addState(g,d),this.currentDocument.relations.push({id1:o,id2:g,title:U.sanitizeText(a,$())})}}addDescription(t,s){const a=this.currentDocument.states.get(t),o=s.startsWith(":")?s.replace(":","").trim():s;a.descriptions.push(U.sanitizeText(o,$()))}cleanupLabel(t){return t.substring(0,1)===":"?t.substr(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,"divider-id-"+this.dividerCnt}addStyleClass(t,s=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const a=this.classes.get(t);s!=null&&s.split(",").forEach(o=>{const i=o.replace(/([^;]*);/,"$1").trim();if(RegExp(Xt).exec(o)){const g=i.replace(Ht,"bgFill").replace(Xt,Ht);a.textStyles.push(g)}a.styles.push(i)})}getClasses(){return this.classes}setCssClass(t,s){t.split(",").forEach(a=>{let o=this.getState(a);if(o===void 0){const i=a.trim();this.addState(i),o=this.getState(i)}o.classes.push(s)})}setStyle(t,s){const a=this.getState(t);a!==void 0&&a.styles.push(s)}setTextStyle(t,s){const a=this.getState(t);a!==void 0&&a.textStyles.push(s)}getDirectionStatement(){return this.rootDoc.find(t=>t.stmt==="dir")}getDirection(){var t;return((t=this.getDirectionStatement())==null?void 0:t.value)??"TB"}setDirection(t){const s=this.getDirectionStatement();s?s.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t&&t[0]===":"?t.substr(1).trim():t.trim()}getData(){const t=$();return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:Yt(this.getRootDocV2())}}getConfig(){return $().state}},l(M,"StateDB"),k(M,"relationType",{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}),M),Te=l(e=>` +defs #statediagram-barbEnd { + fill: ${e.transitionColor}; + stroke: ${e.transitionColor}; + } +g.stateGroup text { + fill: ${e.nodeBorder}; + stroke: none; + font-size: 10px; +} +g.stateGroup text { + fill: ${e.textColor}; + stroke: none; + font-size: 10px; + +} +g.stateGroup .state-title { + font-weight: bolder; + fill: ${e.stateLabelColor}; +} + +g.stateGroup rect { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; +} + +g.stateGroup line { + stroke: ${e.lineColor}; + stroke-width: 1; +} + +.transition { + stroke: ${e.transitionColor}; + stroke-width: 1; + fill: none; +} + +.stateGroup .composit { + fill: ${e.background}; + border-bottom: 1px +} + +.stateGroup .alt-composit { + fill: #e0e0e0; + border-bottom: 1px +} + +.state-note { + stroke: ${e.noteBorderColor}; + fill: ${e.noteBkgColor}; + + text { + fill: ${e.noteTextColor}; + stroke: none; + font-size: 10px; + } +} + +.stateLabel .box { + stroke: none; + stroke-width: 0; + fill: ${e.mainBkg}; + opacity: 0.5; +} + +.edgeLabel .label rect { + fill: ${e.labelBackgroundColor}; + opacity: 0.5; +} +.edgeLabel { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; +} +.edgeLabel .label text { + fill: ${e.transitionLabelColor||e.tertiaryTextColor}; +} +.label div .edgeLabel { + color: ${e.transitionLabelColor||e.tertiaryTextColor}; +} + +.stateLabel text { + fill: ${e.stateLabelColor}; + font-size: 10px; + font-weight: bold; +} + +.node circle.state-start { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node .fork-join { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node circle.state-end { + fill: ${e.innerEndBackground}; + stroke: ${e.background}; + stroke-width: 1.5 +} +.end-state-inner { + fill: ${e.compositeBackground||e.background}; + // stroke: ${e.background}; + stroke-width: 1.5 +} + +.node rect { + fill: ${e.stateBkg||e.mainBkg}; + stroke: ${e.stateBorder||e.nodeBorder}; + stroke-width: 1px; +} +.node polygon { + fill: ${e.mainBkg}; + stroke: ${e.stateBorder||e.nodeBorder};; + stroke-width: 1px; +} +#statediagram-barbEnd { + fill: ${e.lineColor}; +} + +.statediagram-cluster rect { + fill: ${e.compositeTitleBackground}; + stroke: ${e.stateBorder||e.nodeBorder}; + stroke-width: 1px; +} + +.cluster-label, .nodeLabel { + color: ${e.stateLabelColor}; + // line-height: 1; +} + +.statediagram-cluster rect.outer { + rx: 5px; + ry: 5px; +} +.statediagram-state .divider { + stroke: ${e.stateBorder||e.nodeBorder}; +} + +.statediagram-state .title-state { + rx: 5px; + ry: 5px; +} +.statediagram-cluster.statediagram-cluster .inner { + fill: ${e.compositeBackground||e.background}; +} +.statediagram-cluster.statediagram-cluster-alt .inner { + fill: ${e.altBackground?e.altBackground:"#efefef"}; +} + +.statediagram-cluster .inner { + rx:0; + ry:0; +} + +.statediagram-state rect.basic { + rx: 5px; + ry: 5px; +} +.statediagram-state rect.divider { + stroke-dasharray: 10,10; + fill: ${e.altBackground?e.altBackground:"#efefef"}; +} + +.note-edge { + stroke-dasharray: 5; +} + +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} + +.statediagram-note text { + fill: ${e.noteTextColor}; +} + +.statediagram-note .nodeLabel { + color: ${e.noteTextColor}; +} +.statediagram .edgeLabel { + color: red; // ${e.noteTextColor}; +} + +#dependencyStart, #dependencyEnd { + fill: ${e.lineColor}; + stroke: ${e.lineColor}; + stroke-width: 1; +} + +.statediagramTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; +} +`,"getStyles");export{be as S,he as a,Se as b,Te as s}; diff --git a/apps/assets/chunk-D6G4REZN-BESp3t-9.js b/apps/assets/chunk-D6G4REZN-BESp3t-9.js new file mode 100644 index 0000000000000000000000000000000000000000..5020268ee4dff53866a3cb715d3834b74076f655 --- /dev/null +++ b/apps/assets/chunk-D6G4REZN-BESp3t-9.js @@ -0,0 +1 @@ +import{_ as n,m as o,i as c}from"./mermaid-DwRBzUur.js";var i=n((a,t)=>{const r=a.append("rect");if(r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),t.name&&r.attr("name",t.name),t.rx&&r.attr("rx",t.rx),t.ry&&r.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)r.attr(s,t.attrs[s]);return t.class&&r.attr("class",t.class),r},"drawRect"),l=n((a,t)=>{const r={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};i(a,r).lower()},"drawBackgroundRect"),d=n((a,t)=>{const r=t.text.replace(o," "),s=a.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const e=s.append("tspan");return e.attr("x",t.x+2*t.textMargin),e.text(r),s},"drawText"),h=n((a,t,r,s)=>{const e=a.append("image");e.attr("x",t),e.attr("y",r);const x=c.sanitizeUrl(s);e.attr("xlink:href",x)},"drawImage"),y=n((a,t,r,s)=>{const e=a.append("use");e.attr("x",t),e.attr("y",r);const x=c.sanitizeUrl(s);e.attr("xlink:href",`#${x}`)},"drawEmbeddedImage"),p=n(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),g=n(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj");export{l as a,g as b,y as c,i as d,h as e,d as f,p as g}; diff --git a/apps/assets/chunk-RZ5BOZE2-Dd93pMgt.js b/apps/assets/chunk-RZ5BOZE2-Dd93pMgt.js new file mode 100644 index 0000000000000000000000000000000000000000..772b7f5aad812a4634dc85ce20d3d5a9173866fe --- /dev/null +++ b/apps/assets/chunk-RZ5BOZE2-Dd93pMgt.js @@ -0,0 +1 @@ +import{_ as s,d as c,l as x}from"./mermaid-DwRBzUur.js";import{s as r}from"./transform-DetRMEbJ.js";var m=s((t,e)=>{let i;return e==="sandbox"&&(i=r("#i"+t)),r(e==="sandbox"?i.nodes()[0].contentDocument.body:"body").select(`[id="${t}"]`)},"getDiagramElement"),w=s((t,e,i,o)=>{t.attr("class",i);const{width:a,height:d,x:h,y:g}=l(t,e);c(t,d,a,o);const n=u(h,g,a,d,e);t.attr("viewBox",n),x.debug(`viewBox configured: ${n} with padding: ${e}`)},"setupViewPortForSVG"),l=s((t,e)=>{var o;const i=((o=t.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+2*e,height:i.height+2*e,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),u=s((t,e,i,o,a)=>`${t-a} ${e-a} ${i} ${o}`,"createViewBox");export{m as g,w as s}; diff --git a/apps/assets/chunk-XZIHB7SX-80AOfzmu.js b/apps/assets/chunk-XZIHB7SX-80AOfzmu.js new file mode 100644 index 0000000000000000000000000000000000000000..7ef71b09c9d33e0d2fa978ade89bc472396f9bb9 --- /dev/null +++ b/apps/assets/chunk-XZIHB7SX-80AOfzmu.js @@ -0,0 +1 @@ +var t;import{_ as s}from"./mermaid-DwRBzUur.js";var r=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{r as I}; diff --git a/apps/assets/circle-play-ClvgvQfO.js b/apps/assets/circle-play-ClvgvQfO.js new file mode 100644 index 0000000000000000000000000000000000000000..fdce53ffeaf6eed9c74fdbfa7bc276cd5ea1a0e9 --- /dev/null +++ b/apps/assets/circle-play-ClvgvQfO.js @@ -0,0 +1,6 @@ +import{u as c}from"./index-DgI7bmFZ.js";/** + * @license lucide-react v0.503.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o=c("circle-play",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);export{o as C}; diff --git a/apps/assets/classDiagram-GIVACNV2-DLrZBtuR.js b/apps/assets/classDiagram-GIVACNV2-DLrZBtuR.js new file mode 100644 index 0000000000000000000000000000000000000000..95a30bd1889c38c0fb157e4314a21e557a0fa7b0 --- /dev/null +++ b/apps/assets/classDiagram-GIVACNV2-DLrZBtuR.js @@ -0,0 +1 @@ +import{s as a,c as s,a as t,C as o}from"./chunk-A2AXSNBT-LRmUxR_u.js";import{_ as e}from"./mermaid-DwRBzUur.js";import"./transform-DetRMEbJ.js";import"./chunk-RZ5BOZE2-Dd93pMgt.js";import"./index-DgI7bmFZ.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var i={parser:t,get db(){return new o},renderer:s,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{i as diagram}; diff --git a/apps/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js b/apps/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js new file mode 100644 index 0000000000000000000000000000000000000000..95a30bd1889c38c0fb157e4314a21e557a0fa7b0 --- /dev/null +++ b/apps/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js @@ -0,0 +1 @@ +import{s as a,c as s,a as t,C as o}from"./chunk-A2AXSNBT-LRmUxR_u.js";import{_ as e}from"./mermaid-DwRBzUur.js";import"./transform-DetRMEbJ.js";import"./chunk-RZ5BOZE2-Dd93pMgt.js";import"./index-DgI7bmFZ.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var i={parser:t,get db(){return new o},renderer:s,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{i as diagram}; diff --git a/apps/assets/clike-BgBwzOhw.js b/apps/assets/clike-BgBwzOhw.js new file mode 100644 index 0000000000000000000000000000000000000000..1e7f7e690ddb75d5624c7fad0485f49edc0b3df1 --- /dev/null +++ b/apps/assets/clike-BgBwzOhw.js @@ -0,0 +1 @@ +function O(e,t,n,l,u,d){this.indented=e,this.column=t,this.type=n,this.info=l,this.align=u,this.prev=d}function z(e,t,n,l){var u=e.indented;return e.context&&e.context.type=="statement"&&n!="statement"&&(u=e.context.indented),e.context=new O(u,t,n,l,null,e.context)}function _(e){var t=e.context.type;return t!=")"&&t!="]"&&t!="}"||(e.indented=e.context.indented),e.context=e.context.prev}function Q(e,t,n){return t.prevToken=="variable"||t.prevToken=="type"||!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0}function j(e){for(;;){if(!e||e.type=="top")return!0;if(e.type=="}"&&e.prev.info!="namespace")return!1;e=e.prev}}function f(e){var t,n,l=e.statementIndentUnit,u=e.dontAlignCalls,d=e.keywords||{},m=e.types||{},h=e.builtin||{},v=e.blockKeywords||{},C=e.defKeywords||{},U=e.atoms||{},w=e.hooks||{},oe=e.multiLineStrings,le=e.indentStatements!==!1,se=e.indentSwitch!==!1,$=e.namespaceSeparator,ce=e.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,ue=e.numberStart||/[\d\.]/,de=e.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,B=e.isOperatorChar||/[+\-*&%=<>!?|\/]/,K=e.isIdentifierChar||/[\w\$_\xa1-\uffff]/,q=e.isReservedIdentifier||!1;function V(i,o){var s,a=i.next();if(w[a]){var y=w[a](i,o);if(y!==!1)return y}if(a=='"'||a=="'")return o.tokenize=(s=a,function(I,P){for(var R,D=!1,Z=!1;(R=I.next())!=null;){if(R==s&&!D){Z=!0;break}D=!D&&R=="\\"}return(Z||!D&&!oe)&&(P.tokenize=null),"string"}),o.tokenize(i,o);if(ue.test(a)){if(i.backUp(1),i.match(de))return"number";i.next()}if(ce.test(a))return t=a,null;if(a=="/"){if(i.eat("*"))return o.tokenize=W,W(i,o);if(i.eat("/"))return i.skipToEnd(),"comment"}if(B.test(a)){for(;!i.match(/^\/[\/*]/,!1)&&i.eat(B););return"operator"}if(i.eatWhile(K),$)for(;i.match($);)i.eatWhile(K);var p=i.current();return g(d,p)?(g(v,p)&&(t="newstatement"),g(C,p)&&(n=!0),"keyword"):g(m,p)?"type":g(h,p)||q&&q(p)?(g(v,p)&&(t="newstatement"),"builtin"):g(U,p)?"atom":"variable"}function W(i,o){for(var s,a=!1;s=i.next();){if(s=="/"&&a){o.tokenize=null;break}a=s=="*"}return"comment"}function G(i,o){e.typeFirstDefinitions&&i.eol()&&j(o.context)&&(o.typeAtEndOfLine=Q(i,o,i.pos))}return{name:e.name,startState:function(i){return{tokenize:null,context:new O(-i,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(i,o){var s=o.context;if(i.sol()&&(s.align==null&&(s.align=!1),o.indented=i.indentation(),o.startOfLine=!0),i.eatSpace())return G(i,o),null;t=n=null;var a=(o.tokenize||V)(i,o);if(a=="comment"||a=="meta")return a;if(s.align==null&&(s.align=!0),t==";"||t==":"||t==","&&i.match(/^\s*(?:\/\/.*)?$/,!1))for(;o.context.type=="statement";)_(o);else if(t=="{")z(o,i.column(),"}");else if(t=="[")z(o,i.column(),"]");else if(t=="(")z(o,i.column(),")");else if(t=="}"){for(;s.type=="statement";)s=_(o);for(s.type=="}"&&(s=_(o));s.type=="statement";)s=_(o)}else t==s.type?_(o):le&&((s.type=="}"||s.type=="top")&&t!=";"||s.type=="statement"&&t=="newstatement")&&z(o,i.column(),"statement",i.current());if(a=="variable"&&(o.prevToken=="def"||e.typeFirstDefinitions&&Q(i,o,i.start)&&j(o.context)&&i.match(/^\s*\(/,!1))&&(a="def"),w.token){var y=w.token(i,o,a);y!==void 0&&(a=y)}return a=="def"&&e.styleDefs===!1&&(a="variable"),o.startOfLine=!1,o.prevToken=n?"def":a||t,G(i,o),a},indent:function(i,o,s){if(i.tokenize!=V&&i.tokenize!=null||i.typeAtEndOfLine&&j(i.context))return null;var a=i.context,y=o&&o.charAt(0),p=y==a.type;if(a.type=="statement"&&y=="}"&&(a=a.prev),e.dontIndentStatements)for(;a.type=="statement"&&e.dontIndentStatements.test(a.info);)a=a.prev;if(w.indent){var I=w.indent(i,a,o,s.unit);if(typeof I=="number")return I}var P=a.prev&&a.prev.info=="switch";if(e.allmanIndentation&&/[{(]/.test(y)){for(;a.type!="top"&&a.type!="}";)a=a.prev;return a.indented}return a.type=="statement"?a.indented+(y=="{"?0:l||s.unit):!a.align||u&&a.type==")"?a.type!=")"||p?a.indented+(p?0:s.unit)+(p||!P||/^(?:case|default)\b/.test(o)?0:s.unit):a.indented+(l||s.unit):a.column+(p?0:1)},languageData:{indentOnInput:se?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}},autocomplete:Object.keys(d).concat(Object.keys(m)).concat(Object.keys(h)).concat(Object.keys(U)),...e.languageData}}}function r(e){for(var t={},n=e.split(" "),l=0;l!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=re,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"character":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(e,t){var n=t.context;return!(n.type!="}"||!n.align||!e.eat(">"))&&(t.context=new O(n.indented,n.column,n.type,n.info,null,n.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=N(1),t.tokenize(e,t))}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),be=f({name:"kotlin",keywords:r("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:r("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:r("catch class do else finally for if where try while enum"),defKeywords:r("class val var object interface fun"),atoms:r("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,t){return t.prevToken=="."?"variable":"operator"},'"':function(e,t){var n;return t.tokenize=(n=e.match('""'),function(l,u){for(var d,m=!1,h=!1;!l.eol();){if(!n&&!m&&l.match('"')){h=!0;break}if(n&&l.match('"""')){h=!0;break}d=l.next(),!m&&d=="$"&&l.match("{")&&l.skipTo("}"),m=!m&&d=="\\"&&!n}return!h&&n||(u.tokenize=null),"string"}),t.tokenize(e,t)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=N(1),t.tokenize(e,t))},indent:function(e,t,n,l){var u=n&&n.charAt(0);return e.prevToken!="}"&&e.prevToken!=")"||n!=""?e.prevToken=="operator"&&n!="}"&&e.context.type!="}"||e.prevToken=="variable"&&u=="."||(e.prevToken=="}"||e.prevToken==")")&&u=="."?2*l+t.indented:t.align&&t.type=="}"?t.indented+(e.context.type==(n||"").charAt(0)?0:l):void 0:e.indented}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),ve=f({name:"shader",keywords:r("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:r("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:r("for while do if else struct"),builtin:r("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:r("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":k}}),we=f({name:"nesc",keywords:r(x+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:S,blockKeywords:r(T),atoms:r("null true false"),hooks:{"#":k}}),_e=f({name:"objectivec",keywords:r(x+" "+Y),types:J,builtin:r(H),blockKeywords:r(T+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:r(L+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:E,hooks:{"#":k,"*":M}}),xe=f({name:"objectivecpp",keywords:r(x+" "+Y+" "+X),types:J,builtin:r(H),blockKeywords:r(T+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:r(L+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:E,hooks:{"#":k,"*":M,u:b,U:b,L:b,R:b,0:c,1:c,2:c,3:c,4:c,5:c,6:c,7:c,8:c,9:c,token:function(e,t,n){if(n=="variable"&&e.peek()=="("&&(t.prevToken==";"||t.prevToken==null||t.prevToken=="}")&&ee(e.current()))return"def"}},namespaceSeparator:"::"}),Se=f({name:"squirrel",keywords:r("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:S,blockKeywords:r("case catch class else for foreach if switch try while"),defKeywords:r("function local class"),typeFirstDefinitions:!0,atoms:r("true false null"),hooks:{"#":k}});var F=null;function ae(e){return function(t,n){for(var l,u=!1,d=!1;!t.eol();){if(!u&&t.match('"')&&(e=="single"||t.match('""'))){d=!0;break}if(!u&&t.match("``")){F=ae(e),d=!0;break}l=t.next(),u=e=="single"&&!u&&l=="\\"}return d&&(n.tokenize=null),"string"}}const Te=f({name:"ceylon",keywords:r("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:r("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:r("class dynamic function interface module object package value"),builtin:r("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:r("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=ae(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!F||!e.match("`"))&&(t.tokenize=F,F=null,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"string.special":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},token:function(e,t,n){if((n=="variable"||n=="type")&&t.prevToken==".")return"variableName.special"}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function Ne(e){(e.interpolationStack||(e.interpolationStack=[])).push(e.tokenize)}function ie(e){return(e.interpolationStack||(e.interpolationStack=[])).pop()}function A(e,t,n,l){var u=!1;if(t.eat(e)){if(!t.eat(e))return"string";u=!0}function d(m,h){for(var v=!1;!m.eol();){if(!l&&!v&&m.peek()=="$")return Ne(h),h.tokenize=Ce,"string";var C=m.next();if(C==e&&!v&&(!u||m.match(e+e))){h.tokenize=null;break}v=!l&&!v&&C=="\\"}return"string"}return n.tokenize=d,d(t,n)}function Ce(e,t){return e.eat("$"),e.eat("{")?t.tokenize=null:t.tokenize=Ie,null}function Ie(e,t){return e.eatWhile(/[\w_]/),t.tokenize=ie(t),"variable"}const De=f({name:"dart",keywords:r("this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline"),blockKeywords:r("try catch finally do else for if switch while"),builtin:r("void bool num int double dynamic var String Null Never"),atoms:r("true false null"),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_\.]/),"meta"},"'":function(e,t){return A("'",e,t,!1)},'"':function(e,t){return A('"',e,t,!1)},r:function(e,t){var n=e.peek();return(n=="'"||n=='"')&&A(e.next(),e,t,!0)},"}":function(e,t){return function(n){return n.interpolationStack?n.interpolationStack.length:0}(t)>0&&(t.tokenize=ie(t),null)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=N(1),t.tokenize(e,t))},token:function(e,t,n){if(n=="variable"&&RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g").test(e.current()))return"type"}}});export{me as c,Te as ceylon,f as clike,he as cpp,ge as csharp,De as dart,ye as java,be as kotlin,we as nesC,_e as objectiveC,xe as objectiveCpp,ke as scala,ve as shader,Se as squirrel}; diff --git a/apps/assets/clojure-DiuoqK-z.js b/apps/assets/clojure-DiuoqK-z.js new file mode 100644 index 0000000000000000000000000000000000000000..fee670dc1f867f44b2d30640b2bd74c5a950f769 --- /dev/null +++ b/apps/assets/clojure-DiuoqK-z.js @@ -0,0 +1 @@ +var d=["false","nil","true"],l=[".","catch","def","do","if","monitor-enter","monitor-exit","new","quote","recur","set!","throw","try","var"],u=["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Inst","StackTraceElement->vec","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","any?","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","case","cast","cat","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","indexed?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seqable?","seque","sequence","sequential?","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","uri?","use","uuid?","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"],p=o(d),m=o(l),f=o(u),h=o(["->","->>","as->","binding","bound-fn","case","catch","comment","cond","cond->","cond->>","condp","def","definterface","defmethod","defn","defmacro","defprotocol","defrecord","defstruct","deftype","do","doseq","dotimes","doto","extend","extend-protocol","extend-type","fn","for","future","if","if-let","if-not","if-some","let","letfn","locking","loop","ns","proxy","reify","struct-map","some->","some->>","try","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn"]),y=/^(?:[\\\[\]\s"(),;@^`{}~]|$)/,b=/^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/,g=/^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/,k=/^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;function i(t,e){if(t.eatSpace()||t.eat(","))return["space",null];if(t.match(b))return[null,"number"];if(t.match(g))return[null,"string.special"];if(t.eat(/^"/))return(e.tokenize=v)(t,e);if(t.eat(/^[(\[{]/))return["open","bracket"];if(t.eat(/^[)\]}]/))return["close","bracket"];if(t.eat(/^;/))return t.skipToEnd(),["space","comment"];if(t.eat(/^[#'@^`~]/))return[null,"meta"];var r=t.match(k),n=r&&r[0];return n?n==="comment"&&e.lastToken==="("?(e.tokenize=x)(t,e):a(n,p)||n.charAt(0)===":"?["symbol","atom"]:a(n,m)||a(n,f)?["symbol","keyword"]:e.lastToken==="("?["symbol","builtin"]:["symbol","variable"]:(t.next(),t.eatWhile(function(s){return!a(s,y)}),[null,"error"])}function v(t,e){for(var r,n=!1;r=t.next();){if(r==='"'&&!n){e.tokenize=i;break}n=!n&&r==="\\"}return[null,"string"]}function x(t,e){for(var r,n=1;r=t.next();)if(r===")"&&n--,r==="("&&n++,n===0){t.backUp(1),e.tokenize=i;break}return["space","comment"]}function o(t){for(var e={},r=0;r >= "),I={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,symbol:/[\w*+\-]/};const G={name:"cobol",startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(E,R){if(R.indentStack==null&&E.sol()&&(R.indentation=6),E.eatSpace())return null;var T=null;if(R.mode==="string"){for(var A=!1;(A=E.next())!=null;)if((A=='"'||A=="'")&&!E.match(/['"]/,!1)){R.mode=!1;break}T=S}else{var L=E.next(),O=E.column();if(O>=0&&O<=5)T="def";else if(O>=72&&O<=79)E.skipToEnd(),T="header";else if(L=="*"&&O==6)E.skipToEnd(),T="comment";else if(L=='"'||L=="'")R.mode="string",T=S;else if(L!="'"||I.digit_or_colon.test(E.peek()))if(L==".")T="link";else if(function(C,N){return C==="0"&&N.eat(/x/i)?(N.eatWhile(I.hex),!0):(C!="+"&&C!="-"||!I.digit.test(N.peek())||(N.eat(I.sign),C=N.next()),!!I.digit.test(C)&&(N.eat(C),N.eatWhile(I.digit),N.peek()=="."&&(N.eat("."),N.eatWhile(I.digit)),N.eat(I.exponent)&&(N.eat(I.sign),N.eatWhile(I.digit)),!0))}(L,E))T="number";else{if(E.current().match(I.symbol))for(;O<71&&E.eat(I.symbol)!==void 0;)O++;T=M&&M.propertyIsEnumerable(E.current().toUpperCase())?"keyword":e&&e.propertyIsEnumerable(E.current().toUpperCase())?"builtin":P&&P.propertyIsEnumerable(E.current().toUpperCase())?U:null}else T=U}return T},indent:function(E){return E.indentStack==null?E.indentation:E.indentStack.indent}};export{G as cobol}; diff --git a/apps/assets/coffeescript-BTDxI-eT.js b/apps/assets/coffeescript-BTDxI-eT.js new file mode 100644 index 0000000000000000000000000000000000000000..98cccb9eb4dd4c6297a0ab94aef186fa417d59af --- /dev/null +++ b/apps/assets/coffeescript-BTDxI-eT.js @@ -0,0 +1 @@ +var m="error";function s(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var k=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,g=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,h=/^[_A-Za-z$][_A-Za-z$0-9]*/,y=/^@[_A-Za-z$][_A-Za-z$0-9]*/,z=s(["and","or","not","is","isnt","in","instanceof","typeof"]),u=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],b=s(u.concat(["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"]));u=s(u);var x=/^('{3}|\"{3}|['\"])/,w=/^(\/{3}|\/)/,A=s(["Infinity","NaN","undefined","null","true","false","on","off","yes","no"]);function p(e,n){if(e.sol()){n.scope.align===null&&(n.scope.align=!1);var o=n.scope.offset;if(e.eatSpace()){var t=e.indentation();return t>o&&n.scope.type=="coffee"?"indent":t0&&d(e,n)}if(e.eatSpace())return null;var c=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return n.tokenize=O,n.tokenize(e,n);if(c==="#")return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var r=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^-?\d+\.\d*/)&&(r=!0),e.match(/^-?\.\d+/)&&(r=!0),r)return e.peek()=="."&&e.backUp(1),"number";var i=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(i=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(i=!0),e.match(/^-?0(?![\dx])/i)&&(i=!0),i)return"number"}if(e.match(x))return n.tokenize=v(e.current(),!1,"string"),n.tokenize(e,n);if(e.match(w)){if(e.current()!="/"||e.match(/^.*\//,!1))return n.tokenize=v(e.current(),!0,"string.special"),n.tokenize(e,n);e.backUp(1)}return e.match(k)||e.match(z)?"operator":e.match(g)?"punctuation":e.match(A)?"atom":e.match(y)||n.prop&&e.match(h)?"property":e.match(b)?"keyword":e.match(h)?"variable":(e.next(),m)}function v(e,n,o){return function(t,c){for(;!t.eol();)if(t.eatWhile(/[^'"\/\\]/),t.eat("\\")){if(t.next(),n&&t.eol())return o}else{if(t.match(e))return c.tokenize=p,o;t.eat(/['"\/]/)}return n&&(c.tokenize=p),o}}function O(e,n){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){n.tokenize=p;break}e.eatWhile("#")}return"comment"}function l(e,n,o="coffee"){for(var t=0,c=!1,r=null,i=n.scope;i;i=i.prev)if(i.type==="coffee"||i.type=="}"){t=i.offset+e.indentUnit;break}o!=="coffee"?(c=null,r=e.column()+e.current().length):n.scope.align&&(n.scope.align=!1),n.scope={offset:t,type:o,prev:n.scope,align:c,alignOffset:r}}function d(e,n){if(n.scope.prev){if(n.scope.type==="coffee"){for(var o=e.indentation(),t=!1,c=n.scope;c;c=c.prev)if(o===c.offset){t=!0;break}if(!t)return!0;for(;n.scope.prev&&n.scope.offset!==o;)n.scope=n.scope.prev;return!1}return n.scope=n.scope.prev,!1}}const S={name:"coffeescript",startState:function(){return{tokenize:p,scope:{offset:0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,n){var o=n.scope.align===null&&n.scope;o&&e.sol()&&(o.align=!1);var t=function(c,r){var i=r.tokenize(c,r),f=c.current();f==="return"&&(r.dedent=!0),((f==="->"||f==="=>")&&c.eol()||i==="indent")&&l(c,r);var a="[({".indexOf(f);if(a!==-1&&l(c,r,"])}".slice(a,a+1)),u.exec(f)&&l(c,r),f=="then"&&d(c,r),i==="dedent"&&d(c,r))return m;if((a="])}".indexOf(f))!==-1){for(;r.scope.type=="coffee"&&r.scope.prev;)r.scope=r.scope.prev;r.scope.type==f&&(r.scope=r.scope.prev)}return r.dedent&&c.eol()&&(r.scope.type=="coffee"&&r.scope.prev&&(r.scope=r.scope.prev),r.dedent=!1),i=="indent"||i=="dedent"?null:i}(e,n);return t&&t!="comment"&&(o&&(o.align=!0),n.prop=t=="punctuation"&&e.current()=="."),t},indent:function(e,n){if(e.tokenize!=p)return 0;var o=e.scope,t=n&&"])}".indexOf(n.charAt(0))>-1;if(t)for(;o.type=="coffee"&&o.prev;)o=o.prev;var c=t&&o.type===n.charAt(0);return o.align?o.alignOffset-(c?1:0):(c?o.prev:o).offset},languageData:{commentTokens:{line:"#"}}};export{S as coffeeScript}; diff --git a/apps/assets/colors-bszWmPJw.js b/apps/assets/colors-bszWmPJw.js new file mode 100644 index 0000000000000000000000000000000000000000..c546e30a7b459e506ae112a5c9d9f64c29826842 --- /dev/null +++ b/apps/assets/colors-bszWmPJw.js @@ -0,0 +1 @@ +function c(e){for(var n=e.length/6|0,a=new Array(n),r=0;r0){for(o=n[--a];a>0&&(e=o,r=n[--a],o=e+r,i=r-(o-e),!i););a>0&&(i<0&&n[a-1]<0||i>0&&n[a-1]>0)&&(r=2*i,e=o+r,r==e-o&&(o=e))}return o}}function Hx(t,n){return(t==null||!(t>=t))-(n==null||!(n>=n))||(tn?1:0)}function Gx(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=i===void 0?Hx:function(a=Ws){if(a===Ws)return Hx;if(typeof a!="function")throw new TypeError("compare is not a function");return(o,s)=>{const u=a(o,s);return u||u===0?u:(a(s,s)===0)-(a(o,o)===0)}}(i);r>e;){if(r-e>600){const u=r-e+1,l=n-e+1,c=Math.log(u),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(u-f)/u)*(l-u/2<0?-1:1);Gx(t,n,Math.max(e,Math.floor(n-l*f/u+d)),Math.min(r,Math.floor(n+(u-l)*f/u+d)),i)}const a=t[n];let o=e,s=r;for(Ys(t,e,n),i(t[r],a)>0&&Ys(t,e,r);o0;)--s}i(t[e],a)===0?Ys(t,e,s):(++s,Ys(t,s,r)),s<=n&&(e=s+1),n<=s&&(r=s-1)}return t}function Ys(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function yp(t,n,e){if((r=(t=Float64Array.from(r8(t,e))).length)&&!isNaN(n=+n)){if(n<=0||r<2)return cp(t);if(n>=1)return Ca(t);var r,i=(r-1)*n,a=Math.floor(i),o=Ca(Gx(t,a).subarray(0,a+1));return o+(cp(t.subarray(a+1))-o)*(i-a)}}function Vx(t,n,e=i8){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),o=+e(t[a],a,t);return o+(+e(t[a+1],a+1,t)-o)*(i-a)}}function Yx(t,n){return yp(t,.5,n)}function Xx(t){return Array.from(function*(n){for(const e of n)yield*e}(t))}function Jx(t,n){let e=0;for(let r of t)(r=+r)&&(e+=r);return e}function n9(t){return t instanceof Kl?t:new Kl(t)}function Ql(t){const n=t||Me,e=[],r={};return e.add=i=>{const a=n(i);return r[a]||(r[a]=1,e.push(i)),e},e.remove=i=>{const a=n(i);if(r[a]){r[a]=0;const o=e.indexOf(i);o>=0&&e.splice(o,1)}return e},e}async function Zl(t,n){try{await n(t)}catch(e){t.error(e)}}const Kx=Symbol("vega_id");let e9=1;function tc(t){return!(!t||!st(t))}function st(t){return t[Kx]}function Qx(t,n){return t[Kx]=n,t}function St(t){const n=t===Object(t)?t:{data:t};return st(n)?n:Qx(n,e9++)}function vp(t){return nc(t,St({}))}function nc(t,n){for(const e in t)n[e]=t[e];return n}function Zx(t,n){return Qx(n,st(t))}function Sa(t,n){return t?n?(e,r)=>t(e,r)||st(n(e))-st(n(r)):(e,r)=>t(e,r)||st(e)-st(r):null}function t2(t){return t&&t.constructor===Ma}function Ma(){const t=[],n=[],e=[],r=[],i=[];let a=null,o=!1;return{constructor:Ma,insert(s){const u=K(s),l=u.length;for(let c=0;c{p(v)&&(l[st(v)]=-1)});for(f=0,d=t.length;f0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=i.length;f{p(v)&&l[st(v)]>0&&y(v,h.field,h.value)}),s.modifies(h.field);if(o)s.mod=n.length||r.length?u.filter(v=>l[st(v)]>0):u.slice();else for(g in c)s.mod.push(c[g]);return(a||a==null&&(n.length||r.length))&&s.clean(!0),s}}}const ec="_:mod:_";function rc(){Object.defineProperty(this,ec,{writable:!0,value:{}})}rc.prototype={set(t,n,e,r){const i=this,a=i[t],o=i[ec];return n!=null&&n>=0?(a[n]!==e||r)&&(a[n]=e,o[n+":"+t]=-1,o[t]=-1):(a!==e||r)&&(i[t]=e,o[t]=P(e)?1+e.length:-1),i},modified(t,n){const e=this[ec];if(!arguments.length){for(const r in e)if(e[r])return!0;return!1}if(P(t)){for(let r=0;r=0?n+1{h instanceof Ut?(h!==this&&(n&&h.targets().add(this),a.push(h)),i.push({op:h,name:f,index:d})):r.set(f,d,h)};for(o in t)if(s=t[o],o==="pulse")K(s).forEach(f=>{f instanceof Ut?f!==this&&(f.targets().add(this),a.push(f)):j("Pulse parameters must be operator instances.")}),this.source=s;else if(P(s))for(r.set(o,-1,Array(u=s.length)),l=0;l{const e=Date.now();return e-n>t?(n=e,1):0})},debounce(t){const n=Pi();return this.targets().add(Pi(null,null,Qh(t,e=>{const r=e.dataflow;n.receive(e),r&&r.run&&r.run()}))),n},between(t,n){let e=!1;return t.targets().add(Pi(null,null,()=>e=!0)),n.targets().add(Pi(null,null,()=>e=!1)),this.filter(()=>e)},detach(){this._filter=Be,this._targets=null}};const o9={skip:!0};function s9(t,n,e,r,i,a){const o=xt({},a,o9);let s,u;bt(e)||(e=In(e)),r===void 0?s=l=>t.touch(e(l)):bt(r)?(u=new Ut(null,r,i,!1),s=l=>{u.evaluate(l);const c=e(l),f=u.value;t2(f)?t.pulse(c,f,a):t.update(c,f,o)}):s=l=>t.update(e(l),r,o),n.apply(s)}function u9(t,n,e,r,i,a){if(r===void 0)n.targets().add(e);else{const o=a||{},s=new Ut(null,function(u,l){return l=bt(l)?l:In(l),u?function(c,f){const d=l(c,f);return u.skip()||(u.skip(d!==this.value).value=d),d}:l}(e,r),i,!1);s.modified(o.force),s.rank=n.rank,n.targets().add(s),e&&(s.skip(!0),s.value=e.value,s.targets().add(e),t.connect(e,[s]))}}const ac={};function ji(t,n,e){this.dataflow=t,this.stamp=n??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}function bp(t,n){const e=[];return ka(t,n,r=>e.push(r)),e}function e2(t,n){const e={};return t.visit(n,r=>{e[st(r)]=1}),r=>e[st(r)]?null:r}function oc(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function xp(t,n,e,r){const i=this;let a=0;this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e;for(const o of e)if(o.stamp===n){if(o.fields){const s=i.fields||(i.fields={});for(const u in o.fields)s[u]=1}o.changed(i.ADD)&&(a|=i.ADD),o.changed(i.REM)&&(a|=i.REM),o.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}function r2(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}ji.prototype={StopPropagation:ac,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new ji(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new ji(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,n){const e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source,t.cleans&&(e.cleans=t.cleans)),e},runAfter(t){this.dataflow.runAfter(t)},changed(t){const n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,e2(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return P(t)?t.forEach(e=>n[e]=!0):n[t]=!0,this},modified(t,n){const e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?P(t)?t.some(r=>e[r]):e[t]:!!e)},filter(t,n){const e=this;return 1&t&&(e.addF=oc(e.addF,n)),2&t&&(e.remF=oc(e.remF,n)),4&t&&(e.modF=oc(e.modF,n)),16&t&&(e.srcF=oc(e.srcF,n)),e},materialize(t){const n=this;return 1&(t=t||7)&&n.addF&&(n.add=bp(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=bp(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=bp(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(t,n){const e=this,r=n;if(16&t)return ka(e.source,e.srcF,r),e;1&t&&ka(e.add,e.addF,r),2&t&&ka(e.rem,e.remF,r),4&t&&ka(e.mod,e.modF,r);const i=e.source;if(8&t&&i){const a=e.add.length+e.mod.length;a===i.length||ka(i,a?e2(e,5):e.srcF,r)}return e}},V(xp,ji,{fork(t){const n=new ji(this.dataflow).init(this,t&this.NO_FIELDS);return t!==void 0&&(t&n.ADD&&this.visit(n.ADD,e=>n.add.push(e)),t&n.REM&&this.visit(n.REM,e=>n.rem.push(e)),t&n.MOD&&this.visit(n.MOD,e=>n.mod.push(e))),n},changed(t){return this.changes&t},modified(t){const n=this,e=n.fields;return e&&n.changes&n.MOD?P(t)?t.some(r=>e[r]):e[t]:0},filter(){j("MultiPulse does not support filtering.")},materialize(){j("MultiPulse does not support materialization.")},visit(t,n){const e=this,r=e.pulses,i=r.length;let a=0;if(t&e.SOURCE)for(;an=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),i2(n,0,n.length-1,t)),pop:()=>{const e=n.pop();let r;return n.length?(r=n[0],n[0]=e,function(i,a,o){const s=a,u=i.length,l=i[a];let c,f=1+(a<<1);for(;f=0&&(f=c),i[a]=i[f],f=1+((a=f)<<1);i[a]=l,i2(i,s,a,o)}(n,0,t)):r=e,r}}}function i2(t,n,e,r){let i,a;const o=t[e];for(;e>n&&(a=e-1>>1,i=t[a],r(o,i)<0);)t[e]=i,e=a;return t[e]=o}function $o(){this.logger(Kh()),this.logLevel(Kb),this._clock=0,this._rank=0,this._locale=Qb();try{this._loader=Hl()}catch{}this._touched=Ql(Hs),this._input={},this._pulse=null,this._heap=l9((t,n)=>t.qrank-n.qrank),this._postrun=[]}function Xs(t){return function(){return this._log[t].apply(this,arguments)}}function O(t,n){Ut.call(this,t,null,n)}$o.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Xs("error"),warn:Xs("warn"),info:Xs("info"),debug:Xs("debug"),logLevel:Xs("level"),cleanThreshold:1e4,add:function(t,n,e,r){let i,a=1;return t instanceof Ut?i=t:t&&t.prototype instanceof Ut?i=new t:bt(t)?i=new Ut(null,t):(a=0,i=new Ut(t,n)),this.rank(i),a&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},connect:function(t,n){const e=t.rank,r=n.length;for(let i=0;i=0;)n.push(e=r[i]),e===t&&j("Cycle detected in dataflow graph.")},pulse:function(t,n,e){this.touch(t,e||wp);const r=new ji(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},touch:function(t,n){const e=n||wp;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},update:function(t,n,e){const r=e||wp;return(t.set(n)||r.force)&&this.touch(t,r),this},changeset:Ma,ingest:function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},parse:function(t,n){const e=this.locale();return tx(t,n,e.timeParse,e.utcParse)},preload:async function(t,n,e){const r=this,i=r._pending||function(o){let s;const u=new Promise(l=>s=l);return u.requests=0,u.done=()=>{--u.requests===0&&(o._pending=null,s(o))},o._pending=u}(r);i.requests+=1;const a=await r.request(n,e);return r.pulse(t,r.changeset().remove(Be).insert(a.data||[])),i.done(),a},request:async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Zb(n&&n.type)});try{r=e.parse(r,n)}catch(a){i=-2,e.warn("Data ingestion failed",t,a)}}catch(a){i=-1,e.warn("Loading failed",t,a)}return{data:r,status:i}},events:function(t,n,e,r){const i=this,a=Pi(e,r),o=function(l){l.dataflow=i;try{a.receive(l)}catch(c){i.error(c)}finally{i.run()}};let s;s=typeof t=="string"&&typeof document<"u"?document.querySelectorAll(t):K(t);const u=s.length;for(let l=0;lr._enqueue(c,!0)),r._touched=Ql(Hs);let o,s,u,l=0;try{for(;r._heap.size()>0;)o=r._heap.pop(),o.rank===o.qrank?(s=o.run(r._getPulse(o,t)),s.then?s=await s:s.async&&(i.push(s.async),s=ac),s!==ac&&o._targets&&o._targets.forEach(c=>r._enqueue(c)),++l):r._enqueue(o,!0)}catch(c){r._heap.clear(),u=c}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${l} operators`),u&&(r._postrun=[],r.error(u)),r._postrun.length){const c=r._postrun.sort((f,d)=>d.priority-f.priority);r._postrun=[];for(let f=0;fr.runAsync(null,()=>{c.forEach(f=>{try{f(r)}catch(d){r.error(d)}})})),r},run:function(t,n,e){return this._pulse?r2(this):(this.evaluate(t,n,e),this)},runAsync:async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},runAfter:function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(r){this.error(r)}},_enqueue:function(t,n){const e=t.stampi.pulse),n):this._input[t.id]||function(i,a){return a&&a.stamp===i.stamp?a:(i=i.fork(),a&&a!==ac&&(i.source=a.source),i)}(this._pulse,e&&e.pulse)}},V(O,Ut,{run(t){if(t.stampthis.pulse=e):n!==t.StopPropagation&&(this.pulse=n),n},evaluate(t){const n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},transform(){}});const So={};function a2(t){const n=o2(t);return n&&n.Definition||null}function o2(t){return t=t&&t.toLowerCase(),tt(So,t)?So[t]:null}function*s2(t,n){if(n==null)for(let e of t)e!=null&&e!==""&&(e=+e)>=e&&(yield e);else{let e=-1;for(let r of t)r=n(r,++e,t),r!=null&&r!==""&&(r=+r)>=r&&(yield r)}}function Ap(t,n,e){const r=Float64Array.from(s2(t,e));return r.sort(Ws),n.map(i=>Vx(r,i))}function _p(t,n){return Ap(t,[.25,.5,.75],n)}function kp(t,n){const e=t.length,r=function(o,s){const u=function(l,c){let f,d=0,h=0,p=0;if(c===void 0)for(let m of l)m!=null&&(m=+m)>=m&&(f=m-h,h+=f/++d,p+=f*(m-h));else{let m=-1;for(let g of l)(g=c(g,++m,l))!=null&&(g=+g)>=g&&(f=g-h,h+=f/++d,p+=f*(g-h))}if(d>1)return p/(d-1)}(o,s);return u&&Math.sqrt(u)}(t,n),i=_p(t,n),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function u2(t){const n=t.maxbins||20,e=t.base||10,r=Math.log(e),i=t.divide||[5,2];let a,o,s,u,l,c,f=t.extent[0],d=t.extent[1];const h=t.span||d-f||Math.abs(f)||1;if(t.step)a=t.step;else if(t.steps){for(u=h/n,l=0,c=t.steps.length;ln;)a*=e;for(l=0,c=i.length;l=s&&h/u<=n&&(a=u)}u=Math.log(a);const p=u>=0?0:1+~~(-u/r),m=Math.pow(e,-p-1);return(t.nice||t.nice===void 0)&&(u=Math.floor(f/a+m)*a,f=fd);const i=t.length,a=new Float64Array(i);let o,s=0,u=1,l=r(t[0]),c=l,f=l+n;for(;u=f){for(c=(l+c)/2;s>1);gv;)d[g--]=d[y]}y=v,v=m}return d}(a,n+n/4):a}const f2=Math.sqrt(2*Math.PI),c9=Math.SQRT2;let Js=NaN;function sc(t,n){t=t||0,n=n??1;let e,r,i=0,a=0;if(Js==Js)i=Js,Js=NaN;else{do i=2*Ne()-1,a=2*Ne()-1,e=i*i+a*a;while(e===0||e>1);r=Math.sqrt(-2*Math.log(e)/e),i*=r,Js=a*r}return t+i*n}function Dp(t,n,e){const r=(t-(n||0))/(e=e??1);return Math.exp(-.5*r*r)/(e*f2)}function uc(t,n,e){const r=(t-(n=n||0))/(e=e??1),i=Math.abs(r);let a;if(i>37)a=0;else{const o=Math.exp(-i*i/2);let s;i<7.07106781186547?(s=.0352624965998911*i+.700383064443688,s=s*i+6.37396220353165,s=s*i+33.912866078383,s=s*i+112.079291497871,s=s*i+221.213596169931,s=s*i+220.206867912376,a=o*s,s=.0883883476483184*i+1.75566716318264,s=s*i+16.064177579207,s=s*i+86.7807322029461,s=s*i+296.564248779674,s=s*i+637.333633378831,s=s*i+793.826512519948,s=s*i+440.413735824752,a/=s):(s=i+.65,s=i+4/s,s=i+3/s,s=i+2/s,s=i+1/s,a=o/s/2.506628274631)}return r>0?1-a:a}function lc(t,n,e){return t<0||t>1?NaN:(n||0)+(e??1)*c9*function(r){let i,a=-Math.log((1-r)*(1+r));return a<6.25?(a-=3.125,i=-364441206401782e-35,i=i*a-16850591381820166e-35,i=128584807152564e-32+i*a,i=11157877678025181e-33+i*a,i=i*a-1333171662854621e-31,i=20972767875968562e-33+i*a,i=6637638134358324e-30+i*a,i=i*a-4054566272975207e-29,i=i*a-8151934197605472e-29,i=26335093153082323e-28+i*a,i=i*a-12975133253453532e-27,i=i*a-5415412054294628e-26,i=10512122733215323e-25+i*a,i=i*a-4112633980346984e-24,i=i*a-29070369957882005e-24,i=42347877827932404e-23+i*a,i=i*a-13654692000834679e-22,i=i*a-13882523362786469e-21,i=.00018673420803405714+i*a,i=i*a-.000740702534166267,i=i*a-.006033670871430149,i=.24015818242558962+i*a,i=1.6536545626831027+i*a):a<16?(a=Math.sqrt(a)-3.25,i=22137376921775787e-25,i=9075656193888539e-23+i*a,i=i*a-27517406297064545e-23,i=18239629214389228e-24+i*a,i=15027403968909828e-22+i*a,i=i*a-4013867526981546e-21,i=29234449089955446e-22+i*a,i=12475304481671779e-21+i*a,i=i*a-47318229009055734e-21,i=6828485145957318e-20+i*a,i=24031110387097894e-21+i*a,i=i*a-.0003550375203628475,i=.0009532893797373805+i*a,i=i*a-.0016882755560235047,i=.002491442096107851+i*a,i=i*a-.003751208507569241,i=.005370914553590064+i*a,i=1.0052589676941592+i*a,i=3.0838856104922208+i*a):Number.isFinite(a)?(a=Math.sqrt(a)-5,i=-27109920616438573e-27,i=i*a-2555641816996525e-25,i=15076572693500548e-25+i*a,i=i*a-3789465440126737e-24,i=761570120807834e-23+i*a,i=i*a-1496002662714924e-23,i=2914795345090108e-23+i*a,i=i*a-6771199775845234e-23,i=22900482228026655e-23+i*a,i=i*a-99298272942317e-20,i=4526062597223154e-21+i*a,i=i*a-1968177810553167e-20,i=7599527703001776e-20+i*a,i=i*a-.00021503011930044477,i=i*a-.00013871931833623122,i=1.0103004648645344+i*a,i=4.849906401408584+i*a):i=1/0,i*r}(2*t-1)}function Fp(t,n){let e,r;const i={mean(a){return arguments.length?(e=a||0,i):e},stdev(a){return arguments.length?(r=a??1,i):r},sample:()=>sc(e,r),pdf:a=>Dp(a,e,r),cdf:a=>uc(a,e,r),icdf:a=>lc(a,e,r)};return i.mean(t).stdev(n)}function Cp(t,n){const e=Fp();let r=0;const i={data(a){return arguments.length?(t=a,r=a?a.length:0,i.bandwidth(n)):t},bandwidth(a){return arguments.length?(!(n=a)&&t&&(n=kp(t)),i):n},sample:()=>t[~~(Ne()*r)]+n*e.sample(),pdf(a){let o=0,s=0;for(;sEp(e,r),pdf:a=>$p(a,e,r),cdf:a=>Sp(a,e,r),icdf:a=>Mp(a,e,r)};return i.mean(t).stdev(n)}function h2(t,n){let e,r=0;const i={weights(a){return arguments.length?(e=function(o){const s=[];let u,l=0;for(u=0;u=n&&t<=e?1/(e-n):0}function Op(t,n,e){return e==null&&(e=n??1,n=0),te?1:(t-n)/(e-n)}function Np(t,n,e){return e==null&&(e=n??1,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function p2(t,n){let e,r;const i={min(a){return arguments.length?(e=a||0,i):e},max(a){return arguments.length?(r=a??1,i):r},sample:()=>Bp(e,r),pdf:a=>zp(a,e,r),cdf:a=>Op(a,e,r),icdf:a=>Np(a,e,r)};return n==null&&(n=t??1,t=0),i.min(t).max(n)}function Rp(t,n,e){let r=0,i=0;for(const a of t){const o=e(a);n(a)==null||o==null||isNaN(o)||(r+=(o-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function Ks(t,n,e,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-a*t,a]}function cc(t,n,e,r){t=t.filter(h=>{let p=n(h),m=e(h);return p!=null&&(p=+p)>=p&&m!=null&&(m=+m)>=m}),r&&t.sort((h,p)=>n(h)-n(p));const i=t.length,a=new Float64Array(i),o=new Float64Array(i);let s,u,l,c=0,f=0,d=0;for(l of t)a[c]=s=+n(l),o[c]=u=+e(l),++c,f+=(s-f)/c,d+=(u-d)/c;for(c=0;c=i&&a!=null&&(a=+a)>=a&&r(i,a,++o)}function Mo(t,n,e,r,i){let a=0,o=0;return Qs(t,n,e,(s,u)=>{const l=u-i(s),c=u-r;a+=l*l,o+=c*c}),1-a/o}function Tp(t,n,e){let r=0,i=0,a=0,o=0,s=0;Qs(t,n,e,(c,f)=>{++s,r+=(c-r)/s,i+=(f-i)/s,a+=(c*f-a)/s,o+=(c*c-o)/s});const u=Ks(r,i,a,o),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Mo(t,n,e,i,l)}}function m2(t,n,e){let r=0,i=0,a=0,o=0,s=0;Qs(t,n,e,(c,f)=>{++s,c=Math.log(c),r+=(c-r)/s,i+=(f-i)/s,a+=(c*f-a)/s,o+=(c*c-o)/s});const u=Ks(r,i,a,o),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Mo(t,n,e,i,l)}}function g2(t,n,e){const[r,i,a,o]=cc(t,n,e);let s,u,l,c=0,f=0,d=0,h=0,p=0;Qs(t,n,e,(v,x)=>{s=r[p++],u=Math.log(x),l=s*x,c+=(x*u-c)/p,f+=(l-f)/p,d+=(l*u-d)/p,h+=(s*l-h)/p});const[m,g]=Ks(f/o,c/o,d/o,h/o),y=v=>Math.exp(m+g*(v-a));return{coef:[Math.exp(m-g*a),g],predict:y,rSquared:Mo(t,n,e,o,y)}}function y2(t,n,e){let r=0,i=0,a=0,o=0,s=0,u=0;Qs(t,n,e,(f,d)=>{const h=Math.log(f),p=Math.log(d);++u,r+=(h-r)/u,i+=(p-i)/u,a+=(h*p-a)/u,o+=(h*h-o)/u,s+=(d-s)/u});const l=Ks(r,i,a,o),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Mo(t,n,e,s,c)}}function Pp(t,n,e){const[r,i,a,o]=cc(t,n,e),s=r.length;let u,l,c,f,d=0,h=0,p=0,m=0,g=0;for(u=0;ux*(_-=a)*_+b*_+w+o;return{coef:[w-b*a+x*a*a+o,b-2*x*a,x],predict:A,rSquared:Mo(t,n,e,o,A)}}function v2(t,n,e,r){if(r===0)return Rp(t,n,e);if(r===1)return Tp(t,n,e);if(r===2)return Pp(t,n,e);const[i,a,o,s]=cc(t,n,e),u=i.length,l=[],c=[],f=r+1;let d,h,p,m,g;for(d=0;dMath.abs(x[A][F])&&(F=_);for(k=A;k=A;k--)x[k][_]-=x[k][A]*x[A][_]/x[A][A]}for(_=b-1;_>=0;--_){for(C=0,k=_+1;k{x-=o;let b=s+y[0]+y[1]*x+y[2]*x*x;for(d=3;d=0;--a)for(s=n[a],u=1,i[a]+=s,o=1;o<=a;++o)u*=(a+1-o)/o,i[a-o]+=s*Math.pow(e,o)*u;return i[0]+=r,i}function b2(t,n,e,r){const[i,a,o,s]=cc(t,n,e,!0),u=i.length,l=Math.max(2,~~(r*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=2;){const p=[0,l-1];for(let g=0;gi[x]-y?v:x;let w=0,A=0,_=0,k=0,F=0;const C=1/Math.abs(i[b]-y||1);for(let $=v;$<=x;++$){const M=i[$],S=a[$],B=d9(Math.abs(y-M)*C)*d[$],z=M*B;w+=B,A+=z,_+=S*B,k+=S*z,F+=M*z}const[D,E]=Ks(A/w,_/w,k/w,F/w);c[g]=D+E*y,f[g]=Math.abs(a[g]-c[g]),h9(i,g+1,p)}if(h===2)break;const m=Yx(f);if(Math.abs(m)<1e-12)break;for(let g,y,v=0;v=1?1e-12:(y=1-g*g)*y}return function(h,p,m,g){const y=h.length,v=[];let x,b=0,w=0,A=[];for(;b=t.length))for(;n>i&&t[a]-r<=r-t[i];)e[0]=++i,e[1]=a,++a}const p9=.5*Math.PI/180;function fc(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=m=>[m,t(m)],a=n[0],o=n[1],s=o-a,u=s/r,l=[i(a)],c=[];if(e===r){for(let m=1;m0;)c.push(i(a+m/e*s));let f=l[0],d=c[c.length-1];const h=1/s,p=function(m,g){let y=m,v=m;const x=g.length;for(let b=0;bv&&(v=w)}return 1/(v-y)}(f[1],c);for(;d;){const m=i((f[0]+d[0])/2);m[0]-f[0]>=u&&m9(f,m,d,h,p)>p9?c.push(m):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function m9(t,n,e,r,i){const a=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0])),o=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0]));return Math.abs(a-o)}function jp(t){return t&&t.length?t.length===1?t[0]:(n=t,e=>{const r=n.length;let i=1,a=String(n[0](e));for(;i{},g9={init:Lp,add:Lp,rem:Lp,idx:0},Zs={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.valid?t.sum:void 0,add:(t,n)=>t.sum+=+n,rem:(t,n)=>t.sum-=n},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,n)=>t.product*=n,rem:(t,n)=>t.product/=n},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,n)=>(t.mean_d=n-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,n)=>(t.mean_d=n-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,n)=>t.dev+=t.mean_d*(n-t.mean),rem:(t,n)=>t.dev-=t.mean_d*(n-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,n)=>{(n{n<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,n)=>{(n>t.max||t.max===void 0)&&(t.max=n)},rem:(t,n)=>{n>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,n,e)=>{n{n<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,n,e)=>{n>t.max&&(t.argmax=e)},rem:(t,n)=>{n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,n)=>{t.exp=0,t.exp_r=n},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,n)=>t.exp=t.exp_r*t.exp+n,rem:(t,n)=>t.exp=(t.exp-n/t.exp_r**(t.valid-1))/t.exp_r},exponentialb:{value:t=>t.valid?t.exp*(1-t.exp_r):void 0,req:["exponential"],idx:1}},tu=Object.keys(Zs).filter(t=>t!=="__count__");function w2(t,n,e){return Zs[t](e,n)}function A2(t,n){return t.idx-n.idx}function y9(){this.valid=0,this.missing=0,this._ops.forEach(t=>t.aggregate_param==null?t.init(this):t.init(this,t.aggregate_param))}function v9(t,n){t!=null&&t!==""?t==t&&(++this.valid,this._ops.forEach(e=>e.add(this,t,n))):++this.missing}function b9(t,n){t!=null&&t!==""?t==t&&(--this.valid,this._ops.forEach(e=>e.rem(this,t,n))):--this.missing}function x9(t){return this._out.forEach(n=>t[n.out]=n.value(this)),t}function _2(t,n){const e=n||Me,r=function(o){const s={};o.forEach(l=>s[l.name]=l);const u=l=>{l.req&&l.req.forEach(c=>{s[c]||u(s[c]=Zs[c]())})};return o.forEach(u),Object.values(s).sort(A2)}(t),i=t.slice().sort(A2);function a(o){this._ops=r,this._out=i,this.cell=o,this.init()}return a.prototype.init=y9,a.prototype.add=v9,a.prototype.rem=b9,a.prototype.set=x9,a.prototype.get=e,a.fields=t.map(o=>o.out),a}function qp(t){this._key=t?ei(t):st,this.reset()}[...tu,"__count__"].forEach(t=>{Zs[t]=function(n,e){return(r,i)=>xt({name:n,aggregate_param:i,out:r||n},g9,e)}(t,Zs[t])});const kn=qp.prototype;function Li(t){O.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}kn.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},kn.add=function(t){this._add.push(t)},kn.rem=function(t){this._rem.push(t)},kn.values=function(){if(this._get=null,this._rem.length===0)return this._add;const t=this._add,n=this._rem,e=this._key,r=t.length,i=n.length,a=Array(r-i),o={};let s,u,l;for(s=0;s=0;)r=t(n[i])+"",tt(e,r)||(e[r]=1,++a);return a},kn.extent=function(t){if(this._get!==t||!this._ext){const n=this.values(),e=sx(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},kn.argmin=function(t){return this.extent(t)[0]||{}},kn.argmax=function(t){return this.extent(t)[1]||{}},kn.min=function(t){const n=this.extent(t)[0];return n!=null?t(n):void 0},kn.max=function(t){const n=this.extent(t)[1];return n!=null?t(n):void 0},kn.quartile=function(t){return this._get===t&&this._q||(this._q=_p(this.values(),t),this._get=t),this._q},kn.q1=function(t){return this.quartile(t)[0]},kn.q2=function(t){return this.quartile(t)[1]},kn.q3=function(t){return this.quartile(t)[2]},kn.ci=function(t){return this._get===t&&this._ci||(this._ci=l2(this.values(),1e3,.05,t),this._get=t),this._ci},kn.ci0=function(t){return this.ci(t)[0]},kn.ci1=function(t){return this.ci(t)[1]},Li.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:tu},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},V(Li,O,{transform(t,n){const e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):Object.create(null),n.visit(n.SOURCE,a=>e.add(a))):(e.value=e.value||e.init(t),n.visit(n.REM,a=>e.rem(a)),n.visit(n.ADD,a=>e.add(a))),r.modifies(e._outputs),e._drop=t.drop!==!1,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),n.clean()&&e._drop&&r.clean(!0).runAfter(()=>this.clean()),e.changes(r)},cross(){const t=this,n=t.value,e=t._dnames,r=e.map(()=>({})),i=e.length;function a(o){let s,u,l,c;for(s in o)for(l=o[s].tuple,u=0;u{const x=en(v);return i(v),e.push(x),x}),this.cellkey=t.key?t.key:jp(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const a=t.fields||[null],o=t.ops||["count"],s=t.aggregate_params||[null],u=t.as||[],l=a.length,c={};let f,d,h,p,m,g,y;for(l!==o.length&&j("Unmatched number of fields and aggregate ops."),y=0;y_2(v,v.field)),Object.create(null)},cellkey:jp(),cell(t,n){let e=this.value[t];return e?e.num===0&&this._drop&&e.stampa.push(u),remove:u=>o[r(u)]=++s,size:()=>i.length,data:(u,l)=>(s&&(i=i.filter(c=>!o[r(c)]),o={},s=0),l&&u&&i.sort(u),a.length&&(i=u?ox(u,i,a.sort(u)):i.concat(a),a=[]),i)}}function Ip(t){O.call(this,[],t)}function D2(t){Ut.call(this,null,w9,t)}function w9(t){return this.value&&!t.modified()?this.value:ep(t.fields,t.orders)}function Wp(t){O.call(this,null,t)}function Hp(t){O.call(this,null,t)}Up.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},V(Up,O,{transform(t,n){const e=t.interval!==!1,r=this._bins(t),i=r.start,a=r.step,o=t.as||["bin0","bin1"],s=o[0],u=o[1];let l;return l=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(Wn(t.field))?n.ADD_MOD:n.ADD,n.visit(l,e?c=>{const f=r(c);c[s]=f,c[u]=f==null?null:i+a*(1+(f-i)/a)}:c=>c[s]=r(c)),n.modifies(e?o:s)},_bins(t){if(this.value&&!t.modified())return this.value;const n=t.field,e=u2(t),r=e.step;let i,a,o=e.start,s=o+Math.ceil((e.stop-o)/r)*r;(i=t.anchor)!=null&&(a=i-(o+r*Math.floor((i-o)/r)),o+=a,s+=a);const u=function(l){let c=ze(n(l));return c==null?null:cs?1/0:(c=Math.max(o,Math.min(c,s-r)),o+r*Math.floor(1e-14+(c-o)/r))};return u.start=o,u.stop=e.stop,u.step=r,this.value=Do(u,Wn(n),t.name||"bin_"+en(n))}}),Ip.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},V(Ip,O,{transform(t,n){const e=n.fork(n.ALL),r=k2(st,this.value,e.materialize(e.ADD).add),i=t.sort,a=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(a),this.value=e.source=r.data(Sa(i),a),n.source&&n.source.root&&(this.value.root=n.source.root),e}}),V(D2,Ut),Wp.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},V(Wp,O,{transform(t,n){const e=f=>d=>{for(var h,p=function(y,v,x){switch(v){case"upper":y=y.toUpperCase();break;case"lower":y=y.toLowerCase()}return y.match(x)}(s(d),t.case,a)||[],m=0,g=p.length;mi[f]=1+(i[f]||0)),c=e(f=>i[f]-=1);return r?n.visit(n.SOURCE,l):(n.visit(n.ADD,l),n.visit(n.REM,c)),this._finish(n,u)},_parameterCheck(t,n){let e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},_finish(t,n){const e=this._counts,r=this._tuples||(this._tuples={}),i=n[0],a=n[1],o=t.fork(t.NO_SOURCE|t.NO_FIELDS);let s,u,l;for(s in e)u=r[s],l=e[s]||0,!u&&l?(r[s]=u=St({}),u[i]=s,u[a]=l,o.add.push(u)):l===0?(u&&o.rem.push(u),e[s]=null,r[s]=null):u[a]!==l&&(u[a]=l,o.mod.push(u));return o.modifies(n)}}),Hp.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},V(Hp,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.as||["a","b"],i=r[0],a=r[1],o=!this.value||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter");let s=this.value;return o?(s&&(e.rem=s),s=n.materialize(n.SOURCE).source,e.add=this.value=function(u,l,c,f){for(var d,h,p=[],m={},g=u.length,y=0;yE2(a,n))):typeof r[i]===C2&&r[i](t[i]);return r}function Gp(t){O.call(this,null,t)}const $2=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],A9={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:$2},{name:"weights",type:"number",array:!0}]};function S2(t,n){return t?t.map((e,r)=>n[r]||en(e)):null}function Vp(t,n,e){const r=[],i=f=>f(u);let a,o,s,u,l,c;if(n==null)r.push(t.map(e));else for(a={},o=0,s=t.length;ol.materialize(l.SOURCE).source}(n)),i=t.steps||t.minsteps||25,a=t.steps||t.maxsteps||200;let o=t.method||"pdf";o!=="pdf"&&o!=="cdf"&&j("Invalid density method: "+o),t.extent||r.data||j("Missing density extent parameter."),o=r[o];const s=t.as||["value","density"],u=fc(o,t.extent||kr(r.data()),i,a).map(l=>{const c={};return c[s[0]]=l[0],c[s[1]]=l[1],St(c)});this.value&&(e.rem=this.value),this.value=e.add=e.source=u}return e}});function Yp(t){O.call(this,null,t)}Yp.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function M2(t){Ut.call(this,null,_9,t),this.modified(!0)}function _9(t){const n=t.expr;return this.value&&!t.modified("expr")?this.value:Do(e=>n(e,t),Wn(n),en(n))}function Xp(t){O.call(this,[void 0,void 0],t)}function Jp(t,n){Ut.call(this,t),this.parent=n,this.count=0}function dc(t){O.call(this,{},t),this._keys=Fo();const n=this._targets=[];n.active=0,n.forEach=e=>{for(let r=0,i=n.active;rei(n)):ei(t.name,t.as)}function Kp(t){O.call(this,Fo(),t)}function Qp(t){O.call(this,[],t)}function Zp(t){O.call(this,[],t)}function tm(t){O.call(this,null,t)}function z2(t){O.call(this,[],t)}V(Yp,O,{transform(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=Vp(n.source,t.groupby,Me),i=t.smooth||!1,a=t.field,o=t.step||((p,m)=>Gl(kr(p,m))/30)(e,a),s=Sa((p,m)=>a(p)-a(m)),u=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=m),p[++c][u]=m}return this.value={start:f,stop:d,step:o},n.reflow(!0).modifies(u)}}),V(M2,Ut),Xp.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},V(Xp,O,{transform(t,n){const e=this.value,r=t.field,i=n.changed()||n.modified(r.fields)||t.modified("field");let a=e[0],o=e[1];if((i||a==null)&&(a=1/0,o=-1/0),n.visit(i?n.SOURCE:n.ADD,s=>{const u=ze(r(s));u!=null&&(uo&&(o=u))}),!Number.isFinite(a)||!Number.isFinite(o)){let s=en(r);s&&(s=` for field "${s}"`),n.dataflow.warn(`Infinite extent${s}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),V(Jp,Ut,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),V(dc,O,{activate(t){this._targets[this._targets.active++]=t},subflow(t,n,e,r){const i=this.value;let a,o,s=tt(i,t)&&i[t];return s?s.value.stampr&&r.count>0);this.initTargets(e)}},initTargets(t){const n=this._targets,e=n.length,r=t?t.length:0;let i=0;for(;ithis.subflow(u,i,n);return this._group=t.group||{},this.initTargets(),n.visit(n.REM,u=>{const l=st(u),c=a.get(l);c!==void 0&&(a.delete(l),s(c).rem(u))}),n.visit(n.ADD,u=>{const l=r(u);a.set(st(u),l),s(l).add(u)}),o||n.modified(r.fields)?n.visit(n.MOD,u=>{const l=st(u),c=a.get(l),f=r(u);c===f?s(f).mod(u):(a.set(l,f),s(c).rem(u),s(f).add(u))}):n.changed(n.MOD)&&n.visit(n.MOD,u=>{s(a.get(st(u))).mod(u)}),o&&n.visit(n.REFLOW,u=>{const l=st(u),c=a.get(l),f=r(u);c!==f&&(a.set(l,f),s(c).rem(u),s(f).add(u))}),n.clean()?e.runAfter(()=>{this.clean(),a.clean()}):a.empty>e.cleanThreshold&&e.runAfter(a.clean),n}}),V(B2,Ut),Kp.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},V(Kp,O,{transform(t,n){const e=n.dataflow,r=this.value,i=n.fork(),a=i.add,o=i.rem,s=i.mod,u=t.expr;let l=!0;function c(f){const d=st(f),h=u(f,t),p=r.get(d);h&&p?(r.delete(d),a.push(f)):h||p?l&&h&&!p&&s.push(f):(r.set(d,1),o.push(f))}return n.visit(n.REM,f=>{const d=st(f);r.has(d)?r.delete(d):o.push(f)}),n.visit(n.ADD,f=>{u(f,t)?a.push(f):r.set(st(f),1)}),n.visit(n.MOD,c),t.modified()&&(l=!1,n.visit(n.REFLOW,c)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i}}),Qp.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},V(Qp,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=S2(r,t.as||[]),a=t.index||null,o=i.length;return e.rem=this.value,n.visit(n.SOURCE,s=>{const u=r.map(p=>p(s)),l=u.reduce((p,m)=>Math.max(p,m.length),0);let c,f,d,h=0;for(;h{for(let c,f=0;fo[r]=e(o,t))}}),V(z2,O,{transform(t,n){const e=n.fork(n.ALL),r=t.generator;let i,a,o,s=this.value,u=t.size-s.length;if(u>0){for(i=[];--u>=0;)i.push(o=St(r(t))),s.push(o);e.add=e.add.length?e.materialize(e.ADD).add.concat(i):i}else a=s.slice(0,-u),e.rem=e.rem.length?e.materialize(e.REM).rem.concat(a):a,s=s.slice(-u);return e.source=this.value=s,e}});const hc={value:"value",median:Yx,mean:function(t,n){let e=0,r=0;if(n===void 0)for(let i of t)i!=null&&(i=+i)>=i&&(++e,r+=i);else{let i=-1;for(let a of t)(a=n(a,++i,t))!=null&&(a=+a)>=a&&(++e,r+=a)}if(e)return r/e},min:cp,max:Ca},D9=[];function nm(t){O.call(this,[],t)}function em(t){Li.call(this,t)}function rm(t){O.call(this,null,t)}function O2(t){Ut.call(this,null,F9,t)}function F9(t){return this.value&&!t.modified()?this.value:rp(t.fields,t.flat)}function N2(t){O.call(this,[],t),this._pending=null}function im(t,n,e){e.forEach(St);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r.rem.length&&r.clean(!0),r}function am(t){O.call(this,{},t)}function R2(t){Ut.call(this,null,C9,t)}function C9(t){if(this.value&&!t.modified())return this.value;const n=t.extents,e=n.length;let r,i,a=1/0,o=-1/0;for(r=0;ro&&(o=i[1]);return[a,o]}function T2(t){Ut.call(this,null,E9,t)}function E9(t){return this.value&&!t.modified()?this.value:t.values.reduce((n,e)=>n.concat(e),[])}function P2(t){O.call(this,null,t)}function om(t){Li.call(this,t)}function j2(t){dc.call(this,t)}function sm(t){O.call(this,null,t)}function L2(t){O.call(this,null,t)}function um(t){O.call(this,null,t)}nm.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},V(nm,O,{transform(t,n){var e,r,i,a,o,s,u,l,c,f,d=n.fork(n.ALL),h=function(A){var _,k=A.method||hc.value;if(hc[k]!=null)return k===hc.value?(_=A.value!==void 0?A.value:0,()=>_):hc[k];j("Unrecognized imputation method: "+k)}(t),p=function(A){const _=A.field;return k=>k?_(k):NaN}(t),m=en(t.field),g=en(t.key),y=(t.groupby||[]).map(en),v=function(A,_,k,F){var C,D,E,$,M,S,B,z,N=ot=>ot(z),W=[],X=F?F.slice():[],L={},et={};for(X.forEach((ot,nt)=>L[ot]=nt+1),$=0,B=A.length;$e.add(a))):(i=e.value=e.value||this.init(t),n.visit(n.REM,a=>e.rem(a)),n.visit(n.ADD,a=>e.add(a))),e.changes(),n.visit(n.SOURCE,a=>{xt(a,i[e.cellkey(a)].tuple)}),n.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,n=this._mods;let e,r;for(e=0,r=this._alen;e{const p=Cp(h,o)[s],m=t.counts?h.length:1;fc(p,c||kr(h),f,d).forEach(g=>{const y={};for(let v=0;v(this._pending=K(i.data),a=>a.touch(this)))}:e.request(t.url,t.format).then(r=>im(this,n,K(r.data)))}}),am.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},V(am,O,{transform(t,n){const e=t.fields,r=t.index,i=t.values,a=t.default==null?null:t.default,o=t.modified(),s=e.length;let u,l,c,f=o?n.SOURCE:n.ADD,d=n,h=t.as;return i?(l=i.length,s>1&&!h&&j('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*l&&j('The "as" parameter has too few output field names.'),h=h||i.map(en),u=function(p){for(var m,g,y=0,v=0;yn.modified(p.fields)),f|=c?n.MOD:0),n.visit(f,u),d.modifies(h)}}),V(R2,Ut),V(T2,Ut),V(P2,O,{transform(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),om.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:tu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},V(om,Li,{_transform:Li.prototype.transform,transform(t,n){return this._transform(function(e,r){const i=e.field,a=e.value,o=(e.op==="count"?"__count__":e.op)||"sum",s=Wn(i).concat(Wn(a)),u=function(l,c,f){const d={},h=[];return f.visit(f.SOURCE,p=>{const m=l(p);d[m]||(d[m]=1,h.push(m))}),h.sort(Zh),c?h.slice(0,c):h}(i,e.limit||0,r);return r.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:u.map(()=>o),fields:u.map(l=>function(c,f,d,h){return Do(p=>f(p)===c?d(p):NaN,h,c+"")}(l,i,a,s)),as:u.map(l=>l+""),modified:e.modified.bind(e)}}(t,n),n)}}),V(j2,dc,{transform(t,n){const e=t.subflow,r=t.field,i=a=>this.subflow(st(a),e,n,a);return(t.modified("field")||r&&n.modified(Wn(r)))&&j("PreFacet does not support field modification."),this.initTargets(),r?(n.visit(n.MOD,a=>{const o=i(a);r(a).forEach(s=>o.mod(s))}),n.visit(n.ADD,a=>{const o=i(a);r(a).forEach(s=>o.add(St(s)))}),n.visit(n.REM,a=>{const o=i(a);r(a).forEach(s=>o.rem(s))})):(n.visit(n.MOD,a=>i(a).mod(a)),n.visit(n.ADD,a=>i(a).add(a)),n.visit(n.REM,a=>i(a).rem(a))),n.clean()&&n.runAfter(()=>this.clean()),n}}),sm.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},V(sm,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=S2(t.fields,t.as||[]),a=r?(s,u)=>function(l,c,f,d){for(let h=0,p=f.length;h{const u=st(s);e.rem.push(o[u]),o[u]=null}),n.visit(n.ADD,s=>{const u=a(s,St({}));o[st(s)]=u,e.add.push(u)}),n.visit(n.MOD,s=>{e.mod.push(a(s,o[st(s)]))}),e}}),V(L2,O,{transform(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}}),um.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function q2(t){O.call(this,null,t)}function lm(t){O.call(this,[],t),this.count=0}function cm(t){O.call(this,null,t)}function U2(t){O.call(this,null,t),this.modified(!0)}function fm(t){O.call(this,null,t)}V(um,O,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return e.source=this.value,e;const i=Vp(n.materialize(n.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(en),o=[],s=t.step||.01,u=t.probs||xe(s/2,1-1e-14,s),l=u.length;return i.forEach(c=>{const f=Ap(c,u);for(let d=0;d{const a=st(i);e.rem.push(r[a]),r[a]=null}),n.visit(n.ADD,i=>{const a=vp(i);r[st(i)]=a,e.add.push(a)}),n.visit(n.MOD,i=>{const a=r[st(i)];for(const o in i)a[o]=i[o],e.modifies(o);e.mod.push(a)})),e}}),lm.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},V(lm,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.modified("size"),i=t.size,a=this.value.reduce((c,f)=>(c[st(f)]=1,c),{});let o=this.value,s=this.count,u=0;function l(c){let f,d;o.length=u&&(f=o[d],a[st(f)]&&e.rem.push(f),o[d]=c)),++s}if(n.rem.length&&(n.visit(n.REM,c=>{const f=st(c);a[f]&&(a[f]=-1,e.rem.push(c)),--s}),o=o.filter(c=>a[st(c)]!==-1)),(n.rem.length||r)&&o.length{a[st(c)]||l(c)}),u=-1),r&&o.length>i){const c=o.length-i;for(let f=0;f{a[st(c)]&&e.mod.push(c)}),n.add.length&&n.visit(n.ADD,l),(n.add.length||u<0)&&(e.add=o.filter(c=>!a[st(c)])),this.count=s,this.value=e.source=o,e}}),cm.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},V(cm,O,{transform(t,n){if(this.value&&!t.modified())return;const e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=xe(t.start,t.stop,t.step||1).map(i=>{const a={};return a[r]=i,St(a)}),e.add=n.add.concat(this.value),e}}),V(U2,O,{transform(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});const I2=["unit0","unit1"];function W2(t){O.call(this,Fo(),t)}function H2(t){O.call(this,null,t)}fm.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:ux,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:I2}]},V(fm,O,{transform(t,n){const e=t.field,r=t.interval!==!1,i=t.timezone==="utc",a=this._floor(t,n),o=(i?tp:np)(a.unit).offset,s=t.as||I2,u=s[0],l=s[1],c=a.step;let f=a.start||1/0,d=a.stop||-1/0,h=n.ADD;return(t.modified()||n.changed(n.REM)||n.modified(Wn(e)))&&(h=(n=n.reflow(!0)).SOURCE,f=1/0,d=-1/0),n.visit(h,p=>{const m=e(p);let g,y;m==null?(p[u]=null,r&&(p[l]=null)):(p[u]=g=y=a(m),r&&(p[l]=y=o(g,c)),gd&&(d=y))}),a.start=f,a.stop=d,n.modifies(r?s:u)},_floor(t,n){const e=t.timezone==="utc",{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:nx({extent:t.extent||kr(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),a=ex(r),o=this.value||{},s=(e?rx:ix)(a,i);return s.unit=Bt(a),s.units=a,s.step=i,s.start=o.start,s.stop=o.stop,this.value=s}}),V(W2,O,{transform(t,n){const e=n.dataflow,r=t.field,i=this.value,a=s=>i.set(r(s),s);let o=!0;return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,a)):n.changed()?(n.visit(n.REM,s=>i.delete(r(s))),n.visit(n.ADD,a)):o=!1,this.modified(o),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()}}),V(H2,O,{transform(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(Sa(t.sort)):n.source).map(t.field))}});const nu={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){const t=nu.rank(),n=t.next;return{init:t.init,next:e=>(n(e)-1)/(e.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{const e=n.data,r=n.compare;let i=n.index;if(t0||j("ntile num must be greater than zero.");const e=nu.cume_dist(),r=e.next;return{init:e.init,next:i=>Math.ceil(n*r(i))}},lag:function(t,n){return n=+n||1,{next:e=>{const r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{const r=e.index+n,i=e.data;return rt(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||j("nth_value nth must be greater than zero."),{next:e=>{const r=e.i0+(n-1);return rn=null,next:e=>{const r=t(e.data[e.index]);return r!=null?n=r:n}}},next_value:function(t){let n,e;return{init:()=>(n=null,e=-1),next:r=>{const i=r.data;return r.index<=e?n:(e=function(a,o,s){for(let u=o.length;su[m]=1)}h(t.sort),n.forEach((p,m)=>{const g=e[m],y=r[m],v=i[m]||null,x=en(g),b=x2(p,x,a[m]);if(h(g),o.push(b),tt(nu,p))s.push(function(w,A,_,k){const F=nu[w](A,_);return{init:F.init||ip,update:function(C,D){D[k]=F.next(C)}}}(p,g,y,b));else{if(g==null&&p!=="count"&&j("Null aggregate field specified."),p==="count")return void c.push(b);d=!1;let w=l[x];w||(w=l[x]=[],w.field=g,f.push(w)),w.push(w2(p,v,b))}}),(c.length||f.length)&&(this.cell=function(p,m,g){p=p.map(A=>_2(A,A.field));const y={num:0,agg:null,store:!1,count:m};if(!g)for(var v=p.length,x=y.agg=Array(v),b=0;b0&&!i(a[e],a[e-1])&&(t.i0=n.left(a,a[e])),rt.init()),this.cell&&this.cell.init()},V2.update=function(t,n){const e=this.cell,r=this.windows,i=t.data,a=r&&r.length;let o;if(e){for(o=t.p0;othis.group(i(s));let o=this.state;o&&!e||(o=this.state=new G2(t)),e||n.modified(o.inputs)?(this.value={},n.visit(n.SOURCE,s=>a(s).add(s))):(n.visit(n.REM,s=>a(s).remove(s)),n.visit(n.ADD,s=>a(s).add(s)));for(let s=0,u=this._mlen;s=h;--p)s.point(x[p],b[p]);s.lineEnd(),s.areaEnd()}v&&(x[d]=+t(m,d,f),b[d]=+n(m,d,f),s.point(r?+r(m,d,f):x[d],e?+e(m,d,f):b[d]))}if(g)return s=null,g+""||null}function c(){return Wx().defined(i).curve(o).context(a)}return t=typeof t=="function"?t:t===void 0?B8:Hn(+t),n=typeof n=="function"?n:Hn(n===void 0?0:+n),e=typeof e=="function"?e:e===void 0?z8:Hn(+e),l.x=function(f){return arguments.length?(t=typeof f=="function"?f:Hn(+f),r=null,l):t},l.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Hn(+f),l):t},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Hn(+f),l):r},l.y=function(f){return arguments.length?(n=typeof f=="function"?f:Hn(+f),e=null,l):n},l.y0=function(f){return arguments.length?(n=typeof f=="function"?f:Hn(+f),l):n},l.y1=function(f){return arguments.length?(e=f==null?null:typeof f=="function"?f:Hn(+f),l):e},l.lineX0=l.lineY0=function(){return c().x(t).y(n)},l.lineY1=function(){return c().x(t).y(e)},l.lineX1=function(){return c().x(r).y(n)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Hn(!!f),l):i},l.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),l):o},l.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),l):a},l}const O9={draw(t,n){const e=O8(n/R8);t.moveTo(e,0),t.arc(0,0,e,0,N8)}};function qi(t,n){if(typeof document<"u"&&document.createElement){const e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}const N9=()=>typeof Image<"u"?Image:null;var X2=-.14861,hm=1.78277,pm=-.29227,pc=-.90649,eu=1.97294,J2=eu*pc,K2=eu*hm,Q2=hm*pm-pc*X2;function mm(t,n,e,r){return arguments.length===1?function(i){if(i instanceof Ba)return new Ba(i.h,i.s,i.l,i.opacity);i instanceof Px||(i=d8(i));var a=i.r/255,o=i.g/255,s=i.b/255,u=(Q2*s+J2*a-K2*o)/(Q2+J2-K2),l=s-u,c=(eu*(o-u)-pm*l)/pc,f=Math.sqrt(c*c+l*l)/(eu*u*(1-u)),d=f?Math.atan2(c,l)*V6-120:NaN;return new Ba(d<0?d+360:d,f,u,i.opacity)}(t):new Ba(t,n,e,r??1)}function Ba(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Z2(t){return function(n,e){var r=t((n=mp(n)).h,(e=mp(e)).h),i=Oe(n.s,e.s),a=Oe(n.l,e.l),o=Oe(n.opacity,e.opacity);return function(s){return n.h=r(s),n.s=i(s),n.l=a(s),n.opacity=o(s),n+""}}}h8(Ba,mm,p8(m8,{brighter(t){return t=t==null?Lx:Math.pow(Lx,t),new Ba(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?jx:Math.pow(jx,t),new Ba(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Y6,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Px(255*(n+e*(X2*r+hm*i)),255*(n+e*(pm*r+pc*i)),255*(n+e*(eu*r)),this.opacity)}}));const R9=Z2(pp);var T9=Z2(Oe);function tw(t){return function n(e){function r(i,a){var o=t((i=mm(i)).h,(a=mm(a)).h),s=Oe(i.s,a.s),u=Oe(i.l,a.l),l=Oe(i.opacity,a.opacity);return function(c){return i.h=o(c),i.s=s(c),i.l=u(Math.pow(c,e)),i.opacity=l(c),i+""}}return e=+e,r.gamma=n,r}(1)}const P9=tw(pp);var j9=tw(Oe);function gm(t,n){n===void 0&&(n=t,t=Vs);for(var e=0,r=n.length-1,i=n[0],a=new Array(r<0?0:r);e-t(-n,e)}function ym(t){const n=t(nw,ew),e=n.domain;let r,i,a=10;function o(){return r=function(s){return s===Math.E?Math.log:s===10&&Math.log10||s===2&&Math.log2||(s=Math.log(s),u=>Math.log(u)/s)}(a),i=function(s){return s===10?I9:s===Math.E?Math.exp:u=>Math.pow(s,u)}(a),e()[0]<0?(r=rw(r),i=rw(i),t(q9,U9)):t(nw,ew),n}return n.base=function(s){return arguments.length?(a=+s,o()):a},n.domain=function(s){return arguments.length?(e(s),o()):e()},n.ticks=s=>{const u=e();let l=u[0],c=u[u.length-1];const f=c0){for(;p<=m;++p)for(d=1;dc)break;y.push(h)}}else for(;p<=m;++p)for(d=a-1;d>=1;--d)if(h=p>0?d/i(-p):d*i(p),!(hc)break;y.push(h)}2*y.length{if(s==null&&(s=10),u==null&&(u=a===10?"s":","),typeof u!="function"&&(a%1||(u=h6(u)).precision!=null||(u.trim=!0),u=p6(u)),s===1/0)return u;const l=Math.max(1,a*s/n.ticks().length);return c=>{let f=c/i(Math.round(r(c)));return f*ae(K6(e(),{floor:s=>i(Math.floor(r(s))),ceil:s=>i(Math.ceil(r(s)))})),n}function iw(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function aw(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function vm(t){var n=1,e=t(iw(n),aw(n));return e.constant=function(r){return arguments.length?t(iw(n=+r),aw(n)):n},Eo(e)}function ow(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function W9(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function H9(t){return t<0?-t*t:t*t}function bm(t){var n=t(Ri,Ri),e=1;return n.exponent=function(r){return arguments.length?(e=+r)==1?t(Ri,Ri):e===.5?t(W9,H9):t(ow(e),ow(1/e)):e},Eo(n)}function xm(){var t=bm(dp());return t.copy=function(){return hp(t,xm()).exponent(t.exponent())},$a.apply(t,arguments),t}function mc(){var t,n,e,r,i,a=0,o=1,s=Ri,u=!1;function l(f){return f==null||isNaN(f=+f)?i:s(e===0?.5:(f=(r(f)-t)*e,u?Math.max(0,Math.min(1,f)):f))}function c(f){return function(d){var h,p;return arguments.length?([h,p]=d,s=f(h,p),l):[s(0),s(1)]}}return l.domain=function(f){return arguments.length?([a,o]=f,t=r(a=+a),n=r(o=+o),e=t===n?0:1/(n-t),l):[a,o]},l.clamp=function(f){return arguments.length?(u=!!f,l):u},l.interpolator=function(f){return arguments.length?(s=f,l):s},l.range=c(Vs),l.rangeRound=c(Xl),l.unknown=function(f){return arguments.length?(i=f,l):i},function(f){return r=f,t=f(a),n=f(o),e=t===n?0:1/(n-t),l}}function Ui(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function wm(){var t=Eo(mc()(Ri));return t.copy=function(){return Ui(t,wm())},Ti.apply(t,arguments)}function Am(){var t=bm(mc());return t.copy=function(){return Ui(t,Am()).exponent(t.exponent())},Ti.apply(t,arguments)}function gc(){var t,n,e,r,i,a,o,s=0,u=.5,l=1,c=1,f=Ri,d=!1;function h(m){return isNaN(m=+m)?o:(m=.5+((m=+a(m))-n)*(c*m0?r:1:0}const Bo="linear",ri="log",ru="pow",iu="sqrt",yc="symlog",za="time",Oa="utc",Cr="sequential",zo="diverging",Oo="quantile",vc="quantize",bc="threshold",Dm="ordinal",Fm="point",sw="band",Cm="bin-ordinal",fn="continuous",au="discrete",ou="discretizing",Re="interpolating",Em="temporal";function $m(){const t=qx().unknown(void 0),n=t.domain,e=t.range;let r,i,a=[0,1],o=!1,s=0,u=0,l=.5;function c(){const f=n().length,d=a[1]m+r*y);return e(d?g.reverse():g)}return delete t.unknown,t.domain=function(f){return arguments.length?(n(f),c()):n()},t.range=function(f){return arguments.length?(a=[+f[0],+f[1]],c()):a.slice()},t.rangeRound=function(f){return a=[+f[0],+f[1]],o=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(f){return arguments.length?(o=!!f,c()):o},t.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),s=u,c()):s},t.paddingInner=function(f){return arguments.length?(s=Math.max(0,Math.min(1,f)),c()):s},t.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},t.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},t.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=a[1]a[1-d])?void 0:(m=Math.max(0,Ea(h,v)-1),g=v===x?m:Ea(h,x)-1,v-h[m]>i+1e-10&&++m,d&&(y=m,m=p-g,g=p-y),m>g?void 0:n().slice(m,g+1))},t.invert=function(f){const d=t.invertRange([f,f]);return d&&d[0]},t.copy=function(){return $m().domain(n()).range(a).round(o).paddingInner(s).paddingOuter(u).align(l)},c()}function uw(t){const n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return uw(n())},t}var e7=Array.prototype.map;const r7=Array.prototype.slice,xc=new Map,lw=Symbol("vega_scale");function cw(t){return t[lw]=!0,t}function fw(t){return t&&t[lw]===!0}function Dt(t,n,e){return arguments.length>1?(xc.set(t,function(r,i,a){const o=function(){const s=i();return s.invertRange||(s.invertRange=s.invert?function(u){return function(l){let c,f=l[0],d=l[1];return d=m&&c[h]<=g&&(y<0&&(y=h),f=h);if(!(y<0))return m=u.invertExtent(c[y]),g=u.invertExtent(c[f]),[m[0]===void 0?m[1]:m[0],g[1]===void 0?g[0]:g[1]]}}(s):void 0),s.type=r,cw(s)};return o.metadata=Dr(K(a)),o}(t,n,e)),this):dw(t)?xc.get(t):void 0}function dw(t){return xc.has(t)}function Na(t,n){const e=xc.get(t);return e&&e.metadata[n]}function Sm(t){return Na(t,fn)}function No(t){return Na(t,au)}function Mm(t){return Na(t,ou)}function hw(t){return Na(t,ri)}function pw(t){return Na(t,Re)}function mw(t){return Na(t,Oo)}Dt("identity",function t(n){var e;function r(i){return i==null||isNaN(i=+i)?e:i}return r.invert=r,r.domain=r.range=function(i){return arguments.length?(n=Array.from(i,Tx),r):n.slice()},r.unknown=function(i){return arguments.length?(e=i,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,Tx):[0,1],Eo(r)}),Dt(Bo,l8,fn),Dt(ri,function t(){const n=ym(dp()).domain([1,10]);return n.copy=()=>hp(n,t()).base(n.base()),$a.apply(n,arguments),n},[fn,ri]),Dt(ru,xm,fn),Dt(iu,function(){return xm.apply(null,arguments).exponent(.5)},fn),Dt(yc,function t(){var n=vm(dp());return n.copy=function(){return hp(n,t()).constant(n.constant())},$a.apply(n,arguments)},fn),Dt(za,n8,[fn,Em]),Dt(Oa,function(){return $a.apply(Q6(t8,Z6,A6,w6,x6,b6,v6,y6,g6,m6).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[fn,Em]),Dt(Cr,wm,[fn,Re]),Dt(`${Cr}-${Bo}`,wm,[fn,Re]),Dt(`${Cr}-${ri}`,function t(){var n=ym(mc()).domain([1,10]);return n.copy=function(){return Ui(n,t()).base(n.base())},Ti.apply(n,arguments)},[fn,Re,ri]),Dt(`${Cr}-${ru}`,Am,[fn,Re]),Dt(`${Cr}-${iu}`,function(){return Am.apply(null,arguments).exponent(.5)},[fn,Re]),Dt(`${Cr}-${yc}`,function t(){var n=vm(mc());return n.copy=function(){return Ui(n,t()).constant(n.constant())},Ti.apply(n,arguments)},[fn,Re]),Dt(`${zo}-${Bo}`,function t(){var n=Eo(gc()(Ri));return n.copy=function(){return Ui(n,t())},Ti.apply(n,arguments)},[fn,Re]),Dt(`${zo}-${ri}`,function t(){var n=ym(gc()).domain([.1,1,10]);return n.copy=function(){return Ui(n,t()).base(n.base())},Ti.apply(n,arguments)},[fn,Re,ri]),Dt(`${zo}-${ru}`,_m,[fn,Re]),Dt(`${zo}-${iu}`,function(){return _m.apply(null,arguments).exponent(.5)},[fn,Re]),Dt(`${zo}-${yc}`,function t(){var n=vm(gc());return n.copy=function(){return Ui(n,t()).constant(n.constant())},Ti.apply(n,arguments)},[fn,Re]),Dt(Oo,function t(){var n,e=[],r=[],i=[];function a(){var s=0,u=Math.max(1,r.length);for(i=new Array(u-1);++s0?i[u-1]:e[0],u=i?[a[i-1],r]:[a[c-1],a[c]]},s.unknown=function(l){return arguments.length&&(n=l),s},s.thresholds=function(){return a.slice()},s.copy=function(){return t().domain([e,r]).range(o).unknown(n)},$a.apply(Eo(s),arguments)},ou),Dt(bc,function t(){var n,e=[.5],r=[0,1],i=1;function a(o){return o!=null&&o<=o?r[Ea(e,o,0,i)]:n}return a.domain=function(o){return arguments.length?(e=Array.from(o),i=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(o){return arguments.length?(r=Array.from(o),i=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(o){var s=r.indexOf(o);return[e[s-1],e[s]]},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},$a.apply(a,arguments)},ou),Dt(Cm,function t(){let n=[],e=[];function r(i){return i==null||i!=i?void 0:e[(Ea(n,i)-1)%e.length]}return r.domain=function(i){return arguments.length?(n=function(a){return e7.call(a,ze)}(i),r):n.slice()},r.range=function(i){return arguments.length?(e=r7.call(i),r):e.slice()},r.tickFormat=function(i,a){return c8(n[0],Bt(n),i??10,a)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r},[au,ou]),Dt(Dm,qx,au),Dt(sw,$m,au),Dt(Fm,function(){return uw($m().paddingInner(1))},au);const i7=["clamp","base","constant","exponent"];function gw(t,n){const e=n[0],r=Bt(n)-e;return function(i){return t(e+i*r)}}function wc(t,n,e){return gm(Bm(n||"rgb",e),t)}function yw(t,n){const e=new Array(n),r=n+1;for(let i=0;it[s]?o[s](t[s]()):0),o):In(.5)}function Bm(t,n){const e=L9[function(r){return"interpolate"+r.toLowerCase().split("-").map(i=>i[0].toUpperCase()+i.slice(1)).join("")}(t)];return n!=null&&e&&e.gamma?e.gamma(n):e}function bw(t){if(P(t))return t;const n=t.length/6|0,e=new Array(n);for(let r=0;r1?(ww[t]=n,this):ww[t]}xw({accent:V9,category10:G9,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:Y9,observable10:X9,paired:J9,pastel1:K9,pastel2:Q9,set1:Z9,set2:t7,set3:n7,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},bw),xw({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},t=>wc(bw(t)));const Ac="symbol",a7=t=>P(t)?t.map(n=>String(n)):String(t),o7=(t,n)=>t[1]-n[1],s7=(t,n)=>n[1]-t[1];function Om(t,n,e){let r;return $t(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),e!=null&&(n=Math.min(n,Math.floor(Gl(t.domain())/e||1)+1))),Z(n)&&(r=n.step,n=n.interval),Q(n)&&(n=t.type===za?np(n):t.type==Oa?tp(n):j("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Aw(t,n,e){let r=t.range(),i=r[0],a=Bt(r),o=o7;if(i>a&&(r=a,a=i,i=r,o=s7),i=Math.floor(i),a=Math.ceil(a),n=n.map(s=>[s,t(s)]).filter(s=>i<=s[1]&&s[1]<=a).sort(o).map(s=>s[0]),e>0&&n.length>1){const s=[n[0],Bt(n)];for(;n.length>e&&n.length>=3;)n=n.filter((u,l)=>!(l%2));n.length<3&&(n=s)}return n}function Nm(t,n){return t.bins?Aw(t,t.bins,n):t.ticks?t.ticks(n):t.domain()}function _w(t,n,e,r,i,a){const o=n.type;let s=a7;if(o===za||i===za)s=t.timeFormat(r);else if(o===Oa||i===Oa)s=t.utcFormat(r);else if(hw(o)){const u=t.formatFloat(r);if(a||n.bins)s=u;else{const l=kw(n,e,!1);s=c=>l(c)?u(c):""}}else if(n.tickFormat){const u=n.domain();s=t.formatSpan(u[0],u[u.length-1],e,r)}else r&&(s=t.format(r));return s}function kw(t,n,e){const r=Nm(t,n),i=t.base(),a=Math.log(i),o=Math.max(1,i*n/r.length),s=u=>{let l=u/Math.pow(i,Math.round(Math.log(u)/a));return l*i1?f[1]-f[0]:f[0];for(h=1;hRm[u.type]||u.bins)(n)?u7(s):r==="discrete"?l7(s):c7(s)}const u7=t=>(n,e,r)=>{const i=Ew(r[e+1],Ew(r.max,1/0)),a=$w(n,t),o=$w(i,t);return a&&o?a+" \u2013 "+o:o?"< "+o:"\u2265 "+a},Ew=(t,n)=>t??n,l7=t=>(n,e)=>e?t(n):null,c7=t=>n=>t(n),$w=(t,n)=>Number.isFinite(t)?n(t):null;function f7(t,n,e,r){const i=r||n.type;return Q(e)&&function(a){return Na(a,Em)}(i)&&(e=e.replace(/%a/g,"%A").replace(/%b/g,"%B")),e||i!==za?e||i!==Oa?Cw(t,n,5,null,e,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Sw(t,n,e){e=e||{};const r=Math.max(3,e.maxlen||7),i=f7(t,n,e.format,e.formatType);if(Mm(n.type)){const a=Fw(n).slice(1).map(i),o=a.length;return`${o} boundar${o===1?"y":"ies"}: ${a.join(", ")}`}if(No(n.type)){const a=n.domain(),o=a.length;return`${o} value${o===1?"":"s"}: ${o>r?a.slice(0,r-2).map(i).join(", ")+", ending with "+a.slice(-1).map(i):a.map(i).join(", ")}`}{const a=n.domain();return`values from ${i(a[0])} to ${i(Bt(a))}`}}let Mw=0;const _c="p_";function Tm(t){return t&&t.gradient}function Bw(t,n,e){const r=t.gradient;let i=t.id,a=r==="radial"?_c:"";return i||(i=t.id="gradient_"+Mw++,r==="radial"?(t.x1=Er(t.x1,.5),t.y1=Er(t.y1,.5),t.r1=Er(t.r1,0),t.x2=Er(t.x2,.5),t.y2=Er(t.y2,.5),t.r2=Er(t.r2,.5),a=_c):(t.x1=Er(t.x1,0),t.y1=Er(t.y1,0),t.x2=Er(t.x2,1),t.y2=Er(t.y2,0))),n[i]=t,"url("+(e||"")+"#"+a+i+")"}function Er(t,n){return t??n}function zw(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(i,a){return r.push({offset:i,color:a}),e}}}const Ow={basis:{curve:Z8},"basis-closed":{curve:Q8},"basis-open":{curve:K8},bundle:{curve:J8,tension:"beta",value:.85},cardinal:{curve:X8,tension:"tension",value:0},"cardinal-open":{curve:Y8,tension:"tension",value:0},"cardinal-closed":{curve:V8,tension:"tension",value:0},"catmull-rom":{curve:G8,tension:"alpha",value:.5},"catmull-rom-closed":{curve:H8,tension:"alpha",value:.5},"catmull-rom-open":{curve:W8,tension:"alpha",value:.5},linear:{curve:Ix},"linear-closed":{curve:I8},monotone:{horizontal:U8,vertical:q8},natural:{curve:L8},step:{curve:j8},"step-after":{curve:P8},"step-before":{curve:T8}};function Pm(t,n,e){var r=tt(Ow,t)&&Ow[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&e!=null&&(i=i[r.tension](e))),i}const d7={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},h7=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,p7=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,m7=/^((\s+,?\s*)|(,\s*))/,g7=/^[01]/;function Ro(t){const n=[];return(t.match(h7)||[]).forEach(e=>{let r=e[0];const i=r.toLowerCase(),a=d7[i],o=function(u,l,c){const f=[];for(let d=0;l&&d1&&(b=Math.sqrt(b),s*=b,u*=b);const w=y/s,A=g/s,_=-g/u,k=y/u,F=w*d+A*h,C=_*d+k*h,D=w*a+A*o,E=_*a+k*o;let $=1/((D-F)*(D-F)+(E-C)*(E-C))-.25;$<0&&($=0);let M=Math.sqrt($);c==l&&(M=-M);const S=.5*(F+D)-M*(E-C),B=.5*(C+E)+M*(D-F),z=Math.atan2(C-B,F-S);let N=Math.atan2(E-B,D-S)-z;N<0&&c===1?N+=$r:N>0&&c===0&&(N-=$r);const W=Math.ceil(Math.abs(N/(Ra+.001))),X=[];for(let L=0;L+t}function kc(t,n,e){return Math.max(n,Math.min(t,e))}function Lw(){var t=b7,n=x7,e=w7,r=A7,i=ii(0),a=i,o=i,s=i,u=null;function l(c,f,d){var h,p=f??+t.call(this,c),m=d??+n.call(this,c),g=+e.call(this,c),y=+r.call(this,c),v=Math.min(g,y)/2,x=kc(+i.call(this,c),0,v),b=kc(+a.call(this,c),0,v),w=kc(+o.call(this,c),0,v),A=kc(+s.call(this,c),0,v);if(u||(u=h=gp()),x<=0&&b<=0&&w<=0&&A<=0)u.rect(p,m,g,y);else{var _=p+g,k=m+y;u.moveTo(p+x,m),u.lineTo(_-b,m),u.bezierCurveTo(_-Wi*b,m,_,m+Wi*b,_,m+b),u.lineTo(_,k-A),u.bezierCurveTo(_,k-Wi*A,_-Wi*A,k,_-A,k),u.lineTo(p+w,k),u.bezierCurveTo(p+Wi*w,k,p,k-Wi*w,p,k-w),u.lineTo(p,m+x),u.bezierCurveTo(p,m+Wi*x,p+Wi*x,m,p+x,m),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(c){return arguments.length?(t=ii(c),l):t},l.y=function(c){return arguments.length?(n=ii(c),l):n},l.width=function(c){return arguments.length?(e=ii(c),l):e},l.height=function(c){return arguments.length?(r=ii(c),l):r},l.cornerRadius=function(c,f,d,h){return arguments.length?(i=ii(c),a=f!=null?ii(f):i,s=d!=null?ii(d):i,o=h!=null?ii(h):a,l):i},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function qw(){var t,n,e,r,i,a,o,s,u=null;function l(f,d,h){const p=h/2;if(i){var m=o-d,g=f-a;if(m||g){var y=Math.hypot(m,g),v=(m/=y)*s,x=(g/=y)*s,b=Math.atan2(g,m);u.moveTo(a-v,o-x),u.lineTo(f-m*p,d-g*p),u.arc(f,d,p,b-Math.PI,b),u.lineTo(a+v,o+x),u.arc(a,o,s,b,b+Math.PI)}else u.arc(f,d,p,0,$r);u.closePath()}else i=1;a=f,o=d,s=p}function c(f){var d,h,p,m=f.length,g=!1;for(u==null&&(u=p=gp()),d=0;d<=m;++d)!(dt.x||0,cu=t=>t.y||0,Dc=t=>t.defined!==!1,_7=t9().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),k7=Y2().x(lu).y1(cu).y0(t=>(t.y||0)+(t.height||0)).defined(Dc),D7=Y2().y(cu).x1(lu).x0(t=>(t.x||0)+(t.width||0)).defined(Dc),F7=Wx().x(lu).y(cu).defined(Dc),C7=Lw().x(lu).y(cu).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>uu(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>uu(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>uu(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>uu(t.cornerRadiusBottomLeft,t.cornerRadius)||0),E7=function(t,n){let e=null,r=Ux(i);function i(){let a;if(e||(e=a=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),a)return e=null,a+""||null}return t=typeof t=="function"?t:Hn(t||O9),n=typeof n=="function"?n:Hn(n===void 0?64:+n),i.type=function(a){return arguments.length?(t=typeof a=="function"?a:Hn(a),i):t},i.size=function(a){return arguments.length?(n=typeof a=="function"?a:Hn(+a),i):n},i.context=function(a){return arguments.length?(e=a??null,i):e},i}().type(t=>jw(t.shape||"circle")).size(t=>uu(t.size,64)),$7=qw().x(lu).y(cu).defined(Dc).size(t=>t.size||1);function Um(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Po(t,n,e,r){return C7.context(t)(n,e,r)}var Uw=1;function Iw(){Uw=1}function Im(t,n,e){var r=n.clip,i=t._defs,a=n.clip_id||(n.clip_id="clip"+Uw++),o=i.clipping[a]||(i.clipping[a]={id:a});return bt(r)?o.path=r(null):Um(e)?o.path=Po(null,e,0,0):(o.width=e.width||0,o.height=e.height||0),"url(#"+a+")"}function cn(t){this.clear(),t&&this.union(t)}function Fc(t){this.mark=t,this.bounds=this.bounds||new cn}function Cc(t){Fc.call(this,t),this.items=this.items||[]}cn.prototype={clone(){return new cn(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,n,e,r){return ethis.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},rotate(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,n,e){var{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(t),u=Math.sin(t),l=n-n*s+e*u,c=e-n*u-e*s;return[s*r-u*i+l,u*r+s*i+c,s*r-u*o+l,u*r+s*o+c,s*a-u*i+l,u*a+s*i+c,s*a-u*o+l,u*a+s*o+c]},union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)},contains(t,n){return!(tthis.x2||nthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},V(Cc,Fc);class Ww{constructor(n){this._pending=0,this._loader=n||Hl()}pending(){return this._pending}sanitizeURL(n){const e=this;return Hw(e),e._loader.sanitize(n,{context:"href"}).then(r=>(fu(e),r)).catch(()=>(fu(e),null))}loadImage(n){const e=this,r=N9();return Hw(e),e._loader.sanitize(n,{context:"image"}).then(i=>{const a=i.href;if(!a||!r)throw{url:a};const o=new r,s=tt(i,"crossOrigin")?i.crossOrigin:"anonymous";return s!=null&&(o.crossOrigin=s),o.onload=()=>fu(e),o.onerror=()=>fu(e),o.src=a,o}).catch(i=>(fu(e),{complete:!1,width:0,height:0,src:i&&i.url||""}))}ready(){const n=this;return new Promise(e=>{(function r(i){n.pending()?setTimeout(()=>{r(!0)},10):e(i)})(!1)})}}function Hw(t){t._pending+=1}function fu(t){t._pending-=1}function ai(t,n,e){if(n.stroke&&n.opacity!==0&&n.strokeOpacity!==0){const r=n.strokeWidth!=null?+n.strokeWidth:1;t.expand(r+(e?function(i,a){return i.strokeJoin&&i.strokeJoin!=="miter"?0:a}(n,r):0))}return t}const S7=$r-1e-8;let Ec,$c,Sc,Ta,Wm,Mc,Hm,Gm;const Hi=(t,n)=>Ec.add(t,n),Bc=(t,n)=>Hi($c=t,Sc=n),Gw=t=>Hi(t,Ec.y1),Vw=t=>Hi(Ec.x1,t),Pa=(t,n)=>Wm*t+Hm*n,ja=(t,n)=>Mc*t+Gm*n,Vm=(t,n)=>Hi(Pa(t,n),ja(t,n)),Ym=(t,n)=>Bc(Pa(t,n),ja(t,n));function du(t,n){return Ec=t,n?(Ta=n*Ii,Wm=Gm=Math.cos(Ta),Mc=Math.sin(Ta),Hm=-Mc):(Wm=Gm=1,Ta=Mc=Hm=0),M7}const M7={beginPath(){},closePath(){},moveTo:Ym,lineTo:Ym,rect(t,n,e,r){Ta?(Vm(t+e,n),Vm(t+e,n+r),Vm(t,n+r),Ym(t,n)):(Hi(t+e,n+r),Bc(t,n))},quadraticCurveTo(t,n,e,r){const i=Pa(t,n),a=ja(t,n),o=Pa(e,r),s=ja(e,r);Yw($c,i,o,Gw),Yw(Sc,a,s,Vw),Bc(o,s)},bezierCurveTo(t,n,e,r,i,a){const o=Pa(t,n),s=ja(t,n),u=Pa(e,r),l=ja(e,r),c=Pa(i,a),f=ja(i,a);Xw($c,o,u,c,Gw),Xw(Sc,s,l,f,Vw),Bc(c,f)},arc(t,n,e,r,i,a){if(r+=Ta,i+=Ta,$c=e*Math.cos(i)+t,Sc=e*Math.sin(i)+n,Math.abs(i-r)>S7)Hi(t-e,n-e),Hi(t+e,n+e);else{const o=l=>Hi(e*Math.cos(l)+t,e*Math.sin(l)+n);let s,u;if(o(r),o(i),i!==r)if((r%=$r)<0&&(r+=$r),(i%=$r)<0&&(i+=$r),ii;++u,s-=Ra)o(s);else for(s=r-r%Ra+Ra,u=0;u<4&&s1e-14?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),l=(-o+u)/a,c=(-o-u)/a)):l=.5*s/o,0g)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(t.globalAlpha=e,t.fillStyle=tA(t,n,n.fill),!0)}var B7=[];function qo(t,n,e){var r=(r=n.strokeWidth)!=null?r:1;return!(r<=0)&&(e*=n.strokeOpacity==null?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=tA(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||B7),t.lineDashOffset=n.strokeDashOffset||0),!0)}function z7(t,n){return t.zindex-n.zindex||t.index-n.index}function Qm(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,a=[];for(e=0,r=i.length;e=0;)if(e=n(i[r]))return e;if(i===a){for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e}return null}function Zm(t){return function(n,e,r){Qe(e,i=>{r&&!r.intersects(i.bounds)||nA(t,n,i,i)})}}function O7(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||nA(t,n,e.items[0],e.items)}}function nA(t,n,e,r){var i=e.opacity==null?1:e.opacity;i!==0&&(t(n,r)||(Lo(n,e),e.fill&&zc(n,e,i)&&n.fill(),e.stroke&&qo(n,e,i)&&n.stroke()))}function Nc(t){return t=t||Be,function(n,e,r,i,a,o){return r*=n.pixelRatio,i*=n.pixelRatio,Oc(e,s=>{const u=s.bounds;if((!u||u.contains(a,o))&&u)return t(n,s,r,i,a,o)?s:void 0})}}function hu(t,n){return function(e,r,i,a){var o,s,u=Array.isArray(r)?r[0]:r,l=n??u.fill,c=u.stroke&&e.isPointInStroke;return c&&(o=u.strokeWidth,s=u.strokeCap,e.lineWidth=o??1,e.lineCap=s??"butt"),!t(e,r)&&(l&&e.isPointInPath(i,a)||c&&e.isPointInStroke(i,a))}}function t0(t){return Nc(hu(t))}function La(t,n){return"translate("+t+","+n+")"}function n0(t){return"rotate("+t+")"}function eA(t){return La(t.x||0,t.y||0)}function e0(t,n,e){function r(i,a){var o=a.x||0,s=a.y||0,u=a.angle||0;i.translate(o,s),u&&i.rotate(u*=Ii),i.beginPath(),n(i,a),u&&i.rotate(-u),i.translate(-o,-s)}return{type:t,tag:"path",nested:!1,attr:function(i,a){i("transform",function(o){return La(o.x||0,o.y||0)+(o.angle?" "+n0(o.angle):"")}(a)),i("d",n(null,a))},bound:function(i,a){return n(du(i,a.angle),a),ai(i,a).translate(a.x||0,a.y||0)},draw:Zm(r),pick:t0(r),isect:e||Jm(r)}}var N7=e0("arc",function(t,n){return _7.context(t)(n)});function r0(t,n,e){function r(a,o){a.beginPath(),n(a,o)}const i=hu(r);return{type:t,tag:"path",nested:!0,attr:function(a,o){var s=o.mark.items;s.length&&a("d",n(null,s))},bound:function(a,o){var s=o.items;return s.length===0?a:(n(du(a),s),ai(a,s[0]))},draw:O7(r),pick:function(a,o,s,u,l,c){var f=o.items,d=o.bounds;return!f||!f.length||d&&!d.contains(l,c)?null:(s*=a.pixelRatio,u*=a.pixelRatio,i(a,f,s,u)?f[0]:null)},isect:Km,tip:e}}var R7=r0("area",function(t,n){const e=n[0],r=e.interpolate||"linear";return(e.orient==="horizontal"?D7:k7).curve(Pm(r,e.orient,e.tension)).context(t)(n)},function(t,n){for(var e,r,i=t[0].orient==="horizontal"?n[1]:n[0],a=t[0].orient==="horizontal"?"y":"x",o=t.length,s=1/0;--o>=0;)t[o].defined!==!1&&(r=Math.abs(t[o][a]-i)).5&&n<1.5?.5-Math.abs(n-1):0}function aA(t,n){const e=iA(n);t("d",Po(null,n,e,e))}function pu(t,n,e,r){const i=iA(n);t.beginPath(),Po(t,n,(e||0)+i,(r||0)+i)}const T7=hu(pu),P7=hu(pu,!1),j7=hu(pu,!0);var L7={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",eA(n))},bound:function(t,n){if(!n.clip&&n.items){const e=n.items,r=e.length;for(let i=0;i{const a=i.x||0,o=i.y||0,s=i.strokeForeground,u=i.opacity==null?1:i.opacity;(i.stroke||i.fill)&&u&&(pu(t,i,a,o),Lo(t,i),i.fill&&zc(t,i,u)&&t.fill(),i.stroke&&!s&&qo(t,i,u)&&t.stroke()),t.save(),t.translate(a,o),i.clip&&rA(t,i),e&&e.translate(-a,-o),Qe(i,l=>{(l.marktype==="group"||r==null||r.includes(l.marktype))&&this.draw(t,l,e,r)}),e&&e.translate(a,o),t.restore(),s&&i.stroke&&u&&(pu(t,i,a,o),Lo(t,i),qo(t,i,u)&&t.stroke())})},pick:function(t,n,e,r,i,a){if(n.bounds&&!n.bounds.contains(i,a)||!n.items)return null;const o=e*t.pixelRatio,s=r*t.pixelRatio;return Oc(n,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(i,a))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),p=f+(u.height||0),m=u.clip;if(m&&(ih||ap))return;if(t.save(),t.translate(c,f),c=i-c,f=a-f,m&&Um(u)&&!j7(t,u,o,s))return t.restore(),null;const g=u.strokeForeground,y=n.interactive!==!1;return y&&g&&u.stroke&&P7(t,u,o,s)?(t.restore(),u):(l=Oc(u,v=>function(x,b,w){return(x.interactive!==!1||x.marktype==="group")&&x.bounds&&x.bounds.contains(b,w)}(v,c,f)?this.pick(v,e,r,c,f):null),!l&&y&&(u.fill||!g&&u.stroke)&&T7(t,u,o,s)&&(l=u),t.restore(),l||null)})},isect:Kw,content:function(t,n,e){t("clip-path",n.clip?Im(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),aA(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?aA(t,n):t("d","")}},mu={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function i0(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then(r=>{t.image=r,t.image.url=t.url})),e}function a0(t,n){return t.width!=null?t.width:n&&n.width?t.aspect!==!1&&t.height?t.height*n.width/n.height:n.width:0}function o0(t,n){return t.height!=null?t.height:n&&n.height?t.aspect!==!1&&t.width?t.width*n.height/n.width:n.height:0}function Rc(t,n){return t==="center"?n/2:t==="right"?n:0}function Tc(t,n){return t==="middle"?n/2:t==="bottom"?n:0}var q7={type:"image",tag:"image",nested:!1,attr:function(t,n,e){const r=i0(n,e),i=a0(n,r),a=o0(n,r),o=(n.x||0)-Rc(n.align,i),s=(n.y||0)-Tc(n.baseline,a);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",mu["xmlns:xlink"],"xlink:href"),t("transform",La(o,s)),t("width",i),t("height",a),t("preserveAspectRatio",n.aspect===!1?"none":"xMidYMid")},bound:function(t,n){const e=n.image,r=a0(n,e),i=o0(n,e),a=(n.x||0)-Rc(n.align,r),o=(n.y||0)-Tc(n.baseline,i);return t.set(a,o,a+r,o+i)},draw:function(t,n,e){Qe(n,r=>{if(e&&!e.intersects(r.bounds))return;const i=i0(r,this);let a=a0(r,i),o=o0(r,i);if(a===0||o===0)return;let s,u,l,c,f=(r.x||0)-Rc(r.align,a),d=(r.y||0)-Tc(r.baseline,o);r.aspect!==!1&&(u=i.width/i.height,l=r.width/r.height,u==u&&l==l&&u!==l&&(l=0;)if(t[a].defined!==!1&&(e=t[a].x-n[0])*e+(r=t[a].y-n[1])*r{if(!e||e.intersects(r.bounds)){var i=r.opacity==null?1:r.opacity;i&&sA(t,r,i)&&(Lo(t,r),t.stroke())}})},pick:Nc(function(t,n,e,r){return!!t.isPointInStroke&&sA(t,n,1)&&t.isPointInStroke(e,r)}),isect:Qw},G7=e0("shape",function(t,n){return(n.mark.shape||n.shape).context(t)(n)}),V7=e0("symbol",function(t,n){return E7.context(t)(n)},Km);const uA=cx();var we={height:Sr,measureWidth:s0,estimateWidth:jc,width:jc,canvas:lA};function lA(t){we.width=t&&Gi?s0:jc}function jc(t,n){return cA(Yi(t,n),Sr(t))}function cA(t,n){return~~(.8*t.length*n)}function s0(t,n){return Sr(t)<=0||!(n=Yi(t,n))?0:fA(n,Lc(t))}function fA(t,n){const e=`(${n}) ${t}`;let r=uA.get(e);return r===void 0&&(Gi.font=n,r=Gi.measureText(t).width,uA.set(e,r)),r}function Sr(t){return t.fontSize!=null?+t.fontSize||0:11}function Vi(t){return t.lineHeight!=null?t.lineHeight:Sr(t)+2}function gu(t){return n=t.lineBreak&&t.text&&!P(t.text)?t.text.split(t.lineBreak):t.text,P(n)?n.length>1?n:n[0]:n;var n}function u0(t){const n=gu(t);return(P(n)?n.length-1:0)*Vi(t)}function Yi(t,n){const e=n==null?"":(n+"").trim();return t.limit>0&&e.length?function(r,i){var a=+r.limit,o=function(d){if(we.width===s0){const h=Lc(d);return p=>fA(p,h)}if(we.width===jc){const h=Sr(d);return p=>cA(p,h)}return h=>we.width(d,h)}(r);if(o(i)>>1,o(i.slice(s))>a?c=s+1:f=s;return u+i.slice(c)}for(;c>>1),o(i.slice(0,s))Math.max(d,we.width(n,h)),0)):r=we.width(n,f),a==="center"?l-=r/2:a==="right"&&(l-=r),t.set(l+=s,c+=u,l+r,c+i),n.angle&&!e)t.rotate(n.angle*Ii,s,u);else if(e===2)return t.rotatedPoints(n.angle*Ii,s,u);return t}var X7={type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+l0(n),a=qc(n),o=a.x1,s=a.y1,u=n.angle||0;t("text-anchor",Y7[n.align]||"start"),u?(e=La(o,s)+" "+n0(u),(r||i)&&(e+=" "+La(r,i))):e=La(o+r,s+i),t("transform",e)},bound:c0,draw:function(t,n,e){Qe(n,r=>{var i,a,o,s,u,l,c,f=r.opacity==null?1:r.opacity;if(!(e&&!e.intersects(r.bounds)||f===0||r.fontSize<=0||r.text==null||r.text.length===0)){if(t.font=Lc(r),t.textAlign=r.align||"left",a=(i=qc(r)).x1,o=i.y1,r.angle&&(t.save(),t.translate(a,o),t.rotate(r.angle*Ii),a=o=0),a+=r.dx||0,o+=(r.dy||0)+l0(r),l=gu(r),Lo(t,r),P(l))for(u=Vi(r),s=0;s=0;)if(t[i].defined!==!1&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null}),Ae={arc:N7,area:R7,group:L7,image:q7,line:U7,path:I7,rect:W7,rule:H7,shape:G7,symbol:V7,text:X7,trail:J7};function f0(t,n,e){var r=Ae[t.mark.marktype],i=n||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new cn),t,e)}var dA={mark:null};function hA(t,n,e){var r,i,a,o,s=Ae[t.marktype],u=s.bound,l=t.items,c=l&&l.length;if(s.nested)return c?a=l[0]:(dA.mark=t,a=dA),o=f0(a,u,e),n=n&&n.union(o)||o;if(n=n||t.bounds&&t.bounds.clear()||new cn,c)for(r=0,i=l.length;rn;)t.removeChild(e[--r]);return t}function bA(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Uc(t,n){const e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}class h0{constructor(n,e){this._active=null,this._handlers={},this._loader=n||Hl(),this._tooltip=e||Q7}initialize(n,e,r){return this._el=n,this._obj=r||null,this.origin(e)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(n){return arguments.length?(this._origin=n||[0,0],this):this._origin.slice()}scene(n){return arguments.length?(this._scene=n,this):this._scene}on(){}off(){}_handlerIndex(n,e,r){for(let i=n?n.length:0;--i>=0;)if(n[i].type===e&&(!r||n[i].handler===r))return i;return-1}handlers(n){const e=this._handlers,r=[];if(n)r.push(...e[this.eventName(n)]);else for(const i in e)r.push(...e[i]);return r}eventName(n){const e=n.indexOf(".");return e<0?n:n.slice(0,e)}handleHref(n,e,r){this._loader.sanitize(r,{context:"href"}).then(i=>{const a=new MouseEvent(n.type,n),o=Xi(null,"a");for(const s in i)o.setAttribute(s,i[s]);o.dispatchEvent(a)}).catch(()=>{})}handleTooltip(n,e,r){if(e&&e.tooltip!=null){e=function(a,o,s,u){var l,c,f=a&&a.mark;if(f&&(l=Ae[f.marktype]).tip){for((c=Uc(o,s))[0]-=u[0],c[1]-=u[1];a=a.mark.group;)c[0]-=a.x||0,c[1]-=a.y||0;a=l.tip(f.items,c)}return a}(e,n,this.canvas(),this._origin);const i=r&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,n,e,i)}}getItemBoundingClientRect(n){const e=this.canvas();if(!e)return;const r=e.getBoundingClientRect(),i=this._origin,a=n.bounds,o=a.width(),s=a.height();let u=a.x1+i[0]+r.left,l=a.y1+i[1]+r.top;for(;n.mark&&(n=n.mark.group);)u+=n.x||0,l+=n.y||0;return{x:u,y:l,width:o,height:s,left:u,top:l,right:u+o,bottom:l+s}}}function Q7(t,n,e,r){t.element().setAttribute("title",r||"")}class bu{constructor(n){this._el=null,this._bgcolor=null,this._loader=new Ww(n)}initialize(n,e,r,i,a){return this._el=n,this.resize(e,r,i,a)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(n){return arguments.length===0?this._bgcolor:(this._bgcolor=n,this)}resize(n,e,r,i){return this._width=n,this._height=e,this._origin=r||[0,0],this._scale=i||1,this}dirty(){}render(n,e){const r=this;return r._call=function(){r._render(n,e)},r._call(),r._call=null,r}_render(){}renderAsync(n,e){const r=this.render(n,e);return this._ready?this._ready.then(()=>r):Promise.resolve(r)}_load(n,e){var r=this,i=r._loader[n](e);if(!r._ready){const a=r._call;r._ready=r._loader.ready().then(o=>{o&&a(),r._ready=null})}return i}sanitizeURL(n){return this._load("sanitizeURL",n)}loadImage(n){return this._load("loadImage",n)}}const xA="dragenter",Ic="dragleave",wA="dragover",p0="pointerdown",Wc="pointermove",Hc="pointerout",AA="pointerover",m0="mousedown",_A="mousemove",Gc="mouseout",kA="mouseover",Vc="click",DA="mousewheel",Yc="touchstart",Xc="touchmove",Jc="touchend",Z7=["keydown","keypress","keyup",xA,Ic,wA,p0,"pointerup",Wc,Hc,AA,m0,"mouseup",_A,Gc,kA,Vc,"dblclick","wheel",DA,Yc,Xc,Jc],g0=Wc,xu=Gc,y0=Vc;class wu extends h0{constructor(n,e){super(n,e),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Z7,this.pointermove=CA([Wc,_A],[AA,kA],[Hc,Gc]),this.dragover=CA([wA],[xA],[Ic]),this.pointerout=EA([Hc,Gc]),this.dragleave=EA([Ic])}initialize(n,e,r){return this._canvas=n&&d0(n,"canvas"),[Vc,m0,p0,Wc,Hc,Ic].forEach(i=>FA(this,i)),super.initialize(n,e,r)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(n){this.fire(DA,n)}pointerdown(n){this._down=this._active,this.fire(p0,n)}mousedown(n){this._down=this._active,this.fire(m0,n)}click(n){this._down===this._active&&(this.fire(Vc,n),this._down=null)}touchstart(n){this._touch=this.pickEvent(n.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Yc,n,!0)}touchmove(n){this.fire(Xc,n,!0)}touchend(n){this.fire(Jc,n,!0),this._touch=null}fire(n,e,r){const i=r?this._touch:this._active,a=this._handlers[n];if(e.vegaType=n,n===y0&&i&&i.href?this.handleHref(e,i,i.href):n!==g0&&n!==xu||this.handleTooltip(e,i,n!==xu),a)for(let o=0,s=a.length;o=0&&i.splice(a,1),this}pickEvent(n){const e=Uc(n,this._canvas),r=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-r[0],e[1]-r[1])}pick(n,e,r,i,a){const o=this.context();return Ae[n.marktype].pick.call(this,o,n,e,r,i,a)}}const t4=t=>t===Yc||t===Xc||t===Jc?[Yc,Xc,Jc]:[t];function FA(t,n){t4(n).forEach(e=>function(r,i){const a=r.canvas();a&&!r._events[i]&&(r._events[i]=1,a.addEventListener(i,r[i]?o=>r[i](o):o=>r.fire(i,o)))}(t,e))}function Kc(t,n,e){n.forEach(r=>t.fire(r,e))}function CA(t,n,e){return function(r){const i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||Kc(this,e,r),this._active=a,Kc(this,n,r)),Kc(this,t,r)}}function EA(t){return function(n){Kc(this,t,n),this._active=null}}function n4(t,n,e,r,i,a){const o=typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.parentNode!=null,s=t.getContext("2d"),u=o?typeof window<"u"&&window.devicePixelRatio||1:i;t.width=n*u,t.height=e*u;for(const l in a)s[l]=a[l];return o&&u!==1&&(t.style.width=n+"px",t.style.height=e+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*r[0],u*r[1]),t}class Qc extends bu{constructor(n){super(n),this._options={},this._redraw=!1,this._dirty=new cn,this._tempb=new cn}initialize(n,e,r,i,a,o){return this._options=o||{},this._canvas=this._options.externalContext?null:qi(1,1,this._options.type),n&&this._canvas&&(Pe(n,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(n,e,r,i,a)}resize(n,e,r,i){if(super.resize(n,e,r,i),this._canvas)n4(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const a=this._options.externalContext;a||j("CanvasRenderer is missing a valid canvas or context"),a.scale(this._scale,this._scale),a.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(n){const e=this._tempb.clear().union(n.bounds);let r=n.mark.group;for(;r;)e.translate(r.x||0,r.y||0),r=r.mark.group;this._dirty.union(e)}_render(n,e){const r=this.context(),i=this._origin,a=this._width,o=this._height,s=this._dirty,u=e4(i,a,o);r.save();const l=this._redraw||s.empty()?(this._redraw=!1,u.expand(1)):function(c,f,d){return f.expand(1).round(),c.pixelRatio%1&&f.scale(c.pixelRatio).round().scale(1/c.pixelRatio),f.translate(-d[0]%1,-d[1]%1),c.beginPath(),c.rect(f.x1,f.y1,f.width(),f.height()),c.clip(),f}(r,u.intersect(s),i);return this.clear(-i[0],-i[1],a,o),this.draw(r,n,l,e),r.restore(),s.clear(),this}draw(n,e,r,i){if(e.marktype!=="group"&&i!=null&&!i.includes(e.marktype))return;const a=Ae[e.marktype];e.clip&&function(o,s){var u=s.clip;o.save(),bt(u)?(o.beginPath(),u(o),o.clip()):rA(o,s.group)}(n,e),a.draw.call(this,n,e,r,i),e.clip&&n.restore()}clear(n,e,r,i){const a=this._options,o=this.context();a.type==="pdf"||a.externalContext||o.clearRect(n,e,r,i),this._bgcolor!=null&&(o.fillStyle=this._bgcolor,o.fillRect(n,e,r,i))}}const e4=(t,n,e)=>new cn().set(0,0,n,e).translate(-t[0],-t[1]);class $A extends h0{constructor(n,e){super(n,e);const r=this;r._hrefHandler=v0(r,(i,a)=>{a&&a.href&&r.handleHref(i,a,a.href)}),r._tooltipHandler=v0(r,(i,a)=>{r.handleTooltip(i,a,i.type!==xu)})}initialize(n,e,r){let i=this._svg;return i&&(i.removeEventListener(y0,this._hrefHandler),i.removeEventListener(g0,this._tooltipHandler),i.removeEventListener(xu,this._tooltipHandler)),this._svg=i=n&&d0(n,"svg"),i&&(i.addEventListener(y0,this._hrefHandler),i.addEventListener(g0,this._tooltipHandler),i.addEventListener(xu,this._tooltipHandler)),super.initialize(n,e,r)}canvas(){return this._svg}on(n,e){const r=this.eventName(n),i=this._handlers;if(this._handlerIndex(i[r],n,e)<0){const a={type:n,handler:e,listener:v0(this,e)};(i[r]||(i[r]=[])).push(a),this._svg&&this._svg.addEventListener(r,a.listener)}return this}off(n,e){const r=this.eventName(n),i=this._handlers[r],a=this._handlerIndex(i,n,e);return a>=0&&(this._svg&&this._svg.removeEventListener(r,i[a].listener),i.splice(a,1)),this}}const v0=(t,n)=>e=>{let r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)},SA="aria-hidden",b0="aria-label",x0="role",w0="aria-roledescription",MA="graphics-object",A0="graphics-symbol",BA=(t,n,e)=>({[x0]:t,[w0]:n,[b0]:e||void 0}),r4=Dr(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),zA={axis:{desc:"axis",caption:function(t){const n=t.datum,e=t.orient,r=n.title?PA(t):null,i=t.context,a=i.scales[n.scale].value,o=i.dataflow.locale(),s=a.type;return`${e==="left"||e==="right"?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${No(s)?"discrete":s} scale with ${Sw(o,a,t)}`}},legend:{desc:"legend",caption:function(t){const n=t.datum,e=n.title?PA(t):null,r=`${n.type||""} legend`.trim(),i=n.scales,a=Object.keys(i),o=t.context,s=o.scales[i[a[0]]].value,u=o.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(e?` titled '${e}'`:"")+` for ${function(c){return c=c.map(f=>f+(f==="fill"||f==="stroke"?" color":"")),c.length<2?c[0]:c.slice(0,-1).join(", ")+" and "+Bt(c)}(a)} with ${Sw(u,s,t)}`;var l}},"title-text":{desc:"title",caption:t=>`Title text '${TA(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${TA(t)}'`}},OA={ariaRole:x0,ariaRoleDescription:w0,description:b0};function NA(t,n){const e=n.aria===!1;if(t(SA,e||void 0),e||n.description==null)for(const r in OA)t(OA[r],void 0);else{const r=n.mark.marktype;t(b0,n.description),t(x0,n.ariaRole||(r==="group"?MA:A0)),t(w0,n.ariaRoleDescription||`${r} mark`)}}function RA(t){return t.aria===!1?{[SA]:!0}:r4[t.role]?null:zA[t.role]?function(n,e){try{const r=n.items[0],i=e.caption||(()=>"");return BA(e.role||A0,e.desc,r.description||i(r))}catch{return null}}(t,zA[t.role]):function(n){const e=n.marktype,r=e==="group"||e==="text"||n.items.some(i=>i.description!=null&&i.aria!==!1);return BA(r?MA:A0,`${e} mark container`,n.description)}(t)}function TA(t){return K(t.text).join(" ")}function PA(t){try{return K(Bt(t.items).items[0].text).join(" ")}catch{return null}}const jA=t=>(t+"").replace(/&/g,"&").replace(//g,">");function _0(){let t="",n="",e="";const r=[],i=()=>n=e="",a=(s,u)=>{var l;return u!=null&&(n+=` ${s}="${l=u,jA(l).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ")}"`),o},o={open(s){(f=>{n&&(t+=`${n}>${e}`,i()),r.push(f)})(s),n="<"+s;for(var u=arguments.length,l=new Array(u>1?u-1:0),c=1;c${e}`:"/>"):``,i(),o},attr:a,text:s=>(e+=jA(s),o),toString:()=>t};return o}const LA=t=>qA(_0(),t)+"";function qA(t,n){if(t.open(n.tagName),n.hasAttributes()){const e=n.attributes,r=e.length;for(let i=0;i{c.dirty=e})),i.zdirty||(r.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):r._svg&&(l=r._svg.parentNode,l&&l.removeChild(r._svg)),r._svg=null):(r=o.nested?i.items[0]:r,r._update!==e&&(r._svg&&r._svg.ownerSVGElement?this._update(o,r._svg,r):(this._dirtyAll=!1,WA(r,e)),r._update=e)));return!this._dirtyAll}mark(n,e,r,i){if(!this.isDirty(e))return e._svg;const a=this._svg,o=e.marktype,s=Ae[o],u=e.interactive===!1?"none":null,l=s.tag==="g",c=HA(e,n,r,"g",a);if(o!=="group"&&i!=null&&!i.includes(o))return Pe(c,0),e._svg;c.setAttribute("class",bA(e));const f=RA(e);for(const m in f)Vn(c,m,f[m]);l||Vn(c,"pointer-events",u),Vn(c,"clip-path",e.clip?Im(this,e,e.group):null);let d=null,h=0;const p=m=>{const g=this.isDirty(m),y=HA(m,c,d,s.tag,a);g&&(this._update(s,y,m),l&&function(v,x,b,w){x=x.lastChild.previousSibling;let A,_=0;Qe(b,k=>{A=v.mark(x,k,A,w),++_}),Pe(x,1+_)}(this,y,m,i)),d=y,++h};return s.nested?e.items.length&&p(e.items[0]):Qe(e,p),Pe(c,h),c}_update(n,e,r){oi=e,On=e.__values__,NA(Au,r),n.attr(Au,r,this);const i=o4[n.type];i&&i.call(this,n,e,r),oi&&this.style(oi,r)}style(n,e){if(e!=null){for(const r in Zc){let i=r==="font"?yu(e):e[r];if(i===On[r])continue;const a=Zc[r];i==null?n.removeAttribute(a):(Tm(i)&&(i=Bw(i,this._defs.gradient,GA())),n.setAttribute(a,i+"")),On[r]=i}for(const r in tf)nf(n,tf[r],e[r])}}defs(){const n=this._svg,e=this._defs;let r=e.el,i=0;for(const a in e.gradient)r||(e.el=r=dn(n,1,"defs",hn)),i=i4(r,e.gradient[a],i);for(const a in e.clipping)r||(e.el=r=dn(n,1,"defs",hn)),i=a4(r,e.clipping[a],i);r&&(i===0?(n.removeChild(r),e.el=null):Pe(r,i))}_clearDefs(){const n=this._defs;n.gradient={},n.clipping={}}}function WA(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function i4(t,n,e){let r,i,a;if(n.gradient==="radial"){let o=dn(t,e++,"pattern",hn);Ji(o,{id:_c+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),o=dn(o,0,"rect",hn),Ji(o,{width:1,height:1,fill:`url(${GA()}#${n.id})`}),Ji(t=dn(t,e++,"radialGradient",hn),{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else Ji(t=dn(t,e++,"linearGradient",hn),{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(r=0,i=n.stops.length;r1&&s.previousSibling!=u}(o,e))&&n.insertBefore(o,e?e.nextSibling:n.firstChild),o}let oi=null,On=null;const o4={group(t,n,e){const r=oi=n.childNodes[2];On=r.__values__,t.foreground(Au,e,this),On=n.__values__,oi=n.childNodes[1],t.content(Au,e,this);const i=oi=n.childNodes[0];t.background(Au,e,this);const a=e.mark.interactive===!1?"none":null;if(a!==On.events&&(Vn(r,"pointer-events",a),Vn(i,"pointer-events",a),On.events=a),e.strokeForeground&&e.stroke){const o=e.fill;Vn(r,"display",null),this.style(i,e),Vn(i,"stroke",null),o&&(e.fill=null),On=r.__values__,this.style(r,e),o&&(e.fill=o),oi=null}else Vn(r,"display","none")},image(t,n,e){e.smooth===!1?(nf(n,"image-rendering","optimizeSpeed"),nf(n,"image-rendering","pixelated")):nf(n,"image-rendering",null)},text(t,n,e){const r=gu(e);let i,a,o,s;P(r)?(a=r.map(u=>Yi(e,u)),i=a.join(` +`),i!==On.text&&(Pe(n,0),o=n.ownerDocument,s=Vi(e),a.forEach((u,l)=>{const c=Xi(o,"tspan",hn);c.__data__=e,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",s)),n.appendChild(c)}),On.text=i)):(a=Yi(e,r),a!==On.text&&(n.textContent=a,On.text=a)),Vn(n,"font-family",yu(e)),Vn(n,"font-size",Sr(e)+"px"),Vn(n,"font-style",e.fontStyle),Vn(n,"font-variant",e.fontVariant),Vn(n,"font-weight",e.fontWeight)}};function Au(t,n,e){n!==On[t]&&(e?function(r,i,a,o){a!=null?r.setAttributeNS(o,i,a):r.removeAttributeNS(o,i)}(oi,t,n,e):Vn(oi,t,n),On[t]=n)}function nf(t,n,e){e!==On[n]&&(e==null?t.style.removeProperty(n):t.style.setProperty(n,e+""),On[n]=e)}function Ji(t,n){for(const e in n)Vn(t,e,n[e])}function Vn(t,n,e){e!=null?t.setAttribute(n,e):t.removeAttribute(n)}function GA(){let t;return typeof window>"u"?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class VA extends bu{constructor(n){super(n),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(n){const e=_0();e.open("svg",xt({},mu,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const r=this._bgcolor;return r&&r!=="transparent"&&r!=="none"&&e.open("rect",{width:this._width,height:this._height,fill:r}).close(),e.open("g",UA,{transform:"translate("+this._origin+")"}),this.mark(e,n),e.close(),this.defs(e),this._text=e.close()+"",this}mark(n,e){const r=Ae[e.marktype],i=r.tag,a=[NA,r.attr];n.open("g",{class:bA(e),"clip-path":e.clip?Im(this,e,e.group):null},RA(e),{"pointer-events":i!=="g"&&e.interactive===!1?"none":null});const o=s=>{const u=this.href(s);if(u&&n.open("a",u),n.open(i,this.attr(e,s,a,i!=="g"?i:null)),i==="text"){const l=gu(s);if(P(l)){const c={x:0,dy:Vi(s)};for(let f=0;fthis.mark(n,d)),n.close(),l&&f?(c&&(s.fill=null),s.stroke=f,n.open("path",this.attr(e,s,r.foreground,"bgrect")).close(),c&&(s.fill=c)):n.open("path",this.attr(e,s,r.foreground,"bgfore")).close()}n.close(),u&&n.close()};return r.nested?e.items&&e.items.length&&o(e.items[0]):Qe(e,o),n.close()}href(n){const e=n.href;let r;if(e){if(r=this._hrefs&&this._hrefs[e])return r;this.sanitizeURL(e).then(i=>{i["xlink:href"]=i.href,i.href=null,(this._hrefs||(this._hrefs={}))[e]=i})}return null}attr(n,e,r,i){const a={},o=(s,u,l,c)=>{a[c||s]=u};return Array.isArray(r)?r.forEach(s=>s(o,e,this)):r(o,e,this),i&&function(s,u,l,c,f){let d;if(u==null||(c==="bgrect"&&l.interactive===!1&&(s["pointer-events"]="none"),c==="bgfore"&&(l.interactive===!1&&(s["pointer-events"]="none"),s.display="none",u.fill!==null)))return s;c==="image"&&u.smooth===!1&&(d=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),c==="text"&&(s["font-family"]=yu(u),s["font-size"]=Sr(u)+"px",s["font-style"]=u.fontStyle,s["font-variant"]=u.fontVariant,s["font-weight"]=u.fontWeight);for(const h in Zc){let p=u[h];const m=Zc[h];(p!=="transparent"||m!=="fill"&&m!=="stroke")&&p!=null&&(Tm(p)&&(p=Bw(p,f.gradient,"")),s[m]=p)}for(const h in tf){const p=u[h];p!=null&&(d=d||[],d.push(`${tf[h]}: ${p};`))}d&&(s.style=d.join(" "))}(a,e,n,i,this._defs),a}defs(n){const e=this._defs.gradient,r=this._defs.clipping;if(Object.keys(e).length+Object.keys(r).length!==0){n.open("defs");for(const i in e){const a=e[i],o=a.stops;a.gradient==="radial"?(n.open("pattern",{id:_c+i,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),n.open("rect",{width:"1",height:"1",fill:"url(#"+i+")"}).close(),n.close(),n.open("radialGradient",{id:i,fx:a.x1,fy:a.y1,fr:a.r1,cx:a.x2,cy:a.y2,r:a.r2})):n.open("linearGradient",{id:i,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2});for(let s=0;s!Ze.svgMarkTypes.includes(i));this._svgRenderer.render(n,Ze.svgMarkTypes),this._canvasRenderer.render(n,r)}resize(n,e,r,i){return super.resize(n,e,r,i),this._svgRenderer.resize(n,e,r,i),this._canvasRenderer.resize(n,e,r,i),this}background(n){return Ze.svgOnTop?this._canvasRenderer.background(n):this._svgRenderer.background(n),this}}class YA extends wu{constructor(n,e){super(n,e)}initialize(n,e,r){const i=dn(dn(n,0,"div"),Ze.svgOnTop?0:1,"div");return super.initialize(i,e,r)}}const XA="canvas",JA="hybrid",KA="none",Ki={Canvas:XA,PNG:"png",SVG:"svg",Hybrid:JA,None:KA},qa={};function ef(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?(qa[t]=n,this):qa[t]}function QA(t,n,e){const r=[],i=new cn().union(n),a=t.marktype;return a?ZA(t,i,e,r):a==="group"?t_(t,i,e,r):j("Intersect scene must be mark node or group item.")}function ZA(t,n,e,r){if(function(i,a,o){return i.bounds&&a.intersects(i.bounds)&&(i.marktype==="group"||i.interactive!==!1&&(!o||o(i)))}(t,n,e)){const i=t.items,a=t.marktype,o=i.length;let s=0;if(a==="group")for(;s=0;o--)if(s[o]!=u[o])return!1;for(o=s.length-1;o>=0;o--)if(!C0(r[a=s[o]],i[a],a))return!1;return typeof r==typeof i}(t,n):t==n)}function r_(t,n){return C0(Ro(t),Ro(n))}const Uo="top",tr="left",nr="right",Qi="bottom",E0="start",$0="middle",Yn="end",rf="group",S0="axis",M0="title",s4="frame",u4="scope",B0="legend",i_="row-header",a_="row-footer",o_="row-title",s_="column-header",u_="column-footer",l_="column-title",l4="padding",c_="fit",f_="fit-x",d_="fit-y",z0="none",af="all",O0="each",N0="flush",Zi="column",ta="row";function h_(t){O.call(this,null,t)}function of(t,n,e){return n(t.bounds.clear(),t,e)}V(h_,O,{transform(t,n){const e=n.dataflow,r=t.mark,i=r.marktype,a=Ae[i],o=a.bound;let s,u=r.bounds;if(a.nested)r.items.length&&e.dirty(r.items[0]),u=of(r,o),r.items.forEach(l=>{l.bounds.clear().union(u)});else if(i===rf||t.modified())switch(n.visit(n.MOD,l=>e.dirty(l)),u.clear(),r.items.forEach(l=>u.union(of(l,o))),r.role){case S0:case B0:case M0:n.reflow()}else s=n.changed(n.REM),n.visit(n.ADD,l=>{u.union(of(l,o))}),n.visit(n.MOD,l=>{s=s||u.alignsWith(l.bounds),e.dirty(l),u.union(of(l,o))}),s&&(u.clear(),r.items.forEach(l=>u.union(l.bounds)));return e_(r),n.modifies("bounds")}});const p_=":vega_identifier:";function R0(t){O.call(this,0,t)}function m_(t){O.call(this,null,t)}function g_(t){O.call(this,null,t)}R0.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},V(R0,O,{transform(t,n){const e=(i=n.dataflow)._signals[p_]||(i._signals[p_]=i.add(0)),r=t.as;var i;let a=e.value;return n.visit(n.ADD,o=>o[r]=o[r]||++a),e.set(this.value=a),n}}),V(m_,O,{transform(t,n){let e=this.value;e||(e=n.dataflow.scenegraph().mark(t.markdef,function(i){const a=i.groups,o=i.parent;return a&&a.size===1?a.get(Object.keys(a.object)[0]):a&&o?a.lookup(o):null}(t),t.index),e.group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);const r=e.marktype===rf?Cc:Fc;return n.visit(n.ADD,i=>r.call(i,e)),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n}});const y_={parity:t=>t.filter((n,e)=>e%2?n.opacity=0:1),greedy:(t,n)=>{let e;return t.filter((r,i)=>i&&v_(e.bounds,r.bounds,n)?r.opacity=0:(e=r,1))}},v_=(t,n,e)=>e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2),b_=(t,n)=>{for(var e,r=1,i=t.length,a=t[0].bounds;r{const n=t.bounds;return n.width()>1&&n.height()>1},x_=t=>(t.forEach(n=>n.opacity=1),t),w_=(t,n)=>t.reflow(n.modified()).modifies("opacity");function A_(t){O.call(this,null,t)}V(g_,O,{transform(t,n){const e=y_[t.method]||y_.parity,r=t.separation||0;let i,a,o=n.materialize(n.SOURCE).source;if(!o||!o.length)return;if(!t.method)return t.modified("method")&&(x_(o),n=w_(n,t)),n;if(o=o.filter(c4),!o.length)return;if(t.sort&&(o=o.slice().sort(t.sort)),i=x_(o),n=w_(n,t),i.length>=3&&b_(i,r)){do i=e(i,r);while(i.length>=3&&b_(i,r));i.length<3&&!Bt(o).opacity&&(i.length>1&&(Bt(i).opacity=0),Bt(o).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(a=((u,l,c)=>{var f=u.range(),d=new cn;return l===Uo||l===Qi?d.set(f[0],-1/0,f[1],1/0):d.set(-1/0,f[0],1/0,f[1]),d.expand(c||1),h=>d.encloses(h.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),o.forEach(u=>{a(u)||(u.opacity=0)}));const s=i[0].mark.bounds.clear();return o.forEach(u=>{u.opacity&&s.union(u.bounds)}),n}}),V(A_,O,{transform(t,n){const e=n.dataflow;if(n.visit(n.ALL,r=>e.dirty(r)),n.fields&&n.fields.zindex){const r=n.source&&n.source[0];r&&(r.mark.zdirty=!0)}}});const Nn=new cn;function Io(t,n,e){return t[n]===e?0:(t[n]=e,1)}function f4(t){var n=t.items[0].orient;return n===tr||n===nr}function d4(t,n,e,r){var i,a,o=n.items[0],s=o.datum,u=o.translate!=null?o.translate:.5,l=o.orient,c=function(A){let _=+A.grid;return[A.ticks?_++:-1,A.labels?_++:-1,_+ +A.domain]}(s),f=o.range,d=o.offset,h=o.position,p=o.minExtent,m=o.maxExtent,g=s.title&&o.items[c[2]].items[0],y=o.titlePadding,v=o.bounds,x=g&&u0(g),b=0,w=0;switch(Nn.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(o.items[i].bounds),(i=c[1])>-1&&v.union(o.items[i].bounds),l){case Uo:b=h||0,w=-d,a=Math.max(p,Math.min(m,-v.y1)),v.add(0,-a).add(f,0),g&&sf(t,g,a,y,x,0,-1,v);break;case tr:b=-d,w=h||0,a=Math.max(p,Math.min(m,-v.x1)),v.add(-a,0).add(0,f),g&&sf(t,g,a,y,x,1,-1,v);break;case nr:b=e+d,w=h||0,a=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(a,f),g&&sf(t,g,a,y,x,1,1,v);break;case Qi:b=h||0,w=r+d,a=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,a),g&&sf(t,g,a,y,0,0,1,v);break;default:b=o.x,w=o.y}return ai(v.translate(b,w),o),Io(o,"x",b+u)|Io(o,"y",w+u)&&(o.bounds=Nn,t.dirty(o),o.bounds=v,t.dirty(o)),o.mark.bounds.clear().union(v)}function sf(t,n,e,r,i,a,o,s){const u=n.bounds;if(n.auto){const l=o*(e+i+r);let c=0,f=0;t.dirty(n),a?c=(n.x||0)-(n.x=l):f=(n.y||0)-(n.y=l),n.mark.bounds.clear().union(u.translate(-c,-f)),t.dirty(n)}s.union(u)}const __=(t,n)=>Math.floor(Math.min(t,n)),k_=(t,n)=>Math.ceil(Math.max(t,n));function h4(t){return new cn().set(0,0,t.width||0,t.height||0)}function p4(t){const n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function Yt(t,n,e){const r=Z(t)?t[n]:t;return r??(e!==void 0?e:0)}function D_(t){return t<0?Math.ceil(-t):0}function F_(t,n,e){var r,i,a,o,s,u,l,c,f,d,h,p=!e.nodirty,m=e.bounds===N0?h4:p4,g=Nn.set(0,0,0,0),y=Yt(e.align,Zi),v=Yt(e.align,ta),x=Yt(e.padding,Zi),b=Yt(e.padding,ta),w=e.columns||n.length,A=w<=0?1:Math.ceil(n.length/w),_=n.length,k=Array(_),F=Array(w),C=0,D=Array(_),E=Array(A),$=0,M=Array(_),S=Array(_),B=Array(_);for(i=0;i1)for(i=0;i<_;++i)(f=(s=y===af?C:F[i%w])-B[i].x2-n[i].x-M[i])>0&&(M[i]+=f/2);if(v&&Yt(e.center,ta)&&w!==1)for(i=0;i<_;++i)(d=(s=v===af?$:E[~~(i/w)])-B[i].y2-n[i].y-S[i])>0&&(S[i]+=d/2);for(i=0;i<_;++i)g.union(B[i].translate(M[i],S[i]));switch(f=Yt(e.anchor,"x"),d=Yt(e.anchor,"y"),Yt(e.anchor,Zi)){case Yn:f-=g.width();break;case $0:f-=g.width()/2}switch(Yt(e.anchor,ta)){case Yn:d-=g.height();break;case $0:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),i=0;i<_;++i)n[i].mark.bounds.clear();for(i=0;i<_;++i)(u=n[i]).x+=M[i]+=f,u.y+=S[i]+=d,g.union(u.mark.bounds.union(u.bounds.translate(M[i],S[i]))),p&&t.dirty(u);return g}function m4(t,n,e){var r,i,a,o,s,u,l,c=function(v){var x,b,w=v.items,A=w.length,_=0;const k={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;_i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),k+=a,m=0,y=n.length;m=0&&(b=e[g])==null;g-=d);s?(w=h==null?b.x:Math.round(b.bounds.x1+h*b.bounds.width()),A=k):(w=k,A=h==null?b.y:Math.round(b.bounds.y1+h*b.bounds.height())),v.union(x.bounds.translate(w-(x.x||0),A-(x.y||0))),x.x=w,x.y=A,t.dirty(x),F=o(F,v[l])}return F}function C_(t,n,e,r,i,a){if(n){t.dirty(n);var o=e,s=e;r?o=Math.round(i.x1+a*i.width()):s=Math.round(i.y1+a*i.height()),n.bounds.translate(o-(n.x||0),s-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=o,n.y=s,t.dirty(n)}}function v4(t,n,e,r,i,a,o){const s=function(d,h){const p=d[h]||{};return(m,g)=>p[m]!=null?p[m]:d[m]!=null?d[m]:g}(e,n),u=function(d,h){let p=-1/0;return d.forEach(m=>{m.offset!=null&&(p=Math.max(p,m.offset))}),p>-1/0?p:h}(t,s("offset",0)),l=s("anchor",E0),c=l===Yn?1:l===$0?.5:0,f={align:O0,bounds:s("bounds",N0),columns:s("direction")==="vertical"?1:t.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(n){case tr:f.anchor={x:Math.floor(r.x1)-u,column:Yn,y:c*(o||r.height()+2*r.y1),row:l};break;case nr:f.anchor={x:Math.ceil(r.x2)+u,y:c*(o||r.height()+2*r.y1),row:l};break;case Uo:f.anchor={y:Math.floor(i.y1)-u,row:Yn,x:c*(a||i.width()+2*i.x1),column:l};break;case Qi:f.anchor={y:Math.ceil(i.y2)+u,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:u,y:u};break;case"top-right":f.anchor={x:a-u,y:u,column:Yn};break;case"bottom-left":f.anchor={x:u,y:o-u,row:Yn};break;case"bottom-right":f.anchor={x:a-u,y:o-u,column:Yn,row:Yn}}return f}function b4(t,n){var e,r,i=n.items[0],a=i.datum,o=i.orient,s=i.bounds,u=i.x,l=i.y;return i._bounds?i._bounds.clear().union(s):i._bounds=s.clone(),s.clear(),function(c,f,d){var h=f.padding,p=h-d.x,m=h-d.y;if(f.datum.title){var g=f.items[1].items[0],y=g.anchor,v=f.titlePadding||0,x=h-g.x,b=h-g.y;switch(g.orient){case tr:p+=Math.ceil(g.bounds.width())+v;break;case nr:case Qi:break;default:m+=g.bounds.height()+v}switch((p||m)&&_u(c,d,p,m),g.orient){case tr:b+=Wo(f,d,g,y,1,1);break;case nr:x+=Wo(f,d,g,Yn,0,0)+v,b+=Wo(f,d,g,y,1,1);break;case Qi:x+=Wo(f,d,g,y,0,0),b+=Wo(f,d,g,Yn,-1,0,1)+v;break;default:x+=Wo(f,d,g,y,0,0)}(x||b)&&_u(c,g,x,b),(x=Math.round(g.bounds.x1-h))<0&&(_u(c,d,-x,0),_u(c,g,-x,0))}else(p||m)&&_u(c,d,p,m)}(t,i,i.items[0].items[0]),s=function(c,f){return c.items.forEach(d=>f.union(d.bounds)),f.x1=c.padding,f.y1=c.padding,f}(i,s),e=2*i.padding,r=2*i.padding,s.empty()||(e=Math.ceil(s.width()+e),r=Math.ceil(s.height()+r)),a.type==="symbol"&&function(c){const f=c.reduce((d,h)=>(d[h.column]=Math.max(h.bounds.x2-h.x,d[h.column]||0),d),{});c.forEach(d=>{d.width=f[d.column],d.height=d.bounds.y2-d.y})}(i.items[0].items[0].items[0].items),o!==z0&&(i.x=u=0,i.y=l=0),i.width=e,i.height=r,ai(s.set(u,l,u+e,l+r),i),i.mark.bounds.clear().union(s),i}function Wo(t,n,e,r,i,a,o){const s=t.datum.type!=="symbol",u=e.datum.vgrad,l=(!s||!a&&u||o?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&a?l:0,f=u&&a?0:l,d=i<=0?0:u0(e);return Math.round(r===E0?c:r===Yn?f-d:.5*(l-d))}function _u(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function E_(t){O.call(this,null,t)}V(E_,O,{transform(t,n){const e=n.dataflow;return t.mark.items.forEach(r=>{t.layout&&m4(e,r,t.layout),function(i,a,o){var s,u,l,c,f,d=a.items,h=Math.max(0,a.width||0),p=Math.max(0,a.height||0),m=new cn().set(0,0,h,p),g=m.clone(),y=m.clone(),v=[];for(c=0,f=d.length;c{(l=b.orient||nr)!==z0&&(x[l]||(x[l]=[])).push(b)});for(const b in x){const w=x[b];F_(i,w,v4(w,b,o.legends,g,y,h,p))}v.forEach(b=>{const w=b.bounds;if(w.equals(b._bounds)||(b.bounds=b._bounds,i.dirty(b),b.bounds=w,i.dirty(b)),!o.autosize||o.autosize.type!==c_&&o.autosize.type!==f_&&o.autosize.type!==d_)m.union(w);else switch(b.orient){case tr:case nr:m.add(w.x1,0).add(w.x2,0);break;case Uo:case Qi:m.add(0,w.y1).add(0,w.y2)}})}m.union(g).union(y),s&&m.union(function(x,b,w,A,_){var k,F=b.items[0],C=F.frame,D=F.orient,E=F.anchor,$=F.offset,M=F.padding,S=F.items[0].items[0],B=F.items[1]&&F.items[1].items[0],z=D===tr||D===nr?A:w,N=0,W=0,X=0,L=0,et=0;if(C!==rf?D===tr?(N=_.y2,z=_.y1):D===nr?(N=_.y1,z=_.y2):(N=_.x1,z=_.x2):D===tr&&(N=A,z=0),k=E===E0?N:E===Yn?z:(N+z)/2,B&&B.text){switch(D){case Uo:case Qi:et=S.bounds.height()+M;break;case tr:L=S.bounds.width()+M;break;case nr:L=-S.bounds.width()-M}Nn.clear().union(B.bounds),Nn.translate(L-(B.x||0),et-(B.y||0)),Io(B,"x",L)|Io(B,"y",et)&&(x.dirty(B),B.bounds.clear().union(Nn),B.mark.bounds.clear().union(Nn),x.dirty(B)),Nn.clear().union(B.bounds)}else Nn.clear();switch(Nn.union(S.bounds),D){case Uo:W=k,X=_.y1-Nn.height()-$;break;case tr:W=_.x1-Nn.width()-$,X=k;break;case nr:W=_.x2+Nn.width()+$,X=k;break;case Qi:W=k,X=_.y2+$;break;default:W=F.x,X=F.y}return Io(F,"x",W)|Io(F,"y",X)&&(Nn.translate(W,X),x.dirty(F),F.bounds.clear().union(Nn),b.bounds.clear().union(Nn),x.dirty(F)),F.bounds}(i,s,h,p,m)),a.clip&&m.set(0,0,a.width||0,a.height||0),function(x,b,w,A){const _=A.autosize||{},k=_.type;if(x._autosize<1||!k)return;let F=x._width,C=x._height,D=Math.max(0,b.width||0),E=Math.max(0,Math.ceil(-w.x1)),$=Math.max(0,b.height||0),M=Math.max(0,Math.ceil(-w.y1));const S=Math.max(0,Math.ceil(w.x2-D)),B=Math.max(0,Math.ceil(w.y2-$));if(_.contains===l4){const z=x.padding();F-=z.left+z.right,C-=z.top+z.bottom}k===z0?(E=0,M=0,D=F,$=C):k===c_?(D=Math.max(0,F-E-S),$=Math.max(0,C-M-B)):k===f_?(D=Math.max(0,F-E-S),C=$+M+B):k===d_?(F=D+E+S,$=Math.max(0,C-M-B)):k==="pad"&&(F=D+E+S,C=$+M+B),x._resizeView(F,C,D,$,[E,M],_.resize)}(i,a,m,o)}(e,r,t)}),function(r){return r&&r.mark.role!=="legend-entry"}(t.mark.group)?n.reflow():n}});const x4=Object.freeze(Object.defineProperty({__proto__:null,bound:h_,identifier:R0,mark:m_,overlap:g_,render:A_,viewlayout:E_},Symbol.toStringTag,{value:"Module"}));function $_(t){O.call(this,null,t)}function S_(t){O.call(this,null,t)}function w4(){return St({})}function M_(t){O.call(this,null,t)}function B_(t){O.call(this,[],t)}V($_,O,{transform(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.dataflow.locale(),r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=this.value,a=t.scale,o=Om(a,t.count==null?t.values?t.values.length:10:t.count,t.minstep),s=t.format||_w(e,a,o,t.formatSpecifier,t.formatType,!!t.values),u=t.values?Aw(a,t.values,o):Nm(a,o);return i&&(r.rem=i),i=u.map((l,c)=>St({index:c/(u.length-1||1),value:l,label:s(l)})),t.extra&&i.length&&i.push(St({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),V(S_,O,{transform(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.item||w4,a=t.key||st,o=this.value;return P(r.encode)&&(r.encode=null),o&&(t.modified("key")||n.modified(a))&&j("DataJoin does not support modified key function or fields."),o||(n=n.addAll(),this.value=o=function(s){const u=Fo().test(l=>l.exit);return u.lookup=l=>u.get(s(l)),u}(a)),n.visit(n.ADD,s=>{const u=a(s);let l=o.get(u);l?l.exit?(o.empty--,r.add.push(l)):r.mod.push(l):(l=i(s),o.set(u,l),r.add.push(l)),l.datum=s,l.exit=!1}),n.visit(n.MOD,s=>{const u=a(s),l=o.get(u);l&&(l.datum=s,r.mod.push(l))}),n.visit(n.REM,s=>{const u=a(s),l=o.get(u);s!==l.datum||l.exit||(r.rem.push(l),l.exit=!0,++o.empty)}),n.changed(n.ADD_MOD)&&r.modifies("datum"),(n.clean()||t.clean&&o.empty>e.cleanThreshold)&&e.runAfter(o.clean),r}}),V(M_,O,{transform(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,a=n.encode;if(P(a)){if(!e.changed()&&!a.every(f=>i[f]))return n.StopPropagation;a=a[0],e.encode=null}var o=a==="enter",s=i.update||Oi,u=i.enter||Oi,l=i.exit||Oi,c=(a&&!o?i[a]:s)||Oi;if(n.changed(n.ADD)&&(n.visit(n.ADD,f=>{u(f,t),s(f,t)}),e.modifies(u.output),e.modifies(s.output),c!==Oi&&c!==s&&(n.visit(n.ADD,f=>{c(f,t)}),e.modifies(c.output))),n.changed(n.REM)&&l!==Oi&&(n.visit(n.REM,f=>{l(f,t)}),e.modifies(l.output)),o||c!==Oi){const f=n.MOD|(t.modified()?n.REFLOW:0);o?(n.visit(f,d=>{const h=u(d,t)||r;(c(d,t)||h)&&e.mod.push(d)}),e.mod.length&&e.modifies(u.output)):n.visit(f,d=>{(c(d,t)||r)&&e.mod.push(d)}),e.mod.length&&e.modifies(c.output)}return e.changed()?e:n.StopPropagation}}),V(B_,O,{transform(t,n){if(this.value!=null&&!t.modified())return n.StopPropagation;var e,r,i,a,o,s=n.dataflow.locale(),u=n.fork(n.NO_SOURCE|n.NO_FIELDS),l=this.value,c=t.type||Ac,f=t.scale,d=+t.limit,h=Om(f,t.count==null?5:t.count,t.minstep),p=!!t.values||c===Ac,m=t.format||Cw(s,f,h,c,t.formatSpecifier,t.formatType,p),g=t.values||Fw(f,h);return l&&(u.rem=l),c===Ac?(d&&g.length>d?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=g.slice(0,d-1),o=!0):l=g,bt(i=t.size)?(t.values||f(l[0])!==0||(l=l.slice(1)),a=l.reduce((y,v)=>Math.max(y,i(v,t)),0)):i=In(a=i||8),l=l.map((y,v)=>St({index:v,label:m(y,v,l),value:y,offset:a,size:i(y,t)})),o&&(o=g[l.length],l.push(St({index:l.length,label:`\u2026${g.length-l.length} entries`,value:o,offset:a,size:i(o,t)})))):c==="gradient"?(e=f.domain(),r=vw(f,e[0],Bt(e)),g.length<3&&!t.values&&e[0]!==Bt(e)&&(g=[e[0],Bt(e)]),l=g.map((y,v)=>St({index:v,label:m(y,v,g),value:y,perc:r(y)}))):(i=g.length-1,r=function(y){const v=y.domain(),x=v.length-1;let b=+v[0],w=+Bt(v),A=w-b;if(y.type===bc){const _=x?A/x:.1;b-=_,w+=_,A=w-b}return _=>(_-b)/A}(f),l=g.map((y,v)=>St({index:v,label:m(y,v,g),value:y,perc:v?r(y):0,perc2:v===i?1:r(g[v+1])}))),u.source=l,u.add=l,this.value=l,u}});const A4=t=>t.source.x,_4=t=>t.source.y,k4=t=>t.target.x,D4=t=>t.target.y;function T0(t){O.call(this,{},t)}T0.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},V(T0,O,{transform(t,n){var e=t.sourceX||A4,r=t.sourceY||_4,i=t.targetX||k4,a=t.targetY||D4,o=t.as||"path",s=t.orient||"vertical",u=t.shape||"line",l=R_.get(u+"-"+s)||R_.get(u);return l||j("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,c=>{c[o]=l(e(c),r(c),i(c),a(c))}),n.reflow(t.modified()).modifies(o)}});const z_=(t,n,e,r)=>"M"+t+","+n+"L"+e+","+r,O_=(t,n,e,r)=>{var i=e-t,a=r-n,o=Math.hypot(i,a)/2;return"M"+t+","+n+"A"+o+","+o+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+e+","+r},N_=(t,n,e,r)=>{const i=e-t,a=r-n,o=.2*(i+a),s=.2*(a-i);return"M"+t+","+n+"C"+(t+o)+","+(n+s)+" "+(e+s)+","+(r-o)+" "+e+","+r},R_=Fo({line:z_,"line-radial":(t,n,e,r)=>z_(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),arc:O_,"arc-radial":(t,n,e,r)=>O_(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),curve:N_,"curve-radial":(t,n,e,r)=>N_(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),"orthogonal-horizontal":(t,n,e,r)=>"M"+t+","+n+"V"+r+"H"+e,"orthogonal-vertical":(t,n,e,r)=>"M"+t+","+n+"H"+e+"V"+r,"orthogonal-radial":(t,n,e,r)=>{const i=Math.cos(t),a=Math.sin(t),o=Math.cos(e),s=Math.sin(e);return"M"+n*i+","+n*a+"A"+n+","+n+" 0 0,"+((Math.abs(e-t)>Math.PI?e<=t:e>t)?1:0)+" "+n*o+","+n*s+"L"+r*o+","+r*s},"diagonal-horizontal":(t,n,e,r)=>{const i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":(t,n,e,r)=>{const i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":(t,n,e,r)=>{const i=Math.cos(t),a=Math.sin(t),o=Math.cos(e),s=Math.sin(e),u=(n+r)/2;return"M"+n*i+","+n*a+"C"+u*i+","+u*a+" "+u*o+","+u*s+" "+r*o+","+r*s}});function P0(t){O.call(this,null,t)}P0.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},V(P0,O,{transform(t,n){var e,r,i,a=t.as||["startAngle","endAngle"],o=a[0],s=a[1],u=t.field||Gs,l=t.startAngle||0,c=t.endAngle!=null?t.endAngle:2*Math.PI,f=n.source,d=f.map(u),h=d.length,p=l,m=(c-l)/Jx(d),g=xe(h);for(t.sort&&g.sort((y,v)=>d[y]-d[v]),e=0;er+(i<0?-1:i>0?1:0),0))!==n.length&&e.warn("Log scale domain includes zero: "+G(n)),n}function L_(t,n,e){return bt(t)&&(n||e)?gw(t,j0(n||[0,1],e)):t}function j0(t,n){return n?t.slice().reverse():t}function q_(t){O.call(this,null,t)}V(P_,O,{transform(t,n){var e=n.dataflow,r=this.value,i=function(a){var o,s=a.type,u="";return s===Cr?Cr+"-"+Bo:(function(l){const c=l.type;return Sm(c)&&c!==za&&c!==Oa&&(l.scheme||l.range&&l.range.length&&l.range.every(Q))}(a)&&(u=(o=a.rawDomain?a.rawDomain.length:a.domain?a.domain.length+ +(a.domainMid!=null):0)===2?Cr+"-":o===3?zo+"-":""),(u+s||Bo).toLowerCase())}(t);for(i in r&&i===r.type||(this.value=r=Dt(i)()),t)if(!F4[i]){if(i==="padding"&&T_(r.type))continue;bt(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(a,o,s){var u=a.type,l=o.round||!1,c=o.range;if(o.rangeStep!=null)c=function(f,d,h){f!==sw&&f!==Fm&&j("Only band and point scales support rangeStep.");var p=(d.paddingOuter!=null?d.paddingOuter:d.padding)||0,m=f===Fm?1:(d.paddingInner!=null?d.paddingInner:d.padding)||0;return[0,d.rangeStep*km(h,m,p)]}(u,o,s);else if(o.scheme&&(c=function(f,d,h){var p,m=d.schemeExtent;return P(d.scheme)?p=wc(d.scheme,d.interpolate,d.interpolateGamma):(p=zm(d.scheme.toLowerCase()))||j(`Unrecognized scheme name: ${d.scheme}`),h=f===bc?h+1:f===Cm?h-1:f===Oo||f===vc?+d.schemeCount||5:h,pw(f)?L_(p,m,d.reverse):bt(p)?yw(L_(p,m),h):f===Dm?p:p.slice(0,h)}(u,o,s),bt(c))){if(a.interpolator)return a.interpolator(c);j(`Scale type ${u} does not support interpolating color schemes.`)}if(c&&pw(u))return a.interpolator(wc(j0(c,o.reverse),o.interpolate,o.interpolateGamma));c&&o.interpolate&&a.interpolate?a.interpolate(Bm(o.interpolate,o.interpolateGamma)):bt(a.round)?a.round(l):bt(a.rangeRound)&&a.interpolate(l?Xl:Vs),c&&a.range(j0(c,o.reverse))}(r,t,function(a,o,s){let u=o.bins;if(u&&!P(u)){const l=a.domain(),c=l[0],f=Bt(l),d=u.step;let h=u.start==null?c:u.start,p=u.stop==null?f:u.stop;d||j("Scale bins parameter missing step property."),hf&&(p=d*Math.floor(f/d)),u=xe(h,p+d/2,d)}return u?a.bins=u:a.bins&&delete a.bins,a.type===Cm&&(u?o.domain||o.domainRaw||(a.domain(u),s=u.length):a.bins=a.domain()),s}(r,t,function(a,o,s){const u=function(p,m,g){return m?(p.domain(j_(p.type,m,g)),m.length):-1}(a,o.domainRaw,s);if(u>-1)return u;var l,c,f=o.domain,d=a.type,h=o.zero||o.zero===void 0&&function(p){const m=p.type;return!p.bins&&(m===Bo||m===ru||m===iu)}(a);if(!f)return 0;if((h||o.domainMin!=null||o.domainMax!=null||o.domainMid!=null)&&(l=(f=f.slice()).length-1||1,h&&(f[0]>0&&(f[0]=0),f[l]<0&&(f[l]=0)),o.domainMin!=null&&(f[0]=o.domainMin),o.domainMax!=null&&(f[l]=o.domainMax),o.domainMid!=null)){const p=(c=o.domainMid)>f[l]?l+1:cD(b);if(h==null)F.push(d.slice());else for(g={},y=0,v=d.length;yk&&(k=_),p&&A.sort(p)}return F.max=k,F}(n.source,t.groupby,l,c),r=0,i=e.length,a=e.max;r0?1:t<0?-1:0},Jn=Math.sqrt,W0=Math.tan;function V_(t){return t>1?0:t<-1?yt:Math.acos(t)}function le(t){return t>1?rn:t<-1?-rn:Math.asin(t)}function Dn(){}function df(t,n){t&&X_.hasOwnProperty(t.type)&&X_[t.type](t,n)}var Y_={Feature:function(t,n){df(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,a=ct(n=(n*=gt)/2+lf),o=ut(n),s=Y0*o,u=V0*a+s*ct(i),l=s*r*ut(i);hf.add(je(l,u)),G0=t,V0=a,Y0=o}function mf(t){return[je(t[1],t[0]),le(t[2])]}function Ia(t){var n=t[0],e=t[1],r=ct(e);return[r*ct(n),r*ut(n),ut(e)]}function gf(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Vo(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function X0(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function yf(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function vf(t){var n=Jn(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Du,bf,xf,wf,Af,_f,kf,Df,J0,K0,Q0,ek,rk,Kn,Qn,Zn,li={point:Z0,lineStart:ak,lineEnd:ok,polygonStart:function(){li.point=sk,li.lineStart=O4,li.lineEnd=N4,ku=new Gn,Mr.polygonStart()},polygonEnd:function(){Mr.polygonEnd(),li.point=Z0,li.lineStart=ak,li.lineEnd=ok,hf<0?(Kt=-(an=180),ce=-(_e=90)):ku>dt?_e=90:ku<-1e-6&&(ce=-90),ui[0]=Kt,ui[1]=an},sphere:function(){Kt=-(an=180),ce=-(_e=90)}};function Z0(t,n){na.push(ui=[Kt=t,an=t]),n_e&&(_e=n)}function ik(t,n){var e=Ia([t*gt,n*gt]);if(Go){var r=Vo(Go,e),i=Vo([r[1],-r[0],0],r);vf(i),i=mf(i);var a,o=t-Ua,s=o>0?1:-1,u=i[0]*on*s,l=At(o)>180;l^(s*Ua_e&&(_e=a):l^(s*Ua<(u=(u+360)%360-180)&&u_e&&(_e=n)),l?tke(Kt,an)&&(an=t):ke(t,an)>ke(Kt,an)&&(Kt=t):an>=Kt?(tan&&(an=t)):t>Ua?ke(Kt,t)>ke(Kt,an)&&(an=t):ke(t,an)>ke(Kt,an)&&(Kt=t)}else na.push(ui=[Kt=t,an=t]);n_e&&(_e=n),Go=e,Ua=t}function ak(){li.point=ik}function ok(){ui[0]=Kt,ui[1]=an,li.point=Z0,Go=null}function sk(t,n){if(Go){var e=t-Ua;ku.add(At(e)>180?e+(e>0?360:-360):e)}else Z_=t,tk=n;Mr.point(t,n),ik(t,n)}function O4(){Mr.lineStart()}function N4(){sk(Z_,tk),Mr.lineEnd(),At(ku)>dt&&(Kt=-(an=180)),ui[0]=Kt,ui[1]=an,Go=null}function ke(t,n){return(n-=t)<0?n+360:n}function R4(t,n){return t[0]-n[0]}function uk(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nyt&&(t-=Math.round(t/Xn)*Xn),[t,n]}function dk(t,n,e){return(t%=Xn)?n||e?ng(pk(t),mk(n,e)):pk(t):n||e?mk(n,e):eg}function hk(t){return function(n,e){return At(n+=t)>yt&&(n-=Math.round(n/Xn)*Xn),[n,e]}}function pk(t){var n=hk(t);return n.invert=hk(-t),n}function mk(t,n){var e=ct(t),r=ut(t),i=ct(n),a=ut(n);function o(s,u){var l=ct(u),c=ct(s)*l,f=ut(s)*l,d=ut(u),h=d*e+c*r;return[je(f*i-h*a,c*e-d*r),le(h*i+f*a)]}return o.invert=function(s,u){var l=ct(u),c=ct(s)*l,f=ut(s)*l,d=ut(u),h=d*i-f*a;return[je(f*i+d*a,c*e+h*r),le(h*e-c*r)]},o}function gk(t,n){(n=Ia(n))[0]-=t,vf(n);var e=V_(-n[1]);return((-n[2]<0?-e:e)+Xn-dt)%Xn}function yk(){var t,n=[];return{point:function(e,r,i){t.push([e,r,i])},lineStart:function(){n.push(t=[])},lineEnd:Dn,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Ff(t,n){return At(t[0]-n[0])=0;--a)i.point((c=l[a])[0],c[1]);else r(d.x,d.p.x,-1,i);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}}function bk(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r=0?1:-1,Et=kt*Tt,tn=Et>yt,nn=L*J;if($.add(je(nn*kt*ut(Et),et*Mt+nn*ct(Et))),D+=tn?Tt+kt*Xn:Tt,tn^W>=_^mt>=_){var It=Vo(Ia(N),Ia(nt));vf(It);var be=Vo(C,It);vf(be);var zn=(tn^Tt>=0?-1:1)*le(be[2]);(k>zn||k===zn&&(It[0]||It[1]))&&(E+=tn^Tt>=0?1:-1)}}return(D<-1e-6||D0){for(f||(i.polygonStart(),f=!0),i.lineStart(),b=0;b1&&2&k&&F.push(F.pop().concat(F.shift())),o.push(F.filter(U4))}return d}}function U4(t){return t.length>1}function I4(t,n){return((t=t.x)[0]<0?t[1]-rn-dt:rn-t[1])-((n=n.x)[0]<0?n[1]-rn-dt:rn-n[1])}eg.invert=eg;const wk=xk(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,o){var s=a>0?yt:-yt,u=At(a-e);At(u-yt)0?rn:-rn),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),n=0):i!==s&&u>=yt&&(At(e-i)dt?Ho((ut(c)*(p=ct(d))*ut(f)-ut(d)*(h=ct(c))*ut(l))/(h*p*m)):(c+d)/2}(e,r,a,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),n=0),t.point(e=a,r=o),i=s},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(t==null)i=e*rn,r.point(-yt,i),r.point(0,i),r.point(yt,i),r.point(yt,0),r.point(yt,-i),r.point(0,-i),r.point(-yt,-i),r.point(-yt,0),r.point(-yt,i);else if(At(t[0]-n[0])>dt){var a=t[0]0,i=At(n)>dt;function a(u,l){return ct(u)*ct(l)>n}function o(u,l,c){var f=[1,0,0],d=Vo(Ia(u),Ia(l)),h=gf(d,d),p=d[0],m=h-p*p;if(!m)return!c&&u;var g=n*h/m,y=-n*p/m,v=Vo(f,d),x=yf(f,g);X0(x,yf(d,y));var b=v,w=gf(x,b),A=gf(b,b),_=w*w-A*(gf(x,x)-1);if(!(_<0)){var k=Jn(_),F=yf(b,(-w-k)/A);if(X0(F,x),F=mf(F),!c)return F;var C,D=u[0],E=l[0],$=u[1],M=l[1];E0^F[1]<(At(F[0]-D)yt^(D<=F[0]&&F[0]<=E)){var z=yf(b,(-w+k)/A);return X0(z,x),[F,mf(z)]}}}function s(u,l){var c=r?t:yt-t,f=0;return u<-c?f|=1:u>c&&(f|=2),l<-c?f|=4:l>c&&(f|=8),f}return xk(a,function(u){var l,c,f,d,h;return{lineStart:function(){d=f=!1,h=1},point:function(p,m){var g,y=[p,m],v=a(p,m),x=r?v?0:s(p,m):v?s(p+(p<0?yt:-yt),m):0;if(!l&&(d=f=v)&&u.lineStart(),v!==f&&(!(g=o(l,y))||Ff(l,g)||Ff(y,g))&&(y[2]=1),v!==f)h=0,v?(u.lineStart(),g=o(y,l),u.point(g[0],g[1])):(g=o(l,y),u.point(g[0],g[1],2),u.lineEnd()),l=g;else if(i&&l&&r^v){var b;x&c||!(b=o(y,l,!0))||(h=0,r?(u.lineStart(),u.point(b[0][0],b[0][1]),u.point(b[1][0],b[1][1]),u.lineEnd()):(u.point(b[1][0],b[1][1]),u.lineEnd(),u.lineStart(),u.point(b[0][0],b[0][1],3)))}!v||l&&Ff(l,y)||u.point(y[0],y[1]),l=y,f=v,c=x},lineEnd:function(){f&&u.lineEnd(),l=null},clean:function(){return h|(d&&f)<<1}}},function(u,l,c,f){(function(d,h,p,m,g,y){if(p){var v=ct(h),x=ut(h),b=m*p;g==null?(g=h+m*Xn,y=h-b/2):(g=gk(v,g),y=gk(v,y),(m>0?gy)&&(g+=m*Xn));for(var w,A=g;m>0?A>y:A0)do d.point(h===0||h===3?t:e,h>1?r:n);while((h=(h+f+4)%4)!==p);else d.point(c[0],c[1])}function o(l,c){return At(l[0]-t)0?0:3:At(l[0]-e)0?2:1:At(l[1]-n)0?1:0:c>0?3:2}function s(l,c){return u(l.x,c.x)}function u(l,c){var f=o(l,1),d=o(c,1);return f!==d?f-d:f===0?c[1]-l[1]:f===1?l[0]-c[0]:f===2?l[1]-c[1]:c[0]-l[0]}return function(l){var c,f,d,h,p,m,g,y,v,x,b,w=l,A=yk(),_={point:k,lineStart:function(){_.point=F,f&&f.push(d=[]),x=!0,v=!1,g=y=NaN},lineEnd:function(){c&&(F(h,p),m&&v&&A.rejoin(),c.push(A.result())),_.point=k,v&&w.lineEnd()},polygonStart:function(){w=A,c=[],f=[],b=!0},polygonEnd:function(){var C=function(){for(var $=0,M=0,S=f.length;Mr&&(et-B)*(r-z)>(ot-z)*(t-B)&&++$:ot<=r&&(et-B)*(r-z)<(ot-z)*(t-B)&&--$;return $}(),D=b&&C,E=(c=Xx(c)).length;(D||E)&&(l.polygonStart(),D&&(l.lineStart(),a(null,null,1,l),l.lineEnd()),E&&vk(c,s,C,a,l),l.polygonEnd()),w=l,c=f=d=null}};function k(C,D){i(C,D)&&w.point(C,D)}function F(C,D){var E=i(C,D);if(f&&d.push([C,D]),x)h=C,p=D,m=E,x=!1,E&&(w.lineStart(),w.point(C,D));else if(E&&v)w.point(C,D);else{var $=[g=Math.max($f,Math.min(Ef,g)),y=Math.max($f,Math.min(Ef,y))],M=[C=Math.max($f,Math.min(Ef,C)),D=Math.max($f,Math.min(Ef,D))];(function(S,B,z,N,W,X){var L,et=S[0],ot=S[1],nt=0,mt=1,pt=B[0]-et,J=B[1]-ot;if(L=z-et,pt||!(L>0)){if(L/=pt,pt<0){if(L0){if(L>mt)return;L>nt&&(nt=L)}if(L=W-et,pt||!(L<0)){if(L/=pt,pt<0){if(L>mt)return;L>nt&&(nt=L)}else if(pt>0){if(L0)){if(L/=J,J<0){if(L0){if(L>mt)return;L>nt&&(nt=L)}if(L=X-ot,J||!(L<0)){if(L/=J,J<0){if(L>mt)return;L>nt&&(nt=L)}else if(J>0){if(L0&&(S[0]=et+nt*pt,S[1]=ot+nt*J),mt<1&&(B[0]=et+mt*pt,B[1]=ot+mt*J),!0}}}}})($,M,t,n,e,r)?(v||(w.lineStart(),w.point($[0],$[1])),w.point(M[0],M[1]),E||w.lineEnd(),b=!1):E&&(w.lineStart(),w.point(C,D),b=!1)}g=C,y=D,v=E}return _}}function _k(t,n,e){var r=xe(t,n-dt,e).concat(n);return function(i){return r.map(function(a){return[i,a]})}}function kk(t,n,e){var r=xe(t,n-dt,e).concat(n);return function(i){return r.map(function(a){return[a,i]})}}const Cu=t=>t;var Dk,Fk,ig,ag,og=new Gn,sg=new Gn,ci={point:Dn,lineStart:Dn,lineEnd:Dn,polygonStart:function(){ci.lineStart=H4,ci.lineEnd=V4},polygonEnd:function(){ci.lineStart=ci.lineEnd=ci.point=Dn,og.add(At(sg)),sg=new Gn},result:function(){var t=og/2;return og=new Gn,t}};function H4(){ci.point=G4}function G4(t,n){ci.point=Ck,Dk=ig=t,Fk=ag=n}function Ck(t,n){sg.add(ag*t-ig*n),ig=t,ag=n}function V4(){Ck(Dk,Fk)}var Yo=1/0,Sf=Yo,Eu=-Yo,Mf=Eu,Bf={point:function(t,n){tEu&&(Eu=t),nMf&&(Mf=n)},lineStart:Dn,lineEnd:Dn,polygonStart:Dn,polygonEnd:Dn,result:function(){var t=[[Yo,Sf],[Eu,Mf]];return Eu=Mf=-(Sf=Yo=1/0),t}},Ek,$k,Br,zr,ug=0,lg=0,$u=0,zf=0,Of=0,Xo=0,cg=0,fg=0,Su=0,qe={point:Wa,lineStart:Sk,lineEnd:Mk,polygonStart:function(){qe.lineStart=J4,qe.lineEnd=K4},polygonEnd:function(){qe.point=Wa,qe.lineStart=Sk,qe.lineEnd=Mk},result:function(){var t=Su?[cg/Su,fg/Su]:Xo?[zf/Xo,Of/Xo]:$u?[ug/$u,lg/$u]:[NaN,NaN];return ug=lg=$u=zf=Of=Xo=cg=fg=Su=0,t}};function Wa(t,n){ug+=t,lg+=n,++$u}function Sk(){qe.point=Y4}function Y4(t,n){qe.point=X4,Wa(Br=t,zr=n)}function X4(t,n){var e=t-Br,r=n-zr,i=Jn(e*e+r*r);zf+=i*(Br+t)/2,Of+=i*(zr+n)/2,Xo+=i,Wa(Br=t,zr=n)}function Mk(){qe.point=Wa}function J4(){qe.point=Q4}function K4(){Bk(Ek,$k)}function Q4(t,n){qe.point=Bk,Wa(Ek=Br=t,$k=zr=n)}function Bk(t,n){var e=t-Br,r=n-zr,i=Jn(e*e+r*r);zf+=i*(Br+t)/2,Of+=i*(zr+n)/2,Xo+=i,cg+=(i=zr*t-Br*n)*(Br+t),fg+=i*(zr+n),Su+=3*i,Wa(Br=t,zr=n)}function zk(t){this._context=t}zk.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Xn)}},result:Dn};var dg,Ok,Nk,Mu,Bu,hg=new Gn,zu={point:Dn,lineStart:function(){zu.point=Z4},lineEnd:function(){dg&&Rk(Ok,Nk),zu.point=Dn},polygonStart:function(){dg=!0},polygonEnd:function(){dg=null},result:function(){var t=+hg;return hg=new Gn,t}};function Z4(t,n){zu.point=Rk,Ok=Mu=t,Nk=Bu=n}function Rk(t,n){Mu-=t,Bu-=n,hg.add(Jn(Mu*Mu+Bu*Bu)),Mu=t,Bu=n}let Tk,Nf,Pk,jk;class Lk{constructor(n){this._append=n==null?qk:function(e){const r=Math.floor(e);if(!(r>=0))throw new RangeError(`invalid digits: ${e}`);if(r>15)return qk;if(r!==Tk){const i=10**r;Tk=r,Nf=function(a){let o=1;this._+=a[0];for(const s=a.length;o=0))throw new RangeError(`invalid digits: ${s}`);i=u}return n===null&&(r=new Lk(i)),o},o.projection(t).digits(i).context(n)}function Rf(t){return function(n){var e=new pg;for(var r in t)e[r]=t[r];return e.stream=n,e}}function pg(){}function mg(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),si(e,t.stream(Bf)),n(Bf.result()),r!=null&&t.clipExtent(r),t}function Tf(t,n,e){return mg(t,function(r){var i=n[1][0]-n[0][0],a=n[1][1]-n[0][1],o=Math.min(i/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),s=+n[0][0]+(i-o*(r[1][0]+r[0][0]))/2,u=+n[0][1]+(a-o*(r[1][1]+r[0][1]))/2;t.scale(150*o).translate([s,u])},e)}function gg(t,n,e){return Tf(t,[[0,0],n],e)}function yg(t,n,e){return mg(t,function(r){var i=+n,a=i/(r[1][0]-r[0][0]),o=(i-a*(r[1][0]+r[0][0]))/2,s=-a*r[0][1];t.scale(150*a).translate([o,s])},e)}function vg(t,n,e){return mg(t,function(r){var i=+n,a=i/(r[1][1]-r[0][1]),o=-a*r[0][0],s=(i-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([o,s])},e)}pg.prototype={constructor:pg,point:function(t,n){this.stream.point(t,n)},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 tM=ct(30*gt);function Ik(t,n){return+n?function(e,r){function i(a,o,s,u,l,c,f,d,h,p,m,g,y,v){var x=f-a,b=d-o,w=x*x+b*b;if(w>4*r&&y--){var A=u+p,_=l+m,k=c+g,F=Jn(A*A+_*_+k*k),C=le(k/=F),D=At(At(k)-1)r||At((x*S+b*B)/w-.5)>.3||u*p+l*m+c*g2?S[2]%360*gt:0,$()):[g*on,y*on,v*on]},D.angle=function(S){return arguments.length?(x=S%360*gt,$()):x*on},D.reflectX=function(S){return arguments.length?(b=S?-1:1,$()):b<0},D.reflectY=function(S){return arguments.length?(w=S?-1:1,$()):w<0},D.precision=function(S){return arguments.length?(o=Ik(s,C=S*S),M()):Jn(C)},D.fitExtent=function(S,B){return Tf(D,S,B)},D.fitSize=function(S,B){return gg(D,S,B)},D.fitWidth=function(S,B){return yg(D,S,B)},D.fitHeight=function(S,B){return vg(D,S,B)},function(){return n=t.apply(this,arguments),D.invert=n.invert&&E,$()}}function bg(t){var n=0,e=yt/3,r=Hk(t),i=r(n,e);return i.parallels=function(a){return arguments.length?r(n=a[0]*gt,e=a[1]*gt):[n*on,e*on]},i}function eM(t,n){var e=ut(t),r=(e+ut(n))/2;if(At(r)2?h[2]*gt:0),p.invert=function(m){return(m=h.invert(m[0]*gt,m[1]*gt))[0]*=on,m[1]*=on,m},p}(i.rotate()).invert([0,0]));return u(l==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:t===jf?[[Math.max(d[0]-f,l),n],[Math.min(d[0]+f,e),r]]:[[l,Math.max(d[1]-f,n)],[e,Math.min(d[1]+f,r)]])}return i.scale=function(f){return arguments.length?(o(f),c()):o()},i.translate=function(f){return arguments.length?(s(f),c()):s()},i.center=function(f){return arguments.length?(a(f),c()):a()},i.clipExtent=function(f){return arguments.length?(f==null?l=n=e=r=null:(l=+f[0][0],n=+f[0][1],e=+f[1][0],r=+f[1][1]),c()):l==null?null:[[l,n],[e,r]]},c()}function Lf(t){return W0((rn+t)/2)}function rM(t,n){var e=ct(t),r=t===n?ut(t):ff(e/ct(n))/ff(Lf(n)/Lf(t)),i=e*I0(Lf(t),r)/r;if(!r)return jf;function a(o,s){i>0?s<-rn+dt&&(s=-rn+dt):s>rn-dt&&(s=rn-dt);var u=i/I0(Lf(s),r);return[u*ut(r*o),i-u*ct(r*o)]}return a.invert=function(o,s){var u=i-s,l=Le(r)*Jn(o*o+u*u),c=je(o,At(u))*Le(u);return u*r<0&&(c-=yt*Le(o)*Le(u)),[c/r,2*Ho(I0(i/l,1/r))-rn]},a}function qf(t,n){return[t,n]}function iM(t,n){var e=ct(t),r=t===n?ut(t):(e-ct(n))/(n-t),i=e/r+t;if(At(r)dt&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},tD.invert=Ou(le),nD.invert=Ou(function(t){return 2*Ho(t)}),eD.invert=function(t,n){return[-n,2*Ho(G_(t))-rn]};var aM=Math.abs,xg=Math.cos,If=Math.sin,rD=Math.PI,wg=rD/2,iD=function(t){return t>0?Math.sqrt(t):0}(2);function aD(t){return t>1?wg:t<-1?-wg:Math.asin(t)}function oM(t,n){var e,r=t*If(n),i=30;do n-=e=(n+If(n)-r)/(1+xg(n));while(aM(e)>1e-6&&--i>0);return n/2}var sM=function(t,n,e){function r(i,a){return[t*i*xg(a=oM(e,a)),n*If(a)]}return r.invert=function(i,a){return a=aD(a/n),[i/(t*xg(a)),aD((2*a+If(2*a))/e)]},r}(iD/wg,iD,rD);const uM=Uk(),Ag=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function _g(t,n){if(!t||typeof t!="string")throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(Wf[t]=function(e,r){return function i(){const a=r();return a.type=e,a.path=Uk().projection(a),a.copy=a.copy||function(){const o=i();return Ag.forEach(s=>{a[s]&&o[s](a[s]())}),o.path.pointRadius(a.path.pointRadius()),o},cw(a)}}(t,n),this):Wf[t]||null}function oD(t){return t&&t.path||uM}const Wf={albers:Gk,albersusa:function(){var t,n,e,r,i,a,o=Gk(),s=Pf().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=Pf().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(d,h){a=[d,h]}};function c(d){var h=d[0],p=d[1];return a=null,e.point(h,p),a||(r.point(h,p),a)||(i.point(h,p),a)}function f(){return t=n=null,c}return c.invert=function(d){var h=o.scale(),p=o.translate(),m=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?s:g>=.166&&g<.234&&m>=-.214&&m<-.115?u:o).invert(d)},c.stream=function(d){return t&&n===d?t:(h=[o.stream(n=d),s.stream(d),u.stream(d)],p=h.length,t={point:function(m,g){for(var y=-1;++y2?r[2]+90:90]):[(r=e())[0],r[1],r[2]-90]},e([0,0,90]).scale(159.155)}};for(const t in Wf)_g(t,Wf[t]);function lM(){}const fi=[[],[[[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 sD(){var t=1,n=1,e=o;function r(s,u){return u.map(l=>i(s,l))}function i(s,u){var l=[],c=[];return function(f,d,h){var p,m,g,y,v,x,b=[],w=[];for(p=m=-1,y=f[0]>=d,fi[y<<1].forEach(A);++p=d,fi[g|y<<1].forEach(A);for(fi[y|0].forEach(A);++m=d,v=f[m*t]>=d,fi[y<<1|v<<2].forEach(A);++p=d,x=v,v=f[m*t+p+1]>=d,fi[g|y<<1|v<<2|x<<3].forEach(A);fi[y|v<<3].forEach(A)}for(p=-1,v=f[m*t]>=d,fi[v<<2].forEach(A);++p=d,fi[v<<2|x<<3].forEach(A);function A(_){var k,F,C=[_[0][0]+p,_[0][1]+m],D=[_[1][0]+p,_[1][1]+m],E=a(C),$=a(D);(k=w[E])?(F=b[$])?(delete w[k.end],delete b[F.start],k===F?(k.ring.push(D),h(k.ring)):b[k.start]=w[F.end]={start:k.start,end:F.end,ring:k.ring.concat(F.ring)}):(delete w[k.end],k.ring.push(D),w[k.end=$]=k):(k=b[$])?(F=w[E])?(delete b[k.start],delete w[F.end],k===F?(k.ring.push(D),h(k.ring)):b[F.start]=w[k.end]={start:F.start,end:k.end,ring:F.ring.concat(k.ring)}):(delete b[k.start],k.ring.unshift(C),b[k.start=E]=k):b[E]=w[$]={start:E,end:$,ring:[C,D]}}fi[v<<3].forEach(A)}(s,u,f=>{e(f,s,u),function(d){for(var h=0,p=d.length,m=d[p-1][1]*d[0][0]-d[p-1][0]*d[0][1];++h0?l.push([f]):c.push(f)}),c.forEach(f=>{for(var d,h=0,p=l.length;h{var f,d=c[0],h=c[1],p=0|d,m=0|h,g=u[m*t+p];d>0&&d0&&h=0&&l>=0||j("invalid size"),t=u,n=l,r},r.smooth=function(s){return arguments.length?(e=s?o:lM,r):e===o},r}function cM(t,n){for(var e,r=-1,i=n.length;++rr!=h>r&&e<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function dM(t,n,e){var r,i,a,o;return function(s,u,l){return(u[0]-s[0])*(l[1]-s[1])===(l[0]-s[0])*(u[1]-s[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=e[r],o=n[r],i<=a&&a<=o||o<=a&&a<=i)}function uD(t,n,e){return function(r){var i=kr(r),a=e?Math.min(i[0],0):i[0],o=i[1],s=o-a,u=n?fx(a,o,t):s/(t+1);return xe(a+u,o,u)}}function kg(t){O.call(this,null,t)}function lD(t,n,e,r,i){const a=t.x1||0,o=t.y1||0,s=n*e<0;function u(f){f.forEach(l)}function l(f){s&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-a)*n+r,f[1]=(f[1]-o)*e+i}return function(f){return f.coordinates.forEach(u),f}}function cD(t,n,e){const r=t>=0?t:kp(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function Dg(t){return bt(t)?t:In(+t)}function fD(){var t=u=>u[0],n=u=>u[1],e=Gs,r=[-1,-1],i=960,a=500,o=2;function s(u,l){const c=cD(r[0],u,t)>>o,f=cD(r[1],u,n)>>o,d=c?c+2:0,h=f?f+2:0,p=2*d+(i>>o),m=2*h+(a>>o),g=new Float32Array(p*m),y=new Float32Array(p*m);let v=g;u.forEach(b=>{const w=d+(+t(b)>>o),A=h+(+n(b)>>o);w>=0&&w=0&&A0&&f>0?(Jo(p,m,g,y,c),Ko(p,m,y,g,f),Jo(p,m,g,y,c),Ko(p,m,y,g,f),Jo(p,m,g,y,c),Ko(p,m,y,g,f)):c>0?(Jo(p,m,g,y,c),Jo(p,m,y,g,c),Jo(p,m,g,y,c),v=y):f>0&&(Ko(p,m,g,y,f),Ko(p,m,y,g,f),Ko(p,m,g,y,f),v=y);const x=l?Math.pow(2,-2*o):1/Jx(v);for(let b=0,w=p*m;b>o),y2:h+(a>>o)}}return s.x=function(u){return arguments.length?(t=Dg(u),s):t},s.y=function(u){return arguments.length?(n=Dg(u),s):n},s.weight=function(u){return arguments.length?(e=Dg(u),s):e},s.size=function(u){if(!arguments.length)return[i,a];var l=+u[0],c=+u[1];return l>=0&&c>=0||j("invalid size"),i=l,a=c,s},s.cellSize=function(u){return arguments.length?((u=+u)>=1||j("invalid cell size"),o=Math.floor(Math.log(u)/Math.LN2),s):1<=i&&(s>=a&&(u-=e[s-a+o*t]),r[s-i+o*t]=u/Math.min(s+1,t-1+a-s,a))}function Ko(t,n,e,r,i){const a=1+(i<<1);for(let o=0;o=i&&(s>=a&&(u-=e[o+(s-a)*t]),r[o+(s-i)*t]=u/Math.min(s+1,n-1+a-s,a))}function Fg(t){O.call(this,null,t)}kg.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},V(kg,O,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||Me,a=sD().smooth(t.smooth!==!1),o=t.thresholds||function(l,c,f){const d=uD(f.levels||10,f.nice,f.zero!==!1);return f.resolve!=="shared"?d:d(l.map(h=>Ca(c(h).values)))}(r,i,t),s=t.as===null?null:t.as||"contour",u=[];return r.forEach(l=>{const c=i(l),f=a.size([c.width,c.height])(c.values,P(o)?o:o(c.values));(function(d,h,p,m){let g=m.scale||h.scale,y=m.translate||h.translate;if(bt(g)&&(g=g(p,m)),bt(y)&&(y=y(p,m)),(g===1||g==null)&&!y)return;const v=($t(g)?g:g[0])||1,x=($t(g)?g:g[1])||1,b=y&&y[0]||0,w=y&&y[1]||0;d.forEach(lD(h,v,x,b,w))})(f,c,l,t),f.forEach(d=>{u.push(nc(l,St(s!=null?{[s]:d}:d)))})}),this.value&&(e.rem=this.value),this.value=e.source=e.add=u,e}}),Fg.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const hM=["x","y","weight","size","cellSize","bandwidth"];function dD(t,n){return hM.forEach(e=>n[e]!=null?t[e](n[e]):0),t}function Cg(t){O.call(this,null,t)}V(Fg,O,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(u,l){var c,f,d,h,p,m,g=[],y=v=>v(h);if(l==null)g.push(u);else for(c={},f=0,d=u.length;fSt(function(l,c){for(let f=0;fdt}).map(l)).concat(xe(cf(o/p)*p,a,p).filter(function(b){return At(b%g)>dt}).map(c))}return v.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},v.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(d(s).slice(1),f(r).reverse().slice(1),d(u).reverse().slice(1))]}},v.extent=function(b){return arguments.length?v.extentMajor(b).extentMinor(b):v.extentMinor()},v.extentMajor=function(b){return arguments.length?(i=+b[0][0],r=+b[1][0],u=+b[0][1],s=+b[1][1],i>r&&(b=i,i=r,r=b),u>s&&(b=u,u=s,s=b),v.precision(y)):[[i,u],[r,s]]},v.extentMinor=function(b){return arguments.length?(e=+b[0][0],n=+b[1][0],o=+b[0][1],a=+b[1][1],e>n&&(b=e,e=n,n=b),o>a&&(b=o,o=a,a=b),v.precision(y)):[[e,o],[n,a]]},v.step=function(b){return arguments.length?v.stepMajor(b).stepMinor(b):v.stepMinor()},v.stepMajor=function(b){return arguments.length?(m=+b[0],g=+b[1],v):[m,g]},v.stepMinor=function(b){return arguments.length?(h=+b[0],p=+b[1],v):[h,p]},v.precision=function(b){return arguments.length?(y=+b,l=_k(o,a,90),c=kk(e,n,y),f=_k(u,s,90),d=kk(i,r,y),v):y},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Ng(t){O.call(this,null,t)}function hD(t){if(!bt(t))return!1;const n=Dr(Wn(t));return n.$x||n.$y||n.$value||n.$max}function pD(t){O.call(this,null,t),this.modified(!0)}function mD(t,n,e){bt(t[n])&&t[n](e)}Sg.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},V(Sg,O,{transform(t,n){var e,r=this._features,i=this._points,a=t.fields,o=a&&a[0],s=a&&a[1],u=t.geojson||!a&&Me,l=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(Wn(u))||o&&n.modified(Wn(o))||s&&n.modified(Wn(s)),this.value&&!e||(l=n.SOURCE,this._features=r=[],this._points=i=[]),u&&n.visit(l,c=>r.push(u(c))),o&&s&&(n.visit(l,c=>{var f=o(c),d=s(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&i.push([f,d])}),r=r.concat({type:Eg,geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:$g,features:r}}}),Mg.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},V(Mg,O,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||Me,a=t.as||"path",o=e.SOURCE;!r||t.modified()?(this.value=r=oD(t.projection),e.materialize().reflow()):o=i===Me||n.modified(i.fields)?e.ADD_MOD:e.ADD;const s=function(u,l){const c=u.pointRadius();return u.context(null),l!=null&&u.pointRadius(l),c}(r,t.pointRadius);return e.visit(o,u=>u[a]=r(i(u))),r.pointRadius(s),e.modifies(a)}}),Bg.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},V(Bg,O,{transform(t,n){var e,r=t.projection,i=t.fields[0],a=t.fields[1],o=t.as||["x","y"],s=o[0],u=o[1];function l(c){const f=r([i(c),a(c)]);f?(c[s]=f[0],c[u]=f[1]):(c[s]=void 0,c[u]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,l):(e=n.modified(i.fields)||n.modified(a.fields),n.visit(e?n.ADD_MOD:n.ADD,l)),n.modifies(o)}}),zg.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},V(zg,O,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",a=e.ADD;return r&&!t.modified()||(this.value=r=function(o,s,u){const l=u==null?c=>o(s(c)):c=>{var f=o.pointRadius(),d=o.pointRadius(u)(s(c));return o.pointRadius(f),d};return l.context=c=>(o.context(c),l),l}(oD(t.projection),t.field||ei("datum"),t.pointRadius),e.materialize().reflow(),a=e.SOURCE),e.visit(a,o=>o[i]=r),e.modifies(i)}}),Og.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},V(Og,O,{transform(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(const a in t)bt(i[a])&&i[a](t[a]);return e=i(),r.length?n.mod.push(Zx(r[0],e)):n.add.push(St(e)),r[0]=e,n}}),Ng.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},V(Ng,O,{transform(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r=t.resolve==="shared",i=t.field||Me,a=function(l,c){let f;return bt(l)?(f=d=>l(d,c),f.dep=hD(l)):l?f=In(l):(f=d=>d.$value/d.$max||0,f.dep=!0),f}(t.opacity,t),o=function(l,c){let f;return bt(l)?(f=d=>Jl(l(d,c)),f.dep=hD(l)):f=In(Jl(l||"#888")),f}(t.color,t),s=t.as||"image",u={$x:0,$y:0,$value:0,$max:r?Ca(e.map(l=>Ca(i(l).values))):0};return e.forEach(l=>{const c=i(l),f=xt({},l,u);r||(f.$max=Ca(c.values||[])),l[s]=function(d,h,p,m){const g=d.width,y=d.height,v=d.x1||0,x=d.y1||0,b=d.x2||g,w=d.y2||y,A=d.values,_=A?E=>A[E]:ip,k=qi(b-v,w-x),F=k.getContext("2d"),C=F.getImageData(0,0,b-v,w-x),D=C.data;for(let E=x,$=0;E{t[r]!=null&&mD(e,r,t[r])})):Ag.forEach(r=>{t.modified(r)&&mD(e,r,t[r])}),t.pointRadius!=null&&e.path.pointRadius(t.pointRadius),t.fit&&function(r,i){const a=function(o){return o=K(o),o.length===1?o[0]:{type:$g,features:o.reduce((s,u)=>s.concat(function(l){return l.type===$g?l.features:K(l).filter(c=>c!=null).map(c=>c.type===Eg?c:{type:Eg,geometry:c})}(u)),[])}}(i.fit);i.extent?r.fitExtent(i.extent,a):i.size&&r.fitSize(i.size,a)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});const pM=Object.freeze(Object.defineProperty({__proto__:null,contour:Cg,geojson:Sg,geopath:Mg,geopoint:Bg,geoshape:zg,graticule:Og,heatmap:Ng,isocontour:kg,kde2d:Fg,projection:pD},Symbol.toStringTag,{value:"Module"}));function gD(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,a,o,s,u,l,c,f,d,h=t._root,p={data:r},m=t._x0,g=t._y0,y=t._x1,v=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((l=n>=(a=(m+y)/2))?m=a:y=a,(c=e>=(o=(g+v)/2))?g=o:v=o,i=h,!(h=h[f=c<<1|l]))return i[f]=p,t;if(s=+t._x.call(null,h.data),u=+t._y.call(null,h.data),n===s&&e===u)return p.next=h,i?i[f]=p:t._root=p,t;do i=i?i[f]=new Array(4):t._root=new Array(4),(l=n>=(a=(m+y)/2))?m=a:y=a,(c=e>=(o=(g+v)/2))?g=o:v=o;while((f=c<<1|l)==(d=(u>=o)<<1|s>=a));return i[d]=h,i[f]=p,t}function te(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function mM(t){return t[0]}function gM(t){return t[1]}function Rg(t,n,e){var r=new Tg(n??mM,e??gM,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function Tg(t,n,e,r,i,a){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function yD(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var ne=Rg.prototype=Tg.prototype;function ee(t){return function(){return t}}function ea(t){return 1e-6*(t()-.5)}function yM(t){return t.x+t.vx}function vM(t){return t.y+t.vy}function bM(t){return t.index}function vD(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}ne.copy=function(){var t,n,e=new Tg(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=yD(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=yD(n));return e},ne.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return gD(this.cover(n,e),n,e,t)},ne.addAll=function(t){var n,e,r,i,a=t.length,o=new Array(a),s=new Array(a),u=1/0,l=1/0,c=-1/0,f=-1/0;for(e=0;ec&&(c=r),if&&(f=i));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),e=0;et||t>=i||r>n||n>=a;)switch(s=(nd||(a=u.y0)>h||(o=u.x1)=y)<<1|t>=g)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}else{var v=t-+this._x.call(null,m.data),x=n-+this._y.call(null,m.data),b=v*v+x*x;if(b=(s=(p+g)/2))?p=s:g=s,(c=o>=(u=(m+y)/2))?m=u:y=u,n=h,!(h=h[f=c<<1|l]))return this;if(!h.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,d=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(h=n[0]||n[1]||n[2]||n[3])&&h===(n[3]||n[2]||n[1]||n[0])&&!h.length&&(e?e[d]=h:this._root=h),this):(this._root=i,this)},ne.removeAll=function(t){for(var n=0,e=t.length;n(m=(1664525*m+1013904223)%bD)/bD}();function f(){d(),l.call("tick",n),e1?(g==null?s.delete(m):s.set(m,p(g)),n):s.get(m)},find:function(m,g,y){var v,x,b,w,A,_=0,k=t.length;for(y==null?y=1/0:y*=y,_=0;_1?(l.on(m,g),n):l.on(m)}}}const xD={center:function(t,n){var e,r=1;function i(){var a,o,s=e.length,u=0,l=0;for(a=0;ad+C||Ah+C||_f.index){var D=d-k.x-k.vx,E=h-k.y-k.vy,$=D*D+E*E;$l.r&&(l.r=l[c].r)}function u(){if(n){var l,c,f=n.length;for(e=new Array(f),l=0;l=s)){(h.data!==n||h.next)&&(y===0&&(b+=(y=ea(e))*y),v===0&&(b+=(v=ea(e))*v),b[s(b,w,r),b]));for(m=0,i=new Array(y);mn(r,e):n)}jg.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:wD}]},V(jg,O,{transform(t,n){var e,r,i=this.value,a=n.changed(n.ADD_REM),o=t.modified(Pg),s=t.iterations||300;if(i?(a&&(n.modifies("index"),i.nodes(n.source)),(o||n.changed(n.MOD))&&AD(i,t,0,n)):(this.value=i=function(u,l){const c=_M(u),f=c.stop,d=c.restart;let h=!1;return c.stopped=()=>h,c.restart=()=>(h=!1,d()),c.stop=()=>(h=!0,f()),AD(c,l,!0).on("end",()=>h=!0)}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(a=!0,i.tick()),n.modifies("index")),o||a||t.modified(kM)||n.changed()&&t.restart){if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/s)),t.static)for(i.stop();--s>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return n.StopPropagation}return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let s,u=this._argops,l=0,c=u.length;l=0;)n+=e[r].value;else n=1;t.value=n}function Lg(t,n){t instanceof Map?(t=[void 0,t],n===void 0&&(n=OM)):n===void 0&&(n=zM);for(var e,r,i,a,o,s=new Qo(t),u=[s];e=u.pop();)if((i=n(e.data))&&(o=(i=Array.from(i)).length))for(e.children=i,a=o-1;a>=0;--a)u.push(r=i[a]=new Qo(i[a])),r.parent=e,r.depth=e.depth+1;return s.eachBefore(_D)}function zM(t){return t.children}function OM(t){return Array.isArray(t)?t[1]:null}function NM(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function _D(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function Qo(t){this.data=t,this.depth=this.height=0,this.parent=null}function Hf(t){return t==null?null:kD(t)}function kD(t){if(typeof t!="function")throw new Error;return t}function Ha(){return 0}function Zo(t){return function(){return t}}Qo.prototype=Lg.prototype={constructor:Qo,count:function(){return this.eachAfter(BM)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,a=this,o=[a],s=[],u=-1;a=o.pop();)if(s.push(a),e=a.children)for(r=0,i=e.length;r=0;--r)a.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(a,o){if(a===o)return a;var s=a.ancestors(),u=o.ancestors(),l=null;for(a=s.pop(),o=u.pop();a===o;)l=a,a=s.pop(),o=u.pop();return l}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return Lg(this).eachBefore(NM)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,a=[i];do for(t=a.reverse(),a=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e0&&e*e>r*r+i*i}function qg(t,n){for(var e=0;e1e-6?(D+Math.sqrt(D*D-4*C*E))/(2*C):E/D);return{x:r+A+_*$,y:i+k+F*$,r:$}}function ED(t,n,e){var r,i,a,o,s=t.x-n.x,u=t.y-n.y,l=s*s+u*u;l?(i=n.r+e.r,i*=i,o=t.r+e.r,i>(o*=o)?(r=(l+o-i)/(2*l),a=Math.sqrt(Math.max(0,o/l-r*r)),e.x=t.x-r*s-a*u,e.y=t.y-r*u+a*s):(r=(l+i-o)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),e.x=n.x+r*s-a*u,e.y=n.y+r*u+a*s)):(e.x=n.x+e.r,e.y=n.y)}function $D(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function SD(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,a=(n.y*e.r+e.y*n.r)/r;return i*i+a*a}function Vf(t){this._=t,this.next=null,this.previous=null}function PM(t,n){if(!(a=(t=function(h){return typeof h=="object"&&"length"in h?h:Array.from(h)}(t)).length))return 0;var e,r,i,a,o,s,u,l,c,f,d;if((e=t[0]).x=0,e.y=0,!(a>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(a>2))return e.r+r.r;ED(r,e,i=t[2]),e=new Vf(e),r=new Vf(r),i=new Vf(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(u=3;ufunction(A){A=`${A}`;let _=A.length;return Wg(A,_-1)&&!Wg(A,_-2)&&(A=A.slice(0,-1)),A[0]==="/"?A:`/${A}`}(t(b,w,i))),v=y.map(RD),x=new Set(y).add("");for(const b of v)x.has(b)||(x.add(b),y.push(b),v.push(RD(b)),h.push(Ig));p=(b,w)=>y[w],m=(b,w)=>v[w]}for(s=0,a=h.length;s=0&&(c=h[y]).data===Ig;--y)c.data=null}if(u.parent=LM,u.eachBefore(function(y){y.depth=y.parent.depth+1,--a}).eachBefore(_D),u.parent=null,a>0)throw new Error("cycle");return u}return r.id=function(i){return arguments.length?(n=Hf(i),r):n},r.parentId=function(i){return arguments.length?(e=Hf(i),r):e},r.path=function(i){return arguments.length?(t=Hf(i),r):t},r}function RD(t){let n=t.length;if(n<2)return"";for(;--n>1&&!Wg(t,n););return t.slice(0,n)}function Wg(t,n){if(t[n]==="/"){let e=0;for(;n>0&&t[--n]==="\\";)++e;if(!(1&e))return!0}return!1}function IM(t,n){return t.parent===n.parent?1:2}function Hg(t){var n=t.children;return n?n[0]:t.t}function Gg(t){var n=t.children;return n?n[n.length-1]:t.t}function WM(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function HM(t,n,e){return t.a.parent===n.parent?t.a:e}function Yf(t,n){this._=t,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=n}function Xf(t,n,e,r,i){for(var a,o=t.children,s=-1,u=o.length,l=t.value&&(i-e)/t.value;++sd&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(o={value:c,dice:u1?r:1)},e}(TD),GM=function t(n){function e(r,i,a,o,s){if((u=r._squarify)&&u.ratio===n)for(var u,l,c,f,d,h=-1,p=u.length,m=r.value;++h1?r:1)},e}(TD);function Vg(t,n,e){const r={};return t.each(i=>{const a=i.data;e(a)&&(r[n(a)]=i)}),t.lookup=r,t}function Yg(t){O.call(this,null,t)}Yg.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const VM=t=>t.values;function YM(){const t=[],n={entries:i=>r(e(i,0),0),key:i=>(t.push(i),n)};function e(i,a){if(a>=t.length)return i;const o=i.length,s=t[a++],u={},l={};let c,f,d,h=-1;for(;++ht.length)return i;const o=[];for(const s in i)o.push({key:s,values:r(i[s],a)});return o}return n}function di(t){O.call(this,null,t)}V(Yg,O,{transform(t,n){n.source||j("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),i=n.clone(),a=this.value;return(!a||r||n.changed())&&(a&&a.each(o=>{o.children&&tc(o.data)&&i.rem.push(o.data)}),this.value=a=Lg({values:K(t.keys).reduce((o,s)=>(o.key(s),o),YM()).entries(i.source)},VM),e&&a.each(o=>{o.children&&(o=St(o.data),i.add.push(o),i.source.push(o))}),Vg(a,st,st)),i.source.root=a,i}});const XM=(t,n)=>t.parent===n.parent?1:2;V(di,O,{transform(t,n){n.source&&n.source.root||j(this.constructor.name+" transform requires a backing tree data source.");const e=this.layout(t.method),r=this.fields,i=n.source.root,a=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(Sa(t.sort,o=>o.data)),function(o,s,u){for(let l,c=0,f=s.length;cfunction(s,u,l){const c=s.data,f=u.length-1;for(let d=0;d(s=(1664525*s+1013904223)%DD)/DD}();return a.x=n/2,a.y=e/2,t?a.eachBefore(MD(t)).eachAfter(Ug(r,.5,o)).eachBefore(BD(1)):a.eachBefore(MD(jM)).eachAfter(Ug(Ha,1,o)).eachAfter(Ug(r,a.r/Math.min(n,e),o)).eachBefore(BD(Math.min(n,e)/(2*a.r))),a}return i.radius=function(a){return arguments.length?(t=Hf(a),i):t},i.size=function(a){return arguments.length?(n=+a[0],e=+a[1],i):[n,e]},i.padding=function(a){return arguments.length?(r=typeof a=="function"?a:Zo(+a),i):r},i},params:["radius","size","padding"],fields:Xg});const Kg=["x0","y0","x1","y1","depth","children"];function Qg(t){di.call(this,t)}function Zg(t){O.call(this,null,t)}Qg.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Kg.length,default:Kg}]},V(Qg,di,{layout:function(){var t=1,n=1,e=0,r=!1;function i(a){var o=a.height+1;return a.x0=a.y0=e,a.x1=t,a.y1=n/o,a.eachBefore(function(s,u){return function(l){l.children&&qu(l,l.x0,s*(l.depth+1)/u,l.x1,s*(l.depth+2)/u);var c=l.x0,f=l.y0,d=l.x1-e,h=l.y1-e;d=0;--w)k.push(x=v.children[w]=new Yf(b[w],w)),x.parent=v;return(_.parent=new Yf(null,0)).children=[_],_}(u);if(l.eachAfter(a),l.parent.m=-l.z,l.eachBefore(o),r)u.eachBefore(s);else{var c=u,f=u,d=u;u.eachBefore(function(y){y.xf.x&&(f=y),y.depth>d.depth&&(d=y)});var h=c===f?1:t(c,f)/2,p=h-c.x,m=n/(f.x+h+p),g=e/(d.depth||1);u.eachBefore(function(y){y.x=(y.x+p)*m,y.y=y.depth*g})}return u}function a(u){var l=u.children,c=u.parent.children,f=u.i?c[u.i-1]:null;if(l){(function(h){for(var p,m=0,g=0,y=h.children,v=y.length;--v>=0;)(p=y[v]).z+=m,p.m+=m,m+=p.s+(g+=p.c)})(u);var d=(l[0].z+l[l.length-1].z)/2;f?(u.z=f.z+t(u._,f._),u.m=u.z-d):u.z=d}else f&&(u.z=f.z+t(u._,f._));u.parent.A=function(h,p,m){if(p){for(var g,y=h,v=h,x=p,b=y.parent.children[0],w=y.m,A=v.m,_=x.m,k=b.m;x=Gg(x),y=Hg(y),x&&y;)b=Hg(b),(v=Gg(v)).a=h,(g=x.z+_-y.z-w+t(x._,y._))>0&&(WM(HM(x,h,m),h,g),w+=g,A+=g),_+=x.m,w+=y.m,k+=b.m,A+=v.m;x&&!Gg(v)&&(v.t=x,v.m+=_-A),y&&!Hg(b)&&(b.t=y,b.m+=w-k,m=h)}return m}(u,f,u.parent.A||c[0])}function o(u){u._.x=u.z+u.parent.m,u.m+=u.parent.m}function s(u){u.x*=n,u.y=u.depth*e}return i.separation=function(u){return arguments.length?(t=u,i):t},i.size=function(u){return arguments.length?(r=!1,n=+u[0],e=+u[1],i):r?null:[n,e]},i.nodeSize=function(u){return arguments.length?(r=!0,n=+u[0],e=+u[1],i):r?[n,e]:null},i},cluster:function(){var t=$M,n=1,e=1,r=!1;function i(a){var o,s=0;a.eachAfter(function(d){var h=d.children;h?(d.x=function(p){return p.reduce(SM,0)/p.length}(h),d.y=function(p){return 1+p.reduce(MM,0)}(h)):(d.x=o?s+=t(d,o):0,d.y=0,o=d)});var u=function(d){for(var h;h=d.children;)d=h[0];return d}(a),l=function(d){for(var h;h=d.children;)d=h[h.length-1];return d}(a),c=u.x-t(u,l)/2,f=l.x+t(l,u)/2;return a.eachAfter(r?function(d){d.x=(d.x-a.x)*n,d.y=(a.y-d.y)*e}:function(d){d.x=(d.x-c)/(f-c)*n,d.y=(1-(a.y?d.y/a.y:1))*e})}return i.separation=function(a){return arguments.length?(t=a,i):t},i.size=function(a){return arguments.length?(r=!1,n=+a[0],e=+a[1],i):r?null:[n,e]},i.nodeSize=function(a){return arguments.length?(r=!0,n=+a[0],e=+a[1],i):r?[n,e]:null},i}},t1=["x","y","depth","children"];function n1(t){di.call(this,t)}function e1(t){O.call(this,[],t)}n1.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:t1.length,default:t1}]},V(n1,di,{layout(t){const n=t||"tidy";if(tt(LD,n))return LD[n]();j("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:t1}),e1.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},V(e1,O,{transform(t,n){const e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),a={};return r||j("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,o=>a[st(o)]=1),r.each(o=>{const s=o.data,u=o.parent&&o.parent.data;u&&a[st(s)]&&a[st(u)]&&i.add.push(St({source:u,target:s}))}),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,o=>a[st(o)]=1),e.forEach(o=>{(a[st(o.source)]||a[st(o.target)])&&i.mod.push(o)})),i}});const qD={binary:function(t,n,e,r,i){var a,o,s=t.children,u=s.length,l=new Array(u+1);for(l[0]=o=a=0;a=d-1){var v=s[f];return v.x0=p,v.y0=m,v.x1=g,void(v.y1=y)}for(var x=l[f],b=h/2+x,w=f+1,A=d-1;w>>1;l[_]y-m){var C=h?(p*F+g*k)/h:g;c(f,w,k,p,m,C,y),c(w,d,F,C,m,g,y)}else{var D=h?(m*F+y*k)/h:y;c(f,w,k,p,m,g,D),c(w,d,F,p,D,g,y)}})(0,u,t.value,n,e,r,i)},dice:qu,slice:Xf,slicedice:function(t,n,e,r,i){(1&t.depth?Xf:qu)(t,n,e,r,i)},squarify:jD,resquarify:GM},r1=["x0","y0","x1","y1","depth","children"];function i1(t){di.call(this,t)}i1.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:r1.length,default:r1}]},V(i1,di,{layout(){const t=function(){var n=jD,e=!1,r=1,i=1,a=[0],o=Ha,s=Ha,u=Ha,l=Ha,c=Ha;function f(h){return h.x0=h.y0=0,h.x1=r,h.y1=i,h.eachBefore(d),a=[0],e&&h.eachBefore(zD),h}function d(h){var p=a[h.depth],m=h.x0+p,g=h.y0+p,y=h.x1-p,v=h.y1-p;y{const e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=n=>{tt(qD,n)?t.tile(qD[n]):j("Unrecognized Treemap layout method: "+n)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:r1});const JM=Object.freeze(Object.defineProperty({__proto__:null,nest:Yg,pack:Jg,partition:Qg,stratify:Zg,tree:n1,treelinks:e1,treemap:i1},Symbol.toStringTag,{value:"Module"})),a1=4278190080;function o1(t,n,e){return new Uint32Array(t.getImageData(0,0,n,e).data.buffer)}function Jf(t,n,e){if(!n.length)return;const r=n[0].mark.marktype;r==="group"?n.forEach(i=>{i.items.forEach(a=>Jf(t,a.items,e))}):Ae[r].draw(t,{items:e?n.map(KM):n})}function KM(t){const n=nc(t,{});return n.stroke&&n.strokeOpacity!==0||n.fill&&n.fillOpacity!==0?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const re=31,ra=new Uint32Array(33),rr=new Uint32Array(33);rr[0]=0,ra[0]=~rr[0];for(let t=1;t<=32;++t)rr[t]=rr[t-1]<<1|1,ra[t]=~rr[t];function QM(t,n,e){const r=Math.max(1,Math.sqrt(t*n/1e6)),i=~~((t+2*e+r)/r),a=~~((n+2*e+r)/r),o=s=>~~((s+e)/r);return o.invert=s=>s*r-e,o.bitmap=()=>function(s,u){const l=new Uint32Array(~~((s*u+32)/32));function c(d,h){l[d]|=h}function f(d,h){l[d]&=h}return{array:l,get:(d,h)=>{const p=h*s+d;return l[p>>>5]&1<<(p&re)},set:(d,h)=>{const p=h*s+d;c(p>>>5,1<<(p&re))},clear:(d,h)=>{const p=h*s+d;f(p>>>5,~(1<<(p&re)))},getRange:(d,h,p,m)=>{let g,y,v,x,b=m;for(;b>=h;--b)if(g=b*s+d,y=b*s+p,v=g>>>5,x=y>>>5,v===x){if(l[v]&ra[g&re]&rr[1+(y&re)])return!0}else{if(l[v]&ra[g&re]||l[x]&rr[1+(y&re)])return!0;for(let w=v+1;w{let g,y,v,x,b;for(;h<=m;++h)if(g=h*s+d,y=h*s+p,v=g>>>5,x=y>>>5,v===x)c(v,ra[g&re]&rr[1+(y&re)]);else for(c(v,ra[g&re]),c(x,rr[1+(y&re)]),b=v+1;b{let g,y,v,x,b;for(;h<=m;++h)if(g=h*s+d,y=h*s+p,v=g>>>5,x=y>>>5,v===x)f(v,rr[g&re]|ra[1+(y&re)]);else for(f(v,rr[g&re]),f(x,ra[1+(y&re)]),b=v+1;bd<0||h<0||m>=u||p>=s}}(i,a),o.ratio=r,o.padding=e,o.width=t,o.height=n,o}function Kf(t,n,e,r,i,a){let o=e/2;return t-o<0||t+o>i||n-(o=r/2)<0||n+o>a}function ia(t,n,e,r,i,a,o,s){const u=i*a/(2*r),l=t(n-u),c=t(n+u),f=t(e-(a/=2)),d=t(e+a);return o.outOfBounds(l,f,c,d)||o.getRange(l,f,c,d)||s&&s.getRange(l,f,c,d)}const ZM=[-1,-1,1,1],tB=[-1,1,-1,1],nB=["right","center","left"],eB=["bottom","middle","top"];function UD(t,n,e,r,i,a,o,s,u,l,c,f){return!(i.outOfBounds(t,e,n,r)||(f&&a||i).getRange(t,e,n,r))}const rB={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},iB={naive:function(t,n,e,r){const i=t.width,a=t.height;return function(o){const s=o.datum.datum.items[r].items,u=s.length,l=o.datum.fontSize,c=we.width(o.datum,o.datum.text);let f,d,h,p,m,g,y,v=0;for(let x=0;x=v&&(v=y,o.x=m,o.y=g);return m=c/2,g=l/2,f=o.x-m,d=o.x+m,h=o.y-g,p=o.y+g,o.align="center",f<0&&d<=i?o.align="left":0<=f&&i=1;)g=(y+v)/2,ia(t,p,m,h,d,g,o,s)?v=g:y=g;if(y>f)return[p,m,y,!0]}}return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=we.width(l.datum,l.datum.text);let p,m,g,y,v,x,b,w,A,_,k,F,C,D,E,$,M,S=e?d:0,B=!1,z=!1,N=0;for(let W=0;Wm&&(M=p,p=m,m=M),g>y&&(M=g,g=y,y=M),A=t(p),k=t(m),_=~~((A+k)/2),F=t(g),D=t(y),C=~~((F+D)/2),b=_;b>=A;--b)for(w=C;w>=F;--w)$=u(b,w,S,h,d),$&&([l.x,l.y,S,B]=$);for(b=_;b<=k;++b)for(w=C;w<=D;++w)$=u(b,w,S,h,d),$&&([l.x,l.y,S,B]=$);B||e||(E=Math.abs(m-p+y-g),v=(p+m)/2,x=(g+y)/2,E>=N&&!Kf(v,x,h,d,i,a)&&!ia(t,v,x,d,h,d,o,null)&&(N=E,l.x=v,l.y=x,z=!0))}return!(!B&&!z)&&(v=h/2,x=d/2,o.setRange(t(l.x-v),t(l.y-x),t(l.x+v),t(l.y+x)),l.align="center",l.baseline="middle",!0)}},floodfill:function(t,n,e,r){const i=t.width,a=t.height,o=n[0],s=n[1],u=t.bitmap();return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=we.width(l.datum,l.datum.text),p=[];let m,g,y,v,x,b,w,A,_,k,F,C,D=e?d:0,E=!1,$=!1,M=0;for(let S=0;S=1;)F=(_+k)/2,ia(t,x,b,d,h,F,o,s)?k=F:_=F;_>D&&(l.x=x,l.y=b,D=_,E=!0)}}E||e||(C=Math.abs(g-m+v-y),x=(m+g)/2,b=(y+v)/2,C>=M&&!Kf(x,b,h,d,i,a)&&!ia(t,x,b,d,h,d,o,null)&&(M=C,l.x=x,l.y=b,$=!0))}return!(!E&&!$)&&(x=h/2,b=d/2,o.setRange(t(l.x-x),t(l.y-b),t(l.x+x),t(l.y+b)),l.align="center",l.baseline="middle",!0)}}};function aB(t,n,e,r,i,a,o,s,u,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),d=function(D,E){const $=new Float64Array(E),M=D.length;for(let S=0;S[B.x,B.x,B.x,B.y,B.y,B.y];return D?D==="line"||D==="area"?B=>S(B.datum):E==="line"?B=>{const z=B.datum.items[M].items;return S(z.length?z[$==="start"?0:z.length-1]:{x:NaN,y:NaN})}:B=>{const z=B.datum.bounds;return[z.x1,(z.x1+z.x2)/2,z.x2,z.y1,(z.y1+z.y2)/2,z.y2]}:S}(p,m,s,u),v=l===null||l===1/0,x=g&&c==="naive";var b;let w=-1,A=-1;const _=t.map(D=>{const E=v?we.width(D,D.text):void 0;return w=Math.max(w,E),A=Math.max(A,D.fontSize),{datum:D,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(D),textWidth:E}});l=l===null||l===1/0?Math.max(w,A)+Math.max(...r):l;const k=QM(n[0],n[1],l);let F;if(!x){e&&_.sort(($,M)=>e($.datum,M.datum));let D=!1;for(let $=0;$$.datum);F=a.length||E?function($,M,S,B,z){const N=$.width,W=$.height,X=B||z,L=qi(N,W).getContext("2d"),et=qi(N,W).getContext("2d"),ot=X&&qi(N,W).getContext("2d");S.forEach(ti=>Jf(L,ti,!1)),Jf(et,M,!1),X&&Jf(ot,M,!0);const nt=o1(L,N,W),mt=o1(et,N,W),pt=X&&o1(ot,N,W),J=$.bitmap(),Mt=X&&$.bitmap();let Tt,kt,Et,tn,nn,It,be,zn;for(kt=0;ktS.set($(B.boundary[0]),$(B.boundary[3]))),[S,void 0]}(k,o&&_)}const C=g?iB[c](k,F,o,u):function(D,E,$,M){const S=D.width,B=D.height,z=E[0],N=E[1],W=M.length;return function(X){const L=X.boundary,et=X.datum.fontSize;if(L[2]<0||L[5]<0||L[0]>S||L[3]>B)return!1;let ot,nt,mt,pt,J,Mt,Tt,kt,Et,tn,nn,It,be,zn,ti,Je=X.textWidth??0;for(let Se=0;Se>>2&3)-1,mt=ot===0&&nt===0||M[Se]<0,pt=ot&&nt?Math.SQRT1_2:1,J=M[Se]<0?-1:1,Mt=L[1+ot]+M[Se]*ot*pt,nn=L[4+nt]+J*et*nt/2+M[Se]*nt*pt,kt=nn-et/2,Et=nn+et/2,It=D(Mt),zn=D(kt),ti=D(Et),!Je){if(!UD(It,It,zn,ti,z,N,0,0,0,0,0,mt))continue;Je=we.width(X.datum,X.datum.text)}if(tn=Mt+J*Je*ot/2,Mt=tn-Je/2,Tt=tn+Je/2,It=D(Mt),be=D(Tt),UD(It,be,zn,ti,z,N,0,0,0,0,0,mt))return X.x=ot?ot*J<0?Tt:Mt:tn,X.y=nt?nt*J<0?Et:kt:nn,X.align=nB[ot*J+1],X.baseline=eB[nt*J+1],z.setRange(It,zn,be,ti),!0}return!1}}(k,F,h,d);return _.forEach(D=>D.opacity=+C(D)),_}const s1=["x","y","opacity","align","baseline"],ID=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function u1(t){O.call(this,null,t)}u1.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:ID},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:s1.length,default:s1}]},V(u1,O,{transform(t,n){const e=t.modified();if(!(e||n.changed(n.ADD_REM)||function(i){const a=t[i];return bt(a)&&n.modified(a.fields)}("sort")))return;t.size&&t.size.length===2||j("Size parameter should be specified as a [width, height] array.");const r=t.as||s1;return aB(n.materialize(n.SOURCE).source||[],t.size,t.sort,K(t.offset==null?1:t.offset),K(t.anchor||ID),t.avoidMarks||[],t.avoidBaseMark!==!1,t.lineAnchor||"end",t.markIndex||0,t.padding===void 0?0:t.padding,t.method||"naive").forEach(i=>{const a=i.datum;a[r[0]]=i.x,a[r[1]]=i.y,a[r[2]]=i.opacity,a[r[3]]=i.align,a[r[4]]=i.baseline}),n.reflow(e).modifies(r)}});const oB=Object.freeze(Object.defineProperty({__proto__:null,label:u1},Symbol.toStringTag,{value:"Module"}));function WD(t,n){var e,r,i,a,o,s,u=[],l=function(c){return c(a)};if(n==null)u.push(t);else for(e={},r=0,i=t.length;r{b2(u,t.x,t.y,t.bandwidth||.3).forEach(l=>{const c={};for(let f=0;fd==="poly"?h:d==="quad"?2:1)(a,o),u=t.as||[en(t.x),en(t.y)],l=c1[a],c=[];let f=t.extent;tt(c1,a)||j("Invalid regression method: "+a),f!=null&&a==="log"&&f[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),r.forEach(d=>{if(d.length<=s)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const h=l(d,t.x,t.y,o);if(t.params)return void c.push(St({keys:d.dims,coef:h.coef,rSquared:h.rSquared}));const p=f||kr(d,t.x),m=g=>{const y={};for(let v=0;vm([g,h.predict(g)])):fc(h.predict,p,25,200).forEach(m)}),this.value&&(e.rem=this.value),this.value=e.add=e.source=c}return e}});const sB=Object.freeze(Object.defineProperty({__proto__:null,loess:l1,regression:f1},Symbol.toStringTag,{value:"Module"})),Rn=134217729;function d1(t,n,e,r,i){let a,o,s,u,l=n[0],c=r[0],f=0,d=0;c>l==c>-l?(a=l,l=n[++f]):(a=c,c=r[++d]);let h=0;if(fl==c>-l?(o=l+a,s=a-(o-l),l=n[++f]):(o=c+a,s=a-(o-c),c=r[++d]),a=o,s!==0&&(i[h++]=s);fl==c>-l?(o=a+l,u=o-a,s=a-(o-u)+(l-u),l=n[++f]):(o=a+c,u=o-a,s=a-(o-u)+(c-u),c=r[++d]),a=o,s!==0&&(i[h++]=s);for(;f=33306690738754716e-32*l?u:-function(c,f,d,h,p,m,g){let y,v,x,b,w,A,_,k,F,C,D,E,$,M,S,B,z,N;const W=c-p,X=d-p,L=f-m,et=h-m;M=W*et,A=Rn*W,_=A-(A-W),k=W-_,A=Rn*et,F=A-(A-et),C=et-F,S=k*C-(M-_*F-k*F-_*C),B=L*X,A=Rn*L,_=A-(A-L),k=L-_,A=Rn*X,F=A-(A-X),C=X-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ts[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ts[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ts[2]=E-(N-w)+(D-w),ts[3]=N;let ot=function(Mt,Tt){let kt=Tt[0];for(let Et=1;Et=nt||-ot>=nt||(w=c-W,y=c-(W+w)+(w-p),w=d-X,x=d-(X+w)+(w-p),w=f-L,v=f-(L+w)+(w-m),w=h-et,b=h-(et+w)+(w-m),y===0&&v===0&&x===0&&b===0)||(nt=11093356479670487e-47*g+33306690738754706e-32*Math.abs(ot),ot+=W*b+et*y-(L*x+X*v),ot>=nt||-ot>=nt))return ot;M=y*et,A=Rn*y,_=A-(A-y),k=y-_,A=Rn*et,F=A-(A-et),C=et-F,S=k*C-(M-_*F-k*F-_*C),B=v*X,A=Rn*v,_=A-(A-v),k=v-_,A=Rn*X,F=A-(A-X),C=X-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ie[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ie[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ie[2]=E-(N-w)+(D-w),ie[3]=N;const mt=d1(4,ts,4,ie,HD);M=W*b,A=Rn*W,_=A-(A-W),k=W-_,A=Rn*b,F=A-(A-b),C=b-F,S=k*C-(M-_*F-k*F-_*C),B=L*x,A=Rn*L,_=A-(A-L),k=L-_,A=Rn*x,F=A-(A-x),C=x-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ie[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ie[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ie[2]=E-(N-w)+(D-w),ie[3]=N;const pt=d1(mt,HD,4,ie,GD);M=y*b,A=Rn*y,_=A-(A-y),k=y-_,A=Rn*b,F=A-(A-b),C=b-F,S=k*C-(M-_*F-k*F-_*C),B=v*x,A=Rn*v,_=A-(A-v),k=v-_,A=Rn*x,F=A-(A-x),C=x-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ie[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ie[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ie[2]=E-(N-w)+(D-w),ie[3]=N;const J=d1(pt,GD,4,ie,VD);return VD[J-1]}(t,n,e,r,i,a,l)}const YD=Math.pow(2,-52),Zf=new Uint32Array(512);class jh{static from(n,e=cB,r=fB){const i=n.length,a=new Float64Array(2*i);for(let o=0;o>1;if(e>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:n,_hullPrev:e,_hullNext:r,_hullTri:i,_hullHash:a}=this,o=n.length>>1;let s=1/0,u=1/0,l=-1/0,c=-1/0;for(let C=0;Cl&&(l=D),E>c&&(c=E),this._ids[C]=C}const f=(s+l)/2,d=(u+c)/2;let h,p,m,g=1/0;for(let C=0;C0&&(p=C,g=D)}let x=n[2*p],b=n[2*p+1],w=1/0;for(let C=0;C$&&(C[D++]=M,$=this._dists[M])}return this.hull=C.subarray(0,D),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Qf(y,v,x,b,A,_)<0){const C=p,D=x,E=b;p=m,x=A,b=_,m=C,A=D,_=E}const k=function(C,D,E,$,M,S){const B=E-C,z=$-D,N=M-C,W=S-D,X=B*B+z*z,L=N*N+W*W,et=.5/(B*W-z*N),ot=C+(W*X-z*L)*et,nt=D+(B*L-N*X)*et;return{x:ot,y:nt}}(y,v,x,b,A,_);this._cx=k.x,this._cy=k.y;for(let C=0;C0&&Math.abs(M-C)<=YD&&Math.abs(S-D)<=YD||(C=M,D=S,$===h||$===p||$===m))continue;let B=0;for(let L=0,et=this._hashKey(M,S);L=0;)if(N=z,N===B){N=-1;break}if(N===-1)continue;let W=this._addTriangle(N,$,r[N],-1,-1,i[N]);i[$]=this._legalize(W+2),i[N]=W,F++;let X=r[N];for(;z=r[X],Qf(M,S,n[2*X],n[2*X+1],n[2*z],n[2*z+1])<0;)W=this._addTriangle(X,$,z,i[$],-1,i[X]),i[$]=this._legalize(W+2),r[X]=X,F--,X=z;if(N===B)for(;z=e[N],Qf(M,S,n[2*z],n[2*z+1],n[2*N],n[2*N+1])<0;)W=this._addTriangle(z,$,N,-1,i[N],i[z]),this._legalize(W+2),i[z]=W,r[N]=N,F--,N=z;this._hullStart=e[$]=N,r[N]=e[X]=$,r[$]=X,a[this._hashKey(M,S)]=$,a[this._hashKey(n[2*N],n[2*N+1])]=N}this.hull=new Uint32Array(F);for(let C=0,D=this._hullStart;C0?3-a:1+a)/4}(n-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(n){const{_triangles:e,_halfedges:r,coords:i}=this;let a=0,o=0;for(;;){const s=r[n],u=n-n%3;if(o=u+(n+2)%3,s===-1){if(a===0)break;n=Zf[--a];continue}const l=s-s%3,c=u+(n+1)%3,f=l+(s+2)%3,d=e[o],h=e[n],p=e[c],m=e[f];if(uB(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){e[n]=m,e[s]=d;const g=r[f];if(g===-1){let v=this._hullStart;do{if(this._hullTri[v]===f){this._hullTri[v]=n;break}v=this._hullPrev[v]}while(v!==this._hullStart)}this._link(n,g),this._link(s,r[o]),this._link(o,f);const y=l+(s+1)%3;a=e&&n[t[s]]>o;)t[s+1]=t[s--];t[s+1]=a}else{let i=e+1,a=r;Iu(t,e+r>>1,i),n[t[e]]>n[t[r]]&&Iu(t,e,r),n[t[i]]>n[t[r]]&&Iu(t,i,r),n[t[e]]>n[t[i]]&&Iu(t,e,i);const o=t[i],s=n[o];for(;;){do i++;while(n[t[i]]s);if(a=a-e?(ns(t,n,i,r),ns(t,n,e,a-1)):(ns(t,n,e,a-1),ns(t,n,i,r))}}function Iu(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function cB(t){return t[0]}function fB(t){return t[1]}const XD=1e-6;class Ga{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(n,e){this._+=`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(n,e){this._+=`L${this._x1=+n},${this._y1=+e}`}arc(n,e,r){const i=(n=+n)+(r=+r),a=e=+e;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${a}`:(Math.abs(this._x1-i)>XD||Math.abs(this._y1-a)>XD)&&(this._+="L"+i+","+a),r&&(this._+=`A${r},${r},0,1,1,${n-r},${e}A${r},${r},0,1,1,${this._x1=i},${this._y1=a}`)}rect(n,e,r,i){this._+=`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class p1{constructor(){this._=[]}moveTo(n,e){this._.push([n,e])}closePath(){this._.push(this._[0].slice())}lineTo(n,e){this._.push([n,e])}value(){return this._.length?this._:null}}let dB=class{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,a;const o=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let p,m,g=0,y=0,v=e.length;g1;)i-=2;for(let a=2;a0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)this.xmax?2:0)|(nthis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n2&&function(u){const{triangles:l,coords:c}=u;for(let f=0;f1e-10)return!1}return!0}(n)){this.collinear=Int32Array.from({length:e.length/2},(d,h)=>h).sort((d,h)=>e[2*d]-e[2*h]||e[2*d+1]-e[2*h+1]);const u=this.collinear[0],l=this.collinear[this.collinear.length-1],c=[e[2*u],e[2*u+1],e[2*l],e[2*l+1]],f=1e-8*Math.hypot(c[3]-c[1],c[2]-c[0]);for(let d=0,h=e.length/2;d0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,i.length===2&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(n){return new dB(this,n)}*neighbors(n){const{inedges:e,hull:r,_hullIndex:i,halfedges:a,triangles:o,collinear:s}=this;if(s){const f=s.indexOf(n);return f>0&&(yield s[f-1]),void(f=0&&a!==r&&a!==i;)r=a;return a}_step(n,e,r){const{inedges:i,hull:a,_hullIndex:o,halfedges:s,triangles:u,points:l}=this;if(i[n]===-1||!l.length)return(n+1)%(l.length>>1);let c=n,f=es(e-l[2*n],2)+es(r-l[2*n+1],2);const d=i[n];let h=d;do{let p=u[h];const m=es(e-l[2*p],2)+es(r-l[2*p+1],2);if(m=w));)if(p.x=x+y,p.y=b+v,!(p.x+p.x0<0||p.y+p.y0<0||p.x+p.x1>s[0]||p.y+p.y1>s[1])&&(!m||!_B(p,h,s[0]))&&(!m||DB(p,m))){for(var F,C=p.sprite,D=p.width>>5,E=s[0]>>5,$=p.x-(D<<4),M=127&$,S=32-M,B=p.y1-p.y0,z=(p.y+p.y0)*E+($>>5),N=0;N>>M:0);z+=E}return p.sprite=null,!0}return!1}return f.layout=function(){for(var h=function(w){w.width=w.height=1;var A=Math.sqrt(w.getContext("2d").getImageData(0,0,1,1).data.length>>2);w.width=2048/A,w.height=td/A;var _=w.getContext("2d");return _.fillStyle=_.strokeStyle="red",_.textAlign="center",{context:_,ratio:A}}(qi()),p=function(w){for(var A=[],_=-1;++_>5)*s[1]),m=null,g=l.length,y=-1,v=[],x=l.map(w=>({text:t(w),font:n(w),style:r(w),weight:i(w),rotate:a(w),size:~~(e(w)+1e-14),padding:o(w),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:w})).sort((w,A)=>A.size-w.size);++y>1,b.y=s[1]*(c()+.5)>>1,AB(h,b,x,y),b.hasText&&d(p,b,m)&&(v.push(b),m?kB(m,b):m=[{x:b.x+b.x0,y:b.y+b.y0},{x:b.x+b.x1,y:b.y+b.y1}],b.x-=s[0]>>1,b.y-=s[1]>>1)}return v},f.words=function(h){return arguments.length?(l=h,f):l},f.size=function(h){return arguments.length?(s=[+h[0],+h[1]],f):s},f.font=function(h){return arguments.length?(n=Va(h),f):n},f.fontStyle=function(h){return arguments.length?(r=Va(h),f):r},f.fontWeight=function(h){return arguments.length?(i=Va(h),f):i},f.rotate=function(h){return arguments.length?(a=Va(h),f):a},f.text=function(h){return arguments.length?(t=Va(h),f):t},f.spiral=function(h){return arguments.length?(u=FB[h]||h,f):u},f.fontSize=function(h){return arguments.length?(e=Va(h),f):e},f.padding=function(h){return arguments.length?(o=Va(h),f):o},f.random=function(h){return arguments.length?(c=h,f):c},f}function AB(t,n,e,r){if(!n.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,td/a);var o,s,u,l,c,f=0,d=0,h=0,p=e.length;for(--r;++r>5<<5,u=~~Math.max(Math.abs(v+x),Math.abs(v-x))}else o=o+31>>5<<5;if(u>h&&(h=u),f+o>=2048&&(f=0,d+=h,h=0),d+u>=td)break;i.translate((f+(o>>1))/a,(d+(u>>1))/a),n.rotate&&i.rotate(n.rotate*g1),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=o,n.height=u,n.xoff=f,n.yoff=d,n.x1=o>>1,n.y1=u>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=o}for(var w=i.getImageData(0,0,2048/a,td/a).data,A=[];--r>=0;)if((n=e[r]).hasText){for(s=(o=n.width)>>5,u=n.y1-n.y0,l=0;l>5),C=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;A[F]|=C,_|=C}_?k=c:(n.y0++,u--,c--,d++)}n.y1=n.y0+k,n.sprite=A.slice(0,(n.y1-n.y0)*s)}}}function _B(t,n,e){e>>=5;for(var r,i=t.sprite,a=t.width>>5,o=t.x-(a<<4),s=127&o,u=32-s,l=t.y1-t.y0,c=(t.y+t.y0)*e+(o>>5),f=0;f>>s:0))&n[c+d])return!0;c+=e}return!1}function kB(t,n){var e=t[0],r=t[1];n.x+n.x0r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function DB(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0n[0].y&&t.y+t.y0p(h(m))}r.forEach(h=>{h[a[0]]=NaN,h[a[1]]=NaN,h[a[3]]=0});const u=i.words(r).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(s).random(Ne).layout(),l=i.size(),c=l[0]>>1,f=l[1]>>1,d=u.length;for(let h,p,m=0;mnew Uint8Array(t),SB=t=>new Uint16Array(t),Wu=t=>new Uint32Array(t);function nd(t,n,e){const r=(n<257?$B:n<65537?SB:Wu)(t);return e&&r.set(e),r}function QD(t,n,e){const r=1<{const y=h[m],v=h[g];return yv?1:0}),function(m,g){return Array.from(g,y=>m[y])}(h,p)}(d,u),o)l=n,c=t,n=Array(o+s),t=Wu(o+s),function(h,p,m,g,y,v,x,b,w){let A,_=0,k=0;for(A=0;_0)for(f=0;ft,size:()=>e}}function v1(t){O.call(this,function(){let n=8,e=[],r=Wu(0),i=nd(0,n),a=nd(0,n);return{data:()=>e,seen:()=>r=function(o,s,u){return o.length>=s?o:((u=u||new o.constructor(s)).set(o),u)}(r,e.length),add(o){for(let s,u=0,l=e.length,c=o.length;ue.length,curr:()=>i,prev:()=>a,reset:o=>a[o]=i[o],all:()=>n<257?255:n<65537?65535:4294967295,set(o,s){i[o]|=s},clear(o,s){i[o]&=~s},resize(o,s){(o>i.length||s>n)&&(n=Math.max(s,n),i=nd(o,n,i),a=nd(o,n))}}}(),t),this._indices=null,this._dims=null}function b1(t){O.call(this,null,t)}v1.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},V(v1,O,{transform(t,n){return this._dims?t.modified("fields")||t.fields.some(e=>n.modified(e.fields))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},init(t,n){const e=t.fields,r=t.query,i=this._indices={},a=this._dims=[],o=r.length;let s,u,l=0;for(;l{const a=i.remove(n,e);for(const o in r)r[o].reindex(a)})},update(t,n,e){const r=this._dims,i=t.query,a=n.stamp,o=r.length;let s,u,l=0;for(e.filters=0,u=0;uh)for(g=h,y=Math.min(f,p);gp)for(g=Math.max(f,p),y=d;gc)for(h=c,p=Math.min(u,f);hf)for(h=Math.max(u,f),p=l;hs[c]&e?null:o[c];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,c=>{const f=s[c]&e;return!f&&f^u[c]&e?o[c]:null}),a.filter(a.REM,c=>{const f=s[c]&e;return f&&!(f^f^u[c]&e)?o[c]:null})):(a.filter(a.ADD,l),a.filter(a.REM,c=>(s[c]&e)===i?o[c]:null)),a.filter(a.SOURCE,c=>l(c._index))}});const MB=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:v1,resolvefilter:b1},Symbol.toStringTag,{value:"Module"})),rs="Literal",BB="Property",zB="ArrayExpression",OB="BinaryExpression",tF="CallExpression",NB="ConditionalExpression",RB="LogicalExpression",TB="MemberExpression",PB="ObjectExpression",jB="UnaryExpression";function ir(t){this.type=t}var hi,rt,R,Tn,zt;ir.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(i){switch(i.type){case zB:return i.elements;case OB:case RB:return[i.left,i.right];case tF:return[i.callee].concat(i.arguments);case NB:return[i.test,i.consequent,i.alternate];case TB:return[i.object,i.property];case PB:return i.properties;case BB:return[i.key,i.value];case jB:return[i.argument];default:return[]}}(this),e=0,r=n.length;e",hi[3]="Identifier",hi[4]="Keyword",hi[5]="Null",hi[6]="Numeric",hi[7]="Punctuator",hi[8]="String",hi[9]="RegularExpression";var nF="Identifier",gn="Unexpected token %0",x1="Invalid regular expression",w1="Invalid regular expression: missing /",eF="Octal literals are not allowed in strict mode.",Fn="ILLEGAL",Hu="Disabled.",LB=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),qB=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function ed(t,n){if(!t)throw new Error("ASSERT: "+n)}function pi(t){return t>=48&&t<=57}function A1(t){return"0123456789abcdefABCDEF".includes(t)}function Gu(t){return"01234567".includes(t)}function UB(t){return t===32||t===9||t===11||t===12||t===160||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function Vu(t){return t===10||t===13||t===8232||t===8233}function Yu(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t===92||t>=128&&LB.test(String.fromCharCode(t))}function rd(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===92||t>=128&&qB.test(String.fromCharCode(t))}const IB={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function rF(){for(;R1114111||t!=="}")&&Ft({},gn,Fn),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function iF(){var t,n;for(t=rt.charCodeAt(R++),n=String.fromCharCode(t),t===92&&(rt.charCodeAt(R)!==117&&Ft({},gn,Fn),++R,(t=_1("u"))&&t!=="\\"&&Yu(t.charCodeAt(0))||Ft({},gn,Fn),n=t);R>>="?{type:7,value:r,start:i,end:R+=4}:(e=r.substr(0,3))===">>>"||e==="<<="||e===">>="?{type:7,value:e,start:i,end:R+=3}:o===(n=e.substr(0,2))[1]&&"+-<>&|".includes(o)||n==="=>"?{type:7,value:n,start:i,end:R+=2}:(n==="//"&&Ft({},gn,Fn),"<>=!+-*%&|^/".includes(o)?{type:7,value:o,start:i,end:++R}:void Ft({},gn,Fn))}function aF(){var t,n,e;if(ed(pi((e=rt[R]).charCodeAt(0))||e===".","Numeric literal must start with a decimal digit or a decimal point"),n=R,t="",e!=="."){if(t=rt[R++],e=rt[R],t==="0"){if(e==="x"||e==="X")return++R,function(r){let i="";for(;R=0&&Ft({},x1,o),{value:o,literal:a}}(),r=function(i,a){let o=i;a.includes("u")&&(o=o.replace(/\\u\{([0-9a-fA-F]+)\}/g,(s,u)=>{if(parseInt(u,16)<=1114111)return"x";Ft({},x1)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(o)}catch{Ft({},x1)}try{return new RegExp(i,a)}catch{return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:R}}function oF(){if(rF(),R>=Tn)return{type:2,start:R,end:R};const t=rt.charCodeAt(R);return Yu(t)?HB():t===40||t===41||t===59?k1():t===39||t===34?function(){var n,e,r,i,a="",o=!1;for(ed((n=rt[R])==="'"||n==='"',"String literal must starts with a quote"),e=R,++R;R(ed(o":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function Ya(){var t,n;return t=function(){var e,r,i,a,o,s,u,l,c,f;if(e=zt,c=ad(),(o=hF(a=zt))===0)return c;for(a.prec=o,fe(),r=[e,zt],s=[c,a,u=ad()];(o=hF(zt))>0;){for(;s.length>2&&o<=s[s.length-2].prec;)u=s.pop(),l=s.pop().value,c=s.pop(),r.pop(),i=uF(l,c,u),s.push(i);(a=fe()).prec=o,s.push(a),r.push(zt),i=ad(),s.push(i)}for(i=s[f=s.length-1],r.pop();f>1;)r.pop(),i=uF(s[f-1].value,s[f-2],i),f-=2;return i}(),Ht("?")&&(fe(),n=Ya(),Pn(":"),t=function(e,r,i){const a=new ir("ConditionalExpression");return a.test=e,a.consequent=r,a.alternate=i,a}(t,n,Ya())),t}function C1(){const t=Ya();if(Ht(","))throw new Error(Hu);return t}function pF(t){R=0,Tn=(rt=t).length,zt=null,sF();const n=C1();if(zt.type!==2)throw new Error("Unexpect token after expression.");return n}var mF={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function gF(t){function n(a,o,s){return u=>function(l,c,f,d){let h=t(c[0]);return f&&(h=f+"("+h+")",f.lastIndexOf("new ",0)===0&&(h="("+h+")")),h+"."+l+(d<0?"":d===0?"()":"("+c.slice(1).map(t).join(",")+")")}(a,u,o,s)}const e="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(a){a.length<3&&j("Missing arguments to clamp function."),a.length>3&&j("Too many arguments to clamp function.");const o=a.map(t);return"Math.max("+o[1]+", Math.min("+o[2]+","+o[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:i,test:n("test",i),if:function(a){a.length<3&&j("Missing arguments to if function."),a.length>3&&j("Too many arguments to if function.");const o=a.map(t);return"("+o[0]+"?"+o[1]+":"+o[2]+")"}}}function yF(t){const n=(t=t||{}).allowed?Dr(t.allowed):{},e=t.forbidden?Dr(t.forbidden):{},r=t.constants||mF,i=(t.functions||gF)(f),a=t.globalvar,o=t.fieldvar,s=bt(a)?a:p=>`${a}["${p}"]`;let u={},l={},c=0;function f(p){if(Q(p))return p;const m=d[p.type];return m==null&&j("Unsupported type: "+p.type),m(p)}const d={Literal:p=>p.raw,Identifier:p=>{const m=p.name;return c>0?m:tt(e,m)?j("Illegal identifier: "+m):tt(r,m)?r[m]:tt(n,m)?m:(u[m]=1,s(m))},MemberExpression:p=>{const m=!p.computed,g=f(p.object);m&&(c+=1);const y=f(p.property);return g===o&&(l[function(v){const x=v&&v.length-1;return x&&(v[0]==='"'&&v[x]==='"'||v[0]==="'"&&v[x]==="'")?v.slice(1,-1):v}(y)]=1),m&&(c-=1),g+(m?"."+y:"["+y+"]")},CallExpression:p=>{p.callee.type!=="Identifier"&&j("Illegal callee type: "+p.callee.type);const m=p.callee.name,g=p.arguments,y=tt(i,m)&&i[m];return y||j("Unrecognized function: "+m),bt(y)?y(g):y+"("+g.map(f).join(",")+")"},ArrayExpression:p=>"["+p.elements.map(f).join(",")+"]",BinaryExpression:p=>"("+f(p.left)+" "+p.operator+" "+f(p.right)+")",UnaryExpression:p=>"("+p.operator+f(p.argument)+")",ConditionalExpression:p=>"("+f(p.test)+"?"+f(p.consequent)+":"+f(p.alternate)+")",LogicalExpression:p=>"("+f(p.left)+p.operator+f(p.right)+")",ObjectExpression:p=>"{"+p.properties.map(f).join(",")+"}",Property:p=>{c+=1;const m=f(p.key);return c-=1,m+":"+f(p.value)}};function h(p){const m={code:f(p),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},m}return h.functions=i,h.constants=r,h}const vF=Symbol("vega_selection_getter");function bF(t){return t.getter&&t.getter[vF]||(t.getter=ei(t.field),t.getter[vF]=!0),t.getter}const E1="intersect",xF="union",wF="or",ez="and",Nr="_vgsid_",Ju=ei(Nr),od="index:unit";function AF(t,n){for(var e,r,i=n.fields,a=n.values,o=i.length,s=0;s=a[s])return!1}else if(r.type==="E-LTE"){if(e>a[s])return!1}else if(r.type==="E-GT"){if(e<=a[s])return!1}else if(r.type==="E-GTE"){if(en.includes(e)):n},R_union:function(t,n){var e=ze(n[0]),r=ze(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]r&&(e=n[1],r=n[0]),t.length?rr&&(t[1]=r),t):[e,r]}};function S1(t,n,e,r){n[0].type!==rs&&j("First argument to selection functions must be a string literal.");const i=n[0].value,a="unit",o="@"+a,s=":"+i;(n.length>=2&&Bt(n).value)!==E1||tt(r,o)||(r[o]=e.getData(i).indataRef(e,a)),tt(r,s)||(r[s]=e.getData(i).tuplesRef())}function kF(t){const n=this.context.data[t];return n?n.values.value:[]}const Ku=t=>function(n,e){const r=this.context.dataflow.locale();return n===null?"null":r[t](e)(n)},az=Ku("format"),DF=Ku("timeFormat"),oz=Ku("utcFormat"),sz=Ku("timeParse"),uz=Ku("utcParse"),sd=new Date(2e3,0,1);function ud(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(sd.setYear(2e3),sd.setMonth(t),sd.setDate(n),DF.call(this,sd,e)):""}function M1(t,n,e,r){n[0].type!==rs&&j("First argument to data functions must be a string literal.");const i=n[0].value,a=":"+i;if(!tt(a,r))try{r[a]=e.getData(i).tuplesRef()}catch{}}function ae(t,n,e,r){if(n[0].type===rs)FF(e,r,n[0].value);else for(t in e.scales)FF(e,r,t)}function FF(t,n,e){const r="%"+e;if(!tt(n,r))try{n[r]=t.scaleRef(e)}catch{}}function Rr(t,n){if(Q(t)){const e=n.scales[t];return e&&fw(e.value)?e.value:void 0}if(bt(t))return fw(t)?t:void 0}function lz(t,n,e){n.__bandwidth=i=>i&&i.bandwidth?i.bandwidth():0,e._bandwidth=ae,e._range=ae,e._scale=ae;const r=i=>"_["+(i.type===rs?G("%"+i.value):G("%")+"+"+t(i))+"]";return{_bandwidth:i=>`this.__bandwidth(${r(i[0])})`,_range:i=>`${r(i[0])}.range()`,_scale:i=>`${r(i[0])}(${t(i[1])})`}}function B1(t,n){return function(e,r,i){if(e){const a=Rr(e,(i||this).context);return a&&a.path[t](r)}return n(r)}}const cz=B1("area",function(t){return pf=new Gn,si(t,Mr),2*pf}),fz=B1("bounds",function(t){var n,e,r,i,a,o,s;if(_e=an=-(Kt=ce=1/0),na=[],si(t,li),e=na.length){for(na.sort(R4),n=1,a=[r=na[0]];nke(r[0],r[1])&&(r[1]=i[1]),ke(i[0],r[1])>ke(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,n=0,r=a[e=a.length-1];n<=e;r=i,++n)i=a[n],(s=ke(r[1],i[0]))>o&&(o=s,Kt=i[0],an=r[1])}return na=ui=null,Kt===1/0||ce===1/0?[[NaN,NaN],[NaN,NaN]]:[[Kt,ce],[an,_e]]}),dz=B1("centroid",function(t){Du=bf=xf=wf=Af=_f=kf=Df=0,J0=new Gn,K0=new Gn,Q0=new Gn,si(t,er);var n=+J0,e=+K0,r=+Q0,i=U0(n,e,r);return iEF(t,n)}const SF={};function ld(t){return P(t)||ArrayBuffer.isView(t)?t:null}function R1(t){return ld(t)||(Q(t)?t:null)}const MF=t=>t.data;function BF(t,n){const e=kF.call(n,t);return e.root&&e.root.lookup||{}}const zF=()=>typeof window<"u"&&window||null;function OF(t,n,e){if(!t)return[];const[r,i]=t,a=new cn().set(r[0],r[1],i[0],i[1]);return QA(e||this.context.dataflow.scenegraph().root,a,function(o){let s=null;if(o){const u=K(o.marktype),l=K(o.markname);s=c=>(!u.length||u.some(f=>c.marktype===f))&&(!l.length||l.some(f=>c.name===f))}return s}(n))}const Qu={random:()=>Ne(),cumulativeNormal:uc,cumulativeLogNormal:Sp,cumulativeUniform:Op,densityNormal:Dp,densityLogNormal:$p,densityUniform:zp,quantileNormal:lc,quantileLogNormal:Mp,quantileUniform:Np,sampleNormal:sc,sampleLogNormal:Ep,sampleUniform:Bp,isArray:P,isBoolean:Fa,isDate:Da,isDefined:t=>t!==void 0,isNumber:$t,isObject:Z,isRegExp:up,isString:Q,isTuple:tc,isValid:t=>t!=null&&t==t,toBoolean:zx,toDate:t=>Ox(t),toNumber:ze,toString:Bx,indexof:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;rkr(t),inScope:function(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:OF,clampRange:gx,pinchDistance:function(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.hypot(e,r)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){const t=zF();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){const t=zF();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return km(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow,r=this.context.data[t].input;return e.pulse(r,e.changeset().remove(Be).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?su(e,n=n||Ro(t)):t}},panLinear:mx,panLog:px,panPow:hx,panSymlog:dx,zoomLinear:sp,zoomLog:ap,zoomPow:Vl,zoomSymlog:op,encode:function(t,n,e){if(t){const r=this.context.dataflow,i=t.mark.source;r.pulse(i,r.changeset().encode(t,n))}return e!==void 0?e:t},modify:function(t,n,e,r,i,a){const o=this.context.dataflow,s=this.context.data[t],u=s.input,l=o.stamp();let c,f,d=s.changes;if(o._trigger===!1||!(u.value.length||n||r))return 0;if((!d||d.stamp{s.modified=!0,o.pulse(u,d).run()},!0,1)),e&&(c=e===!0?Be:P(e)||tc(e)?e:$F(e),d.remove(c)),n&&d.insert(n),r&&(c=$F(r),u.value.some(c)?d.remove(c):d.insert(r)),i)for(f in a)d.modify(i,f,a[f]);return 1},lassoAppend:function(t,n,e){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;const i=(t=K(t))[t.length-1];return i===void 0||Math.hypot(i[0]-n,i[1]-e)>r?[...t,[n,e]]:t},lassoPath:function(t){return K(t).reduce((n,e,r)=>{let[i,a]=e;return n+(r==0?`M ${i},${a} `:r===t.length-1?" Z":`L ${i},${a} `)},"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:a}=e,o=new cn().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[s,u]of n)so.x2&&(o.x2=s),uo.y2&&(o.y2=u);return o.translate(r,i),OF([[o.x1,o.y1],[o.x2,o.y2]],t,a).filter(s=>function(u,l,c){let f=0;for(let d=0,h=c.length-1;dl!=m>l&&u<(p-g)*(l-y)/(m-y)+g&&f++}return 1&f}(s.x,s.y,n))}},hz=["view","item","group","xy","x","y"],NF="this.",T1={},RF={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${G("$"+t)}]`,functions:function(t){const n=gF(t);hz.forEach(e=>n[e]="event.vega."+e);for(const e in Qu)n[e]=NF+e;return xt(n,lz(t,Qu,T1)),n},constants:mF,visitors:T1},P1=yF(RF);function sn(t,n,e){return arguments.length===1?Qu[t]:(Qu[t]=n,e&&(T1[t]=e),P1&&(P1.functions[t]=NF+t),this)}function Tr(t,n){const e={};let r;try{r=pF(t=Q(t)?t:G(t)+"")}catch{j("Expression parse error: "+t)}r.visit(a=>{if(a.type!==tF)return;const o=a.callee.name,s=RF.visitors[o];s&&s(o,a.arguments,n,e)});const i=P1(r);return i.globals.forEach(a=>{const o="$"+a;!tt(e,o)&&n.getSignal(a)&&(e[o]=n.signalRef(a))}),{$expr:xt({code:i.code},n.options.ast?{ast:r}:null),$fields:i.fields,$params:e}}sn("bandwidth",function(t,n){const e=Rr(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0},ae),sn("copy",function(t,n){const e=Rr(t,(n||this).context);return e?e.copy():void 0},ae),sn("domain",function(t,n){const e=Rr(t,(n||this).context);return e?e.domain():[]},ae),sn("range",function(t,n){const e=Rr(t,(n||this).context);return e&&e.range?e.range():[]},ae),sn("invert",function(t,n,e){const r=Rr(t,(e||this).context);return r?P(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0},ae),sn("scale",function(t,n,e){const r=Rr(t,(e||this).context);return r?r(n):void 0},ae),sn("gradient",function(t,n,e,r,i){t=Rr(t,(i||this).context);const a=zw(n,e);let o=t.domain(),s=o[0],u=Bt(o),l=Me;return u-s?l=vw(t,s,u):t=(t.interpolator?Dt("sequential")().interpolator(t.interpolator()):Dt("linear")().interpolate(t.interpolate()).range(t.range())).domain([s=0,u=1]),t.ticks&&(o=t.ticks(+r||15),s!==o[0]&&o.unshift(s),u!==Bt(o)&&o.push(u)),o.forEach(c=>a.stop(l(c),t(c))),a},ae),sn("geoArea",cz,ae),sn("geoBounds",fz,ae),sn("geoCentroid",dz,ae),sn("geoShape",function(t,n,e){const r=Rr(t,(e||this).context);return function(i){return r?r.path.context(i)(n):""}},ae),sn("geoScale",function(t,n){const e=Rr(t,(n||this).context);return e&&e.scale()},ae),sn("indata",function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i&&i.count},function(t,n,e,r){n[0].type!==rs&&j("First argument to indata must be a string literal."),n[1].type!==rs&&j("Second argument to indata must be a string literal.");const i=n[0].value,a=n[1].value,o="@"+a;tt(o,r)||(r[o]=e.getData(i).indataRef(e,a))}),sn("data",kF,M1),sn("treePath",function(t,n,e){const r=BF(t,this),i=r[n],a=r[e];return i&&a?i.path(a).map(MF):void 0},M1),sn("treeAncestors",function(t,n){const e=BF(t,this)[n];return e?e.ancestors().map(MF):void 0},M1),sn("vlSelectionTest",function(t,n,e){for(var r,i,a,o,s,u=this.context.data[t],l=u?u.values.value:[],c=u?u[od]&&u[od].value:void 0,f=e===E1,d=l.length,h=0;h(_[a[F].field]=k,_),{}))}else u=Nr,l=Ju(i),(f=(c=v[u]||(v[u]={}))[s]||(c[s]=[])).push(l),e&&(f=x[s]||(x[s]=[])).push({[Nr]:l});return n=n||xF,v[Nr]?v[Nr]=$1[`${Nr}_${n}`](...Object.values(v[Nr])):Object.keys(v).forEach(_=>{v[_]=Object.keys(v[_]).map(k=>v[_][k]).reduce((k,F)=>k===void 0?F:$1[`${b[_]}_${n}`](k,F))}),y=Object.keys(x),e&&y.length&&(v[r?"vlPoint":"vlMulti"]=n===xF?{[wF]:y.reduce((_,k)=>(_.push(...x[k]),_),[])}:{[ez]:y.map(_=>({[wF]:x[_]}))}),v},S1),sn("vlSelectionTuples",function(t,n){return t.map(e=>xt(n.fields?{values:n.fields.map(r=>bF(r)(e.datum))}:{[Nr]:Ju(e.datum)},n))});const pz=Dr(["rule"]),TF=Dr(["group","image","rect"]);function j1(t){return(t+"").toLowerCase()}function Zu(t,n,e){e.endsWith(";")||(e="return("+e+");");const r=Function(...n.concat(e));return t&&t.functions?r.bind(t.functions):r}var mz={operator:(t,n)=>Zu(t,["_"],n.code),parameter:(t,n)=>Zu(t,["datum","_"],n.code),event:(t,n)=>Zu(t,["event"],n.code),handler:(t,n)=>Zu(t,["_","event"],`var datum=event.item&&event.item.datum;return ${n.code};`),encode:(t,n)=>{const{marktype:e,channels:r}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const a in r){const o="o["+G(a)+"]";i+=`$=${r[a].code};if(${o}!==$)${o}=$,m=1;`}return i+=function(a,o){let s="";return pz[o]||(a.x2&&(a.x?(TF[o]&&(s+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),s+="o.width=o.x2-o.x;"):s+="o.x=o.x2-(o.width||0);"),a.xc&&(s+="o.x=o.xc-(o.width||0)/2;"),a.y2&&(a.y?(TF[o]&&(s+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),s+="o.height=o.y2-o.y;"):s+="o.y=o.y2-(o.height||0);"),a.yc&&(s+="o.y=o.yc-(o.height||0)/2;")),s}(r,e),i+="return m;",Zu(t,["item","_"],i)},codegen:{get(t){const n=`[${t.map(G).join("][")}]`,e=Function("_",`return _${n};`);return e.path=n,e},comparator(t,n){let e;const r=Function("a","b","var u, v; return "+t.map((i,a)=>{const o=n[a];let s,u;return i.path?(s=`a${i.path}`,u=`b${i.path}`):((e=e||{})["f"+a]=i,s=`this.f${a}(a)`,u=`this.f${a}(b)`),function(l,c,f,d){return`((u = ${l}) < (v = ${c}) || u == null) && v != null ? ${f} + : (u > v || v == null) && u != null ? ${d} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${f} + : v !== v && u === u ? ${d} : `}(s,u,-o,o)}).join("")+"0;");return e?r.bind(e):r}}};function PF(t,n,e){if(!t||!Z(t))return t;for(let r,i=0,a=jF.length;ii&&i.$tupleid?st:i);return n.fn[e]||(n.fn[e]=ep(r,t.$order,n.expr.codegen))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){const e=t.$subflow;return function(r,i,a){const o=n.fork().parse(e),s=o.get(e.operators[0].id),u=o.signals.parent;return u&&u.set(a),s.detachSubflow=()=>n.detach(o),s}}},{key:"$tupleid",parse:function(){return st}}];const gz={skip:!0};function LF(t,n,e,r){return new qF(t,n,e,r)}function qF(t,n,e,r){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.expr=r||mz,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function UF(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function IF(t,n){t&&(n==null?t.removeAttribute("aria-label"):t.setAttribute("aria-label",n))}qF.prototype=UF.prototype={fork(){const t=new UF(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter(e=>e!==t);const n=Object.keys(t.nodes);for(const e of n)t.nodes[e]._targets=null;for(const e of n)t.nodes[e].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,n){return this.nodes[t]=n},add(t,n){const e=this,r=e.dataflow,i=t.value;if(e.set(t.id,n),function(a){return j1(a)==="collect"}(t.type)&&i&&(i.$ingest?r.ingest(n,i.$ingest,i.$format):i.$request?r.preload(n,i.$request,i.$format):r.pulse(n,r.changeset().insert(i))),t.root&&(e.root=n),t.parent){let a=e.get(t.parent.$ref);a?(r.connect(a,[n]),n.targets().add(a)):(e.unresolved=e.unresolved||[]).push(()=>{a=e.get(t.parent.$ref),r.connect(a,[n]),n.targets().add(a)})}if(t.signal&&(e.signals[t.signal]=n),t.scale&&(e.scales[t.scale]=n),t.data)for(const a in t.data){const o=e.data[a]||(e.data[a]={});t.data[a].forEach(s=>o[s]=n)}},resolve(){return(this.unresolved||[]).forEach(t=>t()),delete this.unresolved,this},operator(t,n){this.add(t,this.dataflow.add(t.value,n))},transform(t,n){this.add(t,this.dataflow.add(this.transforms[j1(n)]))},stream(t,n){this.set(t.id,n)},update(t,n,e,r,i){this.dataflow.on(n,e,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const n=this,e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),t.locale&&(n.locale=t.locale),e.forEach(r=>n.parseOperator(r)),e.forEach(r=>n.parseOperatorParameters(r)),(t.streams||[]).forEach(r=>n.parseStream(r)),(t.updates||[]).forEach(r=>n.parseUpdate(r)),n.resolve()},parseOperator:function(t){const n=this;!function(e){return j1(e)==="operator"}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?n.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const n=this;if(t.params){const e=n.get(t.id);e||j("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(n.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,n){n=n||{};const e=this;for(const r in t){const i=t[r];n[r]=P(i)?i.map(a=>PF(a,e,n)):PF(i,e,n)}return n},parseStream:function(t){var n,e=this,r=t.filter!=null?e.eventExpression(t.filter):void 0,i=t.stream!=null?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map(a=>e.get(a)))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map(a=>e.get(a)),i=i.between(n[0],n[1])),t.filter&&(i=i.filter(r)),t.throttle!=null&&(i=i.throttle(+t.throttle)),t.debounce!=null&&(i=i.debounce(+t.debounce)),i==null&&j("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)},parseUpdate:function(t){var n,e=this,r=Z(r=t.source)?r.$ref:r,i=e.get(r),a=t.update,o=void 0;i||j("Source not defined: "+t.source),n=t.target&&t.target.$expr?e.eventExpression(t.target.$expr):e.get(t.target),a&&a.$expr&&(a.$params&&(o=e.parseParameters(a.$params)),a=e.handlerExpression(a.$expr)),e.update(t,i,n,a,o)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach(a=>{const o=n.signals[a];t.signals(a,o)&&(r[a]=o.value)})}if(t.data){var i=e.data={};Object.keys(n.data).forEach(a=>{const o=n.data[a];t.data(a,o)&&(i[a]=o.input.value)})}return n.subcontext&&t.recurse!==!1&&(e.subcontext=n.subcontext.map(a=>a.getState(t))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach(a=>{e.update(n.signals[a],i[a],gz)}),Object.keys(r||{}).forEach(a=>{e.pulse(n.data[a].input,e.changeset().remove(Be).insert(r[a]))}),(t.subcontext||[]).forEach((a,o)=>{const s=n.subcontext[o];s&&s.setState(a)})}};const L1="default";function q1(t,n){const e=t.globalCursor()?typeof document<"u"&&document.body:t.container();if(e)return n==null?e.style.removeProperty("cursor"):e.style.cursor=n}function cd(t,n){var e=t._runtime.data;return tt(e,n)||j("Unrecognized data set: "+n),e[n]}function fd(t,n){t2(n)||j("Second argument to changes must be a changeset.");const e=cd(this,t);return e.modified=!0,this.pulse(e.input,n)}function WF(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function HF(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function dd(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}function yz(t,n,e){var r,i,a=t._renderer,o=a&&a.canvas();return o&&(i=dd(t),(r=Uc(n.changedTouches?n.changedTouches[0]:n,o))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(s,u,l){const c=u?u.mark.marktype==="group"?u:u.mark.group:null;function f(h){var p,m=c;if(h){for(p=u;p;p=p.mark.group)if(p.mark.name===h){m=p;break}}return m&&m.mark&&m.mark.interactive?m:{}}function d(h){if(!h)return l;Q(h)&&(h=f(h));const p=l.slice();for(;h;)p[0]-=h.x||0,p[1]-=h.y||0,h=h.mark&&h.mark.group;return p}return{view:In(s),item:In(u||{}),group:f,xy:d,x:h=>d(h)[0],y:h=>d(h)[1]}}(t,e,r),n}const GF="view",vz={trap:!1};function VF(t,n,e,r){t._eventListeners.push({type:e,sources:K(n),handler:r})}function hd(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(r===!1||Z(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function YF(t){return t.item}function XF(t){return t.item.mark.source}function JF(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function De(t,n,e){const r=document.createElement(t);for(const i in n)r.setAttribute(i,n[i]);return e!=null&&(r.textContent=e),r}function bz(t,n,e,r){const i=e.event||"input",a=()=>t.update(n.value);r.signal(e.signal,n.value),n.addEventListener(i,a),VF(r,n,i,a),t.set=o=>{n.value=o,n.dispatchEvent(function(s){return typeof Event<"u"?new Event(s):{type:s}}(i))}}function xz(t,n,e,r){const i=r.signal(e.signal),a=De("div",{class:"vega-bind"}),o=e.input==="radio"?a:a.appendChild(De("label"));o.appendChild(De("span",{class:"vega-bind-name"},e.name||e.signal)),n.appendChild(a);let s=wz;switch(e.input){case"checkbox":s=Az;break;case"select":s=_z;break;case"radio":s=kz;break;case"range":s=Dz}s(t,o,e,i)}function wz(t,n,e,r){const i=De("input");for(const a in e)a!=="signal"&&a!=="element"&&i.setAttribute(a==="input"?"type":a,e[a]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",()=>t.update(i.value)),t.elements=[i],t.set=a=>i.value=a}function Az(t,n,e,r){const i={type:"checkbox",name:e.signal};r&&(i.checked=!0);const a=De("input",i);n.appendChild(a),a.addEventListener("change",()=>t.update(a.checked)),t.elements=[a],t.set=o=>a.checked=!!o||null}function _z(t,n,e,r){const i=De("select",{name:e.signal}),a=e.labels||[];e.options.forEach((o,s)=>{const u={value:o};pd(o,r)&&(u.selected=!0),i.appendChild(De("option",u,(a[s]||o)+""))}),n.appendChild(i),i.addEventListener("change",()=>{t.update(e.options[i.selectedIndex])}),t.elements=[i],t.set=o=>{for(let s=0,u=e.options.length;s{const u={type:"radio",name:e.signal,value:o};pd(o,r)&&(u.checked=!0);const l=De("input",u);l.addEventListener("change",()=>t.update(o));const c=De("label",{},(a[s]||o)+"");return c.prepend(l),i.appendChild(c),l}),t.set=o=>{const s=t.elements,u=s.length;for(let l=0;l{u.textContent=s.value,t.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),t.elements=[s],t.set=c=>{s.value=c,u.textContent=c}}function pd(t,n){return t===n||t+""==n+""}function KF(t,n,e,r,i,a){return(n=n||new r(t.loader())).initialize(e,WF(t),HF(t),dd(t),i,a).background(t.background())}function U1(t,n){return n?function(){try{n.apply(this,arguments)}catch(e){t.error(e)}}:null}function I1(t,n,e){if(typeof n=="string"){if(typeof document>"u")return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n&&e)try{n.textContent=""}catch(r){n=null,t.error(r)}return n}const tl=t=>+t||0;function QF(t){return Z(t)?{top:tl(t.top),bottom:tl(t.bottom),left:tl(t.left),right:tl(t.right)}:(n=>({top:n,bottom:n,left:n,right:n}))(tl(t))}async function W1(t,n,e,r){const i=ef(n),a=i&&i.headless;return a||j("Unrecognized renderer type: "+n),await t.runAsync(),KF(t,null,null,a,e,r).renderAsync(t._scenegraph.root)}var ZF="width",tC="height",H1="padding",nC={skip:!0};function eC(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===H1?r.left+r.right:0)}function rC(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===H1?r.top+r.bottom:0)}function Fz(t,n){return n.modified&&P(n.input.value)&&!t.startsWith("_:vega:_")}function Cz(t,n){return!(t==="parent"||n instanceof So.proxy)}function Ez(t,n,e,r){const i=t.element();i&&i.setAttribute("title",function(a){return a==null?"":P(a)?iC(a):Z(a)&&!Da(a)?(o=a,Object.keys(o).map(s=>{const u=o[s];return s+": "+(P(u)?iC(u):aC(u))}).join(` +`)):a+"";var o}(r))}function iC(t){return"["+t.map(aC).join(", ")+"]"}function aC(t){return P(t)?"[\u2026]":Z(t)&&!Da(t)?"{\u2026}":t}function oC(t,n){const e=this;if(n=n||{},$o.call(e),n.loader&&e.loader(n.loader),n.logger&&e.logger(n.logger),n.logLevel!=null&&e.logLevel(n.logLevel),n.locale||t.locale){const a=xt({},t.locale,n.locale);e.locale(Nx(a.number,a.time))}e._el=null,e._elBind=null,e._renderType=n.renderer||Ki.Canvas,e._scenegraph=new yA;const r=e._scenegraph.root;e._renderer=null,e._tooltip=n.tooltip||Ez,e._redraw=!0,e._handler=new wu().scene(r),e._globalCursor=!1,e._preventDefault=!1,e._timers=[],e._eventListeners=[],e._resizeListeners=[],e._eventConfig=function(a){const o=xt({defaults:{}},a),s=(u,l)=>{l.forEach(c=>{P(u[c])&&(u[c]=Dr(u[c]))})};return s(o.defaults,["prevent","allow"]),s(o,["view","window","selector"]),o}(t.eventConfig),e.globalCursor(e._eventConfig.globalCursor);const i=function(a,o,s){return LF(a,So,Qu,s).parse(o)}(e,t,n.expr);e._runtime=i,e._signals=i.signals,e._bind=(t.bindings||[]).map(a=>({state:null,param:xt({},a)})),i.root&&i.root.set(r),r.source=i.data.root.input,e.pulse(i.data.root.input,e.changeset().insert(r.items)),e._width=e.width(),e._height=e.height(),e._viewWidth=eC(e,e._width),e._viewHeight=rC(e,e._height),e._origin=[0,0],e._resize=0,e._autosize=1,function(a){var o=a._signals,s=o[ZF],u=o[tC],l=o[H1];function c(){a._autosize=a._resize=1}a._resizeWidth=a.add(null,d=>{a._width=d.size,a._viewWidth=eC(a,d.size),c()},{size:s}),a._resizeHeight=a.add(null,d=>{a._height=d.size,a._viewHeight=rC(a,d.size),c()},{size:u});const f=a.add(null,c,{pad:l});a._resizeWidth.rank=s.rank+1,a._resizeHeight.rank=u.rank+1,f.rank=l.rank+1}(e),function(a){a.add(null,o=>(a._background=o.bg,a._resize=1,o.bg),{bg:a._signals.background})}(e),function(a){const o=a._signals.cursor||(a._signals.cursor=a.add({user:L1,item:null}));a.on(a.events("view","pointermove"),o,(s,u)=>{const l=o.value,c=l?Q(l)?l:l.user:L1,f=u.item&&u.item.cursor||null;return l&&c===l.user&&f==l.item?l:{user:c,item:f}}),a.add(null,function(s){let u=s.cursor,l=this.value;return Q(u)||(l=u.item,u=u.user),q1(a,u&&u!==L1?u:l||u),l},{cursor:o})}(e),e.description(t.description),n.hover&&e.hover(),n.container&&e.initialize(n.container,n.bind),n.watchPixelRatio&&e._watchPixelRatio()}function md(t,n){return tt(t._signals,n)?t._signals[n]:j("Unrecognized signal name: "+G(n))}function sC(t,n){const e=(t._targets||[]).filter(r=>r._update&&r._update.handler===n);return e.length?e[0]:null}function uC(t,n,e,r){let i=sC(e,r);return i||(i=U1(t,()=>r(n,e.value)),i.handler=r,t.on(e,null,i)),t}function lC(t,n,e){const r=sC(n,e);return r&&n._targets.remove(r),t}V(oC,$o,{async evaluate(t,n,e){if(await $o.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(r){var i=dd(r),a=WF(r),o=HF(r);r._renderer.background(r.background()),r._renderer.resize(a,o,i),r._handler.origin(i),r._resizeListeners.forEach(s=>{try{s(a,o)}catch(u){r.error(u)}})}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(r){this.error(r)}return e&&Zl(this,e),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const n=t!=null?t+"":null;return n!==this._desc&&IF(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,n,e){const r=md(this,t);return arguments.length===1?r.value:this.update(r,n,e)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",QF(t)):QF(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(ef(t)||j("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&($o.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(md(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,n,e,r,i,a){this.runAfter(o=>{let s=0;o._autosize=0,o.width()!==e&&(s=1,o.signal(ZF,e,nC),o._resizeWidth.skip(!0)),o.height()!==r&&(s=1,o.signal(tC,r,nC),o._resizeHeight.skip(!0)),o._viewWidth!==t&&(o._resize=1,o._viewWidth=t),o._viewHeight!==n&&(o._resize=1,o._viewHeight=n),o._origin[0]===i[0]&&o._origin[1]===i[1]||(o._resize=1,o._origin=i),s&&o.run("enter"),a&&o.runAfter(u=>u.resize())},!1,1)},addEventListener(t,n,e){let r=n;return e&&e.trap===!1||(r=U1(this,n),r.raw=n),this._handler.on(t,r),this},removeEventListener(t,n){for(var e,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,e=i[a].handler,t===r&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},addResizeListener(t){const n=this._resizeListeners;return n.includes(t)||n.push(t),this},removeResizeListener(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},addSignalListener(t,n){return uC(this,t,md(this,t),n)},removeSignalListener(t,n){return lC(this,md(this,t),n)},addDataListener(t,n){return uC(this,t,cd(this,t).values,n)},removeDataListener(t,n){return lC(this,cd(this,t).values,n)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const n=q1(this,null);this._globalCursor=!!t,n&&q1(this,n)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,n){this._timers.push(function(e,r,i){var a=new D8,o=r;return r==null?(a.restart(e,r,i),a):(a._restart=a.restart,a.restart=function(s,u,l){u=+u,l=l==null?F8():+l,a._restart(function c(f){f+=o,a._restart(c,o+=u,l),s(f)},u,l)},a.restart(e,r,i),a)}(function(e){t({timestamp:Date.now(),elapsed:e})},n))},events:function(t,n,e){var r,i=this,a=new ic(e),o=function(l,c){i.runAsync(null,()=>{t===GF&&function(f,d){var h=f._eventConfig.defaults,p=h.prevent,m=h.allow;return p!==!1&&m!==!0&&(p===!0||m===!1||(p?p[d]:m?!m[d]:f.preventDefault()))}(i,n)&&l.preventDefault(),a.receive(yz(i,l,c))})};if(t==="timer")hd(i,"timer",n)&&i.timer(o,n);else if(t===GF)hd(i,"view",n)&&i.addEventListener(n,o,vz);else if(t==="window"?hd(i,"window",n)&&typeof window<"u"&&(r=[window]):typeof document<"u"&&hd(i,"selector",n)&&(r=Array.from(document.querySelectorAll(t))),r){for(var s=0,u=r.length;s=0;)o[t].stop();for(t=u.length;--t>=0;)for(n=(e=u[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);for(a&&a.call(this,this._handler,null,null,null),t=s.length;--t>=0;)i=s[t].type,r=s[t].handler,this._handler.off(i,r);return this},hover:function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",YF),XF,JF(t)),this.on(this.events("view","pointerout",YF),XF,JF(n)),this},data:function(t,n){return arguments.length<2?cd(this,t).values.value:fd.call(this,t,Ma().remove(Be).insert(n))},change:fd,insert:function(t,n){return fd.call(this,t,Ma().insert(n))},remove:function(t,n){return fd.call(this,t,Ma().remove(n))},scale:function(t){var n=this._runtime.scales;return tt(n,t)||j("Unrecognized scale or projection: "+t),n[t].value},initialize:function(t,n){const e=this,r=e._renderType,i=e._eventConfig.bind,a=ef(r);t=e._el=t?I1(e,t,!0):null,function(u){const l=u.container();l&&(l.setAttribute("role","graphics-document"),l.setAttribute("aria-roleDescription","visualization"),IF(l,u.description()))}(e),a||e.error("Unrecognized renderer type: "+r);const o=a.handler||wu,s=t?a.renderer:a.headless;return e._renderer=s?KF(e,e._renderer,t,s):null,e._handler=function(u,l,c,f){const d=new f(u.loader(),U1(u,u.tooltip())).scene(u.scenegraph().root).initialize(c,dd(u),u);return l&&l.handlers().forEach(h=>{d.on(h.type,h.handler)}),d}(e,e._handler,t,o),e._redraw=!0,t&&i!=="none"&&(n=n?e._elBind=I1(e,n,!0):t.appendChild(De("form",{class:"vega-bindings"})),e._bind.forEach(u=>{u.param.element&&i!=="container"&&(u.element=I1(e,u.param.element,!!u.param.input))}),e._bind.forEach(u=>{(function(l,c,f){if(!c)return;const d=f.param;let h=f.state;h||(h=f.state={elements:null,active:!1,set:null,update:p=>{p!=l.signal(d.signal)&&l.runAsync(null,()=>{h.source=!0,l.signal(d.signal,p)})}},d.debounce&&(h.update=Qh(d.debounce,h.update))),(d.input==null&&d.element?bz:xz)(h,c,d,l),h.active||(l.on(l._signals[d.signal],null,()=>{h.source?h.source=!1:h.set(l.signal(d.signal))}),h.active=!0)})(e,u.element||n,u)})),e},toImageURL:async function(t,n){t!==Ki.Canvas&&t!==Ki.SVG&&t!==Ki.PNG&&j("Unrecognized image type: "+t);const e=await W1(this,t,n);return t===Ki.SVG?function(r,i){const a=new Blob([r],{type:i});return window.URL.createObjectURL(a)}(e.svg(),"image/svg+xml"):e.canvas().toDataURL("image/png")},toCanvas:async function(t,n){return(await W1(this,Ki.Canvas,t,n)).canvas()},toSVG:async function(t){return(await W1(this,Ki.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:Fz,signals:Cz,recurse:!0})},setState:function(t){return this.runAsync(null,n=>{n._trigger=!1,n._runtime.setState(t)},n=>{n._trigger=!0}),this},_watchPixelRatio:function(){if(this.renderer()==="canvas"&&this._renderer._canvas){let t=null;const n=()=>{t!=null&&t();const e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",n),t=()=>{e.removeEventListener("change",n)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};n()}}});const G1="[",V1="]",$z=/[[\]{}]/,Sz={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let cC,fC;function aa(t,n,e){return cC=n||"view",fC=e||Sz,dC(t.trim()).map(Y1)}function nl(t,n,e,r,i){const a=t.length;let o,s=0;for(;n=0?--s:r&&r.indexOf(o)>=0&&++s}return n}function dC(t){const n=[],e=t.length;let r=0,i=0;for(;i")throw"Expected '>' after between selector: "+n;r=r.map(Y1);const a=Y1(n.slice(1).trim());return a.between?{between:r,stream:a}:(a.between=r,a)}(t):function(n){const e={source:cC},r=[];let i,a,o=[0,0],s=0,u=0,l=n.length,c=0;if(n[l-1]==="}"){if(c=n.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+n;try{o=function(f){const d=f.split(",");if(!f.length||d.length>2)throw f;return d.map(h=>{const p=+h;if(p!=p)throw f;return p})}(n.substring(c+1,l-1))}catch{throw"Invalid throttle specification: "+n}l=(n=n.slice(0,c).trim()).length,c=0}if(!l)throw n;if(n[0]==="@"&&(s=++c),i=nl(n,c,":"),i1?(e.type=r[1],s?e.markname=r[0].slice(1):function(f){return fC[f]}(r[0])?e.marktype=r[0]:e.source=r[0]):e.type=r[0],e.type.slice(-1)==="!"&&(e.consume=!0,e.type=e.type.slice(0,-1)),a!=null&&(e.filter=a),o[0]&&(e.throttle=o[0]),o[1]&&(e.debounce=o[1]),e}(t)}function Mz(t){return Z(t)?t:{type:t||"pad"}}const el=t=>+t||0;function Bz(t){return Z(t)?t.signal?t:{top:el(t.top),bottom:el(t.bottom),left:el(t.left),right:el(t.right)}:{top:n=el(t),bottom:n,left:n,right:n};var n}const yn=t=>Z(t)&&!P(t)?xt({},t):{value:t};function hC(t,n,e,r){return e!=null?(Z(e)&&!P(e)||P(e)&&e.length&&Z(e[0])?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function Cn(t,n,e){for(const r in n)hC(t,r,n[r]);for(const r in e)hC(t,r,e[r],"update")}function is(t,n,e){for(const r in n)e&&tt(e,r)||(t[r]=xt(t[r]||{},n[r]));return t}function as(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}const X1="mark",J1="frame",K1="scope",pC="legend-label",zz="title-text",Oz="title-subtitle";function Q1(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}const mC=t=>Q(t)?G(t):t.signal?`(${t.signal})`:gC(t);function gd(t){if(t.gradient!=null)return function(e){const r=[e.start,e.stop,e.count].map(i=>i==null?null:G(i));for(;r.length&&Bt(r)==null;)r.pop();return r.unshift(mC(e.gradient)),`gradient(${r.join(",")})`}(t);let n=t.signal?`(${t.signal})`:t.color?function(e){return e.c?yd("hcl",e.h,e.c,e.l):e.h||e.s?yd("hsl",e.h,e.s,e.l):e.l||e.a?yd("lab",e.l,e.a,e.b):e.r||e.g||e.b?yd("rgb",e.r,e.g,e.b):null}(t.color):t.field!=null?gC(t.field):t.value!==void 0?G(t.value):void 0;return t.scale!=null&&(n=function(e,r){const i=mC(e.scale);return e.range!=null?r=`lerp(_range(${i}), ${+e.range})`:(r!==void 0&&(r=`_scale(${i}, ${r})`),e.band&&(r=(r?r+"+":"")+`_bandwidth(${i})`+(+e.band==1?"":"*"+vd(e.band)),e.extra&&(r=`(datum.extra ? _scale(${i}, datum.extra.value) : ${r})`)),r==null&&(r="0")),r}(t,n)),n===void 0&&(n=null),t.exponent!=null&&(n=`pow(${n},${vd(t.exponent)})`),t.mult!=null&&(n+=`*${vd(t.mult)}`),t.offset!=null&&(n+=`+${vd(t.offset)}`),t.round&&(n=`round(${n})`),n}const yd=(t,n,e,r)=>`(${t}(${[n,e,r].map(gd).join(",")})+'')`;function vd(t){return Z(t)?"("+gd(t)+")":t}function gC(t){return yC(Z(t)?t:{datum:t})}function yC(t){let n,e,r;if(t.signal)n="datum",r=t.signal;else if(t.group||t.parent){for(e=Math.max(1,t.level||1),n="item";e-- >0;)n+=".mark.group";t.parent?(r=t.parent,n+=".datum"):r=t.group}else t.datum?(n="datum",r=t.datum):j("Invalid field reference: "+G(t));return t.signal||(r=Q(r)?Ni(r).map(G).join("]["):yC(r)),n+"["+r+"]"}function vC(t,n,e,r,i,a){const o={};(a=a||{}).encoders={$encode:o},t=function(s,u,l,c,f){const d={},h={};let p,m,g,y;for(m in m="lineBreak",u!=="text"||f[m]==null||as(m,s)||Q1(d,m,f[m]),(l=="legend"||String(l).startsWith("axis"))&&(l=null),y=l===J1?f.group:l===X1?xt({},f.mark,f[u]):null,y)g=as(m,s)||(m==="fill"||m==="stroke")&&(as("fill",s)||as("stroke",s)),g||Q1(d,m,y[m]);for(m in K(c).forEach(v=>{const x=f.style&&f.style[v];for(const b in x)as(b,s)||Q1(d,b,x[b])}),s=xt({},s),d)y=d[m],y.signal?(p=p||{})[m]=y:h[m]=y;return s.enter=xt(h,s.enter),p&&(s.update=xt(p,s.update)),s}(t,n,e,r,i.config);for(const s in t)o[s]=Nz(t[s],n,a,i);return a}function Nz(t,n,e,r){const i={},a={};for(const o in t)t[o]!=null&&(i[o]=Tz(Rz(t[o]),r,e,a));return{$expr:{marktype:n,channels:i},$fields:Object.keys(a),$output:Object.keys(t)}}function Rz(t){return P(t)?function(n){let e="";return n.forEach(r=>{const i=gd(r);e+=r.test?`(${r.test})?${i}:`:i}),Bt(e)===":"&&(e+="null"),e}(t):gd(t)}function Tz(t,n,e,r){const i=Tr(t,n);return i.$fields.forEach(a=>r[a]=1),xt(e,i.$params),i.$expr}const Pz=["value","update","init","react","bind"];function bC(t,n){j(t+' for "outer" push: '+G(n))}function xC(t,n){const e=t.name;if(t.push==="outer")n.signals[e]||bC("No prior signal definition",e),Pz.forEach(r=>{t[r]!==void 0&&bC("Invalid property ",r)});else{const r=n.addSignal(e,t.value);t.react===!1&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function Z1(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function bd(t,n,e,r){return new Z1(t,n,e,r)}function xd(t,n){return bd("operator",t,n)}function lt(t){const n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function rl(t,n){return n?{$field:t,$name:n}:{$field:t}}const ty=rl("key");function wC(t,n){return{$compare:t,$order:n}}function wd(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const ny="scope",ey="view";function pn(t){return t&&t.signal}function Ad(t){if(pn(t))return!0;if(Z(t)){for(const n in t)if(Ad(t[n]))return!0}return!1}function ar(t,n){return t??n}function Xa(t){return t&&t.signal||t}const AC="timer";function il(t,n){return(t.merge?jz:t.stream?Lz:t.type?qz:j("Invalid stream specification: "+G(t)))(t,n)}function jz(t,n){const e=ry({merge:t.merge.map(r=>il(r,n))},t,n);return n.addStream(e).id}function Lz(t,n){const e=ry({stream:il(t.stream,n)},t,n);return n.addStream(e).id}function qz(t,n){let e;t.type===AC?(e=n.event(AC,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(i){return i===ny?ey:i||ey}(t.source),t.type);const r=ry({stream:e},t,n);return Object.keys(r).length===1?e:n.addStream(r).id}function ry(t,n,e){let r=n.between;return r&&(r.length!==2&&j('Stream "between" parameter must have 2 entries: '+G(n)),t.between=[il(r[0],e),il(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(i,a,o){const s="event.item";return s+(i&&i!=="*"?"&&"+s+".mark.marktype==='"+i+"'":"")+(o?"&&"+s+".mark.role==='"+o+"'":"")+(a?"&&"+s+".mark.name==='"+a+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===ny&&r.push("inScope(event.item)"),r.length&&(t.filter=Tr("("+r.join(")&&(")+")",e).$expr),(r=n.throttle)!=null&&(t.throttle=+r),(r=n.debounce)!=null&&(t.debounce=+r),n.consume&&(t.consume=!0),t}const Uz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Iz(t,n,e){const r=t.encode,i={target:e};let a=t.events,o=t.update,s=[];a||j("Signal update missing events specification."),Q(a)&&(a=aa(a,n.isSubscope()?ny:ey)),a=K(a).filter(u=>u.signal||u.scale?(s.push(u),0):1),s.length>1&&(s=[Wz(s)]),a.length&&s.push(a.length>1?{merge:a}:a[0]),r!=null&&(o&&j("Signal encode and update are mutually exclusive."),o="encode(item(),"+G(r)+")"),i.update=Q(o)?Tr(o,n):o.expr!=null?Tr(o.expr,n):o.value!=null?o.value:o.signal!=null?{$expr:Uz,$params:{$value:n.signalRef(o.signal)}}:j("Invalid signal update specification."),t.force&&(i.options={force:!0}),s.forEach(u=>n.addUpdate(xt(function(l,c){return{source:l.signal?c.signalRef(l.signal):l.scale?c.scaleRef(l.scale):il(l,c)}}(u,n),i)))}function Wz(t){return{signal:"["+t.map(n=>n.scale?'scale("'+n.scale+'")':n.signal)+"]"}}const Pt=t=>(n,e,r)=>bd(t,e,n||void 0,r),_C=Pt("aggregate"),Hz=Pt("axisticks"),kC=Pt("bound"),or=Pt("collect"),DC=Pt("compare"),Gz=Pt("datajoin"),FC=Pt("encode"),Vz=Pt("expression"),Yz=Pt("facet"),Xz=Pt("field"),Jz=Pt("key"),Kz=Pt("legendentries"),Qz=Pt("load"),Zz=Pt("mark"),tO=Pt("multiextent"),nO=Pt("multivalues"),eO=Pt("overlap"),rO=Pt("params"),CC=Pt("prefacet"),iO=Pt("projection"),aO=Pt("proxy"),oO=Pt("relay"),EC=Pt("render"),sO=Pt("scale"),Ja=Pt("sieve"),uO=Pt("sortitems"),$C=Pt("viewlayout"),lO=Pt("values");let cO=0;const SC={min:"min",max:"max",count:"sum"};function fO(t,n){const e=n.getScale(t.name).params;let r;for(r in e.domain=MC(t.domain,t,n),t.range!=null&&(e.range=zC(t,n,e)),t.interpolate!=null&&function(i,a){a.interpolate=Ue(i.type||i),i.gamma!=null&&(a.interpolateGamma=Ue(i.gamma))}(t.interpolate,e),t.nice!=null&&(e.nice=function(i,a){return i.signal?a.signalRef(i.signal):Z(i)?{interval:Ue(i.interval),step:Ue(i.step)}:Ue(i)}(t.nice,n)),t.bins!=null&&(e.bins=function(i,a){return i.signal||P(i)?_d(i,a):a.objectProperty(i)}(t.bins,n)),t)tt(e,r)||r==="name"||(e[r]=Ue(t[r],n))}function Ue(t,n){return Z(t)?t.signal?n.signalRef(t.signal):j("Unsupported object: "+G(t)):t}function _d(t,n){return t.signal?n.signalRef(t.signal):t.map(e=>Ue(e,n))}function kd(t){j("Can not find data set: "+G(t))}function MC(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(P(t)?dO:t.fields?pO:hO)(t,n,e);n.domainMin==null&&n.domainMax==null||j("No scale domain defined for domainMin/domainMax to override.")}function dO(t,n,e){return t.map(r=>Ue(r,e))}function hO(t,n,e){const r=e.getData(t.data);return r||kd(t.data),No(n.type)?r.valuesRef(e,t.field,BC(t.sort,!1)):mw(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function pO(t,n,e){const r=t.data,i=t.fields.reduce((a,o)=>(o=Q(o)?{data:r,field:o}:P(o)||o.signal?function(s,u){const l="_:vega:_"+cO++,c=or({});if(P(s))c.value={$ingest:s};else if(s.signal){const f="setdata("+G(l)+","+s.signal+")";c.params.input=u.signalRef(f)}return u.addDataPipeline(l,[c,Ja({})]),{data:l,field:"data"}}(o,e):o,a.push(o),a),[]);return(No(n.type)?mO:mw(n.type)?gO:yO)(t,e,i)}function mO(t,n,e){const r=BC(t.sort,!0);let i,a;const o=e.map(l=>{const c=n.getData(l.data);return c||kd(l.data),c.countsRef(n,l.field,r)}),s={groupby:ty,pulse:o};r&&(i=r.op||"count",a=r.field?wd(i,r.field):"count",s.ops=[SC[i]],s.fields=[n.fieldRef(a)],s.as=[a]),i=n.add(_C(s));const u=n.add(or({pulse:lt(i)}));return a=n.add(lO({field:ty,sort:n.sortRef(r),pulse:lt(u)})),lt(a)}function BC(t,n){return t&&(t.field||t.op?t.field||t.op==="count"?n&&t.field&&t.op&&!SC[t.op]&&j("Multiple domain scales can not be sorted using "+t.op):j("No field provided for sort aggregate op: "+t.op):Z(t)?t.field="key":t={field:"key"}),t}function gO(t,n,e){const r=e.map(i=>{const a=n.getData(i.data);return a||kd(i.data),a.domainRef(n,i.field)});return lt(n.add(nO({values:r})))}function yO(t,n,e){const r=e.map(i=>{const a=n.getData(i.data);return a||kd(i.data),a.extentRef(n,i.field)});return lt(n.add(tO({extents:r})))}function zC(t,n,e){const r=n.config.range;let i=t.range;if(i.signal)return n.signalRef(i.signal);if(Q(i)){if(r&&tt(r,i))return zC(t=xt({},t,{range:r[i]}),n,e);i==="width"?i=[0,{signal:"width"}]:i==="height"?i=No(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:j("Unrecognized scale range value: "+G(i))}else{if(i.scheme)return e.scheme=P(i.scheme)?_d(i.scheme,n):Ue(i.scheme,n),i.extent&&(e.schemeExtent=_d(i.extent,n)),void(i.count&&(e.schemeCount=Ue(i.count,n)));if(i.step)return void(e.rangeStep=Ue(i.step,n));if(No(t.type)&&!P(i))return MC(i,t,n);P(i)||j("Unsupported range type: "+G(i))}return i.map(a=>(P(a)?_d:Ue)(a,n))}function iy(t,n,e){return P(t)?t.map(r=>iy(r,n,e)):Z(t)?t.signal?e.signalRef(t.signal):n==="fit"?t:j("Unsupported parameter object: "+G(t)):t}const sr="top",os="left",ss="right",oa="bottom",OC="center",ay="index",oy="label",us="perc",Ie="value",al="guide-label",sy="guide-title",vO="group-title",bO="group-subtitle",NC="symbol",Dd="gradient",uy="discrete",ly="size",cy=[ly,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],ol={name:1,style:1,interactive:1},_t={value:0},We={value:1},Fd="group",RC="rect",fy="rule",Ka="text";function sl(t){return t.type=Fd,t.interactive=t.interactive||!1,t}function de(t,n){const e=(r,i)=>ar(t[r],ar(n[r],i));return e.isVertical=r=>ar(t.direction,n.direction||(r?n.symbolDirection:n.gradientDirection))==="vertical",e.gradientLength=()=>ar(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>ar(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>ar(t.columns,ar(n.columns,+e.isVertical(!0))),e}function TC(t,n){const e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function Cd(t,n,e){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${n} : ${e}`}const dy=Cd(G(os),G(ss),G(OC));function PC(t,n){return n?t?Z(t)?Object.assign({},t,{offset:PC(t.offset,n)}):{value:t,offset:n}:n:t}function Fe(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=is(t.encode,n,ol)):t.interactive=!1,t}function xO(t,n,e,r){const i=de(t,e),a=i.isVertical(),o=i.gradientThickness(),s=i.gradientLength();let u,l,c,f,d;a?(l=[0,1],c=[0,0],f=o,d=s):(l=[0,0],c=[1,0],f=s,d=o);const h={enter:u={opacity:_t,x:_t,y:_t,width:yn(f),height:yn(d)},update:xt({},u,{opacity:We,fill:{gradient:n,start:l,stop:c}}),exit:{opacity:_t}};return Cn(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),Fe({type:RC,role:"legend-gradient",encode:h},r)}function wO(t,n,e,r,i){const a=de(t,e),o=a.isVertical(),s=a.gradientThickness(),u=a.gradientLength();let l,c,f,d,h="";o?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const p={opacity:_t,fill:{scale:n,field:Ie}};p[l]={signal:h+"datum."+us,mult:u},p[c]=_t,p[f]={signal:h+"datum.perc2",mult:u},p[d]=yn(s);const m={enter:p,update:xt({},p,{opacity:We}),exit:{opacity:_t}};return Cn(m,{stroke:a("gradientStrokeColor"),strokeWidth:a("gradientStrokeWidth")},{opacity:a("gradientOpacity")}),Fe({type:RC,role:"legend-band",key:Ie,from:i,encode:m},r)}const AO=`datum.${us}<=0?"${os}":datum.${us}>=1?"${ss}":"${OC}"`,_O=`datum.${us}<=0?"${oa}":datum.${us}>=1?"${sr}":"middle"`;function jC(t,n,e,r){const i=de(t,n),a=i.isVertical(),o=yn(i.gradientThickness()),s=i.gradientLength();let u,l,c,f,d=i("labelOverlap"),h="";const p={enter:u={opacity:_t},update:l={opacity:We,text:{field:oy}},exit:{opacity:_t}};return Cn(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:ar(t.labelLimit,n.gradientLabelLimit)}),a?(u.align={value:"left"},u.baseline=l.baseline={signal:_O},c="y",f="x",h="1-"):(u.align=l.align={signal:AO},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:h+"datum."+us,mult:s},u[f]=l[f]=o,o.offset=ar(t.labelOffset,n.gradientLabelOffset)||0,d=d?{separation:i("labelSeparation"),method:d,order:"datum."+ay}:void 0,Fe({type:Ka,role:pC,style:al,key:Ie,from:r,encode:p,overlap:d},e)}function kO(t,n,e,r,i){const a=de(t,n),o=e.entries,s=!(!o||!o.interactive),u=o?o.name:void 0,l=a("clipHeight"),c=a("symbolOffset"),f={data:"value"},d=`(${i}) ? datum.offset : datum.${ly}`,h=l?yn(l):{field:ly},p=`datum.${ay}`,m=`max(1, ${i})`;let g,y,v,x,b;h.mult=.5,g={enter:y={opacity:_t,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:We,x:y.x,y:y.y},exit:{opacity:_t}};let w=null,A=null;t.fill||(w=n.symbolBaseFillColor,A=n.symbolBaseStrokeColor),Cn(g,{fill:a("symbolFillColor",w),shape:a("symbolType"),size:a("symbolSize"),stroke:a("symbolStrokeColor",A),strokeDash:a("symbolDash"),strokeDashOffset:a("symbolDashOffset"),strokeWidth:a("symbolStrokeWidth")},{opacity:a("symbolOpacity")}),cy.forEach(C=>{t[C]&&(v[C]=y[C]={scale:t[C],field:Ie})});const _=Fe({type:"symbol",role:"legend-symbol",key:Ie,from:f,clip:!!l||void 0,encode:g},e.symbols),k=yn(c);k.offset=a("labelOffset"),g={enter:y={opacity:_t,x:{signal:d,offset:k},y:h},update:v={opacity:We,text:{field:oy},x:y.x,y:y.y},exit:{opacity:_t}},Cn(g,{align:a("labelAlign"),baseline:a("labelBaseline"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:a("labelLimit")});const F=Fe({type:Ka,role:pC,style:al,key:Ie,from:f,encode:g},e.labels);return g={enter:{noBound:{value:!l},width:_t,height:l?yn(l):_t,opacity:_t},exit:{opacity:_t},update:v={opacity:We,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(x=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${x}`,v.column.signal=`floor(${p} / ${x})`,b={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,b={field:p}),v.column.signal=`(${i})?${v.column.signal}:${p}`,sl({role:K1,from:r={facet:{data:r,name:"value",groupby:ay}},encode:is(g,o,ol),marks:[_,F],name:u,interactive:s,sort:b})}const hy='item.orient === "left"',py='item.orient === "right"',Ed=`(${hy} || ${py})`,DO=`datum.vgrad && ${Ed}`,FO=Cd('"top"','"bottom"','"middle"'),CO=`datum.vgrad && ${py} ? (${Cd('"right"','"left"','"center"')}) : (${Ed} && !(datum.vgrad && ${hy})) ? "left" : ${dy}`,EO=`item._anchor || (${Ed} ? "middle" : "start")`,$O=`${DO} ? (${hy} ? -90 : 90) : 0`,SO=`${Ed} ? (datum.vgrad ? (${py} ? "bottom" : "top") : ${FO}) : "top"`;function MO(t,n){let e;return Z(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+LC(t.path)+")":t.sphere&&(e="geoShape("+LC(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function LC(t){return Z(t)&&t.signal?t.signal:G(t)}function qC(t){const n=t.role||"";return n.startsWith("axis")||n.startsWith("legend")||n.startsWith("title")?n:t.type===Fd?K1:n||X1}function BO(t){return{marktype:t.type,name:t.name||void 0,role:t.role||qC(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function zO(t,n){return t&&t.signal?n.signalRef(t.signal):t!==!1}function my(t,n){const e=a2(t.type);e||j("Unrecognized transform type: "+G(t.type));const r=bd(e.type.toLowerCase(),null,UC(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function UC(t,n,e){const r={},i=t.params.length;for(let a=0;aWC(a,l,s))):WC(a,u,s)}(t,n,e):r==="projection"?e.projectionRef(n[t.name]):t.array&&!pn(i)?i.map(a=>IC(t,a,e)):IC(t,i,e):void(t.required&&j("Missing required "+G(n.type)+" parameter: "+G(t.name)))}function IC(t,n,e){const r=t.type;if(pn(n))return HC(r)?j("Expression references can not be signals."):gy(r)?e.fieldRef(n):GC(r)?e.compareRef(n):e.signalRef(n.signal);{const i=t.expr||gy(r);return i&&NO(n)?e.exprRef(n.expr,n.as):i&&RO(n)?rl(n.field,n.as):HC(r)?Tr(n,e):TO(r)?lt(e.getData(n).values):gy(r)?rl(n):GC(r)?e.compareRef(n):n}}function WC(t,n,e){const r=t.params.length;let i;for(let o=0;ot&&t.expr,RO=t=>t&&t.field,TO=t=>t==="data",HC=t=>t==="expr",gy=t=>t==="field",GC=t=>t==="compare";function $d(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:lt(n.getData(t.data).output)}function Qa(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}function VC(t){return Q(t)?t:null}function YC(t,n,e){const r=wd(e.op,e.field);let i;if(n.ops){for(let a=0,o=n.as.length;ac??"null").join(",")+"),0)",n);u.update=l.$expr,u.params=l.$params}function Sd(t,n){const e=qC(t),r=t.type===Fd,i=t.from&&t.from.facet,a=t.overlap;let o,s,u,l,c,f,d,h=t.layout||e===K1||e===J1;const p=e===X1||h||i,m=function(A,_,k){let F,C,D,E,$;return A?(F=A.facet)&&(_||j("Only group marks can be faceted."),F.field!=null?E=$=$d(F,k):(A.data?$=lt(k.getData(A.data).aggregate):(D=my(xt({type:"aggregate",groupby:K(F.groupby)},F.aggregate),k),D.params.key=k.keyRef(F.groupby),D.params.pulse=$d(F,k),E=$=lt(k.add(D))),C=k.keyRef(F.groupby,!0))):E=lt(k.add(or(null,[{}]))),E||(E=$d(A,k)),{key:C,pulse:E,parent:$}}(t.from,r,n);s=n.add(Gz({key:m.key||(t.key?rl(t.key):void 0),pulse:m.pulse,clean:!r}));const g=lt(s);s=u=n.add(or({pulse:g})),s=n.add(Zz({markdef:BO(t),interactive:zO(t.interactive,n),clip:MO(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:lt(s)}));const y=lt(s);s=l=n.add(FC(vC(t.encode,t.type,e,t.style,n,{mod:!1,pulse:y}))),s.params.parent=n.encode(),t.transform&&t.transform.forEach(A=>{const _=my(A,n),k=_.metadata;(k.generates||k.changes)&&j("Mark transforms should not generate new data."),k.nomod||(l.params.mod=!0),_.params.pulse=lt(s),n.add(s=_)}),t.sort&&(s=n.add(uO({sort:n.compareRef(t.sort),pulse:lt(s)})));const v=lt(s);(i||h)&&(h=n.add($C({layout:n.objectProperty(t.layout),legends:n.legends,mark:y,pulse:v})),f=lt(h));const x=n.add(kC({mark:y,pulse:f||v}));d=lt(x),r&&(p&&(o=n.operators,o.pop(),h&&o.pop()),n.pushState(v,f||d,g),i?function(A,_,k){const F=A.from.facet,C=F.name,D=$d(F,_);let E;F.name||j("Facet must have a name: "+G(F)),F.data||j("Facet must reference a data set: "+G(F)),F.field?E=_.add(CC({field:_.fieldRef(F.field),pulse:D})):F.groupby?E=_.add(Yz({key:_.keyRef(F.groupby),group:lt(_.proxy(k.parent)),pulse:D})):j("Facet must specify groupby or field: "+G(F));const $=_.fork(),M=$.add(or()),S=$.add(Ja({pulse:lt(M)}));$.addData(C,new Qa($,M,M,S)),$.addSignal("parent",null),E.params.subflow={$subflow:$.parse(A).toRuntime()}}(t,n,m):p?function(A,_,k){const F=_.add(CC({pulse:k.pulse})),C=_.fork();C.add(Ja()),C.addSignal("parent",null),F.params.subflow={$subflow:C.parse(A).toRuntime()}}(t,n,m):n.parse(t),n.popState(),p&&(h&&o.push(h),o.push(x))),a&&(d=function(A,_,k){const F=A.method,C=A.bound,D=A.separation,E={separation:pn(D)?k.signalRef(D.signal):D,method:pn(F)?k.signalRef(F.signal):F,pulse:_};if(A.order&&(E.sort=k.compareRef({field:A.order})),C){const $=C.tolerance;E.boundTolerance=pn($)?k.signalRef($.signal):+$,E.boundScale=k.scaleRef(C.scale),E.boundOrient=C.orient}return lt(k.add(eO(E)))}(a,d,n));const b=n.add(EC({pulse:d})),w=n.add(Ja({pulse:lt(b)},void 0,n.parent()));t.name!=null&&(c=t.name,n.addData(c,new Qa(n,u,b,w)),t.on&&t.on.forEach(A=>{(A.insert||A.remove||A.toggle)&&j("Marks only support modify triggers."),XC(A,n,c)}))}function PO(t,n){const e=n.config.legend,r=t.encode||{},i=de(t,e),a=r.legend||{},o=a.name||void 0,s=a.interactive,u=a.style,l={};let c,f,d,h=0;cy.forEach(v=>t[v]?(l[v]=t[v],h=h||t[v]):0),h||j("Missing valid scale for legend.");const p=function(v,x){let b=v.type||NC;return v.type||function(w){return cy.reduce((A,_)=>A+(w[_]?1:0),0)}(v)!==1||!v.fill&&!v.stroke||(b=Sm(x)?Dd:Mm(x)?uy:NC),b!==Dd?b:Mm(x)?uy:Dd}(t,n.scaleType(h)),m={title:t.title!=null,scales:l,type:p,vgrad:p!=="symbol"&&i.isVertical()},g=lt(n.add(or(null,[m]))),y=lt(n.add(Kz(f={type:p,scale:n.scaleRef(h),count:n.objectProperty(i("tickCount")),limit:n.property(i("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)})));return p===Dd?(d=[xO(t,h,e,r.gradient),jC(t,e,r.labels,y)],f.count=f.count||n.signalRef(`max(2,2*floor((${Xa(i.gradientLength())})/100))`)):p===uy?d=[wO(t,h,e,r.gradient,y),jC(t,e,r.labels,y)]:(c=function(v,x){const b=de(v,x);return{align:b("gridAlign"),columns:b.entryColumns(),center:{row:!0,column:!1},padding:{row:b("rowPadding"),column:b("columnPadding")}}}(t,e),d=[kO(t,e,r,y,Xa(c.columns))],f.size=function(v,x,b){const w=Xa(JC("size",v,b)),A=Xa(JC("strokeWidth",v,b)),_=Xa(function(k,F,C){return TC("fontSize",k)||function(D,E,$){const M=E.config.style[$];return M&&M[D]}("fontSize",F,C)}(b[1].encode,x,al));return Tr(`max(ceil(sqrt(${w})+${A}),${_})`,x)}(t,n,d[0].marks)),d=[sl({role:"legend-entry",from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(v,x,b,w){const A=de(v,x),_={enter:{opacity:_t},update:{opacity:We,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:_t}};return Cn(_,{orient:A("titleOrient"),_anchor:A("titleAnchor"),anchor:{signal:EO},angle:{signal:$O},align:{signal:CO},baseline:{signal:SO},text:v.title,fill:A("titleColor"),fillOpacity:A("titleOpacity"),font:A("titleFont"),fontSize:A("titleFontSize"),fontStyle:A("titleFontStyle"),fontWeight:A("titleFontWeight"),limit:A("titleLimit"),lineHeight:A("titleLineHeight")},{align:A("titleAlign"),baseline:A("titleBaseline")}),Fe({type:Ka,role:"legend-title",style:sy,from:w,encode:_},b)}(t,e,r.title,g)),Sd(sl({role:"legend",from:g,encode:is(jO(i,t,e),a,ol),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:o,interactive:s,style:u}),n)}function jO(t,n,e){const r={enter:{},update:{}};return Cn(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:e.strokeWidth,strokeDash:e.strokeDash,x:t("legendX"),y:t("legendY"),format:n.format,formatType:n.formatType}),r}function JC(t,n,e){return n[t]?`scale("${n[t]}",datum)`:TC(t,e[0].encode)}Qa.fromEntries=function(t,n){const e=n.length,r=n[e-1],i=n[e-2];let a=n[0],o=null,s=1;for(a&&a.type==="load"&&(a=n[1]),t.add(n[0]);s{e.push(my(r,n))}),t.on&&t.on.forEach(r=>{XC(r,n,t.name)}),n.addDataPipeline(t.name,function(r,i,a){const o=[];let s,u,l,c,f,d=null,h=!1,p=!1;for(r.values?pn(r.values)||Ad(r.format)?(o.push(KC(i,r)),o.push(d=Za())):o.push(d=Za({$ingest:r.values,$format:r.format})):r.url?Ad(r.url)||Ad(r.format)?(o.push(KC(i,r)),o.push(d=Za())):o.push(d=Za({$request:r.url,$format:r.format})):r.source&&(d=s=K(r.source).map(m=>lt(i.getData(m).output)),o.push(null)),u=0,l=a.length;ut===oa||t===sr,Md=(t,n,e)=>pn(t)?GO(t.signal,n,e):t===os||t===sr?n:e,vn=(t,n,e)=>pn(t)?WO(t.signal,n,e):QC(t)?n:e,ur=(t,n,e)=>pn(t)?HO(t.signal,n,e):QC(t)?e:n,ZC=(t,n,e)=>pn(t)?VO(t.signal,n,e):t===sr?{value:n}:{value:e},WO=(t,n,e)=>tE(`${t} === '${sr}' || ${t} === '${oa}'`,n,e),HO=(t,n,e)=>tE(`${t} !== '${sr}' && ${t} !== '${oa}'`,n,e),GO=(t,n,e)=>yy(`${t} === '${os}' || ${t} === '${sr}'`,n,e),VO=(t,n,e)=>yy(`${t} === '${sr}'`,n,e),YO=(t,n,e)=>yy(`${t} === '${ss}'`,n,e),tE=(t,n,e)=>(n=n!=null?yn(n):n,e=e!=null?yn(e):e,nE(n)&&nE(e)?{signal:`${t} ? (${n=n?n.signal||G(n.value):null}) : (${e=e?e.signal||G(e.value):null})`}:[xt({test:t},n)].concat(e||[])),nE=t=>t==null||Object.keys(t).length===1,yy=(t,n,e)=>({signal:`${t} ? (${ls(n)}) : (${ls(e)})`}),XO=(t,n,e,r,i)=>({signal:(r!=null?`${t} === '${os}' ? (${ls(r)}) : `:"")+(e!=null?`${t} === '${oa}' ? (${ls(e)}) : `:"")+(i!=null?`${t} === '${ss}' ? (${ls(i)}) : `:"")+(n!=null?`${t} === '${sr}' ? (${ls(n)}) : `:"")+"(null)"}),ls=t=>pn(t)?t.signal:t==null?null:G(t),cs=(t,n)=>{const e=t.signal;return e&&e.endsWith("(null)")?{signal:e.slice(0,-6)+n.signal}:t};function fs(t,n,e,r){let i;if(n&&tt(n,t))return n[t];if(tt(e,t))return e[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[sy][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[al][i]}return null}function eE(t){const n={};for(const e of t)if(e)for(const r in e)n[r]=1;return Object.keys(n)}function rE(t,n){return{scale:t.scale,range:n}}function JO(t,n,e,r,i){const a=de(t,n),o=t.orient,s=t.gridScale,u=Md(o,1,-1),l=function(v,x){if(x!==1)if(Z(v)){let b=v=xt({},v);for(;b.mult!=null;){if(!Z(b.mult))return b.mult=pn(x)?{signal:`(${b.mult}) * (${x.signal})`}:b.mult*x,v;b=b.mult=xt({},b.mult)}b.mult=x}else v=pn(x)?{signal:`(${x.signal}) * (${v||0})`}:x*(v||0);return v}(t.offset,u);let c,f,d;const h={enter:c={opacity:_t},update:d={opacity:We},exit:f={opacity:_t}};Cn(h,{stroke:a("gridColor"),strokeCap:a("gridCap"),strokeDash:a("gridDash"),strokeDashOffset:a("gridDashOffset"),strokeOpacity:a("gridOpacity"),strokeWidth:a("gridWidth")});const p={scale:t.scale,field:Ie,band:i.band,extra:i.extra,offset:i.offset,round:a("tickRound")},m=vn(o,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:u,offset:l}:{value:0,offset:l},y=s?{scale:s,range:1,mult:u,offset:l}:xt(m,{mult:u,offset:l});return c.x=d.x=vn(o,p,g),c.y=d.y=ur(o,p,g),c.x2=d.x2=ur(o,y),c.y2=d.y2=vn(o,y),f.x=vn(o,p),f.y=ur(o,p),Fe({type:fy,role:"axis-grid",key:Ie,from:r,encode:h},e)}function vy(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function KO(t,n,e,r,i,a){const o=de(t,n),s=t.orient,u=t.scale,l=Md(s,-1,1),c=Xa(o("labelFlush")),f=Xa(o("labelFlushOffset")),d=o("labelAlign"),h=o("labelBaseline");let p,m=c===0||!!c;const g=yn(i);g.mult=l,g.offset=yn(o("labelPadding")||0),g.offset.mult=l;const y={scale:u,field:Ie,band:.5,offset:PC(a.offset,o("labelOffset"))},v=vn(s,m?vy(u,c,'"left"','"right"','"center"'):{value:"center"},((F,C,D)=>pn(F)?YO(F.signal,C,D):F===ss?{value:C}:{value:D})(s,"left","right")),x=vn(s,ZC(s,"bottom","top"),m?vy(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),b=vy(u,c,`-(${f})`,f,0);m=m&&f;const w={opacity:_t,x:vn(s,y,g),y:ur(s,y,g)},A={enter:w,update:p={opacity:We,text:{field:oy},x:w.x,y:w.y,align:v,baseline:x},exit:{opacity:_t,x:w.x,y:w.y}};Cn(A,{dx:!d&&m?vn(s,b):null,dy:!h&&m?ur(s,b):null}),Cn(A,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:d,baseline:h});const _=o("labelBound");let k=o("labelOverlap");return k=k||_?{separation:o("labelSeparation"),method:k,order:"datum.index",bound:_?{scale:u,orient:s,tolerance:_}:null}:void 0,p.align!==v&&(p.align=cs(p.align,v)),p.baseline!==x&&(p.baseline=cs(p.baseline,x)),Fe({type:Ka,role:"axis-label",style:al,key:Ie,from:r,encode:A,overlap:k},e)}function QO(t,n,e,r){const i=de(t,n),a=t.orient,o=Md(a,-1,1);let s,u;const l={enter:s={opacity:_t,anchor:yn(i("titleAnchor",null)),align:{signal:dy}},update:u=xt({},s,{opacity:We,text:yn(t.title)}),exit:{opacity:_t}},c={signal:`lerp(range("${t.scale}"), ${Cd(0,1,.5)})`};return u.x=vn(a,c),u.y=ur(a,c),s.angle=vn(a,_t,((f,d)=>d===0?0:pn(f)?{signal:`(${f.signal}) * ${d}`}:{value:f*d})(o,90)),s.baseline=vn(a,ZC(a,oa,sr),{value:oa}),u.angle=s.angle,u.baseline=s.baseline,Cn(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(f,d,h,p){const m=(v,x)=>v!=null?(h.update[x]=cs(yn(v),h.update[x]),!1):!as(x,p),g=m(f("titleX"),"x"),y=m(f("titleY"),"y");h.enter.auto=y===g?yn(y):vn(d,yn(y),yn(g))}(i,a,l,e),l.update.align=cs(l.update.align,s.align),l.update.angle=cs(l.update.angle,s.angle),l.update.baseline=cs(l.update.baseline,s.baseline),Fe({type:Ka,role:"axis-title",style:sy,from:r,encode:l},e)}function ZO(t,n){const e=function(m,g){var y,v,x,b=g.config,w=b.style,A=b.axis,_=g.scaleType(m.scale)==="band"&&b.axisBand,k=m.orient;if(pn(k)){const F=eE([b.axisX,b.axisY]),C=eE([b.axisTop,b.axisBottom,b.axisLeft,b.axisRight]);for(x of(y={},F))y[x]=vn(k,fs(x,b.axisX,A,w),fs(x,b.axisY,A,w));for(x of(v={},C))v[x]=XO(k.signal,fs(x,b.axisTop,A,w),fs(x,b.axisBottom,A,w),fs(x,b.axisLeft,A,w),fs(x,b.axisRight,A,w))}else y=k===sr||k===oa?b.axisX:b.axisY,v=b["axis"+k[0].toUpperCase()+k.slice(1)];return y||v||_?xt({},A,y,v,_):A}(t,n),r=t.encode||{},i=r.axis||{},a=i.name||void 0,o=i.interactive,s=i.style,u=de(t,e),l=function(m){const g=m("tickBand");let y,v,x=m("tickOffset");return g?g.signal?(y={signal:`(${g.signal}) === 'extent' ? 1 : 0.5`},v={signal:`(${g.signal}) === 'extent'`},Z(x)||(x={signal:`(${g.signal}) === 'extent' ? 0 : ${x}`})):g==="extent"?(y=1,v=!0,x=0):(y=.5,v=!1):(y=m("bandPosition"),v=m("tickExtra")),{extra:v,band:y,offset:x}}(u),c={scale:t.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:t.title!=null},f=lt(n.add(or({},[c]))),d=lt(n.add(Hz({scale:n.scaleRef(t.scale),extra:n.property(l.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),h=[];let p;return c.grid&&h.push(JO(t,e,r.grid,d,l)),c.ticks&&(p=u("tickSize"),h.push(function(m,g,y,v,x,b){const w=de(m,g),A=m.orient,_=Md(A,-1,1);let k,F,C;const D={enter:k={opacity:_t},update:C={opacity:We},exit:F={opacity:_t}};Cn(D,{stroke:w("tickColor"),strokeCap:w("tickCap"),strokeDash:w("tickDash"),strokeDashOffset:w("tickDashOffset"),strokeOpacity:w("tickOpacity"),strokeWidth:w("tickWidth")});const E=yn(x);E.mult=_;const $={scale:m.scale,field:Ie,band:b.band,extra:b.extra,offset:b.offset,round:w("tickRound")};return C.y=k.y=vn(A,_t,$),C.y2=k.y2=vn(A,E),F.x=vn(A,$),C.x=k.x=ur(A,_t,$),C.x2=k.x2=ur(A,E),F.y=ur(A,$),Fe({type:fy,role:"axis-tick",key:Ie,from:v,encode:D},y)}(t,e,r.ticks,d,p,l))),c.labels&&(p=c.ticks?p:0,h.push(KO(t,e,r.labels,d,p,l))),c.domain&&h.push(function(m,g,y,v){const x=de(m,g),b=m.orient;let w,A;const _={enter:w={opacity:_t},update:A={opacity:We},exit:{opacity:_t}};Cn(_,{stroke:x("domainColor"),strokeCap:x("domainCap"),strokeDash:x("domainDash"),strokeDashOffset:x("domainDashOffset"),strokeWidth:x("domainWidth"),strokeOpacity:x("domainOpacity")});const k=rE(m,0),F=rE(m,1);return w.x=A.x=vn(b,k,_t),w.x2=A.x2=vn(b,F),w.y=A.y=ur(b,k,_t),w.y2=A.y2=ur(b,F),Fe({type:fy,role:"axis-domain",from:v,encode:_},y)}(t,e,r.domain,f)),c.title&&h.push(QO(t,e,r.title,f)),Sd(sl({role:"axis",from:f,encode:is(tN(u,t),i,ol),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:a,interactive:o,style:s}),n)}function tN(t,n){const e={enter:{},update:{}};return Cn(e,{orient:t("orient"),offset:t("offset")||0,position:ar(n.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:t("translate"),format:n.format,formatType:n.formatType}),e}function iE(t,n,e){const r=K(t.signals),i=K(t.scales);return e||r.forEach(a=>xC(a,n)),K(t.projections).forEach(a=>function(o,s){const u=s.config.projection||{},l={};for(const c in o)c!=="name"&&(l[c]=iy(o[c],c,s));for(const c in u)l[c]==null&&(l[c]=iy(u[c],c,s));s.addProjection(o.name,l)}(a,n)),i.forEach(a=>function(o,s){const u=o.type||"linear";dw(u)||j("Unrecognized scale type: "+G(u)),s.addScale(o.name,{type:u,domain:void 0})}(a,n)),K(t.data).forEach(a=>IO(a,n)),i.forEach(a=>fO(a,n)),(e||r).forEach(a=>function(o,s){const u=s.getSignal(o.name);let l=o.update;o.init&&(l?j("Signals can not include both init and update expressions."):(l=o.init,u.initonly=!0)),l&&(l=Tr(l,s),u.update=l.$expr,u.params=l.$params),o.on&&o.on.forEach(c=>Iz(c,s,u.id))}(a,n)),K(t.axes).forEach(a=>ZO(a,n)),K(t.marks).forEach(a=>Sd(a,n)),K(t.legends).forEach(a=>PO(a,n)),t.title&&qO(t.title,n),n.parseLambdas(),n}function nN(t,n){const e=n.config,r=lt(n.root=n.add(xd())),i=function(l,c){const f=m=>ar(l[m],c[m]),d=[ll("background",f("background")),ll("autosize",Mz(f("autosize"))),ll("padding",Bz(f("padding"))),ll("width",f("width")||0),ll("height",f("height")||0)],h=d.reduce((m,g)=>(m[g.name]=g,m),{}),p={};return K(l.signals).forEach(m=>{tt(h,m.name)?m=xt(h[m.name],m):d.push(m),p[m.name]=m}),K(c.signals).forEach(m=>{tt(p,m.name)||tt(h,m.name)||d.push(m)}),d}(t,e);i.forEach(l=>xC(l,n)),n.description=t.description||e.description,n.eventConfig=e.events,n.legends=n.objectProperty(e.legend&&e.legend.layout),n.locale=e.locale;const a=n.add(or()),o=n.add(FC(vC((l=>is({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},l))(t.encode),Fd,J1,t.style,n,{pulse:lt(a)}))),s=n.add($C({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:lt(o)}));n.operators.pop(),n.pushState(lt(o),lt(s),null),iE(t,n,i),n.operators.push(s);let u=n.add(kC({mark:r,pulse:lt(s)}));return u=n.add(EC({pulse:lt(u)})),u=n.add(Ja({pulse:lt(u)})),n.addData("root",new Qa(n,a,a,u)),n}function ll(t,n){return n&&n.signal?{name:t,update:n.signal}:{name:t,value:n}}function aE(t,n){this.config=t||{},this.options=n||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function oE(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function by(t){return(P(t)?eN:rN)(t)}function eN(t){const n=t.length;let e="[";for(let r=0;r0?",":"")+(Z(i)?i.signal||by(i):G(i))}return e+"]"}function rN(t){let n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+G(n)+":"+(Z(e)?e.signal||by(e):G(e));return r+"}"}aE.prototype=oE.prototype={parse(t){return iE(t,this)},fork(){return new oE(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(n=>{n.$ref=t.id}),t.refs=null),t},proxy(t){const n=t instanceof Z1?lt(t):t;return this.add(aO({value:n}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(r,i,a){let o,s;r&&(o=r.data||(r.data={}),s=o[i]||(o[i]=[]),s.push(a))}for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(const r in n.index)e(n.index[r],t,"index:"+r)}return this},pushState(t,n,e){this._encode.push(lt(this.add(Ja({pulse:t})))),this._parent.push(n),this._lookup.push(e?lt(this.proxy(e)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Bt(this._parent)},encode(){return Bt(this._encode)},lookup(){return Bt(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,n){if(Q(t))return rl(t,n);t.signal||j("Unsupported field reference: "+G(t));const e=t.signal;let r=this.field[e];if(!r){const i={name:this.signalRef(e)};n&&(i.as=n),this.field[e]=r=lt(this.add(Xz(i)))}return r},compareRef(t){let n=!1;const e=a=>pn(a)?(n=!0,this.signalRef(a.signal)):function(o){return o&&o.expr}(a)?(n=!0,this.exprRef(a.expr)):a,r=K(t.field).map(e),i=K(t.order).map(e);return n?lt(this.add(DC({fields:r,orders:i}))):wC(r,i)},keyRef(t,n){let e=!1;const r=this.signals;return t=K(t).map(i=>pn(i)?(e=!0,lt(r[i.signal])):i),e?lt(this.add(Jz({fields:t,flat:n}))):function(i,a){const o={$key:i};return a&&(o.$flat=!0),o}(t,n)},sortRef(t){if(!t)return t;const n=wd(t.op,t.field),e=t.order||"ascending";return e.signal?lt(this.add(DC({fields:n,orders:this.signalRef(e.signal)}))):wC(n,e)},event(t,n){const e=t+":"+n;if(!this.events[e]){const r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},hasOwnSignal(t){return tt(this.signals,t)},addSignal(t,n){this.hasOwnSignal(t)&&j("Duplicate signal name: "+G(t));const e=n instanceof Z1?n:this.add(xd(n));return this.signals[t]=e},getSignal(t){return this.signals[t]||j("Unrecognized signal name: "+G(t)),this.signals[t]},signalRef(t){return this.signals[t]?lt(this.signals[t]):(tt(this.lambdas,t)||(this.lambdas[t]=this.add(xd(null))),lt(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let n=0,e=t.length;ne+Math.floor(i*Ne()),pdf:o=>o===Math.floor(o)&&o>=e&&o=r?1:(s-e+1)/i},icdf:o=>o>=0&&o<=1?e-1+Math.floor(o*i):NaN};return a.min(t).max(n)},randomKDE:Cp,randomLCG:function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},randomLogNormal:d2,randomMixture:h2,randomNormal:Fp,randomUniform:p2,read:tx,regressionConstant:Rp,regressionExp:g2,regressionLinear:Tp,regressionLoess:b2,regressionLog:m2,regressionPoly:v2,regressionPow:y2,regressionQuad:Pp,renderModule:ef,repeat:I6,resetDefaultLocale:W6,resetSVGClipId:Iw,resetSVGDefIds:function(){Iw(),Mw=0},responseType:Zb,runtimeContext:LF,sampleCurve:fc,sampleLogNormal:Ep,sampleNormal:sc,sampleUniform:Bp,scale:Dt,sceneEqual:C0,sceneFromJSON:mA,scenePickVisit:Oc,sceneToJSON:pA,sceneVisit:Qe,sceneZOrder:Qm,scheme:zm,serializeXML:LA,setHybridRendererOptions:function(t){Ze.svgMarkTypes=t.svgMarkTypes??["text"],Ze.svgOnTop=t.svgOnTop??!0,Ze.debug=t.debug??!1},setRandom:function(t){Ne=t},span:Gl,splitAccessPath:Ni,stringValue:G,textMetrics:we,timeBin:nx,timeFloor:ix,timeFormatLocale:H6,timeInterval:np,timeOffset:Dx,timeSequence:kx,timeUnitSpecifier:_x,timeUnits:ex,toBoolean:zx,toDate:Ox,toNumber:ze,toSet:Dr,toString:Bx,transform:o2,transforms:So,truncate:Ex,truthy:Be,tupleid:st,typeParsers:G6,utcFloor:rx,utcInterval:tp,utcOffset:Cx,utcSequence:Fx,utcdayofyear:yx,utcquarter:wx,utcweek:bx,version:"5.33.0",visitArray:ka,week:xx,writeConfig:lp,zero:ip,zoomLinear:sp,zoomLog:ap,zoomPow:Vl,zoomSymlog:op},Symbol.toStringTag,{value:"Module"}));function xy(t){return U(t,"or")}function wy(t){return U(t,"and")}function Ay(t){return U(t,"not")}function Bd(t,n){if(Ay(t))Bd(t.not,n);else if(wy(t))for(const e of t.and)Bd(e,n);else if(xy(t))for(const e of t.or)Bd(e,n);else n(t)}function ds(t,n){return Ay(t)?{not:ds(t.not,n)}:wy(t)?{and:t.and.map(e=>ds(e,n))}:xy(t)?{or:t.or.map(e=>ds(e,n))}:n(t)}const ft=structuredClone;function sE(t){throw new Error(t)}function hs(t,n){const e={};for(const r of n)tt(t,r)&&(e[r]=t[r]);return e}function he(t,n){const e={...t};for(const r of n)delete e[r];return e}function wt(t){if($t(t))return t;const n=Q(t)?t:Lt(t);if(n.length<250)return n;let e=0;for(let r=0;ro===0?a:`[${a}]`),i=r.map((a,o)=>r.slice(0,o+1).join(""));for(const a of i)n.add(a)}return n}function Cy(t,n){return t===void 0||n===void 0||Dy(Fy(t),Fy(n))}function jt(t){return q(t).length===0}Set.prototype.toJSON=function(){return`Set(${[...this].map(t=>Lt(t)).join(",")})`};const q=Object.keys,En=Object.values,sa=Object.entries;function cl(t){return t===!0||t===!1}function Xt(t){const n=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+n}function fl(t,n){return Ay(t)?`!(${fl(t.not,n)})`:wy(t)?`(${t.and.map(e=>fl(e,n)).join(") && (")})`:xy(t)?`(${t.or.map(e=>fl(e,n)).join(") || (")})`:n(t)}function zd(t,n){if(n.length===0)return!0;const e=n.shift();return e in t&&zd(t[e],n)&&delete t[e],jt(t)}function dl(t){return t.charAt(0).toUpperCase()+t.substr(1)}function Ey(t,n="datum"){const e=Ni(t),r=[];for(let i=1;i<=e.length;i++){const a=`[${e.slice(0,i).map(G).join("][")}]`;r.push(`${n}${a}`)}return r.join(" && ")}function cE(t,n="datum"){return`${n}[${G(Ni(t).join("."))}]`}function Ot(t){return`datum['${t.replaceAll("'","\\'")}']`}function sN(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function He(t){return`${Ni(t).map(sN).join("\\.")}`}function to(t,n,e){return t.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),e)}function ms(t){return`${Ni(t).join(".")}`}function gs(t){return t?Ni(t).length:0}function un(...t){return t.find(n=>n!==void 0)}let fE=42;function dE(t){const n=++fE;return t?String(t)+n:n}function uN(){fE=42}function hE(t){return pE(t)?t:`__${t}`}function pE(t){return t.startsWith("__")}function hl(t){if(t!==void 0)return(t%360+360)%360}function Od(t){return!!$t(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const mE=Object.getPrototypeOf(structuredClone({}));function Ce(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor.name!==n.constructor.name)return!1;let e,r;if(Array.isArray(t)){if(e=t.length,e!=n.length)return!1;for(r=e;r--!==0;)if(!Ce(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const a of t.entries())if(!n.has(a[0]))return!1;for(const a of t.entries())if(!Ce(a[1],n.get(a[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const a of t.entries())if(!n.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(e=t.length,e!=n.length)return!1;for(r=e;r--!==0;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf&&t.valueOf!==mE.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString&&t.toString!==mE.toString)return t.toString()===n.toString();const i=Object.keys(t);if(e=i.length,e!==Object.keys(n).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=e;r--!==0;){const a=i[r];if(!Ce(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}function Lt(t){const n=[];return function e(r){if(r&&r.toJSON&&typeof r.toJSON=="function"&&(r=r.toJSON()),r===void 0)return;if(typeof r=="number")return isFinite(r)?""+r:"null";if(typeof r!="object")return JSON.stringify(r);let i,a;if(Array.isArray(r)){for(a="[",i=0;iId(t[n])?Xt(`_${n}_${sa(t[n])}`):Xt(`_${n}_${t[n]}`)).join("")}function Wt(t){return t===!0||io(t)&&!t.binned}function $n(t){return t==="binned"||io(t)&&t.binned===!0}function io(t){return Z(t)}function Id(t){return U(t,"param")}function SE(t){switch(t){case mi:case gi:case bi:case pe:case Lr:case qr:case da:case xi:case ca:case fa:case me:return 6;case ha:return 4;default:return 10}}function yl(t){return U(t,"expr")}function Sn(t,{level:n}={level:0}){const e=q(t||{}),r={};for(const i of e)r[i]=n===0?Ee(t[i]):Sn(t[i],{level:n-1});return r}function ME(t){const{anchor:n,frame:e,offset:r,orient:i,angle:a,limit:o,color:s,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=t,g={...n?{anchor:n}:{},...e?{frame:e}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a!==void 0?{angle:a}:{},...o!==void 0?{limit:o}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:hs(t,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function ga(t){return Q(t)||P(t)&&Q(t[0])}function it(t){return U(t,"signal")}function ao(t){return U(t,"step")}function _i(t){return!P(t)&&U(t,"field")&&U(t,"data")}const CN=q({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),EN={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},jy=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function BE(t){const n=P(t.condition)?t.condition.map(zE):zE(t.condition);return{...Ee(t),condition:n}}function Ee(t){if(yl(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function zE(t){if(yl(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Gt(t){if(yl(t)){const{expr:n,...e}=t;return{signal:n,...e}}return it(t)?t:t!==void 0?{value:t}:void 0}function $N(t){return it(t)?t.signal:G(t)}function OE(t){return it(t)?t.signal:G(t.value)}function pr(t){return it(t)?t.signal:t==null?null:G(t)}function SN(t,n,e){for(const r of e){const i=Wr(r,n.markDef,n.config);i!==void 0&&(t[r]=Gt(i))}return t}function NE(t){return[].concat(t.type,t.style??[])}function qt(t,n,e,r={}){const{vgChannel:i,ignoreVgConfig:a}=r;return i&&U(n,i)?n[i]:n[t]!==void 0?n[t]:!a||i&&i!==t?Wr(t,n,e,r):void 0}function Wr(t,n,e,{vgChannel:r}={}){const i=Ly(t,n,e.style);return un(r?i:void 0,i,r?e[n.type][r]:void 0,e[n.type][t],r?e.mark[r]:e.mark[t])}function Ly(t,n,e){return RE(t,NE(n),e)}function RE(t,n,e){let r;n=K(n);for(const i of n){const a=e[i];U(a,t)&&(r=a[t])}return r}function TE(t,n){return K(t).reduce((e,r)=>(e.field.push(Y(r,n)),e.order.push(r.sort??"ascending"),e),{field:[],order:[]})}function PE(t,n){const e=[...t];return n.forEach(r=>{for(const i of e)if(Ce(i,r))return;e.push(r)}),e}function jE(t,n){return Ce(t,n)||!n?t:t?[...K(t),...K(n)].join(", "):n}function LE(t,n){const e=t.value,r=n.value;if(e==null||r===null)return{explicit:t.explicit,value:null};if((ga(e)||it(e))&&(ga(r)||it(r)))return{explicit:t.explicit,value:jE(e,r)};if(ga(e)||it(e))return{explicit:t.explicit,value:e};if(ga(r)||it(r))return{explicit:t.explicit,value:r};if(!(ga(e)||it(e)||ga(r)||it(r)))return{explicit:t.explicit,value:PE(e,r)};throw new Error("It should never reach here")}function qy(t){return`Invalid specification ${Lt(t)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const MN='Autosize "fit" only works for single views and layered views.';function qE(t){return`${t=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function UE(t){return`${t=="width"?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${t=="width"?"x":"y"}".`}function IE(t){return t?`Dropping "fit-${t}" because spec has discrete ${ge(t)}.`:'Dropping "fit" because spec has discrete size.'}function Uy(t){return`Unknown field for ${t}. Cannot calculate view size.`}function WE(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`}function BN(t,n){return`Cannot project a selection on encoding channel "${t}" as it uses an aggregate function ("${n}").`}function HE(t){return`Selection not supported for ${t} yet.`}const zN="The same selection must be used to override scale domains in a layered view.";function GE(t){return`The "columns" property cannot be used when "${t}" has nested row/column.`}const Iy="Animation involving facet, layer, or concat is currently unsupported.";function VE(t,n,e){return`An ancestor parsed field "${t}" as ${e} but a child wants to parse the field as ${n}.`}function ON(t){return`Ignoring an invalid transform: ${Lt(t)}.`}function YE(t){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${t} are dropped.`}function NN(t){return`${t}Offset dropped because ${t} is continuous`}function XE(t){return`Invalid field type "${t}".`}function JE(t,n){const{fill:e,stroke:r}=n;return`Dropping color ${t} as the plot also has ${e&&r?"fill and stroke":e?"fill":"stroke"}.`}function Wy(t,n){return`Dropping ${Lt(t)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}function Wd(t,n,e){return`${t} dropped as it is incompatible with "${n}".`}function RN(t){return`${t}-encoding is dropped as ${t} is not a valid encoding channel.`}function TN(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`}function PN(t){return`${t} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Hy(t,n){return`Using discrete channel "${t}" to encode "${n}" field can be misleading as it does not encode ${n==="ordinal"?"order":"magnitude"}.`}function jN(t){return`Using unaggregated domain with raw field has no effect (${Lt(t)}).`}function LN(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`}function qN(t){return`Unaggregated domain is currently unsupported for log scale (${Lt(t)}).`}function KE(t,n,e){return`${e}-scale's "${n}" is dropped as it does not work with ${t} scale.`}function QE(t){return`The step for "${t}" is dropped because the ${t==="width"?"x":"y"} is continuous.`}const ZE="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Hd(t,n){return`Invalid ${t}: ${Lt(n)}.`}function t3(t){return`1D error band does not support ${t}.`}function n3(t){return`Channel ${t} is required for "binned" bin.`}const e3=Kh(Rx);let vl=e3;function Gy(...t){vl.error(...t)}function I(...t){vl.warn(...t)}function oo(t){if(t&&Z(t)){for(const n of Yy)if(U(t,n))return!0}return!1}const r3=["january","february","march","april","may","june","july","august","september","october","november","december"],UN=r3.map(t=>t.substr(0,3)),i3=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],IN=i3.map(t=>t.substr(0,3));function Vy(t,n){const e=[];if(n&&t.day!==void 0&&q(t).length>1&&(I(function(r){return`Dropping day from datetime ${Lt(r)} as day cannot be combined with other units.`}(t)),delete(t=ft(t)).day),t.year!==void 0?e.push(t.year):e.push(2012),t.month!==void 0){const r=n?function(i){if(Od(i)&&(i=+i),$t(i))return i-1;{const a=i.toLowerCase(),o=r3.indexOf(a);if(o!==-1)return o;const s=a.substr(0,3),u=UN.indexOf(s);if(u!==-1)return u;throw new Error(Hd("month",i))}}(t.month):t.month;e.push(r)}else if(t.quarter!==void 0){const r=n?function(i){if(Od(i)&&(i=+i),$t(i))return i>4&&I(Hd("quarter",i)),i-1;throw new Error(Hd("quarter",i))}(t.quarter):t.quarter;e.push($t(r)?3*r:`${r}*3`)}else e.push(0);if(t.date!==void 0)e.push(t.date);else if(t.day!==void 0){const r=n?function(i){if(Od(i)&&(i=+i),$t(i))return i%7;{const a=i.toLowerCase(),o=i3.indexOf(a);if(o!==-1)return o;const s=a.substr(0,3),u=IN.indexOf(s);if(u!==-1)return u;throw new Error(Hd("day",i))}}(t.day):t.day;e.push($t(r)?r+1:`${r}+1`)}else e.push(1);for(const r of["hours","minutes","seconds","milliseconds"]){const i=t[r];e.push(i===void 0?0:i)}return e}function so(t){const n=Vy(t,!0).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}const a3={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Yy=q(a3);function uo(t){return Z(t)?t.binned:o3(t)}function o3(t){return t&&t.startsWith("binned")}function Xy(t){return t.startsWith("utc")}const WN={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Gd(t){return Yy.filter(n=>u3(t,n))}function s3(t){const n=Gd(t);return n[n.length-1]}function u3(t,n){const e=t.indexOf(n);return!(e<0)&&!(e>0&&n==="seconds"&&t.charAt(e-1)==="i")&&!(t.length>e+3&&n==="day"&&t.charAt(e+3)==="o")&&!(e>0&&n==="year"&&t.charAt(e-1)==="f")}function HN(t,n,{end:e}={end:!1}){const r=Ey(n),i=Xy(t)?"utc":"";function a(u){return u==="quarter"?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`}let o;const s={};for(const u of Yy)u3(t,u)&&(s[u]=a(u),o=u);return e&&(s[o]+="+1"),function(u){const l=Vy(u,!1).join(", ");return u.utc?`utc(${l})`:`datetime(${l})`}(s)}function l3(t){if(t)return`timeUnitSpecifier(${Lt(Gd(t))}, ${Lt(WN)})`}function xn(t){if(!t)return;let n;return Q(t)?n=o3(t)?{unit:t.substring(6),binned:!0}:{unit:t}:Z(t)&&(n={...t,...t.unit?{unit:t.unit}:{}}),Xy(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function c3(t,n=e=>e){const e=xn(t),r=s3(e.unit);if(r&&r!=="day"){const i={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:a,part:o}=f3(r,e.step);return`${n(so({...i,[o]:+i[o]+a}))} - ${n(so(i))}`}}const GN={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function f3(t,n=1){if(function(e){return tt(GN,e)}(t))return{part:t,step:n};switch(t){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function Jy(t){return!!(t!=null&&t.field)&&t.equal!==void 0}function Ky(t){return!!(t!=null&&t.field)&&t.lt!==void 0}function Qy(t){return!!(t!=null&&t.field)&&t.lte!==void 0}function Zy(t){return!!(t!=null&&t.field)&&t.gt!==void 0}function tv(t){return!!(t!=null&&t.field)&&t.gte!==void 0}function nv(t){return!!(t!=null&&t.field&&(P(t.range)&&t.range.length===2||it(t.range)))}function ev(t){return!!(t!=null&&t.field)&&(P(t.oneOf)||P(t.in))}function d3(t){return ev(t)||Jy(t)||nv(t)||Ky(t)||Zy(t)||Qy(t)||tv(t)}function Hr(t,n){return lh(t,{timeUnit:n,wrapTime:!0})}function h3(t,n=!0){const{field:e}=t,r=xn(t.timeUnit),{unit:i,binned:a}=r||{},o=Y(t,{expr:"datum"}),s=i?`time(${a?o:HN(i,e)})`:o;if(Jy(t))return`${s}===${Hr(t.equal,i)}`;if(Ky(t))return`${s}<${Hr(t.lt,i)}`;if(Zy(t))return`${s}>${Hr(t.gt,i)}`;if(Qy(t))return`${s}<=${Hr(t.lte,i)}`;if(tv(t))return`${s}>=${Hr(t.gte,i)}`;if(ev(t))return`indexof([${function(u,l){return u.map(c=>Hr(c,l))}(t.oneOf,i).join(",")}], ${s}) !== -1`;if(function(u){return!!(u!=null&&u.field)&&u.valid!==void 0}(t))return Vd(s,t.valid);if(nv(t)){const{range:u}=Sn(t),l=it(u)?{signal:`${u.signal}[0]`}:u[0],c=it(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&n)return"inrange("+s+", ["+Hr(l,i)+", "+Hr(c,i)+"])";const f=[];return l!==null&&f.push(`${s} >= ${Hr(l,i)}`),c!==null&&f.push(`${s} <= ${Hr(c,i)}`),f.length>0?f.join(" && "):"true"}throw new Error(`Invalid field predicate: ${Lt(t)}`)}function Vd(t,n=!0){return n?`isValid(${t}) && isFinite(+${t})`:`!isValid(${t}) || !isFinite(+${t})`}function VN(t){return d3(t)&&t.timeUnit?{...t,timeUnit:xn(t.timeUnit)}:t}function YN(t){return t==="quantitative"||t==="temporal"}function p3(t){return t==="ordinal"||t==="nominal"}const lo="quantitative",rv="ordinal",xs="temporal",iv="nominal",ws="geojson",m3="linear",XN="log",JN="pow",KN="sqrt",av="time",Yd="utc",g3="point",ov="band",sv={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function QN(t,n){const e=sv[t],r=sv[n];return e===r||e==="ordinal-position"&&r==="time"||r==="ordinal-position"&&e==="time"}const ZN={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function y3(t){return ZN[t]}const v3=new Set(["linear","log","pow","sqrt","symlog"]),b3=new Set([...v3,"time","utc"]);function x3(t){return v3.has(t)}const w3=new Set(["quantile","quantize","threshold"]),tR=new Set([...b3,...w3,"sequential","identity"]),nR=new Set(["ordinal","bin-ordinal","point","band"]);function wn(t){return nR.has(t)}function mr(t){return tR.has(t)}function Gr(t){return b3.has(t)}function As(t){return w3.has(t)}function A3(t){return U(t,"param")}const{type:Gj,domain:Vj,range:Yj,rangeMax:Xj,rangeMin:Jj,scheme:Kj,...eR}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},rR=q(eR);function uv(t,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(t);case"bins":return!["point","band","identity","ordinal"].includes(t);case"round":return Gr(t)||t==="band"||t==="point";case"padding":case"rangeMin":case"rangeMax":return Gr(t)||["point","band"].includes(t);case"paddingOuter":case"align":return["point","band"].includes(t);case"paddingInner":return t==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Gr(t);case"nice":return Gr(t)||t==="quantize"||t==="threshold";case"exponent":return t==="pow";case"base":return t==="log";case"constant":return t==="symlog";case"zero":return mr(t)&&!vt(["log","time","utc","threshold","quantile"],t)}}function _3(t,n){switch(n){case"interpolate":case"scheme":case"domainMid":return bs(t)?void 0:`Cannot use the scale property "${n}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const jn={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},k3=jn.arc,Xd=jn.area,Jd=jn.bar,iR=jn.image,Kd=jn.line,Qd=jn.point,aR=jn.rect,Zd=jn.rule,D3=jn.text,lv=jn.tick,oR=jn.trail,cv=jn.circle,fv=jn.square,F3=jn.geoshape;function ya(t){return["line","area","trail"].includes(t)}function bl(t){return["rect","bar","image","arc","tick"].includes(t)}const sR=new Set(q(jn));function Vr(t){return U(t,"type")}const uR=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],C3=q({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),dv=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],lR={area:["line","point"],bar:dv,rect:dv,line:["point"],tick:["bandSize","thickness",...dv]},E3=q({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function co(t){return U(t,"band")}const cR={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},hv={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},fR={...hv,binSpacing:1},dR={...hv,thickness:1};function $3(t,{isPath:n}){return t===void 0||t==="break-paths-show-path-domains"?n?"break-paths-show-domains":"filter":t===null?"show":t}function pv({markDef:t,config:n,scaleChannel:e,scaleType:r,isCountAggregate:i}){var s,u;if(!r||!mr(r)||i)return"always-valid";const a=$3(qt("invalid",t,n),{isPath:ya(t.type)});return((u=(s=n.scale)==null?void 0:s.invalid)==null?void 0:u[e])!==void 0?"show":a}function S3({scaleName:t,scale:n,mode:e}){const r=`domain('${t}')`;if(!n||!t)return;const i=`${r}[0]`,a=`peek(${r})`,o=n.domainHasZero();return o==="definitely"?{scale:t,value:0}:o==="maybe"?{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${e==="zeroOrMin"?i:a})`}:{signal:`scale('${t}', ${e==="zeroOrMin"?i:a})`}}function M3({scaleChannel:t,channelDef:n,scale:e,scaleName:r,markDef:i,config:a}){var l;const o=e==null?void 0:e.get("type"),s=vr(n),u=pv({scaleChannel:t,markDef:i,config:a,scaleType:o,isCountAggregate:Ud(s==null?void 0:s.aggregate)});if(s&&u==="show"){const c=((l=a.scale.invalid)==null?void 0:l[t])??"zero-or-min";return{test:Vd(Y(s,{expr:"datum"}),!1),...hR(c,e,r)}}}function hR(t,n,e){if(Z(r=t)&&"value"in r){const{value:i}=t;return it(i)?{signal:i.signal}:{value:i}}var r;return S3({scale:n,scaleName:e,mode:"zeroOrMin"})}function mv(t){const{channel:n,channelDef:e,markDef:r,scale:i,scaleName:a,config:o}=t,s=ro(n),u=gv(t),l=M3({scaleChannel:s,channelDef:e,scale:i,scaleName:a,markDef:r,config:o});return l!==void 0?[l,u]:u}function fo(t,n,e,r){const i={};if(n&&(i.scale=n),Yr(t)){const{datum:a}=t;oo(a)?i.signal=so(a):it(a)?i.signal=a.signal:yl(a)?i.signal=a.expr:i.value=a}else i.field=Y(t,e);if(r){const{offset:a,band:o}=r;a&&(i.offset=a),o&&(i.band=o)}return i}function th({scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:e,offset:r,startSuffix:i,endSuffix:a="end",bandPosition:o=.5}){const s=!it(o)&&0Xt(`${h==="unit"?"":`_${h}_`}${d[h]}`)).join(""):(f?"utc":"")+"timeunit"+q(d).map(h=>Xt(`_${h}_${d[h]}`)).join("")}(l),i=(!["range","mid"].includes(n.binSuffix)&&n.binSuffix||"")+(n.suffix??""))}o&&(e=e?`${o}_${e}`:o)}return i&&(e=`${e}_${i}`),r&&(e=`${r}_${e}`),n.forAs?ms(e):n.expr?cE(e,n.expr)+a:He(e)+a}function ah(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return H(t)&&!!t.bin;case"temporal":return!1}throw new Error(XE(t.type))}const V3=(t,n)=>{switch(n.fieldTitle){case"plain":return t.field;case"functional":return function(e){const{aggregate:r,bin:i,timeUnit:a,field:o}=e;if(ma(r))return`${o} for argmax(${r.argmax})`;if(Ai(r))return`${o} for argmin(${r.argmin})`;const s=a&&!uo(a)?xn(a):void 0,u=r||(s==null?void 0:s.unit)||(s==null?void 0:s.maxbins)&&"timeunit"||Wt(i)&&"bin";return u?`${u.toUpperCase()}(${o})`:o}(t);default:return function(e,r){var u;const{field:i,bin:a,timeUnit:o,aggregate:s}=e;if(s==="count")return r.countTitle;if(Wt(a))return`${i} (binned)`;if(o&&!uo(o)){const l=(u=xn(o))==null?void 0:u.unit;if(l)return`${i} (${Gd(l).join("-")})`}else if(s)return ma(s)?`${i} for max ${s.argmax}`:Ai(s)?`${i} for min ${s.argmin}`:`${dl(s)} of ${i}`;return i}(t,n)}};let Y3=V3;function X3(t){Y3=t}function Ds(t,n,{allowDisabling:e,includeDefault:r=!0}){var s;const i=(s=wv(t))==null?void 0:s.title;if(!H(t))return i??t.title;const a=t,o=r?Av(a,n):void 0;return e?un(i,a.title,o):i??a.title??o}function wv(t){return ks(t)&&t.axis?t.axis:H3(t)&&t.legend?t.legend:bv(t)&&t.header?t.header:void 0}function Av(t,n){return Y3(t,n)}function oh(t){if(G3(t)){const{format:n,formatType:e}=t;return{format:n,formatType:e}}{const n=wv(t)??{},{format:e,formatType:r}=n;return{format:e,formatType:r}}}function vr(t){return H(t)?t:rh(t)?t.condition:void 0}function mn(t){return ht(t)?t:kl(t)?t.condition:void 0}function J3(t,n,e,r={}){return Q(t)||$t(t)||Fa(t)?(I(function(i,a,o){return`Channel ${i} is a ${a}. Converted to {value: ${Lt(o)}}.`}(n,Q(t)?"string":$t(t)?"number":"boolean",t)),{value:t}):ht(t)?sh(t,n,e,r):kl(t)?{...t,condition:sh(t.condition,n,e,r)}:t}function sh(t,n,e,r){if(G3(t)){const{format:i,formatType:a,...o}=t;if(ho(a)&&!e.customFormatTypes)return I(YE(n)),sh(o,n,e,r)}else{const i=ks(t)?"axis":H3(t)?"legend":bv(t)?"header":null;if(i&&t[i]){const{format:a,formatType:o,...s}=t[i];if(ho(o)&&!e.customFormatTypes)return I(YE(n)),sh({...t,[i]:s},n,e,r)}}return H(t)?_v(t,n,r):function(i){let a=i.type;if(a)return i;const{datum:o}=i;return a=$t(o)?"quantitative":Q(o)?"nominal":oo(o)?"temporal":void 0,{...i,type:a}}(t)}function _v(t,n,{compositeMark:e=!1}={}){const{aggregate:r,timeUnit:i,bin:a,field:o}=t,s={...t};if(e||!r||qd(r)||ma(r)||Ai(r)||(I(function(u){return`Invalid aggregation operator "${u}".`}(r)),delete s.aggregate),i&&(s.timeUnit=xn(i)),o&&(s.field=`${o}`),Wt(a)&&(s.bin=uh(a,n)),$n(a)&&!ln(n)&&I(function(u){return`Channel ${u} should not be used with "binned" bin.`}(n)),oe(s)){const{type:u}=s,l=function(c){if(c)switch(c=c.toLowerCase()){case"q":case lo:return"quantitative";case"t":case xs:return"temporal";case"o":case rv:return"ordinal";case"n":case iv:return"nominal";case ws:return"geojson"}}(u);u!==l&&(s.type=l),u!=="quantitative"&&Ud(r)&&(I(function(c,f){return`Invalid field type "${c}" for aggregate: "${f}", using "quantitative" instead.`}(u,r)),s.type="quantitative")}else if(!AE(n)){const u=function(l,c){var p;switch(c){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(xv(l)&&P(l.sort))return"ordinal";const{aggregate:f,bin:d,timeUnit:h}=l;if(h)return"temporal";if(d||f&&!ma(f)&&!Ai(f))return"quantitative";if(po(l)&&((p=l.scale)!=null&&p.type))switch(sv[l.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,n);s.type=u}if(oe(s)){const{compatible:u,warning:l}=function(c,f){const d=c.type;if(d==="geojson"&&f!=="shape")return{compatible:!1,warning:`Channel ${f} should not be used with a geojson data.`};switch(f){case mi:case gi:case Nd:return ah(c)?Fs:{compatible:!1,warning:TN(f)};case Jt:case bn:case ua:case ys:case pe:case Lr:case qr:case pl:case ml:case Rd:case eo:case Td:case Pd:case no:case Ge:case cr:case jd:return Fs;case dr:case Ve:case fr:case hr:return d!==lo?{compatible:!1,warning:`Channel ${f} should be used with a quantitative field only, not ${c.type} field.`}:Fs;case xi:case ca:case fa:case da:case bi:case vi:case yi:case lr:case jr:case la:return d!=="nominal"||c.sort?Fs:{compatible:!1,warning:`Channel ${f} should not be used with an unsorted discrete field.`};case me:case ha:return ah(c)||function(h){var p;return po(h)&&As((p=h.scale)==null?void 0:p.type)}(c)?Fs:{compatible:!1,warning:PN(f)};case vs:return c.type!=="nominal"||"sort"in c?Fs:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,n)||{};u===!1&&I(l)}if(xv(s)&&Q(s.sort)){const{sort:u}=s;if(P3(u))return{...s,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&P3(l))return{...s,sort:{encoding:l,order:"descending"}}}if(bv(s)){const{header:u}=s;if(u){const{orient:l,...c}=u;if(l)return{...s,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return s}function uh(t,n){return Fa(t)?{maxbins:SE(n)}:t==="binned"?{binned:!0}:t.maxbins||t.step?t:{...t,maxbins:SE(n)}}const Fs={compatible:!0};function Cs(t){const{formatType:n}=oh(t);return n==="time"||!n&&function(e){return e&&(e.type==="temporal"||H(e)&&!!e.timeUnit)}(t)}function lh(t,{timeUnit:n,type:e,wrapTime:r,undefinedIfExprNotRequired:i}){var u;const a=n&&((u=xn(n))==null?void 0:u.unit);let o,s=a||e==="temporal";return yl(t)?o=t.expr:it(t)?o=t.signal:oo(t)?(s=!0,o=so(t)):(Q(t)||$t(t))&&s&&(o=`datetime(${Lt(t)})`,function(l){return tt(a3,l)}(a)&&($t(t)&&t<1e4||Q(t)&&isNaN(Date.parse(t)))&&(o=so({[a]:t}))),o?r&&s?`time(${o})`:o:i?void 0:Lt(t)}function K3(t,n){const{type:e}=t;return n.map(r=>{const i=lh(r,{timeUnit:H(t)&&!uo(t.timeUnit)?t.timeUnit:void 0,type:e,undefinedIfExprNotRequired:!0});return i!==void 0?{signal:i}:r})}function Dl(t,n){return Wt(t.bin)?Ir(n)&&["ordinal","nominal"].includes(t.type):(console.warn("Only call this method for binned field defs."),!1)}const Q3={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Fl(t){return t==null?void 0:t.condition}const Z3=["domain","grid","labels","ticks","title"],gR={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},t$={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},yR={...t$,style:1,labelExpr:1,encoding:1};function n$(t){return tt(yR,t)}const e$=q({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function Di(t){return U(t,"mark")}class ch{constructor(n,e){this.name=n,this.run=e}hasMatchingType(n){return!!Di(n)&&function(e){return Vr(e)?e.type:e}(n.mark)===this.name}}function mo(t,n){const e=t&&t[n];return!!e&&(P(e)?ps(e,r=>!!r.field):H(e)||rh(e))}function r$(t,n){const e=t&&t[n];return!!e&&(P(e)?ps(e,r=>!!r.field):H(e)||Yr(e)||kl(e))}function i$(t,n){if(ln(n)){const e=t[n];if((H(e)||Yr(e))&&(p3(e.type)||H(e)&&e.timeUnit))return r$(t,By(n))}return!1}function a$(t){return ps(cN,n=>{if(mo(t,n)){const e=t[n];if(P(e))return ps(e,r=>!!r.aggregate);{const r=vr(e);return r&&!!r.aggregate}}return!1})}function o$(t,n){const e=[],r=[],i=[],a=[],o={};return kv(t,(s,u)=>{if(H(s)){const{field:l,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const p=wv(s),m=p==null?void 0:p.title;let g=Y(s,{forAs:!0});const y={...m?[]:{title:Ds(s,n,{allowDisabling:!0})},...h,field:g};if(c){let v;if(ma(c)?(v="argmax",g=Y({op:"argmax",field:c.argmax},{forAs:!0}),y.field=`${g}.${l}`):Ai(c)?(v="argmin",g=Y({op:"argmin",field:c.argmin},{forAs:!0}),y.field=`${g}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(v=c),v){const x={op:v,as:g};l&&(x.field=l),a.push(x)}}else if(e.push(g),oe(s)&&Wt(f)){if(r.push({bin:f,field:l,as:g}),e.push(Y(s,{binSuffix:"end"})),Dl(s,u)&&e.push(Y(s,{binSuffix:"range"})),ln(u)){const v={field:`${g}_end`};o[`${u}2`]=v}y.bin="binned",AE(u)||(y.type=lo)}else if(d&&!uo(d)){i.push({timeUnit:d,field:l,as:g});const v=oe(s)&&s.type!==xs&&"time";v&&(u===pl||u===eo?y.formatType=v:function(x){return tt(zy,x)}(u)?y.legend={formatType:v,...y.legend}:ln(u)&&(y.axis={formatType:v,...y.axis}))}o[u]=y}else e.push(l),o[u]=t[u]}else o[u]=t[u]}),{bins:r,timeUnits:i,aggregate:a,groupby:e,encoding:o}}function vR(t,n,e){const r=xN(n,e);if(!r)return!1;if(r==="binned"){const i=t[n===lr?Jt:bn];return!!(H(i)&&H(t[n])&&$n(i.bin))}return!0}function fh(t,n){const e={};for(const r of q(t)){const i=J3(t[r],r,n,{compositeMark:!0});e[r]=i}return e}function kv(t,n,e){if(t)for(const r of q(t)){const i=t[r];if(P(i))for(const a of i)n.call(e,a,r);else n.call(e,i,r)}}function s$(t,n){return q(n).reduce((e,r)=>{switch(r){case Jt:case bn:case Td:case jd:case Pd:case lr:case jr:case ua:case ys:case Ge:case vi:case cr:case yi:case la:case fr:case dr:case hr:case Ve:case pl:case me:case no:case eo:return e;case vs:if(t==="line"||t==="trail")return e;case ml:case Rd:{const i=n[r];if(P(i)||H(i))for(const a of K(i))a.aggregate||e.push(Y(a,{}));return e}case bi:if(t==="trail")return e;case pe:case Lr:case qr:case xi:case ca:case fa:case ha:case da:{const i=vr(n[r]);return i&&!i.aggregate&&e.push(Y(i,{})),e}}},[])}function Dv(t,n,e,r=!0){if("tooltip"in e)return{tooltip:e.tooltip};const i=t.map(({fieldPrefix:o,titlePrefix:s})=>{const u=r?` of ${Fv(n)}`:"";return{field:o+n.field,type:n.type,title:it(s)?{signal:`${s}"${escape(u)}"`}:s+u}}),a=function(o){const s=[];for(const u of q(o))if(mo(o,u)){const l=o[u],c=K(l);for(const f of c)H(f)?s.push(f):rh(f)&&s.push(f.condition)}return s}(e).map(mR);return{tooltip:[...i,...Pr(a,wt)]}}function Fv(t){const{title:n,field:e}=t;return un(n,e)}function Cv(t,n,e,r,i){const{scale:a,axis:o}=e;return({partName:s,mark:u,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=Fv(e);return u$(t,s,i,{mark:u,encoding:{[n]:{field:`${l}_${e.field}`,type:e.type,...d!==void 0?{title:d}:{},...a!==void 0?{scale:a}:{},...o!==void 0?{axis:o}:{}},...Q(c)?{[`${n}2`]:{field:`${c}_${e.field}`}}:{},...r,...f}})}}function u$(t,n,e,r){const{clip:i,color:a,opacity:o}=t,s=t.type;return t[n]||t[n]===void 0&&e[n]?[{...r,mark:{...e[n],...i?{clip:i}:{},...a?{color:a}:{},...o?{opacity:o}:{},...Vr(r.mark)?r.mark:{type:r.mark},style:`${s}-${String(n)}`,...Fa(t[n])?{}:t[n]}}]:[]}function l$(t,n,e){const{encoding:r}=t,i=n==="vertical"?"y":"x",a=r[i],o=r[`${i}2`],s=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:dh(a,e),continuousAxisChannelDef2:dh(o,e),continuousAxisChannelDefError:dh(s,e),continuousAxisChannelDefError2:dh(u,e),continuousAxis:i}}function dh(t,n){if(t!=null&&t.aggregate){const{aggregate:e,...r}=t;return e!==n&&I(function(i,a){return`Continuous axis should not have customized aggregation function ${i}; ${a} already agregates the axis.`}(e,n)),r}return t}function c$(t,n){const{mark:e,encoding:r}=t,{x:i,y:a}=r;if(Vr(e)&&e.orient)return e.orient;if(ba(i)){if(ba(a)){const o=H(i)&&i.aggregate,s=H(a)&&a.aggregate;if(o||s!==n){if(s||o!==n){if(o===n&&s===n)throw new Error("Both x and y cannot have aggregate");return Cs(a)&&!Cs(i)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(ba(a))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}const hh="boxplot",bR=new ch(hh,d$);function f$(t){return $t(t)?"tukey":t}function d$(t,{config:n}){t={...t,encoding:fh(t.encoding,n)};const{mark:e,encoding:r,params:i,projection:a,...o}=t,s=Vr(e)?e:{type:e};i&&I(HE("boxplot"));const u=s.extent??n.boxplot.extent,l=qt("size",s,n),c=s.invalid,f=f$(u),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:x,ticksOrient:b,boxOrient:w,customTooltipWithoutAggregatedField:A}=function(Je,Se,e6){const Xh=c$(Je,hh),{continuousAxisChannelDef:Hb,continuousAxis:Gb}=l$(Je,Xh,hh),Us=Hb.field,ue=ms(Us),Il=f$(Se),r6=[...h$(Us),{op:"median",field:Us,as:`mid_box_${ue}`},{op:"min",field:Us,as:(Il==="min-max"?"lower_whisker_":"min_")+ue},{op:"max",field:Us,as:(Il==="min-max"?"upper_whisker_":"max_")+ue}],i6=Il==="min-max"||Il==="tukey"?[]:[{calculate:`${Ot(`upper_box_${ue}`)} - ${Ot(`lower_box_${ue}`)}`,as:`iqr_${ue}`},{calculate:`min(${Ot(`upper_box_${ue}`)} + ${Ot(`iqr_${ue}`)} * ${Se}, ${Ot(`max_${ue}`)})`,as:`upper_whisker_${ue}`},{calculate:`max(${Ot(`lower_box_${ue}`)} - ${Ot(`iqr_${ue}`)} * ${Se}, ${Ot(`min_${ue}`)})`,as:`lower_whisker_${ue}`}],{[Gb]:aj,...a6}=Je.encoding,{customTooltipWithoutAggregatedField:o6,filteredEncoding:s6}=function(d6){const{tooltip:ko,...Wl}=d6;if(!ko)return{filteredEncoding:Wl};let Is,ni;if(P(ko)){for(const Jh of ko)Jh.aggregate?(Is||(Is=[]),Is.push(Jh)):(ni||(ni=[]),ni.push(Jh));Is&&(Wl.tooltip=Is)}else ko.aggregate?Wl.tooltip=ko:ni=ko;return P(ni)&&ni.length===1&&(ni=ni[0]),{customTooltipWithoutAggregatedField:ni,filteredEncoding:Wl}}(a6),{bins:Vb,timeUnits:Yb,aggregate:Xb,groupby:Jb,encoding:u6}=o$(s6,e6),l6=Xh==="vertical"?"horizontal":"vertical",c6=Xh,f6=[...Vb,...Yb,{aggregate:[...Xb,...r6],groupby:Jb},...i6];return{bins:Vb,timeUnits:Yb,transform:f6,groupby:Jb,aggregate:Xb,continuousAxisChannelDef:Hb,continuousAxis:Gb,encodingWithoutContinuousAxis:u6,ticksOrient:l6,boxOrient:c6,customTooltipWithoutAggregatedField:o6}}(t,u,n),_=ms(m.field),{color:k,size:F,...C}=x,D=Je=>Cv(s,g,m,Je,n.boxplot),E=D(C),$=D(x),M=(Z(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",S=D({...C,...F?{size:F}:{},color:{condition:{test:`${Ot(`lower_box_${m.field}`)} >= ${Ot(`upper_box_${m.field}`)}`,...k||{value:M}}}}),B=Dv([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],m,x),z={type:"tick",color:"black",opacity:1,orient:b,invalid:c,aria:!1},N=f==="min-max"?B:Dv([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,x),W=[...E({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...E({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...E({partName:"ticks",mark:z,positionPrefix:"lower_whisker",extraEncoding:N}),...E({partName:"ticks",mark:z,positionPrefix:"upper_whisker",extraEncoding:N})],X=[...f!=="tukey"?W:[],...$({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:w,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:B}),...S({partName:"median",mark:{type:"tick",invalid:c,...Z(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...l?{size:l}:{},orient:b,aria:!1},positionPrefix:"mid_box",extraEncoding:B})];if(f==="min-max")return{...o,transform:(o.transform??[]).concat(p),layer:X};const L=Ot(`lower_box_${m.field}`),et=Ot(`upper_box_${m.field}`),ot=`(${et} - ${L})`,nt=`${L} - ${u} * ${ot}`,mt=`${et} + ${u} * ${ot}`,pt=Ot(m.field),J={joinaggregate:h$(m.field),groupby:y},Mt={transform:[{filter:`(${nt} <= ${pt}) && (${pt} <= ${mt})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${_}`},{op:"max",field:m.field,as:`upper_whisker_${_}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${_}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${_}`},...v],groupby:y}],layer:W},{tooltip:Tt,...kt}=C,{scale:Et,axis:tn}=m,nn=Fv(m),It=he(tn,["title"]),be=u$(s,"outliers",n.boxplot,{transform:[{filter:`(${pt} < ${nt}) || (${pt} > ${mt})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...nn!==void 0?{title:nn}:{},...Et!==void 0?{scale:Et}:{},...jt(It)?{}:{axis:It}},...kt,...k?{color:k}:{},...A?{tooltip:A}:{}}})[0];let zn;const ti=[...d,...h,J];return be?zn={transform:ti,layer:[be,Mt]}:(zn=Mt,zn.transform.unshift(...ti)),{...o,layer:[zn,{transform:p,layer:X}]}}function h$(t){const n=ms(t);return[{op:"q1",field:t,as:`lower_box_${n}`},{op:"q3",field:t,as:`upper_box_${n}`}]}const Ev="errorbar",xR=new ch(Ev,p$);function p$(t,{config:n}){t={...t,encoding:fh(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:u,tooltipEncoding:l}=m$(t,Ev,n);delete a.size;const c=Cv(s,i,r,a,n.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:o,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:e,...p.length>1?{layer:p}:{...p[0]}}}function wR(t,n){const{encoding:e}=t;if(function(s){return(ht(s.x)||ht(s.y))&&!ht(s.x2)&&!ht(s.y2)&&!ht(s.xError)&&!ht(s.xError2)&&!ht(s.yError)&&!ht(s.yError2)}(e))return{orient:c$(t,n),inputType:"raw"};const r=function(s){return ht(s.x2)||ht(s.y2)}(e),i=function(s){return ht(s.xError)||ht(s.xError2)||ht(s.yError)||ht(s.yError2)}(e),a=e.x,o=e.y;if(r){if(i)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const s=e.x2,u=e.y2;if(ht(s)&&ht(u))throw new Error(`${n} cannot have both x2 and y2`);if(ht(s)){if(ba(a))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}if(ht(u)){if(ba(o))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}{const s=e.xError,u=e.xError2,l=e.yError,c=e.yError2;if(ht(u)&&!ht(s))throw new Error(`${n} cannot have xError2 without xError`);if(ht(c)&&!ht(l))throw new Error(`${n} cannot have yError2 without yError`);if(ht(s)&&ht(l))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(ht(s)){if(ba(a))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(ht(l)){if(ba(o))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function m$(t,n,e){const{mark:r,encoding:i,params:a,projection:o,...s}=t,u=Vr(r)?r:{type:r};a&&I(HE(n));const{orient:l,inputType:c}=wR(t,n),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=l$(t,l,n),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:x}=function(z,N,W,X,L,et,ot,nt){let mt=[],pt=[];const J=N.field;let Mt,Tt=!1;if(et==="raw"){const kt=z.center?z.center:z.extent?z.extent==="iqr"?"median":"mean":nt.errorbar.center,Et=z.extent?z.extent:kt==="mean"?"stderr":"iqr";if(kt==="median"!=(Et==="iqr")&&I(function(tn,nn,It){return`${tn} is not usually used with ${nn} for ${It}.`}(kt,Et,ot)),Et==="stderr"||Et==="stdev")mt=[{op:Et,field:J,as:`extent_${J}`},{op:kt,field:J,as:`center_${J}`}],pt=[{calculate:`${Ot(`center_${J}`)} + ${Ot(`extent_${J}`)}`,as:`upper_${J}`},{calculate:`${Ot(`center_${J}`)} - ${Ot(`extent_${J}`)}`,as:`lower_${J}`}],Mt=[{fieldPrefix:"center_",titlePrefix:dl(kt)},{fieldPrefix:"upper_",titlePrefix:g$(kt,Et,"+")},{fieldPrefix:"lower_",titlePrefix:g$(kt,Et,"-")}],Tt=!0;else{let tn,nn,It;Et==="ci"?(tn="mean",nn="ci0",It="ci1"):(tn="median",nn="q1",It="q3"),mt=[{op:nn,field:J,as:`lower_${J}`},{op:It,field:J,as:`upper_${J}`},{op:tn,field:J,as:`center_${J}`}],Mt=[{fieldPrefix:"upper_",titlePrefix:Ds({field:J,aggregate:It,type:"quantitative"},nt,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Ds({field:J,aggregate:nn,type:"quantitative"},nt,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Ds({field:J,aggregate:tn,type:"quantitative"},nt,{allowDisabling:!1})}]}}else{(z.center||z.extent)&&I(function(kt,Et){return`${Et?"extent ":""}${Et&&kt?"and ":""}${kt?"center ":""}${Et&&kt?"are ":"is "}not needed when data are aggregated.`}(z.center,z.extent)),et==="aggregated-upper-lower"?(Mt=[],pt=[{calculate:Ot(W.field),as:`upper_${J}`},{calculate:Ot(J),as:`lower_${J}`}]):et==="aggregated-error"&&(Mt=[{fieldPrefix:"",titlePrefix:J}],pt=[{calculate:`${Ot(J)} + ${Ot(X.field)}`,as:`upper_${J}`}],L?pt.push({calculate:`${Ot(J)} + ${Ot(L.field)}`,as:`lower_${J}`}):pt.push({calculate:`${Ot(J)} - ${Ot(X.field)}`,as:`lower_${J}`}));for(const kt of pt)Mt.push({fieldPrefix:kt.as.substring(0,6),titlePrefix:to(to(kt.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:pt,errorBarSpecificAggregate:mt,tooltipSummary:Mt,tooltipTitleWithFieldName:Tt}}(u,f,d,h,p,c,n,e),{[m]:b,[m==="x"?"x2":"y2"]:w,[m==="x"?"xError":"yError"]:A,[m==="x"?"xError2":"yError2"]:_,...k}=i,{bins:F,timeUnits:C,aggregate:D,groupby:E,encoding:$}=o$(k,e),M=[...D,...g],S=c!=="raw"?[]:E,B=Dv(v,f,$,x);return{transform:[...s.transform??[],...F,...C,...M.length===0?[]:[{aggregate:M,groupby:S}],...y],groupby:S,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:$,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:s,tooltipEncoding:B}}function g$(t,n,e){return`${dl(t)} ${e} ${n}`}const $v="errorband",AR=new ch($v,y$);function y$(t,{config:n}){t={...t,encoding:fh(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:u}=m$(t,$v,n),l=o,c=Cv(l,i,r,a,n.errorband),f=t.encoding.x!==void 0&&t.encoding.y!==void 0;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):l.interpolate?I(t3("interpolate")):l.tension&&I(t3("tension")),{...s,transform:e,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const v$={};function Sv(t,n,e){const r=new ch(t,n);v$[t]={normalizer:r,parts:e}}Sv(hh,d$,["box","median","outliers","rule","ticks"]),Sv(Ev,p$,["ticks","rule"]),Sv($v,y$,["band","borders"]);const _R=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],b$={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},x$={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},kR=q(b$),DR=q(x$),w$=q({header:1,headerRow:1,headerColumn:1,headerFacet:1}),A$=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],br="_vgsid_",FR={point:{on:"click",fields:[br],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Mv(t){return t==="legend"||!!(t!=null&&t.legend)}function Bv(t){return Mv(t)&&Z(t)}function zv(t){return!!(t!=null&&t.select)}function _$(t){const n=[];for(const e of t||[]){if(zv(e))continue;const{expr:r,bind:i,...a}=e;if(i&&r){const o={...a,bind:i,init:r};n.push(o)}else{const o={...a,...r?{update:r}:{},...i?{bind:i}:{}};n.push(o)}}return n}function Ov(t){return U(t,"concat")}function ph(t){return U(t,"vconcat")}function Nv(t){return U(t,"hconcat")}function k$({step:t,offsetIsDiscrete:n}){return n?t.for??"offset":"position"}function Xr(t){return U(t,"step")}function D$(t){return U(t,"view")||U(t,"width")||U(t,"height")}const CR=q({align:1,bounds:1,center:1,columns:1,spacing:1});function Rv(t,n){return t[n]??t[n==="width"?"continuousWidth":"continuousHeight"]}function Tv(t,n){const e=mh(t,n);return Xr(e)?e.step:F$}function mh(t,n){return un(t[n]??t[n==="width"?"discreteWidth":"discreteHeight"],{step:t.step})}const F$=20,ER={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:F$},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:fR,circle:{},geoshape:{},image:{},line:{},point:{},rect:hv,rule:{color:"black"},square:{},text:{color:"black"},tick:dR,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:FR,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Fi=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],C$={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},E$={blue:Fi[0],orange:Fi[1],red:Fi[2],teal:Fi[3],green:Fi[4],yellow:Fi[5],purple:Fi[6],pink:Fi[7],brown:Fi[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function $$(t){const n=q(t||{}),e={};for(const r of n){const i=t[r];e[r]=Fl(i)?BE(i):Ee(i)}return e}const $R=[...E3,...e$,...w$,"background","padding","legend","lineBreak","scale","style","title","view"];function S$(t={}){const{color:n,font:e,fontSize:r,selection:i,...a}=t,o=Yl({},ft(ER),e?function(u){return{text:{font:u},style:{"guide-label":{font:u},"guide-title":{font:u},"group-title":{font:u},"group-subtitle":{font:u}}}}(e):{},n?function(u={}){return{signals:[{name:"color",value:Z(u)?{...E$,...u}:E$}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(n):{},r?function(u){return{signals:[{name:"fontSize",value:Z(u)?{...C$,...u}:C$}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(r):{},a||{});i&&lp(o,"selection",i,!0);const s=he(o,$R);for(const u of["background","lineBreak","padding"])o[u]&&(s[u]=Ee(o[u]));for(const u of E3)o[u]&&(s[u]=Sn(o[u]));for(const u of e$)o[u]&&(s[u]=$$(o[u]));for(const u of w$)o[u]&&(s[u]=Sn(o[u]));if(o.legend&&(s.legend=Sn(o.legend)),o.scale){const{invalid:u,...l}=o.scale,c=Sn(u,{level:1});s.scale={...Sn(l),...q(c).length>0?{invalid:c}:{}}}return o.style&&(s.style=function(u){const l=q(u),c={};for(const f of l)c[f]=$$(u[f]);return c}(o.style)),o.title&&(s.title=Sn(o.title)),o.view&&(s.view=Sn(o.view)),s}const SR=new Set(["view",...sR]),MR=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],BR={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...lR};function zR(t){t=ft(t);for(const n of MR)delete t[n];if(t.axis)for(const n in t.axis)Fl(t.axis[n])&&delete t.axis[n];if(t.legend)for(const n of _R)delete t.legend[n];if(t.mark){for(const n of C3)delete t.mark[n];t.mark.tooltip&&Z(t.mark.tooltip)&&delete t.mark.tooltip}t.params&&(t.signals=(t.signals||[]).concat(_$(t.params)),delete t.params);for(const n of SR){for(const r of C3)delete t[n][r];const e=BR[n];if(e)for(const r of e)delete t[n][r];OR(t,n)}for(const n of q(v$))delete t[n];(function(n){const{titleMarkConfig:e,subtitleMarkConfig:r,subtitle:i}=ME(n.title);jt(e)||(n.style["group-title"]={...n.style["group-title"],...e}),jt(r)||(n.style["group-subtitle"]={...n.style["group-subtitle"],...r}),jt(i)?delete n.title:n.title=i})(t);for(const n in t)Z(t[n])&&jt(t[n])&&delete t[n];return jt(t)?void 0:t}function OR(t,n,e,r){n==="view"&&(e="cell");const i={...t[n],...t.style[e??n]};jt(i)||(t.style[e??n]=i),delete t[n]}function gh(t){return U(t,"layer")}class Pv{map(n,e){return eh(n)?this.mapFacet(n,e):function(r){return U(r,"repeat")}(n)?this.mapRepeat(n,e):Nv(n)?this.mapHConcat(n,e):ph(n)?this.mapVConcat(n,e):Ov(n)?this.mapConcat(n,e):this.mapLayerOrUnit(n,e)}mapLayerOrUnit(n,e){if(gh(n))return this.mapLayer(n,e);if(Di(n))return this.mapUnit(n,e);throw new Error(qy(n))}mapLayer(n,e){return{...n,layer:n.layer.map(r=>this.mapLayerOrUnit(r,e))}}mapHConcat(n,e){return{...n,hconcat:n.hconcat.map(r=>this.map(r,e))}}mapVConcat(n,e){return{...n,vconcat:n.vconcat.map(r=>this.map(r,e))}}mapConcat(n,e){const{concat:r,...i}=n;return{...i,concat:r.map(a=>this.map(a,e))}}mapFacet(n,e){return{...n,spec:this.map(n.spec,e)}}mapRepeat(n,e){return{...n,spec:this.map(n.spec,e)}}}const NR={zero:1,center:1,normalize:1},RR=new Set([k3,Jd,Xd,Zd,Qd,cv,fv,Kd,D3,lv]),TR=new Set([Jd,Xd,k3]);function Es(t){return H(t)&&_s(t)==="quantitative"&&!t.bin}function M$(t,n,{orient:e,type:r}){const i=n==="x"?"y":"radius",a=n==="x"&&["bar","area"].includes(r),o=t[n],s=t[i];if(H(o)&&H(s))if(Es(o)&&Es(s)){if(o.stack)return n;if(s.stack)return i;const u=H(o)&&!!o.aggregate;if(u!==(H(s)&&!!s.aggregate))return u?n:i;if(a){if(e==="vertical")return i;if(e==="horizontal")return n}}else{if(Es(o))return n;if(Es(s))return i}else{if(Es(o))return a&&e==="vertical"?void 0:n;if(Es(s))return a&&e==="horizontal"?void 0:i}}function B$(t,n){var g,y;const e=Vr(t)?t:{type:t},r=e.type;if(!RR.has(r))return null;const i=M$(n,"x",e)||M$(n,"theta",e);if(!i)return null;const a=n[i],o=H(a)?Y(a,{}):void 0,s=function(v){switch(v){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(i),u=[],l=new Set;if(n[s]){const v=n[s],x=H(v)?Y(v,{}):void 0;x&&x!==o&&(u.push(s),l.add(x))}const c=s==="x"?"xOffset":"yOffset",f=n[c],d=H(f)?Y(f,{}):void 0;d&&d!==o&&(u.push(c),l.add(d));const h=yN.reduce((v,x)=>{if(x!=="tooltip"&&mo(n,x)){const b=n[x];for(const w of K(b)){const A=vr(w);if(A.aggregate)continue;const _=Y(A,{});_&&l.has(_)||v.push({channel:x,fieldDef:A})}}return v},[]);let p;return a.stack!==void 0?p=Fa(a.stack)?a.stack?"zero":null:a.stack:TR.has(r)&&(p="zero"),p&&tt(NR,p)?a$(n)&&h.length===0?null:((g=a==null?void 0:a.scale)!=null&&g.type&&((y=a==null?void 0:a.scale)==null?void 0:y.type)!==m3&&(a!=null&&a.stack)&&I(function(v){return`Stack is applied to a non-linear scale (${v}).`}(a.scale.type)),ht(n[Ur(i)])?(a.stack!==void 0&&I(`Cannot stack "${m=i}" if there is already "${m}2".`),null):(H(a)&&a.aggregate&&!DN.has(a.aggregate)&&I(`Stacking is applied even though the aggregate function is non-summative ("${a.aggregate}").`),{groupbyChannels:u,groupbyFields:l,fieldChannel:i,impute:a.impute!==null&&ya(r),stackBy:h,offset:p})):null;var m}function z$(t,n,e){const r=Sn(t),i=qt("orient",r,e);if(r.orient=function(s,u,l){switch(s){case Qd:case cv:case fv:case D3:case aR:case iR:return}const{x:c,y:f,x2:d,y2:h}=u;switch(s){case Jd:if(H(c)&&($n(c.bin)||H(f)&&f.aggregate&&!c.aggregate))return"vertical";if(H(f)&&($n(f.bin)||H(c)&&c.aggregate&&!f.aggregate))return"horizontal";if(h||d){if(l)return l;if(!d)return(H(c)&&c.type===lo&&!Wt(c.bin)||ih(c))&&H(f)&&$n(f.bin)?"horizontal":"vertical";if(!h)return(H(f)&&f.type===lo&&!Wt(f.bin)||ih(f))&&H(c)&&$n(c.bin)?"vertical":"horizontal"}case Zd:if(d&&(!H(c)||!$n(c.bin))&&h&&(!H(f)||!$n(f.bin)))return;case Xd:if(h)return H(f)&&$n(f.bin)?"horizontal":"vertical";if(d)return H(c)&&$n(c.bin)?"vertical":"horizontal";if(s===Zd){if(c&&!f)return"vertical";if(f&&!c)return"horizontal"}case Kd:case lv:{const p=W3(c),m=W3(f);if(l)return l;if(p&&!m)return s!=="tick"?"horizontal":"vertical";if(!p&&m)return s!=="tick"?"vertical":"horizontal";if(p&&m)return"vertical";{const g=oe(c)&&c.type===xs,y=oe(f)&&f.type===xs;if(g&&!y)return"vertical";if(!g&&y)return"horizontal"}return}}return"vertical"}(r.type,n,i),i!==void 0&&i!==r.orient&&I(`Specified orient "${r.orient}" overridden with "${i}".`),r.type==="bar"&&r.orient){const s=qt("cornerRadiusEnd",r,e);if(s!==void 0){const u=r.orient==="horizontal"&&n.x2||r.orient==="vertical"&&n.y2?["cornerRadius"]:cR[r.orient];for(const l of u)r[l]=s;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}const a=qt("opacity",r,e),o=qt("fillOpacity",r,e);return a===void 0&&o===void 0&&(r.opacity=function(s,u){if(vt([Qd,lv,cv,fv],s)&&!a$(u))return .7}(r.type,n)),qt("cursor",r,e)===void 0&&(r.cursor=function(s,u,l){return u.href||s.href||qt("href",s,l)?"pointer":s.cursor}(r,n,e)),r}function PR(t){const{point:n,line:e,...r}=t;return q(r).length>1?r:r.type}function jR(t){for(const n of["line","area","rule","trail"])t[n]&&(t={...t,[n]:he(t[n],["point","line"])});return t}function jv(t,n={},e){return t.point==="transparent"?{opacity:0}:t.point?Z(t.point)?t.point:{}:t.point!==void 0?null:n.point||e.shape?Z(n.point)?n.point:{}:void 0}function O$(t,n={}){return t.line?t.line===!0?{}:t.line:t.line!==void 0?null:n.line?n.line===!0?{}:n.line:void 0}class LR{constructor(){this.name="path-overlay"}hasMatchingType(n,e){if(Di(n)){const{mark:r,encoding:i}=n,a=Vr(r)?r:{type:r};switch(a.type){case"line":case"rule":case"trail":return!!jv(a,e[a.type],i);case"area":return!!jv(a,e[a.type],i)||!!O$(a,e[a.type])}}return!1}run(n,e,r){const{config:i}=e,{params:a,projection:o,mark:s,name:u,encoding:l,...c}=n,f=fh(l,i),d=Vr(s)?s:{type:s},h=jv(d,i[d.type],f),p=d.type==="area"&&O$(d,i[d.type]),m=[{name:u,...a?{params:a}:{},mark:PR({...d.type==="area"&&d.opacity===void 0&&d.fillOpacity===void 0?{opacity:.7}:{},...d}),encoding:he(f,["shape"])}],g=B$(z$(d,f,i),f);let y=f;if(g){const{fieldChannel:v,offset:x}=g;y={...f,[v]:{...f[v],...x?{stack:x}:{}}}}return y=he(y,["y2","x2"]),p&&m.push({...o?{projection:o}:{},mark:{type:"line",...hs(d,["clip","interpolate","tension","tooltip"]),...p},encoding:y}),h&&m.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...hs(d,["clip","tooltip"]),...h},encoding:y}),r({...c,layer:m},{...e,config:jR(i)})}}function qR(t,n){return n?Al(t)?P$(t,n):N$(t,n):t}function Lv(t,n){return n?P$(t,n):t}function qv(t,n,e){const r=n[t];return function(i){return!Q(i)&&U(i,"repeat")}(r)?r.repeat in e?{...n,[t]:e[r.repeat]}:void I(function(i){return`Unknown repeated value "${i}".`}(r.repeat)):n}function N$(t,n){if((t=qv("field",t,n))!==void 0){if(t===null)return null;if(xv(t)&&ki(t.sort)){const e=qv("field",t.sort,n);t={...t,...e?{sort:e}:{}}}return t}}function R$(t,n){if(H(t))return N$(t,n);{const e=qv("datum",t,n);return e===t||e.type||(e.type="nominal"),e}}function T$(t,n){if(!ht(t)){if(kl(t)){const e=R$(t.condition,n);if(e)return{...t,condition:e};{const{condition:r,...i}=t;return i}}return t}{const e=R$(t,n);if(e)return e;if(_l(t))return{condition:t.condition}}}function P$(t,n){const e={};for(const r in t)if(U(t,r)){const i=t[r];if(P(i))e[r]=i.map(a=>T$(a,n)).filter(a=>a);else{const a=T$(i,n);a!==void 0&&(e[r]=a)}}return e}class UR{constructor(){this.name="RuleForRangedLine"}hasMatchingType(n){if(Di(n)){const{encoding:e,mark:r}=n;if(r==="line"||Vr(r)&&r.type==="line")for(const i of pN){const a=e[ro(i)];if(e[i]&&(H(a)&&!$n(a.bin)||Yr(a)))return!0}}return!1}run(n,e,r){const{encoding:i,mark:a}=n;var o,s;return I((o=!!i.x2,s=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&s?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),r({...n,mark:Z(a)?{...a,type:"rule"}:"rule"},e)}}function j$({parentEncoding:t,encoding:n={},layer:e}){let r={};if(t){const i=new Set([...q(t),...q(n)]);for(const a of i){const o=n[a],s=t[a];if(ht(o)){const u={...s,...o};r[a]=u}else kl(o)?r[a]={...o,condition:{...s,...o.condition}}:o||o===null?r[a]=o:(e||yr(s)||it(s)||ht(s)||P(s))&&(r[a]=s)}}else r=n;return!r||jt(r)?void 0:r}function L$(t){const{parentProjection:n,projection:e}=t;return n&&e&&I(function(r){const{parentProjection:i,projection:a}=r;return`Layer's shared projection ${Lt(i)} is overridden by a child projection ${Lt(a)}.`}({parentProjection:n,projection:e})),e??n}function Uv(t){return U(t,"filter")}function q$(t){return U(t,"lookup")}function IR(t){return U(t,"pivot")}function WR(t){return U(t,"density")}function HR(t){return U(t,"quantile")}function GR(t){return U(t,"regression")}function VR(t){return U(t,"loess")}function YR(t){return U(t,"sample")}function XR(t){return U(t,"window")}function JR(t){return U(t,"joinaggregate")}function KR(t){return U(t,"flatten")}function QR(t){return U(t,"calculate")}function U$(t){return U(t,"bin")}function ZR(t){return U(t,"impute")}function tT(t){return U(t,"timeUnit")}function nT(t){return U(t,"aggregate")}function eT(t){return U(t,"stack")}function rT(t){return U(t,"fold")}function iT(t){return U(t,"extent")&&!U(t,"density")&&!U(t,"regression")}function I$(t,n){const{transform:e,...r}=t;if(e){const i=e.map(a=>{if(Uv(a))return{filter:Iv(a,n)};if(U$(a)&&io(a.bin))return{...a,bin:H$(a.bin)};if(q$(a)){const{selection:o,...s}=a.from;return o?{...a,from:{param:o,...s}}:a}return a});return{...r,transform:i}}return t}function W$(t,n){var r,i;const e=ft(t);if(H(e)&&io(e.bin)&&(e.bin=H$(e.bin)),po(e)&&((i=(r=e.scale)==null?void 0:r.domain)==null?void 0:i.selection)){const{selection:a,...o}=e.scale.domain;e.scale.domain={...o,...a?{param:a}:{}}}if(_l(e))if(P(e.condition))e.condition=e.condition.map(a=>{const{selection:o,param:s,test:u,...l}=a;return s?a:{...l,test:Iv(a,n)}});else{const{selection:a,param:o,test:s,...u}=W$(e.condition,n);e.condition=o?e.condition:{...u,test:Iv(e.condition,n)}}return e}function H$(t){const n=t.extent;if(n!=null&&n.selection){const{selection:e,...r}=n;return{...t,extent:{...r,param:e}}}return t}function Iv(t,n){const e=r=>ds(r,i=>{var a;const o={param:i,empty:n.emptySelections[i]??!0};return(a=n.selectionPredicates)[i]??(a[i]=[]),n.selectionPredicates[i].push(o),o});return t.selection?e(t.selection):ds(t.test||t.filter,r=>r.selection?e(r.selection):r)}class Wv extends Pv{map(n,e){const r=e.selections??[];if(n.params&&!Di(n)){const i=[];for(const a of n.params)zv(a)?r.push(a):i.push(a);n.params=i}return e.selections=r,super.map(n,e)}mapUnit(n,e){const r=e.selections;if(!r||!r.length)return n;const i=(e.path??[]).concat(n.name),a=[];for(const o of r)if(o.views&&o.views.length)for(const s of o.views)(Q(s)&&(s===n.name||i.includes(s))||P(s)&&s.map(u=>i.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&a.push(o);else a.push(o);return a.length&&(n.params=a),n}}for(const t of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=Wv.prototype[t];Wv.prototype[t]=function(e,r){return n.call(this,e,aT(e,r))}}function aT(t,n){return t.name?{...n,path:(n.path??[]).concat(t.name)}:n}function G$(t,n){n===void 0&&(n=S$(t.config));const e=function(o,s={}){const u={config:s};return uT.map(oT.map(sT.map(o,u),u),u)}(t,n),{width:r,height:i}=t,a=function(o,s,u){let{width:l,height:c}=s;const f=Di(o)||gh(o),d={};f?l=="container"&&c=="container"?(d.type="fit",d.contains="padding"):l=="container"?(d.type="fit-x",d.contains="padding"):c=="container"&&(d.type="fit-y",d.contains="padding"):(l=="container"&&(I(qE("width")),l=void 0),c=="container"&&(I(qE("height")),c=void 0));const h={type:"pad",...d,...u?V$(u.autosize):{},...V$(o.autosize)};if(h.type!=="fit"||f||(I(MN),h.type="pad"),l=="container"&&h.type!="fit"&&h.type!="fit-x"&&I(UE("width")),c=="container"&&h.type!="fit"&&h.type!="fit-y"&&I(UE("height")),!Ce(h,{type:"pad"}))return h}(e,{width:r,height:i,autosize:t.autosize},n);return{...e,...a?{autosize:a}:{}}}const oT=new class extends Pv{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[bR,xR,AR,new LR,new UR]}map(t,n){if(Di(t)){const e=mo(t.encoding,mi),r=mo(t.encoding,gi),i=mo(t.encoding,Nd);if(e||r||i)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:e,parentProjection:r}=n,i=Lv(t.encoding,n.repeater),a={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter(s=>s).join("_")}:{},...i?{encoding:i}:{}};if(e||r)return this.mapUnitWithParentEncodingOrProjection(a,n);const o=this.mapLayerOrUnit.bind(this);for(const s of this.nonFacetUnitNormalizers)if(s.hasMatchingType(a,n.config))return s.run(a,n,o);return a}mapRepeat(t,n){return function(e){return!P(e.repeat)&&U(e.repeat,"layer")}(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:e,spec:r,...i}=t,{row:a,column:o,layer:s}=e,{repeater:u={},repeaterPrefix:l=""}=n;return a||o?this.mapRepeat({...t,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:r}},n):{...i,layer:s.map(c=>{const f={...u,layer:c},d=`${(r.name?`${r.name}_`:"")+l}child__layer_${Xt(c)}`,h=this.mapLayerOrUnit(r,{...n,repeater:f,repeaterPrefix:d});return h.name=d,h})}}mapNonLayerRepeat(t,n){const{repeat:e,spec:r,data:i,...a}=t;!P(e)&&t.columns&&(t=he(t,["columns"]),I(GE("repeat")));const o=[],{repeater:s={},repeaterPrefix:u=""}=n,l=!P(e)&&e.row||[s?s.row:null],c=!P(e)&&e.column||[s?s.column:null],f=P(e)&&e||[s?s.repeat:null];for(const h of f)for(const p of l)for(const m of c){const g={repeat:h,row:p,column:m,layer:s.layer},y=(r.name?`${r.name}_`:"")+u+"child__"+(P(e)?`${Xt(h)}`:(e.row?`row_${Xt(p)}`:"")+(e.column?`column_${Xt(m)}`:"")),v=this.map(r,{...n,repeater:g,repeaterPrefix:y});v.name=y,o.push(he(v,["data"]))}const d=P(e)?t.columns:e.column?e.column.length:1;return{data:r.data??i,align:"all",...a,columns:d,concat:o}}mapFacet(t,n){const{facet:e}=t;return Al(e)&&t.columns&&(t=he(t,["columns"]),I(GE("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:e,projection:r}=t,{parentEncoding:i,parentProjection:a,config:o}=n,s=L$({parentProjection:a,projection:r}),u=j$({parentEncoding:i,encoding:Lv(e,n.repeater)});return this.mapUnit({...t,...s?{projection:s}:{},...u?{encoding:u}:{}},{config:o})}mapFacetedUnit(t,n){const{row:e,column:r,facet:i,...a}=t.encoding,{mark:o,width:s,projection:u,height:l,view:c,params:f,encoding:d,...h}=t,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:e,column:r,facet:i},n),g=Lv(a,n.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...l?{height:l}:{},...c?{view:c}:{},...u?{projection:u}:{},mark:o,encoding:g,...f?{params:f}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:e,column:r,facet:i}=t;if(e||r){i&&I(`Facet encoding dropped as ${(a=[...e?[mi]:[],...r?[gi]:[]]).join(" and ")} ${a.length>1?"are":"is"} also specified.`);const o={},s={};for(const u of[mi,gi]){const l=t[u];if(l){const{align:c,center:f,spacing:d,columns:h,...p}=l;o[u]=p;for(const m of["align","center","spacing"])l[m]!==void 0&&(s[m]??(s[m]={}),s[m][u]=l[m])}}return{facetMapping:o,layout:s}}{const{align:o,center:s,spacing:u,columns:l,...c}=i;return{facetMapping:qR(c,n.repeater),layout:{...o?{align:o}:{},...s?{center:s}:{},...u?{spacing:u}:{},...l?{columns:l}:{}}}}var a}mapLayer(t,{parentEncoding:n,parentProjection:e,...r}){const{encoding:i,projection:a,...o}=t,s={...r,parentEncoding:j$({parentEncoding:n,encoding:i,layer:!0}),parentProjection:L$({parentProjection:e,projection:a})};return super.mapLayer({...o,...t.name?{name:[s.repeaterPrefix,t.name].filter(u=>u).join("_")}:{}},s)}},sT=new class extends Pv{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=I$(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if((t=I$(t,n)).encoding){const e={};for(const[r,i]of sa(t.encoding))e[r]=W$(i,n);t={...t,encoding:e}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:e,...r}=t;return e?{...r,params:sa(e).map(([i,a])=>{const{init:o,bind:s,empty:u,...l}=a;l.type==="single"?(l.type="point",l.toggle=!1):l.type==="multi"&&(l.type="point"),n.emptySelections[i]=u!=="none";for(const c of En(n.selectionPredicates[i]??{}))c.empty=u!=="none";return{name:i,value:o,select:l,bind:s}})}:t}},uT=new Wv;function V$(t){return Q(t)?{type:t}:t??{}}const lT=["background","padding"];function Y$(t,n){const e={};for(const r of lT)t&&t[r]!==void 0&&(e[r]=Ee(t[r]));return n&&(e.params=t.params),e}class Bi{constructor(n={},e={}){this.explicit=n,this.implicit=e}clone(){return new Bi(ft(this.explicit),ft(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(n){return un(this.explicit[n],this.implicit[n])}getWithExplicit(n){return this.explicit[n]!==void 0?{explicit:!0,value:this.explicit[n]}:this.implicit[n]!==void 0?{explicit:!1,value:this.implicit[n]}:{explicit:!1,value:void 0}}setWithExplicit(n,{value:e,explicit:r}){e!==void 0&&this.set(n,e,r)}set(n,e,r){return delete this[r?"implicit":"explicit"][n],this[r?"explicit":"implicit"][n]=e,this}copyKeyFromSplit(n,{explicit:e,implicit:r}){e[n]!==void 0?this.set(n,e[n],!0):r[n]!==void 0&&this.set(n,r[n],!1)}copyKeyFromObject(n,e){e[n]!==void 0&&this.set(n,e[n],!0)}copyAll(n){for(const e of q(n.combine())){const r=n.getWithExplicit(e);this.setWithExplicit(e,r)}}}function Jr(t){return{explicit:!0,value:t}}function xr(t){return{explicit:!1,value:t}}function X$(t){return(n,e,r,i)=>{const a=t(n.value,e.value);return a>0?n:a<0?e:yh(n,e,r,i)}}function yh(t,n,e,r){return t.explicit&&n.explicit&&I(function(i,a,o,s){return`Conflicting ${a.toString()} property "${i.toString()}" (${Lt(o)} and ${Lt(s)}). Using ${Lt(o)}.`}(e,r,t.value,n.value)),t}function xa(t,n,e,r,i=yh){return t===void 0||t.value===void 0?n:t.explicit&&!n.explicit?t:n.explicit&&!t.explicit?n:Ce(t.value,n.value)?t:i(t,n,e,r)}class cT extends Bi{constructor(n={},e={},r=!1){super(n,e),this.explicit=n,this.implicit=e,this.parseNothing=r}clone(){const n=super.clone();return n.parseNothing=this.parseNothing,n}}function $s(t){return U(t,"url")}function Cl(t){return U(t,"values")}function J$(t){return U(t,"name")&&!$s(t)&&!Cl(t)&&!wa(t)}function wa(t){return t&&(K$(t)||Q$(t)||Hv(t))}function K$(t){return U(t,"sequence")}function Q$(t){return U(t,"sphere")}function Hv(t){return U(t,"graticule")}var Qt;function Z$({invalid:t,isPath:n}){switch($3(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}(function(t){t[t.Raw=0]="Raw",t[t.Main=1]="Main",t[t.Row=2]="Row",t[t.Column=3]="Column",t[t.Lookup=4]="Lookup",t[t.PreFilterInvalid=5]="PreFilterInvalid",t[t.PostFilterInvalid=6]="PostFilterInvalid"})(Qt||(Qt={}));class Nt{constructor(n,e){this.debugName=e,this._children=[],this._parent=null,n&&(this.parent=n)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(n){this._parent=n,n&&n.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(n,e){this._children.includes(n)?I("Attempt to add the same child twice."):e!==void 0?this._children.splice(e,0,n):this._children.push(n)}removeChild(n){const e=this._children.indexOf(n);return this._children.splice(e,1),e}remove(){let n=this._parent.removeChild(this);for(const e of this._children)e._parent=this._parent,this._parent.addChild(e,n++)}insertAsParentOf(n){const e=n.parent;e.removeChild(this),this.parent=e,n.parent=this}swapWithParent(){const n=this._parent,e=n.parent;for(const i of this._children)i.parent=n;this._children=[],n.removeChild(this);const r=n.parent.removeChild(n);this._parent=e,e.addChild(this,r),n.parent=this}}class ye extends Nt{clone(){const n=new this.constructor;return n.debugName=`clone_${this.debugName}`,n._source=this._source,n._name=`clone_${this._name}`,n.type=this.type,n.refCounts=this.refCounts,n.refCounts[n._name]=0,n}constructor(n,e,r,i){super(n,e),this.type=r,this.refCounts=i,this._source=this._name=e,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${dE()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(n){this._source=n}}function Gv(t){return t.as!==void 0}function t5(t){return`${t}_end`}class Qr extends Nt{clone(){return new Qr(null,ft(this.timeUnits))}constructor(n,e){super(n),this.timeUnits=e}static makeFromEncoding(n,e){const r=e.reduceFieldDef((i,a,o)=>{const{field:s,timeUnit:u}=a;if(u){let l;if(uo(u)){if(Zt(e)){const{mark:c,markDef:f,config:d}=e,h=va({fieldDef:a,markDef:f,config:d});(bl(c)||h)&&(l={timeUnit:xn(u),field:s})}}else l={as:Y(a,{forAs:!0}),field:s,timeUnit:u};if(Zt(e)){const{mark:c,markDef:f,config:d}=e,h=va({fieldDef:a,markDef:f,config:d});bl(c)&&ln(o)&&h!==.5&&(l.rectBandPosition=h)}l&&(i[wt(l)]=l)}return i},{});return jt(r)?null:new Qr(n,r)}static makeFromTransform(n,e){const{timeUnit:r,...i}={...e},a={...i,timeUnit:xn(r)};return new Qr(n,{[wt(a)]:a})}merge(n){this.timeUnits={...this.timeUnits};for(const e in n.timeUnits)this.timeUnits[e]||(this.timeUnits[e]=n.timeUnits[e]);for(const e of n.children)n.removeChild(e),e.parent=this;n.remove()}removeFormulas(n){const e={};for(const[r,i]of sa(this.timeUnits)){const a=Gv(i)?i.as:`${i.field}_end`;n.has(a)||(e[r]=i)}this.timeUnits=e}producedFields(){return new Set(En(this.timeUnits).map(n=>Gv(n)?n.as:t5(n.field)))}dependentFields(){return new Set(En(this.timeUnits).map(n=>n.field))}hash(){return`TimeUnit ${wt(this.timeUnits)}`}assemble(){const n=[];for(const e of En(this.timeUnits)){const{rectBandPosition:r}=e,i=xn(e.timeUnit);if(Gv(e)){const{field:a,as:o}=e,{unit:s,utc:u,...l}=i,c=[o,`${o}_end`];n.push({field:He(a),type:"timeunit",...s?{units:Gd(s)}:{},...u?{timezone:"utc"}:{},...l,as:c}),n.push(...e5(c,r,i))}else if(e){const{field:a}=e,o=a.replaceAll("\\.","."),s=n5({timeUnit:i,field:o}),u=t5(o);n.push({type:"formula",expr:s,as:u}),n.push(...e5([o,u],r,i))}}return n}}const vh="offsetted_rect_start",bh="offsetted_rect_end";function n5({timeUnit:t,field:n,reverse:e}){const{unit:r,utc:i}=t,a=s3(r),{part:o,step:s}=f3(a,t.step);return`${i?"utcOffset":"timeOffset"}('${o}', ${Ot(n)}, ${e?-s:s})`}function e5([t,n],e,r){if(e!==void 0&&e!==.5){const i=Ot(t),a=Ot(n);return[{type:"formula",expr:r5([n5({timeUnit:r,field:t,reverse:!0}),i],e+.5),as:`${t}_${vh}`},{type:"formula",expr:r5([i,a],e+.5),as:`${t}_${bh}`}]}return[]}function r5([t,n],e){return`${1-e} * ${t} + ${e} * ${n}`}const El="_tuple_fields";class fT{constructor(...n){this.items=n,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const dT={defined:()=>!0,parse:(t,n,e)=>{const r=n.name,i=n.project??(n.project=new fT),a={},o={},s=new Set,u=(p,m)=>{const g=m==="visual"?p.channel:p.field;let y=Xt(`${r}_${g}`);for(let v=1;s.has(y);v++)y=Xt(`${r}_${g}_${v}`);return s.add(y),{[m]:y}},l=n.type,c=t.config.selection[l],f=e.value!==void 0?K(e.value):null;let{fields:d,encodings:h}=Z(e.select)?e.select:{};if(!d&&!h&&f){for(const p of f)if(Z(p))for(const m of q(p))hN(m)?(h||(h=[])).push(m):l==="interval"?(I('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(m)}d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const p of h??[]){const m=t.fieldDef(p);if(m){let g=m.field;if(m.aggregate){I(BN(p,m.aggregate));continue}if(!g){I(WE(p));continue}if(m.timeUnit&&!uo(m.timeUnit)){g=t.vgField(p);const y={timeUnit:m.timeUnit,as:g,field:m.field};o[wt(y)]=y}if(!a[g]){const y={field:g,channel:p,type:l==="interval"&&Ir(p)&&mr(t.getScaleComponent(p).get("type"))?"R":m.bin?"R-RE":"E",index:i.items.length};y.signals={...u(y,"data"),...u(y,"visual")},i.items.push(a[g]=y),i.hasField[g]=a[g],i.hasSelectionId=i.hasSelectionId||g===br,bE(p)?(y.geoChannel=p,y.channel=vE(p),i.hasChannel[y.channel]=a[g]):i.hasChannel[p]=a[g]}}else I(WE(p))}for(const p of d??[]){if(i.hasField[p])continue;const m={type:"E",field:p,index:i.items.length};m.signals={...u(m,"data")},i.items.push(m),i.hasField[p]=m,i.hasSelectionId=i.hasSelectionId||p===br}f&&(n.init=f.map(p=>i.items.map(m=>Z(p)?p[m.geoChannel||m.channel]!==void 0?p[m.geoChannel||m.channel]:p[m.field]:p))),jt(o)||(i.timeUnit=new Qr(null,o))},signals:(t,n,e)=>{const r=n.name+El;return e.filter(i=>i.name===r).length>0||n.project.hasSelectionId?e:e.concat({name:r,value:n.project.items.map(s5)})}},i5="_curr",xh="anim_value",Ss="anim_clock",Vv="eased_anim_clock",a5="min_extent",o5="max_range_extent",Yv="last_tick_at",Xv="is_playing",hT=1/60*1e3,pT={defined:t=>t.type==="point",topLevelSignals:(t,n,e)=>(Kr(n)&&(e=e.concat([{name:Ss,init:"0",on:[{events:{type:"timer",throttle:hT},update:`${Xv} ? (${Ss} + (now() - ${Yv}) > ${o5} ? 0 : ${Ss} + (now() - ${Yv})) : ${Ss}`}]},{name:Yv,init:"now()",on:[{events:[{signal:Ss},{signal:Xv}],update:"now()"}]},{name:Xv,init:"true"}])),e),signals:(t,n,e)=>{const r=n.name,i=r+El,a=n.project,o="(item().isVoronoi ? datum.datum : datum)",s=En(t.component.selection??{}).reduce((d,h)=>h.type==="interval"?d.concat(h.name+Ms):d,[]).map(d=>`indexof(item().mark.name, '${d}') < 0`).join(" && "),u="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let l=`unit: ${vo(t)}, `;if(n.project.hasSelectionId?l+=`${br}: ${o}[${G(br)}]`:Kr(n)?l+=`fields: ${i}, values: [${xh} ? ${xh} : ${a5}]`:l+=`fields: ${i}, values: [${a.items.map(d=>{const h=t.fieldDef(d.channel);return h!=null&&h.bin?`[${o}[${G(t.vgField(d.channel,{}))}], ${o}[${G(t.vgField(d.channel,{binSuffix:"end"}))}]]`:`${o}[${G(d.field)}]`}).join(", ")}]`,Kr(n))return e.concat((c=n.name,f=t.scaleName(la),[{name:Vv,update:Ss},{name:`${c}_domain`,init:`domain('${f}')`},{name:a5,init:`extent(${c}_domain)[0]`},{name:o5,init:`extent(range('${f}'))[1]`},{name:xh,update:`invert('${f}', ${Vv})`}]),[{name:r+$i,on:[{events:[{signal:Vv},{signal:xh}],update:`{${l}}`,force:!0}]}]);{const d=n.events;return e.concat([{name:r+$i,on:d?[{events:d,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}var c,f}};function s5(t){const{signals:n,hasLegend:e,index:r,...i}=t;return i.field=He(i.field),i}function go(t,n=!0,e=Me){if(P(t)){const r=t.map(i=>go(i,n,e));return n?`[${r.join(", ")}]`:r}return oo(t)?e(n?so(t):function(r){const i=Vy(r,!0);return r.utc?+new Date(Date.UTC(...i)):+new Date(...i)}(t)):n?e(Lt(t)):t}function mT(t,n){for(const e of En(t.component.selection??{})){const r=e.name;let i=`${r}${$i}, ${e.resolve==="global"?"true":`{unit: ${vo(t)}}`}`;for(const a of Dh)a.defined(e)&&(a.signals&&(n=a.signals(t,e,n)),a.modifyExpr&&(i=a.modifyExpr(t,e,i)));n.push({name:r+ST,on:[{events:{signal:e.name+$i},update:`modify(${G(e.name+yo)}, ${i})`}]})}return Jv(n)}function gT(t,n){if(t.component.selection&&q(t.component.selection).length){const e=G(t.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:aa("pointermove","scope"),update:`isTuple(facet) ? facet : group(${e}).datum`}]})}return Jv(n)}function u5(t,n){for(const e of En(t.component.selection??{}))for(const r of Dh)r.defined(e)&&r.marks&&(n=r.marks(t,e,n));return n}function Jv(t){return t.map(n=>(n.on&&!n.on.length&&delete n.on,n))}const Ci={defined:t=>t.type==="interval"&&t.resolve==="global"&&t.bind&&t.bind==="scales",parse:(t,n)=>{const e=n.scales=[];for(const r of n.project.items){const i=r.channel;if(!Ir(i))continue;const a=t.getScaleComponent(i),o=a?a.get("type"):void 0;o=="sequential"&&I("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),a&&mr(o)?(a.set("selectionExtent",{param:n.name,field:r.field},!0),e.push(r)):I("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(t,n,e)=>{const r=n.scales.filter(o=>e.filter(s=>s.name===o.signals.data).length===0);if(!t.parent||Qv(t)||r.length===0)return e;const i=e.find(o=>o.name===n.name);let a=i.update;if(a.includes(B5))i.update=`{${r.map(o=>`${G(He(o.field))}: ${o.signals.data}`).join(", ")}}`;else{for(const o of r){const s=`${G(He(o.field))}: ${o.signals.data}`;a.includes(s)||(a=`${a.substring(0,a.length-1)}, ${s}}`)}i.update=a}return e.concat(r.map(o=>({name:o.signals.data})))},signals:(t,n,e)=>{if(t.parent&&!Qv(t))for(const r of n.scales){const i=e.find(a=>a.name===r.signals.data);i.push="outer",delete i.value,delete i.update}return e}};function Kv(t,n){return`domain(${G(t.scaleName(n))})`}function Qv(t){return t.parent&&Rs(t.parent)&&(!t.parent.parent||Qv(t.parent.parent))}const Ms="_brush",l5="_scale_trigger",$l="geo_interval_init_tick",c5="_init",yT={defined:t=>t.type==="interval",parse:(t,n,e)=>{var r;if(t.hasProjection){const i={...Z(e.select)?e.select:{}};i.fields=[br],i.encodings||(i.encodings=e.value?q(e.value):[dr,fr]),e.select={type:"interval",...i}}if(n.translate&&!Ci.defined(n)){const i=`!event.item || event.item.mark.name !== ${G(n.name+Ms)}`;for(const a of n.events){if(!a.between){I(`${a} is not an ordered event stream for interval selections.`);continue}const o=K((r=a.between[0]).filter??(r.filter=[]));o.includes(i)||o.push(i)}}},signals:(t,n,e)=>{const r=n.name,i=r+$i,a=En(n.project.hasChannel).filter(s=>s.channel===Jt||s.channel===bn),o=n.init?n.init[0]:null;if(e.push(...a.reduce((s,u)=>s.concat(function(l,c,f,d){const h=!l.hasProjection,p=f.channel,m=f.signals.visual,g=G(h?l.scaleName(p):l.projectionName()),y=w=>`scale(${g}, ${w})`,v=l.getSizeSignalRef(p===Jt?"width":"height").signal,x=`${p}(unit)`,b=c.events.reduce((w,A)=>[...w,{events:A.between[0],update:`[${x}, ${x}]`},{events:A,update:`[${m}[0], clamp(${x}, 0, ${v})]`}],[]);if(h){const w=f.signals.data,A=Ci.defined(c),_=l.getScaleComponent(p),k=_?_.get("type"):void 0,F=d?{init:go(d,!0,y)}:{value:[]};return b.push({events:{signal:c.name+l5},update:mr(k)?`[${y(`${w}[0]`)}, ${y(`${w}[1]`)}]`:"[0, 0]"}),A?[{name:w,on:[]}]:[{name:m,...F,on:b},{name:w,...d?{init:go(d)}:{},on:[{events:{signal:m},update:`${m}[0] === ${m}[1] ? null : invert(${g}, ${m})`}]}]}{const w=p===Jt?0:1,A=c.name+c5;return[{name:m,...d?{init:`[${A}[0][${w}], ${A}[1][${w}]]`}:{value:[]},on:b}]}}(t,n,u,o&&o[u.index])),[])),t.hasProjection){const s=G(t.projectionName()),u=t.projectionName()+"_center",{x:l,y:c}=n.project.hasChannel,f=l&&l.signals.visual,d=c&&c.signals.visual,h=l?o&&o[l.index]:`${u}[0]`,p=c?o&&o[c.index]:`${u}[1]`,m=x=>t.getSizeSignalRef(x).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;o&&(e.unshift({name:r+c5,init:`[scale(${s}, [${l?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${l?h[1]:h}, ${c?p[1]:p}])]`}),!l||!c)&&(e.find(x=>x.name===u)||e.unshift({name:u,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`}));const y=`vlSelectionTuples(${`intersect(${g}, {markname: ${G(t.getName("marks"))}}, unit.mark)`}, ${`{unit: ${vo(t)}}`})`,v=a.map(x=>x.signals.visual);return e.concat({name:i,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...o?[{signal:$l}]:[]],update:y}]})}{if(!Ci.defined(n)){const l=r+l5,c=a.map(f=>{const d=f.channel,{data:h,visual:p}=f.signals,m=G(t.scaleName(d)),g=mr(t.getScaleComponent(d).get("type"))?"+":"";return`(!isArray(${h}) || (${g}invert(${m}, ${p})[0] === ${g}${h}[0] && ${g}invert(${m}, ${p})[1] === ${g}${h}[1]))`});c.length&&e.push({name:l,value:{},on:[{events:a.map(f=>({scale:t.scaleName(f.channel)})),update:c.join(" && ")+` ? ${l} : {}`}]})}const s=a.map(l=>l.signals.data),u=`unit: ${vo(t)}, fields: ${r+El}, values`;return e.concat({name:i,...o?{init:`{${u}: ${go(o)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${u}: [${s}]} : null`}]}:{}})}},topLevelSignals:(t,n,e)=>(Zt(t)&&t.hasProjection&&n.init&&(e.filter(r=>r.name===$l).length||e.unshift({name:$l,value:null,on:[{events:"timer{1}",update:`${$l} === null ? {} : ${$l}`}]})),e),marks:(t,n,e)=>{const r=n.name,{x:i,y:a}=n.project.hasChannel,o=i==null?void 0:i.signals.visual,s=a==null?void 0:a.signals.visual,u=`data(${G(n.name+yo)})`;if(Ci.defined(n)||!i&&!a)return e;const l={x:i!==void 0?{signal:`${o}[0]`}:{value:0},y:a!==void 0?{signal:`${s}[0]`}:{value:0},x2:i!==void 0?{signal:`${o}[1]`}:{field:{group:"width"}},y2:a!==void 0?{signal:`${s}[1]`}:{field:{group:"height"}}};if(n.resolve==="global")for(const g of q(l))l[g]=[{test:`${u}.length && ${u}[0].unit === ${vo(t)}`,...l[g]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=n.mark,p=q(h).reduce((g,y)=>(g[y]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,a!==void 0&&`${s}[0] !== ${s}[1]`].filter(v=>v).join(" && "),value:h[y]},{value:null}],g),{}),m=d??(n.translate?"move":null);return[{name:`${r+Ms}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...e,{name:r+Ms,type:"rect",clip:!0,encode:{enter:{...m?{cursor:{value:m}}:{},fill:{value:"transparent"}},update:{...l,...p}}}]}};function Bs({model:t,channelDef:n,vgChannel:e,invalidValueRef:r,mainRefFn:i}){const a=_l(n)&&n.condition;let o=[];a&&(o=K(a).map(u=>{const l=i(u);if(function(c){return U(c,"param")}(u)){const{param:c,empty:f}=u;return{test:X5(t,{param:c,empty:f}),...l}}return{test:Sh(t,u.test),...l}})),r!==void 0&&o.push(r);const s=i(n);return s!==void 0&&o.push(s),o.length>1||o.length===1&&o[0].test?{[e]:o}:o.length===1?{[e]:o[0]}:{}}function Zv(t,n="text"){const e=t.encoding[n];return Bs({model:t,channelDef:e,vgChannel:n,mainRefFn:r=>wh(r,t.config),invalidValueRef:void 0})}function wh(t,n,e="datum"){if(t){if(yr(t))return Gt(t.value);if(ht(t)){const{format:r,formatType:i}=oh(t);return yv({fieldOrDatumDef:t,format:r,formatType:i,expr:e,config:n})}}}function f5(t,n={}){const{encoding:e,markDef:r,config:i,stack:a}=t,o=e.tooltip;if(P(o))return{tooltip:h5({tooltip:o},a,i,n)};{const s=n.reactiveGeom?"datum.datum":"datum";return Bs({model:t,channelDef:o,vgChannel:"tooltip",mainRefFn:u=>{const l=wh(u,i,s);if(l)return l;if(u===null)return;let c=qt("tooltip",r,i);return c===!0&&(c={content:"encoding"}),Q(c)?{value:c}:Z(c)?it(c)?c:c.content==="encoding"?h5(e,a,i,n):{signal:s}:void 0},invalidValueRef:void 0})}}function d5(t,n,e,{reactiveGeom:r}={}){const i={...e,...e.tooltipFormat},a=new Set,o=r?"datum.datum":"datum",s=[];function u(c,f){const d=ro(f),h=oe(c)?c:{...c,type:t[d].type},p=h.title||Av(h,i),m=K(p).join(", ").replaceAll(/"/g,'\\"');let g;if(ln(f)){const y=f==="x"?"x2":"y2",v=vr(t[y]);if($n(h.bin)&&v){const x=Y(h,{expr:o}),b=Y(v,{expr:o}),{format:w,formatType:A}=oh(h);g=wl(x,b,w,A,i),a.add(y)}}if((ln(f)||f===Ge||f===cr)&&n&&n.fieldChannel===f&&n.offset==="normalize"){const{format:y,formatType:v}=oh(h);g=yv({fieldOrDatumDef:h,format:y,formatType:v,expr:o,config:i,normalizeStack:!0}).signal}g??(g=wh(h,i,o).signal),s.push({channel:f,key:m,value:g})}kv(t,(c,f)=>{H(c)?u(c,f):rh(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of s)a.has(c)||l[f]||(l[f]=d);return l}function h5(t,n,e,{reactiveGeom:r}={}){const i=d5(t,n,e,{reactiveGeom:r}),a=sa(i).map(([o,s])=>`"${o}": ${s}`);return a.length>0?{signal:`{${a.join(", ")}}`}:void 0}function vT(t){const{markDef:n,config:e}=t,r=qt("aria",n,e);return r===!1?{}:{...r?{aria:r}:{},...bT(t),...xT(t)}}function bT(t){const{mark:n,markDef:e,config:r}=t;if(r.aria===!1)return{};const i=qt("ariaRoleDescription",e,r);return i!=null?{ariaRoleDescription:{value:i}}:tt(EN,n)?{}:{ariaRoleDescription:{value:n}}}function xT(t){const{encoding:n,markDef:e,config:r,stack:i}=t,a=n.description;if(a)return Bs({model:t,channelDef:a,vgChannel:"description",mainRefFn:u=>wh(u,t.config),invalidValueRef:void 0});const o=qt("description",e,r);if(o!=null)return{description:Gt(o)};if(r.aria===!1)return{};const s=d5(n,i,r);return jt(s)?void 0:{description:{signal:sa(s).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function Mn(t,n,e={}){const{markDef:r,encoding:i,config:a}=n,{vgChannel:o}=e;let{defaultRef:s,defaultValue:u}=e;const l=i[t];s===void 0&&(u??(u=qt(t,r,a,{vgChannel:o,ignoreVgConfig:!_l(l)})),u!==void 0&&(s=Gt(u)));const c={markDef:r,config:a,scaleName:n.scaleName(t),scale:n.getScaleComponent(t)},f=M3({...c,scaleChannel:t,channelDef:l});return Bs({model:n,channelDef:l,vgChannel:o??t,invalidValueRef:f,mainRefFn:d=>gv({...c,channel:t,channelDef:d,stack:null,defaultRef:s})})}function p5(t,n={filled:void 0}){const{markDef:e,encoding:r,config:i}=t,{type:a}=e,o=n.filled??qt("filled",e,i),s=vt(["bar","point","circle","square","geoshape"],a)?"transparent":void 0,u=qt(o===!0?"color":void 0,e,i,{vgChannel:"fill"})??i.mark[o===!0&&"color"]??s,l=qt(o===!1?"color":void 0,e,i,{vgChannel:"stroke"})??i.mark[o===!1&&"color"],c=o?"fill":"stroke",f={...u?{fill:Gt(u)}:{},...l?{stroke:Gt(l)}:{}};return e.color&&(o?e.fill:e.stroke)&&I(JE("property",{fill:"fill"in e,stroke:"stroke"in e})),{...f,...Mn("color",t,{vgChannel:c,defaultValue:o?u:l}),...Mn("fill",t,{defaultValue:r.fill?u:void 0}),...Mn("stroke",t,{defaultValue:r.stroke?l:void 0})}}function wT(t){const{encoding:n,mark:e}=t,r=n.order;return!ya(e)&&yr(r)?Bs({model:t,channelDef:r,vgChannel:"zindex",mainRefFn:i=>Gt(i.value),invalidValueRef:void 0}):{}}function Sl({channel:t,markDef:n,encoding:e={},model:r,bandPosition:i}){const a=`${t}Offset`,o=n[a],s=e[a];if((a==="xOffset"||a==="yOffset")&&s)return{offsetType:"encoding",offset:gv({channel:a,channelDef:s,markDef:n,config:r==null?void 0:r.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:Gt(o),bandPosition:i})};const u=n[a];return u?{offsetType:"visual",offset:u}:{}}function se(t,n,{defaultPos:e,vgChannel:r}){const{encoding:i,markDef:a,config:o,stack:s}=n,u=i[t],l=i[Ur(t)],c=n.scaleName(t),f=n.getScaleComponent(t),{offset:d,offsetType:h}=Sl({channel:t,markDef:a,encoding:i,model:n,bandPosition:.5}),p=tb({model:n,defaultPos:e,channel:t,scaleName:c,scale:f}),m=!u&&ln(t)&&(i.latitude||i.longitude)?{field:n.getName(t)}:function(g){const{channel:y,channelDef:v,scaleName:x,stack:b,offset:w,markDef:A}=g;if(ht(v)&&b&&y===b.fieldChannel){if(H(v)){let _=v.bandPosition;if(_!==void 0||A.type!=="text"||y!=="radius"&&y!=="theta"||(_=.5),_!==void 0)return th({scaleName:x,fieldOrDatumDef:v,startSuffix:"start",bandPosition:_,offset:w})}return fo(v,x,{suffix:"end"},{offset:w})}return mv(g)}({channel:t,channelDef:u,channel2Def:l,markDef:a,config:o,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:h==="encoding"?0:void 0});return m?{[r||t]:m}:void 0}function tb({model:t,defaultPos:n,channel:e,scaleName:r,scale:i}){const{markDef:a,config:o}=t;return()=>{const s=ro(e),u=pa(e),l=qt(e,a,o,{vgChannel:u});if(l!==void 0)return xl(e,l);switch(n){case"zeroOrMin":return m5({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:s,config:o});case"zeroOrMax":return m5({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:s,config:o});case"mid":return{...t[ge(e)],mult:.5}}}}function m5({mainChannel:t,config:n,...e}){const r=S3(e),{mode:i}=e;if(r)return r;switch(t){case"radius":{if(i==="zeroOrMin")return{value:0};const{widthSignal:a,heightSignal:o}=i.zeroOrMax;return{signal:`min(${a},${o})/2`}}case"theta":return i==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return i==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return i==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const AT={left:"x",center:"xc",right:"x2"},_T={top:"y",middle:"yc",bottom:"y2"};function g5(t,n,e,r="middle"){if(t==="radius"||t==="theta")return pa(t);const i=t==="x"?"align":"baseline",a=qt(i,n,e);let o;return it(a)?(I(function(s){return`The ${s} for range marks cannot be an expression`}(i)),o=void 0):o=a,t==="x"?AT[o||(r==="top"?"left":"center")]:_T[o||r]}function Ah(t,n,{defaultPos:e,defaultPos2:r,range:i}){return i?y5(t,n,{defaultPos:e,defaultPos2:r}):se(t,n,{defaultPos:e})}function y5(t,n,{defaultPos:e,defaultPos2:r}){const{markDef:i,config:a}=n,o=Ur(t),s=ge(t),u=function(l,c,f){const{encoding:d,mark:h,markDef:p,stack:m,config:g}=l,y=ro(f),v=ge(f),x=pa(f),b=d[y],w=l.scaleName(y),A=l.getScaleComponent(y),{offset:_}=Sl(f in d||f in p?{channel:f,markDef:p,encoding:d,model:l}:{channel:y,markDef:p,encoding:d,model:l});if(!b&&(f==="x2"||f==="y2")&&(d.latitude||d.longitude)){const F=ge(f),C=l.markDef[F];return C!=null?{[F]:{value:C}}:{[x]:{field:l.getName(f)}}}const k=function({channel:F,channelDef:C,channel2Def:D,markDef:E,config:$,scaleName:M,scale:S,stack:B,offset:z,defaultRef:N}){return ht(C)&&B&&F.charAt(0)===B.fieldChannel.charAt(0)?fo(C,M,{suffix:"start"},{offset:z}):mv({channel:F,channelDef:D,scaleName:M,scale:S,stack:B,markDef:E,config:$,offset:z,defaultRef:N})}({channel:f,channelDef:b,channel2Def:d[f],markDef:p,config:g,scaleName:w,scale:A,stack:m,offset:_,defaultRef:void 0});return k!==void 0?{[x]:k}:_h(f,p)||_h(f,{[f]:Ly(f,p,g.style),[v]:Ly(v,p,g.style)})||_h(f,g[h])||_h(f,g.mark)||{[x]:tb({model:l,defaultPos:c,channel:f,scaleName:w,scale:A})()}}(n,r,o);return{...se(t,n,{defaultPos:e,vgChannel:u[s]?g5(t,i,a):pa(t)}),...u}}function _h(t,n){const e=ge(t),r=pa(t);if(n[r]!==void 0)return{[r]:xl(t,n[r])};if(n[t]!==void 0)return{[r]:xl(t,n[t])};if(n[e]){const i=n[e];if(!co(i))return{[e]:xl(t,i)};I(function(a){return`Position range does not support relative band size for ${a}.`}(e))}}function Ei(t,n){const{config:e,encoding:r,markDef:i}=t,a=i.type,o=Ur(n),s=ge(n),u=r[n],l=r[o],c=t.getScaleComponent(n),f=c?c.get("type"):void 0,d=i.orient,h=r[s]??r.size??qt("size",i,e,{vgChannel:s}),p=_E(n),m=a==="bar"&&(n==="x"?d==="vertical":d==="horizontal")||a==="tick"&&(n==="y"?d==="vertical":d==="horizontal");return!H(u)||!(Wt(u.bin)||$n(u.bin)||u.timeUnit&&!l)||h&&!co(h)||r[p]||wn(f)?(ht(u)&&wn(f)||m)&&!l?function(g,y,v){var mt,pt;const{markDef:x,encoding:b,config:w,stack:A}=v,_=x.orient,k=v.scaleName(y),F=v.getScaleComponent(y),C=ge(y),D=Ur(y),E=_E(y),$=v.scaleName(E),M=v.getScaleComponent(By(y)),S=x.type==="tick"||_==="horizontal"&&y==="y"||_==="vertical"&&y==="x";let B;(b.size||x.size)&&(S?B=Mn("size",v,{vgChannel:C,defaultRef:Gt(x.size)}):I(function(J){return`Cannot apply size to non-oriented mark "${J}".`}(x.type)));const z=!!B,N=q3({channel:y,fieldDef:g,markDef:x,config:w,scaleType:(mt=F||M)==null?void 0:mt.get("type"),useVlSizeChannel:S});B=B||{[C]:kT(C,$||k,M||F,w,N,!!g,x.type)};const W=((pt=F||M)==null?void 0:pt.get("type"))==="band"&&co(N)&&!z?"top":"middle",X=g5(y,x,w,W),L=X==="xc"||X==="yc",{offset:et,offsetType:ot}=Sl({channel:y,markDef:x,encoding:b,model:v,bandPosition:L?.5:0}),nt=mv({channel:y,channelDef:g,markDef:x,config:w,scaleName:k,scale:F,stack:A,offset:et,defaultRef:tb({model:v,defaultPos:"mid",channel:y,scaleName:k,scale:F}),bandPosition:L?ot==="encoding"?0:.5:it(N)?{signal:`(1-${N})/2`}:co(N)?(1-N.band)/2:0});if(C)return{[X]:nt,...B};{const J=pa(D),Mt=B[C],Tt=et?{...Mt,offset:et}:Mt;return{[X]:nt,[J]:P(nt)?[nt[0],{...nt[1],offset:Tt}]:{...nt,offset:Tt}}}}(u,n,t):y5(n,t,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:g,fieldDef2:y,channel:v,model:x}){var pt;const{config:b,markDef:w,encoding:A}=x,_=x.getScaleComponent(v),k=x.scaleName(v),F=_?_.get("type"):void 0,C=_.get("reverse"),D=q3({channel:v,fieldDef:g,markDef:w,config:b,scaleType:F}),E=(pt=x.component.axes[v])==null?void 0:pt[0],$=(E==null?void 0:E.get("translate"))??.5,M=ln(v)?qt("binSpacing",w,b)??0:0,S=Ur(v),B=pa(v),z=pa(S),N=Wr("minBandSize",w,b),{offset:W}=Sl({channel:v,markDef:w,encoding:A,model:x,bandPosition:0}),{offset:X}=Sl({channel:S,markDef:w,encoding:A,model:x,bandPosition:0}),L=function({scaleName:J,fieldDef:Mt}){const Tt=Y(Mt,{expr:"datum"});return`abs(scale("${J}", ${Y(Mt,{expr:"datum",suffix:"end"})}) - scale("${J}", ${Tt}))`}({fieldDef:g,scaleName:k}),et=v5(v,M,C,$,W,N,L),ot=v5(S,M,C,$,X??W,N,L),nt=it(D)?{signal:`(1-${D.signal})/2`}:co(D)?(1-D.band)/2:.5,mt=va({fieldDef:g,fieldDef2:y,markDef:w,config:b});if(Wt(g.bin)||g.timeUnit){const J=g.timeUnit&&mt!==.5;return{[z]:b5({fieldDef:g,scaleName:k,bandPosition:nt,offset:ot,useRectOffsetField:J}),[B]:b5({fieldDef:g,scaleName:k,bandPosition:it(nt)?{signal:`1-${nt.signal}`}:1-nt,offset:et,useRectOffsetField:J})}}if($n(g.bin)){const J=fo(g,k,{},{offset:ot});if(H(y))return{[z]:J,[B]:fo(y,k,{},{offset:et})};if(io(g.bin)&&g.bin.step)return{[z]:J,[B]:{signal:`scale("${k}", ${Y(g,{expr:"datum"})} + ${g.bin.step})`,offset:et}}}return void I(n3(S))}({fieldDef:u,fieldDef2:l,channel:n,model:t})}function kT(t,n,e,r,i,a,o){if(co(i)){if(!e)return{mult:i.band,field:{group:t}};{const s=e.get("type");if(s==="band"){let u=`bandwidth('${n}')`;i.band!==1&&(u=`${i.band} * ${u}`);const l=Wr("minBandSize",{type:o},r);return{signal:l?`max(${pr(l)}, ${u})`:u}}i.band!==1&&(I(function(u){return`Cannot use the relative band size with ${u} scale.`}(s)),i=void 0)}}else{if(it(i))return i;if(i)return{value:i}}if(e){const s=e.get("range");if(ao(s)&&$t(s.step))return{value:s.step-2}}if(!a){const{bandPaddingInner:s,barBandPaddingInner:u,rectBandPaddingInner:l,tickBandPaddingInner:c}=r.scale,f=un(s,o==="tick"?c:o==="bar"?u:l);if(it(f))return{signal:`(1 - (${f.signal})) * ${t}`};if($t(f))return{signal:`${1-f} * ${t}`}}return{value:Tv(r.view,t)-2}}function v5(t,n,e,r,i,a,o){if(yE(t))return 0;const s=t==="x"||t==="y2",u=s?-n/2:n/2;if(it(e)||it(i)||it(r)||a){const l=pr(e),c=pr(i),f=pr(r),d=pr(a),h=a?`(${o} < ${d} ? ${s?"":"-"}0.5 * (${d} - (${o})) : ${u})`:u;return{signal:(f?`${f} + `:"")+(l?`(${l} ? -1 : 1) * `:"")+(c?`(${c} + ${h})`:h)}}return i=i||0,r+(e?-i-u:+i+u)}function b5({fieldDef:t,scaleName:n,bandPosition:e,offset:r,useRectOffsetField:i}){return th({scaleName:n,fieldOrDatumDef:t,bandPosition:e,offset:r,...i?{startSuffix:vh,endSuffix:bh}:{}})}const DT=new Set(["aria","width","height"]);function Xe(t,n){const{fill:e,stroke:r}=n.color==="include"?p5(t):{};return{...FT(t.markDef,n),...x5("fill",e),...x5("stroke",r),...Mn("opacity",t),...Mn("fillOpacity",t),...Mn("strokeOpacity",t),...Mn("strokeWidth",t),...Mn("strokeDash",t),...wT(t),...f5(t),...Zv(t,"href"),...vT(t)}}function x5(t,n){return n?{[t]:n}:{}}function FT(t,n){return CN.reduce((e,r)=>(!DT.has(r)&&U(t,r)&&n[r]!=="ignore"&&(e[r]=Gt(t[r])),e),{})}function nb(t){const{config:n,markDef:e}=t,r=new Set;if(t.forEachFieldDef((i,a)=>{var c;let o;if(!Ir(a)||!(o=t.getScaleType(a)))return;const s=Ud(i.aggregate);if((l=pv({scaleChannel:a,markDef:e,config:n,scaleType:o,isCountAggregate:s}))==="break-paths-filter-domains"||l==="break-paths-show-domains"){const f=t.vgField(a,{expr:"datum",binSuffix:(c=t.stack)!=null&&c.impute?"mid":void 0});f&&r.add(f)}var l}),r.size>0)return{defined:{signal:[...r].map(a=>Vd(a,!0)).join(" && ")}}}function w5(t,n){if(n!==void 0)return{[t]:Gt(n)}}const eb="voronoi",A5={defined:t=>t.type==="point"&&t.nearest,parse:(t,n)=>{if(n.events)for(const e of n.events)e.markname=t.getName(eb)},marks:(t,n,e)=>{const{x:r,y:i}=n.project.hasChannel,a=t.mark;if(ya(a))return I(`The "nearest" transform is not supported for ${a} marks.`),e;const o={name:t.getName(eb),type:"path",interactive:!0,from:{data:t.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...f5(t,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let s=0,u=!1;return e.forEach((l,c)=>{const f=l.name??"";f===t.component.mark[0].name?s=c:f.includes(eb)&&(u=!0)}),u||e.splice(s+1,0,o),e}},_5={defined:t=>t.type==="point"&&t.resolve==="global"&&t.bind&&t.bind!=="scales"&&!Mv(t.bind),parse:(t,n,e)=>z5(n,e),topLevelSignals:(t,n,e)=>{const r=n.name,i=n.project,a=n.bind,o=n.init&&n.init[0],s=A5.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((u,l)=>{const c=Xt(`${r}_${u.field}`);e.filter(f=>f.name===c).length||e.unshift({name:c,...o?{init:go(o[l])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${G(u.field)}] : null`}]:[],bind:a[u.field]??a[u.channel]??a})}),e},signals:(t,n,e)=>{const r=n.name,i=n.project,a=e.find(l=>l.name===r+$i),o=r+El,s=i.items.map(l=>Xt(`${r}_${l.field}`)),u=s.map(l=>`${l} !== null`).join(" && ");return s.length&&(a.update=`${u} ? {fields: ${o}, values: [${s.join(", ")}]} : null`),delete a.value,delete a.on,e}},kh="_toggle",k5={defined:t=>t.type==="point"&&!Kr(t)&&!!t.toggle,signals:(t,n,e)=>e.concat({name:n.name+kh,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(t,n)=>{const e=n.name+$i,r=n.name+kh;return`${r} ? null : ${e}, `+(n.resolve==="global"?`${r} ? null : true, `:`${r} ? null : {unit: ${vo(t)}}, `)+`${r} ? ${e} : null`}},CT={defined:t=>t.clear!==void 0&&t.clear!==!1&&!Kr(t),parse:(t,n)=>{n.clear&&(n.clear=Q(n.clear)?aa(n.clear,"view"):n.clear)},topLevelSignals:(t,n,e)=>{if(_5.defined(n))for(const r of n.project.items){const i=e.findIndex(a=>a.name===Xt(`${n.name}_${r.field}`));i!==-1&&e[i].on.push({events:n.clear,update:"null"})}return e},signals:(t,n,e)=>{function r(i,a){i!==-1&&e[i].on&&e[i].on.push({events:n.clear,update:a})}if(n.type==="interval")for(const i of n.project.items){const a=e.findIndex(o=>o.name===i.signals.visual);r(a,"[0, 0]"),a===-1&&r(e.findIndex(o=>o.name===i.signals.data),"null")}else{let i=e.findIndex(a=>a.name===n.name+$i);r(i,"null"),k5.defined(n)&&(i=e.findIndex(a=>a.name===n.name+kh),r(i,"false"))}return e}},D5={defined:t=>{const n=t.resolve==="global"&&t.bind&&Mv(t.bind),e=t.project.items.length===1&&t.project.items[0].field!==br;return n&&!e&&I("Legend bindings are only supported for selections over an individual field or encoding channel."),n&&e},parse:(t,n,e)=>{const r=ft(e);if(r.select=Q(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},z5(n,r),Z(e.select)&&(e.select.on||e.select.clear)){const o='event.item && indexof(event.item.mark.role, "legend") < 0';for(const s of n.events)s.filter=K(s.filter??[]),s.filter.includes(o)||s.filter.push(o)}const i=Bv(n.bind)?n.bind.legend:"click",a=Q(i)?aa(i,"view"):K(i);n.bind={legend:{merge:a}}},topLevelSignals:(t,n,e)=>{const r=n.name,i=Bv(n.bind)&&n.bind.legend,a=o=>s=>{const u=ft(s);return u.markname=o,u};for(const o of n.project.items){if(!o.hasLegend)continue;const s=`${Xt(o.field)}_legend`,u=`${r}_${s}`;if(e.filter(l=>l.name===u).length===0){const l=i.merge.map(a(`${s}_symbols`)).concat(i.merge.map(a(`${s}_labels`))).concat(i.merge.map(a(`${s}_entries`)));e.unshift({name:u,...n.init?{}:{value:null},on:[{events:l,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return e},signals:(t,n,e)=>{const r=n.name,i=n.project,a=e.find(f=>f.name===r+$i),o=r+El,s=i.items.filter(f=>f.hasLegend).map(f=>Xt(`${r}_${Xt(f.field)}_legend`)),u=`${s.map(f=>`${f} !== null`).join(" && ")} ? {fields: ${o}, values: [${s.join(", ")}]} : null`;n.events&&s.length>0?a.on.push({events:s.map(f=>({signal:f})),update:u}):s.length>0&&(a.update=u,delete a.value,delete a.on);const l=e.find(f=>f.name===r+kh),c=Bv(n.bind)&&n.bind.legend;return l&&(n.events?l.on.push({...l.on[0],events:c}):l.on[0].events=c),e}},F5="_translate_anchor",C5="_translate_delta",ET={defined:t=>t.type==="interval"&&t.translate,signals:(t,n,e)=>{const r=n.name,i=Ci.defined(n),a=r+F5,{x:o,y:s}=n.project.hasChannel;let u=aa(n.translate,"scope");return i||(u=u.map(l=>(l.between[0].markname=r+Ms,l))),e.push({name:a,value:{},on:[{events:u.map(l=>l.between[0]),update:"{x: x(unit), y: y(unit)"+(o!==void 0?`, extent_x: ${i?Kv(t,Jt):`slice(${o.signals.visual})`}`:"")+(s!==void 0?`, extent_y: ${i?Kv(t,bn):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:r+C5,value:{},on:[{events:u,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),o!==void 0&&E5(t,n,o,"width",e),s!==void 0&&E5(t,n,s,"height",e),e}};function E5(t,n,e,r,i){const a=n.name,o=a+F5,s=a+C5,u=e.channel,l=Ci.defined(n),c=i.find(y=>y.name===e.signals[l?"data":"visual"]),f=t.getSizeSignalRef(r).signal,d=t.getScaleComponent(u),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${o}.extent_${u}`,g=`${l&&d?h==="log"?"panLog":h==="symlog"?"panSymlog":h==="pow"?"panPow":"panLinear":"panLinear"}(${m}, ${`${l?u===Jt?p?"":"-":p?"-":"":""}${s}.${u} / ${l?`${f}`:`span(${m})`}`}${l?h==="pow"?`, ${d.get("exponent")??1}`:h==="symlog"?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:l?g:`clampRange(${g}, 0, ${f})`})}const $5="_zoom_anchor",S5="_zoom_delta",$T={defined:t=>t.type==="interval"&&t.zoom,signals:(t,n,e)=>{const r=n.name,i=Ci.defined(n),a=r+S5,{x:o,y:s}=n.project.hasChannel,u=G(t.scaleName(Jt)),l=G(t.scaleName(bn));let c=aa(n.zoom,"scope");return i||(c=c.map(f=>(f.markname=r+Ms,f))),e.push({name:r+$5,on:[{events:c,update:i?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),o!==void 0&&M5(t,n,o,"width",e),s!==void 0&&M5(t,n,s,"height",e),e}};function M5(t,n,e,r,i){const a=n.name,o=e.channel,s=Ci.defined(n),u=i.find(m=>m.name===e.signals[s?"data":"visual"]),l=t.getSizeSignalRef(r).signal,c=t.getScaleComponent(o),f=c&&c.get("type"),d=s?Kv(t,o):u.name,h=a+S5,p=`${s&&c?f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${a}${$5}.${o}`}, ${h}${s?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":""})`;u.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${l})`})}const yo="_store",$i="_tuple",ST="_modify",B5="vlSelectionResolve",Dh=[pT,yT,dT,k5,_5,Ci,D5,CT,ET,$T,A5];function vo(t,{escape:n}={escape:!0}){let e=n?G(t.name):t.name;const r=function(i){let a=i.parent;for(;a&&!$e(a);)a=a.parent;return a}(t);if(r){const{facet:i}=r;for(const a of Ye)i[a]&&(e+=` + '__facet_${a}_' + (facet[${G(r.vgField(a))}])`)}return e}function rb(t){return En(t.component.selection??{}).reduce((n,e)=>n||e.project.hasSelectionId,!1)}function z5(t,n){!Q(n.select)&&n.select.on||delete t.events,!Q(n.select)&&n.select.clear||delete t.clear,!Q(n.select)&&n.select.toggle||delete t.toggle}function Kr(t){var n;return(n=t.events)==null?void 0:n.find(e=>"type"in e&&e.type==="timer")}const MT="Property",BT="ArrayExpression",zT="BinaryExpression",OT="CallExpression",NT="ConditionalExpression",RT="LogicalExpression",TT="MemberExpression",PT="ObjectExpression",jT="UnaryExpression";function wr(t){this.type=t}var Si,at,T,Ln,Rt;wr.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(i){switch(i.type){case BT:return i.elements;case zT:case RT:return[i.left,i.right];case OT:return[i.callee].concat(i.arguments);case NT:return[i.test,i.consequent,i.alternate];case TT:return[i.object,i.property];case PT:return i.properties;case MT:return[i.key,i.value];case jT:return[i.argument];default:return[]}}(this),e=0,r=n.length;e",Si[3]="Identifier",Si[4]="Keyword",Si[5]="Null",Si[6]="Numeric",Si[7]="Punctuator",Si[8]="String",Si[9]="RegularExpression";var O5="Identifier",An="Unexpected token %0",ib="Invalid regular expression",ab="Invalid regular expression: missing /",N5="Octal literals are not allowed in strict mode.",Bn="ILLEGAL",Ml="Disabled.",LT=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),qT=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Fh(t,n){if(!t)throw new Error("ASSERT: "+n)}function Mi(t){return t>=48&&t<=57}function ob(t){return"0123456789abcdefABCDEF".includes(t)}function Bl(t){return"01234567".includes(t)}function UT(t){return t===32||t===9||t===11||t===12||t===160||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function zl(t){return t===10||t===13||t===8232||t===8233}function Ol(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t===92||t>=128&<.test(String.fromCharCode(t))}function Ch(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===92||t>=128&&qT.test(String.fromCharCode(t))}const IT={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function R5(){for(;T1114111||t!=="}")&&Ct({},An,Bn),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function T5(){var t,n;for(t=at.charCodeAt(T++),n=String.fromCharCode(t),t===92&&(at.charCodeAt(T)!==117&&Ct({},An,Bn),++T,(t=sb("u"))&&t!=="\\"&&Ol(t.charCodeAt(0))||Ct({},An,Bn),n=t);T>>="?{type:7,value:r,start:i,end:T+=4}:(e=r.substr(0,3))===">>>"||e==="<<="||e===">>="?{type:7,value:e,start:i,end:T+=3}:o===(n=e.substr(0,2))[1]&&"+-<>&|".includes(o)||n==="=>"?{type:7,value:n,start:i,end:T+=2}:(n==="//"&&Ct({},An,Bn),"<>=!+-*%&|^/".includes(o)?{type:7,value:o,start:i,end:++T}:void Ct({},An,Bn))}function P5(){var t,n,e;if(Fh(Mi((e=at[T]).charCodeAt(0))||e===".","Numeric literal must start with a decimal digit or a decimal point"),n=T,t="",e!=="."){if(t=at[T++],e=at[T],t==="0"){if(e==="x"||e==="X")return++T,function(r){let i="";for(;T=0&&Ct({},ib,o),{value:o,literal:a}}(),r=function(i,a){let o=i;a.includes("u")&&(o=o.replace(/\\u\{([0-9a-fA-F]+)\}/g,(s,u)=>{if(parseInt(u,16)<=1114111)return"x";Ct({},ib)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(o)}catch{Ct({},ib)}try{return new RegExp(i,a)}catch{return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:T}}function j5(){if(R5(),T>=Ln)return{type:2,start:T,end:T};const t=at.charCodeAt(T);return Ol(t)?HT():t===40||t===41||t===59?ub():t===39||t===34?function(){var n,e,r,i,a="",o=!1;for(Fh((n=at[T])==="'"||n==='"',"String literal must starts with a quote"),e=T,++T;T(Fh(o":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function bo(){var t,n;return t=function(){var e,r,i,a,o,s,u,l,c,f;if(e=Rt,c=$h(),(o=G5(a=Rt))===0)return c;for(a.prec=o,ve(),r=[e,Rt],s=[c,a,u=$h()];(o=G5(Rt))>0;){for(;s.length>2&&o<=s[s.length-2].prec;)u=s.pop(),l=s.pop().value,c=s.pop(),r.pop(),i=q5(l,c,u),s.push(i);(a=ve()).prec=o,s.push(a),r.push(Rt),i=$h(),s.push(i)}for(i=s[f=s.length-1],r.pop();f>1;)r.pop(),i=q5(s[f-1].value,s[f-2],i),f-=2;return i}(),Vt("?")&&(ve(),n=bo(),qn(":"),t=function(e,r,i){const a=new wr("ConditionalExpression");return a.test=e,a.consequent=r,a.alternate=i,a}(t,n,bo())),t}function fb(){const t=bo();if(Vt(","))throw new Error(Ml);return t}function db(t){const n=[];return t.type==="Identifier"?[t.name]:t.type==="Literal"?[t.value]:(t.type==="MemberExpression"&&(n.push(...db(t.object)),n.push(...db(t.property))),n)}function V5(t){return t.object.type==="MemberExpression"?V5(t.object):t.object.name==="datum"}function Y5(t){const n=function(r){T=0,Ln=(at=r).length,Rt=null,L5();const i=fb();if(Rt.type!==2)throw new Error("Unexpect token after expression.");return i}(t),e=new Set;return n.visit(r=>{r.type==="MemberExpression"&&V5(r)&&e.add(db(r).slice(1).join("."))}),e}class Ts extends Nt{clone(){return new Ts(null,this.model,ft(this.filter))}constructor(n,e,r){super(n),this.model=e,this.filter=r,this.expr=Sh(this.model,this.filter,this),this._dependentFields=Y5(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function X5(t,n,e,r="datum"){const i=Q(n)?n:n.param,a=Xt(i),o=G(a+yo);let s;try{s=t.getSelectionComponent(a,i)}catch{return`!!${a}`}if(s.project.timeUnit){const c=e??t.component.data.raw,f=s.project.timeUnit.clone();c.parent?f.insertAsParentOf(c):c.parent=f}const u=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${o}, ${r}${s.resolve==="global"?")":`, ${G(s.resolve)})`}`,l=`length(data(${o}))`;return n.empty===!1?`${l} && ${u}`:`!${l} || ${u}`}function J5(t,n,e){const r=Xt(n),i=e.encoding;let a,o=e.field;try{a=t.getSelectionComponent(r,n)}catch{return r}if(i||o){if(i&&!o){const s=a.project.items.filter(u=>u.channel===i);!s.length||s.length>1?(o=a.project.items[0].field,I(function(u,l,c,f){return(u.length?"Multiple ":"No ")+`matching ${G(l)} encoding found for selection ${G(c.param)}. Using "field": ${G(f)}.`}(s,i,e,o))):o=s[0].field}}else o=a.project.items[0].field,a.project.items.length>1&&I(function(s){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${G(s)}.`}(o));return`${a.name}[${G(He(o))}]`}function Sh(t,n,e){return fl(n,r=>Q(r)?r:function(i){return U(i,"param")}(r)?X5(t,r,e):h3(r))}function hb(t,n,e,r){var i,a;t.encode??(t.encode={}),(i=t.encode)[n]??(i[n]={}),(a=t.encode[n]).update??(a.update={}),t.encode[n].update[e]=r}function Rl(t,n,e,r={header:!1}){var f,d;const{disable:i,orient:a,scale:o,labelExpr:s,title:u,zindex:l,...c}=t.combine();if(!i){for(const h in c){const p=h,m=gR[p],g=c[p];if(m&&m!==n&&m!=="both")delete c[p];else if(Fl(g)){const{condition:y,...v}=g,x=K(y),b=Q3[p];if(b){const{vgProp:w,part:A}=b,_=[...x.map(k=>{const{test:F,...C}=k;return{test:Sh(null,F),...C}}),v];hb(c,A,w,_),delete c[p]}else if(b===null){const w={signal:x.map(A=>{const{test:_,...k}=A;return`${Sh(null,_)} ? ${OE(k)} : `}).join("")+OE(v)};c[p]=w}}else if(it(g)){const y=Q3[p];if(y){const{vgProp:v,part:x}=y;hb(c,x,v,g),delete c[p]}}vt(["labelAlign","labelBaseline"],p)&&c[p]===null&&delete c[p]}if(n==="grid"){if(!c.grid)return;if(c.encode){const{grid:h}=c.encode;c.encode={...h?{grid:h}:{}},jt(c.encode)&&delete c.encode}return{scale:o,orient:a,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:un(l,0)}}{if(!r.header&&t.mainExtracted)return;if(s!==void 0){let p=s;(d=(f=c.encode)==null?void 0:f.labels)!=null&&d.update&&it(c.encode.labels.update.text)&&(p=to(s,"datum.label",c.encode.labels.update.text.signal)),hb(c,"labels","text",{signal:p})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const p of Z3)t.hasAxisPart(p)||delete c.encode[p];jt(c.encode)&&delete c.encode}const h=function(p,m){if(p)return P(p)&&!ga(p)?p.map(g=>Av(g,m)).join(", "):p}(u,e);return{scale:o,orient:a,grid:!1,...h?{title:h}:{},...c,...e.aria===!1?{aria:!1}:{},zindex:un(l,0)}}}}function K5(t){const{axes:n}=t.component,e=[];for(const r of wi)if(n[r]){for(const i of n[r])if(!i.get("disable")&&!i.get("gridScale")){const a=r==="x"?"height":"width",o=t.getSizeSignalRef(a).signal;a!==o&&e.push({name:a,update:o})}}return e}function Q5(t,n,e,r){return Object.assign.apply(null,[{},...t.map(i=>{if(i==="axisOrient"){const a=e==="x"?"bottom":"left",o=n[e==="x"?"axisBottom":"axisLeft"]||{},s=n[e==="x"?"axisTop":"axisRight"]||{},u=new Set([...q(o),...q(s)]),l={};for(const c of u.values())l[c]={signal:`${r.signal} === "${a}" ? ${pr(o[c])} : ${pr(s[c])}`};return l}return n[i]})])}function eP(t,n){var r;const e=[{}];for(const i of t){let a=(r=n[i])==null?void 0:r.style;if(a){a=K(a);for(const o of a)e.push(n.style[o])}}return Object.assign.apply(null,e)}function pb(t,n,e,r={}){var a;const i=RE(t,e,n);if(i!==void 0)return{configFrom:"style",configValue:i};for(const o of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((a=r[o])==null?void 0:a[t])!==void 0)return{configFrom:o,configValue:r[o][t]};return{}}const Z5={scale:({model:t,channel:n})=>t.scaleName(n),format:({format:t})=>t,formatType:({formatType:t})=>t,grid:({fieldOrDatumDef:t,axis:n,scaleType:e})=>n.grid??function(r,i){return!wn(r)&&H(i)&&!Wt(i==null?void 0:i.bin)&&!$n(i==null?void 0:i.bin)}(e,t),gridScale:({model:t,channel:n})=>function(e,r){const i=r==="x"?"y":"x";if(e.getScaleComponent(i))return e.scaleName(i)}(t,n),labelAlign:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelAlign||nS(n,e,r),labelAngle:({labelAngle:t})=>t,labelBaseline:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelBaseline||tS(n,e,r),labelFlush:({axis:t,fieldOrDatumDef:n,channel:e})=>t.labelFlush??function(r,i){if(i==="x"&&vt(["quantitative","temporal"],r))return!0}(n.type,e),labelOverlap:({axis:t,fieldOrDatumDef:n,scaleType:e})=>t.labelOverlap??function(r,i,a,o){if(a&&!Z(o)||r!=="nominal"&&r!=="ordinal")return i!=="log"&&i!=="symlog"||"greedy"}(n.type,e,H(n)&&!!n.timeUnit,H(n)?n.sort:void 0),orient:({orient:t})=>t,tickCount:({channel:t,model:n,axis:e,fieldOrDatumDef:r,scaleType:i})=>{const a=t==="x"?"width":t==="y"?"height":void 0,o=a?n.getSizeSignalRef(a):void 0;return e.tickCount??function({fieldOrDatumDef:s,scaleType:u,size:l,values:c}){var f;if(!c&&!wn(u)&&u!=="log"){if(H(s)){if(Wt(s.bin))return{signal:`ceil(${l.signal}/10)`};if(s.timeUnit&&vt(["month","hours","day","quarter"],(f=xn(s.timeUnit))==null?void 0:f.unit))return}return{signal:`ceil(${l.signal}/40)`}}}({fieldOrDatumDef:r,scaleType:i,size:o,values:e.values})},tickMinStep:function({format:t,fieldOrDatumDef:n}){if(t==="d")return 1;if(H(n)){const{timeUnit:e}=n;if(e){const r=c3(e);if(r)return{signal:r}}}},title:({axis:t,model:n,channel:e})=>{if(t.title!==void 0)return t.title;const r=eS(n,e);if(r!==void 0)return r;const i=n.typedFieldDef(e),a=e==="x"?"x2":"y2",o=n.fieldDef(a);return PE(i?[L3(i)]:[],H(o)?[L3(o)]:[])},values:({axis:t,fieldOrDatumDef:n})=>function(e,r){const i=e.values;if(P(i))return K3(r,i);if(it(i))return i}(t,n),zindex:({axis:t,fieldOrDatumDef:n,mark:e})=>t.zindex??function(r,i){return r==="rect"&&ah(i)?1:0}(e,n)};function mb(t){return`(((${t.signal} % 360) + 360) % 360)`}function tS(t,n,e,r){if(t!==void 0){if(e==="x"){if(it(t)){const i=mb(t);return{signal:`(45 < ${i} && ${i} < 135) || (225 < ${i} && ${i} < 315) ? "middle" :(${i} <= 45 || 315 <= ${i}) === ${it(n)?`(${n.signal} === "top")`:n==="top"} ? "bottom" : "top"`}}if(45{if(po(r)&&j3(r.sort)){const{field:a,timeUnit:o}=r,s=r.sort,u=s.map((l,c)=>`${h3({field:a,timeUnit:o,equal:l})} ? ${c} : `).join("")+s.length;n=new js(n,{calculate:u,as:zs(r,i,{forAs:!0})})}}),n}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${wt(this.transform)}`}}function zs(t,n,e){return Y(t,{prefix:n,suffix:"sort_index",...e})}function Mh(t,n){return vt(["top","bottom"],n)?"column":vt(["left","right"],n)||t==="row"?"row":"column"}function Os(t,n,e,r){const i=r==="row"?e.headerRow:r==="column"?e.headerColumn:e.headerFacet;return un((n||{})[t],i[t],e.header[t])}function Bh(t,n,e,r){const i={};for(const a of t){const o=Os(a,n||{},e,r);o!==void 0&&(i[a]=o)}return i}const gb=["row","column"],yb=["header","footer"];function rP(t,n){const e=t.component.layoutHeaders[n].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[n].facetFieldDef?t.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:a,titleAngle:o,titleOrient:s}=Bh(["titleAnchor","titleAngle","titleOrient"],i.header,r,n),u=Mh(n,s),l=hl(o);return{name:`${n}-title`,type:"group",role:`${u}-title`,title:{text:e,...n==="row"?{orient:"left"}:{},style:"guide-title",...iS(l,u),...rS(u,l,a),...aS(r,i,n,kR,b$)}}}function rS(t,n,e="middle"){switch(e){case"start":return{align:"left"};case"end":return{align:"right"}}const r=nS(n,t==="row"?"left":"top",t==="row"?"y":"x");return r?{align:r}:{}}function iS(t,n){const e=tS(t,n==="row"?"left":"top",n==="row"?"y":"x",!0);return e?{baseline:e}:{}}function iP(t,n){const e=t.component.layoutHeaders[n],r=[];for(const i of yb)if(e[i])for(const a of e[i]){const o=oP(t,n,i,e,a);o!=null&&r.push(o)}return r}function aP(t,n){const{sort:e}=t;return ki(e)?{field:Y(e,{expr:"datum"}),order:e.order??"ascending"}:P(e)?{field:zs(t,n,{expr:"datum"}),order:"ascending"}:{field:Y(t,{expr:"datum"}),order:e??"ascending"}}function vb(t,n,e){const{format:r,formatType:i,labelAngle:a,labelAnchor:o,labelOrient:s,labelExpr:u}=Bh(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],t.header,e,n),l=yv({fieldOrDatumDef:t,format:r,formatType:i,expr:"parent",config:e}).signal,c=Mh(n,s);return{text:{signal:u?to(to(u,"datum.label",l),"datum.value",Y(t,{expr:"parent"})):l},...n==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...iS(a,c),...rS(c,a,o),...aS(e,t,n,DR,x$)}}function oP(t,n,e,r,i){if(i){let a=null;const{facetFieldDef:o}=r,s=t.config?t.config:void 0;if(o&&i.labels){const{labelOrient:f}=Bh(["labelOrient"],o.header,s,n);(n==="row"&&!vt(["top","bottom"],f)||n==="column"&&!vt(["left","right"],f))&&(a=vb(o,n,s))}const u=$e(t)&&!Al(t.facet),l=i.axes,c=(l==null?void 0:l.length)>0;if(a||c){const f=n==="row"?"height":"width";return{name:t.getName(`${n}_${e}`),type:"group",role:`${n}-${e}`,...r.facetFieldDef?{from:{data:t.getName(`${n}_domain`)},sort:aP(o,n)}:{},...c&&u?{from:{data:t.getName(`facet_domain_${n}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[f]:i.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const sP={column:{start:0,end:1},row:{start:1,end:0}};function uP(t,n){return sP[n][t]}function aS(t,n,e,r,i){const a={};for(const o of r){if(!i[o])continue;const s=Os(o,n==null?void 0:n.header,t,e);s!==void 0&&(a[i[o]]=s)}return a}function bb(t){return[...zh(t,"width"),...zh(t,"height"),...zh(t,"childWidth"),...zh(t,"childHeight")]}function zh(t,n){const e=n==="width"?"x":"y",r=t.component.layoutSize.get(n);if(!r||r==="merged")return[];const i=t.getSizeSignalRef(n).signal;if(r==="step"){const a=t.getScaleComponent(e);if(a){const o=a.get("type"),s=a.get("range");if(wn(o)&&ao(s)){const u=t.scaleName(e);return $e(t.parent)&&t.parent.component.resolve.scale[e]==="independent"?[oS(u,s)]:[oS(u,s),{name:i,update:sS(u,a,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if(r=="container"){const a=i.endsWith("width"),o=a?"containerSize()[0]":"containerSize()[1]",s=`isFinite(${o}) ? ${o} : ${Rv(t.config.view,a?"width":"height")}`;return[{name:i,init:s,on:[{update:s,events:"window:resize"}]}]}return[{name:i,value:r}]}function oS(t,n){const e=`${t}_step`;return it(n.step)?{name:e,update:n.step.signal}:{name:e,value:n.step}}function sS(t,n,e){const r=n.get("type"),i=n.get("padding"),a=un(n.get("paddingOuter"),i);let o=n.get("paddingInner");return o=r==="band"?o!==void 0?o:i:1,`bandspace(${e}, ${pr(o)}, ${pr(a)}) * ${t}_step`}function uS(t){return t==="childWidth"?"width":t==="childHeight"?"height":t}function lS(t,n){return q(t).reduce((e,r)=>({...e,...Bs({model:n,channelDef:t[r],vgChannel:r,mainRefFn:i=>Gt(i.value),invalidValueRef:void 0})}),{})}function cS(t,n){if($e(n))return t==="theta"?"independent":"shared";if(Rs(n))return"shared";if(Nb(n))return ln(t)||t==="theta"||t==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function xb(t,n){const e=t.scale[n],r=ln(n)?"axis":"legend";return e==="independent"?(t[r][n]==="shared"&&I(function(i){return`Setting the scale to be independent for "${i}" means we also have to set the guide (axis or legend) to be independent.`}(n)),"independent"):t[r][n]||"shared"}const fS=q({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class lP extends Bi{}const dS={symbols:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i,legendType:a}){if(a!=="symbol")return;const{markDef:o,encoding:s,config:u,mark:l}=e,c=o.filled&&l!=="trail";let f={...SN({},e,uR),...p5(e,{filled:c})};const d=i.get("symbolOpacity")??u.legend.symbolOpacity,h=i.get("symbolFillColor")??u.legend.symbolFillColor,p=i.get("symbolStrokeColor")??u.legend.symbolStrokeColor,m=d===void 0?hS(s.opacity)??o.opacity:void 0;if(f.fill){if(r==="fill"||c&&r===pe)delete f.fill;else if(U(f.fill,"field"))h?delete f.fill:(f.fill=Gt(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Gt(m??1));else if(P(f.fill)){const g=wb(s.fill??s.color)??o.fill??(c&&o.color);g&&(f.fill=Gt(g))}}if(f.stroke){if(r==="stroke"||!c&&r===pe)delete f.stroke;else if(U(f.stroke,"field")||p)delete f.stroke;else if(P(f.stroke)){const g=un(wb(s.stroke||s.color),o.stroke,c?o.color:void 0);g&&(f.stroke={value:g})}}if(r!==xi){const g=H(n)&&mS(e,i,n);g?f.opacity=[{test:g,...Gt(m??1)},Gt(u.legend.unselectedOpacity)]:m&&(f.opacity=Gt(m))}return f={...f,...t},jt(f)?void 0:f},gradient:function(t,{model:n,legendType:e,legendCmpt:r}){if(e!=="gradient")return;const{config:i,markDef:a,encoding:o}=n;let s={};const u=(r.get("gradientOpacity")??i.legend.gradientOpacity)===void 0?hS(o.opacity)||a.opacity:void 0;return u&&(s.opacity=Gt(u)),s={...s,...t},jt(s)?void 0:s},labels:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i}){const a=e.legend(r)||{},o=e.config,s=H(n)?mS(e,i,n):void 0,u=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=a;let f;ho(c)?f=gr({fieldOrDatumDef:n,field:"datum.value",format:l,formatType:c,config:o}):l===void 0&&c===void 0&&o.customFormatTypes&&(n.type==="quantitative"&&o.numberFormatType?f=gr({fieldOrDatumDef:n,field:"datum.value",format:o.numberFormat,formatType:o.numberFormatType,config:o}):n.type==="temporal"&&o.timeFormatType&&H(n)&&n.timeUnit===void 0&&(f=gr({fieldOrDatumDef:n,field:"datum.value",format:o.timeFormat,formatType:o.timeFormatType,config:o})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...t};return jt(d)?void 0:d},entries:function(t,{legendCmpt:n}){const e=n.get("selections");return e!=null&&e.length?{...t,fill:{value:"transparent"}}:t}};function hS(t){return pS(t,(n,e)=>Math.max(n,e.value))}function wb(t){return pS(t,(n,e)=>un(n,e.value))}function pS(t,n){return function(e){const r=e==null?void 0:e.condition;return!!r&&(P(r)||yr(r))}(t)?K(t.condition).reduce(n,t.value):yr(t)?t.value:void 0}function mS(t,n,e){const r=n.get("selections");if(!(r!=null&&r.length))return;const i=G(e.field);return r.map(a=>`(!length(data(${G(Xt(a)+yo)})) || (${a}[${i}] && indexof(${a}[${i}], datum.value) >= 0))`).join(" || ")}const gS={direction:({direction:t})=>t,format:({fieldOrDatumDef:t,legend:n,config:e})=>{const{format:r,formatType:i}=n;return O3(t,t.type,r,i,e,!1)},formatType:({legend:t,fieldOrDatumDef:n,scaleType:e})=>{const{formatType:r}=t;return N3(r,n,e)},gradientLength:t=>{const{legend:n,legendConfig:e}=t;return n.gradientLength??e.gradientLength??function({legendConfig:r,model:i,direction:a,orient:o,scaleType:s}){const{gradientHorizontalMaxLength:u,gradientHorizontalMinLength:l,gradientVerticalMaxLength:c,gradientVerticalMinLength:f}=r;if(Gr(s))return a==="horizontal"?o==="top"||o==="bottom"?yS(i,"width",l,u):l:yS(i,"height",f,c)}(t)},labelOverlap:({legend:t,legendConfig:n,scaleType:e})=>t.labelOverlap??n.labelOverlap??function(r){if(vt(["quantile","threshold","log","symlog"],r))return"greedy"}(e),symbolType:({legend:t,markDef:n,channel:e,encoding:r})=>t.symbolType??function(i,a,o,s){if(a!=="shape"){const u=wb(o)??s;if(u)return u}switch(i){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(n.type,e,r.shape,n.shape),title:({fieldOrDatumDef:t,config:n})=>Ds(t,n,{allowDisabling:!0}),type:({legendType:t,scaleType:n,channel:e})=>{if(bs(e)&&Gr(n)){if(t==="gradient")return}else if(t==="symbol")return;return t},values:({fieldOrDatumDef:t,legend:n})=>function(e,r){const i=e.values;if(P(i))return K3(r,i);if(it(i))return i}(n,t)};function cP(t){const{legend:n}=t;return un(n.type,function({channel:e,timeUnit:r,scaleType:i}){if(bs(e)){if(vt(["quarter","month","day"],r))return"symbol";if(Gr(i))return"gradient"}return"symbol"}(t))}function fP({legendConfig:t,legendType:n,orient:e,legend:r}){return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(i,a){switch(i){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return a==="gradient"?"horizontal":void 0}}(e,n)}function yS(t,n,e,r){return{signal:`clamp(${t.getSizeSignalRef(n).signal}, ${e}, ${r})`}}function vS(t){const n=Zt(t)?function(e){const{encoding:r}=e,i={};for(const a of[pe,...A$]){const o=mn(r[a]);o&&e.getScaleComponent(a)&&(a===me&&H(o)&&o.type===ws||(i[a]=hP(e,a)))}return i}(t):function(e){const{legends:r,resolve:i}=e.component;for(const a of e.children){vS(a);for(const o of q(a.component.legends))i.legend[o]=xb(e.component.resolve,o),i.legend[o]==="shared"&&(r[o]=bS(r[o],a.component.legends[o]),r[o]||(i.legend[o]="independent",delete r[o]))}for(const a of q(r))for(const o of e.children)o.component.legends[a]&&i.legend[a]==="shared"&&delete o.component.legends[a];return r}(t);return t.component.legends=n,n}function dP(t,n,e,r){switch(n){case"disable":return e!==void 0;case"values":return!!(e!=null&&e.values);case"title":if(n==="title"&&t===(r==null?void 0:r.title))return!0}return t===(e||{})[n]}function hP(t,n){var x;let e=t.legend(n);const{markDef:r,encoding:i,config:a}=t,o=a.legend,s=new lP({},function(b,w){const A=b.scaleName(w);if(b.mark==="trail"){if(w==="color")return{stroke:A};if(w==="size")return{strokeWidth:A}}return w==="color"?b.markDef.filled?{fill:A}:{stroke:A}:{[w]:A}}(t,n));(function(b,w,A){var k;const _=(k=b.fieldDef(w))==null?void 0:k.field;for(const F of En(b.component.selection??{})){const C=F.project.hasField[_]??F.project.hasChannel[w];if(C&&D5.defined(F)){const D=A.get("selections")??[];D.push(F.name),A.set("selections",D,!1),C.hasLegend=!0}}})(t,n,s);const u=e!==void 0?!e:o.disable;if(s.set("disable",u,e!==void 0),u)return s;e=e||{};const l=t.getScaleComponent(n).get("type"),c=mn(i[n]),f=H(c)?(x=xn(c.timeUnit))==null?void 0:x.unit:void 0,d=e.orient||a.legend.orient||"right",h=cP({legend:e,channel:n,timeUnit:f,scaleType:l}),p={legend:e,channel:n,model:t,markDef:r,encoding:i,fieldOrDatumDef:c,legendConfig:o,config:a,scaleType:l,orient:d,legendType:h,direction:fP({legend:e,legendType:h,orient:d,legendConfig:o})};for(const b of fS){if(h==="gradient"&&b.startsWith("symbol")||h==="symbol"&&b.startsWith("gradient"))continue;const w=b in gS?gS[b](p):e[b];if(w!==void 0){const A=dP(w,b,e,t.fieldDef(n));(A||a.legend[b]===void 0)&&s.set(b,w,A)}}const m=(e==null?void 0:e.encoding)??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:t,channel:n,legendCmpt:s,legendType:h};for(const b of["labels","legend","title","symbols","gradient","entries"]){const w=lS(m[b]??{},t),A=b in dS?dS[b](w,v):w;A===void 0||jt(A)||(y[b]={...g!=null&&g.length&&H(c)?{name:`${Xt(c.field)}_legend_${b}`}:{},...g!=null&&g.length?{interactive:!!g}:{},update:A})}return jt(y)||s.set("encode",y,!!(e!=null&&e.encoding)),s}function bS(t,n){var a,o,s,u;if(!t)return n.clone();const e=t.getWithExplicit("orient"),r=n.getWithExplicit("orient");if(e.explicit&&r.explicit&&e.value!==r.value)return;let i=!1;for(const l of fS){const c=xa(t.getWithExplicit(l),n.getWithExplicit(l),l,"legend",(f,d)=>{switch(l){case"symbolType":return pP(f,d);case"title":return LE(f,d);case"type":return i=!0,xr("symbol")}return yh(f,d,l,"legend")});t.setWithExplicit(l,c)}return i&&((o=(a=t.implicit)==null?void 0:a.encode)!=null&&o.gradient&&zd(t.implicit,["encode","gradient"]),(u=(s=t.explicit)==null?void 0:s.encode)!=null&&u.gradient&&zd(t.explicit,["encode","gradient"])),t}function pP(t,n){return n.value==="circle"?n:t}function xS(t){const n=t.component.legends,e={};for(const i of q(n)){const a=Lt(t.getScaleComponent(i).get("domains"));if(e[a])for(const o of e[a])bS(o,n[i])||e[a].push(n[i]);else e[a]=[n[i].clone()]}return En(e).flat().map(i=>function(a,o){var f,d,h;const{disable:s,labelExpr:u,selections:l,...c}=a.combine();if(!s){if(o.aria===!1&&c.aria==null&&(c.aria=!1),(f=c.encode)!=null&&f.symbols){const p=c.encode.symbols.update;!p.fill||p.fill.value==="transparent"||p.stroke||c.stroke||(p.stroke={value:"transparent"});for(const m of A$)c[m]&&delete p[m]}if(c.title||delete c.title,u!==void 0){let p=u;(h=(d=c.encode)==null?void 0:d.labels)!=null&&h.update&&it(c.encode.labels.update.text)&&(p=to(u,"datum.label",c.encode.labels.update.text.signal)),function(m,g,y,v){var x,b;m.encode??(m.encode={}),(x=m.encode)[g]??(x[g]={}),(b=m.encode[g]).update??(b.update={}),m.encode[g].update[y]=v}(c,"labels","text",{signal:p})}return c}}(i,t.config)).filter(i=>i!==void 0)}function mP(t){return Rs(t)||Nb(t)?function(n){return n.children.reduce((e,r)=>e.concat(r.assembleProjections()),wS(n))}(t):wS(t)}function wS(t){const n=t.component.projection;if(!n||n.merged)return[];const e=n.combine(),{name:r}=e;if(n.data){const i={signal:`[${n.size.map(o=>o.signal).join(", ")}]`},a=n.data.reduce((o,s)=>{const u=it(s)?s.signal:`data('${t.lookupDataSource(s)}')`;return vt(o,u)||o.push(u),o},[]);if(a.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(", ")}]`:a[0]},...e}]}return[{name:r,translate:{signal:"[width / 2, height / 2]"},...e}]}const gP=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class AS extends Bi{constructor(n,e,r,i){super({...e},{name:n}),this.specifiedProjection=e,this.size=r,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function _S(t){t.component.projection=Zt(t)?function(n){if(n.hasProjection){const e=Sn(n.specifiedProjection),r=!(e&&(e.scale!=null||e.translate!=null)),i=r?[n.getSizeSignalRef("width"),n.getSizeSignalRef("height")]:void 0,a=r?function(s){const u=[],{encoding:l}=s;for(const c of[[dr,fr],[Ve,hr]])(mn(l[c[0]])||mn(l[c[1]]))&&u.push({signal:s.getName(`geojson_${u.length}`)});return s.channelHasField(me)&&s.typedFieldDef(me).type===ws&&u.push({signal:s.getName(`geojson_${u.length}`)}),u.length===0&&u.push(s.requestDataName(Qt.Main)),u}(n):void 0,o=new AS(n.projectionName(!0),{...Sn(n.config.projection),...e},i,a);return o.get("type")||o.set("type","equalEarth",!1),o}}(t):function(n){if(n.children.length===0)return;let e;for(const i of n.children)_S(i);const r=ky(n.children,i=>{const a=i.component.projection;if(a){if(e){const o=function(s,u){const l=ky(gP,f=>!tt(s.explicit,f)&&!tt(u.explicit,f)||!!(tt(s.explicit,f)&&tt(u.explicit,f)&&Ce(s.get(f),u.get(f))));if(Ce(s.size,u.size)){if(l)return s;if(Ce(s.explicit,{}))return u;if(Ce(u.explicit,{}))return s}return null}(e,a);return o&&(e=o),!!o}return e=a,!0}return!0});if(e&&r){const i=n.projectionName(!0),a=new AS(i,e.specifiedProjection,e.size,ft(e.data));for(const o of n.children){const s=o.component.projection;s&&(s.isFit&&a.data.push(...o.component.projection.data),o.renameProjection(s.get("name"),i),s.merged=!0)}return a}}(t)}function yP(t,n,e,r){if(Dl(n,e)){const i=Zt(t)?t.axis(e)??t.legend(e)??{}:{},a=Y(n,{expr:"datum"}),o=Y(n,{expr:"datum",binSuffix:"end"});return{formulaAs:Y(n,{binSuffix:"range",forAs:!0}),formula:wl(a,o,i.format,i.formatType,r)}}return{}}function kS(t,n){return`${$E(t)}_${n}`}function Ab(t,n,e){const r=kS(uh(e,void 0)??{},n);return t.getName(`${r}_bins`)}function DS(t,n,e){let r,i;r=function(l){return"as"in l}(t)?Q(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[Y(t,{forAs:!0}),Y(t,{binSuffix:"end",forAs:!0})];const a={...uh(n,void 0)},o=kS(a,t.field),{signal:s,extentSignal:u}=function(l,c){return{signal:l.getName(`${c}_bins`),extentSignal:l.getName(`${c}_extent`)}}(e,o);if(Id(a.extent)){const l=a.extent;i=J5(e,l.param,l),delete a.extent}return{key:o,binComponent:{bin:a,field:t.field,as:[r],...s?{signal:s}:{},...u?{extentSignal:u}:{},...i?{span:i}:{}}}}class Zr extends Nt{clone(){return new Zr(null,ft(this.bins))}constructor(n,e){super(n),this.bins=e}static makeFromEncoding(n,e){const r=e.reduceFieldDef((i,a,o)=>{if(oe(a)&&Wt(a.bin)){const{key:s,binComponent:u}=DS(a,a.bin,e);i[s]={...u,...i[s],...yP(e,a,o,e.config)}}return i},{});return jt(r)?null:new Zr(n,r)}static makeFromTransform(n,e,r){const{key:i,binComponent:a}=DS(e,e.bin,r);return new Zr(n,{[i]:a})}merge(n,e){for(const r of q(n.bins))r in this.bins?(e(n.bins[r].signal,this.bins[r].signal),this.bins[r].as=Pr([...this.bins[r].as,...n.bins[r].as],wt)):this.bins[r]=n.bins[r];for(const r of n.children)n.removeChild(r),r.parent=this;n.remove()}producedFields(){return new Set(En(this.bins).map(n=>n.as).flat(2))}dependentFields(){return new Set(En(this.bins).map(n=>n.field))}hash(){return`Bin ${wt(this.bins)}`}assemble(){return En(this.bins).flatMap(n=>{const e=[],[r,...i]=n.as,{extent:a,...o}=n.bin,s={type:"bin",field:He(n.field),as:r,signal:n.signal,...Id(a)?{extent:null}:{extent:a},...n.span?{span:{signal:`span(${n.span})`}}:{},...o};!a&&n.extentSignal&&(e.push({type:"extent",field:He(n.field),signal:n.extentSignal}),s.extent={signal:n.extentSignal}),e.push(s);for(const u of i)for(let l=0;l<2;l++)e.push({type:"formula",expr:Y({field:r[l]},{expr:"datum"}),as:u[l]});return n.formula&&e.push({type:"formula",expr:n.formula,as:n.formulaAs}),e})}}function vP(t,n,e,r){var a;const i=Zt(r)?r.encoding[Ur(n)]:void 0;if(oe(e)&&Zt(r)&&U3(e,i,r.markDef,r.config)){t.add(Y(e,{})),t.add(Y(e,{suffix:"end"}));const{mark:o,markDef:s,config:u}=r,l=va({fieldDef:e,markDef:s,config:u});bl(o)&&l!==.5&&ln(n)&&(t.add(Y(e,{suffix:vh})),t.add(Y(e,{suffix:bh}))),e.bin&&Dl(e,n)&&t.add(Y(e,{binSuffix:"range"}))}else if(bE(n)){const o=vE(n);t.add(r.getName(o))}else t.add(Y(e));return po(e)&&function(o){return Z(o)&&"field"in o}((a=e.scale)==null?void 0:a.range)&&t.add(e.scale.range.field),t}class _r extends Nt{clone(){return new _r(null,new Set(this.dimensions),ft(this.measures))}constructor(n,e,r){super(n),this.dimensions=e,this.measures=r}get groupBy(){return this.dimensions}static makeFromEncoding(n,e){let r=!1;e.forEachFieldDef(o=>{o.aggregate&&(r=!0)});const i={},a=new Set;return r?(e.forEachFieldDef((o,s)=>{const{aggregate:u,field:l}=o;if(u)if(u==="count")i["*"]??(i["*"]={}),i["*"].count=new Set([Y(o,{forAs:!0})]);else{if(Ai(u)||ma(u)){const c=Ai(u)?"argmin":"argmax",f=u[c];i[f]??(i[f]={}),i[f][c]=new Set([Y({op:c,field:f},{forAs:!0})])}else i[l]??(i[l]={}),i[l][u]=new Set([Y(o,{forAs:!0})]);Ir(s)&&e.scaleDomain(s)==="unaggregated"&&(i[l]??(i[l]={}),i[l].min=new Set([Y({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([Y({field:l,aggregate:"max"},{forAs:!0})]))}else vP(a,s,o,e)}),a.size+q(i).length===0?null:new _r(n,a,i)):null}static makeFromTransform(n,e){var r;const i=new Set,a={};for(const o of e.aggregate){const{op:s,field:u,as:l}=o;s&&(s==="count"?(a["*"]??(a["*"]={}),a["*"].count=new Set([l||Y(o,{forAs:!0})])):(a[u]??(a[u]={}),(r=a[u])[s]??(r[s]=new Set),a[u][s].add(l||Y(o,{forAs:!0}))))}for(const o of e.groupby??[])i.add(o);return i.size+q(a).length===0?null:new _r(n,i,a)}merge(n){return lE(this.dimensions,n.dimensions)?(function(e,r){for(const i of q(r)){const a=r[i];for(const o of q(a))i in e?e[i][o]=new Set([...e[i][o]??[],...a[o]]):e[i]={[o]:a[o]}}}(this.measures,n.measures),!0):(function(...e){vl.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(n){n.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...q(this.measures)])}producedFields(){const n=new Set;for(const e of q(this.measures))for(const r of q(this.measures[e])){const i=this.measures[e][r];i.size===0?n.add(`${r}_${e}`):i.forEach(n.add,n)}return n}hash(){return`Aggregate ${wt({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const n=[],e=[],r=[];for(const i of q(this.measures))for(const a of q(this.measures[i]))for(const o of this.measures[i][a])r.push(o),n.push(a),e.push(i==="*"?null:He(i));return{type:"aggregate",groupby:[...this.dimensions].map(He),ops:n,fields:e,as:r}}}class Ns extends Nt{constructor(n,e,r,i){super(n),this.model=e,this.name=r,this.data=i;for(const a of Ye){const o=e.facet[a];if(o){const{bin:s,sort:u}=o;this[a]={name:e.getName(`${a}_domain`),fields:[Y(o),...Wt(s)?[Y(o,{binSuffix:"end"})]:[]],...ki(u)?{sortField:u}:P(u)?{sortIndexField:zs(o,a)}:{}}}}this.childModel=e.child}hash(){let n="Facet";for(const e of Ye)this[e]&&(n+=` ${e.charAt(0)}:${wt(this[e])}`);return n}get fields(){var e;const n=[];for(const r of Ye)(e=this[r])!=null&&e.fields&&n.push(...this[r].fields);return n}dependentFields(){const n=new Set(this.fields);for(const e of Ye)this[e]&&(this[e].sortField&&n.add(this[e].sortField.field),this[e].sortIndexField&&n.add(this[e].sortIndexField));return n}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const n={};for(const e of wi){const r=this.childModel.component.scales[e];if(r&&!r.merged){const i=r.get("type"),a=r.get("range");if(wn(i)&&ao(a)){const o=zb(Oh(this.childModel,e));o?n[e]=o:I(Uy(e))}}}return n}assembleRowColumnHeaderData(n,e,r){const i={row:"y",column:"x",facet:void 0}[n],a=[],o=[],s=[];i&&r&&r[i]&&(e?(a.push(`distinct_${r[i]}`),o.push("max")):(a.push(r[i]),o.push("distinct")),s.push(`distinct_${r[i]}`));const{sortField:u,sortIndexField:l}=this[n];if(u){const{op:c=nh,field:f}=u;a.push(f),o.push(c),s.push(Y(u,{forAs:!0}))}else l&&(a.push(l),o.push("max"),s.push(l));return{name:this[n].name,source:e??this.data,transform:[{type:"aggregate",groupby:this[n].fields,...a.length?{fields:a,ops:o,as:s}:{}}]}}assembleFacetHeaderData(n){var u;const{columns:e}=this.model.layout,{layoutHeaders:r}=this.model.component,i=[],a={};for(const l of gb){for(const c of yb){const f=(r[l]&&r[l][c])??[];for(const d of f)if(((u=d.axes)==null?void 0:u.length)>0){a[l]=!0;break}}if(a[l]){const c=`length(data("${this.facet.name}"))`,f=l==="row"?e?{signal:`ceil(${c} / ${e})`}:1:e?{signal:`min(${c}, ${e})`}:{signal:c};i.push({name:`${this.facet.name}_${l}`,transform:[{type:"sequence",start:0,stop:f}]})}}const{row:o,column:s}=a;return(o||s)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,n)),i}assemble(){const n=[];let e=null;const r=this.getChildIndependentFieldsWithStep(),{column:i,row:a,facet:o}=this;if(i&&a&&(r.x||r.y)){e=`cross_${this.column.name}_${this.row.name}`;const s=[].concat(r.x??[],r.y??[]),u=s.map(()=>"distinct");n.push({name:e,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:s,ops:u}]})}for(const s of[gi,mi])this[s]&&n.push(this.assembleRowColumnHeaderData(s,e,r));if(o){const s=this.assembleFacetHeaderData(r);s&&n.push(...s)}return n}}function FS(t){return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function bP(t){const n={};return Bd(t.filter,e=>{if(d3(e)){let r=null;Jy(e)?r=Ee(e.equal):Qy(e)?r=Ee(e.lte):Ky(e)?r=Ee(e.lt):Zy(e)?r=Ee(e.gt):tv(e)?r=Ee(e.gte):nv(e)?r=e.range[0]:ev(e)&&(r=(e.oneOf??e.in)[0]),r&&(oo(r)?n[e.field]="date":$t(r)?n[e.field]="number":Q(r)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}}),n}function xP(t){const n={};function e(r){var i;Cs(r)?n[r.field]="date":r.type==="quantitative"&&(i=r.aggregate,Q(i)&&vt(["min","max"],i))?n[r.field]="number":gs(r.field)>1?r.field in n||(n[r.field]="flatten"):po(r)&&ki(r.sort)&&gs(r.sort.field)>1&&(r.sort.field in n||(n[r.sort.field]="flatten"))}if((Zt(t)||$e(t))&&t.forEachFieldDef((r,i)=>{if(oe(r))e(r);else{const a=ro(i),o=t.fieldDef(a);e({...r,type:o.type})}}),Zt(t)){const{mark:r,markDef:i,encoding:a}=t;if(ya(r)&&!t.encoding.order){const o=a[i.orient==="horizontal"?"y":"x"];H(o)&&o.type==="quantitative"&&!(o.field in n)&&(n[o.field]="number")}}return n}class Un extends Nt{clone(){return new Un(null,ft(this._parse))}constructor(n,e){super(n),this._parse=e}hash(){return`Parse ${wt(this._parse)}`}static makeExplicit(n,e,r){var o;let i={};const a=e.data;return!wa(a)&&((o=a==null?void 0:a.format)!=null&&o.parse)&&(i=a.format.parse),this.makeWithAncestors(n,i,{},r)}static makeWithAncestors(n,e,r,i){for(const s of q(r)){const u=i.getWithExplicit(s);u.value!==void 0&&(u.explicit||u.value===r[s]||u.value==="derived"||r[s]==="flatten"?delete r[s]:I(VE(s,r[s],u.value)))}for(const s of q(e)){const u=i.get(s);u!==void 0&&(u===e[s]?delete e[s]:I(VE(s,e[s],u)))}const a=new Bi(e,r);i.copyAll(a);const o={};for(const s of q(a.combine())){const u=a.get(s);u!==null&&(o[s]=u)}return q(o).length===0||i.parseNothing?null:new Un(n,o)}get parse(){return this._parse}merge(n){this._parse={...this._parse,...n.parse},n.remove()}assembleFormatParse(){const n={};for(const e of q(this._parse)){const r=this._parse[e];gs(e)===1&&(n[e]=r)}return n}producedFields(){return new Set(q(this._parse))}dependentFields(){return new Set(q(this._parse))}assembleTransforms(n=!1){return q(this._parse).filter(e=>!n||gs(e)>1).map(e=>{const r=function(i,a){const o=Ey(i);return a==="number"?`toNumber(${o})`:a==="boolean"?`toBoolean(${o})`:a==="string"?`toString(${o})`:a==="date"?`toDate(${o})`:a==="flatten"?o:a.startsWith("date:")?`timeParse(${o},'${FS(a.slice(5,a.length))}')`:a.startsWith("utc:")?`utcParse(${o},'${FS(a.slice(4,a.length))}')`:(I(`Unrecognized parse "${a}".`),null)}(e,this._parse[e]);return r?{type:"formula",expr:r,as:ms(e)}:null}).filter(e=>e!==null)}}class _a extends Nt{clone(){return new _a(null)}constructor(n){super(n)}dependentFields(){return new Set}producedFields(){return new Set([br])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:br}}}class Pl extends Nt{clone(){return new Pl(null,this.params)}constructor(n,e){super(n),this.params=e}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${wt(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class jl extends Nt{clone(){return new jl(null,this.params)}constructor(n,e){super(n),this.params=e}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${wt(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class xo extends Nt{constructor(n){let e;if(super(null),n??(n={name:"source"}),wa(n)||(e=n.format?{...he(n.format,["parse"])}:{}),Cl(n))this._data={values:n.values};else if($s(n)){if(this._data={url:n.url},!e.type){let r=/(?:\.([^.]+))?$/.exec(n.url)[1];vt(["json","csv","tsv","dsv","topojson"],r)||(r="json"),e.type=r}}else Q$(n)?this._data={values:[{type:"Sphere"}]}:(J$(n)||wa(n))&&(this._data={});this._generator=wa(n),n.name&&(this._name=n.name),e&&!jt(e)&&(this._data.format=e)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(n){this._name=n}set parent(n){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var Tl,CS=function(t,n,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?t!==n||!i:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,e):i?i.value=e:n.set(t,e),e},wP=function(t,n,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?t!==n||!r:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(t):r?r.value:n.get(t)};function _b(t){return t instanceof xo||t instanceof Pl||t instanceof jl}class kb{constructor(){Tl.set(this,void 0),CS(this,Tl,!1,"f")}setModified(){CS(this,Tl,!0,"f")}get modifiedFlag(){return wP(this,Tl,"f")}}Tl=new WeakMap;class wo extends kb{getNodeDepths(n,e,r){r.set(n,e);for(const i of n.children)this.getNodeDepths(i,e+1,r);return r}optimize(n){const e=[...this.getNodeDepths(n,0,new Map).entries()].sort((r,i)=>i[1]-r[1]);for(const r of e)this.run(r[0]);return this.modifiedFlag}}class Db extends kb{optimize(n){this.run(n);for(const e of n.children)this.optimize(e);return this.modifiedFlag}}class AP extends Db{mergeNodes(n,e){const r=e.shift();for(const i of e)n.removeChild(i),i.parent=r,i.remove()}run(n){const e=n.children.map(i=>i.hash()),r={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(n,r[i]))}}class _P extends Db{constructor(n){super(),this.requiresSelectionId=n&&rb(n)}run(n){n instanceof _a&&(this.requiresSelectionId&&(_b(n.parent)||n.parent instanceof _r||n.parent instanceof Un)||(this.setModified(),n.remove()))}}class kP extends kb{optimize(n){return this.run(n,new Set),this.modifiedFlag}run(n,e){let r=new Set;n instanceof Qr&&(r=n.producedFields(),Dy(r,e)&&(this.setModified(),n.removeFormulas(e),n.producedFields.length===0&&n.remove()));for(const i of n.children)this.run(i,new Set([...e,...r]))}}class DP extends Db{constructor(){super()}run(n){n instanceof ye&&!n.isRequired()&&(this.setModified(),n.remove())}}class FP extends wo{run(n){if(!(_b(n)||n.numChildren()>1)){for(const e of n.children)if(e instanceof Un)if(n instanceof Un)this.setModified(),n.merge(e);else{if(Cy(n.producedFields(),e.dependentFields()))continue;this.setModified(),e.swapWithParent()}}}}class CP extends wo{run(n){const e=[...n.children],r=n.children.filter(i=>i instanceof Un);if(n.numChildren()>1&&r.length>=1){const i={},a=new Set;for(const o of r){const s=o.parse;for(const u of q(s))u in i?i[u]!==s[u]&&a.add(u):i[u]=s[u]}for(const o of a)delete i[o];if(!jt(i)){this.setModified();const o=new Un(n,i);for(const s of e){if(s instanceof Un)for(const u of q(i))delete s.parse[u];n.removeChild(s),s.parent=o,s instanceof Un&&q(s.parse).length===0&&s.remove()}}}}}class EP extends wo{run(n){n instanceof ye||n.numChildren()>0||n instanceof Ns||n instanceof xo||(this.setModified(),n.remove())}}class $P extends wo{run(n){const e=n.children.filter(i=>i instanceof Qr),r=e.pop();for(const i of e)this.setModified(),r.merge(i)}}class SP extends wo{run(n){const e=n.children.filter(i=>i instanceof _r),r={};for(const i of e){const a=wt(i.groupBy);a in r||(r[a]=[]),r[a].push(i)}for(const i of q(r)){const a=r[i];if(a.length>1){const o=a.pop();for(const s of a)o.merge(s)&&(n.removeChild(s),s.parent=o,s.remove(),this.setModified())}}}}class MP extends wo{constructor(n){super(),this.model=n}run(n){const e=!(_b(n)||n instanceof Ts||n instanceof Un||n instanceof _a),r=[],i=[];for(const a of n.children)a instanceof Zr&&(e&&!Cy(n.producedFields(),a.dependentFields())?r.push(a):i.push(a));if(r.length>0){const a=r.pop();for(const o of r)a.merge(o,this.model.renameSignal.bind(this.model));this.setModified(),n instanceof Zr?n.merge(a,this.model.renameSignal.bind(this.model)):a.swapWithParent()}if(i.length>1){const a=i.pop();for(const o of i)a.merge(o,this.model.renameSignal.bind(this.model));this.setModified()}}}class BP extends wo{run(n){const e=[...n.children];if(!ps(e,a=>a instanceof ye)||n.numChildren()<=1)return;const r=[];let i;for(const a of e)if(a instanceof ye){let o=a;for(;o.numChildren()===1;){const[s]=o.children;if(!(s instanceof ye))break;o=s}r.push(...o.children),i?(n.removeChild(a),a.parent=i.parent,i.parent.removeChild(i),i.parent=o,this.setModified()):i=o}else r.push(a);if(r.length){this.setModified();for(const a of r)a.parent.removeChild(a),a.parent=i}}}class Ao extends Nt{clone(){return new Ao(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}addDimensions(n){this.transform.groupby=Pr(this.transform.groupby.concat(n),e=>e)}dependentFields(){const n=new Set;return this.transform.groupby&&this.transform.groupby.forEach(n.add,n),this.transform.joinaggregate.map(e=>e.field).filter(e=>e!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(n){return n.as??Y(n)}hash(){return`JoinAggregateTransform ${wt(this.transform)}`}assemble(){const n=[],e=[],r=[];for(const a of this.transform.joinaggregate)e.push(a.op),r.push(this.getDefaultName(a)),n.push(a.field===void 0?null:a.field);const i=this.transform.groupby;return{type:"joinaggregate",as:r,ops:e,fields:n,...i!==void 0?{groupby:i}:{}}}}class Ls extends Nt{clone(){return new Ls(null,{...this.filter})}constructor(n,e){super(n),this.filter=e}static make(n,e,r){const{config:i,markDef:a}=e,{marks:o,scales:s}=r;if(o==="include-invalid-values"&&s==="include-invalid-values")return null;const u=e.reduceFieldDef((l,c,f)=>{const d=Ir(f)&&e.getScaleComponent(f);if(d){const h=d.get("type"),{aggregate:p}=c,m=pv({scaleChannel:f,markDef:a,config:i,scaleType:h,isCountAggregate:Ud(p)});m!=="show"&&m!=="always-valid"&&(l[c.field]=c)}return l},{});return q(u).length?new Ls(n,u):null}dependentFields(){return new Set(q(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${wt(this.filter)}`}assemble(){const n=q(this.filter).reduce((e,r)=>{const i=this.filter[r],a=Y(i,{expr:"datum"});return i!==null&&(i.type==="temporal"?e.push(`(isDate(${a}) || (${Fb(a)}))`):i.type==="quantitative"&&e.push(Fb(a))),e},[]);return n.length>0?{type:"filter",expr:n.join(" && ")}:null}}function Fb(t){return`isValid(${t}) && isFinite(+${t})`}class zi extends Nt{clone(){return new zi(null,ft(this._stack))}constructor(n,e){super(n),this._stack=e}static makeFromTransform(n,e){const{stack:r,groupby:i,as:a,offset:o="zero"}=e,s=[],u=[];if(e.sort!==void 0)for(const f of e.sort)s.push(f.field),u.push(un(f.order,"ascending"));const l={field:s,order:u};let c;return c=function(f){return P(f)&&f.every(d=>Q(d))&&f.length>1}(a)?a:Q(a)?[a,`${a}_end`]:[`${e.stack}_start`,`${e.stack}_end`],new zi(n,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:c})}static makeFromEncoding(n,e){const r=e.stack,{encoding:i}=e;if(!r)return null;const{groupbyChannels:a,fieldChannel:o,offset:s,impute:u}=r,l=a.map(h=>vr(i[h])).filter(h=>!!h),c=function(h){return h.stack.stackBy.reduce((p,m)=>{const g=Y(m.fieldDef);return g&&p.push(g),p},[])}(e),f=e.encoding.order;let d;if(P(f)||H(f))d=TE(f);else{const h=I3(f)?f.sort:o==="y"?"descending":"ascending";d=c.reduce((p,m)=>(p.field.includes(m)||(p.field.push(m),p.order.push(h)),p),{field:[],order:[]})}return new zi(n,{dimensionFieldDefs:l,stackField:e.vgField(o),facetby:[],stackby:c,sort:d,offset:s,impute:u,as:[e.vgField(o,{suffix:"start",forAs:!0}),e.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(n){this._stack.facetby.push(...n)}dependentFields(){const n=new Set;return n.add(this._stack.stackField),this.getGroupbyFields().forEach(n.add,n),this._stack.facetby.forEach(n.add,n),this._stack.sort.field.forEach(n.add,n),n}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${wt(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:n,impute:e,groupby:r}=this._stack;return n.length>0?n.map(i=>i.bin?e?[Y(i,{binSuffix:"mid"})]:[Y(i,{}),Y(i,{binSuffix:"end"})]:[Y(i)]).flat():r??[]}assemble(){const n=[],{facetby:e,dimensionFieldDefs:r,stackField:i,stackby:a,sort:o,offset:s,impute:u,as:l}=this._stack;if(u)for(const c of r){const{bandPosition:f=.5,bin:d}=c;if(d){const h=Y(c,{expr:"datum"}),p=Y(c,{expr:"datum",binSuffix:"end"});n.push({type:"formula",expr:`${Fb(h)} ? ${f}*${h}+${1-f}*${p} : ${h}`,as:Y(c,{binSuffix:"mid",forAs:!0})})}n.push({type:"impute",field:i,groupby:[...a,...e],key:Y(c,{binSuffix:"mid"}),method:"value",value:0})}return n.push({type:"stack",groupby:[...this.getGroupbyFields(),...e],field:i,sort:o,as:l,offset:s}),n}}class Ps extends Nt{clone(){return new Ps(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}addDimensions(n){this.transform.groupby=Pr(this.transform.groupby.concat(n),e=>e)}dependentFields(){const n=new Set;return(this.transform.groupby??[]).forEach(n.add,n),(this.transform.sort??[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>e!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(n){return n.as??Y(n)}hash(){return`WindowTransform ${wt(this.transform)}`}assemble(){const n=[],e=[],r=[],i=[];for(const f of this.transform.window)e.push(f.op),r.push(this.getDefaultName(f)),i.push(f.param===void 0?null:f.param),n.push(f.field===void 0?null:f.field);const a=this.transform.frame,o=this.transform.groupby;if(a&&a[0]===null&&a[1]===null&&e.every(f=>qd(f)))return{type:"joinaggregate",as:r,ops:e,fields:n,...o!==void 0?{groupby:o}:{}};const s=[],u=[];if(this.transform.sort!==void 0)for(const f of this.transform.sort)s.push(f.field),u.push(f.order??"ascending");const l={field:s,order:u},c=this.transform.ignorePeers;return{type:"window",params:i,as:r,ops:e,fields:n,sort:l,...c!==void 0?{ignorePeers:c}:{},...o!==void 0?{groupby:o}:{},...a!==void 0?{frame:a}:{}}}}function Cb(t){if(t instanceof Ns)if(t.numChildren()!==1||t.children[0]instanceof ye){const e=t.model.component.data.main;ES(e);const r=(n=t,function a(o){if(!(o instanceof Ns)){const s=o.clone();if(s instanceof ye){const u=Eb+s.getSource();s.setSource(u),n.model.component.data.outputNodes[u]=s}else(s instanceof _r||s instanceof zi||s instanceof Ps||s instanceof Ao)&&s.addDimensions(n.fields);for(const u of o.children.flatMap(a))u.parent=s;return[s]}return o.children.flatMap(a)}),i=t.children.map(r).flat();for(const a of i)a.parent=e}else{const e=t.children[0];(e instanceof _r||e instanceof zi||e instanceof Ps||e instanceof Ao)&&e.addDimensions(t.fields),e.swapWithParent(),Cb(t)}else t.children.map(Cb);var n}function ES(t){if(t instanceof ye&&t.type===Qt.Main&&t.numChildren()===1){const n=t.children[0];n instanceof Ns||(n.swapWithParent(),ES(t))}}const Eb="scale_";function $b(t){for(const n of t){for(const e of n.children)if(e.parent!==n)return!1;if(!$b(n.children))return!1}return!0}function Ar(t,n){let e=!1;for(const r of n)e=t.optimize(r)||e;return e}function $S(t,n,e){let r=t.sources,i=!1;return i=Ar(new DP,r)||i,i=Ar(new _P(n),r)||i,r=r.filter(a=>a.numChildren()>0),i=Ar(new EP,r)||i,r=r.filter(a=>a.numChildren()>0),e||(i=Ar(new FP,r)||i,i=Ar(new MP(n),r)||i,i=Ar(new kP,r)||i,i=Ar(new CP,r)||i,i=Ar(new SP,r)||i,i=Ar(new $P,r)||i,i=Ar(new AP,r)||i,i=Ar(new BP,r)||i),t.sources=r,i}class _n{constructor(n){Object.defineProperty(this,"signal",{enumerable:!0,get:n})}static fromName(n,e){return new _n(()=>n(e))}}function SS(t){Zt(t)?function(n){const e=n.component.scales;for(const r of q(e)){const i=zP(n,r);if(e[r].setWithExplicit("domains",i),OP(n,r),n.component.data.isFaceted){let a=n;for(;!$e(a)&&a.parent;)a=a.parent;if(a.component.resolve.scale[r]==="shared")for(const o of i.value)_i(o)&&(o.data=Eb+o.data.replace(Eb,""))}}}(t):function(n){for(const r of n.children)SS(r);const e=n.component.scales;for(const r of q(e)){let i,a=null;for(const o of n.children){const s=o.component.scales[r];if(s){i=i===void 0?s.getWithExplicit("domains"):xa(i,s.getWithExplicit("domains"),"domains","scale",Bb);const u=s.get("selectionExtent");a&&u&&a.param!==u.param&&I(zN),a=u}}e[r].setWithExplicit("domains",i),a&&e[r].set("selectionExtent",a,!0)}}(t)}function zP(t,n){const e=t.getScaleComponent(n).get("type"),{encoding:r}=t,i=function(a,o,s,u){if(a==="unaggregated"){const{valid:l,reason:c}=MS(o,s);if(!l)return void I(c)}else if(a===void 0&&u.useUnaggregatedDomain){const{valid:l}=MS(o,s);if(l)return"unaggregated"}return a}(t.scaleDomain(n),t.typedFieldDef(n),e,t.config.scale);return i!==t.scaleDomain(n)&&(t.specifiedScales[n]={...t.specifiedScales[n],domain:i}),n==="x"&&mn(r.x2)?mn(r.x)?xa(Aa(e,i,t,"x"),Aa(e,i,t,"x2"),"domain","scale",Bb):Aa(e,i,t,"x2"):n==="y"&&mn(r.y2)?mn(r.y)?xa(Aa(e,i,t,"y"),Aa(e,i,t,"y2"),"domain","scale",Bb):Aa(e,i,t,"y2"):Aa(e,i,t,n)}function Sb(t,n,e){var i;const r=(i=xn(e))==null?void 0:i.unit;return n==="temporal"||r?function(a,o,s){return a.map(u=>({signal:`{data: ${lh(u,{timeUnit:s,type:o})}}`}))}(t,n,r):[t]}function Aa(t,n,e,r){const{encoding:i,markDef:a,mark:o,config:s,stack:u}=e,l=mn(i[r]),{type:c}=l,f=l.timeUnit,d=function(m){const{marks:g,scales:y}=Z$(m);return g===y?Qt.Main:y==="include-invalid-values"?Qt.PreFilterInvalid:Qt.PostFilterInvalid}({invalid:Wr("invalid",a,s),isPath:ya(o)});if(function(m){return U(m,"unionWith")}(n)){const m=Aa(t,void 0,e,r);return Jr([...Sb(n.unionWith,c,f),...m.value])}if(it(n))return Jr([n]);if(n&&n!=="unaggregated"&&!A3(n))return Jr(Sb(n,c,f));if(u&&r===u.fieldChannel){if(u.offset==="normalize")return xr([[0,1]]);const m=e.requestDataName(d);return xr([{data:m,field:e.vgField(r,{suffix:"start"})},{data:m,field:e.vgField(r,{suffix:"end"})}])}const h=Ir(r)&&H(l)?function(m,g,y){if(!wn(y))return;const v=m.fieldDef(g),x=v.sort;if(j3(x))return{op:"min",field:zs(v,g),order:"ascending"};const{stack:b}=m,w=b?new Set([...b.groupbyFields,...b.stackBy.map(A=>A.fieldDef.field)]):void 0;if(ki(x))return Mb(x,b&&!w.has(x.field));if(function(A){return U(A,"encoding")}(x)){const{encoding:A,order:_}=x,k=m.fieldDef(A),{aggregate:F,field:C}=k,D=b&&!w.has(C);if(Ai(F)||ma(F))return Mb({field:Y(k),order:_},D);if(qd(F)||!F)return Mb({op:F,field:C,order:_},D)}else{if(x==="descending")return{op:"min",field:m.vgField(g),order:"descending"};if(vt(["ascending",void 0],x))return!0}}(e,r,t):void 0;if(Yr(l))return xr(Sb([l.datum],c,f));const p=l;if(n==="unaggregated"){const{field:m}=l;return xr([{data:e.requestDataName(d),field:Y({field:m,aggregate:"min"})},{data:e.requestDataName(d),field:Y({field:m,aggregate:"max"})}])}if(Wt(p.bin)){if(wn(t))return xr(t==="bin-ordinal"?[]:[{data:cl(h)?e.requestDataName(d):e.requestDataName(Qt.Raw),field:e.vgField(r,Dl(p,r)?{binSuffix:"range"}:{}),sort:h!==!0&&Z(h)?h:{field:e.vgField(r,{}),op:"min"}}]);{const{bin:m}=p;if(Wt(m)){const g=Ab(e,p.field,m);return xr([new _n(()=>{const y=e.getSignalName(g);return`[${y}.start, ${y}.stop]`})])}return xr([{data:e.requestDataName(d),field:e.vgField(r,{})}])}}if(p.timeUnit&&vt(["time","utc"],t)){const m=i[Ur(r)];if(U3(p,m,a,s)){const g=e.requestDataName(d),y=va({fieldDef:p,fieldDef2:m,markDef:a,config:s}),v=bl(o)&&y!==.5&&ln(r);return xr([{data:g,field:e.vgField(r,v?{suffix:vh}:{})},{data:g,field:e.vgField(r,{suffix:v?bh:"end"})}])}}return xr(h?[{data:cl(h)?e.requestDataName(d):e.requestDataName(Qt.Raw),field:e.vgField(r),sort:h}]:[{data:e.requestDataName(d),field:e.vgField(r)}])}function Mb(t,n){const{op:e,field:r,order:i}=t;return{op:e??(n?"sum":nh),...r?{field:He(r)}:{},...i?{order:i}:{}}}function OP(t,n){var s;const e=t.component.scales[n],r=t.specifiedScales[n].domain,i=(s=t.fieldDef(n))==null?void 0:s.bin,a=A3(r)?r:void 0,o=io(i)&&Id(i.extent)?i.extent:void 0;(a||o)&&e.set("selectionExtent",a??o,!0)}function MS(t,n){const{aggregate:e,type:r}=t;return e?Q(e)&&!FN.has(e)?{valid:!1,reason:LN(e)}:r==="quantitative"&&n==="log"?{valid:!1,reason:qN(t)}:{valid:!0}:{valid:!1,reason:jN(t)}}function Bb(t,n,e,r){return t.explicit&&n.explicit&&I(function(i,a,o,s){return`Conflicting ${a.toString()} property "${i.toString()}" (${Lt(o)} and ${Lt(s)}). Using the union of the two domains.`}(e,r,t.value,n.value)),{explicit:t.explicit,value:[...t.value,...n.value]}}function NP(t){const n=Pr(t.map(o=>{if(_i(o)){const{sort:s,...u}=o;return u}return o}),wt),e=Pr(t.map(o=>{if(_i(o)){const s=o.sort;return s===void 0||cl(s)||("op"in s&&s.op==="count"&&delete s.field,s.order==="ascending"&&delete s.order),s}}).filter(o=>o!==void 0),wt);if(n.length===0)return;if(n.length===1){const o=t[0];if(_i(o)&&e.length>0){let s=e[0];if(e.length>1){I(ZE);const u=e.filter(l=>Z(l)&&"op"in l&&l.op!=="min");s=!e.every(l=>Z(l)&&"op"in l)||u.length!==1||u[0]}else if(Z(s)&&"field"in s){const u=s.field;o.field===u&&(s=!s.order||{order:s.order})}return{...o,sort:s}}return o}const r=Pr(e.map(o=>cl(o)||!("op"in o)||Q(o.op)&&tt(_N,o.op)?o:(I(function(s){return`Dropping sort property ${Lt(s)} as unioned domains only support boolean or op "count", "min", and "max".`}(o)),!0)),wt);let i;r.length===1?i=r[0]:r.length>1&&(I(ZE),i=!0);const a=Pr(t.map(o=>_i(o)?o.data:null),o=>o);return a.length===1&&a[0]!==null?{data:a[0],fields:n.map(o=>o.field),...i?{sort:i}:{}}:{fields:n,...i?{sort:i}:{}}}function zb(t){if(_i(t)&&Q(t.field))return t.field;if(function(n){return!P(n)&&U(n,"fields")&&!U(n,"data")}(t)){let n;for(const e of t.fields)if(_i(e)&&Q(e.field))if(n){if(n!==e.field)return I("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),n}else n=e.field;return I("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),n}if(function(n){return!P(n)&&U(n,"fields")&&U(n,"data")}(t)){I("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const n=t.fields[0];return Q(n)?n:void 0}}function Oh(t,n){const e=t.component.scales[n].get("domains").map(r=>(_i(r)&&(r.data=t.lookupDataSource(r.data)),r));return NP(e)}function BS(t){return Rs(t)||Nb(t)?t.children.reduce((n,e)=>n.concat(BS(e)),zS(t)):zS(t)}function zS(t){return q(t.component.scales).reduce((n,e)=>{const r=t.component.scales[e];if(r.merged)return n;const i=r.combine(),{name:a,type:o,selectionExtent:s,domains:u,range:l,reverse:c,...f}=i,d=function(m,g,y,v){if(ln(y)){if(ao(m))return{step:{signal:`${g}_step`}}}else if(Z(m)&&_i(m))return{...m,data:v.lookupDataSource(m.data)};return m}(i.range,a,e,t),h=Oh(t,e),p=s?function(m,g,y,v){const x=J5(m,g.param,g);return{signal:mr(y.get("type"))&&P(v)&&v[0]>v[1]?`isValid(${x}) && reverse(${x})`:x}}(t,s,r,h):null;return n.push({name:a,type:o,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),n},[])}class OS extends Bi{constructor(n,e){super({},{name:n}),this.merged=!1,this.setWithExplicit("type",e)}domainHasZero(){const n=this.get("type");if(vt([XN,av,Yd],n))return"definitely-not";const e=this.get("zero");if(e===!0||e===void 0&&vt([m3,KN,JN],n))return"definitely";const r=this.get("domains");if(r.length>0){let i=!1,a=!1,o=!1;for(const s of r){if(P(s)){const u=s[0],l=s[s.length-1];if($t(u)&&$t(l)){if(u<=0&&l>=0){i=!0;continue}a=!0;continue}}o=!0}if(i)return"definitely";if(a&&!o)return"definitely-not"}return"maybe"}}const RP=["range","scheme"];function NS(t,n){const e=t.fieldDef(n);if(e!=null&&e.bin){const{bin:r,field:i}=e,a=ge(n),o=t.getName(a);if(Z(r)&&r.binned&&r.step!==void 0)return new _n(()=>{const s=t.scaleName(n),u=`(domain("${s}")[1] - domain("${s}")[0]) / ${r.step}`;return`${t.getSignalName(o)} / (${u})`});if(Wt(r)){const s=Ab(t,i,r);return new _n(()=>{const u=t.getSignalName(s),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${t.getSignalName(o)} / (${l})`})}}}function TP(t,n){const e=n.specifiedScales[t],{size:r}=n,i=n.getScaleComponent(t).get("type");for(const c of RP)if(e[c]!==void 0){const f=uv(i,c),d=_3(t,c);if(f)if(d)I(d);else switch(c){case"range":{const h=e.range;if(P(h)){if(ln(t))return Jr(h.map(p=>{if(p==="width"||p==="height"){const m=n.getName(p),g=n.getSignalName.bind(n);return _n.fromName(g,m)}return p}))}else if(Z(h))return Jr({data:n.requestDataName(Qt.Main),field:h.field,sort:{op:"min",field:n.vgField(t)}});return Jr(h)}case"scheme":return Jr(PP(e[c]))}else I(KE(i,c,t))}const a=t===Jt||t==="xOffset"?"width":"height",o=r[a];if(Xr(o)){if(ln(t))if(wn(i)){const c=TS(o,n,t);if(c)return Jr({step:c})}else I(QE(a));else if(gl(t)){const c=t===ua?"x":"y";if(n.getScaleComponent(c).get("type")==="band"){const f=PS(o,i);if(f)return Jr(f)}}}const{rangeMin:s,rangeMax:u}=e,l=function(c,f){const{size:d,config:h,mark:p,encoding:m}=f,{type:g}=mn(m[c]),y=f.getScaleComponent(c),v=y.get("type"),{domain:x,domainMid:b}=f.specifiedScales[c];switch(c){case Jt:case bn:if(vt(["point","band"],v)){const w=jS(c,d,h.view);if(Xr(w))return{step:TS(w,f,c)}}return RS(c,f,v);case ua:case ys:return function(w,A,_){const k=w===ua?"x":"y",F=A.getScaleComponent(k);if(!F)return RS(k,A,_,{center:!0});const C=F.get("type"),D=A.scaleName(k),{markDef:E,config:$}=A;if(C==="band"){const M=jS(k,A.size,A.config.view);if(Xr(M)){const S=PS(M,_);if(S)return S}return[0,{signal:`bandwidth('${D}')`}]}{const M=A.encoding[k];if(H(M)&&M.timeUnit){const S=c3(M.timeUnit,W=>`scale('${D}', ${W})`),B=A.config.scale.bandWithNestedOffsetPaddingInner,z=va({fieldDef:M,markDef:E,config:$})-.5,N=z!==0?` + ${z}`:"";return B?[{signal:`${it(B)?`${B.signal}/2`+N:`${B/2+z}`} * (${S})`},{signal:`${it(B)?`(1 - ${B.signal}/2)`+N:`${1-B/2+z}`} * (${S})`}]:[0,{signal:S}]}return sE(`Cannot use ${w} scale if ${k} scale is not discrete.`)}}(c,f,v);case bi:{const w=function(_,k){switch(_){case"bar":case"tick":return k.scale.minBandSize;case"line":case"trail":case"rule":return k.scale.minStrokeWidth;case"text":return k.scale.minFontSize;case"point":case"square":case"circle":return k.scale.minSize}throw new Error(Wd("size",_))}(p,h),A=function(_,k,F,C){const D={x:NS(F,"x"),y:NS(F,"y")};switch(_){case"bar":case"tick":{if(C.scale.maxBandSize!==void 0)return C.scale.maxBandSize;const E=qS(k,D,C.view);return $t(E)?E-1:new _n(()=>`${E.signal} - 1`)}case"line":case"trail":case"rule":return C.scale.maxStrokeWidth;case"text":return C.scale.maxFontSize;case"point":case"square":case"circle":{if(C.scale.maxSize)return C.scale.maxSize;const E=qS(k,D,C.view);return $t(E)?Math.pow(LS*E,2):new _n(()=>`pow(${LS} * ${E.signal}, 2)`)}}throw new Error(Wd("size",_))}(p,d,f,h);return As(v)?function(_,k,F){const C=()=>{const D=pr(k),E=pr(_),$=`(${D} - ${E}) / (${F} - 1)`;return`sequence(${E}, ${D} + ${$}, ${$})`};return it(k)?new _n(C):{signal:C()}}(w,A,function(_,k,F,C){switch(_){case"quantile":return k.scale.quantileCount;case"quantize":return k.scale.quantizeCount;case"threshold":return F!==void 0&&P(F)?F.length+1:(I(function(D){return`Domain for ${D} is required for threshold scale.`}(C)),3)}}(v,h,x,c)):[w,A]}case Ge:return[0,2*Math.PI];case no:return[0,360];case cr:return[0,new _n(()=>`min(${f.getSignalName($e(f.parent)?"child_width":"width")},${f.getSignalName($e(f.parent)?"child_height":"height")})/2`)];case la:return{step:1e3/h.scale.framesPerSecond};case da:return[h.scale.minStrokeWidth,h.scale.maxStrokeWidth];case ha:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case me:return"symbol";case pe:case Lr:case qr:return v==="ordinal"?g==="nominal"?"category":"ordinal":b!==void 0?"diverging":p==="rect"||p==="geoshape"?"heatmap":"ramp";case xi:case ca:case fa:return[h.scale.minOpacity,h.scale.maxOpacity]}}(t,n);return(s!==void 0||u!==void 0)&&uv(i,"rangeMin")&&P(l)&&l.length===2?Jr([s??l[0],u??l[1]]):xr(l)}function PP(t){return function(n){return!Q(n)&&U(n,"name")}(t)?{scheme:t.name,...he(t,["name"])}:{scheme:t}}function RS(t,n,e,{center:r}={}){const i=ge(t),a=n.getName(i),o=n.getSignalName.bind(n);return t===bn&&mr(e)?r?[_n.fromName(s=>`${o(s)}/2`,a),_n.fromName(s=>`-${o(s)}/2`,a)]:[_n.fromName(o,a),0]:r?[_n.fromName(s=>`-${o(s)}/2`,a),_n.fromName(s=>`${o(s)}/2`,a)]:[0,_n.fromName(o,a)]}function TS(t,n,e){const{encoding:r}=n,i=n.getScaleComponent(e),a=By(e),o=r[a];if(k$({step:t,offsetIsDiscrete:ht(o)&&p3(o.type)})==="offset"&&r$(r,a)){const s=n.getScaleComponent(a);let u=`domain('${n.scaleName(a)}').length`;s.get("type")==="band"&&(u=`bandspace(${u}, ${s.get("paddingInner")??s.get("padding")??0}, ${s.get("paddingOuter")??s.get("padding")??0})`);const l=i.get("paddingInner")??i.get("padding");return{signal:`${t.step} * ${u} / (1-${$N(l)})`}}return t.step}function PS(t,n){if(k$({step:t,offsetIsDiscrete:wn(n)})==="offset")return{step:t.step}}function jS(t,n,e){const r=t===Jt?"width":"height";return n[r]||mh(e,r)}const LS=.95;function qS(t,n,e){const r=Xr(t.width)?t.width.step:Tv(e,"width"),i=Xr(t.height)?t.height.step:Tv(e,"height");return n.x||n.y?new _n(()=>`min(${[n.x?n.x.signal:r,n.y?n.y.signal:i].join(", ")})`):Math.min(r,i)}function US(t,n){Zt(t)?function(e,r){const i=e.component.scales,{config:a,encoding:o,markDef:s,specifiedScales:u}=e;for(const l of q(i)){const c=u[l],f=i[l],d=e.getScaleComponent(l),h=mn(o[l]),p=c[r],m=d.get("type"),g=d.get("padding"),y=d.get("paddingInner"),v=uv(m,r),x=_3(l,r);if(p!==void 0&&(v?x&&I(x):I(KE(m,r,l))),v&&x===void 0)if(p!==void 0){const b=h.timeUnit,w=h.type;switch(r){case"domainMax":case"domainMin":oo(c[r])||w==="temporal"||b?f.set(r,{signal:lh(c[r],{type:w,timeUnit:b})},!0):f.set(r,c[r],!0);break;default:f.copyKeyFromObject(r,c)}}else{const b=U(IS,r)?IS[r]({model:e,channel:l,fieldOrDatumDef:h,scaleType:m,scalePadding:g,scalePaddingInner:y,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:s,config:a,hasNestedOffsetScale:i$(o,l),hasSecondaryRangeChannel:!!o[Ur(l)]}):a.scale[r];b!==void 0&&f.set(r,b,!1)}}}(t,n):HS(t,n)}const IS={bins:({model:t,fieldOrDatumDef:n})=>H(n)?function(e,r){const i=r.bin;if(Wt(i)){const a=Ab(e,r.field,i);return new _n(()=>e.getSignalName(a))}if($n(i)&&io(i)&&i.step!==void 0)return{step:i.step}}(t,n):void 0,interpolate:({channel:t,fieldOrDatumDef:n})=>function(e,r){if(vt([pe,Lr,qr],e)&&r!=="nominal")return"hcl"}(t,n.type),nice:({scaleType:t,channel:n,domain:e,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>function(o,s,u,l,c,f){var d;if(!((d=vr(f))!=null&&d.bin||P(u)||c!=null||l!=null||vt([av,Yd],o)))return!!ln(s)||void 0}(t,n,e,r,i,a),padding:({channel:t,scaleType:n,fieldOrDatumDef:e,markDef:r,config:i})=>function(a,o,s,u,l,c){if(ln(a)){if(Gr(o)){if(s.continuousPadding!==void 0)return s.continuousPadding;const{type:f,orient:d}=l;if(f==="bar"&&(!H(u)||!u.bin&&!u.timeUnit)&&(d==="vertical"&&a==="x"||d==="horizontal"&&a==="y"))return c.continuousBandSize}if(o===g3)return s.pointPadding}}(t,n,i.scale,e,r,i.bar),paddingInner:({scalePadding:t,channel:n,markDef:e,scaleType:r,config:i,hasNestedOffsetScale:a})=>function(o,s,u,l,c,f=!1){if(o===void 0){if(ln(s)){const{bandPaddingInner:d,barBandPaddingInner:h,rectBandPaddingInner:p,tickBandPaddingInner:m,bandWithNestedOffsetPaddingInner:g}=c;return f?g:un(d,u==="bar"?h:u==="tick"?m:p)}if(gl(s)&&l===ov)return c.offsetBandPaddingInner}}(t,n,e.type,r,i.scale,a),paddingOuter:({scalePadding:t,channel:n,scaleType:e,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>function(o,s,u,l,c,f=!1){if(o===void 0){if(ln(s)){const{bandPaddingOuter:d,bandWithNestedOffsetPaddingOuter:h}=c;if(f)return h;if(u===ov)return un(d,it(l)?{signal:`${l.signal}/2`}:l/2)}else if(gl(s)){if(u===g3)return .5;if(u===ov)return c.offsetBandPaddingOuter}}}(t,n,e,r,i.scale,a),reverse:({fieldOrDatumDef:t,scaleType:n,channel:e,config:r})=>function(i,a,o,s){if(o==="x"&&s.xReverse!==void 0)return mr(i)&&a==="descending"?it(s.xReverse)?{signal:`!${s.xReverse.signal}`}:!s.xReverse:s.xReverse;if(mr(i)&&a==="descending")return!0}(n,H(t)?t.sort:void 0,e,r.scale),zero:({channel:t,fieldOrDatumDef:n,domain:e,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:o})=>function(s,u,l,c,f,d,h){if(l&&l!=="unaggregated"&&mr(f)){if(P(l)){const p=l[0],m=l[l.length-1];if($t(p)&&p<=0&&$t(m)&&m>=0)return!0}return!1}if(s==="size"&&u.type==="quantitative"&&!As(f))return!0;if((!H(u)||!u.bin)&&vt([...wi,...vN],s)){const{orient:p,type:m}=c;return(!vt(["bar","area","line","trail"],m)||!(p==="horizontal"&&s==="y"||p==="vertical"&&s==="x"))&&(!(!vt(["bar","area"],m)||h)||(d==null?void 0:d.zero))}return!1}(t,n,e,r,i,a.scale,o)};function WS(t){Zt(t)?function(n){const e=n.component.scales;for(const r of Ty){const i=e[r];if(!i)continue;const a=TP(r,n);i.setWithExplicit("range",a)}}(t):HS(t,"range")}function HS(t,n){const e=t.component.scales;for(const r of t.children)n==="range"?WS(r):US(r,n);for(const r of q(e)){let i;for(const a of t.children){const o=a.component.scales[r];o&&(i=xa(i,o.getWithExplicit(n),n,"scale",X$((s,u)=>n==="range"&&s.step&&u.step?s.step-u.step:0)))}e[r].setWithExplicit(n,i)}}function jP(t,n,e,r,i=!1){const a=function(l,c,f,d){var h;switch(c.type){case"nominal":case"ordinal":if(bs(l)||Py(l)==="discrete")return l==="shape"&&c.type==="ordinal"&&I(Hy(l,"ordinal")),"ordinal";if(Ry(l))return"band";if(ln(l)||gl(l)){if(vt(["rect","bar","image","rule","tick"],f.type)||d)return"band"}else if(f.type==="arc"&&l in Ny)return"band";return co(f[ge(l)])||ks(c)&&((h=c.axis)!=null&&h.tickBand)?"band":"point";case"temporal":return bs(l)?"time":Py(l)==="discrete"?(I(Hy(l,"temporal")),"ordinal"):H(c)&&c.timeUnit&&xn(c.timeUnit).utc?"utc":Ry(l)?"band":"time";case"quantitative":return bs(l)?H(c)&&Wt(c.bin)?"bin-ordinal":"linear":Py(l)==="discrete"?(I(Hy(l,"quantitative")),"ordinal"):Ry(l)?"band":"linear";case"geojson":return}throw new Error(XE(c.type))}(n,e,r,i),{type:o}=t;return Ir(n)?o!==void 0?function(l,c,f=!1){if(!Ir(l))return!1;switch(l){case Jt:case bn:case ua:case ys:case Ge:case cr:return!!Gr(c)||c==="band"||c==="point"&&!f;case la:return vt(["linear","band"],c);case bi:case da:case xi:case ca:case fa:case no:return Gr(c)||As(c)||vt(["band","point","ordinal"],c);case pe:case Lr:case qr:return c!=="band";case ha:case me:return c==="ordinal"||As(c)}}(n,o)?H(e)&&(s=o,u=e.type,!(vt([rv,iv],u)?s===void 0||wn(s):u===xs?vt([av,Yd,void 0],s):u!==lo||x3(s)||As(s)||s===void 0))?(I(function(l,c){return`FieldDef does not work with "${l}" scale. We are using "${c}" scale instead.`}(o,a)),a):o:(I(function(l,c,f){return`Channel "${l}" does not work with "${c}" scale. We are using "${f}" scale instead.`}(n,o,a)),a):a:null;var s,u}function GS(t){Zt(t)?t.component.scales=function(n){const{encoding:e,mark:r,markDef:i}=n,a={};for(const o of Ty){const s=mn(e[o]);if(s&&r===F3&&o===me&&s.type===ws)continue;let u=s&&s.scale;if(s&&u!==null&&u!==!1){u??(u={});const l=jP(u,o,s,i,i$(e,o));a[o]=new OS(n.scaleName(`${o}`,!0),{value:l,explicit:u.type===l})}}return a}(t):t.component.scales=function(n){var e;const r=n.component.scales={},i={},a=n.component.resolve;for(const o of n.children){GS(o);for(const s of q(o.component.scales))if((e=a.scale)[s]??(e[s]=cS(s,n)),a.scale[s]==="shared"){const u=i[s],l=o.component.scales[s].getWithExplicit("type");u?QN(u.value,l.value)?i[s]=xa(u,l,"type","scale",LP):(a.scale[s]="independent",delete i[s]):i[s]=l}}for(const o of q(i)){const s=n.scaleName(o,!0),u=i[o];r[o]=new OS(s,u);for(const l of n.children){const c=l.component.scales[o];c&&(l.renameScale(c.get("name"),s),c.merged=!0)}}return r}(t)}const LP=X$((t,n)=>y3(t)-y3(n));class Ob{constructor(){this.nameMap={}}rename(n,e){this.nameMap[n]=e}has(n){return this.nameMap[n]!==void 0}get(n){for(;this.nameMap[n]&&n!==this.nameMap[n];)n=this.nameMap[n];return n}}function Zt(t){return(t==null?void 0:t.type)==="unit"}function $e(t){return(t==null?void 0:t.type)==="facet"}function Nb(t){return(t==null?void 0:t.type)==="concat"}function Rs(t){return(t==null?void 0:t.type)==="layer"}class Rb{constructor(n,e,r,i,a,o,s){this.type=e,this.parent=r,this.config=a,this.parent=r,this.config=a,this.view=Sn(s),this.name=n.name??i,this.title=ga(n.title)?{text:n.title}:n.title?Sn(n.title):void 0,this.scaleNameMap=r?r.scaleNameMap:new Ob,this.projectionNameMap=r?r.projectionNameMap:new Ob,this.signalNameMap=r?r.signalNameMap:new Ob,this.data=n.data,this.description=n.description,this.transforms=function(u){return u.map(l=>Uv(l)?{filter:ds(l.filter,VN)}:l)}(n.transform??[]),this.layout=e==="layer"||e==="unit"?{}:function(u,l,c){const f=c[l],d={},{spacing:h,columns:p}=f;h!==void 0&&(d.spacing=h),p!==void 0&&(eh(u)&&!Al(u.facet)||Ov(u))&&(d.columns=p),ph(u)&&(d.columns=1);for(const m of CR)if(u[m]!==void 0)if(m==="spacing"){const g=u[m];d[m]=$t(g)?g:{row:g.row??h,column:g.column??h}}else d[m]=u[m];return d}(n,e,a),this.component={data:{sources:r?r.component.data.sources:[],outputNodes:r?r.component.data.outputNodes:{},outputNodeRefCounts:r?r.component.data.outputNodeRefCounts:{},isFaceted:eh(n)||(r==null?void 0:r.component.data.isFaceted)&&n.data===void 0},layoutSize:new Bi,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?ft(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){(function(n,{ignoreRange:e}={}){GS(n),SS(n);for(const r of rR)US(n,r);e||WS(n)})(this)}parseProjection(){_S(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){vS(this)}assembleEncodeFromView(n){const{style:e,...r}=n,i={};for(const a of q(r)){const o=r[a];o!==void 0&&(i[a]=Gt(o))}return i}assembleGroupEncodeEntry(n){let e={};return this.view&&(e=this.assembleEncodeFromView(this.view)),n||(this.description&&(e.description=Gt(this.description)),this.type!=="unit"&&this.type!=="layer")?jt(e)?void 0:e:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...e}}assembleLayout(){if(!this.layout)return;const{spacing:n,...e}=this.layout,{component:r,config:i}=this,a=function(o,s){const u={};for(const l of Ye){const c=o[l];if(c!=null&&c.facetFieldDef){const{titleAnchor:f,titleOrient:d}=Bh(["titleAnchor","titleOrient"],c.facetFieldDef.header,s,l),h=Mh(l,d),p=uP(f,h);p!==void 0&&(u[h]=p)}}return jt(u)?void 0:u}(r.layoutHeaders,i);return{padding:n,...this.assembleDefaultLayout(),...e,...a?{titleBand:a}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:n}=this.component;let e=[];for(const r of Ye)n[r].title&&e.push(rP(this,r));for(const r of gb)e=e.concat(iP(this,r));return e}assembleAxes(){return function(n,e){const{x:r=[],y:i=[]}=n;return[...r.map(a=>Rl(a,"grid",e)),...i.map(a=>Rl(a,"grid",e)),...r.map(a=>Rl(a,"main",e)),...i.map(a=>Rl(a,"main",e))].filter(a=>a)}(this.component.axes,this.config)}assembleLegends(){return xS(this)}assembleProjections(){return mP(this)}assembleTitle(){const{encoding:n,...e}=this.title??{},r={...ME(this.config.title).nonMarkTitleProperties,...e,...n?{encode:{update:n}}:{}};if(r.text)return vt(["unit","layer"],this.type)?vt(["middle",void 0],r.anchor)&&(r.frame??(r.frame="group")):r.anchor??(r.anchor="start"),jt(r)?void 0:r}assembleGroup(n=[]){const e={};(n=n.concat(this.assembleSignals())).length>0&&(e.signals=n);const r=this.assembleLayout();r&&(e.layout=r),e.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||$e(this.parent)?BS(this):[];i.length>0&&(e.scales=i);const a=this.assembleAxes();a.length>0&&(e.axes=a);const o=this.assembleLegends();return o.length>0&&(e.legends=o),e}getName(n){return Xt((this.name?`${this.name}_`:"")+n)}getDataName(n){return this.getName(Qt[n].toLowerCase())}requestDataName(n){const e=this.getDataName(n),r=this.component.data.outputNodeRefCounts;return r[e]=(r[e]||0)+1,e}getSizeSignalRef(n){if($e(this.parent)){const e=Ld(uS(n)),r=this.component.scales[e];if(r&&!r.merged){const i=r.get("type"),a=r.get("range");if(wn(i)&&ao(a)){const o=r.get("name"),s=zb(Oh(this,e));return s?{signal:sS(o,r,Y({aggregate:"distinct",field:s},{expr:"datum"}))}:(I(Uy(e)),null)}}}return{signal:this.signalNameMap.get(this.getName(n))}}lookupDataSource(n){const e=this.component.data.outputNodes[n];return e?e.getSource():n}getSignalName(n){return this.signalNameMap.get(n)}renameSignal(n,e){this.signalNameMap.rename(n,e)}renameScale(n,e){this.scaleNameMap.rename(n,e)}renameProjection(n,e){this.projectionNameMap.rename(n,e)}scaleName(n,e){return e?this.getName(n):wE(n)&&Ir(n)&&this.component.scales[n]||this.scaleNameMap.has(this.getName(n))?this.scaleNameMap.get(this.getName(n)):void 0}projectionName(n){return n?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(n){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const e=this.component.scales[n];return e&&!e.merged?e:this.parent?this.parent.getScaleComponent(n):void 0}getScaleType(n){const e=this.getScaleComponent(n);return e?e.get("type"):void 0}getSelectionComponent(n,e){let r=this.component.selection[n];if(!r&&this.parent&&(r=this.parent.getSelectionComponent(n,e)),!r)throw new Error(`Cannot find a selection named "${e}".`);return r}hasAxisOrientSignalRef(){var n,e;return((n=this.component.axes.x)==null?void 0:n.some(r=>r.hasOrientSignalRef()))||((e=this.component.axes.y)==null?void 0:e.some(r=>r.hasOrientSignalRef()))}}class VS extends Rb{vgField(n,e={}){const r=this.fieldDef(n);if(r)return Y(r,e)}reduceFieldDef(n,e){return function(r,i,a,o){return r?q(r).reduce((s,u)=>{const l=r[u];return P(l)?l.reduce((c,f)=>i.call(o,c,f,u),s):i.call(o,s,l,u)},a):a}(this.getMapping(),(r,i,a)=>{const o=vr(i);return o?n(r,o,a):r},e)}forEachFieldDef(n,e){kv(this.getMapping(),(r,i)=>{const a=vr(r);a&&n(a,i)},e)}}class Lh extends Nt{clone(){return new Lh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"value",r[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${wt(this.transform)}`}assemble(){const{density:n,...e}=this.transform,r={type:"kde",field:n,...e};return r.resolve=this.transform.resolve,r}}class qh extends Nt{clone(){return new qh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${wt(this.transform)}`}assemble(){const{extent:n,param:e}=this.transform;return{type:"extent",field:n,signal:e}}}class Uh extends Nt{clone(){return new Uh(this.parent,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const{flatten:r,as:i=[]}=this.transform;this.transform.as=r.map((a,o)=>i[o]??a)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${wt(this.transform)}`}assemble(){const{flatten:n,as:e}=this.transform;return{type:"flatten",fields:n,as:e}}}class Ih extends Nt{clone(){return new Ih(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"key",r[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${wt(this.transform)}`}assemble(){const{fold:n,as:e}=this.transform;return{type:"fold",fields:n,as:e}}}class qs extends Nt{clone(){return new qs(null,ft(this.fields),this.geojson,this.signal)}static parseAll(n,e){if(e.component.projection&&!e.component.projection.isFit)return n;let r=0;for(const i of[[dr,fr],[Ve,hr]]){const a=i.map(o=>{const s=mn(e.encoding[o]);return H(s)?s.field:Yr(s)?{expr:`${s.datum}`}:yr(s)?{expr:`${s.value}`}:void 0});(a[0]||a[1])&&(n=new qs(n,a,null,e.getName("geojson_"+r++)))}if(e.channelHasField(me)){const i=e.typedFieldDef(me);i.type===ws&&(n=new qs(n,null,i.field,e.getName("geojson_"+r++)))}return n}constructor(n,e,r,i){super(n),this.fields=e,this.geojson=r,this.signal=i}dependentFields(){const n=(this.fields??[]).filter(Q);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${wt(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class ql extends Nt{clone(){return new ql(null,this.projection,ft(this.fields),ft(this.as))}constructor(n,e,r,i){super(n),this.projection=e,this.fields=r,this.as=i}static parseAll(n,e){if(!e.projectionName())return n;for(const r of[[dr,fr],[Ve,hr]]){const i=r.map(o=>{const s=mn(e.encoding[o]);return H(s)?s.field:Yr(s)?{expr:`${s.datum}`}:yr(s)?{expr:`${s.value}`}:void 0}),a=r[0]===Ve?"2":"";(i[0]||i[1])&&(n=new ql(n,e.projectionName(),i,[e.getName(`x${a}`),e.getName(`y${a}`)]))}return n}dependentFields(){return new Set(this.fields.filter(Q))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${wt(this.fields)} ${wt(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class _o extends Nt{clone(){return new _o(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(n){const{start:e=0,stop:r,step:i}=n;return{signal:`sequence(${[e,r,...i?[i]:[]].join(",")})`}}static makeFromTransform(n,e){return new _o(n,e)}static makeFromEncoding(n,e){const r=e.encoding,i=r.x,a=r.y;if(H(i)&&H(a)){const o=i.impute?i:a.impute?a:void 0;if(o===void 0)return;const s=i.impute?a:a.impute?i:void 0,{method:u,value:l,frame:c,keyvals:f}=o.impute,d=s$(e.mark,r);return new _o(n,{impute:o.field,key:s.field,...u?{method:u}:{},...l!==void 0?{value:l}:{},...c?{frame:c}:{},...f!==void 0?{keyvals:f}:{},...d.length?{groupby:d}:{}})}return null}hash(){return`Impute ${wt(this.transform)}`}assemble(){const{impute:n,key:e,keyvals:r,method:i,groupby:a,value:o,frame:s=[null,null]}=this.transform,u={type:"impute",field:n,key:e,...r?{keyvals:(l=r,U(l,"stop")?this.processSequence(r):r)}:{},method:"value",...a?{groupby:a}:{},value:i&&i!=="value"?null:o};var l;return i&&i!=="value"?[u,{type:"window",as:[`imputed_${n}_value`],ops:[i],fields:[n],frame:s,ignorePeers:!1,...a?{groupby:a}:{}},{type:"formula",expr:`datum.${n} === null ? datum.imputed_${n}_value : datum.${n}`,as:n}]:[u]}}class Wh extends Nt{clone(){return new Wh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??e.on,r[1]??e.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${wt(this.transform)}`}assemble(){const{loess:n,on:e,...r}=this.transform;return{type:"loess",x:e,y:n,...r}}}class Ul extends Nt{clone(){return new Ul(null,ft(this.transform),this.secondary)}constructor(n,e,r){super(n),this.transform=e,this.secondary=r}static make(n,e,r,i){const a=e.component.data.sources,{from:o}=r;let s=null;if(function(u){return U(u,"data")}(o)){let u=KS(o.data,a);u||(u=new xo(o.data),a.push(u));const l=e.getName(`lookup_${i}`);s=new ye(u,l,Qt.Lookup,e.component.data.outputNodeRefCounts),e.component.data.outputNodes[l]=s}else if(function(u){return U(u,"param")}(o)){const u=o.param;let l;r={as:u,...r};try{l=e.getSelectionComponent(Xt(u),u)}catch{throw new Error(`Lookups can only be performed on selection parameters. "${u}" is a variable parameter.`)}if(s=l.materialized,!s)throw new Error(function(c){return`Cannot define and lookup the "${c}" selection in the same view. Try moving the lookup into a second, layered view?`}(u))}return new Ul(n,r,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?K(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${wt({transform:this.transform,secondary:this.secondary})}`}assemble(){let n;if(this.transform.from.fields)n={values:this.transform.from.fields,...this.transform.as?{as:K(this.transform.as)}:{}};else{let e=this.transform.as;Q(e)||(I('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),e="_lookup"),n={as:[e]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...n,...this.transform.default?{default:this.transform.default}:{}}}}class Hh extends Nt{clone(){return new Hh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"prob",r[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${wt(this.transform)}`}assemble(){const{quantile:n,...e}=this.transform;return{type:"quantile",field:n,...e}}}class Gh extends Nt{clone(){return new Gh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??e.on,r[1]??e.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${wt(this.transform)}`}assemble(){const{regression:n,on:e,...r}=this.transform;return{type:"regression",x:e,y:n,...r}}}class Vh extends Nt{clone(){return new Vh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}addDimensions(n){this.transform.groupby=Pr((this.transform.groupby??[]).concat(n),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${wt(this.transform)}`}assemble(){const{pivot:n,value:e,groupby:r,limit:i,op:a}=this.transform;return{type:"pivot",field:n,value:e,...i!==void 0?{limit:i}:{},...a!==void 0?{op:a}:{},...r!==void 0?{groupby:r}:{}}}}class Yh extends Nt{clone(){return new Yh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${wt(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function YS(t){let n=0;return function e(r,i){if(r instanceof xo&&!r.isGenerator&&!$s(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof Un&&(r.parent instanceof xo&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof Ns)return i.name||(i.name="data_"+n++),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void t.push(...r.assemble());switch((r instanceof Pl||r instanceof jl||r instanceof Ls||r instanceof Ts||r instanceof js||r instanceof ql||r instanceof _r||r instanceof Ul||r instanceof Ps||r instanceof Ao||r instanceof Ih||r instanceof Uh||r instanceof Lh||r instanceof Wh||r instanceof Hh||r instanceof Gh||r instanceof _a||r instanceof Yh||r instanceof Vh||r instanceof qh)&&i.transform.push(r.assemble()),(r instanceof Zr||r instanceof Qr||r instanceof _o||r instanceof zi||r instanceof qs)&&i.transform.push(...r.assemble()),r instanceof ye&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof ye?r.setSource(i.name):(i.name||(i.name="data_"+n++),r.setSource(i.name),r.numChildren()===1&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof ye&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:e(r.children[0],i);break;default:{i.name||(i.name="data_"+n++);let a=i.name;!i.source||i.transform.length>0?t.push(i):a=i.source;for(const o of r.children)e(o,{name:null,source:a,transform:[]});break}}}}function qP(t){return t==="top"||t==="left"||it(t)?"header":"footer"}function UP(t,n){var o;const{facet:e,config:r,child:i,component:a}=t;if(t.channelHasField(n)){const s=e[n],u=Os("title",null,r,n);let l=Ds(s,r,{allowDisabling:!0,includeDefault:u===void 0||!!u});i.component.layoutHeaders[n].title&&(l=P(l)?l.join(", "):l,l+=` / ${i.component.layoutHeaders[n].title}`,i.component.layoutHeaders[n].title=null);const c=Os("labelOrient",s.header,r,n),f=s.header!==null&&un((o=s.header)==null?void 0:o.labels,r.header.labels,!0),d=vt(["bottom","right"],c)?"footer":"header";a.layoutHeaders[n]={title:s.header!==null?l:null,facetFieldDef:s,[d]:n==="facet"?[]:[XS(t,n,f)]}}}function XS(t,n,e){const r=n==="row"?"height":"width";return{labels:e,sizeSignal:t.child.component.layoutSize.get(r)?t.child.getSizeSignalRef(r):void 0,axes:[]}}function JS(t,n){const{child:e}=t;if(e.component.axes[n]){const{layoutHeaders:r,resolve:i}=t.component;if(i.axis[n]=xb(i,n),i.axis[n]==="shared"){const a=n==="x"?"column":"row",o=r[a];for(const s of e.component.axes[n]){const u=qP(s.get("orient"));o[u]??(o[u]=[XS(t,a,!1)]);const l=Rl(s,"main",t.config,{header:!0});l&&o[u][0].axes.push(l),s.mainExtracted=!0}}}}function Tb(t){for(const n of t.children)n.parseLayoutSize()}function Nh(t,n){const e=uS(n),r=Ld(e),i=t.component.resolve,a=t.component.layoutSize;let o;for(const s of t.children){const u=s.component.layoutSize.getWithExplicit(e),l=i.scale[r]??cS(r,t);if(l==="independent"&&u.value==="step"){o=void 0;break}if(o){if(l==="independent"&&o.value!==u.value){o=void 0;break}o=xa(o,u,e,"")}else o=u}if(o){for(const s of t.children)t.renameSignal(s.getName(e),t.getName(n)),s.component.layoutSize.set(e,"merged",!1);a.setWithExplicit(n,o)}else a.setWithExplicit(n,{explicit:!1,value:void 0})}function IP(t,n){const e=n==="width"?"x":"y",r=t.config,i=t.getScaleComponent(e);if(i){const a=i.get("type"),o=i.get("range");if(wn(a)){const s=mh(r.view,n);return ao(o)||Xr(s)?"step":s}return Rv(r.view,n)}if(t.hasProjection||t.mark==="arc")return Rv(r.view,n);{const a=mh(r.view,n);return Xr(a)?a.step:a}}function Pb(t,n,e){return Y(n,{suffix:`by_${Y(t)}`,...e})}class Ll extends VS{constructor(n,e,r,i){super(n,"facet",e,r,i,n.resolve),this.child=qb(n.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(n.facet)}initFacet(n){if(!Al(n))return{facet:this.initFacetFieldDef(n,"facet")};const e=q(n),r={};for(const i of e){if(![mi,gi].includes(i)){I(Wd(i,"facet"));break}const a=n[i];if(a.field===void 0){I(Wy(a,i));break}r[i]=this.initFacetFieldDef(a,i)}return r}initFacetFieldDef(n,e){const r=_v(n,e);return r.header?r.header=Sn(r.header):r.header===null&&(r.header=null),r}channelHasField(n){return U(this.facet,n)}fieldDef(n){return this.facet[n]}parseData(){this.component.data=Rh(this),this.child.parseData()}parseLayoutSize(){Tb(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some(n=>Kr(n))&&Gy(Iy)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(n){for(const e of Ye)UP(n,e);JS(n,"x"),JS(n,"y")}(this)}assembleSelectionTopLevelSignals(n){return this.child.assembleSelectionTopLevelSignals(n)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(n){return this.child.assembleSelectionData(n)}getHeaderLayoutMixins(){const n={};for(const e of Ye)for(const r of yb){const i=this.component.layoutHeaders[e],a=i[r],{facetFieldDef:o}=i;if(o){const s=Os("titleOrient",o.header,this.config,e);if(["right","bottom"].includes(s)){const u=Mh(e,s);n.titleAnchor??(n.titleAnchor={}),n.titleAnchor[u]="end"}}if(a!=null&&a[0]){const s=e==="row"?"height":"width",u=r==="header"?"headerBand":"footerBand";e==="facet"||this.child.component.layoutSize.get(s)||(n[u]??(n[u]={}),n[u][e]=.5),i.title&&(n.offset??(n.offset={}),n.offset[e==="row"?"rowTitle":"columnTitle"]=10)}}return n}assembleDefaultLayout(){const{column:n,row:e}=this.facet,r=n?this.columnDistinctSignal():e?1:void 0;let i="all";return(e||this.component.resolve.scale.x!=="independent")&&(n||this.component.resolve.scale.y!=="independent")||(i="none"),{...this.getHeaderLayoutMixins(),...r?{columns:r}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Ll))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(n){return this.parent&&this.parent instanceof Ll?{...this.channelHasField("column")?{encode:{update:{columns:{field:Y(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(n)}:super.assembleGroup(n)}getCardinalityAggregateForChild(){const n=[],e=[],r=[];if(this.child instanceof Ll){if(this.child.channelHasField("column")){const i=Y(this.child.facet.column);n.push(i),e.push("distinct"),r.push(`distinct_${i}`)}}else for(const i of wi){const a=this.child.component.scales[i];if(a&&!a.merged){const o=a.get("type"),s=a.get("range");if(wn(o)&&ao(s)){const u=zb(Oh(this.child,i));u?(n.push(u),e.push("distinct"),r.push(`distinct_${u}`)):I(Uy(i))}}}return{fields:n,ops:e,as:r}}assembleFacet(){const{name:n,data:e}=this.component.data.facetRoot,{row:r,column:i}=this.facet,{fields:a,ops:o,as:s}=this.getCardinalityAggregateForChild(),u=[];for(const c of Ye){const f=this.facet[c];if(f){u.push(Y(f));const{bin:d,sort:h}=f;if(Wt(d)&&u.push(Y(f,{binSuffix:"end"})),ki(h)){const{field:p,op:m=nh}=h,g=Pb(f,h);r&&i?(a.push(g),o.push("max"),s.push(g)):(a.push(p),o.push(m),s.push(g))}else if(P(h)){const p=zs(f,c);a.push(p),o.push("max"),s.push(p)}}}const l=!!r&&!!i;return{name:n,data:e,groupby:u,...l||a.length>0?{aggregate:{...l?{cross:l}:{},...a.length?{fields:a,ops:o,as:s}:{}}}:{}}}facetSortFields(n){const{facet:e}=this,r=e[n];return r?ki(r.sort)?[Pb(r,r.sort,{expr:"datum"})]:P(r.sort)?[zs(r,n,{expr:"datum"})]:[Y(r,{expr:"datum"})]:[]}facetSortOrder(n){const{facet:e}=this,r=e[n];if(r){const{sort:i}=r;return[(ki(i)?i.order:!P(i)&&i)||"ascending"]}return[]}assembleLabelTitle(){var i;const{facet:n,config:e}=this;if(n.facet)return vb(n.facet,"facet",e);const r={row:["top","bottom"],column:["left","right"]};for(const a of gb)if(n[a]){const o=Os("labelOrient",(i=n[a])==null?void 0:i.header,e,a);if(r[a].includes(o))return vb(n[a],a,e)}}assembleMarks(){const{child:n}=this,e=function(s){const u=[],l=YS(u);for(const c of s.children)l(c,{source:s.name,name:null,transform:[]});return u}(this.component.data.facetRoot),r=n.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||n.assembleTitle(),a=n.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:Ye.map(s=>this.facetSortFields(s)).flat(),order:Ye.map(s=>this.facetSortOrder(s)).flat()},...e.length>0?{data:e}:{},...r?{encode:{update:r}}:{},...n.assembleGroup(gT(this,[]))}]}getMapping(){return this.facet}}function KS(t,n){var e,r,i,a;for(const o of n){const s=o.data;if(t.name&&o.hasName()&&t.name!==o.dataName)continue;const u=(e=t.format)==null?void 0:e.mesh,l=(r=s.format)==null?void 0:r.feature;if(u&&l)continue;const c=(i=t.format)==null?void 0:i.feature;if((c||l)&&c!==l)continue;const f=(a=s.format)==null?void 0:a.mesh;if(!u&&!f||u===f){if(Cl(t)&&Cl(s)){if(Ce(t.values,s.values))return o}else if($s(t)&&$s(s)){if(t.url===s.url)return o}else if(J$(t)&&t.name===o.dataName)return o}}return null}function Rh(t){var m;let n=function(g,y){if(g.data||!g.parent){if(g.data===null){const x=new xo({values:[]});return y.push(x),x}const v=KS(g.data,y);if(v)return wa(g.data)||(v.data.format=uE({},g.data.format,v.data.format)),!v.hasName()&&g.data.name&&(v.dataName=g.data.name),v;{const x=new xo(g.data);return y.push(x),x}}return g.parent.component.data.facetRoot?g.parent.component.data.facetRoot:g.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:e,outputNodeRefCounts:r}=t.component.data,i=t.data,a=!(i&&(wa(i)||$s(i)||Cl(i)))&&t.parent?t.parent.component.data.ancestorParse.clone():new cT;wa(i)?(K$(i)?n=new jl(n,i.sequence):Hv(i)&&(n=new Pl(n,i.graticule)),a.parseNothing=!0):((m=i==null?void 0:i.format)==null?void 0:m.parse)===null&&(a.parseNothing=!0),n=Un.makeExplicit(n,t,a)??n,n=new _a(n);const o=t.parent&&Rs(t.parent);(Zt(t)||$e(t))&&o&&(n=Zr.makeFromEncoding(n,t)??n),t.transforms.length>0&&(n=function(g,y,v){let x=0;for(const b of y.transforms){let w,A;if(QR(b))A=g=new js(g,b),w="derived";else if(Uv(b)){const _=bP(b);A=g=Un.makeWithAncestors(g,{},_,v)??g,g=new Ts(g,y,b.filter)}else if(U$(b))A=g=Zr.makeFromTransform(g,b,y),w="number";else if(tT(b))w="date",v.getWithExplicit(b.field).value===void 0&&(g=new Un(g,{[b.field]:w}),v.set(b.field,w,!1)),A=g=Qr.makeFromTransform(g,b);else if(nT(b))A=g=_r.makeFromTransform(g,b),w="number",rb(y)&&(g=new _a(g));else if(q$(b))A=g=Ul.make(g,y,b,x++),w="derived";else if(XR(b))A=g=new Ps(g,b),w="number";else if(JR(b))A=g=new Ao(g,b),w="number";else if(eT(b))A=g=zi.makeFromTransform(g,b),w="derived";else if(rT(b))A=g=new Ih(g,b),w="derived";else if(iT(b))A=g=new qh(g,b),w="derived";else if(KR(b))A=g=new Uh(g,b),w="derived";else if(IR(b))A=g=new Vh(g,b),w="derived";else if(YR(b))g=new Yh(g,b);else if(ZR(b))A=g=_o.makeFromTransform(g,b),w="derived";else if(WR(b))A=g=new Lh(g,b),w="derived";else if(HR(b))A=g=new Hh(g,b),w="derived";else if(GR(b))A=g=new Gh(g,b),w="derived";else{if(!VR(b)){I(ON(b));continue}A=g=new Wh(g,b),w="derived"}if(A&&w!==void 0)for(const _ of A.producedFields()??[])v.set(_,w,!1)}return g}(n,t,a));const s=function(g){const y={};if(Zt(g)&&g.component.selection)for(const v of q(g.component.selection)){const x=g.component.selection[v];for(const b of x.project.items)!b.channel&&gs(b.field)>1&&(y[b.field]="flatten")}return y}(t),u=xP(t);n=Un.makeWithAncestors(n,{},{...s,...u},a)??n,Zt(t)&&(n=qs.parseAll(n,t),n=ql.parseAll(n,t)),(Zt(t)||$e(t))&&(o||(n=Zr.makeFromEncoding(n,t)??n),n=Qr.makeFromEncoding(n,t)??n,n=js.parseAllForSortIndex(n,t));const l=n=Th(Qt.Raw,t,n);if(Zt(t)){const g=_r.makeFromEncoding(n,t);g&&(n=g,rb(t)&&(n=new _a(n))),n=_o.makeFromEncoding(n,t)??n,n=zi.makeFromEncoding(n,t)??n}let c,f;if(Zt(t)){const{markDef:g,mark:y,config:v}=t,x=qt("invalid",g,v),{marks:b,scales:w}=f=Z$({invalid:x,isPath:ya(y)});b!==w&&w==="include-invalid-values"&&(c=n=Th(Qt.PreFilterInvalid,t,n)),b==="exclude-invalid-values"&&(n=Ls.make(n,t,f)??n)}const d=n=Th(Qt.Main,t,n);let h;if(Zt(t)&&f){const{marks:g,scales:y}=f;g==="include-invalid-values"&&y==="exclude-invalid-values"&&(n=Ls.make(n,t,f)??n,h=n=Th(Qt.PostFilterInvalid,t,n))}Zt(t)&&function(g,y){for(const[v,x]of sa(g.component.selection??{})){const b=g.getName(`lookup_${v}`);g.component.data.outputNodes[b]=x.materialized=new ye(new Ts(y,g,{param:v}),b,Qt.Lookup,g.component.data.outputNodeRefCounts)}}(t,d);let p=null;if($e(t)){const g=t.getName("facet");n=function(y,v){const{row:x,column:b}=v;if(x&&b){let w=null;for(const A of[x,b])if(ki(A.sort)){const{field:_,op:k=nh}=A.sort;y=w=new Ao(y,{joinaggregate:[{op:k,field:_,as:Pb(A,A.sort,{forAs:!0})}],groupby:[Y(A)]})}return w}return null}(n,t.facet)??n,p=new Ns(n,t,g,d.getSource()),e[g]=p}return{...t.component.data,outputNodes:e,outputNodeRefCounts:r,raw:l,main:d,facetRoot:p,ancestorParse:a,preFilterInvalid:c,postFilterInvalid:h}}function Th(t,n,e){const{outputNodes:r,outputNodeRefCounts:i}=n.component.data,a=n.getDataName(t),o=new ye(e,a,t,i);return r[a]=o,o}class WP extends Rb{constructor(n,e,r,i){var a,o,s,u;super(n,"concat",e,r,i,n.resolve),((o=(a=n.resolve)==null?void 0:a.axis)==null?void 0:o.x)!=="shared"&&((u=(s=n.resolve)==null?void 0:s.axis)==null?void 0:u.y)!=="shared"||I("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(n).map((l,c)=>qb(l,this,this.getName(`concat_${c}`),void 0,i))}parseData(){this.component.data=Rh(this);for(const n of this.children)n.parseData()}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const e of q(n.component.selection))this.component.selection[e]=n.component.selection[e]}Object.values(this.component.selection).some(n=>Kr(n))&&Gy(Iy)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){for(const n of this.children)n.parseAxesAndHeaders()}getChildren(n){return ph(n)?n.vconcat:Nv(n)?n.hconcat:n.concat}parseLayoutSize(){(function(n){Tb(n);const e=n.layout.columns===1?"width":"childWidth",r=n.layout.columns===void 0?"height":"childHeight";Nh(n,e),Nh(n,r)})(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(n){return this.children.reduce((e,r)=>r.assembleSelectionTopLevelSignals(e),n)}assembleSignals(){return this.children.forEach(n=>n.assembleSignals()),[]}assembleLayoutSignals(){const n=bb(this);for(const e of this.children)n.push(...e.assembleLayoutSignals());return n}assembleSelectionData(n){return this.children.reduce((e,r)=>r.assembleSelectionData(e),n)}assembleMarks(){return this.children.map(n=>{const e=n.assembleTitle(),r=n.assembleGroupStyle(),i=n.assembleGroupEncodeEntry(!1);return{type:"group",name:n.getName("group"),...e?{title:e}:{},...r?{style:r}:{},...i?{encode:{update:i}}:{},...n.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const n=this.layout.columns;return{...n!=null?{columns:n}:{},bounds:"full",align:"each"}}}const HP={disable:1,gridScale:1,scale:1,...t$,labelExpr:1,encode:1},QS=q(HP);class Ib extends Bi{constructor(n={},e={},r=!1){super(),this.explicit=n,this.implicit=e,this.mainExtracted=r}clone(){return new Ib(ft(this.explicit),ft(this.implicit),this.mainExtracted)}hasAxisPart(n){return n==="axis"||(n==="grid"||n==="title"?!!this.get(n):!((e=this.get(n))===!1||e===null));var e}hasOrientSignalRef(){return it(this.explicit.orient)}}const GP={bottom:"top",top:"bottom",left:"right",right:"left"};function VP(t,n){if(!t)return n.map(e=>e.clone());{if(t.length!==n.length)return;const e=t.length;for(let r=0;r{switch(e){case"title":return LE(i,a);case"gridScale":return{explicit:i.explicit,value:un(i.value,a.value)}}return yh(i,a,e,"axis")});t.setWithExplicit(e,r)}return t}function XP(t,n,e,r,i){if(n==="disable")return e!==void 0;switch(e=e||{},n){case"titleAngle":case"labelAngle":return t===(it(e.labelAngle)?e.labelAngle:hl(e.labelAngle));case"values":return!!e.values;case"encode":return!!e.encoding||!!e.labelAngle;case"title":if(t===eS(r,i))return!0}return t===e[n]}const JP=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function KP(t,n){var y,v;let e=n.axis(t);const r=new Ib,i=mn(n.encoding[t]),{mark:a,config:o}=n,s=(e==null?void 0:e.orient)||((y=o[t==="x"?"axisX":"axisY"])==null?void 0:y.orient)||((v=o.axis)==null?void 0:v.orient)||function(x){return x==="x"?"bottom":"left"}(t),u=n.getScaleComponent(t).get("type"),l=function(x,b,w,A){const _=b==="band"?["axisDiscrete","axisBand"]:b==="point"?["axisDiscrete","axisPoint"]:x3(b)?["axisQuantitative"]:b==="time"||b==="utc"?["axisTemporal"]:[],k=x==="x"?"axisX":"axisY",F=it(w)?"axisOrient":`axis${dl(w)}`,C=[..._,..._.map(E=>k+E.substr(4))],D=["axis",F,k];return{vlOnlyAxisConfig:Q5(C,A,x,w),vgAxisConfig:Q5(D,A,x,w),axisConfigStyle:eP([...D,...C],A)}}(t,u,s,n.config),c=e!==void 0?!e:pb("disable",o.style,e==null?void 0:e.style,l).configValue;if(r.set("disable",c,e!==void 0),c)return r;e=e||{};const f=function(x,b,w,A,_){const k=b==null?void 0:b.labelAngle;if(k!==void 0)return it(k)?k:hl(k);{const{configValue:F}=pb("labelAngle",A,b==null?void 0:b.style,_);return F!==void 0?hl(F):w!==Jt||!vt([iv,rv],x.type)||H(x)&&x.timeUnit?void 0:270}}(i,e,t,o.style,l),d=N3(e.formatType,i,u),h=O3(i,i.type,e.format,e.formatType,o,!0),p={fieldOrDatumDef:i,axis:e,channel:t,model:n,scaleType:u,orient:s,labelAngle:f,format:h,formatType:d,mark:a,config:o};for(const x of QS){const b=x in Z5?Z5[x](p):n$(x)?e[x]:void 0,w=b!==void 0,A=XP(b,x,e,n,t);if(w&&A)r.set(x,b,A);else{const{configValue:_,configFrom:k}=n$(x)&&x!=="values"?pb(x,o.style,e.style,l):{},F=_!==void 0;w&&!F?r.set(x,b,A):(k!=="vgAxisConfig"||JP.has(x)&&F||Fl(_)||it(_))&&r.set(x,_,!1)}}const m=e.encoding??{},g=Z3.reduce((x,b)=>{if(!r.hasAxisPart(b))return x;const w=lS(m[b]??{},n),A=b==="labels"?function(_,k,F){const{encoding:C,config:D}=_,E=mn(C[k])??mn(C[Ur(k)]),$=_.axis(k)||{},{format:M,formatType:S}=$;if(ho(S))return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:M,formatType:S,config:D}),...F};if(M===void 0&&S===void 0&&D.customFormatTypes){if(_s(E)==="quantitative"){if(ks(E)&&E.stack==="normalize"&&D.normalizedNumberFormatType)return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:D.normalizedNumberFormat,formatType:D.normalizedNumberFormatType,config:D}),...F};if(D.numberFormatType)return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:D.numberFormat,formatType:D.numberFormatType,config:D}),...F}}if(_s(E)==="temporal"&&D.timeFormatType&&H(E)&&!E.timeUnit)return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:D.timeFormat,formatType:D.timeFormatType,config:D}),...F}}return F}(n,t,w):w;return A===void 0||jt(A)||(x[b]={update:A}),x},{});return jt(g)||r.set("encode",g,!!e.encoding||e.labelAngle!==void 0),r}function jb(t,n){const{config:e}=t;return{...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Mn("size",t),...Mn("angle",t),...QP(t,e,n)}}function QP(t,n,e){return e?{shape:{value:e}}:Mn("shape",t)}const ZP={vgMark:"rule",encodeEntry:t=>{const{markDef:n}=t,e=n.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?{...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ah("x",t,{defaultPos:e==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:e!=="vertical"}),...Ah("y",t,{defaultPos:e==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:e!=="horizontal"}),...Mn("size",t,{vgChannel:"strokeWidth"})}:{}}};function tj(t,n,e){if(qt("align",t,e)===void 0)return"center"}function nj(t,n,e){if(qt("baseline",t,e)===void 0)return"middle"}const ej={vgMark:"rect",encodeEntry:t=>{const{config:n,markDef:e}=t,r=e.orient,i=r==="horizontal"?"x":"y",a=r==="horizontal"?"y":"x",o=r==="horizontal"?"height":"width";return{...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,i),...se(a,t,{defaultPos:"mid",vgChannel:a==="y"?"yc":"xc"}),[o]:Gt(qt("thickness",e,n))}}},Ph={arc:{vgMark:"arc",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Ei(t,"radius"),...Ei(t,"theta")})},area:{vgMark:"area",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Ah("x",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:t.markDef.orient==="horizontal"}),...Ah("y",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:t.markDef.orient==="vertical"}),...nb(t)})},bar:{vgMark:"rect",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,"x"),...Ei(t,"y")})},circle:{vgMark:"symbol",encodeEntry:t=>jb(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:t=>{const{encoding:n}=t,e=n.shape;return[{type:"geoshape",projection:t.projectionName(),...e&&H(e)&&e.type===ws?{field:Y(e,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,"x"),...Ei(t,"y"),...Zv(t,"url")})},line:{vgMark:"line",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Mn("size",t,{vgChannel:"strokeWidth"}),...nb(t)})},point:{vgMark:"symbol",encodeEntry:t=>jb(t)},rect:{vgMark:"rect",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,"x"),...Ei(t,"y")})},rule:ZP,square:{vgMark:"symbol",encodeEntry:t=>jb(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:n,encoding:e}=t;return{...Xe(t,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Zv(t),...Mn("size",t,{vgChannel:"fontSize"}),...Mn("angle",t),...w5("align",tj(t.markDef,e,n)),...w5("baseline",nj(t.markDef,e,n)),...se("radius",t,{defaultPos:null}),...se("theta",t,{defaultPos:null})}}},tick:ej,trail:{vgMark:"trail",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Mn("size",t),...nb(t)})}};function rj(t){if(vt([Kd,Xd,oR],t.mark)){const n=s$(t.mark,t.encoding);if(n.length>0)return function(e,r){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:ZS+e.requestDataName(Qt.Main),data:e.requestDataName(Qt.Main),groupby:r}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Lb(e,{fromPrefix:ZS})}]}(t,n)}else if(t.mark===Jd){const n=jy.some(e=>qt(e,t.markDef,t.config));if(t.stack&&!t.fieldDef("size")&&n)return function(e){var c;const[r]=Lb(e,{fromPrefix:t6}),i=e.scaleName(e.stack.fieldChannel),a=(f={})=>e.vgField(e.stack.fieldChannel,f),o=(f,d)=>`${f}(${[a({prefix:"min",suffix:"start",expr:d}),a({prefix:"max",suffix:"start",expr:d}),a({prefix:"min",suffix:"end",expr:d}),a({prefix:"max",suffix:"end",expr:d})].map(h=>`scale('${i}',${h})`).join(",")})`;let s,u;e.stack.fieldChannel==="x"?(s={...hs(r.encode.update,["y","yc","y2","height",...jy]),x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}},u={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},r.encode.update={...he(r.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(s={...hs(r.encode.update,["x","xc","x2","width"]),y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}},u={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},r.encode.update={...he(r.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const f of jy){const d=Wr(f,e.markDef,e.config);r.encode.update[f]?(s[f]=r.encode.update[f],delete r.encode.update[f]):d&&(s[f]=Gt(d)),d&&(r.encode.update[f]={value:0})}const l=[];if(((c=e.stack.groupbyChannels)==null?void 0:c.length)>0)for(const f of e.stack.groupbyChannels){const d=e.fieldDef(f),h=Y(d);h&&l.push(h),(d!=null&&d.bin||d!=null&&d.timeUnit)&&l.push(Y(d,{binSuffix:"end"}))}return s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((f,d)=>{if(r.encode.update[d])return{...f,[d]:r.encode.update[d]};{const h=Wr(d,e.markDef,e.config);return h!==void 0?{...f,[d]:Gt(h)}:f}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Qt.Main),name:t6+e.requestDataName(Qt.Main),groupby:l,aggregate:{fields:[a({suffix:"start"}),a({suffix:"start"}),a({suffix:"end"}),a({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:u},marks:[r]}]}]}(t)}return Lb(t)}const ZS="faceted_path_",t6="stack_group_";function Lb(t,n={fromPrefix:""}){const{mark:e,markDef:r,encoding:i,config:a}=t,o=un(r.clip,function(h){const p=h.getScaleComponent("x"),m=h.getScaleComponent("y");return!(!(p!=null&&p.get("selectionExtent"))&&!(m!=null&&m.get("selectionExtent")))||void 0}(t),function(h){const p=h.component.projection;return!(!p||p.isFit)||void 0}(t)),s=NE(r),u=i.key,l=function(h){const{encoding:p,stack:m,mark:g,markDef:y,config:v}=h,x=p.order;if(!(!P(x)&&yr(x)&&_y(x.value)||!x&&_y(qt("order",y,v)))){if((P(x)||H(x))&&!m)return TE(x,{expr:"datum"});if(ya(g)){const b=y.orient==="horizontal"?"y":"x";if(H(p[b]))return{field:b}}}}(t),c=function(h){if(!h.component.selection)return null;const p=q(h.component.selection).length;let m=p,g=h.parent;for(;g&&m===0;)m=q(g.component.selection).length,g=g.parent;return m?{interactive:p>0||h.mark==="geoshape"||!!h.encoding.tooltip||!!h.markDef.tooltip}:null}(t),f=qt("aria",r,a),d=Ph[e].postEncodingTransform?Ph[e].postEncodingTransform(t):null;return[{name:t.getName("marks"),type:Ph[e].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:n.fromPrefix+t.requestDataName(Qt.Main)},encode:{update:Ph[e].encodeEntry(t)},...d?{transform:d}:{}}]}class n6 extends VS{constructor(n,e,r,i={},a){super(n,"unit",e,r,a,void 0,D$(n)?n.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=l=>{var c,f,d;return(c=l.from)!=null&&c.data&&(l.from.data=this.lookupDataSource(l.from.data),"time"in this.encoding&&(l.from.data=l.from.data+i5)),(d=(f=l.from)==null?void 0:f.facet)!=null&&d.data&&(l.from.facet.data=this.lookupDataSource(l.from.facet.data)),l};const o=Vr(n.mark)?{...n.mark}:{type:n.mark},s=o.type;o.filled===void 0&&(o.filled=function(l,c,{graticule:f}){if(f)return!1;const d=Wr("filled",l,c),h=l.type;return un(d,h!==Qd&&h!==Kd&&h!==Zd)}(o,a,{graticule:n.data&&Hv(n.data)}));const u=this.encoding=function(l,c,f,d){const h={};for(const p of q(l))wE(p)||I(RN(p));for(let p of gN){if(!l[p])continue;const m=l[p];if(gl(p)){const g=mN(p),y=h[g];if(H(y)&&YN(y.type)&&H(m)&&!y.timeUnit){I(NN(g));continue}}if(p!=="angle"||c!=="arc"||l.theta||(I("Arc marks uses theta channel rather than angle, replacing angle with theta."),p=Ge),vR(l,p,c)){if(p===bi&&c==="line"){const g=vr(l[p]);if(g!=null&&g.aggregate){I("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(p===pe&&(f?"fill"in l:"stroke"in l))I(JE("encoding",{fill:"fill"in l,stroke:"stroke"in l}));else if(p===ml||p===vs&&!P(m)&&!yr(m)||p===eo&&P(m)){if(m){if(p===vs){const g=l[p];if(I3(g)){h[p]=g;continue}}h[p]=K(m).reduce((g,y)=>(H(y)?g.push(_v(y,p)):I(Wy(y,p)),g),[])}}else{if(p===eo&&m===null)h[p]=null;else if(!(H(m)||Yr(m)||yr(m)||_l(m)||it(m))){I(Wy(m,p));continue}h[p]=J3(m,p,d)}}else I(Wd(p,c))}return h}(n.encoding||{},s,o.filled,a);this.markDef=z$(o,u,a),this.size=function({encoding:l,size:c}){for(const f of wi){const d=ge(f);Xr(c[d])&&ba(l[f])&&(delete c[d],I(QE(d)))}return c}({encoding:u,size:D$(n)?{...i,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}}:i}),this.stack=B$(this.markDef,u),this.specifiedScales=this.initScales(s,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=n.projection,this.selection=(n.params??[]).filter(l=>zv(l))}get hasProjection(){const{encoding:n}=this,e=this.mark===F3,r=n&&lN.some(i=>ht(n[i]));return e||r}scaleDomain(n){const e=this.specifiedScales[n];return e?e.domain:void 0}axis(n){return this.specifiedAxes[n]}legend(n){return this.specifiedLegends[n]}initScales(n,e){return Ty.reduce((r,i)=>{const a=mn(e[i]);return a&&(r[i]=this.initScale(a.scale??{})),r},{})}initScale(n){const{domain:e,range:r}=n,i=Sn(n);return P(e)&&(i.domain=e.map(Ee)),P(r)&&(i.range=r.map(Ee)),i}initAxes(n){return wi.reduce((e,r)=>{const i=n[r];if(ht(i)||r===Jt&&ht(n.x2)||r===bn&&ht(n.y2)){const a=ht(i)?i.axis:void 0;e[r]=a&&this.initAxis({...a})}return e},{})}initAxis(n){const e=q(n),r={};for(const i of e){const a=n[i];r[i]=Fl(a)?BE(a):Ee(a)}return r}initLegends(n){return FE.reduce((e,r)=>{const i=mn(n[r]);if(i&&function(a){switch(a){case pe:case Lr:case qr:case bi:case me:case xi:case da:case ha:return!0;case ca:case fa:case no:case la:return!1}}(r)){const a=i.legend;e[r]=a&&Sn(a)}return e},{})}parseData(){this.component.data=Rh(this)}parseLayoutSize(){(function(n){const{size:e,component:r}=n;for(const i of wi){const a=ge(i);if(e[a]){const o=e[a];r.layoutSize.set(a,Xr(o)?"step":o,!0)}else{const o=IP(n,a);r.layoutSize.set(a,o,!1)}}})(this)}parseSelections(){this.component.selection=function(n,e){const r={},i=n.config.selection;if(!e||!e.length)return r;let a=0;for(const o of e){const s=Xt(o.name),u=o.select,l=Q(u)?u:u.type,c=Z(u)?ft(u):{type:l},f=i[l];for(const p in f)p!=="fields"&&p!=="encodings"&&(p==="mark"&&(c.mark={...f.mark,...c.mark}),c[p]!==void 0&&c[p]!==!0||(c[p]=ft(f[p]??c[p])));const d=r[s]={...c,name:s,type:l,init:o.value,bind:o.bind,events:Q(c.on)?aa(c.on,"scope"):K(ft(c.on))};if(Kr(d)&&(a++,a>1)){delete r[s];continue}const h=ft(o);for(const p of Dh)p.defined(d)&&p.parse&&p.parse(n,d,h)}return a>1&&I("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),r}(this,this.selection)}parseMarkGroup(){this.component.mark=rj(this)}parseAxesAndHeaders(){var n;this.component.axes=(n=this,wi.reduce((e,r)=>(n.component.scales[r]&&(e[r]=[KP(r,n)]),e),{}))}assembleSelectionTopLevelSignals(n){return function(e,r){let i=!1;for(const a of En(e.component.selection??{})){const o=a.name,s=G(o+yo);if(r.filter(u=>u.name===o).length===0){const u=a.resolve==="global"?"union":a.resolve,l=a.type==="point"?", true, true)":")";r.push({name:a.name,update:`${B5}(${s}, ${G(u)}${l}`})}i=!0;for(const u of Dh)u.defined(a)&&u.topLevelSignals&&(r=u.topLevelSignals(e,a,r))}return i&&r.filter(a=>a.name==="unit").length===0&&r.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),Jv(r)}(this,n)}assembleSignals(){return[...K5(this),...mT(this,[])]}assembleSelectionData(n){return function(e,r){const i=[],a=[],o=vo(e,{escape:!1});for(const s of En(e.component.selection??{})){const u={name:s.name+yo};if(s.project.hasSelectionId&&(u.transform=[{type:"collect",sort:{field:br}}]),s.init){const l=s.project.items.map(s5);u.values=s.project.hasSelectionId?s.init.map(c=>({unit:o,[br]:go(c,!1)[0]})):s.init.map(c=>({unit:o,fields:l,values:go(c,!1)}))}if([...i,...r].filter(l=>l.name===s.name+yo).length||i.push(u),Kr(s)&&r.length){const l=e.lookupDataSource(e.getDataName(Qt.Main)),c=r.find(d=>d.name===l),f=c.transform.find(d=>d.type==="filter"&&d.expr.includes("vlSelectionTest"));if(f){c.transform=c.transform.filter(h=>h!==f);const d={name:c.name+i5,source:c.name,transform:[f]};a.push(d)}}}return i.concat(r,a)}(this,n)}assembleLayout(){return null}assembleLayoutSignals(){return bb(this)}assembleMarks(){let n=this.component.mark??[];return this.parent&&Rs(this.parent)||(n=u5(this,n)),n.map(this.correctDataNames)}assembleGroupStyle(){const{style:n}=this.view||{};return n!==void 0?n:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(n){return mo(this.encoding,n)}fieldDef(n){return vr(this.encoding[n])}typedFieldDef(n){const e=this.fieldDef(n);return oe(e)?e:null}}class Wb extends Rb{constructor(n,e,r,i,a){super(n,"layer",e,r,a,n.resolve,n.view);const o={...i,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}};this.children=n.layer.map((s,u)=>{if(gh(s))return new Wb(s,this,this.getName(`layer_${u}`),o,a);if(Di(s))return new n6(s,this,this.getName(`layer_${u}`),o,a);throw new Error(qy(s))})}parseData(){this.component.data=Rh(this);for(const n of this.children)n.parseData()}parseLayoutSize(){var n;Tb(n=this),Nh(n,"width"),Nh(n,"height")}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const e of q(n.component.selection))this.component.selection[e]=n.component.selection[e]}Object.values(this.component.selection).some(n=>Kr(n))&&Gy(Iy)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){(function(n){const{axes:e,resolve:r}=n.component,i={top:0,bottom:0,right:0,left:0};for(const a of n.children){a.parseAxesAndHeaders();for(const o of q(a.component.axes))r.axis[o]=xb(n.component.resolve,o),r.axis[o]==="shared"&&(e[o]=VP(e[o],a.component.axes[o]),e[o]||(r.axis[o]="independent",delete e[o]))}for(const a of wi){for(const o of n.children)if(o.component.axes[a]){if(r.axis[a]==="independent"){e[a]=(e[a]??[]).concat(o.component.axes[a]);for(const s of o.component.axes[a]){const{value:u,explicit:l}=s.getWithExplicit("orient");if(!it(u)){if(i[u]>0&&!l){const c=GP[u];i[u]>i[c]&&s.set("orient",c,!1)}i[u]++}}}delete o.component.axes[a]}if(r.axis[a]==="independent"&&e[a]&&e[a].length>1)for(const[o,s]of(e[a]||[]).entries())o>0&&s.get("grid")&&!s.explicit.grid&&(s.implicit.grid=!1)}})(this)}assembleSelectionTopLevelSignals(n){return this.children.reduce((e,r)=>r.assembleSelectionTopLevelSignals(e),n)}assembleSignals(){return this.children.reduce((n,e)=>n.concat(e.assembleSignals()),K5(this))}assembleLayoutSignals(){return this.children.reduce((n,e)=>n.concat(e.assembleLayoutSignals()),bb(this))}assembleSelectionData(n){return this.children.reduce((e,r)=>r.assembleSelectionData(e),n)}assembleGroupStyle(){const n=new Set;for(const r of this.children)for(const i of K(r.assembleGroupStyle()))n.add(i);const e=Array.from(n);return e.length>1?e:e.length===1?e[0]:void 0}assembleTitle(){let n=super.assembleTitle();if(n)return n;for(const e of this.children)if(n=e.assembleTitle(),n)return n}assembleLayout(){return null}assembleMarks(){return function(n,e){for(const r of n.children)Zt(r)&&(e=u5(r,e));return e}(this,this.children.flatMap(n=>n.assembleMarks()))}assembleLegends(){return this.children.reduce((n,e)=>n.concat(e.assembleLegends()),xS(this))}}function qb(t,n,e,r,i){if(eh(t))return new Ll(t,n,e,i);if(gh(t))return new Wb(t,n,e,r,i);if(Di(t))return new n6(t,n,e,r,i);if(function(a){return ph(a)||Nv(a)||Ov(a)}(t))return new WP(t,n,e,i);throw new Error(qy(t))}function ij(t,n={}){var e;n.logger&&(e=n.logger,vl=e),n.fieldTitle&&X3(n.fieldTitle);try{const r=S$(Yl(n.config,t.config)),i=G$(t,r),a=qb(i,null,"",void 0,r);return a.parse(),function(s,u){$b(s.sources);let l=0,c=0;for(let f=0;f<5&&$S(s,u,!0);f++)l++;s.sources.map(Cb);for(let f=0;f<5&&$S(s,u,!1);f++)c++;$b(s.sources),Math.max(l,c)===5&&I("Maximum optimization runs(5) reached.")}(a.component.data,a),{spec:function(s,u,l={},c){const f=s.config?zR(s.config):void 0,d=function(w,A){const _=[],k=YS(_);let F=0;for(const D of w.sources){D.hasName()||(D.dataName="source_"+F++);const E=D.assemble();k(D,E)}for(const D of _)D.transform.length===0&&delete D.transform;let C=0;for(const[D,E]of _.entries())(E.transform??[]).length!==0||E.source||_.splice(C++,0,_.splice(D,1)[0]);for(const D of _)for(const E of D.transform??[])E.type==="lookup"&&(E.from=w.outputNodes[E.from].getSource());for(const D of _)D.name in A&&(D.values=A[D.name]);return _}(s.component.data,l),h=s.assembleSelectionData(d),p=s.assembleProjections(),m=s.assembleTitle(),g=s.assembleGroupStyle(),y=s.assembleGroupEncodeEntry(!0);let v=s.assembleLayoutSignals();v=v.filter(w=>w.name!=="width"&&w.name!=="height"||w.value===void 0||(u[w.name]=+w.value,!1));const{params:x,...b}=u;return{$schema:"https://vega.github.io/schema/vega/v5.json",...s.description?{description:s.description}:{},...b,...m?{title:m}:{},...g?{style:g}:{},...y?{encode:{update:y}}:{},data:h,...p.length>0?{projections:p}:{},...s.assembleGroup([...v,...s.assembleSelectionTopLevelSignals([]),..._$(x)]),...f?{config:f}:{},...c?{usermeta:c}:{}}}(a,function(s,u,l,c){const f=c.component.layoutSize.get("width"),d=c.component.layoutSize.get("height");if(u===void 0?(u={type:"pad"},c.hasAxisOrientSignalRef()&&(u.resize=!0)):Q(u)&&(u={type:u}),f&&d&&(h=u.type,["fit","fit-x","fit-y"].includes(h))){if(f==="step"&&d==="step")I(IE()),u.type="pad";else if(f==="step"||d==="step"){const p=f==="step"?"width":"height";I(IE(Ld(p)));const m=p==="width"?"height":"width";u.type=function(g){return g?`fit-${Ld(g)}`:"fit"}(m)}}var h;return{...q(u).length===1&&u.type?u.type==="pad"?{}:{autosize:u.type}:{autosize:u},...Y$(l,!1),...Y$(s,!0)}}(t,i.autosize,r,a),t.datasets,t.usermeta),normalized:i}}finally{n.logger&&(vl=e3),n.fieldTitle&&X3(V3)}}export{sE as A,G$ as B,hl as C,he as D,hs as E,Fy as F,ms as G,to as H,He as I,uN as J,lE as K,ps as L,jn as M,Lt as N,dl as O,Pr as P,dE as Q,En as R,Xt as S,iN as T,qd as U,FE as V,gs as a,Ey as b,ij as c,Ot as d,vt as e,Ce as f,zd as g,ft as h,sa as i,ky as j,Cy as k,cE as l,un as m,Dy as n,U as o,wt as p,hE as q,cl as r,jt as s,oN as t,pE as u,_y as v,Od as w,q as x,fl as y,uE as z}; diff --git a/apps/assets/crystal-CRzZ78HM.js b/apps/assets/crystal-CRzZ78HM.js new file mode 100644 index 0000000000000000000000000000000000000000..b3e69aab9e44ee8bcf409042604d1d12c0441c46 --- /dev/null +++ b/apps/assets/crystal-CRzZ78HM.js @@ -0,0 +1 @@ +function l(t,e){return new RegExp((e?"":"^")+"(?:"+t.join("|")+")"+(e?"$":"\\b"))}function o(t,e,n){return n.tokenize.push(t),t(e,n)}var F=/^(?:[-+/%|&^]|\*\*?|[<>]{2})/,_=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,I=/^(?:\[\][?=]?)/,A=/^(?:\.(?:\.{2})?|->|[?:])/,h=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,k=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,E=l(["abstract","alias","as","asm","begin","break","case","class","def","do","else","elsif","end","ensure","enum","extend","for","fun","if","include","instance_sizeof","lib","macro","module","next","of","out","pointerof","private","protected","rescue","return","require","select","sizeof","struct","super","then","type","typeof","uninitialized","union","unless","until","when","while","with","yield","__DIR__","__END_LINE__","__FILE__","__LINE__"]),T=l(["true","false","nil","self"]),Z=l(["def","fun","macro","class","module","struct","lib","enum","union","do","for"]),N=l(["if","unless","case","while","until","begin","then"]),w=["end","else","elsif","rescue","ensure"],O=l(w),y=["\\)","\\}","\\]"],D=new RegExp("^(?:"+y.join("|")+")$"),v={def:S,fun:S,macro:function(t,e){if(t.eatSpace())return null;var n;if(n=t.match(h)){if(n=="def")return"keyword";t.eat(/[?!]/)}return e.tokenize.pop(),"def"},class:f,module:f,struct:f,lib:f,enum:f,union:f},z={"[":"]","{":"}","(":")","<":">"};function b(t,e){if(t.eatSpace())return null;if(e.lastToken!="\\"&&t.match("{%",!1))return o(s("%","%"),t,e);if(e.lastToken!="\\"&&t.match("{{",!1))return o(s("{","}"),t,e);if(t.peek()=="#")return t.skipToEnd(),"comment";var n;if(t.match(h))return t.eat(/[?!]/),n=t.current(),t.eat(":")?"atom":e.lastToken=="."?"property":E.test(n)?(Z.test(n)?n=="fun"&&e.blocks.indexOf("lib")>=0||n=="def"&&e.lastToken=="abstract"||(e.blocks.push(n),e.currentIndent+=1):e.lastStyle!="operator"&&e.lastStyle||!N.test(n)?n=="end"&&(e.blocks.pop(),e.currentIndent-=1):(e.blocks.push(n),e.currentIndent+=1),v.hasOwnProperty(n)&&e.tokenize.push(v[n]),"keyword"):T.test(n)?"atom":"variable";if(t.eat("@"))return t.peek()=="["?o(m("[","]","meta"),t,e):(t.eat("@"),t.match(h)||t.match(k),"propertyName");if(t.match(k))return"tag";if(t.eat(":"))return t.eat('"')?o(g('"',"atom",!1),t,e):t.match(h)||t.match(k)||t.match(F)||t.match(_)||t.match(I)?"atom":(t.eat(":"),"operator");if(t.eat('"'))return o(g('"',"string",!0),t,e);if(t.peek()=="%"){var r,a="string",u=!0;if(t.match("%r"))a="string.special",r=t.next();else if(t.match("%w"))u=!1,r=t.next();else if(t.match("%q"))u=!1,r=t.next();else if(r=t.match(/^%([^\w\s=])/))r=r[1];else{if(t.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return"meta";if(t.eat("%"))return"operator"}return z.hasOwnProperty(r)&&(r=z[r]),o(g(r,a,u),t,e)}return(n=t.match(/^<<-('?)([A-Z]\w*)\1/))?o(function(c,x){return function(i,p){if(i.sol()&&(i.eatSpace(),i.match(c)))return p.tokenize.pop(),"string";for(var d=!1;i.peek();)if(d)i.next(),d=!1;else{if(i.match("{%",!1))return p.tokenize.push(s("%","%")),"string";if(i.match("{{",!1))return p.tokenize.push(s("{","}")),"string";if(x&&i.match("#{",!1))return p.tokenize.push(m("#{","}","meta")),"string";d=i.next()=="\\"&&x}return"string"}}(n[2],!n[1]),t,e):t.eat("'")?(t.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),t.eat("'"),"atom"):t.eat("0")?(t.eat("x")?t.match(/^[0-9a-fA-F_]+/):t.eat("o")?t.match(/^[0-7_]+/):t.eat("b")&&t.match(/^[01_]+/),"number"):t.eat(/^\d/)?(t.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),"number"):t.match(F)?(t.eat("="),"operator"):t.match(_)||t.match(A)?"operator":(n=t.match(/[({[]/,!1))?o(m(n=n[0],z[n],null),t,e):t.eat("\\")?(t.next(),"meta"):(t.next(),null)}function m(t,e,n,r){return function(a,u){if(!r&&a.match(t))return u.tokenize[u.tokenize.length-1]=m(t,e,n,!0),u.currentIndent+=1,n;var c=b(a,u);return a.current()===e&&(u.tokenize.pop(),u.currentIndent-=1,c=n),c}}function s(t,e,n){return function(r,a){return!n&&r.match("{"+t)?(a.currentIndent+=1,a.tokenize[a.tokenize.length-1]=s(t,e,!0),"meta"):r.match(e+"}")?(a.currentIndent-=1,a.tokenize.pop(),"meta"):b(r,a)}}function S(t,e){return t.eatSpace()?null:(t.match(h)?t.eat(/[!?]/):t.match(F)||t.match(_)||t.match(I),e.tokenize.pop(),"def")}function f(t,e){return t.eatSpace()?null:(t.match(k),e.tokenize.pop(),"def")}function g(t,e,n){return function(r,a){for(var u=!1;r.peek();)if(u)r.next(),u=!1;else{if(r.match("{%",!1))return a.tokenize.push(s("%","%")),e;if(r.match("{{",!1))return a.tokenize.push(s("{","}")),e;if(n&&r.match("#{",!1))return a.tokenize.push(m("#{","}","meta")),e;var c=r.next();if(c==t)return a.tokenize.pop(),e;u=n&&c=="\\"}return e}}const L={name:"crystal",startState:function(){return{tokenize:[b],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(t,e){var n=e.tokenize[e.tokenize.length-1](t,e),r=t.current();return n&&n!="comment"&&(e.lastToken=r,e.lastStyle=n),n},indent:function(t,e,n){return e=e.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,""),O.test(e)||D.test(e)?n.unit*(t.currentIndent-1):n.unit*t.currentIndent},languageData:{indentOnInput:l(y.concat(w),!0),commentTokens:{line:"#"}}};export{L as crystal}; diff --git a/apps/assets/css-ZjFoif2m.js b/apps/assets/css-ZjFoif2m.js new file mode 100644 index 0000000000000000000000000000000000000000..a717aef2161955cd4ac1ee74c9602a2e569f28ae --- /dev/null +++ b/apps/assets/css-ZjFoif2m.js @@ -0,0 +1 @@ +function k(o){var n,a,h=(o={...ne,...o}).inline,C=o.tokenHooks,M=o.documentTypes||{},G=o.mediaTypes||{},J=o.mediaFeatures||{},Q=o.mediaValueKeywords||{},A=o.propertyKeywords||{},S=o.nonStandardPropertyKeywords||{},R=o.fontProperties||{},ee=o.counterDescriptors||{},T=o.colorKeywords||{},F=o.valueKeywords||{},g=o.allowNested,te=o.lineComment,re=o.supportsAtComponent===!0,N=o.highlightNonStandardPropertyKeywords!==!1;function s(e,r){return n=r,e}function oe(e,r){var t=e.next();if(C[t]){var i=C[t](e,r);if(i!==!1)return i}return t=="@"?(e.eatWhile(/[\w\\\-]/),s("def",e.current())):t=="="||(t=="~"||t=="|")&&e.eat("=")?s(null,"compare"):t=='"'||t=="'"?(r.tokenize=$(t),r.tokenize(e,r)):t=="#"?(e.eatWhile(/[\w\\\-]/),s("atom","hash")):t=="!"?(e.match(/^\s*\w*/),s("keyword","important")):/\d/.test(t)||t=="."&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),s("number","unit")):t!=="-"?/[,+>*\/]/.test(t)?s(null,"select-op"):t=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?s("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(t)?s(null,t):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(r.tokenize=ie),s("variableName.function","variable")):/[\w\\\-]/.test(t)?(e.eatWhile(/[\w\\\-]/),s("property","word")):s(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),s("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?s("def","variable-definition"):s("variableName","variable")):e.match(/^\w+-/)?s("meta","meta"):void 0}function $(e){return function(r,t){for(var i,c=!1;(i=r.next())!=null;){if(i==e&&!c){e==")"&&r.backUp(1);break}c=!c&&i=="\\"}return(i==e||!c&&e!=")")&&(t.tokenize=null),s("string","string")}}function ie(e,r){return e.next(),e.match(/^\s*[\"\')]/,!1)?r.tokenize=null:r.tokenize=$(")"),s(null,"(")}function L(e,r,t){this.type=e,this.indent=r,this.prev=t}function l(e,r,t,i){return e.context=new L(t,r.indentation()+(i===!1?0:r.indentUnit),e.context),t}function d(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function b(e,r,t){return f[t.context.type](e,r,t)}function m(e,r,t,i){for(var c=i||1;c>0;c--)t.context=t.context.prev;return b(e,r,t)}function W(e){var r=e.current().toLowerCase();a=F.hasOwnProperty(r)?"atom":T.hasOwnProperty(r)?"keyword":"variable"}var f={top:function(e,r,t){if(e=="{")return l(t,r,"block");if(e=="}"&&t.context.prev)return d(t);if(re&&/@component/i.test(e))return l(t,r,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return l(t,r,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return l(t,r,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return t.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&e.charAt(0)=="@")return l(t,r,"at");if(e=="hash")a="builtin";else if(e=="word")a="tag";else{if(e=="variable-definition")return"maybeprop";if(e=="interpolation")return l(t,r,"interpolation");if(e==":")return"pseudo";if(g&&e=="(")return l(t,r,"parens")}return t.context.type},block:function(e,r,t){if(e=="word"){var i=r.current().toLowerCase();return A.hasOwnProperty(i)?(a="property","maybeprop"):S.hasOwnProperty(i)?(a=N?"string.special":"property","maybeprop"):g?(a=r.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(a="error","maybeprop")}return e=="meta"?"block":g||e!="hash"&&e!="qualifier"?f.top(e,r,t):(a="error","block")},maybeprop:function(e,r,t){return e==":"?l(t,r,"prop"):b(e,r,t)},prop:function(e,r,t){if(e==";")return d(t);if(e=="{"&&g)return l(t,r,"propBlock");if(e=="}"||e=="{")return m(e,r,t);if(e=="(")return l(t,r,"parens");if(e!="hash"||/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(r.current())){if(e=="word")W(r);else if(e=="interpolation")return l(t,r,"interpolation")}else a="error";return"prop"},propBlock:function(e,r,t){return e=="}"?d(t):e=="word"?(a="property","maybeprop"):t.context.type},parens:function(e,r,t){return e=="{"||e=="}"?m(e,r,t):e==")"?d(t):e=="("?l(t,r,"parens"):e=="interpolation"?l(t,r,"interpolation"):(e=="word"&&W(r),"parens")},pseudo:function(e,r,t){return e=="meta"?"pseudo":e=="word"?(a="variableName.constant",t.context.type):b(e,r,t)},documentTypes:function(e,r,t){return e=="word"&&M.hasOwnProperty(r.current())?(a="tag",t.context.type):f.atBlock(e,r,t)},atBlock:function(e,r,t){if(e=="(")return l(t,r,"atBlock_parens");if(e=="}"||e==";")return m(e,r,t);if(e=="{")return d(t)&&l(t,r,g?"block":"top");if(e=="interpolation")return l(t,r,"interpolation");if(e=="word"){var i=r.current().toLowerCase();a=i=="only"||i=="not"||i=="and"||i=="or"?"keyword":G.hasOwnProperty(i)?"attribute":J.hasOwnProperty(i)?"property":Q.hasOwnProperty(i)?"keyword":A.hasOwnProperty(i)?"property":S.hasOwnProperty(i)?N?"string.special":"property":F.hasOwnProperty(i)?"atom":T.hasOwnProperty(i)?"keyword":"error"}return t.context.type},atComponentBlock:function(e,r,t){return e=="}"?m(e,r,t):e=="{"?d(t)&&l(t,r,g?"block":"top",!1):(e=="word"&&(a="error"),t.context.type)},atBlock_parens:function(e,r,t){return e==")"?d(t):e=="{"||e=="}"?m(e,r,t,2):f.atBlock(e,r,t)},restricted_atBlock_before:function(e,r,t){return e=="{"?l(t,r,"restricted_atBlock"):e=="word"&&t.stateArg=="@counter-style"?(a="variable","restricted_atBlock_before"):b(e,r,t)},restricted_atBlock:function(e,r,t){return e=="}"?(t.stateArg=null,d(t)):e=="word"?(a=t.stateArg=="@font-face"&&!R.hasOwnProperty(r.current().toLowerCase())||t.stateArg=="@counter-style"&&!ee.hasOwnProperty(r.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,r,t){return e=="word"?(a="variable","keyframes"):e=="{"?l(t,r,"top"):b(e,r,t)},at:function(e,r,t){return e==";"?d(t):e=="{"||e=="}"?m(e,r,t):(e=="word"?a="tag":e=="hash"&&(a="builtin"),"at")},interpolation:function(e,r,t){return e=="}"?d(t):e=="{"||e==";"?m(e,r,t):(e=="word"?a="variable":e!="variable"&&e!="("&&e!=")"&&(a="error"),"interpolation")}};return{name:o.name,startState:function(){return{tokenize:null,state:h?"block":"top",stateArg:null,context:new L(h?"block":"top",0,null)}},token:function(e,r){if(!r.tokenize&&e.eatSpace())return null;var t=(r.tokenize||oe)(e,r);return t&&typeof t=="object"&&(n=t[1],t=t[0]),a=t,n!="comment"&&(r.state=f[r.state](n,e,r)),a},indent:function(e,r,t){var i=e.context,c=r&&r.charAt(0),q=i.indent;return i.type!="prop"||c!="}"&&c!=")"||(i=i.prev),i.prev&&(c!="}"||i.type!="block"&&i.type!="top"&&i.type!="interpolation"&&i.type!="restricted_atBlock"?(c!=")"||i.type!="parens"&&i.type!="atBlock_parens")&&(c!="{"||i.type!="at"&&i.type!="atBlock")||(q=Math.max(0,i.indent-t.unit)):q=(i=i.prev).indent),q},languageData:{indentOnInput:/^\s*\}$/,commentTokens:{line:te,block:{open:"/*",close:"*/"}},autocomplete:I}}}function p(o){for(var n={},a=0;a=&|~%^]/;const f={name:"cypher",startState:function(){return{tokenize:p,context:null,indent:0,col:0}},token:function(t,e){if(t.sol()&&(e.context&&e.context.align==null&&(e.context.align=!1),e.indent=t.indentation()),t.eatSpace())return null;var n=e.tokenize(t,e);if(n!=="comment"&&e.context&&e.context.align==null&&e.context.type!=="pattern"&&(e.context.align=!0),a==="(")i(e,")",t.column());else if(a==="[")i(e,"]",t.column());else if(a==="{")i(e,"}",t.column());else if(/[\]\}\)]/.test(a)){for(;e.context&&e.context.type==="pattern";)s(e);e.context&&a===e.context.type&&s(e)}else a==="."&&e.context&&e.context.type==="pattern"?s(e):/atom|string|variable/.test(n)&&e.context&&(/[\}\]]/.test(e.context.type)?i(e,"pattern",t.column()):e.context.type!=="pattern"||e.context.align||(e.context.align=!0,e.context.col=t.column()));return n},indent:function(t,e,n){var l=e&&e.charAt(0),r=t.context;if(/[\]\}]/.test(l))for(;r&&r.type==="pattern";)r=r.prev;var c=r&&l===r.type;return r?r.type==="keywords"?null:r.align?r.col+(c?0:1):r.indent+(c?0:n.unit):0}};export{f as cypher}; diff --git a/apps/assets/cytoscape.esm-UYyVlru8.js b/apps/assets/cytoscape.esm-UYyVlru8.js new file mode 100644 index 0000000000000000000000000000000000000000..9ed451af91f5ff0acb5b302165dec82a744aee45 --- /dev/null +++ b/apps/assets/cytoscape.esm-UYyVlru8.js @@ -0,0 +1,10 @@ +function Ne(e){return Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function ra(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aa(e,t,n){return t&&function(r,a){for(var o=0;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){s=!0,o=l},f:function(){try{i||n.return==null||n.return()}finally{if(s)throw o}}}}var Ae=typeof window>"u"?null:window,yi=Ae?Ae.navigator:null;Ae&&Ae.document;var dl=Ne(""),mi=Ne({}),hl=Ne(function(){}),pl=typeof HTMLElement>"u"?"undefined":Ne(HTMLElement),An=function(e){return e&&e.instanceString&&Me(e.instanceString)?e.instanceString():null},ce=function(e){return e!=null&&Ne(e)==dl},Me=function(e){return e!=null&&Ne(e)===hl},ke=function(e){return!tt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ve=function(e){return e!=null&&Ne(e)===mi&&!ke(e)&&e.constructor===Object},te=function(e){return e!=null&&Ne(e)===Ne(1)&&!isNaN(e)},ur=function(e){return pl==="undefined"?void 0:e!=null&&e instanceof HTMLElement},tt=function(e){return Ln(e)||bi(e)},Ln=function(e){return An(e)==="collection"&&e._private.single},bi=function(e){return An(e)==="collection"&&!e._private.single},ia=function(e){return An(e)==="core"},xi=function(e){return An(e)==="stylesheet"},Tt=function(e){return e==null||!(e!==""&&!e.match(/^\s+$/))},fl=function(e){return function(t){return t!=null&&Ne(t)===mi}(e)&&Me(e.then)},zn=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],a=0;at?1:0},he=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;n.push(Math.floor(i))}var s=a[1]||a[2]||a[3],l=a[1]&&a[2]&&a[3];if(s&&!l)return;var u=r[4];if(u!==void 0){if((u=parseFloat(u))<0||u>1)return;n.push(u)}}return n}(e)||function(t){var n,r,a,o,i,s,l,u;function c(p,v,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?p+6*(v-p)*b:b<.5?v:b<2/3?p+(v-p)*(2/3-b)*6:p}var d=new RegExp("^"+yl+"$").exec(t);if(d){if((r=parseInt(d[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(a=parseFloat(d[2]))<0||a>100||(a/=100,(o=parseFloat(d[3]))<0||o>100)||(o/=100,(i=d[4])!==void 0&&((i=parseFloat(i))<0||i>1)))return;if(a===0)s=l=u=Math.round(255*o);else{var h=o<.5?o*(1+a):o+a-o*a,g=2*o-h;s=Math.round(255*c(g,h,r+1/3)),l=Math.round(255*c(g,h,r)),u=Math.round(255*c(g,h,r-1/3))}n=[s,l,u,i]}return n}(e)},xl={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ci=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a=t||m<0||d&&y-u>=o}function v(){var y=sa();if(p(y))return b(y);s=setTimeout(v,function(m){var k=t-(m-l);return d?Ol(k,o-(m-u)):k}(y))}function b(y){return s=void 0,h&&r?g(y):(r=a=void 0,i)}function f(){var y=sa(),m=p(y);if(r=arguments,a=this,l=y,m){if(s===void 0)return function(k){return u=k,s=setTimeout(v,t),c?g(k):i}(l);if(d)return clearTimeout(s),s=setTimeout(v,t),g(l)}return s===void 0&&(s=setTimeout(v,t)),i}return t=Mi(t)||0,qt(n)&&(c=!!n.leading,o=(d="maxWait"in n)?Rl(Mi(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),f.cancel=function(){s!==void 0&&clearTimeout(s),u=0,r=l=a=s=void 0},f.flush=function(){return s===void 0?i:b(sa())},f},la=Ae?Ae.performance:null,Bi=la&&la.now?function(){return la.now()}:function(){return Date.now()},Vl=function(){if(Ae){if(Ae.requestAnimationFrame)return function(e){Ae.requestAnimationFrame(e)};if(Ae.mozRequestAnimationFrame)return function(e){Ae.mozRequestAnimationFrame(e)};if(Ae.webkitRequestAnimationFrame)return function(e){Ae.webkitRequestAnimationFrame(e)};if(Ae.msRequestAnimationFrame)return function(e){Ae.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Bi())},1e3/60)}}(),pr=function(e){return Vl(e)},wt=Bi,sn=9261,Vn=5381,_i=function(e){for(var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sn;!(t=e.next()).done;)n=65599*n+t.value|0;return n},Fn=function(e){return 65599*(arguments.length>1&&arguments[1]!==void 0?arguments[1]:sn)+e|0},Xn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Vn;return(t<<5)+t+e|0},Mt=function(e){return 2097152*e[0]+e[1]},fr=function(e,t){return[Fn(e[0],t[0]),Xn(e[1],t[1])]},Yt=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return _i({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},da=function(e){e.splice(0,e.length)},ct=function(e,t,n){return n&&(t=wi(n,t)),e[t]},_t=function(e,t,n,r){n&&(t=wi(n,t)),e[t]=r},yt=typeof Map<"u"?Map:function(){function e(){ra(this,e),this._obj={}}return aa(e,[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}]),e}(),jl=function(){function e(t){if(ra(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r"u"?"undefined":Ne(Set))!=="undefined"?Set:jl,vr=function(e,t){var n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(e!==void 0&&t!==void 0&&ia(e)){var r=t.group;if(r==null&&(r=t.data&&t.data.source!=null&&t.data.target!=null?"edges":"nodes"),r==="nodes"||r==="edges"){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0||!!t.grabbable,pannable:t.pannable===void 0?r==="edges":!!t.pannable,active:!1,classes:new ln,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),t.renderedPosition){var o=t.renderedPosition,i=e.pan(),s=e.zoom();a.position={x:(o.x-i.x)/s,y:(o.y-i.y)/s}}var l=[];ke(t.classes)?l=t.classes:ce(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;uy?1:0},c=function(f,y,m,k,x){var S;if(m==null&&(m=0),x==null&&(x=r),m<0)throw new Error("lo must be non-negative");for(k==null&&(k=f.length);mP;0<=P?E++:E--)D.push(E);return D}).apply(this).reverse()).length;kT;0<=T?++D:--D)B.push(i(f,m));return B},v=function(f,y,m,k){var x,S,w;for(k==null&&(k=r),x=f[m];m>y&&k(x,S=f[w=m-1>>1])<0;)f[m]=S,m=w;return f[m]=x},b=function(f,y,m){var k,x,S,w,D;for(m==null&&(m=r),x=f.length,D=y,S=f[y],k=2*y+1;k0;){var x=f.pop(),S=v(x),w=x.id();if(d[w]=S,S!==1/0)for(var D=x.neighborhood().intersect(g),E=0;E0)for(F.unshift(R);c[I];){var X=c[I];F.unshift(X.edge),F.unshift(X.node),I=(N=X.node).id()}return i.spawn(F)}}}},Gl={kruskal:function(e){e=e||function(y){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,o=new Array(a),i=n,s=function(y){for(var m=0;m0;){if(k(),S++,u===d){for(var w=[],D=a,E=d,P=y[E];w.unshift(D),P!=null&&w.unshift(P),(D=f[E])!=null;)P=y[E=D.id()];return{found:!0,distance:h[u],path:this.spawn(w),steps:S}}p[u]=!0;for(var T=l._private.edges,B=0;BP&&(g[E]=P,f[E]=D,y[E]=k),!a){var T=D*u+w;!a&&g[T]>P&&(g[T]=P,f[T]=w,y[T]=k)}}}for(var B=0;B1&&arguments[1]!==void 0?arguments[1]:o,_=[],A=y(ee);;){if(A==null)return t.spawn();var V=f(A),L=V.edge,Z=V.pred;if(_.unshift(A[0]),A.same(C)&&_.length>0)break;L!=null&&_.unshift(L),A=Z}return s.spawn(_)},hasNegativeWeightCycle:p,negativeWeightCycles:v}}},tu=Math.sqrt(2),nu=function(e,t,n){n.length===0&&Be("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],o=r[2],i=t[a],s=t[o],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===i&&t[h]===s||t[d]===s&&t[h]===i)&&l.splice(u,1)}for(var g=0;gr;){var a=Math.floor(Math.random()*t.length);t=nu(a,e,t),n--}return t},ru={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(F){return F.isLoop()});var a=n.length,o=r.length,i=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/tu);if(!(a<2)){for(var l=[],u=0;u0?1:e<0?-1:0},jt=function(e,t){return Math.sqrt(Wt(e,t))},Wt=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},au=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},qi=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},iu=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},br=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},xr=function(e){var t,n,r,a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0];if(o.length===1)t=n=r=a=o[0];else if(o.length===2)t=r=o[0],a=n=o[1];else if(o.length===4){var i=ut(o,4);t=i[0],n=i[1],r=i[2],a=i[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Yi=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},fa=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2t.y2)&&!(t.y1>e.y2)},dn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},ou=function(e,t){return dn(e,t.x,t.y)},ji=function(e,t){return dn(e,t.x1,t.y1)&&dn(e,t.x2,t.y2)},Wi=function(e,t,n,r,a,o,i){var s,l,u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",c=u==="auto"?Kt(a,o):u,d=a/2,h=o/2,g=(c=Math.min(c,d,h))!==d,p=c!==h;if(g){var v=r-h-i;if((s=Nt(e,t,n,r,n-d+c-i,v,n+d-c+i,v,!1)).length>0)return s}if(p){var b=n+d+i;if((s=Nt(e,t,n,r,b,r-h+c-i,b,r+h-c+i,!1)).length>0)return s}if(g){var f=r+h+i;if((s=Nt(e,t,n,r,n-d+c-i,f,n+d-c+i,f,!1)).length>0)return s}if(p){var y=n-d-i;if((s=Nt(e,t,n,r,y,r-h+c-i,y,r+h-c+i,!1)).length>0)return s}var m=n-d+c,k=r-h+c;if((l=Wn(e,t,n,r,m,k,c+i)).length>0&&l[0]<=m&&l[1]<=k)return[l[0],l[1]];var x=n+d-c,S=r-h+c;if((l=Wn(e,t,n,r,x,S,c+i)).length>0&&l[0]>=x&&l[1]<=S)return[l[0],l[1]];var w=n+d-c,D=r+h-c;if((l=Wn(e,t,n,r,w,D,c+i)).length>0&&l[0]>=w&&l[1]>=D)return[l[0],l[1]];var E=n-d+c,P=r+h-c;return(l=Wn(e,t,n,r,E,P,c+i)).length>0&&l[0]<=E&&l[1]>=P?[l[0],l[1]]:[]},su=function(e,t,n,r,a,o,i){var s=i,l=Math.min(n,a),u=Math.max(n,a),c=Math.min(r,o),d=Math.max(r,o);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},lu=function(e,t,n,r,a,o,i,s,l){var u=Math.min(n,i,a)-l,c=Math.max(n,i,a)+l,d=Math.min(r,s,o)-l,h=Math.max(r,s,o)+l;return!(ec||th)},uu=function(e,t,n,r,a,o,i,s){var l=[];(function(b,f,y,m,k){var x,S,w,D,E,P,T,B;b===0&&(b=1e-5),w=-27*(m/=b)+(f/=b)*(9*(y/=b)-f*f*2),x=(S=(3*y-f*f)/9)*S*S+(w/=54)*w,k[1]=0,T=f/3,x>0?(E=(E=w+Math.sqrt(x))<0?-Math.pow(-E,1/3):Math.pow(E,1/3),P=(P=w-Math.sqrt(x))<0?-Math.pow(-P,1/3):Math.pow(P,1/3),k[0]=-T+E+P,T+=(E+P)/2,k[4]=k[2]=-T,T=Math.sqrt(3)*(-P+E)/2,k[3]=T,k[5]=-T):(k[5]=k[3]=0,x===0?(B=w<0?-Math.pow(-w,1/3):Math.pow(w,1/3),k[0]=2*B-T,k[4]=k[2]=-(B+T)):(D=(S=-S)*S*S,D=Math.acos(w/Math.sqrt(D)),B=2*Math.sqrt(S),k[0]=-T+B*Math.cos(D/3),k[2]=-T+B*Math.cos((D+2*Math.PI)/3),k[4]=-T+B*Math.cos((D+4*Math.PI)/3)))})(1*n*n-4*n*a+2*n*i+4*a*a-4*a*i+i*i+r*r-4*r*o+2*r*s+4*o*o-4*o*s+s*s,9*n*a-3*n*n-3*n*i-6*a*a+3*a*i+9*r*o-3*r*r-3*r*s-6*o*o+3*o*s,3*n*n-6*n*a+n*i-n*e+2*a*a+2*a*e-i*e+3*r*r-6*r*o+r*s-r*t+2*o*o+2*o*t-s*t,1*n*a-n*n+n*e-a*e+r*o-r*r+r*t-o*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,g,p=-1,v=0;v=0?gl?(e-a)*(e-a)+(t-o)*(t-o):u-d},et=function(e,t,n){for(var r,a,o,i,s=0,l=0;l=e&&e>=o||r<=e&&e<=o))continue;(e-r)/(o-r)*(i-a)+a>t&&s++}return s%2!=0},Et=function(e,t,n,r,a,o,i,s,l){var u,c=new Array(n.length);s[0]!=null?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),g=Math.sin(-u),p=0;p0){var v=Er(c,-l);d=wr(v)}else d=c;return et(e,t,d)},wr=function(e){for(var t,n,r,a,o,i,s,l,u=new Array(e.length/2),c=0;c=0&&p<=1&&b.push(p),v>=0&&v<=1&&b.push(v),b.length===0)return[];var f=b[0]*s[0]+e,y=b[0]*s[1]+t;return b.length>1?b[0]==b[1]?[f,y]:[f,y,b[1]*s[0]+e,b[1]*s[1]+t]:[f,y]},ga=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Nt=function(e,t,n,r,a,o,i,s,l){var u=e-a,c=n-e,d=i-a,h=t-o,g=r-t,p=s-o,v=d*h-p*u,b=c*h-g*u,f=p*c-d*g;if(f!==0){var y=v/f,m=b/f,k=-.001;return k<=y&&y<=1.001&&k<=m&&m<=1.001||l?[e+y*c,t+y*g]:[]}return v===0||b===0?ga(e,n,i)===i?[i,s]:ga(e,n,a)===a?[a,o]:ga(a,i,n)===n?[n,r]:[]:[]},Hn=function(e,t,n,r,a,o,i,s){var l,u,c,d,h,g,p=[],v=new Array(n.length),b=!0;if(o==null&&(b=!1),b){for(var f=0;f0){var y=Er(v,-s);u=wr(y)}else u=v}else u=n;for(var m=0;mu&&(u=m)},d=function(y){return l[y]},h=0;h0?z.edgesTo(M)[0]:M.edgesTo(z)[0];var F=r(R);M=M.id(),w[M]>w[T]+F&&(w[M]=w[T]+F,D.nodes.indexOf(M)<0?D.push(M):D.updateItem(M),S[M]=0,x[M]=[]),w[M]==w[T]+F&&(S[M]=S[M]+S[T],x[M].push(T))}else for(var N=0;N0;){for(var Y=k.pop(),j=0;j0&&P.push(S[T]);P.length!==0&&D.push(w.collection(P))}return D}(c,l,t,r);return m=function(k){for(var x=0;x5&&arguments[5]!==void 0?arguments[5]:Eu,i=r,s=0;s=2?Kn(e,t,n,0,eo,ku):Kn(e,t,n,0,Ji)},squaredEuclidean:function(e,t,n){return Kn(e,t,n,0,eo)},manhattan:function(e,t,n){return Kn(e,t,n,0,Ji)},max:function(e,t,n){return Kn(e,t,n,-1/0,Cu)}};function Cr(e,t,n,r,a,o){var i;return i=Me(e)?e:fn[e]||fn.euclidean,t===0&&Me(e)?i(a,o):i(t,n,r,a,o)}fn["squared-euclidean"]=fn.squaredEuclidean,fn.squaredeuclidean=fn.squaredEuclidean;var Su=Re({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ba=function(e){return Su(e)},Sr=function(e,t,n,r,a){var o=a!=="kMedoids"?function(l){return n[l]}:function(l){return r[l](n)},i=n,s=t;return Cr(e,r.length,o,function(l){return r[l](t)},i,s)},xa=function(e,t,n){for(var r=n.length,a=new Array(r),o=new Array(r),i=new Array(t),s=null,l=0;ln)return!1;return!0},Tu=function(e,t,n){for(var r=0;rw&&(w=k[T][B],D=B);E[D].push(m[T])}for(var M=0;M=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var g,p=t[i],v=t[r[i]];g=a.mode==="dendrogram"?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=g,e.splice(v.index,1),t[p.key]=g;for(var b=0;bn[v.key][f.key]&&(o=n[v.key][f.key])):a.linkage==="max"?(o=n[p.key][f.key],n[p.key][f.key]1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],s=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5];arguments.length>3&&arguments[3]!==void 0&&!arguments[3]?(o0&&r.splice(0,a)):r=r.slice(a,o);for(var l=0,u=r.length-1;u>=0;u--){var c=r[u];s?isFinite(c)||(r[u]=-1/0,l++):r.splice(u,1)}i&&r.sort(function(g,p){return g-p});var d=r.length,h=Math.floor(d/2);return d%2!=0?r[h+1+l]:(r[h-1+l]+r[h+l])/2}(e):t==="mean"?function(r){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=0,s=0,l=a;l1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=1/0,s=a;s1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=-1/0,s=a;si&&(o=l,i=t[a*e+l])}o>0&&r.push(o)}for(var u=0;u=P?(T=P,P=M,B=z):M>T&&(T=M);for(var R=0;R0?1:0;w[S%u.minIterations*t+Y]=j,O+=j}if(O>0&&(S>=u.minIterations-1||S==u.maxIterations-1)){for(var G=0,W=0;W0&&A.push(V);return A}(t,o,i),U=function(ee,C,_){for(var A=lo(ee,C,_),V=0;V<_.length;V++){for(var L=[],Z=0;Zne&&(H=$,ne=J)}_[V]=L[H]}return lo(ee,C,_)}(t,r,K),re={},ae=0;ae1||x>1)&&(u=!0),c[y]=[],f.outgoers().forEach(function(w){w.isEdge()&&c[y].push(w.id())})}else d[y]=[void 0,f.target().id()]}):l.forEach(function(f){var y=f.id();f.isNode()?(f.degree(!0)%2&&(n?r?u=!0:r=y:n=y),c[y]=[],f.connectedEdges().forEach(function(m){return c[y].push(m.id())})):d[y]=[f.source().id(),f.target().id()]});var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var g=function(f){for(var y,m,k,x=f,S=[f];c[x].length;)y=c[x].shift(),m=d[y][0],x!=(k=d[y][1])?(c[k]=c[k].filter(function(w){return w!=y}),x=k):s||x==m||(c[m]=c[m].filter(function(w){return w!=y}),x=m),S.unshift(y),S.unshift(x);return S},p=[],v=[];for(v=g(a);v.length!=1;)c[v[0]].length==0?(p.unshift(l.getElementById(v.shift())),p.unshift(l.getElementById(v.shift()))):v=g(v.shift()).concat(v);for(var b in p.unshift(l.getElementById(v.shift())),c)if(c[b].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Dr=function(){var e=this,t={},n=0,r=0,a=[],o=[],i={},s=function u(c,d,h){c===h&&(r+=1),t[d]={id:n,low:n++,cutVertex:!1};var g,p,v,b,f=e.getElementById(d).connectedEdges().intersection(e);f.size()===0?a.push(e.spawn(e.getElementById(d))):f.forEach(function(y){g=y.source().id(),p=y.target().id(),(v=g===d?p:g)!==h&&(b=y.id(),i[b]||(i[b]=!0,o.push({x:d,y:v,edge:y})),v in t?t[d].low=Math.min(t[d].low,t[v].id):(u(c,v,d),t[d].low=Math.min(t[d].low,t[v].low),t[d].id<=t[v].low&&(t[d].cutVertex=!0,function(m,k){for(var x=o.length-1,S=[],w=e.spawn();o[x].x!=m||o[x].y!=k;)S.push(o.pop().edge),x--;S.push(o.pop().edge),S.forEach(function(D){var E=D.connectedNodes().intersection(e);w.merge(D),E.forEach(function(P){var T=P.id(),B=P.connectedEdges().intersection(e);w.merge(P),t[T].cutVertex?w.merge(B.filter(function(M){return M.isLoop()})):w.merge(B)})}),a.push(w)}(d,v))))})};e.forEach(function(u){if(u.isNode()){var c=u.id();c in t||(r=0,s(c,c),t[c].cutVertex=r>1)}});var l=Object.keys(t).filter(function(u){return t[u].cutVertex}).map(function(u){return e.getElementById(u)});return{cut:e.spawn(l),components:a}},Tr=function(){var e=this,t={},n=0,r=[],a=[],o=e.spawn(e),i=function s(l){if(a.push(l),t[l]={index:n,low:n++,explored:!1},e.getElementById(l).connectedEdges().intersection(e).forEach(function(g){var p=g.target().id();p!==l&&(p in t||s(p),t[p].explored||(t[l].low=Math.min(t[l].low,t[p].low)))}),t[l].index===t[l].low){for(var u=e.spawn();;){var c=a.pop();if(u.merge(e.getElementById(c)),t[c].low=t[l].index,t[c].explored=!0,c===l)break}var d=u.edgesWith(u),h=u.merge(d);r.push(h),o=o.difference(h)}};return e.forEach(function(s){if(s.isNode()){var l=s.id();l in t||i(l)}}),{cut:o,components:r}},co={};[qn,Kl,Gl,Zl,Ql,eu,ru,hu,hn,pn,ma,wu,_u,Iu,Fu,qu,{hopcroftTarjanBiconnected:Dr,htbc:Dr,htb:Dr,hopcroftTarjanBiconnectedComponents:Dr},{tarjanStronglyConnected:Tr,tsc:Tr,tscc:Tr,tarjanStronglyConnectedComponents:Tr}].forEach(function(e){he(co,e)});/*! +Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable +Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) +Licensed under The MIT License (http://opensource.org/licenses/MIT) +*/var kt=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};kt.prototype={fulfill:function(e){return ho(this,1,"fulfillValue",e)},reject:function(e){return ho(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new kt;return n.onFulfilled.push(go(e,r,"fulfill")),n.onRejected.push(go(t,r,"reject")),po(n),r.proxy}};var ho=function(e,t,n,r){return e.state===0&&(e.state=t,e[n]=r,po(e)),e},po=function(e){e.state===1?fo(e,"onFulfilled",e.fulfillValue):e.state===2&&fo(e,"onRejected",e.rejectReason)},fo=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var a=function(){for(var o=0;o0:void 0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1},mc=function(e,t){var n=this.__data__,r=Br(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function yn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){ke(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,a=[],o=0,i=n.length;o0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Nr.className=Nr.classNames=Nr.classes;var ye={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Le,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ye.variable="(?:[\\w-.]|(?:\\\\"+ye.metaChar+"))+",ye.className="(?:[\\w-]|(?:\\\\"+ye.metaChar+"))+",ye.value=ye.string+"|"+ye.number,ye.id=ye.variable,function(){var e,t,n;for(e=ye.comparatorOp.split("|"),n=0;n=0||t!=="="&&(ye.comparatorOp+="|\\!"+t)}();var Pa=0,To=1,Mo=2,Da=3,Ta=4,Ma=5,Ba=6,_a=7,Ar=8,Na=9,Aa=10,La=11,Bo=12,_o=13,za=14,Ia=15,Ra=16,Lr=17,zr=18,Ir=19,bn=20,Oa=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return function(n,r){return-1*ki(n,r)}(e.selector,t.selector)}),Kc=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return we("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return we("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;u.edgeCount===1&&we("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l??""},t=function(l){return ce(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,u){var c=l.type,d=l.value;switch(c){case Pa:var h=e(d);return h.substring(0,h.length-1);case Da:var g=l.field,p=l.operator;return"["+g+n(e(p))+t(d)+"]";case Ma:var v=l.operator,b=l.field;return"["+e(v)+b+"]";case Ta:return"["+l.field+"]";case Ba:var f=l.operator;return"[["+l.field+n(e(f))+t(d)+"]]";case _a:return d;case Ar:return"#"+d;case Na:return"."+d;case Lr:case Ia:return a(l.parent,u)+n(">")+a(l.child,u);case zr:case Ra:return a(l.ancestor,u)+" "+a(l.descendant,u);case Ir:var y=a(l.left,u),m=a(l.subject,u),k=a(l.right,u);return y+(y.length>0?" ":"")+m+k;case bn:return""}},a=function(l,u){return l.checks.reduce(function(c,d,h){return c+(u===l&&h===0?"$":"")+r(d,u)},"")},o="",i=0;i1&&i=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(i||l||u)&&(a=i||s?""+e:"",o=""+n),u&&(e=a=a.toLowerCase(),n=o=o.toLowerCase()),t){case"*=":r=a.indexOf(o)>=0;break;case"$=":r=a.indexOf(o,a.length-o.length)>=0;break;case"^=":r=a.indexOf(o)===0;break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=a.shift();t(u),o.add(u.id()),i&&r(a,o,u)}return e}function Lo(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&arguments[1]!==void 0)||arguments[1],Lo)},wn.forEachUp=function(e){return Xa(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],zo)},wn.forEachUpAndDown=function(e){return Xa(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],Qc)},wn.ancestors=wn.parents,(Rr=Ao={data:Ee.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ee.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ee.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ee.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ee.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ee.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Rr.data,Rr.removeAttr=Rr.removeData;var dt,Io,Jc=Ao,Or={};function qa(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],o=a._private.edges,i=0;it}),minIndegree:En("indegree",function(e,t){return et}),minOutdegree:En("outdegree",function(e,t){return et})}),he(Or,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},e===void 0?a:a[e]}for(var h=0;h0,b=v;v&&(p=p[0]);var f=b?p.position():{x:0,y:0};t!==void 0?g.position(e,t+f[e]):a!==void 0&&g.position({x:a.x+f.x,y:a.y+f.y})}}else if(!o)return;return this}},dt.modelPosition=dt.point=dt.position,dt.modelPositions=dt.points=dt.positions,dt.renderedPoint=dt.renderedPosition,dt.relativePoint=dt.relativePosition;var kn,Rt,ed=Io;kn=Rt={},Rt.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),o=t.x1*r+a.x,i=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:o,x2:i,y1:s,y2:l,w:i-o,h:l-s}},Rt.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this):this},Rt.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(i){if(i.isParent()){var s=i._private,l=i.children(),u=i.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:i.pstyle("min-width").pfValue,left:i.pstyle("min-width-bias-left"),right:i.pstyle("min-width-bias-right")},height:{val:i.pstyle("min-height").pfValue,top:i.pstyle("min-height-bias-top"),bottom:i.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),h=s.position;d.w!==0&&d.h!==0||((d={w:i.pstyle("width").pfValue,h:i.pstyle("height").pfValue}).x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);var g=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(g=100*g/c.width.val);var p=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(p=100*p/c.width.val);var v=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(v=100*v/c.height.val);var b=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(b=100*b/c.height.val);var f=w(c.width.val-d.w,g,p),y=f.biasDiff,m=f.biasComplementDiff,k=w(c.height.val-d.h,v,b),x=k.biasDiff,S=k.biasComplementDiff;s.autoPadding=function(D,E,P,T){if(P.units!=="%")return P.units==="px"?P.pfValue:0;switch(T){case"width":return D>0?P.pfValue*D:0;case"height":return E>0?P.pfValue*E:0;case"average":return D>0&&E>0?P.pfValue*(D+E)/2:0;case"min":return D>0&&E>0?D>E?P.pfValue*E:P.pfValue*D:0;case"max":return D>0&&E>0?D>E?P.pfValue*D:P.pfValue*E:0;default:return 0}}(d.w,d.h,i.pstyle("padding"),i.pstyle("padding-relative-to").value),s.autoWidth=Math.max(d.w,c.width.val),h.x=(-y+d.x1+d.x2+m)/2,s.autoHeight=Math.max(d.h,c.height.val),h.y=(-x+d.y1+d.y2+S)/2}function w(D,E,P){var T=0,B=0,M=E+P;return D>0&&M>0&&(T=E/M*D,B=P/M*D),{biasDiff:T,biasComplementDiff:B}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ut=function(e,t){return t==null?e:ht(e,t.x1,t.y1,t.x2,t.y2)},Un=function(e,t,n){return ct(e,t,n)},Vr=function(e,t,n){if(!t.cy().headless()){var r,a,o=t._private,i=o.rstyle,s=i.arrowWidth/2;if(t.pstyle(n+"-arrow-shape").value!=="none"){n==="source"?(r=i.srcX,a=i.srcY):n==="target"?(r=i.tgtX,a=i.tgtY):(r=i.midX,a=i.midY);var l=o.arrowBounds=o.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,br(u,1),ht(e,u.x1,u.y1,u.x2,u.y2)}}},Ya=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,o=a.rstyle;if(t.pstyle(r+"label").strValue){var i,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Un(o,"labelWidth",n),g=Un(o,"labelHeight",n),p=Un(o,"labelX",n),v=Un(o,"labelY",n),b=t.pstyle(r+"text-margin-x").pfValue,f=t.pstyle(r+"text-margin-y").pfValue,y=t.isEdge(),m=t.pstyle(r+"text-rotation"),k=t.pstyle("text-outline-width").pfValue,x=t.pstyle("text-border-width").pfValue/2,S=t.pstyle("text-background-padding").pfValue,w=g,D=h,E=D/2,P=w/2;if(y)i=p-E,s=p+E,l=v-P,u=v+P;else{switch(c.value){case"left":i=p-D,s=p;break;case"center":i=p-E,s=p+E;break;case"right":i=p,s=p+D}switch(d.value){case"top":l=v-w,u=v;break;case"center":l=v-P,u=v+P;break;case"bottom":l=v,u=v+w}}i+=b-Math.max(k,x)-S-2,s+=b+Math.max(k,x)+S+2,l+=f-Math.max(k,x)-S-2,u+=f+Math.max(k,x)+S+2;var T=n||"main",B=a.labelBounds,M=B[T]=B[T]||{};M.x1=i,M.y1=l,M.x2=s,M.y2=u,M.w=s-i,M.h=u-l;var z=y&&m.strValue==="autorotate",R=m.pfValue!=null&&m.pfValue!==0;if(z||R){var F=z?Un(a.rstyle,"labelAngle",n):m.pfValue,N=Math.cos(F),I=Math.sin(F),X=(i+s)/2,O=(l+u)/2;if(!y){switch(c.value){case"left":X=s;break;case"right":X=i}switch(d.value){case"top":O=u;break;case"bottom":O=l}}var Y=function(re,ae){return{x:(re-=X)*N-(ae-=O)*I+X,y:re*I+ae*N+O}},j=Y(i,l),G=Y(i,u),W=Y(s,l),q=Y(s,u);i=Math.min(j.x,G.x,W.x,q.x),s=Math.max(j.x,G.x,W.x,q.x),l=Math.min(j.y,G.y,W.y,q.y),u=Math.max(j.y,G.y,W.y,q.y)}var K=T+"Rot",U=B[K]=B[K]||{};U.x1=i,U.y1=l,U.x2=s,U.y2=u,U.w=s-i,U.h=u-l,ht(e,i,l,s,u),ht(a.labelBounds.all,i,l,s,u)}return e}},td=function(e,t){var n,r,a,o,i,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=Je(),g=e._private,p=e.isNode(),v=e.isEdge(),b=g.rstyle,f=p&&c?e.pstyle("bounds-expansion").pfValue:[0],y=function(U){return U.pstyle("display").value!=="none"},m=!c||y(e)&&(!v||y(e.source())&&y(e.target()));if(m){var k=0;c&&t.includeOverlays&&e.pstyle("overlay-opacity").value!==0&&(k=e.pstyle("overlay-padding").value);var x=0;c&&t.includeUnderlays&&e.pstyle("underlay-opacity").value!==0&&(x=e.pstyle("underlay-padding").value);var S=Math.max(k,x),w=0;if(c&&(w=e.pstyle("width").pfValue/2),p&&t.includeNodes){var D=e.position();i=D.x,s=D.y;var E=e.outerWidth()/2,P=e.outerHeight()/2;ht(h,n=i-E,a=s-P,r=i+E,o=s+P),c&&t.includeOutlines&&function(U,re){if(!re.cy().headless()){var ae,de,ue,Q=re.pstyle("outline-opacity").value,le=re.pstyle("outline-width").value;if(Q>0&&le>0){var ee=re.pstyle("outline-offset").value,C=re.pstyle("shape").value,_=le+ee,A=(U.w+2*_)/U.w,V=(U.h+2*_)/U.h,L=0;["diamond","pentagon","round-triangle"].includes(C)?(A=(U.w+2.4*_)/U.w,L=-_/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(C)?A=(U.w+2.4*_)/U.w:C==="star"?(A=(U.w+2.8*_)/U.w,V=(U.h+2.6*_)/U.h,L=-_/3.8):C==="triangle"?(A=(U.w+2.8*_)/U.w,V=(U.h+2.4*_)/U.h,L=-_/1.4):C==="vee"&&(A=(U.w+4.4*_)/U.w,V=(U.h+3.8*_)/U.h,L=.5*-_);var Z=U.h*V-U.h,H=U.w*A-U.w;if(xr(U,[Math.ceil(Z/2),Math.ceil(H/2)]),L!==0){var ne=(de=0,ue=L,{x1:(ae=U).x1+de,x2:ae.x2+de,y1:ae.y1+ue,y2:ae.y2+ue,w:ae.w,h:ae.h});qi(U,ne)}}}}(h,e)}else if(v&&t.includeEdges)if(c&&!d){var T=e.pstyle("curve-style").strValue;if(n=Math.min(b.srcX,b.midX,b.tgtX),r=Math.max(b.srcX,b.midX,b.tgtX),a=Math.min(b.srcY,b.midY,b.tgtY),o=Math.max(b.srcY,b.midY,b.tgtY),ht(h,n-=w,a-=w,r+=w,o+=w),T==="haystack"){var B=b.haystackPts;if(B&&B.length===2){if(n=B[0].x,a=B[0].y,n>(r=B[1].x)){var M=n;n=r,r=M}if(a>(o=B[1].y)){var z=a;a=o,o=z}ht(h,n-w,a-w,r+w,o+w)}}else if(T==="bezier"||T==="unbundled-bezier"||T.endsWith("segments")||T.endsWith("taxi")){var R;switch(T){case"bezier":case"unbundled-bezier":R=b.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":R=b.linePts}if(R!=null)for(var F=0;F(r=X.x)){var O=n;n=r,r=O}if((a=I.y)>(o=X.y)){var Y=a;a=o,o=Y}ht(h,n-=w,a-=w,r+=w,o+=w)}if(c&&t.includeEdges&&v&&(Vr(h,e,"mid-source"),Vr(h,e,"mid-target"),Vr(h,e,"source"),Vr(h,e,"target")),c&&e.pstyle("ghost").value==="yes"){var j=e.pstyle("ghost-offset-x").pfValue,G=e.pstyle("ghost-offset-y").pfValue;ht(h,h.x1+j,h.y1+G,h.x2+j,h.y2+G)}var W=g.bodyBounds=g.bodyBounds||{};Yi(W,h),xr(W,f),br(W,1),c&&(n=h.x1,r=h.x2,a=h.y1,o=h.y2,ht(h,n-S,a-S,r+S,o+S));var q=g.overlayBounds=g.overlayBounds||{};Yi(q,h),xr(q,f),br(q,1);var K=g.labelBounds=g.labelBounds||{};K.all!=null?((l=K.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):K.all=Je(),c&&t.includeLabels&&(t.includeMainLabels&&Ya(h,e,null),v&&(t.includeSourceLabels&&Ya(h,e,"source"),t.includeTargetLabels&&Ya(h,e,"target")))}return h.x1=at(h.x1),h.y1=at(h.y1),h.x2=at(h.x2),h.y2=at(h.y2),h.w=at(h.x2-h.x1),h.h=at(h.y2-h.y1),h.w>0&&h.h>0&&m&&(xr(h,f),br(h,1)),h},Vo=function(e){var t=0,n=function(a){return(a?1:0)<0&&arguments[0]!==void 0?arguments[0]:od,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)i(s);return this},Ot.removeAllListeners=function(){return this.removeListener("*")},Ot.emit=Ot.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,ke(t)||(t=[t]),sd(this,function(o,i){n!=null&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var s=function(u){var c=r[u];if(c.type===i.type&&(!c.namespace||c.namespace===i.namespace||c.namespace===".*")&&o.eventMatches(o.context,c,i)){var d=[i];t!=null&&function(p,v){for(var b=0;b1&&!r){var a=this.length-1,o=this[a],i=o._private.data.id;this[a]=void 0,this[e]=o,n.set(i,{ele:o,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ce(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;ar&&(r=s,n=i)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,o=0;o=0&&a"u"?"undefined":Ne(Symbol))!=ja&&Ne(Symbol.iterator)!=ja&&(Yr[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return pi({next:function(){return n1&&arguments[1]!==void 0)||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(ve(e)){var o=e;a.applyBypass(this,o,r),this.emitAndNotify("style")}else if(ce(e)){if(t===void 0){var i=this[0];return i?a.getStylePropertyValue(i,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(e===void 0){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var o=0;o0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),qe.neighbourhood=qe.neighborhood,qe.closedNeighbourhood=qe.closedNeighborhood,qe.openNeighbourhood=qe.openNeighborhood,he(qe,{source:rt(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:rt(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:os({attr:"source"}),targets:os({attr:"target"})}),he(qe,{edgesWith:rt(ss(),"edgesWith"),edgesTo:rt(ss({thisIsSrc:!0}),"edgesTo")}),he(qe,{connectedEdges:rt(function(e){for(var t=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),qe.componentsOf=qe.components;var Ve=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(e!==void 0){var a=new yt,o=!1;if(t){if(t.length>0&&ve(t[0])&&!Ln(t[0])){o=!0;for(var i=[],s=new ln,l=0,u=t.length;l0&&arguments[0]!==void 0)||arguments[0],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],a=this,o=a.cy(),i=o._private,s=[],l=[],u=0,c=a.length;u0){for(var I=e.length===a.length?a:new Ve(o,e),X=0;X0&&arguments[0]!==void 0)||arguments[0],t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this,r=[],a={},o=n._private.cy;function i(P){var T=a[P.id()];t&&P.removed()||T||(a[P.id()]=!0,P.isNode()?(r.push(P),function(B){for(var M=B._private.edges,z=0;z0&&(e?w.emitAndNotify("remove"):t&&w.emit("remove"));for(var D=0;D=.001?function(w,D){for(var E=0;E<4;++E){var P=h(D,e,n);if(P===0)return D;D-=(d(D,e,n)-w)/P}return D}(y,x):S===0?x:function(w,D,E){var P,T,B=0;do(P=d(T=D+(E-D)/2,e,n)-w)>0?E=T:D=T;while(Math.abs(P)>1e-7&&++B<10);return T}(y,m,m+a)}var p=!1;function v(){p=!0,e===t&&n===r||function(){for(var y=0;y<11;++y)s[y]=d(y*a,e,n)}()}var b=function(y){return p||v(),e===t&&n===r?y:y===0?0:y===1?1:d(g(y),t,r)};b.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var f="generateBezier("+[e,t,n,r]+")";return b.toString=function(){return f},b}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var vd=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,o){var i={x:r.x+o.dx*a,v:r.v+o.dv*a,tension:r.tension,friction:r.friction};return{dx:i.v,dv:e(i)}}function n(r,a){var o={dx:r.v,dv:e(r)},i=t(r,.5*a,o),s=t(r,.5*a,i),l=t(r,a,s),u=1/6*(o.dx+2*(i.dx+s.dx)+l.dx),c=1/6*(o.dv+2*(i.dv+s.dv)+l.dv);return r.x=r.x+u*a,r.v=r.v+c*a,r}return function r(a,o,i){var s,l,u,c={x:-1,v:0,tension:null,friction:null},d=[0],h=0,g=1e-4;for(a=parseFloat(a)||500,o=parseFloat(o)||20,i=i||null,c.tension=a,c.friction=o,l=(s=i!==null)?(h=r(a,o))/i*.016:.016;u=n(u||c,l),d.push(1+u.x),h+=16,Math.abs(u.x)>g&&Math.abs(u.v)>g;);return s?function(p){return d[p*(d.length-1)|0]}:h}}(),Se=function(e,t,n,r){var a=gd(e,t,n,r);return function(o,i,s){return o+(i-o)*a(s)}},Kr={linear:function(e,t,n){return e+(t-e)*n},ease:Se(.25,.1,.25,1),"ease-in":Se(.42,0,1,1),"ease-out":Se(0,0,.58,1),"ease-in-out":Se(.42,0,.58,1),"ease-in-sine":Se(.47,0,.745,.715),"ease-out-sine":Se(.39,.575,.565,1),"ease-in-out-sine":Se(.445,.05,.55,.95),"ease-in-quad":Se(.55,.085,.68,.53),"ease-out-quad":Se(.25,.46,.45,.94),"ease-in-out-quad":Se(.455,.03,.515,.955),"ease-in-cubic":Se(.55,.055,.675,.19),"ease-out-cubic":Se(.215,.61,.355,1),"ease-in-out-cubic":Se(.645,.045,.355,1),"ease-in-quart":Se(.895,.03,.685,.22),"ease-out-quart":Se(.165,.84,.44,1),"ease-in-out-quart":Se(.77,0,.175,1),"ease-in-quint":Se(.755,.05,.855,.06),"ease-out-quint":Se(.23,1,.32,1),"ease-in-out-quint":Se(.86,0,.07,1),"ease-in-expo":Se(.95,.05,.795,.035),"ease-out-expo":Se(.19,1,.22,1),"ease-in-out-expo":Se(1,0,0,1),"ease-in-circ":Se(.6,.04,.98,.335),"ease-out-circ":Se(.075,.82,.165,1),"ease-in-out-circ":Se(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Kr.linear;var r=vd(e,t,n);return function(a,o,i){return a+(o-a)*r(i)}},"cubic-bezier":Se};function us(e,t,n,r,a){if(r===1||t===n)return n;var o=a(t,n,r);return e==null||((e.roundValue||e.color)&&(o=Math.round(o)),e.min!==void 0&&(o=Math.max(o,e.min)),e.max!==void 0&&(o=Math.min(o,e.max))),o}function cs(e,t){return e.pfValue!=null||e.value!=null?e.pfValue==null||t!=null&&t.type.units==="%"?e.value:e.pfValue:e}function Pn(e,t,n,r,a){var o=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var i=cs(e,a),s=cs(t,a);if(te(i)&&te(s))return us(o,i,s,n,r);if(ke(i)&&ke(s)){for(var l=[],u=0;u0?(d==="spring"&&h.push(i.duration),i.easingImpl=Kr[d].apply(null,h)):i.easingImpl=Kr[d]}var g,p=i.easingImpl;if(g=i.duration===0?1:(n-l)/i.duration,i.applying&&(g=i.progress),g<0?g=0:g>1&&(g=1),i.delay==null){var v=i.startPosition,b=i.position;if(b&&a&&!e.locked()){var f={};er(v.x,b.x)&&(f.x=Pn(v.x,b.x,g,p)),er(v.y,b.y)&&(f.y=Pn(v.y,b.y,g,p)),e.position(f)}var y=i.startPan,m=i.pan,k=o.pan,x=m!=null&&r;x&&(er(y.x,m.x)&&(k.x=Pn(y.x,m.x,g,p)),er(y.y,m.y)&&(k.y=Pn(y.y,m.y,g,p)),e.emit("pan"));var S=i.startZoom,w=i.zoom,D=w!=null&&r;D&&(er(S,w)&&(o.zoom=jn(o.minZoom,Pn(S,w,g,p),o.maxZoom)),e.emit("zoom")),(x||D)&&e.emit("viewport");var E=i.style;if(E&&E.length>0&&a){for(var P=0;P=0;x--)(0,k[x])();k.splice(0,k.length)},f=h.length-1;f>=0;f--){var y=h[f],m=y._private;m.stopped?(h.splice(f,1),m.hooked=!1,m.playing=!1,m.started=!1,b(m.frames)):(m.playing||m.applying)&&(m.playing&&m.applying&&(m.applying=!1),m.started||md(0,y,e),yd(u,y,e,c),m.applying&&(m.applying=!1),b(m.frames),m.step!=null&&m.step(e),y.completed()&&(h.splice(f,1),m.hooked=!1,m.playing=!1,m.started=!1,b(m.completes)),p=!0)}return c||h.length!==0||g.length!==0||r.push(u),p}for(var o=!1,i=0;i0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var bd={animate:Ee.animate(),animation:Ee.animation(),animated:Ee.animated(),clearQueue:Ee.clearQueue(),delay:Ee.delay(),delayAnimation:Ee.delayAnimation(),stop:Ee.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(n,r){ds(r,e)},t.beforeRenderPriorities.animations):function n(){e._private.animationsRunning&&pr(function(r){ds(r,e),n()})}()}}},xd={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null||e!==n.target&&Ln(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},Gr=function(e){return ce(e)?new Lt(e):e},hs={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Xr(xd,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Gr(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Gr(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Gr(t),n),this},once:function(e,t,n){return this.emitter().one(e,Gr(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Ee.eventAliasesOn(hs);var Ka={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Ka.jpeg=Ka.jpg;var Ur={layout:function(e){var t=this;if(e!=null)if(e.name!=null){var n=e.name,r=t.extension("layout",n);if(r!=null){var a;a=ce(e.eles)?t.$(e.eles):e.eles!=null?e.eles:t.$();var o=new r(he({},e,{cy:t,eles:a}));return o}Be("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Be("A `name` must be specified to make a layout");else Be("Layout options must be specified to make a layout")}};Ur.createLayout=Ur.makeLayout=Ur.layout;var wd={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ga.invalidateDimensions=Ga.resize;var Zr={collection:function(e,t){return ce(e)?this.$(e):tt(e)?e.collection():ke(e)?(t||(t={}),new Ve(this,e,t.unique,t.removed)):new Ve(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Zr.elements=Zr.filter=Zr.$;var Ye={},tr="t";Ye.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&g){var p=void 0;h&&g||h?p=u.properties:g&&(p=u.mappedProperties);for(var v=0;v1&&(b=1),s.color){var x=a.valueMin[0],S=a.valueMax[0],w=a.valueMin[1],D=a.valueMax[1],E=a.valueMin[2],P=a.valueMax[2],T=a.valueMin[3]==null?1:a.valueMin[3],B=a.valueMax[3]==null?1:a.valueMax[3],M=[Math.round(x+(S-x)*b),Math.round(w+(D-w)*b),Math.round(E+(P-E)*b),Math.round(T+(B-T)*b)];n={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var z=a.valueMin+(a.valueMax-a.valueMin)*b;n=this.parse(a.name,z,a.bypass,h)}if(!n)return v(),!1;n.mapping=a,a=n;break;case i.data:for(var R=a.field.split("."),F=d.data,N=0;N0&&o>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(i).play().promise().then(y):y()}).then(function(){return e.animation({style:s,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Ye.checkTrigger=function(e,t,n,r,a,o){var i=this.properties[t],s=a(i);s!=null&&s(n,r)&&o(i)},Ye.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(o){return o.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},Ye.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!a.triggersBoundsOfParallelBeziers||t!=="curve-style"||n!=="bezier"&&r!=="bezier"||e.parallelEdges().forEach(function(o){o.isBundledBezier()&&o.dirtyBoundingBoxCache()}),!a.triggersBoundsOfConnectedEdges||t!=="display"||n!=="none"&&r!=="none"||e.connectedEdges().forEach(function(o){o.dirtyBoundingBoxCache()})})},Ye.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var kd={applyBypass:function(e,t,n,r){var a=[];if(t==="*"||t==="**"){if(n!==void 0)for(var o=0;ot.length?o.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");!o.match(/^\s*$/);){var l=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){we("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=l[0];var u=l[1];if(u!=="core"&&new Lt(u).invalid){we("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),i();continue}var c=l[2],d=!1;n=c;for(var h=[];!n.match(/^\s*$/);){var g=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){we("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=g[0];var p=g[1],v=g[2];this.properties[p]?a.parse(p,v)?(h.push({name:p,val:v}),s()):(we("Skipping property: Invalid property definition in: "+r),s()):(we("Skipping property: Invalid property name in: "+r),s())}if(d){i();break}a.selector(u);for(var b=0;b=7&&t[0]==="d"&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&t[0]==="m"&&(c=new RegExp(s.mapData.regex).exec(t))){if(n||d.multiple)return!1;var g=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return we("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var b=p.value,f=v.value;if(!(b[0]!==f[0]||b[1]!==f[1]||b[2]!==f[2]||b[3]!==f[3]&&(b[3]!=null&&b[3]!==1||f[3]!=null&&f[3]!==1)))return!1}return{name:e,value:c,strValue:""+t,mapped:g,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&r!=="multiple"){var y;if(y=l?t.split(/\s+/):ke(t)?t:[t],d.evenMultiple&&y.length%2!=0)return null;for(var m=[],k=[],x=[],S="",w=!1,D=0;D0?" ":"")+E.strValue}return d.validate&&!d.validate(m,k)?null:d.singleEnum&&w?m.length===1&&ce(m[0])?{name:e,value:m[0],strValue:m[0],bypass:n}:null:{name:e,value:m,pfValue:x,strValue:S,bypass:n,units:k}}var P,T,B=function(){for(var re=0;red.max||d.strictMax&&t===d.max))return null;var N={name:e,value:t,strValue:""+t+(M||""),units:M,bypass:n};return d.unitless||M!=="px"&&M!=="em"?N.pfValue=t:N.pfValue=M!=="px"&&M?this.getEmSizeInPixels()*t:t,M!=="ms"&&M!=="s"||(N.pfValue=M==="ms"?t:1e3*t),M!=="deg"&&M!=="rad"||(N.pfValue=M==="rad"?t:(P=t,Math.PI*P/180)),M==="%"&&(N.pfValue=t/100),N}if(d.propList){var I=[],X=""+t;if(X!=="none"){for(var O=X.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:i=(i=(i=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:i)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,o=r.zoom,i=!1;if(r.zoomingEnabled||(i=!0),te(e)?n=e:ve(e)&&(n=e.level,e.position!=null?t=yr(e.position,o,a):e.renderedPosition!=null&&(t=e.renderedPosition),t==null||r.panningEnabled||(i=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;te(l.x)&&(t.pan.x=l.x,i=!1),te(l.y)&&(t.pan.y=l.y,i=!1),i||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ce(e)){var n=e;e=this.mutableElements().filter(n)}else tt(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),o=this.height();return{x:(a-(t=t===void 0?this._private.zoom:t)*(r.x1+r.x2))/2,y:(o-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,a=this;return n.sizeCache=n.sizeCache||(r?(e=a.window().getComputedStyle(r),t=function(o){return parseFloat(e.getPropertyValue(o))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Zt.centre=Zt.center,Zt.autolockNodes=Zt.autolock,Zt.autoungrabifyNodes=Zt.autoungrabify;var nr={data:Ee.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ee.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ee.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ee.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};nr.attr=nr.data,nr.removeAttr=nr.removeData;var rr=function(e){var t=this,n=(e=he({},e)).container;n&&!ur(n)&&ur(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=Ae!==void 0&&n!==void 0&&!e.headless,i=e;i.layout=he({name:o?"grid":"null"},i.layout),i.renderer=he({name:o?"canvas":"null"},i.renderer);var s=function(c,d,h){return d!==void 0?d:h!==void 0?h:c},l=this._private={container:n,ready:!1,options:i,elements:new Ve(this),listeners:[],aniEles:new Ve(this),data:i.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,i.zoomingEnabled),userZoomingEnabled:s(!0,i.userZoomingEnabled),panningEnabled:s(!0,i.panningEnabled),userPanningEnabled:s(!0,i.userPanningEnabled),boxSelectionEnabled:s(!0,i.boxSelectionEnabled),autolock:s(!1,i.autolock,i.autolockNodes),autoungrabify:s(!1,i.autoungrabify,i.autoungrabifyNodes),autounselectify:s(!1,i.autounselectify),styleEnabled:i.styleEnabled===void 0?o:i.styleEnabled,zoom:te(i.zoom)?i.zoom:1,pan:{x:ve(i.pan)&&te(i.pan.x)?i.pan.x:0,y:ve(i.pan)&&te(i.pan.y)?i.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,i.multiClickDebounceTime)};this.createEmitter(),this.selectionType(i.selectionType),this.zoomRange({min:i.minZoom,max:i.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=he({},i,i.renderer);t.initRenderer(u),function(c,d){if(c.some(fl))return gn.all(c).then(d);d(c)}([i.style,i.elements],function(c){var d=c[0],h=c[1];l.styleEnabled&&t.style().append(d),function(g,p,v){t.notifications(!1);var b=t.mutableElements();b.length>0&&b.remove(),g!=null&&(ve(g)||ke(g))&&t.add(g),t.one("layoutready",function(y){t.notifications(!0),t.emit(y),t.one("load",p),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",v),t.emit("done")});var f=he({},t._private.options.layout);f.eles=t.elements(),t.layout(f).run()}(h,function(){t.startAnimationLoop(),l.ready=!0,Me(i.ready)&&t.on("ready",i.ready);for(var g=0;g0,u=Je(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(tt(n.roots))e=n.roots;else if(ke(n.roots)){for(var c=[],d=0;d0;){var z=M(),R=E(z,T);if(R)z.outgoers().filter(function(Q){return Q.isNode()&&a.has(Q)}).forEach(B);else if(R===null){we("Detected double maximal shift for node `"+z.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var F=0;if(n.avoidOverlap)for(var N=0;N0&&f[0].length<=3?L/2:0),H=2*Math.PI/f[ee].length*C;return ee===0&&f[0].length===1&&(Z=1),{x:ae+Z*Math.cos(H),y:de+Z*Math.sin(H)}}return{x:ae+(C+1-(_+1)/2)*A,y:(ee+1)*V}}),this};var Bd={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function vs(e){this.options=he({},Bd,e)}vs.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var i,s=Je(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(t.sweep===void 0?2*Math.PI-2*Math.PI/o.length:t.sweep)/Math.max(1,o.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var b=Math.cos(c)-Math.cos(0),f=Math.sin(c)-Math.sin(0),y=Math.sqrt(d*d/(b*b+f*f));i=Math.max(y,i)}return r.nodes().layoutPositions(this,t,function(m,k){var x=t.startAngle+k*c*(a?1:-1),S=i*Math.cos(x),w=i*Math.sin(x);return{x:l+S,y:u+w}}),this};var ys,_d={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ms(e){this.options=he({},_d,e)}ms.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,o=a.nodes().not(":parent"),i=Je(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=i.x1+i.w/2,l=i.y1+i.h/2,u=[],c=0,d=0;d0&&Math.abs(y[0].value-k.value)>=b&&(y=[],f.push(y)),y.push(k)}var x=c+t.minNodeSpacing;if(!t.avoidOverlap){var S=f.length>0&&f[0].length>1,w=(Math.min(i.w,i.h)/2-x)/(f.length+S?1:0);x=Math.min(x,w)}for(var D=0,E=0;E1&&t.avoidOverlap){var M=Math.cos(B)-Math.cos(0),z=Math.sin(B)-Math.sin(0),R=Math.sqrt(x*x/(M*M+z*z));D=Math.max(R,D)}P.r=D,D+=x}if(t.equidistant){for(var F=0,N=0,I=0;I=e.numIter)&&(Od(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&o(),pr(c)):(ws(r,e),s())})();else{for(;u;)u=i(l),l++;ws(r,e),s()}return this},Qr.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Qr.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Ad=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),o=Je(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},s=n.eles.components(),l={},u=0;u0)for(i.graphSet.push(x),u=0;ur.count?0:r.graph},zd=function e(t,n,r,a){var o=a.graphSet[r];if(-10)var s=(u=r.nodeOverlap*i)*a/(v=Math.sqrt(a*a+o*o)),l=u*o/v;else{var u,c=Jr(e,a,o),d=Jr(t,-1*a,-1*o),h=d.x-c.x,g=d.y-c.y,p=h*h+g*g,v=Math.sqrt(p);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,l=u*g/v}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Xd=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else o=t.maxY-e.minY;return a>=0&&o>=0?Math.sqrt(a*a+o*o):0},Jr=function(e,t,n){var r=e.positionX,a=e.positionY,o=e.height||1,i=e.width||1,s=n/t,l=o/i,u={};return t===0&&0n?(u.x=r,u.y=a+o/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-i/2,u.y=a-i*n/2/t,u):0=l)?(u.x=r+o*t/2/n,u.y=a+o/2,u):(0>n&&(s<=-1*l||s>=l)&&(u.x=r-o*t/2/n,u.y=a-o/2),u)},qd=function(e,t){for(var n=0;n1){var p=t.gravity*d/g,v=t.gravity*h/g;c.offsetX+=p,c.offsetY+=v}}}}},jd=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var o=n[r++],i=e.idToIndex[o],s=e.layoutNodes[i],l=s.children;if(0n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},Kd=function e(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],o=!1;return(a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,o=!0),(a.minX==null||t.minX-a.padLefta.maxY)&&(a.maxY=t.maxY+a.padBottom,o=!0),(a.minY==null||t.minY-a.padTopp&&(d+=g+t.componentSpacing,c=0,h=0,g=0)}}},Gd={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Es(e){this.options=he({},Gd,e)}Es.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var o=Je(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(o.h===0||o.w===0)r.nodes().layoutPositions(this,t,function(j){return{x:o.x1,y:o.y1}});else{var i=a.size(),s=Math.sqrt(i*o.h/o.w),l=Math.round(s),u=Math.round(o.w/o.h*s),c=function(j){if(j==null)return Math.min(l,u);Math.min(l,u)==l?l=j:u=j},d=function(j){if(j==null)return Math.max(l,u);Math.max(l,u)==l?l=j:u=j},h=t.rows,g=t.cols!=null?t.cols:t.columns;if(h!=null&&g!=null)l=h,u=g;else if(h!=null&&g==null)l=h,u=Math.ceil(i/l);else if(h==null&&g!=null)u=g,l=Math.ceil(i/u);else if(u*l>i){var p=c(),v=d();(p-1)*v>=i?c(p-1):(v-1)*p>=i&&d(v-1)}else for(;u*l=i?d(f+1):c(b+1)}var y=o.w/u,m=o.h/l;if(t.condense&&(y=0,m=0),t.avoidOverlap)for(var k=0;k=u&&(R=0,z++)},N={},I=0;I(D=cu(e,t,I[X],I[X+1],I[X+2],I[X+3])))return b(w,D),!0}else if(P.edgeType==="bezier"||P.edgeType==="multibezier"||P.edgeType==="self"||P.edgeType==="compound"){for(I=P.allpts,X=0;X+5(D=uu(e,t,I[X],I[X+1],I[X+2],I[X+3],I[X+4],I[X+5])))return b(w,D),!0}F=F||E.source,N=N||E.target;var O=i.getArrowWidth(T,B),Y=[{name:"source",x:P.arrowStartX,y:P.arrowStartY,angle:P.srcArrowAngle},{name:"target",x:P.arrowEndX,y:P.arrowEndY,angle:P.tgtArrowAngle},{name:"mid-source",x:P.midX,y:P.midY,angle:P.midsrcArrowAngle},{name:"mid-target",x:P.midX,y:P.midY,angle:P.midtgtArrowAngle}];for(X=0;X0&&(f(F),f(N))}function m(w,D,E){return ct(w,D,E)}function k(w,D){var E,P=w._private,T=p;E=D?D+"-":"",w.boundingBox();var B=P.labelBounds[D||"main"],M=w.pstyle(E+"label").value;if(w.pstyle("text-events").strValue==="yes"&&M){var z=m(P.rscratch,"labelX",D),R=m(P.rscratch,"labelY",D),F=m(P.rscratch,"labelAngle",D),N=w.pstyle(E+"text-margin-x").pfValue,I=w.pstyle(E+"text-margin-y").pfValue,X=B.x1-T-N,O=B.x2+T-N,Y=B.y1-T-I,j=B.y2+T-I;if(F){var G=Math.cos(F),W=Math.sin(F),q=function(ue,Q){return{x:(ue-=z)*G-(Q-=R)*W+z,y:ue*W+Q*G+R}},K=q(X,Y),U=q(X,j),re=q(O,Y),ae=q(O,j),de=[K.x+N,K.y+I,re.x+N,re.y+I,ae.x+N,ae.y+I,U.x+N,U.y+I];if(et(e,t,de))return b(w),!0}else if(dn(B,e,t))return b(w),!0}}n&&(l=l.interactive);for(var x=l.length-1;x>=0;x--){var S=l[x];S.isNode()?f(S)||k(S):y(S)||k(S)||k(S,"source")||k(S,"target")}return u},getAllInBox:function(e,t,n,r){for(var a=this.getCachedZSortedEles().interactive,o=[],i=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r),c=Je({x1:e=i,y1:t=l,x2:n=s,y2:r=u}),d=0;d0?-(Math.PI-o.ang):Math.PI+o.ang),As(t,n,it),Ts=mt.nx*it.ny-mt.ny*it.nx,Ms=mt.nx*it.nx-mt.ny*-it.ny,Ct=Math.asin(Math.max(-1,Math.min(1,Ts))),Math.abs(Ct)<1e-6)return Qa=t.x,Ja=t.y,void(Jt=ar=0);$t=1,ea=!1,Ms<0?Ct<0?Ct=Math.PI+Ct:(Ct=Math.PI-Ct,$t=-1,ea=!0):Ct>0&&($t=-1,ea=!0),ar=t.radius!==void 0?t.radius:r,Qt=Ct/2,ta=Math.min(mt.len/2,it.len/2),a?(St=Math.abs(Math.cos(Qt)*ar/Math.sin(Qt)))>ta?(St=ta,Jt=Math.abs(St*Math.sin(Qt)/Math.cos(Qt))):Jt=ar:(St=Math.min(ta,ar),Jt=Math.abs(St*Math.sin(Qt)/Math.cos(Qt))),ei=t.x+it.nx*St,ti=t.y+it.ny*St,Qa=ei-it.ny*Jt*$t,Ja=ti+it.nx*Jt*$t,Bs=t.x+mt.nx*St,_s=t.y+mt.ny*St,Ns=t};function Ls(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function ni(e,t,n,r){var a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(th(e,t,n,r,a),{cx:Qa,cy:Ja,radius:Jt,startX:Bs,startY:_s,stopX:ei,stopY:ti,startAngle:mt.ang+Math.PI/2*$t,endAngle:it.ang-Math.PI/2*$t,counterClockwise:ea})}var He={};function zs(e){var t=[];if(e!=null){for(var n=0;n0?Math.max(se-pe,0):Math.min(se+pe,0)},T=P(D,S),B=P(E,w),M=!1;b==="auto"?v=Math.abs(T)>Math.abs(B)?a:r:b===l||b===s?(v=r,M=!0):b!==o&&b!==i||(v=a,M=!0);var z,R=v===r,F=R?B:T,N=R?E:D,I=Xi(N),X=!1;M&&(y||k)||!(b===s&&N<0||b===l&&N>0||b===o&&N>0||b===i&&N<0)||(F=(I*=-1)*Math.abs(F),X=!0),y?z=(m<0?1+m:m)*F:z=(m<0?F:0)+m*I;var O=function(se){return Math.abs(se)=Math.abs(F)},Y=O(z),j=O(Math.abs(F)-Math.abs(z));if((Y||j)&&!X)if(R){var G=Math.abs(N)<=d/2,W=Math.abs(D)<=h/2;if(G){var q=(u.x1+u.x2)/2,K=u.y1,U=u.y2;n.segpts=[q,K,q,U]}else if(W){var re=(u.y1+u.y2)/2,ae=u.x1,de=u.x2;n.segpts=[ae,re,de,re]}else n.segpts=[u.x1,u.y2]}else{var ue=Math.abs(N)<=c/2,Q=Math.abs(E)<=g/2;if(ue){var le=(u.y1+u.y2)/2,ee=u.x1,C=u.x2;n.segpts=[ee,le,C,le]}else if(Q){var _=(u.x1+u.x2)/2,A=u.y1,V=u.y2;n.segpts=[_,A,_,V]}else n.segpts=[u.x2,u.y1]}else if(R){var L=u.y1+z+(p?d/2*I:0),Z=u.x1,H=u.x2;n.segpts=[Z,L,H,L]}else{var ne=u.x1+z+(p?c/2*I:0),$=u.y1,J=u.y2;n.segpts=[ne,$,ne,J]}if(n.isRound){var oe=e.pstyle("taxi-radius").value,ie=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(oe),n.isArcRadius=new Array(n.segpts.length/2).fill(ie)}},He.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,o=t.srcW,i=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,g=t.srcRs,p=t.tgtRs,v=!te(n.startX)||!te(n.startY),b=!te(n.arrowStartX)||!te(n.arrowStartY),f=!te(n.endX)||!te(n.endY),y=!te(n.arrowEndX)||!te(n.arrowEndY),m=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),k=jt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=kP.poolIndex()){var T=E;E=P,P=T}var B=x.srcPos=E.position(),M=x.tgtPos=P.position(),z=x.srcW=E.outerWidth(),R=x.srcH=E.outerHeight(),F=x.tgtW=P.outerWidth(),N=x.tgtH=P.outerHeight(),I=x.srcShape=n.nodeShapes[t.getNodeShape(E)],X=x.tgtShape=n.nodeShapes[t.getNodeShape(P)],O=x.srcCornerRadius=E.pstyle("corner-radius").value==="auto"?"auto":E.pstyle("corner-radius").pfValue,Y=x.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,j=x.tgtRs=P._private.rscratch,G=x.srcRs=E._private.rscratch;x.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var W=0;W0){var ae=u,de=Wt(ae,un(t)),ue=Wt(ae,un(re)),Q=de;ue2&&Wt(ae,{x:re[2],y:re[3]})0){var oe=c,ie=Wt(oe,un(t)),se=Wt(oe,un(J)),pe=ie;se2&&Wt(oe,{x:J[2],y:J[3]})=g||S){p={cp:m,segment:x};break}}if(p)break}var w=p.cp,D=p.segment,E=(g-b)/D.length,P=D.t1-D.t0,T=h?D.t0+P*E:D.t1-P*E;T=jn(0,T,1),t=cn(w.p0,w.p1,w.p2,T),d=function(O,Y,j,G){var W=jn(0,G-.001,1),q=jn(0,G+.001,1),K=cn(O,Y,j,W),U=cn(O,Y,j,q);return Rs(K,U)}(w.p0,w.p1,w.p2,T);break;case"straight":case"segments":case"haystack":for(var B,M,z,R,F=0,N=r.allpts.length,I=0;I+3=g));I+=2);var X=(g-M)/B;X=jn(0,X,1),t=function(O,Y,j,G){var W=Y.x-O.x,q=Y.y-O.y,K=jt(O,Y),U=W/K,re=q/K;return j=j??0,G=G??j*K,{x:O.x+U*G,y:O.y+re*G}}(z,R,X),d=Rs(z,R)}i("labelX",c,t.x),i("labelY",c,t.y),i("labelAutoAngle",c,d)}};u("source"),u("target"),this.applyLabelDimensions(e)}},Pt.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Pt.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,i=e.pstyle("text-wrap").strValue,s=ct(n.rscratch,"labelWrapCachedLines",t)||[],l=i!=="wrap"?1:Math.max(s.length,1),u=a.height/l,c=u*o,d=a.width,h=a.height+(l-1)*(o-1)*u;_t(n.rstyle,"labelWidth",t,d),_t(n.rscratch,"labelWidth",t,d),_t(n.rstyle,"labelHeight",t,h),_t(n.rscratch,"labelHeight",t,h),_t(n.rscratch,"labelLineHeight",t,c)},Pt.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,i=function(z,R){return R?(_t(n.rscratch,z,t,R),R):ct(n.rscratch,z,t)};if(!a)return"";o=="none"||(o=="uppercase"?a=a.toUpperCase():o=="lowercase"&&(a=a.toLowerCase()));var s=e.pstyle("text-wrap").value;if(s==="wrap"){var l=i("labelKey");if(l!=null&&i("labelWrapKey")===l)return i("labelWrapCachedText");for(var u=a.split(` +`),c=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value==="anywhere",h=[],g=/[\s\u200b]+|$/g,p=0;pc){var y,m="",k=0,x=vi(v.matchAll(g));try{for(x.s();!(y=x.n()).done;){var S=y.value,w=S[0],D=v.substring(k,S.index);k=S.index+w.length;var E=m.length===0?D:m+D+w;this.calculateLabelDimensions(e,E).width<=c?m+=D+w:(m&&h.push(m),m=D+w)}}catch(z){x.e(z)}finally{x.f()}m.match(/^[\s\u200b]+$/)||h.push(m)}else h.push(v)}i("labelWrapCachedLines",h),a=i("labelWrapCachedText",h.join(` +`)),i("labelWrapKey",l)}else if(s==="ellipsis"){var P=e.pstyle("text-max-width").pfValue,T="",B=!1;if(this.calculateLabelDimensions(e,a).widthP);M++)T+=a[M],M===a.length-1&&(B=!0);return B||(T+="\u2026"),T}return a},Pt.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t!=="auto")return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},Pt.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,a=Yt(t,e._private.labelDimsKey),o=n.labelDimCache||(n.labelDimCache=[]),i=o[a];if(i!=null)return i;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var g=d.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var p=0,v=0,b=t.split(` +`),f=0;f1&&arguments[1]!==void 0)||arguments[1];if(t.merge(o),i)for(var s=0;s=e.desktopTapThreshold2}var Ue=a(C);oe&&(e.hoverData.tapholdCancelled=!0),_=!0,r(J,["mousemove","vmousemove","tapdrag"],C,{x:Z[0],y:Z[1]});var pt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||A.emit({originalEvent:C,type:"boxstart",position:{x:Z[0],y:Z[1]}}),$[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(oe){var Ke={originalEvent:C,type:"cxtdrag",position:{x:Z[0],y:Z[1]}};se?se.emit(Ke):A.emit(Ke),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&J===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:C,type:"cxtdragout",position:{x:Z[0],y:Z[1]}}),e.hoverData.cxtOver=J,J&&J.emit({originalEvent:C,type:"cxtdragover",position:{x:Z[0],y:Z[1]}}))}}else if(e.hoverData.dragging){if(_=!0,A.panningEnabled()&&A.userPanningEnabled()){var Ze;if(e.hoverData.justStartedPan){var ot=e.hoverData.mdownPos;Ze={x:(Z[0]-ot[0])*V,y:(Z[1]-ot[1])*V},e.hoverData.justStartedPan=!1}else Ze={x:pe[0]*V,y:pe[1]*V};A.panBy(Ze),A.emit("dragpan"),e.hoverData.dragged=!0}Z=e.projectIntoViewport(C.clientX,C.clientY)}else if($[4]!=1||se!=null&&!se.pannable()){if(se&&se.pannable()&&se.active()&&se.unactivate(),se&&se.grabbed()||J==ie||(ie&&r(ie,["mouseout","tapdragout"],C,{x:Z[0],y:Z[1]}),J&&r(J,["mouseover","tapdragover"],C,{x:Z[0],y:Z[1]}),e.hoverData.last=J),se)if(oe){if(A.boxSelectionEnabled()&&Ue)se&&se.grabbed()&&(d(fe),se.emit("freeon"),fe.emit("free"),e.dragData.didDrag&&(se.emit("dragfreeon"),fe.emit("dragfree"))),pt();else if(se&&se.grabbed()&&e.nodeIsDraggable(se)){var ft=!e.dragData.didDrag;ft&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(fe,{inDragLayer:!0});var $e={x:0,y:0};if(te(pe[0])&&te(pe[1])&&($e.x+=pe[0],$e.y+=pe[1],ft)){var Qe=e.hoverData.dragDelta;Qe&&te(Qe[0])&&te(Qe[1])&&($e.x+=Qe[0],$e.y+=Qe[1])}e.hoverData.draggingEles=!0,fe.silentShift($e).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else(function(){var st=e.hoverData.dragDelta=e.hoverData.dragDelta||[];st.length===0?(st.push(pe[0]),st.push(pe[1])):(st[0]+=pe[0],st[1]+=pe[1])})();_=!0}else oe&&(e.hoverData.dragging||!A.boxSelectionEnabled()||!Ue&&A.panningEnabled()&&A.userPanningEnabled()?!e.hoverData.selecting&&A.panningEnabled()&&A.userPanningEnabled()&&o(se,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,$[4]=0,e.data.bgActivePosistion=un(H),e.redrawHint("select",!0),e.redraw()):pt(),se&&se.pannable()&&se.active()&&se.unactivate());return $[2]=Z[0],$[3]=Z[1],_?(C.stopPropagation&&C.stopPropagation(),C.preventDefault&&C.preventDefault(),!1):void 0}},!1),e.registerBinding(t,"mouseup",function(C){if((e.hoverData.which!==1||C.which===1||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var _=e.cy,A=e.projectIntoViewport(C.clientX,C.clientY),V=e.selection,L=e.findNearestElement(A[0],A[1],!0,!1),Z=e.dragData.possibleDragElements,H=e.hoverData.down,ne=a(C);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,H&&H.unactivate(),e.hoverData.which===3){var $={originalEvent:C,type:"cxttapend",position:{x:A[0],y:A[1]}};if(H?H.emit($):_.emit($),!e.hoverData.cxtDragged){var J={originalEvent:C,type:"cxttap",position:{x:A[0],y:A[1]}};H?H.emit(J):_.emit(J)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(L,["mouseup","tapend","vmouseup"],C,{x:A[0],y:A[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(H,["click","tap","vclick"],C,{x:A[0],y:A[1]}),m=!1,C.timeStamp-k<=_.multiClickDebounceTime()?(y&&clearTimeout(y),m=!0,k=null,r(H,["dblclick","dbltap","vdblclick"],C,{x:A[0],y:A[1]})):(y=setTimeout(function(){m||r(H,["oneclick","onetap","voneclick"],C,{x:A[0],y:A[1]})},_.multiClickDebounceTime()),k=C.timeStamp)),H!=null||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(C)||(_.$(n).unselect(["tapunselect"]),Z.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=Z=_.collection()),L!=H||e.dragData.didDrag||e.hoverData.selecting||L!=null&&L._private.selectable&&(e.hoverData.dragging||(_.selectionType()==="additive"||ne?L.selected()?L.unselect(["tapunselect"]):L.select(["tapselect"]):ne||(_.$(n).unmerge(L).unselect(["tapunselect"]),L.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var oe=_.collection(e.getAllInBox(V[0],V[1],V[2],V[3]));e.redrawHint("select",!0),oe.length>0&&e.redrawHint("eles",!0),_.emit({type:"boxend",originalEvent:C,position:{x:A[0],y:A[1]}});var ie=function(pe){return pe.selectable()&&!pe.selected()};_.selectionType()==="additive"||ne||_.$(n).unmerge(oe).unselect(),oe.emit("box").stdFilter(ie).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!V[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var se=H&&H.grabbed();d(Z),se&&(H.emit("freeon"),Z.emit("free"),e.dragData.didDrag&&(H.emit("dragfreeon"),Z.emit("dragfree")))}}V[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var S,w,D,E,P,T,B,M,z,R,F,N,I,X=function(C){if(!e.scrollingPage){var _=e.cy,A=_.zoom(),V=_.pan(),L=e.projectIntoViewport(C.clientX,C.clientY),Z=[L[0]*A+V.x,L[1]*A+V.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||e.selection[4]!==0)C.preventDefault();else if(_.panningEnabled()&&_.userPanningEnabled()&&_.zoomingEnabled()&&_.userZoomingEnabled()){var H;C.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150),H=C.deltaY!=null?C.deltaY/-250:C.wheelDeltaY!=null?C.wheelDeltaY/1e3:C.wheelDelta/1e3,H*=e.wheelSensitivity,C.deltaMode===1&&(H*=33);var ne=_.zoom()*Math.pow(10,H);C.type==="gesturechange"&&(ne=e.gestureStartZoom*C.scale),_.zoom({level:ne,renderedPosition:{x:Z[0],y:Z[1]}}),_.emit(C.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",X,!0),e.registerBinding(t,"scroll",function(C){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(C){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||C.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(C){e.hasTouchStarted||X(C)},!0),e.registerBinding(e.container,"mouseout",function(C){var _=e.projectIntoViewport(C.clientX,C.clientY);e.cy.emit({originalEvent:C,type:"mouseout",position:{x:_[0],y:_[1]}})},!1),e.registerBinding(e.container,"mouseover",function(C){var _=e.projectIntoViewport(C.clientX,C.clientY);e.cy.emit({originalEvent:C,type:"mouseover",position:{x:_[0],y:_[1]}})},!1);var O,Y,j,G,W,q,K,U=function(C,_,A,V){return Math.sqrt((A-C)*(A-C)+(V-_)*(V-_))},re=function(C,_,A,V){return(A-C)*(A-C)+(V-_)*(V-_)};if(e.registerBinding(e.container,"touchstart",O=function(C){if(e.hasTouchStarted=!0,x(C)){g(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var _=e.cy,A=e.touchData.now,V=e.touchData.earlier;if(C.touches[0]){var L=e.projectIntoViewport(C.touches[0].clientX,C.touches[0].clientY);A[0]=L[0],A[1]=L[1]}if(C.touches[1]&&(L=e.projectIntoViewport(C.touches[1].clientX,C.touches[1].clientY),A[2]=L[0],A[3]=L[1]),C.touches[2]&&(L=e.projectIntoViewport(C.touches[2].clientX,C.touches[2].clientY),A[4]=L[0],A[5]=L[1]),C.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var Z=e.findContainerClientCoords();z=Z[0],R=Z[1],F=Z[2],N=Z[3],S=C.touches[0].clientX-z,w=C.touches[0].clientY-R,D=C.touches[1].clientX-z,E=C.touches[1].clientY-R,I=0<=S&&S<=F&&0<=D&&D<=F&&0<=w&&w<=N&&0<=E&&E<=N;var H=_.pan(),ne=_.zoom();if(P=U(S,w,D,E),T=re(S,w,D,E),M=[((B=[(S+D)/2,(w+E)/2])[0]-H.x)/ne,(B[1]-H.y)/ne],T<4e4&&!C.touches[2]){var $=e.findNearestElement(A[0],A[1],!0,!0),J=e.findNearestElement(A[2],A[3],!0,!0);return $&&$.isNode()?($.activate().emit({originalEvent:C,type:"cxttapstart",position:{x:A[0],y:A[1]}}),e.touchData.start=$):J&&J.isNode()?(J.activate().emit({originalEvent:C,type:"cxttapstart",position:{x:A[0],y:A[1]}}),e.touchData.start=J):_.emit({originalEvent:C,type:"cxttapstart",position:{x:A[0],y:A[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(C.touches[2])_.boxSelectionEnabled()&&C.preventDefault();else if(!C.touches[1]){if(C.touches[0]){var oe=e.findNearestElements(A[0],A[1],!0,!0),ie=oe[0];if(ie!=null&&(ie.activate(),e.touchData.start=ie,e.touchData.starts=oe,e.nodeIsGrabbable(ie))){var se=e.dragData.touchDragEles=_.collection(),pe=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ie.selected()?(pe=_.$(function(Te){return Te.selected()&&e.nodeIsGrabbable(Te)}),u(pe,{addToList:se})):c(ie,{addToList:se}),s(ie);var fe=function(Te){return{originalEvent:C,type:Te,position:{x:A[0],y:A[1]}}};ie.emit(fe("grabon")),pe?pe.forEach(function(Te){Te.emit(fe("grab"))}):ie.emit(fe("grab"))}r(ie,["touchstart","tapstart","vmousedown"],C,{x:A[0],y:A[1]}),ie==null&&(e.data.bgActivePosistion={x:L[0],y:L[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved!==!1||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],C,{x:A[0],y:A[1]})},e.tapholdDuration)}}if(C.touches.length>=1){for(var xe=e.touchData.startPosition=[null,null,null,null,null,null],ge=0;ge=e.touchTapThreshold2}if(_&&e.touchData.cxt){C.preventDefault();var xe=C.touches[0].clientX-z,ge=C.touches[0].clientY-R,De=C.touches[1].clientX-z,Te=C.touches[1].clientY-R,Ue=re(xe,ge,De,Te);if(Ue/T>=2.25||Ue>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var pt={originalEvent:C,type:"cxttapend",position:{x:L[0],y:L[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(pt),e.touchData.start=null):V.emit(pt)}}if(_&&e.touchData.cxt){pt={originalEvent:C,type:"cxtdrag",position:{x:L[0],y:L[1]}},e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(pt):V.emit(pt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Ke=e.findNearestElement(L[0],L[1],!0,!0);e.touchData.cxtOver&&Ke===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:C,type:"cxtdragout",position:{x:L[0],y:L[1]}}),e.touchData.cxtOver=Ke,Ke&&Ke.emit({originalEvent:C,type:"cxtdragover",position:{x:L[0],y:L[1]}}))}else if(_&&C.touches[2]&&V.boxSelectionEnabled())C.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||V.emit({originalEvent:C,type:"boxstart",position:{x:L[0],y:L[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,A[4]=1,A&&A.length!==0&&A[0]!==void 0?(A[2]=(L[0]+L[2]+L[4])/3,A[3]=(L[1]+L[3]+L[5])/3):(A[0]=(L[0]+L[2]+L[4])/3,A[1]=(L[1]+L[3]+L[5])/3,A[2]=(L[0]+L[2]+L[4])/3+1,A[3]=(L[1]+L[3]+L[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(_&&C.touches[1]&&!e.touchData.didSelect&&V.zoomingEnabled()&&V.panningEnabled()&&V.userZoomingEnabled()&&V.userPanningEnabled()){if(C.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),xt=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var Ze=0;Ze0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",j=function(C){var _=e.touchData.start;e.touchData.capture=!1,_&&_.unactivate()}),e.registerBinding(t,"touchend",G=function(C){var _=e.touchData.start;if(e.touchData.capture){C.touches.length===0&&(e.touchData.capture=!1),C.preventDefault();var A=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var V,L=e.cy,Z=L.zoom(),H=e.touchData.now,ne=e.touchData.earlier;if(C.touches[0]){var $=e.projectIntoViewport(C.touches[0].clientX,C.touches[0].clientY);H[0]=$[0],H[1]=$[1]}if(C.touches[1]&&($=e.projectIntoViewport(C.touches[1].clientX,C.touches[1].clientY),H[2]=$[0],H[3]=$[1]),C.touches[2]&&($=e.projectIntoViewport(C.touches[2].clientX,C.touches[2].clientY),H[4]=$[0],H[5]=$[1]),_&&_.unactivate(),e.touchData.cxt){if(V={originalEvent:C,type:"cxttapend",position:{x:H[0],y:H[1]}},_?_.emit(V):L.emit(V),!e.touchData.cxtDragged){var J={originalEvent:C,type:"cxttap",position:{x:H[0],y:H[1]}};_?_.emit(J):L.emit(J)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!C.touches[2]&&L.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var oe=L.collection(e.getAllInBox(A[0],A[1],A[2],A[3]));A[0]=void 0,A[1]=void 0,A[2]=void 0,A[3]=void 0,A[4]=0,e.redrawHint("select",!0),L.emit({type:"boxend",originalEvent:C,position:{x:H[0],y:H[1]}}),oe.emit("box").stdFilter(function(Ue){return Ue.selectable()&&!Ue.selected()}).select().emit("boxselect"),oe.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(_!=null&&_.unactivate(),C.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!C.touches[1]){if(!C.touches[0]){if(!C.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ie=e.dragData.touchDragEles;if(_!=null){var se=_._private.grabbed;d(ie),e.redrawHint("drag",!0),e.redrawHint("eles",!0),se&&(_.emit("freeon"),ie.emit("free"),e.dragData.didDrag&&(_.emit("dragfreeon"),ie.emit("dragfree"))),r(_,["touchend","tapend","vmouseup","tapdragout"],C,{x:H[0],y:H[1]}),_.unactivate(),e.touchData.start=null}else{var pe=e.findNearestElement(H[0],H[1],!0,!0);r(pe,["touchend","tapend","vmouseup","tapdragout"],C,{x:H[0],y:H[1]})}var fe=e.touchData.startPosition[0]-H[0],xe=fe*fe,ge=e.touchData.startPosition[1]-H[1],De=(xe+ge*ge)*Z*Z;e.touchData.singleTouchMoved||(_||L.$(":selected").unselect(["tapunselect"]),r(_,["tap","vclick"],C,{x:H[0],y:H[1]}),W=!1,C.timeStamp-K<=L.multiClickDebounceTime()?(q&&clearTimeout(q),W=!0,K=null,r(_,["dbltap","vdblclick"],C,{x:H[0],y:H[1]})):(q=setTimeout(function(){W||r(_,["onetap","voneclick"],C,{x:H[0],y:H[1]})},L.multiClickDebounceTime()),K=C.timeStamp)),_!=null&&!e.dragData.didDrag&&_._private.selectable&&De"u"){var ae=[],de=function(C){return{clientX:C.clientX,clientY:C.clientY,force:1,identifier:C.pointerId,pageX:C.pageX,pageY:C.pageY,radiusX:C.width/2,radiusY:C.height/2,screenX:C.screenX,screenY:C.screenY,target:C.target}},ue=function(C){ae.push(function(_){return{event:_,touch:de(_)}}(C))},Q=function(C){for(var _=0;_2){for(var D=[x[0],x[1]],E=Math.pow(D[0]-d,2)+Math.pow(D[1]-h,2),P=1;P0)return O[0]}return null},g=Object.keys(d),p=0;p0?u:Wi(a,o,e,t,n,r,i,s)},checkPoint:function(e,t,n,r,a,o,i,s){var l=2*(s=s==="auto"?Kt(r,a):s);if(Et(e,t,this.points,o,i,r,a-l,[0,-1],n)||Et(e,t,this.points,o,i,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!et(e,t,[o-u,i-c,o-u,i,o+u,i,o+u,i-c])||!!Ht(e,t,l,l,o+r/2-s,i+a/2-s,n)||!!Ht(e,t,l,l,o-r/2+s,i+a/2-s,n)}}},Ft.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Ge(3,0)),this.generateRoundPolygon("round-triangle",Ge(3,0)),this.generatePolygon("rectangle",Ge(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Ge(5,0)),this.generateRoundPolygon("round-pentagon",Ge(5,0)),this.generatePolygon("hexagon",Ge(6,0)),this.generateRoundPolygon("round-hexagon",Ge(6,0)),this.generatePolygon("heptagon",Ge(7,0)),this.generateRoundPolygon("round-heptagon",Ge(7,0)),this.generatePolygon("octagon",Ge(8,0)),this.generateRoundPolygon("round-octagon",Ge(8,0));var r=new Array(20),a=va(5,0),o=va(5,Math.PI/5),i=.5*(3-Math.sqrt(5));i*=1.57;for(var s=0;s=e.deqFastCost*b)break}else if(o){if(p>=e.deqCost*u||p>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*ai)break;var f=e.deq(t,h,d);if(!(f.length>0))break;for(var y=0;y0&&(e.onDeqd(t,c),!o&&e.shouldRedraw(t,c,h,d)&&r())},a(t))}}},sh=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gr;ra(this,e),this.idsByKey=new yt,this.keyForId=new yt,this.cachesByLvl=new yt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return aa(e,[{key:"getIdsFor",value:function(t){t==null&&Be("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new ln,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id();return this.keyForId.get(n)!==this.getKey(t)}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new yt,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id());return this.getCache(r,n)}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}]),e}(),Mn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},lh=Re({getKey:null,doesEleInvalidateKey:gr,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Li,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),or=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=lh(t);he(n,r),n.lookup=new sh(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},ze=or.prototype;ze.reasons=Mn,ze.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},ze.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},ze.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Yn(function(e,t){return t.reqs-e.reqs})},ze.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},ze.getElement=function(e,t,n,r,a){var o=this,i=this.renderer,s=i.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(pa(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=i.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var g,p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(g=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=o.getTextureQueue(g),b=v[v.length-2],f=function(){return o.recycleTexture(g,d)||o.addTexture(g,d)};b||(b=v[v.length-1]),b||(b=f()),b.width-b.usedWidthr;T--)E=o.getElement(e,t,n,T,Mn.downscale);P()}else{var B;if(!k&&!x&&!S)for(var M=r-1;M>=-4;M--){var z=l.get(e,M);if(z){B=z;break}}if(m(B))return o.queueElement(e,r),B;b.context.translate(b.usedWidth,0),b.context.scale(u,u),this.drawElement(b.context,e,t,h,!1),b.context.scale(1/u,1/u),b.context.translate(-b.usedWidth,0)}return p={x:b.usedWidth,texture:b,level:r,scale:u,width:d,height:c,scaledLabelShown:h},b.usedWidth+=Math.ceil(d+8),b.eleCaches.push(p),l.set(e,r,p),o.checkTextureFullness(b),p},ze.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},ze.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Bt(t,e):e.fullnessChecks++},ze.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Bt(n,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,da(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Bt(r,o),n.push(o),o}},ze.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),o=r[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,n.updateItem(o);else{var i={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(i),r[a]=i}},ze.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],o=t.lookup,i=0;i<1&&n.size()>0;i++){var s=n.pop(),l=s.key,u=s.eles[0],c=o.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Mn.dequeue)}}return a},ze.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];a!=null&&(a.eles.length===1?(a.reqs=ua,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},ze.onDequeue=function(e){this.onDequeues.push(e)},ze.offDequeue=function(e){Bt(this.onDequeues,e)},ze.setupDequeueing=js({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null}r.validateLayersElesOrdering(n,e);var i,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;(function(){var k=function(D){if(r.validateLayersElesOrdering(D,e),r.levelIsComplete(D,e))return s=l[D],!0},x=function(D){if(!s)for(var E=n+D;-4<=E&&E<=2&&!k(E);E+=D);};x(1),x(-1);for(var S=c.length-1;S>=0;S--){var w=c[S];w.invalid&&Bt(c,w)}})();var d=function(k){var x=(k=k||{}).after;if(function(){if(!i){i=Je();for(var D=0;D16e6)return null;var S=r.makeLayer(i,n);if(x!=null){var w=c.indexOf(x)+1;c.splice(w,0,S)}else(k.insert===void 0||k.insert)&&c.unshift(S);return S};if(r.skipping&&!o)return null;for(var h=null,g=e.length/1,p=!o,v=0;v=g||!ji(h.bb,b.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||p?r.queueLayer(h,b):r.drawEleInLayer(h,b,n,t),h.eles.push(b),y[n]=h}}return s||(p?null:c)},Xe.getEleLevelForLayerLevel=function(e,t){return e},Xe.drawEleInLayer=function(e,t,n,r){var a=this.renderer,o=e.context,i=t.boundingBox();i.w!==0&&i.h!==0&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,!0),a.setImgSmoothing(o,!0))},Xe.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,a=0;a0||o.invalid)return!1;r+=o.eles.length}return r===t.length},Xe.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Xe.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=wt(),e.length!==0&&t.haveLayers()&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},Xe.invalidateLayer=function(e){if(this.lastInvalidationTime=wt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Bt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],o=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],i=this,s=t._private.rscratch;if((!o||t.visible())&&!s.badLine&&s.allpts!=null&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,g=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,b=t.pstyle("line-outline-color").value,f=u*c,y=u*c,m=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f;d==="straight-triangle"?(i.eleStrokeStyle(e,t,E),i.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=g,e.lineCap=p,i.eleStrokeStyle(e,t,E),i.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},k=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;i.drawArrowheads(e,t,E)};if(e.lineJoin="round",t.pstyle("ghost").value==="yes"){var x=t.pstyle("ghost-offset-x").pfValue,S=t.pstyle("ghost-offset-y").pfValue,w=t.pstyle("ghost-opacity").value,D=f*w;e.translate(x,S),m(D),k(D),e.translate(-x,-S)}else(function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f;e.lineWidth=g+v,e.lineCap=p,v>0?(i.colorStrokeStyle(e,b[0],b[1],b[2],E),d==="straight-triangle"?i.drawEdgeTrianglePath(t,e,s.allpts):(i.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"})();a&&i.drawEdgeUnderlay(e,t),m(),k(),a&&i.drawEdgeOverlay(e,t),i.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},Zs=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var a=this,o=a.usePaths(),i=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,i.edgeType!=="self"||o?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,i.allpts,"solid")}}}};Xt.drawEdgeOverlay=Zs("overlay"),Xt.drawEdgeUnderlay=Zs("underlay"),Xt.drawEdgePath=function(e,t,n,r){var a,o=e._private.rscratch,i=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");o.pathCacheKey&&o.pathCacheKey===d?(a=t=o.pathCache,s=!0):(a=t=new Path2D,o.pathCacheKey=d,o.pathCache=a)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=c;break;case"solid":i.setLineDash([])}if(!s&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==void 0?arguments[5]:5,i=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),i?e.stroke():e.fill()}en.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(pa(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t5&&arguments[5]!==void 0)||arguments[5],i=this;if(r==null){if(o&&!i.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=i.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var g,p=!n;n&&(g=n,e.translate(-g.x1,-g.y1)),a==null?(i.drawText(e,t,null,p,o),t.isEdge()&&(i.drawText(e,t,"source",p,o),i.drawText(e,t,"target",p,o))):i.drawText(e,t,a,p,o),n&&e.translate(g.x1,g.y1)},en.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&arguments[2]!==void 0)||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,i=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+i+" "+a+" "+o,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},en.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",a=e.pstyle(r+"text-rotation"),o=ct(n,"labelAngle",t);return a.strValue==="autorotate"?e.isEdge()?o:0:a.strValue==="none"?0:a.pfValue},en.drawText=function(e,t,n){var r=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],o=t._private.rscratch,i=a?t.effectiveOpacity():1;if(!a||i!==0&&t.pstyle("text-opacity").value!==0){n==="main"&&(n=null);var s,l,u=ct(o,"labelX",n),c=ct(o,"labelY",n),d=this.getLabelText(t,n);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,g=n?n+"-":"",p=ct(o,"labelWidth",n),v=ct(o,"labelHeight",n),b=t.pstyle(g+"text-margin-x").pfValue,f=t.pstyle(g+"text-margin-y").pfValue,y=t.isEdge(),m=t.pstyle("text-halign").value,k=t.pstyle("text-valign").value;switch(y&&(m="center",k="center"),u+=b,c+=f,(h=r?this.getTextAngle(t,n):0)!==0&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),k){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v}var x=t.pstyle("text-background-opacity").value,S=t.pstyle("text-border-opacity").value,w=t.pstyle("text-border-width").pfValue,D=t.pstyle("text-background-padding").pfValue,E=t.pstyle("text-background-shape").strValue.indexOf("round")===0;if(x>0||w>0&&S>0){var P=u-D;switch(m){case"left":P-=p;break;case"center":P-=p/2}var T=c-v-D,B=p+2*D,M=v+2*D;if(x>0){var z=e.fillStyle,R=t.pstyle("text-background-color").value;e.fillStyle="rgba("+R[0]+","+R[1]+","+R[2]+","+x*i+")",E?oi(e,P,T,B,M,2):e.fillRect(P,T,B,M),e.fillStyle=z}if(w>0&&S>0){var F=e.strokeStyle,N=e.lineWidth,I=t.pstyle("text-border-color").value,X=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+S*i+")",e.lineWidth=w,e.setLineDash)switch(X){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=w/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(E?oi(e,P,T,B,M,2,"stroke"):e.strokeRect(P,T,B,M),X==="double"){var O=w/2;E?oi(e,P+O,T+O,B-2*O,M-2*O,2,"stroke"):e.strokeRect(P+O,T+O,B-2*O,M-2*O)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=F}}var Y=2*t.pstyle("text-outline-width").pfValue;if(Y>0&&(e.lineWidth=Y),t.pstyle("text-wrap").value==="wrap"){var j=ct(o,"labelWrapCachedLines",n),G=ct(o,"labelLineHeight",n),W=p/2,q=this.getLabelJustification(t);switch(q==="auto"||(m==="left"?q==="left"?u+=-p:q==="center"&&(u+=-W):m==="center"?q==="left"?u+=-W:q==="right"&&(u+=W):m==="right"&&(q==="center"?u+=W:q==="right"&&(u+=p))),k){case"top":case"center":case"bottom":c-=(j.length-1)*G}for(var K=0;K0&&e.strokeText(j[K],u,c),e.fillText(j[K],u,c),c+=G}else Y>0&&e.strokeText(d,u,c),e.fillText(d,u,c);h!==0&&(e.rotate(-h),e.translate(-s,-l))}}};var sr={drawNode:function(e,t,n){var r,a,o=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],s=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(te(d.x)&&te(d.y)&&(!s||t.visible())){var h,g,p=s?t.effectiveOpacity():1,v=l.usePaths(),b=!1,f=t.padding();r=t.width()+2*f,a=t.height()+2*f,n&&(g=n,e.translate(-g.x1,-g.y1));for(var y=t.pstyle("background-image").value,m=new Array(y.length),k=new Array(y.length),x=0,S=0;S0&&arguments[0]!==void 0?arguments[0]:T;l.eleFillStyle(e,t,$)},U=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;l.colorStrokeStyle(e,B[0],B[1],B[2],$)},re=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G;l.colorStrokeStyle(e,Y[0],Y[1],Y[2],$)},ae=function($,J,oe,ie){var se,pe=l.nodePathCache=l.nodePathCache||[],fe=Ni(oe==="polygon"?oe+","+ie.join(","):oe,""+J,""+$,""+q),xe=pe[fe],ge=!1;return xe!=null?(se=xe,ge=!0,c.pathCache=se):(se=new Path2D,pe[fe]=c.pathCache=se),{path:se,cacheHit:ge}},de=t.pstyle("shape").strValue,ue=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var Q=ae(r,a,de,ue);h=Q.path,b=Q.cacheHit}var le=function(){if(!b){var $=d;v&&($={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,$.x,$.y,r,a,q,c)}v?e.fill(h):e.fill()},ee=function(){for(var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],oe=u.backgrounding,ie=0,se=0;se0&&arguments[0]!==void 0&&arguments[0],J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;l.hasPie(t)&&(l.drawPie(e,t,J),$&&(v||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,q,c)))},_=function(){var $=(E>0?E:-E)*(arguments.length>0&&arguments[0]!==void 0?arguments[0]:p),J=E>0?0:255;E!==0&&(l.colorFillStyle(e,J,J,J,$),v?e.fill(h):e.fill())},A=function(){if(P>0){if(e.lineWidth=P,e.lineCap=R,e.lineJoin=z,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(N),e.lineDashOffset=I;break;case"solid":case"double":e.setLineDash([])}if(F!=="center"){if(e.save(),e.lineWidth*=2,F==="inside")v?e.clip(h):e.clip();else{var $=new Path2D;$.rect(-r/2-P,-a/2-P,r+2*P,a+2*P),$.addPath(h),e.clip($,"evenodd")}v?e.stroke(h):e.stroke(),e.restore()}else v?e.stroke(h):e.stroke();if(M==="double"){e.lineWidth=P/3;var J=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(h):e.stroke(),e.globalCompositeOperation=J}e.setLineDash&&e.setLineDash([])}},V=function(){if(O>0){if(e.lineWidth=O,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var $=d;v&&($={x:0,y:0});var J=l.getNodeShape(t),oe=P;F==="inside"&&(oe=0),F==="outside"&&(oe*=2);var ie,se=(r+oe+(O+W))/r,pe=(a+oe+(O+W))/a,fe=r*se,xe=a*pe,ge=l.nodeShapes[J].points;if(v&&(ie=ae(fe,xe,J,ge).path),J==="ellipse")l.drawEllipsePath(ie||e,$.x,$.y,fe,xe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(J)){var De=0,Te=0,Ue=0;J==="round-diamond"?De=1.4*(oe+W+O):J==="round-heptagon"?(De=1.075*(oe+W+O),Ue=-(oe/2+W+O)/35):J==="round-hexagon"?De=1.12*(oe+W+O):J==="round-pentagon"?(De=1.13*(oe+W+O),Ue=-(oe/2+W+O)/15):J==="round-tag"?(De=1.12*(oe+W+O),Te=.07*(oe/2+O+W)):J==="round-triangle"&&(De=(oe+W+O)*(Math.PI/2),Ue=-(oe+W/2+O)/Math.PI),De!==0&&(fe=r*(se=(r+De)/r),["round-hexagon","round-tag"].includes(J)||(xe=a*(pe=(a+De)/a)));for(var pt=fe/2,Ke=xe/2,Ze=(q=q==="auto"?Ki(fe,xe):q)+(oe+O+W)/2,ot=new Array(ge.length/2),ft=new Array(ge.length/2),$e=0;$e0){if(r=r||n.position(),a==null||o==null){var d=n.padding();a=n.width()+2*d,o=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,a+2*i,o+2*i,c),t.fill()}}}};sr.drawNodeOverlay=$s("overlay"),sr.drawNodeUnderlay=$s("underlay"),sr.hasPie=function(e){return(e=e[0])._private.hasPie},sr.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),o=t.pstyle("pie-size"),i=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(i=0,s=0),o.units==="%"?c*=o.pfValue:o.pfValue!==void 0&&(c=o.pfValue/2);for(var h=1;h<=a.pieBackgroundN;h++){var g=t.pstyle("pie-"+h+"-background-size").value,p=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,b=g/100;b+d>1&&(b=1-d);var f=1.5*Math.PI+2*Math.PI*d,y=f+2*Math.PI*b;g===0||d>=1||d+b>1||(e.beginPath(),e.moveTo(i,s),e.arc(i,s,c,f,y),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],v),e.fill(),d+=b)}};var nt={};nt.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},nt.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,a=0;ai.minMbLowQualFrames&&(i.motionBlurPxRatio=i.mbPxRBlurry)),i.clearingMotionBlur&&(i.motionBlurPxRatio=1),i.textureDrawLastFrame&&!d&&(c[i.NODE]=!0,c[i.SELECT_BOX]=!0);var y=l.style(),m=l.zoom(),k=a!==void 0?a:m,x=l.pan(),S={x:x.x,y:x.y},w={zoom:m,pan:{x:x.x,y:x.y}},D=i.prevViewport;D===void 0||w.zoom!==D.zoom||w.pan.x!==D.pan.x||w.pan.y!==D.pan.y||v&&!p||(i.motionBlurPxRatio=1),o&&(S=o),k*=s,S.x*=s,S.y*=s;var E=i.getCachedZSortedEles();function P(ue,Q,le,ee,C){var _=ue.globalCompositeOperation;ue.globalCompositeOperation="destination-out",i.colorFillStyle(ue,255,255,255,i.motionBlurTransparency),ue.fillRect(Q,le,ee,C),ue.globalCompositeOperation=_}function T(ue,Q){var le,ee,C,_;i.clearingMotionBlur||ue!==u.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]&&ue!==u.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]?(le=S,ee=k,C=i.canvasWidth,_=i.canvasHeight):(le={x:x.x*g,y:x.y*g},ee=m*g,C=i.canvasWidth*g,_=i.canvasHeight*g),ue.setTransform(1,0,0,1,0,0),Q==="motionBlur"?P(ue,0,0,C,_):t||Q!==void 0&&!Q||ue.clearRect(0,0,C,_),n||(ue.translate(le.x,le.y),ue.scale(ee,ee)),o&&ue.translate(o.x,o.y),a&&ue.scale(a,a)}if(d||(i.textureDrawLastFrame=!1),d){if(i.textureDrawLastFrame=!0,!i.textureCache){i.textureCache={},i.textureCache.bb=l.mutableElements().boundingBox(),i.textureCache.texture=i.data.bufferCanvases[i.TEXTURE_BUFFER];var B=i.data.bufferContexts[i.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,i.canvasWidth*i.textureMult,i.canvasHeight*i.textureMult),i.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:s*i.textureMult}),(w=i.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:i.canvasWidth,height:i.canvasHeight}).mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}c[i.DRAG]=!1,c[i.NODE]=!1;var M=u.contexts[i.NODE],z=i.textureCache.texture;w=i.textureCache.viewport,M.setTransform(1,0,0,1,0,0),h?P(M,0,0,w.width,w.height):M.clearRect(0,0,w.width,w.height);var R=y.core("outside-texture-bg-color").value,F=y.core("outside-texture-bg-opacity").value;i.colorFillStyle(M,R[0],R[1],R[2],F),M.fillRect(0,0,w.width,w.height),m=l.zoom(),T(M,!1),M.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/s,w.height/w.zoom/s),M.drawImage(z,w.mpan.x,w.mpan.y,w.width/w.zoom/s,w.height/w.zoom/s)}else i.textureOnViewport&&!t&&(i.textureCache=null);var N=l.extent(),I=i.pinching||i.hoverData.dragging||i.swipePanning||i.data.wheelZooming||i.hoverData.draggingEles||i.cy.animated(),X=i.hideEdgesOnViewport&&I,O=[];if(O[i.NODE]=!c[i.NODE]&&h&&!i.clearedForMotionBlur[i.NODE]||i.clearingMotionBlur,O[i.NODE]&&(i.clearedForMotionBlur[i.NODE]=!0),O[i.DRAG]=!c[i.DRAG]&&h&&!i.clearedForMotionBlur[i.DRAG]||i.clearingMotionBlur,O[i.DRAG]&&(i.clearedForMotionBlur[i.DRAG]=!0),c[i.NODE]||n||r||O[i.NODE]){var Y=h&&!O[i.NODE]&&g!==1;T(M=t||(Y?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]:u.contexts[i.NODE]),h&&!Y?"motionBlur":void 0),X?i.drawCachedNodes(M,E.nondrag,s,N):i.drawLayeredElements(M,E.nondrag,s,N),i.debug&&i.drawDebugPoints(M,E.nondrag),n||h||(c[i.NODE]=!1)}if(!r&&(c[i.DRAG]||n||O[i.DRAG])&&(Y=h&&!O[i.DRAG]&&g!==1,T(M=t||(Y?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]:u.contexts[i.DRAG]),h&&!Y?"motionBlur":void 0),X?i.drawCachedNodes(M,E.drag,s,N):i.drawCachedElements(M,E.drag,s,N),i.debug&&i.drawDebugPoints(M,E.drag),n||h||(c[i.DRAG]=!1)),i.showFps||!r&&c[i.SELECT_BOX]&&!n){if(T(M=t||u.contexts[i.SELECT_BOX]),i.selection[4]==1&&(i.hoverData.selecting||i.touchData.selecting)){m=i.cy.zoom();var j=y.core("selection-box-border-width").value/m;M.lineWidth=j,M.fillStyle="rgba("+y.core("selection-box-color").value[0]+","+y.core("selection-box-color").value[1]+","+y.core("selection-box-color").value[2]+","+y.core("selection-box-opacity").value+")",M.fillRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]),j>0&&(M.strokeStyle="rgba("+y.core("selection-box-border-color").value[0]+","+y.core("selection-box-border-color").value[1]+","+y.core("selection-box-border-color").value[2]+","+y.core("selection-box-opacity").value+")",M.strokeRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]))}if(u.bgActivePosistion&&!i.hoverData.selecting){m=i.cy.zoom();var G=u.bgActivePosistion;M.fillStyle="rgba("+y.core("active-bg-color").value[0]+","+y.core("active-bg-color").value[1]+","+y.core("active-bg-color").value[2]+","+y.core("active-bg-opacity").value+")",M.beginPath(),M.arc(G.x,G.y,y.core("active-bg-size").pfValue/m,0,2*Math.PI),M.fill()}var W=i.lastRedrawTime;if(i.showFps&&W){W=Math.round(W);var q=Math.round(1e3/W);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+W+" ms = "+q+" fps",0,20),M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(q/60,1),20)}n||(c[i.SELECT_BOX]=!1)}if(h&&g!==1){var K=u.contexts[i.NODE],U=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_NODE],re=u.contexts[i.DRAG],ae=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_DRAG],de=function(ue,Q,le){ue.setTransform(1,0,0,1,0,0),le||!f?ue.clearRect(0,0,i.canvasWidth,i.canvasHeight):P(ue,0,0,i.canvasWidth,i.canvasHeight);var ee=g;ue.drawImage(Q,0,0,i.canvasWidth*ee,i.canvasHeight*ee,0,0,i.canvasWidth,i.canvasHeight)};(c[i.NODE]||O[i.NODE])&&(de(K,U,O[i.NODE]),c[i.NODE]=!1),(c[i.DRAG]||O[i.DRAG])&&(de(re,ae,O[i.DRAG]),c[i.DRAG]=!1)}i.prevViewport=w,i.clearingMotionBlur&&(i.clearingMotionBlur=!1,i.motionBlurCleared=!0,i.motionBlur=!0),h&&(i.motionBlurTimeout=setTimeout(function(){i.motionBlurTimeout=null,i.clearedForMotionBlur[i.NODE]=!1,i.clearedForMotionBlur[i.DRAG]=!1,i.motionBlur=!1,i.clearingMotionBlur=!d,i.mbFrames=0,c[i.NODE]=!0,c[i.DRAG]=!0,i.redraw()},100)),t||l.emit("render")};for(var Qs={drawPolygonPath:function(e,t,n,r,a,o){var i=r/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+i*o[0],n+s*o[1]);for(var l=1;l0&&o>0){h.clearRect(0,0,a,o),h.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,g),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var p=t.pan(),v={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(v.x,v.y),h.scale(l,l),this.drawElements(h,g),h.scale(1/l,1/l),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,o),h.fill())}return d},lr.png=function(e){return rl(e,this.bufferCanvasImage(e),"image/png")},lr.jpg=function(e){return rl(e,this.bufferCanvasImage(e),"image/jpeg")};var xh={nodeShapeImpl:function(e,t,n,r,a,o,i,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,o);case"polygon":return this.drawPolygonPath(t,n,r,a,o,i);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,o,i,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,o,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,o,i,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,o,s);case"barrel":return this.drawBarrelPath(t,n,r,a,o)}}},wh=al,be=al.prototype;function al(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(be.CANVAS_LAYERS),contexts:new Array(be.CANVAS_LAYERS),canvasNeedsRedraw:new Array(be.CANVAS_LAYERS),bufferCanvases:new Array(be.BUFFER_COUNT),bufferContexts:new Array(be.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var o=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,o.position="relative",o.zIndex="0",o.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};yi&&yi.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l"u"?"undefined":Ne(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[Gs,Bn,Xt,bh,en,sr,nt,Qs,lr,xh].forEach(function(e){he(be,e)});var kh=[{type:"layout",extensions:Qd},{type:"renderer",extensions:[{name:"null",impl:Ss},{name:"base",impl:Ys},{name:"canvas",impl:wh}]}],il={},ol={};function sl(e,t,n){var r=n,a=function(S){we("Can not register `"+t+"` for `"+e+"` since `"+S+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(rr.prototype[t])return a(t);rr.prototype[t]=n}else if(e==="collection"){if(Ve.prototype[t])return a(t);Ve.prototype[t]=n}else if(e==="layout"){for(var o=function(S){this.options=S,n.call(this,S),ve(this._private)||(this._private={}),this._private.cy=S.cy,this._private.listeners=[],this.createEmitter()},i=o.prototype=Object.create(n.prototype),s=[],l=0;l!?|\/]/;function k(t,e){var r,n=t.next();if(h[n]){var o=h[n](t,e);if(o!==!1)return o}if(n=='"'||n=="'"||n=="`")return e.tokenize=(r=n,function(w,_){for(var d,s=!1,m=!1;(d=w.next())!=null;){if(d==r&&!s){m=!0;break}s=!s&&d=="\\"}return(m||!s&&!O)&&(_.tokenize=null),"string"}),e.tokenize(t,e);if(/[\[\]{}\(\),;\:\.]/.test(n))return i=n,null;if(/\d/.test(n))return t.eatWhile(/[\w\.]/),"number";if(n=="/"){if(t.eat("+"))return e.tokenize=x,x(t,e);if(t.eat("*"))return e.tokenize=v,v(t,e);if(t.eat("/"))return t.skipToEnd(),"comment"}if(b.test(n))return t.eatWhile(b),"operator";t.eatWhile(/[\w\$_\xa1-\uffff]/);var a=t.current();return I.propertyIsEnumerable(a)?(y.propertyIsEnumerable(a)&&(i="newstatement"),"keyword"):E.propertyIsEnumerable(a)?(y.propertyIsEnumerable(a)&&(i="newstatement"),"builtin"):L.propertyIsEnumerable(a)?"atom":"variable"}function v(t,e){for(var r,n=!1;r=t.next();){if(r=="/"&&n){e.tokenize=null;break}n=r=="*"}return"comment"}function x(t,e){for(var r,n=!1;r=t.next();){if(r=="/"&&n){e.tokenize=null;break}n=r=="+"}return"comment"}function g(t,e,r,n,o){this.indented=t,this.column=e,this.type=r,this.align=n,this.prev=o}function f(t,e,r){var n=t.indented;return t.context&&t.context.type=="statement"&&(n=t.context.indented),t.context=new g(n,e,r,null,t.context)}function u(t){var e=t.context.type;return e!=")"&&e!="]"&&e!="}"||(t.indented=t.context.indented),t.context=t.context.prev}const W={name:"d",startState:function(t){return{tokenize:null,context:new g(-t,0,"top",!1),indented:0,startOfLine:!0}},token:function(t,e){var r=e.context;if(t.sol()&&(r.align==null&&(r.align=!1),e.indented=t.indentation(),e.startOfLine=!0),t.eatSpace())return null;i=null;var n=(e.tokenize||k)(t,e);if(n=="comment"||n=="meta")return n;if(r.align==null&&(r.align=!0),i!=";"&&i!=":"&&i!=","||r.type!="statement")if(i=="{")f(e,t.column(),"}");else if(i=="[")f(e,t.column(),"]");else if(i=="(")f(e,t.column(),")");else if(i=="}"){for(;r.type=="statement";)r=u(e);for(r.type=="}"&&(r=u(e));r.type=="statement";)r=u(e)}else i==r.type?u(e):((r.type=="}"||r.type=="top")&&i!=";"||r.type=="statement"&&i=="newstatement")&&f(e,t.column(),"statement");else u(e);return e.startOfLine=!1,n},indent:function(t,e,r){if(t.tokenize!=k&&t.tokenize!=null)return null;var n=t.context,o=e&&e.charAt(0);n.type=="statement"&&o=="}"&&(n=n.prev);var a=o==n.type;return n.type=="statement"?n.indented+(o=="{"?0:z||r.unit):n.align?n.column+(a?0:1):n.indented+(a?0:r.unit)},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}};export{W as d}; diff --git a/apps/assets/dagre-OKDRZEBW-Dzg44g1a.js b/apps/assets/dagre-OKDRZEBW-Dzg44g1a.js new file mode 100644 index 0000000000000000000000000000000000000000..8ea9b615b994e68d5a0f112c10e9e635efd44968 --- /dev/null +++ b/apps/assets/dagre-OKDRZEBW-Dzg44g1a.js @@ -0,0 +1,4 @@ +import{_ as m,aa as M,ab as L,ac as Y,ad as j,l as i,c as H,ae as _,af as $,$ as q,a4 as z,a0 as O,Y as K,ag as Q,ah as U,ai as V}from"./mermaid-DwRBzUur.js";import{G}from"./graph-B7t7oBoL.js";import{l as W}from"./layout-Ccr18Tcr.js";import{i as x}from"./_baseUniq-CR5yKjUQ.js";import{c as Z}from"./clone-Bj7S21pd.js";import{m as k}from"./min-DbRBnib5.js";import"./index-DgI7bmFZ.js";import"./transform-DetRMEbJ.js";import"./timer-Bqd5yn_a.js";import"./step-BwsUM5iJ.js";import"./_baseEach-DH7Slkql.js";import"./sortBy-YZkl3gUo.js";import"./_baseMap-BJiiBMYV.js";function X(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ee(e),edges:te(e)};return x(e.graph())||(r.value=Z(e.graph())),r}function ee(e){return k(e.nodes(),function(r){var t=e.node(r),o=e.parent(r),d={v:r};return x(t)||(d.value=t),x(o)||(d.parent=o),d})}function te(e){return k(e.edges(),function(r){var t=e.edge(r),o={v:r.v,w:r.w};return x(r.name)||(o.name=r.name),x(t)||(o.value=t),o})}var l=new Map,b=new Map,P=new Map,re=m(()=>{b.clear(),P.clear(),l.clear()},"clear"),D=m((e,r)=>{const t=b.get(r)||[];return i.trace("In isDescendant",r," ",e," = ",t.includes(e)),t.includes(e)},"isDescendant"),ne=m((e,r)=>{const t=b.get(r)||[];return i.info("Descendants of ",r," is ",t),i.info("Edge is ",e),e.v!==r&&e.w!==r&&(t?t.includes(e.v)||D(e.v,r)||D(e.w,r)||t.includes(e.w):(i.debug("Tilt, ",r,",not in descendants"),!1))},"edgeInCluster"),B=m((e,r,t,o)=>{i.warn("Copying children of ",e,"root",o,"data",r.node(e),o);const d=r.children(e)||[];e!==o&&d.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",d),d.forEach(s=>{if(r.children(s).length>0)B(s,r,t,o);else{const a=r.node(s);i.info("cp ",s," to ",o," with parent ",e),t.setNode(s,a),o!==r.parent(s)&&(i.warn("Setting parent",s,r.parent(s)),t.setParent(s,r.parent(s))),e!==o&&s!==e?(i.debug("Setting parent",s,e),t.setParent(s,e)):(i.info("In copy ",e,"root",o,"data",r.node(e),o),i.debug("Not Setting parent for node=",s,"cluster!==rootId",e!==o,"node!==clusterId",s!==e));const c=r.edges(s);i.debug("Copying Edges",c),c.forEach(f=>{i.info("Edge",f);const E=r.edge(f.v,f.w,f.name);i.info("Edge data",E,o);try{ne(f,o)?(i.info("Copying as ",f.v,f.w,E,f.name),t.setEdge(f.v,f.w,E,f.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",f.v,"-->",f.w," rootId: ",o," clusterId:",e)}catch(C){i.error(C)}})}i.debug("Removing node",s),r.removeNode(s)})},"copy"),J=m((e,r)=>{const t=r.children(e);let o=[...t];for(const d of t)P.set(d,e),o=[...o,...J(d,r)];return o},"extractDescendants"),ie=m((e,r,t)=>{const o=e.edges().filter(c=>c.v===r||c.w===r),d=e.edges().filter(c=>c.v===t||c.w===t),s=o.map(c=>({v:c.v===r?t:c.v,w:c.w===r?r:c.w})),a=d.map(c=>({v:c.v,w:c.w}));return s.filter(c=>a.some(f=>c.v===f.v&&c.w===f.w))},"findCommonEdges"),I=m((e,r,t)=>{const o=r.children(e);if(i.trace("Searching children of id ",e,o),o.length<1)return e;let d;for(const s of o){const a=I(s,r,t),c=ie(r,t,a);if(a){if(!(c.length>0))return a;d=a}}return d},"findNonClusterChild"),A=m(e=>l.has(e)&&l.get(e).externalConnections&&l.has(e)?l.get(e).id:e,"getAnchorId"),ae=m((e,r)=>{if(!e||r>10)i.debug("Opting out, no graph ");else{i.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",I(t,e,t)),b.set(t,J(t,e)),l.set(t,{id:I(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){const o=e.children(t),d=e.edges();o.length>0?(i.debug("Cluster identified",t,b),d.forEach(s=>{D(s.v,t)^D(s.w,t)&&(i.warn("Edge: ",s," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",b.get(t)),l.get(t).externalConnections=!0)})):i.debug("Not a cluster ",t,b)});for(let t of l.keys()){const o=l.get(t).id,d=e.parent(o);d!==t&&l.has(d)&&!l.get(d).externalConnections&&(l.get(t).id=d)}e.edges().forEach(function(t){const o=e.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let d=t.v,s=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l.get(t.v)," --- ",l.get(t.w)),l.get(t.v)||l.get(t.w)){if(i.warn("Fixing and trying - removing XXX",t.v,t.w,t.name),d=A(t.v),s=A(t.w),e.removeEdge(t.v,t.w,t.name),d!==t.v){const a=e.parent(d);l.get(a).externalConnections=!0,o.fromCluster=t.v}if(s!==t.w){const a=e.parent(s);l.get(a).externalConnections=!0,o.toCluster=t.w}i.warn("Fix Replacing with XXX",d,s,t.name),e.setEdge(d,s,o,t.name)}}),i.warn("Adjusted Graph",X(e)),T(e,0),i.trace(l)}},"adjustClustersAndEdges"),T=m((e,r)=>{var d,s;if(i.warn("extractor - ",r,X(e),e.children("D")),r>10)return void i.error("Bailing out");let t=e.nodes(),o=!1;for(const a of t){const c=e.children(a);o=o||c.length>0}if(o){i.debug("Nodes = ",t,r);for(const a of t)if(i.debug("Extracting node",a,l,l.has(a)&&!l.get(a).externalConnections,!e.parent(a),e.node(a),e.children("D")," Depth ",r),l.has(a))if(!l.get(a).externalConnections&&e.children(a)&&e.children(a).length>0){i.warn("Cluster without external connections, without a parent and with children",a,r);let c=e.graph().rankdir==="TB"?"LR":"TB";(s=(d=l.get(a))==null?void 0:d.clusterData)!=null&&s.dir&&(c=l.get(a).clusterData.dir,i.warn("Fixing dir",l.get(a).clusterData.dir,c));const f=new G({multigraph:!0,compound:!0}).setGraph({rankdir:c,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",X(e)),B(a,e,f,a),e.setNode(a,{clusterNode:!0,id:a,clusterData:l.get(a).clusterData,label:l.get(a).label,graph:f}),i.warn("New graph after copy node: (",a,")",X(f)),i.debug("Old graph after copy",X(e))}else i.warn("Cluster ** ",a," **not meeting the criteria !externalConnections:",!l.get(a).externalConnections," no parent: ",!e.parent(a)," children ",e.children(a)&&e.children(a).length>0,e.children("D"),r),i.debug(l);else i.debug("Not a cluster",a,r);t=e.nodes(),i.warn("New list of nodes",t);for(const a of t){const c=e.node(a);i.warn(" Now next level",a,c),c!=null&&c.clusterNode&&T(c.graph,r+1)}}else i.debug("Done, no node has children",e.nodes())},"extractor"),R=m((e,r)=>{if(r.length===0)return[];let t=Object.assign([],r);return r.forEach(o=>{const d=e.children(o),s=R(e,d);t=[...t,...s]}),t},"sorter"),oe=m(e=>R(e,e.children()),"sortNodesByHierarchy"),F=m(async(e,r,t,o,d,s)=>{i.warn("Graph in recursive render:XAX",X(r),d);const a=r.graph().rankdir;i.trace("Dir in recursive render - dir:",a);const c=e.insert("g").attr("class","root");r.nodes()?i.info("Recursive render XXX",r.nodes()):i.info("No nodes found for",r),r.edges().length>0&&i.info("Recursive edges",r.edge(r.edges()[0]));const f=c.insert("g").attr("class","clusters"),E=c.insert("g").attr("class","edgePaths"),C=c.insert("g").attr("class","edgeLabels"),p=c.insert("g").attr("class","nodes");await Promise.all(r.nodes().map(async function(g){const n=r.node(g);if(d!==void 0){const h=JSON.parse(JSON.stringify(d.clusterData));i.trace(`Setting data for parent cluster XXX + Node.id = `,g,` + data=`,h.height,` +Parent cluster`,d.height),r.setNode(d.id,h),r.parent(g)||(i.trace("Setting parent",g,d.id),r.setParent(g,d.id,h))}if(i.info("(Insert) Node XXX"+g+": "+JSON.stringify(r.node(g))),n==null?void 0:n.clusterNode){i.info("Cluster identified XBX",g,n.width,r.node(g));const{ranksep:h,nodesep:u}=r.graph();n.graph.setGraph({...n.graph.graph(),ranksep:h+25,nodesep:u});const N=await F(p,n.graph,t,o,r.node(g),s),S=N.elem;_(n,S),n.diff=N.diff||0,i.info("New compound node after recursive render XAX",g,"width",n.width,"height",n.height),$(S,n)}else r.children(g).length>0?(i.trace("Cluster - the non recursive path XBX",g,n.id,n,n.width,"Graph:",r),i.trace(I(n.id,r)),l.set(n.id,{id:I(n.id,r),node:n})):(i.trace("Node - the non recursive path XAX",g,p,r.node(g),a),await q(p,r.node(g),{config:s,dir:a}))})),await m(async()=>{const g=r.edges().map(async function(n){const h=r.edge(n.v,n.w,n.name);i.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(r.edge(n))),i.info("Fix",l,"ids:",n.v,n.w,"Translating: ",l.get(n.v),l.get(n.w)),await V(C,h)});await Promise.all(g)},"processEdges")(),i.info("Graph before layout:",JSON.stringify(X(r))),i.info("############################################# XXX"),i.info("### Layout ### XXX"),i.info("############################################# XXX"),W(r),i.info("Graph after layout:",JSON.stringify(X(r)));let y=0,{subGraphTitleTotalMargin:v}=z(s);return await Promise.all(oe(r).map(async function(g){var h;const n=r.node(g);if(i.info("Position XBX => "+g+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n==null?void 0:n.clusterNode)n.y+=v,i.info("A tainted cluster node XBX1",g,n.id,n.width,n.height,n.x,n.y,r.parent(g)),l.get(n.id).node=n,O(n);else if(r.children(g).length>0){i.info("A pure cluster node XBX1",g,n.id,n.x,n.y,n.width,n.height,r.parent(g)),n.height+=v,r.node(n.parentId);const u=(n==null?void 0:n.padding)/2||0,N=((h=n==null?void 0:n.labelBBox)==null?void 0:h.height)||0,S=N-u||0;i.debug("OffsetY",S,"labelHeight",N,"halfPadding",u),await K(f,n),l.get(n.id).node=n}else{const u=r.node(n.parentId);n.y+=v/2,i.info("A regular node XBX1 - using the padding",n.id,"parent",n.parentId,n.width,n.height,n.x,n.y,"offsetY",n.offsetY,"parent",u,u==null?void 0:u.offsetY,n),O(n)}})),r.edges().forEach(function(g){const n=r.edge(g);i.info("Edge "+g.v+" -> "+g.w+": "+JSON.stringify(n),n),n.points.forEach(S=>S.y+=v/2);const h=r.node(g.v);var u=r.node(g.w);const N=Q(E,n,l,t,h,u,o);U(n,N)}),r.nodes().forEach(function(g){const n=r.node(g);i.info(g,n.type,n.diff),n.isGroup&&(y=n.diff)}),i.warn("Returning from recursive render XAX",c,y),{elem:c,diff:y}},"recursiveRender"),se=m(async(e,r)=>{var s,a,c,f,E,C;const t=new G({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:((s=e.config)==null?void 0:s.nodeSpacing)||((c=(a=e.config)==null?void 0:a.flowchart)==null?void 0:c.nodeSpacing)||e.nodeSpacing,ranksep:((f=e.config)==null?void 0:f.rankSpacing)||((C=(E=e.config)==null?void 0:E.flowchart)==null?void 0:C.rankSpacing)||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),o=r.select("g");M(o,e.markers,e.type,e.diagramId),L(),Y(),j(),re(),e.nodes.forEach(p=>{t.setNode(p.id,{...p}),p.parentId&&t.setParent(p.id,p.parentId)}),i.debug("Edges:",e.edges),e.edges.forEach(p=>{if(p.start===p.end){const w=p.start,y=w+"---"+w+"---1",v=w+"---"+w+"---2",g=t.node(w);t.setNode(y,{domId:y,id:y,parentId:g.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),t.setParent(y,g.parentId),t.setNode(v,{domId:v,id:v,parentId:g.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),t.setParent(v,g.parentId);const n=structuredClone(p),h=structuredClone(p),u=structuredClone(p);n.label="",n.arrowTypeEnd="none",n.id=w+"-cyclic-special-1",h.arrowTypeStart="none",h.arrowTypeEnd="none",h.id=w+"-cyclic-special-mid",u.label="",g.isGroup&&(n.fromCluster=w,u.toCluster=w),u.id=w+"-cyclic-special-2",u.arrowTypeStart="none",t.setEdge(w,y,n,w+"-cyclic-special-0"),t.setEdge(y,v,h,w+"-cyclic-special-1"),t.setEdge(v,w,u,w+"-cycr.forEach(a=>{if(!l.has(a))return;const h=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming(()=>a(e)):()=>a(e);t?this.dispatchAsync(h):h()}),o=this.getListeners(i,t,!1)??new Set,n=new Set(o);n.size>0&&s(n,o),new Set(t?this.globalAsyncListeners:this.globalSyncListeners).forEach(r=>{const l=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming(()=>r(i,e)):()=>r(i,e);t?this.dispatchAsync(l):l()})}dispatchAsync(e){if(this.asyncFunctionsQueue.push(e),!this.scheduled){const t=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)};this.frameworkOverrides?this.frameworkOverrides.wrapIncoming(t):t(),this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;const e=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[],e.forEach(t=>t())}},Oo=(e=>(e.CommunityCoreModule="@ag-grid-community/core",e.InfiniteRowModelModule="@ag-grid-community/infinite-row-model",e.ClientSideRowModelModule="@ag-grid-community/client-side-row-model",e.CsvExportModule="@ag-grid-community/csv-export",e.EnterpriseCoreModule="@ag-grid-enterprise/core",e.RowGroupingModule="@ag-grid-enterprise/row-grouping",e.ColumnsToolPanelModule="@ag-grid-enterprise/column-tool-panel",e.FiltersToolPanelModule="@ag-grid-enterprise/filter-tool-panel",e.MenuModule="@ag-grid-enterprise/menu",e.SetFilterModule="@ag-grid-enterprise/set-filter",e.MultiFilterModule="@ag-grid-enterprise/multi-filter",e.StatusBarModule="@ag-grid-enterprise/status-bar",e.SideBarModule="@ag-grid-enterprise/side-bar",e.RangeSelectionModule="@ag-grid-enterprise/range-selection",e.MasterDetailModule="@ag-grid-enterprise/master-detail",e.RichSelectModule="@ag-grid-enterprise/rich-select",e.GridChartsModule="@ag-grid-enterprise/charts",e.ViewportRowModelModule="@ag-grid-enterprise/viewport-row-model",e.ServerSideRowModelModule="@ag-grid-enterprise/server-side-row-model",e.ExcelExportModule="@ag-grid-enterprise/excel-export",e.ClipboardModule="@ag-grid-enterprise/clipboard",e.SparklinesModule="@ag-grid-enterprise/sparklines",e.AdvancedFilterModule="@ag-grid-enterprise/advanced-filter",e.AngularModule="@ag-grid-community/angular",e.ReactModule="@ag-grid-community/react",e.VueModule="@ag-grid-community/vue",e))(Oo||{}),Go={};function as(e,t){Go[t]||(e(),Go[t]=!0)}function He(e,...t){console.log("AG Grid: "+e,...t)}function R(e,...t){as(()=>console.warn("AG Grid: "+e,...t),e+(t==null?void 0:t.join("")))}function Q(e,...t){as(()=>console.error("AG Grid: "+e,...t),e+(t==null?void 0:t.join("")))}function hs(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Rl(e){(function(t,i=0){t.length>0&&window.setTimeout(()=>t.forEach(s=>s()),i)})(e,400)}var ds=[],cs=!1;function No(e){ds.push(e),cs||(cs=!0,window.setTimeout(()=>{const t=ds.slice();ds.length=0,cs=!1,t.forEach(i=>i())},0))}function Se(e,t){let i;return function(...s){const o=this;window.clearTimeout(i),i=window.setTimeout(function(){e.apply(o,s)},t)}}function Ho(e,t){let i=0;return function(...s){const o=new Date().getTime();o-il?1:rt.push(i)),t}return Object.values(e)}function Bo(e,t){return e.get("rowModelType")===t}function ie(e){return Bo(e,"clientSide")}function Ke(e){return Bo(e,"serverSide")}function Ce(e,t){return e.get("domLayout")===t}function xi(e){return ki(e)!==void 0}function Ai(e){return!e.get("suppressAsyncEvents")}function Vo(e){return typeof e.get("getRowHeight")=="function"}function lt(e,t,i=!1,s){if(s==null&&(s=e.environment.getDefaultRowHeight()),Vo(e)){if(i)return{height:s,estimated:!0};const n={node:t,data:t.data},r=e.getCallback("getRowHeight")(n);if(ms(r))return r===0&&R("The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead."),{height:Math.max(1,r),estimated:!1}}if(t.detail&&e.get("masterDetail"))return function(n){if(n.get("detailRowAutoHeight"))return{height:1,estimated:!1};const r=n.get("detailRowHeight");return ms(r)?{height:r,estimated:!1}:{height:300,estimated:!1}}(e);const o=e.get("rowHeight");return{height:o&&ms(o)?o:s,estimated:!1}}function vt(e){const{environment:t}=e,i=e.get("rowHeight");if(!i||K(i))return t.getDefaultRowHeight();const s=t.refreshRowHeightVariable();return s!==-1?s:(R("row height must be a number if not using standard row model"),t.getDefaultRowHeight())}function ms(e){return!isNaN(e)&&typeof e=="number"&&isFinite(e)}function si(e,t,i){const s=t[e.getDomDataKey()];return s?s[i]:void 0}function wt(e,t,i,s){const o=e.getDomDataKey();let n=t[o];K(n)&&(n={},t[o]=n),n[i]=s}function ae(e){let t=null;const i=e.get("getDocument");return i&&M(i)?t=i():e.eGridDiv&&(t=e.eGridDiv.ownerDocument),t&&M(t)?t:document}function Wo(e){return ae(e).defaultView||window}function oi(e){return e.eGridDiv.getRootNode()}function re(e){return oi(e).activeElement}function zo(e){const t=ae(e),i=re(e);return i===null||i===t.body}function Gt(e){return!e.get("ensureDomOrder")&&e.get("animateRows")}function Ti(e){return!(e.get("paginateChildRows")||e.get("groupHideOpenParents")||Ce(e,"print"))}function $e(e){const t=e.get("autoGroupColumnDef");return!(t!=null&&t.comparator)&&!e.get("treeData")}function Cs(e){const t=e.get("groupAggFiltering");return typeof t=="function"?e.getCallback("groupAggFiltering"):t===!0?()=>!0:void 0}function Uo(e){const t=e.get("grandTotalRow");return t||(e.get("groupIncludeTotalFooter")?"bottom":void 0)}function Ko(e){const t=e.get("groupTotalRow");if(typeof t=="function")return e.getCallback("groupTotalRow");if(t)return()=>t;const i=e.get("groupIncludeFooter");if(typeof i=="function"){const s=e.getCallback("groupIncludeFooter");return o=>s(o)?"bottom":void 0}return()=>i?"bottom":void 0}function $o(e){return e.exists("groupDisplayType")?e.get("groupDisplayType")==="multipleColumns":e.get("groupHideOpenParents")}function Ii(e,t){return!t&&e.get("groupDisplayType")==="groupRows"}function Nt(e){const t=e.getCallback("getRowId");return t===void 0?t:i=>{let s=t(i);return typeof s!="string"&&(R("The getRowId callback must return a string. The ID ",s," is being cast to a string."),s=String(s)),s}}function Ht(e){return(e==null?void 0:e.checkboxes)??!0}function Li(e){return(e==null?void 0:e.mode)==="multiRow"&&(e.headerCheckbox??!0)}function Ze(e){const t=e.get("cellSelection");return t!==void 0?!!t:e.get("enableRangeSelection")}function _o(e){var i;const t=e.get("cellSelection");return t!==void 0?typeof t!="boolean"&&((i=t.handle)==null?void 0:i.mode)==="fill":e.get("enableFillHandle")}function jo(e){const t=e.get("rowSelection")??"single";if(typeof t=="string"){const i=e.get("suppressRowClickSelection"),s=e.get("suppressRowDeselection");return(!i||!s)&&(i?"enableDeselection":!s||"enableSelection")}return(t.mode==="singleRow"||t.mode==="multiRow")&&(t.enableClickSelection??!1)}function qo(e){const t=jo(e);return t===!0||t==="enableDeselection"}function fs(e){const t=e.get("rowSelection");return typeof t=="string"?e.get("isRowSelectable"):t==null?void 0:t.isRowSelectable}function ki(e){const t=e.get("rowSelection");if(typeof t=="string")switch(t){case"multiple":return"multiRow";case"single":return"singleRow";default:return}return t==null?void 0:t.mode}function Qo(e){return ki(e)==="multiRow"}function vs(e){const t=e.get("rowSelection");if(typeof t=="string"){const i=e.get("groupSelectsChildren"),s=e.get("groupSelectsFiltered");return i&&s?"filteredDescendants":i?"descendants":"self"}return(t==null?void 0:t.mode)==="multiRow"?t.groupSelects:void 0}function St(e){const t=vs(e);return t==="descendants"||t==="filteredDescendants"}function ws(e){return e.isModuleRegistered("@ag-grid-enterprise/set-filter")&&!e.get("suppressSetFilterByDefault")}function $(e){if(e&&e.length)return e[e.length-1]}function at(e,t,i){return e==null&&t==null||e!=null&&t!=null&&e.length===t.length&&e.every((s,o)=>i?i(s,t[o]):t[o]===s)}function Yo(e,t){const i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],e.pop())}function ye(e,t){const i=e.indexOf(t);i>=0&&e.splice(i,1)}function Oi(e,t,i){e.splice(i,0,t)}function Xo(e,t,i){(function(s,o){for(let n=0;nOi(e,s,i))}function yt(e,t){return e.indexOf(t)>-1}function Pl(e){return(e==null?void 0:e.flatMap(t=>t))??[]}function Jo(e,t){t!=null&&e!=null&&t.forEach(i=>e.push(i))}var Zo="__ag_Grid_Stop_Propagation",Dl=["touchstart","touchend","touchmove","touchcancel","scroll"],Ss={};function Bt(e){e[Zo]=!0}function et(e){return e[Zo]===!0}var en=(()=>{const e={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return t=>{if(typeof Ss[t]=="boolean")return Ss[t];const i=document.createElement(e[t]||"div");return Ss[t="on"+t]=t in i}})();function ys(e,t,i){let s=t;for(;s;){const o=si(e,s,i);if(o)return o;s=s.parentElement}return null}function El(e,t){return!(!t||!e)&&function(i){const s=i;return s.path?s.path:s.composedPath?s.composedPath():function(o){const n=[];let r=o.target;for(;r;)n.push(r),r=r.parentElement;return n}(s)}(t).indexOf(e)>=0}var b=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans(e){this.frameworkOverrides=e.frameworkOverrides,this.stubContext=e.context,this.eventService=e.eventService,this.gos=e.gos,this.localeService=e.localeService}getFrameworkOverrides(){return this.frameworkOverrides}destroy(){for(let e=0;enull;e instanceof HTMLElement?function(o,n,r,l){const a=yt(Dl,r)?{passive:!0}:void 0;o&&o.addEventListener&&o.addEventListener(n,r,l,a)}(this.getFrameworkOverrides(),e,t,i):e.addEventListener(t,i);const s=()=>(e.removeEventListener(t,i),null);return this.destroyFunctions.push(s),()=>(s(),this.destroyFunctions=this.destroyFunctions.filter(o=>o!==s),null)}setupGridOptionListener(e,t){this.gos.addPropertyEventListener(e,t);const i=()=>(this.gos.removePropertyEventListener(e,t),null);return this.destroyFunctions.push(i),()=>(i(),this.destroyFunctions=this.destroyFunctions.filter(s=>s!==i),null)}addManagedPropertyListener(e,t){return this.destroyed?()=>null:this.setupGridOptionListener(e,t)}addManagedPropertyListeners(e,t){if(this.destroyed)return;const i=e.join("-")+this.propertyListenerId++,s=o=>{if(o.changeSet){if(o.changeSet&&o.changeSet.id===this.lastChangeSetIdLookup[i])return;this.lastChangeSetIdLookup[i]=o.changeSet.id}const n={type:"gridPropertyChanged",changeSet:o.changeSet,source:o.source};t(n)};e.forEach(o=>this.setupGridOptionListener(o,s))}addDestroyFunc(e){this.isAlive()?this.destroyFunctions.push(e):e()}createManagedBean(e,t){const i=this.createBean(e,t);return this.addDestroyFunc(this.destroyBean.bind(this,e,t)),i}createBean(e,t,i){return(t||this.stubContext).createBean(e,i)}destroyBean(e,t){return(t||this.stubContext).destroyBean(e)}destroyBeans(e,t){return(t||this.stubContext).destroyBeans(e)}};function be(e){return e instanceof Gi}var Gi=class extends b{constructor(e,t,i,s){super(),this.isColumn=!1,this.expandable=!1,this.instanceId=on(),this.expandableListenerRemoveCallback=null,this.colGroupDef=e,this.groupId=t,this.expanded=!!e&&!!e.openByDefault,this.padding=i,this.level=s}destroy(){this.expandableListenerRemoveCallback&&this.reset(null,void 0),super.destroy()}reset(e,t){this.colGroupDef=e,this.level=t,this.originalParent=null,this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback(),this.children=void 0,this.expandable=void 0}getInstanceId(){return this.instanceId}setOriginalParent(e){this.originalParent=e}getOriginalParent(){return this.originalParent}getLevel(){return this.level}isVisible(){return!!this.children&&this.children.some(e=>e.isVisible())}isPadding(){return this.padding}setExpanded(e){this.expanded=e!==void 0&&e,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren(e){this.children=e}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}addLeafColumns(e){this.children&&this.children.forEach(t=>{dt(t)?e.push(t):be(t)&&t.addLeafColumns(e)})}getColumnGroupShow(){const e=this.colGroupDef;if(e)return e.columnGroupShow}setupExpandable(){this.setExpandable(),this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback();const e=this.onColumnVisibilityChanged.bind(this);this.getLeafColumns().forEach(t=>t.addEventListener("visibleChanged",e)),this.expandableListenerRemoveCallback=()=>{this.getLeafColumns().forEach(t=>t.removeEventListener("visibleChanged",e)),this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let e=!1,t=!1,i=!1;const s=this.findChildrenRemovingPadding();for(let n=0,r=s.length;n{i.forEach(s=>{be(s)&&s.isPadding()?t(s.children):e.push(s)})};return t(this.children),e}onColumnVisibilityChanged(){this.setExpandable()}},tn="ag-Grid-ControlsColumn",Ml=class extends b{constructor(){super(...arguments),this.beanName="controlsColService"}createControlsCols(){const{gos:e}=this,t=e.get("rowSelection");if(!t||typeof t!="object")return[];const i=Ht(t),s=Li(t);if(i||s){const o=e.get("selectionColumnDef"),n={maxWidth:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:e.get("enableRtl")?"right":"left",comparator(l,a,h,d){const c=h.isSelected(),u=d.isSelected();return c&&u?0:c?1:-1},editable:!1,suppressFillHandle:!0,...o,colId:`${tn}`},r=new xs(n,null,n.colId,!1);return this.createBean(r),[r]}return[]}},Ni="ag-Grid-AutoColumn";function bs(e){const t=[],i=s=>{for(let o=0;ot+i.getActualWidth(),0)}function ht(e,t,i){const s={};if(!t)return;it(null,t,n=>{s[n.getInstanceId()]=n}),i&&it(null,i,n=>{s[n.getInstanceId()]=null});const o=Object.values(s).filter(n=>n!=null);e.destroyBeans(o)}function Rs(e){return e.getId().startsWith(Ni)}function ni(e){return e.getColId().startsWith(tn)}function Hi(e){let t=[];return e instanceof Array?e.some(i=>typeof i!="string")?R("if colDef.type is supplied an array it should be of type 'string[]'"):t=e:typeof e=="string"?t=e.split(","):R("colDef.type should be of type 'string' | 'string[]'"),t}var Fs=class{constructor(e){this.frameworkOverrides=e,this.wrappedListeners=new Map,this.wrappedGlobalListeners=new Map}wrap(e,t){const{frameworkOverrides:i,wrappedListeners:s}=this;let o=t;if(i.shouldWrapOutgoing){o=r=>{i.wrapOutgoing(()=>t(r))};let n=s.get(e);n||(n=new Map,s.set(e,n)),n.set(t,o)}return o}wrapGlobal(e){const{frameworkOverrides:t,wrappedGlobalListeners:i}=this;let s=e;return t.shouldWrapOutgoing&&(s=(o,n)=>{t.wrapOutgoing(()=>e(o,n))},i.set(e,s)),s}unwrap(e,t){const{wrappedListeners:i}=this,s=i.get(e);if(s){const o=s.get(t);if(o)return s.delete(t),s.size===0&&i.delete(e),o}return t}unwrapGlobal(e){const{wrappedGlobalListeners:t}=this,i=t.get(e);return i?(t.delete(e),i):e}},Ps=new Set(["__proto__","constructor","prototype"]);function Be(e,t){if(e!=null)if(Array.isArray(e))for(let i=0;i{if(t&&t.indexOf(o)>=0||Ps.has(o))return;const n=i[o],r=Ms(n)&&n.constructor===Object;s[o]=r?Ds(n):n}),s}function Es(e){if(!e)return[];const t=Object;if(typeof t.values=="function")return t.values(e);const i=[];for(const s in e)e.hasOwnProperty(s)&&e.propertyIsEnumerable(s)&&i.push(e[s]);return i}function Re(e,t,i=!0,s=!1){M(t)&&Be(t,(o,n)=>{if(Ps.has(o))return;let r=e[o];r!==n&&(s&&r==null&&n!=null&&typeof n=="object"&&n.constructor===Object&&(r={},e[o]=r),Ms(n)&&Ms(r)&&!Array.isArray(r)?Re(r,n,i,s):(i||n!==void 0)&&(e[o]=n))})}function ri(e,t,i){if(!t||!e)return;if(!i)return e[t];const s=t.split(".");let o=e;for(let n=0;n=0&&!e,this.tooltipFieldContainsDots=M(this.colDef.tooltipField)&&this.colDef.tooltipField.indexOf(".")>=0&&!e}initMinAndMaxWidths(){const e=this.colDef;this.minWidth=e.minWidth??this.gos.environment.getDefaultColumnMinWidth(),this.maxWidth=e.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.tooltipEnabled=M(this.colDef.tooltipField)||M(this.colDef.tooltipValueGetter)||M(this.colDef.tooltipComponent)}resetActualWidth(e){const t=this.calculateColInitialWidth(this.colDef);this.setActualWidth(t,e,!0)}calculateColInitialWidth(e){let t;const i=ft(e.width),s=ft(e.initialWidth);return t=i??s??200,Math.max(Math.min(t,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed(e){if(K(this.colDef)||K(this.colDef.showRowGroup))return!1;const t=this.colDef.showRowGroup===!0,i=this.colDef.showRowGroup===e;return t||i}isPrimary(){return this.primary}isFilterAllowed(){return!!this.colDef.filter}isFieldContainsDots(){return this.fieldContainsDots}isTooltipEnabled(){return this.tooltipEnabled}isTooltipFieldContainsDots(){return this.tooltipFieldContainsDots}getHighlighted(){return this.highlighted}addEventListener(e,t){var s;this.frameworkOverrides.shouldWrapOutgoing&&!this.frameworkEventListenerService&&(this.columnEventService.setFrameworkOverrides(this.frameworkOverrides),this.frameworkEventListenerService=new Fs(this.frameworkOverrides));const i=((s=this.frameworkEventListenerService)==null?void 0:s.wrap(e,t))??t;this.columnEventService.addEventListener(e,i)}removeEventListener(e,t){var s;const i=((s=this.frameworkEventListenerService)==null?void 0:s.unwrap(e,t))??t;this.columnEventService.removeEventListener(e,i)}createColumnFunctionCallbackParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,column:this,colDef:this.colDef})}isSuppressNavigable(e){if(typeof this.colDef.suppressNavigable=="boolean")return this.colDef.suppressNavigable;if(typeof this.colDef.suppressNavigable=="function"){const t=this.createColumnFunctionCallbackParams(e);return(0,this.colDef.suppressNavigable)(t)}return!1}isCellEditable(e){if(e.group){if(this.gos.get("treeData")){if(!e.data&&!this.gos.get("enableGroupEdit"))return!1}else if(!this.gos.get("enableGroupEdit"))return!1}return this.isColumnFunc(e,this.colDef.editable)}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag(e){return this.isColumnFunc(e,this.colDef.rowDrag)}isDndSource(e){return this.isColumnFunc(e,this.colDef.dndSource)}isCellCheckboxSelection(e){const t=this.gos.get("rowSelection");if(t&&typeof t!="string"){const i=ni(this)&&Ht(t);return this.isColumnFunc(e,i)}return this.isColumnFunc(e,this.colDef.checkboxSelection)}isSuppressPaste(e){return this.isColumnFunc(e,this.colDef?this.colDef.suppressPaste:null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue(e){return this.colDef[e]??xl[e]}isColumnFunc(e,t){return typeof t=="boolean"?t:typeof t=="function"?t(this.createColumnFunctionCallbackParams(e)):!1}setHighlighted(e){this.highlighted!==e&&(this.highlighted=e,this.columnEventService.dispatchEvent(this.createColumnEvent("headerHighlightChanged","uiColumnMoved")))}setMoving(e,t){this.moving=e,this.columnEventService.dispatchEvent(this.createColumnEvent("movingChanged",t))}createColumnEvent(e,t){return this.gos.addGridCommonParams({type:e,column:this,columns:[this],source:t})}isMoving(){return this.moving}getSort(){return this.sort}setSort(e,t){this.sort!==e&&(this.sort=e,this.columnEventService.dispatchEvent(this.createColumnEvent("sortChanged",t))),this.dispatchStateUpdatedEvent("sort")}isSortable(){return!!this.getColDefValue("sortable")}isSortAscending(){return this.sort==="asc"}isSortDescending(){return this.sort==="desc"}isSortNone(){return K(this.sort)}isSorting(){return M(this.sort)}getSortIndex(){return this.sortIndex}setSortIndex(e){this.sortIndex=e,this.dispatchStateUpdatedEvent("sortIndex")}setMenuVisible(e,t){this.menuVisible!==e&&(this.menuVisible=e,this.columnEventService.dispatchEvent(this.createColumnEvent("menuVisibleChanged",t)))}isMenuVisible(){return this.menuVisible}setAggFunc(e){this.aggFunc=e,this.dispatchStateUpdatedEvent("aggFunc")}getAggFunc(){return this.aggFunc}getLeft(){return this.left}getOldLeft(){return this.oldLeft}getRight(){return this.left+this.actualWidth}setLeft(e,t){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.columnEventService.dispatchEvent(this.createColumnEvent("leftChanged",t)))}isFilterActive(){return this.filterActive}setFilterActive(e,t,i){this.filterActive!==e&&(this.filterActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("filterActiveChanged",t)));const s=this.createColumnEvent("filterChanged",t);i&&Re(s,i),this.columnEventService.dispatchEvent(s)}isHovered(){return this.columnHoverService.isHovered(this)}setPinned(e){this.pinned=e===!0||e==="left"?"left":e==="right"?"right":null,this.dispatchStateUpdatedEvent("pinned")}setFirstRightPinned(e,t){this.firstRightPinned!==e&&(this.firstRightPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("firstRightPinnedChanged",t)))}setLastLeftPinned(e,t){this.lastLeftPinned!==e&&(this.lastLeftPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("lastLeftPinnedChanged",t)))}isFirstRightPinned(){return this.firstRightPinned}isLastLeftPinned(){return this.lastLeftPinned}isPinned(){return this.pinned==="left"||this.pinned==="right"}isPinnedLeft(){return this.pinned==="left"}isPinnedRight(){return this.pinned==="right"}getPinned(){return this.pinned}setVisible(e,t){const i=e===!0;this.visible!==i&&(this.visible=i,this.columnEventService.dispatchEvent(this.createColumnEvent("visibleChanged",t))),this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getColumnGroupPaddingInfo(){let e=this.getParent();if(!e||!e.isPadding())return{numberOfParents:0,isSpanningTotal:!1};const t=e.getPaddingLevel()+1;let i=!0;for(;e;){if(!e.isPadding()){i=!1;break}e=e.getParent()}return{numberOfParents:t,isSpanningTotal:i}}getColDef(){return this.colDef}getDefinition(){return this.colDef}getColumnGroupShow(){return this.colDef.columnGroupShow}getColId(){return this.colId}getId(){return this.colId}getUniqueId(){return this.colId}getActualWidth(){return this.actualWidth}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}createBaseColDefParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,colDef:this.colDef,column:this})}getColSpan(e){if(K(this.colDef.colSpan))return 1;const t=this.createBaseColDefParams(e),i=this.colDef.colSpan(t);return Math.max(i,1)}getRowSpan(e){if(K(this.colDef.rowSpan))return 1;const t=this.createBaseColDefParams(e),i=this.colDef.rowSpan(t);return Math.max(i,1)}setActualWidth(e,t,i=!1){e=Math.max(e,this.minWidth),e=Math.min(e,this.maxWidth),this.actualWidth!==e&&(this.actualWidth=e,this.flex&&t!=="flex"&&t!=="gridInitializing"&&(this.flex=null),i||this.fireColumnWidthChangedEvent(t)),this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent(e){this.columnEventService.dispatchEvent(this.createColumnEvent("widthChanged",e))}isGreaterThanMax(e){return e>this.maxWidth}getMinWidth(){return this.minWidth}getMaxWidth(){return this.maxWidth}getFlex(){return this.flex||0}setFlex(e){this.flex!==e&&(this.flex=e),this.dispatchStateUpdatedEvent("flex")}setMinimum(e){this.setActualWidth(this.minWidth,e)}setRowGroupActive(e,t){this.rowGroupActive!==e&&(this.rowGroupActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnRowGroupChanged",t))),this.dispatchStateUpdatedEvent("rowGroup")}isRowGroupActive(){return this.rowGroupActive}setPivotActive(e,t){this.pivotActive!==e&&(this.pivotActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnPivotChanged",t))),this.dispatchStateUpdatedEvent("pivot")}isPivotActive(){return this.pivotActive}isAnyFunctionActive(){return this.isPivotActive()||this.isRowGroupActive()||this.isValueActive()}isAnyFunctionAllowed(){return this.isAllowPivot()||this.isAllowRowGroup()||this.isAllowValue()}setValueActive(e,t){this.aggregationActive!==e&&(this.aggregationActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnValueChanged",t)))}isValueActive(){return this.aggregationActive}isAllowPivot(){return this.colDef.enablePivot===!0}isAllowValue(){return this.colDef.enableValue===!0}isAllowRowGroup(){return this.colDef.enableRowGroup===!0}dispatchStateUpdatedEvent(e){this.columnEventService.dispatchEvent({type:"columnStateUpdated",key:e})}},Tl={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}},Il=class{constructor(){this.existingKeys={}}addExistingKeys(e){for(let t=0;t{be(c)&&c.setupExpandable(),c.setOriginalParent(u)}),{columnTree:d,treeDept:h}}extractExistingTreeData(e){const t=[],i=[],s=[];return e&&it(null,e,o=>{if(be(o)){const n=o;i.push(n)}else{const n=o;s.push(n.getId()),t.push(n)}}),{existingCols:t,existingGroups:i,existingColKeys:s}}balanceTreeForAutoCols(e,t){const i=[],s=this.findDepth(t);return e.forEach(o=>{let n=o;for(let r=s-1;r>=0;r--){const l=new Gi(null,`FAKE_PATH_${o.getId()}}_${r}`,!0,r);this.createBean(l),l.setChildren([n]),n.setOriginalParent(l),n=l}s===0&&o.setOriginalParent(null),i.push(n)}),[i,s]}findDepth(e){let t=0,i=e;for(;i&&i[0]&&be(i[0]);)t++,i=i[0].getChildren();return t}balanceColumnTree(e,t,i,s){const o=[];for(let n=0;n=t;h--){const d=s.getUniqueKey(null,null),c=this.createMergedColGroupDef(null),u=new Gi(c,d,!0,t);this.createBean(u),a&&a.setChildren([u]),a=u,l||(l=a)}if(l&&a){if(o.push(l),e.some(h=>be(h))){a.setChildren([r]);continue}a.setChildren(e);break}o.push(r)}}return o}findMaxDept(e,t){let i=t;for(let s=0;s{s in i?R(`the column type '${s}' is a default column type and cannot be overridden.`):(o.type&&R("Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type."),i[s]=o)}),e.forEach(s=>{const o=i[s.trim()];o?Re(t,o,!1,!0):R("colDef.type '"+s+"' does not correspond to defined gridOptions.columnTypes")})}isColumnGroup(e){return e.children!==void 0}};function it(e,t,i){if(t)for(let s=0;sthis.refreshAll(bt(t.source))),this.addManagedPropertyListener("rowSelection",t=>{this.onSelectionOptionsChanged(t.currentValue,t.previousValue,bt(t.source))}),this.addManagedPropertyListener("autoGroupColumnDef",t=>this.onAutoGroupColumnDefChanged(bt(t.source))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],t=>this.recreateColumnDefs(bt(t.source))),this.addManagedPropertyListener("pivotMode",t=>this.setPivotMode(this.gos.get("pivotMode"),bt(t.source))),this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered()})}createColsFromColDefs(e){var h,d,c;const t=this.colDefs?this.columnApplyStateService.compareColumnStatesAndDispatchEvents(e):void 0;this.valueCache.expire();const i=(h=this.colDefCols)==null?void 0:h.list,s=(d=this.colDefCols)==null?void 0:d.tree,o=this.columnFactory.createColumnTree(this.colDefs,!0,s,e);ht(this.context,(c=this.colDefCols)==null?void 0:c.tree,o.columnTree);const n=o.columnTree,r=o.treeDept,l=bs(n),a={};l.forEach(u=>a[u.getId()]=u),this.colDefCols={tree:n,treeDepth:r,list:l,map:a},this.funcColsService.extractCols(e,i),this.ready=!0,this.refreshCols(!0),this.visibleColsService.refresh(e),this.columnViewportService.checkViewportColumns(),this.eventDispatcher.everythingChanged(e),t&&(this.changeEventsDispatching=!0,t(),this.changeEventsDispatching=!1),this.eventDispatcher.newColumnsLoaded(e),e==="gridInitializing"&&this.columnSizeService.applyAutosizeStrategy()}refreshCols(e){var o,n,r;if(!this.colDefCols)return;const t=(o=this.cols)==null?void 0:o.tree;this.saveColOrder(),this.selectCols(),this.createAutoCols(),this.addAutoCols(),this.createControlsCols(),this.addControlsCols();const i=(s=this.gos,this.showingPivotResult?!s.get("enableStrictPivotColumnOrder"):s.get("maintainColumnOrder"));var s;e&&!i||this.restoreColOrder(),this.positionLockedCols(),(n=this.showRowGroupColsService)==null||n.refresh(),(r=this.quickFilterService)==null||r.refreshQuickFilterCols(),this.setColSpanActive(),this.setAutoHeightActive(),this.visibleColsService.clear(),this.columnViewportService.clear(),!at(t,this.cols.tree)&&this.eventDispatcher.gridColumns()}selectCols(){const e=this.pivotResultColsService.getPivotResultCols();if(this.showingPivotResult=e!=null,e){const{map:t,list:i,tree:s,treeDepth:o}=e;this.cols={list:i.slice(),map:{...t},tree:s.slice(),treeDepth:o},e.list.some(n=>{var r;return((r=this.cols)==null?void 0:r.map[n.getColId()])!==void 0})||(this.lastPivotOrder=null)}else{const{map:t,list:i,tree:s,treeDepth:o}=this.colDefCols;this.cols={list:i.slice(),map:{...t},tree:s.slice(),treeDepth:o}}}getColsToShow(){const e=this.isPivotMode()&&!this.isShowingPivotResult(),t=this.funcColsService.getValueColumns();return this.cols.list.filter(i=>{const s=Rs(i);if(e){const o=t&&yt(t,i);return s||o}return s||i.isVisible()})}addAutoCols(){this.autoCols!=null&&(this.cols.list=this.autoCols.list.concat(this.cols.list),this.cols.tree=this.autoCols.tree.concat(this.cols.tree),nn(this.cols))}createAutoCols(){var c;const e=Ii(this.gos,this.pivotMode),t=this.pivotMode?this.gos.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),i=this.funcColsService.getRowGroupColumns(),s=()=>{this.autoCols&&(ht(this.context,this.autoCols.tree),this.autoCols=null)};if(!(i.length>0||this.gos.get("treeData"))||t||e||!this.autoColService)return void s();const o=this.autoColService.createAutoCols(i)??[],n=ln(o,((c=this.autoCols)==null?void 0:c.list)||null),r=this.cols.treeDepth,l=this.autoCols?this.autoCols.treeDepth:-1;if(n&&l==r)return;s();const[a,h]=this.columnFactory.balanceTreeForAutoCols(o,this.cols.tree);this.autoCols={list:o,tree:a,treeDepth:h,map:{}};const d=u=>{if(!u)return null;const g=u.filter(m=>!Rs(m));return[...o,...g]};this.lastOrder=d(this.lastOrder),this.lastPivotOrder=d(this.lastPivotOrder)}createControlsCols(){var l,a,h;const e=()=>{var d;ht(this.context,(d=this.controlsCols)==null?void 0:d.tree),this.controlsCols=null};this.controlsColService||e();const t=this.cols.treeDepth,i=(((l=this.controlsCols)==null?void 0:l.treeDepth)??-1)==t,s=((a=this.controlsColService)==null?void 0:a.createControlsCols())??[];if(ln(s,((h=this.controlsCols)==null?void 0:h.list)??[])&&i)return;e();const[o,n]=this.columnFactory.balanceTreeForAutoCols(s,this.cols.tree);this.controlsCols={list:s,tree:o,treeDepth:n,map:{}};const r=d=>{if(!d)return null;const c=d.filter(u=>!ni(u));return[...s,...c]};this.lastOrder=r(this.lastOrder),this.lastPivotOrder=r(this.lastPivotOrder)}addControlsCols(){this.controlsCols!=null&&(this.cols.list=this.controlsCols.list.concat(this.cols.list),this.cols.tree=this.controlsCols.tree.concat(this.cols.tree),nn(this.cols))}refreshAll(e){this.isReady()&&(this.refreshCols(!1),this.visibleColsService.refresh(e))}setColsVisible(e,t=!1,i){this.columnApplyStateService.applyColumnState({state:e.map(s=>({colId:typeof s=="string"?s:s.getColId(),hide:!t}))},i)}setColsPinned(e,t,i){if(!this.cols||Me(e))return;if(Ce(this.gos,"print"))return void R("Changing the column pinning status is not allowed with domLayout='print'");let s;this.columnAnimationService.start(),s=t===!0||t==="left"?"left":t==="right"?"right":null;const o=[];e.forEach(n=>{if(!n)return;const r=this.getCol(n);r&&r.getPinned()!==s&&(r.setPinned(s),o.push(r))}),o.length&&(this.visibleColsService.refresh(i),this.eventDispatcher.columnPinned(o,i)),this.columnAnimationService.finish()}setColumnGroupOpened(e,t,i){let s;s=be(e)?e.getId():e||"",this.columnGroupStateService.setColumnGroupState([{groupId:s,open:t}],i)}getProvidedColGroup(e){var i;let t=null;return it(null,(i=this.cols)==null?void 0:i.tree,s=>{be(s)&&s.getId()===e&&(t=s)}),t}isColGroupLocked(e){const t=this.gos.get("groupLockGroupColumns");return!e.isRowGroupActive()||t===0?!1:t===-1?!0:t>this.funcColsService.getRowGroupColumns().findIndex(i=>i.getColId()===e.getColId())}isSuppressAutoCol(){return this.gos.get("groupDisplayType")==="custom"?!0:this.gos.get("treeDataDisplayType")==="custom"}setAutoHeightActive(){this.autoHeightActive=this.cols.list.some(e=>e.isVisible()&&e.isAutoHeight()),this.autoHeightActive&&(this.autoHeightActiveAtLeastOnce=!0,ie(this.gos)||Ke(this.gos)||R("autoHeight columns only work with Client Side Row Model and Server Side Row Model."))}restoreColOrder(){const e=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!e)return;const t=new Map(e.map((l,a)=>[l,a]));if(!this.cols.list.some(l=>t.has(l)))return;const i=new Map(this.cols.list.map(l=>[l,!0])),s=e.filter(l=>i.has(l)),o=new Map(s.map(l=>[l,!0])),n=this.cols.list.filter(l=>!o.has(l)),r=s.slice();n.forEach(l=>{let a=l.getOriginalParent();if(!a)return void r.push(l);const h=[];for(;!h.length&&a;)a.getLeafColumns().forEach(u=>{const g=r.indexOf(u)>=0,m=h.indexOf(u)<0;g&&m&&h.push(u)}),a=a.getOriginalParent();if(!h.length)return void r.push(l);const d=h.map(u=>r.indexOf(u)),c=Math.max(...d);Oi(r,l,c+1)}),this.cols.list=r}sortColsLikeKeys(e){if(this.cols==null)return;let t=[];const i={};e.forEach(o=>{if(i[o])return;const n=this.cols.map[o];n&&(t.push(n),i[o]=!0)});let s=0;this.cols.list.forEach(o=>{const n=o.getColId();i[n]==null&&(n.startsWith(Ni)?Oi(t,o,s++):t.push(o))}),t=this.columnMoveService.placeLockedColumns(t),this.columnMoveService.doesMovePassMarryChildren(t)?this.cols.list=t:R("Applying column order broke a group where columns should be married together. Applying new order has been discarded.")}sortColsLikeCols(e){!e||e.length<=1||e.filter(t=>this.cols.list.indexOf(t)<0).length>0||e.sort((t,i)=>this.cols.list.indexOf(t)-this.cols.list.indexOf(i))}resetColDefIntoCol(e,t){const i=e.getUserProvidedColDef();if(!i)return!1;const s=this.columnFactory.addColumnDefaultAndTypes(i,e.getColId());return e.setColDef(s,i,t),!0}queueResizeOperations(){this.shouldQueueResizeOperations=!0}isShouldQueueResizeOperations(){return this.shouldQueueResizeOperations}processResizeOperations(){this.shouldQueueResizeOperations=!1,this.resizeOperationQueue.forEach(e=>e()),this.resizeOperationQueue=[]}pushResizeOperation(e){this.resizeOperationQueue.push(e)}moveInCols(e,t,i){var s;Xo((s=this.cols)==null?void 0:s.list,e,t),this.visibleColsService.refresh(i)}positionLockedCols(){this.cols.list=this.columnMoveService.placeLockedColumns(this.cols.list)}saveColOrder(){var e,t;this.showingPivotResult?this.lastPivotOrder=(e=this.cols)==null?void 0:e.list:this.lastOrder=(t=this.cols)==null?void 0:t.list}getColumnDefs(){if(!this.colDefCols)return;const e=this.colDefCols.list.slice();this.showingPivotResult?e.sort((s,o)=>this.lastOrder.indexOf(s)-this.lastOrder.indexOf(o)):this.lastOrder&&e.sort((s,o)=>this.cols.list.indexOf(s)-this.cols.list.indexOf(o));const t=this.funcColsService.getRowGroupColumns(),i=this.funcColsService.getPivotColumns();return this.columnDefFactory.buildColumnDefs(e,t,i)}isShowingPivotResult(){return this.showingPivotResult}isChangeEventsDispatching(){return this.changeEventsDispatching}isColSpanActive(){return this.colSpanActive}isProvidedColGroupsPresent(){var e;return((e=this.colDefCols)==null?void 0:e.treeDepth)>0}setColSpanActive(){this.colSpanActive=this.cols.list.some(e=>e.getColDef().colSpan!=null)}isAutoRowHeightActive(){return this.autoHeightActive}wasAutoRowHeightEverActive(){return this.autoHeightActiveAtLeastOnce}getHeaderRowCount(){return this.cols?this.cols.treeDepth+1:-1}isReady(){return this.ready}isPivotMode(){return this.pivotMode}setPivotMode(e,t){e!==this.pivotMode&&this.isPivotSettingAllowed(this.pivotMode)&&(this.pivotMode=e,this.ready&&(this.refreshCols(!1),this.visibleColsService.refresh(t),this.eventDispatcher.pivotModeChanged()))}isPivotSettingAllowed(e){return!e||!this.gos.get("treeData")||(R("Pivot mode not available with treeData."),!1)}isPivotActive(){const e=this.funcColsService.getPivotColumns();return this.pivotMode&&!Me(e)}recreateColumnDefs(e){this.cols&&(this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e),this.createColsFromColDefs(e))}setColumnDefs(e,t){this.colDefs=e,this.createColsFromColDefs(t)}destroy(){var e,t,i;ht(this.context,(e=this.colDefCols)==null?void 0:e.tree),ht(this.context,(t=this.autoCols)==null?void 0:t.tree),ht(this.context,(i=this.controlsCols)==null?void 0:i.tree),super.destroy()}getColTree(){return this.cols.tree}getColDefColTree(){return this.colDefCols.tree}getColDefCols(){var e;return(e=this.colDefCols)!=null&&e.list?this.colDefCols.list:null}getCols(){var e;return((e=this.cols)==null?void 0:e.list)??[]}getAllCols(){var i,s,o;const e=this.pivotResultColsService.getPivotResultCols(),t=e==null?void 0:e.list;return[((i=this.colDefCols)==null?void 0:i.list)??[],((s=this.autoCols)==null?void 0:s.list)??[],((o=this.controlsCols)==null?void 0:o.list)??[],t??[]].flat()}getColsForKeys(e){return e?e.map(t=>this.getCol(t)).filter(t=>t!=null):[]}getColDefCol(e){var t;return(t=this.colDefCols)!=null&&t.list?this.getColFromCollection(e,this.colDefCols):null}getCol(e){return e==null?null:this.getColFromCollection(e,this.cols)}getColFromCollection(e,t){if(t==null)return null;const{map:i,list:s}=t;if(typeof e=="string"&&i[e])return i[e];for(let o=0;orn(i,e)))??null}getAutoCols(){var e;return((e=this.autoCols)==null?void 0:e.list)??null}setColHeaderHeight(e,t){e.setAutoHeaderHeight(t)&&(e.isColumn?this.eventDispatcher.headerHeight(e):this.eventDispatcher.groupHeaderHeight(e))}getGroupRowsHeight(){const e=[],t=this.ctrlsService.getHeaderRowContainerCtrls();for(const i of t){if(!i)continue;const s=i.getGroupRowCount()||0;for(let o=0;or)&&(e[o]=l)}}}return e}getColumnGroupHeaderRowHeight(e){const t=this.isPivotMode()?this.getPivotGroupHeaderHeight():this.getGroupHeaderHeight();let i=0;const s=e.getHeaderCtrls();for(const o of s){const n=o.getColumn();if(n.isAutoHeaderHeight()){const r=n.getAutoHeaderHeight();r!=null&&r>i&&(i=r)}}return Math.max(t,i)}getColumnHeaderRowHeight(){const e=this.isPivotMode()?this.getPivotHeaderHeight():this.getHeaderHeight(),t=this.visibleColsService.getAllCols().filter(i=>i.isAutoHeaderHeight()).map(i=>i.getAutoHeaderHeight()||0);return Math.max(e,...t)}getHeaderHeight(){return this.gos.get("headerHeight")??this.environment.getDefaultHeaderHeight()}getFloatingFiltersHeight(){return this.gos.get("floatingFiltersHeight")??this.getHeaderHeight()}getGroupHeaderHeight(){return this.gos.get("groupHeaderHeight")??this.getHeaderHeight()}getPivotHeaderHeight(){return this.gos.get("pivotHeaderHeight")??this.getHeaderHeight()}getPivotGroupHeaderHeight(){return this.gos.get("pivotGroupHeaderHeight")??this.getGroupHeaderHeight()}onFirstDataRendered(){const e=this.gos.get("autoSizeStrategy");if((e==null?void 0:e.type)!=="fitCellContents")return;const{colIds:t,skipHeader:i}=e;setTimeout(()=>{t?this.columnAutosizeService.autoSizeCols({colKeys:t,skipHeader:i,source:"autosizeColumns"}):this.columnAutosizeService.autoSizeAllColumns("autosizeColumns",i)})}onAutoGroupColumnDefChanged(e){this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e)}onSelectionOptionsChanged(e,t,i){const s=(t&&typeof t!="string"?Ht(t):void 0)!==(e&&typeof e!="string"?Ht(e):void 0),o=t&&typeof t!="string"?Li(t):void 0,n=e&&typeof e!="string"?Li(e):void 0;(s||o!==n)&&this.refreshAll(i)}};function bt(e){return e==="gridOptionsUpdated"?"gridOptionsChanged":e}function nn(e){e.map={},e.list.forEach(t=>e.map[t.getId()]=t)}function rn(e,t){const i=e===t,s=e.getColDef()===t,o=e.getColId()==t;return i||s||o}function ln(e,t){return at(e,t,(i,s)=>i.getColId()===s.getColId())}var Ol=class extends b{constructor(){super(...arguments),this.beanName="columnAutosizeService",this.timesDelayed=0}wireBeans(e){this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.animationFrameService=e.animationFrameService,this.autoWidthCalculator=e.autoWidthCalculator,this.eventDispatcher=e.columnEventDispatcher,this.ctrlsService=e.ctrlsService,this.renderStatusService=e.renderStatusService}autoSizeCols(e){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation(()=>this.autoSizeCols(e));const{colKeys:t,skipHeader:i,skipHeaderGroups:s,stopAtGroup:o,source:n="api"}=e;if(this.animationFrameService.flushAllFrames(),this.timesDelayed<5&&this.renderStatusService&&!this.renderStatusService.areHeaderCellsRendered())return this.timesDelayed++,void setTimeout(()=>this.autoSizeCols(e));this.timesDelayed=0;const r=[];let l=-1;const a=i??this.gos.get("skipHeaderOnAutoSize"),h=s??a;for(;l!==0;){l=0;const d=[];t.forEach(c=>{if(!c)return;const u=this.columnModel.getCol(c);if(!u||r.indexOf(u)>=0)return;const g=this.autoWidthCalculator.getPreferredWidthForColumn(u,a);if(g>0){const m=this.normaliseColumnWidth(u,g);u.setActualWidth(m,n),r.push(u),l++}d.push(u)}),d.length&&this.visibleColsService.refresh(n)}h||this.autoSizeColumnGroupsByColumns(t,n,o),this.eventDispatcher.columnResized(r,!0,"autosizeColumns")}autoSizeColumn(e,t,i){e&&this.autoSizeCols({colKeys:[e],skipHeader:i,skipHeaderGroups:!0,source:t})}autoSizeColumnGroupsByColumns(e,t,i){const s=new Set;let o;this.columnModel.getColsForKeys(e).forEach(n=>{let r=n.getParent();for(;r&&r!=i;)r.isPadding()||s.add(r),r=r.getParent()});for(const n of s){for(const r of this.ctrlsService.getHeaderRowContainerCtrls())if(o=r.getHeaderCtrlForColumn(n),o)break;o&&o.resizeLeafColumnsToFit(t)}return[]}autoSizeAllColumns(e,t){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation(()=>this.autoSizeAllColumns(e,t));const i=this.visibleColsService.getAllCols();this.autoSizeCols({colKeys:i,skipHeader:t,source:e})}normaliseColumnWidth(e,t){const i=e.getMinWidth();tthis.rowGroupCols.push(e),removeGroupCol:e=>ye(this.rowGroupCols,e),addPivotCol:e=>this.pivotCols.push(e),removePivotCol:e=>ye(this.pivotCols,e),addValueCol:e=>this.valueCols.push(e),removeValueCol:e=>ye(this.valueCols,e)}}getSourceColumnsForGroupColumn(e){const t=e.getColDef().showRowGroup;if(!t)return null;if(t===!0)return this.rowGroupCols.slice(0);const i=this.columnModel.getColDefCol(t);return i?[i]:null}sortRowGroupColumns(e){this.rowGroupCols.sort(e)}sortPivotColumns(e){this.pivotCols.sort(e)}getValueColumns(){return this.valueCols?this.valueCols:[]}getPivotColumns(){return this.pivotCols?this.pivotCols:[]}getRowGroupColumns(){return this.rowGroupCols?this.rowGroupCols:[]}isRowGroupEmpty(){return Me(this.rowGroupCols)}setColumnAggFunc(e,t,i){if(!e)return;const s=this.columnModel.getColDefCol(e);s&&(s.setAggFunc(t),this.eventDispatcher.columnChanged("columnValueChanged",[s],i))}setRowGroupColumns(e,t){this.setColList(e,this.rowGroupCols,"columnRowGroupChanged",!0,!0,(i,s)=>this.setRowGroupActive(i,s,t),t)}setRowGroupActive(e,t,i){e!==t.isRowGroupActive()&&(t.setRowGroupActive(e,i),e&&!this.gos.get("suppressRowGroupHidesColumns")&&this.columnModel.setColsVisible([t],!1,i),e||this.gos.get("suppressMakeColumnVisibleAfterUnGroup")||this.columnModel.setColsVisible([t],!0,i))}addRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!0,!0,i=>this.setRowGroupActive(!0,i,t),"columnRowGroupChanged",t)}removeRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!1,!0,i=>this.setRowGroupActive(!1,i,t),"columnRowGroupChanged",t)}addPivotColumns(e,t){this.updateColList(e,this.pivotCols,!0,!1,i=>i.setPivotActive(!0,t),"columnPivotChanged",t)}setPivotColumns(e,t){this.setColList(e,this.pivotCols,"columnPivotChanged",!0,!1,(i,s)=>{s.setPivotActive(i,t)},t)}removePivotColumns(e,t){this.updateColList(e,this.pivotCols,!1,!1,i=>i.setPivotActive(!1,t),"columnPivotChanged",t)}setValueColumns(e,t){this.setColList(e,this.valueCols,"columnValueChanged",!1,!1,(i,s)=>this.setValueActive(i,s,t),t)}setValueActive(e,t,i){if(e!==t.isValueActive()&&(t.setValueActive(e,i),e&&!t.getAggFunc()&&this.aggFuncService)){const s=this.aggFuncService.getDefaultAggFunc(t);t.setAggFunc(s)}}addValueColumns(e,t){this.updateColList(e,this.valueCols,!0,!1,i=>this.setValueActive(!0,i,t),"columnValueChanged",t)}removeValueColumns(e,t){this.updateColList(e,this.valueCols,!1,!1,i=>this.setValueActive(!1,i,t),"columnValueChanged",t)}moveRowGroupColumn(e,t,i){if(this.isRowGroupEmpty())return;const s=this.rowGroupCols[e],o=this.rowGroupCols.slice(e,t);this.rowGroupCols.splice(e,1),this.rowGroupCols.splice(t,0,s),this.eventDispatcher.rowGroupChanged(o,i)}setColList(e,t,i,s,o,n,r){if(!this.columnModel.getCols())return;const l=new Map;t.forEach((a,h)=>l.set(a,h)),t.length=0,M(e)&&e.forEach(a=>{const h=this.columnModel.getColDefCol(a);h&&t.push(h)}),t.forEach((a,h)=>{const d=l.get(a);d!==void 0?s&&d!==h||l.delete(a):l.set(a,0)}),(this.columnModel.getColDefCols()||[]).forEach(a=>{const h=t.indexOf(a)>=0;n(h,a)}),o&&this.columnModel.refreshCols(!1),this.visibleColsService.refresh(r),this.eventDispatcher.columnChanged(i,[...l.keys()],r)}updateColList(e,t,i,s,o,n,r){if(!e||Me(e))return;let l=!1;const a=new Set;e.forEach(h=>{if(!h)return;const d=this.columnModel.getColDefCol(h);if(d){if(a.add(d),i){if(t.indexOf(d)>=0)return;t.push(d)}else{const c=t.indexOf(d);if(c<0)return;for(let u=c+1;ui.setValueActive(s,e),()=>{},()=>{},i=>{const s=i.aggFunc;return s===null||s===""?null:s!==void 0?!!s:void 0},i=>i.initialAggFunc!=null&&i.initialAggFunc!=""),this.valueCols.forEach(i=>{const s=i.getColDef();s.aggFunc!=null&&s.aggFunc!=""?i.setAggFunc(s.aggFunc):i.getAggFunc()||i.setAggFunc(s.initialAggFunc)})}extractRowGroupCols(e,t){this.rowGroupCols=this.extractColsCommon(t,this.rowGroupCols,(i,s)=>i.setRowGroupActive(s,e),i=>i.rowGroupIndex,i=>i.initialRowGroupIndex,i=>i.rowGroup,i=>i.initialRowGroup)}extractPivotCols(e,t){this.pivotCols=this.extractColsCommon(t,this.pivotCols,(i,s)=>i.setPivotActive(s,e),i=>i.pivotIndex,i=>i.initialPivotIndex,i=>i.pivot,i=>i.initialPivot)}extractColsCommon(e=[],t=[],i,s,o,n,r){const l=[],a=[];(this.columnModel.getColDefCols()||[]).forEach(c=>{const u=e.indexOf(c)<0,g=c.getColDef(),m=gs(n(g)),f=gs(r(g)),C=ft(s(g)),v=ft(o(g));let w;w=m!==void 0?m:C!==void 0?C!==null&&C>=0:u?f!==void 0?f:v!==void 0&&v!=null&&v>=0:t.indexOf(c)>=0,w&&((u?C!=null||v!=null:C!=null)?l.push(c):a.push(c))});const h=c=>{const u=s(c.getColDef()),g=o(c.getColDef());return u??g};l.sort((c,u)=>{const g=h(c),m=h(u);return g===m?0:g{a.indexOf(c)>=0&&d.push(c)}),a.forEach(c=>{d.indexOf(c)<0&&d.push(c)}),t.forEach(c=>{d.indexOf(c)<0&&i(c,!1)}),d.forEach(c=>{t.indexOf(c)<0&&i(c,!0)}),d}generateColumnStateForRowGroupAndPivotIndexes(e,t){const i={},s=(o,n,r,l,a,h)=>{const d=this.columnModel.getColDefCols();if(!n.length||!d)return[];const c=Object.keys(o),u=new Set(c),g=new Set(c),m=new Set(n.map(E=>{const D=E.getColId();return g.delete(D),D}).concat(c)),f=[],C={};let v=0;for(let E=0;E{const D=C[E];for(let A=S;A{const D=E.getColId();if(u.has(D))F(D),o[D][a]=w++;else{const A=E.getColDef();(A[a]===null||A[a]===void 0&&A[h]==null)&&(P||(A[r]||A[r]===void 0&&A[l]?F(D):(g.forEach(L=>{o[L][a]=w+C[L]}),w+=f.length,P=!0)),i[D]||(i[D]={colId:D}),i[D][a]=w++)}})};return s(e,this.rowGroupCols,"rowGroup","initialRowGroup","rowGroupIndex","initialRowGroupIndex"),s(t,this.pivotCols,"pivot","initialPivot","pivotIndex","initialPivotIndex"),Object.values(i)}},Nl=class extends b{constructor(){super(...arguments),this.beanName="columnApplyStateService"}wireBeans(e){this.columnModel=e.columnModel,this.eventDispatcher=e.columnEventDispatcher,this.sortController=e.sortController,this.columnGetStateService=e.columnGetStateService,this.funcColsService=e.funcColsService,this.visibleColsService=e.visibleColsService,this.columnAnimationService=e.columnAnimationService,this.pivotResultColsService=e.pivotResultColsService}applyColumnState(e,t){const i=this.columnModel.getColDefCols()||[];if(Me(i))return!1;if(e&&e.state&&!e.state.forEach)return R("applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state."),!1;const s=this.funcColsService.getModifyColumnsNoEventsCallbacks(),o=(l,a,h)=>{const d=this.compareColumnStatesAndDispatchEvents(t),c=a.slice(),u={},g={},m=[],f=[];let C=0;const v=this.funcColsService.getRowGroupColumns().slice(),w=this.funcColsService.getPivotColumns().slice();l.forEach(F=>{const E=F.colId||"";if(E.startsWith(Ni))return m.push(F),void f.push(F);const D=h(E);D?(this.syncColumnWithStateItem(D,F,e.defaultState,u,g,!1,t,s),ye(c,D)):(f.push(F),C+=1)});const P=F=>this.syncColumnWithStateItem(F,null,e.defaultState,u,g,!1,t,s);c.forEach(P),this.funcColsService.sortRowGroupColumns(an.bind(this,u,v)),this.funcColsService.sortPivotColumns(an.bind(this,g,w)),this.columnModel.refreshCols(!1);const S=(this.columnModel.getAutoCols()||[]).slice();return m.forEach(F=>{const E=this.columnModel.getAutoCol(F.colId);ye(S,E),this.syncColumnWithStateItem(E,F,e.defaultState,null,null,!0,t,s)}),S.forEach(P),this.orderLiveColsLikeState(e),this.visibleColsService.refresh(t),this.eventDispatcher.everythingChanged(t),d(),{unmatchedAndAutoStates:f,unmatchedCount:C}};this.columnAnimationService.start();let{unmatchedAndAutoStates:n,unmatchedCount:r}=o(e.state||[],i,l=>this.columnModel.getColDefCol(l));if(n.length>0||M(e.defaultState)){const l=this.pivotResultColsService.getPivotResultCols(),a=l==null?void 0:l.list;r=o(n,a||[],h=>this.pivotResultColsService.getPivotResultCol(h)).unmatchedCount}return this.columnAnimationService.finish(),r===0}resetColumnState(e){if(Me(this.columnModel.getColDefCols()))return;const t=bs(this.columnModel.getColDefColTree()),i=[];let s=1e3,o=1e3,n=[];const r=this.columnModel.getAutoCols();r&&(n=n.concat(r)),t&&(n=n.concat(t)),n.forEach(l=>{const a=this.getColumnStateFromColDef(l);K(a.rowGroupIndex)&&a.rowGroup&&(a.rowGroupIndex=s++),K(a.pivotIndex)&&a.pivot&&(a.pivotIndex=o++),i.push(a)}),this.applyColumnState({state:i,applyOrder:!0},e)}getColumnStateFromColDef(e){const t=(m,f)=>m??f??null,i=e.getColDef(),s=t(i.sort,i.initialSort),o=t(i.sortIndex,i.initialSortIndex),n=t(i.hide,i.initialHide),r=t(i.pinned,i.initialPinned),l=t(i.width,i.initialWidth),a=t(i.flex,i.initialFlex);let h=t(i.rowGroupIndex,i.initialRowGroupIndex),d=t(i.rowGroup,i.initialRowGroup);h!=null||d!=null&&d!=0||(h=null,d=null);let c=t(i.pivotIndex,i.initialPivotIndex),u=t(i.pivot,i.initialPivot);c!=null||u!=null&&u!=0||(c=null,u=null);const g=t(i.aggFunc,i.initialAggFunc);return{colId:e.getColId(),sort:s,sortIndex:o,hide:n,pinned:r,width:l,flex:a,rowGroup:d,rowGroupIndex:h,pivot:u,pivotIndex:c,aggFunc:g}}syncColumnWithStateItem(e,t,i,s,o,n,r,l){if(!e)return;const a=(S,F)=>{const E={value1:void 0,value2:void 0};let D=!1;return t&&(t[S]!==void 0&&(E.value1=t[S],D=!0),M(F)&&t[F]!==void 0&&(E.value2=t[F],D=!0)),!D&&i&&(i[S]!==void 0&&(E.value1=i[S]),M(F)&&i[F]!==void 0&&(E.value2=i[F])),E},h=a("hide").value1;h!==void 0&&e.setVisible(!h,r);const d=a("pinned").value1;d!==void 0&&e.setPinned(d);const c=e.getColDef().minWidth??this.gos.environment.getDefaultColumnMinWidth(),u=a("flex").value1;if(u!==void 0&&e.setFlex(u),u==null){const S=a("width").value1;S!=null&&c!=null&&S>=c&&e.setActualWidth(S,r)}const g=a("sort").value1;g!==void 0&&(g==="desc"||g==="asc"?e.setSort(g,r):e.setSort(void 0,r));const m=a("sortIndex").value1;if(m!==void 0&&e.setSortIndex(m),n||!e.isPrimary())return;const f=a("aggFunc").value1;f!==void 0&&(typeof f=="string"?(e.setAggFunc(f),e.isValueActive()||(e.setValueActive(!0,r),l.addValueCol(e))):(M(f)&&R("stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON."),e.isValueActive()&&(e.setValueActive(!1,r),l.removeValueCol(e))));const{value1:C,value2:v}=a("rowGroup","rowGroupIndex");C===void 0&&v===void 0||(typeof v=="number"||C?(e.isRowGroupActive()||(e.setRowGroupActive(!0,r),l.addGroupCol(e)),s&&typeof v=="number"&&(s[e.getId()]=v)):e.isRowGroupActive()&&(e.setRowGroupActive(!1,r),l.removeGroupCol(e)));const{value1:w,value2:P}=a("pivot","pivotIndex");w===void 0&&P===void 0||(typeof P=="number"||w?(e.isPivotActive()||(e.setPivotActive(!0,r),l.addPivotCol(e)),o&&typeof P=="number"&&(o[e.getId()]=P)):e.isPivotActive()&&(e.setPivotActive(!1,r),l.removePivotCol(e)))}orderLiveColsLikeState(e){if(!e.applyOrder||!e.state)return;const t=[];e.state.forEach(i=>{i.colId!=null&&t.push(i.colId)}),this.columnModel.sortColsLikeKeys(t)}compareColumnStatesAndDispatchEvents(e){const t={rowGroupColumns:this.funcColsService.getRowGroupColumns().slice(),pivotColumns:this.funcColsService.getPivotColumns().slice(),valueColumns:this.funcColsService.getValueColumns().slice()},i=this.columnGetStateService.getColumnState(),s={};return i.forEach(o=>{s[o.colId]=o}),()=>{const o=this.columnModel.getAllCols(),n=(d,c,u,g)=>{if(at(c.map(g),u.map(g)))return;const m=new Set(c);u.forEach(C=>{m.delete(C)||m.add(C)});const f=[...m];this.eventService.dispatchEvent({type:d,columns:f,column:f.length===1?f[0]:null,source:e})},r=d=>{const c=[];return o.forEach(u=>{const g=s[u.getColId()];g&&d(g,u)&&c.push(u)}),c},l=d=>d.getColId();n("columnRowGroupChanged",t.rowGroupColumns,this.funcColsService.getRowGroupColumns(),l),n("columnPivotChanged",t.pivotColumns,this.funcColsService.getPivotColumns(),l);const a=r((d,c)=>{const u=d.aggFunc!=null,g=u!=c.isValueActive(),m=u&&d.aggFunc!=c.getAggFunc();return g||m});a.length>0&&this.eventDispatcher.columnChanged("columnValueChanged",a,e),this.eventDispatcher.columnResized(r((d,c)=>d.width!=c.getActualWidth()),!0,e),this.eventDispatcher.columnPinned(r((d,c)=>d.pinned!=c.getPinned()),e),this.eventDispatcher.columnVisible(r((d,c)=>d.hide==c.isVisible()),e);const h=r((d,c)=>d.sort!=c.getSort()||d.sortIndex!=c.getSortIndex());h.length>0&&this.sortController.dispatchSortChangedEvents(e,h),this.normaliseColumnMovedEventForColumnState(i,e)}}normaliseColumnMovedEventForColumnState(e,t){const i=this.columnGetStateService.getColumnState(),s={};i.forEach(a=>s[a.colId]=a);const o={};e.forEach(a=>{s[a.colId]&&(o[a.colId]=!0)});const n=e.filter(a=>o[a.colId]),r=i.filter(a=>o[a.colId]),l=[];r.forEach((a,h)=>{const d=n&&n[h];if(d&&d.colId!==a.colId){const c=this.columnModel.getCol(d.colId);c&&l.push(c)}}),l.length&&this.eventDispatcher.columnMoved({movedColumns:l,source:t,finished:!0})}},an=(e,t,i,s)=>{const o=e[i.getId()],n=e[s.getId()],r=o!=null,l=n!=null;if(r&&l)return o-n;if(r)return-1;if(l)return 1;const a=t.indexOf(i),h=t.indexOf(s),d=a>=0;return d&&h>=0?a-h:d?-1:1},Hl=class extends b{constructor(){super(...arguments),this.beanName="columnMoveService"}wireBeans(e){this.columnModel=e.columnModel,this.columnAnimationService=e.columnAnimationService,this.eventDispatcher=e.columnEventDispatcher}moveColumnByIndex(e,t,i){const s=this.columnModel.getCols();if(!s)return;const o=s[e];this.moveColumns([o],t,i)}moveColumns(e,t,i,s=!0){const o=this.columnModel.getCols();if(!o)return;if(t>o.length-e.length)return R("tried to insert columns in invalid location, toIndex = ",t),void R("remember that you should not count the moving columns when calculating the new index");this.columnAnimationService.start();const n=this.columnModel.getColsForKeys(e);this.doesMovePassRules(n,t)&&(this.columnModel.moveInCols(n,t,i),this.eventDispatcher.columnMoved({movedColumns:n,source:i,toIndex:t,finished:s})),this.columnAnimationService.finish()}doesMovePassRules(e,t){const i=this.getProposedColumnOrder(e,t);return this.doesOrderPassRules(i)}doesOrderPassRules(e){return!!this.doesMovePassMarryChildren(e)&&!!this.doesMovePassLockedPositions(e)}getProposedColumnOrder(e,t){const i=this.columnModel.getCols().slice();return Xo(i,e,t),i}doesMovePassLockedPositions(e){const t=this.gos.get("enableRtl");let i=t?1:-1,s=!0;return e.forEach(o=>{const n=(r=o.getColDef().lockPosition)?r==="left"||r===!0?-1:1:0;var r;t?n>i&&(s=!1):n{if(!be(i))return;const s=i,o=s.getColGroupDef();if(!(o&&o.marryChildren))return;const n=[];s.getLeafColumns().forEach(r=>{const l=e.indexOf(r);n.push(l)}),Math.max.apply(Math,n)-Math.min.apply(Math,n)>s.getLeafColumns().length-1&&(t=!1)}),t}placeLockedColumns(e){const t=[],i=[],s=[];return e.forEach(o=>{const n=o.getColDef().lockPosition;n==="right"?s.push(o):n==="left"||n===!0?t.push(o):i.push(o)}),this.gos.get("enableRtl")?[...s,...i,...t]:[...t,...i,...s]}},Bl=/[&<>"']/g,Vl={"&":"&","<":"<",">":">",'"':""","'":"'"};function _e(e,t){if(e==null)return null;const i=e.toString().toString();return t?i:i.replace(Bl,s=>Vl[s])}var Wl=class extends b{constructor(){super(...arguments),this.beanName="columnNameService"}wireBeans(e){this.expressionService=e.expressionService,this.funcColsService=e.funcColsService,this.columnModel=e.columnModel}getDisplayNameForColumn(e,t,i=!1){if(!e)return null;const s=this.getHeaderName(e.getColDef(),e,null,null,t);return i?this.wrapHeaderNameWithAggFunc(e,s):s}getDisplayNameForProvidedColumnGroup(e,t,i){const s=t?t.getColGroupDef():null;return s?this.getHeaderName(s,null,e,t,i):null}getDisplayNameForColumnGroup(e,t){return this.getDisplayNameForProvidedColumnGroup(e,e.getProvidedColumnGroup(),t)}getHeaderName(e,t,i,s,o){const n=e.headerValueGetter;if(n){const l=this.gos.addGridCommonParams({colDef:e,column:t,columnGroup:i,providedColumnGroup:s,location:o});return typeof n=="function"?n(l):typeof n=="string"?this.expressionService.evaluate(n,l):(R("headerValueGetter must be a function or a string"),"")}return e.headerName!=null?e.headerName:e.field?(r=e.field)&&r!=null?r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z])([a-z])/g,"$1 $2$3").replace(/\./g," ").split(" ").map(l=>l.substring(0,1).toUpperCase()+(l.length>1?l.substring(1,l.length):"")).join(" "):null:"";var r}wrapHeaderNameWithAggFunc(e,t){if(this.gos.get("suppressAggFuncInHeader"))return t;const i=e.getColDef().pivotValueColumn;let s,o=null;if(M(i)){const n=this.funcColsService.getValueColumns(),r=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&n.length===1,l=e.getColDef().pivotTotalColumnIds!==void 0;if(r&&!l)return t;o=i?i.getAggFunc():null,s=!0}else{const n=e.isValueActive(),r=this.columnModel.isPivotMode()||!this.funcColsService.isRowGroupEmpty();n&&r?(o=e.getAggFunc(),s=!0):s=!1}if(s){const n=typeof o=="string"?o:"func";return`${this.localeService.getLocaleTextFunc()(n,n)}(${t})`}return t}},zl=class extends b{constructor(){super(...arguments),this.beanName="pivotResultColsService"}wireBeans(e){this.context=e.context,this.columnModel=e.columnModel,this.columnFactory=e.columnFactory,this.visibleColsService=e.visibleColsService}destroy(){var e;ht(this.context,(e=this.pivotResultCols)==null?void 0:e.tree),super.destroy()}isPivotResultColsPresent(){return this.pivotResultCols!=null}lookupPivotResultCol(e,t){if(this.pivotResultCols==null)return null;const i=this.columnModel.getColDefCol(t);let s=null;return this.pivotResultCols.list.forEach(o=>{const n=o.getColDef().pivotKeys,r=o.getColDef().pivotValueColumn;at(n,e)&&r===i&&(s=o)}),s}getPivotResultCols(){return this.pivotResultCols}getPivotResultCol(e){return this.pivotResultCols?this.columnModel.getColFromCollection(e,this.pivotResultCols):null}setPivotResultCols(e,t){var i,s;if(this.columnModel.isReady()&&(e!=null||this.pivotResultCols!=null)){if(e){this.processPivotResultColDef(e);const o=this.columnFactory.createColumnTree(e,!1,((i=this.pivotResultCols)==null?void 0:i.tree)||this.previousPivotResultCols||void 0,t);ht(this.context,(s=this.pivotResultCols)==null?void 0:s.tree,o.columnTree);const n=o.columnTree,r=o.treeDept,l=bs(n),a={};this.pivotResultCols={tree:n,treeDepth:r,list:l,map:a},this.pivotResultCols.list.forEach(d=>this.pivotResultCols.map[d.getId()]=d);const h=!!this.previousPivotResultCols;this.previousPivotResultCols=null,this.columnModel.refreshCols(!h)}else this.previousPivotResultCols=this.pivotResultCols?this.pivotResultCols.tree:null,this.pivotResultCols=null,this.columnModel.refreshCols(!1);this.visibleColsService.refresh(t)}}processPivotResultColDef(e){const t=this.gos.get("processPivotResultColDef"),i=this.gos.get("processPivotResultColGroupDef");if(!t&&!i)return;const s=o=>{o.forEach(n=>{if(M(n.children)){const r=n;i&&i(r),s(r.children)}else t&&t(n)})};e&&s(e)}},Ul=class extends b{constructor(){super(...arguments),this.beanName="columnSizeService"}wireBeans(e){this.columnModel=e.columnModel,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher,this.visibleColsService=e.visibleColsService,this.ctrlsService=e.ctrlsService}setColumnWidths(e,t,i,s){const o=[];e.forEach(n=>{const r=this.columnModel.getColDefCol(n.key)||this.columnModel.getCol(n.key);if(r&&(o.push({width:n.newWidth,ratios:[1],columns:[r]}),this.gos.get("colResizeDefault")==="shift"&&(t=!t),t)){const l=this.visibleColsService.getColAfter(r);if(!l)return;const a=r.getActualWidth()-n.newWidth,h=l.getActualWidth()+a;o.push({width:h,ratios:[1],columns:[l]})}}),o.length!==0&&this.resizeColumnSets({resizeSets:o,finished:i,source:s})}resizeColumnSets(e){const{resizeSets:t,finished:i,source:s}=e;if(!(!t||t.every(h=>this.checkMinAndMaxWidthsForSet(h)))){if(i){const h=t&&t.length>0?t[0].columns:null;this.eventDispatcher.columnResized(h,i,s)}return}const o=[],n=[];t.forEach(h=>{const{width:d,columns:c,ratios:u}=h,g={},m={};c.forEach(v=>n.push(v));let f=!0,C=0;for(;f;){if(C++,C>1e3){Q("infinite loop in resizeColumnSets");break}f=!1;const v=[];let w=0,P=d;c.forEach((F,E)=>{if(m[F.getId()])P-=g[F.getId()];else{v.push(F);const D=u[E];w+=D}});const S=1/w;v.forEach((F,E)=>{let D;E===v.length-1?D=P:(D=Math.round(u[E]*d*S),P-=D);const A=F.getMinWidth(),L=F.getMaxWidth();D0&&D>L&&(D=L,m[F.getId()]=!0,f=!0),g[F.getId()]=D})}c.forEach(v=>{const w=g[v.getId()];v.getActualWidth()!==w&&(v.setActualWidth(w,s),o.push(v))})});const r=o.length>0;let l=[];r&&(l=this.refreshFlexedColumns({resizingCols:n,skipSetLeft:!0}),this.visibleColsService.setLeftValues(s),this.visibleColsService.updateBodyWidths(),this.columnViewportService.checkViewportColumns());const a=n.concat(l);(r||i)&&this.eventDispatcher.columnResized(a,i,s,l)}checkMinAndMaxWidthsForSet(e){const{columns:t,width:i}=e;let s=0,o=0,n=!0;return t.forEach(r=>{const l=r.getMinWidth();s+=l||0;const a=r.getMaxWidth();a>0?o+=a:n=!1}),i>=s&&(!n||i<=o)}refreshFlexedColumns(e={}){const t=e.source?e.source:"flex";if(e.viewportWidth!=null&&(this.flexViewportWidth=e.viewportWidth),!this.flexViewportWidth)return[];const i=this.visibleColsService.getCenterCols();let s=-1;if(e.resizingCols){const u=new Set(e.resizingCols);for(let g=i.length-1;g>=0;g--)if(u.has(i[g])){s=g;break}}let o=0,n=[],r=0,l=0;for(let u=0;us?(n.push(i[u]),l+=i[u].getFlex(),r+=i[u].getMinWidth()):o+=i[u].getActualWidth();if(!n.length)return[];let a=[];o+r>this.flexViewportWidth&&(n.forEach(u=>u.setActualWidth(u.getMinWidth(),t)),a=n,n=[]);const h=[];let d;e:for(;;){d=this.flexViewportWidth-o;const u=d/l;for(let g=0;gw&&(C=w),C){m.setActualWidth(C,t),Yo(n,m),l-=m.getFlex(),a.push(m),o+=m.getActualWidth();continue e}h[g]=Math.floor(f)}break}let c=d;return n.forEach((u,g)=>{const m=gthis.sizeColumnsToFit(e,t,i,s));const o={};s&&((u=s==null?void 0:s.columnLimits)==null||u.forEach(({key:g,...m})=>{o[typeof g=="string"?g:g.getColId()]=m}));const n=this.visibleColsService.getAllCols(),r=e===tt(n);if(e<=0||!n.length||r)return;const l=[],a=[];n.forEach(g=>{g.getColDef().suppressSizeToFit===!0?a.push(g):l.push(g)});const h=l.slice(0);let d=!1;const c=g=>{ye(l,g),a.push(g)};for(l.forEach(g=>{g.resetActualWidth(t);const m=o==null?void 0:o[g.getId()],f=(m==null?void 0:m.minWidth)??(s==null?void 0:s.defaultMinWidth),C=(m==null?void 0:m.maxWidth)??(s==null?void 0:s.defaultMaxWidth),v=g.getActualWidth();typeof f=="number"&&vC&&g.setActualWidth(C,t,!0)});!d;){d=!0;const g=e-tt(a);if(g<=0)l.forEach(m=>{var C;const f=((C=o==null?void 0:o[m.getId()])==null?void 0:C.minWidth)??(s==null?void 0:s.defaultMinWidth);typeof f!="number"?m.setMinimum(t):m.setActualWidth(f,t,!0)});else{const m=g/tt(l);let f=g;for(let C=l.length-1;C>=0;C--){const v=l[C],w=o==null?void 0:o[v.getId()],P=(w==null?void 0:w.minWidth)??(s==null?void 0:s.defaultMinWidth),S=(w==null?void 0:w.maxWidth)??(s==null?void 0:s.defaultMaxWidth),F=v.getMinWidth(),E=v.getMaxWidth(),D=typeof P=="number"&&P>F?P:F,A=typeof S=="number"&&SA?(L=A,c(v),d=!1):C===0&&(L=f),v.setActualWidth(L,t,!0),f-=L}}}h.forEach(g=>{g.fireColumnWidthChangedEvent(t)}),this.visibleColsService.setLeftValues(t),this.visibleColsService.updateBodyWidths(),i||this.eventDispatcher.columnResized(h,!0,t)}applyAutosizeStrategy(){const e=this.gos.get("autoSizeStrategy");if(!e)return;const{type:t}=e;setTimeout(()=>{if(t==="fitGridWidth"){const{columnLimits:i,defaultMinWidth:s,defaultMaxWidth:o}=e,n=i==null?void 0:i.map(({colId:r,minWidth:l,maxWidth:a})=>({key:r,minWidth:l,maxWidth:a}));this.ctrlsService.getGridBodyCtrl().sizeColumnsToFit({defaultMinWidth:s,defaultMaxWidth:o,columnLimits:n})}else t==="fitProvidedWidth"&&this.sizeColumnsToFit(e.width,"sizeColumnsToFit")})}};function hn(e,t){return e+"_"+t}function de(e){return e instanceof dn}var dn=class extends b{constructor(e,t,i,s){super(),this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.groupId=t,this.partId=i,this.providedColumnGroup=e,this.pinned=s}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}setParent(e){this.parent=e}getUniqueId(){return hn(this.groupId,this.partId)}isEmptyGroup(){return this.displayedChildren.length===0}isMoving(){const e=this.getProvidedColumnGroup().getLeafColumns();return!(!e||e.length===0)&&e.every(t=>t.isMoving())}checkLeft(){if(this.displayedChildren.forEach(e=>{de(e)&&e.checkLeft()}),this.displayedChildren.length>0)if(this.gos.get("enableRtl")){const e=$(this.displayedChildren).getLeft();this.setLeft(e)}else{const e=this.displayedChildren[0].getLeft();this.setLeft(e)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft(e){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.dispatchLocalEvent({type:"leftChanged"}))}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let e=0;return this.displayedChildren&&this.displayedChildren.forEach(t=>{e+=t.getActualWidth()}),e}isResizable(){if(!this.displayedChildren)return!1;let e=!1;return this.displayedChildren.forEach(t=>{t.isResizable()&&(e=!0)}),e}getMinWidth(){let e=0;return this.displayedChildren.forEach(t=>{e+=t.getMinWidth()}),e}addChild(e){this.children||(this.children=[]),this.children.push(e)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}getDisplayedLeafColumns(){const e=[];return this.addDisplayedLeafColumns(e),e}getDefinition(){return this.providedColumnGroup.getColGroupDef()}getColGroupDef(){return this.providedColumnGroup.getColGroupDef()}isPadding(){return this.providedColumnGroup.isPadding()}isExpandable(){return this.providedColumnGroup.isExpandable()}isExpanded(){return this.providedColumnGroup.isExpanded()}setExpanded(e){this.providedColumnGroup.setExpanded(e)}isAutoHeaderHeight(){var e;return!!((e=this.getColGroupDef())!=null&&e.autoHeaderHeight)}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}addDisplayedLeafColumns(e){this.displayedChildren.forEach(t=>{dt(t)?e.push(t):de(t)&&t.addDisplayedLeafColumns(e)})}addLeafColumns(e){this.children.forEach(t=>{dt(t)?e.push(t):de(t)&&t.addLeafColumns(e)})}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){const e=this.getParent();return this.isPadding()&&e&&e.isPadding()?1+e.getPaddingLevel():0}calculateDisplayedColumns(){this.displayedChildren=[];let e=this;for(;e!=null&&e.isPadding();)e=e.getParent();if(!(e&&e.getProvidedColumnGroup().isExpandable()))return this.displayedChildren=this.children,void this.dispatchLocalEvent({type:"displayedChildrenChanged"});this.children.forEach(t=>{if(!(de(t)&&(!t.displayedChildren||!t.displayedChildren.length)))switch(t.getColumnGroupShow()){case"open":e.getProvidedColumnGroup().isExpanded()&&this.displayedChildren.push(t);break;case"closed":e.getProvidedColumnGroup().isExpanded()||this.displayedChildren.push(t);break;default:this.displayedChildren.push(t)}}),this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},cn=class{constructor(){this.existingIds={}}getInstanceIdForKey(e){const t=this.existingIds[e];let i;return i=typeof t!="number"?0:t+1,this.existingIds[e]=i,i}},Kl=class extends b{constructor(){super(...arguments),this.beanName="visibleColsService",this.colsAndGroupsMap={},this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.bodyWidth=0,this.leftWidth=0,this.rightWidth=0,this.bodyWidthDirty=!0}wireBeans(e){this.columnModel=e.columnModel,this.columnSizeService=e.columnSizeService,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher}refresh(e,t=!1){t||this.buildTrees(),this.updateOpenClosedVisibilityInColumnGroups(),this.columnsLeft=As(this.treeLeft),this.columnsCenter=As(this.treeCenter),this.columnsRight=As(this.treeRight),this.joinColsAriaOrder(),this.joinCols(),this.setLeftValues(e),this.autoHeightCols=this.columns.filter(i=>i.isAutoHeight()),this.columnSizeService.refreshFlexedColumns(),this.updateBodyWidths(),this.columnViewportService.checkViewportColumns(!1),this.setFirstRightAndLastLeftPinned(e),this.eventDispatcher.visibleCols(e)}updateBodyWidths(){const e=tt(this.columnsCenter),t=tt(this.columnsLeft),i=tt(this.columnsRight);this.bodyWidthDirty=this.bodyWidth!==e,(this.bodyWidth!==e||this.leftWidth!==t||this.rightWidth!==i)&&(this.bodyWidth=e,this.leftWidth=t,this.rightWidth=i,this.eventService.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventService.dispatchEvent({type:"displayedColumnsWidthChanged"}))}setLeftValues(e){this.setLeftValuesOfCols(e),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned(e){let t,i;this.gos.get("enableRtl")?(t=this.columnsLeft?this.columnsLeft[0]:null,i=this.columnsRight?$(this.columnsRight):null):(t=this.columnsLeft?$(this.columnsLeft):null,i=this.columnsRight?this.columnsRight[0]:null),this.columnModel.getCols().forEach(s=>{s.setLastLeftPinned(s===t,e),s.setFirstRightPinned(s===i,e)})}buildTrees(){const e=this.columnModel.getColsToShow(),t=e.filter(n=>n.getPinned()=="left"),i=e.filter(n=>n.getPinned()=="right"),s=e.filter(n=>n.getPinned()!="left"&&n.getPinned()!="right"),o=new cn;this.treeLeft=this.createGroups({columns:t,idCreator:o,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=this.createGroups({columns:i,idCreator:o,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=this.createGroups({columns:s,idCreator:o,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.ariaOrderColumns=[]}joinColsAriaOrder(){const e=this.columnModel.getCols(),t=[],i=[],s=[];for(const o of e){const n=o.getPinned();n?n===!0||n==="left"?t.push(o):s.push(o):i.push(o)}this.ariaOrderColumns=t.concat(i).concat(s)}getAriaColIndex(e){let t;return t=de(e)?e.getLeafColumns()[0]:e,this.ariaOrderColumns.indexOf(t)+1}getAllAutoHeightCols(){return this.autoHeightCols}setLeftValuesOfGroups(){[this.treeLeft,this.treeRight,this.treeCenter].forEach(e=>{e.forEach(t=>{de(t)&&t.checkLeft()})})}setLeftValuesOfCols(e){if(!this.columnModel.getColDefCols())return;const t=this.columnModel.getCols().slice(0),i=this.gos.get("enableRtl");[this.columnsLeft,this.columnsRight,this.columnsCenter].forEach(s=>{if(i){let o=tt(s);s.forEach(n=>{o-=n.getActualWidth(),n.setLeft(o,e)})}else{let o=0;s.forEach(n=>{n.setLeft(o,e),o+=n.getActualWidth()})}(function(o,n){for(let r=0;r{s.setLeft(null,e)})}joinCols(){this.gos.get("enableRtl")?this.columns=this.columnsRight.concat(this.columnsCenter).concat(this.columnsLeft):this.columns=this.columnsLeft.concat(this.columnsCenter).concat(this.columnsRight)}getColsCenter(){return this.columnsCenter}getAllTrees(){return this.treeLeft&&this.treeRight&&this.treeCenter?this.treeLeft.concat(this.treeCenter).concat(this.treeRight):null}getTreeLeft(){return this.treeLeft}getTreeRight(){return this.treeRight}getTreeCenter(){return this.treeCenter}getAllCols(){return this.columns}isColDisplayed(e){return this.getAllCols().indexOf(e)>=0}getLeftColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsLeft):this.columnsLeft}getRightColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsRight):this.columnsRight}getColsForRow(e,t,i,s){const o=[];let n=null;for(let r=0;r1){const u=h-1;for(let g=1;g<=u;g++)d.push(t[r+g]);r+=u}let c;i?(c=!1,d.forEach(u=>{i(u)&&(c=!0)})):c=!0,c&&(o.length===0&&n&&s&&s(l)&&o.push(n),o.push(l)),n=l}return o}getBodyContainerWidth(){return this.bodyWidth}getContainerWidth(e){switch(e){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getCenterCols(){return this.columnsCenter}getLeftCols(){return this.columnsLeft}getRightCols(){return this.columnsRight}getColBefore(e){const t=this.getAllCols(),i=t.indexOf(e);return i>0?t[i-1]:null}getGroupAtDirection(e,t){const i=e.getProvidedColumnGroup().getLevel()+e.getPaddingLevel(),s=e.getDisplayedLeafColumns(),o=t==="After"?$(s):s[0],n=`getCol${t}`;for(;;){const r=this[n](o);if(!r)return null;const l=this.getColGroupAtLevel(r,i);if(l!==e)return l}}getColGroupAtLevel(e,t){let i,s,o=e.getParent();for(;i=o.getProvidedColumnGroup().getLevel(),s=o.getPaddingLevel(),!(i+s<=t);)o=o.getParent();return o}isPinningLeft(){return this.columnsLeft.length>0}isPinningRight(){return this.columnsRight.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};const e=t=>{this.colsAndGroupsMap[t.getUniqueId()]=t};Rt(this.treeCenter,!1,e),Rt(this.treeLeft,!1,e),Rt(this.treeRight,!1,e)}isVisible(e){return this.colsAndGroupsMap[e.getUniqueId()]===e}updateOpenClosedVisibilityInColumnGroups(){Rt(this.getAllTrees(),!1,e=>{de(e)&&e.calculateDisplayedColumns()})}getFirstColumn(){const e=this.gos.get("enableRtl"),t=["getLeftCols","getCenterCols","getRightCols"];e&&t.reverse();for(let i=0;i{if(de(n)){const r=n;let l;l=s?e===r.getGroupId()&&t===r.getPartId():e===r.getGroupId(),l&&(o=r)}}),o}getColAfter(e){const t=this.getAllCols(),i=t.indexOf(e);return i{const g=d;d=u;const m=h[g],f=(de(m)?m.getProvidedColumnGroup():m).getOriginalParent();if(f==null){for(let v=g;v{s.forEach(o=>{if(de(o)){const n=o;t[o.getUniqueId()]=n,i(n.getChildren())}})};return e&&i(e),t}setupParentsIntoCols(e,t){e.forEach(i=>{if(i.setParent(t),de(i)){const s=i;this.setupParentsIntoCols(s.getChildren(),s)}})}};function Rt(e,t,i){if(e)for(let s=0;s{dt(i)&&t.push(i)}),t}var un=["columnEverythingChanged","newColumnsLoaded","columnPivotModeChanged","pivotMaxColumnsExceeded","columnRowGroupChanged","expandOrCollapseAll","columnPivotChanged","gridColumnsChanged","columnValueChanged","columnMoved","columnVisible","columnPinned","columnGroupOpened","columnResized","displayedColumnsChanged","virtualColumnsChanged","columnHeaderMouseOver","columnHeaderMouseLeave","columnHeaderClicked","columnHeaderContextMenu","asyncTransactionsFlushed","rowGroupOpened","rowDataUpdated","pinnedRowDataChanged","rangeSelectionChanged","cellSelectionChanged","chartCreated","chartRangeSelectionChanged","chartOptionsChanged","chartDestroyed","toolPanelVisibleChanged","toolPanelSizeChanged","modelUpdated","cutStart","cutEnd","pasteStart","pasteEnd","fillStart","fillEnd","cellSelectionDeleteStart","cellSelectionDeleteEnd","rangeDeleteStart","rangeDeleteEnd","undoStarted","undoEnded","redoStarted","redoEnded","cellClicked","cellDoubleClicked","cellMouseDown","cellContextMenu","cellValueChanged","cellEditRequest","rowValueChanged","headerFocused","cellFocused","rowSelected","selectionChanged","tooltipShow","tooltipHide","cellKeyDown","cellMouseOver","cellMouseOut","filterChanged","filterModified","filterOpened","advancedFilterBuilderVisibleChanged","sortChanged","virtualRowRemoved","rowClicked","rowDoubleClicked","gridReady","gridPreDestroyed","gridSizeChanged","viewportChanged","firstDataRendered","dragStarted","dragStopped","dragCancelled","rowEditingStarted","rowEditingStopped","cellEditingStarted","cellEditingStopped","bodyScroll","bodyScrollEnd","paginationChanged","componentStateChanged","storeRefreshed","stateUpdated","columnMenuVisibleChanged","contextMenuVisibleChanged","rowDragEnter","rowDragMove","rowDragLeave","rowDragEnd","rowDragCancel"],$l=[...un,"scrollbarWidthChanged","keyShortcutChangedCellStart","keyShortcutChangedCellEnd","pinnedHeightChanged","cellFocusCleared","fullWidthRowFocused","checkboxChanged","heightScaleChanged","suppressMovableColumns","suppressMenuHide","suppressFieldDotNotation","columnPanelItemDragStart","columnPanelItemDragEnd","bodyHeightChanged","columnContainerWidthChanged","displayedColumnsWidthChanged","scrollVisibilityChanged","scrollGapChanged","columnHoverChanged","flashCells","paginationPixelOffsetChanged","displayedRowsChanged","leftPinnedWidthChanged","rightPinnedWidthChanged","rowContainerHeightChanged","headerHeightChanged","columnGroupHeaderHeightChanged","columnHeaderHeightChanged","gridStylesChanged","storeUpdated","filterDestroyed","rowDataUpdateStarted","rowCountReady","advancedFilterEnabledChanged","dataTypesInferred","fieldValueChanged","fieldPickerValueSelected","richSelectListRowSelected","sideBarUpdated","alignedGridScroll","alignedGridColumn","gridOptionsChanged","chartTitleEdit","recalculateRowBounds","stickyTopOffsetChanged","overlayExclusiveChanged"],_l={enableBrowserTooltips:!0,tooltipTrigger:!0,tooltipMouseTrack:!0,tooltipShowMode:!0,tooltipInteraction:!0,defaultColGroupDef:!0,suppressAutoSize:!0,skipHeaderOnAutoSize:!0,autoSizeStrategy:!0,components:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,undoRedoCellEditingLimit:!0,excelStyles:!0,cacheQuickFilter:!0,advancedFilterModel:!0,customChartThemes:!0,chartThemeOverrides:!0,chartToolPanelsDef:!0,loadingCellRendererSelector:!0,localeText:!0,keepDetailRows:!0,keepDetailRowsCount:!0,detailRowHeight:!0,detailRowAutoHeight:!0,tabIndex:!0,valueCache:!0,valueCacheNeverExpires:!0,enableCellExpressions:!0,suppressTouch:!0,suppressAsyncEvents:!0,suppressBrowserResizeObserver:!0,suppressPropertyNamesCheck:!0,debug:!0,dragAndDropImageComponent:!0,loadingOverlayComponent:!0,suppressLoadingOverlay:!0,noRowsOverlayComponent:!0,paginationPageSizeSelector:!0,paginateChildRows:!0,pivotPanelShow:!0,pivotSuppressAutoColumn:!0,suppressExpandablePivotGroups:!0,aggFuncs:!0,suppressAggFuncInHeader:!0,allowShowChangeAfterFilter:!0,ensureDomOrder:!0,enableRtl:!0,suppressColumnVirtualisation:!0,suppressMaxRenderedRowRestriction:!0,suppressRowVirtualisation:!0,rowDragText:!0,suppressGroupMaintainValueType:!0,groupLockGroupColumns:!0,rowGroupPanelSuppressSort:!0,suppressGroupRowsSticky:!0,rowModelType:!0,cacheOverflowSize:!0,infiniteInitialRowCount:!0,serverSideInitialRowCount:!0,suppressServerSideInfiniteScroll:!0,maxBlocksInCache:!0,maxConcurrentDatasourceRequests:!0,blockLoadDebounceMillis:!0,serverSideOnlyRefreshFilteredGroups:!0,serverSidePivotResultFieldSeparator:!0,viewportRowModelPageSize:!0,viewportRowModelBufferSize:!0,debounceVerticalScrollbar:!0,suppressAnimationFrame:!0,suppressPreventDefaultOnMouseWheel:!0,scrollbarWidth:!0,icons:!0,suppressRowTransform:!0,gridId:!0,enableGroupEdit:!0,initialState:!0,processUnpinnedColumns:!0,createChartContainer:!0,getLocaleText:!0,getRowId:!0,reactiveCustomComponents:!0,columnMenu:!0,suppressSetFilterByDefault:!0},ve=class{};ve.STRING_PROPERTIES=["overlayLoadingTemplate","overlayNoRowsTemplate","gridId","quickFilterText","rowModelType","editType","domLayout","clipboardDelimiter","rowGroupPanelShow","multiSortKey","pivotColumnGroupTotals","pivotRowTotals","pivotPanelShow","fillHandleDirection","groupDisplayType","treeDataDisplayType","colResizeDefault","tooltipTrigger","serverSidePivotResultFieldSeparator","columnMenu","tooltipShowMode","grandTotalRow"],ve.OBJECT_PROPERTIES=["components","rowStyle","context","autoGroupColumnDef","localeText","icons","datasource","dragAndDropImageComponentParams","serverSideDatasource","viewportDatasource","groupRowRendererParams","aggFuncs","fullWidthCellRendererParams","defaultColGroupDef","defaultColDef","defaultCsvExportParams","defaultExcelExportParams","columnTypes","rowClassRules","detailCellRendererParams","loadingCellRendererParams","loadingOverlayComponentParams","noRowsOverlayComponentParams","popupParent","statusBar","sideBar","theme","chartThemeOverrides","customChartThemes","chartToolPanelsDef","dataTypeDefinitions","advancedFilterModel","advancedFilterParent","advancedFilterBuilderParams","initialState","autoSizeStrategy","cellSelection","selectionColumnDef"],ve.ARRAY_PROPERTIES=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector"],ve.NUMBER_PROPERTIES=["rowHeight","detailRowHeight","rowBuffer","headerHeight","groupHeaderHeight","groupLockGroupColumns","floatingFiltersHeight","pivotHeaderHeight","pivotGroupHeaderHeight","groupDefaultExpanded","pivotDefaultExpanded","viewportRowModelPageSize","viewportRowModelBufferSize","autoSizePadding","maxBlocksInCache","maxConcurrentDatasourceRequests","tooltipShowDelay","tooltipHideDelay","cacheOverflowSize","paginationPageSize","cacheBlockSize","infiniteInitialRowCount","serverSideInitialRowCount","scrollbarWidth","asyncTransactionWaitMillis","blockLoadDebounceMillis","keepDetailRowsCount","undoRedoCellEditingLimit","cellFlashDelay","cellFadeDelay","cellFlashDuration","cellFadeDuration","tabIndex","pivotMaxGeneratedColumns"],ve.BOOLEAN_PROPERTIES=["suppressMakeColumnVisibleAfterUnGroup","suppressRowClickSelection","suppressCellFocus","suppressHeaderFocus","suppressHorizontalScroll","groupSelectsChildren","alwaysShowHorizontalScroll","alwaysShowVerticalScroll","debug","enableBrowserTooltips","enableCellExpressions","groupIncludeTotalFooter","groupSuppressBlankHeader","suppressMenuHide","suppressRowDeselection","unSortIcon","suppressMultiSort","alwaysMultiSort","singleClickEdit","suppressLoadingOverlay","suppressNoRowsOverlay","suppressAutoSize","skipHeaderOnAutoSize","suppressColumnMoveAnimation","suppressMoveWhenColumnDragging","suppressMovableColumns","suppressFieldDotNotation","enableRangeSelection","enableRangeHandle","enableFillHandle","suppressClearOnFillReduction","deltaSort","suppressTouch","suppressAsyncEvents","allowContextMenuWithControlKey","suppressContextMenu","enableCellChangeFlash","suppressDragLeaveHidesColumns","suppressRowGroupHidesColumns","suppressMiddleClickScrolls","suppressPreventDefaultOnMouseWheel","suppressCopyRowsToClipboard","copyHeadersToClipboard","copyGroupHeadersToClipboard","pivotMode","suppressAggFuncInHeader","suppressColumnVirtualisation","alwaysAggregateAtRootLevel","suppressFocusAfterRefresh","functionsReadOnly","animateRows","groupSelectsFiltered","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","enableRtl","suppressClickEdit","rowDragEntireRow","rowDragManaged","suppressRowDrag","suppressMoveWhenRowDragging","rowDragMultiRow","enableGroupEdit","embedFullWidthRows","suppressPaginationPanel","groupHideOpenParents","groupAllowUnbalanced","pagination","paginationAutoPageSize","suppressScrollOnNewData","suppressScrollWhenPopupsAreOpen","purgeClosedRowNodes","cacheQuickFilter","includeHiddenColumnsInQuickFilter","ensureDomOrder","accentedSort","suppressChangeDetection","valueCache","valueCacheNeverExpires","aggregateOnlyChangedColumns","suppressAnimationFrame","suppressExcelExport","suppressCsvExport","includeHiddenColumnsInAdvancedFilter","suppressMultiRangeSelection","enterNavigatesVerticallyAfterEdit","enterNavigatesVertically","suppressPropertyNamesCheck","rowMultiSelectWithClick","suppressRowHoverHighlight","suppressRowTransform","suppressClipboardPaste","suppressLastEmptyLineOnPaste","enableCharts","suppressMaintainUnsortedOrder","enableCellTextSelection","suppressBrowserResizeObserver","suppressMaxRenderedRowRestriction","excludeChildrenWhenTreeDataFiltering","tooltipMouseTrack","tooltipInteraction","keepDetailRows","paginateChildRows","preventDefaultOnContextMenu","undoRedoCellEditing","allowDragFromColumnsToolPanel","pivotSuppressAutoColumn","suppressExpandablePivotGroups","debounceVerticalScrollbar","detailRowAutoHeight","serverSideSortAllLevels","serverSideEnableClientSideSort","serverSideOnlyRefreshFilteredGroups","serverSideSortOnServer","serverSideFilterOnServer","suppressAggFilteredOnly","showOpenedGroup","suppressClipboardApi","suppressModelUpdateAfterUpdateTransaction","stopEditingWhenCellsLoseFocus","groupMaintainOrder","columnHoverHighlight","readOnlyEdit","suppressRowVirtualisation","enableCellEditingOnBackspace","resetRowDataOnUpdate","removePivotHeaderRowWhenSingleValueColumn","suppressCopySingleCellRanges","suppressGroupRowsSticky","suppressCutToClipboard","suppressServerSideInfiniteScroll","rowGroupPanelSuppressSort","allowShowChangeAfterFilter","enableAdvancedFilter","masterDetail","treeData","suppressGroupMaintainValueType","reactiveCustomComponents","applyQuickFilterBeforePivotOrAgg","suppressServerSideFullWidthLoadingRow","suppressAdvancedFilterEval","loading","maintainColumnOrder","enableStrictPivotColumnOrder","suppressSetFilterByDefault"],ve.OTHER_PROPERTIES=["suppressStickyTotalRow","loadThemeGoogleFonts","rowSelection"],ve.FUNCTION_PROPERTIES=["doesExternalFilterPass","processPivotResultColDef","processPivotResultColGroupDef","getBusinessKeyForNode","isRowSelectable","rowDragText","groupRowRenderer","dragAndDropImageComponent","fullWidthCellRenderer","loadingCellRenderer","loadingOverlayComponent","noRowsOverlayComponent","detailCellRenderer","quickFilterParser","quickFilterMatcher","getLocaleText","isExternalFilterPresent","getRowHeight","getRowClass","getRowStyle","getContextMenuItems","getMainMenuItems","processRowPostCreate","processCellForClipboard","getGroupRowAgg","isFullWidthRow","sendToClipboard","focusGridInnerElement","navigateToNextHeader","tabToNextHeader","navigateToNextCell","tabToNextCell","processCellFromClipboard","getDocument","postProcessPopup","getChildCount","getDataPath","isRowMaster","postSortRows","processHeaderForClipboard","processUnpinnedColumns","processGroupHeaderForClipboard","paginationNumberFormatter","processDataFromClipboard","getServerSideGroupKey","isServerSideGroup","createChartContainer","getChartToolbarItems","fillOperation","isApplyServerSideTransaction","getServerSideGroupLevelParams","isServerSideGroupOpenByDefault","isGroupOpenByDefault","initialGroupOrderComparator","groupIncludeFooter","loadingCellRendererSelector","getRowId","groupAggFiltering","chartMenuItems","groupTotalRow"],ve.ALL_PROPERTIES=[...ve.ARRAY_PROPERTIES,...ve.OBJECT_PROPERTIES,...ve.STRING_PROPERTIES,...ve.NUMBER_PROPERTIES,...ve.FUNCTION_PROPERTIES,...ve.BOOLEAN_PROPERTIES,...ve.OTHER_PROPERTIES];var li=ve,Ie=class{static getCallbackForEvent(e){return!e||e.length<2?e:"on"+e[0].toUpperCase()+e.substring(1)}};Ie.VUE_OMITTED_PROPERTY="AG-VUE-OMITTED-PROPERTY",Ie.PUBLIC_EVENTS=un,Ie.EVENT_CALLBACKS=$l.map(e=>Ie.getCallbackForEvent(e)),Ie.BOOLEAN_PROPERTIES=li.BOOLEAN_PROPERTIES,Ie.ALL_PROPERTIES=li.ALL_PROPERTIES,Ie.ALL_PROPERTIES_AND_CALLBACKS=[...Ie.ALL_PROPERTIES,...Ie.EVENT_CALLBACKS],Ie.ALL_PROPERTIES_AND_CALLBACKS_SET=new Set(Ie.ALL_PROPERTIES_AND_CALLBACKS);var ai=Ie,Vt=class extends b{};function hi(e,t,i){return i&&e.addDestroyFunc(()=>t.destroyBean(i)),i??e}var di=class{constructor(e){this.cssClassStates={},this.getGui=e}addCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach(i=>this.addCssClass(i));if(this.cssClassStates[e]!==!0&&e.length){const i=this.getGui();i&&i.classList.add(e),this.cssClassStates[e]=!0}}removeCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach(i=>this.removeCssClass(i));if(this.cssClassStates[e]!==!1&&e.length){const i=this.getGui();i&&i.classList.remove(e),this.cssClassStates[e]=!1}}containsCssClass(e){const t=this.getGui();return!!t&&t.classList.contains(e)}addOrRemoveCssClass(e,t){if(e){if(e.indexOf(" ")>=0){const i=(e||"").split(" ");if(i.length>1)return void i.forEach(s=>this.addOrRemoveCssClass(s,t))}if(this.cssClassStates[e]!==t&&e.length){const i=this.getGui();i&&i.classList.toggle(e,t),this.cssClassStates[e]=t}}}};function st(e,t,i){i==null||typeof i=="string"&&i==""?gn(e,t):je(e,t,i)}function je(e,t,i){e.setAttribute(pn(t),i.toString())}function gn(e,t){e.removeAttribute(pn(t))}function pn(e){return`aria-${e}`}function Ve(e,t){t?e.setAttribute("role",t):e.removeAttribute("role")}function Wt(e,t){st(e,"label",t)}function ci(e,t){st(e,"labelledby",t)}function mn(e,t){st(e,"live",t)}function Cn(e,t){st(e,"hidden",t)}function Bi(e,t){je(e,"expanded",t)}function fn(e,t){je(e,"colindex",t)}function Vi(e,t){st(e,"selected",t)}function Ts(e,t){return t===void 0?e("ariaIndeterminate","indeterminate"):t===!0?e("ariaChecked","checked"):e("ariaUnchecked","unchecked")}var vn="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function Is(e){const t=Element.prototype.matches||Element.prototype.msMatchesSelector,i=t.call(e,"input, select, button, textarea"),s=t.call(e,vn),o=qe(e);return i&&!s&&o}function le(e,t,i={}){const{skipAriaHidden:s}=i;e.classList.toggle("ag-hidden",!t),s||Cn(e,!t)}function ui(e,t){const i="disabled",s=t?o=>o.setAttribute(i,""):o=>o.removeAttribute(i);s(e),bn(e.querySelectorAll("input"),o=>s(o))}function zt(e,t,i){let s=0;for(;e;){if(e.classList.contains(t))return!0;if(e=e.parentElement,typeof i=="number"){if(++s>i)break}else if(e===i)break}return!1}function Ft(e){const{height:t,width:i,borderTopWidth:s,borderRightWidth:o,borderBottomWidth:n,borderLeftWidth:r,paddingTop:l,paddingRight:a,paddingBottom:h,paddingLeft:d,marginTop:c,marginRight:u,marginBottom:g,marginLeft:m,boxSizing:f}=window.getComputedStyle(e);return{height:parseFloat(t||"0"),width:parseFloat(i||"0"),borderTopWidth:parseFloat(s||"0"),borderRightWidth:parseFloat(o||"0"),borderBottomWidth:parseFloat(n||"0"),borderLeftWidth:parseFloat(r||"0"),paddingTop:parseFloat(l||"0"),paddingRight:parseFloat(a||"0"),paddingBottom:parseFloat(h||"0"),paddingLeft:parseFloat(d||"0"),marginTop:parseFloat(c||"0"),marginRight:parseFloat(u||"0"),marginBottom:parseFloat(g||"0"),marginLeft:parseFloat(m||"0"),boxSizing:f}}function Ls(e){const t=Ft(e);return t.boxSizing==="border-box"?t.height-t.paddingTop-t.paddingBottom:t.height}function gi(e){const t=Ft(e);return t.boxSizing==="border-box"?t.width-t.paddingLeft-t.paddingRight:t.width}function wn(e){const{height:t,marginBottom:i,marginTop:s}=Ft(e);return Math.floor(t+i+s)}function Wi(e){const{width:t,marginLeft:i,marginRight:s}=Ft(e);return Math.floor(t+i+s)}function Sn(e){const t=e.getBoundingClientRect(),{borderTopWidth:i,borderLeftWidth:s,borderRightWidth:o,borderBottomWidth:n}=Ft(e);return{top:t.top+(i||0),left:t.left+(s||0),right:t.right+(o||0),bottom:t.bottom+(n||0)}}function zi(e,t){let i=e.scrollLeft;return t&&(i=Math.abs(i)),i}function Ui(e,t,i){i&&(t*=-1),e.scrollLeft=t}function xe(e){for(;e&&e.firstChild;)e.removeChild(e.firstChild)}function Pt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function yn(e){return!!e.offsetParent}function qe(e){const t=e;return t.checkVisibility?t.checkVisibility({checkVisibilityCSS:!0}):!(!yn(e)||window.getComputedStyle(e).visibility!=="visible")}function pi(e){const t=document.createElement("div");return t.innerHTML=(e||"").trim(),t.firstChild}function Ki(e,t){t==="flex"?(e.style.removeProperty("width"),e.style.removeProperty("minWidth"),e.style.removeProperty("maxWidth"),e.style.flex="1 1 auto"):We(e,t)}function We(e,t){t=ks(t),e.style.width=t.toString(),e.style.maxWidth=t.toString(),e.style.minWidth=t.toString()}function mi(e,t){t=ks(t),e.style.height=t.toString(),e.style.maxHeight=t.toString(),e.style.minHeight=t.toString()}function ks(e){return typeof e=="number"?`${e}px`:e}function Os(e){return e instanceof Node||e instanceof HTMLElement}function Le(e,t,i){i==null||i===""?e.removeAttribute(t):e.setAttribute(t,i.toString())}function bn(e,t){if(e!=null)for(let i=0;i1),Vs}function Pn(){return!ot()||Rn()>=15}function $s(e){if(!e)return null;const t=e.tabIndex,i=e.getAttribute("tabIndex");return t!==-1||i!==null&&(i!==""||Ks())?t.toString():null}function Dn(){const e=document.body,t=document.createElement("div");t.style.width=t.style.height="100px",t.style.opacity="0",t.style.overflow="scroll",t.style.msOverflowStyle="scrollbar",t.style.position="absolute",e.appendChild(t);let i=t.offsetWidth-t.clientWidth;i===0&&t.clientWidth===0&&(i=null),t.parentNode&&t.parentNode.removeChild(t),i!=null&&(zs=i,Ws=i===0)}function En(){return Ws==null&&Dn(),Ws}var Mn=class Lt extends b{constructor(t,i,s,o){super(),this.parentComp=t,this.tooltipShowDelayOverride=i,this.tooltipHideDelayOverride=s,this.shouldDisplayTooltip=o,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans(t){this.popupService=t.popupService,this.userComponentFactory=t.userComponentFactory}postConstruct(){this.gos.get("tooltipInteraction")&&(this.interactionEnabled=!0),this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");const t=this.parentComp.getGui();this.tooltipTrigger===0&&this.addManagedListeners(t,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)}),this.tooltipTrigger===1&&this.addManagedListeners(t,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)}),this.addManagedListeners(t,{mousemove:this.onMouseMove.bind(this)}),this.interactionEnabled||this.addManagedListeners(t,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay(t){const i=this.gos.get(t);return i<0&&R(`${t} should not be lower than 0`),Math.max(200,i)}getTooltipDelay(t){return t==="show"?this.tooltipShowDelayOverride??this.getGridOptionsTooltipDelay("tooltipShowDelay"):this.tooltipHideDelayOverride??this.getGridOptionsTooltipDelay("tooltipHideDelay")}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){const t=this.gos.get("tooltipTrigger");return t&&t!=="hover"?1:0}onMouseEnter(t){this.interactionEnabled&&this.interactiveTooltipTimeoutId&&(this.unlockService(),this.startHideTimeout()),ct()||(Lt.isLocked?this.showTooltipTimeoutId=window.setTimeout(()=>{this.prepareToShowTooltip(t)},100):this.prepareToShowTooltip(t))}onMouseMove(t){this.lastMouseEvent&&(this.lastMouseEvent=t),this.tooltipMouseTrack&&this.state===2&&this.tooltipComp&&this.positionTooltip()}onMouseDown(){this.setToDoNothing()}onMouseLeave(){this.interactionEnabled?this.lockService():this.setToDoNothing()}onFocusIn(){this.prepareToShowTooltip()}onFocusOut(t){var n;const i=t.relatedTarget,s=this.parentComp.getGui(),o=(n=this.tooltipComp)==null?void 0:n.getGui();this.isInteractingWithTooltip||s.contains(i)||this.interactionEnabled&&(o!=null&&o.contains(i))||this.setToDoNothing()}onKeyDown(){this.isInteractingWithTooltip&&(this.isInteractingWithTooltip=!1),this.setToDoNothing()}prepareToShowTooltip(t){if(this.state!=0||Lt.isLocked)return;let i=0;t&&(i=this.isLastTooltipHiddenRecently()?200:this.getTooltipDelay("show")),this.lastMouseEvent=t||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),i),this.state=1}isLastTooltipHiddenRecently(){return new Date().getTime()-Lt.lastTooltipHideTime<1e3}setToDoNothing(t){t||this.state!==2||this.hideTooltip(),this.onBodyScrollEventCallback&&(this.onBodyScrollEventCallback(),this.onBodyScrollEventCallback=void 0),this.onColumnMovedEventCallback&&(this.onColumnMovedEventCallback(),this.onColumnMovedEventCallback=void 0),this.onDocumentKeyDownCallback&&(this.onDocumentKeyDownCallback(),this.onDocumentKeyDownCallback=void 0),this.clearTimeouts(),this.state=0,this.lastMouseEvent=null}showTooltip(){const t={...this.parentComp.getTooltipParams()};if(!M(t.value)||this.shouldDisplayTooltip&&!this.shouldDisplayTooltip())return void this.setToDoNothing();this.state=2,this.tooltipInstanceCount++;const i=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.userComponentFactory.getTooltipCompDetails(t).newAgStackInstance().then(i)}hideTooltip(t){!t&&this.isInteractingWithTooltip||(this.tooltipComp&&(this.destroyTooltipComp(),Lt.lastTooltipHideTime=new Date().getTime()),this.eventService.dispatchEvent({type:"tooltipHide",parentGui:this.parentComp.getGui()}),t&&(this.isInteractingWithTooltip=!1),this.setToDoNothing(!0))}newTooltipComponentCallback(t,i){if(this.state!==2||this.tooltipInstanceCount!==t)return void this.destroyBean(i);const s=i.getGui();this.tooltipComp=i,s.classList.contains("ag-tooltip")||s.classList.add("ag-tooltip-custom"),this.tooltipTrigger===0&&s.classList.add("ag-tooltip-animate"),this.interactionEnabled&&s.classList.add("ag-tooltip-interactive");const o=this.localeService.getLocaleTextFunc(),n=this.popupService.addPopup({eChild:s,ariaLabel:o("ariaLabelTooltip","Tooltip")});if(n&&(this.tooltipPopupDestroyFunc=n.hideFunc),this.positionTooltip(),this.tooltipTrigger===1){const r=()=>this.setToDoNothing();[this.onBodyScrollEventCallback,this.onColumnMovedEventCallback]=this.addManagedEventListeners({bodyScroll:r,columnMoved:r})}this.interactionEnabled&&([this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener]=this.addManagedElementListeners(s,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(ae(this.gos),{keydown:r=>{s.contains(r==null?void 0:r.target)||this.onKeyDown()}}),this.tooltipTrigger===1&&([this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(s,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)}))),this.eventService.dispatchEvent({type:"tooltipShow",tooltipGui:s,parentGui:this.parentComp.getGui()}),this.startHideTimeout()}onTooltipMouseEnter(){this.isInteractingWithTooltip=!0,this.unlockService()}onTooltipMouseLeave(){this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,this.lockService())}onTooltipFocusIn(){this.isInteractingWithTooltip=!0}isTooltipFocused(){var s;const t=(s=this.tooltipComp)==null?void 0:s.getGui(),i=re(this.gos);return!!t&&t.contains(i)}onTooltipFocusOut(t){const i=this.parentComp.getGui();this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,i.contains(t.relatedTarget)?this.startHideTimeout():this.hideTooltip())}positionTooltip(){const t={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};this.lastMouseEvent?this.popupService.positionPopupUnderMouseEvent({...t,mouseEvent:this.lastMouseEvent}):this.popupService.positionPopupByComponent({...t,eventSource:this.parentComp.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");const t=this.tooltipPopupDestroyFunc,i=this.tooltipComp,s=this.tooltipTrigger===0?1e3:0;window.setTimeout(()=>{t(),this.destroyBean(i)},s),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener].forEach(t=>{t&&t()}),this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){Lt.isLocked=!0,this.interactiveTooltipTimeoutId=window.setTimeout(()=>{this.unlockService(),this.setToDoNothing()},100)}unlockService(){Lt.isLocked=!1,this.clearInteractiveTimeout()}startHideTimeout(){this.clearHideTimeout(),this.hideTooltipTimeoutId=window.setTimeout(this.hideTooltip.bind(this),this.getTooltipDelay("hide"))}clearShowTimeout(){this.showTooltipTimeoutId&&(window.clearTimeout(this.showTooltipTimeoutId),this.showTooltipTimeoutId=void 0)}clearHideTimeout(){this.hideTooltipTimeoutId&&(window.clearTimeout(this.hideTooltipTimeoutId),this.hideTooltipTimeoutId=void 0)}clearInteractiveTimeout(){this.interactiveTooltipTimeoutId&&(window.clearTimeout(this.interactiveTooltipTimeoutId),this.interactiveTooltipTimeoutId=void 0)}clearTimeouts(){this.clearShowTimeout(),this.clearHideTimeout(),this.clearInteractiveTimeout()}};Mn.isLocked=!1;var jl=Mn,Kt=class extends b{constructor(e,t){super(),this.ctrl=e,t&&(this.beans=t)}wireBeans(e){this.beans=e}postConstruct(){this.refreshToolTip()}setBrowserTooltip(e){const t="title",i=this.ctrl.getGui();i&&(e!=null&&e!=""?i.setAttribute(t,e):i.removeAttribute(t))}updateTooltipText(){this.tooltip=this.ctrl.getTooltipValue()}createTooltipFeatureIfNeeded(){var t,i,s,o;if(this.tooltipManager!=null)return;const e={getTooltipParams:()=>this.getTooltipParams(),getGui:()=>this.ctrl.getGui()};this.tooltipManager=this.createBean(new jl(e,(i=(t=this.ctrl).getTooltipShowDelayOverride)==null?void 0:i.call(t),(o=(s=this.ctrl).getTooltipHideDelayOverride)==null?void 0:o.call(s),this.ctrl.shouldDisplayTooltip),this.beans.context)}refreshToolTip(){this.browserTooltips=this.beans.gos.get("enableBrowserTooltips"),this.updateTooltipText(),this.browserTooltips?(this.setBrowserTooltip(this.tooltip),this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context))):(this.setBrowserTooltip(null),this.createTooltipFeatureIfNeeded())}getTooltipParams(){var o,n,r,l,a;const e=this.ctrl,t=(o=e.getColumn)==null?void 0:o.call(e),i=(n=e.getColDef)==null?void 0:n.call(e),s=(r=e.getRowNode)==null?void 0:r.call(e);return{location:e.getLocation(),colDef:i,column:t,rowIndex:(l=e.getRowIndex)==null?void 0:l.call(e),node:s,data:s==null?void 0:s.data,value:this.getTooltipText(),valueFormatted:(a=e.getValueFormatted)==null?void 0:a.call(e),hideTooltipCallback:()=>{var h;return(h=this.tooltipManager)==null?void 0:h.hideTooltip(!0)}}}getTooltipText(){return this.tooltip}destroy(){this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context)),super.destroy()}},ql=new Ut,O=null,ee=class hl extends b{constructor(t,i){super(),this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=ql.next(),this.cssClassManager=new di(()=>this.eGui),this.componentSelectors=new Map((i??[]).map(s=>[s.selector,s])),t&&this.setTemplate(t)}preWireBeans(t){super.preWireBeans(t)}preConstruct(){this.usingBrowserTooltips=this.gos.get("enableBrowserTooltips"),this.wireTemplate(this.getGui())}wireTemplate(t,i){t&&this.gos&&(this.applyElementsToComponent(t),this.createChildComponentsFromTags(t,i))}getCompId(){return this.compId}getTooltipParams(){return{value:this.tooltipText,location:"UNKNOWN"}}setTooltip(t){const{newTooltipText:i,showDelayOverride:s,hideDelayOverride:o,location:n,shouldDisplayTooltip:r}=t||{};this.tooltipFeature&&(this.tooltipFeature=this.destroyBean(this.tooltipFeature)),this.tooltipText!==i&&(this.tooltipText=i);const l=()=>this.tooltipText;i!=null&&(this.tooltipFeature=this.createBean(new Kt({getTooltipValue:l,getGui:()=>this.getGui(),getLocation:()=>n??"UNKNOWN",getColDef:t==null?void 0:t.getColDef,getColumn:t==null?void 0:t.getColumn,getTooltipShowDelayOverride:s!=null?()=>s:void 0,getTooltipHideDelayOverride:o!=null?()=>o:void 0,shouldDisplayTooltip:r})))}getDataRefAttribute(t){return t.getAttribute?t.getAttribute("data-ref"):null}applyElementsToComponent(t,i,s,o=null){if(i===void 0&&(i=this.getDataRefAttribute(t)),i){const n=this[i];if(n===O)this[i]=o??t;else{const r=s&&s[i];this.suppressDataRefValidation||r||R(`Issue with data-ref: ${i} on ${this.constructor.name} with ${n}`)}}}createChildComponentsFromTags(t,i){(function(s){if(s==null)return[];const o=[];return bn(s,n=>o.push(n)),o})(t.childNodes).forEach(s=>{if(!(s instanceof HTMLElement))return;const o=this.createComponentFromElement(s,n=>{n.getGui()&&this.copyAttributesFromNode(s,n.getGui())},i);if(o){if(o.addItems&&s.children.length){this.createChildComponentsFromTags(s,i);const n=Array.prototype.slice.call(s.children);o.addItems(n)}this.swapComponentForNode(o,t,s)}else s.childNodes&&this.createChildComponentsFromTags(s,i)})}createComponentFromElement(t,i,s){const o=t.nodeName,n=this.getDataRefAttribute(t),r=o.indexOf("AG-")===0,l=r?this.componentSelectors.get(o):null;let a=null;if(l){hl.elementGettingCreated=t;const h=s&&n?s[n]:void 0;a=new l.component(h),a.setParentComponent(this),this.createBean(a,null,i)}else r&&R(`Missing selector: ${o}`);return this.applyElementsToComponent(t,n,s,a),a}copyAttributesFromNode(t,i){(function(s,o){if(s)for(let n=0;ni.setAttribute(s,o))}swapComponentForNode(t,i,s){const o=t.getGui();i.replaceChild(o,s),i.insertBefore(document.createComment(s.nodeName),o),this.addDestroyFunc(this.destroyBean.bind(this,t))}activateTabIndex(t){const i=this.gos.get("tabIndex");t||(t=[]),t.length||t.push(this.getGui()),t.forEach(s=>s.setAttribute("tabindex",i.toString()))}setTemplate(t,i,s){const o=pi(t);this.setTemplateFromElement(o,i,s)}setTemplateFromElement(t,i,s,o=!1){if(this.eGui=t,this.suppressDataRefValidation=o,i)for(let n=0;nthis.eGui.removeEventListener(t,i))}addCssClass(t){this.cssClassManager.addCssClass(t)}removeCssClass(t){this.cssClassManager.removeCssClass(t)}containsCssClass(t){return this.cssClassManager.containsCssClass(t)}addOrRemoveCssClass(t,i){this.cssClassManager.addOrRemoveCssClass(t,i)}},xn={columnGroupOpened:"expanded",columnGroupClosed:"contracted",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate",columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",groupContracted:"tree-closed",groupExpanded:"tree-open",setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",chart:"chart",close:"cross",cancel:"cancel",check:"tick",first:"first",previous:"previous",next:"next",last:"last",linked:"linked",unlinked:"unlinked",colorPicker:"color-picker",groupLoading:"loading",menu:"menu",menuAlt:"menu-alt",filter:"filter",columns:"columns",maximize:"maximize",minimize:"minimize",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnDrag:"grip",rowDrag:"grip",save:"save",csvExport:"csv",excelExport:"excel",smallDown:"small-down",smallLeft:"small-left",smallRight:"small-right",smallUp:"small-up",sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",checkboxChecked:"checkbox-checked",checkboxIndeterminate:"checkbox-indeterminate",checkboxUnchecked:"checkbox-unchecked",radioButtonOn:"radio-button-on",radioButtonOff:"radio-button-off"},Ql=(()=>{const e=new Set(Object.values(xn));return e.add("eye"),e})();function Ae(e,t,i,s){let o=null;const n=i&&i.getColDef().icons;if(n&&(o=n[e]),t&&!o){const r=t.get("icons");r&&(o=r[e])}if(!o){const r=document.createElement("span");let l=xn[e]??(Ql.has(e)?e:void 0);return l||(R(`Did not find icon ${e}`),l=""),r.setAttribute("class",`ag-icon ag-icon-${l}`),r.setAttribute("unselectable","on"),Ve(r,"presentation"),r}{let r;if(typeof o=="function")r=o();else{if(typeof o!="string")throw new Error("icon from grid options needs to be a string or a function");r=o}if(typeof r=="string")return pi(r);if(Os(r))return r;R("iconRenderer should return back a string or a dom object")}}var Yl=class extends ee{constructor(){super(...arguments),this.dragSource=null,this.eIcon=O,this.eLabel=O}postConstruct(){const e=t=>function(i,s,o){const n=Ae(i,s,o);if(n){const{className:l}=n;if(typeof l=="string"&&l.indexOf("ag-icon")>-1||typeof l=="object"&&l["ag-icon"])return n}const r=document.createElement("span");return r.appendChild(n),r}(t,this.gos,null);this.dropIconMap={pinned:e("columnMovePin"),hide:e("columnMoveHide"),move:e("columnMoveMove"),left:e("columnMoveLeft"),right:e("columnMoveRight"),group:e("columnMoveGroup"),aggregate:e("columnMoveValue"),pivot:e("columnMovePivot"),notAllowed:e("dropNotAllowed")}}init(e){this.dragSource=e.dragSource,this.setTemplate(`
+ +
+
`)}destroy(){this.dragSource=null,super.destroy()}setIcon(e,t=!1){var s,o;xe(this.eIcon);let i=null;e||(e=(s=this.dragSource)!=null&&s.getDefaultIconName?(o=this.dragSource)==null?void 0:o.getDefaultIconName():"notAllowed"),i=this.dropIconMap[e],this.eIcon.classList.toggle("ag-shake-left-to-right",t),i===this.dropIconMap.hide&&this.gos.get("suppressDragLeaveHidesColumns")||i&&this.eIcon.appendChild(i)}setLabel(e){this.eLabel.textContent=_e(e)}};function An(e,t,i){if(i===0)return!1;const s=Math.abs(e.clientX-t.clientX),o=Math.abs(e.clientY-t.clientY);return Math.max(s,o)<=i}var ut=class{constructor(e,t=!1){this.DOUBLE_TAP_MILLIS=500,this.destroyFuncs=[],this.touching=!1,this.localEventService=new Ot,this.eElement=e,this.preventMouseClick=t;const i=this.onTouchStart.bind(this),s=this.onTouchMove.bind(this),o=this.onTouchEnd.bind(this);this.eElement.addEventListener("touchstart",i,{passive:!0}),this.eElement.addEventListener("touchmove",s,{passive:!0}),this.eElement.addEventListener("touchend",o,{passive:!1}),this.destroyFuncs.push(()=>{this.eElement.removeEventListener("touchstart",i,{passive:!0}),this.eElement.removeEventListener("touchmove",s,{passive:!0}),this.eElement.removeEventListener("touchend",o,{passive:!1})})}getActiveTouch(e){for(let t=0;t{const i=this.touchStart===t;if(this.touching&&i&&!this.moved){this.moved=!0;const s={type:"longTap",touchStart:this.touchStart,touchEvent:e};this.localEventService.dispatchEvent(s)}},500)}onTouchMove(e){if(!this.touching)return;const t=this.getActiveTouch(e.touches);t&&!An(t,this.touchStart,4)&&(this.moved=!0)}onTouchEnd(e){if(this.touching){if(!this.moved){const t={type:"tap",touchStart:this.touchStart};this.localEventService.dispatchEvent(t),this.checkForDoubleTap()}this.preventMouseClick&&e.cancelable&&e.preventDefault(),this.touching=!1}}checkForDoubleTap(){const e=new Date().getTime();if(this.lastTapTime&&this.lastTapTime>0)if(e-this.lastTapTime>this.DOUBLE_TAP_MILLIS){const t={type:"doubleTap",touchStart:this.touchStart};this.localEventService.dispatchEvent(t),this.lastTapTime=null}else this.lastTapTime=e;else this.lastTapTime=e}destroy(){this.destroyFuncs.forEach(e=>e())}};function Ci(e,t){return``}var Xl=` + ${Ci("Order","order")} + ${Ci("Asc","ascending-icon")} + ${Ci("Desc","descending-icon")} + ${Ci("Mixed","mixed-icon")} + ${Ci("None","none-icon")} + `,_s=class extends ee{constructor(e){super(),this.eSortOrder=O,this.eSortAsc=O,this.eSortDesc=O,this.eSortMixed=O,this.eSortNone=O,e||this.setTemplate(Xl)}wireBeans(e){this.sortController=e.sortController}attachCustomElements(e,t,i,s,o){this.eSortOrder=e,this.eSortAsc=t,this.eSortDesc=i,this.eSortMixed=s,this.eSortNone=o}setupSort(e,t=!1){if(this.column=e,this.suppressOrder=t,this.setupMultiSortIndicator(),!this.column.isSortable()&&!this.column.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,e),this.addInIcon("sortDescending",this.eSortDesc,e),this.addInIcon("sortUnSort",this.eSortNone,e);const i=this.updateIcons.bind(this),s=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",i),this.addManagedEventListeners({newColumnsLoaded:i,sortChanged:s,columnRowGroupChanged:s}),this.onSortChanged()}addInIcon(e,t,i){if(t==null)return;const s=Ae(e,this.gos,i);s&&t.appendChild(s)}onSortChanged(){this.updateIcons(),this.suppressOrder||this.updateSortOrder()}updateIcons(){const e=this.sortController.getDisplaySortForColumn(this.column);if(this.eSortAsc){const t=e==="asc";le(this.eSortAsc,t,{skipAriaHidden:!0})}if(this.eSortDesc){const t=e==="desc";le(this.eSortDesc,t,{skipAriaHidden:!0})}if(this.eSortNone){const t=!this.column.getColDef().unSortIcon&&!this.gos.get("unSortIcon"),i=e==null;le(this.eSortNone,!t&&i,{skipAriaHidden:!0})}}setupMultiSortIndicator(){this.addInIcon("sortUnSort",this.eSortMixed,this.column);const e=this.column.getColDef().showRowGroup;$e(this.gos)&&e&&(this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator())}updateMultiSortIndicator(){if(this.eSortMixed){const e=this.sortController.getDisplaySortForColumn(this.column)==="mixed";le(this.eSortMixed,e,{skipAriaHidden:!0})}}updateSortOrder(){if(!this.eSortOrder)return;const e=this.sortController.getColumnsWithSortingOrdered(),t=this.sortController.getDisplaySortIndexForColumn(this.column)??-1,i=e.some(o=>this.sortController.getDisplaySortIndexForColumn(o)??!1),s=t>=0&&i;le(this.eSortOrder,s,{skipAriaHidden:!0}),t>=0?this.eSortOrder.textContent=(t+1).toString():xe(this.eSortOrder)}},Jl={selector:"AG-SORT-INDICATOR",component:_s},js=class extends ee{constructor(){super(...arguments),this.eFilter=O,this.eFilterButton=O,this.eSortIndicator=O,this.eMenu=O,this.eLabel=O,this.eText=O,this.eSortOrder=O,this.eSortAsc=O,this.eSortDesc=O,this.eSortMixed=O,this.eSortNone=O,this.lastMovingChanged=0}wireBeans(e){this.sortController=e.sortController,this.menuService=e.menuService,this.funcColsService=e.funcColsService}destroy(){super.destroy()}refresh(e){const t=this.params;return this.params=e,this.workOutTemplate()==this.currentTemplate&&this.workOutShowMenu()==this.currentShowMenu&&this.workOutSort()==this.currentSort&&this.shouldSuppressMenuHide()==this.currentSuppressMenuHide&&t.enableFilterButton==e.enableFilterButton&&t.enableFilterIcon==e.enableFilterIcon&&(this.setDisplayName(e),!0)}workOutTemplate(){let e=this.params.template??``;return e=e&&e.trim?e.trim():e,e}init(e){this.params=e,this.currentTemplate=this.workOutTemplate(),this.setTemplate(this.currentTemplate,[Jl]),this.setupTap(),this.setMenu(),this.setupSort(),this.setupFilterIcon(),this.setupFilterButton(),this.setDisplayName(e)}setDisplayName(e){if(this.currentDisplayName!=e.displayName){this.currentDisplayName=e.displayName;const t=_e(this.currentDisplayName,!0);this.eText&&(this.eText.textContent=t)}}addInIcon(e,t,i){if(t==null)return;const s=Ae(e,this.gos,i);s&&t.appendChild(s)}setupTap(){const{gos:e}=this;if(e.get("suppressTouch"))return;const t=new ut(this.getGui(),!0),i=this.shouldSuppressMenuHide(),s=i&&M(this.eMenu),o=s?new ut(this.eMenu,!0):t;if(this.params.enableMenu){const n=s?"tap":"longTap",r=l=>this.params.showColumnMenuAfterMouseClick(l.touchStart);this.addManagedListeners(o,{[n]:r})}if(this.params.enableSorting){const n=r=>{var a,h;const l=r.touchStart.target;i&&((a=this.eMenu)!=null&&a.contains(l)||(h=this.eFilterButton)!=null&&h.contains(l))||this.sortController.progressSort(this.params.column,!1,"uiColumnSorted")};this.addManagedListeners(t,{tap:n})}if(this.params.enableFilterButton){const n=new ut(this.eFilterButton,!0);this.addManagedListeners(n,{tap:()=>this.params.showFilter(this.eFilterButton)}),this.addDestroyFunc(()=>n.destroy())}this.addDestroyFunc(()=>t.destroy()),s&&this.addDestroyFunc(()=>o.destroy())}workOutShowMenu(){return this.params.enableMenu&&this.menuService.isHeaderMenuButtonEnabled()}shouldSuppressMenuHide(){return this.menuService.isHeaderMenuButtonAlwaysShowEnabled()}setMenu(){if(!this.eMenu)return;if(this.currentShowMenu=this.workOutShowMenu(),!this.currentShowMenu)return Pt(this.eMenu),void(this.eMenu=void 0);const e=this.menuService.isLegacyMenuEnabled();this.addInIcon(e?"menu":"menuAlt",this.eMenu,this.params.column),this.eMenu.classList.toggle("ag-header-menu-icon",!e),this.currentSuppressMenuHide=this.shouldSuppressMenuHide(),this.addManagedElementListeners(this.eMenu,{click:()=>this.params.showColumnMenu(this.eMenu)}),this.eMenu.classList.toggle("ag-header-menu-always-show",this.currentSuppressMenuHide)}onMenuKeyboardShortcut(e){const t=this.params.column,i=this.menuService.isLegacyMenuEnabled();if(e&&!i){if(this.menuService.isFilterMenuInHeaderEnabled(t))return this.params.showFilter(this.eFilterButton??this.eMenu??this.getGui()),!0}else if(this.params.enableMenu)return this.params.showColumnMenu(this.eMenu??this.eFilterButton??this.getGui()),!0;return!1}workOutSort(){return this.params.enableSorting}setupSort(){if(this.currentSort=this.params.enableSorting,this.eSortIndicator||(this.eSortIndicator=this.createBean(new _s(!0)),this.eSortIndicator.attachCustomElements(this.eSortOrder,this.eSortAsc,this.eSortDesc,this.eSortMixed,this.eSortNone)),this.eSortIndicator.setupSort(this.params.column),!this.currentSort)return;this.addManagedListeners(this.params.column,{movingChanged:()=>{this.lastMovingChanged=new Date().getTime()}}),this.eLabel&&this.addManagedElementListeners(this.eLabel,{click:t=>{const i=this.params.column.isMoving(),s=new Date().getTime()-this.lastMovingChanged<50;if(!(i||s)){const o=this.gos.get("multiSortKey")==="ctrl"?t.ctrlKey||t.metaKey:t.shiftKey;this.params.progressSort(o)}}});const e=()=>{const t=this.params.column.getSort();if(this.addOrRemoveCssClass("ag-header-cell-sorted-asc",t==="asc"),this.addOrRemoveCssClass("ag-header-cell-sorted-desc",t==="desc"),this.addOrRemoveCssClass("ag-header-cell-sorted-none",!t),this.params.column.getColDef().showRowGroup){const i=this.funcColsService.getSourceColumnsForGroupColumn(this.params.column),s=i==null?void 0:i.every(n=>this.params.column.getSort()==n.getSort()),o=!s;this.addOrRemoveCssClass("ag-header-cell-sorted-mixed",o)}};this.addManagedEventListeners({sortChanged:e,columnRowGroupChanged:e})}setupFilterIcon(){this.eFilter&&this.configureFilter(this.params.enableFilterIcon,this.eFilter,this.onFilterChangedIcon.bind(this))}setupFilterButton(){this.eFilterButton&&(this.configureFilter(this.params.enableFilterButton,this.eFilterButton,this.onFilterChangedButton.bind(this))?this.addManagedElementListeners(this.eFilterButton,{click:()=>this.params.showFilter(this.eFilterButton)}):this.eFilterButton=void 0)}configureFilter(e,t,i){if(!e)return Pt(t),!1;const s=this.params.column;return this.addInIcon("filter",t,s),this.addManagedListeners(s,{filterChanged:i}),i(),!0}onFilterChangedIcon(){const e=this.params.column.isFilterActive();le(this.eFilter,e,{skipAriaHidden:!0})}onFilterChangedButton(){const e=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",e)}getAnchorElementForMenu(e){return e?this.eFilterButton??this.eMenu??this.getGui():this.eMenu??this.eFilterButton??this.getGui()}},Zl=class extends ee{constructor(){super(``),this.agOpened=O,this.agClosed=O,this.agLabel=O}wireBeans(e){this.columnModel=e.columnModel}destroy(){super.destroy()}init(e){this.params=e,this.checkWarnings(),this.setupLabel(),this.addGroupExpandIcon(),this.setupExpandIcons()}checkWarnings(){this.params.template&&R("A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)")}setupExpandIcons(){this.addInIcon("columnGroupOpened",this.agOpened),this.addInIcon("columnGroupClosed",this.agClosed);const e=o=>{if(et(o))return;const n=!this.params.columnGroup.isExpanded();this.columnModel.setColumnGroupOpened(this.params.columnGroup.getProvidedColumnGroup(),n,"uiColumnExpanded")};this.addTouchAndClickListeners(this.agClosed,e),this.addTouchAndClickListeners(this.agOpened,e);const t=o=>{Bt(o)};this.addManagedElementListeners(this.agClosed,{dblclick:t}),this.addManagedElementListeners(this.agOpened,{dblclick:t}),this.addManagedElementListeners(this.getGui(),{dblclick:e}),this.updateIconVisibility();const i=this.params.columnGroup.getProvidedColumnGroup(),s=this.updateIconVisibility.bind(this);this.addManagedListeners(i,{expandedChanged:s,expandableChanged:s})}addTouchAndClickListeners(e,t){const i=new ut(e,!0);this.addManagedListeners(i,{tap:t}),this.addDestroyFunc(()=>i.destroy()),this.addManagedElementListeners(e,{click:t})}updateIconVisibility(){if(this.params.columnGroup.isExpandable()){const e=this.params.columnGroup.isExpanded();le(this.agOpened,e),le(this.agClosed,!e)}else le(this.agOpened,!1),le(this.agClosed,!1)}addInIcon(e,t){const i=Ae(e,this.gos,null);i&&t.appendChild(i)}addGroupExpandIcon(){if(!this.params.columnGroup.isExpandable())return le(this.agOpened,!1),void le(this.agClosed,!1)}setupLabel(){var i;const{displayName:e,columnGroup:t}=this.params;if(M(e)){const s=_e(e,!0);this.agLabel.textContent=s}this.addOrRemoveCssClass("ag-sticky-label",!((i=t.getColGroupDef())!=null&&i.suppressStickyLabel))}},ea=class extends ee{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-change-delta");const i=document.createElement("span");i.setAttribute("class","ag-value-change-value"),e.appendChild(t),e.appendChild(i),this.setTemplateFromElement(e)}wireBeans(e){this.filterManager=e.filterManager}init(e){this.eValue=this.queryForHtmlElement(".ag-value-change-value"),this.eDelta=this.queryForHtmlElement(".ag-value-change-delta"),this.refresh(e,!0)}showDelta(e,t){const i=Math.abs(t),s=e.formatValue(i),o=M(s)?s:i,n=t>=0;this.eDelta.textContent=n?"\u2191"+o:"\u2193"+o,this.eDelta.classList.toggle("ag-value-change-delta-up",n),this.eDelta.classList.toggle("ag-value-change-delta-down",!n)}setTimerToRemoveDelta(){this.refreshCount++;const e=this.refreshCount;this.getFrameworkOverrides().wrapIncoming(()=>{window.setTimeout(()=>{e===this.refreshCount&&this.hideDeltaValue()},2e3)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),xe(this.eDelta)}refresh(e,t=!1){var s;const i=e.value;if(i===this.lastValue||(M(e.valueFormatted)?this.eValue.textContent=e.valueFormatted:M(e.value)?this.eValue.textContent=i:xe(this.eValue),(s=this.filterManager)==null?void 0:s.isSuppressFlashingCellsBecauseFiltering()))return!1;if(typeof i=="number"&&typeof this.lastValue=="number"){const o=i-this.lastValue;this.showDelta(e,o)}return this.lastValue&&this.eValue.classList.add("ag-value-change-value-highlight"),t||this.setTimerToRemoveDelta(),this.lastValue=i,!0}},ta=class extends ee{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-slide-current"),e.appendChild(t),this.setTemplateFromElement(e),this.eCurrent=this.queryForHtmlElement(".ag-value-slide-current")}wireBeans(e){this.filterManager=e.filterManager}init(e){this.refresh(e,!0)}addSlideAnimation(){this.refreshCount++;const e=this.refreshCount;this.ePrevious&&this.getGui().removeChild(this.ePrevious);const t=document.createElement("span");t.setAttribute("class","ag-value-slide-previous ag-value-slide-out"),this.ePrevious=t,this.ePrevious.textContent=this.eCurrent.textContent,this.getGui().insertBefore(this.ePrevious,this.eCurrent),this.getFrameworkOverrides().wrapIncoming(()=>{window.setTimeout(()=>{e===this.refreshCount&&this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{e===this.refreshCount&&(this.getGui().removeChild(this.ePrevious),this.ePrevious=null)},3e3)})}refresh(e,t=!1){var s;let i=e.value;return K(i)&&(i=""),i!==this.lastValue&&!((s=this.filterManager)!=null&&s.isSuppressFlashingCellsBecauseFiltering())&&(t||this.addSlideAnimation(),this.lastValue=i,M(e.valueFormatted)?this.eCurrent.textContent=e.valueFormatted:M(e.value)?this.eCurrent.textContent=i:xe(this.eCurrent),!0)}},y=class{};y.BACKSPACE="Backspace",y.TAB="Tab",y.ENTER="Enter",y.ESCAPE="Escape",y.SPACE=" ",y.LEFT="ArrowLeft",y.UP="ArrowUp",y.RIGHT="ArrowRight",y.DOWN="ArrowDown",y.DELETE="Delete",y.F2="F2",y.PAGE_UP="PageUp",y.PAGE_DOWN="PageDown",y.PAGE_HOME="Home",y.PAGE_END="End",y.A="KeyA",y.C="KeyC",y.D="KeyD",y.V="KeyV",y.X="KeyX",y.Y="KeyY",y.Z="KeyZ";var ia=class extends ee{constructor(e,t,i){super(t,i),this.labelSeparator="",this.labelAlignment="left",this.disabled=!1,this.label="",this.config=e||{}}postConstruct(){this.addCssClass("ag-labeled"),this.eLabel.classList.add("ag-label");const{labelSeparator:e,label:t,labelWidth:i,labelAlignment:s,disabled:o}=this.config;o!=null&&this.setDisabled(o),e!=null&&this.setLabelSeparator(e),t!=null&&this.setLabel(t),i!=null&&this.setLabelWidth(i),this.setLabelAlignment(s||this.labelAlignment),this.refreshLabel()}refreshLabel(){xe(this.eLabel),typeof this.label=="string"?this.eLabel.innerText=this.label+this.labelSeparator:this.label&&this.eLabel.appendChild(this.label),this.label===""?(le(this.eLabel,!1),Ve(this.eLabel,"presentation")):(le(this.eLabel,!0),Ve(this.eLabel,null))}setLabelSeparator(e){return this.labelSeparator===e||(this.labelSeparator=e,this.label!=null&&this.refreshLabel()),this}getLabelId(){return this.eLabel.id=this.eLabel.id||`ag-${this.getCompId()}-label`,this.eLabel.id}getLabel(){return this.label}setLabel(e){return this.label===e||(this.label=e,this.refreshLabel()),this}setLabelAlignment(e){const t=this.getGui().classList;return t.toggle("ag-label-align-left",e==="left"),t.toggle("ag-label-align-right",e==="right"),t.toggle("ag-label-align-top",e==="top"),this}setLabelEllipsis(e){return this.eLabel.classList.toggle("ag-label-ellipsis",e),this}setLabelWidth(e){return this.label==null||Ki(this.eLabel,e),this}setDisabled(e){e=!!e;const t=this.getGui();return ui(t,e),t.classList.toggle("ag-disabled",e),this.disabled=e,this}isDisabled(){return!!this.disabled}},Tn=class extends ia{constructor(e,t,i,s){super(e,t,i),this.className=s}postConstruct(){super.postConstruct();const{width:e,value:t,onValueChange:i}=this.config;e!=null&&this.setWidth(e),t!=null&&this.setValue(t),i!=null&&this.onValueChange(i),this.className&&this.addCssClass(this.className),this.refreshAriaLabelledBy()}setLabel(e){return super.setLabel(e),this.refreshAriaLabelledBy(),this}refreshAriaLabelledBy(){const e=this.getAriaElement(),t=this.getLabelId(),i=this.getLabel();i==null||i==""||e.getAttribute("aria-label")!==null?ci(e,""):ci(e,t??"")}setAriaLabel(e){return Wt(this.getAriaElement(),e),this.refreshAriaLabelledBy(),this}onValueChange(e){return this.addManagedListeners(this,{fieldValueChanged:()=>e(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth(e){return We(this.getGui(),e),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue(e,t){return this.value===e||(this.previousValue=this.value,this.value=e,t||this.dispatchLocalEvent({type:"fieldValueChanged"})),this}},Dt=class extends Tn{constructor(e,t,i="text",s="input"){super(e,(e==null?void 0:e.template)??` +
+
+ +
`,[],t),this.inputType=i,this.displayFieldTag=s,this.eLabel=O,this.eWrapper=O,this.eInput=O}postConstruct(){super.postConstruct(),this.setInputType(),this.eLabel.classList.add(`${this.className}-label`),this.eWrapper.classList.add(`${this.className}-input-wrapper`),this.eInput.classList.add(`${this.className}-input`),this.addCssClass("ag-input-field"),this.eInput.id=this.eInput.id||`ag-${this.getCompId()}-input`;const{inputName:e,inputWidth:t}=this.config;e!=null&&this.setInputName(e),t!=null&&this.setInputWidth(t),this.addInputListeners(),this.activateTabIndex([this.eInput])}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:e=>this.setValue(e.target.value)})}setInputType(){this.displayFieldTag==="input"&&this.eInput.setAttribute("type",this.inputType)}getInputElement(){return this.eInput}setInputWidth(e){return Ki(this.eWrapper,e),this}setInputName(e){return this.getInputElement().setAttribute("name",e),this}getFocusableElement(){return this.eInput}setMaxLength(e){return this.eInput.maxLength=e,this}setInputPlaceholder(e){return Le(this.eInput,"placeholder",e),this}setInputAriaLabel(e){return Wt(this.eInput,e),this.refreshAriaLabelledBy(),this}setDisabled(e){return ui(this.eInput,e),super.setDisabled(e)}setAutoComplete(e){if(e===!0)Le(this.eInput,"autocomplete",null);else{const t=typeof e=="string"?e:"off";Le(this.eInput,"autocomplete",t)}return this}},qs=class extends Dt{constructor(e,t="ag-checkbox",i="checkbox"){super(e,t,i),this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();const{readOnly:e,passive:t}=this.config;typeof e=="boolean"&&this.setReadOnly(e),typeof t=="boolean"&&this.setPassive(t)}addInputListeners(){this.addManagedElementListeners(this.eInput,{click:this.onCheckboxClick.bind(this)}),this.addManagedElementListeners(this.eLabel,{click:this.toggle.bind(this)})}getNextValue(){return this.selected===void 0||!this.selected}setPassive(e){this.passive=e}isReadOnly(){return this.readOnly}setReadOnly(e){this.eWrapper.classList.toggle("ag-disabled",e),this.eInput.disabled=e,this.readOnly=e}setDisabled(e){return this.eWrapper.classList.toggle("ag-disabled",e),super.setDisabled(e)}toggle(){if(this.eInput.disabled)return;const e=this.isSelected(),t=this.getNextValue();this.passive?this.dispatchChange(t,e):this.setValue(t)}getValue(){return this.isSelected()}setValue(e,t){return this.refreshSelectedClass(e),this.setSelected(e,t),this}setName(e){return this.getInputElement().name=e,this}isSelected(){return this.selected}setSelected(e,t){this.isSelected()!==e&&(this.previousValue=this.isSelected(),e=this.selected=typeof e=="boolean"?e:void 0,this.eInput.checked=e,this.eInput.indeterminate=e===void 0,t||this.dispatchChange(this.selected,this.previousValue))}dispatchChange(e,t,i){this.dispatchLocalEvent({type:"fieldValueChanged",selected:e,previousValue:t,event:i});const s=this.getInputElement();this.eventService.dispatchEvent({type:"checkboxChanged",id:s.id,name:s.name,selected:e,previousValue:t})}onCheckboxClick(e){if(this.passive||this.eInput.disabled)return;const t=this.isSelected(),i=this.selected=e.target.checked;this.refreshSelectedClass(i),this.dispatchChange(i,t,e)}refreshSelectedClass(e){this.eWrapper.classList.toggle("ag-checked",e===!0),this.eWrapper.classList.toggle("ag-indeterminate",e==null)}},Qs={selector:"AG-CHECKBOX",component:qs},sa=class extends ee{constructor(){super(` + `,[Qs]),this.eCheckbox=O}init(e){this.refresh(e);const t=this.eCheckbox.getInputElement();t.setAttribute("tabindex","-1"),mn(t,"polite"),this.addManagedListeners(t,{click:i=>{if(Bt(i),this.eCheckbox.isDisabled())return;const s=this.eCheckbox.getValue();this.onCheckboxChanged(s)},dblclick:i=>{Bt(i)}}),this.addManagedElementListeners(this.params.eGridCell,{keydown:i=>{if(i.key===y.SPACE&&!this.eCheckbox.isDisabled()){this.params.eGridCell===re(this.gos)&&this.eCheckbox.toggle();const s=this.eCheckbox.getValue();this.onCheckboxChanged(s),i.preventDefault()}}})}refresh(e){return this.params=e,this.updateCheckbox(e),!0}updateCheckbox(e){var l;let t,i=!0;if(e.node.group&&e.column)if(typeof e.value=="boolean")t=e.value;else{const a=e.column.getColId();a.startsWith(Ni)?t=e.value==null||e.value===""?void 0:e.value==="true":e.node.aggData&&e.node.aggData[a]!==void 0?t=e.value??void 0:i=!1}else t=e.value??void 0;if(!i)return void this.eCheckbox.setDisplayed(!1);this.eCheckbox.setValue(t);const s=e.disabled!=null?e.disabled:!((l=e.column)!=null&&l.isCellEditable(e.node));this.eCheckbox.setDisabled(s);const o=this.localeService.getLocaleTextFunc(),n=Ts(o,t),r=s?n:`${o("ariaToggleCellValue","Press SPACE to toggle cell value")} (${n})`;this.eCheckbox.setInputAriaLabel(r)}onCheckboxChanged(e){const{column:t,node:i,value:s}=this.params;this.eventService.dispatchEvent({type:"cellEditingStarted",column:t,colDef:t==null?void 0:t.getColDef(),data:i.data,node:i,rowIndex:i.rowIndex,rowPinned:i.rowPinned,value:s});const o=this.params.node.setDataValue(this.params.column,e,"edit");this.eventService.dispatchEvent({type:"cellEditingStopped",column:t,colDef:t==null?void 0:t.getColDef(),data:i.data,node:i,rowIndex:i.rowIndex,rowPinned:i.rowPinned,value:s,oldValue:s,newValue:e,valueChanged:o}),o||this.updateCheckbox(this.params)}},oa=class extends ee{constructor(){super(`
+ + +
`),this.eLoadingIcon=O,this.eLoadingText=O}init(e){e.node.failedLoad?this.setupFailed():this.setupLoading()}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=e("loadingError","ERR")}setupLoading(){const e=Ae("groupLoading",this.gos,null);e&&this.eLoadingIcon.appendChild(e);const t=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=t("loadingOoo","Loading")}refresh(e){return!1}destroy(){super.destroy()}},na=class extends ee{constructor(){super('
')}init(e){const t=`ag-cell-skeleton-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",t),this.addDestroyFunc(()=>ci(e.eParentOfValue)),ci(e.eParentOfValue,t),e.node.failedLoad?this.setupFailed():this.setupLoading(e)}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.getGui().innerText=e("loadingError","ERR");const t=e("ariaSkeletonCellLoadingFailed","Row failed to load");Wt(this.getGui(),t)}setupLoading(e){const t=ae(this.gos).createElement("div");t.classList.add("ag-skeleton-effect");const i=e.node.rowIndex;if(i!=null){const o=75+25*(i%2==0?Math.sin(i):Math.cos(i));t.style.width=`${o}%`}this.getGui().appendChild(t);const s=this.localeService.getLocaleTextFunc()("ariaSkeletonCellLoading","Row data is loading");Wt(this.getGui(),s)}refresh(e){return!1}destroy(){super.destroy()}},In=class extends ee{constructor(){super()}destroy(){super.destroy()}},ra=class extends In{init(){var t;const e=Je((t=this.gos.get("overlayLoadingTemplate"))==null?void 0:t.trim());if(this.setTemplate(e??''),!e){const i=this.localeService.getLocaleTextFunc();setTimeout(()=>{this.getGui().textContent=i("loadingOoo","Loading...")})}}},la=class extends In{init(){var t;const e=Je((t=this.gos.get("overlayNoRowsTemplate"))==null?void 0:t.trim());if(this.setTemplate(e??''),!e){const i=this.localeService.getLocaleTextFunc();setTimeout(()=>{this.getGui().textContent=i("noRowsToShow","No Rows To Show")})}}},$t=class extends ee{isPopup(){return!0}setParentComponent(e){e.addCssClass("ag-has-popup"),super.setParentComponent(e)}destroy(){const e=this.parentComponent;e&&e.isAlive()&&e.getGui().classList.remove("ag-has-popup"),super.destroy()}},aa=class extends $t{constructor(){super('
')}init(e){const{value:t}=e;this.getGui().textContent=_e(t,!0)}};function Ln(e){const{inputValue:t,allSuggestions:i,hideIrrelevant:s,filterByPercentageOfBestMatch:o,addSequentialWeight:n}=e;let r=i.map((h,d)=>({value:h,relevance:ha(t.toLowerCase(),h.toLocaleLowerCase(),n),idx:d}));if(r.sort((h,d)=>d.relevance-h.relevance),s&&(r=r.filter(h=>h.relevance!==0)),r.length>0&&o&&o>0){const h=r[0].relevance*o;r=r.filter(d=>h-d.relevance<0)}const l=[],a=[];for(const h of r)l.push(h.value),a.push(h.idx);return{values:l,indices:a}}function ha(e,t,i=!1){const s=e.replace(/\s/g,""),o=t.replace(/\s/g,""),n=s.length,r=o.length,l=new Array(n+1).fill(null).map(()=>new Array(r+1).fill(0));for(let d=0;d<=n;d+=1)l[d][0]=d;for(let d=0;d<=r;d+=1)l[0][d]=d;for(let d=1;d<=n;d++)for(let c=1;c<=r;c++)s[d-1]===o[c-1]?l[d][c]=l[d-1][c-1]:l[d][c]=1+Math.min(l[d][c-1],Math.min(l[d-1][c],l[d-1][c-1]));const a=l[n][r];let h=Math.max(n,r)-a;if(i){const d=function(c){const u=[],g=c.length;for(let m=1;m<=g;m++)for(let f=0;f<=g-m;f++){const C=f+m-1;u.push(c.slice(f,C+1))}return u}(s);for(let c=0;cthis.registerJsComponent(t,i))}registerDefaultComponent(e,t,i){this.agGridDefaults[e]=t,i&&(this.agGridDefaultParams[e]=i)}registerJsComponent(e,t){this.jsComps[e]=t}retrieve(e,t){const i=(l,a,h)=>({componentFromFramework:a,component:l,params:h}),s=this.getFrameworkOverrides().frameworkComponent(t,this.gos.get("components"));if(s!=null)return i(s,!0);const o=this.jsComps[t];if(o)return i(o,this.getFrameworkOverrides().isFrameworkComponent(o));const n=this.agGridDefaults[t];if(n)return i(n,!1,this.agGridDefaultParams[t]);const r=this.enterpriseAgDefaultCompsModule[t];return r?this.gos.assertModuleRegistered(r,`AG Grid '${e}' component: ${t}`):as(()=>{this.warnAboutMissingComponent(e,t)},"MissingComp"+t),null}warnAboutMissingComponent(e,t){const i=Ln({inputValue:t,allSuggestions:[...Object.keys(this.agGridDefaults).filter(s=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(s)),...Object.keys(this.jsComps)],hideIrrelevant:!0,filterByPercentageOfBestMatch:.8}).values;R(`Could not find '${t}' component. It was configured as "${e}: '${t}'" but it wasn't found in the list of registered components.`),i.length>0&&R(` Did you mean: [${i.slice(0,3)}]?`),R(`If using a custom component check it has been registered as described in: ${this.getFrameworkOverrides().getDocLink("components/")}`)}},he=class Di{constructor(t){this.status=0,this.resolution=null,this.waiters=[],t(i=>this.onDone(i),i=>this.onReject(i))}static all(t){return t.length?new Di(i=>{let s=t.length;const o=new Array(s);t.forEach((n,r)=>{n.then(l=>{o[r]=l,s--,s===0&&i(o)})})}):Di.resolve()}static resolve(t=null){return new Di(i=>i(t))}then(t){return new Di(i=>{this.status===1?i(t(this.resolution)):this.waiters.push(s=>i(t(s)))})}onDone(t){this.status=1,this.resolution=t,this.waiters.forEach(i=>i(t))}onReject(t){}},ca={propertyName:"dateComponent",cellRenderer:!1},ua={propertyName:"dragAndDropImageComponent",cellRenderer:!1},ga={propertyName:"headerComponent",cellRenderer:!1},pa={propertyName:"headerGroupComponent",cellRenderer:!1},kn={propertyName:"cellRenderer",cellRenderer:!0},ma={propertyName:"cellRenderer",cellRenderer:!1},Ca={propertyName:"loadingCellRenderer",cellRenderer:!0},fa={propertyName:"cellEditor",cellRenderer:!1},On={propertyName:"innerRenderer",cellRenderer:!0},va={propertyName:"loadingOverlayComponent",cellRenderer:!1},wa={propertyName:"noRowsOverlayComponent",cellRenderer:!1},Sa={propertyName:"tooltipComponent",cellRenderer:!1},Ys={propertyName:"filter",cellRenderer:!1},ya={propertyName:"floatingFilterComponent",cellRenderer:!1},ba={propertyName:"toolPanel",cellRenderer:!1},Ra={propertyName:"statusPanel",cellRenderer:!1},Fa={propertyName:"fullWidthCellRenderer",cellRenderer:!0},Pa={propertyName:"loadingCellRenderer",cellRenderer:!0},Da={propertyName:"groupRowRenderer",cellRenderer:!0},Ea={propertyName:"detailCellRenderer",cellRenderer:!0},Ma={propertyName:"menuItem",cellRenderer:!1},Gn=class dl extends b{constructor(){super(...arguments),this.beanName="userComponentFactory"}wireBeans(t){this.agComponentUtils=t.agComponentUtils,this.componentMetadataProvider=t.componentMetadataProvider,this.userComponentRegistry=t.userComponentRegistry,this.frameworkComponentWrapper=t.frameworkComponentWrapper,this.gridOptions=t.gridOptions}getDragAndDropImageCompDetails(t){return this.getCompDetails(this.gridOptions,ua,"agDragAndDropImage",t,!0)}getHeaderCompDetails(t,i){return this.getCompDetails(t,ga,"agColumnHeader",i)}getHeaderGroupCompDetails(t){const i=t.columnGroup.getColGroupDef();return this.getCompDetails(i,pa,"agColumnGroupHeader",t)}getFullWidthCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Fa,null,t,!0)}getFullWidthLoadingCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Pa,"agLoadingCellRenderer",t,!0)}getFullWidthGroupCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Da,"agGroupRowRenderer",t,!0)}getFullWidthDetailCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Ea,"agDetailCellRenderer",t,!0)}getInnerRendererDetails(t,i){return this.getCompDetails(t,On,null,i)}getFullWidthGroupRowInnerCellRenderer(t,i){return this.getCompDetails(t,On,null,i)}getCellRendererDetails(t,i){return this.getCompDetails(t,kn,null,i)}getEditorRendererDetails(t,i){return this.getCompDetails(t,ma,null,i)}getLoadingCellRendererDetails(t,i){return this.getCompDetails(t,Ca,"agSkeletonCellRenderer",i,!0)}getCellEditorDetails(t,i){return this.getCompDetails(t,fa,"agCellEditor",i,!0)}getFilterDetails(t,i,s){return this.getCompDetails(t,Ys,s,i,!0)}getDateCompDetails(t){return this.getCompDetails(this.gridOptions,ca,"agDateInput",t,!0)}getLoadingOverlayCompDetails(t){return this.getCompDetails(this.gridOptions,va,"agLoadingOverlay",t,!0)}getNoRowsOverlayCompDetails(t){return this.getCompDetails(this.gridOptions,wa,"agNoRowsOverlay",t,!0)}getTooltipCompDetails(t){return this.getCompDetails(t.colDef,Sa,"agTooltipComponent",t,!0)}getSetFilterCellRendererDetails(t,i){return this.getCompDetails(t,kn,null,i)}getFloatingFilterCompDetails(t,i,s){return this.getCompDetails(t,ya,s,i)}getToolPanelCompDetails(t,i){return this.getCompDetails(t,ba,null,i,!0)}getStatusPanelCompDetails(t,i){return this.getCompDetails(t,Ra,null,i,!0)}getMenuItemCompDetails(t,i){return this.getCompDetails(t,Ma,"agMenuItem",i,!0)}getCompDetails(t,i,s,o,n=!1){const{propertyName:r,cellRenderer:l}=i;let a,{compName:h,jsComp:d,fwComp:c,paramsFromSelector:u,popupFromSelector:g,popupPositionFromSelector:m}=dl.getCompKeys(this.frameworkOverrides,t,i,o);const f=P=>{const S=this.userComponentRegistry.retrieve(r,P);S&&(d=S.componentFromFramework?void 0:S.component,c=S.componentFromFramework?S.component:void 0,a=S.params)};if(h!=null&&f(h),d==null&&c==null&&s!=null&&f(s),d&&l&&!this.agComponentUtils.doesImplementIComponent(d)&&(d=this.agComponentUtils.adaptFunction(r,d)),!d&&!c)return void(n&&Q(`Could not find component ${h}, did you forget to configure this component?`));const C=this.mergeParamsWithApplicationProvidedParams(t,i,o,u,a),v=d==null,w=d||c;return{componentFromFramework:v,componentClass:w,params:C,type:i,popupFromSelector:g,popupPositionFromSelector:m,newAgStackInstance:()=>this.newAgStackInstance(w,v,C,i)}}static getCompKeys(t,i,s,o){const{propertyName:n}=s;let r,l,a,h,d,c;if(i){const u=i,g=u[n+"Selector"],m=g?g(o):null,f=C=>{typeof C=="string"?r=C:C!=null&&C!==!0&&(t.isFrameworkComponent(C)?a=C:l=C)};m?(f(m.component),h=m.params,d=m.popup,c=m.popupPosition):f(u[n])}return{compName:r,jsComp:l,fwComp:a,paramsFromSelector:h,popupFromSelector:d,popupPositionFromSelector:c}}newAgStackInstance(t,i,s,o){const n=o.propertyName;let r;if(!i)r=new t;else{const a=this.componentMetadataProvider.retrieve(n);r=this.frameworkComponentWrapper.wrap(t,a.mandatoryMethodList,a.optionalMethodList,o)}const l=this.initComponent(r,s);return l==null?he.resolve(r):l.then(()=>r)}mergeParamsWithApplicationProvidedParams(t,i,s,o=null,n){const r=this.gos.getGridCommonParams();Re(r,s),n&&Re(r,n);const l=t&&t[i.propertyName+"Params"];return typeof l=="function"?Re(r,l(s)):typeof l=="object"&&Re(r,l),Re(r,o),r}initComponent(t,i){if(this.createBean(t),t.init!=null)return t.init(i)}};function fi(e){const t=e;return t!=null&&t.getFrameworkComponentInstance!=null?t.getFrameworkComponentInstance():e}var _i=class Y{static register(t){Y.__register(t,!0,void 0)}static registerModules(t){Y.__registerModules(t,!0,void 0)}static __register(t,i,s){Y.runVersionChecks(t),s!==void 0?(Y.areGridScopedModules=!0,Y.gridModulesMap[s]===void 0&&(Y.gridModulesMap[s]={}),Y.gridModulesMap[s][t.moduleName]=t):Y.globalModulesMap[t.moduleName]=t,Y.setModuleBased(i)}static __unRegisterGridModules(t){delete Y.gridModulesMap[t]}static __registerModules(t,i,s){Y.setModuleBased(i),t&&t.forEach(o=>Y.__register(o,i,s))}static isValidModuleVersion(t){const[i,s]=t.version.split(".")||[],[o,n]=Y.currentModuleVersion.split(".")||[];return i===o&&s===n}static runVersionChecks(t){Y.currentModuleVersion||(Y.currentModuleVersion=t.version);const i=s=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${s} Please update all modules to the same version.`;if(t.version?Y.isValidModuleVersion(t)||Q(i(`'${t.moduleName}' is version ${t.version} but the other modules are version ${Y.currentModuleVersion}.`)):Q(i(`'${t.moduleName}' is incompatible.`)),t.validate){const s=t.validate();s.isValid||Q(`${s.message}`)}}static setModuleBased(t){Y.moduleBased===void 0?Y.moduleBased=t:Y.moduleBased!==t&&(Q("AG Grid: You are mixing modules (i.e. @ag-grid-community/core) and packages (ag-grid-community) - you can only use one or the other of these mechanisms."),Q("Please see https://www.ag-grid.com/javascript-grid/modules/ for more information."))}static __setIsBundled(){Y.isBundled=!0}static __assertRegistered(t,i,s){var n;if(this.__isRegistered(t,s))return!0;let o;if(Y.isBundled)o=`AG Grid: unable to use ${i} as 'ag-grid-enterprise' has not been loaded. Check you are using the Enterprise bundle: + + + + + + + + + caternary + + + + + + + + +
+ + + diff --git a/apps/circle-check.ico b/apps/circle-check.ico new file mode 100644 index 0000000000000000000000000000000000000000..9ce6526670fcbb3d2718378ee436d5226863c7a3 Binary files /dev/null and b/apps/circle-check.ico differ diff --git a/apps/circle-play.ico b/apps/circle-play.ico new file mode 100644 index 0000000000000000000000000000000000000000..9b09dafc2e1bdeb3f7c10f10c4e07029dc059c05 Binary files /dev/null and b/apps/circle-play.ico differ diff --git a/apps/circle-x.ico b/apps/circle-x.ico new file mode 100644 index 0000000000000000000000000000000000000000..6016bde2db63c7dee009bc7eb3fe9cdb38b300a0 Binary files /dev/null and b/apps/circle-x.ico differ diff --git a/apps/favicon-16x16.png b/apps/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..10de32630d957fb0cbf70e70666dd8d15736b1e7 Binary files /dev/null and b/apps/favicon-16x16.png differ diff --git a/apps/favicon-32x32.png b/apps/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..21d6f7a9ce932d6dffd0164e99d46f5a89947093 Binary files /dev/null and b/apps/favicon-32x32.png differ diff --git a/apps/favicon.ico b/apps/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..03b04d72248881073eb0ad537104ac1325ccf2b6 Binary files /dev/null and b/apps/favicon.ico differ diff --git a/apps/logo.png b/apps/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f78d56dd1108c8a19bfa170038adabce30b7f290 Binary files /dev/null and b/apps/logo.png differ diff --git a/apps/manifest.json b/apps/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..f839981c26fcd58d16bba984c5ad9d67dbc75e06 --- /dev/null +++ b/apps/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "Marimo", + "name": "A Marimo App", + "icons": [ + { + "src": "favicon.ico", + "sizes": "48x48", + "type": "image/x-icon" + }, + { + "src": "android-chrome-192x192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "android-chrome-512x512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/apps/public/logo.png b/apps/public/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f78d56dd1108c8a19bfa170038adabce30b7f290 Binary files /dev/null and b/apps/public/logo.png differ diff --git a/apps/site.webmanifest b/apps/site.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..09317d7cf8091677fd29e9bffe143d6fcd28e339 --- /dev/null +++ b/apps/site.webmanifest @@ -0,0 +1,19 @@ +{ + "background_color": "#ffffff", + "display": "standalone", + "icons": [ + { + "sizes": "192x192", + "src": "/android-chrome-192x192.png", + "type": "image/png" + }, + { + "sizes": "512x512", + "src": "/android-chrome-512x512.png", + "type": "image/png" + } + ], + "name": "marimo", + "short_name": "marimo", + "theme_color": "#ffffff" +} diff --git a/index.html b/index.html index b0c4b3666032a737f3903db53e6a8a9272483e28..00edcddd4c5aa2c6df86378417c4d0ebaf02474a 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,201 @@ - - - - - - My static Space - - - -
-

Welcome to your static Space!

-

You can modify this app directly by editing index.html in the Files and versions tab.

-

- Also don't forget to check the - Spaces documentation. -

-
- - + + + + + + DataBooth Interactive Notebooks + + + +
+
+

DataBooth Interactive Notebooks

+

+ Explore interactive Python notebooks and apps, powered by Marimo and WebAssembly. +

+
+
+ +
+ + +

Notebooks

+

Interactive notebooks in edit mode — experiment, learn, and explore code.

+
+ +
+
Caternary
+ +
+ +
+ + + +

Apps

+

Interactive applications in run mode — code is hidden for a clean user experience.

+
+ +
+
Caternary
+
+ Open App +
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/notebooks/.nojekyll b/notebooks/.nojekyll new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/notebooks/android-chrome-192x192.png b/notebooks/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..b8e595cb98236af54d85702265bfaf0bc2232158 Binary files /dev/null and b/notebooks/android-chrome-192x192.png differ diff --git a/notebooks/android-chrome-512x512.png b/notebooks/android-chrome-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..0667fbdd81bbfd925aa5aaf1d7e5c8059dce761f Binary files /dev/null and b/notebooks/android-chrome-512x512.png differ diff --git a/notebooks/apple-touch-icon.png b/notebooks/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b2a013bd102eb79ac10f78945bee20d1468cb066 Binary files /dev/null and b/notebooks/apple-touch-icon.png differ diff --git a/notebooks/assets/ConnectedDataExplorerComponent-4GM2STek.js b/notebooks/assets/ConnectedDataExplorerComponent-4GM2STek.js new file mode 100644 index 0000000000000000000000000000000000000000..6ee63786eab6e18addd7249b5b8c373fd300a041 --- /dev/null +++ b/notebooks/assets/ConnectedDataExplorerComponent-4GM2STek.js @@ -0,0 +1,19 @@ +import{u as Gn,y as zn,dm as po,j as x,dn as ho,dp as go,dq as mo,dr as yo,c as Ee,Q as Yn,ds as ke,V as vo,W as Qn,dt as pt,du as Vn,dv as ht,dw as Ke,dx as gt,L as bo,dy as xo,dz as Eo,_ as To,Z as Kt,dA as Kn,bt as So,dB as Jn,dC as wo,dD as No,dE as Co,dF as Ao,dG as Oo,aI as ko,U as Mo,aH as Io,E as Uo,a4 as Fo,dH as Do,aO as _o,dI as jo,a as Po}from"./index-DgI7bmFZ.js";import{U as Ro,e as $o,V as Bo}from"./compile-BapKxctZ.js";import{a as Xn}from"./VegaLite-BNmk2IVQ.js";import"./time-D5YMlIcS.js";import"./timer-Bqd5yn_a.js";import"./linear-aSIo3jFo.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./zoom-COrs4lFh.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./step-BwsUM5iJ.js";import"./arc-CfyY4LWz.js";import"./index-_uHhs6Sh.js";/** + * @license lucide-react v0.503.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lo=Gn("chart-column-big",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]),Wo=Gn("list-ordered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */function $e(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(o=Object.getOwnPropertySymbols(e);it&&s(),u=t=n+1):o==="]"&&(u||Jt("Access path missing open bracket: "+e),u>0&&s(),u=0,t=n+1):n>t?s():t=n+1}return u&&Jt("Access path missing closing bracket: "+e),c&&Jt("Access path missing closing quote: "+e),n>t&&(n++,s()),i}const mt=Array.isArray;function rr(e){return e===Object(e)}function Zt(e){return typeof e=="string"}function en(e){return mt(e)?"["+e.map(en)+"]":rr(e)||Zt(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var Je=[];function yt(e,t,n){var o=[t].concat([].slice.call(n));console[e](...o)}(function(e){var t=Xt(e),n="return _["+t.map(en).join("][")+"];";Be(Function("_",n),[e=t.length===1?t[0]:e],e)})("id"),Be(function(e){return e},Je,"identity"),Be(function(){return 0},Je,"zero"),Be(function(){return 1},Je,"one"),Be(function(){return!0},Je,"true"),Be(function(){return!1},Je,"false");function tn(e){return typeof e=="boolean"}function Le(e){for(var t={},n=0,o=e.length;nnr(e)).join(",")})`};const K=nr;function Y(e,t){return e.indexOf(t)>-1}const ue=Object.keys,ne="row",ee="column",ir="facet",D="x",_="y",nn="x2",rn="y2",or="latitude",ar="longitude",sr="latitude2",cr="longitude2",de="color",vt="fill",bt="stroke",Xe="shape",Te="size",xt="opacity",Et="fillOpacity",Tt="strokeOpacity",St="strokeWidth",on="text",lr="order",an="detail",ur="key",dr="tooltip",fr="href",sn=Object.assign({},{x:1,y:1,x2:1,y2:1},{longitude:1,longitude2:1,latitude:1,latitude2:1},{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1});function wt(e){return e==="color"||e==="fill"||e==="stroke"}const Ze=Object.assign({},sn,{row:1,column:1,facet:1}),Go=ue(Ze),{order:vc,detail:bc}=Ze;$e(Ze,["order","detail"]);const{order:xc,detail:Ec,row:Tc,column:Sc,facet:wc}=Ze;$e(Ze,["order","detail","row","column","facet"]);const{x:Nc,y:Cc,x2:Ac,y2:Oc,latitude:kc,longitude:Mc,latitude2:Ic,longitude2:Uc}=sn,cn=$e(sn,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]),pr=ue(cn),{text:Fc,tooltip:Dc,href:_c,detail:jc,key:Pc,order:Rc}=cn,zo=$e(cn,["text","tooltip","href","detail","key","order"]),Yo=Object.assign({},{x:1,y:1},zo);function Qo(e,t){return function(n){switch(n){case de:case vt:case bt:case an:case ur:case dr:case fr:case lr:case xt:case Et:case Tt:case St:case ir:case ne:case ee:return ln;case D:case _:case or:case ar:return Vo;case nn:case rn:case sr:case cr:return{rule:"always",bar:"always",rect:"always",area:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Te:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Xe:return{point:"always",geoshape:"always"};case on:return{text:"always"}}}(e)[t]}const ln={area:"always",bar:"always",circle:"always",geoshape:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:$c}=ln,Vo=$e(ln,["geoshape"]);function un(e){switch(e){case D:case _:case Te:case St:case xt:case Et:case Tt:case nn:case rn:return;case ir:case ne:case ee:case Xe:case on:case dr:case fr:return"discrete";case de:case vt:case bt:return"flexible";case or:case ar:case sr:case cr:case an:case ur:case lr:return}throw new Error("rangeType not implemented for "+e)}const hr={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,zindex:1},Ko=Object.assign({},hr,{encoding:1});Object.assign({gridScale:1,scale:1},hr,{encode:1});const gr=ue(Ko),mr={clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1};Object.assign({},mr,{opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,encode:1});const yr=ue(mr),Jo=Object.freeze(Object.defineProperty({__proto__:null,BAR_WITH_POINT_SCALE_AND_RANGESTEP_NULL:"Bar mark should not be used with point scale when rangeStep is null. Please use band scale instead.",CANNOT_FIX_RANGE_STEP_WITH_FIT:'Cannot use a fixed value of "rangeStep" when "autosize" is "fit".',CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:"custom domain scale cannot be unioned with default field-based domain",CONCAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).",FIT_NON_SINGLE:'Autosize "fit" only works for single views and layered views.',INVALID_CHANNEL_FOR_AXIS:"Invalid channel for axis.",INVALID_SPEC:"Invalid spec",LINE_WITH_VARYING_SIZE:"Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.",MORE_THAN_ONE_SORT:"Domains that should be unioned has conflicting sort properties. Sort will be set to true.",NO_FIELDS_NEEDS_AS:'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.',NO_INIT_SCALE_BINDINGS:"Selections bound to scales cannot be separately initialized.",REPEAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).",SCALE_BINDINGS_CONTINUOUS:"Scale bindings are currently only supported for scales with unbinned, continuous domains.",UNABLE_TO_MERGE_DOMAINS:"Unable to merge domains",cannotApplySizeToNonOrientedMark:function(e){return`Cannot apply size to non-oriented mark "${e}".`},cannotProjectOnChannelWithoutField:function(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`},cannotStackNonLinearScale:function(e){return`Cannot stack non-linear scale (${e})`},cannotStackRangedMark:function(e){return`Cannot stack "${e}" if there is already "${e}2"`},cannotUseScalePropertyWithNonColor:function(e){return`Cannot use the scale property "${e}" with non-color channel.`},channelRequiredForBinned:function(e){return`Channel ${e} is required for "binned" bin`},columnsNotSupportByRowCol:function(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`},dayReplacedWithDate:function(e){return`Time unit "${e}" is not supported. We are replacing it with ${e.replace("day","date")}.`},differentParse:function(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`},discreteChannelCannotEncode:function(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`},domainRequiredForThresholdScale:function(e){return`Domain for ${e} is required for threshold scale`},domainSortDropped:function(e){return`Dropping sort property ${K(e)} as unioned domains only support boolean or op 'count'.`},droppedDay:function(e){return`Dropping day from datetime ${K(e)} as day cannot be combined with other units.`},droppingColor:function(e,t){const{fill:n,stroke:o}=t;return`Dropping color ${e} as the plot also has `+(n&&o?"fill and stroke":n?"fill":"stroke")},emptyFieldDef:function(e,t){return`Dropping ${K(e)} from channel "${t}" since it does not contain data field or value.`},encodingOverridden:function(e){return`Layer's shared ${e.join(",")} channel ${e.length===1?"is":"are"} overriden`},errorBand1DNotSupport:function(e){return`1D error band does not support ${e}`},errorBarCenterAndExtentAreNotNeeded:function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`},errorBarCenterIsNotNeeded:function(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`},errorBarCenterIsUsedWithWrongExtent:function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`},errorBarContinuousAxisHasCustomizedAggregate:function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`},facetChannelDropped:function(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`},facetChannelShouldBeDiscrete:function(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`},incompatibleChannel:function(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`},independentScaleMeansIndependentGuide:function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`},invalidAggregate:function(e){return`Invalid aggregation operator "${e}"`},invalidEncodingChannel:function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`},invalidFieldType:function(e){return`Invalid field type "${e}"`},invalidFieldTypeForCountAggregate:function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`},invalidTimeUnit:function(e,t){return`Invalid ${e}: ${K(t)}`},invalidTransformIgnored:function(e){return`Ignoring an invalid transform: ${K(e)}.`},latLongDeprecated:function(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`},lineWithRange:function(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`},mergeConflictingDomainProperty:function(e,t,n,o){return`Conflicting ${t.toString()} property "${e.toString()}" (${K(n)} and ${K(o)}). Using the union of the two domains.`},mergeConflictingProperty:function(e,t,n,o){return`Conflicting ${t.toString()} property "${e.toString()}" (${K(n)} and ${K(o)}). Using ${K(n)}.`},missingFieldType:function(e,t){return`Missing type for channel "${e}", using "${t}" instead.`},nearestNotSupportForContinuous:function(e){return`The "nearest" transform is not supported for ${e} marks.`},noSuchRepeatedValue:function(e){return`Unknown repeated value "${e}".`},nonZeroScaleUsedWithLengthMark:function(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${e}'s ${t}. This can be misleading as the ${t==="x"?"width":"height"} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`},orientOverridden:function(e,t){return`Specified orient "${e}" overridden with "${t}"`},primitiveChannelDef:function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${K(n)}}.`},projectionOverridden:function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${K(t)} is overridden by a child projection ${K(n)}.`},rangeStepDropped:function(e){return`rangeStep for "${e}" is dropped as top-level ${e==="x"?"width":"height"} is provided.`},scalePropertyNotWorkWithScaleType:function(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`},scaleTypeNotWorkWithChannel:function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`},scaleTypeNotWorkWithFieldDef:function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`},scaleTypeNotWorkWithMark:function(e,t){return`Scale type "${t}" does not work with mark "${e}".`},selectionNotFound:function(e){return`Cannot find a selection named "${e}"`},selectionNotSupported:function(e){return`Selection not supported for ${e} yet`},stackNonSummativeAggregate:function(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}")`},unaggregateDomainHasNoEffectForRawField:function(e){return`Using unaggregated domain with raw field has no effect (${K(e)}).`},unaggregateDomainWithNonSharedDomainOp:function(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`},unaggregatedDomainWithLogScale:function(e){return`Unaggregated domain is currently unsupported for log scale (${K(e)}).`},unrecognizedParse:function(e){return`Unrecognized parse "${e}".`}},Symbol.toStringTag,{value:"Module"})),re=Jo;var Me;let vr=(Me=2,{level:function(e){return arguments.length?(Me=+e,this):Me},error:function(){return Me>=1&&yt("error","ERROR",arguments),this},warn:function(){return Me>=2&&yt("warn","WARN",arguments),this},info:function(){return Me>=3&&yt("log","INFO",arguments),this},debug:function(){return Me>=4&&yt("log","DEBUG",arguments),this}});function Se(...e){vr.warn.apply(vr,arguments)}const Xo={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},R="quantitative",ce="ordinal",Q="temporal",ie="nominal";var j;(function(e){e.LINEAR="linear",e.LOG="log",e.POW="pow",e.SQRT="sqrt",e.SYMLOG="symlog",e.TIME="time",e.UTC="utc",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.BIN_ORDINAL="bin-ordinal",e.ORDINAL="ordinal",e.POINT="point",e.BAND="band"})(j||(j={}));const Zo=ue({linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"}),br=["linear","log","pow","sqrt","symlog","time","utc"],ea=Le(br),ta=Le(["quantile","quantize","threshold"]),na=Le(br.concat(["quantile","quantize","threshold"])),ra=Le(["ordinal","bin-ordinal","point","band"]);function Ie(e){return e in ra}function We(e){return e in ea}const dn={type:1,domain:1,align:1,range:1,rangeStep:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},xr=ue(dn),{type:Bc,domain:Lc,range:Wc,rangeStep:Hc,scheme:qc}=dn;function fn(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!Y(["point","band","identity"],e);case"bins":return!Y(["point","band","identity","ordinal"],e);case"round":return We(e)||e==="band"||e==="point";case"padding":return We(e)||Y(["point","band"],e);case"paddingOuter":case"rangeStep":case"align":return Y(["point","band"],e);case"paddingInner":return e==="band";case"clamp":return We(e);case"nice":return We(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return function(n){return n in na}(e)&&!Y(["log","time","utc","threshold","quantile"],e)}}function ia(e,t){switch(t){case"interpolate":case"scheme":return wt(e)?void 0:re.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeStep":case"reverse":case"round":case"clamp":case"zero":return}}function Er(e,t){return Y([ce,ie],t)?e===void 0||Ie(e):t===Q?Y([j.TIME,j.UTC,void 0],e):t!==R||Y([j.LOG,j.POW,j.SQRT,j.SYMLOG,j.QUANTILE,j.QUANTIZE,j.THRESHOLD,j.LINEAR,void 0],e)}function Tr(e,t){switch(e){case D:case _:return We(t)||Y(["band","point"],t);case Te:case St:case xt:case Et:case Tt:return We(t)||function(n){return n in ta}(t)||Y(["band","point"],t);case de:case vt:case bt:return t!=="band";case Xe:return t==="ordinal"}return!1}function oa(e,t){return e+"_"+t}$e(dn,["type","domain","range","rangeStep","scheme"]),function(){const e={};for(const t of Go)for(const n of ue(Xo))for(const o of Zo){const i=oa(t,n);Tr(t,o)&&Er(o,n)&&(e[i]=e[i]||[],e[i].push(o))}}();var Sr,wr={exports:{}};function et(){return Sr||(Sr=1,function(){var e=wr.exports,t="__name__";e.namedfunc=function(a,r){return r[t]=a,r},e.name=function(a){return a==null?null:a[t]},e.identity=function(a){return a},e.true=e.namedfunc("true",function(){return!0}),e.false=e.namedfunc("false",function(){return!1}),e.duplicate=function(a){return JSON.parse(JSON.stringify(a))},e.equal=function(a,r){return JSON.stringify(a)===JSON.stringify(r)},e.extend=function(a){for(var r,s,d=1,l=arguments.length;d1?function(s,d){for(var l=0;lr||r==null)&&a!=null?1:(r=r instanceof Date?+r:r,(a=a instanceof Date?+a:a)!==a&&r==r?-1:r!=r&&a==a?1:0)},e.numcmp=function(a,r){return a-r},e.stablesort=function(a,r,s){var d=a.reduce(function(l,f,p){return l[s(f)]=p,l},{});return a.sort(function(l,f){var p=r(l),h=r(f);return ph?1:d[s(l)]-d[s(f)]}),a},e.permute=function(a){for(var r,s,d=a.length;d;)s=Math.floor(Math.random()*d--),r=a[d],a[d]=a[s],a[s]=r},e.pad=function(a,r,s,d){d=d||" ";var l=r-a.length;if(l<=0)return a;switch(s){case"left":return i(l,d)+a;case"middle":case"center":return i(Math.floor(l/2),d)+a+i(Math.ceil(l/2),d);default:return a+i(l,d)}},e.truncate=function(a,r,s,d,l){var f=a.length;if(f<=r)return a;l=l!==void 0?String(l):"\u2026";var p=Math.max(0,r-l.length);switch(s){case"left":return l+(d?c(a,p,1):a.slice(f-p));case"middle":case"center":var h=Math.ceil(p/2),m=Math.floor(p/2);return(d?c(a,h):a.slice(0,h))+l+(d?c(a,m,1):a.slice(f-m));default:return(d?c(a,p):a.slice(0,p))+l}};var u=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/}()),wr.exports}var k=et();function te(e,t){return e.indexOf(t)!==-1}function fe(e,t){for(let n=0;n({parent:"bin",child:e})),gn=["field","op","order"].map(e=>({parent:"sort",child:e})),Nt=xr.map(e=>({parent:"scale",child:e})),Or=gr.map(e=>({parent:"axis",child:e})),kr=yr.map(e=>({parent:"legend",child:e})),Ct=[].concat(Ar,gn,Nt,Or,kr),Mr=["width","height","background","padding","title"];function At(e){return pe(e)?e.parent+"."+e.child:e}const sa=Ct.reduce((e,t)=>(e[t.parent]=e[t.parent]||[],e[t.parent][t.child]=t,e),{});function ge(e,t){return(sa[e]||{})[t]}function Ir(e){return function(t){return t in Nr}(e)||pe(e)}const ca=[].concat(pn,Ct),Ur=["type","field","bin","timeUnit","aggregate","autoCount","channel","mark","stack","scale","sort","axis","legend"].concat(Ar,Nt,Or,kr,gn);var g;(function(e){e.MARK="mark",e.TRANSFORM="transform",e.STACK="stack",e.FORMAT="format",e.CHANNEL="channel",e.AGGREGATE="aggregate",e.AUTOCOUNT="autoCount",e.BIN="bin",e.HAS_FN="hasFn",e.TIMEUNIT="timeUnit",e.FIELD="field",e.TYPE="type",e.SORT="sort",e.SCALE="scale",e.AXIS="axis",e.LEGEND="legend",e.WIDTH="width",e.HEIGHT="height",e.BACKGROUND="background",e.PADDING="padding",e.TITLE="title"})(g||(g={}));const Ue="area",me="bar",tt="line",nt="point",mn="rect",yn="rule",Ot="text",rt="tick",kt="circle",Mt="square";function la(e){return Y(["line","area","trail"],e)}Le(ue({area:1,bar:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1})),["january","february","march","april","may","june","july","august","september","october","november","december"].map(e=>e.substr(0,3));var W;["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].map(e=>e.substr(0,3)),function(e){e.YEAR="year",e.MONTH="month",e.DAY="day",e.DATE="date",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.MILLISECONDS="milliseconds",e.YEARMONTH="yearmonth",e.YEARMONTHDATE="yearmonthdate",e.YEARMONTHDATEHOURS="yearmonthdatehours",e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",e.MONTHDATE="monthdate",e.MONTHDATEHOURS="monthdatehours",e.HOURSMINUTES="hoursminutes",e.HOURSMINUTESSECONDS="hoursminutesseconds",e.MINUTESSECONDS="minutesseconds",e.SECONDSMILLISECONDS="secondsmilliseconds",e.QUARTER="quarter",e.YEARQUARTER="yearquarter",e.QUARTERMONTH="quartermonth",e.YEARQUARTERMONTH="yearquartermonth",e.UTCYEAR="utcyear",e.UTCMONTH="utcmonth",e.UTCDAY="utcday",e.UTCDATE="utcdate",e.UTCHOURS="utchours",e.UTCMINUTES="utcminutes",e.UTCSECONDS="utcseconds",e.UTCMILLISECONDS="utcmilliseconds",e.UTCYEARMONTH="utcyearmonth",e.UTCYEARMONTHDATE="utcyearmonthdate",e.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",e.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",e.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",e.UTCMONTHDATE="utcmonthdate",e.UTCMONTHDATEHOURS="utcmonthdatehours",e.UTCHOURSMINUTES="utchoursminutes",e.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",e.UTCMINUTESSECONDS="utcminutesseconds",e.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",e.UTCQUARTER="utcquarter",e.UTCYEARQUARTER="utcyearquarter",e.UTCQUARTERMONTH="utcquartermonth",e.UTCYEARQUARTERMONTH="utcyearquartermonth"}(W||(W={}));const vn={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Fr=ue(vn),bn={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1},Dr={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},ua=Object.assign({},bn,Dr),da=Object.assign({},vn,bn,{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1},Dr),fa={year:"setFullYear",month:"setMonth",date:"setDate",hours:"setHours",minutes:"setMinutes",seconds:"setSeconds",milliseconds:"setMilliseconds",quarter:null,day:null};function pa(e,t){const n=!!ua[e],o=n?new Date(Date.UTC(1972,0,1,0,0,0,0)):new Date(1972,0,1,0,0,0,0);for(const i of Fr)if(jr(e,i))switch(i){case W.DAY:throw new Error("Cannot convert to TimeUnits containing 'day'");case W.QUARTER:{const{getDateMethod:c,setDateMethod:u}=_r("month",n);o[u](3*Math.floor(t[c]()/3));break}default:{const{getDateMethod:c,setDateMethod:u}=_r(i,n);o[u](t[c]())}}return o}function _r(e,t){const n=fa[e];return{setDateMethod:t?"setUTC"+n.substr(3):n,getDateMethod:"get"+(t?"UTC":"")+n.substr(3)}}function jr(e,t){const n=e.indexOf(t);return n>-1&&(t!==W.SECONDS||n===0||e.charAt(n-1)!=="i")}const P="?";function w(e){return It(e)||function(t){return!(t===void 0||t==null||!t.enum&&!t.name||k.isArray(t))}(e)}function It(e){return e===P}function xn(e,t,n){return k.extend({},{name:t,enum:n},e===P?{}:e)}function En(e){let t={},n={};for(const o of e){const i=[0];for(let u=0;uo.charAt(u)).join("").toLowerCase();if(n[c])if(i[i.length-1]===o.length-1||(c=i.concat([o.length-1]).map(u=>o.charAt(u)).join("").toLowerCase(),n[c]))for(let u=1;!t[o];u++){let a=c+"_"+u;if(!n[a]){t[o]=a,n[a]=!0;break}}else t[o]=c,n[c]=!0;else t[o]=c,n[c]=!0}return t}const Ut={mark:"m",channel:"c",aggregate:"a",autoCount:"#",hasFn:"h",bin:"b",sort:"so",stack:"st",scale:"s",format:"f",axis:"ax",legend:"l",value:"v",timeUnit:"tu",field:"f",type:"t",binProps:{maxbins:"mb",min:"mi",max:"ma",base:"b",step:"s",steps:"ss",minstep:"ms",divide:"d"},sortProps:{field:"f",op:"o",order:"or"},scaleProps:En(xr),axisProps:En(gr),legendProps:En(yr)};function it(e){if(pe(e))return Ut[e.parent]+"-"+Ut[e.parent+"Props"][e.child];if(Ut[e])return Ut[e];throw new Error("Default name undefined for "+e)}const X=[!1,!0],ha={maxbins:[5,10,20],extent:[void 0],base:[10],step:[void 0],steps:[void 0],minstep:[void 0],divide:[[5,2]],binned:[!1],anchor:[void 0],nice:[!0]},ga={field:[void 0],op:["min","mean"],order:["ascending","descending"]},ma={type:[void 0,j.LOG],domain:[void 0],base:[void 0],exponent:[1,2],constant:[void 0],bins:[void 0],clamp:X,nice:X,reverse:X,round:X,zero:X,padding:[void 0],paddingInner:[void 0],paddingOuter:[void 0],interpolate:[void 0],range:[void 0],rangeStep:[17,21],scheme:[void 0]},ya={zindex:[1,0],offset:[void 0],orient:[void 0],values:[void 0],bandPosition:[void 0],encoding:[void 0],domain:X,domainColor:[void 0],domainDash:[void 0],domainDashOffset:[void 0],domainOpacity:[void 0],domainWidth:[void 0],formatType:[void 0],grid:X,gridColor:[void 0],gridDash:[void 0],gridDashOffset:[void 0],gridOpacity:[void 0],gridWidth:[void 0],format:[void 0],labels:X,labelAlign:[void 0],labelAngle:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFlushOffset:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOpacity:[void 0],labelSeparation:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelBound:[void 0],labelFlush:[void 0],maxExtent:[void 0],minExtent:[void 0],position:[void 0],ticks:X,tickColor:[void 0],tickCount:[void 0],tickDash:[void 0],tickExtra:[void 0],tickDashOffset:[void 0],tickMinStep:[void 0],tickOffset:[void 0],tickOpacity:[void 0],tickRound:[void 0],tickSize:[void 0],tickWidth:[void 0],title:[void 0],titleAlign:[void 0],titleAnchor:[void 0],titleAngle:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titlePadding:[void 0],titleX:[void 0],titleY:[void 0]},va={orient:["left","right"],format:[void 0],type:[void 0],values:[void 0],zindex:[void 0],clipHeight:[void 0],columnPadding:[void 0],columns:[void 0],cornerRadius:[void 0],direction:[void 0],encoding:[void 0],fillColor:[void 0],formatType:[void 0],gridAlign:[void 0],offset:[void 0],padding:[void 0],rowPadding:[void 0],strokeColor:[void 0],labelAlign:[void 0],labelBaseline:[void 0],labelColor:[void 0],labelFont:[void 0],labelFontSize:[void 0],labelFontStyle:[void 0],labelFontWeight:[void 0],labelLimit:[void 0],labelOffset:[void 0],labelOpacity:[void 0],labelOverlap:[void 0],labelPadding:[void 0],labelSeparation:[void 0],legendX:[void 0],legendY:[void 0],gradientLength:[void 0],gradientOpacity:[void 0],gradientStrokeColor:[void 0],gradientStrokeWidth:[void 0],gradientThickness:[void 0],symbolDash:[void 0],symbolDashOffset:[void 0],symbolFillColor:[void 0],symbolOffset:[void 0],symbolOpacity:[void 0],symbolSize:[void 0],symbolStrokeColor:[void 0],symbolStrokeWidth:[void 0],symbolType:[void 0],tickCount:[void 0],tickMinStep:[void 0],title:[void 0],titleAnchor:[void 0],titleAlign:[void 0],titleBaseline:[void 0],titleColor:[void 0],titleFont:[void 0],titleFontSize:[void 0],titleFontStyle:[void 0],titleFontWeight:[void 0],titleLimit:[void 0],titleOpacity:[void 0],titleOrient:[void 0],titlePadding:[void 0]},ba={mark:[nt,me,tt,Ue,mn,rt,Ot],channel:[D,_,ne,ee,Te,de],aggregate:[void 0,"mean"],autoCount:X,bin:X,hasFn:X,timeUnit:[void 0,W.YEAR,W.MONTH,W.MINUTES,W.SECONDS],field:[void 0],type:[ie,ce,R,Q],sort:["ascending","descending"],stack:["zero","normalize","center",null],value:[void 0],format:[void 0],title:[void 0],scale:[!0],axis:X,legend:X,binProps:ha,sortProps:ga,scaleProps:ma,axisProps:ya,legendProps:va};function Tn(e,t,n){if(e==="field"||pe(e)&&e.parent==="sort"&&e.child==="field")return t.fieldNames();let o;if(o=pe(e)?n.enum[e.parent+"Props"][e.child]:n.enum[e],o!==void 0)return o;throw new Error("No default enumValues for "+JSON.stringify(e))}const ot={verbose:!1,defaultSpecConfig:{line:{point:!0},scale:{useUnaggregatedDomain:!0}},propertyPrecedence:Ur.map(At),enum:ba,numberNominalProportion:.05,numberNominalLimit:40,constraintManuallySpecifiedValue:!1,autoAddCount:!1,hasAppropriateGraphicTypeForMark:!0,omitAggregate:!1,omitAggregatePlotWithDimensionOnlyOnFacet:!0,omitAggregatePlotWithoutDimension:!1,omitBarLineAreaWithOcclusion:!0,omitBarTickWithSize:!0,omitMultipleNonPositionalChannels:!0,omitRaw:!1,omitRawContinuousFieldForAggregatePlot:!0,omitRepeatedField:!0,omitNonPositionalOrFacetOverPositionalChannels:!0,omitTableWithOcclusionIfAutoAddCount:!0,omitVerticalDotPlot:!1,omitInvalidStackSpec:!0,omitNonSumStack:!0,preferredBinAxis:D,preferredTemporalAxis:D,preferredOrdinalAxis:_,preferredNominalAxis:_,preferredFacet:ne,minCardinalityForBin:15,maxCardinalityForCategoricalColor:20,maxCardinalityForFacet:20,maxCardinalityForShape:6,timeUnitShouldHaveVariation:!0,typeMatchesSchemaType:!0,stylize:!0,smallRangeStepForHighCardinalityOrFacet:{maxCardinality:10,rangeStep:12},nominalColorScaleForHighCardinality:{maxCardinality:10,palette:"category20"},xAxisOnTopForHighYCardinalityWithoutColumn:{maxCardinality:30},maxGoodCardinalityForFacet:5,maxGoodCardinalityForColor:7,minPercentUniqueForKey:.8,minCardinalityForKey:50},xa={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},Pr=["count","sum","distinct","valid","missing"];function Ea(e){return tn(e)&&(e=function(t,n){return tn(t)?{maxbins:Sn(n)}:t==="binned"?{binned:!0}:t.maxbins||t.step?t:Object.assign({},t,{maxbins:Sn(n)})}(e,void 0)),"bin"+ue(e).map(t=>function(n){const o=n.replace(/\W/g,"_");return(n.match(/^\d+/)?"_":"")+o}(`_${t}_${e[t]}`)).join("")}function Rr(e){return e===!0||function(t){return rr(t)}(e)&&!e.binned}function Sn(e){switch(e){case ne:case ee:case Te:case de:case vt:case bt:case St:case xt:case Et:case Tt:case Xe:return 6;default:return 10}}function $r(e){return!!e&&!!e.condition&&!mt(e.condition)&&we(e.condition)}function we(e){return!(!e||!e.field&&e.aggregate!=="count")}function wn(e){return we(e)&&Zt(e.field)}function Nn(e,t={}){let n=e.field;const o=t.prefix;let i=t.suffix,c="";if(function(a){return a.aggregate==="count"}(e))n=function(a){return function(r){return r.indexOf("__")===0}(a)?a:`__${a}`}("count");else{let a;if(!t.nofn)if(function(r){return!!r.op}(e))a=e.op;else{const{bin:r,aggregate:s,timeUnit:d}=e;Rr(r)?(a=Ea(r),i=(t.binSuffix||"")+(t.suffix||"")):s?(u=s)&&u.argmax?(c=`.${n}`,n=`argmax_${s.argmax}`):function(l){return!!l&&!!l.argmin}(s)?(c=`.${n}`,n=`argmin_${s.argmin}`):a=String(s):d&&(a=String(d))}a&&(n=n?`${a}_${n}`:a)}var u;return i&&(n=`${n}_${i}`),o&&(n=`${o}_${n}`),t.forAs?n:t.expr?function(a,r="datum"){return`${r}[${en(Xt(a).join("."))}]`}(n,t.expr)+c:`${Xt(n).map(a=>a.replace(".","\\.")).join("\\.")}`+c}function Br(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(re.invalidFieldType(e.type))}Le(["mean","average","median","q1","q3","min","max"]);const He={compatible:!0};function Ta(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case"row":case"column":case"facet":return function(o){return!Br(o)}(e)?{compatible:!1,warning:re.facetChannelShouldBeDiscrete(t)}:He;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":return He;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==R?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:He;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return n!=="nominal"||e.sort?He:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return Y(["ordinal","nominal","geojson"],e.type)?He:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return e.type!=="nominal"||"sort"in e?He:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}function Sa(e,t,n,o){const i=function(u,a,r){switch(a.type){case"nominal":case"ordinal":return wt(u)||un(u)==="discrete"?(u==="shape"&&a.type==="ordinal"&&Se(re.discreteChannelCannotEncode(u,"ordinal")),"ordinal"):Y(["x","y"],u)&&Y(["rect","bar","rule"],r)?"band":"point";case"temporal":return wt(u)?"time":un(u)==="discrete"?(Se(re.discreteChannelCannotEncode(u,"temporal")),"ordinal"):"time";case"quantitative":return wt(u)?Rr(a.bin)?"bin-ordinal":"linear":un(u)==="discrete"?(Se(re.discreteChannelCannotEncode(u,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(re.invalidFieldType(a.type))}(t,n,o),{type:c}=e;return function(u){return!!Yo[u]}(t)?c!==void 0?Tr(t,c)?Er(c,n.type)?c:(Se(re.scaleTypeNotWorkWithFieldDef(c,i)),i):(Se(re.scaleTypeNotWorkWithChannel(t,c,i)),i):i:null}var le;function Lr(e){return e===ce||e===ie||e===le.KEY}(function(e){e.QUANTITATIVE=R,e.ORDINAL=ce,e.TEMPORAL=Q,e.NOMINAL=ie,e.KEY="key"})(le||(le={}));class J{constructor(t=null){this.index=t?Object.assign({},t):{}}has(t){return At(t)in this.index}get(t){return this.index[At(t)]}set(t,n){return this.index[At(t)]=n,this}setByKey(t,n){this.index[t]=n}map(t){const n=new J;for(const o in this.index)n.index[o]=t(this.index[o]);return n}size(){return k.keys(this.index).length}duplicate(){return new J(this.index)}}function Wr(e,t){const n=e&&e[t];return!!n&&(mt(n)?function(o,i){let c=0;for(const[u,a]of o.entries())if(i(a,u,c++))return!0;return!1}(n,o=>!!o.field):we(n)||$r(n))}const wa={zero:1,center:1,normalize:1},Na=[me,Ue,yn,nt,kt,Mt,tt,Ot,rt],Ca=[me,Ue];function Aa(e,t,n,o={}){const i=function(p){return p.type}(e)?e.type:e;if(!Y(Na,i))return null;const c=function(p){const h=p.x,m=p.y;if(we(h)&&we(m))if(h.type==="quantitative"&&m.type==="quantitative"){if(h.stack)return"x";if(m.stack)return"y";if(!!h.aggregate!=!!m.aggregate)return h.aggregate?"x":"y"}else{if(h.type==="quantitative")return"x";if(m.type==="quantitative")return"y"}else{if(we(h)&&h.type==="quantitative")return"x";if(we(m)&&m.type==="quantitative")return"y"}}(t);if(!c)return null;const u=t[c],a=wn(u)?Nn(u,{}):void 0,r=c==="x"?"y":"x",s=t[r],d=wn(s)?Nn(s,{}):void 0,l=pr.reduce((p,h)=>{if(h!=="tooltip"&&Wr(t,h)){const m=t[h];(mt(m)?m:[m]).forEach(v=>{const b=function(E){return we(E)?E:$r(E)?E.condition:void 0}(v);if(b.aggregate)return;const y=wn(b)?Nn(b,{}):void 0;(!y||y!==d&&y!==a)&&p.push({channel:h,fieldDef:b})})}return p},[]);let f;if(u.stack!==void 0?f=tn(u.stack)?u.stack?"zero":null:u.stack:l.length>0&&(f=Y(Ca,i)?function(...p){for(const h of p)if(h!==void 0)return h}(n,"zero"):n),!f||!wa[f])return null;if(u.scale&&u.scale.type&&u.scale.type!==j.LINEAR){if(o.disallowNonLinearStack)return null;Se(re.cannotStackNonLinearScale(u.scale.type))}return Wr(t,c===D?nn:rn)?(u.stack!==void 0&&Se(re.cannotStackRangedMark(c)),null):(u.aggregate&&!Y(Pr,u.aggregate)&&Se(re.stackNonSummativeAggregate(u.aggregate)),{groupbyChannel:s?r:void 0,fieldChannel:c,impute:la(i),stackBy:l,offset:f})}function Hr(e){if(!function(n){if(w(n.mark))return!1;const o=[g.STACK,g.CHANNEL,g.MARK,g.FIELD,g.AGGREGATE,g.AUTOCOUNT,g.SCALE,ge("scale","type"),g.TYPE],i=k.toMap((u=ca,a=o,u.filter(function(r){return!te(a,r)}))),c=n.encodings.filter(r=>!ae(r));var u,a;for(const r of c)if(qr(r,{exclude:i}))return!1;return!0}(e))return null;const t=Qr(e.encodings,{schema:null,wildcardMode:"null"});return Aa(e.mark,t,void 0,{disallowNonLinearStack:!0})}function qr(e,t={}){if(!k.isObject(e))return!1;for(const n in e)if(e.hasOwnProperty(n)&&(w(e[n])&&(!t.exclude||!t.exclude[n])||qr(e[n],t)))return!0;return!1}function Oa(e){return e.map(t=>function(n){return o=>n[o]!==void 0?n[o]:o}(t))}function Fe(e,t){return w(e)?!It(e)&&e.enum?P+JSON.stringify(e.enum):P:t?t(e):e}function Ft(e,t){return t?t(e):e}const Cn=new J,An=[].concat(Ur,gn,[g.TRANSFORM,g.STACK],Mr).reduce((e,t)=>e.set(t,!0),new J),On={axis:{x:!0,y:!0,row:!0,column:!0},legend:{color:!0,opacity:!0,size:!0,shape:!0},scale:{x:!0,y:!0,color:!0,opacity:!0,row:!0,column:!0,size:!0,shape:!0},sort:{x:!0,y:!0,path:!0,order:!0},stack:{x:!0,y:!0}};function qe(e,t=An,n=Cn){const o=[];let i;if(t.get(g.MARK)&&o.push(Fe(e.mark,n.get(g.MARK))),e.transform&&e.transform.length>0&&o.push("transform:"+JSON.stringify(e.transform)),t.get(g.STACK)&&(i=Hr(e)),e.encodings){const c=e.encodings.reduce((u,a)=>{if(!ae(a)){let r;r=i&&a.channel===i.fieldChannel?Gr(Object.assign({},a,{stack:i.offset}),t,n):Gr(a,t,n),r&&u.push(r)}return u},[]).sort().join("|");c&&o.push(c)}for(let c of Mr){const u=c.toString();if(t.get(c)&&e[u]){const a=e[u];o.push(`${u}=${JSON.stringify(a)}`)}}return o.join("|")}function Gr(e,t=An,n=Cn){const o=[];if(t.get(g.CHANNEL)&&o.push(Fe(e.channel,n.get(g.CHANNEL))),A(e)){const i=zr(e,t,n);i&&o.push(i)}else oe(e)?o.push(e.value):H(e)&&o.push("autocount()");return o.join(":")}function zr(e,t=An,n=Cn){if(t.get(g.AGGREGATE)&&ae(e))return"-";const o=function(u,a,r){if(a.get(g.AGGREGATE)&&u.aggregate&&!w(u.aggregate))return Ft(u.aggregate,r.get(g.AGGREGATE));if(a.get(g.AGGREGATE)&&Dt(u))return Ft("count",r.get(g.AGGREGATE));if(a.get(g.TIMEUNIT)&&u.timeUnit&&!w(u.timeUnit))return Ft(u.timeUnit,r.get(g.TIMEUNIT));if(a.get(g.BIN)&&u.bin&&!w(u.bin))return"bin";{let s=null;for(const d of[g.AGGREGATE,g.AUTOCOUNT,g.TIMEUNIT,g.BIN]){const l=u[d];a.get(d)&&u[d]&&w(l)&&(s=s||{},s[d]=It(l)?l:l.enum)}return s&&u.hasFn&&(s.hasFn=!0),s}}(e,t,n),i=function(u,a,r){const s=[];if(!k.isBoolean(u.bin)&&!It(u.bin)){const d=u.bin;for(const l in d){const f=ge("bin",l);f&&a.get(f)&&d[l]!==void 0&&s.push({key:l,value:Fe(d[l],r.get(f))})}s.sort((l,f)=>l.key.localeCompare(f.key))}for(const d of[g.SCALE,g.SORT,g.STACK,g.AXIS,g.LEGEND])if((w(u.channel)||On[d][u.channel])&&a.get(d)&&u[d]!==void 0){const l=u[d];if(k.isBoolean(l)||l===null)s.push({key:d+"",value:l||!1});else if(k.isString(l))s.push({key:d+"",value:Ft(JSON.stringify(l),r.get(d))});else{let f=[];for(const p in l){const h=ge(d,p);h&&a.get(h)&&l[p]!==void 0&&f.push({key:p,value:Fe(l[p],r.get(h))})}if(f.length>0){const p=f.sort((h,m)=>h.key.localeCompare(m.key)).reduce((h,m)=>(h[m.key]=m.value,h),{});s.push({key:d+"",value:JSON.stringify(p)})}}}return s}(e,t,n);let c;return A(e)?(c=t.get("field")?Fe(e.field,n.get("field")):"...",t.get(g.TYPE)&&(w(e.type)?c+=","+Fe(e.type,n.get(g.TYPE)):c+=","+Fe(((e.type||R)+"").substr(0,1),n.get(g.TYPE))),c+=i.map(u=>{let a=u.value instanceof Array?"["+u.value+"]":u.value;return","+u.key+"="+a}).join("")):H(e)&&(c="*,q"),c?o?(k.isString(o)?o:P+(k.keys(o).length>0?JSON.stringify(o):""))+"("+c+")":c:null}function kn(e,t,n){let o=[],i=0;for(let c=0;c0))return r;for(t(c,1),e(c),c=0;)for(;t(u,1),!c(u););})},n&&(i.count=function(c,u){return In.setTime(+c),Un.setTime(+u),e(In),e(Un),Math.floor(n(In,Un))},i.every=function(c){return c=Math.floor(c),isFinite(c)&&c>0?c>1?i.filter(o?function(u){return o(u)%c===0}:function(u){return i.count(0,u)%c===0}):i:null}),i}var st=G(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});st.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?G(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):st:null};const Vr=G(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getSeconds()}),Kr=G(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4},function(e){return e.getMinutes()}),Jr=G(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getHours()}),Xr=G(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5},function(e){return e.getDate()-1});function _e(e){return G(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}var jt=_e(0),Zr=_e(1),ei=_e(2),ti=_e(3),ni=_e(4),ri=_e(5),ii=_e(6);const oi=G(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),ai=G(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}),si=G(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3},function(e){return e.getUTCSeconds()}),ci=G(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4},function(e){return e.getUTCMinutes()}),li=G(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5},function(e){return e.getUTCHours()}),ui=G(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1});function je(e){return G(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/6048e5})}var Pt=je(0),di=je(1),fi=je(2),pi=je(3),hi=je(4),gi=je(5),mi=je(6);const yi=G(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),vi=G(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});var bi=st.range,Ia=Vr.range,Ua=Kr.range,Fa=Jr.range,Da=Xr.range,_a=jt.range,ja=Zr.range,Pa=ei.range,Ra=ti.range,$a=ni.range,Ba=ri.range,La=ii.range,Wa=jt.range,Ha=oi.range,qa=ai.range,Ga=st,za=bi,Ya=si.range,Qa=ci.range,Va=li.range,Ka=ui.range,Ja=Pt.range,Xa=di.range,Za=fi.range,es=pi.range,ts=hi.range,ns=gi.range,rs=mi.range,is=Pt.range,os=yi.range,as=vi.range;const ss=po(Object.freeze(Object.defineProperty({__proto__:null,day:Xr,days:Da,friday:ri,fridays:Ba,hour:Jr,hours:Fa,interval:G,millisecond:st,milliseconds:bi,minute:Kr,minutes:Ua,monday:Zr,mondays:ja,month:oi,months:Ha,saturday:ii,saturdays:La,second:Vr,seconds:Ia,sunday:jt,sundays:_a,thursday:ni,thursdays:$a,tuesday:ei,tuesdays:Pa,utcDay:ui,utcDays:Ka,utcFriday:gi,utcFridays:ns,utcHour:li,utcHours:Va,utcMillisecond:Ga,utcMilliseconds:za,utcMinute:ci,utcMinutes:Qa,utcMonday:di,utcMondays:Xa,utcMonth:yi,utcMonths:os,utcSaturday:mi,utcSaturdays:rs,utcSecond:si,utcSeconds:Ya,utcSunday:Pt,utcSundays:Ja,utcThursday:hi,utcThursdays:ts,utcTuesday:fi,utcTuesdays:Za,utcWednesday:pi,utcWednesdays:es,utcWeek:Pt,utcWeeks:is,utcYear:vi,utcYears:as,wednesday:ti,wednesdays:Ra,week:jt,weeks:Wa,year:ai,years:qa},Symbol.toStringTag,{value:"Module"})));var xi,Ei,Ti;function cs(){if(xi)return _t.exports;xi=1;var e=ss,t=new Date,n=new Date(0,0,1).setFullYear(0),o=new Date(Date.UTC(0,0,1)).setUTCFullYear(0);function i(l){return t.setTime(+l),t}function c(l,f,p,h,m,v){var b={type:l,date:f,unit:p};return h?b.step=h:b.minstep=1,m!=null&&(b.min=m),v!=null&&(b.max=v),b}function u(l,f,p,h,m,v){return c(l,function(b){return f.offset(p,b)},function(b){return f.count(p,b)},h,m,v)}var a=[u("second",e.second,n),u("minute",e.minute,n),u("hour",e.hour,n),u("day",e.day,n,[1,7]),u("month",e.month,n,[1,3,6]),u("year",e.year,n),c("seconds",function(l){return new Date(1970,0,1,0,0,l)},function(l){return i(l).getSeconds()},null,0,59),c("minutes",function(l){return new Date(1970,0,1,0,l)},function(l){return i(l).getMinutes()},null,0,59),c("hours",function(l){return new Date(1970,0,1,l)},function(l){return i(l).getHours()},null,0,23),c("weekdays",function(l){return new Date(1970,0,4+l)},function(l){return i(l).getDay()},[1],0,6),c("dates",function(l){return new Date(1970,0,l)},function(l){return i(l).getDate()},[1],1,31),c("months",function(l){return new Date(1970,l%12,1)},function(l){return i(l).getMonth()},[1],0,11)],r=[u("second",e.utcSecond,o),u("minute",e.utcMinute,o),u("hour",e.utcHour,o),u("day",e.utcDay,o,[1,7]),u("month",e.utcMonth,o,[1,3,6]),u("year",e.utcYear,o),c("seconds",function(l){return new Date(Date.UTC(1970,0,1,0,0,l))},function(l){return i(l).getUTCSeconds()},null,0,59),c("minutes",function(l){return new Date(Date.UTC(1970,0,1,0,l))},function(l){return i(l).getUTCMinutes()},null,0,59),c("hours",function(l){return new Date(Date.UTC(1970,0,1,l))},function(l){return i(l).getUTCHours()},null,0,23),c("weekdays",function(l){return new Date(Date.UTC(1970,0,4+l))},function(l){return i(l).getUTCDay()},[1],0,6),c("dates",function(l){return new Date(Date.UTC(1970,0,l))},function(l){return i(l).getUTCDate()},[1],1,31),c("months",function(l){return new Date(Date.UTC(1970,l%12,1))},function(l){return i(l).getUTCMonth()},[1],0,11)],s=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];function d(l){var f,p,h={};for(f=0,p=l.length;f(M=s[N])[0]){if((O=E/M[0])>S)return y[s[N-1][1]];if(O>=T)return y[M[1]]}return y[s[C-1][1]]}(l,m,v,b)},h}return _t.exports=d(a),_t.exports.utc=d(r),_t.exports}var ls=function(){if(Ti)return Ei;Ti=1;var e=et(),t=cs();function n(a){if(!a)throw Error("Missing binning options.");var r,s,d,l,f,p,h,m=a.maxbins||15,v=a.base||10,b=Math.log(v),y=a.div||[5,2],E=a.min,T=a.max,S=T-E;if(a.step)r=a.step;else if(a.steps)r=a.steps[Math.min(a.steps.length-1,function(N,C,O,M){for(;O>>1;e.cmp(N[U],C)<0?O=U+1:M=U}return O}(a.steps,S/m,0,a.steps.length))];else{for(s=Math.ceil(Math.log(m)/b),d=a.minstep||0,r=Math.max(d,Math.pow(v,Math.round(Math.log(S)/b)-s));Math.ceil(S/r)>m;)r*=v;for(p=0;p=d&&S/f<=m&&(r=f)}return l=(f=Math.log(r))>=0?0:1+~~(-f/b),h=Math.pow(v,-l-1),{start:E=Math.min(E,Math.floor(E/r+h)*r),stop:T=Math.ceil(T/r)*r,step:r,unit:{precision:l},value:o,index:i}}function o(a){return this.step*Math.floor(a/this.step+1e-15)}function i(a){return Math.floor((a-this.start)/this.step+1e-15)}function c(a){return this.unit.date(o.call(this,a))}function u(a){return i.call(this,this.unit.unit(a))}return n.date=function(a){if(!a)throw Error("Missing date binning options.");var r=a.utc?t.utc:t,s=a.min,d=a.max,l=a.maxbins||20,f=a.minbins||4,p=+d-+s,h=a.unit?r[a.unit]:r.find(p,f,l),m=n({min:h.min!=null?h.min:h.unit(s),max:h.max!=null?h.max:h.unit(d),maxbins:l,minstep:h.minstep,steps:h.step});return m.unit=h,m.index=u,a.raw||(m.value=c),m},Ei=n}();const us=zn(ls);var Si,wi;function Ni(){if(wi)return Si;wi=1;var e=et(),t="__types__",n={boolean:e.boolean,integer:e.number,number:e.number,date:e.date,string:function(r){return r==null||r===""?null:r+""}},o={boolean:function(r){return r==="true"||r==="false"||e.isBoolean(r)},integer:function(r){return o.number(r)&&(r=+r)===~~r},number:function(r){return!isNaN(+r)&&!e.isDate(r)},date:function(r){return!isNaN(Date.parse(r))}};function i(r){return e.keys(r)}function c(r){return"["+r+"]"}function u(r,s){var d,l,f;if(r=e.array(r),s=e.$(s),r[t]&&(d=s(r[t]),e.isString(d)))return d;for(l=0,f=r.length;!e.isValid(d)&&lf;)m.push(h);else for(;(h=l+p*++v)=l&&m<=f?1/p:0},h.cdf=function(m){return mf?1:(m-l)/p},h.icdf=function(m){return m>=0&&m<=1?l+m*p:NaN},h},d.random.integer=function(l,f){f===void 0&&(f=l,l=0);var p=f-l,h=function(){return l+Math.floor(p*Math.random())};return h.samples=function(m){return d.zeros(m).map(h)},h.pdf=function(m){return m===Math.floor(m)&&m>=l&&m=f?1:(v-l+1)/p},h.icdf=function(m){return m>=0&&m<=1?l-1+Math.floor(m*p):NaN},h},d.random.normal=function(l,f){var p;l=l||0,f=f||1;var h=function(){var m,v,b=0,y=0;if(p!==void 0)return b=p,p=void 0,b;do m=(b=2*Math.random()-1)*b+(y=2*Math.random()-1)*y;while(m===0||m>1);return v=Math.sqrt(-2*Math.log(m)/m),p=l+y*v*f,l+b*v*f};return h.samples=function(m){return d.zeros(m).map(h)},h.pdf=function(m){var v=Math.exp(Math.pow(m-l,2)/(-2*Math.pow(f,2)));return 1/(f*Math.sqrt(2*Math.PI))*v},h.cdf=function(m){var v,b=(m-l)/f,y=Math.abs(b);if(y>37)v=0;else{var E=Math.exp(-y*y/2);y<7.07106781186547?(v=E*((((((.0352624965998911*y+.700383064443688)*y+6.37396220353165)*y+33.912866078383)*y+112.079291497871)*y+221.213596169931)*y+220.206867912376),v/=((((((.0883883476483184*y+1.75566716318264)*y+16.064177579207)*y+86.7807322029461)*y+296.564248779674)*y+637.333633378831)*y+793.826512519948)*y+440.413735824752):v=E/(y+1/(y+2/(y+3/(y+4/(y+.65)))))/2.506628274631}return b>0?1-v:v},h.icdf=function(m){if(m<=0||m>=1)return NaN;var v=2*m-1,b=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),y=2/(Math.PI*b)+Math.log(1-Math.pow(v,2))/2,E=Math.log(1-v*v)/b,T=(v>0?1:-1)*Math.sqrt(Math.sqrt(y*y-E)-y);return l+f*Math.SQRT2*T},h},d.random.bootstrap=function(l,f){var p=l.filter(s.isValid),h=p.length,m=f?d.random.normal(0,f):null,v=function(){return p[~~(Math.random()*h)]+(m?m():0)};return v.samples=function(b){return d.zeros(b).map(v)},v}}(ki)),ki.exports),i=e.exports;function c(r,s,d){var l=r&&r.nullh||0,f=o.random.normal(0,1),p=i.mean(s,d),h=i.stdev(s,d)/Math.sqrt(i.count.valid(s,d));if(h===0)return p-l===0?1:0;var m=(p-l)/h;return 2*f.cdf(-Math.abs(m))}function u(r,s,d,l){var f,p=l?s.map(t.$(d)):s,h=l?s.map(t.$(l)):d,m=i.count(p),v=i.count(h),b=Array();if(m!==v)throw Error("Array lengths must match.");for(f=0;f0?Math.pow(h,1/d):0},i.mean.harmonic=function(r,s){s=t.$(s);var d,l,f,p,h=0;for(p=0,d=0,l=r.length;pl&&(l=f));return[d,l]},i.extent.index=function(r,s){s=t.$(s);var d,l,f,p,h=-1,m=-1,v=r.length;for(p=0;pl&&(l=f,m=p));return[h,m]},i.dot=function(r,s,d){var l,f,p=0;if(d)for(s=t.$(s),d=t.$(d),l=0;l-1&&b!==l){for(f=1+(d-1+v)/2;v-1)for(f=1+(h-1+v)/2;vT)&&(T=h),S+=(d=h-m)*(h-(m+=d/++v)),N.push(h));return S/=v-1,l=Math.sqrt(S),N.sort(t.cmp),{type:n(r,s),unique:C,count:r.length,valid:v,missing:b,distinct:y,min:E,max:T,mean:m,stdev:l,median:p=i.quantile(N,.5),q1:i.quantile(N,.25),q3:i.quantile(N,.75),modeskew:l===0?0:(m-p)/l}},i.summary=function(r,s){var d=(s=s||t.keys(r[0])).map(function(l){var f=i.profile(r,t.$(l));return f.field=l,f});return d.__summary__=!0,d}}(Oi)),Oi.exports);const ps=us,Rt={nominal:0,key:1,ordinal:2,temporal:3,quantitative:4};class hs{constructor(t){this._tableSchema=t,t.fields.sort(function(n,o){return Rt[n.vlType]Rt[o.vlType]?1:n.name.localeCompare(o.name)}),t.fields.forEach((n,o)=>n.index=o),this._fieldSchemaIndex=t.fields.reduce((n,o)=>(n[o.name]=o,n),{})}fieldNames(){return this._tableSchema.fields.map(t=>t.name)}get fieldSchemas(){return this._tableSchema.fields}fieldSchema(t){return this._fieldSchemaIndex[t]}tableSchema(){const t=k.duplicate(this._tableSchema);return t.fields.sort((n,o)=>n.originalIndex-o.originalIndex),t}primitiveType(t){return this._fieldSchemaIndex[t]?this._fieldSchemaIndex[t].type:null}vlType(t){return this._fieldSchemaIndex[t]?this._fieldSchemaIndex[t].vlType:null}cardinality(t,n=!0,o=!1){const i=this._fieldSchemaIndex[t.field];if(t.aggregate||H(t)&&t.autoCount)return 1;if(t.bin){let c;c=typeof t.bin=="boolean"?{maxbins:Sn(t.channel)}:t.bin==="?"?{enum:[!0,!1]}:t.bin;const u=c.maxbins;return i.binStats[u]||(i.binStats[u]=Mi(u,i.stats)),i.binStats[u].distinct}if(t.timeUnit){if(n)switch(t.timeUnit){case W.SECONDS:case W.MINUTES:return 60;case W.HOURS:return 24;case W.DAY:return 7;case W.DATE:return 31;case W.MONTH:return 12;case W.QUARTER:return 4;case W.MILLISECONDS:return 1e3}let c=t.timeUnit,u=i.timeStats;return u&&u[c]||(u=Object.assign({},u,{[c]:Ii(t.timeUnit,i.stats)})),o?u[c].distinct-Ui(u[c].unique,["Invalid Date",null]):u[c].distinct}return i?o?i.stats.distinct-Ui(i.stats.unique,[NaN,null]):i.stats.distinct:null}timeUnitHasVariation(t){if(!t.timeUnit)return;if(t.timeUnit===W.DAY){const o=k.extend({},t,{timeUnit:W.DATE});if(this.cardinality(o,!1,!0)<=1)return!1}let n=t.timeUnit;for(let o of Fr)if(jr(n,o)){const i=k.extend({},t,{timeUnit:o});if(this.cardinality(i,!1,!0)<=1)return!1}return!0}domain(t){const n=this._fieldSchemaIndex[t.field];let o=k.keys(n.stats.unique);return n.vlType===R?[+n.stats.min,+n.stats.max]:n.type===L.DATETIME?[n.stats.min,n.stats.max]:n.type===L.INTEGER||n.type===L.NUMBER?(o=o.map(i=>+i),o.sort(k.cmp)):n.vlType===ce&&n.ordinalDomain?n.ordinalDomain:o.map(i=>i==="null"?null:i).sort(k.cmp)}stats(t){const n=this._fieldSchemaIndex[t.field];return n?n.stats:null}}function Mi(e,t){const n=ps({min:t.min,max:t.max,maxbins:e}),o=k.extend({},t);return o.unique=function(i,c){const u={};for(let a in c){let r;r=a===null?null:isNaN(Number(a))?NaN:i.value(Number(a)),u[r]=(u[r]||0)+c[a]}return u}(n,t.unique),o.distinct=(n.stop-n.start)/n.step,o.min=n.start,o.max=n.stop,o}function Ii(e,t){const n=k.extend({},t);let o={};return k.keys(t.unique).forEach(function(i){let c,u=i==="null"?null:new Date(i);c=u===null?null:isNaN(u.getTime())?"Invalid Date":(e===W.DAY?u.getDay():pa(e,u)).toString(),o[c]=(o[c]||0)+t.unique[i]}),n.unique=o,n.distinct=k.keys(o).length,n}function Ui(e,t){return t.reduce(function(n,o){return e[o]?n+1:n},0)}var L;(function(e){e[e.STRING="string"]="STRING",e[e.NUMBER="number"]="NUMBER",e[e.INTEGER="integer"]="INTEGER",e[e.BOOLEAN="boolean"]="BOOLEAN",e[e.DATETIME="datetime"]="DATETIME"})(L||(L={}));class Fi{constructor(t){this.constraint=t}name(){return this.constraint.name}description(){return this.constraint.description}properties(){return this.constraint.properties}strict(){return this.constraint.strict}}class Di extends Fi{constructor(t){super(t)}hasAllRequiredPropertiesSpecific(t){return fe(this.constraint.properties,n=>{if(pe(n)){let o=n.parent,i=n.child;return!t[o]||!w(t[o][i])}return!t[n]||!w(t[n])})}satisfy(t,n,o,i){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(t)||this.constraint.satisfy(t,n,o,i)}}const _i=[{name:"aggregateOpSupportedByType",description:"Aggregate function should be supported by data type.",properties:[g.TYPE,g.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.aggregate||!Lr(e.type)},{name:"asteriskFieldWithCountOnly",description:'Field="*" should be disallowed except aggregate="count"',properties:[g.FIELD,g.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>e.field==="*"==(e.aggregate==="count")},{name:"minCardinalityForBin",description:"binned quantitative field should not have too low cardinality",properties:[g.BIN,g.FIELD,g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{if(e.bin&&e.type===R){let i={channel:e.channel,field:e.field,type:e.type};return t.cardinality(i)>=o.minCardinalityForBin}return!0}},{name:"binAppliedForQuantitative",description:"bin should be applied to quantitative field only.",properties:[g.TYPE,g.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.bin||e.type===R},{name:"channelFieldCompatible",description:"encoding channel's range type be compatible with channel type.",properties:[g.CHANNEL,g.TYPE,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{const i=Object.assign({field:"f"},Mn(e,{schema:t,props:["bin","timeUnit","type"]})),{compatible:c}=Ta(i,e.channel);if(c)return!0;return!(e.channel!=="row"&&e.channel!=="column"||(u=i.timeUnit,!vn[u]&&!function(a){return!!bn[a]}(i.timeUnit)));var u}},{name:"hasFn",description:"A field with as hasFn flag should have one of aggregate, timeUnit, or bin.",properties:[g.AGGREGATE,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>!e.hasFn||!!e.aggregate||!!e.bin||!!e.timeUnit},{name:"omitScaleZeroWithBinnedField",description:"Do not use scale zero with binned field",properties:[g.SCALE,ge("scale","zero"),g.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.bin||!e.scale||e.scale.zero!==!0},{name:"onlyOneTypeOfFunction",description:"Only of of aggregate, autoCount, timeUnit, or bin should be applied at the same time.",properties:[g.AGGREGATE,g.AUTOCOUNT,g.TIMEUNIT,g.BIN],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>A(e)?(!w(e.aggregate)&&e.aggregate?1:0)+(!w(e.bin)&&e.bin?1:0)+(!w(e.timeUnit)&&e.timeUnit?1:0)<=1:!0},{name:"timeUnitAppliedForTemporal",description:"Time unit should be applied to temporal field only.",properties:[g.TYPE,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.timeUnit||e.type===Q},{name:"timeUnitShouldHaveVariation",description:"A particular time unit should be applied only if they produce unique values.",properties:[g.TIMEUNIT,g.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>!e.timeUnit||e.type!==Q||!n.has("timeUnit")&&!o.constraintManuallySpecifiedValue||t.timeUnitHasVariation(e)},{name:"scalePropertiesSupportedByScaleType",description:"Scale properties must be supported by correct scale type",properties:[].concat(Nt,[g.SCALE,g.TYPE]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>{if(e.scale){const i=e.scale,c=De(e);if(c==null)return!0;for(let u in i){if(u==="type"||u==="name"||u==="enum")continue;const a=u;if(c==="point"){if(!fn("point",a)&&!fn("band",a))return!1}else if(!fn(c,a))return!1}}return!0}},{name:"scalePropertiesSupportedByChannel",description:"Not all scale properties are supported by all encoding channels",properties:[].concat(Nt,[g.SCALE,g.CHANNEL]),allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n,o)=>{if(e){let i=e.channel,c=e.scale;if(i&&!w(i)&&c){if(i==="row"||i==="column")return!1;for(let u in c)if(c.hasOwnProperty(u)&&!(u==="type"||u==="name"||u==="enum")&&ia(i,u)!==void 0)return!1}}return!0}},{name:"typeMatchesPrimitiveType",description:"Data type should be supported by field's primitive type.",properties:[g.FIELD,g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{if(e.field==="*")return!0;const i=t.primitiveType(e.field),c=e.type;if(!n.has("field")&&!n.has("type")&&!o.constraintManuallySpecifiedValue)return!0;switch(i){case L.BOOLEAN:case L.STRING:return c!==R&&c!==Q;case L.NUMBER:case L.INTEGER:return c!==Q;case L.DATETIME:return c===Q;case null:return!1}throw new Error("Not implemented")}},{name:"typeMatchesSchemaType",description:"Enumerated data type of a field should match the field's type in the schema.",properties:[g.FIELD,g.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>!(n.has("field")||n.has("type")||o.constraintManuallySpecifiedValue)||(e.field==="*"?e.type===R:t.vlType(e.field)===e.type)},{name:"maxCardinalityForCategoricalColor",description:"Categorical channel should not have too high cardinality",properties:[g.CHANNEL,g.FIELD],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>e.channel!==de||e.type!==ie&&e.type!==le.KEY||t.cardinality(e)<=o.maxCardinalityForCategoricalColor},{name:"maxCardinalityForFacet",description:"Row/column channel should not have too high cardinality",properties:[g.CHANNEL,g.FIELD,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>e.channel!==ne&&e.channel!==ee||t.cardinality(e)<=o.maxCardinalityForFacet},{name:"maxCardinalityForShape",description:"Shape channel should not have too high cardinality",properties:[g.CHANNEL,g.FIELD,g.BIN,g.TIMEUNIT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n,o)=>e.channel!==Xe||t.cardinality(e)<=o.maxCardinalityForShape},{name:"dataTypeAndFunctionMatchScaleType",description:"Scale type must match data type",properties:[g.TYPE,g.SCALE,ge("scale","type"),g.TIMEUNIT,g.BIN],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>{if(e.scale){const i=e.type,c=De(e);if(Lr(i))return c===void 0||Ie(c);if(i===Q)return e.timeUnit?te([j.TIME,j.UTC,void 0],c)||Ie(c):te([j.TIME,j.UTC,void 0],c);if(i===R)return e.bin?te([j.LINEAR,void 0],c):te([j.LOG,j.POW,j.SQRT,j.QUANTILE,j.QUANTIZE,j.LINEAR,void 0],c)}return!0}},{name:"stackIsOnlyUsedWithXY",description:"stack should only be allowed for x and y channels",properties:[g.STACK,g.CHANNEL],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!e.stack||e.channel===D||e.channel===_}].map(e=>new Di(e));_i.reduce((e,t)=>(e[t.name()]=t,e),{});const gs=_i.reduce((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new J),ji=[{name:"doesNotSupportConstantValue",description:"row, column, x, y, order, and detail should not work with constant values.",properties:[g.TYPE,g.AGGREGATE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n,o)=>!te(["row","column","x","y","detail","order"],e.channel)}].map(e=>new Di(e));ji.reduce((e,t)=>(e[t.name()]=t,e),{});const ms=ji.reduce((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new J),ys=pr.reduce((e,t)=>(e[t]=!0,e),{});class vs extends Fi{constructor(t){super(t)}hasAllRequiredPropertiesSpecific(t){return fe(this.constraint.properties,n=>{if(n===g.MARK)return!w(t.getMark());if(pe(n)){let o=n.parent,i=n.child;return fe(t.getEncodings(),c=>!c[o]||!w(c[o][i]))}if(!Ir(n))throw new Error("UNIMPLEMENTED");return fe(t.getEncodings(),o=>!o[n]||!w(o[n]))})}satisfy(t,n,o){return!this.constraint.allowWildcardForProperties&&!this.hasAllRequiredPropertiesSpecific(t)||this.constraint.satisfy(t,n,o)}}const Pi=[{name:"noRepeatedChannel",description:"Each encoding channel should only be used once.",properties:[g.CHANNEL],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{let o={};return fe(e.getEncodings(),i=>!!w(i.channel)||!o[i.channel]&&(o[i.channel]=!0,!0))}},{name:"alwaysIncludeZeroInScaleWithBarMark",description:"Do not recommend bar mark if scale does not start at zero",properties:[g.MARK,g.SCALE,ge("scale","zero"),g.CHANNEL,g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const o=e.getMark(),i=e.getEncodings();if(o===me){for(let c of i)if(A(c)&&(c.channel===D||c.channel===_)&&c.type===R&&c.scale&&c.scale.zero===!1)return!1}return!0}},{name:"autoAddCount",description:"Automatically adding count only for plots with only ordinal, binned quantitative, or temporal with timeunit fields.",properties:[g.BIN,g.TIMEUNIT,g.TYPE,g.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>he(e.getEncodings(),o=>Dt(o))?fe(e.getEncodings(),o=>{if(oe(o)||H(o))return!0;switch(o.type){case R:return!!o.bin;case Q:return!!o.timeUnit;case ce:case le.KEY:case ie:return!0}throw new Error("Unsupported Type")}):fe(e.wildcardIndex.encodingIndicesByProperty.get("autoCount")||[],o=>{let i=e.getEncodingQueryByIndex(o);return H(i)&&!w(i.autoCount)})?he(e.getEncodings(),o=>(A(o)||H(o))&&o.type===R?!ae(o)&&A(o)&&(!o.bin||w(o.bin)):!(!A(o)||o.type!==Q)&&(!o.timeUnit||w(o.timeUnit))):!0},{name:"channelPermittedByMarkType",description:"Each encoding channel should be supported by the mark type",properties:[g.CHANNEL,g.MARK],allowWildcardForProperties:!0,strict:!0,satisfy:(e,t,n)=>{const o=e.getMark();return!!w(o)||fe(e.getEncodings(),i=>!!w(i.channel)||!!Qo(i.channel,o))}},{name:"hasAllRequiredChannelsForMark",description:"All required channels for the specified mark should be specified",properties:[g.CHANNEL,g.MARK],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const o=e.getMark();switch(o){case Ue:case tt:return e.channelUsed(D)&&e.channelUsed(_);case Ot:return e.channelUsed(on);case me:case kt:case Mt:case rt:case yn:case mn:return e.channelUsed(D)||e.channelUsed(_);case nt:return!e.wildcardIndex.hasProperty(g.CHANNEL)||e.channelUsed(D)||e.channelUsed(_)}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+JSON.stringify(o))}},{name:"omitAggregate",description:"Omit aggregate plots.",properties:[g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()},{name:"omitAggregatePlotWithDimensionOnlyOnFacet",description:"Omit aggregate plots with dimensions only on facets as that leads to inefficient use of space.",properties:[g.CHANNEL,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){let o=!1,i=!1,c=!1;if(e.specQuery.encodings.forEach((u,a)=>{oe(u)||ae(u)||A(u)&&!u.aggregate&&(i=!0,te([ne,ee],u.channel)?e.wildcardIndex.hasEncodingProperty(a,g.CHANNEL)&&(c=!0):o=!0)}),i&&!o&&(c||n.constraintManuallySpecifiedValue))return!1}return!0}},{name:"omitAggregatePlotWithoutDimension",description:"Aggregate plots without dimension should be omitted",properties:[g.AGGREGATE,g.AUTOCOUNT,g.BIN,g.TIMEUNIT,g.TYPE],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!e.isAggregate()||he(e.getEncodings(),o=>!!(Ne(o)||A(o)&&o.type==="temporal"))},{name:"omitBarLineAreaWithOcclusion",description:"Don't use bar, line or area to visualize raw plot as they often lead to occlusion.",properties:[g.MARK,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>!te([me,tt,Ue],e.getMark())||e.isAggregate()},{name:"omitBarTickWithSize",description:"Do not map field to size channel with bar and tick mark",properties:[g.CHANNEL,g.MARK],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{const o=e.getMark();if(te([rt,me],o)&&e.channelEncodingField(Te)){if(n.constraintManuallySpecifiedValue)return!1;{const i=e.specQuery.encodings;for(let c=0;c{const o=e.getMark(),i=e.getEncodings();if(o===Ue||o===me){for(let c of i)if(A(c)&&(c.channel===D||c.channel===_)&&c.scale&&De(c)===j.LOG)return!1}return!0}},{name:"omitMultipleNonPositionalChannels",description:"Unless manually specified, do not use multiple non-positional encoding channel to avoid over-encoding.",properties:[g.CHANNEL],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{const o=e.specQuery.encodings;let i=0,c=!1;for(let u=0;u1&&(c||n.constraintManuallySpecifiedValue)))return!1}return!0}},{name:"omitNonPositionalOrFacetOverPositionalChannels",description:"Do not use non-positional channels unless all positional channels are used",properties:[g.CHANNEL],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{const o=e.specQuery.encodings;let i=!1,c=!1,u=!1,a=!1;for(let r=0;r!!e.isAggregate()},{name:"omitRawContinuousFieldForAggregatePlot",description:"Aggregate plot should not use raw continuous field as group by values. (Quantitative should be binned. Temporal should have time unit.)",properties:[g.AGGREGATE,g.AUTOCOUNT,g.TIMEUNIT,g.BIN,g.TYPE],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{if(e.isAggregate()){const o=e.specQuery.encodings;for(let i=0;i!!e.isAggregate()||fe(e.specQuery.encodings,(o,i)=>!(!oe(o)&&!ae(o))||o.channel!==an||!e.wildcardIndex.hasEncodingProperty(i,g.CHANNEL)&&!n.constraintManuallySpecifiedValue)},{name:"omitRepeatedField",description:"Each field should be mapped to only one channel",properties:[g.FIELD],allowWildcardForProperties:!0,strict:!1,satisfy:(e,t,n)=>{let o={},i={};const c=e.specQuery.encodings;for(let u=0;u{const o=e.getEncodings();return o.length!==1||o[0].channel!==_}},{name:"hasAppropriateGraphicTypeForMark",description:"Has appropriate graphic type for mark",properties:[g.CHANNEL,g.MARK,g.TYPE,g.TIMEUNIT,g.BIN,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{const o=e.getMark();switch(o){case Ue:case tt:if(e.isAggregate()){const l=e.getEncodingQueryByChannel(D),f=e.getEncodingQueryByChannel(_),p=at(l),h=at(f);return l&&f&&p!==h&&!(A(l)&&!p&&te(["nominal","key"],l.type))&&!(A(f)&&!h&&te(["nominal","key"],f.type))}return!0;case Ot:return!0;case me:case rt:if(e.channelEncodingField(Te))return!1;{const l=e.getEncodingQueryByChannel(D),f=e.getEncodingQueryByChannel(_);return at(l)!==at(f)}case mn:const i=e.getEncodingQueryByChannel(D),c=e.getEncodingQueryByChannel(_),u=Ne(i),a=Ne(c),r=e.getEncodingQueryByChannel(de),s=at(r),d=!!A(r)&&r.type===ce;return(u&&a||u&&!e.channelUsed(_)||a&&!e.channelUsed(D))&&(!r||r&&(s||d));case kt:case nt:case Mt:case yn:return!0}throw new Error("hasAllRequiredChannelsForMark not implemented for mark"+o)}},{name:"omitInvalidStackSpec",description:"If stack is specified, must follow Vega-Lite stack rules",properties:[g.STACK,g.FIELD,g.CHANNEL,g.MARK,g.AGGREGATE,g.AUTOCOUNT,g.SCALE,ge("scale","type"),g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{if(!e.wildcardIndex.hasProperty(g.STACK))return!0;const o=e.getVlStack();return(o!==null||e.getStackOffset()===null)&&o.fieldChannel===e.getStackChannel()}},{name:"omitNonSumStack",description:"Stack specifications that use non-summative aggregates should be omitted (even implicit ones)",properties:[g.CHANNEL,g.MARK,g.AGGREGATE,g.AUTOCOUNT,g.SCALE,ge("scale","type"),g.TYPE],allowWildcardForProperties:!1,strict:!0,satisfy:(e,t,n)=>{const o=e.getVlStack();if(o!=null){const i=e.getEncodingQueryByChannel(o.fieldChannel);if(!te(Pr,i.aggregate))return!1}return!0}},{name:"omitTableWithOcclusionIfAutoAddCount",description:"Plots without aggregation or autocount where x and y are both discrete should be omitted if autoAddCount is enabled as they often lead to occlusion",properties:[g.CHANNEL,g.TYPE,g.TIMEUNIT,g.BIN,g.AGGREGATE,g.AUTOCOUNT],allowWildcardForProperties:!1,strict:!1,satisfy:(e,t,n)=>{if(n.autoAddCount){const o=e.getEncodingQueryByChannel("x"),i=e.getEncodingQueryByChannel("y");if((!A(o)||Ne(o))&&(!A(i)||Ne(i)))return!!e.isAggregate()&&fe(e.getEncodings(),c=>{let u=c.channel;return!(u!==D&&u!==_&&u!==ne&&u!==ee&&A(c)&&!c.aggregate)})}return!0}}].map(e=>new vs(e));Pi.reduce((e,t)=>(e[t.name()]=t,e),{});const bs=Pi.reduce((e,t)=>{for(const n of t.properties())e.set(n,e.get(n)||[]),e.get(n).push(t);return e},new J);function Ri(e,t,n,o,i){const c=bs.get(e)||[];for(const u of c)if((u.strict()||i[u.name()])&&!u.satisfy(n,o,i)){let a="(spec) "+u.name();return i.verbose&&console.log(a+" failed with "+n.toShorthand()+" for "+t.name),a}return null}const $t=new J;function $i(e){return(t,n,o)=>(i,c)=>{const u=t.encodingIndicesByProperty.get(e);return function a(r){if(r===u.length)return void i.push(c.duplicate());const s=u[r],d=t.encodings[s].get(e),l=c.getEncodingQueryByIndex(s),f=c.getEncodingProperty(s,e);oe(l)||ae(l)||!f?a(r+1):(d.enum.forEach(p=>{p===null&&(p=void 0),c.setEncodingProperty(s,e,p,d),!function(m,v,b,y,E,T){const S=gs.get(m)||[],N=y.getEncodingQueryByIndex(b);for(const O of S)if((O.strict()||T[O.name()])&&!O.satisfy(N,E,y.wildcardIndex.encodings[b],T)){let M="(enc) "+O.name();return T.verbose&&console.log(M+" failed with "+y.toShorthand()+" for "+v.name),M}const C=ms.get(m)||[];for(const O of C)if((O.strict()||T[O.name()])&&oe(N)&&!O.satisfy(N,E,y.wildcardIndex.encodings[b],T)){let M="(enc) "+O.name();return T.verbose&&console.log(M+" failed with "+y.toShorthand()+" for "+v.name),M}return null}(e,d,s,c,n,o)&&(Ri(e,d,c,n,o)||a(r+1))}),c.resetEncodingProperty(s,e,d))}(0),i}}function ct(e,t,n){return t=t||new J,n=n||new J,e.forEach(o=>{var i;i=o,k.isObject(i)&&i.property?(t.setByKey(o.property,!0),n.setByKey(o.property,o.replace)):t.setByKey(o,!0)}),{include:t,replaceIndex:n,replacer:Oa(n)}}$t.set("mark",(e,t,n)=>(o,i)=>(i.getMark().enum.forEach(c=>{i.setMark(c),Ri("mark",e.mark,i,t,n)||o.push(i.duplicate())}),i.resetMark(),o)),pn.forEach(e=>{$t.set(e,$i(e))}),Ct.forEach(e=>{$t.set(e,$i(e))});const Bi=[g.FIELD,g.TYPE,g.AGGREGATE,g.BIN,g.TIMEUNIT,g.STACK],xs=Bi.concat([{property:g.CHANNEL,replace:{x:"xy",y:"xy",color:"style",size:"style",shape:"style",opacity:"style",row:"facet",column:"facet"}}]);let Fn={};function Bt(e,t){Fn[e]=t}const Li=ct([g.FIELD]);Bt("field",e=>qe(e,Li.include,Li.replacer));const Wi=ct(Bi);Bt("fieldTransform",e=>qe(e,Wi.include,Wi.replacer));const Hi=ct(xs);Bt("encoding",e=>qe(e,Hi.include,Hi.replacer)),Bt("spec",e=>JSON.stringify(e));class Es{constructor(){this._mark=void 0,this._encodings={},this._encodingIndicesByProperty=new J}setEncodingProperty(t,n,o){const i=this._encodings;(i[t]=i[t]||new J).set(n,o);const c=this._encodingIndicesByProperty;return c.set(n,c.get(n)||[]),c.get(n).push(t),this}hasEncodingProperty(t,n){return!!this._encodings[t]&&this._encodings[t].has(n)}hasProperty(t){if(Ir(t))return this.encodingIndicesByProperty.has(t);if(t==="mark")return!!this.mark;throw new Error("Unimplemented for property "+t)}isEmpty(){return!this.mark&&this.encodingIndicesByProperty.size()===0}setMark(t){return this._mark=t,this}get mark(){return this._mark}get encodings(){return this._encodings}get encodingIndicesByProperty(){return this._encodingIndicesByProperty}}class Qt{constructor(t,n,o,i,c){this._rankingScore={},this._spec=t,this._channelFieldCount=t.encodings.reduce((u,a)=>(w(a.channel)||H(a)&&a.autoCount===!1||(u[a.channel+""]=1),u),{}),this._wildcardIndex=n,this._assignedWildcardIndex=c,this._opt=i,this._schema=o}static build(t,n,o){let i=new Es;if(w(t.mark)){const c=it(g.MARK);t.mark=xn(t.mark,c,o.enum.mark),i.setMark(t.mark)}if(t.encodings.forEach((c,u)=>{H(c)&&(console.warn("A field with autoCount should not be included as autoCount meant to be an internal object."),c.type=R),A(c)&&c.type===void 0&&(c.type=P),pn.forEach(a=>{if(w(c[a])){const r=it(a)+u,s=Tn(a,n,o),d=c[a]=xn(c[a],r,s);i.setEncodingProperty(u,a,d)}}),Ct.forEach(a=>{const r=c[a.parent];if(r){const s=a.child;if(w(r[s])){const d=it(a)+u,l=Tn(a,n,o),f=r[s]=xn(r[s],d,l);i.setEncodingProperty(u,a,f)}}})}),o.autoAddCount){const c={name:it(g.CHANNEL)+t.encodings.length,enum:Tn(g.CHANNEL,n,o)},u={name:it(g.AUTOCOUNT)+t.encodings.length,enum:[!1,!0]},a={channel:c,autoCount:u,type:R};t.encodings.push(a);const r=t.encodings.length-1;i.setEncodingProperty(r,g.CHANNEL,c),i.setEncodingProperty(r,g.AUTOCOUNT,u)}return new Qt(t,i,n,o,{})}get wildcardIndex(){return this._wildcardIndex}get schema(){return this._schema}get specQuery(){return this._spec}duplicate(){return new Qt(k.duplicate(this._spec),this._wildcardIndex,this._schema,this._opt,k.duplicate(this._assignedWildcardIndex))}setMark(t){const n=this._wildcardIndex.mark.name;this._assignedWildcardIndex[n]=this._spec.mark=t}resetMark(){const t=this._spec.mark=this._wildcardIndex.mark;delete this._assignedWildcardIndex[t.name]}getMark(){return this._spec.mark}getEncodingProperty(t,n){const o=this._spec.encodings[t];return pe(n)?o[n.parent][n.child]:o[n]}setEncodingProperty(t,n,o,i){const c=this._spec.encodings[t];n===g.CHANNEL&&c.channel&&!w(c.channel)&&this._channelFieldCount[c.channel]--,pe(n)?c[n.parent][n.child]=o:hn(n)&&o===!0?c[n]=k.extend({},c[n],{enum:void 0,name:void 0}):c[n]=o,this._assignedWildcardIndex[i.name]=o,n===g.CHANNEL&&(this._channelFieldCount[o]=(this._channelFieldCount[o]||0)+1)}resetEncodingProperty(t,n,o){const i=this._spec.encodings[t];n===g.CHANNEL&&this._channelFieldCount[i.channel]--,pe(n)?i[n.parent][n.child]=o:i[n]=o,delete this._assignedWildcardIndex[o.name]}channelUsed(t){return this._channelFieldCount[t]>0}channelEncodingField(t){return A(this.getEncodingQueryByChannel(t))}getEncodings(){return this._spec.encodings.filter(t=>!ae(t))}getEncodingQueryByChannel(t){for(let n of this._spec.encodings)if(n.channel===t)return n}getEncodingQueryByIndex(t){return this._spec.encodings[t]}isAggregate(){return he(this._spec.encodings,t=>A(t)&&!w(t.aggregate)&&!!t.aggregate||Dt(t))}getVlStack(){return Hr(this._spec)}getStackOffset(){return function(t){for(const n of t.encodings)if(n[g.STACK]!==void 0&&!w(n[g.STACK]))return n[g.STACK]}(this._spec)}getStackChannel(){return function(t){for(const n of t.encodings)if(n[g.STACK]!==void 0&&!w(n.channel))return n.channel;return null}(this._spec)}toShorthand(t){if(t){if(k.isString(t))return function(o,i){return Fn[i](o)}(this.specQuery,t);const n=ct(t);return qe(this._spec,n.include,n.replacer)}return qe(this._spec)}toSpec(t){if(w(this._spec.mark))return null;let n={};return(t=t||this._spec.data)&&(n.data=t),this._spec.transform&&(n.transform=this._spec.transform),n.mark=this._spec.mark,n.encoding=Qr(this.specQuery.encodings,{schema:this._schema,wildcardMode:"null"}),this._spec.width&&(n.width=this._spec.width),this._spec.height&&(n.height=this._spec.height),this._spec.background&&(n.background=this._spec.background),this._spec.padding&&(n.padding=this._spec.padding),this._spec.title&&(n.title=this._spec.title),n.encoding===null?null:((this._spec.config||this._opt.defaultSpecConfig)&&(n.config=k.extend({},this._opt.defaultSpecConfig,this._spec.config)),n)}getRankingScore(t){return this._rankingScore[t]}setRankingScore(t,n){this._rankingScore[t]=n}}function qi(e){return e.items!==void 0}function Dn(e){let t=e.items[0];for(;t&&qi(t);)t=t.items[0];return t}class Ge{constructor(t){this.type=t,this.scoreIndex=this.initScore()}getFeatureScore(t){const n=this.type,o=this.scoreIndex[t];if(o!==void 0)return{type:n,feature:t,score:o}}}var Z;(function(e){e[e.Q=R]="Q",e[e.BIN_Q="bin_"+R]="BIN_Q",e[e.T=Q]="T",e[e.TIMEUNIT_T="timeUnit_time"]="TIMEUNIT_T",e[e.TIMEUNIT_O="timeUnit_"+ce]="TIMEUNIT_O",e[e.O=ce]="O",e[e.N=ie]="N",e[e.K=le.KEY]="K",e[e.NONE="-"]="NONE"})(Z||(Z={}));const Gi=Z.Q,Lt=Z.BIN_Q,_n=Z.T,ze=Z.TIMEUNIT_T,Wt=Z.TIMEUNIT_O,Ht=Z.O,qt=Z.N,jn=Z.K,Gt=Z.NONE;function zt(e){return e.bin?Z.BIN_Q:e.timeUnit?Ie(De(e))?Z.TIMEUNIT_O:Z.TIMEUNIT_T:e.type}const Pn=-10;function q(e,t,n,o){return e+"_"+t+"_"+n+"_"+o}const Ts=[new class extends Ge{constructor(){super("Axis")}initScore(e={}){e=Object.assign({},ot,e);let t={};return[{feature:Lt,opt:"preferredBinAxis"},{feature:_n,opt:"preferredTemporalAxis"},{feature:ze,opt:"preferredTemporalAxis"},{feature:Wt,opt:"preferredTemporalAxis"},{feature:Ht,opt:"preferredOrdinalAxis"},{feature:qt,opt:"preferredNominalAxis"}].forEach(n=>{e[n.opt]===D?t[n.feature+"_"+_]=-.01:e[n.opt]===_&&(t[n.feature+"_"+D]=-.01)}),t}featurize(e,t){return e+"_"+t}getScore(e,t,n){return e.getEncodings().reduce((o,i)=>{if(A(i)||H(i)){const c=zt(i),u=this.featurize(c,i.channel),a=this.getFeatureScore(u);a&&o.push(a)}return o},[])}},new class extends Ge{constructor(){super("Dimension")}initScore(){return{row:-2,column:-2,color:0,opacity:0,size:0,shape:0}}getScore(e,t,n){return e.isAggregate()&&e.getEncodings().reduce((o,i)=>{if(H(i)||A(i)&&!i.aggregate){const c=this.getFeatureScore(i.channel+"");if(c&&c.score>o.score)return c}return o},{type:"Dimension",feature:"No Dimension",score:-5}),[]}},new class extends Ge{constructor(){super("Facet")}initScore(e){let t={};return(e=Object.assign({},ot,e)).preferredFacet===ne?t[ee]=-.01:e.preferredFacet===ee&&(t[ne]=-.01),t}getScore(e,t,n){return e.getEncodings().reduce((o,i)=>{if(A(i)||H(i)){const c=this.getFeatureScore(i.channel);c&&o.push(c)}return o},[])}},new class extends Ge{constructor(){super("Mark")}initScore(){return function(){const e=[Gi,_n],t=[Lt,Wt,Ht,qt,jn].concat([Gt]);let n={};e.forEach(o=>{e.forEach(i=>{V({point:0,text:-.2,tick:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!0,u);n[a]=c}),V({point:0,text:-.2,tick:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c})})}),e.forEach(o=>{t.forEach(i=>{V({tick:0,point:-.2,text:-.5,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!0,u);n[a]=c;const r=q(i,o,!0,u);n[r]=c})}),[ze].forEach(i=>{V({point:0,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!0,u);n[a]=c;const r=q(i,o,!0,u);n[r]=c})}),[Gt,qt,Ht,jn].forEach(i=>{V({bar:0,point:-.2,tick:-.25,text:-.3,line:-2,area:-2,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c;const r=q(i,o,!1,u);n[r]=c})}),[Lt].forEach(i=>{V({bar:0,point:-.2,tick:-.25,text:-.3,line:-.5,area:-.5,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c;const r=q(i,o,!1,u);n[r]=c})}),[ze,Wt].forEach(i=>{V({line:0,area:-.1,bar:-.2,point:-.3,tick:-.35,text:-.4,rule:-2.5},(c,u)=>{const a=q(o,i,!1,u);n[a]=c;const r=q(i,o,!1,u);n[r]=c})})}),[ze].forEach(o=>{[ze].forEach(i=>{const c={point:0,rect:-.1,text:-.5,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};V(c,(u,a)=>{const r=q(o,i,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(o,i,!1,a);n[r]=u})}),t.forEach(i=>{const c={tick:0,point:-.2,text:-.5,rect:-1,bar:-2,line:-2,area:-2,rule:-2.5};V(c,(u,a)=>{const r=q(o,i,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(i,o,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(o,i,!1,a);n[r]=u}),V(c,(u,a)=>{const r=q(i,o,!1,a);n[r]=u})})});for(const o of t)for(const i of t){const c={point:0,rect:0,text:-.1,tick:-1,bar:-2,line:-2,area:-2,rule:-2.5};V(c,(u,a)=>{const r=q(o,i,!0,a);n[r]=u}),V(c,(u,a)=>{const r=q(o,i,!1,a);n[r]=u})}return n}()}getScore(e,t,n){let o=e.getMark();o!==kt&&o!==Mt||(o=nt);const i=e.getEncodingQueryByChannel(D),c=i?zt(i):Gt,u=e.getEncodingQueryByChannel(_),a=c+"_"+(u?zt(u):Gt)+"_"+!e.isAggregate()+"_"+o,r=this.getFeatureScore(a);return r?[r]:(console.error("feature score missing for",a),[])}},new class extends Ge{constructor(){super("SizeChannel")}initScore(){return{bar_size:-2,tick_size:-2}}getScore(e,t,n){const o=e.getMark();return e.getEncodings().reduce((i,c)=>{if(A(c)||H(c)){const u=o+"_"+c.channel,a=this.getFeatureScore(u);a&&i.push(a)}return i},[])}},new class extends Ge{constructor(){super("TypeChannel")}initScore(){let e={};const t={x:0,y:0,size:-.575,color:-.725,text:-2,opacity:-3,shape:Pn,row:Pn,column:Pn,detail:-20};[Gi,_n,ze].forEach(i=>{k.keys(t).forEach(c=>{e[this.featurize(i,c)]=t[c]})});const n=k.extend({},t,{row:-.75,column:-.75,shape:-3.1,text:-3.2,detail:-4});[Lt,Wt,Ht].forEach(i=>{k.keys(n).forEach(c=>{e[this.featurize(i,c)]=n[c]})});const o={x:0,y:0,color:-.6,shape:-.65,row:-.7,column:-.7,text:-.8,detail:-2,size:-3,opacity:-3.1};return k.keys(o).forEach(i=>{e[this.featurize(qt,i)]=o[i],e[this.featurize(jn,i)]=te(["x","y","detail"],i)?-1:o[i]-2}),e}featurize(e,t){return e+"_"+t}getScore(e,t,n){const o=e.getEncodings().reduce((c,u)=>{if(A(u)||H(u)){const a=zr(u);(c[a]=c[a]||[]).push(u)}return c},{}),i=[];return V(o,c=>{const u=c.reduce((a,r)=>{if(A(r)||H(r)){const s=zt(r),d=this.featurize(s,r.channel),l=this.getFeatureScore(d);if(a===null||l.score>a.score)return l}return a},null);i.push(u)}),i}}],Ce="aggregationQuality";let zi={};function Rn(e,t){zi[e]=t}function Yi(e,t,n,o){return t.nest&&o!==t.nest.length?(e.items.forEach(i=>{Yi(i,t,n,o+1)}),t.nest[o].orderGroupBy&&e.items.sort(function(i,c,u){return(a,r)=>{const s=Dn(a),d=Dn(r);return Qi(i instanceof Array?i:[i],s,d,c,u)}}(t.nest[o].orderGroupBy,n,t.config))):(t.orderBy||t.chooseBy)&&(e.items.sort(function(i,c,u){return(a,r)=>Qi(i instanceof Array?i:[i],a,r,c,u)}(t.orderBy||t.chooseBy,n,t.config)),t.chooseBy&&e.items.length>0&&e.items.splice(1)),e}function Qi(e,t,n,o,i){for(let c of e){let u=Vi(n,c,o,i).score-Vi(t,c,o,i).score;if(u!==0)return u}return 0}function Vi(e,t,n,o){if(e.getRankingScore(t)!==void 0)return e.getRankingScore(t);const i=function(u){return zi[u]}(t),c=i(e,n,o);return e.setRankingScore(t,c),c}function Ss(e,t,n){let o={};return e=e.map(function(i){return n.smallRangeStepForHighCardinalityOrFacet&&(i=function(c,u,a,r){[ne,_,ee,D].forEach(l=>{a[l]=c.getEncodingQueryByChannel(l)});const s=a[_];if(s!==void 0&&A(s)&&(a[ne]||u.cardinality(s)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){s.scale===void 0&&(s.scale={});const l=De(s);s.scale&&(l===void 0||Ie(l))&&(s.scale.rangeStep||(s.scale.rangeStep=12))}const d=a[D];if(A(d)&&(a[ee]||u.cardinality(d)>r.smallRangeStepForHighCardinalityOrFacet.maxCardinality)){d.scale===void 0&&(d.scale={});const l=De(d);d.scale&&(l===void 0||Ie(l))&&(d.scale.rangeStep||(d.scale.rangeStep=12))}return c}(i,t,o,n)),n.nominalColorScaleForHighCardinality&&(i=function(c,u,a,r){a[de]=c.getEncodingQueryByChannel(de);const s=a[de];return A(s)&&s!==void 0&&(s.type===ie||s.type===le.KEY)&&u.cardinality(s)>r.nominalColorScaleForHighCardinality.maxCardinality&&(s.scale===void 0&&(s.scale={}),s.scale&&(s.scale.range||(s.scale.scheme=r.nominalColorScaleForHighCardinality.palette))),c}(i,t,o,n)),n.xAxisOnTopForHighYCardinalityWithoutColumn&&(i=function(c,u,a,r){if([ee,D,_].forEach(s=>{a[s]=c.getEncodingQueryByChannel(s)}),a[ee]===void 0){const s=a[D],d=a[_];A(s)&&A(d)&&d!==void 0&&d.field&&Ie(De(d))&&s!==void 0&&u.cardinality(d)>r.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality&&(s.axis===void 0&&(s.axis={}),s.axis&&!s.axis.orient&&(s.axis.orient="top"))}return c}(i,t,o,n)),i}),e}function ws(e,t,n=ot){const o=Qt.build(e,t,n),i=o.wildcardIndex;let c=[o];return n.propertyPrecedence.forEach(u=>{const a=function(r){const s=r.split(".");if(s.length===1)return r;if(s.length===2)return{parent:s[0],child:s[1]};throw"Invalid property key with "+s.length+" dots: "+r}(u);if(i.hasProperty(a)){const r=function(d){return $t.get(d)}(a),s=r(i,t,n);c=c.reduce(s,[])}}),!n.stylize||n.nominalColorScaleForHighCardinality===null&&n.smallRangeStepForHighCardinalityOrFacet===null&&n.xAxisOnTopForHighYCardinalityWithoutColumn===null?c:Ss(c,t,n)}function Ki(e,t,n){return e=Object.assign({},function(o){if(o.groupBy){let i={groupBy:o.groupBy};o.orderBy&&(i.orderGroupBy=o.orderBy);let c={spec:k.duplicate(o.spec),nest:[i]};return o.chooseBy&&(c.chooseBy=o.chooseBy),o.config&&(c.config=o.config),c}return k.duplicate(o)}(e),{config:Object.assign({},ot,n,e.config)}),{query:e,result:Yi(function(o,i){if(i){const c={name:"",path:"",items:[]};let u={},a=[],r=[],s=[];for(let d=0;d0?a[d-1].duplicate():new J),r.push(d>0?r[d-1].duplicate():new J);const l=i[d].groupBy;if(k.isArray(l)){let f=ct(l,a[d],r[d]);s.push(f.replacer)}}return o.forEach(d=>{let l="",f=c;for(let p=0;p{const u=c.getScore(e,t,n);return i.concat(u)},[]);return{score:o.reduce((i,c)=>i+c.score,0),features:o}}),Rn(Ce,function(e,t,n){const o=function(i){const c=i.getEncodings();if(i.isAggregate()){if(he(c,u=>A(u)&&(u.type===R&&!u.bin&&!u.aggregate||u.type===Q&&!u.timeUnit)))return{type:Ce,score:.1,feature:"Aggregate with raw continuous"};if(he(c,u=>A(u)&&Ne(u))){let u=he(c,r=>A(r)&&r.aggregate==="count"||Dt(r)),a=he(c,r=>A(r)&&!!r.bin);return u?{type:Ce,score:.8,feature:"Aggregate with count"}:a?{type:Ce,score:.7,feature:"Aggregate with bin but without count"}:{type:Ce,score:.9,feature:"Aggregate without count and without bin"}}return{type:Ce,score:.3,feature:"Aggregate without dimension"}}return he(c,u=>A(u)&&!Ne(u))?{type:Ce,score:1,feature:"Raw with measure"}:{type:Ce,score:.2,feature:"Raw without measure"}}(e);return{score:o.score,features:[o]}}),Rn("fieldOrder",function(e,t,n){const o=e.wildcardIndex.encodingIndicesByProperty.get("field");if(!o)return{score:0,features:[]};const i=e.specQuery.encodings,c=t.fieldSchemas.length,u=[];let a=0,r=1;for(let s=o.length-1;s>=0;s--){const d=o[s],l=i[d];let f;if(!A(l))continue;f=l.field;const p=e.wildcardIndex.encodings[d].get("field"),h=t.fieldSchema(f).index,m=-h*r;a+=m,u.push({score:m,type:"fieldOrder",feature:`field ${p.name} is ${f} (#${h} in the schema)`}),r*=c}return{score:a,features:u}});const Ye={[L.BOOLEAN]:x.jsx(yo,{className:"h-5 w-5 inline-flex opacity-60"}),[L.DATETIME]:x.jsx(mo,{className:"h-5 w-5 inline-flex opacity-60"}),[L.NUMBER]:x.jsx(go,{className:"h-5 w-5 inline-flex opacity-60"}),[L.STRING]:x.jsx(ho,{className:"h-5 w-5 inline-flex opacity-60"}),[L.INTEGER]:x.jsx(Wo,{className:"h-5 w-5 inline-flex opacity-60"})},Ns=e=>{const t=Ee.c(26),{schema:n}=e,[o,i]=Yn.useState(),[c,u]=Yn.useState();let a;if(t[0]!==n||t[1]!==o||t[2]!==c){const r=n.fieldNames(),s=o?n.stats({field:o,channel:"x"}):void 0;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=x.jsx(Lo,{className:"text-muted-foreground",width:40,height:40,strokeWidth:1.5}),t[4]=d):d=t[4];const l=d,f=c?r:r.slice(0,12),p=r.length>12,h=r.length>0?r.length:"No";let m,v;t[5]!==h?(m=x.jsxs("span",{className:"text-muted-foreground font-semibold",children:[h," fields"]}),t[5]=h,t[6]=m):m=t[6],t[7]!==n||t[8]!==o?(v=I=>{const F=n.cardinality({channel:"x",field:I});return x.jsxs("span",{className:vo("hover:bg-muted self-start px-2 py-2 rounded flex flex-row gap-1 items-center cursor-pointer lg:justify-center text-sm truncate flex-shrink-0 overflow-hidden",o===I&&"bg-muted"),onClick:()=>{i(o!==I?I:void 0)},children:[Ye[n.primitiveType(I)],I,F>1&&x.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",F,")"]})]},I)},t[7]=n,t[8]=o,t[9]=v):v=t[9];const b=f.map(v);let y,E;t[10]!==p||t[11]!==c?(y=p&&x.jsx(Qn,{"data-testid":"marimo-plugin-data-explorer-show-more-columns",variant:"link",size:"sm",className:"self-center col-span-3 -mt-1",onClick:()=>u(Os),children:c?"Show less":"Show more"}),t[10]=p,t[11]=c,t[12]=y):y=t[12],t[13]!==b||t[14]!==y?(E=x.jsxs("div",{className:"hidden lg:grid grid-cols-2 xl:grid-cols-3 gap-2 p-2 bg-[var(--slate-1)] border rounded lg:items-center items-start w-fit grid-flow-dense max-h-[300px] overflow-auto",children:[b,y]}),t[13]=b,t[14]=y,t[15]=E):E=t[15];const T=o||"",S=r.length===0;let N,C,O,M,U;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=I=>{i(I)},t[16]=N):N=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(C=x.jsx(pt,{className:"min-w-[210px] h-full",children:x.jsx(Vn,{placeholder:"Select a column"})}),t[17]=C):C=t[17],t[18]!==n?(O=n.fieldNames().map(I=>x.jsx(ke,{value:I.toString(),children:x.jsxs("span",{className:"flex items-center gap-2 flex-1",children:[Ye[n.primitiveType(I)],x.jsx("span",{className:"flex-1",children:I}),x.jsxs("span",{className:"text-muted-foreground text-xs font-semibold",children:["(",n.vlType(I),")"]})]})},I)),t[18]=n,t[19]=O):O=t[19],t[20]!==O?(M=x.jsx(ht,{children:x.jsx(Ke,{children:O})}),t[20]=O,t[21]=M):M=t[21],t[22]!==S||t[23]!==M||t[24]!==T?(U=x.jsx("div",{className:"lg:hidden",children:x.jsxs(gt,{"data-testid":"marimo-plugin-data-explorer-column-select",value:T,disabled:S,onValueChange:N,children:[C,M]})}),t[22]=S,t[23]=M,t[24]=T,t[25]=U):U=t[25],a=x.jsxs("div",{className:"flex flex-col justify-center items-center h-full flex-1 gap-2",children:[l,m,E,U,o&&x.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-2 p-2 text-sm",children:Cs.map(I=>x.jsxs("div",{className:"flex flex-row gap-2 min-w-[100px]",children:[x.jsx("span",{className:"font-semibold",children:I}),x.jsx("span",{children:As(s==null?void 0:s[I])})]},I))})]}),t[0]=n,t[1]=o,t[2]=c,t[3]=a}else a=t[3];return a},Cs=["distinct","min","max","mean","median","q1","q3","stdev"];function As(e){return typeof e=="number"?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):typeof e=="string"?e:typeof e=="object"&&e instanceof Date?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric"}).format(e):String(e)}function Os(e){return!e}function ks(e){return e?e==="bin"?{bin:!0}:Ro(e)?{aggregate:e}:function(t){return t?Ji.includes(t)||Xi.includes(t):!1}(e)?{timeUnit:e}:{}:{}}const Ms=["bin","min","max","mean","median","sum"],Ji=["year","month","date","day","hours","minutes","seconds","milliseconds"],Xi=["yearmonth","yearmonthdate","monthdate"],Is=[P,"area","bar","circle","geoshape","line","point","rect","rule","square","text","tick","trail"],Us={type:"histograms",limit:12,createQuery:e=>({spec:{data:e.spec.data,mark:P,transform:e.spec.transform,encodings:[{channel:P,bin:P,timeUnit:P,field:P,type:P},{channel:P,aggregate:"count",field:"*",type:"quantitative"}]},groupBy:"fieldTransform",orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:{autoAddCount:!1}})};function Zi(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Fs(e){const{aggregate:t,bin:n,timeUnit:o,field:i,scale:c,legend:u,axis:a,sort:r,description:s}=e;let{type:d}=e;if(w(d))throw new Error("Wildcard not support");d==="ordinal"&&(bo.warn("Ordinal type is not supported. Using nominal type instead."),d="nominal");const l=function(f){const{aggregate:p,bin:h,timeUnit:m}=f;return h?"bin":p?p.toString():m?m.toString():void 0}({aggregate:t,bin:n,timeUnit:o});return xo(i!==void 0,"Field is required for fieldQ"),Zi({field:i,fn:l,type:d,sort:r,scale:c,axis:a,legend:u,description:s})}function Ds(e){return e?Object.entries(e).map(([t,n])=>function(o,i){const{fn:c,...u}=o;return{channel:i,...ks(c),...u}}(n,t)):[]}function $n(e){const{type:t,limit:n,additionalFieldQuery:o}=e;return{type:t,limit:n,createQuery:i=>({spec:{...i.spec,encodings:[...i.spec.encodings,o]},groupBy:"field",orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:{autoAddCount:!0}})}}const _s=$n({type:"addCategoricalField",limit:4,additionalFieldQuery:{channel:P,field:P,type:"nominal"}}),js=$n({type:"addQuantitativeField",limit:4,additionalFieldQuery:{channel:P,bin:P,aggregate:P,field:P,type:"quantitative"}}),Ps=$n({type:"addTemporalField",limit:2,additionalFieldQuery:{channel:P,hasFn:!0,timeUnit:P,field:P,type:"temporal"}});function eo(e){return e.encodings.length===0}function to(e){let t=!1,n=!1,o=!1;for(const i of e.encodings)oe(i)||(H(i)?w(i.autoCount)&&(n=!0):(w(i.field)&&(t=!0),(w(i.aggregate)||w(i.bin)||w(i.timeUnit))&&(n=!0),w(i.channel)&&(o=!0)));return{hasAnyWildcard:o||t||n,hasWildcardField:t,hasWildcardFn:n,hasWildcardChannel:o}}const no={name:"source"};function Rs(e,t){const n={},{hasOpenPosition:o,hasStyleChannel:i,hasOpenFacet:c}=function(u){let a=!1,r=!1,s=!1;return u.encodings.forEach(d=>{d.channel==="x"||d.channel==="y"?a=!0:d.channel==="row"||d.channel==="column"?s=!0:typeof d.channel=="string"&&$o(Bo,d.channel)&&(r=!0)}),{hasOpenPosition:a,hasStyleChannel:r,hasOpenFacet:s}}(e.spec);return(o||i)&&(n.addQuantitativeField=Yt(js,e,t)),(o||i||c)&&(n.addCategoricalField=Yt(_s,e,t)),o&&(n.addTemporalField=Yt(Ps,e,t)),n}function Bn(e,t){return eo(e.spec)?{plots:[],query:e,limit:1}:{plots:[ro(Ki(e,t).result,no)[0]],query:e,limit:1}}function Yt(e,t,n){const o=e.createQuery(t);return{plots:ro(Ki(o,n).result,no),query:o,limit:e.limit}}function ro(e,t){return e.items.map(n=>qi(n)?io(t,Dn(n)):io(t,n))}function io(e,t){return{fieldInfos:t.getEncodings().filter(A).map(n=>({fieldDef:Fs(n),channel:n.channel})),spec:t.toSpec(e)}}function $s(e){const{spec:t,autoAddCount:n}=e,o=function(r){return{mark:r.mark,encodings:Ds(r.encoding),config:r.config}}(t),{hasAnyWildcard:i,hasWildcardFn:c,hasWildcardField:u}=to(o),a=function(r){const{hasWildcardFn:s,hasWildcardField:d}=r;return s?"fieldTransform":d?"field":"encoding"}({hasWildcardFn:c,hasWildcardField:u});return{spec:o,groupBy:a,orderBy:["fieldOrder","aggregationQuality","effectiveness"],chooseBy:["aggregationQuality","effectiveness"],config:i?{autoAddCount:n}:void 0}}const{valueAtom:Qe,useActions:Bs}=Eo(function(){return{mark:P,encoding:{},config:{},schema:null}},{setSchema:(e,t)=>({...e,schema:t}),setMark:(e,t)=>({...e,mark:t}),setEncoding:(e,t)=>{const n=Zi({...e.encoding,...t});return{...e,encoding:n}},set:(e,t)=>{const{schema:n,...o}=t;return{...e,...o}}});function oo(){return Bs()}const Ls=To(e=>{const t=e(Qe);if(!t.schema)return{};const n=$s({spec:t,autoAddCount:!0});return eo(n.spec)?{main:Bn(n,t.schema),histograms:Yt(Us,n,t.schema)}:function(o){return!to(o).hasAnyWildcard}(n.spec)&&!function(o){const i=new Set(o.encodings.map(a=>a.channel)),c=["x","y","color"].every(a=>i.has(a)),u=["row","column"].some(a=>i.has(a));return c&&u}(n.spec)?{main:Bn(n,t.schema),...Rs(n,t.schema)}:{main:Bn(n,t.schema)}}),Ws=["x","y","row","column"],Hs=["color","size","shape"],qs=e=>{const t=Ee.c(26),{schema:n,mark:o}=e,i=Kt(Qe),c=oo(),u=i.encoding.x&&i.encoding.y;let a;t[0]!==c||t[1]!==u||t[2]!==n||t[3]!==i.encoding?(a=S=>{const N=(S==="row"||S==="column")&&!u;return x.jsx(Gs,{schema:n,label:S,disabled:N,fieldDefinition:i.encoding[S],onChange:C=>c.setEncoding({[S]:C})},S)},t[0]=c,t[1]=u,t[2]=n,t[3]=i.encoding,t[4]=a):a=t[4];const r=a;let s,d,l,f,p;t[5]!==o?(s=o.toString(),t[5]=o,t[6]=s):s=t[6],t[7]!==c?(d=S=>c.setMark(S),t[7]=c,t[8]=d):d=t[8],t[9]===Symbol.for("react.memo_cache_sentinel")?(l=x.jsx(pt,{children:x.jsx(Vn,{placeholder:"Mark"})}),t[9]=l):l=t[9],t[10]===Symbol.for("react.memo_cache_sentinel")?(f=x.jsx(ht,{children:x.jsxs(Ke,{children:[x.jsx(Kn,{children:"Mark"}),Is.map(Ys)]})}),t[10]=f):f=t[10],t[11]!==s||t[12]!==d?(p=x.jsxs(gt,{"data-testid":"marimo-plugin-data-explorer-mark-select",value:s,onValueChange:d,children:[l,f]}),t[11]=s,t[12]=d,t[13]=p):p=t[13];const h=p;let m,v,b,y,E,T;return t[14]===Symbol.for("react.memo_cache_sentinel")?(m=x.jsx("span",{className:"col-span-2 flex items-center justify-between w-full",children:x.jsx("div",{className:"text-sm font-semibold",children:"Encodings"})}),t[14]=m):m=t[14],t[15]!==r?(v=Ws.map(r),t[15]=r,t[16]=v):v=t[16],t[17]===Symbol.for("react.memo_cache_sentinel")?(b=x.jsx("div",{children:"Mark"}),t[17]=b):b=t[17],t[18]!==h?(y=x.jsxs("span",{className:"col-span-2 text-sm font-semibold w-full border-t border-divider flex items-center justify-between pt-2 pr-[30px]",children:[b,h]}),t[18]=h,t[19]=y):y=t[19],t[20]!==r?(E=Hs.map(r),t[20]=r,t[21]=E):E=t[21],t[22]!==y||t[23]!==E||t[24]!==v?(T=x.jsxs("div",{className:"grid gap-x-2 gap-y-4 justify-items-start py-3 pl-4 pr-2 bg-[var(--slate-1)] border rounded items-center grid-template-columns-[repeat(2,_minmax(0,_min-content))] self-start",children:[m,v,y,E]}),t[22]=y,t[23]=E,t[24]=v,t[25]=T):T=t[25],T},Gs=e=>{const t=Ee.c(43),{label:n,schema:o,fieldDefinition:i,disabled:c,onChange:u}=e;let a;t[0]!==i||t[1]!==o?(a=()=>{if(!i)return"--";if(i.field==="*")return x.jsxs("span",{className:"flex gap-2 flex-1",children:[Ye[L.NUMBER],x.jsx("span",{className:"text-left flex-1",children:"Count"})]});const F=i.field.toString();return x.jsxs("span",{className:"flex gap-2 flex-1",children:[Ye[o.primitiveType(F)],x.jsx("span",{className:"text-left flex-1",children:i.fn?`${i.fn}(${i.field})`:F})]})},t[0]=i,t[1]=o,t[2]=a):a=t[2];const r=a;let s;t[3]!==u?(s=()=>{u(void 0)},t[3]=u,t[4]=s):s=t[4];const d=s;let l;t[5]!==(i==null?void 0:i.field)?(l=(i==null?void 0:i.field.toString())??"",t[5]=i==null?void 0:i.field,t[6]=l):l=t[6];const f=l;let p,h;t[7]!==n?(p=x.jsx(So,{className:"text-[var(--slate-11)] font-semibold",children:n}),t[7]=n,t[8]=p):p=t[8],t[9]!==u||t[10]!==o?(h=F=>{u(F==="*"?{field:"*",fn:"count",type:"quantitative"}:{field:F,type:o.vlType(F)})},t[9]=u,t[10]=o,t[11]=h):h=t[11];const m=f?d:void 0;let v,b,y,E,T,S,N,C,O,M,U,I;return t[12]!==r?(v=r(),t[12]=r,t[13]=v):v=t[13],t[14]!==m||t[15]!==v?(b=x.jsx(pt,{className:"min-w-[140px] lg:min-w-[210px] h-full",onClear:m,children:v}),t[14]=m,t[15]=v,t[16]=b):b=t[16],t[17]!==o?(y=o.fieldNames().map(F=>x.jsx(ke,{value:F.toString(),children:x.jsxs("span",{className:"flex items-center gap-2 flex-1",children:[Ye[o.primitiveType(F)],x.jsx("span",{className:"flex-1",children:F}),x.jsxs("span",{className:"text-muted-foreground text-xs font-semibold",children:["(",o.vlType(F),")"]})]})},F)),t[17]=o,t[18]=y):y=t[18],t[19]!==o?(E=o.fieldNames().length===0&&x.jsx(ke,{disabled:!0,value:"--",children:"No columns"}),t[19]=o,t[20]=E):E=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(T=x.jsx(Jn,{}),t[21]=T):T=t[21],t[22]===Symbol.for("react.memo_cache_sentinel")?(S=x.jsx(ke,{value:"*",children:x.jsxs("span",{className:"flex items-center gap-1 flex-1",children:[Ye[L.NUMBER],x.jsx("span",{className:"flex-1",children:"Count"})]})},"*"),t[22]=S):S=t[22],t[23]!==E||t[24]!==y?(N=x.jsx(ht,{children:x.jsxs(Ke,{children:[y,E,T,S]})}),t[23]=E,t[24]=y,t[25]=N):N=t[25],t[26]!==c||t[27]!==f||t[28]!==N||t[29]!==h||t[30]!==b?(C=x.jsxs(gt,{value:f,disabled:c,onValueChange:h,children:[b,N]}),t[26]=c,t[27]=f,t[28]=N,t[29]=h,t[30]=b,t[31]=C):C=t[31],t[32]!==i||t[33]!==u?(O=i&&x.jsx(zs,{field:i,onChange:u}),t[32]=i,t[33]=u,t[34]=O):O=t[34],t[35]!==O?(M=x.jsx("div",{className:"w-[26px]",children:O}),t[35]=O,t[36]=M):M=t[36],t[37]!==C||t[38]!==M?(U=x.jsxs("div",{className:"flex flex-row gap-1 h-[26px]",children:[C,M]}),t[37]=C,t[38]=M,t[39]=U):U=t[39],t[40]!==U||t[41]!==p?(I=x.jsxs(x.Fragment,{children:[p,U]}),t[40]=U,t[41]=p,t[42]=I):I=t[42],I},Ln="__",zs=e=>{const t=Ee.c(15),{field:n,onChange:o}=e;if(n.field==="*")return null;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[0]=i):i=t[0];let c=i;if(n.type===le.QUANTITATIVE){let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=[["",Ms]],t[1]=u):u=t[1],c=u}if(n.type===le.TEMPORAL){let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=[["Single",Ji],["Multi",Xi]],t[2]=u):u=t[2],c=u}if(c.length>0){let u,a,r,s,d,l;return t[3]!==n||t[4]!==o?(u=f=>{o({...n,fn:f===Ln?void 0:f})},t[3]=n,t[4]=o,t[5]=u):u=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(a=x.jsx(pt,{className:"h-full px-1",hideChevron:!0,variant:"ghost",children:x.jsx(No,{size:14,strokeWidth:1.5})}),t[6]=a):a=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(r=x.jsx(Ke,{children:x.jsx(ke,{value:Ln,children:"None"})}),s=x.jsx(Jn,{}),t[7]=r,t[8]=s):(r=t[7],s=t[8]),t[9]!==c?(d=x.jsxs(ht,{children:[r,s,c.map(Vs)]}),t[9]=c,t[10]=d):d=t[10],t[11]!==n.fn||t[12]!==u||t[13]!==d?(l=x.jsxs(gt,{"data-testid":"marimo-plugin-data-explorer-field-options",value:n.fn,onValueChange:u,children:[a,d]}),t[11]=n.fn,t[12]=u,t[13]=d,t[14]=l):l=t[14],l}return null};function Ys(e){return x.jsx(ke,{value:e,children:e===P?"auto":e},e)}function Qs(e){return x.jsx(ke,{value:e??Ln,children:wo(e)},e)}function Vs(e){const[t,n]=e;return x.jsxs(Ke,{children:[t&&x.jsx(Kn,{children:t}),n.map(Qs)]},t)}const Ks=e=>{const t=Ee.c(5);let n,o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=Co(),t[0]=o):o=t[0],n=o;const i=n;let c,u;return t[1]!==e?(c=()=>{const a=i.sub(Qe,()=>{const s=i.get(Qe),{schema:d,...l}=s;e.setValue(l)}),r=e.value;return r&&Object.keys(r).length>0&&i.set(Qe,r),a},t[1]=e,t[2]=c):c=t[2],Ao(c),t[3]!==e?(u=x.jsx(Oo,{store:i,children:x.jsx(ao,{...e})}),t[3]=e,t[4]=u):u=t[4],u},Js={export:{svg:!0,png:!0},source:!1,compiled:!1,editor:!1},Xs={left:20,right:20,top:20,bottom:20},ao=e=>{var Ae,ye,ve,be,lt,Wn;const t=Ee.c(43),{data:n}=e,o=oo();let i,c;t[0]!==o||t[1]!==n?(i=async()=>{if(!n)return{};const $=await Io(n,{type:"csv",parse:"auto"},{replacePeriod:!0}),Pe=function(xe,z={},Ve={fields:[]}){z=k.extend({},ot,z);let so=fs.summary(xe),Hn=ds.inferAll(xe),co=Ve.fields.reduce((B,se)=>(B[se.name]=se,B),{}),qn=so.map(function(B,se){const Re=B.field,ut=Hn[Re]==="date"?L.DATETIME:Hn[Re];let Oe,Vt=B.distinct;if(ut===L.NUMBER)Oe=R;else if(ut===L.INTEGER)Oe=VtB.max.getTime()&&(B.max=new Date(ft))}}else Oe=ie;Oe===ie&&Vt/B.count>z.minPercentUniqueForKey&&B.count>z.minCardinalityForKey&&(Oe=le.KEY);let dt={name:Re,originalIndex:se,vlType:Oe,type:ut,stats:B,timeStats:{},binStats:{}};const uo=co[dt.name];return dt=k.extend(dt,uo),dt});for(let B of qn)if(B.vlType===R)for(let se of z.enum.binProps.maxbins)B.binStats[se]=Mi(se,B.stats);else if(B.vlType===Q)for(let se of z.enum.timeUnit)se!==void 0&&(B.timeStats[se]=Ii(se,B.stats));const lo=Object.assign({},Ve,{fields:qn});return new hs(lo)}($);return o.setSchema(Pe),{chartData:$,schema:Pe}},t[0]=o,t[1]=n,t[2]=i):i=t[2],t[3]!==n?(c=[n],t[3]=n,t[4]=c):c=t[4];const{data:u,isPending:a,error:r}=ko(i,c),{mark:s}=Kt(Qe),d=Kt(Ls),{theme:l}=Mo();if(r){let $;return t[5]!==r?($=x.jsx(Uo,{error:r}),t[5]=r,t[6]=$):$=t[6],$}if(!u){let $;return t[7]===Symbol.for("react.memo_cache_sentinel")?($=x.jsx("div",{}),t[7]=$):$=t[7],$}const{chartData:f,schema:p}=u;if(a||!p){let $;return t[8]===Symbol.for("react.memo_cache_sentinel")?($=x.jsx("div",{}),t[8]=$):$=t[8],$}const h=(ye=(Ae=d.main)==null?void 0:Ae.plots)==null?void 0:ye[0];let m;t[9]!==(h==null?void 0:h.fieldInfos)?(m=new Set(h==null?void 0:h.fieldInfos.map(nc)),t[9]=h==null?void 0:h.fieldInfos,t[10]=m):m=t[10];const v=m;let b;t[11]!==f||t[12]!==h||t[13]!==p||t[14]!==l?(b=()=>h?x.jsx("div",{className:"flex overflow-y-auto justify-center items-center flex-1 w-[90%]",children:x.jsx(Xn,{data:{source:f},padding:Xs,actions:Js,spec:tc(h.spec),theme:l==="dark"?"dark":void 0})}):x.jsx(Ns,{schema:p}),t[11]=f,t[12]=h,t[13]=p,t[14]=l,t[15]=b):b=t[15];const y=b;let E,T,S;t[16]!==s||t[17]!==p?(E=x.jsx(qs,{mark:s,schema:p}),t[16]=s,t[17]=p,t[18]=E):E=t[18],t[19]!==y?(T=y(),t[19]=y,t[20]=T):T=t[20],t[21]!==E||t[22]!==T?(S=x.jsxs("div",{className:"flex items-center gap-2",children:[E,T]}),t[21]=E,t[22]=T,t[23]=S):S=t[23];const N=(ve=d.histograms)==null?void 0:ve.plots,C=(be=d.addCategoricalField)==null?void 0:be.plots,O=(lt=d.addQuantitativeField)==null?void 0:lt.plots,M=(Wn=d.addTemporalField)==null?void 0:Wn.plots;let U,I,F;if(t[24]!==o||t[25]!==f||t[26]!==v||t[27]!==O||t[28]!==M||t[29]!==N||t[30]!==C||t[31]!==l){let $;t[33]!==o||t[34]!==f||t[35]!==v||t[36]!==l?($=(Pe,xe)=>x.jsx(ec,{title:x.jsx("div",{className:"flex flex-row gap-1",children:Pe.fieldInfos.map(z=>{const Ve=z.fieldDef.field==="*"?"Count":z.fieldDef.fn?`${z.fieldDef.fn}(${z.fieldDef.field})`:z.fieldDef.field.toString();return x.jsx(jo,{variant:v.has(z.fieldDef.field)?"secondary":"defaultOutline",children:Ve},Ve)})}),actions:x.jsx(Fo,{content:"Make main plot",children:x.jsx(Qn,{"data-testid":"marimo-plugin-data-explorer-make-main-plot",variant:"text",size:"icon",onClick:()=>{const z=_o.fromEntries(Pe.fieldInfos.map(rc));o.setEncoding(z)},children:x.jsx(Do,{className:"w-4 h-4"})})}),children:x.jsx(Xn,{data:{source:f},actions:!1,spec:Pe.spec,theme:l==="dark"?"dark":void 0},xe)},xe),t[33]=o,t[34]=f,t[35]=v,t[36]=l,t[37]=$):$=t[37],U=[N,C,O,M].filter(Boolean).flat().map($),t[24]=o,t[25]=f,t[26]=v,t[27]=O,t[28]=M,t[29]=N,t[30]=C,t[31]=l,t[32]=U}else U=t[32];return t[38]!==U?(I=x.jsx(Zs,{children:U}),t[38]=U,t[39]=I):I=t[39],t[40]!==I||t[41]!==S?(F=x.jsxs("div",{className:"flex flex-col gap-2",children:[S,I]}),t[40]=I,t[41]=S,t[42]=F):F=t[42],F},Zs=e=>{const t=Ee.c(2),{children:n}=e;if(Po.Children.count(n)===0)return null;let o;return t[0]!==n?(o=x.jsx("div",{className:"flex flex-row overflow-x-auto overflow-y-hidden gap-4 snap-x pb-4",children:n}),t[0]=n,t[1]=o):o=t[1],o},ec=e=>{const t=Ee.c(10),{title:n,children:o,actions:i}=e;let c,u,a,r;return t[0]!==n?(c=x.jsx("div",{className:"text-sm font-medium",children:n}),t[0]=n,t[1]=c):c=t[1],t[2]!==i||t[3]!==c?(u=x.jsxs("div",{className:"flex flex-row justify-between items-center bg-[var(--slate-3)] py-0.5 px-2",children:[c,i]}),t[2]=i,t[3]=c,t[4]=u):u=t[4],t[5]!==o?(a=x.jsx("div",{className:"px-6 pt-2 max-h-[280px] overflow-y-auto",children:o}),t[5]=o,t[6]=a):a=t[6],t[7]!==u||t[8]!==a?(r=x.jsxs("div",{className:"flex-shrink-0 bg-card shadow-md border overflow-hidden rounded snap-start",children:[u,a]}),t[7]=u,t[8]=a,t[9]=r):r=t[9],r};function tc(e){var t,n;return(t=e.encoding)!=null&&t.row||(n=e.encoding)!=null&&n.column||(e.width="container"),e}function nc(e){return e.fieldDef.field}function rc(e){return[e.channel,e.fieldDef]}export{ao as DataExplorerComponent,Ks as default}; diff --git a/notebooks/assets/FiraMono-Bold-CLVRCuM9.ttf b/notebooks/assets/FiraMono-Bold-CLVRCuM9.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ed2698b9508ff7970268da7c24a69e71de8f1a7a --- /dev/null +++ b/notebooks/assets/FiraMono-Bold-CLVRCuM9.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:669c459f82d635c170caffb95b91e4b1d4d844b2e39b57009b9f865b06baa56c +size 201708 diff --git a/notebooks/assets/FiraMono-Medium-DU3aDxX5.ttf b/notebooks/assets/FiraMono-Medium-DU3aDxX5.ttf new file mode 100644 index 0000000000000000000000000000000000000000..f8b03cbae9e3df98d2f12104d77447a2d65ff850 --- /dev/null +++ b/notebooks/assets/FiraMono-Medium-DU3aDxX5.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ebf0b5802814edb228b711b70c02736506bb8bce32da2608dcbf9e0df45798d +size 169056 diff --git a/notebooks/assets/FiraMono-Regular-BTCkDNvf.ttf b/notebooks/assets/FiraMono-Regular-BTCkDNvf.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2a44d0766cb1624bd3185082a16d641e0559bdb8 --- /dev/null +++ b/notebooks/assets/FiraMono-Regular-BTCkDNvf.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c1c51abec8b9f7fa24bfb88ebe80b354cc6da9d4036d6bedeaf495d24933e42 +size 170204 diff --git a/notebooks/assets/ImageComparisonComponent-D9i_gkAF.js b/notebooks/assets/ImageComparisonComponent-D9i_gkAF.js new file mode 100644 index 0000000000000000000000000000000000000000..99540e1a64a27914906517736857294ca5a06941 --- /dev/null +++ b/notebooks/assets/ImageComparisonComponent-D9i_gkAF.js @@ -0,0 +1 @@ +import{aE as D,c as k,j as x}from"./index-DgI7bmFZ.js";var T,M,p={},L={},P=function(){if(M)return p;M=1;var E=p&&p.__createBinding||(Object.create?function(d,c,l,t){t===void 0&&(t=l),Object.defineProperty(d,t,{enumerable:!0,get:function(){return c[l]}})}:function(d,c,l,t){t===void 0&&(t=l),d[t]=c[l]}),i=p&&p.__setModuleDefault||(Object.create?function(d,c){Object.defineProperty(d,"default",{enumerable:!0,value:c})}:function(d,c){d.default=c}),y=p&&p.__importStar||function(d){if(d&&d.__esModule)return d;var c={};if(d!=null)for(var l in d)l!=="default"&&Object.prototype.hasOwnProperty.call(d,l)&&E(c,d,l);return i(c,d),c};Object.defineProperty(p,"__esModule",{value:!0}),p.ImgComparisonSlider=void 0;const w=D();return typeof document<"u"&&Promise.resolve().then(()=>y((T||(T=1,(()=>{var d={792:(t,a,r)=>{r.d(a,{Z:()=>v});var n=r(609),u=r.n(n)()(function(f){return f[1]});u.push([t.id,':host{--divider-width: 1px;--divider-color: #fff;--divider-shadow: none;--default-handle-width: 50px;--default-handle-color: #fff;--default-handle-opacity: 1;--default-handle-shadow: none;--handle-position-start: 50%;position:relative;display:inline-block;overflow:hidden;line-height:0;direction:ltr}@media screen and (-webkit-min-device-pixel-ratio: 0)and (min-resolution: 0.001dpcm){:host{outline-offset:1px}}:host(:focus){outline:2px solid -webkit-focus-ring-color}::slotted(*){-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;user-drag:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.first{position:absolute;left:0;top:0;right:0;line-height:normal;font-size:100%;max-height:100%;height:100%;width:100%;--exposure: 50%;--keyboard-transition-time: 0ms;--default-transition-time: 0ms;--transition-time: var(--default-transition-time)}.first .first-overlay-container{position:relative;clip-path:inset(0 var(--exposure) 0 0);transition:clip-path var(--transition-time);height:100%}.first .first-overlay{overflow:hidden;height:100%}.first.focused{will-change:clip-path}.first.focused .first-overlay-container{will-change:clip-path}.second{position:relative}.handle-container{transform:translateX(50%);position:absolute;top:0;right:var(--exposure);height:100%;transition:right var(--transition-time),bottom var(--transition-time)}.focused .handle-container{will-change:right}.divider{position:absolute;height:100%;width:100%;left:0;top:0;display:flex;align-items:center;justify-content:center;flex-direction:column}.divider:after{content:" ";display:block;height:100%;border-left-width:var(--divider-width);border-left-style:solid;border-left-color:var(--divider-color);box-shadow:var(--divider-shadow)}.handle{position:absolute;top:var(--handle-position-start);pointer-events:none;box-sizing:border-box;margin-left:1px;transform:translate(calc(-50% - 0.5px), -50%);line-height:0}.default-handle{width:var(--default-handle-width);opacity:var(--default-handle-opacity);transition:all 1s;filter:drop-shadow(var(--default-handle-shadow))}.default-handle path{stroke:var(--default-handle-color)}.vertical .first-overlay-container{clip-path:inset(0 0 var(--exposure) 0)}.vertical .handle-container{transform:translateY(50%);height:auto;top:unset;bottom:var(--exposure);width:100%;left:0;flex-direction:row}.vertical .divider:after{height:1px;width:100%;border-top-width:var(--divider-width);border-top-style:solid;border-top-color:var(--divider-color);border-left:0}.vertical .handle{top:auto;left:var(--handle-position-start);transform:translate(calc(-50% - 0.5px), -50%) rotate(90deg)}',""]);const v=u},609:t=>{t.exports=function(a){var r=[];return r.toString=function(){return this.map(function(n){var u=a(n);return n[2]?"@media ".concat(n[2]," {").concat(u,"}"):u}).join("")},r.i=function(n,u,v){typeof n=="string"&&(n=[[null,n,""]]);var f={};if(v)for(var m=0;m{var a=t&&t.__esModule?()=>t.default:()=>t;return l.d(a,{a}),a},l.d=(t,a)=>{for(var r in a)l.o(a,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},l.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),(()=>{var t=l(792);const a="rendered",r=(e,s)=>{const o=e.getBoundingClientRect();let h,b;return s.type==="mousedown"?(h=s.clientX,b=s.clientY):(h=s.touches[0].clientX,b=s.touches[0].clientY),h>=o.x&&h<=o.x+o.width&&b>=o.y&&b<=o.y+o.height};let n;const u={ArrowLeft:-1,ArrowRight:1},v=["horizontal","vertical"],f=e=>({x:e.touches[0].pageX,y:e.touches[0].pageY}),m=e=>({x:e.pageX,y:e.pageY}),g=typeof window<"u"&&(window==null?void 0:window.HTMLElement);typeof window<"u"&&(window.document&&(n=document.createElement("template"),n.innerHTML='
'),window.customElements.define("img-comparison-slider",class extends g{constructor(){super(),this.exposure=this.hasAttribute("value")?parseFloat(this.getAttribute("value")):50,this.slideOnHover=!1,this.slideDirection="horizontal",this.keyboard="enabled",this.isMouseDown=!1,this.animationDirection=0,this.isFocused=!1,this.dragByHandle=!1,this.onMouseMove=o=>{if(this.isMouseDown||this.slideOnHover){const h=m(o);this.slideToPage(h)}},this.bodyUserSelectStyle="",this.bodyWebkitUserSelectStyle="",this.onMouseDown=o=>{if(this.slideOnHover||this.handle&&!r(this.handleElement,o))return;o.preventDefault(),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("mouseup",this.onWindowMouseUp),this.isMouseDown=!0,this.enableTransition();const h=m(o);this.slideToPage(h),this.focus(),this.bodyUserSelectStyle=window.document.body.style.userSelect,this.bodyWebkitUserSelectStyle=window.document.body.style.webkitUserSelect,window.document.body.style.userSelect="none",window.document.body.style.webkitUserSelect="none"},this.onWindowMouseUp=()=>{this.isMouseDown=!1,window.document.body.style.userSelect=this.bodyUserSelectStyle,window.document.body.style.webkitUserSelect=this.bodyWebkitUserSelectStyle,window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onWindowMouseUp)},this.touchStartPoint=null,this.isTouchComparing=!1,this.hasTouchMoved=!1,this.onTouchStart=o=>{this.dragByHandle&&!r(this.handleElement,o)||(this.touchStartPoint=f(o),this.isFocused&&(this.enableTransition(),this.slideToPage(this.touchStartPoint)))},this.onTouchMove=o=>{if(this.touchStartPoint===null)return;const h=f(o);if(this.isTouchComparing)return this.slideToPage(h),o.preventDefault(),!1;if(!this.hasTouchMoved){const b=Math.abs(h.y-this.touchStartPoint.y),S=Math.abs(h.x-this.touchStartPoint.x);if(this.slideDirection==="horizontal"&&bS)return this.isTouchComparing=!0,this.focus(),this.slideToPage(h),o.preventDefault(),!1;this.hasTouchMoved=!0}},this.onTouchEnd=()=>{this.isTouchComparing=!1,this.hasTouchMoved=!1,this.touchStartPoint=null},this.onBlur=()=>{this.stopSlideAnimation(),this.isFocused=!1,this.firstElement.classList.remove("focused")},this.onFocus=()=>{this.isFocused=!0,this.firstElement.classList.add("focused")},this.onKeyDown=o=>{if(this.keyboard==="disabled")return;const h=u[o.key];this.animationDirection!==h&&h!==void 0&&(this.animationDirection=h,this.startSlideAnimation())},this.onKeyUp=o=>{if(this.keyboard==="disabled")return;const h=u[o.key];h!==void 0&&this.animationDirection===h&&this.stopSlideAnimation()},this.resetDimensions=()=>{this.imageWidth=this.offsetWidth,this.imageHeight=this.offsetHeight};const e=this.attachShadow({mode:"open"}),s=document.createElement("style");s.innerHTML=t.Z,this.getAttribute("nonce")&&s.setAttribute("nonce",this.getAttribute("nonce")),e.appendChild(s),e.appendChild(n.content.cloneNode(!0)),this.firstElement=e.getElementById("first"),this.handleElement=e.getElementById("handle")}set handle(e){this.dragByHandle=e.toString().toLowerCase()!=="false"}get handle(){return this.dragByHandle}get value(){return this.exposure}set value(e){const s=parseFloat(e);s!==this.exposure&&(this.exposure=s,this.enableTransition(),this.setExposure())}get hover(){return this.slideOnHover}set hover(e){this.slideOnHover=e.toString().toLowerCase()!=="false",this.removeEventListener("mousemove",this.onMouseMove),this.slideOnHover&&this.addEventListener("mousemove",this.onMouseMove)}get direction(){return this.slideDirection}set direction(e){this.slideDirection=e.toString().toLowerCase(),this.slide(0),this.firstElement.classList.remove(...v),v.includes(this.slideDirection)&&this.firstElement.classList.add(this.slideDirection)}static get observedAttributes(){return["hover","direction"]}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("dragstart",e=>(e.preventDefault(),!1)),new ResizeObserver(this.resetDimensions).observe(this),this.setExposure(0),this.keyboard=this.hasAttribute("keyboard")&&this.getAttribute("keyboard")==="disabled"?"disabled":"enabled",this.addEventListener("keydown",this.onKeyDown),this.addEventListener("keyup",this.onKeyUp),this.addEventListener("focus",this.onFocus),this.addEventListener("blur",this.onBlur),this.addEventListener("touchstart",this.onTouchStart,{passive:!0}),this.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.addEventListener("touchend",this.onTouchEnd),this.addEventListener("mousedown",this.onMouseDown),this.handle=this.hasAttribute("handle")?this.getAttribute("handle"):this.dragByHandle,this.hover=this.hasAttribute("hover")?this.getAttribute("hover"):this.slideOnHover,this.direction=this.hasAttribute("direction")?this.getAttribute("direction"):this.slideDirection,this.resetDimensions(),this.classList.contains(a)||this.classList.add(a)}disconnectedCallback(){this.transitionTimer&&window.clearTimeout(this.transitionTimer)}attributeChangedCallback(e,s,o){e==="hover"&&(this.hover=o),e==="direction"&&(this.direction=o),e==="keyboard"&&(this.keyboard=o==="disabled"?"disabled":"enabled")}setExposure(e=0){var s;this.exposure=(s=this.exposure+e)<0?0:s>100?100:s,this.firstElement.style.setProperty("--exposure",100-this.exposure+"%")}slide(e=0){this.setExposure(e);const s=new Event("slide");this.dispatchEvent(s)}slideToPage(e){this.slideDirection==="horizontal"&&this.slideToPageX(e.x),this.slideDirection==="vertical"&&this.slideToPageY(e.y)}slideToPageX(e){const s=e-this.getBoundingClientRect().left-window.scrollX;this.exposure=s/this.imageWidth*100,this.slide(0)}slideToPageY(e){const s=e-this.getBoundingClientRect().top-window.scrollY;this.exposure=s/this.imageHeight*100,this.slide(0)}enableTransition(){this.firstElement.style.setProperty("--transition-time","100ms"),this.transitionTimer=window.setTimeout(()=>{this.firstElement.style.setProperty("--transition-time","var(--default-transition-time)"),this.transitionTimer=null},100)}startSlideAnimation(){let e=null,s=this.animationDirection;this.firstElement.style.setProperty("--transition-time","var(--keyboard-transition-time)");const o=h=>{if(this.animationDirection===0||s!==this.animationDirection)return;e===null&&(e=h);const b=(h-e)/16.666666666666668*this.animationDirection;this.slide(b),setTimeout(()=>window.requestAnimationFrame(o),0),e=h};window.requestAnimationFrame(o)}stopSlideAnimation(){this.animationDirection=0,this.firstElement.style.setProperty("--transition-time","var(--default-transition-time)")}}))})()})()),L))),p.ImgComparisonSlider=(0,w.forwardRef)(({children:d,onSlide:c,value:l,className:t,...a},r)=>{const n=(0,w.useRef)();return(0,w.useEffect)(()=>{l!==void 0&&(n.current.value=parseFloat(l.toString()))},[l,n]),(0,w.useEffect)(()=>{c&&n.current.addEventListener("slide",c)},[]),(0,w.useImperativeHandle)(r,()=>n.current,[n]),(0,w.createElement)("img-comparison-slider",Object.assign({class:t?`${t} rendered`:"rendered",tabIndex:0,ref:n},a),d)}),p}();const A=E=>{const i=k.c(15),{beforeSrc:y,afterSrc:w,value:d,direction:c,width:l,height:t}=E,a=l||"100%",r=t||(c==="vertical"?"400px":"auto");let n;i[0]!==a||i[1]!==r?(n={width:a,height:r,maxWidth:"100%"},i[0]=a,i[1]=r,i[2]=n):n=i[2];const u=n;let v,f,m,g;return i[3]!==y?(v=x.jsx("img",{slot:"first",src:y,alt:"Before",width:"100%"}),i[3]=y,i[4]=v):v=i[4],i[5]!==w?(f=x.jsx("img",{slot:"second",src:w,alt:"After",width:"100%"}),i[5]=w,i[6]=f):f=i[6],i[7]!==c||i[8]!==v||i[9]!==f||i[10]!==d?(m=x.jsxs(P.ImgComparisonSlider,{value:d,direction:c,children:[v,f]}),i[7]=c,i[8]=v,i[9]=f,i[10]=d,i[11]=m):m=i[11],i[12]!==u||i[13]!==m?(g=x.jsx("div",{style:u,children:m}),i[12]=u,i[13]=m,i[14]=g):g=i[14],g};export{A as default}; diff --git a/notebooks/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 b/notebooks/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..0acaaff03d4bb7606de02a827aeee338e5a86910 Binary files /dev/null and b/notebooks/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 differ diff --git a/notebooks/assets/KaTeX_AMS-Regular-DMm9YOAa.woff b/notebooks/assets/KaTeX_AMS-Regular-DMm9YOAa.woff new file mode 100644 index 0000000000000000000000000000000000000000..b804d7b33a3fa5b2587d2d1d55006aed678e3eb2 Binary files /dev/null and b/notebooks/assets/KaTeX_AMS-Regular-DMm9YOAa.woff differ diff --git a/notebooks/assets/KaTeX_AMS-Regular-DRggAlZN.ttf b/notebooks/assets/KaTeX_AMS-Regular-DRggAlZN.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c6f9a5e7c03f9e64e9c7b4773a8e37ade8eaf406 Binary files /dev/null and b/notebooks/assets/KaTeX_AMS-Regular-DRggAlZN.ttf differ diff --git a/notebooks/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf b/notebooks/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9ff4a5e04421e5107f74c28e27354e0b2a4e7ef8 Binary files /dev/null and b/notebooks/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf differ diff --git a/notebooks/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff b/notebooks/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff new file mode 100644 index 0000000000000000000000000000000000000000..9759710d1d3e16eb10012d56babb73f2479ba9f0 Binary files /dev/null and b/notebooks/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff differ diff --git a/notebooks/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 b/notebooks/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..f390922eceffe1f6dfb81a3dc086a92d98171b02 Binary files /dev/null and b/notebooks/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 differ diff --git a/notebooks/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff b/notebooks/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff new file mode 100644 index 0000000000000000000000000000000000000000..9bdd534fd2beb9b878f0219da9d63ffba56677e2 Binary files /dev/null and b/notebooks/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff differ diff --git a/notebooks/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 b/notebooks/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..75344a1f98e37e2c631e178065854c3a81fb842f Binary files /dev/null and b/notebooks/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 differ diff --git a/notebooks/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf b/notebooks/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf new file mode 100644 index 0000000000000000000000000000000000000000..f522294ff0f3f8c52dfdaef7ebfaa06ebfcfaabf Binary files /dev/null and b/notebooks/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf differ diff --git a/notebooks/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf b/notebooks/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4e98259c3b54076d684bf3459baeaeae8dbce97a Binary files /dev/null and b/notebooks/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf differ diff --git a/notebooks/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff b/notebooks/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff new file mode 100644 index 0000000000000000000000000000000000000000..e7730f66275c87c28f26530d89264cffecf90be0 Binary files /dev/null and b/notebooks/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff differ diff --git a/notebooks/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 b/notebooks/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..395f28beac23c7b0f7f3a1e714bd8dac253dd3bc Binary files /dev/null and b/notebooks/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 differ diff --git a/notebooks/assets/KaTeX_Fraktur-Regular-CB_wures.ttf b/notebooks/assets/KaTeX_Fraktur-Regular-CB_wures.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b8461b275fae76efd0d21fd0f1aaa696a5b10f9a Binary files /dev/null and b/notebooks/assets/KaTeX_Fraktur-Regular-CB_wures.ttf differ diff --git a/notebooks/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 b/notebooks/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..735f6948d63c8cc7f8233735bb9c8d843c83d804 Binary files /dev/null and b/notebooks/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 differ diff --git a/notebooks/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff b/notebooks/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff new file mode 100644 index 0000000000000000000000000000000000000000..acab069f90b6fe6301a004e6f8beaf6a0db48bce Binary files /dev/null and b/notebooks/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff differ diff --git a/notebooks/assets/KaTeX_Main-Bold-Cx986IdX.woff2 b/notebooks/assets/KaTeX_Main-Bold-Cx986IdX.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..ab2ad21da6fbe6c171bb869240954d0ead8f68fd Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Bold-Cx986IdX.woff2 differ diff --git a/notebooks/assets/KaTeX_Main-Bold-Jm3AIy58.woff b/notebooks/assets/KaTeX_Main-Bold-Jm3AIy58.woff new file mode 100644 index 0000000000000000000000000000000000000000..f38136ac1cc2dcdc9d9b10b8521487468b1f768c Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Bold-Jm3AIy58.woff differ diff --git a/notebooks/assets/KaTeX_Main-Bold-waoOVXN0.ttf b/notebooks/assets/KaTeX_Main-Bold-waoOVXN0.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4060e627dc341c1854260cbc3f7386e222a4d297 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Bold-waoOVXN0.ttf differ diff --git a/notebooks/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 b/notebooks/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..5931794de4a2a485fa70099bf2659b145976d043 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 differ diff --git a/notebooks/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf b/notebooks/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dc007977ee709a236d9e82719cf7d4e5577a81b9 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf differ diff --git a/notebooks/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff b/notebooks/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff new file mode 100644 index 0000000000000000000000000000000000000000..67807b0bd4f867853271f5917fb3adf377f93f53 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff differ diff --git a/notebooks/assets/KaTeX_Main-Italic-3WenGoN9.ttf b/notebooks/assets/KaTeX_Main-Italic-3WenGoN9.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0e9b0f354ad460202bba554359f5adcc8da666b7 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Italic-3WenGoN9.ttf differ diff --git a/notebooks/assets/KaTeX_Main-Italic-BMLOBm91.woff b/notebooks/assets/KaTeX_Main-Italic-BMLOBm91.woff new file mode 100644 index 0000000000000000000000000000000000000000..6f43b594b6c1d863a0e3f93b001f8dd503316464 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Italic-BMLOBm91.woff differ diff --git a/notebooks/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 b/notebooks/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b50920e138807f385d0b0359f4f0f09891f18406 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 differ diff --git a/notebooks/assets/KaTeX_Main-Regular-B22Nviop.woff2 b/notebooks/assets/KaTeX_Main-Regular-B22Nviop.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..eb24a7ba282b03d830fa6c63ee897d92a5188736 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Regular-B22Nviop.woff2 differ diff --git a/notebooks/assets/KaTeX_Main-Regular-Dr94JaBh.woff b/notebooks/assets/KaTeX_Main-Regular-Dr94JaBh.woff new file mode 100644 index 0000000000000000000000000000000000000000..21f5812968c42392a3eaea9b0c6320870b6b8b38 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Regular-Dr94JaBh.woff differ diff --git a/notebooks/assets/KaTeX_Main-Regular-ypZvNtVU.ttf b/notebooks/assets/KaTeX_Main-Regular-ypZvNtVU.ttf new file mode 100644 index 0000000000000000000000000000000000000000..dd45e1ed2e18b32c516d9b481ebed3cb8bffa711 Binary files /dev/null and b/notebooks/assets/KaTeX_Main-Regular-ypZvNtVU.ttf differ diff --git a/notebooks/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf b/notebooks/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf new file mode 100644 index 0000000000000000000000000000000000000000..728ce7a1e2cb689df32c3a6c26e1bd072dcf2acb Binary files /dev/null and b/notebooks/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf differ diff --git a/notebooks/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 b/notebooks/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..29657023adc09956249f6295746c8ce4469b50d3 Binary files /dev/null and b/notebooks/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 differ diff --git a/notebooks/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff b/notebooks/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff new file mode 100644 index 0000000000000000000000000000000000000000..0ae390d74c9f665cf8b1e5ea5483395da7513444 Binary files /dev/null and b/notebooks/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff differ diff --git a/notebooks/assets/KaTeX_Math-Italic-DA0__PXp.woff b/notebooks/assets/KaTeX_Math-Italic-DA0__PXp.woff new file mode 100644 index 0000000000000000000000000000000000000000..eb5159d4c1ca83fb92b3190223698427df0e010c Binary files /dev/null and b/notebooks/assets/KaTeX_Math-Italic-DA0__PXp.woff differ diff --git a/notebooks/assets/KaTeX_Math-Italic-flOr_0UB.ttf b/notebooks/assets/KaTeX_Math-Italic-flOr_0UB.ttf new file mode 100644 index 0000000000000000000000000000000000000000..70d559b4e937ca1b805eb39f544cbebe3c58ca6f Binary files /dev/null and b/notebooks/assets/KaTeX_Math-Italic-flOr_0UB.ttf differ diff --git a/notebooks/assets/KaTeX_Math-Italic-t53AETM-.woff2 b/notebooks/assets/KaTeX_Math-Italic-t53AETM-.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..215c143fd7805a5c2b222bd7892a1a2b09610020 Binary files /dev/null and b/notebooks/assets/KaTeX_Math-Italic-t53AETM-.woff2 differ diff --git a/notebooks/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf b/notebooks/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf new file mode 100644 index 0000000000000000000000000000000000000000..2f65a8a3a6d3628d11ea9c26c9077cef672fe427 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf differ diff --git a/notebooks/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 b/notebooks/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..cfaa3bda59246b49e94298478d6de3b3208066c8 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 differ diff --git a/notebooks/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff b/notebooks/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff new file mode 100644 index 0000000000000000000000000000000000000000..8d47c02d9408d34b2a9d566c0fe0d42bf82fb735 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff differ diff --git a/notebooks/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 b/notebooks/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..349c06dc609f896392fd5bc8b364d3bc3efc9330 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 differ diff --git a/notebooks/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff b/notebooks/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff new file mode 100644 index 0000000000000000000000000000000000000000..7e02df963621a5e26d53d510f0b4992eebde1c60 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff differ diff --git a/notebooks/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf b/notebooks/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d5850df98ec19de2eee9ff922ef59586efe471d0 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf differ diff --git a/notebooks/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf b/notebooks/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf new file mode 100644 index 0000000000000000000000000000000000000000..537279f6bd2184ed32f1a5168850609147d58ee6 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf differ diff --git a/notebooks/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff b/notebooks/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff new file mode 100644 index 0000000000000000000000000000000000000000..31b84829b42edae20d0148eeec0d922dad2108c4 Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff differ diff --git a/notebooks/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 b/notebooks/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..a90eea85f6f7bded69ff5d40114447a6d8b48cfe Binary files /dev/null and b/notebooks/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 differ diff --git a/notebooks/assets/KaTeX_Script-Regular-C5JkGWo-.ttf b/notebooks/assets/KaTeX_Script-Regular-C5JkGWo-.ttf new file mode 100644 index 0000000000000000000000000000000000000000..fd679bf374af72f2a183b97b40c9c7e9e51fbe5e Binary files /dev/null and b/notebooks/assets/KaTeX_Script-Regular-C5JkGWo-.ttf differ diff --git a/notebooks/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 b/notebooks/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b3048fc115681ee6c1bc86b0aa158cfbbf59daa3 Binary files /dev/null and b/notebooks/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 differ diff --git a/notebooks/assets/KaTeX_Script-Regular-D5yQViql.woff b/notebooks/assets/KaTeX_Script-Regular-D5yQViql.woff new file mode 100644 index 0000000000000000000000000000000000000000..0e7da821eee0dd05a0a6f0b16c2c1345dc573a84 Binary files /dev/null and b/notebooks/assets/KaTeX_Script-Regular-D5yQViql.woff differ diff --git a/notebooks/assets/KaTeX_Size1-Regular-C195tn64.woff b/notebooks/assets/KaTeX_Size1-Regular-C195tn64.woff new file mode 100644 index 0000000000000000000000000000000000000000..7f292d91184f257054ef77cc1cd3443db757c9cc Binary files /dev/null and b/notebooks/assets/KaTeX_Size1-Regular-C195tn64.woff differ diff --git a/notebooks/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf b/notebooks/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf new file mode 100644 index 0000000000000000000000000000000000000000..871fd7d19d8658f64d8696ed9cdfc82c821ed76d Binary files /dev/null and b/notebooks/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf differ diff --git a/notebooks/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 b/notebooks/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..c5a8462fbfe2c39a7c1857b9e296e62500a8a8a5 Binary files /dev/null and b/notebooks/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 differ diff --git a/notebooks/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf b/notebooks/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf new file mode 100644 index 0000000000000000000000000000000000000000..7a212caf91c0007e826fee2d622bf48acbd30dde Binary files /dev/null and b/notebooks/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf differ diff --git a/notebooks/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 b/notebooks/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e1bccfe2403a4ed770c1697ae7c15b9e1cd9bc4e Binary files /dev/null and b/notebooks/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 differ diff --git a/notebooks/assets/KaTeX_Size2-Regular-oD1tc_U0.woff b/notebooks/assets/KaTeX_Size2-Regular-oD1tc_U0.woff new file mode 100644 index 0000000000000000000000000000000000000000..d241d9be2d317f7b39b401d96c8b18836acea0fa Binary files /dev/null and b/notebooks/assets/KaTeX_Size2-Regular-oD1tc_U0.woff differ diff --git a/notebooks/assets/KaTeX_Size3-Regular-CTq5MqoE.woff b/notebooks/assets/KaTeX_Size3-Regular-CTq5MqoE.woff new file mode 100644 index 0000000000000000000000000000000000000000..e6e9b658dcf1cd031ac82b6b8f312444c55d4fc0 Binary files /dev/null and b/notebooks/assets/KaTeX_Size3-Regular-CTq5MqoE.woff differ diff --git a/notebooks/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf b/notebooks/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf new file mode 100644 index 0000000000000000000000000000000000000000..00bff3495fa9d2f98c1c9ce436add6a1bcfe87fb Binary files /dev/null and b/notebooks/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf differ diff --git a/notebooks/assets/KaTeX_Size4-Regular-BF-4gkZK.woff b/notebooks/assets/KaTeX_Size4-Regular-BF-4gkZK.woff new file mode 100644 index 0000000000000000000000000000000000000000..e1ec5457664f438ce5a1cc6dd8409bf60ca7804b Binary files /dev/null and b/notebooks/assets/KaTeX_Size4-Regular-BF-4gkZK.woff differ diff --git a/notebooks/assets/KaTeX_Size4-Regular-DWFBv043.ttf b/notebooks/assets/KaTeX_Size4-Regular-DWFBv043.ttf new file mode 100644 index 0000000000000000000000000000000000000000..74f08921f00f71f413ca42c9d1c90202e672ef38 Binary files /dev/null and b/notebooks/assets/KaTeX_Size4-Regular-DWFBv043.ttf differ diff --git a/notebooks/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 b/notebooks/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..680c13085076a2f6c5a7e695935ec3f21cddb65f Binary files /dev/null and b/notebooks/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 differ diff --git a/notebooks/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff b/notebooks/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff new file mode 100644 index 0000000000000000000000000000000000000000..2432419f28936aff53ddfa2a732d027e6a6648fd Binary files /dev/null and b/notebooks/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff differ diff --git a/notebooks/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 b/notebooks/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..771f1af705f5cef5f578b3a1e7d8eff66f9b76b0 Binary files /dev/null and b/notebooks/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 differ diff --git a/notebooks/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf b/notebooks/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c83252c5714c71a3e0ec62195884167339a0129b Binary files /dev/null and b/notebooks/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf differ diff --git a/notebooks/assets/Lora-VariableFont_wght-B2ootaw-.ttf b/notebooks/assets/Lora-VariableFont_wght-B2ootaw-.ttf new file mode 100644 index 0000000000000000000000000000000000000000..105fb06b4c5fe476b590ab0a044b80ccc87436c7 --- /dev/null +++ b/notebooks/assets/Lora-VariableFont_wght-B2ootaw-.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9385192327b5347c17c50dd31f28a4cc5225e78b42f5ced4e185fc6b20b179a9 +size 212004 diff --git a/notebooks/assets/PTSans-Bold-D9fedIX3.ttf b/notebooks/assets/PTSans-Bold-D9fedIX3.ttf new file mode 100644 index 0000000000000000000000000000000000000000..5dd10098facb34f9fdcf067e80eeabd5a4450edb --- /dev/null +++ b/notebooks/assets/PTSans-Bold-D9fedIX3.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6233f84e139f226690649b3105c077b0f87ec24a23ca4a18ada298c962a06f4f +size 288340 diff --git a/notebooks/assets/PTSans-Regular-CxL0S8W7.ttf b/notebooks/assets/PTSans-Regular-CxL0S8W7.ttf new file mode 100644 index 0000000000000000000000000000000000000000..460df66687ae8060aa8ce166401e22bd9dfe0631 --- /dev/null +++ b/notebooks/assets/PTSans-Regular-CxL0S8W7.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23b91352992c21de231c39dd77441f7c5c3f3e684f4a06e31b65c63d33427560 +size 278612 diff --git a/notebooks/assets/VegaLite-BNmk2IVQ.js b/notebooks/assets/VegaLite-BNmk2IVQ.js new file mode 100644 index 0000000000000000000000000000000000000000..67b1b5343118d5288fa18c03316ece354fa297d2 --- /dev/null +++ b/notebooks/assets/VegaLite-BNmk2IVQ.js @@ -0,0 +1,189 @@ +var Ir;import{cG as xr,cH as Ar,cI as oe,cJ as $e,cK as ot,cL as Lr,cM as Rr,a as V,cN as st}from"./index-DgI7bmFZ.js";import{a as $r,b as Sr,d as Tr,c as Cr,e as Fr,f as Dr,g as Pr,h as kr,i as _r,j as Mr,k as jr,l as zr,m as Ur,n as Gr,o as Br,p as Vr,q as Wr,r as Xr,s as Hr,t as Yr,u as qr,v as Jr,w as Qr,x as Kr,y as Zr,z as en,A as tn,B as rn,C as nn,D as on,E as sn,F as an,G as ln,H as cn,I as dn,J as fn,K as pn,L as hn,N as un,O as mn,P as gn,Q as En,R as vn,S as bn,T as yn}from"./compile-BapKxctZ.js";import{e as wn}from"./index-_uHhs6Sh.js";const at={};function Se(e,t){e===void 0&&(e=at),t===void 0&&(t=at);const r=Object.keys(e),n=Object.keys(t);return e===t||r.length===n.length&&r.every(a=>e[a]===t[a])}const On=/("(?:[^\\"]|\\.)*")|[:,]/g;function Te(e,t={}){const r=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),n=r===""?1/0:t.maxLength===void 0?80:t.maxLength;let{replacer:a}=t;return function l(s,f,o){s&&typeof s.toJSON=="function"&&(s=s.toJSON());const i=JSON.stringify(s,a);if(i===void 0)return i;const u=n-f.length-o;if(i.length<=u){const c=i.replace(On,(d,b)=>b||`${d} `);if(c.length<=u)return c}if(a!=null&&(s=JSON.parse(i),a=void 0),typeof s=="object"&&s!==null){const c=f+r,d=[];let b,T,x=0;if(Array.isArray(s)){b="[",T="]";const{length:S}=s;for(;x0)return[b,r+d.join(`, +${c}`),T].join(` +${f}`)}return i}(e,"",0)}var In={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Nn={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>ee<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},xn={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const An=Array.prototype.slice,W=(e,t,r)=>{const n=r?r(t[0]):t[0];return n[e].apply(n,An.call(t,1))};var Ln={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,r)=>Math.max(t,Math.min(r,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,r,n,a,l,s)=>new Date(e,t||0,r??1,n||0,a||0,l||0,s||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return W("join",arguments)},indexof:function(){return W("indexOf",arguments)},lastindexof:function(){return W("lastIndexOf",arguments)},slice:function(){return W("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(xr),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return W("substring",arguments,String)},split:function(){return W("split",arguments,String)},replace:function(){return W("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const Rn=["view","item","group","xy","x","y"],Ce=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&Ce.add(setImmediate);const $n={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const r=t.name;return e.memberDepth>0?r:r==="datum"?e.datum:r==="event"?e.event:r==="item"?e.item:In[r]||e.params["$"+r]},MemberExpression:(e,t)=>{const r=!t.computed,n=e(t.object);r&&(e.memberDepth+=1);const a=e(t.property);if(r&&(e.memberDepth-=1),!Ce.has(n[a]))return n[a];console.error(`Prevented interpretation of member "${a}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const r=t.arguments;let n=t.callee.name;return n.startsWith("_")&&(n=n.slice(1)),n==="if"?e(r[0])?e(r[1]):e(r[2]):(e.fn[n]||Ln[n]).apply(e.fn,r.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Nn[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>xn[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((r,n)=>{e.memberDepth+=1;const a=e(n.key);return e.memberDepth-=1,Ce.has(e(n.value))?console.error(`Prevented interpretation of property "${a}" which could lead to insecure code execution`):r[a]=e(n.value),r},{})};function se(e,t,r,n,a,l){const s=f=>$n[f.type](s,f);return s.memberDepth=0,s.fn=Object.create(t),s.params=r,s.datum=n,s.event=a,s.item=l,Rn.forEach(f=>s.fn[f]=function(){return a.vega[f](...arguments)}),s(e)}var Sn={operator(e,t){const r=t.ast,n=e.functions;return a=>se(r,n,a)},parameter(e,t){const r=t.ast,n=e.functions;return(a,l)=>se(r,n,l,a)},event(e,t){const r=t.ast,n=e.functions;return a=>se(r,n,void 0,void 0,a)},handler(e,t){const r=t.ast,n=e.functions;return(a,l)=>{const s=l.item&&l.item.datum;return se(r,n,a,s,l)}},encode(e,t){const{marktype:r,channels:n}=t,a=e.functions,l=r==="group"||r==="image"||r==="rect";return(s,f)=>{const o=s.datum;let i,u=0;for(const c in n)i=se(n[c].ast,a,f,o,void 0,s),s[c]!==i&&(s[c]=i,u=1);return r!=="rule"&&function(c,d,b){let T;d.x2&&(d.x?(b&&c.x>c.x2&&(T=c.x,c.x=c.x2,c.x2=T),c.width=c.x2-c.x):c.x=c.x2-(c.width||0)),d.xc&&(c.x=c.xc-(c.width||0)/2),d.y2&&(d.y?(b&&c.y>c.y2&&(T=c.y,c.y=c.y2,c.y2=T),c.height=c.y2-c.y):c.y=c.y2-(c.height||0)),d.yc&&(c.y=c.yc-(c.height||0)/2)}(s,n,l),u}}};const Tn="5.23.0",Cn=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:$r,accessPathWithDatum:Sr,accessWithDatumToUnescapedPath:Tr,compile:Cr,contains:Fr,deepEqual:Dr,deleteNestedProperty:Pr,duplicate:kr,entries:_r,every:Mr,fieldIntersection:jr,flatAccessWithDatum:zr,getFirstDefined:Ur,hasIntersection:Gr,hasProperty:Br,hash:Vr,internalField:Wr,isBoolean:Xr,isEmpty:Hr,isEqual:Yr,isInternalField:qr,isNullOrFalse:Jr,isNumeric:Qr,keys:Kr,logicalExpr:Zr,mergeDeep:en,never:tn,normalize:rn,normalizeAngle:nn,omit:on,pick:sn,prefixGenerator:an,removePathFromField:ln,replaceAll:cn,replacePathInField:dn,resetIdCounter:fn,setEqual:pn,some:hn,stringify:un,titleCase:mn,unique:gn,uniqueId:En,vals:vn,varName:bn,version:Tn},Symbol.toStringTag,{value:"Module"}));function lt(e){const[t,r]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:r}}var Fn="2.15.0";const re="#fff",ct="#888",Dn={background:"#333",view:{stroke:ct},title:{color:re,subtitleColor:re},style:{"guide-label":{fill:re},"guide-title":{fill:re}},axis:{domainColor:re,gridColor:ct,tickColor:re}},X="#4572a7",Pn={background:"#fff",arc:{fill:X},area:{fill:X},line:{stroke:X,strokeWidth:2},path:{stroke:X},rect:{fill:X},shape:{stroke:X},symbol:{fill:X,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},H="#30a2da",Fe="#cbcbcb",dt="#f0f0f0",ft="#333",kn={arc:{fill:H},area:{fill:H},axis:{domainColor:Fe,grid:!0,gridColor:Fe,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:Fe,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:dt,group:{fill:dt},legend:{labelColor:ft,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:ft,titleFontSize:14,titlePadding:10},line:{stroke:H,strokeWidth:2},path:{stroke:H,strokeWidth:.5},rect:{fill:H},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:H},bar:{binSpacing:2,fill:H,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Y="#000",_n={group:{fill:"#e5e5e5"},arc:{fill:Y},area:{fill:Y},line:{stroke:Y},path:{stroke:Y},rect:{fill:Y},shape:{stroke:Y},symbol:{fill:Y,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},pt="Benton Gothic, sans-serif",q="#82c6df",De="Benton Gothic Bold, sans-serif",ht="normal",ae={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},Mn={background:"#ffffff",title:{anchor:"start",color:"#000000",font:De,fontSize:22,fontWeight:"normal"},arc:{fill:q},area:{fill:q},line:{stroke:q,strokeWidth:2},path:{stroke:q},rect:{fill:q},shape:{stroke:q},symbol:{fill:q,size:30},axis:{labelFont:pt,labelFontSize:11.5,labelFontWeight:"normal",titleFont:De,titleFontSize:13,titleFontWeight:ht},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:pt,labelFontSize:11.5,symbolType:"square",titleFont:De,titleFontSize:13,titleFontWeight:ht},range:{category:ae["category-6"],diverging:ae["fireandice-6"],heatmap:ae["fire-7"],ordinal:ae["fire-7"],ramp:ae["fire-7"]}},J="#ab5787",ge="#979797",jn={background:"#f9f9f9",arc:{fill:J},area:{fill:J},line:{stroke:J},path:{stroke:J},rect:{fill:J},shape:{stroke:J},symbol:{fill:J,size:30},axis:{domainColor:ge,domainWidth:.5,gridWidth:.2,labelColor:ge,tickColor:ge,tickWidth:.2,titleColor:ge},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},Q="#3e5c69",zn={background:"#fff",arc:{fill:Q},area:{fill:Q},line:{stroke:Q},path:{stroke:Q},rect:{fill:Q},shape:{stroke:Q},symbol:{fill:Q},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},z="#1696d2",ut="#000000",Ee="Lato",Pe="Lato",le={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},Un={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:Ee},axisX:{domain:!0,domainColor:ut,domainWidth:1,grid:!1,labelFontSize:12,labelFont:Pe,labelAngle:0,tickColor:ut,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:Ee},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:Pe,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:Ee,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:Pe,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:Ee,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:le["six-groups-cat-1"],diverging:le["diverging-colors"],heatmap:le["diverging-colors"],ordinal:le["six-groups-seq"],ramp:le["shades-blue"]},area:{fill:z},rect:{fill:z},line:{color:z,stroke:z,strokeWidth:5},trail:{color:z,stroke:z,strokeWidth:0,size:1},path:{stroke:z,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:z,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:z,stroke:null}},arc:{fill:z},shape:{stroke:z},symbol:{fill:z,size:30}},K="#3366CC",mt="#ccc",ve="Arial, sans-serif",Gn={arc:{fill:K},area:{fill:K},path:{stroke:K},rect:{fill:K},shape:{stroke:K},symbol:{stroke:K},circle:{fill:K},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:ve,fontSize:12},"guide-title":{font:ve,fontSize:12},"group-title":{font:ve,fontSize:12}},title:{font:ve,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:mt,tickColor:mt,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},ke=e=>e*(1/3+1),gt=ke(9),Et=ke(10),vt=ke(12),ce="Segoe UI",bt="wf_standard-font, helvetica, arial, sans-serif",yt="#252423",de="#605E5C",wt="transparent",U="#118DFF",Ot="#DEEFFF",It=[Ot,U],Bn={view:{stroke:wt},background:wt,font:ce,header:{titleFont:bt,titleFontSize:vt,titleColor:yt,labelFont:ce,labelFontSize:Et,labelColor:de},axis:{ticks:!1,grid:!1,domain:!1,labelColor:de,labelFontSize:gt,titleFont:bt,titleColor:yt,titleFontSize:vt,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:U},line:{stroke:U,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:ce,fontSize:gt,fill:de},arc:{fill:U},area:{fill:U,line:!0,opacity:.6},path:{stroke:U},rect:{fill:U},point:{fill:U,filled:!0,size:75},shape:{stroke:U},symbol:{fill:U,strokeWidth:1.5,size:50},legend:{titleFont:ce,titleFontWeight:"bold",titleColor:de,labelFont:ce,labelFontSize:Et,labelColor:de,symbolType:"circle",symbolSize:75},range:{category:[U,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:It,heatmap:It,ordinal:[Ot,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",U]}},_e='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',be={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},Vn=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Wn=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function ye({theme:e,background:t}){const r=["white","g10"].includes(e)?"light":"dark",n=be.gridBg[e],a=be.textPrimary[e],l=be.textSecondary[e],s=r==="dark"?Vn:Wn,f=r==="dark"?"#d4bbff":"#6929c4";return{background:t,arc:{fill:f},area:{fill:f},path:{stroke:f},rect:{fill:f},shape:{stroke:f},symbol:{stroke:f},circle:{fill:f},view:{fill:n,stroke:n},group:{fill:n},title:{color:a,anchor:"start",dy:-15,fontSize:16,font:_e,fontWeight:600},axis:{labelColor:l,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:a,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:be.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:_e,fill:l,fontWeight:400},"guide-title":{font:_e,fill:l,fontWeight:400}},range:{category:s,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const Xn=ye({theme:"white",background:"#ffffff"}),Hn=ye({theme:"g10",background:"#f4f4f4"}),Yn=ye({theme:"g90",background:"#262626"}),qn=ye({theme:"g100",background:"#161616"}),Jn=Fn,Qn=Object.freeze(Object.defineProperty({__proto__:null,carbong10:Hn,carbong100:qn,carbong90:Yn,carbonwhite:Xn,dark:Dn,excel:Pn,fivethirtyeight:kn,ggplot2:_n,googlecharts:Gn,latimes:Mn,powerbi:Bn,quartz:jn,urbaninstitute:Un,version:Jn,vox:zn},Symbol.toStringTag,{value:"Module"}));function Nt(e,t){return JSON.stringify(e,function(r){const n=[];return function(a,l){if(typeof l!="object"||l===null)return l;const s=n.indexOf(this)+1;return n.length=s,n.length>r?"[Object]":n.indexOf(l)>=0?"[Circular]":(n.push(l),l)}}(t))}var Kn=`#vg-tooltip-element { + visibility: hidden; + padding: 8px; + position: fixed; + z-index: 1000; + font-family: sans-serif; + font-size: 11px; + border-radius: 3px; + box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); + /* The default theme is the light theme. */ + background-color: rgba(255, 255, 255, 0.95); + border: 1px solid #d9d9d9; + color: black; +} +#vg-tooltip-element.visible { + visibility: visible; +} +#vg-tooltip-element h2 { + margin-top: 0; + margin-bottom: 10px; + font-size: 13px; +} +#vg-tooltip-element table { + border-spacing: 0; +} +#vg-tooltip-element table tr { + border: none; +} +#vg-tooltip-element table tr td { + overflow: hidden; + text-overflow: ellipsis; + padding-top: 2px; + padding-bottom: 2px; +} +#vg-tooltip-element table tr td.key { + color: #808080; + max-width: 150px; + text-align: right; + padding-right: 4px; +} +#vg-tooltip-element table tr td.value { + display: block; + max-width: 300px; + max-height: 7em; + text-align: left; +} +#vg-tooltip-element.dark-theme { + background-color: rgba(32, 32, 32, 0.9); + border: 1px solid #f5f5f5; + color: white; +} +#vg-tooltip-element.dark-theme td.key { + color: #bfbfbf; +} +`;const xt="vg-tooltip-element",Zn={offsetX:10,offsetY:10,id:xt,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/t(oe(a)?a:Nt(a,r))).join(", ")}]`;if($e(e)){let a="";const{title:l,image:s,...f}=e;l&&(a+=`

${t(l)}

`),s&&(a+=``);const o=Object.keys(f);if(o.length>0){a+="";for(const i of o){let u=f[i];u!==void 0&&($e(u)&&(u=Nt(u,r)),a+=``)}a+="
${t(i)}${t(u)}
"}return a||"{}"}return t(e)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function At(e,t,{offsetX:r,offsetY:n}){const a=Lt({x1:e.clientX,x2:e.clientX,y1:e.clientY,y2:e.clientY},t,r,n),l=["bottom-right","bottom-left","top-right","top-left"];for(const s of l)if(Rt(a[s],t))return a[s];return a["top-left"]}function Lt(e,t,r,n){const a=(e.x1+e.x2)/2,l=(e.y1+e.y2)/2,s=e.x1-t.width-r,f=a-t.width/2,o=e.x2+r,i=e.y1-t.height-n,u=l-t.height/2,c=e.y2+n;return{top:{x:f,y:i},bottom:{x:f,y:c},left:{x:s,y:u},right:{x:o,y:u},"top-left":{x:s,y:i},"top-right":{x:o,y:i},"bottom-left":{x:s,y:c},"bottom-right":{x:o,y:c}}}function Rt(e,t){return e.x>=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function ei(e,t,r){return e.clientX>=t.x&&e.clientX<=t.x+r.width&&e.clientY>=t.y&&e.clientY<=t.y+r.height}class ti{constructor(t){this.options={...Zn,...t};const r=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const n=document.createElement("style");n.setAttribute("id",this.options.styleId),n.innerHTML=function(l){if(!/^[A-Za-z]+[-:.\w]*$/.test(l))throw new Error("Invalid HTML ID");return Kn.toString().replace(xt,l)}(r);const a=document.head;a.childNodes.length>0?a.insertBefore(n,a.childNodes[0]):a.appendChild(n)}}tooltipHandler(t,r,n,a){if(this.el=document.getElementById(this.options.id),!this.el&&(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),a==null||a==="")return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(a,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:l,y:s}=this.options.anchor==="mark"?function(f,o,i,u,c){const{position:d,offsetX:b,offsetY:T}=c,x=function(N,_,L){const C=L.isVoronoi?L.datum.bounds:L.bounds;let F=N.left+_[0]+C.x1,P=N.top+_[1]+C.y1,k=L;for(;k.mark.group;)k=k.mark.group,F+=k.x??0,P+=k.y??0;return{x1:F,x2:F+(C.x2-C.x1),y1:P,y2:P+(C.y2-C.y1)}}(f._el.getBoundingClientRect(),f._origin,i),S=Lt(x,u,b,T),G=Array.isArray(d)?d:[d];for(const N of G)if(Rt(S[N],u)&&!ei(o,S[N],u))return S[N];return At(o,u,c)}(t,r,n,this.el.getBoundingClientRect(),this.options):At(r,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${s}px`,this.el.style.left=`${l}px`}}var Me={},ri=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var l in a)a.hasOwnProperty(l)&&(n[l]=a[l])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),ni=Object.prototype.hasOwnProperty;/*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017-2022 Joachim Wester + * MIT licensed + */function je(e,t){return ni.call(e,t)}function ze(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r=48&&t<=57))return!1;r++}return!0}function Z(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function $t(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Ge(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t0&&f[i-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&c===void 0&&(o[d]===void 0?c=f.slice(0,i).join("/"):i==u-1&&(c=t.path),c!==void 0&&b(t,0,e,c)),i++,Array.isArray(o)){if(d==="-")d=o.length;else{if(r&&!Ue(d))throw new $("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",l,t,e);Ue(d)&&(d=~~d)}if(i>=u){if(r&&t.op==="add"&&d>o.length)throw new $("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",l,t,e);if((s=oi[t.op].call(t,o,d,e)).test===!1)throw new $("Test operation failed","TEST_OPERATION_FAILED",l,t,e);return s}}else if(i>=u){if((s=ne[t.op].call(t,o,d,e)).test===!1)throw new $("Test operation failed","TEST_OPERATION_FAILED",l,t,e);return s}if(o=o[d],r&&i0)throw new $('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new $("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new $("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Ge(e.value))throw new $("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var a=e.path.split("/").length,l=n.split("/").length;if(a!==l+1&&a!==l)throw new $("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new $("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s=Ct([{op:"_get",path:e.from,value:void 0}],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new $("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}function Ct(e,t,r){try{if(!Array.isArray(e))throw new $("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Oe(M(t),M(e),r||!0);else{r=r||Ie;for(var n=0;n0&&(e.patches=[],e.callback&&e.callback(n)),n}function We(e,t,r,n,a){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var l=ze(t),s=ze(e),f=!1,o=s.length-1;o>=0;o--){var i=e[c=s[o]];if(!je(t,c)||t[c]===void 0&&i!==void 0&&Array.isArray(t)===!1)Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:n+"/"+Z(c),value:M(i)}),r.push({op:"remove",path:n+"/"+Z(c)}),f=!0):(a&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}));else{var u=t[c];typeof i=="object"&&i!=null&&typeof u=="object"&&u!=null&&Array.isArray(i)===Array.isArray(u)?We(i,u,r,n+"/"+Z(c),a):i!==u&&(a&&r.push({op:"test",path:n+"/"+Z(c),value:M(i)}),r.push({op:"replace",path:n+"/"+Z(c),value:M(u)}))}}if(f||l.length!=s.length)for(o=0;or?typeof r!="object"?e:r:t}Object.assign({},si,ci,{JsonPatchError:Tt,deepClone:M,escapePathComponent:Z,unescapePathComponent:$t});var _t,Mt,jt,zt,Ut,Gt,Bt,Vt,Wt,Xt,Ht,Yt,qt,Jt,Qt,Kt,Zt,er,tr,rr,nr,ir,or,sr,ar,He,lr,Ye,cr,dr,fr,qe={exports:{}};function Je(){return Mt?_t:(Mt=1,_t={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2})}function Ne(){return zt?jt:(zt=1,jt=typeof process=="object"&&Me&&Me.NODE_DEBUG&&/\bsemver\b/i.test(Me.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{})}function Qe(){return Ut||(Ut=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Je(),l=Ne(),s=(t=e.exports={}).re=[],f=t.safeRe=[],o=t.src=[],i=t.t={};let u=0;const c="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",a],[c,n]],b=(T,x,S)=>{const G=(_=>{for(const[L,C]of d)_=_.split(`${L}*`).join(`${L}{0,${C}}`).split(`${L}+`).join(`${L}{1,${C}}`);return _})(x),N=u++;l(T,N,x),i[T]=N,o[N]=x,s[N]=new RegExp(x,S?"g":void 0),f[N]=new RegExp(G,S?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*"),b("NUMERICIDENTIFIERLOOSE","\\d+"),b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),b("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`),b("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${c}+`),b("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`),b("FULL",`^${o[i.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`),b("LOOSE",`^${o[i.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${o[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${o[i.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?)?)?`),b("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),b("COERCE",`${o[i.COERCEPLAIN]}(?:$|[^\\d])`),b("COERCEFULL",o[i.COERCEPLAIN]+`(?:${o[i.PRERELEASE]})?(?:${o[i.BUILD]})?(?:$|[^\\d])`),b("COERCERTL",o[i.COERCE],!0),b("COERCERTLFULL",o[i.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",b("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",b("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})\\s+-\\s+(${o[i.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[i.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(qe,qe.exports)),qe.exports}function Ke(){if(Wt)return Vt;Wt=1;const e=Ne(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Je(),{safeRe:n,t:a}=Qe(),l=Xe(),{compareIdentifiers:s}=function(){if(Bt)return Gt;Bt=1;const o=/^[0-9]+$/,i=(u,c)=>{const d=o.test(u),b=o.test(c);return d&&b&&(u=+u,c=+c),u===c?0:d&&!b?-1:b&&!d?1:ui(c,u)}}();class f{constructor(i,u){if(u=l(u),i instanceof f){if(i.loose===!!u.loose&&i.includePrerelease===!!u.includePrerelease)return i;i=i.version}else if(typeof i!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);if(i.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",i,u),this.options=u,this.loose=!!u.loose,this.includePrerelease=!!u.includePrerelease;const c=i.trim().match(u.loose?n[a.LOOSE]:n[a.FULL]);if(!c)throw new TypeError(`Invalid Version: ${i}`);if(this.raw=i,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const b=+d;if(b>=0&&b=0;)typeof this.prerelease[b]=="number"&&(this.prerelease[b]++,b=-2);if(b===-1){if(u===this.prerelease.join(".")&&c===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(u){let b=[u,d];c===!1&&(b=[u]),s(this.prerelease[0],u)===0?isNaN(this.prerelease[1])&&(this.prerelease=b):this.prerelease=b}break}default:throw new Error(`invalid increment argument: ${i}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Vt=f}function ie(){if(Ht)return Xt;Ht=1;const e=Ke();return Xt=(t,r,n)=>new e(t,n).compare(new e(r,n))}function fi(){if(ar)return sr;ar=1;const e=function(){if(qt)return Yt;qt=1;const s=ie();return Yt=(f,o,i)=>s(f,o,i)===0}(),t=function(){if(Qt)return Jt;Qt=1;const s=ie();return Jt=(f,o,i)=>s(f,o,i)!==0}(),r=function(){if(Zt)return Kt;Zt=1;const s=ie();return Kt=(f,o,i)=>s(f,o,i)>0}(),n=function(){if(tr)return er;tr=1;const s=ie();return er=(f,o,i)=>s(f,o,i)>=0}(),a=function(){if(nr)return rr;nr=1;const s=ie();return rr=(f,o,i)=>s(f,o,i)<0}(),l=function(){if(or)return ir;or=1;const s=ie();return ir=(f,o,i)=>s(f,o,i)<=0}();return sr=(s,f,o,i)=>{switch(f){case"===":return typeof s=="object"&&(s=s.version),typeof o=="object"&&(o=o.version),s===o;case"!==":return typeof s=="object"&&(s=s.version),typeof o=="object"&&(o=o.version),s!==o;case"":case"=":case"==":return e(s,o,i);case"!=":return t(s,o,i);case">":return r(s,o,i);case">=":return n(s,o,i);case"<":return a(s,o,i);case"<=":return l(s,o,i);default:throw new TypeError(`Invalid operator: ${f}`)}}}function pr(){if(cr)return Ye;cr=1;const e=/\s+/g;class t{constructor(m,p){if(p=n(p),m instanceof t)return m.loose===!!p.loose&&m.includePrerelease===!!p.includePrerelease?m:new t(m.raw,p);if(m instanceof a)return this.raw=m.value,this.set=[[m]],this.formatted=void 0,this;if(this.options=p,this.loose=!!p.loose,this.includePrerelease=!!p.includePrerelease,this.raw=m.trim().replace(e," "),this.set=this.raw.split("||").map(g=>this.parseRange(g.trim())).filter(g=>g.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const g=this.set[0];if(this.set=this.set.filter(h=>!T(h[0])),this.set.length===0)this.set=[g];else if(this.set.length>1){for(const h of this.set)if(h.length===1&&x(h[0])){this.set=[h];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let m=0;m0&&(this.formatted+="||");const p=this.set[m];for(let g=0;g0&&(this.formatted+=" "),this.formatted+=p[g].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(m){const p=((this.options.includePrerelease&&d)|(this.options.loose&&b))+":"+m,g=r.get(p);if(g)return g;const h=this.options.loose,E=h?f[o.HYPHENRANGELOOSE]:f[o.HYPHENRANGE];m=m.replace(E,j(this.options.includePrerelease)),l("hyphen replace",m),m=m.replace(f[o.COMPARATORTRIM],i),l("comparator trim",m),m=m.replace(f[o.TILDETRIM],u),l("tilde trim",m),m=m.replace(f[o.CARETTRIM],c),l("caret trim",m);let w=m.split(" ").map(y=>G(y,this.options)).join(" ").split(/\s+/).map(y=>Le(y,this.options));h&&(w=w.filter(y=>(l("loose invalid filter",y,this.options),!!y.match(f[o.COMPARATORLOOSE])))),l("range list",w);const O=new Map,I=w.map(y=>new a(y,this.options));for(const y of I){if(T(y))return[y];O.set(y.value,y)}O.size>1&&O.has("")&&O.delete("");const R=[...O.values()];return r.set(p,R),R}intersects(m,p){if(!(m instanceof t))throw new TypeError("a Range is required");return this.set.some(g=>S(g,p)&&m.set.some(h=>S(h,p)&&g.every(E=>h.every(w=>E.intersects(w,p)))))}test(m){if(!m)return!1;if(typeof m=="string")try{m=new s(m,this.options)}catch{return!1}for(let p=0;p=this.max){const p=this.map.keys().next().value;this.delete(p)}this.map.set(v,m)}return this}})),n=Xe(),a=function(){if(lr)return He;lr=1;const v=Symbol("SemVer ANY");class m{static get ANY(){return v}constructor(y,A){if(A=p(A),y instanceof m){if(y.loose===!!A.loose)return y;y=y.value}y=y.trim().split(/\s+/).join(" "),w("comparator",y,A),this.options=A,this.loose=!!A.loose,this.parse(y),this.semver===v?this.value="":this.value=this.operator+this.semver.version,w("comp",this)}parse(y){const A=this.options.loose?g[h.COMPARATORLOOSE]:g[h.COMPARATOR],D=y.match(A);if(!D)throw new TypeError(`Invalid comparator: ${y}`);this.operator=D[1]!==void 0?D[1]:"",this.operator==="="&&(this.operator=""),D[2]?this.semver=new O(D[2],this.options.loose):this.semver=v}toString(){return this.value}test(y){if(w("Comparator.test",y,this.options.loose),this.semver===v||y===v)return!0;if(typeof y=="string")try{y=new O(y,this.options)}catch{return!1}return E(y,this.operator,this.semver,this.options)}intersects(y,A){if(!(y instanceof m))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""||new I(y.value,A).test(this.value):y.operator===""?y.value===""||new I(this.value,A).test(y.semver):!((A=p(A)).includePrerelease&&(this.value==="<0.0.0-0"||y.value==="<0.0.0-0")||!A.includePrerelease&&(this.value.startsWith("<0.0.0")||y.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!y.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!y.operator.startsWith("<"))&&(this.semver.version!==y.semver.version||!this.operator.includes("=")||!y.operator.includes("="))&&!(E(this.semver,"<",y.semver,A)&&this.operator.startsWith(">")&&y.operator.startsWith("<"))&&!(E(this.semver,">",y.semver,A)&&this.operator.startsWith("<")&&y.operator.startsWith(">")))}}He=m;const p=Xe(),{safeRe:g,t:h}=Qe(),E=fi(),w=Ne(),O=Ke(),I=pr();return He}(),l=Ne(),s=Ke(),{safeRe:f,t:o,comparatorTrimReplace:i,tildeTrimReplace:u,caretTrimReplace:c}=Qe(),{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:b}=Je(),T=v=>v.value==="<0.0.0-0",x=v=>v.value==="",S=(v,m)=>{let p=!0;const g=v.slice();let h=g.pop();for(;p&&g.length;)p=g.every(E=>h.intersects(E,m)),h=g.pop();return p},G=(v,m)=>(l("comp",v,m),v=C(v,m),l("caret",v),v=_(v,m),l("tildes",v),v=P(v,m),l("xrange",v),v=me(v,m),l("stars",v),v),N=v=>!v||v.toLowerCase()==="x"||v==="*",_=(v,m)=>v.trim().split(/\s+/).map(p=>L(p,m)).join(" "),L=(v,m)=>{const p=m.loose?f[o.TILDELOOSE]:f[o.TILDE];return v.replace(p,(g,h,E,w,O)=>{let I;return l("tilde",v,g,h,E,w,O),N(h)?I="":N(E)?I=`>=${h}.0.0 <${+h+1}.0.0-0`:N(w)?I=`>=${h}.${E}.0 <${h}.${+E+1}.0-0`:O?(l("replaceTilde pr",O),I=`>=${h}.${E}.${w}-${O} <${h}.${+E+1}.0-0`):I=`>=${h}.${E}.${w} <${h}.${+E+1}.0-0`,l("tilde return",I),I})},C=(v,m)=>v.trim().split(/\s+/).map(p=>F(p,m)).join(" "),F=(v,m)=>{l("caret",v,m);const p=m.loose?f[o.CARETLOOSE]:f[o.CARET],g=m.includePrerelease?"-0":"";return v.replace(p,(h,E,w,O,I)=>{let R;return l("caret",v,h,E,w,O,I),N(E)?R="":N(w)?R=`>=${E}.0.0${g} <${+E+1}.0.0-0`:N(O)?R=E==="0"?`>=${E}.${w}.0${g} <${E}.${+w+1}.0-0`:`>=${E}.${w}.0${g} <${+E+1}.0.0-0`:I?(l("replaceCaret pr",I),R=E==="0"?w==="0"?`>=${E}.${w}.${O}-${I} <${E}.${w}.${+O+1}-0`:`>=${E}.${w}.${O}-${I} <${E}.${+w+1}.0-0`:`>=${E}.${w}.${O}-${I} <${+E+1}.0.0-0`):(l("no pr"),R=E==="0"?w==="0"?`>=${E}.${w}.${O}${g} <${E}.${w}.${+O+1}-0`:`>=${E}.${w}.${O}${g} <${E}.${+w+1}.0-0`:`>=${E}.${w}.${O} <${+E+1}.0.0-0`),l("caret return",R),R})},P=(v,m)=>(l("replaceXRanges",v,m),v.split(/\s+/).map(p=>k(p,m)).join(" ")),k=(v,m)=>{v=v.trim();const p=m.loose?f[o.XRANGELOOSE]:f[o.XRANGE];return v.replace(p,(g,h,E,w,O,I)=>{l("xRange",v,g,h,E,w,O,I);const R=N(E),y=R||N(w),A=y||N(O),D=A;return h==="="&&D&&(h=""),I=m.includePrerelease?"-0":"",R?g=h===">"||h==="<"?"<0.0.0-0":"*":h&&D?(y&&(w=0),O=0,h===">"?(h=">=",y?(E=+E+1,w=0,O=0):(w=+w+1,O=0)):h==="<="&&(h="<",y?E=+E+1:w=+w+1),h==="<"&&(I="-0"),g=`${h+E}.${w}.${O}${I}`):y?g=`>=${E}.0.0${I} <${+E+1}.0.0-0`:A&&(g=`>=${E}.${w}.0${I} <${E}.${+w+1}.0-0`),l("xRange return",g),g})},me=(v,m)=>(l("replaceStars",v,m),v.trim().replace(f[o.STAR],"")),Le=(v,m)=>(l("replaceGTE0",v,m),v.trim().replace(f[m.includePrerelease?o.GTE0PRE:o.GTE0],"")),j=v=>(m,p,g,h,E,w,O,I,R,y,A,D)=>`${p=N(g)?"":N(h)?`>=${g}.0.0${v?"-0":""}`:N(E)?`>=${g}.${h}.0${v?"-0":""}`:w?`>=${p}`:`>=${p}${v?"-0":""}`} ${I=N(R)?"":N(y)?`<${+R+1}.0.0-0`:N(A)?`<${R}.${+y+1}.0-0`:D?`<=${R}.${y}.${A}-${D}`:v?`<${R}.${y}.${+A+1}-0`:`<=${I}`}`.trim(),te=(v,m,p)=>{for(let g=0;g0){const h=v[g].semver;if(h.major===m.major&&h.minor===m.minor&&h.patch===m.patch)return!0}return!1}return!0};return Ye}var hr=di(function(){if(fr)return dr;fr=1;const e=pr();return dr=(t,r,n)=>{try{r=new e(r,n)}catch{return!1}return r.test(t)}}()),pi=`.vega-embed { + position: relative; + display: inline-block; + box-sizing: border-box; +} +.vega-embed.has-actions { + padding-right: 38px; +} +.vega-embed details:not([open]) > :not(summary) { + display: none !important; +} +.vega-embed summary { + list-style: none; + position: absolute; + top: 0; + right: 0; + padding: 6px; + z-index: 1000; + background: white; + box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); + color: #1b1e23; + border: 1px solid #aaa; + border-radius: 999px; + opacity: 0.2; + transition: opacity 0.4s ease-in; + cursor: pointer; + line-height: 0px; +} +.vega-embed summary::-webkit-details-marker { + display: none; +} +.vega-embed summary:active { + box-shadow: #aaa 0px 0px 0px 1px inset; +} +.vega-embed summary svg { + width: 14px; + height: 14px; +} +.vega-embed details[open] summary { + opacity: 0.7; +} +.vega-embed:hover summary, .vega-embed:focus-within summary { + opacity: 1 !important; + transition: opacity 0.2s ease; +} +.vega-embed .vega-actions { + position: absolute; + z-index: 1001; + top: 35px; + right: -9px; + display: flex; + flex-direction: column; + padding-bottom: 8px; + padding-top: 8px; + border-radius: 4px; + box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); + border: 1px solid #d9d9d9; + background: white; + animation-duration: 0.15s; + animation-name: scale-in; + animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); + text-align: left; +} +.vega-embed .vega-actions a { + padding: 8px 16px; + font-family: sans-serif; + font-size: 14px; + font-weight: 600; + white-space: nowrap; + color: #434a56; + text-decoration: none; +} +.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus { + background-color: #f7f7f9; + color: black; +} +.vega-embed .vega-actions::before, .vega-embed .vega-actions::after { + content: ""; + display: inline-block; + position: absolute; +} +.vega-embed .vega-actions::before { + left: auto; + right: 14px; + top: -16px; + border: 8px solid rgba(0, 0, 0, 0); + border-bottom-color: #d9d9d9; +} +.vega-embed .vega-actions::after { + left: auto; + right: 15px; + top: -14px; + border: 7px solid rgba(0, 0, 0, 0); + border-bottom-color: #fff; +} +.vega-embed .chart-wrapper.fit-x { + width: 100%; +} +.vega-embed .chart-wrapper.fit-y { + height: 100%; +} + +.vega-embed-wrapper { + max-width: 100%; + overflow: auto; + padding-right: 14px; +} + +@keyframes scale-in { + from { + opacity: 0; + transform: scale(0.6); + } + to { + opacity: 1; + transform: scale(1); + } +} +`;function ur(e,...t){for(const r of t)hi(e,r);return e}function hi(e,t){for(const r of Object.keys(t))Rr(e,r,t[r],!0)}const B=yn;let pe=Cn;const xe=typeof window<"u"?window:void 0;pe===void 0&&((Ir=xe==null?void 0:xe.vl)!=null&&Ir.compile)&&(pe=xe.vl);const ui={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},mi={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},he={vega:"Vega","vega-lite":"Vega-Lite"},Ae={vega:B.version,"vega-lite":pe?pe.version:"not available"},gi={vega:e=>e,"vega-lite":(e,t)=>pe.compile(e,{config:t}).spec},Ei=` + + + + +`,vi="chart-wrapper";function mr(e,t,r,n){const a=`${t}
`,l=`
${r}`,s=window.open("");s.document.write(a+e+l),s.document.title=`${he[n]} JSON Source`}function gr(e){return!(!e||!("load"in e))}function Er(e){return gr(e)?e:B.loader(e)}async function bi(e,t,r={}){let n,a;oe(t)?(a=Er(r.loader),n=JSON.parse(await a.load(t))):n=t;const l=function(u){var d;const c=((d=u.usermeta)==null?void 0:d.embedOptions)??{};return oe(c.defaultStyle)&&(c.defaultStyle=!1),c}(n),s=l.loader;a&&!s||(a=Er(r.loader??s));const f=await vr(l,a),o=await vr(r,a),i={...ur(o,f),config:ot(o.config??{},f.config??{})};return await async function(u,c,d={},b){const T=d.theme?ot(Qn[d.theme],d.config??{}):d.config,x=Lr(d.actions)?d.actions:ur({},ui,d.actions??{}),S={...mi,...d.i18n},G=d.renderer??"canvas",N=d.logLevel??B.Warn,_=d.downloadFileName??"visualization",L=typeof u=="string"?document.querySelector(u):u;if(!L)throw new Error(`${u} does not exist`);if(d.defaultStyle!==!1){const p="vega-embed-style",{root:g,rootContainer:h}=function(E){const w=E.getRootNode?E.getRootNode():document;return w instanceof ShadowRoot?{root:w,rootContainer:w}:{root:document,rootContainer:document.head??document.body}}(L);if(!g.getElementById(p)){const E=document.createElement("style");E.id=p,E.innerHTML=d.defaultStyle===void 0||d.defaultStyle===!0?pi.toString():d.defaultStyle,h.appendChild(E)}}const C=function(p,g){if(p.$schema){const h=lt(p.$schema);g&&g!==h.library&&console.warn(`The given visualization spec is written in ${he[h.library]}, but mode argument sets ${he[g]??g}.`);const E=h.library;return hr(Ae[E],`^${h.version.slice(1)}`)||console.warn(`The input spec uses ${he[E]} ${h.version}, but the current version of ${he[E]} is v${Ae[E]}.`),E}return"mark"in p||"encoding"in p||"layer"in p||"hconcat"in p||"vconcat"in p||"facet"in p||"repeat"in p?"vega-lite":"marks"in p||"signals"in p||"scales"in p||"axes"in p?"vega":g??"vega"}(c,d.mode);let F=gi[C](c,T);if(C==="vega-lite"&&F.$schema){const p=lt(F.$schema);hr(Ae.vega,`^${p.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${p.version}, but current version is v${Ae.vega}.`)}L.classList.add("vega-embed"),x&&L.classList.add("has-actions"),L.innerHTML="";let P=L;if(x){const p=document.createElement("div");p.classList.add(vi),L.appendChild(p),P=p}const k=d.patch;if(k&&(F=k instanceof Function?k(F):Oe(F,k,!0,!1).newDocument),d.formatLocale&&B.formatLocale(d.formatLocale),d.timeFormatLocale&&B.timeFormatLocale(d.timeFormatLocale),d.expressionFunctions)for(const p in d.expressionFunctions){const g=d.expressionFunctions[p];"fn"in g?B.expressionFunction(p,g.fn,g.visitor):g instanceof Function&&B.expressionFunction(p,g)}const{ast:me}=d,Le=B.parse(F,C==="vega-lite"?{}:T,{ast:me}),j=new(d.viewClass||B.View)(Le,{loader:b,logLevel:N,renderer:G,...me?{expr:B.expressionInterpreter??d.expr??Sn}:{}});if(j.addSignalListener("autosize",(p,g)=>{const{type:h}=g;h=="fit-x"?(P.classList.add("fit-x"),P.classList.remove("fit-y")):h=="fit-y"?(P.classList.remove("fit-x"),P.classList.add("fit-y")):h=="fit"?P.classList.add("fit-x","fit-y"):P.classList.remove("fit-x","fit-y")}),d.tooltip!==!1){const{loader:p,tooltip:g}=d,h=p&&!gr(p)?p==null?void 0:p.baseURL:void 0,E=typeof g=="function"?g:new ti({baseURL:h,...g===!0?{}:g}).call;j.tooltip(E)}let te,{hover:v}=d;if(v===void 0&&(v=C==="vega"),v){const{hoverSet:p,updateSet:g}=typeof v=="boolean"?{}:v;j.hover(p,g)}if(d&&(d.width!=null&&j.width(d.width),d.height!=null&&j.height(d.height),d.padding!=null&&j.padding(d.padding)),await j.initialize(P,d.bind).runAsync(),x!==!1){let p=L;if(d.defaultStyle!==!1||d.forceActionsMenu){const h=document.createElement("details");h.title=S.CLICK_TO_VIEW_ACTIONS,L.append(h),p=h;const E=document.createElement("summary");E.innerHTML=Ei,h.append(E),te=w=>{h.contains(w.target)||h.removeAttribute("open")},document.addEventListener("click",te)}const g=document.createElement("div");if(p.append(g),g.classList.add("vega-actions"),x===!0||x.export!==!1){for(const h of["svg","png"])if(x===!0||x.export===!0||x.export[h]){const E=S[`${h.toUpperCase()}_ACTION`],w=document.createElement("a"),O=$e(d.scaleFactor)?d.scaleFactor[h]:d.scaleFactor;w.text=E,w.href="#",w.target="_blank",w.download=`${_}.${h}`,w.addEventListener("mousedown",async function(I){I.preventDefault();const R=await j.toImageURL(h,O);this.href=R}),g.append(w)}}if(x===!0||x.source!==!1){const h=document.createElement("a");h.text=S.SOURCE_ACTION,h.href="#",h.addEventListener("click",function(E){mr(Te(c),d.sourceHeader??"",d.sourceFooter??"",C),E.preventDefault()}),g.append(h)}if(C==="vega-lite"&&(x===!0||x.compiled!==!1)){const h=document.createElement("a");h.text=S.COMPILED_ACTION,h.href="#",h.addEventListener("click",function(E){mr(Te(F),d.sourceHeader??"",d.sourceFooter??"","vega"),E.preventDefault()}),g.append(h)}if(x===!0||x.editor!==!1){const h=d.editorUrl??"https://vega.github.io/editor/",E=document.createElement("a");E.text=S.EDITOR_ACTION,E.href="#",E.addEventListener("click",function(w){(function(O,I,R){const y=O.open(I),{origin:A}=new URL(I);let D=40;O.addEventListener("message",function Re(Nr){Nr.source===y&&(D=0,O.removeEventListener("message",Re,!1))},!1),setTimeout(function Re(){D<=0||(y.postMessage(R,A),setTimeout(Re,250),D-=1)},250)})(window,h,{config:T,mode:k?"vega":C,renderer:G,spec:Te(k?F:c)}),w.preventDefault()}),g.append(E)}}function m(){te&&document.removeEventListener("click",te),j.finalize()}return{view:j,spec:c,vgSpec:F,finalize:m,embedOptions:d}}(e,n,i,a)}async function vr(e,t){const r=oe(e.config)?JSON.parse(await t.load(e.config)):e.config??{},n=oe(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...n?{patch:n}:{},...r?{config:r}:{}}}function yi(e,t){Object.keys(t).forEach(r=>{(function(n,a,l){var s;l&&((s=l)&&{}.toString.call(s)==="[object Function]"?l(n.data(a)):n.change(a,B.changeset().remove(()=>!0).insert(l)))})(e,r,t[r])})}function br(e){const t=new Set;return e.forEach(r=>{Object.keys(r).forEach(n=>{t.add(n)})}),t}const yr=()=>{};function Ze(e,t){const r=Object.keys(t);return r.forEach(n=>{try{e.addSignalListener(n,t[n])}catch(a){console.warn("Cannot add invalid signal listener.",a)}}),r.length>0}function wr(e,t){const r=Object.keys(t);return r.forEach(n=>{try{e.removeSignalListener(n,t[n])}catch(a){console.warn("Cannot remove invalid signal listener.",a)}}),r.length>0}function et(e){const{spec:t,width:r,height:n}=e;return r!==void 0&&n!==void 0?{...t,width:r,height:n}:r!==void 0?{...t,width:r}:n!==void 0?{...t,height:n}:t}function ue(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Or extends V.PureComponent{constructor(){super(...arguments),ue(this,"containerRef",V.createRef()),ue(this,"resultPromise",void 0),ue(this,"handleError",t=>{const{onError:r=yr}=this.props;r(t,this.containerRef.current),console.warn(t)}),ue(this,"modifyView",t=>{this.resultPromise&&this.resultPromise.then(r=>(r&&t(r.view),!0)).catch(this.handleError)})}componentDidMount(){this.createView()}componentDidUpdate(t){const r=br([this.props,t]);if(r.delete("className"),r.delete("signalListeners"),r.delete("spec"),r.delete("style"),r.delete("width"),r.delete("height"),Array.from(r).some(n=>this.props[n]!==t[n]))this.clearView(),this.createView();else{const n=function(s,f){if(s===f)return!1;const o={width:!1,height:!1,isExpensive:!1},i=br([s,f]);return!i.has("width")||"width"in s&&"width"in f&&s.width===f.width||("width"in s&&typeof s.width=="number"?o.width=s.width:o.isExpensive=!0),!i.has("height")||"height"in s&&"height"in f&&s.height===f.height||("height"in s&&typeof s.height=="number"?o.height=s.height:o.isExpensive=!0),i.delete("width"),i.delete("height"),[...i].some(u=>!(u in s)||!(u in f)||!wn(s[u],f[u]))&&(o.isExpensive=!0),!(o.width===!1&&o.height===!1&&!o.isExpensive)&&o}(et(this.props),et(t)),{signalListeners:a}=this.props,{signalListeners:l}=t;if(n)if(n.isExpensive)this.clearView(),this.createView();else{const s=!Se(a,l);this.modifyView(f=>{n.width!==!1&&f.width(n.width),n.height!==!1&&f.height(n.height),s&&(l&&wr(f,l),a&&Ze(f,a)),f.run()})}else Se(a,l)||this.modifyView(s=>{l&&wr(s,l),a&&Ze(s,a),s.run()})}}componentWillUnmount(){this.clearView()}createView(){const{spec:t,onNewView:r,signalListeners:n={},width:a,height:l,...s}=this.props;if(this.containerRef.current){const f=et(this.props);this.resultPromise=bi(this.containerRef.current,f,s).then(o=>{if(o){const{view:i}=o;Ze(i,n)&&i.run()}return o}).catch(this.handleError),r&&this.modifyView(r)}}clearView(){return this.resultPromise&&this.resultPromise.then(t=>{t&&t.finalize()}).catch(this.handleError),this.resultPromise=void 0,this}render(){const{className:t,style:r}=this.props;return V.createElement("div",{ref:this.containerRef,className:t,style:r})}}function tt(){return tt=Object.assign||function(e){for(var t=1;t{this.update();const{onNewView:r=yr}=this.props;r(t)})}componentDidMount(){this.update()}componentDidUpdate(t){Se(this.props.data,t.data)||this.update()}update(){const{data:t}=this.props;this.vegaEmbed.current&&t&&Object.keys(t).length>0&&this.vegaEmbed.current.modifyView(r=>{yi(r,t),r.resize().run()})}render(){const{data:t,...r}=this.props;return V.createElement(Or,tt({ref:this.vegaEmbed},r,{onNewView:this.handleNewView}))}}function it(){return it=Object.assign||function(e){for(var t=1;t-1}var Y=Object.getOwnPropertySymbols?function(r){for(var e=[];r;)J(e,F(r)),r=K(r);return e}:H;function $(r){return rr(r,m,Y)}var dr=Object.prototype.hasOwnProperty,Ar=/\w*$/,z=M?M.prototype:void 0,G=z?z.valueOf:void 0;function hr(r,e,n){var u,i,a,c=r.constructor;switch(e){case"[object ArrayBuffer]":return B(r);case"[object Boolean]":case"[object Date]":return new c(+r);case"[object DataView]":return function(s,b){var v=b?B(s.buffer):s.buffer;return new s.constructor(v,s.byteOffset,s.byteLength)}(r,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return er(r,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(r);case"[object RegExp]":return(a=new(i=r).constructor(i.source,Ar.exec(i))).lastIndex=i.lastIndex,a;case"[object Symbol]":return u=r,G?Object(G.call(u)):{}}}var L=d&&d.isMap,gr=L?P(L):function(r){return D(r)&&S(r)=="[object Map]"},Q=d&&d.isSet,wr=Q?P(Q):function(r){return D(r)&&S(r)=="[object Set]"},T="[object Arguments]",X="[object Function]",Z="[object Object]",o={};function h(r,e,n,u,i,a){var c,s=1&e,b=2&e,v=4&e;if(c!==void 0)return c;if(!nr(r))return r;var l=A(r);if(l){if(c=function(t){var f=t.length,g=new t.constructor(f);return f&&typeof t[0]=="string"&&dr.call(t,"index")&&(g.index=t.index,g.input=t.input),g}(r),!s)return tr(r,c)}else{var j=S(r),y=j==X||j=="[object GeneratorFunction]";if(cr(r))return or(r,s);if(j==Z||j==T||y&&!i){if(c=b||y?{}:ar(r),!s)return b?function(t,f){return p(t,Y(t),f)}(r,function(t,f){return t&&p(f,m(f),t)}(c,r)):function(t,f){return p(t,F(t),f)}(r,function(t,f){return t&&p(f,w(f),t)}(c,r))}else{if(!o[j])return i?r:{};c=hr(r,j,s)}}a||(a=new ur);var O=a.get(r);if(O)return O;a.set(r,c),wr(r)?r.forEach(function(t){c.add(h(t,e,n,t,r,a))}):gr(r)&&r.forEach(function(t,f){c.set(f,h(t,e,n,f,r,a))});var E=l?void 0:(v?b?$:sr:b?m:w)(r);return R(E||r,function(t,f){E&&(t=r[f=t]),ir(c,f,h(t,e,n,f,r,a))}),c}function _(r){return typeof r=="function"?r:fr}function mr(r,e){return(A(r)?R:I)(r,_(e))}function q(r,e){var n=[];return I(r,function(u,i,a){e(u,i,a)&&n.push(u)}),n}function Sr(r,e){return(A(r)?br:q)(r,V(e))}function xr(r){return r==null?[]:function(e,n){return jr(n,function(u){return e[u]})}(r,w(r))}function Ir(r){return r===void 0}function Or(r,e,n,u,i){return i(r,function(a,c,s){n=u?(u=!1,a):e(n,a,c,s)}),n}function Er(r,e,n){var u=A(r)?lr:Or,i=arguments.length<3;return u(r,V(e),n,i,I)}o[T]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object DataView]"]=o["[object Boolean]"]=o["[object Date]"]=o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Map]"]=o["[object Number]"]=o[Z]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object Symbol]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Error]"]=o[X]=o["[object WeakMap]"]=!1;var Fr=x&&1/U(new x([,-0]))[1]==1/0?function(r){return new x(r)}:C;function Br(r,e,n){var u=-1,i=W,a=r.length,c=!0,s=[],b=s;if(a>=200){var v=e?null:Fr(r);if(v)return U(v);c=!1,i=yr,b=new vr}else b=e?[]:s;r:for(;++u{const o=h.c(26);let t,r,m,i,l;o[0]!==f?({language:t,showCopyButton:m,extensions:i,...r}=f,o[0]=f,o[1]=t,o[2]=r,o[3]=m,o[4]=i):(t=o[1],r=o[2],m=o[3],i=o[4]),o[5]!==i?(l=i===void 0?[]:i,o[5]=i,o[6]=l):l=o[6];const u=l,p=t&&!(t in b);let x;p&&C.warn(`Language ${t} not found in CodeMirror.`);o:{if(!t){x=u;break o}const v=t;let n,d;o[7]!==v?(n=L(v),o[7]=v,o[8]=n):n=o[8],o[9]!==u||o[10]!==n?(d=[n,...u].filter(Boolean),o[9]=u,o[10]=n,o[11]=d):d=o[11],x=d}const j=x;let e,a,s,c;return o[12]!==p||o[13]!==t?(e=p&&g.jsx(k,{className:"mb-1 rounded-sm",error:`Language ${t} not supported. + +Supported languages are: ${Object.keys(b).join(", ")}`}),o[12]=p,o[13]=t,o[14]=e):e=o[14],o[15]!==p||o[16]!==r||o[17]!==m?(a=m&&!p&&g.jsx(w,{tooltip:!1,className:"absolute top-2 right-2 p-1 hover-action z-10 text-muted-foreground",value:r.value||"",toastTitle:"Copied to clipboard"}),o[15]=p,o[16]=r,o[17]=m,o[18]=a):a=o[18],o[19]!==j||o[20]!==r?(s=g.jsx(y,{...r,extensions:j}),o[19]=j,o[20]=r,o[21]=s):s=o[21],o[22]!==e||o[23]!==a||o[24]!==s?(c=g.jsxs("div",{className:"relative w-full group hover-actions-parent",children:[e,a,s]}),o[22]=e,o[23]=a,o[24]=s,o[25]=c):c=o[25],c};export{N as default}; diff --git a/notebooks/assets/apl-CXdQSnD-.js b/notebooks/assets/apl-CXdQSnD-.js new file mode 100644 index 0000000000000000000000000000000000000000..364620f6dd7234d65f3db013f37db23bf0f3eec9 --- /dev/null +++ b/notebooks/assets/apl-CXdQSnD-.js @@ -0,0 +1 @@ +var o={"+":["conjugate","add"],"\u2212":["negate","subtract"],"\xD7":["signOf","multiply"],"\xF7":["reciprocal","divide"],"\u2308":["ceiling","greaterOf"],"\u230A":["floor","lesserOf"],"\u2223":["absolute","residue"],"\u2373":["indexGenerate","indexOf"],"?":["roll","deal"],"\u22C6":["exponentiate","toThePowerOf"],"\u235F":["naturalLog","logToTheBase"],"\u25CB":["piTimes","circularFuncs"],"!":["factorial","binomial"],"\u2339":["matrixInverse","matrixDivide"],"<":[null,"lessThan"],"\u2264":[null,"lessThanOrEqual"],"=":[null,"equals"],">":[null,"greaterThan"],"\u2265":[null,"greaterThanOrEqual"],"\u2260":[null,"notEqual"],"\u2261":["depth","match"],"\u2262":[null,"notMatch"],"\u2208":["enlist","membership"],"\u2377":[null,"find"],"\u222A":["unique","union"],"\u2229":[null,"intersection"],"\u223C":["not","without"],"\u2228":[null,"or"],"\u2227":[null,"and"],"\u2371":[null,"nor"],"\u2372":[null,"nand"],"\u2374":["shapeOf","reshape"],",":["ravel","catenate"],"\u236A":[null,"firstAxisCatenate"],"\u233D":["reverse","rotate"],"\u2296":["axis1Reverse","axis1Rotate"],"\u2349":["transpose",null],"\u2191":["first","take"],"\u2193":[null,"drop"],"\u2282":["enclose","partitionWithAxis"],"\u2283":["diclose","pick"],"\u2337":[null,"index"],"\u234B":["gradeUp",null],"\u2352":["gradeDown",null],"\u22A4":["encode",null],"\u22A5":["decode",null],"\u2355":["format","formatByExample"],"\u234E":["execute",null],"\u22A3":["stop","left"],"\u22A2":["pass","right"]},s=/[\.\/⌿⍀¨⍣]/,i=/⍬/,u=/[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/,c=/←/,p=/[⍝#].*$/;const d={name:"apl",startState:function(){return{prev:!1,func:!1,op:!1,string:!1,escape:!1}},token:function(t,n){var e,a,l;return t.eatSpace()?null:(e=t.next())==='"'||e==="'"?(t.eatWhile((a=e,l=!1,function(r){return l=r,r!==a||l==="\\"})),t.next(),n.prev=!0,"string"):/[\[{\(]/.test(e)?(n.prev=!1,null):/[\]}\)]/.test(e)?(n.prev=!0,null):i.test(e)?(n.prev=!1,"atom"):/[¯\d]/.test(e)?(n.func?(n.func=!1,n.prev=!1):n.prev=!0,t.eatWhile(/[\w\.]/),"number"):s.test(e)||c.test(e)?"operator":u.test(e)?(n.func=!0,n.prev=!1,o[e]?"variableName.function.standard":"variableName.function"):p.test(e)?(t.skipToEnd(),"comment"):e==="\u2218"&&t.peek()==="."?(t.next(),"variableName.function"):(t.eatWhile(/[\w\$_]/),n.prev=!0,"keyword")}};export{d as apl}; diff --git a/notebooks/assets/arc-CfyY4LWz.js b/notebooks/assets/arc-CfyY4LWz.js new file mode 100644 index 0000000000000000000000000000000000000000..c5dacffcbd647205f677609c2f33c151865812ad --- /dev/null +++ b/notebooks/assets/arc-CfyY4LWz.js @@ -0,0 +1 @@ +import{w as dt,p as lt,c as I,s as T,a as P,h as ft,e as f,t as Tt,b as D,m as rt,d as pt,f as o,g as gt,i as At,j as Rt}from"./step-BwsUM5iJ.js";function bt(i){return i.innerRadius}function jt(i){return i.outerRadius}function wt(i){return i.startAngle}function zt(i){return i.endAngle}function Pt(i){return i&&i.padAngle}function S(i,k,J,q,b,j,E){var e=i-J,V=k-q,c=(E?j:-j)/D(e*e+V*V),n=c*V,A=-c*e,u=i+n,a=k+A,y=J+n,l=q+A,H=(u+y)/2,s=(a+l)/2,t=y-u,r=l-a,m=t*t+r*r,h=b-j,p=u*l-y*a,v=(r<0?-1:1)*D(At(0,h*h*m-p*p)),w=(p*r-t*v)/m,z=(-p*t-r*v)/m,K=(p*r+t*v)/m,O=(-p*t+r*v)/m,d=w-H,g=z-s,x=K-H,Q=O-s;return d*d+g*g>x*x+Q*Q&&(w=K,z=O),{cx:w,cy:z,x01:-n,y01:-A,x11:w*(b/h-1),y11:z*(b/h-1)}}function kt(){var i=bt,k=jt,J=P(0),q=null,b=wt,j=zt,E=Pt,e=null,V=dt(c);function c(){var n,A,u=+i.apply(this,arguments),a=+k.apply(this,arguments),y=b.apply(this,arguments)-ft,l=j.apply(this,arguments)-ft,H=pt(l-y),s=l>y;if(e||(e=n=V()),af)if(H>Tt-f)e.moveTo(a*I(y),a*T(y)),e.arc(0,0,a,y,l,!s),u>f&&(e.moveTo(u*I(l),u*T(l)),e.arc(0,0,u,l,y,s));else{var t,r,m=y,h=l,p=y,v=l,w=H,z=H,K=E.apply(this,arguments)/2,O=K>f&&(q?+q.apply(this,arguments):D(u*u+a*a)),d=rt(pt(a-u)/2,+J.apply(this,arguments)),g=d,x=d;if(O>f){var Q=gt(O/u*T(K)),U=gt(O/a*T(K));(w-=2*Q)>f?(p+=Q*=s?1:-1,v-=Q):(w=0,p=v=(y+l)/2),(z-=2*U)>f?(m+=U*=s?1:-1,h-=U):(z=0,m=h=(y+l)/2)}var _=a*I(m),$=a*T(m),Y=u*I(v),Z=u*T(v);if(d>f){var R,F=a*I(h),G=a*T(h),L=u*I(p),M=u*T(p);if(Hf?x>f?(t=S(L,M,_,$,a,x,s),r=S(F,G,Y,Z,a,x,s),e.moveTo(t.cx+t.x01,t.cy+t.y01),xf&&w>f?g>f?(t=S(Y,Z,F,G,u,-g,s),r=S(_,$,L,M,u,-g,s),e.lineTo(t.cx+t.x01,t.cy+t.y01),gl?(this.rect.x-=(this.labelWidth-l)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(l+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(g+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>g?(this.rect.y-=(this.labelHeight-g)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(g+this.labelHeight))}}},i.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},i.prototype.transform=function(h){var l=this.rect.x;l>e.WORLD_BOUNDARY?l=e.WORLD_BOUNDARY:l<-e.WORLD_BOUNDARY&&(l=-e.WORLD_BOUNDARY);var g=this.rect.y;g>e.WORLD_BOUNDARY?g=e.WORLD_BOUNDARY:g<-e.WORLD_BOUNDARY&&(g=-e.WORLD_BOUNDARY);var d=new n(l,g),y=h.inverseTransformPoint(d);this.setLocation(y.x,y.y)},i.prototype.getLeft=function(){return this.rect.x},i.prototype.getRight=function(){return this.rect.x+this.rect.width},i.prototype.getTop=function(){return this.rect.y},i.prototype.getBottom=function(){return this.rect.y+this.rect.height},i.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},w.exports=i},function(w,_,T){var c=T(0);function o(){}for(var s in c)o[s]=c[s];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=3*o.MAX_NODE_DISPLACEMENT_INCREMENTAL,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,w.exports=o},function(w,_,T){function c(o,s){o==null&&s==null?(this.x=0,this.y=0):(this.x=o,this.y=s)}c.prototype.getX=function(){return this.x},c.prototype.getY=function(){return this.y},c.prototype.setX=function(o){this.x=o},c.prototype.setY=function(o){this.y=o},c.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},c.prototype.getCopy=function(){return new c(this.x,this.y)},c.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},w.exports=c},function(w,_,T){var c=T(2),o=T(10),s=T(0),e=T(7),r=T(3),n=T(1),i=T(13),t=T(12),h=T(11);function l(d,y,v){c.call(this,v),this.estimatedSize=o.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=d,y!=null&&y instanceof e?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}for(var g in l.prototype=Object.create(c.prototype),c)l[g]=c[g];l.prototype.getNodes=function(){return this.nodes},l.prototype.getEdges=function(){return this.edges},l.prototype.getGraphManager=function(){return this.graphManager},l.prototype.getParent=function(){return this.parent},l.prototype.getLeft=function(){return this.left},l.prototype.getRight=function(){return this.right},l.prototype.getTop=function(){return this.top},l.prototype.getBottom=function(){return this.bottom},l.prototype.isConnected=function(){return this.isConnected},l.prototype.add=function(d,y,v){if(y==null&&v==null){var E=d;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(E)>-1)throw"Node already in graph!";return E.owner=this,this.getNodes().push(E),E}var A=d;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(v)>-1))throw"Source or target not in graph!";if(y.owner!=v.owner||y.owner!=this)throw"Both owners must be this graph!";return y.owner!=v.owner?null:(A.source=y,A.target=v,A.isInterGraph=!1,this.getEdges().push(A),y.edges.push(A),v!=y&&v.edges.push(A),A)},l.prototype.remove=function(d){var y=d;if(d instanceof r){if(y==null)throw"Node is null!";if(y.owner==null||y.owner!=this)throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var v=y.edges.slice(),E=v.length,A=0;A-1&&Y>-1))throw"Source and/or target doesn't know this edge!";if(M.source.edges.splice(b,1),M.target!=M.source&&M.target.edges.splice(Y,1),(P=M.source.owner.getEdges().indexOf(M))==-1)throw"Not in owner's edge list!";M.source.owner.getEdges().splice(P,1)}},l.prototype.updateLeftTop=function(){for(var d,y,v,E=o.MAX_VALUE,A=o.MAX_VALUE,M=this.getNodes(),P=M.length,b=0;b(d=Y.getTop())&&(E=d),A>(y=Y.getLeft())&&(A=y)}return E==o.MAX_VALUE?null:(v=M[0].getParent().paddingLeft!=null?M[0].getParent().paddingLeft:this.margin,this.left=A-v,this.top=E-v,new t(this.left,this.top))},l.prototype.updateBounds=function(d){for(var y,v,E,A,M,P=o.MAX_VALUE,b=-o.MAX_VALUE,Y=o.MAX_VALUE,H=-o.MAX_VALUE,q=this.nodes,x=q.length,B=0;B(y=a.getLeft())&&(P=y),b<(v=a.getRight())&&(b=v),Y>(E=a.getTop())&&(Y=E),H<(A=a.getBottom())&&(H=A)}var m=new i(P,Y,b-P,H-Y);P==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),M=q[0].getParent().paddingLeft!=null?q[0].getParent().paddingLeft:this.margin,this.left=m.x-M,this.right=m.x+m.width+M,this.top=m.y-M,this.bottom=m.y+m.height+M},l.calculateBounds=function(d){for(var y,v,E,A,M=o.MAX_VALUE,P=-o.MAX_VALUE,b=o.MAX_VALUE,Y=-o.MAX_VALUE,H=d.length,q=0;q(y=x.getLeft())&&(M=y),P<(v=x.getRight())&&(P=v),b>(E=x.getTop())&&(b=E),Y<(A=x.getBottom())&&(Y=A)}return new i(M,b,P-M,Y-b)},l.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},l.prototype.calcEstimatedSize=function(){for(var d=0,y=this.nodes,v=y.length,E=0;E=this.nodes.length){var Y=0;A.forEach(function(H){H.owner==d&&Y++}),Y==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},w.exports=l},function(w,_,T){var c,o=T(1);function s(e){c=T(6),this.layout=e,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var e=this.layout.newGraph(),r=this.layout.newNode(null),n=this.add(e,r);return this.setRootGraph(n),this.rootGraph},s.prototype.add=function(e,r,n,i,t){if(n==null&&i==null&&t==null){if(e==null)throw"Graph is null!";if(r==null)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),e.parent!=null)throw"Already has a parent!";if(r.child!=null)throw"Already has a child!";return e.parent=r,r.child=e,e}t=n,n=e;var h=(i=r).getOwner(),l=t.getOwner();if(h==null||h.getGraphManager()!=this)throw"Source not in this graph mgr!";if(l==null||l.getGraphManager()!=this)throw"Target not in this graph mgr!";if(h==l)return n.isInterGraph=!1,h.add(n,i,t);if(n.isInterGraph=!0,n.source=i,n.target=t,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),n.source==null||n.target==null)throw"Edge source and/or target is null!";if(n.source.edges.indexOf(n)!=-1||n.target.edges.indexOf(n)!=-1)throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},s.prototype.remove=function(e){if(e instanceof c){var r=e;if(r.getGraphManager()!=this)throw"Graph not in this graph mgr";if(r!=this.rootGraph&&(r.parent==null||r.parent.graphManager!=this))throw"Invalid parent node!";for(var n,i=[],t=(i=i.concat(r.getEdges())).length,h=0;h=e.getRight()?r[0]+=Math.min(e.getX()-s.getX(),s.getRight()-e.getRight()):e.getX()<=s.getX()&&e.getRight()>=s.getRight()&&(r[0]+=Math.min(s.getX()-e.getX(),e.getRight()-s.getRight())),s.getY()<=e.getY()&&s.getBottom()>=e.getBottom()?r[1]+=Math.min(e.getY()-s.getY(),s.getBottom()-e.getBottom()):e.getY()<=s.getY()&&e.getBottom()>=s.getBottom()&&(r[1]+=Math.min(s.getY()-e.getY(),e.getBottom()-s.getBottom()));var t=Math.abs((e.getCenterY()-s.getCenterY())/(e.getCenterX()-s.getCenterX()));e.getCenterY()===s.getCenterY()&&e.getCenterX()===s.getCenterX()&&(t=1);var h=t*r[0],l=r[1]/t;r[0]h)return r[0]=n,r[1]=g,r[2]=t,r[3]=q,!1;if(it)return r[0]=l,r[1]=i,r[2]=Y,r[3]=h,!1;if(nt?(r[0]=y,r[1]=v,m=!0):(r[0]=d,r[1]=g,m=!0):f===I&&(n>t?(r[0]=l,r[1]=g,m=!0):(r[0]=E,r[1]=v,m=!0)),-p===I?t>n?(r[2]=H,r[3]=q,u=!0):(r[2]=Y,r[3]=b,u=!0):p===I&&(t>n?(r[2]=P,r[3]=b,u=!0):(r[2]=x,r[3]=q,u=!0)),m&&u)return!1;if(n>t?i>h?(L=this.getCardinalDirection(f,I,4),C=this.getCardinalDirection(p,I,2)):(L=this.getCardinalDirection(-f,I,3),C=this.getCardinalDirection(-p,I,1)):i>h?(L=this.getCardinalDirection(-f,I,1),C=this.getCardinalDirection(-p,I,3)):(L=this.getCardinalDirection(f,I,2),C=this.getCardinalDirection(p,I,4)),!m)switch(L){case 1:S=g,G=n+-M/I,r[0]=G,r[1]=S;break;case 2:G=E,S=i+A*I,r[0]=G,r[1]=S;break;case 3:S=v,G=n+M/I,r[0]=G,r[1]=S;break;case 4:G=y,S=i+-A*I,r[0]=G,r[1]=S}if(!u)switch(C){case 1:D=b,F=t+-a/I,r[2]=F,r[3]=D;break;case 2:F=x,D=h+B*I,r[2]=F,r[3]=D;break;case 3:D=q,F=t+a/I,r[2]=F,r[3]=D;break;case 4:F=H,D=h+-B*I,r[2]=F,r[3]=D}}return!1},o.getCardinalDirection=function(s,e,r){return s>e?r:1+r%4},o.getIntersection=function(s,e,r,n){if(n==null)return this.getIntersection2(s,e,r);var i,t,h,l,g,d,y,v=s.x,E=s.y,A=e.x,M=e.y,P=r.x,b=r.y,Y=n.x,H=n.y;return(y=(i=M-E)*(l=P-Y)-(t=H-b)*(h=v-A))===0?null:new c((h*(d=Y*b-P*H)-l*(g=A*E-v*M))/y,(t*g-i*d)/y)},o.angleOfVector=function(s,e,r,n){var i=void 0;return s!==r?(i=Math.atan((n-e)/(r-s)),r=0){var y=(-g+Math.sqrt(g*g-4*l*d))/(2*l),v=(-g-Math.sqrt(g*g-4*l*d))/(2*l);return y>=0&&y<=1?[y]:v>=0&&v<=1?[v]:null}return null},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,w.exports=o},function(w,_,T){function c(){}c.sign=function(o){return o>0?1:o<0?-1:0},c.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},c.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},w.exports=c},function(w,_,T){function c(){}c.MAX_VALUE=2147483647,c.MIN_VALUE=-2147483648,w.exports=c},function(w,_,T){var c=function(){function n(i,t){for(var h=0;h0&&d;){for(M.push(b[0]);M.length>0&&d;){var Y=M[0];M.splice(0,1),A.add(Y);var H=Y.getEdges();for(E=0;E-1&&b.splice(a,1)}A=new Set,P=new Map}else g=[]}return g},l.prototype.createDummyNodesForBendpoints=function(g){for(var d=[],y=g.source,v=this.graphManager.calcLowestCommonAncestor(g.source,g.target),E=0;E0){for(var v=this.edgeToDummyNodes.get(y),E=0;E=0&&d.splice(q,1),H.getNeighborsList().forEach(function(x){if(y.indexOf(x)<0){var B=v.get(x)-1;B==1&&b.push(x),v.set(x,B)}})}y=y.concat(b),d.length!=1&&d.length!=2||(E=!0,A=d[0])}return A},l.prototype.setGraphManager=function(g){this.graphManager=g},w.exports=l},function(w,_,T){function c(){}c.seed=1,c.x=0,c.nextDouble=function(){return c.x=1e4*Math.sin(c.seed++),c.x-Math.floor(c.x)},w.exports=c},function(w,_,T){var c=T(5);function o(s,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(s){this.lworldExtX=s},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(s){this.lworldExtY=s},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},o.prototype.transformX=function(s){var e=0,r=this.lworldExtX;return r!=0&&(e=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/r),e},o.prototype.transformY=function(s){var e=0,r=this.lworldExtY;return r!=0&&(e=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/r),e},o.prototype.inverseTransformX=function(s){var e=0,r=this.ldeviceExtX;return r!=0&&(e=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/r),e},o.prototype.inverseTransformY=function(s){var e=0,r=this.ldeviceExtY;return r!=0&&(e=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/r),e},o.prototype.inverseTransformPoint=function(s){return new c(this.inverseTransformX(s.x),this.inverseTransformY(s.y))},w.exports=o},function(w,_,T){var c=T(15),o=T(4),s=T(0),e=T(8),r=T(9);function n(){c.call(this),this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=o.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=o.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=o.MAX_ITERATIONS}for(var i in n.prototype=Object.create(c.prototype),c)n[i]=c[i];n.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},n.prototype.calcIdealEdgeLengths=function(){for(var t,h,l,g,d,y,v,E=this.getGraphManager().getAllEdges(),A=0;Ao.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*o.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-o.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>o.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(o.COOLING_ADAPTATION_FACTOR,1-(t-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*(1-o.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var t,h=this.getAllEdges(),l=0;l0&&arguments[0]!==void 0)||arguments[0],v=arguments.length>1&&arguments[1]!==void 0&&arguments[1],E=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&y&&this.updateGrid(),d=new Set,t=0;t(A=h.getEstimatedSize()*this.gravityRangeFactor)||E>A)&&(t.gravitationForceX=-this.gravityConstant*d,t.gravitationForceY=-this.gravityConstant*y):(v>(A=h.getEstimatedSize()*this.compoundGravityRangeFactor)||E>A)&&(t.gravitationForceX=-this.gravityConstant*d*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant)},n.prototype.isConverged=function(){var t,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=v.length||A>=v[0].length)){for(var M=0;Mr}}]),e}();w.exports=s},function(w,_,T){function c(){}c.svd=function(o){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=o.length,this.n=o[0].length;var s=Math.min(this.m,this.n);this.s=function(wt){for(var ut=[];wt-- >0;)ut.push(0);return ut}(Math.min(this.m+1,this.n)),this.U=function wt(ut){if(ut.length==0)return 0;for(var Ft=[],Mt=0;Mt0;)ut.push(0);return ut}(this.n),r=function(wt){for(var ut=[];wt-- >0;)ut.push(0);return ut}(this.m),n=Math.min(this.m-1,this.n),i=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;f--)if(this.s[f]!==0){for(var p=f+1;p=0;D--){if(function(wt,ut){return wt&&ut}(D0;){var V=void 0,Et=void 0;for(V=a-2;V>=-1&&V!==-1;V--)if(Math.abs(e[V])<=ot+tt*(Math.abs(this.s[V])+Math.abs(this.s[V+1]))){e[V]=0;break}if(V===a-2)Et=4;else{var Lt=void 0;for(Lt=a-1;Lt>=V&&Lt!==V;Lt--){var kt=(Lt!==a?Math.abs(e[Lt]):0)+(Lt!==V+1?Math.abs(e[Lt-1]):0);if(Math.abs(this.s[Lt])<=ot+tt*kt){this.s[Lt]=0;break}}Lt===V?Et=3:Lt===a-1?Et=1:(Et=2,V=Lt)}switch(V++,Et){case 1:var bt=e[a-2];e[a-2]=0;for(var K=a-2;K>=V;K--){var it=c.hypot(this.s[K],bt),pt=this.s[K]/it,ct=bt/it;this.s[K]=it,K!==V&&(bt=-ct*e[K-1],e[K-1]=pt*e[K-1]);for(var yt=0;yt=this.s[V+1]);){var Pt=this.s[V];if(this.s[V]=this.s[V+1],this.s[V+1]=Pt,VMath.abs(s)?(e=s/o,e=Math.abs(o)*Math.sqrt(1+e*e)):s!=0?(e=o/s,e=Math.abs(s)*Math.sqrt(1+e*e)):e=0,e},w.exports=c},function(w,_,T){var c=function(){function s(e,r){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;(function(y,v){if(!(y instanceof v))throw new TypeError("Cannot call a class as a function")})(this,s),this.sequence1=e,this.sequence2=r,this.match_score=n,this.mismatch_penalty=i,this.gap_penalty=t,this.iMax=e.length+1,this.jMax=r.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;r--){var n=this.listeners[r];n.event===s&&n.callback===e&&this.listeners.splice(r,1)}},o.emit=function(s,e){for(var r=0;r{var r={};r.layoutBase=e(551),r.CoSEConstants=e(806),r.CoSEEdge=e(767),r.CoSEGraph=e(880),r.CoSEGraphManager=e(578),r.CoSELayout=e(765),r.CoSENode=e(991),r.ConstraintHandler=e(902),o.exports=r},806:(o,s,e)=>{var r=e(551).FDLayoutConstants;function n(){}for(var i in r)n[i]=r[i];n.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,n.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,n.DEFAULT_COMPONENT_SEPERATION=60,n.TILE=!0,n.TILING_PADDING_VERTICAL=10,n.TILING_PADDING_HORIZONTAL=10,n.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,n.ENFORCE_CONSTRAINTS=!0,n.APPLY_LAYOUT=!0,n.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,n.TREE_REDUCTION_ON_INCREMENTAL=!0,n.PURE_INCREMENTAL=n.DEFAULT_INCREMENTAL,o.exports=n},767:(o,s,e)=>{var r=e(551).FDLayoutEdge;function n(t,h,l){r.call(this,t,h,l)}for(var i in n.prototype=Object.create(r.prototype),r)n[i]=r[i];o.exports=n},880:(o,s,e)=>{var r=e(551).LGraph;function n(t,h,l){r.call(this,t,h,l)}for(var i in n.prototype=Object.create(r.prototype),r)n[i]=r[i];o.exports=n},578:(o,s,e)=>{var r=e(551).LGraphManager;function n(t){r.call(this,t)}for(var i in n.prototype=Object.create(r.prototype),r)n[i]=r[i];o.exports=n},765:(o,s,e)=>{var r=e(551).FDLayout,n=e(578),i=e(880),t=e(991),h=e(767),l=e(806),g=e(902),d=e(551).FDLayoutConstants,y=e(551).LayoutConstants,v=e(551).Point,E=e(551).PointD,A=e(551).DimensionD,M=e(551).Layout,P=e(551).Integer,b=e(551).IGeometry,Y=e(551).LGraph,H=e(551).Transform,q=e(551).LinkedList;function x(){r.call(this),this.toBeTiled={},this.constraints={}}for(var B in x.prototype=Object.create(r.prototype),r)x[B]=r[B];x.prototype.newGraphManager=function(){var a=new n(this);return this.graphManager=a,a},x.prototype.newGraph=function(a){return new i(null,this.graphManager,a)},x.prototype.newNode=function(a){return new t(this.graphManager,a)},x.prototype.newEdge=function(a){return new h(null,null,a)},x.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=d.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=d.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},x.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/d.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},x.prototype.layout=function(){return y.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},x.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)l.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),m=new Set(this.getAllNodes()),u=this.nodesWithGravity.filter(function(f){return m.has(f)}),this.graphManager.setAllNodesToApplyGravitation(u));else{var a=this.getFlatForest();if(a.length>0)this.positionNodesRadially(a);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),u=this.nodesWithGravity.filter(function(f){return m.has(f)});this.graphManager.setAllNodesToApplyGravitation(u),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(g.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),l.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},x.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var a=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(p){return a.has(p)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),l.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),l.PURE_INCREMENTAL?this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var u=!this.isTreeGrowing&&!this.isGrowthFinished,f=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(u,f),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},x.prototype.getPositionsData=function(){for(var a=this.graphManager.getAllNodes(),m={},u=0;u0&&this.updateDisplacements(),m=0;m0&&(f.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var L=new Map,C=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){a.fixedNodesOnHorizontal.add(O),a.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var G=this.constraints.alignmentConstraint.vertical;for(u=0;u=2*O.length/3;tt--)X=Math.floor(Math.random()*(tt+1)),j=O[tt],O[tt]=O[X],O[X]=j;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var X=L.has(O.left)?L.get(O.left):O.left,j=L.has(O.right)?L.get(O.right):O.right;a.nodesInRelativeHorizontal.includes(X)||(a.nodesInRelativeHorizontal.push(X),a.nodeToRelativeConstraintMapHorizontal.set(X,[]),a.dummyToNodeForVerticalAlignment.has(X)?a.nodeToTempPositionMapHorizontal.set(X,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(X,a.idToNodeMap.get(X).getCenterX())),a.nodesInRelativeHorizontal.includes(j)||(a.nodesInRelativeHorizontal.push(j),a.nodeToRelativeConstraintMapHorizontal.set(j,[]),a.dummyToNodeForVerticalAlignment.has(j)?a.nodeToTempPositionMapHorizontal.set(j,a.idToNodeMap.get(a.dummyToNodeForVerticalAlignment.get(j)[0]).getCenterX()):a.nodeToTempPositionMapHorizontal.set(j,a.idToNodeMap.get(j).getCenterX())),a.nodeToRelativeConstraintMapHorizontal.get(X).push({right:j,gap:O.gap}),a.nodeToRelativeConstraintMapHorizontal.get(j).push({left:X,gap:O.gap})}else{var tt=C.has(O.top)?C.get(O.top):O.top,ot=C.has(O.bottom)?C.get(O.bottom):O.bottom;a.nodesInRelativeVertical.includes(tt)||(a.nodesInRelativeVertical.push(tt),a.nodeToRelativeConstraintMapVertical.set(tt,[]),a.dummyToNodeForHorizontalAlignment.has(tt)?a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(tt,a.idToNodeMap.get(tt).getCenterY())),a.nodesInRelativeVertical.includes(ot)||(a.nodesInRelativeVertical.push(ot),a.nodeToRelativeConstraintMapVertical.set(ot,[]),a.dummyToNodeForHorizontalAlignment.has(ot)?a.nodeToTempPositionMapVertical.set(ot,a.idToNodeMap.get(a.dummyToNodeForHorizontalAlignment.get(ot)[0]).getCenterY()):a.nodeToTempPositionMapVertical.set(ot,a.idToNodeMap.get(ot).getCenterY())),a.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ot,gap:O.gap}),a.nodeToRelativeConstraintMapVertical.get(ot).push({top:tt,gap:O.gap})}});else{var F=new Map,D=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var X=L.has(O.left)?L.get(O.left):O.left,j=L.has(O.right)?L.get(O.right):O.right;F.has(X)?F.get(X).push(j):F.set(X,[j]),F.has(j)?F.get(j).push(X):F.set(j,[X])}else{var tt=C.has(O.top)?C.get(O.top):O.top,ot=C.has(O.bottom)?C.get(O.bottom):O.bottom;D.has(tt)?D.get(tt).push(ot):D.set(tt,[ot]),D.has(ot)?D.get(ot).push(tt):D.set(ot,[tt])}});var z=function(O,X){var j=[],tt=[],ot=new q,V=new Set,Et=0;return O.forEach(function(Lt,kt){if(!V.has(kt)){j[Et]=[],tt[Et]=!1;var bt=kt;for(ot.push(bt),V.add(bt),j[Et].push(bt);ot.length!=0;)bt=ot.shift(),X.has(bt)&&(tt[Et]=!0),O.get(bt).forEach(function(K){V.has(K)||(ot.push(K),V.add(K),j[Et].push(K))});Et++}}),{components:j,isFixed:tt}},W=z(F,a.fixedNodesOnHorizontal);this.componentsOnHorizontal=W.components,this.fixedComponentsOnHorizontal=W.isFixed;var U=z(D,a.fixedNodesOnVertical);this.componentsOnVertical=U.components,this.fixedComponentsOnVertical=U.isFixed}}},x.prototype.updateDisplacements=function(){var a=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(U){var O=a.idToNodeMap.get(U.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,u=0;u1)for(C=0;Cf&&(f=Math.floor(L.y)),I=Math.floor(L.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new E(y.WORLD_CENTER_X-L.x/2,y.WORLD_CENTER_Y-L.y/2))},x.radialLayout=function(a,m,u){var f=Math.max(this.maxDiagonalInTree(a),l.DEFAULT_RADIAL_SEPARATION);x.branchRadialLayout(m,null,0,359,0,f);var p=Y.calculateBounds(a),I=new H;I.setDeviceOrgX(p.getMinX()),I.setDeviceOrgY(p.getMinY()),I.setWorldOrgX(u.x),I.setWorldOrgY(u.y);for(var L=0;L1;){var X=O[0];O.splice(0,1);var j=F.indexOf(X);j>=0&&F.splice(j,1),U--,D--}z=m!=null?(F.indexOf(O[0])+1)%U:0;for(var tt=Math.abs(f-u)/D,ot=z;W!=D;ot=++ot%U){var V=F[ot].getOtherEnd(a);if(V!=m){var Et=(u+W*tt)%360,Lt=(Et+tt)%360;x.branchRadialLayout(V,a,Et,Lt,p+I,I),W++}}},x.maxDiagonalInTree=function(a){for(var m=P.MIN_VALUE,u=0;um&&(m=f)}return m},x.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},x.prototype.groupZeroDegreeMembers=function(){var a=this,m={};this.memberGroups={},this.idToDummyNode={};for(var u=[],f=this.graphManager.getAllNodes(),p=0;p1){var S="DummyCompound_"+G;a.memberGroups[S]=m[G];var F=m[G][0].getParent(),D=new t(a.graphManager);D.id=S,D.paddingLeft=F.paddingLeft||0,D.paddingRight=F.paddingRight||0,D.paddingBottom=F.paddingBottom||0,D.paddingTop=F.paddingTop||0,a.idToDummyNode[S]=D;var z=a.getGraphManager().add(a.newGraph(),D),W=F.getChild();W.add(D);for(var U=0;Up?(f.rect.x-=(f.labelWidth-p)/2,f.setWidth(f.labelWidth),f.labelMarginLeft=(f.labelWidth-p)/2):f.labelPosHorizontal=="right"&&f.setWidth(p+f.labelWidth)),f.labelHeight&&(f.labelPosVertical=="top"?(f.rect.y-=f.labelHeight,f.setHeight(I+f.labelHeight),f.labelMarginTop=f.labelHeight):f.labelPosVertical=="center"&&f.labelHeight>I?(f.rect.y-=(f.labelHeight-I)/2,f.setHeight(f.labelHeight),f.labelMarginTop=(f.labelHeight-I)/2):f.labelPosVertical=="bottom"&&f.setHeight(I+f.labelHeight))}})},x.prototype.repopulateCompounds=function(){for(var a=this.compoundOrder.length-1;a>=0;a--){var m=this.compoundOrder[a],u=m.id,f=m.paddingLeft,p=m.paddingTop,I=m.labelMarginLeft,L=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[u],m.rect.x,m.rect.y,f,p,I,L)}},x.prototype.repopulateZeroDegreeMembers=function(){var a=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(u){var f=a.idToDummyNode[u],p=f.paddingLeft,I=f.paddingTop,L=f.labelMarginLeft,C=f.labelMarginTop;a.adjustLocations(m[u],f.rect.x,f.rect.y,p,I,L,C)})},x.prototype.getToBeTiled=function(a){var m=a.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var u=a.getChild();if(u==null)return this.toBeTiled[m]=!1,!1;for(var f=u.getNodes(),p=0;p0)return this.toBeTiled[m]=!1,!1;if(I.getChild()!=null){if(!this.getToBeTiled(I))return this.toBeTiled[m]=!1,!1}else this.toBeTiled[I.id]=!1}return this.toBeTiled[m]=!0,!0},x.prototype.getNodeDegree=function(a){a.id;for(var m=a.getEdges(),u=0,f=0;fF&&(F=z.rect.height)}u+=F+a.verticalPadding}},x.prototype.tileCompoundMembers=function(a,m){var u=this;this.tiledMemberPack=[],Object.keys(a).forEach(function(f){var p=m[f];if(u.tiledMemberPack[f]=u.tileNodes(a[f],p.paddingLeft+p.paddingRight),p.rect.width=u.tiledMemberPack[f].width,p.rect.height=u.tiledMemberPack[f].height,p.setCenter(u.tiledMemberPack[f].centerX,u.tiledMemberPack[f].centerY),p.labelMarginLeft=0,p.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var I=p.rect.width,L=p.rect.height;p.labelWidth&&(p.labelPosHorizontal=="left"?(p.rect.x-=p.labelWidth,p.setWidth(I+p.labelWidth),p.labelMarginLeft=p.labelWidth):p.labelPosHorizontal=="center"&&p.labelWidth>I?(p.rect.x-=(p.labelWidth-I)/2,p.setWidth(p.labelWidth),p.labelMarginLeft=(p.labelWidth-I)/2):p.labelPosHorizontal=="right"&&p.setWidth(I+p.labelWidth)),p.labelHeight&&(p.labelPosVertical=="top"?(p.rect.y-=p.labelHeight,p.setHeight(L+p.labelHeight),p.labelMarginTop=p.labelHeight):p.labelPosVertical=="center"&&p.labelHeight>L?(p.rect.y-=(p.labelHeight-L)/2,p.setHeight(p.labelHeight),p.labelMarginTop=(p.labelHeight-L)/2):p.labelPosVertical=="bottom"&&p.setHeight(L+p.labelHeight))}})},x.prototype.tileNodes=function(a,m){var u=this.tileNodesByFavoringDim(a,m,!0),f=this.tileNodesByFavoringDim(a,m,!1),p=this.getOrgRatio(u);return this.getOrgRatio(f)C&&(C=U.getWidth())});var G,S=I/p,F=L/p,D=Math.pow(u-f,2)+4*(S+f)*(F+u)*p,z=(f-u+Math.sqrt(D))/(2*(S+f));m?(G=Math.ceil(z))==z&&G++:G=Math.floor(z);var W=G*(S+f)-f;return C>W&&(W=C),W+=2*f},x.prototype.tileNodesByFavoringDim=function(a,m,u){var f=l.TILING_PADDING_VERTICAL,p=l.TILING_PADDING_HORIZONTAL,I=l.TILING_COMPARE_BY,L={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:f,horizontalPadding:p,centerX:0,centerY:0};I&&(L.idealRowWidth=this.calcIdealRowWidth(a,u));var C=function(U){return U.rect.width*U.rect.height},G=function(U,O){return C(O)-C(U)};a.sort(function(U,O){var X=G;return L.idealRowWidth?(X=I)(U.id,O.id):X(U,O)});for(var S=0,F=0,D=0;D0&&(I+=a.horizontalPadding),a.rowWidth[u]=I,a.width0&&(L+=a.verticalPadding);var C=0;L>a.rowHeight[u]&&(C=a.rowHeight[u],a.rowHeight[u]=L,C=a.rowHeight[u]-C),a.height+=C,a.rows[u].push(m)},x.prototype.getShortestRowIndex=function(a){for(var m=-1,u=Number.MAX_VALUE,f=0;fu&&(m=f,u=a.rowWidth[f]);return m},x.prototype.canAddHorizontal=function(a,m,u){if(a.idealRowWidth){var f=a.rows.length-1;return a.rowWidth[f]+m+a.horizontalPadding<=a.idealRowWidth}var p=this.getShortestRowIndex(a);if(p<0)return!0;var I=a.rowWidth[p];if(I+a.horizontalPadding+m<=a.width)return!0;var L,C,G=0;return a.rowHeight[p]0&&(G=u+a.verticalPadding-a.rowHeight[p]),L=a.width-I>=m+a.horizontalPadding?(a.height+G)/(I+m+a.horizontalPadding):(a.height+G)/a.width,G=u+a.verticalPadding,(C=a.widthI&&m!=u){f.splice(-1,1),a.rows[u].push(p),a.rowWidth[m]=a.rowWidth[m]-I,a.rowWidth[u]=a.rowWidth[u]+I,a.width=a.rowWidth[instance.getLongestRowIndex(a)];for(var L=Number.MIN_VALUE,C=0;CL&&(L=f[C].height);m>0&&(L+=a.verticalPadding);var G=a.rowHeight[m]+a.rowHeight[u];a.rowHeight[m]=L,a.rowHeight[u]0)for(var S=p;S<=I;S++)G[0]+=this.grid[S][L-1].length+this.grid[S][L].length-1;if(I0)for(S=L;S<=C;S++)G[3]+=this.grid[p-1][S].length+this.grid[p][S].length-1;for(var F,D,z=P.MAX_VALUE,W=0;W{var r=e(551).FDLayoutNode,n=e(551).IMath;function i(h,l,g,d){r.call(this,h,l,g,d)}for(var t in i.prototype=Object.create(r.prototype),r)i[t]=r[t];i.prototype.calculateDisplacement=function(){var h=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=h.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=h.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=h.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=h.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>h.coolingFactor*h.maxNodeDisplacement&&(this.displacementX=h.coolingFactor*h.maxNodeDisplacement*n.sign(this.displacementX)),Math.abs(this.displacementY)>h.coolingFactor*h.maxNodeDisplacement&&(this.displacementY=h.coolingFactor*h.maxNodeDisplacement*n.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},i.prototype.propogateDisplacementToChildren=function(h,l){for(var g,d=this.getChild().getNodes(),y=0;y{function r(g){if(Array.isArray(g)){for(var d=0,y=Array(g.length);d0){var gt=0;$.forEach(function(st){k=="horizontal"?(nt.set(st,v.has(st)?E[v.get(st)]:Z.get(st)),gt+=nt.get(st)):(nt.set(st,v.has(st)?A[v.get(st)]:Z.get(st)),gt+=nt.get(st))}),gt/=$.length,lt.forEach(function(st){J.has(st)||nt.set(st,gt)})}else{var Tt=0;lt.forEach(function(st){Tt+=k=="horizontal"?v.has(st)?E[v.get(st)]:Z.get(st):v.has(st)?A[v.get(st)]:Z.get(st)}),Tt/=lt.length,lt.forEach(function(st){nt.set(st,Tt)})}});for(var Ut=function(){var lt=ft.shift();R.get(lt).forEach(function($){if(nt.get($.id)st&&(st=Ht),VtPt&&(Pt=Vt)}}catch(jt){Rt=!0,wt=jt}finally{try{!Gt&&Ft.return&&Ft.return()}finally{if(Rt)throw wt}}var ie=(gt+st)/2-(Tt+Pt)/2,Kt=!0,qt=!1,$t=void 0;try{for(var Zt,Bt=lt[Symbol.iterator]();!(Kt=(Zt=Bt.next()).done);Kt=!0){var ee=Zt.value;nt.set(ee,nt.get(ee)+ie)}}catch(jt){qt=!0,$t=jt}finally{try{!Kt&&Bt.return&&Bt.return()}finally{if(qt)throw $t}}})}return nt},x=function(R){var k=0,J=0,Z=0,at=0;if(R.forEach(function(ft){ft.left?E[v.get(ft.left)]-E[v.get(ft.right)]>=0?k++:J++:A[v.get(ft.top)]-A[v.get(ft.bottom)]>=0?Z++:at++}),k>J&&Z>at)for(var _t=0;_tJ)for(var nt=0;ntat)for(var vt=0;vt1)d.fixedNodeConstraint.forEach(function(R,k){u[k]=[R.position.x,R.position.y],f[k]=[E[v.get(R.nodeId)],A[v.get(R.nodeId)]]}),p=!0;else if(d.alignmentConstraint)(function(){var R=0;if(d.alignmentConstraint.vertical){for(var k=d.alignmentConstraint.vertical,J=function(vt){var ft=new Set;k[vt].forEach(function(mt){ft.add(mt)});var Ut=new Set([].concat(r(ft)).filter(function(mt){return L.has(mt)})),rt=void 0;rt=Ut.size>0?E[v.get(Ut.values().next().value)]:H(ft).x,k[vt].forEach(function(mt){u[R]=[rt,A[v.get(mt)]],f[R]=[E[v.get(mt)],A[v.get(mt)]],R++})},Z=0;Z0?E[v.get(Ut.values().next().value)]:H(ft).y,at[vt].forEach(function(mt){u[R]=[E[v.get(mt)],rt],f[R]=[E[v.get(mt)],A[v.get(mt)]],R++})},nt=0;ntF&&(F=S[z].length,D=z);if(F0){var ct={x:0,y:0};d.fixedNodeConstraint.forEach(function(R,k){var J,Z,at={x:E[v.get(R.nodeId)],y:A[v.get(R.nodeId)]},_t=R.position,nt=(Z=at,{x:(J=_t).x-Z.x,y:J.y-Z.y});ct.x+=nt.x,ct.y+=nt.y}),ct.x/=d.fixedNodeConstraint.length,ct.y/=d.fixedNodeConstraint.length,E.forEach(function(R,k){E[k]+=ct.x}),A.forEach(function(R,k){A[k]+=ct.y}),d.fixedNodeConstraint.forEach(function(R){E[v.get(R.nodeId)]=R.position.x,A[v.get(R.nodeId)]=R.position.y})}if(d.alignmentConstraint){if(d.alignmentConstraint.vertical)for(var yt=d.alignmentConstraint.vertical,Nt=function(R){var k=new Set;yt[R].forEach(function(at){k.add(at)});var J=new Set([].concat(r(k)).filter(function(at){return L.has(at)})),Z=void 0;Z=J.size>0?E[v.get(J.values().next().value)]:H(k).x,k.forEach(function(at){L.has(at)||(E[v.get(at)]=Z)})},ht=0;ht0?A[v.get(J.values().next().value)]:H(k).y,k.forEach(function(at){L.has(at)||(A[v.get(at)]=Z)})},Dt=0;Dt{o.exports=w}},T={},c=function o(s){var e=T[s];if(e!==void 0)return e.exports;var r=T[s]={exports:{}};return _[s](r,r.exports,o),r.exports}(45),c;var _,T,c},Le.exports=N(hr()));var N}var xe,Ce,Oe,ce;const dr=ar(xe?Ie.exports:(xe=1,Ie.exports=(Ce=lr(),Oe={658:N=>{N.exports=Object.assign!=null?Object.assign.bind(Object):function(w){for(var _=arguments.length,T=Array(_>1?_-1:0),c=1;c<_;c++)T[c-1]=arguments[c];return T.forEach(function(o){Object.keys(o).forEach(function(s){return w[s]=o[s]})}),w}},548:(N,w,_)=>{var T=function(s,e){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return function(r,n){var i=[],t=!0,h=!1,l=void 0;try{for(var g,d=r[Symbol.iterator]();!(t=(g=d.next()).done)&&(i.push(g.value),!n||i.length!==n);t=!0);}catch(y){h=!0,l=y}finally{try{!t&&d.return&&d.return()}finally{if(h)throw l}}return i}(s,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=_(140).layoutBase.LinkedList,o={getTopMostNodes:function(s){for(var e={},r=0;r0&&x.merge(m)});for(var B=0;B1){g=h[0],d=g.connectedEdges().length,h.forEach(function(x){x.connectedEdges().length0&&n.set("dummy"+(n.size+1),E),A},relocateComponent:function(s,e,r){if(!r.fixedNodeConstraint){var n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY;if(r.quality=="draft"){var l=!0,g=!1,d=void 0;try{for(var y,v=e.nodeIndexes[Symbol.iterator]();!(l=(y=v.next()).done);l=!0){var E=y.value,A=T(E,2),M=A[0],P=A[1],b=r.cy.getElementById(M);if(b){var Y=b.boundingBox(),H=e.xCoords[P]-Y.w/2,q=e.xCoords[P]+Y.w/2,x=e.yCoords[P]-Y.h/2,B=e.yCoords[P]+Y.h/2;Hi&&(i=q),xh&&(h=B)}}}catch(p){g=!0,d=p}finally{try{!l&&v.return&&v.return()}finally{if(g)throw d}}var a=s.x-(i+n)/2,m=s.y-(h+t)/2;e.xCoords=e.xCoords.map(function(p){return p+a}),e.yCoords=e.yCoords.map(function(p){return p+m})}else{Object.keys(e).forEach(function(p){var I=e[p],L=I.getRect().x,C=I.getRect().x+I.getRect().width,G=I.getRect().y,S=I.getRect().y+I.getRect().height;Li&&(i=C),Gh&&(h=S)});var u=s.x-(i+n)/2,f=s.y-(h+t)/2;Object.keys(e).forEach(function(p){var I=e[p];I.setCenter(I.getCenterX()+u,I.getCenterY()+f)})}}},calcBoundingBox:function(s,e,r,n){for(var i=Number.MAX_SAFE_INTEGER,t=Number.MIN_SAFE_INTEGER,h=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER,g=void 0,d=void 0,y=void 0,v=void 0,E=s.descendants().not(":parent"),A=E.length,M=0;M(g=e[n.get(P.id())]-P.width()/2)&&(i=g),t<(d=e[n.get(P.id())]+P.width()/2)&&(t=d),h>(y=r[n.get(P.id())]-P.height()/2)&&(h=y),l<(v=r[n.get(P.id())]+P.height()/2)&&(l=v)}var b={};return b.topLeftX=i,b.topLeftY=h,b.width=t-i,b.height=l-h,b},calcParentsWithoutChildren:function(s,e){var r=s.collection();return e.nodes(":parent").forEach(function(n){var i=!1;n.children().forEach(function(t){t.css("display")!="none"&&(i=!0)}),i||r.merge(n)}),r}};N.exports=o},816:(N,w,_)=>{var T=_(548),c=_(140).CoSELayout,o=_(140).CoSENode,s=_(140).layoutBase.PointD,e=_(140).layoutBase.DimensionD,r=_(140).layoutBase.LayoutConstants,n=_(140).layoutBase.FDLayoutConstants,i=_(140).CoSEConstants;N.exports={coseLayout:function(t,h){var l=t.cy,g=t.eles,d=g.nodes(),y=g.edges(),v=void 0,E=void 0,A=void 0,M={};t.randomize&&(v=h.nodeIndexes,E=h.xCoords,A=h.yCoords);var P=function(x){return typeof x=="function"},b=function(x,B){return P(x)?x(B):x},Y=T.calcParentsWithoutChildren(l,g);t.nestingFactor!=null&&(i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor),t.gravity!=null&&(i.DEFAULT_GRAVITY_STRENGTH=n.DEFAULT_GRAVITY_STRENGTH=t.gravity),t.numIter!=null&&(i.MAX_ITERATIONS=n.MAX_ITERATIONS=t.numIter),t.gravityRange!=null&&(i.DEFAULT_GRAVITY_RANGE_FACTOR=n.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange),t.gravityCompound!=null&&(i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound),t.gravityRangeCompound!=null&&(i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound),t.initialEnergyOnIncremental!=null&&(i.DEFAULT_COOLING_FACTOR_INCREMENTAL=n.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental),t.tilingCompareBy!=null&&(i.TILING_COMPARE_BY=t.tilingCompareBy),t.quality=="proof"?r.QUALITY=2:r.QUALITY=0,i.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!t.randomize,i.ANIMATE=n.ANIMATE=r.ANIMATE=t.animate,i.TILE=t.tile,i.TILING_PADDING_VERTICAL=typeof t.tilingPaddingVertical=="function"?t.tilingPaddingVertical.call():t.tilingPaddingVertical,i.TILING_PADDING_HORIZONTAL=typeof t.tilingPaddingHorizontal=="function"?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal,i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!0,i.PURE_INCREMENTAL=!t.randomize,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=t.uniformNodeDimensions,t.step=="transformed"&&(i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!1),t.step=="enforced"&&(i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!1),t.step=="cose"&&(i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!1,i.APPLY_LAYOUT=!0),t.step=="all"&&(t.randomize?i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:i.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0),t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint?i.TREE_REDUCTION_ON_INCREMENTAL=!1:i.TREE_REDUCTION_ON_INCREMENTAL=!0;var H=new c,q=H.newGraphManager();return function x(B,a,m,u){for(var f=a.length,p=0;p0&&x(m.getGraphManager().add(m.newGraph(),C),L,m,u)}}(q.addRoot(),T.getTopMostNodes(d),H,t),function(x,B,a){for(var m=0,u=0,f=0;f0?i.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=m/u:P(t.idealEdgeLength)?i.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=50:i.DEFAULT_EDGE_LENGTH=n.DEFAULT_EDGE_LENGTH=t.idealEdgeLength,i.MIN_REPULSION_DIST=n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,i.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH)}(H,q,y),function(x,B){B.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=B.fixedNodeConstraint),B.alignmentConstraint&&(x.constraints.alignmentConstraint=B.alignmentConstraint),B.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=B.relativePlacementConstraint)}(H,t),H.runLayout(),M}}},212:(N,w,_)=>{var T=function(){function i(t,h){for(var l=0;l0)if(A){var M=o.getTopMostNodes(t.eles.nodes());if((y=o.connectComponents(h,t.eles,M)).forEach(function(F){var D=F.boundingBox();v.push({x:D.x1+D.w/2,y:D.y1+D.h/2})}),t.randomize&&y.forEach(function(F){t.eles=F,g.push(s(t))}),t.quality=="default"||t.quality=="proof"){var P=h.collection();if(t.tile){var b=new Map,Y=0,H={nodeIndexes:b,xCoords:[],yCoords:[]},q=[];if(y.forEach(function(F,D){F.edges().length==0&&(F.nodes().forEach(function(z,W){P.merge(F.nodes()[W]),z.isParent()||(H.nodeIndexes.set(F.nodes()[W].id(),Y++),H.xCoords.push(F.nodes()[0].position().x),H.yCoords.push(F.nodes()[0].position().y))}),q.push(D))}),P.length>1){var x=P.boundingBox();v.push({x:x.x1+x.w/2,y:x.y1+x.h/2}),y.push(P),g.push(H);for(var B=q.length-1;B>=0;B--)y.splice(q[B],1),g.splice(q[B],1),v.splice(q[B],1)}}y.forEach(function(F,D){t.eles=F,d.push(e(t,g[D])),o.relocateComponent(v[D],d[D],t)})}else y.forEach(function(F,D){o.relocateComponent(v[D],g[D],t)});var a=new Set;if(y.length>1){var m=[],u=l.filter(function(F){return F.css("display")=="none"});y.forEach(function(F,D){var z=void 0;if(t.quality=="draft"&&(z=g[D].nodeIndexes),F.nodes().not(u).length>0){var W={edges:[],nodes:[]},U=void 0;F.nodes().not(u).forEach(function(O){if(t.quality=="draft")if(O.isParent()){var X=o.calcBoundingBox(O,g[D].xCoords,g[D].yCoords,z);W.nodes.push({x:X.topLeftX,y:X.topLeftY,width:X.width,height:X.height})}else U=z.get(O.id()),W.nodes.push({x:g[D].xCoords[U]-O.boundingbox().w/2,y:g[D].yCoords[U]-O.boundingbox().h/2,width:O.boundingbox().w,height:O.boundingbox().h});else d[D][O.id()]&&W.nodes.push({x:d[D][O.id()].getLeft(),y:d[D][O.id()].getTop(),width:d[D][O.id()].getWidth(),height:d[D][O.id()].getHeight()})}),F.edges().forEach(function(O){var X=O.source(),j=O.target();if(X.css("display")!="none"&&j.css("display")!="none")if(t.quality=="draft"){var tt=z.get(X.id()),ot=z.get(j.id()),V=[],Et=[];if(X.isParent()){var Lt=o.calcBoundingBox(X,g[D].xCoords,g[D].yCoords,z);V.push(Lt.topLeftX+Lt.width/2),V.push(Lt.topLeftY+Lt.height/2)}else V.push(g[D].xCoords[tt]),V.push(g[D].yCoords[tt]);if(j.isParent()){var kt=o.calcBoundingBox(j,g[D].xCoords,g[D].yCoords,z);Et.push(kt.topLeftX+kt.width/2),Et.push(kt.topLeftY+kt.height/2)}else Et.push(g[D].xCoords[ot]),Et.push(g[D].yCoords[ot]);W.edges.push({startX:V[0],startY:V[1],endX:Et[0],endY:Et[1]})}else d[D][X.id()]&&d[D][j.id()]&&W.edges.push({startX:d[D][X.id()].getCenterX(),startY:d[D][X.id()].getCenterY(),endX:d[D][j.id()].getCenterX(),endY:d[D][j.id()].getCenterY()})}),W.nodes.length>0&&(m.push(W),a.add(D))}});var f=E.packComponents(m,t.randomize).shifts;if(t.quality=="draft")g.forEach(function(F,D){var z=F.xCoords.map(function(U){return U+f[D].dx}),W=F.yCoords.map(function(U){return U+f[D].dy});F.xCoords=z,F.yCoords=W});else{var p=0;a.forEach(function(F){Object.keys(d[F]).forEach(function(D){var z=d[F][D];z.setCenter(z.getCenterX()+f[p].dx,z.getCenterY()+f[p].dy)}),p++})}}}else{var I=t.eles.boundingBox();if(v.push({x:I.x1+I.w/2,y:I.y1+I.h/2}),t.randomize){var L=s(t);g.push(L)}t.quality=="default"||t.quality=="proof"?(d.push(e(t,g[0])),o.relocateComponent(v[0],d[0],t)):o.relocateComponent(v[0],g[0],t)}var C=function(F,D){if(t.quality=="default"||t.quality=="proof"){typeof F=="number"&&(F=D);var z=void 0,W=void 0,U=F.data("id");return d.forEach(function(X){U in X&&(z={x:X[U].getRect().getCenterX(),y:X[U].getRect().getCenterY()},W=X[U])}),t.nodeDimensionsIncludeLabels&&(W.labelWidth&&(W.labelPosHorizontal=="left"?z.x+=W.labelWidth/2:W.labelPosHorizontal=="right"&&(z.x-=W.labelWidth/2)),W.labelHeight&&(W.labelPosVertical=="top"?z.y+=W.labelHeight/2:W.labelPosVertical=="bottom"&&(z.y-=W.labelHeight/2))),z==null&&(z={x:F.position("x"),y:F.position("y")}),{x:z.x,y:z.y}}var O=void 0;return g.forEach(function(X){var j=X.nodeIndexes.get(F.id());j!=null&&(O={x:X.xCoords[j],y:X.yCoords[j]})}),O==null&&(O={x:F.position("x"),y:F.position("y")}),{x:O.x,y:O.y}};if(t.quality=="default"||t.quality=="proof"||t.randomize){var G=o.calcParentsWithoutChildren(h,l),S=l.filter(function(F){return F.css("display")=="none"});t.eles=l.not(S),l.nodes().not(":parent").not(S).layoutPositions(this,t,C),G.length>0&&G.forEach(function(F){F.position(C(F))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),i}();N.exports=n},657:(N,w,_)=>{var T=_(548),c=_(140).layoutBase.Matrix,o=_(140).layoutBase.SVD;N.exports={spectralLayout:function(s){var e=s.cy,r=s.eles,n=r.nodes(),i=r.nodes(":parent"),t=new Map,h=new Map,l=new Map,g=[],d=[],y=[],v=[],E=[],A=[],M=[],P=[],b=void 0,Y=1e8,H=1e-9,q=s.piTol,x=s.samplingType,B=s.nodeSeparation,a=void 0,m=function(K,it,pt){for(var ct=[],yt=0,Nt=0,ht=0,At=void 0,Ot=[],Dt=0,xt=1,Ct=0;Ct=yt;){ht=ct[yt++];for(var R=g[ht],k=0;kDt&&(Dt=E[Z],xt=Z)}return xt};T.connectComponents(e,r,T.getTopMostNodes(n),t),i.forEach(function(K){T.connectComponents(e,r,T.getTopMostNodes(K.descendants().intersection(r)),t)});for(var u=0,f=0;f0&&(pt.isParent()?g[it].push(l.get(pt.id())):g[it].push(pt.id()))})});var D=function(K){var it=h.get(K),pt=void 0;t.get(K).forEach(function(ct){pt=e.getElementById(ct).isParent()?l.get(ct):ct,g[it].push(pt),g[h.get(pt)].push(K)})},z=!0,W=!1,U=void 0;try{for(var O,X=t.keys()[Symbol.iterator]();!(z=(O=X.next()).done);z=!0)D(O.value)}catch(K){W=!0,U=K}finally{try{!z&&X.return&&X.return()}finally{if(W)throw U}}var j=void 0;if((b=h.size)>2){a=b=1)break;Ot=At}for(var Ct=0;Ct=1)break;Ot=At}for(var k=0;k{var T=_(212),c=function(o){o&&o("layout","fcose",T)};typeof cytoscape<"u"&&c(cytoscape),N.exports=c},140:N=>{N.exports=Ce}},ce={},function N(w){var _=ce[w];if(_!==void 0)return _.exports;var T=ce[w]={exports:{}};return Oe[w](T,T.exports,N),T.exports}(579))));var De={L:"left",R:"right",T:"top",B:"bottom"},Re={L:Q(N=>`${N},${N/2} 0,${N} 0,0`,"L"),R:Q(N=>`0,${N/2} ${N},0 ${N},${N}`,"R"),T:Q(N=>`0,0 ${N},0 ${N/2},${N}`,"T"),B:Q(N=>`${N/2},0 ${N},${N} 0,${N}`,"B")},ne={L:Q((N,w)=>N-w+2,"L"),R:Q((N,w)=>N-2,"R"),T:Q((N,w)=>N-w+2,"T"),B:Q((N,w)=>N-2,"B")},cr=Q(function(N){return Yt(N)?N==="L"?"R":"L":N==="T"?"B":"T"},"getOppositeArchitectureDirection"),be=Q(function(N){return N==="L"||N==="R"||N==="T"||N==="B"},"isArchitectureDirection"),Yt=Q(function(N){return N==="L"||N==="R"},"isArchitectureDirectionX"),Wt=Q(function(N){return N==="T"||N==="B"},"isArchitectureDirectionY"),ge=Q(function(N,w){const _=Yt(N)&&Wt(w),T=Wt(N)&&Yt(w);return _||T},"isArchitectureDirectionXY"),gr=Q(function(N){const w=N[0],_=N[1],T=Yt(w)&&Wt(_),c=Wt(w)&&Yt(_);return T||c},"isArchitecturePairXY"),ur=Q(function(N){return N!=="LL"&&N!=="RR"&&N!=="TT"&&N!=="BB"},"isValidArchitectureDirectionPair"),ue=Q(function(N,w){const _=`${N}${w}`;return ur(_)?_:void 0},"getArchitectureDirectionPair"),pr=Q(function([N,w],_){const T=_[0],c=_[1];return Yt(T)?Wt(c)?[N+(T==="L"?-1:1),w+(c==="T"?1:-1)]:[N+(T==="L"?-1:1),w]:Yt(c)?[N+(c==="L"?1:-1),w+(T==="T"?1:-1)]:[N,w+(T==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),fr=Q(function(N){return N==="LT"||N==="TL"?[1,1]:N==="BL"||N==="LB"?[1,-1]:N==="BR"||N==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),mr=Q(function(N,w){return ge(N,w)?"bend":Yt(N)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),vr=Q(function(N){return N.type==="service"},"isArchitectureService"),yr=Q(function(N){return N.type==="junction"},"isArchitectureJunction"),Ge=Q(N=>N.data(),"edgeData"),Qt=Q(N=>N.data(),"nodeData"),Se=tr.architecture,dt=new or(()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:Se,dataStructures:void 0,elements:{}})),Er=Q(()=>{dt.reset(),Ke()},"clear"),Nr=Q(function({id:N,icon:w,in:_,title:T,iconText:c}){if(dt.records.registeredIds[N]!==void 0)throw new Error(`The service id [${N}] is already in use by another ${dt.records.registeredIds[N]}`);if(_!==void 0){if(N===_)throw new Error(`The service [${N}] cannot be placed within itself`);if(dt.records.registeredIds[_]===void 0)throw new Error(`The service [${N}]'s parent does not exist. Please make sure the parent is created before this service`);if(dt.records.registeredIds[_]==="node")throw new Error(`The service [${N}]'s parent is not a group`)}dt.records.registeredIds[N]="node",dt.records.nodes[N]={id:N,type:"service",icon:w,iconText:c,title:T,edges:[],in:_}},"addService"),Tr=Q(()=>Object.values(dt.records.nodes).filter(vr),"getServices"),Ar=Q(function({id:N,in:w}){dt.records.registeredIds[N]="node",dt.records.nodes[N]={id:N,type:"junction",edges:[],in:w}},"addJunction"),wr=Q(()=>Object.values(dt.records.nodes).filter(yr),"getJunctions"),Ir=Q(()=>Object.values(dt.records.nodes),"getNodes"),pe=Q(N=>dt.records.nodes[N],"getNode"),Lr=Q(function({id:N,icon:w,in:_,title:T}){if(dt.records.registeredIds[N]!==void 0)throw new Error(`The group id [${N}] is already in use by another ${dt.records.registeredIds[N]}`);if(_!==void 0){if(N===_)throw new Error(`The group [${N}] cannot be placed within itself`);if(dt.records.registeredIds[_]===void 0)throw new Error(`The group [${N}]'s parent does not exist. Please make sure the parent is created before this group`);if(dt.records.registeredIds[_]==="node")throw new Error(`The group [${N}]'s parent is not a group`)}dt.records.registeredIds[N]="group",dt.records.groups[N]={id:N,icon:w,title:T,in:_}},"addGroup"),_r=Q(()=>Object.values(dt.records.groups),"getGroups"),Mr=Q(function({lhsId:N,rhsId:w,lhsDir:_,rhsDir:T,lhsInto:c,rhsInto:o,lhsGroup:s,rhsGroup:e,title:r}){if(!be(_))throw new Error(`Invalid direction given for left hand side of edge ${N}--${w}. Expected (L,R,T,B) got ${_}`);if(!be(T))throw new Error(`Invalid direction given for right hand side of edge ${N}--${w}. Expected (L,R,T,B) got ${T}`);if(dt.records.nodes[N]===void 0&&dt.records.groups[N]===void 0)throw new Error(`The left-hand id [${N}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(dt.records.nodes[w]===void 0&&dt.records.groups[N]===void 0)throw new Error(`The right-hand id [${w}] does not yet exist. Please create the service/group before declaring an edge to it.`);const n=dt.records.nodes[N].in,i=dt.records.nodes[w].in;if(s&&n&&i&&n==i)throw new Error(`The left-hand id [${N}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(e&&n&&i&&n==i)throw new Error(`The right-hand id [${w}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const t={lhsId:N,lhsDir:_,lhsInto:c,lhsGroup:s,rhsId:w,rhsDir:T,rhsInto:o,rhsGroup:e,title:r};dt.records.edges.push(t),dt.records.nodes[N]&&dt.records.nodes[w]&&(dt.records.nodes[N].edges.push(dt.records.edges[dt.records.edges.length-1]),dt.records.nodes[w].edges.push(dt.records.edges[dt.records.edges.length-1]))},"addEdge"),xr=Q(()=>dt.records.edges,"getEdges"),Cr=Q(()=>{if(dt.records.dataStructures===void 0){const N={},w=Object.entries(dt.records.nodes).reduce((e,[r,n])=>(e[r]=n.edges.reduce((i,t)=>{var g,d;const h=(g=pe(t.lhsId))==null?void 0:g.in,l=(d=pe(t.rhsId))==null?void 0:d.in;if(h&&l&&h!==l){const y=mr(t.lhsDir,t.rhsDir);y!=="bend"&&(N[h]??(N[h]={}),N[h][l]=y,N[l]??(N[l]={}),N[l][h]=y)}if(t.lhsId===r){const y=ue(t.lhsDir,t.rhsDir);y&&(i[y]=t.rhsId)}else{const y=ue(t.rhsDir,t.lhsDir);y&&(i[y]=t.lhsId)}return i},{}),e),{}),_=Object.keys(w)[0],T={[_]:1},c=Object.keys(w).reduce((e,r)=>r===_?e:{...e,[r]:1},{}),o=Q(e=>{const r={[e]:[0,0]},n=[e];for(;n.length>0;){const i=n.shift();if(i){T[i]=1,delete c[i];const t=w[i],[h,l]=r[i];Object.entries(t).forEach(([g,d])=>{T[d]||(r[d]=pr([h,l],g),n.push(d))})}}return r},"BFS"),s=[o(_)];for(;Object.keys(c).length>0;)s.push(o(Object.keys(c)[0]));dt.records.dataStructures={adjList:w,spatialMaps:s,groupAlignments:N}}return dt.records.dataStructures},"getDataStructures"),oe={clear:Er,setDiagramTitle:Ze,getDiagramTitle:$e,setAccTitle:qe,getAccTitle:je,setAccDescription:Be,getAccDescription:We,addService:Nr,getServices:Tr,addJunction:Ar,getJunctions:wr,getNodes:Ir,getNode:pe,addGroup:Lr,getGroups:_r,addEdge:Mr,getEdges:xr,setElementForId:Q((N,w)=>{dt.records.elements[N]=w},"setElementForId"),getElementById:Q(N=>dt.records.elements[N],"getElementById"),getDataStructures:Cr};function St(N){const w=re().architecture;return w!=null&&w[N]?w[N]:Se[N]}Q(St,"getConfigField");var Or=Q((N,w)=>{nr(N,w),N.groups.map(w.addGroup),N.services.map(_=>w.addService({..._,type:"service"})),N.junctions.map(_=>w.addJunction({..._,type:"junction"})),N.edges.map(w.addEdge)},"populateDb"),Dr={parse:Q(async N=>{const w=await ir("architecture",N);Te.debug(w),Or(w,oe)},"parse")},Rr=Q(N=>` + .edge { + stroke-width: ${N.archEdgeWidth}; + stroke: ${N.archEdgeColor}; + fill: none; + } + + .arrow { + fill: ${N.archEdgeArrowColor}; + } + + .node-bkg { + fill: none; + stroke: ${N.archGroupBorderColor}; + stroke-width: ${N.archGroupBorderWidth}; + stroke-dasharray: 8; + } + .node-icon-text { + display: flex; + align-items: center; + } + + .node-icon-text > div { + color: #fff; + margin: 1px; + height: fit-content; + text-align: center; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + } +`,"getStyles"),Jt=Q(N=>`${N}`,"wrapIcon"),te={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:Jt('')},server:{body:Jt('')},disk:{body:Jt('')},internet:{body:Jt('')},cloud:{body:Jt('')},unknown:rr,blank:{body:Jt("")}}},br=Q(async function(N,w){const _=St("padding"),T=St("iconSize"),c=T/2,o=T/6,s=o/2;await Promise.all(w.edges().map(async e=>{var H,q;const{source:r,sourceDir:n,sourceArrow:i,sourceGroup:t,target:h,targetDir:l,targetArrow:g,targetGroup:d,label:y}=Ge(e);let{x:v,y:E}=e[0].sourceEndpoint();const{x:A,y:M}=e[0].midpoint();let{x:P,y:b}=e[0].targetEndpoint();const Y=_+4;if(t&&(Yt(n)?v+=n==="L"?-Y:Y:E+=n==="T"?-Y:Y+18),d&&(Yt(l)?P+=l==="L"?-Y:Y:b+=l==="T"?-Y:Y+18),t||((H=oe.getNode(r))==null?void 0:H.type)!=="junction"||(Yt(n)?v+=n==="L"?c:-c:E+=n==="T"?c:-c),d||((q=oe.getNode(h))==null?void 0:q.type)!=="junction"||(Yt(l)?P+=l==="L"?c:-c:b+=l==="T"?c:-c),e[0]._private.rscratch){const x=N.insert("g");if(x.insert("path").attr("d",`M ${v},${E} L ${A},${M} L${P},${b} `).attr("class","edge"),i){const B=Yt(n)?ne[n](v,o):v-s,a=Wt(n)?ne[n](E,o):E-s;x.insert("polygon").attr("points",Re[n](o)).attr("transform",`translate(${B},${a})`).attr("class","arrow")}if(g){const B=Yt(l)?ne[l](P,o):P-s,a=Wt(l)?ne[l](b,o):b-s;x.insert("polygon").attr("points",Re[l](o)).attr("transform",`translate(${B},${a})`).attr("class","arrow")}if(y){const B=ge(n,l)?"XY":Yt(n)?"X":"Y";let a=0;a=B==="X"?Math.abs(v-P):B==="Y"?Math.abs(E-b)/1.5:Math.abs(v-P)/2;const m=x.append("g");if(await le(m,y,{useHtmlLabels:!1,width:a,classes:"architecture-service-label"},re()),m.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),B==="X")m.attr("transform","translate("+A+", "+M+")");else if(B==="Y")m.attr("transform","translate("+A+", "+M+") rotate(-90)");else if(B==="XY"){const u=ue(n,l);if(u&&gr(u)){const f=m.node().getBoundingClientRect(),[p,I]=fr(u);m.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*p*I*45})`);const L=m.node().getBoundingClientRect();m.attr("transform",` + translate(${A}, ${M-f.height/2}) + translate(${p*L.width/2}, ${I*L.height/2}) + rotate(${-1*p*I*45}, 0, ${f.height/2}) + `)}}}}}))},"drawEdges"),Gr=Q(async function(N,w){const _=.75*St("padding"),T=St("fontSize"),c=St("iconSize")/2;await Promise.all(w.nodes().map(async o=>{const s=Qt(o);if(s.type==="group"){const{h:e,w:r,x1:n,y1:i}=o.boundingBox();N.append("rect").attr("x",n+c).attr("y",i+c).attr("width",r).attr("height",e).attr("class","node-bkg");const t=N.append("g");let h=n,l=i;if(s.icon){const g=t.append("g");g.html(`${await de(s.icon,{height:_,width:_,fallbackPrefix:te.prefix})}`),g.attr("transform","translate("+(h+c+1)+", "+(l+c+1)+")"),h+=_,l+=T/2-1-2}if(s.label){const g=t.append("g");await le(g,s.label,{useHtmlLabels:!1,width:r,classes:"architecture-service-label"},re()),g.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),g.attr("transform","translate("+(h+c+4)+", "+(l+c+2)+")")}}}))},"drawGroups"),Sr=Q(async function(N,w,_){for(const T of _){const c=w.append("g"),o=St("iconSize");if(T.title){const n=c.append("g");await le(n,T.title,{useHtmlLabels:!1,width:1.5*o,classes:"architecture-service-label"},re()),n.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),n.attr("transform","translate("+o/2+", "+o+")")}const s=c.append("g");if(T.icon)s.html(`${await de(T.icon,{height:o,width:o,fallbackPrefix:te.prefix})}`);else if(T.iconText){s.html(`${await de("blank",{height:o,width:o,fallbackPrefix:te.prefix})}`);const n=s.append("g").append("foreignObject").attr("width",o).attr("height",o).append("div").attr("class","node-icon-text").attr("style",`height: ${o}px;`).append("div").html(T.iconText),i=parseInt(window.getComputedStyle(n.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;n.attr("style",`-webkit-line-clamp: ${Math.floor((o-2)/i)};`)}else s.append("path").attr("class","node-bkg").attr("id","node-"+T.id).attr("d",`M0 ${o} v${-o} q0,-5 5,-5 h${o} q5,0 5,5 v${o} H0 Z`);c.attr("class","architecture-service");const{width:e,height:r}=c._groups[0][0].getBBox();T.width=e,T.height=r,N.setElementForId(T.id,c)}return 0},"drawServices"),Pr=Q(function(N,w,_){_.forEach(T=>{const c=w.append("g"),o=St("iconSize");c.append("g").append("rect").attr("id","node-"+T.id).attr("fill-opacity","0").attr("width",o).attr("height",o),c.attr("class","architecture-junction");const{width:s,height:e}=c._groups[0][0].getBBox();c.width=s,c.height=e,N.setElementForId(T.id,c)})},"drawJunctions");function Pe(N,w){N.forEach(_=>{w.add({group:"nodes",data:{type:"service",id:_.id,icon:_.icon,label:_.title,parent:_.in,width:St("iconSize"),height:St("iconSize")},classes:"node-service"})})}function Fe(N,w){N.forEach(_=>{w.add({group:"nodes",data:{type:"junction",id:_.id,parent:_.in,width:St("iconSize"),height:St("iconSize")},classes:"node-junction"})})}function Ue(N,w){w.nodes().map(_=>{const T=Qt(_);T.type!=="group"&&(T.x=_.position().x,T.y=_.position().y,N.getElementById(T.id).attr("transform","translate("+(T.x||0)+","+(T.y||0)+")"))})}function Ye(N,w){N.forEach(_=>{w.add({group:"nodes",data:{type:"group",id:_.id,icon:_.icon,label:_.title,parent:_.in},classes:"node-group"})})}function ke(N,w){N.forEach(_=>{const{lhsId:T,rhsId:c,lhsInto:o,lhsGroup:s,rhsInto:e,lhsDir:r,rhsDir:n,rhsGroup:i,title:t}=_,h=ge(_.lhsDir,_.rhsDir)?"segments":"straight",l={id:`${T}-${c}`,label:t,source:T,sourceDir:r,sourceArrow:o,sourceGroup:s,sourceEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%",target:c,targetDir:n,targetArrow:e,targetGroup:i,targetEndpoint:n==="L"?"0 50%":n==="R"?"100% 50%":n==="T"?"50% 0":"50% 100%"};w.add({group:"edges",data:l,classes:h})})}function He(N,w,_){const T=Q((e,r)=>Object.entries(e).reduce((n,[i,t])=>{var g;let h=0;const l=Object.entries(t);if(l.length===1)return n[i]=l[0][1],n;for(let d=0;d{const r={},n={};return Object.entries(e).forEach(([i,[t,h]])=>{var g,d,y;const l=((g=N.getNode(i))==null?void 0:g.in)??"default";r[h]??(r[h]={}),(d=r[h])[l]??(d[l]=[]),r[h][l].push(i),n[t]??(n[t]={}),(y=n[t])[l]??(y[l]=[]),n[t][l].push(i)}),{horiz:Object.values(T(r,"horizontal")).filter(i=>i.length>1),vert:Object.values(T(n,"vertical")).filter(i=>i.length>1)}}),[o,s]=c.reduce(([e,r],{horiz:n,vert:i})=>[[...e,...n],[...r,...i]],[[],[]]);return{horizontal:o,vertical:s}}function Xe(N){const w=[],_=Q(c=>`${c[0]},${c[1]}`,"posToStr"),T=Q(c=>c.split(",").map(o=>parseInt(o)),"strToPos");return N.forEach(c=>{const o=Object.fromEntries(Object.entries(c).map(([n,i])=>[_(i),n])),s=[_([0,0])],e={},r={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;s.length>0;){const n=s.shift();if(n){e[n]=1;const i=o[n];if(i){const t=T(n);Object.entries(r).forEach(([h,l])=>{const g=_([t[0]+l[0],t[1]+l[1]]),d=o[g];d&&!e[g]&&(s.push(g),w.push({[De[h]]:d,[De[cr(h)]]:i,gap:1.5*St("iconSize")}))})}}}}),w}function ze(N,w,_,T,c,{spatialMaps:o,groupAlignments:s}){return new Promise(e=>{const r=sr("body").append("div").attr("id","cy").attr("style","display:none"),n=Ae({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${St("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${St("padding")}px`}}]});r.remove(),Ye(_,n),Pe(N,n),Fe(w,n),ke(T,n);const i=He(c,o,s),t=Xe(o),h=n.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(l){const[g,d]=l.connectedNodes(),{parent:y}=Qt(g),{parent:v}=Qt(d);return y===v?1.5*St("iconSize"):.5*St("iconSize")},edgeElasticity(l){const[g,d]=l.connectedNodes(),{parent:y}=Qt(g),{parent:v}=Qt(d);return y===v?.45:.001},alignmentConstraint:i,relativePlacementConstraint:t});h.one("layoutstop",()=>{var g;function l(d,y,v,E){let A,M;const{x:P,y:b}=d,{x:Y,y:H}=y;M=(E-b+(P-v)*(b-H)/(P-Y))/Math.sqrt(1+Math.pow((b-H)/(P-Y),2)),A=Math.sqrt(Math.pow(E-b,2)+Math.pow(v-P,2)-Math.pow(M,2)),A/=Math.sqrt(Math.pow(Y-P,2)+Math.pow(H-b,2));let q=(Y-P)*(E-b)-(H-b)*(v-P);switch(!0){case q>=0:q=1;break;case q<0:q=-1}let x=(Y-P)*(v-P)+(H-b)*(E-b);switch(!0){case x>=0:x=1;break;case x<0:x=-1}return M=Math.abs(M)*q,A*=x,{distances:M,weights:A}}Q(l,"getSegmentWeights"),n.startBatch();for(const d of Object.values(n.edges()))if((g=d.data)!=null&&g.call(d)){const{x:y,y:v}=d.source().position(),{x:E,y:A}=d.target().position();if(y!==E&&v!==A){const M=d.sourceEndpoint(),P=d.targetEndpoint(),{sourceDir:b}=Ge(d),[Y,H]=Wt(b)?[M.x,P.y]:[P.x,M.y],{weights:q,distances:x}=l(M,P,Y,H);d.style("segment-distances",x),d.style("segment-weights",q)}}n.endBatch(),h.run()}),h.run(),n.ready(l=>{Te.info("Ready",l),e(n)})})}er([{name:te.prefix,icons:te}]),Ae.use(dr),Q(Pe,"addServices"),Q(Fe,"addJunctions"),Q(Ue,"positionNodes"),Q(Ye,"addGroups"),Q(ke,"addEdges"),Q(He,"getAlignments"),Q(Xe,"getRelativeConstraints"),Q(ze,"layoutArchitecture");var Fr={parser:Dr,db:oe,renderer:{draw:Q(async(N,w,_,T)=>{const c=T.db,o=c.getServices(),s=c.getJunctions(),e=c.getGroups(),r=c.getEdges(),n=c.getDataStructures(),i=Qe(w),t=i.append("g");t.attr("class","architecture-edges");const h=i.append("g");h.attr("class","architecture-services");const l=i.append("g");l.attr("class","architecture-groups"),await Sr(c,h,o),Pr(c,h,s);const g=await ze(o,s,e,r,c,n);await br(t,g),await Gr(l,g),Ue(c,g),Je(void 0,i,St("padding"),St("useMaxWidth"))},"draw")},styles:Rr};export{Fr as diagram}; diff --git a/notebooks/assets/asciiarmor-D5V0T9Cu.js b/notebooks/assets/asciiarmor-D5V0T9Cu.js new file mode 100644 index 0000000000000000000000000000000000000000..a0eff9d49bc1783c601635750e22f29619ace457 --- /dev/null +++ b/notebooks/assets/asciiarmor-D5V0T9Cu.js @@ -0,0 +1 @@ +function s(t){var e=t.match(/^\s*\S/);return t.skipToEnd(),e?"error":null}const n={name:"asciiarmor",token:function(t,e){var r;if(e.state=="top")return t.sol()&&(r=t.match(/^-----BEGIN (.*)?-----\s*$/))?(e.state="headers",e.type=r[1],"tag"):s(t);if(e.state=="headers"){if(t.sol()&&t.match(/^\w+:/))return e.state="header","atom";var a=s(t);return a&&(e.state="body"),a}return e.state=="header"?(t.skipToEnd(),e.state="headers","string"):e.state=="body"?t.sol()&&(r=t.match(/^-----END (.*)?-----\s*$/))?r[1]!=e.type?"error":(e.state="end","tag"):t.eatWhile(/[A-Za-z0-9+\/=]/)?null:(t.next(),"error"):e.state=="end"?s(t):void 0},blankLine:function(t){t.state=="headers"&&(t.state="body")},startState:function(){return{state:"top",type:null}}};export{n as asciiArmor}; diff --git a/notebooks/assets/asn1-DWPaVWf6.js b/notebooks/assets/asn1-DWPaVWf6.js new file mode 100644 index 0000000000000000000000000000000000000000..78eb252e208a56f312e38312d038c0595fdcde42 --- /dev/null +++ b/notebooks/assets/asn1-DWPaVWf6.js @@ -0,0 +1 @@ +function E(i){for(var u={},l=i.split(" "),I=0;I?$/.test(r)?(t.extenExten=!0,t.extenStart=!1,"strong"):(t.extenStart=!1,a.skipToEnd(),"error")):t.extenExten?(t.extenExten=!1,t.extenPriority=!0,a.eatWhile(/[^,]/),t.extenInclude&&(a.skipToEnd(),t.extenPriority=!1,t.extenInclude=!1),t.extenSame&&(t.extenPriority=!1,t.extenSame=!1,t.extenApplication=!0),"tag"):t.extenPriority?(t.extenPriority=!1,t.extenApplication=!0,a.next(),t.extenSame?null:(a.eatWhile(/[^,]/),"number")):t.extenApplication?(a.eatWhile(/,/),(r=a.current())===","?null:(a.eatWhile(/\w/),r=a.current().toLowerCase(),t.extenApplication=!1,m.indexOf(r)!==-1?"def":null)):function(e,n){var o="",i=e.next();if(n.blockComment)return i=="-"&&e.match("-;",!0)?n.blockComment=!1:e.skipTo("--;")?(e.next(),e.next(),e.next(),n.blockComment=!1):e.skipToEnd(),"comment";if(i==";")return e.match("--",!0)&&!e.match("-",!1)?(n.blockComment=!0,"comment"):(e.skipToEnd(),"comment");if(i=="[")return e.skipTo("]"),e.eat("]"),"header";if(i=='"')return e.skipTo('"'),"string";if(i=="'")return e.skipTo("'"),"string.special";if(i=="#"&&(e.eatWhile(/\w/),o=e.current(),c.indexOf(o)!==-1))return e.skipToEnd(),"strong";if(i=="$"&&e.peek()=="{")return e.skipTo("}"),e.eat("}"),"variableName.special";if(e.eatWhile(/\w/),o=e.current(),s.indexOf(o)!==-1){switch(n.extenStart=!0,o){case"same":n.extenSame=!0;break;case"include":case"switch":case"ignorepat":n.extenInclude=!0}return"atom"}}(a,t)},languageData:{commentTokens:{line:";",block:{open:";--",close:"--;"}}}};export{l as asterisk}; diff --git a/notebooks/assets/blockDiagram-JOT3LUYC-D5EKpDOX.js b/notebooks/assets/blockDiagram-JOT3LUYC-D5EKpDOX.js new file mode 100644 index 0000000000000000000000000000000000000000..81ea03480f70a049e3fb3124a261debc4259ebff --- /dev/null +++ b/notebooks/assets/blockDiagram-JOT3LUYC-D5EKpDOX.js @@ -0,0 +1,121 @@ +var ae,se;import{_ as h,F as V,d as ie,l as w,y as oe,A as le,c as z,a1 as ce,a2 as q,a3 as Dt,a4 as de,u as Q,j as he,a5 as ge,a6 as gt,a7 as ye,h as $t}from"./mermaid-DwRBzUur.js";import{c as pe}from"./clone-Bj7S21pd.js";import{s as R}from"./transform-DetRMEbJ.js";import{G as ue}from"./graph-B7t7oBoL.js";import{c as xe}from"./channel-CWOR9f3f.js";import{l as be,k as fe}from"./step-BwsUM5iJ.js";import"./index-DgI7bmFZ.js";import"./_baseUniq-CR5yKjUQ.js";import"./_baseEach-DH7Slkql.js";import"./timer-Bqd5yn_a.js";var yt=function(){var e=h(function(d,u,k,b){for(k=k||{},b=d.length;b--;k[d[b]]=u);return k},"o"),t=[1,7],a=[1,13],n=[1,14],r=[1,15],s=[1,19],i=[1,16],o=[1,17],c=[1,18],p=[8,30],y=[8,21,28,29,30,31,32,40,44,47],x=[1,23],f=[1,24],_=[8,15,16,21,28,29,30,31,32,40,44,47],L=[8,15,16,21,27,28,29,30,31,32,40,44,47],E=[1,49],D={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,block:31,NODE_ID:32,nodeShapeNLabel:33,dirList:34,DIR:35,NODE_DSTART:36,NODE_DEND:37,BLOCK_ARROW_START:38,BLOCK_ARROW_END:39,classDef:40,CLASSDEF_ID:41,CLASSDEF_STYLEOPTS:42,DEFAULT:43,class:44,CLASSENTITY_IDS:45,STYLECLASS:46,style:47,STYLE_ENTITY_IDS:48,STYLE_DEFINITION_DATA:49,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"block",32:"NODE_ID",35:"DIR",36:"NODE_DSTART",37:"NODE_DEND",38:"BLOCK_ARROW_START",39:"BLOCK_ARROW_END",40:"classDef",41:"CLASSDEF_ID",42:"CLASSDEF_STYLEOPTS",43:"DEFAULT",44:"class",45:"CLASSENTITY_IDS",46:"STYLECLASS",47:"style",48:"STYLE_ENTITY_IDS",49:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[34,1],[34,2],[33,3],[33,4],[23,3],[23,3],[24,3],[25,3]],performAction:h(function(d,u,k,b,m,l,S){var g=l.length-1;switch(m){case 4:b.getLogger().debug("Rule: separator (NL) ");break;case 5:b.getLogger().debug("Rule: separator (Space) ");break;case 6:b.getLogger().debug("Rule: separator (EOF) ");break;case 7:b.getLogger().debug("Rule: hierarchy: ",l[g-1]),b.setHierarchy(l[g-1]);break;case 8:b.getLogger().debug("Stop NL ");break;case 9:b.getLogger().debug("Stop EOF ");break;case 10:b.getLogger().debug("Stop NL2 ");break;case 11:b.getLogger().debug("Stop EOF2 ");break;case 12:b.getLogger().debug("Rule: statement: ",l[g]),typeof l[g].length=="number"?this.$=l[g]:this.$=[l[g]];break;case 13:b.getLogger().debug("Rule: statement #2: ",l[g-1]),this.$=[l[g-1]].concat(l[g]);break;case 14:b.getLogger().debug("Rule: link: ",l[g],d),this.$={edgeTypeStr:l[g],label:""};break;case 15:b.getLogger().debug("Rule: LABEL link: ",l[g-3],l[g-1],l[g]),this.$={edgeTypeStr:l[g],label:l[g-1]};break;case 18:const $=parseInt(l[g]),H=b.generateId();this.$={id:H,type:"space",label:"",width:$,children:[]};break;case 23:b.getLogger().debug("Rule: (nodeStatement link node) ",l[g-2],l[g-1],l[g]," typestr: ",l[g-1].edgeTypeStr);const U=b.edgeStrToEdgeData(l[g-1].edgeTypeStr);this.$=[{id:l[g-2].id,label:l[g-2].label,type:l[g-2].type,directions:l[g-2].directions},{id:l[g-2].id+"-"+l[g].id,start:l[g-2].id,end:l[g].id,label:l[g-1].label,type:"edge",directions:l[g].directions,arrowTypeEnd:U,arrowTypeStart:"arrow_open"},{id:l[g].id,label:l[g].label,type:b.typeStr2Type(l[g].typeStr),directions:l[g].directions}];break;case 24:b.getLogger().debug("Rule: nodeStatement (abc88 node size) ",l[g-1],l[g]),this.$={id:l[g-1].id,label:l[g-1].label,type:b.typeStr2Type(l[g-1].typeStr),directions:l[g-1].directions,widthInColumns:parseInt(l[g],10)};break;case 25:b.getLogger().debug("Rule: nodeStatement (node) ",l[g]),this.$={id:l[g].id,label:l[g].label,type:b.typeStr2Type(l[g].typeStr),directions:l[g].directions,widthInColumns:1};break;case 26:b.getLogger().debug("APA123",this?this:"na"),b.getLogger().debug("COLUMNS: ",l[g]),this.$={type:"column-setting",columns:l[g]==="auto"?-1:parseInt(l[g])};break;case 27:b.getLogger().debug("Rule: id-block statement : ",l[g-2],l[g-1]),b.generateId(),this.$={...l[g-2],type:"composite",children:l[g-1]};break;case 28:b.getLogger().debug("Rule: blockStatement : ",l[g-2],l[g-1],l[g]);const T=b.generateId();this.$={id:T,type:"composite",label:"",children:l[g-1]};break;case 29:b.getLogger().debug("Rule: node (NODE_ID separator): ",l[g]),this.$={id:l[g]};break;case 30:b.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",l[g-1],l[g]),this.$={id:l[g-1],label:l[g].label,typeStr:l[g].typeStr,directions:l[g].directions};break;case 31:b.getLogger().debug("Rule: dirList: ",l[g]),this.$=[l[g]];break;case 32:b.getLogger().debug("Rule: dirList: ",l[g-1],l[g]),this.$=[l[g-1]].concat(l[g]);break;case 33:b.getLogger().debug("Rule: nodeShapeNLabel: ",l[g-2],l[g-1],l[g]),this.$={typeStr:l[g-2]+l[g],label:l[g-1]};break;case 34:b.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",l[g-3],l[g-2]," #3:",l[g-1],l[g]),this.$={typeStr:l[g-3]+l[g],label:l[g-2],directions:l[g-1]};break;case 35:case 36:this.$={type:"classDef",id:l[g-1].trim(),css:l[g].trim()};break;case 37:this.$={type:"applyClass",id:l[g-1].trim(),styleClass:l[g].trim()};break;case 38:this.$={type:"applyStyles",id:l[g-1].trim(),stylesStr:l[g].trim()}}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{11:3,13:4,19:5,20:6,21:t,22:8,23:9,24:10,25:11,26:12,28:a,29:n,31:r,32:s,40:i,44:o,47:c},{8:[1,20]},e(p,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,21:t,28:a,29:n,31:r,32:s,40:i,44:o,47:c}),e(y,[2,16],{14:22,15:x,16:f}),e(y,[2,17]),e(y,[2,18]),e(y,[2,19]),e(y,[2,20]),e(y,[2,21]),e(y,[2,22]),e(_,[2,25],{27:[1,25]}),e(y,[2,26]),{19:26,26:12,32:s},{11:27,13:4,19:5,20:6,21:t,22:8,23:9,24:10,25:11,26:12,28:a,29:n,31:r,32:s,40:i,44:o,47:c},{41:[1,28],43:[1,29]},{45:[1,30]},{48:[1,31]},e(L,[2,29],{33:32,36:[1,33],38:[1,34]}),{1:[2,7]},e(p,[2,13]),{26:35,32:s},{32:[2,14]},{17:[1,36]},e(_,[2,24]),{11:37,13:4,14:22,15:x,16:f,19:5,20:6,21:t,22:8,23:9,24:10,25:11,26:12,28:a,29:n,31:r,32:s,40:i,44:o,47:c},{30:[1,38]},{42:[1,39]},{42:[1,40]},{46:[1,41]},{49:[1,42]},e(L,[2,30]),{18:[1,43]},{18:[1,44]},e(_,[2,23]),{18:[1,45]},{30:[1,46]},e(y,[2,28]),e(y,[2,35]),e(y,[2,36]),e(y,[2,37]),e(y,[2,38]),{37:[1,47]},{34:48,35:E},{15:[1,50]},e(y,[2,27]),e(L,[2,33]),{39:[1,51]},{34:52,35:E,39:[2,31]},{32:[2,15]},e(L,[2,34]),{39:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:h(function(d,u){if(!u.recoverable){var k=new Error(d);throw k.hash=u,k}this.trace(d)},"parseError"),parse:h(function(d){var u=this,k=[0],b=[],m=[null],l=[],S=this.table,g="",$=0,H=0,U=l.slice.call(arguments,1),T=Object.create(this.lexer),M={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(M.yy[dt]=this.yy[dt]);T.setInput(d,M.yy),M.yy.lexer=T,M.yy.parser=this,T.yylloc===void 0&&(T.yylloc={});var ht=T.yylloc;l.push(ht);var ne=T.options&&T.options.ranges;function St(){var X;return typeof(X=b.pop()||T.lex()||1)!="number"&&(X instanceof Array&&(X=(b=X).pop()),X=u.symbols_[X]||X),X}typeof M.yy.parseError=="function"?this.parseError=M.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,h(function(X){k.length=k.length-2*X,m.length=m.length-X,l.length=l.length-X},"popStack"),h(St,"lex");for(var P,G,W,_t,rt,Z,Et,at,J={};;){if(G=k[k.length-1],this.defaultActions[G]?W=this.defaultActions[G]:(P==null&&(P=St()),W=S[G]&&S[G][P]),W===void 0||!W.length||!W[0]){var vt="";for(rt in at=[],S[G])this.terminals_[rt]&&rt>2&&at.push("'"+this.terminals_[rt]+"'");vt=T.showPosition?"Parse error on line "+($+1)+`: +`+T.showPosition()+` +Expecting `+at.join(", ")+", got '"+(this.terminals_[P]||P)+"'":"Parse error on line "+($+1)+": Unexpected "+(P==1?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(vt,{text:T.match,token:this.terminals_[P]||P,line:T.yylineno,loc:ht,expected:at})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+P);switch(W[0]){case 1:k.push(P),m.push(T.yytext),l.push(T.yylloc),k.push(W[1]),P=null,H=T.yyleng,g=T.yytext,$=T.yylineno,ht=T.yylloc;break;case 2:if(Z=this.productions_[W[1]][1],J.$=m[m.length-Z],J._$={first_line:l[l.length-(Z||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(Z||1)].first_column,last_column:l[l.length-1].last_column},ne&&(J._$.range=[l[l.length-(Z||1)].range[0],l[l.length-1].range[1]]),(_t=this.performAction.apply(J,[g,H,$,M.yy,W[1],m,l].concat(U)))!==void 0)return _t;Z&&(k=k.slice(0,-1*Z*2),m=m.slice(0,-1*Z),l=l.slice(0,-1*Z)),k.push(this.productions_[W[1]][0]),m.push(J.$),l.push(J._$),Et=S[k[k.length-2]][k[k.length-1]],k.push(Et);break;case 3:return!0}}return!0},"parse")},N=function(){return{EOF:1,parseError:h(function(d,u){if(!this.yy.parser)throw new Error(d);this.yy.parser.parseError(d,u)},"parseError"),setInput:h(function(d,u){return this.yy=u||this.yy||{},this._input=d,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var d=this._input[0];return this.yytext+=d,this.yyleng++,this.offset++,this.match+=d,this.matched+=d,d.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),d},"input"),unput:h(function(d){var u=d.length,k=d.split(/(?:\r\n?|\n)/g);this._input=d+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===b.length?this.yylloc.first_column:0)+b[b.length-k.length].length-k[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:h(function(d){this.unput(this.match.slice(d))},"less"),pastInput:h(function(){var d=this.matched.substr(0,this.matched.length-this.match.length);return(d.length>20?"...":"")+d.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var d=this.match;return d.length<20&&(d+=this._input.substr(0,20-d.length)),(d.substr(0,20)+(d.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var d=this.pastInput(),u=new Array(d.length+1).join("-");return d+this.upcomingInput()+` +`+u+"^"},"showPosition"),test_match:h(function(d,u){var k,b,m;if(this.options.backtrack_lexer&&(m={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(m.yylloc.range=this.yylloc.range.slice(0))),(b=d[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+d[0].length},this.yytext+=d[0],this.match+=d[0],this.matches=d,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(d[0].length),this.matched+=d[0],k=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),k)return k;if(this._backtrack){for(var l in m)this[l]=m[l];return!1}return!1},"test_match"),next:h(function(){if(this.done)return this.EOF;var d,u,k,b;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),l=0;lu[0].length)){if(u=k,b=l,this.options.backtrack_lexer){if((d=this.test_match(k,m[l]))!==!1)return d;if(this._backtrack){u=!1;continue}return!1}if(!this.options.flex)break}return u?(d=this.test_match(u,m[b]))!==!1&&d:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:h(function(){var d=this.next();return d||this.lex()},"lex"),begin:h(function(d){this.conditionStack.push(d)},"begin"),popState:h(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:h(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:h(function(d){return(d=this.conditionStack.length-1-Math.abs(d||0))>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:h(function(d){this.begin(d)},"pushState"),stateStackSize:h(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:h(function(d,u,k,b){switch(k){case 0:return 10;case 1:return d.getLogger().debug("Found space-block"),31;case 2:return d.getLogger().debug("Found nl-block"),31;case 3:return d.getLogger().debug("Found space-block"),29;case 4:d.getLogger().debug(".",u.yytext);break;case 5:d.getLogger().debug("_",u.yytext);break;case 6:return 5;case 7:return u.yytext=-1,28;case 8:return u.yytext=u.yytext.replace(/columns\s+/,""),d.getLogger().debug("COLUMNS (LEX)",u.yytext),28;case 9:case 77:case 78:case 100:this.pushState("md_string");break;case 10:return"MD_STR";case 11:case 35:case 80:this.popState();break;case 12:this.pushState("string");break;case 13:d.getLogger().debug("LEX: POPPING STR:",u.yytext),this.popState();break;case 14:return d.getLogger().debug("LEX: STR end:",u.yytext),"STR";case 15:return u.yytext=u.yytext.replace(/space\:/,""),d.getLogger().debug("SPACE NUM (LEX)",u.yytext),21;case 16:return u.yytext="1",d.getLogger().debug("COLUMNS (LEX)",u.yytext),21;case 17:return 43;case 18:return"LINKSTYLE";case 19:return"INTERPOLATE";case 20:return this.pushState("CLASSDEF"),40;case 21:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 22:return this.popState(),this.pushState("CLASSDEFID"),41;case 23:return this.popState(),42;case 24:return this.pushState("CLASS"),44;case 25:return this.popState(),this.pushState("CLASS_STYLE"),45;case 26:return this.popState(),46;case 27:return this.pushState("STYLE_STMNT"),47;case 28:return this.popState(),this.pushState("STYLE_DEFINITION"),48;case 29:return this.popState(),49;case 30:return this.pushState("acc_title"),"acc_title";case 31:return this.popState(),"acc_title_value";case 32:return this.pushState("acc_descr"),"acc_descr";case 33:return this.popState(),"acc_descr_value";case 34:this.pushState("acc_descr_multiline");break;case 36:return"acc_descr_multiline_value";case 37:return 30;case 38:case 39:case 41:case 42:case 45:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 40:return this.popState(),d.getLogger().debug("Lex: ))"),"NODE_DEND";case 43:return this.popState(),d.getLogger().debug("Lex: (-"),"NODE_DEND";case 44:return this.popState(),d.getLogger().debug("Lex: -)"),"NODE_DEND";case 46:return this.popState(),d.getLogger().debug("Lex: ]]"),"NODE_DEND";case 47:return this.popState(),d.getLogger().debug("Lex: ("),"NODE_DEND";case 48:return this.popState(),d.getLogger().debug("Lex: ])"),"NODE_DEND";case 49:case 50:return this.popState(),d.getLogger().debug("Lex: /]"),"NODE_DEND";case 51:return this.popState(),d.getLogger().debug("Lex: )]"),"NODE_DEND";case 52:return this.popState(),d.getLogger().debug("Lex: )"),"NODE_DEND";case 53:return this.popState(),d.getLogger().debug("Lex: ]>"),"NODE_DEND";case 54:return this.popState(),d.getLogger().debug("Lex: ]"),"NODE_DEND";case 55:return d.getLogger().debug("Lexa: -)"),this.pushState("NODE"),36;case 56:return d.getLogger().debug("Lexa: (-"),this.pushState("NODE"),36;case 57:return d.getLogger().debug("Lexa: ))"),this.pushState("NODE"),36;case 58:case 60:case 61:case 62:case 65:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;case 59:return d.getLogger().debug("Lex: ((("),this.pushState("NODE"),36;case 63:return d.getLogger().debug("Lexc: >"),this.pushState("NODE"),36;case 64:return d.getLogger().debug("Lexa: (["),this.pushState("NODE"),36;case 66:case 67:case 68:case 69:case 70:case 71:case 72:return this.pushState("NODE"),36;case 73:return d.getLogger().debug("Lexa: ["),this.pushState("NODE"),36;case 74:return this.pushState("BLOCK_ARROW"),d.getLogger().debug("LEX ARR START"),38;case 75:return d.getLogger().debug("Lex: NODE_ID",u.yytext),32;case 76:return d.getLogger().debug("Lex: EOF",u.yytext),8;case 79:return"NODE_DESCR";case 81:d.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 82:d.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 83:return d.getLogger().debug("LEX: NODE_DESCR:",u.yytext),"NODE_DESCR";case 84:d.getLogger().debug("LEX POPPING"),this.popState();break;case 85:d.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 86:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (right): dir:",u.yytext),"DIR";case 87:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (left):",u.yytext),"DIR";case 88:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (x):",u.yytext),"DIR";case 89:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (y):",u.yytext),"DIR";case 90:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (up):",u.yytext),"DIR";case 91:return u.yytext=u.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (down):",u.yytext),"DIR";case 92:return u.yytext="]>",d.getLogger().debug("Lex (ARROW_DIR end):",u.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 93:return d.getLogger().debug("Lex: LINK","#"+u.yytext+"#"),15;case 94:case 95:case 96:return d.getLogger().debug("Lex: LINK",u.yytext),15;case 97:case 98:case 99:return d.getLogger().debug("Lex: START_LINK",u.yytext),this.pushState("LLABEL"),16;case 101:return d.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 102:return this.popState(),d.getLogger().debug("Lex: LINK","#"+u.yytext+"#"),15;case 103:case 104:return this.popState(),d.getLogger().debug("Lex: LINK",u.yytext),15;case 105:return d.getLogger().debug("Lex: COLON",u.yytext),u.yytext=u.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block\s+)/,/^(?:block\n+)/,/^(?:block:)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[29],inclusive:!1},STYLE_STMNT:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[23],inclusive:!1},CLASSDEF:{rules:[21,22],inclusive:!1},CLASS_STYLE:{rules:[26],inclusive:!1},CLASS:{rules:[25],inclusive:!1},LLABEL:{rules:[100,101,102,103,104],inclusive:!1},ARROW_DIR:{rules:[86,87,88,89,90,91,92],inclusive:!1},BLOCK_ARROW:{rules:[77,82,85],inclusive:!1},NODE:{rules:[38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,78,81],inclusive:!1},md_string:{rules:[10,11,79,80],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[13,14,83,84],inclusive:!1},acc_descr_multiline:{rules:[35,36],inclusive:!1},acc_descr:{rules:[33],inclusive:!1},acc_title:{rules:[31],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,12,15,16,17,18,19,20,24,27,30,32,34,37,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,93,94,95,96,97,98,99,105],inclusive:!0}}}}();function v(){this.yy={}}return D.lexer=N,h(v,"Parser"),v.prototype=D,D.Parser=v,new v}();yt.parser=yt;var me=yt,K=new Map,pt=[],ut=new Map,Tt="color",Ct="fill",we=z(),st=new Map,ke=h(e=>he.sanitizeText(e,we),"sanitizeText"),Le=h(function(e,t=""){let a=st.get(e);a||(a={id:e,styles:[],textStyles:[]},st.set(e,a)),t!=null&&t.split(",").forEach(n=>{const r=n.replace(/([^;]*);/,"$1").trim();if(RegExp(Tt).exec(n)){const s=r.replace(Ct,"bgFill").replace(Tt,Ct);a.textStyles.push(s)}a.styles.push(r)})},"addStyleClass"),Se=h(function(e,t=""){const a=K.get(e);t!=null&&(a.styles=t.split(","))},"addStyle2Node"),_e=h(function(e,t){e.split(",").forEach(function(a){let n=K.get(a);if(n===void 0){const r=a.trim();n={id:r,type:"na",children:[]},K.set(r,n)}n.classes||(n.classes=[]),n.classes.push(t)})},"setCssClass"),Nt=h((e,t)=>{const a=e.flat(),n=[];for(const r of a)if(r.label&&(r.label=ke(r.label)),r.type!=="classDef")if(r.type!=="applyClass")if(r.type!=="applyStyles")if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const s=(ut.get(r.id)??0)+1;ut.set(r.id,s),r.id=s+"-"+r.id,pt.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const s=K.get(r.id);if(s===void 0?K.set(r.id,r):(r.type!=="na"&&(s.type=r.type),r.label!==r.id&&(s.label=r.label)),r.children&&Nt(r.children,r),r.type==="space"){const i=r.width??1;for(let o=0;o{w.debug("Clear called"),oe(),tt={id:"root",type:"composite",children:[],columns:-1},K=new Map([["root",tt]]),xt=[],st=new Map,pt=[],ut=new Map},"clear");function It(e){switch(w.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return w.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function Bt(e){return w.debug("typeStr2Type",e),e==="=="?"thick":"normal"}function zt(e){switch(e.trim()){case"--x":return"arrow_cross";case"--o":return"arrow_circle";default:return"arrow_point"}}h(It,"typeStr2Type"),h(Bt,"edgeTypeStr2Type"),h(zt,"edgeStrToEdgeData");var Rt=0,ve=h(()=>(Rt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Rt),"generateId"),De=h(e=>{tt.children=e,Nt(e,tt),xt=tt.children},"setHierarchy"),$e=h(e=>{const t=K.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Te=h(()=>[...K.values()],"getBlocksFlat"),Ce=h(()=>xt||[],"getBlocks"),Ne=h(()=>pt,"getEdges"),Ie=h(e=>K.get(e),"getBlock"),Be=h(e=>{K.set(e.id,e)},"setBlock"),ze=h(()=>console,"getLogger"),Re=h(function(){return st},"getClasses"),Oe={getConfig:h(()=>V().block,"getConfig"),typeStr2Type:It,edgeTypeStr2Type:Bt,edgeStrToEdgeData:zt,getLogger:ze,getBlocksFlat:Te,getBlocks:Ce,getEdges:Ne,setHierarchy:De,getBlock:Ie,setBlock:Be,getColumns:$e,getClasses:Re,clear:Ee,generateId:ve},nt=h((e,t)=>{const a=xe,n=a(e,"r"),r=a(e,"g"),s=a(e,"b");return le(n,r,s,t)},"fade"),Ae=h(e=>`.label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span,p { + color: ${e.titleColor}; + } + + + + .label text,span,p { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + .flowchart-label text { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${nt(e.edgeLabelBackground,.5)}; + // background-color: + } + + .node .cluster { + // fill: ${nt(e.mainBkg,.5)}; + fill: ${nt(e.clusterBkg,.5)}; + stroke: ${nt(e.clusterBorder,.2)}; + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span,p { + color: ${e.titleColor}; + } + /* .cluster div { + color: ${e.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } +`,"getStyles"),Me=h((e,t,a,n)=>{t.forEach(r=>{Pe[r](e,a,n)})},"insertMarkers"),Pe={extension:h((e,t,a)=>{w.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),composition:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),aggregation:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),dependency:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),lollipop:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),point:h((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),circle:h((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),cross:h((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),barb:h((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb")},Ye=Me,B=((se=(ae=z())==null?void 0:ae.block)==null?void 0:se.padding)??8;function Ot(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);return e<0?{px:t,py:0}:e===1?{px:0,py:t}:{px:t%e,py:Math.floor(t/e)}}h(Ot,"calculateBlockPosition");var We=h(e=>{let t=0,a=0;for(const n of e.children){const{width:r,height:s,x:i,y:o}=n.size??{width:0,height:0,x:0,y:0};w.debug("getMaxChildSize abc95 child:",n.id,"width:",r,"height:",s,"x:",i,"y:",o,n.type),n.type!=="space"&&(r>t&&(t=r/(e.widthInColumns??1)),s>a&&(a=s))}return{width:t,height:a}},"getMaxChildSize");function it(e,t,a=0,n=0){var i,o,c,p,y,x,f,_,L,E,D;w.debug("setBlockSizes abc95 (start)",e.id,(i=e==null?void 0:e.size)==null?void 0:i.x,"block width =",e==null?void 0:e.size,"sieblingWidth",a),(o=e==null?void 0:e.size)!=null&&o.width||(e.size={width:a,height:n,x:0,y:0});let r=0,s=0;if(((c=e.children)==null?void 0:c.length)>0){for(const l of e.children)it(l,t);const N=We(e);r=N.width,s=N.height,w.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",r,s);for(const l of e.children)l.size&&(w.debug(`abc95 Setting size of children of ${e.id} id=${l.id} ${r} ${s} ${JSON.stringify(l.size)}`),l.size.width=r*(l.widthInColumns??1)+B*((l.widthInColumns??1)-1),l.size.height=s,l.size.x=0,l.size.y=0,w.debug(`abc95 updating size of ${e.id} children child:${l.id} maxWidth:${r} maxHeight:${s}`));for(const l of e.children)it(l,t,r,s);const v=e.columns??-1;let d=0;for(const l of e.children)d+=l.widthInColumns??1;let u=e.children.length;v>0&&v0?Math.min(e.children.length,v):e.children.length;if(l>0){const S=(b-l*B-B)/l;w.debug("abc95 (growing to fit) width",e.id,b,(f=e.size)==null?void 0:f.width,S);for(const g of e.children)g.size&&(g.size.width=S)}}e.size={width:b,height:m,x:0,y:0}}w.debug("setBlockSizes abc94 (done)",e.id,(_=e==null?void 0:e.size)==null?void 0:_.x,(L=e==null?void 0:e.size)==null?void 0:L.width,(E=e==null?void 0:e.size)==null?void 0:E.y,(D=e==null?void 0:e.size)==null?void 0:D.height)}function bt(e,t){var n,r,s,i,o,c,p,y,x,f,_,L,E,D,N,v,d;w.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(n=e==null?void 0:e.size)==null?void 0:n.x} y: ${(r=e==null?void 0:e.size)==null?void 0:r.y} width: ${(s=e==null?void 0:e.size)==null?void 0:s.width}`);const a=e.columns??-1;if(w.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const u=((o=(i=e==null?void 0:e.children[0])==null?void 0:i.size)==null?void 0:o.width)??0,k=e.children.length*u+(e.children.length-1)*B;w.debug("widthOfChildren 88",k,"posX");let b=0;w.debug("abc91 block?.size?.x",e.id,(c=e==null?void 0:e.size)==null?void 0:c.x);let m=(p=e==null?void 0:e.size)!=null&&p.x?((y=e==null?void 0:e.size)==null?void 0:y.x)+(-((x=e==null?void 0:e.size)==null?void 0:x.width)/2||0):-B,l=0;for(const S of e.children){const g=e;if(!S.size)continue;const{width:$,height:H}=S.size,{px:U,py:T}=Ot(a,b);if(T!=l&&(l=T,m=(f=e==null?void 0:e.size)!=null&&f.x?((_=e==null?void 0:e.size)==null?void 0:_.x)+(-((L=e==null?void 0:e.size)==null?void 0:L.width)/2||0):-B,w.debug("New row in layout for block",e.id," and child ",S.id,l)),w.debug(`abc89 layout blocks (child) id: ${S.id} Pos: ${b} (px, py) ${U},${T} (${(E=g==null?void 0:g.size)==null?void 0:E.x},${(D=g==null?void 0:g.size)==null?void 0:D.y}) parent: ${g.id} width: ${$}${B}`),g.size){const M=$/2;S.size.x=m+B+M,w.debug(`abc91 layout blocks (calc) px, pyid:${S.id} startingPos=X${m} new startingPosX${S.size.x} ${M} padding=${B} width=${$} halfWidth=${M} => x:${S.size.x} y:${S.size.y} ${S.widthInColumns} (width * (child?.w || 1)) / 2 ${$*((S==null?void 0:S.widthInColumns)??1)/2}`),m=S.size.x+M,S.size.y=g.size.y-g.size.height/2+T*(H+B)+H/2+B,w.debug(`abc88 layout blocks (calc) px, pyid:${S.id}startingPosX${m}${B}${M}=>x:${S.size.x}y:${S.size.y}${S.widthInColumns}(width * (child?.w || 1)) / 2${$*((S==null?void 0:S.widthInColumns)??1)/2}`)}S.children&&bt(S),b+=(S==null?void 0:S.widthInColumns)??1,w.debug("abc88 columnsPos",S,b)}}w.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${(N=e==null?void 0:e.size)==null?void 0:N.x} y: ${(v=e==null?void 0:e.size)==null?void 0:v.y} width: ${(d=e==null?void 0:e.size)==null?void 0:d.width}`)}function ft(e,{minX:t,minY:a,maxX:n,maxY:r}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:s,y:i,width:o,height:c}=e.size;s-o/2n&&(n=s+o/2),i+c/2>r&&(r=i+c/2)}if(e.children)for(const s of e.children)({minX:t,minY:a,maxX:n,maxY:r}=ft(s,{minX:t,minY:a,maxX:n,maxY:r}));return{minX:t,minY:a,maxX:n,maxY:r}}function At(e){const t=e.getBlock("root");if(!t)return;it(t,e,0,0),bt(t),w.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:n,maxX:r,maxY:s}=ft(t);return{x:a,y:n,width:r-a,height:s-n}}function mt(e,t){t&&e.attr("style",t)}function Mt(e){const t=R(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),a=t.append("xhtml:div"),n=e.label,r=e.isNode?"nodeLabel":"edgeLabel",s=a.append("span");return s.html(n),mt(s,e.labelStyle),s.attr("class",r),mt(a,e.labelStyle),a.style("display","inline-block"),a.style("white-space","nowrap"),a.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}h(it,"setBlockSizes"),h(bt,"layoutBlocks"),h(ft,"findBounds"),h(At,"layout"),h(mt,"applyStyle"),h(Mt,"addHtmlLabel");var F=h((e,t,a,n)=>{let r=e||"";if(typeof r=="object"&&(r=r[0]),q(z().flowchart.htmlLabels))return r=r.replace(/\\n|\n/g,"
"),w.debug("vertexText"+r),Mt({isNode:n,label:ge(gt(r)),labelStyle:t.replace("fill:","color:")});{const s=document.createElementNS("http://www.w3.org/2000/svg","text");s.setAttribute("style",t.replace("color:","fill:"));let i=[];i=typeof r=="string"?r.split(/\\n|\n|/gi):Array.isArray(r)?r:[];for(const o of i){const c=document.createElementNS("http://www.w3.org/2000/svg","tspan");c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),c.setAttribute("dy","1em"),c.setAttribute("x","0"),a?c.setAttribute("class","title-row"):c.setAttribute("class","row"),c.textContent=o.trim(),s.appendChild(c)}return s}},"createLabel"),Xe=h((e,t,a,n,r)=>{t.arrowTypeStart&&Pt(e,"start",t.arrowTypeStart,a,n,r),t.arrowTypeEnd&&Pt(e,"end",t.arrowTypeEnd,a,n,r)},"addEdgeMarkers"),Fe={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Pt=h((e,t,a,n,r,s)=>{const i=Fe[a];if(!i)return void w.warn(`Unknown arrow type: ${a}`);const o=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${n}#${r}_${s}-${i}${o})`)},"addEdgeMarker"),wt={},A={},He=h((e,t)=>{const a=z(),n=q(a.flowchart.htmlLabels),r=t.labelType==="markdown"?Dt(e,t.label,{style:t.labelStyle,useHtmlLabels:n,addSvgBackground:!0},a):F(t.label,t.labelStyle),s=e.insert("g").attr("class","edgeLabel"),i=s.insert("g").attr("class","label");i.node().appendChild(r);let o,c=r.getBBox();if(n){const p=r.children[0],y=R(r);c=p.getBoundingClientRect(),y.attr("width",c.width),y.attr("height",c.height)}if(i.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),wt[t.id]=s,t.width=c.width,t.height=c.height,t.startLabelLeft){const p=F(t.startLabelLeft,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),A[t.id]||(A[t.id]={}),A[t.id].startLeft=y,et(o,t.startLabelLeft)}if(t.startLabelRight){const p=F(t.startLabelRight,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=y.node().appendChild(p),x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),A[t.id]||(A[t.id]={}),A[t.id].startRight=y,et(o,t.startLabelRight)}if(t.endLabelLeft){const p=F(t.endLabelLeft,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),y.node().appendChild(p),A[t.id]||(A[t.id]={}),A[t.id].endLeft=y,et(o,t.endLabelLeft)}if(t.endLabelRight){const p=F(t.endLabelRight,t.labelStyle),y=e.insert("g").attr("class","edgeTerminals"),x=y.insert("g").attr("class","inner");o=x.node().appendChild(p);const f=p.getBBox();x.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),y.node().appendChild(p),A[t.id]||(A[t.id]={}),A[t.id].endRight=y,et(o,t.endLabelRight)}return r},"insertEdgeLabel");function et(e,t){z().flowchart.htmlLabels&&e&&(e.style.width=9*t.length+"px",e.style.height="12px")}h(et,"setTerminalWidth");var Ue=h((e,t)=>{w.debug("Moving label abc88 ",e.id,e.label,wt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const n=z(),{subGraphTitleTotalMargin:r}=de(n);if(e.label){const s=wt[e.id];let i=e.x,o=e.y;if(a){const c=Q.calcLabelPosition(a);w.debug("Moving label "+e.label+" from (",i,",",o,") to (",c.x,",",c.y,") abc88"),t.updatedPath&&(i=c.x,o=c.y)}s.attr("transform",`translate(${i}, ${o+r/2})`)}if(e.startLabelLeft){const s=A[e.id].startLeft;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}if(e.startLabelRight){const s=A[e.id].startRight;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}if(e.endLabelLeft){const s=A[e.id].endLeft;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}if(e.endLabelRight){const s=A[e.id].endRight;let i=e.x,o=e.y;if(a){const c=Q.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);i=c.x,o=c.y}s.attr("transform",`translate(${i}, ${o})`)}},"positionEdgeLabel"),Ke=h((e,t)=>{const a=e.x,n=e.y,r=Math.abs(t.x-a),s=Math.abs(t.y-n),i=e.width/2,o=e.height/2;return r>=i||s>=o},"outsideNode"),je=h((e,t,a)=>{w.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(a)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const n=e.x,r=e.y,s=Math.abs(n-a.x),i=e.width/2;let o=a.xMath.abs(n-t.x)*c){let x=a.y{w.debug("abc88 cutPathAtIntersect",e,t);let a=[],n=e[0],r=!1;return e.forEach(s=>{if(Ke(t,s)||r)n=s,r||a.push(s);else{const i=je(t,n,s);let o=!1;a.forEach(c=>{o=o||c.x===i.x&&c.y===i.y}),a.some(c=>c.x===i.x&&c.y===i.y)||a.push(i),r=!0}}),a},"cutPathAtIntersect"),qe=h(function(e,t,a,n,r,s,i){let o=a.points;w.debug("abc88 InsertEdge: edge=",a,"e=",t);let c=!1;const p=s.node(t.v);var y=s.node(t.w);y!=null&&y.intersect&&(p!=null&&p.intersect)&&(o=o.slice(1,a.points.length-1),o.unshift(p.intersect(o[0])),o.push(y.intersect(o[o.length-1]))),a.toCluster&&(w.debug("to cluster abc88",n[a.toCluster]),o=Yt(a.points,n[a.toCluster].node),c=!0),a.fromCluster&&(w.debug("from cluster abc88",n[a.fromCluster]),o=Yt(o.reverse(),n[a.fromCluster].node).reverse(),c=!0);const x=o.filter(u=>!Number.isNaN(u.y));let f=fe;!a.curve||r!=="graph"&&r!=="flowchart"||(f=a.curve);const{x:_,y:L}=ce(a),E=be().x(_).y(L).curve(f);let D;switch(a.thickness){case"normal":D="edge-thickness-normal";break;case"thick":case"invisible":D="edge-thickness-thick";break;default:D=""}switch(a.pattern){case"solid":D+=" edge-pattern-solid";break;case"dotted":D+=" edge-pattern-dotted";break;case"dashed":D+=" edge-pattern-dashed"}const N=e.append("path").attr("d",E(x)).attr("id",a.id).attr("class"," "+D+(a.classes?" "+a.classes:"")).attr("style",a.style);let v="";(z().flowchart.arrowMarkerAbsolute||z().state.arrowMarkerAbsolute)&&(v=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,v=v.replace(/\(/g,"\\("),v=v.replace(/\)/g,"\\)")),Xe(N,a,v,i,r);let d={};return c&&(d.updatedPath=o),d.originalPath=a.points,d},"insertEdge"),Ze=h(e=>{const t=new Set;for(const a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a)}return t},"expandAndDeduplicateDirections"),Ge=h((e,t,a)=>{const n=Ze(e),r=t.height+2*a.padding,s=r/2,i=t.width+2*s+a.padding,o=a.padding/2;return n.has("right")&&n.has("left")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:s,y:0},{x:i/2,y:2*o},{x:i-s,y:0},{x:i,y:0},{x:i,y:-r/3},{x:i+2*o,y:-r/2},{x:i,y:-2*r/3},{x:i,y:-r},{x:i-s,y:-r},{x:i/2,y:-r-2*o},{x:s,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*o,y:-r/2},{x:0,y:-r/3}]:n.has("right")&&n.has("left")&&n.has("up")?[{x:s,y:0},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:s,y:-r},{x:0,y:-r/2}]:n.has("right")&&n.has("left")&&n.has("down")?[{x:0,y:0},{x:s,y:-r},{x:i-s,y:-r},{x:i,y:0}]:n.has("right")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:i,y:-s},{x:i,y:-r+s},{x:0,y:-r}]:n.has("left")&&n.has("up")&&n.has("down")?[{x:i,y:0},{x:0,y:-s},{x:0,y:-r+s},{x:i,y:-r}]:n.has("right")&&n.has("left")?[{x:s,y:0},{x:s,y:-o},{x:i-s,y:-o},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:i-s,y:-r+o},{x:s,y:-r+o},{x:s,y:-r},{x:0,y:-r/2}]:n.has("up")&&n.has("down")?[{x:i/2,y:0},{x:0,y:-o},{x:s,y:-o},{x:s,y:-r+o},{x:0,y:-r+o},{x:i/2,y:-r},{x:i,y:-r+o},{x:i-s,y:-r+o},{x:i-s,y:-o},{x:i,y:-o}]:n.has("right")&&n.has("up")?[{x:0,y:0},{x:i,y:-s},{x:0,y:-r}]:n.has("right")&&n.has("down")?[{x:0,y:0},{x:i,y:0},{x:0,y:-r}]:n.has("left")&&n.has("up")?[{x:i,y:0},{x:0,y:-s},{x:i,y:-r}]:n.has("left")&&n.has("down")?[{x:i,y:0},{x:0,y:0},{x:i,y:-r}]:n.has("right")?[{x:s,y:-o},{x:s,y:-o},{x:i-s,y:-o},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:i-s,y:-r+o},{x:s,y:-r+o},{x:s,y:-r+o}]:n.has("left")?[{x:s,y:0},{x:s,y:-o},{x:i-s,y:-o},{x:i-s,y:-r+o},{x:s,y:-r+o},{x:s,y:-r},{x:0,y:-r/2}]:n.has("up")?[{x:s,y:-o},{x:s,y:-r+o},{x:0,y:-r+o},{x:i/2,y:-r},{x:i,y:-r+o},{x:i-s,y:-r+o},{x:i-s,y:-o}]:n.has("down")?[{x:i/2,y:0},{x:0,y:-o},{x:s,y:-o},{x:s,y:-r+o},{x:i-s,y:-r+o},{x:i-s,y:-o},{x:i,y:-o}]:[{x:0,y:0}]},"getArrowPoints");function Wt(e,t){return e.intersect(t)}h(Wt,"intersectNode");var Je=Wt;function Xt(e,t,a,n){var r=e.x,s=e.y,i=r-n.x,o=s-n.y,c=Math.sqrt(t*t*o*o+a*a*i*i),p=Math.abs(t*a*i/c);n.x0}h(Ut,"intersectLine"),h(kt,"sameSign");var Qe=Ut,tr=Kt;function Kt(e,t,a){var n=e.x,r=e.y,s=[],i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(L){i=Math.min(i,L.x),o=Math.min(o,L.y)}):(i=Math.min(i,t.x),o=Math.min(o,t.y));for(var c=n-e.width/2-i,p=r-e.height/2-o,y=0;y1&&s.sort(function(L,E){var D=L.x-a.x,N=L.y-a.y,v=Math.sqrt(D*D+N*N),d=E.x-a.x,u=E.y-a.y,k=Math.sqrt(d*d+u*u);return v{var a,n,r=e.x,s=e.y,i=t.x-r,o=t.y-s,c=e.width/2,p=e.height/2;return Math.abs(o)*c>Math.abs(i)*p?(o<0&&(p=-p),a=o===0?0:p*i/o,n=p):(i<0&&(c=-c),a=c,n=i===0?0:c*o/i),{x:r+a,y:s+n}},"intersectRect")},O=h(async(e,t,a,n)=>{const r=z();let s;const i=t.useHtmlLabels||q(r.flowchart.htmlLabels);s=a||"node default";const o=e.insert("g").attr("class",s).attr("id",t.domId||t.id),c=o.insert("g").attr("class","label").attr("style",t.labelStyle);let p;p=t.labelText===void 0?"":typeof t.labelText=="string"?t.labelText:t.labelText[0];const y=c.node();let x;x=t.labelType==="markdown"?Dt(c,$t(gt(p),r),{useHtmlLabels:i,width:t.width||r.flowchart.wrappingWidth,classes:"markdown-node-label"},r):y.appendChild(F($t(gt(p),r),t.labelStyle,!1,n));let f=x.getBBox();const _=t.padding/2;if(q(r.flowchart.htmlLabels)){const L=x.children[0],E=R(x),D=L.getElementsByTagName("img");if(D){const N=p.replace(/]*>/g,"").trim()==="";await Promise.all([...D].map(v=>new Promise(d=>{function u(){if(v.style.display="flex",v.style.flexDirection="column",N){const k=r.fontSize?r.fontSize:window.getComputedStyle(document.body).fontSize,b=5,m=parseInt(k,10)*b+"px";v.style.minWidth=m,v.style.maxWidth=m}else v.style.width="100%";d(v)}h(u,"setupImage"),setTimeout(()=>{v.complete&&u()}),v.addEventListener("error",u),v.addEventListener("load",u)})))}f=L.getBoundingClientRect(),E.attr("width",f.width),E.attr("height",f.height)}return i?c.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):c.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&c.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),c.insert("rect",":first-child"),{shapeSvg:o,bbox:f,halfPadding:_,label:c}},"labelHelper"),I=h((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function j(e,t,a,n){return e.insert("polygon",":first-child").attr("points",n.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}h(j,"insertPolygonShape");var er=h(async(e,t)=>{t.useHtmlLabels||z().flowchart.htmlLabels||(t.centerLabel=!0);const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,"node "+t.classes,!0);w.info("Classes = ",t.classes);const s=a.insert("rect",":first-child");return s.attr("rx",t.rx).attr("ry",t.ry).attr("x",-n.width/2-r).attr("y",-n.height/2-r).attr("width",n.width+t.padding).attr("height",n.height+t.padding),I(t,s),t.intersect=function(i){return C.rect(t,i)},a},"note"),jt=h(e=>e?" "+e:"","formatClass"),Y=h((e,t)=>`${t||"node default"}${jt(e.classes)} ${jt(e.class)}`,"getClassesFromNode"),qt=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding+(n.height+t.padding),s=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];w.info("Question main (Circle)");const i=j(a,r,r,s);return i.attr("style",t.style),I(t,i),t.intersect=function(o){return w.warn("Intersect called"),C.polygon(t,s,o)},a},"question"),rr=h((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return a.insert("polygon",":first-child").attr("points",n.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return C.circle(t,14,r)},a},"choice"),ar=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.height+t.padding,s=r/4,i=n.width+2*s+t.padding,o=[{x:s,y:0},{x:i-s,y:0},{x:i,y:-r/2},{x:i-s,y:-r},{x:s,y:-r},{x:0,y:-r/2}],c=j(a,i,r,o);return c.attr("style",t.style),I(t,c),t.intersect=function(p){return C.polygon(t,o,p)},a},"hexagon"),sr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,void 0,!0),r=n.height+2*t.padding,s=r/2,i=n.width+2*s+t.padding,o=Ge(t.directions,n,t),c=j(a,i,r,o);return c.attr("style",t.style),I(t,c),t.intersect=function(p){return C.polygon(t,o,p)},a},"block_arrow"),nr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:-s/2,y:0},{x:r,y:0},{x:r,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return j(a,r,s,i).attr("style",t.style),t.width=r+s,t.height=s,t.intersect=function(o){return C.polygon(t,i,o)},a},"rect_left_inv_arrow"),ir=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:-2*s/6,y:0},{x:r-s/6,y:0},{x:r+2*s/6,y:-s},{x:s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"lean_right"),or=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:2*s/6,y:0},{x:r+s/6,y:0},{x:r-2*s/6,y:-s},{x:-s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"lean_left"),lr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:-2*s/6,y:0},{x:r+2*s/6,y:0},{x:r-s/6,y:-s},{x:s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"trapezoid"),cr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:s/6,y:0},{x:r-s/6,y:0},{x:r+2*s/6,y:-s},{x:-2*s/6,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"inv_trapezoid"),dr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:0,y:0},{x:r+s/2,y:0},{x:r,y:-s/2},{x:r+s/2,y:-s},{x:0,y:-s}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"rect_right_inv_arrow"),hr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=r/2,i=s/(2.5+r/50),o=n.height+i+t.padding,c="M 0,"+i+" a "+s+","+i+" 0,0,0 "+r+" 0 a "+s+","+i+" 0,0,0 "+-r+" 0 l 0,"+o+" a "+s+","+i+" 0,0,0 "+r+" 0 l 0,"+-o,p=a.attr("label-offset-y",i).insert("path",":first-child").attr("style",t.style).attr("d",c).attr("transform","translate("+-r/2+","+-(o/2+i)+")");return I(t,p),t.intersect=function(y){const x=C.rect(t,y),f=x.x-t.x;if(s!=0&&(Math.abs(f)t.height/2-i)){let _=i*i*(1-f*f/(s*s));_!=0&&(_=Math.sqrt(_)),_=i-_,y.y-t.y>0&&(_=-_),x.y+=_}return x},a},"cylinder"),gr=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,"node "+t.classes+" "+t.class,!0),s=a.insert("rect",":first-child"),i=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,c=t.positioned?-i/2:-n.width/2-r,p=t.positioned?-o/2:-n.height/2-r;if(s.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",p).attr("width",i).attr("height",o),t.props){const y=new Set(Object.keys(t.props));t.props.borders&&(ot(s,t.props.borders,i,o),y.delete("borders")),y.forEach(x=>{w.warn(`Unknown node property ${x}`)})}return I(t,s),t.intersect=function(y){return C.rect(t,y)},a},"rect"),yr=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,"node "+t.classes,!0),s=a.insert("rect",":first-child"),i=t.positioned?t.width:n.width+t.padding,o=t.positioned?t.height:n.height+t.padding,c=t.positioned?-i/2:-n.width/2-r,p=t.positioned?-o/2:-n.height/2-r;if(s.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",c).attr("y",p).attr("width",i).attr("height",o),t.props){const y=new Set(Object.keys(t.props));t.props.borders&&(ot(s,t.props.borders,i,o),y.delete("borders")),y.forEach(x=>{w.warn(`Unknown node property ${x}`)})}return I(t,s),t.intersect=function(y){return C.rect(t,y)},a},"composite"),pr=h(async(e,t)=>{const{shapeSvg:a}=await O(e,t,"label",!0);w.trace("Classes = ",t.class);const n=a.insert("rect",":first-child");if(n.attr("width",0).attr("height",0),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(ot(n,t.props.borders,0,0),r.delete("borders")),r.forEach(s=>{w.warn(`Unknown node property ${s}`)})}return I(t,n),t.intersect=function(r){return C.rect(t,r)},a},"labelRect");function ot(e,t,a,n){const r=[],s=h(o=>{r.push(o,0)},"addBorder"),i=h(o=>{r.push(0,o)},"skipBorder");t.includes("t")?(w.debug("add top border"),s(a)):i(a),t.includes("r")?(w.debug("add right border"),s(n)):i(n),t.includes("b")?(w.debug("add bottom border"),s(a)):i(a),t.includes("l")?(w.debug("add left border"),s(n)):i(n),e.attr("stroke-dasharray",r.join(" "))}h(ot,"applyNodePropertyBorders");var ur=h((e,t)=>{let a;a=t.classes?"node "+t.classes:"node default";const n=e.insert("g").attr("class",a).attr("id",t.domId||t.id),r=n.insert("rect",":first-child"),s=n.insert("line"),i=n.insert("g").attr("class","label"),o=t.labelText.flat?t.labelText.flat():t.labelText;let c="";c=typeof o=="object"?o[0]:o,w.info("Label text abc79",c,o,typeof o=="object");const p=i.node().appendChild(F(c,t.labelStyle,!0,!0));let y={width:0,height:0};if(q(z().flowchart.htmlLabels)){const E=p.children[0],D=R(p);y=E.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}w.info("Text 2",o);const x=o.slice(1,o.length);let f=p.getBBox();const _=i.node().appendChild(F(x.join?x.join("
"):x,t.labelStyle,!0,!0));if(q(z().flowchart.htmlLabels)){const E=_.children[0],D=R(_);y=E.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}const L=t.padding/2;return R(_).attr("transform","translate( "+(y.width>f.width?0:(f.width-y.width)/2)+", "+(f.height+L+5)+")"),R(p).attr("transform","translate( "+(y.width{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.height+t.padding,s=n.width+r/4+t.padding,i=a.insert("rect",":first-child").attr("style",t.style).attr("rx",r/2).attr("ry",r/2).attr("x",-s/2).attr("y",-r/2).attr("width",s).attr("height",r);return I(t,i),t.intersect=function(o){return C.rect(t,o)},a},"stadium"),br=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,Y(t,void 0),!0),s=a.insert("circle",":first-child");return s.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+r).attr("width",n.width+t.padding).attr("height",n.height+t.padding),w.info("Circle main"),I(t,s),t.intersect=function(i){return w.info("Circle intersect",t,n.width/2+r,i),C.circle(t,n.width/2+r,i)},a},"circle"),fr=h(async(e,t)=>{const{shapeSvg:a,bbox:n,halfPadding:r}=await O(e,t,Y(t,void 0),!0),s=a.insert("g",":first-child"),i=s.insert("circle"),o=s.insert("circle");return s.attr("class",t.class),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+r+5).attr("width",n.width+t.padding+10).attr("height",n.height+t.padding+10),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+r).attr("width",n.width+t.padding).attr("height",n.height+t.padding),w.info("DoubleCircle main"),I(t,i),t.intersect=function(c){return w.info("DoubleCircle intersect",t,n.width/2+r+5,c),C.circle(t,n.width/2+r+5,c)},a},"doublecircle"),mr=h(async(e,t)=>{const{shapeSvg:a,bbox:n}=await O(e,t,Y(t,void 0),!0),r=n.width+t.padding,s=n.height+t.padding,i=[{x:0,y:0},{x:r,y:0},{x:r,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:r+8,y:0},{x:r+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],o=j(a,r,s,i);return o.attr("style",t.style),I(t,o),t.intersect=function(c){return C.polygon(t,i,c)},a},"subroutine"),wr=h((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=a.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),I(t,n),t.intersect=function(r){return C.circle(t,7,r)},a},"start"),Zt=h((e,t,a)=>{const n=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let r=70,s=10;a==="LR"&&(r=10,s=70);const i=n.append("rect").attr("x",-1*r/2).attr("y",-1*s/2).attr("width",r).attr("height",s).attr("class","fork-join");return I(t,i),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(o){return C.rect(t,o)},n},"forkJoin"),Gt={rhombus:qt,composite:yr,question:qt,rect:gr,labelRect:pr,rectWithTitle:ur,choice:rr,circle:br,doublecircle:fr,stadium:xr,hexagon:ar,block_arrow:sr,rect_left_inv_arrow:nr,lean_right:ir,lean_left:or,trapezoid:lr,inv_trapezoid:cr,rect_right_inv_arrow:dr,cylinder:hr,start:wr,end:h((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=a.insert("circle",":first-child"),r=a.insert("circle",":first-child");return r.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),n.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),I(t,r),t.intersect=function(s){return C.circle(t,7,s)},a},"end"),note:er,subroutine:mr,fork:Zt,join:Zt,class_box:h((e,t)=>{var b;const a=t.padding/2;let n;n=t.classes?"node "+t.classes:"node default";const r=e.insert("g").attr("class",n).attr("id",t.domId||t.id),s=r.insert("rect",":first-child"),i=r.insert("line"),o=r.insert("line");let c=0,p=4;const y=r.insert("g").attr("class","label");let x=0;const f=(b=t.classData.annotations)==null?void 0:b[0],_=t.classData.annotations[0]?"\xAB"+t.classData.annotations[0]+"\xBB":"",L=y.node().appendChild(F(_,t.labelStyle,!0,!0));let E=L.getBBox();if(q(z().flowchart.htmlLabels)){const m=L.children[0],l=R(L);E=m.getBoundingClientRect(),l.attr("width",E.width),l.attr("height",E.height)}t.classData.annotations[0]&&(p+=E.height+4,c+=E.width);let D=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(z().flowchart.htmlLabels?D+="<"+t.classData.type+">":D+="<"+t.classData.type+">");const N=y.node().appendChild(F(D,t.labelStyle,!0,!0));R(N).attr("class","classTitle");let v=N.getBBox();if(q(z().flowchart.htmlLabels)){const m=N.children[0],l=R(N);v=m.getBoundingClientRect(),l.attr("width",v.width),l.attr("height",v.height)}p+=v.height+4,v.width>c&&(c=v.width);const d=[];t.classData.members.forEach(m=>{const l=m.getDisplayDetails();let S=l.displayText;z().flowchart.htmlLabels&&(S=S.replace(//g,">"));const g=y.node().appendChild(F(S,l.cssStyle?l.cssStyle:t.labelStyle,!0,!0));let $=g.getBBox();if(q(z().flowchart.htmlLabels)){const H=g.children[0],U=R(g);$=H.getBoundingClientRect(),U.attr("width",$.width),U.attr("height",$.height)}$.width>c&&(c=$.width),p+=$.height+4,d.push(g)}),p+=8;const u=[];if(t.classData.methods.forEach(m=>{const l=m.getDisplayDetails();let S=l.displayText;z().flowchart.htmlLabels&&(S=S.replace(//g,">"));const g=y.node().appendChild(F(S,l.cssStyle?l.cssStyle:t.labelStyle,!0,!0));let $=g.getBBox();if(q(z().flowchart.htmlLabels)){const H=g.children[0],U=R(g);$=H.getBoundingClientRect(),U.attr("width",$.width),U.attr("height",$.height)}$.width>c&&(c=$.width),p+=$.height+4,u.push(g)}),p+=8,f){let m=(c-E.width)/2;R(L).attr("transform","translate( "+(-1*c/2+m)+", "+-1*p/2+")"),x=E.height+4}let k=(c-v.width)/2;return R(N).attr("transform","translate( "+(-1*c/2+k)+", "+(-1*p/2+x)+")"),x+=v.height+4,i.attr("class","divider").attr("x1",-c/2-a).attr("x2",c/2+a).attr("y1",-p/2-a+8+x).attr("y2",-p/2-a+8+x),x+=8,d.forEach(m=>{R(m).attr("transform","translate( "+-c/2+", "+(-1*p/2+x+4)+")");const l=m==null?void 0:m.getBBox();x+=((l==null?void 0:l.height)??0)+4}),x+=8,o.attr("class","divider").attr("x1",-c/2-a).attr("x2",c/2+a).attr("y1",-p/2-a+8+x).attr("y2",-p/2-a+8+x),x+=8,u.forEach(m=>{R(m).attr("transform","translate( "+-c/2+", "+(-1*p/2+x)+")");const l=m==null?void 0:m.getBBox();x+=((l==null?void 0:l.height)??0)+4}),s.attr("style",t.style).attr("class","outer title-state").attr("x",-c/2-a).attr("y",-p/2-a).attr("width",c+t.padding).attr("height",p+t.padding),I(t,s),t.intersect=function(m){return C.rect(t,m)},r},"class_box")},lt={},Jt=h(async(e,t,a)=>{let n,r;if(t.link){let s;z().securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),n=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s),r=await Gt[t.shape](n,t,a)}else r=await Gt[t.shape](e,t,a),n=r;return t.tooltip&&r.attr("title",t.tooltip),t.class&&r.attr("class","node default "+t.class),lt[t.id]=n,t.haveCallback&<[t.id].attr("class",lt[t.id].attr("class")+" clickable"),n},"insertNode"),kr=h(e=>{const t=lt[e.id];w.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const a=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+a-e.width/2)+", "+(e.y-e.height/2-8)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),a},"positionNode");function Lt(e,t,a=!1){var x,f,_;const n=e;let r="default";(((x=n==null?void 0:n.classes)==null?void 0:x.length)||0)>0&&(r=((n==null?void 0:n.classes)??[]).join(" ")),r+=" flowchart-label";let s,i=0,o="";switch(n.type){case"round":i=5,o="rect";break;case"composite":i=0,o="composite",s=0;break;case"square":case"group":default:o="rect";break;case"diamond":o="question";break;case"hexagon":o="hexagon";break;case"block_arrow":o="block_arrow";break;case"odd":case"rect_left_inv_arrow":o="rect_left_inv_arrow";break;case"lean_right":o="lean_right";break;case"lean_left":o="lean_left";break;case"trapezoid":o="trapezoid";break;case"inv_trapezoid":o="inv_trapezoid";break;case"circle":o="circle";break;case"ellipse":o="ellipse";break;case"stadium":o="stadium";break;case"subroutine":o="subroutine";break;case"cylinder":o="cylinder";break;case"doublecircle":o="doublecircle"}const c=ye((n==null?void 0:n.styles)??[]),p=n.label,y=n.size??{width:0,height:0,x:0,y:0};return{labelStyle:c.labelStyle,shape:o,labelText:p,rx:i,ry:i,class:r,style:c.style,id:n.id,directions:n.directions,width:y.width,height:y.height,x:y.x,y:y.y,positioned:a,intersect:void 0,type:n.type,padding:s??((_=(f=V())==null?void 0:f.block)==null?void 0:_.padding)??0}}async function Vt(e,t,a){const n=Lt(t,0,!1);if(n.type==="group")return;const r=V(),s=await Jt(e,n,{config:r}),i=s.node().getBBox(),o=a.getBlock(n.id);o.size={width:i.width,height:i.height,x:0,y:0,node:s},a.setBlock(o),s.remove()}async function Qt(e,t,a){const n=Lt(t,0,!0);if(a.getBlock(n.id).type!=="space"){const r=V();await Jt(e,n,{config:r}),t.intersect=n==null?void 0:n.intersect,kr(n)}}async function ct(e,t,a,n){for(const r of t)await n(e,r,a),r.children&&await ct(e,r.children,a,n)}async function te(e,t,a){await ct(e,t,a,Vt)}async function ee(e,t,a){await ct(e,t,a,Qt)}async function re(e,t,a,n,r){const s=new ue({multigraph:!0,compound:!0});s.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const i of a)i.size&&s.setNode(i.id,{width:i.size.width,height:i.size.height,intersect:i.intersect});for(const i of t)if(i.start&&i.end){const o=n.getBlock(i.start),c=n.getBlock(i.end);if(o!=null&&o.size&&(c!=null&&c.size)){const p=o.size,y=c.size,x=[{x:p.x,y:p.y},{x:p.x+(y.x-p.x)/2,y:p.y+(y.y-p.y)/2},{x:y.x,y:y.y}];qe(e,{v:i.start,w:i.end,name:i.id},{...i,arrowTypeEnd:i.arrowTypeEnd,arrowTypeStart:i.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",s,r),i.label&&(await He(e,{...i,label:i.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:i.arrowTypeEnd,arrowTypeStart:i.arrowTypeStart,points:x,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),Ue({...i,x:x[1].x,y:x[1].y},{originalPath:x}))}}}h(Lt,"getNodeFromBlock"),h(Vt,"calculateBlockSize"),h(Qt,"insertBlockPositioned"),h(ct,"performOperations"),h(te,"calculateBlockSizes"),h(ee,"insertBlocks"),h(re,"insertEdges");var Lr=h(function(e,t){return t.db.getClasses()},"getClasses"),Sr={parser:me,db:Oe,renderer:{draw:h(async function(e,t,a,n){const{securityLevel:r,block:s}=V(),i=n.db;let o;r==="sandbox"&&(o=R("#i"+t));const c=R(r==="sandbox"?o.nodes()[0].contentDocument.body:"body"),p=r==="sandbox"?c.select(`[id="${t}"]`):R(`[id="${t}"]`);Ye(p,["point","circle","cross"],n.type,t);const y=i.getBlocks(),x=i.getBlocksFlat(),f=i.getEdges(),_=p.insert("g").attr("class","block");await te(_,y,i);const L=At(i);if(await ee(_,y,i),await re(_,f,x,i,t),L){const E=L,D=Math.max(1,Math.round(E.width/E.height*.125)),N=E.height+D+10,v=E.width+10,{useMaxWidth:d}=s;ie(p,N,v,!!d),w.debug("Here Bounds",L,E),p.attr("viewBox",`${E.x-5} ${E.y-5} ${E.width+10} ${E.height+10}`)}},"draw"),getClasses:Lr},styles:Ae};export{Sr as diagram}; diff --git a/notebooks/assets/brainfuck-CtZaYBKt.js b/notebooks/assets/brainfuck-CtZaYBKt.js new file mode 100644 index 0000000000000000000000000000000000000000..e693c70cae966bfb514c5b78f3eaa23b1edccedb --- /dev/null +++ b/notebooks/assets/brainfuck-CtZaYBKt.js @@ -0,0 +1 @@ +var o="><+-.,[]".split("");const m={name:"brainfuck",startState:function(){return{commentLine:!1,left:0,right:0,commentLoop:!1}},token:function(n,t){if(n.eatSpace())return null;n.sol()&&(t.commentLine=!1);var e=n.next().toString();return o.indexOf(e)===-1?(t.commentLine=!0,n.eol()&&(t.commentLine=!1),"comment"):t.commentLine===!0?(n.eol()&&(t.commentLine=!1),"comment"):e==="]"||e==="["?(e==="["?t.left++:t.right++,"bracket"):e==="+"||e==="-"?"keyword":e==="<"||e===">"?"atom":e==="."||e===","?"def":void(n.eol()&&(t.commentLine=!1))}};export{m as brainfuck}; diff --git a/notebooks/assets/c4Diagram-VJAJSXHY-Cl2yuyMh.js b/notebooks/assets/c4Diagram-VJAJSXHY-Cl2yuyMh.js new file mode 100644 index 0000000000000000000000000000000000000000..b08d31f30b07dc080ebcd6c8f3d648cce0a83413 --- /dev/null +++ b/notebooks/assets/c4Diagram-VJAJSXHY-Cl2yuyMh.js @@ -0,0 +1,10 @@ +var Ot,Tt;import{g as ke,d as Oe}from"./chunk-D6G4REZN-BESp3t-9.js";import{_ as f,s as Te,g as ve,a as Re,b as De,c as Dt,l as he,d as Ne,e as Pe,f as kt,h as de,i as Be,w as Me,j as Vt,k as ue}from"./mermaid-DwRBzUur.js";import{s as Gt}from"./transform-DetRMEbJ.js";import"./index-DgI7bmFZ.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var Lt=function(){var e=f(function(m,O,x,b){for(x=x||{},b=m.length;b--;x[m[b]]=O);return x},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],a=[1,28],r=[1,63],n=[1,64],i=[1,65],d=[1,66],u=[1,67],p=[1,68],g=[1,69],w=[1,29],v=[1,30],R=[1,31],P=[1,32],X=[1,33],Y=[1,34],H=[1,35],q=[1,36],V=[1,37],G=[1,38],K=[1,39],J=[1,40],Z=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],rt=[1,47],st=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],dt=[1,54],ut=[1,55],pt=[1,56],yt=[1,57],ft=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Wt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],vt=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],E=[1,82],S=[1,83],A=[1,84],C=[1,85],k=[12,14,42],ne=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],xt=[12,33],Qt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],$t={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:f(function(m,O,x,b,T,h,Rt){var y=h.length-1;switch(T){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[y-3]);break;case 19:b.setTitle(h[y].substring(6)),this.$=h[y].substring(6);break;case 20:b.setAccDescription(h[y].substring(15)),this.$=h[y].substring(15);break;case 21:this.$=h[y].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[y].trim(),b.setAccDescription(this.$);break;case 28:h[y].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[y]),this.$=h[y];break;case 29:h[y].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[y]),this.$=h[y];break;case 30:b.addPersonOrSystemBoundary(...h[y]),this.$=h[y];break;case 31:h[y].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[y]),this.$=h[y];break;case 32:b.addDeploymentNode("node",...h[y]),this.$=h[y];break;case 33:b.addDeploymentNode("nodeL",...h[y]),this.$=h[y];break;case 34:b.addDeploymentNode("nodeR",...h[y]),this.$=h[y];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[y]),this.$=h[y];break;case 40:b.addPersonOrSystem("external_person",...h[y]),this.$=h[y];break;case 41:b.addPersonOrSystem("system",...h[y]),this.$=h[y];break;case 42:b.addPersonOrSystem("system_db",...h[y]),this.$=h[y];break;case 43:b.addPersonOrSystem("system_queue",...h[y]),this.$=h[y];break;case 44:b.addPersonOrSystem("external_system",...h[y]),this.$=h[y];break;case 45:b.addPersonOrSystem("external_system_db",...h[y]),this.$=h[y];break;case 46:b.addPersonOrSystem("external_system_queue",...h[y]),this.$=h[y];break;case 47:b.addContainer("container",...h[y]),this.$=h[y];break;case 48:b.addContainer("container_db",...h[y]),this.$=h[y];break;case 49:b.addContainer("container_queue",...h[y]),this.$=h[y];break;case 50:b.addContainer("external_container",...h[y]),this.$=h[y];break;case 51:b.addContainer("external_container_db",...h[y]),this.$=h[y];break;case 52:b.addContainer("external_container_queue",...h[y]),this.$=h[y];break;case 53:b.addComponent("component",...h[y]),this.$=h[y];break;case 54:b.addComponent("component_db",...h[y]),this.$=h[y];break;case 55:b.addComponent("component_queue",...h[y]),this.$=h[y];break;case 56:b.addComponent("external_component",...h[y]),this.$=h[y];break;case 57:b.addComponent("external_component_db",...h[y]),this.$=h[y];break;case 58:b.addComponent("external_component_queue",...h[y]),this.$=h[y];break;case 60:b.addRel("rel",...h[y]),this.$=h[y];break;case 61:b.addRel("birel",...h[y]),this.$=h[y];break;case 62:b.addRel("rel_u",...h[y]),this.$=h[y];break;case 63:b.addRel("rel_d",...h[y]),this.$=h[y];break;case 64:b.addRel("rel_l",...h[y]),this.$=h[y];break;case 65:b.addRel("rel_r",...h[y]),this.$=h[y];break;case 66:b.addRel("rel_b",...h[y]),this.$=h[y];break;case 67:h[y].splice(0,1),b.addRel("rel",...h[y]),this.$=h[y];break;case 68:b.updateElStyle("update_el_style",...h[y]),this.$=h[y];break;case 69:b.updateRelStyle("update_rel_style",...h[y]),this.$=h[y];break;case 70:b.updateLayoutConfig("update_layout_config",...h[y]),this.$=h[y];break;case 71:this.$=[h[y]];break;case 72:h[y].unshift(h[y-1]),this.$=h[y];break;case 73:case 75:this.$=h[y].trim();break;case 74:let Et={};Et[h[y-1].trim()]=h[y].trim(),this.$=Et;break;case 76:this.$=""}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:a,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:r,36:n,37:i,38:d,39:u,40:p,41:g,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt}),e(Ct,[2,14]),e(Wt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(vt,[2,19]),e(vt,[2,20]),{25:[1,78]},{27:[1,79]},e(vt,[2,23]),{35:80,75:81,76:E,77:S,79:A,80:C},{35:86,75:81,76:E,77:S,79:A,80:C},{35:87,75:81,76:E,77:S,79:A,80:C},{35:88,75:81,76:E,77:S,79:A,80:C},{35:89,75:81,76:E,77:S,79:A,80:C},{35:90,75:81,76:E,77:S,79:A,80:C},{35:91,75:81,76:E,77:S,79:A,80:C},{35:92,75:81,76:E,77:S,79:A,80:C},{35:93,75:81,76:E,77:S,79:A,80:C},{35:94,75:81,76:E,77:S,79:A,80:C},{35:95,75:81,76:E,77:S,79:A,80:C},{35:96,75:81,76:E,77:S,79:A,80:C},{35:97,75:81,76:E,77:S,79:A,80:C},{35:98,75:81,76:E,77:S,79:A,80:C},{35:99,75:81,76:E,77:S,79:A,80:C},{35:100,75:81,76:E,77:S,79:A,80:C},{35:101,75:81,76:E,77:S,79:A,80:C},{35:102,75:81,76:E,77:S,79:A,80:C},{35:103,75:81,76:E,77:S,79:A,80:C},{35:104,75:81,76:E,77:S,79:A,80:C},e(k,[2,59]),{35:105,75:81,76:E,77:S,79:A,80:C},{35:106,75:81,76:E,77:S,79:A,80:C},{35:107,75:81,76:E,77:S,79:A,80:C},{35:108,75:81,76:E,77:S,79:A,80:C},{35:109,75:81,76:E,77:S,79:A,80:C},{35:110,75:81,76:E,77:S,79:A,80:C},{35:111,75:81,76:E,77:S,79:A,80:C},{35:112,75:81,76:E,77:S,79:A,80:C},{35:113,75:81,76:E,77:S,79:A,80:C},{35:114,75:81,76:E,77:S,79:A,80:C},{35:115,75:81,76:E,77:S,79:A,80:C},{20:116,29:49,30:61,32:62,34:r,36:n,37:i,38:d,39:u,40:p,41:g,43:23,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:E,77:S,79:A,80:C},{35:120,75:81,76:E,77:S,79:A,80:C},{35:121,75:81,76:E,77:S,79:A,80:C},{35:122,75:81,76:E,77:S,79:A,80:C},{35:123,75:81,76:E,77:S,79:A,80:C},{35:124,75:81,76:E,77:S,79:A,80:C},{35:125,75:81,76:E,77:S,79:A,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Wt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:a}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:a,34:r,36:n,37:i,38:d,39:u,40:p,41:g,44:w,45:v,46:R,47:P,48:X,49:Y,50:H,51:q,52:V,53:G,54:K,55:J,56:Z,57:tt,58:et,59:at,60:it,61:nt,62:rt,63:st,64:lt,65:ot,66:ct,67:ht,68:dt,69:ut,70:pt,71:yt,72:ft,73:gt,74:bt}),e(vt,[2,21]),e(vt,[2,22]),e(k,[2,39]),e(ne,[2,71],{75:81,35:132,76:E,77:S,79:A,80:C}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(k,[2,40]),e(k,[2,41]),e(k,[2,42]),e(k,[2,43]),e(k,[2,44]),e(k,[2,45]),e(k,[2,46]),e(k,[2,47]),e(k,[2,48]),e(k,[2,49]),e(k,[2,50]),e(k,[2,51]),e(k,[2,52]),e(k,[2,53]),e(k,[2,54]),e(k,[2,55]),e(k,[2,56]),e(k,[2,57]),e(k,[2,58]),e(k,[2,60]),e(k,[2,61]),e(k,[2,62]),e(k,[2,63]),e(k,[2,64]),e(k,[2,65]),e(k,[2,66]),e(k,[2,67]),e(k,[2,68]),e(k,[2,69]),e(k,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(xt,[2,28]),e(xt,[2,29]),e(xt,[2,30]),e(xt,[2,31]),e(xt,[2,32]),e(xt,[2,33]),e(xt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Wt,[2,18]),e(Ct,[2,38]),e(ne,[2,72]),e(Bt,[2,74]),e(k,[2,24]),e(k,[2,35]),e(Qt,[2,25]),e(Qt,[2,26],{12:[1,138]}),e(Qt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:f(function(m,O){if(!O.recoverable){var x=new Error(m);throw x.hash=O,x}this.trace(m)},"parseError"),parse:f(function(m){var O=this,x=[0],b=[],T=[null],h=[],Rt=this.table,y="",Et=0,re=0,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),St={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(St.yy[Ht]=this.yy[Ht]);D.setInput(m,St.yy),St.yy.lexer=D,St.yy.parser=this,D.yylloc===void 0&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;function se(){var j;return typeof(j=b.pop()||D.lex()||1)!="number"&&(j instanceof Array&&(j=(b=j).pop()),j=O.symbols_[j]||j),j}typeof St.yy.parseError=="function"?this.parseError=St.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,f(function(j){x.length=x.length-2*j,T.length=T.length-j,h.length=h.length-j},"popStack"),f(se,"lex");for(var B,At,M,le,jt,Q,oe,It,wt={};;){if(At=x[x.length-1],this.defaultActions[At]?M=this.defaultActions[At]:(B==null&&(B=se()),M=Rt[At]&&Rt[At][B]),M===void 0||!M.length||!M[0]){var ce="";for(jt in It=[],Rt[At])this.terminals_[jt]&&jt>2&&It.push("'"+this.terminals_[jt]+"'");ce=D.showPosition?"Parse error on line "+(Et+1)+`: +`+D.showPosition()+` +Expecting `+It.join(", ")+", got '"+(this.terminals_[B]||B)+"'":"Parse error on line "+(Et+1)+": Unexpected "+(B==1?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(ce,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:qt,expected:It})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+At+", token: "+B);switch(M[0]){case 1:x.push(B),T.push(D.yytext),h.push(D.yylloc),x.push(M[1]),B=null,re=D.yyleng,y=D.yytext,Et=D.yylineno,qt=D.yylloc;break;case 2:if(Q=this.productions_[M[1]][1],wt.$=T[T.length-Q],wt._$={first_line:h[h.length-(Q||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(Q||1)].first_column,last_column:h[h.length-1].last_column},we&&(wt._$.range=[h[h.length-(Q||1)].range[0],h[h.length-1].range[1]]),(le=this.performAction.apply(wt,[y,re,Et,St.yy,M[1],T,h].concat(Ce)))!==void 0)return le;Q&&(x=x.slice(0,-1*Q*2),T=T.slice(0,-1*Q),h=h.slice(0,-1*Q)),x.push(this.productions_[M[1]][0]),T.push(wt.$),h.push(wt._$),oe=Rt[x[x.length-2]][x[x.length-1]],x.push(oe);break;case 3:return!0}}return!0},"parse")},Ae=function(){return{EOF:1,parseError:f(function(m,O){if(!this.yy.parser)throw new Error(m);this.yy.parser.parseError(m,O)},"parseError"),setInput:f(function(m,O){return this.yy=O||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var m=this._input[0];return this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m,m.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:f(function(m){var O=m.length,x=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-O),this.offset-=O;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var T=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===b.length?this.yylloc.first_column:0)+b[b.length-x.length].length-x[0].length:this.yylloc.first_column-O},this.options.ranges&&(this.yylloc.range=[T[0],T[0]+this.yyleng-O]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:f(function(m){this.unput(this.match.slice(m))},"less"),pastInput:f(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var m=this.pastInput(),O=new Array(m.length+1).join("-");return m+this.upcomingInput()+` +`+O+"^"},"showPosition"),test_match:f(function(m,O){var x,b,T;if(this.options.backtrack_lexer&&(T={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(T.yylloc.range=this.yylloc.range.slice(0))),(b=m[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=b.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:b?b[b.length-1].length-b[b.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(m[0].length),this.matched+=m[0],x=this.performAction.call(this,this.yy,this,O,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),x)return x;if(this._backtrack){for(var h in T)this[h]=T[h];return!1}return!1},"test_match"),next:f(function(){if(this.done)return this.EOF;var m,O,x,b;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var T=this._currentRules(),h=0;hO[0].length)){if(O=x,b=h,this.options.backtrack_lexer){if((m=this.test_match(x,T[h]))!==!1)return m;if(this._backtrack){O=!1;continue}return!1}if(!this.options.flex)break}return O?(m=this.test_match(O,T[b]))!==!1&&m:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:f(function(){var m=this.next();return m||this.lex()},"lex"),begin:f(function(m){this.conditionStack.push(m)},"begin"),popState:f(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:f(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:f(function(m){return(m=this.conditionStack.length-1-Math.abs(m||0))>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:f(function(m){this.begin(m)},"pushState"),stateStackSize:f(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:f(function(m,O,x,b){switch(x){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 73:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 16:case 70:break;case 14:c;break;case 15:return 12;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:case 53:return this.begin("rel_u"),66;case 54:case 55:return this.begin("rel_d"),67;case 56:case 57:return this.begin("rel_l"),68;case 58:case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:case 79:this.popState(),this.popState();break;case 69:case 71:return 80;case 72:this.begin("string");break;case 74:case 80:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}}}();function Mt(){this.yy={}}return $t.lexer=Ae,f(Mt,"Parser"),Mt.prototype=$t,$t.Parser=Mt,new Mt}();Lt.parser=Lt;var pe,je=Lt,U=[],mt=[""],N="global",F="",z=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Nt=[],Kt="",Jt=!1,Yt=4,Ut=2,Ie=f(function(){return pe},"getC4Type"),Le=f(function(e){pe=de(e,Dt())},"setC4Type"),Ye=f(function(e,t,s,o,l,a,r,n,i){if(e==null||t==null||s==null||o==null)return;let d={};const u=Nt.find(p=>p.from===t&&p.to===s);if(u?d=u:Nt.push(d),d.type=e,d.from=t,d.to=s,d.label={text:o},l==null)d.techn={text:""};else if(typeof l=="object"){let[p,g]=Object.entries(l)[0];d[p]={text:g}}else d.techn={text:l};if(a==null)d.descr={text:""};else if(typeof a=="object"){let[p,g]=Object.entries(a)[0];d[p]={text:g}}else d.descr={text:a};if(typeof r=="object"){let[p,g]=Object.entries(r)[0];d[p]=g}else d.sprite=r;if(typeof n=="object"){let[p,g]=Object.entries(n)[0];d[p]=g}else d.tags=n;if(typeof i=="object"){let[p,g]=Object.entries(i)[0];d[p]=g}else d.link=i;d.wrap=_t()},"addRel"),Ue=f(function(e,t,s,o,l,a,r){if(t===null||s===null)return;let n={};const i=U.find(d=>d.alias===t);if(i&&t===i.alias?n=i:(n.alias=t,U.push(n)),n.label=s==null?{text:""}:{text:s},o==null)n.descr={text:""};else if(typeof o=="object"){let[d,u]=Object.entries(o)[0];n[d]={text:u}}else n.descr={text:o};if(typeof l=="object"){let[d,u]=Object.entries(l)[0];n[d]=u}else n.sprite=l;if(typeof a=="object"){let[d,u]=Object.entries(a)[0];n[d]=u}else n.tags=a;if(typeof r=="object"){let[d,u]=Object.entries(r)[0];n[d]=u}else n.link=r;n.typeC4Shape={text:e},n.parentBoundary=N,n.wrap=_t()},"addPersonOrSystem"),Fe=f(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const d=U.find(u=>u.alias===t);if(d&&t===d.alias?i=d:(i.alias=t,U.push(i)),i.label=s==null?{text:""}:{text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[u,p]=Object.entries(o)[0];i[u]={text:p}}else i.techn={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[u,p]=Object.entries(l)[0];i[u]={text:p}}else i.descr={text:l};if(typeof a=="object"){let[u,p]=Object.entries(a)[0];i[u]=p}else i.sprite=a;if(typeof r=="object"){let[u,p]=Object.entries(r)[0];i[u]=p}else i.tags=r;if(typeof n=="object"){let[u,p]=Object.entries(n)[0];i[u]=p}else i.link=n;i.wrap=_t(),i.typeC4Shape={text:e},i.parentBoundary=N},"addContainer"),Xe=f(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const d=U.find(u=>u.alias===t);if(d&&t===d.alias?i=d:(i.alias=t,U.push(i)),i.label=s==null?{text:""}:{text:s},o==null)i.techn={text:""};else if(typeof o=="object"){let[u,p]=Object.entries(o)[0];i[u]={text:p}}else i.techn={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[u,p]=Object.entries(l)[0];i[u]={text:p}}else i.descr={text:l};if(typeof a=="object"){let[u,p]=Object.entries(a)[0];i[u]=p}else i.sprite=a;if(typeof r=="object"){let[u,p]=Object.entries(r)[0];i[u]=p}else i.tags=r;if(typeof n=="object"){let[u,p]=Object.entries(n)[0];i[u]=p}else i.link=n;i.wrap=_t(),i.typeC4Shape={text:e},i.parentBoundary=N},"addComponent"),ze=f(function(e,t,s,o,l){if(e===null||t===null)return;let a={};const r=z.find(n=>n.alias===e);if(r&&e===r.alias?a=r:(a.alias=e,z.push(a)),a.label=t==null?{text:""}:{text:t},s==null)a.type={text:"system"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];a[n]={text:i}}else a.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];a[n]=i}else a.tags=o;if(typeof l=="object"){let[n,i]=Object.entries(l)[0];a[n]=i}else a.link=l;a.parentBoundary=N,a.wrap=_t(),F=N,N=e,mt.push(F)},"addPersonOrSystemBoundary"),We=f(function(e,t,s,o,l){if(e===null||t===null)return;let a={};const r=z.find(n=>n.alias===e);if(r&&e===r.alias?a=r:(a.alias=e,z.push(a)),a.label=t==null?{text:""}:{text:t},s==null)a.type={text:"container"};else if(typeof s=="object"){let[n,i]=Object.entries(s)[0];a[n]={text:i}}else a.type={text:s};if(typeof o=="object"){let[n,i]=Object.entries(o)[0];a[n]=i}else a.tags=o;if(typeof l=="object"){let[n,i]=Object.entries(l)[0];a[n]=i}else a.link=l;a.parentBoundary=N,a.wrap=_t(),F=N,N=e,mt.push(F)},"addContainerBoundary"),Qe=f(function(e,t,s,o,l,a,r,n){if(t===null||s===null)return;let i={};const d=z.find(u=>u.alias===t);if(d&&t===d.alias?i=d:(i.alias=t,z.push(i)),i.label=s==null?{text:""}:{text:s},o==null)i.type={text:"node"};else if(typeof o=="object"){let[u,p]=Object.entries(o)[0];i[u]={text:p}}else i.type={text:o};if(l==null)i.descr={text:""};else if(typeof l=="object"){let[u,p]=Object.entries(l)[0];i[u]={text:p}}else i.descr={text:l};if(typeof r=="object"){let[u,p]=Object.entries(r)[0];i[u]=p}else i.tags=r;if(typeof n=="object"){let[u,p]=Object.entries(n)[0];i[u]=p}else i.link=n;i.nodeType=e,i.parentBoundary=N,i.wrap=_t(),F=N,N=t,mt.push(F)},"addDeploymentNode"),$e=f(function(){N=F,mt.pop(),F=mt.pop(),mt.push(F)},"popBoundaryParseStack"),He=f(function(e,t,s,o,l,a,r,n,i,d,u){let p=U.find(g=>g.alias===t);if(p!==void 0||(p=z.find(g=>g.alias===t),p!==void 0)){if(s!=null)if(typeof s=="object"){let[g,w]=Object.entries(s)[0];p[g]=w}else p.bgColor=s;if(o!=null)if(typeof o=="object"){let[g,w]=Object.entries(o)[0];p[g]=w}else p.fontColor=o;if(l!=null)if(typeof l=="object"){let[g,w]=Object.entries(l)[0];p[g]=w}else p.borderColor=l;if(a!=null)if(typeof a=="object"){let[g,w]=Object.entries(a)[0];p[g]=w}else p.shadowing=a;if(r!=null)if(typeof r=="object"){let[g,w]=Object.entries(r)[0];p[g]=w}else p.shape=r;if(n!=null)if(typeof n=="object"){let[g,w]=Object.entries(n)[0];p[g]=w}else p.sprite=n;if(i!=null)if(typeof i=="object"){let[g,w]=Object.entries(i)[0];p[g]=w}else p.techn=i;if(d!=null)if(typeof d=="object"){let[g,w]=Object.entries(d)[0];p[g]=w}else p.legendText=d;if(u!=null)if(typeof u=="object"){let[g,w]=Object.entries(u)[0];p[g]=w}else p.legendSprite=u}},"updateElStyle"),qe=f(function(e,t,s,o,l,a,r){const n=Nt.find(i=>i.from===t&&i.to===s);if(n!==void 0){if(o!=null)if(typeof o=="object"){let[i,d]=Object.entries(o)[0];n[i]=d}else n.textColor=o;if(l!=null)if(typeof l=="object"){let[i,d]=Object.entries(l)[0];n[i]=d}else n.lineColor=l;if(a!=null)if(typeof a=="object"){let[i,d]=Object.entries(a)[0];n[i]=parseInt(d)}else n.offsetX=parseInt(a);if(r!=null)if(typeof r=="object"){let[i,d]=Object.entries(r)[0];n[i]=parseInt(d)}else n.offsetY=parseInt(r)}},"updateRelStyle"),Ve=f(function(e,t,s){let o=Yt,l=Ut;if(typeof t=="object"){const a=Object.values(t)[0];o=parseInt(a)}else o=parseInt(t);if(typeof s=="object"){const a=Object.values(s)[0];l=parseInt(a)}else l=parseInt(s);o>=1&&(Yt=o),l>=1&&(Ut=l)},"updateLayoutConfig"),Ge=f(function(){return Yt},"getC4ShapeInRow"),Ke=f(function(){return Ut},"getC4BoundaryInRow"),Je=f(function(){return N},"getCurrentBoundaryParse"),Ze=f(function(){return F},"getParentBoundaryParse"),ye=f(function(e){return e==null?U:U.filter(t=>t.parentBoundary===e)},"getC4ShapeArray"),t0=f(function(e){return U.find(t=>t.alias===e)},"getC4Shape"),e0=f(function(e){return Object.keys(ye(e))},"getC4ShapeKeys"),fe=f(function(e){return e==null?z:z.filter(t=>t.parentBoundary===e)},"getBoundaries"),a0=fe,i0=f(function(){return Nt},"getRels"),n0=f(function(){return Kt},"getTitle"),r0=f(function(e){Jt=e},"setWrap"),_t=f(function(){return Jt},"autoWrap"),s0=f(function(){U=[],z=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],F="",N="global",mt=[""],Nt=[],mt=[""],Kt="",Jt=!1,Yt=4,Ut=2},"clear"),l0=f(function(e){Kt=de(e,Dt())},"setTitle"),Zt={addPersonOrSystem:Ue,addPersonOrSystemBoundary:ze,addContainer:Fe,addContainerBoundary:We,addComponent:Xe,addDeploymentNode:Qe,popBoundaryParseStack:$e,addRel:Ye,updateElStyle:He,updateRelStyle:qe,updateLayoutConfig:Ve,autoWrap:_t,setWrap:r0,getC4ShapeArray:ye,getC4Shape:t0,getC4ShapeKeys:e0,getBoundaries:fe,getBoundarys:a0,getCurrentBoundaryParse:Je,getParentBoundaryParse:Ze,getRels:i0,getTitle:n0,getC4Type:Ie,getC4ShapeInRow:Ge,getC4BoundaryInRow:Ke,setAccTitle:De,getAccTitle:Re,getAccDescription:ve,setAccDescription:Te,getConfig:f(()=>Dt().c4,"getConfig"),clear:s0,LINETYPE:{SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},setTitle:l0,setC4Type:Le},te=f(function(e,t){return Oe(e,t)},"drawRect"),ge=f(function(e,t,s,o,l,a){const r=e.append("image");r.attr("width",t),r.attr("height",s),r.attr("x",o),r.attr("y",l);let n=a.startsWith("data:image/png;base64")?a:Be.sanitizeUrl(a);r.attr("xlink:href",n)},"drawImage"),o0=f((e,t,s)=>{const o=e.append("g");let l=0;for(let a of t){let r=a.textColor?a.textColor:"#444444",n=a.lineColor?a.lineColor:"#444444",i=a.offsetX?parseInt(a.offsetX):0,d=a.offsetY?parseInt(a.offsetY):0,u="";if(l===0){let g=o.append("line");g.attr("x1",a.startPoint.x),g.attr("y1",a.startPoint.y),g.attr("x2",a.endPoint.x),g.attr("y2",a.endPoint.y),g.attr("stroke-width","1"),g.attr("stroke",n),g.style("fill","none"),a.type!=="rel_b"&&g.attr("marker-end","url("+u+"#arrowhead)"),a.type!=="birel"&&a.type!=="rel_b"||g.attr("marker-start","url("+u+"#arrowend)"),l=-1}else{let g=o.append("path");g.attr("fill","none").attr("stroke-width","1").attr("stroke",n).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),a.type!=="rel_b"&&g.attr("marker-end","url("+u+"#arrowhead)"),a.type!=="birel"&&a.type!=="rel_b"||g.attr("marker-start","url("+u+"#arrowend)")}let p=s.messageFont();$(s)(a.label.text,o,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+i,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+d,a.label.width,a.label.height,{fill:r},p),a.techn&&a.techn.text!==""&&(p=s.messageFont(),$(s)("["+a.techn.text+"]",o,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+i,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+s.messageFontSize+5+d,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:r,"font-style":"italic"},p))}},"drawRels"),c0=f(function(e,t,s){const o=e.append("g");let l=t.bgColor?t.bgColor:"none",a=t.borderColor?t.borderColor:"#444444",r=t.fontColor?t.fontColor:"black",n={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(n={"stroke-width":1});let i={x:t.x,y:t.y,fill:l,stroke:a,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:n};te(o,i);let d=s.boundaryFont();d.fontWeight="bold",d.fontSize=d.fontSize+2,d.fontColor=r,$(s)(t.label.text,o,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},d),t.type&&t.type.text!==""&&(d=s.boundaryFont(),d.fontColor=r,$(s)(t.type.text,o,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},d)),t.descr&&t.descr.text!==""&&(d=s.boundaryFont(),d.fontSize=d.fontSize-2,d.fontColor=r,$(s)(t.descr.text,o,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},d))},"drawBoundary"),h0=f(function(e,t,s){var p;let o=t.bgColor?t.bgColor:s[t.typeC4Shape.text+"_bg_color"],l=t.borderColor?t.borderColor:s[t.typeC4Shape.text+"_border_color"],a=t.fontColor?t.fontColor:"#FFFFFF",r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="}const n=e.append("g");n.attr("class","person-man");const i=ke();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":i.x=t.x,i.y=t.y,i.fill=o,i.width=t.width,i.height=t.height,i.stroke=l,i.rx=2.5,i.ry=2.5,i.attrs={"stroke-width":.5},te(n,i);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":n.append("path").attr("fill",o).attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),n.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",l).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2))}let d=_0(s,t.typeC4Shape.text);switch(n.append("text").attr("fill",a).attr("font-family",d.fontFamily).attr("font-size",d.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":ge(n,48,48,t.x+t.width/2-24,t.y+t.image.Y,r)}let u=s[t.typeC4Shape.text+"Font"]();return u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=a,$(s)(t.label.text,n,t.x,t.y+t.label.Y,t.width,t.height,{fill:a},u),u=s[t.typeC4Shape.text+"Font"](),u.fontColor=a,t.techn&&((p=t.techn)==null?void 0:p.text)!==""?$(s)(t.techn.text,n,t.x,t.y+t.techn.Y,t.width,t.height,{fill:a,"font-style":"italic"},u):t.type&&t.type.text!==""&&$(s)(t.type.text,n,t.x,t.y+t.type.Y,t.width,t.height,{fill:a,"font-style":"italic"},u),t.descr&&t.descr.text!==""&&(u=s.personFont(),u.fontColor=a,$(s)(t.descr.text,n,t.x,t.y+t.descr.Y,t.width,t.height,{fill:a},u)),t.height},"drawC4Shape"),d0=f(function(e){e.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),u0=f(function(e){e.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),p0=f(function(e){e.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),y0=f(function(e){e.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),f0=f(function(e){e.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),g0=f(function(e){e.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),b0=f(function(e){e.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertDynamicNumber"),m0=f(function(e){const t=e.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);t.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),t.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),_0=f((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"getC4ShapeFont"),$=function(){function e(l,a,r,n,i,d,u){o(a.append("text").attr("x",r+i/2).attr("y",n+d/2+5).style("text-anchor","middle").text(l),u)}function t(l,a,r,n,i,d,u,p){const{fontSize:g,fontFamily:w,fontWeight:v}=p,R=l.split(Vt.lineBreakRegex);for(let P=0;P=this.data.widthLimit||o>=this.data.widthLimit||this.nextData.cnt>be)&&(s=this.nextData.startx+t.margin+_.nextLinePaddingX,l=this.nextData.stopy+2*t.margin,this.nextData.stopx=o=s+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=a=l+t.height,this.nextData.cnt=1),t.x=s,t.y=l,this.updateVal(this.data,"startx",s,Math.min),this.updateVal(this.data,"starty",l,Math.min),this.updateVal(this.data,"stopx",o,Math.max),this.updateVal(this.data,"stopy",a,Math.max),this.updateVal(this.nextData,"startx",s,Math.min),this.updateVal(this.nextData,"starty",l,Math.min),this.updateVal(this.nextData,"stopx",o,Math.max),this.updateVal(this.nextData,"stopy",a,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},ae(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},f(Ot,"Bounds"),Ot),ae=f(function(e){Pe(_,e),e.fontFamily&&(_.personFontFamily=_.systemFontFamily=_.messageFontFamily=e.fontFamily),e.fontSize&&(_.personFontSize=_.systemFontSize=_.messageFontSize=e.fontSize),e.fontWeight&&(_.personFontWeight=_.systemFontWeight=_.messageFontWeight=e.fontWeight)},"setConf"),Pt=f((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"c4ShapeFont"),zt=f(e=>({fontFamily:e.boundaryFontFamily,fontSize:e.boundaryFontSize,fontWeight:e.boundaryFontWeight}),"boundaryFont"),x0=f(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont");function I(e,t,s,o,l){if(!t[e].width)if(s)t[e].text=Me(t[e].text,l,o),t[e].textLines=t[e].text.split(Vt.lineBreakRegex).length,t[e].width=l,t[e].height=ue(t[e].text,o);else{let a=t[e].text.split(Vt.lineBreakRegex);t[e].textLines=a.length;let r=0;t[e].height=0,t[e].width=0;for(const n of a)t[e].width=Math.max(kt(n,o),t[e].width),r=ue(n,o),t[e].height=t[e].height+r}}f(I,"calcC4ShapeTextWH");var _e=f(function(e,t,s){t.x=s.data.startx,t.y=s.data.starty,t.width=s.data.stopx-s.data.startx,t.height=s.data.stopy-s.data.starty,t.label.y=_.c4ShapeMargin-35;let o=t.wrap&&_.wrap,l=zt(_);l.fontSize=l.fontSize+2,l.fontWeight="bold",I("label",t,o,l,kt(t.label.text,l)),W.drawBoundary(e,t,_)},"drawBoundary"),xe=f(function(e,t,s,o){let l=0;for(const a of o){l=0;const r=s[a];let n=Pt(_,r.typeC4Shape.text);switch(n.fontSize=n.fontSize-2,r.typeC4Shape.width=kt("\xAB"+r.typeC4Shape.text+"\xBB",n),r.typeC4Shape.height=n.fontSize+2,r.typeC4Shape.Y=_.c4ShapePadding,l=r.typeC4Shape.Y+r.typeC4Shape.height-4,r.image={width:0,height:0,Y:0},r.typeC4Shape.text){case"person":case"external_person":r.image.width=48,r.image.height=48,r.image.Y=l,l=r.image.Y+r.image.height}r.sprite&&(r.image.width=48,r.image.height=48,r.image.Y=l,l=r.image.Y+r.image.height);let i=r.wrap&&_.wrap,d=_.width-2*_.c4ShapePadding,u=Pt(_,r.typeC4Shape.text);u.fontSize=u.fontSize+2,u.fontWeight="bold",I("label",r,i,u,d),r.label.Y=l+8,l=r.label.Y+r.label.height,r.type&&r.type.text!==""?(r.type.text="["+r.type.text+"]",I("type",r,i,Pt(_,r.typeC4Shape.text),d),r.type.Y=l+5,l=r.type.Y+r.type.height):r.techn&&r.techn.text!==""&&(r.techn.text="["+r.techn.text+"]",I("techn",r,i,Pt(_,r.techn.text),d),r.techn.Y=l+5,l=r.techn.Y+r.techn.height);let p=l,g=r.label.width;r.descr&&r.descr.text!==""&&(I("descr",r,i,Pt(_,r.typeC4Shape.text),d),r.descr.Y=l+20,l=r.descr.Y+r.descr.height,g=Math.max(r.label.width,r.descr.width),p=l-5*r.descr.textLines),g+=_.c4ShapePadding,r.width=Math.max(r.width||_.width,g,_.width),r.height=Math.max(r.height||_.height,p,_.height),r.margin=r.margin||_.c4ShapeMargin,e.insert(r),W.drawC4Shape(t,r,_)}e.bumpLastMargin(_.c4ShapeMargin)},"drawC4ShapeArray"),L=(Tt=class{constructor(t,s){this.x=t,this.y=s}},f(Tt,"Point"),Tt),Ee=f(function(e,t){let s=e.x,o=e.y,l=t.x,a=t.y,r=s+e.width/2,n=o+e.height/2,i=Math.abs(s-l),d=Math.abs(o-a),u=d/i,p=e.height/e.width,g=null;return o==a&&sl?g=new L(s,n):s==l&&oa&&(g=new L(r,o)),s>l&&o=u?new L(s,n+u*e.width/2):new L(r-i/d*e.height/2,o+e.height):s=u?new L(s+e.width,n+u*e.width/2):new L(r+i/d*e.height/2,o+e.height):sa?g=p>=u?new L(s+e.width,n-u*e.width/2):new L(r+e.height/2*i/d,o):s>l&&o>a&&(g=p>=u?new L(s,n-e.width/2*u):new L(r-e.height/2*i/d,o)),g},"getIntersectPoint"),E0=f(function(e,t){let s={x:0,y:0};s.x=t.x+t.width/2,s.y=t.y+t.height/2;let o=Ee(e,s);return s.x=e.x+e.width/2,s.y=e.y+e.height/2,{startPoint:o,endPoint:Ee(t,s)}},"getIntersectPoints"),S0=f(function(e,t,s,o){let l=0;for(let a of t){l+=1;let r=a.wrap&&_.wrap,n=x0(_);o.db.getC4Type()==="C4Dynamic"&&(a.label.text=l+": "+a.label.text);let i=kt(a.label.text,n);I("label",a,r,n,i),a.techn&&a.techn.text!==""&&(i=kt(a.techn.text,n),I("techn",a,r,n,i)),a.descr&&a.descr.text!==""&&(i=kt(a.descr.text,n),I("descr",a,r,n,i));let d=s(a.from),u=s(a.to),p=E0(d,u);a.startPoint=p.startPoint,a.endPoint=p.endPoint}W.drawRels(e,t,_)},"drawRels");function ie(e,t,s,o,l){let a=new me(l);a.data.widthLimit=s.data.widthLimit/Math.min(ee,o.length);for(let[r,n]of o.entries()){let i=0;n.image={width:0,height:0,Y:0},n.sprite&&(n.image.width=48,n.image.height=48,n.image.Y=i,i=n.image.Y+n.image.height);let d=n.wrap&&_.wrap,u=zt(_);if(u.fontSize=u.fontSize+2,u.fontWeight="bold",I("label",n,d,u,a.data.widthLimit),n.label.Y=i+8,i=n.label.Y+n.label.height,n.type&&n.type.text!==""&&(n.type.text="["+n.type.text+"]",I("type",n,d,zt(_),a.data.widthLimit),n.type.Y=i+5,i=n.type.Y+n.type.height),n.descr&&n.descr.text!==""){let v=zt(_);v.fontSize=v.fontSize-2,I("descr",n,d,v,a.data.widthLimit),n.descr.Y=i+20,i=n.descr.Y+n.descr.height}if(r==0||r%ee===0){let v=s.data.startx+_.diagramMarginX,R=s.data.stopy+_.diagramMarginY+i;a.setData(v,v,R,R)}else{let v=a.data.stopx!==a.data.startx?a.data.stopx+_.diagramMarginX:a.data.startx,R=a.data.starty;a.setData(v,v,R,R)}a.name=n.alias;let p=l.db.getC4ShapeArray(n.alias),g=l.db.getC4ShapeKeys(n.alias);g.length>0&&xe(a,e,p,g),t=n.alias;let w=l.db.getBoundarys(t);w.length>0&&ie(e,t,a,w,l),n.alias!=="global"&&_e(e,n,a),s.data.stopy=Math.max(a.data.stopy+_.c4ShapeMargin,s.data.stopy),s.data.stopx=Math.max(a.data.stopx+_.c4ShapeMargin,s.data.stopx),Ft=Math.max(Ft,s.data.stopx),Xt=Math.max(Xt,s.data.stopy)}}f(ie,"drawInsideBoundary");var Se={drawPersonOrSystemArray:xe,drawBoundary:_e,setConf:ae,draw:f(function(e,t,s,o){_=Dt().c4;const l=Dt().securityLevel;let a;l==="sandbox"&&(a=Gt("#i"+t));const r=Gt(l==="sandbox"?a.nodes()[0].contentDocument.body:"body");let n=o.db;o.db.setWrap(_.wrap),be=n.getC4ShapeInRow(),ee=n.getC4BoundaryInRow(),he.debug(`C:${JSON.stringify(_,null,2)}`);const i=l==="sandbox"?r.select(`[id="${t}"]`):Gt(`[id="${t}"]`);W.insertComputerIcon(i),W.insertDatabaseIcon(i),W.insertClockIcon(i);let d=new me(o);d.setData(_.diagramMarginX,_.diagramMarginX,_.diagramMarginY,_.diagramMarginY),d.data.widthLimit=screen.availWidth,Ft=_.diagramMarginX,Xt=_.diagramMarginY;const u=o.db.getTitle();ie(i,"",d,o.db.getBoundarys(""),o),W.insertArrowHead(i),W.insertArrowEnd(i),W.insertArrowCrossHead(i),W.insertArrowFilledHead(i),S0(i,o.db.getRels(),o.db.getC4Shape,o),d.data.stopx=Ft,d.data.stopy=Xt;const p=d.data;let g=p.stopy-p.starty+2*_.diagramMarginY;const w=p.stopx-p.startx+2*_.diagramMarginX;u&&i.append("text").text(u).attr("x",(p.stopx-p.startx)/2-4*_.diagramMarginX).attr("y",p.starty+_.diagramMarginY),Ne(i,g,w,_.useMaxWidth);const v=u?60:0;i.attr("viewBox",p.startx-_.diagramMarginX+" -"+(_.diagramMarginY+v)+" "+w+" "+(g+v)),he.debug("models:",p)},"draw")},A0={parser:je,db:Zt,renderer:Se,styles:f(e=>`.person { + stroke: ${e.personBorder}; + fill: ${e.personBkg}; + } +`,"getStyles"),init:f(({c4:e,wrap:t})=>{Se.setConf(e),Zt.setWrap(t)},"init")};export{A0 as diagram}; diff --git a/notebooks/assets/channel-CWOR9f3f.js b/notebooks/assets/channel-CWOR9f3f.js new file mode 100644 index 0000000000000000000000000000000000000000..51a27ec7abf5d40bd8c3dfc37b10e91f9cc3f3a9 --- /dev/null +++ b/notebooks/assets/channel-CWOR9f3f.js @@ -0,0 +1 @@ +import{U as s,C as o}from"./mermaid-DwRBzUur.js";const n=(a,r)=>s.lang.round(o.parse(a)[r]);export{n as c}; diff --git a/notebooks/assets/chunk-4BMEZGHF-CYzWMCfb.js b/notebooks/assets/chunk-4BMEZGHF-CYzWMCfb.js new file mode 100644 index 0000000000000000000000000000000000000000..06f49ca140b1f7d82d9651298c01094879d4d7a5 --- /dev/null +++ b/notebooks/assets/chunk-4BMEZGHF-CYzWMCfb.js @@ -0,0 +1 @@ +import{_ as l}from"./mermaid-DwRBzUur.js";function s(c,e){var i,a,o;c.accDescr&&((i=e.setAccDescription)==null||i.call(e,c.accDescr)),c.accTitle&&((a=e.setAccTitle)==null||a.call(e,c.accTitle)),c.title&&((o=e.setDiagramTitle)==null||o.call(e,c.title))}l(s,"populateCommonDb");export{s as p}; diff --git a/notebooks/assets/chunk-A2AXSNBT-LRmUxR_u.js b/notebooks/assets/chunk-A2AXSNBT-LRmUxR_u.js new file mode 100644 index 0000000000000000000000000000000000000000..9992ed4762c9ea6e24b4611526757fdb3b52d2ee --- /dev/null +++ b/notebooks/assets/chunk-A2AXSNBT-LRmUxR_u.js @@ -0,0 +1,164 @@ +var P,M;import{g as Ht,s as Vt}from"./chunk-RZ5BOZE2-Dd93pMgt.js";import{_ as A,l as $t,c as F,o as Jt,r as Zt,u as xt,b as te,a as ee,s as se,g as ie,p as ne,q as re,j as $,y as ae,x as ue,h as le,Q as R}from"./mermaid-DwRBzUur.js";import{s as V}from"./transform-DetRMEbJ.js";var It=function(){var s=A(function(o,y,p,r){for(p=p||{},r=o.length;r--;p[o[r]]=y);return p},"o"),i=[1,18],n=[1,19],a=[1,20],u=[1,41],l=[1,42],c=[1,26],d=[1,24],C=[1,25],B=[1,32],pt=[1,33],dt=[1,34],g=[1,45],At=[1,35],yt=[1,36],Ct=[1,37],mt=[1,38],gt=[1,27],bt=[1,28],Et=[1,29],Tt=[1,30],ft=[1,31],b=[1,44],E=[1,46],T=[1,43],k=[1,47],kt=[1,9],h=[1,8,9],J=[1,58],Z=[1,59],tt=[1,60],et=[1,61],st=[1,62],Ft=[1,63],Dt=[1,64],it=[1,8,9,41],Ot=[1,76],v=[1,8,9,12,13,22,39,41,44,66,67,68,69,70,71,72,77,79],nt=[1,8,9,12,13,17,20,22,39,41,44,48,58,66,67,68,69,70,71,72,77,79,84,99,101,102],rt=[13,58,84,99,101,102],G=[13,58,71,72,84,99,101,102],vt=[13,58,66,67,68,69,70,84,99,101,102],Bt=[1,98],U=[1,115],z=[1,107],K=[1,113],Y=[1,108],W=[1,109],j=[1,110],Q=[1,111],X=[1,112],q=[1,114],wt=[22,58,59,80,84,85,86,87,88,89],_t=[1,8,9,39,41,44],at=[1,8,9,22],Rt=[1,143],Pt=[1,8,9,59],N=[1,8,9,22,58,59,80,84,85,86,87,88,89],St={trace:A(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,DOT:17,className:18,classLiteralName:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,CLASS:46,ANNOTATION_START:47,ANNOTATION_END:48,MEMBER:49,SEPARATOR:50,relation:51,NOTE_FOR:52,noteText:53,NOTE:54,CLASSDEF:55,classList:56,stylesOpt:57,ALPHA:58,COMMA:59,direction_tb:60,direction_bt:61,direction_rl:62,direction_lr:63,relationType:64,lineType:65,AGGREGATION:66,EXTENSION:67,COMPOSITION:68,DEPENDENCY:69,LOLLIPOP:70,LINE:71,DOTTED_LINE:72,CALLBACK:73,LINK:74,LINK_TARGET:75,CLICK:76,CALLBACK_NAME:77,CALLBACK_ARGS:78,HREF:79,STYLE:80,CSSCLASS:81,style:82,styleComponent:83,NUM:84,COLON:85,UNIT:86,SPACE:87,BRKT:88,PCT:89,commentToken:90,textToken:91,graphCodeTokens:92,textNoTagsToken:93,TAGSTART:94,TAGEND:95,"==":96,"--":97,DEFAULT:98,MINUS:99,keywords:100,UNICODE_TEXT:101,BQUOTE_STR:102,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",17:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"CLASS",47:"ANNOTATION_START",48:"ANNOTATION_END",49:"MEMBER",50:"SEPARATOR",52:"NOTE_FOR",54:"NOTE",55:"CLASSDEF",58:"ALPHA",59:"COMMA",60:"direction_tb",61:"direction_bt",62:"direction_rl",63:"direction_lr",66:"AGGREGATION",67:"EXTENSION",68:"COMPOSITION",69:"DEPENDENCY",70:"LOLLIPOP",71:"LINE",72:"DOTTED_LINE",73:"CALLBACK",74:"LINK",75:"LINK_TARGET",76:"CLICK",77:"CALLBACK_NAME",78:"CALLBACK_ARGS",79:"HREF",80:"STYLE",81:"CSSCLASS",84:"NUM",85:"COLON",86:"UNIT",87:"SPACE",88:"BRKT",89:"PCT",92:"graphCodeTokens",94:"TAGSTART",95:"TAGEND",96:"==",97:"--",98:"DEFAULT",99:"MINUS",100:"keywords",101:"UNICODE_TEXT",102:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,3],[15,2],[18,1],[18,3],[18,1],[18,2],[18,2],[18,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,6],[43,2],[43,3],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[56,1],[56,3],[32,1],[32,1],[32,1],[32,1],[51,3],[51,2],[51,2],[51,1],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[57,1],[57,3],[82,1],[82,2],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[90,1],[90,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[93,1],[93,1],[93,1],[93,1],[16,1],[16,1],[16,1],[16,1],[19,1],[53,1]],performAction:A(function(o,y,p,r,m,t,H){var e=t.length-1;switch(m){case 8:this.$=t[e-1];break;case 9:case 12:case 14:this.$=t[e];break;case 10:case 13:this.$=t[e-2]+"."+t[e];break;case 11:case 15:case 95:this.$=t[e-1]+t[e];break;case 16:case 17:this.$=t[e-1]+"~"+t[e]+"~";break;case 18:r.addRelation(t[e]);break;case 19:t[e-1].title=r.cleanupLabel(t[e]),r.addRelation(t[e-1]);break;case 30:this.$=t[e].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=t[e].trim(),r.setAccDescription(this.$);break;case 33:r.addClassesToNamespace(t[e-3],t[e-1]);break;case 34:r.addClassesToNamespace(t[e-4],t[e-1]);break;case 35:this.$=t[e],r.addNamespace(t[e]);break;case 36:case 46:case 59:case 92:this.$=[t[e]];break;case 37:this.$=[t[e-1]];break;case 38:t[e].unshift(t[e-2]),this.$=t[e];break;case 40:r.setCssClass(t[e-2],t[e]);break;case 41:r.addMembers(t[e-3],t[e-1]);break;case 42:r.setCssClass(t[e-5],t[e-3]),r.addMembers(t[e-5],t[e-1]);break;case 43:this.$=t[e],r.addClass(t[e]);break;case 44:this.$=t[e-1],r.addClass(t[e-1]),r.setClassLabel(t[e-1],t[e]);break;case 45:r.addAnnotation(t[e],t[e-2]);break;case 47:t[e].push(t[e-1]),this.$=t[e];break;case 48:case 50:case 51:break;case 49:r.addMember(t[e-1],r.cleanupLabel(t[e]));break;case 52:this.$={id1:t[e-2],id2:t[e],relation:t[e-1],relationTitle1:"none",relationTitle2:"none"};break;case 53:this.$={id1:t[e-3],id2:t[e],relation:t[e-1],relationTitle1:t[e-2],relationTitle2:"none"};break;case 54:this.$={id1:t[e-3],id2:t[e],relation:t[e-2],relationTitle1:"none",relationTitle2:t[e-1]};break;case 55:this.$={id1:t[e-4],id2:t[e],relation:t[e-2],relationTitle1:t[e-3],relationTitle2:t[e-1]};break;case 56:r.addNote(t[e],t[e-1]);break;case 57:r.addNote(t[e]);break;case 58:this.$=t[e-2],r.defineClass(t[e-1],t[e]);break;case 60:this.$=t[e-2].concat([t[e]]);break;case 61:r.setDirection("TB");break;case 62:r.setDirection("BT");break;case 63:r.setDirection("RL");break;case 64:r.setDirection("LR");break;case 65:this.$={type1:t[e-2],type2:t[e],lineType:t[e-1]};break;case 66:this.$={type1:"none",type2:t[e],lineType:t[e-1]};break;case 67:this.$={type1:t[e-1],type2:"none",lineType:t[e]};break;case 68:this.$={type1:"none",type2:"none",lineType:t[e]};break;case 69:this.$=r.relationType.AGGREGATION;break;case 70:this.$=r.relationType.EXTENSION;break;case 71:this.$=r.relationType.COMPOSITION;break;case 72:this.$=r.relationType.DEPENDENCY;break;case 73:this.$=r.relationType.LOLLIPOP;break;case 74:this.$=r.lineType.LINE;break;case 75:this.$=r.lineType.DOTTED_LINE;break;case 76:case 82:this.$=t[e-2],r.setClickEvent(t[e-1],t[e]);break;case 77:case 83:this.$=t[e-3],r.setClickEvent(t[e-2],t[e-1]),r.setTooltip(t[e-2],t[e]);break;case 78:this.$=t[e-2],r.setLink(t[e-1],t[e]);break;case 79:this.$=t[e-3],r.setLink(t[e-2],t[e-1],t[e]);break;case 80:this.$=t[e-3],r.setLink(t[e-2],t[e-1]),r.setTooltip(t[e-2],t[e]);break;case 81:this.$=t[e-4],r.setLink(t[e-3],t[e-2],t[e]),r.setTooltip(t[e-3],t[e-1]);break;case 84:this.$=t[e-3],r.setClickEvent(t[e-2],t[e-1],t[e]);break;case 85:this.$=t[e-4],r.setClickEvent(t[e-3],t[e-2],t[e-1]),r.setTooltip(t[e-3],t[e]);break;case 86:this.$=t[e-3],r.setLink(t[e-2],t[e]);break;case 87:this.$=t[e-4],r.setLink(t[e-3],t[e-1],t[e]);break;case 88:this.$=t[e-4],r.setLink(t[e-3],t[e-1]),r.setTooltip(t[e-3],t[e]);break;case 89:this.$=t[e-5],r.setLink(t[e-4],t[e-2],t[e]),r.setTooltip(t[e-4],t[e-1]);break;case 90:this.$=t[e-2],r.setCssStyle(t[e-1],t[e]);break;case 91:r.setCssClass(t[e-1],t[e]);break;case 93:t[e-2].push(t[e]),this.$=t[e-2]}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:n,37:a,38:22,42:u,43:23,46:l,47:c,49:d,50:C,52:B,54:pt,55:dt,58:g,60:At,61:yt,62:Ct,63:mt,73:gt,74:bt,76:Et,80:Tt,81:ft,84:b,99:E,101:T,102:k},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},s(kt,[2,5],{8:[1,48]}),{8:[1,49]},s(h,[2,18],{22:[1,50]}),s(h,[2,20]),s(h,[2,21]),s(h,[2,22]),s(h,[2,23]),s(h,[2,24]),s(h,[2,25]),s(h,[2,26]),s(h,[2,27]),s(h,[2,28]),s(h,[2,29]),{34:[1,51]},{36:[1,52]},s(h,[2,32]),s(h,[2,48],{51:53,64:56,65:57,13:[1,54],22:[1,55],66:J,67:Z,68:tt,69:et,70:st,71:Ft,72:Dt}),{39:[1,65]},s(it,[2,39],{39:[1,67],44:[1,66]}),s(h,[2,50]),s(h,[2,51]),{16:68,58:g,84:b,99:E,101:T},{16:39,18:69,19:40,58:g,84:b,99:E,101:T,102:k},{16:39,18:70,19:40,58:g,84:b,99:E,101:T,102:k},{16:39,18:71,19:40,58:g,84:b,99:E,101:T,102:k},{58:[1,72]},{13:[1,73]},{16:39,18:74,19:40,58:g,84:b,99:E,101:T,102:k},{13:Ot,53:75},{56:77,58:[1,78]},s(h,[2,61]),s(h,[2,62]),s(h,[2,63]),s(h,[2,64]),s(v,[2,12],{16:39,19:40,18:80,17:[1,79],20:[1,81],58:g,84:b,99:E,101:T,102:k}),s(v,[2,14],{20:[1,82]}),{15:83,16:84,58:g,84:b,99:E,101:T},{16:39,18:85,19:40,58:g,84:b,99:E,101:T,102:k},s(nt,[2,118]),s(nt,[2,119]),s(nt,[2,120]),s(nt,[2,121]),s([1,8,9,12,13,20,22,39,41,44,66,67,68,69,70,71,72,77,79],[2,122]),s(kt,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,18:21,38:22,43:23,16:39,19:40,5:86,33:i,35:n,37:a,42:u,46:l,47:c,49:d,50:C,52:B,54:pt,55:dt,58:g,60:At,61:yt,62:Ct,63:mt,73:gt,74:bt,76:Et,80:Tt,81:ft,84:b,99:E,101:T,102:k}),{5:87,10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:n,37:a,38:22,42:u,43:23,46:l,47:c,49:d,50:C,52:B,54:pt,55:dt,58:g,60:At,61:yt,62:Ct,63:mt,73:gt,74:bt,76:Et,80:Tt,81:ft,84:b,99:E,101:T,102:k},s(h,[2,19]),s(h,[2,30]),s(h,[2,31]),{13:[1,89],16:39,18:88,19:40,58:g,84:b,99:E,101:T,102:k},{51:90,64:56,65:57,66:J,67:Z,68:tt,69:et,70:st,71:Ft,72:Dt},s(h,[2,49]),{65:91,71:Ft,72:Dt},s(rt,[2,68],{64:92,66:J,67:Z,68:tt,69:et,70:st}),s(G,[2,69]),s(G,[2,70]),s(G,[2,71]),s(G,[2,72]),s(G,[2,73]),s(vt,[2,74]),s(vt,[2,75]),{8:[1,94],24:95,40:93,43:23,46:l},{16:96,58:g,84:b,99:E,101:T},{45:97,49:Bt},{48:[1,99]},{13:[1,100]},{13:[1,101]},{77:[1,102],79:[1,103]},{22:U,57:104,58:z,80:K,82:105,83:106,84:Y,85:W,86:j,87:Q,88:X,89:q},{58:[1,116]},{13:Ot,53:117},s(h,[2,57]),s(h,[2,123]),{22:U,57:118,58:z,59:[1,119],80:K,82:105,83:106,84:Y,85:W,86:j,87:Q,88:X,89:q},s(wt,[2,59]),{16:39,18:120,19:40,58:g,84:b,99:E,101:T,102:k},s(v,[2,15]),s(v,[2,16]),s(v,[2,17]),{39:[2,35]},{15:122,16:84,17:[1,121],39:[2,9],58:g,84:b,99:E,101:T},s(_t,[2,43],{11:123,12:[1,124]}),s(kt,[2,7]),{9:[1,125]},s(at,[2,52]),{16:39,18:126,19:40,58:g,84:b,99:E,101:T,102:k},{13:[1,128],16:39,18:127,19:40,58:g,84:b,99:E,101:T,102:k},s(rt,[2,67],{64:129,66:J,67:Z,68:tt,69:et,70:st}),s(rt,[2,66]),{41:[1,130]},{24:95,40:131,43:23,46:l},{8:[1,132],41:[2,36]},s(it,[2,40],{39:[1,133]}),{41:[1,134]},{41:[2,46],45:135,49:Bt},{16:39,18:136,19:40,58:g,84:b,99:E,101:T,102:k},s(h,[2,76],{13:[1,137]}),s(h,[2,78],{13:[1,139],75:[1,138]}),s(h,[2,82],{13:[1,140],78:[1,141]}),{13:[1,142]},s(h,[2,90],{59:Rt}),s(Pt,[2,92],{83:144,22:U,58:z,80:K,84:Y,85:W,86:j,87:Q,88:X,89:q}),s(N,[2,94]),s(N,[2,96]),s(N,[2,97]),s(N,[2,98]),s(N,[2,99]),s(N,[2,100]),s(N,[2,101]),s(N,[2,102]),s(N,[2,103]),s(N,[2,104]),s(h,[2,91]),s(h,[2,56]),s(h,[2,58],{59:Rt}),{58:[1,145]},s(v,[2,13]),{15:146,16:84,58:g,84:b,99:E,101:T},{39:[2,11]},s(_t,[2,44]),{13:[1,147]},{1:[2,4]},s(at,[2,54]),s(at,[2,53]),{16:39,18:148,19:40,58:g,84:b,99:E,101:T,102:k},s(rt,[2,65]),s(h,[2,33]),{41:[1,149]},{24:95,40:150,41:[2,37],43:23,46:l},{45:151,49:Bt},s(it,[2,41]),{41:[2,47]},s(h,[2,45]),s(h,[2,77]),s(h,[2,79]),s(h,[2,80],{75:[1,152]}),s(h,[2,83]),s(h,[2,84],{13:[1,153]}),s(h,[2,86],{13:[1,155],75:[1,154]}),{22:U,58:z,80:K,82:156,83:106,84:Y,85:W,86:j,87:Q,88:X,89:q},s(N,[2,95]),s(wt,[2,60]),{39:[2,10]},{14:[1,157]},s(at,[2,55]),s(h,[2,34]),{41:[2,38]},{41:[1,158]},s(h,[2,81]),s(h,[2,85]),s(h,[2,87]),s(h,[2,88],{75:[1,159]}),s(Pt,[2,93],{83:144,22:U,58:z,80:K,84:Y,85:W,86:j,87:Q,88:X,89:q}),s(_t,[2,8]),s(it,[2,42]),s(h,[2,89])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],83:[2,35],122:[2,11],125:[2,4],135:[2,47],146:[2,10],150:[2,38]},parseError:A(function(o,y){if(!y.recoverable){var p=new Error(o);throw p.hash=y,p}this.trace(o)},"parseError"),parse:A(function(o){var y=this,p=[0],r=[],m=[null],t=[],H=this.table,e="",lt=0,Mt=0,Xt=t.slice.call(arguments,1),f=Object.create(this.lexer),x={yy:{}};for(var Nt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Nt)&&(x.yy[Nt]=this.yy[Nt]);f.setInput(o,x.yy),x.yy.lexer=f,x.yy.parser=this,f.yylloc===void 0&&(f.yylloc={});var Lt=f.yylloc;t.push(Lt);var qt=f.options&&f.options.ranges;function Gt(){var S;return typeof(S=r.pop()||f.lex()||1)!="number"&&(S instanceof Array&&(S=(r=S).pop()),S=y.symbols_[S]||S),S}typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,A(function(S){p.length=p.length-2*S,m.length=m.length-S,t.length=t.length-S},"popStack"),A(Gt,"lex");for(var D,I,_,Ut,ot,L,zt,ct,w={};;){if(I=p[p.length-1],this.defaultActions[I]?_=this.defaultActions[I]:(D==null&&(D=Gt()),_=H[I]&&H[I][D]),_===void 0||!_.length||!_[0]){var Kt="";for(ot in ct=[],H[I])this.terminals_[ot]&&ot>2&&ct.push("'"+this.terminals_[ot]+"'");Kt=f.showPosition?"Parse error on line "+(lt+1)+`: +`+f.showPosition()+` +Expecting `+ct.join(", ")+", got '"+(this.terminals_[D]||D)+"'":"Parse error on line "+(lt+1)+": Unexpected "+(D==1?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError(Kt,{text:f.match,token:this.terminals_[D]||D,line:f.yylineno,loc:Lt,expected:ct})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+D);switch(_[0]){case 1:p.push(D),m.push(f.yytext),t.push(f.yylloc),p.push(_[1]),D=null,Mt=f.yyleng,e=f.yytext,lt=f.yylineno,Lt=f.yylloc;break;case 2:if(L=this.productions_[_[1]][1],w.$=m[m.length-L],w._$={first_line:t[t.length-(L||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(L||1)].first_column,last_column:t[t.length-1].last_column},qt&&(w._$.range=[t[t.length-(L||1)].range[0],t[t.length-1].range[1]]),(Ut=this.performAction.apply(w,[e,Mt,lt,x.yy,_[1],m,t].concat(Xt)))!==void 0)return Ut;L&&(p=p.slice(0,-1*L*2),m=m.slice(0,-1*L),t=t.slice(0,-1*L)),p.push(this.productions_[_[1]][0]),m.push(w.$),t.push(w._$),zt=H[p[p.length-2]][p[p.length-1]],p.push(zt);break;case 3:return!0}}return!0},"parse")},Qt=function(){return{EOF:1,parseError:A(function(o,y){if(!this.yy.parser)throw new Error(o);this.yy.parser.parseError(o,y)},"parseError"),setInput:A(function(o,y){return this.yy=y||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:A(function(){var o=this._input[0];return this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o,o.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:A(function(o){var y=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-y),this.offset-=y;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===r.length?this.yylloc.first_column:0)+r[r.length-p.length].length-p[0].length:this.yylloc.first_column-y},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-y]),this.yyleng=this.yytext.length,this},"unput"),more:A(function(){return this._more=!0,this},"more"),reject:A(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:A(function(o){this.unput(this.match.slice(o))},"less"),pastInput:A(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:A(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:A(function(){var o=this.pastInput(),y=new Array(o.length+1).join("-");return o+this.upcomingInput()+` +`+y+"^"},"showPosition"),test_match:A(function(o,y){var p,r,m;if(this.options.backtrack_lexer&&(m={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(m.yylloc.range=this.yylloc.range.slice(0))),(r=o[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+o[0].length},this.yytext+=o[0],this.match+=o[0],this.matches=o,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(o[0].length),this.matched+=o[0],p=this.performAction.call(this,this.yy,this,y,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),p)return p;if(this._backtrack){for(var t in m)this[t]=m[t];return!1}return!1},"test_match"),next:A(function(){if(this.done)return this.EOF;var o,y,p,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),t=0;ty[0].length)){if(y=p,r=t,this.options.backtrack_lexer){if((o=this.test_match(p,m[t]))!==!1)return o;if(this._backtrack){y=!1;continue}return!1}if(!this.options.flex)break}return y?(o=this.test_match(y,m[r]))!==!1&&o:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:A(function(){var o=this.next();return o||this.lex()},"lex"),begin:A(function(o){this.conditionStack.push(o)},"begin"),popState:A(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:A(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:A(function(o){return(o=this.conditionStack.length-1-Math.abs(o||0))>=0?this.conditionStack[o]:"INITIAL"},"topState"),pushState:A(function(o){this.begin(o)},"pushState"),stateStackSize:A(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:A(function(o,y,p,r){switch(p){case 0:return 60;case 1:return 61;case 2:return 62;case 3:return 63;case 4:case 5:case 14:case 31:case 36:case 40:case 47:break;case 6:return this.begin("acc_title"),33;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),35;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 19:case 22:case 24:case 58:case 61:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 35:return 8;case 15:case 16:return 7;case 17:case 37:case 45:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 77;case 23:return 78;case 25:return"STR";case 26:this.begin("string");break;case 27:return 80;case 28:return 55;case 29:return this.begin("namespace"),42;case 30:case 39:return this.popState(),8;case 32:return this.begin("namespace-body"),39;case 33:case 43:return this.popState(),41;case 34:case 44:return"EOF_IN_STRUCT";case 38:return this.begin("class"),46;case 41:return this.popState(),this.popState(),41;case 42:return this.begin("class-body"),39;case 46:return"OPEN_IN_STRUCT";case 48:return"MEMBER";case 49:return 81;case 50:return 73;case 51:return 74;case 52:return 76;case 53:return 52;case 54:return 54;case 55:return 47;case 56:return 48;case 57:return 79;case 59:return"GENERICTYPE";case 60:this.begin("generic");break;case 62:return"BQUOTE_STR";case 63:this.begin("bqstring");break;case 64:case 65:case 66:case 67:return 75;case 68:case 69:return 67;case 70:case 71:return 69;case 72:return 68;case 73:return 66;case 74:return 70;case 75:return 71;case 76:return 72;case 77:return 22;case 78:return 44;case 79:return 99;case 80:return 17;case 81:return"PLUS";case 82:return 85;case 83:return 59;case 84:case 85:return 88;case 86:return 89;case 87:case 88:return"EQUALS";case 89:return 58;case 90:return 12;case 91:return 14;case 92:return"PUNCTUATION";case 93:return 84;case 94:return 101;case 95:case 96:return 87;case 97:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,33,34,35,36,37,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},namespace:{rules:[26,29,30,31,32,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},"class-body":{rules:[26,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},class:{rules:[26,39,40,41,42,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr:{rules:[9,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_title:{rules:[7,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_args:{rules:[22,23,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_name:{rules:[19,20,21,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},href:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},struct:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},generic:{rules:[26,49,50,51,52,53,54,55,56,57,58,59,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},bqstring:{rules:[26,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},string:{rules:[24,25,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],inclusive:!0}}}}();function ut(){this.yy={}}return St.lexer=Qt,A(ut,"Parser"),ut.prototype=St,St.Parser=ut,new ut}();It.parser=It;var oe=It,Yt=["#","+","~","-",""],Wt=(P=class{constructor(i,n){this.memberType=n,this.visibility="",this.classifier="",this.text="";const a=le(i,F());this.parseMember(a)}getDisplayDetails(){let i=this.visibility+R(this.id);return this.memberType==="method"&&(i+=`(${R(this.parameters.trim())})`,this.returnType&&(i+=" : "+R(this.returnType))),i=i.trim(),{displayText:i,cssStyle:this.parseClassifier()}}parseMember(i){let n="";if(this.memberType==="method"){const u=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(i);if(u){const l=u[1]?u[1].trim():"";if(Yt.includes(l)&&(this.visibility=l),this.id=u[2],this.parameters=u[3]?u[3].trim():"",n=u[4]?u[4].trim():"",this.returnType=u[5]?u[5].trim():"",n===""){const c=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(c)&&(n=c,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{const u=i.length,l=i.substring(0,1),c=i.substring(u-1);Yt.includes(l)&&(this.visibility=l),/[$*]/.exec(c)&&(n=c),this.id=i.substring(this.visibility===""?0:1,n===""?u:u-1)}this.classifier=n,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();const a=`${this.visibility?"\\"+this.visibility:""}${R(this.id)}${this.memberType==="method"?`(${R(this.parameters)})${this.returnType?" : "+R(this.returnType):""}`:""}`;this.text=a.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},A(P,"ClassMember"),P),ht="classId-",jt=0,O=A(s=>$.sanitizeText(s,F()),"sanitizeText"),ce=(M=class{constructor(){this.relations=[],this.classes=new Map,this.styleClasses=new Map,this.notes=[],this.interfaces=[],this.namespaces=new Map,this.namespaceCounter=0,this.functions=[],this.lineType={LINE:0,DOTTED_LINE:1},this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},this.setupToolTips=A(i=>{let n=V(".mermaidTooltip");(n._groups||n)[0][0]===null&&(n=V("body").append("div").attr("class","mermaidTooltip").style("opacity",0)),V(i).select("svg").selectAll("g.node").on("mouseover",a=>{const u=V(a.currentTarget);if(u.attr("title")===null)return;const l=this.getBoundingClientRect();n.transition().duration(200).style("opacity",".9"),n.text(u.attr("title")).style("left",window.scrollX+l.left+(l.right-l.left)/2+"px").style("top",window.scrollY+l.top-14+document.body.scrollTop+"px"),n.html(n.html().replace(/<br\/>/g,"
")),u.classed("hover",!0)}).on("mouseout",a=>{n.transition().duration(500).style("opacity",0),V(a.currentTarget).classed("hover",!1)})},"setupToolTips"),this.direction="TB",this.setAccTitle=te,this.getAccTitle=ee,this.setAccDescription=se,this.getAccDescription=ie,this.setDiagramTitle=ne,this.getDiagramTitle=re,this.getConfig=A(()=>F().class,"getConfig"),this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}splitClassNameAndType(i){const n=$.sanitizeText(i,F());let a="",u=n;if(n.indexOf("~")>0){const l=n.split("~");u=O(l[0]),a=O(l[1])}return{className:u,type:a}}setClassLabel(i,n){const a=$.sanitizeText(i,F());n&&(n=O(n));const{className:u}=this.splitClassNameAndType(a);this.classes.get(u).label=n,this.classes.get(u).text=`${n}${this.classes.get(u).type?`<${this.classes.get(u).type}>`:""}`}addClass(i){const n=$.sanitizeText(i,F()),{className:a,type:u}=this.splitClassNameAndType(n);if(this.classes.has(a))return;const l=$.sanitizeText(a,F());this.classes.set(l,{id:l,type:u,label:l,text:`${l}${u?`<${u}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:ht+l+"-"+jt}),jt++}addInterface(i,n){const a={id:`interface${this.interfaces.length}`,label:i,classId:n};this.interfaces.push(a)}lookUpDomId(i){const n=$.sanitizeText(i,F());if(this.classes.has(n))return this.classes.get(n).domId;throw new Error("Class not found: "+n)}clear(){this.relations=[],this.classes=new Map,this.notes=[],this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.direction="TB",ae()}getClass(i){return this.classes.get(i)}getClasses(){return this.classes}getRelations(){return this.relations}getNotes(){return this.notes}addRelation(i){$t.debug("Adding relation: "+JSON.stringify(i));const n=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];i.relation.type1!==this.relationType.LOLLIPOP||n.includes(i.relation.type2)?i.relation.type2!==this.relationType.LOLLIPOP||n.includes(i.relation.type1)?(this.addClass(i.id1),this.addClass(i.id2)):(this.addClass(i.id1),this.addInterface(i.id2,i.id1),i.id2="interface"+(this.interfaces.length-1)):(this.addClass(i.id2),this.addInterface(i.id1,i.id2),i.id1="interface"+(this.interfaces.length-1)),i.id1=this.splitClassNameAndType(i.id1).className,i.id2=this.splitClassNameAndType(i.id2).className,i.relationTitle1=$.sanitizeText(i.relationTitle1.trim(),F()),i.relationTitle2=$.sanitizeText(i.relationTitle2.trim(),F()),this.relations.push(i)}addAnnotation(i,n){const a=this.splitClassNameAndType(i).className;this.classes.get(a).annotations.push(n)}addMember(i,n){this.addClass(i);const a=this.splitClassNameAndType(i).className,u=this.classes.get(a);if(typeof n=="string"){const l=n.trim();l.startsWith("<<")&&l.endsWith(">>")?u.annotations.push(O(l.substring(2,l.length-2))):l.indexOf(")")>0?u.methods.push(new Wt(l,"method")):l&&u.members.push(new Wt(l,"attribute"))}}addMembers(i,n){Array.isArray(n)&&(n.reverse(),n.forEach(a=>this.addMember(i,a)))}addNote(i,n){const a={id:`note${this.notes.length}`,class:n,text:i};this.notes.push(a)}cleanupLabel(i){return i.startsWith(":")&&(i=i.substring(1)),O(i.trim())}setCssClass(i,n){i.split(",").forEach(a=>{let u=a;/\d/.exec(a[0])&&(u=ht+u);const l=this.classes.get(u);l&&(l.cssClasses+=" "+n)})}defineClass(i,n){for(const a of i){let u=this.styleClasses.get(a);u===void 0&&(u={id:a,styles:[],textStyles:[]},this.styleClasses.set(a,u)),n&&n.forEach(l=>{if(/color/.exec(l)){const c=l.replace("fill","bgFill");u.textStyles.push(c)}u.styles.push(l)}),this.classes.forEach(l=>{l.cssClasses.includes(a)&&l.styles.push(...n.flatMap(c=>c.split(",")))})}}setTooltip(i,n){i.split(",").forEach(a=>{n!==void 0&&(this.classes.get(a).tooltip=O(n))})}getTooltip(i,n){return n&&this.namespaces.has(n)?this.namespaces.get(n).classes.get(i).tooltip:this.classes.get(i).tooltip}setLink(i,n,a){const u=F();i.split(",").forEach(l=>{let c=l;/\d/.exec(l[0])&&(c=ht+c);const d=this.classes.get(c);d&&(d.link=xt.formatUrl(n,u),u.securityLevel==="sandbox"?d.linkTarget="_top":d.linkTarget=typeof a=="string"?O(a):"_blank")}),this.setCssClass(i,"clickable")}setClickEvent(i,n,a){i.split(",").forEach(u=>{this.setClickFunc(u,n,a),this.classes.get(u).haveCallback=!0}),this.setCssClass(i,"clickable")}setClickFunc(i,n,a){const u=$.sanitizeText(i,F());if(F().securityLevel!=="loose"||n===void 0)return;const l=u;if(this.classes.has(l)){const c=this.lookUpDomId(l);let d=[];if(typeof a=="string"){d=a.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let C=0;C{const C=document.querySelector(`[id="${c}"]`);C!==null&&C.addEventListener("click",()=>{xt.runFunc(n,...d)},!1)})}}bindFunctions(i){this.functions.forEach(n=>{n(i)})}getDirection(){return this.direction}setDirection(i){this.direction=i}addNamespace(i){this.namespaces.has(i)||(this.namespaces.set(i,{id:i,classes:new Map,children:{},domId:ht+i+"-"+this.namespaceCounter}),this.namespaceCounter++)}getNamespace(i){return this.namespaces.get(i)}getNamespaces(){return this.namespaces}addClassesToNamespace(i,n){if(this.namespaces.has(i))for(const a of n){const{className:u}=this.splitClassNameAndType(a);this.classes.get(u).parent=i,this.namespaces.get(i).classes.set(u,this.classes.get(u))}}setCssStyle(i,n){const a=this.classes.get(i);if(n&&a)for(const u of n)u.includes(",")?a.styles.push(...u.split(",")):a.styles.push(u)}getArrowMarker(i){let n;switch(i){case 0:n="aggregation";break;case 1:n="extension";break;case 2:n="composition";break;case 3:n="dependency";break;case 4:n="lollipop";break;default:n="none"}return n}getData(){var l;const i=[],n=[],a=F();for(const c of this.namespaces.keys()){const d=this.namespaces.get(c);if(d){const C={id:d.id,label:d.id,isGroup:!0,padding:a.class.padding??16,shape:"rect",cssStyles:["fill: none","stroke: black"],look:a.look};i.push(C)}}for(const c of this.classes.keys()){const d=this.classes.get(c);if(d){const C=d;C.parentId=d.parent,C.look=a.look,i.push(C)}}let u=0;for(const c of this.notes){u++;const d={id:c.id,label:c.text,isGroup:!1,shape:"note",padding:a.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${a.themeVariables.noteBkgColor}`,`stroke: ${a.themeVariables.noteBorderColor}`],look:a.look};i.push(d);const C=((l=this.classes.get(c.class))==null?void 0:l.id)??"";if(C){const B={id:`edgeNote${u}`,start:c.id,end:C,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:a.look};n.push(B)}}for(const c of this.interfaces){const d={id:c.id,label:c.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:a.look};i.push(d)}u=0;for(const c of this.relations){u++;const d={id:ue(c.id1,c.id2,{prefix:"id",counter:u}),start:c.id1,end:c.id2,type:"normal",label:c.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(c.relation.type1),arrowTypeEnd:this.getArrowMarker(c.relation.type2),startLabelRight:c.relationTitle1==="none"?"":c.relationTitle1,endLabelLeft:c.relationTitle2==="none"?"":c.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:c.style||"",pattern:c.relation.lineType==1?"dashed":"solid",look:a.look};n.push(d)}return{nodes:i,edges:n,other:{},config:a,direction:this.getDirection()}}},A(M,"ClassDB"),M),he=A(s=>`g.classGroup text { + fill: ${s.nodeBorder||s.classText}; + stroke: none; + font-family: ${s.fontFamily}; + font-size: 10px; + + .title { + font-weight: bolder; + } + +} + +.nodeLabel, .edgeLabel { + color: ${s.classText}; +} +.edgeLabel .label rect { + fill: ${s.mainBkg}; +} +.label text { + fill: ${s.classText}; +} + +.labelBkg { + background: ${s.mainBkg}; +} +.edgeLabel .label span { + background: ${s.mainBkg}; +} + +.classTitle { + font-weight: bolder; +} +.node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; + stroke-width: 1px; + } + + +.divider { + stroke: ${s.nodeBorder}; + stroke-width: 1; +} + +g.clickable { + cursor: pointer; +} + +g.classGroup rect { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; +} + +g.classGroup line { + stroke: ${s.nodeBorder}; + stroke-width: 1; +} + +.classLabel .box { + stroke: none; + stroke-width: 0; + fill: ${s.mainBkg}; + opacity: 0.5; +} + +.classLabel .label { + fill: ${s.nodeBorder}; + font-size: 10px; +} + +.relation { + stroke: ${s.lineColor}; + stroke-width: 1; + fill: none; +} + +.dashed-line{ + stroke-dasharray: 3; +} + +.dotted-line{ + stroke-dasharray: 1 2; +} + +#compositionStart, .composition { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#compositionEnd, .composition { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#extensionStart, .extension { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#extensionEnd, .extension { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#aggregationStart, .aggregation { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#aggregationEnd, .aggregation { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#lollipopStart, .lollipop { + fill: ${s.mainBkg} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#lollipopEnd, .lollipop { + fill: ${s.mainBkg} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +.edgeTerminals { + font-size: 11px; + line-height: initial; +} + +.classTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${s.textColor}; +} +`,"getStyles"),pe=A((s,i="TB")=>{if(!s.doc)return i;let n=i;for(const a of s.doc)a.stmt==="dir"&&(n=a.value);return n},"getDir"),de={getClasses:A(function(s,i){return i.db.getClasses()},"getClasses"),draw:A(async function(s,i,n,a){$t.info("REF0:"),$t.info("Drawing class diagram (v3)",i);const{securityLevel:u,state:l,layout:c}=F(),d=a.db.getData(),C=Ht(i,u);d.type=a.type,d.layoutAlgorithm=Jt(c),d.nodeSpacing=(l==null?void 0:l.nodeSpacing)||50,d.rankSpacing=(l==null?void 0:l.rankSpacing)||50,d.markers=["aggregation","extension","composition","dependency","lollipop"],d.diagramId=i,await Zt(d,C),xt.insertTitle(C,"classDiagramTitleText",(l==null?void 0:l.titleTopMargin)??25,a.db.getDiagramTitle()),Vt(C,8,"classDiagram",(l==null?void 0:l.useMaxWidth)??!0)},"draw"),getDir:pe};export{ce as C,oe as a,de as c,he as s}; diff --git a/notebooks/assets/chunk-AEK57VVT-ClK8FMFn.js b/notebooks/assets/chunk-AEK57VVT-ClK8FMFn.js new file mode 100644 index 0000000000000000000000000000000000000000..b67e8980cf6e2e7ad6c2638c94923016c19fc78f --- /dev/null +++ b/notebooks/assets/chunk-AEK57VVT-ClK8FMFn.js @@ -0,0 +1,220 @@ +var Kt=Object.defineProperty;var qt=(e,t,s)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var k=(e,t,s)=>qt(e,typeof t!="symbol"?t+"":t,s);var M;import{g as Qt,s as Zt}from"./chunk-RZ5BOZE2-Dd93pMgt.js";import{_ as l,l as E,c as $,r as te,u as ee,R as se,j as U,y as ie,a as ne,b as re,g as ae,s as oe,p as ce,q as le}from"./mermaid-DwRBzUur.js";var mt=function(){var e=l(function(r,y,u,f){for(u=u||{},f=r.length;f--;u[r[f]]=y);return u},"o"),t=[1,2],s=[1,3],a=[1,4],o=[2,4],i=[1,9],g=[1,11],d=[1,16],c=[1,17],S=[1,18],b=[1,19],v=[1,32],F=[1,20],P=[1,21],L=[1,22],p=[1,23],I=[1,24],A=[1,26],Y=[1,27],G=[1,28],N=[1,29],R=[1,30],Q=[1,31],Z=[1,34],tt=[1,35],et=[1,36],st=[1,37],V=[1,33],m=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],it=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],Et=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],pt={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,classDef:38,CLASSDEF_ID:39,CLASSDEF_STYLEOPTS:40,DEFAULT:41,style:42,STYLE_IDS:43,STYLEDEF_STYLEOPTS:44,class:45,CLASSENTITY_IDS:46,STYLECLASS:47,direction_tb:48,direction_bt:49,direction_rl:50,direction_lr:51,eol:52,";":53,EDGE_STATE:54,STYLE_SEPARATOR:55,left_of:56,right_of:57,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"classDef",39:"CLASSDEF_ID",40:"CLASSDEF_STYLEOPTS",41:"DEFAULT",42:"style",43:"STYLE_IDS",44:"STYLEDEF_STYLEOPTS",45:"class",46:"CLASSENTITY_IDS",47:"STYLECLASS",48:"direction_tb",49:"direction_bt",50:"direction_rl",51:"direction_lr",53:";",54:"EDGE_STATE",55:"STYLE_SEPARATOR",56:"left_of",57:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[52,1],[52,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:l(function(r,y,u,f,_,n,W){var h=n.length-1;switch(_){case 3:return f.setRootDoc(n[h]),n[h];case 4:this.$=[];break;case 5:n[h]!="nl"&&(n[h-1].push(n[h]),this.$=n[h-1]);break;case 6:case 7:case 12:this.$=n[h];break;case 8:this.$="nl";break;case 13:const T=n[h-1];T.description=f.trimColon(n[h]),this.$=T;break;case 14:this.$={stmt:"relation",state1:n[h-2],state2:n[h]};break;case 15:const w=f.trimColon(n[h]);this.$={stmt:"relation",state1:n[h-3],state2:n[h-1],description:w};break;case 19:this.$={stmt:"state",id:n[h-3],type:"default",description:"",doc:n[h-1]};break;case 20:var j=n[h],X=n[h-2].trim();if(n[h].match(":")){var rt=n[h].split(":");j=rt[0],X=[X,rt[1]]}this.$={stmt:"state",id:j,type:"default",description:X};break;case 21:this.$={stmt:"state",id:n[h-3],type:"default",description:n[h-5],doc:n[h-1]};break;case 22:this.$={stmt:"state",id:n[h],type:"fork"};break;case 23:this.$={stmt:"state",id:n[h],type:"join"};break;case 24:this.$={stmt:"state",id:n[h],type:"choice"};break;case 25:this.$={stmt:"state",id:f.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:n[h-1].trim(),note:{position:n[h-2].trim(),text:n[h].trim()}};break;case 29:this.$=n[h].trim(),f.setAccTitle(this.$);break;case 30:case 31:this.$=n[h].trim(),f.setAccDescription(this.$);break;case 32:case 33:this.$={stmt:"classDef",id:n[h-1].trim(),classes:n[h].trim()};break;case 34:this.$={stmt:"style",id:n[h-1].trim(),styleClass:n[h].trim()};break;case 35:this.$={stmt:"applyClass",id:n[h-1].trim(),styleClass:n[h].trim()};break;case 36:f.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 37:f.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 38:f.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 39:f.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 42:case 43:this.$={stmt:"state",id:n[h].trim(),type:"default",description:""};break;case 44:case 45:this.$={stmt:"state",id:n[h-2].trim(),classes:[n[h].trim()],type:"default",description:""}}},"anonymous"),table:[{3:1,4:t,5:s,6:a},{1:[3]},{3:5,4:t,5:s,6:a},{3:6,4:t,5:s,6:a},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],o,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:i,5:g,8:8,9:10,10:12,11:13,12:14,13:15,16:d,17:c,19:S,22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,5]),{9:38,10:12,11:13,12:14,13:15,16:d,17:c,19:S,22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,7]),e(m,[2,8]),e(m,[2,9]),e(m,[2,10]),e(m,[2,11]),e(m,[2,12],{14:[1,39],15:[1,40]}),e(m,[2,16]),{18:[1,41]},e(m,[2,18],{20:[1,42]}),{23:[1,43]},e(m,[2,22]),e(m,[2,23]),e(m,[2,24]),e(m,[2,25]),{30:44,31:[1,45],56:[1,46],57:[1,47]},e(m,[2,28]),{34:[1,48]},{36:[1,49]},e(m,[2,31]),{39:[1,50],41:[1,51]},{43:[1,52]},{46:[1,53]},e(it,[2,42],{55:[1,54]}),e(it,[2,43],{55:[1,55]}),e(m,[2,36]),e(m,[2,37]),e(m,[2,38]),e(m,[2,39]),e(m,[2,6]),e(m,[2,13]),{13:56,24:v,54:V},e(m,[2,17]),e(Et,o,{7:57}),{24:[1,58]},{24:[1,59]},{23:[1,60]},{24:[2,46]},{24:[2,47]},e(m,[2,29]),e(m,[2,30]),{40:[1,61]},{40:[1,62]},{44:[1,63]},{47:[1,64]},{24:[1,65]},{24:[1,66]},e(m,[2,14],{14:[1,67]}),{4:i,5:g,8:8,9:10,10:12,11:13,12:14,13:15,16:d,17:c,19:S,21:[1,68],22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,20],{20:[1,69]}),{31:[1,70]},{24:[1,71]},e(m,[2,32]),e(m,[2,33]),e(m,[2,34]),e(m,[2,35]),e(it,[2,44]),e(it,[2,45]),e(m,[2,15]),e(m,[2,19]),e(Et,o,{7:72}),e(m,[2,26]),e(m,[2,27]),{4:i,5:g,8:8,9:10,10:12,11:13,12:14,13:15,16:d,17:c,19:S,21:[1,73],22:b,24:v,25:F,26:P,27:L,28:p,29:I,32:25,33:A,35:Y,37:G,38:N,42:R,45:Q,48:Z,49:tt,50:et,51:st,54:V},e(m,[2,21])],defaultActions:{5:[2,1],6:[2,2],46:[2,46],47:[2,47]},parseError:l(function(r,y){if(!y.recoverable){var u=new Error(r);throw u.hash=y,u}this.trace(r)},"parseError"),parse:l(function(r){var y=this,u=[0],f=[],_=[null],n=[],W=this.table,h="",j=0,X=0,rt=n.slice.call(arguments,1),T=Object.create(this.lexer),w={yy:{}};for(var yt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,yt)&&(w.yy[yt]=this.yy[yt]);T.setInput(r,w.yy),w.yy.lexer=T,w.yy.parser=this,T.yylloc===void 0&&(T.yylloc={});var gt=T.yylloc;n.push(gt);var Jt=T.options&&T.options.ranges;function Dt(){var C;return typeof(C=f.pop()||T.lex()||1)!="number"&&(C instanceof Array&&(C=(f=C).pop()),C=y.symbols_[C]||C),C}typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,l(function(C){u.length=u.length-2*C,_.length=_.length-C,n.length=n.length-C},"popStack"),l(Dt,"lex");for(var D,z,x,xt,at,O,Ct,ot,H={};;){if(z=u[u.length-1],this.defaultActions[z]?x=this.defaultActions[z]:(D==null&&(D=Dt()),x=W[z]&&W[z][D]),x===void 0||!x.length||!x[0]){var $t="";for(at in ot=[],W[z])this.terminals_[at]&&at>2&&ot.push("'"+this.terminals_[at]+"'");$t=T.showPosition?"Parse error on line "+(j+1)+`: +`+T.showPosition()+` +Expecting `+ot.join(", ")+", got '"+(this.terminals_[D]||D)+"'":"Parse error on line "+(j+1)+": Unexpected "+(D==1?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError($t,{text:T.match,token:this.terminals_[D]||D,line:T.yylineno,loc:gt,expected:ot})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+z+", token: "+D);switch(x[0]){case 1:u.push(D),_.push(T.yytext),n.push(T.yylloc),u.push(x[1]),D=null,X=T.yyleng,h=T.yytext,j=T.yylineno,gt=T.yylloc;break;case 2:if(O=this.productions_[x[1]][1],H.$=_[_.length-O],H._$={first_line:n[n.length-(O||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(O||1)].first_column,last_column:n[n.length-1].last_column},Jt&&(H._$.range=[n[n.length-(O||1)].range[0],n[n.length-1].range[1]]),(xt=this.performAction.apply(H,[h,X,j,w.yy,x[1],_,n].concat(rt)))!==void 0)return xt;O&&(u=u.slice(0,-1*O*2),_=_.slice(0,-1*O),n=n.slice(0,-1*O)),u.push(this.productions_[x[1]][0]),_.push(H.$),n.push(H._$),Ct=W[u[u.length-2]][u[u.length-1]],u.push(Ct);break;case 3:return!0}}return!0},"parse")},Wt=function(){return{EOF:1,parseError:l(function(r,y){if(!this.yy.parser)throw new Error(r);this.yy.parser.parseError(r,y)},"parseError"),setInput:l(function(r,y){return this.yy=y||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:l(function(r){var y=r.length,u=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-y),this.offset-=y;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===f.length?this.yylloc.first_column:0)+f[f.length-u.length].length-u[0].length:this.yylloc.first_column-y},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-y]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:l(function(r){this.unput(this.match.slice(r))},"less"),pastInput:l(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var r=this.pastInput(),y=new Array(r.length+1).join("-");return r+this.upcomingInput()+` +`+y+"^"},"showPosition"),test_match:l(function(r,y){var u,f,_;if(this.options.backtrack_lexer&&(_={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(_.yylloc.range=this.yylloc.range.slice(0))),(f=r[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],u=this.performAction.call(this,this.yy,this,y,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),u)return u;if(this._backtrack){for(var n in _)this[n]=_[n];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;var r,y,u,f;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var _=this._currentRules(),n=0;n<_.length;n++)if((u=this._input.match(this.rules[_[n]]))&&(!y||u[0].length>y[0].length)){if(y=u,f=n,this.options.backtrack_lexer){if((r=this.test_match(u,_[n]))!==!1)return r;if(this._backtrack){y=!1;continue}return!1}if(!this.options.flex)break}return y?(r=this.test_match(y,_[f]))!==!1&&r:this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var r=this.next();return r||this.lex()},"lex"),begin:l(function(r){this.conditionStack.push(r)},"begin"),popState:l(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:l(function(r){return(r=this.conditionStack.length-1-Math.abs(r||0))>=0?this.conditionStack[r]:"INITIAL"},"topState"),pushState:l(function(r){this.begin(r)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(r,y,u,f){switch(u){case 0:return 41;case 1:case 42:return 48;case 2:case 43:return 49;case 3:case 44:return 50;case 4:case 45:return 51;case 5:case 6:case 8:case 9:case 10:case 11:case 54:case 56:case 62:break;case 7:case 77:return 5;case 12:case 32:return this.pushState("SCALE"),17;case 13:case 33:return 18;case 14:case 20:case 34:case 49:case 52:this.popState();break;case 15:return this.begin("acc_title"),33;case 16:return this.popState(),"acc_title_value";case 17:return this.begin("acc_descr"),35;case 18:return this.popState(),"acc_descr_value";case 19:this.begin("acc_descr_multiline");break;case 21:return"acc_descr_multiline_value";case 22:return this.pushState("CLASSDEF"),38;case 23:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 24:return this.popState(),this.pushState("CLASSDEFID"),39;case 25:return this.popState(),40;case 26:return this.pushState("CLASS"),45;case 27:return this.popState(),this.pushState("CLASS_STYLE"),46;case 28:return this.popState(),47;case 29:return this.pushState("STYLE"),42;case 30:return this.popState(),this.pushState("STYLEDEF_STYLES"),43;case 31:return this.popState(),44;case 35:this.pushState("STATE");break;case 36:case 39:return this.popState(),y.yytext=y.yytext.slice(0,-8).trim(),25;case 37:case 40:return this.popState(),y.yytext=y.yytext.slice(0,-8).trim(),26;case 38:case 41:return this.popState(),y.yytext=y.yytext.slice(0,-10).trim(),27;case 46:this.pushState("STATE_STRING");break;case 47:return this.pushState("STATE_ID"),"AS";case 48:case 64:return this.popState(),"ID";case 50:return"STATE_DESCR";case 51:return 19;case 53:return this.popState(),this.pushState("struct"),20;case 55:return this.popState(),21;case 57:return this.begin("NOTE"),29;case 58:return this.popState(),this.pushState("NOTE_ID"),56;case 59:return this.popState(),this.pushState("NOTE_ID"),57;case 60:this.popState(),this.pushState("FLOATING_NOTE");break;case 61:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 63:return"NOTE_TEXT";case 65:return this.popState(),this.pushState("NOTE_TEXT"),24;case 66:return this.popState(),y.yytext=y.yytext.substr(2).trim(),31;case 67:return this.popState(),y.yytext=y.yytext.slice(0,-8).trim(),31;case 68:case 69:return 6;case 70:return 16;case 71:return 54;case 72:return 24;case 73:return y.yytext=y.yytext.trim(),14;case 74:return 15;case 75:return 28;case 76:return 55;case 78:return"INVALID"}},"anonymous"),rules:[/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[9,10],inclusive:!1},struct:{rules:[9,10,22,26,29,35,42,43,44,45,54,55,56,57,71,72,73,74,75],inclusive:!1},FLOATING_NOTE_ID:{rules:[64],inclusive:!1},FLOATING_NOTE:{rules:[61,62,63],inclusive:!1},NOTE_TEXT:{rules:[66,67],inclusive:!1},NOTE_ID:{rules:[65],inclusive:!1},NOTE:{rules:[58,59,60],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[31],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[30],inclusive:!1},CLASS_STYLE:{rules:[28],inclusive:!1},CLASS:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[25],inclusive:!1},CLASSDEF:{rules:[23,24],inclusive:!1},acc_descr_multiline:{rules:[20,21],inclusive:!1},acc_descr:{rules:[18],inclusive:!1},acc_title:{rules:[16],inclusive:!1},SCALE:{rules:[13,14,33,34],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[48],inclusive:!1},STATE_STRING:{rules:[49,50],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[9,10,36,37,38,39,40,41,46,47,51,52,53],inclusive:!1},ID:{rules:[9,10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,10,11,12,15,17,19,22,26,29,32,35,53,57,68,69,70,71,72,73,74,76,77,78],inclusive:!0}}}}();function nt(){this.yy={}}return pt.lexer=Wt,l(nt,"Parser"),nt.prototype=pt,pt.Parser=nt,new nt}();mt.parser=mt;var he=mt,ct="state",St="relation",J="default",vt="divider",It="fill:none",Lt="fill: #333",At="text",wt="normal",ft="rect",_t="rectWithTitle",Ot="divider",Nt="roundedWithTitle",K="statediagram",de=`${K}-state`,Rt="transition",ue=`${Rt} note-edge`,pe=`${K}-note`,ye=`${K}-cluster`,ge=`${K}-cluster-alt`,Bt="parent",Ft="note",bt="----",me=`${bt}${Ft}`,Pt=`${bt}${Bt}`,Yt=l((e,t="TB")=>{if(!e.doc)return t;let s=t;for(const a of e.doc)a.stmt==="dir"&&(s=a.value);return s},"getDir"),Se={getClasses:l(function(e,t){return t.db.getClasses()},"getClasses"),draw:l(async function(e,t,s,a){E.info("REF0:"),E.info("Drawing state diagram (v2)",t);const{securityLevel:o,state:i,layout:g}=$();a.db.extract(a.db.getRootDocV2());const d=a.db.getData(),c=Qt(t,o);d.type=a.type,d.layoutAlgorithm=g,d.nodeSpacing=(i==null?void 0:i.nodeSpacing)||50,d.rankSpacing=(i==null?void 0:i.rankSpacing)||50,d.markers=["barb"],d.diagramId=t,await te(d,c),ee.insertTitle(c,"statediagramTitleText",(i==null?void 0:i.titleTopMargin)??25,a.db.getDiagramTitle()),Zt(c,8,K,(i==null?void 0:i.useMaxWidth)??!0)},"draw"),getDir:Yt},lt=new Map,B=0;function ht(e="",t=0,s="",a=bt){return`state-${e}${s!==null&&s.length>0?`${a}${s}`:""}-${t}`}l(ht,"stateDomId");var fe=l((e,t,s,a,o,i,g,d)=>{E.trace("items",t),t.forEach(c=>{switch(c.stmt){case ct:case J:dt(e,c,s,a,o,i,g,d);break;case St:{dt(e,c.state1,s,a,o,i,g,d),dt(e,c.state2,s,a,o,i,g,d);const S={id:"edge"+B,start:c.state1.id,end:c.state2.id,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:It,labelStyle:"",label:U.sanitizeText(c.description,$()),arrowheadStyle:Lt,labelpos:"c",labelType:At,thickness:wt,classes:Rt,look:g};o.push(S),B++}}})},"setupDoc"),Gt=l((e,t="TB")=>{let s=t;if(e.doc)for(const a of e.doc)a.stmt==="dir"&&(s=a.value);return s},"getDir");function q(e,t,s){if(!t.id||t.id===""||t.id==="")return;t.cssClasses&&(Array.isArray(t.cssCompiledStyles)||(t.cssCompiledStyles=[]),t.cssClasses.split(" ").forEach(o=>{if(s.get(o)){const i=s.get(o);t.cssCompiledStyles=[...t.cssCompiledStyles,...i.styles]}}));const a=e.find(o=>o.id===t.id);a?Object.assign(a,t):e.push(t)}function jt(e){var t;return((t=e==null?void 0:e.classes)==null?void 0:t.join(" "))??""}function zt(e){return(e==null?void 0:e.styles)??[]}l(q,"insertOrUpdateNode"),l(jt,"getClassesFromDbInfo"),l(zt,"getStylesFromDbInfo");var dt=l((e,t,s,a,o,i,g,d)=>{var F,P;const c=t.id,S=s.get(c),b=jt(S),v=zt(S);if(E.info("dataFetcher parsedItem",t,S,v),c!=="root"){let L=ft;t.start===!0?L="stateStart":t.start===!1&&(L="stateEnd"),t.type!==J&&(L=t.type),lt.get(c)||lt.set(c,{id:c,shape:L,description:U.sanitizeText(c,$()),cssClasses:`${b} ${de}`,cssStyles:v});const p=lt.get(c);t.description&&(Array.isArray(p.description)?(p.shape=_t,p.description.push(t.description)):((F=p.description)==null?void 0:F.length)>0?(p.shape=_t,p.description===c?p.description=[t.description]:p.description=[p.description,t.description]):(p.shape=ft,p.description=t.description),p.description=U.sanitizeTextOrArray(p.description,$())),((P=p.description)==null?void 0:P.length)===1&&p.shape===_t&&(p.type==="group"?p.shape=Nt:p.shape=ft),!p.type&&t.doc&&(E.info("Setting cluster for XCX",c,Gt(t)),p.type="group",p.isGroup=!0,p.dir=Gt(t),p.shape=t.type===vt?Ot:Nt,p.cssClasses=`${p.cssClasses} ${ye} ${i?ge:""}`);const I={labelStyle:"",shape:p.shape,label:p.description,cssClasses:p.cssClasses,cssCompiledStyles:[],cssStyles:p.cssStyles,id:c,dir:p.dir,domId:ht(c,B),type:p.type,isGroup:p.type==="group",padding:8,rx:10,ry:10,look:g};if(I.shape===Ot&&(I.label=""),e&&e.id!=="root"&&(E.trace("Setting node ",c," to be child of its parent ",e.id),I.parentId=e.id),I.centerLabel=!0,t.note){const A={labelStyle:"",shape:"note",label:t.note.text,cssClasses:pe,cssStyles:[],cssCompilesStyles:[],id:c+me+"-"+B,domId:ht(c,B,Ft),type:p.type,isGroup:p.type==="group",padding:$().flowchart.padding,look:g,position:t.note.position},Y=c+Pt,G={labelStyle:"",shape:"noteGroup",label:t.note.text,cssClasses:p.cssClasses,cssStyles:[],id:c+Pt,domId:ht(c,B,Bt),type:"group",isGroup:!0,padding:16,look:g,position:t.note.position};B++,G.id=Y,A.parentId=Y,q(a,G,d),q(a,A,d),q(a,I,d);let N=c,R=A.id;t.note.position==="left of"&&(N=A.id,R=c),o.push({id:N+"-"+R,start:N,end:R,arrowhead:"none",arrowTypeEnd:"",style:It,labelStyle:"",classes:ue,arrowheadStyle:Lt,labelpos:"c",labelType:At,thickness:wt,look:g})}else q(a,I,d)}t.doc&&(E.trace("Adding nodes children "),fe(t,t.doc,s,a,o,!i,g,d))},"dataFetcher"),_e=l(()=>{lt.clear(),B=0},"reset"),Tt="[*]",Ut="start",Mt=Tt,Xt="color",Ht="fill";function kt(){return new Map}l(kt,"newClassesList");var Vt=l(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),ut=l(e=>JSON.parse(JSON.stringify(e)),"clone"),be=(M=class{constructor(t){k(this,"version");k(this,"nodes",[]);k(this,"edges",[]);k(this,"rootDoc",[]);k(this,"classes",kt());k(this,"documents",{root:Vt()});k(this,"currentDocument",this.documents.root);k(this,"startEndCount",0);k(this,"dividerCnt",0);k(this,"getAccTitle",ne);k(this,"setAccTitle",re);k(this,"getAccDescription",ae);k(this,"setAccDescription",oe);k(this,"setDiagramTitle",ce);k(this,"getDiagramTitle",le);this.clear(),this.version=t,this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this)}setRootDoc(t){E.info("Setting root doc",t),this.rootDoc=t,this.version===1?this.extract(t):this.extract(this.getRootDocV2())}getRootDoc(){return this.rootDoc}docTranslator(t,s,a){if(s.stmt===St)this.docTranslator(t,s.state1,!0),this.docTranslator(t,s.state2,!1);else if(s.stmt===ct&&(s.id==="[*]"?(s.id=a?t.id+"_start":t.id+"_end",s.start=a):s.id=s.id.trim()),s.doc){const o=[];let i,g=[];for(i=0;i0&&g.length>0){const d={stmt:ct,id:se(),type:"divider",doc:ut(g)};o.push(ut(d)),s.doc=o}s.doc.forEach(d=>this.docTranslator(s,d,!0))}}getRootDocV2(){return this.docTranslator({id:"root"},{id:"root",doc:this.rootDoc},!0),{id:"root",doc:this.rootDoc}}extract(t){let s;s=t.doc?t.doc:t,E.info(s),this.clear(!0),E.info("Extract initial document:",s),s.forEach(i=>{switch(E.warn("Statement",i.stmt),i.stmt){case ct:this.addState(i.id.trim(),i.type,i.doc,i.description,i.note,i.classes,i.styles,i.textStyles);break;case St:this.addRelation(i.state1,i.state2,i.description);break;case"classDef":this.addStyleClass(i.id.trim(),i.classes);break;case"style":{const g=i.id.trim().split(","),d=i.styleClass.split(",");g.forEach(c=>{let S=this.getState(c);if(S===void 0){const b=c.trim();this.addState(b),S=this.getState(b)}S.styles=d.map(b=>{var v;return(v=b.replace(/;/g,""))==null?void 0:v.trim()})})}break;case"applyClass":this.setCssClass(i.id.trim(),i.styleClass)}});const a=this.getStates(),o=$().look;_e(),dt(void 0,this.getRootDocV2(),a,this.nodes,this.edges,!0,o,this.classes),this.nodes.forEach(i=>{if(Array.isArray(i.label)){if(i.description=i.label.slice(1),i.isGroup&&i.description.length>0)throw new Error("Group nodes can only have label. Remove the additional description for node ["+i.id+"]");i.label=i.label[0]}})}addState(t,s=J,a=null,o=null,i=null,g=null,d=null,c=null){const S=t==null?void 0:t.trim();if(this.currentDocument.states.has(S)?(this.currentDocument.states.get(S).doc||(this.currentDocument.states.get(S).doc=a),this.currentDocument.states.get(S).type||(this.currentDocument.states.get(S).type=s)):(E.info("Adding state ",S,o),this.currentDocument.states.set(S,{id:S,descriptions:[],type:s,doc:a,note:i,classes:[],styles:[],textStyles:[]})),o&&(E.info("Setting state description",S,o),typeof o=="string"&&this.addDescription(S,o.trim()),typeof o=="object"&&o.forEach(b=>this.addDescription(S,b.trim()))),i){const b=this.currentDocument.states.get(S);b.note=i,b.note.text=U.sanitizeText(b.note.text,$())}g&&(E.info("Setting state classes",S,g),(typeof g=="string"?[g]:g).forEach(b=>this.setCssClass(S,b.trim()))),d&&(E.info("Setting state styles",S,d),(typeof d=="string"?[d]:d).forEach(b=>this.setStyle(S,b.trim()))),c&&(E.info("Setting state styles",S,d),(typeof c=="string"?[c]:c).forEach(b=>this.setTextStyle(S,b.trim())))}clear(t){this.nodes=[],this.edges=[],this.documents={root:Vt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=kt(),t||ie()}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){E.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}startIdIfNeeded(t=""){let s=t;return t===Tt&&(this.startEndCount++,s=`${Ut}${this.startEndCount}`),s}startTypeIfNeeded(t="",s=J){return t===Tt?Ut:s}endIdIfNeeded(t=""){let s=t;return t===Mt&&(this.startEndCount++,s=`end${this.startEndCount}`),s}endTypeIfNeeded(t="",s=J){return t===Mt?"end":s}addRelationObjs(t,s,a){let o=this.startIdIfNeeded(t.id.trim()),i=this.startTypeIfNeeded(t.id.trim(),t.type),g=this.startIdIfNeeded(s.id.trim()),d=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(o,i,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(g,d,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:o,id2:g,relationTitle:U.sanitizeText(a,$())})}addRelation(t,s,a){if(typeof t=="object")this.addRelationObjs(t,s,a);else{const o=this.startIdIfNeeded(t.trim()),i=this.startTypeIfNeeded(t),g=this.endIdIfNeeded(s.trim()),d=this.endTypeIfNeeded(s);this.addState(o,i),this.addState(g,d),this.currentDocument.relations.push({id1:o,id2:g,title:U.sanitizeText(a,$())})}}addDescription(t,s){const a=this.currentDocument.states.get(t),o=s.startsWith(":")?s.replace(":","").trim():s;a.descriptions.push(U.sanitizeText(o,$()))}cleanupLabel(t){return t.substring(0,1)===":"?t.substr(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,"divider-id-"+this.dividerCnt}addStyleClass(t,s=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const a=this.classes.get(t);s!=null&&s.split(",").forEach(o=>{const i=o.replace(/([^;]*);/,"$1").trim();if(RegExp(Xt).exec(o)){const g=i.replace(Ht,"bgFill").replace(Xt,Ht);a.textStyles.push(g)}a.styles.push(i)})}getClasses(){return this.classes}setCssClass(t,s){t.split(",").forEach(a=>{let o=this.getState(a);if(o===void 0){const i=a.trim();this.addState(i),o=this.getState(i)}o.classes.push(s)})}setStyle(t,s){const a=this.getState(t);a!==void 0&&a.styles.push(s)}setTextStyle(t,s){const a=this.getState(t);a!==void 0&&a.textStyles.push(s)}getDirectionStatement(){return this.rootDoc.find(t=>t.stmt==="dir")}getDirection(){var t;return((t=this.getDirectionStatement())==null?void 0:t.value)??"TB"}setDirection(t){const s=this.getDirectionStatement();s?s.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t&&t[0]===":"?t.substr(1).trim():t.trim()}getData(){const t=$();return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:Yt(this.getRootDocV2())}}getConfig(){return $().state}},l(M,"StateDB"),k(M,"relationType",{AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}),M),Te=l(e=>` +defs #statediagram-barbEnd { + fill: ${e.transitionColor}; + stroke: ${e.transitionColor}; + } +g.stateGroup text { + fill: ${e.nodeBorder}; + stroke: none; + font-size: 10px; +} +g.stateGroup text { + fill: ${e.textColor}; + stroke: none; + font-size: 10px; + +} +g.stateGroup .state-title { + font-weight: bolder; + fill: ${e.stateLabelColor}; +} + +g.stateGroup rect { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; +} + +g.stateGroup line { + stroke: ${e.lineColor}; + stroke-width: 1; +} + +.transition { + stroke: ${e.transitionColor}; + stroke-width: 1; + fill: none; +} + +.stateGroup .composit { + fill: ${e.background}; + border-bottom: 1px +} + +.stateGroup .alt-composit { + fill: #e0e0e0; + border-bottom: 1px +} + +.state-note { + stroke: ${e.noteBorderColor}; + fill: ${e.noteBkgColor}; + + text { + fill: ${e.noteTextColor}; + stroke: none; + font-size: 10px; + } +} + +.stateLabel .box { + stroke: none; + stroke-width: 0; + fill: ${e.mainBkg}; + opacity: 0.5; +} + +.edgeLabel .label rect { + fill: ${e.labelBackgroundColor}; + opacity: 0.5; +} +.edgeLabel { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; +} +.edgeLabel .label text { + fill: ${e.transitionLabelColor||e.tertiaryTextColor}; +} +.label div .edgeLabel { + color: ${e.transitionLabelColor||e.tertiaryTextColor}; +} + +.stateLabel text { + fill: ${e.stateLabelColor}; + font-size: 10px; + font-weight: bold; +} + +.node circle.state-start { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node .fork-join { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node circle.state-end { + fill: ${e.innerEndBackground}; + stroke: ${e.background}; + stroke-width: 1.5 +} +.end-state-inner { + fill: ${e.compositeBackground||e.background}; + // stroke: ${e.background}; + stroke-width: 1.5 +} + +.node rect { + fill: ${e.stateBkg||e.mainBkg}; + stroke: ${e.stateBorder||e.nodeBorder}; + stroke-width: 1px; +} +.node polygon { + fill: ${e.mainBkg}; + stroke: ${e.stateBorder||e.nodeBorder};; + stroke-width: 1px; +} +#statediagram-barbEnd { + fill: ${e.lineColor}; +} + +.statediagram-cluster rect { + fill: ${e.compositeTitleBackground}; + stroke: ${e.stateBorder||e.nodeBorder}; + stroke-width: 1px; +} + +.cluster-label, .nodeLabel { + color: ${e.stateLabelColor}; + // line-height: 1; +} + +.statediagram-cluster rect.outer { + rx: 5px; + ry: 5px; +} +.statediagram-state .divider { + stroke: ${e.stateBorder||e.nodeBorder}; +} + +.statediagram-state .title-state { + rx: 5px; + ry: 5px; +} +.statediagram-cluster.statediagram-cluster .inner { + fill: ${e.compositeBackground||e.background}; +} +.statediagram-cluster.statediagram-cluster-alt .inner { + fill: ${e.altBackground?e.altBackground:"#efefef"}; +} + +.statediagram-cluster .inner { + rx:0; + ry:0; +} + +.statediagram-state rect.basic { + rx: 5px; + ry: 5px; +} +.statediagram-state rect.divider { + stroke-dasharray: 10,10; + fill: ${e.altBackground?e.altBackground:"#efefef"}; +} + +.note-edge { + stroke-dasharray: 5; +} + +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} + +.statediagram-note text { + fill: ${e.noteTextColor}; +} + +.statediagram-note .nodeLabel { + color: ${e.noteTextColor}; +} +.statediagram .edgeLabel { + color: red; // ${e.noteTextColor}; +} + +#dependencyStart, #dependencyEnd { + fill: ${e.lineColor}; + stroke: ${e.lineColor}; + stroke-width: 1; +} + +.statediagramTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; +} +`,"getStyles");export{be as S,he as a,Se as b,Te as s}; diff --git a/notebooks/assets/chunk-D6G4REZN-BESp3t-9.js b/notebooks/assets/chunk-D6G4REZN-BESp3t-9.js new file mode 100644 index 0000000000000000000000000000000000000000..5020268ee4dff53866a3cb715d3834b74076f655 --- /dev/null +++ b/notebooks/assets/chunk-D6G4REZN-BESp3t-9.js @@ -0,0 +1 @@ +import{_ as n,m as o,i as c}from"./mermaid-DwRBzUur.js";var i=n((a,t)=>{const r=a.append("rect");if(r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),t.name&&r.attr("name",t.name),t.rx&&r.attr("rx",t.rx),t.ry&&r.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)r.attr(s,t.attrs[s]);return t.class&&r.attr("class",t.class),r},"drawRect"),l=n((a,t)=>{const r={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};i(a,r).lower()},"drawBackgroundRect"),d=n((a,t)=>{const r=t.text.replace(o," "),s=a.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const e=s.append("tspan");return e.attr("x",t.x+2*t.textMargin),e.text(r),s},"drawText"),h=n((a,t,r,s)=>{const e=a.append("image");e.attr("x",t),e.attr("y",r);const x=c.sanitizeUrl(s);e.attr("xlink:href",x)},"drawImage"),y=n((a,t,r,s)=>{const e=a.append("use");e.attr("x",t),e.attr("y",r);const x=c.sanitizeUrl(s);e.attr("xlink:href",`#${x}`)},"drawEmbeddedImage"),p=n(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),g=n(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj");export{l as a,g as b,y as c,i as d,h as e,d as f,p as g}; diff --git a/notebooks/assets/chunk-RZ5BOZE2-Dd93pMgt.js b/notebooks/assets/chunk-RZ5BOZE2-Dd93pMgt.js new file mode 100644 index 0000000000000000000000000000000000000000..772b7f5aad812a4634dc85ce20d3d5a9173866fe --- /dev/null +++ b/notebooks/assets/chunk-RZ5BOZE2-Dd93pMgt.js @@ -0,0 +1 @@ +import{_ as s,d as c,l as x}from"./mermaid-DwRBzUur.js";import{s as r}from"./transform-DetRMEbJ.js";var m=s((t,e)=>{let i;return e==="sandbox"&&(i=r("#i"+t)),r(e==="sandbox"?i.nodes()[0].contentDocument.body:"body").select(`[id="${t}"]`)},"getDiagramElement"),w=s((t,e,i,o)=>{t.attr("class",i);const{width:a,height:d,x:h,y:g}=l(t,e);c(t,d,a,o);const n=u(h,g,a,d,e);t.attr("viewBox",n),x.debug(`viewBox configured: ${n} with padding: ${e}`)},"setupViewPortForSVG"),l=s((t,e)=>{var o;const i=((o=t.node())==null?void 0:o.getBBox())||{width:0,height:0,x:0,y:0};return{width:i.width+2*e,height:i.height+2*e,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),u=s((t,e,i,o,a)=>`${t-a} ${e-a} ${i} ${o}`,"createViewBox");export{m as g,w as s}; diff --git a/notebooks/assets/chunk-XZIHB7SX-80AOfzmu.js b/notebooks/assets/chunk-XZIHB7SX-80AOfzmu.js new file mode 100644 index 0000000000000000000000000000000000000000..7ef71b09c9d33e0d2fa978ade89bc472396f9bb9 --- /dev/null +++ b/notebooks/assets/chunk-XZIHB7SX-80AOfzmu.js @@ -0,0 +1 @@ +var t;import{_ as s}from"./mermaid-DwRBzUur.js";var r=(t=class{constructor(i){this.init=i,this.records=this.init()}reset(){this.records=this.init()}},s(t,"ImperativeState"),t);export{r as I}; diff --git a/notebooks/assets/circle-play-ClvgvQfO.js b/notebooks/assets/circle-play-ClvgvQfO.js new file mode 100644 index 0000000000000000000000000000000000000000..fdce53ffeaf6eed9c74fdbfa7bc276cd5ea1a0e9 --- /dev/null +++ b/notebooks/assets/circle-play-ClvgvQfO.js @@ -0,0 +1,6 @@ +import{u as c}from"./index-DgI7bmFZ.js";/** + * @license lucide-react v0.503.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o=c("circle-play",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);export{o as C}; diff --git a/notebooks/assets/classDiagram-GIVACNV2-DLrZBtuR.js b/notebooks/assets/classDiagram-GIVACNV2-DLrZBtuR.js new file mode 100644 index 0000000000000000000000000000000000000000..95a30bd1889c38c0fb157e4314a21e557a0fa7b0 --- /dev/null +++ b/notebooks/assets/classDiagram-GIVACNV2-DLrZBtuR.js @@ -0,0 +1 @@ +import{s as a,c as s,a as t,C as o}from"./chunk-A2AXSNBT-LRmUxR_u.js";import{_ as e}from"./mermaid-DwRBzUur.js";import"./transform-DetRMEbJ.js";import"./chunk-RZ5BOZE2-Dd93pMgt.js";import"./index-DgI7bmFZ.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var i={parser:t,get db(){return new o},renderer:s,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{i as diagram}; diff --git a/notebooks/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js b/notebooks/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js new file mode 100644 index 0000000000000000000000000000000000000000..95a30bd1889c38c0fb157e4314a21e557a0fa7b0 --- /dev/null +++ b/notebooks/assets/classDiagram-v2-COTLJTTW-DLrZBtuR.js @@ -0,0 +1 @@ +import{s as a,c as s,a as t,C as o}from"./chunk-A2AXSNBT-LRmUxR_u.js";import{_ as e}from"./mermaid-DwRBzUur.js";import"./transform-DetRMEbJ.js";import"./chunk-RZ5BOZE2-Dd93pMgt.js";import"./index-DgI7bmFZ.js";import"./step-BwsUM5iJ.js";import"./timer-Bqd5yn_a.js";var i={parser:t,get db(){return new o},renderer:s,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{i as diagram}; diff --git a/notebooks/assets/clike-BgBwzOhw.js b/notebooks/assets/clike-BgBwzOhw.js new file mode 100644 index 0000000000000000000000000000000000000000..1e7f7e690ddb75d5624c7fad0485f49edc0b3df1 --- /dev/null +++ b/notebooks/assets/clike-BgBwzOhw.js @@ -0,0 +1 @@ +function O(e,t,n,l,u,d){this.indented=e,this.column=t,this.type=n,this.info=l,this.align=u,this.prev=d}function z(e,t,n,l){var u=e.indented;return e.context&&e.context.type=="statement"&&n!="statement"&&(u=e.context.indented),e.context=new O(u,t,n,l,null,e.context)}function _(e){var t=e.context.type;return t!=")"&&t!="]"&&t!="}"||(e.indented=e.context.indented),e.context=e.context.prev}function Q(e,t,n){return t.prevToken=="variable"||t.prevToken=="type"||!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0}function j(e){for(;;){if(!e||e.type=="top")return!0;if(e.type=="}"&&e.prev.info!="namespace")return!1;e=e.prev}}function f(e){var t,n,l=e.statementIndentUnit,u=e.dontAlignCalls,d=e.keywords||{},m=e.types||{},h=e.builtin||{},v=e.blockKeywords||{},C=e.defKeywords||{},U=e.atoms||{},w=e.hooks||{},oe=e.multiLineStrings,le=e.indentStatements!==!1,se=e.indentSwitch!==!1,$=e.namespaceSeparator,ce=e.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,ue=e.numberStart||/[\d\.]/,de=e.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,B=e.isOperatorChar||/[+\-*&%=<>!?|\/]/,K=e.isIdentifierChar||/[\w\$_\xa1-\uffff]/,q=e.isReservedIdentifier||!1;function V(i,o){var s,a=i.next();if(w[a]){var y=w[a](i,o);if(y!==!1)return y}if(a=='"'||a=="'")return o.tokenize=(s=a,function(I,P){for(var R,D=!1,Z=!1;(R=I.next())!=null;){if(R==s&&!D){Z=!0;break}D=!D&&R=="\\"}return(Z||!D&&!oe)&&(P.tokenize=null),"string"}),o.tokenize(i,o);if(ue.test(a)){if(i.backUp(1),i.match(de))return"number";i.next()}if(ce.test(a))return t=a,null;if(a=="/"){if(i.eat("*"))return o.tokenize=W,W(i,o);if(i.eat("/"))return i.skipToEnd(),"comment"}if(B.test(a)){for(;!i.match(/^\/[\/*]/,!1)&&i.eat(B););return"operator"}if(i.eatWhile(K),$)for(;i.match($);)i.eatWhile(K);var p=i.current();return g(d,p)?(g(v,p)&&(t="newstatement"),g(C,p)&&(n=!0),"keyword"):g(m,p)?"type":g(h,p)||q&&q(p)?(g(v,p)&&(t="newstatement"),"builtin"):g(U,p)?"atom":"variable"}function W(i,o){for(var s,a=!1;s=i.next();){if(s=="/"&&a){o.tokenize=null;break}a=s=="*"}return"comment"}function G(i,o){e.typeFirstDefinitions&&i.eol()&&j(o.context)&&(o.typeAtEndOfLine=Q(i,o,i.pos))}return{name:e.name,startState:function(i){return{tokenize:null,context:new O(-i,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(i,o){var s=o.context;if(i.sol()&&(s.align==null&&(s.align=!1),o.indented=i.indentation(),o.startOfLine=!0),i.eatSpace())return G(i,o),null;t=n=null;var a=(o.tokenize||V)(i,o);if(a=="comment"||a=="meta")return a;if(s.align==null&&(s.align=!0),t==";"||t==":"||t==","&&i.match(/^\s*(?:\/\/.*)?$/,!1))for(;o.context.type=="statement";)_(o);else if(t=="{")z(o,i.column(),"}");else if(t=="[")z(o,i.column(),"]");else if(t=="(")z(o,i.column(),")");else if(t=="}"){for(;s.type=="statement";)s=_(o);for(s.type=="}"&&(s=_(o));s.type=="statement";)s=_(o)}else t==s.type?_(o):le&&((s.type=="}"||s.type=="top")&&t!=";"||s.type=="statement"&&t=="newstatement")&&z(o,i.column(),"statement",i.current());if(a=="variable"&&(o.prevToken=="def"||e.typeFirstDefinitions&&Q(i,o,i.start)&&j(o.context)&&i.match(/^\s*\(/,!1))&&(a="def"),w.token){var y=w.token(i,o,a);y!==void 0&&(a=y)}return a=="def"&&e.styleDefs===!1&&(a="variable"),o.startOfLine=!1,o.prevToken=n?"def":a||t,G(i,o),a},indent:function(i,o,s){if(i.tokenize!=V&&i.tokenize!=null||i.typeAtEndOfLine&&j(i.context))return null;var a=i.context,y=o&&o.charAt(0),p=y==a.type;if(a.type=="statement"&&y=="}"&&(a=a.prev),e.dontIndentStatements)for(;a.type=="statement"&&e.dontIndentStatements.test(a.info);)a=a.prev;if(w.indent){var I=w.indent(i,a,o,s.unit);if(typeof I=="number")return I}var P=a.prev&&a.prev.info=="switch";if(e.allmanIndentation&&/[{(]/.test(y)){for(;a.type!="top"&&a.type!="}";)a=a.prev;return a.indented}return a.type=="statement"?a.indented+(y=="{"?0:l||s.unit):!a.align||u&&a.type==")"?a.type!=")"||p?a.indented+(p?0:s.unit)+(p||!P||/^(?:case|default)\b/.test(o)?0:s.unit):a.indented+(l||s.unit):a.column+(p?0:1)},languageData:{indentOnInput:se?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}},autocomplete:Object.keys(d).concat(Object.keys(m)).concat(Object.keys(h)).concat(Object.keys(U)),...e.languageData}}}function r(e){for(var t={},n=e.split(" "),l=0;l!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=re,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"character":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(e,t){var n=t.context;return!(n.type!="}"||!n.align||!e.eat(">"))&&(t.context=new O(n.indented,n.column,n.type,n.info,null,n.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=N(1),t.tokenize(e,t))}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),be=f({name:"kotlin",keywords:r("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:r("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:r("catch class do else finally for if where try while enum"),defKeywords:r("class val var object interface fun"),atoms:r("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,t){return t.prevToken=="."?"variable":"operator"},'"':function(e,t){var n;return t.tokenize=(n=e.match('""'),function(l,u){for(var d,m=!1,h=!1;!l.eol();){if(!n&&!m&&l.match('"')){h=!0;break}if(n&&l.match('"""')){h=!0;break}d=l.next(),!m&&d=="$"&&l.match("{")&&l.skipTo("}"),m=!m&&d=="\\"&&!n}return!h&&n||(u.tokenize=null),"string"}),t.tokenize(e,t)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=N(1),t.tokenize(e,t))},indent:function(e,t,n,l){var u=n&&n.charAt(0);return e.prevToken!="}"&&e.prevToken!=")"||n!=""?e.prevToken=="operator"&&n!="}"&&e.context.type!="}"||e.prevToken=="variable"&&u=="."||(e.prevToken=="}"||e.prevToken==")")&&u=="."?2*l+t.indented:t.align&&t.type=="}"?t.indented+(e.context.type==(n||"").charAt(0)?0:l):void 0:e.indented}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}}),ve=f({name:"shader",keywords:r("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:r("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:r("for while do if else struct"),builtin:r("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:r("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":k}}),we=f({name:"nesc",keywords:r(x+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:S,blockKeywords:r(T),atoms:r("null true false"),hooks:{"#":k}}),_e=f({name:"objectivec",keywords:r(x+" "+Y),types:J,builtin:r(H),blockKeywords:r(T+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:r(L+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:E,hooks:{"#":k,"*":M}}),xe=f({name:"objectivecpp",keywords:r(x+" "+Y+" "+X),types:J,builtin:r(H),blockKeywords:r(T+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:r(L+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:E,hooks:{"#":k,"*":M,u:b,U:b,L:b,R:b,0:c,1:c,2:c,3:c,4:c,5:c,6:c,7:c,8:c,9:c,token:function(e,t,n){if(n=="variable"&&e.peek()=="("&&(t.prevToken==";"||t.prevToken==null||t.prevToken=="}")&&ee(e.current()))return"def"}},namespaceSeparator:"::"}),Se=f({name:"squirrel",keywords:r("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:S,blockKeywords:r("case catch class else for foreach if switch try while"),defKeywords:r("function local class"),typeFirstDefinitions:!0,atoms:r("true false null"),hooks:{"#":k}});var F=null;function ae(e){return function(t,n){for(var l,u=!1,d=!1;!t.eol();){if(!u&&t.match('"')&&(e=="single"||t.match('""'))){d=!0;break}if(!u&&t.match("``")){F=ae(e),d=!0;break}l=t.next(),u=e=="single"&&!u&&l=="\\"}return d&&(n.tokenize=null),"string"}}const Te=f({name:"ceylon",keywords:r("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:r("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:r("class dynamic function interface module object package value"),builtin:r("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:r("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=ae(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!F||!e.match("`"))&&(t.tokenize=F,F=null,t.tokenize(e,t))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"string.special":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},token:function(e,t,n){if((n=="variable"||n=="type")&&t.prevToken==".")return"variableName.special"}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function Ne(e){(e.interpolationStack||(e.interpolationStack=[])).push(e.tokenize)}function ie(e){return(e.interpolationStack||(e.interpolationStack=[])).pop()}function A(e,t,n,l){var u=!1;if(t.eat(e)){if(!t.eat(e))return"string";u=!0}function d(m,h){for(var v=!1;!m.eol();){if(!l&&!v&&m.peek()=="$")return Ne(h),h.tokenize=Ce,"string";var C=m.next();if(C==e&&!v&&(!u||m.match(e+e))){h.tokenize=null;break}v=!l&&!v&&C=="\\"}return"string"}return n.tokenize=d,d(t,n)}function Ce(e,t){return e.eat("$"),e.eat("{")?t.tokenize=null:t.tokenize=Ie,null}function Ie(e,t){return e.eatWhile(/[\w_]/),t.tokenize=ie(t),"variable"}const De=f({name:"dart",keywords:r("this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline"),blockKeywords:r("try catch finally do else for if switch while"),builtin:r("void bool num int double dynamic var String Null Never"),atoms:r("true false null"),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_\.]/),"meta"},"'":function(e,t){return A("'",e,t,!1)},'"':function(e,t){return A('"',e,t,!1)},r:function(e,t){var n=e.peek();return(n=="'"||n=='"')&&A(e.next(),e,t,!0)},"}":function(e,t){return function(n){return n.interpolationStack?n.interpolationStack.length:0}(t)>0&&(t.tokenize=ie(t),null)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=N(1),t.tokenize(e,t))},token:function(e,t,n){if(n=="variable"&&RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g").test(e.current()))return"type"}}});export{me as c,Te as ceylon,f as clike,he as cpp,ge as csharp,De as dart,ye as java,be as kotlin,we as nesC,_e as objectiveC,xe as objectiveCpp,ke as scala,ve as shader,Se as squirrel}; diff --git a/notebooks/assets/clojure-DiuoqK-z.js b/notebooks/assets/clojure-DiuoqK-z.js new file mode 100644 index 0000000000000000000000000000000000000000..fee670dc1f867f44b2d30640b2bd74c5a950f769 --- /dev/null +++ b/notebooks/assets/clojure-DiuoqK-z.js @@ -0,0 +1 @@ +var d=["false","nil","true"],l=[".","catch","def","do","if","monitor-enter","monitor-exit","new","quote","recur","set!","throw","try","var"],u=["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-namespace-maps*","*print-readably*","*read-eval*","*reader-resolver*","*source-path*","*suppress-read*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Eduction","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods","..","/","<","<=","=","==",">",">=","EMPTY-NODE","Inst","StackTraceElement->vec","Throwable->map","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","any?","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc","assoc!","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","boolean?","booleans","bound-fn","bound-fn*","bound?","bounded-count","butlast","byte","byte-array","bytes","bytes?","case","cast","cat","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","completing","concat","cond","cond->","cond->>","condp","conj","conj!","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","dedupe","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj","disj!","dissoc","dissoc!","distinct","distinct?","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","double?","doubles","drop","drop-last","drop-while","eduction","empty","empty?","ensure","ensure-reduced","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","halt-when","hash","hash-combine","hash-map","hash-ordered-coll","hash-set","hash-unordered-coll","ident?","identical?","identity","if-let","if-not","if-some","ifn?","import","in-ns","inc","inc'","indexed?","init-proxy","inst-ms","inst-ms*","inst?","instance?","int","int-array","int?","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-entry?","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mix-collection-hash","mod","munge","name","namespace","namespace-munge","nat-int?","neg-int?","neg?","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop","pop!","pop-thread-bindings","pos-int?","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","qualified-ident?","qualified-keyword?","qualified-symbol?","quot","rand","rand-int","rand-nth","random-sample","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","reader-conditional","reader-conditional?","realized?","record?","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","reset-vals!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","run!","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seqable?","seque","sequence","sequential?","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","simple-ident?","simple-keyword?","simple-symbol?","slurp","some","some->","some->>","some-fn","some?","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","swap-vals!","symbol","symbol?","sync","tagged-literal","tagged-literal?","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","time","to-array","to-array-2d","trampoline","transduce","transient","tree-seq","true?","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","unreduced","unsigned-bit-shift-right","update","update-in","update-proxy","uri?","use","uuid?","val","vals","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","volatile!","volatile?","vreset!","vswap!","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"],p=o(d),m=o(l),f=o(u),h=o(["->","->>","as->","binding","bound-fn","case","catch","comment","cond","cond->","cond->>","condp","def","definterface","defmethod","defn","defmacro","defprotocol","defrecord","defstruct","deftype","do","doseq","dotimes","doto","extend","extend-protocol","extend-type","fn","for","future","if","if-let","if-not","if-some","let","letfn","locking","loop","ns","proxy","reify","struct-map","some->","some->>","try","when","when-first","when-let","when-not","when-some","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn"]),y=/^(?:[\\\[\]\s"(),;@^`{}~]|$)/,b=/^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/,g=/^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/,k=/^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;function i(t,e){if(t.eatSpace()||t.eat(","))return["space",null];if(t.match(b))return[null,"number"];if(t.match(g))return[null,"string.special"];if(t.eat(/^"/))return(e.tokenize=v)(t,e);if(t.eat(/^[(\[{]/))return["open","bracket"];if(t.eat(/^[)\]}]/))return["close","bracket"];if(t.eat(/^;/))return t.skipToEnd(),["space","comment"];if(t.eat(/^[#'@^`~]/))return[null,"meta"];var r=t.match(k),n=r&&r[0];return n?n==="comment"&&e.lastToken==="("?(e.tokenize=x)(t,e):a(n,p)||n.charAt(0)===":"?["symbol","atom"]:a(n,m)||a(n,f)?["symbol","keyword"]:e.lastToken==="("?["symbol","builtin"]:["symbol","variable"]:(t.next(),t.eatWhile(function(s){return!a(s,y)}),[null,"error"])}function v(t,e){for(var r,n=!1;r=t.next();){if(r==='"'&&!n){e.tokenize=i;break}n=!n&&r==="\\"}return[null,"string"]}function x(t,e){for(var r,n=1;r=t.next();)if(r===")"&&n--,r==="("&&n++,n===0){t.backUp(1),e.tokenize=i;break}return["space","comment"]}function o(t){for(var e={},r=0;r >= "),I={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,symbol:/[\w*+\-]/};const G={name:"cobol",startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(E,R){if(R.indentStack==null&&E.sol()&&(R.indentation=6),E.eatSpace())return null;var T=null;if(R.mode==="string"){for(var A=!1;(A=E.next())!=null;)if((A=='"'||A=="'")&&!E.match(/['"]/,!1)){R.mode=!1;break}T=S}else{var L=E.next(),O=E.column();if(O>=0&&O<=5)T="def";else if(O>=72&&O<=79)E.skipToEnd(),T="header";else if(L=="*"&&O==6)E.skipToEnd(),T="comment";else if(L=='"'||L=="'")R.mode="string",T=S;else if(L!="'"||I.digit_or_colon.test(E.peek()))if(L==".")T="link";else if(function(C,N){return C==="0"&&N.eat(/x/i)?(N.eatWhile(I.hex),!0):(C!="+"&&C!="-"||!I.digit.test(N.peek())||(N.eat(I.sign),C=N.next()),!!I.digit.test(C)&&(N.eat(C),N.eatWhile(I.digit),N.peek()=="."&&(N.eat("."),N.eatWhile(I.digit)),N.eat(I.exponent)&&(N.eat(I.sign),N.eatWhile(I.digit)),!0))}(L,E))T="number";else{if(E.current().match(I.symbol))for(;O<71&&E.eat(I.symbol)!==void 0;)O++;T=M&&M.propertyIsEnumerable(E.current().toUpperCase())?"keyword":e&&e.propertyIsEnumerable(E.current().toUpperCase())?"builtin":P&&P.propertyIsEnumerable(E.current().toUpperCase())?U:null}else T=U}return T},indent:function(E){return E.indentStack==null?E.indentation:E.indentStack.indent}};export{G as cobol}; diff --git a/notebooks/assets/coffeescript-BTDxI-eT.js b/notebooks/assets/coffeescript-BTDxI-eT.js new file mode 100644 index 0000000000000000000000000000000000000000..98cccb9eb4dd4c6297a0ab94aef186fa417d59af --- /dev/null +++ b/notebooks/assets/coffeescript-BTDxI-eT.js @@ -0,0 +1 @@ +var m="error";function s(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var k=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,g=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,h=/^[_A-Za-z$][_A-Za-z$0-9]*/,y=/^@[_A-Za-z$][_A-Za-z$0-9]*/,z=s(["and","or","not","is","isnt","in","instanceof","typeof"]),u=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],b=s(u.concat(["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"]));u=s(u);var x=/^('{3}|\"{3}|['\"])/,w=/^(\/{3}|\/)/,A=s(["Infinity","NaN","undefined","null","true","false","on","off","yes","no"]);function p(e,n){if(e.sol()){n.scope.align===null&&(n.scope.align=!1);var o=n.scope.offset;if(e.eatSpace()){var t=e.indentation();return t>o&&n.scope.type=="coffee"?"indent":t0&&d(e,n)}if(e.eatSpace())return null;var c=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return n.tokenize=O,n.tokenize(e,n);if(c==="#")return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var r=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^-?\d+\.\d*/)&&(r=!0),e.match(/^-?\.\d+/)&&(r=!0),r)return e.peek()=="."&&e.backUp(1),"number";var i=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(i=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(i=!0),e.match(/^-?0(?![\dx])/i)&&(i=!0),i)return"number"}if(e.match(x))return n.tokenize=v(e.current(),!1,"string"),n.tokenize(e,n);if(e.match(w)){if(e.current()!="/"||e.match(/^.*\//,!1))return n.tokenize=v(e.current(),!0,"string.special"),n.tokenize(e,n);e.backUp(1)}return e.match(k)||e.match(z)?"operator":e.match(g)?"punctuation":e.match(A)?"atom":e.match(y)||n.prop&&e.match(h)?"property":e.match(b)?"keyword":e.match(h)?"variable":(e.next(),m)}function v(e,n,o){return function(t,c){for(;!t.eol();)if(t.eatWhile(/[^'"\/\\]/),t.eat("\\")){if(t.next(),n&&t.eol())return o}else{if(t.match(e))return c.tokenize=p,o;t.eat(/['"\/]/)}return n&&(c.tokenize=p),o}}function O(e,n){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){n.tokenize=p;break}e.eatWhile("#")}return"comment"}function l(e,n,o="coffee"){for(var t=0,c=!1,r=null,i=n.scope;i;i=i.prev)if(i.type==="coffee"||i.type=="}"){t=i.offset+e.indentUnit;break}o!=="coffee"?(c=null,r=e.column()+e.current().length):n.scope.align&&(n.scope.align=!1),n.scope={offset:t,type:o,prev:n.scope,align:c,alignOffset:r}}function d(e,n){if(n.scope.prev){if(n.scope.type==="coffee"){for(var o=e.indentation(),t=!1,c=n.scope;c;c=c.prev)if(o===c.offset){t=!0;break}if(!t)return!0;for(;n.scope.prev&&n.scope.offset!==o;)n.scope=n.scope.prev;return!1}return n.scope=n.scope.prev,!1}}const S={name:"coffeescript",startState:function(){return{tokenize:p,scope:{offset:0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,n){var o=n.scope.align===null&&n.scope;o&&e.sol()&&(o.align=!1);var t=function(c,r){var i=r.tokenize(c,r),f=c.current();f==="return"&&(r.dedent=!0),((f==="->"||f==="=>")&&c.eol()||i==="indent")&&l(c,r);var a="[({".indexOf(f);if(a!==-1&&l(c,r,"])}".slice(a,a+1)),u.exec(f)&&l(c,r),f=="then"&&d(c,r),i==="dedent"&&d(c,r))return m;if((a="])}".indexOf(f))!==-1){for(;r.scope.type=="coffee"&&r.scope.prev;)r.scope=r.scope.prev;r.scope.type==f&&(r.scope=r.scope.prev)}return r.dedent&&c.eol()&&(r.scope.type=="coffee"&&r.scope.prev&&(r.scope=r.scope.prev),r.dedent=!1),i=="indent"||i=="dedent"?null:i}(e,n);return t&&t!="comment"&&(o&&(o.align=!0),n.prop=t=="punctuation"&&e.current()=="."),t},indent:function(e,n){if(e.tokenize!=p)return 0;var o=e.scope,t=n&&"])}".indexOf(n.charAt(0))>-1;if(t)for(;o.type=="coffee"&&o.prev;)o=o.prev;var c=t&&o.type===n.charAt(0);return o.align?o.alignOffset-(c?1:0):(c?o.prev:o).offset},languageData:{commentTokens:{line:"#"}}};export{S as coffeeScript}; diff --git a/notebooks/assets/colors-bszWmPJw.js b/notebooks/assets/colors-bszWmPJw.js new file mode 100644 index 0000000000000000000000000000000000000000..c546e30a7b459e506ae112a5c9d9f64c29826842 --- /dev/null +++ b/notebooks/assets/colors-bszWmPJw.js @@ -0,0 +1 @@ +function c(e){for(var n=e.length/6|0,a=new Array(n),r=0;r0){for(o=n[--a];a>0&&(e=o,r=n[--a],o=e+r,i=r-(o-e),!i););a>0&&(i<0&&n[a-1]<0||i>0&&n[a-1]>0)&&(r=2*i,e=o+r,r==e-o&&(o=e))}return o}}function Hx(t,n){return(t==null||!(t>=t))-(n==null||!(n>=n))||(tn?1:0)}function Gx(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=i===void 0?Hx:function(a=Ws){if(a===Ws)return Hx;if(typeof a!="function")throw new TypeError("compare is not a function");return(o,s)=>{const u=a(o,s);return u||u===0?u:(a(s,s)===0)-(a(o,o)===0)}}(i);r>e;){if(r-e>600){const u=r-e+1,l=n-e+1,c=Math.log(u),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(u-f)/u)*(l-u/2<0?-1:1);Gx(t,n,Math.max(e,Math.floor(n-l*f/u+d)),Math.min(r,Math.floor(n+(u-l)*f/u+d)),i)}const a=t[n];let o=e,s=r;for(Ys(t,e,n),i(t[r],a)>0&&Ys(t,e,r);o0;)--s}i(t[e],a)===0?Ys(t,e,s):(++s,Ys(t,s,r)),s<=n&&(e=s+1),n<=s&&(r=s-1)}return t}function Ys(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function yp(t,n,e){if((r=(t=Float64Array.from(r8(t,e))).length)&&!isNaN(n=+n)){if(n<=0||r<2)return cp(t);if(n>=1)return Ca(t);var r,i=(r-1)*n,a=Math.floor(i),o=Ca(Gx(t,a).subarray(0,a+1));return o+(cp(t.subarray(a+1))-o)*(i-a)}}function Vx(t,n,e=i8){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),o=+e(t[a],a,t);return o+(+e(t[a+1],a+1,t)-o)*(i-a)}}function Yx(t,n){return yp(t,.5,n)}function Xx(t){return Array.from(function*(n){for(const e of n)yield*e}(t))}function Jx(t,n){let e=0;for(let r of t)(r=+r)&&(e+=r);return e}function n9(t){return t instanceof Kl?t:new Kl(t)}function Ql(t){const n=t||Me,e=[],r={};return e.add=i=>{const a=n(i);return r[a]||(r[a]=1,e.push(i)),e},e.remove=i=>{const a=n(i);if(r[a]){r[a]=0;const o=e.indexOf(i);o>=0&&e.splice(o,1)}return e},e}async function Zl(t,n){try{await n(t)}catch(e){t.error(e)}}const Kx=Symbol("vega_id");let e9=1;function tc(t){return!(!t||!st(t))}function st(t){return t[Kx]}function Qx(t,n){return t[Kx]=n,t}function St(t){const n=t===Object(t)?t:{data:t};return st(n)?n:Qx(n,e9++)}function vp(t){return nc(t,St({}))}function nc(t,n){for(const e in t)n[e]=t[e];return n}function Zx(t,n){return Qx(n,st(t))}function Sa(t,n){return t?n?(e,r)=>t(e,r)||st(n(e))-st(n(r)):(e,r)=>t(e,r)||st(e)-st(r):null}function t2(t){return t&&t.constructor===Ma}function Ma(){const t=[],n=[],e=[],r=[],i=[];let a=null,o=!1;return{constructor:Ma,insert(s){const u=K(s),l=u.length;for(let c=0;c{p(v)&&(l[st(v)]=-1)});for(f=0,d=t.length;f0&&(y(m,p,h.value),s.modifies(p));for(f=0,d=i.length;f{p(v)&&l[st(v)]>0&&y(v,h.field,h.value)}),s.modifies(h.field);if(o)s.mod=n.length||r.length?u.filter(v=>l[st(v)]>0):u.slice();else for(g in c)s.mod.push(c[g]);return(a||a==null&&(n.length||r.length))&&s.clean(!0),s}}}const ec="_:mod:_";function rc(){Object.defineProperty(this,ec,{writable:!0,value:{}})}rc.prototype={set(t,n,e,r){const i=this,a=i[t],o=i[ec];return n!=null&&n>=0?(a[n]!==e||r)&&(a[n]=e,o[n+":"+t]=-1,o[t]=-1):(a!==e||r)&&(i[t]=e,o[t]=P(e)?1+e.length:-1),i},modified(t,n){const e=this[ec];if(!arguments.length){for(const r in e)if(e[r])return!0;return!1}if(P(t)){for(let r=0;r=0?n+1{h instanceof Ut?(h!==this&&(n&&h.targets().add(this),a.push(h)),i.push({op:h,name:f,index:d})):r.set(f,d,h)};for(o in t)if(s=t[o],o==="pulse")K(s).forEach(f=>{f instanceof Ut?f!==this&&(f.targets().add(this),a.push(f)):j("Pulse parameters must be operator instances.")}),this.source=s;else if(P(s))for(r.set(o,-1,Array(u=s.length)),l=0;l{const e=Date.now();return e-n>t?(n=e,1):0})},debounce(t){const n=Pi();return this.targets().add(Pi(null,null,Qh(t,e=>{const r=e.dataflow;n.receive(e),r&&r.run&&r.run()}))),n},between(t,n){let e=!1;return t.targets().add(Pi(null,null,()=>e=!0)),n.targets().add(Pi(null,null,()=>e=!1)),this.filter(()=>e)},detach(){this._filter=Be,this._targets=null}};const o9={skip:!0};function s9(t,n,e,r,i,a){const o=xt({},a,o9);let s,u;bt(e)||(e=In(e)),r===void 0?s=l=>t.touch(e(l)):bt(r)?(u=new Ut(null,r,i,!1),s=l=>{u.evaluate(l);const c=e(l),f=u.value;t2(f)?t.pulse(c,f,a):t.update(c,f,o)}):s=l=>t.update(e(l),r,o),n.apply(s)}function u9(t,n,e,r,i,a){if(r===void 0)n.targets().add(e);else{const o=a||{},s=new Ut(null,function(u,l){return l=bt(l)?l:In(l),u?function(c,f){const d=l(c,f);return u.skip()||(u.skip(d!==this.value).value=d),d}:l}(e,r),i,!1);s.modified(o.force),s.rank=n.rank,n.targets().add(s),e&&(s.skip(!0),s.value=e.value,s.targets().add(e),t.connect(e,[s]))}}const ac={};function ji(t,n,e){this.dataflow=t,this.stamp=n??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}function bp(t,n){const e=[];return ka(t,n,r=>e.push(r)),e}function e2(t,n){const e={};return t.visit(n,r=>{e[st(r)]=1}),r=>e[st(r)]?null:r}function oc(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function xp(t,n,e,r){const i=this;let a=0;this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e;for(const o of e)if(o.stamp===n){if(o.fields){const s=i.fields||(i.fields={});for(const u in o.fields)s[u]=1}o.changed(i.ADD)&&(a|=i.ADD),o.changed(i.REM)&&(a|=i.REM),o.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}function r2(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}ji.prototype={StopPropagation:ac,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new ji(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new ji(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,n){const e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source,t.cleans&&(e.cleans=t.cleans)),e},runAfter(t){this.dataflow.runAfter(t)},changed(t){const n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,e2(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return P(t)?t.forEach(e=>n[e]=!0):n[t]=!0,this},modified(t,n){const e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?P(t)?t.some(r=>e[r]):e[t]:!!e)},filter(t,n){const e=this;return 1&t&&(e.addF=oc(e.addF,n)),2&t&&(e.remF=oc(e.remF,n)),4&t&&(e.modF=oc(e.modF,n)),16&t&&(e.srcF=oc(e.srcF,n)),e},materialize(t){const n=this;return 1&(t=t||7)&&n.addF&&(n.add=bp(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=bp(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=bp(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(t,n){const e=this,r=n;if(16&t)return ka(e.source,e.srcF,r),e;1&t&&ka(e.add,e.addF,r),2&t&&ka(e.rem,e.remF,r),4&t&&ka(e.mod,e.modF,r);const i=e.source;if(8&t&&i){const a=e.add.length+e.mod.length;a===i.length||ka(i,a?e2(e,5):e.srcF,r)}return e}},V(xp,ji,{fork(t){const n=new ji(this.dataflow).init(this,t&this.NO_FIELDS);return t!==void 0&&(t&n.ADD&&this.visit(n.ADD,e=>n.add.push(e)),t&n.REM&&this.visit(n.REM,e=>n.rem.push(e)),t&n.MOD&&this.visit(n.MOD,e=>n.mod.push(e))),n},changed(t){return this.changes&t},modified(t){const n=this,e=n.fields;return e&&n.changes&n.MOD?P(t)?t.some(r=>e[r]):e[t]:0},filter(){j("MultiPulse does not support filtering.")},materialize(){j("MultiPulse does not support materialization.")},visit(t,n){const e=this,r=e.pulses,i=r.length;let a=0;if(t&e.SOURCE)for(;an=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),i2(n,0,n.length-1,t)),pop:()=>{const e=n.pop();let r;return n.length?(r=n[0],n[0]=e,function(i,a,o){const s=a,u=i.length,l=i[a];let c,f=1+(a<<1);for(;f=0&&(f=c),i[a]=i[f],f=1+((a=f)<<1);i[a]=l,i2(i,s,a,o)}(n,0,t)):r=e,r}}}function i2(t,n,e,r){let i,a;const o=t[e];for(;e>n&&(a=e-1>>1,i=t[a],r(o,i)<0);)t[e]=i,e=a;return t[e]=o}function $o(){this.logger(Kh()),this.logLevel(Kb),this._clock=0,this._rank=0,this._locale=Qb();try{this._loader=Hl()}catch{}this._touched=Ql(Hs),this._input={},this._pulse=null,this._heap=l9((t,n)=>t.qrank-n.qrank),this._postrun=[]}function Xs(t){return function(){return this._log[t].apply(this,arguments)}}function O(t,n){Ut.call(this,t,null,n)}$o.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Xs("error"),warn:Xs("warn"),info:Xs("info"),debug:Xs("debug"),logLevel:Xs("level"),cleanThreshold:1e4,add:function(t,n,e,r){let i,a=1;return t instanceof Ut?i=t:t&&t.prototype instanceof Ut?i=new t:bt(t)?i=new Ut(null,t):(a=0,i=new Ut(t,n)),this.rank(i),a&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},connect:function(t,n){const e=t.rank,r=n.length;for(let i=0;i=0;)n.push(e=r[i]),e===t&&j("Cycle detected in dataflow graph.")},pulse:function(t,n,e){this.touch(t,e||wp);const r=new ji(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},touch:function(t,n){const e=n||wp;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},update:function(t,n,e){const r=e||wp;return(t.set(n)||r.force)&&this.touch(t,r),this},changeset:Ma,ingest:function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},parse:function(t,n){const e=this.locale();return tx(t,n,e.timeParse,e.utcParse)},preload:async function(t,n,e){const r=this,i=r._pending||function(o){let s;const u=new Promise(l=>s=l);return u.requests=0,u.done=()=>{--u.requests===0&&(o._pending=null,s(o))},o._pending=u}(r);i.requests+=1;const a=await r.request(n,e);return r.pulse(t,r.changeset().remove(Be).insert(a.data||[])),i.done(),a},request:async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Zb(n&&n.type)});try{r=e.parse(r,n)}catch(a){i=-2,e.warn("Data ingestion failed",t,a)}}catch(a){i=-1,e.warn("Loading failed",t,a)}return{data:r,status:i}},events:function(t,n,e,r){const i=this,a=Pi(e,r),o=function(l){l.dataflow=i;try{a.receive(l)}catch(c){i.error(c)}finally{i.run()}};let s;s=typeof t=="string"&&typeof document<"u"?document.querySelectorAll(t):K(t);const u=s.length;for(let l=0;lr._enqueue(c,!0)),r._touched=Ql(Hs);let o,s,u,l=0;try{for(;r._heap.size()>0;)o=r._heap.pop(),o.rank===o.qrank?(s=o.run(r._getPulse(o,t)),s.then?s=await s:s.async&&(i.push(s.async),s=ac),s!==ac&&o._targets&&o._targets.forEach(c=>r._enqueue(c)),++l):r._enqueue(o,!0)}catch(c){r._heap.clear(),u=c}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${l} operators`),u&&(r._postrun=[],r.error(u)),r._postrun.length){const c=r._postrun.sort((f,d)=>d.priority-f.priority);r._postrun=[];for(let f=0;fr.runAsync(null,()=>{c.forEach(f=>{try{f(r)}catch(d){r.error(d)}})})),r},run:function(t,n,e){return this._pulse?r2(this):(this.evaluate(t,n,e),this)},runAsync:async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},runAfter:function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(r){this.error(r)}},_enqueue:function(t,n){const e=t.stampi.pulse),n):this._input[t.id]||function(i,a){return a&&a.stamp===i.stamp?a:(i=i.fork(),a&&a!==ac&&(i.source=a.source),i)}(this._pulse,e&&e.pulse)}},V(O,Ut,{run(t){if(t.stampthis.pulse=e):n!==t.StopPropagation&&(this.pulse=n),n},evaluate(t){const n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},transform(){}});const So={};function a2(t){const n=o2(t);return n&&n.Definition||null}function o2(t){return t=t&&t.toLowerCase(),tt(So,t)?So[t]:null}function*s2(t,n){if(n==null)for(let e of t)e!=null&&e!==""&&(e=+e)>=e&&(yield e);else{let e=-1;for(let r of t)r=n(r,++e,t),r!=null&&r!==""&&(r=+r)>=r&&(yield r)}}function Ap(t,n,e){const r=Float64Array.from(s2(t,e));return r.sort(Ws),n.map(i=>Vx(r,i))}function _p(t,n){return Ap(t,[.25,.5,.75],n)}function kp(t,n){const e=t.length,r=function(o,s){const u=function(l,c){let f,d=0,h=0,p=0;if(c===void 0)for(let m of l)m!=null&&(m=+m)>=m&&(f=m-h,h+=f/++d,p+=f*(m-h));else{let m=-1;for(let g of l)(g=c(g,++m,l))!=null&&(g=+g)>=g&&(f=g-h,h+=f/++d,p+=f*(g-h))}if(d>1)return p/(d-1)}(o,s);return u&&Math.sqrt(u)}(t,n),i=_p(t,n),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function u2(t){const n=t.maxbins||20,e=t.base||10,r=Math.log(e),i=t.divide||[5,2];let a,o,s,u,l,c,f=t.extent[0],d=t.extent[1];const h=t.span||d-f||Math.abs(f)||1;if(t.step)a=t.step;else if(t.steps){for(u=h/n,l=0,c=t.steps.length;ln;)a*=e;for(l=0,c=i.length;l=s&&h/u<=n&&(a=u)}u=Math.log(a);const p=u>=0?0:1+~~(-u/r),m=Math.pow(e,-p-1);return(t.nice||t.nice===void 0)&&(u=Math.floor(f/a+m)*a,f=fd);const i=t.length,a=new Float64Array(i);let o,s=0,u=1,l=r(t[0]),c=l,f=l+n;for(;u=f){for(c=(l+c)/2;s>1);gv;)d[g--]=d[y]}y=v,v=m}return d}(a,n+n/4):a}const f2=Math.sqrt(2*Math.PI),c9=Math.SQRT2;let Js=NaN;function sc(t,n){t=t||0,n=n??1;let e,r,i=0,a=0;if(Js==Js)i=Js,Js=NaN;else{do i=2*Ne()-1,a=2*Ne()-1,e=i*i+a*a;while(e===0||e>1);r=Math.sqrt(-2*Math.log(e)/e),i*=r,Js=a*r}return t+i*n}function Dp(t,n,e){const r=(t-(n||0))/(e=e??1);return Math.exp(-.5*r*r)/(e*f2)}function uc(t,n,e){const r=(t-(n=n||0))/(e=e??1),i=Math.abs(r);let a;if(i>37)a=0;else{const o=Math.exp(-i*i/2);let s;i<7.07106781186547?(s=.0352624965998911*i+.700383064443688,s=s*i+6.37396220353165,s=s*i+33.912866078383,s=s*i+112.079291497871,s=s*i+221.213596169931,s=s*i+220.206867912376,a=o*s,s=.0883883476483184*i+1.75566716318264,s=s*i+16.064177579207,s=s*i+86.7807322029461,s=s*i+296.564248779674,s=s*i+637.333633378831,s=s*i+793.826512519948,s=s*i+440.413735824752,a/=s):(s=i+.65,s=i+4/s,s=i+3/s,s=i+2/s,s=i+1/s,a=o/s/2.506628274631)}return r>0?1-a:a}function lc(t,n,e){return t<0||t>1?NaN:(n||0)+(e??1)*c9*function(r){let i,a=-Math.log((1-r)*(1+r));return a<6.25?(a-=3.125,i=-364441206401782e-35,i=i*a-16850591381820166e-35,i=128584807152564e-32+i*a,i=11157877678025181e-33+i*a,i=i*a-1333171662854621e-31,i=20972767875968562e-33+i*a,i=6637638134358324e-30+i*a,i=i*a-4054566272975207e-29,i=i*a-8151934197605472e-29,i=26335093153082323e-28+i*a,i=i*a-12975133253453532e-27,i=i*a-5415412054294628e-26,i=10512122733215323e-25+i*a,i=i*a-4112633980346984e-24,i=i*a-29070369957882005e-24,i=42347877827932404e-23+i*a,i=i*a-13654692000834679e-22,i=i*a-13882523362786469e-21,i=.00018673420803405714+i*a,i=i*a-.000740702534166267,i=i*a-.006033670871430149,i=.24015818242558962+i*a,i=1.6536545626831027+i*a):a<16?(a=Math.sqrt(a)-3.25,i=22137376921775787e-25,i=9075656193888539e-23+i*a,i=i*a-27517406297064545e-23,i=18239629214389228e-24+i*a,i=15027403968909828e-22+i*a,i=i*a-4013867526981546e-21,i=29234449089955446e-22+i*a,i=12475304481671779e-21+i*a,i=i*a-47318229009055734e-21,i=6828485145957318e-20+i*a,i=24031110387097894e-21+i*a,i=i*a-.0003550375203628475,i=.0009532893797373805+i*a,i=i*a-.0016882755560235047,i=.002491442096107851+i*a,i=i*a-.003751208507569241,i=.005370914553590064+i*a,i=1.0052589676941592+i*a,i=3.0838856104922208+i*a):Number.isFinite(a)?(a=Math.sqrt(a)-5,i=-27109920616438573e-27,i=i*a-2555641816996525e-25,i=15076572693500548e-25+i*a,i=i*a-3789465440126737e-24,i=761570120807834e-23+i*a,i=i*a-1496002662714924e-23,i=2914795345090108e-23+i*a,i=i*a-6771199775845234e-23,i=22900482228026655e-23+i*a,i=i*a-99298272942317e-20,i=4526062597223154e-21+i*a,i=i*a-1968177810553167e-20,i=7599527703001776e-20+i*a,i=i*a-.00021503011930044477,i=i*a-.00013871931833623122,i=1.0103004648645344+i*a,i=4.849906401408584+i*a):i=1/0,i*r}(2*t-1)}function Fp(t,n){let e,r;const i={mean(a){return arguments.length?(e=a||0,i):e},stdev(a){return arguments.length?(r=a??1,i):r},sample:()=>sc(e,r),pdf:a=>Dp(a,e,r),cdf:a=>uc(a,e,r),icdf:a=>lc(a,e,r)};return i.mean(t).stdev(n)}function Cp(t,n){const e=Fp();let r=0;const i={data(a){return arguments.length?(t=a,r=a?a.length:0,i.bandwidth(n)):t},bandwidth(a){return arguments.length?(!(n=a)&&t&&(n=kp(t)),i):n},sample:()=>t[~~(Ne()*r)]+n*e.sample(),pdf(a){let o=0,s=0;for(;sEp(e,r),pdf:a=>$p(a,e,r),cdf:a=>Sp(a,e,r),icdf:a=>Mp(a,e,r)};return i.mean(t).stdev(n)}function h2(t,n){let e,r=0;const i={weights(a){return arguments.length?(e=function(o){const s=[];let u,l=0;for(u=0;u=n&&t<=e?1/(e-n):0}function Op(t,n,e){return e==null&&(e=n??1,n=0),te?1:(t-n)/(e-n)}function Np(t,n,e){return e==null&&(e=n??1,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function p2(t,n){let e,r;const i={min(a){return arguments.length?(e=a||0,i):e},max(a){return arguments.length?(r=a??1,i):r},sample:()=>Bp(e,r),pdf:a=>zp(a,e,r),cdf:a=>Op(a,e,r),icdf:a=>Np(a,e,r)};return n==null&&(n=t??1,t=0),i.min(t).max(n)}function Rp(t,n,e){let r=0,i=0;for(const a of t){const o=e(a);n(a)==null||o==null||isNaN(o)||(r+=(o-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function Ks(t,n,e,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-a*t,a]}function cc(t,n,e,r){t=t.filter(h=>{let p=n(h),m=e(h);return p!=null&&(p=+p)>=p&&m!=null&&(m=+m)>=m}),r&&t.sort((h,p)=>n(h)-n(p));const i=t.length,a=new Float64Array(i),o=new Float64Array(i);let s,u,l,c=0,f=0,d=0;for(l of t)a[c]=s=+n(l),o[c]=u=+e(l),++c,f+=(s-f)/c,d+=(u-d)/c;for(c=0;c=i&&a!=null&&(a=+a)>=a&&r(i,a,++o)}function Mo(t,n,e,r,i){let a=0,o=0;return Qs(t,n,e,(s,u)=>{const l=u-i(s),c=u-r;a+=l*l,o+=c*c}),1-a/o}function Tp(t,n,e){let r=0,i=0,a=0,o=0,s=0;Qs(t,n,e,(c,f)=>{++s,r+=(c-r)/s,i+=(f-i)/s,a+=(c*f-a)/s,o+=(c*c-o)/s});const u=Ks(r,i,a,o),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Mo(t,n,e,i,l)}}function m2(t,n,e){let r=0,i=0,a=0,o=0,s=0;Qs(t,n,e,(c,f)=>{++s,c=Math.log(c),r+=(c-r)/s,i+=(f-i)/s,a+=(c*f-a)/s,o+=(c*c-o)/s});const u=Ks(r,i,a,o),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Mo(t,n,e,i,l)}}function g2(t,n,e){const[r,i,a,o]=cc(t,n,e);let s,u,l,c=0,f=0,d=0,h=0,p=0;Qs(t,n,e,(v,x)=>{s=r[p++],u=Math.log(x),l=s*x,c+=(x*u-c)/p,f+=(l-f)/p,d+=(l*u-d)/p,h+=(s*l-h)/p});const[m,g]=Ks(f/o,c/o,d/o,h/o),y=v=>Math.exp(m+g*(v-a));return{coef:[Math.exp(m-g*a),g],predict:y,rSquared:Mo(t,n,e,o,y)}}function y2(t,n,e){let r=0,i=0,a=0,o=0,s=0,u=0;Qs(t,n,e,(f,d)=>{const h=Math.log(f),p=Math.log(d);++u,r+=(h-r)/u,i+=(p-i)/u,a+=(h*p-a)/u,o+=(h*h-o)/u,s+=(d-s)/u});const l=Ks(r,i,a,o),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Mo(t,n,e,s,c)}}function Pp(t,n,e){const[r,i,a,o]=cc(t,n,e),s=r.length;let u,l,c,f,d=0,h=0,p=0,m=0,g=0;for(u=0;ux*(_-=a)*_+b*_+w+o;return{coef:[w-b*a+x*a*a+o,b-2*x*a,x],predict:A,rSquared:Mo(t,n,e,o,A)}}function v2(t,n,e,r){if(r===0)return Rp(t,n,e);if(r===1)return Tp(t,n,e);if(r===2)return Pp(t,n,e);const[i,a,o,s]=cc(t,n,e),u=i.length,l=[],c=[],f=r+1;let d,h,p,m,g;for(d=0;dMath.abs(x[A][F])&&(F=_);for(k=A;k=A;k--)x[k][_]-=x[k][A]*x[A][_]/x[A][A]}for(_=b-1;_>=0;--_){for(C=0,k=_+1;k{x-=o;let b=s+y[0]+y[1]*x+y[2]*x*x;for(d=3;d=0;--a)for(s=n[a],u=1,i[a]+=s,o=1;o<=a;++o)u*=(a+1-o)/o,i[a-o]+=s*Math.pow(e,o)*u;return i[0]+=r,i}function b2(t,n,e,r){const[i,a,o,s]=cc(t,n,e,!0),u=i.length,l=Math.max(2,~~(r*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=2;){const p=[0,l-1];for(let g=0;gi[x]-y?v:x;let w=0,A=0,_=0,k=0,F=0;const C=1/Math.abs(i[b]-y||1);for(let $=v;$<=x;++$){const M=i[$],S=a[$],B=d9(Math.abs(y-M)*C)*d[$],z=M*B;w+=B,A+=z,_+=S*B,k+=S*z,F+=M*z}const[D,E]=Ks(A/w,_/w,k/w,F/w);c[g]=D+E*y,f[g]=Math.abs(a[g]-c[g]),h9(i,g+1,p)}if(h===2)break;const m=Yx(f);if(Math.abs(m)<1e-12)break;for(let g,y,v=0;v=1?1e-12:(y=1-g*g)*y}return function(h,p,m,g){const y=h.length,v=[];let x,b=0,w=0,A=[];for(;b=t.length))for(;n>i&&t[a]-r<=r-t[i];)e[0]=++i,e[1]=a,++a}const p9=.5*Math.PI/180;function fc(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=m=>[m,t(m)],a=n[0],o=n[1],s=o-a,u=s/r,l=[i(a)],c=[];if(e===r){for(let m=1;m0;)c.push(i(a+m/e*s));let f=l[0],d=c[c.length-1];const h=1/s,p=function(m,g){let y=m,v=m;const x=g.length;for(let b=0;bv&&(v=w)}return 1/(v-y)}(f[1],c);for(;d;){const m=i((f[0]+d[0])/2);m[0]-f[0]>=u&&m9(f,m,d,h,p)>p9?c.push(m):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function m9(t,n,e,r,i){const a=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0])),o=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0]));return Math.abs(a-o)}function jp(t){return t&&t.length?t.length===1?t[0]:(n=t,e=>{const r=n.length;let i=1,a=String(n[0](e));for(;i{},g9={init:Lp,add:Lp,rem:Lp,idx:0},Zs={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.valid?t.sum:void 0,add:(t,n)=>t.sum+=+n,rem:(t,n)=>t.sum-=n},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,n)=>t.product*=n,rem:(t,n)=>t.product/=n},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,n)=>(t.mean_d=n-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,n)=>(t.mean_d=n-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,n)=>t.dev+=t.mean_d*(n-t.mean),rem:(t,n)=>t.dev-=t.mean_d*(n-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,n)=>{(n{n<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,n)=>{(n>t.max||t.max===void 0)&&(t.max=n)},rem:(t,n)=>{n>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,n,e)=>{n{n<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,n,e)=>{n>t.max&&(t.argmax=e)},rem:(t,n)=>{n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,n)=>{t.exp=0,t.exp_r=n},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,n)=>t.exp=t.exp_r*t.exp+n,rem:(t,n)=>t.exp=(t.exp-n/t.exp_r**(t.valid-1))/t.exp_r},exponentialb:{value:t=>t.valid?t.exp*(1-t.exp_r):void 0,req:["exponential"],idx:1}},tu=Object.keys(Zs).filter(t=>t!=="__count__");function w2(t,n,e){return Zs[t](e,n)}function A2(t,n){return t.idx-n.idx}function y9(){this.valid=0,this.missing=0,this._ops.forEach(t=>t.aggregate_param==null?t.init(this):t.init(this,t.aggregate_param))}function v9(t,n){t!=null&&t!==""?t==t&&(++this.valid,this._ops.forEach(e=>e.add(this,t,n))):++this.missing}function b9(t,n){t!=null&&t!==""?t==t&&(--this.valid,this._ops.forEach(e=>e.rem(this,t,n))):--this.missing}function x9(t){return this._out.forEach(n=>t[n.out]=n.value(this)),t}function _2(t,n){const e=n||Me,r=function(o){const s={};o.forEach(l=>s[l.name]=l);const u=l=>{l.req&&l.req.forEach(c=>{s[c]||u(s[c]=Zs[c]())})};return o.forEach(u),Object.values(s).sort(A2)}(t),i=t.slice().sort(A2);function a(o){this._ops=r,this._out=i,this.cell=o,this.init()}return a.prototype.init=y9,a.prototype.add=v9,a.prototype.rem=b9,a.prototype.set=x9,a.prototype.get=e,a.fields=t.map(o=>o.out),a}function qp(t){this._key=t?ei(t):st,this.reset()}[...tu,"__count__"].forEach(t=>{Zs[t]=function(n,e){return(r,i)=>xt({name:n,aggregate_param:i,out:r||n},g9,e)}(t,Zs[t])});const kn=qp.prototype;function Li(t){O.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}kn.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},kn.add=function(t){this._add.push(t)},kn.rem=function(t){this._rem.push(t)},kn.values=function(){if(this._get=null,this._rem.length===0)return this._add;const t=this._add,n=this._rem,e=this._key,r=t.length,i=n.length,a=Array(r-i),o={};let s,u,l;for(s=0;s=0;)r=t(n[i])+"",tt(e,r)||(e[r]=1,++a);return a},kn.extent=function(t){if(this._get!==t||!this._ext){const n=this.values(),e=sx(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},kn.argmin=function(t){return this.extent(t)[0]||{}},kn.argmax=function(t){return this.extent(t)[1]||{}},kn.min=function(t){const n=this.extent(t)[0];return n!=null?t(n):void 0},kn.max=function(t){const n=this.extent(t)[1];return n!=null?t(n):void 0},kn.quartile=function(t){return this._get===t&&this._q||(this._q=_p(this.values(),t),this._get=t),this._q},kn.q1=function(t){return this.quartile(t)[0]},kn.q2=function(t){return this.quartile(t)[1]},kn.q3=function(t){return this.quartile(t)[2]},kn.ci=function(t){return this._get===t&&this._ci||(this._ci=l2(this.values(),1e3,.05,t),this._get=t),this._ci},kn.ci0=function(t){return this.ci(t)[0]},kn.ci1=function(t){return this.ci(t)[1]},Li.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:tu},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},V(Li,O,{transform(t,n){const e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):Object.create(null),n.visit(n.SOURCE,a=>e.add(a))):(e.value=e.value||e.init(t),n.visit(n.REM,a=>e.rem(a)),n.visit(n.ADD,a=>e.add(a))),r.modifies(e._outputs),e._drop=t.drop!==!1,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),n.clean()&&e._drop&&r.clean(!0).runAfter(()=>this.clean()),e.changes(r)},cross(){const t=this,n=t.value,e=t._dnames,r=e.map(()=>({})),i=e.length;function a(o){let s,u,l,c;for(s in o)for(l=o[s].tuple,u=0;u{const x=en(v);return i(v),e.push(x),x}),this.cellkey=t.key?t.key:jp(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const a=t.fields||[null],o=t.ops||["count"],s=t.aggregate_params||[null],u=t.as||[],l=a.length,c={};let f,d,h,p,m,g,y;for(l!==o.length&&j("Unmatched number of fields and aggregate ops."),y=0;y_2(v,v.field)),Object.create(null)},cellkey:jp(),cell(t,n){let e=this.value[t];return e?e.num===0&&this._drop&&e.stampa.push(u),remove:u=>o[r(u)]=++s,size:()=>i.length,data:(u,l)=>(s&&(i=i.filter(c=>!o[r(c)]),o={},s=0),l&&u&&i.sort(u),a.length&&(i=u?ox(u,i,a.sort(u)):i.concat(a),a=[]),i)}}function Ip(t){O.call(this,[],t)}function D2(t){Ut.call(this,null,w9,t)}function w9(t){return this.value&&!t.modified()?this.value:ep(t.fields,t.orders)}function Wp(t){O.call(this,null,t)}function Hp(t){O.call(this,null,t)}Up.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},V(Up,O,{transform(t,n){const e=t.interval!==!1,r=this._bins(t),i=r.start,a=r.step,o=t.as||["bin0","bin1"],s=o[0],u=o[1];let l;return l=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(Wn(t.field))?n.ADD_MOD:n.ADD,n.visit(l,e?c=>{const f=r(c);c[s]=f,c[u]=f==null?null:i+a*(1+(f-i)/a)}:c=>c[s]=r(c)),n.modifies(e?o:s)},_bins(t){if(this.value&&!t.modified())return this.value;const n=t.field,e=u2(t),r=e.step;let i,a,o=e.start,s=o+Math.ceil((e.stop-o)/r)*r;(i=t.anchor)!=null&&(a=i-(o+r*Math.floor((i-o)/r)),o+=a,s+=a);const u=function(l){let c=ze(n(l));return c==null?null:cs?1/0:(c=Math.max(o,Math.min(c,s-r)),o+r*Math.floor(1e-14+(c-o)/r))};return u.start=o,u.stop=e.stop,u.step=r,this.value=Do(u,Wn(n),t.name||"bin_"+en(n))}}),Ip.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},V(Ip,O,{transform(t,n){const e=n.fork(n.ALL),r=k2(st,this.value,e.materialize(e.ADD).add),i=t.sort,a=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(a),this.value=e.source=r.data(Sa(i),a),n.source&&n.source.root&&(this.value.root=n.source.root),e}}),V(D2,Ut),Wp.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},V(Wp,O,{transform(t,n){const e=f=>d=>{for(var h,p=function(y,v,x){switch(v){case"upper":y=y.toUpperCase();break;case"lower":y=y.toLowerCase()}return y.match(x)}(s(d),t.case,a)||[],m=0,g=p.length;mi[f]=1+(i[f]||0)),c=e(f=>i[f]-=1);return r?n.visit(n.SOURCE,l):(n.visit(n.ADD,l),n.visit(n.REM,c)),this._finish(n,u)},_parameterCheck(t,n){let e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},_finish(t,n){const e=this._counts,r=this._tuples||(this._tuples={}),i=n[0],a=n[1],o=t.fork(t.NO_SOURCE|t.NO_FIELDS);let s,u,l;for(s in e)u=r[s],l=e[s]||0,!u&&l?(r[s]=u=St({}),u[i]=s,u[a]=l,o.add.push(u)):l===0?(u&&o.rem.push(u),e[s]=null,r[s]=null):u[a]!==l&&(u[a]=l,o.mod.push(u));return o.modifies(n)}}),Hp.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},V(Hp,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.as||["a","b"],i=r[0],a=r[1],o=!this.value||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter");let s=this.value;return o?(s&&(e.rem=s),s=n.materialize(n.SOURCE).source,e.add=this.value=function(u,l,c,f){for(var d,h,p=[],m={},g=u.length,y=0;yE2(a,n))):typeof r[i]===C2&&r[i](t[i]);return r}function Gp(t){O.call(this,null,t)}const $2=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],A9={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:$2},{name:"weights",type:"number",array:!0}]};function S2(t,n){return t?t.map((e,r)=>n[r]||en(e)):null}function Vp(t,n,e){const r=[],i=f=>f(u);let a,o,s,u,l,c;if(n==null)r.push(t.map(e));else for(a={},o=0,s=t.length;ol.materialize(l.SOURCE).source}(n)),i=t.steps||t.minsteps||25,a=t.steps||t.maxsteps||200;let o=t.method||"pdf";o!=="pdf"&&o!=="cdf"&&j("Invalid density method: "+o),t.extent||r.data||j("Missing density extent parameter."),o=r[o];const s=t.as||["value","density"],u=fc(o,t.extent||kr(r.data()),i,a).map(l=>{const c={};return c[s[0]]=l[0],c[s[1]]=l[1],St(c)});this.value&&(e.rem=this.value),this.value=e.add=e.source=u}return e}});function Yp(t){O.call(this,null,t)}Yp.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function M2(t){Ut.call(this,null,_9,t),this.modified(!0)}function _9(t){const n=t.expr;return this.value&&!t.modified("expr")?this.value:Do(e=>n(e,t),Wn(n),en(n))}function Xp(t){O.call(this,[void 0,void 0],t)}function Jp(t,n){Ut.call(this,t),this.parent=n,this.count=0}function dc(t){O.call(this,{},t),this._keys=Fo();const n=this._targets=[];n.active=0,n.forEach=e=>{for(let r=0,i=n.active;rei(n)):ei(t.name,t.as)}function Kp(t){O.call(this,Fo(),t)}function Qp(t){O.call(this,[],t)}function Zp(t){O.call(this,[],t)}function tm(t){O.call(this,null,t)}function z2(t){O.call(this,[],t)}V(Yp,O,{transform(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=Vp(n.source,t.groupby,Me),i=t.smooth||!1,a=t.field,o=t.step||((p,m)=>Gl(kr(p,m))/30)(e,a),s=Sa((p,m)=>a(p)-a(m)),u=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,h=0;for(;hd&&(d=m),p[++c][u]=m}return this.value={start:f,stop:d,step:o},n.reflow(!0).modifies(u)}}),V(M2,Ut),Xp.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},V(Xp,O,{transform(t,n){const e=this.value,r=t.field,i=n.changed()||n.modified(r.fields)||t.modified("field");let a=e[0],o=e[1];if((i||a==null)&&(a=1/0,o=-1/0),n.visit(i?n.SOURCE:n.ADD,s=>{const u=ze(r(s));u!=null&&(uo&&(o=u))}),!Number.isFinite(a)||!Number.isFinite(o)){let s=en(r);s&&(s=` for field "${s}"`),n.dataflow.warn(`Infinite extent${s}: [${a}, ${o}]`),a=o=void 0}this.value=[a,o]}}),V(Jp,Ut,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),V(dc,O,{activate(t){this._targets[this._targets.active++]=t},subflow(t,n,e,r){const i=this.value;let a,o,s=tt(i,t)&&i[t];return s?s.value.stampr&&r.count>0);this.initTargets(e)}},initTargets(t){const n=this._targets,e=n.length,r=t?t.length:0;let i=0;for(;ithis.subflow(u,i,n);return this._group=t.group||{},this.initTargets(),n.visit(n.REM,u=>{const l=st(u),c=a.get(l);c!==void 0&&(a.delete(l),s(c).rem(u))}),n.visit(n.ADD,u=>{const l=r(u);a.set(st(u),l),s(l).add(u)}),o||n.modified(r.fields)?n.visit(n.MOD,u=>{const l=st(u),c=a.get(l),f=r(u);c===f?s(f).mod(u):(a.set(l,f),s(c).rem(u),s(f).add(u))}):n.changed(n.MOD)&&n.visit(n.MOD,u=>{s(a.get(st(u))).mod(u)}),o&&n.visit(n.REFLOW,u=>{const l=st(u),c=a.get(l),f=r(u);c!==f&&(a.set(l,f),s(c).rem(u),s(f).add(u))}),n.clean()?e.runAfter(()=>{this.clean(),a.clean()}):a.empty>e.cleanThreshold&&e.runAfter(a.clean),n}}),V(B2,Ut),Kp.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},V(Kp,O,{transform(t,n){const e=n.dataflow,r=this.value,i=n.fork(),a=i.add,o=i.rem,s=i.mod,u=t.expr;let l=!0;function c(f){const d=st(f),h=u(f,t),p=r.get(d);h&&p?(r.delete(d),a.push(f)):h||p?l&&h&&!p&&s.push(f):(r.set(d,1),o.push(f))}return n.visit(n.REM,f=>{const d=st(f);r.has(d)?r.delete(d):o.push(f)}),n.visit(n.ADD,f=>{u(f,t)?a.push(f):r.set(st(f),1)}),n.visit(n.MOD,c),t.modified()&&(l=!1,n.visit(n.REFLOW,c)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i}}),Qp.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},V(Qp,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=S2(r,t.as||[]),a=t.index||null,o=i.length;return e.rem=this.value,n.visit(n.SOURCE,s=>{const u=r.map(p=>p(s)),l=u.reduce((p,m)=>Math.max(p,m.length),0);let c,f,d,h=0;for(;h{for(let c,f=0;fo[r]=e(o,t))}}),V(z2,O,{transform(t,n){const e=n.fork(n.ALL),r=t.generator;let i,a,o,s=this.value,u=t.size-s.length;if(u>0){for(i=[];--u>=0;)i.push(o=St(r(t))),s.push(o);e.add=e.add.length?e.materialize(e.ADD).add.concat(i):i}else a=s.slice(0,-u),e.rem=e.rem.length?e.materialize(e.REM).rem.concat(a):a,s=s.slice(-u);return e.source=this.value=s,e}});const hc={value:"value",median:Yx,mean:function(t,n){let e=0,r=0;if(n===void 0)for(let i of t)i!=null&&(i=+i)>=i&&(++e,r+=i);else{let i=-1;for(let a of t)(a=n(a,++i,t))!=null&&(a=+a)>=a&&(++e,r+=a)}if(e)return r/e},min:cp,max:Ca},D9=[];function nm(t){O.call(this,[],t)}function em(t){Li.call(this,t)}function rm(t){O.call(this,null,t)}function O2(t){Ut.call(this,null,F9,t)}function F9(t){return this.value&&!t.modified()?this.value:rp(t.fields,t.flat)}function N2(t){O.call(this,[],t),this._pending=null}function im(t,n,e){e.forEach(St);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r.rem.length&&r.clean(!0),r}function am(t){O.call(this,{},t)}function R2(t){Ut.call(this,null,C9,t)}function C9(t){if(this.value&&!t.modified())return this.value;const n=t.extents,e=n.length;let r,i,a=1/0,o=-1/0;for(r=0;ro&&(o=i[1]);return[a,o]}function T2(t){Ut.call(this,null,E9,t)}function E9(t){return this.value&&!t.modified()?this.value:t.values.reduce((n,e)=>n.concat(e),[])}function P2(t){O.call(this,null,t)}function om(t){Li.call(this,t)}function j2(t){dc.call(this,t)}function sm(t){O.call(this,null,t)}function L2(t){O.call(this,null,t)}function um(t){O.call(this,null,t)}nm.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},V(nm,O,{transform(t,n){var e,r,i,a,o,s,u,l,c,f,d=n.fork(n.ALL),h=function(A){var _,k=A.method||hc.value;if(hc[k]!=null)return k===hc.value?(_=A.value!==void 0?A.value:0,()=>_):hc[k];j("Unrecognized imputation method: "+k)}(t),p=function(A){const _=A.field;return k=>k?_(k):NaN}(t),m=en(t.field),g=en(t.key),y=(t.groupby||[]).map(en),v=function(A,_,k,F){var C,D,E,$,M,S,B,z,N=ot=>ot(z),W=[],X=F?F.slice():[],L={},et={};for(X.forEach((ot,nt)=>L[ot]=nt+1),$=0,B=A.length;$e.add(a))):(i=e.value=e.value||this.init(t),n.visit(n.REM,a=>e.rem(a)),n.visit(n.ADD,a=>e.add(a))),e.changes(),n.visit(n.SOURCE,a=>{xt(a,i[e.cellkey(a)].tuple)}),n.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,n=this._mods;let e,r;for(e=0,r=this._alen;e{const p=Cp(h,o)[s],m=t.counts?h.length:1;fc(p,c||kr(h),f,d).forEach(g=>{const y={};for(let v=0;v(this._pending=K(i.data),a=>a.touch(this)))}:e.request(t.url,t.format).then(r=>im(this,n,K(r.data)))}}),am.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},V(am,O,{transform(t,n){const e=t.fields,r=t.index,i=t.values,a=t.default==null?null:t.default,o=t.modified(),s=e.length;let u,l,c,f=o?n.SOURCE:n.ADD,d=n,h=t.as;return i?(l=i.length,s>1&&!h&&j('Multi-field lookup requires explicit "as" parameter.'),h&&h.length!==s*l&&j('The "as" parameter has too few output field names.'),h=h||i.map(en),u=function(p){for(var m,g,y=0,v=0;yn.modified(p.fields)),f|=c?n.MOD:0),n.visit(f,u),d.modifies(h)}}),V(R2,Ut),V(T2,Ut),V(P2,O,{transform(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),om.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:tu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},V(om,Li,{_transform:Li.prototype.transform,transform(t,n){return this._transform(function(e,r){const i=e.field,a=e.value,o=(e.op==="count"?"__count__":e.op)||"sum",s=Wn(i).concat(Wn(a)),u=function(l,c,f){const d={},h=[];return f.visit(f.SOURCE,p=>{const m=l(p);d[m]||(d[m]=1,h.push(m))}),h.sort(Zh),c?h.slice(0,c):h}(i,e.limit||0,r);return r.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:u.map(()=>o),fields:u.map(l=>function(c,f,d,h){return Do(p=>f(p)===c?d(p):NaN,h,c+"")}(l,i,a,s)),as:u.map(l=>l+""),modified:e.modified.bind(e)}}(t,n),n)}}),V(j2,dc,{transform(t,n){const e=t.subflow,r=t.field,i=a=>this.subflow(st(a),e,n,a);return(t.modified("field")||r&&n.modified(Wn(r)))&&j("PreFacet does not support field modification."),this.initTargets(),r?(n.visit(n.MOD,a=>{const o=i(a);r(a).forEach(s=>o.mod(s))}),n.visit(n.ADD,a=>{const o=i(a);r(a).forEach(s=>o.add(St(s)))}),n.visit(n.REM,a=>{const o=i(a);r(a).forEach(s=>o.rem(s))})):(n.visit(n.MOD,a=>i(a).mod(a)),n.visit(n.ADD,a=>i(a).add(a)),n.visit(n.REM,a=>i(a).rem(a))),n.clean()&&n.runAfter(()=>this.clean()),n}}),sm.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},V(sm,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=S2(t.fields,t.as||[]),a=r?(s,u)=>function(l,c,f,d){for(let h=0,p=f.length;h{const u=st(s);e.rem.push(o[u]),o[u]=null}),n.visit(n.ADD,s=>{const u=a(s,St({}));o[st(s)]=u,e.add.push(u)}),n.visit(n.MOD,s=>{e.mod.push(a(s,o[st(s)]))}),e}}),V(L2,O,{transform(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}}),um.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function q2(t){O.call(this,null,t)}function lm(t){O.call(this,[],t),this.count=0}function cm(t){O.call(this,null,t)}function U2(t){O.call(this,null,t),this.modified(!0)}function fm(t){O.call(this,null,t)}V(um,O,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return e.source=this.value,e;const i=Vp(n.materialize(n.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(en),o=[],s=t.step||.01,u=t.probs||xe(s/2,1-1e-14,s),l=u.length;return i.forEach(c=>{const f=Ap(c,u);for(let d=0;d{const a=st(i);e.rem.push(r[a]),r[a]=null}),n.visit(n.ADD,i=>{const a=vp(i);r[st(i)]=a,e.add.push(a)}),n.visit(n.MOD,i=>{const a=r[st(i)];for(const o in i)a[o]=i[o],e.modifies(o);e.mod.push(a)})),e}}),lm.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},V(lm,O,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.modified("size"),i=t.size,a=this.value.reduce((c,f)=>(c[st(f)]=1,c),{});let o=this.value,s=this.count,u=0;function l(c){let f,d;o.length=u&&(f=o[d],a[st(f)]&&e.rem.push(f),o[d]=c)),++s}if(n.rem.length&&(n.visit(n.REM,c=>{const f=st(c);a[f]&&(a[f]=-1,e.rem.push(c)),--s}),o=o.filter(c=>a[st(c)]!==-1)),(n.rem.length||r)&&o.length{a[st(c)]||l(c)}),u=-1),r&&o.length>i){const c=o.length-i;for(let f=0;f{a[st(c)]&&e.mod.push(c)}),n.add.length&&n.visit(n.ADD,l),(n.add.length||u<0)&&(e.add=o.filter(c=>!a[st(c)])),this.count=s,this.value=e.source=o,e}}),cm.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},V(cm,O,{transform(t,n){if(this.value&&!t.modified())return;const e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=xe(t.start,t.stop,t.step||1).map(i=>{const a={};return a[r]=i,St(a)}),e.add=n.add.concat(this.value),e}}),V(U2,O,{transform(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});const I2=["unit0","unit1"];function W2(t){O.call(this,Fo(),t)}function H2(t){O.call(this,null,t)}fm.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:ux,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:I2}]},V(fm,O,{transform(t,n){const e=t.field,r=t.interval!==!1,i=t.timezone==="utc",a=this._floor(t,n),o=(i?tp:np)(a.unit).offset,s=t.as||I2,u=s[0],l=s[1],c=a.step;let f=a.start||1/0,d=a.stop||-1/0,h=n.ADD;return(t.modified()||n.changed(n.REM)||n.modified(Wn(e)))&&(h=(n=n.reflow(!0)).SOURCE,f=1/0,d=-1/0),n.visit(h,p=>{const m=e(p);let g,y;m==null?(p[u]=null,r&&(p[l]=null)):(p[u]=g=y=a(m),r&&(p[l]=y=o(g,c)),gd&&(d=y))}),a.start=f,a.stop=d,n.modifies(r?s:u)},_floor(t,n){const e=t.timezone==="utc",{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:nx({extent:t.extent||kr(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),a=ex(r),o=this.value||{},s=(e?rx:ix)(a,i);return s.unit=Bt(a),s.units=a,s.step=i,s.start=o.start,s.stop=o.stop,this.value=s}}),V(W2,O,{transform(t,n){const e=n.dataflow,r=t.field,i=this.value,a=s=>i.set(r(s),s);let o=!0;return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,a)):n.changed()?(n.visit(n.REM,s=>i.delete(r(s))),n.visit(n.ADD,a)):o=!1,this.modified(o),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()}}),V(H2,O,{transform(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(Sa(t.sort)):n.source).map(t.field))}});const nu={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){const t=nu.rank(),n=t.next;return{init:t.init,next:e=>(n(e)-1)/(e.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{const e=n.data,r=n.compare;let i=n.index;if(t0||j("ntile num must be greater than zero.");const e=nu.cume_dist(),r=e.next;return{init:e.init,next:i=>Math.ceil(n*r(i))}},lag:function(t,n){return n=+n||1,{next:e=>{const r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{const r=e.index+n,i=e.data;return rt(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||j("nth_value nth must be greater than zero."),{next:e=>{const r=e.i0+(n-1);return rn=null,next:e=>{const r=t(e.data[e.index]);return r!=null?n=r:n}}},next_value:function(t){let n,e;return{init:()=>(n=null,e=-1),next:r=>{const i=r.data;return r.index<=e?n:(e=function(a,o,s){for(let u=o.length;su[m]=1)}h(t.sort),n.forEach((p,m)=>{const g=e[m],y=r[m],v=i[m]||null,x=en(g),b=x2(p,x,a[m]);if(h(g),o.push(b),tt(nu,p))s.push(function(w,A,_,k){const F=nu[w](A,_);return{init:F.init||ip,update:function(C,D){D[k]=F.next(C)}}}(p,g,y,b));else{if(g==null&&p!=="count"&&j("Null aggregate field specified."),p==="count")return void c.push(b);d=!1;let w=l[x];w||(w=l[x]=[],w.field=g,f.push(w)),w.push(w2(p,v,b))}}),(c.length||f.length)&&(this.cell=function(p,m,g){p=p.map(A=>_2(A,A.field));const y={num:0,agg:null,store:!1,count:m};if(!g)for(var v=p.length,x=y.agg=Array(v),b=0;b0&&!i(a[e],a[e-1])&&(t.i0=n.left(a,a[e])),rt.init()),this.cell&&this.cell.init()},V2.update=function(t,n){const e=this.cell,r=this.windows,i=t.data,a=r&&r.length;let o;if(e){for(o=t.p0;othis.group(i(s));let o=this.state;o&&!e||(o=this.state=new G2(t)),e||n.modified(o.inputs)?(this.value={},n.visit(n.SOURCE,s=>a(s).add(s))):(n.visit(n.REM,s=>a(s).remove(s)),n.visit(n.ADD,s=>a(s).add(s)));for(let s=0,u=this._mlen;s=h;--p)s.point(x[p],b[p]);s.lineEnd(),s.areaEnd()}v&&(x[d]=+t(m,d,f),b[d]=+n(m,d,f),s.point(r?+r(m,d,f):x[d],e?+e(m,d,f):b[d]))}if(g)return s=null,g+""||null}function c(){return Wx().defined(i).curve(o).context(a)}return t=typeof t=="function"?t:t===void 0?B8:Hn(+t),n=typeof n=="function"?n:Hn(n===void 0?0:+n),e=typeof e=="function"?e:e===void 0?z8:Hn(+e),l.x=function(f){return arguments.length?(t=typeof f=="function"?f:Hn(+f),r=null,l):t},l.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Hn(+f),l):t},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Hn(+f),l):r},l.y=function(f){return arguments.length?(n=typeof f=="function"?f:Hn(+f),e=null,l):n},l.y0=function(f){return arguments.length?(n=typeof f=="function"?f:Hn(+f),l):n},l.y1=function(f){return arguments.length?(e=f==null?null:typeof f=="function"?f:Hn(+f),l):e},l.lineX0=l.lineY0=function(){return c().x(t).y(n)},l.lineY1=function(){return c().x(t).y(e)},l.lineX1=function(){return c().x(r).y(n)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Hn(!!f),l):i},l.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),l):o},l.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),l):a},l}const O9={draw(t,n){const e=O8(n/R8);t.moveTo(e,0),t.arc(0,0,e,0,N8)}};function qi(t,n){if(typeof document<"u"&&document.createElement){const e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}const N9=()=>typeof Image<"u"?Image:null;var X2=-.14861,hm=1.78277,pm=-.29227,pc=-.90649,eu=1.97294,J2=eu*pc,K2=eu*hm,Q2=hm*pm-pc*X2;function mm(t,n,e,r){return arguments.length===1?function(i){if(i instanceof Ba)return new Ba(i.h,i.s,i.l,i.opacity);i instanceof Px||(i=d8(i));var a=i.r/255,o=i.g/255,s=i.b/255,u=(Q2*s+J2*a-K2*o)/(Q2+J2-K2),l=s-u,c=(eu*(o-u)-pm*l)/pc,f=Math.sqrt(c*c+l*l)/(eu*u*(1-u)),d=f?Math.atan2(c,l)*V6-120:NaN;return new Ba(d<0?d+360:d,f,u,i.opacity)}(t):new Ba(t,n,e,r??1)}function Ba(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Z2(t){return function(n,e){var r=t((n=mp(n)).h,(e=mp(e)).h),i=Oe(n.s,e.s),a=Oe(n.l,e.l),o=Oe(n.opacity,e.opacity);return function(s){return n.h=r(s),n.s=i(s),n.l=a(s),n.opacity=o(s),n+""}}}h8(Ba,mm,p8(m8,{brighter(t){return t=t==null?Lx:Math.pow(Lx,t),new Ba(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?jx:Math.pow(jx,t),new Ba(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Y6,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Px(255*(n+e*(X2*r+hm*i)),255*(n+e*(pm*r+pc*i)),255*(n+e*(eu*r)),this.opacity)}}));const R9=Z2(pp);var T9=Z2(Oe);function tw(t){return function n(e){function r(i,a){var o=t((i=mm(i)).h,(a=mm(a)).h),s=Oe(i.s,a.s),u=Oe(i.l,a.l),l=Oe(i.opacity,a.opacity);return function(c){return i.h=o(c),i.s=s(c),i.l=u(Math.pow(c,e)),i.opacity=l(c),i+""}}return e=+e,r.gamma=n,r}(1)}const P9=tw(pp);var j9=tw(Oe);function gm(t,n){n===void 0&&(n=t,t=Vs);for(var e=0,r=n.length-1,i=n[0],a=new Array(r<0?0:r);e-t(-n,e)}function ym(t){const n=t(nw,ew),e=n.domain;let r,i,a=10;function o(){return r=function(s){return s===Math.E?Math.log:s===10&&Math.log10||s===2&&Math.log2||(s=Math.log(s),u=>Math.log(u)/s)}(a),i=function(s){return s===10?I9:s===Math.E?Math.exp:u=>Math.pow(s,u)}(a),e()[0]<0?(r=rw(r),i=rw(i),t(q9,U9)):t(nw,ew),n}return n.base=function(s){return arguments.length?(a=+s,o()):a},n.domain=function(s){return arguments.length?(e(s),o()):e()},n.ticks=s=>{const u=e();let l=u[0],c=u[u.length-1];const f=c0){for(;p<=m;++p)for(d=1;dc)break;y.push(h)}}else for(;p<=m;++p)for(d=a-1;d>=1;--d)if(h=p>0?d/i(-p):d*i(p),!(hc)break;y.push(h)}2*y.length{if(s==null&&(s=10),u==null&&(u=a===10?"s":","),typeof u!="function"&&(a%1||(u=h6(u)).precision!=null||(u.trim=!0),u=p6(u)),s===1/0)return u;const l=Math.max(1,a*s/n.ticks().length);return c=>{let f=c/i(Math.round(r(c)));return f*ae(K6(e(),{floor:s=>i(Math.floor(r(s))),ceil:s=>i(Math.ceil(r(s)))})),n}function iw(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function aw(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function vm(t){var n=1,e=t(iw(n),aw(n));return e.constant=function(r){return arguments.length?t(iw(n=+r),aw(n)):n},Eo(e)}function ow(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function W9(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function H9(t){return t<0?-t*t:t*t}function bm(t){var n=t(Ri,Ri),e=1;return n.exponent=function(r){return arguments.length?(e=+r)==1?t(Ri,Ri):e===.5?t(W9,H9):t(ow(e),ow(1/e)):e},Eo(n)}function xm(){var t=bm(dp());return t.copy=function(){return hp(t,xm()).exponent(t.exponent())},$a.apply(t,arguments),t}function mc(){var t,n,e,r,i,a=0,o=1,s=Ri,u=!1;function l(f){return f==null||isNaN(f=+f)?i:s(e===0?.5:(f=(r(f)-t)*e,u?Math.max(0,Math.min(1,f)):f))}function c(f){return function(d){var h,p;return arguments.length?([h,p]=d,s=f(h,p),l):[s(0),s(1)]}}return l.domain=function(f){return arguments.length?([a,o]=f,t=r(a=+a),n=r(o=+o),e=t===n?0:1/(n-t),l):[a,o]},l.clamp=function(f){return arguments.length?(u=!!f,l):u},l.interpolator=function(f){return arguments.length?(s=f,l):s},l.range=c(Vs),l.rangeRound=c(Xl),l.unknown=function(f){return arguments.length?(i=f,l):i},function(f){return r=f,t=f(a),n=f(o),e=t===n?0:1/(n-t),l}}function Ui(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function wm(){var t=Eo(mc()(Ri));return t.copy=function(){return Ui(t,wm())},Ti.apply(t,arguments)}function Am(){var t=bm(mc());return t.copy=function(){return Ui(t,Am()).exponent(t.exponent())},Ti.apply(t,arguments)}function gc(){var t,n,e,r,i,a,o,s=0,u=.5,l=1,c=1,f=Ri,d=!1;function h(m){return isNaN(m=+m)?o:(m=.5+((m=+a(m))-n)*(c*m0?r:1:0}const Bo="linear",ri="log",ru="pow",iu="sqrt",yc="symlog",za="time",Oa="utc",Cr="sequential",zo="diverging",Oo="quantile",vc="quantize",bc="threshold",Dm="ordinal",Fm="point",sw="band",Cm="bin-ordinal",fn="continuous",au="discrete",ou="discretizing",Re="interpolating",Em="temporal";function $m(){const t=qx().unknown(void 0),n=t.domain,e=t.range;let r,i,a=[0,1],o=!1,s=0,u=0,l=.5;function c(){const f=n().length,d=a[1]m+r*y);return e(d?g.reverse():g)}return delete t.unknown,t.domain=function(f){return arguments.length?(n(f),c()):n()},t.range=function(f){return arguments.length?(a=[+f[0],+f[1]],c()):a.slice()},t.rangeRound=function(f){return a=[+f[0],+f[1]],o=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(f){return arguments.length?(o=!!f,c()):o},t.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),s=u,c()):s},t.paddingInner=function(f){return arguments.length?(s=Math.max(0,Math.min(1,f)),c()):s},t.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},t.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},t.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=a[1]a[1-d])?void 0:(m=Math.max(0,Ea(h,v)-1),g=v===x?m:Ea(h,x)-1,v-h[m]>i+1e-10&&++m,d&&(y=m,m=p-g,g=p-y),m>g?void 0:n().slice(m,g+1))},t.invert=function(f){const d=t.invertRange([f,f]);return d&&d[0]},t.copy=function(){return $m().domain(n()).range(a).round(o).paddingInner(s).paddingOuter(u).align(l)},c()}function uw(t){const n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return uw(n())},t}var e7=Array.prototype.map;const r7=Array.prototype.slice,xc=new Map,lw=Symbol("vega_scale");function cw(t){return t[lw]=!0,t}function fw(t){return t&&t[lw]===!0}function Dt(t,n,e){return arguments.length>1?(xc.set(t,function(r,i,a){const o=function(){const s=i();return s.invertRange||(s.invertRange=s.invert?function(u){return function(l){let c,f=l[0],d=l[1];return d=m&&c[h]<=g&&(y<0&&(y=h),f=h);if(!(y<0))return m=u.invertExtent(c[y]),g=u.invertExtent(c[f]),[m[0]===void 0?m[1]:m[0],g[1]===void 0?g[0]:g[1]]}}(s):void 0),s.type=r,cw(s)};return o.metadata=Dr(K(a)),o}(t,n,e)),this):dw(t)?xc.get(t):void 0}function dw(t){return xc.has(t)}function Na(t,n){const e=xc.get(t);return e&&e.metadata[n]}function Sm(t){return Na(t,fn)}function No(t){return Na(t,au)}function Mm(t){return Na(t,ou)}function hw(t){return Na(t,ri)}function pw(t){return Na(t,Re)}function mw(t){return Na(t,Oo)}Dt("identity",function t(n){var e;function r(i){return i==null||isNaN(i=+i)?e:i}return r.invert=r,r.domain=r.range=function(i){return arguments.length?(n=Array.from(i,Tx),r):n.slice()},r.unknown=function(i){return arguments.length?(e=i,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,Tx):[0,1],Eo(r)}),Dt(Bo,l8,fn),Dt(ri,function t(){const n=ym(dp()).domain([1,10]);return n.copy=()=>hp(n,t()).base(n.base()),$a.apply(n,arguments),n},[fn,ri]),Dt(ru,xm,fn),Dt(iu,function(){return xm.apply(null,arguments).exponent(.5)},fn),Dt(yc,function t(){var n=vm(dp());return n.copy=function(){return hp(n,t()).constant(n.constant())},$a.apply(n,arguments)},fn),Dt(za,n8,[fn,Em]),Dt(Oa,function(){return $a.apply(Q6(t8,Z6,A6,w6,x6,b6,v6,y6,g6,m6).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[fn,Em]),Dt(Cr,wm,[fn,Re]),Dt(`${Cr}-${Bo}`,wm,[fn,Re]),Dt(`${Cr}-${ri}`,function t(){var n=ym(mc()).domain([1,10]);return n.copy=function(){return Ui(n,t()).base(n.base())},Ti.apply(n,arguments)},[fn,Re,ri]),Dt(`${Cr}-${ru}`,Am,[fn,Re]),Dt(`${Cr}-${iu}`,function(){return Am.apply(null,arguments).exponent(.5)},[fn,Re]),Dt(`${Cr}-${yc}`,function t(){var n=vm(mc());return n.copy=function(){return Ui(n,t()).constant(n.constant())},Ti.apply(n,arguments)},[fn,Re]),Dt(`${zo}-${Bo}`,function t(){var n=Eo(gc()(Ri));return n.copy=function(){return Ui(n,t())},Ti.apply(n,arguments)},[fn,Re]),Dt(`${zo}-${ri}`,function t(){var n=ym(gc()).domain([.1,1,10]);return n.copy=function(){return Ui(n,t()).base(n.base())},Ti.apply(n,arguments)},[fn,Re,ri]),Dt(`${zo}-${ru}`,_m,[fn,Re]),Dt(`${zo}-${iu}`,function(){return _m.apply(null,arguments).exponent(.5)},[fn,Re]),Dt(`${zo}-${yc}`,function t(){var n=vm(gc());return n.copy=function(){return Ui(n,t()).constant(n.constant())},Ti.apply(n,arguments)},[fn,Re]),Dt(Oo,function t(){var n,e=[],r=[],i=[];function a(){var s=0,u=Math.max(1,r.length);for(i=new Array(u-1);++s0?i[u-1]:e[0],u=i?[a[i-1],r]:[a[c-1],a[c]]},s.unknown=function(l){return arguments.length&&(n=l),s},s.thresholds=function(){return a.slice()},s.copy=function(){return t().domain([e,r]).range(o).unknown(n)},$a.apply(Eo(s),arguments)},ou),Dt(bc,function t(){var n,e=[.5],r=[0,1],i=1;function a(o){return o!=null&&o<=o?r[Ea(e,o,0,i)]:n}return a.domain=function(o){return arguments.length?(e=Array.from(o),i=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(o){return arguments.length?(r=Array.from(o),i=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(o){var s=r.indexOf(o);return[e[s-1],e[s]]},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},$a.apply(a,arguments)},ou),Dt(Cm,function t(){let n=[],e=[];function r(i){return i==null||i!=i?void 0:e[(Ea(n,i)-1)%e.length]}return r.domain=function(i){return arguments.length?(n=function(a){return e7.call(a,ze)}(i),r):n.slice()},r.range=function(i){return arguments.length?(e=r7.call(i),r):e.slice()},r.tickFormat=function(i,a){return c8(n[0],Bt(n),i??10,a)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r},[au,ou]),Dt(Dm,qx,au),Dt(sw,$m,au),Dt(Fm,function(){return uw($m().paddingInner(1))},au);const i7=["clamp","base","constant","exponent"];function gw(t,n){const e=n[0],r=Bt(n)-e;return function(i){return t(e+i*r)}}function wc(t,n,e){return gm(Bm(n||"rgb",e),t)}function yw(t,n){const e=new Array(n),r=n+1;for(let i=0;it[s]?o[s](t[s]()):0),o):In(.5)}function Bm(t,n){const e=L9[function(r){return"interpolate"+r.toLowerCase().split("-").map(i=>i[0].toUpperCase()+i.slice(1)).join("")}(t)];return n!=null&&e&&e.gamma?e.gamma(n):e}function bw(t){if(P(t))return t;const n=t.length/6|0,e=new Array(n);for(let r=0;r1?(ww[t]=n,this):ww[t]}xw({accent:V9,category10:G9,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:Y9,observable10:X9,paired:J9,pastel1:K9,pastel2:Q9,set1:Z9,set2:t7,set3:n7,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},bw),xw({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},t=>wc(bw(t)));const Ac="symbol",a7=t=>P(t)?t.map(n=>String(n)):String(t),o7=(t,n)=>t[1]-n[1],s7=(t,n)=>n[1]-t[1];function Om(t,n,e){let r;return $t(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),e!=null&&(n=Math.min(n,Math.floor(Gl(t.domain())/e||1)+1))),Z(n)&&(r=n.step,n=n.interval),Q(n)&&(n=t.type===za?np(n):t.type==Oa?tp(n):j("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Aw(t,n,e){let r=t.range(),i=r[0],a=Bt(r),o=o7;if(i>a&&(r=a,a=i,i=r,o=s7),i=Math.floor(i),a=Math.ceil(a),n=n.map(s=>[s,t(s)]).filter(s=>i<=s[1]&&s[1]<=a).sort(o).map(s=>s[0]),e>0&&n.length>1){const s=[n[0],Bt(n)];for(;n.length>e&&n.length>=3;)n=n.filter((u,l)=>!(l%2));n.length<3&&(n=s)}return n}function Nm(t,n){return t.bins?Aw(t,t.bins,n):t.ticks?t.ticks(n):t.domain()}function _w(t,n,e,r,i,a){const o=n.type;let s=a7;if(o===za||i===za)s=t.timeFormat(r);else if(o===Oa||i===Oa)s=t.utcFormat(r);else if(hw(o)){const u=t.formatFloat(r);if(a||n.bins)s=u;else{const l=kw(n,e,!1);s=c=>l(c)?u(c):""}}else if(n.tickFormat){const u=n.domain();s=t.formatSpan(u[0],u[u.length-1],e,r)}else r&&(s=t.format(r));return s}function kw(t,n,e){const r=Nm(t,n),i=t.base(),a=Math.log(i),o=Math.max(1,i*n/r.length),s=u=>{let l=u/Math.pow(i,Math.round(Math.log(u)/a));return l*i1?f[1]-f[0]:f[0];for(h=1;hRm[u.type]||u.bins)(n)?u7(s):r==="discrete"?l7(s):c7(s)}const u7=t=>(n,e,r)=>{const i=Ew(r[e+1],Ew(r.max,1/0)),a=$w(n,t),o=$w(i,t);return a&&o?a+" \u2013 "+o:o?"< "+o:"\u2265 "+a},Ew=(t,n)=>t??n,l7=t=>(n,e)=>e?t(n):null,c7=t=>n=>t(n),$w=(t,n)=>Number.isFinite(t)?n(t):null;function f7(t,n,e,r){const i=r||n.type;return Q(e)&&function(a){return Na(a,Em)}(i)&&(e=e.replace(/%a/g,"%A").replace(/%b/g,"%B")),e||i!==za?e||i!==Oa?Cw(t,n,5,null,e,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Sw(t,n,e){e=e||{};const r=Math.max(3,e.maxlen||7),i=f7(t,n,e.format,e.formatType);if(Mm(n.type)){const a=Fw(n).slice(1).map(i),o=a.length;return`${o} boundar${o===1?"y":"ies"}: ${a.join(", ")}`}if(No(n.type)){const a=n.domain(),o=a.length;return`${o} value${o===1?"":"s"}: ${o>r?a.slice(0,r-2).map(i).join(", ")+", ending with "+a.slice(-1).map(i):a.map(i).join(", ")}`}{const a=n.domain();return`values from ${i(a[0])} to ${i(Bt(a))}`}}let Mw=0;const _c="p_";function Tm(t){return t&&t.gradient}function Bw(t,n,e){const r=t.gradient;let i=t.id,a=r==="radial"?_c:"";return i||(i=t.id="gradient_"+Mw++,r==="radial"?(t.x1=Er(t.x1,.5),t.y1=Er(t.y1,.5),t.r1=Er(t.r1,0),t.x2=Er(t.x2,.5),t.y2=Er(t.y2,.5),t.r2=Er(t.r2,.5),a=_c):(t.x1=Er(t.x1,0),t.y1=Er(t.y1,0),t.x2=Er(t.x2,1),t.y2=Er(t.y2,0))),n[i]=t,"url("+(e||"")+"#"+a+i+")"}function Er(t,n){return t??n}function zw(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(i,a){return r.push({offset:i,color:a}),e}}}const Ow={basis:{curve:Z8},"basis-closed":{curve:Q8},"basis-open":{curve:K8},bundle:{curve:J8,tension:"beta",value:.85},cardinal:{curve:X8,tension:"tension",value:0},"cardinal-open":{curve:Y8,tension:"tension",value:0},"cardinal-closed":{curve:V8,tension:"tension",value:0},"catmull-rom":{curve:G8,tension:"alpha",value:.5},"catmull-rom-closed":{curve:H8,tension:"alpha",value:.5},"catmull-rom-open":{curve:W8,tension:"alpha",value:.5},linear:{curve:Ix},"linear-closed":{curve:I8},monotone:{horizontal:U8,vertical:q8},natural:{curve:L8},step:{curve:j8},"step-after":{curve:P8},"step-before":{curve:T8}};function Pm(t,n,e){var r=tt(Ow,t)&&Ow[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&e!=null&&(i=i[r.tension](e))),i}const d7={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},h7=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,p7=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,m7=/^((\s+,?\s*)|(,\s*))/,g7=/^[01]/;function Ro(t){const n=[];return(t.match(h7)||[]).forEach(e=>{let r=e[0];const i=r.toLowerCase(),a=d7[i],o=function(u,l,c){const f=[];for(let d=0;l&&d1&&(b=Math.sqrt(b),s*=b,u*=b);const w=y/s,A=g/s,_=-g/u,k=y/u,F=w*d+A*h,C=_*d+k*h,D=w*a+A*o,E=_*a+k*o;let $=1/((D-F)*(D-F)+(E-C)*(E-C))-.25;$<0&&($=0);let M=Math.sqrt($);c==l&&(M=-M);const S=.5*(F+D)-M*(E-C),B=.5*(C+E)+M*(D-F),z=Math.atan2(C-B,F-S);let N=Math.atan2(E-B,D-S)-z;N<0&&c===1?N+=$r:N>0&&c===0&&(N-=$r);const W=Math.ceil(Math.abs(N/(Ra+.001))),X=[];for(let L=0;L+t}function kc(t,n,e){return Math.max(n,Math.min(t,e))}function Lw(){var t=b7,n=x7,e=w7,r=A7,i=ii(0),a=i,o=i,s=i,u=null;function l(c,f,d){var h,p=f??+t.call(this,c),m=d??+n.call(this,c),g=+e.call(this,c),y=+r.call(this,c),v=Math.min(g,y)/2,x=kc(+i.call(this,c),0,v),b=kc(+a.call(this,c),0,v),w=kc(+o.call(this,c),0,v),A=kc(+s.call(this,c),0,v);if(u||(u=h=gp()),x<=0&&b<=0&&w<=0&&A<=0)u.rect(p,m,g,y);else{var _=p+g,k=m+y;u.moveTo(p+x,m),u.lineTo(_-b,m),u.bezierCurveTo(_-Wi*b,m,_,m+Wi*b,_,m+b),u.lineTo(_,k-A),u.bezierCurveTo(_,k-Wi*A,_-Wi*A,k,_-A,k),u.lineTo(p+w,k),u.bezierCurveTo(p+Wi*w,k,p,k-Wi*w,p,k-w),u.lineTo(p,m+x),u.bezierCurveTo(p,m+Wi*x,p+Wi*x,m,p+x,m),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(c){return arguments.length?(t=ii(c),l):t},l.y=function(c){return arguments.length?(n=ii(c),l):n},l.width=function(c){return arguments.length?(e=ii(c),l):e},l.height=function(c){return arguments.length?(r=ii(c),l):r},l.cornerRadius=function(c,f,d,h){return arguments.length?(i=ii(c),a=f!=null?ii(f):i,s=d!=null?ii(d):i,o=h!=null?ii(h):a,l):i},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function qw(){var t,n,e,r,i,a,o,s,u=null;function l(f,d,h){const p=h/2;if(i){var m=o-d,g=f-a;if(m||g){var y=Math.hypot(m,g),v=(m/=y)*s,x=(g/=y)*s,b=Math.atan2(g,m);u.moveTo(a-v,o-x),u.lineTo(f-m*p,d-g*p),u.arc(f,d,p,b-Math.PI,b),u.lineTo(a+v,o+x),u.arc(a,o,s,b,b+Math.PI)}else u.arc(f,d,p,0,$r);u.closePath()}else i=1;a=f,o=d,s=p}function c(f){var d,h,p,m=f.length,g=!1;for(u==null&&(u=p=gp()),d=0;d<=m;++d)!(dt.x||0,cu=t=>t.y||0,Dc=t=>t.defined!==!1,_7=t9().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),k7=Y2().x(lu).y1(cu).y0(t=>(t.y||0)+(t.height||0)).defined(Dc),D7=Y2().y(cu).x1(lu).x0(t=>(t.x||0)+(t.width||0)).defined(Dc),F7=Wx().x(lu).y(cu).defined(Dc),C7=Lw().x(lu).y(cu).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>uu(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>uu(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>uu(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>uu(t.cornerRadiusBottomLeft,t.cornerRadius)||0),E7=function(t,n){let e=null,r=Ux(i);function i(){let a;if(e||(e=a=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),a)return e=null,a+""||null}return t=typeof t=="function"?t:Hn(t||O9),n=typeof n=="function"?n:Hn(n===void 0?64:+n),i.type=function(a){return arguments.length?(t=typeof a=="function"?a:Hn(a),i):t},i.size=function(a){return arguments.length?(n=typeof a=="function"?a:Hn(+a),i):n},i.context=function(a){return arguments.length?(e=a??null,i):e},i}().type(t=>jw(t.shape||"circle")).size(t=>uu(t.size,64)),$7=qw().x(lu).y(cu).defined(Dc).size(t=>t.size||1);function Um(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Po(t,n,e,r){return C7.context(t)(n,e,r)}var Uw=1;function Iw(){Uw=1}function Im(t,n,e){var r=n.clip,i=t._defs,a=n.clip_id||(n.clip_id="clip"+Uw++),o=i.clipping[a]||(i.clipping[a]={id:a});return bt(r)?o.path=r(null):Um(e)?o.path=Po(null,e,0,0):(o.width=e.width||0,o.height=e.height||0),"url(#"+a+")"}function cn(t){this.clear(),t&&this.union(t)}function Fc(t){this.mark=t,this.bounds=this.bounds||new cn}function Cc(t){Fc.call(this,t),this.items=this.items||[]}cn.prototype={clone(){return new cn(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,n,e,r){return ethis.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},rotate(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,n,e){var{x1:r,y1:i,x2:a,y2:o}=this,s=Math.cos(t),u=Math.sin(t),l=n-n*s+e*u,c=e-n*u-e*s;return[s*r-u*i+l,u*r+s*i+c,s*r-u*o+l,u*r+s*o+c,s*a-u*i+l,u*a+s*i+c,s*a-u*o+l,u*a+s*o+c]},union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)},contains(t,n){return!(tthis.x2||nthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},V(Cc,Fc);class Ww{constructor(n){this._pending=0,this._loader=n||Hl()}pending(){return this._pending}sanitizeURL(n){const e=this;return Hw(e),e._loader.sanitize(n,{context:"href"}).then(r=>(fu(e),r)).catch(()=>(fu(e),null))}loadImage(n){const e=this,r=N9();return Hw(e),e._loader.sanitize(n,{context:"image"}).then(i=>{const a=i.href;if(!a||!r)throw{url:a};const o=new r,s=tt(i,"crossOrigin")?i.crossOrigin:"anonymous";return s!=null&&(o.crossOrigin=s),o.onload=()=>fu(e),o.onerror=()=>fu(e),o.src=a,o}).catch(i=>(fu(e),{complete:!1,width:0,height:0,src:i&&i.url||""}))}ready(){const n=this;return new Promise(e=>{(function r(i){n.pending()?setTimeout(()=>{r(!0)},10):e(i)})(!1)})}}function Hw(t){t._pending+=1}function fu(t){t._pending-=1}function ai(t,n,e){if(n.stroke&&n.opacity!==0&&n.strokeOpacity!==0){const r=n.strokeWidth!=null?+n.strokeWidth:1;t.expand(r+(e?function(i,a){return i.strokeJoin&&i.strokeJoin!=="miter"?0:a}(n,r):0))}return t}const S7=$r-1e-8;let Ec,$c,Sc,Ta,Wm,Mc,Hm,Gm;const Hi=(t,n)=>Ec.add(t,n),Bc=(t,n)=>Hi($c=t,Sc=n),Gw=t=>Hi(t,Ec.y1),Vw=t=>Hi(Ec.x1,t),Pa=(t,n)=>Wm*t+Hm*n,ja=(t,n)=>Mc*t+Gm*n,Vm=(t,n)=>Hi(Pa(t,n),ja(t,n)),Ym=(t,n)=>Bc(Pa(t,n),ja(t,n));function du(t,n){return Ec=t,n?(Ta=n*Ii,Wm=Gm=Math.cos(Ta),Mc=Math.sin(Ta),Hm=-Mc):(Wm=Gm=1,Ta=Mc=Hm=0),M7}const M7={beginPath(){},closePath(){},moveTo:Ym,lineTo:Ym,rect(t,n,e,r){Ta?(Vm(t+e,n),Vm(t+e,n+r),Vm(t,n+r),Ym(t,n)):(Hi(t+e,n+r),Bc(t,n))},quadraticCurveTo(t,n,e,r){const i=Pa(t,n),a=ja(t,n),o=Pa(e,r),s=ja(e,r);Yw($c,i,o,Gw),Yw(Sc,a,s,Vw),Bc(o,s)},bezierCurveTo(t,n,e,r,i,a){const o=Pa(t,n),s=ja(t,n),u=Pa(e,r),l=ja(e,r),c=Pa(i,a),f=ja(i,a);Xw($c,o,u,c,Gw),Xw(Sc,s,l,f,Vw),Bc(c,f)},arc(t,n,e,r,i,a){if(r+=Ta,i+=Ta,$c=e*Math.cos(i)+t,Sc=e*Math.sin(i)+n,Math.abs(i-r)>S7)Hi(t-e,n-e),Hi(t+e,n+e);else{const o=l=>Hi(e*Math.cos(l)+t,e*Math.sin(l)+n);let s,u;if(o(r),o(i),i!==r)if((r%=$r)<0&&(r+=$r),(i%=$r)<0&&(i+=$r),ii;++u,s-=Ra)o(s);else for(s=r-r%Ra+Ra,u=0;u<4&&s1e-14?(u=o*o+s*a,u>=0&&(u=Math.sqrt(u),l=(-o+u)/a,c=(-o-u)/a)):l=.5*s/o,0g)return!1;h>m&&(m=h)}else if(f>0){if(h0&&(t.globalAlpha=e,t.fillStyle=tA(t,n,n.fill),!0)}var B7=[];function qo(t,n,e){var r=(r=n.strokeWidth)!=null?r:1;return!(r<=0)&&(e*=n.strokeOpacity==null?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=tA(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||B7),t.lineDashOffset=n.strokeDashOffset||0),!0)}function z7(t,n){return t.zindex-n.zindex||t.index-n.index}function Qm(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,a=[];for(e=0,r=i.length;e=0;)if(e=n(i[r]))return e;if(i===a){for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e}return null}function Zm(t){return function(n,e,r){Qe(e,i=>{r&&!r.intersects(i.bounds)||nA(t,n,i,i)})}}function O7(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||nA(t,n,e.items[0],e.items)}}function nA(t,n,e,r){var i=e.opacity==null?1:e.opacity;i!==0&&(t(n,r)||(Lo(n,e),e.fill&&zc(n,e,i)&&n.fill(),e.stroke&&qo(n,e,i)&&n.stroke()))}function Nc(t){return t=t||Be,function(n,e,r,i,a,o){return r*=n.pixelRatio,i*=n.pixelRatio,Oc(e,s=>{const u=s.bounds;if((!u||u.contains(a,o))&&u)return t(n,s,r,i,a,o)?s:void 0})}}function hu(t,n){return function(e,r,i,a){var o,s,u=Array.isArray(r)?r[0]:r,l=n??u.fill,c=u.stroke&&e.isPointInStroke;return c&&(o=u.strokeWidth,s=u.strokeCap,e.lineWidth=o??1,e.lineCap=s??"butt"),!t(e,r)&&(l&&e.isPointInPath(i,a)||c&&e.isPointInStroke(i,a))}}function t0(t){return Nc(hu(t))}function La(t,n){return"translate("+t+","+n+")"}function n0(t){return"rotate("+t+")"}function eA(t){return La(t.x||0,t.y||0)}function e0(t,n,e){function r(i,a){var o=a.x||0,s=a.y||0,u=a.angle||0;i.translate(o,s),u&&i.rotate(u*=Ii),i.beginPath(),n(i,a),u&&i.rotate(-u),i.translate(-o,-s)}return{type:t,tag:"path",nested:!1,attr:function(i,a){i("transform",function(o){return La(o.x||0,o.y||0)+(o.angle?" "+n0(o.angle):"")}(a)),i("d",n(null,a))},bound:function(i,a){return n(du(i,a.angle),a),ai(i,a).translate(a.x||0,a.y||0)},draw:Zm(r),pick:t0(r),isect:e||Jm(r)}}var N7=e0("arc",function(t,n){return _7.context(t)(n)});function r0(t,n,e){function r(a,o){a.beginPath(),n(a,o)}const i=hu(r);return{type:t,tag:"path",nested:!0,attr:function(a,o){var s=o.mark.items;s.length&&a("d",n(null,s))},bound:function(a,o){var s=o.items;return s.length===0?a:(n(du(a),s),ai(a,s[0]))},draw:O7(r),pick:function(a,o,s,u,l,c){var f=o.items,d=o.bounds;return!f||!f.length||d&&!d.contains(l,c)?null:(s*=a.pixelRatio,u*=a.pixelRatio,i(a,f,s,u)?f[0]:null)},isect:Km,tip:e}}var R7=r0("area",function(t,n){const e=n[0],r=e.interpolate||"linear";return(e.orient==="horizontal"?D7:k7).curve(Pm(r,e.orient,e.tension)).context(t)(n)},function(t,n){for(var e,r,i=t[0].orient==="horizontal"?n[1]:n[0],a=t[0].orient==="horizontal"?"y":"x",o=t.length,s=1/0;--o>=0;)t[o].defined!==!1&&(r=Math.abs(t[o][a]-i)).5&&n<1.5?.5-Math.abs(n-1):0}function aA(t,n){const e=iA(n);t("d",Po(null,n,e,e))}function pu(t,n,e,r){const i=iA(n);t.beginPath(),Po(t,n,(e||0)+i,(r||0)+i)}const T7=hu(pu),P7=hu(pu,!1),j7=hu(pu,!0);var L7={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",eA(n))},bound:function(t,n){if(!n.clip&&n.items){const e=n.items,r=e.length;for(let i=0;i{const a=i.x||0,o=i.y||0,s=i.strokeForeground,u=i.opacity==null?1:i.opacity;(i.stroke||i.fill)&&u&&(pu(t,i,a,o),Lo(t,i),i.fill&&zc(t,i,u)&&t.fill(),i.stroke&&!s&&qo(t,i,u)&&t.stroke()),t.save(),t.translate(a,o),i.clip&&rA(t,i),e&&e.translate(-a,-o),Qe(i,l=>{(l.marktype==="group"||r==null||r.includes(l.marktype))&&this.draw(t,l,e,r)}),e&&e.translate(a,o),t.restore(),s&&i.stroke&&u&&(pu(t,i,a,o),Lo(t,i),qo(t,i,u)&&t.stroke())})},pick:function(t,n,e,r,i,a){if(n.bounds&&!n.bounds.contains(i,a)||!n.items)return null;const o=e*t.pixelRatio,s=r*t.pixelRatio;return Oc(n,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(i,a))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),p=f+(u.height||0),m=u.clip;if(m&&(ih||ap))return;if(t.save(),t.translate(c,f),c=i-c,f=a-f,m&&Um(u)&&!j7(t,u,o,s))return t.restore(),null;const g=u.strokeForeground,y=n.interactive!==!1;return y&&g&&u.stroke&&P7(t,u,o,s)?(t.restore(),u):(l=Oc(u,v=>function(x,b,w){return(x.interactive!==!1||x.marktype==="group")&&x.bounds&&x.bounds.contains(b,w)}(v,c,f)?this.pick(v,e,r,c,f):null),!l&&y&&(u.fill||!g&&u.stroke)&&T7(t,u,o,s)&&(l=u),t.restore(),l||null)})},isect:Kw,content:function(t,n,e){t("clip-path",n.clip?Im(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),aA(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?aA(t,n):t("d","")}},mu={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function i0(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then(r=>{t.image=r,t.image.url=t.url})),e}function a0(t,n){return t.width!=null?t.width:n&&n.width?t.aspect!==!1&&t.height?t.height*n.width/n.height:n.width:0}function o0(t,n){return t.height!=null?t.height:n&&n.height?t.aspect!==!1&&t.width?t.width*n.height/n.width:n.height:0}function Rc(t,n){return t==="center"?n/2:t==="right"?n:0}function Tc(t,n){return t==="middle"?n/2:t==="bottom"?n:0}var q7={type:"image",tag:"image",nested:!1,attr:function(t,n,e){const r=i0(n,e),i=a0(n,r),a=o0(n,r),o=(n.x||0)-Rc(n.align,i),s=(n.y||0)-Tc(n.baseline,a);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",mu["xmlns:xlink"],"xlink:href"),t("transform",La(o,s)),t("width",i),t("height",a),t("preserveAspectRatio",n.aspect===!1?"none":"xMidYMid")},bound:function(t,n){const e=n.image,r=a0(n,e),i=o0(n,e),a=(n.x||0)-Rc(n.align,r),o=(n.y||0)-Tc(n.baseline,i);return t.set(a,o,a+r,o+i)},draw:function(t,n,e){Qe(n,r=>{if(e&&!e.intersects(r.bounds))return;const i=i0(r,this);let a=a0(r,i),o=o0(r,i);if(a===0||o===0)return;let s,u,l,c,f=(r.x||0)-Rc(r.align,a),d=(r.y||0)-Tc(r.baseline,o);r.aspect!==!1&&(u=i.width/i.height,l=r.width/r.height,u==u&&l==l&&u!==l&&(l=0;)if(t[a].defined!==!1&&(e=t[a].x-n[0])*e+(r=t[a].y-n[1])*r{if(!e||e.intersects(r.bounds)){var i=r.opacity==null?1:r.opacity;i&&sA(t,r,i)&&(Lo(t,r),t.stroke())}})},pick:Nc(function(t,n,e,r){return!!t.isPointInStroke&&sA(t,n,1)&&t.isPointInStroke(e,r)}),isect:Qw},G7=e0("shape",function(t,n){return(n.mark.shape||n.shape).context(t)(n)}),V7=e0("symbol",function(t,n){return E7.context(t)(n)},Km);const uA=cx();var we={height:Sr,measureWidth:s0,estimateWidth:jc,width:jc,canvas:lA};function lA(t){we.width=t&&Gi?s0:jc}function jc(t,n){return cA(Yi(t,n),Sr(t))}function cA(t,n){return~~(.8*t.length*n)}function s0(t,n){return Sr(t)<=0||!(n=Yi(t,n))?0:fA(n,Lc(t))}function fA(t,n){const e=`(${n}) ${t}`;let r=uA.get(e);return r===void 0&&(Gi.font=n,r=Gi.measureText(t).width,uA.set(e,r)),r}function Sr(t){return t.fontSize!=null?+t.fontSize||0:11}function Vi(t){return t.lineHeight!=null?t.lineHeight:Sr(t)+2}function gu(t){return n=t.lineBreak&&t.text&&!P(t.text)?t.text.split(t.lineBreak):t.text,P(n)?n.length>1?n:n[0]:n;var n}function u0(t){const n=gu(t);return(P(n)?n.length-1:0)*Vi(t)}function Yi(t,n){const e=n==null?"":(n+"").trim();return t.limit>0&&e.length?function(r,i){var a=+r.limit,o=function(d){if(we.width===s0){const h=Lc(d);return p=>fA(p,h)}if(we.width===jc){const h=Sr(d);return p=>cA(p,h)}return h=>we.width(d,h)}(r);if(o(i)>>1,o(i.slice(s))>a?c=s+1:f=s;return u+i.slice(c)}for(;c>>1),o(i.slice(0,s))Math.max(d,we.width(n,h)),0)):r=we.width(n,f),a==="center"?l-=r/2:a==="right"&&(l-=r),t.set(l+=s,c+=u,l+r,c+i),n.angle&&!e)t.rotate(n.angle*Ii,s,u);else if(e===2)return t.rotatedPoints(n.angle*Ii,s,u);return t}var X7={type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+l0(n),a=qc(n),o=a.x1,s=a.y1,u=n.angle||0;t("text-anchor",Y7[n.align]||"start"),u?(e=La(o,s)+" "+n0(u),(r||i)&&(e+=" "+La(r,i))):e=La(o+r,s+i),t("transform",e)},bound:c0,draw:function(t,n,e){Qe(n,r=>{var i,a,o,s,u,l,c,f=r.opacity==null?1:r.opacity;if(!(e&&!e.intersects(r.bounds)||f===0||r.fontSize<=0||r.text==null||r.text.length===0)){if(t.font=Lc(r),t.textAlign=r.align||"left",a=(i=qc(r)).x1,o=i.y1,r.angle&&(t.save(),t.translate(a,o),t.rotate(r.angle*Ii),a=o=0),a+=r.dx||0,o+=(r.dy||0)+l0(r),l=gu(r),Lo(t,r),P(l))for(u=Vi(r),s=0;s=0;)if(t[i].defined!==!1&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null}),Ae={arc:N7,area:R7,group:L7,image:q7,line:U7,path:I7,rect:W7,rule:H7,shape:G7,symbol:V7,text:X7,trail:J7};function f0(t,n,e){var r=Ae[t.mark.marktype],i=n||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new cn),t,e)}var dA={mark:null};function hA(t,n,e){var r,i,a,o,s=Ae[t.marktype],u=s.bound,l=t.items,c=l&&l.length;if(s.nested)return c?a=l[0]:(dA.mark=t,a=dA),o=f0(a,u,e),n=n&&n.union(o)||o;if(n=n||t.bounds&&t.bounds.clear()||new cn,c)for(r=0,i=l.length;rn;)t.removeChild(e[--r]);return t}function bA(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Uc(t,n){const e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}class h0{constructor(n,e){this._active=null,this._handlers={},this._loader=n||Hl(),this._tooltip=e||Q7}initialize(n,e,r){return this._el=n,this._obj=r||null,this.origin(e)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(n){return arguments.length?(this._origin=n||[0,0],this):this._origin.slice()}scene(n){return arguments.length?(this._scene=n,this):this._scene}on(){}off(){}_handlerIndex(n,e,r){for(let i=n?n.length:0;--i>=0;)if(n[i].type===e&&(!r||n[i].handler===r))return i;return-1}handlers(n){const e=this._handlers,r=[];if(n)r.push(...e[this.eventName(n)]);else for(const i in e)r.push(...e[i]);return r}eventName(n){const e=n.indexOf(".");return e<0?n:n.slice(0,e)}handleHref(n,e,r){this._loader.sanitize(r,{context:"href"}).then(i=>{const a=new MouseEvent(n.type,n),o=Xi(null,"a");for(const s in i)o.setAttribute(s,i[s]);o.dispatchEvent(a)}).catch(()=>{})}handleTooltip(n,e,r){if(e&&e.tooltip!=null){e=function(a,o,s,u){var l,c,f=a&&a.mark;if(f&&(l=Ae[f.marktype]).tip){for((c=Uc(o,s))[0]-=u[0],c[1]-=u[1];a=a.mark.group;)c[0]-=a.x||0,c[1]-=a.y||0;a=l.tip(f.items,c)}return a}(e,n,this.canvas(),this._origin);const i=r&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,n,e,i)}}getItemBoundingClientRect(n){const e=this.canvas();if(!e)return;const r=e.getBoundingClientRect(),i=this._origin,a=n.bounds,o=a.width(),s=a.height();let u=a.x1+i[0]+r.left,l=a.y1+i[1]+r.top;for(;n.mark&&(n=n.mark.group);)u+=n.x||0,l+=n.y||0;return{x:u,y:l,width:o,height:s,left:u,top:l,right:u+o,bottom:l+s}}}function Q7(t,n,e,r){t.element().setAttribute("title",r||"")}class bu{constructor(n){this._el=null,this._bgcolor=null,this._loader=new Ww(n)}initialize(n,e,r,i,a){return this._el=n,this.resize(e,r,i,a)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(n){return arguments.length===0?this._bgcolor:(this._bgcolor=n,this)}resize(n,e,r,i){return this._width=n,this._height=e,this._origin=r||[0,0],this._scale=i||1,this}dirty(){}render(n,e){const r=this;return r._call=function(){r._render(n,e)},r._call(),r._call=null,r}_render(){}renderAsync(n,e){const r=this.render(n,e);return this._ready?this._ready.then(()=>r):Promise.resolve(r)}_load(n,e){var r=this,i=r._loader[n](e);if(!r._ready){const a=r._call;r._ready=r._loader.ready().then(o=>{o&&a(),r._ready=null})}return i}sanitizeURL(n){return this._load("sanitizeURL",n)}loadImage(n){return this._load("loadImage",n)}}const xA="dragenter",Ic="dragleave",wA="dragover",p0="pointerdown",Wc="pointermove",Hc="pointerout",AA="pointerover",m0="mousedown",_A="mousemove",Gc="mouseout",kA="mouseover",Vc="click",DA="mousewheel",Yc="touchstart",Xc="touchmove",Jc="touchend",Z7=["keydown","keypress","keyup",xA,Ic,wA,p0,"pointerup",Wc,Hc,AA,m0,"mouseup",_A,Gc,kA,Vc,"dblclick","wheel",DA,Yc,Xc,Jc],g0=Wc,xu=Gc,y0=Vc;class wu extends h0{constructor(n,e){super(n,e),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Z7,this.pointermove=CA([Wc,_A],[AA,kA],[Hc,Gc]),this.dragover=CA([wA],[xA],[Ic]),this.pointerout=EA([Hc,Gc]),this.dragleave=EA([Ic])}initialize(n,e,r){return this._canvas=n&&d0(n,"canvas"),[Vc,m0,p0,Wc,Hc,Ic].forEach(i=>FA(this,i)),super.initialize(n,e,r)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(n){this.fire(DA,n)}pointerdown(n){this._down=this._active,this.fire(p0,n)}mousedown(n){this._down=this._active,this.fire(m0,n)}click(n){this._down===this._active&&(this.fire(Vc,n),this._down=null)}touchstart(n){this._touch=this.pickEvent(n.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Yc,n,!0)}touchmove(n){this.fire(Xc,n,!0)}touchend(n){this.fire(Jc,n,!0),this._touch=null}fire(n,e,r){const i=r?this._touch:this._active,a=this._handlers[n];if(e.vegaType=n,n===y0&&i&&i.href?this.handleHref(e,i,i.href):n!==g0&&n!==xu||this.handleTooltip(e,i,n!==xu),a)for(let o=0,s=a.length;o=0&&i.splice(a,1),this}pickEvent(n){const e=Uc(n,this._canvas),r=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-r[0],e[1]-r[1])}pick(n,e,r,i,a){const o=this.context();return Ae[n.marktype].pick.call(this,o,n,e,r,i,a)}}const t4=t=>t===Yc||t===Xc||t===Jc?[Yc,Xc,Jc]:[t];function FA(t,n){t4(n).forEach(e=>function(r,i){const a=r.canvas();a&&!r._events[i]&&(r._events[i]=1,a.addEventListener(i,r[i]?o=>r[i](o):o=>r.fire(i,o)))}(t,e))}function Kc(t,n,e){n.forEach(r=>t.fire(r,e))}function CA(t,n,e){return function(r){const i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||Kc(this,e,r),this._active=a,Kc(this,n,r)),Kc(this,t,r)}}function EA(t){return function(n){Kc(this,t,n),this._active=null}}function n4(t,n,e,r,i,a){const o=typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.parentNode!=null,s=t.getContext("2d"),u=o?typeof window<"u"&&window.devicePixelRatio||1:i;t.width=n*u,t.height=e*u;for(const l in a)s[l]=a[l];return o&&u!==1&&(t.style.width=n+"px",t.style.height=e+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*r[0],u*r[1]),t}class Qc extends bu{constructor(n){super(n),this._options={},this._redraw=!1,this._dirty=new cn,this._tempb=new cn}initialize(n,e,r,i,a,o){return this._options=o||{},this._canvas=this._options.externalContext?null:qi(1,1,this._options.type),n&&this._canvas&&(Pe(n,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(n,e,r,i,a)}resize(n,e,r,i){if(super.resize(n,e,r,i),this._canvas)n4(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const a=this._options.externalContext;a||j("CanvasRenderer is missing a valid canvas or context"),a.scale(this._scale,this._scale),a.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(n){const e=this._tempb.clear().union(n.bounds);let r=n.mark.group;for(;r;)e.translate(r.x||0,r.y||0),r=r.mark.group;this._dirty.union(e)}_render(n,e){const r=this.context(),i=this._origin,a=this._width,o=this._height,s=this._dirty,u=e4(i,a,o);r.save();const l=this._redraw||s.empty()?(this._redraw=!1,u.expand(1)):function(c,f,d){return f.expand(1).round(),c.pixelRatio%1&&f.scale(c.pixelRatio).round().scale(1/c.pixelRatio),f.translate(-d[0]%1,-d[1]%1),c.beginPath(),c.rect(f.x1,f.y1,f.width(),f.height()),c.clip(),f}(r,u.intersect(s),i);return this.clear(-i[0],-i[1],a,o),this.draw(r,n,l,e),r.restore(),s.clear(),this}draw(n,e,r,i){if(e.marktype!=="group"&&i!=null&&!i.includes(e.marktype))return;const a=Ae[e.marktype];e.clip&&function(o,s){var u=s.clip;o.save(),bt(u)?(o.beginPath(),u(o),o.clip()):rA(o,s.group)}(n,e),a.draw.call(this,n,e,r,i),e.clip&&n.restore()}clear(n,e,r,i){const a=this._options,o=this.context();a.type==="pdf"||a.externalContext||o.clearRect(n,e,r,i),this._bgcolor!=null&&(o.fillStyle=this._bgcolor,o.fillRect(n,e,r,i))}}const e4=(t,n,e)=>new cn().set(0,0,n,e).translate(-t[0],-t[1]);class $A extends h0{constructor(n,e){super(n,e);const r=this;r._hrefHandler=v0(r,(i,a)=>{a&&a.href&&r.handleHref(i,a,a.href)}),r._tooltipHandler=v0(r,(i,a)=>{r.handleTooltip(i,a,i.type!==xu)})}initialize(n,e,r){let i=this._svg;return i&&(i.removeEventListener(y0,this._hrefHandler),i.removeEventListener(g0,this._tooltipHandler),i.removeEventListener(xu,this._tooltipHandler)),this._svg=i=n&&d0(n,"svg"),i&&(i.addEventListener(y0,this._hrefHandler),i.addEventListener(g0,this._tooltipHandler),i.addEventListener(xu,this._tooltipHandler)),super.initialize(n,e,r)}canvas(){return this._svg}on(n,e){const r=this.eventName(n),i=this._handlers;if(this._handlerIndex(i[r],n,e)<0){const a={type:n,handler:e,listener:v0(this,e)};(i[r]||(i[r]=[])).push(a),this._svg&&this._svg.addEventListener(r,a.listener)}return this}off(n,e){const r=this.eventName(n),i=this._handlers[r],a=this._handlerIndex(i,n,e);return a>=0&&(this._svg&&this._svg.removeEventListener(r,i[a].listener),i.splice(a,1)),this}}const v0=(t,n)=>e=>{let r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)},SA="aria-hidden",b0="aria-label",x0="role",w0="aria-roledescription",MA="graphics-object",A0="graphics-symbol",BA=(t,n,e)=>({[x0]:t,[w0]:n,[b0]:e||void 0}),r4=Dr(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),zA={axis:{desc:"axis",caption:function(t){const n=t.datum,e=t.orient,r=n.title?PA(t):null,i=t.context,a=i.scales[n.scale].value,o=i.dataflow.locale(),s=a.type;return`${e==="left"||e==="right"?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${No(s)?"discrete":s} scale with ${Sw(o,a,t)}`}},legend:{desc:"legend",caption:function(t){const n=t.datum,e=n.title?PA(t):null,r=`${n.type||""} legend`.trim(),i=n.scales,a=Object.keys(i),o=t.context,s=o.scales[i[a[0]]].value,u=o.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(e?` titled '${e}'`:"")+` for ${function(c){return c=c.map(f=>f+(f==="fill"||f==="stroke"?" color":"")),c.length<2?c[0]:c.slice(0,-1).join(", ")+" and "+Bt(c)}(a)} with ${Sw(u,s,t)}`;var l}},"title-text":{desc:"title",caption:t=>`Title text '${TA(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${TA(t)}'`}},OA={ariaRole:x0,ariaRoleDescription:w0,description:b0};function NA(t,n){const e=n.aria===!1;if(t(SA,e||void 0),e||n.description==null)for(const r in OA)t(OA[r],void 0);else{const r=n.mark.marktype;t(b0,n.description),t(x0,n.ariaRole||(r==="group"?MA:A0)),t(w0,n.ariaRoleDescription||`${r} mark`)}}function RA(t){return t.aria===!1?{[SA]:!0}:r4[t.role]?null:zA[t.role]?function(n,e){try{const r=n.items[0],i=e.caption||(()=>"");return BA(e.role||A0,e.desc,r.description||i(r))}catch{return null}}(t,zA[t.role]):function(n){const e=n.marktype,r=e==="group"||e==="text"||n.items.some(i=>i.description!=null&&i.aria!==!1);return BA(r?MA:A0,`${e} mark container`,n.description)}(t)}function TA(t){return K(t.text).join(" ")}function PA(t){try{return K(Bt(t.items).items[0].text).join(" ")}catch{return null}}const jA=t=>(t+"").replace(/&/g,"&").replace(//g,">");function _0(){let t="",n="",e="";const r=[],i=()=>n=e="",a=(s,u)=>{var l;return u!=null&&(n+=` ${s}="${l=u,jA(l).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ")}"`),o},o={open(s){(f=>{n&&(t+=`${n}>${e}`,i()),r.push(f)})(s),n="<"+s;for(var u=arguments.length,l=new Array(u>1?u-1:0),c=1;c${e}`:"/>"):``,i(),o},attr:a,text:s=>(e+=jA(s),o),toString:()=>t};return o}const LA=t=>qA(_0(),t)+"";function qA(t,n){if(t.open(n.tagName),n.hasAttributes()){const e=n.attributes,r=e.length;for(let i=0;i{c.dirty=e})),i.zdirty||(r.exit?(o.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(o,l._svg,l)):r._svg&&(l=r._svg.parentNode,l&&l.removeChild(r._svg)),r._svg=null):(r=o.nested?i.items[0]:r,r._update!==e&&(r._svg&&r._svg.ownerSVGElement?this._update(o,r._svg,r):(this._dirtyAll=!1,WA(r,e)),r._update=e)));return!this._dirtyAll}mark(n,e,r,i){if(!this.isDirty(e))return e._svg;const a=this._svg,o=e.marktype,s=Ae[o],u=e.interactive===!1?"none":null,l=s.tag==="g",c=HA(e,n,r,"g",a);if(o!=="group"&&i!=null&&!i.includes(o))return Pe(c,0),e._svg;c.setAttribute("class",bA(e));const f=RA(e);for(const m in f)Vn(c,m,f[m]);l||Vn(c,"pointer-events",u),Vn(c,"clip-path",e.clip?Im(this,e,e.group):null);let d=null,h=0;const p=m=>{const g=this.isDirty(m),y=HA(m,c,d,s.tag,a);g&&(this._update(s,y,m),l&&function(v,x,b,w){x=x.lastChild.previousSibling;let A,_=0;Qe(b,k=>{A=v.mark(x,k,A,w),++_}),Pe(x,1+_)}(this,y,m,i)),d=y,++h};return s.nested?e.items.length&&p(e.items[0]):Qe(e,p),Pe(c,h),c}_update(n,e,r){oi=e,On=e.__values__,NA(Au,r),n.attr(Au,r,this);const i=o4[n.type];i&&i.call(this,n,e,r),oi&&this.style(oi,r)}style(n,e){if(e!=null){for(const r in Zc){let i=r==="font"?yu(e):e[r];if(i===On[r])continue;const a=Zc[r];i==null?n.removeAttribute(a):(Tm(i)&&(i=Bw(i,this._defs.gradient,GA())),n.setAttribute(a,i+"")),On[r]=i}for(const r in tf)nf(n,tf[r],e[r])}}defs(){const n=this._svg,e=this._defs;let r=e.el,i=0;for(const a in e.gradient)r||(e.el=r=dn(n,1,"defs",hn)),i=i4(r,e.gradient[a],i);for(const a in e.clipping)r||(e.el=r=dn(n,1,"defs",hn)),i=a4(r,e.clipping[a],i);r&&(i===0?(n.removeChild(r),e.el=null):Pe(r,i))}_clearDefs(){const n=this._defs;n.gradient={},n.clipping={}}}function WA(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function i4(t,n,e){let r,i,a;if(n.gradient==="radial"){let o=dn(t,e++,"pattern",hn);Ji(o,{id:_c+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),o=dn(o,0,"rect",hn),Ji(o,{width:1,height:1,fill:`url(${GA()}#${n.id})`}),Ji(t=dn(t,e++,"radialGradient",hn),{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else Ji(t=dn(t,e++,"linearGradient",hn),{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(r=0,i=n.stops.length;r1&&s.previousSibling!=u}(o,e))&&n.insertBefore(o,e?e.nextSibling:n.firstChild),o}let oi=null,On=null;const o4={group(t,n,e){const r=oi=n.childNodes[2];On=r.__values__,t.foreground(Au,e,this),On=n.__values__,oi=n.childNodes[1],t.content(Au,e,this);const i=oi=n.childNodes[0];t.background(Au,e,this);const a=e.mark.interactive===!1?"none":null;if(a!==On.events&&(Vn(r,"pointer-events",a),Vn(i,"pointer-events",a),On.events=a),e.strokeForeground&&e.stroke){const o=e.fill;Vn(r,"display",null),this.style(i,e),Vn(i,"stroke",null),o&&(e.fill=null),On=r.__values__,this.style(r,e),o&&(e.fill=o),oi=null}else Vn(r,"display","none")},image(t,n,e){e.smooth===!1?(nf(n,"image-rendering","optimizeSpeed"),nf(n,"image-rendering","pixelated")):nf(n,"image-rendering",null)},text(t,n,e){const r=gu(e);let i,a,o,s;P(r)?(a=r.map(u=>Yi(e,u)),i=a.join(` +`),i!==On.text&&(Pe(n,0),o=n.ownerDocument,s=Vi(e),a.forEach((u,l)=>{const c=Xi(o,"tspan",hn);c.__data__=e,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",s)),n.appendChild(c)}),On.text=i)):(a=Yi(e,r),a!==On.text&&(n.textContent=a,On.text=a)),Vn(n,"font-family",yu(e)),Vn(n,"font-size",Sr(e)+"px"),Vn(n,"font-style",e.fontStyle),Vn(n,"font-variant",e.fontVariant),Vn(n,"font-weight",e.fontWeight)}};function Au(t,n,e){n!==On[t]&&(e?function(r,i,a,o){a!=null?r.setAttributeNS(o,i,a):r.removeAttributeNS(o,i)}(oi,t,n,e):Vn(oi,t,n),On[t]=n)}function nf(t,n,e){e!==On[n]&&(e==null?t.style.removeProperty(n):t.style.setProperty(n,e+""),On[n]=e)}function Ji(t,n){for(const e in n)Vn(t,e,n[e])}function Vn(t,n,e){e!=null?t.setAttribute(n,e):t.removeAttribute(n)}function GA(){let t;return typeof window>"u"?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class VA extends bu{constructor(n){super(n),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(n){const e=_0();e.open("svg",xt({},mu,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const r=this._bgcolor;return r&&r!=="transparent"&&r!=="none"&&e.open("rect",{width:this._width,height:this._height,fill:r}).close(),e.open("g",UA,{transform:"translate("+this._origin+")"}),this.mark(e,n),e.close(),this.defs(e),this._text=e.close()+"",this}mark(n,e){const r=Ae[e.marktype],i=r.tag,a=[NA,r.attr];n.open("g",{class:bA(e),"clip-path":e.clip?Im(this,e,e.group):null},RA(e),{"pointer-events":i!=="g"&&e.interactive===!1?"none":null});const o=s=>{const u=this.href(s);if(u&&n.open("a",u),n.open(i,this.attr(e,s,a,i!=="g"?i:null)),i==="text"){const l=gu(s);if(P(l)){const c={x:0,dy:Vi(s)};for(let f=0;fthis.mark(n,d)),n.close(),l&&f?(c&&(s.fill=null),s.stroke=f,n.open("path",this.attr(e,s,r.foreground,"bgrect")).close(),c&&(s.fill=c)):n.open("path",this.attr(e,s,r.foreground,"bgfore")).close()}n.close(),u&&n.close()};return r.nested?e.items&&e.items.length&&o(e.items[0]):Qe(e,o),n.close()}href(n){const e=n.href;let r;if(e){if(r=this._hrefs&&this._hrefs[e])return r;this.sanitizeURL(e).then(i=>{i["xlink:href"]=i.href,i.href=null,(this._hrefs||(this._hrefs={}))[e]=i})}return null}attr(n,e,r,i){const a={},o=(s,u,l,c)=>{a[c||s]=u};return Array.isArray(r)?r.forEach(s=>s(o,e,this)):r(o,e,this),i&&function(s,u,l,c,f){let d;if(u==null||(c==="bgrect"&&l.interactive===!1&&(s["pointer-events"]="none"),c==="bgfore"&&(l.interactive===!1&&(s["pointer-events"]="none"),s.display="none",u.fill!==null)))return s;c==="image"&&u.smooth===!1&&(d=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),c==="text"&&(s["font-family"]=yu(u),s["font-size"]=Sr(u)+"px",s["font-style"]=u.fontStyle,s["font-variant"]=u.fontVariant,s["font-weight"]=u.fontWeight);for(const h in Zc){let p=u[h];const m=Zc[h];(p!=="transparent"||m!=="fill"&&m!=="stroke")&&p!=null&&(Tm(p)&&(p=Bw(p,f.gradient,"")),s[m]=p)}for(const h in tf){const p=u[h];p!=null&&(d=d||[],d.push(`${tf[h]}: ${p};`))}d&&(s.style=d.join(" "))}(a,e,n,i,this._defs),a}defs(n){const e=this._defs.gradient,r=this._defs.clipping;if(Object.keys(e).length+Object.keys(r).length!==0){n.open("defs");for(const i in e){const a=e[i],o=a.stops;a.gradient==="radial"?(n.open("pattern",{id:_c+i,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),n.open("rect",{width:"1",height:"1",fill:"url(#"+i+")"}).close(),n.close(),n.open("radialGradient",{id:i,fx:a.x1,fy:a.y1,fr:a.r1,cx:a.x2,cy:a.y2,r:a.r2})):n.open("linearGradient",{id:i,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2});for(let s=0;s!Ze.svgMarkTypes.includes(i));this._svgRenderer.render(n,Ze.svgMarkTypes),this._canvasRenderer.render(n,r)}resize(n,e,r,i){return super.resize(n,e,r,i),this._svgRenderer.resize(n,e,r,i),this._canvasRenderer.resize(n,e,r,i),this}background(n){return Ze.svgOnTop?this._canvasRenderer.background(n):this._svgRenderer.background(n),this}}class YA extends wu{constructor(n,e){super(n,e)}initialize(n,e,r){const i=dn(dn(n,0,"div"),Ze.svgOnTop?0:1,"div");return super.initialize(i,e,r)}}const XA="canvas",JA="hybrid",KA="none",Ki={Canvas:XA,PNG:"png",SVG:"svg",Hybrid:JA,None:KA},qa={};function ef(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?(qa[t]=n,this):qa[t]}function QA(t,n,e){const r=[],i=new cn().union(n),a=t.marktype;return a?ZA(t,i,e,r):a==="group"?t_(t,i,e,r):j("Intersect scene must be mark node or group item.")}function ZA(t,n,e,r){if(function(i,a,o){return i.bounds&&a.intersects(i.bounds)&&(i.marktype==="group"||i.interactive!==!1&&(!o||o(i)))}(t,n,e)){const i=t.items,a=t.marktype,o=i.length;let s=0;if(a==="group")for(;s=0;o--)if(s[o]!=u[o])return!1;for(o=s.length-1;o>=0;o--)if(!C0(r[a=s[o]],i[a],a))return!1;return typeof r==typeof i}(t,n):t==n)}function r_(t,n){return C0(Ro(t),Ro(n))}const Uo="top",tr="left",nr="right",Qi="bottom",E0="start",$0="middle",Yn="end",rf="group",S0="axis",M0="title",s4="frame",u4="scope",B0="legend",i_="row-header",a_="row-footer",o_="row-title",s_="column-header",u_="column-footer",l_="column-title",l4="padding",c_="fit",f_="fit-x",d_="fit-y",z0="none",af="all",O0="each",N0="flush",Zi="column",ta="row";function h_(t){O.call(this,null,t)}function of(t,n,e){return n(t.bounds.clear(),t,e)}V(h_,O,{transform(t,n){const e=n.dataflow,r=t.mark,i=r.marktype,a=Ae[i],o=a.bound;let s,u=r.bounds;if(a.nested)r.items.length&&e.dirty(r.items[0]),u=of(r,o),r.items.forEach(l=>{l.bounds.clear().union(u)});else if(i===rf||t.modified())switch(n.visit(n.MOD,l=>e.dirty(l)),u.clear(),r.items.forEach(l=>u.union(of(l,o))),r.role){case S0:case B0:case M0:n.reflow()}else s=n.changed(n.REM),n.visit(n.ADD,l=>{u.union(of(l,o))}),n.visit(n.MOD,l=>{s=s||u.alignsWith(l.bounds),e.dirty(l),u.union(of(l,o))}),s&&(u.clear(),r.items.forEach(l=>u.union(l.bounds)));return e_(r),n.modifies("bounds")}});const p_=":vega_identifier:";function R0(t){O.call(this,0,t)}function m_(t){O.call(this,null,t)}function g_(t){O.call(this,null,t)}R0.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},V(R0,O,{transform(t,n){const e=(i=n.dataflow)._signals[p_]||(i._signals[p_]=i.add(0)),r=t.as;var i;let a=e.value;return n.visit(n.ADD,o=>o[r]=o[r]||++a),e.set(this.value=a),n}}),V(m_,O,{transform(t,n){let e=this.value;e||(e=n.dataflow.scenegraph().mark(t.markdef,function(i){const a=i.groups,o=i.parent;return a&&a.size===1?a.get(Object.keys(a.object)[0]):a&&o?a.lookup(o):null}(t),t.index),e.group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);const r=e.marktype===rf?Cc:Fc;return n.visit(n.ADD,i=>r.call(i,e)),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n}});const y_={parity:t=>t.filter((n,e)=>e%2?n.opacity=0:1),greedy:(t,n)=>{let e;return t.filter((r,i)=>i&&v_(e.bounds,r.bounds,n)?r.opacity=0:(e=r,1))}},v_=(t,n,e)=>e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2),b_=(t,n)=>{for(var e,r=1,i=t.length,a=t[0].bounds;r{const n=t.bounds;return n.width()>1&&n.height()>1},x_=t=>(t.forEach(n=>n.opacity=1),t),w_=(t,n)=>t.reflow(n.modified()).modifies("opacity");function A_(t){O.call(this,null,t)}V(g_,O,{transform(t,n){const e=y_[t.method]||y_.parity,r=t.separation||0;let i,a,o=n.materialize(n.SOURCE).source;if(!o||!o.length)return;if(!t.method)return t.modified("method")&&(x_(o),n=w_(n,t)),n;if(o=o.filter(c4),!o.length)return;if(t.sort&&(o=o.slice().sort(t.sort)),i=x_(o),n=w_(n,t),i.length>=3&&b_(i,r)){do i=e(i,r);while(i.length>=3&&b_(i,r));i.length<3&&!Bt(o).opacity&&(i.length>1&&(Bt(i).opacity=0),Bt(o).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(a=((u,l,c)=>{var f=u.range(),d=new cn;return l===Uo||l===Qi?d.set(f[0],-1/0,f[1],1/0):d.set(-1/0,f[0],1/0,f[1]),d.expand(c||1),h=>d.encloses(h.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),o.forEach(u=>{a(u)||(u.opacity=0)}));const s=i[0].mark.bounds.clear();return o.forEach(u=>{u.opacity&&s.union(u.bounds)}),n}}),V(A_,O,{transform(t,n){const e=n.dataflow;if(n.visit(n.ALL,r=>e.dirty(r)),n.fields&&n.fields.zindex){const r=n.source&&n.source[0];r&&(r.mark.zdirty=!0)}}});const Nn=new cn;function Io(t,n,e){return t[n]===e?0:(t[n]=e,1)}function f4(t){var n=t.items[0].orient;return n===tr||n===nr}function d4(t,n,e,r){var i,a,o=n.items[0],s=o.datum,u=o.translate!=null?o.translate:.5,l=o.orient,c=function(A){let _=+A.grid;return[A.ticks?_++:-1,A.labels?_++:-1,_+ +A.domain]}(s),f=o.range,d=o.offset,h=o.position,p=o.minExtent,m=o.maxExtent,g=s.title&&o.items[c[2]].items[0],y=o.titlePadding,v=o.bounds,x=g&&u0(g),b=0,w=0;switch(Nn.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(o.items[i].bounds),(i=c[1])>-1&&v.union(o.items[i].bounds),l){case Uo:b=h||0,w=-d,a=Math.max(p,Math.min(m,-v.y1)),v.add(0,-a).add(f,0),g&&sf(t,g,a,y,x,0,-1,v);break;case tr:b=-d,w=h||0,a=Math.max(p,Math.min(m,-v.x1)),v.add(-a,0).add(0,f),g&&sf(t,g,a,y,x,1,-1,v);break;case nr:b=e+d,w=h||0,a=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(a,f),g&&sf(t,g,a,y,x,1,1,v);break;case Qi:b=h||0,w=r+d,a=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,a),g&&sf(t,g,a,y,0,0,1,v);break;default:b=o.x,w=o.y}return ai(v.translate(b,w),o),Io(o,"x",b+u)|Io(o,"y",w+u)&&(o.bounds=Nn,t.dirty(o),o.bounds=v,t.dirty(o)),o.mark.bounds.clear().union(v)}function sf(t,n,e,r,i,a,o,s){const u=n.bounds;if(n.auto){const l=o*(e+i+r);let c=0,f=0;t.dirty(n),a?c=(n.x||0)-(n.x=l):f=(n.y||0)-(n.y=l),n.mark.bounds.clear().union(u.translate(-c,-f)),t.dirty(n)}s.union(u)}const __=(t,n)=>Math.floor(Math.min(t,n)),k_=(t,n)=>Math.ceil(Math.max(t,n));function h4(t){return new cn().set(0,0,t.width||0,t.height||0)}function p4(t){const n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function Yt(t,n,e){const r=Z(t)?t[n]:t;return r??(e!==void 0?e:0)}function D_(t){return t<0?Math.ceil(-t):0}function F_(t,n,e){var r,i,a,o,s,u,l,c,f,d,h,p=!e.nodirty,m=e.bounds===N0?h4:p4,g=Nn.set(0,0,0,0),y=Yt(e.align,Zi),v=Yt(e.align,ta),x=Yt(e.padding,Zi),b=Yt(e.padding,ta),w=e.columns||n.length,A=w<=0?1:Math.ceil(n.length/w),_=n.length,k=Array(_),F=Array(w),C=0,D=Array(_),E=Array(A),$=0,M=Array(_),S=Array(_),B=Array(_);for(i=0;i1)for(i=0;i<_;++i)(f=(s=y===af?C:F[i%w])-B[i].x2-n[i].x-M[i])>0&&(M[i]+=f/2);if(v&&Yt(e.center,ta)&&w!==1)for(i=0;i<_;++i)(d=(s=v===af?$:E[~~(i/w)])-B[i].y2-n[i].y-S[i])>0&&(S[i]+=d/2);for(i=0;i<_;++i)g.union(B[i].translate(M[i],S[i]));switch(f=Yt(e.anchor,"x"),d=Yt(e.anchor,"y"),Yt(e.anchor,Zi)){case Yn:f-=g.width();break;case $0:f-=g.width()/2}switch(Yt(e.anchor,ta)){case Yn:d-=g.height();break;case $0:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),i=0;i<_;++i)n[i].mark.bounds.clear();for(i=0;i<_;++i)(u=n[i]).x+=M[i]+=f,u.y+=S[i]+=d,g.union(u.mark.bounds.union(u.bounds.translate(M[i],S[i]))),p&&t.dirty(u);return g}function m4(t,n,e){var r,i,a,o,s,u,l,c=function(v){var x,b,w=v.items,A=w.length,_=0;const k={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;_i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),k+=a,m=0,y=n.length;m=0&&(b=e[g])==null;g-=d);s?(w=h==null?b.x:Math.round(b.bounds.x1+h*b.bounds.width()),A=k):(w=k,A=h==null?b.y:Math.round(b.bounds.y1+h*b.bounds.height())),v.union(x.bounds.translate(w-(x.x||0),A-(x.y||0))),x.x=w,x.y=A,t.dirty(x),F=o(F,v[l])}return F}function C_(t,n,e,r,i,a){if(n){t.dirty(n);var o=e,s=e;r?o=Math.round(i.x1+a*i.width()):s=Math.round(i.y1+a*i.height()),n.bounds.translate(o-(n.x||0),s-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=o,n.y=s,t.dirty(n)}}function v4(t,n,e,r,i,a,o){const s=function(d,h){const p=d[h]||{};return(m,g)=>p[m]!=null?p[m]:d[m]!=null?d[m]:g}(e,n),u=function(d,h){let p=-1/0;return d.forEach(m=>{m.offset!=null&&(p=Math.max(p,m.offset))}),p>-1/0?p:h}(t,s("offset",0)),l=s("anchor",E0),c=l===Yn?1:l===$0?.5:0,f={align:O0,bounds:s("bounds",N0),columns:s("direction")==="vertical"?1:t.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(n){case tr:f.anchor={x:Math.floor(r.x1)-u,column:Yn,y:c*(o||r.height()+2*r.y1),row:l};break;case nr:f.anchor={x:Math.ceil(r.x2)+u,y:c*(o||r.height()+2*r.y1),row:l};break;case Uo:f.anchor={y:Math.floor(i.y1)-u,row:Yn,x:c*(a||i.width()+2*i.x1),column:l};break;case Qi:f.anchor={y:Math.ceil(i.y2)+u,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:u,y:u};break;case"top-right":f.anchor={x:a-u,y:u,column:Yn};break;case"bottom-left":f.anchor={x:u,y:o-u,row:Yn};break;case"bottom-right":f.anchor={x:a-u,y:o-u,column:Yn,row:Yn}}return f}function b4(t,n){var e,r,i=n.items[0],a=i.datum,o=i.orient,s=i.bounds,u=i.x,l=i.y;return i._bounds?i._bounds.clear().union(s):i._bounds=s.clone(),s.clear(),function(c,f,d){var h=f.padding,p=h-d.x,m=h-d.y;if(f.datum.title){var g=f.items[1].items[0],y=g.anchor,v=f.titlePadding||0,x=h-g.x,b=h-g.y;switch(g.orient){case tr:p+=Math.ceil(g.bounds.width())+v;break;case nr:case Qi:break;default:m+=g.bounds.height()+v}switch((p||m)&&_u(c,d,p,m),g.orient){case tr:b+=Wo(f,d,g,y,1,1);break;case nr:x+=Wo(f,d,g,Yn,0,0)+v,b+=Wo(f,d,g,y,1,1);break;case Qi:x+=Wo(f,d,g,y,0,0),b+=Wo(f,d,g,Yn,-1,0,1)+v;break;default:x+=Wo(f,d,g,y,0,0)}(x||b)&&_u(c,g,x,b),(x=Math.round(g.bounds.x1-h))<0&&(_u(c,d,-x,0),_u(c,g,-x,0))}else(p||m)&&_u(c,d,p,m)}(t,i,i.items[0].items[0]),s=function(c,f){return c.items.forEach(d=>f.union(d.bounds)),f.x1=c.padding,f.y1=c.padding,f}(i,s),e=2*i.padding,r=2*i.padding,s.empty()||(e=Math.ceil(s.width()+e),r=Math.ceil(s.height()+r)),a.type==="symbol"&&function(c){const f=c.reduce((d,h)=>(d[h.column]=Math.max(h.bounds.x2-h.x,d[h.column]||0),d),{});c.forEach(d=>{d.width=f[d.column],d.height=d.bounds.y2-d.y})}(i.items[0].items[0].items[0].items),o!==z0&&(i.x=u=0,i.y=l=0),i.width=e,i.height=r,ai(s.set(u,l,u+e,l+r),i),i.mark.bounds.clear().union(s),i}function Wo(t,n,e,r,i,a,o){const s=t.datum.type!=="symbol",u=e.datum.vgrad,l=(!s||!a&&u||o?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&a?l:0,f=u&&a?0:l,d=i<=0?0:u0(e);return Math.round(r===E0?c:r===Yn?f-d:.5*(l-d))}function _u(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function E_(t){O.call(this,null,t)}V(E_,O,{transform(t,n){const e=n.dataflow;return t.mark.items.forEach(r=>{t.layout&&m4(e,r,t.layout),function(i,a,o){var s,u,l,c,f,d=a.items,h=Math.max(0,a.width||0),p=Math.max(0,a.height||0),m=new cn().set(0,0,h,p),g=m.clone(),y=m.clone(),v=[];for(c=0,f=d.length;c{(l=b.orient||nr)!==z0&&(x[l]||(x[l]=[])).push(b)});for(const b in x){const w=x[b];F_(i,w,v4(w,b,o.legends,g,y,h,p))}v.forEach(b=>{const w=b.bounds;if(w.equals(b._bounds)||(b.bounds=b._bounds,i.dirty(b),b.bounds=w,i.dirty(b)),!o.autosize||o.autosize.type!==c_&&o.autosize.type!==f_&&o.autosize.type!==d_)m.union(w);else switch(b.orient){case tr:case nr:m.add(w.x1,0).add(w.x2,0);break;case Uo:case Qi:m.add(0,w.y1).add(0,w.y2)}})}m.union(g).union(y),s&&m.union(function(x,b,w,A,_){var k,F=b.items[0],C=F.frame,D=F.orient,E=F.anchor,$=F.offset,M=F.padding,S=F.items[0].items[0],B=F.items[1]&&F.items[1].items[0],z=D===tr||D===nr?A:w,N=0,W=0,X=0,L=0,et=0;if(C!==rf?D===tr?(N=_.y2,z=_.y1):D===nr?(N=_.y1,z=_.y2):(N=_.x1,z=_.x2):D===tr&&(N=A,z=0),k=E===E0?N:E===Yn?z:(N+z)/2,B&&B.text){switch(D){case Uo:case Qi:et=S.bounds.height()+M;break;case tr:L=S.bounds.width()+M;break;case nr:L=-S.bounds.width()-M}Nn.clear().union(B.bounds),Nn.translate(L-(B.x||0),et-(B.y||0)),Io(B,"x",L)|Io(B,"y",et)&&(x.dirty(B),B.bounds.clear().union(Nn),B.mark.bounds.clear().union(Nn),x.dirty(B)),Nn.clear().union(B.bounds)}else Nn.clear();switch(Nn.union(S.bounds),D){case Uo:W=k,X=_.y1-Nn.height()-$;break;case tr:W=_.x1-Nn.width()-$,X=k;break;case nr:W=_.x2+Nn.width()+$,X=k;break;case Qi:W=k,X=_.y2+$;break;default:W=F.x,X=F.y}return Io(F,"x",W)|Io(F,"y",X)&&(Nn.translate(W,X),x.dirty(F),F.bounds.clear().union(Nn),b.bounds.clear().union(Nn),x.dirty(F)),F.bounds}(i,s,h,p,m)),a.clip&&m.set(0,0,a.width||0,a.height||0),function(x,b,w,A){const _=A.autosize||{},k=_.type;if(x._autosize<1||!k)return;let F=x._width,C=x._height,D=Math.max(0,b.width||0),E=Math.max(0,Math.ceil(-w.x1)),$=Math.max(0,b.height||0),M=Math.max(0,Math.ceil(-w.y1));const S=Math.max(0,Math.ceil(w.x2-D)),B=Math.max(0,Math.ceil(w.y2-$));if(_.contains===l4){const z=x.padding();F-=z.left+z.right,C-=z.top+z.bottom}k===z0?(E=0,M=0,D=F,$=C):k===c_?(D=Math.max(0,F-E-S),$=Math.max(0,C-M-B)):k===f_?(D=Math.max(0,F-E-S),C=$+M+B):k===d_?(F=D+E+S,$=Math.max(0,C-M-B)):k==="pad"&&(F=D+E+S,C=$+M+B),x._resizeView(F,C,D,$,[E,M],_.resize)}(i,a,m,o)}(e,r,t)}),function(r){return r&&r.mark.role!=="legend-entry"}(t.mark.group)?n.reflow():n}});const x4=Object.freeze(Object.defineProperty({__proto__:null,bound:h_,identifier:R0,mark:m_,overlap:g_,render:A_,viewlayout:E_},Symbol.toStringTag,{value:"Module"}));function $_(t){O.call(this,null,t)}function S_(t){O.call(this,null,t)}function w4(){return St({})}function M_(t){O.call(this,null,t)}function B_(t){O.call(this,[],t)}V($_,O,{transform(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.dataflow.locale(),r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=this.value,a=t.scale,o=Om(a,t.count==null?t.values?t.values.length:10:t.count,t.minstep),s=t.format||_w(e,a,o,t.formatSpecifier,t.formatType,!!t.values),u=t.values?Aw(a,t.values,o):Nm(a,o);return i&&(r.rem=i),i=u.map((l,c)=>St({index:c/(u.length-1||1),value:l,label:s(l)})),t.extra&&i.length&&i.push(St({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),V(S_,O,{transform(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.item||w4,a=t.key||st,o=this.value;return P(r.encode)&&(r.encode=null),o&&(t.modified("key")||n.modified(a))&&j("DataJoin does not support modified key function or fields."),o||(n=n.addAll(),this.value=o=function(s){const u=Fo().test(l=>l.exit);return u.lookup=l=>u.get(s(l)),u}(a)),n.visit(n.ADD,s=>{const u=a(s);let l=o.get(u);l?l.exit?(o.empty--,r.add.push(l)):r.mod.push(l):(l=i(s),o.set(u,l),r.add.push(l)),l.datum=s,l.exit=!1}),n.visit(n.MOD,s=>{const u=a(s),l=o.get(u);l&&(l.datum=s,r.mod.push(l))}),n.visit(n.REM,s=>{const u=a(s),l=o.get(u);s!==l.datum||l.exit||(r.rem.push(l),l.exit=!0,++o.empty)}),n.changed(n.ADD_MOD)&&r.modifies("datum"),(n.clean()||t.clean&&o.empty>e.cleanThreshold)&&e.runAfter(o.clean),r}}),V(M_,O,{transform(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,a=n.encode;if(P(a)){if(!e.changed()&&!a.every(f=>i[f]))return n.StopPropagation;a=a[0],e.encode=null}var o=a==="enter",s=i.update||Oi,u=i.enter||Oi,l=i.exit||Oi,c=(a&&!o?i[a]:s)||Oi;if(n.changed(n.ADD)&&(n.visit(n.ADD,f=>{u(f,t),s(f,t)}),e.modifies(u.output),e.modifies(s.output),c!==Oi&&c!==s&&(n.visit(n.ADD,f=>{c(f,t)}),e.modifies(c.output))),n.changed(n.REM)&&l!==Oi&&(n.visit(n.REM,f=>{l(f,t)}),e.modifies(l.output)),o||c!==Oi){const f=n.MOD|(t.modified()?n.REFLOW:0);o?(n.visit(f,d=>{const h=u(d,t)||r;(c(d,t)||h)&&e.mod.push(d)}),e.mod.length&&e.modifies(u.output)):n.visit(f,d=>{(c(d,t)||r)&&e.mod.push(d)}),e.mod.length&&e.modifies(c.output)}return e.changed()?e:n.StopPropagation}}),V(B_,O,{transform(t,n){if(this.value!=null&&!t.modified())return n.StopPropagation;var e,r,i,a,o,s=n.dataflow.locale(),u=n.fork(n.NO_SOURCE|n.NO_FIELDS),l=this.value,c=t.type||Ac,f=t.scale,d=+t.limit,h=Om(f,t.count==null?5:t.count,t.minstep),p=!!t.values||c===Ac,m=t.format||Cw(s,f,h,c,t.formatSpecifier,t.formatType,p),g=t.values||Fw(f,h);return l&&(u.rem=l),c===Ac?(d&&g.length>d?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=g.slice(0,d-1),o=!0):l=g,bt(i=t.size)?(t.values||f(l[0])!==0||(l=l.slice(1)),a=l.reduce((y,v)=>Math.max(y,i(v,t)),0)):i=In(a=i||8),l=l.map((y,v)=>St({index:v,label:m(y,v,l),value:y,offset:a,size:i(y,t)})),o&&(o=g[l.length],l.push(St({index:l.length,label:`\u2026${g.length-l.length} entries`,value:o,offset:a,size:i(o,t)})))):c==="gradient"?(e=f.domain(),r=vw(f,e[0],Bt(e)),g.length<3&&!t.values&&e[0]!==Bt(e)&&(g=[e[0],Bt(e)]),l=g.map((y,v)=>St({index:v,label:m(y,v,g),value:y,perc:r(y)}))):(i=g.length-1,r=function(y){const v=y.domain(),x=v.length-1;let b=+v[0],w=+Bt(v),A=w-b;if(y.type===bc){const _=x?A/x:.1;b-=_,w+=_,A=w-b}return _=>(_-b)/A}(f),l=g.map((y,v)=>St({index:v,label:m(y,v,g),value:y,perc:v?r(y):0,perc2:v===i?1:r(g[v+1])}))),u.source=l,u.add=l,this.value=l,u}});const A4=t=>t.source.x,_4=t=>t.source.y,k4=t=>t.target.x,D4=t=>t.target.y;function T0(t){O.call(this,{},t)}T0.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},V(T0,O,{transform(t,n){var e=t.sourceX||A4,r=t.sourceY||_4,i=t.targetX||k4,a=t.targetY||D4,o=t.as||"path",s=t.orient||"vertical",u=t.shape||"line",l=R_.get(u+"-"+s)||R_.get(u);return l||j("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,c=>{c[o]=l(e(c),r(c),i(c),a(c))}),n.reflow(t.modified()).modifies(o)}});const z_=(t,n,e,r)=>"M"+t+","+n+"L"+e+","+r,O_=(t,n,e,r)=>{var i=e-t,a=r-n,o=Math.hypot(i,a)/2;return"M"+t+","+n+"A"+o+","+o+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+e+","+r},N_=(t,n,e,r)=>{const i=e-t,a=r-n,o=.2*(i+a),s=.2*(a-i);return"M"+t+","+n+"C"+(t+o)+","+(n+s)+" "+(e+s)+","+(r-o)+" "+e+","+r},R_=Fo({line:z_,"line-radial":(t,n,e,r)=>z_(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),arc:O_,"arc-radial":(t,n,e,r)=>O_(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),curve:N_,"curve-radial":(t,n,e,r)=>N_(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),"orthogonal-horizontal":(t,n,e,r)=>"M"+t+","+n+"V"+r+"H"+e,"orthogonal-vertical":(t,n,e,r)=>"M"+t+","+n+"H"+e+"V"+r,"orthogonal-radial":(t,n,e,r)=>{const i=Math.cos(t),a=Math.sin(t),o=Math.cos(e),s=Math.sin(e);return"M"+n*i+","+n*a+"A"+n+","+n+" 0 0,"+((Math.abs(e-t)>Math.PI?e<=t:e>t)?1:0)+" "+n*o+","+n*s+"L"+r*o+","+r*s},"diagonal-horizontal":(t,n,e,r)=>{const i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":(t,n,e,r)=>{const i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":(t,n,e,r)=>{const i=Math.cos(t),a=Math.sin(t),o=Math.cos(e),s=Math.sin(e),u=(n+r)/2;return"M"+n*i+","+n*a+"C"+u*i+","+u*a+" "+u*o+","+u*s+" "+r*o+","+r*s}});function P0(t){O.call(this,null,t)}P0.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},V(P0,O,{transform(t,n){var e,r,i,a=t.as||["startAngle","endAngle"],o=a[0],s=a[1],u=t.field||Gs,l=t.startAngle||0,c=t.endAngle!=null?t.endAngle:2*Math.PI,f=n.source,d=f.map(u),h=d.length,p=l,m=(c-l)/Jx(d),g=xe(h);for(t.sort&&g.sort((y,v)=>d[y]-d[v]),e=0;er+(i<0?-1:i>0?1:0),0))!==n.length&&e.warn("Log scale domain includes zero: "+G(n)),n}function L_(t,n,e){return bt(t)&&(n||e)?gw(t,j0(n||[0,1],e)):t}function j0(t,n){return n?t.slice().reverse():t}function q_(t){O.call(this,null,t)}V(P_,O,{transform(t,n){var e=n.dataflow,r=this.value,i=function(a){var o,s=a.type,u="";return s===Cr?Cr+"-"+Bo:(function(l){const c=l.type;return Sm(c)&&c!==za&&c!==Oa&&(l.scheme||l.range&&l.range.length&&l.range.every(Q))}(a)&&(u=(o=a.rawDomain?a.rawDomain.length:a.domain?a.domain.length+ +(a.domainMid!=null):0)===2?Cr+"-":o===3?zo+"-":""),(u+s||Bo).toLowerCase())}(t);for(i in r&&i===r.type||(this.value=r=Dt(i)()),t)if(!F4[i]){if(i==="padding"&&T_(r.type))continue;bt(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(a,o,s){var u=a.type,l=o.round||!1,c=o.range;if(o.rangeStep!=null)c=function(f,d,h){f!==sw&&f!==Fm&&j("Only band and point scales support rangeStep.");var p=(d.paddingOuter!=null?d.paddingOuter:d.padding)||0,m=f===Fm?1:(d.paddingInner!=null?d.paddingInner:d.padding)||0;return[0,d.rangeStep*km(h,m,p)]}(u,o,s);else if(o.scheme&&(c=function(f,d,h){var p,m=d.schemeExtent;return P(d.scheme)?p=wc(d.scheme,d.interpolate,d.interpolateGamma):(p=zm(d.scheme.toLowerCase()))||j(`Unrecognized scheme name: ${d.scheme}`),h=f===bc?h+1:f===Cm?h-1:f===Oo||f===vc?+d.schemeCount||5:h,pw(f)?L_(p,m,d.reverse):bt(p)?yw(L_(p,m),h):f===Dm?p:p.slice(0,h)}(u,o,s),bt(c))){if(a.interpolator)return a.interpolator(c);j(`Scale type ${u} does not support interpolating color schemes.`)}if(c&&pw(u))return a.interpolator(wc(j0(c,o.reverse),o.interpolate,o.interpolateGamma));c&&o.interpolate&&a.interpolate?a.interpolate(Bm(o.interpolate,o.interpolateGamma)):bt(a.round)?a.round(l):bt(a.rangeRound)&&a.interpolate(l?Xl:Vs),c&&a.range(j0(c,o.reverse))}(r,t,function(a,o,s){let u=o.bins;if(u&&!P(u)){const l=a.domain(),c=l[0],f=Bt(l),d=u.step;let h=u.start==null?c:u.start,p=u.stop==null?f:u.stop;d||j("Scale bins parameter missing step property."),hf&&(p=d*Math.floor(f/d)),u=xe(h,p+d/2,d)}return u?a.bins=u:a.bins&&delete a.bins,a.type===Cm&&(u?o.domain||o.domainRaw||(a.domain(u),s=u.length):a.bins=a.domain()),s}(r,t,function(a,o,s){const u=function(p,m,g){return m?(p.domain(j_(p.type,m,g)),m.length):-1}(a,o.domainRaw,s);if(u>-1)return u;var l,c,f=o.domain,d=a.type,h=o.zero||o.zero===void 0&&function(p){const m=p.type;return!p.bins&&(m===Bo||m===ru||m===iu)}(a);if(!f)return 0;if((h||o.domainMin!=null||o.domainMax!=null||o.domainMid!=null)&&(l=(f=f.slice()).length-1||1,h&&(f[0]>0&&(f[0]=0),f[l]<0&&(f[l]=0)),o.domainMin!=null&&(f[0]=o.domainMin),o.domainMax!=null&&(f[l]=o.domainMax),o.domainMid!=null)){const p=(c=o.domainMid)>f[l]?l+1:cD(b);if(h==null)F.push(d.slice());else for(g={},y=0,v=d.length;yk&&(k=_),p&&A.sort(p)}return F.max=k,F}(n.source,t.groupby,l,c),r=0,i=e.length,a=e.max;r0?1:t<0?-1:0},Jn=Math.sqrt,W0=Math.tan;function V_(t){return t>1?0:t<-1?yt:Math.acos(t)}function le(t){return t>1?rn:t<-1?-rn:Math.asin(t)}function Dn(){}function df(t,n){t&&X_.hasOwnProperty(t.type)&&X_[t.type](t,n)}var Y_={Feature:function(t,n){df(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r=0?1:-1,i=r*e,a=ct(n=(n*=gt)/2+lf),o=ut(n),s=Y0*o,u=V0*a+s*ct(i),l=s*r*ut(i);hf.add(je(l,u)),G0=t,V0=a,Y0=o}function mf(t){return[je(t[1],t[0]),le(t[2])]}function Ia(t){var n=t[0],e=t[1],r=ct(e);return[r*ct(n),r*ut(n),ut(e)]}function gf(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Vo(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function X0(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function yf(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function vf(t){var n=Jn(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Du,bf,xf,wf,Af,_f,kf,Df,J0,K0,Q0,ek,rk,Kn,Qn,Zn,li={point:Z0,lineStart:ak,lineEnd:ok,polygonStart:function(){li.point=sk,li.lineStart=O4,li.lineEnd=N4,ku=new Gn,Mr.polygonStart()},polygonEnd:function(){Mr.polygonEnd(),li.point=Z0,li.lineStart=ak,li.lineEnd=ok,hf<0?(Kt=-(an=180),ce=-(_e=90)):ku>dt?_e=90:ku<-1e-6&&(ce=-90),ui[0]=Kt,ui[1]=an},sphere:function(){Kt=-(an=180),ce=-(_e=90)}};function Z0(t,n){na.push(ui=[Kt=t,an=t]),n_e&&(_e=n)}function ik(t,n){var e=Ia([t*gt,n*gt]);if(Go){var r=Vo(Go,e),i=Vo([r[1],-r[0],0],r);vf(i),i=mf(i);var a,o=t-Ua,s=o>0?1:-1,u=i[0]*on*s,l=At(o)>180;l^(s*Ua_e&&(_e=a):l^(s*Ua<(u=(u+360)%360-180)&&u_e&&(_e=n)),l?tke(Kt,an)&&(an=t):ke(t,an)>ke(Kt,an)&&(Kt=t):an>=Kt?(tan&&(an=t)):t>Ua?ke(Kt,t)>ke(Kt,an)&&(an=t):ke(t,an)>ke(Kt,an)&&(Kt=t)}else na.push(ui=[Kt=t,an=t]);n_e&&(_e=n),Go=e,Ua=t}function ak(){li.point=ik}function ok(){ui[0]=Kt,ui[1]=an,li.point=Z0,Go=null}function sk(t,n){if(Go){var e=t-Ua;ku.add(At(e)>180?e+(e>0?360:-360):e)}else Z_=t,tk=n;Mr.point(t,n),ik(t,n)}function O4(){Mr.lineStart()}function N4(){sk(Z_,tk),Mr.lineEnd(),At(ku)>dt&&(Kt=-(an=180)),ui[0]=Kt,ui[1]=an,Go=null}function ke(t,n){return(n-=t)<0?n+360:n}function R4(t,n){return t[0]-n[0]}function uk(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nyt&&(t-=Math.round(t/Xn)*Xn),[t,n]}function dk(t,n,e){return(t%=Xn)?n||e?ng(pk(t),mk(n,e)):pk(t):n||e?mk(n,e):eg}function hk(t){return function(n,e){return At(n+=t)>yt&&(n-=Math.round(n/Xn)*Xn),[n,e]}}function pk(t){var n=hk(t);return n.invert=hk(-t),n}function mk(t,n){var e=ct(t),r=ut(t),i=ct(n),a=ut(n);function o(s,u){var l=ct(u),c=ct(s)*l,f=ut(s)*l,d=ut(u),h=d*e+c*r;return[je(f*i-h*a,c*e-d*r),le(h*i+f*a)]}return o.invert=function(s,u){var l=ct(u),c=ct(s)*l,f=ut(s)*l,d=ut(u),h=d*i-f*a;return[je(f*i+d*a,c*e+h*r),le(h*e-c*r)]},o}function gk(t,n){(n=Ia(n))[0]-=t,vf(n);var e=V_(-n[1]);return((-n[2]<0?-e:e)+Xn-dt)%Xn}function yk(){var t,n=[];return{point:function(e,r,i){t.push([e,r,i])},lineStart:function(){n.push(t=[])},lineEnd:Dn,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Ff(t,n){return At(t[0]-n[0])=0;--a)i.point((c=l[a])[0],c[1]);else r(d.x,d.p.x,-1,i);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}}function bk(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r=0?1:-1,Et=kt*Tt,tn=Et>yt,nn=L*J;if($.add(je(nn*kt*ut(Et),et*Mt+nn*ct(Et))),D+=tn?Tt+kt*Xn:Tt,tn^W>=_^mt>=_){var It=Vo(Ia(N),Ia(nt));vf(It);var be=Vo(C,It);vf(be);var zn=(tn^Tt>=0?-1:1)*le(be[2]);(k>zn||k===zn&&(It[0]||It[1]))&&(E+=tn^Tt>=0?1:-1)}}return(D<-1e-6||D0){for(f||(i.polygonStart(),f=!0),i.lineStart(),b=0;b1&&2&k&&F.push(F.pop().concat(F.shift())),o.push(F.filter(U4))}return d}}function U4(t){return t.length>1}function I4(t,n){return((t=t.x)[0]<0?t[1]-rn-dt:rn-t[1])-((n=n.x)[0]<0?n[1]-rn-dt:rn-n[1])}eg.invert=eg;const wk=xk(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,o){var s=a>0?yt:-yt,u=At(a-e);At(u-yt)0?rn:-rn),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(a,r),n=0):i!==s&&u>=yt&&(At(e-i)dt?Ho((ut(c)*(p=ct(d))*ut(f)-ut(d)*(h=ct(c))*ut(l))/(h*p*m)):(c+d)/2}(e,r,a,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),n=0),t.point(e=a,r=o),i=s},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(t==null)i=e*rn,r.point(-yt,i),r.point(0,i),r.point(yt,i),r.point(yt,0),r.point(yt,-i),r.point(0,-i),r.point(-yt,-i),r.point(-yt,0),r.point(-yt,i);else if(At(t[0]-n[0])>dt){var a=t[0]0,i=At(n)>dt;function a(u,l){return ct(u)*ct(l)>n}function o(u,l,c){var f=[1,0,0],d=Vo(Ia(u),Ia(l)),h=gf(d,d),p=d[0],m=h-p*p;if(!m)return!c&&u;var g=n*h/m,y=-n*p/m,v=Vo(f,d),x=yf(f,g);X0(x,yf(d,y));var b=v,w=gf(x,b),A=gf(b,b),_=w*w-A*(gf(x,x)-1);if(!(_<0)){var k=Jn(_),F=yf(b,(-w-k)/A);if(X0(F,x),F=mf(F),!c)return F;var C,D=u[0],E=l[0],$=u[1],M=l[1];E0^F[1]<(At(F[0]-D)yt^(D<=F[0]&&F[0]<=E)){var z=yf(b,(-w+k)/A);return X0(z,x),[F,mf(z)]}}}function s(u,l){var c=r?t:yt-t,f=0;return u<-c?f|=1:u>c&&(f|=2),l<-c?f|=4:l>c&&(f|=8),f}return xk(a,function(u){var l,c,f,d,h;return{lineStart:function(){d=f=!1,h=1},point:function(p,m){var g,y=[p,m],v=a(p,m),x=r?v?0:s(p,m):v?s(p+(p<0?yt:-yt),m):0;if(!l&&(d=f=v)&&u.lineStart(),v!==f&&(!(g=o(l,y))||Ff(l,g)||Ff(y,g))&&(y[2]=1),v!==f)h=0,v?(u.lineStart(),g=o(y,l),u.point(g[0],g[1])):(g=o(l,y),u.point(g[0],g[1],2),u.lineEnd()),l=g;else if(i&&l&&r^v){var b;x&c||!(b=o(y,l,!0))||(h=0,r?(u.lineStart(),u.point(b[0][0],b[0][1]),u.point(b[1][0],b[1][1]),u.lineEnd()):(u.point(b[1][0],b[1][1]),u.lineEnd(),u.lineStart(),u.point(b[0][0],b[0][1],3)))}!v||l&&Ff(l,y)||u.point(y[0],y[1]),l=y,f=v,c=x},lineEnd:function(){f&&u.lineEnd(),l=null},clean:function(){return h|(d&&f)<<1}}},function(u,l,c,f){(function(d,h,p,m,g,y){if(p){var v=ct(h),x=ut(h),b=m*p;g==null?(g=h+m*Xn,y=h-b/2):(g=gk(v,g),y=gk(v,y),(m>0?gy)&&(g+=m*Xn));for(var w,A=g;m>0?A>y:A0)do d.point(h===0||h===3?t:e,h>1?r:n);while((h=(h+f+4)%4)!==p);else d.point(c[0],c[1])}function o(l,c){return At(l[0]-t)0?0:3:At(l[0]-e)0?2:1:At(l[1]-n)0?1:0:c>0?3:2}function s(l,c){return u(l.x,c.x)}function u(l,c){var f=o(l,1),d=o(c,1);return f!==d?f-d:f===0?c[1]-l[1]:f===1?l[0]-c[0]:f===2?l[1]-c[1]:c[0]-l[0]}return function(l){var c,f,d,h,p,m,g,y,v,x,b,w=l,A=yk(),_={point:k,lineStart:function(){_.point=F,f&&f.push(d=[]),x=!0,v=!1,g=y=NaN},lineEnd:function(){c&&(F(h,p),m&&v&&A.rejoin(),c.push(A.result())),_.point=k,v&&w.lineEnd()},polygonStart:function(){w=A,c=[],f=[],b=!0},polygonEnd:function(){var C=function(){for(var $=0,M=0,S=f.length;Mr&&(et-B)*(r-z)>(ot-z)*(t-B)&&++$:ot<=r&&(et-B)*(r-z)<(ot-z)*(t-B)&&--$;return $}(),D=b&&C,E=(c=Xx(c)).length;(D||E)&&(l.polygonStart(),D&&(l.lineStart(),a(null,null,1,l),l.lineEnd()),E&&vk(c,s,C,a,l),l.polygonEnd()),w=l,c=f=d=null}};function k(C,D){i(C,D)&&w.point(C,D)}function F(C,D){var E=i(C,D);if(f&&d.push([C,D]),x)h=C,p=D,m=E,x=!1,E&&(w.lineStart(),w.point(C,D));else if(E&&v)w.point(C,D);else{var $=[g=Math.max($f,Math.min(Ef,g)),y=Math.max($f,Math.min(Ef,y))],M=[C=Math.max($f,Math.min(Ef,C)),D=Math.max($f,Math.min(Ef,D))];(function(S,B,z,N,W,X){var L,et=S[0],ot=S[1],nt=0,mt=1,pt=B[0]-et,J=B[1]-ot;if(L=z-et,pt||!(L>0)){if(L/=pt,pt<0){if(L0){if(L>mt)return;L>nt&&(nt=L)}if(L=W-et,pt||!(L<0)){if(L/=pt,pt<0){if(L>mt)return;L>nt&&(nt=L)}else if(pt>0){if(L0)){if(L/=J,J<0){if(L0){if(L>mt)return;L>nt&&(nt=L)}if(L=X-ot,J||!(L<0)){if(L/=J,J<0){if(L>mt)return;L>nt&&(nt=L)}else if(J>0){if(L0&&(S[0]=et+nt*pt,S[1]=ot+nt*J),mt<1&&(B[0]=et+mt*pt,B[1]=ot+mt*J),!0}}}}})($,M,t,n,e,r)?(v||(w.lineStart(),w.point($[0],$[1])),w.point(M[0],M[1]),E||w.lineEnd(),b=!1):E&&(w.lineStart(),w.point(C,D),b=!1)}g=C,y=D,v=E}return _}}function _k(t,n,e){var r=xe(t,n-dt,e).concat(n);return function(i){return r.map(function(a){return[i,a]})}}function kk(t,n,e){var r=xe(t,n-dt,e).concat(n);return function(i){return r.map(function(a){return[a,i]})}}const Cu=t=>t;var Dk,Fk,ig,ag,og=new Gn,sg=new Gn,ci={point:Dn,lineStart:Dn,lineEnd:Dn,polygonStart:function(){ci.lineStart=H4,ci.lineEnd=V4},polygonEnd:function(){ci.lineStart=ci.lineEnd=ci.point=Dn,og.add(At(sg)),sg=new Gn},result:function(){var t=og/2;return og=new Gn,t}};function H4(){ci.point=G4}function G4(t,n){ci.point=Ck,Dk=ig=t,Fk=ag=n}function Ck(t,n){sg.add(ag*t-ig*n),ig=t,ag=n}function V4(){Ck(Dk,Fk)}var Yo=1/0,Sf=Yo,Eu=-Yo,Mf=Eu,Bf={point:function(t,n){tEu&&(Eu=t),nMf&&(Mf=n)},lineStart:Dn,lineEnd:Dn,polygonStart:Dn,polygonEnd:Dn,result:function(){var t=[[Yo,Sf],[Eu,Mf]];return Eu=Mf=-(Sf=Yo=1/0),t}},Ek,$k,Br,zr,ug=0,lg=0,$u=0,zf=0,Of=0,Xo=0,cg=0,fg=0,Su=0,qe={point:Wa,lineStart:Sk,lineEnd:Mk,polygonStart:function(){qe.lineStart=J4,qe.lineEnd=K4},polygonEnd:function(){qe.point=Wa,qe.lineStart=Sk,qe.lineEnd=Mk},result:function(){var t=Su?[cg/Su,fg/Su]:Xo?[zf/Xo,Of/Xo]:$u?[ug/$u,lg/$u]:[NaN,NaN];return ug=lg=$u=zf=Of=Xo=cg=fg=Su=0,t}};function Wa(t,n){ug+=t,lg+=n,++$u}function Sk(){qe.point=Y4}function Y4(t,n){qe.point=X4,Wa(Br=t,zr=n)}function X4(t,n){var e=t-Br,r=n-zr,i=Jn(e*e+r*r);zf+=i*(Br+t)/2,Of+=i*(zr+n)/2,Xo+=i,Wa(Br=t,zr=n)}function Mk(){qe.point=Wa}function J4(){qe.point=Q4}function K4(){Bk(Ek,$k)}function Q4(t,n){qe.point=Bk,Wa(Ek=Br=t,$k=zr=n)}function Bk(t,n){var e=t-Br,r=n-zr,i=Jn(e*e+r*r);zf+=i*(Br+t)/2,Of+=i*(zr+n)/2,Xo+=i,cg+=(i=zr*t-Br*n)*(Br+t),fg+=i*(zr+n),Su+=3*i,Wa(Br=t,zr=n)}function zk(t){this._context=t}zk.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,Xn)}},result:Dn};var dg,Ok,Nk,Mu,Bu,hg=new Gn,zu={point:Dn,lineStart:function(){zu.point=Z4},lineEnd:function(){dg&&Rk(Ok,Nk),zu.point=Dn},polygonStart:function(){dg=!0},polygonEnd:function(){dg=null},result:function(){var t=+hg;return hg=new Gn,t}};function Z4(t,n){zu.point=Rk,Ok=Mu=t,Nk=Bu=n}function Rk(t,n){Mu-=t,Bu-=n,hg.add(Jn(Mu*Mu+Bu*Bu)),Mu=t,Bu=n}let Tk,Nf,Pk,jk;class Lk{constructor(n){this._append=n==null?qk:function(e){const r=Math.floor(e);if(!(r>=0))throw new RangeError(`invalid digits: ${e}`);if(r>15)return qk;if(r!==Tk){const i=10**r;Tk=r,Nf=function(a){let o=1;this._+=a[0];for(const s=a.length;o=0))throw new RangeError(`invalid digits: ${s}`);i=u}return n===null&&(r=new Lk(i)),o},o.projection(t).digits(i).context(n)}function Rf(t){return function(n){var e=new pg;for(var r in t)e[r]=t[r];return e.stream=n,e}}function pg(){}function mg(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),si(e,t.stream(Bf)),n(Bf.result()),r!=null&&t.clipExtent(r),t}function Tf(t,n,e){return mg(t,function(r){var i=n[1][0]-n[0][0],a=n[1][1]-n[0][1],o=Math.min(i/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),s=+n[0][0]+(i-o*(r[1][0]+r[0][0]))/2,u=+n[0][1]+(a-o*(r[1][1]+r[0][1]))/2;t.scale(150*o).translate([s,u])},e)}function gg(t,n,e){return Tf(t,[[0,0],n],e)}function yg(t,n,e){return mg(t,function(r){var i=+n,a=i/(r[1][0]-r[0][0]),o=(i-a*(r[1][0]+r[0][0]))/2,s=-a*r[0][1];t.scale(150*a).translate([o,s])},e)}function vg(t,n,e){return mg(t,function(r){var i=+n,a=i/(r[1][1]-r[0][1]),o=-a*r[0][0],s=(i-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([o,s])},e)}pg.prototype={constructor:pg,point:function(t,n){this.stream.point(t,n)},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 tM=ct(30*gt);function Ik(t,n){return+n?function(e,r){function i(a,o,s,u,l,c,f,d,h,p,m,g,y,v){var x=f-a,b=d-o,w=x*x+b*b;if(w>4*r&&y--){var A=u+p,_=l+m,k=c+g,F=Jn(A*A+_*_+k*k),C=le(k/=F),D=At(At(k)-1)r||At((x*S+b*B)/w-.5)>.3||u*p+l*m+c*g2?S[2]%360*gt:0,$()):[g*on,y*on,v*on]},D.angle=function(S){return arguments.length?(x=S%360*gt,$()):x*on},D.reflectX=function(S){return arguments.length?(b=S?-1:1,$()):b<0},D.reflectY=function(S){return arguments.length?(w=S?-1:1,$()):w<0},D.precision=function(S){return arguments.length?(o=Ik(s,C=S*S),M()):Jn(C)},D.fitExtent=function(S,B){return Tf(D,S,B)},D.fitSize=function(S,B){return gg(D,S,B)},D.fitWidth=function(S,B){return yg(D,S,B)},D.fitHeight=function(S,B){return vg(D,S,B)},function(){return n=t.apply(this,arguments),D.invert=n.invert&&E,$()}}function bg(t){var n=0,e=yt/3,r=Hk(t),i=r(n,e);return i.parallels=function(a){return arguments.length?r(n=a[0]*gt,e=a[1]*gt):[n*on,e*on]},i}function eM(t,n){var e=ut(t),r=(e+ut(n))/2;if(At(r)2?h[2]*gt:0),p.invert=function(m){return(m=h.invert(m[0]*gt,m[1]*gt))[0]*=on,m[1]*=on,m},p}(i.rotate()).invert([0,0]));return u(l==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:t===jf?[[Math.max(d[0]-f,l),n],[Math.min(d[0]+f,e),r]]:[[l,Math.max(d[1]-f,n)],[e,Math.min(d[1]+f,r)]])}return i.scale=function(f){return arguments.length?(o(f),c()):o()},i.translate=function(f){return arguments.length?(s(f),c()):s()},i.center=function(f){return arguments.length?(a(f),c()):a()},i.clipExtent=function(f){return arguments.length?(f==null?l=n=e=r=null:(l=+f[0][0],n=+f[0][1],e=+f[1][0],r=+f[1][1]),c()):l==null?null:[[l,n],[e,r]]},c()}function Lf(t){return W0((rn+t)/2)}function rM(t,n){var e=ct(t),r=t===n?ut(t):ff(e/ct(n))/ff(Lf(n)/Lf(t)),i=e*I0(Lf(t),r)/r;if(!r)return jf;function a(o,s){i>0?s<-rn+dt&&(s=-rn+dt):s>rn-dt&&(s=rn-dt);var u=i/I0(Lf(s),r);return[u*ut(r*o),i-u*ct(r*o)]}return a.invert=function(o,s){var u=i-s,l=Le(r)*Jn(o*o+u*u),c=je(o,At(u))*Le(u);return u*r<0&&(c-=yt*Le(o)*Le(u)),[c/r,2*Ho(I0(i/l,1/r))-rn]},a}function qf(t,n){return[t,n]}function iM(t,n){var e=ct(t),r=t===n?ut(t):(e-ct(n))/(n-t),i=e/r+t;if(At(r)dt&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},tD.invert=Ou(le),nD.invert=Ou(function(t){return 2*Ho(t)}),eD.invert=function(t,n){return[-n,2*Ho(G_(t))-rn]};var aM=Math.abs,xg=Math.cos,If=Math.sin,rD=Math.PI,wg=rD/2,iD=function(t){return t>0?Math.sqrt(t):0}(2);function aD(t){return t>1?wg:t<-1?-wg:Math.asin(t)}function oM(t,n){var e,r=t*If(n),i=30;do n-=e=(n+If(n)-r)/(1+xg(n));while(aM(e)>1e-6&&--i>0);return n/2}var sM=function(t,n,e){function r(i,a){return[t*i*xg(a=oM(e,a)),n*If(a)]}return r.invert=function(i,a){return a=aD(a/n),[i/(t*xg(a)),aD((2*a+If(2*a))/e)]},r}(iD/wg,iD,rD);const uM=Uk(),Ag=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function _g(t,n){if(!t||typeof t!="string")throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(Wf[t]=function(e,r){return function i(){const a=r();return a.type=e,a.path=Uk().projection(a),a.copy=a.copy||function(){const o=i();return Ag.forEach(s=>{a[s]&&o[s](a[s]())}),o.path.pointRadius(a.path.pointRadius()),o},cw(a)}}(t,n),this):Wf[t]||null}function oD(t){return t&&t.path||uM}const Wf={albers:Gk,albersusa:function(){var t,n,e,r,i,a,o=Gk(),s=Pf().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=Pf().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(d,h){a=[d,h]}};function c(d){var h=d[0],p=d[1];return a=null,e.point(h,p),a||(r.point(h,p),a)||(i.point(h,p),a)}function f(){return t=n=null,c}return c.invert=function(d){var h=o.scale(),p=o.translate(),m=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?s:g>=.166&&g<.234&&m>=-.214&&m<-.115?u:o).invert(d)},c.stream=function(d){return t&&n===d?t:(h=[o.stream(n=d),s.stream(d),u.stream(d)],p=h.length,t={point:function(m,g){for(var y=-1;++y2?r[2]+90:90]):[(r=e())[0],r[1],r[2]-90]},e([0,0,90]).scale(159.155)}};for(const t in Wf)_g(t,Wf[t]);function lM(){}const fi=[[],[[[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 sD(){var t=1,n=1,e=o;function r(s,u){return u.map(l=>i(s,l))}function i(s,u){var l=[],c=[];return function(f,d,h){var p,m,g,y,v,x,b=[],w=[];for(p=m=-1,y=f[0]>=d,fi[y<<1].forEach(A);++p=d,fi[g|y<<1].forEach(A);for(fi[y|0].forEach(A);++m=d,v=f[m*t]>=d,fi[y<<1|v<<2].forEach(A);++p=d,x=v,v=f[m*t+p+1]>=d,fi[g|y<<1|v<<2|x<<3].forEach(A);fi[y|v<<3].forEach(A)}for(p=-1,v=f[m*t]>=d,fi[v<<2].forEach(A);++p=d,fi[v<<2|x<<3].forEach(A);function A(_){var k,F,C=[_[0][0]+p,_[0][1]+m],D=[_[1][0]+p,_[1][1]+m],E=a(C),$=a(D);(k=w[E])?(F=b[$])?(delete w[k.end],delete b[F.start],k===F?(k.ring.push(D),h(k.ring)):b[k.start]=w[F.end]={start:k.start,end:F.end,ring:k.ring.concat(F.ring)}):(delete w[k.end],k.ring.push(D),w[k.end=$]=k):(k=b[$])?(F=w[E])?(delete b[k.start],delete w[F.end],k===F?(k.ring.push(D),h(k.ring)):b[F.start]=w[k.end]={start:F.start,end:k.end,ring:F.ring.concat(k.ring)}):(delete b[k.start],k.ring.unshift(C),b[k.start=E]=k):b[E]=w[$]={start:E,end:$,ring:[C,D]}}fi[v<<3].forEach(A)}(s,u,f=>{e(f,s,u),function(d){for(var h=0,p=d.length,m=d[p-1][1]*d[0][0]-d[p-1][0]*d[0][1];++h0?l.push([f]):c.push(f)}),c.forEach(f=>{for(var d,h=0,p=l.length;h{var f,d=c[0],h=c[1],p=0|d,m=0|h,g=u[m*t+p];d>0&&d0&&h=0&&l>=0||j("invalid size"),t=u,n=l,r},r.smooth=function(s){return arguments.length?(e=s?o:lM,r):e===o},r}function cM(t,n){for(var e,r=-1,i=n.length;++rr!=h>r&&e<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function dM(t,n,e){var r,i,a,o;return function(s,u,l){return(u[0]-s[0])*(l[1]-s[1])===(l[0]-s[0])*(u[1]-s[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=e[r],o=n[r],i<=a&&a<=o||o<=a&&a<=i)}function uD(t,n,e){return function(r){var i=kr(r),a=e?Math.min(i[0],0):i[0],o=i[1],s=o-a,u=n?fx(a,o,t):s/(t+1);return xe(a+u,o,u)}}function kg(t){O.call(this,null,t)}function lD(t,n,e,r,i){const a=t.x1||0,o=t.y1||0,s=n*e<0;function u(f){f.forEach(l)}function l(f){s&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-a)*n+r,f[1]=(f[1]-o)*e+i}return function(f){return f.coordinates.forEach(u),f}}function cD(t,n,e){const r=t>=0?t:kp(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function Dg(t){return bt(t)?t:In(+t)}function fD(){var t=u=>u[0],n=u=>u[1],e=Gs,r=[-1,-1],i=960,a=500,o=2;function s(u,l){const c=cD(r[0],u,t)>>o,f=cD(r[1],u,n)>>o,d=c?c+2:0,h=f?f+2:0,p=2*d+(i>>o),m=2*h+(a>>o),g=new Float32Array(p*m),y=new Float32Array(p*m);let v=g;u.forEach(b=>{const w=d+(+t(b)>>o),A=h+(+n(b)>>o);w>=0&&w=0&&A0&&f>0?(Jo(p,m,g,y,c),Ko(p,m,y,g,f),Jo(p,m,g,y,c),Ko(p,m,y,g,f),Jo(p,m,g,y,c),Ko(p,m,y,g,f)):c>0?(Jo(p,m,g,y,c),Jo(p,m,y,g,c),Jo(p,m,g,y,c),v=y):f>0&&(Ko(p,m,g,y,f),Ko(p,m,y,g,f),Ko(p,m,g,y,f),v=y);const x=l?Math.pow(2,-2*o):1/Jx(v);for(let b=0,w=p*m;b>o),y2:h+(a>>o)}}return s.x=function(u){return arguments.length?(t=Dg(u),s):t},s.y=function(u){return arguments.length?(n=Dg(u),s):n},s.weight=function(u){return arguments.length?(e=Dg(u),s):e},s.size=function(u){if(!arguments.length)return[i,a];var l=+u[0],c=+u[1];return l>=0&&c>=0||j("invalid size"),i=l,a=c,s},s.cellSize=function(u){return arguments.length?((u=+u)>=1||j("invalid cell size"),o=Math.floor(Math.log(u)/Math.LN2),s):1<=i&&(s>=a&&(u-=e[s-a+o*t]),r[s-i+o*t]=u/Math.min(s+1,t-1+a-s,a))}function Ko(t,n,e,r,i){const a=1+(i<<1);for(let o=0;o=i&&(s>=a&&(u-=e[o+(s-a)*t]),r[o+(s-i)*t]=u/Math.min(s+1,n-1+a-s,a))}function Fg(t){O.call(this,null,t)}kg.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},V(kg,O,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||Me,a=sD().smooth(t.smooth!==!1),o=t.thresholds||function(l,c,f){const d=uD(f.levels||10,f.nice,f.zero!==!1);return f.resolve!=="shared"?d:d(l.map(h=>Ca(c(h).values)))}(r,i,t),s=t.as===null?null:t.as||"contour",u=[];return r.forEach(l=>{const c=i(l),f=a.size([c.width,c.height])(c.values,P(o)?o:o(c.values));(function(d,h,p,m){let g=m.scale||h.scale,y=m.translate||h.translate;if(bt(g)&&(g=g(p,m)),bt(y)&&(y=y(p,m)),(g===1||g==null)&&!y)return;const v=($t(g)?g:g[0])||1,x=($t(g)?g:g[1])||1,b=y&&y[0]||0,w=y&&y[1]||0;d.forEach(lD(h,v,x,b,w))})(f,c,l,t),f.forEach(d=>{u.push(nc(l,St(s!=null?{[s]:d}:d)))})}),this.value&&(e.rem=this.value),this.value=e.source=e.add=u,e}}),Fg.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const hM=["x","y","weight","size","cellSize","bandwidth"];function dD(t,n){return hM.forEach(e=>n[e]!=null?t[e](n[e]):0),t}function Cg(t){O.call(this,null,t)}V(Fg,O,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(u,l){var c,f,d,h,p,m,g=[],y=v=>v(h);if(l==null)g.push(u);else for(c={},f=0,d=u.length;fSt(function(l,c){for(let f=0;fdt}).map(l)).concat(xe(cf(o/p)*p,a,p).filter(function(b){return At(b%g)>dt}).map(c))}return v.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},v.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(d(s).slice(1),f(r).reverse().slice(1),d(u).reverse().slice(1))]}},v.extent=function(b){return arguments.length?v.extentMajor(b).extentMinor(b):v.extentMinor()},v.extentMajor=function(b){return arguments.length?(i=+b[0][0],r=+b[1][0],u=+b[0][1],s=+b[1][1],i>r&&(b=i,i=r,r=b),u>s&&(b=u,u=s,s=b),v.precision(y)):[[i,u],[r,s]]},v.extentMinor=function(b){return arguments.length?(e=+b[0][0],n=+b[1][0],o=+b[0][1],a=+b[1][1],e>n&&(b=e,e=n,n=b),o>a&&(b=o,o=a,a=b),v.precision(y)):[[e,o],[n,a]]},v.step=function(b){return arguments.length?v.stepMajor(b).stepMinor(b):v.stepMinor()},v.stepMajor=function(b){return arguments.length?(m=+b[0],g=+b[1],v):[m,g]},v.stepMinor=function(b){return arguments.length?(h=+b[0],p=+b[1],v):[h,p]},v.precision=function(b){return arguments.length?(y=+b,l=_k(o,a,90),c=kk(e,n,y),f=_k(u,s,90),d=kk(i,r,y),v):y},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Ng(t){O.call(this,null,t)}function hD(t){if(!bt(t))return!1;const n=Dr(Wn(t));return n.$x||n.$y||n.$value||n.$max}function pD(t){O.call(this,null,t),this.modified(!0)}function mD(t,n,e){bt(t[n])&&t[n](e)}Sg.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},V(Sg,O,{transform(t,n){var e,r=this._features,i=this._points,a=t.fields,o=a&&a[0],s=a&&a[1],u=t.geojson||!a&&Me,l=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(Wn(u))||o&&n.modified(Wn(o))||s&&n.modified(Wn(s)),this.value&&!e||(l=n.SOURCE,this._features=r=[],this._points=i=[]),u&&n.visit(l,c=>r.push(u(c))),o&&s&&(n.visit(l,c=>{var f=o(c),d=s(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&i.push([f,d])}),r=r.concat({type:Eg,geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:$g,features:r}}}),Mg.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},V(Mg,O,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||Me,a=t.as||"path",o=e.SOURCE;!r||t.modified()?(this.value=r=oD(t.projection),e.materialize().reflow()):o=i===Me||n.modified(i.fields)?e.ADD_MOD:e.ADD;const s=function(u,l){const c=u.pointRadius();return u.context(null),l!=null&&u.pointRadius(l),c}(r,t.pointRadius);return e.visit(o,u=>u[a]=r(i(u))),r.pointRadius(s),e.modifies(a)}}),Bg.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},V(Bg,O,{transform(t,n){var e,r=t.projection,i=t.fields[0],a=t.fields[1],o=t.as||["x","y"],s=o[0],u=o[1];function l(c){const f=r([i(c),a(c)]);f?(c[s]=f[0],c[u]=f[1]):(c[s]=void 0,c[u]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,l):(e=n.modified(i.fields)||n.modified(a.fields),n.visit(e?n.ADD_MOD:n.ADD,l)),n.modifies(o)}}),zg.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},V(zg,O,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",a=e.ADD;return r&&!t.modified()||(this.value=r=function(o,s,u){const l=u==null?c=>o(s(c)):c=>{var f=o.pointRadius(),d=o.pointRadius(u)(s(c));return o.pointRadius(f),d};return l.context=c=>(o.context(c),l),l}(oD(t.projection),t.field||ei("datum"),t.pointRadius),e.materialize().reflow(),a=e.SOURCE),e.visit(a,o=>o[i]=r),e.modifies(i)}}),Og.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},V(Og,O,{transform(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(const a in t)bt(i[a])&&i[a](t[a]);return e=i(),r.length?n.mod.push(Zx(r[0],e)):n.add.push(St(e)),r[0]=e,n}}),Ng.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},V(Ng,O,{transform(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r=t.resolve==="shared",i=t.field||Me,a=function(l,c){let f;return bt(l)?(f=d=>l(d,c),f.dep=hD(l)):l?f=In(l):(f=d=>d.$value/d.$max||0,f.dep=!0),f}(t.opacity,t),o=function(l,c){let f;return bt(l)?(f=d=>Jl(l(d,c)),f.dep=hD(l)):f=In(Jl(l||"#888")),f}(t.color,t),s=t.as||"image",u={$x:0,$y:0,$value:0,$max:r?Ca(e.map(l=>Ca(i(l).values))):0};return e.forEach(l=>{const c=i(l),f=xt({},l,u);r||(f.$max=Ca(c.values||[])),l[s]=function(d,h,p,m){const g=d.width,y=d.height,v=d.x1||0,x=d.y1||0,b=d.x2||g,w=d.y2||y,A=d.values,_=A?E=>A[E]:ip,k=qi(b-v,w-x),F=k.getContext("2d"),C=F.getImageData(0,0,b-v,w-x),D=C.data;for(let E=x,$=0;E{t[r]!=null&&mD(e,r,t[r])})):Ag.forEach(r=>{t.modified(r)&&mD(e,r,t[r])}),t.pointRadius!=null&&e.path.pointRadius(t.pointRadius),t.fit&&function(r,i){const a=function(o){return o=K(o),o.length===1?o[0]:{type:$g,features:o.reduce((s,u)=>s.concat(function(l){return l.type===$g?l.features:K(l).filter(c=>c!=null).map(c=>c.type===Eg?c:{type:Eg,geometry:c})}(u)),[])}}(i.fit);i.extent?r.fitExtent(i.extent,a):i.size&&r.fitSize(i.size,a)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});const pM=Object.freeze(Object.defineProperty({__proto__:null,contour:Cg,geojson:Sg,geopath:Mg,geopoint:Bg,geoshape:zg,graticule:Og,heatmap:Ng,isocontour:kg,kde2d:Fg,projection:pD},Symbol.toStringTag,{value:"Module"}));function gD(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,a,o,s,u,l,c,f,d,h=t._root,p={data:r},m=t._x0,g=t._y0,y=t._x1,v=t._y1;if(!h)return t._root=p,t;for(;h.length;)if((l=n>=(a=(m+y)/2))?m=a:y=a,(c=e>=(o=(g+v)/2))?g=o:v=o,i=h,!(h=h[f=c<<1|l]))return i[f]=p,t;if(s=+t._x.call(null,h.data),u=+t._y.call(null,h.data),n===s&&e===u)return p.next=h,i?i[f]=p:t._root=p,t;do i=i?i[f]=new Array(4):t._root=new Array(4),(l=n>=(a=(m+y)/2))?m=a:y=a,(c=e>=(o=(g+v)/2))?g=o:v=o;while((f=c<<1|l)==(d=(u>=o)<<1|s>=a));return i[d]=h,i[f]=p,t}function te(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function mM(t){return t[0]}function gM(t){return t[1]}function Rg(t,n,e){var r=new Tg(n??mM,e??gM,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function Tg(t,n,e,r,i,a){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function yD(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var ne=Rg.prototype=Tg.prototype;function ee(t){return function(){return t}}function ea(t){return 1e-6*(t()-.5)}function yM(t){return t.x+t.vx}function vM(t){return t.y+t.vy}function bM(t){return t.index}function vD(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}ne.copy=function(){var t,n,e=new Tg(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=yD(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=yD(n));return e},ne.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return gD(this.cover(n,e),n,e,t)},ne.addAll=function(t){var n,e,r,i,a=t.length,o=new Array(a),s=new Array(a),u=1/0,l=1/0,c=-1/0,f=-1/0;for(e=0;ec&&(c=r),if&&(f=i));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),e=0;et||t>=i||r>n||n>=a;)switch(s=(nd||(a=u.y0)>h||(o=u.x1)=y)<<1|t>=g)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}else{var v=t-+this._x.call(null,m.data),x=n-+this._y.call(null,m.data),b=v*v+x*x;if(b=(s=(p+g)/2))?p=s:g=s,(c=o>=(u=(m+y)/2))?m=u:y=u,n=h,!(h=h[f=c<<1|l]))return this;if(!h.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,d=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(h=n[0]||n[1]||n[2]||n[3])&&h===(n[3]||n[2]||n[1]||n[0])&&!h.length&&(e?e[d]=h:this._root=h),this):(this._root=i,this)},ne.removeAll=function(t){for(var n=0,e=t.length;n(m=(1664525*m+1013904223)%bD)/bD}();function f(){d(),l.call("tick",n),e1?(g==null?s.delete(m):s.set(m,p(g)),n):s.get(m)},find:function(m,g,y){var v,x,b,w,A,_=0,k=t.length;for(y==null?y=1/0:y*=y,_=0;_1?(l.on(m,g),n):l.on(m)}}}const xD={center:function(t,n){var e,r=1;function i(){var a,o,s=e.length,u=0,l=0;for(a=0;ad+C||Ah+C||_f.index){var D=d-k.x-k.vx,E=h-k.y-k.vy,$=D*D+E*E;$l.r&&(l.r=l[c].r)}function u(){if(n){var l,c,f=n.length;for(e=new Array(f),l=0;l=s)){(h.data!==n||h.next)&&(y===0&&(b+=(y=ea(e))*y),v===0&&(b+=(v=ea(e))*v),b[s(b,w,r),b]));for(m=0,i=new Array(y);mn(r,e):n)}jg.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:wD}]},V(jg,O,{transform(t,n){var e,r,i=this.value,a=n.changed(n.ADD_REM),o=t.modified(Pg),s=t.iterations||300;if(i?(a&&(n.modifies("index"),i.nodes(n.source)),(o||n.changed(n.MOD))&&AD(i,t,0,n)):(this.value=i=function(u,l){const c=_M(u),f=c.stop,d=c.restart;let h=!1;return c.stopped=()=>h,c.restart=()=>(h=!1,d()),c.stop=()=>(h=!0,f()),AD(c,l,!0).on("end",()=>h=!0)}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(a=!0,i.tick()),n.modifies("index")),o||a||t.modified(kM)||n.changed()&&t.restart){if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/s)),t.static)for(i.stop();--s>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return n.StopPropagation}return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let s,u=this._argops,l=0,c=u.length;l=0;)n+=e[r].value;else n=1;t.value=n}function Lg(t,n){t instanceof Map?(t=[void 0,t],n===void 0&&(n=OM)):n===void 0&&(n=zM);for(var e,r,i,a,o,s=new Qo(t),u=[s];e=u.pop();)if((i=n(e.data))&&(o=(i=Array.from(i)).length))for(e.children=i,a=o-1;a>=0;--a)u.push(r=i[a]=new Qo(i[a])),r.parent=e,r.depth=e.depth+1;return s.eachBefore(_D)}function zM(t){return t.children}function OM(t){return Array.isArray(t)?t[1]:null}function NM(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function _D(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function Qo(t){this.data=t,this.depth=this.height=0,this.parent=null}function Hf(t){return t==null?null:kD(t)}function kD(t){if(typeof t!="function")throw new Error;return t}function Ha(){return 0}function Zo(t){return function(){return t}}Qo.prototype=Lg.prototype={constructor:Qo,count:function(){return this.eachAfter(BM)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,a=this,o=[a],s=[],u=-1;a=o.pop();)if(s.push(a),e=a.children)for(r=0,i=e.length;r=0;--r)a.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(a,o){if(a===o)return a;var s=a.ancestors(),u=o.ancestors(),l=null;for(a=s.pop(),o=u.pop();a===o;)l=a,a=s.pop(),o=u.pop();return l}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return Lg(this).eachBefore(NM)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,a=[i];do for(t=a.reverse(),a=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e0&&e*e>r*r+i*i}function qg(t,n){for(var e=0;e1e-6?(D+Math.sqrt(D*D-4*C*E))/(2*C):E/D);return{x:r+A+_*$,y:i+k+F*$,r:$}}function ED(t,n,e){var r,i,a,o,s=t.x-n.x,u=t.y-n.y,l=s*s+u*u;l?(i=n.r+e.r,i*=i,o=t.r+e.r,i>(o*=o)?(r=(l+o-i)/(2*l),a=Math.sqrt(Math.max(0,o/l-r*r)),e.x=t.x-r*s-a*u,e.y=t.y-r*u+a*s):(r=(l+i-o)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),e.x=n.x+r*s-a*u,e.y=n.y+r*u+a*s)):(e.x=n.x+e.r,e.y=n.y)}function $D(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function SD(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,a=(n.y*e.r+e.y*n.r)/r;return i*i+a*a}function Vf(t){this._=t,this.next=null,this.previous=null}function PM(t,n){if(!(a=(t=function(h){return typeof h=="object"&&"length"in h?h:Array.from(h)}(t)).length))return 0;var e,r,i,a,o,s,u,l,c,f,d;if((e=t[0]).x=0,e.y=0,!(a>1))return e.r;if(r=t[1],e.x=-r.r,r.x=e.r,r.y=0,!(a>2))return e.r+r.r;ED(r,e,i=t[2]),e=new Vf(e),r=new Vf(r),i=new Vf(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(u=3;ufunction(A){A=`${A}`;let _=A.length;return Wg(A,_-1)&&!Wg(A,_-2)&&(A=A.slice(0,-1)),A[0]==="/"?A:`/${A}`}(t(b,w,i))),v=y.map(RD),x=new Set(y).add("");for(const b of v)x.has(b)||(x.add(b),y.push(b),v.push(RD(b)),h.push(Ig));p=(b,w)=>y[w],m=(b,w)=>v[w]}for(s=0,a=h.length;s=0&&(c=h[y]).data===Ig;--y)c.data=null}if(u.parent=LM,u.eachBefore(function(y){y.depth=y.parent.depth+1,--a}).eachBefore(_D),u.parent=null,a>0)throw new Error("cycle");return u}return r.id=function(i){return arguments.length?(n=Hf(i),r):n},r.parentId=function(i){return arguments.length?(e=Hf(i),r):e},r.path=function(i){return arguments.length?(t=Hf(i),r):t},r}function RD(t){let n=t.length;if(n<2)return"";for(;--n>1&&!Wg(t,n););return t.slice(0,n)}function Wg(t,n){if(t[n]==="/"){let e=0;for(;n>0&&t[--n]==="\\";)++e;if(!(1&e))return!0}return!1}function IM(t,n){return t.parent===n.parent?1:2}function Hg(t){var n=t.children;return n?n[0]:t.t}function Gg(t){var n=t.children;return n?n[n.length-1]:t.t}function WM(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function HM(t,n,e){return t.a.parent===n.parent?t.a:e}function Yf(t,n){this._=t,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=n}function Xf(t,n,e,r,i){for(var a,o=t.children,s=-1,u=o.length,l=t.value&&(i-e)/t.value;++sd&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(o={value:c,dice:u1?r:1)},e}(TD),GM=function t(n){function e(r,i,a,o,s){if((u=r._squarify)&&u.ratio===n)for(var u,l,c,f,d,h=-1,p=u.length,m=r.value;++h1?r:1)},e}(TD);function Vg(t,n,e){const r={};return t.each(i=>{const a=i.data;e(a)&&(r[n(a)]=i)}),t.lookup=r,t}function Yg(t){O.call(this,null,t)}Yg.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const VM=t=>t.values;function YM(){const t=[],n={entries:i=>r(e(i,0),0),key:i=>(t.push(i),n)};function e(i,a){if(a>=t.length)return i;const o=i.length,s=t[a++],u={},l={};let c,f,d,h=-1;for(;++ht.length)return i;const o=[];for(const s in i)o.push({key:s,values:r(i[s],a)});return o}return n}function di(t){O.call(this,null,t)}V(Yg,O,{transform(t,n){n.source||j("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),i=n.clone(),a=this.value;return(!a||r||n.changed())&&(a&&a.each(o=>{o.children&&tc(o.data)&&i.rem.push(o.data)}),this.value=a=Lg({values:K(t.keys).reduce((o,s)=>(o.key(s),o),YM()).entries(i.source)},VM),e&&a.each(o=>{o.children&&(o=St(o.data),i.add.push(o),i.source.push(o))}),Vg(a,st,st)),i.source.root=a,i}});const XM=(t,n)=>t.parent===n.parent?1:2;V(di,O,{transform(t,n){n.source&&n.source.root||j(this.constructor.name+" transform requires a backing tree data source.");const e=this.layout(t.method),r=this.fields,i=n.source.root,a=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(Sa(t.sort,o=>o.data)),function(o,s,u){for(let l,c=0,f=s.length;cfunction(s,u,l){const c=s.data,f=u.length-1;for(let d=0;d(s=(1664525*s+1013904223)%DD)/DD}();return a.x=n/2,a.y=e/2,t?a.eachBefore(MD(t)).eachAfter(Ug(r,.5,o)).eachBefore(BD(1)):a.eachBefore(MD(jM)).eachAfter(Ug(Ha,1,o)).eachAfter(Ug(r,a.r/Math.min(n,e),o)).eachBefore(BD(Math.min(n,e)/(2*a.r))),a}return i.radius=function(a){return arguments.length?(t=Hf(a),i):t},i.size=function(a){return arguments.length?(n=+a[0],e=+a[1],i):[n,e]},i.padding=function(a){return arguments.length?(r=typeof a=="function"?a:Zo(+a),i):r},i},params:["radius","size","padding"],fields:Xg});const Kg=["x0","y0","x1","y1","depth","children"];function Qg(t){di.call(this,t)}function Zg(t){O.call(this,null,t)}Qg.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Kg.length,default:Kg}]},V(Qg,di,{layout:function(){var t=1,n=1,e=0,r=!1;function i(a){var o=a.height+1;return a.x0=a.y0=e,a.x1=t,a.y1=n/o,a.eachBefore(function(s,u){return function(l){l.children&&qu(l,l.x0,s*(l.depth+1)/u,l.x1,s*(l.depth+2)/u);var c=l.x0,f=l.y0,d=l.x1-e,h=l.y1-e;d=0;--w)k.push(x=v.children[w]=new Yf(b[w],w)),x.parent=v;return(_.parent=new Yf(null,0)).children=[_],_}(u);if(l.eachAfter(a),l.parent.m=-l.z,l.eachBefore(o),r)u.eachBefore(s);else{var c=u,f=u,d=u;u.eachBefore(function(y){y.xf.x&&(f=y),y.depth>d.depth&&(d=y)});var h=c===f?1:t(c,f)/2,p=h-c.x,m=n/(f.x+h+p),g=e/(d.depth||1);u.eachBefore(function(y){y.x=(y.x+p)*m,y.y=y.depth*g})}return u}function a(u){var l=u.children,c=u.parent.children,f=u.i?c[u.i-1]:null;if(l){(function(h){for(var p,m=0,g=0,y=h.children,v=y.length;--v>=0;)(p=y[v]).z+=m,p.m+=m,m+=p.s+(g+=p.c)})(u);var d=(l[0].z+l[l.length-1].z)/2;f?(u.z=f.z+t(u._,f._),u.m=u.z-d):u.z=d}else f&&(u.z=f.z+t(u._,f._));u.parent.A=function(h,p,m){if(p){for(var g,y=h,v=h,x=p,b=y.parent.children[0],w=y.m,A=v.m,_=x.m,k=b.m;x=Gg(x),y=Hg(y),x&&y;)b=Hg(b),(v=Gg(v)).a=h,(g=x.z+_-y.z-w+t(x._,y._))>0&&(WM(HM(x,h,m),h,g),w+=g,A+=g),_+=x.m,w+=y.m,k+=b.m,A+=v.m;x&&!Gg(v)&&(v.t=x,v.m+=_-A),y&&!Hg(b)&&(b.t=y,b.m+=w-k,m=h)}return m}(u,f,u.parent.A||c[0])}function o(u){u._.x=u.z+u.parent.m,u.m+=u.parent.m}function s(u){u.x*=n,u.y=u.depth*e}return i.separation=function(u){return arguments.length?(t=u,i):t},i.size=function(u){return arguments.length?(r=!1,n=+u[0],e=+u[1],i):r?null:[n,e]},i.nodeSize=function(u){return arguments.length?(r=!0,n=+u[0],e=+u[1],i):r?[n,e]:null},i},cluster:function(){var t=$M,n=1,e=1,r=!1;function i(a){var o,s=0;a.eachAfter(function(d){var h=d.children;h?(d.x=function(p){return p.reduce(SM,0)/p.length}(h),d.y=function(p){return 1+p.reduce(MM,0)}(h)):(d.x=o?s+=t(d,o):0,d.y=0,o=d)});var u=function(d){for(var h;h=d.children;)d=h[0];return d}(a),l=function(d){for(var h;h=d.children;)d=h[h.length-1];return d}(a),c=u.x-t(u,l)/2,f=l.x+t(l,u)/2;return a.eachAfter(r?function(d){d.x=(d.x-a.x)*n,d.y=(a.y-d.y)*e}:function(d){d.x=(d.x-c)/(f-c)*n,d.y=(1-(a.y?d.y/a.y:1))*e})}return i.separation=function(a){return arguments.length?(t=a,i):t},i.size=function(a){return arguments.length?(r=!1,n=+a[0],e=+a[1],i):r?null:[n,e]},i.nodeSize=function(a){return arguments.length?(r=!0,n=+a[0],e=+a[1],i):r?[n,e]:null},i}},t1=["x","y","depth","children"];function n1(t){di.call(this,t)}function e1(t){O.call(this,[],t)}n1.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:t1.length,default:t1}]},V(n1,di,{layout(t){const n=t||"tidy";if(tt(LD,n))return LD[n]();j("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:t1}),e1.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},V(e1,O,{transform(t,n){const e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),a={};return r||j("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,o=>a[st(o)]=1),r.each(o=>{const s=o.data,u=o.parent&&o.parent.data;u&&a[st(s)]&&a[st(u)]&&i.add.push(St({source:u,target:s}))}),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,o=>a[st(o)]=1),e.forEach(o=>{(a[st(o.source)]||a[st(o.target)])&&i.mod.push(o)})),i}});const qD={binary:function(t,n,e,r,i){var a,o,s=t.children,u=s.length,l=new Array(u+1);for(l[0]=o=a=0;a=d-1){var v=s[f];return v.x0=p,v.y0=m,v.x1=g,void(v.y1=y)}for(var x=l[f],b=h/2+x,w=f+1,A=d-1;w>>1;l[_]y-m){var C=h?(p*F+g*k)/h:g;c(f,w,k,p,m,C,y),c(w,d,F,C,m,g,y)}else{var D=h?(m*F+y*k)/h:y;c(f,w,k,p,m,g,D),c(w,d,F,p,D,g,y)}})(0,u,t.value,n,e,r,i)},dice:qu,slice:Xf,slicedice:function(t,n,e,r,i){(1&t.depth?Xf:qu)(t,n,e,r,i)},squarify:jD,resquarify:GM},r1=["x0","y0","x1","y1","depth","children"];function i1(t){di.call(this,t)}i1.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:r1.length,default:r1}]},V(i1,di,{layout(){const t=function(){var n=jD,e=!1,r=1,i=1,a=[0],o=Ha,s=Ha,u=Ha,l=Ha,c=Ha;function f(h){return h.x0=h.y0=0,h.x1=r,h.y1=i,h.eachBefore(d),a=[0],e&&h.eachBefore(zD),h}function d(h){var p=a[h.depth],m=h.x0+p,g=h.y0+p,y=h.x1-p,v=h.y1-p;y{const e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=n=>{tt(qD,n)?t.tile(qD[n]):j("Unrecognized Treemap layout method: "+n)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:r1});const JM=Object.freeze(Object.defineProperty({__proto__:null,nest:Yg,pack:Jg,partition:Qg,stratify:Zg,tree:n1,treelinks:e1,treemap:i1},Symbol.toStringTag,{value:"Module"})),a1=4278190080;function o1(t,n,e){return new Uint32Array(t.getImageData(0,0,n,e).data.buffer)}function Jf(t,n,e){if(!n.length)return;const r=n[0].mark.marktype;r==="group"?n.forEach(i=>{i.items.forEach(a=>Jf(t,a.items,e))}):Ae[r].draw(t,{items:e?n.map(KM):n})}function KM(t){const n=nc(t,{});return n.stroke&&n.strokeOpacity!==0||n.fill&&n.fillOpacity!==0?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const re=31,ra=new Uint32Array(33),rr=new Uint32Array(33);rr[0]=0,ra[0]=~rr[0];for(let t=1;t<=32;++t)rr[t]=rr[t-1]<<1|1,ra[t]=~rr[t];function QM(t,n,e){const r=Math.max(1,Math.sqrt(t*n/1e6)),i=~~((t+2*e+r)/r),a=~~((n+2*e+r)/r),o=s=>~~((s+e)/r);return o.invert=s=>s*r-e,o.bitmap=()=>function(s,u){const l=new Uint32Array(~~((s*u+32)/32));function c(d,h){l[d]|=h}function f(d,h){l[d]&=h}return{array:l,get:(d,h)=>{const p=h*s+d;return l[p>>>5]&1<<(p&re)},set:(d,h)=>{const p=h*s+d;c(p>>>5,1<<(p&re))},clear:(d,h)=>{const p=h*s+d;f(p>>>5,~(1<<(p&re)))},getRange:(d,h,p,m)=>{let g,y,v,x,b=m;for(;b>=h;--b)if(g=b*s+d,y=b*s+p,v=g>>>5,x=y>>>5,v===x){if(l[v]&ra[g&re]&rr[1+(y&re)])return!0}else{if(l[v]&ra[g&re]||l[x]&rr[1+(y&re)])return!0;for(let w=v+1;w{let g,y,v,x,b;for(;h<=m;++h)if(g=h*s+d,y=h*s+p,v=g>>>5,x=y>>>5,v===x)c(v,ra[g&re]&rr[1+(y&re)]);else for(c(v,ra[g&re]),c(x,rr[1+(y&re)]),b=v+1;b{let g,y,v,x,b;for(;h<=m;++h)if(g=h*s+d,y=h*s+p,v=g>>>5,x=y>>>5,v===x)f(v,rr[g&re]|ra[1+(y&re)]);else for(f(v,rr[g&re]),f(x,ra[1+(y&re)]),b=v+1;bd<0||h<0||m>=u||p>=s}}(i,a),o.ratio=r,o.padding=e,o.width=t,o.height=n,o}function Kf(t,n,e,r,i,a){let o=e/2;return t-o<0||t+o>i||n-(o=r/2)<0||n+o>a}function ia(t,n,e,r,i,a,o,s){const u=i*a/(2*r),l=t(n-u),c=t(n+u),f=t(e-(a/=2)),d=t(e+a);return o.outOfBounds(l,f,c,d)||o.getRange(l,f,c,d)||s&&s.getRange(l,f,c,d)}const ZM=[-1,-1,1,1],tB=[-1,1,-1,1],nB=["right","center","left"],eB=["bottom","middle","top"];function UD(t,n,e,r,i,a,o,s,u,l,c,f){return!(i.outOfBounds(t,e,n,r)||(f&&a||i).getRange(t,e,n,r))}const rB={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},iB={naive:function(t,n,e,r){const i=t.width,a=t.height;return function(o){const s=o.datum.datum.items[r].items,u=s.length,l=o.datum.fontSize,c=we.width(o.datum,o.datum.text);let f,d,h,p,m,g,y,v=0;for(let x=0;x=v&&(v=y,o.x=m,o.y=g);return m=c/2,g=l/2,f=o.x-m,d=o.x+m,h=o.y-g,p=o.y+g,o.align="center",f<0&&d<=i?o.align="left":0<=f&&i=1;)g=(y+v)/2,ia(t,p,m,h,d,g,o,s)?v=g:y=g;if(y>f)return[p,m,y,!0]}}return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=we.width(l.datum,l.datum.text);let p,m,g,y,v,x,b,w,A,_,k,F,C,D,E,$,M,S=e?d:0,B=!1,z=!1,N=0;for(let W=0;Wm&&(M=p,p=m,m=M),g>y&&(M=g,g=y,y=M),A=t(p),k=t(m),_=~~((A+k)/2),F=t(g),D=t(y),C=~~((F+D)/2),b=_;b>=A;--b)for(w=C;w>=F;--w)$=u(b,w,S,h,d),$&&([l.x,l.y,S,B]=$);for(b=_;b<=k;++b)for(w=C;w<=D;++w)$=u(b,w,S,h,d),$&&([l.x,l.y,S,B]=$);B||e||(E=Math.abs(m-p+y-g),v=(p+m)/2,x=(g+y)/2,E>=N&&!Kf(v,x,h,d,i,a)&&!ia(t,v,x,d,h,d,o,null)&&(N=E,l.x=v,l.y=x,z=!0))}return!(!B&&!z)&&(v=h/2,x=d/2,o.setRange(t(l.x-v),t(l.y-x),t(l.x+v),t(l.y+x)),l.align="center",l.baseline="middle",!0)}},floodfill:function(t,n,e,r){const i=t.width,a=t.height,o=n[0],s=n[1],u=t.bitmap();return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=we.width(l.datum,l.datum.text),p=[];let m,g,y,v,x,b,w,A,_,k,F,C,D=e?d:0,E=!1,$=!1,M=0;for(let S=0;S=1;)F=(_+k)/2,ia(t,x,b,d,h,F,o,s)?k=F:_=F;_>D&&(l.x=x,l.y=b,D=_,E=!0)}}E||e||(C=Math.abs(g-m+v-y),x=(m+g)/2,b=(y+v)/2,C>=M&&!Kf(x,b,h,d,i,a)&&!ia(t,x,b,d,h,d,o,null)&&(M=C,l.x=x,l.y=b,$=!0))}return!(!E&&!$)&&(x=h/2,b=d/2,o.setRange(t(l.x-x),t(l.y-b),t(l.x+x),t(l.y+b)),l.align="center",l.baseline="middle",!0)}}};function aB(t,n,e,r,i,a,o,s,u,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),d=function(D,E){const $=new Float64Array(E),M=D.length;for(let S=0;S[B.x,B.x,B.x,B.y,B.y,B.y];return D?D==="line"||D==="area"?B=>S(B.datum):E==="line"?B=>{const z=B.datum.items[M].items;return S(z.length?z[$==="start"?0:z.length-1]:{x:NaN,y:NaN})}:B=>{const z=B.datum.bounds;return[z.x1,(z.x1+z.x2)/2,z.x2,z.y1,(z.y1+z.y2)/2,z.y2]}:S}(p,m,s,u),v=l===null||l===1/0,x=g&&c==="naive";var b;let w=-1,A=-1;const _=t.map(D=>{const E=v?we.width(D,D.text):void 0;return w=Math.max(w,E),A=Math.max(A,D.fontSize),{datum:D,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(D),textWidth:E}});l=l===null||l===1/0?Math.max(w,A)+Math.max(...r):l;const k=QM(n[0],n[1],l);let F;if(!x){e&&_.sort(($,M)=>e($.datum,M.datum));let D=!1;for(let $=0;$$.datum);F=a.length||E?function($,M,S,B,z){const N=$.width,W=$.height,X=B||z,L=qi(N,W).getContext("2d"),et=qi(N,W).getContext("2d"),ot=X&&qi(N,W).getContext("2d");S.forEach(ti=>Jf(L,ti,!1)),Jf(et,M,!1),X&&Jf(ot,M,!0);const nt=o1(L,N,W),mt=o1(et,N,W),pt=X&&o1(ot,N,W),J=$.bitmap(),Mt=X&&$.bitmap();let Tt,kt,Et,tn,nn,It,be,zn;for(kt=0;ktS.set($(B.boundary[0]),$(B.boundary[3]))),[S,void 0]}(k,o&&_)}const C=g?iB[c](k,F,o,u):function(D,E,$,M){const S=D.width,B=D.height,z=E[0],N=E[1],W=M.length;return function(X){const L=X.boundary,et=X.datum.fontSize;if(L[2]<0||L[5]<0||L[0]>S||L[3]>B)return!1;let ot,nt,mt,pt,J,Mt,Tt,kt,Et,tn,nn,It,be,zn,ti,Je=X.textWidth??0;for(let Se=0;Se>>2&3)-1,mt=ot===0&&nt===0||M[Se]<0,pt=ot&&nt?Math.SQRT1_2:1,J=M[Se]<0?-1:1,Mt=L[1+ot]+M[Se]*ot*pt,nn=L[4+nt]+J*et*nt/2+M[Se]*nt*pt,kt=nn-et/2,Et=nn+et/2,It=D(Mt),zn=D(kt),ti=D(Et),!Je){if(!UD(It,It,zn,ti,z,N,0,0,0,0,0,mt))continue;Je=we.width(X.datum,X.datum.text)}if(tn=Mt+J*Je*ot/2,Mt=tn-Je/2,Tt=tn+Je/2,It=D(Mt),be=D(Tt),UD(It,be,zn,ti,z,N,0,0,0,0,0,mt))return X.x=ot?ot*J<0?Tt:Mt:tn,X.y=nt?nt*J<0?Et:kt:nn,X.align=nB[ot*J+1],X.baseline=eB[nt*J+1],z.setRange(It,zn,be,ti),!0}return!1}}(k,F,h,d);return _.forEach(D=>D.opacity=+C(D)),_}const s1=["x","y","opacity","align","baseline"],ID=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function u1(t){O.call(this,null,t)}u1.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:ID},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:s1.length,default:s1}]},V(u1,O,{transform(t,n){const e=t.modified();if(!(e||n.changed(n.ADD_REM)||function(i){const a=t[i];return bt(a)&&n.modified(a.fields)}("sort")))return;t.size&&t.size.length===2||j("Size parameter should be specified as a [width, height] array.");const r=t.as||s1;return aB(n.materialize(n.SOURCE).source||[],t.size,t.sort,K(t.offset==null?1:t.offset),K(t.anchor||ID),t.avoidMarks||[],t.avoidBaseMark!==!1,t.lineAnchor||"end",t.markIndex||0,t.padding===void 0?0:t.padding,t.method||"naive").forEach(i=>{const a=i.datum;a[r[0]]=i.x,a[r[1]]=i.y,a[r[2]]=i.opacity,a[r[3]]=i.align,a[r[4]]=i.baseline}),n.reflow(e).modifies(r)}});const oB=Object.freeze(Object.defineProperty({__proto__:null,label:u1},Symbol.toStringTag,{value:"Module"}));function WD(t,n){var e,r,i,a,o,s,u=[],l=function(c){return c(a)};if(n==null)u.push(t);else for(e={},r=0,i=t.length;r{b2(u,t.x,t.y,t.bandwidth||.3).forEach(l=>{const c={};for(let f=0;fd==="poly"?h:d==="quad"?2:1)(a,o),u=t.as||[en(t.x),en(t.y)],l=c1[a],c=[];let f=t.extent;tt(c1,a)||j("Invalid regression method: "+a),f!=null&&a==="log"&&f[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),f=null),r.forEach(d=>{if(d.length<=s)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const h=l(d,t.x,t.y,o);if(t.params)return void c.push(St({keys:d.dims,coef:h.coef,rSquared:h.rSquared}));const p=f||kr(d,t.x),m=g=>{const y={};for(let v=0;vm([g,h.predict(g)])):fc(h.predict,p,25,200).forEach(m)}),this.value&&(e.rem=this.value),this.value=e.add=e.source=c}return e}});const sB=Object.freeze(Object.defineProperty({__proto__:null,loess:l1,regression:f1},Symbol.toStringTag,{value:"Module"})),Rn=134217729;function d1(t,n,e,r,i){let a,o,s,u,l=n[0],c=r[0],f=0,d=0;c>l==c>-l?(a=l,l=n[++f]):(a=c,c=r[++d]);let h=0;if(fl==c>-l?(o=l+a,s=a-(o-l),l=n[++f]):(o=c+a,s=a-(o-c),c=r[++d]),a=o,s!==0&&(i[h++]=s);fl==c>-l?(o=a+l,u=o-a,s=a-(o-u)+(l-u),l=n[++f]):(o=a+c,u=o-a,s=a-(o-u)+(c-u),c=r[++d]),a=o,s!==0&&(i[h++]=s);for(;f=33306690738754716e-32*l?u:-function(c,f,d,h,p,m,g){let y,v,x,b,w,A,_,k,F,C,D,E,$,M,S,B,z,N;const W=c-p,X=d-p,L=f-m,et=h-m;M=W*et,A=Rn*W,_=A-(A-W),k=W-_,A=Rn*et,F=A-(A-et),C=et-F,S=k*C-(M-_*F-k*F-_*C),B=L*X,A=Rn*L,_=A-(A-L),k=L-_,A=Rn*X,F=A-(A-X),C=X-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ts[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ts[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ts[2]=E-(N-w)+(D-w),ts[3]=N;let ot=function(Mt,Tt){let kt=Tt[0];for(let Et=1;Et=nt||-ot>=nt||(w=c-W,y=c-(W+w)+(w-p),w=d-X,x=d-(X+w)+(w-p),w=f-L,v=f-(L+w)+(w-m),w=h-et,b=h-(et+w)+(w-m),y===0&&v===0&&x===0&&b===0)||(nt=11093356479670487e-47*g+33306690738754706e-32*Math.abs(ot),ot+=W*b+et*y-(L*x+X*v),ot>=nt||-ot>=nt))return ot;M=y*et,A=Rn*y,_=A-(A-y),k=y-_,A=Rn*et,F=A-(A-et),C=et-F,S=k*C-(M-_*F-k*F-_*C),B=v*X,A=Rn*v,_=A-(A-v),k=v-_,A=Rn*X,F=A-(A-X),C=X-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ie[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ie[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ie[2]=E-(N-w)+(D-w),ie[3]=N;const mt=d1(4,ts,4,ie,HD);M=W*b,A=Rn*W,_=A-(A-W),k=W-_,A=Rn*b,F=A-(A-b),C=b-F,S=k*C-(M-_*F-k*F-_*C),B=L*x,A=Rn*L,_=A-(A-L),k=L-_,A=Rn*x,F=A-(A-x),C=x-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ie[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ie[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ie[2]=E-(N-w)+(D-w),ie[3]=N;const pt=d1(mt,HD,4,ie,GD);M=y*b,A=Rn*y,_=A-(A-y),k=y-_,A=Rn*b,F=A-(A-b),C=b-F,S=k*C-(M-_*F-k*F-_*C),B=v*x,A=Rn*v,_=A-(A-v),k=v-_,A=Rn*x,F=A-(A-x),C=x-F,z=k*C-(B-_*F-k*F-_*C),D=S-z,w=S-D,ie[0]=S-(D+w)+(w-z),E=M+D,w=E-M,$=M-(E-w)+(D-w),D=$-B,w=$-D,ie[1]=$-(D+w)+(w-B),N=E+D,w=N-E,ie[2]=E-(N-w)+(D-w),ie[3]=N;const J=d1(pt,GD,4,ie,VD);return VD[J-1]}(t,n,e,r,i,a,l)}const YD=Math.pow(2,-52),Zf=new Uint32Array(512);class jh{static from(n,e=cB,r=fB){const i=n.length,a=new Float64Array(2*i);for(let o=0;o>1;if(e>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:n,_hullPrev:e,_hullNext:r,_hullTri:i,_hullHash:a}=this,o=n.length>>1;let s=1/0,u=1/0,l=-1/0,c=-1/0;for(let C=0;Cl&&(l=D),E>c&&(c=E),this._ids[C]=C}const f=(s+l)/2,d=(u+c)/2;let h,p,m,g=1/0;for(let C=0;C0&&(p=C,g=D)}let x=n[2*p],b=n[2*p+1],w=1/0;for(let C=0;C$&&(C[D++]=M,$=this._dists[M])}return this.hull=C.subarray(0,D),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(Qf(y,v,x,b,A,_)<0){const C=p,D=x,E=b;p=m,x=A,b=_,m=C,A=D,_=E}const k=function(C,D,E,$,M,S){const B=E-C,z=$-D,N=M-C,W=S-D,X=B*B+z*z,L=N*N+W*W,et=.5/(B*W-z*N),ot=C+(W*X-z*L)*et,nt=D+(B*L-N*X)*et;return{x:ot,y:nt}}(y,v,x,b,A,_);this._cx=k.x,this._cy=k.y;for(let C=0;C0&&Math.abs(M-C)<=YD&&Math.abs(S-D)<=YD||(C=M,D=S,$===h||$===p||$===m))continue;let B=0;for(let L=0,et=this._hashKey(M,S);L=0;)if(N=z,N===B){N=-1;break}if(N===-1)continue;let W=this._addTriangle(N,$,r[N],-1,-1,i[N]);i[$]=this._legalize(W+2),i[N]=W,F++;let X=r[N];for(;z=r[X],Qf(M,S,n[2*X],n[2*X+1],n[2*z],n[2*z+1])<0;)W=this._addTriangle(X,$,z,i[$],-1,i[X]),i[$]=this._legalize(W+2),r[X]=X,F--,X=z;if(N===B)for(;z=e[N],Qf(M,S,n[2*z],n[2*z+1],n[2*N],n[2*N+1])<0;)W=this._addTriangle(z,$,N,-1,i[N],i[z]),this._legalize(W+2),i[z]=W,r[N]=N,F--,N=z;this._hullStart=e[$]=N,r[N]=e[X]=$,r[$]=X,a[this._hashKey(M,S)]=$,a[this._hashKey(n[2*N],n[2*N+1])]=N}this.hull=new Uint32Array(F);for(let C=0,D=this._hullStart;C0?3-a:1+a)/4}(n-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(n){const{_triangles:e,_halfedges:r,coords:i}=this;let a=0,o=0;for(;;){const s=r[n],u=n-n%3;if(o=u+(n+2)%3,s===-1){if(a===0)break;n=Zf[--a];continue}const l=s-s%3,c=u+(n+1)%3,f=l+(s+2)%3,d=e[o],h=e[n],p=e[c],m=e[f];if(uB(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){e[n]=m,e[s]=d;const g=r[f];if(g===-1){let v=this._hullStart;do{if(this._hullTri[v]===f){this._hullTri[v]=n;break}v=this._hullPrev[v]}while(v!==this._hullStart)}this._link(n,g),this._link(s,r[o]),this._link(o,f);const y=l+(s+1)%3;a=e&&n[t[s]]>o;)t[s+1]=t[s--];t[s+1]=a}else{let i=e+1,a=r;Iu(t,e+r>>1,i),n[t[e]]>n[t[r]]&&Iu(t,e,r),n[t[i]]>n[t[r]]&&Iu(t,i,r),n[t[e]]>n[t[i]]&&Iu(t,e,i);const o=t[i],s=n[o];for(;;){do i++;while(n[t[i]]s);if(a=a-e?(ns(t,n,i,r),ns(t,n,e,a-1)):(ns(t,n,e,a-1),ns(t,n,i,r))}}function Iu(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function cB(t){return t[0]}function fB(t){return t[1]}const XD=1e-6;class Ga{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(n,e){this._+=`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(n,e){this._+=`L${this._x1=+n},${this._y1=+e}`}arc(n,e,r){const i=(n=+n)+(r=+r),a=e=+e;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${a}`:(Math.abs(this._x1-i)>XD||Math.abs(this._y1-a)>XD)&&(this._+="L"+i+","+a),r&&(this._+=`A${r},${r},0,1,1,${n-r},${e}A${r},${r},0,1,1,${this._x1=i},${this._y1=a}`)}rect(n,e,r,i){this._+=`M${this._x0=this._x1=+n},${this._y0=this._y1=+e}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class p1{constructor(){this._=[]}moveTo(n,e){this._.push([n,e])}closePath(){this._.push(this._[0].slice())}lineTo(n,e){this._.push([n,e])}value(){return this._.length?this._:null}}let dB=class{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,a;const o=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let p,m,g=0,y=0,v=e.length;g1;)i-=2;for(let a=2;a0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)this.xmax?2:0)|(nthis.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n2&&function(u){const{triangles:l,coords:c}=u;for(let f=0;f1e-10)return!1}return!0}(n)){this.collinear=Int32Array.from({length:e.length/2},(d,h)=>h).sort((d,h)=>e[2*d]-e[2*h]||e[2*d+1]-e[2*h+1]);const u=this.collinear[0],l=this.collinear[this.collinear.length-1],c=[e[2*u],e[2*u+1],e[2*l],e[2*l+1]],f=1e-8*Math.hypot(c[3]-c[1],c[2]-c[0]);for(let d=0,h=e.length/2;d0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,i.length===2&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(n){return new dB(this,n)}*neighbors(n){const{inedges:e,hull:r,_hullIndex:i,halfedges:a,triangles:o,collinear:s}=this;if(s){const f=s.indexOf(n);return f>0&&(yield s[f-1]),void(f=0&&a!==r&&a!==i;)r=a;return a}_step(n,e,r){const{inedges:i,hull:a,_hullIndex:o,halfedges:s,triangles:u,points:l}=this;if(i[n]===-1||!l.length)return(n+1)%(l.length>>1);let c=n,f=es(e-l[2*n],2)+es(r-l[2*n+1],2);const d=i[n];let h=d;do{let p=u[h];const m=es(e-l[2*p],2)+es(r-l[2*p+1],2);if(m=w));)if(p.x=x+y,p.y=b+v,!(p.x+p.x0<0||p.y+p.y0<0||p.x+p.x1>s[0]||p.y+p.y1>s[1])&&(!m||!_B(p,h,s[0]))&&(!m||DB(p,m))){for(var F,C=p.sprite,D=p.width>>5,E=s[0]>>5,$=p.x-(D<<4),M=127&$,S=32-M,B=p.y1-p.y0,z=(p.y+p.y0)*E+($>>5),N=0;N>>M:0);z+=E}return p.sprite=null,!0}return!1}return f.layout=function(){for(var h=function(w){w.width=w.height=1;var A=Math.sqrt(w.getContext("2d").getImageData(0,0,1,1).data.length>>2);w.width=2048/A,w.height=td/A;var _=w.getContext("2d");return _.fillStyle=_.strokeStyle="red",_.textAlign="center",{context:_,ratio:A}}(qi()),p=function(w){for(var A=[],_=-1;++_>5)*s[1]),m=null,g=l.length,y=-1,v=[],x=l.map(w=>({text:t(w),font:n(w),style:r(w),weight:i(w),rotate:a(w),size:~~(e(w)+1e-14),padding:o(w),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:w})).sort((w,A)=>A.size-w.size);++y>1,b.y=s[1]*(c()+.5)>>1,AB(h,b,x,y),b.hasText&&d(p,b,m)&&(v.push(b),m?kB(m,b):m=[{x:b.x+b.x0,y:b.y+b.y0},{x:b.x+b.x1,y:b.y+b.y1}],b.x-=s[0]>>1,b.y-=s[1]>>1)}return v},f.words=function(h){return arguments.length?(l=h,f):l},f.size=function(h){return arguments.length?(s=[+h[0],+h[1]],f):s},f.font=function(h){return arguments.length?(n=Va(h),f):n},f.fontStyle=function(h){return arguments.length?(r=Va(h),f):r},f.fontWeight=function(h){return arguments.length?(i=Va(h),f):i},f.rotate=function(h){return arguments.length?(a=Va(h),f):a},f.text=function(h){return arguments.length?(t=Va(h),f):t},f.spiral=function(h){return arguments.length?(u=FB[h]||h,f):u},f.fontSize=function(h){return arguments.length?(e=Va(h),f):e},f.padding=function(h){return arguments.length?(o=Va(h),f):o},f.random=function(h){return arguments.length?(c=h,f):c},f}function AB(t,n,e,r){if(!n.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,td/a);var o,s,u,l,c,f=0,d=0,h=0,p=e.length;for(--r;++r>5<<5,u=~~Math.max(Math.abs(v+x),Math.abs(v-x))}else o=o+31>>5<<5;if(u>h&&(h=u),f+o>=2048&&(f=0,d+=h,h=0),d+u>=td)break;i.translate((f+(o>>1))/a,(d+(u>>1))/a),n.rotate&&i.rotate(n.rotate*g1),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=o,n.height=u,n.xoff=f,n.yoff=d,n.x1=o>>1,n.y1=u>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=o}for(var w=i.getImageData(0,0,2048/a,td/a).data,A=[];--r>=0;)if((n=e[r]).hasText){for(s=(o=n.width)>>5,u=n.y1-n.y0,l=0;l>5),C=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;A[F]|=C,_|=C}_?k=c:(n.y0++,u--,c--,d++)}n.y1=n.y0+k,n.sprite=A.slice(0,(n.y1-n.y0)*s)}}}function _B(t,n,e){e>>=5;for(var r,i=t.sprite,a=t.width>>5,o=t.x-(a<<4),s=127&o,u=32-s,l=t.y1-t.y0,c=(t.y+t.y0)*e+(o>>5),f=0;f>>s:0))&n[c+d])return!0;c+=e}return!1}function kB(t,n){var e=t[0],r=t[1];n.x+n.x0r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function DB(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0n[0].y&&t.y+t.y0p(h(m))}r.forEach(h=>{h[a[0]]=NaN,h[a[1]]=NaN,h[a[3]]=0});const u=i.words(r).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(s).random(Ne).layout(),l=i.size(),c=l[0]>>1,f=l[1]>>1,d=u.length;for(let h,p,m=0;mnew Uint8Array(t),SB=t=>new Uint16Array(t),Wu=t=>new Uint32Array(t);function nd(t,n,e){const r=(n<257?$B:n<65537?SB:Wu)(t);return e&&r.set(e),r}function QD(t,n,e){const r=1<{const y=h[m],v=h[g];return yv?1:0}),function(m,g){return Array.from(g,y=>m[y])}(h,p)}(d,u),o)l=n,c=t,n=Array(o+s),t=Wu(o+s),function(h,p,m,g,y,v,x,b,w){let A,_=0,k=0;for(A=0;_0)for(f=0;ft,size:()=>e}}function v1(t){O.call(this,function(){let n=8,e=[],r=Wu(0),i=nd(0,n),a=nd(0,n);return{data:()=>e,seen:()=>r=function(o,s,u){return o.length>=s?o:((u=u||new o.constructor(s)).set(o),u)}(r,e.length),add(o){for(let s,u=0,l=e.length,c=o.length;ue.length,curr:()=>i,prev:()=>a,reset:o=>a[o]=i[o],all:()=>n<257?255:n<65537?65535:4294967295,set(o,s){i[o]|=s},clear(o,s){i[o]&=~s},resize(o,s){(o>i.length||s>n)&&(n=Math.max(s,n),i=nd(o,n,i),a=nd(o,n))}}}(),t),this._indices=null,this._dims=null}function b1(t){O.call(this,null,t)}v1.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},V(v1,O,{transform(t,n){return this._dims?t.modified("fields")||t.fields.some(e=>n.modified(e.fields))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},init(t,n){const e=t.fields,r=t.query,i=this._indices={},a=this._dims=[],o=r.length;let s,u,l=0;for(;l{const a=i.remove(n,e);for(const o in r)r[o].reindex(a)})},update(t,n,e){const r=this._dims,i=t.query,a=n.stamp,o=r.length;let s,u,l=0;for(e.filters=0,u=0;uh)for(g=h,y=Math.min(f,p);gp)for(g=Math.max(f,p),y=d;gc)for(h=c,p=Math.min(u,f);hf)for(h=Math.max(u,f),p=l;hs[c]&e?null:o[c];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,c=>{const f=s[c]&e;return!f&&f^u[c]&e?o[c]:null}),a.filter(a.REM,c=>{const f=s[c]&e;return f&&!(f^f^u[c]&e)?o[c]:null})):(a.filter(a.ADD,l),a.filter(a.REM,c=>(s[c]&e)===i?o[c]:null)),a.filter(a.SOURCE,c=>l(c._index))}});const MB=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:v1,resolvefilter:b1},Symbol.toStringTag,{value:"Module"})),rs="Literal",BB="Property",zB="ArrayExpression",OB="BinaryExpression",tF="CallExpression",NB="ConditionalExpression",RB="LogicalExpression",TB="MemberExpression",PB="ObjectExpression",jB="UnaryExpression";function ir(t){this.type=t}var hi,rt,R,Tn,zt;ir.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(i){switch(i.type){case zB:return i.elements;case OB:case RB:return[i.left,i.right];case tF:return[i.callee].concat(i.arguments);case NB:return[i.test,i.consequent,i.alternate];case TB:return[i.object,i.property];case PB:return i.properties;case BB:return[i.key,i.value];case jB:return[i.argument];default:return[]}}(this),e=0,r=n.length;e",hi[3]="Identifier",hi[4]="Keyword",hi[5]="Null",hi[6]="Numeric",hi[7]="Punctuator",hi[8]="String",hi[9]="RegularExpression";var nF="Identifier",gn="Unexpected token %0",x1="Invalid regular expression",w1="Invalid regular expression: missing /",eF="Octal literals are not allowed in strict mode.",Fn="ILLEGAL",Hu="Disabled.",LB=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),qB=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function ed(t,n){if(!t)throw new Error("ASSERT: "+n)}function pi(t){return t>=48&&t<=57}function A1(t){return"0123456789abcdefABCDEF".includes(t)}function Gu(t){return"01234567".includes(t)}function UB(t){return t===32||t===9||t===11||t===12||t===160||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function Vu(t){return t===10||t===13||t===8232||t===8233}function Yu(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t===92||t>=128&&LB.test(String.fromCharCode(t))}function rd(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===92||t>=128&&qB.test(String.fromCharCode(t))}const IB={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function rF(){for(;R1114111||t!=="}")&&Ft({},gn,Fn),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function iF(){var t,n;for(t=rt.charCodeAt(R++),n=String.fromCharCode(t),t===92&&(rt.charCodeAt(R)!==117&&Ft({},gn,Fn),++R,(t=_1("u"))&&t!=="\\"&&Yu(t.charCodeAt(0))||Ft({},gn,Fn),n=t);R>>="?{type:7,value:r,start:i,end:R+=4}:(e=r.substr(0,3))===">>>"||e==="<<="||e===">>="?{type:7,value:e,start:i,end:R+=3}:o===(n=e.substr(0,2))[1]&&"+-<>&|".includes(o)||n==="=>"?{type:7,value:n,start:i,end:R+=2}:(n==="//"&&Ft({},gn,Fn),"<>=!+-*%&|^/".includes(o)?{type:7,value:o,start:i,end:++R}:void Ft({},gn,Fn))}function aF(){var t,n,e;if(ed(pi((e=rt[R]).charCodeAt(0))||e===".","Numeric literal must start with a decimal digit or a decimal point"),n=R,t="",e!=="."){if(t=rt[R++],e=rt[R],t==="0"){if(e==="x"||e==="X")return++R,function(r){let i="";for(;R=0&&Ft({},x1,o),{value:o,literal:a}}(),r=function(i,a){let o=i;a.includes("u")&&(o=o.replace(/\\u\{([0-9a-fA-F]+)\}/g,(s,u)=>{if(parseInt(u,16)<=1114111)return"x";Ft({},x1)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(o)}catch{Ft({},x1)}try{return new RegExp(i,a)}catch{return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:R}}function oF(){if(rF(),R>=Tn)return{type:2,start:R,end:R};const t=rt.charCodeAt(R);return Yu(t)?HB():t===40||t===41||t===59?k1():t===39||t===34?function(){var n,e,r,i,a="",o=!1;for(ed((n=rt[R])==="'"||n==='"',"String literal must starts with a quote"),e=R,++R;R(ed(o":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function Ya(){var t,n;return t=function(){var e,r,i,a,o,s,u,l,c,f;if(e=zt,c=ad(),(o=hF(a=zt))===0)return c;for(a.prec=o,fe(),r=[e,zt],s=[c,a,u=ad()];(o=hF(zt))>0;){for(;s.length>2&&o<=s[s.length-2].prec;)u=s.pop(),l=s.pop().value,c=s.pop(),r.pop(),i=uF(l,c,u),s.push(i);(a=fe()).prec=o,s.push(a),r.push(zt),i=ad(),s.push(i)}for(i=s[f=s.length-1],r.pop();f>1;)r.pop(),i=uF(s[f-1].value,s[f-2],i),f-=2;return i}(),Ht("?")&&(fe(),n=Ya(),Pn(":"),t=function(e,r,i){const a=new ir("ConditionalExpression");return a.test=e,a.consequent=r,a.alternate=i,a}(t,n,Ya())),t}function C1(){const t=Ya();if(Ht(","))throw new Error(Hu);return t}function pF(t){R=0,Tn=(rt=t).length,zt=null,sF();const n=C1();if(zt.type!==2)throw new Error("Unexpect token after expression.");return n}var mF={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function gF(t){function n(a,o,s){return u=>function(l,c,f,d){let h=t(c[0]);return f&&(h=f+"("+h+")",f.lastIndexOf("new ",0)===0&&(h="("+h+")")),h+"."+l+(d<0?"":d===0?"()":"("+c.slice(1).map(t).join(",")+")")}(a,u,o,s)}const e="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(a){a.length<3&&j("Missing arguments to clamp function."),a.length>3&&j("Too many arguments to clamp function.");const o=a.map(t);return"Math.max("+o[1]+", Math.min("+o[2]+","+o[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:i,test:n("test",i),if:function(a){a.length<3&&j("Missing arguments to if function."),a.length>3&&j("Too many arguments to if function.");const o=a.map(t);return"("+o[0]+"?"+o[1]+":"+o[2]+")"}}}function yF(t){const n=(t=t||{}).allowed?Dr(t.allowed):{},e=t.forbidden?Dr(t.forbidden):{},r=t.constants||mF,i=(t.functions||gF)(f),a=t.globalvar,o=t.fieldvar,s=bt(a)?a:p=>`${a}["${p}"]`;let u={},l={},c=0;function f(p){if(Q(p))return p;const m=d[p.type];return m==null&&j("Unsupported type: "+p.type),m(p)}const d={Literal:p=>p.raw,Identifier:p=>{const m=p.name;return c>0?m:tt(e,m)?j("Illegal identifier: "+m):tt(r,m)?r[m]:tt(n,m)?m:(u[m]=1,s(m))},MemberExpression:p=>{const m=!p.computed,g=f(p.object);m&&(c+=1);const y=f(p.property);return g===o&&(l[function(v){const x=v&&v.length-1;return x&&(v[0]==='"'&&v[x]==='"'||v[0]==="'"&&v[x]==="'")?v.slice(1,-1):v}(y)]=1),m&&(c-=1),g+(m?"."+y:"["+y+"]")},CallExpression:p=>{p.callee.type!=="Identifier"&&j("Illegal callee type: "+p.callee.type);const m=p.callee.name,g=p.arguments,y=tt(i,m)&&i[m];return y||j("Unrecognized function: "+m),bt(y)?y(g):y+"("+g.map(f).join(",")+")"},ArrayExpression:p=>"["+p.elements.map(f).join(",")+"]",BinaryExpression:p=>"("+f(p.left)+" "+p.operator+" "+f(p.right)+")",UnaryExpression:p=>"("+p.operator+f(p.argument)+")",ConditionalExpression:p=>"("+f(p.test)+"?"+f(p.consequent)+":"+f(p.alternate)+")",LogicalExpression:p=>"("+f(p.left)+p.operator+f(p.right)+")",ObjectExpression:p=>"{"+p.properties.map(f).join(",")+"}",Property:p=>{c+=1;const m=f(p.key);return c-=1,m+":"+f(p.value)}};function h(p){const m={code:f(p),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},m}return h.functions=i,h.constants=r,h}const vF=Symbol("vega_selection_getter");function bF(t){return t.getter&&t.getter[vF]||(t.getter=ei(t.field),t.getter[vF]=!0),t.getter}const E1="intersect",xF="union",wF="or",ez="and",Nr="_vgsid_",Ju=ei(Nr),od="index:unit";function AF(t,n){for(var e,r,i=n.fields,a=n.values,o=i.length,s=0;s=a[s])return!1}else if(r.type==="E-LTE"){if(e>a[s])return!1}else if(r.type==="E-GT"){if(e<=a[s])return!1}else if(r.type==="E-GTE"){if(en.includes(e)):n},R_union:function(t,n){var e=ze(n[0]),r=ze(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]r&&(e=n[1],r=n[0]),t.length?rr&&(t[1]=r),t):[e,r]}};function S1(t,n,e,r){n[0].type!==rs&&j("First argument to selection functions must be a string literal.");const i=n[0].value,a="unit",o="@"+a,s=":"+i;(n.length>=2&&Bt(n).value)!==E1||tt(r,o)||(r[o]=e.getData(i).indataRef(e,a)),tt(r,s)||(r[s]=e.getData(i).tuplesRef())}function kF(t){const n=this.context.data[t];return n?n.values.value:[]}const Ku=t=>function(n,e){const r=this.context.dataflow.locale();return n===null?"null":r[t](e)(n)},az=Ku("format"),DF=Ku("timeFormat"),oz=Ku("utcFormat"),sz=Ku("timeParse"),uz=Ku("utcParse"),sd=new Date(2e3,0,1);function ud(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(sd.setYear(2e3),sd.setMonth(t),sd.setDate(n),DF.call(this,sd,e)):""}function M1(t,n,e,r){n[0].type!==rs&&j("First argument to data functions must be a string literal.");const i=n[0].value,a=":"+i;if(!tt(a,r))try{r[a]=e.getData(i).tuplesRef()}catch{}}function ae(t,n,e,r){if(n[0].type===rs)FF(e,r,n[0].value);else for(t in e.scales)FF(e,r,t)}function FF(t,n,e){const r="%"+e;if(!tt(n,r))try{n[r]=t.scaleRef(e)}catch{}}function Rr(t,n){if(Q(t)){const e=n.scales[t];return e&&fw(e.value)?e.value:void 0}if(bt(t))return fw(t)?t:void 0}function lz(t,n,e){n.__bandwidth=i=>i&&i.bandwidth?i.bandwidth():0,e._bandwidth=ae,e._range=ae,e._scale=ae;const r=i=>"_["+(i.type===rs?G("%"+i.value):G("%")+"+"+t(i))+"]";return{_bandwidth:i=>`this.__bandwidth(${r(i[0])})`,_range:i=>`${r(i[0])}.range()`,_scale:i=>`${r(i[0])}(${t(i[1])})`}}function B1(t,n){return function(e,r,i){if(e){const a=Rr(e,(i||this).context);return a&&a.path[t](r)}return n(r)}}const cz=B1("area",function(t){return pf=new Gn,si(t,Mr),2*pf}),fz=B1("bounds",function(t){var n,e,r,i,a,o,s;if(_e=an=-(Kt=ce=1/0),na=[],si(t,li),e=na.length){for(na.sort(R4),n=1,a=[r=na[0]];nke(r[0],r[1])&&(r[1]=i[1]),ke(i[0],r[1])>ke(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(o=-1/0,n=0,r=a[e=a.length-1];n<=e;r=i,++n)i=a[n],(s=ke(r[1],i[0]))>o&&(o=s,Kt=i[0],an=r[1])}return na=ui=null,Kt===1/0||ce===1/0?[[NaN,NaN],[NaN,NaN]]:[[Kt,ce],[an,_e]]}),dz=B1("centroid",function(t){Du=bf=xf=wf=Af=_f=kf=Df=0,J0=new Gn,K0=new Gn,Q0=new Gn,si(t,er);var n=+J0,e=+K0,r=+Q0,i=U0(n,e,r);return iEF(t,n)}const SF={};function ld(t){return P(t)||ArrayBuffer.isView(t)?t:null}function R1(t){return ld(t)||(Q(t)?t:null)}const MF=t=>t.data;function BF(t,n){const e=kF.call(n,t);return e.root&&e.root.lookup||{}}const zF=()=>typeof window<"u"&&window||null;function OF(t,n,e){if(!t)return[];const[r,i]=t,a=new cn().set(r[0],r[1],i[0],i[1]);return QA(e||this.context.dataflow.scenegraph().root,a,function(o){let s=null;if(o){const u=K(o.marktype),l=K(o.markname);s=c=>(!u.length||u.some(f=>c.marktype===f))&&(!l.length||l.some(f=>c.name===f))}return s}(n))}const Qu={random:()=>Ne(),cumulativeNormal:uc,cumulativeLogNormal:Sp,cumulativeUniform:Op,densityNormal:Dp,densityLogNormal:$p,densityUniform:zp,quantileNormal:lc,quantileLogNormal:Mp,quantileUniform:Np,sampleNormal:sc,sampleLogNormal:Ep,sampleUniform:Bp,isArray:P,isBoolean:Fa,isDate:Da,isDefined:t=>t!==void 0,isNumber:$t,isObject:Z,isRegExp:up,isString:Q,isTuple:tc,isValid:t=>t!=null&&t==t,toBoolean:zx,toDate:t=>Ox(t),toNumber:ze,toString:Bx,indexof:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;rkr(t),inScope:function(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:OF,clampRange:gx,pinchDistance:function(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.hypot(e,r)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){const t=zF();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){const t=zF();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return km(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow,r=this.context.data[t].input;return e.pulse(r,e.changeset().remove(Be).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?su(e,n=n||Ro(t)):t}},panLinear:mx,panLog:px,panPow:hx,panSymlog:dx,zoomLinear:sp,zoomLog:ap,zoomPow:Vl,zoomSymlog:op,encode:function(t,n,e){if(t){const r=this.context.dataflow,i=t.mark.source;r.pulse(i,r.changeset().encode(t,n))}return e!==void 0?e:t},modify:function(t,n,e,r,i,a){const o=this.context.dataflow,s=this.context.data[t],u=s.input,l=o.stamp();let c,f,d=s.changes;if(o._trigger===!1||!(u.value.length||n||r))return 0;if((!d||d.stamp{s.modified=!0,o.pulse(u,d).run()},!0,1)),e&&(c=e===!0?Be:P(e)||tc(e)?e:$F(e),d.remove(c)),n&&d.insert(n),r&&(c=$F(r),u.value.some(c)?d.remove(c):d.insert(r)),i)for(f in a)d.modify(i,f,a[f]);return 1},lassoAppend:function(t,n,e){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;const i=(t=K(t))[t.length-1];return i===void 0||Math.hypot(i[0]-n,i[1]-e)>r?[...t,[n,e]]:t},lassoPath:function(t){return K(t).reduce((n,e,r)=>{let[i,a]=e;return n+(r==0?`M ${i},${a} `:r===t.length-1?" Z":`L ${i},${a} `)},"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:a}=e,o=new cn().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[s,u]of n)so.x2&&(o.x2=s),uo.y2&&(o.y2=u);return o.translate(r,i),OF([[o.x1,o.y1],[o.x2,o.y2]],t,a).filter(s=>function(u,l,c){let f=0;for(let d=0,h=c.length-1;dl!=m>l&&u<(p-g)*(l-y)/(m-y)+g&&f++}return 1&f}(s.x,s.y,n))}},hz=["view","item","group","xy","x","y"],NF="this.",T1={},RF={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${G("$"+t)}]`,functions:function(t){const n=gF(t);hz.forEach(e=>n[e]="event.vega."+e);for(const e in Qu)n[e]=NF+e;return xt(n,lz(t,Qu,T1)),n},constants:mF,visitors:T1},P1=yF(RF);function sn(t,n,e){return arguments.length===1?Qu[t]:(Qu[t]=n,e&&(T1[t]=e),P1&&(P1.functions[t]=NF+t),this)}function Tr(t,n){const e={};let r;try{r=pF(t=Q(t)?t:G(t)+"")}catch{j("Expression parse error: "+t)}r.visit(a=>{if(a.type!==tF)return;const o=a.callee.name,s=RF.visitors[o];s&&s(o,a.arguments,n,e)});const i=P1(r);return i.globals.forEach(a=>{const o="$"+a;!tt(e,o)&&n.getSignal(a)&&(e[o]=n.signalRef(a))}),{$expr:xt({code:i.code},n.options.ast?{ast:r}:null),$fields:i.fields,$params:e}}sn("bandwidth",function(t,n){const e=Rr(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0},ae),sn("copy",function(t,n){const e=Rr(t,(n||this).context);return e?e.copy():void 0},ae),sn("domain",function(t,n){const e=Rr(t,(n||this).context);return e?e.domain():[]},ae),sn("range",function(t,n){const e=Rr(t,(n||this).context);return e&&e.range?e.range():[]},ae),sn("invert",function(t,n,e){const r=Rr(t,(e||this).context);return r?P(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0},ae),sn("scale",function(t,n,e){const r=Rr(t,(e||this).context);return r?r(n):void 0},ae),sn("gradient",function(t,n,e,r,i){t=Rr(t,(i||this).context);const a=zw(n,e);let o=t.domain(),s=o[0],u=Bt(o),l=Me;return u-s?l=vw(t,s,u):t=(t.interpolator?Dt("sequential")().interpolator(t.interpolator()):Dt("linear")().interpolate(t.interpolate()).range(t.range())).domain([s=0,u=1]),t.ticks&&(o=t.ticks(+r||15),s!==o[0]&&o.unshift(s),u!==Bt(o)&&o.push(u)),o.forEach(c=>a.stop(l(c),t(c))),a},ae),sn("geoArea",cz,ae),sn("geoBounds",fz,ae),sn("geoCentroid",dz,ae),sn("geoShape",function(t,n,e){const r=Rr(t,(e||this).context);return function(i){return r?r.path.context(i)(n):""}},ae),sn("geoScale",function(t,n){const e=Rr(t,(n||this).context);return e&&e.scale()},ae),sn("indata",function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i&&i.count},function(t,n,e,r){n[0].type!==rs&&j("First argument to indata must be a string literal."),n[1].type!==rs&&j("Second argument to indata must be a string literal.");const i=n[0].value,a=n[1].value,o="@"+a;tt(o,r)||(r[o]=e.getData(i).indataRef(e,a))}),sn("data",kF,M1),sn("treePath",function(t,n,e){const r=BF(t,this),i=r[n],a=r[e];return i&&a?i.path(a).map(MF):void 0},M1),sn("treeAncestors",function(t,n){const e=BF(t,this)[n];return e?e.ancestors().map(MF):void 0},M1),sn("vlSelectionTest",function(t,n,e){for(var r,i,a,o,s,u=this.context.data[t],l=u?u.values.value:[],c=u?u[od]&&u[od].value:void 0,f=e===E1,d=l.length,h=0;h(_[a[F].field]=k,_),{}))}else u=Nr,l=Ju(i),(f=(c=v[u]||(v[u]={}))[s]||(c[s]=[])).push(l),e&&(f=x[s]||(x[s]=[])).push({[Nr]:l});return n=n||xF,v[Nr]?v[Nr]=$1[`${Nr}_${n}`](...Object.values(v[Nr])):Object.keys(v).forEach(_=>{v[_]=Object.keys(v[_]).map(k=>v[_][k]).reduce((k,F)=>k===void 0?F:$1[`${b[_]}_${n}`](k,F))}),y=Object.keys(x),e&&y.length&&(v[r?"vlPoint":"vlMulti"]=n===xF?{[wF]:y.reduce((_,k)=>(_.push(...x[k]),_),[])}:{[ez]:y.map(_=>({[wF]:x[_]}))}),v},S1),sn("vlSelectionTuples",function(t,n){return t.map(e=>xt(n.fields?{values:n.fields.map(r=>bF(r)(e.datum))}:{[Nr]:Ju(e.datum)},n))});const pz=Dr(["rule"]),TF=Dr(["group","image","rect"]);function j1(t){return(t+"").toLowerCase()}function Zu(t,n,e){e.endsWith(";")||(e="return("+e+");");const r=Function(...n.concat(e));return t&&t.functions?r.bind(t.functions):r}var mz={operator:(t,n)=>Zu(t,["_"],n.code),parameter:(t,n)=>Zu(t,["datum","_"],n.code),event:(t,n)=>Zu(t,["event"],n.code),handler:(t,n)=>Zu(t,["_","event"],`var datum=event.item&&event.item.datum;return ${n.code};`),encode:(t,n)=>{const{marktype:e,channels:r}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const a in r){const o="o["+G(a)+"]";i+=`$=${r[a].code};if(${o}!==$)${o}=$,m=1;`}return i+=function(a,o){let s="";return pz[o]||(a.x2&&(a.x?(TF[o]&&(s+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),s+="o.width=o.x2-o.x;"):s+="o.x=o.x2-(o.width||0);"),a.xc&&(s+="o.x=o.xc-(o.width||0)/2;"),a.y2&&(a.y?(TF[o]&&(s+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),s+="o.height=o.y2-o.y;"):s+="o.y=o.y2-(o.height||0);"),a.yc&&(s+="o.y=o.yc-(o.height||0)/2;")),s}(r,e),i+="return m;",Zu(t,["item","_"],i)},codegen:{get(t){const n=`[${t.map(G).join("][")}]`,e=Function("_",`return _${n};`);return e.path=n,e},comparator(t,n){let e;const r=Function("a","b","var u, v; return "+t.map((i,a)=>{const o=n[a];let s,u;return i.path?(s=`a${i.path}`,u=`b${i.path}`):((e=e||{})["f"+a]=i,s=`this.f${a}(a)`,u=`this.f${a}(b)`),function(l,c,f,d){return`((u = ${l}) < (v = ${c}) || u == null) && v != null ? ${f} + : (u > v || v == null) && u != null ? ${d} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${f} + : v !== v && u === u ? ${d} : `}(s,u,-o,o)}).join("")+"0;");return e?r.bind(e):r}}};function PF(t,n,e){if(!t||!Z(t))return t;for(let r,i=0,a=jF.length;ii&&i.$tupleid?st:i);return n.fn[e]||(n.fn[e]=ep(r,t.$order,n.expr.codegen))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){const e=t.$subflow;return function(r,i,a){const o=n.fork().parse(e),s=o.get(e.operators[0].id),u=o.signals.parent;return u&&u.set(a),s.detachSubflow=()=>n.detach(o),s}}},{key:"$tupleid",parse:function(){return st}}];const gz={skip:!0};function LF(t,n,e,r){return new qF(t,n,e,r)}function qF(t,n,e,r){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.expr=r||mz,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function UF(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function IF(t,n){t&&(n==null?t.removeAttribute("aria-label"):t.setAttribute("aria-label",n))}qF.prototype=UF.prototype={fork(){const t=new UF(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter(e=>e!==t);const n=Object.keys(t.nodes);for(const e of n)t.nodes[e]._targets=null;for(const e of n)t.nodes[e].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,n){return this.nodes[t]=n},add(t,n){const e=this,r=e.dataflow,i=t.value;if(e.set(t.id,n),function(a){return j1(a)==="collect"}(t.type)&&i&&(i.$ingest?r.ingest(n,i.$ingest,i.$format):i.$request?r.preload(n,i.$request,i.$format):r.pulse(n,r.changeset().insert(i))),t.root&&(e.root=n),t.parent){let a=e.get(t.parent.$ref);a?(r.connect(a,[n]),n.targets().add(a)):(e.unresolved=e.unresolved||[]).push(()=>{a=e.get(t.parent.$ref),r.connect(a,[n]),n.targets().add(a)})}if(t.signal&&(e.signals[t.signal]=n),t.scale&&(e.scales[t.scale]=n),t.data)for(const a in t.data){const o=e.data[a]||(e.data[a]={});t.data[a].forEach(s=>o[s]=n)}},resolve(){return(this.unresolved||[]).forEach(t=>t()),delete this.unresolved,this},operator(t,n){this.add(t,this.dataflow.add(t.value,n))},transform(t,n){this.add(t,this.dataflow.add(this.transforms[j1(n)]))},stream(t,n){this.set(t.id,n)},update(t,n,e,r,i){this.dataflow.on(n,e,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const n=this,e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),t.locale&&(n.locale=t.locale),e.forEach(r=>n.parseOperator(r)),e.forEach(r=>n.parseOperatorParameters(r)),(t.streams||[]).forEach(r=>n.parseStream(r)),(t.updates||[]).forEach(r=>n.parseUpdate(r)),n.resolve()},parseOperator:function(t){const n=this;!function(e){return j1(e)==="operator"}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?n.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const n=this;if(t.params){const e=n.get(t.id);e||j("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(n.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,n){n=n||{};const e=this;for(const r in t){const i=t[r];n[r]=P(i)?i.map(a=>PF(a,e,n)):PF(i,e,n)}return n},parseStream:function(t){var n,e=this,r=t.filter!=null?e.eventExpression(t.filter):void 0,i=t.stream!=null?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map(a=>e.get(a)))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map(a=>e.get(a)),i=i.between(n[0],n[1])),t.filter&&(i=i.filter(r)),t.throttle!=null&&(i=i.throttle(+t.throttle)),t.debounce!=null&&(i=i.debounce(+t.debounce)),i==null&&j("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)},parseUpdate:function(t){var n,e=this,r=Z(r=t.source)?r.$ref:r,i=e.get(r),a=t.update,o=void 0;i||j("Source not defined: "+t.source),n=t.target&&t.target.$expr?e.eventExpression(t.target.$expr):e.get(t.target),a&&a.$expr&&(a.$params&&(o=e.parseParameters(a.$params)),a=e.handlerExpression(a.$expr)),e.update(t,i,n,a,o)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach(a=>{const o=n.signals[a];t.signals(a,o)&&(r[a]=o.value)})}if(t.data){var i=e.data={};Object.keys(n.data).forEach(a=>{const o=n.data[a];t.data(a,o)&&(i[a]=o.input.value)})}return n.subcontext&&t.recurse!==!1&&(e.subcontext=n.subcontext.map(a=>a.getState(t))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach(a=>{e.update(n.signals[a],i[a],gz)}),Object.keys(r||{}).forEach(a=>{e.pulse(n.data[a].input,e.changeset().remove(Be).insert(r[a]))}),(t.subcontext||[]).forEach((a,o)=>{const s=n.subcontext[o];s&&s.setState(a)})}};const L1="default";function q1(t,n){const e=t.globalCursor()?typeof document<"u"&&document.body:t.container();if(e)return n==null?e.style.removeProperty("cursor"):e.style.cursor=n}function cd(t,n){var e=t._runtime.data;return tt(e,n)||j("Unrecognized data set: "+n),e[n]}function fd(t,n){t2(n)||j("Second argument to changes must be a changeset.");const e=cd(this,t);return e.modified=!0,this.pulse(e.input,n)}function WF(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function HF(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function dd(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}function yz(t,n,e){var r,i,a=t._renderer,o=a&&a.canvas();return o&&(i=dd(t),(r=Uc(n.changedTouches?n.changedTouches[0]:n,o))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(s,u,l){const c=u?u.mark.marktype==="group"?u:u.mark.group:null;function f(h){var p,m=c;if(h){for(p=u;p;p=p.mark.group)if(p.mark.name===h){m=p;break}}return m&&m.mark&&m.mark.interactive?m:{}}function d(h){if(!h)return l;Q(h)&&(h=f(h));const p=l.slice();for(;h;)p[0]-=h.x||0,p[1]-=h.y||0,h=h.mark&&h.mark.group;return p}return{view:In(s),item:In(u||{}),group:f,xy:d,x:h=>d(h)[0],y:h=>d(h)[1]}}(t,e,r),n}const GF="view",vz={trap:!1};function VF(t,n,e,r){t._eventListeners.push({type:e,sources:K(n),handler:r})}function hd(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(r===!1||Z(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function YF(t){return t.item}function XF(t){return t.item.mark.source}function JF(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function De(t,n,e){const r=document.createElement(t);for(const i in n)r.setAttribute(i,n[i]);return e!=null&&(r.textContent=e),r}function bz(t,n,e,r){const i=e.event||"input",a=()=>t.update(n.value);r.signal(e.signal,n.value),n.addEventListener(i,a),VF(r,n,i,a),t.set=o=>{n.value=o,n.dispatchEvent(function(s){return typeof Event<"u"?new Event(s):{type:s}}(i))}}function xz(t,n,e,r){const i=r.signal(e.signal),a=De("div",{class:"vega-bind"}),o=e.input==="radio"?a:a.appendChild(De("label"));o.appendChild(De("span",{class:"vega-bind-name"},e.name||e.signal)),n.appendChild(a);let s=wz;switch(e.input){case"checkbox":s=Az;break;case"select":s=_z;break;case"radio":s=kz;break;case"range":s=Dz}s(t,o,e,i)}function wz(t,n,e,r){const i=De("input");for(const a in e)a!=="signal"&&a!=="element"&&i.setAttribute(a==="input"?"type":a,e[a]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",()=>t.update(i.value)),t.elements=[i],t.set=a=>i.value=a}function Az(t,n,e,r){const i={type:"checkbox",name:e.signal};r&&(i.checked=!0);const a=De("input",i);n.appendChild(a),a.addEventListener("change",()=>t.update(a.checked)),t.elements=[a],t.set=o=>a.checked=!!o||null}function _z(t,n,e,r){const i=De("select",{name:e.signal}),a=e.labels||[];e.options.forEach((o,s)=>{const u={value:o};pd(o,r)&&(u.selected=!0),i.appendChild(De("option",u,(a[s]||o)+""))}),n.appendChild(i),i.addEventListener("change",()=>{t.update(e.options[i.selectedIndex])}),t.elements=[i],t.set=o=>{for(let s=0,u=e.options.length;s{const u={type:"radio",name:e.signal,value:o};pd(o,r)&&(u.checked=!0);const l=De("input",u);l.addEventListener("change",()=>t.update(o));const c=De("label",{},(a[s]||o)+"");return c.prepend(l),i.appendChild(c),l}),t.set=o=>{const s=t.elements,u=s.length;for(let l=0;l{u.textContent=s.value,t.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),t.elements=[s],t.set=c=>{s.value=c,u.textContent=c}}function pd(t,n){return t===n||t+""==n+""}function KF(t,n,e,r,i,a){return(n=n||new r(t.loader())).initialize(e,WF(t),HF(t),dd(t),i,a).background(t.background())}function U1(t,n){return n?function(){try{n.apply(this,arguments)}catch(e){t.error(e)}}:null}function I1(t,n,e){if(typeof n=="string"){if(typeof document>"u")return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n&&e)try{n.textContent=""}catch(r){n=null,t.error(r)}return n}const tl=t=>+t||0;function QF(t){return Z(t)?{top:tl(t.top),bottom:tl(t.bottom),left:tl(t.left),right:tl(t.right)}:(n=>({top:n,bottom:n,left:n,right:n}))(tl(t))}async function W1(t,n,e,r){const i=ef(n),a=i&&i.headless;return a||j("Unrecognized renderer type: "+n),await t.runAsync(),KF(t,null,null,a,e,r).renderAsync(t._scenegraph.root)}var ZF="width",tC="height",H1="padding",nC={skip:!0};function eC(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===H1?r.left+r.right:0)}function rC(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===H1?r.top+r.bottom:0)}function Fz(t,n){return n.modified&&P(n.input.value)&&!t.startsWith("_:vega:_")}function Cz(t,n){return!(t==="parent"||n instanceof So.proxy)}function Ez(t,n,e,r){const i=t.element();i&&i.setAttribute("title",function(a){return a==null?"":P(a)?iC(a):Z(a)&&!Da(a)?(o=a,Object.keys(o).map(s=>{const u=o[s];return s+": "+(P(u)?iC(u):aC(u))}).join(` +`)):a+"";var o}(r))}function iC(t){return"["+t.map(aC).join(", ")+"]"}function aC(t){return P(t)?"[\u2026]":Z(t)&&!Da(t)?"{\u2026}":t}function oC(t,n){const e=this;if(n=n||{},$o.call(e),n.loader&&e.loader(n.loader),n.logger&&e.logger(n.logger),n.logLevel!=null&&e.logLevel(n.logLevel),n.locale||t.locale){const a=xt({},t.locale,n.locale);e.locale(Nx(a.number,a.time))}e._el=null,e._elBind=null,e._renderType=n.renderer||Ki.Canvas,e._scenegraph=new yA;const r=e._scenegraph.root;e._renderer=null,e._tooltip=n.tooltip||Ez,e._redraw=!0,e._handler=new wu().scene(r),e._globalCursor=!1,e._preventDefault=!1,e._timers=[],e._eventListeners=[],e._resizeListeners=[],e._eventConfig=function(a){const o=xt({defaults:{}},a),s=(u,l)=>{l.forEach(c=>{P(u[c])&&(u[c]=Dr(u[c]))})};return s(o.defaults,["prevent","allow"]),s(o,["view","window","selector"]),o}(t.eventConfig),e.globalCursor(e._eventConfig.globalCursor);const i=function(a,o,s){return LF(a,So,Qu,s).parse(o)}(e,t,n.expr);e._runtime=i,e._signals=i.signals,e._bind=(t.bindings||[]).map(a=>({state:null,param:xt({},a)})),i.root&&i.root.set(r),r.source=i.data.root.input,e.pulse(i.data.root.input,e.changeset().insert(r.items)),e._width=e.width(),e._height=e.height(),e._viewWidth=eC(e,e._width),e._viewHeight=rC(e,e._height),e._origin=[0,0],e._resize=0,e._autosize=1,function(a){var o=a._signals,s=o[ZF],u=o[tC],l=o[H1];function c(){a._autosize=a._resize=1}a._resizeWidth=a.add(null,d=>{a._width=d.size,a._viewWidth=eC(a,d.size),c()},{size:s}),a._resizeHeight=a.add(null,d=>{a._height=d.size,a._viewHeight=rC(a,d.size),c()},{size:u});const f=a.add(null,c,{pad:l});a._resizeWidth.rank=s.rank+1,a._resizeHeight.rank=u.rank+1,f.rank=l.rank+1}(e),function(a){a.add(null,o=>(a._background=o.bg,a._resize=1,o.bg),{bg:a._signals.background})}(e),function(a){const o=a._signals.cursor||(a._signals.cursor=a.add({user:L1,item:null}));a.on(a.events("view","pointermove"),o,(s,u)=>{const l=o.value,c=l?Q(l)?l:l.user:L1,f=u.item&&u.item.cursor||null;return l&&c===l.user&&f==l.item?l:{user:c,item:f}}),a.add(null,function(s){let u=s.cursor,l=this.value;return Q(u)||(l=u.item,u=u.user),q1(a,u&&u!==L1?u:l||u),l},{cursor:o})}(e),e.description(t.description),n.hover&&e.hover(),n.container&&e.initialize(n.container,n.bind),n.watchPixelRatio&&e._watchPixelRatio()}function md(t,n){return tt(t._signals,n)?t._signals[n]:j("Unrecognized signal name: "+G(n))}function sC(t,n){const e=(t._targets||[]).filter(r=>r._update&&r._update.handler===n);return e.length?e[0]:null}function uC(t,n,e,r){let i=sC(e,r);return i||(i=U1(t,()=>r(n,e.value)),i.handler=r,t.on(e,null,i)),t}function lC(t,n,e){const r=sC(n,e);return r&&n._targets.remove(r),t}V(oC,$o,{async evaluate(t,n,e){if(await $o.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(r){var i=dd(r),a=WF(r),o=HF(r);r._renderer.background(r.background()),r._renderer.resize(a,o,i),r._handler.origin(i),r._resizeListeners.forEach(s=>{try{s(a,o)}catch(u){r.error(u)}})}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(r){this.error(r)}return e&&Zl(this,e),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const n=t!=null?t+"":null;return n!==this._desc&&IF(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,n,e){const r=md(this,t);return arguments.length===1?r.value:this.update(r,n,e)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",QF(t)):QF(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(ef(t)||j("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&($o.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(md(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,n,e,r,i,a){this.runAfter(o=>{let s=0;o._autosize=0,o.width()!==e&&(s=1,o.signal(ZF,e,nC),o._resizeWidth.skip(!0)),o.height()!==r&&(s=1,o.signal(tC,r,nC),o._resizeHeight.skip(!0)),o._viewWidth!==t&&(o._resize=1,o._viewWidth=t),o._viewHeight!==n&&(o._resize=1,o._viewHeight=n),o._origin[0]===i[0]&&o._origin[1]===i[1]||(o._resize=1,o._origin=i),s&&o.run("enter"),a&&o.runAfter(u=>u.resize())},!1,1)},addEventListener(t,n,e){let r=n;return e&&e.trap===!1||(r=U1(this,n),r.raw=n),this._handler.on(t,r),this},removeEventListener(t,n){for(var e,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,e=i[a].handler,t===r&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},addResizeListener(t){const n=this._resizeListeners;return n.includes(t)||n.push(t),this},removeResizeListener(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},addSignalListener(t,n){return uC(this,t,md(this,t),n)},removeSignalListener(t,n){return lC(this,md(this,t),n)},addDataListener(t,n){return uC(this,t,cd(this,t).values,n)},removeDataListener(t,n){return lC(this,cd(this,t).values,n)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const n=q1(this,null);this._globalCursor=!!t,n&&q1(this,n)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,n){this._timers.push(function(e,r,i){var a=new D8,o=r;return r==null?(a.restart(e,r,i),a):(a._restart=a.restart,a.restart=function(s,u,l){u=+u,l=l==null?F8():+l,a._restart(function c(f){f+=o,a._restart(c,o+=u,l),s(f)},u,l)},a.restart(e,r,i),a)}(function(e){t({timestamp:Date.now(),elapsed:e})},n))},events:function(t,n,e){var r,i=this,a=new ic(e),o=function(l,c){i.runAsync(null,()=>{t===GF&&function(f,d){var h=f._eventConfig.defaults,p=h.prevent,m=h.allow;return p!==!1&&m!==!0&&(p===!0||m===!1||(p?p[d]:m?!m[d]:f.preventDefault()))}(i,n)&&l.preventDefault(),a.receive(yz(i,l,c))})};if(t==="timer")hd(i,"timer",n)&&i.timer(o,n);else if(t===GF)hd(i,"view",n)&&i.addEventListener(n,o,vz);else if(t==="window"?hd(i,"window",n)&&typeof window<"u"&&(r=[window]):typeof document<"u"&&hd(i,"selector",n)&&(r=Array.from(document.querySelectorAll(t))),r){for(var s=0,u=r.length;s=0;)o[t].stop();for(t=u.length;--t>=0;)for(n=(e=u[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);for(a&&a.call(this,this._handler,null,null,null),t=s.length;--t>=0;)i=s[t].type,r=s[t].handler,this._handler.off(i,r);return this},hover:function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",YF),XF,JF(t)),this.on(this.events("view","pointerout",YF),XF,JF(n)),this},data:function(t,n){return arguments.length<2?cd(this,t).values.value:fd.call(this,t,Ma().remove(Be).insert(n))},change:fd,insert:function(t,n){return fd.call(this,t,Ma().insert(n))},remove:function(t,n){return fd.call(this,t,Ma().remove(n))},scale:function(t){var n=this._runtime.scales;return tt(n,t)||j("Unrecognized scale or projection: "+t),n[t].value},initialize:function(t,n){const e=this,r=e._renderType,i=e._eventConfig.bind,a=ef(r);t=e._el=t?I1(e,t,!0):null,function(u){const l=u.container();l&&(l.setAttribute("role","graphics-document"),l.setAttribute("aria-roleDescription","visualization"),IF(l,u.description()))}(e),a||e.error("Unrecognized renderer type: "+r);const o=a.handler||wu,s=t?a.renderer:a.headless;return e._renderer=s?KF(e,e._renderer,t,s):null,e._handler=function(u,l,c,f){const d=new f(u.loader(),U1(u,u.tooltip())).scene(u.scenegraph().root).initialize(c,dd(u),u);return l&&l.handlers().forEach(h=>{d.on(h.type,h.handler)}),d}(e,e._handler,t,o),e._redraw=!0,t&&i!=="none"&&(n=n?e._elBind=I1(e,n,!0):t.appendChild(De("form",{class:"vega-bindings"})),e._bind.forEach(u=>{u.param.element&&i!=="container"&&(u.element=I1(e,u.param.element,!!u.param.input))}),e._bind.forEach(u=>{(function(l,c,f){if(!c)return;const d=f.param;let h=f.state;h||(h=f.state={elements:null,active:!1,set:null,update:p=>{p!=l.signal(d.signal)&&l.runAsync(null,()=>{h.source=!0,l.signal(d.signal,p)})}},d.debounce&&(h.update=Qh(d.debounce,h.update))),(d.input==null&&d.element?bz:xz)(h,c,d,l),h.active||(l.on(l._signals[d.signal],null,()=>{h.source?h.source=!1:h.set(l.signal(d.signal))}),h.active=!0)})(e,u.element||n,u)})),e},toImageURL:async function(t,n){t!==Ki.Canvas&&t!==Ki.SVG&&t!==Ki.PNG&&j("Unrecognized image type: "+t);const e=await W1(this,t,n);return t===Ki.SVG?function(r,i){const a=new Blob([r],{type:i});return window.URL.createObjectURL(a)}(e.svg(),"image/svg+xml"):e.canvas().toDataURL("image/png")},toCanvas:async function(t,n){return(await W1(this,Ki.Canvas,t,n)).canvas()},toSVG:async function(t){return(await W1(this,Ki.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:Fz,signals:Cz,recurse:!0})},setState:function(t){return this.runAsync(null,n=>{n._trigger=!1,n._runtime.setState(t)},n=>{n._trigger=!0}),this},_watchPixelRatio:function(){if(this.renderer()==="canvas"&&this._renderer._canvas){let t=null;const n=()=>{t!=null&&t();const e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",n),t=()=>{e.removeEventListener("change",n)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};n()}}});const G1="[",V1="]",$z=/[[\]{}]/,Sz={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let cC,fC;function aa(t,n,e){return cC=n||"view",fC=e||Sz,dC(t.trim()).map(Y1)}function nl(t,n,e,r,i){const a=t.length;let o,s=0;for(;n=0?--s:r&&r.indexOf(o)>=0&&++s}return n}function dC(t){const n=[],e=t.length;let r=0,i=0;for(;i")throw"Expected '>' after between selector: "+n;r=r.map(Y1);const a=Y1(n.slice(1).trim());return a.between?{between:r,stream:a}:(a.between=r,a)}(t):function(n){const e={source:cC},r=[];let i,a,o=[0,0],s=0,u=0,l=n.length,c=0;if(n[l-1]==="}"){if(c=n.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+n;try{o=function(f){const d=f.split(",");if(!f.length||d.length>2)throw f;return d.map(h=>{const p=+h;if(p!=p)throw f;return p})}(n.substring(c+1,l-1))}catch{throw"Invalid throttle specification: "+n}l=(n=n.slice(0,c).trim()).length,c=0}if(!l)throw n;if(n[0]==="@"&&(s=++c),i=nl(n,c,":"),i1?(e.type=r[1],s?e.markname=r[0].slice(1):function(f){return fC[f]}(r[0])?e.marktype=r[0]:e.source=r[0]):e.type=r[0],e.type.slice(-1)==="!"&&(e.consume=!0,e.type=e.type.slice(0,-1)),a!=null&&(e.filter=a),o[0]&&(e.throttle=o[0]),o[1]&&(e.debounce=o[1]),e}(t)}function Mz(t){return Z(t)?t:{type:t||"pad"}}const el=t=>+t||0;function Bz(t){return Z(t)?t.signal?t:{top:el(t.top),bottom:el(t.bottom),left:el(t.left),right:el(t.right)}:{top:n=el(t),bottom:n,left:n,right:n};var n}const yn=t=>Z(t)&&!P(t)?xt({},t):{value:t};function hC(t,n,e,r){return e!=null?(Z(e)&&!P(e)||P(e)&&e.length&&Z(e[0])?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function Cn(t,n,e){for(const r in n)hC(t,r,n[r]);for(const r in e)hC(t,r,e[r],"update")}function is(t,n,e){for(const r in n)e&&tt(e,r)||(t[r]=xt(t[r]||{},n[r]));return t}function as(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}const X1="mark",J1="frame",K1="scope",pC="legend-label",zz="title-text",Oz="title-subtitle";function Q1(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}const mC=t=>Q(t)?G(t):t.signal?`(${t.signal})`:gC(t);function gd(t){if(t.gradient!=null)return function(e){const r=[e.start,e.stop,e.count].map(i=>i==null?null:G(i));for(;r.length&&Bt(r)==null;)r.pop();return r.unshift(mC(e.gradient)),`gradient(${r.join(",")})`}(t);let n=t.signal?`(${t.signal})`:t.color?function(e){return e.c?yd("hcl",e.h,e.c,e.l):e.h||e.s?yd("hsl",e.h,e.s,e.l):e.l||e.a?yd("lab",e.l,e.a,e.b):e.r||e.g||e.b?yd("rgb",e.r,e.g,e.b):null}(t.color):t.field!=null?gC(t.field):t.value!==void 0?G(t.value):void 0;return t.scale!=null&&(n=function(e,r){const i=mC(e.scale);return e.range!=null?r=`lerp(_range(${i}), ${+e.range})`:(r!==void 0&&(r=`_scale(${i}, ${r})`),e.band&&(r=(r?r+"+":"")+`_bandwidth(${i})`+(+e.band==1?"":"*"+vd(e.band)),e.extra&&(r=`(datum.extra ? _scale(${i}, datum.extra.value) : ${r})`)),r==null&&(r="0")),r}(t,n)),n===void 0&&(n=null),t.exponent!=null&&(n=`pow(${n},${vd(t.exponent)})`),t.mult!=null&&(n+=`*${vd(t.mult)}`),t.offset!=null&&(n+=`+${vd(t.offset)}`),t.round&&(n=`round(${n})`),n}const yd=(t,n,e,r)=>`(${t}(${[n,e,r].map(gd).join(",")})+'')`;function vd(t){return Z(t)?"("+gd(t)+")":t}function gC(t){return yC(Z(t)?t:{datum:t})}function yC(t){let n,e,r;if(t.signal)n="datum",r=t.signal;else if(t.group||t.parent){for(e=Math.max(1,t.level||1),n="item";e-- >0;)n+=".mark.group";t.parent?(r=t.parent,n+=".datum"):r=t.group}else t.datum?(n="datum",r=t.datum):j("Invalid field reference: "+G(t));return t.signal||(r=Q(r)?Ni(r).map(G).join("]["):yC(r)),n+"["+r+"]"}function vC(t,n,e,r,i,a){const o={};(a=a||{}).encoders={$encode:o},t=function(s,u,l,c,f){const d={},h={};let p,m,g,y;for(m in m="lineBreak",u!=="text"||f[m]==null||as(m,s)||Q1(d,m,f[m]),(l=="legend"||String(l).startsWith("axis"))&&(l=null),y=l===J1?f.group:l===X1?xt({},f.mark,f[u]):null,y)g=as(m,s)||(m==="fill"||m==="stroke")&&(as("fill",s)||as("stroke",s)),g||Q1(d,m,y[m]);for(m in K(c).forEach(v=>{const x=f.style&&f.style[v];for(const b in x)as(b,s)||Q1(d,b,x[b])}),s=xt({},s),d)y=d[m],y.signal?(p=p||{})[m]=y:h[m]=y;return s.enter=xt(h,s.enter),p&&(s.update=xt(p,s.update)),s}(t,n,e,r,i.config);for(const s in t)o[s]=Nz(t[s],n,a,i);return a}function Nz(t,n,e,r){const i={},a={};for(const o in t)t[o]!=null&&(i[o]=Tz(Rz(t[o]),r,e,a));return{$expr:{marktype:n,channels:i},$fields:Object.keys(a),$output:Object.keys(t)}}function Rz(t){return P(t)?function(n){let e="";return n.forEach(r=>{const i=gd(r);e+=r.test?`(${r.test})?${i}:`:i}),Bt(e)===":"&&(e+="null"),e}(t):gd(t)}function Tz(t,n,e,r){const i=Tr(t,n);return i.$fields.forEach(a=>r[a]=1),xt(e,i.$params),i.$expr}const Pz=["value","update","init","react","bind"];function bC(t,n){j(t+' for "outer" push: '+G(n))}function xC(t,n){const e=t.name;if(t.push==="outer")n.signals[e]||bC("No prior signal definition",e),Pz.forEach(r=>{t[r]!==void 0&&bC("Invalid property ",r)});else{const r=n.addSignal(e,t.value);t.react===!1&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function Z1(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function bd(t,n,e,r){return new Z1(t,n,e,r)}function xd(t,n){return bd("operator",t,n)}function lt(t){const n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function rl(t,n){return n?{$field:t,$name:n}:{$field:t}}const ty=rl("key");function wC(t,n){return{$compare:t,$order:n}}function wd(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const ny="scope",ey="view";function pn(t){return t&&t.signal}function Ad(t){if(pn(t))return!0;if(Z(t)){for(const n in t)if(Ad(t[n]))return!0}return!1}function ar(t,n){return t??n}function Xa(t){return t&&t.signal||t}const AC="timer";function il(t,n){return(t.merge?jz:t.stream?Lz:t.type?qz:j("Invalid stream specification: "+G(t)))(t,n)}function jz(t,n){const e=ry({merge:t.merge.map(r=>il(r,n))},t,n);return n.addStream(e).id}function Lz(t,n){const e=ry({stream:il(t.stream,n)},t,n);return n.addStream(e).id}function qz(t,n){let e;t.type===AC?(e=n.event(AC,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(i){return i===ny?ey:i||ey}(t.source),t.type);const r=ry({stream:e},t,n);return Object.keys(r).length===1?e:n.addStream(r).id}function ry(t,n,e){let r=n.between;return r&&(r.length!==2&&j('Stream "between" parameter must have 2 entries: '+G(n)),t.between=[il(r[0],e),il(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(i,a,o){const s="event.item";return s+(i&&i!=="*"?"&&"+s+".mark.marktype==='"+i+"'":"")+(o?"&&"+s+".mark.role==='"+o+"'":"")+(a?"&&"+s+".mark.name==='"+a+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===ny&&r.push("inScope(event.item)"),r.length&&(t.filter=Tr("("+r.join(")&&(")+")",e).$expr),(r=n.throttle)!=null&&(t.throttle=+r),(r=n.debounce)!=null&&(t.debounce=+r),n.consume&&(t.consume=!0),t}const Uz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Iz(t,n,e){const r=t.encode,i={target:e};let a=t.events,o=t.update,s=[];a||j("Signal update missing events specification."),Q(a)&&(a=aa(a,n.isSubscope()?ny:ey)),a=K(a).filter(u=>u.signal||u.scale?(s.push(u),0):1),s.length>1&&(s=[Wz(s)]),a.length&&s.push(a.length>1?{merge:a}:a[0]),r!=null&&(o&&j("Signal encode and update are mutually exclusive."),o="encode(item(),"+G(r)+")"),i.update=Q(o)?Tr(o,n):o.expr!=null?Tr(o.expr,n):o.value!=null?o.value:o.signal!=null?{$expr:Uz,$params:{$value:n.signalRef(o.signal)}}:j("Invalid signal update specification."),t.force&&(i.options={force:!0}),s.forEach(u=>n.addUpdate(xt(function(l,c){return{source:l.signal?c.signalRef(l.signal):l.scale?c.scaleRef(l.scale):il(l,c)}}(u,n),i)))}function Wz(t){return{signal:"["+t.map(n=>n.scale?'scale("'+n.scale+'")':n.signal)+"]"}}const Pt=t=>(n,e,r)=>bd(t,e,n||void 0,r),_C=Pt("aggregate"),Hz=Pt("axisticks"),kC=Pt("bound"),or=Pt("collect"),DC=Pt("compare"),Gz=Pt("datajoin"),FC=Pt("encode"),Vz=Pt("expression"),Yz=Pt("facet"),Xz=Pt("field"),Jz=Pt("key"),Kz=Pt("legendentries"),Qz=Pt("load"),Zz=Pt("mark"),tO=Pt("multiextent"),nO=Pt("multivalues"),eO=Pt("overlap"),rO=Pt("params"),CC=Pt("prefacet"),iO=Pt("projection"),aO=Pt("proxy"),oO=Pt("relay"),EC=Pt("render"),sO=Pt("scale"),Ja=Pt("sieve"),uO=Pt("sortitems"),$C=Pt("viewlayout"),lO=Pt("values");let cO=0;const SC={min:"min",max:"max",count:"sum"};function fO(t,n){const e=n.getScale(t.name).params;let r;for(r in e.domain=MC(t.domain,t,n),t.range!=null&&(e.range=zC(t,n,e)),t.interpolate!=null&&function(i,a){a.interpolate=Ue(i.type||i),i.gamma!=null&&(a.interpolateGamma=Ue(i.gamma))}(t.interpolate,e),t.nice!=null&&(e.nice=function(i,a){return i.signal?a.signalRef(i.signal):Z(i)?{interval:Ue(i.interval),step:Ue(i.step)}:Ue(i)}(t.nice,n)),t.bins!=null&&(e.bins=function(i,a){return i.signal||P(i)?_d(i,a):a.objectProperty(i)}(t.bins,n)),t)tt(e,r)||r==="name"||(e[r]=Ue(t[r],n))}function Ue(t,n){return Z(t)?t.signal?n.signalRef(t.signal):j("Unsupported object: "+G(t)):t}function _d(t,n){return t.signal?n.signalRef(t.signal):t.map(e=>Ue(e,n))}function kd(t){j("Can not find data set: "+G(t))}function MC(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(P(t)?dO:t.fields?pO:hO)(t,n,e);n.domainMin==null&&n.domainMax==null||j("No scale domain defined for domainMin/domainMax to override.")}function dO(t,n,e){return t.map(r=>Ue(r,e))}function hO(t,n,e){const r=e.getData(t.data);return r||kd(t.data),No(n.type)?r.valuesRef(e,t.field,BC(t.sort,!1)):mw(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function pO(t,n,e){const r=t.data,i=t.fields.reduce((a,o)=>(o=Q(o)?{data:r,field:o}:P(o)||o.signal?function(s,u){const l="_:vega:_"+cO++,c=or({});if(P(s))c.value={$ingest:s};else if(s.signal){const f="setdata("+G(l)+","+s.signal+")";c.params.input=u.signalRef(f)}return u.addDataPipeline(l,[c,Ja({})]),{data:l,field:"data"}}(o,e):o,a.push(o),a),[]);return(No(n.type)?mO:mw(n.type)?gO:yO)(t,e,i)}function mO(t,n,e){const r=BC(t.sort,!0);let i,a;const o=e.map(l=>{const c=n.getData(l.data);return c||kd(l.data),c.countsRef(n,l.field,r)}),s={groupby:ty,pulse:o};r&&(i=r.op||"count",a=r.field?wd(i,r.field):"count",s.ops=[SC[i]],s.fields=[n.fieldRef(a)],s.as=[a]),i=n.add(_C(s));const u=n.add(or({pulse:lt(i)}));return a=n.add(lO({field:ty,sort:n.sortRef(r),pulse:lt(u)})),lt(a)}function BC(t,n){return t&&(t.field||t.op?t.field||t.op==="count"?n&&t.field&&t.op&&!SC[t.op]&&j("Multiple domain scales can not be sorted using "+t.op):j("No field provided for sort aggregate op: "+t.op):Z(t)?t.field="key":t={field:"key"}),t}function gO(t,n,e){const r=e.map(i=>{const a=n.getData(i.data);return a||kd(i.data),a.domainRef(n,i.field)});return lt(n.add(nO({values:r})))}function yO(t,n,e){const r=e.map(i=>{const a=n.getData(i.data);return a||kd(i.data),a.extentRef(n,i.field)});return lt(n.add(tO({extents:r})))}function zC(t,n,e){const r=n.config.range;let i=t.range;if(i.signal)return n.signalRef(i.signal);if(Q(i)){if(r&&tt(r,i))return zC(t=xt({},t,{range:r[i]}),n,e);i==="width"?i=[0,{signal:"width"}]:i==="height"?i=No(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:j("Unrecognized scale range value: "+G(i))}else{if(i.scheme)return e.scheme=P(i.scheme)?_d(i.scheme,n):Ue(i.scheme,n),i.extent&&(e.schemeExtent=_d(i.extent,n)),void(i.count&&(e.schemeCount=Ue(i.count,n)));if(i.step)return void(e.rangeStep=Ue(i.step,n));if(No(t.type)&&!P(i))return MC(i,t,n);P(i)||j("Unsupported range type: "+G(i))}return i.map(a=>(P(a)?_d:Ue)(a,n))}function iy(t,n,e){return P(t)?t.map(r=>iy(r,n,e)):Z(t)?t.signal?e.signalRef(t.signal):n==="fit"?t:j("Unsupported parameter object: "+G(t)):t}const sr="top",os="left",ss="right",oa="bottom",OC="center",ay="index",oy="label",us="perc",Ie="value",al="guide-label",sy="guide-title",vO="group-title",bO="group-subtitle",NC="symbol",Dd="gradient",uy="discrete",ly="size",cy=[ly,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],ol={name:1,style:1,interactive:1},_t={value:0},We={value:1},Fd="group",RC="rect",fy="rule",Ka="text";function sl(t){return t.type=Fd,t.interactive=t.interactive||!1,t}function de(t,n){const e=(r,i)=>ar(t[r],ar(n[r],i));return e.isVertical=r=>ar(t.direction,n.direction||(r?n.symbolDirection:n.gradientDirection))==="vertical",e.gradientLength=()=>ar(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>ar(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>ar(t.columns,ar(n.columns,+e.isVertical(!0))),e}function TC(t,n){const e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function Cd(t,n,e){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${n} : ${e}`}const dy=Cd(G(os),G(ss),G(OC));function PC(t,n){return n?t?Z(t)?Object.assign({},t,{offset:PC(t.offset,n)}):{value:t,offset:n}:n:t}function Fe(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=is(t.encode,n,ol)):t.interactive=!1,t}function xO(t,n,e,r){const i=de(t,e),a=i.isVertical(),o=i.gradientThickness(),s=i.gradientLength();let u,l,c,f,d;a?(l=[0,1],c=[0,0],f=o,d=s):(l=[0,0],c=[1,0],f=s,d=o);const h={enter:u={opacity:_t,x:_t,y:_t,width:yn(f),height:yn(d)},update:xt({},u,{opacity:We,fill:{gradient:n,start:l,stop:c}}),exit:{opacity:_t}};return Cn(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),Fe({type:RC,role:"legend-gradient",encode:h},r)}function wO(t,n,e,r,i){const a=de(t,e),o=a.isVertical(),s=a.gradientThickness(),u=a.gradientLength();let l,c,f,d,h="";o?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const p={opacity:_t,fill:{scale:n,field:Ie}};p[l]={signal:h+"datum."+us,mult:u},p[c]=_t,p[f]={signal:h+"datum.perc2",mult:u},p[d]=yn(s);const m={enter:p,update:xt({},p,{opacity:We}),exit:{opacity:_t}};return Cn(m,{stroke:a("gradientStrokeColor"),strokeWidth:a("gradientStrokeWidth")},{opacity:a("gradientOpacity")}),Fe({type:RC,role:"legend-band",key:Ie,from:i,encode:m},r)}const AO=`datum.${us}<=0?"${os}":datum.${us}>=1?"${ss}":"${OC}"`,_O=`datum.${us}<=0?"${oa}":datum.${us}>=1?"${sr}":"middle"`;function jC(t,n,e,r){const i=de(t,n),a=i.isVertical(),o=yn(i.gradientThickness()),s=i.gradientLength();let u,l,c,f,d=i("labelOverlap"),h="";const p={enter:u={opacity:_t},update:l={opacity:We,text:{field:oy}},exit:{opacity:_t}};return Cn(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:ar(t.labelLimit,n.gradientLabelLimit)}),a?(u.align={value:"left"},u.baseline=l.baseline={signal:_O},c="y",f="x",h="1-"):(u.align=l.align={signal:AO},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:h+"datum."+us,mult:s},u[f]=l[f]=o,o.offset=ar(t.labelOffset,n.gradientLabelOffset)||0,d=d?{separation:i("labelSeparation"),method:d,order:"datum."+ay}:void 0,Fe({type:Ka,role:pC,style:al,key:Ie,from:r,encode:p,overlap:d},e)}function kO(t,n,e,r,i){const a=de(t,n),o=e.entries,s=!(!o||!o.interactive),u=o?o.name:void 0,l=a("clipHeight"),c=a("symbolOffset"),f={data:"value"},d=`(${i}) ? datum.offset : datum.${ly}`,h=l?yn(l):{field:ly},p=`datum.${ay}`,m=`max(1, ${i})`;let g,y,v,x,b;h.mult=.5,g={enter:y={opacity:_t,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:We,x:y.x,y:y.y},exit:{opacity:_t}};let w=null,A=null;t.fill||(w=n.symbolBaseFillColor,A=n.symbolBaseStrokeColor),Cn(g,{fill:a("symbolFillColor",w),shape:a("symbolType"),size:a("symbolSize"),stroke:a("symbolStrokeColor",A),strokeDash:a("symbolDash"),strokeDashOffset:a("symbolDashOffset"),strokeWidth:a("symbolStrokeWidth")},{opacity:a("symbolOpacity")}),cy.forEach(C=>{t[C]&&(v[C]=y[C]={scale:t[C],field:Ie})});const _=Fe({type:"symbol",role:"legend-symbol",key:Ie,from:f,clip:!!l||void 0,encode:g},e.symbols),k=yn(c);k.offset=a("labelOffset"),g={enter:y={opacity:_t,x:{signal:d,offset:k},y:h},update:v={opacity:We,text:{field:oy},x:y.x,y:y.y},exit:{opacity:_t}},Cn(g,{align:a("labelAlign"),baseline:a("labelBaseline"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:a("labelLimit")});const F=Fe({type:Ka,role:pC,style:al,key:Ie,from:f,encode:g},e.labels);return g={enter:{noBound:{value:!l},width:_t,height:l?yn(l):_t,opacity:_t},exit:{opacity:_t},update:v={opacity:We,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(x=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${x}`,v.column.signal=`floor(${p} / ${x})`,b={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,b={field:p}),v.column.signal=`(${i})?${v.column.signal}:${p}`,sl({role:K1,from:r={facet:{data:r,name:"value",groupby:ay}},encode:is(g,o,ol),marks:[_,F],name:u,interactive:s,sort:b})}const hy='item.orient === "left"',py='item.orient === "right"',Ed=`(${hy} || ${py})`,DO=`datum.vgrad && ${Ed}`,FO=Cd('"top"','"bottom"','"middle"'),CO=`datum.vgrad && ${py} ? (${Cd('"right"','"left"','"center"')}) : (${Ed} && !(datum.vgrad && ${hy})) ? "left" : ${dy}`,EO=`item._anchor || (${Ed} ? "middle" : "start")`,$O=`${DO} ? (${hy} ? -90 : 90) : 0`,SO=`${Ed} ? (datum.vgrad ? (${py} ? "bottom" : "top") : ${FO}) : "top"`;function MO(t,n){let e;return Z(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+LC(t.path)+")":t.sphere&&(e="geoShape("+LC(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function LC(t){return Z(t)&&t.signal?t.signal:G(t)}function qC(t){const n=t.role||"";return n.startsWith("axis")||n.startsWith("legend")||n.startsWith("title")?n:t.type===Fd?K1:n||X1}function BO(t){return{marktype:t.type,name:t.name||void 0,role:t.role||qC(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function zO(t,n){return t&&t.signal?n.signalRef(t.signal):t!==!1}function my(t,n){const e=a2(t.type);e||j("Unrecognized transform type: "+G(t.type));const r=bd(e.type.toLowerCase(),null,UC(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function UC(t,n,e){const r={},i=t.params.length;for(let a=0;aWC(a,l,s))):WC(a,u,s)}(t,n,e):r==="projection"?e.projectionRef(n[t.name]):t.array&&!pn(i)?i.map(a=>IC(t,a,e)):IC(t,i,e):void(t.required&&j("Missing required "+G(n.type)+" parameter: "+G(t.name)))}function IC(t,n,e){const r=t.type;if(pn(n))return HC(r)?j("Expression references can not be signals."):gy(r)?e.fieldRef(n):GC(r)?e.compareRef(n):e.signalRef(n.signal);{const i=t.expr||gy(r);return i&&NO(n)?e.exprRef(n.expr,n.as):i&&RO(n)?rl(n.field,n.as):HC(r)?Tr(n,e):TO(r)?lt(e.getData(n).values):gy(r)?rl(n):GC(r)?e.compareRef(n):n}}function WC(t,n,e){const r=t.params.length;let i;for(let o=0;ot&&t.expr,RO=t=>t&&t.field,TO=t=>t==="data",HC=t=>t==="expr",gy=t=>t==="field",GC=t=>t==="compare";function $d(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:lt(n.getData(t.data).output)}function Qa(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}function VC(t){return Q(t)?t:null}function YC(t,n,e){const r=wd(e.op,e.field);let i;if(n.ops){for(let a=0,o=n.as.length;ac??"null").join(",")+"),0)",n);u.update=l.$expr,u.params=l.$params}function Sd(t,n){const e=qC(t),r=t.type===Fd,i=t.from&&t.from.facet,a=t.overlap;let o,s,u,l,c,f,d,h=t.layout||e===K1||e===J1;const p=e===X1||h||i,m=function(A,_,k){let F,C,D,E,$;return A?(F=A.facet)&&(_||j("Only group marks can be faceted."),F.field!=null?E=$=$d(F,k):(A.data?$=lt(k.getData(A.data).aggregate):(D=my(xt({type:"aggregate",groupby:K(F.groupby)},F.aggregate),k),D.params.key=k.keyRef(F.groupby),D.params.pulse=$d(F,k),E=$=lt(k.add(D))),C=k.keyRef(F.groupby,!0))):E=lt(k.add(or(null,[{}]))),E||(E=$d(A,k)),{key:C,pulse:E,parent:$}}(t.from,r,n);s=n.add(Gz({key:m.key||(t.key?rl(t.key):void 0),pulse:m.pulse,clean:!r}));const g=lt(s);s=u=n.add(or({pulse:g})),s=n.add(Zz({markdef:BO(t),interactive:zO(t.interactive,n),clip:MO(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:lt(s)}));const y=lt(s);s=l=n.add(FC(vC(t.encode,t.type,e,t.style,n,{mod:!1,pulse:y}))),s.params.parent=n.encode(),t.transform&&t.transform.forEach(A=>{const _=my(A,n),k=_.metadata;(k.generates||k.changes)&&j("Mark transforms should not generate new data."),k.nomod||(l.params.mod=!0),_.params.pulse=lt(s),n.add(s=_)}),t.sort&&(s=n.add(uO({sort:n.compareRef(t.sort),pulse:lt(s)})));const v=lt(s);(i||h)&&(h=n.add($C({layout:n.objectProperty(t.layout),legends:n.legends,mark:y,pulse:v})),f=lt(h));const x=n.add(kC({mark:y,pulse:f||v}));d=lt(x),r&&(p&&(o=n.operators,o.pop(),h&&o.pop()),n.pushState(v,f||d,g),i?function(A,_,k){const F=A.from.facet,C=F.name,D=$d(F,_);let E;F.name||j("Facet must have a name: "+G(F)),F.data||j("Facet must reference a data set: "+G(F)),F.field?E=_.add(CC({field:_.fieldRef(F.field),pulse:D})):F.groupby?E=_.add(Yz({key:_.keyRef(F.groupby),group:lt(_.proxy(k.parent)),pulse:D})):j("Facet must specify groupby or field: "+G(F));const $=_.fork(),M=$.add(or()),S=$.add(Ja({pulse:lt(M)}));$.addData(C,new Qa($,M,M,S)),$.addSignal("parent",null),E.params.subflow={$subflow:$.parse(A).toRuntime()}}(t,n,m):p?function(A,_,k){const F=_.add(CC({pulse:k.pulse})),C=_.fork();C.add(Ja()),C.addSignal("parent",null),F.params.subflow={$subflow:C.parse(A).toRuntime()}}(t,n,m):n.parse(t),n.popState(),p&&(h&&o.push(h),o.push(x))),a&&(d=function(A,_,k){const F=A.method,C=A.bound,D=A.separation,E={separation:pn(D)?k.signalRef(D.signal):D,method:pn(F)?k.signalRef(F.signal):F,pulse:_};if(A.order&&(E.sort=k.compareRef({field:A.order})),C){const $=C.tolerance;E.boundTolerance=pn($)?k.signalRef($.signal):+$,E.boundScale=k.scaleRef(C.scale),E.boundOrient=C.orient}return lt(k.add(eO(E)))}(a,d,n));const b=n.add(EC({pulse:d})),w=n.add(Ja({pulse:lt(b)},void 0,n.parent()));t.name!=null&&(c=t.name,n.addData(c,new Qa(n,u,b,w)),t.on&&t.on.forEach(A=>{(A.insert||A.remove||A.toggle)&&j("Marks only support modify triggers."),XC(A,n,c)}))}function PO(t,n){const e=n.config.legend,r=t.encode||{},i=de(t,e),a=r.legend||{},o=a.name||void 0,s=a.interactive,u=a.style,l={};let c,f,d,h=0;cy.forEach(v=>t[v]?(l[v]=t[v],h=h||t[v]):0),h||j("Missing valid scale for legend.");const p=function(v,x){let b=v.type||NC;return v.type||function(w){return cy.reduce((A,_)=>A+(w[_]?1:0),0)}(v)!==1||!v.fill&&!v.stroke||(b=Sm(x)?Dd:Mm(x)?uy:NC),b!==Dd?b:Mm(x)?uy:Dd}(t,n.scaleType(h)),m={title:t.title!=null,scales:l,type:p,vgrad:p!=="symbol"&&i.isVertical()},g=lt(n.add(or(null,[m]))),y=lt(n.add(Kz(f={type:p,scale:n.scaleRef(h),count:n.objectProperty(i("tickCount")),limit:n.property(i("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)})));return p===Dd?(d=[xO(t,h,e,r.gradient),jC(t,e,r.labels,y)],f.count=f.count||n.signalRef(`max(2,2*floor((${Xa(i.gradientLength())})/100))`)):p===uy?d=[wO(t,h,e,r.gradient,y),jC(t,e,r.labels,y)]:(c=function(v,x){const b=de(v,x);return{align:b("gridAlign"),columns:b.entryColumns(),center:{row:!0,column:!1},padding:{row:b("rowPadding"),column:b("columnPadding")}}}(t,e),d=[kO(t,e,r,y,Xa(c.columns))],f.size=function(v,x,b){const w=Xa(JC("size",v,b)),A=Xa(JC("strokeWidth",v,b)),_=Xa(function(k,F,C){return TC("fontSize",k)||function(D,E,$){const M=E.config.style[$];return M&&M[D]}("fontSize",F,C)}(b[1].encode,x,al));return Tr(`max(ceil(sqrt(${w})+${A}),${_})`,x)}(t,n,d[0].marks)),d=[sl({role:"legend-entry",from:g,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:c,interactive:s})],m.title&&d.push(function(v,x,b,w){const A=de(v,x),_={enter:{opacity:_t},update:{opacity:We,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:_t}};return Cn(_,{orient:A("titleOrient"),_anchor:A("titleAnchor"),anchor:{signal:EO},angle:{signal:$O},align:{signal:CO},baseline:{signal:SO},text:v.title,fill:A("titleColor"),fillOpacity:A("titleOpacity"),font:A("titleFont"),fontSize:A("titleFontSize"),fontStyle:A("titleFontStyle"),fontWeight:A("titleFontWeight"),limit:A("titleLimit"),lineHeight:A("titleLineHeight")},{align:A("titleAlign"),baseline:A("titleBaseline")}),Fe({type:Ka,role:"legend-title",style:sy,from:w,encode:_},b)}(t,e,r.title,g)),Sd(sl({role:"legend",from:g,encode:is(jO(i,t,e),a,ol),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:o,interactive:s,style:u}),n)}function jO(t,n,e){const r={enter:{},update:{}};return Cn(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:e.strokeWidth,strokeDash:e.strokeDash,x:t("legendX"),y:t("legendY"),format:n.format,formatType:n.formatType}),r}function JC(t,n,e){return n[t]?`scale("${n[t]}",datum)`:TC(t,e[0].encode)}Qa.fromEntries=function(t,n){const e=n.length,r=n[e-1],i=n[e-2];let a=n[0],o=null,s=1;for(a&&a.type==="load"&&(a=n[1]),t.add(n[0]);s{e.push(my(r,n))}),t.on&&t.on.forEach(r=>{XC(r,n,t.name)}),n.addDataPipeline(t.name,function(r,i,a){const o=[];let s,u,l,c,f,d=null,h=!1,p=!1;for(r.values?pn(r.values)||Ad(r.format)?(o.push(KC(i,r)),o.push(d=Za())):o.push(d=Za({$ingest:r.values,$format:r.format})):r.url?Ad(r.url)||Ad(r.format)?(o.push(KC(i,r)),o.push(d=Za())):o.push(d=Za({$request:r.url,$format:r.format})):r.source&&(d=s=K(r.source).map(m=>lt(i.getData(m).output)),o.push(null)),u=0,l=a.length;ut===oa||t===sr,Md=(t,n,e)=>pn(t)?GO(t.signal,n,e):t===os||t===sr?n:e,vn=(t,n,e)=>pn(t)?WO(t.signal,n,e):QC(t)?n:e,ur=(t,n,e)=>pn(t)?HO(t.signal,n,e):QC(t)?e:n,ZC=(t,n,e)=>pn(t)?VO(t.signal,n,e):t===sr?{value:n}:{value:e},WO=(t,n,e)=>tE(`${t} === '${sr}' || ${t} === '${oa}'`,n,e),HO=(t,n,e)=>tE(`${t} !== '${sr}' && ${t} !== '${oa}'`,n,e),GO=(t,n,e)=>yy(`${t} === '${os}' || ${t} === '${sr}'`,n,e),VO=(t,n,e)=>yy(`${t} === '${sr}'`,n,e),YO=(t,n,e)=>yy(`${t} === '${ss}'`,n,e),tE=(t,n,e)=>(n=n!=null?yn(n):n,e=e!=null?yn(e):e,nE(n)&&nE(e)?{signal:`${t} ? (${n=n?n.signal||G(n.value):null}) : (${e=e?e.signal||G(e.value):null})`}:[xt({test:t},n)].concat(e||[])),nE=t=>t==null||Object.keys(t).length===1,yy=(t,n,e)=>({signal:`${t} ? (${ls(n)}) : (${ls(e)})`}),XO=(t,n,e,r,i)=>({signal:(r!=null?`${t} === '${os}' ? (${ls(r)}) : `:"")+(e!=null?`${t} === '${oa}' ? (${ls(e)}) : `:"")+(i!=null?`${t} === '${ss}' ? (${ls(i)}) : `:"")+(n!=null?`${t} === '${sr}' ? (${ls(n)}) : `:"")+"(null)"}),ls=t=>pn(t)?t.signal:t==null?null:G(t),cs=(t,n)=>{const e=t.signal;return e&&e.endsWith("(null)")?{signal:e.slice(0,-6)+n.signal}:t};function fs(t,n,e,r){let i;if(n&&tt(n,t))return n[t];if(tt(e,t))return e[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[sy][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[al][i]}return null}function eE(t){const n={};for(const e of t)if(e)for(const r in e)n[r]=1;return Object.keys(n)}function rE(t,n){return{scale:t.scale,range:n}}function JO(t,n,e,r,i){const a=de(t,n),o=t.orient,s=t.gridScale,u=Md(o,1,-1),l=function(v,x){if(x!==1)if(Z(v)){let b=v=xt({},v);for(;b.mult!=null;){if(!Z(b.mult))return b.mult=pn(x)?{signal:`(${b.mult}) * (${x.signal})`}:b.mult*x,v;b=b.mult=xt({},b.mult)}b.mult=x}else v=pn(x)?{signal:`(${x.signal}) * (${v||0})`}:x*(v||0);return v}(t.offset,u);let c,f,d;const h={enter:c={opacity:_t},update:d={opacity:We},exit:f={opacity:_t}};Cn(h,{stroke:a("gridColor"),strokeCap:a("gridCap"),strokeDash:a("gridDash"),strokeDashOffset:a("gridDashOffset"),strokeOpacity:a("gridOpacity"),strokeWidth:a("gridWidth")});const p={scale:t.scale,field:Ie,band:i.band,extra:i.extra,offset:i.offset,round:a("tickRound")},m=vn(o,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:u,offset:l}:{value:0,offset:l},y=s?{scale:s,range:1,mult:u,offset:l}:xt(m,{mult:u,offset:l});return c.x=d.x=vn(o,p,g),c.y=d.y=ur(o,p,g),c.x2=d.x2=ur(o,y),c.y2=d.y2=vn(o,y),f.x=vn(o,p),f.y=ur(o,p),Fe({type:fy,role:"axis-grid",key:Ie,from:r,encode:h},e)}function vy(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function KO(t,n,e,r,i,a){const o=de(t,n),s=t.orient,u=t.scale,l=Md(s,-1,1),c=Xa(o("labelFlush")),f=Xa(o("labelFlushOffset")),d=o("labelAlign"),h=o("labelBaseline");let p,m=c===0||!!c;const g=yn(i);g.mult=l,g.offset=yn(o("labelPadding")||0),g.offset.mult=l;const y={scale:u,field:Ie,band:.5,offset:PC(a.offset,o("labelOffset"))},v=vn(s,m?vy(u,c,'"left"','"right"','"center"'):{value:"center"},((F,C,D)=>pn(F)?YO(F.signal,C,D):F===ss?{value:C}:{value:D})(s,"left","right")),x=vn(s,ZC(s,"bottom","top"),m?vy(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),b=vy(u,c,`-(${f})`,f,0);m=m&&f;const w={opacity:_t,x:vn(s,y,g),y:ur(s,y,g)},A={enter:w,update:p={opacity:We,text:{field:oy},x:w.x,y:w.y,align:v,baseline:x},exit:{opacity:_t,x:w.x,y:w.y}};Cn(A,{dx:!d&&m?vn(s,b):null,dy:!h&&m?ur(s,b):null}),Cn(A,{angle:o("labelAngle"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontWeight:o("labelFontWeight"),fontStyle:o("labelFontStyle"),limit:o("labelLimit"),lineHeight:o("labelLineHeight")},{align:d,baseline:h});const _=o("labelBound");let k=o("labelOverlap");return k=k||_?{separation:o("labelSeparation"),method:k,order:"datum.index",bound:_?{scale:u,orient:s,tolerance:_}:null}:void 0,p.align!==v&&(p.align=cs(p.align,v)),p.baseline!==x&&(p.baseline=cs(p.baseline,x)),Fe({type:Ka,role:"axis-label",style:al,key:Ie,from:r,encode:A,overlap:k},e)}function QO(t,n,e,r){const i=de(t,n),a=t.orient,o=Md(a,-1,1);let s,u;const l={enter:s={opacity:_t,anchor:yn(i("titleAnchor",null)),align:{signal:dy}},update:u=xt({},s,{opacity:We,text:yn(t.title)}),exit:{opacity:_t}},c={signal:`lerp(range("${t.scale}"), ${Cd(0,1,.5)})`};return u.x=vn(a,c),u.y=ur(a,c),s.angle=vn(a,_t,((f,d)=>d===0?0:pn(f)?{signal:`(${f.signal}) * ${d}`}:{value:f*d})(o,90)),s.baseline=vn(a,ZC(a,oa,sr),{value:oa}),u.angle=s.angle,u.baseline=s.baseline,Cn(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(f,d,h,p){const m=(v,x)=>v!=null?(h.update[x]=cs(yn(v),h.update[x]),!1):!as(x,p),g=m(f("titleX"),"x"),y=m(f("titleY"),"y");h.enter.auto=y===g?yn(y):vn(d,yn(y),yn(g))}(i,a,l,e),l.update.align=cs(l.update.align,s.align),l.update.angle=cs(l.update.angle,s.angle),l.update.baseline=cs(l.update.baseline,s.baseline),Fe({type:Ka,role:"axis-title",style:sy,from:r,encode:l},e)}function ZO(t,n){const e=function(m,g){var y,v,x,b=g.config,w=b.style,A=b.axis,_=g.scaleType(m.scale)==="band"&&b.axisBand,k=m.orient;if(pn(k)){const F=eE([b.axisX,b.axisY]),C=eE([b.axisTop,b.axisBottom,b.axisLeft,b.axisRight]);for(x of(y={},F))y[x]=vn(k,fs(x,b.axisX,A,w),fs(x,b.axisY,A,w));for(x of(v={},C))v[x]=XO(k.signal,fs(x,b.axisTop,A,w),fs(x,b.axisBottom,A,w),fs(x,b.axisLeft,A,w),fs(x,b.axisRight,A,w))}else y=k===sr||k===oa?b.axisX:b.axisY,v=b["axis"+k[0].toUpperCase()+k.slice(1)];return y||v||_?xt({},A,y,v,_):A}(t,n),r=t.encode||{},i=r.axis||{},a=i.name||void 0,o=i.interactive,s=i.style,u=de(t,e),l=function(m){const g=m("tickBand");let y,v,x=m("tickOffset");return g?g.signal?(y={signal:`(${g.signal}) === 'extent' ? 1 : 0.5`},v={signal:`(${g.signal}) === 'extent'`},Z(x)||(x={signal:`(${g.signal}) === 'extent' ? 0 : ${x}`})):g==="extent"?(y=1,v=!0,x=0):(y=.5,v=!1):(y=m("bandPosition"),v=m("tickExtra")),{extra:v,band:y,offset:x}}(u),c={scale:t.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:t.title!=null},f=lt(n.add(or({},[c]))),d=lt(n.add(Hz({scale:n.scaleRef(t.scale),extra:n.property(l.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),h=[];let p;return c.grid&&h.push(JO(t,e,r.grid,d,l)),c.ticks&&(p=u("tickSize"),h.push(function(m,g,y,v,x,b){const w=de(m,g),A=m.orient,_=Md(A,-1,1);let k,F,C;const D={enter:k={opacity:_t},update:C={opacity:We},exit:F={opacity:_t}};Cn(D,{stroke:w("tickColor"),strokeCap:w("tickCap"),strokeDash:w("tickDash"),strokeDashOffset:w("tickDashOffset"),strokeOpacity:w("tickOpacity"),strokeWidth:w("tickWidth")});const E=yn(x);E.mult=_;const $={scale:m.scale,field:Ie,band:b.band,extra:b.extra,offset:b.offset,round:w("tickRound")};return C.y=k.y=vn(A,_t,$),C.y2=k.y2=vn(A,E),F.x=vn(A,$),C.x=k.x=ur(A,_t,$),C.x2=k.x2=ur(A,E),F.y=ur(A,$),Fe({type:fy,role:"axis-tick",key:Ie,from:v,encode:D},y)}(t,e,r.ticks,d,p,l))),c.labels&&(p=c.ticks?p:0,h.push(KO(t,e,r.labels,d,p,l))),c.domain&&h.push(function(m,g,y,v){const x=de(m,g),b=m.orient;let w,A;const _={enter:w={opacity:_t},update:A={opacity:We},exit:{opacity:_t}};Cn(_,{stroke:x("domainColor"),strokeCap:x("domainCap"),strokeDash:x("domainDash"),strokeDashOffset:x("domainDashOffset"),strokeWidth:x("domainWidth"),strokeOpacity:x("domainOpacity")});const k=rE(m,0),F=rE(m,1);return w.x=A.x=vn(b,k,_t),w.x2=A.x2=vn(b,F),w.y=A.y=ur(b,k,_t),w.y2=A.y2=ur(b,F),Fe({type:fy,role:"axis-domain",from:v,encode:_},y)}(t,e,r.domain,f)),c.title&&h.push(QO(t,e,r.title,f)),Sd(sl({role:"axis",from:f,encode:is(tN(u,t),i,ol),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:a,interactive:o,style:s}),n)}function tN(t,n){const e={enter:{},update:{}};return Cn(e,{orient:t("orient"),offset:t("offset")||0,position:ar(n.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:t("translate"),format:n.format,formatType:n.formatType}),e}function iE(t,n,e){const r=K(t.signals),i=K(t.scales);return e||r.forEach(a=>xC(a,n)),K(t.projections).forEach(a=>function(o,s){const u=s.config.projection||{},l={};for(const c in o)c!=="name"&&(l[c]=iy(o[c],c,s));for(const c in u)l[c]==null&&(l[c]=iy(u[c],c,s));s.addProjection(o.name,l)}(a,n)),i.forEach(a=>function(o,s){const u=o.type||"linear";dw(u)||j("Unrecognized scale type: "+G(u)),s.addScale(o.name,{type:u,domain:void 0})}(a,n)),K(t.data).forEach(a=>IO(a,n)),i.forEach(a=>fO(a,n)),(e||r).forEach(a=>function(o,s){const u=s.getSignal(o.name);let l=o.update;o.init&&(l?j("Signals can not include both init and update expressions."):(l=o.init,u.initonly=!0)),l&&(l=Tr(l,s),u.update=l.$expr,u.params=l.$params),o.on&&o.on.forEach(c=>Iz(c,s,u.id))}(a,n)),K(t.axes).forEach(a=>ZO(a,n)),K(t.marks).forEach(a=>Sd(a,n)),K(t.legends).forEach(a=>PO(a,n)),t.title&&qO(t.title,n),n.parseLambdas(),n}function nN(t,n){const e=n.config,r=lt(n.root=n.add(xd())),i=function(l,c){const f=m=>ar(l[m],c[m]),d=[ll("background",f("background")),ll("autosize",Mz(f("autosize"))),ll("padding",Bz(f("padding"))),ll("width",f("width")||0),ll("height",f("height")||0)],h=d.reduce((m,g)=>(m[g.name]=g,m),{}),p={};return K(l.signals).forEach(m=>{tt(h,m.name)?m=xt(h[m.name],m):d.push(m),p[m.name]=m}),K(c.signals).forEach(m=>{tt(p,m.name)||tt(h,m.name)||d.push(m)}),d}(t,e);i.forEach(l=>xC(l,n)),n.description=t.description||e.description,n.eventConfig=e.events,n.legends=n.objectProperty(e.legend&&e.legend.layout),n.locale=e.locale;const a=n.add(or()),o=n.add(FC(vC((l=>is({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},l))(t.encode),Fd,J1,t.style,n,{pulse:lt(a)}))),s=n.add($C({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:lt(o)}));n.operators.pop(),n.pushState(lt(o),lt(s),null),iE(t,n,i),n.operators.push(s);let u=n.add(kC({mark:r,pulse:lt(s)}));return u=n.add(EC({pulse:lt(u)})),u=n.add(Ja({pulse:lt(u)})),n.addData("root",new Qa(n,a,a,u)),n}function ll(t,n){return n&&n.signal?{name:t,update:n.signal}:{name:t,value:n}}function aE(t,n){this.config=t||{},this.options=n||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function oE(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function by(t){return(P(t)?eN:rN)(t)}function eN(t){const n=t.length;let e="[";for(let r=0;r0?",":"")+(Z(i)?i.signal||by(i):G(i))}return e+"]"}function rN(t){let n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+G(n)+":"+(Z(e)?e.signal||by(e):G(e));return r+"}"}aE.prototype=oE.prototype={parse(t){return iE(t,this)},fork(){return new oE(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(n=>{n.$ref=t.id}),t.refs=null),t},proxy(t){const n=t instanceof Z1?lt(t):t;return this.add(aO({value:n}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(r,i,a){let o,s;r&&(o=r.data||(r.data={}),s=o[i]||(o[i]=[]),s.push(a))}for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(const r in n.index)e(n.index[r],t,"index:"+r)}return this},pushState(t,n,e){this._encode.push(lt(this.add(Ja({pulse:t})))),this._parent.push(n),this._lookup.push(e?lt(this.proxy(e)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return Bt(this._parent)},encode(){return Bt(this._encode)},lookup(){return Bt(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,n){if(Q(t))return rl(t,n);t.signal||j("Unsupported field reference: "+G(t));const e=t.signal;let r=this.field[e];if(!r){const i={name:this.signalRef(e)};n&&(i.as=n),this.field[e]=r=lt(this.add(Xz(i)))}return r},compareRef(t){let n=!1;const e=a=>pn(a)?(n=!0,this.signalRef(a.signal)):function(o){return o&&o.expr}(a)?(n=!0,this.exprRef(a.expr)):a,r=K(t.field).map(e),i=K(t.order).map(e);return n?lt(this.add(DC({fields:r,orders:i}))):wC(r,i)},keyRef(t,n){let e=!1;const r=this.signals;return t=K(t).map(i=>pn(i)?(e=!0,lt(r[i.signal])):i),e?lt(this.add(Jz({fields:t,flat:n}))):function(i,a){const o={$key:i};return a&&(o.$flat=!0),o}(t,n)},sortRef(t){if(!t)return t;const n=wd(t.op,t.field),e=t.order||"ascending";return e.signal?lt(this.add(DC({fields:n,orders:this.signalRef(e.signal)}))):wC(n,e)},event(t,n){const e=t+":"+n;if(!this.events[e]){const r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},hasOwnSignal(t){return tt(this.signals,t)},addSignal(t,n){this.hasOwnSignal(t)&&j("Duplicate signal name: "+G(t));const e=n instanceof Z1?n:this.add(xd(n));return this.signals[t]=e},getSignal(t){return this.signals[t]||j("Unrecognized signal name: "+G(t)),this.signals[t]},signalRef(t){return this.signals[t]?lt(this.signals[t]):(tt(this.lambdas,t)||(this.lambdas[t]=this.add(xd(null))),lt(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let n=0,e=t.length;ne+Math.floor(i*Ne()),pdf:o=>o===Math.floor(o)&&o>=e&&o=r?1:(s-e+1)/i},icdf:o=>o>=0&&o<=1?e-1+Math.floor(o*i):NaN};return a.min(t).max(n)},randomKDE:Cp,randomLCG:function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},randomLogNormal:d2,randomMixture:h2,randomNormal:Fp,randomUniform:p2,read:tx,regressionConstant:Rp,regressionExp:g2,regressionLinear:Tp,regressionLoess:b2,regressionLog:m2,regressionPoly:v2,regressionPow:y2,regressionQuad:Pp,renderModule:ef,repeat:I6,resetDefaultLocale:W6,resetSVGClipId:Iw,resetSVGDefIds:function(){Iw(),Mw=0},responseType:Zb,runtimeContext:LF,sampleCurve:fc,sampleLogNormal:Ep,sampleNormal:sc,sampleUniform:Bp,scale:Dt,sceneEqual:C0,sceneFromJSON:mA,scenePickVisit:Oc,sceneToJSON:pA,sceneVisit:Qe,sceneZOrder:Qm,scheme:zm,serializeXML:LA,setHybridRendererOptions:function(t){Ze.svgMarkTypes=t.svgMarkTypes??["text"],Ze.svgOnTop=t.svgOnTop??!0,Ze.debug=t.debug??!1},setRandom:function(t){Ne=t},span:Gl,splitAccessPath:Ni,stringValue:G,textMetrics:we,timeBin:nx,timeFloor:ix,timeFormatLocale:H6,timeInterval:np,timeOffset:Dx,timeSequence:kx,timeUnitSpecifier:_x,timeUnits:ex,toBoolean:zx,toDate:Ox,toNumber:ze,toSet:Dr,toString:Bx,transform:o2,transforms:So,truncate:Ex,truthy:Be,tupleid:st,typeParsers:G6,utcFloor:rx,utcInterval:tp,utcOffset:Cx,utcSequence:Fx,utcdayofyear:yx,utcquarter:wx,utcweek:bx,version:"5.33.0",visitArray:ka,week:xx,writeConfig:lp,zero:ip,zoomLinear:sp,zoomLog:ap,zoomPow:Vl,zoomSymlog:op},Symbol.toStringTag,{value:"Module"}));function xy(t){return U(t,"or")}function wy(t){return U(t,"and")}function Ay(t){return U(t,"not")}function Bd(t,n){if(Ay(t))Bd(t.not,n);else if(wy(t))for(const e of t.and)Bd(e,n);else if(xy(t))for(const e of t.or)Bd(e,n);else n(t)}function ds(t,n){return Ay(t)?{not:ds(t.not,n)}:wy(t)?{and:t.and.map(e=>ds(e,n))}:xy(t)?{or:t.or.map(e=>ds(e,n))}:n(t)}const ft=structuredClone;function sE(t){throw new Error(t)}function hs(t,n){const e={};for(const r of n)tt(t,r)&&(e[r]=t[r]);return e}function he(t,n){const e={...t};for(const r of n)delete e[r];return e}function wt(t){if($t(t))return t;const n=Q(t)?t:Lt(t);if(n.length<250)return n;let e=0;for(let r=0;ro===0?a:`[${a}]`),i=r.map((a,o)=>r.slice(0,o+1).join(""));for(const a of i)n.add(a)}return n}function Cy(t,n){return t===void 0||n===void 0||Dy(Fy(t),Fy(n))}function jt(t){return q(t).length===0}Set.prototype.toJSON=function(){return`Set(${[...this].map(t=>Lt(t)).join(",")})`};const q=Object.keys,En=Object.values,sa=Object.entries;function cl(t){return t===!0||t===!1}function Xt(t){const n=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+n}function fl(t,n){return Ay(t)?`!(${fl(t.not,n)})`:wy(t)?`(${t.and.map(e=>fl(e,n)).join(") && (")})`:xy(t)?`(${t.or.map(e=>fl(e,n)).join(") || (")})`:n(t)}function zd(t,n){if(n.length===0)return!0;const e=n.shift();return e in t&&zd(t[e],n)&&delete t[e],jt(t)}function dl(t){return t.charAt(0).toUpperCase()+t.substr(1)}function Ey(t,n="datum"){const e=Ni(t),r=[];for(let i=1;i<=e.length;i++){const a=`[${e.slice(0,i).map(G).join("][")}]`;r.push(`${n}${a}`)}return r.join(" && ")}function cE(t,n="datum"){return`${n}[${G(Ni(t).join("."))}]`}function Ot(t){return`datum['${t.replaceAll("'","\\'")}']`}function sN(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function He(t){return`${Ni(t).map(sN).join("\\.")}`}function to(t,n,e){return t.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),e)}function ms(t){return`${Ni(t).join(".")}`}function gs(t){return t?Ni(t).length:0}function un(...t){return t.find(n=>n!==void 0)}let fE=42;function dE(t){const n=++fE;return t?String(t)+n:n}function uN(){fE=42}function hE(t){return pE(t)?t:`__${t}`}function pE(t){return t.startsWith("__")}function hl(t){if(t!==void 0)return(t%360+360)%360}function Od(t){return!!$t(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const mE=Object.getPrototypeOf(structuredClone({}));function Ce(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor.name!==n.constructor.name)return!1;let e,r;if(Array.isArray(t)){if(e=t.length,e!=n.length)return!1;for(r=e;r--!==0;)if(!Ce(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const a of t.entries())if(!n.has(a[0]))return!1;for(const a of t.entries())if(!Ce(a[1],n.get(a[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const a of t.entries())if(!n.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(e=t.length,e!=n.length)return!1;for(r=e;r--!==0;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf&&t.valueOf!==mE.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString&&t.toString!==mE.toString)return t.toString()===n.toString();const i=Object.keys(t);if(e=i.length,e!==Object.keys(n).length)return!1;for(r=e;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=e;r--!==0;){const a=i[r];if(!Ce(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}function Lt(t){const n=[];return function e(r){if(r&&r.toJSON&&typeof r.toJSON=="function"&&(r=r.toJSON()),r===void 0)return;if(typeof r=="number")return isFinite(r)?""+r:"null";if(typeof r!="object")return JSON.stringify(r);let i,a;if(Array.isArray(r)){for(a="[",i=0;iId(t[n])?Xt(`_${n}_${sa(t[n])}`):Xt(`_${n}_${t[n]}`)).join("")}function Wt(t){return t===!0||io(t)&&!t.binned}function $n(t){return t==="binned"||io(t)&&t.binned===!0}function io(t){return Z(t)}function Id(t){return U(t,"param")}function SE(t){switch(t){case mi:case gi:case bi:case pe:case Lr:case qr:case da:case xi:case ca:case fa:case me:return 6;case ha:return 4;default:return 10}}function yl(t){return U(t,"expr")}function Sn(t,{level:n}={level:0}){const e=q(t||{}),r={};for(const i of e)r[i]=n===0?Ee(t[i]):Sn(t[i],{level:n-1});return r}function ME(t){const{anchor:n,frame:e,offset:r,orient:i,angle:a,limit:o,color:s,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=t,g={...n?{anchor:n}:{},...e?{frame:e}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a!==void 0?{angle:a}:{},...o!==void 0?{limit:o}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:hs(t,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function ga(t){return Q(t)||P(t)&&Q(t[0])}function it(t){return U(t,"signal")}function ao(t){return U(t,"step")}function _i(t){return!P(t)&&U(t,"field")&&U(t,"data")}const CN=q({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),EN={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},jy=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function BE(t){const n=P(t.condition)?t.condition.map(zE):zE(t.condition);return{...Ee(t),condition:n}}function Ee(t){if(yl(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function zE(t){if(yl(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Gt(t){if(yl(t)){const{expr:n,...e}=t;return{signal:n,...e}}return it(t)?t:t!==void 0?{value:t}:void 0}function $N(t){return it(t)?t.signal:G(t)}function OE(t){return it(t)?t.signal:G(t.value)}function pr(t){return it(t)?t.signal:t==null?null:G(t)}function SN(t,n,e){for(const r of e){const i=Wr(r,n.markDef,n.config);i!==void 0&&(t[r]=Gt(i))}return t}function NE(t){return[].concat(t.type,t.style??[])}function qt(t,n,e,r={}){const{vgChannel:i,ignoreVgConfig:a}=r;return i&&U(n,i)?n[i]:n[t]!==void 0?n[t]:!a||i&&i!==t?Wr(t,n,e,r):void 0}function Wr(t,n,e,{vgChannel:r}={}){const i=Ly(t,n,e.style);return un(r?i:void 0,i,r?e[n.type][r]:void 0,e[n.type][t],r?e.mark[r]:e.mark[t])}function Ly(t,n,e){return RE(t,NE(n),e)}function RE(t,n,e){let r;n=K(n);for(const i of n){const a=e[i];U(a,t)&&(r=a[t])}return r}function TE(t,n){return K(t).reduce((e,r)=>(e.field.push(Y(r,n)),e.order.push(r.sort??"ascending"),e),{field:[],order:[]})}function PE(t,n){const e=[...t];return n.forEach(r=>{for(const i of e)if(Ce(i,r))return;e.push(r)}),e}function jE(t,n){return Ce(t,n)||!n?t:t?[...K(t),...K(n)].join(", "):n}function LE(t,n){const e=t.value,r=n.value;if(e==null||r===null)return{explicit:t.explicit,value:null};if((ga(e)||it(e))&&(ga(r)||it(r)))return{explicit:t.explicit,value:jE(e,r)};if(ga(e)||it(e))return{explicit:t.explicit,value:e};if(ga(r)||it(r))return{explicit:t.explicit,value:r};if(!(ga(e)||it(e)||ga(r)||it(r)))return{explicit:t.explicit,value:PE(e,r)};throw new Error("It should never reach here")}function qy(t){return`Invalid specification ${Lt(t)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const MN='Autosize "fit" only works for single views and layered views.';function qE(t){return`${t=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function UE(t){return`${t=="width"?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${t=="width"?"x":"y"}".`}function IE(t){return t?`Dropping "fit-${t}" because spec has discrete ${ge(t)}.`:'Dropping "fit" because spec has discrete size.'}function Uy(t){return`Unknown field for ${t}. Cannot calculate view size.`}function WE(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`}function BN(t,n){return`Cannot project a selection on encoding channel "${t}" as it uses an aggregate function ("${n}").`}function HE(t){return`Selection not supported for ${t} yet.`}const zN="The same selection must be used to override scale domains in a layered view.";function GE(t){return`The "columns" property cannot be used when "${t}" has nested row/column.`}const Iy="Animation involving facet, layer, or concat is currently unsupported.";function VE(t,n,e){return`An ancestor parsed field "${t}" as ${e} but a child wants to parse the field as ${n}.`}function ON(t){return`Ignoring an invalid transform: ${Lt(t)}.`}function YE(t){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${t} are dropped.`}function NN(t){return`${t}Offset dropped because ${t} is continuous`}function XE(t){return`Invalid field type "${t}".`}function JE(t,n){const{fill:e,stroke:r}=n;return`Dropping color ${t} as the plot also has ${e&&r?"fill and stroke":e?"fill":"stroke"}.`}function Wy(t,n){return`Dropping ${Lt(t)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}function Wd(t,n,e){return`${t} dropped as it is incompatible with "${n}".`}function RN(t){return`${t}-encoding is dropped as ${t} is not a valid encoding channel.`}function TN(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`}function PN(t){return`${t} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Hy(t,n){return`Using discrete channel "${t}" to encode "${n}" field can be misleading as it does not encode ${n==="ordinal"?"order":"magnitude"}.`}function jN(t){return`Using unaggregated domain with raw field has no effect (${Lt(t)}).`}function LN(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`}function qN(t){return`Unaggregated domain is currently unsupported for log scale (${Lt(t)}).`}function KE(t,n,e){return`${e}-scale's "${n}" is dropped as it does not work with ${t} scale.`}function QE(t){return`The step for "${t}" is dropped because the ${t==="width"?"x":"y"} is continuous.`}const ZE="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Hd(t,n){return`Invalid ${t}: ${Lt(n)}.`}function t3(t){return`1D error band does not support ${t}.`}function n3(t){return`Channel ${t} is required for "binned" bin.`}const e3=Kh(Rx);let vl=e3;function Gy(...t){vl.error(...t)}function I(...t){vl.warn(...t)}function oo(t){if(t&&Z(t)){for(const n of Yy)if(U(t,n))return!0}return!1}const r3=["january","february","march","april","may","june","july","august","september","october","november","december"],UN=r3.map(t=>t.substr(0,3)),i3=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],IN=i3.map(t=>t.substr(0,3));function Vy(t,n){const e=[];if(n&&t.day!==void 0&&q(t).length>1&&(I(function(r){return`Dropping day from datetime ${Lt(r)} as day cannot be combined with other units.`}(t)),delete(t=ft(t)).day),t.year!==void 0?e.push(t.year):e.push(2012),t.month!==void 0){const r=n?function(i){if(Od(i)&&(i=+i),$t(i))return i-1;{const a=i.toLowerCase(),o=r3.indexOf(a);if(o!==-1)return o;const s=a.substr(0,3),u=UN.indexOf(s);if(u!==-1)return u;throw new Error(Hd("month",i))}}(t.month):t.month;e.push(r)}else if(t.quarter!==void 0){const r=n?function(i){if(Od(i)&&(i=+i),$t(i))return i>4&&I(Hd("quarter",i)),i-1;throw new Error(Hd("quarter",i))}(t.quarter):t.quarter;e.push($t(r)?3*r:`${r}*3`)}else e.push(0);if(t.date!==void 0)e.push(t.date);else if(t.day!==void 0){const r=n?function(i){if(Od(i)&&(i=+i),$t(i))return i%7;{const a=i.toLowerCase(),o=i3.indexOf(a);if(o!==-1)return o;const s=a.substr(0,3),u=IN.indexOf(s);if(u!==-1)return u;throw new Error(Hd("day",i))}}(t.day):t.day;e.push($t(r)?r+1:`${r}+1`)}else e.push(1);for(const r of["hours","minutes","seconds","milliseconds"]){const i=t[r];e.push(i===void 0?0:i)}return e}function so(t){const n=Vy(t,!0).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}const a3={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Yy=q(a3);function uo(t){return Z(t)?t.binned:o3(t)}function o3(t){return t&&t.startsWith("binned")}function Xy(t){return t.startsWith("utc")}const WN={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Gd(t){return Yy.filter(n=>u3(t,n))}function s3(t){const n=Gd(t);return n[n.length-1]}function u3(t,n){const e=t.indexOf(n);return!(e<0)&&!(e>0&&n==="seconds"&&t.charAt(e-1)==="i")&&!(t.length>e+3&&n==="day"&&t.charAt(e+3)==="o")&&!(e>0&&n==="year"&&t.charAt(e-1)==="f")}function HN(t,n,{end:e}={end:!1}){const r=Ey(n),i=Xy(t)?"utc":"";function a(u){return u==="quarter"?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`}let o;const s={};for(const u of Yy)u3(t,u)&&(s[u]=a(u),o=u);return e&&(s[o]+="+1"),function(u){const l=Vy(u,!1).join(", ");return u.utc?`utc(${l})`:`datetime(${l})`}(s)}function l3(t){if(t)return`timeUnitSpecifier(${Lt(Gd(t))}, ${Lt(WN)})`}function xn(t){if(!t)return;let n;return Q(t)?n=o3(t)?{unit:t.substring(6),binned:!0}:{unit:t}:Z(t)&&(n={...t,...t.unit?{unit:t.unit}:{}}),Xy(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function c3(t,n=e=>e){const e=xn(t),r=s3(e.unit);if(r&&r!=="day"){const i={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:a,part:o}=f3(r,e.step);return`${n(so({...i,[o]:+i[o]+a}))} - ${n(so(i))}`}}const GN={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function f3(t,n=1){if(function(e){return tt(GN,e)}(t))return{part:t,step:n};switch(t){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function Jy(t){return!!(t!=null&&t.field)&&t.equal!==void 0}function Ky(t){return!!(t!=null&&t.field)&&t.lt!==void 0}function Qy(t){return!!(t!=null&&t.field)&&t.lte!==void 0}function Zy(t){return!!(t!=null&&t.field)&&t.gt!==void 0}function tv(t){return!!(t!=null&&t.field)&&t.gte!==void 0}function nv(t){return!!(t!=null&&t.field&&(P(t.range)&&t.range.length===2||it(t.range)))}function ev(t){return!!(t!=null&&t.field)&&(P(t.oneOf)||P(t.in))}function d3(t){return ev(t)||Jy(t)||nv(t)||Ky(t)||Zy(t)||Qy(t)||tv(t)}function Hr(t,n){return lh(t,{timeUnit:n,wrapTime:!0})}function h3(t,n=!0){const{field:e}=t,r=xn(t.timeUnit),{unit:i,binned:a}=r||{},o=Y(t,{expr:"datum"}),s=i?`time(${a?o:HN(i,e)})`:o;if(Jy(t))return`${s}===${Hr(t.equal,i)}`;if(Ky(t))return`${s}<${Hr(t.lt,i)}`;if(Zy(t))return`${s}>${Hr(t.gt,i)}`;if(Qy(t))return`${s}<=${Hr(t.lte,i)}`;if(tv(t))return`${s}>=${Hr(t.gte,i)}`;if(ev(t))return`indexof([${function(u,l){return u.map(c=>Hr(c,l))}(t.oneOf,i).join(",")}], ${s}) !== -1`;if(function(u){return!!(u!=null&&u.field)&&u.valid!==void 0}(t))return Vd(s,t.valid);if(nv(t)){const{range:u}=Sn(t),l=it(u)?{signal:`${u.signal}[0]`}:u[0],c=it(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&n)return"inrange("+s+", ["+Hr(l,i)+", "+Hr(c,i)+"])";const f=[];return l!==null&&f.push(`${s} >= ${Hr(l,i)}`),c!==null&&f.push(`${s} <= ${Hr(c,i)}`),f.length>0?f.join(" && "):"true"}throw new Error(`Invalid field predicate: ${Lt(t)}`)}function Vd(t,n=!0){return n?`isValid(${t}) && isFinite(+${t})`:`!isValid(${t}) || !isFinite(+${t})`}function VN(t){return d3(t)&&t.timeUnit?{...t,timeUnit:xn(t.timeUnit)}:t}function YN(t){return t==="quantitative"||t==="temporal"}function p3(t){return t==="ordinal"||t==="nominal"}const lo="quantitative",rv="ordinal",xs="temporal",iv="nominal",ws="geojson",m3="linear",XN="log",JN="pow",KN="sqrt",av="time",Yd="utc",g3="point",ov="band",sv={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function QN(t,n){const e=sv[t],r=sv[n];return e===r||e==="ordinal-position"&&r==="time"||r==="ordinal-position"&&e==="time"}const ZN={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function y3(t){return ZN[t]}const v3=new Set(["linear","log","pow","sqrt","symlog"]),b3=new Set([...v3,"time","utc"]);function x3(t){return v3.has(t)}const w3=new Set(["quantile","quantize","threshold"]),tR=new Set([...b3,...w3,"sequential","identity"]),nR=new Set(["ordinal","bin-ordinal","point","band"]);function wn(t){return nR.has(t)}function mr(t){return tR.has(t)}function Gr(t){return b3.has(t)}function As(t){return w3.has(t)}function A3(t){return U(t,"param")}const{type:Gj,domain:Vj,range:Yj,rangeMax:Xj,rangeMin:Jj,scheme:Kj,...eR}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},rR=q(eR);function uv(t,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(t);case"bins":return!["point","band","identity","ordinal"].includes(t);case"round":return Gr(t)||t==="band"||t==="point";case"padding":case"rangeMin":case"rangeMax":return Gr(t)||["point","band"].includes(t);case"paddingOuter":case"align":return["point","band"].includes(t);case"paddingInner":return t==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Gr(t);case"nice":return Gr(t)||t==="quantize"||t==="threshold";case"exponent":return t==="pow";case"base":return t==="log";case"constant":return t==="symlog";case"zero":return mr(t)&&!vt(["log","time","utc","threshold","quantile"],t)}}function _3(t,n){switch(n){case"interpolate":case"scheme":case"domainMid":return bs(t)?void 0:`Cannot use the scale property "${n}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const jn={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},k3=jn.arc,Xd=jn.area,Jd=jn.bar,iR=jn.image,Kd=jn.line,Qd=jn.point,aR=jn.rect,Zd=jn.rule,D3=jn.text,lv=jn.tick,oR=jn.trail,cv=jn.circle,fv=jn.square,F3=jn.geoshape;function ya(t){return["line","area","trail"].includes(t)}function bl(t){return["rect","bar","image","arc","tick"].includes(t)}const sR=new Set(q(jn));function Vr(t){return U(t,"type")}const uR=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],C3=q({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),dv=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],lR={area:["line","point"],bar:dv,rect:dv,line:["point"],tick:["bandSize","thickness",...dv]},E3=q({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function co(t){return U(t,"band")}const cR={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},hv={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},fR={...hv,binSpacing:1},dR={...hv,thickness:1};function $3(t,{isPath:n}){return t===void 0||t==="break-paths-show-path-domains"?n?"break-paths-show-domains":"filter":t===null?"show":t}function pv({markDef:t,config:n,scaleChannel:e,scaleType:r,isCountAggregate:i}){var s,u;if(!r||!mr(r)||i)return"always-valid";const a=$3(qt("invalid",t,n),{isPath:ya(t.type)});return((u=(s=n.scale)==null?void 0:s.invalid)==null?void 0:u[e])!==void 0?"show":a}function S3({scaleName:t,scale:n,mode:e}){const r=`domain('${t}')`;if(!n||!t)return;const i=`${r}[0]`,a=`peek(${r})`,o=n.domainHasZero();return o==="definitely"?{scale:t,value:0}:o==="maybe"?{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${e==="zeroOrMin"?i:a})`}:{signal:`scale('${t}', ${e==="zeroOrMin"?i:a})`}}function M3({scaleChannel:t,channelDef:n,scale:e,scaleName:r,markDef:i,config:a}){var l;const o=e==null?void 0:e.get("type"),s=vr(n),u=pv({scaleChannel:t,markDef:i,config:a,scaleType:o,isCountAggregate:Ud(s==null?void 0:s.aggregate)});if(s&&u==="show"){const c=((l=a.scale.invalid)==null?void 0:l[t])??"zero-or-min";return{test:Vd(Y(s,{expr:"datum"}),!1),...hR(c,e,r)}}}function hR(t,n,e){if(Z(r=t)&&"value"in r){const{value:i}=t;return it(i)?{signal:i.signal}:{value:i}}var r;return S3({scale:n,scaleName:e,mode:"zeroOrMin"})}function mv(t){const{channel:n,channelDef:e,markDef:r,scale:i,scaleName:a,config:o}=t,s=ro(n),u=gv(t),l=M3({scaleChannel:s,channelDef:e,scale:i,scaleName:a,markDef:r,config:o});return l!==void 0?[l,u]:u}function fo(t,n,e,r){const i={};if(n&&(i.scale=n),Yr(t)){const{datum:a}=t;oo(a)?i.signal=so(a):it(a)?i.signal=a.signal:yl(a)?i.signal=a.expr:i.value=a}else i.field=Y(t,e);if(r){const{offset:a,band:o}=r;a&&(i.offset=a),o&&(i.band=o)}return i}function th({scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:e,offset:r,startSuffix:i,endSuffix:a="end",bandPosition:o=.5}){const s=!it(o)&&0Xt(`${h==="unit"?"":`_${h}_`}${d[h]}`)).join(""):(f?"utc":"")+"timeunit"+q(d).map(h=>Xt(`_${h}_${d[h]}`)).join("")}(l),i=(!["range","mid"].includes(n.binSuffix)&&n.binSuffix||"")+(n.suffix??""))}o&&(e=e?`${o}_${e}`:o)}return i&&(e=`${e}_${i}`),r&&(e=`${r}_${e}`),n.forAs?ms(e):n.expr?cE(e,n.expr)+a:He(e)+a}function ah(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return H(t)&&!!t.bin;case"temporal":return!1}throw new Error(XE(t.type))}const V3=(t,n)=>{switch(n.fieldTitle){case"plain":return t.field;case"functional":return function(e){const{aggregate:r,bin:i,timeUnit:a,field:o}=e;if(ma(r))return`${o} for argmax(${r.argmax})`;if(Ai(r))return`${o} for argmin(${r.argmin})`;const s=a&&!uo(a)?xn(a):void 0,u=r||(s==null?void 0:s.unit)||(s==null?void 0:s.maxbins)&&"timeunit"||Wt(i)&&"bin";return u?`${u.toUpperCase()}(${o})`:o}(t);default:return function(e,r){var u;const{field:i,bin:a,timeUnit:o,aggregate:s}=e;if(s==="count")return r.countTitle;if(Wt(a))return`${i} (binned)`;if(o&&!uo(o)){const l=(u=xn(o))==null?void 0:u.unit;if(l)return`${i} (${Gd(l).join("-")})`}else if(s)return ma(s)?`${i} for max ${s.argmax}`:Ai(s)?`${i} for min ${s.argmin}`:`${dl(s)} of ${i}`;return i}(t,n)}};let Y3=V3;function X3(t){Y3=t}function Ds(t,n,{allowDisabling:e,includeDefault:r=!0}){var s;const i=(s=wv(t))==null?void 0:s.title;if(!H(t))return i??t.title;const a=t,o=r?Av(a,n):void 0;return e?un(i,a.title,o):i??a.title??o}function wv(t){return ks(t)&&t.axis?t.axis:H3(t)&&t.legend?t.legend:bv(t)&&t.header?t.header:void 0}function Av(t,n){return Y3(t,n)}function oh(t){if(G3(t)){const{format:n,formatType:e}=t;return{format:n,formatType:e}}{const n=wv(t)??{},{format:e,formatType:r}=n;return{format:e,formatType:r}}}function vr(t){return H(t)?t:rh(t)?t.condition:void 0}function mn(t){return ht(t)?t:kl(t)?t.condition:void 0}function J3(t,n,e,r={}){return Q(t)||$t(t)||Fa(t)?(I(function(i,a,o){return`Channel ${i} is a ${a}. Converted to {value: ${Lt(o)}}.`}(n,Q(t)?"string":$t(t)?"number":"boolean",t)),{value:t}):ht(t)?sh(t,n,e,r):kl(t)?{...t,condition:sh(t.condition,n,e,r)}:t}function sh(t,n,e,r){if(G3(t)){const{format:i,formatType:a,...o}=t;if(ho(a)&&!e.customFormatTypes)return I(YE(n)),sh(o,n,e,r)}else{const i=ks(t)?"axis":H3(t)?"legend":bv(t)?"header":null;if(i&&t[i]){const{format:a,formatType:o,...s}=t[i];if(ho(o)&&!e.customFormatTypes)return I(YE(n)),sh({...t,[i]:s},n,e,r)}}return H(t)?_v(t,n,r):function(i){let a=i.type;if(a)return i;const{datum:o}=i;return a=$t(o)?"quantitative":Q(o)?"nominal":oo(o)?"temporal":void 0,{...i,type:a}}(t)}function _v(t,n,{compositeMark:e=!1}={}){const{aggregate:r,timeUnit:i,bin:a,field:o}=t,s={...t};if(e||!r||qd(r)||ma(r)||Ai(r)||(I(function(u){return`Invalid aggregation operator "${u}".`}(r)),delete s.aggregate),i&&(s.timeUnit=xn(i)),o&&(s.field=`${o}`),Wt(a)&&(s.bin=uh(a,n)),$n(a)&&!ln(n)&&I(function(u){return`Channel ${u} should not be used with "binned" bin.`}(n)),oe(s)){const{type:u}=s,l=function(c){if(c)switch(c=c.toLowerCase()){case"q":case lo:return"quantitative";case"t":case xs:return"temporal";case"o":case rv:return"ordinal";case"n":case iv:return"nominal";case ws:return"geojson"}}(u);u!==l&&(s.type=l),u!=="quantitative"&&Ud(r)&&(I(function(c,f){return`Invalid field type "${c}" for aggregate: "${f}", using "quantitative" instead.`}(u,r)),s.type="quantitative")}else if(!AE(n)){const u=function(l,c){var p;switch(c){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(xv(l)&&P(l.sort))return"ordinal";const{aggregate:f,bin:d,timeUnit:h}=l;if(h)return"temporal";if(d||f&&!ma(f)&&!Ai(f))return"quantitative";if(po(l)&&((p=l.scale)!=null&&p.type))switch(sv[l.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,n);s.type=u}if(oe(s)){const{compatible:u,warning:l}=function(c,f){const d=c.type;if(d==="geojson"&&f!=="shape")return{compatible:!1,warning:`Channel ${f} should not be used with a geojson data.`};switch(f){case mi:case gi:case Nd:return ah(c)?Fs:{compatible:!1,warning:TN(f)};case Jt:case bn:case ua:case ys:case pe:case Lr:case qr:case pl:case ml:case Rd:case eo:case Td:case Pd:case no:case Ge:case cr:case jd:return Fs;case dr:case Ve:case fr:case hr:return d!==lo?{compatible:!1,warning:`Channel ${f} should be used with a quantitative field only, not ${c.type} field.`}:Fs;case xi:case ca:case fa:case da:case bi:case vi:case yi:case lr:case jr:case la:return d!=="nominal"||c.sort?Fs:{compatible:!1,warning:`Channel ${f} should not be used with an unsorted discrete field.`};case me:case ha:return ah(c)||function(h){var p;return po(h)&&As((p=h.scale)==null?void 0:p.type)}(c)?Fs:{compatible:!1,warning:PN(f)};case vs:return c.type!=="nominal"||"sort"in c?Fs:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(s,n)||{};u===!1&&I(l)}if(xv(s)&&Q(s.sort)){const{sort:u}=s;if(P3(u))return{...s,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&P3(l))return{...s,sort:{encoding:l,order:"descending"}}}if(bv(s)){const{header:u}=s;if(u){const{orient:l,...c}=u;if(l)return{...s,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return s}function uh(t,n){return Fa(t)?{maxbins:SE(n)}:t==="binned"?{binned:!0}:t.maxbins||t.step?t:{...t,maxbins:SE(n)}}const Fs={compatible:!0};function Cs(t){const{formatType:n}=oh(t);return n==="time"||!n&&function(e){return e&&(e.type==="temporal"||H(e)&&!!e.timeUnit)}(t)}function lh(t,{timeUnit:n,type:e,wrapTime:r,undefinedIfExprNotRequired:i}){var u;const a=n&&((u=xn(n))==null?void 0:u.unit);let o,s=a||e==="temporal";return yl(t)?o=t.expr:it(t)?o=t.signal:oo(t)?(s=!0,o=so(t)):(Q(t)||$t(t))&&s&&(o=`datetime(${Lt(t)})`,function(l){return tt(a3,l)}(a)&&($t(t)&&t<1e4||Q(t)&&isNaN(Date.parse(t)))&&(o=so({[a]:t}))),o?r&&s?`time(${o})`:o:i?void 0:Lt(t)}function K3(t,n){const{type:e}=t;return n.map(r=>{const i=lh(r,{timeUnit:H(t)&&!uo(t.timeUnit)?t.timeUnit:void 0,type:e,undefinedIfExprNotRequired:!0});return i!==void 0?{signal:i}:r})}function Dl(t,n){return Wt(t.bin)?Ir(n)&&["ordinal","nominal"].includes(t.type):(console.warn("Only call this method for binned field defs."),!1)}const Q3={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Fl(t){return t==null?void 0:t.condition}const Z3=["domain","grid","labels","ticks","title"],gR={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},t$={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},yR={...t$,style:1,labelExpr:1,encoding:1};function n$(t){return tt(yR,t)}const e$=q({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function Di(t){return U(t,"mark")}class ch{constructor(n,e){this.name=n,this.run=e}hasMatchingType(n){return!!Di(n)&&function(e){return Vr(e)?e.type:e}(n.mark)===this.name}}function mo(t,n){const e=t&&t[n];return!!e&&(P(e)?ps(e,r=>!!r.field):H(e)||rh(e))}function r$(t,n){const e=t&&t[n];return!!e&&(P(e)?ps(e,r=>!!r.field):H(e)||Yr(e)||kl(e))}function i$(t,n){if(ln(n)){const e=t[n];if((H(e)||Yr(e))&&(p3(e.type)||H(e)&&e.timeUnit))return r$(t,By(n))}return!1}function a$(t){return ps(cN,n=>{if(mo(t,n)){const e=t[n];if(P(e))return ps(e,r=>!!r.aggregate);{const r=vr(e);return r&&!!r.aggregate}}return!1})}function o$(t,n){const e=[],r=[],i=[],a=[],o={};return kv(t,(s,u)=>{if(H(s)){const{field:l,aggregate:c,bin:f,timeUnit:d,...h}=s;if(c||d||f){const p=wv(s),m=p==null?void 0:p.title;let g=Y(s,{forAs:!0});const y={...m?[]:{title:Ds(s,n,{allowDisabling:!0})},...h,field:g};if(c){let v;if(ma(c)?(v="argmax",g=Y({op:"argmax",field:c.argmax},{forAs:!0}),y.field=`${g}.${l}`):Ai(c)?(v="argmin",g=Y({op:"argmin",field:c.argmin},{forAs:!0}),y.field=`${g}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(v=c),v){const x={op:v,as:g};l&&(x.field=l),a.push(x)}}else if(e.push(g),oe(s)&&Wt(f)){if(r.push({bin:f,field:l,as:g}),e.push(Y(s,{binSuffix:"end"})),Dl(s,u)&&e.push(Y(s,{binSuffix:"range"})),ln(u)){const v={field:`${g}_end`};o[`${u}2`]=v}y.bin="binned",AE(u)||(y.type=lo)}else if(d&&!uo(d)){i.push({timeUnit:d,field:l,as:g});const v=oe(s)&&s.type!==xs&&"time";v&&(u===pl||u===eo?y.formatType=v:function(x){return tt(zy,x)}(u)?y.legend={formatType:v,...y.legend}:ln(u)&&(y.axis={formatType:v,...y.axis}))}o[u]=y}else e.push(l),o[u]=t[u]}else o[u]=t[u]}),{bins:r,timeUnits:i,aggregate:a,groupby:e,encoding:o}}function vR(t,n,e){const r=xN(n,e);if(!r)return!1;if(r==="binned"){const i=t[n===lr?Jt:bn];return!!(H(i)&&H(t[n])&&$n(i.bin))}return!0}function fh(t,n){const e={};for(const r of q(t)){const i=J3(t[r],r,n,{compositeMark:!0});e[r]=i}return e}function kv(t,n,e){if(t)for(const r of q(t)){const i=t[r];if(P(i))for(const a of i)n.call(e,a,r);else n.call(e,i,r)}}function s$(t,n){return q(n).reduce((e,r)=>{switch(r){case Jt:case bn:case Td:case jd:case Pd:case lr:case jr:case ua:case ys:case Ge:case vi:case cr:case yi:case la:case fr:case dr:case hr:case Ve:case pl:case me:case no:case eo:return e;case vs:if(t==="line"||t==="trail")return e;case ml:case Rd:{const i=n[r];if(P(i)||H(i))for(const a of K(i))a.aggregate||e.push(Y(a,{}));return e}case bi:if(t==="trail")return e;case pe:case Lr:case qr:case xi:case ca:case fa:case ha:case da:{const i=vr(n[r]);return i&&!i.aggregate&&e.push(Y(i,{})),e}}},[])}function Dv(t,n,e,r=!0){if("tooltip"in e)return{tooltip:e.tooltip};const i=t.map(({fieldPrefix:o,titlePrefix:s})=>{const u=r?` of ${Fv(n)}`:"";return{field:o+n.field,type:n.type,title:it(s)?{signal:`${s}"${escape(u)}"`}:s+u}}),a=function(o){const s=[];for(const u of q(o))if(mo(o,u)){const l=o[u],c=K(l);for(const f of c)H(f)?s.push(f):rh(f)&&s.push(f.condition)}return s}(e).map(mR);return{tooltip:[...i,...Pr(a,wt)]}}function Fv(t){const{title:n,field:e}=t;return un(n,e)}function Cv(t,n,e,r,i){const{scale:a,axis:o}=e;return({partName:s,mark:u,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=Fv(e);return u$(t,s,i,{mark:u,encoding:{[n]:{field:`${l}_${e.field}`,type:e.type,...d!==void 0?{title:d}:{},...a!==void 0?{scale:a}:{},...o!==void 0?{axis:o}:{}},...Q(c)?{[`${n}2`]:{field:`${c}_${e.field}`}}:{},...r,...f}})}}function u$(t,n,e,r){const{clip:i,color:a,opacity:o}=t,s=t.type;return t[n]||t[n]===void 0&&e[n]?[{...r,mark:{...e[n],...i?{clip:i}:{},...a?{color:a}:{},...o?{opacity:o}:{},...Vr(r.mark)?r.mark:{type:r.mark},style:`${s}-${String(n)}`,...Fa(t[n])?{}:t[n]}}]:[]}function l$(t,n,e){const{encoding:r}=t,i=n==="vertical"?"y":"x",a=r[i],o=r[`${i}2`],s=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:dh(a,e),continuousAxisChannelDef2:dh(o,e),continuousAxisChannelDefError:dh(s,e),continuousAxisChannelDefError2:dh(u,e),continuousAxis:i}}function dh(t,n){if(t!=null&&t.aggregate){const{aggregate:e,...r}=t;return e!==n&&I(function(i,a){return`Continuous axis should not have customized aggregation function ${i}; ${a} already agregates the axis.`}(e,n)),r}return t}function c$(t,n){const{mark:e,encoding:r}=t,{x:i,y:a}=r;if(Vr(e)&&e.orient)return e.orient;if(ba(i)){if(ba(a)){const o=H(i)&&i.aggregate,s=H(a)&&a.aggregate;if(o||s!==n){if(s||o!==n){if(o===n&&s===n)throw new Error("Both x and y cannot have aggregate");return Cs(a)&&!Cs(i)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(ba(a))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}const hh="boxplot",bR=new ch(hh,d$);function f$(t){return $t(t)?"tukey":t}function d$(t,{config:n}){t={...t,encoding:fh(t.encoding,n)};const{mark:e,encoding:r,params:i,projection:a,...o}=t,s=Vr(e)?e:{type:e};i&&I(HE("boxplot"));const u=s.extent??n.boxplot.extent,l=qt("size",s,n),c=s.invalid,f=f$(u),{bins:d,timeUnits:h,transform:p,continuousAxisChannelDef:m,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:x,ticksOrient:b,boxOrient:w,customTooltipWithoutAggregatedField:A}=function(Je,Se,e6){const Xh=c$(Je,hh),{continuousAxisChannelDef:Hb,continuousAxis:Gb}=l$(Je,Xh,hh),Us=Hb.field,ue=ms(Us),Il=f$(Se),r6=[...h$(Us),{op:"median",field:Us,as:`mid_box_${ue}`},{op:"min",field:Us,as:(Il==="min-max"?"lower_whisker_":"min_")+ue},{op:"max",field:Us,as:(Il==="min-max"?"upper_whisker_":"max_")+ue}],i6=Il==="min-max"||Il==="tukey"?[]:[{calculate:`${Ot(`upper_box_${ue}`)} - ${Ot(`lower_box_${ue}`)}`,as:`iqr_${ue}`},{calculate:`min(${Ot(`upper_box_${ue}`)} + ${Ot(`iqr_${ue}`)} * ${Se}, ${Ot(`max_${ue}`)})`,as:`upper_whisker_${ue}`},{calculate:`max(${Ot(`lower_box_${ue}`)} - ${Ot(`iqr_${ue}`)} * ${Se}, ${Ot(`min_${ue}`)})`,as:`lower_whisker_${ue}`}],{[Gb]:aj,...a6}=Je.encoding,{customTooltipWithoutAggregatedField:o6,filteredEncoding:s6}=function(d6){const{tooltip:ko,...Wl}=d6;if(!ko)return{filteredEncoding:Wl};let Is,ni;if(P(ko)){for(const Jh of ko)Jh.aggregate?(Is||(Is=[]),Is.push(Jh)):(ni||(ni=[]),ni.push(Jh));Is&&(Wl.tooltip=Is)}else ko.aggregate?Wl.tooltip=ko:ni=ko;return P(ni)&&ni.length===1&&(ni=ni[0]),{customTooltipWithoutAggregatedField:ni,filteredEncoding:Wl}}(a6),{bins:Vb,timeUnits:Yb,aggregate:Xb,groupby:Jb,encoding:u6}=o$(s6,e6),l6=Xh==="vertical"?"horizontal":"vertical",c6=Xh,f6=[...Vb,...Yb,{aggregate:[...Xb,...r6],groupby:Jb},...i6];return{bins:Vb,timeUnits:Yb,transform:f6,groupby:Jb,aggregate:Xb,continuousAxisChannelDef:Hb,continuousAxis:Gb,encodingWithoutContinuousAxis:u6,ticksOrient:l6,boxOrient:c6,customTooltipWithoutAggregatedField:o6}}(t,u,n),_=ms(m.field),{color:k,size:F,...C}=x,D=Je=>Cv(s,g,m,Je,n.boxplot),E=D(C),$=D(x),M=(Z(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",S=D({...C,...F?{size:F}:{},color:{condition:{test:`${Ot(`lower_box_${m.field}`)} >= ${Ot(`upper_box_${m.field}`)}`,...k||{value:M}}}}),B=Dv([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],m,x),z={type:"tick",color:"black",opacity:1,orient:b,invalid:c,aria:!1},N=f==="min-max"?B:Dv([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,x),W=[...E({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...E({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...E({partName:"ticks",mark:z,positionPrefix:"lower_whisker",extraEncoding:N}),...E({partName:"ticks",mark:z,positionPrefix:"upper_whisker",extraEncoding:N})],X=[...f!=="tukey"?W:[],...$({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:w,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:B}),...S({partName:"median",mark:{type:"tick",invalid:c,...Z(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...l?{size:l}:{},orient:b,aria:!1},positionPrefix:"mid_box",extraEncoding:B})];if(f==="min-max")return{...o,transform:(o.transform??[]).concat(p),layer:X};const L=Ot(`lower_box_${m.field}`),et=Ot(`upper_box_${m.field}`),ot=`(${et} - ${L})`,nt=`${L} - ${u} * ${ot}`,mt=`${et} + ${u} * ${ot}`,pt=Ot(m.field),J={joinaggregate:h$(m.field),groupby:y},Mt={transform:[{filter:`(${nt} <= ${pt}) && (${pt} <= ${mt})`},{aggregate:[{op:"min",field:m.field,as:`lower_whisker_${_}`},{op:"max",field:m.field,as:`upper_whisker_${_}`},{op:"min",field:`lower_box_${m.field}`,as:`lower_box_${_}`},{op:"max",field:`upper_box_${m.field}`,as:`upper_box_${_}`},...v],groupby:y}],layer:W},{tooltip:Tt,...kt}=C,{scale:Et,axis:tn}=m,nn=Fv(m),It=he(tn,["title"]),be=u$(s,"outliers",n.boxplot,{transform:[{filter:`(${pt} < ${nt}) || (${pt} > ${mt})`}],mark:"point",encoding:{[g]:{field:m.field,type:m.type,...nn!==void 0?{title:nn}:{},...Et!==void 0?{scale:Et}:{},...jt(It)?{}:{axis:It}},...kt,...k?{color:k}:{},...A?{tooltip:A}:{}}})[0];let zn;const ti=[...d,...h,J];return be?zn={transform:ti,layer:[be,Mt]}:(zn=Mt,zn.transform.unshift(...ti)),{...o,layer:[zn,{transform:p,layer:X}]}}function h$(t){const n=ms(t);return[{op:"q1",field:t,as:`lower_box_${n}`},{op:"q3",field:t,as:`upper_box_${n}`}]}const Ev="errorbar",xR=new ch(Ev,p$);function p$(t,{config:n}){t={...t,encoding:fh(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:o,markDef:s,outerSpec:u,tooltipEncoding:l}=m$(t,Ev,n);delete a.size;const c=Cv(s,i,r,a,n.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:o,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:e,...p.length>1?{layer:p}:{...p[0]}}}function wR(t,n){const{encoding:e}=t;if(function(s){return(ht(s.x)||ht(s.y))&&!ht(s.x2)&&!ht(s.y2)&&!ht(s.xError)&&!ht(s.xError2)&&!ht(s.yError)&&!ht(s.yError2)}(e))return{orient:c$(t,n),inputType:"raw"};const r=function(s){return ht(s.x2)||ht(s.y2)}(e),i=function(s){return ht(s.xError)||ht(s.xError2)||ht(s.yError)||ht(s.yError2)}(e),a=e.x,o=e.y;if(r){if(i)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const s=e.x2,u=e.y2;if(ht(s)&&ht(u))throw new Error(`${n} cannot have both x2 and y2`);if(ht(s)){if(ba(a))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}if(ht(u)){if(ba(o))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}{const s=e.xError,u=e.xError2,l=e.yError,c=e.yError2;if(ht(u)&&!ht(s))throw new Error(`${n} cannot have xError2 without xError`);if(ht(c)&&!ht(l))throw new Error(`${n} cannot have yError2 without yError`);if(ht(s)&&ht(l))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(ht(s)){if(ba(a))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(ht(l)){if(ba(o))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function m$(t,n,e){const{mark:r,encoding:i,params:a,projection:o,...s}=t,u=Vr(r)?r:{type:r};a&&I(HE(n));const{orient:l,inputType:c}=wR(t,n),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=l$(t,l,n),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:x}=function(z,N,W,X,L,et,ot,nt){let mt=[],pt=[];const J=N.field;let Mt,Tt=!1;if(et==="raw"){const kt=z.center?z.center:z.extent?z.extent==="iqr"?"median":"mean":nt.errorbar.center,Et=z.extent?z.extent:kt==="mean"?"stderr":"iqr";if(kt==="median"!=(Et==="iqr")&&I(function(tn,nn,It){return`${tn} is not usually used with ${nn} for ${It}.`}(kt,Et,ot)),Et==="stderr"||Et==="stdev")mt=[{op:Et,field:J,as:`extent_${J}`},{op:kt,field:J,as:`center_${J}`}],pt=[{calculate:`${Ot(`center_${J}`)} + ${Ot(`extent_${J}`)}`,as:`upper_${J}`},{calculate:`${Ot(`center_${J}`)} - ${Ot(`extent_${J}`)}`,as:`lower_${J}`}],Mt=[{fieldPrefix:"center_",titlePrefix:dl(kt)},{fieldPrefix:"upper_",titlePrefix:g$(kt,Et,"+")},{fieldPrefix:"lower_",titlePrefix:g$(kt,Et,"-")}],Tt=!0;else{let tn,nn,It;Et==="ci"?(tn="mean",nn="ci0",It="ci1"):(tn="median",nn="q1",It="q3"),mt=[{op:nn,field:J,as:`lower_${J}`},{op:It,field:J,as:`upper_${J}`},{op:tn,field:J,as:`center_${J}`}],Mt=[{fieldPrefix:"upper_",titlePrefix:Ds({field:J,aggregate:It,type:"quantitative"},nt,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Ds({field:J,aggregate:nn,type:"quantitative"},nt,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Ds({field:J,aggregate:tn,type:"quantitative"},nt,{allowDisabling:!1})}]}}else{(z.center||z.extent)&&I(function(kt,Et){return`${Et?"extent ":""}${Et&&kt?"and ":""}${kt?"center ":""}${Et&&kt?"are ":"is "}not needed when data are aggregated.`}(z.center,z.extent)),et==="aggregated-upper-lower"?(Mt=[],pt=[{calculate:Ot(W.field),as:`upper_${J}`},{calculate:Ot(J),as:`lower_${J}`}]):et==="aggregated-error"&&(Mt=[{fieldPrefix:"",titlePrefix:J}],pt=[{calculate:`${Ot(J)} + ${Ot(X.field)}`,as:`upper_${J}`}],L?pt.push({calculate:`${Ot(J)} + ${Ot(L.field)}`,as:`lower_${J}`}):pt.push({calculate:`${Ot(J)} - ${Ot(X.field)}`,as:`lower_${J}`}));for(const kt of pt)Mt.push({fieldPrefix:kt.as.substring(0,6),titlePrefix:to(to(kt.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:pt,errorBarSpecificAggregate:mt,tooltipSummary:Mt,tooltipTitleWithFieldName:Tt}}(u,f,d,h,p,c,n,e),{[m]:b,[m==="x"?"x2":"y2"]:w,[m==="x"?"xError":"yError"]:A,[m==="x"?"xError2":"yError2"]:_,...k}=i,{bins:F,timeUnits:C,aggregate:D,groupby:E,encoding:$}=o$(k,e),M=[...D,...g],S=c!=="raw"?[]:E,B=Dv(v,f,$,x);return{transform:[...s.transform??[],...F,...C,...M.length===0?[]:[{aggregate:M,groupby:S}],...y],groupby:S,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:$,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:s,tooltipEncoding:B}}function g$(t,n,e){return`${dl(t)} ${e} ${n}`}const $v="errorband",AR=new ch($v,y$);function y$(t,{config:n}){t={...t,encoding:fh(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:o,outerSpec:s,tooltipEncoding:u}=m$(t,$v,n),l=o,c=Cv(l,i,r,a,n.errorband),f=t.encoding.x!==void 0&&t.encoding.y!==void 0;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):l.interpolate?I(t3("interpolate")):l.tension&&I(t3("tension")),{...s,transform:e,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const v$={};function Sv(t,n,e){const r=new ch(t,n);v$[t]={normalizer:r,parts:e}}Sv(hh,d$,["box","median","outliers","rule","ticks"]),Sv(Ev,p$,["ticks","rule"]),Sv($v,y$,["band","borders"]);const _R=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],b$={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},x$={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},kR=q(b$),DR=q(x$),w$=q({header:1,headerRow:1,headerColumn:1,headerFacet:1}),A$=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],br="_vgsid_",FR={point:{on:"click",fields:[br],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Mv(t){return t==="legend"||!!(t!=null&&t.legend)}function Bv(t){return Mv(t)&&Z(t)}function zv(t){return!!(t!=null&&t.select)}function _$(t){const n=[];for(const e of t||[]){if(zv(e))continue;const{expr:r,bind:i,...a}=e;if(i&&r){const o={...a,bind:i,init:r};n.push(o)}else{const o={...a,...r?{update:r}:{},...i?{bind:i}:{}};n.push(o)}}return n}function Ov(t){return U(t,"concat")}function ph(t){return U(t,"vconcat")}function Nv(t){return U(t,"hconcat")}function k$({step:t,offsetIsDiscrete:n}){return n?t.for??"offset":"position"}function Xr(t){return U(t,"step")}function D$(t){return U(t,"view")||U(t,"width")||U(t,"height")}const CR=q({align:1,bounds:1,center:1,columns:1,spacing:1});function Rv(t,n){return t[n]??t[n==="width"?"continuousWidth":"continuousHeight"]}function Tv(t,n){const e=mh(t,n);return Xr(e)?e.step:F$}function mh(t,n){return un(t[n]??t[n==="width"?"discreteWidth":"discreteHeight"],{step:t.step})}const F$=20,ER={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:F$},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:fR,circle:{},geoshape:{},image:{},line:{},point:{},rect:hv,rule:{color:"black"},square:{},text:{color:"black"},tick:dR,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:FR,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Fi=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],C$={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},E$={blue:Fi[0],orange:Fi[1],red:Fi[2],teal:Fi[3],green:Fi[4],yellow:Fi[5],purple:Fi[6],pink:Fi[7],brown:Fi[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function $$(t){const n=q(t||{}),e={};for(const r of n){const i=t[r];e[r]=Fl(i)?BE(i):Ee(i)}return e}const $R=[...E3,...e$,...w$,"background","padding","legend","lineBreak","scale","style","title","view"];function S$(t={}){const{color:n,font:e,fontSize:r,selection:i,...a}=t,o=Yl({},ft(ER),e?function(u){return{text:{font:u},style:{"guide-label":{font:u},"guide-title":{font:u},"group-title":{font:u},"group-subtitle":{font:u}}}}(e):{},n?function(u={}){return{signals:[{name:"color",value:Z(u)?{...E$,...u}:E$}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(n):{},r?function(u){return{signals:[{name:"fontSize",value:Z(u)?{...C$,...u}:C$}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(r):{},a||{});i&&lp(o,"selection",i,!0);const s=he(o,$R);for(const u of["background","lineBreak","padding"])o[u]&&(s[u]=Ee(o[u]));for(const u of E3)o[u]&&(s[u]=Sn(o[u]));for(const u of e$)o[u]&&(s[u]=$$(o[u]));for(const u of w$)o[u]&&(s[u]=Sn(o[u]));if(o.legend&&(s.legend=Sn(o.legend)),o.scale){const{invalid:u,...l}=o.scale,c=Sn(u,{level:1});s.scale={...Sn(l),...q(c).length>0?{invalid:c}:{}}}return o.style&&(s.style=function(u){const l=q(u),c={};for(const f of l)c[f]=$$(u[f]);return c}(o.style)),o.title&&(s.title=Sn(o.title)),o.view&&(s.view=Sn(o.view)),s}const SR=new Set(["view",...sR]),MR=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],BR={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...lR};function zR(t){t=ft(t);for(const n of MR)delete t[n];if(t.axis)for(const n in t.axis)Fl(t.axis[n])&&delete t.axis[n];if(t.legend)for(const n of _R)delete t.legend[n];if(t.mark){for(const n of C3)delete t.mark[n];t.mark.tooltip&&Z(t.mark.tooltip)&&delete t.mark.tooltip}t.params&&(t.signals=(t.signals||[]).concat(_$(t.params)),delete t.params);for(const n of SR){for(const r of C3)delete t[n][r];const e=BR[n];if(e)for(const r of e)delete t[n][r];OR(t,n)}for(const n of q(v$))delete t[n];(function(n){const{titleMarkConfig:e,subtitleMarkConfig:r,subtitle:i}=ME(n.title);jt(e)||(n.style["group-title"]={...n.style["group-title"],...e}),jt(r)||(n.style["group-subtitle"]={...n.style["group-subtitle"],...r}),jt(i)?delete n.title:n.title=i})(t);for(const n in t)Z(t[n])&&jt(t[n])&&delete t[n];return jt(t)?void 0:t}function OR(t,n,e,r){n==="view"&&(e="cell");const i={...t[n],...t.style[e??n]};jt(i)||(t.style[e??n]=i),delete t[n]}function gh(t){return U(t,"layer")}class Pv{map(n,e){return eh(n)?this.mapFacet(n,e):function(r){return U(r,"repeat")}(n)?this.mapRepeat(n,e):Nv(n)?this.mapHConcat(n,e):ph(n)?this.mapVConcat(n,e):Ov(n)?this.mapConcat(n,e):this.mapLayerOrUnit(n,e)}mapLayerOrUnit(n,e){if(gh(n))return this.mapLayer(n,e);if(Di(n))return this.mapUnit(n,e);throw new Error(qy(n))}mapLayer(n,e){return{...n,layer:n.layer.map(r=>this.mapLayerOrUnit(r,e))}}mapHConcat(n,e){return{...n,hconcat:n.hconcat.map(r=>this.map(r,e))}}mapVConcat(n,e){return{...n,vconcat:n.vconcat.map(r=>this.map(r,e))}}mapConcat(n,e){const{concat:r,...i}=n;return{...i,concat:r.map(a=>this.map(a,e))}}mapFacet(n,e){return{...n,spec:this.map(n.spec,e)}}mapRepeat(n,e){return{...n,spec:this.map(n.spec,e)}}}const NR={zero:1,center:1,normalize:1},RR=new Set([k3,Jd,Xd,Zd,Qd,cv,fv,Kd,D3,lv]),TR=new Set([Jd,Xd,k3]);function Es(t){return H(t)&&_s(t)==="quantitative"&&!t.bin}function M$(t,n,{orient:e,type:r}){const i=n==="x"?"y":"radius",a=n==="x"&&["bar","area"].includes(r),o=t[n],s=t[i];if(H(o)&&H(s))if(Es(o)&&Es(s)){if(o.stack)return n;if(s.stack)return i;const u=H(o)&&!!o.aggregate;if(u!==(H(s)&&!!s.aggregate))return u?n:i;if(a){if(e==="vertical")return i;if(e==="horizontal")return n}}else{if(Es(o))return n;if(Es(s))return i}else{if(Es(o))return a&&e==="vertical"?void 0:n;if(Es(s))return a&&e==="horizontal"?void 0:i}}function B$(t,n){var g,y;const e=Vr(t)?t:{type:t},r=e.type;if(!RR.has(r))return null;const i=M$(n,"x",e)||M$(n,"theta",e);if(!i)return null;const a=n[i],o=H(a)?Y(a,{}):void 0,s=function(v){switch(v){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(i),u=[],l=new Set;if(n[s]){const v=n[s],x=H(v)?Y(v,{}):void 0;x&&x!==o&&(u.push(s),l.add(x))}const c=s==="x"?"xOffset":"yOffset",f=n[c],d=H(f)?Y(f,{}):void 0;d&&d!==o&&(u.push(c),l.add(d));const h=yN.reduce((v,x)=>{if(x!=="tooltip"&&mo(n,x)){const b=n[x];for(const w of K(b)){const A=vr(w);if(A.aggregate)continue;const _=Y(A,{});_&&l.has(_)||v.push({channel:x,fieldDef:A})}}return v},[]);let p;return a.stack!==void 0?p=Fa(a.stack)?a.stack?"zero":null:a.stack:TR.has(r)&&(p="zero"),p&&tt(NR,p)?a$(n)&&h.length===0?null:((g=a==null?void 0:a.scale)!=null&&g.type&&((y=a==null?void 0:a.scale)==null?void 0:y.type)!==m3&&(a!=null&&a.stack)&&I(function(v){return`Stack is applied to a non-linear scale (${v}).`}(a.scale.type)),ht(n[Ur(i)])?(a.stack!==void 0&&I(`Cannot stack "${m=i}" if there is already "${m}2".`),null):(H(a)&&a.aggregate&&!DN.has(a.aggregate)&&I(`Stacking is applied even though the aggregate function is non-summative ("${a.aggregate}").`),{groupbyChannels:u,groupbyFields:l,fieldChannel:i,impute:a.impute!==null&&ya(r),stackBy:h,offset:p})):null;var m}function z$(t,n,e){const r=Sn(t),i=qt("orient",r,e);if(r.orient=function(s,u,l){switch(s){case Qd:case cv:case fv:case D3:case aR:case iR:return}const{x:c,y:f,x2:d,y2:h}=u;switch(s){case Jd:if(H(c)&&($n(c.bin)||H(f)&&f.aggregate&&!c.aggregate))return"vertical";if(H(f)&&($n(f.bin)||H(c)&&c.aggregate&&!f.aggregate))return"horizontal";if(h||d){if(l)return l;if(!d)return(H(c)&&c.type===lo&&!Wt(c.bin)||ih(c))&&H(f)&&$n(f.bin)?"horizontal":"vertical";if(!h)return(H(f)&&f.type===lo&&!Wt(f.bin)||ih(f))&&H(c)&&$n(c.bin)?"vertical":"horizontal"}case Zd:if(d&&(!H(c)||!$n(c.bin))&&h&&(!H(f)||!$n(f.bin)))return;case Xd:if(h)return H(f)&&$n(f.bin)?"horizontal":"vertical";if(d)return H(c)&&$n(c.bin)?"vertical":"horizontal";if(s===Zd){if(c&&!f)return"vertical";if(f&&!c)return"horizontal"}case Kd:case lv:{const p=W3(c),m=W3(f);if(l)return l;if(p&&!m)return s!=="tick"?"horizontal":"vertical";if(!p&&m)return s!=="tick"?"vertical":"horizontal";if(p&&m)return"vertical";{const g=oe(c)&&c.type===xs,y=oe(f)&&f.type===xs;if(g&&!y)return"vertical";if(!g&&y)return"horizontal"}return}}return"vertical"}(r.type,n,i),i!==void 0&&i!==r.orient&&I(`Specified orient "${r.orient}" overridden with "${i}".`),r.type==="bar"&&r.orient){const s=qt("cornerRadiusEnd",r,e);if(s!==void 0){const u=r.orient==="horizontal"&&n.x2||r.orient==="vertical"&&n.y2?["cornerRadius"]:cR[r.orient];for(const l of u)r[l]=s;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}const a=qt("opacity",r,e),o=qt("fillOpacity",r,e);return a===void 0&&o===void 0&&(r.opacity=function(s,u){if(vt([Qd,lv,cv,fv],s)&&!a$(u))return .7}(r.type,n)),qt("cursor",r,e)===void 0&&(r.cursor=function(s,u,l){return u.href||s.href||qt("href",s,l)?"pointer":s.cursor}(r,n,e)),r}function PR(t){const{point:n,line:e,...r}=t;return q(r).length>1?r:r.type}function jR(t){for(const n of["line","area","rule","trail"])t[n]&&(t={...t,[n]:he(t[n],["point","line"])});return t}function jv(t,n={},e){return t.point==="transparent"?{opacity:0}:t.point?Z(t.point)?t.point:{}:t.point!==void 0?null:n.point||e.shape?Z(n.point)?n.point:{}:void 0}function O$(t,n={}){return t.line?t.line===!0?{}:t.line:t.line!==void 0?null:n.line?n.line===!0?{}:n.line:void 0}class LR{constructor(){this.name="path-overlay"}hasMatchingType(n,e){if(Di(n)){const{mark:r,encoding:i}=n,a=Vr(r)?r:{type:r};switch(a.type){case"line":case"rule":case"trail":return!!jv(a,e[a.type],i);case"area":return!!jv(a,e[a.type],i)||!!O$(a,e[a.type])}}return!1}run(n,e,r){const{config:i}=e,{params:a,projection:o,mark:s,name:u,encoding:l,...c}=n,f=fh(l,i),d=Vr(s)?s:{type:s},h=jv(d,i[d.type],f),p=d.type==="area"&&O$(d,i[d.type]),m=[{name:u,...a?{params:a}:{},mark:PR({...d.type==="area"&&d.opacity===void 0&&d.fillOpacity===void 0?{opacity:.7}:{},...d}),encoding:he(f,["shape"])}],g=B$(z$(d,f,i),f);let y=f;if(g){const{fieldChannel:v,offset:x}=g;y={...f,[v]:{...f[v],...x?{stack:x}:{}}}}return y=he(y,["y2","x2"]),p&&m.push({...o?{projection:o}:{},mark:{type:"line",...hs(d,["clip","interpolate","tension","tooltip"]),...p},encoding:y}),h&&m.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...hs(d,["clip","tooltip"]),...h},encoding:y}),r({...c,layer:m},{...e,config:jR(i)})}}function qR(t,n){return n?Al(t)?P$(t,n):N$(t,n):t}function Lv(t,n){return n?P$(t,n):t}function qv(t,n,e){const r=n[t];return function(i){return!Q(i)&&U(i,"repeat")}(r)?r.repeat in e?{...n,[t]:e[r.repeat]}:void I(function(i){return`Unknown repeated value "${i}".`}(r.repeat)):n}function N$(t,n){if((t=qv("field",t,n))!==void 0){if(t===null)return null;if(xv(t)&&ki(t.sort)){const e=qv("field",t.sort,n);t={...t,...e?{sort:e}:{}}}return t}}function R$(t,n){if(H(t))return N$(t,n);{const e=qv("datum",t,n);return e===t||e.type||(e.type="nominal"),e}}function T$(t,n){if(!ht(t)){if(kl(t)){const e=R$(t.condition,n);if(e)return{...t,condition:e};{const{condition:r,...i}=t;return i}}return t}{const e=R$(t,n);if(e)return e;if(_l(t))return{condition:t.condition}}}function P$(t,n){const e={};for(const r in t)if(U(t,r)){const i=t[r];if(P(i))e[r]=i.map(a=>T$(a,n)).filter(a=>a);else{const a=T$(i,n);a!==void 0&&(e[r]=a)}}return e}class UR{constructor(){this.name="RuleForRangedLine"}hasMatchingType(n){if(Di(n)){const{encoding:e,mark:r}=n;if(r==="line"||Vr(r)&&r.type==="line")for(const i of pN){const a=e[ro(i)];if(e[i]&&(H(a)&&!$n(a.bin)||Yr(a)))return!0}}return!1}run(n,e,r){const{encoding:i,mark:a}=n;var o,s;return I((o=!!i.x2,s=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&s?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),r({...n,mark:Z(a)?{...a,type:"rule"}:"rule"},e)}}function j$({parentEncoding:t,encoding:n={},layer:e}){let r={};if(t){const i=new Set([...q(t),...q(n)]);for(const a of i){const o=n[a],s=t[a];if(ht(o)){const u={...s,...o};r[a]=u}else kl(o)?r[a]={...o,condition:{...s,...o.condition}}:o||o===null?r[a]=o:(e||yr(s)||it(s)||ht(s)||P(s))&&(r[a]=s)}}else r=n;return!r||jt(r)?void 0:r}function L$(t){const{parentProjection:n,projection:e}=t;return n&&e&&I(function(r){const{parentProjection:i,projection:a}=r;return`Layer's shared projection ${Lt(i)} is overridden by a child projection ${Lt(a)}.`}({parentProjection:n,projection:e})),e??n}function Uv(t){return U(t,"filter")}function q$(t){return U(t,"lookup")}function IR(t){return U(t,"pivot")}function WR(t){return U(t,"density")}function HR(t){return U(t,"quantile")}function GR(t){return U(t,"regression")}function VR(t){return U(t,"loess")}function YR(t){return U(t,"sample")}function XR(t){return U(t,"window")}function JR(t){return U(t,"joinaggregate")}function KR(t){return U(t,"flatten")}function QR(t){return U(t,"calculate")}function U$(t){return U(t,"bin")}function ZR(t){return U(t,"impute")}function tT(t){return U(t,"timeUnit")}function nT(t){return U(t,"aggregate")}function eT(t){return U(t,"stack")}function rT(t){return U(t,"fold")}function iT(t){return U(t,"extent")&&!U(t,"density")&&!U(t,"regression")}function I$(t,n){const{transform:e,...r}=t;if(e){const i=e.map(a=>{if(Uv(a))return{filter:Iv(a,n)};if(U$(a)&&io(a.bin))return{...a,bin:H$(a.bin)};if(q$(a)){const{selection:o,...s}=a.from;return o?{...a,from:{param:o,...s}}:a}return a});return{...r,transform:i}}return t}function W$(t,n){var r,i;const e=ft(t);if(H(e)&&io(e.bin)&&(e.bin=H$(e.bin)),po(e)&&((i=(r=e.scale)==null?void 0:r.domain)==null?void 0:i.selection)){const{selection:a,...o}=e.scale.domain;e.scale.domain={...o,...a?{param:a}:{}}}if(_l(e))if(P(e.condition))e.condition=e.condition.map(a=>{const{selection:o,param:s,test:u,...l}=a;return s?a:{...l,test:Iv(a,n)}});else{const{selection:a,param:o,test:s,...u}=W$(e.condition,n);e.condition=o?e.condition:{...u,test:Iv(e.condition,n)}}return e}function H$(t){const n=t.extent;if(n!=null&&n.selection){const{selection:e,...r}=n;return{...t,extent:{...r,param:e}}}return t}function Iv(t,n){const e=r=>ds(r,i=>{var a;const o={param:i,empty:n.emptySelections[i]??!0};return(a=n.selectionPredicates)[i]??(a[i]=[]),n.selectionPredicates[i].push(o),o});return t.selection?e(t.selection):ds(t.test||t.filter,r=>r.selection?e(r.selection):r)}class Wv extends Pv{map(n,e){const r=e.selections??[];if(n.params&&!Di(n)){const i=[];for(const a of n.params)zv(a)?r.push(a):i.push(a);n.params=i}return e.selections=r,super.map(n,e)}mapUnit(n,e){const r=e.selections;if(!r||!r.length)return n;const i=(e.path??[]).concat(n.name),a=[];for(const o of r)if(o.views&&o.views.length)for(const s of o.views)(Q(s)&&(s===n.name||i.includes(s))||P(s)&&s.map(u=>i.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&a.push(o);else a.push(o);return a.length&&(n.params=a),n}}for(const t of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=Wv.prototype[t];Wv.prototype[t]=function(e,r){return n.call(this,e,aT(e,r))}}function aT(t,n){return t.name?{...n,path:(n.path??[]).concat(t.name)}:n}function G$(t,n){n===void 0&&(n=S$(t.config));const e=function(o,s={}){const u={config:s};return uT.map(oT.map(sT.map(o,u),u),u)}(t,n),{width:r,height:i}=t,a=function(o,s,u){let{width:l,height:c}=s;const f=Di(o)||gh(o),d={};f?l=="container"&&c=="container"?(d.type="fit",d.contains="padding"):l=="container"?(d.type="fit-x",d.contains="padding"):c=="container"&&(d.type="fit-y",d.contains="padding"):(l=="container"&&(I(qE("width")),l=void 0),c=="container"&&(I(qE("height")),c=void 0));const h={type:"pad",...d,...u?V$(u.autosize):{},...V$(o.autosize)};if(h.type!=="fit"||f||(I(MN),h.type="pad"),l=="container"&&h.type!="fit"&&h.type!="fit-x"&&I(UE("width")),c=="container"&&h.type!="fit"&&h.type!="fit-y"&&I(UE("height")),!Ce(h,{type:"pad"}))return h}(e,{width:r,height:i,autosize:t.autosize},n);return{...e,...a?{autosize:a}:{}}}const oT=new class extends Pv{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[bR,xR,AR,new LR,new UR]}map(t,n){if(Di(t)){const e=mo(t.encoding,mi),r=mo(t.encoding,gi),i=mo(t.encoding,Nd);if(e||r||i)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:e,parentProjection:r}=n,i=Lv(t.encoding,n.repeater),a={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter(s=>s).join("_")}:{},...i?{encoding:i}:{}};if(e||r)return this.mapUnitWithParentEncodingOrProjection(a,n);const o=this.mapLayerOrUnit.bind(this);for(const s of this.nonFacetUnitNormalizers)if(s.hasMatchingType(a,n.config))return s.run(a,n,o);return a}mapRepeat(t,n){return function(e){return!P(e.repeat)&&U(e.repeat,"layer")}(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:e,spec:r,...i}=t,{row:a,column:o,layer:s}=e,{repeater:u={},repeaterPrefix:l=""}=n;return a||o?this.mapRepeat({...t,repeat:{...a?{row:a}:{},...o?{column:o}:{}},spec:{repeat:{layer:s},spec:r}},n):{...i,layer:s.map(c=>{const f={...u,layer:c},d=`${(r.name?`${r.name}_`:"")+l}child__layer_${Xt(c)}`,h=this.mapLayerOrUnit(r,{...n,repeater:f,repeaterPrefix:d});return h.name=d,h})}}mapNonLayerRepeat(t,n){const{repeat:e,spec:r,data:i,...a}=t;!P(e)&&t.columns&&(t=he(t,["columns"]),I(GE("repeat")));const o=[],{repeater:s={},repeaterPrefix:u=""}=n,l=!P(e)&&e.row||[s?s.row:null],c=!P(e)&&e.column||[s?s.column:null],f=P(e)&&e||[s?s.repeat:null];for(const h of f)for(const p of l)for(const m of c){const g={repeat:h,row:p,column:m,layer:s.layer},y=(r.name?`${r.name}_`:"")+u+"child__"+(P(e)?`${Xt(h)}`:(e.row?`row_${Xt(p)}`:"")+(e.column?`column_${Xt(m)}`:"")),v=this.map(r,{...n,repeater:g,repeaterPrefix:y});v.name=y,o.push(he(v,["data"]))}const d=P(e)?t.columns:e.column?e.column.length:1;return{data:r.data??i,align:"all",...a,columns:d,concat:o}}mapFacet(t,n){const{facet:e}=t;return Al(e)&&t.columns&&(t=he(t,["columns"]),I(GE("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:e,projection:r}=t,{parentEncoding:i,parentProjection:a,config:o}=n,s=L$({parentProjection:a,projection:r}),u=j$({parentEncoding:i,encoding:Lv(e,n.repeater)});return this.mapUnit({...t,...s?{projection:s}:{},...u?{encoding:u}:{}},{config:o})}mapFacetedUnit(t,n){const{row:e,column:r,facet:i,...a}=t.encoding,{mark:o,width:s,projection:u,height:l,view:c,params:f,encoding:d,...h}=t,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:e,column:r,facet:i},n),g=Lv(a,n.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...l?{height:l}:{},...c?{view:c}:{},...u?{projection:u}:{},mark:o,encoding:g,...f?{params:f}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:e,column:r,facet:i}=t;if(e||r){i&&I(`Facet encoding dropped as ${(a=[...e?[mi]:[],...r?[gi]:[]]).join(" and ")} ${a.length>1?"are":"is"} also specified.`);const o={},s={};for(const u of[mi,gi]){const l=t[u];if(l){const{align:c,center:f,spacing:d,columns:h,...p}=l;o[u]=p;for(const m of["align","center","spacing"])l[m]!==void 0&&(s[m]??(s[m]={}),s[m][u]=l[m])}}return{facetMapping:o,layout:s}}{const{align:o,center:s,spacing:u,columns:l,...c}=i;return{facetMapping:qR(c,n.repeater),layout:{...o?{align:o}:{},...s?{center:s}:{},...u?{spacing:u}:{},...l?{columns:l}:{}}}}var a}mapLayer(t,{parentEncoding:n,parentProjection:e,...r}){const{encoding:i,projection:a,...o}=t,s={...r,parentEncoding:j$({parentEncoding:n,encoding:i,layer:!0}),parentProjection:L$({parentProjection:e,projection:a})};return super.mapLayer({...o,...t.name?{name:[s.repeaterPrefix,t.name].filter(u=>u).join("_")}:{}},s)}},sT=new class extends Pv{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=I$(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if((t=I$(t,n)).encoding){const e={};for(const[r,i]of sa(t.encoding))e[r]=W$(i,n);t={...t,encoding:e}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:e,...r}=t;return e?{...r,params:sa(e).map(([i,a])=>{const{init:o,bind:s,empty:u,...l}=a;l.type==="single"?(l.type="point",l.toggle=!1):l.type==="multi"&&(l.type="point"),n.emptySelections[i]=u!=="none";for(const c of En(n.selectionPredicates[i]??{}))c.empty=u!=="none";return{name:i,value:o,select:l,bind:s}})}:t}},uT=new Wv;function V$(t){return Q(t)?{type:t}:t??{}}const lT=["background","padding"];function Y$(t,n){const e={};for(const r of lT)t&&t[r]!==void 0&&(e[r]=Ee(t[r]));return n&&(e.params=t.params),e}class Bi{constructor(n={},e={}){this.explicit=n,this.implicit=e}clone(){return new Bi(ft(this.explicit),ft(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(n){return un(this.explicit[n],this.implicit[n])}getWithExplicit(n){return this.explicit[n]!==void 0?{explicit:!0,value:this.explicit[n]}:this.implicit[n]!==void 0?{explicit:!1,value:this.implicit[n]}:{explicit:!1,value:void 0}}setWithExplicit(n,{value:e,explicit:r}){e!==void 0&&this.set(n,e,r)}set(n,e,r){return delete this[r?"implicit":"explicit"][n],this[r?"explicit":"implicit"][n]=e,this}copyKeyFromSplit(n,{explicit:e,implicit:r}){e[n]!==void 0?this.set(n,e[n],!0):r[n]!==void 0&&this.set(n,r[n],!1)}copyKeyFromObject(n,e){e[n]!==void 0&&this.set(n,e[n],!0)}copyAll(n){for(const e of q(n.combine())){const r=n.getWithExplicit(e);this.setWithExplicit(e,r)}}}function Jr(t){return{explicit:!0,value:t}}function xr(t){return{explicit:!1,value:t}}function X$(t){return(n,e,r,i)=>{const a=t(n.value,e.value);return a>0?n:a<0?e:yh(n,e,r,i)}}function yh(t,n,e,r){return t.explicit&&n.explicit&&I(function(i,a,o,s){return`Conflicting ${a.toString()} property "${i.toString()}" (${Lt(o)} and ${Lt(s)}). Using ${Lt(o)}.`}(e,r,t.value,n.value)),t}function xa(t,n,e,r,i=yh){return t===void 0||t.value===void 0?n:t.explicit&&!n.explicit?t:n.explicit&&!t.explicit?n:Ce(t.value,n.value)?t:i(t,n,e,r)}class cT extends Bi{constructor(n={},e={},r=!1){super(n,e),this.explicit=n,this.implicit=e,this.parseNothing=r}clone(){const n=super.clone();return n.parseNothing=this.parseNothing,n}}function $s(t){return U(t,"url")}function Cl(t){return U(t,"values")}function J$(t){return U(t,"name")&&!$s(t)&&!Cl(t)&&!wa(t)}function wa(t){return t&&(K$(t)||Q$(t)||Hv(t))}function K$(t){return U(t,"sequence")}function Q$(t){return U(t,"sphere")}function Hv(t){return U(t,"graticule")}var Qt;function Z$({invalid:t,isPath:n}){switch($3(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}(function(t){t[t.Raw=0]="Raw",t[t.Main=1]="Main",t[t.Row=2]="Row",t[t.Column=3]="Column",t[t.Lookup=4]="Lookup",t[t.PreFilterInvalid=5]="PreFilterInvalid",t[t.PostFilterInvalid=6]="PostFilterInvalid"})(Qt||(Qt={}));class Nt{constructor(n,e){this.debugName=e,this._children=[],this._parent=null,n&&(this.parent=n)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(n){this._parent=n,n&&n.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(n,e){this._children.includes(n)?I("Attempt to add the same child twice."):e!==void 0?this._children.splice(e,0,n):this._children.push(n)}removeChild(n){const e=this._children.indexOf(n);return this._children.splice(e,1),e}remove(){let n=this._parent.removeChild(this);for(const e of this._children)e._parent=this._parent,this._parent.addChild(e,n++)}insertAsParentOf(n){const e=n.parent;e.removeChild(this),this.parent=e,n.parent=this}swapWithParent(){const n=this._parent,e=n.parent;for(const i of this._children)i.parent=n;this._children=[],n.removeChild(this);const r=n.parent.removeChild(n);this._parent=e,e.addChild(this,r),n.parent=this}}class ye extends Nt{clone(){const n=new this.constructor;return n.debugName=`clone_${this.debugName}`,n._source=this._source,n._name=`clone_${this._name}`,n.type=this.type,n.refCounts=this.refCounts,n.refCounts[n._name]=0,n}constructor(n,e,r,i){super(n,e),this.type=r,this.refCounts=i,this._source=this._name=e,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${dE()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(n){this._source=n}}function Gv(t){return t.as!==void 0}function t5(t){return`${t}_end`}class Qr extends Nt{clone(){return new Qr(null,ft(this.timeUnits))}constructor(n,e){super(n),this.timeUnits=e}static makeFromEncoding(n,e){const r=e.reduceFieldDef((i,a,o)=>{const{field:s,timeUnit:u}=a;if(u){let l;if(uo(u)){if(Zt(e)){const{mark:c,markDef:f,config:d}=e,h=va({fieldDef:a,markDef:f,config:d});(bl(c)||h)&&(l={timeUnit:xn(u),field:s})}}else l={as:Y(a,{forAs:!0}),field:s,timeUnit:u};if(Zt(e)){const{mark:c,markDef:f,config:d}=e,h=va({fieldDef:a,markDef:f,config:d});bl(c)&&ln(o)&&h!==.5&&(l.rectBandPosition=h)}l&&(i[wt(l)]=l)}return i},{});return jt(r)?null:new Qr(n,r)}static makeFromTransform(n,e){const{timeUnit:r,...i}={...e},a={...i,timeUnit:xn(r)};return new Qr(n,{[wt(a)]:a})}merge(n){this.timeUnits={...this.timeUnits};for(const e in n.timeUnits)this.timeUnits[e]||(this.timeUnits[e]=n.timeUnits[e]);for(const e of n.children)n.removeChild(e),e.parent=this;n.remove()}removeFormulas(n){const e={};for(const[r,i]of sa(this.timeUnits)){const a=Gv(i)?i.as:`${i.field}_end`;n.has(a)||(e[r]=i)}this.timeUnits=e}producedFields(){return new Set(En(this.timeUnits).map(n=>Gv(n)?n.as:t5(n.field)))}dependentFields(){return new Set(En(this.timeUnits).map(n=>n.field))}hash(){return`TimeUnit ${wt(this.timeUnits)}`}assemble(){const n=[];for(const e of En(this.timeUnits)){const{rectBandPosition:r}=e,i=xn(e.timeUnit);if(Gv(e)){const{field:a,as:o}=e,{unit:s,utc:u,...l}=i,c=[o,`${o}_end`];n.push({field:He(a),type:"timeunit",...s?{units:Gd(s)}:{},...u?{timezone:"utc"}:{},...l,as:c}),n.push(...e5(c,r,i))}else if(e){const{field:a}=e,o=a.replaceAll("\\.","."),s=n5({timeUnit:i,field:o}),u=t5(o);n.push({type:"formula",expr:s,as:u}),n.push(...e5([o,u],r,i))}}return n}}const vh="offsetted_rect_start",bh="offsetted_rect_end";function n5({timeUnit:t,field:n,reverse:e}){const{unit:r,utc:i}=t,a=s3(r),{part:o,step:s}=f3(a,t.step);return`${i?"utcOffset":"timeOffset"}('${o}', ${Ot(n)}, ${e?-s:s})`}function e5([t,n],e,r){if(e!==void 0&&e!==.5){const i=Ot(t),a=Ot(n);return[{type:"formula",expr:r5([n5({timeUnit:r,field:t,reverse:!0}),i],e+.5),as:`${t}_${vh}`},{type:"formula",expr:r5([i,a],e+.5),as:`${t}_${bh}`}]}return[]}function r5([t,n],e){return`${1-e} * ${t} + ${e} * ${n}`}const El="_tuple_fields";class fT{constructor(...n){this.items=n,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const dT={defined:()=>!0,parse:(t,n,e)=>{const r=n.name,i=n.project??(n.project=new fT),a={},o={},s=new Set,u=(p,m)=>{const g=m==="visual"?p.channel:p.field;let y=Xt(`${r}_${g}`);for(let v=1;s.has(y);v++)y=Xt(`${r}_${g}_${v}`);return s.add(y),{[m]:y}},l=n.type,c=t.config.selection[l],f=e.value!==void 0?K(e.value):null;let{fields:d,encodings:h}=Z(e.select)?e.select:{};if(!d&&!h&&f){for(const p of f)if(Z(p))for(const m of q(p))hN(m)?(h||(h=[])).push(m):l==="interval"?(I('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=c.encodings):(d??(d=[])).push(m)}d||h||(h=c.encodings,"fields"in c&&(d=c.fields));for(const p of h??[]){const m=t.fieldDef(p);if(m){let g=m.field;if(m.aggregate){I(BN(p,m.aggregate));continue}if(!g){I(WE(p));continue}if(m.timeUnit&&!uo(m.timeUnit)){g=t.vgField(p);const y={timeUnit:m.timeUnit,as:g,field:m.field};o[wt(y)]=y}if(!a[g]){const y={field:g,channel:p,type:l==="interval"&&Ir(p)&&mr(t.getScaleComponent(p).get("type"))?"R":m.bin?"R-RE":"E",index:i.items.length};y.signals={...u(y,"data"),...u(y,"visual")},i.items.push(a[g]=y),i.hasField[g]=a[g],i.hasSelectionId=i.hasSelectionId||g===br,bE(p)?(y.geoChannel=p,y.channel=vE(p),i.hasChannel[y.channel]=a[g]):i.hasChannel[p]=a[g]}}else I(WE(p))}for(const p of d??[]){if(i.hasField[p])continue;const m={type:"E",field:p,index:i.items.length};m.signals={...u(m,"data")},i.items.push(m),i.hasField[p]=m,i.hasSelectionId=i.hasSelectionId||p===br}f&&(n.init=f.map(p=>i.items.map(m=>Z(p)?p[m.geoChannel||m.channel]!==void 0?p[m.geoChannel||m.channel]:p[m.field]:p))),jt(o)||(i.timeUnit=new Qr(null,o))},signals:(t,n,e)=>{const r=n.name+El;return e.filter(i=>i.name===r).length>0||n.project.hasSelectionId?e:e.concat({name:r,value:n.project.items.map(s5)})}},i5="_curr",xh="anim_value",Ss="anim_clock",Vv="eased_anim_clock",a5="min_extent",o5="max_range_extent",Yv="last_tick_at",Xv="is_playing",hT=1/60*1e3,pT={defined:t=>t.type==="point",topLevelSignals:(t,n,e)=>(Kr(n)&&(e=e.concat([{name:Ss,init:"0",on:[{events:{type:"timer",throttle:hT},update:`${Xv} ? (${Ss} + (now() - ${Yv}) > ${o5} ? 0 : ${Ss} + (now() - ${Yv})) : ${Ss}`}]},{name:Yv,init:"now()",on:[{events:[{signal:Ss},{signal:Xv}],update:"now()"}]},{name:Xv,init:"true"}])),e),signals:(t,n,e)=>{const r=n.name,i=r+El,a=n.project,o="(item().isVoronoi ? datum.datum : datum)",s=En(t.component.selection??{}).reduce((d,h)=>h.type==="interval"?d.concat(h.name+Ms):d,[]).map(d=>`indexof(item().mark.name, '${d}') < 0`).join(" && "),u="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let l=`unit: ${vo(t)}, `;if(n.project.hasSelectionId?l+=`${br}: ${o}[${G(br)}]`:Kr(n)?l+=`fields: ${i}, values: [${xh} ? ${xh} : ${a5}]`:l+=`fields: ${i}, values: [${a.items.map(d=>{const h=t.fieldDef(d.channel);return h!=null&&h.bin?`[${o}[${G(t.vgField(d.channel,{}))}], ${o}[${G(t.vgField(d.channel,{binSuffix:"end"}))}]]`:`${o}[${G(d.field)}]`}).join(", ")}]`,Kr(n))return e.concat((c=n.name,f=t.scaleName(la),[{name:Vv,update:Ss},{name:`${c}_domain`,init:`domain('${f}')`},{name:a5,init:`extent(${c}_domain)[0]`},{name:o5,init:`extent(range('${f}'))[1]`},{name:xh,update:`invert('${f}', ${Vv})`}]),[{name:r+$i,on:[{events:[{signal:Vv},{signal:xh}],update:`{${l}}`,force:!0}]}]);{const d=n.events;return e.concat([{name:r+$i,on:d?[{events:d,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}var c,f}};function s5(t){const{signals:n,hasLegend:e,index:r,...i}=t;return i.field=He(i.field),i}function go(t,n=!0,e=Me){if(P(t)){const r=t.map(i=>go(i,n,e));return n?`[${r.join(", ")}]`:r}return oo(t)?e(n?so(t):function(r){const i=Vy(r,!0);return r.utc?+new Date(Date.UTC(...i)):+new Date(...i)}(t)):n?e(Lt(t)):t}function mT(t,n){for(const e of En(t.component.selection??{})){const r=e.name;let i=`${r}${$i}, ${e.resolve==="global"?"true":`{unit: ${vo(t)}}`}`;for(const a of Dh)a.defined(e)&&(a.signals&&(n=a.signals(t,e,n)),a.modifyExpr&&(i=a.modifyExpr(t,e,i)));n.push({name:r+ST,on:[{events:{signal:e.name+$i},update:`modify(${G(e.name+yo)}, ${i})`}]})}return Jv(n)}function gT(t,n){if(t.component.selection&&q(t.component.selection).length){const e=G(t.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:aa("pointermove","scope"),update:`isTuple(facet) ? facet : group(${e}).datum`}]})}return Jv(n)}function u5(t,n){for(const e of En(t.component.selection??{}))for(const r of Dh)r.defined(e)&&r.marks&&(n=r.marks(t,e,n));return n}function Jv(t){return t.map(n=>(n.on&&!n.on.length&&delete n.on,n))}const Ci={defined:t=>t.type==="interval"&&t.resolve==="global"&&t.bind&&t.bind==="scales",parse:(t,n)=>{const e=n.scales=[];for(const r of n.project.items){const i=r.channel;if(!Ir(i))continue;const a=t.getScaleComponent(i),o=a?a.get("type"):void 0;o=="sequential"&&I("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),a&&mr(o)?(a.set("selectionExtent",{param:n.name,field:r.field},!0),e.push(r)):I("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(t,n,e)=>{const r=n.scales.filter(o=>e.filter(s=>s.name===o.signals.data).length===0);if(!t.parent||Qv(t)||r.length===0)return e;const i=e.find(o=>o.name===n.name);let a=i.update;if(a.includes(B5))i.update=`{${r.map(o=>`${G(He(o.field))}: ${o.signals.data}`).join(", ")}}`;else{for(const o of r){const s=`${G(He(o.field))}: ${o.signals.data}`;a.includes(s)||(a=`${a.substring(0,a.length-1)}, ${s}}`)}i.update=a}return e.concat(r.map(o=>({name:o.signals.data})))},signals:(t,n,e)=>{if(t.parent&&!Qv(t))for(const r of n.scales){const i=e.find(a=>a.name===r.signals.data);i.push="outer",delete i.value,delete i.update}return e}};function Kv(t,n){return`domain(${G(t.scaleName(n))})`}function Qv(t){return t.parent&&Rs(t.parent)&&(!t.parent.parent||Qv(t.parent.parent))}const Ms="_brush",l5="_scale_trigger",$l="geo_interval_init_tick",c5="_init",yT={defined:t=>t.type==="interval",parse:(t,n,e)=>{var r;if(t.hasProjection){const i={...Z(e.select)?e.select:{}};i.fields=[br],i.encodings||(i.encodings=e.value?q(e.value):[dr,fr]),e.select={type:"interval",...i}}if(n.translate&&!Ci.defined(n)){const i=`!event.item || event.item.mark.name !== ${G(n.name+Ms)}`;for(const a of n.events){if(!a.between){I(`${a} is not an ordered event stream for interval selections.`);continue}const o=K((r=a.between[0]).filter??(r.filter=[]));o.includes(i)||o.push(i)}}},signals:(t,n,e)=>{const r=n.name,i=r+$i,a=En(n.project.hasChannel).filter(s=>s.channel===Jt||s.channel===bn),o=n.init?n.init[0]:null;if(e.push(...a.reduce((s,u)=>s.concat(function(l,c,f,d){const h=!l.hasProjection,p=f.channel,m=f.signals.visual,g=G(h?l.scaleName(p):l.projectionName()),y=w=>`scale(${g}, ${w})`,v=l.getSizeSignalRef(p===Jt?"width":"height").signal,x=`${p}(unit)`,b=c.events.reduce((w,A)=>[...w,{events:A.between[0],update:`[${x}, ${x}]`},{events:A,update:`[${m}[0], clamp(${x}, 0, ${v})]`}],[]);if(h){const w=f.signals.data,A=Ci.defined(c),_=l.getScaleComponent(p),k=_?_.get("type"):void 0,F=d?{init:go(d,!0,y)}:{value:[]};return b.push({events:{signal:c.name+l5},update:mr(k)?`[${y(`${w}[0]`)}, ${y(`${w}[1]`)}]`:"[0, 0]"}),A?[{name:w,on:[]}]:[{name:m,...F,on:b},{name:w,...d?{init:go(d)}:{},on:[{events:{signal:m},update:`${m}[0] === ${m}[1] ? null : invert(${g}, ${m})`}]}]}{const w=p===Jt?0:1,A=c.name+c5;return[{name:m,...d?{init:`[${A}[0][${w}], ${A}[1][${w}]]`}:{value:[]},on:b}]}}(t,n,u,o&&o[u.index])),[])),t.hasProjection){const s=G(t.projectionName()),u=t.projectionName()+"_center",{x:l,y:c}=n.project.hasChannel,f=l&&l.signals.visual,d=c&&c.signals.visual,h=l?o&&o[l.index]:`${u}[0]`,p=c?o&&o[c.index]:`${u}[1]`,m=x=>t.getSizeSignalRef(x).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;o&&(e.unshift({name:r+c5,init:`[scale(${s}, [${l?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${l?h[1]:h}, ${c?p[1]:p}])]`}),!l||!c)&&(e.find(x=>x.name===u)||e.unshift({name:u,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`}));const y=`vlSelectionTuples(${`intersect(${g}, {markname: ${G(t.getName("marks"))}}, unit.mark)`}, ${`{unit: ${vo(t)}}`})`,v=a.map(x=>x.signals.visual);return e.concat({name:i,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...o?[{signal:$l}]:[]],update:y}]})}{if(!Ci.defined(n)){const l=r+l5,c=a.map(f=>{const d=f.channel,{data:h,visual:p}=f.signals,m=G(t.scaleName(d)),g=mr(t.getScaleComponent(d).get("type"))?"+":"";return`(!isArray(${h}) || (${g}invert(${m}, ${p})[0] === ${g}${h}[0] && ${g}invert(${m}, ${p})[1] === ${g}${h}[1]))`});c.length&&e.push({name:l,value:{},on:[{events:a.map(f=>({scale:t.scaleName(f.channel)})),update:c.join(" && ")+` ? ${l} : {}`}]})}const s=a.map(l=>l.signals.data),u=`unit: ${vo(t)}, fields: ${r+El}, values`;return e.concat({name:i,...o?{init:`{${u}: ${go(o)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${u}: [${s}]} : null`}]}:{}})}},topLevelSignals:(t,n,e)=>(Zt(t)&&t.hasProjection&&n.init&&(e.filter(r=>r.name===$l).length||e.unshift({name:$l,value:null,on:[{events:"timer{1}",update:`${$l} === null ? {} : ${$l}`}]})),e),marks:(t,n,e)=>{const r=n.name,{x:i,y:a}=n.project.hasChannel,o=i==null?void 0:i.signals.visual,s=a==null?void 0:a.signals.visual,u=`data(${G(n.name+yo)})`;if(Ci.defined(n)||!i&&!a)return e;const l={x:i!==void 0?{signal:`${o}[0]`}:{value:0},y:a!==void 0?{signal:`${s}[0]`}:{value:0},x2:i!==void 0?{signal:`${o}[1]`}:{field:{group:"width"}},y2:a!==void 0?{signal:`${s}[1]`}:{field:{group:"height"}}};if(n.resolve==="global")for(const g of q(l))l[g]=[{test:`${u}.length && ${u}[0].unit === ${vo(t)}`,...l[g]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=n.mark,p=q(h).reduce((g,y)=>(g[y]=[{test:[i!==void 0&&`${o}[0] !== ${o}[1]`,a!==void 0&&`${s}[0] !== ${s}[1]`].filter(v=>v).join(" && "),value:h[y]},{value:null}],g),{}),m=d??(n.translate?"move":null);return[{name:`${r+Ms}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...e,{name:r+Ms,type:"rect",clip:!0,encode:{enter:{...m?{cursor:{value:m}}:{},fill:{value:"transparent"}},update:{...l,...p}}}]}};function Bs({model:t,channelDef:n,vgChannel:e,invalidValueRef:r,mainRefFn:i}){const a=_l(n)&&n.condition;let o=[];a&&(o=K(a).map(u=>{const l=i(u);if(function(c){return U(c,"param")}(u)){const{param:c,empty:f}=u;return{test:X5(t,{param:c,empty:f}),...l}}return{test:Sh(t,u.test),...l}})),r!==void 0&&o.push(r);const s=i(n);return s!==void 0&&o.push(s),o.length>1||o.length===1&&o[0].test?{[e]:o}:o.length===1?{[e]:o[0]}:{}}function Zv(t,n="text"){const e=t.encoding[n];return Bs({model:t,channelDef:e,vgChannel:n,mainRefFn:r=>wh(r,t.config),invalidValueRef:void 0})}function wh(t,n,e="datum"){if(t){if(yr(t))return Gt(t.value);if(ht(t)){const{format:r,formatType:i}=oh(t);return yv({fieldOrDatumDef:t,format:r,formatType:i,expr:e,config:n})}}}function f5(t,n={}){const{encoding:e,markDef:r,config:i,stack:a}=t,o=e.tooltip;if(P(o))return{tooltip:h5({tooltip:o},a,i,n)};{const s=n.reactiveGeom?"datum.datum":"datum";return Bs({model:t,channelDef:o,vgChannel:"tooltip",mainRefFn:u=>{const l=wh(u,i,s);if(l)return l;if(u===null)return;let c=qt("tooltip",r,i);return c===!0&&(c={content:"encoding"}),Q(c)?{value:c}:Z(c)?it(c)?c:c.content==="encoding"?h5(e,a,i,n):{signal:s}:void 0},invalidValueRef:void 0})}}function d5(t,n,e,{reactiveGeom:r}={}){const i={...e,...e.tooltipFormat},a=new Set,o=r?"datum.datum":"datum",s=[];function u(c,f){const d=ro(f),h=oe(c)?c:{...c,type:t[d].type},p=h.title||Av(h,i),m=K(p).join(", ").replaceAll(/"/g,'\\"');let g;if(ln(f)){const y=f==="x"?"x2":"y2",v=vr(t[y]);if($n(h.bin)&&v){const x=Y(h,{expr:o}),b=Y(v,{expr:o}),{format:w,formatType:A}=oh(h);g=wl(x,b,w,A,i),a.add(y)}}if((ln(f)||f===Ge||f===cr)&&n&&n.fieldChannel===f&&n.offset==="normalize"){const{format:y,formatType:v}=oh(h);g=yv({fieldOrDatumDef:h,format:y,formatType:v,expr:o,config:i,normalizeStack:!0}).signal}g??(g=wh(h,i,o).signal),s.push({channel:f,key:m,value:g})}kv(t,(c,f)=>{H(c)?u(c,f):rh(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of s)a.has(c)||l[f]||(l[f]=d);return l}function h5(t,n,e,{reactiveGeom:r}={}){const i=d5(t,n,e,{reactiveGeom:r}),a=sa(i).map(([o,s])=>`"${o}": ${s}`);return a.length>0?{signal:`{${a.join(", ")}}`}:void 0}function vT(t){const{markDef:n,config:e}=t,r=qt("aria",n,e);return r===!1?{}:{...r?{aria:r}:{},...bT(t),...xT(t)}}function bT(t){const{mark:n,markDef:e,config:r}=t;if(r.aria===!1)return{};const i=qt("ariaRoleDescription",e,r);return i!=null?{ariaRoleDescription:{value:i}}:tt(EN,n)?{}:{ariaRoleDescription:{value:n}}}function xT(t){const{encoding:n,markDef:e,config:r,stack:i}=t,a=n.description;if(a)return Bs({model:t,channelDef:a,vgChannel:"description",mainRefFn:u=>wh(u,t.config),invalidValueRef:void 0});const o=qt("description",e,r);if(o!=null)return{description:Gt(o)};if(r.aria===!1)return{};const s=d5(n,i,r);return jt(s)?void 0:{description:{signal:sa(s).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function Mn(t,n,e={}){const{markDef:r,encoding:i,config:a}=n,{vgChannel:o}=e;let{defaultRef:s,defaultValue:u}=e;const l=i[t];s===void 0&&(u??(u=qt(t,r,a,{vgChannel:o,ignoreVgConfig:!_l(l)})),u!==void 0&&(s=Gt(u)));const c={markDef:r,config:a,scaleName:n.scaleName(t),scale:n.getScaleComponent(t)},f=M3({...c,scaleChannel:t,channelDef:l});return Bs({model:n,channelDef:l,vgChannel:o??t,invalidValueRef:f,mainRefFn:d=>gv({...c,channel:t,channelDef:d,stack:null,defaultRef:s})})}function p5(t,n={filled:void 0}){const{markDef:e,encoding:r,config:i}=t,{type:a}=e,o=n.filled??qt("filled",e,i),s=vt(["bar","point","circle","square","geoshape"],a)?"transparent":void 0,u=qt(o===!0?"color":void 0,e,i,{vgChannel:"fill"})??i.mark[o===!0&&"color"]??s,l=qt(o===!1?"color":void 0,e,i,{vgChannel:"stroke"})??i.mark[o===!1&&"color"],c=o?"fill":"stroke",f={...u?{fill:Gt(u)}:{},...l?{stroke:Gt(l)}:{}};return e.color&&(o?e.fill:e.stroke)&&I(JE("property",{fill:"fill"in e,stroke:"stroke"in e})),{...f,...Mn("color",t,{vgChannel:c,defaultValue:o?u:l}),...Mn("fill",t,{defaultValue:r.fill?u:void 0}),...Mn("stroke",t,{defaultValue:r.stroke?l:void 0})}}function wT(t){const{encoding:n,mark:e}=t,r=n.order;return!ya(e)&&yr(r)?Bs({model:t,channelDef:r,vgChannel:"zindex",mainRefFn:i=>Gt(i.value),invalidValueRef:void 0}):{}}function Sl({channel:t,markDef:n,encoding:e={},model:r,bandPosition:i}){const a=`${t}Offset`,o=n[a],s=e[a];if((a==="xOffset"||a==="yOffset")&&s)return{offsetType:"encoding",offset:gv({channel:a,channelDef:s,markDef:n,config:r==null?void 0:r.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:Gt(o),bandPosition:i})};const u=n[a];return u?{offsetType:"visual",offset:u}:{}}function se(t,n,{defaultPos:e,vgChannel:r}){const{encoding:i,markDef:a,config:o,stack:s}=n,u=i[t],l=i[Ur(t)],c=n.scaleName(t),f=n.getScaleComponent(t),{offset:d,offsetType:h}=Sl({channel:t,markDef:a,encoding:i,model:n,bandPosition:.5}),p=tb({model:n,defaultPos:e,channel:t,scaleName:c,scale:f}),m=!u&&ln(t)&&(i.latitude||i.longitude)?{field:n.getName(t)}:function(g){const{channel:y,channelDef:v,scaleName:x,stack:b,offset:w,markDef:A}=g;if(ht(v)&&b&&y===b.fieldChannel){if(H(v)){let _=v.bandPosition;if(_!==void 0||A.type!=="text"||y!=="radius"&&y!=="theta"||(_=.5),_!==void 0)return th({scaleName:x,fieldOrDatumDef:v,startSuffix:"start",bandPosition:_,offset:w})}return fo(v,x,{suffix:"end"},{offset:w})}return mv(g)}({channel:t,channelDef:u,channel2Def:l,markDef:a,config:o,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:h==="encoding"?0:void 0});return m?{[r||t]:m}:void 0}function tb({model:t,defaultPos:n,channel:e,scaleName:r,scale:i}){const{markDef:a,config:o}=t;return()=>{const s=ro(e),u=pa(e),l=qt(e,a,o,{vgChannel:u});if(l!==void 0)return xl(e,l);switch(n){case"zeroOrMin":return m5({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:s,config:o});case"zeroOrMax":return m5({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:s,config:o});case"mid":return{...t[ge(e)],mult:.5}}}}function m5({mainChannel:t,config:n,...e}){const r=S3(e),{mode:i}=e;if(r)return r;switch(t){case"radius":{if(i==="zeroOrMin")return{value:0};const{widthSignal:a,heightSignal:o}=i.zeroOrMax;return{signal:`min(${a},${o})/2`}}case"theta":return i==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return i==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return i==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const AT={left:"x",center:"xc",right:"x2"},_T={top:"y",middle:"yc",bottom:"y2"};function g5(t,n,e,r="middle"){if(t==="radius"||t==="theta")return pa(t);const i=t==="x"?"align":"baseline",a=qt(i,n,e);let o;return it(a)?(I(function(s){return`The ${s} for range marks cannot be an expression`}(i)),o=void 0):o=a,t==="x"?AT[o||(r==="top"?"left":"center")]:_T[o||r]}function Ah(t,n,{defaultPos:e,defaultPos2:r,range:i}){return i?y5(t,n,{defaultPos:e,defaultPos2:r}):se(t,n,{defaultPos:e})}function y5(t,n,{defaultPos:e,defaultPos2:r}){const{markDef:i,config:a}=n,o=Ur(t),s=ge(t),u=function(l,c,f){const{encoding:d,mark:h,markDef:p,stack:m,config:g}=l,y=ro(f),v=ge(f),x=pa(f),b=d[y],w=l.scaleName(y),A=l.getScaleComponent(y),{offset:_}=Sl(f in d||f in p?{channel:f,markDef:p,encoding:d,model:l}:{channel:y,markDef:p,encoding:d,model:l});if(!b&&(f==="x2"||f==="y2")&&(d.latitude||d.longitude)){const F=ge(f),C=l.markDef[F];return C!=null?{[F]:{value:C}}:{[x]:{field:l.getName(f)}}}const k=function({channel:F,channelDef:C,channel2Def:D,markDef:E,config:$,scaleName:M,scale:S,stack:B,offset:z,defaultRef:N}){return ht(C)&&B&&F.charAt(0)===B.fieldChannel.charAt(0)?fo(C,M,{suffix:"start"},{offset:z}):mv({channel:F,channelDef:D,scaleName:M,scale:S,stack:B,markDef:E,config:$,offset:z,defaultRef:N})}({channel:f,channelDef:b,channel2Def:d[f],markDef:p,config:g,scaleName:w,scale:A,stack:m,offset:_,defaultRef:void 0});return k!==void 0?{[x]:k}:_h(f,p)||_h(f,{[f]:Ly(f,p,g.style),[v]:Ly(v,p,g.style)})||_h(f,g[h])||_h(f,g.mark)||{[x]:tb({model:l,defaultPos:c,channel:f,scaleName:w,scale:A})()}}(n,r,o);return{...se(t,n,{defaultPos:e,vgChannel:u[s]?g5(t,i,a):pa(t)}),...u}}function _h(t,n){const e=ge(t),r=pa(t);if(n[r]!==void 0)return{[r]:xl(t,n[r])};if(n[t]!==void 0)return{[r]:xl(t,n[t])};if(n[e]){const i=n[e];if(!co(i))return{[e]:xl(t,i)};I(function(a){return`Position range does not support relative band size for ${a}.`}(e))}}function Ei(t,n){const{config:e,encoding:r,markDef:i}=t,a=i.type,o=Ur(n),s=ge(n),u=r[n],l=r[o],c=t.getScaleComponent(n),f=c?c.get("type"):void 0,d=i.orient,h=r[s]??r.size??qt("size",i,e,{vgChannel:s}),p=_E(n),m=a==="bar"&&(n==="x"?d==="vertical":d==="horizontal")||a==="tick"&&(n==="y"?d==="vertical":d==="horizontal");return!H(u)||!(Wt(u.bin)||$n(u.bin)||u.timeUnit&&!l)||h&&!co(h)||r[p]||wn(f)?(ht(u)&&wn(f)||m)&&!l?function(g,y,v){var mt,pt;const{markDef:x,encoding:b,config:w,stack:A}=v,_=x.orient,k=v.scaleName(y),F=v.getScaleComponent(y),C=ge(y),D=Ur(y),E=_E(y),$=v.scaleName(E),M=v.getScaleComponent(By(y)),S=x.type==="tick"||_==="horizontal"&&y==="y"||_==="vertical"&&y==="x";let B;(b.size||x.size)&&(S?B=Mn("size",v,{vgChannel:C,defaultRef:Gt(x.size)}):I(function(J){return`Cannot apply size to non-oriented mark "${J}".`}(x.type)));const z=!!B,N=q3({channel:y,fieldDef:g,markDef:x,config:w,scaleType:(mt=F||M)==null?void 0:mt.get("type"),useVlSizeChannel:S});B=B||{[C]:kT(C,$||k,M||F,w,N,!!g,x.type)};const W=((pt=F||M)==null?void 0:pt.get("type"))==="band"&&co(N)&&!z?"top":"middle",X=g5(y,x,w,W),L=X==="xc"||X==="yc",{offset:et,offsetType:ot}=Sl({channel:y,markDef:x,encoding:b,model:v,bandPosition:L?.5:0}),nt=mv({channel:y,channelDef:g,markDef:x,config:w,scaleName:k,scale:F,stack:A,offset:et,defaultRef:tb({model:v,defaultPos:"mid",channel:y,scaleName:k,scale:F}),bandPosition:L?ot==="encoding"?0:.5:it(N)?{signal:`(1-${N})/2`}:co(N)?(1-N.band)/2:0});if(C)return{[X]:nt,...B};{const J=pa(D),Mt=B[C],Tt=et?{...Mt,offset:et}:Mt;return{[X]:nt,[J]:P(nt)?[nt[0],{...nt[1],offset:Tt}]:{...nt,offset:Tt}}}}(u,n,t):y5(n,t,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:g,fieldDef2:y,channel:v,model:x}){var pt;const{config:b,markDef:w,encoding:A}=x,_=x.getScaleComponent(v),k=x.scaleName(v),F=_?_.get("type"):void 0,C=_.get("reverse"),D=q3({channel:v,fieldDef:g,markDef:w,config:b,scaleType:F}),E=(pt=x.component.axes[v])==null?void 0:pt[0],$=(E==null?void 0:E.get("translate"))??.5,M=ln(v)?qt("binSpacing",w,b)??0:0,S=Ur(v),B=pa(v),z=pa(S),N=Wr("minBandSize",w,b),{offset:W}=Sl({channel:v,markDef:w,encoding:A,model:x,bandPosition:0}),{offset:X}=Sl({channel:S,markDef:w,encoding:A,model:x,bandPosition:0}),L=function({scaleName:J,fieldDef:Mt}){const Tt=Y(Mt,{expr:"datum"});return`abs(scale("${J}", ${Y(Mt,{expr:"datum",suffix:"end"})}) - scale("${J}", ${Tt}))`}({fieldDef:g,scaleName:k}),et=v5(v,M,C,$,W,N,L),ot=v5(S,M,C,$,X??W,N,L),nt=it(D)?{signal:`(1-${D.signal})/2`}:co(D)?(1-D.band)/2:.5,mt=va({fieldDef:g,fieldDef2:y,markDef:w,config:b});if(Wt(g.bin)||g.timeUnit){const J=g.timeUnit&&mt!==.5;return{[z]:b5({fieldDef:g,scaleName:k,bandPosition:nt,offset:ot,useRectOffsetField:J}),[B]:b5({fieldDef:g,scaleName:k,bandPosition:it(nt)?{signal:`1-${nt.signal}`}:1-nt,offset:et,useRectOffsetField:J})}}if($n(g.bin)){const J=fo(g,k,{},{offset:ot});if(H(y))return{[z]:J,[B]:fo(y,k,{},{offset:et})};if(io(g.bin)&&g.bin.step)return{[z]:J,[B]:{signal:`scale("${k}", ${Y(g,{expr:"datum"})} + ${g.bin.step})`,offset:et}}}return void I(n3(S))}({fieldDef:u,fieldDef2:l,channel:n,model:t})}function kT(t,n,e,r,i,a,o){if(co(i)){if(!e)return{mult:i.band,field:{group:t}};{const s=e.get("type");if(s==="band"){let u=`bandwidth('${n}')`;i.band!==1&&(u=`${i.band} * ${u}`);const l=Wr("minBandSize",{type:o},r);return{signal:l?`max(${pr(l)}, ${u})`:u}}i.band!==1&&(I(function(u){return`Cannot use the relative band size with ${u} scale.`}(s)),i=void 0)}}else{if(it(i))return i;if(i)return{value:i}}if(e){const s=e.get("range");if(ao(s)&&$t(s.step))return{value:s.step-2}}if(!a){const{bandPaddingInner:s,barBandPaddingInner:u,rectBandPaddingInner:l,tickBandPaddingInner:c}=r.scale,f=un(s,o==="tick"?c:o==="bar"?u:l);if(it(f))return{signal:`(1 - (${f.signal})) * ${t}`};if($t(f))return{signal:`${1-f} * ${t}`}}return{value:Tv(r.view,t)-2}}function v5(t,n,e,r,i,a,o){if(yE(t))return 0;const s=t==="x"||t==="y2",u=s?-n/2:n/2;if(it(e)||it(i)||it(r)||a){const l=pr(e),c=pr(i),f=pr(r),d=pr(a),h=a?`(${o} < ${d} ? ${s?"":"-"}0.5 * (${d} - (${o})) : ${u})`:u;return{signal:(f?`${f} + `:"")+(l?`(${l} ? -1 : 1) * `:"")+(c?`(${c} + ${h})`:h)}}return i=i||0,r+(e?-i-u:+i+u)}function b5({fieldDef:t,scaleName:n,bandPosition:e,offset:r,useRectOffsetField:i}){return th({scaleName:n,fieldOrDatumDef:t,bandPosition:e,offset:r,...i?{startSuffix:vh,endSuffix:bh}:{}})}const DT=new Set(["aria","width","height"]);function Xe(t,n){const{fill:e,stroke:r}=n.color==="include"?p5(t):{};return{...FT(t.markDef,n),...x5("fill",e),...x5("stroke",r),...Mn("opacity",t),...Mn("fillOpacity",t),...Mn("strokeOpacity",t),...Mn("strokeWidth",t),...Mn("strokeDash",t),...wT(t),...f5(t),...Zv(t,"href"),...vT(t)}}function x5(t,n){return n?{[t]:n}:{}}function FT(t,n){return CN.reduce((e,r)=>(!DT.has(r)&&U(t,r)&&n[r]!=="ignore"&&(e[r]=Gt(t[r])),e),{})}function nb(t){const{config:n,markDef:e}=t,r=new Set;if(t.forEachFieldDef((i,a)=>{var c;let o;if(!Ir(a)||!(o=t.getScaleType(a)))return;const s=Ud(i.aggregate);if((l=pv({scaleChannel:a,markDef:e,config:n,scaleType:o,isCountAggregate:s}))==="break-paths-filter-domains"||l==="break-paths-show-domains"){const f=t.vgField(a,{expr:"datum",binSuffix:(c=t.stack)!=null&&c.impute?"mid":void 0});f&&r.add(f)}var l}),r.size>0)return{defined:{signal:[...r].map(a=>Vd(a,!0)).join(" && ")}}}function w5(t,n){if(n!==void 0)return{[t]:Gt(n)}}const eb="voronoi",A5={defined:t=>t.type==="point"&&t.nearest,parse:(t,n)=>{if(n.events)for(const e of n.events)e.markname=t.getName(eb)},marks:(t,n,e)=>{const{x:r,y:i}=n.project.hasChannel,a=t.mark;if(ya(a))return I(`The "nearest" transform is not supported for ${a} marks.`),e;const o={name:t.getName(eb),type:"path",interactive:!0,from:{data:t.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...f5(t,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let s=0,u=!1;return e.forEach((l,c)=>{const f=l.name??"";f===t.component.mark[0].name?s=c:f.includes(eb)&&(u=!0)}),u||e.splice(s+1,0,o),e}},_5={defined:t=>t.type==="point"&&t.resolve==="global"&&t.bind&&t.bind!=="scales"&&!Mv(t.bind),parse:(t,n,e)=>z5(n,e),topLevelSignals:(t,n,e)=>{const r=n.name,i=n.project,a=n.bind,o=n.init&&n.init[0],s=A5.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((u,l)=>{const c=Xt(`${r}_${u.field}`);e.filter(f=>f.name===c).length||e.unshift({name:c,...o?{init:go(o[l])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${G(u.field)}] : null`}]:[],bind:a[u.field]??a[u.channel]??a})}),e},signals:(t,n,e)=>{const r=n.name,i=n.project,a=e.find(l=>l.name===r+$i),o=r+El,s=i.items.map(l=>Xt(`${r}_${l.field}`)),u=s.map(l=>`${l} !== null`).join(" && ");return s.length&&(a.update=`${u} ? {fields: ${o}, values: [${s.join(", ")}]} : null`),delete a.value,delete a.on,e}},kh="_toggle",k5={defined:t=>t.type==="point"&&!Kr(t)&&!!t.toggle,signals:(t,n,e)=>e.concat({name:n.name+kh,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(t,n)=>{const e=n.name+$i,r=n.name+kh;return`${r} ? null : ${e}, `+(n.resolve==="global"?`${r} ? null : true, `:`${r} ? null : {unit: ${vo(t)}}, `)+`${r} ? ${e} : null`}},CT={defined:t=>t.clear!==void 0&&t.clear!==!1&&!Kr(t),parse:(t,n)=>{n.clear&&(n.clear=Q(n.clear)?aa(n.clear,"view"):n.clear)},topLevelSignals:(t,n,e)=>{if(_5.defined(n))for(const r of n.project.items){const i=e.findIndex(a=>a.name===Xt(`${n.name}_${r.field}`));i!==-1&&e[i].on.push({events:n.clear,update:"null"})}return e},signals:(t,n,e)=>{function r(i,a){i!==-1&&e[i].on&&e[i].on.push({events:n.clear,update:a})}if(n.type==="interval")for(const i of n.project.items){const a=e.findIndex(o=>o.name===i.signals.visual);r(a,"[0, 0]"),a===-1&&r(e.findIndex(o=>o.name===i.signals.data),"null")}else{let i=e.findIndex(a=>a.name===n.name+$i);r(i,"null"),k5.defined(n)&&(i=e.findIndex(a=>a.name===n.name+kh),r(i,"false"))}return e}},D5={defined:t=>{const n=t.resolve==="global"&&t.bind&&Mv(t.bind),e=t.project.items.length===1&&t.project.items[0].field!==br;return n&&!e&&I("Legend bindings are only supported for selections over an individual field or encoding channel."),n&&e},parse:(t,n,e)=>{const r=ft(e);if(r.select=Q(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},z5(n,r),Z(e.select)&&(e.select.on||e.select.clear)){const o='event.item && indexof(event.item.mark.role, "legend") < 0';for(const s of n.events)s.filter=K(s.filter??[]),s.filter.includes(o)||s.filter.push(o)}const i=Bv(n.bind)?n.bind.legend:"click",a=Q(i)?aa(i,"view"):K(i);n.bind={legend:{merge:a}}},topLevelSignals:(t,n,e)=>{const r=n.name,i=Bv(n.bind)&&n.bind.legend,a=o=>s=>{const u=ft(s);return u.markname=o,u};for(const o of n.project.items){if(!o.hasLegend)continue;const s=`${Xt(o.field)}_legend`,u=`${r}_${s}`;if(e.filter(l=>l.name===u).length===0){const l=i.merge.map(a(`${s}_symbols`)).concat(i.merge.map(a(`${s}_labels`))).concat(i.merge.map(a(`${s}_entries`)));e.unshift({name:u,...n.init?{}:{value:null},on:[{events:l,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return e},signals:(t,n,e)=>{const r=n.name,i=n.project,a=e.find(f=>f.name===r+$i),o=r+El,s=i.items.filter(f=>f.hasLegend).map(f=>Xt(`${r}_${Xt(f.field)}_legend`)),u=`${s.map(f=>`${f} !== null`).join(" && ")} ? {fields: ${o}, values: [${s.join(", ")}]} : null`;n.events&&s.length>0?a.on.push({events:s.map(f=>({signal:f})),update:u}):s.length>0&&(a.update=u,delete a.value,delete a.on);const l=e.find(f=>f.name===r+kh),c=Bv(n.bind)&&n.bind.legend;return l&&(n.events?l.on.push({...l.on[0],events:c}):l.on[0].events=c),e}},F5="_translate_anchor",C5="_translate_delta",ET={defined:t=>t.type==="interval"&&t.translate,signals:(t,n,e)=>{const r=n.name,i=Ci.defined(n),a=r+F5,{x:o,y:s}=n.project.hasChannel;let u=aa(n.translate,"scope");return i||(u=u.map(l=>(l.between[0].markname=r+Ms,l))),e.push({name:a,value:{},on:[{events:u.map(l=>l.between[0]),update:"{x: x(unit), y: y(unit)"+(o!==void 0?`, extent_x: ${i?Kv(t,Jt):`slice(${o.signals.visual})`}`:"")+(s!==void 0?`, extent_y: ${i?Kv(t,bn):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:r+C5,value:{},on:[{events:u,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),o!==void 0&&E5(t,n,o,"width",e),s!==void 0&&E5(t,n,s,"height",e),e}};function E5(t,n,e,r,i){const a=n.name,o=a+F5,s=a+C5,u=e.channel,l=Ci.defined(n),c=i.find(y=>y.name===e.signals[l?"data":"visual"]),f=t.getSizeSignalRef(r).signal,d=t.getScaleComponent(u),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${o}.extent_${u}`,g=`${l&&d?h==="log"?"panLog":h==="symlog"?"panSymlog":h==="pow"?"panPow":"panLinear":"panLinear"}(${m}, ${`${l?u===Jt?p?"":"-":p?"-":"":""}${s}.${u} / ${l?`${f}`:`span(${m})`}`}${l?h==="pow"?`, ${d.get("exponent")??1}`:h==="symlog"?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:l?g:`clampRange(${g}, 0, ${f})`})}const $5="_zoom_anchor",S5="_zoom_delta",$T={defined:t=>t.type==="interval"&&t.zoom,signals:(t,n,e)=>{const r=n.name,i=Ci.defined(n),a=r+S5,{x:o,y:s}=n.project.hasChannel,u=G(t.scaleName(Jt)),l=G(t.scaleName(bn));let c=aa(n.zoom,"scope");return i||(c=c.map(f=>(f.markname=r+Ms,f))),e.push({name:r+$5,on:[{events:c,update:i?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),o!==void 0&&M5(t,n,o,"width",e),s!==void 0&&M5(t,n,s,"height",e),e}};function M5(t,n,e,r,i){const a=n.name,o=e.channel,s=Ci.defined(n),u=i.find(m=>m.name===e.signals[s?"data":"visual"]),l=t.getSizeSignalRef(r).signal,c=t.getScaleComponent(o),f=c&&c.get("type"),d=s?Kv(t,o):u.name,h=a+S5,p=`${s&&c?f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${a}${$5}.${o}`}, ${h}${s?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":""})`;u.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${l})`})}const yo="_store",$i="_tuple",ST="_modify",B5="vlSelectionResolve",Dh=[pT,yT,dT,k5,_5,Ci,D5,CT,ET,$T,A5];function vo(t,{escape:n}={escape:!0}){let e=n?G(t.name):t.name;const r=function(i){let a=i.parent;for(;a&&!$e(a);)a=a.parent;return a}(t);if(r){const{facet:i}=r;for(const a of Ye)i[a]&&(e+=` + '__facet_${a}_' + (facet[${G(r.vgField(a))}])`)}return e}function rb(t){return En(t.component.selection??{}).reduce((n,e)=>n||e.project.hasSelectionId,!1)}function z5(t,n){!Q(n.select)&&n.select.on||delete t.events,!Q(n.select)&&n.select.clear||delete t.clear,!Q(n.select)&&n.select.toggle||delete t.toggle}function Kr(t){var n;return(n=t.events)==null?void 0:n.find(e=>"type"in e&&e.type==="timer")}const MT="Property",BT="ArrayExpression",zT="BinaryExpression",OT="CallExpression",NT="ConditionalExpression",RT="LogicalExpression",TT="MemberExpression",PT="ObjectExpression",jT="UnaryExpression";function wr(t){this.type=t}var Si,at,T,Ln,Rt;wr.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(i){switch(i.type){case BT:return i.elements;case zT:case RT:return[i.left,i.right];case OT:return[i.callee].concat(i.arguments);case NT:return[i.test,i.consequent,i.alternate];case TT:return[i.object,i.property];case PT:return i.properties;case MT:return[i.key,i.value];case jT:return[i.argument];default:return[]}}(this),e=0,r=n.length;e",Si[3]="Identifier",Si[4]="Keyword",Si[5]="Null",Si[6]="Numeric",Si[7]="Punctuator",Si[8]="String",Si[9]="RegularExpression";var O5="Identifier",An="Unexpected token %0",ib="Invalid regular expression",ab="Invalid regular expression: missing /",N5="Octal literals are not allowed in strict mode.",Bn="ILLEGAL",Ml="Disabled.",LT=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),qT=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Fh(t,n){if(!t)throw new Error("ASSERT: "+n)}function Mi(t){return t>=48&&t<=57}function ob(t){return"0123456789abcdefABCDEF".includes(t)}function Bl(t){return"01234567".includes(t)}function UT(t){return t===32||t===9||t===11||t===12||t===160||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function zl(t){return t===10||t===13||t===8232||t===8233}function Ol(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t===92||t>=128&<.test(String.fromCharCode(t))}function Ch(t){return t===36||t===95||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===92||t>=128&&qT.test(String.fromCharCode(t))}const IT={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function R5(){for(;T1114111||t!=="}")&&Ct({},An,Bn),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function T5(){var t,n;for(t=at.charCodeAt(T++),n=String.fromCharCode(t),t===92&&(at.charCodeAt(T)!==117&&Ct({},An,Bn),++T,(t=sb("u"))&&t!=="\\"&&Ol(t.charCodeAt(0))||Ct({},An,Bn),n=t);T>>="?{type:7,value:r,start:i,end:T+=4}:(e=r.substr(0,3))===">>>"||e==="<<="||e===">>="?{type:7,value:e,start:i,end:T+=3}:o===(n=e.substr(0,2))[1]&&"+-<>&|".includes(o)||n==="=>"?{type:7,value:n,start:i,end:T+=2}:(n==="//"&&Ct({},An,Bn),"<>=!+-*%&|^/".includes(o)?{type:7,value:o,start:i,end:++T}:void Ct({},An,Bn))}function P5(){var t,n,e;if(Fh(Mi((e=at[T]).charCodeAt(0))||e===".","Numeric literal must start with a decimal digit or a decimal point"),n=T,t="",e!=="."){if(t=at[T++],e=at[T],t==="0"){if(e==="x"||e==="X")return++T,function(r){let i="";for(;T=0&&Ct({},ib,o),{value:o,literal:a}}(),r=function(i,a){let o=i;a.includes("u")&&(o=o.replace(/\\u\{([0-9a-fA-F]+)\}/g,(s,u)=>{if(parseInt(u,16)<=1114111)return"x";Ct({},ib)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(o)}catch{Ct({},ib)}try{return new RegExp(i,a)}catch{return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:T}}function j5(){if(R5(),T>=Ln)return{type:2,start:T,end:T};const t=at.charCodeAt(T);return Ol(t)?HT():t===40||t===41||t===59?ub():t===39||t===34?function(){var n,e,r,i,a="",o=!1;for(Fh((n=at[T])==="'"||n==='"',"String literal must starts with a quote"),e=T,++T;T(Fh(o":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function bo(){var t,n;return t=function(){var e,r,i,a,o,s,u,l,c,f;if(e=Rt,c=$h(),(o=G5(a=Rt))===0)return c;for(a.prec=o,ve(),r=[e,Rt],s=[c,a,u=$h()];(o=G5(Rt))>0;){for(;s.length>2&&o<=s[s.length-2].prec;)u=s.pop(),l=s.pop().value,c=s.pop(),r.pop(),i=q5(l,c,u),s.push(i);(a=ve()).prec=o,s.push(a),r.push(Rt),i=$h(),s.push(i)}for(i=s[f=s.length-1],r.pop();f>1;)r.pop(),i=q5(s[f-1].value,s[f-2],i),f-=2;return i}(),Vt("?")&&(ve(),n=bo(),qn(":"),t=function(e,r,i){const a=new wr("ConditionalExpression");return a.test=e,a.consequent=r,a.alternate=i,a}(t,n,bo())),t}function fb(){const t=bo();if(Vt(","))throw new Error(Ml);return t}function db(t){const n=[];return t.type==="Identifier"?[t.name]:t.type==="Literal"?[t.value]:(t.type==="MemberExpression"&&(n.push(...db(t.object)),n.push(...db(t.property))),n)}function V5(t){return t.object.type==="MemberExpression"?V5(t.object):t.object.name==="datum"}function Y5(t){const n=function(r){T=0,Ln=(at=r).length,Rt=null,L5();const i=fb();if(Rt.type!==2)throw new Error("Unexpect token after expression.");return i}(t),e=new Set;return n.visit(r=>{r.type==="MemberExpression"&&V5(r)&&e.add(db(r).slice(1).join("."))}),e}class Ts extends Nt{clone(){return new Ts(null,this.model,ft(this.filter))}constructor(n,e,r){super(n),this.model=e,this.filter=r,this.expr=Sh(this.model,this.filter,this),this._dependentFields=Y5(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function X5(t,n,e,r="datum"){const i=Q(n)?n:n.param,a=Xt(i),o=G(a+yo);let s;try{s=t.getSelectionComponent(a,i)}catch{return`!!${a}`}if(s.project.timeUnit){const c=e??t.component.data.raw,f=s.project.timeUnit.clone();c.parent?f.insertAsParentOf(c):c.parent=f}const u=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${o}, ${r}${s.resolve==="global"?")":`, ${G(s.resolve)})`}`,l=`length(data(${o}))`;return n.empty===!1?`${l} && ${u}`:`!${l} || ${u}`}function J5(t,n,e){const r=Xt(n),i=e.encoding;let a,o=e.field;try{a=t.getSelectionComponent(r,n)}catch{return r}if(i||o){if(i&&!o){const s=a.project.items.filter(u=>u.channel===i);!s.length||s.length>1?(o=a.project.items[0].field,I(function(u,l,c,f){return(u.length?"Multiple ":"No ")+`matching ${G(l)} encoding found for selection ${G(c.param)}. Using "field": ${G(f)}.`}(s,i,e,o))):o=s[0].field}}else o=a.project.items[0].field,a.project.items.length>1&&I(function(s){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${G(s)}.`}(o));return`${a.name}[${G(He(o))}]`}function Sh(t,n,e){return fl(n,r=>Q(r)?r:function(i){return U(i,"param")}(r)?X5(t,r,e):h3(r))}function hb(t,n,e,r){var i,a;t.encode??(t.encode={}),(i=t.encode)[n]??(i[n]={}),(a=t.encode[n]).update??(a.update={}),t.encode[n].update[e]=r}function Rl(t,n,e,r={header:!1}){var f,d;const{disable:i,orient:a,scale:o,labelExpr:s,title:u,zindex:l,...c}=t.combine();if(!i){for(const h in c){const p=h,m=gR[p],g=c[p];if(m&&m!==n&&m!=="both")delete c[p];else if(Fl(g)){const{condition:y,...v}=g,x=K(y),b=Q3[p];if(b){const{vgProp:w,part:A}=b,_=[...x.map(k=>{const{test:F,...C}=k;return{test:Sh(null,F),...C}}),v];hb(c,A,w,_),delete c[p]}else if(b===null){const w={signal:x.map(A=>{const{test:_,...k}=A;return`${Sh(null,_)} ? ${OE(k)} : `}).join("")+OE(v)};c[p]=w}}else if(it(g)){const y=Q3[p];if(y){const{vgProp:v,part:x}=y;hb(c,x,v,g),delete c[p]}}vt(["labelAlign","labelBaseline"],p)&&c[p]===null&&delete c[p]}if(n==="grid"){if(!c.grid)return;if(c.encode){const{grid:h}=c.encode;c.encode={...h?{grid:h}:{}},jt(c.encode)&&delete c.encode}return{scale:o,orient:a,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:un(l,0)}}{if(!r.header&&t.mainExtracted)return;if(s!==void 0){let p=s;(d=(f=c.encode)==null?void 0:f.labels)!=null&&d.update&&it(c.encode.labels.update.text)&&(p=to(s,"datum.label",c.encode.labels.update.text.signal)),hb(c,"labels","text",{signal:p})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const p of Z3)t.hasAxisPart(p)||delete c.encode[p];jt(c.encode)&&delete c.encode}const h=function(p,m){if(p)return P(p)&&!ga(p)?p.map(g=>Av(g,m)).join(", "):p}(u,e);return{scale:o,orient:a,grid:!1,...h?{title:h}:{},...c,...e.aria===!1?{aria:!1}:{},zindex:un(l,0)}}}}function K5(t){const{axes:n}=t.component,e=[];for(const r of wi)if(n[r]){for(const i of n[r])if(!i.get("disable")&&!i.get("gridScale")){const a=r==="x"?"height":"width",o=t.getSizeSignalRef(a).signal;a!==o&&e.push({name:a,update:o})}}return e}function Q5(t,n,e,r){return Object.assign.apply(null,[{},...t.map(i=>{if(i==="axisOrient"){const a=e==="x"?"bottom":"left",o=n[e==="x"?"axisBottom":"axisLeft"]||{},s=n[e==="x"?"axisTop":"axisRight"]||{},u=new Set([...q(o),...q(s)]),l={};for(const c of u.values())l[c]={signal:`${r.signal} === "${a}" ? ${pr(o[c])} : ${pr(s[c])}`};return l}return n[i]})])}function eP(t,n){var r;const e=[{}];for(const i of t){let a=(r=n[i])==null?void 0:r.style;if(a){a=K(a);for(const o of a)e.push(n.style[o])}}return Object.assign.apply(null,e)}function pb(t,n,e,r={}){var a;const i=RE(t,e,n);if(i!==void 0)return{configFrom:"style",configValue:i};for(const o of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((a=r[o])==null?void 0:a[t])!==void 0)return{configFrom:o,configValue:r[o][t]};return{}}const Z5={scale:({model:t,channel:n})=>t.scaleName(n),format:({format:t})=>t,formatType:({formatType:t})=>t,grid:({fieldOrDatumDef:t,axis:n,scaleType:e})=>n.grid??function(r,i){return!wn(r)&&H(i)&&!Wt(i==null?void 0:i.bin)&&!$n(i==null?void 0:i.bin)}(e,t),gridScale:({model:t,channel:n})=>function(e,r){const i=r==="x"?"y":"x";if(e.getScaleComponent(i))return e.scaleName(i)}(t,n),labelAlign:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelAlign||nS(n,e,r),labelAngle:({labelAngle:t})=>t,labelBaseline:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelBaseline||tS(n,e,r),labelFlush:({axis:t,fieldOrDatumDef:n,channel:e})=>t.labelFlush??function(r,i){if(i==="x"&&vt(["quantitative","temporal"],r))return!0}(n.type,e),labelOverlap:({axis:t,fieldOrDatumDef:n,scaleType:e})=>t.labelOverlap??function(r,i,a,o){if(a&&!Z(o)||r!=="nominal"&&r!=="ordinal")return i!=="log"&&i!=="symlog"||"greedy"}(n.type,e,H(n)&&!!n.timeUnit,H(n)?n.sort:void 0),orient:({orient:t})=>t,tickCount:({channel:t,model:n,axis:e,fieldOrDatumDef:r,scaleType:i})=>{const a=t==="x"?"width":t==="y"?"height":void 0,o=a?n.getSizeSignalRef(a):void 0;return e.tickCount??function({fieldOrDatumDef:s,scaleType:u,size:l,values:c}){var f;if(!c&&!wn(u)&&u!=="log"){if(H(s)){if(Wt(s.bin))return{signal:`ceil(${l.signal}/10)`};if(s.timeUnit&&vt(["month","hours","day","quarter"],(f=xn(s.timeUnit))==null?void 0:f.unit))return}return{signal:`ceil(${l.signal}/40)`}}}({fieldOrDatumDef:r,scaleType:i,size:o,values:e.values})},tickMinStep:function({format:t,fieldOrDatumDef:n}){if(t==="d")return 1;if(H(n)){const{timeUnit:e}=n;if(e){const r=c3(e);if(r)return{signal:r}}}},title:({axis:t,model:n,channel:e})=>{if(t.title!==void 0)return t.title;const r=eS(n,e);if(r!==void 0)return r;const i=n.typedFieldDef(e),a=e==="x"?"x2":"y2",o=n.fieldDef(a);return PE(i?[L3(i)]:[],H(o)?[L3(o)]:[])},values:({axis:t,fieldOrDatumDef:n})=>function(e,r){const i=e.values;if(P(i))return K3(r,i);if(it(i))return i}(t,n),zindex:({axis:t,fieldOrDatumDef:n,mark:e})=>t.zindex??function(r,i){return r==="rect"&&ah(i)?1:0}(e,n)};function mb(t){return`(((${t.signal} % 360) + 360) % 360)`}function tS(t,n,e,r){if(t!==void 0){if(e==="x"){if(it(t)){const i=mb(t);return{signal:`(45 < ${i} && ${i} < 135) || (225 < ${i} && ${i} < 315) ? "middle" :(${i} <= 45 || 315 <= ${i}) === ${it(n)?`(${n.signal} === "top")`:n==="top"} ? "bottom" : "top"`}}if(45{if(po(r)&&j3(r.sort)){const{field:a,timeUnit:o}=r,s=r.sort,u=s.map((l,c)=>`${h3({field:a,timeUnit:o,equal:l})} ? ${c} : `).join("")+s.length;n=new js(n,{calculate:u,as:zs(r,i,{forAs:!0})})}}),n}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${wt(this.transform)}`}}function zs(t,n,e){return Y(t,{prefix:n,suffix:"sort_index",...e})}function Mh(t,n){return vt(["top","bottom"],n)?"column":vt(["left","right"],n)||t==="row"?"row":"column"}function Os(t,n,e,r){const i=r==="row"?e.headerRow:r==="column"?e.headerColumn:e.headerFacet;return un((n||{})[t],i[t],e.header[t])}function Bh(t,n,e,r){const i={};for(const a of t){const o=Os(a,n||{},e,r);o!==void 0&&(i[a]=o)}return i}const gb=["row","column"],yb=["header","footer"];function rP(t,n){const e=t.component.layoutHeaders[n].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[n].facetFieldDef?t.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:a,titleAngle:o,titleOrient:s}=Bh(["titleAnchor","titleAngle","titleOrient"],i.header,r,n),u=Mh(n,s),l=hl(o);return{name:`${n}-title`,type:"group",role:`${u}-title`,title:{text:e,...n==="row"?{orient:"left"}:{},style:"guide-title",...iS(l,u),...rS(u,l,a),...aS(r,i,n,kR,b$)}}}function rS(t,n,e="middle"){switch(e){case"start":return{align:"left"};case"end":return{align:"right"}}const r=nS(n,t==="row"?"left":"top",t==="row"?"y":"x");return r?{align:r}:{}}function iS(t,n){const e=tS(t,n==="row"?"left":"top",n==="row"?"y":"x",!0);return e?{baseline:e}:{}}function iP(t,n){const e=t.component.layoutHeaders[n],r=[];for(const i of yb)if(e[i])for(const a of e[i]){const o=oP(t,n,i,e,a);o!=null&&r.push(o)}return r}function aP(t,n){const{sort:e}=t;return ki(e)?{field:Y(e,{expr:"datum"}),order:e.order??"ascending"}:P(e)?{field:zs(t,n,{expr:"datum"}),order:"ascending"}:{field:Y(t,{expr:"datum"}),order:e??"ascending"}}function vb(t,n,e){const{format:r,formatType:i,labelAngle:a,labelAnchor:o,labelOrient:s,labelExpr:u}=Bh(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],t.header,e,n),l=yv({fieldOrDatumDef:t,format:r,formatType:i,expr:"parent",config:e}).signal,c=Mh(n,s);return{text:{signal:u?to(to(u,"datum.label",l),"datum.value",Y(t,{expr:"parent"})):l},...n==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...iS(a,c),...rS(c,a,o),...aS(e,t,n,DR,x$)}}function oP(t,n,e,r,i){if(i){let a=null;const{facetFieldDef:o}=r,s=t.config?t.config:void 0;if(o&&i.labels){const{labelOrient:f}=Bh(["labelOrient"],o.header,s,n);(n==="row"&&!vt(["top","bottom"],f)||n==="column"&&!vt(["left","right"],f))&&(a=vb(o,n,s))}const u=$e(t)&&!Al(t.facet),l=i.axes,c=(l==null?void 0:l.length)>0;if(a||c){const f=n==="row"?"height":"width";return{name:t.getName(`${n}_${e}`),type:"group",role:`${n}-${e}`,...r.facetFieldDef?{from:{data:t.getName(`${n}_domain`)},sort:aP(o,n)}:{},...c&&u?{from:{data:t.getName(`facet_domain_${n}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[f]:i.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const sP={column:{start:0,end:1},row:{start:1,end:0}};function uP(t,n){return sP[n][t]}function aS(t,n,e,r,i){const a={};for(const o of r){if(!i[o])continue;const s=Os(o,n==null?void 0:n.header,t,e);s!==void 0&&(a[i[o]]=s)}return a}function bb(t){return[...zh(t,"width"),...zh(t,"height"),...zh(t,"childWidth"),...zh(t,"childHeight")]}function zh(t,n){const e=n==="width"?"x":"y",r=t.component.layoutSize.get(n);if(!r||r==="merged")return[];const i=t.getSizeSignalRef(n).signal;if(r==="step"){const a=t.getScaleComponent(e);if(a){const o=a.get("type"),s=a.get("range");if(wn(o)&&ao(s)){const u=t.scaleName(e);return $e(t.parent)&&t.parent.component.resolve.scale[e]==="independent"?[oS(u,s)]:[oS(u,s),{name:i,update:sS(u,a,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if(r=="container"){const a=i.endsWith("width"),o=a?"containerSize()[0]":"containerSize()[1]",s=`isFinite(${o}) ? ${o} : ${Rv(t.config.view,a?"width":"height")}`;return[{name:i,init:s,on:[{update:s,events:"window:resize"}]}]}return[{name:i,value:r}]}function oS(t,n){const e=`${t}_step`;return it(n.step)?{name:e,update:n.step.signal}:{name:e,value:n.step}}function sS(t,n,e){const r=n.get("type"),i=n.get("padding"),a=un(n.get("paddingOuter"),i);let o=n.get("paddingInner");return o=r==="band"?o!==void 0?o:i:1,`bandspace(${e}, ${pr(o)}, ${pr(a)}) * ${t}_step`}function uS(t){return t==="childWidth"?"width":t==="childHeight"?"height":t}function lS(t,n){return q(t).reduce((e,r)=>({...e,...Bs({model:n,channelDef:t[r],vgChannel:r,mainRefFn:i=>Gt(i.value),invalidValueRef:void 0})}),{})}function cS(t,n){if($e(n))return t==="theta"?"independent":"shared";if(Rs(n))return"shared";if(Nb(n))return ln(t)||t==="theta"||t==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function xb(t,n){const e=t.scale[n],r=ln(n)?"axis":"legend";return e==="independent"?(t[r][n]==="shared"&&I(function(i){return`Setting the scale to be independent for "${i}" means we also have to set the guide (axis or legend) to be independent.`}(n)),"independent"):t[r][n]||"shared"}const fS=q({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class lP extends Bi{}const dS={symbols:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i,legendType:a}){if(a!=="symbol")return;const{markDef:o,encoding:s,config:u,mark:l}=e,c=o.filled&&l!=="trail";let f={...SN({},e,uR),...p5(e,{filled:c})};const d=i.get("symbolOpacity")??u.legend.symbolOpacity,h=i.get("symbolFillColor")??u.legend.symbolFillColor,p=i.get("symbolStrokeColor")??u.legend.symbolStrokeColor,m=d===void 0?hS(s.opacity)??o.opacity:void 0;if(f.fill){if(r==="fill"||c&&r===pe)delete f.fill;else if(U(f.fill,"field"))h?delete f.fill:(f.fill=Gt(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Gt(m??1));else if(P(f.fill)){const g=wb(s.fill??s.color)??o.fill??(c&&o.color);g&&(f.fill=Gt(g))}}if(f.stroke){if(r==="stroke"||!c&&r===pe)delete f.stroke;else if(U(f.stroke,"field")||p)delete f.stroke;else if(P(f.stroke)){const g=un(wb(s.stroke||s.color),o.stroke,c?o.color:void 0);g&&(f.stroke={value:g})}}if(r!==xi){const g=H(n)&&mS(e,i,n);g?f.opacity=[{test:g,...Gt(m??1)},Gt(u.legend.unselectedOpacity)]:m&&(f.opacity=Gt(m))}return f={...f,...t},jt(f)?void 0:f},gradient:function(t,{model:n,legendType:e,legendCmpt:r}){if(e!=="gradient")return;const{config:i,markDef:a,encoding:o}=n;let s={};const u=(r.get("gradientOpacity")??i.legend.gradientOpacity)===void 0?hS(o.opacity)||a.opacity:void 0;return u&&(s.opacity=Gt(u)),s={...s,...t},jt(s)?void 0:s},labels:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i}){const a=e.legend(r)||{},o=e.config,s=H(n)?mS(e,i,n):void 0,u=s?[{test:s,value:1},{value:o.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=a;let f;ho(c)?f=gr({fieldOrDatumDef:n,field:"datum.value",format:l,formatType:c,config:o}):l===void 0&&c===void 0&&o.customFormatTypes&&(n.type==="quantitative"&&o.numberFormatType?f=gr({fieldOrDatumDef:n,field:"datum.value",format:o.numberFormat,formatType:o.numberFormatType,config:o}):n.type==="temporal"&&o.timeFormatType&&H(n)&&n.timeUnit===void 0&&(f=gr({fieldOrDatumDef:n,field:"datum.value",format:o.timeFormat,formatType:o.timeFormatType,config:o})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...t};return jt(d)?void 0:d},entries:function(t,{legendCmpt:n}){const e=n.get("selections");return e!=null&&e.length?{...t,fill:{value:"transparent"}}:t}};function hS(t){return pS(t,(n,e)=>Math.max(n,e.value))}function wb(t){return pS(t,(n,e)=>un(n,e.value))}function pS(t,n){return function(e){const r=e==null?void 0:e.condition;return!!r&&(P(r)||yr(r))}(t)?K(t.condition).reduce(n,t.value):yr(t)?t.value:void 0}function mS(t,n,e){const r=n.get("selections");if(!(r!=null&&r.length))return;const i=G(e.field);return r.map(a=>`(!length(data(${G(Xt(a)+yo)})) || (${a}[${i}] && indexof(${a}[${i}], datum.value) >= 0))`).join(" || ")}const gS={direction:({direction:t})=>t,format:({fieldOrDatumDef:t,legend:n,config:e})=>{const{format:r,formatType:i}=n;return O3(t,t.type,r,i,e,!1)},formatType:({legend:t,fieldOrDatumDef:n,scaleType:e})=>{const{formatType:r}=t;return N3(r,n,e)},gradientLength:t=>{const{legend:n,legendConfig:e}=t;return n.gradientLength??e.gradientLength??function({legendConfig:r,model:i,direction:a,orient:o,scaleType:s}){const{gradientHorizontalMaxLength:u,gradientHorizontalMinLength:l,gradientVerticalMaxLength:c,gradientVerticalMinLength:f}=r;if(Gr(s))return a==="horizontal"?o==="top"||o==="bottom"?yS(i,"width",l,u):l:yS(i,"height",f,c)}(t)},labelOverlap:({legend:t,legendConfig:n,scaleType:e})=>t.labelOverlap??n.labelOverlap??function(r){if(vt(["quantile","threshold","log","symlog"],r))return"greedy"}(e),symbolType:({legend:t,markDef:n,channel:e,encoding:r})=>t.symbolType??function(i,a,o,s){if(a!=="shape"){const u=wb(o)??s;if(u)return u}switch(i){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(n.type,e,r.shape,n.shape),title:({fieldOrDatumDef:t,config:n})=>Ds(t,n,{allowDisabling:!0}),type:({legendType:t,scaleType:n,channel:e})=>{if(bs(e)&&Gr(n)){if(t==="gradient")return}else if(t==="symbol")return;return t},values:({fieldOrDatumDef:t,legend:n})=>function(e,r){const i=e.values;if(P(i))return K3(r,i);if(it(i))return i}(n,t)};function cP(t){const{legend:n}=t;return un(n.type,function({channel:e,timeUnit:r,scaleType:i}){if(bs(e)){if(vt(["quarter","month","day"],r))return"symbol";if(Gr(i))return"gradient"}return"symbol"}(t))}function fP({legendConfig:t,legendType:n,orient:e,legend:r}){return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(i,a){switch(i){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return a==="gradient"?"horizontal":void 0}}(e,n)}function yS(t,n,e,r){return{signal:`clamp(${t.getSizeSignalRef(n).signal}, ${e}, ${r})`}}function vS(t){const n=Zt(t)?function(e){const{encoding:r}=e,i={};for(const a of[pe,...A$]){const o=mn(r[a]);o&&e.getScaleComponent(a)&&(a===me&&H(o)&&o.type===ws||(i[a]=hP(e,a)))}return i}(t):function(e){const{legends:r,resolve:i}=e.component;for(const a of e.children){vS(a);for(const o of q(a.component.legends))i.legend[o]=xb(e.component.resolve,o),i.legend[o]==="shared"&&(r[o]=bS(r[o],a.component.legends[o]),r[o]||(i.legend[o]="independent",delete r[o]))}for(const a of q(r))for(const o of e.children)o.component.legends[a]&&i.legend[a]==="shared"&&delete o.component.legends[a];return r}(t);return t.component.legends=n,n}function dP(t,n,e,r){switch(n){case"disable":return e!==void 0;case"values":return!!(e!=null&&e.values);case"title":if(n==="title"&&t===(r==null?void 0:r.title))return!0}return t===(e||{})[n]}function hP(t,n){var x;let e=t.legend(n);const{markDef:r,encoding:i,config:a}=t,o=a.legend,s=new lP({},function(b,w){const A=b.scaleName(w);if(b.mark==="trail"){if(w==="color")return{stroke:A};if(w==="size")return{strokeWidth:A}}return w==="color"?b.markDef.filled?{fill:A}:{stroke:A}:{[w]:A}}(t,n));(function(b,w,A){var k;const _=(k=b.fieldDef(w))==null?void 0:k.field;for(const F of En(b.component.selection??{})){const C=F.project.hasField[_]??F.project.hasChannel[w];if(C&&D5.defined(F)){const D=A.get("selections")??[];D.push(F.name),A.set("selections",D,!1),C.hasLegend=!0}}})(t,n,s);const u=e!==void 0?!e:o.disable;if(s.set("disable",u,e!==void 0),u)return s;e=e||{};const l=t.getScaleComponent(n).get("type"),c=mn(i[n]),f=H(c)?(x=xn(c.timeUnit))==null?void 0:x.unit:void 0,d=e.orient||a.legend.orient||"right",h=cP({legend:e,channel:n,timeUnit:f,scaleType:l}),p={legend:e,channel:n,model:t,markDef:r,encoding:i,fieldOrDatumDef:c,legendConfig:o,config:a,scaleType:l,orient:d,legendType:h,direction:fP({legend:e,legendType:h,orient:d,legendConfig:o})};for(const b of fS){if(h==="gradient"&&b.startsWith("symbol")||h==="symbol"&&b.startsWith("gradient"))continue;const w=b in gS?gS[b](p):e[b];if(w!==void 0){const A=dP(w,b,e,t.fieldDef(n));(A||a.legend[b]===void 0)&&s.set(b,w,A)}}const m=(e==null?void 0:e.encoding)??{},g=s.get("selections"),y={},v={fieldOrDatumDef:c,model:t,channel:n,legendCmpt:s,legendType:h};for(const b of["labels","legend","title","symbols","gradient","entries"]){const w=lS(m[b]??{},t),A=b in dS?dS[b](w,v):w;A===void 0||jt(A)||(y[b]={...g!=null&&g.length&&H(c)?{name:`${Xt(c.field)}_legend_${b}`}:{},...g!=null&&g.length?{interactive:!!g}:{},update:A})}return jt(y)||s.set("encode",y,!!(e!=null&&e.encoding)),s}function bS(t,n){var a,o,s,u;if(!t)return n.clone();const e=t.getWithExplicit("orient"),r=n.getWithExplicit("orient");if(e.explicit&&r.explicit&&e.value!==r.value)return;let i=!1;for(const l of fS){const c=xa(t.getWithExplicit(l),n.getWithExplicit(l),l,"legend",(f,d)=>{switch(l){case"symbolType":return pP(f,d);case"title":return LE(f,d);case"type":return i=!0,xr("symbol")}return yh(f,d,l,"legend")});t.setWithExplicit(l,c)}return i&&((o=(a=t.implicit)==null?void 0:a.encode)!=null&&o.gradient&&zd(t.implicit,["encode","gradient"]),(u=(s=t.explicit)==null?void 0:s.encode)!=null&&u.gradient&&zd(t.explicit,["encode","gradient"])),t}function pP(t,n){return n.value==="circle"?n:t}function xS(t){const n=t.component.legends,e={};for(const i of q(n)){const a=Lt(t.getScaleComponent(i).get("domains"));if(e[a])for(const o of e[a])bS(o,n[i])||e[a].push(n[i]);else e[a]=[n[i].clone()]}return En(e).flat().map(i=>function(a,o){var f,d,h;const{disable:s,labelExpr:u,selections:l,...c}=a.combine();if(!s){if(o.aria===!1&&c.aria==null&&(c.aria=!1),(f=c.encode)!=null&&f.symbols){const p=c.encode.symbols.update;!p.fill||p.fill.value==="transparent"||p.stroke||c.stroke||(p.stroke={value:"transparent"});for(const m of A$)c[m]&&delete p[m]}if(c.title||delete c.title,u!==void 0){let p=u;(h=(d=c.encode)==null?void 0:d.labels)!=null&&h.update&&it(c.encode.labels.update.text)&&(p=to(u,"datum.label",c.encode.labels.update.text.signal)),function(m,g,y,v){var x,b;m.encode??(m.encode={}),(x=m.encode)[g]??(x[g]={}),(b=m.encode[g]).update??(b.update={}),m.encode[g].update[y]=v}(c,"labels","text",{signal:p})}return c}}(i,t.config)).filter(i=>i!==void 0)}function mP(t){return Rs(t)||Nb(t)?function(n){return n.children.reduce((e,r)=>e.concat(r.assembleProjections()),wS(n))}(t):wS(t)}function wS(t){const n=t.component.projection;if(!n||n.merged)return[];const e=n.combine(),{name:r}=e;if(n.data){const i={signal:`[${n.size.map(o=>o.signal).join(", ")}]`},a=n.data.reduce((o,s)=>{const u=it(s)?s.signal:`data('${t.lookupDataSource(s)}')`;return vt(o,u)||o.push(u),o},[]);if(a.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(", ")}]`:a[0]},...e}]}return[{name:r,translate:{signal:"[width / 2, height / 2]"},...e}]}const gP=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class AS extends Bi{constructor(n,e,r,i){super({...e},{name:n}),this.specifiedProjection=e,this.size=r,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function _S(t){t.component.projection=Zt(t)?function(n){if(n.hasProjection){const e=Sn(n.specifiedProjection),r=!(e&&(e.scale!=null||e.translate!=null)),i=r?[n.getSizeSignalRef("width"),n.getSizeSignalRef("height")]:void 0,a=r?function(s){const u=[],{encoding:l}=s;for(const c of[[dr,fr],[Ve,hr]])(mn(l[c[0]])||mn(l[c[1]]))&&u.push({signal:s.getName(`geojson_${u.length}`)});return s.channelHasField(me)&&s.typedFieldDef(me).type===ws&&u.push({signal:s.getName(`geojson_${u.length}`)}),u.length===0&&u.push(s.requestDataName(Qt.Main)),u}(n):void 0,o=new AS(n.projectionName(!0),{...Sn(n.config.projection),...e},i,a);return o.get("type")||o.set("type","equalEarth",!1),o}}(t):function(n){if(n.children.length===0)return;let e;for(const i of n.children)_S(i);const r=ky(n.children,i=>{const a=i.component.projection;if(a){if(e){const o=function(s,u){const l=ky(gP,f=>!tt(s.explicit,f)&&!tt(u.explicit,f)||!!(tt(s.explicit,f)&&tt(u.explicit,f)&&Ce(s.get(f),u.get(f))));if(Ce(s.size,u.size)){if(l)return s;if(Ce(s.explicit,{}))return u;if(Ce(u.explicit,{}))return s}return null}(e,a);return o&&(e=o),!!o}return e=a,!0}return!0});if(e&&r){const i=n.projectionName(!0),a=new AS(i,e.specifiedProjection,e.size,ft(e.data));for(const o of n.children){const s=o.component.projection;s&&(s.isFit&&a.data.push(...o.component.projection.data),o.renameProjection(s.get("name"),i),s.merged=!0)}return a}}(t)}function yP(t,n,e,r){if(Dl(n,e)){const i=Zt(t)?t.axis(e)??t.legend(e)??{}:{},a=Y(n,{expr:"datum"}),o=Y(n,{expr:"datum",binSuffix:"end"});return{formulaAs:Y(n,{binSuffix:"range",forAs:!0}),formula:wl(a,o,i.format,i.formatType,r)}}return{}}function kS(t,n){return`${$E(t)}_${n}`}function Ab(t,n,e){const r=kS(uh(e,void 0)??{},n);return t.getName(`${r}_bins`)}function DS(t,n,e){let r,i;r=function(l){return"as"in l}(t)?Q(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[Y(t,{forAs:!0}),Y(t,{binSuffix:"end",forAs:!0})];const a={...uh(n,void 0)},o=kS(a,t.field),{signal:s,extentSignal:u}=function(l,c){return{signal:l.getName(`${c}_bins`),extentSignal:l.getName(`${c}_extent`)}}(e,o);if(Id(a.extent)){const l=a.extent;i=J5(e,l.param,l),delete a.extent}return{key:o,binComponent:{bin:a,field:t.field,as:[r],...s?{signal:s}:{},...u?{extentSignal:u}:{},...i?{span:i}:{}}}}class Zr extends Nt{clone(){return new Zr(null,ft(this.bins))}constructor(n,e){super(n),this.bins=e}static makeFromEncoding(n,e){const r=e.reduceFieldDef((i,a,o)=>{if(oe(a)&&Wt(a.bin)){const{key:s,binComponent:u}=DS(a,a.bin,e);i[s]={...u,...i[s],...yP(e,a,o,e.config)}}return i},{});return jt(r)?null:new Zr(n,r)}static makeFromTransform(n,e,r){const{key:i,binComponent:a}=DS(e,e.bin,r);return new Zr(n,{[i]:a})}merge(n,e){for(const r of q(n.bins))r in this.bins?(e(n.bins[r].signal,this.bins[r].signal),this.bins[r].as=Pr([...this.bins[r].as,...n.bins[r].as],wt)):this.bins[r]=n.bins[r];for(const r of n.children)n.removeChild(r),r.parent=this;n.remove()}producedFields(){return new Set(En(this.bins).map(n=>n.as).flat(2))}dependentFields(){return new Set(En(this.bins).map(n=>n.field))}hash(){return`Bin ${wt(this.bins)}`}assemble(){return En(this.bins).flatMap(n=>{const e=[],[r,...i]=n.as,{extent:a,...o}=n.bin,s={type:"bin",field:He(n.field),as:r,signal:n.signal,...Id(a)?{extent:null}:{extent:a},...n.span?{span:{signal:`span(${n.span})`}}:{},...o};!a&&n.extentSignal&&(e.push({type:"extent",field:He(n.field),signal:n.extentSignal}),s.extent={signal:n.extentSignal}),e.push(s);for(const u of i)for(let l=0;l<2;l++)e.push({type:"formula",expr:Y({field:r[l]},{expr:"datum"}),as:u[l]});return n.formula&&e.push({type:"formula",expr:n.formula,as:n.formulaAs}),e})}}function vP(t,n,e,r){var a;const i=Zt(r)?r.encoding[Ur(n)]:void 0;if(oe(e)&&Zt(r)&&U3(e,i,r.markDef,r.config)){t.add(Y(e,{})),t.add(Y(e,{suffix:"end"}));const{mark:o,markDef:s,config:u}=r,l=va({fieldDef:e,markDef:s,config:u});bl(o)&&l!==.5&&ln(n)&&(t.add(Y(e,{suffix:vh})),t.add(Y(e,{suffix:bh}))),e.bin&&Dl(e,n)&&t.add(Y(e,{binSuffix:"range"}))}else if(bE(n)){const o=vE(n);t.add(r.getName(o))}else t.add(Y(e));return po(e)&&function(o){return Z(o)&&"field"in o}((a=e.scale)==null?void 0:a.range)&&t.add(e.scale.range.field),t}class _r extends Nt{clone(){return new _r(null,new Set(this.dimensions),ft(this.measures))}constructor(n,e,r){super(n),this.dimensions=e,this.measures=r}get groupBy(){return this.dimensions}static makeFromEncoding(n,e){let r=!1;e.forEachFieldDef(o=>{o.aggregate&&(r=!0)});const i={},a=new Set;return r?(e.forEachFieldDef((o,s)=>{const{aggregate:u,field:l}=o;if(u)if(u==="count")i["*"]??(i["*"]={}),i["*"].count=new Set([Y(o,{forAs:!0})]);else{if(Ai(u)||ma(u)){const c=Ai(u)?"argmin":"argmax",f=u[c];i[f]??(i[f]={}),i[f][c]=new Set([Y({op:c,field:f},{forAs:!0})])}else i[l]??(i[l]={}),i[l][u]=new Set([Y(o,{forAs:!0})]);Ir(s)&&e.scaleDomain(s)==="unaggregated"&&(i[l]??(i[l]={}),i[l].min=new Set([Y({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([Y({field:l,aggregate:"max"},{forAs:!0})]))}else vP(a,s,o,e)}),a.size+q(i).length===0?null:new _r(n,a,i)):null}static makeFromTransform(n,e){var r;const i=new Set,a={};for(const o of e.aggregate){const{op:s,field:u,as:l}=o;s&&(s==="count"?(a["*"]??(a["*"]={}),a["*"].count=new Set([l||Y(o,{forAs:!0})])):(a[u]??(a[u]={}),(r=a[u])[s]??(r[s]=new Set),a[u][s].add(l||Y(o,{forAs:!0}))))}for(const o of e.groupby??[])i.add(o);return i.size+q(a).length===0?null:new _r(n,i,a)}merge(n){return lE(this.dimensions,n.dimensions)?(function(e,r){for(const i of q(r)){const a=r[i];for(const o of q(a))i in e?e[i][o]=new Set([...e[i][o]??[],...a[o]]):e[i]={[o]:a[o]}}}(this.measures,n.measures),!0):(function(...e){vl.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(n){n.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...q(this.measures)])}producedFields(){const n=new Set;for(const e of q(this.measures))for(const r of q(this.measures[e])){const i=this.measures[e][r];i.size===0?n.add(`${r}_${e}`):i.forEach(n.add,n)}return n}hash(){return`Aggregate ${wt({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const n=[],e=[],r=[];for(const i of q(this.measures))for(const a of q(this.measures[i]))for(const o of this.measures[i][a])r.push(o),n.push(a),e.push(i==="*"?null:He(i));return{type:"aggregate",groupby:[...this.dimensions].map(He),ops:n,fields:e,as:r}}}class Ns extends Nt{constructor(n,e,r,i){super(n),this.model=e,this.name=r,this.data=i;for(const a of Ye){const o=e.facet[a];if(o){const{bin:s,sort:u}=o;this[a]={name:e.getName(`${a}_domain`),fields:[Y(o),...Wt(s)?[Y(o,{binSuffix:"end"})]:[]],...ki(u)?{sortField:u}:P(u)?{sortIndexField:zs(o,a)}:{}}}}this.childModel=e.child}hash(){let n="Facet";for(const e of Ye)this[e]&&(n+=` ${e.charAt(0)}:${wt(this[e])}`);return n}get fields(){var e;const n=[];for(const r of Ye)(e=this[r])!=null&&e.fields&&n.push(...this[r].fields);return n}dependentFields(){const n=new Set(this.fields);for(const e of Ye)this[e]&&(this[e].sortField&&n.add(this[e].sortField.field),this[e].sortIndexField&&n.add(this[e].sortIndexField));return n}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const n={};for(const e of wi){const r=this.childModel.component.scales[e];if(r&&!r.merged){const i=r.get("type"),a=r.get("range");if(wn(i)&&ao(a)){const o=zb(Oh(this.childModel,e));o?n[e]=o:I(Uy(e))}}}return n}assembleRowColumnHeaderData(n,e,r){const i={row:"y",column:"x",facet:void 0}[n],a=[],o=[],s=[];i&&r&&r[i]&&(e?(a.push(`distinct_${r[i]}`),o.push("max")):(a.push(r[i]),o.push("distinct")),s.push(`distinct_${r[i]}`));const{sortField:u,sortIndexField:l}=this[n];if(u){const{op:c=nh,field:f}=u;a.push(f),o.push(c),s.push(Y(u,{forAs:!0}))}else l&&(a.push(l),o.push("max"),s.push(l));return{name:this[n].name,source:e??this.data,transform:[{type:"aggregate",groupby:this[n].fields,...a.length?{fields:a,ops:o,as:s}:{}}]}}assembleFacetHeaderData(n){var u;const{columns:e}=this.model.layout,{layoutHeaders:r}=this.model.component,i=[],a={};for(const l of gb){for(const c of yb){const f=(r[l]&&r[l][c])??[];for(const d of f)if(((u=d.axes)==null?void 0:u.length)>0){a[l]=!0;break}}if(a[l]){const c=`length(data("${this.facet.name}"))`,f=l==="row"?e?{signal:`ceil(${c} / ${e})`}:1:e?{signal:`min(${c}, ${e})`}:{signal:c};i.push({name:`${this.facet.name}_${l}`,transform:[{type:"sequence",start:0,stop:f}]})}}const{row:o,column:s}=a;return(o||s)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,n)),i}assemble(){const n=[];let e=null;const r=this.getChildIndependentFieldsWithStep(),{column:i,row:a,facet:o}=this;if(i&&a&&(r.x||r.y)){e=`cross_${this.column.name}_${this.row.name}`;const s=[].concat(r.x??[],r.y??[]),u=s.map(()=>"distinct");n.push({name:e,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:s,ops:u}]})}for(const s of[gi,mi])this[s]&&n.push(this.assembleRowColumnHeaderData(s,e,r));if(o){const s=this.assembleFacetHeaderData(r);s&&n.push(...s)}return n}}function FS(t){return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function bP(t){const n={};return Bd(t.filter,e=>{if(d3(e)){let r=null;Jy(e)?r=Ee(e.equal):Qy(e)?r=Ee(e.lte):Ky(e)?r=Ee(e.lt):Zy(e)?r=Ee(e.gt):tv(e)?r=Ee(e.gte):nv(e)?r=e.range[0]:ev(e)&&(r=(e.oneOf??e.in)[0]),r&&(oo(r)?n[e.field]="date":$t(r)?n[e.field]="number":Q(r)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}}),n}function xP(t){const n={};function e(r){var i;Cs(r)?n[r.field]="date":r.type==="quantitative"&&(i=r.aggregate,Q(i)&&vt(["min","max"],i))?n[r.field]="number":gs(r.field)>1?r.field in n||(n[r.field]="flatten"):po(r)&&ki(r.sort)&&gs(r.sort.field)>1&&(r.sort.field in n||(n[r.sort.field]="flatten"))}if((Zt(t)||$e(t))&&t.forEachFieldDef((r,i)=>{if(oe(r))e(r);else{const a=ro(i),o=t.fieldDef(a);e({...r,type:o.type})}}),Zt(t)){const{mark:r,markDef:i,encoding:a}=t;if(ya(r)&&!t.encoding.order){const o=a[i.orient==="horizontal"?"y":"x"];H(o)&&o.type==="quantitative"&&!(o.field in n)&&(n[o.field]="number")}}return n}class Un extends Nt{clone(){return new Un(null,ft(this._parse))}constructor(n,e){super(n),this._parse=e}hash(){return`Parse ${wt(this._parse)}`}static makeExplicit(n,e,r){var o;let i={};const a=e.data;return!wa(a)&&((o=a==null?void 0:a.format)!=null&&o.parse)&&(i=a.format.parse),this.makeWithAncestors(n,i,{},r)}static makeWithAncestors(n,e,r,i){for(const s of q(r)){const u=i.getWithExplicit(s);u.value!==void 0&&(u.explicit||u.value===r[s]||u.value==="derived"||r[s]==="flatten"?delete r[s]:I(VE(s,r[s],u.value)))}for(const s of q(e)){const u=i.get(s);u!==void 0&&(u===e[s]?delete e[s]:I(VE(s,e[s],u)))}const a=new Bi(e,r);i.copyAll(a);const o={};for(const s of q(a.combine())){const u=a.get(s);u!==null&&(o[s]=u)}return q(o).length===0||i.parseNothing?null:new Un(n,o)}get parse(){return this._parse}merge(n){this._parse={...this._parse,...n.parse},n.remove()}assembleFormatParse(){const n={};for(const e of q(this._parse)){const r=this._parse[e];gs(e)===1&&(n[e]=r)}return n}producedFields(){return new Set(q(this._parse))}dependentFields(){return new Set(q(this._parse))}assembleTransforms(n=!1){return q(this._parse).filter(e=>!n||gs(e)>1).map(e=>{const r=function(i,a){const o=Ey(i);return a==="number"?`toNumber(${o})`:a==="boolean"?`toBoolean(${o})`:a==="string"?`toString(${o})`:a==="date"?`toDate(${o})`:a==="flatten"?o:a.startsWith("date:")?`timeParse(${o},'${FS(a.slice(5,a.length))}')`:a.startsWith("utc:")?`utcParse(${o},'${FS(a.slice(4,a.length))}')`:(I(`Unrecognized parse "${a}".`),null)}(e,this._parse[e]);return r?{type:"formula",expr:r,as:ms(e)}:null}).filter(e=>e!==null)}}class _a extends Nt{clone(){return new _a(null)}constructor(n){super(n)}dependentFields(){return new Set}producedFields(){return new Set([br])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:br}}}class Pl extends Nt{clone(){return new Pl(null,this.params)}constructor(n,e){super(n),this.params=e}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${wt(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class jl extends Nt{clone(){return new jl(null,this.params)}constructor(n,e){super(n),this.params=e}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${wt(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class xo extends Nt{constructor(n){let e;if(super(null),n??(n={name:"source"}),wa(n)||(e=n.format?{...he(n.format,["parse"])}:{}),Cl(n))this._data={values:n.values};else if($s(n)){if(this._data={url:n.url},!e.type){let r=/(?:\.([^.]+))?$/.exec(n.url)[1];vt(["json","csv","tsv","dsv","topojson"],r)||(r="json"),e.type=r}}else Q$(n)?this._data={values:[{type:"Sphere"}]}:(J$(n)||wa(n))&&(this._data={});this._generator=wa(n),n.name&&(this._name=n.name),e&&!jt(e)&&(this._data.format=e)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(n){this._name=n}set parent(n){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var Tl,CS=function(t,n,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?t!==n||!i:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,e):i?i.value=e:n.set(t,e),e},wP=function(t,n,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?t!==n||!r:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(t):r?r.value:n.get(t)};function _b(t){return t instanceof xo||t instanceof Pl||t instanceof jl}class kb{constructor(){Tl.set(this,void 0),CS(this,Tl,!1,"f")}setModified(){CS(this,Tl,!0,"f")}get modifiedFlag(){return wP(this,Tl,"f")}}Tl=new WeakMap;class wo extends kb{getNodeDepths(n,e,r){r.set(n,e);for(const i of n.children)this.getNodeDepths(i,e+1,r);return r}optimize(n){const e=[...this.getNodeDepths(n,0,new Map).entries()].sort((r,i)=>i[1]-r[1]);for(const r of e)this.run(r[0]);return this.modifiedFlag}}class Db extends kb{optimize(n){this.run(n);for(const e of n.children)this.optimize(e);return this.modifiedFlag}}class AP extends Db{mergeNodes(n,e){const r=e.shift();for(const i of e)n.removeChild(i),i.parent=r,i.remove()}run(n){const e=n.children.map(i=>i.hash()),r={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(n,r[i]))}}class _P extends Db{constructor(n){super(),this.requiresSelectionId=n&&rb(n)}run(n){n instanceof _a&&(this.requiresSelectionId&&(_b(n.parent)||n.parent instanceof _r||n.parent instanceof Un)||(this.setModified(),n.remove()))}}class kP extends kb{optimize(n){return this.run(n,new Set),this.modifiedFlag}run(n,e){let r=new Set;n instanceof Qr&&(r=n.producedFields(),Dy(r,e)&&(this.setModified(),n.removeFormulas(e),n.producedFields.length===0&&n.remove()));for(const i of n.children)this.run(i,new Set([...e,...r]))}}class DP extends Db{constructor(){super()}run(n){n instanceof ye&&!n.isRequired()&&(this.setModified(),n.remove())}}class FP extends wo{run(n){if(!(_b(n)||n.numChildren()>1)){for(const e of n.children)if(e instanceof Un)if(n instanceof Un)this.setModified(),n.merge(e);else{if(Cy(n.producedFields(),e.dependentFields()))continue;this.setModified(),e.swapWithParent()}}}}class CP extends wo{run(n){const e=[...n.children],r=n.children.filter(i=>i instanceof Un);if(n.numChildren()>1&&r.length>=1){const i={},a=new Set;for(const o of r){const s=o.parse;for(const u of q(s))u in i?i[u]!==s[u]&&a.add(u):i[u]=s[u]}for(const o of a)delete i[o];if(!jt(i)){this.setModified();const o=new Un(n,i);for(const s of e){if(s instanceof Un)for(const u of q(i))delete s.parse[u];n.removeChild(s),s.parent=o,s instanceof Un&&q(s.parse).length===0&&s.remove()}}}}}class EP extends wo{run(n){n instanceof ye||n.numChildren()>0||n instanceof Ns||n instanceof xo||(this.setModified(),n.remove())}}class $P extends wo{run(n){const e=n.children.filter(i=>i instanceof Qr),r=e.pop();for(const i of e)this.setModified(),r.merge(i)}}class SP extends wo{run(n){const e=n.children.filter(i=>i instanceof _r),r={};for(const i of e){const a=wt(i.groupBy);a in r||(r[a]=[]),r[a].push(i)}for(const i of q(r)){const a=r[i];if(a.length>1){const o=a.pop();for(const s of a)o.merge(s)&&(n.removeChild(s),s.parent=o,s.remove(),this.setModified())}}}}class MP extends wo{constructor(n){super(),this.model=n}run(n){const e=!(_b(n)||n instanceof Ts||n instanceof Un||n instanceof _a),r=[],i=[];for(const a of n.children)a instanceof Zr&&(e&&!Cy(n.producedFields(),a.dependentFields())?r.push(a):i.push(a));if(r.length>0){const a=r.pop();for(const o of r)a.merge(o,this.model.renameSignal.bind(this.model));this.setModified(),n instanceof Zr?n.merge(a,this.model.renameSignal.bind(this.model)):a.swapWithParent()}if(i.length>1){const a=i.pop();for(const o of i)a.merge(o,this.model.renameSignal.bind(this.model));this.setModified()}}}class BP extends wo{run(n){const e=[...n.children];if(!ps(e,a=>a instanceof ye)||n.numChildren()<=1)return;const r=[];let i;for(const a of e)if(a instanceof ye){let o=a;for(;o.numChildren()===1;){const[s]=o.children;if(!(s instanceof ye))break;o=s}r.push(...o.children),i?(n.removeChild(a),a.parent=i.parent,i.parent.removeChild(i),i.parent=o,this.setModified()):i=o}else r.push(a);if(r.length){this.setModified();for(const a of r)a.parent.removeChild(a),a.parent=i}}}class Ao extends Nt{clone(){return new Ao(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}addDimensions(n){this.transform.groupby=Pr(this.transform.groupby.concat(n),e=>e)}dependentFields(){const n=new Set;return this.transform.groupby&&this.transform.groupby.forEach(n.add,n),this.transform.joinaggregate.map(e=>e.field).filter(e=>e!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(n){return n.as??Y(n)}hash(){return`JoinAggregateTransform ${wt(this.transform)}`}assemble(){const n=[],e=[],r=[];for(const a of this.transform.joinaggregate)e.push(a.op),r.push(this.getDefaultName(a)),n.push(a.field===void 0?null:a.field);const i=this.transform.groupby;return{type:"joinaggregate",as:r,ops:e,fields:n,...i!==void 0?{groupby:i}:{}}}}class Ls extends Nt{clone(){return new Ls(null,{...this.filter})}constructor(n,e){super(n),this.filter=e}static make(n,e,r){const{config:i,markDef:a}=e,{marks:o,scales:s}=r;if(o==="include-invalid-values"&&s==="include-invalid-values")return null;const u=e.reduceFieldDef((l,c,f)=>{const d=Ir(f)&&e.getScaleComponent(f);if(d){const h=d.get("type"),{aggregate:p}=c,m=pv({scaleChannel:f,markDef:a,config:i,scaleType:h,isCountAggregate:Ud(p)});m!=="show"&&m!=="always-valid"&&(l[c.field]=c)}return l},{});return q(u).length?new Ls(n,u):null}dependentFields(){return new Set(q(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${wt(this.filter)}`}assemble(){const n=q(this.filter).reduce((e,r)=>{const i=this.filter[r],a=Y(i,{expr:"datum"});return i!==null&&(i.type==="temporal"?e.push(`(isDate(${a}) || (${Fb(a)}))`):i.type==="quantitative"&&e.push(Fb(a))),e},[]);return n.length>0?{type:"filter",expr:n.join(" && ")}:null}}function Fb(t){return`isValid(${t}) && isFinite(+${t})`}class zi extends Nt{clone(){return new zi(null,ft(this._stack))}constructor(n,e){super(n),this._stack=e}static makeFromTransform(n,e){const{stack:r,groupby:i,as:a,offset:o="zero"}=e,s=[],u=[];if(e.sort!==void 0)for(const f of e.sort)s.push(f.field),u.push(un(f.order,"ascending"));const l={field:s,order:u};let c;return c=function(f){return P(f)&&f.every(d=>Q(d))&&f.length>1}(a)?a:Q(a)?[a,`${a}_end`]:[`${e.stack}_start`,`${e.stack}_end`],new zi(n,{dimensionFieldDefs:[],stackField:r,groupby:i,offset:o,sort:l,facetby:[],as:c})}static makeFromEncoding(n,e){const r=e.stack,{encoding:i}=e;if(!r)return null;const{groupbyChannels:a,fieldChannel:o,offset:s,impute:u}=r,l=a.map(h=>vr(i[h])).filter(h=>!!h),c=function(h){return h.stack.stackBy.reduce((p,m)=>{const g=Y(m.fieldDef);return g&&p.push(g),p},[])}(e),f=e.encoding.order;let d;if(P(f)||H(f))d=TE(f);else{const h=I3(f)?f.sort:o==="y"?"descending":"ascending";d=c.reduce((p,m)=>(p.field.includes(m)||(p.field.push(m),p.order.push(h)),p),{field:[],order:[]})}return new zi(n,{dimensionFieldDefs:l,stackField:e.vgField(o),facetby:[],stackby:c,sort:d,offset:s,impute:u,as:[e.vgField(o,{suffix:"start",forAs:!0}),e.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(n){this._stack.facetby.push(...n)}dependentFields(){const n=new Set;return n.add(this._stack.stackField),this.getGroupbyFields().forEach(n.add,n),this._stack.facetby.forEach(n.add,n),this._stack.sort.field.forEach(n.add,n),n}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${wt(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:n,impute:e,groupby:r}=this._stack;return n.length>0?n.map(i=>i.bin?e?[Y(i,{binSuffix:"mid"})]:[Y(i,{}),Y(i,{binSuffix:"end"})]:[Y(i)]).flat():r??[]}assemble(){const n=[],{facetby:e,dimensionFieldDefs:r,stackField:i,stackby:a,sort:o,offset:s,impute:u,as:l}=this._stack;if(u)for(const c of r){const{bandPosition:f=.5,bin:d}=c;if(d){const h=Y(c,{expr:"datum"}),p=Y(c,{expr:"datum",binSuffix:"end"});n.push({type:"formula",expr:`${Fb(h)} ? ${f}*${h}+${1-f}*${p} : ${h}`,as:Y(c,{binSuffix:"mid",forAs:!0})})}n.push({type:"impute",field:i,groupby:[...a,...e],key:Y(c,{binSuffix:"mid"}),method:"value",value:0})}return n.push({type:"stack",groupby:[...this.getGroupbyFields(),...e],field:i,sort:o,as:l,offset:s}),n}}class Ps extends Nt{clone(){return new Ps(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}addDimensions(n){this.transform.groupby=Pr(this.transform.groupby.concat(n),e=>e)}dependentFields(){const n=new Set;return(this.transform.groupby??[]).forEach(n.add,n),(this.transform.sort??[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>e!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(n){return n.as??Y(n)}hash(){return`WindowTransform ${wt(this.transform)}`}assemble(){const n=[],e=[],r=[],i=[];for(const f of this.transform.window)e.push(f.op),r.push(this.getDefaultName(f)),i.push(f.param===void 0?null:f.param),n.push(f.field===void 0?null:f.field);const a=this.transform.frame,o=this.transform.groupby;if(a&&a[0]===null&&a[1]===null&&e.every(f=>qd(f)))return{type:"joinaggregate",as:r,ops:e,fields:n,...o!==void 0?{groupby:o}:{}};const s=[],u=[];if(this.transform.sort!==void 0)for(const f of this.transform.sort)s.push(f.field),u.push(f.order??"ascending");const l={field:s,order:u},c=this.transform.ignorePeers;return{type:"window",params:i,as:r,ops:e,fields:n,sort:l,...c!==void 0?{ignorePeers:c}:{},...o!==void 0?{groupby:o}:{},...a!==void 0?{frame:a}:{}}}}function Cb(t){if(t instanceof Ns)if(t.numChildren()!==1||t.children[0]instanceof ye){const e=t.model.component.data.main;ES(e);const r=(n=t,function a(o){if(!(o instanceof Ns)){const s=o.clone();if(s instanceof ye){const u=Eb+s.getSource();s.setSource(u),n.model.component.data.outputNodes[u]=s}else(s instanceof _r||s instanceof zi||s instanceof Ps||s instanceof Ao)&&s.addDimensions(n.fields);for(const u of o.children.flatMap(a))u.parent=s;return[s]}return o.children.flatMap(a)}),i=t.children.map(r).flat();for(const a of i)a.parent=e}else{const e=t.children[0];(e instanceof _r||e instanceof zi||e instanceof Ps||e instanceof Ao)&&e.addDimensions(t.fields),e.swapWithParent(),Cb(t)}else t.children.map(Cb);var n}function ES(t){if(t instanceof ye&&t.type===Qt.Main&&t.numChildren()===1){const n=t.children[0];n instanceof Ns||(n.swapWithParent(),ES(t))}}const Eb="scale_";function $b(t){for(const n of t){for(const e of n.children)if(e.parent!==n)return!1;if(!$b(n.children))return!1}return!0}function Ar(t,n){let e=!1;for(const r of n)e=t.optimize(r)||e;return e}function $S(t,n,e){let r=t.sources,i=!1;return i=Ar(new DP,r)||i,i=Ar(new _P(n),r)||i,r=r.filter(a=>a.numChildren()>0),i=Ar(new EP,r)||i,r=r.filter(a=>a.numChildren()>0),e||(i=Ar(new FP,r)||i,i=Ar(new MP(n),r)||i,i=Ar(new kP,r)||i,i=Ar(new CP,r)||i,i=Ar(new SP,r)||i,i=Ar(new $P,r)||i,i=Ar(new AP,r)||i,i=Ar(new BP,r)||i),t.sources=r,i}class _n{constructor(n){Object.defineProperty(this,"signal",{enumerable:!0,get:n})}static fromName(n,e){return new _n(()=>n(e))}}function SS(t){Zt(t)?function(n){const e=n.component.scales;for(const r of q(e)){const i=zP(n,r);if(e[r].setWithExplicit("domains",i),OP(n,r),n.component.data.isFaceted){let a=n;for(;!$e(a)&&a.parent;)a=a.parent;if(a.component.resolve.scale[r]==="shared")for(const o of i.value)_i(o)&&(o.data=Eb+o.data.replace(Eb,""))}}}(t):function(n){for(const r of n.children)SS(r);const e=n.component.scales;for(const r of q(e)){let i,a=null;for(const o of n.children){const s=o.component.scales[r];if(s){i=i===void 0?s.getWithExplicit("domains"):xa(i,s.getWithExplicit("domains"),"domains","scale",Bb);const u=s.get("selectionExtent");a&&u&&a.param!==u.param&&I(zN),a=u}}e[r].setWithExplicit("domains",i),a&&e[r].set("selectionExtent",a,!0)}}(t)}function zP(t,n){const e=t.getScaleComponent(n).get("type"),{encoding:r}=t,i=function(a,o,s,u){if(a==="unaggregated"){const{valid:l,reason:c}=MS(o,s);if(!l)return void I(c)}else if(a===void 0&&u.useUnaggregatedDomain){const{valid:l}=MS(o,s);if(l)return"unaggregated"}return a}(t.scaleDomain(n),t.typedFieldDef(n),e,t.config.scale);return i!==t.scaleDomain(n)&&(t.specifiedScales[n]={...t.specifiedScales[n],domain:i}),n==="x"&&mn(r.x2)?mn(r.x)?xa(Aa(e,i,t,"x"),Aa(e,i,t,"x2"),"domain","scale",Bb):Aa(e,i,t,"x2"):n==="y"&&mn(r.y2)?mn(r.y)?xa(Aa(e,i,t,"y"),Aa(e,i,t,"y2"),"domain","scale",Bb):Aa(e,i,t,"y2"):Aa(e,i,t,n)}function Sb(t,n,e){var i;const r=(i=xn(e))==null?void 0:i.unit;return n==="temporal"||r?function(a,o,s){return a.map(u=>({signal:`{data: ${lh(u,{timeUnit:s,type:o})}}`}))}(t,n,r):[t]}function Aa(t,n,e,r){const{encoding:i,markDef:a,mark:o,config:s,stack:u}=e,l=mn(i[r]),{type:c}=l,f=l.timeUnit,d=function(m){const{marks:g,scales:y}=Z$(m);return g===y?Qt.Main:y==="include-invalid-values"?Qt.PreFilterInvalid:Qt.PostFilterInvalid}({invalid:Wr("invalid",a,s),isPath:ya(o)});if(function(m){return U(m,"unionWith")}(n)){const m=Aa(t,void 0,e,r);return Jr([...Sb(n.unionWith,c,f),...m.value])}if(it(n))return Jr([n]);if(n&&n!=="unaggregated"&&!A3(n))return Jr(Sb(n,c,f));if(u&&r===u.fieldChannel){if(u.offset==="normalize")return xr([[0,1]]);const m=e.requestDataName(d);return xr([{data:m,field:e.vgField(r,{suffix:"start"})},{data:m,field:e.vgField(r,{suffix:"end"})}])}const h=Ir(r)&&H(l)?function(m,g,y){if(!wn(y))return;const v=m.fieldDef(g),x=v.sort;if(j3(x))return{op:"min",field:zs(v,g),order:"ascending"};const{stack:b}=m,w=b?new Set([...b.groupbyFields,...b.stackBy.map(A=>A.fieldDef.field)]):void 0;if(ki(x))return Mb(x,b&&!w.has(x.field));if(function(A){return U(A,"encoding")}(x)){const{encoding:A,order:_}=x,k=m.fieldDef(A),{aggregate:F,field:C}=k,D=b&&!w.has(C);if(Ai(F)||ma(F))return Mb({field:Y(k),order:_},D);if(qd(F)||!F)return Mb({op:F,field:C,order:_},D)}else{if(x==="descending")return{op:"min",field:m.vgField(g),order:"descending"};if(vt(["ascending",void 0],x))return!0}}(e,r,t):void 0;if(Yr(l))return xr(Sb([l.datum],c,f));const p=l;if(n==="unaggregated"){const{field:m}=l;return xr([{data:e.requestDataName(d),field:Y({field:m,aggregate:"min"})},{data:e.requestDataName(d),field:Y({field:m,aggregate:"max"})}])}if(Wt(p.bin)){if(wn(t))return xr(t==="bin-ordinal"?[]:[{data:cl(h)?e.requestDataName(d):e.requestDataName(Qt.Raw),field:e.vgField(r,Dl(p,r)?{binSuffix:"range"}:{}),sort:h!==!0&&Z(h)?h:{field:e.vgField(r,{}),op:"min"}}]);{const{bin:m}=p;if(Wt(m)){const g=Ab(e,p.field,m);return xr([new _n(()=>{const y=e.getSignalName(g);return`[${y}.start, ${y}.stop]`})])}return xr([{data:e.requestDataName(d),field:e.vgField(r,{})}])}}if(p.timeUnit&&vt(["time","utc"],t)){const m=i[Ur(r)];if(U3(p,m,a,s)){const g=e.requestDataName(d),y=va({fieldDef:p,fieldDef2:m,markDef:a,config:s}),v=bl(o)&&y!==.5&&ln(r);return xr([{data:g,field:e.vgField(r,v?{suffix:vh}:{})},{data:g,field:e.vgField(r,{suffix:v?bh:"end"})}])}}return xr(h?[{data:cl(h)?e.requestDataName(d):e.requestDataName(Qt.Raw),field:e.vgField(r),sort:h}]:[{data:e.requestDataName(d),field:e.vgField(r)}])}function Mb(t,n){const{op:e,field:r,order:i}=t;return{op:e??(n?"sum":nh),...r?{field:He(r)}:{},...i?{order:i}:{}}}function OP(t,n){var s;const e=t.component.scales[n],r=t.specifiedScales[n].domain,i=(s=t.fieldDef(n))==null?void 0:s.bin,a=A3(r)?r:void 0,o=io(i)&&Id(i.extent)?i.extent:void 0;(a||o)&&e.set("selectionExtent",a??o,!0)}function MS(t,n){const{aggregate:e,type:r}=t;return e?Q(e)&&!FN.has(e)?{valid:!1,reason:LN(e)}:r==="quantitative"&&n==="log"?{valid:!1,reason:qN(t)}:{valid:!0}:{valid:!1,reason:jN(t)}}function Bb(t,n,e,r){return t.explicit&&n.explicit&&I(function(i,a,o,s){return`Conflicting ${a.toString()} property "${i.toString()}" (${Lt(o)} and ${Lt(s)}). Using the union of the two domains.`}(e,r,t.value,n.value)),{explicit:t.explicit,value:[...t.value,...n.value]}}function NP(t){const n=Pr(t.map(o=>{if(_i(o)){const{sort:s,...u}=o;return u}return o}),wt),e=Pr(t.map(o=>{if(_i(o)){const s=o.sort;return s===void 0||cl(s)||("op"in s&&s.op==="count"&&delete s.field,s.order==="ascending"&&delete s.order),s}}).filter(o=>o!==void 0),wt);if(n.length===0)return;if(n.length===1){const o=t[0];if(_i(o)&&e.length>0){let s=e[0];if(e.length>1){I(ZE);const u=e.filter(l=>Z(l)&&"op"in l&&l.op!=="min");s=!e.every(l=>Z(l)&&"op"in l)||u.length!==1||u[0]}else if(Z(s)&&"field"in s){const u=s.field;o.field===u&&(s=!s.order||{order:s.order})}return{...o,sort:s}}return o}const r=Pr(e.map(o=>cl(o)||!("op"in o)||Q(o.op)&&tt(_N,o.op)?o:(I(function(s){return`Dropping sort property ${Lt(s)} as unioned domains only support boolean or op "count", "min", and "max".`}(o)),!0)),wt);let i;r.length===1?i=r[0]:r.length>1&&(I(ZE),i=!0);const a=Pr(t.map(o=>_i(o)?o.data:null),o=>o);return a.length===1&&a[0]!==null?{data:a[0],fields:n.map(o=>o.field),...i?{sort:i}:{}}:{fields:n,...i?{sort:i}:{}}}function zb(t){if(_i(t)&&Q(t.field))return t.field;if(function(n){return!P(n)&&U(n,"fields")&&!U(n,"data")}(t)){let n;for(const e of t.fields)if(_i(e)&&Q(e.field))if(n){if(n!==e.field)return I("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),n}else n=e.field;return I("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),n}if(function(n){return!P(n)&&U(n,"fields")&&U(n,"data")}(t)){I("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const n=t.fields[0];return Q(n)?n:void 0}}function Oh(t,n){const e=t.component.scales[n].get("domains").map(r=>(_i(r)&&(r.data=t.lookupDataSource(r.data)),r));return NP(e)}function BS(t){return Rs(t)||Nb(t)?t.children.reduce((n,e)=>n.concat(BS(e)),zS(t)):zS(t)}function zS(t){return q(t.component.scales).reduce((n,e)=>{const r=t.component.scales[e];if(r.merged)return n;const i=r.combine(),{name:a,type:o,selectionExtent:s,domains:u,range:l,reverse:c,...f}=i,d=function(m,g,y,v){if(ln(y)){if(ao(m))return{step:{signal:`${g}_step`}}}else if(Z(m)&&_i(m))return{...m,data:v.lookupDataSource(m.data)};return m}(i.range,a,e,t),h=Oh(t,e),p=s?function(m,g,y,v){const x=J5(m,g.param,g);return{signal:mr(y.get("type"))&&P(v)&&v[0]>v[1]?`isValid(${x}) && reverse(${x})`:x}}(t,s,r,h):null;return n.push({name:a,type:o,...h?{domain:h}:{},...p?{domainRaw:p}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),n},[])}class OS extends Bi{constructor(n,e){super({},{name:n}),this.merged=!1,this.setWithExplicit("type",e)}domainHasZero(){const n=this.get("type");if(vt([XN,av,Yd],n))return"definitely-not";const e=this.get("zero");if(e===!0||e===void 0&&vt([m3,KN,JN],n))return"definitely";const r=this.get("domains");if(r.length>0){let i=!1,a=!1,o=!1;for(const s of r){if(P(s)){const u=s[0],l=s[s.length-1];if($t(u)&&$t(l)){if(u<=0&&l>=0){i=!0;continue}a=!0;continue}}o=!0}if(i)return"definitely";if(a&&!o)return"definitely-not"}return"maybe"}}const RP=["range","scheme"];function NS(t,n){const e=t.fieldDef(n);if(e!=null&&e.bin){const{bin:r,field:i}=e,a=ge(n),o=t.getName(a);if(Z(r)&&r.binned&&r.step!==void 0)return new _n(()=>{const s=t.scaleName(n),u=`(domain("${s}")[1] - domain("${s}")[0]) / ${r.step}`;return`${t.getSignalName(o)} / (${u})`});if(Wt(r)){const s=Ab(t,i,r);return new _n(()=>{const u=t.getSignalName(s),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${t.getSignalName(o)} / (${l})`})}}}function TP(t,n){const e=n.specifiedScales[t],{size:r}=n,i=n.getScaleComponent(t).get("type");for(const c of RP)if(e[c]!==void 0){const f=uv(i,c),d=_3(t,c);if(f)if(d)I(d);else switch(c){case"range":{const h=e.range;if(P(h)){if(ln(t))return Jr(h.map(p=>{if(p==="width"||p==="height"){const m=n.getName(p),g=n.getSignalName.bind(n);return _n.fromName(g,m)}return p}))}else if(Z(h))return Jr({data:n.requestDataName(Qt.Main),field:h.field,sort:{op:"min",field:n.vgField(t)}});return Jr(h)}case"scheme":return Jr(PP(e[c]))}else I(KE(i,c,t))}const a=t===Jt||t==="xOffset"?"width":"height",o=r[a];if(Xr(o)){if(ln(t))if(wn(i)){const c=TS(o,n,t);if(c)return Jr({step:c})}else I(QE(a));else if(gl(t)){const c=t===ua?"x":"y";if(n.getScaleComponent(c).get("type")==="band"){const f=PS(o,i);if(f)return Jr(f)}}}const{rangeMin:s,rangeMax:u}=e,l=function(c,f){const{size:d,config:h,mark:p,encoding:m}=f,{type:g}=mn(m[c]),y=f.getScaleComponent(c),v=y.get("type"),{domain:x,domainMid:b}=f.specifiedScales[c];switch(c){case Jt:case bn:if(vt(["point","band"],v)){const w=jS(c,d,h.view);if(Xr(w))return{step:TS(w,f,c)}}return RS(c,f,v);case ua:case ys:return function(w,A,_){const k=w===ua?"x":"y",F=A.getScaleComponent(k);if(!F)return RS(k,A,_,{center:!0});const C=F.get("type"),D=A.scaleName(k),{markDef:E,config:$}=A;if(C==="band"){const M=jS(k,A.size,A.config.view);if(Xr(M)){const S=PS(M,_);if(S)return S}return[0,{signal:`bandwidth('${D}')`}]}{const M=A.encoding[k];if(H(M)&&M.timeUnit){const S=c3(M.timeUnit,W=>`scale('${D}', ${W})`),B=A.config.scale.bandWithNestedOffsetPaddingInner,z=va({fieldDef:M,markDef:E,config:$})-.5,N=z!==0?` + ${z}`:"";return B?[{signal:`${it(B)?`${B.signal}/2`+N:`${B/2+z}`} * (${S})`},{signal:`${it(B)?`(1 - ${B.signal}/2)`+N:`${1-B/2+z}`} * (${S})`}]:[0,{signal:S}]}return sE(`Cannot use ${w} scale if ${k} scale is not discrete.`)}}(c,f,v);case bi:{const w=function(_,k){switch(_){case"bar":case"tick":return k.scale.minBandSize;case"line":case"trail":case"rule":return k.scale.minStrokeWidth;case"text":return k.scale.minFontSize;case"point":case"square":case"circle":return k.scale.minSize}throw new Error(Wd("size",_))}(p,h),A=function(_,k,F,C){const D={x:NS(F,"x"),y:NS(F,"y")};switch(_){case"bar":case"tick":{if(C.scale.maxBandSize!==void 0)return C.scale.maxBandSize;const E=qS(k,D,C.view);return $t(E)?E-1:new _n(()=>`${E.signal} - 1`)}case"line":case"trail":case"rule":return C.scale.maxStrokeWidth;case"text":return C.scale.maxFontSize;case"point":case"square":case"circle":{if(C.scale.maxSize)return C.scale.maxSize;const E=qS(k,D,C.view);return $t(E)?Math.pow(LS*E,2):new _n(()=>`pow(${LS} * ${E.signal}, 2)`)}}throw new Error(Wd("size",_))}(p,d,f,h);return As(v)?function(_,k,F){const C=()=>{const D=pr(k),E=pr(_),$=`(${D} - ${E}) / (${F} - 1)`;return`sequence(${E}, ${D} + ${$}, ${$})`};return it(k)?new _n(C):{signal:C()}}(w,A,function(_,k,F,C){switch(_){case"quantile":return k.scale.quantileCount;case"quantize":return k.scale.quantizeCount;case"threshold":return F!==void 0&&P(F)?F.length+1:(I(function(D){return`Domain for ${D} is required for threshold scale.`}(C)),3)}}(v,h,x,c)):[w,A]}case Ge:return[0,2*Math.PI];case no:return[0,360];case cr:return[0,new _n(()=>`min(${f.getSignalName($e(f.parent)?"child_width":"width")},${f.getSignalName($e(f.parent)?"child_height":"height")})/2`)];case la:return{step:1e3/h.scale.framesPerSecond};case da:return[h.scale.minStrokeWidth,h.scale.maxStrokeWidth];case ha:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case me:return"symbol";case pe:case Lr:case qr:return v==="ordinal"?g==="nominal"?"category":"ordinal":b!==void 0?"diverging":p==="rect"||p==="geoshape"?"heatmap":"ramp";case xi:case ca:case fa:return[h.scale.minOpacity,h.scale.maxOpacity]}}(t,n);return(s!==void 0||u!==void 0)&&uv(i,"rangeMin")&&P(l)&&l.length===2?Jr([s??l[0],u??l[1]]):xr(l)}function PP(t){return function(n){return!Q(n)&&U(n,"name")}(t)?{scheme:t.name,...he(t,["name"])}:{scheme:t}}function RS(t,n,e,{center:r}={}){const i=ge(t),a=n.getName(i),o=n.getSignalName.bind(n);return t===bn&&mr(e)?r?[_n.fromName(s=>`${o(s)}/2`,a),_n.fromName(s=>`-${o(s)}/2`,a)]:[_n.fromName(o,a),0]:r?[_n.fromName(s=>`-${o(s)}/2`,a),_n.fromName(s=>`${o(s)}/2`,a)]:[0,_n.fromName(o,a)]}function TS(t,n,e){const{encoding:r}=n,i=n.getScaleComponent(e),a=By(e),o=r[a];if(k$({step:t,offsetIsDiscrete:ht(o)&&p3(o.type)})==="offset"&&r$(r,a)){const s=n.getScaleComponent(a);let u=`domain('${n.scaleName(a)}').length`;s.get("type")==="band"&&(u=`bandspace(${u}, ${s.get("paddingInner")??s.get("padding")??0}, ${s.get("paddingOuter")??s.get("padding")??0})`);const l=i.get("paddingInner")??i.get("padding");return{signal:`${t.step} * ${u} / (1-${$N(l)})`}}return t.step}function PS(t,n){if(k$({step:t,offsetIsDiscrete:wn(n)})==="offset")return{step:t.step}}function jS(t,n,e){const r=t===Jt?"width":"height";return n[r]||mh(e,r)}const LS=.95;function qS(t,n,e){const r=Xr(t.width)?t.width.step:Tv(e,"width"),i=Xr(t.height)?t.height.step:Tv(e,"height");return n.x||n.y?new _n(()=>`min(${[n.x?n.x.signal:r,n.y?n.y.signal:i].join(", ")})`):Math.min(r,i)}function US(t,n){Zt(t)?function(e,r){const i=e.component.scales,{config:a,encoding:o,markDef:s,specifiedScales:u}=e;for(const l of q(i)){const c=u[l],f=i[l],d=e.getScaleComponent(l),h=mn(o[l]),p=c[r],m=d.get("type"),g=d.get("padding"),y=d.get("paddingInner"),v=uv(m,r),x=_3(l,r);if(p!==void 0&&(v?x&&I(x):I(KE(m,r,l))),v&&x===void 0)if(p!==void 0){const b=h.timeUnit,w=h.type;switch(r){case"domainMax":case"domainMin":oo(c[r])||w==="temporal"||b?f.set(r,{signal:lh(c[r],{type:w,timeUnit:b})},!0):f.set(r,c[r],!0);break;default:f.copyKeyFromObject(r,c)}}else{const b=U(IS,r)?IS[r]({model:e,channel:l,fieldOrDatumDef:h,scaleType:m,scalePadding:g,scalePaddingInner:y,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:s,config:a,hasNestedOffsetScale:i$(o,l),hasSecondaryRangeChannel:!!o[Ur(l)]}):a.scale[r];b!==void 0&&f.set(r,b,!1)}}}(t,n):HS(t,n)}const IS={bins:({model:t,fieldOrDatumDef:n})=>H(n)?function(e,r){const i=r.bin;if(Wt(i)){const a=Ab(e,r.field,i);return new _n(()=>e.getSignalName(a))}if($n(i)&&io(i)&&i.step!==void 0)return{step:i.step}}(t,n):void 0,interpolate:({channel:t,fieldOrDatumDef:n})=>function(e,r){if(vt([pe,Lr,qr],e)&&r!=="nominal")return"hcl"}(t,n.type),nice:({scaleType:t,channel:n,domain:e,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>function(o,s,u,l,c,f){var d;if(!((d=vr(f))!=null&&d.bin||P(u)||c!=null||l!=null||vt([av,Yd],o)))return!!ln(s)||void 0}(t,n,e,r,i,a),padding:({channel:t,scaleType:n,fieldOrDatumDef:e,markDef:r,config:i})=>function(a,o,s,u,l,c){if(ln(a)){if(Gr(o)){if(s.continuousPadding!==void 0)return s.continuousPadding;const{type:f,orient:d}=l;if(f==="bar"&&(!H(u)||!u.bin&&!u.timeUnit)&&(d==="vertical"&&a==="x"||d==="horizontal"&&a==="y"))return c.continuousBandSize}if(o===g3)return s.pointPadding}}(t,n,i.scale,e,r,i.bar),paddingInner:({scalePadding:t,channel:n,markDef:e,scaleType:r,config:i,hasNestedOffsetScale:a})=>function(o,s,u,l,c,f=!1){if(o===void 0){if(ln(s)){const{bandPaddingInner:d,barBandPaddingInner:h,rectBandPaddingInner:p,tickBandPaddingInner:m,bandWithNestedOffsetPaddingInner:g}=c;return f?g:un(d,u==="bar"?h:u==="tick"?m:p)}if(gl(s)&&l===ov)return c.offsetBandPaddingInner}}(t,n,e.type,r,i.scale,a),paddingOuter:({scalePadding:t,channel:n,scaleType:e,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>function(o,s,u,l,c,f=!1){if(o===void 0){if(ln(s)){const{bandPaddingOuter:d,bandWithNestedOffsetPaddingOuter:h}=c;if(f)return h;if(u===ov)return un(d,it(l)?{signal:`${l.signal}/2`}:l/2)}else if(gl(s)){if(u===g3)return .5;if(u===ov)return c.offsetBandPaddingOuter}}}(t,n,e,r,i.scale,a),reverse:({fieldOrDatumDef:t,scaleType:n,channel:e,config:r})=>function(i,a,o,s){if(o==="x"&&s.xReverse!==void 0)return mr(i)&&a==="descending"?it(s.xReverse)?{signal:`!${s.xReverse.signal}`}:!s.xReverse:s.xReverse;if(mr(i)&&a==="descending")return!0}(n,H(t)?t.sort:void 0,e,r.scale),zero:({channel:t,fieldOrDatumDef:n,domain:e,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:o})=>function(s,u,l,c,f,d,h){if(l&&l!=="unaggregated"&&mr(f)){if(P(l)){const p=l[0],m=l[l.length-1];if($t(p)&&p<=0&&$t(m)&&m>=0)return!0}return!1}if(s==="size"&&u.type==="quantitative"&&!As(f))return!0;if((!H(u)||!u.bin)&&vt([...wi,...vN],s)){const{orient:p,type:m}=c;return(!vt(["bar","area","line","trail"],m)||!(p==="horizontal"&&s==="y"||p==="vertical"&&s==="x"))&&(!(!vt(["bar","area"],m)||h)||(d==null?void 0:d.zero))}return!1}(t,n,e,r,i,a.scale,o)};function WS(t){Zt(t)?function(n){const e=n.component.scales;for(const r of Ty){const i=e[r];if(!i)continue;const a=TP(r,n);i.setWithExplicit("range",a)}}(t):HS(t,"range")}function HS(t,n){const e=t.component.scales;for(const r of t.children)n==="range"?WS(r):US(r,n);for(const r of q(e)){let i;for(const a of t.children){const o=a.component.scales[r];o&&(i=xa(i,o.getWithExplicit(n),n,"scale",X$((s,u)=>n==="range"&&s.step&&u.step?s.step-u.step:0)))}e[r].setWithExplicit(n,i)}}function jP(t,n,e,r,i=!1){const a=function(l,c,f,d){var h;switch(c.type){case"nominal":case"ordinal":if(bs(l)||Py(l)==="discrete")return l==="shape"&&c.type==="ordinal"&&I(Hy(l,"ordinal")),"ordinal";if(Ry(l))return"band";if(ln(l)||gl(l)){if(vt(["rect","bar","image","rule","tick"],f.type)||d)return"band"}else if(f.type==="arc"&&l in Ny)return"band";return co(f[ge(l)])||ks(c)&&((h=c.axis)!=null&&h.tickBand)?"band":"point";case"temporal":return bs(l)?"time":Py(l)==="discrete"?(I(Hy(l,"temporal")),"ordinal"):H(c)&&c.timeUnit&&xn(c.timeUnit).utc?"utc":Ry(l)?"band":"time";case"quantitative":return bs(l)?H(c)&&Wt(c.bin)?"bin-ordinal":"linear":Py(l)==="discrete"?(I(Hy(l,"quantitative")),"ordinal"):Ry(l)?"band":"linear";case"geojson":return}throw new Error(XE(c.type))}(n,e,r,i),{type:o}=t;return Ir(n)?o!==void 0?function(l,c,f=!1){if(!Ir(l))return!1;switch(l){case Jt:case bn:case ua:case ys:case Ge:case cr:return!!Gr(c)||c==="band"||c==="point"&&!f;case la:return vt(["linear","band"],c);case bi:case da:case xi:case ca:case fa:case no:return Gr(c)||As(c)||vt(["band","point","ordinal"],c);case pe:case Lr:case qr:return c!=="band";case ha:case me:return c==="ordinal"||As(c)}}(n,o)?H(e)&&(s=o,u=e.type,!(vt([rv,iv],u)?s===void 0||wn(s):u===xs?vt([av,Yd,void 0],s):u!==lo||x3(s)||As(s)||s===void 0))?(I(function(l,c){return`FieldDef does not work with "${l}" scale. We are using "${c}" scale instead.`}(o,a)),a):o:(I(function(l,c,f){return`Channel "${l}" does not work with "${c}" scale. We are using "${f}" scale instead.`}(n,o,a)),a):a:null;var s,u}function GS(t){Zt(t)?t.component.scales=function(n){const{encoding:e,mark:r,markDef:i}=n,a={};for(const o of Ty){const s=mn(e[o]);if(s&&r===F3&&o===me&&s.type===ws)continue;let u=s&&s.scale;if(s&&u!==null&&u!==!1){u??(u={});const l=jP(u,o,s,i,i$(e,o));a[o]=new OS(n.scaleName(`${o}`,!0),{value:l,explicit:u.type===l})}}return a}(t):t.component.scales=function(n){var e;const r=n.component.scales={},i={},a=n.component.resolve;for(const o of n.children){GS(o);for(const s of q(o.component.scales))if((e=a.scale)[s]??(e[s]=cS(s,n)),a.scale[s]==="shared"){const u=i[s],l=o.component.scales[s].getWithExplicit("type");u?QN(u.value,l.value)?i[s]=xa(u,l,"type","scale",LP):(a.scale[s]="independent",delete i[s]):i[s]=l}}for(const o of q(i)){const s=n.scaleName(o,!0),u=i[o];r[o]=new OS(s,u);for(const l of n.children){const c=l.component.scales[o];c&&(l.renameScale(c.get("name"),s),c.merged=!0)}}return r}(t)}const LP=X$((t,n)=>y3(t)-y3(n));class Ob{constructor(){this.nameMap={}}rename(n,e){this.nameMap[n]=e}has(n){return this.nameMap[n]!==void 0}get(n){for(;this.nameMap[n]&&n!==this.nameMap[n];)n=this.nameMap[n];return n}}function Zt(t){return(t==null?void 0:t.type)==="unit"}function $e(t){return(t==null?void 0:t.type)==="facet"}function Nb(t){return(t==null?void 0:t.type)==="concat"}function Rs(t){return(t==null?void 0:t.type)==="layer"}class Rb{constructor(n,e,r,i,a,o,s){this.type=e,this.parent=r,this.config=a,this.parent=r,this.config=a,this.view=Sn(s),this.name=n.name??i,this.title=ga(n.title)?{text:n.title}:n.title?Sn(n.title):void 0,this.scaleNameMap=r?r.scaleNameMap:new Ob,this.projectionNameMap=r?r.projectionNameMap:new Ob,this.signalNameMap=r?r.signalNameMap:new Ob,this.data=n.data,this.description=n.description,this.transforms=function(u){return u.map(l=>Uv(l)?{filter:ds(l.filter,VN)}:l)}(n.transform??[]),this.layout=e==="layer"||e==="unit"?{}:function(u,l,c){const f=c[l],d={},{spacing:h,columns:p}=f;h!==void 0&&(d.spacing=h),p!==void 0&&(eh(u)&&!Al(u.facet)||Ov(u))&&(d.columns=p),ph(u)&&(d.columns=1);for(const m of CR)if(u[m]!==void 0)if(m==="spacing"){const g=u[m];d[m]=$t(g)?g:{row:g.row??h,column:g.column??h}}else d[m]=u[m];return d}(n,e,a),this.component={data:{sources:r?r.component.data.sources:[],outputNodes:r?r.component.data.outputNodes:{},outputNodeRefCounts:r?r.component.data.outputNodeRefCounts:{},isFaceted:eh(n)||(r==null?void 0:r.component.data.isFaceted)&&n.data===void 0},layoutSize:new Bi,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?ft(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){(function(n,{ignoreRange:e}={}){GS(n),SS(n);for(const r of rR)US(n,r);e||WS(n)})(this)}parseProjection(){_S(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){vS(this)}assembleEncodeFromView(n){const{style:e,...r}=n,i={};for(const a of q(r)){const o=r[a];o!==void 0&&(i[a]=Gt(o))}return i}assembleGroupEncodeEntry(n){let e={};return this.view&&(e=this.assembleEncodeFromView(this.view)),n||(this.description&&(e.description=Gt(this.description)),this.type!=="unit"&&this.type!=="layer")?jt(e)?void 0:e:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...e}}assembleLayout(){if(!this.layout)return;const{spacing:n,...e}=this.layout,{component:r,config:i}=this,a=function(o,s){const u={};for(const l of Ye){const c=o[l];if(c!=null&&c.facetFieldDef){const{titleAnchor:f,titleOrient:d}=Bh(["titleAnchor","titleOrient"],c.facetFieldDef.header,s,l),h=Mh(l,d),p=uP(f,h);p!==void 0&&(u[h]=p)}}return jt(u)?void 0:u}(r.layoutHeaders,i);return{padding:n,...this.assembleDefaultLayout(),...e,...a?{titleBand:a}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:n}=this.component;let e=[];for(const r of Ye)n[r].title&&e.push(rP(this,r));for(const r of gb)e=e.concat(iP(this,r));return e}assembleAxes(){return function(n,e){const{x:r=[],y:i=[]}=n;return[...r.map(a=>Rl(a,"grid",e)),...i.map(a=>Rl(a,"grid",e)),...r.map(a=>Rl(a,"main",e)),...i.map(a=>Rl(a,"main",e))].filter(a=>a)}(this.component.axes,this.config)}assembleLegends(){return xS(this)}assembleProjections(){return mP(this)}assembleTitle(){const{encoding:n,...e}=this.title??{},r={...ME(this.config.title).nonMarkTitleProperties,...e,...n?{encode:{update:n}}:{}};if(r.text)return vt(["unit","layer"],this.type)?vt(["middle",void 0],r.anchor)&&(r.frame??(r.frame="group")):r.anchor??(r.anchor="start"),jt(r)?void 0:r}assembleGroup(n=[]){const e={};(n=n.concat(this.assembleSignals())).length>0&&(e.signals=n);const r=this.assembleLayout();r&&(e.layout=r),e.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||$e(this.parent)?BS(this):[];i.length>0&&(e.scales=i);const a=this.assembleAxes();a.length>0&&(e.axes=a);const o=this.assembleLegends();return o.length>0&&(e.legends=o),e}getName(n){return Xt((this.name?`${this.name}_`:"")+n)}getDataName(n){return this.getName(Qt[n].toLowerCase())}requestDataName(n){const e=this.getDataName(n),r=this.component.data.outputNodeRefCounts;return r[e]=(r[e]||0)+1,e}getSizeSignalRef(n){if($e(this.parent)){const e=Ld(uS(n)),r=this.component.scales[e];if(r&&!r.merged){const i=r.get("type"),a=r.get("range");if(wn(i)&&ao(a)){const o=r.get("name"),s=zb(Oh(this,e));return s?{signal:sS(o,r,Y({aggregate:"distinct",field:s},{expr:"datum"}))}:(I(Uy(e)),null)}}}return{signal:this.signalNameMap.get(this.getName(n))}}lookupDataSource(n){const e=this.component.data.outputNodes[n];return e?e.getSource():n}getSignalName(n){return this.signalNameMap.get(n)}renameSignal(n,e){this.signalNameMap.rename(n,e)}renameScale(n,e){this.scaleNameMap.rename(n,e)}renameProjection(n,e){this.projectionNameMap.rename(n,e)}scaleName(n,e){return e?this.getName(n):wE(n)&&Ir(n)&&this.component.scales[n]||this.scaleNameMap.has(this.getName(n))?this.scaleNameMap.get(this.getName(n)):void 0}projectionName(n){return n?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(n){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const e=this.component.scales[n];return e&&!e.merged?e:this.parent?this.parent.getScaleComponent(n):void 0}getScaleType(n){const e=this.getScaleComponent(n);return e?e.get("type"):void 0}getSelectionComponent(n,e){let r=this.component.selection[n];if(!r&&this.parent&&(r=this.parent.getSelectionComponent(n,e)),!r)throw new Error(`Cannot find a selection named "${e}".`);return r}hasAxisOrientSignalRef(){var n,e;return((n=this.component.axes.x)==null?void 0:n.some(r=>r.hasOrientSignalRef()))||((e=this.component.axes.y)==null?void 0:e.some(r=>r.hasOrientSignalRef()))}}class VS extends Rb{vgField(n,e={}){const r=this.fieldDef(n);if(r)return Y(r,e)}reduceFieldDef(n,e){return function(r,i,a,o){return r?q(r).reduce((s,u)=>{const l=r[u];return P(l)?l.reduce((c,f)=>i.call(o,c,f,u),s):i.call(o,s,l,u)},a):a}(this.getMapping(),(r,i,a)=>{const o=vr(i);return o?n(r,o,a):r},e)}forEachFieldDef(n,e){kv(this.getMapping(),(r,i)=>{const a=vr(r);a&&n(a,i)},e)}}class Lh extends Nt{clone(){return new Lh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"value",r[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${wt(this.transform)}`}assemble(){const{density:n,...e}=this.transform,r={type:"kde",field:n,...e};return r.resolve=this.transform.resolve,r}}class qh extends Nt{clone(){return new qh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${wt(this.transform)}`}assemble(){const{extent:n,param:e}=this.transform;return{type:"extent",field:n,signal:e}}}class Uh extends Nt{clone(){return new Uh(this.parent,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const{flatten:r,as:i=[]}=this.transform;this.transform.as=r.map((a,o)=>i[o]??a)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${wt(this.transform)}`}assemble(){const{flatten:n,as:e}=this.transform;return{type:"flatten",fields:n,as:e}}}class Ih extends Nt{clone(){return new Ih(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"key",r[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${wt(this.transform)}`}assemble(){const{fold:n,as:e}=this.transform;return{type:"fold",fields:n,as:e}}}class qs extends Nt{clone(){return new qs(null,ft(this.fields),this.geojson,this.signal)}static parseAll(n,e){if(e.component.projection&&!e.component.projection.isFit)return n;let r=0;for(const i of[[dr,fr],[Ve,hr]]){const a=i.map(o=>{const s=mn(e.encoding[o]);return H(s)?s.field:Yr(s)?{expr:`${s.datum}`}:yr(s)?{expr:`${s.value}`}:void 0});(a[0]||a[1])&&(n=new qs(n,a,null,e.getName("geojson_"+r++)))}if(e.channelHasField(me)){const i=e.typedFieldDef(me);i.type===ws&&(n=new qs(n,null,i.field,e.getName("geojson_"+r++)))}return n}constructor(n,e,r,i){super(n),this.fields=e,this.geojson=r,this.signal=i}dependentFields(){const n=(this.fields??[]).filter(Q);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${wt(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class ql extends Nt{clone(){return new ql(null,this.projection,ft(this.fields),ft(this.as))}constructor(n,e,r,i){super(n),this.projection=e,this.fields=r,this.as=i}static parseAll(n,e){if(!e.projectionName())return n;for(const r of[[dr,fr],[Ve,hr]]){const i=r.map(o=>{const s=mn(e.encoding[o]);return H(s)?s.field:Yr(s)?{expr:`${s.datum}`}:yr(s)?{expr:`${s.value}`}:void 0}),a=r[0]===Ve?"2":"";(i[0]||i[1])&&(n=new ql(n,e.projectionName(),i,[e.getName(`x${a}`),e.getName(`y${a}`)]))}return n}dependentFields(){return new Set(this.fields.filter(Q))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${wt(this.fields)} ${wt(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class _o extends Nt{clone(){return new _o(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(n){const{start:e=0,stop:r,step:i}=n;return{signal:`sequence(${[e,r,...i?[i]:[]].join(",")})`}}static makeFromTransform(n,e){return new _o(n,e)}static makeFromEncoding(n,e){const r=e.encoding,i=r.x,a=r.y;if(H(i)&&H(a)){const o=i.impute?i:a.impute?a:void 0;if(o===void 0)return;const s=i.impute?a:a.impute?i:void 0,{method:u,value:l,frame:c,keyvals:f}=o.impute,d=s$(e.mark,r);return new _o(n,{impute:o.field,key:s.field,...u?{method:u}:{},...l!==void 0?{value:l}:{},...c?{frame:c}:{},...f!==void 0?{keyvals:f}:{},...d.length?{groupby:d}:{}})}return null}hash(){return`Impute ${wt(this.transform)}`}assemble(){const{impute:n,key:e,keyvals:r,method:i,groupby:a,value:o,frame:s=[null,null]}=this.transform,u={type:"impute",field:n,key:e,...r?{keyvals:(l=r,U(l,"stop")?this.processSequence(r):r)}:{},method:"value",...a?{groupby:a}:{},value:i&&i!=="value"?null:o};var l;return i&&i!=="value"?[u,{type:"window",as:[`imputed_${n}_value`],ops:[i],fields:[n],frame:s,ignorePeers:!1,...a?{groupby:a}:{}},{type:"formula",expr:`datum.${n} === null ? datum.imputed_${n}_value : datum.${n}`,as:n}]:[u]}}class Wh extends Nt{clone(){return new Wh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??e.on,r[1]??e.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${wt(this.transform)}`}assemble(){const{loess:n,on:e,...r}=this.transform;return{type:"loess",x:e,y:n,...r}}}class Ul extends Nt{clone(){return new Ul(null,ft(this.transform),this.secondary)}constructor(n,e,r){super(n),this.transform=e,this.secondary=r}static make(n,e,r,i){const a=e.component.data.sources,{from:o}=r;let s=null;if(function(u){return U(u,"data")}(o)){let u=KS(o.data,a);u||(u=new xo(o.data),a.push(u));const l=e.getName(`lookup_${i}`);s=new ye(u,l,Qt.Lookup,e.component.data.outputNodeRefCounts),e.component.data.outputNodes[l]=s}else if(function(u){return U(u,"param")}(o)){const u=o.param;let l;r={as:u,...r};try{l=e.getSelectionComponent(Xt(u),u)}catch{throw new Error(`Lookups can only be performed on selection parameters. "${u}" is a variable parameter.`)}if(s=l.materialized,!s)throw new Error(function(c){return`Cannot define and lookup the "${c}" selection in the same view. Try moving the lookup into a second, layered view?`}(u))}return new Ul(n,r,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?K(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${wt({transform:this.transform,secondary:this.secondary})}`}assemble(){let n;if(this.transform.from.fields)n={values:this.transform.from.fields,...this.transform.as?{as:K(this.transform.as)}:{}};else{let e=this.transform.as;Q(e)||(I('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),e="_lookup"),n={as:[e]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...n,...this.transform.default?{default:this.transform.default}:{}}}}class Hh extends Nt{clone(){return new Hh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"prob",r[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${wt(this.transform)}`}assemble(){const{quantile:n,...e}=this.transform;return{type:"quantile",field:n,...e}}}class Gh extends Nt{clone(){return new Gh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e,this.transform=ft(e);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??e.on,r[1]??e.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${wt(this.transform)}`}assemble(){const{regression:n,on:e,...r}=this.transform;return{type:"regression",x:e,y:n,...r}}}class Vh extends Nt{clone(){return new Vh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}addDimensions(n){this.transform.groupby=Pr((this.transform.groupby??[]).concat(n),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${wt(this.transform)}`}assemble(){const{pivot:n,value:e,groupby:r,limit:i,op:a}=this.transform;return{type:"pivot",field:n,value:e,...i!==void 0?{limit:i}:{},...a!==void 0?{op:a}:{},...r!==void 0?{groupby:r}:{}}}}class Yh extends Nt{clone(){return new Yh(null,ft(this.transform))}constructor(n,e){super(n),this.transform=e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${wt(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function YS(t){let n=0;return function e(r,i){if(r instanceof xo&&!r.isGenerator&&!$s(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof Un&&(r.parent instanceof xo&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof Ns)return i.name||(i.name="data_"+n++),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void t.push(...r.assemble());switch((r instanceof Pl||r instanceof jl||r instanceof Ls||r instanceof Ts||r instanceof js||r instanceof ql||r instanceof _r||r instanceof Ul||r instanceof Ps||r instanceof Ao||r instanceof Ih||r instanceof Uh||r instanceof Lh||r instanceof Wh||r instanceof Hh||r instanceof Gh||r instanceof _a||r instanceof Yh||r instanceof Vh||r instanceof qh)&&i.transform.push(r.assemble()),(r instanceof Zr||r instanceof Qr||r instanceof _o||r instanceof zi||r instanceof qs)&&i.transform.push(...r.assemble()),r instanceof ye&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof ye?r.setSource(i.name):(i.name||(i.name="data_"+n++),r.setSource(i.name),r.numChildren()===1&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof ye&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:e(r.children[0],i);break;default:{i.name||(i.name="data_"+n++);let a=i.name;!i.source||i.transform.length>0?t.push(i):a=i.source;for(const o of r.children)e(o,{name:null,source:a,transform:[]});break}}}}function qP(t){return t==="top"||t==="left"||it(t)?"header":"footer"}function UP(t,n){var o;const{facet:e,config:r,child:i,component:a}=t;if(t.channelHasField(n)){const s=e[n],u=Os("title",null,r,n);let l=Ds(s,r,{allowDisabling:!0,includeDefault:u===void 0||!!u});i.component.layoutHeaders[n].title&&(l=P(l)?l.join(", "):l,l+=` / ${i.component.layoutHeaders[n].title}`,i.component.layoutHeaders[n].title=null);const c=Os("labelOrient",s.header,r,n),f=s.header!==null&&un((o=s.header)==null?void 0:o.labels,r.header.labels,!0),d=vt(["bottom","right"],c)?"footer":"header";a.layoutHeaders[n]={title:s.header!==null?l:null,facetFieldDef:s,[d]:n==="facet"?[]:[XS(t,n,f)]}}}function XS(t,n,e){const r=n==="row"?"height":"width";return{labels:e,sizeSignal:t.child.component.layoutSize.get(r)?t.child.getSizeSignalRef(r):void 0,axes:[]}}function JS(t,n){const{child:e}=t;if(e.component.axes[n]){const{layoutHeaders:r,resolve:i}=t.component;if(i.axis[n]=xb(i,n),i.axis[n]==="shared"){const a=n==="x"?"column":"row",o=r[a];for(const s of e.component.axes[n]){const u=qP(s.get("orient"));o[u]??(o[u]=[XS(t,a,!1)]);const l=Rl(s,"main",t.config,{header:!0});l&&o[u][0].axes.push(l),s.mainExtracted=!0}}}}function Tb(t){for(const n of t.children)n.parseLayoutSize()}function Nh(t,n){const e=uS(n),r=Ld(e),i=t.component.resolve,a=t.component.layoutSize;let o;for(const s of t.children){const u=s.component.layoutSize.getWithExplicit(e),l=i.scale[r]??cS(r,t);if(l==="independent"&&u.value==="step"){o=void 0;break}if(o){if(l==="independent"&&o.value!==u.value){o=void 0;break}o=xa(o,u,e,"")}else o=u}if(o){for(const s of t.children)t.renameSignal(s.getName(e),t.getName(n)),s.component.layoutSize.set(e,"merged",!1);a.setWithExplicit(n,o)}else a.setWithExplicit(n,{explicit:!1,value:void 0})}function IP(t,n){const e=n==="width"?"x":"y",r=t.config,i=t.getScaleComponent(e);if(i){const a=i.get("type"),o=i.get("range");if(wn(a)){const s=mh(r.view,n);return ao(o)||Xr(s)?"step":s}return Rv(r.view,n)}if(t.hasProjection||t.mark==="arc")return Rv(r.view,n);{const a=mh(r.view,n);return Xr(a)?a.step:a}}function Pb(t,n,e){return Y(n,{suffix:`by_${Y(t)}`,...e})}class Ll extends VS{constructor(n,e,r,i){super(n,"facet",e,r,i,n.resolve),this.child=qb(n.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(n.facet)}initFacet(n){if(!Al(n))return{facet:this.initFacetFieldDef(n,"facet")};const e=q(n),r={};for(const i of e){if(![mi,gi].includes(i)){I(Wd(i,"facet"));break}const a=n[i];if(a.field===void 0){I(Wy(a,i));break}r[i]=this.initFacetFieldDef(a,i)}return r}initFacetFieldDef(n,e){const r=_v(n,e);return r.header?r.header=Sn(r.header):r.header===null&&(r.header=null),r}channelHasField(n){return U(this.facet,n)}fieldDef(n){return this.facet[n]}parseData(){this.component.data=Rh(this),this.child.parseData()}parseLayoutSize(){Tb(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some(n=>Kr(n))&&Gy(Iy)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(n){for(const e of Ye)UP(n,e);JS(n,"x"),JS(n,"y")}(this)}assembleSelectionTopLevelSignals(n){return this.child.assembleSelectionTopLevelSignals(n)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(n){return this.child.assembleSelectionData(n)}getHeaderLayoutMixins(){const n={};for(const e of Ye)for(const r of yb){const i=this.component.layoutHeaders[e],a=i[r],{facetFieldDef:o}=i;if(o){const s=Os("titleOrient",o.header,this.config,e);if(["right","bottom"].includes(s)){const u=Mh(e,s);n.titleAnchor??(n.titleAnchor={}),n.titleAnchor[u]="end"}}if(a!=null&&a[0]){const s=e==="row"?"height":"width",u=r==="header"?"headerBand":"footerBand";e==="facet"||this.child.component.layoutSize.get(s)||(n[u]??(n[u]={}),n[u][e]=.5),i.title&&(n.offset??(n.offset={}),n.offset[e==="row"?"rowTitle":"columnTitle"]=10)}}return n}assembleDefaultLayout(){const{column:n,row:e}=this.facet,r=n?this.columnDistinctSignal():e?1:void 0;let i="all";return(e||this.component.resolve.scale.x!=="independent")&&(n||this.component.resolve.scale.y!=="independent")||(i="none"),{...this.getHeaderLayoutMixins(),...r?{columns:r}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Ll))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(n){return this.parent&&this.parent instanceof Ll?{...this.channelHasField("column")?{encode:{update:{columns:{field:Y(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(n)}:super.assembleGroup(n)}getCardinalityAggregateForChild(){const n=[],e=[],r=[];if(this.child instanceof Ll){if(this.child.channelHasField("column")){const i=Y(this.child.facet.column);n.push(i),e.push("distinct"),r.push(`distinct_${i}`)}}else for(const i of wi){const a=this.child.component.scales[i];if(a&&!a.merged){const o=a.get("type"),s=a.get("range");if(wn(o)&&ao(s)){const u=zb(Oh(this.child,i));u?(n.push(u),e.push("distinct"),r.push(`distinct_${u}`)):I(Uy(i))}}}return{fields:n,ops:e,as:r}}assembleFacet(){const{name:n,data:e}=this.component.data.facetRoot,{row:r,column:i}=this.facet,{fields:a,ops:o,as:s}=this.getCardinalityAggregateForChild(),u=[];for(const c of Ye){const f=this.facet[c];if(f){u.push(Y(f));const{bin:d,sort:h}=f;if(Wt(d)&&u.push(Y(f,{binSuffix:"end"})),ki(h)){const{field:p,op:m=nh}=h,g=Pb(f,h);r&&i?(a.push(g),o.push("max"),s.push(g)):(a.push(p),o.push(m),s.push(g))}else if(P(h)){const p=zs(f,c);a.push(p),o.push("max"),s.push(p)}}}const l=!!r&&!!i;return{name:n,data:e,groupby:u,...l||a.length>0?{aggregate:{...l?{cross:l}:{},...a.length?{fields:a,ops:o,as:s}:{}}}:{}}}facetSortFields(n){const{facet:e}=this,r=e[n];return r?ki(r.sort)?[Pb(r,r.sort,{expr:"datum"})]:P(r.sort)?[zs(r,n,{expr:"datum"})]:[Y(r,{expr:"datum"})]:[]}facetSortOrder(n){const{facet:e}=this,r=e[n];if(r){const{sort:i}=r;return[(ki(i)?i.order:!P(i)&&i)||"ascending"]}return[]}assembleLabelTitle(){var i;const{facet:n,config:e}=this;if(n.facet)return vb(n.facet,"facet",e);const r={row:["top","bottom"],column:["left","right"]};for(const a of gb)if(n[a]){const o=Os("labelOrient",(i=n[a])==null?void 0:i.header,e,a);if(r[a].includes(o))return vb(n[a],a,e)}}assembleMarks(){const{child:n}=this,e=function(s){const u=[],l=YS(u);for(const c of s.children)l(c,{source:s.name,name:null,transform:[]});return u}(this.component.data.facetRoot),r=n.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||n.assembleTitle(),a=n.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:Ye.map(s=>this.facetSortFields(s)).flat(),order:Ye.map(s=>this.facetSortOrder(s)).flat()},...e.length>0?{data:e}:{},...r?{encode:{update:r}}:{},...n.assembleGroup(gT(this,[]))}]}getMapping(){return this.facet}}function KS(t,n){var e,r,i,a;for(const o of n){const s=o.data;if(t.name&&o.hasName()&&t.name!==o.dataName)continue;const u=(e=t.format)==null?void 0:e.mesh,l=(r=s.format)==null?void 0:r.feature;if(u&&l)continue;const c=(i=t.format)==null?void 0:i.feature;if((c||l)&&c!==l)continue;const f=(a=s.format)==null?void 0:a.mesh;if(!u&&!f||u===f){if(Cl(t)&&Cl(s)){if(Ce(t.values,s.values))return o}else if($s(t)&&$s(s)){if(t.url===s.url)return o}else if(J$(t)&&t.name===o.dataName)return o}}return null}function Rh(t){var m;let n=function(g,y){if(g.data||!g.parent){if(g.data===null){const x=new xo({values:[]});return y.push(x),x}const v=KS(g.data,y);if(v)return wa(g.data)||(v.data.format=uE({},g.data.format,v.data.format)),!v.hasName()&&g.data.name&&(v.dataName=g.data.name),v;{const x=new xo(g.data);return y.push(x),x}}return g.parent.component.data.facetRoot?g.parent.component.data.facetRoot:g.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:e,outputNodeRefCounts:r}=t.component.data,i=t.data,a=!(i&&(wa(i)||$s(i)||Cl(i)))&&t.parent?t.parent.component.data.ancestorParse.clone():new cT;wa(i)?(K$(i)?n=new jl(n,i.sequence):Hv(i)&&(n=new Pl(n,i.graticule)),a.parseNothing=!0):((m=i==null?void 0:i.format)==null?void 0:m.parse)===null&&(a.parseNothing=!0),n=Un.makeExplicit(n,t,a)??n,n=new _a(n);const o=t.parent&&Rs(t.parent);(Zt(t)||$e(t))&&o&&(n=Zr.makeFromEncoding(n,t)??n),t.transforms.length>0&&(n=function(g,y,v){let x=0;for(const b of y.transforms){let w,A;if(QR(b))A=g=new js(g,b),w="derived";else if(Uv(b)){const _=bP(b);A=g=Un.makeWithAncestors(g,{},_,v)??g,g=new Ts(g,y,b.filter)}else if(U$(b))A=g=Zr.makeFromTransform(g,b,y),w="number";else if(tT(b))w="date",v.getWithExplicit(b.field).value===void 0&&(g=new Un(g,{[b.field]:w}),v.set(b.field,w,!1)),A=g=Qr.makeFromTransform(g,b);else if(nT(b))A=g=_r.makeFromTransform(g,b),w="number",rb(y)&&(g=new _a(g));else if(q$(b))A=g=Ul.make(g,y,b,x++),w="derived";else if(XR(b))A=g=new Ps(g,b),w="number";else if(JR(b))A=g=new Ao(g,b),w="number";else if(eT(b))A=g=zi.makeFromTransform(g,b),w="derived";else if(rT(b))A=g=new Ih(g,b),w="derived";else if(iT(b))A=g=new qh(g,b),w="derived";else if(KR(b))A=g=new Uh(g,b),w="derived";else if(IR(b))A=g=new Vh(g,b),w="derived";else if(YR(b))g=new Yh(g,b);else if(ZR(b))A=g=_o.makeFromTransform(g,b),w="derived";else if(WR(b))A=g=new Lh(g,b),w="derived";else if(HR(b))A=g=new Hh(g,b),w="derived";else if(GR(b))A=g=new Gh(g,b),w="derived";else{if(!VR(b)){I(ON(b));continue}A=g=new Wh(g,b),w="derived"}if(A&&w!==void 0)for(const _ of A.producedFields()??[])v.set(_,w,!1)}return g}(n,t,a));const s=function(g){const y={};if(Zt(g)&&g.component.selection)for(const v of q(g.component.selection)){const x=g.component.selection[v];for(const b of x.project.items)!b.channel&&gs(b.field)>1&&(y[b.field]="flatten")}return y}(t),u=xP(t);n=Un.makeWithAncestors(n,{},{...s,...u},a)??n,Zt(t)&&(n=qs.parseAll(n,t),n=ql.parseAll(n,t)),(Zt(t)||$e(t))&&(o||(n=Zr.makeFromEncoding(n,t)??n),n=Qr.makeFromEncoding(n,t)??n,n=js.parseAllForSortIndex(n,t));const l=n=Th(Qt.Raw,t,n);if(Zt(t)){const g=_r.makeFromEncoding(n,t);g&&(n=g,rb(t)&&(n=new _a(n))),n=_o.makeFromEncoding(n,t)??n,n=zi.makeFromEncoding(n,t)??n}let c,f;if(Zt(t)){const{markDef:g,mark:y,config:v}=t,x=qt("invalid",g,v),{marks:b,scales:w}=f=Z$({invalid:x,isPath:ya(y)});b!==w&&w==="include-invalid-values"&&(c=n=Th(Qt.PreFilterInvalid,t,n)),b==="exclude-invalid-values"&&(n=Ls.make(n,t,f)??n)}const d=n=Th(Qt.Main,t,n);let h;if(Zt(t)&&f){const{marks:g,scales:y}=f;g==="include-invalid-values"&&y==="exclude-invalid-values"&&(n=Ls.make(n,t,f)??n,h=n=Th(Qt.PostFilterInvalid,t,n))}Zt(t)&&function(g,y){for(const[v,x]of sa(g.component.selection??{})){const b=g.getName(`lookup_${v}`);g.component.data.outputNodes[b]=x.materialized=new ye(new Ts(y,g,{param:v}),b,Qt.Lookup,g.component.data.outputNodeRefCounts)}}(t,d);let p=null;if($e(t)){const g=t.getName("facet");n=function(y,v){const{row:x,column:b}=v;if(x&&b){let w=null;for(const A of[x,b])if(ki(A.sort)){const{field:_,op:k=nh}=A.sort;y=w=new Ao(y,{joinaggregate:[{op:k,field:_,as:Pb(A,A.sort,{forAs:!0})}],groupby:[Y(A)]})}return w}return null}(n,t.facet)??n,p=new Ns(n,t,g,d.getSource()),e[g]=p}return{...t.component.data,outputNodes:e,outputNodeRefCounts:r,raw:l,main:d,facetRoot:p,ancestorParse:a,preFilterInvalid:c,postFilterInvalid:h}}function Th(t,n,e){const{outputNodes:r,outputNodeRefCounts:i}=n.component.data,a=n.getDataName(t),o=new ye(e,a,t,i);return r[a]=o,o}class WP extends Rb{constructor(n,e,r,i){var a,o,s,u;super(n,"concat",e,r,i,n.resolve),((o=(a=n.resolve)==null?void 0:a.axis)==null?void 0:o.x)!=="shared"&&((u=(s=n.resolve)==null?void 0:s.axis)==null?void 0:u.y)!=="shared"||I("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(n).map((l,c)=>qb(l,this,this.getName(`concat_${c}`),void 0,i))}parseData(){this.component.data=Rh(this);for(const n of this.children)n.parseData()}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const e of q(n.component.selection))this.component.selection[e]=n.component.selection[e]}Object.values(this.component.selection).some(n=>Kr(n))&&Gy(Iy)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){for(const n of this.children)n.parseAxesAndHeaders()}getChildren(n){return ph(n)?n.vconcat:Nv(n)?n.hconcat:n.concat}parseLayoutSize(){(function(n){Tb(n);const e=n.layout.columns===1?"width":"childWidth",r=n.layout.columns===void 0?"height":"childHeight";Nh(n,e),Nh(n,r)})(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(n){return this.children.reduce((e,r)=>r.assembleSelectionTopLevelSignals(e),n)}assembleSignals(){return this.children.forEach(n=>n.assembleSignals()),[]}assembleLayoutSignals(){const n=bb(this);for(const e of this.children)n.push(...e.assembleLayoutSignals());return n}assembleSelectionData(n){return this.children.reduce((e,r)=>r.assembleSelectionData(e),n)}assembleMarks(){return this.children.map(n=>{const e=n.assembleTitle(),r=n.assembleGroupStyle(),i=n.assembleGroupEncodeEntry(!1);return{type:"group",name:n.getName("group"),...e?{title:e}:{},...r?{style:r}:{},...i?{encode:{update:i}}:{},...n.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const n=this.layout.columns;return{...n!=null?{columns:n}:{},bounds:"full",align:"each"}}}const HP={disable:1,gridScale:1,scale:1,...t$,labelExpr:1,encode:1},QS=q(HP);class Ib extends Bi{constructor(n={},e={},r=!1){super(),this.explicit=n,this.implicit=e,this.mainExtracted=r}clone(){return new Ib(ft(this.explicit),ft(this.implicit),this.mainExtracted)}hasAxisPart(n){return n==="axis"||(n==="grid"||n==="title"?!!this.get(n):!((e=this.get(n))===!1||e===null));var e}hasOrientSignalRef(){return it(this.explicit.orient)}}const GP={bottom:"top",top:"bottom",left:"right",right:"left"};function VP(t,n){if(!t)return n.map(e=>e.clone());{if(t.length!==n.length)return;const e=t.length;for(let r=0;r{switch(e){case"title":return LE(i,a);case"gridScale":return{explicit:i.explicit,value:un(i.value,a.value)}}return yh(i,a,e,"axis")});t.setWithExplicit(e,r)}return t}function XP(t,n,e,r,i){if(n==="disable")return e!==void 0;switch(e=e||{},n){case"titleAngle":case"labelAngle":return t===(it(e.labelAngle)?e.labelAngle:hl(e.labelAngle));case"values":return!!e.values;case"encode":return!!e.encoding||!!e.labelAngle;case"title":if(t===eS(r,i))return!0}return t===e[n]}const JP=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function KP(t,n){var y,v;let e=n.axis(t);const r=new Ib,i=mn(n.encoding[t]),{mark:a,config:o}=n,s=(e==null?void 0:e.orient)||((y=o[t==="x"?"axisX":"axisY"])==null?void 0:y.orient)||((v=o.axis)==null?void 0:v.orient)||function(x){return x==="x"?"bottom":"left"}(t),u=n.getScaleComponent(t).get("type"),l=function(x,b,w,A){const _=b==="band"?["axisDiscrete","axisBand"]:b==="point"?["axisDiscrete","axisPoint"]:x3(b)?["axisQuantitative"]:b==="time"||b==="utc"?["axisTemporal"]:[],k=x==="x"?"axisX":"axisY",F=it(w)?"axisOrient":`axis${dl(w)}`,C=[..._,..._.map(E=>k+E.substr(4))],D=["axis",F,k];return{vlOnlyAxisConfig:Q5(C,A,x,w),vgAxisConfig:Q5(D,A,x,w),axisConfigStyle:eP([...D,...C],A)}}(t,u,s,n.config),c=e!==void 0?!e:pb("disable",o.style,e==null?void 0:e.style,l).configValue;if(r.set("disable",c,e!==void 0),c)return r;e=e||{};const f=function(x,b,w,A,_){const k=b==null?void 0:b.labelAngle;if(k!==void 0)return it(k)?k:hl(k);{const{configValue:F}=pb("labelAngle",A,b==null?void 0:b.style,_);return F!==void 0?hl(F):w!==Jt||!vt([iv,rv],x.type)||H(x)&&x.timeUnit?void 0:270}}(i,e,t,o.style,l),d=N3(e.formatType,i,u),h=O3(i,i.type,e.format,e.formatType,o,!0),p={fieldOrDatumDef:i,axis:e,channel:t,model:n,scaleType:u,orient:s,labelAngle:f,format:h,formatType:d,mark:a,config:o};for(const x of QS){const b=x in Z5?Z5[x](p):n$(x)?e[x]:void 0,w=b!==void 0,A=XP(b,x,e,n,t);if(w&&A)r.set(x,b,A);else{const{configValue:_,configFrom:k}=n$(x)&&x!=="values"?pb(x,o.style,e.style,l):{},F=_!==void 0;w&&!F?r.set(x,b,A):(k!=="vgAxisConfig"||JP.has(x)&&F||Fl(_)||it(_))&&r.set(x,_,!1)}}const m=e.encoding??{},g=Z3.reduce((x,b)=>{if(!r.hasAxisPart(b))return x;const w=lS(m[b]??{},n),A=b==="labels"?function(_,k,F){const{encoding:C,config:D}=_,E=mn(C[k])??mn(C[Ur(k)]),$=_.axis(k)||{},{format:M,formatType:S}=$;if(ho(S))return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:M,formatType:S,config:D}),...F};if(M===void 0&&S===void 0&&D.customFormatTypes){if(_s(E)==="quantitative"){if(ks(E)&&E.stack==="normalize"&&D.normalizedNumberFormatType)return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:D.normalizedNumberFormat,formatType:D.normalizedNumberFormatType,config:D}),...F};if(D.numberFormatType)return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:D.numberFormat,formatType:D.numberFormatType,config:D}),...F}}if(_s(E)==="temporal"&&D.timeFormatType&&H(E)&&!E.timeUnit)return{text:gr({fieldOrDatumDef:E,field:"datum.value",format:D.timeFormat,formatType:D.timeFormatType,config:D}),...F}}return F}(n,t,w):w;return A===void 0||jt(A)||(x[b]={update:A}),x},{});return jt(g)||r.set("encode",g,!!e.encoding||e.labelAngle!==void 0),r}function jb(t,n){const{config:e}=t;return{...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Mn("size",t),...Mn("angle",t),...QP(t,e,n)}}function QP(t,n,e){return e?{shape:{value:e}}:Mn("shape",t)}const ZP={vgMark:"rule",encodeEntry:t=>{const{markDef:n}=t,e=n.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?{...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ah("x",t,{defaultPos:e==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:e!=="vertical"}),...Ah("y",t,{defaultPos:e==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:e!=="horizontal"}),...Mn("size",t,{vgChannel:"strokeWidth"})}:{}}};function tj(t,n,e){if(qt("align",t,e)===void 0)return"center"}function nj(t,n,e){if(qt("baseline",t,e)===void 0)return"middle"}const ej={vgMark:"rect",encodeEntry:t=>{const{config:n,markDef:e}=t,r=e.orient,i=r==="horizontal"?"x":"y",a=r==="horizontal"?"y":"x",o=r==="horizontal"?"height":"width";return{...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,i),...se(a,t,{defaultPos:"mid",vgChannel:a==="y"?"yc":"xc"}),[o]:Gt(qt("thickness",e,n))}}},Ph={arc:{vgMark:"arc",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Ei(t,"radius"),...Ei(t,"theta")})},area:{vgMark:"area",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Ah("x",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:t.markDef.orient==="horizontal"}),...Ah("y",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:t.markDef.orient==="vertical"}),...nb(t)})},bar:{vgMark:"rect",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,"x"),...Ei(t,"y")})},circle:{vgMark:"symbol",encodeEntry:t=>jb(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:t=>{const{encoding:n}=t,e=n.shape;return[{type:"geoshape",projection:t.projectionName(),...e&&H(e)&&e.type===ws?{field:Y(e,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,"x"),...Ei(t,"y"),...Zv(t,"url")})},line:{vgMark:"line",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Mn("size",t,{vgChannel:"strokeWidth"}),...nb(t)})},point:{vgMark:"symbol",encodeEntry:t=>jb(t)},rect:{vgMark:"rect",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ei(t,"x"),...Ei(t,"y")})},rule:ZP,square:{vgMark:"symbol",encodeEntry:t=>jb(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:n,encoding:e}=t;return{...Xe(t,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Zv(t),...Mn("size",t,{vgChannel:"fontSize"}),...Mn("angle",t),...w5("align",tj(t.markDef,e,n)),...w5("baseline",nj(t.markDef,e,n)),...se("radius",t,{defaultPos:null}),...se("theta",t,{defaultPos:null})}}},tick:ej,trail:{vgMark:"trail",encodeEntry:t=>({...Xe(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...se("x",t,{defaultPos:"mid"}),...se("y",t,{defaultPos:"mid"}),...Mn("size",t),...nb(t)})}};function rj(t){if(vt([Kd,Xd,oR],t.mark)){const n=s$(t.mark,t.encoding);if(n.length>0)return function(e,r){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:ZS+e.requestDataName(Qt.Main),data:e.requestDataName(Qt.Main),groupby:r}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Lb(e,{fromPrefix:ZS})}]}(t,n)}else if(t.mark===Jd){const n=jy.some(e=>qt(e,t.markDef,t.config));if(t.stack&&!t.fieldDef("size")&&n)return function(e){var c;const[r]=Lb(e,{fromPrefix:t6}),i=e.scaleName(e.stack.fieldChannel),a=(f={})=>e.vgField(e.stack.fieldChannel,f),o=(f,d)=>`${f}(${[a({prefix:"min",suffix:"start",expr:d}),a({prefix:"max",suffix:"start",expr:d}),a({prefix:"min",suffix:"end",expr:d}),a({prefix:"max",suffix:"end",expr:d})].map(h=>`scale('${i}',${h})`).join(",")})`;let s,u;e.stack.fieldChannel==="x"?(s={...hs(r.encode.update,["y","yc","y2","height",...jy]),x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}},u={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},r.encode.update={...he(r.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(s={...hs(r.encode.update,["x","xc","x2","width"]),y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}},u={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},r.encode.update={...he(r.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const f of jy){const d=Wr(f,e.markDef,e.config);r.encode.update[f]?(s[f]=r.encode.update[f],delete r.encode.update[f]):d&&(s[f]=Gt(d)),d&&(r.encode.update[f]={value:0})}const l=[];if(((c=e.stack.groupbyChannels)==null?void 0:c.length)>0)for(const f of e.stack.groupbyChannels){const d=e.fieldDef(f),h=Y(d);h&&l.push(h),(d!=null&&d.bin||d!=null&&d.timeUnit)&&l.push(Y(d,{binSuffix:"end"}))}return s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((f,d)=>{if(r.encode.update[d])return{...f,[d]:r.encode.update[d]};{const h=Wr(d,e.markDef,e.config);return h!==void 0?{...f,[d]:Gt(h)}:f}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Qt.Main),name:t6+e.requestDataName(Qt.Main),groupby:l,aggregate:{fields:[a({suffix:"start"}),a({suffix:"start"}),a({suffix:"end"}),a({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:u},marks:[r]}]}]}(t)}return Lb(t)}const ZS="faceted_path_",t6="stack_group_";function Lb(t,n={fromPrefix:""}){const{mark:e,markDef:r,encoding:i,config:a}=t,o=un(r.clip,function(h){const p=h.getScaleComponent("x"),m=h.getScaleComponent("y");return!(!(p!=null&&p.get("selectionExtent"))&&!(m!=null&&m.get("selectionExtent")))||void 0}(t),function(h){const p=h.component.projection;return!(!p||p.isFit)||void 0}(t)),s=NE(r),u=i.key,l=function(h){const{encoding:p,stack:m,mark:g,markDef:y,config:v}=h,x=p.order;if(!(!P(x)&&yr(x)&&_y(x.value)||!x&&_y(qt("order",y,v)))){if((P(x)||H(x))&&!m)return TE(x,{expr:"datum"});if(ya(g)){const b=y.orient==="horizontal"?"y":"x";if(H(p[b]))return{field:b}}}}(t),c=function(h){if(!h.component.selection)return null;const p=q(h.component.selection).length;let m=p,g=h.parent;for(;g&&m===0;)m=q(g.component.selection).length,g=g.parent;return m?{interactive:p>0||h.mark==="geoshape"||!!h.encoding.tooltip||!!h.markDef.tooltip}:null}(t),f=qt("aria",r,a),d=Ph[e].postEncodingTransform?Ph[e].postEncodingTransform(t):null;return[{name:t.getName("marks"),type:Ph[e].vgMark,...o?{clip:o}:{},...s?{style:s}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:n.fromPrefix+t.requestDataName(Qt.Main)},encode:{update:Ph[e].encodeEntry(t)},...d?{transform:d}:{}}]}class n6 extends VS{constructor(n,e,r,i={},a){super(n,"unit",e,r,a,void 0,D$(n)?n.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=l=>{var c,f,d;return(c=l.from)!=null&&c.data&&(l.from.data=this.lookupDataSource(l.from.data),"time"in this.encoding&&(l.from.data=l.from.data+i5)),(d=(f=l.from)==null?void 0:f.facet)!=null&&d.data&&(l.from.facet.data=this.lookupDataSource(l.from.facet.data)),l};const o=Vr(n.mark)?{...n.mark}:{type:n.mark},s=o.type;o.filled===void 0&&(o.filled=function(l,c,{graticule:f}){if(f)return!1;const d=Wr("filled",l,c),h=l.type;return un(d,h!==Qd&&h!==Kd&&h!==Zd)}(o,a,{graticule:n.data&&Hv(n.data)}));const u=this.encoding=function(l,c,f,d){const h={};for(const p of q(l))wE(p)||I(RN(p));for(let p of gN){if(!l[p])continue;const m=l[p];if(gl(p)){const g=mN(p),y=h[g];if(H(y)&&YN(y.type)&&H(m)&&!y.timeUnit){I(NN(g));continue}}if(p!=="angle"||c!=="arc"||l.theta||(I("Arc marks uses theta channel rather than angle, replacing angle with theta."),p=Ge),vR(l,p,c)){if(p===bi&&c==="line"){const g=vr(l[p]);if(g!=null&&g.aggregate){I("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(p===pe&&(f?"fill"in l:"stroke"in l))I(JE("encoding",{fill:"fill"in l,stroke:"stroke"in l}));else if(p===ml||p===vs&&!P(m)&&!yr(m)||p===eo&&P(m)){if(m){if(p===vs){const g=l[p];if(I3(g)){h[p]=g;continue}}h[p]=K(m).reduce((g,y)=>(H(y)?g.push(_v(y,p)):I(Wy(y,p)),g),[])}}else{if(p===eo&&m===null)h[p]=null;else if(!(H(m)||Yr(m)||yr(m)||_l(m)||it(m))){I(Wy(m,p));continue}h[p]=J3(m,p,d)}}else I(Wd(p,c))}return h}(n.encoding||{},s,o.filled,a);this.markDef=z$(o,u,a),this.size=function({encoding:l,size:c}){for(const f of wi){const d=ge(f);Xr(c[d])&&ba(l[f])&&(delete c[d],I(QE(d)))}return c}({encoding:u,size:D$(n)?{...i,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}}:i}),this.stack=B$(this.markDef,u),this.specifiedScales=this.initScales(s,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=n.projection,this.selection=(n.params??[]).filter(l=>zv(l))}get hasProjection(){const{encoding:n}=this,e=this.mark===F3,r=n&&lN.some(i=>ht(n[i]));return e||r}scaleDomain(n){const e=this.specifiedScales[n];return e?e.domain:void 0}axis(n){return this.specifiedAxes[n]}legend(n){return this.specifiedLegends[n]}initScales(n,e){return Ty.reduce((r,i)=>{const a=mn(e[i]);return a&&(r[i]=this.initScale(a.scale??{})),r},{})}initScale(n){const{domain:e,range:r}=n,i=Sn(n);return P(e)&&(i.domain=e.map(Ee)),P(r)&&(i.range=r.map(Ee)),i}initAxes(n){return wi.reduce((e,r)=>{const i=n[r];if(ht(i)||r===Jt&&ht(n.x2)||r===bn&&ht(n.y2)){const a=ht(i)?i.axis:void 0;e[r]=a&&this.initAxis({...a})}return e},{})}initAxis(n){const e=q(n),r={};for(const i of e){const a=n[i];r[i]=Fl(a)?BE(a):Ee(a)}return r}initLegends(n){return FE.reduce((e,r)=>{const i=mn(n[r]);if(i&&function(a){switch(a){case pe:case Lr:case qr:case bi:case me:case xi:case da:case ha:return!0;case ca:case fa:case no:case la:return!1}}(r)){const a=i.legend;e[r]=a&&Sn(a)}return e},{})}parseData(){this.component.data=Rh(this)}parseLayoutSize(){(function(n){const{size:e,component:r}=n;for(const i of wi){const a=ge(i);if(e[a]){const o=e[a];r.layoutSize.set(a,Xr(o)?"step":o,!0)}else{const o=IP(n,a);r.layoutSize.set(a,o,!1)}}})(this)}parseSelections(){this.component.selection=function(n,e){const r={},i=n.config.selection;if(!e||!e.length)return r;let a=0;for(const o of e){const s=Xt(o.name),u=o.select,l=Q(u)?u:u.type,c=Z(u)?ft(u):{type:l},f=i[l];for(const p in f)p!=="fields"&&p!=="encodings"&&(p==="mark"&&(c.mark={...f.mark,...c.mark}),c[p]!==void 0&&c[p]!==!0||(c[p]=ft(f[p]??c[p])));const d=r[s]={...c,name:s,type:l,init:o.value,bind:o.bind,events:Q(c.on)?aa(c.on,"scope"):K(ft(c.on))};if(Kr(d)&&(a++,a>1)){delete r[s];continue}const h=ft(o);for(const p of Dh)p.defined(d)&&p.parse&&p.parse(n,d,h)}return a>1&&I("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),r}(this,this.selection)}parseMarkGroup(){this.component.mark=rj(this)}parseAxesAndHeaders(){var n;this.component.axes=(n=this,wi.reduce((e,r)=>(n.component.scales[r]&&(e[r]=[KP(r,n)]),e),{}))}assembleSelectionTopLevelSignals(n){return function(e,r){let i=!1;for(const a of En(e.component.selection??{})){const o=a.name,s=G(o+yo);if(r.filter(u=>u.name===o).length===0){const u=a.resolve==="global"?"union":a.resolve,l=a.type==="point"?", true, true)":")";r.push({name:a.name,update:`${B5}(${s}, ${G(u)}${l}`})}i=!0;for(const u of Dh)u.defined(a)&&u.topLevelSignals&&(r=u.topLevelSignals(e,a,r))}return i&&r.filter(a=>a.name==="unit").length===0&&r.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),Jv(r)}(this,n)}assembleSignals(){return[...K5(this),...mT(this,[])]}assembleSelectionData(n){return function(e,r){const i=[],a=[],o=vo(e,{escape:!1});for(const s of En(e.component.selection??{})){const u={name:s.name+yo};if(s.project.hasSelectionId&&(u.transform=[{type:"collect",sort:{field:br}}]),s.init){const l=s.project.items.map(s5);u.values=s.project.hasSelectionId?s.init.map(c=>({unit:o,[br]:go(c,!1)[0]})):s.init.map(c=>({unit:o,fields:l,values:go(c,!1)}))}if([...i,...r].filter(l=>l.name===s.name+yo).length||i.push(u),Kr(s)&&r.length){const l=e.lookupDataSource(e.getDataName(Qt.Main)),c=r.find(d=>d.name===l),f=c.transform.find(d=>d.type==="filter"&&d.expr.includes("vlSelectionTest"));if(f){c.transform=c.transform.filter(h=>h!==f);const d={name:c.name+i5,source:c.name,transform:[f]};a.push(d)}}}return i.concat(r,a)}(this,n)}assembleLayout(){return null}assembleLayoutSignals(){return bb(this)}assembleMarks(){let n=this.component.mark??[];return this.parent&&Rs(this.parent)||(n=u5(this,n)),n.map(this.correctDataNames)}assembleGroupStyle(){const{style:n}=this.view||{};return n!==void 0?n:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(n){return mo(this.encoding,n)}fieldDef(n){return vr(this.encoding[n])}typedFieldDef(n){const e=this.fieldDef(n);return oe(e)?e:null}}class Wb extends Rb{constructor(n,e,r,i,a){super(n,"layer",e,r,a,n.resolve,n.view);const o={...i,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}};this.children=n.layer.map((s,u)=>{if(gh(s))return new Wb(s,this,this.getName(`layer_${u}`),o,a);if(Di(s))return new n6(s,this,this.getName(`layer_${u}`),o,a);throw new Error(qy(s))})}parseData(){this.component.data=Rh(this);for(const n of this.children)n.parseData()}parseLayoutSize(){var n;Tb(n=this),Nh(n,"width"),Nh(n,"height")}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const e of q(n.component.selection))this.component.selection[e]=n.component.selection[e]}Object.values(this.component.selection).some(n=>Kr(n))&&Gy(Iy)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){(function(n){const{axes:e,resolve:r}=n.component,i={top:0,bottom:0,right:0,left:0};for(const a of n.children){a.parseAxesAndHeaders();for(const o of q(a.component.axes))r.axis[o]=xb(n.component.resolve,o),r.axis[o]==="shared"&&(e[o]=VP(e[o],a.component.axes[o]),e[o]||(r.axis[o]="independent",delete e[o]))}for(const a of wi){for(const o of n.children)if(o.component.axes[a]){if(r.axis[a]==="independent"){e[a]=(e[a]??[]).concat(o.component.axes[a]);for(const s of o.component.axes[a]){const{value:u,explicit:l}=s.getWithExplicit("orient");if(!it(u)){if(i[u]>0&&!l){const c=GP[u];i[u]>i[c]&&s.set("orient",c,!1)}i[u]++}}}delete o.component.axes[a]}if(r.axis[a]==="independent"&&e[a]&&e[a].length>1)for(const[o,s]of(e[a]||[]).entries())o>0&&s.get("grid")&&!s.explicit.grid&&(s.implicit.grid=!1)}})(this)}assembleSelectionTopLevelSignals(n){return this.children.reduce((e,r)=>r.assembleSelectionTopLevelSignals(e),n)}assembleSignals(){return this.children.reduce((n,e)=>n.concat(e.assembleSignals()),K5(this))}assembleLayoutSignals(){return this.children.reduce((n,e)=>n.concat(e.assembleLayoutSignals()),bb(this))}assembleSelectionData(n){return this.children.reduce((e,r)=>r.assembleSelectionData(e),n)}assembleGroupStyle(){const n=new Set;for(const r of this.children)for(const i of K(r.assembleGroupStyle()))n.add(i);const e=Array.from(n);return e.length>1?e:e.length===1?e[0]:void 0}assembleTitle(){let n=super.assembleTitle();if(n)return n;for(const e of this.children)if(n=e.assembleTitle(),n)return n}assembleLayout(){return null}assembleMarks(){return function(n,e){for(const r of n.children)Zt(r)&&(e=u5(r,e));return e}(this,this.children.flatMap(n=>n.assembleMarks()))}assembleLegends(){return this.children.reduce((n,e)=>n.concat(e.assembleLegends()),xS(this))}}function qb(t,n,e,r,i){if(eh(t))return new Ll(t,n,e,i);if(gh(t))return new Wb(t,n,e,r,i);if(Di(t))return new n6(t,n,e,r,i);if(function(a){return ph(a)||Nv(a)||Ov(a)}(t))return new WP(t,n,e,i);throw new Error(qy(t))}function ij(t,n={}){var e;n.logger&&(e=n.logger,vl=e),n.fieldTitle&&X3(n.fieldTitle);try{const r=S$(Yl(n.config,t.config)),i=G$(t,r),a=qb(i,null,"",void 0,r);return a.parse(),function(s,u){$b(s.sources);let l=0,c=0;for(let f=0;f<5&&$S(s,u,!0);f++)l++;s.sources.map(Cb);for(let f=0;f<5&&$S(s,u,!1);f++)c++;$b(s.sources),Math.max(l,c)===5&&I("Maximum optimization runs(5) reached.")}(a.component.data,a),{spec:function(s,u,l={},c){const f=s.config?zR(s.config):void 0,d=function(w,A){const _=[],k=YS(_);let F=0;for(const D of w.sources){D.hasName()||(D.dataName="source_"+F++);const E=D.assemble();k(D,E)}for(const D of _)D.transform.length===0&&delete D.transform;let C=0;for(const[D,E]of _.entries())(E.transform??[]).length!==0||E.source||_.splice(C++,0,_.splice(D,1)[0]);for(const D of _)for(const E of D.transform??[])E.type==="lookup"&&(E.from=w.outputNodes[E.from].getSource());for(const D of _)D.name in A&&(D.values=A[D.name]);return _}(s.component.data,l),h=s.assembleSelectionData(d),p=s.assembleProjections(),m=s.assembleTitle(),g=s.assembleGroupStyle(),y=s.assembleGroupEncodeEntry(!0);let v=s.assembleLayoutSignals();v=v.filter(w=>w.name!=="width"&&w.name!=="height"||w.value===void 0||(u[w.name]=+w.value,!1));const{params:x,...b}=u;return{$schema:"https://vega.github.io/schema/vega/v5.json",...s.description?{description:s.description}:{},...b,...m?{title:m}:{},...g?{style:g}:{},...y?{encode:{update:y}}:{},data:h,...p.length>0?{projections:p}:{},...s.assembleGroup([...v,...s.assembleSelectionTopLevelSignals([]),..._$(x)]),...f?{config:f}:{},...c?{usermeta:c}:{}}}(a,function(s,u,l,c){const f=c.component.layoutSize.get("width"),d=c.component.layoutSize.get("height");if(u===void 0?(u={type:"pad"},c.hasAxisOrientSignalRef()&&(u.resize=!0)):Q(u)&&(u={type:u}),f&&d&&(h=u.type,["fit","fit-x","fit-y"].includes(h))){if(f==="step"&&d==="step")I(IE()),u.type="pad";else if(f==="step"||d==="step"){const p=f==="step"?"width":"height";I(IE(Ld(p)));const m=p==="width"?"height":"width";u.type=function(g){return g?`fit-${Ld(g)}`:"fit"}(m)}}var h;return{...q(u).length===1&&u.type?u.type==="pad"?{}:{autosize:u.type}:{autosize:u},...Y$(l,!1),...Y$(s,!0)}}(t,i.autosize,r,a),t.datasets,t.usermeta),normalized:i}}finally{n.logger&&(vl=e3),n.fieldTitle&&X3(V3)}}export{sE as A,G$ as B,hl as C,he as D,hs as E,Fy as F,ms as G,to as H,He as I,uN as J,lE as K,ps as L,jn as M,Lt as N,dl as O,Pr as P,dE as Q,En as R,Xt as S,iN as T,qd as U,FE as V,gs as a,Ey as b,ij as c,Ot as d,vt as e,Ce as f,zd as g,ft as h,sa as i,ky as j,Cy as k,cE as l,un as m,Dy as n,U as o,wt as p,hE as q,cl as r,jt as s,oN as t,pE as u,_y as v,Od as w,q as x,fl as y,uE as z}; diff --git a/notebooks/assets/crystal-CRzZ78HM.js b/notebooks/assets/crystal-CRzZ78HM.js new file mode 100644 index 0000000000000000000000000000000000000000..b3e69aab9e44ee8bcf409042604d1d12c0441c46 --- /dev/null +++ b/notebooks/assets/crystal-CRzZ78HM.js @@ -0,0 +1 @@ +function l(t,e){return new RegExp((e?"":"^")+"(?:"+t.join("|")+")"+(e?"$":"\\b"))}function o(t,e,n){return n.tokenize.push(t),t(e,n)}var F=/^(?:[-+/%|&^]|\*\*?|[<>]{2})/,_=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,I=/^(?:\[\][?=]?)/,A=/^(?:\.(?:\.{2})?|->|[?:])/,h=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,k=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,E=l(["abstract","alias","as","asm","begin","break","case","class","def","do","else","elsif","end","ensure","enum","extend","for","fun","if","include","instance_sizeof","lib","macro","module","next","of","out","pointerof","private","protected","rescue","return","require","select","sizeof","struct","super","then","type","typeof","uninitialized","union","unless","until","when","while","with","yield","__DIR__","__END_LINE__","__FILE__","__LINE__"]),T=l(["true","false","nil","self"]),Z=l(["def","fun","macro","class","module","struct","lib","enum","union","do","for"]),N=l(["if","unless","case","while","until","begin","then"]),w=["end","else","elsif","rescue","ensure"],O=l(w),y=["\\)","\\}","\\]"],D=new RegExp("^(?:"+y.join("|")+")$"),v={def:S,fun:S,macro:function(t,e){if(t.eatSpace())return null;var n;if(n=t.match(h)){if(n=="def")return"keyword";t.eat(/[?!]/)}return e.tokenize.pop(),"def"},class:f,module:f,struct:f,lib:f,enum:f,union:f},z={"[":"]","{":"}","(":")","<":">"};function b(t,e){if(t.eatSpace())return null;if(e.lastToken!="\\"&&t.match("{%",!1))return o(s("%","%"),t,e);if(e.lastToken!="\\"&&t.match("{{",!1))return o(s("{","}"),t,e);if(t.peek()=="#")return t.skipToEnd(),"comment";var n;if(t.match(h))return t.eat(/[?!]/),n=t.current(),t.eat(":")?"atom":e.lastToken=="."?"property":E.test(n)?(Z.test(n)?n=="fun"&&e.blocks.indexOf("lib")>=0||n=="def"&&e.lastToken=="abstract"||(e.blocks.push(n),e.currentIndent+=1):e.lastStyle!="operator"&&e.lastStyle||!N.test(n)?n=="end"&&(e.blocks.pop(),e.currentIndent-=1):(e.blocks.push(n),e.currentIndent+=1),v.hasOwnProperty(n)&&e.tokenize.push(v[n]),"keyword"):T.test(n)?"atom":"variable";if(t.eat("@"))return t.peek()=="["?o(m("[","]","meta"),t,e):(t.eat("@"),t.match(h)||t.match(k),"propertyName");if(t.match(k))return"tag";if(t.eat(":"))return t.eat('"')?o(g('"',"atom",!1),t,e):t.match(h)||t.match(k)||t.match(F)||t.match(_)||t.match(I)?"atom":(t.eat(":"),"operator");if(t.eat('"'))return o(g('"',"string",!0),t,e);if(t.peek()=="%"){var r,a="string",u=!0;if(t.match("%r"))a="string.special",r=t.next();else if(t.match("%w"))u=!1,r=t.next();else if(t.match("%q"))u=!1,r=t.next();else if(r=t.match(/^%([^\w\s=])/))r=r[1];else{if(t.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return"meta";if(t.eat("%"))return"operator"}return z.hasOwnProperty(r)&&(r=z[r]),o(g(r,a,u),t,e)}return(n=t.match(/^<<-('?)([A-Z]\w*)\1/))?o(function(c,x){return function(i,p){if(i.sol()&&(i.eatSpace(),i.match(c)))return p.tokenize.pop(),"string";for(var d=!1;i.peek();)if(d)i.next(),d=!1;else{if(i.match("{%",!1))return p.tokenize.push(s("%","%")),"string";if(i.match("{{",!1))return p.tokenize.push(s("{","}")),"string";if(x&&i.match("#{",!1))return p.tokenize.push(m("#{","}","meta")),"string";d=i.next()=="\\"&&x}return"string"}}(n[2],!n[1]),t,e):t.eat("'")?(t.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),t.eat("'"),"atom"):t.eat("0")?(t.eat("x")?t.match(/^[0-9a-fA-F_]+/):t.eat("o")?t.match(/^[0-7_]+/):t.eat("b")&&t.match(/^[01_]+/),"number"):t.eat(/^\d/)?(t.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),"number"):t.match(F)?(t.eat("="),"operator"):t.match(_)||t.match(A)?"operator":(n=t.match(/[({[]/,!1))?o(m(n=n[0],z[n],null),t,e):t.eat("\\")?(t.next(),"meta"):(t.next(),null)}function m(t,e,n,r){return function(a,u){if(!r&&a.match(t))return u.tokenize[u.tokenize.length-1]=m(t,e,n,!0),u.currentIndent+=1,n;var c=b(a,u);return a.current()===e&&(u.tokenize.pop(),u.currentIndent-=1,c=n),c}}function s(t,e,n){return function(r,a){return!n&&r.match("{"+t)?(a.currentIndent+=1,a.tokenize[a.tokenize.length-1]=s(t,e,!0),"meta"):r.match(e+"}")?(a.currentIndent-=1,a.tokenize.pop(),"meta"):b(r,a)}}function S(t,e){return t.eatSpace()?null:(t.match(h)?t.eat(/[!?]/):t.match(F)||t.match(_)||t.match(I),e.tokenize.pop(),"def")}function f(t,e){return t.eatSpace()?null:(t.match(k),e.tokenize.pop(),"def")}function g(t,e,n){return function(r,a){for(var u=!1;r.peek();)if(u)r.next(),u=!1;else{if(r.match("{%",!1))return a.tokenize.push(s("%","%")),e;if(r.match("{{",!1))return a.tokenize.push(s("{","}")),e;if(n&&r.match("#{",!1))return a.tokenize.push(m("#{","}","meta")),e;var c=r.next();if(c==t)return a.tokenize.pop(),e;u=n&&c=="\\"}return e}}const L={name:"crystal",startState:function(){return{tokenize:[b],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(t,e){var n=e.tokenize[e.tokenize.length-1](t,e),r=t.current();return n&&n!="comment"&&(e.lastToken=r,e.lastStyle=n),n},indent:function(t,e,n){return e=e.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,""),O.test(e)||D.test(e)?n.unit*(t.currentIndent-1):n.unit*t.currentIndent},languageData:{indentOnInput:l(y.concat(w),!0),commentTokens:{line:"#"}}};export{L as crystal}; diff --git a/notebooks/assets/css-ZjFoif2m.js b/notebooks/assets/css-ZjFoif2m.js new file mode 100644 index 0000000000000000000000000000000000000000..a717aef2161955cd4ac1ee74c9602a2e569f28ae --- /dev/null +++ b/notebooks/assets/css-ZjFoif2m.js @@ -0,0 +1 @@ +function k(o){var n,a,h=(o={...ne,...o}).inline,C=o.tokenHooks,M=o.documentTypes||{},G=o.mediaTypes||{},J=o.mediaFeatures||{},Q=o.mediaValueKeywords||{},A=o.propertyKeywords||{},S=o.nonStandardPropertyKeywords||{},R=o.fontProperties||{},ee=o.counterDescriptors||{},T=o.colorKeywords||{},F=o.valueKeywords||{},g=o.allowNested,te=o.lineComment,re=o.supportsAtComponent===!0,N=o.highlightNonStandardPropertyKeywords!==!1;function s(e,r){return n=r,e}function oe(e,r){var t=e.next();if(C[t]){var i=C[t](e,r);if(i!==!1)return i}return t=="@"?(e.eatWhile(/[\w\\\-]/),s("def",e.current())):t=="="||(t=="~"||t=="|")&&e.eat("=")?s(null,"compare"):t=='"'||t=="'"?(r.tokenize=$(t),r.tokenize(e,r)):t=="#"?(e.eatWhile(/[\w\\\-]/),s("atom","hash")):t=="!"?(e.match(/^\s*\w*/),s("keyword","important")):/\d/.test(t)||t=="."&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),s("number","unit")):t!=="-"?/[,+>*\/]/.test(t)?s(null,"select-op"):t=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?s("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(t)?s(null,t):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(r.tokenize=ie),s("variableName.function","variable")):/[\w\\\-]/.test(t)?(e.eatWhile(/[\w\\\-]/),s("property","word")):s(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),s("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?s("def","variable-definition"):s("variableName","variable")):e.match(/^\w+-/)?s("meta","meta"):void 0}function $(e){return function(r,t){for(var i,c=!1;(i=r.next())!=null;){if(i==e&&!c){e==")"&&r.backUp(1);break}c=!c&&i=="\\"}return(i==e||!c&&e!=")")&&(t.tokenize=null),s("string","string")}}function ie(e,r){return e.next(),e.match(/^\s*[\"\')]/,!1)?r.tokenize=null:r.tokenize=$(")"),s(null,"(")}function L(e,r,t){this.type=e,this.indent=r,this.prev=t}function l(e,r,t,i){return e.context=new L(t,r.indentation()+(i===!1?0:r.indentUnit),e.context),t}function d(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function b(e,r,t){return f[t.context.type](e,r,t)}function m(e,r,t,i){for(var c=i||1;c>0;c--)t.context=t.context.prev;return b(e,r,t)}function W(e){var r=e.current().toLowerCase();a=F.hasOwnProperty(r)?"atom":T.hasOwnProperty(r)?"keyword":"variable"}var f={top:function(e,r,t){if(e=="{")return l(t,r,"block");if(e=="}"&&t.context.prev)return d(t);if(re&&/@component/i.test(e))return l(t,r,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return l(t,r,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return l(t,r,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return t.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&e.charAt(0)=="@")return l(t,r,"at");if(e=="hash")a="builtin";else if(e=="word")a="tag";else{if(e=="variable-definition")return"maybeprop";if(e=="interpolation")return l(t,r,"interpolation");if(e==":")return"pseudo";if(g&&e=="(")return l(t,r,"parens")}return t.context.type},block:function(e,r,t){if(e=="word"){var i=r.current().toLowerCase();return A.hasOwnProperty(i)?(a="property","maybeprop"):S.hasOwnProperty(i)?(a=N?"string.special":"property","maybeprop"):g?(a=r.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(a="error","maybeprop")}return e=="meta"?"block":g||e!="hash"&&e!="qualifier"?f.top(e,r,t):(a="error","block")},maybeprop:function(e,r,t){return e==":"?l(t,r,"prop"):b(e,r,t)},prop:function(e,r,t){if(e==";")return d(t);if(e=="{"&&g)return l(t,r,"propBlock");if(e=="}"||e=="{")return m(e,r,t);if(e=="(")return l(t,r,"parens");if(e!="hash"||/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(r.current())){if(e=="word")W(r);else if(e=="interpolation")return l(t,r,"interpolation")}else a="error";return"prop"},propBlock:function(e,r,t){return e=="}"?d(t):e=="word"?(a="property","maybeprop"):t.context.type},parens:function(e,r,t){return e=="{"||e=="}"?m(e,r,t):e==")"?d(t):e=="("?l(t,r,"parens"):e=="interpolation"?l(t,r,"interpolation"):(e=="word"&&W(r),"parens")},pseudo:function(e,r,t){return e=="meta"?"pseudo":e=="word"?(a="variableName.constant",t.context.type):b(e,r,t)},documentTypes:function(e,r,t){return e=="word"&&M.hasOwnProperty(r.current())?(a="tag",t.context.type):f.atBlock(e,r,t)},atBlock:function(e,r,t){if(e=="(")return l(t,r,"atBlock_parens");if(e=="}"||e==";")return m(e,r,t);if(e=="{")return d(t)&&l(t,r,g?"block":"top");if(e=="interpolation")return l(t,r,"interpolation");if(e=="word"){var i=r.current().toLowerCase();a=i=="only"||i=="not"||i=="and"||i=="or"?"keyword":G.hasOwnProperty(i)?"attribute":J.hasOwnProperty(i)?"property":Q.hasOwnProperty(i)?"keyword":A.hasOwnProperty(i)?"property":S.hasOwnProperty(i)?N?"string.special":"property":F.hasOwnProperty(i)?"atom":T.hasOwnProperty(i)?"keyword":"error"}return t.context.type},atComponentBlock:function(e,r,t){return e=="}"?m(e,r,t):e=="{"?d(t)&&l(t,r,g?"block":"top",!1):(e=="word"&&(a="error"),t.context.type)},atBlock_parens:function(e,r,t){return e==")"?d(t):e=="{"||e=="}"?m(e,r,t,2):f.atBlock(e,r,t)},restricted_atBlock_before:function(e,r,t){return e=="{"?l(t,r,"restricted_atBlock"):e=="word"&&t.stateArg=="@counter-style"?(a="variable","restricted_atBlock_before"):b(e,r,t)},restricted_atBlock:function(e,r,t){return e=="}"?(t.stateArg=null,d(t)):e=="word"?(a=t.stateArg=="@font-face"&&!R.hasOwnProperty(r.current().toLowerCase())||t.stateArg=="@counter-style"&&!ee.hasOwnProperty(r.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,r,t){return e=="word"?(a="variable","keyframes"):e=="{"?l(t,r,"top"):b(e,r,t)},at:function(e,r,t){return e==";"?d(t):e=="{"||e=="}"?m(e,r,t):(e=="word"?a="tag":e=="hash"&&(a="builtin"),"at")},interpolation:function(e,r,t){return e=="}"?d(t):e=="{"||e==";"?m(e,r,t):(e=="word"?a="variable":e!="variable"&&e!="("&&e!=")"&&(a="error"),"interpolation")}};return{name:o.name,startState:function(){return{tokenize:null,state:h?"block":"top",stateArg:null,context:new L(h?"block":"top",0,null)}},token:function(e,r){if(!r.tokenize&&e.eatSpace())return null;var t=(r.tokenize||oe)(e,r);return t&&typeof t=="object"&&(n=t[1],t=t[0]),a=t,n!="comment"&&(r.state=f[r.state](n,e,r)),a},indent:function(e,r,t){var i=e.context,c=r&&r.charAt(0),q=i.indent;return i.type!="prop"||c!="}"&&c!=")"||(i=i.prev),i.prev&&(c!="}"||i.type!="block"&&i.type!="top"&&i.type!="interpolation"&&i.type!="restricted_atBlock"?(c!=")"||i.type!="parens"&&i.type!="atBlock_parens")&&(c!="{"||i.type!="at"&&i.type!="atBlock")||(q=Math.max(0,i.indent-t.unit)):q=(i=i.prev).indent),q},languageData:{indentOnInput:/^\s*\}$/,commentTokens:{line:te,block:{open:"/*",close:"*/"}},autocomplete:I}}}function p(o){for(var n={},a=0;a=&|~%^]/;const f={name:"cypher",startState:function(){return{tokenize:p,context:null,indent:0,col:0}},token:function(t,e){if(t.sol()&&(e.context&&e.context.align==null&&(e.context.align=!1),e.indent=t.indentation()),t.eatSpace())return null;var n=e.tokenize(t,e);if(n!=="comment"&&e.context&&e.context.align==null&&e.context.type!=="pattern"&&(e.context.align=!0),a==="(")i(e,")",t.column());else if(a==="[")i(e,"]",t.column());else if(a==="{")i(e,"}",t.column());else if(/[\]\}\)]/.test(a)){for(;e.context&&e.context.type==="pattern";)s(e);e.context&&a===e.context.type&&s(e)}else a==="."&&e.context&&e.context.type==="pattern"?s(e):/atom|string|variable/.test(n)&&e.context&&(/[\}\]]/.test(e.context.type)?i(e,"pattern",t.column()):e.context.type!=="pattern"||e.context.align||(e.context.align=!0,e.context.col=t.column()));return n},indent:function(t,e,n){var l=e&&e.charAt(0),r=t.context;if(/[\]\}]/.test(l))for(;r&&r.type==="pattern";)r=r.prev;var c=r&&l===r.type;return r?r.type==="keywords"?null:r.align?r.col+(c?0:1):r.indent+(c?0:n.unit):0}};export{f as cypher}; diff --git a/notebooks/assets/cytoscape.esm-UYyVlru8.js b/notebooks/assets/cytoscape.esm-UYyVlru8.js new file mode 100644 index 0000000000000000000000000000000000000000..9ed451af91f5ff0acb5b302165dec82a744aee45 --- /dev/null +++ b/notebooks/assets/cytoscape.esm-UYyVlru8.js @@ -0,0 +1,10 @@ +function Ne(e){return Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function ra(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aa(e,t,n){return t&&function(r,a){for(var o=0;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){s=!0,o=l},f:function(){try{i||n.return==null||n.return()}finally{if(s)throw o}}}}var Ae=typeof window>"u"?null:window,yi=Ae?Ae.navigator:null;Ae&&Ae.document;var dl=Ne(""),mi=Ne({}),hl=Ne(function(){}),pl=typeof HTMLElement>"u"?"undefined":Ne(HTMLElement),An=function(e){return e&&e.instanceString&&Me(e.instanceString)?e.instanceString():null},ce=function(e){return e!=null&&Ne(e)==dl},Me=function(e){return e!=null&&Ne(e)===hl},ke=function(e){return!tt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ve=function(e){return e!=null&&Ne(e)===mi&&!ke(e)&&e.constructor===Object},te=function(e){return e!=null&&Ne(e)===Ne(1)&&!isNaN(e)},ur=function(e){return pl==="undefined"?void 0:e!=null&&e instanceof HTMLElement},tt=function(e){return Ln(e)||bi(e)},Ln=function(e){return An(e)==="collection"&&e._private.single},bi=function(e){return An(e)==="collection"&&!e._private.single},ia=function(e){return An(e)==="core"},xi=function(e){return An(e)==="stylesheet"},Tt=function(e){return e==null||!(e!==""&&!e.match(/^\s+$/))},fl=function(e){return function(t){return t!=null&&Ne(t)===mi}(e)&&Me(e.then)},zn=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],a=0;at?1:0},he=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;n.push(Math.floor(i))}var s=a[1]||a[2]||a[3],l=a[1]&&a[2]&&a[3];if(s&&!l)return;var u=r[4];if(u!==void 0){if((u=parseFloat(u))<0||u>1)return;n.push(u)}}return n}(e)||function(t){var n,r,a,o,i,s,l,u;function c(p,v,b){return b<0&&(b+=1),b>1&&(b-=1),b<1/6?p+6*(v-p)*b:b<.5?v:b<2/3?p+(v-p)*(2/3-b)*6:p}var d=new RegExp("^"+yl+"$").exec(t);if(d){if((r=parseInt(d[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(a=parseFloat(d[2]))<0||a>100||(a/=100,(o=parseFloat(d[3]))<0||o>100)||(o/=100,(i=d[4])!==void 0&&((i=parseFloat(i))<0||i>1)))return;if(a===0)s=l=u=Math.round(255*o);else{var h=o<.5?o*(1+a):o+a-o*a,g=2*o-h;s=Math.round(255*c(g,h,r+1/3)),l=Math.round(255*c(g,h,r)),u=Math.round(255*c(g,h,r-1/3))}n=[s,l,u,i]}return n}(e)},xl={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ci=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a=t||m<0||d&&y-u>=o}function v(){var y=sa();if(p(y))return b(y);s=setTimeout(v,function(m){var k=t-(m-l);return d?Ol(k,o-(m-u)):k}(y))}function b(y){return s=void 0,h&&r?g(y):(r=a=void 0,i)}function f(){var y=sa(),m=p(y);if(r=arguments,a=this,l=y,m){if(s===void 0)return function(k){return u=k,s=setTimeout(v,t),c?g(k):i}(l);if(d)return clearTimeout(s),s=setTimeout(v,t),g(l)}return s===void 0&&(s=setTimeout(v,t)),i}return t=Mi(t)||0,qt(n)&&(c=!!n.leading,o=(d="maxWait"in n)?Rl(Mi(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),f.cancel=function(){s!==void 0&&clearTimeout(s),u=0,r=l=a=s=void 0},f.flush=function(){return s===void 0?i:b(sa())},f},la=Ae?Ae.performance:null,Bi=la&&la.now?function(){return la.now()}:function(){return Date.now()},Vl=function(){if(Ae){if(Ae.requestAnimationFrame)return function(e){Ae.requestAnimationFrame(e)};if(Ae.mozRequestAnimationFrame)return function(e){Ae.mozRequestAnimationFrame(e)};if(Ae.webkitRequestAnimationFrame)return function(e){Ae.webkitRequestAnimationFrame(e)};if(Ae.msRequestAnimationFrame)return function(e){Ae.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Bi())},1e3/60)}}(),pr=function(e){return Vl(e)},wt=Bi,sn=9261,Vn=5381,_i=function(e){for(var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sn;!(t=e.next()).done;)n=65599*n+t.value|0;return n},Fn=function(e){return 65599*(arguments.length>1&&arguments[1]!==void 0?arguments[1]:sn)+e|0},Xn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Vn;return(t<<5)+t+e|0},Mt=function(e){return 2097152*e[0]+e[1]},fr=function(e,t){return[Fn(e[0],t[0]),Xn(e[1],t[1])]},Yt=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return _i({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},da=function(e){e.splice(0,e.length)},ct=function(e,t,n){return n&&(t=wi(n,t)),e[t]},_t=function(e,t,n,r){n&&(t=wi(n,t)),e[t]=r},yt=typeof Map<"u"?Map:function(){function e(){ra(this,e),this._obj={}}return aa(e,[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}]),e}(),jl=function(){function e(t){if(ra(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r"u"?"undefined":Ne(Set))!=="undefined"?Set:jl,vr=function(e,t){var n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(e!==void 0&&t!==void 0&&ia(e)){var r=t.group;if(r==null&&(r=t.data&&t.data.source!=null&&t.data.target!=null?"edges":"nodes"),r==="nodes"||r==="edges"){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0||!!t.grabbable,pannable:t.pannable===void 0?r==="edges":!!t.pannable,active:!1,classes:new ln,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),t.renderedPosition){var o=t.renderedPosition,i=e.pan(),s=e.zoom();a.position={x:(o.x-i.x)/s,y:(o.y-i.y)/s}}var l=[];ke(t.classes)?l=t.classes:ce(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;uy?1:0},c=function(f,y,m,k,x){var S;if(m==null&&(m=0),x==null&&(x=r),m<0)throw new Error("lo must be non-negative");for(k==null&&(k=f.length);mP;0<=P?E++:E--)D.push(E);return D}).apply(this).reverse()).length;kT;0<=T?++D:--D)B.push(i(f,m));return B},v=function(f,y,m,k){var x,S,w;for(k==null&&(k=r),x=f[m];m>y&&k(x,S=f[w=m-1>>1])<0;)f[m]=S,m=w;return f[m]=x},b=function(f,y,m){var k,x,S,w,D;for(m==null&&(m=r),x=f.length,D=y,S=f[y],k=2*y+1;k0;){var x=f.pop(),S=v(x),w=x.id();if(d[w]=S,S!==1/0)for(var D=x.neighborhood().intersect(g),E=0;E0)for(F.unshift(R);c[I];){var X=c[I];F.unshift(X.edge),F.unshift(X.node),I=(N=X.node).id()}return i.spawn(F)}}}},Gl={kruskal:function(e){e=e||function(y){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,o=new Array(a),i=n,s=function(y){for(var m=0;m0;){if(k(),S++,u===d){for(var w=[],D=a,E=d,P=y[E];w.unshift(D),P!=null&&w.unshift(P),(D=f[E])!=null;)P=y[E=D.id()];return{found:!0,distance:h[u],path:this.spawn(w),steps:S}}p[u]=!0;for(var T=l._private.edges,B=0;BP&&(g[E]=P,f[E]=D,y[E]=k),!a){var T=D*u+w;!a&&g[T]>P&&(g[T]=P,f[T]=w,y[T]=k)}}}for(var B=0;B1&&arguments[1]!==void 0?arguments[1]:o,_=[],A=y(ee);;){if(A==null)return t.spawn();var V=f(A),L=V.edge,Z=V.pred;if(_.unshift(A[0]),A.same(C)&&_.length>0)break;L!=null&&_.unshift(L),A=Z}return s.spawn(_)},hasNegativeWeightCycle:p,negativeWeightCycles:v}}},tu=Math.sqrt(2),nu=function(e,t,n){n.length===0&&Be("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],o=r[2],i=t[a],s=t[o],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===i&&t[h]===s||t[d]===s&&t[h]===i)&&l.splice(u,1)}for(var g=0;gr;){var a=Math.floor(Math.random()*t.length);t=nu(a,e,t),n--}return t},ru={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(F){return F.isLoop()});var a=n.length,o=r.length,i=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/tu);if(!(a<2)){for(var l=[],u=0;u0?1:e<0?-1:0},jt=function(e,t){return Math.sqrt(Wt(e,t))},Wt=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},au=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},qi=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},iu=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},br=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},xr=function(e){var t,n,r,a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0];if(o.length===1)t=n=r=a=o[0];else if(o.length===2)t=r=o[0],a=n=o[1];else if(o.length===4){var i=ut(o,4);t=i[0],n=i[1],r=i[2],a=i[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Yi=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},fa=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2t.y2)&&!(t.y1>e.y2)},dn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},ou=function(e,t){return dn(e,t.x,t.y)},ji=function(e,t){return dn(e,t.x1,t.y1)&&dn(e,t.x2,t.y2)},Wi=function(e,t,n,r,a,o,i){var s,l,u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",c=u==="auto"?Kt(a,o):u,d=a/2,h=o/2,g=(c=Math.min(c,d,h))!==d,p=c!==h;if(g){var v=r-h-i;if((s=Nt(e,t,n,r,n-d+c-i,v,n+d-c+i,v,!1)).length>0)return s}if(p){var b=n+d+i;if((s=Nt(e,t,n,r,b,r-h+c-i,b,r+h-c+i,!1)).length>0)return s}if(g){var f=r+h+i;if((s=Nt(e,t,n,r,n-d+c-i,f,n+d-c+i,f,!1)).length>0)return s}if(p){var y=n-d-i;if((s=Nt(e,t,n,r,y,r-h+c-i,y,r+h-c+i,!1)).length>0)return s}var m=n-d+c,k=r-h+c;if((l=Wn(e,t,n,r,m,k,c+i)).length>0&&l[0]<=m&&l[1]<=k)return[l[0],l[1]];var x=n+d-c,S=r-h+c;if((l=Wn(e,t,n,r,x,S,c+i)).length>0&&l[0]>=x&&l[1]<=S)return[l[0],l[1]];var w=n+d-c,D=r+h-c;if((l=Wn(e,t,n,r,w,D,c+i)).length>0&&l[0]>=w&&l[1]>=D)return[l[0],l[1]];var E=n-d+c,P=r+h-c;return(l=Wn(e,t,n,r,E,P,c+i)).length>0&&l[0]<=E&&l[1]>=P?[l[0],l[1]]:[]},su=function(e,t,n,r,a,o,i){var s=i,l=Math.min(n,a),u=Math.max(n,a),c=Math.min(r,o),d=Math.max(r,o);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},lu=function(e,t,n,r,a,o,i,s,l){var u=Math.min(n,i,a)-l,c=Math.max(n,i,a)+l,d=Math.min(r,s,o)-l,h=Math.max(r,s,o)+l;return!(ec||th)},uu=function(e,t,n,r,a,o,i,s){var l=[];(function(b,f,y,m,k){var x,S,w,D,E,P,T,B;b===0&&(b=1e-5),w=-27*(m/=b)+(f/=b)*(9*(y/=b)-f*f*2),x=(S=(3*y-f*f)/9)*S*S+(w/=54)*w,k[1]=0,T=f/3,x>0?(E=(E=w+Math.sqrt(x))<0?-Math.pow(-E,1/3):Math.pow(E,1/3),P=(P=w-Math.sqrt(x))<0?-Math.pow(-P,1/3):Math.pow(P,1/3),k[0]=-T+E+P,T+=(E+P)/2,k[4]=k[2]=-T,T=Math.sqrt(3)*(-P+E)/2,k[3]=T,k[5]=-T):(k[5]=k[3]=0,x===0?(B=w<0?-Math.pow(-w,1/3):Math.pow(w,1/3),k[0]=2*B-T,k[4]=k[2]=-(B+T)):(D=(S=-S)*S*S,D=Math.acos(w/Math.sqrt(D)),B=2*Math.sqrt(S),k[0]=-T+B*Math.cos(D/3),k[2]=-T+B*Math.cos((D+2*Math.PI)/3),k[4]=-T+B*Math.cos((D+4*Math.PI)/3)))})(1*n*n-4*n*a+2*n*i+4*a*a-4*a*i+i*i+r*r-4*r*o+2*r*s+4*o*o-4*o*s+s*s,9*n*a-3*n*n-3*n*i-6*a*a+3*a*i+9*r*o-3*r*r-3*r*s-6*o*o+3*o*s,3*n*n-6*n*a+n*i-n*e+2*a*a+2*a*e-i*e+3*r*r-6*r*o+r*s-r*t+2*o*o+2*o*t-s*t,1*n*a-n*n+n*e-a*e+r*o-r*r+r*t-o*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,g,p=-1,v=0;v=0?gl?(e-a)*(e-a)+(t-o)*(t-o):u-d},et=function(e,t,n){for(var r,a,o,i,s=0,l=0;l=e&&e>=o||r<=e&&e<=o))continue;(e-r)/(o-r)*(i-a)+a>t&&s++}return s%2!=0},Et=function(e,t,n,r,a,o,i,s,l){var u,c=new Array(n.length);s[0]!=null?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),g=Math.sin(-u),p=0;p0){var v=Er(c,-l);d=wr(v)}else d=c;return et(e,t,d)},wr=function(e){for(var t,n,r,a,o,i,s,l,u=new Array(e.length/2),c=0;c=0&&p<=1&&b.push(p),v>=0&&v<=1&&b.push(v),b.length===0)return[];var f=b[0]*s[0]+e,y=b[0]*s[1]+t;return b.length>1?b[0]==b[1]?[f,y]:[f,y,b[1]*s[0]+e,b[1]*s[1]+t]:[f,y]},ga=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Nt=function(e,t,n,r,a,o,i,s,l){var u=e-a,c=n-e,d=i-a,h=t-o,g=r-t,p=s-o,v=d*h-p*u,b=c*h-g*u,f=p*c-d*g;if(f!==0){var y=v/f,m=b/f,k=-.001;return k<=y&&y<=1.001&&k<=m&&m<=1.001||l?[e+y*c,t+y*g]:[]}return v===0||b===0?ga(e,n,i)===i?[i,s]:ga(e,n,a)===a?[a,o]:ga(a,i,n)===n?[n,r]:[]:[]},Hn=function(e,t,n,r,a,o,i,s){var l,u,c,d,h,g,p=[],v=new Array(n.length),b=!0;if(o==null&&(b=!1),b){for(var f=0;f0){var y=Er(v,-s);u=wr(y)}else u=v}else u=n;for(var m=0;mu&&(u=m)},d=function(y){return l[y]},h=0;h0?z.edgesTo(M)[0]:M.edgesTo(z)[0];var F=r(R);M=M.id(),w[M]>w[T]+F&&(w[M]=w[T]+F,D.nodes.indexOf(M)<0?D.push(M):D.updateItem(M),S[M]=0,x[M]=[]),w[M]==w[T]+F&&(S[M]=S[M]+S[T],x[M].push(T))}else for(var N=0;N0;){for(var Y=k.pop(),j=0;j0&&P.push(S[T]);P.length!==0&&D.push(w.collection(P))}return D}(c,l,t,r);return m=function(k){for(var x=0;x5&&arguments[5]!==void 0?arguments[5]:Eu,i=r,s=0;s=2?Kn(e,t,n,0,eo,ku):Kn(e,t,n,0,Ji)},squaredEuclidean:function(e,t,n){return Kn(e,t,n,0,eo)},manhattan:function(e,t,n){return Kn(e,t,n,0,Ji)},max:function(e,t,n){return Kn(e,t,n,-1/0,Cu)}};function Cr(e,t,n,r,a,o){var i;return i=Me(e)?e:fn[e]||fn.euclidean,t===0&&Me(e)?i(a,o):i(t,n,r,a,o)}fn["squared-euclidean"]=fn.squaredEuclidean,fn.squaredeuclidean=fn.squaredEuclidean;var Su=Re({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ba=function(e){return Su(e)},Sr=function(e,t,n,r,a){var o=a!=="kMedoids"?function(l){return n[l]}:function(l){return r[l](n)},i=n,s=t;return Cr(e,r.length,o,function(l){return r[l](t)},i,s)},xa=function(e,t,n){for(var r=n.length,a=new Array(r),o=new Array(r),i=new Array(t),s=null,l=0;ln)return!1;return!0},Tu=function(e,t,n){for(var r=0;rw&&(w=k[T][B],D=B);E[D].push(m[T])}for(var M=0;M=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var g,p=t[i],v=t[r[i]];g=a.mode==="dendrogram"?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=g,e.splice(v.index,1),t[p.key]=g;for(var b=0;bn[v.key][f.key]&&(o=n[v.key][f.key])):a.linkage==="max"?(o=n[p.key][f.key],n[p.key][f.key]1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],s=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5];arguments.length>3&&arguments[3]!==void 0&&!arguments[3]?(o0&&r.splice(0,a)):r=r.slice(a,o);for(var l=0,u=r.length-1;u>=0;u--){var c=r[u];s?isFinite(c)||(r[u]=-1/0,l++):r.splice(u,1)}i&&r.sort(function(g,p){return g-p});var d=r.length,h=Math.floor(d/2);return d%2!=0?r[h+1+l]:(r[h-1+l]+r[h+l])/2}(e):t==="mean"?function(r){for(var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=0,s=0,l=a;l1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=1/0,s=a;s1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.length,i=-1/0,s=a;si&&(o=l,i=t[a*e+l])}o>0&&r.push(o)}for(var u=0;u=P?(T=P,P=M,B=z):M>T&&(T=M);for(var R=0;R0?1:0;w[S%u.minIterations*t+Y]=j,O+=j}if(O>0&&(S>=u.minIterations-1||S==u.maxIterations-1)){for(var G=0,W=0;W0&&A.push(V);return A}(t,o,i),U=function(ee,C,_){for(var A=lo(ee,C,_),V=0;V<_.length;V++){for(var L=[],Z=0;Zne&&(H=$,ne=J)}_[V]=L[H]}return lo(ee,C,_)}(t,r,K),re={},ae=0;ae1||x>1)&&(u=!0),c[y]=[],f.outgoers().forEach(function(w){w.isEdge()&&c[y].push(w.id())})}else d[y]=[void 0,f.target().id()]}):l.forEach(function(f){var y=f.id();f.isNode()?(f.degree(!0)%2&&(n?r?u=!0:r=y:n=y),c[y]=[],f.connectedEdges().forEach(function(m){return c[y].push(m.id())})):d[y]=[f.source().id(),f.target().id()]});var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var g=function(f){for(var y,m,k,x=f,S=[f];c[x].length;)y=c[x].shift(),m=d[y][0],x!=(k=d[y][1])?(c[k]=c[k].filter(function(w){return w!=y}),x=k):s||x==m||(c[m]=c[m].filter(function(w){return w!=y}),x=m),S.unshift(y),S.unshift(x);return S},p=[],v=[];for(v=g(a);v.length!=1;)c[v[0]].length==0?(p.unshift(l.getElementById(v.shift())),p.unshift(l.getElementById(v.shift()))):v=g(v.shift()).concat(v);for(var b in p.unshift(l.getElementById(v.shift())),c)if(c[b].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Dr=function(){var e=this,t={},n=0,r=0,a=[],o=[],i={},s=function u(c,d,h){c===h&&(r+=1),t[d]={id:n,low:n++,cutVertex:!1};var g,p,v,b,f=e.getElementById(d).connectedEdges().intersection(e);f.size()===0?a.push(e.spawn(e.getElementById(d))):f.forEach(function(y){g=y.source().id(),p=y.target().id(),(v=g===d?p:g)!==h&&(b=y.id(),i[b]||(i[b]=!0,o.push({x:d,y:v,edge:y})),v in t?t[d].low=Math.min(t[d].low,t[v].id):(u(c,v,d),t[d].low=Math.min(t[d].low,t[v].low),t[d].id<=t[v].low&&(t[d].cutVertex=!0,function(m,k){for(var x=o.length-1,S=[],w=e.spawn();o[x].x!=m||o[x].y!=k;)S.push(o.pop().edge),x--;S.push(o.pop().edge),S.forEach(function(D){var E=D.connectedNodes().intersection(e);w.merge(D),E.forEach(function(P){var T=P.id(),B=P.connectedEdges().intersection(e);w.merge(P),t[T].cutVertex?w.merge(B.filter(function(M){return M.isLoop()})):w.merge(B)})}),a.push(w)}(d,v))))})};e.forEach(function(u){if(u.isNode()){var c=u.id();c in t||(r=0,s(c,c),t[c].cutVertex=r>1)}});var l=Object.keys(t).filter(function(u){return t[u].cutVertex}).map(function(u){return e.getElementById(u)});return{cut:e.spawn(l),components:a}},Tr=function(){var e=this,t={},n=0,r=[],a=[],o=e.spawn(e),i=function s(l){if(a.push(l),t[l]={index:n,low:n++,explored:!1},e.getElementById(l).connectedEdges().intersection(e).forEach(function(g){var p=g.target().id();p!==l&&(p in t||s(p),t[p].explored||(t[l].low=Math.min(t[l].low,t[p].low)))}),t[l].index===t[l].low){for(var u=e.spawn();;){var c=a.pop();if(u.merge(e.getElementById(c)),t[c].low=t[l].index,t[c].explored=!0,c===l)break}var d=u.edgesWith(u),h=u.merge(d);r.push(h),o=o.difference(h)}};return e.forEach(function(s){if(s.isNode()){var l=s.id();l in t||i(l)}}),{cut:o,components:r}},co={};[qn,Kl,Gl,Zl,Ql,eu,ru,hu,hn,pn,ma,wu,_u,Iu,Fu,qu,{hopcroftTarjanBiconnected:Dr,htbc:Dr,htb:Dr,hopcroftTarjanBiconnectedComponents:Dr},{tarjanStronglyConnected:Tr,tsc:Tr,tscc:Tr,tarjanStronglyConnectedComponents:Tr}].forEach(function(e){he(co,e)});/*! +Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable +Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) +Licensed under The MIT License (http://opensource.org/licenses/MIT) +*/var kt=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};kt.prototype={fulfill:function(e){return ho(this,1,"fulfillValue",e)},reject:function(e){return ho(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new kt;return n.onFulfilled.push(go(e,r,"fulfill")),n.onRejected.push(go(t,r,"reject")),po(n),r.proxy}};var ho=function(e,t,n,r){return e.state===0&&(e.state=t,e[n]=r,po(e)),e},po=function(e){e.state===1?fo(e,"onFulfilled",e.fulfillValue):e.state===2&&fo(e,"onRejected",e.rejectReason)},fo=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var a=function(){for(var o=0;o0:void 0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1},mc=function(e,t){var n=this.__data__,r=Br(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function yn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){ke(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,a=[],o=0,i=n.length;o0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Nr.className=Nr.classNames=Nr.classes;var ye={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Le,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ye.variable="(?:[\\w-.]|(?:\\\\"+ye.metaChar+"))+",ye.className="(?:[\\w-]|(?:\\\\"+ye.metaChar+"))+",ye.value=ye.string+"|"+ye.number,ye.id=ye.variable,function(){var e,t,n;for(e=ye.comparatorOp.split("|"),n=0;n=0||t!=="="&&(ye.comparatorOp+="|\\!"+t)}();var Pa=0,To=1,Mo=2,Da=3,Ta=4,Ma=5,Ba=6,_a=7,Ar=8,Na=9,Aa=10,La=11,Bo=12,_o=13,za=14,Ia=15,Ra=16,Lr=17,zr=18,Ir=19,bn=20,Oa=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return function(n,r){return-1*ki(n,r)}(e.selector,t.selector)}),Kc=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return we("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return we("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;u.edgeCount===1&&we("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l??""},t=function(l){return ce(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,u){var c=l.type,d=l.value;switch(c){case Pa:var h=e(d);return h.substring(0,h.length-1);case Da:var g=l.field,p=l.operator;return"["+g+n(e(p))+t(d)+"]";case Ma:var v=l.operator,b=l.field;return"["+e(v)+b+"]";case Ta:return"["+l.field+"]";case Ba:var f=l.operator;return"[["+l.field+n(e(f))+t(d)+"]]";case _a:return d;case Ar:return"#"+d;case Na:return"."+d;case Lr:case Ia:return a(l.parent,u)+n(">")+a(l.child,u);case zr:case Ra:return a(l.ancestor,u)+" "+a(l.descendant,u);case Ir:var y=a(l.left,u),m=a(l.subject,u),k=a(l.right,u);return y+(y.length>0?" ":"")+m+k;case bn:return""}},a=function(l,u){return l.checks.reduce(function(c,d,h){return c+(u===l&&h===0?"$":"")+r(d,u)},"")},o="",i=0;i1&&i=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(i||l||u)&&(a=i||s?""+e:"",o=""+n),u&&(e=a=a.toLowerCase(),n=o=o.toLowerCase()),t){case"*=":r=a.indexOf(o)>=0;break;case"$=":r=a.indexOf(o,a.length-o.length)>=0;break;case"^=":r=a.indexOf(o)===0;break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=a.shift();t(u),o.add(u.id()),i&&r(a,o,u)}return e}function Lo(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&arguments[1]!==void 0)||arguments[1],Lo)},wn.forEachUp=function(e){return Xa(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],zo)},wn.forEachUpAndDown=function(e){return Xa(this,e,!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],Qc)},wn.ancestors=wn.parents,(Rr=Ao={data:Ee.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ee.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ee.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ee.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ee.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ee.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Rr.data,Rr.removeAttr=Rr.removeData;var dt,Io,Jc=Ao,Or={};function qa(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],o=a._private.edges,i=0;it}),minIndegree:En("indegree",function(e,t){return et}),minOutdegree:En("outdegree",function(e,t){return et})}),he(Or,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},e===void 0?a:a[e]}for(var h=0;h0,b=v;v&&(p=p[0]);var f=b?p.position():{x:0,y:0};t!==void 0?g.position(e,t+f[e]):a!==void 0&&g.position({x:a.x+f.x,y:a.y+f.y})}}else if(!o)return;return this}},dt.modelPosition=dt.point=dt.position,dt.modelPositions=dt.points=dt.positions,dt.renderedPoint=dt.renderedPosition,dt.relativePoint=dt.relativePosition;var kn,Rt,ed=Io;kn=Rt={},Rt.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),o=t.x1*r+a.x,i=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:o,x2:i,y1:s,y2:l,w:i-o,h:l-s}},Rt.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this):this},Rt.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(i){if(i.isParent()){var s=i._private,l=i.children(),u=i.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:i.pstyle("min-width").pfValue,left:i.pstyle("min-width-bias-left"),right:i.pstyle("min-width-bias-right")},height:{val:i.pstyle("min-height").pfValue,top:i.pstyle("min-height-bias-top"),bottom:i.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),h=s.position;d.w!==0&&d.h!==0||((d={w:i.pstyle("width").pfValue,h:i.pstyle("height").pfValue}).x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);var g=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(g=100*g/c.width.val);var p=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(p=100*p/c.width.val);var v=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(v=100*v/c.height.val);var b=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(b=100*b/c.height.val);var f=w(c.width.val-d.w,g,p),y=f.biasDiff,m=f.biasComplementDiff,k=w(c.height.val-d.h,v,b),x=k.biasDiff,S=k.biasComplementDiff;s.autoPadding=function(D,E,P,T){if(P.units!=="%")return P.units==="px"?P.pfValue:0;switch(T){case"width":return D>0?P.pfValue*D:0;case"height":return E>0?P.pfValue*E:0;case"average":return D>0&&E>0?P.pfValue*(D+E)/2:0;case"min":return D>0&&E>0?D>E?P.pfValue*E:P.pfValue*D:0;case"max":return D>0&&E>0?D>E?P.pfValue*D:P.pfValue*E:0;default:return 0}}(d.w,d.h,i.pstyle("padding"),i.pstyle("padding-relative-to").value),s.autoWidth=Math.max(d.w,c.width.val),h.x=(-y+d.x1+d.x2+m)/2,s.autoHeight=Math.max(d.h,c.height.val),h.y=(-x+d.y1+d.y2+S)/2}function w(D,E,P){var T=0,B=0,M=E+P;return D>0&&M>0&&(T=E/M*D,B=P/M*D),{biasDiff:T,biasComplementDiff:B}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ut=function(e,t){return t==null?e:ht(e,t.x1,t.y1,t.x2,t.y2)},Un=function(e,t,n){return ct(e,t,n)},Vr=function(e,t,n){if(!t.cy().headless()){var r,a,o=t._private,i=o.rstyle,s=i.arrowWidth/2;if(t.pstyle(n+"-arrow-shape").value!=="none"){n==="source"?(r=i.srcX,a=i.srcY):n==="target"?(r=i.tgtX,a=i.tgtY):(r=i.midX,a=i.midY);var l=o.arrowBounds=o.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,br(u,1),ht(e,u.x1,u.y1,u.x2,u.y2)}}},Ya=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,o=a.rstyle;if(t.pstyle(r+"label").strValue){var i,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Un(o,"labelWidth",n),g=Un(o,"labelHeight",n),p=Un(o,"labelX",n),v=Un(o,"labelY",n),b=t.pstyle(r+"text-margin-x").pfValue,f=t.pstyle(r+"text-margin-y").pfValue,y=t.isEdge(),m=t.pstyle(r+"text-rotation"),k=t.pstyle("text-outline-width").pfValue,x=t.pstyle("text-border-width").pfValue/2,S=t.pstyle("text-background-padding").pfValue,w=g,D=h,E=D/2,P=w/2;if(y)i=p-E,s=p+E,l=v-P,u=v+P;else{switch(c.value){case"left":i=p-D,s=p;break;case"center":i=p-E,s=p+E;break;case"right":i=p,s=p+D}switch(d.value){case"top":l=v-w,u=v;break;case"center":l=v-P,u=v+P;break;case"bottom":l=v,u=v+w}}i+=b-Math.max(k,x)-S-2,s+=b+Math.max(k,x)+S+2,l+=f-Math.max(k,x)-S-2,u+=f+Math.max(k,x)+S+2;var T=n||"main",B=a.labelBounds,M=B[T]=B[T]||{};M.x1=i,M.y1=l,M.x2=s,M.y2=u,M.w=s-i,M.h=u-l;var z=y&&m.strValue==="autorotate",R=m.pfValue!=null&&m.pfValue!==0;if(z||R){var F=z?Un(a.rstyle,"labelAngle",n):m.pfValue,N=Math.cos(F),I=Math.sin(F),X=(i+s)/2,O=(l+u)/2;if(!y){switch(c.value){case"left":X=s;break;case"right":X=i}switch(d.value){case"top":O=u;break;case"bottom":O=l}}var Y=function(re,ae){return{x:(re-=X)*N-(ae-=O)*I+X,y:re*I+ae*N+O}},j=Y(i,l),G=Y(i,u),W=Y(s,l),q=Y(s,u);i=Math.min(j.x,G.x,W.x,q.x),s=Math.max(j.x,G.x,W.x,q.x),l=Math.min(j.y,G.y,W.y,q.y),u=Math.max(j.y,G.y,W.y,q.y)}var K=T+"Rot",U=B[K]=B[K]||{};U.x1=i,U.y1=l,U.x2=s,U.y2=u,U.w=s-i,U.h=u-l,ht(e,i,l,s,u),ht(a.labelBounds.all,i,l,s,u)}return e}},td=function(e,t){var n,r,a,o,i,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=Je(),g=e._private,p=e.isNode(),v=e.isEdge(),b=g.rstyle,f=p&&c?e.pstyle("bounds-expansion").pfValue:[0],y=function(U){return U.pstyle("display").value!=="none"},m=!c||y(e)&&(!v||y(e.source())&&y(e.target()));if(m){var k=0;c&&t.includeOverlays&&e.pstyle("overlay-opacity").value!==0&&(k=e.pstyle("overlay-padding").value);var x=0;c&&t.includeUnderlays&&e.pstyle("underlay-opacity").value!==0&&(x=e.pstyle("underlay-padding").value);var S=Math.max(k,x),w=0;if(c&&(w=e.pstyle("width").pfValue/2),p&&t.includeNodes){var D=e.position();i=D.x,s=D.y;var E=e.outerWidth()/2,P=e.outerHeight()/2;ht(h,n=i-E,a=s-P,r=i+E,o=s+P),c&&t.includeOutlines&&function(U,re){if(!re.cy().headless()){var ae,de,ue,Q=re.pstyle("outline-opacity").value,le=re.pstyle("outline-width").value;if(Q>0&&le>0){var ee=re.pstyle("outline-offset").value,C=re.pstyle("shape").value,_=le+ee,A=(U.w+2*_)/U.w,V=(U.h+2*_)/U.h,L=0;["diamond","pentagon","round-triangle"].includes(C)?(A=(U.w+2.4*_)/U.w,L=-_/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(C)?A=(U.w+2.4*_)/U.w:C==="star"?(A=(U.w+2.8*_)/U.w,V=(U.h+2.6*_)/U.h,L=-_/3.8):C==="triangle"?(A=(U.w+2.8*_)/U.w,V=(U.h+2.4*_)/U.h,L=-_/1.4):C==="vee"&&(A=(U.w+4.4*_)/U.w,V=(U.h+3.8*_)/U.h,L=.5*-_);var Z=U.h*V-U.h,H=U.w*A-U.w;if(xr(U,[Math.ceil(Z/2),Math.ceil(H/2)]),L!==0){var ne=(de=0,ue=L,{x1:(ae=U).x1+de,x2:ae.x2+de,y1:ae.y1+ue,y2:ae.y2+ue,w:ae.w,h:ae.h});qi(U,ne)}}}}(h,e)}else if(v&&t.includeEdges)if(c&&!d){var T=e.pstyle("curve-style").strValue;if(n=Math.min(b.srcX,b.midX,b.tgtX),r=Math.max(b.srcX,b.midX,b.tgtX),a=Math.min(b.srcY,b.midY,b.tgtY),o=Math.max(b.srcY,b.midY,b.tgtY),ht(h,n-=w,a-=w,r+=w,o+=w),T==="haystack"){var B=b.haystackPts;if(B&&B.length===2){if(n=B[0].x,a=B[0].y,n>(r=B[1].x)){var M=n;n=r,r=M}if(a>(o=B[1].y)){var z=a;a=o,o=z}ht(h,n-w,a-w,r+w,o+w)}}else if(T==="bezier"||T==="unbundled-bezier"||T.endsWith("segments")||T.endsWith("taxi")){var R;switch(T){case"bezier":case"unbundled-bezier":R=b.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":R=b.linePts}if(R!=null)for(var F=0;F(r=X.x)){var O=n;n=r,r=O}if((a=I.y)>(o=X.y)){var Y=a;a=o,o=Y}ht(h,n-=w,a-=w,r+=w,o+=w)}if(c&&t.includeEdges&&v&&(Vr(h,e,"mid-source"),Vr(h,e,"mid-target"),Vr(h,e,"source"),Vr(h,e,"target")),c&&e.pstyle("ghost").value==="yes"){var j=e.pstyle("ghost-offset-x").pfValue,G=e.pstyle("ghost-offset-y").pfValue;ht(h,h.x1+j,h.y1+G,h.x2+j,h.y2+G)}var W=g.bodyBounds=g.bodyBounds||{};Yi(W,h),xr(W,f),br(W,1),c&&(n=h.x1,r=h.x2,a=h.y1,o=h.y2,ht(h,n-S,a-S,r+S,o+S));var q=g.overlayBounds=g.overlayBounds||{};Yi(q,h),xr(q,f),br(q,1);var K=g.labelBounds=g.labelBounds||{};K.all!=null?((l=K.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):K.all=Je(),c&&t.includeLabels&&(t.includeMainLabels&&Ya(h,e,null),v&&(t.includeSourceLabels&&Ya(h,e,"source"),t.includeTargetLabels&&Ya(h,e,"target")))}return h.x1=at(h.x1),h.y1=at(h.y1),h.x2=at(h.x2),h.y2=at(h.y2),h.w=at(h.x2-h.x1),h.h=at(h.y2-h.y1),h.w>0&&h.h>0&&m&&(xr(h,f),br(h,1)),h},Vo=function(e){var t=0,n=function(a){return(a?1:0)<0&&arguments[0]!==void 0?arguments[0]:od,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)i(s);return this},Ot.removeAllListeners=function(){return this.removeListener("*")},Ot.emit=Ot.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,ke(t)||(t=[t]),sd(this,function(o,i){n!=null&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var s=function(u){var c=r[u];if(c.type===i.type&&(!c.namespace||c.namespace===i.namespace||c.namespace===".*")&&o.eventMatches(o.context,c,i)){var d=[i];t!=null&&function(p,v){for(var b=0;b1&&!r){var a=this.length-1,o=this[a],i=o._private.data.id;this[a]=void 0,this[e]=o,n.set(i,{ele:o,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ce(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;ar&&(r=s,n=i)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,o=0;o=0&&a"u"?"undefined":Ne(Symbol))!=ja&&Ne(Symbol.iterator)!=ja&&(Yr[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return pi({next:function(){return n1&&arguments[1]!==void 0)||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(ve(e)){var o=e;a.applyBypass(this,o,r),this.emitAndNotify("style")}else if(ce(e)){if(t===void 0){var i=this[0];return i?a.getStylePropertyValue(i,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(e===void 0){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var o=0;o0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),qe.neighbourhood=qe.neighborhood,qe.closedNeighbourhood=qe.closedNeighborhood,qe.openNeighbourhood=qe.openNeighborhood,he(qe,{source:rt(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:rt(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:os({attr:"source"}),targets:os({attr:"target"})}),he(qe,{edgesWith:rt(ss(),"edgesWith"),edgesTo:rt(ss({thisIsSrc:!0}),"edgesTo")}),he(qe,{connectedEdges:rt(function(e){for(var t=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),qe.componentsOf=qe.components;var Ve=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(e!==void 0){var a=new yt,o=!1;if(t){if(t.length>0&&ve(t[0])&&!Ln(t[0])){o=!0;for(var i=[],s=new ln,l=0,u=t.length;l0&&arguments[0]!==void 0)||arguments[0],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],a=this,o=a.cy(),i=o._private,s=[],l=[],u=0,c=a.length;u0){for(var I=e.length===a.length?a:new Ve(o,e),X=0;X0&&arguments[0]!==void 0)||arguments[0],t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this,r=[],a={},o=n._private.cy;function i(P){var T=a[P.id()];t&&P.removed()||T||(a[P.id()]=!0,P.isNode()?(r.push(P),function(B){for(var M=B._private.edges,z=0;z0&&(e?w.emitAndNotify("remove"):t&&w.emit("remove"));for(var D=0;D=.001?function(w,D){for(var E=0;E<4;++E){var P=h(D,e,n);if(P===0)return D;D-=(d(D,e,n)-w)/P}return D}(y,x):S===0?x:function(w,D,E){var P,T,B=0;do(P=d(T=D+(E-D)/2,e,n)-w)>0?E=T:D=T;while(Math.abs(P)>1e-7&&++B<10);return T}(y,m,m+a)}var p=!1;function v(){p=!0,e===t&&n===r||function(){for(var y=0;y<11;++y)s[y]=d(y*a,e,n)}()}var b=function(y){return p||v(),e===t&&n===r?y:y===0?0:y===1?1:d(g(y),t,r)};b.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var f="generateBezier("+[e,t,n,r]+")";return b.toString=function(){return f},b}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var vd=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,o){var i={x:r.x+o.dx*a,v:r.v+o.dv*a,tension:r.tension,friction:r.friction};return{dx:i.v,dv:e(i)}}function n(r,a){var o={dx:r.v,dv:e(r)},i=t(r,.5*a,o),s=t(r,.5*a,i),l=t(r,a,s),u=1/6*(o.dx+2*(i.dx+s.dx)+l.dx),c=1/6*(o.dv+2*(i.dv+s.dv)+l.dv);return r.x=r.x+u*a,r.v=r.v+c*a,r}return function r(a,o,i){var s,l,u,c={x:-1,v:0,tension:null,friction:null},d=[0],h=0,g=1e-4;for(a=parseFloat(a)||500,o=parseFloat(o)||20,i=i||null,c.tension=a,c.friction=o,l=(s=i!==null)?(h=r(a,o))/i*.016:.016;u=n(u||c,l),d.push(1+u.x),h+=16,Math.abs(u.x)>g&&Math.abs(u.v)>g;);return s?function(p){return d[p*(d.length-1)|0]}:h}}(),Se=function(e,t,n,r){var a=gd(e,t,n,r);return function(o,i,s){return o+(i-o)*a(s)}},Kr={linear:function(e,t,n){return e+(t-e)*n},ease:Se(.25,.1,.25,1),"ease-in":Se(.42,0,1,1),"ease-out":Se(0,0,.58,1),"ease-in-out":Se(.42,0,.58,1),"ease-in-sine":Se(.47,0,.745,.715),"ease-out-sine":Se(.39,.575,.565,1),"ease-in-out-sine":Se(.445,.05,.55,.95),"ease-in-quad":Se(.55,.085,.68,.53),"ease-out-quad":Se(.25,.46,.45,.94),"ease-in-out-quad":Se(.455,.03,.515,.955),"ease-in-cubic":Se(.55,.055,.675,.19),"ease-out-cubic":Se(.215,.61,.355,1),"ease-in-out-cubic":Se(.645,.045,.355,1),"ease-in-quart":Se(.895,.03,.685,.22),"ease-out-quart":Se(.165,.84,.44,1),"ease-in-out-quart":Se(.77,0,.175,1),"ease-in-quint":Se(.755,.05,.855,.06),"ease-out-quint":Se(.23,1,.32,1),"ease-in-out-quint":Se(.86,0,.07,1),"ease-in-expo":Se(.95,.05,.795,.035),"ease-out-expo":Se(.19,1,.22,1),"ease-in-out-expo":Se(1,0,0,1),"ease-in-circ":Se(.6,.04,.98,.335),"ease-out-circ":Se(.075,.82,.165,1),"ease-in-out-circ":Se(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Kr.linear;var r=vd(e,t,n);return function(a,o,i){return a+(o-a)*r(i)}},"cubic-bezier":Se};function us(e,t,n,r,a){if(r===1||t===n)return n;var o=a(t,n,r);return e==null||((e.roundValue||e.color)&&(o=Math.round(o)),e.min!==void 0&&(o=Math.max(o,e.min)),e.max!==void 0&&(o=Math.min(o,e.max))),o}function cs(e,t){return e.pfValue!=null||e.value!=null?e.pfValue==null||t!=null&&t.type.units==="%"?e.value:e.pfValue:e}function Pn(e,t,n,r,a){var o=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var i=cs(e,a),s=cs(t,a);if(te(i)&&te(s))return us(o,i,s,n,r);if(ke(i)&&ke(s)){for(var l=[],u=0;u0?(d==="spring"&&h.push(i.duration),i.easingImpl=Kr[d].apply(null,h)):i.easingImpl=Kr[d]}var g,p=i.easingImpl;if(g=i.duration===0?1:(n-l)/i.duration,i.applying&&(g=i.progress),g<0?g=0:g>1&&(g=1),i.delay==null){var v=i.startPosition,b=i.position;if(b&&a&&!e.locked()){var f={};er(v.x,b.x)&&(f.x=Pn(v.x,b.x,g,p)),er(v.y,b.y)&&(f.y=Pn(v.y,b.y,g,p)),e.position(f)}var y=i.startPan,m=i.pan,k=o.pan,x=m!=null&&r;x&&(er(y.x,m.x)&&(k.x=Pn(y.x,m.x,g,p)),er(y.y,m.y)&&(k.y=Pn(y.y,m.y,g,p)),e.emit("pan"));var S=i.startZoom,w=i.zoom,D=w!=null&&r;D&&(er(S,w)&&(o.zoom=jn(o.minZoom,Pn(S,w,g,p),o.maxZoom)),e.emit("zoom")),(x||D)&&e.emit("viewport");var E=i.style;if(E&&E.length>0&&a){for(var P=0;P=0;x--)(0,k[x])();k.splice(0,k.length)},f=h.length-1;f>=0;f--){var y=h[f],m=y._private;m.stopped?(h.splice(f,1),m.hooked=!1,m.playing=!1,m.started=!1,b(m.frames)):(m.playing||m.applying)&&(m.playing&&m.applying&&(m.applying=!1),m.started||md(0,y,e),yd(u,y,e,c),m.applying&&(m.applying=!1),b(m.frames),m.step!=null&&m.step(e),y.completed()&&(h.splice(f,1),m.hooked=!1,m.playing=!1,m.started=!1,b(m.completes)),p=!0)}return c||h.length!==0||g.length!==0||r.push(u),p}for(var o=!1,i=0;i0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var bd={animate:Ee.animate(),animation:Ee.animation(),animated:Ee.animated(),clearQueue:Ee.clearQueue(),delay:Ee.delay(),delayAnimation:Ee.delayAnimation(),stop:Ee.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(n,r){ds(r,e)},t.beforeRenderPriorities.animations):function n(){e._private.animationsRunning&&pr(function(r){ds(r,e),n()})}()}}},xd={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null||e!==n.target&&Ln(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},Gr=function(e){return ce(e)?new Lt(e):e},hs={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Xr(xd,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Gr(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Gr(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Gr(t),n),this},once:function(e,t,n){return this.emitter().one(e,Gr(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Ee.eventAliasesOn(hs);var Ka={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Ka.jpeg=Ka.jpg;var Ur={layout:function(e){var t=this;if(e!=null)if(e.name!=null){var n=e.name,r=t.extension("layout",n);if(r!=null){var a;a=ce(e.eles)?t.$(e.eles):e.eles!=null?e.eles:t.$();var o=new r(he({},e,{cy:t,eles:a}));return o}Be("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Be("A `name` must be specified to make a layout");else Be("Layout options must be specified to make a layout")}};Ur.createLayout=Ur.makeLayout=Ur.layout;var wd={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ga.invalidateDimensions=Ga.resize;var Zr={collection:function(e,t){return ce(e)?this.$(e):tt(e)?e.collection():ke(e)?(t||(t={}),new Ve(this,e,t.unique,t.removed)):new Ve(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Zr.elements=Zr.filter=Zr.$;var Ye={},tr="t";Ye.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&g){var p=void 0;h&&g||h?p=u.properties:g&&(p=u.mappedProperties);for(var v=0;v1&&(b=1),s.color){var x=a.valueMin[0],S=a.valueMax[0],w=a.valueMin[1],D=a.valueMax[1],E=a.valueMin[2],P=a.valueMax[2],T=a.valueMin[3]==null?1:a.valueMin[3],B=a.valueMax[3]==null?1:a.valueMax[3],M=[Math.round(x+(S-x)*b),Math.round(w+(D-w)*b),Math.round(E+(P-E)*b),Math.round(T+(B-T)*b)];n={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var z=a.valueMin+(a.valueMax-a.valueMin)*b;n=this.parse(a.name,z,a.bypass,h)}if(!n)return v(),!1;n.mapping=a,a=n;break;case i.data:for(var R=a.field.split("."),F=d.data,N=0;N0&&o>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(i).play().promise().then(y):y()}).then(function(){return e.animation({style:s,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Ye.checkTrigger=function(e,t,n,r,a,o){var i=this.properties[t],s=a(i);s!=null&&s(n,r)&&o(i)},Ye.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(o){return o.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},Ye.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!a.triggersBoundsOfParallelBeziers||t!=="curve-style"||n!=="bezier"&&r!=="bezier"||e.parallelEdges().forEach(function(o){o.isBundledBezier()&&o.dirtyBoundingBoxCache()}),!a.triggersBoundsOfConnectedEdges||t!=="display"||n!=="none"&&r!=="none"||e.connectedEdges().forEach(function(o){o.dirtyBoundingBoxCache()})})},Ye.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var kd={applyBypass:function(e,t,n,r){var a=[];if(t==="*"||t==="**"){if(n!==void 0)for(var o=0;ot.length?o.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");!o.match(/^\s*$/);){var l=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){we("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=l[0];var u=l[1];if(u!=="core"&&new Lt(u).invalid){we("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),i();continue}var c=l[2],d=!1;n=c;for(var h=[];!n.match(/^\s*$/);){var g=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){we("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=g[0];var p=g[1],v=g[2];this.properties[p]?a.parse(p,v)?(h.push({name:p,val:v}),s()):(we("Skipping property: Invalid property definition in: "+r),s()):(we("Skipping property: Invalid property name in: "+r),s())}if(d){i();break}a.selector(u);for(var b=0;b=7&&t[0]==="d"&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&t[0]==="m"&&(c=new RegExp(s.mapData.regex).exec(t))){if(n||d.multiple)return!1;var g=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return we("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var b=p.value,f=v.value;if(!(b[0]!==f[0]||b[1]!==f[1]||b[2]!==f[2]||b[3]!==f[3]&&(b[3]!=null&&b[3]!==1||f[3]!=null&&f[3]!==1)))return!1}return{name:e,value:c,strValue:""+t,mapped:g,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&r!=="multiple"){var y;if(y=l?t.split(/\s+/):ke(t)?t:[t],d.evenMultiple&&y.length%2!=0)return null;for(var m=[],k=[],x=[],S="",w=!1,D=0;D0?" ":"")+E.strValue}return d.validate&&!d.validate(m,k)?null:d.singleEnum&&w?m.length===1&&ce(m[0])?{name:e,value:m[0],strValue:m[0],bypass:n}:null:{name:e,value:m,pfValue:x,strValue:S,bypass:n,units:k}}var P,T,B=function(){for(var re=0;red.max||d.strictMax&&t===d.max))return null;var N={name:e,value:t,strValue:""+t+(M||""),units:M,bypass:n};return d.unitless||M!=="px"&&M!=="em"?N.pfValue=t:N.pfValue=M!=="px"&&M?this.getEmSizeInPixels()*t:t,M!=="ms"&&M!=="s"||(N.pfValue=M==="ms"?t:1e3*t),M!=="deg"&&M!=="rad"||(N.pfValue=M==="rad"?t:(P=t,Math.PI*P/180)),M==="%"&&(N.pfValue=t/100),N}if(d.propList){var I=[],X=""+t;if(X!=="none"){for(var O=X.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:i=(i=(i=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:i)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,o=r.zoom,i=!1;if(r.zoomingEnabled||(i=!0),te(e)?n=e:ve(e)&&(n=e.level,e.position!=null?t=yr(e.position,o,a):e.renderedPosition!=null&&(t=e.renderedPosition),t==null||r.panningEnabled||(i=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;te(l.x)&&(t.pan.x=l.x,i=!1),te(l.y)&&(t.pan.y=l.y,i=!1),i||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ce(e)){var n=e;e=this.mutableElements().filter(n)}else tt(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),o=this.height();return{x:(a-(t=t===void 0?this._private.zoom:t)*(r.x1+r.x2))/2,y:(o-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,a=this;return n.sizeCache=n.sizeCache||(r?(e=a.window().getComputedStyle(r),t=function(o){return parseFloat(e.getPropertyValue(o))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Zt.centre=Zt.center,Zt.autolockNodes=Zt.autolock,Zt.autoungrabifyNodes=Zt.autoungrabify;var nr={data:Ee.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ee.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ee.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ee.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};nr.attr=nr.data,nr.removeAttr=nr.removeData;var rr=function(e){var t=this,n=(e=he({},e)).container;n&&!ur(n)&&ur(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=Ae!==void 0&&n!==void 0&&!e.headless,i=e;i.layout=he({name:o?"grid":"null"},i.layout),i.renderer=he({name:o?"canvas":"null"},i.renderer);var s=function(c,d,h){return d!==void 0?d:h!==void 0?h:c},l=this._private={container:n,ready:!1,options:i,elements:new Ve(this),listeners:[],aniEles:new Ve(this),data:i.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,i.zoomingEnabled),userZoomingEnabled:s(!0,i.userZoomingEnabled),panningEnabled:s(!0,i.panningEnabled),userPanningEnabled:s(!0,i.userPanningEnabled),boxSelectionEnabled:s(!0,i.boxSelectionEnabled),autolock:s(!1,i.autolock,i.autolockNodes),autoungrabify:s(!1,i.autoungrabify,i.autoungrabifyNodes),autounselectify:s(!1,i.autounselectify),styleEnabled:i.styleEnabled===void 0?o:i.styleEnabled,zoom:te(i.zoom)?i.zoom:1,pan:{x:ve(i.pan)&&te(i.pan.x)?i.pan.x:0,y:ve(i.pan)&&te(i.pan.y)?i.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,i.multiClickDebounceTime)};this.createEmitter(),this.selectionType(i.selectionType),this.zoomRange({min:i.minZoom,max:i.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=he({},i,i.renderer);t.initRenderer(u),function(c,d){if(c.some(fl))return gn.all(c).then(d);d(c)}([i.style,i.elements],function(c){var d=c[0],h=c[1];l.styleEnabled&&t.style().append(d),function(g,p,v){t.notifications(!1);var b=t.mutableElements();b.length>0&&b.remove(),g!=null&&(ve(g)||ke(g))&&t.add(g),t.one("layoutready",function(y){t.notifications(!0),t.emit(y),t.one("load",p),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",v),t.emit("done")});var f=he({},t._private.options.layout);f.eles=t.elements(),t.layout(f).run()}(h,function(){t.startAnimationLoop(),l.ready=!0,Me(i.ready)&&t.on("ready",i.ready);for(var g=0;g0,u=Je(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(tt(n.roots))e=n.roots;else if(ke(n.roots)){for(var c=[],d=0;d0;){var z=M(),R=E(z,T);if(R)z.outgoers().filter(function(Q){return Q.isNode()&&a.has(Q)}).forEach(B);else if(R===null){we("Detected double maximal shift for node `"+z.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var F=0;if(n.avoidOverlap)for(var N=0;N0&&f[0].length<=3?L/2:0),H=2*Math.PI/f[ee].length*C;return ee===0&&f[0].length===1&&(Z=1),{x:ae+Z*Math.cos(H),y:de+Z*Math.sin(H)}}return{x:ae+(C+1-(_+1)/2)*A,y:(ee+1)*V}}),this};var Bd={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function vs(e){this.options=he({},Bd,e)}vs.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var i,s=Je(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(t.sweep===void 0?2*Math.PI-2*Math.PI/o.length:t.sweep)/Math.max(1,o.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var b=Math.cos(c)-Math.cos(0),f=Math.sin(c)-Math.sin(0),y=Math.sqrt(d*d/(b*b+f*f));i=Math.max(y,i)}return r.nodes().layoutPositions(this,t,function(m,k){var x=t.startAngle+k*c*(a?1:-1),S=i*Math.cos(x),w=i*Math.sin(x);return{x:l+S,y:u+w}}),this};var ys,_d={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ms(e){this.options=he({},_d,e)}ms.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,o=a.nodes().not(":parent"),i=Je(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=i.x1+i.w/2,l=i.y1+i.h/2,u=[],c=0,d=0;d0&&Math.abs(y[0].value-k.value)>=b&&(y=[],f.push(y)),y.push(k)}var x=c+t.minNodeSpacing;if(!t.avoidOverlap){var S=f.length>0&&f[0].length>1,w=(Math.min(i.w,i.h)/2-x)/(f.length+S?1:0);x=Math.min(x,w)}for(var D=0,E=0;E1&&t.avoidOverlap){var M=Math.cos(B)-Math.cos(0),z=Math.sin(B)-Math.sin(0),R=Math.sqrt(x*x/(M*M+z*z));D=Math.max(R,D)}P.r=D,D+=x}if(t.equidistant){for(var F=0,N=0,I=0;I=e.numIter)&&(Od(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&o(),pr(c)):(ws(r,e),s())})();else{for(;u;)u=i(l),l++;ws(r,e),s()}return this},Qr.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Qr.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Ad=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),o=Je(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},s=n.eles.components(),l={},u=0;u0)for(i.graphSet.push(x),u=0;ur.count?0:r.graph},zd=function e(t,n,r,a){var o=a.graphSet[r];if(-10)var s=(u=r.nodeOverlap*i)*a/(v=Math.sqrt(a*a+o*o)),l=u*o/v;else{var u,c=Jr(e,a,o),d=Jr(t,-1*a,-1*o),h=d.x-c.x,g=d.y-c.y,p=h*h+g*g,v=Math.sqrt(p);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,l=u*g/v}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Xd=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else o=t.maxY-e.minY;return a>=0&&o>=0?Math.sqrt(a*a+o*o):0},Jr=function(e,t,n){var r=e.positionX,a=e.positionY,o=e.height||1,i=e.width||1,s=n/t,l=o/i,u={};return t===0&&0n?(u.x=r,u.y=a+o/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-i/2,u.y=a-i*n/2/t,u):0=l)?(u.x=r+o*t/2/n,u.y=a+o/2,u):(0>n&&(s<=-1*l||s>=l)&&(u.x=r-o*t/2/n,u.y=a-o/2),u)},qd=function(e,t){for(var n=0;n1){var p=t.gravity*d/g,v=t.gravity*h/g;c.offsetX+=p,c.offsetY+=v}}}}},jd=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var o=n[r++],i=e.idToIndex[o],s=e.layoutNodes[i],l=s.children;if(0n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},Kd=function e(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],o=!1;return(a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,o=!0),(a.minX==null||t.minX-a.padLefta.maxY)&&(a.maxY=t.maxY+a.padBottom,o=!0),(a.minY==null||t.minY-a.padTopp&&(d+=g+t.componentSpacing,c=0,h=0,g=0)}}},Gd={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Es(e){this.options=he({},Gd,e)}Es.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var o=Je(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(o.h===0||o.w===0)r.nodes().layoutPositions(this,t,function(j){return{x:o.x1,y:o.y1}});else{var i=a.size(),s=Math.sqrt(i*o.h/o.w),l=Math.round(s),u=Math.round(o.w/o.h*s),c=function(j){if(j==null)return Math.min(l,u);Math.min(l,u)==l?l=j:u=j},d=function(j){if(j==null)return Math.max(l,u);Math.max(l,u)==l?l=j:u=j},h=t.rows,g=t.cols!=null?t.cols:t.columns;if(h!=null&&g!=null)l=h,u=g;else if(h!=null&&g==null)l=h,u=Math.ceil(i/l);else if(h==null&&g!=null)u=g,l=Math.ceil(i/u);else if(u*l>i){var p=c(),v=d();(p-1)*v>=i?c(p-1):(v-1)*p>=i&&d(v-1)}else for(;u*l=i?d(f+1):c(b+1)}var y=o.w/u,m=o.h/l;if(t.condense&&(y=0,m=0),t.avoidOverlap)for(var k=0;k=u&&(R=0,z++)},N={},I=0;I(D=cu(e,t,I[X],I[X+1],I[X+2],I[X+3])))return b(w,D),!0}else if(P.edgeType==="bezier"||P.edgeType==="multibezier"||P.edgeType==="self"||P.edgeType==="compound"){for(I=P.allpts,X=0;X+5(D=uu(e,t,I[X],I[X+1],I[X+2],I[X+3],I[X+4],I[X+5])))return b(w,D),!0}F=F||E.source,N=N||E.target;var O=i.getArrowWidth(T,B),Y=[{name:"source",x:P.arrowStartX,y:P.arrowStartY,angle:P.srcArrowAngle},{name:"target",x:P.arrowEndX,y:P.arrowEndY,angle:P.tgtArrowAngle},{name:"mid-source",x:P.midX,y:P.midY,angle:P.midsrcArrowAngle},{name:"mid-target",x:P.midX,y:P.midY,angle:P.midtgtArrowAngle}];for(X=0;X0&&(f(F),f(N))}function m(w,D,E){return ct(w,D,E)}function k(w,D){var E,P=w._private,T=p;E=D?D+"-":"",w.boundingBox();var B=P.labelBounds[D||"main"],M=w.pstyle(E+"label").value;if(w.pstyle("text-events").strValue==="yes"&&M){var z=m(P.rscratch,"labelX",D),R=m(P.rscratch,"labelY",D),F=m(P.rscratch,"labelAngle",D),N=w.pstyle(E+"text-margin-x").pfValue,I=w.pstyle(E+"text-margin-y").pfValue,X=B.x1-T-N,O=B.x2+T-N,Y=B.y1-T-I,j=B.y2+T-I;if(F){var G=Math.cos(F),W=Math.sin(F),q=function(ue,Q){return{x:(ue-=z)*G-(Q-=R)*W+z,y:ue*W+Q*G+R}},K=q(X,Y),U=q(X,j),re=q(O,Y),ae=q(O,j),de=[K.x+N,K.y+I,re.x+N,re.y+I,ae.x+N,ae.y+I,U.x+N,U.y+I];if(et(e,t,de))return b(w),!0}else if(dn(B,e,t))return b(w),!0}}n&&(l=l.interactive);for(var x=l.length-1;x>=0;x--){var S=l[x];S.isNode()?f(S)||k(S):y(S)||k(S)||k(S,"source")||k(S,"target")}return u},getAllInBox:function(e,t,n,r){for(var a=this.getCachedZSortedEles().interactive,o=[],i=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r),c=Je({x1:e=i,y1:t=l,x2:n=s,y2:r=u}),d=0;d0?-(Math.PI-o.ang):Math.PI+o.ang),As(t,n,it),Ts=mt.nx*it.ny-mt.ny*it.nx,Ms=mt.nx*it.nx-mt.ny*-it.ny,Ct=Math.asin(Math.max(-1,Math.min(1,Ts))),Math.abs(Ct)<1e-6)return Qa=t.x,Ja=t.y,void(Jt=ar=0);$t=1,ea=!1,Ms<0?Ct<0?Ct=Math.PI+Ct:(Ct=Math.PI-Ct,$t=-1,ea=!0):Ct>0&&($t=-1,ea=!0),ar=t.radius!==void 0?t.radius:r,Qt=Ct/2,ta=Math.min(mt.len/2,it.len/2),a?(St=Math.abs(Math.cos(Qt)*ar/Math.sin(Qt)))>ta?(St=ta,Jt=Math.abs(St*Math.sin(Qt)/Math.cos(Qt))):Jt=ar:(St=Math.min(ta,ar),Jt=Math.abs(St*Math.sin(Qt)/Math.cos(Qt))),ei=t.x+it.nx*St,ti=t.y+it.ny*St,Qa=ei-it.ny*Jt*$t,Ja=ti+it.nx*Jt*$t,Bs=t.x+mt.nx*St,_s=t.y+mt.ny*St,Ns=t};function Ls(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function ni(e,t,n,r){var a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4];return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(th(e,t,n,r,a),{cx:Qa,cy:Ja,radius:Jt,startX:Bs,startY:_s,stopX:ei,stopY:ti,startAngle:mt.ang+Math.PI/2*$t,endAngle:it.ang-Math.PI/2*$t,counterClockwise:ea})}var He={};function zs(e){var t=[];if(e!=null){for(var n=0;n0?Math.max(se-pe,0):Math.min(se+pe,0)},T=P(D,S),B=P(E,w),M=!1;b==="auto"?v=Math.abs(T)>Math.abs(B)?a:r:b===l||b===s?(v=r,M=!0):b!==o&&b!==i||(v=a,M=!0);var z,R=v===r,F=R?B:T,N=R?E:D,I=Xi(N),X=!1;M&&(y||k)||!(b===s&&N<0||b===l&&N>0||b===o&&N>0||b===i&&N<0)||(F=(I*=-1)*Math.abs(F),X=!0),y?z=(m<0?1+m:m)*F:z=(m<0?F:0)+m*I;var O=function(se){return Math.abs(se)=Math.abs(F)},Y=O(z),j=O(Math.abs(F)-Math.abs(z));if((Y||j)&&!X)if(R){var G=Math.abs(N)<=d/2,W=Math.abs(D)<=h/2;if(G){var q=(u.x1+u.x2)/2,K=u.y1,U=u.y2;n.segpts=[q,K,q,U]}else if(W){var re=(u.y1+u.y2)/2,ae=u.x1,de=u.x2;n.segpts=[ae,re,de,re]}else n.segpts=[u.x1,u.y2]}else{var ue=Math.abs(N)<=c/2,Q=Math.abs(E)<=g/2;if(ue){var le=(u.y1+u.y2)/2,ee=u.x1,C=u.x2;n.segpts=[ee,le,C,le]}else if(Q){var _=(u.x1+u.x2)/2,A=u.y1,V=u.y2;n.segpts=[_,A,_,V]}else n.segpts=[u.x2,u.y1]}else if(R){var L=u.y1+z+(p?d/2*I:0),Z=u.x1,H=u.x2;n.segpts=[Z,L,H,L]}else{var ne=u.x1+z+(p?c/2*I:0),$=u.y1,J=u.y2;n.segpts=[ne,$,ne,J]}if(n.isRound){var oe=e.pstyle("taxi-radius").value,ie=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(oe),n.isArcRadius=new Array(n.segpts.length/2).fill(ie)}},He.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,o=t.srcW,i=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,g=t.srcRs,p=t.tgtRs,v=!te(n.startX)||!te(n.startY),b=!te(n.arrowStartX)||!te(n.arrowStartY),f=!te(n.endX)||!te(n.endY),y=!te(n.arrowEndX)||!te(n.arrowEndY),m=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),k=jt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=kP.poolIndex()){var T=E;E=P,P=T}var B=x.srcPos=E.position(),M=x.tgtPos=P.position(),z=x.srcW=E.outerWidth(),R=x.srcH=E.outerHeight(),F=x.tgtW=P.outerWidth(),N=x.tgtH=P.outerHeight(),I=x.srcShape=n.nodeShapes[t.getNodeShape(E)],X=x.tgtShape=n.nodeShapes[t.getNodeShape(P)],O=x.srcCornerRadius=E.pstyle("corner-radius").value==="auto"?"auto":E.pstyle("corner-radius").pfValue,Y=x.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,j=x.tgtRs=P._private.rscratch,G=x.srcRs=E._private.rscratch;x.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var W=0;W0){var ae=u,de=Wt(ae,un(t)),ue=Wt(ae,un(re)),Q=de;ue2&&Wt(ae,{x:re[2],y:re[3]})0){var oe=c,ie=Wt(oe,un(t)),se=Wt(oe,un(J)),pe=ie;se2&&Wt(oe,{x:J[2],y:J[3]})=g||S){p={cp:m,segment:x};break}}if(p)break}var w=p.cp,D=p.segment,E=(g-b)/D.length,P=D.t1-D.t0,T=h?D.t0+P*E:D.t1-P*E;T=jn(0,T,1),t=cn(w.p0,w.p1,w.p2,T),d=function(O,Y,j,G){var W=jn(0,G-.001,1),q=jn(0,G+.001,1),K=cn(O,Y,j,W),U=cn(O,Y,j,q);return Rs(K,U)}(w.p0,w.p1,w.p2,T);break;case"straight":case"segments":case"haystack":for(var B,M,z,R,F=0,N=r.allpts.length,I=0;I+3=g));I+=2);var X=(g-M)/B;X=jn(0,X,1),t=function(O,Y,j,G){var W=Y.x-O.x,q=Y.y-O.y,K=jt(O,Y),U=W/K,re=q/K;return j=j??0,G=G??j*K,{x:O.x+U*G,y:O.y+re*G}}(z,R,X),d=Rs(z,R)}i("labelX",c,t.x),i("labelY",c,t.y),i("labelAutoAngle",c,d)}};u("source"),u("target"),this.applyLabelDimensions(e)}},Pt.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Pt.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,i=e.pstyle("text-wrap").strValue,s=ct(n.rscratch,"labelWrapCachedLines",t)||[],l=i!=="wrap"?1:Math.max(s.length,1),u=a.height/l,c=u*o,d=a.width,h=a.height+(l-1)*(o-1)*u;_t(n.rstyle,"labelWidth",t,d),_t(n.rscratch,"labelWidth",t,d),_t(n.rstyle,"labelHeight",t,h),_t(n.rscratch,"labelHeight",t,h),_t(n.rscratch,"labelLineHeight",t,c)},Pt.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,i=function(z,R){return R?(_t(n.rscratch,z,t,R),R):ct(n.rscratch,z,t)};if(!a)return"";o=="none"||(o=="uppercase"?a=a.toUpperCase():o=="lowercase"&&(a=a.toLowerCase()));var s=e.pstyle("text-wrap").value;if(s==="wrap"){var l=i("labelKey");if(l!=null&&i("labelWrapKey")===l)return i("labelWrapCachedText");for(var u=a.split(` +`),c=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value==="anywhere",h=[],g=/[\s\u200b]+|$/g,p=0;pc){var y,m="",k=0,x=vi(v.matchAll(g));try{for(x.s();!(y=x.n()).done;){var S=y.value,w=S[0],D=v.substring(k,S.index);k=S.index+w.length;var E=m.length===0?D:m+D+w;this.calculateLabelDimensions(e,E).width<=c?m+=D+w:(m&&h.push(m),m=D+w)}}catch(z){x.e(z)}finally{x.f()}m.match(/^[\s\u200b]+$/)||h.push(m)}else h.push(v)}i("labelWrapCachedLines",h),a=i("labelWrapCachedText",h.join(` +`)),i("labelWrapKey",l)}else if(s==="ellipsis"){var P=e.pstyle("text-max-width").pfValue,T="",B=!1;if(this.calculateLabelDimensions(e,a).widthP);M++)T+=a[M],M===a.length-1&&(B=!0);return B||(T+="\u2026"),T}return a},Pt.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t!=="auto")return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},Pt.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,a=Yt(t,e._private.labelDimsKey),o=n.labelDimCache||(n.labelDimCache=[]),i=o[a];if(i!=null)return i;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var g=d.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var p=0,v=0,b=t.split(` +`),f=0;f1&&arguments[1]!==void 0)||arguments[1];if(t.merge(o),i)for(var s=0;s=e.desktopTapThreshold2}var Ue=a(C);oe&&(e.hoverData.tapholdCancelled=!0),_=!0,r(J,["mousemove","vmousemove","tapdrag"],C,{x:Z[0],y:Z[1]});var pt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||A.emit({originalEvent:C,type:"boxstart",position:{x:Z[0],y:Z[1]}}),$[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(oe){var Ke={originalEvent:C,type:"cxtdrag",position:{x:Z[0],y:Z[1]}};se?se.emit(Ke):A.emit(Ke),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&J===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:C,type:"cxtdragout",position:{x:Z[0],y:Z[1]}}),e.hoverData.cxtOver=J,J&&J.emit({originalEvent:C,type:"cxtdragover",position:{x:Z[0],y:Z[1]}}))}}else if(e.hoverData.dragging){if(_=!0,A.panningEnabled()&&A.userPanningEnabled()){var Ze;if(e.hoverData.justStartedPan){var ot=e.hoverData.mdownPos;Ze={x:(Z[0]-ot[0])*V,y:(Z[1]-ot[1])*V},e.hoverData.justStartedPan=!1}else Ze={x:pe[0]*V,y:pe[1]*V};A.panBy(Ze),A.emit("dragpan"),e.hoverData.dragged=!0}Z=e.projectIntoViewport(C.clientX,C.clientY)}else if($[4]!=1||se!=null&&!se.pannable()){if(se&&se.pannable()&&se.active()&&se.unactivate(),se&&se.grabbed()||J==ie||(ie&&r(ie,["mouseout","tapdragout"],C,{x:Z[0],y:Z[1]}),J&&r(J,["mouseover","tapdragover"],C,{x:Z[0],y:Z[1]}),e.hoverData.last=J),se)if(oe){if(A.boxSelectionEnabled()&&Ue)se&&se.grabbed()&&(d(fe),se.emit("freeon"),fe.emit("free"),e.dragData.didDrag&&(se.emit("dragfreeon"),fe.emit("dragfree"))),pt();else if(se&&se.grabbed()&&e.nodeIsDraggable(se)){var ft=!e.dragData.didDrag;ft&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(fe,{inDragLayer:!0});var $e={x:0,y:0};if(te(pe[0])&&te(pe[1])&&($e.x+=pe[0],$e.y+=pe[1],ft)){var Qe=e.hoverData.dragDelta;Qe&&te(Qe[0])&&te(Qe[1])&&($e.x+=Qe[0],$e.y+=Qe[1])}e.hoverData.draggingEles=!0,fe.silentShift($e).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else(function(){var st=e.hoverData.dragDelta=e.hoverData.dragDelta||[];st.length===0?(st.push(pe[0]),st.push(pe[1])):(st[0]+=pe[0],st[1]+=pe[1])})();_=!0}else oe&&(e.hoverData.dragging||!A.boxSelectionEnabled()||!Ue&&A.panningEnabled()&&A.userPanningEnabled()?!e.hoverData.selecting&&A.panningEnabled()&&A.userPanningEnabled()&&o(se,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,$[4]=0,e.data.bgActivePosistion=un(H),e.redrawHint("select",!0),e.redraw()):pt(),se&&se.pannable()&&se.active()&&se.unactivate());return $[2]=Z[0],$[3]=Z[1],_?(C.stopPropagation&&C.stopPropagation(),C.preventDefault&&C.preventDefault(),!1):void 0}},!1),e.registerBinding(t,"mouseup",function(C){if((e.hoverData.which!==1||C.which===1||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var _=e.cy,A=e.projectIntoViewport(C.clientX,C.clientY),V=e.selection,L=e.findNearestElement(A[0],A[1],!0,!1),Z=e.dragData.possibleDragElements,H=e.hoverData.down,ne=a(C);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,H&&H.unactivate(),e.hoverData.which===3){var $={originalEvent:C,type:"cxttapend",position:{x:A[0],y:A[1]}};if(H?H.emit($):_.emit($),!e.hoverData.cxtDragged){var J={originalEvent:C,type:"cxttap",position:{x:A[0],y:A[1]}};H?H.emit(J):_.emit(J)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(L,["mouseup","tapend","vmouseup"],C,{x:A[0],y:A[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(H,["click","tap","vclick"],C,{x:A[0],y:A[1]}),m=!1,C.timeStamp-k<=_.multiClickDebounceTime()?(y&&clearTimeout(y),m=!0,k=null,r(H,["dblclick","dbltap","vdblclick"],C,{x:A[0],y:A[1]})):(y=setTimeout(function(){m||r(H,["oneclick","onetap","voneclick"],C,{x:A[0],y:A[1]})},_.multiClickDebounceTime()),k=C.timeStamp)),H!=null||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(C)||(_.$(n).unselect(["tapunselect"]),Z.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=Z=_.collection()),L!=H||e.dragData.didDrag||e.hoverData.selecting||L!=null&&L._private.selectable&&(e.hoverData.dragging||(_.selectionType()==="additive"||ne?L.selected()?L.unselect(["tapunselect"]):L.select(["tapselect"]):ne||(_.$(n).unmerge(L).unselect(["tapunselect"]),L.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var oe=_.collection(e.getAllInBox(V[0],V[1],V[2],V[3]));e.redrawHint("select",!0),oe.length>0&&e.redrawHint("eles",!0),_.emit({type:"boxend",originalEvent:C,position:{x:A[0],y:A[1]}});var ie=function(pe){return pe.selectable()&&!pe.selected()};_.selectionType()==="additive"||ne||_.$(n).unmerge(oe).unselect(),oe.emit("box").stdFilter(ie).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!V[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var se=H&&H.grabbed();d(Z),se&&(H.emit("freeon"),Z.emit("free"),e.dragData.didDrag&&(H.emit("dragfreeon"),Z.emit("dragfree")))}}V[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var S,w,D,E,P,T,B,M,z,R,F,N,I,X=function(C){if(!e.scrollingPage){var _=e.cy,A=_.zoom(),V=_.pan(),L=e.projectIntoViewport(C.clientX,C.clientY),Z=[L[0]*A+V.x,L[1]*A+V.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||e.selection[4]!==0)C.preventDefault();else if(_.panningEnabled()&&_.userPanningEnabled()&&_.zoomingEnabled()&&_.userZoomingEnabled()){var H;C.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150),H=C.deltaY!=null?C.deltaY/-250:C.wheelDeltaY!=null?C.wheelDeltaY/1e3:C.wheelDelta/1e3,H*=e.wheelSensitivity,C.deltaMode===1&&(H*=33);var ne=_.zoom()*Math.pow(10,H);C.type==="gesturechange"&&(ne=e.gestureStartZoom*C.scale),_.zoom({level:ne,renderedPosition:{x:Z[0],y:Z[1]}}),_.emit(C.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",X,!0),e.registerBinding(t,"scroll",function(C){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(C){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||C.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(C){e.hasTouchStarted||X(C)},!0),e.registerBinding(e.container,"mouseout",function(C){var _=e.projectIntoViewport(C.clientX,C.clientY);e.cy.emit({originalEvent:C,type:"mouseout",position:{x:_[0],y:_[1]}})},!1),e.registerBinding(e.container,"mouseover",function(C){var _=e.projectIntoViewport(C.clientX,C.clientY);e.cy.emit({originalEvent:C,type:"mouseover",position:{x:_[0],y:_[1]}})},!1);var O,Y,j,G,W,q,K,U=function(C,_,A,V){return Math.sqrt((A-C)*(A-C)+(V-_)*(V-_))},re=function(C,_,A,V){return(A-C)*(A-C)+(V-_)*(V-_)};if(e.registerBinding(e.container,"touchstart",O=function(C){if(e.hasTouchStarted=!0,x(C)){g(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var _=e.cy,A=e.touchData.now,V=e.touchData.earlier;if(C.touches[0]){var L=e.projectIntoViewport(C.touches[0].clientX,C.touches[0].clientY);A[0]=L[0],A[1]=L[1]}if(C.touches[1]&&(L=e.projectIntoViewport(C.touches[1].clientX,C.touches[1].clientY),A[2]=L[0],A[3]=L[1]),C.touches[2]&&(L=e.projectIntoViewport(C.touches[2].clientX,C.touches[2].clientY),A[4]=L[0],A[5]=L[1]),C.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var Z=e.findContainerClientCoords();z=Z[0],R=Z[1],F=Z[2],N=Z[3],S=C.touches[0].clientX-z,w=C.touches[0].clientY-R,D=C.touches[1].clientX-z,E=C.touches[1].clientY-R,I=0<=S&&S<=F&&0<=D&&D<=F&&0<=w&&w<=N&&0<=E&&E<=N;var H=_.pan(),ne=_.zoom();if(P=U(S,w,D,E),T=re(S,w,D,E),M=[((B=[(S+D)/2,(w+E)/2])[0]-H.x)/ne,(B[1]-H.y)/ne],T<4e4&&!C.touches[2]){var $=e.findNearestElement(A[0],A[1],!0,!0),J=e.findNearestElement(A[2],A[3],!0,!0);return $&&$.isNode()?($.activate().emit({originalEvent:C,type:"cxttapstart",position:{x:A[0],y:A[1]}}),e.touchData.start=$):J&&J.isNode()?(J.activate().emit({originalEvent:C,type:"cxttapstart",position:{x:A[0],y:A[1]}}),e.touchData.start=J):_.emit({originalEvent:C,type:"cxttapstart",position:{x:A[0],y:A[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(C.touches[2])_.boxSelectionEnabled()&&C.preventDefault();else if(!C.touches[1]){if(C.touches[0]){var oe=e.findNearestElements(A[0],A[1],!0,!0),ie=oe[0];if(ie!=null&&(ie.activate(),e.touchData.start=ie,e.touchData.starts=oe,e.nodeIsGrabbable(ie))){var se=e.dragData.touchDragEles=_.collection(),pe=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ie.selected()?(pe=_.$(function(Te){return Te.selected()&&e.nodeIsGrabbable(Te)}),u(pe,{addToList:se})):c(ie,{addToList:se}),s(ie);var fe=function(Te){return{originalEvent:C,type:Te,position:{x:A[0],y:A[1]}}};ie.emit(fe("grabon")),pe?pe.forEach(function(Te){Te.emit(fe("grab"))}):ie.emit(fe("grab"))}r(ie,["touchstart","tapstart","vmousedown"],C,{x:A[0],y:A[1]}),ie==null&&(e.data.bgActivePosistion={x:L[0],y:L[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved!==!1||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],C,{x:A[0],y:A[1]})},e.tapholdDuration)}}if(C.touches.length>=1){for(var xe=e.touchData.startPosition=[null,null,null,null,null,null],ge=0;ge=e.touchTapThreshold2}if(_&&e.touchData.cxt){C.preventDefault();var xe=C.touches[0].clientX-z,ge=C.touches[0].clientY-R,De=C.touches[1].clientX-z,Te=C.touches[1].clientY-R,Ue=re(xe,ge,De,Te);if(Ue/T>=2.25||Ue>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var pt={originalEvent:C,type:"cxttapend",position:{x:L[0],y:L[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(pt),e.touchData.start=null):V.emit(pt)}}if(_&&e.touchData.cxt){pt={originalEvent:C,type:"cxtdrag",position:{x:L[0],y:L[1]}},e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(pt):V.emit(pt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Ke=e.findNearestElement(L[0],L[1],!0,!0);e.touchData.cxtOver&&Ke===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:C,type:"cxtdragout",position:{x:L[0],y:L[1]}}),e.touchData.cxtOver=Ke,Ke&&Ke.emit({originalEvent:C,type:"cxtdragover",position:{x:L[0],y:L[1]}}))}else if(_&&C.touches[2]&&V.boxSelectionEnabled())C.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||V.emit({originalEvent:C,type:"boxstart",position:{x:L[0],y:L[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,A[4]=1,A&&A.length!==0&&A[0]!==void 0?(A[2]=(L[0]+L[2]+L[4])/3,A[3]=(L[1]+L[3]+L[5])/3):(A[0]=(L[0]+L[2]+L[4])/3,A[1]=(L[1]+L[3]+L[5])/3,A[2]=(L[0]+L[2]+L[4])/3+1,A[3]=(L[1]+L[3]+L[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(_&&C.touches[1]&&!e.touchData.didSelect&&V.zoomingEnabled()&&V.panningEnabled()&&V.userZoomingEnabled()&&V.userPanningEnabled()){if(C.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),xt=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var Ze=0;Ze0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",j=function(C){var _=e.touchData.start;e.touchData.capture=!1,_&&_.unactivate()}),e.registerBinding(t,"touchend",G=function(C){var _=e.touchData.start;if(e.touchData.capture){C.touches.length===0&&(e.touchData.capture=!1),C.preventDefault();var A=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var V,L=e.cy,Z=L.zoom(),H=e.touchData.now,ne=e.touchData.earlier;if(C.touches[0]){var $=e.projectIntoViewport(C.touches[0].clientX,C.touches[0].clientY);H[0]=$[0],H[1]=$[1]}if(C.touches[1]&&($=e.projectIntoViewport(C.touches[1].clientX,C.touches[1].clientY),H[2]=$[0],H[3]=$[1]),C.touches[2]&&($=e.projectIntoViewport(C.touches[2].clientX,C.touches[2].clientY),H[4]=$[0],H[5]=$[1]),_&&_.unactivate(),e.touchData.cxt){if(V={originalEvent:C,type:"cxttapend",position:{x:H[0],y:H[1]}},_?_.emit(V):L.emit(V),!e.touchData.cxtDragged){var J={originalEvent:C,type:"cxttap",position:{x:H[0],y:H[1]}};_?_.emit(J):L.emit(J)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!C.touches[2]&&L.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var oe=L.collection(e.getAllInBox(A[0],A[1],A[2],A[3]));A[0]=void 0,A[1]=void 0,A[2]=void 0,A[3]=void 0,A[4]=0,e.redrawHint("select",!0),L.emit({type:"boxend",originalEvent:C,position:{x:H[0],y:H[1]}}),oe.emit("box").stdFilter(function(Ue){return Ue.selectable()&&!Ue.selected()}).select().emit("boxselect"),oe.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(_!=null&&_.unactivate(),C.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!C.touches[1]){if(!C.touches[0]){if(!C.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ie=e.dragData.touchDragEles;if(_!=null){var se=_._private.grabbed;d(ie),e.redrawHint("drag",!0),e.redrawHint("eles",!0),se&&(_.emit("freeon"),ie.emit("free"),e.dragData.didDrag&&(_.emit("dragfreeon"),ie.emit("dragfree"))),r(_,["touchend","tapend","vmouseup","tapdragout"],C,{x:H[0],y:H[1]}),_.unactivate(),e.touchData.start=null}else{var pe=e.findNearestElement(H[0],H[1],!0,!0);r(pe,["touchend","tapend","vmouseup","tapdragout"],C,{x:H[0],y:H[1]})}var fe=e.touchData.startPosition[0]-H[0],xe=fe*fe,ge=e.touchData.startPosition[1]-H[1],De=(xe+ge*ge)*Z*Z;e.touchData.singleTouchMoved||(_||L.$(":selected").unselect(["tapunselect"]),r(_,["tap","vclick"],C,{x:H[0],y:H[1]}),W=!1,C.timeStamp-K<=L.multiClickDebounceTime()?(q&&clearTimeout(q),W=!0,K=null,r(_,["dbltap","vdblclick"],C,{x:H[0],y:H[1]})):(q=setTimeout(function(){W||r(_,["onetap","voneclick"],C,{x:H[0],y:H[1]})},L.multiClickDebounceTime()),K=C.timeStamp)),_!=null&&!e.dragData.didDrag&&_._private.selectable&&De"u"){var ae=[],de=function(C){return{clientX:C.clientX,clientY:C.clientY,force:1,identifier:C.pointerId,pageX:C.pageX,pageY:C.pageY,radiusX:C.width/2,radiusY:C.height/2,screenX:C.screenX,screenY:C.screenY,target:C.target}},ue=function(C){ae.push(function(_){return{event:_,touch:de(_)}}(C))},Q=function(C){for(var _=0;_2){for(var D=[x[0],x[1]],E=Math.pow(D[0]-d,2)+Math.pow(D[1]-h,2),P=1;P0)return O[0]}return null},g=Object.keys(d),p=0;p0?u:Wi(a,o,e,t,n,r,i,s)},checkPoint:function(e,t,n,r,a,o,i,s){var l=2*(s=s==="auto"?Kt(r,a):s);if(Et(e,t,this.points,o,i,r,a-l,[0,-1],n)||Et(e,t,this.points,o,i,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!et(e,t,[o-u,i-c,o-u,i,o+u,i,o+u,i-c])||!!Ht(e,t,l,l,o+r/2-s,i+a/2-s,n)||!!Ht(e,t,l,l,o-r/2+s,i+a/2-s,n)}}},Ft.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Ge(3,0)),this.generateRoundPolygon("round-triangle",Ge(3,0)),this.generatePolygon("rectangle",Ge(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Ge(5,0)),this.generateRoundPolygon("round-pentagon",Ge(5,0)),this.generatePolygon("hexagon",Ge(6,0)),this.generateRoundPolygon("round-hexagon",Ge(6,0)),this.generatePolygon("heptagon",Ge(7,0)),this.generateRoundPolygon("round-heptagon",Ge(7,0)),this.generatePolygon("octagon",Ge(8,0)),this.generateRoundPolygon("round-octagon",Ge(8,0));var r=new Array(20),a=va(5,0),o=va(5,Math.PI/5),i=.5*(3-Math.sqrt(5));i*=1.57;for(var s=0;s=e.deqFastCost*b)break}else if(o){if(p>=e.deqCost*u||p>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*ai)break;var f=e.deq(t,h,d);if(!(f.length>0))break;for(var y=0;y0&&(e.onDeqd(t,c),!o&&e.shouldRedraw(t,c,h,d)&&r())},a(t))}}},sh=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gr;ra(this,e),this.idsByKey=new yt,this.keyForId=new yt,this.cachesByLvl=new yt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return aa(e,[{key:"getIdsFor",value:function(t){t==null&&Be("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new ln,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id();return this.keyForId.get(n)!==this.getKey(t)}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new yt,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id());return this.getCache(r,n)}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}]),e}(),Mn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},lh=Re({getKey:null,doesEleInvalidateKey:gr,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Li,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),or=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=lh(t);he(n,r),n.lookup=new sh(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},ze=or.prototype;ze.reasons=Mn,ze.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},ze.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},ze.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new Yn(function(e,t){return t.reqs-e.reqs})},ze.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},ze.getElement=function(e,t,n,r,a){var o=this,i=this.renderer,s=i.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(pa(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=i.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var g,p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(g=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var v=o.getTextureQueue(g),b=v[v.length-2],f=function(){return o.recycleTexture(g,d)||o.addTexture(g,d)};b||(b=v[v.length-1]),b||(b=f()),b.width-b.usedWidthr;T--)E=o.getElement(e,t,n,T,Mn.downscale);P()}else{var B;if(!k&&!x&&!S)for(var M=r-1;M>=-4;M--){var z=l.get(e,M);if(z){B=z;break}}if(m(B))return o.queueElement(e,r),B;b.context.translate(b.usedWidth,0),b.context.scale(u,u),this.drawElement(b.context,e,t,h,!1),b.context.scale(1/u,1/u),b.context.translate(-b.usedWidth,0)}return p={x:b.usedWidth,texture:b,level:r,scale:u,width:d,height:c,scaledLabelShown:h},b.usedWidth+=Math.ceil(d+8),b.eleCaches.push(p),l.set(e,r,p),o.checkTextureFullness(b),p},ze.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},ze.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Bt(t,e):e.fullnessChecks++},ze.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Bt(n,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,da(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Bt(r,o),n.push(o),o}},ze.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),o=r[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,n.updateItem(o);else{var i={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(i),r[a]=i}},ze.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],o=t.lookup,i=0;i<1&&n.size()>0;i++){var s=n.pop(),l=s.key,u=s.eles[0],c=o.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Mn.dequeue)}}return a},ze.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];a!=null&&(a.eles.length===1?(a.reqs=ua,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},ze.onDequeue=function(e){this.onDequeues.push(e)},ze.offDequeue=function(e){Bt(this.onDequeues,e)},ze.setupDequeueing=js({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null}r.validateLayersElesOrdering(n,e);var i,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;(function(){var k=function(D){if(r.validateLayersElesOrdering(D,e),r.levelIsComplete(D,e))return s=l[D],!0},x=function(D){if(!s)for(var E=n+D;-4<=E&&E<=2&&!k(E);E+=D);};x(1),x(-1);for(var S=c.length-1;S>=0;S--){var w=c[S];w.invalid&&Bt(c,w)}})();var d=function(k){var x=(k=k||{}).after;if(function(){if(!i){i=Je();for(var D=0;D16e6)return null;var S=r.makeLayer(i,n);if(x!=null){var w=c.indexOf(x)+1;c.splice(w,0,S)}else(k.insert===void 0||k.insert)&&c.unshift(S);return S};if(r.skipping&&!o)return null;for(var h=null,g=e.length/1,p=!o,v=0;v=g||!ji(h.bb,b.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||p?r.queueLayer(h,b):r.drawEleInLayer(h,b,n,t),h.eles.push(b),y[n]=h}}return s||(p?null:c)},Xe.getEleLevelForLayerLevel=function(e,t){return e},Xe.drawEleInLayer=function(e,t,n,r){var a=this.renderer,o=e.context,i=t.boundingBox();i.w!==0&&i.h!==0&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,!0),a.setImgSmoothing(o,!0))},Xe.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,a=0;a0||o.invalid)return!1;r+=o.eles.length}return r===t.length},Xe.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Xe.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=wt(),e.length!==0&&t.haveLayers()&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},Xe.invalidateLayer=function(e){if(this.lastInvalidationTime=wt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Bt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],o=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],i=this,s=t._private.rscratch;if((!o||t.visible())&&!s.badLine&&s.allpts!=null&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,g=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,b=t.pstyle("line-outline-color").value,f=u*c,y=u*c,m=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f;d==="straight-triangle"?(i.eleStrokeStyle(e,t,E),i.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=g,e.lineCap=p,i.eleStrokeStyle(e,t,E),i.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},k=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;i.drawArrowheads(e,t,E)};if(e.lineJoin="round",t.pstyle("ghost").value==="yes"){var x=t.pstyle("ghost-offset-x").pfValue,S=t.pstyle("ghost-offset-y").pfValue,w=t.pstyle("ghost-opacity").value,D=f*w;e.translate(x,S),m(D),k(D),e.translate(-x,-S)}else(function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f;e.lineWidth=g+v,e.lineCap=p,v>0?(i.colorStrokeStyle(e,b[0],b[1],b[2],E),d==="straight-triangle"?i.drawEdgeTrianglePath(t,e,s.allpts):(i.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"})();a&&i.drawEdgeUnderlay(e,t),m(),k(),a&&i.drawEdgeOverlay(e,t),i.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},Zs=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var a=this,o=a.usePaths(),i=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,i.edgeType!=="self"||o?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,i.allpts,"solid")}}}};Xt.drawEdgeOverlay=Zs("overlay"),Xt.drawEdgeUnderlay=Zs("underlay"),Xt.drawEdgePath=function(e,t,n,r){var a,o=e._private.rscratch,i=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");o.pathCacheKey&&o.pathCacheKey===d?(a=t=o.pathCache,s=!0):(a=t=new Path2D,o.pathCacheKey=d,o.pathCache=a)}if(i.setLineDash)switch(r){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=c;break;case"solid":i.setLineDash([])}if(!s&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==void 0?arguments[5]:5,i=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),i?e.stroke():e.fill()}en.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(pa(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t5&&arguments[5]!==void 0)||arguments[5],i=this;if(r==null){if(o&&!i.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=i.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var g,p=!n;n&&(g=n,e.translate(-g.x1,-g.y1)),a==null?(i.drawText(e,t,null,p,o),t.isEdge()&&(i.drawText(e,t,"source",p,o),i.drawText(e,t,"target",p,o))):i.drawText(e,t,a,p,o),n&&e.translate(g.x1,g.y1)},en.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&arguments[2]!==void 0)||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,i=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+i+" "+a+" "+o,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},en.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",a=e.pstyle(r+"text-rotation"),o=ct(n,"labelAngle",t);return a.strValue==="autorotate"?e.isEdge()?o:0:a.strValue==="none"?0:a.pfValue},en.drawText=function(e,t,n){var r=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],o=t._private.rscratch,i=a?t.effectiveOpacity():1;if(!a||i!==0&&t.pstyle("text-opacity").value!==0){n==="main"&&(n=null);var s,l,u=ct(o,"labelX",n),c=ct(o,"labelY",n),d=this.getLabelText(t,n);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,g=n?n+"-":"",p=ct(o,"labelWidth",n),v=ct(o,"labelHeight",n),b=t.pstyle(g+"text-margin-x").pfValue,f=t.pstyle(g+"text-margin-y").pfValue,y=t.isEdge(),m=t.pstyle("text-halign").value,k=t.pstyle("text-valign").value;switch(y&&(m="center",k="center"),u+=b,c+=f,(h=r?this.getTextAngle(t,n):0)!==0&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),k){case"top":break;case"center":c+=v/2;break;case"bottom":c+=v}var x=t.pstyle("text-background-opacity").value,S=t.pstyle("text-border-opacity").value,w=t.pstyle("text-border-width").pfValue,D=t.pstyle("text-background-padding").pfValue,E=t.pstyle("text-background-shape").strValue.indexOf("round")===0;if(x>0||w>0&&S>0){var P=u-D;switch(m){case"left":P-=p;break;case"center":P-=p/2}var T=c-v-D,B=p+2*D,M=v+2*D;if(x>0){var z=e.fillStyle,R=t.pstyle("text-background-color").value;e.fillStyle="rgba("+R[0]+","+R[1]+","+R[2]+","+x*i+")",E?oi(e,P,T,B,M,2):e.fillRect(P,T,B,M),e.fillStyle=z}if(w>0&&S>0){var F=e.strokeStyle,N=e.lineWidth,I=t.pstyle("text-border-color").value,X=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+S*i+")",e.lineWidth=w,e.setLineDash)switch(X){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=w/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(E?oi(e,P,T,B,M,2,"stroke"):e.strokeRect(P,T,B,M),X==="double"){var O=w/2;E?oi(e,P+O,T+O,B-2*O,M-2*O,2,"stroke"):e.strokeRect(P+O,T+O,B-2*O,M-2*O)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=F}}var Y=2*t.pstyle("text-outline-width").pfValue;if(Y>0&&(e.lineWidth=Y),t.pstyle("text-wrap").value==="wrap"){var j=ct(o,"labelWrapCachedLines",n),G=ct(o,"labelLineHeight",n),W=p/2,q=this.getLabelJustification(t);switch(q==="auto"||(m==="left"?q==="left"?u+=-p:q==="center"&&(u+=-W):m==="center"?q==="left"?u+=-W:q==="right"&&(u+=W):m==="right"&&(q==="center"?u+=W:q==="right"&&(u+=p))),k){case"top":case"center":case"bottom":c-=(j.length-1)*G}for(var K=0;K0&&e.strokeText(j[K],u,c),e.fillText(j[K],u,c),c+=G}else Y>0&&e.strokeText(d,u,c),e.fillText(d,u,c);h!==0&&(e.rotate(-h),e.translate(-s,-l))}}};var sr={drawNode:function(e,t,n){var r,a,o=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],s=!(arguments.length>5&&arguments[5]!==void 0)||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(te(d.x)&&te(d.y)&&(!s||t.visible())){var h,g,p=s?t.effectiveOpacity():1,v=l.usePaths(),b=!1,f=t.padding();r=t.width()+2*f,a=t.height()+2*f,n&&(g=n,e.translate(-g.x1,-g.y1));for(var y=t.pstyle("background-image").value,m=new Array(y.length),k=new Array(y.length),x=0,S=0;S0&&arguments[0]!==void 0?arguments[0]:T;l.eleFillStyle(e,t,$)},U=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;l.colorStrokeStyle(e,B[0],B[1],B[2],$)},re=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G;l.colorStrokeStyle(e,Y[0],Y[1],Y[2],$)},ae=function($,J,oe,ie){var se,pe=l.nodePathCache=l.nodePathCache||[],fe=Ni(oe==="polygon"?oe+","+ie.join(","):oe,""+J,""+$,""+q),xe=pe[fe],ge=!1;return xe!=null?(se=xe,ge=!0,c.pathCache=se):(se=new Path2D,pe[fe]=c.pathCache=se),{path:se,cacheHit:ge}},de=t.pstyle("shape").strValue,ue=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(d.x,d.y);var Q=ae(r,a,de,ue);h=Q.path,b=Q.cacheHit}var le=function(){if(!b){var $=d;v&&($={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,$.x,$.y,r,a,q,c)}v?e.fill(h):e.fill()},ee=function(){for(var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],oe=u.backgrounding,ie=0,se=0;se0&&arguments[0]!==void 0&&arguments[0],J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;l.hasPie(t)&&(l.drawPie(e,t,J),$&&(v||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,q,c)))},_=function(){var $=(E>0?E:-E)*(arguments.length>0&&arguments[0]!==void 0?arguments[0]:p),J=E>0?0:255;E!==0&&(l.colorFillStyle(e,J,J,J,$),v?e.fill(h):e.fill())},A=function(){if(P>0){if(e.lineWidth=P,e.lineCap=R,e.lineJoin=z,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(N),e.lineDashOffset=I;break;case"solid":case"double":e.setLineDash([])}if(F!=="center"){if(e.save(),e.lineWidth*=2,F==="inside")v?e.clip(h):e.clip();else{var $=new Path2D;$.rect(-r/2-P,-a/2-P,r+2*P,a+2*P),$.addPath(h),e.clip($,"evenodd")}v?e.stroke(h):e.stroke(),e.restore()}else v?e.stroke(h):e.stroke();if(M==="double"){e.lineWidth=P/3;var J=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(h):e.stroke(),e.globalCompositeOperation=J}e.setLineDash&&e.setLineDash([])}},V=function(){if(O>0){if(e.lineWidth=O,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var $=d;v&&($={x:0,y:0});var J=l.getNodeShape(t),oe=P;F==="inside"&&(oe=0),F==="outside"&&(oe*=2);var ie,se=(r+oe+(O+W))/r,pe=(a+oe+(O+W))/a,fe=r*se,xe=a*pe,ge=l.nodeShapes[J].points;if(v&&(ie=ae(fe,xe,J,ge).path),J==="ellipse")l.drawEllipsePath(ie||e,$.x,$.y,fe,xe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(J)){var De=0,Te=0,Ue=0;J==="round-diamond"?De=1.4*(oe+W+O):J==="round-heptagon"?(De=1.075*(oe+W+O),Ue=-(oe/2+W+O)/35):J==="round-hexagon"?De=1.12*(oe+W+O):J==="round-pentagon"?(De=1.13*(oe+W+O),Ue=-(oe/2+W+O)/15):J==="round-tag"?(De=1.12*(oe+W+O),Te=.07*(oe/2+O+W)):J==="round-triangle"&&(De=(oe+W+O)*(Math.PI/2),Ue=-(oe+W/2+O)/Math.PI),De!==0&&(fe=r*(se=(r+De)/r),["round-hexagon","round-tag"].includes(J)||(xe=a*(pe=(a+De)/a)));for(var pt=fe/2,Ke=xe/2,Ze=(q=q==="auto"?Ki(fe,xe):q)+(oe+O+W)/2,ot=new Array(ge.length/2),ft=new Array(ge.length/2),$e=0;$e0){if(r=r||n.position(),a==null||o==null){var d=n.padding();a=n.width()+2*d,o=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,a+2*i,o+2*i,c),t.fill()}}}};sr.drawNodeOverlay=$s("overlay"),sr.drawNodeUnderlay=$s("underlay"),sr.hasPie=function(e){return(e=e[0])._private.hasPie},sr.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),o=t.pstyle("pie-size"),i=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(i=0,s=0),o.units==="%"?c*=o.pfValue:o.pfValue!==void 0&&(c=o.pfValue/2);for(var h=1;h<=a.pieBackgroundN;h++){var g=t.pstyle("pie-"+h+"-background-size").value,p=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,b=g/100;b+d>1&&(b=1-d);var f=1.5*Math.PI+2*Math.PI*d,y=f+2*Math.PI*b;g===0||d>=1||d+b>1||(e.beginPath(),e.moveTo(i,s),e.arc(i,s,c,f,y),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],v),e.fill(),d+=b)}};var nt={};nt.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},nt.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,a=0;ai.minMbLowQualFrames&&(i.motionBlurPxRatio=i.mbPxRBlurry)),i.clearingMotionBlur&&(i.motionBlurPxRatio=1),i.textureDrawLastFrame&&!d&&(c[i.NODE]=!0,c[i.SELECT_BOX]=!0);var y=l.style(),m=l.zoom(),k=a!==void 0?a:m,x=l.pan(),S={x:x.x,y:x.y},w={zoom:m,pan:{x:x.x,y:x.y}},D=i.prevViewport;D===void 0||w.zoom!==D.zoom||w.pan.x!==D.pan.x||w.pan.y!==D.pan.y||v&&!p||(i.motionBlurPxRatio=1),o&&(S=o),k*=s,S.x*=s,S.y*=s;var E=i.getCachedZSortedEles();function P(ue,Q,le,ee,C){var _=ue.globalCompositeOperation;ue.globalCompositeOperation="destination-out",i.colorFillStyle(ue,255,255,255,i.motionBlurTransparency),ue.fillRect(Q,le,ee,C),ue.globalCompositeOperation=_}function T(ue,Q){var le,ee,C,_;i.clearingMotionBlur||ue!==u.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]&&ue!==u.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]?(le=S,ee=k,C=i.canvasWidth,_=i.canvasHeight):(le={x:x.x*g,y:x.y*g},ee=m*g,C=i.canvasWidth*g,_=i.canvasHeight*g),ue.setTransform(1,0,0,1,0,0),Q==="motionBlur"?P(ue,0,0,C,_):t||Q!==void 0&&!Q||ue.clearRect(0,0,C,_),n||(ue.translate(le.x,le.y),ue.scale(ee,ee)),o&&ue.translate(o.x,o.y),a&&ue.scale(a,a)}if(d||(i.textureDrawLastFrame=!1),d){if(i.textureDrawLastFrame=!0,!i.textureCache){i.textureCache={},i.textureCache.bb=l.mutableElements().boundingBox(),i.textureCache.texture=i.data.bufferCanvases[i.TEXTURE_BUFFER];var B=i.data.bufferContexts[i.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,i.canvasWidth*i.textureMult,i.canvasHeight*i.textureMult),i.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:s*i.textureMult}),(w=i.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:i.canvasWidth,height:i.canvasHeight}).mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}c[i.DRAG]=!1,c[i.NODE]=!1;var M=u.contexts[i.NODE],z=i.textureCache.texture;w=i.textureCache.viewport,M.setTransform(1,0,0,1,0,0),h?P(M,0,0,w.width,w.height):M.clearRect(0,0,w.width,w.height);var R=y.core("outside-texture-bg-color").value,F=y.core("outside-texture-bg-opacity").value;i.colorFillStyle(M,R[0],R[1],R[2],F),M.fillRect(0,0,w.width,w.height),m=l.zoom(),T(M,!1),M.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/s,w.height/w.zoom/s),M.drawImage(z,w.mpan.x,w.mpan.y,w.width/w.zoom/s,w.height/w.zoom/s)}else i.textureOnViewport&&!t&&(i.textureCache=null);var N=l.extent(),I=i.pinching||i.hoverData.dragging||i.swipePanning||i.data.wheelZooming||i.hoverData.draggingEles||i.cy.animated(),X=i.hideEdgesOnViewport&&I,O=[];if(O[i.NODE]=!c[i.NODE]&&h&&!i.clearedForMotionBlur[i.NODE]||i.clearingMotionBlur,O[i.NODE]&&(i.clearedForMotionBlur[i.NODE]=!0),O[i.DRAG]=!c[i.DRAG]&&h&&!i.clearedForMotionBlur[i.DRAG]||i.clearingMotionBlur,O[i.DRAG]&&(i.clearedForMotionBlur[i.DRAG]=!0),c[i.NODE]||n||r||O[i.NODE]){var Y=h&&!O[i.NODE]&&g!==1;T(M=t||(Y?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]:u.contexts[i.NODE]),h&&!Y?"motionBlur":void 0),X?i.drawCachedNodes(M,E.nondrag,s,N):i.drawLayeredElements(M,E.nondrag,s,N),i.debug&&i.drawDebugPoints(M,E.nondrag),n||h||(c[i.NODE]=!1)}if(!r&&(c[i.DRAG]||n||O[i.DRAG])&&(Y=h&&!O[i.DRAG]&&g!==1,T(M=t||(Y?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]:u.contexts[i.DRAG]),h&&!Y?"motionBlur":void 0),X?i.drawCachedNodes(M,E.drag,s,N):i.drawCachedElements(M,E.drag,s,N),i.debug&&i.drawDebugPoints(M,E.drag),n||h||(c[i.DRAG]=!1)),i.showFps||!r&&c[i.SELECT_BOX]&&!n){if(T(M=t||u.contexts[i.SELECT_BOX]),i.selection[4]==1&&(i.hoverData.selecting||i.touchData.selecting)){m=i.cy.zoom();var j=y.core("selection-box-border-width").value/m;M.lineWidth=j,M.fillStyle="rgba("+y.core("selection-box-color").value[0]+","+y.core("selection-box-color").value[1]+","+y.core("selection-box-color").value[2]+","+y.core("selection-box-opacity").value+")",M.fillRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]),j>0&&(M.strokeStyle="rgba("+y.core("selection-box-border-color").value[0]+","+y.core("selection-box-border-color").value[1]+","+y.core("selection-box-border-color").value[2]+","+y.core("selection-box-opacity").value+")",M.strokeRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]))}if(u.bgActivePosistion&&!i.hoverData.selecting){m=i.cy.zoom();var G=u.bgActivePosistion;M.fillStyle="rgba("+y.core("active-bg-color").value[0]+","+y.core("active-bg-color").value[1]+","+y.core("active-bg-color").value[2]+","+y.core("active-bg-opacity").value+")",M.beginPath(),M.arc(G.x,G.y,y.core("active-bg-size").pfValue/m,0,2*Math.PI),M.fill()}var W=i.lastRedrawTime;if(i.showFps&&W){W=Math.round(W);var q=Math.round(1e3/W);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+W+" ms = "+q+" fps",0,20),M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(q/60,1),20)}n||(c[i.SELECT_BOX]=!1)}if(h&&g!==1){var K=u.contexts[i.NODE],U=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_NODE],re=u.contexts[i.DRAG],ae=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_DRAG],de=function(ue,Q,le){ue.setTransform(1,0,0,1,0,0),le||!f?ue.clearRect(0,0,i.canvasWidth,i.canvasHeight):P(ue,0,0,i.canvasWidth,i.canvasHeight);var ee=g;ue.drawImage(Q,0,0,i.canvasWidth*ee,i.canvasHeight*ee,0,0,i.canvasWidth,i.canvasHeight)};(c[i.NODE]||O[i.NODE])&&(de(K,U,O[i.NODE]),c[i.NODE]=!1),(c[i.DRAG]||O[i.DRAG])&&(de(re,ae,O[i.DRAG]),c[i.DRAG]=!1)}i.prevViewport=w,i.clearingMotionBlur&&(i.clearingMotionBlur=!1,i.motionBlurCleared=!0,i.motionBlur=!0),h&&(i.motionBlurTimeout=setTimeout(function(){i.motionBlurTimeout=null,i.clearedForMotionBlur[i.NODE]=!1,i.clearedForMotionBlur[i.DRAG]=!1,i.motionBlur=!1,i.clearingMotionBlur=!d,i.mbFrames=0,c[i.NODE]=!0,c[i.DRAG]=!0,i.redraw()},100)),t||l.emit("render")};for(var Qs={drawPolygonPath:function(e,t,n,r,a,o){var i=r/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+i*o[0],n+s*o[1]);for(var l=1;l0&&o>0){h.clearRect(0,0,a,o),h.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,g),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var p=t.pan(),v={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(v.x,v.y),h.scale(l,l),this.drawElements(h,g),h.scale(1/l,1/l),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,o),h.fill())}return d},lr.png=function(e){return rl(e,this.bufferCanvasImage(e),"image/png")},lr.jpg=function(e){return rl(e,this.bufferCanvasImage(e),"image/jpeg")};var xh={nodeShapeImpl:function(e,t,n,r,a,o,i,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,o);case"polygon":return this.drawPolygonPath(t,n,r,a,o,i);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,o,i,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,o,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,o,i,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,o,s);case"barrel":return this.drawBarrelPath(t,n,r,a,o)}}},wh=al,be=al.prototype;function al(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(be.CANVAS_LAYERS),contexts:new Array(be.CANVAS_LAYERS),canvasNeedsRedraw:new Array(be.CANVAS_LAYERS),bufferCanvases:new Array(be.BUFFER_COUNT),bufferContexts:new Array(be.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var o=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,o.position="relative",o.zIndex="0",o.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};yi&&yi.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l"u"?"undefined":Ne(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[Gs,Bn,Xt,bh,en,sr,nt,Qs,lr,xh].forEach(function(e){he(be,e)});var kh=[{type:"layout",extensions:Qd},{type:"renderer",extensions:[{name:"null",impl:Ss},{name:"base",impl:Ys},{name:"canvas",impl:wh}]}],il={},ol={};function sl(e,t,n){var r=n,a=function(S){we("Can not register `"+t+"` for `"+e+"` since `"+S+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(rr.prototype[t])return a(t);rr.prototype[t]=n}else if(e==="collection"){if(Ve.prototype[t])return a(t);Ve.prototype[t]=n}else if(e==="layout"){for(var o=function(S){this.options=S,n.call(this,S),ve(this._private)||(this._private={}),this._private.cy=S.cy,this._private.listeners=[],this.createEmitter()},i=o.prototype=Object.create(n.prototype),s=[],l=0;l!?|\/]/;function k(t,e){var r,n=t.next();if(h[n]){var o=h[n](t,e);if(o!==!1)return o}if(n=='"'||n=="'"||n=="`")return e.tokenize=(r=n,function(w,_){for(var d,s=!1,m=!1;(d=w.next())!=null;){if(d==r&&!s){m=!0;break}s=!s&&d=="\\"}return(m||!s&&!O)&&(_.tokenize=null),"string"}),e.tokenize(t,e);if(/[\[\]{}\(\),;\:\.]/.test(n))return i=n,null;if(/\d/.test(n))return t.eatWhile(/[\w\.]/),"number";if(n=="/"){if(t.eat("+"))return e.tokenize=x,x(t,e);if(t.eat("*"))return e.tokenize=v,v(t,e);if(t.eat("/"))return t.skipToEnd(),"comment"}if(b.test(n))return t.eatWhile(b),"operator";t.eatWhile(/[\w\$_\xa1-\uffff]/);var a=t.current();return I.propertyIsEnumerable(a)?(y.propertyIsEnumerable(a)&&(i="newstatement"),"keyword"):E.propertyIsEnumerable(a)?(y.propertyIsEnumerable(a)&&(i="newstatement"),"builtin"):L.propertyIsEnumerable(a)?"atom":"variable"}function v(t,e){for(var r,n=!1;r=t.next();){if(r=="/"&&n){e.tokenize=null;break}n=r=="*"}return"comment"}function x(t,e){for(var r,n=!1;r=t.next();){if(r=="/"&&n){e.tokenize=null;break}n=r=="+"}return"comment"}function g(t,e,r,n,o){this.indented=t,this.column=e,this.type=r,this.align=n,this.prev=o}function f(t,e,r){var n=t.indented;return t.context&&t.context.type=="statement"&&(n=t.context.indented),t.context=new g(n,e,r,null,t.context)}function u(t){var e=t.context.type;return e!=")"&&e!="]"&&e!="}"||(t.indented=t.context.indented),t.context=t.context.prev}const W={name:"d",startState:function(t){return{tokenize:null,context:new g(-t,0,"top",!1),indented:0,startOfLine:!0}},token:function(t,e){var r=e.context;if(t.sol()&&(r.align==null&&(r.align=!1),e.indented=t.indentation(),e.startOfLine=!0),t.eatSpace())return null;i=null;var n=(e.tokenize||k)(t,e);if(n=="comment"||n=="meta")return n;if(r.align==null&&(r.align=!0),i!=";"&&i!=":"&&i!=","||r.type!="statement")if(i=="{")f(e,t.column(),"}");else if(i=="[")f(e,t.column(),"]");else if(i=="(")f(e,t.column(),")");else if(i=="}"){for(;r.type=="statement";)r=u(e);for(r.type=="}"&&(r=u(e));r.type=="statement";)r=u(e)}else i==r.type?u(e):((r.type=="}"||r.type=="top")&&i!=";"||r.type=="statement"&&i=="newstatement")&&f(e,t.column(),"statement");else u(e);return e.startOfLine=!1,n},indent:function(t,e,r){if(t.tokenize!=k&&t.tokenize!=null)return null;var n=t.context,o=e&&e.charAt(0);n.type=="statement"&&o=="}"&&(n=n.prev);var a=o==n.type;return n.type=="statement"?n.indented+(o=="{"?0:z||r.unit):n.align?n.column+(a?0:1):n.indented+(a?0:r.unit)},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}};export{W as d}; diff --git a/notebooks/assets/dagre-OKDRZEBW-Dzg44g1a.js b/notebooks/assets/dagre-OKDRZEBW-Dzg44g1a.js new file mode 100644 index 0000000000000000000000000000000000000000..8ea9b615b994e68d5a0f112c10e9e635efd44968 --- /dev/null +++ b/notebooks/assets/dagre-OKDRZEBW-Dzg44g1a.js @@ -0,0 +1,4 @@ +import{_ as m,aa as M,ab as L,ac as Y,ad as j,l as i,c as H,ae as _,af as $,$ as q,a4 as z,a0 as O,Y as K,ag as Q,ah as U,ai as V}from"./mermaid-DwRBzUur.js";import{G}from"./graph-B7t7oBoL.js";import{l as W}from"./layout-Ccr18Tcr.js";import{i as x}from"./_baseUniq-CR5yKjUQ.js";import{c as Z}from"./clone-Bj7S21pd.js";import{m as k}from"./min-DbRBnib5.js";import"./index-DgI7bmFZ.js";import"./transform-DetRMEbJ.js";import"./timer-Bqd5yn_a.js";import"./step-BwsUM5iJ.js";import"./_baseEach-DH7Slkql.js";import"./sortBy-YZkl3gUo.js";import"./_baseMap-BJiiBMYV.js";function X(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ee(e),edges:te(e)};return x(e.graph())||(r.value=Z(e.graph())),r}function ee(e){return k(e.nodes(),function(r){var t=e.node(r),o=e.parent(r),d={v:r};return x(t)||(d.value=t),x(o)||(d.parent=o),d})}function te(e){return k(e.edges(),function(r){var t=e.edge(r),o={v:r.v,w:r.w};return x(r.name)||(o.name=r.name),x(t)||(o.value=t),o})}var l=new Map,b=new Map,P=new Map,re=m(()=>{b.clear(),P.clear(),l.clear()},"clear"),D=m((e,r)=>{const t=b.get(r)||[];return i.trace("In isDescendant",r," ",e," = ",t.includes(e)),t.includes(e)},"isDescendant"),ne=m((e,r)=>{const t=b.get(r)||[];return i.info("Descendants of ",r," is ",t),i.info("Edge is ",e),e.v!==r&&e.w!==r&&(t?t.includes(e.v)||D(e.v,r)||D(e.w,r)||t.includes(e.w):(i.debug("Tilt, ",r,",not in descendants"),!1))},"edgeInCluster"),B=m((e,r,t,o)=>{i.warn("Copying children of ",e,"root",o,"data",r.node(e),o);const d=r.children(e)||[];e!==o&&d.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",d),d.forEach(s=>{if(r.children(s).length>0)B(s,r,t,o);else{const a=r.node(s);i.info("cp ",s," to ",o," with parent ",e),t.setNode(s,a),o!==r.parent(s)&&(i.warn("Setting parent",s,r.parent(s)),t.setParent(s,r.parent(s))),e!==o&&s!==e?(i.debug("Setting parent",s,e),t.setParent(s,e)):(i.info("In copy ",e,"root",o,"data",r.node(e),o),i.debug("Not Setting parent for node=",s,"cluster!==rootId",e!==o,"node!==clusterId",s!==e));const c=r.edges(s);i.debug("Copying Edges",c),c.forEach(f=>{i.info("Edge",f);const E=r.edge(f.v,f.w,f.name);i.info("Edge data",E,o);try{ne(f,o)?(i.info("Copying as ",f.v,f.w,E,f.name),t.setEdge(f.v,f.w,E,f.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",f.v,"-->",f.w," rootId: ",o," clusterId:",e)}catch(C){i.error(C)}})}i.debug("Removing node",s),r.removeNode(s)})},"copy"),J=m((e,r)=>{const t=r.children(e);let o=[...t];for(const d of t)P.set(d,e),o=[...o,...J(d,r)];return o},"extractDescendants"),ie=m((e,r,t)=>{const o=e.edges().filter(c=>c.v===r||c.w===r),d=e.edges().filter(c=>c.v===t||c.w===t),s=o.map(c=>({v:c.v===r?t:c.v,w:c.w===r?r:c.w})),a=d.map(c=>({v:c.v,w:c.w}));return s.filter(c=>a.some(f=>c.v===f.v&&c.w===f.w))},"findCommonEdges"),I=m((e,r,t)=>{const o=r.children(e);if(i.trace("Searching children of id ",e,o),o.length<1)return e;let d;for(const s of o){const a=I(s,r,t),c=ie(r,t,a);if(a){if(!(c.length>0))return a;d=a}}return d},"findNonClusterChild"),A=m(e=>l.has(e)&&l.get(e).externalConnections&&l.has(e)?l.get(e).id:e,"getAnchorId"),ae=m((e,r)=>{if(!e||r>10)i.debug("Opting out, no graph ");else{i.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",I(t,e,t)),b.set(t,J(t,e)),l.set(t,{id:I(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){const o=e.children(t),d=e.edges();o.length>0?(i.debug("Cluster identified",t,b),d.forEach(s=>{D(s.v,t)^D(s.w,t)&&(i.warn("Edge: ",s," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",b.get(t)),l.get(t).externalConnections=!0)})):i.debug("Not a cluster ",t,b)});for(let t of l.keys()){const o=l.get(t).id,d=e.parent(o);d!==t&&l.has(d)&&!l.get(d).externalConnections&&(l.get(t).id=d)}e.edges().forEach(function(t){const o=e.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let d=t.v,s=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l.get(t.v)," --- ",l.get(t.w)),l.get(t.v)||l.get(t.w)){if(i.warn("Fixing and trying - removing XXX",t.v,t.w,t.name),d=A(t.v),s=A(t.w),e.removeEdge(t.v,t.w,t.name),d!==t.v){const a=e.parent(d);l.get(a).externalConnections=!0,o.fromCluster=t.v}if(s!==t.w){const a=e.parent(s);l.get(a).externalConnections=!0,o.toCluster=t.w}i.warn("Fix Replacing with XXX",d,s,t.name),e.setEdge(d,s,o,t.name)}}),i.warn("Adjusted Graph",X(e)),T(e,0),i.trace(l)}},"adjustClustersAndEdges"),T=m((e,r)=>{var d,s;if(i.warn("extractor - ",r,X(e),e.children("D")),r>10)return void i.error("Bailing out");let t=e.nodes(),o=!1;for(const a of t){const c=e.children(a);o=o||c.length>0}if(o){i.debug("Nodes = ",t,r);for(const a of t)if(i.debug("Extracting node",a,l,l.has(a)&&!l.get(a).externalConnections,!e.parent(a),e.node(a),e.children("D")," Depth ",r),l.has(a))if(!l.get(a).externalConnections&&e.children(a)&&e.children(a).length>0){i.warn("Cluster without external connections, without a parent and with children",a,r);let c=e.graph().rankdir==="TB"?"LR":"TB";(s=(d=l.get(a))==null?void 0:d.clusterData)!=null&&s.dir&&(c=l.get(a).clusterData.dir,i.warn("Fixing dir",l.get(a).clusterData.dir,c));const f=new G({multigraph:!0,compound:!0}).setGraph({rankdir:c,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",X(e)),B(a,e,f,a),e.setNode(a,{clusterNode:!0,id:a,clusterData:l.get(a).clusterData,label:l.get(a).label,graph:f}),i.warn("New graph after copy node: (",a,")",X(f)),i.debug("Old graph after copy",X(e))}else i.warn("Cluster ** ",a," **not meeting the criteria !externalConnections:",!l.get(a).externalConnections," no parent: ",!e.parent(a)," children ",e.children(a)&&e.children(a).length>0,e.children("D"),r),i.debug(l);else i.debug("Not a cluster",a,r);t=e.nodes(),i.warn("New list of nodes",t);for(const a of t){const c=e.node(a);i.warn(" Now next level",a,c),c!=null&&c.clusterNode&&T(c.graph,r+1)}}else i.debug("Done, no node has children",e.nodes())},"extractor"),R=m((e,r)=>{if(r.length===0)return[];let t=Object.assign([],r);return r.forEach(o=>{const d=e.children(o),s=R(e,d);t=[...t,...s]}),t},"sorter"),oe=m(e=>R(e,e.children()),"sortNodesByHierarchy"),F=m(async(e,r,t,o,d,s)=>{i.warn("Graph in recursive render:XAX",X(r),d);const a=r.graph().rankdir;i.trace("Dir in recursive render - dir:",a);const c=e.insert("g").attr("class","root");r.nodes()?i.info("Recursive render XXX",r.nodes()):i.info("No nodes found for",r),r.edges().length>0&&i.info("Recursive edges",r.edge(r.edges()[0]));const f=c.insert("g").attr("class","clusters"),E=c.insert("g").attr("class","edgePaths"),C=c.insert("g").attr("class","edgeLabels"),p=c.insert("g").attr("class","nodes");await Promise.all(r.nodes().map(async function(g){const n=r.node(g);if(d!==void 0){const h=JSON.parse(JSON.stringify(d.clusterData));i.trace(`Setting data for parent cluster XXX + Node.id = `,g,` + data=`,h.height,` +Parent cluster`,d.height),r.setNode(d.id,h),r.parent(g)||(i.trace("Setting parent",g,d.id),r.setParent(g,d.id,h))}if(i.info("(Insert) Node XXX"+g+": "+JSON.stringify(r.node(g))),n==null?void 0:n.clusterNode){i.info("Cluster identified XBX",g,n.width,r.node(g));const{ranksep:h,nodesep:u}=r.graph();n.graph.setGraph({...n.graph.graph(),ranksep:h+25,nodesep:u});const N=await F(p,n.graph,t,o,r.node(g),s),S=N.elem;_(n,S),n.diff=N.diff||0,i.info("New compound node after recursive render XAX",g,"width",n.width,"height",n.height),$(S,n)}else r.children(g).length>0?(i.trace("Cluster - the non recursive path XBX",g,n.id,n,n.width,"Graph:",r),i.trace(I(n.id,r)),l.set(n.id,{id:I(n.id,r),node:n})):(i.trace("Node - the non recursive path XAX",g,p,r.node(g),a),await q(p,r.node(g),{config:s,dir:a}))})),await m(async()=>{const g=r.edges().map(async function(n){const h=r.edge(n.v,n.w,n.name);i.info("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.info("Edge "+n.v+" -> "+n.w+": ",n," ",JSON.stringify(r.edge(n))),i.info("Fix",l,"ids:",n.v,n.w,"Translating: ",l.get(n.v),l.get(n.w)),await V(C,h)});await Promise.all(g)},"processEdges")(),i.info("Graph before layout:",JSON.stringify(X(r))),i.info("############################################# XXX"),i.info("### Layout ### XXX"),i.info("############################################# XXX"),W(r),i.info("Graph after layout:",JSON.stringify(X(r)));let y=0,{subGraphTitleTotalMargin:v}=z(s);return await Promise.all(oe(r).map(async function(g){var h;const n=r.node(g);if(i.info("Position XBX => "+g+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n==null?void 0:n.clusterNode)n.y+=v,i.info("A tainted cluster node XBX1",g,n.id,n.width,n.height,n.x,n.y,r.parent(g)),l.get(n.id).node=n,O(n);else if(r.children(g).length>0){i.info("A pure cluster node XBX1",g,n.id,n.x,n.y,n.width,n.height,r.parent(g)),n.height+=v,r.node(n.parentId);const u=(n==null?void 0:n.padding)/2||0,N=((h=n==null?void 0:n.labelBBox)==null?void 0:h.height)||0,S=N-u||0;i.debug("OffsetY",S,"labelHeight",N,"halfPadding",u),await K(f,n),l.get(n.id).node=n}else{const u=r.node(n.parentId);n.y+=v/2,i.info("A regular node XBX1 - using the padding",n.id,"parent",n.parentId,n.width,n.height,n.x,n.y,"offsetY",n.offsetY,"parent",u,u==null?void 0:u.offsetY,n),O(n)}})),r.edges().forEach(function(g){const n=r.edge(g);i.info("Edge "+g.v+" -> "+g.w+": "+JSON.stringify(n),n),n.points.forEach(S=>S.y+=v/2);const h=r.node(g.v);var u=r.node(g.w);const N=Q(E,n,l,t,h,u,o);U(n,N)}),r.nodes().forEach(function(g){const n=r.node(g);i.info(g,n.type,n.diff),n.isGroup&&(y=n.diff)}),i.warn("Returning from recursive render XAX",c,y),{elem:c,diff:y}},"recursiveRender"),se=m(async(e,r)=>{var s,a,c,f,E,C;const t=new G({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:((s=e.config)==null?void 0:s.nodeSpacing)||((c=(a=e.config)==null?void 0:a.flowchart)==null?void 0:c.nodeSpacing)||e.nodeSpacing,ranksep:((f=e.config)==null?void 0:f.rankSpacing)||((C=(E=e.config)==null?void 0:E.flowchart)==null?void 0:C.rankSpacing)||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),o=r.select("g");M(o,e.markers,e.type,e.diagramId),L(),Y(),j(),re(),e.nodes.forEach(p=>{t.setNode(p.id,{...p}),p.parentId&&t.setParent(p.id,p.parentId)}),i.debug("Edges:",e.edges),e.edges.forEach(p=>{if(p.start===p.end){const w=p.start,y=w+"---"+w+"---1",v=w+"---"+w+"---2",g=t.node(w);t.setNode(y,{domId:y,id:y,parentId:g.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),t.setParent(y,g.parentId),t.setNode(v,{domId:v,id:v,parentId:g.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),t.setParent(v,g.parentId);const n=structuredClone(p),h=structuredClone(p),u=structuredClone(p);n.label="",n.arrowTypeEnd="none",n.id=w+"-cyclic-special-1",h.arrowTypeStart="none",h.arrowTypeEnd="none",h.id=w+"-cyclic-special-mid",u.label="",g.isGroup&&(n.fromCluster=w,u.toCluster=w),u.id=w+"-cyclic-special-2",u.arrowTypeStart="none",t.setEdge(w,y,n,w+"-cyclic-special-0"),t.setEdge(y,v,h,w+"-cyclic-special-1"),t.setEdge(v,w,u,w+"-cycr.forEach(a=>{if(!l.has(a))return;const h=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming(()=>a(e)):()=>a(e);t?this.dispatchAsync(h):h()}),o=this.getListeners(i,t,!1)??new Set,n=new Set(o);n.size>0&&s(n,o),new Set(t?this.globalAsyncListeners:this.globalSyncListeners).forEach(r=>{const l=this.frameworkOverrides?()=>this.frameworkOverrides.wrapIncoming(()=>r(i,e)):()=>r(i,e);t?this.dispatchAsync(l):l()})}dispatchAsync(e){if(this.asyncFunctionsQueue.push(e),!this.scheduled){const t=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)};this.frameworkOverrides?this.frameworkOverrides.wrapIncoming(t):t(),this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;const e=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[],e.forEach(t=>t())}},Oo=(e=>(e.CommunityCoreModule="@ag-grid-community/core",e.InfiniteRowModelModule="@ag-grid-community/infinite-row-model",e.ClientSideRowModelModule="@ag-grid-community/client-side-row-model",e.CsvExportModule="@ag-grid-community/csv-export",e.EnterpriseCoreModule="@ag-grid-enterprise/core",e.RowGroupingModule="@ag-grid-enterprise/row-grouping",e.ColumnsToolPanelModule="@ag-grid-enterprise/column-tool-panel",e.FiltersToolPanelModule="@ag-grid-enterprise/filter-tool-panel",e.MenuModule="@ag-grid-enterprise/menu",e.SetFilterModule="@ag-grid-enterprise/set-filter",e.MultiFilterModule="@ag-grid-enterprise/multi-filter",e.StatusBarModule="@ag-grid-enterprise/status-bar",e.SideBarModule="@ag-grid-enterprise/side-bar",e.RangeSelectionModule="@ag-grid-enterprise/range-selection",e.MasterDetailModule="@ag-grid-enterprise/master-detail",e.RichSelectModule="@ag-grid-enterprise/rich-select",e.GridChartsModule="@ag-grid-enterprise/charts",e.ViewportRowModelModule="@ag-grid-enterprise/viewport-row-model",e.ServerSideRowModelModule="@ag-grid-enterprise/server-side-row-model",e.ExcelExportModule="@ag-grid-enterprise/excel-export",e.ClipboardModule="@ag-grid-enterprise/clipboard",e.SparklinesModule="@ag-grid-enterprise/sparklines",e.AdvancedFilterModule="@ag-grid-enterprise/advanced-filter",e.AngularModule="@ag-grid-community/angular",e.ReactModule="@ag-grid-community/react",e.VueModule="@ag-grid-community/vue",e))(Oo||{}),Go={};function as(e,t){Go[t]||(e(),Go[t]=!0)}function He(e,...t){console.log("AG Grid: "+e,...t)}function R(e,...t){as(()=>console.warn("AG Grid: "+e,...t),e+(t==null?void 0:t.join("")))}function Q(e,...t){as(()=>console.error("AG Grid: "+e,...t),e+(t==null?void 0:t.join("")))}function hs(e){return!!(e&&e.constructor&&e.call&&e.apply)}function Rl(e){(function(t,i=0){t.length>0&&window.setTimeout(()=>t.forEach(s=>s()),i)})(e,400)}var ds=[],cs=!1;function No(e){ds.push(e),cs||(cs=!0,window.setTimeout(()=>{const t=ds.slice();ds.length=0,cs=!1,t.forEach(i=>i())},0))}function Se(e,t){let i;return function(...s){const o=this;window.clearTimeout(i),i=window.setTimeout(function(){e.apply(o,s)},t)}}function Ho(e,t){let i=0;return function(...s){const o=new Date().getTime();o-il?1:rt.push(i)),t}return Object.values(e)}function Bo(e,t){return e.get("rowModelType")===t}function ie(e){return Bo(e,"clientSide")}function Ke(e){return Bo(e,"serverSide")}function Ce(e,t){return e.get("domLayout")===t}function xi(e){return ki(e)!==void 0}function Ai(e){return!e.get("suppressAsyncEvents")}function Vo(e){return typeof e.get("getRowHeight")=="function"}function lt(e,t,i=!1,s){if(s==null&&(s=e.environment.getDefaultRowHeight()),Vo(e)){if(i)return{height:s,estimated:!0};const n={node:t,data:t.data},r=e.getCallback("getRowHeight")(n);if(ms(r))return r===0&&R("The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead."),{height:Math.max(1,r),estimated:!1}}if(t.detail&&e.get("masterDetail"))return function(n){if(n.get("detailRowAutoHeight"))return{height:1,estimated:!1};const r=n.get("detailRowHeight");return ms(r)?{height:r,estimated:!1}:{height:300,estimated:!1}}(e);const o=e.get("rowHeight");return{height:o&&ms(o)?o:s,estimated:!1}}function vt(e){const{environment:t}=e,i=e.get("rowHeight");if(!i||K(i))return t.getDefaultRowHeight();const s=t.refreshRowHeightVariable();return s!==-1?s:(R("row height must be a number if not using standard row model"),t.getDefaultRowHeight())}function ms(e){return!isNaN(e)&&typeof e=="number"&&isFinite(e)}function si(e,t,i){const s=t[e.getDomDataKey()];return s?s[i]:void 0}function wt(e,t,i,s){const o=e.getDomDataKey();let n=t[o];K(n)&&(n={},t[o]=n),n[i]=s}function ae(e){let t=null;const i=e.get("getDocument");return i&&M(i)?t=i():e.eGridDiv&&(t=e.eGridDiv.ownerDocument),t&&M(t)?t:document}function Wo(e){return ae(e).defaultView||window}function oi(e){return e.eGridDiv.getRootNode()}function re(e){return oi(e).activeElement}function zo(e){const t=ae(e),i=re(e);return i===null||i===t.body}function Gt(e){return!e.get("ensureDomOrder")&&e.get("animateRows")}function Ti(e){return!(e.get("paginateChildRows")||e.get("groupHideOpenParents")||Ce(e,"print"))}function $e(e){const t=e.get("autoGroupColumnDef");return!(t!=null&&t.comparator)&&!e.get("treeData")}function Cs(e){const t=e.get("groupAggFiltering");return typeof t=="function"?e.getCallback("groupAggFiltering"):t===!0?()=>!0:void 0}function Uo(e){const t=e.get("grandTotalRow");return t||(e.get("groupIncludeTotalFooter")?"bottom":void 0)}function Ko(e){const t=e.get("groupTotalRow");if(typeof t=="function")return e.getCallback("groupTotalRow");if(t)return()=>t;const i=e.get("groupIncludeFooter");if(typeof i=="function"){const s=e.getCallback("groupIncludeFooter");return o=>s(o)?"bottom":void 0}return()=>i?"bottom":void 0}function $o(e){return e.exists("groupDisplayType")?e.get("groupDisplayType")==="multipleColumns":e.get("groupHideOpenParents")}function Ii(e,t){return!t&&e.get("groupDisplayType")==="groupRows"}function Nt(e){const t=e.getCallback("getRowId");return t===void 0?t:i=>{let s=t(i);return typeof s!="string"&&(R("The getRowId callback must return a string. The ID ",s," is being cast to a string."),s=String(s)),s}}function Ht(e){return(e==null?void 0:e.checkboxes)??!0}function Li(e){return(e==null?void 0:e.mode)==="multiRow"&&(e.headerCheckbox??!0)}function Ze(e){const t=e.get("cellSelection");return t!==void 0?!!t:e.get("enableRangeSelection")}function _o(e){var i;const t=e.get("cellSelection");return t!==void 0?typeof t!="boolean"&&((i=t.handle)==null?void 0:i.mode)==="fill":e.get("enableFillHandle")}function jo(e){const t=e.get("rowSelection")??"single";if(typeof t=="string"){const i=e.get("suppressRowClickSelection"),s=e.get("suppressRowDeselection");return(!i||!s)&&(i?"enableDeselection":!s||"enableSelection")}return(t.mode==="singleRow"||t.mode==="multiRow")&&(t.enableClickSelection??!1)}function qo(e){const t=jo(e);return t===!0||t==="enableDeselection"}function fs(e){const t=e.get("rowSelection");return typeof t=="string"?e.get("isRowSelectable"):t==null?void 0:t.isRowSelectable}function ki(e){const t=e.get("rowSelection");if(typeof t=="string")switch(t){case"multiple":return"multiRow";case"single":return"singleRow";default:return}return t==null?void 0:t.mode}function Qo(e){return ki(e)==="multiRow"}function vs(e){const t=e.get("rowSelection");if(typeof t=="string"){const i=e.get("groupSelectsChildren"),s=e.get("groupSelectsFiltered");return i&&s?"filteredDescendants":i?"descendants":"self"}return(t==null?void 0:t.mode)==="multiRow"?t.groupSelects:void 0}function St(e){const t=vs(e);return t==="descendants"||t==="filteredDescendants"}function ws(e){return e.isModuleRegistered("@ag-grid-enterprise/set-filter")&&!e.get("suppressSetFilterByDefault")}function $(e){if(e&&e.length)return e[e.length-1]}function at(e,t,i){return e==null&&t==null||e!=null&&t!=null&&e.length===t.length&&e.every((s,o)=>i?i(s,t[o]):t[o]===s)}function Yo(e,t){const i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],e.pop())}function ye(e,t){const i=e.indexOf(t);i>=0&&e.splice(i,1)}function Oi(e,t,i){e.splice(i,0,t)}function Xo(e,t,i){(function(s,o){for(let n=0;nOi(e,s,i))}function yt(e,t){return e.indexOf(t)>-1}function Pl(e){return(e==null?void 0:e.flatMap(t=>t))??[]}function Jo(e,t){t!=null&&e!=null&&t.forEach(i=>e.push(i))}var Zo="__ag_Grid_Stop_Propagation",Dl=["touchstart","touchend","touchmove","touchcancel","scroll"],Ss={};function Bt(e){e[Zo]=!0}function et(e){return e[Zo]===!0}var en=(()=>{const e={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return t=>{if(typeof Ss[t]=="boolean")return Ss[t];const i=document.createElement(e[t]||"div");return Ss[t="on"+t]=t in i}})();function ys(e,t,i){let s=t;for(;s;){const o=si(e,s,i);if(o)return o;s=s.parentElement}return null}function El(e,t){return!(!t||!e)&&function(i){const s=i;return s.path?s.path:s.composedPath?s.composedPath():function(o){const n=[];let r=o.target;for(;r;)n.push(r),r=r.parentElement;return n}(s)}(t).indexOf(e)>=0}var b=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans(e){this.frameworkOverrides=e.frameworkOverrides,this.stubContext=e.context,this.eventService=e.eventService,this.gos=e.gos,this.localeService=e.localeService}getFrameworkOverrides(){return this.frameworkOverrides}destroy(){for(let e=0;enull;e instanceof HTMLElement?function(o,n,r,l){const a=yt(Dl,r)?{passive:!0}:void 0;o&&o.addEventListener&&o.addEventListener(n,r,l,a)}(this.getFrameworkOverrides(),e,t,i):e.addEventListener(t,i);const s=()=>(e.removeEventListener(t,i),null);return this.destroyFunctions.push(s),()=>(s(),this.destroyFunctions=this.destroyFunctions.filter(o=>o!==s),null)}setupGridOptionListener(e,t){this.gos.addPropertyEventListener(e,t);const i=()=>(this.gos.removePropertyEventListener(e,t),null);return this.destroyFunctions.push(i),()=>(i(),this.destroyFunctions=this.destroyFunctions.filter(s=>s!==i),null)}addManagedPropertyListener(e,t){return this.destroyed?()=>null:this.setupGridOptionListener(e,t)}addManagedPropertyListeners(e,t){if(this.destroyed)return;const i=e.join("-")+this.propertyListenerId++,s=o=>{if(o.changeSet){if(o.changeSet&&o.changeSet.id===this.lastChangeSetIdLookup[i])return;this.lastChangeSetIdLookup[i]=o.changeSet.id}const n={type:"gridPropertyChanged",changeSet:o.changeSet,source:o.source};t(n)};e.forEach(o=>this.setupGridOptionListener(o,s))}addDestroyFunc(e){this.isAlive()?this.destroyFunctions.push(e):e()}createManagedBean(e,t){const i=this.createBean(e,t);return this.addDestroyFunc(this.destroyBean.bind(this,e,t)),i}createBean(e,t,i){return(t||this.stubContext).createBean(e,i)}destroyBean(e,t){return(t||this.stubContext).destroyBean(e)}destroyBeans(e,t){return(t||this.stubContext).destroyBeans(e)}};function be(e){return e instanceof Gi}var Gi=class extends b{constructor(e,t,i,s){super(),this.isColumn=!1,this.expandable=!1,this.instanceId=on(),this.expandableListenerRemoveCallback=null,this.colGroupDef=e,this.groupId=t,this.expanded=!!e&&!!e.openByDefault,this.padding=i,this.level=s}destroy(){this.expandableListenerRemoveCallback&&this.reset(null,void 0),super.destroy()}reset(e,t){this.colGroupDef=e,this.level=t,this.originalParent=null,this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback(),this.children=void 0,this.expandable=void 0}getInstanceId(){return this.instanceId}setOriginalParent(e){this.originalParent=e}getOriginalParent(){return this.originalParent}getLevel(){return this.level}isVisible(){return!!this.children&&this.children.some(e=>e.isVisible())}isPadding(){return this.padding}setExpanded(e){this.expanded=e!==void 0&&e,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren(e){this.children=e}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}addLeafColumns(e){this.children&&this.children.forEach(t=>{dt(t)?e.push(t):be(t)&&t.addLeafColumns(e)})}getColumnGroupShow(){const e=this.colGroupDef;if(e)return e.columnGroupShow}setupExpandable(){this.setExpandable(),this.expandableListenerRemoveCallback&&this.expandableListenerRemoveCallback();const e=this.onColumnVisibilityChanged.bind(this);this.getLeafColumns().forEach(t=>t.addEventListener("visibleChanged",e)),this.expandableListenerRemoveCallback=()=>{this.getLeafColumns().forEach(t=>t.removeEventListener("visibleChanged",e)),this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let e=!1,t=!1,i=!1;const s=this.findChildrenRemovingPadding();for(let n=0,r=s.length;n{i.forEach(s=>{be(s)&&s.isPadding()?t(s.children):e.push(s)})};return t(this.children),e}onColumnVisibilityChanged(){this.setExpandable()}},tn="ag-Grid-ControlsColumn",Ml=class extends b{constructor(){super(...arguments),this.beanName="controlsColService"}createControlsCols(){const{gos:e}=this,t=e.get("rowSelection");if(!t||typeof t!="object")return[];const i=Ht(t),s=Li(t);if(i||s){const o=e.get("selectionColumnDef"),n={maxWidth:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:e.get("enableRtl")?"right":"left",comparator(l,a,h,d){const c=h.isSelected(),u=d.isSelected();return c&&u?0:c?1:-1},editable:!1,suppressFillHandle:!0,...o,colId:`${tn}`},r=new xs(n,null,n.colId,!1);return this.createBean(r),[r]}return[]}},Ni="ag-Grid-AutoColumn";function bs(e){const t=[],i=s=>{for(let o=0;ot+i.getActualWidth(),0)}function ht(e,t,i){const s={};if(!t)return;it(null,t,n=>{s[n.getInstanceId()]=n}),i&&it(null,i,n=>{s[n.getInstanceId()]=null});const o=Object.values(s).filter(n=>n!=null);e.destroyBeans(o)}function Rs(e){return e.getId().startsWith(Ni)}function ni(e){return e.getColId().startsWith(tn)}function Hi(e){let t=[];return e instanceof Array?e.some(i=>typeof i!="string")?R("if colDef.type is supplied an array it should be of type 'string[]'"):t=e:typeof e=="string"?t=e.split(","):R("colDef.type should be of type 'string' | 'string[]'"),t}var Fs=class{constructor(e){this.frameworkOverrides=e,this.wrappedListeners=new Map,this.wrappedGlobalListeners=new Map}wrap(e,t){const{frameworkOverrides:i,wrappedListeners:s}=this;let o=t;if(i.shouldWrapOutgoing){o=r=>{i.wrapOutgoing(()=>t(r))};let n=s.get(e);n||(n=new Map,s.set(e,n)),n.set(t,o)}return o}wrapGlobal(e){const{frameworkOverrides:t,wrappedGlobalListeners:i}=this;let s=e;return t.shouldWrapOutgoing&&(s=(o,n)=>{t.wrapOutgoing(()=>e(o,n))},i.set(e,s)),s}unwrap(e,t){const{wrappedListeners:i}=this,s=i.get(e);if(s){const o=s.get(t);if(o)return s.delete(t),s.size===0&&i.delete(e),o}return t}unwrapGlobal(e){const{wrappedGlobalListeners:t}=this,i=t.get(e);return i?(t.delete(e),i):e}},Ps=new Set(["__proto__","constructor","prototype"]);function Be(e,t){if(e!=null)if(Array.isArray(e))for(let i=0;i{if(t&&t.indexOf(o)>=0||Ps.has(o))return;const n=i[o],r=Ms(n)&&n.constructor===Object;s[o]=r?Ds(n):n}),s}function Es(e){if(!e)return[];const t=Object;if(typeof t.values=="function")return t.values(e);const i=[];for(const s in e)e.hasOwnProperty(s)&&e.propertyIsEnumerable(s)&&i.push(e[s]);return i}function Re(e,t,i=!0,s=!1){M(t)&&Be(t,(o,n)=>{if(Ps.has(o))return;let r=e[o];r!==n&&(s&&r==null&&n!=null&&typeof n=="object"&&n.constructor===Object&&(r={},e[o]=r),Ms(n)&&Ms(r)&&!Array.isArray(r)?Re(r,n,i,s):(i||n!==void 0)&&(e[o]=n))})}function ri(e,t,i){if(!t||!e)return;if(!i)return e[t];const s=t.split(".");let o=e;for(let n=0;n=0&&!e,this.tooltipFieldContainsDots=M(this.colDef.tooltipField)&&this.colDef.tooltipField.indexOf(".")>=0&&!e}initMinAndMaxWidths(){const e=this.colDef;this.minWidth=e.minWidth??this.gos.environment.getDefaultColumnMinWidth(),this.maxWidth=e.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.tooltipEnabled=M(this.colDef.tooltipField)||M(this.colDef.tooltipValueGetter)||M(this.colDef.tooltipComponent)}resetActualWidth(e){const t=this.calculateColInitialWidth(this.colDef);this.setActualWidth(t,e,!0)}calculateColInitialWidth(e){let t;const i=ft(e.width),s=ft(e.initialWidth);return t=i??s??200,Math.max(Math.min(t,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed(e){if(K(this.colDef)||K(this.colDef.showRowGroup))return!1;const t=this.colDef.showRowGroup===!0,i=this.colDef.showRowGroup===e;return t||i}isPrimary(){return this.primary}isFilterAllowed(){return!!this.colDef.filter}isFieldContainsDots(){return this.fieldContainsDots}isTooltipEnabled(){return this.tooltipEnabled}isTooltipFieldContainsDots(){return this.tooltipFieldContainsDots}getHighlighted(){return this.highlighted}addEventListener(e,t){var s;this.frameworkOverrides.shouldWrapOutgoing&&!this.frameworkEventListenerService&&(this.columnEventService.setFrameworkOverrides(this.frameworkOverrides),this.frameworkEventListenerService=new Fs(this.frameworkOverrides));const i=((s=this.frameworkEventListenerService)==null?void 0:s.wrap(e,t))??t;this.columnEventService.addEventListener(e,i)}removeEventListener(e,t){var s;const i=((s=this.frameworkEventListenerService)==null?void 0:s.unwrap(e,t))??t;this.columnEventService.removeEventListener(e,i)}createColumnFunctionCallbackParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,column:this,colDef:this.colDef})}isSuppressNavigable(e){if(typeof this.colDef.suppressNavigable=="boolean")return this.colDef.suppressNavigable;if(typeof this.colDef.suppressNavigable=="function"){const t=this.createColumnFunctionCallbackParams(e);return(0,this.colDef.suppressNavigable)(t)}return!1}isCellEditable(e){if(e.group){if(this.gos.get("treeData")){if(!e.data&&!this.gos.get("enableGroupEdit"))return!1}else if(!this.gos.get("enableGroupEdit"))return!1}return this.isColumnFunc(e,this.colDef.editable)}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag(e){return this.isColumnFunc(e,this.colDef.rowDrag)}isDndSource(e){return this.isColumnFunc(e,this.colDef.dndSource)}isCellCheckboxSelection(e){const t=this.gos.get("rowSelection");if(t&&typeof t!="string"){const i=ni(this)&&Ht(t);return this.isColumnFunc(e,i)}return this.isColumnFunc(e,this.colDef.checkboxSelection)}isSuppressPaste(e){return this.isColumnFunc(e,this.colDef?this.colDef.suppressPaste:null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue(e){return this.colDef[e]??xl[e]}isColumnFunc(e,t){return typeof t=="boolean"?t:typeof t=="function"?t(this.createColumnFunctionCallbackParams(e)):!1}setHighlighted(e){this.highlighted!==e&&(this.highlighted=e,this.columnEventService.dispatchEvent(this.createColumnEvent("headerHighlightChanged","uiColumnMoved")))}setMoving(e,t){this.moving=e,this.columnEventService.dispatchEvent(this.createColumnEvent("movingChanged",t))}createColumnEvent(e,t){return this.gos.addGridCommonParams({type:e,column:this,columns:[this],source:t})}isMoving(){return this.moving}getSort(){return this.sort}setSort(e,t){this.sort!==e&&(this.sort=e,this.columnEventService.dispatchEvent(this.createColumnEvent("sortChanged",t))),this.dispatchStateUpdatedEvent("sort")}isSortable(){return!!this.getColDefValue("sortable")}isSortAscending(){return this.sort==="asc"}isSortDescending(){return this.sort==="desc"}isSortNone(){return K(this.sort)}isSorting(){return M(this.sort)}getSortIndex(){return this.sortIndex}setSortIndex(e){this.sortIndex=e,this.dispatchStateUpdatedEvent("sortIndex")}setMenuVisible(e,t){this.menuVisible!==e&&(this.menuVisible=e,this.columnEventService.dispatchEvent(this.createColumnEvent("menuVisibleChanged",t)))}isMenuVisible(){return this.menuVisible}setAggFunc(e){this.aggFunc=e,this.dispatchStateUpdatedEvent("aggFunc")}getAggFunc(){return this.aggFunc}getLeft(){return this.left}getOldLeft(){return this.oldLeft}getRight(){return this.left+this.actualWidth}setLeft(e,t){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.columnEventService.dispatchEvent(this.createColumnEvent("leftChanged",t)))}isFilterActive(){return this.filterActive}setFilterActive(e,t,i){this.filterActive!==e&&(this.filterActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("filterActiveChanged",t)));const s=this.createColumnEvent("filterChanged",t);i&&Re(s,i),this.columnEventService.dispatchEvent(s)}isHovered(){return this.columnHoverService.isHovered(this)}setPinned(e){this.pinned=e===!0||e==="left"?"left":e==="right"?"right":null,this.dispatchStateUpdatedEvent("pinned")}setFirstRightPinned(e,t){this.firstRightPinned!==e&&(this.firstRightPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("firstRightPinnedChanged",t)))}setLastLeftPinned(e,t){this.lastLeftPinned!==e&&(this.lastLeftPinned=e,this.columnEventService.dispatchEvent(this.createColumnEvent("lastLeftPinnedChanged",t)))}isFirstRightPinned(){return this.firstRightPinned}isLastLeftPinned(){return this.lastLeftPinned}isPinned(){return this.pinned==="left"||this.pinned==="right"}isPinnedLeft(){return this.pinned==="left"}isPinnedRight(){return this.pinned==="right"}getPinned(){return this.pinned}setVisible(e,t){const i=e===!0;this.visible!==i&&(this.visible=i,this.columnEventService.dispatchEvent(this.createColumnEvent("visibleChanged",t))),this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getColumnGroupPaddingInfo(){let e=this.getParent();if(!e||!e.isPadding())return{numberOfParents:0,isSpanningTotal:!1};const t=e.getPaddingLevel()+1;let i=!0;for(;e;){if(!e.isPadding()){i=!1;break}e=e.getParent()}return{numberOfParents:t,isSpanningTotal:i}}getColDef(){return this.colDef}getDefinition(){return this.colDef}getColumnGroupShow(){return this.colDef.columnGroupShow}getColId(){return this.colId}getId(){return this.colId}getUniqueId(){return this.colId}getActualWidth(){return this.actualWidth}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}createBaseColDefParams(e){return this.gos.addGridCommonParams({node:e,data:e.data,colDef:this.colDef,column:this})}getColSpan(e){if(K(this.colDef.colSpan))return 1;const t=this.createBaseColDefParams(e),i=this.colDef.colSpan(t);return Math.max(i,1)}getRowSpan(e){if(K(this.colDef.rowSpan))return 1;const t=this.createBaseColDefParams(e),i=this.colDef.rowSpan(t);return Math.max(i,1)}setActualWidth(e,t,i=!1){e=Math.max(e,this.minWidth),e=Math.min(e,this.maxWidth),this.actualWidth!==e&&(this.actualWidth=e,this.flex&&t!=="flex"&&t!=="gridInitializing"&&(this.flex=null),i||this.fireColumnWidthChangedEvent(t)),this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent(e){this.columnEventService.dispatchEvent(this.createColumnEvent("widthChanged",e))}isGreaterThanMax(e){return e>this.maxWidth}getMinWidth(){return this.minWidth}getMaxWidth(){return this.maxWidth}getFlex(){return this.flex||0}setFlex(e){this.flex!==e&&(this.flex=e),this.dispatchStateUpdatedEvent("flex")}setMinimum(e){this.setActualWidth(this.minWidth,e)}setRowGroupActive(e,t){this.rowGroupActive!==e&&(this.rowGroupActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnRowGroupChanged",t))),this.dispatchStateUpdatedEvent("rowGroup")}isRowGroupActive(){return this.rowGroupActive}setPivotActive(e,t){this.pivotActive!==e&&(this.pivotActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnPivotChanged",t))),this.dispatchStateUpdatedEvent("pivot")}isPivotActive(){return this.pivotActive}isAnyFunctionActive(){return this.isPivotActive()||this.isRowGroupActive()||this.isValueActive()}isAnyFunctionAllowed(){return this.isAllowPivot()||this.isAllowRowGroup()||this.isAllowValue()}setValueActive(e,t){this.aggregationActive!==e&&(this.aggregationActive=e,this.columnEventService.dispatchEvent(this.createColumnEvent("columnValueChanged",t)))}isValueActive(){return this.aggregationActive}isAllowPivot(){return this.colDef.enablePivot===!0}isAllowValue(){return this.colDef.enableValue===!0}isAllowRowGroup(){return this.colDef.enableRowGroup===!0}dispatchStateUpdatedEvent(e){this.columnEventService.dispatchEvent({type:"columnStateUpdated",key:e})}},Tl={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}},Il=class{constructor(){this.existingKeys={}}addExistingKeys(e){for(let t=0;t{be(c)&&c.setupExpandable(),c.setOriginalParent(u)}),{columnTree:d,treeDept:h}}extractExistingTreeData(e){const t=[],i=[],s=[];return e&&it(null,e,o=>{if(be(o)){const n=o;i.push(n)}else{const n=o;s.push(n.getId()),t.push(n)}}),{existingCols:t,existingGroups:i,existingColKeys:s}}balanceTreeForAutoCols(e,t){const i=[],s=this.findDepth(t);return e.forEach(o=>{let n=o;for(let r=s-1;r>=0;r--){const l=new Gi(null,`FAKE_PATH_${o.getId()}}_${r}`,!0,r);this.createBean(l),l.setChildren([n]),n.setOriginalParent(l),n=l}s===0&&o.setOriginalParent(null),i.push(n)}),[i,s]}findDepth(e){let t=0,i=e;for(;i&&i[0]&&be(i[0]);)t++,i=i[0].getChildren();return t}balanceColumnTree(e,t,i,s){const o=[];for(let n=0;n=t;h--){const d=s.getUniqueKey(null,null),c=this.createMergedColGroupDef(null),u=new Gi(c,d,!0,t);this.createBean(u),a&&a.setChildren([u]),a=u,l||(l=a)}if(l&&a){if(o.push(l),e.some(h=>be(h))){a.setChildren([r]);continue}a.setChildren(e);break}o.push(r)}}return o}findMaxDept(e,t){let i=t;for(let s=0;s{s in i?R(`the column type '${s}' is a default column type and cannot be overridden.`):(o.type&&R("Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type."),i[s]=o)}),e.forEach(s=>{const o=i[s.trim()];o?Re(t,o,!1,!0):R("colDef.type '"+s+"' does not correspond to defined gridOptions.columnTypes")})}isColumnGroup(e){return e.children!==void 0}};function it(e,t,i){if(t)for(let s=0;sthis.refreshAll(bt(t.source))),this.addManagedPropertyListener("rowSelection",t=>{this.onSelectionOptionsChanged(t.currentValue,t.previousValue,bt(t.source))}),this.addManagedPropertyListener("autoGroupColumnDef",t=>this.onAutoGroupColumnDefChanged(bt(t.source))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],t=>this.recreateColumnDefs(bt(t.source))),this.addManagedPropertyListener("pivotMode",t=>this.setPivotMode(this.gos.get("pivotMode"),bt(t.source))),this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered()})}createColsFromColDefs(e){var h,d,c;const t=this.colDefs?this.columnApplyStateService.compareColumnStatesAndDispatchEvents(e):void 0;this.valueCache.expire();const i=(h=this.colDefCols)==null?void 0:h.list,s=(d=this.colDefCols)==null?void 0:d.tree,o=this.columnFactory.createColumnTree(this.colDefs,!0,s,e);ht(this.context,(c=this.colDefCols)==null?void 0:c.tree,o.columnTree);const n=o.columnTree,r=o.treeDept,l=bs(n),a={};l.forEach(u=>a[u.getId()]=u),this.colDefCols={tree:n,treeDepth:r,list:l,map:a},this.funcColsService.extractCols(e,i),this.ready=!0,this.refreshCols(!0),this.visibleColsService.refresh(e),this.columnViewportService.checkViewportColumns(),this.eventDispatcher.everythingChanged(e),t&&(this.changeEventsDispatching=!0,t(),this.changeEventsDispatching=!1),this.eventDispatcher.newColumnsLoaded(e),e==="gridInitializing"&&this.columnSizeService.applyAutosizeStrategy()}refreshCols(e){var o,n,r;if(!this.colDefCols)return;const t=(o=this.cols)==null?void 0:o.tree;this.saveColOrder(),this.selectCols(),this.createAutoCols(),this.addAutoCols(),this.createControlsCols(),this.addControlsCols();const i=(s=this.gos,this.showingPivotResult?!s.get("enableStrictPivotColumnOrder"):s.get("maintainColumnOrder"));var s;e&&!i||this.restoreColOrder(),this.positionLockedCols(),(n=this.showRowGroupColsService)==null||n.refresh(),(r=this.quickFilterService)==null||r.refreshQuickFilterCols(),this.setColSpanActive(),this.setAutoHeightActive(),this.visibleColsService.clear(),this.columnViewportService.clear(),!at(t,this.cols.tree)&&this.eventDispatcher.gridColumns()}selectCols(){const e=this.pivotResultColsService.getPivotResultCols();if(this.showingPivotResult=e!=null,e){const{map:t,list:i,tree:s,treeDepth:o}=e;this.cols={list:i.slice(),map:{...t},tree:s.slice(),treeDepth:o},e.list.some(n=>{var r;return((r=this.cols)==null?void 0:r.map[n.getColId()])!==void 0})||(this.lastPivotOrder=null)}else{const{map:t,list:i,tree:s,treeDepth:o}=this.colDefCols;this.cols={list:i.slice(),map:{...t},tree:s.slice(),treeDepth:o}}}getColsToShow(){const e=this.isPivotMode()&&!this.isShowingPivotResult(),t=this.funcColsService.getValueColumns();return this.cols.list.filter(i=>{const s=Rs(i);if(e){const o=t&&yt(t,i);return s||o}return s||i.isVisible()})}addAutoCols(){this.autoCols!=null&&(this.cols.list=this.autoCols.list.concat(this.cols.list),this.cols.tree=this.autoCols.tree.concat(this.cols.tree),nn(this.cols))}createAutoCols(){var c;const e=Ii(this.gos,this.pivotMode),t=this.pivotMode?this.gos.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),i=this.funcColsService.getRowGroupColumns(),s=()=>{this.autoCols&&(ht(this.context,this.autoCols.tree),this.autoCols=null)};if(!(i.length>0||this.gos.get("treeData"))||t||e||!this.autoColService)return void s();const o=this.autoColService.createAutoCols(i)??[],n=ln(o,((c=this.autoCols)==null?void 0:c.list)||null),r=this.cols.treeDepth,l=this.autoCols?this.autoCols.treeDepth:-1;if(n&&l==r)return;s();const[a,h]=this.columnFactory.balanceTreeForAutoCols(o,this.cols.tree);this.autoCols={list:o,tree:a,treeDepth:h,map:{}};const d=u=>{if(!u)return null;const g=u.filter(m=>!Rs(m));return[...o,...g]};this.lastOrder=d(this.lastOrder),this.lastPivotOrder=d(this.lastPivotOrder)}createControlsCols(){var l,a,h;const e=()=>{var d;ht(this.context,(d=this.controlsCols)==null?void 0:d.tree),this.controlsCols=null};this.controlsColService||e();const t=this.cols.treeDepth,i=(((l=this.controlsCols)==null?void 0:l.treeDepth)??-1)==t,s=((a=this.controlsColService)==null?void 0:a.createControlsCols())??[];if(ln(s,((h=this.controlsCols)==null?void 0:h.list)??[])&&i)return;e();const[o,n]=this.columnFactory.balanceTreeForAutoCols(s,this.cols.tree);this.controlsCols={list:s,tree:o,treeDepth:n,map:{}};const r=d=>{if(!d)return null;const c=d.filter(u=>!ni(u));return[...s,...c]};this.lastOrder=r(this.lastOrder),this.lastPivotOrder=r(this.lastPivotOrder)}addControlsCols(){this.controlsCols!=null&&(this.cols.list=this.controlsCols.list.concat(this.cols.list),this.cols.tree=this.controlsCols.tree.concat(this.cols.tree),nn(this.cols))}refreshAll(e){this.isReady()&&(this.refreshCols(!1),this.visibleColsService.refresh(e))}setColsVisible(e,t=!1,i){this.columnApplyStateService.applyColumnState({state:e.map(s=>({colId:typeof s=="string"?s:s.getColId(),hide:!t}))},i)}setColsPinned(e,t,i){if(!this.cols||Me(e))return;if(Ce(this.gos,"print"))return void R("Changing the column pinning status is not allowed with domLayout='print'");let s;this.columnAnimationService.start(),s=t===!0||t==="left"?"left":t==="right"?"right":null;const o=[];e.forEach(n=>{if(!n)return;const r=this.getCol(n);r&&r.getPinned()!==s&&(r.setPinned(s),o.push(r))}),o.length&&(this.visibleColsService.refresh(i),this.eventDispatcher.columnPinned(o,i)),this.columnAnimationService.finish()}setColumnGroupOpened(e,t,i){let s;s=be(e)?e.getId():e||"",this.columnGroupStateService.setColumnGroupState([{groupId:s,open:t}],i)}getProvidedColGroup(e){var i;let t=null;return it(null,(i=this.cols)==null?void 0:i.tree,s=>{be(s)&&s.getId()===e&&(t=s)}),t}isColGroupLocked(e){const t=this.gos.get("groupLockGroupColumns");return!e.isRowGroupActive()||t===0?!1:t===-1?!0:t>this.funcColsService.getRowGroupColumns().findIndex(i=>i.getColId()===e.getColId())}isSuppressAutoCol(){return this.gos.get("groupDisplayType")==="custom"?!0:this.gos.get("treeDataDisplayType")==="custom"}setAutoHeightActive(){this.autoHeightActive=this.cols.list.some(e=>e.isVisible()&&e.isAutoHeight()),this.autoHeightActive&&(this.autoHeightActiveAtLeastOnce=!0,ie(this.gos)||Ke(this.gos)||R("autoHeight columns only work with Client Side Row Model and Server Side Row Model."))}restoreColOrder(){const e=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!e)return;const t=new Map(e.map((l,a)=>[l,a]));if(!this.cols.list.some(l=>t.has(l)))return;const i=new Map(this.cols.list.map(l=>[l,!0])),s=e.filter(l=>i.has(l)),o=new Map(s.map(l=>[l,!0])),n=this.cols.list.filter(l=>!o.has(l)),r=s.slice();n.forEach(l=>{let a=l.getOriginalParent();if(!a)return void r.push(l);const h=[];for(;!h.length&&a;)a.getLeafColumns().forEach(u=>{const g=r.indexOf(u)>=0,m=h.indexOf(u)<0;g&&m&&h.push(u)}),a=a.getOriginalParent();if(!h.length)return void r.push(l);const d=h.map(u=>r.indexOf(u)),c=Math.max(...d);Oi(r,l,c+1)}),this.cols.list=r}sortColsLikeKeys(e){if(this.cols==null)return;let t=[];const i={};e.forEach(o=>{if(i[o])return;const n=this.cols.map[o];n&&(t.push(n),i[o]=!0)});let s=0;this.cols.list.forEach(o=>{const n=o.getColId();i[n]==null&&(n.startsWith(Ni)?Oi(t,o,s++):t.push(o))}),t=this.columnMoveService.placeLockedColumns(t),this.columnMoveService.doesMovePassMarryChildren(t)?this.cols.list=t:R("Applying column order broke a group where columns should be married together. Applying new order has been discarded.")}sortColsLikeCols(e){!e||e.length<=1||e.filter(t=>this.cols.list.indexOf(t)<0).length>0||e.sort((t,i)=>this.cols.list.indexOf(t)-this.cols.list.indexOf(i))}resetColDefIntoCol(e,t){const i=e.getUserProvidedColDef();if(!i)return!1;const s=this.columnFactory.addColumnDefaultAndTypes(i,e.getColId());return e.setColDef(s,i,t),!0}queueResizeOperations(){this.shouldQueueResizeOperations=!0}isShouldQueueResizeOperations(){return this.shouldQueueResizeOperations}processResizeOperations(){this.shouldQueueResizeOperations=!1,this.resizeOperationQueue.forEach(e=>e()),this.resizeOperationQueue=[]}pushResizeOperation(e){this.resizeOperationQueue.push(e)}moveInCols(e,t,i){var s;Xo((s=this.cols)==null?void 0:s.list,e,t),this.visibleColsService.refresh(i)}positionLockedCols(){this.cols.list=this.columnMoveService.placeLockedColumns(this.cols.list)}saveColOrder(){var e,t;this.showingPivotResult?this.lastPivotOrder=(e=this.cols)==null?void 0:e.list:this.lastOrder=(t=this.cols)==null?void 0:t.list}getColumnDefs(){if(!this.colDefCols)return;const e=this.colDefCols.list.slice();this.showingPivotResult?e.sort((s,o)=>this.lastOrder.indexOf(s)-this.lastOrder.indexOf(o)):this.lastOrder&&e.sort((s,o)=>this.cols.list.indexOf(s)-this.cols.list.indexOf(o));const t=this.funcColsService.getRowGroupColumns(),i=this.funcColsService.getPivotColumns();return this.columnDefFactory.buildColumnDefs(e,t,i)}isShowingPivotResult(){return this.showingPivotResult}isChangeEventsDispatching(){return this.changeEventsDispatching}isColSpanActive(){return this.colSpanActive}isProvidedColGroupsPresent(){var e;return((e=this.colDefCols)==null?void 0:e.treeDepth)>0}setColSpanActive(){this.colSpanActive=this.cols.list.some(e=>e.getColDef().colSpan!=null)}isAutoRowHeightActive(){return this.autoHeightActive}wasAutoRowHeightEverActive(){return this.autoHeightActiveAtLeastOnce}getHeaderRowCount(){return this.cols?this.cols.treeDepth+1:-1}isReady(){return this.ready}isPivotMode(){return this.pivotMode}setPivotMode(e,t){e!==this.pivotMode&&this.isPivotSettingAllowed(this.pivotMode)&&(this.pivotMode=e,this.ready&&(this.refreshCols(!1),this.visibleColsService.refresh(t),this.eventDispatcher.pivotModeChanged()))}isPivotSettingAllowed(e){return!e||!this.gos.get("treeData")||(R("Pivot mode not available with treeData."),!1)}isPivotActive(){const e=this.funcColsService.getPivotColumns();return this.pivotMode&&!Me(e)}recreateColumnDefs(e){this.cols&&(this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e),this.createColsFromColDefs(e))}setColumnDefs(e,t){this.colDefs=e,this.createColsFromColDefs(t)}destroy(){var e,t,i;ht(this.context,(e=this.colDefCols)==null?void 0:e.tree),ht(this.context,(t=this.autoCols)==null?void 0:t.tree),ht(this.context,(i=this.controlsCols)==null?void 0:i.tree),super.destroy()}getColTree(){return this.cols.tree}getColDefColTree(){return this.colDefCols.tree}getColDefCols(){var e;return(e=this.colDefCols)!=null&&e.list?this.colDefCols.list:null}getCols(){var e;return((e=this.cols)==null?void 0:e.list)??[]}getAllCols(){var i,s,o;const e=this.pivotResultColsService.getPivotResultCols(),t=e==null?void 0:e.list;return[((i=this.colDefCols)==null?void 0:i.list)??[],((s=this.autoCols)==null?void 0:s.list)??[],((o=this.controlsCols)==null?void 0:o.list)??[],t??[]].flat()}getColsForKeys(e){return e?e.map(t=>this.getCol(t)).filter(t=>t!=null):[]}getColDefCol(e){var t;return(t=this.colDefCols)!=null&&t.list?this.getColFromCollection(e,this.colDefCols):null}getCol(e){return e==null?null:this.getColFromCollection(e,this.cols)}getColFromCollection(e,t){if(t==null)return null;const{map:i,list:s}=t;if(typeof e=="string"&&i[e])return i[e];for(let o=0;orn(i,e)))??null}getAutoCols(){var e;return((e=this.autoCols)==null?void 0:e.list)??null}setColHeaderHeight(e,t){e.setAutoHeaderHeight(t)&&(e.isColumn?this.eventDispatcher.headerHeight(e):this.eventDispatcher.groupHeaderHeight(e))}getGroupRowsHeight(){const e=[],t=this.ctrlsService.getHeaderRowContainerCtrls();for(const i of t){if(!i)continue;const s=i.getGroupRowCount()||0;for(let o=0;or)&&(e[o]=l)}}}return e}getColumnGroupHeaderRowHeight(e){const t=this.isPivotMode()?this.getPivotGroupHeaderHeight():this.getGroupHeaderHeight();let i=0;const s=e.getHeaderCtrls();for(const o of s){const n=o.getColumn();if(n.isAutoHeaderHeight()){const r=n.getAutoHeaderHeight();r!=null&&r>i&&(i=r)}}return Math.max(t,i)}getColumnHeaderRowHeight(){const e=this.isPivotMode()?this.getPivotHeaderHeight():this.getHeaderHeight(),t=this.visibleColsService.getAllCols().filter(i=>i.isAutoHeaderHeight()).map(i=>i.getAutoHeaderHeight()||0);return Math.max(e,...t)}getHeaderHeight(){return this.gos.get("headerHeight")??this.environment.getDefaultHeaderHeight()}getFloatingFiltersHeight(){return this.gos.get("floatingFiltersHeight")??this.getHeaderHeight()}getGroupHeaderHeight(){return this.gos.get("groupHeaderHeight")??this.getHeaderHeight()}getPivotHeaderHeight(){return this.gos.get("pivotHeaderHeight")??this.getHeaderHeight()}getPivotGroupHeaderHeight(){return this.gos.get("pivotGroupHeaderHeight")??this.getGroupHeaderHeight()}onFirstDataRendered(){const e=this.gos.get("autoSizeStrategy");if((e==null?void 0:e.type)!=="fitCellContents")return;const{colIds:t,skipHeader:i}=e;setTimeout(()=>{t?this.columnAutosizeService.autoSizeCols({colKeys:t,skipHeader:i,source:"autosizeColumns"}):this.columnAutosizeService.autoSizeAllColumns("autosizeColumns",i)})}onAutoGroupColumnDefChanged(e){this.autoCols&&this.autoColService.updateAutoCols(this.autoCols.list,e)}onSelectionOptionsChanged(e,t,i){const s=(t&&typeof t!="string"?Ht(t):void 0)!==(e&&typeof e!="string"?Ht(e):void 0),o=t&&typeof t!="string"?Li(t):void 0,n=e&&typeof e!="string"?Li(e):void 0;(s||o!==n)&&this.refreshAll(i)}};function bt(e){return e==="gridOptionsUpdated"?"gridOptionsChanged":e}function nn(e){e.map={},e.list.forEach(t=>e.map[t.getId()]=t)}function rn(e,t){const i=e===t,s=e.getColDef()===t,o=e.getColId()==t;return i||s||o}function ln(e,t){return at(e,t,(i,s)=>i.getColId()===s.getColId())}var Ol=class extends b{constructor(){super(...arguments),this.beanName="columnAutosizeService",this.timesDelayed=0}wireBeans(e){this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.animationFrameService=e.animationFrameService,this.autoWidthCalculator=e.autoWidthCalculator,this.eventDispatcher=e.columnEventDispatcher,this.ctrlsService=e.ctrlsService,this.renderStatusService=e.renderStatusService}autoSizeCols(e){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation(()=>this.autoSizeCols(e));const{colKeys:t,skipHeader:i,skipHeaderGroups:s,stopAtGroup:o,source:n="api"}=e;if(this.animationFrameService.flushAllFrames(),this.timesDelayed<5&&this.renderStatusService&&!this.renderStatusService.areHeaderCellsRendered())return this.timesDelayed++,void setTimeout(()=>this.autoSizeCols(e));this.timesDelayed=0;const r=[];let l=-1;const a=i??this.gos.get("skipHeaderOnAutoSize"),h=s??a;for(;l!==0;){l=0;const d=[];t.forEach(c=>{if(!c)return;const u=this.columnModel.getCol(c);if(!u||r.indexOf(u)>=0)return;const g=this.autoWidthCalculator.getPreferredWidthForColumn(u,a);if(g>0){const m=this.normaliseColumnWidth(u,g);u.setActualWidth(m,n),r.push(u),l++}d.push(u)}),d.length&&this.visibleColsService.refresh(n)}h||this.autoSizeColumnGroupsByColumns(t,n,o),this.eventDispatcher.columnResized(r,!0,"autosizeColumns")}autoSizeColumn(e,t,i){e&&this.autoSizeCols({colKeys:[e],skipHeader:i,skipHeaderGroups:!0,source:t})}autoSizeColumnGroupsByColumns(e,t,i){const s=new Set;let o;this.columnModel.getColsForKeys(e).forEach(n=>{let r=n.getParent();for(;r&&r!=i;)r.isPadding()||s.add(r),r=r.getParent()});for(const n of s){for(const r of this.ctrlsService.getHeaderRowContainerCtrls())if(o=r.getHeaderCtrlForColumn(n),o)break;o&&o.resizeLeafColumnsToFit(t)}return[]}autoSizeAllColumns(e,t){if(this.columnModel.isShouldQueueResizeOperations())return void this.columnModel.pushResizeOperation(()=>this.autoSizeAllColumns(e,t));const i=this.visibleColsService.getAllCols();this.autoSizeCols({colKeys:i,skipHeader:t,source:e})}normaliseColumnWidth(e,t){const i=e.getMinWidth();tthis.rowGroupCols.push(e),removeGroupCol:e=>ye(this.rowGroupCols,e),addPivotCol:e=>this.pivotCols.push(e),removePivotCol:e=>ye(this.pivotCols,e),addValueCol:e=>this.valueCols.push(e),removeValueCol:e=>ye(this.valueCols,e)}}getSourceColumnsForGroupColumn(e){const t=e.getColDef().showRowGroup;if(!t)return null;if(t===!0)return this.rowGroupCols.slice(0);const i=this.columnModel.getColDefCol(t);return i?[i]:null}sortRowGroupColumns(e){this.rowGroupCols.sort(e)}sortPivotColumns(e){this.pivotCols.sort(e)}getValueColumns(){return this.valueCols?this.valueCols:[]}getPivotColumns(){return this.pivotCols?this.pivotCols:[]}getRowGroupColumns(){return this.rowGroupCols?this.rowGroupCols:[]}isRowGroupEmpty(){return Me(this.rowGroupCols)}setColumnAggFunc(e,t,i){if(!e)return;const s=this.columnModel.getColDefCol(e);s&&(s.setAggFunc(t),this.eventDispatcher.columnChanged("columnValueChanged",[s],i))}setRowGroupColumns(e,t){this.setColList(e,this.rowGroupCols,"columnRowGroupChanged",!0,!0,(i,s)=>this.setRowGroupActive(i,s,t),t)}setRowGroupActive(e,t,i){e!==t.isRowGroupActive()&&(t.setRowGroupActive(e,i),e&&!this.gos.get("suppressRowGroupHidesColumns")&&this.columnModel.setColsVisible([t],!1,i),e||this.gos.get("suppressMakeColumnVisibleAfterUnGroup")||this.columnModel.setColsVisible([t],!0,i))}addRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!0,!0,i=>this.setRowGroupActive(!0,i,t),"columnRowGroupChanged",t)}removeRowGroupColumns(e,t){this.updateColList(e,this.rowGroupCols,!1,!0,i=>this.setRowGroupActive(!1,i,t),"columnRowGroupChanged",t)}addPivotColumns(e,t){this.updateColList(e,this.pivotCols,!0,!1,i=>i.setPivotActive(!0,t),"columnPivotChanged",t)}setPivotColumns(e,t){this.setColList(e,this.pivotCols,"columnPivotChanged",!0,!1,(i,s)=>{s.setPivotActive(i,t)},t)}removePivotColumns(e,t){this.updateColList(e,this.pivotCols,!1,!1,i=>i.setPivotActive(!1,t),"columnPivotChanged",t)}setValueColumns(e,t){this.setColList(e,this.valueCols,"columnValueChanged",!1,!1,(i,s)=>this.setValueActive(i,s,t),t)}setValueActive(e,t,i){if(e!==t.isValueActive()&&(t.setValueActive(e,i),e&&!t.getAggFunc()&&this.aggFuncService)){const s=this.aggFuncService.getDefaultAggFunc(t);t.setAggFunc(s)}}addValueColumns(e,t){this.updateColList(e,this.valueCols,!0,!1,i=>this.setValueActive(!0,i,t),"columnValueChanged",t)}removeValueColumns(e,t){this.updateColList(e,this.valueCols,!1,!1,i=>this.setValueActive(!1,i,t),"columnValueChanged",t)}moveRowGroupColumn(e,t,i){if(this.isRowGroupEmpty())return;const s=this.rowGroupCols[e],o=this.rowGroupCols.slice(e,t);this.rowGroupCols.splice(e,1),this.rowGroupCols.splice(t,0,s),this.eventDispatcher.rowGroupChanged(o,i)}setColList(e,t,i,s,o,n,r){if(!this.columnModel.getCols())return;const l=new Map;t.forEach((a,h)=>l.set(a,h)),t.length=0,M(e)&&e.forEach(a=>{const h=this.columnModel.getColDefCol(a);h&&t.push(h)}),t.forEach((a,h)=>{const d=l.get(a);d!==void 0?s&&d!==h||l.delete(a):l.set(a,0)}),(this.columnModel.getColDefCols()||[]).forEach(a=>{const h=t.indexOf(a)>=0;n(h,a)}),o&&this.columnModel.refreshCols(!1),this.visibleColsService.refresh(r),this.eventDispatcher.columnChanged(i,[...l.keys()],r)}updateColList(e,t,i,s,o,n,r){if(!e||Me(e))return;let l=!1;const a=new Set;e.forEach(h=>{if(!h)return;const d=this.columnModel.getColDefCol(h);if(d){if(a.add(d),i){if(t.indexOf(d)>=0)return;t.push(d)}else{const c=t.indexOf(d);if(c<0)return;for(let u=c+1;ui.setValueActive(s,e),()=>{},()=>{},i=>{const s=i.aggFunc;return s===null||s===""?null:s!==void 0?!!s:void 0},i=>i.initialAggFunc!=null&&i.initialAggFunc!=""),this.valueCols.forEach(i=>{const s=i.getColDef();s.aggFunc!=null&&s.aggFunc!=""?i.setAggFunc(s.aggFunc):i.getAggFunc()||i.setAggFunc(s.initialAggFunc)})}extractRowGroupCols(e,t){this.rowGroupCols=this.extractColsCommon(t,this.rowGroupCols,(i,s)=>i.setRowGroupActive(s,e),i=>i.rowGroupIndex,i=>i.initialRowGroupIndex,i=>i.rowGroup,i=>i.initialRowGroup)}extractPivotCols(e,t){this.pivotCols=this.extractColsCommon(t,this.pivotCols,(i,s)=>i.setPivotActive(s,e),i=>i.pivotIndex,i=>i.initialPivotIndex,i=>i.pivot,i=>i.initialPivot)}extractColsCommon(e=[],t=[],i,s,o,n,r){const l=[],a=[];(this.columnModel.getColDefCols()||[]).forEach(c=>{const u=e.indexOf(c)<0,g=c.getColDef(),m=gs(n(g)),f=gs(r(g)),C=ft(s(g)),v=ft(o(g));let w;w=m!==void 0?m:C!==void 0?C!==null&&C>=0:u?f!==void 0?f:v!==void 0&&v!=null&&v>=0:t.indexOf(c)>=0,w&&((u?C!=null||v!=null:C!=null)?l.push(c):a.push(c))});const h=c=>{const u=s(c.getColDef()),g=o(c.getColDef());return u??g};l.sort((c,u)=>{const g=h(c),m=h(u);return g===m?0:g{a.indexOf(c)>=0&&d.push(c)}),a.forEach(c=>{d.indexOf(c)<0&&d.push(c)}),t.forEach(c=>{d.indexOf(c)<0&&i(c,!1)}),d.forEach(c=>{t.indexOf(c)<0&&i(c,!0)}),d}generateColumnStateForRowGroupAndPivotIndexes(e,t){const i={},s=(o,n,r,l,a,h)=>{const d=this.columnModel.getColDefCols();if(!n.length||!d)return[];const c=Object.keys(o),u=new Set(c),g=new Set(c),m=new Set(n.map(E=>{const D=E.getColId();return g.delete(D),D}).concat(c)),f=[],C={};let v=0;for(let E=0;E{const D=C[E];for(let A=S;A{const D=E.getColId();if(u.has(D))F(D),o[D][a]=w++;else{const A=E.getColDef();(A[a]===null||A[a]===void 0&&A[h]==null)&&(P||(A[r]||A[r]===void 0&&A[l]?F(D):(g.forEach(L=>{o[L][a]=w+C[L]}),w+=f.length,P=!0)),i[D]||(i[D]={colId:D}),i[D][a]=w++)}})};return s(e,this.rowGroupCols,"rowGroup","initialRowGroup","rowGroupIndex","initialRowGroupIndex"),s(t,this.pivotCols,"pivot","initialPivot","pivotIndex","initialPivotIndex"),Object.values(i)}},Nl=class extends b{constructor(){super(...arguments),this.beanName="columnApplyStateService"}wireBeans(e){this.columnModel=e.columnModel,this.eventDispatcher=e.columnEventDispatcher,this.sortController=e.sortController,this.columnGetStateService=e.columnGetStateService,this.funcColsService=e.funcColsService,this.visibleColsService=e.visibleColsService,this.columnAnimationService=e.columnAnimationService,this.pivotResultColsService=e.pivotResultColsService}applyColumnState(e,t){const i=this.columnModel.getColDefCols()||[];if(Me(i))return!1;if(e&&e.state&&!e.state.forEach)return R("applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state."),!1;const s=this.funcColsService.getModifyColumnsNoEventsCallbacks(),o=(l,a,h)=>{const d=this.compareColumnStatesAndDispatchEvents(t),c=a.slice(),u={},g={},m=[],f=[];let C=0;const v=this.funcColsService.getRowGroupColumns().slice(),w=this.funcColsService.getPivotColumns().slice();l.forEach(F=>{const E=F.colId||"";if(E.startsWith(Ni))return m.push(F),void f.push(F);const D=h(E);D?(this.syncColumnWithStateItem(D,F,e.defaultState,u,g,!1,t,s),ye(c,D)):(f.push(F),C+=1)});const P=F=>this.syncColumnWithStateItem(F,null,e.defaultState,u,g,!1,t,s);c.forEach(P),this.funcColsService.sortRowGroupColumns(an.bind(this,u,v)),this.funcColsService.sortPivotColumns(an.bind(this,g,w)),this.columnModel.refreshCols(!1);const S=(this.columnModel.getAutoCols()||[]).slice();return m.forEach(F=>{const E=this.columnModel.getAutoCol(F.colId);ye(S,E),this.syncColumnWithStateItem(E,F,e.defaultState,null,null,!0,t,s)}),S.forEach(P),this.orderLiveColsLikeState(e),this.visibleColsService.refresh(t),this.eventDispatcher.everythingChanged(t),d(),{unmatchedAndAutoStates:f,unmatchedCount:C}};this.columnAnimationService.start();let{unmatchedAndAutoStates:n,unmatchedCount:r}=o(e.state||[],i,l=>this.columnModel.getColDefCol(l));if(n.length>0||M(e.defaultState)){const l=this.pivotResultColsService.getPivotResultCols(),a=l==null?void 0:l.list;r=o(n,a||[],h=>this.pivotResultColsService.getPivotResultCol(h)).unmatchedCount}return this.columnAnimationService.finish(),r===0}resetColumnState(e){if(Me(this.columnModel.getColDefCols()))return;const t=bs(this.columnModel.getColDefColTree()),i=[];let s=1e3,o=1e3,n=[];const r=this.columnModel.getAutoCols();r&&(n=n.concat(r)),t&&(n=n.concat(t)),n.forEach(l=>{const a=this.getColumnStateFromColDef(l);K(a.rowGroupIndex)&&a.rowGroup&&(a.rowGroupIndex=s++),K(a.pivotIndex)&&a.pivot&&(a.pivotIndex=o++),i.push(a)}),this.applyColumnState({state:i,applyOrder:!0},e)}getColumnStateFromColDef(e){const t=(m,f)=>m??f??null,i=e.getColDef(),s=t(i.sort,i.initialSort),o=t(i.sortIndex,i.initialSortIndex),n=t(i.hide,i.initialHide),r=t(i.pinned,i.initialPinned),l=t(i.width,i.initialWidth),a=t(i.flex,i.initialFlex);let h=t(i.rowGroupIndex,i.initialRowGroupIndex),d=t(i.rowGroup,i.initialRowGroup);h!=null||d!=null&&d!=0||(h=null,d=null);let c=t(i.pivotIndex,i.initialPivotIndex),u=t(i.pivot,i.initialPivot);c!=null||u!=null&&u!=0||(c=null,u=null);const g=t(i.aggFunc,i.initialAggFunc);return{colId:e.getColId(),sort:s,sortIndex:o,hide:n,pinned:r,width:l,flex:a,rowGroup:d,rowGroupIndex:h,pivot:u,pivotIndex:c,aggFunc:g}}syncColumnWithStateItem(e,t,i,s,o,n,r,l){if(!e)return;const a=(S,F)=>{const E={value1:void 0,value2:void 0};let D=!1;return t&&(t[S]!==void 0&&(E.value1=t[S],D=!0),M(F)&&t[F]!==void 0&&(E.value2=t[F],D=!0)),!D&&i&&(i[S]!==void 0&&(E.value1=i[S]),M(F)&&i[F]!==void 0&&(E.value2=i[F])),E},h=a("hide").value1;h!==void 0&&e.setVisible(!h,r);const d=a("pinned").value1;d!==void 0&&e.setPinned(d);const c=e.getColDef().minWidth??this.gos.environment.getDefaultColumnMinWidth(),u=a("flex").value1;if(u!==void 0&&e.setFlex(u),u==null){const S=a("width").value1;S!=null&&c!=null&&S>=c&&e.setActualWidth(S,r)}const g=a("sort").value1;g!==void 0&&(g==="desc"||g==="asc"?e.setSort(g,r):e.setSort(void 0,r));const m=a("sortIndex").value1;if(m!==void 0&&e.setSortIndex(m),n||!e.isPrimary())return;const f=a("aggFunc").value1;f!==void 0&&(typeof f=="string"?(e.setAggFunc(f),e.isValueActive()||(e.setValueActive(!0,r),l.addValueCol(e))):(M(f)&&R("stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON."),e.isValueActive()&&(e.setValueActive(!1,r),l.removeValueCol(e))));const{value1:C,value2:v}=a("rowGroup","rowGroupIndex");C===void 0&&v===void 0||(typeof v=="number"||C?(e.isRowGroupActive()||(e.setRowGroupActive(!0,r),l.addGroupCol(e)),s&&typeof v=="number"&&(s[e.getId()]=v)):e.isRowGroupActive()&&(e.setRowGroupActive(!1,r),l.removeGroupCol(e)));const{value1:w,value2:P}=a("pivot","pivotIndex");w===void 0&&P===void 0||(typeof P=="number"||w?(e.isPivotActive()||(e.setPivotActive(!0,r),l.addPivotCol(e)),o&&typeof P=="number"&&(o[e.getId()]=P)):e.isPivotActive()&&(e.setPivotActive(!1,r),l.removePivotCol(e)))}orderLiveColsLikeState(e){if(!e.applyOrder||!e.state)return;const t=[];e.state.forEach(i=>{i.colId!=null&&t.push(i.colId)}),this.columnModel.sortColsLikeKeys(t)}compareColumnStatesAndDispatchEvents(e){const t={rowGroupColumns:this.funcColsService.getRowGroupColumns().slice(),pivotColumns:this.funcColsService.getPivotColumns().slice(),valueColumns:this.funcColsService.getValueColumns().slice()},i=this.columnGetStateService.getColumnState(),s={};return i.forEach(o=>{s[o.colId]=o}),()=>{const o=this.columnModel.getAllCols(),n=(d,c,u,g)=>{if(at(c.map(g),u.map(g)))return;const m=new Set(c);u.forEach(C=>{m.delete(C)||m.add(C)});const f=[...m];this.eventService.dispatchEvent({type:d,columns:f,column:f.length===1?f[0]:null,source:e})},r=d=>{const c=[];return o.forEach(u=>{const g=s[u.getColId()];g&&d(g,u)&&c.push(u)}),c},l=d=>d.getColId();n("columnRowGroupChanged",t.rowGroupColumns,this.funcColsService.getRowGroupColumns(),l),n("columnPivotChanged",t.pivotColumns,this.funcColsService.getPivotColumns(),l);const a=r((d,c)=>{const u=d.aggFunc!=null,g=u!=c.isValueActive(),m=u&&d.aggFunc!=c.getAggFunc();return g||m});a.length>0&&this.eventDispatcher.columnChanged("columnValueChanged",a,e),this.eventDispatcher.columnResized(r((d,c)=>d.width!=c.getActualWidth()),!0,e),this.eventDispatcher.columnPinned(r((d,c)=>d.pinned!=c.getPinned()),e),this.eventDispatcher.columnVisible(r((d,c)=>d.hide==c.isVisible()),e);const h=r((d,c)=>d.sort!=c.getSort()||d.sortIndex!=c.getSortIndex());h.length>0&&this.sortController.dispatchSortChangedEvents(e,h),this.normaliseColumnMovedEventForColumnState(i,e)}}normaliseColumnMovedEventForColumnState(e,t){const i=this.columnGetStateService.getColumnState(),s={};i.forEach(a=>s[a.colId]=a);const o={};e.forEach(a=>{s[a.colId]&&(o[a.colId]=!0)});const n=e.filter(a=>o[a.colId]),r=i.filter(a=>o[a.colId]),l=[];r.forEach((a,h)=>{const d=n&&n[h];if(d&&d.colId!==a.colId){const c=this.columnModel.getCol(d.colId);c&&l.push(c)}}),l.length&&this.eventDispatcher.columnMoved({movedColumns:l,source:t,finished:!0})}},an=(e,t,i,s)=>{const o=e[i.getId()],n=e[s.getId()],r=o!=null,l=n!=null;if(r&&l)return o-n;if(r)return-1;if(l)return 1;const a=t.indexOf(i),h=t.indexOf(s),d=a>=0;return d&&h>=0?a-h:d?-1:1},Hl=class extends b{constructor(){super(...arguments),this.beanName="columnMoveService"}wireBeans(e){this.columnModel=e.columnModel,this.columnAnimationService=e.columnAnimationService,this.eventDispatcher=e.columnEventDispatcher}moveColumnByIndex(e,t,i){const s=this.columnModel.getCols();if(!s)return;const o=s[e];this.moveColumns([o],t,i)}moveColumns(e,t,i,s=!0){const o=this.columnModel.getCols();if(!o)return;if(t>o.length-e.length)return R("tried to insert columns in invalid location, toIndex = ",t),void R("remember that you should not count the moving columns when calculating the new index");this.columnAnimationService.start();const n=this.columnModel.getColsForKeys(e);this.doesMovePassRules(n,t)&&(this.columnModel.moveInCols(n,t,i),this.eventDispatcher.columnMoved({movedColumns:n,source:i,toIndex:t,finished:s})),this.columnAnimationService.finish()}doesMovePassRules(e,t){const i=this.getProposedColumnOrder(e,t);return this.doesOrderPassRules(i)}doesOrderPassRules(e){return!!this.doesMovePassMarryChildren(e)&&!!this.doesMovePassLockedPositions(e)}getProposedColumnOrder(e,t){const i=this.columnModel.getCols().slice();return Xo(i,e,t),i}doesMovePassLockedPositions(e){const t=this.gos.get("enableRtl");let i=t?1:-1,s=!0;return e.forEach(o=>{const n=(r=o.getColDef().lockPosition)?r==="left"||r===!0?-1:1:0;var r;t?n>i&&(s=!1):n{if(!be(i))return;const s=i,o=s.getColGroupDef();if(!(o&&o.marryChildren))return;const n=[];s.getLeafColumns().forEach(r=>{const l=e.indexOf(r);n.push(l)}),Math.max.apply(Math,n)-Math.min.apply(Math,n)>s.getLeafColumns().length-1&&(t=!1)}),t}placeLockedColumns(e){const t=[],i=[],s=[];return e.forEach(o=>{const n=o.getColDef().lockPosition;n==="right"?s.push(o):n==="left"||n===!0?t.push(o):i.push(o)}),this.gos.get("enableRtl")?[...s,...i,...t]:[...t,...i,...s]}},Bl=/[&<>"']/g,Vl={"&":"&","<":"<",">":">",'"':""","'":"'"};function _e(e,t){if(e==null)return null;const i=e.toString().toString();return t?i:i.replace(Bl,s=>Vl[s])}var Wl=class extends b{constructor(){super(...arguments),this.beanName="columnNameService"}wireBeans(e){this.expressionService=e.expressionService,this.funcColsService=e.funcColsService,this.columnModel=e.columnModel}getDisplayNameForColumn(e,t,i=!1){if(!e)return null;const s=this.getHeaderName(e.getColDef(),e,null,null,t);return i?this.wrapHeaderNameWithAggFunc(e,s):s}getDisplayNameForProvidedColumnGroup(e,t,i){const s=t?t.getColGroupDef():null;return s?this.getHeaderName(s,null,e,t,i):null}getDisplayNameForColumnGroup(e,t){return this.getDisplayNameForProvidedColumnGroup(e,e.getProvidedColumnGroup(),t)}getHeaderName(e,t,i,s,o){const n=e.headerValueGetter;if(n){const l=this.gos.addGridCommonParams({colDef:e,column:t,columnGroup:i,providedColumnGroup:s,location:o});return typeof n=="function"?n(l):typeof n=="string"?this.expressionService.evaluate(n,l):(R("headerValueGetter must be a function or a string"),"")}return e.headerName!=null?e.headerName:e.field?(r=e.field)&&r!=null?r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z])([a-z])/g,"$1 $2$3").replace(/\./g," ").split(" ").map(l=>l.substring(0,1).toUpperCase()+(l.length>1?l.substring(1,l.length):"")).join(" "):null:"";var r}wrapHeaderNameWithAggFunc(e,t){if(this.gos.get("suppressAggFuncInHeader"))return t;const i=e.getColDef().pivotValueColumn;let s,o=null;if(M(i)){const n=this.funcColsService.getValueColumns(),r=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&n.length===1,l=e.getColDef().pivotTotalColumnIds!==void 0;if(r&&!l)return t;o=i?i.getAggFunc():null,s=!0}else{const n=e.isValueActive(),r=this.columnModel.isPivotMode()||!this.funcColsService.isRowGroupEmpty();n&&r?(o=e.getAggFunc(),s=!0):s=!1}if(s){const n=typeof o=="string"?o:"func";return`${this.localeService.getLocaleTextFunc()(n,n)}(${t})`}return t}},zl=class extends b{constructor(){super(...arguments),this.beanName="pivotResultColsService"}wireBeans(e){this.context=e.context,this.columnModel=e.columnModel,this.columnFactory=e.columnFactory,this.visibleColsService=e.visibleColsService}destroy(){var e;ht(this.context,(e=this.pivotResultCols)==null?void 0:e.tree),super.destroy()}isPivotResultColsPresent(){return this.pivotResultCols!=null}lookupPivotResultCol(e,t){if(this.pivotResultCols==null)return null;const i=this.columnModel.getColDefCol(t);let s=null;return this.pivotResultCols.list.forEach(o=>{const n=o.getColDef().pivotKeys,r=o.getColDef().pivotValueColumn;at(n,e)&&r===i&&(s=o)}),s}getPivotResultCols(){return this.pivotResultCols}getPivotResultCol(e){return this.pivotResultCols?this.columnModel.getColFromCollection(e,this.pivotResultCols):null}setPivotResultCols(e,t){var i,s;if(this.columnModel.isReady()&&(e!=null||this.pivotResultCols!=null)){if(e){this.processPivotResultColDef(e);const o=this.columnFactory.createColumnTree(e,!1,((i=this.pivotResultCols)==null?void 0:i.tree)||this.previousPivotResultCols||void 0,t);ht(this.context,(s=this.pivotResultCols)==null?void 0:s.tree,o.columnTree);const n=o.columnTree,r=o.treeDept,l=bs(n),a={};this.pivotResultCols={tree:n,treeDepth:r,list:l,map:a},this.pivotResultCols.list.forEach(d=>this.pivotResultCols.map[d.getId()]=d);const h=!!this.previousPivotResultCols;this.previousPivotResultCols=null,this.columnModel.refreshCols(!h)}else this.previousPivotResultCols=this.pivotResultCols?this.pivotResultCols.tree:null,this.pivotResultCols=null,this.columnModel.refreshCols(!1);this.visibleColsService.refresh(t)}}processPivotResultColDef(e){const t=this.gos.get("processPivotResultColDef"),i=this.gos.get("processPivotResultColGroupDef");if(!t&&!i)return;const s=o=>{o.forEach(n=>{if(M(n.children)){const r=n;i&&i(r),s(r.children)}else t&&t(n)})};e&&s(e)}},Ul=class extends b{constructor(){super(...arguments),this.beanName="columnSizeService"}wireBeans(e){this.columnModel=e.columnModel,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher,this.visibleColsService=e.visibleColsService,this.ctrlsService=e.ctrlsService}setColumnWidths(e,t,i,s){const o=[];e.forEach(n=>{const r=this.columnModel.getColDefCol(n.key)||this.columnModel.getCol(n.key);if(r&&(o.push({width:n.newWidth,ratios:[1],columns:[r]}),this.gos.get("colResizeDefault")==="shift"&&(t=!t),t)){const l=this.visibleColsService.getColAfter(r);if(!l)return;const a=r.getActualWidth()-n.newWidth,h=l.getActualWidth()+a;o.push({width:h,ratios:[1],columns:[l]})}}),o.length!==0&&this.resizeColumnSets({resizeSets:o,finished:i,source:s})}resizeColumnSets(e){const{resizeSets:t,finished:i,source:s}=e;if(!(!t||t.every(h=>this.checkMinAndMaxWidthsForSet(h)))){if(i){const h=t&&t.length>0?t[0].columns:null;this.eventDispatcher.columnResized(h,i,s)}return}const o=[],n=[];t.forEach(h=>{const{width:d,columns:c,ratios:u}=h,g={},m={};c.forEach(v=>n.push(v));let f=!0,C=0;for(;f;){if(C++,C>1e3){Q("infinite loop in resizeColumnSets");break}f=!1;const v=[];let w=0,P=d;c.forEach((F,E)=>{if(m[F.getId()])P-=g[F.getId()];else{v.push(F);const D=u[E];w+=D}});const S=1/w;v.forEach((F,E)=>{let D;E===v.length-1?D=P:(D=Math.round(u[E]*d*S),P-=D);const A=F.getMinWidth(),L=F.getMaxWidth();D0&&D>L&&(D=L,m[F.getId()]=!0,f=!0),g[F.getId()]=D})}c.forEach(v=>{const w=g[v.getId()];v.getActualWidth()!==w&&(v.setActualWidth(w,s),o.push(v))})});const r=o.length>0;let l=[];r&&(l=this.refreshFlexedColumns({resizingCols:n,skipSetLeft:!0}),this.visibleColsService.setLeftValues(s),this.visibleColsService.updateBodyWidths(),this.columnViewportService.checkViewportColumns());const a=n.concat(l);(r||i)&&this.eventDispatcher.columnResized(a,i,s,l)}checkMinAndMaxWidthsForSet(e){const{columns:t,width:i}=e;let s=0,o=0,n=!0;return t.forEach(r=>{const l=r.getMinWidth();s+=l||0;const a=r.getMaxWidth();a>0?o+=a:n=!1}),i>=s&&(!n||i<=o)}refreshFlexedColumns(e={}){const t=e.source?e.source:"flex";if(e.viewportWidth!=null&&(this.flexViewportWidth=e.viewportWidth),!this.flexViewportWidth)return[];const i=this.visibleColsService.getCenterCols();let s=-1;if(e.resizingCols){const u=new Set(e.resizingCols);for(let g=i.length-1;g>=0;g--)if(u.has(i[g])){s=g;break}}let o=0,n=[],r=0,l=0;for(let u=0;us?(n.push(i[u]),l+=i[u].getFlex(),r+=i[u].getMinWidth()):o+=i[u].getActualWidth();if(!n.length)return[];let a=[];o+r>this.flexViewportWidth&&(n.forEach(u=>u.setActualWidth(u.getMinWidth(),t)),a=n,n=[]);const h=[];let d;e:for(;;){d=this.flexViewportWidth-o;const u=d/l;for(let g=0;gw&&(C=w),C){m.setActualWidth(C,t),Yo(n,m),l-=m.getFlex(),a.push(m),o+=m.getActualWidth();continue e}h[g]=Math.floor(f)}break}let c=d;return n.forEach((u,g)=>{const m=gthis.sizeColumnsToFit(e,t,i,s));const o={};s&&((u=s==null?void 0:s.columnLimits)==null||u.forEach(({key:g,...m})=>{o[typeof g=="string"?g:g.getColId()]=m}));const n=this.visibleColsService.getAllCols(),r=e===tt(n);if(e<=0||!n.length||r)return;const l=[],a=[];n.forEach(g=>{g.getColDef().suppressSizeToFit===!0?a.push(g):l.push(g)});const h=l.slice(0);let d=!1;const c=g=>{ye(l,g),a.push(g)};for(l.forEach(g=>{g.resetActualWidth(t);const m=o==null?void 0:o[g.getId()],f=(m==null?void 0:m.minWidth)??(s==null?void 0:s.defaultMinWidth),C=(m==null?void 0:m.maxWidth)??(s==null?void 0:s.defaultMaxWidth),v=g.getActualWidth();typeof f=="number"&&vC&&g.setActualWidth(C,t,!0)});!d;){d=!0;const g=e-tt(a);if(g<=0)l.forEach(m=>{var C;const f=((C=o==null?void 0:o[m.getId()])==null?void 0:C.minWidth)??(s==null?void 0:s.defaultMinWidth);typeof f!="number"?m.setMinimum(t):m.setActualWidth(f,t,!0)});else{const m=g/tt(l);let f=g;for(let C=l.length-1;C>=0;C--){const v=l[C],w=o==null?void 0:o[v.getId()],P=(w==null?void 0:w.minWidth)??(s==null?void 0:s.defaultMinWidth),S=(w==null?void 0:w.maxWidth)??(s==null?void 0:s.defaultMaxWidth),F=v.getMinWidth(),E=v.getMaxWidth(),D=typeof P=="number"&&P>F?P:F,A=typeof S=="number"&&SA?(L=A,c(v),d=!1):C===0&&(L=f),v.setActualWidth(L,t,!0),f-=L}}}h.forEach(g=>{g.fireColumnWidthChangedEvent(t)}),this.visibleColsService.setLeftValues(t),this.visibleColsService.updateBodyWidths(),i||this.eventDispatcher.columnResized(h,!0,t)}applyAutosizeStrategy(){const e=this.gos.get("autoSizeStrategy");if(!e)return;const{type:t}=e;setTimeout(()=>{if(t==="fitGridWidth"){const{columnLimits:i,defaultMinWidth:s,defaultMaxWidth:o}=e,n=i==null?void 0:i.map(({colId:r,minWidth:l,maxWidth:a})=>({key:r,minWidth:l,maxWidth:a}));this.ctrlsService.getGridBodyCtrl().sizeColumnsToFit({defaultMinWidth:s,defaultMaxWidth:o,columnLimits:n})}else t==="fitProvidedWidth"&&this.sizeColumnsToFit(e.width,"sizeColumnsToFit")})}};function hn(e,t){return e+"_"+t}function de(e){return e instanceof dn}var dn=class extends b{constructor(e,t,i,s){super(),this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.groupId=t,this.partId=i,this.providedColumnGroup=e,this.pinned=s}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}setParent(e){this.parent=e}getUniqueId(){return hn(this.groupId,this.partId)}isEmptyGroup(){return this.displayedChildren.length===0}isMoving(){const e=this.getProvidedColumnGroup().getLeafColumns();return!(!e||e.length===0)&&e.every(t=>t.isMoving())}checkLeft(){if(this.displayedChildren.forEach(e=>{de(e)&&e.checkLeft()}),this.displayedChildren.length>0)if(this.gos.get("enableRtl")){const e=$(this.displayedChildren).getLeft();this.setLeft(e)}else{const e=this.displayedChildren[0].getLeft();this.setLeft(e)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft(e){this.oldLeft=this.left,this.left!==e&&(this.left=e,this.dispatchLocalEvent({type:"leftChanged"}))}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let e=0;return this.displayedChildren&&this.displayedChildren.forEach(t=>{e+=t.getActualWidth()}),e}isResizable(){if(!this.displayedChildren)return!1;let e=!1;return this.displayedChildren.forEach(t=>{t.isResizable()&&(e=!0)}),e}getMinWidth(){let e=0;return this.displayedChildren.forEach(t=>{e+=t.getMinWidth()}),e}addChild(e){this.children||(this.children=[]),this.children.push(e)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){const e=[];return this.addLeafColumns(e),e}getDisplayedLeafColumns(){const e=[];return this.addDisplayedLeafColumns(e),e}getDefinition(){return this.providedColumnGroup.getColGroupDef()}getColGroupDef(){return this.providedColumnGroup.getColGroupDef()}isPadding(){return this.providedColumnGroup.isPadding()}isExpandable(){return this.providedColumnGroup.isExpandable()}isExpanded(){return this.providedColumnGroup.isExpanded()}setExpanded(e){this.providedColumnGroup.setExpanded(e)}isAutoHeaderHeight(){var e;return!!((e=this.getColGroupDef())!=null&&e.autoHeaderHeight)}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(e){const t=e!==this.autoHeaderHeight;return this.autoHeaderHeight=e,t}addDisplayedLeafColumns(e){this.displayedChildren.forEach(t=>{dt(t)?e.push(t):de(t)&&t.addDisplayedLeafColumns(e)})}addLeafColumns(e){this.children.forEach(t=>{dt(t)?e.push(t):de(t)&&t.addLeafColumns(e)})}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){const e=this.getParent();return this.isPadding()&&e&&e.isPadding()?1+e.getPaddingLevel():0}calculateDisplayedColumns(){this.displayedChildren=[];let e=this;for(;e!=null&&e.isPadding();)e=e.getParent();if(!(e&&e.getProvidedColumnGroup().isExpandable()))return this.displayedChildren=this.children,void this.dispatchLocalEvent({type:"displayedChildrenChanged"});this.children.forEach(t=>{if(!(de(t)&&(!t.displayedChildren||!t.displayedChildren.length)))switch(t.getColumnGroupShow()){case"open":e.getProvidedColumnGroup().isExpanded()&&this.displayedChildren.push(t);break;case"closed":e.getProvidedColumnGroup().isExpanded()||this.displayedChildren.push(t);break;default:this.displayedChildren.push(t)}}),this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},cn=class{constructor(){this.existingIds={}}getInstanceIdForKey(e){const t=this.existingIds[e];let i;return i=typeof t!="number"?0:t+1,this.existingIds[e]=i,i}},Kl=class extends b{constructor(){super(...arguments),this.beanName="visibleColsService",this.colsAndGroupsMap={},this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.bodyWidth=0,this.leftWidth=0,this.rightWidth=0,this.bodyWidthDirty=!0}wireBeans(e){this.columnModel=e.columnModel,this.columnSizeService=e.columnSizeService,this.columnViewportService=e.columnViewportService,this.eventDispatcher=e.columnEventDispatcher}refresh(e,t=!1){t||this.buildTrees(),this.updateOpenClosedVisibilityInColumnGroups(),this.columnsLeft=As(this.treeLeft),this.columnsCenter=As(this.treeCenter),this.columnsRight=As(this.treeRight),this.joinColsAriaOrder(),this.joinCols(),this.setLeftValues(e),this.autoHeightCols=this.columns.filter(i=>i.isAutoHeight()),this.columnSizeService.refreshFlexedColumns(),this.updateBodyWidths(),this.columnViewportService.checkViewportColumns(!1),this.setFirstRightAndLastLeftPinned(e),this.eventDispatcher.visibleCols(e)}updateBodyWidths(){const e=tt(this.columnsCenter),t=tt(this.columnsLeft),i=tt(this.columnsRight);this.bodyWidthDirty=this.bodyWidth!==e,(this.bodyWidth!==e||this.leftWidth!==t||this.rightWidth!==i)&&(this.bodyWidth=e,this.leftWidth=t,this.rightWidth=i,this.eventService.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventService.dispatchEvent({type:"displayedColumnsWidthChanged"}))}setLeftValues(e){this.setLeftValuesOfCols(e),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned(e){let t,i;this.gos.get("enableRtl")?(t=this.columnsLeft?this.columnsLeft[0]:null,i=this.columnsRight?$(this.columnsRight):null):(t=this.columnsLeft?$(this.columnsLeft):null,i=this.columnsRight?this.columnsRight[0]:null),this.columnModel.getCols().forEach(s=>{s.setLastLeftPinned(s===t,e),s.setFirstRightPinned(s===i,e)})}buildTrees(){const e=this.columnModel.getColsToShow(),t=e.filter(n=>n.getPinned()=="left"),i=e.filter(n=>n.getPinned()=="right"),s=e.filter(n=>n.getPinned()!="left"&&n.getPinned()!="right"),o=new cn;this.treeLeft=this.createGroups({columns:t,idCreator:o,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=this.createGroups({columns:i,idCreator:o,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=this.createGroups({columns:s,idCreator:o,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.columnsLeft=[],this.columnsRight=[],this.columnsCenter=[],this.columns=[],this.ariaOrderColumns=[]}joinColsAriaOrder(){const e=this.columnModel.getCols(),t=[],i=[],s=[];for(const o of e){const n=o.getPinned();n?n===!0||n==="left"?t.push(o):s.push(o):i.push(o)}this.ariaOrderColumns=t.concat(i).concat(s)}getAriaColIndex(e){let t;return t=de(e)?e.getLeafColumns()[0]:e,this.ariaOrderColumns.indexOf(t)+1}getAllAutoHeightCols(){return this.autoHeightCols}setLeftValuesOfGroups(){[this.treeLeft,this.treeRight,this.treeCenter].forEach(e=>{e.forEach(t=>{de(t)&&t.checkLeft()})})}setLeftValuesOfCols(e){if(!this.columnModel.getColDefCols())return;const t=this.columnModel.getCols().slice(0),i=this.gos.get("enableRtl");[this.columnsLeft,this.columnsRight,this.columnsCenter].forEach(s=>{if(i){let o=tt(s);s.forEach(n=>{o-=n.getActualWidth(),n.setLeft(o,e)})}else{let o=0;s.forEach(n=>{n.setLeft(o,e),o+=n.getActualWidth()})}(function(o,n){for(let r=0;r{s.setLeft(null,e)})}joinCols(){this.gos.get("enableRtl")?this.columns=this.columnsRight.concat(this.columnsCenter).concat(this.columnsLeft):this.columns=this.columnsLeft.concat(this.columnsCenter).concat(this.columnsRight)}getColsCenter(){return this.columnsCenter}getAllTrees(){return this.treeLeft&&this.treeRight&&this.treeCenter?this.treeLeft.concat(this.treeCenter).concat(this.treeRight):null}getTreeLeft(){return this.treeLeft}getTreeRight(){return this.treeRight}getTreeCenter(){return this.treeCenter}getAllCols(){return this.columns}isColDisplayed(e){return this.getAllCols().indexOf(e)>=0}getLeftColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsLeft):this.columnsLeft}getRightColsForRow(e){return this.columnModel.isColSpanActive()?this.getColsForRow(e,this.columnsRight):this.columnsRight}getColsForRow(e,t,i,s){const o=[];let n=null;for(let r=0;r1){const u=h-1;for(let g=1;g<=u;g++)d.push(t[r+g]);r+=u}let c;i?(c=!1,d.forEach(u=>{i(u)&&(c=!0)})):c=!0,c&&(o.length===0&&n&&s&&s(l)&&o.push(n),o.push(l)),n=l}return o}getBodyContainerWidth(){return this.bodyWidth}getContainerWidth(e){switch(e){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getCenterCols(){return this.columnsCenter}getLeftCols(){return this.columnsLeft}getRightCols(){return this.columnsRight}getColBefore(e){const t=this.getAllCols(),i=t.indexOf(e);return i>0?t[i-1]:null}getGroupAtDirection(e,t){const i=e.getProvidedColumnGroup().getLevel()+e.getPaddingLevel(),s=e.getDisplayedLeafColumns(),o=t==="After"?$(s):s[0],n=`getCol${t}`;for(;;){const r=this[n](o);if(!r)return null;const l=this.getColGroupAtLevel(r,i);if(l!==e)return l}}getColGroupAtLevel(e,t){let i,s,o=e.getParent();for(;i=o.getProvidedColumnGroup().getLevel(),s=o.getPaddingLevel(),!(i+s<=t);)o=o.getParent();return o}isPinningLeft(){return this.columnsLeft.length>0}isPinningRight(){return this.columnsRight.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};const e=t=>{this.colsAndGroupsMap[t.getUniqueId()]=t};Rt(this.treeCenter,!1,e),Rt(this.treeLeft,!1,e),Rt(this.treeRight,!1,e)}isVisible(e){return this.colsAndGroupsMap[e.getUniqueId()]===e}updateOpenClosedVisibilityInColumnGroups(){Rt(this.getAllTrees(),!1,e=>{de(e)&&e.calculateDisplayedColumns()})}getFirstColumn(){const e=this.gos.get("enableRtl"),t=["getLeftCols","getCenterCols","getRightCols"];e&&t.reverse();for(let i=0;i{if(de(n)){const r=n;let l;l=s?e===r.getGroupId()&&t===r.getPartId():e===r.getGroupId(),l&&(o=r)}}),o}getColAfter(e){const t=this.getAllCols(),i=t.indexOf(e);return i{const g=d;d=u;const m=h[g],f=(de(m)?m.getProvidedColumnGroup():m).getOriginalParent();if(f==null){for(let v=g;v{s.forEach(o=>{if(de(o)){const n=o;t[o.getUniqueId()]=n,i(n.getChildren())}})};return e&&i(e),t}setupParentsIntoCols(e,t){e.forEach(i=>{if(i.setParent(t),de(i)){const s=i;this.setupParentsIntoCols(s.getChildren(),s)}})}};function Rt(e,t,i){if(e)for(let s=0;s{dt(i)&&t.push(i)}),t}var un=["columnEverythingChanged","newColumnsLoaded","columnPivotModeChanged","pivotMaxColumnsExceeded","columnRowGroupChanged","expandOrCollapseAll","columnPivotChanged","gridColumnsChanged","columnValueChanged","columnMoved","columnVisible","columnPinned","columnGroupOpened","columnResized","displayedColumnsChanged","virtualColumnsChanged","columnHeaderMouseOver","columnHeaderMouseLeave","columnHeaderClicked","columnHeaderContextMenu","asyncTransactionsFlushed","rowGroupOpened","rowDataUpdated","pinnedRowDataChanged","rangeSelectionChanged","cellSelectionChanged","chartCreated","chartRangeSelectionChanged","chartOptionsChanged","chartDestroyed","toolPanelVisibleChanged","toolPanelSizeChanged","modelUpdated","cutStart","cutEnd","pasteStart","pasteEnd","fillStart","fillEnd","cellSelectionDeleteStart","cellSelectionDeleteEnd","rangeDeleteStart","rangeDeleteEnd","undoStarted","undoEnded","redoStarted","redoEnded","cellClicked","cellDoubleClicked","cellMouseDown","cellContextMenu","cellValueChanged","cellEditRequest","rowValueChanged","headerFocused","cellFocused","rowSelected","selectionChanged","tooltipShow","tooltipHide","cellKeyDown","cellMouseOver","cellMouseOut","filterChanged","filterModified","filterOpened","advancedFilterBuilderVisibleChanged","sortChanged","virtualRowRemoved","rowClicked","rowDoubleClicked","gridReady","gridPreDestroyed","gridSizeChanged","viewportChanged","firstDataRendered","dragStarted","dragStopped","dragCancelled","rowEditingStarted","rowEditingStopped","cellEditingStarted","cellEditingStopped","bodyScroll","bodyScrollEnd","paginationChanged","componentStateChanged","storeRefreshed","stateUpdated","columnMenuVisibleChanged","contextMenuVisibleChanged","rowDragEnter","rowDragMove","rowDragLeave","rowDragEnd","rowDragCancel"],$l=[...un,"scrollbarWidthChanged","keyShortcutChangedCellStart","keyShortcutChangedCellEnd","pinnedHeightChanged","cellFocusCleared","fullWidthRowFocused","checkboxChanged","heightScaleChanged","suppressMovableColumns","suppressMenuHide","suppressFieldDotNotation","columnPanelItemDragStart","columnPanelItemDragEnd","bodyHeightChanged","columnContainerWidthChanged","displayedColumnsWidthChanged","scrollVisibilityChanged","scrollGapChanged","columnHoverChanged","flashCells","paginationPixelOffsetChanged","displayedRowsChanged","leftPinnedWidthChanged","rightPinnedWidthChanged","rowContainerHeightChanged","headerHeightChanged","columnGroupHeaderHeightChanged","columnHeaderHeightChanged","gridStylesChanged","storeUpdated","filterDestroyed","rowDataUpdateStarted","rowCountReady","advancedFilterEnabledChanged","dataTypesInferred","fieldValueChanged","fieldPickerValueSelected","richSelectListRowSelected","sideBarUpdated","alignedGridScroll","alignedGridColumn","gridOptionsChanged","chartTitleEdit","recalculateRowBounds","stickyTopOffsetChanged","overlayExclusiveChanged"],_l={enableBrowserTooltips:!0,tooltipTrigger:!0,tooltipMouseTrack:!0,tooltipShowMode:!0,tooltipInteraction:!0,defaultColGroupDef:!0,suppressAutoSize:!0,skipHeaderOnAutoSize:!0,autoSizeStrategy:!0,components:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,undoRedoCellEditingLimit:!0,excelStyles:!0,cacheQuickFilter:!0,advancedFilterModel:!0,customChartThemes:!0,chartThemeOverrides:!0,chartToolPanelsDef:!0,loadingCellRendererSelector:!0,localeText:!0,keepDetailRows:!0,keepDetailRowsCount:!0,detailRowHeight:!0,detailRowAutoHeight:!0,tabIndex:!0,valueCache:!0,valueCacheNeverExpires:!0,enableCellExpressions:!0,suppressTouch:!0,suppressAsyncEvents:!0,suppressBrowserResizeObserver:!0,suppressPropertyNamesCheck:!0,debug:!0,dragAndDropImageComponent:!0,loadingOverlayComponent:!0,suppressLoadingOverlay:!0,noRowsOverlayComponent:!0,paginationPageSizeSelector:!0,paginateChildRows:!0,pivotPanelShow:!0,pivotSuppressAutoColumn:!0,suppressExpandablePivotGroups:!0,aggFuncs:!0,suppressAggFuncInHeader:!0,allowShowChangeAfterFilter:!0,ensureDomOrder:!0,enableRtl:!0,suppressColumnVirtualisation:!0,suppressMaxRenderedRowRestriction:!0,suppressRowVirtualisation:!0,rowDragText:!0,suppressGroupMaintainValueType:!0,groupLockGroupColumns:!0,rowGroupPanelSuppressSort:!0,suppressGroupRowsSticky:!0,rowModelType:!0,cacheOverflowSize:!0,infiniteInitialRowCount:!0,serverSideInitialRowCount:!0,suppressServerSideInfiniteScroll:!0,maxBlocksInCache:!0,maxConcurrentDatasourceRequests:!0,blockLoadDebounceMillis:!0,serverSideOnlyRefreshFilteredGroups:!0,serverSidePivotResultFieldSeparator:!0,viewportRowModelPageSize:!0,viewportRowModelBufferSize:!0,debounceVerticalScrollbar:!0,suppressAnimationFrame:!0,suppressPreventDefaultOnMouseWheel:!0,scrollbarWidth:!0,icons:!0,suppressRowTransform:!0,gridId:!0,enableGroupEdit:!0,initialState:!0,processUnpinnedColumns:!0,createChartContainer:!0,getLocaleText:!0,getRowId:!0,reactiveCustomComponents:!0,columnMenu:!0,suppressSetFilterByDefault:!0},ve=class{};ve.STRING_PROPERTIES=["overlayLoadingTemplate","overlayNoRowsTemplate","gridId","quickFilterText","rowModelType","editType","domLayout","clipboardDelimiter","rowGroupPanelShow","multiSortKey","pivotColumnGroupTotals","pivotRowTotals","pivotPanelShow","fillHandleDirection","groupDisplayType","treeDataDisplayType","colResizeDefault","tooltipTrigger","serverSidePivotResultFieldSeparator","columnMenu","tooltipShowMode","grandTotalRow"],ve.OBJECT_PROPERTIES=["components","rowStyle","context","autoGroupColumnDef","localeText","icons","datasource","dragAndDropImageComponentParams","serverSideDatasource","viewportDatasource","groupRowRendererParams","aggFuncs","fullWidthCellRendererParams","defaultColGroupDef","defaultColDef","defaultCsvExportParams","defaultExcelExportParams","columnTypes","rowClassRules","detailCellRendererParams","loadingCellRendererParams","loadingOverlayComponentParams","noRowsOverlayComponentParams","popupParent","statusBar","sideBar","theme","chartThemeOverrides","customChartThemes","chartToolPanelsDef","dataTypeDefinitions","advancedFilterModel","advancedFilterParent","advancedFilterBuilderParams","initialState","autoSizeStrategy","cellSelection","selectionColumnDef"],ve.ARRAY_PROPERTIES=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector"],ve.NUMBER_PROPERTIES=["rowHeight","detailRowHeight","rowBuffer","headerHeight","groupHeaderHeight","groupLockGroupColumns","floatingFiltersHeight","pivotHeaderHeight","pivotGroupHeaderHeight","groupDefaultExpanded","pivotDefaultExpanded","viewportRowModelPageSize","viewportRowModelBufferSize","autoSizePadding","maxBlocksInCache","maxConcurrentDatasourceRequests","tooltipShowDelay","tooltipHideDelay","cacheOverflowSize","paginationPageSize","cacheBlockSize","infiniteInitialRowCount","serverSideInitialRowCount","scrollbarWidth","asyncTransactionWaitMillis","blockLoadDebounceMillis","keepDetailRowsCount","undoRedoCellEditingLimit","cellFlashDelay","cellFadeDelay","cellFlashDuration","cellFadeDuration","tabIndex","pivotMaxGeneratedColumns"],ve.BOOLEAN_PROPERTIES=["suppressMakeColumnVisibleAfterUnGroup","suppressRowClickSelection","suppressCellFocus","suppressHeaderFocus","suppressHorizontalScroll","groupSelectsChildren","alwaysShowHorizontalScroll","alwaysShowVerticalScroll","debug","enableBrowserTooltips","enableCellExpressions","groupIncludeTotalFooter","groupSuppressBlankHeader","suppressMenuHide","suppressRowDeselection","unSortIcon","suppressMultiSort","alwaysMultiSort","singleClickEdit","suppressLoadingOverlay","suppressNoRowsOverlay","suppressAutoSize","skipHeaderOnAutoSize","suppressColumnMoveAnimation","suppressMoveWhenColumnDragging","suppressMovableColumns","suppressFieldDotNotation","enableRangeSelection","enableRangeHandle","enableFillHandle","suppressClearOnFillReduction","deltaSort","suppressTouch","suppressAsyncEvents","allowContextMenuWithControlKey","suppressContextMenu","enableCellChangeFlash","suppressDragLeaveHidesColumns","suppressRowGroupHidesColumns","suppressMiddleClickScrolls","suppressPreventDefaultOnMouseWheel","suppressCopyRowsToClipboard","copyHeadersToClipboard","copyGroupHeadersToClipboard","pivotMode","suppressAggFuncInHeader","suppressColumnVirtualisation","alwaysAggregateAtRootLevel","suppressFocusAfterRefresh","functionsReadOnly","animateRows","groupSelectsFiltered","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","enableRtl","suppressClickEdit","rowDragEntireRow","rowDragManaged","suppressRowDrag","suppressMoveWhenRowDragging","rowDragMultiRow","enableGroupEdit","embedFullWidthRows","suppressPaginationPanel","groupHideOpenParents","groupAllowUnbalanced","pagination","paginationAutoPageSize","suppressScrollOnNewData","suppressScrollWhenPopupsAreOpen","purgeClosedRowNodes","cacheQuickFilter","includeHiddenColumnsInQuickFilter","ensureDomOrder","accentedSort","suppressChangeDetection","valueCache","valueCacheNeverExpires","aggregateOnlyChangedColumns","suppressAnimationFrame","suppressExcelExport","suppressCsvExport","includeHiddenColumnsInAdvancedFilter","suppressMultiRangeSelection","enterNavigatesVerticallyAfterEdit","enterNavigatesVertically","suppressPropertyNamesCheck","rowMultiSelectWithClick","suppressRowHoverHighlight","suppressRowTransform","suppressClipboardPaste","suppressLastEmptyLineOnPaste","enableCharts","suppressMaintainUnsortedOrder","enableCellTextSelection","suppressBrowserResizeObserver","suppressMaxRenderedRowRestriction","excludeChildrenWhenTreeDataFiltering","tooltipMouseTrack","tooltipInteraction","keepDetailRows","paginateChildRows","preventDefaultOnContextMenu","undoRedoCellEditing","allowDragFromColumnsToolPanel","pivotSuppressAutoColumn","suppressExpandablePivotGroups","debounceVerticalScrollbar","detailRowAutoHeight","serverSideSortAllLevels","serverSideEnableClientSideSort","serverSideOnlyRefreshFilteredGroups","serverSideSortOnServer","serverSideFilterOnServer","suppressAggFilteredOnly","showOpenedGroup","suppressClipboardApi","suppressModelUpdateAfterUpdateTransaction","stopEditingWhenCellsLoseFocus","groupMaintainOrder","columnHoverHighlight","readOnlyEdit","suppressRowVirtualisation","enableCellEditingOnBackspace","resetRowDataOnUpdate","removePivotHeaderRowWhenSingleValueColumn","suppressCopySingleCellRanges","suppressGroupRowsSticky","suppressCutToClipboard","suppressServerSideInfiniteScroll","rowGroupPanelSuppressSort","allowShowChangeAfterFilter","enableAdvancedFilter","masterDetail","treeData","suppressGroupMaintainValueType","reactiveCustomComponents","applyQuickFilterBeforePivotOrAgg","suppressServerSideFullWidthLoadingRow","suppressAdvancedFilterEval","loading","maintainColumnOrder","enableStrictPivotColumnOrder","suppressSetFilterByDefault"],ve.OTHER_PROPERTIES=["suppressStickyTotalRow","loadThemeGoogleFonts","rowSelection"],ve.FUNCTION_PROPERTIES=["doesExternalFilterPass","processPivotResultColDef","processPivotResultColGroupDef","getBusinessKeyForNode","isRowSelectable","rowDragText","groupRowRenderer","dragAndDropImageComponent","fullWidthCellRenderer","loadingCellRenderer","loadingOverlayComponent","noRowsOverlayComponent","detailCellRenderer","quickFilterParser","quickFilterMatcher","getLocaleText","isExternalFilterPresent","getRowHeight","getRowClass","getRowStyle","getContextMenuItems","getMainMenuItems","processRowPostCreate","processCellForClipboard","getGroupRowAgg","isFullWidthRow","sendToClipboard","focusGridInnerElement","navigateToNextHeader","tabToNextHeader","navigateToNextCell","tabToNextCell","processCellFromClipboard","getDocument","postProcessPopup","getChildCount","getDataPath","isRowMaster","postSortRows","processHeaderForClipboard","processUnpinnedColumns","processGroupHeaderForClipboard","paginationNumberFormatter","processDataFromClipboard","getServerSideGroupKey","isServerSideGroup","createChartContainer","getChartToolbarItems","fillOperation","isApplyServerSideTransaction","getServerSideGroupLevelParams","isServerSideGroupOpenByDefault","isGroupOpenByDefault","initialGroupOrderComparator","groupIncludeFooter","loadingCellRendererSelector","getRowId","groupAggFiltering","chartMenuItems","groupTotalRow"],ve.ALL_PROPERTIES=[...ve.ARRAY_PROPERTIES,...ve.OBJECT_PROPERTIES,...ve.STRING_PROPERTIES,...ve.NUMBER_PROPERTIES,...ve.FUNCTION_PROPERTIES,...ve.BOOLEAN_PROPERTIES,...ve.OTHER_PROPERTIES];var li=ve,Ie=class{static getCallbackForEvent(e){return!e||e.length<2?e:"on"+e[0].toUpperCase()+e.substring(1)}};Ie.VUE_OMITTED_PROPERTY="AG-VUE-OMITTED-PROPERTY",Ie.PUBLIC_EVENTS=un,Ie.EVENT_CALLBACKS=$l.map(e=>Ie.getCallbackForEvent(e)),Ie.BOOLEAN_PROPERTIES=li.BOOLEAN_PROPERTIES,Ie.ALL_PROPERTIES=li.ALL_PROPERTIES,Ie.ALL_PROPERTIES_AND_CALLBACKS=[...Ie.ALL_PROPERTIES,...Ie.EVENT_CALLBACKS],Ie.ALL_PROPERTIES_AND_CALLBACKS_SET=new Set(Ie.ALL_PROPERTIES_AND_CALLBACKS);var ai=Ie,Vt=class extends b{};function hi(e,t,i){return i&&e.addDestroyFunc(()=>t.destroyBean(i)),i??e}var di=class{constructor(e){this.cssClassStates={},this.getGui=e}addCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach(i=>this.addCssClass(i));if(this.cssClassStates[e]!==!0&&e.length){const i=this.getGui();i&&i.classList.add(e),this.cssClassStates[e]=!0}}removeCssClass(e){const t=(e||"").split(" ");if(t.length>1)return void t.forEach(i=>this.removeCssClass(i));if(this.cssClassStates[e]!==!1&&e.length){const i=this.getGui();i&&i.classList.remove(e),this.cssClassStates[e]=!1}}containsCssClass(e){const t=this.getGui();return!!t&&t.classList.contains(e)}addOrRemoveCssClass(e,t){if(e){if(e.indexOf(" ")>=0){const i=(e||"").split(" ");if(i.length>1)return void i.forEach(s=>this.addOrRemoveCssClass(s,t))}if(this.cssClassStates[e]!==t&&e.length){const i=this.getGui();i&&i.classList.toggle(e,t),this.cssClassStates[e]=t}}}};function st(e,t,i){i==null||typeof i=="string"&&i==""?gn(e,t):je(e,t,i)}function je(e,t,i){e.setAttribute(pn(t),i.toString())}function gn(e,t){e.removeAttribute(pn(t))}function pn(e){return`aria-${e}`}function Ve(e,t){t?e.setAttribute("role",t):e.removeAttribute("role")}function Wt(e,t){st(e,"label",t)}function ci(e,t){st(e,"labelledby",t)}function mn(e,t){st(e,"live",t)}function Cn(e,t){st(e,"hidden",t)}function Bi(e,t){je(e,"expanded",t)}function fn(e,t){je(e,"colindex",t)}function Vi(e,t){st(e,"selected",t)}function Ts(e,t){return t===void 0?e("ariaIndeterminate","indeterminate"):t===!0?e("ariaChecked","checked"):e("ariaUnchecked","unchecked")}var vn="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function Is(e){const t=Element.prototype.matches||Element.prototype.msMatchesSelector,i=t.call(e,"input, select, button, textarea"),s=t.call(e,vn),o=qe(e);return i&&!s&&o}function le(e,t,i={}){const{skipAriaHidden:s}=i;e.classList.toggle("ag-hidden",!t),s||Cn(e,!t)}function ui(e,t){const i="disabled",s=t?o=>o.setAttribute(i,""):o=>o.removeAttribute(i);s(e),bn(e.querySelectorAll("input"),o=>s(o))}function zt(e,t,i){let s=0;for(;e;){if(e.classList.contains(t))return!0;if(e=e.parentElement,typeof i=="number"){if(++s>i)break}else if(e===i)break}return!1}function Ft(e){const{height:t,width:i,borderTopWidth:s,borderRightWidth:o,borderBottomWidth:n,borderLeftWidth:r,paddingTop:l,paddingRight:a,paddingBottom:h,paddingLeft:d,marginTop:c,marginRight:u,marginBottom:g,marginLeft:m,boxSizing:f}=window.getComputedStyle(e);return{height:parseFloat(t||"0"),width:parseFloat(i||"0"),borderTopWidth:parseFloat(s||"0"),borderRightWidth:parseFloat(o||"0"),borderBottomWidth:parseFloat(n||"0"),borderLeftWidth:parseFloat(r||"0"),paddingTop:parseFloat(l||"0"),paddingRight:parseFloat(a||"0"),paddingBottom:parseFloat(h||"0"),paddingLeft:parseFloat(d||"0"),marginTop:parseFloat(c||"0"),marginRight:parseFloat(u||"0"),marginBottom:parseFloat(g||"0"),marginLeft:parseFloat(m||"0"),boxSizing:f}}function Ls(e){const t=Ft(e);return t.boxSizing==="border-box"?t.height-t.paddingTop-t.paddingBottom:t.height}function gi(e){const t=Ft(e);return t.boxSizing==="border-box"?t.width-t.paddingLeft-t.paddingRight:t.width}function wn(e){const{height:t,marginBottom:i,marginTop:s}=Ft(e);return Math.floor(t+i+s)}function Wi(e){const{width:t,marginLeft:i,marginRight:s}=Ft(e);return Math.floor(t+i+s)}function Sn(e){const t=e.getBoundingClientRect(),{borderTopWidth:i,borderLeftWidth:s,borderRightWidth:o,borderBottomWidth:n}=Ft(e);return{top:t.top+(i||0),left:t.left+(s||0),right:t.right+(o||0),bottom:t.bottom+(n||0)}}function zi(e,t){let i=e.scrollLeft;return t&&(i=Math.abs(i)),i}function Ui(e,t,i){i&&(t*=-1),e.scrollLeft=t}function xe(e){for(;e&&e.firstChild;)e.removeChild(e.firstChild)}function Pt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function yn(e){return!!e.offsetParent}function qe(e){const t=e;return t.checkVisibility?t.checkVisibility({checkVisibilityCSS:!0}):!(!yn(e)||window.getComputedStyle(e).visibility!=="visible")}function pi(e){const t=document.createElement("div");return t.innerHTML=(e||"").trim(),t.firstChild}function Ki(e,t){t==="flex"?(e.style.removeProperty("width"),e.style.removeProperty("minWidth"),e.style.removeProperty("maxWidth"),e.style.flex="1 1 auto"):We(e,t)}function We(e,t){t=ks(t),e.style.width=t.toString(),e.style.maxWidth=t.toString(),e.style.minWidth=t.toString()}function mi(e,t){t=ks(t),e.style.height=t.toString(),e.style.maxHeight=t.toString(),e.style.minHeight=t.toString()}function ks(e){return typeof e=="number"?`${e}px`:e}function Os(e){return e instanceof Node||e instanceof HTMLElement}function Le(e,t,i){i==null||i===""?e.removeAttribute(t):e.setAttribute(t,i.toString())}function bn(e,t){if(e!=null)for(let i=0;i1),Vs}function Pn(){return!ot()||Rn()>=15}function $s(e){if(!e)return null;const t=e.tabIndex,i=e.getAttribute("tabIndex");return t!==-1||i!==null&&(i!==""||Ks())?t.toString():null}function Dn(){const e=document.body,t=document.createElement("div");t.style.width=t.style.height="100px",t.style.opacity="0",t.style.overflow="scroll",t.style.msOverflowStyle="scrollbar",t.style.position="absolute",e.appendChild(t);let i=t.offsetWidth-t.clientWidth;i===0&&t.clientWidth===0&&(i=null),t.parentNode&&t.parentNode.removeChild(t),i!=null&&(zs=i,Ws=i===0)}function En(){return Ws==null&&Dn(),Ws}var Mn=class Lt extends b{constructor(t,i,s,o){super(),this.parentComp=t,this.tooltipShowDelayOverride=i,this.tooltipHideDelayOverride=s,this.shouldDisplayTooltip=o,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans(t){this.popupService=t.popupService,this.userComponentFactory=t.userComponentFactory}postConstruct(){this.gos.get("tooltipInteraction")&&(this.interactionEnabled=!0),this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");const t=this.parentComp.getGui();this.tooltipTrigger===0&&this.addManagedListeners(t,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)}),this.tooltipTrigger===1&&this.addManagedListeners(t,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)}),this.addManagedListeners(t,{mousemove:this.onMouseMove.bind(this)}),this.interactionEnabled||this.addManagedListeners(t,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay(t){const i=this.gos.get(t);return i<0&&R(`${t} should not be lower than 0`),Math.max(200,i)}getTooltipDelay(t){return t==="show"?this.tooltipShowDelayOverride??this.getGridOptionsTooltipDelay("tooltipShowDelay"):this.tooltipHideDelayOverride??this.getGridOptionsTooltipDelay("tooltipHideDelay")}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){const t=this.gos.get("tooltipTrigger");return t&&t!=="hover"?1:0}onMouseEnter(t){this.interactionEnabled&&this.interactiveTooltipTimeoutId&&(this.unlockService(),this.startHideTimeout()),ct()||(Lt.isLocked?this.showTooltipTimeoutId=window.setTimeout(()=>{this.prepareToShowTooltip(t)},100):this.prepareToShowTooltip(t))}onMouseMove(t){this.lastMouseEvent&&(this.lastMouseEvent=t),this.tooltipMouseTrack&&this.state===2&&this.tooltipComp&&this.positionTooltip()}onMouseDown(){this.setToDoNothing()}onMouseLeave(){this.interactionEnabled?this.lockService():this.setToDoNothing()}onFocusIn(){this.prepareToShowTooltip()}onFocusOut(t){var n;const i=t.relatedTarget,s=this.parentComp.getGui(),o=(n=this.tooltipComp)==null?void 0:n.getGui();this.isInteractingWithTooltip||s.contains(i)||this.interactionEnabled&&(o!=null&&o.contains(i))||this.setToDoNothing()}onKeyDown(){this.isInteractingWithTooltip&&(this.isInteractingWithTooltip=!1),this.setToDoNothing()}prepareToShowTooltip(t){if(this.state!=0||Lt.isLocked)return;let i=0;t&&(i=this.isLastTooltipHiddenRecently()?200:this.getTooltipDelay("show")),this.lastMouseEvent=t||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),i),this.state=1}isLastTooltipHiddenRecently(){return new Date().getTime()-Lt.lastTooltipHideTime<1e3}setToDoNothing(t){t||this.state!==2||this.hideTooltip(),this.onBodyScrollEventCallback&&(this.onBodyScrollEventCallback(),this.onBodyScrollEventCallback=void 0),this.onColumnMovedEventCallback&&(this.onColumnMovedEventCallback(),this.onColumnMovedEventCallback=void 0),this.onDocumentKeyDownCallback&&(this.onDocumentKeyDownCallback(),this.onDocumentKeyDownCallback=void 0),this.clearTimeouts(),this.state=0,this.lastMouseEvent=null}showTooltip(){const t={...this.parentComp.getTooltipParams()};if(!M(t.value)||this.shouldDisplayTooltip&&!this.shouldDisplayTooltip())return void this.setToDoNothing();this.state=2,this.tooltipInstanceCount++;const i=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.userComponentFactory.getTooltipCompDetails(t).newAgStackInstance().then(i)}hideTooltip(t){!t&&this.isInteractingWithTooltip||(this.tooltipComp&&(this.destroyTooltipComp(),Lt.lastTooltipHideTime=new Date().getTime()),this.eventService.dispatchEvent({type:"tooltipHide",parentGui:this.parentComp.getGui()}),t&&(this.isInteractingWithTooltip=!1),this.setToDoNothing(!0))}newTooltipComponentCallback(t,i){if(this.state!==2||this.tooltipInstanceCount!==t)return void this.destroyBean(i);const s=i.getGui();this.tooltipComp=i,s.classList.contains("ag-tooltip")||s.classList.add("ag-tooltip-custom"),this.tooltipTrigger===0&&s.classList.add("ag-tooltip-animate"),this.interactionEnabled&&s.classList.add("ag-tooltip-interactive");const o=this.localeService.getLocaleTextFunc(),n=this.popupService.addPopup({eChild:s,ariaLabel:o("ariaLabelTooltip","Tooltip")});if(n&&(this.tooltipPopupDestroyFunc=n.hideFunc),this.positionTooltip(),this.tooltipTrigger===1){const r=()=>this.setToDoNothing();[this.onBodyScrollEventCallback,this.onColumnMovedEventCallback]=this.addManagedEventListeners({bodyScroll:r,columnMoved:r})}this.interactionEnabled&&([this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener]=this.addManagedElementListeners(s,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(ae(this.gos),{keydown:r=>{s.contains(r==null?void 0:r.target)||this.onKeyDown()}}),this.tooltipTrigger===1&&([this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(s,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)}))),this.eventService.dispatchEvent({type:"tooltipShow",tooltipGui:s,parentGui:this.parentComp.getGui()}),this.startHideTimeout()}onTooltipMouseEnter(){this.isInteractingWithTooltip=!0,this.unlockService()}onTooltipMouseLeave(){this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,this.lockService())}onTooltipFocusIn(){this.isInteractingWithTooltip=!0}isTooltipFocused(){var s;const t=(s=this.tooltipComp)==null?void 0:s.getGui(),i=re(this.gos);return!!t&&t.contains(i)}onTooltipFocusOut(t){const i=this.parentComp.getGui();this.isTooltipFocused()||(this.isInteractingWithTooltip=!1,i.contains(t.relatedTarget)?this.startHideTimeout():this.hideTooltip())}positionTooltip(){const t={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};this.lastMouseEvent?this.popupService.positionPopupUnderMouseEvent({...t,mouseEvent:this.lastMouseEvent}):this.popupService.positionPopupByComponent({...t,eventSource:this.parentComp.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");const t=this.tooltipPopupDestroyFunc,i=this.tooltipComp,s=this.tooltipTrigger===0?1e3:0;window.setTimeout(()=>{t(),this.destroyBean(i)},s),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener].forEach(t=>{t&&t()}),this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){Lt.isLocked=!0,this.interactiveTooltipTimeoutId=window.setTimeout(()=>{this.unlockService(),this.setToDoNothing()},100)}unlockService(){Lt.isLocked=!1,this.clearInteractiveTimeout()}startHideTimeout(){this.clearHideTimeout(),this.hideTooltipTimeoutId=window.setTimeout(this.hideTooltip.bind(this),this.getTooltipDelay("hide"))}clearShowTimeout(){this.showTooltipTimeoutId&&(window.clearTimeout(this.showTooltipTimeoutId),this.showTooltipTimeoutId=void 0)}clearHideTimeout(){this.hideTooltipTimeoutId&&(window.clearTimeout(this.hideTooltipTimeoutId),this.hideTooltipTimeoutId=void 0)}clearInteractiveTimeout(){this.interactiveTooltipTimeoutId&&(window.clearTimeout(this.interactiveTooltipTimeoutId),this.interactiveTooltipTimeoutId=void 0)}clearTimeouts(){this.clearShowTimeout(),this.clearHideTimeout(),this.clearInteractiveTimeout()}};Mn.isLocked=!1;var jl=Mn,Kt=class extends b{constructor(e,t){super(),this.ctrl=e,t&&(this.beans=t)}wireBeans(e){this.beans=e}postConstruct(){this.refreshToolTip()}setBrowserTooltip(e){const t="title",i=this.ctrl.getGui();i&&(e!=null&&e!=""?i.setAttribute(t,e):i.removeAttribute(t))}updateTooltipText(){this.tooltip=this.ctrl.getTooltipValue()}createTooltipFeatureIfNeeded(){var t,i,s,o;if(this.tooltipManager!=null)return;const e={getTooltipParams:()=>this.getTooltipParams(),getGui:()=>this.ctrl.getGui()};this.tooltipManager=this.createBean(new jl(e,(i=(t=this.ctrl).getTooltipShowDelayOverride)==null?void 0:i.call(t),(o=(s=this.ctrl).getTooltipHideDelayOverride)==null?void 0:o.call(s),this.ctrl.shouldDisplayTooltip),this.beans.context)}refreshToolTip(){this.browserTooltips=this.beans.gos.get("enableBrowserTooltips"),this.updateTooltipText(),this.browserTooltips?(this.setBrowserTooltip(this.tooltip),this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context))):(this.setBrowserTooltip(null),this.createTooltipFeatureIfNeeded())}getTooltipParams(){var o,n,r,l,a;const e=this.ctrl,t=(o=e.getColumn)==null?void 0:o.call(e),i=(n=e.getColDef)==null?void 0:n.call(e),s=(r=e.getRowNode)==null?void 0:r.call(e);return{location:e.getLocation(),colDef:i,column:t,rowIndex:(l=e.getRowIndex)==null?void 0:l.call(e),node:s,data:s==null?void 0:s.data,value:this.getTooltipText(),valueFormatted:(a=e.getValueFormatted)==null?void 0:a.call(e),hideTooltipCallback:()=>{var h;return(h=this.tooltipManager)==null?void 0:h.hideTooltip(!0)}}}getTooltipText(){return this.tooltip}destroy(){this.tooltipManager&&(this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context)),super.destroy()}},ql=new Ut,O=null,ee=class hl extends b{constructor(t,i){super(),this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=ql.next(),this.cssClassManager=new di(()=>this.eGui),this.componentSelectors=new Map((i??[]).map(s=>[s.selector,s])),t&&this.setTemplate(t)}preWireBeans(t){super.preWireBeans(t)}preConstruct(){this.usingBrowserTooltips=this.gos.get("enableBrowserTooltips"),this.wireTemplate(this.getGui())}wireTemplate(t,i){t&&this.gos&&(this.applyElementsToComponent(t),this.createChildComponentsFromTags(t,i))}getCompId(){return this.compId}getTooltipParams(){return{value:this.tooltipText,location:"UNKNOWN"}}setTooltip(t){const{newTooltipText:i,showDelayOverride:s,hideDelayOverride:o,location:n,shouldDisplayTooltip:r}=t||{};this.tooltipFeature&&(this.tooltipFeature=this.destroyBean(this.tooltipFeature)),this.tooltipText!==i&&(this.tooltipText=i);const l=()=>this.tooltipText;i!=null&&(this.tooltipFeature=this.createBean(new Kt({getTooltipValue:l,getGui:()=>this.getGui(),getLocation:()=>n??"UNKNOWN",getColDef:t==null?void 0:t.getColDef,getColumn:t==null?void 0:t.getColumn,getTooltipShowDelayOverride:s!=null?()=>s:void 0,getTooltipHideDelayOverride:o!=null?()=>o:void 0,shouldDisplayTooltip:r})))}getDataRefAttribute(t){return t.getAttribute?t.getAttribute("data-ref"):null}applyElementsToComponent(t,i,s,o=null){if(i===void 0&&(i=this.getDataRefAttribute(t)),i){const n=this[i];if(n===O)this[i]=o??t;else{const r=s&&s[i];this.suppressDataRefValidation||r||R(`Issue with data-ref: ${i} on ${this.constructor.name} with ${n}`)}}}createChildComponentsFromTags(t,i){(function(s){if(s==null)return[];const o=[];return bn(s,n=>o.push(n)),o})(t.childNodes).forEach(s=>{if(!(s instanceof HTMLElement))return;const o=this.createComponentFromElement(s,n=>{n.getGui()&&this.copyAttributesFromNode(s,n.getGui())},i);if(o){if(o.addItems&&s.children.length){this.createChildComponentsFromTags(s,i);const n=Array.prototype.slice.call(s.children);o.addItems(n)}this.swapComponentForNode(o,t,s)}else s.childNodes&&this.createChildComponentsFromTags(s,i)})}createComponentFromElement(t,i,s){const o=t.nodeName,n=this.getDataRefAttribute(t),r=o.indexOf("AG-")===0,l=r?this.componentSelectors.get(o):null;let a=null;if(l){hl.elementGettingCreated=t;const h=s&&n?s[n]:void 0;a=new l.component(h),a.setParentComponent(this),this.createBean(a,null,i)}else r&&R(`Missing selector: ${o}`);return this.applyElementsToComponent(t,n,s,a),a}copyAttributesFromNode(t,i){(function(s,o){if(s)for(let n=0;ni.setAttribute(s,o))}swapComponentForNode(t,i,s){const o=t.getGui();i.replaceChild(o,s),i.insertBefore(document.createComment(s.nodeName),o),this.addDestroyFunc(this.destroyBean.bind(this,t))}activateTabIndex(t){const i=this.gos.get("tabIndex");t||(t=[]),t.length||t.push(this.getGui()),t.forEach(s=>s.setAttribute("tabindex",i.toString()))}setTemplate(t,i,s){const o=pi(t);this.setTemplateFromElement(o,i,s)}setTemplateFromElement(t,i,s,o=!1){if(this.eGui=t,this.suppressDataRefValidation=o,i)for(let n=0;nthis.eGui.removeEventListener(t,i))}addCssClass(t){this.cssClassManager.addCssClass(t)}removeCssClass(t){this.cssClassManager.removeCssClass(t)}containsCssClass(t){return this.cssClassManager.containsCssClass(t)}addOrRemoveCssClass(t,i){this.cssClassManager.addOrRemoveCssClass(t,i)}},xn={columnGroupOpened:"expanded",columnGroupClosed:"contracted",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate",columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",groupContracted:"tree-closed",groupExpanded:"tree-open",setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",chart:"chart",close:"cross",cancel:"cancel",check:"tick",first:"first",previous:"previous",next:"next",last:"last",linked:"linked",unlinked:"unlinked",colorPicker:"color-picker",groupLoading:"loading",menu:"menu",menuAlt:"menu-alt",filter:"filter",columns:"columns",maximize:"maximize",minimize:"minimize",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnDrag:"grip",rowDrag:"grip",save:"save",csvExport:"csv",excelExport:"excel",smallDown:"small-down",smallLeft:"small-left",smallRight:"small-right",smallUp:"small-up",sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",checkboxChecked:"checkbox-checked",checkboxIndeterminate:"checkbox-indeterminate",checkboxUnchecked:"checkbox-unchecked",radioButtonOn:"radio-button-on",radioButtonOff:"radio-button-off"},Ql=(()=>{const e=new Set(Object.values(xn));return e.add("eye"),e})();function Ae(e,t,i,s){let o=null;const n=i&&i.getColDef().icons;if(n&&(o=n[e]),t&&!o){const r=t.get("icons");r&&(o=r[e])}if(!o){const r=document.createElement("span");let l=xn[e]??(Ql.has(e)?e:void 0);return l||(R(`Did not find icon ${e}`),l=""),r.setAttribute("class",`ag-icon ag-icon-${l}`),r.setAttribute("unselectable","on"),Ve(r,"presentation"),r}{let r;if(typeof o=="function")r=o();else{if(typeof o!="string")throw new Error("icon from grid options needs to be a string or a function");r=o}if(typeof r=="string")return pi(r);if(Os(r))return r;R("iconRenderer should return back a string or a dom object")}}var Yl=class extends ee{constructor(){super(...arguments),this.dragSource=null,this.eIcon=O,this.eLabel=O}postConstruct(){const e=t=>function(i,s,o){const n=Ae(i,s,o);if(n){const{className:l}=n;if(typeof l=="string"&&l.indexOf("ag-icon")>-1||typeof l=="object"&&l["ag-icon"])return n}const r=document.createElement("span");return r.appendChild(n),r}(t,this.gos,null);this.dropIconMap={pinned:e("columnMovePin"),hide:e("columnMoveHide"),move:e("columnMoveMove"),left:e("columnMoveLeft"),right:e("columnMoveRight"),group:e("columnMoveGroup"),aggregate:e("columnMoveValue"),pivot:e("columnMovePivot"),notAllowed:e("dropNotAllowed")}}init(e){this.dragSource=e.dragSource,this.setTemplate(`
+ +
+
`)}destroy(){this.dragSource=null,super.destroy()}setIcon(e,t=!1){var s,o;xe(this.eIcon);let i=null;e||(e=(s=this.dragSource)!=null&&s.getDefaultIconName?(o=this.dragSource)==null?void 0:o.getDefaultIconName():"notAllowed"),i=this.dropIconMap[e],this.eIcon.classList.toggle("ag-shake-left-to-right",t),i===this.dropIconMap.hide&&this.gos.get("suppressDragLeaveHidesColumns")||i&&this.eIcon.appendChild(i)}setLabel(e){this.eLabel.textContent=_e(e)}};function An(e,t,i){if(i===0)return!1;const s=Math.abs(e.clientX-t.clientX),o=Math.abs(e.clientY-t.clientY);return Math.max(s,o)<=i}var ut=class{constructor(e,t=!1){this.DOUBLE_TAP_MILLIS=500,this.destroyFuncs=[],this.touching=!1,this.localEventService=new Ot,this.eElement=e,this.preventMouseClick=t;const i=this.onTouchStart.bind(this),s=this.onTouchMove.bind(this),o=this.onTouchEnd.bind(this);this.eElement.addEventListener("touchstart",i,{passive:!0}),this.eElement.addEventListener("touchmove",s,{passive:!0}),this.eElement.addEventListener("touchend",o,{passive:!1}),this.destroyFuncs.push(()=>{this.eElement.removeEventListener("touchstart",i,{passive:!0}),this.eElement.removeEventListener("touchmove",s,{passive:!0}),this.eElement.removeEventListener("touchend",o,{passive:!1})})}getActiveTouch(e){for(let t=0;t{const i=this.touchStart===t;if(this.touching&&i&&!this.moved){this.moved=!0;const s={type:"longTap",touchStart:this.touchStart,touchEvent:e};this.localEventService.dispatchEvent(s)}},500)}onTouchMove(e){if(!this.touching)return;const t=this.getActiveTouch(e.touches);t&&!An(t,this.touchStart,4)&&(this.moved=!0)}onTouchEnd(e){if(this.touching){if(!this.moved){const t={type:"tap",touchStart:this.touchStart};this.localEventService.dispatchEvent(t),this.checkForDoubleTap()}this.preventMouseClick&&e.cancelable&&e.preventDefault(),this.touching=!1}}checkForDoubleTap(){const e=new Date().getTime();if(this.lastTapTime&&this.lastTapTime>0)if(e-this.lastTapTime>this.DOUBLE_TAP_MILLIS){const t={type:"doubleTap",touchStart:this.touchStart};this.localEventService.dispatchEvent(t),this.lastTapTime=null}else this.lastTapTime=e;else this.lastTapTime=e}destroy(){this.destroyFuncs.forEach(e=>e())}};function Ci(e,t){return``}var Xl=` + ${Ci("Order","order")} + ${Ci("Asc","ascending-icon")} + ${Ci("Desc","descending-icon")} + ${Ci("Mixed","mixed-icon")} + ${Ci("None","none-icon")} + `,_s=class extends ee{constructor(e){super(),this.eSortOrder=O,this.eSortAsc=O,this.eSortDesc=O,this.eSortMixed=O,this.eSortNone=O,e||this.setTemplate(Xl)}wireBeans(e){this.sortController=e.sortController}attachCustomElements(e,t,i,s,o){this.eSortOrder=e,this.eSortAsc=t,this.eSortDesc=i,this.eSortMixed=s,this.eSortNone=o}setupSort(e,t=!1){if(this.column=e,this.suppressOrder=t,this.setupMultiSortIndicator(),!this.column.isSortable()&&!this.column.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,e),this.addInIcon("sortDescending",this.eSortDesc,e),this.addInIcon("sortUnSort",this.eSortNone,e);const i=this.updateIcons.bind(this),s=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",i),this.addManagedEventListeners({newColumnsLoaded:i,sortChanged:s,columnRowGroupChanged:s}),this.onSortChanged()}addInIcon(e,t,i){if(t==null)return;const s=Ae(e,this.gos,i);s&&t.appendChild(s)}onSortChanged(){this.updateIcons(),this.suppressOrder||this.updateSortOrder()}updateIcons(){const e=this.sortController.getDisplaySortForColumn(this.column);if(this.eSortAsc){const t=e==="asc";le(this.eSortAsc,t,{skipAriaHidden:!0})}if(this.eSortDesc){const t=e==="desc";le(this.eSortDesc,t,{skipAriaHidden:!0})}if(this.eSortNone){const t=!this.column.getColDef().unSortIcon&&!this.gos.get("unSortIcon"),i=e==null;le(this.eSortNone,!t&&i,{skipAriaHidden:!0})}}setupMultiSortIndicator(){this.addInIcon("sortUnSort",this.eSortMixed,this.column);const e=this.column.getColDef().showRowGroup;$e(this.gos)&&e&&(this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator())}updateMultiSortIndicator(){if(this.eSortMixed){const e=this.sortController.getDisplaySortForColumn(this.column)==="mixed";le(this.eSortMixed,e,{skipAriaHidden:!0})}}updateSortOrder(){if(!this.eSortOrder)return;const e=this.sortController.getColumnsWithSortingOrdered(),t=this.sortController.getDisplaySortIndexForColumn(this.column)??-1,i=e.some(o=>this.sortController.getDisplaySortIndexForColumn(o)??!1),s=t>=0&&i;le(this.eSortOrder,s,{skipAriaHidden:!0}),t>=0?this.eSortOrder.textContent=(t+1).toString():xe(this.eSortOrder)}},Jl={selector:"AG-SORT-INDICATOR",component:_s},js=class extends ee{constructor(){super(...arguments),this.eFilter=O,this.eFilterButton=O,this.eSortIndicator=O,this.eMenu=O,this.eLabel=O,this.eText=O,this.eSortOrder=O,this.eSortAsc=O,this.eSortDesc=O,this.eSortMixed=O,this.eSortNone=O,this.lastMovingChanged=0}wireBeans(e){this.sortController=e.sortController,this.menuService=e.menuService,this.funcColsService=e.funcColsService}destroy(){super.destroy()}refresh(e){const t=this.params;return this.params=e,this.workOutTemplate()==this.currentTemplate&&this.workOutShowMenu()==this.currentShowMenu&&this.workOutSort()==this.currentSort&&this.shouldSuppressMenuHide()==this.currentSuppressMenuHide&&t.enableFilterButton==e.enableFilterButton&&t.enableFilterIcon==e.enableFilterIcon&&(this.setDisplayName(e),!0)}workOutTemplate(){let e=this.params.template??``;return e=e&&e.trim?e.trim():e,e}init(e){this.params=e,this.currentTemplate=this.workOutTemplate(),this.setTemplate(this.currentTemplate,[Jl]),this.setupTap(),this.setMenu(),this.setupSort(),this.setupFilterIcon(),this.setupFilterButton(),this.setDisplayName(e)}setDisplayName(e){if(this.currentDisplayName!=e.displayName){this.currentDisplayName=e.displayName;const t=_e(this.currentDisplayName,!0);this.eText&&(this.eText.textContent=t)}}addInIcon(e,t,i){if(t==null)return;const s=Ae(e,this.gos,i);s&&t.appendChild(s)}setupTap(){const{gos:e}=this;if(e.get("suppressTouch"))return;const t=new ut(this.getGui(),!0),i=this.shouldSuppressMenuHide(),s=i&&M(this.eMenu),o=s?new ut(this.eMenu,!0):t;if(this.params.enableMenu){const n=s?"tap":"longTap",r=l=>this.params.showColumnMenuAfterMouseClick(l.touchStart);this.addManagedListeners(o,{[n]:r})}if(this.params.enableSorting){const n=r=>{var a,h;const l=r.touchStart.target;i&&((a=this.eMenu)!=null&&a.contains(l)||(h=this.eFilterButton)!=null&&h.contains(l))||this.sortController.progressSort(this.params.column,!1,"uiColumnSorted")};this.addManagedListeners(t,{tap:n})}if(this.params.enableFilterButton){const n=new ut(this.eFilterButton,!0);this.addManagedListeners(n,{tap:()=>this.params.showFilter(this.eFilterButton)}),this.addDestroyFunc(()=>n.destroy())}this.addDestroyFunc(()=>t.destroy()),s&&this.addDestroyFunc(()=>o.destroy())}workOutShowMenu(){return this.params.enableMenu&&this.menuService.isHeaderMenuButtonEnabled()}shouldSuppressMenuHide(){return this.menuService.isHeaderMenuButtonAlwaysShowEnabled()}setMenu(){if(!this.eMenu)return;if(this.currentShowMenu=this.workOutShowMenu(),!this.currentShowMenu)return Pt(this.eMenu),void(this.eMenu=void 0);const e=this.menuService.isLegacyMenuEnabled();this.addInIcon(e?"menu":"menuAlt",this.eMenu,this.params.column),this.eMenu.classList.toggle("ag-header-menu-icon",!e),this.currentSuppressMenuHide=this.shouldSuppressMenuHide(),this.addManagedElementListeners(this.eMenu,{click:()=>this.params.showColumnMenu(this.eMenu)}),this.eMenu.classList.toggle("ag-header-menu-always-show",this.currentSuppressMenuHide)}onMenuKeyboardShortcut(e){const t=this.params.column,i=this.menuService.isLegacyMenuEnabled();if(e&&!i){if(this.menuService.isFilterMenuInHeaderEnabled(t))return this.params.showFilter(this.eFilterButton??this.eMenu??this.getGui()),!0}else if(this.params.enableMenu)return this.params.showColumnMenu(this.eMenu??this.eFilterButton??this.getGui()),!0;return!1}workOutSort(){return this.params.enableSorting}setupSort(){if(this.currentSort=this.params.enableSorting,this.eSortIndicator||(this.eSortIndicator=this.createBean(new _s(!0)),this.eSortIndicator.attachCustomElements(this.eSortOrder,this.eSortAsc,this.eSortDesc,this.eSortMixed,this.eSortNone)),this.eSortIndicator.setupSort(this.params.column),!this.currentSort)return;this.addManagedListeners(this.params.column,{movingChanged:()=>{this.lastMovingChanged=new Date().getTime()}}),this.eLabel&&this.addManagedElementListeners(this.eLabel,{click:t=>{const i=this.params.column.isMoving(),s=new Date().getTime()-this.lastMovingChanged<50;if(!(i||s)){const o=this.gos.get("multiSortKey")==="ctrl"?t.ctrlKey||t.metaKey:t.shiftKey;this.params.progressSort(o)}}});const e=()=>{const t=this.params.column.getSort();if(this.addOrRemoveCssClass("ag-header-cell-sorted-asc",t==="asc"),this.addOrRemoveCssClass("ag-header-cell-sorted-desc",t==="desc"),this.addOrRemoveCssClass("ag-header-cell-sorted-none",!t),this.params.column.getColDef().showRowGroup){const i=this.funcColsService.getSourceColumnsForGroupColumn(this.params.column),s=i==null?void 0:i.every(n=>this.params.column.getSort()==n.getSort()),o=!s;this.addOrRemoveCssClass("ag-header-cell-sorted-mixed",o)}};this.addManagedEventListeners({sortChanged:e,columnRowGroupChanged:e})}setupFilterIcon(){this.eFilter&&this.configureFilter(this.params.enableFilterIcon,this.eFilter,this.onFilterChangedIcon.bind(this))}setupFilterButton(){this.eFilterButton&&(this.configureFilter(this.params.enableFilterButton,this.eFilterButton,this.onFilterChangedButton.bind(this))?this.addManagedElementListeners(this.eFilterButton,{click:()=>this.params.showFilter(this.eFilterButton)}):this.eFilterButton=void 0)}configureFilter(e,t,i){if(!e)return Pt(t),!1;const s=this.params.column;return this.addInIcon("filter",t,s),this.addManagedListeners(s,{filterChanged:i}),i(),!0}onFilterChangedIcon(){const e=this.params.column.isFilterActive();le(this.eFilter,e,{skipAriaHidden:!0})}onFilterChangedButton(){const e=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",e)}getAnchorElementForMenu(e){return e?this.eFilterButton??this.eMenu??this.getGui():this.eMenu??this.eFilterButton??this.getGui()}},Zl=class extends ee{constructor(){super(``),this.agOpened=O,this.agClosed=O,this.agLabel=O}wireBeans(e){this.columnModel=e.columnModel}destroy(){super.destroy()}init(e){this.params=e,this.checkWarnings(),this.setupLabel(),this.addGroupExpandIcon(),this.setupExpandIcons()}checkWarnings(){this.params.template&&R("A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)")}setupExpandIcons(){this.addInIcon("columnGroupOpened",this.agOpened),this.addInIcon("columnGroupClosed",this.agClosed);const e=o=>{if(et(o))return;const n=!this.params.columnGroup.isExpanded();this.columnModel.setColumnGroupOpened(this.params.columnGroup.getProvidedColumnGroup(),n,"uiColumnExpanded")};this.addTouchAndClickListeners(this.agClosed,e),this.addTouchAndClickListeners(this.agOpened,e);const t=o=>{Bt(o)};this.addManagedElementListeners(this.agClosed,{dblclick:t}),this.addManagedElementListeners(this.agOpened,{dblclick:t}),this.addManagedElementListeners(this.getGui(),{dblclick:e}),this.updateIconVisibility();const i=this.params.columnGroup.getProvidedColumnGroup(),s=this.updateIconVisibility.bind(this);this.addManagedListeners(i,{expandedChanged:s,expandableChanged:s})}addTouchAndClickListeners(e,t){const i=new ut(e,!0);this.addManagedListeners(i,{tap:t}),this.addDestroyFunc(()=>i.destroy()),this.addManagedElementListeners(e,{click:t})}updateIconVisibility(){if(this.params.columnGroup.isExpandable()){const e=this.params.columnGroup.isExpanded();le(this.agOpened,e),le(this.agClosed,!e)}else le(this.agOpened,!1),le(this.agClosed,!1)}addInIcon(e,t){const i=Ae(e,this.gos,null);i&&t.appendChild(i)}addGroupExpandIcon(){if(!this.params.columnGroup.isExpandable())return le(this.agOpened,!1),void le(this.agClosed,!1)}setupLabel(){var i;const{displayName:e,columnGroup:t}=this.params;if(M(e)){const s=_e(e,!0);this.agLabel.textContent=s}this.addOrRemoveCssClass("ag-sticky-label",!((i=t.getColGroupDef())!=null&&i.suppressStickyLabel))}},ea=class extends ee{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-change-delta");const i=document.createElement("span");i.setAttribute("class","ag-value-change-value"),e.appendChild(t),e.appendChild(i),this.setTemplateFromElement(e)}wireBeans(e){this.filterManager=e.filterManager}init(e){this.eValue=this.queryForHtmlElement(".ag-value-change-value"),this.eDelta=this.queryForHtmlElement(".ag-value-change-delta"),this.refresh(e,!0)}showDelta(e,t){const i=Math.abs(t),s=e.formatValue(i),o=M(s)?s:i,n=t>=0;this.eDelta.textContent=n?"\u2191"+o:"\u2193"+o,this.eDelta.classList.toggle("ag-value-change-delta-up",n),this.eDelta.classList.toggle("ag-value-change-delta-down",!n)}setTimerToRemoveDelta(){this.refreshCount++;const e=this.refreshCount;this.getFrameworkOverrides().wrapIncoming(()=>{window.setTimeout(()=>{e===this.refreshCount&&this.hideDeltaValue()},2e3)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),xe(this.eDelta)}refresh(e,t=!1){var s;const i=e.value;if(i===this.lastValue||(M(e.valueFormatted)?this.eValue.textContent=e.valueFormatted:M(e.value)?this.eValue.textContent=i:xe(this.eValue),(s=this.filterManager)==null?void 0:s.isSuppressFlashingCellsBecauseFiltering()))return!1;if(typeof i=="number"&&typeof this.lastValue=="number"){const o=i-this.lastValue;this.showDelta(e,o)}return this.lastValue&&this.eValue.classList.add("ag-value-change-value-highlight"),t||this.setTimerToRemoveDelta(),this.lastValue=i,!0}},ta=class extends ee{constructor(){super(),this.refreshCount=0;const e=document.createElement("span"),t=document.createElement("span");t.setAttribute("class","ag-value-slide-current"),e.appendChild(t),this.setTemplateFromElement(e),this.eCurrent=this.queryForHtmlElement(".ag-value-slide-current")}wireBeans(e){this.filterManager=e.filterManager}init(e){this.refresh(e,!0)}addSlideAnimation(){this.refreshCount++;const e=this.refreshCount;this.ePrevious&&this.getGui().removeChild(this.ePrevious);const t=document.createElement("span");t.setAttribute("class","ag-value-slide-previous ag-value-slide-out"),this.ePrevious=t,this.ePrevious.textContent=this.eCurrent.textContent,this.getGui().insertBefore(this.ePrevious,this.eCurrent),this.getFrameworkOverrides().wrapIncoming(()=>{window.setTimeout(()=>{e===this.refreshCount&&this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{e===this.refreshCount&&(this.getGui().removeChild(this.ePrevious),this.ePrevious=null)},3e3)})}refresh(e,t=!1){var s;let i=e.value;return K(i)&&(i=""),i!==this.lastValue&&!((s=this.filterManager)!=null&&s.isSuppressFlashingCellsBecauseFiltering())&&(t||this.addSlideAnimation(),this.lastValue=i,M(e.valueFormatted)?this.eCurrent.textContent=e.valueFormatted:M(e.value)?this.eCurrent.textContent=i:xe(this.eCurrent),!0)}},y=class{};y.BACKSPACE="Backspace",y.TAB="Tab",y.ENTER="Enter",y.ESCAPE="Escape",y.SPACE=" ",y.LEFT="ArrowLeft",y.UP="ArrowUp",y.RIGHT="ArrowRight",y.DOWN="ArrowDown",y.DELETE="Delete",y.F2="F2",y.PAGE_UP="PageUp",y.PAGE_DOWN="PageDown",y.PAGE_HOME="Home",y.PAGE_END="End",y.A="KeyA",y.C="KeyC",y.D="KeyD",y.V="KeyV",y.X="KeyX",y.Y="KeyY",y.Z="KeyZ";var ia=class extends ee{constructor(e,t,i){super(t,i),this.labelSeparator="",this.labelAlignment="left",this.disabled=!1,this.label="",this.config=e||{}}postConstruct(){this.addCssClass("ag-labeled"),this.eLabel.classList.add("ag-label");const{labelSeparator:e,label:t,labelWidth:i,labelAlignment:s,disabled:o}=this.config;o!=null&&this.setDisabled(o),e!=null&&this.setLabelSeparator(e),t!=null&&this.setLabel(t),i!=null&&this.setLabelWidth(i),this.setLabelAlignment(s||this.labelAlignment),this.refreshLabel()}refreshLabel(){xe(this.eLabel),typeof this.label=="string"?this.eLabel.innerText=this.label+this.labelSeparator:this.label&&this.eLabel.appendChild(this.label),this.label===""?(le(this.eLabel,!1),Ve(this.eLabel,"presentation")):(le(this.eLabel,!0),Ve(this.eLabel,null))}setLabelSeparator(e){return this.labelSeparator===e||(this.labelSeparator=e,this.label!=null&&this.refreshLabel()),this}getLabelId(){return this.eLabel.id=this.eLabel.id||`ag-${this.getCompId()}-label`,this.eLabel.id}getLabel(){return this.label}setLabel(e){return this.label===e||(this.label=e,this.refreshLabel()),this}setLabelAlignment(e){const t=this.getGui().classList;return t.toggle("ag-label-align-left",e==="left"),t.toggle("ag-label-align-right",e==="right"),t.toggle("ag-label-align-top",e==="top"),this}setLabelEllipsis(e){return this.eLabel.classList.toggle("ag-label-ellipsis",e),this}setLabelWidth(e){return this.label==null||Ki(this.eLabel,e),this}setDisabled(e){e=!!e;const t=this.getGui();return ui(t,e),t.classList.toggle("ag-disabled",e),this.disabled=e,this}isDisabled(){return!!this.disabled}},Tn=class extends ia{constructor(e,t,i,s){super(e,t,i),this.className=s}postConstruct(){super.postConstruct();const{width:e,value:t,onValueChange:i}=this.config;e!=null&&this.setWidth(e),t!=null&&this.setValue(t),i!=null&&this.onValueChange(i),this.className&&this.addCssClass(this.className),this.refreshAriaLabelledBy()}setLabel(e){return super.setLabel(e),this.refreshAriaLabelledBy(),this}refreshAriaLabelledBy(){const e=this.getAriaElement(),t=this.getLabelId(),i=this.getLabel();i==null||i==""||e.getAttribute("aria-label")!==null?ci(e,""):ci(e,t??"")}setAriaLabel(e){return Wt(this.getAriaElement(),e),this.refreshAriaLabelledBy(),this}onValueChange(e){return this.addManagedListeners(this,{fieldValueChanged:()=>e(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth(e){return We(this.getGui(),e),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue(e,t){return this.value===e||(this.previousValue=this.value,this.value=e,t||this.dispatchLocalEvent({type:"fieldValueChanged"})),this}},Dt=class extends Tn{constructor(e,t,i="text",s="input"){super(e,(e==null?void 0:e.template)??` +
+
+ +
`,[],t),this.inputType=i,this.displayFieldTag=s,this.eLabel=O,this.eWrapper=O,this.eInput=O}postConstruct(){super.postConstruct(),this.setInputType(),this.eLabel.classList.add(`${this.className}-label`),this.eWrapper.classList.add(`${this.className}-input-wrapper`),this.eInput.classList.add(`${this.className}-input`),this.addCssClass("ag-input-field"),this.eInput.id=this.eInput.id||`ag-${this.getCompId()}-input`;const{inputName:e,inputWidth:t}=this.config;e!=null&&this.setInputName(e),t!=null&&this.setInputWidth(t),this.addInputListeners(),this.activateTabIndex([this.eInput])}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:e=>this.setValue(e.target.value)})}setInputType(){this.displayFieldTag==="input"&&this.eInput.setAttribute("type",this.inputType)}getInputElement(){return this.eInput}setInputWidth(e){return Ki(this.eWrapper,e),this}setInputName(e){return this.getInputElement().setAttribute("name",e),this}getFocusableElement(){return this.eInput}setMaxLength(e){return this.eInput.maxLength=e,this}setInputPlaceholder(e){return Le(this.eInput,"placeholder",e),this}setInputAriaLabel(e){return Wt(this.eInput,e),this.refreshAriaLabelledBy(),this}setDisabled(e){return ui(this.eInput,e),super.setDisabled(e)}setAutoComplete(e){if(e===!0)Le(this.eInput,"autocomplete",null);else{const t=typeof e=="string"?e:"off";Le(this.eInput,"autocomplete",t)}return this}},qs=class extends Dt{constructor(e,t="ag-checkbox",i="checkbox"){super(e,t,i),this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();const{readOnly:e,passive:t}=this.config;typeof e=="boolean"&&this.setReadOnly(e),typeof t=="boolean"&&this.setPassive(t)}addInputListeners(){this.addManagedElementListeners(this.eInput,{click:this.onCheckboxClick.bind(this)}),this.addManagedElementListeners(this.eLabel,{click:this.toggle.bind(this)})}getNextValue(){return this.selected===void 0||!this.selected}setPassive(e){this.passive=e}isReadOnly(){return this.readOnly}setReadOnly(e){this.eWrapper.classList.toggle("ag-disabled",e),this.eInput.disabled=e,this.readOnly=e}setDisabled(e){return this.eWrapper.classList.toggle("ag-disabled",e),super.setDisabled(e)}toggle(){if(this.eInput.disabled)return;const e=this.isSelected(),t=this.getNextValue();this.passive?this.dispatchChange(t,e):this.setValue(t)}getValue(){return this.isSelected()}setValue(e,t){return this.refreshSelectedClass(e),this.setSelected(e,t),this}setName(e){return this.getInputElement().name=e,this}isSelected(){return this.selected}setSelected(e,t){this.isSelected()!==e&&(this.previousValue=this.isSelected(),e=this.selected=typeof e=="boolean"?e:void 0,this.eInput.checked=e,this.eInput.indeterminate=e===void 0,t||this.dispatchChange(this.selected,this.previousValue))}dispatchChange(e,t,i){this.dispatchLocalEvent({type:"fieldValueChanged",selected:e,previousValue:t,event:i});const s=this.getInputElement();this.eventService.dispatchEvent({type:"checkboxChanged",id:s.id,name:s.name,selected:e,previousValue:t})}onCheckboxClick(e){if(this.passive||this.eInput.disabled)return;const t=this.isSelected(),i=this.selected=e.target.checked;this.refreshSelectedClass(i),this.dispatchChange(i,t,e)}refreshSelectedClass(e){this.eWrapper.classList.toggle("ag-checked",e===!0),this.eWrapper.classList.toggle("ag-indeterminate",e==null)}},Qs={selector:"AG-CHECKBOX",component:qs},sa=class extends ee{constructor(){super(` + `,[Qs]),this.eCheckbox=O}init(e){this.refresh(e);const t=this.eCheckbox.getInputElement();t.setAttribute("tabindex","-1"),mn(t,"polite"),this.addManagedListeners(t,{click:i=>{if(Bt(i),this.eCheckbox.isDisabled())return;const s=this.eCheckbox.getValue();this.onCheckboxChanged(s)},dblclick:i=>{Bt(i)}}),this.addManagedElementListeners(this.params.eGridCell,{keydown:i=>{if(i.key===y.SPACE&&!this.eCheckbox.isDisabled()){this.params.eGridCell===re(this.gos)&&this.eCheckbox.toggle();const s=this.eCheckbox.getValue();this.onCheckboxChanged(s),i.preventDefault()}}})}refresh(e){return this.params=e,this.updateCheckbox(e),!0}updateCheckbox(e){var l;let t,i=!0;if(e.node.group&&e.column)if(typeof e.value=="boolean")t=e.value;else{const a=e.column.getColId();a.startsWith(Ni)?t=e.value==null||e.value===""?void 0:e.value==="true":e.node.aggData&&e.node.aggData[a]!==void 0?t=e.value??void 0:i=!1}else t=e.value??void 0;if(!i)return void this.eCheckbox.setDisplayed(!1);this.eCheckbox.setValue(t);const s=e.disabled!=null?e.disabled:!((l=e.column)!=null&&l.isCellEditable(e.node));this.eCheckbox.setDisabled(s);const o=this.localeService.getLocaleTextFunc(),n=Ts(o,t),r=s?n:`${o("ariaToggleCellValue","Press SPACE to toggle cell value")} (${n})`;this.eCheckbox.setInputAriaLabel(r)}onCheckboxChanged(e){const{column:t,node:i,value:s}=this.params;this.eventService.dispatchEvent({type:"cellEditingStarted",column:t,colDef:t==null?void 0:t.getColDef(),data:i.data,node:i,rowIndex:i.rowIndex,rowPinned:i.rowPinned,value:s});const o=this.params.node.setDataValue(this.params.column,e,"edit");this.eventService.dispatchEvent({type:"cellEditingStopped",column:t,colDef:t==null?void 0:t.getColDef(),data:i.data,node:i,rowIndex:i.rowIndex,rowPinned:i.rowPinned,value:s,oldValue:s,newValue:e,valueChanged:o}),o||this.updateCheckbox(this.params)}},oa=class extends ee{constructor(){super(`
+ + +
`),this.eLoadingIcon=O,this.eLoadingText=O}init(e){e.node.failedLoad?this.setupFailed():this.setupLoading()}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=e("loadingError","ERR")}setupLoading(){const e=Ae("groupLoading",this.gos,null);e&&this.eLoadingIcon.appendChild(e);const t=this.localeService.getLocaleTextFunc();this.eLoadingText.innerText=t("loadingOoo","Loading")}refresh(e){return!1}destroy(){super.destroy()}},na=class extends ee{constructor(){super('
')}init(e){const t=`ag-cell-skeleton-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",t),this.addDestroyFunc(()=>ci(e.eParentOfValue)),ci(e.eParentOfValue,t),e.node.failedLoad?this.setupFailed():this.setupLoading(e)}setupFailed(){const e=this.localeService.getLocaleTextFunc();this.getGui().innerText=e("loadingError","ERR");const t=e("ariaSkeletonCellLoadingFailed","Row failed to load");Wt(this.getGui(),t)}setupLoading(e){const t=ae(this.gos).createElement("div");t.classList.add("ag-skeleton-effect");const i=e.node.rowIndex;if(i!=null){const o=75+25*(i%2==0?Math.sin(i):Math.cos(i));t.style.width=`${o}%`}this.getGui().appendChild(t);const s=this.localeService.getLocaleTextFunc()("ariaSkeletonCellLoading","Row data is loading");Wt(this.getGui(),s)}refresh(e){return!1}destroy(){super.destroy()}},In=class extends ee{constructor(){super()}destroy(){super.destroy()}},ra=class extends In{init(){var t;const e=Je((t=this.gos.get("overlayLoadingTemplate"))==null?void 0:t.trim());if(this.setTemplate(e??''),!e){const i=this.localeService.getLocaleTextFunc();setTimeout(()=>{this.getGui().textContent=i("loadingOoo","Loading...")})}}},la=class extends In{init(){var t;const e=Je((t=this.gos.get("overlayNoRowsTemplate"))==null?void 0:t.trim());if(this.setTemplate(e??''),!e){const i=this.localeService.getLocaleTextFunc();setTimeout(()=>{this.getGui().textContent=i("noRowsToShow","No Rows To Show")})}}},$t=class extends ee{isPopup(){return!0}setParentComponent(e){e.addCssClass("ag-has-popup"),super.setParentComponent(e)}destroy(){const e=this.parentComponent;e&&e.isAlive()&&e.getGui().classList.remove("ag-has-popup"),super.destroy()}},aa=class extends $t{constructor(){super('
')}init(e){const{value:t}=e;this.getGui().textContent=_e(t,!0)}};function Ln(e){const{inputValue:t,allSuggestions:i,hideIrrelevant:s,filterByPercentageOfBestMatch:o,addSequentialWeight:n}=e;let r=i.map((h,d)=>({value:h,relevance:ha(t.toLowerCase(),h.toLocaleLowerCase(),n),idx:d}));if(r.sort((h,d)=>d.relevance-h.relevance),s&&(r=r.filter(h=>h.relevance!==0)),r.length>0&&o&&o>0){const h=r[0].relevance*o;r=r.filter(d=>h-d.relevance<0)}const l=[],a=[];for(const h of r)l.push(h.value),a.push(h.idx);return{values:l,indices:a}}function ha(e,t,i=!1){const s=e.replace(/\s/g,""),o=t.replace(/\s/g,""),n=s.length,r=o.length,l=new Array(n+1).fill(null).map(()=>new Array(r+1).fill(0));for(let d=0;d<=n;d+=1)l[d][0]=d;for(let d=0;d<=r;d+=1)l[0][d]=d;for(let d=1;d<=n;d++)for(let c=1;c<=r;c++)s[d-1]===o[c-1]?l[d][c]=l[d-1][c-1]:l[d][c]=1+Math.min(l[d][c-1],Math.min(l[d-1][c],l[d-1][c-1]));const a=l[n][r];let h=Math.max(n,r)-a;if(i){const d=function(c){const u=[],g=c.length;for(let m=1;m<=g;m++)for(let f=0;f<=g-m;f++){const C=f+m-1;u.push(c.slice(f,C+1))}return u}(s);for(let c=0;cthis.registerJsComponent(t,i))}registerDefaultComponent(e,t,i){this.agGridDefaults[e]=t,i&&(this.agGridDefaultParams[e]=i)}registerJsComponent(e,t){this.jsComps[e]=t}retrieve(e,t){const i=(l,a,h)=>({componentFromFramework:a,component:l,params:h}),s=this.getFrameworkOverrides().frameworkComponent(t,this.gos.get("components"));if(s!=null)return i(s,!0);const o=this.jsComps[t];if(o)return i(o,this.getFrameworkOverrides().isFrameworkComponent(o));const n=this.agGridDefaults[t];if(n)return i(n,!1,this.agGridDefaultParams[t]);const r=this.enterpriseAgDefaultCompsModule[t];return r?this.gos.assertModuleRegistered(r,`AG Grid '${e}' component: ${t}`):as(()=>{this.warnAboutMissingComponent(e,t)},"MissingComp"+t),null}warnAboutMissingComponent(e,t){const i=Ln({inputValue:t,allSuggestions:[...Object.keys(this.agGridDefaults).filter(s=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(s)),...Object.keys(this.jsComps)],hideIrrelevant:!0,filterByPercentageOfBestMatch:.8}).values;R(`Could not find '${t}' component. It was configured as "${e}: '${t}'" but it wasn't found in the list of registered components.`),i.length>0&&R(` Did you mean: [${i.slice(0,3)}]?`),R(`If using a custom component check it has been registered as described in: ${this.getFrameworkOverrides().getDocLink("components/")}`)}},he=class Di{constructor(t){this.status=0,this.resolution=null,this.waiters=[],t(i=>this.onDone(i),i=>this.onReject(i))}static all(t){return t.length?new Di(i=>{let s=t.length;const o=new Array(s);t.forEach((n,r)=>{n.then(l=>{o[r]=l,s--,s===0&&i(o)})})}):Di.resolve()}static resolve(t=null){return new Di(i=>i(t))}then(t){return new Di(i=>{this.status===1?i(t(this.resolution)):this.waiters.push(s=>i(t(s)))})}onDone(t){this.status=1,this.resolution=t,this.waiters.forEach(i=>i(t))}onReject(t){}},ca={propertyName:"dateComponent",cellRenderer:!1},ua={propertyName:"dragAndDropImageComponent",cellRenderer:!1},ga={propertyName:"headerComponent",cellRenderer:!1},pa={propertyName:"headerGroupComponent",cellRenderer:!1},kn={propertyName:"cellRenderer",cellRenderer:!0},ma={propertyName:"cellRenderer",cellRenderer:!1},Ca={propertyName:"loadingCellRenderer",cellRenderer:!0},fa={propertyName:"cellEditor",cellRenderer:!1},On={propertyName:"innerRenderer",cellRenderer:!0},va={propertyName:"loadingOverlayComponent",cellRenderer:!1},wa={propertyName:"noRowsOverlayComponent",cellRenderer:!1},Sa={propertyName:"tooltipComponent",cellRenderer:!1},Ys={propertyName:"filter",cellRenderer:!1},ya={propertyName:"floatingFilterComponent",cellRenderer:!1},ba={propertyName:"toolPanel",cellRenderer:!1},Ra={propertyName:"statusPanel",cellRenderer:!1},Fa={propertyName:"fullWidthCellRenderer",cellRenderer:!0},Pa={propertyName:"loadingCellRenderer",cellRenderer:!0},Da={propertyName:"groupRowRenderer",cellRenderer:!0},Ea={propertyName:"detailCellRenderer",cellRenderer:!0},Ma={propertyName:"menuItem",cellRenderer:!1},Gn=class dl extends b{constructor(){super(...arguments),this.beanName="userComponentFactory"}wireBeans(t){this.agComponentUtils=t.agComponentUtils,this.componentMetadataProvider=t.componentMetadataProvider,this.userComponentRegistry=t.userComponentRegistry,this.frameworkComponentWrapper=t.frameworkComponentWrapper,this.gridOptions=t.gridOptions}getDragAndDropImageCompDetails(t){return this.getCompDetails(this.gridOptions,ua,"agDragAndDropImage",t,!0)}getHeaderCompDetails(t,i){return this.getCompDetails(t,ga,"agColumnHeader",i)}getHeaderGroupCompDetails(t){const i=t.columnGroup.getColGroupDef();return this.getCompDetails(i,pa,"agColumnGroupHeader",t)}getFullWidthCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Fa,null,t,!0)}getFullWidthLoadingCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Pa,"agLoadingCellRenderer",t,!0)}getFullWidthGroupCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Da,"agGroupRowRenderer",t,!0)}getFullWidthDetailCellRendererDetails(t){return this.getCompDetails(this.gridOptions,Ea,"agDetailCellRenderer",t,!0)}getInnerRendererDetails(t,i){return this.getCompDetails(t,On,null,i)}getFullWidthGroupRowInnerCellRenderer(t,i){return this.getCompDetails(t,On,null,i)}getCellRendererDetails(t,i){return this.getCompDetails(t,kn,null,i)}getEditorRendererDetails(t,i){return this.getCompDetails(t,ma,null,i)}getLoadingCellRendererDetails(t,i){return this.getCompDetails(t,Ca,"agSkeletonCellRenderer",i,!0)}getCellEditorDetails(t,i){return this.getCompDetails(t,fa,"agCellEditor",i,!0)}getFilterDetails(t,i,s){return this.getCompDetails(t,Ys,s,i,!0)}getDateCompDetails(t){return this.getCompDetails(this.gridOptions,ca,"agDateInput",t,!0)}getLoadingOverlayCompDetails(t){return this.getCompDetails(this.gridOptions,va,"agLoadingOverlay",t,!0)}getNoRowsOverlayCompDetails(t){return this.getCompDetails(this.gridOptions,wa,"agNoRowsOverlay",t,!0)}getTooltipCompDetails(t){return this.getCompDetails(t.colDef,Sa,"agTooltipComponent",t,!0)}getSetFilterCellRendererDetails(t,i){return this.getCompDetails(t,kn,null,i)}getFloatingFilterCompDetails(t,i,s){return this.getCompDetails(t,ya,s,i)}getToolPanelCompDetails(t,i){return this.getCompDetails(t,ba,null,i,!0)}getStatusPanelCompDetails(t,i){return this.getCompDetails(t,Ra,null,i,!0)}getMenuItemCompDetails(t,i){return this.getCompDetails(t,Ma,"agMenuItem",i,!0)}getCompDetails(t,i,s,o,n=!1){const{propertyName:r,cellRenderer:l}=i;let a,{compName:h,jsComp:d,fwComp:c,paramsFromSelector:u,popupFromSelector:g,popupPositionFromSelector:m}=dl.getCompKeys(this.frameworkOverrides,t,i,o);const f=P=>{const S=this.userComponentRegistry.retrieve(r,P);S&&(d=S.componentFromFramework?void 0:S.component,c=S.componentFromFramework?S.component:void 0,a=S.params)};if(h!=null&&f(h),d==null&&c==null&&s!=null&&f(s),d&&l&&!this.agComponentUtils.doesImplementIComponent(d)&&(d=this.agComponentUtils.adaptFunction(r,d)),!d&&!c)return void(n&&Q(`Could not find component ${h}, did you forget to configure this component?`));const C=this.mergeParamsWithApplicationProvidedParams(t,i,o,u,a),v=d==null,w=d||c;return{componentFromFramework:v,componentClass:w,params:C,type:i,popupFromSelector:g,popupPositionFromSelector:m,newAgStackInstance:()=>this.newAgStackInstance(w,v,C,i)}}static getCompKeys(t,i,s,o){const{propertyName:n}=s;let r,l,a,h,d,c;if(i){const u=i,g=u[n+"Selector"],m=g?g(o):null,f=C=>{typeof C=="string"?r=C:C!=null&&C!==!0&&(t.isFrameworkComponent(C)?a=C:l=C)};m?(f(m.component),h=m.params,d=m.popup,c=m.popupPosition):f(u[n])}return{compName:r,jsComp:l,fwComp:a,paramsFromSelector:h,popupFromSelector:d,popupPositionFromSelector:c}}newAgStackInstance(t,i,s,o){const n=o.propertyName;let r;if(!i)r=new t;else{const a=this.componentMetadataProvider.retrieve(n);r=this.frameworkComponentWrapper.wrap(t,a.mandatoryMethodList,a.optionalMethodList,o)}const l=this.initComponent(r,s);return l==null?he.resolve(r):l.then(()=>r)}mergeParamsWithApplicationProvidedParams(t,i,s,o=null,n){const r=this.gos.getGridCommonParams();Re(r,s),n&&Re(r,n);const l=t&&t[i.propertyName+"Params"];return typeof l=="function"?Re(r,l(s)):typeof l=="object"&&Re(r,l),Re(r,o),r}initComponent(t,i){if(this.createBean(t),t.init!=null)return t.init(i)}};function fi(e){const t=e;return t!=null&&t.getFrameworkComponentInstance!=null?t.getFrameworkComponentInstance():e}var _i=class Y{static register(t){Y.__register(t,!0,void 0)}static registerModules(t){Y.__registerModules(t,!0,void 0)}static __register(t,i,s){Y.runVersionChecks(t),s!==void 0?(Y.areGridScopedModules=!0,Y.gridModulesMap[s]===void 0&&(Y.gridModulesMap[s]={}),Y.gridModulesMap[s][t.moduleName]=t):Y.globalModulesMap[t.moduleName]=t,Y.setModuleBased(i)}static __unRegisterGridModules(t){delete Y.gridModulesMap[t]}static __registerModules(t,i,s){Y.setModuleBased(i),t&&t.forEach(o=>Y.__register(o,i,s))}static isValidModuleVersion(t){const[i,s]=t.version.split(".")||[],[o,n]=Y.currentModuleVersion.split(".")||[];return i===o&&s===n}static runVersionChecks(t){Y.currentModuleVersion||(Y.currentModuleVersion=t.version);const i=s=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${s} Please update all modules to the same version.`;if(t.version?Y.isValidModuleVersion(t)||Q(i(`'${t.moduleName}' is version ${t.version} but the other modules are version ${Y.currentModuleVersion}.`)):Q(i(`'${t.moduleName}' is incompatible.`)),t.validate){const s=t.validate();s.isValid||Q(`${s.message}`)}}static setModuleBased(t){Y.moduleBased===void 0?Y.moduleBased=t:Y.moduleBased!==t&&(Q("AG Grid: You are mixing modules (i.e. @ag-grid-community/core) and packages (ag-grid-community) - you can only use one or the other of these mechanisms."),Q("Please see https://www.ag-grid.com/javascript-grid/modules/ for more information."))}static __setIsBundled(){Y.isBundled=!0}static __assertRegistered(t,i,s){var n;if(this.__isRegistered(t,s))return!0;let o;if(Y.isBundled)o=`AG Grid: unable to use ${i} as 'ag-grid-enterprise' has not been loaded. Check you are using the Enterprise bundle: + + + + + + + + + caternary + + + + + + + + +
+ + + diff --git a/notebooks/circle-check.ico b/notebooks/circle-check.ico new file mode 100644 index 0000000000000000000000000000000000000000..9ce6526670fcbb3d2718378ee436d5226863c7a3 Binary files /dev/null and b/notebooks/circle-check.ico differ diff --git a/notebooks/circle-play.ico b/notebooks/circle-play.ico new file mode 100644 index 0000000000000000000000000000000000000000..9b09dafc2e1bdeb3f7c10f10c4e07029dc059c05 Binary files /dev/null and b/notebooks/circle-play.ico differ diff --git a/notebooks/circle-x.ico b/notebooks/circle-x.ico new file mode 100644 index 0000000000000000000000000000000000000000..6016bde2db63c7dee009bc7eb3fe9cdb38b300a0 Binary files /dev/null and b/notebooks/circle-x.ico differ diff --git a/notebooks/favicon-16x16.png b/notebooks/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..10de32630d957fb0cbf70e70666dd8d15736b1e7 Binary files /dev/null and b/notebooks/favicon-16x16.png differ diff --git a/notebooks/favicon-32x32.png b/notebooks/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..21d6f7a9ce932d6dffd0164e99d46f5a89947093 Binary files /dev/null and b/notebooks/favicon-32x32.png differ diff --git a/notebooks/favicon.ico b/notebooks/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..03b04d72248881073eb0ad537104ac1325ccf2b6 Binary files /dev/null and b/notebooks/favicon.ico differ diff --git a/notebooks/logo.png b/notebooks/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..f78d56dd1108c8a19bfa170038adabce30b7f290 Binary files /dev/null and b/notebooks/logo.png differ diff --git a/notebooks/manifest.json b/notebooks/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..f839981c26fcd58d16bba984c5ad9d67dbc75e06 --- /dev/null +++ b/notebooks/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "Marimo", + "name": "A Marimo App", + "icons": [ + { + "src": "favicon.ico", + "sizes": "48x48", + "type": "image/x-icon" + }, + { + "src": "android-chrome-192x192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "android-chrome-512x512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/notebooks/public/penguins.csv b/notebooks/public/penguins.csv new file mode 100644 index 0000000000000000000000000000000000000000..51fd0fe50c4e01e6f42e54063925571c004ef25a --- /dev/null +++ b/notebooks/public/penguins.csv @@ -0,0 +1,345 @@ +species,island,bill_length_mm,bill_depth_mm,flipper_length_mm,body_mass_g,sex +Adelie,Torgersen,39.1,18.7,181,3750,MALE +Adelie,Torgersen,39.5,17.4,186,3800,FEMALE +Adelie,Torgersen,40.3,18,195,3250,FEMALE +Adelie,Torgersen,,,,, +Adelie,Torgersen,36.7,19.3,193,3450,FEMALE +Adelie,Torgersen,39.3,20.6,190,3650,MALE +Adelie,Torgersen,38.9,17.8,181,3625,FEMALE +Adelie,Torgersen,39.2,19.6,195,4675,MALE +Adelie,Torgersen,34.1,18.1,193,3475, +Adelie,Torgersen,42,20.2,190,4250, +Adelie,Torgersen,37.8,17.1,186,3300, +Adelie,Torgersen,37.8,17.3,180,3700, +Adelie,Torgersen,41.1,17.6,182,3200,FEMALE +Adelie,Torgersen,38.6,21.2,191,3800,MALE +Adelie,Torgersen,34.6,21.1,198,4400,MALE +Adelie,Torgersen,36.6,17.8,185,3700,FEMALE +Adelie,Torgersen,38.7,19,195,3450,FEMALE +Adelie,Torgersen,42.5,20.7,197,4500,MALE +Adelie,Torgersen,34.4,18.4,184,3325,FEMALE +Adelie,Torgersen,46,21.5,194,4200,MALE +Adelie,Biscoe,37.8,18.3,174,3400,FEMALE +Adelie,Biscoe,37.7,18.7,180,3600,MALE +Adelie,Biscoe,35.9,19.2,189,3800,FEMALE +Adelie,Biscoe,38.2,18.1,185,3950,MALE +Adelie,Biscoe,38.8,17.2,180,3800,MALE +Adelie,Biscoe,35.3,18.9,187,3800,FEMALE +Adelie,Biscoe,40.6,18.6,183,3550,MALE +Adelie,Biscoe,40.5,17.9,187,3200,FEMALE +Adelie,Biscoe,37.9,18.6,172,3150,FEMALE +Adelie,Biscoe,40.5,18.9,180,3950,MALE +Adelie,Dream,39.5,16.7,178,3250,FEMALE +Adelie,Dream,37.2,18.1,178,3900,MALE +Adelie,Dream,39.5,17.8,188,3300,FEMALE +Adelie,Dream,40.9,18.9,184,3900,MALE +Adelie,Dream,36.4,17,195,3325,FEMALE +Adelie,Dream,39.2,21.1,196,4150,MALE +Adelie,Dream,38.8,20,190,3950,MALE +Adelie,Dream,42.2,18.5,180,3550,FEMALE +Adelie,Dream,37.6,19.3,181,3300,FEMALE +Adelie,Dream,39.8,19.1,184,4650,MALE +Adelie,Dream,36.5,18,182,3150,FEMALE +Adelie,Dream,40.8,18.4,195,3900,MALE +Adelie,Dream,36,18.5,186,3100,FEMALE +Adelie,Dream,44.1,19.7,196,4400,MALE +Adelie,Dream,37,16.9,185,3000,FEMALE +Adelie,Dream,39.6,18.8,190,4600,MALE +Adelie,Dream,41.1,19,182,3425,MALE +Adelie,Dream,37.5,18.9,179,2975, +Adelie,Dream,36,17.9,190,3450,FEMALE +Adelie,Dream,42.3,21.2,191,4150,MALE +Adelie,Biscoe,39.6,17.7,186,3500,FEMALE +Adelie,Biscoe,40.1,18.9,188,4300,MALE +Adelie,Biscoe,35,17.9,190,3450,FEMALE +Adelie,Biscoe,42,19.5,200,4050,MALE +Adelie,Biscoe,34.5,18.1,187,2900,FEMALE +Adelie,Biscoe,41.4,18.6,191,3700,MALE +Adelie,Biscoe,39,17.5,186,3550,FEMALE +Adelie,Biscoe,40.6,18.8,193,3800,MALE +Adelie,Biscoe,36.5,16.6,181,2850,FEMALE +Adelie,Biscoe,37.6,19.1,194,3750,MALE +Adelie,Biscoe,35.7,16.9,185,3150,FEMALE +Adelie,Biscoe,41.3,21.1,195,4400,MALE +Adelie,Biscoe,37.6,17,185,3600,FEMALE +Adelie,Biscoe,41.1,18.2,192,4050,MALE +Adelie,Biscoe,36.4,17.1,184,2850,FEMALE +Adelie,Biscoe,41.6,18,192,3950,MALE +Adelie,Biscoe,35.5,16.2,195,3350,FEMALE +Adelie,Biscoe,41.1,19.1,188,4100,MALE +Adelie,Torgersen,35.9,16.6,190,3050,FEMALE +Adelie,Torgersen,41.8,19.4,198,4450,MALE +Adelie,Torgersen,33.5,19,190,3600,FEMALE +Adelie,Torgersen,39.7,18.4,190,3900,MALE +Adelie,Torgersen,39.6,17.2,196,3550,FEMALE +Adelie,Torgersen,45.8,18.9,197,4150,MALE +Adelie,Torgersen,35.5,17.5,190,3700,FEMALE +Adelie,Torgersen,42.8,18.5,195,4250,MALE +Adelie,Torgersen,40.9,16.8,191,3700,FEMALE +Adelie,Torgersen,37.2,19.4,184,3900,MALE +Adelie,Torgersen,36.2,16.1,187,3550,FEMALE +Adelie,Torgersen,42.1,19.1,195,4000,MALE +Adelie,Torgersen,34.6,17.2,189,3200,FEMALE +Adelie,Torgersen,42.9,17.6,196,4700,MALE +Adelie,Torgersen,36.7,18.8,187,3800,FEMALE +Adelie,Torgersen,35.1,19.4,193,4200,MALE +Adelie,Dream,37.3,17.8,191,3350,FEMALE +Adelie,Dream,41.3,20.3,194,3550,MALE +Adelie,Dream,36.3,19.5,190,3800,MALE +Adelie,Dream,36.9,18.6,189,3500,FEMALE +Adelie,Dream,38.3,19.2,189,3950,MALE +Adelie,Dream,38.9,18.8,190,3600,FEMALE +Adelie,Dream,35.7,18,202,3550,FEMALE +Adelie,Dream,41.1,18.1,205,4300,MALE +Adelie,Dream,34,17.1,185,3400,FEMALE +Adelie,Dream,39.6,18.1,186,4450,MALE +Adelie,Dream,36.2,17.3,187,3300,FEMALE +Adelie,Dream,40.8,18.9,208,4300,MALE +Adelie,Dream,38.1,18.6,190,3700,FEMALE +Adelie,Dream,40.3,18.5,196,4350,MALE +Adelie,Dream,33.1,16.1,178,2900,FEMALE +Adelie,Dream,43.2,18.5,192,4100,MALE +Adelie,Biscoe,35,17.9,192,3725,FEMALE +Adelie,Biscoe,41,20,203,4725,MALE +Adelie,Biscoe,37.7,16,183,3075,FEMALE +Adelie,Biscoe,37.8,20,190,4250,MALE +Adelie,Biscoe,37.9,18.6,193,2925,FEMALE +Adelie,Biscoe,39.7,18.9,184,3550,MALE +Adelie,Biscoe,38.6,17.2,199,3750,FEMALE +Adelie,Biscoe,38.2,20,190,3900,MALE +Adelie,Biscoe,38.1,17,181,3175,FEMALE +Adelie,Biscoe,43.2,19,197,4775,MALE +Adelie,Biscoe,38.1,16.5,198,3825,FEMALE +Adelie,Biscoe,45.6,20.3,191,4600,MALE +Adelie,Biscoe,39.7,17.7,193,3200,FEMALE +Adelie,Biscoe,42.2,19.5,197,4275,MALE +Adelie,Biscoe,39.6,20.7,191,3900,FEMALE +Adelie,Biscoe,42.7,18.3,196,4075,MALE +Adelie,Torgersen,38.6,17,188,2900,FEMALE +Adelie,Torgersen,37.3,20.5,199,3775,MALE +Adelie,Torgersen,35.7,17,189,3350,FEMALE +Adelie,Torgersen,41.1,18.6,189,3325,MALE +Adelie,Torgersen,36.2,17.2,187,3150,FEMALE +Adelie,Torgersen,37.7,19.8,198,3500,MALE +Adelie,Torgersen,40.2,17,176,3450,FEMALE +Adelie,Torgersen,41.4,18.5,202,3875,MALE +Adelie,Torgersen,35.2,15.9,186,3050,FEMALE +Adelie,Torgersen,40.6,19,199,4000,MALE +Adelie,Torgersen,38.8,17.6,191,3275,FEMALE +Adelie,Torgersen,41.5,18.3,195,4300,MALE +Adelie,Torgersen,39,17.1,191,3050,FEMALE +Adelie,Torgersen,44.1,18,210,4000,MALE +Adelie,Torgersen,38.5,17.9,190,3325,FEMALE +Adelie,Torgersen,43.1,19.2,197,3500,MALE +Adelie,Dream,36.8,18.5,193,3500,FEMALE +Adelie,Dream,37.5,18.5,199,4475,MALE +Adelie,Dream,38.1,17.6,187,3425,FEMALE +Adelie,Dream,41.1,17.5,190,3900,MALE +Adelie,Dream,35.6,17.5,191,3175,FEMALE +Adelie,Dream,40.2,20.1,200,3975,MALE +Adelie,Dream,37,16.5,185,3400,FEMALE +Adelie,Dream,39.7,17.9,193,4250,MALE +Adelie,Dream,40.2,17.1,193,3400,FEMALE +Adelie,Dream,40.6,17.2,187,3475,MALE +Adelie,Dream,32.1,15.5,188,3050,FEMALE +Adelie,Dream,40.7,17,190,3725,MALE +Adelie,Dream,37.3,16.8,192,3000,FEMALE +Adelie,Dream,39,18.7,185,3650,MALE +Adelie,Dream,39.2,18.6,190,4250,MALE +Adelie,Dream,36.6,18.4,184,3475,FEMALE +Adelie,Dream,36,17.8,195,3450,FEMALE +Adelie,Dream,37.8,18.1,193,3750,MALE +Adelie,Dream,36,17.1,187,3700,FEMALE +Adelie,Dream,41.5,18.5,201,4000,MALE +Chinstrap,Dream,46.5,17.9,192,3500,FEMALE +Chinstrap,Dream,50,19.5,196,3900,MALE +Chinstrap,Dream,51.3,19.2,193,3650,MALE +Chinstrap,Dream,45.4,18.7,188,3525,FEMALE +Chinstrap,Dream,52.7,19.8,197,3725,MALE +Chinstrap,Dream,45.2,17.8,198,3950,FEMALE +Chinstrap,Dream,46.1,18.2,178,3250,FEMALE +Chinstrap,Dream,51.3,18.2,197,3750,MALE +Chinstrap,Dream,46,18.9,195,4150,FEMALE +Chinstrap,Dream,51.3,19.9,198,3700,MALE +Chinstrap,Dream,46.6,17.8,193,3800,FEMALE +Chinstrap,Dream,51.7,20.3,194,3775,MALE +Chinstrap,Dream,47,17.3,185,3700,FEMALE +Chinstrap,Dream,52,18.1,201,4050,MALE +Chinstrap,Dream,45.9,17.1,190,3575,FEMALE +Chinstrap,Dream,50.5,19.6,201,4050,MALE +Chinstrap,Dream,50.3,20,197,3300,MALE +Chinstrap,Dream,58,17.8,181,3700,FEMALE +Chinstrap,Dream,46.4,18.6,190,3450,FEMALE +Chinstrap,Dream,49.2,18.2,195,4400,MALE +Chinstrap,Dream,42.4,17.3,181,3600,FEMALE +Chinstrap,Dream,48.5,17.5,191,3400,MALE +Chinstrap,Dream,43.2,16.6,187,2900,FEMALE +Chinstrap,Dream,50.6,19.4,193,3800,MALE +Chinstrap,Dream,46.7,17.9,195,3300,FEMALE +Chinstrap,Dream,52,19,197,4150,MALE +Chinstrap,Dream,50.5,18.4,200,3400,FEMALE +Chinstrap,Dream,49.5,19,200,3800,MALE +Chinstrap,Dream,46.4,17.8,191,3700,FEMALE +Chinstrap,Dream,52.8,20,205,4550,MALE +Chinstrap,Dream,40.9,16.6,187,3200,FEMALE +Chinstrap,Dream,54.2,20.8,201,4300,MALE +Chinstrap,Dream,42.5,16.7,187,3350,FEMALE +Chinstrap,Dream,51,18.8,203,4100,MALE +Chinstrap,Dream,49.7,18.6,195,3600,MALE +Chinstrap,Dream,47.5,16.8,199,3900,FEMALE +Chinstrap,Dream,47.6,18.3,195,3850,FEMALE +Chinstrap,Dream,52,20.7,210,4800,MALE +Chinstrap,Dream,46.9,16.6,192,2700,FEMALE +Chinstrap,Dream,53.5,19.9,205,4500,MALE +Chinstrap,Dream,49,19.5,210,3950,MALE +Chinstrap,Dream,46.2,17.5,187,3650,FEMALE +Chinstrap,Dream,50.9,19.1,196,3550,MALE +Chinstrap,Dream,45.5,17,196,3500,FEMALE +Chinstrap,Dream,50.9,17.9,196,3675,FEMALE +Chinstrap,Dream,50.8,18.5,201,4450,MALE +Chinstrap,Dream,50.1,17.9,190,3400,FEMALE +Chinstrap,Dream,49,19.6,212,4300,MALE +Chinstrap,Dream,51.5,18.7,187,3250,MALE +Chinstrap,Dream,49.8,17.3,198,3675,FEMALE +Chinstrap,Dream,48.1,16.4,199,3325,FEMALE +Chinstrap,Dream,51.4,19,201,3950,MALE +Chinstrap,Dream,45.7,17.3,193,3600,FEMALE +Chinstrap,Dream,50.7,19.7,203,4050,MALE +Chinstrap,Dream,42.5,17.3,187,3350,FEMALE +Chinstrap,Dream,52.2,18.8,197,3450,MALE +Chinstrap,Dream,45.2,16.6,191,3250,FEMALE +Chinstrap,Dream,49.3,19.9,203,4050,MALE +Chinstrap,Dream,50.2,18.8,202,3800,MALE +Chinstrap,Dream,45.6,19.4,194,3525,FEMALE +Chinstrap,Dream,51.9,19.5,206,3950,MALE +Chinstrap,Dream,46.8,16.5,189,3650,FEMALE +Chinstrap,Dream,45.7,17,195,3650,FEMALE +Chinstrap,Dream,55.8,19.8,207,4000,MALE +Chinstrap,Dream,43.5,18.1,202,3400,FEMALE +Chinstrap,Dream,49.6,18.2,193,3775,MALE +Chinstrap,Dream,50.8,19,210,4100,MALE +Chinstrap,Dream,50.2,18.7,198,3775,FEMALE +Gentoo,Biscoe,46.1,13.2,211,4500,FEMALE +Gentoo,Biscoe,50,16.3,230,5700,MALE +Gentoo,Biscoe,48.7,14.1,210,4450,FEMALE +Gentoo,Biscoe,50,15.2,218,5700,MALE +Gentoo,Biscoe,47.6,14.5,215,5400,MALE +Gentoo,Biscoe,46.5,13.5,210,4550,FEMALE +Gentoo,Biscoe,45.4,14.6,211,4800,FEMALE +Gentoo,Biscoe,46.7,15.3,219,5200,MALE +Gentoo,Biscoe,43.3,13.4,209,4400,FEMALE +Gentoo,Biscoe,46.8,15.4,215,5150,MALE +Gentoo,Biscoe,40.9,13.7,214,4650,FEMALE +Gentoo,Biscoe,49,16.1,216,5550,MALE +Gentoo,Biscoe,45.5,13.7,214,4650,FEMALE +Gentoo,Biscoe,48.4,14.6,213,5850,MALE +Gentoo,Biscoe,45.8,14.6,210,4200,FEMALE +Gentoo,Biscoe,49.3,15.7,217,5850,MALE +Gentoo,Biscoe,42,13.5,210,4150,FEMALE +Gentoo,Biscoe,49.2,15.2,221,6300,MALE +Gentoo,Biscoe,46.2,14.5,209,4800,FEMALE +Gentoo,Biscoe,48.7,15.1,222,5350,MALE +Gentoo,Biscoe,50.2,14.3,218,5700,MALE +Gentoo,Biscoe,45.1,14.5,215,5000,FEMALE +Gentoo,Biscoe,46.5,14.5,213,4400,FEMALE +Gentoo,Biscoe,46.3,15.8,215,5050,MALE +Gentoo,Biscoe,42.9,13.1,215,5000,FEMALE +Gentoo,Biscoe,46.1,15.1,215,5100,MALE +Gentoo,Biscoe,44.5,14.3,216,4100, +Gentoo,Biscoe,47.8,15,215,5650,MALE +Gentoo,Biscoe,48.2,14.3,210,4600,FEMALE +Gentoo,Biscoe,50,15.3,220,5550,MALE +Gentoo,Biscoe,47.3,15.3,222,5250,MALE +Gentoo,Biscoe,42.8,14.2,209,4700,FEMALE +Gentoo,Biscoe,45.1,14.5,207,5050,FEMALE +Gentoo,Biscoe,59.6,17,230,6050,MALE +Gentoo,Biscoe,49.1,14.8,220,5150,FEMALE +Gentoo,Biscoe,48.4,16.3,220,5400,MALE +Gentoo,Biscoe,42.6,13.7,213,4950,FEMALE +Gentoo,Biscoe,44.4,17.3,219,5250,MALE +Gentoo,Biscoe,44,13.6,208,4350,FEMALE +Gentoo,Biscoe,48.7,15.7,208,5350,MALE +Gentoo,Biscoe,42.7,13.7,208,3950,FEMALE +Gentoo,Biscoe,49.6,16,225,5700,MALE +Gentoo,Biscoe,45.3,13.7,210,4300,FEMALE +Gentoo,Biscoe,49.6,15,216,4750,MALE +Gentoo,Biscoe,50.5,15.9,222,5550,MALE +Gentoo,Biscoe,43.6,13.9,217,4900,FEMALE +Gentoo,Biscoe,45.5,13.9,210,4200,FEMALE +Gentoo,Biscoe,50.5,15.9,225,5400,MALE +Gentoo,Biscoe,44.9,13.3,213,5100,FEMALE +Gentoo,Biscoe,45.2,15.8,215,5300,MALE +Gentoo,Biscoe,46.6,14.2,210,4850,FEMALE +Gentoo,Biscoe,48.5,14.1,220,5300,MALE +Gentoo,Biscoe,45.1,14.4,210,4400,FEMALE +Gentoo,Biscoe,50.1,15,225,5000,MALE +Gentoo,Biscoe,46.5,14.4,217,4900,FEMALE +Gentoo,Biscoe,45,15.4,220,5050,MALE +Gentoo,Biscoe,43.8,13.9,208,4300,FEMALE +Gentoo,Biscoe,45.5,15,220,5000,MALE +Gentoo,Biscoe,43.2,14.5,208,4450,FEMALE +Gentoo,Biscoe,50.4,15.3,224,5550,MALE +Gentoo,Biscoe,45.3,13.8,208,4200,FEMALE +Gentoo,Biscoe,46.2,14.9,221,5300,MALE +Gentoo,Biscoe,45.7,13.9,214,4400,FEMALE +Gentoo,Biscoe,54.3,15.7,231,5650,MALE +Gentoo,Biscoe,45.8,14.2,219,4700,FEMALE +Gentoo,Biscoe,49.8,16.8,230,5700,MALE +Gentoo,Biscoe,46.2,14.4,214,4650, +Gentoo,Biscoe,49.5,16.2,229,5800,MALE +Gentoo,Biscoe,43.5,14.2,220,4700,FEMALE +Gentoo,Biscoe,50.7,15,223,5550,MALE +Gentoo,Biscoe,47.7,15,216,4750,FEMALE +Gentoo,Biscoe,46.4,15.6,221,5000,MALE +Gentoo,Biscoe,48.2,15.6,221,5100,MALE +Gentoo,Biscoe,46.5,14.8,217,5200,FEMALE +Gentoo,Biscoe,46.4,15,216,4700,FEMALE +Gentoo,Biscoe,48.6,16,230,5800,MALE +Gentoo,Biscoe,47.5,14.2,209,4600,FEMALE +Gentoo,Biscoe,51.1,16.3,220,6000,MALE +Gentoo,Biscoe,45.2,13.8,215,4750,FEMALE +Gentoo,Biscoe,45.2,16.4,223,5950,MALE +Gentoo,Biscoe,49.1,14.5,212,4625,FEMALE +Gentoo,Biscoe,52.5,15.6,221,5450,MALE +Gentoo,Biscoe,47.4,14.6,212,4725,FEMALE +Gentoo,Biscoe,50,15.9,224,5350,MALE +Gentoo,Biscoe,44.9,13.8,212,4750,FEMALE +Gentoo,Biscoe,50.8,17.3,228,5600,MALE +Gentoo,Biscoe,43.4,14.4,218,4600,FEMALE +Gentoo,Biscoe,51.3,14.2,218,5300,MALE +Gentoo,Biscoe,47.5,14,212,4875,FEMALE +Gentoo,Biscoe,52.1,17,230,5550,MALE +Gentoo,Biscoe,47.5,15,218,4950,FEMALE +Gentoo,Biscoe,52.2,17.1,228,5400,MALE +Gentoo,Biscoe,45.5,14.5,212,4750,FEMALE +Gentoo,Biscoe,49.5,16.1,224,5650,MALE +Gentoo,Biscoe,44.5,14.7,214,4850,FEMALE +Gentoo,Biscoe,50.8,15.7,226,5200,MALE +Gentoo,Biscoe,49.4,15.8,216,4925,MALE +Gentoo,Biscoe,46.9,14.6,222,4875,FEMALE +Gentoo,Biscoe,48.4,14.4,203,4625,FEMALE +Gentoo,Biscoe,51.1,16.5,225,5250,MALE +Gentoo,Biscoe,48.5,15,219,4850,FEMALE +Gentoo,Biscoe,55.9,17,228,5600,MALE +Gentoo,Biscoe,47.2,15.5,215,4975,FEMALE +Gentoo,Biscoe,49.1,15,228,5500,MALE +Gentoo,Biscoe,47.3,13.8,216,4725, +Gentoo,Biscoe,46.8,16.1,215,5500,MALE +Gentoo,Biscoe,41.7,14.7,210,4700,FEMALE +Gentoo,Biscoe,53.4,15.8,219,5500,MALE +Gentoo,Biscoe,43.3,14,208,4575,FEMALE +Gentoo,Biscoe,48.1,15.1,209,5500,MALE +Gentoo,Biscoe,50.5,15.2,216,5000,FEMALE +Gentoo,Biscoe,49.8,15.9,229,5950,MALE +Gentoo,Biscoe,43.5,15.2,213,4650,FEMALE +Gentoo,Biscoe,51.5,16.3,230,5500,MALE +Gentoo,Biscoe,46.2,14.1,217,4375,FEMALE +Gentoo,Biscoe,55.1,16,230,5850,MALE +Gentoo,Biscoe,44.5,15.7,217,4875, +Gentoo,Biscoe,48.8,16.2,222,6000,MALE +Gentoo,Biscoe,47.2,13.7,214,4925,FEMALE +Gentoo,Biscoe,,,,, +Gentoo,Biscoe,46.8,14.3,215,4850,FEMALE +Gentoo,Biscoe,50.4,15.7,222,5750,MALE +Gentoo,Biscoe,45.2,14.8,212,5200,FEMALE +Gentoo,Biscoe,49.9,16.1,213,5400,MALE diff --git a/notebooks/site.webmanifest b/notebooks/site.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..09317d7cf8091677fd29e9bffe143d6fcd28e339 --- /dev/null +++ b/notebooks/site.webmanifest @@ -0,0 +1,19 @@ +{ + "background_color": "#ffffff", + "display": "standalone", + "icons": [ + { + "sizes": "192x192", + "src": "/android-chrome-192x192.png", + "type": "image/png" + }, + { + "sizes": "512x512", + "src": "/android-chrome-512x512.png", + "type": "image/png" + } + ], + "name": "marimo", + "short_name": "marimo", + "theme_color": "#ffffff" +}