semiotic 3.8.2 → 3.8.4

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.
Files changed (195) hide show
  1. package/CLAUDE.md +9 -9
  2. package/README.md +42 -40
  3. package/ai/examples.md +1 -1
  4. package/ai/schema.json +2726 -300
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  8. package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
  9. package/dist/{chunk-chunk-NO4MCQVD.module.min.js → chunk-chunk-5RKXZQ2P.module.min.js} +1 -1
  10. package/dist/{chunk-chunk-CYIML3AV.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
  11. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  12. package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
  13. package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
  14. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  15. package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
  16. package/dist/{chunk-chunk-ZLKRTF5N.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
  17. package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
  18. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  19. package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
  20. package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
  21. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  22. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  23. package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
  24. package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
  25. package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
  26. package/dist/chunk-chunk-FBGHXL72.module.min.js +2 -0
  27. package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
  28. package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
  29. package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
  30. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  31. package/dist/{chunk-chunk-7LHMKRKE.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
  32. package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
  33. package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
  34. package/dist/chunk-chunk-KQ546MKE.module.min.js +2 -0
  35. package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
  36. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  37. package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
  38. package/dist/chunk-chunk-N6VKKF3A.module.min.js +2 -0
  39. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  40. package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
  41. package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
  42. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  43. package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
  44. package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
  45. package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
  46. package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
  47. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  48. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  49. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  50. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  51. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  52. package/dist/components/ChartContainer.d.ts +2 -2
  53. package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
  54. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  55. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  56. package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
  57. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  58. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  59. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  60. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  61. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  62. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  63. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  64. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  65. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  66. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
  67. package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
  68. package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
  69. package/dist/components/charts/shared/chartMode.d.ts +75 -0
  70. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  71. package/dist/components/charts/shared/colorUtils.d.ts +8 -0
  72. package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
  73. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  74. package/dist/components/charts/shared/hooks.d.ts +13 -80
  75. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  76. package/dist/components/charts/shared/types.d.ts +2 -2
  77. package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
  78. package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
  79. package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
  80. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  81. package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
  82. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  83. package/dist/components/charts/xy/LineChart.d.ts +3 -0
  84. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  85. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  86. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  87. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  88. package/dist/components/legendLayout.d.ts +31 -0
  89. package/dist/components/realtime/types.d.ts +5 -0
  90. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  91. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  92. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  93. package/dist/components/semiotic-recipes-core.d.ts +6 -2
  94. package/dist/components/server/serverChartConfigShared.d.ts +29 -0
  95. package/dist/components/server/serverChartConfigs.d.ts +2 -13
  96. package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
  97. package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
  98. package/dist/components/server/staticAnnotations.d.ts +3 -1
  99. package/dist/components/server/staticLegend.d.ts +7 -1
  100. package/dist/components/server/staticSVGChrome.d.ts +57 -0
  101. package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
  102. package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
  103. package/dist/components/stream/SceneToSVG.d.ts +10 -8
  104. package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
  105. package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
  106. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  107. package/dist/components/stream/canvasBackground.d.ts +7 -0
  108. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  109. package/dist/components/stream/networkTypes.d.ts +2 -4
  110. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  111. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  112. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  113. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  114. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  115. package/dist/components/stream/renderBackend.d.ts +14 -0
  116. package/dist/components/stream/sceneToSVGShared.d.ts +80 -0
  117. package/dist/components/stream/types.d.ts +4 -0
  118. package/dist/components/stream/useHydration.d.ts +7 -1
  119. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  120. package/dist/components/types/legendTypes.d.ts +16 -3
  121. package/dist/forceLayoutWorker.js +1 -1
  122. package/dist/geo.min.js +1 -1
  123. package/dist/geo.module.min.js +1 -1
  124. package/dist/network.min.js +1 -1
  125. package/dist/network.module.min.js +1 -1
  126. package/dist/ordinal.min.js +1 -1
  127. package/dist/ordinal.module.min.js +1 -1
  128. package/dist/physics.min.js +1 -1
  129. package/dist/physics.module.min.js +1 -1
  130. package/dist/physicsWorker.js +1 -1
  131. package/dist/realtime.min.js +1 -1
  132. package/dist/realtime.module.min.js +1 -1
  133. package/dist/rough.min.js +1 -1
  134. package/dist/rough.module.min.js +1 -1
  135. package/dist/semiotic-ai-core.min.js +1 -1
  136. package/dist/semiotic-ai-core.module.min.js +1 -1
  137. package/dist/semiotic-ai.min.js +1 -1
  138. package/dist/semiotic-ai.module.min.js +1 -1
  139. package/dist/semiotic-experimental.min.js +1 -1
  140. package/dist/semiotic-experimental.module.min.js +1 -1
  141. package/dist/semiotic-realtime-core.min.js +1 -1
  142. package/dist/semiotic-realtime-core.module.min.js +1 -1
  143. package/dist/semiotic-recipes-core.d.ts +6 -2
  144. package/dist/semiotic-recipes-core.min.js +1 -1
  145. package/dist/semiotic-recipes-core.module.min.js +1 -1
  146. package/dist/semiotic-recipes.min.js +1 -1
  147. package/dist/semiotic-recipes.module.min.js +1 -1
  148. package/dist/semiotic-server-edge.min.js +1 -1
  149. package/dist/semiotic-server-edge.module.min.js +1 -1
  150. package/dist/semiotic-server-node.min.js +1 -1
  151. package/dist/semiotic-server-node.module.min.js +1 -1
  152. package/dist/semiotic-utils-core.min.js +1 -1
  153. package/dist/semiotic-utils-core.module.min.js +1 -1
  154. package/dist/semiotic-utils.min.js +1 -1
  155. package/dist/semiotic-utils.module.min.js +1 -1
  156. package/dist/semiotic-value.module.min.js +1 -1
  157. package/dist/semiotic.min.js +1 -1
  158. package/dist/semiotic.module.min.js +1 -1
  159. package/dist/server.min.js +1 -1
  160. package/dist/server.module.min.js +1 -1
  161. package/dist/xy.min.js +1 -1
  162. package/dist/xy.module.min.js +1 -1
  163. package/package.json +3 -2
  164. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  165. package/dist/chunk-chunk-27HVVXS6.module.min.js +0 -1
  166. package/dist/chunk-chunk-2UN3ANRN.module.min.js +0 -2
  167. package/dist/chunk-chunk-2VUEY5TH.module.min.js +0 -1
  168. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  169. package/dist/chunk-chunk-5WEFWNUW.module.min.js +0 -2
  170. package/dist/chunk-chunk-6F6GEAQU.module.min.js +0 -1
  171. package/dist/chunk-chunk-BHYTYMY2.module.min.js +0 -2
  172. package/dist/chunk-chunk-C6EJ4IOD.module.min.js +0 -2
  173. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  174. package/dist/chunk-chunk-DNY43POY.module.min.js +0 -1
  175. package/dist/chunk-chunk-E7MIQX7D.module.min.js +0 -2
  176. package/dist/chunk-chunk-ES4DCG3L.module.min.js +0 -1
  177. package/dist/chunk-chunk-FAKO3RGQ.module.min.js +0 -2
  178. package/dist/chunk-chunk-H4PPRW6N.module.min.js +0 -1
  179. package/dist/chunk-chunk-IFYPMWKY.module.min.js +0 -1
  180. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  181. package/dist/chunk-chunk-L6D3I3V7.module.min.js +0 -2
  182. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  183. package/dist/chunk-chunk-ODUZEEBH.module.min.js +0 -2
  184. package/dist/chunk-chunk-P6UBCMSQ.module.min.js +0 -2
  185. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  186. package/dist/chunk-chunk-RH5TSQPH.module.min.js +0 -1
  187. package/dist/chunk-chunk-STZFFTAN.module.min.js +0 -2
  188. package/dist/chunk-chunk-T27ZEV6A.module.min.js +0 -1
  189. package/dist/chunk-chunk-U3AGQ5EF.module.min.js +0 -2
  190. package/dist/chunk-chunk-W3DB2MN4.module.min.js +0 -2
  191. package/dist/chunk-chunk-WDIN4LRC.module.min.js +0 -1
  192. package/dist/chunk-chunk-XOYX77KF.module.min.js +0 -2
  193. package/dist/chunk-chunk-Z5KXAVQD.module.min.js +0 -2
  194. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
  195. package/dist/chunk-chunk-ZTNVDWAK.module.min.js +0 -2
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{SafeRender as e,useWasHydratingFromSSR as t}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useReducedMotion as i}from"./chunk-chunk-YHNZCPOZ.module.min.js";function n(e,t={}){if("function"==typeof e)return e;const i=t.locale??"en-US";if("currency"===e){const e=t.precision??2,n=new Intl.NumberFormat(i,{style:"currency",currency:t.currency??"USD",maximumFractionDigits:e,minimumFractionDigits:e});return e=>n.format(e)}if("percent"===e){const e=new Intl.NumberFormat(i,{style:"percent",maximumFractionDigits:t.precision??1,minimumFractionDigits:0});return t=>e.format(t)}if("compact"===e){const e=new Intl.NumberFormat(i,{notation:"compact",maximumFractionDigits:t.precision??1,minimumFractionDigits:0});return t=>e.format(t)}if("duration"===e)return e=>r(e);const n=new Intl.NumberFormat(i,{notation:t.notation??"standard",maximumFractionDigits:t.precision??0,minimumFractionDigits:0});return e=>n.format(e)}function r(e){if(!Number.isFinite(e))return e+"";const t=0>e?"-":"",i=Math.abs(e);if(1e3>i)return`${t}${Math.round(i)}ms`;const n=i/1e3;if(60>n)return`${t}${r=n,Math.round(100*r)/100+""}s`;var r;const a=n/60;if(60>a){const e=Math.floor(a),i=Math.round(n-60*e);return 0===i?`${t}${e}m`:`${t}${e}m ${i}s`}const l=a/60;if(24>l){const e=Math.floor(l),i=Math.round(a-60*e);return 0===i?`${t}${e}h`:`${t}${e}h ${i}m`}const o=Math.floor(l/24),s=Math.round(l-24*o);return 0===s?`${t}${o}d`:`${t}${o}d ${s}h`}function a(e,t,i){return`${t??""}${e}${i??""}`}function l(e,t){return Number.isFinite(e)?0===e?t(0):`${e>0?"+":"−"}${t(Math.abs(e))}`:""}function o(e,t,i="en-US",n=1){if(!Number.isFinite(e)||!Number.isFinite(t))return null;if(0===e)return null;const r=(t-e)/Math.abs(e);return new Intl.NumberFormat(i,{style:"percent",maximumFractionDigits:n,minimumFractionDigits:0,signDisplay:"exceptZero"}).format(r)}function s(e,t){if(!t||0===t.length)return null;if(!Number.isFinite(e))return null;const i=t.filter(e=>Number.isFinite(e.at)||e.at===-1/0).slice().sort((e,t)=>e.at-t.at);let n=null;for(const t of i){if(t.at>e)break;n=t}return n}function u(e,t){return t||("neutral"===e?"var(--semiotic-text, currentColor)":`var(--semiotic-${e}, currentColor)`)}function c(e,t){const i=t.padding??1;if(0===e.length)return{line:"",area:"",points:[]};if(1===e.length){const e=t.width/2,i=t.height/2;return{line:`M${e},${i}`,area:"",points:[{x:e,y:i}]}}const n=t.yMin??e.reduce((e,t)=>Number.isFinite(t)&&e>t?t:e,1/0),r=(t.yMax??e.reduce((e,t)=>Number.isFinite(t)&&t>e?t:e,-1/0))-n||1,a=Math.max(0,t.width-2*i),l=Math.max(0,t.height-2*i),o=1===e.length?0:a/(e.length-1),s=[];let u="";for(let t=0;e.length>t;t++){const a=e[t];if(!Number.isFinite(a))continue;const c=i+t*o,m=i+l-(a-n)/r*l;u+=`${0===s.length?"M":"L"}${c.toFixed(2)},${m.toFixed(2)}`,s.push({x:c,y:m})}if(0===s.length)return{line:"",area:"",points:[]};const c=s[0],m=i+l;return{line:u,area:`${u} L${s[s.length-1].x.toFixed(2)},${m.toFixed(2)} L${c.x.toFixed(2)},${m.toFixed(2)} Z`,points:s}}import{forwardRef as m,useCallback as d,useEffect as h,useImperativeHandle as b,useMemo as p,useRef as f,useState as g}from"react";import{useMemo as v}from"react";import{Fragment as y,jsx as x,jsxs as N}from"react/jsx-runtime";var w={tile:{width:280,height:184,align:"start",labelSize:13,captionSize:11,valueSize:40,deltaSize:13,padding:{top:14,right:16,bottom:14,left:16},background:"var(--semiotic-surface, transparent)",border:!0,showHeader:!0,showDelta:!0,showTrend:!0,showChart:!0,chartSize:44},presentation:{width:540,height:320,align:"center",labelSize:18,captionSize:14,valueSize:96,deltaSize:18,padding:{top:32,right:32,bottom:32,left:32},background:"var(--semiotic-surface, transparent)",border:!0,showHeader:!0,showDelta:!0,showTrend:!0,showChart:!0,chartSize:80},inline:{width:void 0,height:void 0,align:"inherit",labelSize:0,captionSize:0,valueSize:0,deltaSize:0,padding:{top:0,right:0,bottom:0,left:0},background:"transparent",border:!1,showHeader:!1,showDelta:!0,showTrend:!1,showChart:!1,chartSize:0},thumbnail:{width:96,height:56,align:"center",labelSize:0,captionSize:0,valueSize:22,deltaSize:0,padding:{top:4,right:6,bottom:4,left:6},background:"transparent",border:!1,showHeader:!1,showDelta:!1,showTrend:!1,showChart:!1,chartSize:0}};function F(e,t,i){return void 0===e?i:"function"==typeof e?e(t):e}function S(e){return"positive"===e?"var(--semiotic-success, currentColor)":"negative"===e?"var(--semiotic-danger, currentColor)":"var(--semiotic-text-secondary, currentColor)"}function $(e){return"positive"===e?"▲":"negative"===e?"▼":"■"}var _=m((r,o)=>{const{value:c,label:m,caption:_,format:z,locale:D,currency:C,precision:I,prefix:k,suffix:L,unit:T,comparison:j,target:B,delta:H,deltaFormat:V,showDeltaPercent:P,direction:W,sentiment:Z,thresholds:U,windowSize:R=60,mode:A="tile",align:q,width:E,height:O,padding:Y,emphasis:X,color:G,background:J,borderColor:K,borderRadius:Q,className:ee,style:te,animate:ie,stalenessThreshold:ne,staleLabel:re,headerSlot:ae,valueSlot:le,deltaSlot:oe,trendSlot:se,chartSlot:ue,chartSize:ce,footerSlot:me,onClick:de,onObservation:he,chartId:be,description:pe,summary:fe,loading:ge,loadingContent:ve,emptyContent:ye}=r,xe=w[A]??w.tile,Ne=q??xe.align,we=E??xe.width,Fe=O??xe.height,Se=i(),$e=t(),[_e,ze]=g([]),[De,Me]=g(null),[Ce,Ie]=g(null),[ke,Le]=g(null),Te=f([]),je=f(null),Be=f(c);h(()=>{Be.current=c},[c]);const He=f(R);h(()=>{He.current=R},[R]);const Ve=d(e=>{const t="number"==typeof e?{value:e,time:Date.now()}:{time:Date.now(),...e},i="number"==typeof t.time?t.time:t.time instanceof Date?t.time.getTime():Date.now();return{...t,time:i}},[]),Pe=d(e=>{if(0===e.length)return;const t=He.current,i=e.map(Ve);let n=Te.current.concat(i);n.length>t&&(n=n.slice(n.length-t)),Te.current=n;const r=i[i.length-1];je.current=r.value,ze(n),Me(r.value);for(let e=i.length-1;e>=0;e--){const t=i[e].comparison;if(null!=t){Ie(t);break}}Le(r.time)},[Ve]),We=d(e=>Pe([e]),[Pe]);b(o,()=>({push:e=>We(e),pushMany:e=>Pe(e),clear:()=>{Te.current=[],je.current=null,ze([]),Me(null),Ie(null),Le(null)},getValue:()=>je.current??(Number.isFinite(Be.current)?Be.current:null),getData:()=>Te.current.slice()}),[We,Pe]);const Ze=De??c,Ue=null==Ze||"number"!=typeof Ze||!Number.isFinite(Ze),Re=p(()=>n(z??"number",{locale:D,currency:C,precision:I}),[z,D,C,I]),Ae=p(()=>n(V??z??"number",{locale:D,currency:C,precision:null==V&&null==z?0:I}),[V,z,D,C,I]),qe=ie??!1,Ee=("object"!=typeof qe||!1!==qe.intro)&&!!qe,Oe=Number.isFinite(Ze)?Ze:0,Ye=function(e,t,i,n=e){const[r,a]=g(()=>n),l=f(n),o=f(null),s=f(e),u=f(0),c=!!t,m="object"==typeof t?t.duration:void 0,d="number"==typeof m&&Number.isFinite(m)?Math.max(0,m):300,b="object"==typeof t&&"linear"===t.easing?"linear":"ease-out",p=f(e);return h(()=>{const t=e=>{l.current=e,a(e)};if(!Number.isFinite(e))return void t(e);if(!c||i)return void t(e);if(0===d)return void t(e);s.current=l.current,p.current=e,u.current="undefined"!=typeof performance?performance.now():Date.now();const n="linear"===b?e=>e:e=>1-Math.pow(1-e,3),r=e=>{const i=Math.min(1,(e-u.current)/d),a=n(i);t(s.current+(p.current-s.current)*a),1>i?o.current=requestAnimationFrame(r):(o.current=null,t(p.current))};return o.current=requestAnimationFrame(r),()=>{null!=o.current&&cancelAnimationFrame(o.current),o.current=null}},[c,d,b,i,e]),r}(Oe,qe,Se,f(!Ee||Se||$e?Oe:0).current),Xe=qe?Ye:Number.isFinite(Ze)?Ze:0,Ge=p(()=>s(Number.isFinite(Ze)?Ze:NaN,U),[Ze,U]),Je=Ge?Ge.level:"neutral",Ke=G??u(Je,Ge?.color),Qe=Ce??j?.value??null,et=null!=H?H:null!=Qe&&Number.isFinite(Ze)?Ze-Qe:null,tt=function(e,t,i){if(i&&"auto"!==i)return i;if(null==e||0===e||!Number.isFinite(e))return"neutral";const n=t??"higher-is-better";return"neutral"===n?"neutral":("higher-is-better"===n?e>0:0>e)?"positive":"negative"}(et,j?.direction??B?.direction??W,Z),it=null!=et&&Number.isFinite(et)?l(et,Ae):null,nt=p(()=>new Intl.NumberFormat(D??"en-US",{style:"percent",maximumFractionDigits:1,minimumFractionDigits:0,signDisplay:"exceptZero"}),[D]),rt=null!=Qe&&Number.isFinite(Ze)&&(P??1)&&0!==Qe?nt.format((Ze-Qe)/Math.abs(Qe)):null,at=function({target:e,value:t,format:i,locale:r,currency:a,precision:l}){const o=v(()=>new Intl.NumberFormat(r??"en-US",{style:"percent",maximumFractionDigits:0}),[r]),s=v(()=>n(e?.format??i??"number",{locale:r,currency:a,precision:l}),[e?.format,i,r,a,l]);return v(()=>{if(!e||!Number.isFinite(e.value))return null;const i="number"==typeof t&&Number.isFinite(t)&&0!==e.value?o.format(t/e.value):null,n=s(e.value);return{label:e.label,percent:i,formattedValue:n,text:i?e.label?`${i} of ${e.label} (${n})`:`${i} of ${n}`:e.label?`target ${e.label} (${n})`:"target "+n}},[e,t,s,o])}({target:B,value:Ze,format:z,locale:D,currency:C,precision:I}),lt=at?.percent??null,ot=at?.text??null,st=function(e,t){const[i,n]=g(!1);return h(()=>{if(!t||null==e)return void n(!1);const i=()=>{n(Date.now()-e>=t)};i();const r=setInterval(i,Math.max(250,Math.floor(t/4)));return()=>clearInterval(r)},[e,t]),i}(ke,ne),ut=Number.isFinite(Xe)?a(Re(Xe),k,L):"",ct={value:Ue?null:Ze,formattedValue:ut,level:Je,color:Ke,delta:et,deltaFormatted:it,deltaPercent:rt,sentiment:tt,isStale:st,pushBuffer:_e},mt=pe??function(e){const t=[];if(e.label&&t.push(e.label+":"),t.push(e.unit?`${e.formattedValue} ${e.unit}`:e.formattedValue),e.deltaFormatted){const i=e.delta,n=null!=i&&Number.isFinite(i)&&0!==i?i>0?"up":"down":"change";t.push(`${n} ${e.deltaFormatted}${e.deltaPercent?` (${e.deltaPercent})`:""}${e.comparisonLabel?" from "+e.comparisonLabel:""}`)}return e.targetText&&t.push(e.targetText),e.thresholdLabel&&t.push(e.thresholdLabel),e.stale&&t.push(e.staleLabel??"stale"),t.join(", ")}({label:m,formattedValue:Number.isFinite(Ze)?a(Re(Ze),k,L):"",unit:T,comparisonLabel:j?.label,delta:et,deltaFormatted:it,deltaPercent:rt,targetText:ot,thresholdLabel:Ge?.label,stale:st,staleLabel:re}),dt="number"==typeof Y?{top:Y,right:Y,bottom:Y,left:Y}:{...xe.padding,...Y??{}},ht="end"===Ne?"flex-end":"center"===Ne?"center":"start"===Ne?"flex-start":"inherit",bt={position:"relative",boxSizing:"border-box",width:we,height:Fe,padding:`${dt.top}px ${dt.right}px ${dt.bottom}px ${dt.left}px`,background:J??xe.background,border:xe.border?"1px solid "+(K??"var(--semiotic-border, #e2e2e2)"):void 0,borderRadius:"number"==typeof Q?Q+"px":Q??"var(--semiotic-border-radius, 8px)",display:"inline"===A?"inline-flex":"flex",flexDirection:"column",alignItems:"inherit"===ht?void 0:ht,textAlign:Ne,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",color:"var(--semiotic-text, #111)",opacity:st?.55:1,transition:"opacity 240ms ease-out",gridColumn:"primary"===X?"span 2":void 0,cursor:de?"pointer":void 0,...te},pt=d(e=>{const t=e.currentTarget.getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top,r={value:Ue?NaN:Ze,level:Je,delta:et};de&&de(r,{x:i,y:n}),he&&he({type:"click",datum:r,x:i,y:n,chartType:"BigNumber",chartId:be,timestamp:Date.now()})},[de,he,be,Ue,Ze,Je,et]),ft="inline"===A?"span":"div",gt=["semiotic-bignumber","semiotic-bignumber--mode-"+A,"semiotic-bignumber--level-"+Je,"semiotic-bignumber--sentiment-"+tt,st?"semiotic-bignumber--stale":null,ee].filter(Boolean).join(" "),vt="positive"===tt?"up":"negative"===tt?"down":"flat";if(ge){const e="number"==typeof we?we:280,t="number"==typeof Fe?Fe:160;return x(ft,{role:"status","aria-live":"polite","aria-busy":"true",className:gt+" semiotic-bignumber--loading",style:{...bt,opacity:1},children:ve??x(M,{width:e,height:t,mode:A})})}return Ue?!1===ye?null:x(ft,{role:"status","aria-label":m?m+": no value":"no value",className:gt+" semiotic-bignumber--empty",style:{...bt,color:"var(--semiotic-text-secondary, #666)",fontSize:13,alignItems:"center",justifyContent:"center"},children:ye??"—"}):x(e,{componentName:"BigNumber",width:"number"==typeof we?we:280,height:"number"==typeof Fe?Fe:160,children:N(ft,{role:"group","aria-label":mt,"data-chart":"BigNumber","data-mode":A,"data-level":Je,"data-stale":st?"true":void 0,"data-sentiment":tt,className:gt,style:bt,onClick:de||he?pt:void 0,children:[xe.showHeader&&(m||_||ae)?x("div",{className:"semiotic-bignumber__header",style:{display:"flex",flexDirection:"column",gap:2,marginBottom:6,paddingRight:xe.showChart&&null!=ue?(ce??xe.chartSize)+8:0},children:F(ae,ct,N(y,{children:[m?x("span",{className:"semiotic-bignumber__label",style:{fontSize:xe.labelSize,color:"var(--semiotic-text-secondary, #6b7280)",fontWeight:500,letterSpacing:.2},children:m}):null,_?x("span",{className:"semiotic-bignumber__caption",style:{fontSize:xe.captionSize,color:"var(--semiotic-text-secondary, #9ca3af)"},children:_}):null]}))}):null,F(le,ct,N(ft,{className:"semiotic-bignumber__value semiotic-bignumber__value--"+Je,style:{display:"inline"===A?"inline-flex":"flex",alignItems:"baseline",gap:6,fontVariantNumeric:"tabular-nums",fontWeight:600,color:Ke,fontSize:xe.valueSize||void 0,lineHeight:1.05},children:[x("span",{className:"semiotic-bignumber__value-text",children:ut}),T?x("span",{className:"semiotic-bignumber__unit",style:{fontSize:xe.valueSize?Math.max(11,Math.round(.32*xe.valueSize)):"0.75em",color:"var(--semiotic-text-secondary, #9ca3af)",fontWeight:500},children:T}):null]})),xe.showDelta&&(it||at||j)?x(ft,{className:"semiotic-bignumber__delta semiotic-bignumber__delta--"+vt,style:{display:"inline"===A?"inline-flex":"flex",flexWrap:"wrap",gap:8,alignItems:"baseline",marginTop:"inline"===A?0:6,fontSize:xe.deltaSize||void 0,color:"var(--semiotic-text-secondary, #6b7280)"},children:F(oe,ct,N(y,{children:[it?N("span",{className:"semiotic-bignumber__delta-row semiotic-bignumber__delta-row--"+vt,style:{display:"inline-flex",alignItems:"center",gap:4,color:S(tt),fontWeight:600},children:[x("span",{"aria-hidden":"true",className:"semiotic-bignumber__arrow semiotic-bignumber__arrow--"+vt,children:$(tt)}),x("span",{className:"semiotic-bignumber__delta-amount",children:it}),rt?N("span",{className:"semiotic-bignumber__delta-percent",style:{fontWeight:500},children:["(",rt,")"]}):null]}):null,j?.label?x("span",{className:"semiotic-bignumber__comparison-label",children:j.label}):null,at?N("span",{className:"semiotic-bignumber__target",style:{display:"inline-flex",alignItems:"baseline",gap:4},children:[it||j?.label?x("span",{"aria-hidden":"true",className:"semiotic-bignumber__separator",children:"·"}):null,x("span",{className:"semiotic-bignumber__target-percent",style:{fontWeight:500,color:"var(--semiotic-text, #111)"},children:lt}),N("span",{className:"semiotic-bignumber__target-value",children:["of ",at.formattedValue,at.label?" "+at.label:""]})]}):null]}))}):null,xe.showChart&&null!=ue?x("div",{className:"semiotic-bignumber__chart",style:{position:"absolute",top:dt.top,right:dt.right,width:ce??xe.chartSize,height:ce??xe.chartSize,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:x("div",{style:{pointerEvents:"auto",lineHeight:0},children:F(ue,ct,null)})}):null,xe.showTrend&&null!=se?x("div",{className:"semiotic-bignumber__trend",style:{position:"absolute",left:dt.left,right:dt.right,bottom:dt.bottom+(null!=me?28:0)},children:F(se,ct,null)}):null,null!=me?x(ft,{className:"semiotic-bignumber__footer",style:{position:"absolute",left:dt.left,right:dt.right,bottom:dt.bottom,fontSize:xe.deltaSize||void 0,color:"var(--semiotic-text-secondary, #9ca3af)"},children:F(me,ct,null)}):null,fe?x("span",{style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:fe}):null]})})});_.displayName="BigNumber";var z=_,D=z;function M(e){const t=Math.floor(.45*e.width),i=Math.floor(.6*e.width),n=(e,t)=>x("div",{style:{width:e,height:t,background:"var(--semiotic-border, #e0e0e0)",borderRadius:4,opacity:.55}});return N("div",{style:{display:"flex",flexDirection:"column",gap:10,justifyContent:"center",width:"100%",height:"100%"},children:["thumbnail"!==e.mode&&"inline"!==e.mode?n(t,10):null,n(i,"presentation"===e.mode?48:28),"tile"===e.mode||"presentation"===e.mode?n(Math.floor(.35*e.width),8):null]})}export{n as buildFormatter,r as formatDuration,l as formatSignedDelta,o as formatDeltaPercent,s as resolveThreshold,u as colorForLevel,c as buildSparklinePath,z as BigNumber,D as BigNumber_default};
2
+ import{SafeRender as e,useWasHydratingFromSSR as t}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useReducedMotion as i}from"./chunk-chunk-YHNZCPOZ.module.min.js";function n(e,t={}){if("function"==typeof e)return e;const i=t.locale??"en-US";if("currency"===e){const e=t.precision??2,n=new Intl.NumberFormat(i,{style:"currency",currency:t.currency??"USD",maximumFractionDigits:e,minimumFractionDigits:e});return e=>n.format(e)}if("percent"===e){const e=new Intl.NumberFormat(i,{style:"percent",maximumFractionDigits:t.precision??1,minimumFractionDigits:0});return t=>e.format(t)}if("compact"===e){const e=new Intl.NumberFormat(i,{notation:"compact",maximumFractionDigits:t.precision??1,minimumFractionDigits:0});return t=>e.format(t)}if("duration"===e)return e=>r(e);const n=new Intl.NumberFormat(i,{notation:t.notation??"standard",maximumFractionDigits:t.precision??0,minimumFractionDigits:0});return e=>n.format(e)}function r(e){if(!Number.isFinite(e))return e+"";const t=0>e?"-":"",i=Math.abs(e);if(1e3>i)return`${t}${Math.round(i)}ms`;const n=i/1e3;if(60>n)return`${t}${r=n,Math.round(100*r)/100+""}s`;var r;const a=n/60;if(60>a){const e=Math.floor(a),i=Math.round(n-60*e);return 0===i?`${t}${e}m`:`${t}${e}m ${i}s`}const l=a/60;if(24>l){const e=Math.floor(l),i=Math.round(a-60*e);return 0===i?`${t}${e}h`:`${t}${e}h ${i}m`}const o=Math.floor(l/24),s=Math.round(l-24*o);return 0===s?`${t}${o}d`:`${t}${o}d ${s}h`}function a(e,t,i){return`${t??""}${e}${i??""}`}function l(e,t){return Number.isFinite(e)?0===e?t(0):`${e>0?"+":"−"}${t(Math.abs(e))}`:""}function o(e,t,i="en-US",n=1){if(!Number.isFinite(e)||!Number.isFinite(t))return null;if(0===e)return null;const r=(t-e)/Math.abs(e);return new Intl.NumberFormat(i,{style:"percent",maximumFractionDigits:n,minimumFractionDigits:0,signDisplay:"exceptZero"}).format(r)}function s(e,t){if(!t||0===t.length)return null;if(!Number.isFinite(e))return null;const i=t.filter(e=>Number.isFinite(e.at)||e.at===-1/0).slice().sort((e,t)=>e.at-t.at);let n=null;for(const t of i){if(t.at>e)break;n=t}return n}function u(e,t){return t||("neutral"===e?"var(--semiotic-text, currentColor)":`var(--semiotic-${e}, currentColor)`)}function c(e,t){const i=t.padding??1;if(0===e.length)return{line:"",area:"",points:[]};if(1===e.length){const e=t.width/2,i=t.height/2;return{line:`M${e},${i}`,area:"",points:[{x:e,y:i}]}}const n=t.yMin??e.reduce((e,t)=>Number.isFinite(t)&&e>t?t:e,1/0),r=(t.yMax??e.reduce((e,t)=>Number.isFinite(t)&&t>e?t:e,-1/0))-n||1,a=Math.max(0,t.width-2*i),l=Math.max(0,t.height-2*i),o=1===e.length?0:a/(e.length-1),s=[];let u="";for(let t=0;e.length>t;t++){const a=e[t];if(!Number.isFinite(a))continue;const c=i+t*o,m=i+l-(a-n)/r*l;u+=`${0===s.length?"M":"L"}${c.toFixed(2)},${m.toFixed(2)}`,s.push({x:c,y:m})}if(0===s.length)return{line:"",area:"",points:[]};const c=s[0],m=i+l;return{line:u,area:`${u} L${s[s.length-1].x.toFixed(2)},${m.toFixed(2)} L${c.x.toFixed(2)},${m.toFixed(2)} Z`,points:s}}import{forwardRef as m,useCallback as d,useEffect as h,useImperativeHandle as b,useMemo as p,useRef as f,useState as g}from"react";import{useMemo as v}from"react";import{Fragment as y,jsx as x,jsxs as w}from"react/jsx-runtime";var N={tile:{width:280,height:184,align:"start",labelSize:13,captionSize:11,valueSize:40,deltaSize:13,padding:{top:14,right:16,bottom:14,left:16},background:"var(--semiotic-surface, transparent)",border:!0,showHeader:!0,showDelta:!0,showTrend:!0,showChart:!0,chartSize:44},presentation:{width:540,height:320,align:"center",labelSize:18,captionSize:14,valueSize:96,deltaSize:18,padding:{top:32,right:32,bottom:32,left:32},background:"var(--semiotic-surface, transparent)",border:!0,showHeader:!0,showDelta:!0,showTrend:!0,showChart:!0,chartSize:80},inline:{width:void 0,height:void 0,align:"inherit",labelSize:0,captionSize:0,valueSize:0,deltaSize:0,padding:{top:0,right:0,bottom:0,left:0},background:"transparent",border:!1,showHeader:!1,showDelta:!0,showTrend:!1,showChart:!1,chartSize:0},thumbnail:{width:96,height:56,align:"center",labelSize:0,captionSize:0,valueSize:22,deltaSize:0,padding:{top:4,right:6,bottom:4,left:6},background:"transparent",border:!1,showHeader:!1,showDelta:!1,showTrend:!1,showChart:!1,chartSize:0}};function F(e,t,i){return void 0===e?i:"function"==typeof e?e(t):e}function S(e){return"positive"===e?"var(--semiotic-success, currentColor)":"negative"===e?"var(--semiotic-danger, currentColor)":"var(--semiotic-text-secondary, currentColor)"}function $(e){return"positive"===e?"▲":"negative"===e?"▼":"■"}var _=m((r,o)=>{const{value:c,label:m,caption:_,format:z,locale:D,currency:C,precision:I,prefix:k,suffix:L,unit:T,comparison:j,target:B,delta:H,deltaFormat:V,showDeltaPercent:W,direction:P,sentiment:R,thresholds:A,windowSize:U=60,mode:Z="tile",align:q,width:E,height:O,padding:Y,emphasis:X,color:G,background:J,borderColor:K,borderRadius:Q,className:ee,style:te,animate:ie,stalenessThreshold:ne,staleLabel:re,headerSlot:ae,valueSlot:le,deltaSlot:oe,trendSlot:se,chartSlot:ue,chartSize:ce,footerSlot:me,onClick:de,onObservation:he,chartId:be,description:pe,summary:fe,loading:ge,loadingContent:ve,emptyContent:ye}=r,xe=N[Z]??N.tile,we=q??xe.align,Ne=E??xe.width,Fe=O??xe.height,Se=i(),$e=t(),[_e,ze]=g([]),[De,Me]=g(null),[Ce,Ie]=g(null),[ke,Le]=g(null),Te=f([]),je=f(null),Be=f(c);h(()=>{Be.current=c},[c]);const He=f(U);h(()=>{He.current=U},[U]);const Ve=d(e=>{const t="number"==typeof e?{value:e,time:Date.now()}:{time:Date.now(),...e},i="number"==typeof t.time?t.time:t.time instanceof Date?t.time.getTime():Date.now();return{...t,time:i}},[]),We=d(e=>{if(0===e.length)return;const t=He.current,i=e.map(Ve);let n=Te.current.concat(i);n.length>t&&(n=n.slice(n.length-t)),Te.current=n;const r=i[i.length-1];je.current=r.value,ze(n),Me(r.value);for(let e=i.length-1;e>=0;e--){const t=i[e].comparison;if(null!=t){Ie(t);break}}Le(r.time)},[Ve]),Pe=d(e=>We([e]),[We]);b(o,()=>({push:e=>Pe(e),pushMany:e=>We(e),clear:()=>{Te.current=[],je.current=null,ze([]),Me(null),Ie(null),Le(null)},getValue:()=>je.current??(Number.isFinite(Be.current)?Be.current:null),getData:()=>Te.current.slice()}),[Pe,We]);const Re=De??c,Ae=null==Re||"number"!=typeof Re||!Number.isFinite(Re),Ue=p(()=>n(z??"number",{locale:D,currency:C,precision:I}),[z,D,C,I]),Ze=p(()=>n(V??z??"number",{locale:D,currency:C,precision:null==V&&null==z?0:I}),[V,z,D,C,I]),qe=ie??!1,Ee=("object"!=typeof qe||!1!==qe.intro)&&!!qe,Oe=Number.isFinite(Re)?Re:0,Ye=function(e,t,i,n=e){const[r,a]=g(()=>n),l=f(n),o=f(null),s=f(e),u=f(0),c=!!t,m="object"==typeof t?t.duration:void 0,d="number"==typeof m&&Number.isFinite(m)?Math.max(0,m):300,b="object"==typeof t&&"linear"===t.easing?"linear":"ease-out",p=f(e);return h(()=>{const t=e=>{l.current=e,a(e)};if(!Number.isFinite(e))return void t(e);if(!c||i)return void t(e);if(0===d)return void t(e);s.current=l.current,p.current=e,u.current="undefined"!=typeof performance?performance.now():Date.now();const n="linear"===b?e=>e:e=>1-Math.pow(1-e,3),r=e=>{const i=Math.min(1,(e-u.current)/d),a=n(i);t(s.current+(p.current-s.current)*a),1>i?o.current=requestAnimationFrame(r):(o.current=null,t(p.current))};return o.current=requestAnimationFrame(r),()=>{null!=o.current&&cancelAnimationFrame(o.current),o.current=null}},[c,d,b,i,e]),r}(Oe,qe,Se,f(!Ee||Se||$e?Oe:0).current),Xe=qe?Ye:Number.isFinite(Re)?Re:0,Ge=p(()=>s(Number.isFinite(Re)?Re:NaN,A),[Re,A]),Je=Ge?Ge.level:"neutral",Ke=G??u(Je,Ge?.color),Qe=Ce??j?.value??null,et=null!=H?H:null!=Qe&&Number.isFinite(Re)?Re-Qe:null,tt=function(e,t,i){if(i&&"auto"!==i)return i;if(null==e||0===e||!Number.isFinite(e))return"neutral";const n=t??"higher-is-better";return"neutral"===n?"neutral":("higher-is-better"===n?e>0:0>e)?"positive":"negative"}(et,j?.direction??B?.direction??P,R),it=null!=et&&Number.isFinite(et)?l(et,Ze):null,nt=p(()=>new Intl.NumberFormat(D??"en-US",{style:"percent",maximumFractionDigits:1,minimumFractionDigits:0,signDisplay:"exceptZero"}),[D]),rt=null!=Qe&&Number.isFinite(Re)&&(W??1)&&0!==Qe?nt.format((Re-Qe)/Math.abs(Qe)):null,at=function({target:e,value:t,format:i,locale:r,currency:a,precision:l}){const o=v(()=>new Intl.NumberFormat(r??"en-US",{style:"percent",maximumFractionDigits:0}),[r]),s=v(()=>n(e?.format??i??"number",{locale:r,currency:a,precision:l}),[e?.format,i,r,a,l]);return v(()=>{if(!e||!Number.isFinite(e.value))return null;const i="number"==typeof t&&Number.isFinite(t)&&0!==e.value?o.format(t/e.value):null,n=s(e.value);return{label:e.label,percent:i,formattedValue:n,text:i?e.label?`${i} of ${e.label} (${n})`:`${i} of ${n}`:e.label?`target ${e.label} (${n})`:"target "+n}},[e,t,s,o])}({target:B,value:Re,format:z,locale:D,currency:C,precision:I}),lt=at?.percent??null,ot=at?.text??null,st=function(e,t){const[i,n]=g(!1);return h(()=>{if(!t||null==e)return void n(!1);const i=()=>{n(Date.now()-e>=t)};i();const r=setInterval(i,Math.max(250,Math.floor(t/4)));return()=>clearInterval(r)},[e,t]),i}(ke,ne),ut=Number.isFinite(Xe)?a(Ue(Xe),k,L):"",ct={value:Ae?null:Re,formattedValue:ut,level:Je,color:Ke,delta:et,deltaFormatted:it,deltaPercent:rt,sentiment:tt,isStale:st,pushBuffer:_e},mt=pe??function(e){const t=[];if(e.label&&t.push(e.label+":"),t.push(e.unit?`${e.formattedValue} ${e.unit}`:e.formattedValue),e.deltaFormatted){const i=e.delta,n=null!=i&&Number.isFinite(i)&&0!==i?i>0?"up":"down":"change";t.push(`${n} ${e.deltaFormatted}${e.deltaPercent?` (${e.deltaPercent})`:""}${e.comparisonLabel?" from "+e.comparisonLabel:""}`)}return e.targetText&&t.push(e.targetText),e.thresholdLabel&&t.push(e.thresholdLabel),e.stale&&t.push(e.staleLabel??"stale"),t.join(", ")}({label:m,formattedValue:Number.isFinite(Re)?a(Ue(Re),k,L):"",unit:T,comparisonLabel:j?.label,delta:et,deltaFormatted:it,deltaPercent:rt,targetText:ot,thresholdLabel:Ge?.label,stale:st,staleLabel:re}),dt="number"==typeof Y?{top:Y,right:Y,bottom:Y,left:Y}:{...xe.padding,...Y??{}},ht="end"===we?"flex-end":"center"===we?"center":"start"===we?"flex-start":"inherit",bt={position:"relative",boxSizing:"border-box",width:Ne,height:Fe,padding:`${dt.top}px ${dt.right}px ${dt.bottom}px ${dt.left}px`,background:J??xe.background,border:xe.border?"1px solid "+(K??"var(--semiotic-border, #e2e2e2)"):void 0,borderRadius:"number"==typeof Q?Q+"px":Q??"var(--semiotic-border-radius, 8px)",display:"inline"===Z?"inline-flex":"flex",flexDirection:"column",alignItems:"inherit"===ht?void 0:ht,textAlign:we,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",color:"var(--semiotic-text, #111)",opacity:st?.55:1,transition:"opacity 240ms ease-out",gridColumn:"primary"===X?"span 2":void 0,cursor:de?"pointer":void 0,...te},pt=d(e=>{const t=e.currentTarget.getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top,r={value:Ae?NaN:Re,level:Je,delta:et};de&&de(r,{x:i,y:n}),he&&he({type:"click",datum:r,x:i,y:n,chartType:"BigNumber",chartId:be,timestamp:Date.now()})},[de,he,be,Ae,Re,Je,et]),ft="inline"===Z?"span":"div",gt=["semiotic-bignumber","semiotic-bignumber--mode-"+Z,"semiotic-bignumber--level-"+Je,"semiotic-bignumber--sentiment-"+tt,st?"semiotic-bignumber--stale":null,ee].filter(Boolean).join(" "),vt="positive"===tt?"up":"negative"===tt?"down":"flat";if(ge){const e="number"==typeof Ne?Ne:280,t="number"==typeof Fe?Fe:160;return x(ft,{role:"status","aria-live":"polite","aria-busy":"true",className:gt+" semiotic-bignumber--loading",style:{...bt,opacity:1},children:ve??x(M,{width:e,height:t,mode:Z})})}return Ae?!1===ye?null:x(ft,{role:"status","aria-label":m?m+": no value":"no value",className:gt+" semiotic-bignumber--empty",style:{...bt,color:"var(--semiotic-text-secondary, #666)",fontSize:13,alignItems:"center",justifyContent:"center"},children:ye??"—"}):x(e,{componentName:"BigNumber",width:"number"==typeof Ne?Ne:280,height:"number"==typeof Fe?Fe:160,children:w(ft,{role:"group","aria-label":mt,"data-chart":"BigNumber","data-mode":Z,"data-level":Je,"data-stale":st?"true":void 0,"data-sentiment":tt,className:gt,style:bt,onClick:de||he?pt:void 0,children:[xe.showHeader&&(m||_||ae)?x("div",{className:"semiotic-bignumber__header",style:{display:"flex",flexDirection:"column",gap:2,marginBottom:6,paddingRight:xe.showChart&&null!=ue?(ce??xe.chartSize)+8:0},children:F(ae,ct,w(y,{children:[m?x("span",{className:"semiotic-bignumber__label",style:{fontSize:xe.labelSize,color:"var(--semiotic-text-secondary, #6b7280)",fontWeight:500,letterSpacing:.2},children:m}):null,_?x("span",{className:"semiotic-bignumber__caption",style:{fontSize:xe.captionSize,color:"var(--semiotic-text-secondary, #9ca3af)"},children:_}):null]}))}):null,F(le,ct,w(ft,{className:"semiotic-bignumber__value semiotic-bignumber__value--"+Je,style:{display:"inline"===Z?"inline-flex":"flex",alignItems:"baseline",gap:6,fontVariantNumeric:"tabular-nums",fontWeight:600,color:Ke,fontSize:xe.valueSize||void 0,lineHeight:1.05},children:[x("span",{className:"semiotic-bignumber__value-text",children:ut}),T?x("span",{className:"semiotic-bignumber__unit",style:{fontSize:xe.valueSize?Math.max(11,Math.round(.32*xe.valueSize)):"0.75em",color:"var(--semiotic-text-secondary, #9ca3af)",fontWeight:500},children:T}):null]})),xe.showDelta&&(it||at||j)?x(ft,{className:"semiotic-bignumber__delta semiotic-bignumber__delta--"+vt,style:{display:"inline"===Z?"inline-flex":"flex",flexWrap:"wrap",gap:8,alignItems:"baseline",marginTop:"inline"===Z?0:6,fontSize:xe.deltaSize||void 0,color:"var(--semiotic-text-secondary, #6b7280)"},children:F(oe,ct,w(y,{children:[it?w("span",{className:"semiotic-bignumber__delta-row semiotic-bignumber__delta-row--"+vt,style:{display:"inline-flex",alignItems:"center",gap:4,color:S(tt),fontWeight:600},children:[x("span",{"aria-hidden":"true",className:"semiotic-bignumber__arrow semiotic-bignumber__arrow--"+vt,children:$(tt)}),x("span",{className:"semiotic-bignumber__delta-amount",children:it}),rt?w("span",{className:"semiotic-bignumber__delta-percent",style:{fontWeight:500},children:["(",rt,")"]}):null]}):null,j?.label?x("span",{className:"semiotic-bignumber__comparison-label",children:j.label}):null,at?w("span",{className:"semiotic-bignumber__target",style:{display:"inline-flex",alignItems:"baseline",gap:4},children:[it||j?.label?x("span",{"aria-hidden":"true",className:"semiotic-bignumber__separator",children:"·"}):null,x("span",{className:"semiotic-bignumber__target-percent",style:{fontWeight:500,color:"var(--semiotic-text, #111)"},children:lt}),w("span",{className:"semiotic-bignumber__target-value",children:["of ",at.formattedValue,at.label?" "+at.label:""]})]}):null]}))}):null,xe.showChart&&null!=ue?x("div",{className:"semiotic-bignumber__chart",style:{position:"absolute",top:dt.top,right:dt.right,width:ce??xe.chartSize,height:ce??xe.chartSize,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:x("div",{style:{pointerEvents:"auto",lineHeight:0},children:F(ue,ct,null)})}):null,xe.showTrend&&null!=se?x("div",{className:"semiotic-bignumber__trend",style:{position:"absolute",left:dt.left,right:dt.right,bottom:dt.bottom+(null!=me?28:0)},children:F(se,ct,null)}):null,null!=me?x(ft,{className:"semiotic-bignumber__footer",style:{position:"absolute",left:dt.left,right:dt.right,bottom:dt.bottom,fontSize:xe.deltaSize||void 0,color:"var(--semiotic-text-secondary, #9ca3af)"},children:F(me,ct,null)}):null,fe?x("span",{style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:fe}):null]})})});_.displayName="BigNumber";var z=_,D=z;function M(e){const t=Math.floor(.45*e.width),i=Math.floor(.6*e.width),n=(e,t)=>x("div",{style:{width:e,height:t,background:"var(--semiotic-border, #e0e0e0)",borderRadius:4,opacity:.55}});return w("div",{style:{display:"flex",flexDirection:"column",gap:10,justifyContent:"center",width:"100%",height:"100%"},children:["thumbnail"!==e.mode&&"inline"!==e.mode?n(t,10):null,n(i,"presentation"===e.mode?48:28),"tile"===e.mode||"presentation"===e.mode?n(Math.floor(.35*e.width),8):null]})}export{n as buildFormatter,r as formatDuration,l as formatSignedDelta,o as formatDeltaPercent,s as resolveThreshold,u as colorForLevel,c as buildSparklinePath,z as BigNumber,D as BigNumber_default};
@@ -0,0 +1 @@
1
+ import{LayoutCache as t,createSafeDatum as e,datumFromFields as n,dimFor as o,forceLayout as r,generateTokens as i,groupBy as a,layoutTokenGrid as s,makeShade as c,normalizeTokenEncoding as l,readField as u,resolveAccessor as h,signatureKey as d,stableGlyphId as f,unwrapDatum as m}from"./chunk-chunk-2CXCXRB4.module.min.js";import{canUseForceWorker as p,runForceLayoutWorker as y,shouldUseForceWorker as g}from"./chunk-chunk-ZOAQDIJO.module.min.js";import{collidersFromPlotBounds as x,collidersFromXScaleBins as b,sedimentHeightfield as w}from"./chunk-chunk-LRIFN2HK.module.min.js";import{mulberry32 as M}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{useCustomLayoutSelection as v}from"./chunk-chunk-C4YA6TDR.module.min.js";import{SYMBOL_SEQUENCE as k,symbolExtent as $,symbolPathString as A}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{isNoteAnnotation as S}from"./chunk-chunk-U66USBWU.module.min.js";var C=t=>{const n=t.config,o=n.rows??10,r=n.columns??10,i=n.gutter??2,a=o*r;if(0>=o||0>=r||0>=a)return{nodes:[]};const{plot:s}=t.dimensions;if(0>=s.width||0>=s.height)return{nodes:[]};const c=(s.width-i*(r-1))/r,l=(s.height-i*(o-1))/o;if(0>=c||0>=l)return{nodes:[]};const u=(null==(h=n.categoryAccessor)?null:"function"==typeof h?h:t=>t[h])??(()=>"_default");var h;const d=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(n.valueAccessor)??(()=>1),f=new Map,m=[];for(const e of t.data){const t=u(e)+"",n=Number(d(e)),o=Number.isFinite(n)?Math.max(0,n):0;f.has(t)||m.push(t),f.set(t,(f.get(t)??0)+o)}const p=Array.from(f.values()).reduce((t,e)=>t+e,0);if(0>=p)return{nodes:[]};let y;if(n.categoryOrder&&n.categoryOrder.length>0){const t=new Set,e=[];for(const o of n.categoryOrder)f.has(o)&&!t.has(o)&&(t.add(o),e.push(o));y=[...e,...m.filter(e=>!t.has(e))]}else y=m;if(0===y.length)return{nodes:[]};const g=y.map(t=>({cat:t,exact:(f.get(t)??0)/p*a})).map(t=>({...t,count:Math.floor(t.exact)})),x=g.reduce((t,e)=>t+e.count,0),b=g.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;a-x>t;t++)g[b[t%b.length].i].count+=1;const w="string"==typeof n.categoryAccessor?n.categoryAccessor:"category",M="string"==typeof n.valueAccessor?n.valueAccessor:"value",v=(t,n,o)=>e(e=>{e("category",t),e("value",f.get(t)??0),e("share",(f.get(t)??0)/p),"category"!==w&&e(w,t),"value"!==M&&e(M,f.get(t)??0),e("cells",o),e("_waffleCategory",t),e("_waffleIndex",n)}),k=[];let $=0;for(const e of g){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)k.push({type:"rect",x:s.x+$%r*(c+i),y:s.y+(o-1-Math.floor($/r))*(l+i),w:c,h:l,style:{fill:n,stroke:"none"},datum:v(e.cat,$,e.count),group:e.cat,_transitionKey:`waffle-${e.cat}-${t}`}),$++}return{nodes:k}};function z(t,e,n){const o=Math.max(0,Math.floor(n?.minPerCategory??0)),r=t.reduce((t,e)=>t+Math.max(0,e.weight),0);if(0>=e||0>=r)return t.map(t=>({...t,exact:0,cells:0,remainder:0}));const i=t.map(t=>{const n=Math.max(0,t.weight)/r*e;return{...t,exact:n,cells:Math.max(o,Math.floor(n)),remainder:n-Math.floor(n)}});let a=i.reduce((t,e)=>t+e.cells,0);for(;a>e;){const t=i.filter(t=>t.cells>o).sort((t,e)=>e.cells-t.cells||t.remainder-e.remainder||t.key.localeCompare(e.key))[0];if(!t)break;t.cells--,a--}const s=[...i].sort((t,e)=>e.remainder-t.remainder||e.weight-t.weight||t.key.localeCompare(e.key));for(let t=0;e>a;t++)s[t%s.length].cells++,a++;return i}var I="#334155",N="#f8fafc",L="#cbd5e1",W={viewBox:[40,40],anchor:[.5,1],parts:[{d:"M8 3h24v34H8z",fill:"color"},{d:"M12 9h16v5H12zM12 18h16v5H12zM12 27h16v5H12z",fill:"accent"},{d:"M23.8 11.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 20.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 29.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0",fill:"color"}]},F={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M10 8h20a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z",fill:"color"},{d:"M15 15h10v10H15z",fill:"accent"},{d:"M7 2v6M14 2v6M21 2v6M28 2v6M7 32v6M14 32v6M21 32v6M28 32v6M2 7h6M2 14h6M2 21h6M2 28h6M32 7h6M32 14h6M32 21h6M32 28h6",fill:"none",stroke:"color",strokeWidth:3}]},T={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M23 1L7 23h10l-3 16 19-25H22z",fill:"color"}]},E={viewBox:[48,40],anchor:[.5,.78],parts:[{d:"M7 12c0-4 3-7 7-7h20c4 0 7 3 7 7v15H7z",fill:"color"},{d:"M11 15h26v8H11z",fill:"accent",opacity:.9},{d:"M12 27h7v4h-7zM29 27h7v4h-7z",fill:"accent",opacity:.95},{d:"M12 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0M28 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0",fill:"color",stroke:"accent",strokeWidth:1.8},{d:"M5 13h4v8H5zM39 13h4v8h-4z",fill:"color"}]},R="M 9.12,3.34 C 8.28,3.29 7.44,3.40 6.64,3.69 4.17,3.63 1.97,5.37 0.91,7.51 -1.32,11.80 2.55,17.76 8.19,16.55 11.62,16.13 15.55,14.04 16.17,10.33 16.38,6.53 12.77,3.52 9.12,3.34 Z M 9.35,19.86 C 8.89,19.84 8.41,19.92 7.92,20.11 5.12,21.55 3.72,24.68 2.79,27.54 2.32,29.86 0.87,32.04 1.36,34.49 1.63,37.60 8.04,38.95 8.04,38.95 8.04,38.95 14.67,39.65 16.50,36.33 17.16,31.95 16.34,27.23 14.01,23.42 13.07,21.69 11.36,19.92 9.35,19.86 Z",P={viewBox:[18,40],anchor:[.5,1],parts:[{d:R,fill:"color",stroke:"color",strokeWidth:1.4}]},O={server:W,chip:F,bolt:T,bus:E,person:P},D="var(--semiotic-primary, #4e79a7)",j="var(--semiotic-border, #d1d5db)";function B(t){return"object"==typeof t&&null!==t&&"tokens"in t&&"encoding"in t}function H(t,e,n){return"function"==typeof t?t(e)??n:t??n}function Y(t,e){return"function"==typeof t?t(e):t}function V(t){return t.sample??t.value??t.index}var X=new Set(k);function q(t,e){return void 0!==e.datum?H(e.datum,t,null):t.datum??null}function G(t,e){return{fill:!1!==t.highlighted?"scenario"===t.range?H(e.rangeColor,t,"var(--semiotic-secondary, #9ca3af)"):H(e.color,t,D):H(e.inactiveColor,t,j),stroke:"none",...Y(e.style,t)??{}}}function K(t,e){const n=Y(e.pointId,t)??(e.idPrefix?`${e.idPrefix}-${"scenario"===t.range?"range-":""}${t.index}`:void 0);return{datum:q(t,e),accessibleDatum:Y(e.accessibleDatum,t),accessibility:Y(e.accessibility,t),pointId:n,_transitionKey:n}}function _({input:t,encoding:e,options:n={}}){if(!B(t)&&!e)throw Error("tokenLayer requires an encoding when input is not a TokenSet.");const o=B(t)?{...t,encoding:l(t.encoding)}:i(t,e),r=function(t,e){const n=e.includeRange&&t.rangeTokens?[...t.tokens,...t.rangeTokens]:t.tokens;if(e.positionToken)return function(t,e){const n=e.positionToken;return n?t.map((e,o)=>{const r=n(e,o,t);return{...e,x:r.x,y:r.y,row:r.row??o,column:r.column??0}}):[]}(n,e);const o=e.layout??t.encoding.layout??"grid";if("quantile-strip"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),i=e.gutter??2,a=Math.max(1,Math.floor(e.rows??1)),s=t.map(V),c=Math.min(...s),l=Math.max(...s)-c||1;return t.map((s,u)=>{const h=V(s),d=u%a,f=e.valueToX?e.valueToX(h,s):n+(h-c)/l*(e.width??12*Math.max(1,t.length-1)),m=e.valueToY?e.valueToY(h,s):o+d*(r+i);return{...s,x:f,y:m,row:d,column:u}})}(n,e);if("dotplot"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r="number"==typeof e.tokenSize?e.tokenSize:12,i=e.gutter??2,a=e.cellWidth??r+i,s=e.cellHeight??r+i,c=t.map(V),l=Math.min(...c),u=Math.max(...c)-l||1,h=new Map;return t.map(r=>{const i=V(r),c=e.valueToX?e.valueToX(i,r):n+(i-l)/u*(e.width??Math.max(1,t.length-1)*a),d=Math.round((c-n)/Math.max(1,a)),f=h.get(d)??0;h.set(d,f+1);const m=e.valueToY?e.valueToY(i,r):o+f*s;return{...r,x:n+d*a,y:m,row:f,column:d}})}(n,e);if("bar-segment"===o){if(!e.valueToX)throw Error('tokenLayer layout "bar-segment" requires valueToX and optionally valueToY.');return function(t,e){if(!e.valueToX)return[];const n=e.y??0,o=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),r=e.anchor??[.5,.5];return t.map((t,i)=>{const a=Number.isFinite(t.start)?t.start:V(t),s=(a+(Number.isFinite(t.end)?t.end:a+t.value))/2,c=e.valueToY?e.valueToY(s,t):n+r[1]*o;return{...t,x:e.valueToX(s,t),y:c,row:0,column:i}})}(n,e)}if("beeswarm"===o||"small-multiple"===o)throw Error(`tokenLayer layout "${o}" is not implemented yet; use row, column, stack, grid, waffle, dotplot, quantile-strip, bar-segment with valueToX, or positionToken.`);const r="number"==typeof e.tokenSize?e.tokenSize:void 0,i=e.cellWidth??r??12,a=e.cellHeight??r??i,c="row"===o?Math.max(1,n.length):"column"===o||"stack"===o?1:"waffle"===o&&"fixed-denominator"===t.encoding.countStrategy&&100===t.denominator?10:function(t,e,n){if(e.columns)return e.columns;if(e.width&&n>0){const t=e.gutter??2;return Math.max(1,Math.floor((e.width+t)/(n+t)))}return t.length>0?Math.ceil(Math.sqrt(t.length)):1}(n,e,i);return s(n,{...e,columns:c,cellWidth:i,cellHeight:a})}(o,n).filter(t=>!n.include||n.include(t));return{tokenSet:o,positionedTokens:r,nodes:r.map(t=>function(t,e,n){if("dot"===n.tokenType)return function(t,e){const n=H(e.tokenSize,t,12);return{type:"point",x:t.x,y:t.y,r:H(e.radius,t,n/2),style:G(t,e),...K(t,e)}}(t,e);const o=Y(e.glyph,t)??function(t){if(t)return O[t]}(n.icon);if(o)return function(t,e,n){const o=G(t,n),r=H(n.tokenSize,t,12);return{type:"glyph",x:t.x,y:t.y,size:r,glyph:e,color:(o.fill??D)+"",accent:H(n.accent,t,"var(--semiotic-bg, #ffffff)"),fraction:1>t.fraction?t.fraction:void 0,fractionStart:t.startFraction>0?t.startFraction:void 0,fractionDirection:H(n.fractionDirection,t,"horizontal"),ghostColor:1>t.fraction?Y(n.ghostColor,t)??j:void 0,rotation:Y(n.rotation,t),style:o,...K(t,n)}}(t,o,e);const r=(i=n.icon)&&X.has(i)?i:void 0;var i;return function(t,e){const n=H(e.tokenSize,t,12);return{type:"symbol",x:t.x,y:t.y,size:Math.PI*Math.max(1,n/2)**2,symbolType:H(e.symbolType,t,"circle"),path:Y(e.symbolPath,t),rotation:Y(e.rotation,t),style:G(t,e),...K(t,e)}}(t,r&&null==e.symbolType?{...e,symbolType:r}:e)}(t,n,o.encoding))}}import{interpolateRgb as U}from"d3-interpolate";var Z=864e5,Q=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const o=t=>{const n="function"==typeof e.dateAccessor?e.dateAccessor(t):t[e.dateAccessor];return n instanceof Date?n:new Date(n)},r=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor];return Number(n)},i=new Map;let a=null;for(const e of t.data){const t=o(e);if(!isFinite(t.getTime()))continue;null==a&&(a=t.getUTCFullYear());const n=J(t),s=r(e);i.set(n,(i.get(n)??0)+(Number.isFinite(s)?s:0))}const s=e.year??a??(new Date).getUTCFullYear();let c=1/0,l=-1/0;for(const t of i.values())c>t&&(c=t),t>l&&(l=t);c===1/0&&(c=0,l=0);const[u,h]=e.colorRamp??[t.theme.semantic.surface??"#ebedf0",t.theme.semantic.primary??"#216e39"],d=t=>{if(l===c)return u;const e=(t-c)/(l-c);return U(u,h)(e)},f=e.gutter??2,m=e.labelInset??0,p=Math.min((n.width-m-53*f)/54,(n.height-6*f)/7);if(0>=p)return{nodes:[]};const y=new Date(Date.UTC(s,0,1)),g=y.getUTCDay(),x=new Date(y.getTime()-g*Z),b=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const o=new Date(x.getTime()+(7*t+e)*Z);if(o.getUTCFullYear()!==s)continue;const r=J(o),a=i.get(r),c=null==a?u:d(a);b.push({type:"rect",x:n.x+m+t*(p+f),y:n.y+e*(p+f),w:p,h:p,style:{fill:c,stroke:"none"},datum:{date:o,value:a??0}})}return{nodes:b}};function J(t){return`${t.getUTCFullYear()}-${tt(t.getUTCMonth()+1)}-${tt(t.getUTCDate())}`}function tt(t){return 10>t?"0"+t:t+""}import{jsx as et,jsxs as nt}from"react/jsx-runtime";var ot={resource:32,city:64},rt=["#739b58","#83a964","#668d52","#8baa68"],it={land:"#78985c",ocean:"#4d8192",forest:"#4f7c4b",grassland:"#8eaa68",cropland:"#a6a568",wetland:"#668f79",urban:"#8d8a72",scrub:"#9b9665",bare:"#aa906a",snow:"#d8ddcf"},at={land:"Open land",ocean:"Open ocean",forest:"Forest",grassland:"Grassland",cropland:"Cropland",wetland:"Wetland",urban:"Urban district",scrub:"Scrubland",bare:"Bare ground",snow:"Snow cover"},st=new Set(["city","culture","monument","faith","nature","knowledge","defense","arena","transport"]);function ct(t,e){if("function"==typeof t)return t;const n=t??e;return t=>t[n]}function lt(t,e,n){return[111.32*(t-n.lon)*Math.cos((e+n.lat)/2*(Math.PI/180)),110.574*(e-n.lat)]}function ut(t){const e=Math.max(3,Math.round(t??5));return e%2==0?e+1:e}function ht(t){return st.has(t)?t:"monument"}function dt(t,e){const n=ut(e.gridSize),o=Math.max(1,e.gridRadiusKm??75),r=2*o/n,i=Math.floor(n/2),a=ct(e.idAccessor,"id"),s=ct(e.nameAccessor,"name"),c=ct(e.longitudeAccessor,"lon"),l=ct(e.latitudeAccessor,"lat"),u=ct(e.kindAccessor,"kind"),h=e.candidatePriorityAccessor?ct(e.candidatePriorityAccessor,"priority"):()=>0,d=new Map;let f=null;for(const m of t){const t=Number(c(m)),p=Number(l(m));if(!Number.isFinite(t)||!Number.isFinite(p))continue;const y=(a(m)??`${t},${p}`)+"",g=(s(m)??y)+"",x=ht(u(m)),[b,w]=lt(t,p,e.center);if(Math.abs(b)>o||Math.abs(w)>o)continue;const M=Math.min(n-1,Math.max(0,Math.floor((b+o)/r))),v=Math.min(n-1,Math.max(0,Math.floor((o-w)/r))),k=(M+.5)*r-o,$=o-(v+.5)*r,A={...m,id:y,name:g,kind:x,lon:t,lat:p,distanceKm:Math.sqrt(b*b+w*w),row:v,column:M,cellDistanceSq:(b-k)**2+(w-$)**2,candidatePriority:Number(h(m))||0};(null!=e.centerId&&y===e.centerId||!f&&"city"===x||!f&&v===i&&M===i)&&(f=A);const S=`${v}:${M}`,C=d.get(S)??[];C.push(A),d.set(S,C)}const m=new Map;f&&m.set("city",1);const p=[];for(let t=0;n>t;t++)for(let e=0;n>e;e++){const n=`tile-${t}-${e}`,a=(e+.5)*r-o,s=o-(t+.5)*r;let c,l;if(t===i&&e===i&&f){c=f;const n=(d.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id).sort((t,e)=>t.candidatePriority-e.candidatePriority||t.cellDistanceSq-e.cellDistanceSq||t.name.localeCompare(e.name));l=[f,...n]}else{const n=(d.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id);n.sort((t,e)=>{const n=t.candidatePriority-e.candidatePriority;if(0!==n)return n;const o=m.get(t.kind)??0,i=m.get(e.kind)??0,a=r*r*.35;return t.cellDistanceSq+o*a-(e.cellDistanceSq+i*a)||t.name.localeCompare(e.name)}),c=n[0]??null,l=n}c&&m.set(c.kind,(m.get(c.kind)??0)+1),p.push({id:n,row:t,column:e,centerXKm:a,centerYKm:s,terrainIndex:Math.abs((17*t+31*e)%rt.length),landmark:c,landmarks:l})}return p}var ft=t=>{const e=ut(t.config.gridSize),n=Math.max(20,t.config.tileWidth??80),o=Math.max(10,t.config.tileHeight??40),r=t.config.terrainColors?.length?t.config.terrainColors:rt,i=t.dimensions.width/2,a=(t.dimensions.height-e*o)/2+o/2,s=dt(t.points,t.config).map(t=>({...t,x:i+n/2*(t.column-t.row),y:a+(t.column+t.row)*(o/2)}));return{nodes:s.map(e=>{const i=t.config.terrainByCell?.[e.id],a="string"==typeof i?{kind:i}:i,s="city"===e.landmark?.kind?"urban":a?.kind??"land",c=a?.fill??t.config.terrainPalette?.[s]??it[s],l=e.landmark?{...e.landmark,gridRow:e.row,gridColumn:e.column,cellId:e.id,terrainKind:s,terrainCoverage:a?.coverage,features:e.landmarks,featureCount:e.landmarks.length}:{id:e.id,name:at[s],kind:"terrain",terrainKind:s,terrainCoverage:a?.coverage,gridRow:e.row,gridColumn:e.column,cellId:e.id,features:[],featureCount:0};return{type:"geoarea",pathData:(u=e.x,h=e.y,d=n,f=o,`M${u},${h-f/2}L${u+d/2},${h}L${u},${h+f/2}L${u-d/2},${h}Z`),centroid:[e.x,e.y],bounds:[[e.x-n/2,e.y-o/2],[e.x+n/2,e.y+o/2]],screenArea:n*o/2,style:{fill:a||"urban"===s?c:r[e.terrainIndex%r.length],stroke:"ocean"===s?"#315d6c":t.config.tileStroke??"#314934",strokeWidth:1},datum:l,group:e.landmark?.kind??s,interactive:!0};var u,h,d,f}),overlays:et(mt,{tiles:s,tileWidth:n,tileHeight:o,sprites:t.config.sprites,resourceSize:t.config.resourceSpriteSize??32,citySize:t.config.citySpriteSize??64,showCityLabel:!1!==t.config.showCityLabel}),restyle:(t,e)=>e?.isActive&&t.datum&&"terrain"!==t.datum.kind?{fillOpacity:e.predicate(t.datum)?1:.28}:{fillOpacity:1}}};function mt({tiles:t,tileWidth:e,tileHeight:n,sprites:o,resourceSize:r,citySize:i,showCityLabel:a}){const s=v(),c=t.filter(t=>t.landmark).sort((t,e)=>t.y-e.y||t.x-e.x);return nt("g",{"aria-hidden":"true",pointerEvents:"none",children:[c.map(t=>{const a=t.landmark,c="city"===a.kind?i:r,l=t.y+n/2,u=s.isActive&&!s.predicate(a)?.28:1;return nt("g",{opacity:u,children:[et("ellipse",{cx:t.x,cy:t.y+.15*n,rx:.28*c,ry:.1*c,fill:"#17251d",opacity:.32}),et(xt,{kind:a.kind,href:o?.[a.kind],x:t.x-c/2,y:l-c,size:c}),t.landmarks.length>1&&et(pt,{x:t.x+.3*e,y:t.y-.19*n,count:t.landmarks.length-1,tileHeight:n})]},a.id)}),a&&c.filter(t=>"city"===t.landmark?.kind).map(t=>{const e=t.landmark.name.toUpperCase(),o=Math.max(56,6.4*e.length+14);return nt("g",{transform:`translate(${t.x},${t.y+.72*n})`,children:[et("rect",{x:-o/2,y:-7,width:o,height:14,rx:1,fill:"#17251d",opacity:.92}),et("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:9,fontWeight:700,letterSpacing:.8,children:e})]},t.landmark.id+"-label")})]})}function pt({x:t,y:e,count:n,tileHeight:o}){const r=Math.max(10,Math.min(15,.34*o)),i="+"+n,a=Math.max(r,i.length*r*.58);return nt("g",{transform:`translate(${t},${e})`,children:[et("rect",{x:-a/2,y:-r/2,width:a,height:r,rx:1,fill:"#17251d",stroke:"#f0d36d",strokeWidth:1}),et("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:Math.max(7,.62*r),fontWeight:700,children:i})]})}var yt={city:["..1111..","..1221..",".111111.",".133331.","11111111","13311331","14411441","11111111"],culture:["..1111..",".122221.","11111111",".133331.",".133331.",".133331.","11111111",".444444."],monument:["...11...","..1221..","..1221..","..1331..",".113311.",".133331.","11111111",".444444."],faith:["...11...","...11...","..1111..","...11...","..1221..",".133331.","11111111",".444444."],nature:["...11...","..1221..",".122221.","12222221",".133331.","...11...","..1441..",".144441."],knowledge:[".111111.","12211221","12211221","13311331","13311331","13311331","11111111",".444444."],defense:["11.11.11","11111111","12222221","12211221","13311331","13333331","11111111",".444444."],arena:["..1111..",".122221.","12333321","12344321","12344321","12333321",".122221.","..1111.."],transport:["...11...","..1221..",".122221.","11111111","..1331..","..1331..",".114411.","11444411"]},gt={city:{1:"#29364a",2:"#d8b45b",3:"#b7693c",4:"#6d9fc5"},culture:{1:"#29364a",2:"#d5c9a3",3:"#9c6fb2",4:"#ece3c4"},monument:{1:"#29364a",2:"#d8cba8",3:"#9c8f79",4:"#ece3c4"},faith:{1:"#29364a",2:"#d9c36d",3:"#a877a5",4:"#ece3c4"},nature:{1:"#29364a",2:"#4f8a4e",3:"#79aa56",4:"#79583a"},knowledge:{1:"#29364a",2:"#d5c9a3",3:"#4f7da0",4:"#ece3c4"},defense:{1:"#29364a",2:"#a6a298",3:"#777b7f",4:"#d5c9a3"},arena:{1:"#29364a",2:"#cb8056",3:"#d8cba8",4:"#6d9fc5"},transport:{1:"#29364a",2:"#d8b45b",3:"#6d9fc5",4:"#ece3c4"}};function xt({kind:t,href:e,x:n,y:o,size:r}){if(e)return et("image",{href:e,x:n,y:o,width:r,height:r,preserveAspectRatio:"xMidYMax meet",style:{imageRendering:"pixelated"}});const i=gt[t];return et("svg",{x:n,y:o,width:r,height:r,viewBox:"0 0 8 8",shapeRendering:"crispEdges",children:yt[t].flatMap((t,e)=>[...t].map((t,n)=>"."===t?null:et("rect",{x:n,y:e,width:1,height:1,fill:i[t]},`${e}-${n}`)))})}var bt=t=>{const e=t.config,n=e.nodeWidth??80,o=e.nodeHeight??30,r=e.orientation??"vertical",i=e.edgeCurve??"curved",a=!1!==e.showLabels,s=e.labelAccessor??"id",c="function"==typeof s?s:t=>u(t,s,t.id??"")+"",l=new Map,h=[],d=[],f=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:i,h:s}=f(n);null!=o&&null!=r&&(l.set(n.id,{x:o,y:r,w:i,h:s}),h.push({type:"rect",x:o-i/2,y:r-s/2,w:i,h:s,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-surface, ${t.theme.semantic.surface??"#fff"})`,strokeWidth:1.5},datum:n,id:n.id,label:c(n)+""}),a&&d.push({x:o,y:r,text:c(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const m=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=l.get("string"==typeof e.source?e.source:e.source.id),a=l.get(n);if(!o||!a)continue;const s="vertical"===r?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},c="vertical"===r?{x:a.x,y:a.y-a.h/2}:{x:a.x-a.w/2,y:a.y};if("line"===i)m.push({type:"line",x1:s.x,y1:s.y,x2:c.x,y2:c.y,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1},datum:e});else{const n=(s.y+c.y)/2,o=(s.x+c.x)/2;m.push({type:"curved",pathD:"vertical"===r?`M${s.x},${s.y} C${s.x},${n} ${c.x},${n} ${c.x},${c.y}`:`M${s.x},${s.y} C${o},${s.y} ${o},${c.y} ${c.x},${c.y}`,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:h,sceneEdges:m,labels:d}},wt=t=>{const e=t.config,n=e.nodeWidth??100,o=e.nodeHeight??36,r=e.edgeStyle??"polyline",i=!1!==e.showLabels,a=e.labelAccessor??"label",s="function"==typeof a?a:t=>u(t,a,t.id??"")+"",c=new Map,l=[],h=[],d=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:a,h:u}=d(n);null!=o&&null!=r&&(c.set(n.id,{x:o,y:r,w:a,h:u}),l.push({type:"rect",x:o-a/2,y:r-u/2,w:a,h:u,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#888"})`,strokeWidth:1.5},datum:n,id:n.id,label:s(n)+""}),i&&h.push({x:o,y:r,text:s(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const f=e.edgeStroke??`var(--semiotic-border, ${t.theme.semantic.border??"#666"})`,m=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=c.get("string"==typeof e.source?e.source:e.source.id),o=c.get(t);if(!n||!o)continue;const i=e.data??{},a=Array.isArray(i.points)?i.points:e.points;if(a&&a.length>=2)if("smooth"!==r||3>a.length){const t="M"+a.map(t=>`${t.x},${t.y}`).join(" L ");m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${a[0].x},${a[0].y}`;for(let e=1;a.length-1>e;e++)t+=` Q${a[e].x},${a[e].y} ${(a[e].x+a[e+1].x)/2},${(a[e].y+a[e+1].y)/2}`;const n=a[a.length-1];t+=` T${n.x},${n.y}`,m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else m.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:f,strokeWidth:1},datum:e})}return{sceneNodes:l,sceneEdges:m,labels:h}};import{jsx as Mt,jsxs as vt}from"react/jsx-runtime";var kt={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},$t={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function At(t){return Array.isArray(t)?t.map((t,e)=>"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(t.storeName??"")+"",slotIndex:t.slotIndex??e}):[]}var St=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.layerAccessor??"x",r=e.rowAccessor??"y",i=e.partitionAccessor??"partition",a=e.semanticAccessor??"semantic",s=e.labelAccessor??"label",c=e.storesAccessor??"stores",l=e.backEdgeAccessor??"isBackEdge",h=e.edgeTypeAccessor??"edgeType",d={...kt,...e.partitionColors},f={...$t,...e.edgeColors},m=e.accentColor??"var(--semiotic-focus, #ffcc33)",p=e.borderColor??"var(--semiotic-border, #555)",y=e.dimOpacity??.14,g=e.edgeOpacity??.5,x=e.edgeWidth??1.25,b=e.backEdgeWidth??e.edgeWidth??1.5,w=!1!==e.showStoreChips,M=e.storeChipColor??"var(--semiotic-info, #6a8caf)";let v=e.layerCount,k=e.maxLayerSize;if(null==v||null==k){let e=0;const n=new Map;for(const r of t.nodes){const t=Math.round(Number(u(r,o,0)));e=Math.max(e,t),n.set(t,(n.get(t)??0)+1)}v=v??e+1,k=k??Math.max(1,...n.values())}const $=n.width/Math.max(1,v),A=n.height/Math.max(1,k);let S=Math.min(e.nodeWidth??172,Math.max(8,$-(e.minGapX??26))),C=Math.min(e.nodeHeight??54,Math.max(8,A-(e.minGapY??18)));const z=e.lod&&"auto"!==e.lod?e.lod:16>S?"dot":48>S?"icon":108>S?"compact":"full";if("dot"===z){const t=Math.min(S,C,11);S=t,C=t}const I=Math.max(1,n.width-S),N=Math.max(1,n.height-C),L=Math.max(1,k-1),W=t=>n.x+S/2+(v>1?t/(v-1):.5)*I,F=t=>n.y+C/2+(t+L/2)/L*N,T=e.reachableIds?new Set(e.reachableIds):null,E=e.selectedId??null,R=t.selection,P=new Map,O=new Map,D=[],j=[];for(const e of t.nodes){const t=e.id,n=Number(u(e,o,0)),l=Number(u(e,r,0)),h=u(e,i,"processor")+"",f=u(e,a,"processor")+"",g=u(e,s,t)+"",x=At(u(e,c,[])),b=e.data??e,w=W(n),M=F(l);P.set(t,{cx:w,cy:M});const v=T?T.has(t):null,k=R?.isActive?R.predicate(b):null,$=null!==v?!v:null!==k&&!k;O.set(t,$);const A=null!=E&&t===E,I=$&&!A?y:1,N=d[h]??d.unknown;"dot"===z?D.push({type:"circle",cx:w,cy:M,r:S/2,style:{fill:N,opacity:I,stroke:A?m:"transparent",strokeWidth:A?2:0},datum:e,id:t,label:g}):(D.push({type:"rect",x:w-S/2,y:M-C/2,w:S,h:C,style:{fill:N,opacity:I,stroke:A?m:p,strokeWidth:A?3:1},datum:e,id:t,label:g}),j.push({id:t,cx:w,cy:M,partition:h,semantic:f,label:g,stores:x,opacity:I,selected:A,node:b}))}const B=[];for(const e of t.edges){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=P.get(t),r=P.get(n);if(!o||!r)continue;const i=!!u(e,l,!1),a=u(e,h,"internal")+"",s=O.get(t)||O.get(n)?Math.min(g,1.4*y):g,c=i?f.back:f[a]??f.internal;let d;if(i){const t=o.cx,e=o.cy+C/2,n=r.cx,i=r.cy+C/2,a=Math.max(48,.28*Math.abs(t-n))+C;d=`M${t},${e} C${t},${e+a} ${n},${i+a} ${n},${i}`}else{const t=o.cx+S/2,e=o.cy,n=r.cx-S/2,i=r.cy,a=(t+n)/2;d=`M${t},${e} C${a},${e} ${a},${i} ${n},${i}`}const m={type:"curved",pathD:d,style:{stroke:c,strokeWidth:i?b:x,fill:"none",opacity:s,...i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}},datum:e};B.push(m)}const H=0===j.length?null:Mt("g",{className:"lineage-dag-glyphs",children:j.map(t=>function(t,e){const{w:n,h:o,lod:r}=e,i="icon"===r?Math.min(n,o):Math.min(o-14,26),a="icon"===r?0:8+i+8,s=null!=e.renderIcon?e.renderIcon({semantic:t.semantic,partition:t.partition,size:i,color:e.partColors[t.partition]??e.partColors.unknown??"#5a5a6a",node:t.node}):function(t,e,n){const o=e.startsWith("topic")?"T":{source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[t]??"PR";return vt("g",{children:[Mt("rect",{width:n,height:n,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),Mt("text",{x:n/2,y:n/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*n,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:o})]})}(t.semantic,t.partition,i),c="full"===r,l="icon"!==r,u="full"===r&&e.showChips&&t.stores.length>0;return vt("g",{transform:`translate(${t.cx-n/2}, ${t.cy-o/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[Mt("g",{transform:`translate(${"icon"===r?(n-i)/2:8}, ${(o-i)/2})`,children:s}),l&&Mt("foreignObject",{x:a,y:c?o/2-12:o/2-9,width:Math.max(8,n-a-8),height:18,style:{pointerEvents:"none"},children:Mt("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===r?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),c&&Mt("text",{x:a,y:o/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:e.typeLabel?e.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),u&&t.stores.map((t,n)=>Mt("rect",{x:a+15*n,y:o-10,width:12,height:5,rx:1.5,fill:e.chipColor,children:Mt("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:S,h:C,lod:z,partColors:d,chipColor:M,showChips:w,renderIcon:e.renderIcon,typeLabel:e.typeLabel}))});return{sceneNodes:D,sceneEdges:B,overlays:H}};import{jsx as Ct,jsxs as zt}from"react/jsx-runtime";function It(t,e){return t.length>e?t.slice(0,Math.max(1,e-1))+"…":t}var Nt={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function Lt(t,e,n,o,r,i,a,s){const c=e-o/2,l=n-r/2,u={fill:i,stroke:a,strokeWidth:s};switch(t){case"diamond":return Ct("polygon",{points:`${e},${l} ${e+o/2},${n} ${e},${n+r/2} ${c},${n}`,...u});case"circle":return Ct("circle",{cx:e,cy:n,r:Math.min(o,r)/2,...u});case"stadium":case"round":return Ct("rect",{x:c,y:l,width:o,height:r,rx:"stadium"===t?r/2:8,ry:"stadium"===t?r/2:8,...u});case"hexagon":{const t=Math.min(.18*o,16);return Ct("polygon",{points:`${c+t},${l} ${e+o/2-t},${l} ${e+o/2},${n} ${e+o/2-t},${n+r/2} ${c+t},${n+r/2} ${c},${n}`,...u})}case"cylinder":{const t=Math.min(.16*r,8),e=`M${c},${l+t} a${o/2},${t} 0 0 1 ${o},0`;return zt("g",{children:[Ct("path",{d:`M${c},${l+t} a${o/2},${t} 0 0 0 ${o},0 v${r-2*t} a${o/2},${t} 0 0 1 ${-o},0 z`,...u}),Ct("path",{d:e,fill:"none",stroke:a,strokeWidth:s})]})}case"subroutine":{const t=Math.min(8,.08*o);return zt("g",{children:[Ct("rect",{x:c,y:l,width:o,height:r,rx:3,...u}),Ct("line",{x1:c+t,y1:l,x2:c+t,y2:l+r,stroke:a,strokeWidth:s}),Ct("line",{x1:c+o-t,y1:l,x2:c+o-t,y2:l+r,stroke:a,strokeWidth:s})]})}default:return Ct("rect",{x:c,y:l,width:o,height:r,rx:4,...u})}}var Wt=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.direction??"TD",r="LR"===o||"RL"===o,i="BT"===o||"RL"===o,a=e.layerAccessor??"layer",s=e.rowAccessor??"row",c=e.labelAccessor??"label",l=e.shapeAccessor??"shape",h=e.edgeLabelAccessor??"label",d=e.nodeFill??"var(--semiotic-surface, #20242d)",f=e.nodeStroke??"var(--semiotic-border, #5a6573)",m=e.textColor??"var(--semiotic-text, #e6e6e6)",p=e.edgeColor??"var(--semiotic-text-secondary, #9aa0a6)",y=e.accentColor??"var(--semiotic-warning, #d49a00)";if(0===t.nodes.length)return{sceneNodes:[],overlays:null};const g=new Map;let x=0;for(const e of t.nodes){const t=Math.round(Number(u(e,a,0)));x=Math.max(x,t);const n=g.get(t)||[];n.push(e),g.set(t,n)}const b=x+1;let w=1;for(const t of g.values())t.sort((t,e)=>Number(u(t,s,0))-Number(u(e,s,0))),w=Math.max(w,t.length);const M=r?n.width:n.height,v=r?n.height:n.width,k=M/b,$=v/(w+1),A=Math.max(44,Math.min(e.nodeWidth??150,r?k-36:.92*$)),S=Math.max(26,Math.min(e.nodeHeight??46,r?.7*$:.5*k)),C=(r?A:S)/2+6,z=Math.max(1,M-2*C),I=t=>(r?n.x:n.y)+C+(b>1?(i?b-1-t:t)/(b-1)*z:z/2),N=new Map,L=[],W=[];for(const[t,e]of g)e.forEach((o,i)=>{const a=I(t),s=(r?n.y:n.x)+(i+1)/(e.length+1)*v,h=r?a:s,p=r?s:a,g=u(o,l,"rect")+"",x=u(o,c,o.id)+"";N.set(o.id,{cx:h,cy:p,shape:g}),L.push({type:"rect",x:h-A/2,y:p-S/2,w:A,h:S,style:{fill:"transparent",stroke:"transparent"},datum:{id:o.id,name:x,type:Nt[g]??"process",shape:g},id:o.id,label:x}),W.push(zt("g",{children:[Lt(g,h,p,A,S,d,"diamond"===g?y:f,1.5),Ct("text",{x:h,y:p,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:m,style:{pointerEvents:"none"},children:It(x,Math.max(4,Math.floor((A-12)/7)))})]},"n-"+o.id))});const F=[];return t.edges.forEach((t,e)=>{const n="string"==typeof t.target?t.target:t.target.id,o=N.get("string"==typeof t.source?t.source:t.source.id),i=N.get(n);if(!o||!i)return;const a=r?o.cx+A/2:o.cx,s=r?o.cy:o.cy+S/2,c=r?i.cx-A/2:i.cx,l=r?i.cy:i.cy-S/2,d=r?`M${a},${s} C${(a+c)/2},${s} ${(a+c)/2},${l} ${c},${l}`:`M${a},${s} C${a},${(s+l)/2} ${c},${(s+l)/2} ${c},${l}`,y=Math.atan2(l-s,c-a),g=c-9*Math.cos(y),x=l-9*Math.sin(y),b=4.5*-Math.sin(y),w=4.5*Math.cos(y),M=`${c},${l} ${g+b},${x+w} ${g-b},${x-w}`,v=u(t,h,void 0),k=(a+c)/2,$=(s+l)/2;F.push(zt("g",{children:[Ct("path",{d:d,fill:"none",stroke:p,strokeWidth:1.4}),Ct("polygon",{points:M,fill:p}),"string"==typeof v&&v.length>0&&zt("g",{children:[Ct("rect",{x:k-6.5*v.length/2-4,y:$-9,width:6.5*v.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:f,strokeWidth:.75}),Ct("text",{x:k,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:m,style:{pointerEvents:"none"},children:v})]})]},"e-"+e))}),{sceneNodes:L,overlays:zt("g",{className:"mermaid-dag",children:[F,W]})}};import{jsx as Ft,jsxs as Tt}from"react/jsx-runtime";function Et(t){return Ft("rect",{className:t.className,x:t.x,y:t.y,width:Math.max(0,t.width),height:Math.max(0,t.height),rx:t.radius??10,ry:t.radius??10,fill:t.fill??"none",stroke:t.stroke,strokeWidth:t.strokeWidth??1.5,strokeDasharray:t.strokeDasharray,opacity:t.opacity??.6,style:{pointerEvents:"none"}},t.keyId)}function Rt(t,e=0){let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of t){const t=e.r??0;n>e.x-t&&(n=e.x-t),e.x+t>r&&(r=e.x+t),o>e.y-t&&(o=e.y-t),e.y+t>i&&(i=e.y+t)}return Number.isFinite(n)?{x:n-e,y:o-e,width:r-n+2*e,height:i-o+2*e}:null}function Pt(t,e=0){if(!t.length)return null;const n="number"==typeof e?e:e.x??0,o="number"==typeof e?e:e.y??0;let r=1/0,i=1/0,a=-1/0,s=-1/0;for(const e of t){if(!Number.isFinite(e.x)||!Number.isFinite(e.y))continue;if(!Number.isFinite(e.width)||!Number.isFinite(e.height))continue;const t=Math.max(0,e.width),n=Math.max(0,e.height);r>e.x&&(r=e.x),i>e.y&&(i=e.y),e.x+t>a&&(a=e.x+t),e.y+n>s&&(s=e.y+n)}return Number.isFinite(r)?{x:r-n,y:i-o,width:a-r+2*n,height:s-i+2*o}:null}function Ot(t){const e=t.fontSize??12;return null!=t.maxWidth&&t.text.length*e*.56>t.maxWidth?null:Ft("text",{className:t.className,x:t.x,y:t.y,textAnchor:t.anchor??"middle",dominantBaseline:t.baseline??"middle",fontSize:e,fontWeight:t.fontWeight,fill:t.color,style:{pointerEvents:"none"},children:t.text},t.keyId)}function Dt(t){const e=t.spacing??8;return{def:Ft("pattern",{id:t.id,width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${t.angle??45})`,children:Ft("line",{x1:0,y1:0,x2:0,y2:e,stroke:t.color??"currentColor",strokeWidth:t.strokeWidth??1,opacity:t.opacity??.5})},t.id),fill:`url(#${t.id})`}}function jt(t){const e=t.orient??"bottom",n="bottom"===e||"top"===e,o=t.offset??0,r=t.tickLength??6,i=t.gridLength??0,a=t.labelGap??4,s=t.fontSize??11,c=t.color??"var(--semiotic-text-secondary, #888)",l=t.gridColor??c,u=t.format??(t=>t+""),h="top"===e||"left"===e?-1:1,d=t.ticks.length-1,f=t.ticks.map((f,m)=>{const p=t.scale(f),y=o+h*r,g=o-h*i,x=y+h*a;let b;b=t.labelAnchor?t.labelAnchor:n?t.edgeAnchor&&0===m?"start":t.edgeAnchor&&m===d?"end":"middle":"left"===e?"end":"start";const w=n?"top"===e?"auto":"hanging":"middle",M=n?{x:p,y:x}:{x:x,y:p};return Tt("g",{children:[(r>0||i>0)&&Ft("line",{...n?{x1:p,x2:p,y1:y,y2:g}:{x1:y,x2:g,y1:p,y2:p},stroke:i>0?l:c,strokeWidth:1,strokeDasharray:i>0?t.gridDasharray:void 0,opacity:i>0?.7:1}),Ft("text",{x:M.x,y:M.y,textAnchor:b,dominantBaseline:w,fontSize:s,fontWeight:t.fontWeight,fill:c,children:u(f)})]},`tick-${f}-${m}`)});return Ft("g",{className:t.className,style:{pointerEvents:"none"},children:f},t.keyId)}function Bt(t){const e=t.stroke??"var(--semiotic-text, #f4f4f8)",n=t.strokeWidth??1,o=t.markRadius??0,r=t.labelX-t.markX,i=t.labelY-t.markY,a=Math.hypot(r,i)||1,s=t.markX+r/a*o,c=t.markY+i/a*o;let l;return l="elbow"===t.connector?`M${s},${c} L${s},${t.labelY} L${t.labelX},${t.labelY}`:"curve"===t.connector?`M${s},${c} Q${(s+t.labelX)/2},${c} ${t.labelX},${t.labelY}`:`M${s},${c} L${t.labelX},${t.labelY}`,Tt("g",{className:t.className,style:{pointerEvents:"none"},children:[o>0&&Ft("circle",{cx:t.markX,cy:t.markY,r:o,fill:"none",stroke:e,strokeWidth:n}),Ft("path",{d:l,fill:"none",stroke:e,strokeWidth:n}),Ft("text",{x:t.labelX,y:t.labelY,textAnchor:t.labelAnchor??"middle",dominantBaseline:t.labelBaseline??"hanging",fontSize:t.fontSize??11,fontWeight:t.fontWeight,fill:t.color??e,children:t.label})]},t.keyId)}import{jsx as Ht,jsxs as Yt}from"react/jsx-runtime";var Vt=new t(12);function Xt(t){if(null==t)return NaN;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=t+"",n=Number(e);if(!Number.isNaN(n)&&""!==e.trim())return n;const o=Date.parse(e);return Number.isNaN(o)?NaN:o}function qt(t,e,n){return e>t?e:t>n?n:t}var Gt=t=>{const e=t.config||{},n=t.dimensions.plot,r=e.columnAccessor??"column",i=e.rowAccessor??"row",s=e.sizeAccessor,l=e.colorAccessor,h=e.symbolAccessor,f=e.shadeAccessor,m=e.markerAccessor,p=e.iconAccessor,y=e.defaultSymbol??"circle",[g,x]=e.sizeRange??[2,8],b=e.shadeStrength??.72,w=e.shadeReverse??!1,M=e.rowMode??"banded",v=e.cellSizing??"proportional",S=e.proportionExponent??1,C=e.columnGap??16,z=e.rowGap??12,I=e.packPadding??1,N=e.iterations??12,L=!1!==e.showEnclosures,W=!1!==e.showColumnHeaders,F=!1!==e.showRowLabels,T=W?e.headerHeight??26:0,E=F?e.labelWidth??66:0,R=e.callouts&&e.callouts.length>0?e.footerHeight??30:0,P=n.x+E,O=n.y+T,D=Math.max(1,n.width-E),j=Math.max(1,n.height-T-R),B=[];for(const e of t.nodes){const t=e.data??e;B.push({id:e.id,col:u(e,r,"—")+"",row:u(e,i,"—")+"",sizeVal:s?Number(u(e,s,1)):1,colorKey:l?u(e,l,"")+"":"",symVal:h?u(e,h,"")+"":"",shadeVal:f?Xt(u(e,f,null)):NaN,marker:!!m&&!!u(e,m,!1),iconVal:p?u(e,p,"")+"":"",datum:t,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===B.length)return{sceneNodes:[]};let H=1/0,Y=-1/0;if(s)for(const t of B)Number.isFinite(t.sizeVal)&&(H>t.sizeVal&&(H=t.sizeVal),t.sizeVal>Y&&(Y=t.sizeVal));e.sizeDomain&&([H,Y]=e.sizeDomain),Number.isFinite(H)&&Number.isFinite(Y)||(H=0,Y=1);const V=t=>{if(H>=Y)return(g+x)/2;const e=Math.sqrt(qt((t-H)/(Y-H),0,1));return g+e*(x-g)};let X=1/0,q=-1/0;if(f)for(const t of B)Number.isFinite(t.shadeVal)&&(X>t.shadeVal&&(X=t.shadeVal),t.shadeVal>q&&(q=t.shadeVal));e.shadeDomain&&([X,q]=e.shadeDomain);const G=t=>{if(!f||!Number.isFinite(t)||X>=q)return.5;const e=qt((t-X)/(q-X),0,1);return w?1-e:e},K=e.colorMap,_=new Map,U=(e,n)=>{let o=_.get(e);if(!o){const n=K&&K[e]||t.resolveColor(e);o=c(n,b),_.set(e,o)}return o(n)},Z=new Map;if(e.symbolMap)for(const[t,n]of Object.entries(e.symbolMap))Z.set(t,n);let Q=0;const J=e.iconMap,tt=t=>p&&J&&J[t]?J[t]:null,et=t=>p?"circle":(t=>{if(!h)return y;let e=Z.get(t);return e||(e=k[Q%k.length],Q++,Z.set(t,e)),e})(t.symVal),nt=e.maxAreaFraction??.4;let ot=0;const rt=Array(B.length),it=Array(B.length);for(let t=0;B.length>t;t++){const e=B[t],n=V(e.sizeVal);rt[t]=n,e.baseShape=et(e),e.iconShape=tt(e.iconVal);const o=$(e.baseShape,Math.PI*n*n);it[t]=o,ot+=Math.PI*o*o}const at=nt*D*j,st=ot>at?Math.sqrt(at/ot):1;for(let t=0;B.length>t;t++){const e=B[t],n=rt[t]*st;e.size=Math.PI*n*n,e.packR=it[t]*st}const ct=new Map,lt=new Map;for(const t of B)ct.set(t.col,(ct.get(t.col)??0)+1),lt.set(t.row,(lt.get(t.row)??0)+1);const ut=e.columnOrder?.filter(t=>ct.has(t))??[...ct.keys()].sort((t,e)=>(ct.get(e)??0)-(ct.get(t)??0)),ht=e.rowOrder?.filter(t=>lt.has(t))??[...lt.keys()].sort((t,e)=>(lt.get(e)??0)-(lt.get(t)??0)),dt=d([Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height),T,E,R,M,v,S,C,z,I,N,g,x,H,Y,nt,ut.join(","),ht.join(","),B.length,_t(B)]),ft=Vt.getOrCompute(dt,()=>function(t,e){const n=new Map;for(const e of t){let t=n.get(e.col);t||(t=[],n.set(e.col,t)),t.push(e)}const o=e.columnOrder.filter(t=>n.has(t)),r=Math.max(1,e.innerW-e.columnGap*Math.max(0,o.length-1)),i=e.proportionExponent,s=o.map(t=>Math.pow(n.get(t).length,i)),c=s.reduce((t,e)=>t+e,0)||1,l=t=>"uniform"===e.cellSizing?r/o.length:s[t]/c*r,u=new Map,h=[];let d=e.innerX;for(let t=0;o.length>t;t++)h.push({col:o[t],x:d,w:l(t)}),d+=l(t)+e.columnGap;let f=1;const m=new Map,p=[],y=(t,e,n,o)=>{let r=m.get(t);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(t,r)),r.minX>e-o&&(r.minX=e-o),e+o>r.maxX&&(r.maxX=e+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},g=(t,n,o,r,i,a)=>{const s=t.map(t=>({id:t.id,r:t.packR})),c=function(t,e,n,o,r,i,a,s){const c=e+o/2,l=n+r/2,u=new Map,h=t.length;if(0===h)return u;if(1===h)return u.set(t[0].id,{px:c,py:l}),u;const d=function(t){let e=t>>>0||1;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}(s),f=new Float64Array(h);let m=0;for(let e=0;h>e;e++)f[e]=t[e].r+i,f[e]>m&&(m=f[e]);const p=Math.max(1,Math.round(Math.sqrt(h*o/Math.max(1,r)))),y=new Float64Array(h),g=new Float64Array(h),x=o/p,b=r/Math.ceil(h/p);for(let t=0;h>t;t++){const o=t%p,r=Math.floor(t/p);y[t]=e+(o+.3+.4*d())*x,g[t]=n+(r+.3+.4*d())*b}const w=Math.max(0,Math.min(a,14)),M=Math.max(1,2*m),v=new Map,k=Math.max(1,Math.ceil(o/M)+3),$=(t,e)=>(e+1)*k+(t+1);for(let t=0;w>t;t++){v.clear();for(let t=0;h>t;t++){const o=$(Math.floor((y[t]-e)/M),Math.floor((g[t]-n)/M)),r=v.get(o);r?r.push(t):v.set(o,[t])}for(let t=0;h>t;t++){const o=Math.floor((y[t]-e)/M),r=Math.floor((g[t]-n)/M);for(let e=-1;1>=e;e++)for(let n=-1;1>=n;n++){const i=v.get($(o+e,r+n));if(i)for(let e=0;i.length>e;e++){const n=i[e];if(t>=n)continue;let o=y[n]-y[t],r=g[n]-g[t];const a=f[t]+f[n],s=o*o+r*r;if(a*a>s)if(s>1e-9){const e=Math.sqrt(s),i=(a-e)/2;o/=e,r/=e,y[t]-=o*i,g[t]-=r*i,y[n]+=o*i,g[n]+=r*i}else{const e=2.39996323*t;y[t]+=Math.cos(e)*f[t],g[t]+=Math.sin(e)*f[t]}}}}for(let t=0;h>t;t++){const i=f[t],a=e+i,s=e+o-i,u=n+i,h=n+r-i;y[t]=s>a?qt(y[t],a,s):c,g[t]=h>u?qt(g[t],u,h):l}}for(let e=0;h>e;e++)u.set(t[e].id,{px:y[e],py:g[e]});return u}(s,n,o,r,i,e.packPadding,e.iterations,f++);let l=1/0,h=1/0,d=-1/0,m=-1/0;for(const t of s){const e=c.get(t.id);u.set(t.id,{px:e.px,py:e.py}),y(a,e.px,e.py,t.r),l>e.px-t.r&&(l=e.px-t.r),e.px+t.r>d&&(d=e.px+t.r),h>e.py-t.r&&(h=e.py-t.r),e.py+t.r>m&&(m=e.py+t.r)}return Number.isFinite(l)?{x:l-Kt,y:h-Kt,w:d-l+2*Kt,h:m-h+2*Kt}:null};if("banded"===e.rowMode){const r=new Map;for(const e of t)r.set(e.row,(r.get(e.row)??0)+1);const s=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,s.length-1)),l=s.map(t=>Math.pow(r.get(t),i)),d=l.reduce((t,e)=>t+e,0)||1,f=new Map;let p=e.innerY+e.innerH;for(let t=0;s.length>t;t++){const n="uniform"===e.cellSizing?c/s.length:l[t]/d*c,o=p-n;f.set(s[t],{y:o,h:n}),p=o-e.rowGap}o.forEach((t,e)=>{const o=a(n.get(t),t=>t.row);for(const t of s){const n=o.get(t),r=f.get(t);n&&r&&g(n,h[e].x,r.y,h[e].w,r.h,t)}});const y=[],x=new Map;for(const t of s){const e=f.get(t);x.set(t,e.y+e.h/2);const n=m.get(t);n&&Number.isFinite(n.minX)&&y.push({x:n.minX-Kt,y:n.minY-Kt,w:n.maxX-n.minX+2*Kt,h:n.maxY-n.minY+2*Kt})}return{positions:u,enclosures:y,colBands:h,rowLabelY:x}}const x=new Map;o.forEach((t,o)=>{const r=a(n.get(t),t=>t.row),s=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,s.length-1)),l=s.map(t=>Math.pow(r.get(t).length,i)),u=l.reduce((t,e)=>t+e,0)||1;let d=e.innerY+e.innerH;s.forEach((t,n)=>{const i="uniform"===e.cellSizing?c/s.length:l[n]/u*c,a=d-i,f=g(r.get(t),h[o].x,a,h[o].w,i,t);if(f){p.push(f);const e=x.get(t)??{sum:0,n:0};e.sum+=f.y+f.h/2,e.n+=1,x.set(t,e)}d=a-e.rowGap})});const b=new Map;for(const[t,e]of x)b.set(t,e.sum/e.n);return{positions:u,enclosures:p,colBands:h,rowLabelY:b}}(B,{columnOrder:ut,rowOrder:ht,innerX:P,innerY:O,innerW:D,innerH:j,rowMode:M,cellSizing:v,proportionExponent:S,columnGap:C,rowGap:z,packPadding:I,iterations:N})),mt=t.selection,pt=mt?.isActive?mt.predicate:null,yt=e.highlight??null,gt=e.dimOpacity??.16,xt=e.markStroke,bt=e.markStrokeWidth??0,wt=e.markerColor??"#ffffff",Mt=e.iconColor??"rgba(255,255,255,0.92)",vt=e.iconStrokeWidth??1,kt=e.iconScale??.72,$t=[],At=[],St=[];for(const t of B){const e=ft.positions.get(t.id);if(!e)continue;const n=o(t.datum,{highlight:yt,predicate:pt,dimOpacity:gt}),r={type:"symbol",cx:e.px,cy:e.py,size:t.size,symbolType:t.baseShape,style:{fill:U(t.colorKey,G(t.shadeVal)),opacity:n,...xt?{stroke:xt,strokeWidth:bt}:{}},datum:t.datum,id:t.id,label:t.id+""};if($t.push(r),t.iconShape){const o=Math.sqrt(t.size/Math.PI)*kt,r=$(t.iconShape,100);St.push({x:e.px,y:e.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:t.iconShape,opacity:n})}t.marker&&n>gt+.001&&At.push({x:e.px,y:e.py,r:Math.max(1,.4*Math.sqrt(t.size/Math.PI))})}const Ct=[];if(e.callouts&&e.callouts.length>0){const t=e.calloutColor??"var(--semiotic-text, #f4f4f8)",o=n.y+n.height-(R>0?.45*R:9),r=[];for(let t=0;e.callouts.length>t;t++){const n=e.callouts[t],o=B.find(t=>t.datum[n.field]+""==n.value+"");if(!o)continue;const i=ft.positions.get(o.id);i&&r.push({c:n,ci:t,px:i.px,py:i.py,markR:Math.sqrt(o.size/Math.PI)})}const i=r.filter(t=>null==t.c.at).sort((t,e)=>t.px-e.px),a=new Map;i.forEach((t,e)=>{a.set(t.ci,P+(e+.5)/i.length*D)});for(const e of r){const r=e.c;let i=a.get(e.ci)??e.px,s=o;const c=r.connector??(a.has(e.ci)?"elbow":"straight");"object"==typeof r.at&&r.at?(i=r.at.x,s=r.at.y):"number"==typeof r.at&&(s=n.y+r.at*n.height),Ct.push({keyId:"callout-"+e.ci,markX:e.px,markY:e.py,labelX:i,labelY:s,label:r.label,connector:c,markRadius:Math.max(e.markR+3,7),stroke:t,color:t,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const zt=function(t,e){const n=e.columnLabel??(t=>t),o=e.rowLabel??(t=>t);return Yt("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[e.showEnclosures&&t.enclosures.map((t,n)=>Et({keyId:"enc-"+n,x:t.x,y:t.y,width:t.w,height:t.h,radius:e.enclosureRadius,stroke:e.enclosureColor,strokeWidth:e.enclosureWidth,opacity:e.enclosureOpacity})),e.iconMarks.length>0&&Ht("g",{className:"packed-cluster-matrix-icons",children:e.iconMarks.map((t,n)=>Ht("path",{d:A(t.shape,t.size),transform:`translate(${t.x},${t.y})`,fill:"none",stroke:e.iconColor,strokeWidth:e.iconStrokeWidth,opacity:t.opacity},"ic-"+n))}),e.markerDots.length>0&&Ht("g",{className:"packed-cluster-matrix-markers",children:e.markerDots.map((t,n)=>Ht("circle",{cx:t.x,cy:t.y,r:t.r,fill:e.markerColor},"mk-"+n))}),e.showColumnHeaders&&t.colBands.map((t,o)=>Ot({keyId:"col-"+o,text:n(t.col),x:t.x+t.w/2,y:e.headerY,anchor:"middle",fontSize:e.headerFontSize,fontWeight:700,color:e.headerColor})),e.showRowLabels&&[...t.rowLabelY].map(([t,n])=>Ot({keyId:"row-"+t,text:o(t),x:e.labelX,y:n,anchor:"end",fontSize:e.labelFontSize,fontWeight:600,color:e.labelColor})),e.callouts.map(t=>Bt(t))]})}(ft,{markerDots:At,markerColor:wt,iconMarks:St,iconColor:Mt,iconStrokeWidth:vt,callouts:Ct,plot:n,showEnclosures:L,showColumnHeaders:W,showRowLabels:F,enclosureColor:e.enclosureColor??"var(--semiotic-text, #f4f4f8)",enclosureRadius:e.enclosureRadius??9,enclosureOpacity:e.enclosureOpacity??.5,enclosureWidth:e.enclosureWidth??1.5,headerColor:e.headerColor??"var(--semiotic-text, #f4f4f8)",labelColor:e.labelColor??"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:e.headerFontSize??13,labelFontSize:e.labelFontSize??11,headerY:n.y+.62*T,labelX:n.x+E-10,columnLabel:e.columnLabel,rowLabel:e.rowLabel});return{sceneNodes:$t,overlays:zt}},Kt=4;function _t(t){let e=2166136261;const n=t=>{for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619)};for(const o of t)n(o.id),n(o.col),n(o.row),e^=Math.round(8*o.packR),e=Math.imul(e,16777619);return(e>>>0).toString(36)}import*as Ut from"react";var Zt=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=h(n.categoryAccessor),i=h(n.stackBy),a=t=>{const e="function"==typeof n.valueAccessor?n.valueAccessor(t):t[n.valueAccessor],o=Number(e);return Number.isFinite(o)&&o>0?o:0},s=n.gutter??2,c="string"==typeof n.categoryAccessor?n.categoryAccessor:"category",l="string"==typeof n.stackBy?n.stackBy:"stack",u="string"==typeof n.valueAccessor?n.valueAccessor:"value",d=(t,n,o)=>e(e=>{e("category",t),e("stack",n),e("value",o),"category"!==c&&e(c,t),"stack"!==l&&e(l,n),"value"!==u&&e(u,o)}),f=!1!==n.showCategoryLabels,m=Math.max(0,o.height-(n.labelPadding??(f?22:0))),p=[],y=new Map,g=[],x=new Set,b=new Map;for(const e of t.data){const t=r(e)+"",n=i(e)+"",o=a(e);y.has(t)||(p.push(t),y.set(t,0),b.set(t,new Map)),x.has(n)||(x.add(n),g.push(n)),y.set(t,(y.get(t)??0)+o);const s=b.get(t);s.set(n,(s.get(n)??0)+o)}const w=n.categoryOrder?Qt(n.categoryOrder,p,t=>y.has(t)):p,M=n.stackOrder?Qt(n.stackOrder,g,()=>!0):g,v=w.reduce((t,e)=>t+(y.get(e)??0),0);if(0>=v)return{nodes:[]};const k=Math.max(0,o.width-s*Math.max(0,w.length-1)),$=[],A=[];let S=o.x;for(const e of w){const n=y.get(e)??0,r=n/v*k;if(0>=r)continue;A.push({cat:e,x:S,w:r});const i=b.get(e);let a=o.y;for(const o of M){const s=i.get(o)??0;if(0>=s)continue;const c=s/n*m;$.push({type:"rect",x:S,y:a,w:r,h:c,style:{fill:t.resolveColor(o),stroke:"none"},datum:d(e,o,s),group:o}),a+=c}S+=r+s}return{nodes:$,overlays:f&&A.length>0?function(t,e,n){const o=t.map((t,o)=>Ot({keyId:"marimekko-label-"+o,text:t.cat,x:t.x+t.w/2,y:e+12,anchor:"middle",baseline:"auto",maxWidth:t.w-4,fontSize:12,color:n}));return Ut.createElement(Ut.Fragment,null,...o)}(A,o.y+m+4,`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`):null}};function Qt(t,e,n){const o=new Set,r=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),r.push(e));for(const t of e)o.has(t)||r.push(t);return r}import*as Jt from"react";var te=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height||0===t.data.length)return{nodes:[]};const r=n.rowHeight??28,i=n.rowGap??12,a=!1!==n.showLabels,s=a?n.labelWidth??120:0,c=!1!==n.showTicks,l=c?14:0,u=n.tickFormat??(t=>t.toLocaleString()),d=o.x+s,f=Math.max(0,o.width-s);if(0>=f)return{nodes:[]};const m=h(n.categoryAccessor),p=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},y=t=>p("function"==typeof n.valueAccessor?n.valueAccessor(t):t[n.valueAccessor]),g=t=>p("function"==typeof n.targetAccessor?n.targetAccessor(t):t[n.targetAccessor]),x=t=>{const e="function"==typeof n.rangesAccessor?n.rangesAccessor(t):t[n.rangesAccessor];return Array.isArray(e)?e.map(p).sort((t,e)=>t-e):[]},b="string"==typeof n.categoryAccessor?n.categoryAccessor:"metric",w="string"==typeof n.valueAccessor?n.valueAccessor:"value",M="string"==typeof n.targetAccessor?n.targetAccessor:"target",v=n.actualColor??t.theme.semantic.primary??"#3b6cb1",k=t.theme.semantic.text??"currentColor",$=n.targetColor??`var(--semiotic-text, ${k})`,A=[`var(--semiotic-surface, ${t.theme.semantic.surface??"#e8eaed"})`,`var(--semiotic-grid, ${t.theme.semantic.grid??"#cdd1d6"})`,`var(--semiotic-border, ${t.theme.semantic.border??"#a3a8af"})`],S=`var(--semiotic-text, ${k})`,C=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=[],I=[];for(let n=0;t.data.length>n;n++){const a=t.data[n],s=x(a),c=y(a),u=g(a),h=Math.max(c,u,...s.length?s:[0]);if(0>=h)continue;const p=o.y+n*(r+i+l);if(p+r+l>o.y+o.height)break;I.push({yTop:p,label:m(a),actual:c,target:u,maxVal:h});const k=t=>d+t/h*f,S=m(a),C=t=>e(e=>{e("metric",S),"metric"!==b&&e(b,S),t(e)});let N=d;for(let t=0;s.length>t;t++){const e=k(s[t]),n=e-N;n>0&&z.push({type:"rect",x:N,y:p,w:n,h:r,style:{fill:A[Math.min(t,A.length-1)],stroke:"none"},datum:C(e=>{e("range",t),e("rangeValue",s[t]),e("kind","range")}),group:"range-"+t}),N=e}const L=Math.max(6,Math.floor(.45*r));z.push({type:"rect",x:d,y:p+(r-L)/2,w:k(c)-d,h:L,style:{fill:v,stroke:"none"},datum:C(t=>{t("value",c),t("kind","actual"),"value"!==w&&t(w,c)}),group:"actual"});const W=3,F=Math.floor(.8*r);z.push({type:"rect",x:k(u)-W/2,y:p+(r-F)/2,w:W,h:F,style:{fill:$,stroke:"none"},datum:C(t=>{t("target",u),t("kind","target"),"target"!==M&&t(M,u)}),group:"target"})}const N=[];for(let t=0;I.length>t;t++){const e=I[t];if(a&&N.push(Ot({keyId:"bullet-label-"+t,text:e.label,x:o.x+s-8,y:e.yTop+r/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:S})),c){const n=5,o=e.yTop+r+2;for(let r=0;n>r;r++){const i=e.maxVal*r/(n-1),a=d+i/e.maxVal*f;N.push(Jt.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:a,x2:a,y1:o,y2:o+3,stroke:C,strokeWidth:1}),Ot({keyId:`bullet-ticktext-${t}-${r}`,text:u(i),x:a,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:C}))}}}return{nodes:z,overlays:N.length>0?Jt.createElement(Jt.Fragment,null,...N):null}};import*as ee from"react";import{scaleLinear as ne}from"d3-scale";var oe=t=>{const e=t.config,{plot:n}=t.dimensions,r=e.fields??[];if(2>r.length||0>=n.width||0>=n.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const i={};for(const n of r){if(e.domains?.[n]){i[n]=e.domains[n];continue}let o=1/0,r=-1/0;for(const e of t.data){const t=Number(e[n]);Number.isFinite(t)&&(o>t&&(o=t),t>r&&(r=t))}i[n]=Number.isFinite(o)&&Number.isFinite(r)&&o!==r?[o,r]:[0,1]}const a=!1!==e.showAxes,s=a?e.axisLabelPadding??24:8,c=a?18:8,l=r.map(t=>ne().domain(i[t]).range([n.y+n.height-c,n.y+s])),u=r.map((t,e)=>1===r.length?n.x+n.width/2:n.x+e/(r.length-1)*n.width),h=e.colorBy?"function"==typeof e.colorBy?e.colorBy:t=>(t[e.colorBy]??"")+"":null,d=e.opacity??.45,f=e.strokeWidth??1.25,m=t.theme.semantic.primary??"#3b6cb1",p=e.dimmedOpacity??.08,y=e.highlightFn,g=[],x=[];for(const n of t.data){const i=h?t.resolveColor(h(n)+""):m,a=!y||y(n),s=o(n,{predicate:y,baseOpacity:d,dimOpacity:p,brighten:.4}),c=a?x:g;for(let t=0;r.length-1>t;t++){const e=Number(n[r[t]]),o=Number(n[r[t+1]]);if(!Number.isFinite(e)||!Number.isFinite(o))continue;const h={type:"connector",x1:u[t],y1:l[t](e),x2:u[t+1],y2:l[t+1](o),style:{stroke:i,strokeWidth:y&&a?f+.75:f,opacity:s,fill:"none"},datum:n};c.push(h)}if(e.showPoints)for(let t=0;r.length>t;t++){const e=Number(n[r[t]]);if(!Number.isFinite(e))continue;const o={type:"point",x:u[t],y:l[t](e),r:2.5,style:{fill:i,stroke:"none",opacity:Math.min(1,s+.3)},datum:n};c.push(o)}}let b=null;if(a){const o=`var(--semiotic-border, ${t.theme.semantic.border??"#aaa"})`,a=`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`,h=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,d=n.y+s,f=n.y+n.height-c,m=[];for(let t=0;r.length>t;t++){const c=r[t],p=u[t],y=e.tickFormat?.[c]??(t=>t.toLocaleString());m.push(ee.createElement("line",{key:"pc-axis-line-"+t,x1:p,x2:p,y1:d,y2:f,stroke:o,strokeWidth:1})),m.push(Ot({keyId:"pc-axis-label-"+t,text:c,x:p,y:n.y+s-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:a}));const[g,x]=i[c],b=5;for(let e=0;b>e;e++){const n=g+(x-g)*e/(b-1),r=l[t](n);m.push(ee.createElement("line",{key:`pc-tick-${t}-${e}`,x1:p-3,x2:p+3,y1:r,y2:r,stroke:o,strokeWidth:1}),Ot({keyId:`pc-ticktext-${t}-${e}`,text:y(n),x:p+6,y:r+3,anchor:"start",baseline:"auto",fontSize:10,color:h}))}}b=ee.createElement(ee.Fragment,null,...m)}return{nodes:g.concat(x),overlays:b}};import{jsx as re,jsxs as ie}from"react/jsx-runtime";var ae=1.75,se="#222222";function ce(t,e){return t.topRadius+(e-t.height)/t.height*(t.topRadius-t.bottomRadius)}function le(t,e){return function(t,e,n){return Math.PI*n/3*(t*t+t*e+e*e)}(ce(t,e),t.bottomRadius,e)}function ue(t,e){const n=(t.topRadius+t.bottomRadius)/2,o=Math.PI*n*n;let r=e/o,i=e-le(t,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=e-le(t,r),a++;return r}function he(t,e){const n=43758.5453*Math.sin(12.9898*t+78.233);return 2*(n-Math.floor(n)-.5)*e}function de(t,e){if(e>t||2*e>t)return[{x:0,y:0}];const n=[],o=t=>{let r=Math.floor(2*Math.PI*t/(2*e));1>r&&(r=1);const i=0*t,a=Math.hypot(1*t-t*Math.cos(2*Math.PI/r),i-t*Math.sin(2*Math.PI/r));2*e>a&&r>1&&r--;for(let e=0;r>e;e++)n.push({x:t*Math.cos(2*e*Math.PI/r),y:t*Math.sin(2*e*Math.PI/r)});const s=t-2*e;e>s?t>2*e&&n.push({x:0,y:0}):o(s)};return o(t-e),n}function fe(t,e,n){const o=[];let r=n,i=0;for(;r>0&&60>i;){const n=e*(1+2*i),a=de(ce(t,n),e),s=a.length-r,c=s>1?a.slice(Math.floor(s/2),Math.floor(s/2)+r):a,l=t.height-n;if(c.forEach((t,e)=>{o.push({x:t.x+he(97*i+e,.15),z:l+he(31*i+e,.05)})}),r-=c.length,i++,0===c.length)break}return{pearls:o,layers:i}}function me(t,e,n,o){if(0>=o)return[];const r=function(t,e,n){let o=n,r=0;for(;o>0&&60>r;){const n=ce(t,e+.875*(1+2*r));o-=Math.max(1,Math.floor(2*n/ae)),r++}return r}(t,e,o),i=Math.max(e,n-r*ae)+.875,a=[];let s=0;for(let e=0;r>e&&o>s;e++){const n=i+ae*e,r=ce(t,n),c=Math.max(1,Math.floor(2*r/ae)),l=(2*r-c*ae)/(c+1),u=-r+l,h=t.height-n-.875-.1;for(let t=0;c>t&&o>s;t++)a.push({cx:u+(l+ae)*t+.875,cy:h+.875,rotation:he(53*e+t,10)}),s++}return a}function pe(t,e){const n=Number(t);return Number.isFinite(n)?n:e}var ye=t=>{const e=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=h(e.categoryAccessor??"name"),i=h(e.teaVolumeAccessor??"teaVolume"),a=h(e.bobaVolumeAccessor??"bobaVolume"),s=h(e.iceVolumeAccessor??"iceVolume"),c=h(e.cupHeightAccessor??"cupHeight"),l=h(e.cupTopRadiusAccessor??"cupTopRadius"),u=h(e.cupBottomRadiusAccessor??"cupBottomRadius"),d=h(e.bobaRadiusAccessor??"bobaRadius"),m=e.cupWidthRatio??.82,p=t.scales.o,y=p.bandwidth(),g=Math.max(1,o.height-26-8),x=o.y+8,b=[],w=[];for(const e of t.data){const o=r(e)+"",h=p(o);if(null==h)continue;const M={height:pe(c(e),15.5),topRadius:pe(l(e),4.75),bottomRadius:pe(u(e),3.75)},v=pe(d(e),.6),k=Math.max(0,pe(i(e),450)),$=Math.max(0,pe(a(e),110)),A=Math.max(0,pe(s(e),135)),S=Math.PI*v*v,C=Math.floor($/S),z=C*S,I=Math.floor(A/5.359375),N=I*ae*ae*ae,L=k+z+N,W=ue(M,L),F=Math.min(M.height,Math.max(0,W)),T=ce(M,F),{pearls:E,layers:R}=fe(M,v,C),P=F,O=me(M,R*v*2,P,I),D=M.height-20.32,j=Math.min(0,D),B=Math.min(y*m/(2*(M.topRadius+1)),g/(M.height-j)),H=h+y/2,Y=t=>H+t*B,V=t=>x+(t-j)*B,X=Y(-(M.topRadius+1)),q=Y(M.topRadius+1),G=V(j),K=V(M.height),_=n({name:o,teaVolume:k,bobaVolume:Math.round(z),iceVolume:Math.round(N),totalVolume:Math.round(L),numBobas:C,numIce:I,kind:"boba cup"});b.push({type:"rect",x:X,y:G,w:Math.max(1,q-X),h:Math.max(1,K-G),style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:_,group:o,_transitionKey:"boba-"+f(o)});const U=M.height-P,Z=f(o),Q=t.resolveColor(o);w.push(ie("g",{children:[k>0?re("path",{d:`M${Y(-T)},${V(U)} L${Y(-M.bottomRadius)},${V(M.height)} L${Y(M.bottomRadius)},${V(M.height)} L${Y(T)},${V(U)} z`,fill:"#D2B799"}):null,E.map((t,e)=>re("circle",{cx:Y(t.x),cy:V(t.z),r:v*B,fill:"#222222",opacity:.5},"p-"+e)),O.map((t,e)=>re("rect",{x:Y(t.cx)-.95*ae*B/2,y:V(t.cy)-.95*ae*B/2,width:.95*ae*B,height:.95*ae*B,rx:2,fill:"#a5f2f3",opacity:.85,transform:`rotate(${t.rotation} ${Y(t.cx)} ${V(t.cy)})`},"i-"+e)),re("path",{d:`M${Y(-M.topRadius)},${V(0)} L${Y(-M.bottomRadius)},${V(M.height)} L${Y(M.bottomRadius)},${V(M.height)} L${Y(M.topRadius)},${V(0)}`,fill:"none",stroke:se,strokeWidth:2.5}),re("line",{x1:Y(-(M.topRadius+1)),y1:V(0),x2:Y(M.topRadius+1),y2:V(0),stroke:se,strokeWidth:3,strokeLinecap:"round"}),k>0?re("path",{d:`M${Y(-.635)},${V(D)} L${Y(-.635)},${V(M.height-.4)} L${Y(.635)},${V(M.height-1.27-.4)} L${Y(.635)},${V(D)} z`,fill:"#4F91CB",stroke:se,strokeWidth:1,opacity:.78}):null,re("text",{x:H,y:K+16,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--semiotic-text, #333)",children:o}),re("text",{x:H,y:K+30,textAnchor:"middle",fontSize:10,fill:Q,children:`${C} pearls · ${Math.round(L)} cm³`})]},"boba-"+Z))}return{nodes:b,overlays:re("g",{className:"semiotic-boba",style:{pointerEvents:"none"},children:w})}},ge=["naturalGas","coal","nuclear","hydro","wind","solar","other"],xe={naturalGas:"Natural gas",coal:"Coal",nuclear:"Nuclear",hydro:"Hydro",wind:"Wind",solar:"Solar",other:"Other"},be={tight:5,watch:12,comfortable:20};function we(t,e=0){return"number"==typeof t&&Number.isFinite(t)?t:e}function Me(t,e={}){const n=e.fuels??ge,o=!0===e.includeZero,r=[];for(const e of t)if(e&&"number"==typeof e.t)for(const t of n){const n=we(e.fuels?.[t]);(o||n>0)&&r.push({t:e.t,fuel:t,fuelLabel:xe[t],mw:n,ba:e.ba})}return r}function ve(t){const e=[];for(const n of t){if(!n||"number"!=typeof n.t)continue;const t=we(n.demandMw),o=n.forecastMw;"number"==typeof o&&Number.isFinite(o)&&e.push({t:n.t,a:t,b:o,demandMw:t,forecastMw:o,errorMw:t-o,ba:n.ba})}return e}function ke(t){const e=we(t.demand);if(0>=e)return 0;const n=we(t.capacityOrNetGen),o=we(t.interchange);return(n+(0>o?-o:0)-e)/e*100}function $e(t){return t.filter(t=>t&&"number"==typeof t.t).map(t=>{const e=we(t.demandMw),n=we(t.netGenMw),o=ke({demand:e,capacityOrNetGen:n,interchange:t.interchangeMw});return{t:t.t,ba:t.ba,reserveMarginPct:o,netLoadMw:e,demandMw:e,netGenMw:n}})}function Ae(t={},e={}){const{watch:n,comfortable:o}={...be,...t},r=e.field,i=r?{field:r}:{},a=e.tightHatch??{type:"hatch",background:"var(--semiotic-danger, #c2410c)",stroke:"rgba(255, 240, 200, 0.55)",spacing:5,angle:-35,lineWidth:1.25,lineOpacity:.9};return[{id:"reserve-comfortable",label:`Comfortable (≥ ${o}%)`,when:{...i,gte:o},style:{fill:e.comfortableFill??"var(--semiotic-success, #16a34a)",fillOpacity:.85}},{id:"reserve-watch",label:`Watch (< ${o}%, ≥ ${n}%)`,when:{...i,lt:o,gte:n},style:{fill:e.watchFill??"var(--semiotic-warning, #d97706)",fillOpacity:.9}},{id:"reserve-tight",label:`Tight (< ${n}%)`,when:{...i,lt:n},style:{fill:a,stroke:e.tightFill??"var(--semiotic-danger, #c2410c)",strokeWidth:1,fillOpacity:1}}]}function Se(t={}){const{tight:e,watch:n,comfortable:o}={...be,...t};return[{type:"band",y0:-50,y1:e,label:"Tight",color:"var(--semiotic-danger, #c2410c)",fillOpacity:.12,emphasis:"secondary"},{type:"band",y0:e,y1:n,label:"Watch",color:"var(--semiotic-warning, #d97706)",fillOpacity:.1,emphasis:"secondary"},{type:"band",y0:n,y1:Math.max(o+30,40),label:"Headroom",color:"var(--semiotic-success, #16a34a)",fillOpacity:.06,emphasis:"secondary"}]}function Ce(t,e){if(!t.length)return null;const n=[...t].filter(t=>t&&"number"==typeof t.t).sort((t,e)=>t.t-e.t);if(!n.length)return null;let o=n[n.length-1];if("number"==typeof e&&Number.isFinite(e)){const t=n.filter(t=>e>=t.t);o=t.length?t[t.length-1]:n[0]}const r=we(o.demandMw),i=we(o.netGenMw),a="number"==typeof o.forecastMw&&Number.isFinite(o.forecastMw)?o.forecastMw:null,s=ke({demand:r,capacityOrNetGen:i,interchange:o.interchangeMw}),c={};let l=null,u=0,h=0;for(const t of ge){const e=we(o.fuels?.[t]);e>0&&(h+=e,c[t]=e,e>u&&(u=e,l=t))}if(h>0)for(const t of Object.keys(c))c[t]=c[t]/h;return{t:o.t,ba:o.ba,demandMw:r,forecastMw:a,forecastErrorMw:null==a?null:r-a,netGenMw:i,reserveMarginPct:s,topFuel:l,topFuelShare:h>0?u/h:0,topFuelMw:u,fuelShares:c}}function ze(t,e={}){const n=e.now??Date.now(),o=e.author??"system",r=e.source??"authored-scenario";return t.map(t=>{const e=(t.start+t.end)/2,i=new Date(t.start).toISOString();return{type:"x-band",x0:t.start,x1:t.end,label:t.label,color:"outage"===t.kind?"var(--semiotic-danger)":"var(--semiotic-warning)",fillOpacity:.12,emphasis:"secondary",x:e,y:t.y??t.value,note:t.note,provenance:{author:o,authorKind:"system",source:r,basis:"rule",confidence:.85,createdAt:i,stableId:t.id,dataVersion:t.start+""},lifecycle:{status:"accepted",ttlHint:t.ttlHint??"P14D",anchor:"fixed"},_eventKind:t.kind,_createdAtMs:t.start,_nowMs:n}})}function Ie(t,e=12){return[...t].filter(t=>Number.isFinite(t.reserveMarginPct)).sort((t,e)=>t.reserveMarginPct-e.reserveMarginPct).slice(0,Math.max(0,e))}function Ne(t,e=0){return Number.isFinite(t)?t.toLocaleString(void 0,{maximumFractionDigits:e,minimumFractionDigits:e})+" MW":"—"}function Le(t,e=1){return Number.isFinite(t)?`${t>0?"+":""}${t.toFixed(e)}%`:"—"}import*as We from"react";function Fe(t,e){if("function"==typeof t)return t;const n=t??e;return t=>Number(t[n])}function Te(t,e={}){const n=Fe(e.start,"start"),o=Fe(e.end,"end"),r=!1===e.sort?t.slice():t.slice().sort((t,e)=>n(t)-n(e)||o(e)-o(t)),i=[];return{packed:r.map(t=>{const e=n(t);let r=i.findIndex(t=>e>=t);return-1===r&&(r=i.length),i[r]=o(t),{item:t,track:r}}),trackCount:Math.max(1,i.length)}}function Ee(t,e){const n=Fe(e.start,"start"),o=Fe(e.end,"end"),[r,i]=e.domain,a=e.step??1,s="half-open"===e.bounds,c=[];for(let e=r;i>=e;e+=a){let r=0;for(const i of t){const t=n(i),a=o(i);t>e||(s?e>=a:e>a)||r++}c.push({value:e,count:r})}return c}function Re(t){return"function"==typeof t?t:e=>e[t]}var Pe=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height||0===t.data.length||!e?.domain)return{nodes:[]};const o=Re(e.laneAccessor),r=Re(e.startAccessor),i=Re(e.endAccessor),a=e.idAccessor?Re(e.idAccessor):null,s=e.unit??0,c=e.barGap??1.5,l=Math.max(0,e.minBarWidth??2),u=e.minBarHeight??3.5,h=e.maxBarHeight??10,d=e.lanePadding??7,f=e.cornerRadius??2,m=e.bottomInset??0,p=e.color??((e,n)=>t.resolveColor(n)),[y,g]=e.domain,x=g-y||1,b=t=>n.x+(t-y)/x*n.width,w=t.scales?.o?.domain?.()??[],M=e.lanes??(w.length>0?w:[...new Set(t.data.map(o))]),v=Math.max(0,n.height-m)/Math.max(1,M.length),k=t=>b(r(t)),$=t=>Math.max(k(t)+l,b(i(t)+s)),A=[];M.forEach((e,r)=>{const i=n.y+r*v,s=t.data.filter(t=>o(t)===e);if(0===s.length)return;const{packed:l,trackCount:m}=Te(s,{start:k,end:$}),y=new Map,g=new Map;for(const{item:t,track:e}of l){const n=g.get(e);n?n.push(t):g.set(e,[t])}for(const t of g.values()){t.sort((t,e)=>k(t)-k(e));for(let e=0;t.length-1>e;e++)y.set(t[e],k(t[e+1]))}const x=(v-2*d)/m,b=Math.min(h,Math.max(Math.min(u,x),x-c));for(const{item:t,track:n}of l){const o=k(t),r=y.get(t),s=$(t)-o;A.push({type:"rect",x:o,y:i+d+n*x,w:void 0!==r&&o+s>r-1?Math.max(1,r-1-o):s,h:b,cornerRadii:f>0?{tl:f,tr:f,br:f,bl:f}:void 0,style:{fill:p(t,e),stroke:"none"},datum:t,group:e,_transitionKey:a?a(t)+"":void 0})}});const S=`var(--semiotic-text, ${t.theme.semantic.text??"#1a1a1a"})`,C=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=`var(--semiotic-border, ${t.theme.semantic.border??"#94a3b8"})`,I=[];(e.periods??[]).forEach((t,e)=>{const o=b(t.start),r=Math.max(1,b(t.end+s)-o);I.push(We.createElement("rect",{key:"period-"+e,x:o,y:n.y,width:r,height:n.height,fill:z,opacity:e%2==0?.06:.025,pointerEvents:"none"})),t.name&&I.push(Ot({keyId:"period-label-"+e,text:t.name,x:o+4,y:n.y+12,anchor:"start",baseline:"hanging",fontSize:13,fontWeight:700,color:C}))});const N=!1!==e.showLaneLabels,L=e.laneLabelGap??12;if(M.forEach((t,e)=>{const o=n.y+e*v;I.push(We.createElement("line",{key:"lane-sep-"+e,x1:n.x,x2:n.x+n.width,y1:o,y2:o,stroke:z,opacity:.45})),N&&I.push(Ot({keyId:"lane-label-"+e,text:t,x:n.x-L,y:o+v/2,anchor:"end",baseline:"middle",fontSize:12,fontWeight:600,color:S}))}),!1!==e.showAxis){const t=e.axisTicks??Array.from({length:8},(t,e)=>Math.round(y+e/7*x));I.push(jt({keyId:"interval-axis",scale:b,ticks:t,orient:"top",offset:n.y,tickLength:0,gridLength:n.height,gridDasharray:"3 5",edgeAnchor:!0,format:e.tickFormat,color:C}))}return{nodes:A,overlays:We.createElement(We.Fragment,null,...I)}};function Oe(t,e,n){const o=n?.orientation??"vertical",r=n?.bend??0,i=n?.minAlong??18,a=(t,e)=>(t+e)/2;if("vertical"===o){if(i>Math.abs(e.y-t.y)){const n=t.x>e.x?-1:1,o=a(t.x,e.x)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${o},${a(t.y,e.y)} ${e.x},${e.y}`}const n=a(t.y,e.y)+r;return`M${t.x},${t.y} C${t.x},${n} ${e.x},${n} ${e.x},${e.y}`}if(i>Math.abs(e.x-t.x)){const n=t.y>e.y?-1:1,o=a(t.y,e.y)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${a(t.x,e.x)},${o} ${e.x},${e.y}`}const s=a(t.x,e.x)+r;return`M${t.x},${t.y} C${s},${t.y} ${s},${e.y} ${e.x},${e.y}`}function De(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=(t.y+e.y)/2;return`M${t.x},${t.y} L${t.x},${n} L${e.x},${n} L${e.x},${e.y}`}const o=(t.x+e.x)/2;return`M${t.x},${t.y} L${o},${t.y} L${o},${e.y} L${e.x},${e.y}`}function je(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=e.cy>=t.cy;return{from:{x:t.cx,y:t.cy+(n?t.height/2:-t.height/2)},to:{x:e.cx,y:e.cy+(n?-e.height/2:e.height/2)}}}const o=e.cx>=t.cx;return{from:{x:t.cx+(o?t.width/2:-t.width/2),y:t.cy},to:{x:e.cx+(o?-e.width/2:e.width/2),y:e.cy}}}function Be(t,e){const n=e?.spread??5;return e?.modulo&&e.modulo>0?(t%e.modulo-(e.modulo-1)/2)*n:(t-((e?.count??1)-1)/2)*n}function He(t,e){const n=1-e,o=n*n*n,r=3*n*n*e,i=3*n*e*e,a=e*e*e;return{x:o*t.p0.x+r*t.p1.x+i*t.p2.x+a*t.p3.x,y:o*t.p0.y+r*t.p1.y+i*t.p2.y+a*t.p3.y}}function Ye(t,e){const n=1-e,o=3*n*n,r=6*n*e,i=3*e*e;return{x:o*(t.p1.x-t.p0.x)+r*(t.p2.x-t.p1.x)+i*(t.p3.x-t.p2.x),y:o*(t.p1.y-t.p0.y)+r*(t.p2.y-t.p1.y)+i*(t.p3.y-t.p2.y)}}function Ve(t){return`M${t.p0.x},${t.p0.y} C${t.p1.x},${t.p1.y} ${t.p2.x},${t.p2.y} ${t.p3.x},${t.p3.y}`}function Xe(t,e){const n=e?.axis??"x",o=e?.padding??0,r=e?.strength??.5,i="x"===n?"y":"x",a="x"===n?"width":"height",s="x"===n?"height":"width",c=new Map;for(const e of t)c.set(e.id,0);for(let e=0;t.length>e;e++)for(let l=e+1;t.length>l;l++){const u=t[e],h=t[l];if(Math.abs(u[i]-h[i])>(u[s]+h[s])/2+o)continue;const d=h[n]-u[n]||(h.id>u.id?-.5:.5),f=(u[a]+h[a])/2+o-Math.abs(d);if(0>=f)continue;const m=f*r*Math.sign(d);c.set(u.id,(c.get(u.id)??0)-m),c.set(h.id,(c.get(h.id)??0)+m)}return c}var qe={width:60,height:34};function Ge(t,e){if("function"==typeof t)return t;const n=t??e;return t=>u(t,n,void 0)}function Ke(t,e,n,o){const r=o.fixedAxis??"y",i=t=>Ge(o.sourceAccessor,"source")(t)+"",a=t=>Ge(o.targetAccessor,"target")(t)+"",s=o.size??(()=>qe),c=o.iterations??180,l=o.attraction??.012,u=o.anchorStrength??.003,h=o.collisionStrength??.12,d=o.collisionPadding??15,f=o.edgePadding??42,p=o.fixedPadding??16,y=o.damping??.72,g=o.spread??1,[x,b]=o.fixedDomain,w=b-x||1,M=("y"===r?n.y:n.x)+p,v=("y"===r?n.y+n.height:n.x+n.width)-p,k=("y"===r?n.x:n.y)+f,$=("y"===r?n.x+n.width:n.y+n.height)-f,A=Math.max(1,$-k),S=t.map(t=>{const e=m(t)??t,n=(r=t,Ge(o.idAccessor,"id")(r)+"");var r;const{width:i,height:a}=s(e),c=(t=>Number(Ge(o.fixedAccessor,"fixed")(t)))(t),l=k+function(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}(n)*A;return{data:e,id:n,width:i,height:a,fixedValue:c,fixed:(u=c,M+(u-x)/w*(v-M)),free:l,anchor:l};var u}),C=new Map(S.map(t=>[t.id,t])),z=t=>"y"===r?t.width:t.height;for(let t=0;c>t;t++){const t=new Map;for(const e of S)t.set(e.id,0);for(const n of e){const e=C.get(i(n)),o=C.get(a(n));if(!e||!o)continue;const r=(o.free-e.free)*l;t.set(e.id,(t.get(e.id)??0)+r),t.set(o.id,(t.get(o.id)??0)-r)}for(const e of S)t.set(e.id,(t.get(e.id)??0)+(e.anchor-e.free)*u);const n=Xe(S.map(t=>({id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height})),{axis:"y"===r?"x":"y",padding:d,strength:h});for(const e of S)t.set(e.id,(t.get(e.id)??0)+(n.get(e.id)??0));for(const e of S){e.free+=(t.get(e.id)??0)*y;const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,e.free))}}if(1!==g){const t=(k+$)/2;for(const e of S){const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,t+(e.free-t)*g))}}const I=S.map(t=>({data:t.data,id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height,fixedValue:t.fixedValue}));return{positioned:I,byId:new Map(I.map(t=>[t.id,t]))}}var _e=t=>{const{plot:e}=t.dimensions;if(0>=e.width||0>=e.height||0===t.nodes.length||!t.config?.fixedDomain)return{sceneNodes:[]};const n=t.config.fixedAxis??"y",{positioned:o,byId:r}=Ke(t.nodes,t.edges,e,t.config),i=o.map(e=>({type:"rect",x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,style:{fill:t.resolveColor(e.id),stroke:"none"},datum:e.data,id:e.id,label:e.id})),a=[];t.edges.forEach((e,o)=>{const i=r.get((s=e,("function"==typeof t.config.sourceAccessor?t.config.sourceAccessor(s):u(s,t.config.sourceAccessor??"source",void 0))+""));var s;const c=r.get((e=>("function"==typeof t.config.targetAccessor?t.config.targetAccessor(e):u(e,t.config.targetAccessor??"target",void 0))+"")(e));if(!i||!c)return;const{from:l,to:h}=je({cx:i.x,cy:i.y,width:i.width,height:i.height},{cx:c.x,cy:c.y,width:c.width,height:c.height},{orientation:"y"===n?"vertical":"horizontal"});a.push({type:"curved",pathD:Oe(l,h,{orientation:"y"===n?"vertical":"horizontal",bend:Be(o,{modulo:5,spread:5})}),style:{stroke:"var(--semiotic-border, #888)",fill:"none",strokeWidth:1.4},datum:m(e)??e})});const s=o.map(t=>({x:t.x,y:t.y,text:t.id}));return{sceneNodes:i,sceneEdges:a,labels:s}},Ue={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Ze=8;function Qe(t){return null==t?void 0:t+""}function Je(t){const e=Qe(t.id);return{type:"point",x:t.x,y:t.y,r:t.r??8,style:{...Ue},datum:t.datum,pointId:e,_transitionKey:e}}function tn(t){return Je(t)}function en(t){const[[e,n],[o,r]]=t.bounds;return{type:"geoarea",pathData:t.pathData,centroid:t.centroid,bounds:t.bounds,screenArea:t.screenArea??Math.abs((o-e)*(r-n)),style:{...Ue},datum:t.datum,group:t.group,interactive:!0}}function nn(t){return{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...Ue},datum:t.datum,group:t.group,_transitionKey:Qe(t.id)}}function on(t){const e=Qe(t.id);return"width"in t&&"height"in t?{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...Ue},datum:t.datum,id:e,label:t.label}:{type:"circle",cx:t.x,cy:t.y,r:t.r??8,style:{...Ue},datum:t.datum,id:e,label:t.label}}function rn(t,e,n={}){const{coord:o,step:r=1,equals:i=Object.is,truthyOnly:a=!1}=n,s=[],c=e=>o?o(t[e],e):e,l=(t,e,n)=>{t.endIndex=e,t.count=e-t.startIndex+1,t.end=o?null==n||c(n)-c(e)>r?c(e)+r:c(n):e+1,s.push(t)};let u=null;for(let n=0;t.length>n;n++){const s=e(t[n],n);if(a&&!s){u&&(l(u,u.endIndex,n),u=null);continue}const h=!o||0>=n||c(n)-c(n-1)<=r;u&&h&&i(u.value,s)?u.endIndex=n:(u&&l(u,u.endIndex,n),u={value:s,start:c(n),end:c(n),count:1,startIndex:n,endIndex:n})}return u&&l(u,u.endIndex,null),s}var an=rn;function sn(t,e,n=0){return e>0?((t-n)%e+e)%e+n:t}function cn(t,e,n){if(0>=n)return e-t;let o=(e-t)%n;return o>n/2?o-=n:-n/2>o&&(o+=n),o}function ln(t,e,n){return e>n?t>=e||n>=t:t>=e&&n>=t}function un(t,e,n,o){return n>o?[...t.filter(t=>e(t)>=n),...t.filter(t=>e(t)<=o)]:t.filter(t=>ln(e(t),n,o))}function hn(t,e){const n=Math.max(0,e.width),o=e.y,r=Math.min(74,Math.max(34,.08*n)),i=e.paddingLeft??r,a=t.length>1?Math.max(0,n-i-(e.paddingRight??r))/(t.length-1):0,s=new Map;return t.forEach((t,e)=>{s.set(t.id,{id:t.id,x:i+a*e,y:o,index:e})}),s}function dn(t,e){const n=Math.max(0,e.width),o=e.y,r=Math.min(74,Math.max(34,.08*n)),i=e.paddingLeft??r,a=e.paddingRight??r,s=e.gap??8,c=!1!==e.distribute,l=e.estimateWidth??(t=>fn(t.label??t.id)),u=t.map((t,e)=>Math.max(1,l(t,e))),h=u.reduce((t,e)=>t+e,0)+s*Math.max(0,t.length-1),d=Math.max(0,n-i-a),f=c&&t.length>1?Math.max(0,d-h)/(t.length-1):0,m=new Map;let p=i;return c||1!==t.length||(p=i+Math.max(0,(d-u[0])/2)),t.forEach((t,e)=>{const n=u[e];m.set(t.id,{id:t.id,x:p+n/2,y:o,index:e,width:n}),p+=n+s+f}),m}function fn(t,e=38,n=7.4,o=20){return Math.max(e,((t??"")+"").length*n+o)}function mn(t){const e=t.map(t=>{const e=Math.min(t.a,t.b),n=Math.max(t.a,t.b);return{span:t,a:e,b:n,width:n-e}}).sort((t,e)=>t.width-e.width||t.a-e.a),n=[],o=e.map(t=>{let e=n.findIndex(e=>t.a>=e);return 0>e?(e=n.length,n.push(t.b)):n[e]=t.b,{span:t.span,level:e}}),r=o.reduce((t,e)=>Math.max(t,e.level),0);return{packed:o,maxLevel:r,levelCount:o.length?r+1:1}}function pn(t){const e=t.labelRoom??18,n=Math.max(48,t.baselineY-t.ceilingY-28),o=Math.max(1,t.levelCount),r=Math.min(42,Math.max(26,.18*n)),i=Math.max(24,n-r-e);return{arcLift:r,levelStep:Math.min(72,Math.max(28,o>1?i/Math.max(1,o-1):i))}}function yn(t,e,n,o,r={}){const i=n-(r.footLift??26);return`M${t} ${i}Q${(t+e)/2} ${o} ${e} ${i}`}function gn(t,e,n){return t-n.arcLift-e*n.levelStep}function xn(t,e=bn){if(!t.length)return{shared:[],exclusive:[]};if(1===t.length)return{shared:[...t[0]],exclusive:[[]]};const n=t.map(t=>new Set(t.map(t=>e(t)))),o=new Set;for(const t of n[0])n.every(e=>e.has(t))&&o.add(t);const r=[],i=new Set;for(const n of t[0]){const t=e(n);o.has(t)&&!i.has(t)&&(r.push(n),i.add(t))}return{shared:r,exclusive:t.map(t=>t.filter(t=>!o.has(e(t))))}}function bn(t){return null==t||"object"!=typeof t?t+"":null!=t.id?t.id+"":`${(t.sourceTokenId??t.source)+""}|${(t.targetTokenId??t.target)+""}|${(t.relation??t.label??"")+""}`}var wn=2*Math.PI;function Mn(t,e,n){const o=n?.center?.x??0,r=n?.center?.y??0;return{x:o+Math.sin(t)*e,y:r-Math.cos(t)*e}}function vn(t,e,n){return(Math.atan2(t-(n?.center?.x??0),-(e-(n?.center?.y??0)))+wn)%wn}function kn(t,e){const[n,o]=t,r=o-n||1,i=e?.startAngle??0,a=e?.endAngle??wn;return t=>i+(t-n)/r*(a-i)}function $n(t,e){const[n,o]=t,[r,i]=e,a=o-n||1;return t=>r+(t-n)/a*(i-r)}function An(t,e,n,o,r){const i=r?.center,a=(t,e)=>{const{x:n,y:o}=Mn(t,e,{center:i});return`${Sn(n)},${Sn(o)}`},s=Math.max(0,n),c=Math.max(s,o),l=Math.abs(e-t),u=t>e?0:1;if(l>=wn-1e-6){const t=i?.x??0,e=i?.y??0,n=`${Sn(t)},${Sn(e-c)}`,o=`${Sn(t)},${Sn(e+c)}`;let r=`M${n} A${Sn(c)},${Sn(c)} 0 1 1 ${o} A${Sn(c)},${Sn(c)} 0 1 1 ${n} Z`;if(s>0){const n=`${Sn(t)},${Sn(e-s)}`,o=`${Sn(t)},${Sn(e+s)}`;r+=` M${n} A${Sn(s)},${Sn(s)} 0 1 0 ${o} A${Sn(s)},${Sn(s)} 0 1 0 ${n} Z`}return r}const h=l>Math.PI?1:0,d=a(t,c),f=a(e,c);if(0>=s){const t=i?.x??0,e=i?.y??0;return`M${Sn(t)},${Sn(e)} L${d} A${Sn(c)},${Sn(c)} 0 ${h} ${u} ${f} Z`}const m=a(e,s),p=a(t,s);return`M${d} A${Sn(c)},${Sn(c)} 0 ${h} ${u} ${f} L${m} A${Sn(s)},${Sn(s)} 0 ${h} ${1===u?0:1} ${p} Z`}function Sn(t){return Math.round(1e3*t)/1e3}function Cn(t,e){return{x:t.x+e.x,y:t.y+e.y}}function zn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function In(t,e){return{x:t.x*e,y:t.y*e}}function Nn(t){return Math.hypot(t.x,t.y)}function Ln(t){const e=Nn(t)||1;return{x:t.x/e,y:t.y/e}}import{jsx as Wn,jsxs as Fn}from"react/jsx-runtime";var Tn="var(--semiotic-text, currentColor)";function En(t,e){const n=$(t,100);return n>0?e/n*100*(e/n):Math.PI*e*e}function Rn(t){const e=[],n=t.colorMap?Object.entries(t.colorMap):t.keys?t.keys.map(e=>[e,t.color?t.color(e):void 0]):[];if(n.length>0){const o=t.colorType??"fill",r=n.map(([t,e])=>({label:t,color:e}));e.push({type:o,label:t.colorLabel??"",items:r,styleFn:"line"===o?t=>({stroke:t.color??Tn,strokeWidth:2,fill:"none"}):t=>({fill:t.color??Tn,stroke:t.color??Tn})})}if(t.symbolMap&&Object.keys(t.symbolMap).length>0){const n=t.symbolColor??Tn,o=Object.entries(t.symbolMap).map(([t,e])=>({label:t,shape:e,color:n}));e.push({label:t.symbolLabel??"",items:o,styleFn:()=>({}),type:t=>{const e=t.shape;return Wn("path",{d:A(e,En(e,7)),transform:"translate(8,8)",fill:t.color??n})}})}if(t.sizeStops&&t.sizeStops.length>0&&t.sizeRadius){const n=t.sizeRadius,o=t.sizeFormat??(t=>t+""),r=t.sizeColor??Tn,i=t.sizeStops.map(t=>({label:o(t),r:Math.max(.5,n(t)),color:r}));e.push({label:t.sizeLabel??"",items:i,styleFn:()=>({}),type:t=>Wn("circle",{cx:8,cy:8,r:t.r,fill:t.color??r})})}return e}function Pn(t){const e=t.orientation??"vertical",n=t.swatchSize??14,o=t.gap??8,r=t.labelGap??6,i=t.fontSize??12,a=t.color??"var(--semiotic-text-secondary, #888)",s=n+o;let c=0;const l=[];return t.entries.forEach((t,u)=>{l.push(Fn("g",{transform:`translate(${"vertical"===e?0:c},${"vertical"===e?c:0})`,children:[On(t,n,t.color??t.line??a,a),Wn("text",{x:n+r,y:n/2,dominantBaseline:"middle",fontSize:i,fill:a,children:t.label})]},"legend-"+u)),c+="vertical"===e?s:n+r+t.label.length*i*.58+o+8}),Wn("g",{className:t.className,transform:`translate(${t.x},${t.y})`,style:{pointerEvents:"none"},children:l},t.keyId)}function On(t,e,n,o){if(t.shape){const o=En(t.shape,e/2-1);return Wn("path",{d:A(t.shape,o),transform:`translate(${e/2},${e/2})`,fill:n})}if(t.hatch){const n=t.color??o;return Fn("g",{children:[Wn("svg",{width:e,height:e,style:{overflow:"hidden"},children:[-e,-e/2,0,e/2].map((t,o)=>Wn("line",{x1:t,y1:e,x2:t+e,y2:0,stroke:n,strokeWidth:1,opacity:.7},o))}),Wn("rect",{width:e,height:e,fill:"none",stroke:n,strokeWidth:1,opacity:.5,rx:2})]})}return Wn("rect",t.line?{y:e/2-1.5,width:e,height:3,rx:1.5,fill:t.line}:{width:e,height:e,rx:2,fill:n})}var Dn=new Set(["rows"]);function jn(t){const e=t,n=[Vn(e,["datum","data"]),Vn(e,["datum"]),Vn(e,["data","data"]),Vn(e,["data"]),Vn(e,["node","datum","data"]),Vn(e,["node","datum"]),t];for(const t of n){if(!Xn(t))continue;const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||"function"==typeof o||(e[n]=o);if(Object.keys(e).length>0)return e}return null}function Bn(t,e={}){const n=jn(t);if(!n)return[];const o=new Set(Dn);if(e.excludeKeys)for(const t of e.excludeKeys)o.add(t);const r=[];for(const[t,i]of Object.entries(n))if((e.includeInternal||!t.startsWith("_"))&&!o.has(t)&&(e.includeEmpty||null!=i&&""!==i)&&"function"!=typeof i&&(r.push({key:t,label:Yn(t,e.labels),value:i,formatted:e.valueFormat?e.valueFormat(i,t,n):Hn(i)}),r.length>=(e.maxEntries??8)))break;return r}function Hn(t){if(null==t)return"";if(t instanceof Date)return t.toISOString();if("number"==typeof t)return Number.isInteger(t)?t+"":t.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof t)return t?"true":"false";if(Array.isArray(t))return t.length+" items";if("object"==typeof t)try{return JSON.stringify(t)}catch{return t+""}return t+""}function Yn(t,e){return"function"==typeof e?e(t):e&&e[t]?e[t]:t}function Vn(t,e){let n=t;for(const t of e){if(!Xn(n))return;n=n[t]}return n}function Xn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function qn(t,e){const n=new Map;for(const e of t)n.set(e.id,new Set);for(const t of e)n.has(t.source)||n.set(t.source,new Set),n.has(t.target)||n.set(t.target,new Set),n.get(t.source).add(t.target),n.get(t.target).add(t.source);return n}function Gn(t,e){const n={};for(const e of t)n[e.id]=0;for(const t of e)n[t.source]=(n[t.source]||0)+1,n[t.target]=(n[t.target]||0)+1;return n}function Kn(t,e){const n={[e]:0},o=[e];let r=0;for(;o.length>r;){const e=o[r];r+=1;for(const r of t.get(e)||[])void 0===n[r]&&(n[r]=n[e]+1,o.push(r))}return n}function _n(t,e,n,o){if(n===o)return n?[n]:[];const r=qn(t,e),i={[n]:null},a=[n];let s=0;for(;a.length>s;){const t=a[s];if(s+=1,t===o)break;for(const e of r.get(t)||[])void 0===i[e]&&(i[e]=t,a.push(e))}if(void 0===i[o])return[];const c=[];let l=o;for(;null!=l;)c.unshift(l),l=i[l];return c}function Un(t,e,n,o=1){const r=qn(t,e);if(!r.has(n))return new Set;const i=Kn(r,n),a=new Set;for(const t in i)i[t]>o||a.add(t);return a}function Zn(t,e){const n=qn(t,e),o={};for(const e of t)o[e.id]=0;for(const e of t.map(t=>t.id)){const r=[],i={},a={},s={};for(const e of t)i[e.id]=[],a[e.id]=0,s[e.id]=-1;a[e]=1,s[e]=0;const c=[e];let l=0;for(;c.length>l;){const t=c[l];l+=1,r.push(t);for(const e of n.get(t)||[])0>s[e]&&(s[e]=s[t]+1,c.push(e)),s[e]===s[t]+1&&(a[e]+=a[t],i[e].push(t))}const u={};for(const e of t)u[e.id]=0;for(;r.length;){const t=r.pop();for(const e of i[t])u[e]+=a[e]/a[t]*(1+u[t]);t!==e&&(o[t]+=u[t])}}for(const t in o)o[t]/=2;return o}function Qn(t,e){const n=qn(t,e),o={};for(const e of t){const t=Kn(n,e.id);let r=0,i=0;for(const e in t)r+=t[e],i+=1;o[e.id]=r>0?(i-1)/r:0}return o}function Jn(t,e){const n=qn(t,e),o={};for(const e of t){const t=[...n.get(e.id)||[]],r=t.length;if(2>r){o[e.id]=0;continue}let i=0;for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1)n.get(t[e])?.has(t[o])&&(i+=1);o[e.id]=2*i/(r*(r-1))}return o}function to(t){let e=0;for(const n in t)t[n]>e&&(e=t[n]);const n={};for(const o in t)n[o]=e>0?t[o]/e:0;return n}function eo(t,e,n,o={}){const r=qn(t,e),i={};for(const e of t)i[e.id]=Kn(r,e.id);let a=o.minHops??4,s=o.startThreshold??.08;const c=o.maxThreshold??.2,l=new Set;let u=0;for(;0===l.size&&40>u;){for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1){const r=t[e].id,c=t[o].id,u=n[r],h=n[c];if(!u||!h)continue;const d=u.x-h.x,f=u.y-h.y;(void 0===i[r][c]?1/0:i[r][c])>=a&&s>Math.sqrt(d*d+f*f)&&(l.add(r),l.add(c))}0===l.size&&(s+=.02,s>c&&(s=o.startThreshold??.08,a=Math.max(2,a-1))),u+=1}return{problemIds:l,threshold:s,minHops:a}}async function no(t,e,n={}){const{execution:o="auto",signal:i,workerThreshold:a,nodeRadius:s,...c}=n,l=c.iterations??260;if(!p()||!g(o,t.length,e.length,l,a))return r(t,e,{...c,nodeRadius:s});const u={kind:"normalized",nodes:t.map(t=>({...t})),edges:e.map(t=>({...t})),options:c,nodeRadii:"function"==typeof s?Object.fromEntries(t.map(t=>[t.id,s(t)])):null==s?void 0:Object.fromEntries(t.map(t=>[t.id,s]))};try{return(await y(u,i)).positions}catch(n){if("AbortError"===n?.name)throw n;return r(t,e,{...c,nodeRadius:s})}}var oo=[.1,.5,.9],ro=1e6;function io(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function ao(t,e,n,o,r){return"function"==typeof o?o(t,e,n):function(t,e){let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}(t,o??r)}function so(t){const e=Number(t.toFixed(12));return Object.is(e,-0)?0:e}function co(t,e,n,o){const r=t.flatMap((t,r)=>{const i=io(ao(t,r,e,n,"time")),a=io(ao(t,r,e,o,"value"));return null==i||null==a?[]:[{time:so(i),value:a,index:r}]});r.sort((t,e)=>t.time-e.time||t.index-e.index);const i=[];for(const t of r){const e=i[i.length-1];e?.time===t.time?e.value=t.value:i.push({time:t.time,value:t.value})}return i}function lo(t,e,n,o){if(!t.length)return null;const r=t[0],i=t[t.length-1];if(r.time>e)return"clamp"===o?r.value:null;if(e>i.time)return"clamp"===o?i.value:null;const a=function(t,e){let n=0,o=t.length;for(;o>n;){const r=n+o>>>1;e>t[r].time?n=r+1:o=r}return n}(t,e),s=t[a];if(s?.time===e)return s.value;const c=t[Math.max(0,a-1)];return"step"!==n&&s&&s.time!==c.time?c.value+(e-c.time)/(s.time-c.time)*(s.value-c.value):c.value}function uo(t,e){if(1===t.length)return t[0];const n=(t.length-1)*e,o=Math.floor(n),r=Math.ceil(n);return o===r?t[o]:t[o]+(t[r]-t[o])*(n-o)}function ho(t){const e=t.interpolation??"step",n=t.outsideDomain??"omit",o=function(t){const e=(t??oo).map(t=>{const e=io(t);if(null==e||0>e||e>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+t);return so(e)});return Array.from(new Set(e)).sort((t,e)=>t-e)}(t.quantiles),r=function(t){if(Array.isArray(t)){if(t.length>ro)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(t.map(io).filter(t=>null!=t).map(so))).sort((t,e)=>t-e)}const e=t,n=io(e.start),o=io(e.end),r=io(e.step);if(null==n||null==o||null==r||0>=r||n>o)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const i=Math.floor((o-n)/r)+1;if(i>ro)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const a=[],s=1e-10*Math.max(1,Math.abs(o),Math.abs(n));for(let t=0;i>t;t+=1){const e=n+t*r;if(e>o+s)break;a.push(so(Math.min(e,o)))}if(a.length&&s>=Math.abs(a[a.length-1]-o)||a.push(so(o)),a.length>ro)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(a)).sort((t,e)=>t-e)}(t.sampleAt),i=t.runs.map(e=>co(e.samples,e.id,t.timeAccessor,t.valueAccessor));return{points:r.map(t=>{const r=i.map(o=>lo(o,t,e,n)).filter(t=>null!=t).sort((t,e)=>t-e),a={};for(const t of o)a[t]=r.length?uo(r,t):null;return{time:t,count:r.length,min:r.length?r[0]:null,max:r.length?r[r.length-1]:null,median:r.length?uo(r,.5):null,quantiles:a}}),quantiles:o,interpolation:e,outsideDomain:n,runCount:t.runs.length}}function fo(t,e){return t.quantiles.length?"lower"===e?t.quantiles[0]:t.quantiles[t.quantiles.length-1]:"lower"===e?"min":"max"}function mo(t,e){if("min"===e||"median"===e||"max"===e)return t[e];const n=io(e);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+e);const o=so(n);if(!Object.prototype.hasOwnProperty.call(t.quantiles,o))throw Error(`comparePhysicsTrace could not find quantile ${o} in the reference envelope`);return t.quantiles[o]??null}function po(t,e,n){return e>t?"below":t>n?"above":"inside"}function yo(t,e){const n=Math.max(0,e.time-t.time);if(0>=n||null==t.value||null==t.lower||null==t.upper||null==e.value||null==e.lower||null==e.upper)return{below:0,inside:0,above:0,observed:0};const o=t.value-t.lower,r=e.value-e.lower,i=t.value-t.upper,a=e.value-e.upper,s=[0,1];for(const[t,e]of[[o,r],[i,a]])(0>t&&e>0||t>0&&0>e)&&s.push(-t/(e-t));s.sort((t,e)=>t-e);let c=0,l=0,u=0;for(let o=0;s.length-1>o;o+=1){const r=s[o],i=s[o+1];if(r>=i)continue;const a=(r+i)/2,h=(i-r)*n,d=po(t.value+(e.value-t.value)*a,t.lower+(e.lower-t.lower)*a,t.upper+(e.upper-t.upper)*a);"below"===d?c+=h:"above"===d?u+=h:l+=h}return{below:c,inside:l,above:u,observed:n}}function go(t,e,n={}){const o=n.interpolation??e.interpolation,r=n.outsideDomain??e.outsideDomain,i=co(t,n.traceId??"trace",n.timeAccessor,n.valueAccessor),a=n.lower??fo(e,"lower"),s=n.upper??fo(e,"upper"),c=e.points.map(t=>{const e=lo(i,t.time,o,r),n=mo(t,a),c=mo(t,s);if(null!=n&&null!=c&&n>c)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+t.time);return{time:t.time,value:e,lower:n,upper:c,status:null==e||null==n||null==c?"unobserved":po(e,n,c)}});let l=0,u=0,h=0,d=0,f=null,m=0,p=null;for(const t of c){if("below"===t.status?l+=1:"inside"===t.status?u+=1:"above"===t.status&&(h+=1),null==t.value||null==t.lower||null==t.upper)continue;const e=Math.max(0,t.value-t.upper),n=Math.max(0,t.lower-t.value);e>d&&(d=e,f=t.time),n>m&&(m=n,p=t.time)}let y=0,g=0,x=0,b=0;for(let t=0;c.length-1>t;t+=1){const e=c[t],n=c[t+1],r=Math.max(0,n.time-e.time);if(r>0){if("linear"===o){const t=yo(e,n);y+=t.below,g+=t.inside,x+=t.above,b+=t.observed;continue}"unobserved"!==e.status&&(b+=r,"below"===e.status?y+=r:"above"===e.status?x+=r:g+=r)}}const w=c[0]?.time,M=c[c.length-1]?.time,v=null==w||null==M?0:Math.max(0,M-w);return{points:c,sampleCount:c.length,observedSamples:l+u+h,belowSamples:l,insideSamples:u,aboveSamples:h,totalDuration:v,observedDuration:b,unobservedDuration:Math.max(0,v-b),belowDuration:y,insideDuration:g,aboveDuration:x,peakExcess:d,peakExcessAt:f,peakDeficit:m,peakDeficitAt:p}}function xo(t){return{id:t,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function bo(t){const e=Array.from(new Set(t.bodyIds??[]));return{stages:t.stages.map(t=>({...t})),bodyIds:e,entities:Object.fromEntries(e.map(t=>[t,xo(t)]))}}function wo(t,e,n={}){if("region-enter"!==e.type)return t;const o=function(t,e){const n=e.stageId?.(t);if(n)return n;const o=t.region.metadata;if(o&&"object"==typeof o){const t=o.stageId;if("string"==typeof t)return t}return t.region.id}(e,n),r=t.stages.findIndex(t=>t.id===o);if(0>r)return t;const i=n.entityId?.(e)??e.bodyId;if(!i)return t;const a=t.entities[i]??xo(i),s=a.currentStageId?t.stages.findIndex(t=>t.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(o),l=Number(e.observation.timestamp),u=Number.isFinite(l)?l:0,h={...a,currentStageId:o,furthestStageId:r>a.furthestStageIndex?o:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,r),visitedStageIds:c?[...a.visitedStageIds,o]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[o]:(a.visitsByStage[o]??0)+1},firstEnteredAt:c?{...a.firstEnteredAt,[o]:u}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[o]:u},regressionCount:s>=0&&s>r?a.regressionCount+1:a.regressionCount};return{...t,bodyIds:t.bodyIds.includes(i)?t.bodyIds:[...t.bodyIds,i],entities:{...t.entities,[i]:h}}}function Mo(t){const e=t.bodyIds.map(e=>t.entities[e]??xo(e)),n=e.length;let o=n;return t.stages.map((t,r)=>{const i=e.filter(t=>t.furthestStageIndex>=r).length,a=e.filter(e=>e.visitedStageIds.includes(t.id)).length,s=e.reduce((e,n)=>e+(n.visitsByStage[t.id]??0),0),c={id:t.id,label:t.label??t.id,reached:i,entered:a,total:n,conversion:n>0?i/n:0,fromPrevious:o>0?i/o:0,dropoff:Math.max(0,o-i),visits:s,repeatVisits:Math.max(0,s-a)};return o=i,c})}import{Fragment as vo,jsx as ko,jsxs as $o}from"react/jsx-runtime";var Ao={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}};function So(t,e,n){return Math.max(e,Math.min(n,t))}function Co(t){return 6.2*t.length}function zo(t,e){const n=t.trim();if(e>=n.length)return n;if(1>=e)return n.slice(0,1);const o=n.split(/\s+/).filter(Boolean).map(t=>t[0]).join("").toUpperCase();return o.length>1&&e>=o.length?o:e>3?n.slice(0,Math.max(1,e-2))+"..":n.slice(0,e).toUpperCase()}function Io(t,e,n="auto"){const o=Math.max(1,Math.floor(e/6.2)),r="compact"===n?zo(t,o):"full"===n?t:Co(t)>e?zo(t,o):t;return{text:r,textLength:Co(r)>e?Math.max(4,e):void 0}}function No(t,e={}){const{showFlowSpine:n=!0,showStageCounts:o=!0,showCapacityBadges:r=!0,showGroupSockets:i=!0,stageLabelMode:a="auto",outlineStages:s=!1,testId:c="process-flow-chrome"}=e,{width:l,height:u,left:h,right:d,topY:f,bottomY:m,midY:p,stages:y,groups:g=[]}=t,x=m-f;return $o("svg",{"aria-hidden":"true","data-testid":c,"data-outline-stages":s?"true":void 0,width:l,height:u,viewBox:`0 0 ${l} ${u}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",s?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[ko("defs",{children:$o("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[ko("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),ko("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),ko("rect",{x:0,y:0,width:l,height:u,fill:"url(#semiotic-process-floor)"}),ko("rect",{x:h-6,y:f-8,width:d-h+12,height:x+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),n?ko("line",{x1:h+8,x2:d-8,y1:p,y2:p,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,y.map((t,e)=>{const n=function(t){return t.absorb?"absorb":t.portalTarget?"portal":null!=t.capacity?"capacity":"flow"}(t),i=Ao[n],c=Math.max(12,t.width-8),l=So(c-8,22,88),h=Io(t.label,Math.max(8,l-10),a),d="none"!==a&&c-8>=22,g=function(t){if(null!=t.capacity){const e=null!=t.queueDepth?" · q "+t.queueDepth:"";return t.capacityLabel?`${t.capacityLabel}${e}`:`cap ${Number.isInteger(t.capacity)?t.capacity+"":t.capacity.toFixed(1)}${e}`}return t.absorb?"absorb":t.portalTarget?"portal":"flow"}(t),b=Io(g,Math.max(16,c-10),"auto"),w=r&&!1!==t.showBadge&&c>=32,M=null!=t.count?`n=${t.count}${null!=t.processed?" done "+t.processed:""}`:"",v=Io(M,Math.max(16,c-8),"auto"),k=Math.max(30,f-15),$=k-13;return $o("g",{"data-stage":t.id,"data-role":n,children:[ko("rect",{className:"semiotic-process-chrome__stage-bay",x:t.x0+4,y:f+6,width:c,height:x-12,rx:10,fill:s?"none":i.fill,stroke:i.stroke,strokeWidth:s?1.85:"flow"===n?1:1.6}),y.length-1>e?ko("polygon",{points:`${t.x1-2},${p-7} ${t.x1+8},${p} ${t.x1-2},${p+7}`,fill:i.accent,opacity:.85}):null,d?$o(vo,{children:[ko("rect",{className:"semiotic-process-chrome__stage-label-bg",x:t.x-l/2,y:$,width:l,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:i.stroke}),$o("text",{x:t.x,y:k,textAnchor:"middle",fill:i.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:h.textLength,lengthAdjust:h.textLength?"spacingAndGlyphs":void 0,children:[ko("title",{children:t.label}),h.text]})]}):null,w?$o("text",{x:t.x,y:f+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:b.textLength,lengthAdjust:b.textLength?"spacingAndGlyphs":void 0,children:[ko("title",{children:g}),b.text]}):null,o&&null!=t.count?$o("text",{x:t.x,y:Math.min(u-8,m+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:v.textLength,lengthAdjust:v.textLength?"spacingAndGlyphs":void 0,children:[ko("title",{children:M}),v.text]}):null]},t.id)}),i?g.map((t,e)=>{const n=t.total??0,o=t.absorbed??0,r=t.complete??(n>0&&o>=n),i=!r&&n>0&&o/n>=.75,a=r?"rgba(52, 211, 153, 0.35)":i?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",s=r?"#34d399":i?"#fbbf24":"var(--semiotic-border, #64748b)",c=n>0?`${o}/${n}${r?" shipped":i?" almost":""}`:"feature "+(e+1),l=So(Math.max(54,Co(t.label)+18,Co(c)+16),54,104),u=Io(t.label,l-12,"auto"),h=Io(c,l-12,"auto");return $o("g",{"data-group":t.id,children:[ko("rect",{x:t.x-l/2,y:t.y-22,width:l,height:44,rx:10,fill:a,stroke:s,strokeWidth:1.5}),$o("text",{x:t.x,y:t.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[ko("title",{children:t.label}),u.text]}),$o("text",{x:t.x,y:t.y+12,textAnchor:"middle",fill:s,fontSize:9,fontWeight:700,textLength:h.textLength,lengthAdjust:h.textLength?"spacingAndGlyphs":void 0,children:[ko("title",{children:c}),h.text]})]},t.id)}):null]})}function Lo(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function Wo(t,e,n,o){const r="function"==typeof t?t(e,n):t;return Number.isFinite(r)?Number(r):o}function Fo(t,e,n){return Lo(t[e])??n}function To(t,e){return"number"==typeof t?t:t?.[e]??0}function Eo(t){const{band:e,idPrefix:n,plot:o,projection:r}=t,{includeBoundaryWalls:i=!0,includeInteriorWalls:a=!0,wallThickness:s=4}=e,c=function(t){const e=t.bandwidth??t.scale.bandwidth?.()??0,n=new Set;for(const o of t.values){const r=t.scale(o);Number.isFinite(r)&&(n.add(Number(r)),n.add(Number(r)+e))}return Array.from(n).sort((t,e)=>t-e)}(e);if(2>c.length)return[];const l=i?c.length-1:c.length-2,u=[];for(let t=i?0:1;l>=t;t+=1){if(!a&&t>0&&c.length-1>t)continue;const e=c[t];u.push({id:`${n}-wall-${t}`,shape:"x"===r?{type:"aabb",x:e,y:o.y+o.height/2,width:s,height:o.height}:{type:"aabb",x:o.x+o.width/2,y:e,width:o.width,height:s}})}return u}function Ro(t){const{plot:e,idPrefix:n="physics-scale",bounds:o={},xBins:r,xBands:i,yBands:a}=t,s=[];if(!1!==o&&s.push(...x(e,{idPrefix:n,...o})),r){const{idPrefix:t,yTop:o,yBottom:i,...a}=r;s.push(...b({...a,idPrefix:t??n+"-xbin",yTop:o??e.y,yBottom:i??e.y+e.height}))}return i&&s.push(...Eo({band:i,idPrefix:i.idPrefix??n+"-xband",plot:e,projection:"x"})),a&&s.push(...Eo({band:a,idPrefix:a.idPrefix??n+"-yband",plot:e,projection:"y"})),s}function Po(t){const{plot:e,rows:n,columns:o=n+1,pegRadius:r=3,idPrefix:i="galton-peg",yStart:a=e.y+.18*e.height,yEnd:s=e.y+.58*e.height,stagger:c=!0,restitution:l=.2,friction:u=.04}=t,h=Math.max(0,Math.floor(n)),d=Math.max(1,Math.floor(o));if(0===h)return[];const f=h>1?(s-a)/(h-1):0,m=e.width/d,p=[];for(let t=0;h>t;t+=1){const n=c&&t%2==1?m/2:0;for(let o=0;d>o;o+=1){const s=e.x+m*(o+.5)+n;e.x+r>s||s>e.x+e.width-r||p.push({id:`${i}-${t}-${o}`,shape:{type:"aabb",x:s,y:a+t*f,width:2*r,height:2*r},restitution:l,friction:u})}}return p}function Oo(t,e={}){const{idPrefix:n="physics-token",radius:o=5,shape:r,mass:i,vx:a,vy:s,spawnAt:c,seed:l=1,jitter:u,datum:h}=e,d=M(l),f=To(u,"x"),m=To(u,"y");return t.map((t,l)=>{const u=Wo(e.x,t,l,Fo(t,"x",0)),p=Wo(e.y,t,l,Fo(t,"y",0)),y=Wo(o,t,l,5),g="function"==typeof r?r(t,l):r??{type:"circle",radius:y};return{id:`${n}-${t.index??l}`,x:u+(d()-.5)*f,y:p+(d()-.5)*m,vx:Wo(a,t,l,0),vy:Wo(s,t,l,0),mass:Wo(i,t,l,1),spawnAt:Wo(c,t,l,void 0),shape:g,datum:h?h(t,l):t.datum??t}}).map(t=>{if(Number.isFinite(t.spawnAt))return t;const{spawnAt:e,...n}=t;return n})}function Do(t,e={}){const{idPrefix:n="sediment",collider:o=!0,colliderThickness:r=1,restitution:i=.05,friction:a=.2,...s}=e,c=w(t,s),l=o?c.filter(t=>t.height>0).map(t=>({id:`${n}-${t.binId}`,shape:{type:"aabb",x:t.x+t.width/2,y:t.y+r/2,width:t.width,height:r},restitution:i,friction:a})):[];return{columns:c,colliders:l}}function jo(t,e={}){const{timeAccessor:n="arrivalTime",timeScale:o=1,startAt:r=0,rebase:i=!0,sort:a=!0}=e,s=t.map((t,e)=>({spawn:t,time:function(t,e,n){return Lo("function"==typeof n?n(t,e):t[n]??t.datum?.[n])}(t,e,n)??t.spawnAt??e})),c=s.length?Math.min(...s.map(t=>t.time)):0;return{initialSpawns:s.map(({spawn:t,time:e})=>({...t,spawnAt:r+(i?e-c:e)})).sort((t,e)=>a?(t.spawnAt??0)-(e.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:r,timeAccessor:"spawnAt",timeScale:o}}}function Bo(t,e,n="group"){const o=Gn(t,e),r=t=>"function"==typeof n?n(t):t[n]??0;return t.slice().sort((t,e)=>{const n=r(t),i=r(e);return i>n?-1:n>i?1:(o[e.id]||0)-(o[t.id]||0)}).map(t=>t.id)}function Ho(t,e={}){const n=e.baseline??.62,o=e.inset??.06,r={},i=t.length;return t.forEach((t,e)=>{r[t]={x:i>1?o+e/(i-1)*(1-2*o):.5,y:n}}),r}function Yo(t,e,n=.55){return`M${t.x},${t.y} Q${(t.x+e.x)/2},${t.y-Math.abs(e.x-t.x)*n} ${e.x},${e.y}`}function Vo(t,e={}){const n=e.radius??.42,o=e.center?.x??.5,r=e.center?.y??.5,i=e.startAngle??0,a={},s=t.length;return t.forEach((t,e)=>{const c=i+e/s*Math.PI*2-Math.PI/2;a[t]={x:o+Math.cos(c)*n,y:r+Math.sin(c)*n}}),a}function Xo(t,e,n={}){const o=(n.order??Bo(t,e,n.groupAccessor??"group")).slice(),r=new Map(o.map((t,e)=>[t,e])),i=new Map;for(const t of e){if(!r.has(t.source)||!r.has(t.target)||t.source===t.target)continue;const e=t.target>t.source?`${t.source}\0${t.target}`:`${t.target}\0${t.source}`;i.set(e,(i.get(e)||0)+(t.value??1))}const a=[];let s=0;for(const[t,e]of i){const[n,o]=t.split("\0"),i=r.get(n),c=r.get(o);e>s&&(s=e),a.push({row:i,col:c,source:n,target:o,value:e}),a.push({row:c,col:i,source:o,target:n,value:e})}return{order:o,cells:a,size:o.length,maxValue:s}}function qo(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function Go(t){if("string"!=typeof t)return;const e=t.trim();return e.length?e:void 0}function Ko(t,e){const n=qo(t.note)?t.note:void 0;return e?Go(t.mobileText)||Go(t.shortText)||Go(t.label)||Go(n?.mobileText)||Go(n?.shortText)||Go(n?.label)||Go(n?.title):Go(t.label)||Go(t.mobileText)||Go(t.shortText)||Go(n?.label)||Go(n?.title)}function _o(t,e,n){const o=function(t,e,n){if(!n)return;const o="function"==typeof n?n(t,e):t[n];return"number"==typeof o&&Number.isFinite(o)?o:void 0}(t,e,n.priorityAccessor);if(void 0!==o)return o;let r=1e3-e;const i=((t.emphasis??"")+"").toLowerCase();"primary"!==i&&"critical"!==i||(r+=1e4),"secondary"===i&&(r-=1e3),"high"===t.priority&&(r+=5e3),"low"===t.priority&&(r-=1500),"number"==typeof t.priority&&(r+=100*t.priority);const a=qo(t.provenance)?t.provenance:void 0;"number"==typeof a?.confidence&&(r+=100*a.confidence);const s=qo(t.lifecycle)?t.lifecycle:void 0,c=((s?.freshness??"")+"").toLowerCase();return"expired"!==c&&"stale"!==c||(r-=3e3),r}function Uo(t,e){if(!e)return t;const n=Ko(t,!0);return n&&"string"==typeof t.label?{...t,label:n}:t}function Zo(t,e={}){const n=Array.isArray(t)?t.filter(qo):[],o=e.active??(null==e.width||(e.breakpoint??480)>=e.width),r=e.strategy??"hybrid",i=!1!==e.preferShortText,a=!1!==e.preservePrimary,s=Math.max(0,e.maxPlotAnnotations??e.maxAnnotations??("callout-list"===r?1:2)),c=Math.max(0,e.minPlotAnnotations??e.minVisible??1);if(!o||"plot"===r)return{active:o,strategy:r,budget:n.length,visible:i?n.map(t=>Uo(t,i)):n,deferred:[],calloutList:[],hidden:[]};const l=[],u=n.map((t,n)=>({annotation:t,index:n,priority:_o(t,n,e)})).filter(t=>!!S(t.annotation)||(l.push(t.annotation),!1)).sort((t,e)=>e.priority-t.priority),h=a?u.filter(t=>"primary"===((t.annotation.emphasis??"")+"").toLowerCase()):[],d=new Set(h.map(t=>t.index)),f=u.filter(t=>!d.has(t.index)),m=[...h,...f].slice(0,Math.max(s,c)),p=new Set(m.map(t=>t.index)),y=u.filter(t=>!p.has(t.index)),g=[...l,...m.sort((t,e)=>t.index-e.index).map(t=>Uo(t.annotation,i))],x=y.sort((t,e)=>t.index-e.index).map(t=>t.annotation),b=Math.max(0,e.maxCalloutItems??6),w=y.filter(t=>!e.calloutFilter||e.calloutFilter(t.annotation,t.index)).map(t=>function(t,e,n,o){const r=Ko(t,o);if(!r)return null;const i=Go(t.id)||Go(t.key)||Go(t.pointId)||"annotation-"+(e+1),a=qo(t.provenance)?Go(t.provenance.source)||Go(t.provenance.authorKind):void 0;return{id:i,label:r,shortLabel:Go(t.shortText),pointId:t.pointId,emphasis:"string"==typeof t.emphasis?t.emphasis:void 0,source:a,priority:n,annotation:t}}(t.annotation,t.index,t.priority,i)).filter(t=>!!t).slice(0,b),M=new Set(w.map(t=>t.annotation)),v=x.filter(t=>!M.has(t));return{active:o,strategy:r,budget:s,visible:g,deferred:x,calloutList:w,hidden:v}}function Qo(t){return"dense"===t.density?.75:"compact"===t.density?.9:1}function Jo(t,e){const n=!1!==e.keepAxes,o=!1===e.directLabel?12:28;return"ordinal"===t?{top:12,right:o,bottom:n?44:12,left:n?48:12}:"geo"===t||"network"===t?{top:12,right:12,bottom:12,left:12}:{top:12,right:o,bottom:n?42:14,left:n?44:14}}function tr(t,e,n,o={}){const r={...n},i={mode:!1===e.mode?void 0:"mobile",...r,margin:Jo(t,e),...o},a=Object.fromEntries(Object.entries(r).filter(([,t])=>void 0!==t)),s=Object.fromEntries(Object.entries(i).filter(([,t])=>void 0!==t)),c=function(t,e){const n=e.targetSize??44,o=[],r=e.standardControls,i=t=>!0===r||"all"===r||r===t||Array.isArray(r)&&r.includes(t);return i("brush")&&o.push("range-inputs","clear-brush"),i("zoom")&&o.push("zoom-buttons","reset-view"),i("legend")&&o.push("legend-chips","show-all-series"),{strategy:`${t}-${e.transformProfile??"overview"}-mobile-recipe`,supportsResponsiveLayout:!0,breakpoints:[320,360,390,430,e.breakpoint??480,768],maxAnnotations:e.maxAnnotations??2,minimumHitTarget:n,summary:e.summary??!0,interaction:{primary:"tap",hoverFallback:"tap-to-lock",targetSize:n,...o.length>0&&{alternatives:o}},labels:{strategy:!1===e.directLabel?"compact":"direct",minFontSize:12}}}(t,e),l=function(t){return{tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:t.targetSize??44,snap:t.snap??"nearestDatum",brushHandleSize:t.targetSize??44,standardControls:t.standardControls??!1}}(e);return{family:t,props:a,responsiveRules:[{id:t+"-mobile",description:`Apply Semiotic's mobile ${t} recipe at phone width.`,when:{maxWidth:e.breakpoint??480},transform:{...s,mobileInteraction:l,mobileSemantics:c}}],mobileInteraction:l,mobileSemantics:c}}function er(t={}){const e=Qo(t);return tr("line",t,{showLegend:t.showLegend??!1,directLabel:t.directLabel??!0,lineWidth:"inspect"===t.transformProfile?3:Math.max(1.5,2.5*e),showPoints:"inspect"===t.transformProfile,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function nr(t={}){const e=Qo(t);return tr("area",t,{showLegend:t.showLegend??!1,showPoints:!1,areaOpacity:"compare"===t.transformProfile?.55:.42,lineWidth:Math.max(1.25,2*e),autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function or(t={}){return tr("ordinal",t,{showLegend:t.showLegend??!1,showCategoryTicks:t.keepAxes??!0,sort:"compare"===t.transformProfile?"desc":void 0},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function rr(t={}){const e=Qo(t);return tr("scatter",t,{showLegend:t.showLegend??!1,pointRadius:Math.max(4,Math.round((t.targetSize??44)/8*e)),hoverRadius:Math.ceil((t.targetSize??44)/2),pointOpacity:"dense"===t.density?.42:.68,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??1,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function ir(t={}){const e=Qo(t);return tr("network",t,{showLegend:t.showLegend??!1,nodeSizeRange:[Math.max(4,Math.round(6*e)),Math.max(12,Math.round((t.targetSize??44)/2*e))],showLabels:"inspect"===t.transformProfile,edgeOpacity:"dense"===t.density?.28:.44})}function ar(t={}){return tr("geo",t,{showLegend:t.showLegend??!1})}function sr(t={}){return tr("small-multiple",t,{mobileColumns:t.mobileColumns??1,tabletColumns:t.tabletColumns??2,chartHeight:t.chartHeight??180,sharedExtent:!0})}function cr(t,e={}){switch(t){case"line":return er(e);case"area":return nr(e);case"ordinal":return or(e);case"scatter":return rr(e);case"network":return ir(e);case"geo":return ar(e);case"small-multiple":return sr(e)}}function lr(t={}){const e=t.controls??["range-inputs","chip-filter","clear"];return{mobileInteraction:{enabled:!0,targetSize:t.targetSize??44,tapToSelect:!0,tapToLockTooltip:!0,standardControls:"brush"},mobileSemantics:{interaction:{primary:"filter",alternatives:e,summary:t.summary??"Expose brushable ranges through touch-sized controls in addition to drag gestures."}},controls:e}}export{C as waffleLayout,z as allocateCells,I as isotypeInk,N as isotypePaper,L as isotypeGhost,W as isotypeServerGlyph,F as isotypeChipGlyph,T as isotypeBoltGlyph,E as isotypeBusGlyph,R as isotypePersonPath,P as isotypePersonGlyph,O as isotypeNetworkGlyphs,_ as tokenLayer,Q as calendarLayout,ot as DEFAULT_ISOMETRIC_SPRITE_SIZES,dt as selectIsometricLandmarks,ft as isometricLandmarkLayout,bt as flextreeLayout,wt as dagreLayout,St as lineageDagLayout,Wt as mermaidDagLayout,Et as roundedEnclosure,Rt as boundsOf,Pt as hullFromBoxes,Ot as bandLabel,Dt as hatchFill,jt as linearAxis,Bt as markCallout,Gt as packedClusterMatrix,Zt as marimekkoLayout,te as bulletLayout,oe as parallelCoordinatesLayout,ye as bobaLayout,ge as GRID_FUEL_KEYS,xe as GRID_FUEL_LABELS,Me as stackFuelSeries,ve as demandForecastRows,ke as reserveMarginPct,$e as reserveSeries,Ae as thresholdBandsForReserve,Se as reserveAnnotationBands,Ce as summarizeOperatingPoint,ze as gridEventAnnotations,Ie as tightestHours,Ne as formatMw,Le as formatReservePct,Te as packIntervals,Ee as activeCountOverDomain,Pe as intervalLanesLayout,Oe as curvedEdgePath,De as orthogonalEdgePath,je as boxEdgeAnchors,Be as fanOutBend,He as cubicPoint,Ye as cubicTangent,Ve as cubicPath,Xe as rectCollide,Ke as axisFixedForcePositions,_e as axisFixedForceLayout,Ze as DEFAULT_HIT_RADIUS,Je as hitTargetPoint,tn as geoHitTarget,en as geoAreaHitTarget,nn as hitTargetRect,on as networkHitTarget,rn as runs,an as runLengthEncode,sn as wrapValue,cn as shortestArcDelta,ln as cyclicRangeContains,un as selectCyclicRange,hn as layoutSequence,dn as layoutChipStrip,fn as estimateLabelWidth,mn as packSpanLevels,pn as scaleArcBand,yn as spanArcPath,gn as spanArcPeakY,xn as partitionSharedEdges,wn as TAU,Mn as polarToXY,vn as xyToAngle,kn as angleScale,$n as radiusScale,An as ringArcPath,Cn as addPoints,zn as subtractPoints,In as scalePoint,Nn as pointMagnitude,Ln as normalizePoint,Rn as legendGroupsFrom,Pn as legendSwatches,jn as extractTooltipDatum,Bn as buildTooltipEntries,Hn as formatTooltipValue,qn as buildAdjacency,Gn as degree,Kn as bfsDistances,_n as shortestPath,Un as egoNetwork,Zn as betweenness,Qn as closeness,Jn as clustering,to as normalizeScores,eo as proximityProblem,no as forceLayoutAsync,ho as physicsReferenceEnvelope,go as comparePhysicsTrace,bo as createProcessJourneyLedger,wo as updateProcessJourney,Mo as processJourneyRows,No as processChrome,Ro as collidersFromScales,Po as galtonPegs,Oo as spawnFromTokens,Do as sedimentBake,jo as arrivalReplay,Bo as orderByGroupDegree,Ho as arcLayout,Yo as arcPath,Vo as circularLayout,Xo as adjacencyMatrix,Zo as mobileAnnotationStrategy,er as mobileLineChartRecipe,nr as mobileAreaChartRecipe,or as mobileOrdinalChartRecipe,rr as mobileScatterplotRecipe,ir as mobileNetworkChartRecipe,ar as mobileGeoChartRecipe,sr as mobileSmallMultipleRecipe,cr as mobileChartFamilyRecipe,lr as mobileBrushAlternatives};
@@ -0,0 +1 @@
1
+ function t(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function e(e,n,r=e.responsiveRules){if(!Array.isArray(r)||0===r.length)return{props:e,matches:[]};const o=r.map((t,e)=>({rule:t,index:e})).filter(t=>function(t,e){const{when:n}=t,r=e.width,o=e.height,i=function(t){if("number"==typeof t.height&&t.height>0)return t.width/t.height}(e),a=function(t){if("number"==typeof t.height&&t.height>0)return t.height>t.width?"portrait":"landscape"}(e);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}(t.rule,n)).sort((t,e)=>("number"==typeof t.rule.priority?t.rule.priority:t.index)-("number"==typeof e.rule.priority?e.rule.priority:e.index));return{props:o.reduce((e,n)=>function(e,n){const r={...e,...n};for(const o of["margin","frameProps","mobileSemantics","style"])t(e[o])&&t(n[o])&&(r[o]={...e[o],...n[o]});return"string"==typeof e.className&&"string"==typeof n.className&&(r.className=`${e.className} ${n.className}`),r}(e,n.rule.transform),e),matches:o}}function n(t,e){return t===e}function r(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function o(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function i(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}var a=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),s=new Set(["label","callout","callout-circle","callout-rect"]);function u(t){return"string"==typeof t?.type?t.type:""}function c(t){return!!t&&"object"==typeof t&&a.has(u(t))}function l(t){return s.has(u(t))&&!function(t){return Array.isArray(t?.disable)&&t.disable.includes("connector")}(t)}function f(t,e,n={}){return Number.isFinite(e)&&e>0?Number.isNaN(t)?"fresh":t===1/0?"expired":0>t||e*(n.fresh??1)>t?"fresh":e*(n.aging??1.5)>t?"aging":e*(n.stale??3)>t?"stale":"expired":"fresh"}function d(t,e={}){const n=!0===e.showRetractedAnnotations,r=!0===e.showSupersededAnnotations,o=new Set;for(const e of t){const t=e?.lifecycle?.supersedes;t&&"retracted"!==e?.lifecycle?.status&&o.add(t)}return t.filter(t=>{if("retracted"===t?.lifecycle?.status&&!n)return!1;const e=t?.provenance?.stableId;return!(e&&o.has(e)&&!r)})}function h(t,e){const n=t.length,r=e.length,o=Array(r+1);for(let t=0;r>=t;t++)o[t]=t;for(let i=1;n>=i;i++){let n=o[0];o[0]=i;for(let a=1;r>=a;a++){const r=o[a];o[a]=t[i-1]===e[a-1]?n:1+Math.min(n,o[a],o[a-1]),n=r}}return o[r]}function p(t,e,n=3){let r,o=n+1;for(const n of e){const e=h(t.toLowerCase(),n.toLowerCase());o>e&&(o=e,r=n)}return o>n?void 0:r}function m(t){return t.length>3?[t[0],t[Math.floor(t.length/2)],t[t.length-1]]:[...t]}function y(t,e){if(0===e.length)return null;const n=t.toLowerCase();return e.find(t=>t.toLowerCase().includes(n)||n.includes(t.toLowerCase()))||(p(t,e,3)??null)}function b({componentName:t,data:e,accessors:n,requiredProps:r}){if(r)for(const[e,n]of Object.entries(r))if(null==n)return`${t}: ${e} is required. Provide a field name or function.`;if(null==e)return null;if(!Array.isArray(e)&&"object"==typeof e)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(e)||0===e.length)return t+": No data provided. Pass a non-empty array to the data prop.";if(n){const r=m(e).find(t=>t&&"object"==typeof t);if(r){const e=Object.keys(r);for(const[o,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in r)){const n=y(i,e),r=n?` Try ${o}="${n}".`:"";return`${t}: ${o} "${i}" not found in data. Available fields: ${e.join(", ")}.${r}`}}}return null}function g({componentName:t,data:e,dataLabel:n="data"}){return null==e?`${t}: No ${n} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(e)?`${t}: ${n} 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 v({componentName:t,nodes:e,edges:n,nodesRequired:r=!1,edgesRequired:o=!0,accessors:i}){if(null==e&&null==n)return null;if(o&&(!n||!Array.isArray(n)||0===n.length))return t+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(r&&(!e||!Array.isArray(e)||0===e.length))return t+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&e&&e.length>0){const n=m(e).find(t=>t&&"object"==typeof t);if(n){const e=Object.keys(n);for(const[r,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in n)){const n=y(o,e),i=n?` Try ${r}="${n}".`:"";return`${t}: ${r} "${o}" not found in node data. Available fields: ${e.join(", ")}.${i}`}}}return null}import{createContext as A,useCallback as x,useContext as w,useMemo as $,useRef as N,useSyncExternalStore as j}from"react";import{jsx as M}from"react/jsx-runtime";function O(t){let e=null;const n=()=>(e||(e=A(null)),e),r=P(t);return[function({children:e,initialState:r}){const o=N(r),i=$(()=>P(t,o.current),[]),a=n();return M(a.Provider,{value:i,children:e})},(t,e)=>{const o=n(),i=w(o)??r,a=N(t);a.current=t;const s=N({hasValue:!1,value:void 0}),u=x(()=>{const t=a.current(i.getState()),n=s.current;return n.hasValue&&e&&e(n.value,t)?n.value:(s.current={hasValue:!0,value:t},t)},[i,e]),c=x(()=>a.current(i.getState()),[i]);return j(i.subscribe,u,c)}]}function P(t,e){const n=new Set;let r={...t(function(t){const e=t(r);if(function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}(e)){r={...r,...e};for(const t of n)t()}}),...e??{}};return{getState:()=>r,subscribe:function(t){return n.add(t),()=>{n.delete(t)}}}}import*as S from"react";var[C,I]=O(t=>({observations:[],maxObservations:100,version:0,pushObservation(e){t(t=>{const n=t.observations;return n.push(e),n.length>t.maxObservations&&n.shift(),{version:t.version+1}})},clearObservations(){t(()=>({observations:[],version:0}))}}));function k(t){const e=I(t=>t.pushObservation),n=S.useCallback(n=>{t.onObservation?.(n),e?.(n)},[t,e]);return S.useMemo(()=>({...t,onObservation:n}),[n,t])}function T(t){const e=t.provenance,n=t.id??t.stableId??e?.stableId;return null==n||""===n?void 0:n+""}function R(t,e={}){const n=T(t);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(t){const e=t.nativeEvent;return"touch"===e.pointerType?"touch":0===e.detail?"keyboard":"pointer"}(r);e.onAnnotationActivate?.({annotation:t,annotationId:n,chartId:e.chartId,inputType:o}),n&&e.onObservation&&e.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:e.chartType??"unknown",chartId:e.chartId})}}}function L(t){return t instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]")}function q(t){return"primary"===t?.emphasis||!0===t?.defensive}function H(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function V(t){let e;const n=t?.emphasis;e="primary"===n?100:"secondary"===n?10:50;const r=t?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(e+=15*Math.max(0,Math.min(1,r))),t?.lifecycle?.freshness){case"fresh":e+=8;break;case"aging":e+=4;break;case"stale":e+=1;break;case"expired":e-=200}return e}function W(t){const{annotations:e,width:n,height:r}=t,o=Math.max(0,t.minVisible??1),i=H(n,r,t),a=e.map((t,e)=>{return{annotation:t,index:e,note:(n=t,c(n))};var n}),s=a.filter(t=>t.note);if(0===s.length||i>=s.length)return{visible:e.slice(),deferred:[],budget:i};const u=s.filter(t=>q(t.annotation)),l=s.filter(t=>!q(t.annotation)).sort((t,e)=>V(e.annotation)-V(t.annotation)||t.index-e.index),f=Math.min(l.length,Math.max(Math.max(0,i-u.length),Math.max(0,o-u.length))),d=new Set([...u.map(t=>t.index),...l.slice(0,f).map(t=>t.index)]),h=[],p=[];for(const{annotation:t,index:e,note:n}of a)!n||d.has(e)?h.push(t):p.push(t);return{visible:h,deferred:p,budget:i}}function B(t){let e=t>>>0;return function(){e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}export{e as resolveResponsiveRules,O as createStore,n as accessorsEquivalent,r as resolveAccessor,o as resolveRawAccessor,i as resolveStringAccessor,f as bandFromAge,I as useObservationSelector,k as useAnnotationActivationOptions,T as annotationStableId,R as annotationActivationProps,L as isAnnotationActivationTarget,u as annotationType,c as isNoteAnnotation,l as annotationDrawsConnector,H as annotationBudget,W as annotationDensity,d as filterAnnotationsByStatus,p as closestMatch,b as validateArrayData,g as validateObjectData,v as validateNetworkData,B as mulberry32};