semiotic 3.8.4 → 3.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +9 -5
- package/README.md +52 -46
- package/ai/behaviorContracts.cjs +2 -2
- package/ai/componentMetadata.cjs +2 -2
- package/ai/dist/mcp-server.js +6 -2
- package/ai/examples.md +211 -2
- package/ai/schema.json +1388 -14
- package/ai/surface-manifest.json +8 -4
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js +2 -0
- package/dist/chunk-chunk-2CHN2TA3.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
- package/dist/chunk-chunk-3SHB24AG.module.min.js +1 -0
- package/dist/chunk-chunk-4MMOOYTX.module.min.js +2 -0
- package/dist/chunk-chunk-75OTQSXS.module.min.js +1 -0
- package/dist/chunk-chunk-A5GRQUOF.module.min.js +1 -0
- package/dist/chunk-chunk-AAF5LZAU.module.min.js +2 -0
- package/dist/{chunk-chunk-LQBSXO7K.module.min.js → chunk-chunk-ARZGA4LJ.module.min.js} +1 -1
- package/dist/chunk-chunk-CAFLML4L.module.min.js +2 -0
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
- package/dist/chunk-chunk-FHBN7OEB.module.min.js +2 -0
- package/dist/{chunk-chunk-KQ546MKE.module.min.js → chunk-chunk-GFTVACTO.module.min.js} +1 -1
- package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
- package/dist/chunk-chunk-ITDWLZXV.module.min.js +2 -0
- package/dist/chunk-chunk-LPSPATPC.module.min.js +1 -0
- package/dist/chunk-chunk-OM6NWS4H.module.min.js +2 -0
- package/dist/chunk-chunk-PX5YQGDP.module.min.js +2 -0
- package/dist/chunk-chunk-Q2BS46W2.module.min.js +2 -0
- package/dist/{chunk-chunk-FBGHXL72.module.min.js → chunk-chunk-RA7JCG7D.module.min.js} +1 -1
- package/dist/chunk-chunk-RNUHEXZA.module.min.js +2 -0
- package/dist/chunk-chunk-ROZWKEUG.module.min.js +1 -0
- package/dist/chunk-chunk-SMVD3EQJ.module.min.js +2 -0
- package/dist/chunk-chunk-T2FKJD4O.module.min.js +2 -0
- package/dist/chunk-chunk-UDREYOLV.module.min.js +1 -0
- package/dist/chunk-chunk-VOWE3SAP.module.min.js +2 -0
- package/dist/chunk-chunk-VQPNBUSW.module.min.js +2 -0
- package/dist/{chunk-chunk-7RYBCTK5.module.min.js → chunk-chunk-WAWCIHFJ.module.min.js} +1 -1
- package/dist/{chunk-chunk-F7WFPD4O.module.min.js → chunk-chunk-WYARAXHR.module.min.js} +1 -1
- package/dist/{chunk-chunk-JDXT6ORT.module.min.js → chunk-chunk-XP3OHHFX.module.min.js} +1 -1
- package/dist/chunk-chunk-XV3KGYTR.module.min.js +2 -0
- package/dist/chunk-chunk-YC2IVEPX.module.min.js +1 -0
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
- package/dist/components/ChartContainer.d.ts +10 -0
- package/dist/components/ai/chartCapabilities.d.ts +3 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +14 -0
- package/dist/components/chartContainerDataAudit.d.ts +10 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +30 -4
- package/dist/components/charts/index.d.ts +4 -0
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
- package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
- package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
- package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
- package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
- package/dist/components/charts/physics/crucibleController.d.ts +59 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
- package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
- package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
- package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +10 -4
- package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
- package/dist/components/charts/shared/gradient.d.ts +35 -0
- package/dist/components/charts/shared/hatchFill.d.ts +3 -10
- package/dist/components/charts/shared/hooks.d.ts +2 -50
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +58 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +5 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +25 -42
- package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
- package/dist/components/charts/xy/BumpChart.d.ts +161 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
- package/dist/components/charts/xy/Heatmap.d.ts +3 -0
- package/dist/components/charts/xy/LineChart.d.ts +6 -8
- package/dist/components/data/auditData.d.ts +51 -0
- package/dist/components/data/dataAuditPresentation.d.ts +18 -0
- package/dist/components/data/dataAuditSources.d.ts +9 -0
- package/dist/components/data/numericContracts.d.ts +59 -0
- package/dist/components/data/numericFieldProfiler.d.ts +23 -0
- package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
- package/dist/components/legendLayout.d.ts +19 -1
- package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
- package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
- package/dist/components/recipes/wordTrails.d.ts +156 -0
- package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
- package/dist/components/semiotic-ai-core.d.ts +3 -0
- package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +9 -6
- package/dist/components/semiotic-geo.d.ts +1 -0
- package/dist/components/semiotic-network.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-physics.d.ts +2 -0
- package/dist/components/semiotic-realtime-core.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +4 -0
- package/dist/components/semiotic-server-edge.d.ts +1 -1
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-utils-core.d.ts +3 -0
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +5 -5
- package/dist/components/server/renderEvidence.d.ts +27 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
- package/dist/components/server/staticAnnotations.d.ts +12 -0
- package/dist/components/server/staticLegend.d.ts +4 -2
- package/dist/components/server/staticSVGChrome.d.ts +4 -4
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +11 -10
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
- package/dist/components/stream/SVGOverlay.d.ts +2 -6
- package/dist/components/stream/StalenessBadge.d.ts +2 -6
- package/dist/components/stream/geoCartogram.d.ts +7 -0
- package/dist/components/stream/geoTypes.d.ts +20 -8
- package/dist/components/stream/legendRenderer.d.ts +2 -6
- package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
- package/dist/components/stream/ordinalTypes.d.ts +7 -31
- package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
- package/dist/components/stream/pipelineConfig.d.ts +7 -15
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
- package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
- package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
- package/dist/components/stream/types.d.ts +32 -56
- package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
- package/dist/components/types/legendTypes.d.ts +15 -6
- package/dist/components/useChartContainerDataAudit.d.ts +7 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +3 -0
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +9 -6
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +1 -0
- package/dist/semiotic-network.d.ts +1 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-physics.d.ts +2 -0
- package/dist/semiotic-realtime-core.d.ts +1 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +4 -0
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-server.d.ts +1 -1
- package/dist/semiotic-utils-core.d.ts +3 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +5 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +0 -1
- package/dist/chunk-chunk-6TPGFL7M.module.min.js +0 -2
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +0 -2
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
- package/dist/chunk-chunk-AQPQN2HH.module.min.js +0 -2
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +0 -1
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +0 -2
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +0 -2
- package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +0 -2
- package/dist/chunk-chunk-FP44FHFO.module.min.js +0 -2
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +0 -2
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +0 -2
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +0 -1
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +0 -1
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +0 -1
- package/dist/chunk-chunk-N6VKKF3A.module.min.js +0 -2
- package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +0 -2
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +0 -2
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +0 -1
- package/dist/chunk-chunk-RP7WTID5.module.min.js +0 -1
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +0 -1
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
package/dist/geo.module.min.js
CHANGED
|
@@ -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-FP44FHFO.module.min.js";import{mergeShapeStyle as a,normalizePartialMargin as l,useChartSetup as s,useFrameImperativeHandle as c,useResolvedSelection as d}from"./chunk-chunk-PLIDPQNG.module.min.js";import"./chunk-chunk-6TPGFL7M.module.min.js";import"./chunk-chunk-F5V4UIE6.module.min.js";import"./chunk-chunk-KQ546MKE.module.min.js";import{buildCustomBehaviorProps as m}from"./chunk-chunk-F7WFPD4O.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 g,ruleMatches as y}from"./chunk-chunk-EMO5NUGE.module.min.js";import"./chunk-chunk-FBGHXL72.module.min.js";import{DEFAULT_COLOR as b,EMPTY_ARRAY as v,filterSparseArray as k,getColor as w,getSequentialInterpolator as S,getSize as C,hatchFillId as A,hatchPatternDef as H,isHatchFill as x,normalizeLinkedHover as j,normalizeTooltip as R,resolveAxisFreeMarginDefaults as I,resolveResponsiveRules as P,resolveSvgFill as M,responsiveRuleMatches as L,useChartMode as N,useChartSelection as z,useLinkedHover as F,useObservationSelector as B,useThemeSequential as W,wrapStyleWithSelection as O}from"./chunk-chunk-BFHUYEOS.module.min.js";import{getMinMax as E}from"./chunk-chunk-JJ2OOIET.module.min.js";import"./chunk-chunk-WCX6U47H.module.min.js";import{glyphExtent as T,glyphPlacement as D}from"./chunk-chunk-KTWEBFMX.module.min.js";import{ChartError as U,SafeRender as G,renderEmptyState as Z,renderLoadingState as $,warnMissingField as _}from"./chunk-chunk-ACLDBMRH.module.min.js";import"./chunk-chunk-YHNZCPOZ.module.min.js";import{useMemo as J}from"react";import{scaleSequential as K}from"d3-scale";import{useState as q,useEffect as X,useMemo as Q}from"react";import{feature as V}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:n}=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 i=V(o,o.objects[n]),r="features"in i?i.features:[i];return Y.set(e,r),r}function oe(e){const t=Q(()=>Array.isArray(e)?e:void 0,[e]),[o,n]=q(null);return X(()=>{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),te(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 ne,jsxs as ie}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=W(),{areas:n,valueAccessor:i,styleRules:s,colorScheme:c,projection:h="equalEarth",graticule:p,fitPadding:f,zoomable:g,zoomExtent:y,onZoom:b,dragRotate:v,tileURL:w,tileAttribution:C,tileCacheSize:A,tooltip:H,areaOpacity:x=1,annotations:j,margin:P,className:M,selection:L,linkedHover:F,onObservation:B,onClick:E,chartId:T,loading:D,loadingContent:_,emptyContent:q,frameProps:X={},stroke:Q,strokeWidth:V,opacity:Y}=e,ee=g??!!w,te=oe(n),re=J(()=>te?k(te):te,[te]),ae=J(()=>"function"==typeof i?i:e=>e?.properties?.[i]??e?.[i],[i]),le=c??o??"blues",se=J(()=>{if(!re)return K(S(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const o of re){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])},[re,ae,le]),{activeSelectionHook:ce,customHoverBehavior:de,customClickBehavior:me}=z({selection:L,linkedHover:F,onObservation:B,onClick:E,chartType:"ChoroplethMap",chartId:T,mobileInteraction:t.mobileInteraction}),ue=d(L),he=J(()=>{const e=u(e=>{const t=ae(e);return{fill:null!=t&&isFinite(t)?se(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:x}},s,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=a(e,{stroke:Q,strokeWidth:V,opacity:Y});return ce?O(t,ce,ue):t},[ae,se,ce,ue,x,Q,V,Y,s]),pe=J(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",o=ae(e);return ie("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[ne("div",{style:{fontWeight:600},children:t}),null!=o&&ne("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=I(t),ge=J(()=>({...fe,...l(P)}),[fe,P]),ye=$(D,t.width,t.height,_)||(re?null:$(!0,t.width,t.height,_)),be=ye?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 ne(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:ge,enableHover:t.enableHover,tooltipContent:!1===H?()=>null:!0===H?pe:R(H)||pe,...null!=p&&{graticule:p},...null!=f&&{fitPadding:f},...ee&&{zoomable:!0},...y&&{zoomExtent:y},...b&&{onZoom:b},...null!=v&&{dragRotate:v},...w&&{tileURL:w},...C&&{tileAttribution:C},...A&&{tileCacheSize:A},...m({linkedHover:F,selection:L,onObservation:B,onClick:E,mobileInteraction:t.mobileInteraction,customHoverBehavior:de,customClickBehavior:me,linkedHoverInClickPredicate:!1}),...j&&j.length>0&&{annotations:j},...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},...X};return ye||be||ne(G,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:ne(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 n=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,xAccessor:l="lon",yAccessor:d="lat",sizeBy:p,sizeRange:f,colorBy:g,styleRules:y,colorScheme:k,projection:S="equalEarth",graticule:A,fitPadding:H,zoomable:x,zoomExtent:j,onZoom:P,dragRotate:M,tileURL:L,tileAttribution:z,tileCacheSize:F,areas:B,areaStyle:W=ce,tooltip:T,annotations:D,margin:U,className:Z,selection:$,linkedHover:J,onObservation:K,onClick:q,chartId:X,loading:Q,loadingContent:V,emptyContent:Y,legendInteraction:ee,legendPosition:te,frameProps:ne={},stroke:ie,strokeWidth:re,opacity:se}=e,pe=f??("sparkline"===n.mode?he:ue),fe="sparkline"===n.mode?1.5:6,ge=x??!!L,ye=oe(B),be=s({data:i??v,rawData:i,colorBy:g,colorScheme:k,legendInteraction:ee,legendPosition:te,selection:$,linkedHover:J,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!1,onObservation:K,onClick:q,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:X,showLegend:n.showLegend,userMargin:U,marginDefaults:I(n),loading:Q,loadingContent:V,emptyContent:Y,width:n.width,height:n.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?E(t):void 0},[ve,p]),we=ae(()=>{const e=u(e=>({fill:g?w(e,g,be.colorScale):b,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:p?C(e,p,pe,ke):fe}),y,h(g,p)),t=a(e,{stroke:ie,strokeWidth:re,opacity:se});return be.effectiveSelectionHook?O(t,be.effectiveSelectionHook,be.resolvedSelection):t},[g,be.colorScale,be.effectiveSelectionHook,be.resolvedSelection,p,pe,ke,fe,ie,re,se,y]),Se=ae(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,o="string"==typeof p?p:null,n=("function"==typeof p?p:e=>e[p])(e),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",r="string"==typeof g?g: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))]})},[p,g]);if(be.earlyReturn)return be.earlyReturn;_("ProportionalSymbolMap",ve,"xAccessor",l),_("ProportionalSymbolMap",ve,"yAccessor",d);const Ce={projection:S,...null!=i&&{points:ve},xAccessor:l,yAccessor:d,pointStyle:we,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ye&&{areas:ye,areaStyle:W},...null!=A&&{graticule:A},...null!=H&&{fitPadding:H},...ge&&{zoomable:!0},...j&&{zoomExtent:j},...P&&{onZoom:P},...null!=M&&{dragRotate:M},...L&&{tileURL:L},...z&&{tileAttribution:z},...F&&{tileCacheSize:F},size:[n.width,n.height],margin:be.margin,enableHover:n.enableHover,tooltipContent:!1===T?()=>null:R(T)||Se,...be.legendBehaviorProps,...m({linkedHover:J,selection:$,onObservation:K,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},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...Z&&{className:Z},...null!=e.animate&&{animate:e.animate},...ne};return de(G,{componentName:"ProportionalSymbolMap",width:n.width,height:n.height,children:de(r,{ref:o,...Ce})})});pe.displayName="ProportionalSymbolMap";import{useMemo as fe,useCallback as ge,useRef as ye,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",Ce="__semiotic_y",Ae=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:n,nodes:i,nodeIdAccessor:l="id",xAccessor:d="lon",yAccessor:u="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:g,zoomable:y,zoomExtent:S,onZoom:C,dragRotate:A,tileURL:H,tileAttribution:x,tileCacheSize:P,lineType:M="geo",flowStyle:L="basic",areas:z,areaStyle:W=ce,edgeColorBy:T,edgeOpacity:D=.6,edgeWidthRange:U=[1,8],pointRadius:Z,edgeLinecap:$="round",colorScheme:_,showParticles:J,particleStyle:K,tooltip:q,annotations:X,margin:Q,className:V,selection:Y,linkedHover:ee,onObservation:te,onClick:ne,chartId:ie,loading:re,loadingContent:ae,emptyContent:le,frameProps:se={},legendInteraction:de,legendPosition:me,stroke:ue,strokeWidth:he,opacity:pe,lineIdAccessor:be}=e,Ae=y??!!H,He=oe(z),xe=fe(()=>k(i),[i]),je=s({data:n??v,rawData:n,colorBy:T,colorScheme:_,legendInteraction:de,legendPosition:me,selection:Y,linkedHover:ee,fallbackFields:T?["string"==typeof T?T:""]:[],unwrapData:!1,onObservation:te,onClick:ne,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FlowMap",chartId:ie,showLegend:o.showLegend,userMargin:Q,marginDefaults:I(o),loading:re,loadingContent:ae,emptyContent:le,width:o.width,height:o.height}),Re=je.data,Ie=j(ee),Pe=F({name:Ie?.name||"hover",fields:Ie?.fields||[]}),Me=B(e=>e.pushObservation),Le=fe(()=>{const e=new Map;for(const t of xe)e.set(t[l]+"",t);return e},[xe,l]),Ne=ye(null),ze=ye(Le);ze.current=Le;const Fe=ye(d);Fe.current=d;const Be=ye(u);Be.current=u;const We=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 Fe.current?Fe.current:e=>e[Fe.current],r="function"==typeof Be.current?Be.current:e=>e[Be.current];return{...e,coordinates:[{[Se]:i(o),[Ce]:r(o)},{[Se]:i(n),[Ce]:r(n)}]}},[]);c(t,{variant:"geo-lines",frameRef:Ne,overrides:{push:e=>{const t=We(e);t&&Ne.current?.pushLine(t)},pushMany:e=>{const t=[];for(const o of e){const e=We(o);e&&t.push(e)}t.length>0&&Ne.current?.pushManyLines(t)}}});const Oe=fe(()=>{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=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: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),Me&&Me(n)}else{const e={...t,type:"hover-end"};te&&te(e),Me&&Me(e)}}},[ee,Pe,l,Oe,te,ie,Me]),Te=je.customClickBehavior,De=fe(()=>{const e="function"==typeof d?d:e=>e[d],t="function"==typeof u?u:e=>e[u];return Re.map(o=>{if(!o||"object"!=typeof o||null==o.source||null==o.target)return null;const n=Le.get(o.source+""),i=Le.get(o.target+"");return n&&i?{...o,coordinates:[{[Se]:e(n),[Ce]:t(n)},{[Se]:e(i),[Ce]:t(i)}]}:null}).filter(Boolean)},[Re,Le,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]),Ge=fe(()=>{const e="function"==typeof u?u:e=>e[u];return t=>null!=t&&"object"==typeof t&&Ce in t?t[Ce]:e(t)},[u]),Ze=fe(()=>{const e=Re.filter(e=>e&&"object"==typeof e).map(e=>e[h]??0).filter(e=>isFinite(e));return 0===e.length?()=>U[0]:ve().domain(E(e)).range(U)},[Re,h,U]),$e=fe(()=>e=>({stroke:T?w(e,T,je.colorScale):b,strokeWidth:Ze(e[h]??0),strokeLinecap:$,opacity:D}),[T,je.colorScale,Ze,h,D,$]),_e=fe(()=>{const e=a($e,{stroke:ue,strokeWidth:he,opacity:pe});if(!je.effectiveSelectionHook)return e;const t={...je.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return O(e,je.effectiveSelectionHook,{...je.resolvedSelection||{},unselectedStyle:t})},[$e,je.effectiveSelectionHook,je.resolvedSelection,ue,he,pe]),Je=Z??("sparkline"===o.mode?1.5:5),Ke=fe(()=>a(()=>({fill:"#333",r:Je,fillOpacity:.8}),{stroke:ue,strokeWidth:he,opacity:pe}),[Je,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(je.earlyReturn)return je.earlyReturn;const Xe={projection:p,...null!=n&&{lines:De},points:xe,xAccessor:Ue,yAccessor:Ge,lineDataAccessor:"coordinates",...null!=be&&{lineIdAccessor:be},lineType:M,flowStyle:L,lineStyle:_e,pointStyle:Ke,...He&&{areas:He,areaStyle:W},...null!=f&&{graticule:f},...null!=g&&{fitPadding:g},...Ae&&{zoomable:!0},...S&&{zoomExtent:S},...C&&{onZoom:C},...null!=A&&{dragRotate:A},...J&&{showParticles:J},...K&&{particleStyle:K},...H&&{tileURL:H},...x&&{tileAttribution:x},...P&&{tileCacheSize:P},size:[o.width,o.height],margin:je.margin,enableHover:o.enableHover,tooltipContent:!1===q?()=>null:R(q)||qe,...je.legendBehaviorProps,...m({linkedHover:ee,selection:Y,onObservation:te,onClick:ne,mobileInteraction:je.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},...V&&{className:V},...null!=e.animate&&{animate:e.animate},...se};return ke(G,{componentName:"FlowMap",width:o.width,height:o.height,children:ke(r,{ref:Ne,...Xe})})});Ae.displayName="FlowMap";import{useMemo as He,useRef as xe,useState as je,useEffect as Re,useCallback as Ie,forwardRef as Pe}from"react";import{jsx as Me,jsxs as Le}from"react/jsx-runtime";var Ne=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:n,lines:i,xAccessor:l="lon",yAccessor:d="lat",nodeIdAccessor:p="id",center:f,costAccessor:g,strength:y=1,lineMode:v="straight",projection:S="mercator",graticule:C,fitPadding:A,zoomable:H,zoomExtent:x,onZoom:j,dragRotate:P,tileURL:M,tileAttribution:L,tileCacheSize:z,transition:F,colorBy:B,styleRules:W,colorScheme:E,pointRadius:T,tooltip:D,showRings:U,showRingLabels:Z,ringStyle:$,showNorth:J,costLabel:K,annotations:q,margin:X,className:Q,selection:V,linkedHover:Y,onObservation:ee,onClick:te,chartId:oe,loading:ne,loadingContent:ie,emptyContent:re,legendPosition:ae,frameProps:le={},stroke:se,strokeWidth:ce,opacity:de}=e,me=T??("sparkline"===o.mode?1.5:5),ue=U??!0,he=Z??!o.compactMode,pe=J??"sparkline"!==o.mode,fe=H??!!M,ge=He(()=>k(n),[n]),ye=s({data:ge,rawData:n,colorBy:B,colorScheme:E,legendInteraction:void 0,legendPosition:ae,selection:V,linkedHover:Y,fallbackFields:B?["string"==typeof B?B:""]:[],unwrapData:!1,onObservation:ee,onClick:te,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DistanceCartogram",chartId:oe,showLegend:o.showLegend,userMargin:X,marginDefaults:I(o),loading:ne,loadingContent:ie,emptyContent:re,width:o.width,height:o.height}),be=He(()=>{const e=u(e=>({fill:B?w(e,B,ye.colorScale):b,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:me}),W,h(B)),t=a(e,{stroke:se,strokeWidth:ce,opacity:de});return ye.effectiveSelectionHook?O(t,ye.effectiveSelectionHook,ye.resolvedSelection):t},[B,ye.colorScale,ye.effectiveSelectionHook,ye.resolvedSelection,me,se,ce,de,W]),ve=He(()=>({center:f,centerAccessor:p,costAccessor:g,strength:y,lineMode:v}),[f,p,g,y,v]),ke=He(()=>{if(!i)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 ge)o.set(e[p]+"",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),[d]:t(i)},{[l]:e(r),[d]:t(r)}]}:null}).filter(Boolean)},[i,ge,l,d,p]),we=He(()=>e=>{const t=("function"==typeof g?g:e=>e[g])(e);return Le("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&&Le("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[g,p]),Se=xe(null);c(t,{variant:"geo-points",frameRef:Se});const[Ce,Ae]=je(null),Pe=Ie(()=>{const e=Se.current?.getCartogramLayout?.();e&&Ae(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);Re(()=>{const e=requestAnimationFrame(Pe);return()=>cancelAnimationFrame(e)},[Pe,y,f,o.width,o.height,ge]);const Ne=He(()=>{if(!ue||!Ce)return[];const{maxCost:e}=Ce;if(0>=e)return[];if(Array.isArray(ue))return ue.filter(t=>t>0&&e>=t);const t="number"==typeof ue?ue:Math.min(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},[ue,Ce]),ze=He(()=>{if(!Ce)return le.foregroundGraphics||null;const{cx:e,cy:t,maxCost:o,availableRadius:n}=Ce,i={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...$},r=ye.margin.left??10,a=ye.margin.top??10;return Le("g",{children:[Ne.map(l=>{const s=l/o*n;return Le("g",{children:[Me("circle",{cx:e+r,cy:t+a,r:s,fill:"none",stroke:i.stroke,strokeWidth:i.strokeWidth,strokeDasharray:i.strokeDasharray,opacity:.5}),he&&Le("text",{x:e+r+s+3,y:t+a-2,fontSize:i.labelSize,fill:i.labelColor,fontFamily:"system-ui, sans-serif",children:[l,K?" "+K:""]})]},l)}),pe&&Le("g",{transform:`translate(${r+24}, ${a+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})]}),le.foregroundGraphics]})},[Ce,Ne,he,pe,K,$,ye.margin,le.foregroundGraphics]);if(ye.earlyReturn)return ye.earlyReturn;_("DistanceCartogram",ge,"xAccessor",l),_("DistanceCartogram",ge,"yAccessor",d);const Fe={projection:S,...null!=n&&{points:ge},...ke&&{lines:ke,lineDataAccessor:"coordinates"},xAccessor:l,yAccessor:d,pointIdAccessor:p,pointStyle:be,projectionTransform:ve,...F&&{transition:{duration:F}},...null!=C&&{graticule:C},...null!=A&&{fitPadding:A},...fe&&{zoomable:!0},...x&&{zoomExtent:x},...j&&{onZoom:j},...null!=P&&{dragRotate:P},...M&&{tileURL:M},...L&&{tileAttribution:L},...z&&{tileCacheSize:z},size:[o.width,o.height],margin:ye.margin,enableHover:o.enableHover,tooltipContent:!1===D?()=>null:R(D)||we,...ye.legendBehaviorProps,...m({linkedHover:Y,selection:V,onObservation:ee,onClick:te,mobileInteraction:ye.mobileInteraction,customHoverBehavior:ye.customHoverBehavior,customClickBehavior:ye.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},...le,foregroundGraphics:ze};return Me(G,{componentName:"DistanceCartogram",width:o.width,height:o.height,children:Me(r,{ref:Se,...Fe})})});function ze(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})}Ne.displayName="DistanceCartogram";export{re as ChoroplethMap,e as DEFAULT_HIT_RADIUS,Ne as DistanceCartogram,Ae as FlowMap,i as GeoCustomChart,pe as ProportionalSymbolMap,r as StreamGeoFrame,u as composeStyleRules,t as geoAreaHitTarget,o as geoHitTarget,T as glyphExtent,D as glyphPlacement,A as hatchFillId,H as hatchPatternDef,n as hitTargetPoint,x as isHatchFill,h as makeNodeRuleContext,p as makeRuleValueResolver,f as matchesThreshold,ze as mergeData,te as resolveReferenceGeography,P as resolveResponsiveRules,g as resolveStyleRules,M as resolveSvgFill,L as responsiveRuleMatches,y 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};
|