semiotic 3.8.5 → 3.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CLAUDE.md +5 -4
  2. package/README.md +42 -42
  3. package/ai/behaviorContracts.cjs +2 -2
  4. package/ai/componentMetadata.cjs +1 -1
  5. package/ai/dist/mcp-server.js +2 -0
  6. package/ai/examples.md +44 -2
  7. package/ai/schema.json +385 -14
  8. package/ai/surface-manifest.json +6 -4
  9. package/ai/system-prompt.md +1 -1
  10. package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2CHN2TA3.module.min.js +1 -0
  12. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
  13. package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
  14. package/dist/chunk-chunk-3SHB24AG.module.min.js +1 -0
  15. package/dist/chunk-chunk-4MMOOYTX.module.min.js +2 -0
  16. package/dist/{chunk-chunk-KT2VAZMZ.module.min.js → chunk-chunk-75OTQSXS.module.min.js} +1 -1
  17. package/dist/chunk-chunk-A5GRQUOF.module.min.js +1 -0
  18. package/dist/chunk-chunk-AAF5LZAU.module.min.js +2 -0
  19. package/dist/{chunk-chunk-4AANPFOX.module.min.js → chunk-chunk-ARZGA4LJ.module.min.js} +1 -1
  20. package/dist/chunk-chunk-CAFLML4L.module.min.js +2 -0
  21. package/dist/chunk-chunk-FHBN7OEB.module.min.js +2 -0
  22. package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-GFTVACTO.module.min.js} +1 -1
  23. package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
  24. package/dist/chunk-chunk-ITDWLZXV.module.min.js +2 -0
  25. package/dist/chunk-chunk-LPSPATPC.module.min.js +1 -0
  26. package/dist/chunk-chunk-OM6NWS4H.module.min.js +2 -0
  27. package/dist/chunk-chunk-PX5YQGDP.module.min.js +2 -0
  28. package/dist/chunk-chunk-Q2BS46W2.module.min.js +2 -0
  29. package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-RA7JCG7D.module.min.js} +1 -1
  30. package/dist/chunk-chunk-RNUHEXZA.module.min.js +2 -0
  31. package/dist/chunk-chunk-ROZWKEUG.module.min.js +1 -0
  32. package/dist/chunk-chunk-SMVD3EQJ.module.min.js +2 -0
  33. package/dist/chunk-chunk-T2FKJD4O.module.min.js +2 -0
  34. package/dist/{chunk-chunk-K3DMEW22.module.min.js → chunk-chunk-UDREYOLV.module.min.js} +1 -1
  35. package/dist/chunk-chunk-VOWE3SAP.module.min.js +2 -0
  36. package/dist/chunk-chunk-VQPNBUSW.module.min.js +2 -0
  37. package/dist/{chunk-chunk-N5DDKCCF.module.min.js → chunk-chunk-WAWCIHFJ.module.min.js} +1 -1
  38. package/dist/{chunk-chunk-XXWSHGPL.module.min.js → chunk-chunk-WYARAXHR.module.min.js} +1 -1
  39. package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-XP3OHHFX.module.min.js} +1 -1
  40. package/dist/chunk-chunk-XV3KGYTR.module.min.js +2 -0
  41. package/dist/chunk-chunk-YC2IVEPX.module.min.js +1 -0
  42. package/dist/components/ai/chartCapabilities.d.ts +2 -1
  43. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  44. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  45. package/dist/components/charts/index.d.ts +3 -0
  46. package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
  47. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  48. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
  49. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
  50. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
  51. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
  52. package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
  53. package/dist/components/charts/shared/gradient.d.ts +35 -0
  54. package/dist/components/charts/shared/hatchFill.d.ts +3 -10
  55. package/dist/components/charts/shared/hooks.d.ts +2 -50
  56. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  57. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
  58. package/dist/components/charts/shared/useChartLegend.d.ts +58 -0
  59. package/dist/components/charts/shared/useChartSetup.d.ts +5 -0
  60. package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
  61. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
  62. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  63. package/dist/components/charts/xy/AreaChart.d.ts +25 -42
  64. package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
  65. package/dist/components/charts/xy/BumpChart.d.ts +161 -0
  66. package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
  67. package/dist/components/charts/xy/Heatmap.d.ts +3 -0
  68. package/dist/components/charts/xy/LineChart.d.ts +6 -8
  69. package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
  70. package/dist/components/legendLayout.d.ts +19 -1
  71. package/dist/components/semiotic-ai.d.ts +2 -1
  72. package/dist/components/semiotic-geo.d.ts +1 -0
  73. package/dist/components/semiotic-network.d.ts +1 -0
  74. package/dist/components/semiotic-ordinal.d.ts +2 -0
  75. package/dist/components/semiotic-physics.d.ts +1 -0
  76. package/dist/components/semiotic-realtime-core.d.ts +1 -0
  77. package/dist/components/semiotic-server-edge.d.ts +1 -1
  78. package/dist/components/semiotic-server.d.ts +1 -1
  79. package/dist/components/semiotic-xy.d.ts +4 -0
  80. package/dist/components/semiotic.d.ts +4 -4
  81. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  82. package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
  83. package/dist/components/server/staticLegend.d.ts +4 -2
  84. package/dist/components/server/staticSVGChrome.d.ts +4 -4
  85. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
  86. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
  87. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
  88. package/dist/components/stream/SVGOverlay.d.ts +2 -6
  89. package/dist/components/stream/StalenessBadge.d.ts +2 -6
  90. package/dist/components/stream/geoTypes.d.ts +3 -6
  91. package/dist/components/stream/legendRenderer.d.ts +2 -6
  92. package/dist/components/stream/ordinalTypes.d.ts +7 -31
  93. package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
  94. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
  95. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
  96. package/dist/components/stream/pipelineConfig.d.ts +7 -15
  97. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
  98. package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
  99. package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
  100. package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
  101. package/dist/components/stream/types.d.ts +32 -56
  102. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
  103. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
  104. package/dist/components/types/legendTypes.d.ts +15 -6
  105. package/dist/geo.min.js +1 -1
  106. package/dist/geo.module.min.js +1 -1
  107. package/dist/network.min.js +1 -1
  108. package/dist/network.module.min.js +1 -1
  109. package/dist/ordinal.min.js +1 -1
  110. package/dist/ordinal.module.min.js +1 -1
  111. package/dist/physics.min.js +1 -1
  112. package/dist/physics.module.min.js +1 -1
  113. package/dist/physicsWorker.js +1 -1
  114. package/dist/realtime.min.js +1 -1
  115. package/dist/realtime.module.min.js +1 -1
  116. package/dist/semiotic-ai-core.min.js +1 -1
  117. package/dist/semiotic-ai-core.module.min.js +1 -1
  118. package/dist/semiotic-ai.d.ts +2 -1
  119. package/dist/semiotic-ai.min.js +1 -1
  120. package/dist/semiotic-ai.module.min.js +1 -1
  121. package/dist/semiotic-experimental.min.js +1 -1
  122. package/dist/semiotic-experimental.module.min.js +1 -1
  123. package/dist/semiotic-geo.d.ts +1 -0
  124. package/dist/semiotic-network.d.ts +1 -0
  125. package/dist/semiotic-ordinal.d.ts +2 -0
  126. package/dist/semiotic-physics.d.ts +1 -0
  127. package/dist/semiotic-realtime-core.d.ts +1 -0
  128. package/dist/semiotic-realtime-core.min.js +1 -1
  129. package/dist/semiotic-realtime-core.module.min.js +1 -1
  130. package/dist/semiotic-recipes-core.module.min.js +1 -1
  131. package/dist/semiotic-recipes.module.min.js +1 -1
  132. package/dist/semiotic-server-edge.d.ts +1 -1
  133. package/dist/semiotic-server-edge.min.js +1 -1
  134. package/dist/semiotic-server-edge.module.min.js +1 -1
  135. package/dist/semiotic-server-node.min.js +1 -1
  136. package/dist/semiotic-server-node.module.min.js +1 -1
  137. package/dist/semiotic-server.d.ts +1 -1
  138. package/dist/semiotic-utils-core.min.js +1 -1
  139. package/dist/semiotic-utils-core.module.min.js +1 -1
  140. package/dist/semiotic-utils.min.js +1 -1
  141. package/dist/semiotic-utils.module.min.js +1 -1
  142. package/dist/semiotic-xy.d.ts +4 -0
  143. package/dist/semiotic.d.ts +4 -4
  144. package/dist/semiotic.min.js +1 -1
  145. package/dist/semiotic.module.min.js +1 -1
  146. package/dist/server.min.js +1 -1
  147. package/dist/server.module.min.js +1 -1
  148. package/dist/xy.min.js +1 -1
  149. package/dist/xy.module.min.js +1 -1
  150. package/package.json +1 -1
  151. package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
  152. package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
  153. package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
  154. package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
  155. package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
  156. package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
  157. package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
  158. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
  159. package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
  160. package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
  161. package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
  162. package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
  163. package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
  164. package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
  165. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
  166. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
  167. package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
  168. package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
  169. package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
  170. package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
  171. package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
  172. package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
  173. package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
  174. package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
  175. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
  176. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as i}from"./chunk-chunk-J3XWETBJ.module.min.js";import{GeoCustomChart as n,StreamGeoFrame_default as r}from"./chunk-chunk-NLO44TOS.module.min.js";import{mergeShapeStyle as a,normalizePartialMargin as l,useChartSetup as s,useFrameImperativeHandle as c,useResolvedSelection as d}from"./chunk-chunk-SKMBCFIL.module.min.js";import"./chunk-chunk-BANTPINB.module.min.js";import"./chunk-chunk-PZJ2SBLL.module.min.js";import"./chunk-chunk-TMWIZL3K.module.min.js";import{buildCustomBehaviorProps as m}from"./chunk-chunk-XXWSHGPL.module.min.js";import"./chunk-chunk-5UKL5W76.module.min.js";import{composeStyleRules as u,makeNodeRuleContext as h,makeRuleValueResolver as p,matchesThreshold as f,resolveStyleRules as y,ruleMatches as g}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-LJLS6DY7.module.min.js";import{DEFAULT_COLOR as b,EMPTY_ARRAY as v,filterSparseArray as k,getColor as w,getSequentialInterpolator as S,getSize as x,hatchFillId as C,hatchPatternDef as A,isHatchFill as H,normalizeLinkedHover as R,normalizeTooltip as j,resolveAxisFreeMarginDefaults as I,resolveResponsiveRules as L,resolveSvgFill as P,responsiveRuleMatches as M,useChartMode as N,useChartSelection as z,useLinkedHover as W,useObservationSelector as B,useThemeSequential as T,wrapStyleWithSelection as O}from"./chunk-chunk-CWQ5YIHX.module.min.js";import{getMinMax as F}from"./chunk-chunk-JJ2OOIET.module.min.js";import"./chunk-chunk-WCX6U47H.module.min.js";import{glyphExtent as E,glyphPlacement as D}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as U,SafeRender as Z,renderEmptyState as G,renderLoadingState as J,warnMissingField as $}from"./chunk-chunk-ACLDBMRH.module.min.js";import"./chunk-chunk-YHNZCPOZ.module.min.js";import{useMemo as _}from"react";import{scaleSequential as K}from"d3-scale";import{useState as X,useEffect as q,useMemo as Y}from"react";import{feature as Q}from"topojson-client";var V=new Map;function ee(e){return"default"in e?e.default:e}async function te(e){const t=V.get(e);if(t)return t;const{topology:o,objectName:i}=await async function(e){try{switch(e){case"world-110m":return{topology:ee(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ee(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ee(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ee(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:t});throw t}}(e);if(!o||!o.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof o} with keys: ${o?Object.keys(o).join(", "):"none"}`);const n=Q(o,o.objects[i]),r="features"in n?n.features:[n];return V.set(e,r),r}function oe(e){const t=Y(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=X(null);return q(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),te(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==t?t:o}import{jsx as ie,jsxs as ne}from"react/jsx-runtime";function re(e){const t=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=T(),{areas:i,valueAccessor:n,styleRules:s,colorScheme:c,projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:y,zoomExtent:g,onZoom:b,dragRotate:v,tileURL:w,tileAttribution:x,tileCacheSize:C,tooltip:A,areaOpacity:H=1,annotations:R,margin:L,className:P,selection:M,linkedHover:W,onObservation:B,onClick:F,chartId:E,loading:D,loadingContent:$,emptyContent:X,frameProps:q={},stroke:Y,strokeWidth:Q,opacity:V}=e,ee=y??!!w,te=oe(i),re=_(()=>te?k(te):te,[te]),ae=_(()=>"function"==typeof n?n:e=>e?.properties?.[n]??e?.[n],[n]),le=c??o??"blues",se=_(()=>{if(!re)return K(S(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of re){const i=ae(o);null!=i&&isFinite(i)&&(e>i&&(e=i),i>t&&(t=i))}const o=S(le);return K(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[re,ae,le]),{activeSelectionHook:ce,customHoverBehavior:de,customClickBehavior:me}=z({selection:M,linkedHover:W,onObservation:B,onClick:F,chartType:"ChoroplethMap",chartId:E,mobileInteraction:t.mobileInteraction}),ue=d(M),he=_(()=>{const e=u(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?se(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:H}},s,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:Y,strokeWidth:Q,opacity:V});return ce?O(t,ce,ue):t},[ae,se,ce,ue,H,Y,Q,V,s]),pe=_(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return ne("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ie("div",{style:{fontWeight:600},children:t}),null!=o&&ie("div",{style:{opacity:.7},children:(i=o,"number"==typeof i&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(i??"")+"")})]});var i},[ae]),fe=I(t),ye=_(()=>({...fe,...l(L)}),[fe,L]),ge=J(D,t.width,t.height,$)||(re?null:J(!0,t.width,t.height,$)),be=ge?null:G(re,t.width,t.height,X);if(Array.isArray(re)&&re.length>0){const e=re[0];if(!e||"object"!=typeof e||!e.geometry)return ie(U,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const ve={projection:h,areas:re,areaStyle:he,size:[t.width,t.height],margin:ye,enableHover:t.enableHover,tooltipContent:!1===A?()=>null:!0===A?pe:j(A)||pe,...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...ee&&{zoomable:!0},...g&&{zoomExtent:g},...b&&{onZoom:b},...null!=v&&{dragRotate:v},...w&&{tileURL:w},...x&&{tileAttribution:x},...C&&{tileCacheSize:C},...m({linkedHover:W,selection:M,onObservation:B,onClick:F,mobileInteraction:t.mobileInteraction,customHoverBehavior:de,customClickBehavior:me,linkedHoverInClickPredicate:!1}),...R&&R.length>0&&{annotations:R},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...P&&{className:P},...null!=e.animate&&{animate:e.animate},...q};return ge||be||ie(Z,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ie(r,{...ve})})}re.displayName="ChoroplethMap";import{useMemo as ae,useRef as le,forwardRef as se}from"react";var ce={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as de,jsxs as me}from"react/jsx-runtime";var ue=[3,30],he=[1,4],pe=se(function(e,t){const o=le(null);c(t,{variant:"geo-points",frameRef:o});const i=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:n,xAccessor:l="lon",yAccessor:d="lat",sizeBy:p,sizeRange:f,colorBy:y,styleRules:g,colorScheme:k,projection:S="equalEarth",graticule:C,fitPadding:A,zoomable:H,zoomExtent:R,onZoom:L,dragRotate:P,tileURL:M,tileAttribution:z,tileCacheSize:W,areas:B,areaStyle:T=ce,tooltip:E,annotations:D,margin:U,className:G,selection:J,linkedHover:_,onObservation:K,onClick:X,chartId:q,loading:Y,loadingContent:Q,emptyContent:V,legendInteraction:ee,legendPosition:te,frameProps:ie={},stroke:ne,strokeWidth:re,opacity:se}=e,pe=f??("sparkline"===i.mode?he:ue),fe="sparkline"===i.mode?1.5:6,ye=H??!!M,ge=oe(B),be=s({data:n??v,rawData:n,colorBy:y,colorScheme:k,legendInteraction:ee,legendPosition:te,selection:J,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:K,onClick:X,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:q,showLegend:i.showLegend,userMargin:U,marginDefaults:I(i),loading:Y,loadingContent:Q,emptyContent:V,width:i.width,height:i.height}),ve=be.data,ke=ae(()=>{if(!p)return;const e="function"==typeof p?p:e=>e?.[p],t=ve.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?F(t):void 0},[ve,p]),we=ae(()=>{const e=u(e=>({fill:y?w(e,y,be.colorScale):b,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:p?x(e,p,pe,ke):fe}),g,h(y,p)),t=a(e,{stroke:ne,strokeWidth:re,opacity:se});return be.effectiveSelectionHook?O(t,be.effectiveSelectionHook,be.resolvedSelection):t},[y,be.colorScale,be.effectiveSelectionHook,be.resolvedSelection,p,pe,ke,fe,ne,re,se,g]),Se=ae(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof p?p:null,i=("function"==typeof p?p:e=>e[p])(e),n=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",r="string"==typeof y?y:null,a=r?e?.[r]:null;return me("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&de("div",{style:{fontWeight:600,marginBottom:2},children:t}),o&&null!=i&&me("div",{children:[me("span",{style:{opacity:.7},children:[o,": "]}),n(i)]}),r&&null!=a&&me("div",{children:[me("span",{style:{opacity:.7},children:[r,": "]}),a+""]}),!t&&!o&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>me("div",{children:[me("span",{style:{opacity:.7},children:[e,": "]}),n(t)]},e))]})},[p,y]);if(be.earlyReturn)return be.earlyReturn;$("ProportionalSymbolMap",ve,"xAccessor",l),$("ProportionalSymbolMap",ve,"yAccessor",d);const xe={projection:S,...null!=n&&{points:ve},xAccessor:l,yAccessor:d,pointStyle:we,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ge&&{areas:ge,areaStyle:T},...null!=C&&{graticule:C},...null!=A&&{fitPadding:A},...ye&&{zoomable:!0},...R&&{zoomExtent:R},...L&&{onZoom:L},...null!=P&&{dragRotate:P},...M&&{tileURL:M},...z&&{tileAttribution:z},...W&&{tileCacheSize:W},size:[i.width,i.height],margin:be.margin,enableHover:i.enableHover,tooltipContent:!1===E?()=>null:j(E)||Se,...be.legendBehaviorProps,...m({linkedHover:_,selection:J,onObservation:K,onClick:X,mobileInteraction:be.mobileInteraction,customHoverBehavior:be.customHoverBehavior,customClickBehavior:be.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...G&&{className:G},...null!=e.animate&&{animate:e.animate},...ie};return de(Z,{componentName:"ProportionalSymbolMap",width:i.width,height:i.height,children:de(r,{ref:o,...xe})})});pe.displayName="ProportionalSymbolMap";import{useMemo as fe,useCallback as ye,useRef as ge,forwardRef as be}from"react";import{scaleLinear as ve}from"d3-scale";import{jsx as ke,jsxs as we}from"react/jsx-runtime";var Se="__semiotic_x",xe="__semiotic_y",Ce=be(function(e,t){const o=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:i,nodes:n,nodeIdAccessor:l="id",xAccessor:d="lon",yAccessor:u="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:y,zoomable:g,zoomExtent:S,onZoom:x,dragRotate:C,tileURL:A,tileAttribution:H,tileCacheSize:L,lineType:P="geo",flowStyle:M="basic",areas:z,areaStyle:T=ce,edgeColorBy:E,edgeOpacity:D=.6,edgeWidthRange:U=[1,8],pointRadius:G,edgeLinecap:J="round",colorScheme:$,showParticles:_,particleStyle:K,tooltip:X,annotations:q,margin:Y,className:Q,selection:V,linkedHover:ee,onObservation:te,onClick:ie,chartId:ne,loading:re,loadingContent:ae,emptyContent:le,frameProps:se={},legendInteraction:de,legendPosition:me,stroke:ue,strokeWidth:he,opacity:pe,lineIdAccessor:be}=e,Ce=g??!!A,Ae=oe(z),He=fe(()=>k(n),[n]),Re=s({data:i??v,rawData:i,colorBy:E,colorScheme:$,legendInteraction:de,legendPosition:me,selection:V,linkedHover:ee,fallbackFields:E?["string"==typeof E?E:""]:[],unwrapData:!1,onObservation:te,onClick:ie,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ne,showLegend:o.showLegend,userMargin:Y,marginDefaults:I(o),loading:re,loadingContent:ae,emptyContent:le,width:o.width,height:o.height}),je=Re.data,Ie=R(ee),Le=W({name:Ie?.name||"hover",fields:Ie?.fields||[]}),Pe=B(e=>e.pushObservation),Me=fe(()=>{const e=new Map;for(const t of He)e.set(t[l]+"",t);return e},[He,l]),Ne=ge(null),ze=ge(Me);ze.current=Me;const We=ge(d);We.current=d;const Be=ge(u);Be.current=u;const Te=ye(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ze.current,o=t.get(e.source+""),i=t.get(e.target+"");if(!o||!i)return null;const n="function"==typeof We.current?We.current:e=>e[We.current],r="function"==typeof Be.current?Be.current:e=>e[Be.current];return{...e,coordinates:[{[Se]:n(o),[xe]:r(o)},{[Se]:n(i),[xe]:r(i)}]}},[]);c(t,{variant:"geo-lines",frameRef:Ne,overrides:{push:e=>{const t=Te(e);t&&Ne.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=Te(o);e&&t.push(e)}t.length>0&&Ne.current?.pushManyLines(t)}}});const Oe=fe(()=>{const e=new Map;for(const t of je)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[je]),Fe=ye(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=Oe.get(t[l]+"");e&&Le.onHover(e)}else Le.onHover(t)}else Le.onHover(null);if(te||Pe){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:ne};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const i={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};te&&te(i),Pe&&Pe(i)}else{const e={...t,type:"hover-end"};te&&te(e),Pe&&Pe(e)}}},[ee,Le,l,Oe,te,ne,Pe]),Ee=Re.customClickBehavior,De=fe(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof u?u:e=>e[u];return je.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const i=Me.get(o.source+""),n=Me.get(o.target+"");return i&&n?{...o,coordinates:[{[Se]:e(i),[xe]:t(i)},{[Se]:e(n),[xe]:t(n)}]}:null}).filter(Boolean)},[je,Me,d,u]),Ue=fe(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Se in t?t[Se]:e(t)},[d]),Ze=fe(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&xe in t?t[xe]:e(t)},[u]),Ge=fe(()=>{const e=je.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>U[0]:ve().domain(F(e)).range(U)},[je,h,U]),Je=fe(()=>e=>({stroke:E?w(e,E,Re.colorScale):b,strokeWidth:Ge(e[h]??0),strokeLinecap:J,opacity:D}),[E,Re.colorScale,Ge,h,D,J]),$e=fe(()=>{const e=a(Je,{stroke:ue,strokeWidth:he,opacity:pe});if(!Re.effectiveSelectionHook)return e;const t={...Re.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return O(e,Re.effectiveSelectionHook,{...Re.resolvedSelection||{},unselectedStyle:t})},[Je,Re.effectiveSelectionHook,Re.resolvedSelection,ue,he,pe]),_e=G??("sparkline"===o.mode?1.5:5),Ke=fe(()=>a(()=>({fill:"#333",r:_e,fillOpacity:.8}),{stroke:ue,strokeWidth:he,opacity:pe}),[_e,ue,he,pe]),Xe=fe(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return ke("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:ke("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[h];return we("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[we("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&ke("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[l];return null!=t?ke("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:ke("div",{style:{fontWeight:600},children:t})}):null},[h,l]);if(Re.earlyReturn)return Re.earlyReturn;const qe={projection:p,...null!=i&&{lines:De},points:He,xAccessor:Ue,yAccessor:Ze,lineDataAccessor:"coordinates",...null!=be&&{lineIdAccessor:be},lineType:P,flowStyle:M,lineStyle:$e,pointStyle:Ke,...Ae&&{areas:Ae,areaStyle:T},...null!=f&&{graticule:f},...null!=y&&{fitPadding:y},...Ce&&{zoomable:!0},...S&&{zoomExtent:S},...x&&{onZoom:x},...null!=C&&{dragRotate:C},..._&&{showParticles:_},...K&&{particleStyle:K},...A&&{tileURL:A},...H&&{tileAttribution:H},...L&&{tileCacheSize:L},size:[o.width,o.height],margin:Re.margin,enableHover:o.enableHover,tooltipContent:!1===X?()=>null:j(X)||Xe,...Re.legendBehaviorProps,...m({linkedHover:ee,selection:V,onObservation:te,onClick:ie,mobileInteraction:Re.mobileInteraction,customHoverBehavior:Fe,customClickBehavior:Ee,linkedHoverInClickPredicate:!1}),...q&&q.length>0&&{annotations:q},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...Q&&{className:Q},...null!=e.animate&&{animate:e.animate},...se};return ke(Z,{componentName:"FlowMap",width:o.width,height:o.height,children:ke(r,{ref:Ne,...qe})})});Ce.displayName="FlowMap";import{useMemo as Ae,useRef as He,useState as Re,useEffect as je,useCallback as Ie,forwardRef as Le}from"react";import{Fragment as Pe,jsx as Me,jsxs as Ne}from"react/jsx-runtime";var ze=Le(function(e,t){const o=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,lines:n,xAccessor:l="lon",yAccessor:d="lat",nodeIdAccessor:p="id",center:f,costAccessor:y,strength:g=1,lineMode:v="straight",projection:S="mercator",graticule:x,fitPadding:C,zoomable:A,zoomExtent:H,onZoom:R,dragRotate:L,tileURL:P,tileAttribution:M,tileCacheSize:z,transition:W,colorBy:B,styleRules:T,colorScheme:F,pointRadius:E,tooltip:D,showRings:U,showRingLabels:G,ringStyle:J,showNorth:_,costLabel:K,cartogramLayout:X,annotations:q,margin:Y,className:Q,selection:V,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:ne,loadingContent:re,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:de,opacity:me}=e,ue="sparkline"===o.mode,he=X??(ue?"strip":"radial"),pe=E??(ue?1.5:5),fe=U??!0,ye=G??("strip"!==he&&!o.compactMode),ge=_??("strip"!==he&&!ue),be=A??!!P,ve=Ae(()=>k(i),[i]),ke=s({data:ve,rawData:i,colorBy:B,colorScheme:F,legendInteraction:void 0,legendPosition:le,selection:V,linkedHover:ee,fallbackFields:B?["string"==typeof B?B:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ie,showLegend:o.showLegend,userMargin:Y,marginDefaults:I(o),loading:ne,loadingContent:re,emptyContent:ae,width:o.width,height:o.height}),we=Ae(()=>{const e=u(e=>{const t=e?.[p],o=null!=t&&t+""==f+"";return{fill:B?w(e,B,ke.colorScale):b,fillOpacity:o?1:.8,stroke:o?"var(--semiotic-text, #222)":"#fff",strokeWidth:o?1.25:1,r:o?1.35*pe:pe}},T,h(B)),t=a(e,{stroke:ce,strokeWidth:de,opacity:me});return ke.effectiveSelectionHook?O(t,ke.effectiveSelectionHook,ke.resolvedSelection):t},[B,ke.colorScale,ke.effectiveSelectionHook,ke.resolvedSelection,pe,ce,de,me,T,f,p]),Se=Ae(()=>({center:f,centerAccessor:p,costAccessor:y,strength:g,lineMode:v,layout:he}),[f,p,y,g,v,he]),xe=Ae(()=>{if(!n)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof d?d:e=>e[d],o=new Map;for(const e of ve)o.set(e[p]+"",e);return n.map(i=>{if(i.coordinates)return i;const n=o.get(i.source+""),r=o.get(i.target+"");return n&&r?{...i,coordinates:[{[l]:e(n),[d]:t(n)},{[l]:e(r),[d]:t(r)}]}:null}).filter(Boolean)},[n,ve,l,d,p]),Ce=Ae(()=>e=>{const t=("function"==typeof y?y:e=>e[y])(e);return Ne("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Me("div",{style:{fontWeight:600},children:e[p]||e.name||e.id||"Point"}),null!=t&&Ne("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[y,p]),Le=He(null);c(t,{variant:"geo-points",frameRef:Le});const[ze,We]=Re(null),Be=Ie(()=>{const e=Le.current?.getCartogramLayout?.();e&&We(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);je(()=>{const e=requestAnimationFrame(Be);return()=>cancelAnimationFrame(e)},[Be,g,f,o.width,o.height,ve,he]);const Te=Ae(()=>{if(!fe||!ze)return[];const{maxCost:e}=ze;if(0>=e)return[];if(Array.isArray(fe))return fe.filter(t=>t>0&&e>=t);const t="number"==typeof fe?fe:Math.min("strip"===ze.layout?3:5,Math.max(2,Math.ceil(e/5))),o=e/t,i=[];for(let e=1;t>=e;e++)i.push(Math.round(o*e*10)/10);return i},[fe,ze]),Oe=Ae(()=>{if(!ze)return se.foregroundGraphics||null;const{cx:e,cy:t,maxCost:o,availableRadius:i,layout:n}=ze,r="strip"===n,a={stroke:r?"var(--semiotic-border, #999)":"#999",strokeWidth:r?1:.8,strokeDasharray:r?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:r?8:10,...J},l=ke.margin.left??10,s=ke.margin.top??10,c=e+l,d=t+s;return Ne("g",{children:[Ne(Pe,r?{children:[Me("line",{x1:c,y1:d,x2:c+i,y2:d,stroke:a.stroke,strokeWidth:a.strokeWidth,strokeLinecap:"round",opacity:.85}),Me("line",{x1:c,y1:d-3.5,x2:c,y2:d+3.5,stroke:a.stroke,strokeWidth:a.strokeWidth,opacity:.9}),fe&&Te.map(e=>{const t=c+(o>0?e/o*i:0);return Ne("g",{children:[Me("line",{x1:t,y1:d-2.5,x2:t,y2:d+2.5,stroke:a.stroke,strokeWidth:.9,opacity:.65}),ye&&Ne("text",{x:t,y:d+Math.min(10,(ke.margin.bottom??2)+8),textAnchor:"middle",fontSize:a.labelSize,fill:a.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,K?" "+K:""]})]},e)})]}:{children:[Te.map(e=>{const t=e/o*i;return Ne("g",{children:[Me("circle",{cx:c,cy:d,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),ye&&Ne("text",{x:c+t+3,y:d-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[e,K?" "+K:""]})]},e)}),ge&&Ne("g",{transform:`translate(${l+24}, ${s+24})`,children:[Me("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Me("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Me("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Me("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Me("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Me("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]}),se.foregroundGraphics]})},[ze,Te,fe,ye,ge,K,J,ke.margin,se.foregroundGraphics]);if(ke.earlyReturn)return ke.earlyReturn;$("DistanceCartogram",ve,"xAccessor",l),$("DistanceCartogram",ve,"yAccessor",d);const Fe={projection:S,...null!=i&&{points:ve},...xe&&{lines:xe,lineDataAccessor:"coordinates"},xAccessor:l,yAccessor:d,pointIdAccessor:p,pointStyle:we,projectionTransform:Se,...W&&{transition:{duration:W}},...null!=x&&{graticule:x},...null!=C&&{fitPadding:C},...be&&{zoomable:!0},...H&&{zoomExtent:H},...R&&{onZoom:R},...null!=L&&{dragRotate:L},...P&&{tileURL:P},...M&&{tileAttribution:M},...z&&{tileCacheSize:z},size:[o.width,o.height],margin:ke.margin,enableHover:o.enableHover,tooltipContent:!1===D?()=>null:j(D)||Ce,...ke.legendBehaviorProps,...m({linkedHover:ee,selection:V,onObservation:te,onClick:oe,mobileInteraction:ke.mobileInteraction,customHoverBehavior:ke.customHoverBehavior,customClickBehavior:ke.customClickBehavior,linkedHoverInClickPredicate:!1}),...q&&q.length>0&&{annotations:q},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...Q&&{className:Q},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:Oe};return Me(Z,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Me(r,{ref:Le,...Fe})})});function We(e,t,o){const{featureKey:i,dataKey:n}=o,r=new Map;for(const e of t)r.set(e[n]+"",e);return e.map(e=>{const t=(e=>{const t=i.split(".");let o=e;for(const e of t)o=null!==o&&"object"==typeof o?o[e]:void 0;return(o??"")+""})(e),o=r.get(t);return o?{...e,properties:{...e.properties,...o}}:e})}ze.displayName="DistanceCartogram";export{re as ChoroplethMap,e as DEFAULT_HIT_RADIUS,ze as DistanceCartogram,Ce as FlowMap,n as GeoCustomChart,pe as ProportionalSymbolMap,r as StreamGeoFrame,u as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,E as glyphExtent,D as glyphPlacement,C as hatchFillId,A as hatchPatternDef,i as hitTargetPoint,H as isHatchFill,h as makeNodeRuleContext,p as makeRuleValueResolver,f as matchesThreshold,We as mergeData,te as resolveReferenceGeography,L as resolveResponsiveRules,y as resolveStyleRules,P as resolveSvgFill,M as responsiveRuleMatches,g as ruleMatches};
2
+ import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as i}from"./chunk-chunk-J3XWETBJ.module.min.js";import{GeoCustomChart as n,StreamGeoFrame_default as r}from"./chunk-chunk-FHBN7OEB.module.min.js";import{mergeShapeStyle as a,normalizePartialMargin as l,useChartSetup as s,useFrameImperativeHandle as c,useResolvedSelection as d}from"./chunk-chunk-VQPNBUSW.module.min.js";import"./chunk-chunk-SMVD3EQJ.module.min.js";import"./chunk-chunk-OM6NWS4H.module.min.js";import"./chunk-chunk-GFTVACTO.module.min.js";import{buildCustomBehaviorProps as m}from"./chunk-chunk-WYARAXHR.module.min.js";import"./chunk-chunk-5UKL5W76.module.min.js";import{composeStyleRules as u,makeNodeRuleContext as h,makeRuleValueResolver as p,matchesThreshold as f,resolveStyleRules as y,ruleMatches as g}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-RA7JCG7D.module.min.js";import{DEFAULT_COLOR as b,EMPTY_ARRAY as v,filterSparseArray as k,getColor as w,getSequentialInterpolator as S,getSize as x,hatchFillId as C,hatchPatternDef as A,isHatchFill as H,normalizeLinkedHover as R,normalizeTooltip as j,resolveAxisFreeMarginDefaults as I,resolveResponsiveRules as P,resolveSvgFill as M,responsiveRuleMatches as L,useChartMode as N,useChartSelection as z,useLinkedHover as W,useObservationSelector as T,useThemeSequential as B,wrapStyleWithSelection as O}from"./chunk-chunk-PX5YQGDP.module.min.js";import{getMinMax as F}from"./chunk-chunk-JJ2OOIET.module.min.js";import"./chunk-chunk-WCX6U47H.module.min.js";import{glyphExtent as E,glyphPlacement as D}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as G,SafeRender as U,renderEmptyState as Z,renderLoadingState as J,warnMissingField as $}from"./chunk-chunk-ACLDBMRH.module.min.js";import"./chunk-chunk-YHNZCPOZ.module.min.js";import{useMemo as _}from"react";import{scaleSequential as X}from"d3-scale";import{useState as q,useEffect as K,useMemo as V}from"react";import{feature as Q}from"topojson-client";var Y=new Map;function ee(e){return"default"in e?e.default:e}async function te(e){const t=Y.get(e);if(t)return t;const{topology:o,objectName:i}=await async function(e){try{switch(e){case"world-110m":return{topology:ee(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:ee(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:ee(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:ee(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:t});throw t}}(e);if(!o||!o.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof o} with keys: ${o?Object.keys(o).join(", "):"none"}`);const n=Q(o,o.objects[i]),r="features"in n?n.features:[n];return Y.set(e,r),r}function oe(e){const t=V(()=>Array.isArray(e)?e:void 0,[e]),[o,i]=q(null);return K(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return i(null),te(e).then(e=>{t||i(e)}),()=>{t=!0}}var t;"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),i(null)}else i(null)},[e]),void 0!==t?t:o}import{jsx as ie,jsxs as ne}from"react/jsx-runtime";function re(e){const t=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),o=B(),{areas:i,valueAccessor:n,styleRules:s,colorScheme:c,projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:y,zoomExtent:g,onZoom:b,dragRotate:v,tileURL:w,tileAttribution:x,tileCacheSize:C,tooltip:A,areaOpacity:H=1,annotations:R,margin:P,className:M,selection:L,linkedHover:W,onObservation:T,onClick:F,chartId:E,loading:D,loadingContent:$,emptyContent:q,frameProps:K={},stroke:V,strokeWidth:Q,opacity:Y}=e,ee=y??!!w,te=oe(i),re=_(()=>te?k(te):te,[te]),ae=_(()=>"function"==typeof n?n:e=>e?.properties?.[n]??e?.[n],[n]),le=c??o??"blues",se=_(()=>{if(!re)return X(S(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of re){const i=ae(o);null!=i&&isFinite(i)&&(e>i&&(e=i),i>t&&(t=i))}const o=S(le);return X(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[re,ae,le]),{activeSelectionHook:ce,customHoverBehavior:de,customClickBehavior:me}=z({selection:L,linkedHover:W,onObservation:T,onClick:F,chartType:"ChoroplethMap",chartId:E,mobileInteraction:t.mobileInteraction}),ue=d(L),he=_(()=>{const e=u(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?se(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:H}},s,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:V,strokeWidth:Q,opacity:Y});return ce?O(t,ce,ue):t},[ae,se,ce,ue,H,V,Q,Y,s]),pe=_(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return ne("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ie("div",{style:{fontWeight:600},children:t}),null!=o&&ie("div",{style:{opacity:.7},children:(i=o,"number"==typeof i&&isFinite(i)?Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}):(i??"")+"")})]});var i},[ae]),fe=I(t),ye=_(()=>({...fe,...l(P)}),[fe,P]),ge=J(D,t.width,t.height,$)||(re?null:J(!0,t.width,t.height,$)),be=ge?null:Z(re,t.width,t.height,q);if(Array.isArray(re)&&re.length>0){const e=re[0];if(!e||"object"!=typeof e||!e.geometry)return ie(G,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const ve={projection:h,areas:re,areaStyle:he,size:[t.width,t.height],margin:ye,enableHover:t.enableHover,tooltipContent:!1===A?()=>null:!0===A?pe:j(A)||pe,...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...ee&&{zoomable:!0},...g&&{zoomExtent:g},...b&&{onZoom:b},...null!=v&&{dragRotate:v},...w&&{tileURL:w},...x&&{tileAttribution:x},...C&&{tileCacheSize:C},...m({linkedHover:W,selection:L,onObservation:T,onClick:F,mobileInteraction:t.mobileInteraction,customHoverBehavior:de,customClickBehavior:me,linkedHoverInClickPredicate:!1}),...R&&R.length>0&&{annotations:R},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...K};return ge||be||ie(U,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ie(r,{...ve})})}re.displayName="ChoroplethMap";import{useMemo as ae,useRef as le,forwardRef as se}from"react";var ce={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as de,jsxs as me}from"react/jsx-runtime";var ue=[3,30],he=[1,4],pe=se(function(e,t){const o=le(null);c(t,{variant:"geo-points",frameRef:o});const i=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:n,xAccessor:l="lon",yAccessor:d="lat",sizeBy:p,sizeRange:f,colorBy:y,styleRules:g,colorScheme:k,projection:S="equalEarth",graticule:C,fitPadding:A,zoomable:H,zoomExtent:R,onZoom:P,dragRotate:M,tileURL:L,tileAttribution:z,tileCacheSize:W,areas:T,areaStyle:B=ce,tooltip:E,annotations:D,margin:G,className:Z,selection:J,linkedHover:_,onObservation:X,onClick:q,chartId:K,loading:V,loadingContent:Q,emptyContent:Y,legendInteraction:ee,legendPosition:te,frameProps:ie={},stroke:ne,strokeWidth:re,opacity:se}=e,pe=f??("sparkline"===i.mode?he:ue),fe="sparkline"===i.mode?1.5:6,ye=H??!!L,ge=oe(T),be=s({data:n??v,rawData:n,colorBy:y,colorScheme:k,legendInteraction:ee,legendPosition:te,selection:J,linkedHover:_,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:X,onClick:q,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:K,showLegend:i.showLegend,userMargin:G,marginDefaults:I(i),loading:V,loadingContent:Q,emptyContent:Y,width:i.width,height:i.height,hasTitle:!!i.title}),ve=be.data,ke=ae(()=>{if(!p)return;const e="function"==typeof p?p:e=>e?.[p],t=ve.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?F(t):void 0},[ve,p]),we=ae(()=>{const e=u(e=>({fill:y?w(e,y,be.colorScale):b,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:p?x(e,p,pe,ke):fe}),g,h(y,p)),t=a(e,{stroke:ne,strokeWidth:re,opacity:se});return be.effectiveSelectionHook?O(t,be.effectiveSelectionHook,be.resolvedSelection):t},[y,be.colorScale,be.effectiveSelectionHook,be.resolvedSelection,p,pe,ke,fe,ne,re,se,g]),Se=ae(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof p?p:null,i=("function"==typeof p?p:e=>e[p])(e),n=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",r="string"==typeof y?y:null,a=r?e?.[r]:null;return me("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&de("div",{style:{fontWeight:600,marginBottom:2},children:t}),o&&null!=i&&me("div",{children:[me("span",{style:{opacity:.7},children:[o,": "]}),n(i)]}),r&&null!=a&&me("div",{children:[me("span",{style:{opacity:.7},children:[r,": "]}),a+""]}),!t&&!o&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>me("div",{children:[me("span",{style:{opacity:.7},children:[e,": "]}),n(t)]},e))]})},[p,y]);if(be.earlyReturn)return be.earlyReturn;$("ProportionalSymbolMap",ve,"xAccessor",l),$("ProportionalSymbolMap",ve,"yAccessor",d);const xe={projection:S,...null!=n&&{points:ve},xAccessor:l,yAccessor:d,pointStyle:we,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ge&&{areas:ge,areaStyle:B},...null!=C&&{graticule:C},...null!=A&&{fitPadding:A},...ye&&{zoomable:!0},...R&&{zoomExtent:R},...P&&{onZoom:P},...null!=M&&{dragRotate:M},...L&&{tileURL:L},...z&&{tileAttribution:z},...W&&{tileCacheSize:W},size:[i.width,i.height],margin:be.margin,enableHover:i.enableHover,tooltipContent:!1===E?()=>null:j(E)||Se,...be.legendBehaviorProps,...m({linkedHover:_,selection:J,onObservation:X,onClick:q,mobileInteraction:be.mobileInteraction,customHoverBehavior:be.customHoverBehavior,customClickBehavior:be.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...Z&&{className:Z},...null!=e.animate&&{animate:e.animate},...ie};return de(U,{componentName:"ProportionalSymbolMap",width:i.width,height:i.height,children:de(r,{ref:o,...xe})})});pe.displayName="ProportionalSymbolMap";import{useMemo as fe,useCallback as ye,useRef as ge,forwardRef as be}from"react";import{scaleLinear as ve}from"d3-scale";import{jsx as ke,jsxs as we}from"react/jsx-runtime";var Se="__semiotic_x",xe="__semiotic_y",Ce=be(function(e,t){const o=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:i,nodes:n,nodeIdAccessor:l="id",xAccessor:d="lon",yAccessor:u="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:y,zoomable:g,zoomExtent:S,onZoom:x,dragRotate:C,tileURL:A,tileAttribution:H,tileCacheSize:P,lineType:M="geo",flowStyle:L="basic",areas:z,areaStyle:B=ce,edgeColorBy:E,edgeOpacity:D=.6,edgeWidthRange:G=[1,8],pointRadius:Z,edgeLinecap:J="round",colorScheme:$,showParticles:_,particleStyle:X,tooltip:q,annotations:K,margin:V,className:Q,selection:Y,linkedHover:ee,onObservation:te,onClick:ie,chartId:ne,loading:re,loadingContent:ae,emptyContent:le,frameProps:se={},legendInteraction:de,legendPosition:me,stroke:ue,strokeWidth:he,opacity:pe,lineIdAccessor:be}=e,Ce=g??!!A,Ae=oe(z),He=fe(()=>k(n),[n]),Re=s({data:i??v,rawData:i,colorBy:E,colorScheme:$,legendInteraction:de,legendPosition:me,selection:Y,linkedHover:ee,fallbackFields:E?["string"==typeof E?E:""]:[],unwrapData:!1,onObservation:te,onClick:ie,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ne,showLegend:o.showLegend,userMargin:V,marginDefaults:I(o),loading:re,loadingContent:ae,emptyContent:le,width:o.width,height:o.height,hasTitle:!!o.title}),je=Re.data,Ie=R(ee),Pe=W({name:Ie?.name||"hover",fields:Ie?.fields||[]}),Me=T(e=>e.pushObservation),Le=fe(()=>{const e=new Map;for(const t of He)e.set(t[l]+"",t);return e},[He,l]),Ne=ge(null),ze=ge(Le);ze.current=Le;const We=ge(d);We.current=d;const Te=ge(u);Te.current=u;const Be=ye(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ze.current,o=t.get(e.source+""),i=t.get(e.target+"");if(!o||!i)return null;const n="function"==typeof We.current?We.current:e=>e[We.current],r="function"==typeof Te.current?Te.current:e=>e[Te.current];return{...e,coordinates:[{[Se]:n(o),[xe]:r(o)},{[Se]:n(i),[xe]:r(i)}]}},[]);c(t,{variant:"geo-lines",frameRef:Ne,overrides:{push:e=>{const t=Be(e);t&&Ne.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=Be(o);e&&t.push(e)}t.length>0&&Ne.current?.pushManyLines(t)}}});const Oe=fe(()=>{const e=new Map;for(const t of je)t&&"object"==typeof t&&(null==t.source||e.has(t.source)||e.set(t.source,t),null==t.target||e.has(t.target)||e.set(t.target,t));return e},[je]),Fe=ye(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=Oe.get(t[l]+"");e&&Pe.onHover(e)}else Pe.onHover(t)}else Pe.onHover(null);if(te||Me){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:ne};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const i={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};te&&te(i),Me&&Me(i)}else{const e={...t,type:"hover-end"};te&&te(e),Me&&Me(e)}}},[ee,Pe,l,Oe,te,ne,Me]),Ee=Re.customClickBehavior,De=fe(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof u?u:e=>e[u];return je.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const i=Le.get(o.source+""),n=Le.get(o.target+"");return i&&n?{...o,coordinates:[{[Se]:e(i),[xe]:t(i)},{[Se]:e(n),[xe]:t(n)}]}:null}).filter(Boolean)},[je,Le,d,u]),Ge=fe(()=>{const e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&Se in t?t[Se]:e(t)},[d]),Ue=fe(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&xe in t?t[xe]:e(t)},[u]),Ze=fe(()=>{const e=je.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>G[0]:ve().domain(F(e)).range(G)},[je,h,G]),Je=fe(()=>e=>({stroke:E?w(e,E,Re.colorScale):b,strokeWidth:Ze(e[h]??0),strokeLinecap:J,opacity:D}),[E,Re.colorScale,Ze,h,D,J]),$e=fe(()=>{const e=a(Je,{stroke:ue,strokeWidth:he,opacity:pe});if(!Re.effectiveSelectionHook)return e;const t={...Re.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return O(e,Re.effectiveSelectionHook,{...Re.resolvedSelection||{},unselectedStyle:t})},[Je,Re.effectiveSelectionHook,Re.resolvedSelection,ue,he,pe]),_e=Z??("sparkline"===o.mode?1.5:5),Xe=fe(()=>a(()=>({fill:"#333",r:_e,fillOpacity:.8}),{stroke:ue,strokeWidth:he,opacity:pe}),[_e,ue,he,pe]),qe=fe(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)return ke("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:ke("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[h];return we("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[we("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&ke("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[l];return null!=t?ke("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:ke("div",{style:{fontWeight:600},children:t})}):null},[h,l]);if(Re.earlyReturn)return Re.earlyReturn;const Ke={projection:p,...null!=i&&{lines:De},points:He,xAccessor:Ge,yAccessor:Ue,lineDataAccessor:"coordinates",...null!=be&&{lineIdAccessor:be},lineType:M,flowStyle:L,lineStyle:$e,pointStyle:Xe,...Ae&&{areas:Ae,areaStyle:B},...null!=f&&{graticule:f},...null!=y&&{fitPadding:y},...Ce&&{zoomable:!0},...S&&{zoomExtent:S},...x&&{onZoom:x},...null!=C&&{dragRotate:C},..._&&{showParticles:_},...X&&{particleStyle:X},...A&&{tileURL:A},...H&&{tileAttribution:H},...P&&{tileCacheSize:P},size:[o.width,o.height],margin:Re.margin,enableHover:o.enableHover,tooltipContent:!1===q?()=>null:j(q)||qe,...Re.legendBehaviorProps,...m({linkedHover:ee,selection:Y,onObservation:te,onClick:ie,mobileInteraction:Re.mobileInteraction,customHoverBehavior:Fe,customClickBehavior:Ee,linkedHoverInClickPredicate:!1}),...K&&K.length>0&&{annotations:K},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...Q&&{className:Q},...null!=e.animate&&{animate:e.animate},...se};return ke(U,{componentName:"FlowMap",width:o.width,height:o.height,children:ke(r,{ref:Ne,...Ke})})});Ce.displayName="FlowMap";import{useMemo as Ae,useRef as He,useState as Re,useEffect as je,useCallback as Ie,forwardRef as Pe}from"react";import{Fragment as Me,jsx as Le,jsxs as Ne}from"react/jsx-runtime";var ze=Pe(function(e,t){const o=N(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:i,lines:n,xAccessor:l="lon",yAccessor:d="lat",nodeIdAccessor:p="id",center:f,costAccessor:y,strength:g=1,lineMode:v="straight",projection:S="mercator",graticule:x,fitPadding:C,zoomable:A,zoomExtent:H,onZoom:R,dragRotate:P,tileURL:M,tileAttribution:L,tileCacheSize:z,transition:W,colorBy:T,styleRules:B,colorScheme:F,pointRadius:E,tooltip:D,showRings:G,showRingLabels:Z,ringStyle:J,showNorth:_,costLabel:X,cartogramLayout:q,annotations:K,margin:V,className:Q,selection:Y,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:ne,loadingContent:re,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:de,opacity:me}=e,ue="sparkline"===o.mode,he=q??(ue?"strip":"radial"),pe=E??(ue?1.5:5),fe=G??!0,ye=Z??("strip"!==he&&!o.compactMode),ge=_??("strip"!==he&&!ue),be=A??!!M,ve=Ae(()=>k(i),[i]),ke=s({data:ve,rawData:i,colorBy:T,colorScheme:F,legendInteraction:void 0,legendPosition:le,selection:Y,linkedHover:ee,fallbackFields:T?["string"==typeof T?T:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ie,showLegend:o.showLegend,userMargin:V,marginDefaults:I(o),loading:ne,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),we=Ae(()=>{const e=u(e=>{const t=e?.[p],o=null!=t&&t+""==f+"";return{fill:T?w(e,T,ke.colorScale):b,fillOpacity:o?1:.8,stroke:o?"var(--semiotic-text, #222)":"#fff",strokeWidth:o?1.25:1,r:o?1.35*pe:pe}},B,h(T)),t=a(e,{stroke:ce,strokeWidth:de,opacity:me});return ke.effectiveSelectionHook?O(t,ke.effectiveSelectionHook,ke.resolvedSelection):t},[T,ke.colorScale,ke.effectiveSelectionHook,ke.resolvedSelection,pe,ce,de,me,B,f,p]),Se=Ae(()=>({center:f,centerAccessor:p,costAccessor:y,strength:g,lineMode:v,layout:he}),[f,p,y,g,v,he]),xe=Ae(()=>{if(!n)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof d?d:e=>e[d],o=new Map;for(const e of ve)o.set(e[p]+"",e);return n.map(i=>{if(i.coordinates)return i;const n=o.get(i.source+""),r=o.get(i.target+"");return n&&r?{...i,coordinates:[{[l]:e(n),[d]:t(n)},{[l]:e(r),[d]:t(r)}]}:null}).filter(Boolean)},[n,ve,l,d,p]),Ce=Ae(()=>e=>{const t=("function"==typeof y?y:e=>e[y])(e);return Ne("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Le("div",{style:{fontWeight:600},children:e[p]||e.name||e.id||"Point"}),null!=t&&Ne("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[y,p]),Pe=He(null);c(t,{variant:"geo-points",frameRef:Pe});const[ze,We]=Re(null),Te=Ie(()=>{const e=Pe.current?.getCartogramLayout?.();e&&We(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);je(()=>{const e=requestAnimationFrame(Te);return()=>cancelAnimationFrame(e)},[Te,g,f,o.width,o.height,ve,he]);const Be=Ae(()=>{if(!fe||!ze)return[];const{maxCost:e}=ze;if(0>=e)return[];if(Array.isArray(fe))return fe.filter(t=>t>0&&e>=t);const t="number"==typeof fe?fe:Math.min("strip"===ze.layout?3:5,Math.max(2,Math.ceil(e/5))),o=e/t,i=[];for(let e=1;t>=e;e++)i.push(Math.round(o*e*10)/10);return i},[fe,ze]),Oe=Ae(()=>{if(!ze)return se.foregroundGraphics||null;const{cx:e,cy:t,maxCost:o,availableRadius:i,layout:n}=ze,r="strip"===n,a={stroke:r?"var(--semiotic-border, #999)":"#999",strokeWidth:r?1:.8,strokeDasharray:r?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:r?8:10,...J},l=ke.margin.left??10,s=ke.margin.top??10,c=e+l,d=t+s;return Ne("g",{children:[Ne(Me,r?{children:[Le("line",{x1:c,y1:d,x2:c+i,y2:d,stroke:a.stroke,strokeWidth:a.strokeWidth,strokeLinecap:"round",opacity:.85}),Le("line",{x1:c,y1:d-3.5,x2:c,y2:d+3.5,stroke:a.stroke,strokeWidth:a.strokeWidth,opacity:.9}),fe&&Be.map(e=>{const t=c+(o>0?e/o*i:0);return Ne("g",{children:[Le("line",{x1:t,y1:d-2.5,x2:t,y2:d+2.5,stroke:a.stroke,strokeWidth:.9,opacity:.65}),ye&&Ne("text",{x:t,y:d+Math.min(10,(ke.margin.bottom??2)+8),textAnchor:"middle",fontSize:a.labelSize,fill:a.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,X?" "+X:""]})]},e)})]}:{children:[Be.map(e=>{const t=e/o*i;return Ne("g",{children:[Le("circle",{cx:c,cy:d,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),ye&&Ne("text",{x:c+t+3,y:d-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[e,X?" "+X:""]})]},e)}),ge&&Ne("g",{transform:`translate(${l+24}, ${s+24})`,children:[Le("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Le("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Le("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Le("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Le("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Le("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]}),se.foregroundGraphics]})},[ze,Be,fe,ye,ge,X,J,ke.margin,se.foregroundGraphics]);if(ke.earlyReturn)return ke.earlyReturn;$("DistanceCartogram",ve,"xAccessor",l),$("DistanceCartogram",ve,"yAccessor",d);const Fe={projection:S,...null!=i&&{points:ve},...xe&&{lines:xe,lineDataAccessor:"coordinates"},xAccessor:l,yAccessor:d,pointIdAccessor:p,pointStyle:we,projectionTransform:Se,...W&&{transition:{duration:W}},...null!=x&&{graticule:x},...null!=C&&{fitPadding:C},...be&&{zoomable:!0},...H&&{zoomExtent:H},...R&&{onZoom:R},...null!=P&&{dragRotate:P},...M&&{tileURL:M},...L&&{tileAttribution:L},...z&&{tileCacheSize:z},size:[o.width,o.height],margin:ke.margin,enableHover:o.enableHover,tooltipContent:!1===D?()=>null:j(D)||Ce,...ke.legendBehaviorProps,...m({linkedHover:ee,selection:Y,onObservation:te,onClick:oe,mobileInteraction:ke.mobileInteraction,customHoverBehavior:ke.customHoverBehavior,customClickBehavior:ke.customClickBehavior,linkedHoverInClickPredicate:!1}),...K&&K.length>0&&{annotations:K},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...Q&&{className:Q},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:Oe};return Le(U,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Le(r,{ref:Pe,...Fe})})});function We(e,t,o){const{featureKey:i,dataKey:n}=o,r=new Map;for(const e of t)r.set(e[n]+"",e);return e.map(e=>{const t=(e=>{const t=i.split(".");let o=e;for(const e of t)o=null!==o&&"object"==typeof o?o[e]:void 0;return(o??"")+""})(e),o=r.get(t);return o?{...e,properties:{...e.properties,...o}}:e})}ze.displayName="DistanceCartogram";export{re as ChoroplethMap,e as DEFAULT_HIT_RADIUS,ze as DistanceCartogram,Ce as FlowMap,n as GeoCustomChart,pe as ProportionalSymbolMap,r as StreamGeoFrame,u as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,E as glyphExtent,D as glyphPlacement,C as hatchFillId,A as hatchPatternDef,i as hitTargetPoint,H as isHatchFill,h as makeNodeRuleContext,p as makeRuleValueResolver,f as matchesThreshold,We as mergeData,te as resolveReferenceGeography,P as resolveResponsiveRules,y as resolveStyleRules,M as resolveSvgFill,L as responsiveRuleMatches,g as ruleMatches};