semiotic 3.8.7 → 3.8.8

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 (206) hide show
  1. package/CLAUDE.md +2 -2
  2. package/README.md +56 -46
  3. package/ai/dist/mcp-server.js +28 -2
  4. package/ai/schema.json +124 -4
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/{chunk-chartContainerDataAudit-JDSVSKGM.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
  8. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
  9. package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
  10. package/dist/chunk-chunk-3GCILWPB.module.min.js +2 -0
  11. package/dist/chunk-chunk-46KRGJQP.module.min.js +1 -0
  12. package/dist/{chunk-chunk-5SD6BHVW.module.min.js → chunk-chunk-4MLLQUGW.module.min.js} +1 -1
  13. package/dist/chunk-chunk-57RBPDBQ.module.min.js +2 -0
  14. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
  15. package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
  16. package/dist/chunk-chunk-7LE56WAE.module.min.js +2 -0
  17. package/dist/chunk-chunk-7T25U75Z.module.min.js +2 -0
  18. package/dist/chunk-chunk-AF53TBSN.module.min.js +2 -0
  19. package/dist/chunk-chunk-BTZYH2IE.module.min.js +1 -0
  20. package/dist/chunk-chunk-BWV55BZK.module.min.js +2 -0
  21. package/dist/{chunk-chunk-FRO4TRXK.module.min.js → chunk-chunk-BZNOAHJV.module.min.js} +1 -1
  22. package/dist/chunk-chunk-CD6PVVS3.module.min.js +2 -0
  23. package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
  24. package/dist/{chunk-chunk-BNGBEY7N.module.min.js → chunk-chunk-FC3NZWYR.module.min.js} +1 -1
  25. package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
  26. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
  27. package/dist/chunk-chunk-FRGBMTZR.module.min.js +1 -0
  28. package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
  29. package/dist/{chunk-chunk-NH4MEAKP.module.min.js → chunk-chunk-H5IFO6CU.module.min.js} +1 -1
  30. package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
  31. package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
  32. package/dist/chunk-chunk-HCNDE26Q.module.min.js +2 -0
  33. package/dist/chunk-chunk-JJ4BSUYL.module.min.js +2 -0
  34. package/dist/chunk-chunk-JRHXQGEV.module.min.js +2 -0
  35. package/dist/chunk-chunk-L6FFYGYS.module.min.js +1 -0
  36. package/dist/{chunk-chunk-Z2AJERX5.module.min.js → chunk-chunk-LJDH3WV3.module.min.js} +1 -1
  37. package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
  38. package/dist/chunk-chunk-N3Q33XCB.module.min.js +2 -0
  39. package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
  40. package/dist/chunk-chunk-OG3TTJGJ.module.min.js +2 -0
  41. package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
  42. package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
  43. package/dist/chunk-chunk-QQJNG23C.module.min.js +2 -0
  44. package/dist/{chunk-chunk-LG7YKJAK.module.min.js → chunk-chunk-RGJ6TKAH.module.min.js} +1 -1
  45. package/dist/{chunk-chunk-JWXLNZSM.module.min.js → chunk-chunk-SFLUSZ73.module.min.js} +1 -1
  46. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
  47. package/dist/{chunk-chunk-LVHDZAT3.module.min.js → chunk-chunk-UEZ6SHW5.module.min.js} +1 -1
  48. package/dist/chunk-chunk-VUWYT7DY.module.min.js +2 -0
  49. package/dist/{chunk-chunk-OI7R7EJB.module.min.js → chunk-chunk-W5HWGQMD.module.min.js} +1 -1
  50. package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
  51. package/dist/chunk-chunk-WGROBM3I.module.min.js +2 -0
  52. package/dist/{chunk-chunk-GU2EJIDJ.module.min.js → chunk-chunk-WSDJFBKX.module.min.js} +1 -1
  53. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
  54. package/dist/components/charts/index.d.ts +2 -2
  55. package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
  56. package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
  57. package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
  58. package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
  59. package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
  60. package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
  61. package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
  62. package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
  63. package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
  64. package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
  65. package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
  66. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
  67. package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
  68. package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
  69. package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
  70. package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
  71. package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
  72. package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
  73. package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
  74. package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
  75. package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
  76. package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
  77. package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
  78. package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
  79. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
  80. package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
  81. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
  82. package/dist/components/charts/network/processSankey/time.d.ts +11 -0
  83. package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
  84. package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
  85. package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
  86. package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
  87. package/dist/components/charts/shared/formatUtils.d.ts +12 -1
  88. package/dist/components/charts/shared/hatchFill.d.ts +2 -0
  89. package/dist/components/charts/shared/hooks.d.ts +1 -1
  90. package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
  91. package/dist/components/charts/shared/styleRules.d.ts +5 -1
  92. package/dist/components/charts/shared/useChartLegend.d.ts +6 -0
  93. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  94. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  95. package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
  96. package/dist/components/data/numericFieldProfiler.d.ts +2 -0
  97. package/dist/components/recipes/layout1d.d.ts +68 -0
  98. package/dist/components/semiotic-network.d.ts +2 -2
  99. package/dist/components/semiotic-recipes-core.d.ts +2 -0
  100. package/dist/components/semiotic.d.ts +2 -0
  101. package/dist/components/server/staticSVGChrome.d.ts +2 -1
  102. package/dist/components/store/createStore.d.ts +2 -0
  103. package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
  104. package/dist/components/stream/PipelineStore.d.ts +5 -0
  105. package/dist/components/stream/accessorUtils.d.ts +21 -0
  106. package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
  107. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
  108. package/dist/components/stream/layouts/index.d.ts +1 -1
  109. package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
  110. package/dist/components/stream/networkTypes.d.ts +2 -0
  111. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
  112. package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
  113. package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
  114. package/dist/components/stream/pipelineTransitions.d.ts +15 -1
  115. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
  116. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
  117. package/dist/components/stream/symbolPath.d.ts +8 -0
  118. package/dist/components/stream/types.d.ts +2 -0
  119. package/dist/components/stream/useCanvasFrameHost.d.ts +6 -0
  120. package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
  121. package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -0
  122. package/dist/forceLayoutWorker.js +1 -1
  123. package/dist/geo.min.js +1 -1
  124. package/dist/geo.module.min.js +1 -1
  125. package/dist/network.min.js +1 -1
  126. package/dist/network.module.min.js +1 -1
  127. package/dist/ordinal.min.js +1 -1
  128. package/dist/ordinal.module.min.js +1 -1
  129. package/dist/physics.min.js +1 -1
  130. package/dist/physics.module.min.js +1 -1
  131. package/dist/physicsWorker.js +1 -1
  132. package/dist/processSankeyLayoutWorker.js +1 -0
  133. package/dist/realtime.min.js +1 -1
  134. package/dist/realtime.module.min.js +1 -1
  135. package/dist/semiotic-ai-core.min.js +1 -1
  136. package/dist/semiotic-ai-core.module.min.js +1 -1
  137. package/dist/semiotic-ai.min.js +1 -1
  138. package/dist/semiotic-ai.module.min.js +1 -1
  139. package/dist/semiotic-experimental-vacp.min.js +1 -1
  140. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  141. package/dist/semiotic-experimental.min.js +1 -1
  142. package/dist/semiotic-experimental.module.min.js +1 -1
  143. package/dist/semiotic-network.d.ts +2 -2
  144. package/dist/semiotic-realtime-core.min.js +1 -1
  145. package/dist/semiotic-realtime-core.module.min.js +1 -1
  146. package/dist/semiotic-recipes-core.d.ts +2 -0
  147. package/dist/semiotic-recipes-core.min.js +1 -1
  148. package/dist/semiotic-recipes-core.module.min.js +1 -1
  149. package/dist/semiotic-recipes.min.js +1 -1
  150. package/dist/semiotic-recipes.module.min.js +1 -1
  151. package/dist/semiotic-server-edge.min.js +1 -1
  152. package/dist/semiotic-server-edge.module.min.js +1 -1
  153. package/dist/semiotic-server-node.min.js +1 -1
  154. package/dist/semiotic-server-node.module.min.js +1 -1
  155. package/dist/semiotic-themes-core.module.min.js +1 -1
  156. package/dist/semiotic-themes-react.module.min.js +1 -1
  157. package/dist/semiotic-themes.module.min.js +1 -1
  158. package/dist/semiotic-utils-core.min.js +1 -1
  159. package/dist/semiotic-utils-core.module.min.js +1 -1
  160. package/dist/semiotic-utils-react.module.min.js +1 -1
  161. package/dist/semiotic-utils.min.js +1 -1
  162. package/dist/semiotic-utils.module.min.js +1 -1
  163. package/dist/semiotic-value.min.js +1 -1
  164. package/dist/semiotic-value.module.min.js +1 -1
  165. package/dist/semiotic.d.ts +2 -0
  166. package/dist/semiotic.min.js +1 -1
  167. package/dist/semiotic.module.min.js +1 -1
  168. package/dist/server.min.js +1 -1
  169. package/dist/server.module.min.js +1 -1
  170. package/dist/xy.min.js +1 -1
  171. package/dist/xy.module.min.js +1 -1
  172. package/package.json +4 -3
  173. package/dist/chunk-chunk-2YAZHXL4.module.min.js +0 -2
  174. package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
  175. package/dist/chunk-chunk-7TTBHSAG.module.min.js +0 -2
  176. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +0 -2
  177. package/dist/chunk-chunk-BGHPD3RA.module.min.js +0 -1
  178. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +0 -2
  179. package/dist/chunk-chunk-C7APLVQD.module.min.js +0 -2
  180. package/dist/chunk-chunk-DGWFBOGB.module.min.js +0 -1
  181. package/dist/chunk-chunk-DIVE2DRA.module.min.js +0 -2
  182. package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
  183. package/dist/chunk-chunk-FBUNUIPV.module.min.js +0 -2
  184. package/dist/chunk-chunk-G7QVPZUD.module.min.js +0 -2
  185. package/dist/chunk-chunk-GBPYV4FP.module.min.js +0 -2
  186. package/dist/chunk-chunk-KXAFCCDB.module.min.js +0 -2
  187. package/dist/chunk-chunk-LWITSR2O.module.min.js +0 -2
  188. package/dist/chunk-chunk-MX35T6RX.module.min.js +0 -2
  189. package/dist/chunk-chunk-NJETWX42.module.min.js +0 -2
  190. package/dist/chunk-chunk-NW25WGLS.module.min.js +0 -2
  191. package/dist/chunk-chunk-ONMLEXHR.module.min.js +0 -2
  192. package/dist/chunk-chunk-OY66GCE6.module.min.js +0 -1
  193. package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
  194. package/dist/chunk-chunk-PZFT457G.module.min.js +0 -1
  195. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +0 -1
  196. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +0 -1
  197. package/dist/chunk-chunk-RJRM2E6P.module.min.js +0 -1
  198. package/dist/chunk-chunk-RPL7WYXI.module.min.js +0 -1
  199. package/dist/chunk-chunk-V3OAKG32.module.min.js +0 -1
  200. package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
  201. package/dist/chunk-chunk-WLOIUMWG.module.min.js +0 -2
  202. package/dist/chunk-chunk-XEGXX4F7.module.min.js +0 -1
  203. package/dist/chunk-chunk-XFRBLXYM.module.min.js +0 -1
  204. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +0 -2
  205. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
  206. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as n}from"./chunk-chunk-J3XWETBJ.module.min.js";import{GeoCustomChart as i,StreamGeoFrame_default as r}from"./chunk-chunk-C7APLVQD.module.min.js";import{mergeShapeStyle as a,normalizePartialMargin as l,useChartSetup as s,useFrameImperativeHandle as c,useResolvedSelection as u}from"./chunk-chunk-FBUNUIPV.module.min.js";import"./chunk-chunk-MX35T6RX.module.min.js";import"./chunk-chunk-ONMLEXHR.module.min.js";import"./chunk-chunk-OI7R7EJB.module.min.js";import{buildCustomBehaviorProps as d}from"./chunk-chunk-NH4MEAKP.module.min.js";import{useCustomLayoutSelection as m}from"./chunk-chunk-5UKL5W76.module.min.js";import"./chunk-chunk-BNGBEY7N.module.min.js";import{composeStyleRules as h,makeNodeRuleContext as p,makeRuleValueResolver as f,matchesThreshold as y,resolveStyleRules as g,ruleMatches as b}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-JWXLNZSM.module.min.js";import"./chunk-chunk-5SD6BHVW.module.min.js";import{DEFAULT_COLOR as v,EMPTY_ARRAY as k,filterSparseArray as x,getColor as w,getSequentialInterpolator as S,getSize as M,hatchFillId as A,hatchPatternDef as N,isHatchFill as C,normalizeLinkedHover as R,normalizeTooltip as j,resolveAxisFreeMarginDefaults as F,resolveResponsiveRules as I,resolveSvgFill as H,responsiveRuleMatches as P,useChartMode as z,useChartSelection as L,useLinkedHover as W,useObservationSelector as O,useThemeSequential as B,wrapStyleWithSelection as E}from"./chunk-chunk-7ZDJSYKI.module.min.js";import{getMinMax as T}from"./chunk-chunk-JJ2OOIET.module.min.js";import"./chunk-chunk-WCX6U47H.module.min.js";import{glyphExtent as D,glyphPlacement as $}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as U,SafeRender as Z,renderEmptyState as G,renderLoadingState as q,warnMissingField as J}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 V,useMemo as Y}from"react";import{feature as Q}from"topojson-client";var ee=new Map;function te(e){return"default"in e?e.default:e}async function oe(e){const t=ee.get(e);if(t)return t;const{topology:o,objectName:n}=await async function(e){try{switch(e){case"world-110m":return{topology:te(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:te(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:te(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:te(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 i=Q(o,o.objects[n]),r="features"in i?i.features:[i];return ee.set(e,r),r}function ne(e){const t=Y(()=>Array.isArray(e)?e:void 0,[e]),[o,n]=X(null);return V(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return n(null),oe(e).then(e=>{t||n(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".`),n(null)}else n(null)},[e]),void 0!==t?t:o}import{jsx as ie,jsxs as re}from"react/jsx-runtime";function ae(e){const t=z(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:n,valueAccessor:i,styleRules:s,colorScheme:c,projection:m="equalEarth",graticule:p,fitPadding:f,zoomable:y,zoomExtent:g,onZoom:b,dragRotate:v,tileURL:k,tileAttribution:w,tileCacheSize:M,tooltip:A,areaOpacity:N=1,annotations:C,margin:R,className:I,selection:H,linkedHover:P,onObservation:W,onClick:O,chartId:T,loading:D,loadingContent:$,emptyContent:J,frameProps:X={},stroke:V,strokeWidth:Y,opacity:Q}=e,ee=y??!!k,te=ne(n),oe=_(()=>te?x(te):te,[te]),ae=_(()=>"function"==typeof i?i:e=>e?.properties?.[i]??e?.[i],[i]),le=c??o??"blues",se=_(()=>{if(!oe)return K(S(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of oe){const n=ae(o);null!=n&&isFinite(n)&&(e>n&&(e=n),n>t&&(t=n))}const o=S(le);return K(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[oe,ae,le]),{activeSelectionHook:ce,customHoverBehavior:ue,customClickBehavior:de}=L({selection:H,linkedHover:P,onObservation:W,onClick:O,chartType:"ChoroplethMap",chartId:T,mobileInteraction:t.mobileInteraction}),me=u(H),he=_(()=>{const e=h(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?se(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:N}},s,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:V,strokeWidth:Y,opacity:Q});return ce?E(t,ce,me):t},[ae,se,ce,me,N,V,Y,Q,s]),pe=_(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return re("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:(n=o,"number"==typeof n&&isFinite(n)?Number.isInteger(n)?n.toLocaleString():n.toLocaleString(void 0,{maximumFractionDigits:2}):(n??"")+"")})]});var n},[ae]),fe=F(t),ye=_(()=>({...fe,...l(R)}),[fe,R]),ge=q(D,t.width,t.height,$)||(oe?null:q(!0,t.width,t.height,$)),be=ge?null:G(oe,t.width,t.height,J);if(Array.isArray(oe)&&oe.length>0){const e=oe[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:m,areas:oe,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},...k&&{tileURL:k},...w&&{tileAttribution:w},...M&&{tileCacheSize:M},...d({linkedHover:P,selection:H,onObservation:W,onClick:O,mobileInteraction:t.mobileInteraction,customHoverBehavior:ue,customClickBehavior:de,linkedHoverInClickPredicate:!1}),...C&&C.length>0&&{annotations:C},...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},...I&&{className:I},...null!=e.animate&&{animate:e.animate},...X};return ge||be||ie(Z,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ie(r,{...ve})})}ae.displayName="ChoroplethMap";import{useMemo as le,useRef as se,forwardRef as ce}from"react";var ue={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as de,jsxs as me}from"react/jsx-runtime";var he=[3,30],pe=[1,4],fe=ce(function(e,t){const o=se(null);c(t,{variant:"geo-points",frameRef:o});const n=z(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,xAccessor:l="lon",yAccessor:u="lat",sizeBy:m,sizeRange:f,colorBy:y,styleRules:g,colorScheme:b,projection:x="equalEarth",graticule:S,fitPadding:A,zoomable:N,zoomExtent:C,onZoom:R,dragRotate:I,tileURL:H,tileAttribution:P,tileCacheSize:L,areas:W,areaStyle:O=ue,tooltip:B,annotations:D,margin:$,className:U,selection:G,linkedHover:q,onObservation:_,onClick:K,chartId:X,loading:V,loadingContent:Y,emptyContent:Q,legendInteraction:ee,legendPosition:te,frameProps:oe={},stroke:ie,strokeWidth:re,opacity:ae}=e,ce=f??("sparkline"===n.mode?pe:he),fe="sparkline"===n.mode?1.5:6,ye=N??!!H,ge=ne(W),be=s({data:i??k,rawData:i,colorBy:y,colorScheme:b,legendInteraction:ee,legendPosition:te,selection:G,linkedHover:q,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:_,onClick:K,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:X,showLegend:n.showLegend,userMargin:$,marginDefaults:F(n),loading:V,loadingContent:Y,emptyContent:Q,width:n.width,height:n.height,hasTitle:!!n.title}),ve=be.data,ke=le(()=>{if(!m)return;const e="function"==typeof m?m:e=>e?.[m],t=ve.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?T(t):void 0},[ve,m]),xe=le(()=>{const e=h(e=>({fill:y?w(e,y,be.colorScale):v,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:m?M(e,m,ce,ke):fe}),g,p(y,m)),t=a(e,{stroke:ie,strokeWidth:re,opacity:ae});return be.effectiveSelectionHook?E(t,be.effectiveSelectionHook,be.resolvedSelection):t},[y,be.colorScale,be.effectiveSelectionHook,be.resolvedSelection,m,ce,ke,fe,ie,re,ae,g]),we=le(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof m?m:null,n=("function"==typeof m?m:e=>e[m])(e),i=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!=n&&me("div",{children:[me("span",{style:{opacity:.7},children:[o,": "]}),i(n)]}),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,": "]}),i(t)]},e))]})},[m,y]);if(be.earlyReturn)return be.earlyReturn;J("ProportionalSymbolMap",ve,"xAccessor",l),J("ProportionalSymbolMap",ve,"yAccessor",u);const Se={projection:x,...null!=i&&{points:ve},xAccessor:l,yAccessor:u,pointStyle:xe,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ge&&{areas:ge,areaStyle:O},...null!=S&&{graticule:S},...null!=A&&{fitPadding:A},...ye&&{zoomable:!0},...C&&{zoomExtent:C},...R&&{onZoom:R},...null!=I&&{dragRotate:I},...H&&{tileURL:H},...P&&{tileAttribution:P},...L&&{tileCacheSize:L},size:[n.width,n.height],margin:be.margin,enableHover:n.enableHover,tooltipContent:!1===B?()=>null:j(B)||we,...be.legendBehaviorProps,...d({linkedHover:q,selection:G,onObservation:_,onClick:K,mobileInteraction:be.mobileInteraction,customHoverBehavior:be.customHoverBehavior,customClickBehavior:be.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...U&&{className:U},...null!=e.animate&&{animate:e.animate},...oe};return de(Z,{componentName:"ProportionalSymbolMap",width:n.width,height:n.height,children:de(r,{ref:o,...Se})})});fe.displayName="ProportionalSymbolMap";import{useMemo as ye,useCallback as ge,useRef as be,forwardRef as ve}from"react";import{scaleLinear as ke}from"d3-scale";import{jsx as xe,jsxs as we}from"react/jsx-runtime";var Se="__semiotic_x",Me="__semiotic_y",Ae=ve(function(e,t){const o=z(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:n,nodes:i,nodeIdAccessor:l="id",xAccessor:u="lon",yAccessor:m="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:y,zoomable:g,zoomExtent:b,onZoom:S,dragRotate:M,tileURL:A,tileAttribution:N,tileCacheSize:C,lineType:I="geo",flowStyle:H="basic",areas:P,areaStyle:L=ue,edgeColorBy:B,edgeOpacity:D=.6,edgeWidthRange:$=[1,8],pointRadius:U,edgeLinecap:G="round",colorScheme:q,showParticles:J,particleStyle:_,tooltip:K,annotations:X,margin:V,className:Y,selection:Q,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:re,loadingContent:ae,emptyContent:le,frameProps:se={},legendInteraction:ce,legendPosition:de,stroke:me,strokeWidth:he,opacity:pe,lineIdAccessor:fe}=e,ve=g??!!A,Ae=ne(P),Ne=ye(()=>x(i),[i]),Ce=s({data:n??k,rawData:n,colorBy:B,colorScheme:q,legendInteraction:ce,legendPosition:de,selection:Q,linkedHover:ee,fallbackFields:B?["string"==typeof B?B:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ie,showLegend:o.showLegend,userMargin:V,marginDefaults:F(o),loading:re,loadingContent:ae,emptyContent:le,width:o.width,height:o.height,hasTitle:!!o.title}),Re=Ce.data,je=R(ee),Fe=W({name:je?.name||"hover",fields:je?.fields||[]}),Ie=O(e=>e.pushObservation),He=ye(()=>{const e=new Map;for(const t of Ne)e.set(t[l]+"",t);return e},[Ne,l]),Pe=be(null),ze=be(He);ze.current=He;const Le=be(u);Le.current=u;const We=be(m);We.current=m;const Oe=ge(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ze.current,o=t.get(e.source+""),n=t.get(e.target+"");if(!o||!n)return null;const i="function"==typeof Le.current?Le.current:e=>e[Le.current],r="function"==typeof We.current?We.current:e=>e[We.current];return{...e,coordinates:[{[Se]:i(o),[Me]:r(o)},{[Se]:i(n),[Me]:r(n)}]}},[]);c(t,{variant:"geo-lines",frameRef:Pe,overrides:{push:e=>{const t=Oe(e);t&&Pe.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=Oe(o);e&&t.push(e)}t.length>0&&Pe.current?.pushManyLines(t)}}});const Be=ye(()=>{const e=new Map;for(const t of Re)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},[Re]),Ee=ge(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=Be.get(t[l]+"");e&&Fe.onHover(e)}else Fe.onHover(t)}else Fe.onHover(null);if(te||Ie){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:ie};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const n={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};te&&te(n),Ie&&Ie(n)}else{const e={...t,type:"hover-end"};te&&te(e),Ie&&Ie(e)}}},[ee,Fe,l,Be,te,ie,Ie]),Te=Ce.customClickBehavior,De=ye(()=>{const e="function"==typeof u?u:e=>e[u],t="function"==typeof m?m:e=>e[m];return Re.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const n=He.get(o.source+""),i=He.get(o.target+"");return n&&i?{...o,coordinates:[{[Se]:e(n),[Me]:t(n)},{[Se]:e(i),[Me]:t(i)}]}:null}).filter(Boolean)},[Re,He,u,m]),$e=ye(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&Se in t?t[Se]:e(t)},[u]),Ue=ye(()=>{const e="function"==typeof m?m:e=>e[m];return t=>null!=t&&"object"==typeof t&&Me in t?t[Me]:e(t)},[m]),Ze=ye(()=>{const e=Re.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>$[0]:ke().domain(T(e)).range($)},[Re,h,$]),Ge=ye(()=>e=>({stroke:B?w(e,B,Ce.colorScale):v,strokeWidth:Ze(e[h]??0),strokeLinecap:G,opacity:D}),[B,Ce.colorScale,Ze,h,D,G]),qe=ye(()=>{const e=a(Ge,{stroke:me,strokeWidth:he,opacity:pe});if(!Ce.effectiveSelectionHook)return e;const t={...Ce.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return E(e,Ce.effectiveSelectionHook,{...Ce.resolvedSelection||{},unselectedStyle:t})},[Ge,Ce.effectiveSelectionHook,Ce.resolvedSelection,me,he,pe]),Je=U??("sparkline"===o.mode?1.5:5),_e=ye(()=>a(()=>({fill:"#333",r:Je,fillOpacity:.8}),{stroke:me,strokeWidth:he,opacity:pe}),[Je,me,he,pe]),Ke=ye(()=>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 xe("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:xe("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&&xe("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[l];return null!=t?xe("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:xe("div",{style:{fontWeight:600},children:t})}):null},[h,l]);if(Ce.earlyReturn)return Ce.earlyReturn;const Xe={projection:p,...null!=n&&{lines:De},points:Ne,xAccessor:$e,yAccessor:Ue,lineDataAccessor:"coordinates",...null!=fe&&{lineIdAccessor:fe},lineType:I,flowStyle:H,lineStyle:qe,pointStyle:_e,...Ae&&{areas:Ae,areaStyle:L},...null!=f&&{graticule:f},...null!=y&&{fitPadding:y},...ve&&{zoomable:!0},...b&&{zoomExtent:b},...S&&{onZoom:S},...null!=M&&{dragRotate:M},...J&&{showParticles:J},..._&&{particleStyle:_},...A&&{tileURL:A},...N&&{tileAttribution:N},...C&&{tileCacheSize:C},size:[o.width,o.height],margin:Ce.margin,enableHover:o.enableHover,tooltipContent:!1===K?()=>null:j(K)||Ke,...Ce.legendBehaviorProps,...d({linkedHover:ee,selection:Q,onObservation:te,onClick:oe,mobileInteraction:Ce.mobileInteraction,customHoverBehavior:Ee,customClickBehavior:Te,linkedHoverInClickPredicate:!1}),...X&&X.length>0&&{annotations:X},...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},...Y&&{className:Y},...null!=e.animate&&{animate:e.animate},...se};return xe(Z,{componentName:"FlowMap",width:o.width,height:o.height,children:xe(r,{ref:Pe,...Xe})})});Ae.displayName="FlowMap";import{useMemo as Ne,useRef as Ce,useState as Re,useEffect as je,useCallback as Fe,forwardRef as Ie}from"react";import{Fragment as He,jsx as Pe,jsxs as ze}from"react/jsx-runtime";var Le=Ie(function(e,t){const o=z(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,lines:i,xAccessor:l="lon",yAccessor:u="lat",nodeIdAccessor:m="id",center:f,costAccessor:y,strength:g=1,lineMode:b="straight",projection:k="mercator",graticule:S,fitPadding:M,zoomable:A,zoomExtent:N,onZoom:C,dragRotate:R,tileURL:I,tileAttribution:H,tileCacheSize:P,transition:L,colorBy:W,styleRules:O,colorScheme:B,pointRadius:T,tooltip:D,showRings:$,showRingLabels:U,ringStyle:G,showNorth:q,costLabel:_,cartogramLayout:K,annotations:X,margin:V,className:Y,selection:Q,linkedHover:ee,onObservation:te,onClick:oe,chartId:ne,loading:ie,loadingContent:re,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:ue,opacity:de}=e,me="sparkline"===o.mode,he=K??(me?"strip":"radial"),pe=T??(me?1.5:5),fe=$??!0,ye=U??("strip"!==he&&!o.compactMode),ge=q??("strip"!==he&&!me),be=A??!!I,ve=Ne(()=>x(n),[n]),ke=s({data:ve,rawData:n,colorBy:W,colorScheme:B,legendInteraction:void 0,legendPosition:le,selection:Q,linkedHover:ee,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ne,showLegend:o.showLegend,userMargin:V,marginDefaults:F(o),loading:ie,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),xe=Ne(()=>{const e=h(e=>{const t=e?.[m],o=null!=t&&t+""==f+"";return{fill:W?w(e,W,ke.colorScale):v,fillOpacity:o?1:.8,stroke:o?"var(--semiotic-text, #222)":"#fff",strokeWidth:o?1.25:1,r:o?1.35*pe:pe}},O,p(W)),t=a(e,{stroke:ce,strokeWidth:ue,opacity:de});return ke.effectiveSelectionHook?E(t,ke.effectiveSelectionHook,ke.resolvedSelection):t},[W,ke.colorScale,ke.effectiveSelectionHook,ke.resolvedSelection,pe,ce,ue,de,O,f,m]),we=Ne(()=>({center:f,centerAccessor:m,costAccessor:y,strength:g,lineMode:b,layout:he}),[f,m,y,g,b,he]),Se=Ne(()=>{if(!i)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof u?u:e=>e[u],o=new Map;for(const e of ve)o.set(e[m]+"",e);return i.map(n=>{if(n.coordinates)return n;const i=o.get(n.source+""),r=o.get(n.target+"");return i&&r?{...n,coordinates:[{[l]:e(i),[u]:t(i)},{[l]:e(r),[u]:t(r)}]}:null}).filter(Boolean)},[i,ve,l,u,m]),Me=Ne(()=>e=>{const t=("function"==typeof y?y:e=>e[y])(e);return ze("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Pe("div",{style:{fontWeight:600},children:e[m]||e.name||e.id||"Point"}),null!=t&&ze("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[y,m]),Ae=Ce(null);c(t,{variant:"geo-points",frameRef:Ae});const[Ie,Le]=Re(null),We=Fe(()=>{const e=Ae.current?.getCartogramLayout?.();e&&Le(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(We);return()=>cancelAnimationFrame(e)},[We,g,f,o.width,o.height,ve,he]);const Oe=Ne(()=>{if(!fe||!Ie)return[];const{maxCost:e}=Ie;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"===Ie.layout?3:5,Math.max(2,Math.ceil(e/5))),o=e/t,n=[];for(let e=1;t>=e;e++)n.push(Math.round(o*e*10)/10);return n},[fe,Ie]),Be=Ne(()=>{if(!Ie)return se.foregroundGraphics||null;const{cx:e,cy:t,maxCost:o,availableRadius:n,layout:i}=Ie,r="strip"===i,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,...G},l=ke.margin.left??10,s=ke.margin.top??10,c=e+l,u=t+s;return ze("g",{children:[ze(He,r?{children:[Pe("line",{x1:c,y1:u,x2:c+n,y2:u,stroke:a.stroke,strokeWidth:a.strokeWidth,strokeLinecap:"round",opacity:.85}),Pe("line",{x1:c,y1:u-3.5,x2:c,y2:u+3.5,stroke:a.stroke,strokeWidth:a.strokeWidth,opacity:.9}),fe&&Oe.map(e=>{const t=c+(o>0?e/o*n:0);return ze("g",{children:[Pe("line",{x1:t,y1:u-2.5,x2:t,y2:u+2.5,stroke:a.stroke,strokeWidth:.9,opacity:.65}),ye&&ze("text",{x:t,y:u+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,_?" "+_:""]})]},e)})]}:{children:[Oe.map(e=>{const t=e/o*n;return ze("g",{children:[Pe("circle",{cx:c,cy:u,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),ye&&ze("text",{x:c+t+3,y:u-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[e,_?" "+_:""]})]},e)}),ge&&ze("g",{transform:`translate(${l+24}, ${s+24})`,children:[Pe("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Pe("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Pe("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Pe("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Pe("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Pe("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]}),se.foregroundGraphics]})},[Ie,Oe,fe,ye,ge,_,G,ke.margin,se.foregroundGraphics]);if(ke.earlyReturn)return ke.earlyReturn;J("DistanceCartogram",ve,"xAccessor",l),J("DistanceCartogram",ve,"yAccessor",u);const Ee={projection:k,...null!=n&&{points:ve},...Se&&{lines:Se,lineDataAccessor:"coordinates"},xAccessor:l,yAccessor:u,pointIdAccessor:m,pointStyle:xe,projectionTransform:we,...L&&{transition:{duration:L}},...null!=S&&{graticule:S},...null!=M&&{fitPadding:M},...be&&{zoomable:!0},...N&&{zoomExtent:N},...C&&{onZoom:C},...null!=R&&{dragRotate:R},...I&&{tileURL:I},...H&&{tileAttribution:H},...P&&{tileCacheSize:P},size:[o.width,o.height],margin:ke.margin,enableHover:o.enableHover,tooltipContent:!1===D?()=>null:j(D)||Me,...ke.legendBehaviorProps,...d({linkedHover:ee,selection:Q,onObservation:te,onClick:oe,mobileInteraction:ke.mobileInteraction,customHoverBehavior:ke.customHoverBehavior,customClickBehavior:ke.customClickBehavior,linkedHoverInClickPredicate:!1}),...X&&X.length>0&&{annotations:X},...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},...Y&&{className:Y},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:Be};return Pe(Z,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Pe(r,{ref:Ae,...Ee})})});Le.displayName="DistanceCartogram";import{jsx as We}from"react/jsx-runtime";function Oe(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function Be(e,t,o){return Math.max(t,Math.min(o,e))}function Ee(e){let t=1/0,o=-1/0;for(const n of e)Number.isFinite(n)&&(t>n&&(t=n),n>o&&(o=n));return t===1/0?[0,0]:[t,o]}function Te(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function De(e,t={}){const o=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===o.length)return[];const n=Be(Number.isFinite(t.occupancy)?Number(t.occupancy):.72,.2,1),i=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):1.8;let r=Oe(t.columns)??Math.max(1,Math.ceil(Math.sqrt(o.length*i/n))),a=Oe(t.rows)??Math.max(1,Math.ceil(o.length/(r*n)));o.length>r*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(o.length/r):null!=t.rows&&null==t.columns?r=Math.ceil(o.length/a):a=Math.ceil(o.length/r));const l=Ee(o.map(e=>e.x)),s=Ee(o.map(e=>e.y)),c=o.map(e=>({...e,desiredColumn:Te(e.x,l)*Math.max(0,r-1),desiredRow:Te(e.y,s)*Math.max(0,a-1)})),u=(r-1)/2,d=(a-1)/2;c.sort((e,t)=>(t.desiredColumn-u)**2+(t.desiredRow-d)**2-((e.desiredColumn-u)**2+(e.desiredRow-d)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);const m=new Set;for(let e=0;a>e;e+=1)for(let t=0;r>t;t+=1)m.add(e*r+t);const h=[];for(const e of c){let t=-1,o=1/0;for(const n of m){const i=(n%r-e.desiredColumn)**2+(Math.floor(n/r)-e.desiredRow)**2;(o>i||i===o&&t>n)&&(t=n,o=i)}0>t||(m.delete(t),h.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/r),column:t%r,index:e.index}))}return h.sort((e,t)=>e.index-t.index),h.map(({index:e,...t})=>t)}function $e(e,t,o=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of o)if(null!=e[t])return e[t]}function Ue(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var Ze=e=>{const t=e.config,o=t.source??"auto",n="areas"===o||"auto"===o&&e.areas.length>0,i=n?function(e){return e.areas.map((t,o)=>{const n=function(e,t){const o=e.properties&&"object"==typeof e.properties?e.properties:{},n=e.id??o.id??o.name??"area-"+t;return{...o,id:n+""}}(t,o),i=e.scales.geoPath.centroid(t),r=Number.isFinite(i[0])&&Number.isFinite(i[1])?e.scales.invertedPoint(i[0],i[1]):null;return{datum:{...n,gridLongitude:r?.[0],gridLatitude:r?.[1]},x:i[0],y:i[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t})),r=i.filter((e,o)=>!t.filter||t.filter(e.datum,o)),a=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const o=e.map(e=>({datum:e,x:Number($e(e,t.columnAccessor)),y:Number($e(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return o.length!==e.length?null:o.map(e=>({...e,row:e.y,column:e.x}))}(r.map(e=>e.datum),t),l=n?r:function(e){return e.points.map(t=>{const o=Number($e(t,e.config.longitudeAccessor,["lon","longitude"])),n=Number($e(t,e.config.latitudeAccessor,["lat","latitude"])),i=Number.isFinite(o)&&Number.isFinite(n)?e.scales.projectedPoint(o,n):null;return{datum:t,x:i?.[0]??NaN,y:i?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:r.map(e=>e.datum)}),s=a??De(l,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===s.length)return{nodes:[]};const c=Ee(s.map(e=>e.row)),u=Ee(s.map(e=>e.column)),d=Math.max(1,Math.round(c[1]-c[0])+1),m=Math.max(1,Math.round(u[1]-u[0])+1),h=Math.max(0,t.layoutPadding??8),p=Math.max(1,e.dimensions.width-2*h)/m,f=Math.max(1,e.dimensions.height-2*h)/d,y=(e.dimensions.width-p*m)/2,g=(e.dimensions.height-f*d)/2,b=Be(t.cellPadding??.12,0,.8),v=Math.max(1,.5*Math.min(p,f)*(1-b)),k=t.sizeAccessor?s.map(e=>Number($e(e.datum,t.sizeAccessor))):[],x=t.sizeDomain??Ee(k),w=t.sizeRange??[.36,1],S=Be(Math.min(w[0],w[1]),.05,1),M=Be(Math.max(w[0],w[1]),S,1),A=s.map((o,n)=>{const i={...o.datum,gridRow:o.row,gridColumn:o.column},r=($e(i,t.idAccessor,["id","key","name"])??"grid-"+n)+"",a=($e(i,t.labelAccessor,["abbr","code","label","name","id"])??r)+"",l=Math.max(1,t.maxLabelLength??4),s=a.length>l?a.slice(0,l):a,d=$e(i,t.categoryAccessor),m=null==d?void 0:d+"",h=$e(i,t.fillAccessor),b=null!=h?h+"":m?e.resolveColor(m):e.theme.categorical[0]??"#4f86c6",k=t.sizeAccessor?Number($e(i,t.sizeAccessor)):NaN,w=t.sizeAccessor&&Number.isFinite(k)?Math.sqrt(Be(Te(k,x),0,1)):1,A=v*(S+w*(M-S)),N="function"==typeof t.markStyle?t.markStyle(i,n):t.markStyle;return{datum:i,id:r,label:s,category:m,row:o.row,column:o.column,x:y+(o.column-u[0]+.5)*p,y:g+(o.row-c[0]+.5)*f,radius:A,style:{fill:b,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...N}}}),N=t.shape??"circle";return{nodes:A.map(e=>{return"circle"===N?{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id}:{type:"geoarea",pathData:"hexagon"===N?function(e,t,o){const n=[];for(let i=0;6>i;i+=1){const r=-Math.PI/2+i*(Math.PI/3);n.push([e+Math.cos(r)*o,t+Math.sin(r)*o])}return Ue(n)}(e.x,e.y,e.radius):Ue([[(t=e.x)-(n=e.radius),(o=e.y)-n],[t+n,o-n],[t+n,o+n],[t-n,o+n]]),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===N?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0};var t,o,n}),overlays:!1===t.showLabels?null:We(Ge,{marks:A,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??Be(.23*Math.min(p,f),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}};function Ge({marks:e,color:t,fontSize:o,fontFamily:n,fontWeight:i}){const r=m();return We("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!r.isActive||r.predicate(e.datum);return We("text",{x:e.x,y:e.y,fill:t,fontFamily:n,fontSize:o,fontWeight:i,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}import{geoBounds as qe,geoContains as Je}from"d3-geo";import{jsx as _e}from"react/jsx-runtime";var Ke=new WeakMap,Xe=new WeakMap,Ve=new WeakMap,Ye=1;function Qe(e,t,o){return Math.max(t,Math.min(o,e))}function et(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function tt(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function ot(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function nt(e,t){const o=ot(e);return(e.id??o.id??o.name??"feature-"+t)+""}function it(e,t,o,n){return[Math.ceil((e-o)/n-.5),Math.floor((t-o)/n-.5)]}function rt(e){if(!e)return 0;const t=Ve.get(e);if(t)return t;const o=Ye;return Ye+=1,Ve.set(e,o),o}function at(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(o=e[0],n=t[0][0],i=t[1][0],n>i?n>o&&o>i:n>o||o>i));var o,n,i}function lt(e,t){for(const o of e){const{feature:e,index:n}=o;if(e.geometry&&at(t,o.bounds))try{if(Je(e,t))return{feature:e,index:n}}catch{}}return null}function st(e,t,o,n={}){const i=e.filter((e,t)=>e.geometry&&(!n.featureFilter||n.featureFilter(e,t))),r=function(e,t){if(0===e.length)return null;const o=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(o[0][0])&&Number.isFinite(o[0][1])&&Number.isFinite(o[1][0])&&Number.isFinite(o[1][1])?o:null}(i,t.geoPath);if(!r)return{dots:[],cellSize:10,features:i};const a=Math.max(0,n.layoutPadding??0),l=[[Qe(r[0][0],a,Math.max(a,o.width-a)),Qe(r[0][1],a,Math.max(a,o.height-a))],[Qe(r[1][0],a,Math.max(a,o.width-a)),Qe(r[1][1],a,Math.max(a,o.height-a))]],s=Math.max(0,l[1][0]-l[0][0]),c=Math.max(0,l[1][1]-l[0][1]);if(0===s||0===c)return{dots:[],cellSize:10,features:i};const u=et(n.columns);let d=Math.max(2,u?s/u:et(n.cellSize)??10);const m=Math.max(100,Math.round(et(n.maxSamples)??25e3)),h=Math.ceil(s/d)*Math.ceil(c/d);h>m&&(d*=Math.sqrt(h/m));const p=n.gridOrigin?.[0]??0,f=n.gridOrigin?.[1]??0,[y,g]=it(l[0][0],l[1][0],p,d),[b,v]=it(l[0][1],l[1][1],f,d),k=[],x=function(e){return e.map((e,t)=>{if(Xe.has(e))return{feature:e,index:t,bounds:Xe.get(e)??null};try{const o=qe(e);return Xe.set(e,o),{feature:e,index:t,bounds:o}}catch{return Xe.set(e,null),{feature:e,index:t,bounds:null}}})}(i);for(let e=b;v>=e;e+=1){const o=f+(e+.5)*d;for(let i=y;g>=i;i+=1){const r=t.invertedPoint(p+(i+.5)*d,o);if(!r||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;const a=lt(x,r);if(!a)continue;const l={...ot(a.feature),featureId:nt(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:i,longitude:r[0],latitude:r[1],dotIndex:k.length};n.dotFilter&&!n.dotFilter(l,k.length)||k.push(l)}}return{dots:k,cellSize:d,features:i}}function ct(e){return Math.round(1e4*e)/1e4}function ut(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${ct(Number(e[0]))},${ct(Number(e[1]))}`:"null"}function dt(e,t){const o=e[t];return"function"==typeof o?o.call(e):void 0}function mt(e){return"number"==typeof e&&Number.isFinite(e)?ct(e)+"":null===e?"null":"unavailable"}function ht(e){const t=e.scales.projection;return[mt(dt(t,"scale")),ut(dt(t,"translate")),ut(dt(t,"center")),(o=dt(t,"rotate"),Array.isArray(o)&&o.every(Number.isFinite)?o.map(e=>ct(Number(e))).join(","):"unavailable"),mt(dt(t,"clipAngle")),mt(dt(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,o])=>ut(e.scales.projectedPoint(t,o)))].join("|");var o}function pt(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var ft=e=>{const t=function(e){let t=Ke.get(e.areas);t||(t=new Map,Ke.set(e.areas,t));const o=function(e){const t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",rt(t.featureFilter),rt(t.dotFilter),ht(e)].join("::")}(e),n=t.get(o);if(n)return n;const i=st(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){const e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(o,i),i}(e),o=e.config,n=o.shape??"circle",i=Math.max(.5,et(o.dotRadius)??t.cellSize*Qe(o.radiusRatio??.24,.05,.5)),r=o.gridOrigin?.[0]??0,a=o.gridOrigin?.[1]??0;return{nodes:t.dots.map((l,s)=>{const c=r+(l.gridColumn+.5)*t.cellSize,u=a+(l.gridRow+.5)*t.cellSize,d=tt(l,o.categoryAccessor),m=tt(l,o.fillAccessor),h={fill:null!=m?m+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof o.markStyle?o.markStyle(l,s):o.markStyle},p=`dot-${l.gridRow}-${l.gridColumn}`;if("circle"===n)return{type:"point",x:c,y:u,r:i,style:h,datum:l,interactive:!1,pointId:p,_transitionKey:p};const f="hexagon"===n?function(e,t,o){return pt(Array.from({length:6},(n,i)=>{const r=-Math.PI/2+i*(Math.PI/3);return[e+Math.cos(r)*o,t+Math.sin(r)*o]}))}(c,u,i):function(e,t,o){return pt([[e-o,t-o],[e+o,t-o],[e+o,t+o],[e-o,t+o]])}(c,u,i);return{type:"geoarea",pathData:f,centroid:[c,u],bounds:[[c-i,u-i],[c+i,u+i]],screenArea:"hexagon"===n?3*Math.sqrt(3)*i*i/2:(2*i)**2,style:h,datum:l,group:l.featureId,interactive:!1}}),overlays:o.showOutline?_e("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,n)=>{const i=e.scales.geoPath(t);return i?_e("path",{d:i,fill:"none",stroke:o.outlineStyle?.stroke??"currentColor",strokeOpacity:o.outlineStyle?.opacity??o.outlineStyle?.fillOpacity??.22,strokeWidth:o.outlineStyle?.strokeWidth??.7,strokeDasharray:o.outlineStyle?.strokeDasharray,strokeLinecap:o.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},nt(t,n)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};function yt(e,t,o){const{featureKey:n,dataKey:i}=o,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=n.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})}export{ae as ChoroplethMap,e as DEFAULT_HIT_RADIUS,Le as DistanceCartogram,Ae as FlowMap,i as GeoCustomChart,fe as ProportionalSymbolMap,r as StreamGeoFrame,h as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,ft as geographicDotGridLayout,Ze as geographicGridLayout,D as glyphExtent,$ as glyphPlacement,De as gridifyGeographicPoints,A as hatchFillId,N as hatchPatternDef,n as hitTargetPoint,C as isHatchFill,p as makeNodeRuleContext,f as makeRuleValueResolver,y as matchesThreshold,yt as mergeData,oe as resolveReferenceGeography,I as resolveResponsiveRules,g as resolveStyleRules,H as resolveSvgFill,P as responsiveRuleMatches,b as ruleMatches,st as sampleGeographicDotGrid};
2
+ import{DEFAULT_HIT_RADIUS as e,geoAreaHitTarget as t,geoHitTarget as o,hitTargetPoint as n}from"./chunk-chunk-J3XWETBJ.module.min.js";import{GeoCustomChart as i,StreamGeoFrame_default as r}from"./chunk-chunk-BWV55BZK.module.min.js";import{mergeShapeStyle as a,normalizePartialMargin as l,useChartSetup as s,useFrameImperativeHandle as c,useResolvedSelection as u}from"./chunk-chunk-VUWYT7DY.module.min.js";import"./chunk-chunk-AF53TBSN.module.min.js";import"./chunk-chunk-QQJNG23C.module.min.js";import"./chunk-chunk-W5HWGQMD.module.min.js";import{buildCustomBehaviorProps as d}from"./chunk-chunk-H5IFO6CU.module.min.js";import{useCustomLayoutSelection as m}from"./chunk-chunk-5UKL5W76.module.min.js";import"./chunk-chunk-FC3NZWYR.module.min.js";import{composeStyleRules as h,makeNodeRuleContext as p,makeRuleValueResolver as f,matchesThreshold as y,resolveStyleRules as g,ruleMatches as b}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-SFLUSZ73.module.min.js";import"./chunk-chunk-4MLLQUGW.module.min.js";import{DEFAULT_COLOR as v,EMPTY_ARRAY as k,filterSparseArray as x,getColor as w,getSequentialInterpolator as S,getSize as M,hatchFillId as A,hatchPatternDef as C,isHatchFill as N,normalizeLinkedHover as R,normalizeTooltip as F,resolveAxisFreeMarginDefaults as j,resolveResponsiveRules as H,resolveSvgFill as I,responsiveRuleMatches as P,useChartMode as z,useChartSelection as L,useLinkedHover as W,useObservationSelector as O,useThemeSequential as B,wrapStyleWithSelection as T}from"./chunk-chunk-HCNDE26Q.module.min.js";import{getMinMax as D}from"./chunk-chunk-2NVFEB7P.module.min.js";import"./chunk-chunk-PMR47KRY.module.min.js";import{glyphExtent as E,glyphPlacement as $}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as U,SafeRender as Z,renderEmptyState as G,renderLoadingState as q,warnMissingField as _}from"./chunk-chunk-ACLDBMRH.module.min.js";import"./chunk-chunk-YHNZCPOZ.module.min.js";import{useMemo as K}from"react";import{scaleSequential as J}from"d3-scale";import{useState as Q,useEffect as Y,useMemo as V}from"react";import{feature as X}from"topojson-client";var ee=new Map;function te(e){return"default"in e?e.default:e}async function oe(e){const t=ee.get(e);if(t)return t;const{topology:o,objectName:n}=await async function(e){try{switch(e){case"world-110m":return{topology:te(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:te(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:te(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:te(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 i=X(o,o.objects[n]),r="features"in i?i.features:[i];return ee.set(e,r),r}function ne(e){const t=V(()=>Array.isArray(e)?e:void 0,[e]),[o,n]=Q(null);return Y(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return n(null),oe(e).then(e=>{t||n(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".`),n(null)}else n(null)},[e]),void 0!==t?t:o}import{jsx as ie,jsxs as re}from"react/jsx-runtime";function ae(e){const t=z(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:n,valueAccessor:i,styleRules:s,colorScheme:c,projection:m="equalEarth",graticule:p,fitPadding:f,zoomable:y,zoomExtent:g,onZoom:b,dragRotate:v,tileURL:k,tileAttribution:w,tileCacheSize:M,tooltip:A,areaOpacity:C=1,annotations:N,margin:R,className:H,selection:I,linkedHover:P,onObservation:W,onClick:O,chartId:D,loading:E,loadingContent:$,emptyContent:_,frameProps:Q={},stroke:Y,strokeWidth:V,opacity:X}=e,ee=y??!!k,te=ne(n),oe=K(()=>te?x(te):te,[te]),ae=K(()=>"function"==typeof i?i:e=>e?.properties?.[i]??e?.[i],[i]),le=c??o??"blues",se=K(()=>{if(!oe)return J(S(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of oe){const n=ae(o);null!=n&&isFinite(n)&&(e>n&&(e=n),n>t&&(t=n))}const o=S(le);return J(o).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[oe,ae,le]),{activeSelectionHook:ce,customHoverBehavior:ue,customClickBehavior:de}=L({selection:I,linkedHover:P,onObservation:W,onClick:O,chartType:"ChoroplethMap",chartId:D,mobileInteraction:t.mobileInteraction}),me=u(I),he=K(()=>{const e=h(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?se(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:C}},s,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:Y,strokeWidth:V,opacity:X});return ce?T(t,ce,me):t},[ae,se,ce,me,C,Y,V,X,s]),pe=K(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return re("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:(n=o,"number"==typeof n&&isFinite(n)?Number.isInteger(n)?n.toLocaleString():n.toLocaleString(void 0,{maximumFractionDigits:2}):(n??"")+"")})]});var n},[ae]),fe=j(t),ye=K(()=>({...fe,...l(R)}),[fe,R]),ge=q(E,t.width,t.height,$)||(oe?null:q(!0,t.width,t.height,$)),be=ge?null:G(oe,t.width,t.height,_);if(Array.isArray(oe)&&oe.length>0){const e=oe[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:m,areas:oe,areaStyle:he,size:[t.width,t.height],margin:ye,enableHover:t.enableHover,tooltipContent:!1===A?()=>null:!0===A?pe:F(A)||pe,...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...ee&&{zoomable:!0},...g&&{zoomExtent:g},...b&&{onZoom:b},...null!=v&&{dragRotate:v},...k&&{tileURL:k},...w&&{tileAttribution:w},...M&&{tileCacheSize:M},...d({linkedHover:P,selection:I,onObservation:W,onClick:O,mobileInteraction:t.mobileInteraction,customHoverBehavior:ue,customClickBehavior:de,linkedHoverInClickPredicate:!1}),...N&&N.length>0&&{annotations:N},...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},...H&&{className:H},...null!=e.animate&&{animate:e.animate},...Q};return ge||be||ie(Z,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ie(r,{...ve})})}ae.displayName="ChoroplethMap";import{useMemo as le,useRef as se,forwardRef as ce}from"react";var ue={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as de,jsxs as me}from"react/jsx-runtime";var he=[3,30],pe=[1,4],fe=ce(function(e,t){const o=se(null);c(t,{variant:"geo-points",frameRef:o});const n=z(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,xAccessor:l="lon",yAccessor:u="lat",sizeBy:m,sizeRange:f,colorBy:y,styleRules:g,colorScheme:b,projection:x="equalEarth",graticule:S,fitPadding:A,zoomable:C,zoomExtent:N,onZoom:R,dragRotate:H,tileURL:I,tileAttribution:P,tileCacheSize:L,areas:W,areaStyle:O=ue,tooltip:B,annotations:E,margin:$,className:U,selection:G,linkedHover:q,onObservation:K,onClick:J,chartId:Q,loading:Y,loadingContent:V,emptyContent:X,legendInteraction:ee,legendPosition:te,frameProps:oe={},stroke:ie,strokeWidth:re,opacity:ae}=e,ce=f??("sparkline"===n.mode?pe:he),fe="sparkline"===n.mode?1.5:6,ye=C??!!I,ge=ne(W),be=s({data:i??k,rawData:i,colorBy:y,colorScheme:b,legendInteraction:ee,legendPosition:te,selection:G,linkedHover:q,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:K,onClick:J,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:Q,showLegend:n.showLegend,userMargin:$,marginDefaults:j(n),loading:Y,loadingContent:V,emptyContent:X,width:n.width,height:n.height,hasTitle:!!n.title}),ve=be.data,ke=le(()=>{if(!m)return;const e="function"==typeof m?m:e=>e?.[m],t=ve.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?D(t):void 0},[ve,m]),xe=le(()=>{const e=h(e=>({fill:y?w(e,y,be.colorScale):v,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:m?M(e,m,ce,ke):fe}),g,p(y,m)),t=a(e,{stroke:ie,strokeWidth:re,opacity:ae});return be.effectiveSelectionHook?T(t,be.effectiveSelectionHook,be.resolvedSelection):t},[y,be.colorScale,be.effectiveSelectionHook,be.resolvedSelection,m,ce,ke,fe,ie,re,ae,g]),we=le(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof m?m:null,n=("function"==typeof m?m:e=>e[m])(e),i=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!=n&&me("div",{children:[me("span",{style:{opacity:.7},children:[o,": "]}),i(n)]}),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,": "]}),i(t)]},e))]})},[m,y]);if(be.earlyReturn)return be.earlyReturn;_("ProportionalSymbolMap",ve,"xAccessor",l),_("ProportionalSymbolMap",ve,"yAccessor",u);const Se={projection:x,...null!=i&&{points:ve},xAccessor:l,yAccessor:u,pointStyle:xe,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ge&&{areas:ge,areaStyle:O},...null!=S&&{graticule:S},...null!=A&&{fitPadding:A},...ye&&{zoomable:!0},...N&&{zoomExtent:N},...R&&{onZoom:R},...null!=H&&{dragRotate:H},...I&&{tileURL:I},...P&&{tileAttribution:P},...L&&{tileCacheSize:L},size:[n.width,n.height],margin:be.margin,enableHover:n.enableHover,tooltipContent:!1===B?()=>null:F(B)||we,...be.legendBehaviorProps,...d({linkedHover:q,selection:G,onObservation:K,onClick:J,mobileInteraction:be.mobileInteraction,customHoverBehavior:be.customHoverBehavior,customClickBehavior:be.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&E.length>0&&{annotations:E},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...U&&{className:U},...null!=e.animate&&{animate:e.animate},...oe};return de(Z,{componentName:"ProportionalSymbolMap",width:n.width,height:n.height,children:de(r,{ref:o,...Se})})});fe.displayName="ProportionalSymbolMap";import{useMemo as ye,useCallback as ge,useRef as be,forwardRef as ve}from"react";import{scaleLinear as ke}from"d3-scale";import{jsx as xe,jsxs as we}from"react/jsx-runtime";var Se="__semiotic_x",Me="__semiotic_y",Ae=ve(function(e,t){const o=z(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:n,nodes:i,nodeIdAccessor:l="id",xAccessor:u="lon",yAccessor:m="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:y,zoomable:g,zoomExtent:b,onZoom:S,dragRotate:M,tileURL:A,tileAttribution:C,tileCacheSize:N,lineType:H="geo",flowStyle:I="basic",areas:P,areaStyle:L=ue,edgeColorBy:B,edgeOpacity:E=.6,edgeWidthRange:$=[1,8],pointRadius:U,edgeLinecap:G="round",colorScheme:q,showParticles:_,particleStyle:K,tooltip:J,annotations:Q,margin:Y,className:V,selection:X,linkedHover:ee,onObservation:te,onClick:oe,chartId:ie,loading:re,loadingContent:ae,emptyContent:le,frameProps:se={},legendInteraction:ce,legendPosition:de,stroke:me,strokeWidth:he,opacity:pe,lineIdAccessor:fe}=e,ve=g??!!A,Ae=ne(P),Ce=ye(()=>x(i),[i]),Ne=s({data:n??k,rawData:n,colorBy:B,colorScheme:q,legendInteraction:ce,legendPosition:de,selection:X,linkedHover:ee,fallbackFields:B?["string"==typeof B?B:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ie,showLegend:o.showLegend,userMargin:Y,marginDefaults:j(o),loading:re,loadingContent:ae,emptyContent:le,width:o.width,height:o.height,hasTitle:!!o.title}),Re=Ne.data,Fe=R(ee),je=W({name:Fe?.name||"hover",fields:Fe?.fields||[]}),He=O(e=>e.pushObservation),Ie=ye(()=>{const e=new Map;for(const t of Ce)e.set(t[l]+"",t);return e},[Ce,l]),Pe=be(null),ze=be(Ie);ze.current=Ie;const Le=be(u);Le.current=u;const We=be(m);We.current=m;const Oe=ge(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ze.current,o=t.get(e.source+""),n=t.get(e.target+"");if(!o||!n)return null;const i="function"==typeof Le.current?Le.current:e=>e[Le.current],r="function"==typeof We.current?We.current:e=>e[We.current];return{...e,coordinates:[{[Se]:i(o),[Me]:r(o)},{[Se]:i(n),[Me]:r(n)}]}},[]);c(t,{variant:"geo-lines",frameRef:Pe,overrides:{push:e=>{const t=Oe(e);t&&Pe.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=Oe(o);e&&t.push(e)}t.length>0&&Pe.current?.pushManyLines(t)}}});const Be=ye(()=>{const e=new Map;for(const t of Re)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},[Re]),Te=ge(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=Be.get(t[l]+"");e&&je.onHover(e)}else je.onHover(t)}else je.onHover(null);if(te||He){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:ie};if(e){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]);const n={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};te&&te(n),He&&He(n)}else{const e={...t,type:"hover-end"};te&&te(e),He&&He(e)}}},[ee,je,l,Be,te,ie,He]),De=Ne.customClickBehavior,Ee=ye(()=>{const e="function"==typeof u?u:e=>e[u],t="function"==typeof m?m:e=>e[m];return Re.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const n=Ie.get(o.source+""),i=Ie.get(o.target+"");return n&&i?{...o,coordinates:[{[Se]:e(n),[Me]:t(n)},{[Se]:e(i),[Me]:t(i)}]}:null}).filter(Boolean)},[Re,Ie,u,m]),$e=ye(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&Se in t?t[Se]:e(t)},[u]),Ue=ye(()=>{const e="function"==typeof m?m:e=>e[m];return t=>null!=t&&"object"==typeof t&&Me in t?t[Me]:e(t)},[m]),Ze=ye(()=>{const e=Re.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>$[0]:ke().domain(D(e)).range($)},[Re,h,$]),Ge=ye(()=>e=>({stroke:B?w(e,B,Ne.colorScale):v,strokeWidth:Ze(e[h]??0),strokeLinecap:G,opacity:E}),[B,Ne.colorScale,Ze,h,E,G]),qe=ye(()=>{const e=a(Ge,{stroke:me,strokeWidth:he,opacity:pe});if(!Ne.effectiveSelectionHook)return e;const t={...Ne.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return T(e,Ne.effectiveSelectionHook,{...Ne.resolvedSelection||{},unselectedStyle:t})},[Ge,Ne.effectiveSelectionHook,Ne.resolvedSelection,me,he,pe]),_e=U??("sparkline"===o.mode?1.5:5),Ke=ye(()=>a(()=>({fill:"#333",r:_e,fillOpacity:.8}),{stroke:me,strokeWidth:he,opacity:pe}),[_e,me,he,pe]),Je=ye(()=>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 xe("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:xe("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&&xe("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[l];return null!=t?xe("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:xe("div",{style:{fontWeight:600},children:t})}):null},[h,l]);if(Ne.earlyReturn)return Ne.earlyReturn;const Qe={projection:p,...null!=n&&{lines:Ee},points:Ce,xAccessor:$e,yAccessor:Ue,lineDataAccessor:"coordinates",...null!=fe&&{lineIdAccessor:fe},lineType:H,flowStyle:I,lineStyle:qe,pointStyle:Ke,...Ae&&{areas:Ae,areaStyle:L},...null!=f&&{graticule:f},...null!=y&&{fitPadding:y},...ve&&{zoomable:!0},...b&&{zoomExtent:b},...S&&{onZoom:S},...null!=M&&{dragRotate:M},..._&&{showParticles:_},...K&&{particleStyle:K},...A&&{tileURL:A},...C&&{tileAttribution:C},...N&&{tileCacheSize:N},size:[o.width,o.height],margin:Ne.margin,enableHover:o.enableHover,tooltipContent:!1===J?()=>null:F(J)||Je,...Ne.legendBehaviorProps,...d({linkedHover:ee,selection:X,onObservation:te,onClick:oe,mobileInteraction:Ne.mobileInteraction,customHoverBehavior:Te,customClickBehavior:De,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},...V&&{className:V},...null!=e.animate&&{animate:e.animate},...se};return xe(Z,{componentName:"FlowMap",width:o.width,height:o.height,children:xe(r,{ref:Pe,...Qe})})});Ae.displayName="FlowMap";import{useMemo as Ce,useRef as Ne,useState as Re,useEffect as Fe,useCallback as je,forwardRef as He}from"react";import{Fragment as Ie,jsx as Pe,jsxs as ze}from"react/jsx-runtime";var Le=He(function(e,t){const o=z(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,lines:i,xAccessor:l="lon",yAccessor:u="lat",nodeIdAccessor:m="id",center:f,costAccessor:y,strength:g=1,lineMode:b="straight",projection:k="mercator",graticule:S,fitPadding:M,zoomable:A,zoomExtent:C,onZoom:N,dragRotate:R,tileURL:H,tileAttribution:I,tileCacheSize:P,transition:L,colorBy:W,styleRules:O,colorScheme:B,pointRadius:D,tooltip:E,showRings:$,showRingLabels:U,ringStyle:G,showNorth:q,costLabel:K,cartogramLayout:J,annotations:Q,margin:Y,className:V,selection:X,linkedHover:ee,onObservation:te,onClick:oe,chartId:ne,loading:ie,loadingContent:re,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:ue,opacity:de}=e,me="sparkline"===o.mode,he=J??(me?"strip":"radial"),pe=D??(me?1.5:5),fe=$??!0,ye=U??("strip"!==he&&!o.compactMode),ge=q??("strip"!==he&&!me),be=A??!!H,ve=Ce(()=>x(n),[n]),ke=s({data:ve,rawData:n,colorBy:W,colorScheme:B,legendInteraction:void 0,legendPosition:le,selection:X,linkedHover:ee,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:ne,showLegend:o.showLegend,userMargin:Y,marginDefaults:j(o),loading:ie,loadingContent:re,emptyContent:ae,width:o.width,height:o.height,hasTitle:!!o.title}),xe=Ce(()=>{const e=h(e=>{const t=e?.[m],o=null!=t&&t+""==f+"";return{fill:W?w(e,W,ke.colorScale):v,fillOpacity:o?1:.8,stroke:o?"var(--semiotic-text, #222)":"#fff",strokeWidth:o?1.25:1,r:o?1.35*pe:pe}},O,p(W)),t=a(e,{stroke:ce,strokeWidth:ue,opacity:de});return ke.effectiveSelectionHook?T(t,ke.effectiveSelectionHook,ke.resolvedSelection):t},[W,ke.colorScale,ke.effectiveSelectionHook,ke.resolvedSelection,pe,ce,ue,de,O,f,m]),we=Ce(()=>({center:f,centerAccessor:m,costAccessor:y,strength:g,lineMode:b,layout:he}),[f,m,y,g,b,he]),Se=Ce(()=>{if(!i)return;const e="function"==typeof l?l:e=>e[l],t="function"==typeof u?u:e=>e[u],o=new Map;for(const e of ve)o.set(e[m]+"",e);return i.map(n=>{if(n.coordinates)return n;const i=o.get(n.source+""),r=o.get(n.target+"");return i&&r?{...n,coordinates:[{[l]:e(i),[u]:t(i)},{[l]:e(r),[u]:t(r)}]}:null}).filter(Boolean)},[i,ve,l,u,m]),Me=Ce(()=>e=>{const t=("function"==typeof y?y:e=>e[y])(e);return ze("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[Pe("div",{style:{fontWeight:600},children:e[m]||e.name||e.id||"Point"}),null!=t&&ze("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[y,m]),Ae=Ne(null);c(t,{variant:"geo-points",frameRef:Ae});const[He,Le]=Re(null),We=je(()=>{const e=Ae.current?.getCartogramLayout?.();e&&Le(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"})},[]);Fe(()=>{const e=requestAnimationFrame(We);return()=>cancelAnimationFrame(e)},[We,g,f,o.width,o.height,ve,he]);const Oe=Ce(()=>{if(!fe||!He)return[];const{maxCost:e}=He;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"===He.layout?3:5,Math.max(2,Math.ceil(e/5))),o=e/t,n=[];for(let e=1;t>=e;e++)n.push(Math.round(o*e*10)/10);return n},[fe,He]),Be=Ce(()=>{if(!He)return se.foregroundGraphics||null;const{cx:e,cy:t,maxCost:o,availableRadius:n,layout:i}=He,r="strip"===i,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,...G},l=ke.margin.left??10,s=ke.margin.top??10,c=e+l,u=t+s;return ze("g",{children:[ze(Ie,r?{children:[Pe("line",{x1:c,y1:u,x2:c+n,y2:u,stroke:a.stroke,strokeWidth:a.strokeWidth,strokeLinecap:"round",opacity:.85}),Pe("line",{x1:c,y1:u-3.5,x2:c,y2:u+3.5,stroke:a.stroke,strokeWidth:a.strokeWidth,opacity:.9}),fe&&Oe.map(e=>{const t=c+(o>0?e/o*n:0);return ze("g",{children:[Pe("line",{x1:t,y1:u-2.5,x2:t,y2:u+2.5,stroke:a.stroke,strokeWidth:.9,opacity:.65}),ye&&ze("text",{x:t,y:u+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:[Oe.map(e=>{const t=e/o*n;return ze("g",{children:[Pe("circle",{cx:c,cy:u,r:t,fill:"none",stroke:a.stroke,strokeWidth:a.strokeWidth,strokeDasharray:a.strokeDasharray,opacity:.5}),ye&&ze("text",{x:c+t+3,y:u-2,fontSize:a.labelSize,fill:a.labelColor,fontFamily:"system-ui, sans-serif",children:[e,K?" "+K:""]})]},e)}),ge&&ze("g",{transform:`translate(${l+24}, ${s+24})`,children:[Pe("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),Pe("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),Pe("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),Pe("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),Pe("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),Pe("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]}),se.foregroundGraphics]})},[He,Oe,fe,ye,ge,K,G,ke.margin,se.foregroundGraphics]);if(ke.earlyReturn)return ke.earlyReturn;_("DistanceCartogram",ve,"xAccessor",l),_("DistanceCartogram",ve,"yAccessor",u);const Te={projection:k,...null!=n&&{points:ve},...Se&&{lines:Se,lineDataAccessor:"coordinates"},xAccessor:l,yAccessor:u,pointIdAccessor:m,pointStyle:xe,projectionTransform:we,...L&&{transition:{duration:L}},...null!=S&&{graticule:S},...null!=M&&{fitPadding:M},...be&&{zoomable:!0},...C&&{zoomExtent:C},...N&&{onZoom:N},...null!=R&&{dragRotate:R},...H&&{tileURL:H},...I&&{tileAttribution:I},...P&&{tileCacheSize:P},size:[o.width,o.height],margin:ke.margin,enableHover:o.enableHover,tooltipContent:!1===E?()=>null:F(E)||Me,...ke.legendBehaviorProps,...d({linkedHover:ee,selection:X,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},...V&&{className:V},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:Be};return Pe(Z,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Pe(r,{ref:Ae,...Te})})});Le.displayName="DistanceCartogram";import{jsx as We}from"react/jsx-runtime";function Oe(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function Be(e,t,o){return Math.max(t,Math.min(o,e))}function Te(e){let t=1/0,o=-1/0;for(const n of e)Number.isFinite(n)&&(t>n&&(t=n),n>o&&(o=n));return t===1/0?[0,0]:[t,o]}function De(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Ee(e,t={}){const o=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===o.length)return[];const n=Be(Number.isFinite(t.occupancy)?Number(t.occupancy):.72,.2,1),i=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):1.8;let r=Oe(t.columns)??Math.max(1,Math.ceil(Math.sqrt(o.length*i/n))),a=Oe(t.rows)??Math.max(1,Math.ceil(o.length/(r*n)));o.length>r*a&&(null!=t.columns&&null==t.rows?a=Math.ceil(o.length/r):null!=t.rows&&null==t.columns?r=Math.ceil(o.length/a):a=Math.ceil(o.length/r));const l=Te(o.map(e=>e.x)),s=Te(o.map(e=>e.y)),c=o.map(e=>({...e,desiredColumn:De(e.x,l)*Math.max(0,r-1),desiredRow:De(e.y,s)*Math.max(0,a-1)})),u=(r-1)/2,d=(a-1)/2;c.sort((e,t)=>(t.desiredColumn-u)**2+(t.desiredRow-d)**2-((e.desiredColumn-u)**2+(e.desiredRow-d)**2)||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index);const m=new Set;for(let e=0;a>e;e+=1)for(let t=0;r>t;t+=1)m.add(e*r+t);const h=[];for(const e of c){let t=-1,o=1/0;for(const n of m){const i=(n%r-e.desiredColumn)**2+(Math.floor(n/r)-e.desiredRow)**2;(o>i||i===o&&t>n)&&(t=n,o=i)}0>t||(m.delete(t),h.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/r),column:t%r,index:e.index}))}return h.sort((e,t)=>e.index-t.index),h.map(({index:e,...t})=>t)}function $e(e,t,o=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of o)if(null!=e[t])return e[t]}function Ue(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var Ze=e=>{const t=e.config,o=t.source??"auto",n="areas"===o||"auto"===o&&e.areas.length>0,i=n?function(e){return e.areas.map((t,o)=>{const n=function(e,t){const o=e.properties&&"object"==typeof e.properties?e.properties:{},n=e.id??o.id??o.name??"area-"+t;return{...o,id:n+""}}(t,o),i=e.scales.geoPath.centroid(t),r=Number.isFinite(i[0])&&Number.isFinite(i[1])?e.scales.invertedPoint(i[0],i[1]):null;return{datum:{...n,gridLongitude:r?.[0],gridLatitude:r?.[1]},x:i[0],y:i[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}(e):e.points.map((e,t)=>({datum:e,x:t,y:t})),r=i.filter((e,o)=>!t.filter||t.filter(e.datum,o)),a=function(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const o=e.map(e=>({datum:e,x:Number($e(e,t.columnAccessor)),y:Number($e(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return o.length!==e.length?null:o.map(e=>({...e,row:e.y,column:e.x}))}(r.map(e=>e.datum),t),l=n?r:function(e){return e.points.map(t=>{const o=Number($e(t,e.config.longitudeAccessor,["lon","longitude"])),n=Number($e(t,e.config.latitudeAccessor,["lat","latitude"])),i=Number.isFinite(o)&&Number.isFinite(n)?e.scales.projectedPoint(o,n):null;return{datum:t,x:i?.[0]??NaN,y:i?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}({...e,points:r.map(e=>e.datum)}),s=a??Ee(l,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===s.length)return{nodes:[]};const c=Te(s.map(e=>e.row)),u=Te(s.map(e=>e.column)),d=Math.max(1,Math.round(c[1]-c[0])+1),m=Math.max(1,Math.round(u[1]-u[0])+1),h=Math.max(0,t.layoutPadding??8),p=Math.max(1,e.dimensions.width-2*h)/m,f=Math.max(1,e.dimensions.height-2*h)/d,y=(e.dimensions.width-p*m)/2,g=(e.dimensions.height-f*d)/2,b=Be(t.cellPadding??.12,0,.8),v=Math.max(1,.5*Math.min(p,f)*(1-b)),k=t.sizeAccessor?s.map(e=>Number($e(e.datum,t.sizeAccessor))):[],x=t.sizeDomain??Te(k),w=t.sizeRange??[.36,1],S=Be(Math.min(w[0],w[1]),.05,1),M=Be(Math.max(w[0],w[1]),S,1),A=s.map((o,n)=>{const i={...o.datum,gridRow:o.row,gridColumn:o.column},r=($e(i,t.idAccessor,["id","key","name"])??"grid-"+n)+"",a=($e(i,t.labelAccessor,["abbr","code","label","name","id"])??r)+"",l=Math.max(1,t.maxLabelLength??4),s=a.length>l?a.slice(0,l):a,d=$e(i,t.categoryAccessor),m=null==d?void 0:d+"",h=$e(i,t.fillAccessor),b=null!=h?h+"":m?e.resolveColor(m):e.theme.categorical[0]??"#4f86c6",k=t.sizeAccessor?Number($e(i,t.sizeAccessor)):NaN,w=t.sizeAccessor&&Number.isFinite(k)?Math.sqrt(Be(De(k,x),0,1)):1,A=v*(S+w*(M-S)),C="function"==typeof t.markStyle?t.markStyle(i,n):t.markStyle;return{datum:i,id:r,label:s,category:m,row:o.row,column:o.column,x:y+(o.column-u[0]+.5)*p,y:g+(o.row-c[0]+.5)*f,radius:A,style:{fill:b,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...C}}}),C=t.shape??"circle";return{nodes:A.map(e=>{return"circle"===C?{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id}:{type:"geoarea",pathData:"hexagon"===C?function(e,t,o){const n=[];for(let i=0;6>i;i+=1){const r=-Math.PI/2+i*(Math.PI/3);n.push([e+Math.cos(r)*o,t+Math.sin(r)*o])}return Ue(n)}(e.x,e.y,e.radius):Ue([[(t=e.x)-(n=e.radius),(o=e.y)-n],[t+n,o-n],[t+n,o+n],[t-n,o+n]]),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===C?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0};var t,o,n}),overlays:!1===t.showLabels?null:We(Ge,{marks:A,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??Be(.23*Math.min(p,f),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}};function Ge({marks:e,color:t,fontSize:o,fontFamily:n,fontWeight:i}){const r=m();return We("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!r.isActive||r.predicate(e.datum);return We("text",{x:e.x,y:e.y,fill:t,fontFamily:n,fontSize:o,fontWeight:i,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}import{geoBounds as qe,geoContains as _e}from"d3-geo";import{jsx as Ke}from"react/jsx-runtime";var Je=new WeakMap,Qe=new WeakMap,Ye=new WeakMap,Ve=1;function Xe(e,t,o){return Math.max(t,Math.min(o,e))}function et(e){if(Number.isFinite(e)&&Number(e)>0)return Number(e)}function tt(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function ot(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function nt(e,t){const o=ot(e);return(e.id??o.id??o.name??"feature-"+t)+""}function it(e,t,o,n){return[Math.ceil((e-o)/n-.5),Math.floor((t-o)/n-.5)]}function rt(e){if(!e)return 0;const t=Ye.get(e);if(t)return t;const o=Ve;return Ve+=1,Ye.set(e,o),o}function at(e,t){return!t||!(t[0][1]>e[1]||e[1]>t[1][1]||(o=e[0],n=t[0][0],i=t[1][0],n>i?n>o&&o>i:n>o||o>i));var o,n,i}function lt(e,t){for(const o of e){const{feature:e,index:n}=o;if(e.geometry&&at(t,o.bounds))try{if(_e(e,t))return{feature:e,index:n}}catch{}}return null}function st(e,t,o,n={}){const i=e.filter((e,t)=>e.geometry&&(!n.featureFilter||n.featureFilter(e,t))),r=function(e,t){if(0===e.length)return null;const o=t.bounds({type:"FeatureCollection",features:e});return Number.isFinite(o[0][0])&&Number.isFinite(o[0][1])&&Number.isFinite(o[1][0])&&Number.isFinite(o[1][1])?o:null}(i,t.geoPath);if(!r)return{dots:[],cellSize:10,features:i};const a=Math.max(0,n.layoutPadding??0),l=[[Xe(r[0][0],a,Math.max(a,o.width-a)),Xe(r[0][1],a,Math.max(a,o.height-a))],[Xe(r[1][0],a,Math.max(a,o.width-a)),Xe(r[1][1],a,Math.max(a,o.height-a))]],s=Math.max(0,l[1][0]-l[0][0]),c=Math.max(0,l[1][1]-l[0][1]);if(0===s||0===c)return{dots:[],cellSize:10,features:i};const u=et(n.columns);let d=Math.max(2,u?s/u:et(n.cellSize)??10);const m=Math.max(100,Math.round(et(n.maxSamples)??25e3)),h=Math.ceil(s/d)*Math.ceil(c/d);h>m&&(d*=Math.sqrt(h/m));const p=n.gridOrigin?.[0]??0,f=n.gridOrigin?.[1]??0,[y,g]=it(l[0][0],l[1][0],p,d),[b,v]=it(l[0][1],l[1][1],f,d),k=[],x=function(e){return e.map((e,t)=>{if(Qe.has(e))return{feature:e,index:t,bounds:Qe.get(e)??null};try{const o=qe(e);return Qe.set(e,o),{feature:e,index:t,bounds:o}}catch{return Qe.set(e,null),{feature:e,index:t,bounds:null}}})}(i);for(let e=b;v>=e;e+=1){const o=f+(e+.5)*d;for(let i=y;g>=i;i+=1){const r=t.invertedPoint(p+(i+.5)*d,o);if(!r||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;const a=lt(x,r);if(!a)continue;const l={...ot(a.feature),featureId:nt(a.feature,a.index),featureIndex:a.index,gridRow:e,gridColumn:i,longitude:r[0],latitude:r[1],dotIndex:k.length};n.dotFilter&&!n.dotFilter(l,k.length)||k.push(l)}}return{dots:k,cellSize:d,features:i}}function ct(e){return Math.round(1e4*e)/1e4}function ut(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${ct(Number(e[0]))},${ct(Number(e[1]))}`:"null"}function dt(e,t){const o=e[t];return"function"==typeof o?o.call(e):void 0}function mt(e){return"number"==typeof e&&Number.isFinite(e)?ct(e)+"":null===e?"null":"unavailable"}function ht(e){const t=e.scales.projection;return[mt(dt(t,"scale")),ut(dt(t,"translate")),ut(dt(t,"center")),(o=dt(t,"rotate"),Array.isArray(o)&&o.every(Number.isFinite)?o.map(e=>ct(Number(e))).join(","):"unavailable"),mt(dt(t,"clipAngle")),mt(dt(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,o])=>ut(e.scales.projectedPoint(t,o)))].join("|");var o}function pt(e){return e.map(([e,t],o)=>`${0===o?"M":"L"}${e},${t}`).join("")+"Z"}var ft=e=>{const t=function(e){let t=Je.get(e.areas);t||(t=new Map,Je.set(e.areas,t));const o=function(e){const t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",rt(t.featureFilter),rt(t.dotFilter),ht(e)].join("::")}(e),n=t.get(o);if(n)return n;const i=st(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){const e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(o,i),i}(e),o=e.config,n=o.shape??"circle",i=Math.max(.5,et(o.dotRadius)??t.cellSize*Xe(o.radiusRatio??.24,.05,.5)),r=o.gridOrigin?.[0]??0,a=o.gridOrigin?.[1]??0;return{nodes:t.dots.map((l,s)=>{const c=r+(l.gridColumn+.5)*t.cellSize,u=a+(l.gridRow+.5)*t.cellSize,d=tt(l,o.categoryAccessor),m=tt(l,o.fillAccessor),h={fill:null!=m?m+"":null!=d?e.resolveColor(d+""):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof o.markStyle?o.markStyle(l,s):o.markStyle},p=`dot-${l.gridRow}-${l.gridColumn}`;if("circle"===n)return{type:"point",x:c,y:u,r:i,style:h,datum:l,interactive:!1,pointId:p,_transitionKey:p};const f="hexagon"===n?function(e,t,o){return pt(Array.from({length:6},(n,i)=>{const r=-Math.PI/2+i*(Math.PI/3);return[e+Math.cos(r)*o,t+Math.sin(r)*o]}))}(c,u,i):function(e,t,o){return pt([[e-o,t-o],[e+o,t-o],[e+o,t+o],[e-o,t+o]])}(c,u,i);return{type:"geoarea",pathData:f,centroid:[c,u],bounds:[[c-i,u-i],[c+i,u+i]],screenArea:"hexagon"===n?3*Math.sqrt(3)*i*i/2:(2*i)**2,style:h,datum:l,group:l.featureId,interactive:!1}}),overlays:o.showOutline?Ke("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,n)=>{const i=e.scales.geoPath(t);return i?Ke("path",{d:i,fill:"none",stroke:o.outlineStyle?.stroke??"currentColor",strokeOpacity:o.outlineStyle?.opacity??o.outlineStyle?.fillOpacity??.22,strokeWidth:o.outlineStyle?.strokeWidth??.7,strokeDasharray:o.outlineStyle?.strokeDasharray,strokeLinecap:o.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},nt(t,n)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};function yt(e,t,o){const{featureKey:n,dataKey:i}=o,r=new Map;for(const e of t)r.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=n.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})}export{ae as ChoroplethMap,e as DEFAULT_HIT_RADIUS,Le as DistanceCartogram,Ae as FlowMap,i as GeoCustomChart,fe as ProportionalSymbolMap,r as StreamGeoFrame,h as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,ft as geographicDotGridLayout,Ze as geographicGridLayout,E as glyphExtent,$ as glyphPlacement,Ee as gridifyGeographicPoints,A as hatchFillId,C as hatchPatternDef,n as hitTargetPoint,N as isHatchFill,p as makeNodeRuleContext,f as makeRuleValueResolver,y as matchesThreshold,yt as mergeData,oe as resolveReferenceGeography,H as resolveResponsiveRules,g as resolveStyleRules,I as resolveSvgFill,P as responsiveRuleMatches,b as ruleMatches,st as sampleGeographicDotGrid};