semiotic 3.8.4 → 3.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +9 -5
- package/README.md +52 -46
- package/ai/behaviorContracts.cjs +2 -2
- package/ai/componentMetadata.cjs +2 -2
- package/ai/dist/mcp-server.js +6 -2
- package/ai/examples.md +211 -2
- package/ai/schema.json +1388 -14
- package/ai/surface-manifest.json +8 -4
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js +2 -0
- package/dist/chunk-chunk-2CHN2TA3.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
- package/dist/chunk-chunk-3SHB24AG.module.min.js +1 -0
- package/dist/chunk-chunk-4MMOOYTX.module.min.js +2 -0
- package/dist/chunk-chunk-75OTQSXS.module.min.js +1 -0
- package/dist/chunk-chunk-A5GRQUOF.module.min.js +1 -0
- package/dist/chunk-chunk-AAF5LZAU.module.min.js +2 -0
- package/dist/{chunk-chunk-LQBSXO7K.module.min.js → chunk-chunk-ARZGA4LJ.module.min.js} +1 -1
- package/dist/chunk-chunk-CAFLML4L.module.min.js +2 -0
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
- package/dist/chunk-chunk-FHBN7OEB.module.min.js +2 -0
- package/dist/{chunk-chunk-KQ546MKE.module.min.js → chunk-chunk-GFTVACTO.module.min.js} +1 -1
- package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
- package/dist/chunk-chunk-ITDWLZXV.module.min.js +2 -0
- package/dist/chunk-chunk-LPSPATPC.module.min.js +1 -0
- package/dist/chunk-chunk-OM6NWS4H.module.min.js +2 -0
- package/dist/chunk-chunk-PX5YQGDP.module.min.js +2 -0
- package/dist/chunk-chunk-Q2BS46W2.module.min.js +2 -0
- package/dist/{chunk-chunk-FBGHXL72.module.min.js → chunk-chunk-RA7JCG7D.module.min.js} +1 -1
- package/dist/chunk-chunk-RNUHEXZA.module.min.js +2 -0
- package/dist/chunk-chunk-ROZWKEUG.module.min.js +1 -0
- package/dist/chunk-chunk-SMVD3EQJ.module.min.js +2 -0
- package/dist/chunk-chunk-T2FKJD4O.module.min.js +2 -0
- package/dist/chunk-chunk-UDREYOLV.module.min.js +1 -0
- package/dist/chunk-chunk-VOWE3SAP.module.min.js +2 -0
- package/dist/chunk-chunk-VQPNBUSW.module.min.js +2 -0
- package/dist/{chunk-chunk-7RYBCTK5.module.min.js → chunk-chunk-WAWCIHFJ.module.min.js} +1 -1
- package/dist/{chunk-chunk-F7WFPD4O.module.min.js → chunk-chunk-WYARAXHR.module.min.js} +1 -1
- package/dist/{chunk-chunk-JDXT6ORT.module.min.js → chunk-chunk-XP3OHHFX.module.min.js} +1 -1
- package/dist/chunk-chunk-XV3KGYTR.module.min.js +2 -0
- package/dist/chunk-chunk-YC2IVEPX.module.min.js +1 -0
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
- package/dist/components/ChartContainer.d.ts +10 -0
- package/dist/components/ai/chartCapabilities.d.ts +3 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +14 -0
- package/dist/components/chartContainerDataAudit.d.ts +10 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +30 -4
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
- package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
- package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
- package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
- package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
- package/dist/components/charts/physics/crucibleController.d.ts +59 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
- package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
- package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
- package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +10 -4
- package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
- package/dist/components/charts/shared/gradient.d.ts +35 -0
- package/dist/components/charts/shared/hatchFill.d.ts +3 -10
- package/dist/components/charts/shared/hooks.d.ts +2 -50
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +58 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +5 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +25 -42
- package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
- package/dist/components/charts/xy/BumpChart.d.ts +161 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
- package/dist/components/charts/xy/Heatmap.d.ts +3 -0
- package/dist/components/charts/xy/LineChart.d.ts +6 -8
- package/dist/components/data/auditData.d.ts +51 -0
- package/dist/components/data/dataAuditPresentation.d.ts +18 -0
- package/dist/components/data/dataAuditSources.d.ts +9 -0
- package/dist/components/data/numericContracts.d.ts +59 -0
- package/dist/components/data/numericFieldProfiler.d.ts +23 -0
- package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
- package/dist/components/legendLayout.d.ts +19 -1
- package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
- package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
- package/dist/components/recipes/wordTrails.d.ts +156 -0
- package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
- package/dist/components/semiotic-ai-core.d.ts +3 -0
- package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +9 -6
- package/dist/components/semiotic-geo.d.ts +1 -0
- package/dist/components/semiotic-network.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-physics.d.ts +2 -0
- package/dist/components/semiotic-realtime-core.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +4 -0
- package/dist/components/semiotic-server-edge.d.ts +1 -1
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-utils-core.d.ts +3 -0
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +5 -5
- package/dist/components/server/renderEvidence.d.ts +27 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
- package/dist/components/server/staticAnnotations.d.ts +12 -0
- package/dist/components/server/staticLegend.d.ts +4 -2
- package/dist/components/server/staticSVGChrome.d.ts +4 -4
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +11 -10
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
- package/dist/components/stream/SVGOverlay.d.ts +2 -6
- package/dist/components/stream/StalenessBadge.d.ts +2 -6
- package/dist/components/stream/geoCartogram.d.ts +7 -0
- package/dist/components/stream/geoTypes.d.ts +20 -8
- package/dist/components/stream/legendRenderer.d.ts +2 -6
- package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
- package/dist/components/stream/ordinalTypes.d.ts +7 -31
- package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
- package/dist/components/stream/pipelineConfig.d.ts +7 -15
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
- package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
- package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
- package/dist/components/stream/types.d.ts +32 -56
- package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
- package/dist/components/types/legendTypes.d.ts +15 -6
- package/dist/components/useChartContainerDataAudit.d.ts +7 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +3 -0
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +9 -6
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +1 -0
- package/dist/semiotic-network.d.ts +1 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-physics.d.ts +2 -0
- package/dist/semiotic-realtime-core.d.ts +1 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +4 -0
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-server.d.ts +1 -1
- package/dist/semiotic-utils-core.d.ts +3 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +5 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +0 -1
- package/dist/chunk-chunk-6TPGFL7M.module.min.js +0 -2
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +0 -2
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
- package/dist/chunk-chunk-AQPQN2HH.module.min.js +0 -2
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +0 -1
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +0 -2
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +0 -2
- package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +0 -2
- package/dist/chunk-chunk-FP44FHFO.module.min.js +0 -2
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +0 -2
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +0 -2
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +0 -1
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +0 -1
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +0 -1
- package/dist/chunk-chunk-N6VKKF3A.module.min.js +0 -2
- package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +0 -2
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +0 -2
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +0 -1
- package/dist/chunk-chunk-RP7WTID5.module.min.js +0 -1
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +0 -1
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{mulberry32 as t}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{UpdateResultTracker as e}from"./chunk-chunk-5RKXZQ2P.module.min.js";var i={seed:1,gravity:{x:0,y:980},fixedDt:1/120,cellSize:64,collisionIterations:6,velocityDamping:.995,sleepSpeed:8,sleepAfter:.35,restitution:.1,friction:.35,maxVelocity:1600,contactWakeSpeed:200},s=1e-9,n=.005;function o(t){return"circle"===t.type?{type:"circle",radius:t.radius}:{type:"aabb",width:t.width,height:t.height}}function r(t){return"aabb"===t.type?{type:"aabb",x:t.x,y:t.y,width:t.width,height:t.height}:{type:"segment",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,thickness:t.thickness}}function a(t,e,i){return Math.max(e,Math.min(i,t))}function d(t){return 0>t?-1:1}function h(t){if("circle"===t.shape.type){const e=t.shape.radius;return{minX:t.x-e,minY:t.y-e,maxX:t.x+e,maxY:t.y+e}}const e=t.shape.width/2,i=t.shape.height/2;return{minX:t.x-e,minY:t.y-i,maxX:t.x+e,maxY:t.y+i}}function c(t){const e=t.shape;if("aabb"===e.type){const t=e.width/2,i=e.height/2;return{minX:e.x-t,minY:e.y-i,maxX:e.x+t,maxY:e.y+i}}const i=(e.thickness??0)/2;return{minX:Math.min(e.x1,e.x2)-i,minY:Math.min(e.y1,e.y2)-i,maxX:Math.max(e.x1,e.x2)+i,maxY:Math.max(e.y1,e.y2)+i}}function l(t,e){return!(t.minX>e.maxX||e.minX>t.maxX||t.minY>e.maxY||e.minY>t.maxY)}function u(t,e,i,s,n,o,r,a){const h=n-t,c=(i+r)/2-Math.abs(h);if(0>=c)return null;const l=o-e,u=(s+a)/2-Math.abs(l);return u>0?u>c?{nx:d(h),ny:0,penetration:c}:{nx:0,ny:d(l),penetration:u}:null}function p(t,e,i,n,o,r,d){const h=r/2,c=d/2;let l=t-a(t,n-h,n+h),u=e-a(e,o-c,o+c);const p=l*l+u*u;if(p>i*i)return null;if(s>=p){const s=Math.abs(t-(n-h)),r=Math.abs(t-(n+h)),a=Math.abs(e-(o-c)),d=Math.abs(e-(o+c)),p=Math.min(s,r,a,d);return p===s?(l=-1,u=0,{nx:l,ny:u,penetration:i+s}):p===r?(l=1,u=0,{nx:l,ny:u,penetration:i+r}):p===a?(l=0,u=-1,{nx:l,ny:u,penetration:i+a}):(l=0,u=1,{nx:l,ny:u,penetration:i+d})}const m=Math.sqrt(p);return{nx:l/m,ny:u/m,penetration:i-m}}function m(t,e){if("circle"===t.shape.type&&"circle"===e.shape.type)return function(t,e,i,n,o,r){const a=n-t,d=o-e,h=i+r,c=a*a+d*d;if(c>=h*h)return null;if(s>=c)return{nx:1,ny:0,penetration:h};const l=Math.sqrt(c);return{nx:a/l,ny:d/l,penetration:h-l}}(t.x,t.y,t.shape.radius,e.x,e.y,e.shape.radius);if("aabb"===t.shape.type&&"aabb"===e.shape.type)return u(t.x,t.y,t.shape.width,t.shape.height,e.x,e.y,e.shape.width,e.shape.height);if("circle"===t.shape.type&&"aabb"===e.shape.type){const i=p(t.x,t.y,t.shape.radius,e.x,e.y,e.shape.width,e.shape.height);return i?{nx:-i.nx,ny:-i.ny,penetration:i.penetration}:null}return"aabb"===t.shape.type&&"circle"===e.shape.type?p(e.x,e.y,e.shape.radius,t.x,t.y,t.shape.width,t.shape.height):null}function y(t,e){const i=e.shape;return"aabb"===i.type?"circle"===t.shape.type?p(t.x,t.y,t.shape.radius,i.x,i.y,i.width,i.height):u(i.x,i.y,i.width,i.height,t.x,t.y,t.shape.width,t.shape.height):function(t,e,i,n,o,r,d,h=0){const c=r-n,l=d-o,u=c*c+l*l,p=u>s?a(((t-n)*c+(e-o)*l)/u,0,1):0,m=i+h/2,y=t-(n+c*p),f=e-(o+l*p),v=y*y+f*f;if(v>=m*m)return null;if(s>=v){const t=Math.sqrt(u);return t>s?{nx:-l/t,ny:c/t,penetration:m}:{nx:1,ny:0,penetration:m}}const b=Math.sqrt(v);return{nx:y/b,ny:f/b,penetration:m-b}}(t.x,t.y,"circle"===t.shape.type?t.shape.radius:Math.sqrt(t.shape.width*t.shape.width+t.shape.height*t.shape.height)/2,i.x1,i.y1,i.x2,i.y2,i.thickness??0)}function f(t,e){return`${t}\0${e}`}function v(t){const e=t.indexOf("\0");return{sensorId:t.slice(0,e),bodyId:t.slice(e+1)}}function b(t){return{id:t.id,x:t.x,y:t.y,prevX:t.prevX,prevY:t.prevY,vx:t.vx,vy:t.vy,angle:t.angle,mass:t.mass,bodyCollisions:t.bodyCollisions,shape:o(t.shape),sleeping:t.sleeping,datum:t.datum,index:t.index,sleepTime:t.sleepTime,restitution:t.restitution,friction:t.friction}}function g(t){return t&&"function"!=typeof t?{property:t.property,equals:t.equals,notEquals:t.notEquals,oneOf:t.oneOf?.slice(),notOneOf:t.notOneOf?.slice()}:t}function x(t){return{id:t.id,shape:r(t.shape),sensor:t.sensor,restitution:t.restitution,friction:t.friction,bodyFilter:g(t.bodyFilter),index:t.index}}function S(t,e){return!!e?.some(e=>Object.is(t,e))}function w(t,e){const i=t.bodyFilter;if(!i)return!0;if("function"==typeof i)return i(e);const s=function(t,e){if(!e)return;let i=t;for(const t of e.split(".")){if(null==i||"object"!=typeof i)return;i=i[t]}return i}(e,i.property);return!("equals"in i&&!Object.is(s,i.equals)||"notEquals"in i&&Object.is(s,i.notEquals)||i.oneOf&&!S(s,i.oneOf)||i.notOneOf&&S(s,i.notOneOf))}var I=class{constructor(e={}){this.capabilities={determinism:"strict",sensors:!0,joints:!1,ccd:!1,maxBodiesHint:5e3,worker:!1},this.bodies=new Map,this.colliders=new Map,this.springs=new Map,this.activeSensors=new Set,this.supportedThisStep=new Set,this.lastEvents=[],this.nextBodyIndex=0,this.nextColliderIndex=0,this.nextSpringIndex=0,this.options={...i,...e},this.random=t(this.options.seed)}init(e={}){this.options={...i,...e},this.random=t(this.options.seed),this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors.clear(),this.lastEvents=[],this.nextBodyIndex=0,this.nextColliderIndex=0,this.nextSpringIndex=0}spawn(t){const e={id:t.id,x:t.x,y:t.y,prevX:t.x,prevY:t.y,vx:t.vx??0,vy:t.vy??0,angle:t.angle??0,mass:Math.max(s,t.mass??1),bodyCollisions:t.bodyCollisions??!0,shape:o(t.shape),sleeping:!1,datum:t.datum,restitution:t.restitution,friction:t.friction,index:this.nextBodyIndex,sleepTime:0};this.nextBodyIndex+=1,this.bodies.set(t.id,e)}remove(t){for(const e of t){this.bodies.delete(e);for(const t of Array.from(this.activeSensors))v(t).bodyId===e&&this.activeSensors.delete(t)}}setColliders(t){this.colliders.clear(),this.activeSensors.clear(),this.nextColliderIndex=0;for(const e of t)this.colliders.set(e.id,{...e,shape:r(e.shape),bodyFilter:g(e.bodyFilter),index:this.nextColliderIndex}),this.nextColliderIndex+=1}setConstraint(t){const e=t.id??"spring-"+this.nextSpringIndex;return this.springs.set(e,{id:e,bodyId:t.bodyId,target:t.target,restLength:t.restLength??0,stiffness:t.stiffness??40,damping:t.damping??3}),this.nextSpringIndex+=1,e}removeConstraint(t){this.springs.delete(t)}applyImpulse(t,e,i){const s=this.bodies.get(t);s&&(s.vx+=e/s.mass,s.vy+=i/s.mass,this.wake(s))}step(t=this.options.fixedDt){const e=Math.max(0,t);if(this.lastEvents=[],0===e)return;const i=this.sortedBodies();for(const t of i)t.prevX=t.x,t.prevY=t.y;this.applySprings(e);const s=this.options.maxVelocity;for(const t of i)if(!t.sleeping){if(t.vx+=this.options.gravity.x*e,t.vy+=this.options.gravity.y*e,t.vx*=this.options.velocityDamping,t.vy*=this.options.velocityDamping,s>0){const e=Math.sqrt(t.vx*t.vx+t.vy*t.vy);if(e>s){const i=s/e;t.vx*=i,t.vy*=i}}t.x+=t.vx*e,t.y+=t.vy*e}this.supportedThisStep.clear();const n=this.bodyPairKeys(i),o=this.sortedColliders().filter(t=>!t.sensor);for(let t=0;this.options.collisionIterations>t;t+=1)this.resolveBodyPairs(i,n,0===t),this.resolveColliders(i,o,0===t);this.updateSensors(i),this.updateSleeping(i,e)}settle(t=1200,e=this.options.fixedDt){let i=0;for(;t>i&&!this.allSleeping();)this.step(e),i+=1;return i}readState(t=[]){t.length=0;for(const e of this.sortedBodies())t.push({id:e.id,x:e.x,y:e.y,prevX:e.prevX,prevY:e.prevY,vx:e.vx,vy:e.vy,angle:e.angle,mass:e.mass,shape:o(e.shape),sleeping:e.sleeping,datum:e.datum});return t}events(){return this.lastEvents.slice()}activeSensorPairs(){return Array.from(this.activeSensors).sort().map(v)}allSleeping(){for(const t of this.bodies.values())if(!t.sleeping)return!1;return!0}snapshot(){return{options:{...this.options,gravity:{...this.options.gravity}},bodies:this.sortedBodies().map(b),colliders:this.sortedColliders().map(x),springs:Array.from(this.springs.values()).map(t=>({...t,target:{...t.target}})),activeSensors:Array.from(this.activeSensors).sort()}}restore(e){this.options={...e.options,gravity:{...e.options.gravity}},this.random=t(this.options.seed),this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors=new Set(e.activeSensors),this.lastEvents=[],this.nextBodyIndex=0;for(const t of e.bodies){const e=b(t);this.bodies.set(e.id,e),this.nextBodyIndex=Math.max(this.nextBodyIndex,e.index+1)}this.nextColliderIndex=0;for(const t of e.colliders){const e=x(t);this.colliders.set(e.id,e),this.nextColliderIndex=Math.max(this.nextColliderIndex,e.index+1)}this.nextSpringIndex=0;for(const t of e.springs){this.springs.set(t.id,{...t,target:{...t.target}});const e=/^spring-(\d+)$/.exec(t.id);e&&(this.nextSpringIndex=Math.max(this.nextSpringIndex,Number(e[1])+1))}}dispose(){this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors.clear(),this.lastEvents=[]}sortedBodies(){return Array.from(this.bodies.values()).sort((t,e)=>t.index-e.index)}sortedColliders(){return Array.from(this.colliders.values()).sort((t,e)=>t.index-e.index)}applySprings(t){for(const e of Array.from(this.springs.values()).sort((t,e)=>t.id.localeCompare(e.id))){const i=this.bodies.get(e.bodyId);if(!i||i.sleeping)continue;const n="point"===e.target.type?e.target:this.bodies.get(e.target.bodyId);if(!n)continue;const o=n.x-i.x,r=n.y-i.y,a=Math.sqrt(o*o+r*r);if(s>=a)continue;const d=o/a,h=r/a,c=(a-e.restLength)*e.stiffness+((("vx"in n?n.vx:0)-i.vx)*d+(("vy"in n?n.vy:0)-i.vy)*h)*e.damping;i.vx+=c*d*t/i.mass,i.vy+=c*h*t/i.mass}}resolveBodyPairs(t,e,i){for(const s of e){const[e,n]=s.split(":").map(Number),o=t[e],r=t[n];if(!o||!r)continue;const a=m(o,r);a&&(this.resolveDynamicCollision(o,r,a),i&&this.lastEvents.push({type:"contact",bodyId:o.id,otherId:r.id,sensor:!1}))}}bodyPairKeys(t){const e=Math.max(1,this.options.cellSize),i=new Map;for(let s=0;t.length>s;s+=1){if(!1===t[s].bodyCollisions)continue;const n=h(t[s]),o=Math.floor(n.minX/e),r=Math.floor(n.maxX/e),a=Math.floor(n.minY/e),d=Math.floor(n.maxY/e);for(let t=o;r>=t;t+=1)for(let e=a;d>=e;e+=1){const n=`${t}:${e}`,o=i.get(n);o?o.push(s):i.set(n,[s])}}const s=new Set;for(const e of Array.from(i.keys()).sort()){const n=i.get(e)??[];n.sort((t,e)=>t-e);for(let e=0;n.length>e;e+=1)for(let i=e+1;n.length>i;i+=1){const o=n[e],r=n[i];!1!==t[o].bodyCollisions&&!1!==t[r].bodyCollisions&&l(h(t[o]),h(t[r]))&&s.add(`${o}:${r}`)}}return Array.from(s).sort((t,e)=>{const[i,s]=t.split(":").map(Number),[n,o]=e.split(":").map(Number);return i===n?s-o:i-n})}resolveDynamicCollision(t,e,i){t.sleeping&&this.supportedThisStep.add(e.id),e.sleeping&&this.supportedThisStep.add(t.id);const o=t.sleeping?0:1/t.mass,r=e.sleeping?0:1/e.mass,a=o+r;if(s>=a)return;const d=Math.max(0,i.penetration-n)/a;t.x-=i.nx*d*o,t.y-=i.ny*d*o,e.x+=i.nx*d*r,e.y+=i.ny*d*r;const h=(e.vx-t.vx)*i.nx+(e.vy-t.vy)*i.ny;if(h>0)return;const c=Math.abs(h),l=-(1+Math.min(t.restitution??this.options.restitution,e.restitution??this.options.restitution))*h/a,u=l*i.nx,p=l*i.ny;t.vx-=u*o,t.vy-=p*o,e.vx+=u*r,e.vy+=p*r,this.applyFriction(t,e,i,l,o,r),c>this.options.contactWakeSpeed&&(this.wake(t),this.wake(e))}applyFriction(t,e,i,n,o,r){const d=-i.ny,h=i.nx,c=(e.vx-t.vx)*d+(e.vy-t.vy)*h,l=o+r;if(s>=Math.abs(c)||s>=l)return;const u=Math.max(0,Math.min(1,Math.max(t.friction??this.options.friction,e.friction??this.options.friction))),p=a(-c/l,-n*u,n*u),m=p*d,y=p*h;t.vx-=m*o,t.vy-=y*o,e.vx+=m*r,e.vy+=y*r}resolveColliders(t,e,i){for(const s of t)for(const t of e){if(!w(t,s))continue;if(!l(h(s),c(t)))continue;const e=y(s,t);e&&(this.resolveStaticCollision(s,t,e),this.supportedThisStep.add(s.id),i&&this.lastEvents.push({type:"contact",bodyId:s.id,otherId:t.id,sensor:!1}))}}resolveStaticCollision(t,e,i){t.x+=i.nx*Math.max(0,i.penetration-n),t.y+=i.ny*Math.max(0,i.penetration-n);const s=t.vx*i.nx+t.vy*i.ny;if(0>s){const n=Math.min(t.restitution??this.options.restitution,e.restitution??this.options.restitution);t.vx-=(1+n)*s*i.nx,t.vy-=(1+n)*s*i.ny;const o=-i.ny,r=i.nx,a=t.vx*o+t.vy*r,d=Math.max(0,Math.min(1,Math.max(t.friction??this.options.friction,e.friction??this.options.friction)));t.vx-=a*o*d,t.vy-=a*r*d}}updateSensors(t){const e=new Set,i=this.sortedColliders().filter(t=>t.sensor);for(const s of t){const t=h(s);for(const n of i){if(!w(n,s))continue;if(!l(t,c(n)))continue;if(!y(s,n))continue;const i=f(n.id,s.id);e.add(i),this.activeSensors.has(i)||this.lastEvents.push({type:"sensor-enter",bodyId:s.id,sensorId:n.id})}}for(const t of Array.from(this.activeSensors).sort()){if(e.has(t))continue;const{sensorId:i,bodyId:s}=v(t);this.lastEvents.push({type:"sensor-exit",bodyId:s,sensorId:i})}this.activeSensors=e}updateSleeping(t,e){const i=Math.hypot(this.options.gravity.x,this.options.gravity.y)>1;for(const s of t)Math.sqrt(s.vx*s.vx+s.vy*s.vy)>=this.options.sleepSpeed||Math.sqrt((s.x-s.prevX)*(s.x-s.prevX)+(s.y-s.prevY)*(s.y-s.prevY))>=this.options.sleepSpeed*e||i&&!this.supportedThisStep.has(s.id)?s.sleeping?this.wake(s):s.sleepTime=0:(s.sleepTime+=e,s.sleeping||this.options.sleepAfter>s.sleepTime||(s.sleeping=!0,s.vx=0,s.vy=0,this.lastEvents.push({type:"sleep",bodyId:s.id})))}wake(t){t.sleeping&&this.lastEvents.push({type:"wake",bodyId:t.id}),t.sleeping=!1,t.sleepTime=0}nextRandom(){return this.random()}},M=class{constructor(t={}){this.id="builtin",this.capabilities={...(new I).capabilities,engine:"builtin"},this.world=new I(t)}init(t={}){this.world.init(t)}spawn(t){this.world.spawn(t)}remove(t){this.world.remove(t)}setColliders(t){this.world.setColliders(t)}setConstraint(t){return this.world.setConstraint(t)}removeConstraint(t){this.world.removeConstraint(t)}applyImpulse(t,e,i){this.world.applyImpulse(t,e,i)}step(t){this.world.step(t)}settle(t,e){return this.world.settle(t,e)}readState(t){return this.world.readState(t)}events(){return this.world.events()}activeSensorPairs(){return this.world.activeSensorPairs()}allSleeping(){return this.world.allSleeping()}snapshot(){return this.world.snapshot()}restore(t){this.world.restore(t)}nextRandom(){return this.world.nextRandom()}dispose(){this.world.dispose()}};function B(t={}){return new M(t)}function k(t,e={}){return t?"function"==typeof t?t(e):(t.init(e),t):B(e)}var O=["binId","targetBin","category","windowIndex","lane","group"];function q(t,e){if(!Number.isFinite(e))return;t.count+=1,t.total+=e,t.min=Math.min(t.min,e),t.max=Math.max(t.max,e);const i=e-t.mean;t.mean+=i/t.count,t.m2+=i*(e-t.mean)}function C(t){return{count:t.count,total:t.total,mean:t.count>0?t.mean:0,min:t.count>0?t.min:0,max:t.count>0?t.max:0,variance:t.count>1?t.m2/(t.count-1):0}}function T(t){return{count:t.count,total:t.total,mean:t.mean,m2:t.variance*Math.max(0,t.count-1),min:t.count>0?t.min:1/0,max:t.count>0?t.max:-1/0}}function R(t,e){if(null!=t[e])return t[e];const i=t.datum;return i&&"object"==typeof i?i[e]:void 0}function D(t,e,i){return"function"==typeof t?t(e,i):"string"==typeof t?R(e,t):void 0}function A(t){if(null==t)return;const e=t+"";return e.trim()?e:void 0}function Y(t){const e=C(t.value);return{id:t.id,label:t.label,count:e.count,total:e.total,bodyIds:t.bodyIds.slice(),lastBodyId:t.lastBodyId,lastDatum:t.lastDatum,x:C(t.x),y:C(t.y),value:e}}var F=class{constructor(t=!1){this.bins=new Map,this.nextIndex=0,this.config=t}updateConfig(t){void 0!==t&&(this.config=t,!1===t&&this.clear())}isEnabled(){return!1!==this.config}add(t){if(!1===this.config)return null;const e=this.nextIndex;this.nextIndex+=1;const i=A(D(this.config.binAccessor,t,e))??function(t){for(const e of O){const i=A(R(t,e));if(i)return i}return"sediment"}(t),s=A(D(this.config.labelAccessor,t,e))??i,n=function(t,e,i){if("number"==typeof t)return t;const s="function"==typeof t?t(e,i):"string"==typeof t?R(e,t):1,n="number"==typeof s?s:Number(s);return Number.isFinite(n)?n:1}(this.config.valueAccessor,t,e),o=Math.max(0,Math.floor(this.config.retainBodyIds??12));let r=this.bins.get(i);return r||(r={id:i,label:s,bodyIds:[],x:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0},y:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0},value:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0}},this.bins.set(i,r)),r.label=s,r.lastBodyId=t.id,r.lastDatum=t.datum,q(r.x,t.x),q(r.y,t.y),q(r.value,n),o>0&&(r.bodyIds.push(t.id),r.bodyIds.length>o&&(r.bodyIds=r.bodyIds.slice(r.bodyIds.length-o))),Y(r)}clear(){this.bins.clear(),this.nextIndex=0}snapshot(){return Array.from(this.bins.values()).map(Y)}restore(t=[]){this.bins.clear();for(const e of t)this.bins.set(e.id,{id:e.id,label:e.label,bodyIds:e.bodyIds.slice(),lastBodyId:e.lastBodyId,lastDatum:e.lastDatum,x:T(e.x),y:T(e.y),value:T(e.value)});this.nextIndex=t.reduce((t,e)=>t+e.count,0)}totals(){const t=this.snapshot();return{bins:t.length,count:t.reduce((t,e)=>t+e.count,0),total:t.reduce((t,e)=>t+e.total,0)}}};function E(t,e={}){const{baselineY:i=0,binWidth:s=24,gap:n=2,maxHeight:o=80,value:r="count",x:a}=e,d=Math.max(1,...t.map(t=>t[r]));return t.map((t,e)=>{const h=Math.max(0,t[r]/d*o),c=a?.(t,e)??e*(s+n);return{binId:t.id,label:t.label,index:e,count:t.count,total:t.total,x:c,y:i-h,width:s,height:h,meanX:t.x.mean,meanY:t.y.mean}})}function P(t){const e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}function L(t){const e=Math.max(0,Math.floor(t.liveBodies)),i=Math.max(0,Math.floor(t.queuedBodies??0)),s=e+i,n=P(t.bodyLimit),o=P(t.engineMaxBodiesHint),r=function(t,e,i){if(!1===i)return;const s=P(i?.warnAt);return null!=s?s:null!=t?Math.max(1,Math.floor(.8*t)):null!=e?Math.max(1,Math.floor(.8*e)):void 0}(n,o,t.options),a=null==n?0:Math.max(0,e-n),d=a>0?"overflow":null==r||r>s?"ok":"warning";return{action:"overflow"!==d?"continue":t.sedimentEnabled?"sediment":t.evictionEnabled?"evict":"retain",bodyLimit:n,engineMaxBodiesHint:o,liveBodies:e,overflow:a,projectedBodies:s,queuedBodies:i,state:d,warnAt:r}}var X={bodyLimit:1/0,eviction:"oldest",fixedDt:1/120,maxDeltaSeconds:.1,maxSubsteps:8,settleStepLimit:1200,timeScale:1},N={chartId:"physics",chartType:"physics",sensors:{},onObservation:void 0,onSimulationStateChange:void 0};function j(t={},e=N){return{chartId:t.chartId??e.chartId,chartType:t.chartType??e.chartType,sensors:t.sensors??e.sensors,onObservation:t.onObservation??e.onObservation,onSimulationStateChange:t.onSimulationStateChange??e.onSimulationStateChange}}function K(t){return{...t,shape:{...t.shape},datum:t.datum,springs:t.springs?.map(t=>({...t,target:{...t.target}}))}}function $(t){if(t instanceof Date){const e=t.getTime();return Number.isFinite(e)?e:void 0}const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:void 0}function W(t,e){if(null!=t[e])return t[e];const i=t.datum;return i&&"object"==typeof i?i[e]:void 0}function H(t,e={}){const i=$(e.startAt)??0,s=e.pacing??"immediate";if("arrival"===s){const s=t.map((t,i)=>function(t,e,i){return"function"==typeof i?$(i(t,e)):"string"==typeof i?$(W(t,i)):$(t.spawnAt)??$(W(t,"arrivalTime"))??$(W(t,"timestamp"))??$(W(t,"time"))??$(W(t,"eventTime"))}(t,i,e.timeAccessor)),n=s.filter(t=>null!=t),o=n.length>0?Math.min(...n):0,r=$(e.timeScale)??1,a=r>0?r:1;return t.map((t,e)=>{const n=s[e],r=null==n?0:Math.max(0,n-o);return{...K(t),spawnAt:i+r/a}})}if("object"==typeof s){const e=$(s.ratePerSec);if(e&&e>0)return t.map((t,s)=>({...K(t),spawnAt:i+s/e}))}return t.map(t=>({...K(t),spawnAt:i}))}function z(t){return{...K(t),sequence:t.sequence,spawnAt:t.spawnAt}}function V(t){return t.map(t=>({...t,shape:{...t.shape},bodyFilter:t.bodyFilter&&"function"!=typeof t.bodyFilter?{...t.bodyFilter,oneOf:t.bodyFilter.oneOf?.slice(),notOneOf:t.bodyFilter.notOneOf?.slice()}:t.bodyFilter}))}function U(t){return!1!==t&&{...t}}function G(t,e){return t.spawnAt===e.spawnAt?t.sequence-e.sequence:t.spawnAt-e.spawnAt}function J(t){return{...t,gravity:{...t.gravity}}}function Q(t,e,i,s){if("circle"===t.shape.type){const n=t.x-e,o=t.y-i,r=t.shape.radius+s,a=n*n+o*o;return a>r*r?null:a}const n=Math.max(Math.abs(e-t.x)-t.shape.width/2,0),o=Math.max(Math.abs(i-t.y)-t.shape.height/2,0),r=n*n+o*o;return r>s*s?null:r}function Z(t){const e=t.indexOf("\0");return{sensorId:t.slice(0,e),bodyId:t.slice(e+1)}}function _(t,e={}){const{idPrefix:i="plot",includeFloor:s=!0,includeCeiling:n=!1,includeLeftWall:o=!0,includeRightWall:r=!0,wallThickness:a=20,floorThickness:d=a}=e,h=[],c=t.x+t.width/2,l=t.y+t.height/2;return s&&h.push({id:i+"-floor",shape:{type:"aabb",x:c,y:t.y+t.height+d/2,width:t.width+2*a,height:d}}),n&&h.push({id:i+"-ceiling",shape:{type:"aabb",x:c,y:t.y-d/2,width:t.width+2*a,height:d}}),o&&h.push({id:i+"-left-wall",shape:{type:"aabb",x:t.x-a/2,y:l,width:a,height:t.height+2*d}}),r&&h.push({id:i+"-right-wall",shape:{type:"aabb",x:t.x+t.width+a/2,y:l,width:a,height:t.height+2*d}}),h}function tt(t){const{idPrefix:e="bin",count:i,domainStart:s,domainStep:n,xScale:o,yTop:r,yBottom:a,wallThickness:d=4,includeBoundaryWalls:h=!0,includeInteriorWalls:c=!0,closedBefore:l,lidY:u=r,lidThickness:p=Math.max(2,d)}=t,m=[],y=r+(a-r)/2,f=Math.abs(a-r),v=h?i:i-1;if(c||h)for(let t=h?0:1;v>=t;t+=1){if(!c&&t>0&&i>t)continue;const r=o(s+t*n);m.push({id:`${e}-wall-${t}`,shape:{type:"aabb",x:r,y:y,width:d,height:f}})}if(null!=l)for(let t=0;i>t;t+=1){const i=s+t*n,r=i+n;if(r>=l)continue;const a=o(i),h=o(r);m.push({id:`${e}-lid-${t}`,shape:{type:"segment",x1:Math.min(a,h)+d/2,y1:u,x2:Math.max(a,h)-d/2,y2:u,thickness:p}})}return m}import{quadtree as et}from"d3-quadtree";var it=class{constructor(){this.maxSearchRadius=0,this.revision=-1,this.tree=null}hitTest(t,e,i,s,n,o=0){const r=this.ensure(t,e);if(!r)return null;let a=null,d=1/0;const h=Math.max(0,o)+this.maxSearchRadius,c=s-h,l=s+h,u=n-h,p=n+h;return r.visit((t,e,r,h,m)=>{if(c>h||e>l||u>m||r>p)return!0;if(t.length)return!1;let y=t;for(;y;){const t=y.data;if(t){const e=Q(t,s,n,Math.max(0,o));null!=e&&(d>e||e===d&&i.indexOf(t.id)>i.indexOf(a?.id??""))&&(a=t,d=e)}y=y.next}return!1}),a}ensure(t,e){if(this.tree&&this.revision===e)return this.tree;const i=t.readState();return 0===i.length?(this.tree=null,this.maxSearchRadius=0,this.revision=e,null):(this.maxSearchRadius=i.reduce((t,e)=>Math.max(t,function(t){return"circle"===t.shape.type?t.shape.radius:Math.hypot(t.shape.width,t.shape.height)/2}(e)),0),this.tree=et().x(t=>t.x).y(t=>t.y).addAll(i),this.revision=e,this.tree)}},st=["data","scene-geometry","data-paint","accessibility","evidence"],nt=["scene-geometry","data-paint","accessibility","evidence"],ot=["overlay","accessibility","evidence"],rt=(t,e)=>({retainedData:t,invalidations:e}),at=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],dt=["scene-geometry","data-paint","accessibility","evidence"],ht=[],ct={engine:rt("rebuild",["scene-geometry","data-paint","accessibility","evidence"]),kernel:rt("preserve",dt),colliders:rt("preserve",dt),sediment:rt("preserve",dt),bodyBudget:rt("preserve",at),bodyLimit:rt("preserve",at),eviction:rt("preserve",at),fixedDt:rt("preserve",ht),maxDeltaSeconds:rt("preserve",ht),maxSubsteps:rt("preserve",ht),settleStepLimit:rt("preserve",ht),timeScale:rt("preserve",ht),observation:rt("preserve",ht)},lt=rt("preserve",at);function ut(t){let e="preserve";const i=new Set;for(const s of t){const t=ct[s]??lt;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)i.add(e)}return{retainedData:e,invalidations:i}}var pt=["seed","fixedDt","cellSize","collisionIterations","velocityDamping","sleepSpeed","sleepAfter","restitution","friction","maxVelocity","contactWakeSpeed"];function mt(t,e){return t===e||!(!t||!e)&&t.gravity?.x===e.gravity?.x&&t.gravity?.y===e.gravity?.y&&pt.every(i=>t[i]===e[i])}function yt(t,e,i,s){return t||!e?"paused":i||!s?"running":"settled"}var ft=class{constructor(){this.seconds=0,this.speed=8,this.scratch=[]}setKernelOptions(t){this.speed=function(t){const e=t?.sleepSpeed;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:8}(t)}reset(){this.seconds=0}isAtRest(){return this.seconds>=.6}refresh(t,e,i){if(i>0)return void(this.seconds=0);const s=t.readState(this.scratch),n=this.speed*this.speed;let o=!0;for(const t of s)if(!t.sleeping&&t.vx*t.vx+t.vy*t.vy>=n){o=!1;break}this.seconds=o?this.seconds+Math.max(0,e):0}},vt=class{constructor(t={}){this.activeSensorPairs=new Set,this.accumulator=0,this.bodyBudgetObservationKey="ok",this.bodySpatialIndex=new it,this.elapsedSeconds=0,this.liveBodyOrder=[],this.nextSequence=0,this.paused=!1,this.queue=[],this.revision=0,this.updateResults=new e,this.simulationState="settled",this.visible=!0,this.quiescence=new ft;const{bodyBudget:i,colliders:s,engine:n,kernel:o,observation:r,sediment:a,...d}=t;this.config={...X,...d},this.configInput={...t},this.bodyBudget=i??{},this.engineInput=n,this.observation=j(r),this.sediment=new F(a??!1),this.world=k(n,{fixedDt:this.config.fixedDt,...o}),this.quiescence.setKernelOptions(o),s&&this.world.setColliders(V(s))}updateConfig(t){const e=function(t,e){return Object.keys(t).filter(i=>"kernel"===i?!mt(t.kernel,e.kernel):t[i]!==e[i])}(t,this.configInput),{colliders:i,bodyBudget:s,engine:n,kernel:o,observation:r,sediment:a,...d}=t;if(this.config={...this.config,...d},void 0!==s&&(this.bodyBudget=s,!1===s&&(this.bodyBudgetObservationKey="ok")),n&&n!==this.engineInput){const t=this.world.snapshot();this.world.dispose(),this.engineInput=n,this.world=k(n,t.options),this.world.restore(t),this.revision+=1}if(o&&!mt(o,this.configInput.kernel)){const t=this.world.snapshot(),e={...t.options,...o,gravity:{...t.options.gravity,...o.gravity}};this.world.restore({...t,options:e}),this.quiescence.setKernelOptions(e),this.revision+=1}r&&(this.observation=j(r,this.observation)),this.sediment.updateConfig(a),i&&(this.world.setColliders(V(i)),this.revision+=1),this.configInput={...this.configInput,...t};const h=ut(e);this.updateResults.record({kind:"config",keys:e},h.invalidations)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}setColliders(t){this.world.setColliders(V(t)),this.revision+=1,this.updateResults.record({kind:"config",keys:["colliders"]},ut(["colliders"]).invalidations)}enqueue(t,e){const i=Array.isArray(t)?t:[t],s=e?H(i,{...e,startAt:e.startAt??this.elapsedSeconds}):i;for(const t of s)this.queue.push({...K(t),sequence:this.nextSequence,spawnAt:t.spawnAt??this.elapsedSeconds}),this.nextSequence+=1;this.queue.sort(G),s.length>0&&(this.revision+=1),this.updateResults.record({kind:"enqueue",count:s.length},s.length?st:[])}enqueueWithResult(t,e){return this.enqueue(t,e),this.updateResults.last}spawnNow(t){this.spawnOne(K(t)),this.nextSequence+=1,this.observeBodyBudget(),this.evictOverflow(),this.revision+=1,this.updateResults.record({kind:"enqueue",count:1},st)}materializeDueSpawns(){const t=this.revision,e=[],i=[];return this.spawnDue(e,i),0===e.length||(this.observeBodyBudget(i),this.evictOverflow(i),this.syncSimulationState(i),this.revision+=1,this.updateResults.record({kind:"enqueue",count:e.length},this.revision!==t?st:[])),e}clear(){const t=this.world.snapshot().options;this.world.init({...t,fixedDt:this.config.fixedDt}),this.activeSensorPairs.clear(),this.liveBodyOrder=[],this.queue=[],this.accumulator=0,this.elapsedSeconds=0,this.nextSequence=0,this.quiescence.reset(),this.sediment.clear(),this.bodyBudgetObservationKey="ok",this.revision+=1,this.syncSimulationState(),this.updateResults.record({kind:"clear"},st)}tick(t){const e=this.revision,i=[],s=[],n=[],o=[],r=[];if(this.paused||!this.visible){const t=this.result(0,i,s,n,o,r,!1);return this.updateResults.record({kind:"tick",count:0},[]),t}const a=Math.max(0,Math.min(t,this.config.maxDeltaSeconds))*this.config.timeScale;this.elapsedSeconds+=a,this.spawnDue(i,r);const d=this.observeBodyBudget(r),h=this.evictOverflow(r);s.push(...h.evicted),n.push(...h.sedimented),this.syncSimulationState(r),this.accumulator+=a;let c=0;for(;this.accumulator>=this.config.fixedDt&&this.config.maxSubsteps>c;){this.world.step(this.config.fixedDt);const t=this.world.events();o.push(...t),this.observeKernelEvents(t,r),this.observeSensorTransitions(r),this.accumulator-=this.config.fixedDt,c+=1}c===this.config.maxSubsteps&&(this.accumulator=Math.min(this.accumulator,this.config.fixedDt)),this.quiescence.refresh(this.world,a,i.length),(c>0||i.length>0||s.length>0||n.length>0||o.length>0)&&(this.revision+=1);const l=this.result(c,i,s,n,o,r,void 0,d);return this.updateResults.record({kind:"tick",count:c},this.revision!==e?i.length||s.length||n.length?st:nt:[]),l}settle(t=this.config.settleStepLimit){const e=this.revision;this.spawnDue([],[]);const i=this.world.settle(t,this.config.fixedDt);return i>0&&(this.revision+=1),this.syncSimulationState(),this.updateResults.record({kind:"settle",count:i},this.revision!==e?nt:[]),i}settleWithObservations(t=this.config.settleStepLimit){const e=this.revision,i=[],s=[],n=[],o=[],r=[];if(this.paused||!this.visible){const t=this.result(0,i,s,n,o,r,!1);return this.updateResults.record({kind:"settle",count:0},[]),t}this.spawnDue(i,r);const a=this.observeBodyBudget(r),d=this.evictOverflow(r);s.push(...d.evicted),n.push(...d.sedimented),this.syncSimulationState(r);let h=0;for(i.length>0&&this.quiescence.reset();t>h&&!this.atRest();){this.world.step(this.config.fixedDt);const t=this.world.events();o.push(...t),this.observeKernelEvents(t,r),this.observeSensorTransitions(r),h+=1,this.quiescence.refresh(this.world,this.config.fixedDt,0)}(h>0||i.length>0||s.length>0||n.length>0||o.length>0)&&(this.revision+=1);const c=this.result(h,i,s,n,o,r,void 0,a);return this.updateResults.record({kind:"settle",count:h},this.revision!==e?i.length||s.length||n.length?st:nt:[]),c}readBodies(t=[]){return this.world.readState(t)}readSediment(){return this.sediment.snapshot()}bodyBudgetStatus(){return this.evaluateBodyBudget()}sedimentTotals(){return this.sediment.totals()}sedimentHeightfield(t={}){return E(this.readSediment(),t)}hitTest(t,e,i=0){return this.bodySpatialIndex.hitTest(this.world,this.revision,this.liveBodyOrder,t,e,i)}events(){return this.world.events()}allSleeping(){return this.world.allSleeping()}atRest(){return this.world.allSleeping()||this.quiescence.isAtRest()}hasPendingWork(){return this.queue.length>0||!this.atRest()}queueSize(){return this.queue.length}liveBodyCount(){return this.liveBodyOrder.length}elapsed(){return this.elapsedSeconds}recordObservation(t){const{timestamp:e,chartType:i,chartId:s,...n}=t,o={...n,timestamp:e??this.elapsedSeconds,chartType:i??this.observation.chartType,chartId:s??this.observation.chartId};return this.emitObservation(o),this.updateResults.record({kind:"update",count:1},["evidence"]),o}getLastUpdateResult(){return this.updateResults.last}getUpdateSnapshot(){return this.updateResults.last}subscribeUpdateResult(t){return this.updateResults.subscribe(t)}version(){return this.revision}setPaused(t){const e=this.paused!==t;this.paused=t,this.syncSimulationState(),this.updateResults.record({kind:"pause"},e?ot:[])}setVisible(t){const e=this.visible!==t;this.visible=t,this.syncSimulationState(),this.updateResults.record({kind:"visibility"},e?ot:[])}remove(t){const e=new Set(t),i=new Set(this.liveBodyOrder),s=new Set(this.queue.map(t=>t.id));this.queue=this.queue.filter(t=>!e.has(t.id)),this.liveBodyOrder=this.liveBodyOrder.filter(t=>!e.has(t)),this.world.remove(t),this.removeActiveSensorPairsForBodies(e);const n=t.filter(t=>i.has(t)||s.has(t));return n.length>0&&(this.revision+=1,this.syncSimulationState()),this.updateResults.record({kind:"remove",keys:n,count:n.length},n.length?st:[]),n}setConstraint(t){const e=this.world.setConstraint(t);return this.revision+=1,this.updateResults.record({kind:"constraint",keys:[e]},nt),e}removeConstraint(t){this.world.removeConstraint(t),this.revision+=1,this.updateResults.record({kind:"constraint",keys:[t]},nt)}applyImpulse(t,e,i){this.world.applyImpulse(t,e,i),this.revision+=1,this.updateResults.record({kind:"impulse",keys:[t]},nt)}nextRandom(){return this.world.nextRandom()}controls(){return t=this,{applyImpulse:(e,i,s)=>t.applyImpulse(e,i,s),clear:()=>t.clear(),hitTest:(e,i,s)=>t.hitTest(e,i,s),pause:()=>t.setPaused(!0),push:(e,i)=>t.enqueue(e,i),pushMany:(e,i)=>t.enqueue(e,i),bodyBudgetStatus:()=>t.bodyBudgetStatus(),readBodies:e=>t.readBodies(e),readSediment:()=>t.readSediment(),recordObservation:e=>t.recordObservation(e),remove:e=>t.remove(e),restore:e=>t.restore(e),resume:()=>t.setPaused(!1),settle:e=>t.settle(e),settleWithObservations:e=>t.settleWithObservations(e),snapshot:()=>t.snapshot(),sedimentHeightfield:e=>t.sedimentHeightfield(e),sedimentTotals:()=>t.sedimentTotals(),step:e=>t.tick(e)};var t}snapshot(){const t=this.world.snapshot();return{accumulator:this.accumulator,activeSensorPairs:Array.from(this.activeSensorPairs).sort(),bodyBudget:U(this.bodyBudget),config:{...this.config,kernel:J(t.options)},elapsedSeconds:this.elapsedSeconds,paused:this.paused,queue:this.queue.map(z),revision:this.revision,sediment:this.readSediment(),simulationState:this.simulationState,liveBodyOrder:this.liveBodyOrder.slice(),visible:this.visible,world:t}}restore(t){this.config={bodyLimit:t.config.bodyLimit,eviction:t.config.eviction,fixedDt:t.config.fixedDt,maxDeltaSeconds:t.config.maxDeltaSeconds,maxSubsteps:t.config.maxSubsteps,settleStepLimit:t.config.settleStepLimit,timeScale:t.config.timeScale},this.configInput={...t.config,bodyBudget:U(t.bodyBudget??{}),kernel:J(t.world.options)},this.bodyBudget=U(t.bodyBudget??{}),this.bodyBudgetObservationKey="ok",this.quiescence.setKernelOptions(t.world.options),this.quiescence.reset(),this.activeSensorPairs=new Set(t.activeSensorPairs),this.accumulator=t.accumulator,this.elapsedSeconds=t.elapsedSeconds,this.paused=t.paused,this.queue=t.queue.map(z).sort(G),this.revision=t.revision,this.sediment.restore(t.sediment??[]),this.simulationState=t.simulationState??yt(t.paused,t.visible,t.queue.length>0,t.world.bodies.every(t=>t.sleeping)),this.liveBodyOrder=t.liveBodyOrder.slice(),this.visible=t.visible,this.nextSequence=this.queue.reduce((t,e)=>Math.max(t,e.sequence),-1)+1,this.world.restore(t.world),this.updateResults.record({kind:"restore"},st)}spawnDue(t,e){for(;this.queue.length>0&&this.elapsedSeconds>=this.queue[0].spawnAt;){const i=this.queue.shift();if(!i)return;this.spawnOne(i,e),t.push(i.id)}}spawnOne(t,e){this.liveBodyOrder=this.liveBodyOrder.filter(e=>e!==t.id),this.removeActiveSensorPairsForBodies(new Set([t.id])),this.world.spawn(t),this.liveBodyOrder.push(t.id);for(const e of t.springs??[])this.world.setConstraint({...e,bodyId:t.id});const i=this.world.readState().find(e=>e.id===t.id);this.emitObservation({type:"physics-spawn",timestamp:this.elapsedSeconds,chartType:this.observation.chartType,chartId:this.observation.chartId,bodyId:t.id,datum:i?.datum??t.datum,x:i?.x??t.x,y:i?.y??t.y},e)}result(t,e,i,s,n,o,r,a=this.evaluateBodyBudget()){this.syncSimulationState(o);const d=this.world.allSleeping();return{budget:a,elapsedSeconds:this.elapsedSeconds,evicted:i,events:n,observations:o,queueSize:this.queue.length,revision:this.revision,shouldContinue:r??(this.queue.length>0||!this.atRest()),sleeping:d,sedimented:s,spawned:e,steps:t}}observeKernelEvents(t,e){!function(t,e,i){if(0===e.length)return;const s=new Map(t.readState().map(t=>[t.id,t]));for(const t of e){if("sleep"!==t.type)continue;const e=s.get(t.bodyId);i.emit({type:"physics-settle",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,bodyId:t.bodyId,datum:e?.datum,x:e?.x,y:e?.y})}}(this.world,t,this.observationContext(e))}observeSensorTransitions(t){this.activeSensorPairs=function(t,e,i){const s=new Set(t.activeSensorPairs().map(t=>`${t.sensorId}\0${t.bodyId}`));if(0===s.size&&0===e.size)return s;const n=new Map(t.readState().map(t=>[t.id,t])),o=(t,e)=>{const{sensorId:s,bodyId:o}=Z(e),r=i.observation.sensors[s],a=n.get(o);i.emit({type:"enter"===t?r?.enterType??"physics-bin-enter":r?.exitType??"physics-bin-exit",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,bodyId:o,datum:a?.datum,x:a?.x,y:a?.y,sensorId:s,binId:r?.binId??s})};for(const t of Array.from(s).sort())e.has(t)||o("enter",t);for(const t of Array.from(e).sort())s.has(t)||o("exit",t);return s}(this.world,this.activeSensorPairs,this.observationContext(t))}removeActiveSensorPairsForBodies(t){!function(t,e){for(const i of t)e.has(Z(i).bodyId)&&t.delete(i)}(this.activeSensorPairs,t)}observationContext(t){return{elapsedSeconds:this.elapsedSeconds,observation:this.observation,emit:e=>this.emitObservation(e,t)}}emitObservation(t,e){e?.push(t),this.observation.onObservation?.(t)}evaluateBodyBudget(){return L({bodyLimit:this.config.bodyLimit,engineMaxBodiesHint:this.world.capabilities.maxBodiesHint,evictionEnabled:!1!==this.config.eviction,liveBodies:this.liveBodyOrder.length,queuedBodies:this.queue.length,sedimentEnabled:this.sediment.isEnabled(),options:this.bodyBudget})}observeBodyBudget(t){const e=this.evaluateBodyBudget();if("ok"===e.state||!1===this.bodyBudget)return this.bodyBudgetObservationKey="ok",e;const i=`${e.state}:${e.action}`;return i===this.bodyBudgetObservationKey||(this.bodyBudgetObservationKey=i,this.emitObservation({type:"overflow"===e.state?"physics-budget-overflow":"physics-budget-warning",timestamp:this.elapsedSeconds,chartType:this.observation.chartType,chartId:this.observation.chartId,budgetAction:e.action,bodyLimit:e.bodyLimit,engineMaxBodiesHint:e.engineMaxBodiesHint,liveBodies:e.liveBodies,overflow:e.overflow,projectedBodies:e.projectedBodies,queuedBodies:e.queuedBodies,warnAt:e.warnAt},t)),e}syncSimulationState(t){const e=yt(this.paused,this.visible,this.queue.length>0,this.atRest());if(e===this.simulationState)return;const i=this.simulationState;this.simulationState=e,function(t,e,i){i.observation.onSimulationStateChange?.(e,t),"running"!==e&&"settled"!==e||i.emit({type:"running"===e?"sim-active":"sim-idle",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,simulationState:e,previousSimulationState:t})}(i,e,this.observationContext(t))}evictOverflow(t){const{evicted:e,sedimented:i,liveBodyOrder:s}=function(t,e,i,s,n,o){const r={evicted:[],sedimented:[],liveBodyOrder:n};if(!1===i)return r;const a=Math.max(0,Math.floor(s));if(!Number.isFinite(a))return r;const d=n.length-a;if(0>=d)return r;const h=function(t,e,i){if("sleeping-first"!==e)return i.slice();const s=new Map(t.readState().map(t=>[t.id,t.sleeping])),n=[],o=[];for(const t of i)s.get(t)?n.push(t):o.push(t);return[...n,...o]}(t,i,n),c=h.slice(0,d);if(0===c.length)return r;const l=function(t,e,i,s){const n=new Map(t.readState().map(t=>[t.id,t])),o=[];for(const t of i){const i=n.get(t);if(!i)continue;const r=e.add(i);r&&(o.push(t),s.emit({type:"physics-sediment",timestamp:s.elapsedSeconds,chartType:s.observation.chartType,chartId:s.observation.chartId,bodyId:t,datum:i.datum,x:i.x,y:i.y,binId:r.id,count:r.count,total:r.total}))}return o}(t,e,c,o);t.remove(c);const u=new Set(c);return{evicted:c,sedimented:l,liveBodyOrder:n.filter(t=>!u.has(t))}}(this.world,this.sediment,this.config.eviction,this.config.bodyLimit,this.liveBodyOrder,this.observationContext(t));return e.length>0&&(this.liveBodyOrder=s,this.removeActiveSensorPairsForBodies(new Set(e))),{evicted:e,sedimented:i}}};function bt(t,e){if("region-enter"!==e.type)return t;const i=e.region.id,s=t[i]??{id:i,label:e.region.label??i,count:0,bodyIds:[]};if(s.bodyIds.includes(e.bodyId))return t;const n=[...s.bodyIds,e.bodyId];return{...t,[i]:{...s,count:n.length,bodyIds:n}}}function gt(t,e){return(e??Object.keys(t)).map(e=>t[e]).filter(t=>null!=t).map(t=>({label:t.label??t.id,value:t.count}))}function xt(t,e){const i=e instanceof Set?e:new Set(e);return t.map(t=>{const e=t.bodyIds??[],s=e.filter(t=>!i.has(t)),n=e.length-s.length,o=t.completion?.mode??"allMembersAbsorbed",r=t.completion?.valueByBodyId,a=t=>{const e=r?.[t];return Number.isFinite(e)&&Number(e)>=0?Number(e):1},d=e.reduce((t,e)=>t+a(e),0),h=e.reduce((t,e)=>t+(i.has(e)?a(e):0),0),c=t.completion?.threshold,l="threshold"===o?Number.isFinite(c)&&Number(c)>=0?Number(c):d:void 0;return{id:t.id,label:t.label??t.id,mode:o,complete:e.length>0&&("anyAbsorbed"===o?n>0:"threshold"===o?h>=(l??d):0===s.length),absorbed:n,total:e.length,absorbedValue:h,totalValue:d,threshold:l,missing:s}})}function St(t,e,i){return Math.max(e,Math.min(i,t))}function wt(t,e,i={}){const s=i.random??Math.random,n=t.stages.find(t=>t.id===e)??t.stages[t.stages.length-1],o=St(i.along??.5,.05,.95),r=i.jitterX??0,a=i.padY??20,d=n.x0+(n.x1-n.x0)*o+(2*s()-1)*r,h=Math.min(1,n.width/2),c=St(d,n.x0+h,n.x1-h),l=t.boundaryY(c,"top")+a,u=t.boundaryY(c,"bottom")-a;return{x:c,y:u>l?l+s()*Math.max(1,u-l):t.midY}}function It(t){return"bowtie"===t.shape?[{id:"incoming",role:"incoming",points:[[t.left,t.topY],[t.centerLeft,t.pinchTop],[t.centerLeft,t.pinchBottom],[t.left,t.bottomY]]},{id:"center",role:"center",points:[[t.centerLeft,t.pinchTop],[t.centerRight,t.pinchTop],[t.centerRight,t.pinchBottom],[t.centerLeft,t.pinchBottom]]},{id:"outgoing",role:"outgoing",points:[[t.centerRight,t.pinchTop],[t.right,t.topY],[t.right,t.bottomY],[t.centerRight,t.pinchBottom]]}]:[{id:"volume",role:"volume",points:[[t.left,t.topY],[t.right,"funnel"===t.shape?t.pinchTop:t.topY],[t.right,"funnel"===t.shape?t.pinchBottom:t.bottomY],[t.left,t.bottomY]]}]}function Mt(t,e,i){return Math.max(e,Math.min(i,t))}function Bt(t,e,i,s,n,o={}){return{id:t,friction:o.friction,restitution:o.restitution,bodyFilter:o.bodyFilter,shape:{type:"segment",x1:e,y1:i,x2:s,y2:n,thickness:o.thickness??8}}}function kt(t){const e=t.shape??"lane",i=Math.max(1,Math.round(t.width)),s=Math.max(1,Math.round(t.height)),n=t.padX??46,o=t.padY??72,r=n,a=i-n,d=o,h=s-Math.max(24,Math.round(.45*o)),c=(d+h)/2,l=Math.max(1,h-d),u=Mt(t.pinchRatio??.18,.06,.5),p=Number(t.pinchHeightOffset??0),m=Number.isFinite(p)?p:0,y=Mt(l*u+m,.06*l,.5*l),f=y/2,v=c-f,b=c+f,g=t.idPrefix??"process",x=t.friction??.58,S=t.restitution??.18,w=t.wallThickness??8,I=t.stages;if(!I.length)throw Error("processStageLayout requires at least one stage");const M=Mt(t.centerStageIndex??Math.floor(I.length/2),0,I.length-1),B=function(t){const e=t.reduce((t,e)=>t+(e.share??1),0);return e>0?e:t.length}(I),k=a-r;let O=r;const q=I.map((t,e)=>{const i=O,s=e===I.length-1?a:O+(t.share??1)/B*k;return O=s,{id:t.id,label:t.label,description:t.description,kind:t.kind??"stage",index:e,x0:i,x1:s,x:(i+s)/2,width:s-i,y:c,height:l}}),C=q[M],T=C.x0,R=C.x1,D=(t,i)=>{if("lane"===e)return"top"===i?d:h;if("funnel"===e){const e=Mt((t-r)/Math.max(1,a-r),0,1);return"top"===i?d+(v-d)*e:h+(b-h)*e}if(T>=t){const e=Mt((t-r)/Math.max(1,T-r),0,1);return"top"===i?d+(v-d)*e:h+(b-h)*e}if(R>=t)return"top"===i?v:b;const s=Mt((t-R)/Math.max(1,a-R),0,1);return"top"===i?v+(d-v)*s:b+(h-b)*s},A=q.map(t=>{const e=Math.min(D(t.x0,"top"),D(t.x1,"top")),i=Math.max(D(t.x0,"bottom"),D(t.x1,"bottom"));return{...t,y:(e+i)/2,height:Math.max(1,i-e)}}),Y={thickness:w,friction:x,restitution:S},F=[];"lane"===e?F.push(Bt(g+"-top",r,d,a,d,Y),Bt(g+"-bottom",r,h,a,h,Y),Bt(g+"-left",r,d,r,h,{...Y,thickness:Math.max(6,w-2)}),Bt(g+"-right",a,d,a,h,{...Y,thickness:Math.max(6,w)})):"funnel"===e?F.push(Bt(g+"-top",r,d,a,v,Y),Bt(g+"-bottom",r,h,a,b,Y),Bt(g+"-left",r,d,r,h,{...Y,thickness:Math.max(6,w-2)}),Bt(g+"-right",a,v,a,b,{...Y,thickness:Math.max(6,w)})):F.push(Bt(g+"-left-top",r,d,T,v,Y),Bt(g+"-left-bottom",r,h,T,b,Y),Bt(g+"-center-top",T,v,R,v,Y),Bt(g+"-center-bottom",T,b,R,b,Y),Bt(g+"-right-top",R,v,a,d,Y),Bt(g+"-right-bottom",R,b,a,h,Y),Bt(g+"-left",r,d,r,h,{...Y,thickness:Math.max(6,w-2)}),Bt(g+"-right",a,d,a,h,{...Y,thickness:Math.max(6,w)}));const E=t.membraneDampingScale??.5,P=r,L=Math.max(1,("bowtie"===e?T:a)-P),X=(t.membranes??[]).map(t=>{const e=P+Mt(t.offset,0,1)*L,i=t.width??18+18*t.cost,s=l-16,n=c+.25*(t.wobble??0);return{...t,x:e,y:n,width:i,height:s}}),N=!1===t.includeMembraneRegions?[]:X.map(t=>Ct({id:t.id,label:t.label??t.id,description:t.description??(t.label??t.id)+" is a permeable region. It taxes energy and damps velocity while bodies overlap it.",x:t.x,y:t.y,width:t.width,height:t.height,cost:t.cost,dampingScale:t.dampingScale??E,bodyStyle:t.bodyStyle,metadata:t.metadata,semanticItem:t.semanticItem,color:t.color}));return{shape:e,width:i,height:s,padX:n,padY:o,left:r,right:a,topY:d,bottomY:h,midY:c,centerLeft:T,centerRight:R,pinchHeight:y,pinchTop:v,pinchBottom:b,stages:A,membranes:X,colliders:F,regionEffects:N,boundaryY:D}}function Ot(t){return{id:t.id,label:t.label,description:t.description,kind:t.kind,shape:(e=t.x,i=t.y,s=t.width,n=t.height,{type:"aabb",x:e,y:i,width:s,height:n}),bodyFilter:t.bodyFilter,collider:t.collider,colliderThickness:t.colliderThickness,friction:t.friction,restitution:t.restitution,semanticItem:t.semanticItem,metadata:t.metadata,bodyStyle:t.bodyStyle,attributes:t.attributes,onEnter:t.onEnter,onExit:t.onExit};var e,i,s,n}function qt(t,e={}){const i=e.idPrefix??"stage",s=Math.max(0,e.insetX??0),n=Math.max(0,e.insetY??1);return t.stages.map(t=>{const o="function"==typeof e.metadata?e.metadata(t):e.metadata??{};return{...Ot({id:i?`${i}:${t.id}`:t.id,label:t.label??t.id,description:t.description,kind:"region",x:t.x,y:t.y,width:Math.max(1,t.width-2*s),height:Math.max(1,t.height-2*n),bodyFilter:e.bodyFilter,semanticItem:e.semanticItem,attributes:{primitive:"processStage",stageId:t.id,stageIndex:t.index},metadata:{...o,primitive:"processStage",stageId:t.id,stageIndex:t.index}})}})}function Ct(t){const e=t.dampingScale??.5,i=t.energyScale??1,s=Mt(t.cost,0,2);return{...Ot({...t,kind:t.kind??"membrane",attributes:{primitive:"membrane",membraneCost:s,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),damping:s*e,energyDelta:-s*i}}function Tt(t){return{...Ot({...t,kind:t.kind??"charge-gate",attributes:{primitive:"chargeGate",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),charge:t.charge??!0,energyDelta:t.energyDelta,impulseOnEnter:t.impulseOnEnter}}function Rt(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force??{x:12,y:0};return{...Ot({...t,kind:t.kind??"force-field",attributes:{primitive:"routeSurface",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping??.015}}function Dt(t){const e=t.pressure??t.occupancy??0,i=t.baseDamping??.08,s=t.dampingPerUnit??.12,n=t.energyPerUnit??0;return{...Ot({...t,kind:t.kind??"membrane",attributes:{primitive:"pressureField",pressure:e,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),damping:i+e*s,energyDelta:n?-e*n:void 0,force:t.force}}function At(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force;return{...Ot({...t,kind:t.kind??"force-field",attributes:{primitive:"capacitatedSensor",capacity:t.capacity,unitsPerSecond:t.unitsPerSecond??t.capacity,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping,charge:t.charge??t.capacity}}function Yt(t){return{...Ot({...t,kind:t.kind??"force-field",attributes:{primitive:"portal",targetStage:t.targetStage,..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:t.force,impulseOnEnter:t.impulseOnEnter,damping:t.damping??.08}}function Ft(t){const e="number"==typeof t.force?{x:t.force,y:0}:t.force??{x:24,y:0};return{...Ot({...t,kind:t.kind??"sink",attributes:{primitive:"absorb",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:e,damping:t.damping??.02,charge:t.charge??"absorbed"}}function Et(t){return{...Ot({...t,kind:t.kind??"force-field",attributes:{primitive:"forceField",..."object"==typeof t.attributes&&t.attributes?t.attributes:{}}}),force:t.force,damping:t.damping,energyDelta:t.energyDelta}}function Pt(t){const e=t.x??t.anchor?.x??0,i=t.y??t.anchor?.y??0;return{id:t.id,label:t.label,description:t.description,group:t.group,bodyIds:t.bodyIds,datum:t.datum,state:t.state,x:e,y:i,width:t.width,height:t.height,anchor:t.anchor??{x:e,y:i},completion:t.completion,tether:t.tether,semanticItem:t.semanticItem}}function Lt(t){const e=t.idPrefix??"lane",i={thickness:t.thickness??8,friction:t.friction??.5,restitution:t.restitution??.16},s=[Bt(e+"-top",t.left,t.top,t.right,t.top,i),Bt(e+"-bottom",t.left,t.bottom,t.right,t.bottom,i)];return t.openEnds||s.push(Bt(e+"-left",t.left,t.top,t.left,t.bottom,i),Bt(e+"-right",t.right,t.top,t.right,t.bottom,i)),s}export{M as BuiltInPhysicsEngineAdapter,B as createDefaultPhysicsEngineAdapter,F as PhysicsSedimentAccumulator,E as sedimentHeightfield,L as evaluatePhysicsBodyBudget,H as schedulePhysicsSpawns,_ as collidersFromPlotBounds,tt as collidersFromXScaleBins,vt as PhysicsPipelineStore,bt as aggregateRegionCounts,gt as regionCountsToProjectionRows,xt as groupCompletionRows,wt as stageTargetInVolume,It as processVolumePolygons,kt as processStageLayout,qt as processStageRegions,Ct as membraneRegion,Tt as chargeGateRegion,Rt as routeSurfaceRegion,Dt as pressureFieldRegion,At as capacitatedRegion,Yt as portalRegion,Ft as absorbRegion,Et as forceFieldRegion,Pt as bodyGroupSpec,Lt as processLaneWalls};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useReducedMotion as e,useTheme as t}from"./chunk-chunk-XEVJDUTH.module.min.js";import{annotationActivationProps as n,defaultTooltipStyle as r,extractAllRows as o,hatchPatternDef as i,isHatchFill as a,resolveHatchCanvasPattern as l,resolveResponsiveRules as s,resolveSvgFill as c,useObservationSelector as d}from"./chunk-chunk-JMVEIZXP.module.min.js";import{FrameRuntime as u,SEQUENTIAL_INTERPOLATORS as h,glyphFractionClipRect as f,glyphPlacement as y,isInBounds as m,resolveAnchoredPosition as p,resolveGlyphPaint as g,resolveX as b,resolveY as x,schemeCategory10 as v,schemeSet3 as k,schemeTableau10 as w,symbolPathString as $}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{getMinMax as M}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as S,resolveCSSColor as A}from"./chunk-chunk-IY7RYD4S.module.min.js";import{createStore as W,useThemeSelector as j}from"./chunk-chunk-DSNGDNJY.module.min.js";var C=Object.freeze([]);function R(e){if(!e)return C;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var N=/^\d{4}-\d{1,2}$/;function L(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=N.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function O(e){return e instanceof Date?e.getTime():"string"==typeof e?L(e):+e}function I(e,t){if(!e||!t)return{data:e,failed:!1};let n=!1,r=!1;const o=e.map(e=>{const o=e[t];if("string"!=typeof o)return e;const i=L(o);return n=!0,Number.isFinite(i)?{...e,[t]:i}:(r=!0,{...e,[t]:NaN})});return{data:n?o:e,failed:r}}import{memo as z,useEffect as F,useRef as D}from"react";var P={sceneGeometry:0,layout:0,domain:0};function T(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function B(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var E="production"!==process.env.NODE_ENV,H={revisions:P,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},G=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=P,this.lastObserved=P,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){E&&(this.lastObserved=B(this.lastObserved,T(e)))}beforeCompute(e,t){if(!E)return H;const n=B(T(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(E){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function q(e){return D(new G(e))}function _(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}var Y=z(function({store:e,diagnostics:t}){return F(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),V=22;function U(e){return"string"==typeof e&&e.length>0}function Z(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}function X(e,t){return Z(e,U(t))}import*as J from"react";import{arc as K}from"d3-shape";function Q(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function ee(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var te=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ne(e){const{innerRadius:t,outerRadius:n,startAngle:r,endAngle:o}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=te(n,r),t=te(n,o);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=te(n,r),a=te(n,o),l=te(t,o),s=te(t,r),c=o-r>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${l.x},${l.y} A${t},${t} 0 ${c} 0 ${s.x},${s.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===a)return ne({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const l=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),s=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=o-r,d=e.roundStart&&e.roundEnd?c/2:c,u=!!e.roundStart&&d>l,h=!!e.roundEnd&&d>l;if(!u&&!h)return ne({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(u?l:0),y=o-(h?l:0),m=r+(u?s:0),p=o-(h?s:0),g=te(n,f),b=te(n,y),x=(n-a)*Math.cos(l),v=te(x,r),k=te(x,o),w=i?null:te(t,p),$=i?null:te(t,m),M=i?0:(t+a)*Math.cos(s),S=i?null:te(M,r),A=i?null:te(M,o),W=y-f>Math.PI?1:0,j=i?0:p-m>Math.PI?1:0;let C="";if(u)C+=`M${v.x},${v.y}`,C+=` A${a},${a} 0 0 1 ${g.x},${g.y}`;else{const e=te(n,r);C+=`M${e.x},${e.y}`}if(h)C+=` A${n},${n} 0 ${W} 1 ${b.x},${b.y}`,C+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=te(n,o);C+=` A${n},${n} 0 ${W} 1 ${e.x},${e.y}`}if(i)C+=" L0,0";else{if(h)C+=` L${A.x},${A.y}`,C+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=te(t,o);C+=` L${e.x},${e.y}`}if(u)C+=` A${t},${t} 0 ${j} 0 ${$.x},${$.y}`,C+=` A${a},${a} 0 0 1 ${S.x},${S.y}`;else{const e=te(t,r);C+=` A${t},${t} 0 ${j} 0 ${e.x},${e.y}`}}return C+=" Z",C}import{jsx as re,jsxs as oe}from"react/jsx-runtime";var ie={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ae(e,t="#4e79a7"){return a(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function le(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function se(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=y(o,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,l=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),s=f(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=s?le(r+"-clip"):void 0,d=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),u=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:g(n.fill,l,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:g(n.stroke??"none",l,e.accent);return o||i?re("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return oe("g",{transform:a,opacity:1===d?void 0:d,children:[s&&c&&re("clipPath",{id:c,children:re("rect",{x:s.x,y:s.y,width:s.width,height:s.height})}),s&&e.ghostColor?re("g",{children:u(e.ghostColor)}):null,s&&c?re("g",{clipPath:`url(#${c})`,children:u()}):u()]},r)}function ce(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>re("stop",{offset:e.offset,stopColor:e.color},t))}function de(e,t,n){const r=$(e.symbolType,e.size,e.path);return re("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?ae(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}import{jsx as ue,jsxs as he}from"react/jsx-runtime";function fe(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function ye(e,t){const n=e.datum;if(!n)return null;const r=[],o=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),a=Number(n.__funnelStepLabelY),l=Number(n.__funnelRowWidth);"string"!=typeof o||!Number.isFinite(i)||!Number.isFinite(a)||Number.isFinite(l)&&8.4*o.length+16>l||r.push(ue("text",{x:i,y:a+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-step"));const s=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),d=Number(n.__funnelValueLabelY),u=Number(n.__funnelBarW);if(Number.isFinite(s)&&0!==s&&Number.isFinite(c)&&Number.isFinite(d)&&u>=60){const e=Number(n.__funnelPercent);let o=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${fe(s)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:fe(s);7.8*o.length+16>u&&(o=fe(s)),7.8*o.length+16>u||r.push(ue("text",{x:c,y:d+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-value"))}return r.length?ue("g",{children:r},t+"-funnel-labels"):null}function me(e,t,n){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",o=n=>`ord-${e.type}-${r}-${t}-${n}`,l=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,n=le(l)+"-grad",r=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=e.x,o=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(o=e.y+e.h,a=e.y):"right"===e.roundedEdge?(r=e.x+e.w,o=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(r=e.x,o=e.y,i=e.x+e.w,a=e.y);const l=[];if("colorStops"in n){const e=ce(n.colorStops);if(!e)return null;l.push(...e)}else{const t=ae(e.style.fill);l.push(re("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),l.push(re("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return re("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:a,children:l})}(t,n);let o,s;if(r)s=`url(#${n})`;else if(a(t.style.fill)){const e=le(l)+"-hatch";o=i(t.style.fill,e),s=`url(#${e})`}else s=ae(t.style.fill);const c=r||o?he("defs",{children:[r,o]}):null;if(t.cornerRadii&&Q(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:r,h:o}=e,{tl:i,tr:a,br:l,bl:s}=ee(e);let c=`M${t+i},${n}`;return c+=` L${t+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r},${n+a}`),c+=` L${t+r},${n+o-l}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t+r-l},${n+o}`),c+=` L${t+s},${n+o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t},${n+o-s}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return he(J.Fragment,{children:[c,ue("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},l)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:r,w:o,h:i}=t;let a;switch(t.roundedEdge){case"right":a=`M${n},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+i-e} A${e},${e} 0 0 1 ${n+o-e},${r+i} L${n},${r+i} Z`;break;case"left":a=`M${n+o},${r} L${n+e},${r} A${e},${e} 0 0 0 ${n},${r+e} L${n},${r+i-e} A${e},${e} 0 0 0 ${n+e},${r+i} L${n+o},${r+i} Z`;break;case"bottom":a=`M${n},${r} L${n+o},${r} L${n+o},${r+i-e} A${e},${e} 0 0 1 ${n+o-e},${r+i} L${n+e},${r+i} A${e},${e} 0 0 1 ${n},${r+i-e} Z`;break;default:a=`M${n},${r+i} L${n},${r+e} A${e},${e} 0 0 1 ${n+e},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+i} Z`}return he(J.Fragment,{children:[c,ue("path",{d:a,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},l)}return he(J.Fragment,{children:[c,ue("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),ye(t,l)]},l)}case"point":{const t=e;return ue("circle",{cx:t.x,cy:t.y,r:t.r,fill:ae(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},l)}case"symbol":return de(e,t,n);case"glyph":return se(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=le(`${n?n+"-":""}gauge-grad-${r.category||l}-${t}`),{clipPath:o,slices:i}=function(e){const t=ne({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:ne({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+o*t,endAngle:e.endAngle}),color:r[o]})}return{clipPath:t,slices:n}}({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return he("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[ue("defs",{children:ue("clipPath",{id:e,children:ue("path",{d:o})})}),ue("g",{clipPath:`url(#${e})`,children:i.map((e,t)=>ue("path",{d:e.d,fill:ae(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&ue("path",{d:o,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},l)}let o;if(r.roundedEnds)o=ne({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=K().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),o=e(ie)||""}return ue("path",{d:o,transform:`translate(${r.cx},${r.cy})`,fill:ae(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},l)}case"boxplot":{const t=e,n=t.columnWidth/2;return he("g","vertical"===t.projection?{children:[ue("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:ae(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),ue("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[ue("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:ae(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),ue("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},l)}case"violin":{const t=e,n=[ue("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:ae(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},o("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?n.push(ue("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),ue("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med"))):n.push(ue("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),ue("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med")))}return ue("g",{children:n},l)}case"connector":return ue("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},l);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return ue("polygon",{points:n,fill:ae(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},l)}default:return null}}import*as pe from"react";import{area as ge,line as be}from"d3-shape";import{curveMonotoneX as xe,curveMonotoneY as ve,curveCardinal as ke,curveCatmullRom as we,curveStep as $e,curveStepBefore as Me,curveStepAfter as Se,curveBasis as Ae,curveNatural as We}from"d3-shape";function je(e){switch(e){case"monotoneX":return xe;case"monotoneY":return ve;case"cardinal":return ke;case"catmullRom":return we;case"step":return $e;case"stepBefore":return Me;case"stepAfter":return Se;case"basis":return Ae;case"natural":return We;default:return null}}function Ce(e,t,n){if(null==t)return n;if(a(t)){return l(t,e)||t.background&&A(e,t.background)||n}return"string"!=typeof t?t:A(e,t)||n}function Re(e,t){if(null==t)return;const n=Ce(e,t,"");return""===n?void 0:n}function Ne(e,t,n,r,o,i,a){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(r,o,i,a);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:s}=t;if(!Number.isFinite(l)||!Number.isFinite(s))return null;const c=Math.max(0,Math.min(1,l)),d=Math.max(0,Math.min(1,s)),u=e.createLinearGradient(r,o,i,a),[h,f,y]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const o=e.fillStyle;if(e.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return u.addColorStop(0,`rgba(${h},${f},${y},${c})`),u.addColorStop(1,`rgba(${h},${f},${y},${d})`),u}function Le(e,t,n,r,o,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const l=e.createLinearGradient(n,r,o,i);for(const e of a)l.addColorStop(e.offset,e.color);return l}import*as Oe from"react";import{arc as Ie}from"d3-shape";import{jsx as ze,jsxs as Fe}from"react/jsx-runtime";function De(e,t){switch(e.type){case"circle":{const n=e,r=a(n.style.fill)?i(n.style.fill,`net-circle-${t}-hatch`):void 0;return Fe(Oe.Fragment,{children:[r&&ze("defs",{children:r}),ze("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:ae(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=a(n.style.fill)?i(n.style.fill,`net-rect-${t}-hatch`):void 0;return Fe(Oe.Fragment,{children:[r&&ze("defs",{children:r}),ze("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:ae(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=Ie().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(ie)||"",o=a(n.style.fill)?i(n.style.fill,`net-arc-${t}-hatch`):void 0;return Fe(Oe.Fragment,{children:[o&&ze("defs",{children:o}),ze("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${t}-hatch)`:ae(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=$(n.symbolType,n.size,n.path);return ze("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?ae(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return se(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}function Pe(e,t){switch(e.type){case"line":return ze("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e;return ze("path",{d:n.pathD,fill:ae(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return ze("path",{d:n.pathD,fill:ae(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return ze("path",{d:n.pathD,fill:ae(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}function Te(e,t){return ze("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}import*as Be from"react";import{jsx as Ee,jsxs as He}from"react/jsx-runtime";function Ge(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=a(n.style.fill)?i(n.style.fill,`geoarea-${t}-hatch`):void 0;return He(Be.Fragment,{children:[r&&Ee("defs",{children:r}),Ee("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:ae(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=a(n.style.fill)?i(n.style.fill,`geopoint-${t}-hatch`):void 0;return He(Be.Fragment,{children:[r&&Ee("defs",{children:r}),Ee("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:ae(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return Ee("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return se(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}import{jsx as qe,jsxs as _e}from"react/jsx-runtime";function Ye(e,t,n){if(!e||2>t.length)return null;const r=ce(e.colorStops);return r?qe("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:r}):null}function Ve(e,t,n){switch(e.type){case"line":{const r=e;if(0===r.path.length)return null;const o=je(r.curve),i=o?be().x(([e])=>e).y(([,e])=>e).curve(o)(r.path)??"":"M"+r.path.map(([e,t])=>`${e},${t}`).join("L"),a=le(`${n?n+"-":""}line-${t}-stroke-gradient`),l=Ye(r.strokeGradient,r.path,a);return _e(pe.Fragment,{children:[l&&qe("defs",{children:l}),qe("path",{d:i,fill:"none",stroke:l?`url(#${a})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const o=je(r.curve),l=!o||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:ge().x(([e])=>e).y0((e,t)=>r.bottomPath[t][1]).y1(([,e])=>e).curve(o)(r.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,c=a(r.style.fill)?i(r.style.fill,s):void 0,d=le(`${n?n+"-":""}area-${t}-gradient`),u=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,t]of e.topPath)r=Math.min(r,t);let o=-1/0;for(const[,t]of e.bottomPath)o=Math.max(o,t);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const i=[];if("colorStops"in n){const e=ce(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push(qe("stop",{offset:0,stopColor:ae(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push(qe("stop",{offset:1,stopColor:ae(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return qe("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:o,children:i})}(r,d),h=u?`url(#${d})`:c?`url(#${s})`:ae(r.style.fill),f=u?void 0:r.style.fillOpacity??r.style.opacity??.7,y=o?be().x(([e])=>e).y(([,e])=>e).curve(o)(r.topPath)??"":"M"+r.topPath.map(([e,t])=>`${e},${t}`).join("L"),m=le(`${n?n+"-":""}area-${t}-stroke-gradient`),p=Ye(r.strokeGradient,r.topPath,m),g=r.style.stroke&&"none"!==r.style.stroke?qe("path",{d:y,fill:"none",stroke:p?`url(#${m})`:ae(r.style.stroke),strokeWidth:r.style.strokeWidth||2,opacity:r.style.opacity}):null;if(r.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return _e("g",{children:[_e("defs",{children:[u,!u&&c,p,qe("clipPath",{id:e,children:qe("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),_e("g",{clipPath:`url(#${e})`,children:[qe("path",{d:l,fill:h,fillOpacity:f,opacity:u?r.style.opacity:void 0,stroke:"none"}),g]})]},"area-"+t)}return _e(pe.Fragment,{children:[(u||c||p)&&_e("defs",{children:[u,!u&&c,p]}),qe("path",{d:l,fill:h,fillOpacity:f,opacity:u?r.style.opacity:void 0,stroke:"none"}),g]},"area-"+t)}case"point":{const r=e,o=`${n?n+"-":""}point-${t}-hatch`,l=a(r.style.fill)?i(r.style.fill,o):void 0;return _e(pe.Fragment,{children:[l&&qe("defs",{children:l}),qe("circle",{cx:r.x,cy:r.y,r:r.r,fill:l?`url(#${o})`:ae(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+t)}case"symbol":return de(e,t);case"glyph":return se(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const r=e,o=`${n?n+"-":""}xyrect-${t}-hatch`,l=a(r.style.fill)?i(r.style.fill,o):void 0;return _e(pe.Fragment,{children:[l&&qe("defs",{children:l}),qe("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:l?`url(#${o})`:ae(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[r,o,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*r+.587*o+.114*i>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return _e("g",{children:[qe("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth}),qe("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:e})]},"heatcell-"+t)}return qe("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return _e("g",{children:[qe("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),qe("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),qe("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const r=Math.min(n.openY,n.closeY),o=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return _e("g",{children:[qe("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),qe("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}var Ue="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Ze,useLayoutEffect as Xe,useRef as Je,useState as Ke,useSyncExternalStore as Qe}from"react";var et="undefined"!=typeof window?Xe:Ze;function tt(){const[e,t]=Ke(!1);return et(()=>{t(!0)},[]),e}var nt=()=>()=>{},rt=()=>!1,ot=()=>!0;function it(){const e=Qe(nt,rt,ot);return Je(e).current}import{jsx as at}from"react/jsx-runtime";var lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function st({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return at("div",{"aria-live":"polite","aria-atomic":"true",style:lt,children:t})}import*as ct from"react";import*as dt from"react";import{jsx as ut}from"react/jsx-runtime";var ht=dt.createContext(null);function ft(){return dt.useContext(ht)}import{jsx as yt,jsxs as mt}from"react/jsx-runtime";function pt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}function gt(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var bt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},xt="semiotic-accessible-data-table",vt=xt+" semiotic-accessible-data-table-hidden",kt=xt+" semiotic-accessible-data-table-visible",wt=kt+" semiotic-accessible-data-table-network",$t={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Mt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},St={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},At={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Wt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},jt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ct={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Rt={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Nt({scene:e,chartType:t,tableId:n,chartTitle:r}){const[i,a]=ct.useState(!1),[l,s]=ct.useState(5),c=ft(),d=c?.visible??!1,u=i||d,h=ct.useRef(null),f=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;ct.useEffect(()=>{u||s(5)},[u]);const y=ct.useCallback(e=>{e.target===e.currentTarget&&(i||d||a(!0))},[i,d]),m=ct.useCallback(e=>{d||h.current?.contains(e.relatedTarget)||a(!1)},[d]);if(!e||0===e.length)return n?yt("span",{id:n,tabIndex:-1,style:lt}):null;if(!u)return yt("div",{id:n,className:vt,tabIndex:-1,onFocus:y,style:lt,role:"region","aria-label":f,children:mt("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," elements)"]})});const p=o(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${bt(e.min)} to ${bt(e.max)}, mean ${bt(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(p.length,g),x=Math.min(l,p.length),v=p.slice(0,x),k=p.length-x,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const $=Array.from(w);return mt("div",{ref:h,id:n,className:kt,tabIndex:-1,onBlur:m,style:$t,role:"region","aria-label":f,children:[yt("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:St,children:"×"}),yt("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Mt,children:b}),mt("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:At,children:[yt("caption",{className:"semiotic-accessible-data-table-caption",style:Ct,children:k>0?`First ${x} of ${p.length} data points`:`All ${p.length} data points`}),yt("thead",{children:mt("tr",{children:[yt("th",{style:Wt,children:"type"}),$.map(e=>yt("th",{style:Wt,children:e},e))]})}),yt("tbody",{children:v.map((e,t)=>mt("tr",{children:[yt("td",{style:jt,children:e.label}),$.map(t=>{return yt("td",{style:jt,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":bt(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),k>0&&mt("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Rt,children:["Show ",Math.min(25,k)," more"," ",1===k?"row":"rows"," (",k," remaining)"]})]})}function Lt({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=ct.useState(!1),[l,s]=ct.useState(5),c=ft(),d=c?.visible??!1,u=i||d,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=ct.useRef(null);ct.useEffect(()=>{u||s(5)},[u]);const y=ct.useCallback(e=>{e.target===e.currentTarget&&(i||d||a(!0))},[i,d]),m=ct.useCallback(e=>{d||f.current?.contains(e.relatedTarget)||a(!1)},[d]);if(!e||0===e.length)return r?yt("span",{id:r,tabIndex:-1,style:lt}):null;if(!u)return yt("div",{id:r,className:vt,tabIndex:-1,onFocus:y,style:lt,role:"region","aria-label":h,children:mt("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const p=Array.isArray(e)?e:[],g=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,k=new Map;for(const e of g){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";x.set(e,(x.get(e)??0)+1),k.set(e,(k.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+o)}}const w=[];for(let e=0;p.length>e;e++){const t=p[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=b.get(r)??0,i=x.get(r)??0,a=v.get(r)??0,l=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+l,wInDeg:a,wOutDeg:l})}w.sort((e,t)=>t.degree-e.degree);let $=0,M=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>M&&(M=t.degree);$=e/w.length}const S=g.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),A=[`${w.length} nodes, ${g.length} edges.`];w.length>0&&A.push(`Mean degree: ${bt($)}, max degree: ${M}.`);const W=Math.min(l,w.length),j=w.slice(0,W),C=w.length-W;return mt("div",{ref:f,id:r,className:wt,tabIndex:-1,onBlur:m,style:$t,role:"region","aria-label":h,children:[yt("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:St,children:"×"}),yt("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Mt,children:A.join(" ")}),mt("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:At,children:[yt("caption",{className:"semiotic-accessible-data-table-caption",style:Ct,children:C>0?`Top ${W} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),yt("thead",{children:mt("tr",{children:[yt("th",{style:Wt,children:"id"}),yt("th",{style:Wt,children:"degree"}),yt("th",{style:Wt,children:"in"}),yt("th",{style:Wt,children:"out"}),S&&yt("th",{style:Wt,children:"w. degree"}),S&&yt("th",{style:Wt,children:"w. in"}),S&&yt("th",{style:Wt,children:"w. out"})]})}),yt("tbody",{children:j.map((e,t)=>mt("tr",{children:[yt("td",{style:jt,children:e.id}),yt("td",{style:jt,children:e.degree}),yt("td",{style:jt,children:e.inDeg}),yt("td",{style:jt,children:e.outDeg}),S&&yt("td",{style:jt,children:bt(e.wDegree)}),S&&yt("td",{style:jt,children:bt(e.wInDeg)}),S&&yt("td",{style:jt,children:bt(e.wOutDeg)})]},t))})]}),C>0&&mt("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Rt,children:["Show ",Math.min(25,C)," more"," ",1===C?"node":"nodes"," (",C," remaining)"]})]})}function Ot({summary:e}){return e?yt("div",{role:"note",style:lt,children:e}):null}function It({tableId:e}){return yt("a",{href:"#"+e,style:lt,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,lt)},children:"Skip to data table"})}import{jsx as zt}from"react/jsx-runtime";var Ft="var(--semiotic-focus, #005fcc)";function Dt({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:l}){if(!e||!t)return null;const s=t.x+n.left,c=t.y+n.top;let d;if("geoarea"!==o&&"path"!==o||!l)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);d=zt("rect",{x:s-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ft,strokeWidth:2,strokeDasharray:"4,2"})}else d=zt("circle","wedge"===o?{cx:s,cy:c,r:12,fill:"none",stroke:Ft,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:Ft,strokeWidth:2,strokeDasharray:"4,2"});else d=zt("g",{transform:`translate(${n.left},${n.top})`,children:zt("path",{d:l,fill:"none",stroke:Ft,strokeWidth:2.5,strokeDasharray:"6,3"})});return zt("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}import*as Pt from"react";import{jsx as Tt}from"react/jsx-runtime";function Bt({x:e,y:t,containerWidth:n,containerHeight:o,margin:i,children:a,className:l="stream-frame-tooltip",zIndex:s=1}){const c=Number.isFinite(e)&&Number.isFinite(t),d=Pt.useRef(null),[u,h]=Pt.useState(null);Pt.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[l,n,o,c]);let f;f=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const y=function(e){if(!Pt.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(a),m=y?null:r;return c?Tt("div",{ref:d,className:y?l:(l+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:i.left+e,top:i.top+t,transform:f,pointerEvents:"none",zIndex:s,width:"max-content"},children:a}):null}import*as Et from"react";import{useCallback as Ht,useEffect as Gt,useLayoutEffect as qt,useMemo as _t,useRef as Yt}from"react";import{useRef as Vt,useState as Ut,useEffect as Zt}from"react";function Xt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Jt(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Kt(e,t,n){return e+(t-e)*n}function Qt(){return"undefined"!=typeof performance?performance.now():Date.now()}var en="undefined"==typeof window?Gt:qt,tn={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function nn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function rn(t){const n=e(),r=Yt(n);r.current=n;const[o,i]=function(e,t,n){const r=Vt(null),[o,i]=Ut(null);return Zt(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),a=!!t.title,l=!!t.legend&&"top"===t.legendPosition,s=_t(()=>Z({...t.marginDefault,...t.userMargin},a,l),[t.marginDefault,t.userMargin,a,l]),c=i[0]-s.left-s.right,d=i[1]-s.top-s.bottom,h=nn(t.foregroundGraphics,i,s),f=nn(t.backgroundGraphics,i,s),y=j(e=>e.theme),{transition:m,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(t.animate,t.transitionProp),g="semiotic-table-"+Et.useId(),b=Yt(null);if(!b.current){const e=!t.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new u({clock:t.clock,random:t.random,seed:t.seed,paused:t.paused,visible:e})}const x=b.current;x.configure({clock:t.clock,random:t.random,seed:t.seed});const v=Yt(null),k=Yt(t.frameScheduler??tn);k.current=t.frameScheduler??tn;const w=Yt(null),$=Yt(!1),M=Yt(()=>{}),A=Ht(()=>{if(null!==v.current||$.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&($.current=!0),v.current=null,w.current=null;try{M.current()}finally{e&&($.current=!1)}});n=!0,t||(v.current=r,w.current=e)},[]),W=Ht(()=>{null!==v.current&&((w.current??k.current).cancelAnimationFrame(v.current),v.current=null,w.current=null)},[]);en(()=>{x.setPaused(!0===t.paused)},[x,t.paused]),Gt(()=>{if(!t.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const e=()=>x.setVisible(!document.hidden);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[x,t.suspendWhenHidden]),Gt(()=>()=>{W()},[W]);const C=Yt(()=>{}),R=Yt(()=>{}),N=Yt(null),L=Yt(null),O=Yt(null),I=Ht(()=>{const e=N.current;N.current=null,e&&C.current(e)},[]),z=Ht(e=>{if(N.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===L.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,L.current=null,O.current=null,I()});t||(L.current=n,O.current=e)}},[I]),F=Ht(()=>{N.current=null,null!==L.current&&((O.current??k.current).cancelAnimationFrame(L.current),L.current=null,O.current=null),R.current()},[]);Gt(()=>()=>{N.current=null,null!==L.current&&((O.current??k.current).cancelAnimationFrame(L.current),L.current=null,O.current=null)},[]);const D=t.themeDirtyRef;return en(()=>{D&&(S(),D.current=!0,A())},[y,A,D]),{reducedMotion:n,reducedMotionRef:r,responsiveRef:o,size:i,margin:s,adjustedWidth:c,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:y,transition:m,introEnabled:p,tableId:g,frameRuntime:x,rafRef:v,renderFnRef:M,scheduleRender:A,cancelRender:W,hoverHandlerRef:C,hoverLeaveRef:R,onPointerMove:z,onPointerLeave:F}}import{useEffect as on,useRef as an}from"react";import{jsx as ln}from"react/jsx-runtime";function sn(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=an(null),l=an(null),s=an(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:a,cleanup:l}=e;et(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():o.current=!0,a?.(),i.current()},[t,n]);const s=Je(l);s.current=l,Ze(()=>()=>s.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),on(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),on(()=>{!s.current&&(s.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function cn({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?ln("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:ln("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function dn(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),l=i/t[0],s=a/t[1],c=t[0]+"px",d=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==d&&(e.style.height=d),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(l,0,0,s,0,0),o.translate(n.left,n.top),o}function un(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function hn(e){return"touch"===e?"touch":"pointer"}function fn(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function yn(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:l,timestamp:s=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:s,chartType:i,chartId:a}),"focus"===l?.type&&t({type:"focus",datum:n,inputType:"touch"===l.inputType?"pointer":l.inputType,timestamp:s,chartType:i,chartId:a})):t({type:"hover-end",timestamp:s,chartType:i,chartId:a}))}function mn(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:l,timestamp:s=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:s,chartType:i,chartId:a}),"activate"===l?.type&&t({type:"activate",datum:n,inputType:l.inputType,timestamp:s,chartType:i,chartId:a})):t({type:"click-end",timestamp:s,chartType:i,chartId:a}))}import*as pn from"react";import{jsx as gn,jsxs as bn}from"react/jsx-runtime";function xn({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return gn("div",{role:"alert",style:{width:r,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:bn("div",{style:{textAlign:"center",maxWidth:400},children:[gn("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),gn("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&gn("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as vn}from"react/jsx-runtime";var kn=class extends pn.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:vn(xn,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as wn}from"react/jsx-runtime";var $n="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Mn({componentName:e,width:t,height:n,children:r}){return wn(kn,{fallback:r=>wn(xn,{componentName:e,message:r.message,width:t,height:n}),children:r})}var Sn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},An={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Wn(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?wn("div",{style:{...Sn,width:t,height:n},children:r||"No data available"}):null}function jn(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return wn("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),l=Math.floor((n-(o*(i+a)-a))/2);return wn("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>wn("div",{className:"semiotic-loading-bar",style:{...An,position:"absolute",top:l+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Cn(e,t,n,r){if(!$n)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}import{useId as Rn,useMemo as Nn,useCallback as Ln}from"react";function On(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function In(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function zn(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Fn,Dn]=W(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!zn(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),a=In(i,t),l=new Map(a.clauses);return l.set(n.clientId,n),i.set(t,{...a,clauses:l}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=In(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));import{useSyncExternalStore as Pn}from"react";var Tn={positions:new Map},Bn=new Set;function En(){for(const e of Bn)e()}function Hn(e,t){const n=Tn.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(Tn.positions);r.delete(e),Tn={positions:r},En()}function Gn(e,t){const n=Tn.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(Tn.positions);r.delete(e),Tn={positions:r},En()}function qn(){return Tn}function _n(e){return Bn.add(e),()=>Bn.delete(e)}var Yn={positions:new Map};function Vn(){return()=>{}}function Un(){return Yn}function Zn(e){const t=Pn(e?_n:Vn,e?qn:Un,e?qn:Un);return e?t.positions.get(e)??null:null}function Xn(e){const t=Rn(),n=e.clientId||t,{name:r}=e,o=Dn(e=>e.selections.get(r)),i=Dn(e=>e.setClause),a=Dn(e=>e.clearClause),l=Nn(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Nn(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(On(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:l,selectPoints:Ln(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:Ln(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:Ln(()=>{a(r,n)},[a,r,n]),clientId:n}}function Jn(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Kn(e){const{name:t,xField:n,yField:r}=e,{predicate:o,isActive:i,selectInterval:a,clear:l}=Xn({name:t,fields:[n,r].filter(Boolean)}),s=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Ln(e=>{if(!e)return void l();const t={};"xyBrush"===s&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===s&&Jn(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===s&&Jn(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Qn(t)&&a(t)},[s,n,r,a,l]);return{brushInteraction:Nn(()=>({brush:s,during:c,end:c}),[s,c]),predicate:o,isActive:i,clear:l}}function Qn(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function er(e){return e?"string"==typeof e?{name:e}:e:null}function tr(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var nr={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function rr(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!o&&!i)return nr;const l=a??{};return{enabled:!0,tapToSelect:l.tapToSelect??!0,tapToLockTooltip:l.tapToLockTooltip??!0,clearSelection:l.clearSelection??"backgroundTap",targetSize:l.targetSize??r??44,snap:l.snap??"nearestDatum",brushHandleSize:l.brushHandleSize??44,standardControls:l.standardControls??!1}}var or={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function ir(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(or,e)}function ar(e,t,n){const r=or[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,a={...t,mode:e},l=s(a,{width:t.width??o,height:t.height??i}).props,c=l.mode||e||"primary",d=or[c],u="context"===c||"sparkline"===c,h="primary"===c&&n?.width?n.width:d.width;return{mode:c,width:l.width??h,height:l.height??("primary"===c&&n?.height?n.height:d.height),showAxes:l.showAxes??d.showAxes,showGrid:l.showGrid??d.showGrid,enableHover:l.enableHover??(!!l.linkedHover||d.enableHover),showLegend:l.showLegend??d.showLegend,showLabels:l.showLabels??d.showLabels,title:u?void 0:l.title,description:l.description,summary:l.summary,accessibleTable:l.accessibleTable,xLabel:u?void 0:l.xLabel,yLabel:u?void 0:l.yLabel,categoryLabel:u?void 0:l.categoryLabel,valueLabel:u?void 0:l.valueLabel,marginDefaults:lr(d.marginDefaults,l.showCategoryTicks,l.orientation),compactMode:u,mobileInteraction:rr(l.mobileInteraction,{mode:c,width:l.width??h,mobileSemantics:l.mobileSemantics}),mobileSemantics:l.mobileSemantics}}function lr(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as sr,useCallback as cr,useState as dr,useId as ur,useEffect as hr,useRef as fr}from"react";import{createContext as yr,useContext as mr,useMemo as pr}from"react";import{scaleOrdinal as gr}from"d3-scale";var br={category10:v,tableau10:w,set3:k,...h},xr=v,vr="#007bff";function kr(e,t,n=xr){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=br[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}var wr=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],$r=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Mr=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Sr(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Mr.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):xr[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%xr.length]}function Ar(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function Wr(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Ar(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return gr().domain(r).range(n).unknown("#999");const i=br[n]||br.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:xr;return gr().domain(r).range(e).unknown("#999")}}function jr(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,a]=r,[l,s]=n;if(a===i)return(l+s)/2;let c=(o-i)/(a-i);return 0>c?c=0:c>1&&(c=1),l+c*(s-l)}import{jsx as Cr}from"react/jsx-runtime";var Rr=yr(null);function Nr(){return mr(Rr)}import{createContext as Lr,useContext as Or,useEffect as Ir,useId as zr,useLayoutEffect as Fr,useMemo as Dr,useRef as Pr,useState as Tr,useCallback as Br}from"react";import*as Er from"react";var Hr=22;function Gr(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function qr(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const o=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const a=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:a,endY:n}})}import{jsx as _r,jsxs as Yr}from"react/jsx-runtime";var Vr={fill:(e,t)=>_r("rect",{style:e,width:t,height:t}),line:(e,t)=>_r("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Ur(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Vr[n])(r(e,t),o),i}function Zr({swatchSize:e}){return _r("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Xr(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Jr=(e,t,n,r,o,i,a,l,s,c,d)=>{const{type:u="fill",styleFn:h,items:f}=e,y=[];let m=0;const p=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:x,rowHeight:v}=d;return f.forEach((e,c)=>{const d=Ur(e,c,u,h,b),k=Xr(e,r,o),w=o&&o.size>0&&o.has(e.label);y.push(Yr("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:p?l===i&&c===a?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&g?w||!1:void 0,"aria-current":p&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:p?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;s(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:p?t=>{s(l,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[p&&_r("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&_r(Zr,{swatchSize:b}),_r("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=v}),y};function Kr({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=e,l=a||(e=>Math.round(100*e)/100+""),s="grad-legend-"+Er.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(_r("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return Yr("g",{"aria-label":i||"Gradient legend",children:[_r("defs",{children:_r("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&_r("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),_r("rect",{x:a,y:0,width:t,height:e,fill:`url(#${s})`,rx:2}),_r("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])}),_r("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(_r("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return Yr("g",{"aria-label":i||"Gradient legend",children:[i&&_r("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),_r("defs",{children:_r("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),_r("rect",{x:0,y:0,width:14,height:100,fill:`url(#${s})`,rx:2}),_r("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])}),_r("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])})]})}function Qr(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:l="Legend",width:s=100,height:c=20,orientation:d="vertical",legendLayout:u}=e,h=Gr(u),[f,y]=Er.useState(0),[m,p]=Er.useState(0),g=Er.useCallback((e,t)=>{y(e),p(t)},[]),b="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:s,legendInteraction:c,metrics:d})=>{const u=[],h=qr(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),d.rowHeight);return e.forEach((e,f)=>{const y=h[f];u.push(_r("line",{stroke:"gray",x1:0,y1:y.lineY,x2:t,y2:y.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=y.labelY&&u.push(_r("text",{y:y.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),u.push(_r("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Jr(e,n,r,o,i,a,l,f,s,c,d)},"legend-group-"+f))}),u})({legendGroups:t||[],width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const m=((e,t,n,r,o,i,a,l,s,c,d,u)=>{const{type:h="fill",styleFn:f,items:y}=e,m=[],{swatchSize:p,labelGap:g,itemGap:b,rowHeight:x,align:v}=d,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=o,$=y.map(e=>p+g+7*e.label.length),M=[];let S=0,A=0;$.forEach((e,t)=>{const n=0===A?e:A+b+e;u&&u>0&&A>0&&n>u?(M.push({start:S,end:t,width:A}),S=t,A=e):A=n}),y.length>0&&M.push({start:S,end:y.length,width:A}),M.forEach((e,c)=>{let d="center"===v?Math.max(0,((u??e.width)-e.width)/2):"end"===v?Math.max(0,(u??e.width)-e.width):0;for(let u=e.start;e.end>u;u++){const e=y[u],v=Ur(e,u,h,f,p),M=Xr(e,r,o),S=o&&o.size>0&&o.has(e.label);m.push(Yr("g",{transform:`translate(${d},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?l===i&&u===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+y.length)%y.length;s(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{s(l,u),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&_r("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:p+g+2+7*e.label.length,height:p+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,S&&_r(Zr,{swatchSize:p}),_r("text",{y:p/2,x:p+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+u)),d+=$[u]+b}});const W=Math.max(0,...M.map(e=>e.width)),j=M.length;return{items:m,offset:W,totalRows:j,totalHeight:j*x}})(e,r,o,i,a,l,s,t,c,d,u,u.maxWidth??n);y+=m.offset+5,f.push({label:e.label,...m,offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=y+12});const y=u.maxWidth??n;let m=h>y?0:"center"===u.align?Math.max(0,(y-h)/2):"end"===u.align?Math.max(0,y-h):0;const p=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(p.push(_r("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),p.push(_r("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&p.push(_r("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),_r("g",{children:p})})({legendGroups:t||[],title:l,height:c,width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:h}),x=!(!n&&!r);return Yr("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&_r("text",{className:"legend-title",y:16,x:s/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),b]})}import{jsx as eo,jsxs as to}from"react/jsx-runtime";var no=Lr(!1);Lr(!1);var ro=Lr(null),oo="undefined"==typeof window?Ir:Fr;function io(...e){let t;for(const n of e)n&&(t=ao(t)&&ao(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function ao(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function lo(e){return"object"==typeof e&&null!==e&&"gradient"in e}function so(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function co(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function uo(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ho=[];function fo(){const e=t(),n=e?.colors?.categorical;return n&&n.length>0?n:void 0}function yo(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=Ar(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=br[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:vr}function mo(e,t,n){const r=Nr(),o=fo();return sr(()=>{if(!t)return;const i=r??void 0,a=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&uo(i)){const e=Wr(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return Wr(n.map(e=>({_cat:e})),"_cat",a)}if(i&&uo(i)){const n=Wr(e,t,a);return e=>i[e]||n(e)}return Wr(e,t,a)}if(i&&uo(i)){const e=Wr([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,r,o])}function po({selection:e,linkedHover:t,fallbackFields:n=ho,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:l,hoverHighlight:s,colorByField:c,mobileInteraction:u}){const h=ur(),f=sr(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),y=sr(()=>"series"===f?.mode?[f.seriesField||c||n[0]].filter(e=>!!e):f?.fields||n,[f,c,n]),m=Xn({name:e?.name||"__unused__",fields:y}),p=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:a}=Xn({name:t,fields:n});return{onHover:Ln(e=>{if(!e)return void a();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}Qn(t)&&i(t)},[n,i,a]),predicate:r,isActive:o}}({name:f?.name||"hover",fields:y}),g=d(e=>e.pushObservation),b=cr(e=>{o?.(e),g?.(e)},[o,g]),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,k]=dr(null),w=fr(!1),$=c||n[0],M=sr(()=>{if(!s||null==v||!$)return null;const e=v,t=$;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[s,v,$]),S=cr((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===f?.mode&&f.xField){const n=so(e,t,f.xField);null!=n&&function(e,t,n){const r=Tn.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(Tn={positions:new Map(Tn.positions).set(e,{xValue:t,sourceId:n})},En())}(f.name||"hover",n,h)}"x-position"!==f?.mode&&p.onHover(t)}else"x-position"!==f?.mode||r||Hn(f.name||"hover",h),"x-position"===f?.mode||r||p.onHover(null);if(s&&$)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[$];k(null!=n?n+"":null)}else r||k(null);(o||g)&&yn({onObservation:b,datum:e?co(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,p,f,h,o,i,a,g,b,s,$,u]),A=cr((n=!0)=>{w.current=!1,t&&"x-position"!==f?.mode&&p.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&s&&k(null),"x-position"===f?.mode&&(Gn(f.name||"hover",h),Hn(f.name||"hover",h))},[t,f,p,e,u,m,s,h]),W=cr((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),d=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===f?.mode&&f.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=so(n,e,f.xField);null!=t&&function(e,t,n){const r=Tn.positions.get(e);if(r?.locked){const t=new Map(Tn.positions);return t.delete(e),Tn={positions:t},En(),!1}Tn={positions:new Map(Tn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},En()}(f.name||"hover",t,h)}if(c)if(n){w.current=!0;const r=co(n);if(t&&"x-position"!==f?.mode&&p.onHover(r),e&&u?.tapToSelect&&y.length>0){const e={};for(const t of y){const n=r[t];void 0!==n&&(e[t]=[n])}uo(e)&&m.selectPoints(e)}if(s&&$){const e=r?.[$];k(null!=e?e+"":null)}}else d&&A();if(n||d){if(n&&l){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),l(e,{x:n.x??0,y:n.y??0})}(o||g)&&mn({onObservation:b,datum:n?co(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[l,o,g,b,i,a,f,h,u,t,p,e,m,y,s,$,A]);return hr(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),hr(()=>()=>{w.current&&A(!1)},[A]),hr(()=>{if("x-position"!==f?.mode)return;const e=f.name||"hover";return()=>{Gn(e,h),Hn(e,h)}},[f?.mode,f?.name,h]),{activeSelectionHook:x,hoverSelectionHook:M,customHoverBehavior:S,customClickBehavior:W,crosshairSourceId:h}}function go(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function bo({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:l,additionalLegend:s}){const c=Or(no),d=null!==Or(ro),u=void 0!==r?r:!c&&!!t,h=!!t&&(u||d),f=sr(()=>{if(!h)return[];if(void 0!==l)return l;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[l,t,e,h]);!function(e){const t=Or(ro),n=zr(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=Pr([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;oo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),oo(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(d&&t?f:[]);const y=sr(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),l=a?r(a,t,n):n?n(o):wr[i%wr.length];return{label:o+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Sr,categories:f});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,f]),m=sr(()=>io(y,s),[y,s]),p=sr(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return m&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,i,m,o]);return{legend:m,margin:p,legendPosition:o}}function xo(e,t,n){const[r,o]=dr(null),[i,a]=dr(new Set),l=sr(()=>new Set,[]),s=cr(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=cr(t=>{"isolate"===e&&a(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),d=sr(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:l,onLegendHover:s,onLegendClick:c,legendSelectionHook:d}}function vo(e,t,n){return ar(e,t,n)}import{jsx as ko}from"react/jsx-runtime";function wo(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,title:l,legendHoverBehavior:s,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,y=!!l,m=Math.max(0,n-o.left-o.right),p=Math.max(1,f?a?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,o.left-p-10),b=o.top):"top"===i?(g=o.left,b=y?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),ko("g",{transform:`translate(${g}, ${b})`,children:lo(t)?ko(Kr,{config:t.gradient,orientation:f?"horizontal":"vertical",width:p}):ao(t)?ko(Qr,{legendGroups:t.legendGroups,title:"",width:p,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):t})}import{jsx as $o}from"react/jsx-runtime";var Mo={secondary:0,primary:3},So=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Ao(e){return!0===e?._annotationDeferred}function Wo(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function jo(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Co(e){return Math.max(.72,.95-.06*e)}function Ro(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:jo(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Ao(e.annotation)),o=e.some(e=>null!=Wo(e.annotation)),i=e.some(e=>"layer"===Wo(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=Mo[e.emphasis]);const l=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=Ao(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;a=$o("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Co(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const l=Wo(t.annotation);return l&&(a=$o("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+n)),i&&(a=$o("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&l.unshift($o("style",{children:So},"annotation-disclosure-style")),i&&l.unshift($o("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}import*as No from"react";import{jsx as Lo,jsxs as Oo}from"react/jsx-runtime";function Io(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let a="";for(const e of o)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function zo(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Fo(e,t,n,r){if(!e)return Lo("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:l,wrap:s=120,noWrap:c}=e;if(!o&&!i)return Lo("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let u=l;u&&"dynamic"!==u||(u="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===d?"right"===u?h="end":"middle"===u&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:Io(i,s):[],m=o?c?[o]:Io(o,s):[],p="leftRight"===d?"end"===h?-4:4:0;let g=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Lo("foreignObject",{className:"annotation-note-html",x:"end"===h?p-s:"middle"===h?p-s/2:p,y:-16,width:s,height:Math.max(f,(y.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:Oo("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Lo("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&Lo("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(b.push(Lo("text",{className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold",children:y.map((e,t)=>Lo("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=y.length*f),m.length>0&&b.push(Lo("text",{className:"annotation-note-label",fill:x,textAnchor:h,y:g,children:m.map((e,t)=>Lo("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(s,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=Lo("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===u?(t=-e,n=0):"middle"===u&&(t=-e/2,n=e/2),v=Lo("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+m.length-1)*f;let w=0;return"topBottom"===d?w=0>n?-(k+2):18:"leftRight"===d&&(w="middle"===u?-(k+f+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===u||0>n?-(k+2):18),Oo("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Lo("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),v]})}function Do(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Lo("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push(Lo("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,a=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(Lo("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(Lo("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Lo("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Lo("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push(Lo("path",{d:zo(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Lo("g",{className:"annotation-subject",children:i})}function Po(e,t,n,r,o,i){const a=[];let l=0,s=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,a=e-o,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),d=n/2,u=r/2,h=e*u>t*d?d/e:u/t;l=o+a*h,s=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,s=n):void 0!==t&&(l=n,s=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);l=Math.cos(r)*n,s=Math.sin(r)*n}}const c=Math.sqrt((e-l)**2+(t-s)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let d=Math.atan2(t-s,e-l);if(i){const r=(l+e)/2,i=(s+t)/2,u=-(t-s)/c,h=(e-l)/c,f=(n?.curve??.25)*c,y=r+u*f,m=i+h*f;a.push(Lo("path",{className:"connector-curve",d:`M${l},${s}Q${y},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),d=Math.atan2(m-s,y-l)}else a.push(Lo("line",{x1:l,y1:s,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Lo("path",{d:`M${l},${s}L${l+e*Math.cos(d+t)},${s+e*Math.sin(d+t)}L${l+e*Math.cos(d-t)},${s+e*Math.sin(d-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return Lo("g",{className:"annotation-connector",children:a})}function To(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:l,connector:s,subject:c,type:d,color:u,className:h,disable:f,opacity:y,strokeDasharray:m,events:p={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-b),null!=a&&(w=a-x);const $="string"==typeof d?d:"label";if("bracket"===$&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return Oo("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=y&&{opacity:y},...m&&{strokeDasharray:m},...p,children:[!v.has("connector")&&Po(k,w,s,u,$,c),!v.has("subject")&&Do($,c,u,b,x),!v.has("note")&&Fo(l,k,w,u)]})}function Bo(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return Lo(To,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return Lo("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Lo(To,{"data-testid":"semiotic-annotation",events:o,...t,type:r},a)}import{packEnclose as Eo}from"d3-hierarchy";import{area as Ho,curveLinear as Go,curveMonotoneX as qo,curveMonotoneY as _o,curveStep as Yo,curveStepAfter as Vo,curveStepBefore as Uo,curveBasis as Zo,curveCardinal as Xo,curveCatmullRom as Jo}from"d3-shape";function Ko(e){return Math.round(100*e)/100}function Qo(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ko);return{points:e.map(([e])=>[Ko(e),Ko(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}import{jsx as ei,jsxs as ti}from"react/jsx-runtime";var ni="var(--semiotic-bg, #ffffff)";function ri(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:l,textAnchor:s="start",dominantBaseline:c,background:d,className:u}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(d),f=e=>ei("text",{x:t,y:n,textAnchor:s,dominantBaseline:c,fill:o,fontSize:i,fontWeight:a,fontFamily:l,className:u,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ni,strokeWidth:h.haloWidth??3});const y=h.padding??{x:6,y:3},m="number"==typeof y?y:y.x,p="number"==typeof y?y:y.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*p;let x,v;return x="middle"===s?t-g/2-m:"end"===s?t-g-m:t-m,v="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-p:n-.8*i-p,ti("g",{className:u,children:[ei("rect",{x:x,y:v,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ni,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}import{jsx as oi,jsxs as ii}from"react/jsx-runtime";var ai={linear:Go,monotoneX:qo,monotoneY:_o,step:Yo,stepAfter:Vo,stepBefore:Uo,basis:Zo,cardinal:Xo,catmullRom:Jo};function li(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,annotation:e})}),Ro(o)}function si(e,t={}){return function(e,r,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=p(e,r,o);if(!t)return null;const{x:n,y:i}=t;if(!m(n,i,o))return null;const a="callout"===e.type?"callout-circle":e.type,l="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return oi(Bo,{noteData:{x:n,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...l?{subject:l}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+r)}case"x-threshold":{const t=b(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const l=t>.6*(o.width||0),s=l?t-4:t+4,c=l?"end":"start";return ii("g",{opacity:e.opacity,children:[oi("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&oi(ri,{x:s,y:a,text:e.label,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+r)}case"y-threshold":{const t=x(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let a,s;"left"===i?(a=4,s="start"):"center"===i?(a=(o.width||0)/2,s="middle"):(a=(o.width||0)-4,s="end");const c=20>(l=t)?Math.min((o.height||0)-4,l+16):l-4;return ii("g",{opacity:e.opacity,children:[oi("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&oi(ri,{x:a,y:c,text:e.label,textAnchor:s,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+r)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:b({...e,type:"point"},o),y:x({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=Eo(t),i=e.padding||10;return ii("g",{children:[oi("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&oi(ri,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+r)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:b({...e,type:"point"},o),y:x({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=e.padding||10,i=t.map(e=>e.x),a=t.map(e=>e.y),[l,s]=M(i),[c,d]=M(a),u=l-n,h=s+n,f=c-n;return ii("g",{children:[oi("rect",{x:u,y:f,width:h-u,height:d+n-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&oi(ri,{x:(u+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+r)}case"highlight":{const t=o.data||[],n="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return oi("g",{children:n.map((t,n)=>{const r=b(t,o),a=x(t,o);if(null==r||null==a)return null;const l="function"==typeof e.r?e.r(t):e.r||6,s="function"==typeof e.style?e.style(t):e.style||i;return oi("circle",{cx:r,cy:a,r:l,...s},"hl-"+n)})},"ann-"+r)}case"bracket":{const t=b(e,o),n=x(e,o);return oi(Bo,{noteData:{x:t??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+r)}case"trend":{const t=o.data||[];if(2>t.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a="ordinal"===o.frameType,l="horizontal"===o.projection,s=a?n:null,c=a?i:null;let d;const u=[],h=new Map;if(a&&s&&c){for(const e of t){const t=e[s];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,u.length),u.push(n))}d=t.map(e=>{const t=e[s],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else d=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>d.length)return null;const f=o.scales?.x??o.scales?.time,y=o.scales?.y??o.scales?.value;if(!f||!y)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(u.length-1,n+1),o=t-n,i=e(u[n]);return i+(e(u[r])-i)*o},p=f,g=y;let b;if(a)if(l){const e=m(g);b=(t,n)=>[p(n),e(t)]}else{const e=m(p);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[p(e),g(t)];const x=e.method||"linear";let v;if("loess"===x)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),s=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===s?0:r[e]/s;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,f=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],y+=t*o[e]*i[e])}if(0===d){l.push([t,i[e]]);continue}const m=d*f-u*u;if(1e-12>Math.abs(m))l.push([t,h/d]);else{const e=(d*y-u*h)/m;l.push([t,(h-e*u)/d+e*t])}}return l}(d,e.bandwidth??.3);else{const t="polynomial"===x?Qo(d,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ko((n*t[3]-t[0]*t[1])/r),i=Ko(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ko(e),Ko(o*e+i)]),equation:[o,i]}}(d);v=t.points}const k=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),w=e.color||"#6366f1",$=v[v.length-1],[M,S]=b($[0],$[1]);return ii("g",{children:[oi("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&oi("text",{x:M+4,y:S-4,fill:w,fontSize:11,children:e.label})]},"ann-"+r)}case"band":{const t=o.scales?.y??o.scales?.value,n=t?.domain?.(),l=e.y0??n?.[0],s=e.y1??n?.[1],d=null!=l&&t?t(l):0,u=null!=s&&t?t(s):o.height||0,h=c(e.fill,"ann-"+r,"var(--semiotic-primary, #6366f1)");return ii("g",{opacity:e.opacity,children:[h.def&&oi("defs",{children:h.def}),oi("rect",{x:0,y:Math.min(d,u),width:o.width||0,height:Math.abs(u-d),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&oi(ri,{x:(o.width||0)-4,y:(i=d,a=u,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+r)}case"x-band":{const t=o.scales?.x??o.scales?.time,n=t?.domain?.(),i=e.x0??n?.[0],a=e.x1??n?.[1],l=null!=i&&t?t(i):null,s=null!=a&&t?t(a):null;if(null==l||null==s)return null;const d=c(e.fill||e.color,"ann-"+r,"var(--semiotic-primary, #6366f1)");return ii("g",{opacity:e.opacity,children:[d.def&&oi("defs",{children:d.def}),oi("rect",{x:Math.min(l,s),y:0,width:Math.abs(s-l),height:o.height||0,fill:d.fill,fillOpacity:e.fillOpacity??.1}),e.label&&oi(ri,{x:Math.min(l,s)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+r)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const l=e.upperAccessor||"upperBounds",s=e.lowerAccessor||"lowerBounds",c=e.filter,d=t.filter(e=>null!=e[l]&&null!=e[s]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>d.length)return null;const u=ai[o.curve||"linear"]||Go,h=Ho().x(e=>i(e[n])).y0(e=>a(e[s])).y1(e=>a(e[l])).curve(u)(d);if(!h)return null;const f=e.fill||"#6366f1";return ii("g",{children:[oi("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&d.length>0&&oi("text",{x:i(d[d.length-1][n])+4,y:a(d[d.length-1][l])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+r)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const l=t.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const s=l.reduce((e,t)=>e+t,0)/l.length,c=l.reduce((e,t)=>e+(t-s)**2,0)/l.length,d=Math.sqrt(c),u=e.threshold??2,h=s-u*d,f=!1!==e.showBand,y=e.fill||"#6366f1",m=e.fillOpacity??.1,p=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,v=a(s+u*d),k=a(h),w=t.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-s)>u*d});return ii("g",{children:[f&&oi("rect",{x:0,y:Math.min(v,k),width:o.width||0,height:Math.abs(k-v),fill:y,fillOpacity:m}),w.map((e,t)=>{const n=b(e,o),r=x(e,o);return null==n||null==r?null:oi("circle",{cx:n,cy:r,r:g,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5},"anomaly-"+t)}),e.label&&oi("text",{x:(o.width||0)-4,y:Math.min(v,k)-4,textAnchor:"end",fill:y,fontSize:11,children:e.label})]},"ann-"+r)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a=o.scales?.x??o.scales?.time,l=o.scales?.y??o.scales?.value;if(!a||!l)return null;const s=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>s.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Qo(s,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=s.length;let t=0,n=0,r=0,o=0;for(const[e,i]of s)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const a=(e*o-t*n)/i,l=(n-a*t)/e;c=e=>l+a*e}const d=s.length,u=s.map(([e,t])=>t-c(e)),h=u.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),y=s.reduce((e,t)=>e+t[0],0)/d,m=s.reduce((e,t)=>e+(t[0]-y)**2,0),p=e.confidence??.95,g=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=e.steps??5,x=s[d-1][0],v=(x-s[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/d+(m>0?(e-y)**2/m:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const $=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(c(x))}`,A=e.strokeColor||"#6366f1";return ii("g",{children:[oi("path",{d:$,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),oi("polyline",{points:`${S} ${M}`,fill:"none",stroke:A,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&oi("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:e.label})]},"ann-"+r)}case"widget":{let i,a;if(null!=e.px&&null!=e.py)i=e.px,a=e.py;else{const t=p(e,r,o);if(!t)return null;i=t.x,a=t.y}if(!m(i,a,o))return null;const l=e.dx??0,s=e.dy??0,c=e.width??32,d=e.height??32,u=e.content??oi("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return oi("foreignObject",{x:i+l-c/2,y:a+s-d/2,width:c,height:d,style:{overflow:"visible",pointerEvents:"auto"},children:oi("div",{...n(e,t),style:{width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+r)}case"text":{const t=p(e,r,o);if(!t)return null;const{x:n,y:i}=t,a=n+(e.dx||0),l=i+(e.dy||0),s=e.color||"var(--semiotic-text, #333)",c=oi("text",{x:a,y:l,fill:s,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?No.cloneElement(c,{key:"ann-text-"+r}):ii("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[oi("line",{x1:n,y1:i,x2:a,y2:l,stroke:s,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),No.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+r)}case"category-highlight":{const t=e.category;if(null==t)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,a=o.scales?.x,l=o.scales?.y,s=n(i)?i:n(a)?a:n(l)?l:null;if(!s)return null;const c=s(t+"");if(null==c)return null;const d=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return ii("g",(o.projection?"vertical"===o.projection:s===a)?{children:[oi("rect",{x:c,y:0,width:d,height:o.height||0,fill:u,fillOpacity:h}),f&&oi(ri,{x:c+d/2,y:16,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[oi("rect",{x:0,y:c,width:o.width||0,height:d,fill:u,fillOpacity:h}),f&&oi(ri,{x:12,y:c+d/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+r)}default:return null}var i,a,l}}function ci(e,t,n){return kr(e,t,n)}function di(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Ar(n,e)||"#4e79a7":t=>{if(n){const e=Ar(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}export{R as filterSparseArray,L as parseDateLikeString,O as coerceDateLikeValue,I as coerceTemporalStringRows,xr as DEFAULT_COLORS,vr as DEFAULT_COLOR,kr as resolveCategoricalPalette,wr as STREAMING_PALETTE,$r as DEPTH_PALETTE_COLORS,Sr as getColor,Ar as resolveExplicitColor,Wr as createColorScale,jr as getSize,Xt as computeEasing,Jt as computeRawProgress,Kt as lerp,Qt as now,q as useSceneRevisionDiagnostics,_ as runSceneBuild,Y as SceneRevisionDiagnosticsObserver,je as resolveCurveFactory,Ce as resolveCanvasFill,Re as coerceCanvasFill,Ne as buildLinearFillGradient,Le as buildColorStopGradient,Hr as DEFAULT_LEGEND_ROW_HEIGHT,Gr as resolveLegendMetrics,qr as layoutVerticalLegendGroups,io as composeLegendConfigs,ao as isLegendConfig,lo as isGradientLegendConfig,wo as renderLegendFromConfig,Bo as SemioticAnnotation,So as ANNOTATION_DISCLOSURE_REVEAL_CSS,Ro as applyAnnotationEmphasis,ri as AnnotationLabel,li as renderAnnotationPass,si as createDefaultAnnotationRules,Gn as unlockCrosshair,Zn as useCrosshairPosition,V as TITLE_BASELINE,U as hasTextTitle,X as reserveTitleMargin,Q as hasAnyCornerRadius,ee as clampCornerRadii,De as networkSceneNodeToSVG,Pe as networkSceneEdgeToSVG,Te as networkLabelToSVG,Ge as geoSceneNodeToSVG,me as ordinalSceneNodeToSVG,Ve as xySceneNodeToSVG,Ue as isServerEnvironment,tt as useHydration,it as useWasHydratingFromSSR,ft as useDataSummary,st as AriaLiveTooltip,pt as computeCanvasAriaLabel,gt as computeNetworkAriaLabel,Nt as AccessibleDataTable,Lt as NetworkAccessibleDataTable,Ot as ScreenReaderSummary,It as SkipToTableLink,Dt as FocusRing,Bt as FlippingTooltip,rn as useFrame,sn as useFrameCanvasHost,cn as CanvasFrameBackground,dn as prepareCanvas,un as getDevicePixelRatio,hn as observationInputType,fn as isInteractiveKeyboardTarget,yn as emitHoverObservations,mn as emitClickObservations,ci as resolveCustomLayoutPalette,di as buildResolveColor,xn as ChartError,Mn as SafeRender,Wn as renderEmptyState,jn as renderLoadingState,Cn as warnMissingField,Nr as useCategoryColors,Kn as useBrushSelection,er as normalizeLinkedBrush,tr as wrapStyleWithSelection,rr as resolveMobileInteraction,ir as isChartMode,ar as resolveChartMode,fo as useThemeCategorical,yo as resolveDefaultFill,mo as useColorScale,po as useChartSelection,go as getCrosshairProps,bo as useChartLegendAndMargin,xo as useLegendInteraction,vo as useChartMode};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{StreamXYFrame_default as e}from"./chunk-chunk-B3DRZPBK.module.min.js";import{buildCustomBehaviorProps as t}from"./chunk-chunk-F7WFPD4O.module.min.js";import{normalizeLinkedBrush as n,useBrushSelection as i,useChartLegendAndMargin as s,useChartMode as o,useChartSelection as r}from"./chunk-chunk-BFHUYEOS.module.min.js";import{renderEmptyState as a,renderLoadingState as l}from"./chunk-chunk-ACLDBMRH.module.min.js";var c=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},u=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,i=Math.floor(e/n);for(let s=Math.floor((e-this.size)/n)+1;i>=s;s++)this.bump(s*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new c,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,i=new c;i.push(t);let s=e,o=e;const r=[],a={start:s,end:o,stats:i};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>o&&(o=t.end));a.start=s,a.end=o,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const i=t+this.size;e.push(this.row(t,i,n,i>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,i){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:i}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function m(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function h(e,t,n,i=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=m(e,n),o=e.stddev*i;return[s-o,s+o]}var d={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},p=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function g(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;p.lastIndex=0;let n,i=0,s=0;for(;null!==(n=p.exec(t));){const e=parseFloat(n[1]),t=d[n[2]];if(null==t||!Number.isFinite(e))return null;i+=e*t,s+=n[0].length}return s!==t.length?null:i>0?i:null}var v=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const i of this.held)this.getTime(i)>e?n.push(i):t.push(i);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as f,useImperativeHandle as w,forwardRef as y,useCallback as b,useState as x,useEffect as A}from"react";import{jsx as _,jsxs as k}from"react/jsx-runtime";var H={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},S={opacity:.7,marginRight:4};function z(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function I(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function C(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=z(o,t,"time"),a=z(o,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]})]})}}function T(e,t){return null!=e?e:Math.max(t?.length??0,200)}var R="time",P="value",F="__aggLower",M="__aggUpper",N="__aggPartial",D="count",B="__aggStart",E="__aggEnd";function O(e,t){const n=t.stat??"mean",i=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[R]:(e.start+e.end)/2,[P]:m(e,n),[D]:e.count,[N]:e.partial,[B]:e.start,[E]:e.end},o=h(e,i,n,s);return o&&(t[F]=o[0],t[M]=o[1]),t})}import{jsx as j}from"react/jsx-runtime";function L(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isFinite(s)?s:null}var W=y(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:m,className:h,arrowOfTime:d="right",windowMode:p="sliding",windowSize:y,data:_,timeAccessor:k,valueAccessor:H,timeExtent:S,valueExtent:z,extentPadding:I,stroke:N="#007bff",strokeWidth:D=2,strokeDasharray:B,opacity:E,background:W,tooltipContent:V,tooltip:$,onHover:Y,annotations:q,autoPlaceAnnotations:U,svgAnnotationRules:X,tickFormatTime:K,tickFormatValue:Z,decay:G,pulse:J,staleness:Q,transition:ee,linkedHover:te,selection:ne,onObservation:ie,chartId:se,loading:oe,loadingContent:re,emptyContent:ae,emphasis:le,legendPosition:ce,aggregate:ue,eventTime:me}=n,he=s.showAxes,de=s.enableHover,pe=m??s.marginDefaults,ge=c??[s.width,s.height],ve=V??$??C({timeAccessor:k,valueAccessor:H}),fe=f(null),{customHoverBehavior:we}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ie,chartType:"RealtimeLineChart",chartId:se}),ye=b(e=>{Y&&Y(e),we(e)},[Y,we]),be=null!=ue,[xe,Ae]=x([]),_e=f(null),ke=f(ue);ke.current=ue;const He=f(be);He.current=be;const Se=f(xe);Se.current=xe;const ze=f({timeAccessor:k,valueAccessor:H});ze.current={timeAccessor:k,valueAccessor:H},A(()=>{if(!be)return void(_e.current=null);const e=ke.current,t=function(e){const t=e.window??"tumbling",n=g("session"===t?e.gap??e.size:e.size);if(null==n)return null;const i=null!=e.hop?g(e.hop):void 0,s=null!=e.gap?g(e.gap):void 0;return new u({window:t,size:n,hop:i??void 0,gap:s??void 0,retain:e.retain})}(e);if(_e.current=t,t&&_){const{timeAccessor:e,valueAccessor:n}=ze.current;for(const i of _){const s=L(i,e,"time"),o=L(i,n,"value");null!=s&&null!=o&&t.push(s,o)}}Ae(t?O(t,e):[])},[be?[ue.window??"tumbling",ue.size,ue.hop??"",ue.gap??"",ue.retain??""].join("|"):"",be,_]),A(()=>{be&&_e.current&&Ae(O(_e.current,ke.current))},[ue?.stat,ue?.band,ue?.sigma]);const Ie=b(e=>{const t=_e.current,n=ke.current;if(!t||!n)return;const{timeAccessor:i,valueAccessor:s}=ze.current;for(const n of e){const e=L(n,i,"time"),o=L(n,s,"value");null!=e&&null!=o&&t.push(e,o)}Ae(O(t,n))},[]),Ce=null!=me,Te=f(null),Re=f(me);Re.current=me;const Pe=f(Ce);Pe.current=Ce;const Fe=f(ie);Fe.current=ie;const Me=f(se);Me.current=se,A(()=>{Te.current=Ce?function(e){const t=g(e.lateness);return null==t?null:new v({lateness:t,getTime:e=>L(e,ze.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Re.current):null},[Ce?`${me.lateness}|${me.latePolicy??"drop"}`:"",Ce]);const Ne=b(e=>{0!==e.length&&(He.current?Ie(e):fe.current?.pushMany(e))},[Ie]),De=b(e=>{const t=Te.current;if(!Pe.current||!t)return void Ne(e);const n=[];for(const i of e){const e=t.push(i);if(e.released.length&&n.push(...e.released),e.late.length){const n=Fe.current;if(n){const{timeAccessor:i}=ze.current,s=Re.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:L(o,i,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Me.current})}}}Ne(n)},[Ne]);w(i,()=>({push:e=>De([e]),pushMany:e=>De(e),remove:e=>He.current?[]:fe.current?.remove(e)??[],update:(e,t)=>He.current?[]:fe.current?.update(e,t)??[],clear:()=>{Te.current?.clear(),He.current?(_e.current?.clear(),Ae([])):fe.current?.clear()},getData:()=>He.current?Se.current:fe.current?.getData()??[],getScales:()=>fe.current?.getScales()??null}),[De]);const Be=l(oe,ge[0],ge[1],re),Ee=Be?null:a(be?void 0:_,ge[0],ge[1],ae),Oe={stroke:N,strokeWidth:D,strokeDasharray:B};null!=E&&(Oe.opacity=E);const je=T(y,_),Le=be?xe:_,We=be?R:k,Ve=be?P:H,$e=be&&ue&&"none"!==(ue.band??"none")?{y0Accessor:F,y1Accessor:M,perSeries:!1}:void 0;return Be||Ee||j(e,{ref:fe,chartType:"line",runtimeMode:"streaming",size:ge,margin:pe,className:le?`${h||""} semiotic-emphasis-${le}`.trim():h,arrowOfTime:d,windowMode:be?"growing":p,windowSize:be?Math.max(1,ue?.retain??Math.max(xe.length,600)):je,data:Le,timeAccessor:We,valueAccessor:Ve,xExtent:S,yExtent:z,extentPadding:I,band:$e,lineStyle:Oe,showAxes:he,background:W,hoverAnnotation:de,tooltipContent:ve,...t({linkedHover:te,selection:ne,onObservation:ie,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ye}),annotations:q,autoPlaceAnnotations:U,svgAnnotationRules:X,tickFormatTime:K,tickFormatValue:Z,decay:G,pulse:J,staleness:Q,transition:ee,pointIdAccessor:n.pointIdAccessor,legendPosition:ce})});W.displayName="RealtimeLineChart";import{useRef as V,useImperativeHandle as $,forwardRef as Y,useCallback as q,useMemo as U}from"react";function X(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const s=Number(i);return Number.isFinite(s)?s:null}import{jsx as K}from"react/jsx-runtime";var Z=Y(function(c,u){const m=o(c.mode,{width:c.size?.[0]??c.width,height:c.size?.[1]??c.height,showAxes:c.showAxes,showLegend:c.showLegend,enableHover:null!=c.enableHover?!!c.enableHover:void 0,linkedHover:c.linkedHover,mobileInteraction:c.mobileInteraction,mobileSemantics:c.mobileSemantics,responsiveRules:c.responsiveRules}),{binSize:h,size:d,margin:p,className:g,arrowOfTime:v="right",windowMode:f="sliding",windowSize:w,data:y,timeAccessor:b,valueAccessor:x,direction:A="up",timeExtent:C,valueExtent:R,extentPadding:P,categoryAccessor:F,colors:M,fill:N,stroke:D,strokeWidth:B,opacity:E,gap:O,background:j,tooltipContent:L,tooltip:W,onHover:Y,annotations:Z,autoPlaceAnnotations:G,svgAnnotationRules:J,tickFormatTime:Q,tickFormatValue:ee,linkedHover:te,selection:ne,decay:ie,pulse:se,staleness:oe,transition:re,onObservation:ae,chartId:le,loading:ce,loadingContent:ue,emptyContent:me,emphasis:he,legendPosition:de,legend:pe,brush:ge,onBrush:ve,linkedBrush:fe}=c,we=m.showAxes,ye=m.enableHover,be=d??[m.width,m.height],xe=U(()=>M?e=>M[e]??N??"#999":void 0,[M,N]),{legend:Ae,margin:_e,legendPosition:ke}=s({data:y??[],colorBy:F,colorScale:xe,showLegend:m.showLegend,legendPosition:de,userMargin:p,defaults:m.marginDefaults,additionalLegend:pe}),He=L??W??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null;if(null==i?.binStart||null==i?.binEnd){const e=z(i,t,"time"),s=z(i,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(e)]}),k("div",{children:[_("span",{style:S,children:"y:"}),I(s)]})]})}return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"range:"}),I(i.binStart),"–",I(i.binEnd)]}),null!=i.total&&k("div",{children:[_("span",{style:S,children:"count:"}),I(i.total)]}),null!=i.category&&k("div",{children:[_("span",{style:S,children:"category:"}),I(i.category)]})]})}}({timeAccessor:b,valueAccessor:x}),Se=V(null),{customHoverBehavior:ze}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ae,chartType:"RealtimeHistogram",chartId:le}),Ie=q(e=>{Y&&Y(e),ze(e)},[Y,ze]),Ce=!0===ge?{dimension:"x",snap:"bin"}:"x"===ge?{dimension:"x"}:"object"==typeof ge?ge:void 0,Te=n(fe),Re="string"==typeof b?b:"time",Pe=i({name:Te?.name||"__unused_hist_brush__",xField:Te?.xField||Re,...Te?.yField?{yField:Te.yField}:{}}),Fe=V(Pe.brushInteraction);Fe.current=Pe.brushInteraction;const Me=q(e=>{if(ve&&ve(e),ae&&ae(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}),Te){const t=Fe.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ve,ae,le,Te]);$(u,()=>({push:e=>Se.current?.push(e),pushMany:e=>Se.current?.pushMany(e),remove:e=>Se.current?.remove(e)??[],update:(e,t)=>Se.current?.update(e,t)??[],clear:()=>Se.current?.clear(),getData:()=>Se.current?.getData()??[],getScales:()=>Se.current?.getScales()??null}),[]);const Ne=l(ce,be[0],be[1],ue),De=Ne?null:a(y,be[0],be[1],me),Be={};null!=N&&(Be.fill=N),null!=D&&(Be.stroke=D),null!=B&&(Be.strokeWidth=B),null!=E&&(Be.opacity=E),null!=O&&(Be.gap=O);const Ee=he?`${g||""} semiotic-emphasis-${he}`.trim():g,Oe=T(w,y),je=U(()=>"down"!==A?R:function({data:e,valueAccessor:t,timeAccessor:n,binSize:i,valueExtent:s,extentPadding:o}){if(s)return[s[1],s[0]];if(!e||0===e.length)return;const r=new Map;for(const s of e){const e=X(s,n,"time"),o=X(s,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/i)*i;r.set(a,(r.get(a)??0)+o)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:y,valueAccessor:x,timeAccessor:b,binSize:h,valueExtent:R,extentPadding:P}),[A,y,x,b,h,R,P]);return Ne||De||K(e,{ref:Se,chartType:"bar",runtimeMode:"streaming",size:be,margin:_e,className:Ee,arrowOfTime:v,windowMode:f,windowSize:Oe,data:y,timeAccessor:b,valueAccessor:x,xExtent:C,yExtent:je,extentPadding:P,binSize:h,categoryAccessor:F,barColors:M,barStyle:Be,showAxes:we,background:j,hoverAnnotation:ye,tooltipContent:He,...t({linkedHover:te,selection:ne,onObservation:ae,forceHoverBehavior:!0,mobileInteraction:m.mobileInteraction,customHoverBehavior:Ie}),annotations:Z,autoPlaceAnnotations:G,svgAnnotationRules:J,tickFormatTime:Q,tickFormatValue:ee,decay:ie,pulse:se,staleness:oe,transition:re,pointIdAccessor:c.pointIdAccessor,legend:Ae,legendPosition:ke,brush:Ce||(fe?{dimension:"x"}:void 0),onBrush:Ce||fe?Me:void 0})});function G(e){return K(Z,{...e,windowMode:"growing"})}Z.displayName="RealtimeHistogram",G.displayName="TemporalHistogram";var J=Z;import{useRef as Q,useImperativeHandle as ee,forwardRef as te,useCallback as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var se=te(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,colors:_,radius:k,fill:H,opacity:S,stroke:z,strokeWidth:I,pointStyle:R,background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,linkedHover:L,selection:W,onObservation:V,chartId:$,loading:Y,loadingContent:q,emptyContent:U,emphasis:X,legendPosition:K}=n,Z=s.showAxes,G=s.enableHover,J=u??s.marginDefaults,te=c??[s.width,s.height],se=F??M??C({timeAccessor:v,valueAccessor:f}),oe=Q(null),{customHoverBehavior:re}=r({selection:W,linkedHover:L,unwrapData:!0,onObservation:V,chartType:"RealtimeSwarmChart",chartId:$}),ae=ne(e=>{N&&N(e),re(e)},[N,re]);ee(i,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const le=l(Y,te[0],te[1],q),ce=le?null:a(g,te[0],te[1],U),ue={};null!=k&&(ue.radius=k),null!=H&&(ue.fill=H),null!=S&&(ue.opacity=S),null!=z&&(ue.stroke=z),null!=I&&(ue.strokeWidth=I);const me=R,he=X?`${m||""} semiotic-emphasis-${X}`.trim():m,de=T(p,g);return le||ce||ie(e,{ref:oe,chartType:"swarm",runtimeMode:"streaming",size:te,margin:J,className:he,arrowOfTime:h,windowMode:d,windowSize:de,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,barColors:_,swarmStyle:ue,pointStyle:me,showAxes:Z,background:P,hoverAnnotation:G,tooltipContent:se,...t({linkedHover:L,selection:W,onObservation:V,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ae}),annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,legendPosition:K,pointIdAccessor:n.pointIdAccessor})});se.displayName="RealtimeSwarmChart";import{useRef as oe,useImperativeHandle as re,forwardRef as ae,useCallback as le}from"react";import{jsx as ce}from"react/jsx-runtime";var ue=ae(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,extentPadding:b,positiveColor:x,negativeColor:A,connectorStroke:C,connectorWidth:R,gap:P,stroke:F,strokeWidth:M,opacity:N,background:D,tooltipContent:B,tooltip:E,onHover:O,annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:Y,selection:q,onObservation:U,chartId:X,loading:K,loadingContent:Z,emptyContent:G,emphasis:J,legendPosition:Q}=n,ee=s.showAxes,te=s.enableHover,ne=u??s.marginDefaults,ie=c??[s.width,s.height],se=B??E??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null,s=z(i,t,"time"),o=i?.delta??z(i,n,"value"),r=i?.cumEnd,a="number"==typeof o?0>o?I(o):"+"+I(o):I(o);return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(s)]}),k("div",{children:[_("span",{style:S,children:"Δ:"}),a]}),null!=r&&k("div",{children:[_("span",{style:S,children:"total:"}),I(r)]})]})}}({timeAccessor:v,valueAccessor:f}),ae=oe(null),{customHoverBehavior:ue}=r({selection:q,linkedHover:Y,unwrapData:!0,onObservation:U,chartType:"RealtimeWaterfallChart",chartId:X}),me=le(e=>{O&&O(e),ue(e)},[O,ue]);re(i,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const he=l(K,ie[0],ie[1],Z),de=he?null:a(g,ie[0],ie[1],G),pe={};null!=x&&(pe.positiveColor=x),null!=A&&(pe.negativeColor=A),null!=C&&(pe.connectorStroke=C),null!=R&&(pe.connectorWidth=R),null!=P&&(pe.gap=P),null!=F&&(pe.stroke=F),null!=M&&(pe.strokeWidth=M),null!=N&&(pe.opacity=N);const ge=J?`${m||""} semiotic-emphasis-${J}`.trim():m,ve=T(p,g);return he||de||ce(e,{ref:ae,chartType:"waterfall",runtimeMode:"streaming",size:ie,margin:ne,className:ge,arrowOfTime:h,windowMode:d,windowSize:ve,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,extentPadding:b,waterfallStyle:pe,showAxes:ee,background:D,hoverAnnotation:te,tooltipContent:se,...t({linkedHover:Y,selection:q,onObservation:U,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:me}),annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legendPosition:Q,pointIdAccessor:n.pointIdAccessor})});ue.displayName="RealtimeWaterfallChart";import{useRef as me,useImperativeHandle as he,forwardRef as de,useCallback as pe}from"react";import{jsx as ge}from"react/jsx-runtime";var ve=de(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,timeExtent:y,valueExtent:b,extentPadding:x,heatmapXBins:A=20,heatmapYBins:C=20,aggregation:R="count",background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,linkedHover:$,selection:Y,onObservation:q,chartId:U,loading:X,loadingContent:K,emptyContent:Z,emphasis:G,legendPosition:J}=n,Q=s.showAxes,ee=s.enableHover,te=u??s.marginDefaults,ne=c??[s.width,s.height],ie=F??M??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=o?.xCenter??z(o,t,"time"),a=o?.yCenter??z(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,m=o?.agg??"count";return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]}),null!=l&&k("div",{children:[_("span",{style:S,children:"count:"}),I(l)]}),"sum"===m&&null!=c&&k("div",{children:[_("span",{style:S,children:"sum:"}),I(c)]}),"mean"===m&&null!=u&&k("div",{children:[_("span",{style:S,children:"mean:"}),I(u)]})]})}}({timeAccessor:v,valueAccessor:f}),se=me(null),{customHoverBehavior:oe}=r({selection:Y,linkedHover:$,unwrapData:!0,onObservation:q,chartType:"RealtimeHeatmap",chartId:U}),re=pe(e=>{N&&N(e),oe(e)},[N,oe]);he(i,()=>({push:e=>se.current?.push(e),pushMany:e=>se.current?.pushMany(e),remove:e=>se.current?.remove(e)??[],update:(e,t)=>se.current?.update(e,t)??[],clear:()=>se.current?.clear(),getData:()=>se.current?.getData()??[],getScales:()=>se.current?.getScales()??null}),[]);const ae=l(X,ne[0],ne[1],K),le=ae?null:a(g,ne[0],ne[1],Z),ce=G?`${m||""} semiotic-emphasis-${G}`.trim():m,ue=T(p,g);return ae||le||ge(e,{ref:se,chartType:"heatmap",runtimeMode:"streaming",size:ne,margin:te,className:ce,arrowOfTime:h,windowMode:d,windowSize:ue,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,xExtent:y,yExtent:b,extentPadding:x,heatmapXBins:A,heatmapYBins:C,heatmapAggregation:R,showAxes:Q,background:P,hoverAnnotation:ee,tooltipContent:ie,...t({linkedHover:$,selection:Y,onObservation:q,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:re}),annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,legendPosition:J,pointIdAccessor:n.pointIdAccessor})});ve.displayName="RealtimeHeatmap";export{c as RunningStats,u as WindowAccumulator,m as statValue,h as bandBounds,g as parseWindowDuration,v as ReorderBuffer,W as RealtimeLineChart,Z as RealtimeHistogram,G as TemporalHistogram,J as RealtimeTemporalHistogram,se as RealtimeSwarmChart,ue as RealtimeWaterfallChart,ve as RealtimeHeatmap};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(t){if(null==t)return()=>{};const n="function"==typeof t?t:n=>n[t];return t=>r(n(t))}function n(n,e){const r=t(n),o=t(e);return(t,n)=>{const e=o(t);return{value:e,x:r(t),y:e,category:n}}}function e(n,e){const r=t(e??"value"),o=null==n?void 0:"function"==typeof n?n:t=>t[n];return t=>{const n=o?o(t):void 0;return{value:r(t),category:null==n?void 0:n+""}}}function r(t){if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t&&""!==t.trim()){const n=Number(t);return Number.isFinite(n)?n:void 0}}function o(t,n,e){const o=null!=t.axis?e[t.axis]:null!=t.field?n[t.field]:e.value;if(void 0!==t.eq&&o!==t.eq)return!1;if(void 0!==t.ne&&o===t.ne)return!1;if(void 0!==t.in&&!t.in.includes(o))return!1;if(void 0===t.gt&&void 0===t.gte&&void 0===t.lt&&void 0===t.lte&&void 0===t.within&&void 0===t.outside)return!0;const i=r(o);if(void 0===i)return!1;if(void 0!==t.gt&&t.gt>=i)return!1;if(void 0!==t.gte&&t.gte>i)return!1;if(void 0!==t.lt&&i>=t.lt)return!1;if(void 0!==t.lte&&i>t.lte)return!1;if(void 0!==t.within){const[n,e]=t.within;if(n>i||i>e)return!1}if(void 0!==t.outside){const[n,e]=t.outside;if(i>=n&&e>=i)return!1}return!0}function i(t,n,e){const r=t.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(n,e):o(r,n,e))}function u(t,n,e){if(!n||0===n.length)return{};let r={};for(const o of n){if(!i(o,t,e))continue;const n="function"==typeof o.style?o.style(t,e):o.style;n&&(r={...r,...n})}return r}function a(t,n,e,r=t=>t){const o=t??(()=>({}));return n&&0!==n.length?(t,i)=>{const a=r(t),s={...o(t,i)};return Object.assign(s,u(a,n,e(a,i))),s}:o}function s(t,n,e){return t&&0!==t.length?(r,o)=>{const i=u(r,t,n(r,o)),a=e?e(r,o):void 0;return a?{...i,...a}:i}:e}function f(t,n,r,o){if(!t||0===t.length)return o;const i=e(n,r);return(n,e)=>{const r=n&&n.data||n,a=u(r,t,i(r)),s=o?o(n,e):void 0;return s?{...a,...s}:a}}function c(t,e,r,o){return s(t,n(e,r),o)}function l(t,n){const e=t.length,r=n.length,o=Array(r+1);for(let t=0;r>=t;t++)o[t]=t;for(let i=1;e>=i;i++){let e=o[0];o[0]=i;for(let u=1;r>=u;u++){const r=o[u];o[u]=t[i-1]===n[u-1]?e:1+Math.min(e,o[u],o[u-1]),e=r}}return o[r]}function d(t,n,e=3){let r,o=e+1;for(const e of n){const n=l(t.toLowerCase(),e.toLowerCase());o>n&&(o=n,r=e)}return o>e?void 0:r}function y(t){return t.length>3?[t[0],t[Math.floor(t.length/2)],t[t.length-1]]:[...t]}function v(t,n){if(0===n.length)return null;const e=t.toLowerCase();return n.find(t=>t.toLowerCase().includes(e)||e.includes(t.toLowerCase()))||(d(t,n,3)??null)}function h({componentName:t,data:n,accessors:e,requiredProps:r}){if(r)for(const[n,e]of Object.entries(r))if(null==e)return`${t}: ${n} is required. Provide a field name or function.`;if(null==n)return null;if(!Array.isArray(n)&&"object"==typeof n)return t+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(n)||0===n.length)return t+": No data provided. Pass a non-empty array to the data prop.";if(e){const r=y(n).find(t=>t&&"object"==typeof t);if(r){const n=Object.keys(r);for(const[o,i]of Object.entries(e))if(i&&"string"==typeof i&&!(i in r)){const e=v(i,n),r=e?` Try ${o}="${e}".`:"";return`${t}: ${o} "${i}" not found in data. Available fields: ${n.join(", ")}.${r}`}}}return null}function g({componentName:t,data:n,dataLabel:e="data"}){return null==n?`${t}: No ${e} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(n)?`${t}: ${e} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function p({componentName:t,nodes:n,edges:e,nodesRequired:r=!1,edgesRequired:o=!0,accessors:i}){if(null==n&&null==e)return null;if(o&&(!e||!Array.isArray(e)||0===e.length))return t+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(r&&(!n||!Array.isArray(n)||0===n.length))return t+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&n&&n.length>0){const e=y(n).find(t=>t&&"object"==typeof t);if(e){const n=Object.keys(e);for(const[r,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in e)){const e=v(o,n),i=e?` Try ${r}="${e}".`:"";return`${t}: ${r} "${o}" not found in node data. Available fields: ${n.join(", ")}.${i}`}}}return null}export{t as makeRuleValueResolver,n as makeXYRuleContext,e as makeNodeRuleContext,o as matchesThreshold,i as ruleMatches,u as resolveStyleRules,a as composeStyleRules,s as makeStyleRuleStyleFn,f as styleRulesToNodeStyle,c as styleRulesToXYStyle,d as closestMatch,h as validateArrayData,g as validateObjectData,p as validateNetworkData};
|