semiotic 3.7.4 → 3.7.5

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 (135) hide show
  1. package/CLAUDE.md +10 -7
  2. package/README.md +36 -19
  3. package/ai/schema.json +221 -1
  4. package/ai/system-prompt.md +2 -1
  5. package/dist/components/Annotation.d.ts +4 -0
  6. package/dist/components/DataSummaryContext.d.ts +1 -0
  7. package/dist/components/ai/chartCapabilityTypes.d.ts +16 -0
  8. package/dist/components/ai/dataPitfallsBridge.d.ts +101 -0
  9. package/dist/components/ai/dataQualityBridge.d.ts +201 -0
  10. package/dist/components/ai/describeChart.d.ts +2 -0
  11. package/dist/components/ai/generativeChart.d.ts +145 -0
  12. package/dist/components/charts/custom/NetworkCustomChart.d.ts +14 -1
  13. package/dist/components/charts/ordinal/SwarmPlot.d.ts +7 -0
  14. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +21 -0
  15. package/dist/components/charts/realtime/aggregate.d.ts +51 -0
  16. package/dist/components/charts/realtime/eventTime.d.ts +26 -0
  17. package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
  18. package/dist/components/charts/shared/colorUtils.d.ts +1 -12
  19. package/dist/components/charts/shared/minMax.d.ts +3 -0
  20. package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
  21. package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
  22. package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
  23. package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
  24. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  25. package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
  26. package/dist/components/charts/shared/validateChartData.d.ts +1 -1
  27. package/dist/components/charts/xy/Scatterplot.d.ts +9 -0
  28. package/dist/components/data/fromArrow.d.ts +54 -0
  29. package/dist/components/data/fromMermaid.d.ts +47 -0
  30. package/dist/components/data/fromObservablePlot.d.ts +69 -0
  31. package/dist/components/data/portability/index.d.ts +14 -0
  32. package/dist/components/data/portability/spec.d.ts +129 -0
  33. package/dist/components/data/portability/vegaLite.d.ts +62 -0
  34. package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
  35. package/dist/components/realtime/RunningStats.d.ts +66 -0
  36. package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
  37. package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
  38. package/dist/components/recipes/customTooltip.d.ts +31 -0
  39. package/dist/components/recipes/gofish.d.ts +207 -0
  40. package/dist/components/recipes/gofishBoba.d.ts +23 -0
  41. package/dist/components/recipes/gofishIR.d.ts +169 -0
  42. package/dist/components/recipes/gofishIRExamples.d.ts +89 -0
  43. package/dist/components/recipes/gofishInterpreter.d.ts +52 -0
  44. package/dist/components/recipes/gofishLambdas.d.ts +145 -0
  45. package/dist/components/recipes/mermaidDag.d.ts +44 -0
  46. package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
  47. package/dist/components/recipes/recipeChrome.d.ts +100 -0
  48. package/dist/components/recipes/recipeLegend.d.ts +57 -0
  49. package/dist/components/recipes/recipeUtils.d.ts +105 -0
  50. package/dist/components/semiotic-ai.d.ts +6 -0
  51. package/dist/components/semiotic-data.d.ts +2 -0
  52. package/dist/components/semiotic-experimental.d.ts +20 -0
  53. package/dist/components/semiotic-network.d.ts +3 -1
  54. package/dist/components/semiotic-ordinal.d.ts +2 -0
  55. package/dist/components/semiotic-realtime.d.ts +9 -1
  56. package/dist/components/semiotic-recipes.d.ts +18 -1
  57. package/dist/components/semiotic-themes.d.ts +2 -0
  58. package/dist/components/semiotic-xy.d.ts +2 -0
  59. package/dist/components/semiotic.d.ts +4 -0
  60. package/dist/components/store/ObservationStore.d.ts +21 -2
  61. package/dist/components/store/SelectionStore.d.ts +1 -1
  62. package/dist/components/store/ThemeStore.d.ts +1 -1
  63. package/dist/components/store/TooltipStore.d.ts +1 -1
  64. package/dist/components/store/createStore.d.ts +1 -1
  65. package/dist/components/store/designTokens.d.ts +15 -0
  66. package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
  67. package/dist/components/stream/NetworkPipelineStore.d.ts +32 -0
  68. package/dist/components/stream/NetworkSVGOverlay.d.ts +12 -0
  69. package/dist/components/stream/OrdinalPipelineStore.d.ts +18 -0
  70. package/dist/components/stream/PipelineStore.d.ts +27 -0
  71. package/dist/components/stream/SceneGraph.d.ts +5 -1
  72. package/dist/components/stream/customLayout.d.ts +20 -0
  73. package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
  74. package/dist/components/stream/customLayoutSelection.d.ts +52 -0
  75. package/dist/components/stream/networkCustomLayout.d.ts +66 -1
  76. package/dist/components/stream/networkTypes.d.ts +29 -1
  77. package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
  78. package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
  79. package/dist/components/stream/ordinalTypes.d.ts +19 -3
  80. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
  81. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
  82. package/dist/components/stream/stalenessBands.d.ts +28 -0
  83. package/dist/components/stream/symbolPath.d.ts +24 -0
  84. package/dist/components/stream/types.d.ts +72 -3
  85. package/dist/components/stream/useStalenessCheck.d.ts +6 -1
  86. package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
  87. package/dist/components/stream/xySceneBuilders/types.d.ts +5 -0
  88. package/dist/geo.min.js +1 -1
  89. package/dist/geo.module.min.js +1 -1
  90. package/dist/network.min.js +1 -1
  91. package/dist/network.module.min.js +1 -1
  92. package/dist/ordinal.min.js +1 -1
  93. package/dist/ordinal.module.min.js +1 -1
  94. package/dist/realtime.min.js +1 -1
  95. package/dist/realtime.module.min.js +1 -1
  96. package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +2 -0
  97. package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +1 -0
  98. package/dist/semiotic-ai.d.ts +6 -0
  99. package/dist/semiotic-ai.min.js +1 -1
  100. package/dist/semiotic-ai.module.min.js +1 -1
  101. package/dist/semiotic-data.d.ts +2 -0
  102. package/dist/semiotic-data.min.js +1 -1
  103. package/dist/semiotic-data.module.min.js +1 -1
  104. package/dist/semiotic-experimental.d.ts +20 -0
  105. package/dist/semiotic-experimental.min.js +1 -0
  106. package/dist/semiotic-experimental.module.min.js +1 -0
  107. package/dist/semiotic-network.d.ts +3 -1
  108. package/dist/semiotic-ordinal.d.ts +2 -0
  109. package/dist/semiotic-realtime.d.ts +9 -1
  110. package/dist/semiotic-recipes.d.ts +18 -1
  111. package/dist/semiotic-recipes.min.js +1 -1
  112. package/dist/semiotic-recipes.module.min.js +1 -1
  113. package/dist/semiotic-semiotic-BmrYbi99.js +2 -0
  114. package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +1 -0
  115. package/dist/semiotic-themes.d.ts +2 -0
  116. package/dist/semiotic-themes.min.js +1 -1
  117. package/dist/semiotic-themes.module.min.js +1 -1
  118. package/dist/semiotic-utils.min.js +1 -1
  119. package/dist/semiotic-utils.module.min.js +1 -1
  120. package/dist/semiotic-value.min.js +1 -1
  121. package/dist/semiotic-value.module.min.js +1 -1
  122. package/dist/semiotic-xy.d.ts +2 -0
  123. package/dist/semiotic.d.ts +4 -0
  124. package/dist/semiotic.min.js +1 -1
  125. package/dist/semiotic.module.min.js +1 -1
  126. package/dist/server.min.js +1 -1
  127. package/dist/server.module.min.js +1 -1
  128. package/dist/xy-semiotic-xy-Dufu3D0-.js +2 -0
  129. package/dist/xy-statisticalOverlays-3Ni9bRph.js +1 -0
  130. package/dist/xy.min.js +1 -1
  131. package/dist/xy.module.min.js +1 -1
  132. package/package.json +11 -3
  133. package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
  134. package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
  135. package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
@@ -15,6 +15,10 @@ export { dagreLayout } from "./components/recipes/dagre";
15
15
  export type { DagreConfig } from "./components/recipes/dagre";
16
16
  export { lineageDagLayout } from "./components/recipes/lineageDag";
17
17
  export type { LineageDagConfig, LineageLod, LineageStoreSlot } from "./components/recipes/lineageDag";
18
+ export { mermaidDagLayout } from "./components/recipes/mermaidDag";
19
+ export type { MermaidDagConfig } from "./components/recipes/mermaidDag";
20
+ export { packedClusterMatrix } from "./components/recipes/packedClusterMatrix";
21
+ export type { PackedClusterMatrixConfig } from "./components/recipes/packedClusterMatrix";
18
22
  export { marimekkoLayout } from "./components/recipes/marimekko";
19
23
  export type { MarimekkoConfig } from "./components/recipes/marimekko";
20
24
  export { bulletLayout } from "./components/recipes/bullet";
@@ -26,5 +30,18 @@ export type { AnnotationLayoutConfig, AnnotationLayoutOptions, AutoPlaceAnnotati
26
30
  export { annotationDensity, annotationBudget, DEFAULT_AREA_PER_ANNOTATION } from "./components/recipes/annotationDensity";
27
31
  export type { AnnotationDensityConfig, AnnotationDensityOptions, AnnotationDensityResult, } from "./components/recipes/annotationDensity";
28
32
  export type { CustomLayout, LayoutContext, LayoutResult, } from "./components/stream/customLayout";
29
- export type { NetworkCustomLayout, NetworkLayoutContext, NetworkLayoutResult, } from "./components/stream/networkCustomLayout";
33
+ export type { NetworkCustomLayout, NetworkLayoutContext, NetworkLayoutResult, NetworkHtmlMark, } from "./components/stream/networkCustomLayout";
30
34
  export type { OrdinalCustomLayout, OrdinalLayoutContext, OrdinalLayoutResult, } from "./components/stream/ordinalCustomLayout";
35
+ export { shade, makeShade, readField, groupBy } from "./components/recipes/recipeUtils";
36
+ export { dimFor, matchesHighlight, signatureKey, LayoutCache } from "./components/recipes/recipeUtils";
37
+ export type { DimOptions, HighlightMatch } from "./components/recipes/recipeUtils";
38
+ export { symbolPathString, symbolRadius, symbolExtent, SYMBOL_SEQUENCE } from "./components/stream/symbolPath";
39
+ export type { NetworkSymbolName } from "./components/stream/symbolPath";
40
+ export { roundedEnclosure, boundsOf, bandLabel, markCallout } from "./components/recipes/recipeChrome";
41
+ export type { RoundedEnclosureProps, BandLabelProps, MarkCalloutProps, CalloutConnector, } from "./components/recipes/recipeChrome";
42
+ export { legendGroupsFrom } from "./components/recipes/recipeLegend";
43
+ export type { LegendGroupsInput } from "./components/recipes/recipeLegend";
44
+ export { useCustomLayoutSelection } from "./components/stream/customLayoutSelection";
45
+ export type { CustomLayoutSelection } from "./components/stream/customLayoutSelection";
46
+ export { buildTooltipEntries, extractTooltipDatum, formatTooltipValue, } from "./components/recipes/customTooltip";
47
+ export type { CustomTooltipEntry, CustomTooltipEntryOptions, } from "./components/recipes/customTooltip";
@@ -1 +1 @@
1
- "use strict";const e=require("d3-interpolate"),t=require("react/jsx-runtime"),n=require("react"),o=require("d3-scale");function i(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const r=i(n);function l(e){return"function"==typeof e?e:t=>t[e]}function s(e){const t=Object.create(null);return e((e,n)=>{t[e]=n}),t}const a=864e5;function c(e){return`${e.getUTCFullYear()}-${u(e.getUTCMonth()+1)}-${u(e.getUTCDate())}`}function u(e){return 10>e?"0"+e:e+""}const d={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},h={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function f(e,t,n){const o=e.data,i=o?o[t]:void 0;if(null!=i)return i;const r=e[t];return null==r?n:r}function y(e){return Array.isArray(e)?e.map((e,t)=>{var n,o;return"string"==typeof e?{storeName:e,slotIndex:t}:{storeName:(null!==(n=e.storeName)&&void 0!==n?n:"")+"",slotIndex:null!==(o=e.slotIndex)&&void 0!==o?o:t}}):[]}function m(e,t,n){const o=new Set,i=[];for(const t of e)n(t)&&!o.has(t)&&(o.add(t),i.push(t));for(const e of t)o.has(e)||i.push(e);return i}function p(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function g(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function v(e){return null==e?null:e+""}function x(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}const b=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function w(e){return!!e&&"object"==typeof e&&b.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function M(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function k(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function A(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function $(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),l=k(o,i,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,w(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(e=>M(e.annotation)),u=a.filter(e=>!M(e.annotation)).sort((e,t)=>A(t.annotation)-A(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],y=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?f.push(e):y.push(e);return{visible:f,deferred:y,budget:l}}new Set(["label","callout","callout-circle","callout-rect"]);const j=32,N=6,C=4,O=8,S=72;const W={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function F(e){return w(e)}function I(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function L(e,t,n,o,i){const r=e+n,l=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?l-i.height:l,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?l-i.height-4:l+4,width:i.width,height:i.height}}function T(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function E(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function D(e,t,n,o,i,r,l,s){const a=T(e,l);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,r,s);for(const e of n)c+=12*E(a,e);for(const e of o)c+=4*E(a,e);return c}function P(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const l=e.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return x(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?x(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return v(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>v(e.pointId)===r);if(l)return x(t,n,{x:l.x,y:l.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return v(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!s)return null;const a=p(s,n),c=g(s,n);return null==a||null==c?null:x(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let l=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,s=t.y)}if(null!=l&&null!=s||(l=p(e,n),s=g(e,n)),null!=l&&null!=s)return x(t,n,{x:l,y:s});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}(e,t,n):{x:e.x,y:e.y}}exports.DEFAULT_AREA_PER_ANNOTATION=2e4,exports.annotationBudget=k,exports.annotationDensity=$,exports.annotationLayout=function(e){var t;const{annotations:n,context:o,defaultOffset:i=j,notePadding:r=N,markPadding:l=C,edgePadding:s=O,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=S,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:y,cohesion:m,audience:p}=e,g=o.width||0,v=o.height||0;if(0===n.length||0>=g||0>=v)return n.slice();const x=[],b=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const M=n.map((e,t)=>{if(!F(e))return e;const n=P(e,t,o);if(!n)return e;const l=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...I("string"==typeof e.title?e.title:void 0,t),...I("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return x.push(T(L(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=D(L(n.x,n.y,e.dx,e.dy,l),e,x,b,g,v,r,s);f>t&&(h=e,f=t)}if(!h)return e;const y=T(L(n.x,n.y,h.dx,h.dy,l),r);x.push(y);const m=Math.hypot(h.dx,h.dy),p=c&&m>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),p?{connector:p}:{})}),A=w?M:n.slice();let E=A;if(f){let e=!1;const t=A.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});E=e?t:A}{let e=!1;const t=E.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=W[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});E=e?t:E}const z=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(p),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:k(g,v,e))*n))}),{deferred:i}=$(Object.assign({annotations:E,width:g,height:v},o));for(const e of i)z.add(e)}if(y&&("object"==typeof y&&"number"==typeof y.minWidth?y.minWidth:480)>=g)for(const e of E)F(e)&&"secondary"===e.emphasis&&z.add(e);if(z.size>0)for(const e of E)!0===(null==e?void 0:e.defensive)&&z.delete(e);let B;return B=0===z.size?E:h?E.map(e=>z.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):E.filter(e=>!z.has(e)),m?function(e,t){let n=!1;const o=e.map(e=>F(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(B,m):B},exports.bulletLayout=e=>{var t,n,o,i,a,c,u,d,h,f,y,m;const p=e.config,{plot:g}=e.dimensions;if(0>=g.width||0>=g.height||0===e.data.length)return{nodes:[]};const v=null!==(t=p.rowHeight)&&void 0!==t?t:28,x=null!==(n=p.rowGap)&&void 0!==n?n:12,b=!1!==p.showLabels,w=b?null!==(o=p.labelWidth)&&void 0!==o?o:120:0,M=!1!==p.showTicks,k=M?14:0,A=null!==(i=p.tickFormat)&&void 0!==i?i:e=>e.toLocaleString(),$=g.x+w,j=Math.max(0,g.width-w);if(0>=j)return{nodes:[]};const N=l(p.categoryAccessor),C=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:0},O=e=>C("function"==typeof p.valueAccessor?p.valueAccessor(e):e[p.valueAccessor]),S=e=>C("function"==typeof p.targetAccessor?p.targetAccessor(e):e[p.targetAccessor]),W=e=>{const t="function"==typeof p.rangesAccessor?p.rangesAccessor(e):e[p.rangesAccessor];return Array.isArray(t)?t.map(C).sort((e,t)=>e-t):[]},F="string"==typeof p.categoryAccessor?p.categoryAccessor:"metric",I="string"==typeof p.valueAccessor?p.valueAccessor:"value",L="string"==typeof p.targetAccessor?p.targetAccessor:"target",T=null!==(c=null!==(a=p.actualColor)&&void 0!==a?a:e.theme.semantic.primary)&&void 0!==c?c:"#3b6cb1",E=null!==(u=e.theme.semantic.text)&&void 0!==u?u:"currentColor",D=null!==(d=e.theme.semantic.textSecondary)&&void 0!==d?d:"#888",P=null!==(h=e.theme.semantic.surface)&&void 0!==h?h:"#e8eaed",z=null!==(f=e.theme.semantic.grid)&&void 0!==f?f:"#cdd1d6",B=null!==(y=e.theme.semantic.border)&&void 0!==y?y:"#a3a8af",_=null!==(m=p.targetColor)&&void 0!==m?m:`var(--semiotic-text, ${E})`,U=[`var(--semiotic-surface, ${P})`,`var(--semiotic-grid, ${z})`,`var(--semiotic-border, ${B})`],R=`var(--semiotic-text, ${E})`,G=`var(--semiotic-text-secondary, ${D})`,H=[],V=[];for(let t=0;e.data.length>t;t++){const n=e.data[t],o=W(n),i=O(n),r=S(n),l=Math.max(i,r,...o.length?o:[0]);if(0>=l)continue;const a=g.y+t*(v+x+k);if(a+v+k>g.y+g.height)break;V.push({yTop:a,label:N(n),actual:i,target:r,maxVal:l});const c=e=>$+e/l*j,u=N(n),d=e=>s(t=>{t("metric",u),"metric"!==F&&t(F,u),e(t)});let h=$;for(let e=0;o.length>e;e++){const t=c(o[e]),n=t-h;n>0&&H.push({type:"rect",x:h,y:a,w:n,h:v,style:{fill:U[Math.min(e,U.length-1)],stroke:"none"},datum:d(t=>{t("range",e),t("rangeValue",o[e]),t("kind","range")}),group:"range-"+e}),h=t}const f=Math.max(6,Math.floor(.45*v));H.push({type:"rect",x:$,y:a+(v-f)/2,w:c(i)-$,h:f,style:{fill:T,stroke:"none"},datum:d(e=>{e("value",i),e("kind","actual"),"value"!==I&&e(I,i)}),group:"actual"});const y=3,m=Math.floor(.8*v);H.push({type:"rect",x:c(r)-y/2,y:a+(v-m)/2,w:y,h:m,style:{fill:_,stroke:"none"},datum:d(e=>{e("target",r),e("kind","target"),"target"!==L&&e(L,r)}),group:"target"})}const Y=[];for(let e=0;V.length>e;e++){const t=V[e];if(b&&Y.push(r.createElement("text",{key:"bullet-label-"+e,x:g.x+w-8,y:t.yTop+v/2,textAnchor:"end",dominantBaseline:"middle",fontSize:13,fontWeight:500,fill:R},t.label)),M){const n=5,o=t.yTop+v+2;for(let i=0;n>i;i++){const l=t.maxVal*i/(n-1),s=$+l/t.maxVal*j;Y.push(r.createElement("line",{key:`bullet-tick-${e}-${i}`,x1:s,x2:s,y1:o,y2:o+3,stroke:G,strokeWidth:1}),r.createElement("text",{key:`bullet-ticktext-${e}-${i}`,x:s,y:o+12,textAnchor:0===i?"start":i===n-1?"end":"middle",fontSize:10,fill:G},A(l)))}}}return{nodes:H,overlays:Y.length>0?r.createElement(r.Fragment,null,...Y):null}},exports.calendarLayout=t=>{var n,o,i,r,l,s,u,d;const h=t.config,{plot:f}=t.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=e=>{const t="function"==typeof h.dateAccessor?h.dateAccessor(e):e[h.dateAccessor];return t instanceof Date?t:new Date(t)},m=e=>{const t="function"==typeof h.valueAccessor?h.valueAccessor(e):e[h.valueAccessor];return Number(t)},p=new Map;let g=null;for(const e of t.data){const t=y(e);if(!isFinite(t.getTime()))continue;null==g&&(g=t.getUTCFullYear());const o=c(t),i=m(e);p.set(o,(null!==(n=p.get(o))&&void 0!==n?n:0)+(Number.isFinite(i)?i:0))}const v=null!==(i=null!==(o=h.year)&&void 0!==o?o:g)&&void 0!==i?i:(new Date).getUTCFullYear();let x=1/0,b=-1/0;for(const e of p.values())x>e&&(x=e),e>b&&(b=e);x===1/0&&(x=0,b=0);const[w,M]=null!==(r=h.colorRamp)&&void 0!==r?r:[null!==(l=t.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=t.theme.semantic.primary)&&void 0!==s?s:"#216e39"],k=t=>{if(b===x)return w;const n=(t-x)/(b-x);return e.interpolateRgb(w,M)(n)},A=null!==(u=h.gutter)&&void 0!==u?u:2,$=null!==(d=h.labelInset)&&void 0!==d?d:0,j=Math.min((f.width-$-53*A)/54,(f.height-6*A)/7);if(0>=j)return{nodes:[]};const N=new Date(Date.UTC(v,0,1)),C=N.getUTCDay(),O=new Date(N.getTime()-C*a),S=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){const n=new Date(O.getTime()+(7*e+t)*a);if(n.getUTCFullYear()!==v)continue;const o=c(n),i=p.get(o),r=null==i?w:k(i);S.push({type:"rect",x:f.x+$+e*(j+A),y:f.y+t*(j+A),w:j,h:j,style:{fill:r,stroke:"none"},datum:{date:n,value:null!=i?i:0}})}return{nodes:S}},exports.dagreLayout=e=>{var t,n,o,i,r,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",y=!1!==u.showLabels,m=null!==(i=u.labelAccessor)&&void 0!==i?i:"label",p="function"==typeof m?m:e=>{var t,n;const o=e.data,i=o?o[m]:void 0;return(null!==(n=null!==(t=null!=i?i:e[m])&&void 0!==t?t:e.id)&&void 0!==n?n:"")+""},g=new Map,v=[],x=[],b=e=>{var t,n,o;const i=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof i.x?i.x:e.x,y:"number"==typeof i.y?i.y:e.y,w:null!==(n="number"==typeof i.width?i.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:i,h:s}=b(t);null!=n&&null!=o&&(g.set(t.id,{x:n,y:o,w:i,h:s}),v.push({type:"rect",x:n-i/2,y:o-s/2,w:i,h:s,style:{fill:null!==(r=u.nodeFill)&&void 0!==r?r:e.resolveColor(t.id),stroke:`var(--semiotic-border, ${null!==(l=e.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:t,id:t.id,label:p(t)+""}),y&&x.push({x:n,y:o,text:p(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const w=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#666"})`,M=[];for(const t of e.edges){const e="string"==typeof t.target?t.target:t.target.id,n=g.get("string"==typeof t.source?t.source:t.source.id),o=g.get(e);if(!n||!o)continue;const i=null!==(c=t.data)&&void 0!==c?c:{},r=Array.isArray(i.points)?i.points:t.points;if(r&&r.length>=2)if("smooth"!==f||3>r.length){const e="M"+r.map(e=>`${e.x},${e.y}`).join(" L ");M.push({type:"curved",pathD:e,style:{stroke:w,strokeWidth:1,fill:"none"},datum:t})}else{let e=`M${r[0].x},${r[0].y}`;for(let t=1;r.length-1>t;t++)e+=` Q${r[t].x},${r[t].y} ${(r[t].x+r[t+1].x)/2},${(r[t].y+r[t+1].y)/2}`;const n=r[r.length-1];e+=` T${n.x},${n.y}`,M.push({type:"curved",pathD:e,style:{stroke:w,strokeWidth:1,fill:"none"},datum:t})}else M.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:w,strokeWidth:1},datum:t})}return{sceneNodes:v,sceneEdges:M,labels:x}},exports.flextreeLayout=e=>{var t,n,o,i,r,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",y=null!==(i=u.edgeCurve)&&void 0!==i?i:"curved",m=!1!==u.showLabels,p=null!==(r=u.labelAccessor)&&void 0!==r?r:"id",g="function"==typeof p?p:e=>{var t,n;const o=e.data,i=o?o[p]:void 0;return(null!==(n=null!==(t=null!=i?i:e[p])&&void 0!==t?t:e.id)&&void 0!==n?n:"")+""},v=new Map,x=[],b=[],w=e=>{var t,n,o;const i=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof i.x?i.x:e.x,y:"number"==typeof i.y?i.y:e.y,w:null!==(n="number"==typeof i.width?i.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:i,h:r}=w(t);null!=n&&null!=o&&(v.set(t.id,{x:n,y:o,w:i,h:r}),x.push({type:"rect",x:n-i/2,y:o-r/2,w:i,h:r,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:e.resolveColor(t.id),stroke:`var(--semiotic-surface, ${null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:t,id:t.id,label:g(t)+""}),m&&b.push({x:n,y:o,text:g(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const M=[];for(const t of e.edges){const n="string"==typeof t.target?t.target:t.target.id,o=v.get("string"==typeof t.source?t.source:t.source.id),i=v.get(n);if(!o||!i)continue;const r="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:i.x,y:i.y-i.h/2}:{x:i.x-i.w/2,y:i.y};if("line"===y)M.push({type:"line",x1:r.x,y1:r.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:t});else{const n=(r.y+l.y)/2,o=(r.x+l.x)/2;M.push({type:"curved",pathD:"vertical"===f?`M${r.x},${r.y} C${r.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${r.x},${r.y} C${o},${r.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:t})}}return{sceneNodes:x,sceneEdges:M,labels:b}},exports.lineageDagLayout=e=>{var n,o,i,r,l,s,a,c,u,m,p,g,v,x,b,w,M,k,A,$,j,N,C,O,S;const W=e.config||{},F=e.dimensions.plot,I=null!==(n=W.layerAccessor)&&void 0!==n?n:"x",L=null!==(o=W.rowAccessor)&&void 0!==o?o:"y",T=null!==(i=W.partitionAccessor)&&void 0!==i?i:"partition",E=null!==(r=W.semanticAccessor)&&void 0!==r?r:"semantic",D=null!==(l=W.labelAccessor)&&void 0!==l?l:"label",P=null!==(s=W.storesAccessor)&&void 0!==s?s:"stores",z=null!==(a=W.backEdgeAccessor)&&void 0!==a?a:"isBackEdge",B=null!==(c=W.edgeTypeAccessor)&&void 0!==c?c:"edgeType",_=Object.assign(Object.assign({},d),W.partitionColors),U=Object.assign(Object.assign({},h),W.edgeColors),R=null!==(u=W.accentColor)&&void 0!==u?u:"var(--semiotic-focus, #ffcc33)",G=null!==(m=W.borderColor)&&void 0!==m?m:"var(--semiotic-border, #555)",H=null!==(p=W.dimOpacity)&&void 0!==p?p:.14,V=null!==(g=W.edgeOpacity)&&void 0!==g?g:.5,Y=null!==(v=W.edgeWidth)&&void 0!==v?v:1.25,q=null!==(b=null!==(x=W.backEdgeWidth)&&void 0!==x?x:W.edgeWidth)&&void 0!==b?b:1.5,J=!1!==W.showStoreChips,K=null!==(w=W.storeChipColor)&&void 0!==w?w:"var(--semiotic-info, #6a8caf)";let Q=W.layerCount,X=W.maxLayerSize;if(null==Q||null==X){let t=0;const n=new Map;for(const o of e.nodes){const e=Math.round(Number(f(o,I,0)));t=Math.max(t,e),n.set(e,(null!==(M=n.get(e))&&void 0!==M?M:0)+1)}Q=null!=Q?Q:t+1,X=null!=X?X:Math.max(1,...n.values())}const Z=F.width/Math.max(1,Q),ee=F.height/Math.max(1,X);let te=Math.min(null!==(k=W.nodeWidth)&&void 0!==k?k:172,Math.max(8,Z-(null!==(A=W.minGapX)&&void 0!==A?A:26))),ne=Math.min(null!==($=W.nodeHeight)&&void 0!==$?$:54,Math.max(8,ee-(null!==(j=W.minGapY)&&void 0!==j?j:18)));const oe=W.lod&&"auto"!==W.lod?W.lod:16>te?"dot":48>te?"icon":108>te?"compact":"full";if("dot"===oe){const e=Math.min(te,ne,11);te=e,ne=e}const ie=Math.max(1,F.width-te),re=Math.max(1,F.height-ne),le=Math.max(1,X-1),se=e=>F.x+te/2+(Q>1?e/(Q-1):.5)*ie,ae=e=>F.y+ne/2+(e+le/2)/le*re,ce=W.reachableIds?new Set(W.reachableIds):null,ue=null!==(N=W.selectedId)&&void 0!==N?N:null,de=e.selection,he=new Map,fe=new Map,ye=[],me=[];for(const t of e.nodes){const e=t.id,n=Number(f(t,I,0)),o=Number(f(t,L,0)),i=f(t,T,"processor")+"",r=f(t,E,"processor")+"",l=f(t,D,e)+"",s=y(f(t,P,[])),a=null!==(C=t.data)&&void 0!==C?C:t,c=se(n),u=ae(o);he.set(e,{cx:c,cy:u});const d=ce?ce.has(e):null,h=(null==de?void 0:de.isActive)?de.predicate(a):null,m=null!==d?!d:null!==h&&!h;fe.set(e,m);const p=null!=ue&&e===ue,g=m&&!p?H:1,v=null!==(O=_[i])&&void 0!==O?O:_.unknown;"dot"===oe?ye.push({type:"circle",cx:c,cy:u,r:te/2,style:{fill:v,opacity:g,stroke:p?R:"transparent",strokeWidth:p?2:0},datum:t,id:e,label:l}):(ye.push({type:"rect",x:c-te/2,y:u-ne/2,w:te,h:ne,style:{fill:v,opacity:g,stroke:p?R:G,strokeWidth:p?3:1},datum:t,id:e,label:l}),me.push({id:e,cx:c,cy:u,partition:i,semantic:r,label:l,stores:s,opacity:g,selected:p,node:a}))}const pe=[];for(const t of e.edges){const e="string"==typeof t.source?t.source:t.source.id,n="string"==typeof t.target?t.target:t.target.id,o=he.get(e),i=he.get(n);if(!o||!i)continue;const r=!!f(t,z,!1),l=f(t,B,"internal")+"",s=fe.get(e)||fe.get(n)?Math.min(V,1.4*H):V,a=r?U.back:null!==(S=U[l])&&void 0!==S?S:U.internal;let c;if(r){const e=o.cx,t=o.cy+ne/2,n=i.cx,r=i.cy+ne/2,l=Math.max(48,.28*Math.abs(e-n))+ne;c=`M${e},${t} C${e},${t+l} ${n},${r+l} ${n},${r}`}else{const e=o.cx+te/2,t=o.cy,n=i.cx-te/2,r=i.cy,l=(e+n)/2;c=`M${e},${t} C${l},${t} ${l},${r} ${n},${r}`}const u={type:"curved",pathD:c,style:Object.assign({stroke:a,strokeWidth:r?q:Y,fill:"none",opacity:s},r?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:t};pe.push(u)}const ge=0===me.length?null:t.jsx("g",{className:"lineage-dag-glyphs",children:me.map(e=>function(e,n){var o,i;const{w:r,h:l,lod:s}=n,a="icon"===s?Math.min(r,l):Math.min(l-14,26),c=null!==(i=null!==(o=n.partColors[e.partition])&&void 0!==o?o:n.partColors.unknown)&&void 0!==i?i:"#5a5a6a",u="icon"===s?0:8+a+8,d=null!=n.renderIcon?n.renderIcon({semantic:e.semantic,partition:e.partition,size:a,color:c,node:e.node}):function(e,n,o){var i;const r=n.startsWith("topic")?"T":null!==(i={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"}[e])&&void 0!==i?i:"PR";return t.jsxs("g",{children:[t.jsx("rect",{width:o,height:o,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),t.jsx("text",{x:o/2,y:o/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*o,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:r})]})}(e.semantic,e.partition,a),h="full"===s,f="icon"!==s,y="full"===s&&n.showChips&&e.stores.length>0;return t.jsxs("g",{transform:`translate(${e.cx-r/2}, ${e.cy-l/2})`,opacity:e.opacity,style:{pointerEvents:"none"},children:[t.jsx("g",{transform:`translate(${"icon"===s?(r-a)/2:8}, ${(l-a)/2})`,children:d}),f&&t.jsx("foreignObject",{x:u,y:h?l/2-12:l/2-9,width:Math.max(8,r-u-8),height:18,style:{pointerEvents:"none"},children:t.jsx("div",{title:e.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===s?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label})}),h&&t.jsx("text",{x:u,y:l/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:n.typeLabel?n.typeLabel({semantic:e.semantic,partition:e.partition,node:e.node}):e.partition.startsWith("topic")?"topic":e.semantic}),y&&e.stores.map((e,o)=>t.jsx("rect",{x:u+15*o,y:l-10,width:12,height:5,rx:1.5,fill:n.chipColor,children:t.jsx("title",{children:e.storeName})},e.storeName+o))]},e.id)}(e,{w:te,h:ne,lod:oe,partColors:_,chipColor:K,showChips:J,renderIcon:W.renderIcon,typeLabel:W.typeLabel}))});return{sceneNodes:ye,sceneEdges:pe,overlays:ge}},exports.marimekkoLayout=e=>{var t,n,o,i,a,c,u;const d=e.config,{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=l(d.categoryAccessor),y=l(d.stackBy),p=e=>{const t="function"==typeof d.valueAccessor?d.valueAccessor(e):e[d.valueAccessor],n=Number(t);return Number.isFinite(n)&&n>0?n:0},g=null!==(t=d.gutter)&&void 0!==t?t:2,v="string"==typeof d.categoryAccessor?d.categoryAccessor:"category",x="string"==typeof d.stackBy?d.stackBy:"stack",b="string"==typeof d.valueAccessor?d.valueAccessor:"value",w=(e,t,n)=>s(o=>{o("category",e),o("stack",t),o("value",n),"category"!==v&&o(v,e),"stack"!==x&&o(x,t),"value"!==b&&o(b,n)}),M=!1!==d.showCategoryLabels,k=null!==(n=d.labelPadding)&&void 0!==n?n:M?22:0,A=Math.max(0,h.height-k),$=[],j=new Map,N=[],C=new Set,O=new Map;for(const t of e.data){const e=f(t)+"",n=y(t)+"",r=p(t);j.has(e)||($.push(e),j.set(e,0),O.set(e,new Map)),C.has(n)||(C.add(n),N.push(n)),j.set(e,(null!==(o=j.get(e))&&void 0!==o?o:0)+r);const l=O.get(e);l.set(n,(null!==(i=l.get(n))&&void 0!==i?i:0)+r)}const S=d.categoryOrder?m(d.categoryOrder,$,e=>j.has(e)):$,W=d.stackOrder?m(d.stackOrder,N,()=>!0):N,F=S.reduce((e,t)=>{var n;return e+(null!==(n=j.get(t))&&void 0!==n?n:0)},0);if(0>=F)return{nodes:[]};const I=Math.max(0,h.width-g*Math.max(0,S.length-1)),L=[],T=[];let E=h.x;for(const t of S){const n=null!==(a=j.get(t))&&void 0!==a?a:0,o=n/F*I;if(0>=o)continue;T.push({cat:t,x:E,w:o});const i=O.get(t);let r=h.y;for(const l of W){const s=null!==(c=i.get(l))&&void 0!==c?c:0;if(0>=s)continue;const a=s/n*A;L.push({type:"rect",x:E,y:r,w:o,h:a,style:{fill:e.resolveColor(l),stroke:"none"},datum:w(t,l,s),group:l}),r+=a}E+=o+g}return{nodes:L,overlays:M&&T.length>0?function(e,t,n){const o=e.map((e,o)=>6.5*e.cat.length>e.w-4?null:r.createElement("text",{key:"marimekko-label-"+o,x:e.x+e.w/2,y:t+12,textAnchor:"middle",fontSize:12,fill:n},e.cat));return r.createElement(r.Fragment,null,...o)}(T,h.y+A+4,`var(--semiotic-text, ${null!==(u=e.theme.semantic.text)&&void 0!==u?u:"currentColor"})`):null}},exports.parallelCoordinatesLayout=e=>{var t,n,i,l,s,a,c,u,d,h,f,y;const m=e.config,{plot:p}=e.dimensions,g=null!==(t=m.fields)&&void 0!==t?t:[];if(2>g.length||0>=p.width||0>=p.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};const v={};for(const t of g){if(null===(n=m.domains)||void 0===n?void 0:n[t]){v[t]=m.domains[t];continue}let o=1/0,i=-1/0;for(const n of e.data){const e=Number(n[t]);Number.isFinite(e)&&(o>e&&(o=e),e>i&&(i=e))}v[t]=Number.isFinite(o)&&Number.isFinite(i)&&o!==i?[o,i]:[0,1]}const x=!1!==m.showAxes,b=x?null!==(i=m.axisLabelPadding)&&void 0!==i?i:24:8,w=x?18:8,M=g.map(e=>o.scaleLinear().domain(v[e]).range([p.y+p.height-w,p.y+b])),k=g.map((e,t)=>1===g.length?p.x+p.width/2:p.x+t/(g.length-1)*p.width),A=m.colorBy?"function"==typeof m.colorBy?m.colorBy:e=>{var t;return(null!==(t=e[m.colorBy])&&void 0!==t?t:"")+""}:null,$=null!==(l=m.opacity)&&void 0!==l?l:.45,j=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,N=null!==(a=e.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",C=null!==(c=m.dimmedOpacity)&&void 0!==c?c:.08,O=m.highlightFn,S=[],W=[];for(const t of e.data){const n=A?e.resolveColor(A(t)+""):N,o=!O||O(t),i=O?o?Math.min(1,$+.4):C:$,r=o?W:S;for(let e=0;g.length-1>e;e++){const l=Number(t[g[e]]),s=Number(t[g[e+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:k[e],y1:M[e](l),x2:k[e+1],y2:M[e+1](s),style:{stroke:n,strokeWidth:O&&o?j+.75:j,opacity:i,fill:"none"},datum:t};r.push(a)}if(m.showPoints)for(let e=0;g.length>e;e++){const o=Number(t[g[e]]);if(!Number.isFinite(o))continue;const l={type:"point",x:k[e],y:M[e](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,i+.3)},datum:t};r.push(l)}}let F=null;if(x){const t=`var(--semiotic-border, ${null!==(u=e.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,n=`var(--semiotic-text, ${null!==(d=e.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,o=`var(--semiotic-text-secondary, ${null!==(h=e.theme.semantic.textSecondary)&&void 0!==h?h:"#888"})`,i=p.y+b,l=p.y+p.height-w,s=[];for(let e=0;g.length>e;e++){const a=g[e],c=k[e],u=null!==(y=null===(f=m.tickFormat)||void 0===f?void 0:f[a])&&void 0!==y?y:e=>e.toLocaleString();s.push(r.createElement("line",{key:"pc-axis-line-"+e,x1:c,x2:c,y1:i,y2:l,stroke:t,strokeWidth:1})),s.push(r.createElement("text",{key:"pc-axis-label-"+e,x:c,y:p.y+b-8,textAnchor:"middle",fontSize:12,fontWeight:600,fill:n},a));const[d,h]=v[a],x=5;for(let n=0;x>n;n++){const i=d+(h-d)*n/(x-1),l=M[e](i);s.push(r.createElement("line",{key:`pc-tick-${e}-${n}`,x1:c-3,x2:c+3,y1:l,y2:l,stroke:t,strokeWidth:1}),r.createElement("text",{key:`pc-ticktext-${e}-${n}`,x:c+6,y:l+3,fontSize:10,fill:o},u(i)))}}F=r.createElement(r.Fragment,null,...s)}return{nodes:S.concat(W),overlays:F}},exports.waffleLayout=e=>{var t,n,o,i,r,l;const a=e.config,c=null!==(t=a.rows)&&void 0!==t?t:10,u=null!==(n=a.columns)&&void 0!==n?n:10,d=null!==(o=a.gutter)&&void 0!==o?o:2,h=c*u;if(0>=c||0>=u||0>=h)return{nodes:[]};const{plot:f}=e.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=(f.width-d*(u-1))/u,m=(f.height-d*(c-1))/c;if(0>=y||0>=m)return{nodes:[]};const p=null!==(i=null==(g=a.categoryAccessor)?null:"function"==typeof g?g:e=>e[g])&&void 0!==i?i:()=>"_default";var g;const v=null!==(r=function(e){return null==e?null:"function"==typeof e?e:t=>Number(t[e])}(a.valueAccessor))&&void 0!==r?r:()=>1,x=new Map,b=[];for(const t of e.data){const e=p(t)+"",n=Number(v(t)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(e)||b.push(e),x.set(e,(null!==(l=x.get(e))&&void 0!==l?l:0)+o)}const w=Array.from(x.values()).reduce((e,t)=>e+t,0);if(0>=w)return{nodes:[]};let M;if(a.categoryOrder&&a.categoryOrder.length>0){const e=new Set,t=[];for(const n of a.categoryOrder)x.has(n)&&!e.has(n)&&(e.add(n),t.push(n));M=[...t,...b.filter(t=>!e.has(t))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(e=>{var t;return{cat:e,exact:(null!==(t=x.get(e))&&void 0!==t?t:0)/w*h}}),A=k.map(e=>Object.assign(Object.assign({},e),{count:Math.floor(e.exact)})),$=A.reduce((e,t)=>e+t.count,0),j=A.map((e,t)=>({i:t,rem:e.exact-e.count})).sort((e,t)=>t.rem-e.rem);for(let e=0;h-$>e;e++)A[j[e%j.length].i].count+=1;const N="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",C="string"==typeof a.valueAccessor?a.valueAccessor:"value",O=(e,t,n)=>s(o=>{var i,r;o("category",e),o("value",null!==(i=x.get(e))&&void 0!==i?i:0),"category"!==N&&o(N,e),"value"!==C&&o(C,null!==(r=x.get(e))&&void 0!==r?r:0),o("cells",n),o("_waffleCategory",e),o("_waffleIndex",t)}),S=[];let W=0;for(const t of A){const n=e.resolveColor(t.cat);for(let e=0;t.count>e;e++)S.push({type:"rect",x:f.x+W%u*(y+d),y:f.y+(c-1-Math.floor(W/u))*(m+d),w:y,h:m,style:{fill:n,stroke:"none"},datum:O(t.cat,W,t.count),group:t.cat}),W++}return{nodes:S}};
1
+ "use strict";const e=require("d3-interpolate"),t=require("react/jsx-runtime"),o=require("d3-shape"),n=require("react"),r=require("d3-scale");function i(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const o in e)if("default"!==o){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}return t.default=e,Object.freeze(t)}const l=i(n);function s(e){return"function"==typeof e?e:t=>t[e]}function a(e,t,o){const n=null==e?void 0:e.data,r=n?n[t]:void 0;if(null!=r)return r;const i=null==e?void 0:e[t];return null==i?o:i}function c(e,t){const o=new Map;for(const n of e){const e=t(n),r=o.get(e);r?r.push(n):o.set(e,[n])}return o}function u(e){const t=Object.create(null);return e((e,o)=>{t[e]=o}),t}function d(e,t){if(!t)return!0;const o=Array.isArray(t)?t:[t],n=e;for(const e of o)if(null!=e.value&&n[e.field]+""!=e.value+"")return!1;return!0}function h(e,t={}){var o,n,r;const i=null!==(o=t.baseOpacity)&&void 0!==o?o:1;return t.highlight||t.predicate?!d(e,t.highlight)||t.predicate&&!t.predicate(e)?null!==(r=t.dimOpacity)&&void 0!==r?r:.16:Math.min(1,i+(null!==(n=t.brighten)&&void 0!==n?n:0)):i}function f(e){return e.join("|")}class p{constructor(e=12){this.maxSize=e,this.store=new Map}get(e){return this.store.get(e)}set(e,t){this.maxSize>this.store.size||this.store.clear(),this.store.set(e,t)}getOrCompute(e,t){const o=this.store.get(e);if(void 0!==o)return o;const n=t();return this.set(e,n),n}clear(){this.store.clear()}get size(){return this.store.size}}function y(t,o=.72){const n=e.interpolateLab(t,"#ffffff"),r=e.interpolateLab(t,"#000000"),i=e.interpolateLab(t,t)(0);return e=>{const t=0>e?0:e>1?1:e;return.5===t?i:.5>t?n(2*(.5-t)*o):r(2*(t-.5)*o)}}const m=864e5;function x(e){return`${e.getUTCFullYear()}-${g(e.getUTCMonth()+1)}-${g(e.getUTCDate())}`}function g(e){return 10>e?"0"+e:e+""}const v={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},b={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function w(e){return Array.isArray(e)?e.map((e,t)=>{var o,n;return"string"==typeof e?{storeName:e,slotIndex:t}:{storeName:(null!==(o=e.storeName)&&void 0!==o?o:"")+"",slotIndex:null!==(n=e.slotIndex)&&void 0!==n?n:t}}):[]}function M(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+"…":e}const k={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function $(e,o,n,r,i,l,s,a){const c=o-r/2,u=n-i/2,d={fill:l,stroke:s,strokeWidth:a};switch(e){case"diamond":return t.jsx("polygon",Object.assign({points:`${o},${u} ${o+r/2},${n} ${o},${n+i/2} ${c},${n}`},d));case"circle":return t.jsx("circle",Object.assign({cx:o,cy:n,r:Math.min(r,i)/2},d));case"stadium":case"round":return t.jsx("rect",Object.assign({x:c,y:u,width:r,height:i,rx:"stadium"===e?i/2:8,ry:"stadium"===e?i/2:8},d));case"hexagon":{const e=Math.min(.18*r,16);return t.jsx("polygon",Object.assign({points:`${c+e},${u} ${o+r/2-e},${u} ${o+r/2},${n} ${o+r/2-e},${n+i/2} ${c+e},${n+i/2} ${c},${n}`},d))}case"cylinder":{const e=Math.min(.16*i,8),o=`M${c},${u+e} a${r/2},${e} 0 0 1 ${r},0`;return t.jsxs("g",{children:[t.jsx("path",Object.assign({d:`M${c},${u+e} a${r/2},${e} 0 0 0 ${r},0 v${i-2*e} a${r/2},${e} 0 0 1 ${-r},0 z`},d)),t.jsx("path",{d:o,fill:"none",stroke:s,strokeWidth:a})]})}case"subroutine":{const e=Math.min(8,.08*r);return t.jsxs("g",{children:[t.jsx("rect",Object.assign({x:c,y:u,width:r,height:i,rx:3},d)),t.jsx("line",{x1:c+e,y1:u,x2:c+e,y2:u+i,stroke:s,strokeWidth:a}),t.jsx("line",{x1:c+r-e,y1:u,x2:c+r-e,y2:u+i,stroke:s,strokeWidth:a})]})}default:return t.jsx("rect",Object.assign({x:c,y:u,width:r,height:i,rx:4},d))}}const A={circle:o.symbolCircle,square:o.symbolSquare,triangle:o.symbolTriangle,diamond:o.symbolDiamond,star:o.symbolStar,cross:o.symbolCross,wye:o.symbolWye},j=["circle","triangle","diamond","star","square","chevron","cross","wye"];function N(e,t,n){var r,i;if(n)return n;const l=null!=e?e:"circle";if("chevron"===l)return function(e){const t=1.5*S(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t);const s=null!==(r=A[l])&&void 0!==r?r:o.symbolCircle;return null!==(i=o.symbol(s,Math.max(1,t))())&&void 0!==i?i:""}function S(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const C=new Map;function O(e,t,o){if(!o&&"circle"===(null!=e?e:"circle"))return S(t);const n=o?"p:"+o:`${e}:${Math.round(t)}`,r=C.get(n);if(null!=r)return r;const i=(null!=o?o:N(e,t)).match(/-?\d*\.?\d+(?:e-?\d+)?/gi);let l=0;if(i)for(let e=0;i.length>e+1;e+=2){const t=+i[e],o=+i[e+1],n=Math.sqrt(t*t+o*o);n>l&&(l=n)}return l>0||(l=S(t)),C.size>512&&C.clear(),C.set(n,l),l}function z(e){var o,n,r,i,l;return t.jsx("rect",{className:e.className,x:e.x,y:e.y,width:Math.max(0,e.width),height:Math.max(0,e.height),rx:null!==(o=e.radius)&&void 0!==o?o:10,ry:null!==(n=e.radius)&&void 0!==n?n:10,fill:null!==(r=e.fill)&&void 0!==r?r:"none",stroke:e.stroke,strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1.5,strokeDasharray:e.strokeDasharray,opacity:null!==(l=e.opacity)&&void 0!==l?l:.6,style:{pointerEvents:"none"}},e.keyId)}function W(e){var o,n,r;const i=null!==(o=e.fontSize)&&void 0!==o?o:12;return null!=e.maxWidth&&e.text.length*i*.56>e.maxWidth?null:t.jsx("text",{className:e.className,x:e.x,y:e.y,textAnchor:null!==(n=e.anchor)&&void 0!==n?n:"middle",dominantBaseline:null!==(r=e.baseline)&&void 0!==r?r:"middle",fontSize:i,fontWeight:e.fontWeight,fill:e.color,style:{pointerEvents:"none"},children:e.text},e.keyId)}function F(e){var o,n,r,i,l,s,a;const c=null!==(o=e.stroke)&&void 0!==o?o:"var(--semiotic-text, #f4f4f8)",u=null!==(n=e.strokeWidth)&&void 0!==n?n:1,d=null!==(r=e.markRadius)&&void 0!==r?r:0,h=e.labelX-e.markX,f=e.labelY-e.markY,p=Math.hypot(h,f)||1,y=e.markX+h/p*d,m=e.markY+f/p*d;let x;return x="elbow"===e.connector?`M${y},${m} L${y},${e.labelY} L${e.labelX},${e.labelY}`:"curve"===e.connector?`M${y},${m} Q${(y+e.labelX)/2},${m} ${e.labelX},${e.labelY}`:`M${y},${m} L${e.labelX},${e.labelY}`,t.jsxs("g",{className:e.className,style:{pointerEvents:"none"},children:[d>0&&t.jsx("circle",{cx:e.markX,cy:e.markY,r:d,fill:"none",stroke:c,strokeWidth:u}),t.jsx("path",{d:x,fill:"none",stroke:c,strokeWidth:u}),t.jsx("text",{x:e.labelX,y:e.labelY,textAnchor:null!==(i=e.labelAnchor)&&void 0!==i?i:"middle",dominantBaseline:null!==(l=e.labelBaseline)&&void 0!==l?l:"hanging",fontSize:null!==(s=e.fontSize)&&void 0!==s?s:11,fontWeight:e.fontWeight,fill:null!==(a=e.color)&&void 0!==a?a:c,children:e.label})]},e.keyId)}const L=new p(12);function I(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();const t=e+"",o=Number(t);if(!Number.isNaN(o)&&""!==t.trim())return o;const n=Date.parse(t);return Number.isNaN(n)?NaN:n}function E(e,t,o){return t>e?t:e>o?o:e}function D(e){let t=2166136261;const o=e=>{for(let o=0;e.length>o;o++)t^=e.charCodeAt(o),t=Math.imul(t,16777619)};for(const n of e)o(n.id),o(n.col),o(n.row),t^=Math.round(8*n.packR),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function T(e,t,o){const n=new Set,r=[];for(const t of e)o(t)&&!n.has(t)&&(n.add(t),r.push(t));for(const e of t)n.has(e)||r.push(e);return r}function Y(e,t){var o,n,r;const i=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function P(e,t){var o,n,r;const i=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function R(e){return null==e?null:e+""}function X(e,t,o){var n;return null===(n=t.stickyPositionCache)||void 0===n||n.set(e,o),o}const B=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function V(e){return!!e&&"object"==typeof e&&B.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function q(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function H(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function G(e){var t,o;let n;const r=null==e?void 0:e.emphasis;n="primary"===r?100:"secondary"===r?10:50;const i=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof i&&Number.isFinite(i)&&(n+=15*Math.max(0,Math.min(1,i))),null===(o=null==e?void 0:e.lifecycle)||void 0===o?void 0:o.freshness){case"fresh":n+=8;break;case"aging":n+=4;break;case"stale":n+=1;break;case"expired":n-=200}return n}function _(e){var t;const{annotations:o,width:n,height:r}=e,i=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),l=H(n,r,e),s=o.map((e,t)=>{return{annotation:e,index:t,note:(o=e,V(o))};var o}),a=s.filter(e=>e.note);if(0===a.length||l>=a.length)return{visible:o.slice(),deferred:[],budget:l};const c=a.filter(e=>q(e.annotation)),u=a.filter(e=>!q(e.annotation)).sort((e,t)=>G(t.annotation)-G(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,i-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],p=[];for(const{annotation:e,index:t,note:o}of s)!o||h.has(t)?f.push(e):p.push(e);return{visible:f,deferred:p,budget:l}}new Set(["label","callout","callout-circle","callout-rect"]);const U=32,K=6,J=4,Q=8,Z=72;const ee={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function te(e){return V(e)}function oe(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of n)i&&i.length+e.length+1>o?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function ne(e,t,o,n,r){const i=e+o,l=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?i-r.width-4:i+4,y:0>n?l-r.height:l,width:r.width,height:r.height}:{x:0>o?i-r.width:i,y:0>n?l-r.height-4:l+4,width:r.width,height:r.height}}function re(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ie(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function le(e,t,o,n,r,i,l,s){const a=re(e,l);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const r=Math.max(0,n-e.x),i=Math.max(0,n-e.y);return(r+Math.max(0,e.x+e.width-(t-n)))*e.height+(i+Math.max(0,e.y+e.height-(o-n)))*e.width}(a,r,i,s);for(const e of o)c+=12*ie(a,e);for(const e of n)c+=4*ie(a,e);return c}function se(e,t,o){var n,r;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const i=null!==(n=e.pointId)&&void 0!==n?n:e.nodeId;if(null!=i&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===i);if(e)return{x:e.x,y:e.y}}const l=e.coordinates,s=null===(r=o.scales)||void 0===r?void 0:r.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const o=s([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,o){var n,r;const i=e.anchor||(null===(n=e.lifecycle)||void 0===n?void 0:n.anchor)||"fixed";if("latest"===i){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const r=o.pointNodes[n];if(r.pointId===e.pointId)return X(t,o,{x:r.x,y:r.y})}const n=function(e){var t,o,n,r,i,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(o);return n?X(t,o,n):null}if("semantic"===i){const n=function(e,t,o){var n,r;const i=function(e){var t,o;return R(null!==(o=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==o?o:e.stableId)}(e);if(!i)return null;const l=null===(n=o.pointNodes)||void 0===n?void 0:n.find(e=>R(e.pointId)===i);if(l)return X(t,o,{x:l.x,y:l.y});const s=null===(r=o.data)||void 0===r?void 0:r.find(e=>function(e){var t,o,n;return R(null!==(o=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==o?o:null===(n=e.provenance)||void 0===n?void 0:n.stableId)}(e)===i);if(!s)return null;const a=Y(s,o),c=P(s,o);return null==a||null==c?null:X(t,o,{x:a,y:c})}(e,t,o);if(n)return n}let l=null,s=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,s=t.y)}if(null!=l&&null!=s||(l=Y(e,o),s=P(e,o)),null!=l&&null!=s)return X(t,o,{x:l,y:s});if("sticky"===i){const e=null===(r=o.stickyPositionCache)||void 0===r?void 0:r.get(t);if(e)return e}return null}(e,t,o):{x:e.x,y:e.y}}const ae="var(--semiotic-text, currentColor)";function ce(e,t){const o=O(e,100);return o>0?t/o*100*(t/o):Math.PI*t*t}const ue={isActive:!1,predicate:()=>!0},de=l.createContext(null),he=new Set(["rows"]);function fe(e){const t=e,o=[me(t,["datum","data"]),me(t,["datum"]),me(t,["data","data"]),me(t,["data"]),me(t,["node","datum","data"]),me(t,["node","datum"]),e];for(const e of o){if(!xe(e))continue;const t={};for(const[o,n]of Object.entries(e))o.startsWith("_")||"function"==typeof n||(t[o]=n);if(Object.keys(t).length>0)return t}return null}function pe(e){if(null==e)return"";if(e instanceof Date)return e.toISOString();if("number"==typeof e)return Number.isInteger(e)?e+"":e.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof e)return e?"true":"false";if(Array.isArray(e))return e.length+" items";if("object"==typeof e)try{return JSON.stringify(e)}catch(t){return e+""}return e+""}function ye(e,t){return"function"==typeof t?t(e):t&&t[e]?t[e]:e}function me(e,t){let o=e;for(const e of t){if(!xe(o))return;o=o[e]}return o}function xe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}exports.DEFAULT_AREA_PER_ANNOTATION=2e4,exports.LayoutCache=p,exports.SYMBOL_SEQUENCE=j,exports.annotationBudget=H,exports.annotationDensity=_,exports.annotationLayout=function(e){var t;const{annotations:o,context:n,defaultOffset:r=U,notePadding:i=K,markPadding:l=J,edgePadding:s=Q,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=Z,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:p,cohesion:y,audience:m}=e,x=n.width||0,g=n.height||0;if(0===o.length||0>=x||0>=g)return o.slice();const v=[],b=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(n,l);let w=!1;const M=o.map((e,t)=>{if(!te(e))return e;const o=se(e,t,n);if(!o)return e;const l=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...oe("string"==typeof e.title?e.title:void 0,t),...oe("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return v.push(re(ne(o.x,o.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),i)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=le(ne(o.x,o.y,e.dx,e.dy,l),e,v,b,x,g,i,s);f>t&&(h=e,f=t)}if(!h)return e;const p=re(ne(o.x,o.y,h.dx,h.dy,l),i);v.push(p);const y=Math.hypot(h.dx,h.dy),m=c&&y>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),m?{connector:m}:{})}),k=w?M:o.slice();let $=k;if(f){let e=!1;const t=k.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return o!==t&&(e=!0),o});$=e?t:k}{let e=!1;const t=$.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const o=function(e){var t;const o=null==e?void 0:e.provenance;if(!o||"object"!=typeof o)return e;const n="string"==typeof o.source?null!==(t=ee[o.source])&&void 0!==t?t:o.source:null,r="number"==typeof o.confidence&&Number.isFinite(o.confidence)?Math.round(100*Math.max(0,Math.min(1,o.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[n,r].filter(Boolean).join(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${i})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${i})`:`(${i})`})}(t);return o!==t&&(e=!0),o});$=e?t:$}const A=new Set;if(d){const e="object"==typeof d?d:{},o=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(m),n=1===o?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:H(x,g,e))*o))}),{deferred:r}=_(Object.assign({annotations:$,width:x,height:g},n));for(const e of r)A.add(e)}if(p&&("object"==typeof p&&"number"==typeof p.minWidth?p.minWidth:480)>=x)for(const e of $)te(e)&&"secondary"===e.emphasis&&A.add(e);if(A.size>0)for(const e of $)!0===(null==e?void 0:e.defensive)&&A.delete(e);let j;return j=0===A.size?$:h?$.map(e=>A.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):$.filter(e=>!A.has(e)),y?function(e,t){let o=!1;const n=e.map(e=>te(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return o?n:e}(j,y):j},exports.bandLabel=W,exports.boundsOf=function(e,t=0){var o;let n=1/0,r=1/0,i=-1/0,l=-1/0;for(const t of e){const e=null!==(o=t.r)&&void 0!==o?o:0;n>t.x-e&&(n=t.x-e),t.x+e>i&&(i=t.x+e),r>t.y-e&&(r=t.y-e),t.y+e>l&&(l=t.y+e)}return Number.isFinite(n)?{x:n-t,y:r-t,width:i-n+2*t,height:l-r+2*t}:null},exports.buildTooltipEntries=function(e,t={}){var o;const n=fe(e);if(!n)return[];const r=new Set(he);if(t.excludeKeys)for(const e of t.excludeKeys)r.add(e);const i=[];for(const[e,l]of Object.entries(n))if((t.includeInternal||!e.startsWith("_"))&&!r.has(e)&&(t.includeEmpty||null!=l&&""!==l)&&"function"!=typeof l&&(i.push({key:e,label:ye(e,t.labels),value:l,formatted:t.valueFormat?t.valueFormat(l,e,n):pe(l)}),i.length>=(null!==(o=t.maxEntries)&&void 0!==o?o:8)))break;return i},exports.bulletLayout=e=>{var t,o,n,r,i,a,c,d,h,f,p,y;const m=e.config,{plot:x}=e.dimensions;if(0>=x.width||0>=x.height||0===e.data.length)return{nodes:[]};const g=null!==(t=m.rowHeight)&&void 0!==t?t:28,v=null!==(o=m.rowGap)&&void 0!==o?o:12,b=!1!==m.showLabels,w=b?null!==(n=m.labelWidth)&&void 0!==n?n:120:0,M=!1!==m.showTicks,k=M?14:0,$=null!==(r=m.tickFormat)&&void 0!==r?r:e=>e.toLocaleString(),A=x.x+w,j=Math.max(0,x.width-w);if(0>=j)return{nodes:[]};const N=s(m.categoryAccessor),S=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:0},C=e=>S("function"==typeof m.valueAccessor?m.valueAccessor(e):e[m.valueAccessor]),O=e=>S("function"==typeof m.targetAccessor?m.targetAccessor(e):e[m.targetAccessor]),z=e=>{const t="function"==typeof m.rangesAccessor?m.rangesAccessor(e):e[m.rangesAccessor];return Array.isArray(t)?t.map(S).sort((e,t)=>e-t):[]},F="string"==typeof m.categoryAccessor?m.categoryAccessor:"metric",L="string"==typeof m.valueAccessor?m.valueAccessor:"value",I="string"==typeof m.targetAccessor?m.targetAccessor:"target",E=null!==(a=null!==(i=m.actualColor)&&void 0!==i?i:e.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",D=null!==(c=e.theme.semantic.text)&&void 0!==c?c:"currentColor",T=null!==(d=e.theme.semantic.textSecondary)&&void 0!==d?d:"#888",Y=null!==(h=e.theme.semantic.surface)&&void 0!==h?h:"#e8eaed",P=null!==(f=e.theme.semantic.grid)&&void 0!==f?f:"#cdd1d6",R=null!==(p=e.theme.semantic.border)&&void 0!==p?p:"#a3a8af",X=null!==(y=m.targetColor)&&void 0!==y?y:`var(--semiotic-text, ${D})`,B=[`var(--semiotic-surface, ${Y})`,`var(--semiotic-grid, ${P})`,`var(--semiotic-border, ${R})`],V=`var(--semiotic-text, ${D})`,q=`var(--semiotic-text-secondary, ${T})`,H=[],G=[];for(let t=0;e.data.length>t;t++){const o=e.data[t],n=z(o),r=C(o),i=O(o),l=Math.max(r,i,...n.length?n:[0]);if(0>=l)continue;const s=x.y+t*(g+v+k);if(s+g+k>x.y+x.height)break;G.push({yTop:s,label:N(o),actual:r,target:i,maxVal:l});const a=e=>A+e/l*j,c=N(o),d=e=>u(t=>{t("metric",c),"metric"!==F&&t(F,c),e(t)});let h=A;for(let e=0;n.length>e;e++){const t=a(n[e]),o=t-h;o>0&&H.push({type:"rect",x:h,y:s,w:o,h:g,style:{fill:B[Math.min(e,B.length-1)],stroke:"none"},datum:d(t=>{t("range",e),t("rangeValue",n[e]),t("kind","range")}),group:"range-"+e}),h=t}const f=Math.max(6,Math.floor(.45*g));H.push({type:"rect",x:A,y:s+(g-f)/2,w:a(r)-A,h:f,style:{fill:E,stroke:"none"},datum:d(e=>{e("value",r),e("kind","actual"),"value"!==L&&e(L,r)}),group:"actual"});const p=3,y=Math.floor(.8*g);H.push({type:"rect",x:a(i)-p/2,y:s+(g-y)/2,w:p,h:y,style:{fill:X,stroke:"none"},datum:d(e=>{e("target",i),e("kind","target"),"target"!==I&&e(I,i)}),group:"target"})}const _=[];for(let e=0;G.length>e;e++){const t=G[e];if(b&&_.push(W({keyId:"bullet-label-"+e,text:t.label,x:x.x+w-8,y:t.yTop+g/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:V})),M){const o=5,n=t.yTop+g+2;for(let r=0;o>r;r++){const i=t.maxVal*r/(o-1),s=A+i/t.maxVal*j;_.push(l.createElement("line",{key:`bullet-tick-${e}-${r}`,x1:s,x2:s,y1:n,y2:n+3,stroke:q,strokeWidth:1}),W({keyId:`bullet-ticktext-${e}-${r}`,text:$(i),x:s,y:n+12,anchor:0===r?"start":r===o-1?"end":"middle",baseline:"auto",fontSize:10,color:q}))}}}return{nodes:H,overlays:_.length>0?l.createElement(l.Fragment,null,..._):null}},exports.calendarLayout=t=>{var o,n,r,i,l,s,a,c;const u=t.config,{plot:d}=t.dimensions;if(0>=d.width||0>=d.height)return{nodes:[]};const h=e=>{const t="function"==typeof u.dateAccessor?u.dateAccessor(e):e[u.dateAccessor];return t instanceof Date?t:new Date(t)},f=e=>{const t="function"==typeof u.valueAccessor?u.valueAccessor(e):e[u.valueAccessor];return Number(t)},p=new Map;let y=null;for(const e of t.data){const t=h(e);if(!isFinite(t.getTime()))continue;null==y&&(y=t.getUTCFullYear());const n=x(t),r=f(e);p.set(n,(null!==(o=p.get(n))&&void 0!==o?o:0)+(Number.isFinite(r)?r:0))}const g=null!==(r=null!==(n=u.year)&&void 0!==n?n:y)&&void 0!==r?r:(new Date).getUTCFullYear();let v=1/0,b=-1/0;for(const e of p.values())v>e&&(v=e),e>b&&(b=e);v===1/0&&(v=0,b=0);const[w,M]=null!==(i=u.colorRamp)&&void 0!==i?i:[null!==(l=t.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=t.theme.semantic.primary)&&void 0!==s?s:"#216e39"],k=t=>{if(b===v)return w;const o=(t-v)/(b-v);return e.interpolateRgb(w,M)(o)},$=null!==(a=u.gutter)&&void 0!==a?a:2,A=null!==(c=u.labelInset)&&void 0!==c?c:0,j=Math.min((d.width-A-53*$)/54,(d.height-6*$)/7);if(0>=j)return{nodes:[]};const N=new Date(Date.UTC(g,0,1)),S=N.getUTCDay(),C=new Date(N.getTime()-S*m),O=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){const o=new Date(C.getTime()+(7*e+t)*m);if(o.getUTCFullYear()!==g)continue;const n=x(o),r=p.get(n),i=null==r?w:k(r);O.push({type:"rect",x:d.x+A+e*(j+$),y:d.y+t*(j+$),w:j,h:j,style:{fill:i,stroke:"none"},datum:{date:o,value:null!=r?r:0}})}return{nodes:O}},exports.dagreLayout=e=>{var t,o,n,r,i,l,s,c,u;const d=e.config,h=null!==(t=d.nodeWidth)&&void 0!==t?t:100,f=null!==(o=d.nodeHeight)&&void 0!==o?o:36,p=null!==(n=d.edgeStyle)&&void 0!==n?n:"polyline",y=!1!==d.showLabels,m=null!==(r=d.labelAccessor)&&void 0!==r?r:"label",x="function"==typeof m?m:e=>{var t;return a(e,m,null!==(t=e.id)&&void 0!==t?t:"")+""},g=new Map,v=[],b=[],w=e=>{var t,o,n;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(o="number"==typeof r.width?r.width:e.width)&&void 0!==o?o:h,h:null!==(n="number"==typeof r.height?r.height:e.height)&&void 0!==n?n:f}};for(const t of e.nodes){const{x:o,y:n,w:r,h:s}=w(t);null!=o&&null!=n&&(g.set(t.id,{x:o,y:n,w:r,h:s}),v.push({type:"rect",x:o-r/2,y:n-s/2,w:r,h:s,style:{fill:null!==(i=d.nodeFill)&&void 0!==i?i:e.resolveColor(t.id),stroke:`var(--semiotic-border, ${null!==(l=e.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:t,id:t.id,label:x(t)+""}),y&&b.push({x:o,y:n,text:x(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const M=null!==(s=d.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#666"})`,k=[];for(const t of e.edges){const e="string"==typeof t.target?t.target:t.target.id,o=g.get("string"==typeof t.source?t.source:t.source.id),n=g.get(e);if(!o||!n)continue;const r=null!==(u=t.data)&&void 0!==u?u:{},i=Array.isArray(r.points)?r.points:t.points;if(i&&i.length>=2)if("smooth"!==p||3>i.length){const e="M"+i.map(e=>`${e.x},${e.y}`).join(" L ");k.push({type:"curved",pathD:e,style:{stroke:M,strokeWidth:1,fill:"none"},datum:t})}else{let e=`M${i[0].x},${i[0].y}`;for(let t=1;i.length-1>t;t++)e+=` Q${i[t].x},${i[t].y} ${(i[t].x+i[t+1].x)/2},${(i[t].y+i[t+1].y)/2}`;const o=i[i.length-1];e+=` T${o.x},${o.y}`,k.push({type:"curved",pathD:e,style:{stroke:M,strokeWidth:1,fill:"none"},datum:t})}else k.push({type:"line",x1:o.x,y1:o.y,x2:n.x,y2:n.y,style:{stroke:M,strokeWidth:1},datum:t})}return{sceneNodes:v,sceneEdges:k,labels:b}},exports.dimFor=h,exports.extractTooltipDatum=fe,exports.flextreeLayout=e=>{var t,o,n,r,i,l,s,c,u;const d=e.config,h=null!==(t=d.nodeWidth)&&void 0!==t?t:80,f=null!==(o=d.nodeHeight)&&void 0!==o?o:30,p=null!==(n=d.orientation)&&void 0!==n?n:"vertical",y=null!==(r=d.edgeCurve)&&void 0!==r?r:"curved",m=!1!==d.showLabels,x=null!==(i=d.labelAccessor)&&void 0!==i?i:"id",g="function"==typeof x?x:e=>{var t;return a(e,x,null!==(t=e.id)&&void 0!==t?t:"")+""},v=new Map,b=[],w=[],M=e=>{var t,o,n;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(o="number"==typeof r.width?r.width:e.width)&&void 0!==o?o:h,h:null!==(n="number"==typeof r.height?r.height:e.height)&&void 0!==n?n:f}};for(const t of e.nodes){const{x:o,y:n,w:r,h:i}=M(t);null!=o&&null!=n&&(v.set(t.id,{x:o,y:n,w:r,h:i}),b.push({type:"rect",x:o-r/2,y:n-i/2,w:r,h:i,style:{fill:null!==(l=d.nodeFill)&&void 0!==l?l:e.resolveColor(t.id),stroke:`var(--semiotic-surface, ${null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:t,id:t.id,label:g(t)+""}),m&&w.push({x:o,y:n,text:g(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const k=[];for(const t of e.edges){const o="string"==typeof t.target?t.target:t.target.id,n=v.get("string"==typeof t.source?t.source:t.source.id),r=v.get(o);if(!n||!r)continue;const i="vertical"===p?{x:n.x,y:n.y+n.h/2}:{x:n.x+n.w/2,y:n.y},l="vertical"===p?{x:r.x,y:r.y-r.h/2}:{x:r.x-r.w/2,y:r.y};if("line"===y)k.push({type:"line",x1:i.x,y1:i.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1},datum:t});else{const o=(i.y+l.y)/2,n=(i.x+l.x)/2;k.push({type:"curved",pathD:"vertical"===p?`M${i.x},${i.y} C${i.x},${o} ${l.x},${o} ${l.x},${l.y}`:`M${i.x},${i.y} C${n},${i.y} ${n},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(u=e.theme.semantic.border)&&void 0!==u?u:"#999"})`,strokeWidth:1,fill:"none"},datum:t})}}return{sceneNodes:b,sceneEdges:k,labels:w}},exports.formatTooltipValue=pe,exports.groupBy=c,exports.legendGroupsFrom=function(e){var o,n,r,i,l,s,a;const c=[],u=e.colorMap?Object.entries(e.colorMap):e.keys?e.keys.map(t=>[t,e.color?e.color(t):void 0]):[];if(u.length>0){const t=null!==(o=e.colorType)&&void 0!==o?o:"fill",r=u.map(([e,t])=>({label:e,color:t})),i="line"===t?e=>{var t;return{stroke:null!==(t=e.color)&&void 0!==t?t:ae,strokeWidth:2,fill:"none"}}:e=>{var t,o;return{fill:null!==(t=e.color)&&void 0!==t?t:ae,stroke:null!==(o=e.color)&&void 0!==o?o:ae}};c.push({type:t,label:null!==(n=e.colorLabel)&&void 0!==n?n:"",items:r,styleFn:i})}if(e.symbolMap&&Object.keys(e.symbolMap).length>0){const o=null!==(r=e.symbolColor)&&void 0!==r?r:ae,n=Object.entries(e.symbolMap).map(([e,t])=>({label:e,shape:t,color:o}));c.push({label:null!==(i=e.symbolLabel)&&void 0!==i?i:"",items:n,styleFn:()=>({}),type:e=>{var n;const r=e.shape;return t.jsx("path",{d:N(r,ce(r,7)),transform:"translate(8,8)",fill:null!==(n=e.color)&&void 0!==n?n:o})}})}if(e.sizeStops&&e.sizeStops.length>0&&e.sizeRadius){const o=e.sizeRadius,n=null!==(l=e.sizeFormat)&&void 0!==l?l:e=>e+"",r=null!==(s=e.sizeColor)&&void 0!==s?s:ae,i=e.sizeStops.map(e=>({label:n(e),r:Math.max(.5,o(e)),color:r}));c.push({label:null!==(a=e.sizeLabel)&&void 0!==a?a:"",items:i,styleFn:()=>({}),type:e=>{var o;return t.jsx("circle",{cx:8,cy:8,r:e.r,fill:null!==(o=e.color)&&void 0!==o?o:r})}})}return c},exports.lineageDagLayout=e=>{var o,n,r,i,l,s,c,u,d,h,f,p,y,m,x,g,M,k,$,A,j,N,S,C,O;const z=e.config||{},W=e.dimensions.plot,F=null!==(o=z.layerAccessor)&&void 0!==o?o:"x",L=null!==(n=z.rowAccessor)&&void 0!==n?n:"y",I=null!==(r=z.partitionAccessor)&&void 0!==r?r:"partition",E=null!==(i=z.semanticAccessor)&&void 0!==i?i:"semantic",D=null!==(l=z.labelAccessor)&&void 0!==l?l:"label",T=null!==(s=z.storesAccessor)&&void 0!==s?s:"stores",Y=null!==(c=z.backEdgeAccessor)&&void 0!==c?c:"isBackEdge",P=null!==(u=z.edgeTypeAccessor)&&void 0!==u?u:"edgeType",R=Object.assign(Object.assign({},v),z.partitionColors),X=Object.assign(Object.assign({},b),z.edgeColors),B=null!==(d=z.accentColor)&&void 0!==d?d:"var(--semiotic-focus, #ffcc33)",V=null!==(h=z.borderColor)&&void 0!==h?h:"var(--semiotic-border, #555)",q=null!==(f=z.dimOpacity)&&void 0!==f?f:.14,H=null!==(p=z.edgeOpacity)&&void 0!==p?p:.5,G=null!==(y=z.edgeWidth)&&void 0!==y?y:1.25,_=null!==(x=null!==(m=z.backEdgeWidth)&&void 0!==m?m:z.edgeWidth)&&void 0!==x?x:1.5,U=!1!==z.showStoreChips,K=null!==(g=z.storeChipColor)&&void 0!==g?g:"var(--semiotic-info, #6a8caf)";let J=z.layerCount,Q=z.maxLayerSize;if(null==J||null==Q){let t=0;const o=new Map;for(const n of e.nodes){const e=Math.round(Number(a(n,F,0)));t=Math.max(t,e),o.set(e,(null!==(M=o.get(e))&&void 0!==M?M:0)+1)}J=null!=J?J:t+1,Q=null!=Q?Q:Math.max(1,...o.values())}const Z=W.width/Math.max(1,J),ee=W.height/Math.max(1,Q);let te=Math.min(null!==(k=z.nodeWidth)&&void 0!==k?k:172,Math.max(8,Z-(null!==($=z.minGapX)&&void 0!==$?$:26))),oe=Math.min(null!==(A=z.nodeHeight)&&void 0!==A?A:54,Math.max(8,ee-(null!==(j=z.minGapY)&&void 0!==j?j:18)));const ne=z.lod&&"auto"!==z.lod?z.lod:16>te?"dot":48>te?"icon":108>te?"compact":"full";if("dot"===ne){const e=Math.min(te,oe,11);te=e,oe=e}const re=Math.max(1,W.width-te),ie=Math.max(1,W.height-oe),le=Math.max(1,Q-1),se=e=>W.x+te/2+(J>1?e/(J-1):.5)*re,ae=e=>W.y+oe/2+(e+le/2)/le*ie,ce=z.reachableIds?new Set(z.reachableIds):null,ue=null!==(N=z.selectedId)&&void 0!==N?N:null,de=e.selection,he=new Map,fe=new Map,pe=[],ye=[];for(const t of e.nodes){const e=t.id,o=Number(a(t,F,0)),n=Number(a(t,L,0)),r=a(t,I,"processor")+"",i=a(t,E,"processor")+"",l=a(t,D,e)+"",s=w(a(t,T,[])),c=null!==(S=t.data)&&void 0!==S?S:t,u=se(o),d=ae(n);he.set(e,{cx:u,cy:d});const h=ce?ce.has(e):null,f=(null==de?void 0:de.isActive)?de.predicate(c):null,p=null!==h?!h:null!==f&&!f;fe.set(e,p);const y=null!=ue&&e===ue,m=p&&!y?q:1,x=null!==(C=R[r])&&void 0!==C?C:R.unknown;"dot"===ne?pe.push({type:"circle",cx:u,cy:d,r:te/2,style:{fill:x,opacity:m,stroke:y?B:"transparent",strokeWidth:y?2:0},datum:t,id:e,label:l}):(pe.push({type:"rect",x:u-te/2,y:d-oe/2,w:te,h:oe,style:{fill:x,opacity:m,stroke:y?B:V,strokeWidth:y?3:1},datum:t,id:e,label:l}),ye.push({id:e,cx:u,cy:d,partition:r,semantic:i,label:l,stores:s,opacity:m,selected:y,node:c}))}const me=[];for(const t of e.edges){const e="string"==typeof t.source?t.source:t.source.id,o="string"==typeof t.target?t.target:t.target.id,n=he.get(e),r=he.get(o);if(!n||!r)continue;const i=!!a(t,Y,!1),l=a(t,P,"internal")+"",s=fe.get(e)||fe.get(o)?Math.min(H,1.4*q):H,c=i?X.back:null!==(O=X[l])&&void 0!==O?O:X.internal;let u;if(i){const e=n.cx,t=n.cy+oe/2,o=r.cx,i=r.cy+oe/2,l=Math.max(48,.28*Math.abs(e-o))+oe;u=`M${e},${t} C${e},${t+l} ${o},${i+l} ${o},${i}`}else{const e=n.cx+te/2,t=n.cy,o=r.cx-te/2,i=r.cy,l=(e+o)/2;u=`M${e},${t} C${l},${t} ${l},${i} ${o},${i}`}const d={type:"curved",pathD:u,style:Object.assign({stroke:c,strokeWidth:i?_:G,fill:"none",opacity:s},i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:t};me.push(d)}const xe=0===ye.length?null:t.jsx("g",{className:"lineage-dag-glyphs",children:ye.map(e=>function(e,o){var n,r;const{w:i,h:l,lod:s}=o,a="icon"===s?Math.min(i,l):Math.min(l-14,26),c=null!==(r=null!==(n=o.partColors[e.partition])&&void 0!==n?n:o.partColors.unknown)&&void 0!==r?r:"#5a5a6a",u="icon"===s?0:8+a+8,d=null!=o.renderIcon?o.renderIcon({semantic:e.semantic,partition:e.partition,size:a,color:c,node:e.node}):function(e,o,n){var r;const i=o.startsWith("topic")?"T":null!==(r={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"}[e])&&void 0!==r?r:"PR";return t.jsxs("g",{children:[t.jsx("rect",{width:n,height:n,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),t.jsx("text",{x:n/2,y:n/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*n,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:i})]})}(e.semantic,e.partition,a),h="full"===s,f="icon"!==s,p="full"===s&&o.showChips&&e.stores.length>0;return t.jsxs("g",{transform:`translate(${e.cx-i/2}, ${e.cy-l/2})`,opacity:e.opacity,style:{pointerEvents:"none"},children:[t.jsx("g",{transform:`translate(${"icon"===s?(i-a)/2:8}, ${(l-a)/2})`,children:d}),f&&t.jsx("foreignObject",{x:u,y:h?l/2-12:l/2-9,width:Math.max(8,i-u-8),height:18,style:{pointerEvents:"none"},children:t.jsx("div",{title:e.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===s?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label})}),h&&t.jsx("text",{x:u,y:l/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:o.typeLabel?o.typeLabel({semantic:e.semantic,partition:e.partition,node:e.node}):e.partition.startsWith("topic")?"topic":e.semantic}),p&&e.stores.map((e,n)=>t.jsx("rect",{x:u+15*n,y:l-10,width:12,height:5,rx:1.5,fill:o.chipColor,children:t.jsx("title",{children:e.storeName})},e.storeName+n))]},e.id)}(e,{w:te,h:oe,lod:ne,partColors:R,chipColor:K,showChips:U,renderIcon:z.renderIcon,typeLabel:z.typeLabel}))});return{sceneNodes:pe,sceneEdges:me,overlays:xe}},exports.makeShade=y,exports.marimekkoLayout=e=>{var t,o,n,r,i,a,c;const d=e.config,{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=s(d.categoryAccessor),p=s(d.stackBy),y=e=>{const t="function"==typeof d.valueAccessor?d.valueAccessor(e):e[d.valueAccessor],o=Number(t);return Number.isFinite(o)&&o>0?o:0},m=null!==(t=d.gutter)&&void 0!==t?t:2,x="string"==typeof d.categoryAccessor?d.categoryAccessor:"category",g="string"==typeof d.stackBy?d.stackBy:"stack",v="string"==typeof d.valueAccessor?d.valueAccessor:"value",b=(e,t,o)=>u(n=>{n("category",e),n("stack",t),n("value",o),"category"!==x&&n(x,e),"stack"!==g&&n(g,t),"value"!==v&&n(v,o)}),w=!1!==d.showCategoryLabels,M=null!==(o=d.labelPadding)&&void 0!==o?o:w?22:0,k=Math.max(0,h.height-M),$=[],A=new Map,j=[],N=new Set,S=new Map;for(const t of e.data){const e=f(t)+"",o=p(t)+"",i=y(t);A.has(e)||($.push(e),A.set(e,0),S.set(e,new Map)),N.has(o)||(N.add(o),j.push(o)),A.set(e,(null!==(n=A.get(e))&&void 0!==n?n:0)+i);const l=S.get(e);l.set(o,(null!==(r=l.get(o))&&void 0!==r?r:0)+i)}const C=d.categoryOrder?T(d.categoryOrder,$,e=>A.has(e)):$,O=d.stackOrder?T(d.stackOrder,j,()=>!0):j,z=C.reduce((e,t)=>{var o;return e+(null!==(o=A.get(t))&&void 0!==o?o:0)},0);if(0>=z)return{nodes:[]};const F=Math.max(0,h.width-m*Math.max(0,C.length-1)),L=[],I=[];let E=h.x;for(const t of C){const o=null!==(i=A.get(t))&&void 0!==i?i:0,n=o/z*F;if(0>=n)continue;I.push({cat:t,x:E,w:n});const r=S.get(t);let l=h.y;for(const i of O){const s=null!==(a=r.get(i))&&void 0!==a?a:0;if(0>=s)continue;const c=s/o*k;L.push({type:"rect",x:E,y:l,w:n,h:c,style:{fill:e.resolveColor(i),stroke:"none"},datum:b(t,i,s),group:i}),l+=c}E+=n+m}return{nodes:L,overlays:w&&I.length>0?function(e,t,o){const n=e.map((e,n)=>W({keyId:"marimekko-label-"+n,text:e.cat,x:e.x+e.w/2,y:t+12,anchor:"middle",baseline:"auto",maxWidth:e.w-4,fontSize:12,color:o}));return l.createElement(l.Fragment,null,...n)}(I,h.y+k+4,`var(--semiotic-text, ${null!==(c=e.theme.semantic.text)&&void 0!==c?c:"currentColor"})`):null}},exports.markCallout=F,exports.matchesHighlight=d,exports.mermaidDagLayout=e=>{var o,n,r,i,l,s,c,u,d,h,f,p,y;const m=e.config||{},x=e.dimensions.plot,g=null!==(o=m.direction)&&void 0!==o?o:"TD",v="LR"===g||"RL"===g,b="BT"===g||"RL"===g,w=null!==(n=m.layerAccessor)&&void 0!==n?n:"layer",A=null!==(r=m.rowAccessor)&&void 0!==r?r:"row",j=null!==(i=m.labelAccessor)&&void 0!==i?i:"label",N=null!==(l=m.shapeAccessor)&&void 0!==l?l:"shape",S=null!==(s=m.edgeLabelAccessor)&&void 0!==s?s:"label",C=null!==(c=m.nodeFill)&&void 0!==c?c:"var(--semiotic-surface, #20242d)",O=null!==(u=m.nodeStroke)&&void 0!==u?u:"var(--semiotic-border, #5a6573)",z=null!==(d=m.textColor)&&void 0!==d?d:"var(--semiotic-text, #e6e6e6)",W=null!==(h=m.edgeColor)&&void 0!==h?h:"var(--semiotic-text-secondary, #9aa0a6)",F=null!==(f=m.accentColor)&&void 0!==f?f:"var(--semiotic-warning, #d49a00)";if(0===e.nodes.length)return{sceneNodes:[],overlays:null};const L=new Map;let I=0;for(const t of e.nodes){const e=Math.round(Number(a(t,w,0)));I=Math.max(I,e);const o=L.get(e)||[];o.push(t),L.set(e,o)}const E=I+1;let D=1;for(const e of L.values())e.sort((e,t)=>Number(a(e,A,0))-Number(a(t,A,0))),D=Math.max(D,e.length);const T=v?x.width:x.height,Y=v?x.height:x.width,P=T/E,R=Y/(D+1),X=Math.max(44,Math.min(null!==(p=m.nodeWidth)&&void 0!==p?p:150,v?P-36:.92*R)),B=Math.max(26,Math.min(null!==(y=m.nodeHeight)&&void 0!==y?y:46,v?.7*R:.5*P)),V=(v?X:B)/2+6,q=Math.max(1,T-2*V),H=e=>(v?x.x:x.y)+V+(E>1?(b?E-1-e:e)/(E-1)*q:q/2),G=new Map,_=[],U=[];for(const[e,o]of L)o.forEach((n,r)=>{var i;const l=H(e),s=(v?x.y:x.x)+(r+1)/(o.length+1)*Y,c=v?l:s,u=v?s:l,d=a(n,N,"rect")+"",h=a(n,j,n.id)+"";G.set(n.id,{cx:c,cy:u,shape:d}),_.push({type:"rect",x:c-X/2,y:u-B/2,w:X,h:B,style:{fill:"transparent",stroke:"transparent"},datum:{id:n.id,name:h,type:null!==(i=k[d])&&void 0!==i?i:"process",shape:d},id:n.id,label:h}),U.push(t.jsxs("g",{children:[$(d,c,u,X,B,C,"diamond"===d?F:O,1.5),t.jsx("text",{x:c,y:u,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:z,style:{pointerEvents:"none"},children:M(h,Math.max(4,Math.floor((X-12)/7)))})]},"n-"+n.id))});const K=[];e.edges.forEach((e,o)=>{const n="string"==typeof e.target?e.target:e.target.id,r=G.get("string"==typeof e.source?e.source:e.source.id),i=G.get(n);if(!r||!i)return;const l=v?r.cx+X/2:r.cx,s=v?r.cy:r.cy+B/2,c=v?i.cx-X/2:i.cx,u=v?i.cy:i.cy-B/2,d=v?`M${l},${s} C${(l+c)/2},${s} ${(l+c)/2},${u} ${c},${u}`:`M${l},${s} C${l},${(s+u)/2} ${c},${(s+u)/2} ${c},${u}`,h=Math.atan2(u-s,c-l),f=c-9*Math.cos(h),p=u-9*Math.sin(h),y=4.5*-Math.sin(h),m=4.5*Math.cos(h),x=`${c},${u} ${f+y},${p+m} ${f-y},${p-m}`,g=a(e,S,void 0),b=(l+c)/2,w=(s+u)/2;K.push(t.jsxs("g",{children:[t.jsx("path",{d:d,fill:"none",stroke:W,strokeWidth:1.4}),t.jsx("polygon",{points:x,fill:W}),"string"==typeof g&&g.length>0&&t.jsxs("g",{children:[t.jsx("rect",{x:b-6.5*g.length/2-4,y:w-9,width:6.5*g.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:O,strokeWidth:.75}),t.jsx("text",{x:b,y:w,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:z,style:{pointerEvents:"none"},children:g})]})]},"e-"+o))});const J=t.jsxs("g",{className:"mermaid-dag",children:[K,U]});return{sceneNodes:_,overlays:J}},exports.packedClusterMatrix=e=>{var o,n,r,i,l,s,u,d,p,m,x,g,v,b,w,M,k,$,A,S,C,T,Y,P,R,X,B,V,q,H,G,_,U,K,J,Q,Z,ee,te,oe,ne,re;const ie=e.config||{},le=e.dimensions.plot,se=null!==(o=ie.columnAccessor)&&void 0!==o?o:"column",ae=null!==(n=ie.rowAccessor)&&void 0!==n?n:"row",ce=ie.sizeAccessor,ue=ie.colorAccessor,de=ie.symbolAccessor,he=ie.shadeAccessor,fe=ie.markerAccessor,pe=ie.iconAccessor,ye=null!==(r=ie.defaultSymbol)&&void 0!==r?r:"circle",[me,xe]=null!==(i=ie.sizeRange)&&void 0!==i?i:[2,8],ge=null!==(l=ie.shadeStrength)&&void 0!==l?l:.72,ve=null!==(s=ie.shadeReverse)&&void 0!==s&&s,be=null!==(u=ie.rowMode)&&void 0!==u?u:"banded",we=null!==(d=ie.cellSizing)&&void 0!==d?d:"proportional",Me=null!==(p=ie.proportionExponent)&&void 0!==p?p:1,ke=null!==(m=ie.columnGap)&&void 0!==m?m:16,$e=null!==(x=ie.rowGap)&&void 0!==x?x:12,Ae=null!==(g=ie.packPadding)&&void 0!==g?g:1,je=null!==(v=ie.iterations)&&void 0!==v?v:12,Ne=!1!==ie.showEnclosures,Se=!1!==ie.showColumnHeaders,Ce=!1!==ie.showRowLabels,Oe=Se?null!==(b=ie.headerHeight)&&void 0!==b?b:26:0,ze=Ce?null!==(w=ie.labelWidth)&&void 0!==w?w:66:0,We=ie.callouts&&ie.callouts.length>0?null!==(M=ie.footerHeight)&&void 0!==M?M:30:0,Fe=le.x+ze,Le=le.y+Oe,Ie=Math.max(1,le.width-ze),Ee=Math.max(1,le.height-Oe-We),De=[];for(const t of e.nodes){const e=null!==(k=t.data)&&void 0!==k?k:t;De.push({id:t.id,col:a(t,se,"—")+"",row:a(t,ae,"—")+"",sizeVal:ce?Number(a(t,ce,1)):1,colorKey:ue?a(t,ue,"")+"":"",symVal:de?a(t,de,"")+"":"",shadeVal:he?I(a(t,he,null)):NaN,marker:!!fe&&!!a(t,fe,!1),iconVal:pe?a(t,pe,"")+"":"",datum:e,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===De.length)return{sceneNodes:[]};let Te=1/0,Ye=-1/0;if(ce)for(const e of De)Number.isFinite(e.sizeVal)&&(Te>e.sizeVal&&(Te=e.sizeVal),e.sizeVal>Ye&&(Ye=e.sizeVal));ie.sizeDomain&&([Te,Ye]=ie.sizeDomain),Number.isFinite(Te)&&Number.isFinite(Ye)||(Te=0,Ye=1);const Pe=e=>{if(Te>=Ye)return(me+xe)/2;const t=Math.sqrt(E((e-Te)/(Ye-Te),0,1));return me+t*(xe-me)};let Re=1/0,Xe=-1/0;if(he)for(const e of De)Number.isFinite(e.shadeVal)&&(Re>e.shadeVal&&(Re=e.shadeVal),e.shadeVal>Xe&&(Xe=e.shadeVal));ie.shadeDomain&&([Re,Xe]=ie.shadeDomain);const Be=e=>{if(!he||!Number.isFinite(e)||Re>=Xe)return.5;const t=E((e-Re)/(Xe-Re),0,1);return ve?1-t:t},Ve=ie.colorMap,qe=new Map,He=(t,o)=>{let n=qe.get(t);return n||(n=y(Ve&&Ve[t]||e.resolveColor(t),ge),qe.set(t,n)),n(o)},Ge=new Map;if(ie.symbolMap)for(const[e,t]of Object.entries(ie.symbolMap))Ge.set(e,t);let _e=0;const Ue=ie.iconMap,Ke=e=>pe&&Ue&&Ue[e]?Ue[e]:null,Je=e=>pe?"circle":(e=>{if(!de)return ye;let t=Ge.get(e);return t||(t=j[_e%j.length],_e++,Ge.set(e,t)),t})(e.symVal),Qe=null!==($=ie.maxAreaFraction)&&void 0!==$?$:.4;let Ze=0;const et=Array(De.length),tt=Array(De.length);for(let e=0;De.length>e;e++){const t=De[e],o=Pe(t.sizeVal);et[e]=o,t.baseShape=Je(t),t.iconShape=Ke(t.iconVal);const n=O(t.baseShape,Math.PI*o*o);tt[e]=n,Ze+=Math.PI*n*n}const ot=Qe*Ie*Ee,nt=Ze>ot?Math.sqrt(ot/Ze):1;for(let e=0;De.length>e;e++){const t=De[e],o=et[e]*nt;t.size=Math.PI*o*o,t.packR=tt[e]*nt}const rt=new Map,it=new Map;for(const e of De)rt.set(e.col,(null!==(A=rt.get(e.col))&&void 0!==A?A:0)+1),it.set(e.row,(null!==(S=it.get(e.row))&&void 0!==S?S:0)+1);const lt=null!==(T=null===(C=ie.columnOrder)||void 0===C?void 0:C.filter(e=>rt.has(e)))&&void 0!==T?T:[...rt.keys()].sort((e,t)=>{var o,n;return(null!==(o=rt.get(t))&&void 0!==o?o:0)-(null!==(n=rt.get(e))&&void 0!==n?n:0)}),st=null!==(P=null===(Y=ie.rowOrder)||void 0===Y?void 0:Y.filter(e=>it.has(e)))&&void 0!==P?P:[...it.keys()].sort((e,t)=>{var o,n;return(null!==(o=it.get(t))&&void 0!==o?o:0)-(null!==(n=it.get(e))&&void 0!==n?n:0)}),at=f([Math.round(le.x),Math.round(le.y),Math.round(le.width),Math.round(le.height),Oe,ze,We,be,we,Me,ke,$e,Ae,je,me,xe,Te,Ye,Qe,lt.join(","),st.join(","),De.length,D(De)]),ct=L.getOrCompute(at,()=>function(e,t){var o;const n=new Map;for(const t of e){let e=n.get(t.col);e||(e=[],n.set(t.col,e)),e.push(t)}const r=t.columnOrder.filter(e=>n.has(e)),i=Math.max(1,t.innerW-t.columnGap*Math.max(0,r.length-1)),l=t.proportionExponent,s=r.map(e=>Math.pow(n.get(e).length,l)),a=s.reduce((e,t)=>e+t,0)||1,u=e=>"uniform"===t.cellSizing?i/r.length:s[e]/a*i,d=new Map,h=[];let f=t.innerX;for(let e=0;r.length>e;e++)h.push({col:r[e],x:f,w:u(e)}),f+=u(e)+t.columnGap;let p=1;const y=new Map,m=[],x=(e,t,o,n)=>{let r=y.get(e);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},y.set(e,r)),r.minX>t-n&&(r.minX=t-n),t+n>r.maxX&&(r.maxX=t+n),r.minY>o-n&&(r.minY=o-n),o+n>r.maxY&&(r.maxY=o+n)},g=(e,o,n,r,i,l)=>{const s=e.map(e=>({id:e.id,r:e.packR})),a=function(e,t,o,n,r,i,l,s){const a=t+n/2,c=o+r/2,u=new Map,d=e.length;if(0===d)return u;if(1===d)return u.set(e[0].id,{px:a,py:c}),u;const h=function(e){let t=e>>>0||1;return()=>(t=Math.imul(t,1664525)+1013904223>>>0,t/4294967296)}(s),f=new Float64Array(d);let p=0;for(let t=0;d>t;t++)f[t]=e[t].r+i,f[t]>p&&(p=f[t]);const y=Math.max(1,Math.round(Math.sqrt(d*n/Math.max(1,r)))),m=new Float64Array(d),x=new Float64Array(d),g=n/y,v=r/Math.ceil(d/y);for(let e=0;d>e;e++){const n=e%y,r=Math.floor(e/y);m[e]=t+(n+.3+.4*h())*g,x[e]=o+(r+.3+.4*h())*v}const b=Math.max(0,Math.min(l,14)),w=Math.max(1,2*p),M=new Map,k=Math.max(1,Math.ceil(n/w)+3),$=(e,t)=>(t+1)*k+(e+1);for(let e=0;b>e;e++){M.clear();for(let e=0;d>e;e++){const n=$(Math.floor((m[e]-t)/w),Math.floor((x[e]-o)/w)),r=M.get(n);r?r.push(e):M.set(n,[e])}for(let e=0;d>e;e++){const n=Math.floor((m[e]-t)/w),r=Math.floor((x[e]-o)/w);for(let t=-1;1>=t;t++)for(let o=-1;1>=o;o++){const i=M.get($(n+t,r+o));if(i)for(let t=0;i.length>t;t++){const o=i[t];if(e>=o)continue;let n=m[o]-m[e],r=x[o]-x[e];const l=f[e]+f[o],s=n*n+r*r;if(l*l>s)if(s>1e-9){const t=Math.sqrt(s),i=(l-t)/2;n/=t,r/=t,m[e]-=n*i,x[e]-=r*i,m[o]+=n*i,x[o]+=r*i}else{const t=2.39996323*e;m[e]+=Math.cos(t)*f[e],x[e]+=Math.sin(t)*f[e]}}}}for(let e=0;d>e;e++){const i=f[e],l=t+i,s=t+n-i,u=o+i,d=o+r-i;m[e]=s>l?E(m[e],l,s):a,x[e]=d>u?E(x[e],u,d):c}}for(let t=0;d>t;t++)u.set(e[t].id,{px:m[t],py:x[t]});return u}(s,o,n,r,i,t.packPadding,t.iterations,p++);let c=1/0,u=1/0,h=-1/0,f=-1/0;for(const e of s){const t=a.get(e.id);d.set(e.id,{px:t.px,py:t.py}),x(l,t.px,t.py,e.r),c>t.px-e.r&&(c=t.px-e.r),t.px+e.r>h&&(h=t.px+e.r),u>t.py-e.r&&(u=t.py-e.r),t.py+e.r>f&&(f=t.py+e.r)}return Number.isFinite(c)?{x:c-4,y:u-4,w:h-c+8,h:f-u+8}:null};if("banded"===t.rowMode){const i=new Map;for(const t of e)i.set(t.row,(null!==(o=i.get(t.row))&&void 0!==o?o:0)+1);const s=t.rowOrder.filter(e=>i.has(e)),a=Math.max(1,t.innerH-t.rowGap*Math.max(0,s.length-1)),u=s.map(e=>Math.pow(i.get(e),l)),f=u.reduce((e,t)=>e+t,0)||1,p=new Map;let m=t.innerY+t.innerH;for(let e=0;s.length>e;e++){const o="uniform"===t.cellSizing?a/s.length:u[e]/f*a,n=m-o;p.set(s[e],{y:n,h:o}),m=n-t.rowGap}r.forEach((e,t)=>{const o=c(n.get(e),e=>e.row);for(const e of s){const n=o.get(e),r=p.get(e);n&&r&&g(n,h[t].x,r.y,h[t].w,r.h,e)}});const x=[],v=new Map;for(const e of s){const t=p.get(e);v.set(e,t.y+t.h/2);const o=y.get(e);o&&Number.isFinite(o.minX)&&x.push({x:o.minX-4,y:o.minY-4,w:o.maxX-o.minX+8,h:o.maxY-o.minY+8})}return{positions:d,enclosures:x,colBands:h,rowLabelY:v}}const v=new Map;r.forEach((e,o)=>{const r=c(n.get(e),e=>e.row),i=t.rowOrder.filter(e=>r.has(e)),s=Math.max(1,t.innerH-t.rowGap*Math.max(0,i.length-1)),a=i.map(e=>Math.pow(r.get(e).length,l)),u=a.reduce((e,t)=>e+t,0)||1;let d=t.innerY+t.innerH;i.forEach((e,n)=>{var l;const c="uniform"===t.cellSizing?s/i.length:a[n]/u*s,f=d-c,p=g(r.get(e),h[o].x,f,h[o].w,c,e);if(p){m.push(p);const t=null!==(l=v.get(e))&&void 0!==l?l:{sum:0,n:0};t.sum+=p.y+p.h/2,t.n+=1,v.set(e,t)}d=f-t.rowGap})});const b=new Map;for(const[e,t]of v)b.set(e,t.sum/t.n);return{positions:d,enclosures:m,colBands:h,rowLabelY:b}}(De,{columnOrder:lt,rowOrder:st,innerX:Fe,innerY:Le,innerW:Ie,innerH:Ee,rowMode:be,cellSizing:we,proportionExponent:Me,columnGap:ke,rowGap:$e,packPadding:Ae,iterations:je})),ut=e.selection,dt=(null==ut?void 0:ut.isActive)?ut.predicate:null,ht=null!==(R=ie.highlight)&&void 0!==R?R:null,ft=null!==(X=ie.dimOpacity)&&void 0!==X?X:.16,pt=ie.markStroke,yt=null!==(B=ie.markStrokeWidth)&&void 0!==B?B:0,mt=null!==(V=ie.markerColor)&&void 0!==V?V:"#ffffff",xt=null!==(q=ie.iconColor)&&void 0!==q?q:"rgba(255,255,255,0.92)",gt=null!==(H=ie.iconStrokeWidth)&&void 0!==H?H:1,vt=null!==(G=ie.iconScale)&&void 0!==G?G:.72,bt=[],wt=[],Mt=[];for(const e of De){const t=ct.positions.get(e.id);if(!t)continue;const o=h(e.datum,{highlight:ht,predicate:dt,dimOpacity:ft}),n={type:"symbol",cx:t.px,cy:t.py,size:e.size,symbolType:e.baseShape,style:Object.assign({fill:He(e.colorKey,Be(e.shadeVal)),opacity:o},pt?{stroke:pt,strokeWidth:yt}:{}),datum:e.datum,id:e.id,label:e.id+""};if(bt.push(n),e.iconShape){const n=Math.sqrt(e.size/Math.PI)*vt,r=O(e.iconShape,100);Mt.push({x:t.px,y:t.py,size:r>0?n/r*100*(n/r):Math.PI*n*n,shape:e.iconShape,opacity:o})}e.marker&&o>ft+.001&&wt.push({x:t.px,y:t.py,r:Math.max(1,.4*Math.sqrt(e.size/Math.PI))})}const kt=[];if(ie.callouts&&ie.callouts.length>0){const e=null!==(_=ie.calloutColor)&&void 0!==_?_:"var(--semiotic-text, #f4f4f8)",t=le.y+le.height-(We>0?.45*We:9),o=[];for(let e=0;ie.callouts.length>e;e++){const t=ie.callouts[e],n=De.find(e=>e.datum[t.field]+""==t.value+"");if(!n)continue;const r=ct.positions.get(n.id);r&&o.push({c:t,ci:e,px:r.px,py:r.py,markR:Math.sqrt(n.size/Math.PI)})}const n=o.filter(e=>null==e.c.at).sort((e,t)=>e.px-t.px),r=new Map;n.forEach((e,t)=>{r.set(e.ci,Fe+(t+.5)/n.length*Ie)});for(const n of o){const o=n.c;let i=null!==(U=r.get(n.ci))&&void 0!==U?U:n.px,l=t;const s=null!==(K=o.connector)&&void 0!==K?K:r.has(n.ci)?"elbow":"straight";"object"==typeof o.at&&o.at?(i=o.at.x,l=o.at.y):"number"==typeof o.at&&(l=le.y+o.at*le.height),kt.push({keyId:"callout-"+n.ci,markX:n.px,markY:n.py,labelX:i,labelY:l,label:o.label,connector:s,markRadius:Math.max(n.markR+3,7),stroke:e,color:e,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const $t=function(e,o){var n,r;const i=null!==(n=o.columnLabel)&&void 0!==n?n:e=>e,l=null!==(r=o.rowLabel)&&void 0!==r?r:e=>e;return t.jsxs("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[o.showEnclosures&&e.enclosures.map((e,t)=>z({keyId:"enc-"+t,x:e.x,y:e.y,width:e.w,height:e.h,radius:o.enclosureRadius,stroke:o.enclosureColor,strokeWidth:o.enclosureWidth,opacity:o.enclosureOpacity})),o.iconMarks.length>0&&t.jsx("g",{className:"packed-cluster-matrix-icons",children:o.iconMarks.map((e,n)=>t.jsx("path",{d:N(e.shape,e.size),transform:`translate(${e.x},${e.y})`,fill:"none",stroke:o.iconColor,strokeWidth:o.iconStrokeWidth,opacity:e.opacity},"ic-"+n))}),o.markerDots.length>0&&t.jsx("g",{className:"packed-cluster-matrix-markers",children:o.markerDots.map((e,n)=>t.jsx("circle",{cx:e.x,cy:e.y,r:e.r,fill:o.markerColor},"mk-"+n))}),o.showColumnHeaders&&e.colBands.map((e,t)=>W({keyId:"col-"+t,text:i(e.col),x:e.x+e.w/2,y:o.headerY,anchor:"middle",fontSize:o.headerFontSize,fontWeight:700,color:o.headerColor})),o.showRowLabels&&[...e.rowLabelY].map(([e,t])=>W({keyId:"row-"+e,text:l(e),x:o.labelX,y:t,anchor:"end",fontSize:o.labelFontSize,fontWeight:600,color:o.labelColor})),o.callouts.map(e=>F(e))]})}(ct,{markerDots:wt,markerColor:mt,iconMarks:Mt,iconColor:xt,iconStrokeWidth:gt,callouts:kt,showEnclosures:Ne,showColumnHeaders:Se,showRowLabels:Ce,enclosureColor:null!==(J=ie.enclosureColor)&&void 0!==J?J:"var(--semiotic-text, #f4f4f8)",enclosureRadius:null!==(Q=ie.enclosureRadius)&&void 0!==Q?Q:9,enclosureOpacity:null!==(Z=ie.enclosureOpacity)&&void 0!==Z?Z:.5,enclosureWidth:null!==(ee=ie.enclosureWidth)&&void 0!==ee?ee:1.5,headerColor:null!==(te=ie.headerColor)&&void 0!==te?te:"var(--semiotic-text, #f4f4f8)",labelColor:null!==(oe=ie.labelColor)&&void 0!==oe?oe:"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:null!==(ne=ie.headerFontSize)&&void 0!==ne?ne:13,labelFontSize:null!==(re=ie.labelFontSize)&&void 0!==re?re:11,headerY:le.y+.62*Oe,labelX:le.x+ze-10,columnLabel:ie.columnLabel,rowLabel:ie.rowLabel});return{sceneNodes:bt,overlays:$t}},exports.parallelCoordinatesLayout=e=>{var t,o,n,i,s,a,c,u,d,f,p,y;const m=e.config,{plot:x}=e.dimensions,g=null!==(t=m.fields)&&void 0!==t?t:[];if(2>g.length||0>=x.width||0>=x.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};const v={};for(const t of g){if(null===(o=m.domains)||void 0===o?void 0:o[t]){v[t]=m.domains[t];continue}let n=1/0,r=-1/0;for(const o of e.data){const e=Number(o[t]);Number.isFinite(e)&&(n>e&&(n=e),e>r&&(r=e))}v[t]=Number.isFinite(n)&&Number.isFinite(r)&&n!==r?[n,r]:[0,1]}const b=!1!==m.showAxes,w=b?null!==(n=m.axisLabelPadding)&&void 0!==n?n:24:8,M=b?18:8,k=g.map(e=>r.scaleLinear().domain(v[e]).range([x.y+x.height-M,x.y+w])),$=g.map((e,t)=>1===g.length?x.x+x.width/2:x.x+t/(g.length-1)*x.width),A=m.colorBy?"function"==typeof m.colorBy?m.colorBy:e=>{var t;return(null!==(t=e[m.colorBy])&&void 0!==t?t:"")+""}:null,j=null!==(i=m.opacity)&&void 0!==i?i:.45,N=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,S=null!==(a=e.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",C=null!==(c=m.dimmedOpacity)&&void 0!==c?c:.08,O=m.highlightFn,z=[],F=[];for(const t of e.data){const o=A?e.resolveColor(A(t)+""):S,n=!O||O(t),r=h(t,{predicate:O,baseOpacity:j,dimOpacity:C,brighten:.4}),i=n?F:z;for(let e=0;g.length-1>e;e++){const l=Number(t[g[e]]),s=Number(t[g[e+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:$[e],y1:k[e](l),x2:$[e+1],y2:k[e+1](s),style:{stroke:o,strokeWidth:O&&n?N+.75:N,opacity:r,fill:"none"},datum:t};i.push(a)}if(m.showPoints)for(let e=0;g.length>e;e++){const n=Number(t[g[e]]);if(!Number.isFinite(n))continue;const l={type:"point",x:$[e],y:k[e](n),r:2.5,style:{fill:o,stroke:"none",opacity:Math.min(1,r+.3)},datum:t};i.push(l)}}let L=null;if(b){const t=`var(--semiotic-border, ${null!==(u=e.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,o=`var(--semiotic-text, ${null!==(d=e.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,n=`var(--semiotic-text-secondary, ${null!==(f=e.theme.semantic.textSecondary)&&void 0!==f?f:"#888"})`,r=x.y+w,i=x.y+x.height-M,s=[];for(let e=0;g.length>e;e++){const a=g[e],c=$[e],u=null!==(y=null===(p=m.tickFormat)||void 0===p?void 0:p[a])&&void 0!==y?y:e=>e.toLocaleString();s.push(l.createElement("line",{key:"pc-axis-line-"+e,x1:c,x2:c,y1:r,y2:i,stroke:t,strokeWidth:1})),s.push(W({keyId:"pc-axis-label-"+e,text:a,x:c,y:x.y+w-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:o}));const[d,h]=v[a],f=5;for(let o=0;f>o;o++){const r=d+(h-d)*o/(f-1),i=k[e](r);s.push(l.createElement("line",{key:`pc-tick-${e}-${o}`,x1:c-3,x2:c+3,y1:i,y2:i,stroke:t,strokeWidth:1}),W({keyId:`pc-ticktext-${e}-${o}`,text:u(r),x:c+6,y:i+3,anchor:"start",baseline:"auto",fontSize:10,color:n}))}}L=l.createElement(l.Fragment,null,...s)}return{nodes:z.concat(F),overlays:L}},exports.readField=a,exports.roundedEnclosure=z,exports.shade=function(e,t,o=.72){return y(e,o)(t)},exports.signatureKey=f,exports.symbolExtent=O,exports.symbolPathString=N,exports.symbolRadius=S,exports.useCustomLayoutSelection=function(){var e;return null!==(e=l.useContext(de))&&void 0!==e?e:ue},exports.waffleLayout=e=>{var t,o,n,r,i,l;const s=e.config,a=null!==(t=s.rows)&&void 0!==t?t:10,c=null!==(o=s.columns)&&void 0!==o?o:10,d=null!==(n=s.gutter)&&void 0!==n?n:2,h=a*c;if(0>=a||0>=c||0>=h)return{nodes:[]};const{plot:f}=e.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const p=(f.width-d*(c-1))/c,y=(f.height-d*(a-1))/a;if(0>=p||0>=y)return{nodes:[]};const m=null!==(r=null==(x=s.categoryAccessor)?null:"function"==typeof x?x:e=>e[x])&&void 0!==r?r:()=>"_default";var x;const g=null!==(i=function(e){return null==e?null:"function"==typeof e?e:t=>Number(t[e])}(s.valueAccessor))&&void 0!==i?i:()=>1,v=new Map,b=[];for(const t of e.data){const e=m(t)+"",o=Number(g(t)),n=Number.isFinite(o)?Math.max(0,o):0;v.has(e)||b.push(e),v.set(e,(null!==(l=v.get(e))&&void 0!==l?l:0)+n)}const w=Array.from(v.values()).reduce((e,t)=>e+t,0);if(0>=w)return{nodes:[]};let M;if(s.categoryOrder&&s.categoryOrder.length>0){const e=new Set,t=[];for(const o of s.categoryOrder)v.has(o)&&!e.has(o)&&(e.add(o),t.push(o));M=[...t,...b.filter(t=>!e.has(t))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(e=>{var t;return{cat:e,exact:(null!==(t=v.get(e))&&void 0!==t?t:0)/w*h}}),$=k.map(e=>Object.assign(Object.assign({},e),{count:Math.floor(e.exact)})),A=$.reduce((e,t)=>e+t.count,0),j=$.map((e,t)=>({i:t,rem:e.exact-e.count})).sort((e,t)=>t.rem-e.rem);for(let e=0;h-A>e;e++)$[j[e%j.length].i].count+=1;const N="string"==typeof s.categoryAccessor?s.categoryAccessor:"category",S="string"==typeof s.valueAccessor?s.valueAccessor:"value",C=(e,t,o)=>u(n=>{var r,i;n("category",e),n("value",null!==(r=v.get(e))&&void 0!==r?r:0),"category"!==N&&n(N,e),"value"!==S&&n(S,null!==(i=v.get(e))&&void 0!==i?i:0),n("cells",o),n("_waffleCategory",e),n("_waffleIndex",t)}),O=[];let z=0;for(const t of $){const o=e.resolveColor(t.cat);for(let e=0;t.count>e;e++)O.push({type:"rect",x:f.x+z%c*(p+d),y:f.y+(a-1-Math.floor(z/c))*(y+d),w:p,h:y,style:{fill:o,stroke:"none"},datum:C(t.cat,z,t.count),group:t.cat}),z++}return{nodes:O}};
@@ -1 +1 @@
1
- import{interpolateRgb as t}from"d3-interpolate";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{scaleLinear as i}from"d3-scale";function r(t){return"function"==typeof t?t:e=>e[t]}function l(t){const e=Object.create(null);return t((t,n)=>{e[t]=n}),e}const s=t=>{var e,n,o,i,r,s;const a=t.config,c=null!==(e=a.rows)&&void 0!==e?e:10,u=null!==(n=a.columns)&&void 0!==n?n:10,d=null!==(o=a.gutter)&&void 0!==o?o:2,h=c*u;if(0>=c||0>=u||0>=h)return{nodes:[]};const{plot:f}=t.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=(f.width-d*(u-1))/u,m=(f.height-d*(c-1))/c;if(0>=y||0>=m)return{nodes:[]};const p=null!==(i=null==(g=a.categoryAccessor)?null:"function"==typeof g?g:t=>t[g])&&void 0!==i?i:()=>"_default";var g;const v=null!==(r=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(a.valueAccessor))&&void 0!==r?r:()=>1,x=new Map,b=[];for(const e of t.data){const t=p(e)+"",n=Number(v(e)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(t)||b.push(t),x.set(t,(null!==(s=x.get(t))&&void 0!==s?s:0)+o)}const w=Array.from(x.values()).reduce((t,e)=>t+e,0);if(0>=w)return{nodes:[]};let M;if(a.categoryOrder&&a.categoryOrder.length>0){const t=new Set,e=[];for(const n of a.categoryOrder)x.has(n)&&!t.has(n)&&(t.add(n),e.push(n));M=[...e,...b.filter(e=>!t.has(e))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(t=>{var e;return{cat:t,exact:(null!==(e=x.get(t))&&void 0!==e?e:0)/w*h}}),A=k.map(t=>Object.assign(Object.assign({},t),{count:Math.floor(t.exact)})),$=A.reduce((t,e)=>t+e.count,0),N=A.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;h-$>t;t++)A[N[t%N.length].i].count+=1;const C="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",O="string"==typeof a.valueAccessor?a.valueAccessor:"value",j=(t,e,n)=>l(o=>{var i,r;o("category",t),o("value",null!==(i=x.get(t))&&void 0!==i?i:0),"category"!==C&&o(C,t),"value"!==O&&o(O,null!==(r=x.get(t))&&void 0!==r?r:0),o("cells",n),o("_waffleCategory",t),o("_waffleIndex",e)}),S=[];let W=0;for(const e of A){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)S.push({type:"rect",x:f.x+W%u*(y+d),y:f.y+(c-1-Math.floor(W/u))*(m+d),w:y,h:m,style:{fill:n,stroke:"none"},datum:j(e.cat,W,e.count),group:e.cat}),W++}return{nodes:S}},a=864e5,c=e=>{var n,o,i,r,l,s,c,d;const h=e.config,{plot:f}=e.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=t=>{const e="function"==typeof h.dateAccessor?h.dateAccessor(t):t[h.dateAccessor];return e instanceof Date?e:new Date(e)},m=t=>{const e="function"==typeof h.valueAccessor?h.valueAccessor(t):t[h.valueAccessor];return Number(e)},p=new Map;let g=null;for(const t of e.data){const e=y(t);if(!isFinite(e.getTime()))continue;null==g&&(g=e.getUTCFullYear());const o=u(e),i=m(t);p.set(o,(null!==(n=p.get(o))&&void 0!==n?n:0)+(Number.isFinite(i)?i:0))}const v=null!==(i=null!==(o=h.year)&&void 0!==o?o:g)&&void 0!==i?i:(new Date).getUTCFullYear();let x=1/0,b=-1/0;for(const t of p.values())x>t&&(x=t),t>b&&(b=t);x===1/0&&(x=0,b=0);const[w,M]=null!==(r=h.colorRamp)&&void 0!==r?r:[null!==(l=e.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=e.theme.semantic.primary)&&void 0!==s?s:"#216e39"],k=e=>{if(b===x)return w;const n=(e-x)/(b-x);return t(w,M)(n)},A=null!==(c=h.gutter)&&void 0!==c?c:2,$=null!==(d=h.labelInset)&&void 0!==d?d:0,N=Math.min((f.width-$-53*A)/54,(f.height-6*A)/7);if(0>=N)return{nodes:[]};const C=new Date(Date.UTC(v,0,1)),O=C.getUTCDay(),j=new Date(C.getTime()-O*a),S=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const n=new Date(j.getTime()+(7*t+e)*a);if(n.getUTCFullYear()!==v)continue;const o=u(n),i=p.get(o),r=null==i?w:k(i);S.push({type:"rect",x:f.x+$+t*(N+A),y:f.y+e*(N+A),w:N,h:N,style:{fill:r,stroke:"none"},datum:{date:n,value:null!=i?i:0}})}return{nodes:S}};function u(t){return`${t.getUTCFullYear()}-${d(t.getUTCMonth()+1)}-${d(t.getUTCDate())}`}function d(t){return 10>t?"0"+t:t+""}const h=t=>{var e,n,o,i,r,l,s,a,c;const u=t.config,d=null!==(e=u.nodeWidth)&&void 0!==e?e:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",y=null!==(i=u.edgeCurve)&&void 0!==i?i:"curved",m=!1!==u.showLabels,p=null!==(r=u.labelAccessor)&&void 0!==r?r:"id",g="function"==typeof p?p:t=>{var e,n;const o=t.data,i=o?o[p]:void 0;return(null!==(n=null!==(e=null!=i?i:t[p])&&void 0!==e?e:t.id)&&void 0!==n?n:"")+""},v=new Map,x=[],b=[],w=t=>{var e,n,o;const i=null!==(e=t.data)&&void 0!==e?e:{};return{x:"number"==typeof i.x?i.x:t.x,y:"number"==typeof i.y?i.y:t.y,w:null!==(n="number"==typeof i.width?i.width:t.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:t.height)&&void 0!==o?o:h}};for(const e of t.nodes){const{x:n,y:o,w:i,h:r}=w(e);null!=n&&null!=o&&(v.set(e.id,{x:n,y:o,w:i,h:r}),x.push({type:"rect",x:n-i/2,y:o-r/2,w:i,h:r,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:t.resolveColor(e.id),stroke:`var(--semiotic-surface, ${null!==(s=t.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:e,id:e.id,label:g(e)+""}),m&&b.push({x:n,y:o,text:g(e)+"",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=v.get("string"==typeof e.source?e.source:e.source.id),i=v.get(n);if(!o||!i)continue;const r="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:i.x,y:i.y-i.h/2}:{x:i.x-i.w/2,y:i.y};if("line"===y)M.push({type:"line",x1:r.x,y1:r.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=t.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:e});else{const n=(r.y+l.y)/2,o=(r.x+l.x)/2;M.push({type:"curved",pathD:"vertical"===f?`M${r.x},${r.y} C${r.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${r.x},${r.y} C${o},${r.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=t.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:x,sceneEdges:M,labels:b}},f=t=>{var e,n,o,i,r,l,s,a,c;const u=t.config,d=null!==(e=u.nodeWidth)&&void 0!==e?e:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",y=!1!==u.showLabels,m=null!==(i=u.labelAccessor)&&void 0!==i?i:"label",p="function"==typeof m?m:t=>{var e,n;const o=t.data,i=o?o[m]:void 0;return(null!==(n=null!==(e=null!=i?i:t[m])&&void 0!==e?e:t.id)&&void 0!==n?n:"")+""},g=new Map,v=[],x=[],b=t=>{var e,n,o;const i=null!==(e=t.data)&&void 0!==e?e:{};return{x:"number"==typeof i.x?i.x:t.x,y:"number"==typeof i.y?i.y:t.y,w:null!==(n="number"==typeof i.width?i.width:t.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:t.height)&&void 0!==o?o:h}};for(const e of t.nodes){const{x:n,y:o,w:i,h:s}=b(e);null!=n&&null!=o&&(g.set(e.id,{x:n,y:o,w:i,h:s}),v.push({type:"rect",x:n-i/2,y:o-s/2,w:i,h:s,style:{fill:null!==(r=u.nodeFill)&&void 0!==r?r:t.resolveColor(e.id),stroke:`var(--semiotic-border, ${null!==(l=t.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:e,id:e.id,label:p(e)+""}),y&&x.push({x:n,y:o,text:p(e)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const w=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=t.theme.semantic.border)&&void 0!==a?a:"#666"})`,M=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(!n||!o)continue;const i=null!==(c=e.data)&&void 0!==c?c:{},r=Array.isArray(i.points)?i.points:e.points;if(r&&r.length>=2)if("smooth"!==f||3>r.length){const t="M"+r.map(t=>`${t.x},${t.y}`).join(" L ");M.push({type:"curved",pathD:t,style:{stroke:w,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${r[0].x},${r[0].y}`;for(let e=1;r.length-1>e;e++)t+=` Q${r[e].x},${r[e].y} ${(r[e].x+r[e+1].x)/2},${(r[e].y+r[e+1].y)/2}`;const n=r[r.length-1];t+=` T${n.x},${n.y}`,M.push({type:"curved",pathD:t,style:{stroke:w,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:w,strokeWidth:1},datum:e})}return{sceneNodes:v,sceneEdges:M,labels:x}},y={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},m={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function p(t,e,n){const o=t.data,i=o?o[e]:void 0;if(null!=i)return i;const r=t[e];return null==r?n:r}function g(t){return Array.isArray(t)?t.map((t,e)=>{var n,o;return"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(null!==(n=t.storeName)&&void 0!==n?n:"")+"",slotIndex:null!==(o=t.slotIndex)&&void 0!==o?o:e}}):[]}const v=t=>{var o,i,r,l,s,a,c,u,d,h,f,v,x,b,w,M,k,A,$,N,C,O,j,S,W;const F=t.config||{},I=t.dimensions.plot,T=null!==(o=F.layerAccessor)&&void 0!==o?o:"x",E=null!==(i=F.rowAccessor)&&void 0!==i?i:"y",D=null!==(r=F.partitionAccessor)&&void 0!==r?r:"partition",L=null!==(l=F.semanticAccessor)&&void 0!==l?l:"semantic",P=null!==(s=F.labelAccessor)&&void 0!==s?s:"label",z=null!==(a=F.storesAccessor)&&void 0!==a?a:"stores",B=null!==(c=F.backEdgeAccessor)&&void 0!==c?c:"isBackEdge",U=null!==(u=F.edgeTypeAccessor)&&void 0!==u?u:"edgeType",G=Object.assign(Object.assign({},y),F.partitionColors),H=Object.assign(Object.assign({},m),F.edgeColors),V=null!==(d=F.accentColor)&&void 0!==d?d:"var(--semiotic-focus, #ffcc33)",Y=null!==(h=F.borderColor)&&void 0!==h?h:"var(--semiotic-border, #555)",_=null!==(f=F.dimOpacity)&&void 0!==f?f:.14,R=null!==(v=F.edgeOpacity)&&void 0!==v?v:.5,J=null!==(x=F.edgeWidth)&&void 0!==x?x:1.25,K=null!==(w=null!==(b=F.backEdgeWidth)&&void 0!==b?b:F.edgeWidth)&&void 0!==w?w:1.5,Q=!1!==F.showStoreChips,X=null!==(M=F.storeChipColor)&&void 0!==M?M:"var(--semiotic-info, #6a8caf)";let q=F.layerCount,Z=F.maxLayerSize;if(null==q||null==Z){let e=0;const n=new Map;for(const o of t.nodes){const t=Math.round(Number(p(o,T,0)));e=Math.max(e,t),n.set(t,(null!==(k=n.get(t))&&void 0!==k?k:0)+1)}q=null!=q?q:e+1,Z=null!=Z?Z:Math.max(1,...n.values())}const tt=I.width/Math.max(1,q),et=I.height/Math.max(1,Z);let nt=Math.min(null!==(A=F.nodeWidth)&&void 0!==A?A:172,Math.max(8,tt-(null!==($=F.minGapX)&&void 0!==$?$:26))),ot=Math.min(null!==(N=F.nodeHeight)&&void 0!==N?N:54,Math.max(8,et-(null!==(C=F.minGapY)&&void 0!==C?C:18)));const it=F.lod&&"auto"!==F.lod?F.lod:16>nt?"dot":48>nt?"icon":108>nt?"compact":"full";if("dot"===it){const t=Math.min(nt,ot,11);nt=t,ot=t}const rt=Math.max(1,I.width-nt),lt=Math.max(1,I.height-ot),st=Math.max(1,Z-1),at=t=>I.x+nt/2+(q>1?t/(q-1):.5)*rt,ct=t=>I.y+ot/2+(t+st/2)/st*lt,ut=F.reachableIds?new Set(F.reachableIds):null,dt=null!==(O=F.selectedId)&&void 0!==O?O:null,ht=t.selection,ft=new Map,yt=new Map,mt=[],pt=[];for(const e of t.nodes){const t=e.id,n=Number(p(e,T,0)),o=Number(p(e,E,0)),i=p(e,D,"processor")+"",r=p(e,L,"processor")+"",l=p(e,P,t)+"",s=g(p(e,z,[])),a=null!==(j=e.data)&&void 0!==j?j:e,c=at(n),u=ct(o);ft.set(t,{cx:c,cy:u});const d=ut?ut.has(t):null,h=(null==ht?void 0:ht.isActive)?ht.predicate(a):null,f=null!==d?!d:null!==h&&!h;yt.set(t,f);const y=null!=dt&&t===dt,m=f&&!y?_:1,v=null!==(S=G[i])&&void 0!==S?S:G.unknown;"dot"===it?mt.push({type:"circle",cx:c,cy:u,r:nt/2,style:{fill:v,opacity:m,stroke:y?V:"transparent",strokeWidth:y?2:0},datum:e,id:t,label:l}):(mt.push({type:"rect",x:c-nt/2,y:u-ot/2,w:nt,h:ot,style:{fill:v,opacity:m,stroke:y?V:Y,strokeWidth:y?3:1},datum:e,id:t,label:l}),pt.push({id:t,cx:c,cy:u,partition:i,semantic:r,label:l,stores:s,opacity:m,selected:y,node:a}))}const gt=[];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=ft.get(t),i=ft.get(n);if(!o||!i)continue;const r=!!p(e,B,!1),l=p(e,U,"internal")+"",s=yt.get(t)||yt.get(n)?Math.min(R,1.4*_):R,a=r?H.back:null!==(W=H[l])&&void 0!==W?W:H.internal;let c;if(r){const t=o.cx,e=o.cy+ot/2,n=i.cx,r=i.cy+ot/2,l=Math.max(48,.28*Math.abs(t-n))+ot;c=`M${t},${e} C${t},${e+l} ${n},${r+l} ${n},${r}`}else{const t=o.cx+nt/2,e=o.cy,n=i.cx-nt/2,r=i.cy,l=(t+n)/2;c=`M${t},${e} C${l},${e} ${l},${r} ${n},${r}`}const u={type:"curved",pathD:c,style:Object.assign({stroke:a,strokeWidth:r?K:J,fill:"none",opacity:s},r?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:e};gt.push(u)}const vt=0===pt.length?null:e("g",{className:"lineage-dag-glyphs",children:pt.map(t=>function(t,o){var i,r;const{w:l,h:s,lod:a}=o,c="icon"===a?Math.min(l,s):Math.min(s-14,26),u=null!==(r=null!==(i=o.partColors[t.partition])&&void 0!==i?i:o.partColors.unknown)&&void 0!==r?r:"#5a5a6a",d="icon"===a?0:8+c+8,h=null!=o.renderIcon?o.renderIcon({semantic:t.semantic,partition:t.partition,size:c,color:u,node:t.node}):function(t,o,i){var r;const l=o.startsWith("topic")?"T":null!==(r={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])&&void 0!==r?r:"PR";return n("g",{children:[e("rect",{width:i,height:i,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),e("text",{x:i/2,y:i/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*i,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:l})]})}(t.semantic,t.partition,c),f="full"===a,y="icon"!==a,m="full"===a&&o.showChips&&t.stores.length>0;return n("g",{transform:`translate(${t.cx-l/2}, ${t.cy-s/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[e("g",{transform:`translate(${"icon"===a?(l-c)/2:8}, ${(s-c)/2})`,children:h}),y&&e("foreignObject",{x:d,y:f?s/2-12:s/2-9,width:Math.max(8,l-d-8),height:18,style:{pointerEvents:"none"},children:e("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===a?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),f&&e("text",{x:d,y:s/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:o.typeLabel?o.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),m&&t.stores.map((t,n)=>e("rect",{x:d+15*n,y:s-10,width:12,height:5,rx:1.5,fill:o.chipColor,children:e("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:nt,h:ot,lod:it,partColors:G,chipColor:X,showChips:Q,renderIcon:F.renderIcon,typeLabel:F.typeLabel}))});return{sceneNodes:mt,sceneEdges:gt,overlays:vt}},x=t=>{var e,n,i,s,a,c,u;const d=t.config,{plot:h}=t.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=r(d.categoryAccessor),y=r(d.stackBy),m=t=>{const e="function"==typeof d.valueAccessor?d.valueAccessor(t):t[d.valueAccessor],n=Number(e);return Number.isFinite(n)&&n>0?n:0},p=null!==(e=d.gutter)&&void 0!==e?e:2,g="string"==typeof d.categoryAccessor?d.categoryAccessor:"category",v="string"==typeof d.stackBy?d.stackBy:"stack",x="string"==typeof d.valueAccessor?d.valueAccessor:"value",w=(t,e,n)=>l(o=>{o("category",t),o("stack",e),o("value",n),"category"!==g&&o(g,t),"stack"!==v&&o(v,e),"value"!==x&&o(x,n)}),M=!1!==d.showCategoryLabels,k=null!==(n=d.labelPadding)&&void 0!==n?n:M?22:0,A=Math.max(0,h.height-k),$=[],N=new Map,C=[],O=new Set,j=new Map;for(const e of t.data){const t=f(e)+"",n=y(e)+"",o=m(e);N.has(t)||($.push(t),N.set(t,0),j.set(t,new Map)),O.has(n)||(O.add(n),C.push(n)),N.set(t,(null!==(i=N.get(t))&&void 0!==i?i:0)+o);const r=j.get(t);r.set(n,(null!==(s=r.get(n))&&void 0!==s?s:0)+o)}const S=d.categoryOrder?b(d.categoryOrder,$,t=>N.has(t)):$,W=d.stackOrder?b(d.stackOrder,C,()=>!0):C,F=S.reduce((t,e)=>{var n;return t+(null!==(n=N.get(e))&&void 0!==n?n:0)},0);if(0>=F)return{nodes:[]};const I=Math.max(0,h.width-p*Math.max(0,S.length-1)),T=[],E=[];let D=h.x;for(const e of S){const n=null!==(a=N.get(e))&&void 0!==a?a:0,o=n/F*I;if(0>=o)continue;E.push({cat:e,x:D,w:o});const i=j.get(e);let r=h.y;for(const l of W){const s=null!==(c=i.get(l))&&void 0!==c?c:0;if(0>=s)continue;const a=s/n*A;T.push({type:"rect",x:D,y:r,w:o,h:a,style:{fill:t.resolveColor(l),stroke:"none"},datum:w(e,l,s),group:l}),r+=a}D+=o+p}return{nodes:T,overlays:M&&E.length>0?function(t,e,n){const i=t.map((t,i)=>6.5*t.cat.length>t.w-4?null:o.createElement("text",{key:"marimekko-label-"+i,x:t.x+t.w/2,y:e+12,textAnchor:"middle",fontSize:12,fill:n},t.cat));return o.createElement(o.Fragment,null,...i)}(E,h.y+A+4,`var(--semiotic-text, ${null!==(u=t.theme.semantic.text)&&void 0!==u?u:"currentColor"})`):null}};function b(t,e,n){const o=new Set,i=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),i.push(e));for(const t of e)o.has(t)||i.push(t);return i}const w=t=>{var e,n,i,s,a,c,u,d,h,f,y,m;const p=t.config,{plot:g}=t.dimensions;if(0>=g.width||0>=g.height||0===t.data.length)return{nodes:[]};const v=null!==(e=p.rowHeight)&&void 0!==e?e:28,x=null!==(n=p.rowGap)&&void 0!==n?n:12,b=!1!==p.showLabels,w=b?null!==(i=p.labelWidth)&&void 0!==i?i:120:0,M=!1!==p.showTicks,k=M?14:0,A=null!==(s=p.tickFormat)&&void 0!==s?s:t=>t.toLocaleString(),$=g.x+w,N=Math.max(0,g.width-w);if(0>=N)return{nodes:[]};const C=r(p.categoryAccessor),O=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},j=t=>O("function"==typeof p.valueAccessor?p.valueAccessor(t):t[p.valueAccessor]),S=t=>O("function"==typeof p.targetAccessor?p.targetAccessor(t):t[p.targetAccessor]),W=t=>{const e="function"==typeof p.rangesAccessor?p.rangesAccessor(t):t[p.rangesAccessor];return Array.isArray(e)?e.map(O).sort((t,e)=>t-e):[]},F="string"==typeof p.categoryAccessor?p.categoryAccessor:"metric",I="string"==typeof p.valueAccessor?p.valueAccessor:"value",T="string"==typeof p.targetAccessor?p.targetAccessor:"target",E=null!==(c=null!==(a=p.actualColor)&&void 0!==a?a:t.theme.semantic.primary)&&void 0!==c?c:"#3b6cb1",D=null!==(u=t.theme.semantic.text)&&void 0!==u?u:"currentColor",L=null!==(d=t.theme.semantic.textSecondary)&&void 0!==d?d:"#888",P=null!==(h=t.theme.semantic.surface)&&void 0!==h?h:"#e8eaed",z=null!==(f=t.theme.semantic.grid)&&void 0!==f?f:"#cdd1d6",B=null!==(y=t.theme.semantic.border)&&void 0!==y?y:"#a3a8af",U=null!==(m=p.targetColor)&&void 0!==m?m:`var(--semiotic-text, ${D})`,G=[`var(--semiotic-surface, ${P})`,`var(--semiotic-grid, ${z})`,`var(--semiotic-border, ${B})`],H=`var(--semiotic-text, ${D})`,V=`var(--semiotic-text-secondary, ${L})`,Y=[],_=[];for(let e=0;t.data.length>e;e++){const n=t.data[e],o=W(n),i=j(n),r=S(n),s=Math.max(i,r,...o.length?o:[0]);if(0>=s)continue;const a=g.y+e*(v+x+k);if(a+v+k>g.y+g.height)break;_.push({yTop:a,label:C(n),actual:i,target:r,maxVal:s});const c=t=>$+t/s*N,u=C(n),d=t=>l(e=>{e("metric",u),"metric"!==F&&e(F,u),t(e)});let h=$;for(let t=0;o.length>t;t++){const e=c(o[t]),n=e-h;n>0&&Y.push({type:"rect",x:h,y:a,w:n,h:v,style:{fill:G[Math.min(t,G.length-1)],stroke:"none"},datum:d(e=>{e("range",t),e("rangeValue",o[t]),e("kind","range")}),group:"range-"+t}),h=e}const f=Math.max(6,Math.floor(.45*v));Y.push({type:"rect",x:$,y:a+(v-f)/2,w:c(i)-$,h:f,style:{fill:E,stroke:"none"},datum:d(t=>{t("value",i),t("kind","actual"),"value"!==I&&t(I,i)}),group:"actual"});const y=3,m=Math.floor(.8*v);Y.push({type:"rect",x:c(r)-y/2,y:a+(v-m)/2,w:y,h:m,style:{fill:U,stroke:"none"},datum:d(t=>{t("target",r),t("kind","target"),"target"!==T&&t(T,r)}),group:"target"})}const R=[];for(let t=0;_.length>t;t++){const e=_[t];if(b&&R.push(o.createElement("text",{key:"bullet-label-"+t,x:g.x+w-8,y:e.yTop+v/2,textAnchor:"end",dominantBaseline:"middle",fontSize:13,fontWeight:500,fill:H},e.label)),M){const n=5,i=e.yTop+v+2;for(let r=0;n>r;r++){const l=e.maxVal*r/(n-1),s=$+l/e.maxVal*N;R.push(o.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:s,x2:s,y1:i,y2:i+3,stroke:V,strokeWidth:1}),o.createElement("text",{key:`bullet-ticktext-${t}-${r}`,x:s,y:i+12,textAnchor:0===r?"start":r===n-1?"end":"middle",fontSize:10,fill:V},A(l)))}}}return{nodes:Y,overlays:R.length>0?o.createElement(o.Fragment,null,...R):null}},M=t=>{var e,n,r,l,s,a,c,u,d,h,f,y;const m=t.config,{plot:p}=t.dimensions,g=null!==(e=m.fields)&&void 0!==e?e:[];if(2>g.length||0>=p.width||0>=p.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const v={};for(const e of g){if(null===(n=m.domains)||void 0===n?void 0:n[e]){v[e]=m.domains[e];continue}let o=1/0,i=-1/0;for(const n of t.data){const t=Number(n[e]);Number.isFinite(t)&&(o>t&&(o=t),t>i&&(i=t))}v[e]=Number.isFinite(o)&&Number.isFinite(i)&&o!==i?[o,i]:[0,1]}const x=!1!==m.showAxes,b=x?null!==(r=m.axisLabelPadding)&&void 0!==r?r:24:8,w=x?18:8,M=g.map(t=>i().domain(v[t]).range([p.y+p.height-w,p.y+b])),k=g.map((t,e)=>1===g.length?p.x+p.width/2:p.x+e/(g.length-1)*p.width),A=m.colorBy?"function"==typeof m.colorBy?m.colorBy:t=>{var e;return(null!==(e=t[m.colorBy])&&void 0!==e?e:"")+""}:null,$=null!==(l=m.opacity)&&void 0!==l?l:.45,N=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,C=null!==(a=t.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",O=null!==(c=m.dimmedOpacity)&&void 0!==c?c:.08,j=m.highlightFn,S=[],W=[];for(const e of t.data){const n=A?t.resolveColor(A(e)+""):C,o=!j||j(e),i=j?o?Math.min(1,$+.4):O:$,r=o?W:S;for(let t=0;g.length-1>t;t++){const l=Number(e[g[t]]),s=Number(e[g[t+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:k[t],y1:M[t](l),x2:k[t+1],y2:M[t+1](s),style:{stroke:n,strokeWidth:j&&o?N+.75:N,opacity:i,fill:"none"},datum:e};r.push(a)}if(m.showPoints)for(let t=0;g.length>t;t++){const o=Number(e[g[t]]);if(!Number.isFinite(o))continue;const l={type:"point",x:k[t],y:M[t](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,i+.3)},datum:e};r.push(l)}}let F=null;if(x){const e=`var(--semiotic-border, ${null!==(u=t.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,n=`var(--semiotic-text, ${null!==(d=t.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,i=`var(--semiotic-text-secondary, ${null!==(h=t.theme.semantic.textSecondary)&&void 0!==h?h:"#888"})`,r=p.y+b,l=p.y+p.height-w,s=[];for(let t=0;g.length>t;t++){const a=g[t],c=k[t],u=null!==(y=null===(f=m.tickFormat)||void 0===f?void 0:f[a])&&void 0!==y?y:t=>t.toLocaleString();s.push(o.createElement("line",{key:"pc-axis-line-"+t,x1:c,x2:c,y1:r,y2:l,stroke:e,strokeWidth:1})),s.push(o.createElement("text",{key:"pc-axis-label-"+t,x:c,y:p.y+b-8,textAnchor:"middle",fontSize:12,fontWeight:600,fill:n},a));const[d,h]=v[a],x=5;for(let n=0;x>n;n++){const r=d+(h-d)*n/(x-1),l=M[t](r);s.push(o.createElement("line",{key:`pc-tick-${t}-${n}`,x1:c-3,x2:c+3,y1:l,y2:l,stroke:e,strokeWidth:1}),o.createElement("text",{key:`pc-ticktext-${t}-${n}`,x:c+6,y:l+3,fontSize:10,fill:i},u(r)))}}F=o.createElement(o.Fragment,null,...s)}return{nodes:S.concat(W),overlays:F}};function k(t,e){var n,o,i;const r=null!==(o=null===(n=e.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=e.scales)||void 0===i?void 0:i.time;return r?null!=t.x?r(t.x):e.xAccessor&&null!=t[e.xAccessor]?r(t[e.xAccessor]):null:null}function A(t,e){var n,o,i;const r=null!==(o=null===(n=e.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=e.scales)||void 0===i?void 0:i.value;return r?null!=t.y?r(t.y):e.yAccessor&&null!=t[e.yAccessor]?r(t[e.yAccessor]):null:null}function $(t){return null==t?null:t+""}function N(t,e,n){var o;return null===(o=e.stickyPositionCache)||void 0===o||o.set(t,n),n}const C=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function O(t){return!!t&&"object"==typeof t&&C.has(function(t){return"string"==typeof(null==t?void 0:t.type)?t.type:""}(t))}new Set(["label","callout","callout-circle","callout-rect"]);const j=2e4;function S(t){return"primary"===(null==t?void 0:t.emphasis)||!0===(null==t?void 0:t.defensive)}function W(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 F(t){var e,n;let o;const i=null==t?void 0:t.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(e=null==t?void 0:t.provenance)||void 0===e?void 0:e.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function I(t){var e;const{annotations:n,width:o,height:i}=t,r=Math.max(0,null!==(e=t.minVisible)&&void 0!==e?e:1),l=W(o,i,t),s=n.map((t,e)=>{return{annotation:t,index:e,note:(n=t,O(n))};var n}),a=s.filter(t=>t.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(t=>S(t.annotation)),u=a.filter(t=>!S(t.annotation)).sort((t,e)=>F(e.annotation)-F(t.annotation)||t.index-e.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(t=>t.index),...u.slice(0,d).map(t=>t.index)]),f=[],y=[];for(const{annotation:t,index:e,note:n}of s)!n||h.has(e)?f.push(t):y.push(t);return{visible:f,deferred:y,budget:l}}const T=32,E=6,D=4,L=8,P=72;const z={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function B(t){return O(t)}function U(t,e){if(!t)return[];const n=Math.max(1,Math.floor(e/7)),o=t.split(/\s+/).filter(Boolean),i=[];let r="";for(const t of o)r&&r.length+t.length+1>n?(i.push(r),r=t):r=r?`${r} ${t}`:t;return r&&i.push(r),i}function G(t,e,n,o,i){const r=t+n,l=e+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?l-i.height:l,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?l-i.height-4:l+4,width:i.width,height:i.height}}function H(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}function V(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function Y(t,e,n,o,i,r,l,s){const a=H(t,l);let c=.4*Math.hypot(e.dx,e.dy)+80*function(t,e,n,o){const i=Math.max(0,o-t.x),r=Math.max(0,o-t.y);return(i+Math.max(0,t.x+t.width-(e-o)))*t.height+(r+Math.max(0,t.y+t.height-(n-o)))*t.width}(a,i,r,s);for(const t of n)c+=12*V(a,t);for(const t of o)c+=4*V(a,t);return c}function _(t,e,n){var o,i;if("widget"===t.type&&"number"==typeof t.px&&"number"==typeof t.py)return{x:t.px,y:t.py};const r=null!==(o=t.pointId)&&void 0!==o?o:t.nodeId;if(null!=r&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===r);if(t)return{x:t.x,y:t.y}}const l=t.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const t=l[0],e=l[1];if("number"==typeof t&&"number"==typeof e){const n=s([t,e]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof t.x||"number"!=typeof t.y?function(t,e,n){var o,i;const r=t.anchor||(null===(o=t.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=t.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===t.pointId)return N(e,n,{x:i.x,y:i.y})}const o=function(t){var e,n,o,i,r,l;const s=t.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(e=t.scales)||void 0===e?void 0:e.x)&&void 0!==n?n:null===(o=t.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=t.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=t.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[t.xAccessor||"x"],h=a[t.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?N(e,n,o):null}if("semantic"===r){const o=function(t,e,n){var o,i;const r=function(t){var e,n;return $(null!==(n=null===(e=t.provenance)||void 0===e?void 0:e.stableId)&&void 0!==n?n:t.stableId)}(t);if(!r)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(t=>$(t.pointId)===r);if(l)return N(e,n,{x:l.x,y:l.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(t=>function(t){var e,n,o;return $(null!==(n=null!==(e=t.stableId)&&void 0!==e?e:t.id)&&void 0!==n?n:null===(o=t.provenance)||void 0===o?void 0:o.stableId)}(t)===r);if(!s)return null;const a=k(s,n),c=A(s,n);return null==a||null==c?null:N(e,n,{x:a,y:c})}(t,e,n);if(o)return o}let l=null,s=null;if(null!=t.pointId&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===t.pointId);e&&(l=e.x,s=e.y)}if(null!=l&&null!=s||(l=k(t,n),s=A(t,n)),null!=l&&null!=s)return N(e,n,{x:l,y:s});if("sticky"===r){const t=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(e);if(t)return t}return null}(t,e,n):{x:t.x,y:t.y}}function R(t){var e;const{annotations:n,context:o,defaultOffset:i=T,notePadding:r=E,markPadding:l=D,edgePadding:s=L,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=P,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:y,cohesion:m,audience:p}=t,g=o.width||0,v=o.height||0;if(0===n.length||0>=g||0>=v)return n.slice();const x=[],b=function(t,e){return(t.pointNodes||[]).map(t=>{const n=Math.max(1,t.r||1)+e;return{x:t.x-n,y:t.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const M=n.map((t,e)=>{if(!B(t))return t;const n=_(t,e,o);if(!n)return t;const l=function(t){if("widget"===t.type)return{width:"number"==typeof t.width?t.width:32,height:"number"==typeof t.height?t.height:32};const e="number"==typeof t.wrap?t.wrap:120,n=[...U("string"==typeof t.title?t.title:void 0,e),...U("string"==typeof t.label?t.label:void 0,e)],o=n.reduce((t,e)=>Math.max(t,e.length),0);return{width:Math.max(24,Math.min(e,7*o)+10),height:Math.max(18,16*n.length+6)}}(t);if(a&&("number"==typeof(d=t).dx||"number"==typeof d.dy)){const e=function(t){return"text"===t.type||"widget"===t.type?{dx:0,dy:0}:{dx:30,dy:-30}}(t);return x.push(H(G(n.x,n.y,"number"==typeof t.dx?t.dx:e.dx,"number"==typeof t.dy?t.dy:e.dy,l),r)),t}var d;let h=null,f=1/0;for(const t of function(t){const e=1.6*t;return[{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t},{dx:t,dy:0},{dx:-t,dy:0},{dx:0,dy:-t},{dx:0,dy:t},{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e}]}(i)){const e=Y(G(n.x,n.y,t.dx,t.dy,l),t,x,b,g,v,r,s);f>e&&(h=t,f=e)}if(!h)return t;const y=H(G(n.x,n.y,h.dx,h.dy,l),r);x.push(y);const m=Math.hypot(h.dx,h.dy),p=c&&m>=u&&"text"!==t.type&&"widget"!==t.type?Object.assign(Object.assign({},t.connector||{end:"arrow"}),{type:"curve"}):t.connector;return w=!0,Object.assign(Object.assign(Object.assign({},t),{dx:h.dx,dy:h.dy}),p?{connector:p}:{})}),k=w?M:n.slice();let A=k;if(f){let t=!1;const e=k.map(e=>{const n=function(t){return"text"!==t.type||"string"!=typeof t.color||8>Math.hypot("number"==typeof t.dx?t.dx:0,"number"==typeof t.dy?t.dy:0)?t:Object.assign(Object.assign({},t),{_redundantConnector:!0})}(e);return n!==e&&(t=!0),n});A=t?e:k}{let t=!1;const e=A.map(e=>{if(!0!==(null==e?void 0:e.defensive))return e;const n=function(t){var e;const n=null==t?void 0:t.provenance;if(!n||"object"!=typeof n)return t;const o="string"==typeof n.source?null!==(e=z[n.source])&&void 0!==e?e:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return t;if(null!=t.label&&"string"!=typeof t.label)return t;const r=[o,i].filter(Boolean).join(" · "),l="string"==typeof t.label?t.label:"";return l.includes(`(${r})`)?t:Object.assign(Object.assign({},t),{label:l?`${l} (${r})`:`(${r})`})}(e);return n!==e&&(t=!0),n});A=t?e:A}const $=new Set;if(d){const t="object"==typeof d?d:{},n=function(t){if(!t)return 1;const e=function(t){const e=null==t?void 0:t.familiarity;if(!e)return 3;const n=Object.values(e).filter(t=>"number"==typeof t&&Number.isFinite(t));return 0===n.length?3:n.reduce((t,e)=>t+e,0)/n.length}(t);return e>2?4>e?1:.6:1.5}(p),o=1===n?t:Object.assign(Object.assign({},t),{maxAnnotations:Math.max(0,Math.round((null!==(e=t.maxAnnotations)&&void 0!==e?e:W(g,v,t))*n))}),{deferred:i}=I(Object.assign({annotations:A,width:g,height:v},o));for(const t of i)$.add(t)}if(y&&("object"==typeof y&&"number"==typeof y.minWidth?y.minWidth:480)>=g)for(const t of A)B(t)&&"secondary"===t.emphasis&&$.add(t);if($.size>0)for(const t of A)!0===(null==t?void 0:t.defensive)&&$.delete(t);let N;return N=0===$.size?A:h?A.map(t=>$.has(t)?Object.assign(Object.assign({},t),{_annotationDeferred:!0}):t):A.filter(t=>!$.has(t)),m?function(t,e){let n=!1;const o=t.map(t=>B(t)?"blended"===t.cohesion||"layer"===t.cohesion?t:(n=!0,Object.assign(Object.assign({},t),{cohesion:e})):t);return n?o:t}(N,m):N}export{j as DEFAULT_AREA_PER_ANNOTATION,W as annotationBudget,I as annotationDensity,R as annotationLayout,w as bulletLayout,c as calendarLayout,f as dagreLayout,h as flextreeLayout,v as lineageDagLayout,x as marimekkoLayout,M as parallelCoordinatesLayout,s as waffleLayout};
1
+ import{interpolateLab as e,interpolateRgb as t}from"d3-interpolate";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{symbol as r,symbolCircle as i,symbolWye as l,symbolCross as s,symbolStar as a,symbolDiamond as c,symbolTriangle as u,symbolSquare as d}from"d3-shape";import*as h from"react";import{scaleLinear as f}from"d3-scale";function m(e){return"function"==typeof e?e:t=>t[e]}function y(e,t,n){const o=null==e?void 0:e.data,r=o?o[t]:void 0;if(null!=r)return r;const i=null==e?void 0:e[t];return null==i?n:i}function p(e,t){const n=new Map;for(const o of e){const e=t(o),r=n.get(e);r?r.push(o):n.set(e,[o])}return n}function g(e){const t=Object.create(null);return e((e,n)=>{t[e]=n}),t}function v(e,t){if(!t)return!0;const n=Array.isArray(t)?t:[t],o=e;for(const e of n)if(null!=e.value&&o[e.field]+""!=e.value+"")return!1;return!0}function x(e,t={}){var n,o,r;const i=null!==(n=t.baseOpacity)&&void 0!==n?n:1;return t.highlight||t.predicate?!v(e,t.highlight)||t.predicate&&!t.predicate(e)?null!==(r=t.dimOpacity)&&void 0!==r?r:.16:Math.min(1,i+(null!==(o=t.brighten)&&void 0!==o?o:0)):i}function b(e){return e.join("|")}class w{constructor(e=12){this.maxSize=e,this.store=new Map}get(e){return this.store.get(e)}set(e,t){this.maxSize>this.store.size||this.store.clear(),this.store.set(e,t)}getOrCompute(e,t){const n=this.store.get(e);if(void 0!==n)return n;const o=t();return this.set(e,o),o}clear(){this.store.clear()}get size(){return this.store.size}}function M(t,n=.72){const o=e(t,"#ffffff"),r=e(t,"#000000"),i=e(t,t)(0);return e=>{const t=0>e?0:e>1?1:e;return.5===t?i:.5>t?o(2*(.5-t)*n):r(2*(t-.5)*n)}}function k(e,t,n=.72){return M(e,n)(t)}const $=e=>{var t,n,o,r,i,l;const s=e.config,a=null!==(t=s.rows)&&void 0!==t?t:10,c=null!==(n=s.columns)&&void 0!==n?n:10,u=null!==(o=s.gutter)&&void 0!==o?o:2,d=a*c;if(0>=a||0>=c||0>=d)return{nodes:[]};const{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=(h.width-u*(c-1))/c,m=(h.height-u*(a-1))/a;if(0>=f||0>=m)return{nodes:[]};const y=null!==(r=null==(p=s.categoryAccessor)?null:"function"==typeof p?p:e=>e[p])&&void 0!==r?r:()=>"_default";var p;const v=null!==(i=function(e){return null==e?null:"function"==typeof e?e:t=>Number(t[e])}(s.valueAccessor))&&void 0!==i?i:()=>1,x=new Map,b=[];for(const t of e.data){const e=y(t)+"",n=Number(v(t)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(e)||b.push(e),x.set(e,(null!==(l=x.get(e))&&void 0!==l?l:0)+o)}const w=Array.from(x.values()).reduce((e,t)=>e+t,0);if(0>=w)return{nodes:[]};let M;if(s.categoryOrder&&s.categoryOrder.length>0){const e=new Set,t=[];for(const n of s.categoryOrder)x.has(n)&&!e.has(n)&&(e.add(n),t.push(n));M=[...t,...b.filter(t=>!e.has(t))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(e=>{var t;return{cat:e,exact:(null!==(t=x.get(e))&&void 0!==t?t:0)/w*d}}),$=k.map(e=>Object.assign(Object.assign({},e),{count:Math.floor(e.exact)})),A=$.reduce((e,t)=>e+t.count,0),N=$.map((e,t)=>({i:t,rem:e.exact-e.count})).sort((e,t)=>t.rem-e.rem);for(let e=0;d-A>e;e++)$[N[e%N.length].i].count+=1;const S="string"==typeof s.categoryAccessor?s.categoryAccessor:"category",C="string"==typeof s.valueAccessor?s.valueAccessor:"value",O=(e,t,n)=>g(o=>{var r,i;o("category",e),o("value",null!==(r=x.get(e))&&void 0!==r?r:0),"category"!==S&&o(S,e),"value"!==C&&o(C,null!==(i=x.get(e))&&void 0!==i?i:0),o("cells",n),o("_waffleCategory",e),o("_waffleIndex",t)}),z=[];let W=0;for(const t of $){const n=e.resolveColor(t.cat);for(let e=0;t.count>e;e++)z.push({type:"rect",x:h.x+W%c*(f+u),y:h.y+(a-1-Math.floor(W/c))*(m+u),w:f,h:m,style:{fill:n,stroke:"none"},datum:O(t.cat,W,t.count),group:t.cat}),W++}return{nodes:z}},A=864e5,N=e=>{var n,o,r,i,l,s,a,c;const u=e.config,{plot:d}=e.dimensions;if(0>=d.width||0>=d.height)return{nodes:[]};const h=e=>{const t="function"==typeof u.dateAccessor?u.dateAccessor(e):e[u.dateAccessor];return t instanceof Date?t:new Date(t)},f=e=>{const t="function"==typeof u.valueAccessor?u.valueAccessor(e):e[u.valueAccessor];return Number(t)},m=new Map;let y=null;for(const t of e.data){const e=h(t);if(!isFinite(e.getTime()))continue;null==y&&(y=e.getUTCFullYear());const o=S(e),r=f(t);m.set(o,(null!==(n=m.get(o))&&void 0!==n?n:0)+(Number.isFinite(r)?r:0))}const p=null!==(r=null!==(o=u.year)&&void 0!==o?o:y)&&void 0!==r?r:(new Date).getUTCFullYear();let g=1/0,v=-1/0;for(const e of m.values())g>e&&(g=e),e>v&&(v=e);g===1/0&&(g=0,v=0);const[x,b]=null!==(i=u.colorRamp)&&void 0!==i?i:[null!==(l=e.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=e.theme.semantic.primary)&&void 0!==s?s:"#216e39"],w=e=>{if(v===g)return x;const n=(e-g)/(v-g);return t(x,b)(n)},M=null!==(a=u.gutter)&&void 0!==a?a:2,k=null!==(c=u.labelInset)&&void 0!==c?c:0,$=Math.min((d.width-k-53*M)/54,(d.height-6*M)/7);if(0>=$)return{nodes:[]};const N=new Date(Date.UTC(p,0,1)),C=N.getUTCDay(),O=new Date(N.getTime()-C*A),z=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){const n=new Date(O.getTime()+(7*e+t)*A);if(n.getUTCFullYear()!==p)continue;const o=S(n),r=m.get(o),i=null==r?x:w(r);z.push({type:"rect",x:d.x+k+e*($+M),y:d.y+t*($+M),w:$,h:$,style:{fill:i,stroke:"none"},datum:{date:n,value:null!=r?r:0}})}return{nodes:z}};function S(e){return`${e.getUTCFullYear()}-${C(e.getUTCMonth()+1)}-${C(e.getUTCDate())}`}function C(e){return 10>e?"0"+e:e+""}const O=e=>{var t,n,o,r,i,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",m=null!==(r=u.edgeCurve)&&void 0!==r?r:"curved",p=!1!==u.showLabels,g=null!==(i=u.labelAccessor)&&void 0!==i?i:"id",v="function"==typeof g?g:e=>{var t;return y(e,g,null!==(t=e.id)&&void 0!==t?t:"")+""},x=new Map,b=[],w=[],M=e=>{var t,n,o;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(n="number"==typeof r.width?r.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof r.height?r.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:r,h:i}=M(t);null!=n&&null!=o&&(x.set(t.id,{x:n,y:o,w:r,h:i}),b.push({type:"rect",x:n-r/2,y:o-i/2,w:r,h:i,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:e.resolveColor(t.id),stroke:`var(--semiotic-surface, ${null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:t,id:t.id,label:v(t)+""}),p&&w.push({x:n,y:o,text:v(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const k=[];for(const t of e.edges){const n="string"==typeof t.target?t.target:t.target.id,o=x.get("string"==typeof t.source?t.source:t.source.id),r=x.get(n);if(!o||!r)continue;const i="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:r.x,y:r.y-r.h/2}:{x:r.x-r.w/2,y:r.y};if("line"===m)k.push({type:"line",x1:i.x,y1:i.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:t});else{const n=(i.y+l.y)/2,o=(i.x+l.x)/2;k.push({type:"curved",pathD:"vertical"===f?`M${i.x},${i.y} C${i.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${i.x},${i.y} C${o},${i.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:t})}}return{sceneNodes:b,sceneEdges:k,labels:w}},z=e=>{var t,n,o,r,i,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",m=!1!==u.showLabels,p=null!==(r=u.labelAccessor)&&void 0!==r?r:"label",g="function"==typeof p?p:e=>{var t;return y(e,p,null!==(t=e.id)&&void 0!==t?t:"")+""},v=new Map,x=[],b=[],w=e=>{var t,n,o;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(n="number"==typeof r.width?r.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof r.height?r.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:r,h:s}=w(t);null!=n&&null!=o&&(v.set(t.id,{x:n,y:o,w:r,h:s}),x.push({type:"rect",x:n-r/2,y:o-s/2,w:r,h:s,style:{fill:null!==(i=u.nodeFill)&&void 0!==i?i:e.resolveColor(t.id),stroke:`var(--semiotic-border, ${null!==(l=e.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:t,id:t.id,label:g(t)+""}),m&&b.push({x:n,y:o,text:g(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const M=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#666"})`,k=[];for(const t of e.edges){const e="string"==typeof t.target?t.target:t.target.id,n=v.get("string"==typeof t.source?t.source:t.source.id),o=v.get(e);if(!n||!o)continue;const r=null!==(c=t.data)&&void 0!==c?c:{},i=Array.isArray(r.points)?r.points:t.points;if(i&&i.length>=2)if("smooth"!==f||3>i.length){const e="M"+i.map(e=>`${e.x},${e.y}`).join(" L ");k.push({type:"curved",pathD:e,style:{stroke:M,strokeWidth:1,fill:"none"},datum:t})}else{let e=`M${i[0].x},${i[0].y}`;for(let t=1;i.length-1>t;t++)e+=` Q${i[t].x},${i[t].y} ${(i[t].x+i[t+1].x)/2},${(i[t].y+i[t+1].y)/2}`;const n=i[i.length-1];e+=` T${n.x},${n.y}`,k.push({type:"curved",pathD:e,style:{stroke:M,strokeWidth:1,fill:"none"},datum:t})}else k.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:M,strokeWidth:1},datum:t})}return{sceneNodes:x,sceneEdges:k,labels:b}},W={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},F={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function j(e){return Array.isArray(e)?e.map((e,t)=>{var n,o;return"string"==typeof e?{storeName:e,slotIndex:t}:{storeName:(null!==(n=e.storeName)&&void 0!==n?n:"")+"",slotIndex:null!==(o=e.slotIndex)&&void 0!==o?o:t}}):[]}const I=e=>{var t,r,i,l,s,a,c,u,d,h,f,m,p,g,v,x,b,w,M,k,$,A,N,S,C;const O=e.config||{},z=e.dimensions.plot,I=null!==(t=O.layerAccessor)&&void 0!==t?t:"x",L=null!==(r=O.rowAccessor)&&void 0!==r?r:"y",E=null!==(i=O.partitionAccessor)&&void 0!==i?i:"partition",Y=null!==(l=O.semanticAccessor)&&void 0!==l?l:"semantic",D=null!==(s=O.labelAccessor)&&void 0!==s?s:"label",P=null!==(a=O.storesAccessor)&&void 0!==a?a:"stores",T=null!==(c=O.backEdgeAccessor)&&void 0!==c?c:"isBackEdge",X=null!==(u=O.edgeTypeAccessor)&&void 0!==u?u:"edgeType",R=Object.assign(Object.assign({},W),O.partitionColors),V=Object.assign(Object.assign({},F),O.edgeColors),B=null!==(d=O.accentColor)&&void 0!==d?d:"var(--semiotic-focus, #ffcc33)",H=null!==(h=O.borderColor)&&void 0!==h?h:"var(--semiotic-border, #555)",G=null!==(f=O.dimOpacity)&&void 0!==f?f:.14,q=null!==(m=O.edgeOpacity)&&void 0!==m?m:.5,U=null!==(p=O.edgeWidth)&&void 0!==p?p:1.25,_=null!==(v=null!==(g=O.backEdgeWidth)&&void 0!==g?g:O.edgeWidth)&&void 0!==v?v:1.5,K=!1!==O.showStoreChips,J=null!==(x=O.storeChipColor)&&void 0!==x?x:"var(--semiotic-info, #6a8caf)";let Q=O.layerCount,Z=O.maxLayerSize;if(null==Q||null==Z){let t=0;const n=new Map;for(const o of e.nodes){const e=Math.round(Number(y(o,I,0)));t=Math.max(t,e),n.set(e,(null!==(b=n.get(e))&&void 0!==b?b:0)+1)}Q=null!=Q?Q:t+1,Z=null!=Z?Z:Math.max(1,...n.values())}const ee=z.width/Math.max(1,Q),te=z.height/Math.max(1,Z);let ne=Math.min(null!==(w=O.nodeWidth)&&void 0!==w?w:172,Math.max(8,ee-(null!==(M=O.minGapX)&&void 0!==M?M:26))),oe=Math.min(null!==(k=O.nodeHeight)&&void 0!==k?k:54,Math.max(8,te-(null!==($=O.minGapY)&&void 0!==$?$:18)));const re=O.lod&&"auto"!==O.lod?O.lod:16>ne?"dot":48>ne?"icon":108>ne?"compact":"full";if("dot"===re){const e=Math.min(ne,oe,11);ne=e,oe=e}const ie=Math.max(1,z.width-ne),le=Math.max(1,z.height-oe),se=Math.max(1,Z-1),ae=e=>z.x+ne/2+(Q>1?e/(Q-1):.5)*ie,ce=e=>z.y+oe/2+(e+se/2)/se*le,ue=O.reachableIds?new Set(O.reachableIds):null,de=null!==(A=O.selectedId)&&void 0!==A?A:null,he=e.selection,fe=new Map,me=new Map,ye=[],pe=[];for(const t of e.nodes){const e=t.id,n=Number(y(t,I,0)),o=Number(y(t,L,0)),r=y(t,E,"processor")+"",i=y(t,Y,"processor")+"",l=y(t,D,e)+"",s=j(y(t,P,[])),a=null!==(N=t.data)&&void 0!==N?N:t,c=ae(n),u=ce(o);fe.set(e,{cx:c,cy:u});const d=ue?ue.has(e):null,h=(null==he?void 0:he.isActive)?he.predicate(a):null,f=null!==d?!d:null!==h&&!h;me.set(e,f);const m=null!=de&&e===de,p=f&&!m?G:1,g=null!==(S=R[r])&&void 0!==S?S:R.unknown;"dot"===re?ye.push({type:"circle",cx:c,cy:u,r:ne/2,style:{fill:g,opacity:p,stroke:m?B:"transparent",strokeWidth:m?2:0},datum:t,id:e,label:l}):(ye.push({type:"rect",x:c-ne/2,y:u-oe/2,w:ne,h:oe,style:{fill:g,opacity:p,stroke:m?B:H,strokeWidth:m?3:1},datum:t,id:e,label:l}),pe.push({id:e,cx:c,cy:u,partition:r,semantic:i,label:l,stores:s,opacity:p,selected:m,node:a}))}const ge=[];for(const t of e.edges){const e="string"==typeof t.source?t.source:t.source.id,n="string"==typeof t.target?t.target:t.target.id,o=fe.get(e),r=fe.get(n);if(!o||!r)continue;const i=!!y(t,T,!1),l=y(t,X,"internal")+"",s=me.get(e)||me.get(n)?Math.min(q,1.4*G):q,a=i?V.back:null!==(C=V[l])&&void 0!==C?C:V.internal;let c;if(i){const e=o.cx,t=o.cy+oe/2,n=r.cx,i=r.cy+oe/2,l=Math.max(48,.28*Math.abs(e-n))+oe;c=`M${e},${t} C${e},${t+l} ${n},${i+l} ${n},${i}`}else{const e=o.cx+ne/2,t=o.cy,n=r.cx-ne/2,i=r.cy,l=(e+n)/2;c=`M${e},${t} C${l},${t} ${l},${i} ${n},${i}`}const u={type:"curved",pathD:c,style:Object.assign({stroke:a,strokeWidth:i?_:U,fill:"none",opacity:s},i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:t};ge.push(u)}const ve=0===pe.length?null:n("g",{className:"lineage-dag-glyphs",children:pe.map(e=>function(e,t){var r,i;const{w:l,h:s,lod:a}=t,c="icon"===a?Math.min(l,s):Math.min(s-14,26),u=null!==(i=null!==(r=t.partColors[e.partition])&&void 0!==r?r:t.partColors.unknown)&&void 0!==i?i:"#5a5a6a",d="icon"===a?0:8+c+8,h=null!=t.renderIcon?t.renderIcon({semantic:e.semantic,partition:e.partition,size:c,color:u,node:e.node}):function(e,t,r){var i;const l=t.startsWith("topic")?"T":null!==(i={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"}[e])&&void 0!==i?i:"PR";return o("g",{children:[n("rect",{width:r,height:r,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),n("text",{x:r/2,y:r/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*r,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:l})]})}(e.semantic,e.partition,c),f="full"===a,m="icon"!==a,y="full"===a&&t.showChips&&e.stores.length>0;return o("g",{transform:`translate(${e.cx-l/2}, ${e.cy-s/2})`,opacity:e.opacity,style:{pointerEvents:"none"},children:[n("g",{transform:`translate(${"icon"===a?(l-c)/2:8}, ${(s-c)/2})`,children:h}),m&&n("foreignObject",{x:d,y:f?s/2-12:s/2-9,width:Math.max(8,l-d-8),height:18,style:{pointerEvents:"none"},children:n("div",{title:e.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===a?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label})}),f&&n("text",{x:d,y:s/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:t.typeLabel?t.typeLabel({semantic:e.semantic,partition:e.partition,node:e.node}):e.partition.startsWith("topic")?"topic":e.semantic}),y&&e.stores.map((e,o)=>n("rect",{x:d+15*o,y:s-10,width:12,height:5,rx:1.5,fill:t.chipColor,children:n("title",{children:e.storeName})},e.storeName+o))]},e.id)}(e,{w:ne,h:oe,lod:re,partColors:R,chipColor:J,showChips:K,renderIcon:O.renderIcon,typeLabel:O.typeLabel}))});return{sceneNodes:ye,sceneEdges:ge,overlays:ve}};function L(e,t){return e.length>t?e.slice(0,Math.max(1,t-1))+"…":e}const E={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function Y(e,t,r,i,l,s,a,c){const u=t-i/2,d=r-l/2,h={fill:s,stroke:a,strokeWidth:c};switch(e){case"diamond":return n("polygon",Object.assign({points:`${t},${d} ${t+i/2},${r} ${t},${r+l/2} ${u},${r}`},h));case"circle":return n("circle",Object.assign({cx:t,cy:r,r:Math.min(i,l)/2},h));case"stadium":case"round":return n("rect",Object.assign({x:u,y:d,width:i,height:l,rx:"stadium"===e?l/2:8,ry:"stadium"===e?l/2:8},h));case"hexagon":{const e=Math.min(.18*i,16);return n("polygon",Object.assign({points:`${u+e},${d} ${t+i/2-e},${d} ${t+i/2},${r} ${t+i/2-e},${r+l/2} ${u+e},${r+l/2} ${u},${r}`},h))}case"cylinder":{const e=Math.min(.16*l,8),t=`M${u},${d+e} a${i/2},${e} 0 0 1 ${i},0`;return o("g",{children:[n("path",Object.assign({d:`M${u},${d+e} a${i/2},${e} 0 0 0 ${i},0 v${l-2*e} a${i/2},${e} 0 0 1 ${-i},0 z`},h)),n("path",{d:t,fill:"none",stroke:a,strokeWidth:c})]})}case"subroutine":{const e=Math.min(8,.08*i);return o("g",{children:[n("rect",Object.assign({x:u,y:d,width:i,height:l,rx:3},h)),n("line",{x1:u+e,y1:d,x2:u+e,y2:d+l,stroke:a,strokeWidth:c}),n("line",{x1:u+i-e,y1:d,x2:u+i-e,y2:d+l,stroke:a,strokeWidth:c})]})}default:return n("rect",Object.assign({x:u,y:d,width:i,height:l,rx:4},h))}}const D=e=>{var t,r,i,l,s,a,c,u,d,h,f,m,p;const g=e.config||{},v=e.dimensions.plot,x=null!==(t=g.direction)&&void 0!==t?t:"TD",b="LR"===x||"RL"===x,w="BT"===x||"RL"===x,M=null!==(r=g.layerAccessor)&&void 0!==r?r:"layer",k=null!==(i=g.rowAccessor)&&void 0!==i?i:"row",$=null!==(l=g.labelAccessor)&&void 0!==l?l:"label",A=null!==(s=g.shapeAccessor)&&void 0!==s?s:"shape",N=null!==(a=g.edgeLabelAccessor)&&void 0!==a?a:"label",S=null!==(c=g.nodeFill)&&void 0!==c?c:"var(--semiotic-surface, #20242d)",C=null!==(u=g.nodeStroke)&&void 0!==u?u:"var(--semiotic-border, #5a6573)",O=null!==(d=g.textColor)&&void 0!==d?d:"var(--semiotic-text, #e6e6e6)",z=null!==(h=g.edgeColor)&&void 0!==h?h:"var(--semiotic-text-secondary, #9aa0a6)",W=null!==(f=g.accentColor)&&void 0!==f?f:"var(--semiotic-warning, #d49a00)";if(0===e.nodes.length)return{sceneNodes:[],overlays:null};const F=new Map;let j=0;for(const t of e.nodes){const e=Math.round(Number(y(t,M,0)));j=Math.max(j,e);const n=F.get(e)||[];n.push(t),F.set(e,n)}const I=j+1;let D=1;for(const e of F.values())e.sort((e,t)=>Number(y(e,k,0))-Number(y(t,k,0))),D=Math.max(D,e.length);const P=b?v.width:v.height,T=b?v.height:v.width,X=P/I,R=T/(D+1),V=Math.max(44,Math.min(null!==(m=g.nodeWidth)&&void 0!==m?m:150,b?X-36:.92*R)),B=Math.max(26,Math.min(null!==(p=g.nodeHeight)&&void 0!==p?p:46,b?.7*R:.5*X)),H=(b?V:B)/2+6,G=Math.max(1,P-2*H),q=e=>(b?v.x:v.y)+H+(I>1?(w?I-1-e:e)/(I-1)*G:G/2),U=new Map,_=[],K=[];for(const[e,t]of F)t.forEach((r,i)=>{var l;const s=q(e),a=(b?v.y:v.x)+(i+1)/(t.length+1)*T,c=b?s:a,u=b?a:s,d=y(r,A,"rect")+"",h=y(r,$,r.id)+"";U.set(r.id,{cx:c,cy:u,shape:d}),_.push({type:"rect",x:c-V/2,y:u-B/2,w:V,h:B,style:{fill:"transparent",stroke:"transparent"},datum:{id:r.id,name:h,type:null!==(l=E[d])&&void 0!==l?l:"process",shape:d},id:r.id,label:h}),K.push(o("g",{children:[Y(d,c,u,V,B,S,"diamond"===d?W:C,1.5),n("text",{x:c,y:u,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:O,style:{pointerEvents:"none"},children:L(h,Math.max(4,Math.floor((V-12)/7)))})]},"n-"+r.id))});const J=[];e.edges.forEach((e,t)=>{const r="string"==typeof e.target?e.target:e.target.id,i=U.get("string"==typeof e.source?e.source:e.source.id),l=U.get(r);if(!i||!l)return;const s=b?i.cx+V/2:i.cx,a=b?i.cy:i.cy+B/2,c=b?l.cx-V/2:l.cx,u=b?l.cy:l.cy-B/2,d=b?`M${s},${a} C${(s+c)/2},${a} ${(s+c)/2},${u} ${c},${u}`:`M${s},${a} C${s},${(a+u)/2} ${c},${(a+u)/2} ${c},${u}`,h=Math.atan2(u-a,c-s),f=c-9*Math.cos(h),m=u-9*Math.sin(h),p=4.5*-Math.sin(h),g=4.5*Math.cos(h),v=`${c},${u} ${f+p},${m+g} ${f-p},${m-g}`,x=y(e,N,void 0),w=(s+c)/2,M=(a+u)/2;J.push(o("g",{children:[n("path",{d:d,fill:"none",stroke:z,strokeWidth:1.4}),n("polygon",{points:v,fill:z}),"string"==typeof x&&x.length>0&&o("g",{children:[n("rect",{x:w-6.5*x.length/2-4,y:M-9,width:6.5*x.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:C,strokeWidth:.75}),n("text",{x:w,y:M,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:O,style:{pointerEvents:"none"},children:x})]})]},"e-"+t))});const Q=o("g",{className:"mermaid-dag",children:[J,K]});return{sceneNodes:_,overlays:Q}},P={circle:i,square:d,triangle:u,diamond:c,star:a,cross:s,wye:l},T=["circle","triangle","diamond","star","square","chevron","cross","wye"];function X(e,t,n){var o,l;if(n)return n;const s=null!=e?e:"circle";if("chevron"===s)return function(e){const t=1.5*R(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t);const a=null!==(o=P[s])&&void 0!==o?o:i;return null!==(l=r(a,Math.max(1,t))())&&void 0!==l?l:""}function R(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const V=new Map;function B(e,t,n){if(!n&&"circle"===(null!=e?e:"circle"))return R(t);const o=n?"p:"+n:`${e}:${Math.round(t)}`,r=V.get(o);if(null!=r)return r;const i=(null!=n?n:X(e,t)).match(/-?\d*\.?\d+(?:e-?\d+)?/gi);let l=0;if(i)for(let e=0;i.length>e+1;e+=2){const t=+i[e],n=+i[e+1],o=Math.sqrt(t*t+n*n);o>l&&(l=o)}return l>0||(l=R(t)),V.size>512&&V.clear(),V.set(o,l),l}function H(e){var t,o,r,i,l;return n("rect",{className:e.className,x:e.x,y:e.y,width:Math.max(0,e.width),height:Math.max(0,e.height),rx:null!==(t=e.radius)&&void 0!==t?t:10,ry:null!==(o=e.radius)&&void 0!==o?o:10,fill:null!==(r=e.fill)&&void 0!==r?r:"none",stroke:e.stroke,strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1.5,strokeDasharray:e.strokeDasharray,opacity:null!==(l=e.opacity)&&void 0!==l?l:.6,style:{pointerEvents:"none"}},e.keyId)}function G(e,t=0){var n;let o=1/0,r=1/0,i=-1/0,l=-1/0;for(const t of e){const e=null!==(n=t.r)&&void 0!==n?n:0;o>t.x-e&&(o=t.x-e),t.x+e>i&&(i=t.x+e),r>t.y-e&&(r=t.y-e),t.y+e>l&&(l=t.y+e)}return Number.isFinite(o)?{x:o-t,y:r-t,width:i-o+2*t,height:l-r+2*t}:null}function q(e){var t,o,r;const i=null!==(t=e.fontSize)&&void 0!==t?t:12;return null!=e.maxWidth&&e.text.length*i*.56>e.maxWidth?null:n("text",{className:e.className,x:e.x,y:e.y,textAnchor:null!==(o=e.anchor)&&void 0!==o?o:"middle",dominantBaseline:null!==(r=e.baseline)&&void 0!==r?r:"middle",fontSize:i,fontWeight:e.fontWeight,fill:e.color,style:{pointerEvents:"none"},children:e.text},e.keyId)}function U(e){var t,r,i,l,s,a,c;const u=null!==(t=e.stroke)&&void 0!==t?t:"var(--semiotic-text, #f4f4f8)",d=null!==(r=e.strokeWidth)&&void 0!==r?r:1,h=null!==(i=e.markRadius)&&void 0!==i?i:0,f=e.labelX-e.markX,m=e.labelY-e.markY,y=Math.hypot(f,m)||1,p=e.markX+f/y*h,g=e.markY+m/y*h;let v;return v="elbow"===e.connector?`M${p},${g} L${p},${e.labelY} L${e.labelX},${e.labelY}`:"curve"===e.connector?`M${p},${g} Q${(p+e.labelX)/2},${g} ${e.labelX},${e.labelY}`:`M${p},${g} L${e.labelX},${e.labelY}`,o("g",{className:e.className,style:{pointerEvents:"none"},children:[h>0&&n("circle",{cx:e.markX,cy:e.markY,r:h,fill:"none",stroke:u,strokeWidth:d}),n("path",{d:v,fill:"none",stroke:u,strokeWidth:d}),n("text",{x:e.labelX,y:e.labelY,textAnchor:null!==(l=e.labelAnchor)&&void 0!==l?l:"middle",dominantBaseline:null!==(s=e.labelBaseline)&&void 0!==s?s:"hanging",fontSize:null!==(a=e.fontSize)&&void 0!==a?a:11,fontWeight:e.fontWeight,fill:null!==(c=e.color)&&void 0!==c?c:u,children:e.label})]},e.keyId)}const _=new w(12);function K(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();const t=e+"",n=Number(t);if(!Number.isNaN(n)&&""!==t.trim())return n;const o=Date.parse(t);return Number.isNaN(o)?NaN:o}function J(e,t,n){return t>e?t:e>n?n:e}const Q=e=>{var t,r,i,l,s,a,c,u,d,h,f,m,g,v,w,k,$,A,N,S,C,O,z,W,F,j,I,L,E,Y,D,P,R,V,G,Q,te,ne,oe,re,ie,le;const se=e.config||{},ae=e.dimensions.plot,ce=null!==(t=se.columnAccessor)&&void 0!==t?t:"column",ue=null!==(r=se.rowAccessor)&&void 0!==r?r:"row",de=se.sizeAccessor,he=se.colorAccessor,fe=se.symbolAccessor,me=se.shadeAccessor,ye=se.markerAccessor,pe=se.iconAccessor,ge=null!==(i=se.defaultSymbol)&&void 0!==i?i:"circle",[ve,xe]=null!==(l=se.sizeRange)&&void 0!==l?l:[2,8],be=null!==(s=se.shadeStrength)&&void 0!==s?s:.72,we=null!==(a=se.shadeReverse)&&void 0!==a&&a,Me=null!==(c=se.rowMode)&&void 0!==c?c:"banded",ke=null!==(u=se.cellSizing)&&void 0!==u?u:"proportional",$e=null!==(d=se.proportionExponent)&&void 0!==d?d:1,Ae=null!==(h=se.columnGap)&&void 0!==h?h:16,Ne=null!==(f=se.rowGap)&&void 0!==f?f:12,Se=null!==(m=se.packPadding)&&void 0!==m?m:1,Ce=null!==(g=se.iterations)&&void 0!==g?g:12,Oe=!1!==se.showEnclosures,ze=!1!==se.showColumnHeaders,We=!1!==se.showRowLabels,Fe=ze?null!==(v=se.headerHeight)&&void 0!==v?v:26:0,je=We?null!==(w=se.labelWidth)&&void 0!==w?w:66:0,Ie=se.callouts&&se.callouts.length>0?null!==(k=se.footerHeight)&&void 0!==k?k:30:0,Le=ae.x+je,Ee=ae.y+Fe,Ye=Math.max(1,ae.width-je),De=Math.max(1,ae.height-Fe-Ie),Pe=[];for(const t of e.nodes){const e=null!==($=t.data)&&void 0!==$?$:t;Pe.push({id:t.id,col:y(t,ce,"—")+"",row:y(t,ue,"—")+"",sizeVal:de?Number(y(t,de,1)):1,colorKey:he?y(t,he,"")+"":"",symVal:fe?y(t,fe,"")+"":"",shadeVal:me?K(y(t,me,null)):NaN,marker:!!ye&&!!y(t,ye,!1),iconVal:pe?y(t,pe,"")+"":"",datum:e,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===Pe.length)return{sceneNodes:[]};let Te=1/0,Xe=-1/0;if(de)for(const e of Pe)Number.isFinite(e.sizeVal)&&(Te>e.sizeVal&&(Te=e.sizeVal),e.sizeVal>Xe&&(Xe=e.sizeVal));se.sizeDomain&&([Te,Xe]=se.sizeDomain),Number.isFinite(Te)&&Number.isFinite(Xe)||(Te=0,Xe=1);const Re=e=>{if(Te>=Xe)return(ve+xe)/2;const t=Math.sqrt(J((e-Te)/(Xe-Te),0,1));return ve+t*(xe-ve)};let Ve=1/0,Be=-1/0;if(me)for(const e of Pe)Number.isFinite(e.shadeVal)&&(Ve>e.shadeVal&&(Ve=e.shadeVal),e.shadeVal>Be&&(Be=e.shadeVal));se.shadeDomain&&([Ve,Be]=se.shadeDomain);const He=e=>{if(!me||!Number.isFinite(e)||Ve>=Be)return.5;const t=J((e-Ve)/(Be-Ve),0,1);return we?1-t:t},Ge=se.colorMap,qe=new Map,Ue=(t,n)=>{let o=qe.get(t);return o||(o=M(Ge&&Ge[t]||e.resolveColor(t),be),qe.set(t,o)),o(n)},_e=new Map;if(se.symbolMap)for(const[e,t]of Object.entries(se.symbolMap))_e.set(e,t);let Ke=0;const Je=se.iconMap,Qe=e=>pe&&Je&&Je[e]?Je[e]:null,Ze=e=>pe?"circle":(e=>{if(!fe)return ge;let t=_e.get(e);return t||(t=T[Ke%T.length],Ke++,_e.set(e,t)),t})(e.symVal),et=null!==(A=se.maxAreaFraction)&&void 0!==A?A:.4;let tt=0;const nt=Array(Pe.length),ot=Array(Pe.length);for(let e=0;Pe.length>e;e++){const t=Pe[e],n=Re(t.sizeVal);nt[e]=n,t.baseShape=Ze(t),t.iconShape=Qe(t.iconVal);const o=B(t.baseShape,Math.PI*n*n);ot[e]=o,tt+=Math.PI*o*o}const rt=et*Ye*De,it=tt>rt?Math.sqrt(rt/tt):1;for(let e=0;Pe.length>e;e++){const t=Pe[e],n=nt[e]*it;t.size=Math.PI*n*n,t.packR=ot[e]*it}const lt=new Map,st=new Map;for(const e of Pe)lt.set(e.col,(null!==(N=lt.get(e.col))&&void 0!==N?N:0)+1),st.set(e.row,(null!==(S=st.get(e.row))&&void 0!==S?S:0)+1);const at=null!==(O=null===(C=se.columnOrder)||void 0===C?void 0:C.filter(e=>lt.has(e)))&&void 0!==O?O:[...lt.keys()].sort((e,t)=>{var n,o;return(null!==(n=lt.get(t))&&void 0!==n?n:0)-(null!==(o=lt.get(e))&&void 0!==o?o:0)}),ct=null!==(W=null===(z=se.rowOrder)||void 0===z?void 0:z.filter(e=>st.has(e)))&&void 0!==W?W:[...st.keys()].sort((e,t)=>{var n,o;return(null!==(n=st.get(t))&&void 0!==n?n:0)-(null!==(o=st.get(e))&&void 0!==o?o:0)}),ut=b([Math.round(ae.x),Math.round(ae.y),Math.round(ae.width),Math.round(ae.height),Fe,je,Ie,Me,ke,$e,Ae,Ne,Se,Ce,ve,xe,Te,Xe,et,at.join(","),ct.join(","),Pe.length,ee(Pe)]),dt=_.getOrCompute(ut,()=>function(e,t){var n;const o=new Map;for(const t of e){let e=o.get(t.col);e||(e=[],o.set(t.col,e)),e.push(t)}const r=t.columnOrder.filter(e=>o.has(e)),i=Math.max(1,t.innerW-t.columnGap*Math.max(0,r.length-1)),l=t.proportionExponent,s=r.map(e=>Math.pow(o.get(e).length,l)),a=s.reduce((e,t)=>e+t,0)||1,c=e=>"uniform"===t.cellSizing?i/r.length:s[e]/a*i,u=new Map,d=[];let h=t.innerX;for(let e=0;r.length>e;e++)d.push({col:r[e],x:h,w:c(e)}),h+=c(e)+t.columnGap;let f=1;const m=new Map,y=[],g=(e,t,n,o)=>{let r=m.get(e);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(e,r)),r.minX>t-o&&(r.minX=t-o),t+o>r.maxX&&(r.maxX=t+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},v=(e,n,o,r,i,l)=>{const s=e.map(e=>({id:e.id,r:e.packR})),a=function(e,t,n,o,r,i,l,s){const a=t+o/2,c=n+r/2,u=new Map,d=e.length;if(0===d)return u;if(1===d)return u.set(e[0].id,{px:a,py:c}),u;const h=function(e){let t=e>>>0||1;return()=>(t=Math.imul(t,1664525)+1013904223>>>0,t/4294967296)}(s),f=new Float64Array(d);let m=0;for(let t=0;d>t;t++)f[t]=e[t].r+i,f[t]>m&&(m=f[t]);const y=Math.max(1,Math.round(Math.sqrt(d*o/Math.max(1,r)))),p=new Float64Array(d),g=new Float64Array(d),v=o/y,x=r/Math.ceil(d/y);for(let e=0;d>e;e++){const o=e%y,r=Math.floor(e/y);p[e]=t+(o+.3+.4*h())*v,g[e]=n+(r+.3+.4*h())*x}const b=Math.max(0,Math.min(l,14)),w=Math.max(1,2*m),M=new Map,k=Math.max(1,Math.ceil(o/w)+3),$=(e,t)=>(t+1)*k+(e+1);for(let e=0;b>e;e++){M.clear();for(let e=0;d>e;e++){const o=$(Math.floor((p[e]-t)/w),Math.floor((g[e]-n)/w)),r=M.get(o);r?r.push(e):M.set(o,[e])}for(let e=0;d>e;e++){const o=Math.floor((p[e]-t)/w),r=Math.floor((g[e]-n)/w);for(let t=-1;1>=t;t++)for(let n=-1;1>=n;n++){const i=M.get($(o+t,r+n));if(i)for(let t=0;i.length>t;t++){const n=i[t];if(e>=n)continue;let o=p[n]-p[e],r=g[n]-g[e];const l=f[e]+f[n],s=o*o+r*r;if(l*l>s)if(s>1e-9){const t=Math.sqrt(s),i=(l-t)/2;o/=t,r/=t,p[e]-=o*i,g[e]-=r*i,p[n]+=o*i,g[n]+=r*i}else{const t=2.39996323*e;p[e]+=Math.cos(t)*f[e],g[e]+=Math.sin(t)*f[e]}}}}for(let e=0;d>e;e++){const i=f[e],l=t+i,s=t+o-i,u=n+i,d=n+r-i;p[e]=s>l?J(p[e],l,s):a,g[e]=d>u?J(g[e],u,d):c}}for(let t=0;d>t;t++)u.set(e[t].id,{px:p[t],py:g[t]});return u}(s,n,o,r,i,t.packPadding,t.iterations,f++);let c=1/0,d=1/0,h=-1/0,m=-1/0;for(const e of s){const t=a.get(e.id);u.set(e.id,{px:t.px,py:t.py}),g(l,t.px,t.py,e.r),c>t.px-e.r&&(c=t.px-e.r),t.px+e.r>h&&(h=t.px+e.r),d>t.py-e.r&&(d=t.py-e.r),t.py+e.r>m&&(m=t.py+e.r)}return Number.isFinite(c)?{x:c-Z,y:d-Z,w:h-c+2*Z,h:m-d+2*Z}:null};if("banded"===t.rowMode){const i=new Map;for(const t of e)i.set(t.row,(null!==(n=i.get(t.row))&&void 0!==n?n:0)+1);const s=t.rowOrder.filter(e=>i.has(e)),a=Math.max(1,t.innerH-t.rowGap*Math.max(0,s.length-1)),c=s.map(e=>Math.pow(i.get(e),l)),h=c.reduce((e,t)=>e+t,0)||1,f=new Map;let y=t.innerY+t.innerH;for(let e=0;s.length>e;e++){const n="uniform"===t.cellSizing?a/s.length:c[e]/h*a,o=y-n;f.set(s[e],{y:o,h:n}),y=o-t.rowGap}r.forEach((e,t)=>{const n=p(o.get(e),e=>e.row);for(const e of s){const o=n.get(e),r=f.get(e);o&&r&&v(o,d[t].x,r.y,d[t].w,r.h,e)}});const g=[],x=new Map;for(const e of s){const t=f.get(e);x.set(e,t.y+t.h/2);const n=m.get(e);n&&Number.isFinite(n.minX)&&g.push({x:n.minX-Z,y:n.minY-Z,w:n.maxX-n.minX+2*Z,h:n.maxY-n.minY+2*Z})}return{positions:u,enclosures:g,colBands:d,rowLabelY:x}}const x=new Map;r.forEach((e,n)=>{const r=p(o.get(e),e=>e.row),i=t.rowOrder.filter(e=>r.has(e)),s=Math.max(1,t.innerH-t.rowGap*Math.max(0,i.length-1)),a=i.map(e=>Math.pow(r.get(e).length,l)),c=a.reduce((e,t)=>e+t,0)||1;let u=t.innerY+t.innerH;i.forEach((e,o)=>{var l;const h="uniform"===t.cellSizing?s/i.length:a[o]/c*s,f=u-h,m=v(r.get(e),d[n].x,f,d[n].w,h,e);if(m){y.push(m);const t=null!==(l=x.get(e))&&void 0!==l?l:{sum:0,n:0};t.sum+=m.y+m.h/2,t.n+=1,x.set(e,t)}u=f-t.rowGap})});const b=new Map;for(const[e,t]of x)b.set(e,t.sum/t.n);return{positions:u,enclosures:y,colBands:d,rowLabelY:b}}(Pe,{columnOrder:at,rowOrder:ct,innerX:Le,innerY:Ee,innerW:Ye,innerH:De,rowMode:Me,cellSizing:ke,proportionExponent:$e,columnGap:Ae,rowGap:Ne,packPadding:Se,iterations:Ce})),ht=e.selection,ft=(null==ht?void 0:ht.isActive)?ht.predicate:null,mt=null!==(F=se.highlight)&&void 0!==F?F:null,yt=null!==(j=se.dimOpacity)&&void 0!==j?j:.16,pt=se.markStroke,gt=null!==(I=se.markStrokeWidth)&&void 0!==I?I:0,vt=null!==(L=se.markerColor)&&void 0!==L?L:"#ffffff",xt=null!==(E=se.iconColor)&&void 0!==E?E:"rgba(255,255,255,0.92)",bt=null!==(Y=se.iconStrokeWidth)&&void 0!==Y?Y:1,wt=null!==(D=se.iconScale)&&void 0!==D?D:.72,Mt=[],kt=[],$t=[];for(const e of Pe){const t=dt.positions.get(e.id);if(!t)continue;const n=x(e.datum,{highlight:mt,predicate:ft,dimOpacity:yt}),o={type:"symbol",cx:t.px,cy:t.py,size:e.size,symbolType:e.baseShape,style:Object.assign({fill:Ue(e.colorKey,He(e.shadeVal)),opacity:n},pt?{stroke:pt,strokeWidth:gt}:{}),datum:e.datum,id:e.id,label:e.id+""};if(Mt.push(o),e.iconShape){const o=Math.sqrt(e.size/Math.PI)*wt,r=B(e.iconShape,100);$t.push({x:t.px,y:t.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:e.iconShape,opacity:n})}e.marker&&n>yt+.001&&kt.push({x:t.px,y:t.py,r:Math.max(1,.4*Math.sqrt(e.size/Math.PI))})}const At=[];if(se.callouts&&se.callouts.length>0){const e=null!==(P=se.calloutColor)&&void 0!==P?P:"var(--semiotic-text, #f4f4f8)",t=ae.y+ae.height-(Ie>0?.45*Ie:9),n=[];for(let e=0;se.callouts.length>e;e++){const t=se.callouts[e],o=Pe.find(e=>e.datum[t.field]+""==t.value+"");if(!o)continue;const r=dt.positions.get(o.id);r&&n.push({c:t,ci:e,px:r.px,py:r.py,markR:Math.sqrt(o.size/Math.PI)})}const o=n.filter(e=>null==e.c.at).sort((e,t)=>e.px-t.px),r=new Map;o.forEach((e,t)=>{r.set(e.ci,Le+(t+.5)/o.length*Ye)});for(const o of n){const n=o.c;let i=null!==(R=r.get(o.ci))&&void 0!==R?R:o.px,l=t;const s=null!==(V=n.connector)&&void 0!==V?V:r.has(o.ci)?"elbow":"straight";"object"==typeof n.at&&n.at?(i=n.at.x,l=n.at.y):"number"==typeof n.at&&(l=ae.y+n.at*ae.height),At.push({keyId:"callout-"+o.ci,markX:o.px,markY:o.py,labelX:i,labelY:l,label:n.label,connector:s,markRadius:Math.max(o.markR+3,7),stroke:e,color:e,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const Nt=function(e,t){var r,i;const l=null!==(r=t.columnLabel)&&void 0!==r?r:e=>e,s=null!==(i=t.rowLabel)&&void 0!==i?i:e=>e;return o("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[t.showEnclosures&&e.enclosures.map((e,n)=>H({keyId:"enc-"+n,x:e.x,y:e.y,width:e.w,height:e.h,radius:t.enclosureRadius,stroke:t.enclosureColor,strokeWidth:t.enclosureWidth,opacity:t.enclosureOpacity})),t.iconMarks.length>0&&n("g",{className:"packed-cluster-matrix-icons",children:t.iconMarks.map((e,o)=>n("path",{d:X(e.shape,e.size),transform:`translate(${e.x},${e.y})`,fill:"none",stroke:t.iconColor,strokeWidth:t.iconStrokeWidth,opacity:e.opacity},"ic-"+o))}),t.markerDots.length>0&&n("g",{className:"packed-cluster-matrix-markers",children:t.markerDots.map((e,o)=>n("circle",{cx:e.x,cy:e.y,r:e.r,fill:t.markerColor},"mk-"+o))}),t.showColumnHeaders&&e.colBands.map((e,n)=>q({keyId:"col-"+n,text:l(e.col),x:e.x+e.w/2,y:t.headerY,anchor:"middle",fontSize:t.headerFontSize,fontWeight:700,color:t.headerColor})),t.showRowLabels&&[...e.rowLabelY].map(([e,n])=>q({keyId:"row-"+e,text:s(e),x:t.labelX,y:n,anchor:"end",fontSize:t.labelFontSize,fontWeight:600,color:t.labelColor})),t.callouts.map(e=>U(e))]})}(dt,{markerDots:kt,markerColor:vt,iconMarks:$t,iconColor:xt,iconStrokeWidth:bt,callouts:At,showEnclosures:Oe,showColumnHeaders:ze,showRowLabels:We,enclosureColor:null!==(G=se.enclosureColor)&&void 0!==G?G:"var(--semiotic-text, #f4f4f8)",enclosureRadius:null!==(Q=se.enclosureRadius)&&void 0!==Q?Q:9,enclosureOpacity:null!==(te=se.enclosureOpacity)&&void 0!==te?te:.5,enclosureWidth:null!==(ne=se.enclosureWidth)&&void 0!==ne?ne:1.5,headerColor:null!==(oe=se.headerColor)&&void 0!==oe?oe:"var(--semiotic-text, #f4f4f8)",labelColor:null!==(re=se.labelColor)&&void 0!==re?re:"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:null!==(ie=se.headerFontSize)&&void 0!==ie?ie:13,labelFontSize:null!==(le=se.labelFontSize)&&void 0!==le?le:11,headerY:ae.y+.62*Fe,labelX:ae.x+je-10,columnLabel:se.columnLabel,rowLabel:se.rowLabel});return{sceneNodes:Mt,overlays:Nt}},Z=4;function ee(e){let t=2166136261;const n=e=>{for(let n=0;e.length>n;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)};for(const o of e)n(o.id),n(o.col),n(o.row),t^=Math.round(8*o.packR),t=Math.imul(t,16777619);return(t>>>0).toString(36)}const te=e=>{var t,n,o,r,i,l,s;const a=e.config,{plot:c}=e.dimensions;if(0>=c.width||0>=c.height)return{nodes:[]};const u=m(a.categoryAccessor),d=m(a.stackBy),f=e=>{const t="function"==typeof a.valueAccessor?a.valueAccessor(e):e[a.valueAccessor],n=Number(t);return Number.isFinite(n)&&n>0?n:0},y=null!==(t=a.gutter)&&void 0!==t?t:2,p="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",v="string"==typeof a.stackBy?a.stackBy:"stack",x="string"==typeof a.valueAccessor?a.valueAccessor:"value",b=(e,t,n)=>g(o=>{o("category",e),o("stack",t),o("value",n),"category"!==p&&o(p,e),"stack"!==v&&o(v,t),"value"!==x&&o(x,n)}),w=!1!==a.showCategoryLabels,M=null!==(n=a.labelPadding)&&void 0!==n?n:w?22:0,k=Math.max(0,c.height-M),$=[],A=new Map,N=[],S=new Set,C=new Map;for(const t of e.data){const e=u(t)+"",n=d(t)+"",i=f(t);A.has(e)||($.push(e),A.set(e,0),C.set(e,new Map)),S.has(n)||(S.add(n),N.push(n)),A.set(e,(null!==(o=A.get(e))&&void 0!==o?o:0)+i);const l=C.get(e);l.set(n,(null!==(r=l.get(n))&&void 0!==r?r:0)+i)}const O=a.categoryOrder?ne(a.categoryOrder,$,e=>A.has(e)):$,z=a.stackOrder?ne(a.stackOrder,N,()=>!0):N,W=O.reduce((e,t)=>{var n;return e+(null!==(n=A.get(t))&&void 0!==n?n:0)},0);if(0>=W)return{nodes:[]};const F=Math.max(0,c.width-y*Math.max(0,O.length-1)),j=[],I=[];let L=c.x;for(const t of O){const n=null!==(i=A.get(t))&&void 0!==i?i:0,o=n/W*F;if(0>=o)continue;I.push({cat:t,x:L,w:o});const r=C.get(t);let s=c.y;for(const i of z){const a=null!==(l=r.get(i))&&void 0!==l?l:0;if(0>=a)continue;const c=a/n*k;j.push({type:"rect",x:L,y:s,w:o,h:c,style:{fill:e.resolveColor(i),stroke:"none"},datum:b(t,i,a),group:i}),s+=c}L+=o+y}return{nodes:j,overlays:w&&I.length>0?function(e,t,n){const o=e.map((e,o)=>q({keyId:"marimekko-label-"+o,text:e.cat,x:e.x+e.w/2,y:t+12,anchor:"middle",baseline:"auto",maxWidth:e.w-4,fontSize:12,color:n}));return h.createElement(h.Fragment,null,...o)}(I,c.y+k+4,`var(--semiotic-text, ${null!==(s=e.theme.semantic.text)&&void 0!==s?s:"currentColor"})`):null}};function ne(e,t,n){const o=new Set,r=[];for(const t of e)n(t)&&!o.has(t)&&(o.add(t),r.push(t));for(const e of t)o.has(e)||r.push(e);return r}const oe=e=>{var t,n,o,r,i,l,s,a,c,u,d,f;const y=e.config,{plot:p}=e.dimensions;if(0>=p.width||0>=p.height||0===e.data.length)return{nodes:[]};const v=null!==(t=y.rowHeight)&&void 0!==t?t:28,x=null!==(n=y.rowGap)&&void 0!==n?n:12,b=!1!==y.showLabels,w=b?null!==(o=y.labelWidth)&&void 0!==o?o:120:0,M=!1!==y.showTicks,k=M?14:0,$=null!==(r=y.tickFormat)&&void 0!==r?r:e=>e.toLocaleString(),A=p.x+w,N=Math.max(0,p.width-w);if(0>=N)return{nodes:[]};const S=m(y.categoryAccessor),C=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:0},O=e=>C("function"==typeof y.valueAccessor?y.valueAccessor(e):e[y.valueAccessor]),z=e=>C("function"==typeof y.targetAccessor?y.targetAccessor(e):e[y.targetAccessor]),W=e=>{const t="function"==typeof y.rangesAccessor?y.rangesAccessor(e):e[y.rangesAccessor];return Array.isArray(t)?t.map(C).sort((e,t)=>e-t):[]},F="string"==typeof y.categoryAccessor?y.categoryAccessor:"metric",j="string"==typeof y.valueAccessor?y.valueAccessor:"value",I="string"==typeof y.targetAccessor?y.targetAccessor:"target",L=null!==(l=null!==(i=y.actualColor)&&void 0!==i?i:e.theme.semantic.primary)&&void 0!==l?l:"#3b6cb1",E=null!==(s=e.theme.semantic.text)&&void 0!==s?s:"currentColor",Y=null!==(a=e.theme.semantic.textSecondary)&&void 0!==a?a:"#888",D=null!==(c=e.theme.semantic.surface)&&void 0!==c?c:"#e8eaed",P=null!==(u=e.theme.semantic.grid)&&void 0!==u?u:"#cdd1d6",T=null!==(d=e.theme.semantic.border)&&void 0!==d?d:"#a3a8af",X=null!==(f=y.targetColor)&&void 0!==f?f:`var(--semiotic-text, ${E})`,R=[`var(--semiotic-surface, ${D})`,`var(--semiotic-grid, ${P})`,`var(--semiotic-border, ${T})`],V=`var(--semiotic-text, ${E})`,B=`var(--semiotic-text-secondary, ${Y})`,H=[],G=[];for(let t=0;e.data.length>t;t++){const n=e.data[t],o=W(n),r=O(n),i=z(n),l=Math.max(r,i,...o.length?o:[0]);if(0>=l)continue;const s=p.y+t*(v+x+k);if(s+v+k>p.y+p.height)break;G.push({yTop:s,label:S(n),actual:r,target:i,maxVal:l});const a=e=>A+e/l*N,c=S(n),u=e=>g(t=>{t("metric",c),"metric"!==F&&t(F,c),e(t)});let d=A;for(let e=0;o.length>e;e++){const t=a(o[e]),n=t-d;n>0&&H.push({type:"rect",x:d,y:s,w:n,h:v,style:{fill:R[Math.min(e,R.length-1)],stroke:"none"},datum:u(t=>{t("range",e),t("rangeValue",o[e]),t("kind","range")}),group:"range-"+e}),d=t}const h=Math.max(6,Math.floor(.45*v));H.push({type:"rect",x:A,y:s+(v-h)/2,w:a(r)-A,h:h,style:{fill:L,stroke:"none"},datum:u(e=>{e("value",r),e("kind","actual"),"value"!==j&&e(j,r)}),group:"actual"});const f=3,m=Math.floor(.8*v);H.push({type:"rect",x:a(i)-f/2,y:s+(v-m)/2,w:f,h:m,style:{fill:X,stroke:"none"},datum:u(e=>{e("target",i),e("kind","target"),"target"!==I&&e(I,i)}),group:"target"})}const U=[];for(let e=0;G.length>e;e++){const t=G[e];if(b&&U.push(q({keyId:"bullet-label-"+e,text:t.label,x:p.x+w-8,y:t.yTop+v/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:V})),M){const n=5,o=t.yTop+v+2;for(let r=0;n>r;r++){const i=t.maxVal*r/(n-1),l=A+i/t.maxVal*N;U.push(h.createElement("line",{key:`bullet-tick-${e}-${r}`,x1:l,x2:l,y1:o,y2:o+3,stroke:B,strokeWidth:1}),q({keyId:`bullet-ticktext-${e}-${r}`,text:$(i),x:l,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:B}))}}}return{nodes:H,overlays:U.length>0?h.createElement(h.Fragment,null,...U):null}},re=e=>{var t,n,o,r,i,l,s,a,c,u,d,m;const y=e.config,{plot:p}=e.dimensions,g=null!==(t=y.fields)&&void 0!==t?t:[];if(2>g.length||0>=p.width||0>=p.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};const v={};for(const t of g){if(null===(n=y.domains)||void 0===n?void 0:n[t]){v[t]=y.domains[t];continue}let o=1/0,r=-1/0;for(const n of e.data){const e=Number(n[t]);Number.isFinite(e)&&(o>e&&(o=e),e>r&&(r=e))}v[t]=Number.isFinite(o)&&Number.isFinite(r)&&o!==r?[o,r]:[0,1]}const b=!1!==y.showAxes,w=b?null!==(o=y.axisLabelPadding)&&void 0!==o?o:24:8,M=b?18:8,k=g.map(e=>f().domain(v[e]).range([p.y+p.height-M,p.y+w])),$=g.map((e,t)=>1===g.length?p.x+p.width/2:p.x+t/(g.length-1)*p.width),A=y.colorBy?"function"==typeof y.colorBy?y.colorBy:e=>{var t;return(null!==(t=e[y.colorBy])&&void 0!==t?t:"")+""}:null,N=null!==(r=y.opacity)&&void 0!==r?r:.45,S=null!==(i=y.strokeWidth)&&void 0!==i?i:1.25,C=null!==(l=e.theme.semantic.primary)&&void 0!==l?l:"#3b6cb1",O=null!==(s=y.dimmedOpacity)&&void 0!==s?s:.08,z=y.highlightFn,W=[],F=[];for(const t of e.data){const n=A?e.resolveColor(A(t)+""):C,o=!z||z(t),r=x(t,{predicate:z,baseOpacity:N,dimOpacity:O,brighten:.4}),i=o?F:W;for(let e=0;g.length-1>e;e++){const l=Number(t[g[e]]),s=Number(t[g[e+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:$[e],y1:k[e](l),x2:$[e+1],y2:k[e+1](s),style:{stroke:n,strokeWidth:z&&o?S+.75:S,opacity:r,fill:"none"},datum:t};i.push(a)}if(y.showPoints)for(let e=0;g.length>e;e++){const o=Number(t[g[e]]);if(!Number.isFinite(o))continue;const l={type:"point",x:$[e],y:k[e](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,r+.3)},datum:t};i.push(l)}}let j=null;if(b){const t=`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#aaa"})`,n=`var(--semiotic-text, ${null!==(c=e.theme.semantic.text)&&void 0!==c?c:"currentColor"})`,o=`var(--semiotic-text-secondary, ${null!==(u=e.theme.semantic.textSecondary)&&void 0!==u?u:"#888"})`,r=p.y+w,i=p.y+p.height-M,l=[];for(let e=0;g.length>e;e++){const s=g[e],a=$[e],c=null!==(m=null===(d=y.tickFormat)||void 0===d?void 0:d[s])&&void 0!==m?m:e=>e.toLocaleString();l.push(h.createElement("line",{key:"pc-axis-line-"+e,x1:a,x2:a,y1:r,y2:i,stroke:t,strokeWidth:1})),l.push(q({keyId:"pc-axis-label-"+e,text:s,x:a,y:p.y+w-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:n}));const[u,f]=v[s],x=5;for(let n=0;x>n;n++){const r=u+(f-u)*n/(x-1),i=k[e](r);l.push(h.createElement("line",{key:`pc-tick-${e}-${n}`,x1:a-3,x2:a+3,y1:i,y2:i,stroke:t,strokeWidth:1}),q({keyId:`pc-ticktext-${e}-${n}`,text:c(r),x:a+6,y:i+3,anchor:"start",baseline:"auto",fontSize:10,color:o}))}}j=h.createElement(h.Fragment,null,...l)}return{nodes:W.concat(F),overlays:j}};function ie(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function le(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function se(e){return null==e?null:e+""}function ae(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}const ce=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function ue(e){return!!e&&"object"==typeof e&&ce.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}new Set(["label","callout","callout-circle","callout-rect"]);const de=2e4;function he(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function fe(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function me(e){var t,n;let o;const r=null==e?void 0:e.emphasis;o="primary"===r?100:"secondary"===r?10:50;const i=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof i&&Number.isFinite(i)&&(o+=15*Math.max(0,Math.min(1,i))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function ye(e){var t;const{annotations:n,width:o,height:r}=e,i=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),l=fe(o,r,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,ue(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(e=>he(e.annotation)),u=a.filter(e=>!he(e.annotation)).sort((e,t)=>me(t.annotation)-me(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,i-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],m=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?f.push(e):m.push(e);return{visible:f,deferred:m,budget:l}}const pe=32,ge=6,ve=4,xe=8,be=72;const we={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Me(e){return ue(e)}function ke(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function $e(e,t,n,o,r){const i=e+n,l=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?l-r.height:l,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?l-r.height-4:l+4,width:r.width,height:r.height}}function Ae(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Ne(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Se(e,t,n,o,r,i,l,s){const a=Ae(e,l);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,r,i,s);for(const e of n)c+=12*Ne(a,e);for(const e of o)c+=4*Ne(a,e);return c}function Ce(e,t,n){var o,r;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const i=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=i&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===i);if(e)return{x:e.x,y:e.y}}const l=e.coordinates,s=null===(r=n.scales)||void 0===r?void 0:r.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,n){var o,r;const i=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===i){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return ae(t,n,{x:r.x,y:r.y})}const o=function(e){var t,n,o,r,i,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?ae(t,n,o):null}if("semantic"===i){const o=function(e,t,n){var o,r;const i=function(e){var t,n;return se(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!i)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>se(e.pointId)===i);if(l)return ae(t,n,{x:l.x,y:l.y});const s=null===(r=n.data)||void 0===r?void 0:r.find(e=>function(e){var t,n,o;return se(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===i);if(!s)return null;const a=ie(s,n),c=le(s,n);return null==a||null==c?null:ae(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let l=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,s=t.y)}if(null!=l&&null!=s||(l=ie(e,n),s=le(e,n)),null!=l&&null!=s)return ae(t,n,{x:l,y:s});if("sticky"===i){const e=null===(r=n.stickyPositionCache)||void 0===r?void 0:r.get(t);if(e)return e}return null}(e,t,n):{x:e.x,y:e.y}}function Oe(e){var t;const{annotations:n,context:o,defaultOffset:r=pe,notePadding:i=ge,markPadding:l=ve,edgePadding:s=xe,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=be,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:m,cohesion:y,audience:p}=e,g=o.width||0,v=o.height||0;if(0===n.length||0>=g||0>=v)return n.slice();const x=[],b=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const M=n.map((e,t)=>{if(!Me(e))return e;const n=Ce(e,t,o);if(!n)return e;const l=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...ke("string"==typeof e.title?e.title:void 0,t),...ke("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return x.push(Ae($e(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),i)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Se($e(n.x,n.y,e.dx,e.dy,l),e,x,b,g,v,i,s);f>t&&(h=e,f=t)}if(!h)return e;const m=Ae($e(n.x,n.y,h.dx,h.dy,l),i);x.push(m);const y=Math.hypot(h.dx,h.dy),p=c&&y>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),p?{connector:p}:{})}),k=w?M:n.slice();let $=k;if(f){let e=!1;const t=k.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});$=e?t:k}{let e=!1;const t=$.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=we[n.source])&&void 0!==t?t:n.source:null,r="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[o,r].filter(Boolean).join(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${i})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${i})`:`(${i})`})}(t);return n!==t&&(e=!0),n});$=e?t:$}const A=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(p),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:fe(g,v,e))*n))}),{deferred:r}=ye(Object.assign({annotations:$,width:g,height:v},o));for(const e of r)A.add(e)}if(m&&("object"==typeof m&&"number"==typeof m.minWidth?m.minWidth:480)>=g)for(const e of $)Me(e)&&"secondary"===e.emphasis&&A.add(e);if(A.size>0)for(const e of $)!0===(null==e?void 0:e.defensive)&&A.delete(e);let N;return N=0===A.size?$:h?$.map(e=>A.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):$.filter(e=>!A.has(e)),y?function(e,t){let n=!1;const o=e.map(e=>Me(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(N,y):N}const ze="var(--semiotic-text, currentColor)";function We(e,t){const n=B(e,100);return n>0?t/n*100*(t/n):Math.PI*t*t}function Fe(e){var t,o,r,i,l,s,a;const c=[],u=e.colorMap?Object.entries(e.colorMap):e.keys?e.keys.map(t=>[t,e.color?e.color(t):void 0]):[];if(u.length>0){const n=null!==(t=e.colorType)&&void 0!==t?t:"fill",r=u.map(([e,t])=>({label:e,color:t})),i="line"===n?e=>{var t;return{stroke:null!==(t=e.color)&&void 0!==t?t:ze,strokeWidth:2,fill:"none"}}:e=>{var t,n;return{fill:null!==(t=e.color)&&void 0!==t?t:ze,stroke:null!==(n=e.color)&&void 0!==n?n:ze}};c.push({type:n,label:null!==(o=e.colorLabel)&&void 0!==o?o:"",items:r,styleFn:i})}if(e.symbolMap&&Object.keys(e.symbolMap).length>0){const t=null!==(r=e.symbolColor)&&void 0!==r?r:ze,o=Object.entries(e.symbolMap).map(([e,n])=>({label:e,shape:n,color:t}));c.push({label:null!==(i=e.symbolLabel)&&void 0!==i?i:"",items:o,styleFn:()=>({}),type:e=>{var o;const r=e.shape;return n("path",{d:X(r,We(r,7)),transform:"translate(8,8)",fill:null!==(o=e.color)&&void 0!==o?o:t})}})}if(e.sizeStops&&e.sizeStops.length>0&&e.sizeRadius){const t=e.sizeRadius,o=null!==(l=e.sizeFormat)&&void 0!==l?l:e=>e+"",r=null!==(s=e.sizeColor)&&void 0!==s?s:ze,i=e.sizeStops.map(e=>({label:o(e),r:Math.max(.5,t(e)),color:r}));c.push({label:null!==(a=e.sizeLabel)&&void 0!==a?a:"",items:i,styleFn:()=>({}),type:e=>{var t;return n("circle",{cx:8,cy:8,r:e.r,fill:null!==(t=e.color)&&void 0!==t?t:r})}})}return c}const je={isActive:!1,predicate:()=>!0},Ie=h.createContext(null);function Le(){var e;return null!==(e=h.useContext(Ie))&&void 0!==e?e:je}const Ee=new Set(["rows"]);function Ye(e){const t=e,n=[Xe(t,["datum","data"]),Xe(t,["datum"]),Xe(t,["data","data"]),Xe(t,["data"]),Xe(t,["node","datum","data"]),Xe(t,["node","datum"]),e];for(const e of n){if(!Re(e))continue;const t={};for(const[n,o]of Object.entries(e))n.startsWith("_")||"function"==typeof o||(t[n]=o);if(Object.keys(t).length>0)return t}return null}function De(e,t={}){var n;const o=Ye(e);if(!o)return[];const r=new Set(Ee);if(t.excludeKeys)for(const e of t.excludeKeys)r.add(e);const i=[];for(const[e,l]of Object.entries(o))if((t.includeInternal||!e.startsWith("_"))&&!r.has(e)&&(t.includeEmpty||null!=l&&""!==l)&&"function"!=typeof l&&(i.push({key:e,label:Te(e,t.labels),value:l,formatted:t.valueFormat?t.valueFormat(l,e,o):Pe(l)}),i.length>=(null!==(n=t.maxEntries)&&void 0!==n?n:8)))break;return i}function Pe(e){if(null==e)return"";if(e instanceof Date)return e.toISOString();if("number"==typeof e)return Number.isInteger(e)?e+"":e.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof e)return e?"true":"false";if(Array.isArray(e))return e.length+" items";if("object"==typeof e)try{return JSON.stringify(e)}catch(t){return e+""}return e+""}function Te(e,t){return"function"==typeof t?t(e):t&&t[e]?t[e]:e}function Xe(e,t){let n=e;for(const e of t){if(!Re(n))return;n=n[e]}return n}function Re(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}export{de as DEFAULT_AREA_PER_ANNOTATION,w as LayoutCache,T as SYMBOL_SEQUENCE,fe as annotationBudget,ye as annotationDensity,Oe as annotationLayout,q as bandLabel,G as boundsOf,De as buildTooltipEntries,oe as bulletLayout,N as calendarLayout,z as dagreLayout,x as dimFor,Ye as extractTooltipDatum,O as flextreeLayout,Pe as formatTooltipValue,p as groupBy,Fe as legendGroupsFrom,I as lineageDagLayout,M as makeShade,te as marimekkoLayout,U as markCallout,v as matchesHighlight,D as mermaidDagLayout,Q as packedClusterMatrix,re as parallelCoordinatesLayout,y as readField,H as roundedEnclosure,k as shade,b as signatureKey,B as symbolExtent,X as symbolPathString,R as symbolRadius,Le as useCustomLayoutSelection,$ as waffleLayout};