semiotic 3.13.0 → 3.13.1
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/README.md +53 -41
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/dist/mcp-server.js +132 -106
- package/ai/reference.md +12 -4
- package/ai/schema.json +16 -2
- package/ai/surface-manifest.json +1 -1
- package/ai/task-packets/compare-category-totals.json +5 -5
- package/ai/task-packets/compare-category-totals.md +2 -2
- package/ai/task-packets/correct-published-chart.json +5 -5
- package/ai/task-packets/correct-published-chart.md +2 -2
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +5 -5
- package/ai/task-packets/update-live-chart.md +2 -2
- package/dist/{c-CRKR5M42.min.js → c-2M2OPWVA.min.js} +37 -37
- package/dist/c-3GIPT46Z.min.js +1 -0
- package/dist/c-3UXQGCQT.min.js +1 -0
- package/dist/{c-MHNU6KYQ.min.js → c-4P2EM44G.min.js} +3 -3
- package/dist/c-4RVDKSMQ.min.js +1 -0
- package/dist/{c-6MEEA5VY.min.js → c-4YPPVFZH.min.js} +1 -1
- package/dist/{c-6MPP6QF5.min.js → c-62JIVHK5.min.js} +1 -1
- package/dist/{c-KYRH3XKJ.min.js → c-6QCSRJSC.min.js} +1 -1
- package/dist/c-6WJKNYIG.min.js +1 -0
- package/dist/c-7BVQDXFU.min.js +1 -0
- package/dist/c-7UN2WUMI.min.js +1 -0
- package/dist/c-AQUX6L2O.min.js +1 -0
- package/dist/c-BR5QDUCR.min.js +1 -0
- package/dist/c-C3YQVUB6.min.js +1 -0
- package/dist/{c-RQ2XZHWY.min.js → c-COP4OISO.min.js} +1 -1
- package/dist/c-ENRZPF5E.min.js +1 -0
- package/dist/c-HBLICBM6.min.js +1 -0
- package/dist/{c-EQVM754Z.min.js → c-HGWITEJI.min.js} +1 -1
- package/dist/{c-3K2FJDLE.min.js → c-I54V24WG.min.js} +1 -1
- package/dist/c-IDCFMBA4.min.js +2 -0
- package/dist/{c-TPL7X32J.min.js → c-ISHYKYII.min.js} +1 -1
- package/dist/c-KSSS3HSA.min.js +1 -0
- package/dist/c-LEICSI5V.min.js +1 -0
- package/dist/c-LJ4XY3Z3.min.js +1 -0
- package/dist/c-MBE6PPHN.min.js +1 -0
- package/dist/c-MOK4RWNO.min.js +1 -0
- package/dist/c-N2TVSOYL.min.js +2 -0
- package/dist/{c-EAAKQIUZ.min.js → c-NHZ2E3CI.min.js} +1 -1
- package/dist/{c-MDY3ULP6.min.js → c-OBA7XSLH.min.js} +1 -1
- package/dist/c-OIJL2WZH.min.js +1 -0
- package/dist/c-ONOWKUUZ.min.js +1 -0
- package/dist/{c-CPJR4LHF.min.js → c-OSLNYZ3Q.min.js} +17 -17
- package/dist/c-PBFRYNKM.min.js +1 -0
- package/dist/c-QUAEYF34.min.js +1 -0
- package/dist/c-RDFFLRKC.min.js +1 -0
- package/dist/c-SDGGMIYI.min.js +1 -0
- package/dist/c-SQQZPFVY.min.js +1 -0
- package/dist/c-SU6Z75M2.min.js +1 -0
- package/dist/{c-BWM7MU2Y.min.js → c-SX4TPG3Z.min.js} +1 -1
- package/dist/{c-DTYG34WG.min.js → c-VGHU2LTF.min.js} +2 -2
- package/dist/c-VLWWXOM5.min.js +1 -0
- package/dist/c-VZNIIKL6.min.js +1 -0
- package/dist/{c-GBO32OML.min.js → c-W5ATXREF.min.js} +1 -1
- package/dist/c-WSWMQDFZ.min.js +1 -0
- package/dist/{c-3SDC7AQQ.min.js → c-XM76UG3P.min.js} +1 -1
- package/dist/c-XORVM6C5.min.js +1 -0
- package/dist/{c-MYRI7NF2.min.js → c-XZJWL7UL.min.js} +1 -1
- package/dist/c-Y43GTKGR.min.js +1 -0
- package/dist/c-YGTMWEEF.min.js +1 -0
- package/dist/c-ZFIURPZA.min.js +1 -0
- package/dist/c-ZWJDTDEV.min.js +1 -0
- package/dist/c-ZYMXDR42.min.js +1 -0
- package/dist/components/ai/chartClinic.d.ts +4 -0
- package/dist/components/ai/evaluateChart.d.ts +3 -1
- package/dist/components/ai/generativeChart.d.ts +13 -0
- package/dist/components/ai/renderEvidenceMemoKey.d.ts +9 -0
- package/dist/components/ai/reportRenderError.d.ts +2 -0
- package/dist/components/charts/physics/eventDropSources.d.ts +1 -1
- package/dist/components/evidence/claimReferences.d.ts +9 -0
- package/dist/components/realtime/BinAccumulator.d.ts +5 -0
- package/dist/components/recipes/atlas/dependencyEvidence.d.ts +5 -0
- package/dist/components/recipes/atlas/support.d.ts +5 -0
- package/dist/components/server/staticXYAxisTicks.d.ts +1 -1
- package/dist/components/stream/MarginalGraphics.d.ts +4 -2
- package/dist/components/stream/PipelineStore.d.ts +6 -18
- package/dist/components/stream/axisTickUtils.d.ts +1 -1
- package/dist/components/stream/countNoun.d.ts +2 -0
- package/dist/components/stream/heatmapBandTicks.d.ts +68 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +52 -3
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +8 -0
- package/dist/components/stream/uniqueRegionLabel.d.ts +6 -0
- package/dist/components/stream/xyAxisTicks.d.ts +8 -1
- package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -0
- package/dist/geo.min.js +152 -152
- package/dist/geo.module.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -1
- package/dist/semiotic-access.module.min.js +2 -2
- package/dist/semiotic-ai-core.min.js +5 -5
- package/dist/semiotic-ai-core.module.min.js +4 -4
- package/dist/semiotic-ai.module.min.js +2 -2
- package/dist/semiotic-artifact.min.js +6 -6
- package/dist/semiotic-artifact.module.min.js +2 -2
- package/dist/semiotic-atlas-core.min.js +1 -1
- package/dist/semiotic-atlas-core.module.min.js +1 -1
- package/dist/semiotic-atlas-selection.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1023 -1023
- package/dist/semiotic-evidence.min.js +4 -4
- package/dist/semiotic-evidence.module.min.js +3 -3
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +101 -101
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +3 -3
- package/dist/semiotic-server-edge.min.js +397 -397
- package/dist/semiotic-server-edge.module.min.js +3 -3
- package/dist/semiotic-server-node.min.js +397 -397
- package/dist/semiotic-utils-core.min.js +11 -11
- package/dist/semiotic-utils-core.module.min.js +3 -3
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +397 -397
- package/dist/server.module.min.js +3 -3
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/c-3OBJLOXI.min.js +0 -1
- package/dist/c-4VFGNUWG.min.js +0 -1
- package/dist/c-5BN7GWJH.min.js +0 -1
- package/dist/c-65GMYND6.min.js +0 -1
- package/dist/c-AGRMJIUH.min.js +0 -1
- package/dist/c-BJKGYOPX.min.js +0 -1
- package/dist/c-C332PFY6.min.js +0 -1
- package/dist/c-DDZ5TZ7P.min.js +0 -1
- package/dist/c-F4DZ3NMI.min.js +0 -1
- package/dist/c-GZJ2XEQ5.min.js +0 -1
- package/dist/c-HFQ3Z65X.min.js +0 -1
- package/dist/c-HNW73MXJ.min.js +0 -1
- package/dist/c-HWFZB7SD.min.js +0 -1
- package/dist/c-IIV4DB7T.min.js +0 -1
- package/dist/c-J2QH3PEI.min.js +0 -1
- package/dist/c-JZNWRFVJ.min.js +0 -2
- package/dist/c-KHLBCSIO.min.js +0 -1
- package/dist/c-L7FQHKGH.min.js +0 -1
- package/dist/c-LYPOBMKC.min.js +0 -1
- package/dist/c-NGMMPKNJ.min.js +0 -1
- package/dist/c-NOME4L5M.min.js +0 -1
- package/dist/c-OKIJBK5K.min.js +0 -2
- package/dist/c-OXV4W7YX.min.js +0 -1
- package/dist/c-P73SQZEP.min.js +0 -1
- package/dist/c-PD5EZI24.min.js +0 -1
- package/dist/c-RAL7HCTV.min.js +0 -1
- package/dist/c-S4OGXAVO.min.js +0 -1
- package/dist/c-UWE3VZEO.min.js +0 -1
- package/dist/c-VP7WX6QI.min.js +0 -1
- package/dist/c-VW7ZSLDC.min.js +0 -1
- package/dist/c-WDVYLMCM.min.js +0 -1
- package/dist/c-XEACLH4B.min.js +0 -1
- package/dist/c-YJDGSPNB.min.js +0 -1
- package/dist/c-ZYBEKQCT.min.js +0 -1
package/dist/geo.min.js
CHANGED
|
@@ -1,236 +1,236 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";function e(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=String(r):r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function t(e){return e&&"object"==typeof e?e:{}}function n(e){return t(e.accessibility).tableFields??e.accessibleDatum??e.datum}function r(e){const t=/* @__PURE__ */new Set;if(!e.some(e=>e&&("point"===e.type||"symbol"===e.type||"glyph"===e.type)))return t;for(const n of e)if(n&&["line","area","boxplot","violin"].includes(String(n.type))&&Array.isArray(n.datum))for(const e of n.datum)t.add(e);return t}function i(e){if(!Array.isArray(e))return 0;const t=r(e);let i=0;for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)switch(r.type){case"point":case"symbol":case"glyph":t.has(r.datum)||i++;break;case"line":case"area":{const e=n(r);i+=Array.isArray(e)?e.length:null!=e&&"object"==typeof e?1:0;break}case"boxplot":case"violin":{const e=n(r);i+=Array.isArray(e)?e.length+1:1;break}case"rect":case"heatcell":case"wedge":case"circle":case"arc":case"candlestick":case"connector":case"trapezoid":case"bezier":case"ribbon":case"curved":case"geoarea":i++}return i}function o(i){const o=[];if(!Array.isArray(i))return o;const a=r(i);for(const r of i)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":case"symbol":case"glyph":if(a.has(r.datum))break;o.push({label:"Point",values:e(n(r))});break;case"line":case"area":{const t=n(r),i=Array.isArray(t)?t:null!=t&&"object"==typeof t?[t]:[],a="line"===r.type?"Line point":"Area point";for(const t of i)o.push({label:a,values:e(t)});break}case"boxplot":case"violin":{const t=n(r),i="boxplot"===r.type?"Boxplot":"Distribution",a="string"==typeof r.category?{category:r.category}:{};if(Array.isArray(t)){o.push({label:i,values:{...a,...e(r.stats)}});for(const n of t)o.push({label:`${i} observation`,values:{...a,...e(n)}})}else o.push({label:i,values:{...a,...e(t)}});break}case"rect":{const t=n(r),i=null!=t&&"object"==typeof t?t:{},a=i.category??r.group??"",s=i.value??i.__aggregateValue??i.total,l=e(i);null==l.category&&""!==a&&(l.category=String(a)),null==l.value&&null!=s&&(l.value="number"==typeof s||"string"==typeof s?s:String(s)),o.push({label:"Bar",values:l});break}case"heatcell":{const t=e(n(r));null==t.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(t.value=r.value),o.push({label:"Cell",values:t});break}case"wedge":{const i=n(r),a=e(i);if(null==a.category){const e=t(i),n=e.category??e.label;null!=n&&(a.category=String(n))}o.push({label:"Wedge",values:a});break}case"circle":o.push({label:"Node",values:e(n(r))});break;case"arc":o.push({label:"Arc",values:e(n(r))});break;case"candlestick":o.push({label:"Candlestick",values:e(n(r))});break;case"connector":case"trapezoid":case"bezier":case"ribbon":case"curved":o.push({label:"Connection",values:e(n(r))});break;case"geoarea":{const i=t(n(r)),a={...e(i.properties),...e(i)};o.push({label:"Region",values:a});break}}}catch{}return o}function a(e){return"string"==typeof e?document.getElementById(e):"function"==typeof e?e():e}function
|
|
3
|
-
return(0,
|
|
2
|
+
"use strict";function e(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=String(r):r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function t(e){return e&&"object"==typeof e?e:{}}function n(e){return t(e.accessibility).tableFields??e.accessibleDatum??e.datum}function r(e){const t=/* @__PURE__ */new Set;if(!e.some(e=>e&&("point"===e.type||"symbol"===e.type||"glyph"===e.type)))return t;for(const n of e)if(n&&["line","area","boxplot","violin"].includes(String(n.type))&&Array.isArray(n.datum))for(const e of n.datum)t.add(e);return t}function i(e){if(!Array.isArray(e))return 0;const t=r(e);let i=0;for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)switch(r.type){case"point":case"symbol":case"glyph":t.has(r.datum)||i++;break;case"line":case"area":{const e=n(r);i+=Array.isArray(e)?e.length:null!=e&&"object"==typeof e?1:0;break}case"boxplot":case"violin":{const e=n(r);i+=Array.isArray(e)?e.length+1:1;break}case"rect":case"heatcell":case"wedge":case"circle":case"arc":case"candlestick":case"connector":case"trapezoid":case"bezier":case"ribbon":case"curved":case"geoarea":i++}return i}function o(i){const o=[];if(!Array.isArray(i))return o;const a=r(i);for(const r of i)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":case"symbol":case"glyph":if(a.has(r.datum))break;o.push({label:"Point",values:e(n(r))});break;case"line":case"area":{const t=n(r),i=Array.isArray(t)?t:null!=t&&"object"==typeof t?[t]:[],a="line"===r.type?"Line point":"Area point";for(const t of i)o.push({label:a,values:e(t)});break}case"boxplot":case"violin":{const t=n(r),i="boxplot"===r.type?"Boxplot":"Distribution",a="string"==typeof r.category?{category:r.category}:{};if(Array.isArray(t)){o.push({label:i,values:{...a,...e(r.stats)}});for(const n of t)o.push({label:`${i} observation`,values:{...a,...e(n)}})}else o.push({label:i,values:{...a,...e(t)}});break}case"rect":{const t=n(r),i=null!=t&&"object"==typeof t?t:{},a=i.category??r.group??"",s=i.value??i.__aggregateValue??i.total,l=e(i);null==l.category&&""!==a&&(l.category=String(a)),null==l.value&&null!=s&&(l.value="number"==typeof s||"string"==typeof s?s:String(s)),o.push({label:"Bar",values:l});break}case"heatcell":{const t=e(n(r));null==t.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(t.value=r.value),o.push({label:"Cell",values:t});break}case"wedge":{const i=n(r),a=e(i);if(null==a.category){const e=t(i),n=e.category??e.label;null!=n&&(a.category=String(n))}o.push({label:"Wedge",values:a});break}case"circle":o.push({label:"Node",values:e(n(r))});break;case"arc":o.push({label:"Arc",values:e(n(r))});break;case"candlestick":o.push({label:"Candlestick",values:e(n(r))});break;case"connector":case"trapezoid":case"bezier":case"ribbon":case"curved":o.push({label:"Connection",values:e(n(r))});break;case"geoarea":{const i=t(n(r)),a={...e(i.properties),...e(i)};o.push({label:"Region",values:a});break}}}catch{}return o}function a(e,t,n=`${t}s`){return`${e} ${1===e?t:n}`}function s(e){return"string"==typeof e?document.getElementById(e):"function"==typeof e?e():e}function l({target:e,children:t}){const[n,r]=Au.useState({requestedTarget:e,resolved:!1,target:null});return Au.useEffect(()=>{const t=s(e);"production"!==process.env.NODE_ENV&&null==t&&"string"==typeof e&&console.warn(`[Semiotic] accessibleTable portal target "${e}" was not found. Rendering the data-summary controls inline instead.`),r({requestedTarget:e,resolved:!0,target:t})},[e]),n.requestedTarget===e&&n.resolved?n.target?(0,Ru.createPortal)(t,n.target):/* @__PURE__ */ /* @__PURE__ */(0,Cu.jsx)(Cu.Fragment,{children:t}):null}function c(e){return null==e||""===e?"—":"number"==typeof e?Number.isNaN(e)?"—":Hu(e):"boolean"==typeof e?e?"true":"false":"object"==typeof e?"—":String(e)}function u(e){const t=/* @__PURE__ */new Map;for(const n of e??[])for(const[e,r]of Object.entries(n?.values??{})){if(null==r||""===r)continue;let n=t.get(e);if(n||(n={count:0,min:1/0,max:-1/0,sum:0,strings:/* @__PURE__ */new Set},t.set(e,n)),"number"==typeof r){if(!Number.isFinite(r))continue;n.count++,n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r)}else"object"!=typeof r&&"function"!=typeof r&&n.strings.add(String(r))}return Array.from(t,([e,t])=>{if(t.count)return{name:e,count:t.count,numeric:!0,min:t.min,max:t.max,mean:t.sum/t.count};const n=Array.from(t.strings);return{name:e,count:n.length,numeric:!1,uniqueValues:n.slice(0,5)}}).filter(e=>e.count>0)}function d(e,t){const n=[`${a(e,"data point","data points")}.`];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Hu(e.min)} to ${Hu(e.max)}, mean ${Hu(e.mean)}.`);else{const t=e.uniqueValues,r=t.length<=3?t.join(", "):`${t.slice(0,3).join(", ")}… (${e.count} unique)`;n.push(`${e.name}: ${r}.`)}return n.join(" ")}function h({rows:e,label:t,caption:n,typeLabel:r,labelRows:i=!1,className:o="semiotic-accessible-data-table-table",style:a,extraColumns:s=[]}){const l=Array.from(new Set(e.flatMap(e=>Object.keys(e.values))));/* @__PURE__ */ /* @__PURE__ */
|
|
3
|
+
return(0,qu.jsxs)("table",{className:o,role:"table","aria-label":t,style:a??wu,children:[
|
|
4
4
|
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */(0,
|
|
5
|
+
/* @__PURE__ */(0,qu.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Mu,children:n}),
|
|
6
6
|
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */(0,
|
|
7
|
+
/* @__PURE__ */(0,qu.jsx)("thead",{children:/* @__PURE__ */ /* @__PURE__ */(0,qu.jsx)("tr",{children:[r,...l,...s.map(e=>e.label)].map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,qu.jsx)("th",{style:ku,children:e},t))})}),
|
|
8
8
|
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */(0,
|
|
9
|
+
/* @__PURE__ */(0,qu.jsx)("tbody",{children:e.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,qu.jsxs)("tr",{tabIndex:-1,"aria-label":i?e.label:void 0,children:[
|
|
10
10
|
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */(0,
|
|
12
|
-
return(0,
|
|
11
|
+
/* @__PURE__ */(0,qu.jsx)("td",{style:Su,children:e.label}),l.map(t=>/* @__PURE__ */ /* @__PURE__ */(0,qu.jsx)("td",{style:Su,children:c(e.values[t])},t)),s.map((e,n)=>/* @__PURE__ */ /* @__PURE__ */(0,qu.jsx)("td",{style:Su,children:c(e.values[t])},n))]},t))})]})}function f({remaining:e,kind:t="row",onClick:n}){return e<=0?null:/* @__PURE__ */ /* @__PURE__ */(0,Gu.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:n,style:ju,children:["Show ",Math.min(pu,e)," more ",t,1===e?"":"s"," (",e," remaining)"]})}function p({scene:e,sceneRevision:t,chartType:n,revealRows:r}){const[i,s]=Vu.useState(fu),l=t??e,{allRows:c,summary:p}=Vu.useMemo(()=>{const t=o(e);return{allRows:t,summary:d(t.length,u(t))}},[l]),m=Math.min(i,c.length),g=c.length-m;/* @__PURE__ */ /* @__PURE__ */
|
|
12
|
+
return(0,Uu.jsxs)(Uu.Fragment,{children:[
|
|
13
13
|
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */(0,
|
|
14
|
+
/* @__PURE__ */(0,Uu.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:vu,children:p}),
|
|
15
15
|
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */(0,
|
|
16
|
+
/* @__PURE__ */(0,Uu.jsx)(h,{rows:c.slice(0,m),label:`Sample data for ${n}`,typeLabel:"type",caption:g>0?`First ${m} of ${a(c.length,"data point","data points")}`:`All ${a(c.length,"data point","data points")}`}),
|
|
17
17
|
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */(0,Ru.jsx)(h,{remaining:m,onClick:e=>{r(e.currentTarget,p,Math.min(p+Xc,l.length),l.length),a(e=>e+Xc)},kind:"row"})]})}function p(e,t){ed(()=>{t&&(e.current=t)},[e,t])}function m(e){return e>1?ad:e<-1?-ad:Math.asin(e)}function g(e){return(e=bd(e/2))*e}function y(){}function b(e,t){e&&Sd.hasOwnProperty(e.type)&&Sd[e.type](e,t)}function v(e,t,n){var r,i=-1,o=e.length-n;for(t.lineStart();++i<o;)r=e[i],t.point(r[0],r[1],r[2]);t.lineEnd()}function x(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)v(e[n],t,1);t.polygonEnd()}function w(e,t){e&&kd.hasOwnProperty(e.type)?kd[e.type](e,t):b(e,t)}function k(){Ad.point=M}function S(){j(Du,$u)}function M(e,t){Ad.point=j,Du=e,$u=t,Ou=e*=ud,Fu=pd(t=(t*=ud)/2+sd),_u=bd(t)}function j(e,t){var n=(e*=ud)-Ou,r=n>=0?1:-1,i=r*n,o=pd(t=(t*=ud)/2+sd),a=bd(t),s=_u*a,l=Fu*o+s*pd(i),c=s*r*bd(i);Md.add(fd(c,l)),Ou=e,Fu=o,_u=a}function A(e){return[fd(e[1],e[0]),m(e[2])]}function R(e){var t=e[0],n=e[1],r=pd(n);return[r*pd(t),r*bd(t),bd(n)]}function C(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function L(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function P(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function N(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function E(e){var t=xd(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function I(e,t){Zu.push(Ku=[Wu=e,Hu=e]),t<Bu&&(Bu=t),t>qu&&(qu=t)}function z(e,t){var n=R([e*ud,t*ud]);if(Yu){var r=L(Yu,n),i=L([r[1],-r[0],0],r);E(i),i=A(i);var o,a=e-Gu,s=a>0?1:-1,l=i[0]*cd*s,c=dd(a)>180;c^(s*Gu<l&&l<s*e)?(o=i[1]*cd)>qu&&(qu=o):c^(s*Gu<(l=(l+360)%360-180)&&l<s*e)?(o=-i[1]*cd)<Bu&&(Bu=o):(t<Bu&&(Bu=t),t>qu&&(qu=t)),c?e<Gu?_(Wu,e)>_(Wu,Hu)&&(Hu=e):_(e,Hu)>_(Wu,Hu)&&(Wu=e):Hu>=Wu?(e<Wu&&(Wu=e),e>Hu&&(Hu=e)):e>Gu?_(Wu,e)>_(Wu,Hu)&&(Hu=e):_(e,Hu)>_(Wu,Hu)&&(Wu=e)}else Zu.push(Ku=[Wu=e,Hu=e]);t<Bu&&(Bu=t),t>qu&&(qu=t),Yu=n,Gu=e}function T(){Cd.point=z}function D(){Ku[0]=Wu,Ku[1]=Hu,Cd.point=I,Yu=null}function $(e,t){if(Yu){var n=e-Gu;Xu.add(dd(n)>180?n+(n>0?360:-360):n)}else Vu=e,Uu=t;Ad.point(e,t),z(e,t)}function O(){Ad.lineStart()}function F(){$(Vu,Uu),Ad.lineEnd(),dd(Xu)>rd&&(Wu=-(Hu=180)),Ku[0]=Wu,Ku[1]=Hu,Yu=null}function _(e,t){return(t-=e)<0?t+360:t}function W(e,t){return e[0]-t[0]}function B(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}function H(e){var t,n,r,i,o,a,s;if(qu=Hu=-(Wu=Bu=1/0),Zu=[],w(e,Cd),n=Zu.length){for(Zu.sort(W),t=1,o=[r=Zu[0]];t<n;++t)B(r,(i=Zu[t])[0])||B(r,i[1])?(_(r[0],i[1])>_(r[0],r[1])&&(r[1]=i[1]),_(i[0],r[1])>_(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];t<=n;r=i,++t)i=o[t],(s=_(r[1],i[0]))>a&&(a=s,Wu=i[0],Hu=r[1])}return Zu=Ku=null,Wu===1/0||Bu===1/0?[[NaN,NaN],[NaN,NaN]]:[[Wu,Bu],[Hu,qu]]}function q(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function G(e,t){return dd(e)>od&&(e-=Math.round(e/ld)*ld),[e,t]}function V(e,t,n){return(e%=ld)?t||n?q(Y(e),X(t,n)):Y(e):t||n?X(t,n):G}function U(e){return function(t,n){return dd(t+=e)>od&&(t-=Math.round(t/ld)*ld),[t,n]}}function Y(e){var t=U(e);return t.invert=U(-e),t}function X(e,t){function n(e,t){var n=pd(t),s=pd(e)*n,l=bd(e)*n,c=bd(t),u=c*r+s*i;return[fd(l*o-u*a,s*r-c*i),m(u*o+l*a)]}var r=pd(e),i=bd(e),o=pd(t),a=bd(t);return n.invert=function(e,t){var n=pd(t),s=pd(e)*n,l=bd(e)*n,c=bd(t),u=c*o-l*a;return[fd(l*o+c*a,s*r+u*i),m(u*r-s*i)]},n}function Z(e){function t(t){return(t=e(t[0]*ud,t[1]*ud))[0]*=cd,t[1]*=cd,t}return e=V(e[0]*ud,e[1]*ud,e.length>2?e[2]*ud:0),t.invert=function(t){return(t=e.invert(t[0]*ud,t[1]*ud))[0]*=cd,t[1]*=cd,t},t}function K(e,t,n,r,i,o){if(n){var a=pd(t),s=bd(t),l=r*n;null==i?(i=t+r*ld,o=t-l/2):(i=Q(a,i),o=Q(a,o),(r>0?i<o:i>o)&&(i+=r*ld));for(var c,u=i;r>0?u>o:u<o;u-=l)c=A([a,-s*pd(u),-s*bd(u)]),e.point(c[0],c[1])}}function Q(e,t){(t=R(t))[0]-=e,E(t);var n,r=(n=-t[1])>1?0:n<-1?od:Math.acos(n);return((-t[2]<0?-r:r)+ld-rd)%ld}function J(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:y,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function ee(e,t){return dd(e[0]-t[0])<rd&&dd(e[1]-t[1])<rd}function te(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ne(e,t,n,r,i){var o,a,s=[],l=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n,r=e[0],a=e[t];if(ee(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<t;++o)i.point((r=e[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new te(r,e,null,!0)),l.push(n.o=new te(r,null,n,!1)),s.push(n=new te(a,e,null,!1)),l.push(n.o=new te(a,null,n,!0))}}),s.length){for(l.sort(t),re(s),re(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var c,u,d=s[0];;){for(var h=d,f=!0;h.v;)if((h=h.n)===d)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(o=0,a=c.length;o<a;++o)i.point((u=c[o])[0],u[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(f)for(c=h.p.z,o=c.length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,f=!f}while(!h.v);i.lineEnd()}}}function re(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r<t;)i.n=n=e[r],n.p=i,i=n;i.n=n=e[0],n.p=i}}function ie(e){return dd(e[0])<=od?e[0]:vd(e[0])*((dd(e[0])+od)%ld-od)}function oe(e,t){var n=ie(t),r=t[1],i=bd(r),o=[bd(n),-pd(n),0],a=0,s=0,l=new Wd.Adder;1===i?r=ad+rd:-1===i&&(r=-ad-rd);for(var c=0,u=e.length;c<u;++c)if(h=(d=e[c]).length)for(var d,h,f=d[h-1],p=ie(f),g=f[1]/2+sd,y=bd(g),b=pd(g),v=0;v<h;++v,p=w,y=S,b=M,f=x){var x=d[v],w=ie(x),k=x[1]/2+sd,S=bd(k),M=pd(k),j=w-p,A=j>=0?1:-1,C=A*j,P=C>od,N=y*S;if(l.add(fd(N*A*bd(C),b*M+N*pd(C))),a+=P?j+A*ld:j,P^p>=n^w>=n){var I=L(R(f),R(x));E(I);var z=L(o,I);E(z);var T=(P^j>=0?-1:1)*m(z[2]);(r>T||r===T&&(I[0]||I[1]))&&(s+=P^j>=0?1:-1)}}return(a<-rd||a<rd&&l<-1e-12)^1&s}function ae(e,t,n,r){return function(i){function o(t,n){e(t,n)&&i.point(t,n)}function a(e,t){m.point(e,t)}function s(){v.point=a,m.lineStart()}function l(){v.point=o,m.lineEnd()}function c(e,t){p.push([e,t]),y.point(e,t)}function u(){y.lineStart(),p=[]}function d(){c(p[0][0],p[0][1]),y.lineEnd();var e,t,n,r,o=y.clean(),a=g.result(),s=a.length;if(p.pop(),h.push(p),p=null,s)if(1&o){if((t=(n=a[0]).length-1)>0){for(b||(i.polygonStart(),b=!0),i.lineStart(),e=0;e<t;++e)i.point((r=n[e])[0],r[1]);i.lineEnd()}}else s>1&&2&o&&a.push(a.pop().concat(a.shift())),f.push(a.filter(se))}var h,f,p,m=t(i),g=J(),y=t(g),b=!1,v={point:o,lineStart:s,lineEnd:l,polygonStart:function(){v.point=c,v.lineStart=u,v.lineEnd=d,f=[],h=[]},polygonEnd:function(){v.point=o,v.lineStart=s,v.lineEnd=l,f=(0,Bd.merge)(f);var e=oe(h,r);f.length?(b||(i.polygonStart(),b=!0),ne(f,le,e,n,i)):e&&(b||(i.polygonStart(),b=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),f=h=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};return v}}function se(e){return e.length>1}function le(e,t){return((e=e.x)[0]<0?e[1]-ad-rd:ad-e[1])-((t=t.x)[0]<0?t[1]-ad-rd:ad-t[1])}function ce(e,t,n,r){var i,o,a=bd(e-n);return dd(a)>rd?hd((bd(t)*(o=pd(r))*bd(n)-bd(r)*(i=pd(t))*bd(e))/(i*o*a)):(t+r)/2}function ue(e){function t(e,t){return pd(e)*pd(t)>i}function n(e,t,n){var r=[1,0,0],o=L(R(e),R(t)),a=C(o,o),s=o[0],l=a-s*s;if(!l)return!n&&e;var c=i*a/l,u=-i*s/l,d=L(r,o),h=N(r,c);P(h,N(o,u));var f=d,p=C(h,f),m=C(f,f),g=p*p-m*(C(h,h)-1);if(!(g<0)){var y=xd(g),b=N(f,(-p-y)/m);if(P(b,h),b=A(b),!n)return b;var v,x=e[0],w=t[0],k=e[1],S=t[1];w<x&&(v=x,x=w,w=v);var M=w-x,j=dd(M-od)<rd;if(!j&&S<k&&(v=k,k=S,S=v),j||M<rd?j?k+S>0^b[1]<(dd(b[0]-x)<rd?k:S):k<=b[1]&&b[1]<=S:M>od^(x<=b[0]&&b[0]<=w)){var E=N(f,(-p+y)/m);return P(E,h),[b,A(E)]}}}function r(t,n){var r=a?e:od-e,i=0;return t<-r?i|=1:t>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var i=pd(e),o=2*ud,a=i>0,s=dd(i)>rd;return ae(t,function(e){var i,o,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(d,h){var f,p=[d,h],m=t(d,h),g=a?m?0:r(d,h):m?r(d+(d<0?od:-od),h):0;if(!i&&(c=l=m)&&e.lineStart(),m!==l&&(!(f=n(i,p))||ee(i,f)||ee(p,f))&&(p[2]=1),m!==l)u=0,m?(e.lineStart(),f=n(p,i),e.point(f[0],f[1])):(f=n(i,p),e.point(f[0],f[1],2),e.lineEnd()),i=f;else if(s&&i&&a^m){var y;g&o||!(y=n(p,i,!0))||(u=0,a?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||i&&ee(i,p)||e.point(p[0],p[1]),i=p,l=m,o=g},lineEnd:function(){l&&e.lineEnd(),i=null},clean:function(){return u|(c&&l)<<1}}},function(t,n,r,i){K(i,e,o,r,t,n)},a?[0,-e]:[-od,e-od])}function de(e,t,n,r,i,o){var a,s=e[0],l=e[1],c=0,u=1,d=t[0]-s,h=t[1]-l;if(a=n-s,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<u&&(u=a)}else if(d>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<u&&(u=a)}if(a=r-l,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<u&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<u&&(u=a)}return c>0&&(e[0]=s+c*d,e[1]=l+c*h),u<1&&(t[0]=s+u*d,t[1]=l+u*h),!0}}}}}function he(e,t,n,r){function i(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function o(i,o,s,c){var u=0,d=0;if(null==i||(u=a(i,s))!==(d=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?e:n,u>1?r:t)}while((u=(u+s+4)%4)!==d);else c.point(o[0],o[1])}function a(r,i){return dd(r[0]-e)<rd?i>0?0:3:dd(r[0]-n)<rd?i>0?2:1:dd(r[1]-t)<rd?i>0?1:0:i>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){function l(e,t){i(e,t)&&k.point(e,t)}function c(){for(var t=0,n=0,i=h.length;n<i;++n)for(var o,a,s=h[n],l=1,c=s.length,u=s[0],d=u[0],f=u[1];l<c;++l)o=d,a=f,d=(u=s[l])[0],f=u[1],a<=r?f>r&&(d-o)*(r-a)>(f-a)*(e-o)&&++t:f<=r&&(d-o)*(r-a)<(f-a)*(e-o)&&--t;return t}function u(o,a){var s=i(o,a);if(h&&f.push([o,a]),x)p=o,m=a,g=s,x=!1,s&&(k.lineStart(),k.point(o,a));else if(s&&v)k.point(o,a);else{var l=[y=Math.max(Vd,Math.min(Gd,y)),b=Math.max(Vd,Math.min(Gd,b))],c=[o=Math.max(Vd,Math.min(Gd,o)),a=Math.max(Vd,Math.min(Gd,a))];de(l,c,e,t,n,r)?(v||(k.lineStart(),k.point(l[0],l[1])),k.point(c[0],c[1]),s||k.lineEnd(),w=!1):s&&(k.lineStart(),k.point(o,a),w=!1)}y=o,b=a,v=s}var d,h,f,p,m,g,y,b,v,x,w,k=a,S=J(),M={point:l,lineStart:function(){M.point=u,h&&h.push(f=[]),x=!0,v=!1,y=b=NaN},lineEnd:function(){d&&(u(p,m),g&&v&&S.rejoin(),d.push(S.result())),M.point=l,v&&k.lineEnd()},polygonStart:function(){k=S,d=[],h=[],w=!0},polygonEnd:function(){var e=c(),t=w&&e,n=(d=(0,qd.merge)(d)).length;(t||n)&&(a.polygonStart(),t&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),n&&ne(d,s,e,o,a),a.polygonEnd()),k=a,d=h=f=null}};return M}}function fe(){Yd.point=Yd.lineEnd=y}function pe(e,t){Pd=e*=ud,Nd=bd(t*=ud),Ed=pd(t),Yd.point=me}function me(e,t){e*=ud;var n=bd(t*=ud),r=pd(t),i=dd(e-Pd),o=pd(i),a=r*bd(i),s=Ed*n-Nd*r*o,l=Nd*n+Ed*r*o;Ld.add(fd(xd(a*a+s*s),l)),Pd=e,Nd=n,Ed=r}function ge(e,t){return Xd[0]=e,Xd[1]=t,n=Zd,Ld=new Ud.Adder,w(n,Yd),+Ld;var n}function ye(e,t){return!(!e||!Qd.hasOwnProperty(e.type))&&Qd[e.type](e,t)}function be(e,t){return 0===ge(e,t)}function ve(e,t){for(var n,r,i,o=0,a=e.length;o<a;o++){if(0===(r=ge(e[o],t)))return!0;if(o>0&&(i=ge(e[o],e[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<id*i)return!0;n=r}return!1}function xe(e,t){return!!oe(e.map(we),ke(t))}function we(e){return(e=e.map(ke)).pop(),e}function ke(e){return[e[0]*ud,e[1]*ud]}function Se(e,t){return(e&&Kd.hasOwnProperty(e.type)?Kd[e.type]:ye)(e,t)}function Me(e,t,n){var r=(0,Jd.range)(e,t-rd,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function je(e,t,n){var r=(0,Jd.range)(e,t-rd,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function Ae(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return(0,Jd.range)(md(o/g)*g,i,g).map(h).concat((0,Jd.range)(md(c/y)*y,l,y).map(f)).concat((0,Jd.range)(md(r/p)*p,n,p).filter(function(e){return dd(e%g)>rd}).map(u)).concat((0,Jd.range)(md(s/m)*m,a,m).filter(function(e){return dd(e%y)>rd}).map(d))}var n,r,i,o,a,s,l,c,u,d,h,f,p=10,m=p,g=90,y=360,b=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(f(l).slice(1),h(i).reverse().slice(1),f(c).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.extentMajor(t).extentMinor(t):e.extentMinor()},e.extentMajor=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],c=+t[0][1],l=+t[1][1],o>i&&(t=o,o=i,i=t),c>l&&(t=c,c=l,l=t),e.precision(b)):[[o,c],[i,l]]},e.extentMinor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),e.precision(b)):[[r,s],[n,a]]},e.step=function(t){return arguments.length?e.stepMajor(t).stepMinor(t):e.stepMinor()},e.stepMajor=function(t){return arguments.length?(g=+t[0],y=+t[1],e):[g,y]},e.stepMinor=function(t){return arguments.length?(p=+t[0],m=+t[1],e):[p,m]},e.precision=function(t){return arguments.length?(b=+t,u=Me(s,a,90),d=je(r,n,b),h=Me(c,l,90),f=je(o,i,b),e):b},e.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}function Re(e,t){var n=e[0]*ud,r=e[1]*ud,i=t[0]*ud,o=t[1]*ud,a=pd(r),s=bd(r),l=pd(o),c=bd(o),u=a*pd(n),d=a*bd(n),h=l*pd(i),f=l*bd(i),p=2*m(xd(g(o-r)+a*l*g(i-n))),y=bd(p),b=p?function(e){var t=bd(e*=p)/y,n=bd(p-e)/y,r=n*u+t*h,i=n*d+t*f,o=n*s+t*c;return[fd(i,r)*cd,fd(o,xd(r*r+i*i))*cd]}:function(){return[n*cd,r*cd]};return b.distance=p,b}function Ce(){ih.point=Le}function Le(e,t){ih.point=Pe,Id=Td=e,zd=Dd=t}function Pe(e,t){rh.add(Dd*e-Td*t),Td=e,Dd=t}function Ne(){Pe(Id,zd)}function Ee(e,t){dh+=e,hh+=t,++fh}function Ie(){xh.point=ze}function ze(e,t){xh.point=Te,Ee(Fd=e,_d=t)}function Te(e,t){var n=e-Fd,r=t-_d,i=xd(n*n+r*r);ph+=i*(Fd+e)/2,mh+=i*(_d+t)/2,gh+=i,Ee(Fd=e,_d=t)}function De(){xh.point=Ee}function $e(){xh.point=Fe}function Oe(){_e($d,Od)}function Fe(e,t){xh.point=_e,Ee($d=Fd=e,Od=_d=t)}function _e(e,t){var n=e-Fd,r=t-_d,i=xd(n*n+r*r);ph+=i*(Fd+e)/2,mh+=i*(_d+t)/2,gh+=i,yh+=(i=_d*e-Fd*t)*(Fd+e),bh+=i*(_d+t),vh+=3*i,Ee(Fd=e,_d=t)}function We(e){this._context=e}function Be(e,t){Ih.point=He,Sh=jh=e,Mh=Ah=t}function He(e,t){jh-=e,Ah-=t,Eh.add(xd(jh*jh+Ah*Ah)),jh=e,Ah=t}function qe(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Ge(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return qe;if(t!==Rh){const e=10**t;Rh=t,Ch=function(t){let n=1;this._+=t[0];for(const r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return Ch}function Ve(e,t){function n(e){return e&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),w(e,r(i))),i.result()}let r,i,o=3,a=4.5;return n.area=function(e){return w(e,r(oh)),oh.result()},n.measure=function(e){return w(e,r(zh)),zh.result()},n.bounds=function(e){return w(e,r(uh)),uh.result()},n.centroid=function(e){return w(e,r(wh)),wh.result()},n.projection=function(t){return arguments.length?(r=null==t?(e=null,eh):(e=t).stream,n):e},n.context=function(e){return arguments.length?(i=null==e?(t=null,new Th(o)):new We(t=e),"function"!=typeof a&&i.pointRadius(a),n):t},n.pointRadius=function(e){return arguments.length?(a="function"==typeof e?e:(i.pointRadius(+e),+e),n):a},n.digits=function(e){if(!arguments.length)return o;if(null==e)o=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);o=t}return null===t&&(i=new Th(o)),n},n.projection(e).digits(o).context(t)}function Ue(e){return function(t){var n=new Ye;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Ye(){}function Xe(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),w(n,e.stream(uh)),t(uh.result()),null!=r&&e.clipExtent(r),e}function Ze(e,t,n){return Xe(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])},n)}function Ke(e,t,n){return Ze(e,[[0,0],t],n)}function Qe(e,t,n){return Xe(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])},n)}function Je(e,t,n){return Xe(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])},n)}function et(e,t){return+t?nt(e,t):tt(e)}function tt(e){return Ue({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function nt(e,t){function n(r,i,o,a,s,l,c,u,d,h,f,p,g,y){var b=c-r,v=u-i,x=b*b+v*v;if(x>4*t&&g--){var w=a+h,k=s+f,S=l+p,M=xd(w*w+k*k+S*S),j=m(S/=M),A=dd(dd(S)-1)<rd||dd(o-d)<rd?(o+d)/2:fd(k,w),R=e(A,j),C=R[0],L=R[1],P=C-r,N=L-i,E=v*P-b*N;(E*E/x>t||dd((b*P+v*N)/x-.5)>.3||a*h+s*f+l*p<Dh)&&(n(r,i,o,a,s,l,C,L,A,w/=M,k/=M,S,g,y),y.point(C,L),n(C,L,A,w,k,S,c,u,d,h,f,p,g,y))}}return function(t){function r(n,r){n=e(n,r),t.point(n[0],n[1])}function i(){y=NaN,k.point=o,t.lineStart()}function o(r,i){var o=R([r,i]),a=e(r,i);n(y,b,g,v,x,w,y=a[0],b=a[1],g=r,v=o[0],x=o[1],w=o[2],16,t),t.point(y,b)}function a(){k.point=r,t.lineEnd()}function s(){i(),k.point=l,k.lineEnd=c}function l(e,t){o(u=e,t),d=y,h=b,f=v,p=x,m=w,k.point=o}function c(){n(y,b,g,v,x,w,d,h,u,f,p,m,16,t),k.lineEnd=a,a()}var u,d,h,f,p,m,g,y,b,v,x,w,k={point:r,lineStart:i,lineEnd:a,polygonStart:function(){t.polygonStart(),k.lineStart=s},polygonEnd:function(){t.polygonEnd(),k.lineStart=i}};return k}}function rt(e){return Ue({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function it(e,t,n,r,i){function o(o,a){return[t+e*(o*=r),n-e*(a*=i)]}return o.invert=function(o,a){return[(o-t)/e*r,(n-a)/e*i]},o}function ot(e,t,n,r,i,o){function a(e,o){return[c*(e*=r)-u*(o*=i)+t,n-u*e-c*o]}if(!o)return it(e,t,n,r,i);var s=pd(o),l=bd(o),c=s*e,u=l*e,d=s/e,h=l/e,f=(l*n-s*t)/e,p=(l*t+s*n)/e;return a.invert=function(e,t){return[r*(d*e-h*t+f),i*(p-h*e-d*t)]},a}function at(e){return st(function(){return e})()}function st(e){function t(e){return h(e[0]*ud,e[1]*ud)}function n(e){return(e=h.invert(e[0],e[1]))&&[e[0]*cd,e[1]*cd]}function r(){var e=ot(m,0,0,M,j,S).apply(null,o(b,v)),t=ot(m,g-e[0],y-e[1],M,j,S);return a=V(x,w,k),d=q(o,t),h=q(a,d),u=et(d,P),i()}function i(){return f=p=null,t}var o,a,s,l,c,u,d,h,f,p,m=150,g=480,y=250,b=0,v=0,x=0,w=0,k=0,S=0,M=1,j=1,A=null,R=Hd,C=null,L=eh,P=.5;return t.stream=function(e){return f&&p===e?f:f=$h(rt(a)(R(u(L(p=e)))))},t.preclip=function(e){return arguments.length?(R=e,A=void 0,i()):R},t.postclip=function(e){return arguments.length?(L=e,C=s=l=c=null,i()):L},t.clipAngle=function(e){return arguments.length?(R=+e?ue(A=e*ud):(A=null,Hd),i()):A*cd},t.clipExtent=function(e){return arguments.length?(L=null==e?(C=s=l=c=null,eh):he(C=+e[0][0],s=+e[0][1],l=+e[1][0],c=+e[1][1]),i()):null==C?null:[[C,s],[l,c]]},t.scale=function(e){return arguments.length?(m=+e,r()):m},t.translate=function(e){return arguments.length?(g=+e[0],y=+e[1],r()):[g,y]},t.center=function(e){return arguments.length?(b=e[0]%360*ud,v=e[1]%360*ud,r()):[b*cd,v*cd]},t.rotate=function(e){return arguments.length?(x=e[0]%360*ud,w=e[1]%360*ud,k=e.length>2?e[2]%360*ud:0,r()):[x*cd,w*cd,k*cd]},t.angle=function(e){return arguments.length?(S=e%360*ud,r()):S*cd},t.reflectX=function(e){return arguments.length?(M=e?-1:1,r()):M<0},t.reflectY=function(e){return arguments.length?(j=e?-1:1,r()):j<0},t.precision=function(e){return arguments.length?(u=et(d,P=e*e),i()):xd(P)},t.fitExtent=function(e,n){return Ze(t,e,n)},t.fitSize=function(e,n){return Ke(t,e,n)},t.fitWidth=function(e,n){return Qe(t,e,n)},t.fitHeight=function(e,n){return Je(t,e,n)},function(){return o=e.apply(this,arguments),t.invert=o.invert&&n,r()}}function lt(e){function t(e,t){return[e*n,bd(t)/n]}var n=pd(e);return t.invert=function(e,t){return[e/n,m(t*n)]},t}function ct(e,t){function n(e,t){var n=xd(o-2*i*bd(t))/i;return[n*bd(e*=i),a-n*pd(e)]}var r=bd(e),i=(r+bd(t))/2;if(dd(i)<rd)return lt(e);var o=1+r*(2*i-r),a=xd(o)/i;return n.invert=function(e,t){var n=a-t,r=fd(e,dd(n))*vd(n);return n*i<0&&(r-=od*vd(e)*vd(n)),[r/i,m((o-(e*e+n*n)*i*i)/(2*i))]},n}function ut(){return(e=ct,t=0,n=od/3,r=st(e),i=r(t,n),i.parallels=function(e){return arguments.length?r(t=e[0]*ud,n=e[1]*ud):[t*cd,n*cd]},i).scale(155.424).center([0,33.6442]);var e,t,n,r,i}function dt(e,t){return[e,yd(wd((ad+t)/2))]}function ht(e){function t(){var t=od*s(),a=o(Z(o.rotate()).invert([0,0]));return c(null==u?[[a[0]-t,a[1]-t],[a[0]+t,a[1]+t]]:e===dt?[[Math.max(a[0]-t,u),n],[Math.min(a[0]+t,r),i]]:[[u,Math.max(a[1]-t,n)],[r,Math.min(a[1]+t,i)]])}var n,r,i,o=at(e),a=o.center,s=o.scale,l=o.translate,c=o.clipExtent,u=null;return o.scale=function(e){return arguments.length?(s(e),t()):s()},o.translate=function(e){return arguments.length?(l(e),t()):l()},o.center=function(e){return arguments.length?(a(e),t()):a()},o.clipExtent=function(e){return arguments.length?(null==e?u=n=r=i=null:(u=+e[0][0],n=+e[0][1],r=+e[1][0],i=+e[1][1]),t()):null==u?null:[[u,n],[r,i]]},t()}function ft(e,t){return[e,t]}function pt(e,t){var n=m(Hh*bd(t)),r=n*n,i=r*r*r;return[e*pd(n)/(Hh*(Fh+3*_h*r+i*(7*Wh+9*Bh*r))),n*(Fh+_h*r+i*(Wh+Bh*r))]}function mt(){return at(pt).scale(177.158)}function gt(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function yt(e,t){return[pd(t)*bd(e),bd(t)]}function bt(e,t,n){if(Number.isFinite(e.scale())&&e.translate().every(Number.isFinite))return;e.scale(Math.max(1,Math.min(n.width,n.height)/(2*Math.PI))),e.translate([n.width/2,n.height/2]);const r=Ve(e).bounds(t);if(!r.flat().every(Number.isFinite))return;const i=e.translate();e.translate([i[0]+n.width/2-(r[0][0]+r[1][0])/2,i[1]+n.height/2-(r[0][1]+r[1][1])/2])}function vt(e,t){Vh.set(e,t)}function xt(e,t){let n;const r=/* @__PURE__ */new Map;return e.map(e=>{const i=Vh.get(e);if(void 0!==i)return i;if(!n){const e=/* @__PURE__ */new Map;n=e,t.forEach((t,n)=>{const r=e.get(t);r?r.push(n):e.set(t,[n])})}const o=r.get(e.datum)??0;return r.set(e.datum,o+1),n.get(e.datum)?.[o]??-1})}function wt(e){return{projection:e,geoPath:Ve(e),projectedPoint:(t,n)=>e([t,n]),invertedPoint:(t,n)=>e.invert?.([t,n])??null}}function kt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function St(e,t){const n=e-t.startTime;return Math.min(n/t.duration,1)}function Mt(e,t,n){return e+(t-e)*n}function jt(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}function At(e,t,n={}){if(!Number.isFinite(t)||t<=0)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(e<0)return"fresh";const r=n.fresh??Xh,i=n.aging??Zh,o=n.stale??Kh;return e<t*r?"fresh":e<t*i?"aging":e<t*o?"stale":"expired"}function Rt(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||e.extent<=0)return 1;const n=Math.max(0,e.age);if("step"===e.type)return n<(e.threshold??.5*e.extent)?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2,i=r>0?r:e.extent/2;return t+Math.pow(.5,n/i)*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}function Ct(e,t,n){if(n<=1)return 1;const r=n-1;return Rt({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function Lt(e,t,n){const r=e.duration??500,i=n-t;return i>=r?0:1-i/r}function Pt(e,t,n,r){let i=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,i=!0),e._pulseColor!==n&&(e._pulseColor=n,i=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,i=!0),i):(0!==e._pulseIntensity&&(e._pulseIntensity=0,i=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,i=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,i=!0),i)}function Nt(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,i=t.peek();return null!=i&&n-i<r}function Et(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function It(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function zt(e){const t=e.map(Et),n=t.length-1;return e=>{if(Number.isNaN(e)&&(e=0),e<=0){const[e,n,r]=t[0];return It(e,n,r)}if(e>=1){const[e,r,i]=t[n];return It(e,r,i)}const r=e*n,i=Math.floor(r),o=r-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return It(Math.round(a+(c-a)*o),Math.round(s+(u-s)*o),Math.round(l+(d-l)*o))}}function Tt(e){return e&&Object.prototype.hasOwnProperty.call(sf,e)?sf[e]:ef}function Dt(e,t,n=cf){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Object.prototype.hasOwnProperty.call(lf,e)?lf[e]:void 0;if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function $t(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||hf.has(t)}function Ot(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!$t(r)?n(r):r}const r=String(e?.[t]);return n?n(r):cf[Math.abs(Wt(r))%cf.length]}function Ft(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function _t(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Ft(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>String(e)))),i=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,Qh.scaleOrdinal)().domain(r).range(n).unknown("#999");const o=Object.prototype.hasOwnProperty.call(lf,n)?lf[n]:lf.category10;if(i&&"function"==typeof o){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>o(0===e?0:Number(t)/e)}{const e=Array.isArray(o)?o:cf;return(0,Qh.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function Wt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}function Bt(e,t,n=[3,20],r){let i;if(i="function"==typeof t?t(e):e?.[t],!r)return i;const[o,a]=r,[s,l]=n;if(a===o)return(s+l)/2;let c=(i-o)/(a-o);return c<0?c=0:c>1&&(c=1),s+c*(l-s)}function Ht(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Ft(n,e)||"#4e79a7":t=>{if(n){const e=Ft(n,t);if(e)return e}let r=0;for(let e=0;e<t.length;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function qt(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:i}=e;Gt(r)&&0===n.length&&Vt(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Vt(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Gt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Gt))}function Vt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Ut(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:String(e)}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}function Yt(e,t,n,r){const i=Ut(t),o="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:o,message:`Semiotic ${e} ${o} failed: ${i.message}`,error:i,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}function Xt(e){try{return{kind:"success",result:e.run()}}catch(t){const n=e.hasPreviousResult,r=Yt(e.family,t,n,e.revision);"production"!==process.env.NODE_ENV&&console.error(`[semiotic] ${e.logLabel} threw:`,t);try{e.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:r,preservedLastGoodScene:n}}}function Zt(e){if(!e)return mt();if("string"==typeof e){const t=ff[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),mt())}if("object"==typeof e&&"type"in e){const t=ff[e.type],n=t?t():mt();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}function Kt(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Qt(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function Jt(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function en(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}function tn(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}function nn(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}function rn(e,t){if(e.length<2)return[e];const n=.4*t,r=[];let i=[e[0]];for(let t=1;t<e.length;t++){const o=e[t-1],a=e[t];Math.abs(a[0]-o[0])>n?(i.length>=2&&r.push(i),i=[a]):i.push(a)}return i.length>=2&&r.push(i),r}function on(e,t,n=24){const r=t[0]-e[0],i=t[1]-e[1],o=Math.sqrt(r*r+i*i);if(0===o)return[e,t];const a=-i/o,s=r/o,l=Math.min(.3*o,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let r=0;r<=n;r++){const i=r/n,o=1-i,a=o*o*e[0]+2*o*i*c+i*i*t[0],s=o*o*e[1]+2*o*i*u+i*i*t[1];d.push([a,s])}return d}function an(e,t){if(e.length<2)return e;const n=t/2+1,r=[];for(let t=0;t<e.length;t++){const i=e[t];let o,a;0===t?(o=e[1][0]-i[0],a=e[1][1]-i[1]):t===e.length-1?(o=i[0]-e[t-1][0],a=i[1]-e[t-1][1]):(o=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(o*o+a*a)||1,l=a/s,c=-o/s;r.push([i[0]+l*n,i[1]+c*n])}return r}function sn(e,t,n,r,i){const o=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(o*o+a*a);if(0===s)return[e,t];const l=a/s,c=-o/s,u=i/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}function ln(e,t){let n=1/0,r=-1/0;for(const i of e){const e=t?t(i):i;e<n&&(n=e),e>r&&(r=e)}return[n,r]}function cn(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function un(e,t,n,r){const i=e.filter(e=>"point"===e.type);if(i.length<2)return null;const o=t.strength??1,a=Number.isFinite(o)?Math.max(0,Math.min(1,o)):1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===a)return null;const l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=i.find(e=>e.datum&&String(l(e.datum))===String(t.center));if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const d=cn(i.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),1);r>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}const h="strip"===s?hn(i,u,c,d,n):dn(i,u,c,d,a,n),f=e.filter(e=>"line"===e.type);if(f.length>0){const e=/* @__PURE__ */new Map;for(const t of i)null!=t.pointId&&e.set(String(t.pointId),[t.x,t.y]);for(const n of f){const r=n.datum?.source,i=n.datum?.target;if(null!=r&&null!=i){const o=e.get(String(r)),a=e.get(String(i));if(o&&a)if("fractional"===t.lineMode&&n.path.length>2){const e=n.path[0],t=n.path[n.path.length-1],r=[o[0]-e[0],o[1]-e[1]],i=[a[0]-t[0],a[1]-t[1]],s=[0];for(let e=1;e<n.path.length;e++)s.push(s[e-1]+Math.hypot(n.path[e][0]-n.path[e-1][0],n.path[e][1]-n.path[e-1][1]));const l=s[s.length-1];n.path=n.path.map((e,t)=>{const o=l>0?s[t]/l:t/(n.path.length-1);return[e[0]+r[0]*(1-o)+i[0]*o,e[1]+r[1]*(1-o)+i[1]*o]})}else n.path=[o,a]}}}return h}function dn(e,t,n,r,i,o){const a=t.x,s=t.y,l=o.width/2,c=o.height/2,u=Math.min(o.width,o.height)/2,d=(0,pf.scaleLinear)().domain([0,r]).range([0,u]);for(const o of e){if(o===t)continue;if(!o.datum)continue;const e=o.x,u=o.y,h=Math.atan2(u-s,e-a),f=Math.hypot(e-a,u-s),p=Number(n(o.datum)),m=isFinite(p)&&p>=0?r>0?d(p):0:f,g=l+Math.cos(h)*m,y=c+Math.sin(h)*m;o.x=e+(g-e)*i,o.y=u+(y-u)*i}return t.x=a+(l-a)*i,t.y=s+(c-s)*i,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}function hn(e,t,n,r,i){const o=Math.max(3,Math.min(8,.35*i.height)),a=Math.max(1,i.width-2*o),s=i.height/2,l=(0,pf.scaleLinear)().domain([0,r]).range([0,a]);t.x=o,t.y=s;const c=[];for(const i of e){if(i===t)continue;if(!i.datum){i.x=o,i.y=s;continue}const e=Number(n(i.datum)),a=o+(isFinite(e)&&e>=0&&r>0?l(e):0);i.x=a,i.y=s,c.push({node:i,x:a})}c.sort((e,t)=>e.x-t.x);const u=Math.max(0,Math.min(i.height/2-1,6));let d=0;for(;d<c.length;){let e=d+1;for(;e<c.length&&Math.abs(c[e].x-c[d].x)<3;)e++;const t=e-d;if(t>1&&u>0)for(let e=0;e<t;e++){const n=e-(t-1)/2,r=Math.min(2.5,2*u/Math.max(1,t-1));c[d+e].node.y=s+n*r}d=e}return{cx:o,cy:s,maxCost:r,availableRadius:a,layout:"strip"}}function fn(e,t,n,r){const i=e.push(t);return n&&n.push(r),i}function pn(e,t,n){if(!t||0===t.size)return;const r=/* @__PURE__ */new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const i=t.toArray();t.clear();for(let e=0;e<i.length;e++)r.has(e)||t.push(i[e])}function mn(e,t){const n={...e};for(const e of t)n[mf[e]]++;return n}function gn(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:mn(n,r)}}function yn(e){let t="preserve";const n=/* @__PURE__ */new Set;for(const r of e){const e=Object.prototype.hasOwnProperty.call(Rf,r)?Rf[r]:Cf;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}function bn({config:e,projection:t,path:n,areas:r,points:i,lines:o,layout:a}){const s=Kt(e.xAccessor,"lon"),l=Kt(e.yAccessor,"lat"),c=[],u=en(e),d=nn(e),h=tn(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=Ae();t.step&&r.step(t.step);const i=n(r())||"";i&&c.push({type:"geoarea",pathData:i,centroid:[a.width/2,a.height/2],bounds:[[0,0],[a.width,a.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth??.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const t of r){const r=n(t);if(!r)continue;const i=n.centroid(t),o=n.bounds(t),a=n.area(t);c.push({type:"geoarea",pathData:r,centroid:i,bounds:o,screenArea:a,style:Jt(e.areaStyle,t,u),datum:t,interactive:!0})}const f=Qt(e.lineDataAccessor);for(const n of o){const r=f(n);if(!r||r.length<2)continue;let i=[];if("geo"===e.lineType){const e=new Array(r.length);for(let t=0;t<r.length;t++)e[t]=[s(r[t]),l(r[t])];for(let n=0;n<e.length-1;n++){const r=e[n],o=e[n+1],a=ge(r,o)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=Re(r,o);for(let e=0;e<=s;e++){if(n>0&&0===e)continue;const r=t(l(e/s));null!=r&&i.push(r)}}}else for(let e=0;e<r.length;e++){const n=r[e],o=t([s(n),l(n)]);null!=o&&i.push(o)}if(i.length<2)continue;const o=Jt(e.lineStyle,n,d),u="number"==typeof o.strokeWidth?o.strokeWidth:1;2===r.length&&i.length>=2&&"arc"===e.flowStyle?i=on(i[0],i[i.length-1]):2===r.length&&i.length>=2&&"offset"===e.flowStyle&&(i="geo"===e.lineType?an(i,u):sn(i[0],i[i.length-1],0,0,u));const h=rn(i,a.width);if(h.length<=1)c.push({type:"line",path:i.length>=2?i:h[0]||i,style:o,datum:n});else for(const e of h)e.length<2||c.push({type:"line",path:e,style:{...o,_edgeFade:!0},datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,g=m>0?m*Math.PI/180:null,y=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-y[0],(b[1]??0)-y[1]];for(const[n,r]of i.entries()){const i=s(r),o=l(r);if(!Number.isFinite(i)||!Number.isFinite(o))continue;if(null!=g&&ge([i,o],v)>g)continue;const a=t([i,o]);if(!a||!Number.isFinite(a[0])||!Number.isFinite(a[1]))continue;const u=e.pointStyle?e.pointStyle(r):{...h},d={type:"point",x:a[0],y:a[1],r:u.r||4,style:u,datum:r,pointId:p?String(p(r)):void 0};vt(d,n),c.push(d)}return c}function vn(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&e<.5)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${String(e)}.`)}function xn(e){return{...e,fitPadding:vn(e.fitPadding)}}function wn(e){return"fitPadding"in e?{...e,fitPadding:vn(e.fitPadding)}:e}function kn(e){if(!e)return Df;for(const t of e)if(null==t||"object"!=typeof t)return e.filter(e=>null!=e&&"object"==typeof e);return e}function Sn(e,{storeRef:t,dirtyRef:n,scheduleRender:r,zoomTransformRef:i,containerRef:o,zoomBehaviorRef:a}){const s=(0,If.useCallback)(e=>{null!=e&&"object"==typeof e&&(t.current?.pushPoint(e),n.current=!0,r())},[t,n,r]),l=(0,If.useCallback)(e=>{const i=kn(e);0!==i.length&&(t.current?.pushMany(i),n.current=!0,r())},[t,n,r]),c=(0,If.useCallback)(e=>{null!=e&&"object"==typeof e&&(t.current?.pushLine(e),n.current=!0,r())},[t,n,r]),u=(0,If.useCallback)(e=>{const i=kn(e);0!==i.length&&(t.current?.pushManyLines(i),n.current=!0,r())},[t,n,r]),d=(0,If.useCallback)(()=>{t.current?.clear(),n.current=!0,r()},[t,n,r]);(0,If.useImperativeHandle)(e,()=>({push:s,pushMany:l,removePoint:e=>{const i=t.current?.removePoint(e)??[];return i.length>0&&(n.current=!0,r()),i},pushLine:c,pushManyLines:u,removeLine:e=>{const i=t.current?.removeLine(e)??[];return i.length>0&&(n.current=!0,r()),i},getLines:()=>t.current?.getLines()??[],clear:d,getProjection:()=>t.current?.scales?.projection??null,getGeoPath:()=>t.current?.scales?.geoPath??null,getCartogramLayout:()=>t.current?.cartogramLayout??null,getCustomLayout:()=>t.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>t.current?.lastCustomLayoutFailure??null,getZoom:()=>i.current.k,resetZoom:()=>{const e=o.current;e&&a.current&&(0,zf.select)(e).call(a.current.transform,Tf.zoomIdentity)},getData:()=>t.current?.getPoints()??[]}),[s,l,c,u,d,r,t,n,i,o,a])}function Mn(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function jn(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}function An(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}function Rn(e,t,n,r){const i=r.current,o=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!o&&e.hasActivePulsesAt(t),s=!(n||o||!a&&!i)&&e.refreshPulse(t);return r.current=a,{changed:s,pending:a}}function Cn(e,t){return"function"==typeof e?.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e?.addListener?.(t),()=>e?.removeListener?.(t))}function Ln(){const[e,t]=(0,Uf.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Uf.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Cn(e,e=>t(e.matches))},[]),e}function Pn(e,t=0,n=1/0,r=0){const i=Number.isFinite(t)?t:0,o=Number.isFinite(n)?Math.max(i,n):1/0,a=Number.isFinite(e)?Math.floor(e):i,s=Math.max(i,Math.min(o,a));return r>0&&Number.isFinite(r)?Math.max(i,Math.min(o,Math.round(s/r)*r)):s}function Nn(e,t,n,r={}){const i=(0,Yf.useRef)(null),[o,a]=(0,Yf.useState)(null);Xf(()=>{if(!t&&!n)return;const e=i.current;if(!e||"undefined"==typeof ResizeObserver)return;const o=(e,t)=>({w:Pn(e,r.minWidth,r.maxWidth,r.widthStep),h:Pn(t,r.minHeight,r.maxHeight,r.heightStep)}),s=e.getBoundingClientRect();(s.width>0||s.height>0)&&a(o(s.width,s.height));const l=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect,r=o(e,n);a(e=>e&&e.w===r.w&&e.h===r.h?e:r)}});return l.observe(e),()=>l.disconnect()},[t,n,r.minWidth,r.maxWidth,r.widthStep,r.minHeight,r.maxHeight,r.heightStep]);const s=[t&&o?o.w:e[0],n&&o?o.h:e[1]];return[i,s]}function En(e){return 0!==e.fontfaces?.length}function In(e){const t="undefined"==typeof document?void 0:document.fonts;if(!t||"function"!=typeof t.addEventListener)return()=>{};const n=t=>{En(t)&&e()};return t.addEventListener("loadingdone",n),()=>t.removeEventListener("loadingdone",n)}function zn(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const i=n.slice(0,r).trim(),o=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:o||void 0}:null}function Tn(){if(Qf)return;if("undefined"==typeof window||"undefined"==typeof document)return;Qf=!0;const e=e=>{if(!e?.includes("--"))return"";const t=document.createElement("span").style;return t.cssText=e,Array.from(t).filter(e=>e.startsWith("--")).sort().map(e=>`${e}:${t.getPropertyValue(e)}!${t.getPropertyPriority(e)}`).join(";")},t=(t,n)=>{const r=t.target;if(!(r instanceof Element))return!1;if(r===n||r.contains(n))return!0;if(!n.contains(r))return!1;const i="CANVAS"===r.tagName;return!(!i&&!r.querySelector("canvas")||i&&"style"===t.attributeName&&e(t.oldValue)===e(r.getAttribute("style")))},n=e=>{const n=[];for(const r of rp){const i=r.getElement();i&&(!e||e.some(e=>t(e,i)))&&n.push(r)}if(!e||0!==n.length){Kf++;for(const e of n)e.listener()}};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Jf=new MutationObserver(e=>{n(e)})).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme","data-semiotic-theme-mode"],attributeOldValue:!0,subtree:!0}),"function"==typeof window.matchMedia)try{ep=window.matchMedia("(prefers-color-scheme: dark)"),tp=()=>n(),"function"==typeof ep.addEventListener?ep.addEventListener("change",tp):"function"==typeof ep.addListener&&ep.addListener(tp)}catch{}np=In(()=>n())}function Dn(e,t){Tn();const n={getElement:e,listener:t};return rp.add(n),()=>{rp.delete(n)&&0===rp.size&&(Jf?.disconnect(),Jf=null,ep&&tp&&("function"==typeof ep.removeEventListener?ep.removeEventListener("change",tp):"function"==typeof ep.removeListener&&ep.removeListener(tp)),ep=null,tp=null,np?.(),np=null,Qf=!1)}}function $n(e,t){if(!t)return t;const n=zn(t);if(!n)return t;const r=()=>n.fallback?$n(e,n.fallback):t,i=e.canvas;if(!i)return r();let o=Zf.get(i);o&&o.version===Kf||(o={version:Kf,map:/* @__PURE__ */new Map},Zf.set(i,o));const a=o.map.get(t);if(void 0!==a)return a;const s=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||t;return o.map.set(t,s),s}function On(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function Fn(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}function _n(e,t){const n=e();return Number.isFinite(n)?n:t}function Wn(e,t){const n=t?36:0;return e.top>=n?e:{...e,top:n}}function Bn(e){let t=6;for(let n=1;n<e.length;n++){const r=Math.abs(e[n]-e[n-1]);if(r>0&&Number.isFinite(r)){const i=Math.max(Math.abs(e[n]),Math.abs(e[n-1]));t=Math.max(t,Math.ceil(Math.log10(i/r))+1)}}const n=Math.min(17,t);return e=>Number.isInteger(e)?String(e):String(Number(e.toPrecision(n)))}function Hn(...e){let t;for(const n of e)n&&(t=qn(t)&&qn(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}function qn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Gn(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Vn(e,t,n,r,i=8){const o="left"===r||"right"===r,a=r,s="left"===r?"right":"right"===r?"left":"top"===r?"bottom":"top",l=Math.max(0,(o?n[0]:n[1])-i),c=Math.max(t[a],l-e[s]);e[a]>c&&(e[a]=c)}function Un(e){return Math.ceil(7*e.length)}function Yn(e,t){if(qn(e)){const n=rr(t);let r=100;for(const t of e.legendGroups){t.label&&(r=Math.max(r,Un(t.label)));for(const e of t.items)r=Math.max(r,n.swatchSize+n.labelGap+Un(e.label))}return r}if(Gn(e)){const{gradient:t}=e,n=t.format||Bn(t.domain),r=Math.max(Un(n(t.domain[0])),Un(n(t.domain[1]))),i=t.label?Un(t.label):0;return Math.max(100,19+r,i)}return 100}function Xn(e){return(qn(e)||Gn(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):10}function Zn(e,t){return null!=e?.sideGutter?Math.max(0,e.sideGutter):t?.hasAxis?t.hasAxisLabel?sp:ap:0}function Kn(e){return Math.max(0,e?.edgeGutter??3)}function Qn(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?64:46:22:0}function Jn(e,t,n){if(Gn(e))return e.gradient.label?46:26;if(!qn(e))return 20;const r=rr(n),i=Math.max(1,n?.maxWidth??t);let o=r.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const o of t.items){const t=r.swatchSize+r.labelGap+Un(o.label),a=0===n?t:n+r.itemGap+t;n>0&&a>i?(e+=1,n=t):n=a}t.items.length>0&&(e+=1),o=Math.max(o,e*r.rowHeight,t.label?Un(t.label):0)}return o+(e.legendGroups.length>1?16:0)}function er(e,t,n){return Yn(e,t)+Xn(e)+Zn(t,n)+Kn(t)}function tr(e,t){const{legend:n}=t;if(!n)return;const r=t.position??"right",i=Jn(n,Math.max(1,t.size[0]-e.left-e.right),t.legendLayout)+Xn(n)+Qn("bottom"===r?t.axisChrome:"top"===r?t.axisChrome?.topAxis:void 0,t.legendLayout)+("top"===r&&t.hasTitle?24:0),o=Math.max(t.minimumMargin??0,"top"===r?t.hasTitle?58:34:0);"right"===r?e.right=Math.max(e.right,o,er(n,t.legendLayout,t.axisChrome?.rightAxis)):"left"===r?e.left=Math.max(e.left,o,er(n,t.legendLayout,t.axisChrome?.leftAxis)):"top"===r?e.top=Math.max(e.top,o,i):e.bottom=Math.max(e.bottom,o,i)}function nr(e,t){const n=t.position??"right",r="top"===n||"bottom"===n,i=Math.max(0,t.totalWidth-t.margin.left-t.margin.right),o=Math.max(1,r?t.legendLayout?.maxWidth??i:t.reservedWidth??Yn(e,t.legendLayout)),a=Xn(e),s=Zn(t.legendLayout,"left"===n?t.axisChrome?.leftAxis:t.axisChrome?.rightAxis),l=Kn(t.legendLayout),c=Jn(e,i,t.legendLayout),u=Qn(t.axisChrome,t.legendLayout),d=Qn(t.axisChrome?.topAxis,t.legendLayout);if("left"===n)return{x:Math.max(l,t.margin.left-s-o-a),y:t.margin.top,width:o,height:c};if("top"===n)return{x:t.margin.left,y:t.margin.top-d-a-c,width:o,height:c};if("bottom"===n){const e=t.totalHeight-t.margin.bottom;return{x:t.margin.left,y:Math.max(e+a,Math.min(e+u+a,t.totalHeight-c)),width:o,height:c}}return{x:Math.min(t.totalWidth-o-l,t.totalWidth-t.margin.right+s+a),y:t.margin.top,width:o,height:c}}function rr(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function ir(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const i=n;let o;n+=8,e&&(n+=16,o=n,n+=8);const a=n;return n+=r*t+8,{lineY:i,labelY:o,itemsY:a,endY:n}})}function or(e,t,n=!1){const r={...e};for(const e of t??[])!1!==e.visible||"top"===e.orient&&n||(r[e.orient]=0);return r}function ar(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function sr(e){const t=Ln(),n=(0,qf.useRef)(t);n.current=t;const[r,i]=Nn(e.sizeProp,e.responsiveWidth,e.responsiveHeight),o=i[0],a=i[1],s=(0,qf.useMemo)(()=>[o,a],[o,a]),l=Boolean(e.title),c=(0,qf.useMemo)(()=>{const t=Wn({...e.marginDefault,...e.userMargin},l);if(e.legend&&!e.legendMarginReserved){const n={...t},r=e.legendPosition??"right";tr(t,{legend:e.legend,position:r,size:s,hasTitle:l,legendLayout:e.legendLayout,axisChrome:e.axisChrome}),Vn(t,n,s,r)}return t},[e.marginDefault,e.userMargin,e.legend,e.legendPosition,e.legendLayout,e.axisChrome,e.legendMarginReserved,l,s]),u=Math.max(1,i[0]-c.left-c.right),d=Math.max(1,i[1]-c.top-c.bottom),h=ar(e.foregroundGraphics,i,c),f=ar(e.backgroundGraphics,i,c),p=(0,Vf.useThemeSelector)(e=>e.theme),{transition:m,introEnabled:g}=jt(e.animate,e.transitionProp),y=`semiotic-table-${Hf.useId()}`,b=(0,qf.useRef)(null);if(!b.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new op({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const v=b.current;v.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,qf.useRef)(null),w=(0,qf.useRef)(e.frameScheduler??cp);w.current=e.frameScheduler??cp;const k=(0,qf.useRef)(null),S=(0,qf.useRef)(!1),M=(0,qf.useRef)(()=>{}),j=(0,qf.useCallback)(()=>{if(null!==x.current||S.current)return;const e=w.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(S.current=!0),x.current=null,k.current=null;try{e?M.current():(0,Gf.flushSync)(M.current)}finally{e&&(S.current=!1)}});n=!0,t||(x.current=r,k.current=e)},[]),A=(0,qf.useCallback)(()=>{null!==x.current&&((k.current??w.current).cancelAnimationFrame(x.current),x.current=null,k.current=null)},[]),R=(0,qf.useCallback)(()=>{null!==x.current&&(A(),M.current())},[A]);lp(()=>{v.setPaused(!0===e.paused)},[v,e.paused]),(0,qf.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void v.setVisible(!0);const t=()=>v.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[v,e.suspendWhenHidden]),(0,qf.useEffect)(()=>()=>{A()},[A]);const C=(0,qf.useRef)(()=>{}),L=(0,qf.useRef)(()=>{}),P=(0,qf.useRef)({inside:!1,clientX:0,clientY:0,pointerType:void 0}),N=(0,qf.useRef)(null),E=(0,qf.useRef)(null),I=(0,qf.useRef)(null),z=(0,qf.useCallback)(()=>{const e=N.current;N.current=null,e&&C.current(e)},[]),T=(0,qf.useCallback)(e=>{const t=P.current;if(t.inside=!0,t.clientX=e.clientX,t.clientY=e.clientY,t.pointerType=e.pointerType,N.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===E.current){const e=w.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,E.current=null,I.current=null,z()});t||(E.current=n,I.current=e)}},[z]),D=(0,qf.useCallback)(()=>{null!==E.current&&((I.current??w.current).cancelAnimationFrame(E.current),E.current=null,I.current=null),z()},[z]),$=(0,qf.useCallback)(()=>{P.current.inside=!1,N.current=null,D(),L.current()},[D]);(0,qf.useEffect)(()=>{if("undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&P.current.inside&&$()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[$]),(0,qf.useEffect)(()=>()=>{N.current=null,null!==E.current&&((I.current??w.current).cancelAnimationFrame(E.current),E.current=null,I.current=null)},[]);const O=e.themeDirtyRef,F=(0,qf.useRef)(!1);return lp(()=>{if(!O)return;const t=!F.current;F.current=!0,t&&e.skipInitialThemeInvalidation||(Kf++,O.current=!0,j())},[p,e.skipInitialThemeInvalidation,j,O]),(0,qf.useEffect)(()=>{if(O)return Dn(()=>r.current,()=>{O.current=!0,j()})},[r,j,O]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:i,margin:c,adjustedWidth:u,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:p,transition:m,introEnabled:g,tableId:y,frameRuntime:v,rafRef:x,renderFnRef:M,scheduleRender:j,cancelRender:A,flushRender:R,hoverHandlerRef:C,hoverLeaveRef:L,onPointerMove:T,flushPointerMove:D,onPointerLeave:$,pointerStateRef:P}}function lr(e,t,n,r){(0,up.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}function cr(e,t,n,r){const i=(0,up.useRef)(null);(0,up.useEffect)(()=>{const o=e.current;if(!o)return;const a=t??null;i.current!==a&&(i.current=a,o.setLayoutSelection(a),o.hasCustomRestyle?o.restyleScene(a):n.current=!0,r())},[t,r,e,n])}function ur(e,t="dark"===e.mode){if(!e.accessibility)return e;let n=e;return e.accessibility.colorBlindSafe&&(n={...n,colors:{...n.colors,categorical:dp}}),e.accessibility.highContrast&&(n={...n,colors:{...n.colors,text:t?"#ffffff":"#000000",textSecondary:t?"#cccccc":"#333333",grid:t?"#666666":"#999999",border:t?"#888888":"#000000"}}),n}function dr(e){let t=e.replace(/^#/,"");/^[a-f\d]{3}$/i.test(t)&&(t=t.split("").map(e=>e+e).join(""));const n=t.match(/^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!n)return null;const[r,i,o]=[parseInt(n[1],16)/255,parseInt(n[2],16)/255,parseInt(n[3],16)/255],a=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return.2126*a(r)+.7152*a(i)+.0722*a(o)}function hr(e,t){const n=dr(e),r=dr(t);return null===n||null===r?null:(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function fr(e){return function e(t){return Array.isArray(t)?t.map(e):null!==t&&"object"==typeof t?Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):t}(e)}function pr(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function mr(e){return ur(e,"dark"===e.mode||"auto"===e.mode&&(hr(e.colors.background,"#ffffff")??1)>Math.sqrt(21))}function gr(e,t){if("light"===t)return fr(hp);if("dark"===t)return fr(fp);if("high-contrast"===t)return fr(pp);if("string"==typeof t)return"undefined"!=typeof console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;const n=t.mode&&"auto"!==t.mode?"dark"===t.mode?fp:hp:e;return fr(mr({...n,...t,colors:{...n.colors,...t.colors||{}},typography:{...n.typography,...t.typography||{}},aesthetics:(r=n.aesthetics,t.aesthetics?{...r,...t.aesthetics,weights:{...r?.weights,...t.aesthetics.weights},thresholds:{...r?.thresholds,...t.aesthetics.thresholds},rationales:{...r?.rationales,...t.aesthetics.rationales}}:r)}));var r}function yr(e,t){const n=e?.state??(e?.settling?"settling":void 0);if("live"===n)return yp;if("stopped"===n||"failed"===n||"stale"===n)return{alpha:e?.dimOpacity??.5,band:"stale",isStale:!0};if("settling"===n)return{alpha:.85,band:"aging",isStale:!1};if(!(e&&t>0))return yp;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,i=e.graded;if(i){const e="object"==typeof i?i:{},n=At(t,r,e.thresholds);return{alpha:{...gp,...e.opacities??{}}[n],band:n,isStale:"fresh"!==n}}return t>r?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:yp}function br(e,t,n,r,i,o,a){const s=(0,mp.useRef)("fresh");(0,mp.useEffect)(()=>{if(!e)return void(s.current="fresh");const l=setInterval(()=>{const l=t.current;if(!l||0===l.lastIngestTime)return;const c=yr(e,i()-l.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&a(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[e,o,r,i,t,a,n])}function vr(e,t,n){return t||(n?"settling":e?"stale":"live")}function xr({isStale:e,position:t,state:n,settling:r}){const i=vr(e,n,r),o=vp[i]??vp.live,a=Object.hasOwn(vp,i)?i.toUpperCase():"LIVE";/* @__PURE__ */ /* @__PURE__ */
|
|
19
|
-
return(0,
|
|
18
|
+
/* @__PURE__ */(0,Uu.jsx)(f,{remaining:g,onClick:e=>{r(e.currentTarget,m,Math.min(m+pu,c.length),c.length),s(e=>e+pu)},kind:"row"})]})}function m(e,t){xd(()=>{t&&(e.current=t)},[e,t])}function g(e){return e>1?Ad:e<-1?-Ad:Math.asin(e)}function y(e){return(e=Fd(e/2))*e}function b(){}function v(e,t){e&&Hd.hasOwnProperty(e.type)&&Hd[e.type](e,t)}function x(e,t,n){var r,i=-1,o=e.length-n;for(t.lineStart();++i<o;)r=e[i],t.point(r[0],r[1],r[2]);t.lineEnd()}function w(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)x(e[n],t,1);t.polygonEnd()}function k(e,t){e&&Wd.hasOwnProperty(e.type)?Wd[e.type](e,t):v(e,t)}function S(){Vd.point=j}function M(){A(nd,rd)}function j(e,t){Vd.point=A,nd=e,rd=t,id=e*=Nd,od=Td(t=(t*=Nd)/2+Rd),ad=Fd(t)}function A(e,t){var n=(e*=Nd)-id,r=n>=0?1:-1,i=r*n,o=Td(t=(t*=Nd)/2+Rd),a=Fd(t),s=ad*a,l=od*o+s*Td(i),c=s*r*Fd(i);qd.add(Id(c,l)),id=e,od=o,ad=a}function R(e){return[Id(e[1],e[0]),g(e[2])]}function C(e){var t=e[0],n=e[1],r=Td(n);return[r*Td(t),r*Fd(t),Fd(n)]}function L(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function N(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function P(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function E(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function I(e){var t=_d(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function T(e,t){gd.push(yd=[sd=e,cd=e]),t<ld&&(ld=t),t>ud&&(ud=t)}function z(e,t){var n=C([e*Nd,t*Nd]);if(pd){var r=N(pd,n),i=N([r[1],-r[0],0],r);I(i),i=R(i);var o,a=e-dd,s=a>0?1:-1,l=i[0]*Ld*s,c=Pd(a)>180;c^(s*dd<l&&l<s*e)?(o=i[1]*Ld)>ud&&(ud=o):c^(s*dd<(l=(l+360)%360-180)&&l<s*e)?(o=-i[1]*Ld)<ld&&(ld=o):(t<ld&&(ld=t),t>ud&&(ud=t)),c?e<dd?B(sd,e)>B(sd,cd)&&(cd=e):B(e,cd)>B(sd,cd)&&(sd=e):cd>=sd?(e<sd&&(sd=e),e>cd&&(cd=e)):e>dd?B(sd,e)>B(sd,cd)&&(cd=e):B(e,cd)>B(sd,cd)&&(sd=e)}else gd.push(yd=[sd=e,cd=e]);t<ld&&(ld=t),t>ud&&(ud=t),pd=n,dd=e}function D(){Yd.point=z}function $(){yd[0]=sd,yd[1]=cd,Yd.point=T,pd=null}function F(e,t){if(pd){var n=e-dd;md.add(Pd(n)>180?n+(n>0?360:-360):n)}else hd=e,fd=t;Vd.point(e,t),z(e,t)}function O(){Vd.lineStart()}function _(){F(hd,fd),Vd.lineEnd(),Pd(md)>Sd&&(sd=-(cd=180)),yd[0]=sd,yd[1]=cd,pd=null}function B(e,t){return(t-=e)<0?t+360:t}function W(e,t){return e[0]-t[0]}function H(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}function q(e){var t,n,r,i,o,a,s;if(ud=cd=-(sd=ld=1/0),gd=[],k(e,Yd),n=gd.length){for(gd.sort(W),t=1,o=[r=gd[0]];t<n;++t)H(r,(i=gd[t])[0])||H(r,i[1])?(B(r[0],i[1])>B(r[0],r[1])&&(r[1]=i[1]),B(i[0],r[1])>B(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];t<=n;r=i,++t)i=o[t],(s=B(r[1],i[0]))>a&&(a=s,sd=i[0],cd=r[1])}return gd=yd=null,sd===1/0||ld===1/0?[[NaN,NaN],[NaN,NaN]]:[[sd,ld],[cd,ud]]}function G(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return(n=t.invert(n,r))&&e.invert(n[0],n[1])}),n}function V(e,t){return Pd(e)>jd&&(e-=Math.round(e/Cd)*Cd),[e,t]}function U(e,t,n){return(e%=Cd)?t||n?G(X(e),Z(t,n)):X(e):t||n?Z(t,n):V}function Y(e){return function(t,n){return Pd(t+=e)>jd&&(t-=Math.round(t/Cd)*Cd),[t,n]}}function X(e){var t=Y(e);return t.invert=Y(-e),t}function Z(e,t){function n(e,t){var n=Td(t),s=Td(e)*n,l=Fd(e)*n,c=Fd(t),u=c*r+s*i;return[Id(l*o-u*a,s*r-c*i),g(u*o+l*a)]}var r=Td(e),i=Fd(e),o=Td(t),a=Fd(t);return n.invert=function(e,t){var n=Td(t),s=Td(e)*n,l=Fd(e)*n,c=Fd(t),u=c*o-l*a;return[Id(l*o+c*a,s*r+u*i),g(u*r-s*i)]},n}function K(e){function t(t){return(t=e(t[0]*Nd,t[1]*Nd))[0]*=Ld,t[1]*=Ld,t}return e=U(e[0]*Nd,e[1]*Nd,e.length>2?e[2]*Nd:0),t.invert=function(t){return(t=e.invert(t[0]*Nd,t[1]*Nd))[0]*=Ld,t[1]*=Ld,t},t}function Q(e,t,n,r,i,o){if(n){var a=Td(t),s=Fd(t),l=r*n;null==i?(i=t+r*Cd,o=t-l/2):(i=J(a,i),o=J(a,o),(r>0?i<o:i>o)&&(i+=r*Cd));for(var c,u=i;r>0?u>o:u<o;u-=l)c=R([a,-s*Td(u),-s*Fd(u)]),e.point(c[0],c[1])}}function J(e,t){(t=C(t))[0]-=e,I(t);var n,r=(n=-t[1])>1?0:n<-1?jd:Math.acos(n);return((-t[2]<0?-r:r)+Cd-Sd)%Cd}function ee(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:b,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function te(e,t){return Pd(e[0]-t[0])<Sd&&Pd(e[1]-t[1])<Sd}function ne(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function re(e,t,n,r,i){var o,a,s=[],l=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n,r=e[0],a=e[t];if(te(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<t;++o)i.point((r=e[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new ne(r,e,null,!0)),l.push(n.o=new ne(r,null,n,!1)),s.push(n=new ne(a,e,null,!1)),l.push(n.o=new ne(a,null,n,!0))}}),s.length){for(l.sort(t),ie(s),ie(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var c,u,d=s[0];;){for(var h=d,f=!0;h.v;)if((h=h.n)===d)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(f)for(o=0,a=c.length;o<a;++o)i.point((u=c[o])[0],u[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(f)for(c=h.p.z,o=c.length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,f=!f}while(!h.v);i.lineEnd()}}}function ie(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r<t;)i.n=n=e[r],n.p=i,i=n;i.n=n=e[0],n.p=i}}function oe(e){return Pd(e[0])<=jd?e[0]:Od(e[0])*((Pd(e[0])+jd)%Cd-jd)}function ae(e,t){var n=oe(t),r=t[1],i=Fd(r),o=[Fd(n),-Td(n),0],a=0,s=0,l=new sh.Adder;1===i?r=Ad+Sd:-1===i&&(r=-Ad-Sd);for(var c=0,u=e.length;c<u;++c)if(h=(d=e[c]).length)for(var d,h,f=d[h-1],p=oe(f),m=f[1]/2+Rd,y=Fd(m),b=Td(m),v=0;v<h;++v,p=w,y=S,b=M,f=x){var x=d[v],w=oe(x),k=x[1]/2+Rd,S=Fd(k),M=Td(k),j=w-p,A=j>=0?1:-1,R=A*j,L=R>jd,P=y*S;if(l.add(Id(P*A*Fd(R),b*M+P*Td(R))),a+=L?j+A*Cd:j,L^p>=n^w>=n){var E=N(C(f),C(x));I(E);var T=N(o,E);I(T);var z=(L^j>=0?-1:1)*g(T[2]);(r>z||r===z&&(E[0]||E[1]))&&(s+=L^j>=0?1:-1)}}return(a<-Sd||a<Sd&&l<-1e-12)^1&s}function se(e,t,n,r){return function(i){function o(t,n){e(t,n)&&i.point(t,n)}function a(e,t){m.point(e,t)}function s(){v.point=a,m.lineStart()}function l(){v.point=o,m.lineEnd()}function c(e,t){p.push([e,t]),y.point(e,t)}function u(){y.lineStart(),p=[]}function d(){c(p[0][0],p[0][1]),y.lineEnd();var e,t,n,r,o=y.clean(),a=g.result(),s=a.length;if(p.pop(),h.push(p),p=null,s)if(1&o){if((t=(n=a[0]).length-1)>0){for(b||(i.polygonStart(),b=!0),i.lineStart(),e=0;e<t;++e)i.point((r=n[e])[0],r[1]);i.lineEnd()}}else s>1&&2&o&&a.push(a.pop().concat(a.shift())),f.push(a.filter(le))}var h,f,p,m=t(i),g=ee(),y=t(g),b=!1,v={point:o,lineStart:s,lineEnd:l,polygonStart:function(){v.point=c,v.lineStart=u,v.lineEnd=d,f=[],h=[]},polygonEnd:function(){v.point=o,v.lineStart=s,v.lineEnd=l,f=(0,lh.merge)(f);var e=ae(h,r);f.length?(b||(i.polygonStart(),b=!0),re(f,ce,e,n,i)):e&&(b||(i.polygonStart(),b=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),f=h=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};return v}}function le(e){return e.length>1}function ce(e,t){return((e=e.x)[0]<0?e[1]-Ad-Sd:Ad-e[1])-((t=t.x)[0]<0?t[1]-Ad-Sd:Ad-t[1])}function ue(e,t,n,r){var i,o,a=Fd(e-n);return Pd(a)>Sd?Ed((Fd(t)*(o=Td(r))*Fd(n)-Fd(r)*(i=Td(t))*Fd(e))/(i*o*a)):(t+r)/2}function de(e){function t(e,t){return Td(e)*Td(t)>i}function n(e,t,n){var r=[1,0,0],o=N(C(e),C(t)),a=L(o,o),s=o[0],l=a-s*s;if(!l)return!n&&e;var c=i*a/l,u=-i*s/l,d=N(r,o),h=E(r,c);P(h,E(o,u));var f=d,p=L(h,f),m=L(f,f),g=p*p-m*(L(h,h)-1);if(!(g<0)){var y=_d(g),b=E(f,(-p-y)/m);if(P(b,h),b=R(b),!n)return b;var v,x=e[0],w=t[0],k=e[1],S=t[1];w<x&&(v=x,x=w,w=v);var M=w-x,j=Pd(M-jd)<Sd;if(!j&&S<k&&(v=k,k=S,S=v),j||M<Sd?j?k+S>0^b[1]<(Pd(b[0]-x)<Sd?k:S):k<=b[1]&&b[1]<=S:M>jd^(x<=b[0]&&b[0]<=w)){var A=E(f,(-p+y)/m);return P(A,h),[b,R(A)]}}}function r(t,n){var r=a?e:jd-e,i=0;return t<-r?i|=1:t>r&&(i|=2),n<-r?i|=4:n>r&&(i|=8),i}var i=Td(e),o=2*Nd,a=i>0,s=Pd(i)>Sd;return se(t,function(e){var i,o,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(d,h){var f,p=[d,h],m=t(d,h),g=a?m?0:r(d,h):m?r(d+(d<0?jd:-jd),h):0;if(!i&&(c=l=m)&&e.lineStart(),m!==l&&(!(f=n(i,p))||te(i,f)||te(p,f))&&(p[2]=1),m!==l)u=0,m?(e.lineStart(),f=n(p,i),e.point(f[0],f[1])):(f=n(i,p),e.point(f[0],f[1],2),e.lineEnd()),i=f;else if(s&&i&&a^m){var y;g&o||!(y=n(p,i,!0))||(u=0,a?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||i&&te(i,p)||e.point(p[0],p[1]),i=p,l=m,o=g},lineEnd:function(){l&&e.lineEnd(),i=null},clean:function(){return u|(c&&l)<<1}}},function(t,n,r,i){Q(i,e,o,r,t,n)},a?[0,-e]:[-jd,e-jd])}function he(e,t,n,r,i,o){var a,s=e[0],l=e[1],c=0,u=1,d=t[0]-s,h=t[1]-l;if(a=n-s,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<u&&(u=a)}else if(d>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<u&&(u=a)}if(a=r-l,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<u&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<u&&(u=a)}return c>0&&(e[0]=s+c*d,e[1]=l+c*h),u<1&&(t[0]=s+u*d,t[1]=l+u*h),!0}}}}}function fe(e,t,n,r){function i(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function o(i,o,s,c){var u=0,d=0;if(null==i||(u=a(i,s))!==(d=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?e:n,u>1?r:t)}while((u=(u+s+4)%4)!==d);else c.point(o[0],o[1])}function a(r,i){return Pd(r[0]-e)<Sd?i>0?0:3:Pd(r[0]-n)<Sd?i>0?2:1:Pd(r[1]-t)<Sd?i>0?1:0:i>0?3:2}function s(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){function l(e,t){i(e,t)&&k.point(e,t)}function c(){for(var t=0,n=0,i=h.length;n<i;++n)for(var o,a,s=h[n],l=1,c=s.length,u=s[0],d=u[0],f=u[1];l<c;++l)o=d,a=f,d=(u=s[l])[0],f=u[1],a<=r?f>r&&(d-o)*(r-a)>(f-a)*(e-o)&&++t:f<=r&&(d-o)*(r-a)<(f-a)*(e-o)&&--t;return t}function u(o,a){var s=i(o,a);if(h&&f.push([o,a]),x)p=o,m=a,g=s,x=!1,s&&(k.lineStart(),k.point(o,a));else if(s&&v)k.point(o,a);else{var l=[y=Math.max(hh,Math.min(dh,y)),b=Math.max(hh,Math.min(dh,b))],c=[o=Math.max(hh,Math.min(dh,o)),a=Math.max(hh,Math.min(dh,a))];he(l,c,e,t,n,r)?(v||(k.lineStart(),k.point(l[0],l[1])),k.point(c[0],c[1]),s||k.lineEnd(),w=!1):s&&(k.lineStart(),k.point(o,a),w=!1)}y=o,b=a,v=s}var d,h,f,p,m,g,y,b,v,x,w,k=a,S=ee(),M={point:l,lineStart:function(){M.point=u,h&&h.push(f=[]),x=!0,v=!1,y=b=NaN},lineEnd:function(){d&&(u(p,m),g&&v&&S.rejoin(),d.push(S.result())),M.point=l,v&&k.lineEnd()},polygonStart:function(){k=S,d=[],h=[],w=!0},polygonEnd:function(){var e=c(),t=w&&e,n=(d=(0,uh.merge)(d)).length;(t||n)&&(a.polygonStart(),t&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),n&&re(d,s,e,o,a),a.polygonEnd()),k=a,d=h=f=null}};return M}}function pe(){ph.point=ph.lineEnd=b}function me(e,t){Zd=e*=Nd,Kd=Fd(t*=Nd),Qd=Td(t),ph.point=ge}function ge(e,t){e*=Nd;var n=Fd(t*=Nd),r=Td(t),i=Pd(e-Zd),o=Td(i),a=r*Fd(i),s=Qd*n-Kd*r*o,l=Kd*n+Qd*r*o;Xd.add(Id(_d(a*a+s*s),l)),Zd=e,Kd=n,Qd=r}function ye(e,t){return mh[0]=e,mh[1]=t,n=gh,Xd=new fh.Adder,k(n,ph),+Xd;var n}function be(e,t){return!(!e||!bh.hasOwnProperty(e.type))&&bh[e.type](e,t)}function ve(e,t){return 0===ye(e,t)}function xe(e,t){for(var n,r,i,o=0,a=e.length;o<a;o++){if(0===(r=ye(e[o],t)))return!0;if(o>0&&(i=ye(e[o],e[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<Md*i)return!0;n=r}return!1}function we(e,t){return!!ae(e.map(ke),Se(t))}function ke(e){return(e=e.map(Se)).pop(),e}function Se(e){return[e[0]*Nd,e[1]*Nd]}function Me(e,t){return(e&&yh.hasOwnProperty(e.type)?yh[e.type]:be)(e,t)}function je(e,t,n){var r=(0,vh.range)(e,t-Sd,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function Ae(e,t,n){var r=(0,vh.range)(e,t-Sd,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function Re(){function e(){return{type:"MultiLineString",coordinates:t()}}function t(){return(0,vh.range)(zd(o/g)*g,i,g).map(h).concat((0,vh.range)(zd(c/y)*y,l,y).map(f)).concat((0,vh.range)(zd(r/p)*p,n,p).filter(function(e){return Pd(e%g)>Sd}).map(u)).concat((0,vh.range)(zd(s/m)*m,a,m).filter(function(e){return Pd(e%y)>Sd}).map(d))}var n,r,i,o,a,s,l,c,u,d,h,f,p=10,m=p,g=90,y=360,b=2.5;return e.lines=function(){return t().map(function(e){return{type:"LineString",coordinates:e}})},e.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(f(l).slice(1),h(i).reverse().slice(1),f(c).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.extentMajor(t).extentMinor(t):e.extentMinor()},e.extentMajor=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],c=+t[0][1],l=+t[1][1],o>i&&(t=o,o=i,i=t),c>l&&(t=c,c=l,l=t),e.precision(b)):[[o,c],[i,l]]},e.extentMinor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),e.precision(b)):[[r,s],[n,a]]},e.step=function(t){return arguments.length?e.stepMajor(t).stepMinor(t):e.stepMinor()},e.stepMajor=function(t){return arguments.length?(g=+t[0],y=+t[1],e):[g,y]},e.stepMinor=function(t){return arguments.length?(p=+t[0],m=+t[1],e):[p,m]},e.precision=function(t){return arguments.length?(b=+t,u=je(s,a,90),d=Ae(r,n,b),h=je(c,l,90),f=Ae(o,i,b),e):b},e.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}function Ce(e,t){var n=e[0]*Nd,r=e[1]*Nd,i=t[0]*Nd,o=t[1]*Nd,a=Td(r),s=Fd(r),l=Td(o),c=Fd(o),u=a*Td(n),d=a*Fd(n),h=l*Td(i),f=l*Fd(i),p=2*g(_d(y(o-r)+a*l*y(i-n))),m=Fd(p),b=p?function(e){var t=Fd(e*=p)/m,n=Fd(p-e)/m,r=n*u+t*h,i=n*d+t*f,o=n*s+t*c;return[Id(i,r)*Ld,Id(o,_d(r*r+i*i))*Ld]}:function(){return[n*Ld,r*Ld]};return b.distance=p,b}function Le(){Mh.point=Ne}function Ne(e,t){Mh.point=Pe,Jd=th=e,eh=nh=t}function Pe(e,t){Sh.add(nh*e-th*t),th=e,nh=t}function Ee(){Pe(Jd,eh)}function Ie(e,t){Ph+=e,Eh+=t,++Ih}function Te(){_h.point=ze}function ze(e,t){_h.point=De,Ie(oh=e,ah=t)}function De(e,t){var n=e-oh,r=t-ah,i=_d(n*n+r*r);Th+=i*(oh+e)/2,zh+=i*(ah+t)/2,Dh+=i,Ie(oh=e,ah=t)}function $e(){_h.point=Ie}function Fe(){_h.point=_e}function Oe(){Be(rh,ih)}function _e(e,t){_h.point=Be,Ie(rh=oh=e,ih=ah=t)}function Be(e,t){var n=e-oh,r=t-ah,i=_d(n*n+r*r);Th+=i*(oh+e)/2,zh+=i*(ah+t)/2,Dh+=i,$h+=(i=ah*e-oh*t)*(oh+e),Fh+=i*(ah+t),Oh+=3*i,Ie(oh=e,ah=t)}function We(e){this._context=e}function He(e,t){Jh.point=qe,Hh=Gh=e,qh=Vh=t}function qe(e,t){Gh-=e,Vh-=t,Qh.add(_d(Gh*Gh+Vh*Vh)),Gh=e,Vh=t}function Ge(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Ve(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Ge;if(t!==Uh){const e=10**t;Uh=t,Yh=function(t){let n=1;this._+=t[0];for(const r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return Yh}function Ue(e,t){function n(e){return e&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),k(e,r(i))),i.result()}let r,i,o=3,a=4.5;return n.area=function(e){return k(e,r(jh)),jh.result()},n.measure=function(e){return k(e,r(ef)),ef.result()},n.bounds=function(e){return k(e,r(Nh)),Nh.result()},n.centroid=function(e){return k(e,r(Bh)),Bh.result()},n.projection=function(t){return arguments.length?(r=null==t?(e=null,xh):(e=t).stream,n):e},n.context=function(e){return arguments.length?(i=null==e?(t=null,new tf(o)):new We(t=e),"function"!=typeof a&&i.pointRadius(a),n):t},n.pointRadius=function(e){return arguments.length?(a="function"==typeof e?e:(i.pointRadius(+e),+e),n):a},n.digits=function(e){if(!arguments.length)return o;if(null==e)o=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);o=t}return null===t&&(i=new tf(o)),n},n.projection(e).digits(o).context(t)}function Ye(e){return function(t){var n=new Xe;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Xe(){}function Ze(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),k(n,e.stream(Nh)),t(Nh.result()),null!=r&&e.clipExtent(r),e}function Ke(e,t,n){return Ze(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])},n)}function Qe(e,t,n){return Ke(e,[[0,0],t],n)}function Je(e,t,n){return Ze(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])},n)}function et(e,t,n){return Ze(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])},n)}function tt(e,t){return+t?rt(e,t):nt(e)}function nt(e){return Ye({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function rt(e,t){function n(r,i,o,a,s,l,c,u,d,h,f,p,m,y){var b=c-r,v=u-i,x=b*b+v*v;if(x>4*t&&m--){var w=a+h,k=s+f,S=l+p,M=_d(w*w+k*k+S*S),j=g(S/=M),A=Pd(Pd(S)-1)<Sd||Pd(o-d)<Sd?(o+d)/2:Id(k,w),R=e(A,j),C=R[0],L=R[1],N=C-r,P=L-i,E=v*N-b*P;(E*E/x>t||Pd((b*N+v*P)/x-.5)>.3||a*h+s*f+l*p<nf)&&(n(r,i,o,a,s,l,C,L,A,w/=M,k/=M,S,m,y),y.point(C,L),n(C,L,A,w,k,S,c,u,d,h,f,p,m,y))}}return function(t){function r(n,r){n=e(n,r),t.point(n[0],n[1])}function i(){y=NaN,k.point=o,t.lineStart()}function o(r,i){var o=C([r,i]),a=e(r,i);n(y,b,g,v,x,w,y=a[0],b=a[1],g=r,v=o[0],x=o[1],w=o[2],16,t),t.point(y,b)}function a(){k.point=r,t.lineEnd()}function s(){i(),k.point=l,k.lineEnd=c}function l(e,t){o(u=e,t),d=y,h=b,f=v,p=x,m=w,k.point=o}function c(){n(y,b,g,v,x,w,d,h,u,f,p,m,16,t),k.lineEnd=a,a()}var u,d,h,f,p,m,g,y,b,v,x,w,k={point:r,lineStart:i,lineEnd:a,polygonStart:function(){t.polygonStart(),k.lineStart=s},polygonEnd:function(){t.polygonEnd(),k.lineStart=i}};return k}}function it(e){return Ye({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function ot(e,t,n,r,i){function o(o,a){return[t+e*(o*=r),n-e*(a*=i)]}return o.invert=function(o,a){return[(o-t)/e*r,(n-a)/e*i]},o}function at(e,t,n,r,i,o){function a(e,o){return[c*(e*=r)-u*(o*=i)+t,n-u*e-c*o]}if(!o)return ot(e,t,n,r,i);var s=Td(o),l=Fd(o),c=s*e,u=l*e,d=s/e,h=l/e,f=(l*n-s*t)/e,p=(l*t+s*n)/e;return a.invert=function(e,t){return[r*(d*e-h*t+f),i*(p-h*e-d*t)]},a}function st(e){return lt(function(){return e})()}function lt(e){function t(e){return h(e[0]*Nd,e[1]*Nd)}function n(e){return(e=h.invert(e[0],e[1]))&&[e[0]*Ld,e[1]*Ld]}function r(){var e=at(m,0,0,M,j,S).apply(null,o(b,v)),t=at(m,g-e[0],y-e[1],M,j,S);return a=U(x,w,k),d=G(o,t),h=G(a,d),u=tt(d,N),i()}function i(){return f=p=null,t}var o,a,s,l,c,u,d,h,f,p,m=150,g=480,y=250,b=0,v=0,x=0,w=0,k=0,S=0,M=1,j=1,A=null,R=ch,C=null,L=xh,N=.5;return t.stream=function(e){return f&&p===e?f:f=rf(it(a)(R(u(L(p=e)))))},t.preclip=function(e){return arguments.length?(R=e,A=void 0,i()):R},t.postclip=function(e){return arguments.length?(L=e,C=s=l=c=null,i()):L},t.clipAngle=function(e){return arguments.length?(R=+e?de(A=e*Nd):(A=null,ch),i()):A*Ld},t.clipExtent=function(e){return arguments.length?(L=null==e?(C=s=l=c=null,xh):fe(C=+e[0][0],s=+e[0][1],l=+e[1][0],c=+e[1][1]),i()):null==C?null:[[C,s],[l,c]]},t.scale=function(e){return arguments.length?(m=+e,r()):m},t.translate=function(e){return arguments.length?(g=+e[0],y=+e[1],r()):[g,y]},t.center=function(e){return arguments.length?(b=e[0]%360*Nd,v=e[1]%360*Nd,r()):[b*Ld,v*Ld]},t.rotate=function(e){return arguments.length?(x=e[0]%360*Nd,w=e[1]%360*Nd,k=e.length>2?e[2]%360*Nd:0,r()):[x*Ld,w*Ld,k*Ld]},t.angle=function(e){return arguments.length?(S=e%360*Nd,r()):S*Ld},t.reflectX=function(e){return arguments.length?(M=e?-1:1,r()):M<0},t.reflectY=function(e){return arguments.length?(j=e?-1:1,r()):j<0},t.precision=function(e){return arguments.length?(u=tt(d,N=e*e),i()):_d(N)},t.fitExtent=function(e,n){return Ke(t,e,n)},t.fitSize=function(e,n){return Qe(t,e,n)},t.fitWidth=function(e,n){return Je(t,e,n)},t.fitHeight=function(e,n){return et(t,e,n)},function(){return o=e.apply(this,arguments),t.invert=o.invert&&n,r()}}function ct(e){function t(e,t){return[e*n,Fd(t)/n]}var n=Td(e);return t.invert=function(e,t){return[e/n,g(t*n)]},t}function ut(e,t){function n(e,t){var n=_d(o-2*i*Fd(t))/i;return[n*Fd(e*=i),a-n*Td(e)]}var r=Fd(e),i=(r+Fd(t))/2;if(Pd(i)<Sd)return ct(e);var o=1+r*(2*i-r),a=_d(o)/i;return n.invert=function(e,t){var n=a-t,r=Id(e,Pd(n))*Od(n);return n*i<0&&(r-=jd*Od(e)*Od(n)),[r/i,g((o-(e*e+n*n)*i*i)/(2*i))]},n}function dt(){return(e=ut,t=0,n=jd/3,r=lt(e),i=r(t,n),i.parallels=function(e){return arguments.length?r(t=e[0]*Nd,n=e[1]*Nd):[t*Ld,n*Ld]},i).scale(155.424).center([0,33.6442]);var e,t,n,r,i}function ht(e,t){return[e,$d(Bd((Ad+t)/2))]}function ft(e){function t(){var t=jd*s(),a=o(K(o.rotate()).invert([0,0]));return c(null==u?[[a[0]-t,a[1]-t],[a[0]+t,a[1]+t]]:e===ht?[[Math.max(a[0]-t,u),n],[Math.min(a[0]+t,r),i]]:[[u,Math.max(a[1]-t,n)],[r,Math.min(a[1]+t,i)]])}var n,r,i,o=st(e),a=o.center,s=o.scale,l=o.translate,c=o.clipExtent,u=null;return o.scale=function(e){return arguments.length?(s(e),t()):s()},o.translate=function(e){return arguments.length?(l(e),t()):l()},o.center=function(e){return arguments.length?(a(e),t()):a()},o.clipExtent=function(e){return arguments.length?(null==e?u=n=r=i=null:(u=+e[0][0],n=+e[0][1],r=+e[1][0],i=+e[1][1]),t()):null==u?null:[[u,n],[r,i]]},t()}function pt(e,t){return[e,t]}function mt(e,t){var n=g(uf*Fd(t)),r=n*n,i=r*r*r;return[e*Td(n)/(uf*(af+3*sf*r+i*(7*lf+9*cf*r))),n*(af+sf*r+i*(lf+cf*r))]}function gt(){return st(mt).scale(177.158)}function yt(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),t*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function bt(e,t){return[Td(t)*Fd(e),Fd(t)]}function vt(e,t,n){if(Number.isFinite(e.scale())&&e.translate().every(Number.isFinite))return;e.scale(Math.max(1,Math.min(n.width,n.height)/(2*Math.PI))),e.translate([n.width/2,n.height/2]);const r=Ue(e).bounds(t);if(!r.flat().every(Number.isFinite))return;const i=e.translate();e.translate([i[0]+n.width/2-(r[0][0]+r[1][0])/2,i[1]+n.height/2-(r[0][1]+r[1][1])/2])}function xt(e,t){ff.set(e,t)}function wt(e,t){let n;const r=/* @__PURE__ */new Map;return e.map(e=>{const i=ff.get(e);if(void 0!==i)return i;if(!n){const e=/* @__PURE__ */new Map;n=e,t.forEach((t,n)=>{const r=e.get(t);r?r.push(n):e.set(t,[n])})}const o=r.get(e.datum)??0;return r.set(e.datum,o+1),n.get(e.datum)?.[o]??-1})}function kt(e){return{projection:e,geoPath:Ue(e),projectedPoint:(t,n)=>e([t,n]),invertedPoint:(t,n)=>e.invert?.([t,n])??null}}function St(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Mt(e,t){const n=e-t.startTime;return Math.min(n/t.duration,1)}function jt(e,t,n){return e+(t-e)*n}function At(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}function Rt(e,t,n={}){if(!Number.isFinite(t)||t<=0)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(e<0)return"fresh";const r=n.fresh??gf,i=n.aging??yf,o=n.stale??bf;return e<t*r?"fresh":e<t*i?"aging":e<t*o?"stale":"expired"}function Ct(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||e.extent<=0)return 1;const n=Math.max(0,e.age);if("step"===e.type)return n<(e.threshold??.5*e.extent)?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2,i=r>0?r:e.extent/2;return t+Math.pow(.5,n/i)*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}function Lt(e,t,n){if(n<=1)return 1;const r=n-1;return Ct({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function Nt(e,t,n){const r=e.duration??500,i=n-t;return i>=r?0:1-i/r}function Pt(e,t,n,r){let i=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,i=!0),e._pulseColor!==n&&(e._pulseColor=n,i=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,i=!0),i):(0!==e._pulseIntensity&&(e._pulseIntensity=0,i=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,i=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,i=!0),i)}function Et(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,i=t.peek();return null!=i&&n-i<r}function It(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function Tt(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function zt(e){const t=e.map(It),n=t.length-1;return e=>{if(Number.isNaN(e)&&(e=0),e<=0){const[e,n,r]=t[0];return Tt(e,n,r)}if(e>=1){const[e,r,i]=t[n];return Tt(e,r,i)}const r=e*n,i=Math.floor(r),o=r-i,[a,s,l]=t[i],[c,u,d]=t[i+1];return Tt(Math.round(a+(c-a)*o),Math.round(s+(u-s)*o),Math.round(l+(d-l)*o))}}function Dt(e){return e&&Object.prototype.hasOwnProperty.call(Rf,e)?Rf[e]:wf}function $t(e,t,n=Lf){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Object.prototype.hasOwnProperty.call(Cf,e)?Cf[e]:void 0;if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}function Ft(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Ef.has(t)}function Ot(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!Ft(r)?n(r):r}const r=String(e?.[t]);return n?n(r):Lf[Math.abs(Wt(r))%Lf.length]}function _t(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function Bt(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>_t(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>String(e)))),i=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,vf.scaleOrdinal)().domain(r).range(n).unknown("#999");const o=Object.prototype.hasOwnProperty.call(Cf,n)?Cf[n]:Cf.category10;if(i&&"function"==typeof o){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>o(0===e?0:Number(t)/e)}{const e=Array.isArray(o)?o:Lf;return(0,vf.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function Wt(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}function Ht(e,t,n=[3,20],r){let i;if(i="function"==typeof t?t(e):e?.[t],!r)return i;const[o,a]=r,[s,l]=n;if(a===o)return(s+l)/2;let c=(i-o)/(a-o);return c<0?c=0:c>1&&(c=1),s+c*(l-s)}function qt(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&_t(n,e)||"#4e79a7":t=>{if(n){const e=_t(n,t);if(e)return e}let r=0;for(let e=0;e<t.length;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function Gt(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:i}=e;Vt(r)&&0===n.length&&Ut(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Ut(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Vt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Vt))}function Ut(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Yt(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:String(e)}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}function Xt(e,t,n,r){const i=Yt(t),o="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:o,message:`Semiotic ${e} ${o} failed: ${i.message}`,error:i,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}function Zt(e){try{return{kind:"success",result:e.run()}}catch(t){const n=e.hasPreviousResult,r=Xt(e.family,t,n,e.revision);"production"!==process.env.NODE_ENV&&console.error(`[semiotic] ${e.logLabel} threw:`,t);try{e.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:r,preservedLastGoodScene:n}}}function Kt(e){if(!e)return gt();if("string"==typeof e){const t=If[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),gt())}if("object"==typeof e&&"type"in e){const t=If[e.type],n=t?t():gt();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}function Qt(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Jt(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function en(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function tn(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}function nn(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}function rn(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}function on(e,t){if(e.length<2)return[e];const n=.4*t,r=[];let i=[e[0]];for(let t=1;t<e.length;t++){const o=e[t-1],a=e[t];Math.abs(a[0]-o[0])>n?(i.length>=2&&r.push(i),i=[a]):i.push(a)}return i.length>=2&&r.push(i),r}function an(e,t,n=24){const r=t[0]-e[0],i=t[1]-e[1],o=Math.sqrt(r*r+i*i);if(0===o)return[e,t];const a=-i/o,s=r/o,l=Math.min(.3*o,80),c=(e[0]+t[0])/2+a*l,u=(e[1]+t[1])/2+s*l,d=[];for(let r=0;r<=n;r++){const i=r/n,o=1-i,a=o*o*e[0]+2*o*i*c+i*i*t[0],s=o*o*e[1]+2*o*i*u+i*i*t[1];d.push([a,s])}return d}function sn(e,t){if(e.length<2)return e;const n=t/2+1,r=[];for(let t=0;t<e.length;t++){const i=e[t];let o,a;0===t?(o=e[1][0]-i[0],a=e[1][1]-i[1]):t===e.length-1?(o=i[0]-e[t-1][0],a=i[1]-e[t-1][1]):(o=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);const s=Math.sqrt(o*o+a*a)||1,l=a/s,c=-o/s;r.push([i[0]+l*n,i[1]+c*n])}return r}function ln(e,t,n,r,i){const o=t[0]-e[0],a=t[1]-e[1],s=Math.sqrt(o*o+a*a);if(0===s)return[e,t];const l=a/s,c=-o/s,u=i/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}function cn(e,t){let n=1/0,r=-1/0;for(const i of e){const e=t?t(i):i;e<n&&(n=e),e>r&&(r=e)}return[n,r]}function un(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function dn(e,t,n,r){const i=e.filter(e=>"point"===e.type);if(i.length<2)return null;const o=t.strength??1,a=Number.isFinite(o)?Math.max(0,Math.min(1,o)):1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===a)return null;const l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=i.find(e=>e.datum&&String(l(e.datum))===String(t.center));if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const d=un(i.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),1);r>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){const n=e[t];"geoarea"===n.type&&n.interactive&&e.splice(t,1)}const h="strip"===s?fn(i,u,c,d,n):hn(i,u,c,d,a,n),f=e.filter(e=>"line"===e.type);if(f.length>0){const e=/* @__PURE__ */new Map;for(const t of i)null!=t.pointId&&e.set(String(t.pointId),[t.x,t.y]);for(const n of f){const r=n.datum?.source,i=n.datum?.target;if(null!=r&&null!=i){const o=e.get(String(r)),a=e.get(String(i));if(o&&a)if("fractional"===t.lineMode&&n.path.length>2){const e=n.path[0],t=n.path[n.path.length-1],r=[o[0]-e[0],o[1]-e[1]],i=[a[0]-t[0],a[1]-t[1]],s=[0];for(let e=1;e<n.path.length;e++)s.push(s[e-1]+Math.hypot(n.path[e][0]-n.path[e-1][0],n.path[e][1]-n.path[e-1][1]));const l=s[s.length-1];n.path=n.path.map((e,t)=>{const o=l>0?s[t]/l:t/(n.path.length-1);return[e[0]+r[0]*(1-o)+i[0]*o,e[1]+r[1]*(1-o)+i[1]*o]})}else n.path=[o,a]}}}return h}function hn(e,t,n,r,i,o){const a=t.x,s=t.y,l=o.width/2,c=o.height/2,u=Math.min(o.width,o.height)/2,d=(0,Tf.scaleLinear)().domain([0,r]).range([0,u]);for(const o of e){if(o===t)continue;if(!o.datum)continue;const e=o.x,u=o.y,h=Math.atan2(u-s,e-a),f=Math.hypot(e-a,u-s),p=Number(n(o.datum)),m=isFinite(p)&&p>=0?r>0?d(p):0:f,g=l+Math.cos(h)*m,y=c+Math.sin(h)*m;o.x=e+(g-e)*i,o.y=u+(y-u)*i}return t.x=a+(l-a)*i,t.y=s+(c-s)*i,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}function fn(e,t,n,r,i){const o=Math.max(3,Math.min(8,.35*i.height)),a=Math.max(1,i.width-2*o),s=i.height/2,l=(0,Tf.scaleLinear)().domain([0,r]).range([0,a]);t.x=o,t.y=s;const c=[];for(const i of e){if(i===t)continue;if(!i.datum){i.x=o,i.y=s;continue}const e=Number(n(i.datum)),a=o+(isFinite(e)&&e>=0&&r>0?l(e):0);i.x=a,i.y=s,c.push({node:i,x:a})}c.sort((e,t)=>e.x-t.x);const u=Math.max(0,Math.min(i.height/2-1,6));let d=0;for(;d<c.length;){let e=d+1;for(;e<c.length&&Math.abs(c[e].x-c[d].x)<3;)e++;const t=e-d;if(t>1&&u>0)for(let e=0;e<t;e++){const n=e-(t-1)/2,r=Math.min(2.5,2*u/Math.max(1,t-1));c[d+e].node.y=s+n*r}d=e}return{cx:o,cy:s,maxCost:r,availableRadius:a,layout:"strip"}}function pn(e,t,n,r){const i=e.push(t);return n&&n.push(r),i}function mn(e,t,n){if(!t||0===t.size)return;const r=/* @__PURE__ */new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const i=t.toArray();t.clear();for(let e=0;e<i.length;e++)r.has(e)||t.push(i[e])}function gn(e,t){const n={...e};for(const e of t)n[zf[e]]++;return n}function yn(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:gn(n,r)}}function bn(e){let t="preserve";const n=/* @__PURE__ */new Set;for(const r of e){const e=Object.prototype.hasOwnProperty.call(Uf,r)?Uf[r]:Yf;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}function vn({config:e,projection:t,path:n,areas:r,points:i,lines:o,layout:a}){const s=Qt(e.xAccessor,"lon"),l=Qt(e.yAccessor,"lat"),c=[],u=tn(e),d=rn(e),h=nn(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=Re();t.step&&r.step(t.step);const i=n(r())||"";i&&c.push({type:"geoarea",pathData:i,centroid:[a.width/2,a.height/2],bounds:[[0,0],[a.width,a.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth??.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const t of r){const r=n(t);if(!r)continue;const i=n.centroid(t),o=n.bounds(t),a=n.area(t);c.push({type:"geoarea",pathData:r,centroid:i,bounds:o,screenArea:a,style:en(e.areaStyle,t,u),datum:t,interactive:!0})}const f=Jt(e.lineDataAccessor);for(const n of o){const r=f(n);if(!r||r.length<2)continue;let i=[];if("geo"===e.lineType){const e=new Array(r.length);for(let t=0;t<r.length;t++)e[t]=[s(r[t]),l(r[t])];for(let n=0;n<e.length-1;n++){const r=e[n],o=e[n+1],a=ye(r,o)||0,s=Math.max(2,Math.ceil(a/(Math.PI/180))),l=Ce(r,o);for(let e=0;e<=s;e++){if(n>0&&0===e)continue;const r=t(l(e/s));null!=r&&i.push(r)}}}else for(let e=0;e<r.length;e++){const n=r[e],o=t([s(n),l(n)]);null!=o&&i.push(o)}if(i.length<2)continue;const o=en(e.lineStyle,n,d),u="number"==typeof o.strokeWidth?o.strokeWidth:1;2===r.length&&i.length>=2&&"arc"===e.flowStyle?i=an(i[0],i[i.length-1]):2===r.length&&i.length>=2&&"offset"===e.flowStyle&&(i="geo"===e.lineType?sn(i,u):ln(i[0],i[i.length-1],0,0,u));const h=on(i,a.width);if(h.length<=1)c.push({type:"line",path:i.length>=2?i:h[0]||i,style:o,datum:n});else for(const e of h)e.length<2||c.push({type:"line",path:e,style:{...o,_edgeFade:!0},datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,g=m>0?m*Math.PI/180:null,y=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-y[0],(b[1]??0)-y[1]];for(const[n,r]of i.entries()){const i=s(r),o=l(r);if(!Number.isFinite(i)||!Number.isFinite(o))continue;if(null!=g&&ye([i,o],v)>g)continue;const a=t([i,o]);if(!a||!Number.isFinite(a[0])||!Number.isFinite(a[1]))continue;const u=e.pointStyle?e.pointStyle(r):{...h},d={type:"point",x:a[0],y:a[1],r:u.r||4,style:u,datum:r,pointId:p?String(p(r)):void 0};xt(d,n),c.push(d)}return c}function xn(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&e<.5)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${String(e)}.`)}function wn(e){return{...e,fitPadding:xn(e.fitPadding)}}function kn(e){return"fitPadding"in e?{...e,fitPadding:xn(e.fitPadding)}:e}function Sn(e){if(!e)return np;for(const t of e)if(null==t||"object"!=typeof t)return e.filter(e=>null!=e&&"object"==typeof e);return e}function Mn(e,{storeRef:t,dirtyRef:n,scheduleRender:r,zoomTransformRef:i,containerRef:o,zoomBehaviorRef:a}){const s=(0,Jf.useCallback)(e=>{null!=e&&"object"==typeof e&&(t.current?.pushPoint(e),n.current=!0,r())},[t,n,r]),l=(0,Jf.useCallback)(e=>{const i=Sn(e);0!==i.length&&(t.current?.pushMany(i),n.current=!0,r())},[t,n,r]),c=(0,Jf.useCallback)(e=>{null!=e&&"object"==typeof e&&(t.current?.pushLine(e),n.current=!0,r())},[t,n,r]),u=(0,Jf.useCallback)(e=>{const i=Sn(e);0!==i.length&&(t.current?.pushManyLines(i),n.current=!0,r())},[t,n,r]),d=(0,Jf.useCallback)(()=>{t.current?.clear(),n.current=!0,r()},[t,n,r]);(0,Jf.useImperativeHandle)(e,()=>({push:s,pushMany:l,removePoint:e=>{const i=t.current?.removePoint(e)??[];return i.length>0&&(n.current=!0,r()),i},pushLine:c,pushManyLines:u,removeLine:e=>{const i=t.current?.removeLine(e)??[];return i.length>0&&(n.current=!0,r()),i},getLines:()=>t.current?.getLines()??[],clear:d,getProjection:()=>t.current?.scales?.projection??null,getGeoPath:()=>t.current?.scales?.geoPath??null,getCartogramLayout:()=>t.current?.cartogramLayout??null,getCustomLayout:()=>t.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>t.current?.lastCustomLayoutFailure??null,getZoom:()=>i.current.k,resetZoom:()=>{const e=o.current;e&&a.current&&(0,ep.select)(e).call(a.current.transform,tp.zoomIdentity)},getData:()=>t.current?.getPoints()??[]}),[s,l,c,u,d,r,t,n,i,o,a])}function jn(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function An(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}function Rn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}function Cn(e,t,n,r){const i=r.current,o=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!o&&e.hasActivePulsesAt(t),s=!(n||o||!a&&!i)&&e.refreshPulse(t);return r.current=a,{changed:s,pending:a}}function Ln(e,t){return"function"==typeof e?.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e?.addListener?.(t),()=>e?.removeListener?.(t))}function Nn(){const[e,t]=(0,fp.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,fp.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ln(e,e=>t(e.matches))},[]),e}function Pn(e,t=0,n=1/0,r=0){const i=Number.isFinite(t)?t:0,o=Number.isFinite(n)?Math.max(i,n):1/0,a=Number.isFinite(e)?Math.floor(e):i,s=Math.max(i,Math.min(o,a));return r>0&&Number.isFinite(r)?Math.max(i,Math.min(o,Math.round(s/r)*r)):s}function En(e,t,n,r={}){const i=(0,pp.useRef)(null),[o,a]=(0,pp.useState)(null);mp(()=>{if(!t&&!n)return;const e=i.current;if(!e||"undefined"==typeof ResizeObserver)return;const o=(e,t)=>({w:Pn(e,r.minWidth,r.maxWidth,r.widthStep),h:Pn(t,r.minHeight,r.maxHeight,r.heightStep)}),s=e.getBoundingClientRect();(s.width>0||s.height>0)&&a(o(s.width,s.height));const l=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect,r=o(e,n);a(e=>e&&e.w===r.w&&e.h===r.h?e:r)}});return l.observe(e),()=>l.disconnect()},[t,n,r.minWidth,r.maxWidth,r.widthStep,r.minHeight,r.maxHeight,r.heightStep]);const s=[t&&o?o.w:e[0],n&&o?o.h:e[1]];return[i,s]}function In(e){return 0!==e.fontfaces?.length}function Tn(e){const t="undefined"==typeof document?void 0:document.fonts;if(!t||"function"!=typeof t.addEventListener)return()=>{};const n=t=>{In(t)&&e()};return t.addEventListener("loadingdone",n),()=>t.removeEventListener("loadingdone",n)}function zn(e){const t=e.trim();if(!t.startsWith("var(")||!t.endsWith(")"))return null;const n=t.slice(4,-1),r=n.indexOf(",");if(-1===r){const e=n.trim();return e.startsWith("--")?{name:e}:null}const i=n.slice(0,r).trim(),o=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:o||void 0}:null}function Dn(){if(bp)return;if("undefined"==typeof window||"undefined"==typeof document)return;bp=!0;const e=e=>{if(!e?.includes("--"))return"";const t=document.createElement("span").style;return t.cssText=e,Array.from(t).filter(e=>e.startsWith("--")).sort().map(e=>`${e}:${t.getPropertyValue(e)}!${t.getPropertyPriority(e)}`).join(";")},t=(t,n)=>{const r=t.target;if(!(r instanceof Element))return!1;if(r===n||r.contains(n))return!0;if(!n.contains(r))return!1;const i="CANVAS"===r.tagName;return!(!i&&!r.querySelector("canvas")||i&&"style"===t.attributeName&&e(t.oldValue)===e(r.getAttribute("style")))},n=e=>{const n=[];for(const r of Sp){const i=r.getElement();i&&(!e||e.some(e=>t(e,i)))&&n.push(r)}if(!e||0!==n.length){yp++;for(const e of n)e.listener()}};if("undefined"!=typeof MutationObserver&&document.documentElement&&(vp=new MutationObserver(e=>{n(e)})).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme","data-semiotic-theme-mode"],attributeOldValue:!0,subtree:!0}),"function"==typeof window.matchMedia)try{xp=window.matchMedia("(prefers-color-scheme: dark)"),wp=()=>n(),"function"==typeof xp.addEventListener?xp.addEventListener("change",wp):"function"==typeof xp.addListener&&xp.addListener(wp)}catch{}kp=Tn(()=>n())}function $n(e,t){Dn();const n={getElement:e,listener:t};return Sp.add(n),()=>{Sp.delete(n)&&0===Sp.size&&(vp?.disconnect(),vp=null,xp&&wp&&("function"==typeof xp.removeEventListener?xp.removeEventListener("change",wp):"function"==typeof xp.removeListener&&xp.removeListener(wp)),xp=null,wp=null,kp?.(),kp=null,bp=!1)}}function Fn(e,t){if(!t)return t;const n=zn(t);if(!n)return t;const r=()=>n.fallback?Fn(e,n.fallback):t,i=e.canvas;if(!i)return r();let o=gp.get(i);o&&o.version===yp||(o={version:yp,map:/* @__PURE__ */new Map},gp.set(i,o));const a=o.map.get(t);if(void 0!==a)return a;const s=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||t;return o.map.set(t,s),s}function On(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function _n(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}function Bn(e,t){const n=e();return Number.isFinite(n)?n:t}function Wn(e,t){const n=t?36:0;return e.top>=n?e:{...e,top:n}}function Hn(e){let t=6;for(let n=1;n<e.length;n++){const r=Math.abs(e[n]-e[n-1]);if(r>0&&Number.isFinite(r)){const i=Math.max(Math.abs(e[n]),Math.abs(e[n-1]));t=Math.max(t,Math.ceil(Math.log10(i/r))+1)}}const n=Math.min(17,t);return e=>Number.isInteger(e)?String(e):String(Number(e.toPrecision(n)))}function qn(...e){let t;for(const n of e)n&&(t=Gn(t)&&Gn(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}function Gn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Vn(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Un(e,t,n,r,i=8){const o="left"===r||"right"===r,a=r,s="left"===r?"right":"right"===r?"left":"top"===r?"bottom":"top",l=Math.max(0,(o?n[0]:n[1])-i),c=Math.max(t[a],l-e[s]);e[a]>c&&(e[a]=c)}function Yn(e){return Math.ceil(7*e.length)}function Xn(e,t){if(Gn(e)){const n=ir(t);let r=100;for(const t of e.legendGroups){t.label&&(r=Math.max(r,Yn(t.label)));for(const e of t.items)r=Math.max(r,n.swatchSize+n.labelGap+Yn(e.label))}return r}if(Vn(e)){const{gradient:t}=e,n=t.format||Hn(t.domain),r=Math.max(Yn(n(t.domain[0])),Yn(n(t.domain[1]))),i=t.label?Yn(t.label):0;return Math.max(100,19+r,i)}return 100}function Zn(e){return(Gn(e)||Vn(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):10}function Kn(e,t){return null!=e?.sideGutter?Math.max(0,e.sideGutter):t?.hasAxis?t.hasAxisLabel?Rp:Ap:0}function Qn(e){return Math.max(0,e?.edgeGutter??3)}function Jn(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?64:46:22:0}function er(e,t,n){if(Vn(e))return e.gradient.label?46:26;if(!Gn(e))return 20;const r=ir(n),i=Math.max(1,n?.maxWidth??t);let o=r.rowHeight;for(const t of e.legendGroups){let e=0,n=0;for(const o of t.items){const t=r.swatchSize+r.labelGap+Yn(o.label),a=0===n?t:n+r.itemGap+t;n>0&&a>i?(e+=1,n=t):n=a}t.items.length>0&&(e+=1),o=Math.max(o,e*r.rowHeight,t.label?Yn(t.label):0)}return o+(e.legendGroups.length>1?16:0)}function tr(e,t,n){return Xn(e,t)+Zn(e)+Kn(t,n)+Qn(t)}function nr(e,t){const{legend:n}=t;if(!n)return;const r=t.position??"right",i=er(n,Math.max(1,t.size[0]-e.left-e.right),t.legendLayout)+Zn(n)+Jn("bottom"===r?t.axisChrome:"top"===r?t.axisChrome?.topAxis:void 0,t.legendLayout)+("top"===r&&t.hasTitle?24:0),o=Math.max(t.minimumMargin??0,"top"===r?t.hasTitle?58:34:0);"right"===r?e.right=Math.max(e.right,o,tr(n,t.legendLayout,t.axisChrome?.rightAxis)):"left"===r?e.left=Math.max(e.left,o,tr(n,t.legendLayout,t.axisChrome?.leftAxis)):"top"===r?e.top=Math.max(e.top,o,i):e.bottom=Math.max(e.bottom,o,i)}function rr(e,t){const n=t.position??"right",r="top"===n||"bottom"===n,i=Math.max(0,t.totalWidth-t.margin.left-t.margin.right),o=Math.max(1,r?t.legendLayout?.maxWidth??i:t.reservedWidth??Xn(e,t.legendLayout)),a=Zn(e),s=Kn(t.legendLayout,"left"===n?t.axisChrome?.leftAxis:t.axisChrome?.rightAxis),l=Qn(t.legendLayout),c=er(e,i,t.legendLayout),u=Jn(t.axisChrome,t.legendLayout),d=Jn(t.axisChrome?.topAxis,t.legendLayout);if("left"===n)return{x:Math.max(l,t.margin.left-s-o-a),y:t.margin.top,width:o,height:c};if("top"===n)return{x:t.margin.left,y:t.margin.top-d-a-c,width:o,height:c};if("bottom"===n){const e=t.totalHeight-t.margin.bottom;return{x:t.margin.left,y:Math.max(e+a,Math.min(e+u+a,t.totalHeight-c)),width:o,height:c}}return{x:Math.min(t.totalWidth-o-l,t.totalWidth-t.margin.right+s+a),y:t.margin.top,width:o,height:c}}function ir(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function or(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const i=n;let o;n+=8,e&&(n+=16,o=n,n+=8);const a=n;return n+=r*t+8,{lineY:i,labelY:o,itemsY:a,endY:n}})}function ar(e,t,n=!1){const r={...e};for(const e of t??[])!1!==e.visible||"top"===e.orient&&n||(r[e.orient]=0);return r}function sr(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function lr(e){const t=Nn(),n=(0,up.useRef)(t);n.current=t;const[r,i]=En(e.sizeProp,e.responsiveWidth,e.responsiveHeight),o=i[0],a=i[1],s=(0,up.useMemo)(()=>[o,a],[o,a]),l=Boolean(e.title),c=(0,up.useMemo)(()=>{const t=Wn({...e.marginDefault,...e.userMargin},l);if(e.legend&&!e.legendMarginReserved){const n={...t},r=e.legendPosition??"right";nr(t,{legend:e.legend,position:r,size:s,hasTitle:l,legendLayout:e.legendLayout,axisChrome:e.axisChrome}),Un(t,n,s,r)}return t},[e.marginDefault,e.userMargin,e.legend,e.legendPosition,e.legendLayout,e.axisChrome,e.legendMarginReserved,l,s]),u=Math.max(1,i[0]-c.left-c.right),d=Math.max(1,i[1]-c.top-c.bottom),h=sr(e.foregroundGraphics,i,c),f=sr(e.backgroundGraphics,i,c),p=(0,hp.useThemeSelector)(e=>e.theme),{transition:m,introEnabled:g}=At(e.animate,e.transitionProp),y=`semiotic-table-${cp.useId()}`,b=(0,up.useRef)(null);if(!b.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new jp({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const v=b.current;v.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,up.useRef)(null),w=(0,up.useRef)(e.frameScheduler??Lp);w.current=e.frameScheduler??Lp;const k=(0,up.useRef)(null),S=(0,up.useRef)(!1),M=(0,up.useRef)(()=>{}),j=(0,up.useCallback)(()=>{if(null!==x.current||S.current)return;const e=w.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(S.current=!0),x.current=null,k.current=null;try{e?M.current():(0,dp.flushSync)(M.current)}finally{e&&(S.current=!1)}});n=!0,t||(x.current=r,k.current=e)},[]),A=(0,up.useCallback)(()=>{null!==x.current&&((k.current??w.current).cancelAnimationFrame(x.current),x.current=null,k.current=null)},[]),R=(0,up.useCallback)(()=>{null!==x.current&&(A(),M.current())},[A]);Cp(()=>{v.setPaused(!0===e.paused)},[v,e.paused]),(0,up.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void v.setVisible(!0);const t=()=>v.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[v,e.suspendWhenHidden]),(0,up.useEffect)(()=>()=>{A()},[A]);const C=(0,up.useRef)(()=>{}),L=(0,up.useRef)(()=>{}),N=(0,up.useRef)({inside:!1,clientX:0,clientY:0,pointerType:void 0}),P=(0,up.useRef)(null),E=(0,up.useRef)(null),I=(0,up.useRef)(null),T=(0,up.useCallback)(()=>{const e=P.current;P.current=null,e&&C.current(e)},[]),z=(0,up.useCallback)(e=>{const t=N.current;if(t.inside=!0,t.clientX=e.clientX,t.clientY=e.clientY,t.pointerType=e.pointerType,P.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===E.current){const e=w.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,E.current=null,I.current=null,T()});t||(E.current=n,I.current=e)}},[T]),D=(0,up.useCallback)(()=>{null!==E.current&&((I.current??w.current).cancelAnimationFrame(E.current),E.current=null,I.current=null),T()},[T]),$=(0,up.useCallback)(()=>{N.current.inside=!1,P.current=null,D(),L.current()},[D]);(0,up.useEffect)(()=>{if("undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&N.current.inside&&$()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[$]),(0,up.useEffect)(()=>()=>{P.current=null,null!==E.current&&((I.current??w.current).cancelAnimationFrame(E.current),E.current=null,I.current=null)},[]);const F=e.themeDirtyRef,O=(0,up.useRef)(!1);return Cp(()=>{if(!F)return;const t=!O.current;O.current=!0,t&&e.skipInitialThemeInvalidation||(yp++,F.current=!0,j())},[p,e.skipInitialThemeInvalidation,j,F]),(0,up.useEffect)(()=>{if(F)return $n(()=>r.current,()=>{F.current=!0,j()})},[r,j,F]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:i,margin:c,adjustedWidth:u,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:p,transition:m,introEnabled:g,tableId:y,frameRuntime:v,rafRef:x,renderFnRef:M,scheduleRender:j,cancelRender:A,flushRender:R,hoverHandlerRef:C,hoverLeaveRef:L,onPointerMove:z,flushPointerMove:D,onPointerLeave:$,pointerStateRef:N}}function cr(e,t,n,r){(0,Np.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}function ur(e,t,n,r){const i=(0,Np.useRef)(null);(0,Np.useEffect)(()=>{const o=e.current;if(!o)return;const a=t??null;i.current!==a&&(i.current=a,o.setLayoutSelection(a),o.hasCustomRestyle?o.restyleScene(a):n.current=!0,r())},[t,r,e,n])}function dr(e,t="dark"===e.mode){if(!e.accessibility)return e;let n=e;return e.accessibility.colorBlindSafe&&(n={...n,colors:{...n.colors,categorical:Pp}}),e.accessibility.highContrast&&(n={...n,colors:{...n.colors,text:t?"#ffffff":"#000000",textSecondary:t?"#cccccc":"#333333",grid:t?"#666666":"#999999",border:t?"#888888":"#000000"}}),n}function hr(e){let t=e.replace(/^#/,"");/^[a-f\d]{3}$/i.test(t)&&(t=t.split("").map(e=>e+e).join(""));const n=t.match(/^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!n)return null;const[r,i,o]=[parseInt(n[1],16)/255,parseInt(n[2],16)/255,parseInt(n[3],16)/255],a=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return.2126*a(r)+.7152*a(i)+.0722*a(o)}function fr(e,t){const n=hr(e),r=hr(t);return null===n||null===r?null:(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function pr(e){return function e(t){return Array.isArray(t)?t.map(e):null!==t&&"object"==typeof t?Object.fromEntries(Object.entries(t).map(([t,n])=>[t,e(n)])):t}(e)}function mr(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function gr(e){return dr(e,"dark"===e.mode||"auto"===e.mode&&(fr(e.colors.background,"#ffffff")??1)>Math.sqrt(21))}function yr(e,t){if("light"===t)return pr(Ep);if("dark"===t)return pr(Ip);if("high-contrast"===t)return pr(Tp);if("string"==typeof t)return"undefined"!=typeof console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;const n=t.mode&&"auto"!==t.mode?"dark"===t.mode?Ip:Ep:e;return pr(gr({...n,...t,colors:{...n.colors,...t.colors||{}},typography:{...n.typography,...t.typography||{}},aesthetics:(r=n.aesthetics,t.aesthetics?{...r,...t.aesthetics,weights:{...r?.weights,...t.aesthetics.weights},thresholds:{...r?.thresholds,...t.aesthetics.thresholds},rationales:{...r?.rationales,...t.aesthetics.rationales}}:r)}));var r}function br(e,t){const n=e?.state??(e?.settling?"settling":void 0);if("live"===n)return $p;if("stopped"===n||"failed"===n||"stale"===n)return{alpha:e?.dimOpacity??.5,band:"stale",isStale:!0};if("settling"===n)return{alpha:.85,band:"aging",isStale:!1};if(!(e&&t>0))return $p;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,i=e.graded;if(i){const e="object"==typeof i?i:{},n=Rt(t,r,e.thresholds);return{alpha:{...Dp,...e.opacities??{}}[n],band:n,isStale:"fresh"!==n}}return t>r?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:$p}function vr(e,t,n,r,i,o,a){const s=(0,zp.useRef)("fresh");(0,zp.useEffect)(()=>{if(!e)return void(s.current="fresh");const l=setInterval(()=>{const l=t.current;if(!l||0===l.lastIngestTime)return;const c=br(e,i()-l.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&a(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[e,o,r,i,t,a,n])}function xr(e,t,n){return t||(n?"settling":e?"stale":"live")}function wr({isStale:e,position:t,state:n,settling:r}){const i=xr(e,n,r),o=Op[i]??Op.live,a=Object.hasOwn(Op,i)?i.toUpperCase():"LIVE";/* @__PURE__ */ /* @__PURE__ */
|
|
19
|
+
return(0,Fp.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:o,color:"white"},children:a})}function kr(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:String(n)}function Sr(e){const t=(0,Bp.useObservationSelector)(e=>e.pushObservation),n=_p.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return _p.useMemo(()=>({...e,onObservation:n}),[n,e])}function Mr(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}function jr(e,t={}){const n=kr(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const i=Mr(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:i}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:i,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function Ar(e){return"string"==typeof e&&e.includes("var(")}function Rr(e){const t=Hp.exec(e);if(!t)return Ar(e)?void 0:e;const n=t[1]?.trim();return n?Rr(n):void 0}function Cr(e,t){return String(e).length*t*.6}function Lr(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{...e,type:e.type??"halo"}}function Nr(e){const{x:t,y:n,text:r,fill:i,fontSize:o=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=Lr(u),f=e=>/* @__PURE__ */ /* @__PURE__ */(0,qp.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:i,fontSize:o,fontWeight:a,fontFamily:s,className:d,...e?{style:{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Gp,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,g="number"==typeof p?p:p.y,y=Cr(r,o),b=y+2*m,v=o+2*g;let x,w;x="middle"===l?t-y/2-m:"end"===l?t-y-m:t-m,w="middle"===c||"central"===c?n-v/2:"hanging"===c||"text-before-edge"===c?n-g:n-.8*o-g;const k=h.fill??Gp,S={};return Ar(k)&&(S.fill=k),Ar(h.stroke)&&(S.stroke=h.stroke),/* @__PURE__ */ /* @__PURE__ */(0,qp.jsxs)("g",{className:d,children:[
|
|
20
20
|
/* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */(0,
|
|
22
|
-
return(0,
|
|
23
|
-
return(0,
|
|
21
|
+
/* @__PURE__ */(0,qp.jsx)("rect",{x:x,y:w,width:b,height:v,rx:h.radius??3,ry:h.radius??3,fill:Ar(k)?Rr(k):k,fillOpacity:h.opacity??.85,stroke:Ar(h.stroke)?Rr(h.stroke):h.stroke,strokeWidth:h.strokeWidth,...S.fill||S.stroke?{style:S}:{}}),f()]})}function Pr(e,t,n){if(!e)return null;const r="object"==typeof e?e:{};/* @__PURE__ */ /* @__PURE__ */
|
|
22
|
+
return(0,Vp.jsx)("circle",{className:"semiotic-threshold-end-cap",cx:t[0],cy:t[1],r:Math.max(0,r.radius??4),fill:r.fill??n})}function Er(e,t){return Math.max(Math.min(e,t),0)+16}function Ir({ann:e,position:t,vertical:n,width:r,height:i,color:o,fontSize:a=12,fontFamily:s,bold:l,background:c,dash:u="6,3",labelGap:d=4}){const h=e.labelPosition,f=t>.6*r,p=n?t+(f?-4:4):"left"===h?4:"center"===h?r/2:r-4,m=n?"bottom"===h?i-4:"center"===h?i/2:16:t<20?Math.min(i-4,t+16):t-d,g=n?f?"end":"start":"left"===h?"start":"center"===h?"middle":"end",y=n?[t,0]:[0,t],b=n?[t,i]:[r,t];/* @__PURE__ */ /* @__PURE__ */
|
|
23
|
+
return(0,Up.jsxs)("g",{opacity:e.opacity,children:[
|
|
24
24
|
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */(0,
|
|
25
|
+
/* @__PURE__ */(0,Up.jsx)("line",{x1:y[0],y1:y[1],x2:b[0],y2:b[1],stroke:o,strokeWidth:e.strokeWidth??1.5,strokeDasharray:e.strokeDasharray||u}),Pr(e.endCap,y,o),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,Up.jsx)(Nr,{x:p,y:m,text:e.label,textAnchor:g,fill:e.labelColor??o,fontSize:a,fontFamily:s,fontWeight:l?"bold":void 0,background:c??e.labelBackground??"halo"})]})}function Tr(e){return{label:e.label,title:e.title,wrap:e.wrap||120,noWrap:"function"==typeof e._noteLayout?e.noWrap:void 0,_noteLayout:e._noteLayout}}function zr(e){return"function"==typeof e._noteLayout?e._noteLayout(e):void 0}function Dr(e,t,n){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),i=[];let o="";for(const t of e.split(/\s+/))t&&(o&&o.length+1+t.length>r?(i.push(o),o=t):o=o?`${o} ${t}`:t);return o&&i.push(o),i}function $r(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Fr(e,t,n,r){if(!e)/* @__PURE__ */ /* @__PURE__ */return(0,Xp.jsx)("g",{className:"annotation-note"});const{label:i,title:o,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!i&&!o)/* @__PURE__ */ /* @__PURE__ */return(0,Xp.jsx)("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");const d="topBottom"===u,h="leftRight"===u;let f=s;f&&"dynamic"!==f||(f=d?t>=0?"left":"right":n>=0?"top":"bottom");let p="start";d?"right"===f?p="end":"middle"===f&&(p="middle"):p=t>=0?"start":"end";const m=e.useHTML||e.html,g=m?void 0:zr(e),y=g?.lineHeight??16,b=g?.titleLines??(o?c?[o]:Dr(o,l,8):[]),v=g?.labelLines??(i?c?[i]:Dr(i,l,8):[]),x=b.length+v.length,w=h?"end"===p?-4:4:0,k=[],S=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";if(m){const e=l,t=Math.max(y,x*y+(o&&i?2:0)),n="end"===p?w-e:"middle"===p?w-e/2:w,r="end"===p?"right":"middle"===p?"center":"left";k.push(
|
|
26
26
|
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */(0,
|
|
27
|
+
/* @__PURE__ */(0,Xp.jsx)("foreignObject",{className:"annotation-note-html",x:n,y:-y,width:e,height:t+y,style:{overflow:"visible"},children:/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:S,fontSize:"12px",lineHeight:`${y}px`,overflow:"visible",textAlign:r,whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[o&&/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:o}),i&&/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("div",{className:"annotation-note-label",children:i})]})},"annotation-note-html"))}else for(const e of[!0,!1]){const t=e?b:v;if(0===t.length)continue;const n="annotation-note-"+(e?"title":"label");k.push(
|
|
28
28
|
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */(0,
|
|
30
|
-
return(0,
|
|
29
|
+
/* @__PURE__ */(0,Xp.jsx)("text",{className:n,fill:S,textAnchor:p,fontWeight:e?g?.titleFontWeight??"bold":void 0,y:e?void 0:b.length*y,children:t.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("tspan",{x:w,dy:0===t?0:y,children:e},t))},n))}let M=null;if((o||i)&&(0!==t||0!==n)){const e=d?g?g.width:Math.min(l,120):(b.length+v.length+(v.length>0?1:0))*y,t=d?p:f,n="end"===t||"bottom"===t?-e:"middle"===t?-e/2:0;M=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("line",{className:"note-line",x1:d?n:0,x2:d?n+e:0,y1:d?0:n,y2:d?0:n+e,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const j=Math.max(0,x-1)*y,A=v.length>0&&b.length>0?2:0;let R=0;(d||h)&&(R=h&&"middle"===f?-(j+y+A)/2+y/2:n<0||h&&"bottom"===f?-(j+2):2+y);const C=0!==R?`translate(0,${R})`:void 0;/* @__PURE__ */ /* @__PURE__ */
|
|
30
|
+
return(0,Xp.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,...g?.textProps,children:[
|
|
31
31
|
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */(0,
|
|
33
|
-
return(0,
|
|
34
|
-
return(0,
|
|
35
|
-
return(0,
|
|
36
|
-
return(0,
|
|
37
|
-
return(0,
|
|
38
|
-
return(0,Lp.jsx)(Fr,{"data-testid":"semiotic-annotation",events:i,...t,type:r},a)}function Wr(e){return e instanceof Date&&(e=e.getTime()),"string"==typeof e&&""!==e.trim()&&(e=Number(e)),"number"==typeof e&&Number.isFinite(e)?e:null}function Br(e){const t=[];for(const[n,r]of e){const e=Wr(n),i=Wr(r);null!==e&&null!==i&&t.push([e,i])}return t.sort((e,t)=>e[0]-t[0])}function Hr(){return{points:[],parameterCount:0,predict:()=>NaN,leverage:()=>NaN}}function qr(e){const t=Br(e);if(!t.length)return{points:[],parameterCount:0,predict:()=>NaN,leverage:()=>NaN};const n=t[0][0],r=t.reduce((e,[r])=>e+(r-n)/t.length,0),i=t.reduce((e,[,n])=>e+n/t.length,0);let o=0,a=0;for(const[e,s]of t){const t=e-n-r;o+=t*t,a+=t*(s-i)}const s=0===o?0:a/o,l=e=>i+s*(e-n-r);return{points:t.map(([e])=>[e,l(e)]),parameterCount:2,leverage:e=>1/t.length+(o>0?(e-n-r)**2/o:0),predict:l}}function Gr(e,t=2){const n=Br(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{points:[],parameterCount:0,predict:()=>NaN,leverage:()=>NaN};const r=n[0][0]/2+n[n.length-1][0]/2,i=Math.max(Math.abs(n[0][0]-r),Math.abs(n[n.length-1][0]-r))||1,o=n.map(([e])=>(e-r)/i),a=[],s=Array.from({length:t+1},()=>Array(t+1).fill(0));for(let e=0;e<=t;e++){const t=o.map(t=>t**e);for(let n=0;n<2;n++)for(let n=0;n<e;n++){const r=t.reduce((e,t,r)=>e+t*a[n][r],0);s[n][e]+=r;for(let e=0;e<t.length;e++)t[e]-=r*a[n][e]}const r=Math.sqrt(t.reduce((e,t)=>e+t*t,0));if(!Number.isFinite(r)||r<=Number.EPSILON*n.length)return Hr();s[e][e]=r,a.push(t.map(e=>e/r))}const l=a.map(e=>e.reduce((e,t,r)=>e+t*n[r][1],0));for(let e=t;e>=0;e--){for(let n=e+1;n<=t;n++)l[e]-=s[e][n]*l[n];l[e]/=s[e][e]}const c=e=>{const n=(e-r)/i;let o=0;for(let e=t;e>=0;e--)o=o*n+l[e];return o};return{points:n.map(([e])=>[e,c(e)]),parameterCount:t+1,predict:c,leverage:e=>{const n=(e-r)/i,o=[];for(let e=0;e<=t;e++){let t=n**e;for(let n=0;n<e;n++)t-=s[n][e]*o[n];o.push(t/s[e][e])}return o.reduce((e,t)=>e+t*t,0)}}}function Vr(e,t,n=2){const r=e.length,i=e.reduce((e,[n,r])=>e+(r-t(n))**2,0);return{se:Math.sqrt(i/Math.max(r-n,1))}}function Ur(e,t=.3){if(!Number.isFinite(t)||t<0||t>1)return[];const n=Br(e),r=n.length;if(r<2)return n;const i=n.map(e=>e[0]),o=n.map(e=>e[1]);let a=0,s=Math.min(r,Math.max(2,Math.ceil(t*r)))-1;const l=[];for(let e=0;e<r;e++){const t=i[e];let n=0,c=r-1;for(;s<r-1&&Math.abs(i[s+1]-t)<=Math.abs(i[a]-t);)a++,s++;const u=Math.max(Math.abs(i[a]-t),Math.abs(i[s]-t)),d=u||1;u>0&&(n=a,c=s);let h=0,f=0,p=0,m=0,g=0;for(let e=n;e<=c;e++){const n=Math.abs(i[e]-t)/d,r=n<1?Math.pow(1-Math.pow(n,3),3):0;if(0===r)continue;h+=r;const a=(i[e]-t)/d;f+=r*a,p+=r*o[e],m+=r*a*a,g+=r*a*o[e]}if(0===h){l.push([t,o[e]]);continue}const y=h*m-f*f;if(Math.abs(y)<1e-12)l.push([t,p/h]);else{const e=(p-(h*g-f*p)/y*f)/h;l.push([t,e])}}return l}function Yr(e,t=.3){const n=new Map(Ur(e,t));return n.size<2?null:(0,Ep.scaleLinear)().domain([...n.keys()]).range([...n.values()])}function Xr(e,t){if(e.length<3||e[0][0]===e[e.length-1][0])return null;const n="polynomial"===t.method?Gr(e,t.order??2):qr(e);if(!n.points.length)return null;const r="loess"===t.method?Yr(e,t.bandwidth):n.predict;if(!r)return null;const{se:i}=Vr(e,r,n.parameterCount),o=(a=t.confidence??.95)>=.99?2.576:a>=.95?1.96:a>=.9?1.645:1;var a;const s=e[e.length-1][0],l=(s-e[0][0])/(e.length-1);return{predict:r,forecast:(e,t=s)=>!Number.isInteger(e)||e<=0?[]:Array.from({length:e},(e,a)=>{const s=t+(a+1)*l,c=r(s),u=i*o*Math.sqrt(1+n.leverage(s));return{x:s,y:c,upper:c+u,lower:c-u}})}}function Zr(e,t){const n=t.scales?.x??t.scales?.time,r=t.scales?.y??t.scales?.value;if(!n||!r)return[];const i=t.data||[];let o=t.xAccessor||"x",a=t.yAccessor||"y";const s="horizontal"===t.projection,l="ordinal"===t.frameType;l&&s&&([o,a]=[a,o]);const c=n,u=r,d=s?u:c,h=l?t.scales?.o?.domain().map(String)??[...new Set(i.filter(e=>null!=e[o]).map(e=>String(e[o])))].sort((e,t)=>d(e)-d(t)):[],f=new Map(h.map((e,t)=>[e,t])),p=Br(i.map(e=>[l?null==e[o]?void 0:f.get(String(e[o])):e[o],e[a]]));return p.length<2?[]:("loess"===e.method?Ur(p,e.bandwidth??.3):("polynomial"===e.method?Gr(p,e.order??2):qr(p)).points).map(([e,t])=>{if(!l)return[c(e),u(t)];const n=d(h[e]);return s?[c(t),n]:[n,u(t)]}).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t))}function Kr(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Qr(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Jr(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,i=e.scales?.y??e.scales?.value;if(!r||!i)return null;const o=e.xAccessor||"x",a=e.yAccessor||"y",s=n[o],l=n[a];return null==s||null==l?null:{x:r(s),y:i(l)}}function ei(e){return null==e?null:String(e)}function ti(e){return ei(e.provenance?.stableId??e.stableId)}function ni(e){return ei(e.stableId??e.id??e.provenance?.stableId)}function ri(e,t,n){return t.stickyPositionCache?.set(e,n),n}function ii(e,t,n){const r=ti(e);if(!r)return null;const i=n.pointNodes?.find(e=>ei(e.pointId)===r);if(i)return ri(t,n,{x:i.x,y:i.y});const o=n.data?.find(e=>ni(e)===r);if(!o)return null;const a=Kr(o,n),s=Qr(o,n);return null==a||null==s?null:ri(t,n,{x:a,y:s})}function oi(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId)return ri(t,n,{x:i.x,y:i.y})}const r=Jr(n);return r?ri(t,n,r):null}if("semantic"===r){const r=ii(e,t,n);if(r)return r}let i=null,o=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(i=t.x,o=t.y)}if(null!=i&&null!=o||(i=Kr(e,n),o=Qr(e,n)),null!=i&&null!=o)return ri(t,n,{x:i,y:o});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function ai(e,t,n,r=50){const i=n.width||0,o=n.height||0;return e>=-r&&e<=i+r&&t>=-r&&t<=o+r}function si(e,t=2166136261){let n=t;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return n>>>0}function li(e){const t=Number.isFinite(e)&&e>0?e:6;return{width:Math.max(8,t),height:t,lineY:t/2}}function ci(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle,...1!==e.lineOpacity?{lineOpacity:e.lineOpacity}:{}}}function ui(){const e="undefined"!=typeof window&&window.devicePixelRatio||1;return Math.min(3,Math.max(1,e))}function di(e,t,n,r){t&&"transparent"!==t&&"none"!==t?(e.fillStyle=t,e.fillRect(0,0,n,r)):e.clearRect(0,0,n,r)}function hi(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45,lineOpacity:s=1}=e,l={background:n,stroke:r,lineWidth:i,spacing:o,angle:a,lineOpacity:s},c=li(o),u=ui(),d=Math.max(1,Math.round(c.width*u)),h=Math.max(1,Math.round(c.height*u));let f;try{p=d,m=h,f="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(p,m):(Ip||(Ip=document.createElement("canvas")),Ip.width=p,Ip.height=m,Ip)}catch{return ci(l)}var p,m;const g=f.getContext("2d");if(!g)return ci(l);di(g,n,d,h);const y=h/c.height,b=Math.max(0,i)*y;g.save(),g.globalAlpha=Math.min(1,Math.max(0,s)),g.fillStyle=r,g.fillRect(0,c.lineY*y-b/2,d,b),g.restore();const v=(t||g).createPattern(f,"repeat");if(!v)return v;const x=a*Math.PI/180,w=Math.cos(x),k=Math.sin(x),S=c.width/d,M=c.height/h;return v.setTransform?.({a:w*S,b:k*S,c:-k*M,d:w*M,e:0,f:0}),v}function fi(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function pi(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function mi(e,t){return`${e}-hatch-${si(pi(t)).toString(36)}`}function gi(e,t){const n=e.background??"transparent",r=e.stroke??"#000",i="transparent"===n||"none"===n?n:$n(t,n)||n,o=$n(t,r)||r||"#000",a="undefined"!=typeof window&&window.devicePixelRatio||1,s=`${pi(e)}|${i}|${o}@${a}`,l=Tp.get(s);if(void 0!==l)return l;const c=hi({background:i,stroke:o,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle,lineOpacity:e.lineOpacity},t),u=fi(c)?null:c;return Tp.set(s,u),u}function yi(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45,lineOpacity:s=1}=e,l=li(o);/* @__PURE__ */ /* @__PURE__ */
|
|
39
|
-
return(0,
|
|
32
|
+
/* @__PURE__ */(0,Xp.jsx)("g",{className:"annotation-note-content",transform:C,children:k}),M]})}function Or(e,t,n,r,i){let o=null;const a=n||"var(--semiotic-text-secondary, currentColor)";switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&(o=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("circle",{r:e,fill:"none",stroke:a},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,n=t?.height||0;(e>0||n>0)&&(o=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("rect",{width:e,height:n,fill:"none",stroke:a},"subject-rect"));break}case"callout-custom":o=t?.custom;break;case"xy-threshold":{const e=r||0,n=i||0;let s=0,l=0,c=0,u=0;if(void 0!==t?.x)s=l=(t.x||0)-e,c=(t.y1||0)-n,u=(t.y2||0)-n;else if(void 0!==t?.y)c=u=(t.y||0)-n,s=(t.x1||0)-e,l=(t.x2||0)-e;else if(void 0!==t?.x1||void 0!==t?.x2)s=(t.x1||0)-e,l=(t.x2||0)-e;else{if(void 0===t?.y1&&void 0===t?.y2)break;c=(t.y1||0)-n,u=(t.y2||0)-n}o=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("line",{x1:s,y1:c,x2:l,y2:u,stroke:a,strokeDasharray:"5,5"},"threshold-line");break}case"bracket":{const e=t?.type||"curly",n=t?.width??t?.height,r=t?.depth||30,i=void 0===t?.width;void 0!==n&&(o=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("path",{d:$r(e,n,r,i),fill:"none",stroke:a},"bracket-path"));break}}/* @__PURE__ */ /* @__PURE__ */
|
|
33
|
+
return(0,Xp.jsx)("g",{className:"annotation-subject",children:o})}function _r(e,t,n,r,i,o){let a,s,l=0,c=0;if("callout-circle"!==i&&"label"!==i||!o?.radius){if("callout-rect"===i&&o){const n=o.width||0,r=o.height||0;if(n>0||r>0){const i=n/2,o=r/2,a=e-i,s=t-o;if(0!==a||0!==s){const e=Math.abs(a),t=Math.abs(s),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;l=i+a*h,c=o+s*h}}}else if("bracket"===i&&o){const e=o.width,t=o.height,n=o.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const n=(o.radius||0)+(o.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);l=Math.cos(r)*n,c=Math.sin(r)*n}}const u=e-l,d=t-c,h=Math.hypot(u,d);if(h>.5){const i=r||"var(--semiotic-text-secondary, currentColor)",o="curve"===n?.type;let f=Math.atan2(d,u);if(o){const r=(l+e)/2,o=(c+t)/2,s=-d/h,p=u/h,m=(n?.curve??.25)*h,g=r+s*m,y=o+p*m;a=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("path",{className:"connector-curve",d:`M${l},${c}Q${g},${y} ${e},${t}`,fill:"none",stroke:i},"connector-line"),f=Math.atan2(y-c,g-l)}else a=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("line",{x1:l,y1:c,x2:e,y2:t,stroke:i},"connector-line");if("arrow"===n?.end){const e=10,t=16/180*Math.PI,n=l+e*Math.cos(f+t),r=c+e*Math.sin(f+t),o=l+e*Math.cos(f-t),a=c+e*Math.sin(f-t);s=/* @__PURE__ */ /* @__PURE__ */(0,Xp.jsx)("path",{d:`M${l},${c}L${n},${r}L${o},${a}Z`,fill:i,stroke:"none"},"connector-arrow")}}/* @__PURE__ */ /* @__PURE__ */
|
|
34
|
+
return(0,Xp.jsxs)("g",{className:"annotation-connector",children:[a,s]})}function Br(e){const{x:t=0,y:n=0,dx:r,dy:i,nx:o,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:g={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=Array.isArray(f)?f:[];let w=r||0,k=i||0;null!=o&&(w=o-b),null!=a&&(k=a-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(e>=0?5:-5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(e>=0?5:-5),k=c.height/2}/* @__PURE__ */ /* @__PURE__ */
|
|
35
|
+
return(0,Xp.jsxs)("g",{className:`annotation ${h||""}`.trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...g,children:[!x.includes("connector")&&_r(w,k,l,d,S,c),!x.includes("subject")&&Or(S,c,d,b,v),!x.includes("note")&&Fr(s,w,k,d)]})}function Wr(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",i=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),i=t.ny||n[0][1]+(t.dy??0),o=n.map((n,o)=>{const a=Object.assign({},t,{note:0===o?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:i});/* @__PURE__ */ /* @__PURE__ */
|
|
36
|
+
return(0,Xp.jsx)(Br,{"data-testid":"semiotic-annotation",...a,type:r},`multi-annotation-${o}`)});/* @__PURE__ */ /* @__PURE__ */
|
|
37
|
+
return(0,Xp.jsx)("g",{children:o})}const o=t.note||{title:"none",label:t.label},a=`${o.label}-${o.title}-${t.i}`;/* @__PURE__ */ /* @__PURE__ */
|
|
38
|
+
return(0,Xp.jsx)(Br,{"data-testid":"semiotic-annotation",events:i,...t,type:r},a)}function Hr(e){return e instanceof Date&&(e=e.getTime()),"string"==typeof e&&""!==e.trim()&&(e=Number(e)),"number"==typeof e&&Number.isFinite(e)?e:null}function qr(e){const t=[];for(const[n,r]of e){const e=Hr(n),i=Hr(r);null!==e&&null!==i&&t.push([e,i])}return t.sort((e,t)=>e[0]-t[0])}function Gr(){return{points:[],parameterCount:0,predict:()=>NaN,leverage:()=>NaN}}function Vr(e){const t=qr(e);if(!t.length)return{points:[],parameterCount:0,predict:()=>NaN,leverage:()=>NaN};const n=t[0][0],r=t.reduce((e,[r])=>e+(r-n)/t.length,0),i=t.reduce((e,[,n])=>e+n/t.length,0);let o=0,a=0;for(const[e,s]of t){const t=e-n-r;o+=t*t,a+=t*(s-i)}const s=0===o?0:a/o,l=e=>i+s*(e-n-r);return{points:t.map(([e])=>[e,l(e)]),parameterCount:2,leverage:e=>1/t.length+(o>0?(e-n-r)**2/o:0),predict:l}}function Ur(e,t=2){const n=qr(e);if(!Number.isInteger(t)||t<0||t>=n.length)return{points:[],parameterCount:0,predict:()=>NaN,leverage:()=>NaN};const r=n[0][0]/2+n[n.length-1][0]/2,i=Math.max(Math.abs(n[0][0]-r),Math.abs(n[n.length-1][0]-r))||1,o=n.map(([e])=>(e-r)/i),a=[],s=Array.from({length:t+1},()=>Array(t+1).fill(0));for(let e=0;e<=t;e++){const t=o.map(t=>t**e);for(let n=0;n<2;n++)for(let n=0;n<e;n++){const r=t.reduce((e,t,r)=>e+t*a[n][r],0);s[n][e]+=r;for(let e=0;e<t.length;e++)t[e]-=r*a[n][e]}const r=Math.sqrt(t.reduce((e,t)=>e+t*t,0));if(!Number.isFinite(r)||r<=Number.EPSILON*n.length)return Gr();s[e][e]=r,a.push(t.map(e=>e/r))}const l=a.map(e=>e.reduce((e,t,r)=>e+t*n[r][1],0));for(let e=t;e>=0;e--){for(let n=e+1;n<=t;n++)l[e]-=s[e][n]*l[n];l[e]/=s[e][e]}const c=e=>{const n=(e-r)/i;let o=0;for(let e=t;e>=0;e--)o=o*n+l[e];return o};return{points:n.map(([e])=>[e,c(e)]),parameterCount:t+1,predict:c,leverage:e=>{const n=(e-r)/i,o=[];for(let e=0;e<=t;e++){let t=n**e;for(let n=0;n<e;n++)t-=s[n][e]*o[n];o.push(t/s[e][e])}return o.reduce((e,t)=>e+t*t,0)}}}function Yr(e,t,n=2){const r=e.length,i=e.reduce((e,[n,r])=>e+(r-t(n))**2,0);return{se:Math.sqrt(i/Math.max(r-n,1))}}function Xr(e,t=.3){if(!Number.isFinite(t)||t<0||t>1)return[];const n=qr(e),r=n.length;if(r<2)return n;const i=n.map(e=>e[0]),o=n.map(e=>e[1]);let a=0,s=Math.min(r,Math.max(2,Math.ceil(t*r)))-1;const l=[];for(let e=0;e<r;e++){const t=i[e];let n=0,c=r-1;for(;s<r-1&&Math.abs(i[s+1]-t)<=Math.abs(i[a]-t);)a++,s++;const u=Math.max(Math.abs(i[a]-t),Math.abs(i[s]-t)),d=u||1;u>0&&(n=a,c=s);let h=0,f=0,p=0,m=0,g=0;for(let e=n;e<=c;e++){const n=Math.abs(i[e]-t)/d,r=n<1?Math.pow(1-Math.pow(n,3),3):0;if(0===r)continue;h+=r;const a=(i[e]-t)/d;f+=r*a,p+=r*o[e],m+=r*a*a,g+=r*a*o[e]}if(0===h){l.push([t,o[e]]);continue}const y=h*m-f*f;if(Math.abs(y)<1e-12)l.push([t,p/h]);else{const e=(p-(h*g-f*p)/y*f)/h;l.push([t,e])}}return l}function Zr(e,t=.3){const n=new Map(Xr(e,t));return n.size<2?null:(0,Qp.scaleLinear)().domain([...n.keys()]).range([...n.values()])}function Kr(e,t){if(e.length<3||e[0][0]===e[e.length-1][0])return null;const n="polynomial"===t.method?Ur(e,t.order??2):Vr(e);if(!n.points.length)return null;const r="loess"===t.method?Zr(e,t.bandwidth):n.predict;if(!r)return null;const{se:i}=Yr(e,r,n.parameterCount),o=(a=t.confidence??.95)>=.99?2.576:a>=.95?1.96:a>=.9?1.645:1;var a;const s=e[e.length-1][0],l=(s-e[0][0])/(e.length-1);return{predict:r,forecast:(e,t=s)=>!Number.isInteger(e)||e<=0?[]:Array.from({length:e},(e,a)=>{const s=t+(a+1)*l,c=r(s),u=i*o*Math.sqrt(1+n.leverage(s));return{x:s,y:c,upper:c+u,lower:c-u}})}}function Qr(e){if(!e)return null;const t=e[Jp];return t&&t.length>0?t:null}function Jr(e,t){if(t instanceof Date){const n=t.getTime();return Number.isFinite(n)?e.find(e=>e.label instanceof Date&&e.label.getTime()===n)?.value??null:null}if("number"==typeof t&&Number.isFinite(t)){const n=e.find(e=>"number"==typeof e.label&&e.label===t);return n?n.value:e.find(e=>e.label instanceof Date&&e.label.getTime()===t)?.value??null}return"string"==typeof t?e.find(e=>"string"==typeof e.label&&e.label===t)?.value??null:null}function ei(e,t){if(!e)return null;const n=Qr(e);if(!n)return e(t);const r=Jr(n,t);return null==r?null:e(r)}function ti(e,t,n){if("function"!=typeof e)return null;if(null==t){const t=e.domain?.()?.[n];if(null==t)return null;const r=e(t instanceof Date?t.getTime():Number(t));return Number.isFinite(r)?r:null}const r=ei(e,t);return null!=r&&Number.isFinite(r)?r:null}function ni(e,t){const n=t instanceof Date?t.getTime():t;if(!e||!Number.isFinite(n))return null;const r=Qr(e);if(!r)return e(n);const i=ii(r);if(!i)return e(n);const o=oi(r,i).get(n);if(null!=o)return e(o);const a=li(i,n);return null==a?null:e(a)}function ri(e,t){return"number"==typeof t&&Number.isFinite(t)?ni(e,t):ei(e,t)}function ii(e){const t=e;if(em in t)return t[em]??null;let n=null;return e.every(e=>"number"==typeof e.label&&Number.isFinite(e.label))?n=e.map(e=>e.label):e.every(e=>e.label instanceof Date&&Number.isFinite(e.label.getTime()))&&(n=e.map(e=>e.label.getTime())),Object.defineProperty(t,em,{value:n}),n}function oi(e,t){const n=e,r=n[tm];if(r)return r;const i=/* @__PURE__ */new Map;for(let e=0;e<t.length;e++)i.set(t[e],e);return Object.defineProperty(n,tm,{value:i}),i}function ai(e){const t=e,n=t[nm];if(null!=n)return n;let r=0;for(let t=1;t<e.length;t++){const n=e[t]-e[t-1];if(0===n){r=0;break}const i=n>0?1:-1;if(0===r)r=i;else if(r!==i){r=0;break}}return Object.defineProperty(t,nm,{value:r}),r}function si(e,t,n){let r=0,i=e.length;for(;r<i;){const o=r+i>>1;(1===n?e[o]<t:e[o]>t)?r=o+1:i=o}if(0===r)return(t-e[0])/(e[1]-e[0]);const o=e.length-1;return r>=e.length?o+(t-e[o])/(e[o]-e[o-1]):r-1+(t-e[r-1])/(e[r]-e[r-1])}function li(e,t){if(e.length<2)return 1===e.length?t-e[0]:null;const n=ai(e);if(1===n||-1===n)return si(e,t,n);for(let n=0;n<e.length-1;n++){const r=e[n],i=e[n+1];if(r===i)continue;const o=Math.min(r,i),a=Math.max(r,i);if(t>=o&&t<=a)return n+(t-r)/(i-r)}const r=e[1]-e[0];if(0!==r&&(t-e[0])/r<0)return(t-e[0])/r;const i=e.length-1,o=e[i]-e[i-1];return 0!==o&&(t-e[i])/o>0?i+(t-e[i])/o:null}function ci(e,t){const n=t.scales?.x??t.scales?.time,r=t.scales?.y??t.scales?.value;if(!n||!r)return[];const i=t.data||[];let o=t.xAccessor||"x",a=t.yAccessor||"y";const s="horizontal"===t.projection,l="ordinal"===t.frameType;l&&s&&([o,a]=[a,o]);const c=e=>{const t=ri(n,e);return null==t?Number.NaN:t},u=e=>{const t=ri(r,e);return null==t?Number.NaN:t},d=s?u:c,h=l?t.scales?.o?.domain().map(String)??[...new Set(i.filter(e=>null!=e[o]).map(e=>String(e[o])))].sort((e,t)=>d(e)-d(t)):[],f=new Map(h.map((e,t)=>[e,t])),p=qr(i.map(e=>[l?null==e[o]?void 0:f.get(String(e[o])):e[o],e[a]]));return p.length<2?[]:("loess"===e.method?Xr(p,e.bandwidth??.3):("polynomial"===e.method?Ur(p,e.order??2):Vr(p)).points).map(([e,t])=>{if(!l)return[c(e),u(t)];const n=d(h[e]);return s?[c(t),n]:[n,u(t)]}).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t))}function ui(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?ei(n,e.x):t.xAccessor&&null!=e[t.xAccessor]?ei(n,e[t.xAccessor]):null:null}function di(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?ei(n,e.y):t.yAccessor&&null!=e[t.yAccessor]?ei(n,e[t.yAccessor]):null:null}function hi(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,i=e.scales?.y??e.scales?.value;if(!r||!i)return null;const o=e.xAccessor||"x",a=e.yAccessor||"y",s=n[o],l=n[a];if(null==s||null==l)return null;const c=ei(r,s),u=ei(i,l);return null==c||null==u?null:{x:c,y:u}}function fi(e){return null==e?null:String(e)}function pi(e){return fi(e.provenance?.stableId??e.stableId)}function mi(e){return fi(e.stableId??e.id??e.provenance?.stableId)}function gi(e,t,n){return t.stickyPositionCache?.set(e,n),n}function yi(e,t,n){const r=pi(e);if(!r)return null;const i=n.pointNodes?.find(e=>fi(e.pointId)===r);if(i)return gi(t,n,{x:i.x,y:i.y});const o=n.data?.find(e=>mi(e)===r);if(!o)return null;const a=ui(o,n),s=di(o,n);return null==a||null==s?null:gi(t,n,{x:a,y:s})}function bi(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const i=n.pointNodes[r];if(i.pointId===e.pointId)return gi(t,n,{x:i.x,y:i.y})}const r=hi(n);return r?gi(t,n,r):null}if("semantic"===r){const r=yi(e,t,n);if(r)return r}let i=null,o=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(i=t.x,o=t.y)}if(null!=i&&null!=o||(i=ui(e,n),o=di(e,n)),null!=i&&null!=o)return gi(t,n,{x:i,y:o});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function vi(e,t,n,r=50){const i=n.width||0,o=n.height||0;return e>=-r&&e<=i+r&&t>=-r&&t<=o+r}function xi(e,t=2166136261){let n=t;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return n>>>0}function wi(e){const t=Number.isFinite(e)&&e>0?e:6;return{width:Math.max(8,t),height:t,lineY:t/2}}function ki(e){return{type:"hatch",background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle,...1!==e.lineOpacity?{lineOpacity:e.lineOpacity}:{}}}function Si(){const e="undefined"!=typeof window&&window.devicePixelRatio||1;return Math.min(3,Math.max(1,e))}function Mi(e,t,n,r){t&&"transparent"!==t&&"none"!==t?(e.fillStyle=t,e.fillRect(0,0,n,r)):e.clearRect(0,0,n,r)}function ji(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45,lineOpacity:s=1}=e,l={background:n,stroke:r,lineWidth:i,spacing:o,angle:a,lineOpacity:s},c=wi(o),u=Si(),d=Math.max(1,Math.round(c.width*u)),h=Math.max(1,Math.round(c.height*u));let f;try{p=d,m=h,f="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(p,m):(rm||(rm=document.createElement("canvas")),rm.width=p,rm.height=m,rm)}catch{return ki(l)}var p,m;const g=f.getContext("2d");if(!g)return ki(l);Mi(g,n,d,h);const y=h/c.height,b=Math.max(0,i)*y;g.save(),g.globalAlpha=Math.min(1,Math.max(0,s)),g.fillStyle=r,g.fillRect(0,c.lineY*y-b/2,d,b),g.restore();const v=(t||g).createPattern(f,"repeat");if(!v)return v;const x=a*Math.PI/180,w=Math.cos(x),k=Math.sin(x),S=c.width/d,M=c.height/h;return v.setTransform?.({a:w*S,b:k*S,c:-k*M,d:w*M,e:0,f:0}),v}function Ai(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function Ri(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function Ci(e,t){return`${e}-hatch-${xi(Ri(t)).toString(36)}`}function Li(e,t){const n=e.background??"transparent",r=e.stroke??"#000",i="transparent"===n||"none"===n?n:Fn(t,n)||n,o=Fn(t,r)||r||"#000",a="undefined"!=typeof window&&window.devicePixelRatio||1,s=`${Ri(e)}|${i}|${o}@${a}`,l=om.get(s);if(void 0!==l)return l;const c=ji({background:i,stroke:o,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle,lineOpacity:e.lineOpacity},t),u=Ai(c)?null:c;return om.set(s,u),u}function Ni(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:i=1.5,spacing:o=6,angle:a=45,lineOpacity:s=1}=e,l=wi(o);/* @__PURE__ */ /* @__PURE__ */
|
|
39
|
+
return(0,im.jsxs)("pattern",{id:t,width:l.width,height:l.height,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&"none"!==n&&/* @__PURE__ */ /* @__PURE__ */(0,im.jsx)("rect",{width:l.width,height:l.height,fill:n}),
|
|
40
40
|
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */(0,
|
|
41
|
+
/* @__PURE__ */(0,im.jsx)("line",{x1:0,y1:l.lineY,x2:l.width,y2:l.lineY,stroke:r,strokeWidth:i,...1!==s?{strokeOpacity:s}:{}})]},t)}function Pi(e,t,n="#4e79a7"){if(Ai(e)){const n=Ci(t,e);return{fill:`url(#${n})`,def:Ni(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}function Ei(e,t,n){if(!e||"object"!=typeof e)return;const r=e;if(!Array.isArray(r.stops))return;const i=r.stops.flatMap(e=>{if(!e||"object"!=typeof e)return[];const{offset:t,color:r,opacity:i}=e;return"number"==typeof t&&Number.isFinite(t)?[{offset:Math.max(0,Math.min(1,t)),color:"string"==typeof r&&r?r:n,opacity:"number"==typeof i&&Number.isFinite(i)?Math.max(0,Math.min(1,i)):void 0}]:[]}).sort((e,t)=>e.offset-t.offset);return i.length?{direction:"horizontal"===r.direction?"horizontal":"vertical"===r.direction?"vertical":t,stops:i}:void 0}function Ii(e,t,n,r){const i=Ei(e,n,r);if(!i)return;const{direction:o,stops:a}=i,s=`${t}-gradient`;return{fill:`url(#${s})`,def:/* @__PURE__ */ /* @__PURE__ */(0,im.jsx)("linearGradient",{id:s,x1:0,y1:0,x2:"horizontal"===o?"100%":0,y2:"vertical"===o?"100%":0,children:a.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,im.jsx)("stop",{offset:100*e.offset+"%",stopColor:e.color,stopOpacity:e.opacity},`${e.offset}-${t}`))},s)}}function Ti(e,t,n,r){const i=Pi(e.fill??e.color,t,r),o="string"==typeof e.fill&&e.fill?e.fill:"string"==typeof e.color&&e.color?e.color:r;return Ii(e.gradient,t,n,o)??i}function zi(e,t,n){const r=e.position,i="string"==typeof r&&am.has(r)?r:"bottom-left",o=i.endsWith("left")?"left":i.endsWith("right")?"right":"center",a=i.startsWith("top")?"top":i.startsWith("bottom")?"bottom":"middle",s="top"===a?0:"bottom"===a?n:n/2;return{x:("left"===o?0:"right"===o?t:t/2)+("number"==typeof e.dx&&Number.isFinite(e.dx)?e.dx:0),y:s+("number"==typeof e.dy&&Number.isFinite(e.dy)?e.dy:0),textAnchor:"start"===e.textAnchor||"middle"===e.textAnchor||"end"===e.textAnchor?e.textAnchor:"left"===o?"start":"right"===o?"end":"middle",dominantBaseline:"auto"===e.dominantBaseline||"middle"===e.dominantBaseline||"hanging"===e.dominantBaseline?e.dominantBaseline:"top"===a?"hanging":"bottom"===a?"auto":"middle"}}function Di(e,t,n,r){return{...zi(e,t,n),fill:e.fill??e.color??r.fill,fontSize:e.fontSize??r.fontSize,fontFamily:e.fontFamily??r.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,letterSpacing:e.letterSpacing,opacity:e.opacity,className:e.className,style:{pointerEvents:"none"}}}function $i({annotation:e,width:t,height:n,defaults:r=lm}){const i=e.label??e.text;return null==i?null:/* @__PURE__ */ /* @__PURE__ */(0,sm.jsx)("text",{...Di(e,t,n,r),children:i})}function Fi(e){return!0===e?._annotationDeferred}function Oi(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function _i(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Bi(e){return Math.max(.72,.95-.06*e)}function Wi(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:_i(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Fi(e.annotation)),i=e.some(e=>null!=Oi(e.annotation)),o=e.some(e=>"layer"===Oi(e.annotation));if(!n&&!r&&!i)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=um[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:i}=e,o=Fi(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=i){const e=null==r&&null!=i,o=e?"annotation-emphasis annotation-emphasis--inferred":`annotation-emphasis annotation-emphasis--${r}`;a=/* @__PURE__ */ /* @__PURE__ */(0,cm.jsx)("g",{className:o,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Bi(i),"data-annotation-reading-order":i}:{},children:t.node},`annotation-emphasis-${n}`)}const s=Oi(t.annotation);return s&&(a=/* @__PURE__ */ /* @__PURE__ */(0,cm.jsx)("g",{className:`annotation-cohesion--${s}`,children:a},`annotation-cohesion-${n}`)),o&&(a=/* @__PURE__ */ /* @__PURE__ */(0,cm.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},`annotation-deferred-${n}`)),a});return r&&s.unshift(
|
|
42
42
|
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */(0,
|
|
43
|
+
/* @__PURE__ */(0,cm.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),o&&s.unshift(
|
|
44
44
|
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */(0,
|
|
46
|
-
return(0,
|
|
47
|
-
return(0,
|
|
45
|
+
/* @__PURE__ */(0,cm.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}function Hi(e,t,n,r){return qi(e,t,n,r).nodes}function qi(e,t,n,r){const i=[];return e.forEach((e,o)=>{let a;if(n){const i=n(e,o,r);a=null!=i?i:t(e,o,r)}else a=t(e,o,r);a&&i.push({node:a,annotation:e})}),{nodes:Wi(i),renderedAnnotations:i.map(e=>e.annotation)}}function Gi(e,t){const n=ri(e,t);return null!=n&&Number.isFinite(n)?n:Number.NaN}function Vi(e,t={},n=!1){return function(e,r,i){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=bi(e,r,i);if(!t)return null;const{x:n,y:o}=t;if(!vi(n,o,i))return null;const a="callout"===e.type?"callout-circle":e.type,s="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;/* @__PURE__ */ /* @__PURE__ */
|
|
46
|
+
return(0,dm.jsx)(Wr,{noteData:{x:n,y:o,dx:e.dx??30,dy:e.dy??-30,note:Tr(e),type:a,...s?{subject:s}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},`ann-${r}`)}case"x-threshold":case"y-threshold":{const t="x-threshold"===e.type,n=null!=e.value?{...e,[t?"x":"y"]:e.value}:e,o=t?ui(n,i):di(n,i);return null==o?null:/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Ir,{ann:e,position:o,vertical:t,width:i.width||0,height:i.height||0,color:e.color||"#f97316",bold:!0},`ann-${r}`)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:ui({...e,type:"point"},i),y:di({...e,type:"point"},i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(t.length<2)return null;const n=(0,Zp.packEnclose)(t),o=e.padding||10;/* @__PURE__ */ /* @__PURE__ */
|
|
47
|
+
return(0,dm.jsxs)("g",{children:[
|
|
48
48
|
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */(0,
|
|
50
|
-
return(0,
|
|
49
|
+
/* @__PURE__ */(0,dm.jsx)("circle",{cx:n.x,cy:n.y,r:n.r+o,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Nr,{x:n.x,y:n.y-n.r-o-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},`ann-${r}`)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:ui({...e,type:"point"},i),y:di({...e,type:"point"},i)})).filter(e=>null!=e.x&&null!=e.y);if(t.length<2)return null;const n=e.padding||10,o=t.map(e=>e.x),a=t.map(e=>e.y),[s,l]=cn(o),[c,u]=cn(a),d=s-n,h=l+n,f=c-n,p=u+n;/* @__PURE__ */ /* @__PURE__ */
|
|
50
|
+
return(0,dm.jsxs)("g",{children:[
|
|
51
51
|
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */(0,
|
|
53
|
-
return(0,
|
|
54
|
-
return(0,
|
|
55
|
-
return(0,
|
|
56
|
-
return(0,
|
|
52
|
+
/* @__PURE__ */(0,dm.jsx)("rect",{x:d,y:f,width:h-d,height:p-f,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Nr,{x:(d+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},`ann-${r}`)}case"highlight":{const t=i.data||[],n="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],o={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};/* @__PURE__ */ /* @__PURE__ */
|
|
53
|
+
return(0,dm.jsx)("g",{children:n.map((t,n)=>{const r=ui(t,i),a=di(t,i);if(null==r||null==a)return null;const s="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||o;/* @__PURE__ */ /* @__PURE__ */
|
|
54
|
+
return(0,dm.jsx)("circle",{cx:r,cy:a,r:s,...l},`hl-${n}`)})},`ann-${r}`)}case"bracket":{const t=ui(e,i),n=di(e,i);/* @__PURE__ */ /* @__PURE__ */
|
|
55
|
+
return(0,dm.jsx)(Wr,{noteData:{x:t??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:Tr(e),type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},`ann-${r}`)}case"trend":{const t=ci(e,i);if(t.length<2)return null;const n=t.map(([e,t])=>`${e},${t}`).join(" "),o=e.color||"#6366f1",[a,s]=t[t.length-1];/* @__PURE__ */ /* @__PURE__ */
|
|
56
|
+
return(0,dm.jsxs)("g",{children:[
|
|
57
57
|
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */(0,
|
|
59
|
-
return(0,
|
|
60
|
-
return(0,
|
|
61
|
-
return(0,
|
|
58
|
+
/* @__PURE__ */(0,dm.jsx)("polyline",{points:n,fill:"none",stroke:o,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("text",{x:a+4,y:s-4,fill:o,fontSize:11,children:e.label})]},`ann-${r}`)}case"band":{const t=i.scales?.y??i.scales?.value,o=ti(t,e.y0,0),a=ti(t,e.y1,1);if(t&&(null!=e.y0&&null==o||null!=e.y1&&null==a))return null;const s=o??0,l=a??(i.height||0),c=Ti(e,`ann-${r}`,"vertical","var(--semiotic-primary, #6366f1)"),u=n&&"under"===e.layer;/* @__PURE__ */ /* @__PURE__ */
|
|
59
|
+
return(0,dm.jsxs)("g",{opacity:e.opacity,children:[!u&&c.def&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("defs",{children:c.def}),!u&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("rect",{x:0,y:Math.min(s,l),width:i.width||0,height:Math.abs(l-s),fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Nr,{x:(i.width||0)-4,y:Er(s,l),textAnchor:"end",fill:e.labelColor??(e.color||"var(--semiotic-primary, #6366f1)"),fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},`ann-${r}`)}case"x-band":{const t=i.scales?.x??i.scales?.time,o=ti(t,e.x0,0),a=ti(t,e.x1,1);if(null!=e.x0&&null==o||null!=e.x1&&null==a)return null;const s=o??0,l=a??(i.width||0),c=Ti(e,`ann-${r}`,"horizontal","var(--semiotic-primary, #6366f1)"),u=n&&"under"===e.layer;/* @__PURE__ */ /* @__PURE__ */
|
|
60
|
+
return(0,dm.jsxs)("g",{opacity:e.opacity,children:[!u&&c.def&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("defs",{children:c.def}),!u&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("rect",{x:Math.min(s,l),y:0,width:Math.abs(l-s),height:i.height||0,fill:c.fill,fillOpacity:e.fillOpacity??.1}),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Nr,{x:Math.min(s,l)+4,y:16,textAnchor:"start",fill:e.labelColor??(e.color||"var(--semiotic-primary, #6366f1)"),fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},`ann-${r}`)}case"envelope":{const t=i.data||[];if(t.length<2)return null;const n=i.xAccessor||"x",o=i.scales?.x??i.scales?.time,a=i.scales?.y??i.scales?.value;if(!o||!a)return null;const s=e=>Gi(o,e),l=e=>Gi(a,e),c=e.upperAccessor||"upperBounds",u=e.lowerAccessor||"lowerBounds",d=e.filter,h=t.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[n]-t[n]);if(h.length<2)return null;const f=hm[i.curve||"linear"]||Kp.curveLinear,p=(0,Kp.area)().x(e=>s(e[n])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(f)(h);if(!p)return null;const m=e.fill||"#6366f1";/* @__PURE__ */ /* @__PURE__ */
|
|
61
|
+
return(0,dm.jsxs)("g",{children:[
|
|
62
62
|
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */(0,
|
|
64
|
-
return(0,
|
|
65
|
-
return(0,
|
|
63
|
+
/* @__PURE__ */(0,dm.jsx)("path",{d:p,fill:m,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&h.length>0&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("text",{x:s(h[h.length-1][n])+4,y:l(h[h.length-1][c])-4,fill:m,fontSize:11,children:e.label})]},`ann-${r}`)}case"anomaly-band":{const t=(i.data||[]).filter(t=>!e.filter||e.filter(t));if(t.length<2)return null;const n=i.yAccessor||"y",o=i.scales?.x??i.scales?.time,a=i.scales?.y??i.scales?.value;if(!o||!a)return null;const s=e=>Gi(a,e),l=t.map(e=>Hr(e[n])).filter(e=>null!==e);if(l.length<2)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+(t-c)**2,0)/l.length,d=Math.sqrt(u),h=e.threshold??2,f=c+h*d,p=c-h*d,m=!1!==e.showBand,g=e.fill||"#6366f1",y=e.fillOpacity??.1,b=e.anomalyColor||"#ef4444",v=e.anomalyRadius??6,x=s(f),w=s(p),k=t.filter(e=>{const t=Hr(e[n]);return null!=t&&Math.abs(t-c)>h*d});/* @__PURE__ */ /* @__PURE__ */
|
|
64
|
+
return(0,dm.jsxs)("g",{children:[m&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("rect",{x:0,y:Math.min(x,w),width:i.width||0,height:Math.abs(w-x),fill:g,fillOpacity:y}),k.map((e,t)=>{const n=ui(e,i),r=di(e,i);return null==n||null==r?null:/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("circle",{cx:n,cy:r,r:v,fill:b,fillOpacity:.7,stroke:b,strokeWidth:1.5},`anomaly-${t}`)}),e.label&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("text",{x:(i.width||0)-4,y:Math.min(x,w)-4,textAnchor:"end",fill:g,fontSize:11,children:e.label})]},`ann-${r}`)}case"forecast":{const t=i.data||[],n=i.xAccessor||"x",o=i.yAccessor||"y",a=i.scales?.x??i.scales?.time,s=i.scales?.y??i.scales?.value;if(!a||!s)return null;const l=e=>Gi(a,e),c=e=>Gi(s,e),u=qr(t.map(e=>[e[n],e[o]])),d=Kr(u,e);if(!d)return null;const{predict:h}=d,f=u[u.length-1][0],p=d.forecast(e.steps??5);if(!p.length)return null;const m=(0,Kp.area)().x(e=>l(e.x)).y0(e=>c(e.lower)).y1(e=>c(e.upper))(p);if(!m)return null;const g=p.map(e=>`${l(e.x)},${c(e.y)}`).join(" "),y=`${l(f)},${c(h(f))}`,b=e.fill||"#6366f1",v=e.strokeColor||"#6366f1";/* @__PURE__ */ /* @__PURE__ */
|
|
65
|
+
return(0,dm.jsxs)("g",{children:[
|
|
66
66
|
/* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */(0,
|
|
67
|
+
/* @__PURE__ */(0,dm.jsx)("path",{d:m,fill:b,fillOpacity:e.fillOpacity??.15,stroke:"none"}),
|
|
68
68
|
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */(0,
|
|
70
|
-
return(0,
|
|
69
|
+
/* @__PURE__ */(0,dm.jsx)("polyline",{points:`${y} ${g}`,fill:"none",stroke:v,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&p.length>0&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("text",{x:l(p[p.length-1].x)+4,y:c(p[p.length-1].y)-4,fill:v,fontSize:11,children:e.label})]},`ann-${r}`)}case"widget":{let n,o;if(null!=e.px&&null!=e.py)n=e.px,o=e.py;else{const t=bi(e,r,i);if(!t)return null;n=t.x,o=t.y}if(!vi(n,o,i))return null;const a=e.dx??0,s=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});/* @__PURE__ */ /* @__PURE__ */
|
|
70
|
+
return(0,dm.jsx)("foreignObject",{x:n+a-l/2,y:o+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("div",{...jr(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},`ann-${r}`)}case"text":{const t=bi(e,r,i);if(!t)return null;const{x:n,y:o}=t,a=n+(e.dx||0),s=o+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)("text",{x:a,y:s,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Yp.cloneElement(c,{key:`ann-text-${r}`}):/* @__PURE__ */ /* @__PURE__ */(0,dm.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[
|
|
71
71
|
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */(0,
|
|
73
|
-
return(0,
|
|
72
|
+
/* @__PURE__ */(0,dm.jsx)("line",{x1:n,y1:o,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Yp.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},`ann-text-${r}`)}case"frame-text":/* @__PURE__ */ /* @__PURE__ */
|
|
73
|
+
return(0,dm.jsx)($i,{annotation:e,width:i.width||0,height:i.height||0},`ann-frame-text-${r}`);case"category-highlight":{const t=e.category;if(null==t)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,o=i.scales?.o,a=i.scales?.x,s=i.scales?.y,l=n(o)?o:n(a)?a:n(s)?s:null;if(!l)return null;const c=l(String(t));if(null==c)return null;const u=l.bandwidth(),d=i.projection?"vertical"===i.projection:l===a,h=e.color||"var(--semiotic-primary, #4589ff)",f=e.opacity??.15,p=e.label;return d?/* @__PURE__ */ /* @__PURE__ */(0,dm.jsxs)("g",{children:[
|
|
74
74
|
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */(0,
|
|
75
|
+
/* @__PURE__ */(0,dm.jsx)("rect",{x:c,y:0,width:u,height:i.height||0,fill:h,fillOpacity:f}),p&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Nr,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:p,background:e.labelBackground??"none"})]},`ann-${r}`):/* @__PURE__ */ /* @__PURE__ */(0,dm.jsxs)("g",{children:[
|
|
76
76
|
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */(0,
|
|
78
|
-
return(0,
|
|
79
|
-
return(0,
|
|
80
|
-
return(0,
|
|
77
|
+
/* @__PURE__ */(0,dm.jsx)("rect",{x:0,y:c,width:i.width||0,height:u,fill:h,fillOpacity:f}),p&&/* @__PURE__ */ /* @__PURE__ */(0,dm.jsx)(Nr,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:p,background:e.labelBackground??"none"})]},`ann-${r}`)}default:return null}}}function Ui(e){return"string"==typeof e?.type?e.type:""}function Yi(e){return!!e&&"object"==typeof e&&fm.has(Ui(e))}function Xi(e,t,n){return Math.max(t,Math.min(n,e))}function Zi(e){return"primary"===e?.emphasis||!0===e?.defensive}function Ki(e,t,n={}){if("number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations))return Math.max(0,Math.floor(n.maxAnnotations));if(!(e>0&&t>0))return 1/0;const r=n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4;return Math.max(1,Math.round(e*t/r))}function Qi(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Xi(r,0,1)),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}function Ji(e){const{annotations:t,width:n,height:r}=e,i=Math.max(0,e.minVisible??1),o=Ki(n,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,Yi(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||s.length<=o)return{visible:t.slice(),deferred:[],budget:o};const l=s.filter(e=>Zi(e.annotation)),c=s.filter(e=>!Zi(e.annotation)).sort((e,t)=>Qi(t.annotation)-Qi(e.annotation)||e.index-t.index),u=Math.max(0,o-l.length),d=Math.max(0,i-l.length),h=Math.min(c.length,Math.max(u,d)),f=/* @__PURE__ */new Set([...l.map(e=>e.index),...c.slice(0,h).map(e=>e.index)]),p=[],m=[];for(const{annotation:e,index:t,note:n}of a)!n||f.has(t)?p.push(e):m.push(e);return{visible:p,deferred:m,budget:o}}function eo(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}function to(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}function no(e){if(!e)return 1;const t=to(e);return t<=2?1.5:t>=4?.6:1}function ro(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Object.prototype.hasOwnProperty.call(vm,t.source)?vm[t.source]:t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?`${Math.round(100*Math.max(0,Math.min(1,t.confidence)))}%`:null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[n,r].filter(Boolean).join(" · "),o="string"==typeof e.label?e.label:"";return o.includes(`(${i})`)?e:{...e,label:o?`${o} (${i})`:`(${i})`}}function io(e,t){let n=!1;const r=e.map(e=>so(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}function oo(e){if(!so(e))return e;const t="string"==typeof e.mobileText?e.mobileText:void 0,n="string"==typeof e.shortText?e.shortText:void 0,r=t??n;return!r||"string"!=typeof e.label&&null!=e.label?e:{...e,label:r}}function ao(e){if("text"!==e.type||"string"!=typeof e.color)return e;const t="number"==typeof e.dx?e.dx:0,n="number"==typeof e.dy?e.dy:0;return Math.hypot(t,n)<8?e:{...e,_redundantConnector:!0}}function so(e){return Yi(e)}function lo(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t=zr(e);if(t)return{width:Math.max(24,t.width+10),height:Math.max(18,t.height+6)};const n="number"==typeof e.wrap?e.wrap:120,r=[...Dr("string"==typeof e.title?e.title:void 0,n,7),...Dr("string"==typeof e.label?e.label:void 0,n,7)],i=r.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(n,7*i)+10),height:Math.max(18,16*r.length+6)}}function co(e,t,n,r,i){const o=e+n,a=t+r;return Math.abs(n)>Math.abs(r)?{x:n>=0?o+4:o-i.width-4,y:r<0?a-i.height:a,width:i.width,height:i.height}:{x:n>=0?o:o-i.width,y:r<0?a-i.height-4:a+4,width:i.width,height:i.height}}function uo(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function ho(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function fo(e,t,n,r){const i=Math.max(0,r-e.x),o=Math.max(0,r-e.y),a=Math.max(0,e.x+e.width-(t-r)),s=Math.max(0,e.y+e.height-(n-r));return(i+a)*e.height+(o+s)*e.width}function po(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}function mo(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}function go(e,t,n,r,i,o,a,s){const l=uo(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*fo(l,i,o,s);for(const e of n)c+=12*ho(l,e);for(const e of r)c+=4*ho(l,e);return c}function yo(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const i=e.coordinates,o=n.scales?.geoProjection;if(Array.isArray(i)&&i.length>=2&&o){const e=i[0],t=i[1];if("number"==typeof e&&"number"==typeof t){const n=o([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?bi(e,t,n):{x:e.x,y:e.y}}function bo(e){const{annotations:t,context:n,defaultOffset:r=pm,notePadding:i=mm,markPadding:o=gm,edgePadding:a=ym,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=bm,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:g}=e,y=n.width||0,b=n.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&y<=x,k=w&&!1!==v.preferShortText?t.map(oo):t,S=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,M=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),j=w&&!f?v.responsive??{minWidth:x}:f,A=w&&!m?v.cohesion:m;if(0===k.length||y<=0||b<=0)return k.slice();const R=[],C=mo(n,o);let L=!1;const N=k.map((e,t)=>{if(!so(e))return e;const o=yo(e,t,n);if(!o)return e;const u=lo(!0===e.defensive?ro(e):e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=eo(e),n="number"==typeof e.dx?e.dx:t.dx,r="number"==typeof e.dy?e.dy:t.dy;return R.push(uo(co(o.x,o.y,n,r,u),i)),e}var d;let h=null,f=1/0;for(const e of po(r)){const t=go(co(o.x,o.y,e.dx,e.dy,u),e,R,C,y,b,i,a);t<f&&(h=e,f=t)}if(!h)return e;const p=uo(co(o.x,o.y,h.dx,h.dy,u),i);R.push(p);const m=Math.hypot(h.dx,h.dy),g=l&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return L=!0,{...e,dx:h.dx,dy:h.dy,...g?{connector:g}:{}}}),P=L?N:k.slice();let E=P;if(h){let e=!1;const t=P.map(t=>{const n=ao(t);return n!==t&&(e=!0),n});E=e?t:P}{let e=!1;const t=E.map(t=>{if(!0!==t?.defensive)return t;const n=ro(t);return n!==t&&(e=!0),n});E=e?t:E}const I=/* @__PURE__ */new Set;if(S){const e="object"==typeof S?S:{},t=no(g),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Ki(y,b,e))*t))},{deferred:r}=Ji({annotations:E,width:y,height:b,...n});for(const e of r)I.add(e)}if(j){const e="object"==typeof j&&"number"==typeof j.minWidth?j.minWidth:480;if(y<=e)for(const e of E)so(e)&&"secondary"===e.emphasis&&I.add(e)}if(I.size>0)for(const e of E)!0===e?.defensive&&I.delete(e);let T;return T=0===I.size?E:M?E.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):E.filter(e=>!I.has(e)),A?io(T,A):T}function vo(e,t={}){const n=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,i=/* @__PURE__ */new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&i.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!n)return!1;const t=e?.provenance?.stableId;return!(t&&i.has(t)&&!r)})}function xo(e,t){const{key:n,currentTarget:r}=e,i=t?"ArrowRight":"ArrowDown";if(n!==(t?"ArrowLeft":"ArrowUp")&&n!==i&&"Home"!==n&&"End"!==n)return;e.preventDefault();const o=Array.from(r.closest("[role='listbox']")?.querySelectorAll("[role='option']")??[]),a="Home"===n?0:"End"===n?o.length-1:(o.indexOf(r)+(n===i?1:-1)+o.length)%o.length;o[a]?.focus()}function wo({config:e,orientation:t="vertical",width:n=100,customClickBehavior:r,customHoverBehavior:i,highlightedCategory:o,isolatedCategories:a,legendInteraction:s}){const{colorFn:l,domain:c,label:u,format:d}=e,h="horizontal"===t,f=d||Hn(c),p=`grad-legend-${Sm.useId()}`,m=!(!r&&!i),g="isolate"===s||void 0===s&&null!=a,[y,b]=Sm.useState(0),[v,x]=Sm.useState(null),w=e=>{const t=h?e:5-e-1,n=c[0]+t/5*(c[1]-c[0]),r=c[0]+(t+1)/5*(c[1]-c[0]);return{label:`${f(n)} – ${f(r)}`,valueRange:[n,r],interactionKey:`${n}:${r}`}},k=(e,t,n)=>{const s="string"==typeof e.interactionKey?e.interactionKey:e.label,l=a?.has(s)??!1,c=o===s,u=v===n,d=a?.size&&!l||null!=o&&!c;/* @__PURE__ */ /* @__PURE__ */
|
|
78
|
+
return(0,Mm.jsx)("rect",{className:"semiotic-gradient-legend-bin",...t,fill:d?"rgba(255,255,255,0.65)":"transparent",stroke:u||l||c?"var(--semiotic-focus, #005fcc)":"transparent",strokeWidth:u?3:2,tabIndex:n===y?0:-1,role:"option","aria-label":e.label,"aria-selected":g?l:void 0,"aria-current":!(g||!c)||void 0,onClick:r?()=>r(e):void 0,onMouseEnter:i?()=>i(e):void 0,onMouseLeave:i?()=>i(null):void 0,onFocus:()=>{b(n),x(n),i?.(e)},onBlur:()=>{x(null),i?.(null)},onKeyDown:t=>{if(("Enter"===t.key||" "===t.key)&&r)return t.preventDefault(),void r(e);xo(t,h)},style:{cursor:"pointer",pointerEvents:"all"}},`gradient-interaction-${n}`)},[S,M]=c,j=Sm.useMemo(()=>Array.from({length:65},(e,t)=>{const n=t/64,r=h?S+n*(M-S):M-n*(M-S);/* @__PURE__ */ /* @__PURE__ */
|
|
79
|
+
return(0,Mm.jsx)("stop",{offset:n,stopColor:l(r)},t)}),[l,S,M,h]),A=h?Math.min(n,200):14,R=h?12:100,C=h?Math.max(0,(n-A)/2):0,L=u?18:0;/* @__PURE__ */ /* @__PURE__ */
|
|
80
|
+
return(0,Mm.jsxs)("g",{"aria-label":u||"Gradient legend",role:m?"listbox":void 0,"aria-orientation":m?t:void 0,"aria-multiselectable":!(!m||!g)||void 0,style:wm,children:[
|
|
81
81
|
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */(0,
|
|
82
|
+
/* @__PURE__ */(0,Mm.jsx)("defs",{children:/* @__PURE__ */ /* @__PURE__ */(0,Mm.jsx)("linearGradient",{id:p,x1:"0%",y1:"0%",x2:h?"100%":"0%",y2:h?"0%":"100%",children:j})}),u&&/* @__PURE__ */ /* @__PURE__ */(0,Mm.jsx)("text",{x:h?C+A/2:0,y:12,textAnchor:h?"middle":"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:u}),
|
|
83
83
|
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */(0,
|
|
85
|
-
return(0,
|
|
86
|
-
return(0,
|
|
84
|
+
/* @__PURE__ */(0,Mm.jsx)("rect",{x:C,y:L,width:A,height:R,fill:`url(#${p})`,rx:2}),m&&Array.from({length:5},(e,t)=>k(w(t),{x:h?C+t*A/5:0,y:h?L:L+t*R/5,width:h?A/5:A,height:h?R:R/5},t)),[0,1].map(e=>/* @__PURE__ */ /* @__PURE__ */(0,Mm.jsx)("text",{x:h?C+e*A:A+5,y:L+(h?R+12:e?R:10),textAnchor:h?e?"end":"start":void 0,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:f(c[h?e:1-e])},e))]})}function ko(e,t,n,r,i){if("function"==typeof n)return n(e);const o=r(e,t);return"fill"===n?/* @__PURE__ */ /* @__PURE__ */(0,jm.jsx)("rect",{style:o,width:i,height:i}):/* @__PURE__ */ /* @__PURE__ */(0,jm.jsx)("line",{style:o,x1:0,y1:0,x2:i,y2:i})}function So({swatchSize:e}){/* @__PURE__ */ /* @__PURE__ */
|
|
85
|
+
return(0,jm.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Mo(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function jo(e,t,n,r,i){const{legendGroup:{type:o="fill",styleFn:a},customClickBehavior:s,customHoverBehavior:l,highlightedCategory:c,isolatedCategories:u,focusedGroupIndex:d,focusedItemIndex:h,groupIndex:f,onFocusedIndexChange:p,interactive:m,useIsolateAria:g,metrics:{swatchSize:y,labelGap:b}}=e,v=!!u?.size&&u.has(t.label);/* @__PURE__ */ /* @__PURE__ */
|
|
86
|
+
return(0,jm.jsxs)("g",{transform:r,onClick:s?()=>s(t):void 0,onMouseEnter:l?()=>l(t):void 0,onMouseLeave:l?()=>l(null):void 0,tabIndex:m?f===d&&n===h?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?v:void 0,"aria-label":t.label,onKeyDown:m?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s?.(t)),xo(e,i)}:void 0,onFocus:m?e=>{p(f,n),l?.(t),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{l?.(null),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:Mo(t,c,u),transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&/* @__PURE__ */ /* @__PURE__ */(0,jm.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+b+2+7*t.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),ko(t,n,o,a,y),v&&/* @__PURE__ */ /* @__PURE__ */(0,jm.jsx)(So,{swatchSize:y}),
|
|
87
87
|
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */(0,
|
|
89
|
-
return(0,
|
|
90
|
-
return(0,
|
|
88
|
+
/* @__PURE__ */(0,jm.jsx)("text",{y:y/2,x:y+b,dominantBaseline:"central",fontSize:12,style:km,fill:"var(--semiotic-text, #333)",children:t.label})]},`legend-item-${n}`)}function Ao(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=ir(d),[f,p]=xm.useState({group:0,item:0}),m=xm.useRef(null),g=xm.useRef(null),y=t||[],b=y[f.group]?.items.length?f.group:y.findIndex(e=>e.items.length>0),v=Math.min(f.item,(y[b]?.items.length??1)-1);xm.useEffect(()=>{const e=g.current;e&&!e.isConnected&&document.activeElement===document.body&&m.current?.querySelector("[tabindex='0']")?.focus()});const x=xm.useCallback((e,t)=>{p({group:e,item:t})},[]),w=Boolean(n||r),k={customClickBehavior:n,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:o,focusedGroupIndex:b,focusedItemIndex:v,onFocusedIndexChange:x,interactive:w,useIsolateAria:"isolate"===a||void 0===a&&null!=o,metrics:h},S="vertical"===u?Cm(y,l,k):Lm(y,l,c,k);/* @__PURE__ */ /* @__PURE__ */
|
|
89
|
+
return(0,jm.jsxs)("g",{ref:m,onFocusCapture:e=>{e.target instanceof SVGElement&&"option"===e.target.getAttribute("role")&&(g.current=e.target)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(g.current=null)},role:w?"listbox":void 0,"aria-multiselectable":!(!w||!k.useIsolateAria)||void 0,"aria-label":"string"==typeof s&&s?s:"Chart legend","aria-orientation":w?"vertical"===u?"vertical":"horizontal":void 0,style:wm,children:[void 0!==s&&""!==s&&"vertical"===u&&/* @__PURE__ */ /* @__PURE__ */(0,jm.jsx)("text",{className:"legend-title","aria-hidden":w||void 0,y:16,x:l/2,textAnchor:"middle",fontSize:12,style:km,fill:"var(--semiotic-text, #333)",children:s}),S]})}function Ro(e){const{legend:t,totalWidth:n,totalHeight:r,margin:i,legendPosition:o="right",legendLayout:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;const{x:h,y:f,width:p}=rr(t,{totalWidth:n,totalHeight:r,margin:i,position:o,legendLayout:a,axisChrome:e.axisChrome}),m="top"===o||"bottom"===o;/* @__PURE__ */ /* @__PURE__ */
|
|
90
|
+
return(0,Nm.jsx)("g",{transform:`translate(${h}, ${f})`,children:Vn(t)?/* @__PURE__ */ /* @__PURE__ */(0,Nm.jsx)(wo,{config:t.gradient,orientation:m?"horizontal":"vertical",width:p,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):Gn(t)?/* @__PURE__ */ /* @__PURE__ */(0,Nm.jsx)(Ao,{legendGroups:t.legendGroups,title:"",width:p,orientation:m?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t})}function Co({title:e,totalWidth:t,marginTop:n}){return e?"string"!=typeof e?/* @__PURE__ */ /* @__PURE__ */(0,Pm.jsx)("foreignObject",{x:0,y:0,width:t,height:n,children:e}):/* @__PURE__ */ /* @__PURE__ */(0,Pm.jsx)("text",{x:t/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)",fontFamily:"var(--semiotic-title-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-title-font-weight, bold)"},children:e}):null}function Lo(e,t){return"string"==typeof e&&e.length>0?e:t}function No(e,t,n){return"string"==typeof t&&t.length>0?t:"string"==typeof e&&e.length>0?`${e} (${n.familyPhrase})`:n.fallback}function Po(e){const t=String(e).replace(/[^a-zA-Z0-9_-]/g,"_"),n=/^[A-Za-z_]/.test(t)?t:`c${t}`,r=`${n}-semiotic-title`,i=`${n}-semiotic-desc`;return{titleId:r,descId:i,labelledBy:`${r} ${i}`}}function Eo(e){const{width:t,height:n,totalWidth:r,totalHeight:i,margin:o,showAxes:a,title:s,description:l,idPrefix:c,decorative:u=!1,legend:d,legendHoverBehavior:h,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:m,legendPosition:g,legendLayout:y,foregroundGraphics:b,annotations:v,onAnnotationActivate:x,onObservation:w,chartId:k,chartType:S,autoPlaceAnnotations:M,svgAnnotationRules:j,pointNodes:A,geoProjection:R}=e,C=Sr({onAnnotationActivate:x,onObservation:w,chartId:k,chartType:S}),L=(0,Wp.useRef)([v?.length??0,/* @__PURE__ */new Map]),N=v?.length??0;L.current[0]!==N&&(L.current=[N,/* @__PURE__ */new Map]);const P=(0,Wp.useMemo)(()=>{if(!v||0===v.length)return null;const e=vo(v),r=R?e.map(e=>{if(!Array.isArray(e.coordinates)||e.coordinates.length<2)return e;const t=R(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,i={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:A,stickyPositionCache:L.current[1]};return Hi(M?bo({annotations:r,context:i,..."object"==typeof M?M:{}}):r,Vi(0,C),j,i)},[v,M,j,t,n,A,C,R]),E=a||s||l||d||b||P&&P.length>0,I=(0,Wp.useId)(),{titleId:T,descId:z,labelledBy:D}=Po(c||k||I);return E?/* @__PURE__ */ /* @__PURE__ */(0,Em.jsxs)("svg",{"data-semiotic-overlay":"",role:u?"presentation":"img","aria-labelledby":u?void 0:D,width:r,height:i,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[!u&&/* @__PURE__ */ /* @__PURE__ */(0,Em.jsxs)(Em.Fragment,{children:[
|
|
91
91
|
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */(0,
|
|
92
|
+
/* @__PURE__ */(0,Em.jsx)("title",{id:T,children:Lo(s,"Geographic chart")}),
|
|
93
93
|
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */(0,
|
|
94
|
+
/* @__PURE__ */(0,Em.jsx)("desc",{id:z,children:No(s,l,{familyPhrase:"geographic data visualization",fallback:"geographic data visualization"})})]}),
|
|
95
95
|
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */(0,
|
|
96
|
+
/* @__PURE__ */(0,Em.jsxs)("g",{transform:"translate("+o.left+","+o.top+")",children:[P,b]}),
|
|
97
97
|
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */(0,
|
|
99
|
-
return(0
|
|
100
|
-
return(0,
|
|
98
|
+
/* @__PURE__ */(0,Em.jsx)(Co,{title:s,totalWidth:r,marginTop:o.top}),Ro({legend:d,totalWidth:r,totalHeight:i,margin:o,legendPosition:g,title:s,legendLayout:y,legendHoverBehavior:h,legendClickBehavior:f,legendHighlightedCategory:p,legendIsolatedCategories:m})]}):null}function Io(e,t){const[n,r]=e.viewBox??Tm,[i,o]=e.anchor??zm,a=r>0?r:1,s=Math.max(0,t)/a,l=(n>0?n:a)*s,c=a*s;return{width:l,height:c,scale:s,offsetX:-i*l,offsetY:-o*c}}function To(e,t){const n=Io(e,t),r=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let i=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>i&&(i=n)}return i}function zo(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}function Do(e){if("undefined"==typeof Path2D)return null;Dm||(Dm=/* @__PURE__ */new Map);const t=Dm.get(e);if(t)return t;const n=new Path2D(e);return Dm.size>1024&&Dm.clear(),Dm.set(e,n),n}function $o(e,t,n=0,r="horizontal"){const[i,o]=e.viewBox??Tm,a=Math.min(1,Math.max(0,n)),s=Math.min(1,Math.max(0,t));return s<=a?{x:0,y:0,width:0,height:0}:a<=0&&s>=1?null:"vertical"===r?{x:0,y:o*(1-s),width:i,height:o*(s-a)}:{x:i*a,y:0,width:i*(s-a),height:o}}function Fo(e,t){const n=Io(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function Oo(e,t,n,r,i,o=e=>e){for(const a of t.parts){const t=Do(a.d);if(!t)continue;const s=a.opacity??1,l=e.globalAlpha;1!==s&&(e.globalAlpha=l*s);const c=i?"none"===a.fill?void 0:i:zo(a.fill,n,r);c&&(e.fillStyle=o(c),e.fill(t));const u=i?a.stroke&&"none"!==a.stroke?i:void 0:zo(a.stroke??"none",n,r);u&&(e.strokeStyle=o(u),e.lineWidth=a.strokeWidth??1,e.lineCap=a.strokeLinecap??"butt",e.lineJoin=a.strokeLinejoin??"miter",e.stroke(t)),1!==s&&(e.globalAlpha=l)}}function _o(e,t="#4e79a7"){return Ai(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function Bo(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?`s_${t}`:t}function Wo(e,t,n,r){const i=e.glyph;if(!i?.parts?.length||e.size<=0)return null;const o=Io(i,e.size);if(o.scale<=0)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${o.offsetX},${o.offsetY}) scale(${o.scale})`,s=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=$o(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?Bo(`${r}-clip`):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>i.parts.map((n,r)=>{const i=t?"none"===n.fill?void 0:t:zo(n.fill,s,e.accent),o=t?n.stroke&&"none"!==n.stroke?t:void 0:zo(n.stroke??"none",s,e.accent);return i||o?/* @__PURE__ */ /* @__PURE__ */(0,$m.jsx)("path",{d:n.d,fill:i??"none",stroke:o,strokeWidth:o?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});/* @__PURE__ */ /* @__PURE__ */
|
|
99
|
+
return(0,$m.jsxs)("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&/* @__PURE__ */ /* @__PURE__ */(0,$m.jsx)("clipPath",{id:c,children:/* @__PURE__ */ /* @__PURE__ */(0,$m.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?/* @__PURE__ */ /* @__PURE__ */(0,$m.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?/* @__PURE__ */ /* @__PURE__ */(0,$m.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}function Ho(e){if(!1!==e?.interactive)return e?.style?.cursor}function qo(e){if(!e)return!1;for(const t of e)if(Ho(t))return!0;return!1}function Go(e,t){if(!e)return;const n=t??"";e.style.cursor!==n&&(e.style.cursor=n)}function Vo(e){const t=Fm.useRef(null);Fm.useEffect(()=>{e.current&&(t.current=e.current)}),Fm.useEffect(()=>()=>Go(t.current),[])}function Uo(e,t,n){const r=Ho(t);return r&&null!=e&&!1!==e?/* @__PURE__ */ /* @__PURE__ */(0,Om.jsx)("g",{style:{cursor:r},"data-semiotic-mark-cursor":r,children:e},n):e}function Yo(e,t){return Uo(Xo(e,t),e,`geo-cursor-${t}`)}function Xo(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=Ai(n.style.fill)?Ni(n.style.fill,`geoarea-${t}-hatch`):void 0;/* @__PURE__ */ /* @__PURE__ */
|
|
100
|
+
return(0,_m.jsxs)(Im.Fragment,{children:[r&&/* @__PURE__ */ /* @__PURE__ */(0,_m.jsx)("defs",{children:r}),
|
|
101
101
|
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */(0,
|
|
103
|
-
return(0,
|
|
102
|
+
/* @__PURE__ */(0,_m.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:_o(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth??.5,strokeDasharray:n.style.strokeDasharray,opacity:(n.style.opacity??1)*(n._decayOpacity??1)})]},`geoarea-${t}`)}case"point":{const n=e,r=Ai(n.style.fill)?Ni(n.style.fill,`geopoint-${t}-hatch`):void 0;/* @__PURE__ */ /* @__PURE__ */
|
|
103
|
+
return(0,_m.jsxs)(Im.Fragment,{children:[r&&/* @__PURE__ */ /* @__PURE__ */(0,_m.jsx)("defs",{children:r}),
|
|
104
104
|
/* @__PURE__ */
|
|
105
|
-
/* @__PURE__ */(0,
|
|
106
|
-
return(0,
|
|
105
|
+
/* @__PURE__ */(0,_m.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:_o(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},`point-${t}`)}case"line":{const n=e;if(n.path.length<2)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");/* @__PURE__ */ /* @__PURE__ */
|
|
106
|
+
return(0,_m.jsx)("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth??1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},`line-${t}`)}case"glyph":{const n=e;return Wo(n,n.x,n.y,`geo-glyph-${n.pointId??t}`)}default:return null}}function Zo(){const e=(0,Bm.useSyncExternalStore)(Hm,qm,Gm),[t,n]=(0,Bm.useState)(()=>!e);return Wm(()=>{n(!0)},[]),t}function Ko(){const e=(0,Bm.useSyncExternalStore)(Hm,qm,Gm);return(0,Bm.useRef)(e).current}function Qo(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:i,renderFnRef:o,cancelRender:a,flushRender:s,cleanup:l}=e;Wm(()=>{if(!t||!n)return;const e=r.current;e?.cancelIntroAnimation?.(),i.current=!0,a?.(),o.current()},[t,n]);const c=(0,Bm.useRef)(s);c.current=s;const[u,d]=(0,Bm.useState)(!1);Wm(()=>{!n&&c.current&&d(!0)},[n]),Wm(()=>{u&&c.current?.()},[u]);const h=(0,Bm.useRef)(l);h.current=l,(0,Bm.useEffect)(()=>()=>h.current?.(),[])}function Jo(e,t,n){const r=Math.round(t[0]*n),i=Math.round(t[1]*n),o=0===t[0]?n:r/t[0],a=0===t[1]?n:i/t[1],s=`${t[0]}px`,l=`${t[1]}px`;e.style.width!==s&&(e.style.width=s),e.style.height!==l&&(e.style.height=l);const c=e.width!==r||e.height!==i;return e.width!==r&&(e.width=r),e.height!==i&&(e.height=i),{effectiveDprX:o,effectiveDprY:a,resized:c}}function ea(){if("undefined"!=typeof window&&"function"==typeof window.matchMedia)return hf!==window.matchMedia&&(hf=window.matchMedia,df=window.matchMedia("(pointer: coarse)")),df}function ta(e,t,n,r){const i=e.getContext("2d");if(!i)return null;const{effectiveDprX:o,effectiveDprY:a}=Jo(e,t,r);return i.setTransform(o,0,0,a,0,0),i.translate(n.left,n.top),i}function na(e,t){if("undefined"==typeof window)return 1;const n=window.devicePixelRatio||1,r="undefined"!=typeof window&&(!0===ea()?.matches||Math.min(window.innerWidth||1/0,window.innerHeight||1/0)<768)?2:3,i="number"==typeof e&&e>0?e:r;if(!t)return Math.max(1,Math.min(n,i));const[o,a]=t,s=Math.min(Math.sqrt(8388608/(o*a)),16384/Math.max(o,a));return Math.max(s<1?0:1,Math.min(n,i,s))}function ra(e){function t(){r||(n(),i=na(),e(),queueMicrotask(()=>{r||o()}))}if("undefined"==typeof window)return()=>{};let n=()=>{},r=!1,i=0;const o=()=>{if("function"!=typeof window.matchMedia)return;const e=`(resolution: ${window.devicePixelRatio||1}dppx)`,r=window.matchMedia(e);r.media.includes("resolution")&&(n=Ln(r,t))};o(),i=na();const a=ea(),s=()=>{if(r)return;const t=na();t!==i&&(i=t,e())};window.addEventListener("resize",s);const l=Ln(a,s);return()=>{r=!0,window.removeEventListener("resize",s),l(),n()}}function ia(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:i,maxDevicePixelRatio:o,scheduleRender:a}=e,s=(0,Vm.useRef)(null),l=(0,Vm.useRef)(null),c=(0,Vm.useRef)(!1),u=(0,Vm.useRef)(!1),d=(0,Vm.useRef)(!1);return Ym(()=>{if(!e.size)return;const t=na(o,e.size);for(const n of[s.current,l.current])n&&Jo(n,e.size,t)},[e.size?.[0],e.size?.[1],o,e.hydrated]),Ym(()=>{!u.current&&(u.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.canvasPaintInvalidator?e.canvasPaintInvalidator():e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),Qo({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,flushRender:e.flushRender,cleanup:e.cleanup}),(0,Vm.useEffect)(()=>{if(!1!==i)return r.subscribe(()=>{r.isActive?(n.current=!0,a()):t()})},[t,n,r,i,a]),(0,Vm.useEffect)(()=>ra(()=>{c.current=!0,a()}),[a]),(0,Vm.useEffect)(()=>{d.current?(c.current=!0,a()):d.current=!0},[o,a]),{canvasRef:s,interactionCanvasRef:l,resolutionDirtyRef:c}}function oa(e,t){return ia({...t,size:e.size,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,flushRender:e.flushRender,frameRuntime:e.frameRuntime})}function aa({children:e,size:t,margin:n,backdropFill:r,overflowVisible:i=!1}){return e||r?/* @__PURE__ */ /* @__PURE__ */(0,Um.jsxs)("svg",{role:"presentation",style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:i?"visible":void 0},children:[r&&"transparent"!==r?/* @__PURE__ */ /* @__PURE__ */(0,Um.jsx)("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:t[0],height:t[1],fill:r}):null,
|
|
107
107
|
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */(0,
|
|
109
|
-
return(0,
|
|
110
|
-
return(0,
|
|
108
|
+
/* @__PURE__ */(0,Um.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})]}):null}function sa(e,t,n){if(Object.is(e,t))return!0;if(0===n)return!1;if(Array.isArray(e)&&Array.isArray(t))return la(e,t);if(!ca(e)||!ca(t))return!1;const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(const i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!sa(e[i],t[i],n-1))return!1}return!0}function la(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function ca(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function ua(e){const t=(0,Xm.useRef)(e);return sa(t.current,e,2)||(t.current=e),t.current}function da(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t?null:n?t||null:t||(r&&"transparent"!==r?r:"")||null}function ha(e){const{background:t,hasBackgroundGraphics:n=!1,themeBackground:r=""}=e;return"transparent"===t||n?null:t||(r&&"transparent"!==r?r:"")||null}function fa(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:i="",x:o=0,y:a=0,width:s,height:l}=t,c=ha({background:n,hasBackgroundGraphics:r,themeBackground:i});if(!c)return!1;const u=Fn(e,c);return!(!u||"transparent"===u.trim().toLowerCase()||(e.fillStyle=u,e.fillRect(o,a,s,l),0))}function pa({hoverPoint:t,scene:r,active:i=!0}){let o="";if(i&&t){const i=t.data??t,a="stats"in t?t.stats:void 0,s=a&&r?.find(e=>e.stats===a)||r?.find(e=>e.datum===i)||r?.find(e=>Array.isArray(e.datum)&&e.datum.includes(i)),l=s?n(s):i,c=a&&s&&("boxplot"===s.type||"violin"===s.type)&&Array.isArray(l)?{category:s.category,...e(s.stats)}:l;if(null!=c&&"object"==typeof c){const t=(Array.isArray(c)?c:[c]).map(t=>Object.entries(e(t)).map(([e,t])=>`${e}: ${t}`).join(", ")).filter(Boolean);o=t.length>0?`Data point: ${t.join("; ")}`:""}else o=`Data point: ${String(c)}`}/* @__PURE__ */ /* @__PURE__ */
|
|
109
|
+
return(0,eg.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Qm,children:o})}function ma(e){return og?.ordinals.has(e)&&(og=null),og||(og={counts:/* @__PURE__ */new Map,ordinals:/* @__PURE__ */new Map},ag||(ag=!0,queueMicrotask(()=>{og=null,ag=!1}))),og}function ga(e,t,n){const r=e.ordinals.get(n);if(null!=r)return r;const i=(e.counts.get(t)??0)+1;return e.counts.set(t,i),e.ordinals.set(n,i),i}function ya(e){let t=1;for(const n of e)rg.get(n)?.(t),t+=1}function ba(e){const t=tg.useId(),n=tg.useRef(null);null==n.current&&(n.current=/* @__PURE__ */Symbol("summary-region"));const r=n.current,i=tg.useContext(ig),o=tg.useRef(null);null==o.current&&(o.current=ga(i??ma(t),e,t));const[a,s]=tg.useState(o.current);return tg.useLayoutEffect(()=>{rg.set(r,s);let t=ng.get(e);return t||(t=/* @__PURE__ */new Set,ng.set(e,t)),t.add(r),ya(t),()=>{rg.delete(r),t.delete(r),0===t.size?ng.delete(e):ya(t)}},[e,r]),1===a?e:`${e} (${a})`}function va({interaction:e,tableId:t,regionLabel:n,countLabel:r,summary:i,children:o,className:a=gu}){const{isExpanded:s,containerRef:l,triggerRef:c,open:u,handleFocus:d,handleBlur:h,dismiss:f,announcement:p}=e,[m,g]=Km.useState(!1),y=ba(n);/* @__PURE__ */ /* @__PURE__ */
|
|
110
|
+
return(0,sg.jsx)("div",{ref:l,id:t,className:s?a:mu,tabIndex:-1,onFocus:s?void 0:d,onBlur:s?h:void 0,style:s?bu:m?Jm:Qm,role:"region","aria-label":y,children:s?/* @__PURE__ */ /* @__PURE__ */(0,sg.jsxs)(sg.Fragment,{children:[
|
|
111
111
|
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */(0,
|
|
112
|
+
/* @__PURE__ */(0,sg.jsx)("div",{role:"status","aria-atomic":"true",style:Qm,children:p}),
|
|
113
113
|
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */(0,
|
|
114
|
+
/* @__PURE__ */(0,sg.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:f,"aria-label":"Close data summary",style:xu,children:"×"}),i&&/* @__PURE__ */ /* @__PURE__ */(0,sg.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:vu,children:i}),o]}):/* @__PURE__ */ /* @__PURE__ */(0,sg.jsxs)("button",{ref:c,type:"button",onClick:u,onFocus:()=>g(!0),onBlur:()=>g(!1),style:yu,children:["View data summary (",r,")"]})})}function xa(){const[e,t]=lg.useState(!1),[n,r]=lg.useState(""),i=cg.useContext(ug),o=i?.visible??!1,a=e||o,s=lg.useRef(null),l=lg.useRef(null),c=lg.useRef(null),u=lg.useRef(!1),d=lg.useRef(!1),h=lg.useRef(null);dg(()=>{if(a&&!d.current){const e=document.activeElement;e instanceof HTMLElement&&e!==document.body&&!s.current?.contains(e)&&(c.current=e),s.current?.focus()}else if(!a&&d.current){if(u.current){const e=c.current?.isConnected?c.current:l.current;e?.focus()}u.current=!1,c.current=null,h.current=null,r("")}d.current=a;const e=h.current;if(a&&e){const t=e.table.querySelectorAll("tbody tr");t[e.index]?.focus(),h.current=null}});const f=()=>t(!0);return{isExpanded:a,containerRef:s,triggerRef:l,open:f,handleFocus:e=>{e.target!==e.currentTarget||a||(e.relatedTarget instanceof HTMLElement&&(c.current=e.relatedTarget),f())},handleBlur:e=>{o||s.current?.contains(e.relatedTarget)||t(!1)},dismiss:()=>{u.current=!0,o&&i?.setVisible(!1),t(!1)},revealRows:(e,t,n,i,o="rows")=>{const a=e.previousElementSibling;a&&(h.current={table:a,index:t}),r(`${n} of ${i} ${o} shown.`)},announcement:n}}function wa({accessibleTable:e,children:t}){const n=Zo();return"object"!=typeof e?t:n?/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)(Zm.Suspense,{fallback:null,children:/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)(pg,{target:e.portalTarget,children:t})}):null}function ka(e,t){if(!e||0===e.length)return`${t}, empty`;const n={};for(const t of e){if(null===t?.datum)continue;const e=String(t.type);n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return`${t}, empty`;const r=[],i={point:["point","points"],line:["line","lines"],area:["area","areas"],rect:["bar","bars"],heatcell:["cell","cells"],circle:["node","nodes"],candlestick:["candlestick","candlesticks"],wedge:["wedge","wedges"],arc:["arc","arcs"],geoarea:["region","regions"]},o=Object.keys(i),s=Object.keys(n).sort((e,t)=>{const n=o.indexOf(e),r=o.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s){const t=i[e];r.push(t?a(n[e],t[0],t[1]):a(n[e],e))}return`${t}, ${r.join(", ")}`}function Sa({accessibleTable:e,...t}){return e?/* @__PURE__ */ /* @__PURE__ */(0,fg.jsxs)(wa,{accessibleTable:e,children:[
|
|
115
115
|
/* @__PURE__ */
|
|
116
|
-
/* @__PURE__ */(0
|
|
116
|
+
/* @__PURE__ */(0,fg.jsx)(Aa,{tableId:t.tableId}),
|
|
117
117
|
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */(0
|
|
119
|
-
return(0
|
|
120
|
-
return(0,Wm.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function fa(e){return null!=e&&"boolean"!=typeof e&&("string"==typeof e?e.trim().length>0:Array.isArray(e)?e.some(fa):!Gm.isValidElement(e)||e.type!==Gm.Fragment||fa(e.props.children))}function pa(){const e=globalThis;return e[Ym]??(e[Ym]=Gm.createContext(void 0))}function ma(){return Gm.useContext(pa())}function ga(e){let t;for(const n of e.childNodes)if(1===n.nodeType){if(t)return!1;t=n}else if(3===n.nodeType&&n.textContent?.trim())return!1;const n=t?.getAttribute("data-semiotic-tooltip-chrome");return!t||null!=n&&"false"!==n}function ya(e,t){const[n,r]=Gm.useState(!1);return("undefined"==typeof window?Gm.useEffect:Gm.useLayoutEffect)(()=>{const i=t&&null!==e.current&&ga(e.current);i!==n&&r(i)}),Gm.useEffect(()=>{const n=e.current;if(!t||!n)return;const i=new MutationObserver(()=>r(ga(n)));return i.observe(n,{childList:!0,subtree:!0,characterData:!0,attributeFilter:["data-semiotic-tooltip-chrome"]}),()=>i.disconnect()},[t,e]),t&&n}function ba(e){return e.ownsChrome=!0,e}function va(e){if("string"!=typeof e)return null!=e;const t=e.trim().toLowerCase();return!(!t||"transparent"===t||/^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t)||/^hsla\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t))}function xa(e){if("function"==typeof e)return!0===e.ownsChrome;if(!Gm.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props,r=n["data-semiotic-tooltip-chrome"];if(null!=r&&!1!==r&&"false"!==r)return!0;const i=n.style;if(i&&"object"==typeof i){if(va(i.background))return!0;if(va(i.backgroundColor))return!0}return!1}function wa({x:e,y:t,containerWidth:n,containerHeight:r,margin:i,children:o,contentOwnsChrome:a=!1,className:s="stream-frame-tooltip",zIndex:l=1}){const c=ma(),u=Number.isFinite(e)&&Number.isFinite(t),d=fa(o),h=Hm.useRef(null),f="none"===c||a||xa(o),p=ya(h,!f&&u&&d),m=f||p,[g,y]=Hm.useState(null);Hm.useLayoutEffect(()=>{const e=h.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=parseFloat(n.width)||t.width,i=parseFloat(n.height)||t.height;Number.isFinite(r)&&Number.isFinite(i)&&y(e=>e&&e.ownsChrome===m&&Math.abs(e.width-r)<.5&&Math.abs(e.height-i)<.5?e:{width:r,height:i,ownsChrome:m})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(()=>(0,qm.flushSync)(t));return n.observe(e),()=>n.disconnect()},[s,n,r,u,d,m]);const b=Hm.useRef(null),v=g?.ownsChrome===m?g:null;let x,w=e,k=t,S=!1,M=!1;if(v){const i=r-t;S=n-e<v.width+12,M=i<v.height+12,w=Math.max(0,Math.min(e+(S?-v.width-12:12),n-v.width)),k=Math.max(0,Math.min(t+(M?-v.height-4:4),r-v.height)),x="none"}else x=`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${t<.3*r?"4px":"calc(-100% - 4px)"})`;const j=v?{flipX:S,flipY:M}:null,A=b.current,R=!j||!A||A.flipX!==j.flipX||A.flipY!==j.flipY;Hm.useLayoutEffect(()=>{b.current=j});const C=m?null:Um,L=m?s:`${s} semiotic-tooltip`.trim();return u&&d?/* @__PURE__ */ /* @__PURE__ */(0,Zm.jsx)("div",{ref:h,className:L,"data-placement":j?"placed":"pending","data-flip-x":S?"true":"false","data-flip-y":M?"true":"false",style:{...C||{},position:"absolute",left:i.left+w,top:i.top+k,transform:x,...R&&{transition:"none"},pointerEvents:"none",zIndex:l,width:"max-content",maxWidth:m?n:`min(${n}px, ${Um.maxWidth})`,boxSizing:"border-box"},children:o}):null}function ka(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const o=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return o?[+o[1],+o[2],+o[3]]:[78,121,167]}function Sa(e){switch(e){case"monotoneX":return Jm.curveMonotoneX;case"monotoneY":return Jm.curveMonotoneY;case"cardinal":return Jm.curveCardinal;case"catmullRom":return Jm.curveCatmullRom;case"step":return Jm.curveStep;case"stepBefore":return Jm.curveStepBefore;case"stepAfter":return Jm.curveStepAfter;case"basis":return Jm.curveBasis;case"natural":return Jm.curveNatural;default:return null}}function Ma(e,t,n){return null==t?n:fi(t)?gi(t,e)||t.background&&$n(e,t.background)||n:"string"!=typeof t?t:$n(e,t)||n}function ja(e,t){if(null==t)return;const n=Ma(e,t,"");return""===n?void 0:n}function Aa(e,t,n,r,i,o,a){const s=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(s.length<2)return null;const l=e.createLinearGradient(r,i,o,a);for(const t of s)l.addColorStop(Math.max(0,Math.min(1,t.offset)),Ra(e,t,n));return l}function Ra(e,t,n){const r=t.color??n,i=$n(e,r)||r;if(null==t.opacity)return i;const o=Math.max(0,Math.min(1,t.opacity)),[a,s,l]=ka(e,i);return`rgba(${a},${s},${l},${o})`}function Ca(e){return!!(e._pulseIntensity&&e._pulseIntensity>0)}function La(e,t,n=.6){if(!Ca(t))return;const r=t._pulseGlowRadius??4,i=t.r+r*t._pulseIntensity,o=t.cx??t.x??0,a=t.cy??t.y??0;e.beginPath(),e.arc(o,a,i,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Pa(e,t,n,r=.35){Ca(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Na(e,t,n,r){const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=ja(e,t.style.fill)||"#e0e0e0";"none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n));const i=t.style.strokeWidth??.5;if(t.style.stroke&&"none"!==t.style.stroke&&i>0){if(e.strokeStyle=$n(e,t.style.stroke)||t.style.stroke,e.lineWidth=i,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}Pa(e,t,n),e.globalAlpha=1,e.setLineDash([])}}function Ea(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?e<n.value&&(r=n.color):e>n.value&&(r=n.color);return r}function Ia(e,t,n,r){if(e.length<2||t.length!==e.length||0===n.length)return[];const i=[],o=(e,t,n)=>{const r=i[i.length-1];r?.color===e?r.path.push(n):i.push({color:e,path:[t,n]})};for(let i=1;i<e.length;i++){const[a,s]=e[i-1],[l,c]=e[i],u=t[i-1],d=t[i]-u,h=[0,...0===d?[]:n.map(({value:e})=>(e-u)/d).filter(e=>e>0&&e<1&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;e<h.length;e++){const t=h[e-1],i=h[e];o(Ea(u+d*((t+i)/2),n,r),[a+(l-a)*t,s+(c-s)*t],[a+(l-a)*i,s+(c-s)*i])}}return i}function za(e,t,n,r,i,o){if(t.length<2)return;const a=[0];for(let e=1;e<t.length;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=o;for(let n=0;n<t.length-1;n++){const r=(a[n]+a[n+1])/2;let o=i;r<l&&(o*=r/l),s-r<l&&(o*=(s-r)/l),e.globalAlpha=Math.max(0,o),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function Ta(e,t,n){for(const r of t){if(r.path.length<2)continue;const t=r._introClipFraction;void 0!==t&&t<1&&(e.save(),e.beginPath(),e.rect(0,0,n.width*t,n.height),e.clip());const i=r.style.stroke||"#007bff",o=$n(e,i)||i,a=r.style.strokeWidth??2,s=r.colorThresholds,l=r.rawValues;if(r.style.strokeDasharray?e.setLineDash(r.style.strokeDasharray.split(/[\s,]+/).map(Number)):e.setLineDash([]),null!=r.style.opacity&&(e.globalAlpha=r.style.opacity),a>0&&(e.lineWidth=a),e.lineCap=r.style.strokeLinecap||"butt",r.style._edgeFade&&a>0){const t=r.style.opacity??1;za(e,r.path,o,a,t,r.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Sa(r.curve),u=s&&s.length>0&&l&&l.length===r.path.length,d=r._decayOpacities;if(a>0&&d&&d.length===r.path.length&&!u){e.strokeStyle=o;const t=r.style.opacity??1;for(let n=0;n<r.path.length-1;n++){const i=.5*(d[n]+d[n+1])*t;e.globalAlpha=i,e.beginPath(),e.moveTo(r.path[n][0],r.path[n][1]),e.lineTo(r.path[n+1][0],r.path[n+1][1]),e.stroke()}}else if(a>0&&!u){e.beginPath();const t=r.strokeGradient&&r.path.length>=2?Aa(e,r.strokeGradient,o,r.path[0][0],0,r.path[r.path.length-1][0],0):null;if(e.strokeStyle=t||o,c)(0,eg.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(r.path);else{const[t,n]=r.path[0];e.moveTo(t,n);for(let t=1;t<r.path.length;t++)e.lineTo(r.path[t][0],r.path[t][1])}e.stroke()}else if(a>0){const t=Ia(r.path,l,s,o);for(const n of t){e.beginPath(),e.strokeStyle=$n(e,n.color)||n.color,e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;t<n.path.length;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.stroke()}}if(r.style.fill&&r.style.fillOpacity&&r.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=r.style.fillOpacity,e.fillStyle=Ma(e,r.style.fill,r.style.fill),c&&!u)(0,eg.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(r.path);else{const[t,n]=r.path[0];e.moveTo(t,n);for(let t=1;t<r.path.length;t++)e.lineTo(r.path[t][0],r.path[t][1])}const t=r.path[r.path.length-1][0],i=r.path[0][0];e.lineTo(t,n.height),e.lineTo(i,n.height),e.closePath(),e.fill()}void 0!==t&&t<1&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}}function Da(e,t){if(0!==t.length){e.save();try{const n=e.globalAlpha;let r=[],i="";const o=t=>{e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const r=t.style.opacity??t.style.fillOpacity??1;e.globalAlpha=n*r,e.fillStyle=Ma(e,t.style.fill,"#4e79a7"),e.fill();const i=t.style.strokeWidth??1;t.style.stroke&&"none"!==t.style.stroke&&i>0&&(e.strokeStyle=Ma(e,t.style.stroke,t.style.stroke),e.lineWidth=i,e.stroke()),La(e,t)},a=()=>{if(0===r.length)return;if(1===r.length)return o(r[0]),r=[],void(i="");const t=r[0],a=t.style.opacity??t.style.fillOpacity??1;e.globalAlpha=n*a,e.beginPath();for(const t of r)e.moveTo(t.x+t.r,t.y),e.arc(t.x,t.y,t.r,0,2*Math.PI);e.fillStyle=Ma(e,t.style.fill,"#4e79a7"),e.fill();const s=t.style.strokeWidth??1;t.style.stroke&&"none"!==t.style.stroke&&s>0&&(e.strokeStyle=Ma(e,t.style.stroke,t.style.stroke),e.lineWidth=s,e.stroke()),r=[],i=""};for(const e of t){const t=e.style.opacity??e.style.fillOpacity??1,n=e.style.fill;if(Ca(e)||null!=n&&"string"!=typeof n||t<1){a(),o(e);continue}const s=e.style.strokeWidth??1,l=`${n??"#4e79a7"}\0${e.style.stroke&&"none"!==e.style.stroke&&s>0?String(e.style.stroke):""}\0${s}\0${e.r}\0${t}`;r.length>0&&l!==i&&a(),i=l,r.push(e),r.length>=2048&&a()}a()}finally{e.restore()}}}function $a(e,t,n,r,i){if(t.size<=0)return;const o=t.glyph;if(!o||!o.parts?.length)return;const a=vo(o,t.size);if(a.scale<=0)return;const s=t._decayOpacity??1,l=(t.style.opacity??1)*s;if(l<=0)return;const c=t=>{const n=Ma(e,t,t);return"string"==typeof n?n:t},u=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=i*l*(t.style.fillOpacity??1);const d=So(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");d&&t.ghostColor&&jo(e,o,u,t.accent,t.ghostColor,c),d&&(e.beginPath(),e.rect(d.x,d.y,d.width,d.height),e.clip()),jo(e,o,u,t.accent,void 0,c),e.restore()}function Oa(e,t){const n=e.globalAlpha;for(const r of t){const t=r;$a(e,t,t.x,t.y,n)}e.globalAlpha=n}function Fa(e){const{size:t,scale:n,translate:r,clampX:i=!0,clampY:o=!0}=e,a=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(a),l=1<<s,c=Math.pow(2,a-s+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(o?0:-1/0,Math.floor((0-d)/c)),m=Math.min(o?l:1/0,Math.ceil((t[1]-d)/c)),g=[];for(let e=p;e<m;++e)for(let t=h;t<f;++t)g.push([t,e,s]);return{tiles:g,translate:[u/c,d/c],scale:c}}function _a([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Wa(e,t,n,r,i){return"function"==typeof e?e(t,n,r,i):e.replaceAll("{z}",String(t)).replaceAll("{x}",String(n)).replaceAll("{y}",String(r)).replaceAll("{r}",i>1?"@2x":"")}function Ba(e){if("string"==typeof e)return`template:${e}`;const t=e;let n=tg.get(t);return null==n&&(n=ng++,tg.set(t,n)),`provider:${n}`}function Ha(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):256}function qa(e,t){const{tileURL:n,projection:r,width:i,height:o,tileCache:a,onTileLoad:s,maxDevicePixelRatio:l}=t,c=r.scale(),u=r([0,0])??r.translate(),d=Fa({size:[i,o],scale:2*c*Math.PI,translate:u,clampX:!1}),h=Bo(l,[i,o]),f=Ba(n);let p=!0;for(const t of d.tiles){const[r,i,o]=_a(t),l=Wa(n,o,r,i,h),c=`${f}|dpr:${h}|${o}/${r}/${i}|${l}`;let u=a.get(c);if(!u||u.failed&&(u.attempts??1)<3&&Date.now()>=(u.retryAt??1/0)){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,failed:!1,key:c,lastUsed:performance.now(),attempts:(u?.attempts??0)+1};a.set(c,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0,t.failed=!0,t.retryAt=Date.now()+1e3,s?.()},e.src=l,u=t}if(!u.loaded){p=!1;continue}if(u.failed)continue;const m=d.scale,g=d.translate[0],y=d.translate[1],b=(t[0]+g)*m,v=(t[1]+y)*m;e.drawImage(u.img,b-.5,v-.5,m+1,m+1)}return p}function Ga(e){let t=0;for(let n=1;n<e.length;n++){const r=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+i*i)}return t}function Va(e,t){let n=0;for(let r=1;r<e.length;r++){const i=e[r][0]-e[r-1][0],o=e[r][1]-e[r-1][1],a=Math.sqrt(i*i+o*o);if(n+a>=t||r===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[r-1][0]+i*s,y:e[r-1][1]+o*s,nx:-o/l,ny:i/l}}n+=a}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}function Ua(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}function Ya(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:og.createElement(og.Fragment,null,...t)}function Xa({value:e,children:t}){const n=(Dm??(Dm=ag.createContext(null)),Dm);/* @__PURE__ */ /* @__PURE__ */
|
|
121
|
-
return(0
|
|
122
|
-
return(0,pg.jsxs)(Xm,{chrome:n,className:a,style:o,children:[s&&/* @__PURE__ */ /* @__PURE__ */(0,pg.jsx)("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:s}),l.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,pg.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&/* @__PURE__ */ /* @__PURE__ */(0,pg.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function bs(e={}){const{fields:t=[],chrome:n,title:r,format:i,style:o={},className:a="",showLabels:s=!0,separator:l=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const c=[];if(r){const t=ps(e,r);c.push({value:ms(t,i)})}if(t&&Array.isArray(t)&&t.length>0)for(const n of t){const t=gs(e,n,i);c.push({...t,label:s?t.label:void 0})}else{const t=fs(e,{skipPositional:!1});null!=t.title&&c.push({label:void 0,value:ms(t.title,i),bold:!0}),t.entries.forEach(e=>{c.push({label:s?e.key:void 0,value:ms(e.value,i)})})}return Array.isArray(c)&&0!==c.length?/* @__PURE__ */ /* @__PURE__ */(0,pg.jsx)(Xm,{chrome:n,className:`semiotic-tooltip-multiline ${a}`.trim(),style:o,children:c.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,pg.jsxs)("div",{style:{marginBottom:t<c.length-1?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&/* @__PURE__ */ /* @__PURE__ */(0,pg.jsxs)("strong",{children:[e.label,l]}),e.value]},t))}):null}}function vs(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"mode"in e&&"multi"===e.mode}function xs(e){if(!0!==e){if("function"==typeof e||"object"==typeof e&&null!==e&&"content"in e&&"function"==typeof e.content&&!vs(e)){const t="function"==typeof e?e:e.content,n="function"==typeof e?void 0:e.chrome,r=e=>{const r=us(e);if(!r)return null;const i=t(r);return fa(i)?void 0===n&&(xa(t)||xa(i))?i:/* @__PURE__ */ /* @__PURE__ */(0,pg.jsx)(Xm,{chrome:n,children:i}):null};return void 0===n&&xa(t)?ba(r):r}if(!1===e||void 0===e)return!1;if(vs(e)){if("function"==typeof e.content)return mg||"production"===process.env.NODE_ENV||(mg=!0,console.warn('[semiotic] tooltip={{ mode: "multi", content }} reached a chart without multi-series hover. content receives one datum and no allSeries.')),xs(void 0===e.chrome?e.content:{content:e.content,chrome:e.chrome});"production"!==process.env.NODE_ENV&&console.warn('[semiotic] tooltip={{ mode: "multi" }} reached normalizeTooltip without a chart that wires tooltipMode. Use a line/area-family chart with multi support, or pass frameProps.tooltipMode: "multi" to StreamXYFrame.');const t=bs({chrome:e.chrome});return xs(e=>t(e))}if("object"==typeof e&&null!==e&&("fields"in e||"title"in e||"chrome"in e)){const t=ys(e);return xs(e=>t(e))}if("multi"===e){"production"!==process.env.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip on a single-tooltip chart. Rendering multi-field content as a backward-compatible fallback.');const e=bs();return xs(t=>e(t))}return ys()}}function ws(e,t,n,r,i,o){const a=i-n,s=o-r,l=a*a+s*s;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*a+(t-r)*s)/l;c=Math.max(0,Math.min(1,c));const u=n+c*a,d=r+c*s;return Math.sqrt((e-u)**2+(t-d)**2)}function ks(e,t=30,n=1){return Math.max((e??4)+5/n,12/n,t)}function Ss(e,t,n,r,i,o=e=>e.x,a=e=>e.y,s=e=>e.r,l,c=1){const u=ks(i,r,c),d=t-u,h=t+u,f=n-u,p=n+u;let m=null,g=1/0;return e.visit((e,i,u,y,b)=>{if(i>h||y<d||u>p||b<f)return!0;const v=e;if(!v.length){let e=v;do{const i=e.data,u=o(i)-t,d=a(i)-n,h=Math.sqrt(u*u+d*d);h<=ks(s(i),r,c)&&(null===m||(l?l(i,m,h,g):h<g))&&(m=i,g=h),e=e.next}while(e)}return!1}),m?{node:m,distance:g}:null}function Ms(e,t,n,r,i,o,a=0,s=r){if(o){const e=Ss(o,t,n,r,a);if(e&&!1!==e.node.interactive)return e}else{let i=null,o=1/0;for(const a of e){if("point"!==a.type)continue;if(!1===a.interactive)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);l<=ks(a.r,r)&&l<o&&(i=a,o=l)}if(i)return{node:i,distance:o}}let l=null,c=1/0;for(const i of e){if("glyph"!==i.type)continue;if(null==i.datum)continue;const e=Mo(i.glyph,i.size),o=i.x+e.centerDx-t,a=i.y+e.centerDy-n,s=Math.sqrt(o*o+a*a);s<=ks(e.radius,r)&&s<c&&(l=i,c=s)}if(l)return{node:l,distance:c};let u=null,d=1/0;for(const r of e){if("line"!==r.type)continue;const e=r,{path:i}=e,o=Math.max((e.style.strokeWidth??2)+4,5,s),a=t-o,l=t+o,c=n-o,h=n+o;for(let r=0;r<i.length-1;r++){const s=i[r],f=i[r+1],p=s[0],m=s[1],g=f[0],y=f[1];if(p<a&&g<a||p>l&&g>l||m<c&&y<c||m>h&&y>h)continue;const b=ws(t,n,p,m,g,y);b<=o&&b<d&&(u=e,d=b)}}if(u)return{node:u,distance:d};for(let r=e.length-1;r>=0;r--){const o=e[r];if("geoarea"!==o.type)continue;const a=o;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(t<s||t>c||n<l||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),i.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}return null}function js(){if(null!==vg)return vg;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&navigator.deviceMemory<=4;return vg=e||t||n}function As(){return js()?12:30}function Rs(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Cs(e){const t=e.pointer.clientX-e.canvasRect.left-e.margin.left,n=e.pointer.clientY-e.canvasRect.top-e.margin.top;if(t<0||t>e.width||n<0||n>e.height)return{kind:"outside"};e.hitCanvasRef.current||(e.hitCanvasRef.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=(i=e.hitCanvasRef.current)?i.getContext("2d"):null;var i;if(!r)return{kind:"unavailable"};const o=Ms(e.scene,t,n,is(30,e.pointer.pointerType),r,e.pointQuadtree,e.maxPointRadius,is(6,e.pointer.pointerType));if(!o)return{kind:"miss"};const{node:a}=o,s=a.datum,l=Array.isArray(s)?null:s?.properties?s:s?.data||s,c="point"===a.type?a.x:"geoarea"===a.type?a.centroid[0]:t,u="point"===a.type?a.y:"geoarea"===a.type?a.centroid[1]:n;return{kind:"hit",node:a,hover:{...l,...l?.properties||{},data:l,properties:l?.properties,__semioticHoverData:!0,x:c,y:u}}}function Ls(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function Ps(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"hover-end",timestamp:l,chartType:o,chartId:a}))}function Ns(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"click-end",timestamp:l,chartType:o,chartId:a}))}function Es({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:i}){const o=Boolean(e||n),a=Boolean(t||n),s=(0,wg.useCallback)((t,o)=>{e?.(t,o),Ps({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:r,context:o})},[r,i,e,n]),l=(0,wg.useCallback)((e,o)=>{t?.(e,o),Ns({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:r,context:o})},[r,i,t,n]);return{customHoverBehavior:o?s:void 0,customClickBehavior:a?l:void 0,hasClickBehavior:a}}function Is(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=n.group??"_default";let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;t<e.length;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const r=t.get(e),i=t.get(n);return(r.length>0?r[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(t.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const i=/* @__PURE__ */new Map;for(let e=0;e<r.length;e++){r[e]._flatIndex=e;const t=r[e].datum?.id;null!=t&&i.set(String(t),e)}return{flat:r,groups:n,byGroup:t,idToIdx:i}}function zs(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function Ts(e,t,n){const{group:r,indexInGroup:i}=t,o=n.byGroup.get(r);switch(e){case"ArrowRight":return i<o.length-1?o[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?o[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(r);return e<n.groups.length-1?Ds(n,n.groups[e+1],o[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(r);return e>0?Ds(n,n.groups[e-1],o[i]):t.flatIndex}case"PageDown":{const e=Math.max(1,Math.floor(.1*n.flat.length));return Math.min(t.flatIndex+e,n.flat.length-1)}case"PageUp":{const e=Math.max(1,Math.floor(.1*n.flat.length));return Math.max(t.flatIndex-e,0)}case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function Ds(e,t,n){const r=e.byGroup.get(t);let i=0,o=Math.abs(r[0].x-n.x);for(let e=1;e<r.length;e++){const t=Math.abs(r[e].x-n.x);t<o&&(o=t,i=e)}return r[i]._flatIndex}function $s(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return t<n-1?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":{const e=Math.max(1,Math.floor(.1*n));return Math.min(t+e,n-1)}case"PageUp":{const e=Math.max(1,Math.floor(.1*n));return Math.max(t-e,0)}case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function Os(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x&&!1!==n.interactive)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(n.size<=0||null==n.datum)continue;const e=Mo(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else if("line"===n.type){if(null==n.datum||n.path.length<2)continue;const e=n.path.slice(1).map((e,t)=>Math.hypot(e[0]-n.path[t][0],e[1]-n.path[t][1]));let r=e.reduce((e,t)=>e+t,0)/2;if(!Number.isFinite(r)||r<=0)continue;for(let i=0;i<e.length;i++){const o=e[i];if(o>0&&r<=o){const e=n.path[i],a=n.path[i+1],s=r/o;t.push({x:e[0]+(a[0]-e[0])*s,y:e[1]+(a[1]-e[1])*s,datum:os(n.datum),shape:"path",pathData:`M${n.path.map(e=>e.join(",")).join("L")}`});break}r-=o}}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function Fs(e,t,n,r,i,o){const a=n.current;if(t.current<0||!a)return;const s=e=>(e.datum===a.datum||void 0!==a.semanticKey&&e.semanticKey===a.semanticKey)&&e.group===a.group&&e.shape===a.shape,l=e[t.current]&&s(e[t.current])?t.current:e.findIndex(s),c=e[l];if(t.current=l,n.current=c??null,c&&c.datum===a.datum&&c.x===a.x&&c.y===a.y&&c.w===a.w&&c.h===a.h&&c.pathData===a.pathData&&c.stats===a.stats)return;const u=c?o(c):null;r.current=u,i(u)}function _s({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:i,customClickBehavior:o,scheduleRender:a,clearPointerHover:s,extractPoints:l,toHover:c,navigation:u="graph",nextConnected:d}){const h=(0,kg.useRef)(-1),f=(0,kg.useRef)(-1),p=(0,kg.useRef)(null),m=(0,kg.useRef)(null),g=(0,kg.useCallback)(()=>{const i=e.current;if(!i)return;if(f.current<0)return void(m.current=null);const o=Is(l(i.scene));m.current={version:i.version,graph:o},Fs(o.flat,f,p,t,r,e=>c(e,i)),f.current<0&&n&&(n.current=null)},[l,t,n,r,e,c]),y=(0,kg.useCallback)(g=>{if(Ls(g))return;const y=e.current;if(!y)return;const b=()=>{const e=null!==t.current;f.current=-1,p.current=null,h.current=-1,t.current=null,n&&(n.current=null),r(null),e&&i?.(null),a()};if("Escape"===g.key)return g.preventDefault(),s?.(),void b();if(0===y.scene.length)return void(f.current>=0&&b());let v;if(m.current?.version===y.version)v=m.current.graph;else{const e=l(y.scene);if(0===e.length)return void(f.current>=0&&b());v=Is(e),m.current={version:y.version,graph:v}}let x,w=f.current;if(w>=v.flat.length&&(b(),w=-1),("Enter"===g.key&&!d||" "===g.key)&&w>=0)return g.preventDefault(),void o?.(c(v.flat[w],y),{type:"activate",inputType:"keyboard"});if(w<0){if(!(["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(g.key)||d&&"Enter"===g.key))return;h.current=-1,x=0}else x=d?d(g.key,v,w,h):"linear"===u?$s(g.key,w,v.flat.length):Ts(g.key,zs(v,w),v);if(null===x)return;if(g.preventDefault(),x<0)return void b();f.current=x;const k=v.flat[x];p.current=k;const S=c(k,y);t.current=S,r(S),i?.(S,{type:"focus",inputType:"keyboard"}),a()},[s,o,i,l,d,u,t,n,a,r,e,c]);return{kbFocusIndexRef:f,focusedNavPointRef:p,neighborIndexRef:h,onKeyDown:y,refreshKeyboardFocus:g}}function Ws(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}function Bs(e,t,n,r){return"function"==typeof e?e({size:t,margin:n,scales:r}):e}function Hs({foregroundGraphics:e,backgroundGraphics:t,size:n,margin:r,scales:i,background:o,themeBackgroundColor:a,resolveScaleAwareGraphics:s=!0}){const l=`var(--semiotic-bg, ${a})`;return{resolvedForeground:s||"function"!=typeof e?Bs(e,n,r,i):null,resolvedBackground:s||"function"!=typeof t?Bs(t,n,r,i):null,themeBackground:l,surfaceBackground:Ko({background:o,hasBackgroundGraphics:Boolean(t),themeBackground:l})}}function qs(e){const t=/* @__PURE__ */new Set;let n=0,r=e;return{subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>n,sync(e){if(e!==r){r=e,n+=1;for(const e of t)e()}}}}function Gs({graphics:e,size:t,margin:n,readScales:r,tracker:i}){return(0,Mg.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),Sg.createElement(Sg.Fragment,null,Bs(e,t,n,r()))}function Vs({tracker:e,readScales:t,...n}){const r=r=>"function"==typeof r?Sg.createElement(Gs,{graphics:r,size:n.size,margin:n.margin,readScales:t,tracker:e}):r;return{...Hs({...n,resolveScaleAwareGraphics:!1}),resolvedForeground:r(n.foregroundGraphics),resolvedBackground:r(n.backgroundGraphics)}}function Us(e,t,n){const r=e.current;r.inside=!0,r.clientX=t.clientX,r.clientY=t.clientY,r.pointerType=t.pointerType??n}function Ys(e){var t,n,r;t=e.canvas,n=e.pointer,r=t=>{const n=Cs({pointer:t,canvasRect:e.canvas.getBoundingClientRect(),margin:e.margin,width:e.width,height:e.height,scene:e.store.scene,pointQuadtree:e.geometryMoved?null:e.store.quadtree,maxPointRadius:e.store.maxPointRadius,hitCanvasRef:e.hitCanvasRef});return"hit"===n.kind?Lo(n.node):void 0},t&&(n.inside&&"touch"!==n.pointerType?No(t,r(n)):No(t))}function Xs(e,t){return e.displayName=t,e}function Zs(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}function Ks(e,t,n,r){if(!t)return e;const i=(i,...o)=>{const a={...e(i,...o)};if(t.isActive)if(t.predicate(r?r(i):i))n?.selectedStyle&&Object.assign(a,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;a.opacity=e,a.fillOpacity=e,a.strokeOpacity=e,n?.unselectedStyle&&Object.assign(a,n.unselectedStyle)}return a};return as(i,[i])}function Qs(e){let t=null;const n=()=>(t||(t=(0,Ig.createContext)(null)),t),r=Js(e);return[function({children:t,initialState:r}){const i=(0,Ig.useRef)(r),o=(0,Ig.useMemo)(()=>Js(e,i.current),[]),a=n();/* @__PURE__ */ /* @__PURE__ */
|
|
123
|
-
return(0,
|
|
124
|
-
/* @__PURE__ */new Set),c=(0,
|
|
125
|
-
return(0,
|
|
118
|
+
/* @__PURE__ */(0,fg.jsx)(Ma,{...t})]}):null}function Ma(e){const{scene:t,chartType:n,tableId:r,chartTitle:o}=e,s=xa(),l=`Data summary for ${o||n}`;return t&&0!==t.length?/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)(va,{interaction:s,tableId:r,regionLabel:l,countLabel:a(i(t),"element"),children:s.isExpanded&&/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)(Zm.Suspense,{fallback:/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)("div",{role:"status",children:"Loading data summary…"}),children:/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)(mg,{...e,revealRows:s.revealRows})})}):r?/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)("span",{id:r,tabIndex:-1,style:Qm}):null}function ja({summary:e}){return e?/* @__PURE__ */ /* @__PURE__ */(0,fg.jsx)("div",{role:"note",style:Qm,children:e}):null}function Aa({tableId:e}){const[t,n]=Zm.useState(!1);/* @__PURE__ */ /* @__PURE__ */
|
|
119
|
+
return(0,fg.jsx)("a",{href:`#${e}`,style:t?Jm:Qm,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:()=>n(!0),onBlur:()=>n(!1),children:"Skip to data table"})}function Ra(e,t){if(!t)return[];const n=/* @__PURE__ */new Set,r=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t],o=String(e);n.has(o)||(n.add(o),r.push(o))}return r}function Ca(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function La(e,t,n,r){const i=(0,gg.useRef)({accessor:t,onChange:n,readData:r}),o=(0,gg.useRef)([]);i.current={accessor:t,onChange:n,readData:r};const a=(0,gg.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=i.current;if(!n||!t)return;const a=Ra(e.current?r(e.current):[],t);Ca(a,o.current)||(o.current=a,n(a))},[e]);return(0,gg.useEffect)(()=>{o.current=[],a()},[t,a,n]),a}function Na({active:e,hoverPoint:t,margin:n,size:r,shape:i="circle",width:o,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==i&&"path"!==i||!s)if("rect"===i&&null!=o&&null!=a){const e=Math.max(o,4),t=Math.max(a,4);u=/* @__PURE__ */ /* @__PURE__ */(0,yg.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:bg,strokeWidth:2,strokeDasharray:"4,2"})}else u="wedge"===i?/* @__PURE__ */ /* @__PURE__ */(0,yg.jsx)("circle",{cx:l,cy:c,r:12,fill:"none",stroke:bg,strokeWidth:2.5,strokeDasharray:"6,3"}):/* @__PURE__ */ /* @__PURE__ */(0,yg.jsx)("circle",{cx:l,cy:c,r:8,fill:"none",stroke:bg,strokeWidth:2,strokeDasharray:"4,2"});else u=/* @__PURE__ */ /* @__PURE__ */(0,yg.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:/* @__PURE__ */ /* @__PURE__ */(0,yg.jsx)("path",{d:s,fill:"none",stroke:bg,strokeWidth:2.5,strokeDasharray:"6,3"})});/* @__PURE__ */ /* @__PURE__ */
|
|
120
|
+
return(0,yg.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Pa(e){return null!=e&&"boolean"!=typeof e&&("string"==typeof e?e.trim().length>0:Array.isArray(e)?e.some(Pa):!wg.isValidElement(e)||e.type!==wg.Fragment||Pa(e.props.children))}function Ea(){const e=globalThis;return e[Mg]??(e[Mg]=wg.createContext(void 0))}function Ia(){return wg.useContext(Ea())}function Ta(e){let t;for(const n of e.childNodes)if(1===n.nodeType){if(t)return!1;t=n}else if(3===n.nodeType&&n.textContent?.trim())return!1;const n=t?.getAttribute("data-semiotic-tooltip-chrome");return!t||null!=n&&"false"!==n}function za(e,t){const[n,r]=wg.useState(!1);return("undefined"==typeof window?wg.useEffect:wg.useLayoutEffect)(()=>{const i=t&&null!==e.current&&Ta(e.current);i!==n&&r(i)}),wg.useEffect(()=>{const n=e.current;if(!t||!n)return;const i=new MutationObserver(()=>r(Ta(n)));return i.observe(n,{childList:!0,subtree:!0,characterData:!0,attributeFilter:["data-semiotic-tooltip-chrome"]}),()=>i.disconnect()},[t,e]),t&&n}function Da(e){return e.ownsChrome=!0,e}function $a(e){if("string"!=typeof e)return null!=e;const t=e.trim().toLowerCase();return!(!t||"transparent"===t||/^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t)||/^hsla\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t))}function Fa(e){if("function"==typeof e)return!0===e.ownsChrome;if(!wg.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props,r=n["data-semiotic-tooltip-chrome"];if(null!=r&&!1!==r&&"false"!==r)return!0;const i=n.style;if(i&&"object"==typeof i){if($a(i.background))return!0;if($a(i.backgroundColor))return!0}return!1}function Oa({x:e,y:t,containerWidth:n,containerHeight:r,margin:i,children:o,contentOwnsChrome:a=!1,className:s="stream-frame-tooltip",zIndex:l=1}){const c=Ia(),u=Number.isFinite(e)&&Number.isFinite(t),d=Pa(o),h=vg.useRef(null),f="none"===c||a||Fa(o),p=za(h,!f&&u&&d),m=f||p,[g,y]=vg.useState(null);vg.useLayoutEffect(()=>{const e=h.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=parseFloat(n.width)||t.width,i=parseFloat(n.height)||t.height;Number.isFinite(r)&&Number.isFinite(i)&&y(e=>e&&e.ownsChrome===m&&Math.abs(e.width-r)<.5&&Math.abs(e.height-i)<.5?e:{width:r,height:i,ownsChrome:m})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(()=>(0,xg.flushSync)(t));return n.observe(e),()=>n.disconnect()},[s,n,r,u,d,m]);const b=vg.useRef(null),v=g?.ownsChrome===m?g:null;let x,w=e,k=t,S=!1,M=!1;if(v){const i=r-t;S=n-e<v.width+12,M=i<v.height+12,w=Math.max(0,Math.min(e+(S?-v.width-12:12),n-v.width)),k=Math.max(0,Math.min(t+(M?-v.height-4:4),r-v.height)),x="none"}else x=`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${t<.3*r?"4px":"calc(-100% - 4px)"})`;const j=v?{flipX:S,flipY:M}:null,A=b.current,R=!j||!A||A.flipX!==j.flipX||A.flipY!==j.flipY;vg.useLayoutEffect(()=>{b.current=j});const C=m?null:Sg,L=m?s:`${s} semiotic-tooltip`.trim();return u&&d?/* @__PURE__ */ /* @__PURE__ */(0,Ag.jsx)("div",{ref:h,className:L,"data-placement":j?"placed":"pending","data-flip-x":S?"true":"false","data-flip-y":M?"true":"false",style:{...C||{},position:"absolute",left:i.left+w,top:i.top+k,transform:x,...R&&{transition:"none"},pointerEvents:"none",zIndex:l,width:"max-content",maxWidth:m?n:`min(${n}px, ${Sg.maxWidth})`,boxSizing:"border-box"},children:o}):null}function _a(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const o=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return o?[+o[1],+o[2],+o[3]]:[78,121,167]}function Ba(e){switch(e){case"monotoneX":return Lg.curveMonotoneX;case"monotoneY":return Lg.curveMonotoneY;case"cardinal":return Lg.curveCardinal;case"catmullRom":return Lg.curveCatmullRom;case"step":return Lg.curveStep;case"stepBefore":return Lg.curveStepBefore;case"stepAfter":return Lg.curveStepAfter;case"basis":return Lg.curveBasis;case"natural":return Lg.curveNatural;default:return null}}function Wa(e){return"string"==typeof e&&"none"===e.trim().toLowerCase()}function Ha(e,t,n){return Wa(t)?"rgba(0,0,0,0)":null==t?n:Ai(t)?Li(t,e)||t.background&&Fn(e,t.background)||n:"string"!=typeof t?t:Fn(e,t)||n}function qa(e,t){if(null==t)return;const n=Ha(e,t,"");return""===n?void 0:n}function Ga(e,t,n,r,i,o,a){const s=t.stops.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity)));if(s.length<2)return null;const l=e.createLinearGradient(r,i,o,a);for(const t of s)l.addColorStop(Math.max(0,Math.min(1,t.offset)),Va(e,t,n));return l}function Va(e,t,n){const r=t.color??n,i=Fn(e,r)||r;if(null==t.opacity)return i;const o=Math.max(0,Math.min(1,t.opacity)),[a,s,l]=_a(e,i);return`rgba(${a},${s},${l},${o})`}function Ua(e){return!!(e._pulseIntensity&&e._pulseIntensity>0)}function Ya(e,t,n=.6){if(!Ua(t))return;const r=t._pulseGlowRadius??4,i=t.r+r*t._pulseIntensity,o=t.cx??t.x??0,a=t.cy??t.y??0;e.beginPath(),e.arc(o,a,i,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Xa(e,t,n,r=.35){Ua(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}function Za(e,t,n,r){const i=t.filter(e=>"geoarea"===e.type);for(const t of i){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=Wa(t.style.fill)?void 0:qa(e,t.style.fill)||"#e0e0e0";r&&!Wa(r)&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n));const i=t.style.strokeWidth??.5;if(t.style.stroke&&"none"!==t.style.stroke&&i>0){if(e.strokeStyle=Fn(e,t.style.stroke)||t.style.stroke,e.lineWidth=i,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){const n=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(n)}else e.setLineDash([]);e.stroke(n)}Xa(e,t,n),e.globalAlpha=1,e.setLineDash([])}}function Ka(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?e<n.value&&(r=n.color):e>n.value&&(r=n.color);return r}function Qa(e,t,n,r){if(e.length<2||t.length!==e.length||0===n.length)return[];const i=[],o=(e,t,n)=>{const r=i[i.length-1];r?.color===e?r.path.push(n):i.push({color:e,path:[t,n]})};for(let i=1;i<e.length;i++){const[a,s]=e[i-1],[l,c]=e[i],u=t[i-1],d=t[i]-u,h=[0,...0===d?[]:n.map(({value:e})=>(e-u)/d).filter(e=>e>0&&e<1&&Number.isFinite(e)).sort((e,t)=>e-t).filter((e,t,n)=>0===t||e!==n[t-1]),1];for(let e=1;e<h.length;e++){const t=h[e-1],i=h[e];o(Ka(u+d*((t+i)/2),n,r),[a+(l-a)*t,s+(c-s)*t],[a+(l-a)*i,s+(c-s)*i])}}return i}function Ja(e,t,n,r,i,o){if(t.length<2)return;const a=[0];for(let e=1;e<t.length;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];a.push(a[e-1]+Math.sqrt(n*n+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=o;for(let n=0;n<t.length-1;n++){const r=(a[n]+a[n+1])/2;let o=i;r<l&&(o*=r/l),s-r<l&&(o*=(s-r)/l),e.globalAlpha=Math.max(0,o),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function es(e,t,n){for(const r of t){if(r.path.length<2)continue;const t=r._introClipFraction;void 0!==t&&t<1&&(e.save(),e.beginPath(),e.rect(0,0,n.width*t,n.height),e.clip());const i=Wa(r.style.stroke),o=i?"#007bff":r.style.stroke||"#007bff",a=Fn(e,o)||o,s=i?0:r.style.strokeWidth??2,l=r.colorThresholds,c=r.rawValues;if(r.style.strokeDasharray?e.setLineDash(r.style.strokeDasharray.split(/[\s,]+/).map(Number)):e.setLineDash([]),null!=r.style.opacity&&(e.globalAlpha=r.style.opacity),s>0&&(e.lineWidth=s),e.lineCap=r.style.strokeLinecap||"butt",r.style._edgeFade&&s>0){const t=r.style.opacity??1;Ja(e,r.path,a,s,t,r.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const u=Ba(r.curve),d=l&&l.length>0&&c&&c.length===r.path.length,h=r._decayOpacities;if(s>0&&h&&h.length===r.path.length&&!d){e.strokeStyle=a;const t=r.style.opacity??1;for(let n=0;n<r.path.length-1;n++){const i=.5*(h[n]+h[n+1])*t;e.globalAlpha=i,e.beginPath(),e.moveTo(r.path[n][0],r.path[n][1]),e.lineTo(r.path[n+1][0],r.path[n+1][1]),e.stroke()}}else if(s>0&&!d){e.beginPath();const t=r.strokeGradient&&r.path.length>=2?Ga(e,r.strokeGradient,a,r.path[0][0],0,r.path[r.path.length-1][0],0):null;if(e.strokeStyle=t||a,u)(0,Ng.line)().x(e=>e[0]).y(e=>e[1]).curve(u).context(e)(r.path);else{const[t,n]=r.path[0];e.moveTo(t,n);for(let t=1;t<r.path.length;t++)e.lineTo(r.path[t][0],r.path[t][1])}e.stroke()}else if(s>0){const t=Qa(r.path,c,l,a);for(const n of t){e.beginPath(),e.strokeStyle=Fn(e,n.color)||n.color,e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;t<n.path.length;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.stroke()}}if(r.style.fill&&r.style.fillOpacity&&r.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=r.style.fillOpacity,e.fillStyle=Ha(e,r.style.fill,r.style.fill),u&&!d)(0,Ng.line)().x(e=>e[0]).y(e=>e[1]).curve(u).context(e)(r.path);else{const[t,n]=r.path[0];e.moveTo(t,n);for(let t=1;t<r.path.length;t++)e.lineTo(r.path[t][0],r.path[t][1])}const t=r.path[r.path.length-1][0],i=r.path[0][0];e.lineTo(t,n.height),e.lineTo(i,n.height),e.closePath(),e.fill()}void 0!==t&&t<1&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}}function ts(e,t){if(0!==t.length){e.save();try{const n=e.globalAlpha;let r=[],i="";const o=t=>{e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const r=t.style.opacity??t.style.fillOpacity??1;e.globalAlpha=n*r,e.fillStyle=Ha(e,t.style.fill,"#4e79a7"),e.fill();const i=t.style.strokeWidth??1;t.style.stroke&&"none"!==t.style.stroke&&i>0&&(e.strokeStyle=Ha(e,t.style.stroke,t.style.stroke),e.lineWidth=i,e.stroke()),Ya(e,t)},a=()=>{if(0===r.length)return;if(1===r.length)return o(r[0]),r=[],void(i="");const t=r[0],a=t.style.opacity??t.style.fillOpacity??1;e.globalAlpha=n*a,e.beginPath();for(const t of r)e.moveTo(t.x+t.r,t.y),e.arc(t.x,t.y,t.r,0,2*Math.PI);e.fillStyle=Ha(e,t.style.fill,"#4e79a7"),e.fill();const s=t.style.strokeWidth??1;t.style.stroke&&"none"!==t.style.stroke&&s>0&&(e.strokeStyle=Ha(e,t.style.stroke,t.style.stroke),e.lineWidth=s,e.stroke()),r=[],i=""};for(const e of t){const t=e.style.opacity??e.style.fillOpacity??1,n=e.style.fill;if(Ua(e)||null!=n&&"string"!=typeof n||t<1){a(),o(e);continue}const s=e.style.strokeWidth??1,l=`${n??"#4e79a7"}\0${e.style.stroke&&"none"!==e.style.stroke&&s>0?String(e.style.stroke):""}\0${s}\0${e.r}\0${t}`;r.length>0&&l!==i&&a(),i=l,r.push(e),r.length>=2048&&a()}a()}finally{e.restore()}}}function ns(e,t,n,r,i){if(t.size<=0)return;const o=t.glyph;if(!o||!o.parts?.length)return;const a=Io(o,t.size);if(a.scale<=0)return;const s=t._decayOpacity??1,l=(t.style.opacity??1)*s;if(l<=0)return;const c=t=>{const n=Ha(e,t,t);return"string"==typeof n?n:t},u=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,r),t.rotation&&e.rotate(t.rotation),e.translate(a.offsetX,a.offsetY),e.scale(a.scale,a.scale),e.globalAlpha=i*l*(t.style.fillOpacity??1);const d=$o(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");d&&t.ghostColor&&Oo(e,o,u,t.accent,t.ghostColor,c),d&&(e.beginPath(),e.rect(d.x,d.y,d.width,d.height),e.clip()),Oo(e,o,u,t.accent,void 0,c),e.restore()}function rs(e,t){const n=e.globalAlpha;for(const r of t){const t=r;ns(e,t,t.x,t.y,n)}e.globalAlpha=n}function is(e){const{size:t,scale:n,translate:r,clampX:i=!0,clampY:o=!0}=e,a=Math.max(Math.log(n)/Math.LN2-8,0),s=Math.round(a),l=1<<s,c=Math.pow(2,a-s+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(i?0:-1/0,Math.floor((0-u)/c)),f=Math.min(i?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(o?0:-1/0,Math.floor((0-d)/c)),m=Math.min(o?l:1/0,Math.ceil((t[1]-d)/c)),g=[];for(let e=p;e<m;++e)for(let t=h;t<f;++t)g.push([t,e,s]);return{tiles:g,translate:[u/c,d/c],scale:c}}function os([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function as(e,t,n,r,i){return"function"==typeof e?e(t,n,r,i):e.replaceAll("{z}",String(t)).replaceAll("{x}",String(n)).replaceAll("{y}",String(r)).replaceAll("{r}",i>1?"@2x":"")}function ss(e){if("string"==typeof e)return`template:${e}`;const t=e;let n=Pg.get(t);return null==n&&(n=Eg++,Pg.set(t,n)),`provider:${n}`}function ls(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):256}function cs(e,t){const{tileURL:n,projection:r,width:i,height:o,tileCache:a,onTileLoad:s,maxDevicePixelRatio:l}=t,c=r.scale(),u=r([0,0])??r.translate(),d=is({size:[i,o],scale:2*c*Math.PI,translate:u,clampX:!1}),h=na(l,[i,o]),f=ss(n);let p=!0;for(const t of d.tiles){const[r,i,o]=os(t),l=as(n,o,r,i,h),c=`${f}|dpr:${h}|${o}/${r}/${i}|${l}`;let u=a.get(c);if(!u||u.failed&&(u.attempts??1)<3&&Date.now()>=(u.retryAt??1/0)){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,failed:!1,key:c,lastUsed:performance.now(),attempts:(u?.attempts??0)+1};a.set(c,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0,t.failed=!0,t.retryAt=Date.now()+1e3,s?.()},e.src=l,u=t}if(!u.loaded){p=!1;continue}if(u.failed)continue;const m=d.scale,g=d.translate[0],y=d.translate[1],b=(t[0]+g)*m,v=(t[1]+y)*m;e.drawImage(u.img,b-.5,v-.5,m+1,m+1)}return p}function us(e){let t=0;for(let n=1;n<e.length;n++){const r=e[n][0]-e[n-1][0],i=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+i*i)}return t}function ds(e,t){let n=0;for(let r=1;r<e.length;r++){const i=e[r][0]-e[r-1][0],o=e[r][1]-e[r-1][1],a=Math.sqrt(i*i+o*o);if(n+a>=t||r===e.length-1){const s=a>0?(t-n)/a:0,l=a>.001?a:1;return{x:e[r-1][0]+i*s,y:e[r-1][1]+o*s,nx:-o/l,ny:i/l}}n+=a}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}function hs(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}function fs(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:zg.createElement(zg.Fragment,null,...t)}function ps({value:e,children:t}){const n=(hg??(hg=Dg.createContext(null)),hg);/* @__PURE__ */ /* @__PURE__ */
|
|
121
|
+
return(0,$g.jsx)(n.Provider,{value:e,children:t})}function ms(e,t){return null!=e?/* @__PURE__ */ /* @__PURE__ */(0,$g.jsx)(ps,{value:t,children:e}):e}function gs(e){if(!e||"object"!=typeof e)return!1;const t=e;return"string"==typeof t.id&&"function"==typeof t.cacheKey&&"function"==typeof t.drawCanvas&&"function"==typeof t.renderStaticSVG}function ys(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return gs(n)?n:void 0}function bs(e,t){if("production"===process.env.NODE_ENV)return;const n=`${e}:${t}`;Fg.has(n)||(Fg.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function vs(e){const{context:t,nodes:n,renderMode:r,pixelRatio:i,paintBuiltIn:o}=e;if(!r||"sketchy"===r)return void o(n);let a=[];const s=()=>{a.length&&(o(a),a=[])};for(const e of n){const n=ys(r,e);if(!n){a.push(e);continue}let l;s(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:i})}finally{t.restore()}l||(bs(n.id,e.type??"unknown"),o([e]))}s()}function xs(e){const{node:t,index:n,renderMode:r,fallback:i}=e,o=ys(r,t);if(!o)return{element:i(),renderedByBackend:!1};const a=o.renderStaticSVG({node:t,style:t.style??{},key:`${o.id}-${n}`});return null!=a?{element:Uo(a,t,`${o.id}-${n}-cursor`),renderedByBackend:!0}:(bs(o.id,t.type??"unknown"),{element:i(),renderedByBackend:!1})}function ws(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("glyph"===n.type){const e=n,r=Fo(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}function ks(e){if(!Number.isFinite(e))return String(e);const t=Number.isInteger(e)?e:Number(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():String(t)}function Ss(e,t){return"touch"===t?Math.max(e,24):e}function Ms(e){return Array.isArray(e)?e[0]:e}function js(e,t){return t?.length?(Object.defineProperty(e,Og,{configurable:!0,enumerable:!1,value:t}),e):e}function As(e){return e?.[Og]}function Rs(e){return e.parentLine?js({...e.parentLine,...e},As(e)):e}function Cs(e,t){const n=Rs(e),r={};for(const i of t){const t=n[i];if(void 0!==t){r[i]=[t];continue}const o=As(e)?.map(e=>Rs(e)[i]).filter(e=>void 0!==e);o?.length&&(r[i]=[...new Set(o)])}return r}function Ls(e){const t=!0===e?.__semioticHoverData,n=e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType),r=t||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&n;let i=Ms(r?e.data??{}:e);if(!i)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof i?.x0&&"number"==typeof i?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof i?.sankeyWidth)&&i.data&&"object"==typeof i.data&&(i=i.data),!i)return null;if(r&&(void 0!==e.allSeries||void 0!==e.xValue)){const t=js({...i},As(i));void 0!==e.allSeries&&void 0===t.allSeries&&(t.allSeries=e.allSeries),void 0!==e.xValue&&void 0===t.xValue&&(t.xValue=e.xValue),i=t}return i}function Ns(e){return e.getHours()||e.getMinutes()||e.getSeconds()||e.getMilliseconds()?e.toLocaleString():e.toLocaleDateString()}function Ps(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function Es(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,i=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;const e=t.toLowerCase();if(r&&Hg.has(e))continue;if(null==n)continue;const o=typeof n;("string"===o||"number"===o||"boolean"===o||n instanceof Date)&&i.push({key:t,lower:e,value:n})}if(0===i.length)return{entries:[]};let o=i.findIndex(e=>_g.includes(e.lower));const a=o>=0;o<0&&(o=i.findIndex(e=>"id"===e.lower)),o<0&&(o=i.findIndex(e=>"string"==typeof e.value));const s=o>=0?i[o]:void 0,l=i.filter((e,t)=>t!==o&&(!a||"id"!==e.lower)),c=Ps(l,Bg),u=Ps(l,Wg),d=[];c&&d.push({key:c.key,value:c.value}),u&&d.push({key:u.key,value:u.value});for(const e of l){if(d.length>=n)break;Bg.includes(e.lower)||Wg.includes(e.lower)||d.push({key:e.key,value:e.value})}return{titleKey:s?.key,title:s?.value,entries:d}}function Is(e,t){return"function"==typeof t?t(e):e[t]}function Ts(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e)return Number.isFinite(e)?ks(e):String(e);if(e instanceof Date)return Ns(e);if("object"==typeof e&&null!==e){const t=e;if(void 0!==t.id)return String(t.id);if(void 0!==t.name)return String(t.name);try{return JSON.stringify(e)}catch{return Array.isArray(e)?`[Array(${e.length})]`:"[Object]"}}return String(e)}function zs(e,t,n){const r="string"==typeof t?t:t.accessor||t.key||"";return{label:"string"==typeof t?t:t.label,value:Ts(Is(e,r),"string"==typeof t?n:t.format||n)}}function Ds(e={}){const{fields:t,chrome:n,title:r,format:i,style:o={},className:a=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const l=[];if(r){const t=Is(e,r);s=Ts(t,i)}if(t&&t.length>0)l.push(...t.map(t=>zs(e,t,i)));else if(!r){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=Ts(e[n],i);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Ts(e[t[0]],i))}}/* @__PURE__ */ /* @__PURE__ */
|
|
122
|
+
return(0,qg.jsxs)(jg,{chrome:n,className:a,style:o,children:[s&&/* @__PURE__ */ /* @__PURE__ */(0,qg.jsx)("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:s}),l.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,qg.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&/* @__PURE__ */ /* @__PURE__ */(0,qg.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function $s(e={}){const{fields:t=[],chrome:n,title:r,format:i,style:o={},className:a="",showLabels:s=!0,separator:l=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const c=[];if(r){const t=Is(e,r);c.push({value:Ts(t,i)})}if(t&&Array.isArray(t)&&t.length>0)for(const n of t){const t=zs(e,n,i);c.push({...t,label:s?t.label:void 0})}else{const t=Es(e,{skipPositional:!1});null!=t.title&&c.push({label:void 0,value:Ts(t.title,i),bold:!0}),t.entries.forEach(e=>{c.push({label:s?e.key:void 0,value:Ts(e.value,i)})})}return Array.isArray(c)&&0!==c.length?/* @__PURE__ */ /* @__PURE__ */(0,qg.jsx)(jg,{chrome:n,className:`semiotic-tooltip-multiline ${a}`.trim(),style:o,children:c.map((e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,qg.jsxs)("div",{style:{marginBottom:t<c.length-1?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&/* @__PURE__ */ /* @__PURE__ */(0,qg.jsxs)("strong",{children:[e.label,l]}),e.value]},t))}):null}}function Fs(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"mode"in e&&"multi"===e.mode}function Os(e){if(!0!==e){if("function"==typeof e||"object"==typeof e&&null!==e&&"content"in e&&"function"==typeof e.content&&!Fs(e)){const t="function"==typeof e?e:e.content,n="function"==typeof e?void 0:e.chrome,r=e=>{const r=Ls(e);if(!r)return null;const i=t(r);return Pa(i)?void 0===n&&(Fa(t)||Fa(i))?i:/* @__PURE__ */ /* @__PURE__ */(0,qg.jsx)(jg,{chrome:n,children:i}):null};return void 0===n&&Fa(t)?Da(r):r}if(!1===e||void 0===e)return!1;if(Fs(e)){if("function"==typeof e.content)return Gg||"production"===process.env.NODE_ENV||(Gg=!0,console.warn('[semiotic] tooltip={{ mode: "multi", content }} reached a chart without multi-series hover. content receives one datum and no allSeries.')),Os(void 0===e.chrome?e.content:{content:e.content,chrome:e.chrome});"production"!==process.env.NODE_ENV&&console.warn('[semiotic] tooltip={{ mode: "multi" }} reached normalizeTooltip without a chart that wires tooltipMode. Use a line/area-family chart with multi support, or pass frameProps.tooltipMode: "multi" to StreamXYFrame.');const t=$s({chrome:e.chrome});return Os(e=>t(e))}if("object"==typeof e&&null!==e&&("fields"in e||"title"in e||"chrome"in e)){const t=Ds(e);return Os(e=>t(e))}if("multi"===e){"production"!==process.env.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip on a single-tooltip chart. Rendering multi-field content as a backward-compatible fallback.');const e=$s();return Os(t=>e(t))}return Ds()}}function _s(e,t,n,r,i,o){const a=i-n,s=o-r,l=a*a+s*s;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*a+(t-r)*s)/l;c=Math.max(0,Math.min(1,c));const u=n+c*a,d=r+c*s;return Math.sqrt((e-u)**2+(t-d)**2)}function Bs(e,t=30,n=1){return Math.max((e??4)+5/n,12/n,t)}function Ws(e,t,n,r,i,o=e=>e.x,a=e=>e.y,s=e=>e.r,l,c=1){const u=Bs(i,r,c),d=t-u,h=t+u,f=n-u,p=n+u;let m=null,g=1/0;return e.visit((e,i,u,y,b)=>{if(i>h||y<d||u>p||b<f)return!0;const v=e;if(!v.length){let e=v;do{const i=e.data,u=o(i)-t,d=a(i)-n,h=Math.sqrt(u*u+d*d);h<=Bs(s(i),r,c)&&(null===m||(l?l(i,m,h,g):h<g))&&(m=i,g=h),e=e.next}while(e)}return!1}),m?{node:m,distance:g}:null}function Hs(e,t,n,r,i,o,a=0,s=r){if(o){const e=Ws(o,t,n,r,a);if(e&&!1!==e.node.interactive)return e}else{let i=null,o=1/0;for(const a of e){if("point"!==a.type)continue;if(!1===a.interactive)continue;const e=a.x-t,s=a.y-n,l=Math.sqrt(e*e+s*s);l<=Bs(a.r,r)&&l<o&&(i=a,o=l)}if(i)return{node:i,distance:o}}let l=null,c=1/0;for(const i of e){if("glyph"!==i.type)continue;if(null==i.datum)continue;const e=Fo(i.glyph,i.size),o=i.x+e.centerDx-t,a=i.y+e.centerDy-n,s=Math.sqrt(o*o+a*a);s<=Bs(e.radius,r)&&s<c&&(l=i,c=s)}if(l)return{node:l,distance:c};let u=null,d=1/0;for(const r of e){if("line"!==r.type)continue;const e=r,{path:i}=e,o=Math.max((e.style.strokeWidth??2)+4,5,s),a=t-o,l=t+o,c=n-o,h=n+o;for(let r=0;r<i.length-1;r++){const s=i[r],f=i[r+1],p=s[0],m=s[1],g=f[0],y=f[1];if(p<a&&g<a||p>l&&g>l||m<c&&y<c||m>h&&y>h)continue;const b=_s(t,n,p,m,g,y);b<=o&&b<d&&(u=e,d=b)}}if(u)return{node:u,distance:d};for(let r=e.length-1;r>=0;r--){const o=e[r];if("geoarea"!==o.type)continue;const a=o;if(!1===a.interactive)continue;const[[s,l],[c,u]]=a.bounds;if(!(t<s||t>c||n<l||n>u)&&(a._cachedPath2D||(a._cachedPath2D=new Path2D(a.pathData)),i.isPointInPath(a._cachedPath2D,t,n)))return{node:a,distance:0}}return null}function qs(){if(null!==Xg)return Xg;if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&navigator.deviceMemory<=4;return Xg=e||t||n}function Gs(){return qs()?12:30}function Vs(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Us(e){const t=e.pointer.clientX-e.canvasRect.left-e.margin.left,n=e.pointer.clientY-e.canvasRect.top-e.margin.top;if(t<0||t>e.width||n<0||n>e.height)return{kind:"outside"};e.hitCanvasRef.current||(e.hitCanvasRef.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=(i=e.hitCanvasRef.current)?i.getContext("2d"):null;var i;if(!r)return{kind:"unavailable"};const o=Hs(e.scene,t,n,Ss(30,e.pointer.pointerType),r,e.pointQuadtree,e.maxPointRadius,Ss(6,e.pointer.pointerType));if(!o)return{kind:"miss"};const{node:a}=o,s=a.datum,l=Array.isArray(s)?null:s?.properties?s:s?.data||s,c="point"===a.type?a.x:"geoarea"===a.type?a.centroid[0]:t,u="point"===a.type?a.y:"geoarea"===a.type?a.centroid[1]:n;return{kind:"hit",node:a,hover:{...l,...l?.properties||{},data:l,properties:l?.properties,__semioticHoverData:!0,x:c,y:u}}}function Ys(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function Xs(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"hover-end",timestamp:l,chartType:o,chartId:a}))}function Zs(e){const{onObservation:t,datum:n,x:r=0,y:i=0,chartType:o,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:i,timestamp:l,chartType:o,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:o,chartId:a})):t({type:"click-end",timestamp:l,chartType:o,chartId:a}))}function Ks({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:i}){const o=Boolean(e||n),a=Boolean(t||n),s=(0,Kg.useCallback)((t,o)=>{e?.(t,o),Xs({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:i,chartId:r,context:o})},[r,i,e,n]),l=(0,Kg.useCallback)((e,o)=>{t?.(e,o),Zs({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:i,chartId:r,context:o})},[r,i,t,n]);return{customHoverBehavior:o?s:void 0,customClickBehavior:a?l:void 0,hasClickBehavior:a}}function Qs(e){const t=/* @__PURE__ */new Map;for(const n of e){const e=n.group??"_default";let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;t<e.length;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const r=t.get(e),i=t.get(n);return(r.length>0?r[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(t.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const i=/* @__PURE__ */new Map;for(let e=0;e<r.length;e++){r[e]._flatIndex=e;const t=r[e].datum?.id;null!=t&&i.set(String(t),e)}return{flat:r,groups:n,byGroup:t,idToIdx:i}}function Js(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function el(e,t,n){const{group:r,indexInGroup:i}=t,o=n.byGroup.get(r);switch(e){case"ArrowRight":return i<o.length-1?o[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?o[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(r);return e<n.groups.length-1?tl(n,n.groups[e+1],o[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(r);return e>0?tl(n,n.groups[e-1],o[i]):t.flatIndex}case"PageDown":{const e=Math.max(1,Math.floor(.1*n.flat.length));return Math.min(t.flatIndex+e,n.flat.length-1)}case"PageUp":{const e=Math.max(1,Math.floor(.1*n.flat.length));return Math.max(t.flatIndex-e,0)}case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function tl(e,t,n){const r=e.byGroup.get(t);let i=0,o=Math.abs(r[0].x-n.x);for(let e=1;e<r.length;e++){const t=Math.abs(r[e].x-n.x);t<o&&(o=t,i=e)}return r[i]._flatIndex}function nl(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return t<n-1?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":{const e=Math.max(1,Math.floor(.1*n));return Math.min(t+e,n-1)}case"PageUp":{const e=Math.max(1,Math.floor(.1*n));return Math.max(t-e,0)}case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function rl(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x&&!1!==n.interactive)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(n.size<=0||null==n.datum)continue;const e=Fo(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else if("line"===n.type){if(null==n.datum||n.path.length<2)continue;const e=n.path.slice(1).map((e,t)=>Math.hypot(e[0]-n.path[t][0],e[1]-n.path[t][1]));let r=e.reduce((e,t)=>e+t,0)/2;if(!Number.isFinite(r)||r<=0)continue;for(let i=0;i<e.length;i++){const o=e[i];if(o>0&&r<=o){const e=n.path[i],a=n.path[i+1],s=r/o;t.push({x:e[0]+(a[0]-e[0])*s,y:e[1]+(a[1]-e[1])*s,datum:Ms(n.datum),shape:"path",pathData:`M${n.path.map(e=>e.join(",")).join("L")}`});break}r-=o}}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&t.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function il(e,t,n,r,i,o){const a=n.current;if(t.current<0||!a)return;const s=e=>(e.datum===a.datum||void 0!==a.semanticKey&&e.semanticKey===a.semanticKey)&&e.group===a.group&&e.shape===a.shape,l=e[t.current]&&s(e[t.current])?t.current:e.findIndex(s),c=e[l];if(t.current=l,n.current=c??null,c&&c.datum===a.datum&&c.x===a.x&&c.y===a.y&&c.w===a.w&&c.h===a.h&&c.pathData===a.pathData&&c.stats===a.stats)return;const u=c?o(c):null;r.current=u,i(u)}function ol({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:i,customClickBehavior:o,scheduleRender:a,clearPointerHover:s,extractPoints:l,toHover:c,navigation:u="graph",nextConnected:d}){const h=(0,Qg.useRef)(-1),f=(0,Qg.useRef)(-1),p=(0,Qg.useRef)(null),m=(0,Qg.useRef)(null),g=(0,Qg.useCallback)(()=>{const i=e.current;if(!i)return;if(f.current<0)return void(m.current=null);const o=Qs(l(i.scene));m.current={version:i.version,graph:o},il(o.flat,f,p,t,r,e=>c(e,i)),f.current<0&&n&&(n.current=null)},[l,t,n,r,e,c]),y=(0,Qg.useCallback)(g=>{if(Ys(g))return;const y=e.current;if(!y)return;const b=()=>{const e=null!==t.current;f.current=-1,p.current=null,h.current=-1,t.current=null,n&&(n.current=null),r(null),e&&i?.(null),a()};if("Escape"===g.key)return g.preventDefault(),s?.(),void b();if(0===y.scene.length)return void(f.current>=0&&b());let v;if(m.current?.version===y.version)v=m.current.graph;else{const e=l(y.scene);if(0===e.length)return void(f.current>=0&&b());v=Qs(e),m.current={version:y.version,graph:v}}let x,w=f.current;if(w>=v.flat.length&&(b(),w=-1),("Enter"===g.key&&!d||" "===g.key)&&w>=0)return g.preventDefault(),void o?.(c(v.flat[w],y),{type:"activate",inputType:"keyboard"});if(w<0){if(!(["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(g.key)||d&&"Enter"===g.key))return;h.current=-1,x=0}else x=d?d(g.key,v,w,h):"linear"===u?nl(g.key,w,v.flat.length):el(g.key,Js(v,w),v);if(null===x)return;if(g.preventDefault(),x<0)return void b();f.current=x;const k=v.flat[x];p.current=k;const S=c(k,y);t.current=S,r(S),i?.(S,{type:"focus",inputType:"keyboard"}),a()},[s,o,i,l,d,u,t,n,a,r,e,c]);return{kbFocusIndexRef:f,focusedNavPointRef:p,neighborIndexRef:h,onKeyDown:y,refreshKeyboardFocus:g}}function al(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}function sl(e,t,n,r){return"function"==typeof e?e({size:t,margin:n,scales:r}):e}function ll({foregroundGraphics:e,backgroundGraphics:t,size:n,margin:r,scales:i,background:o,themeBackgroundColor:a,resolveScaleAwareGraphics:s=!0}){const l=`var(--semiotic-bg, ${a})`;return{resolvedForeground:s||"function"!=typeof e?sl(e,n,r,i):null,resolvedBackground:s||"function"!=typeof t?sl(t,n,r,i):null,themeBackground:l,surfaceBackground:da({background:o,hasBackgroundGraphics:Boolean(t),themeBackground:l})}}function cl(e){const t=/* @__PURE__ */new Set;let n=0,r=e;return{subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>n,sync(e){if(e!==r){r=e,n+=1;for(const e of t)e()}}}}function ul({graphics:e,size:t,margin:n,readScales:r,tracker:i}){return(0,ey.useSyncExternalStore)(i.subscribe,i.getSnapshot,i.getSnapshot),Jg.createElement(Jg.Fragment,null,sl(e,t,n,r()))}function dl({tracker:e,readScales:t,...n}){const r=r=>"function"==typeof r?Jg.createElement(ul,{graphics:r,size:n.size,margin:n.margin,readScales:t,tracker:e}):r;return{...ll({...n,resolveScaleAwareGraphics:!1}),resolvedForeground:r(n.foregroundGraphics),resolvedBackground:r(n.backgroundGraphics)}}function hl(e,t,n){const r=e.current;r.inside=!0,r.clientX=t.clientX,r.clientY=t.clientY,r.pointerType=t.pointerType??n}function fl(e){var t,n,r;t=e.canvas,n=e.pointer,r=t=>{const n=Us({pointer:t,canvasRect:e.canvas.getBoundingClientRect(),margin:e.margin,width:e.width,height:e.height,scene:e.store.scene,pointQuadtree:e.geometryMoved?null:e.store.quadtree,maxPointRadius:e.store.maxPointRadius,hitCanvasRef:e.hitCanvasRef});return"hit"===n.kind?Ho(n.node):void 0},t&&(n.inside&&"touch"!==n.pointerType?Go(t,r(n)):Go(t))}function pl(e,t){return e.displayName=t,e}function ml(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}function gl(e,t,n,r){if(!t)return e;const i=(i,...o)=>{const a={...e(i,...o)};if(t.isActive)if(t.predicate(r?r(i):i))n?.selectedStyle&&Object.assign(a,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;a.opacity=e,a.fillOpacity=e,a.strokeOpacity=e,n?.unselectedStyle&&Object.assign(a,n.unselectedStyle)}return a};return js(i,[i])}function yl(e){let t=null;const n=()=>(t||(t=(0,cy.createContext)(null)),t),r=bl(e);return[function({children:t,initialState:r}){const i=(0,cy.useRef)(r),o=(0,cy.useMemo)(()=>bl(e,i.current),[]),a=n();/* @__PURE__ */ /* @__PURE__ */
|
|
123
|
+
return(0,uy.jsx)(a.Provider,{value:o,children:t})},(e,t)=>{const i=n(),o=(0,cy.useContext)(i)??r,a=(0,cy.useRef)(e);a.current=e;const s=(0,cy.useRef)({hasValue:!1,value:void 0}),l=(0,cy.useCallback)(()=>{const e=a.current(o.getState()),n=s.current;return n.hasValue&&t&&t(n.value,e)?n.value:(s.current={hasValue:!0,value:e},e)},[o,t]),c=(0,cy.useCallback)(()=>a.current(o.getState()),[o]);return(0,cy.useSyncExternalStore)(o.subscribe,l,c)}]}function bl(e,t){const n=/* @__PURE__ */new Set;let r={...e(function(e){const t=e(r);if(vl(t)){r={...r,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function vl(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function xl(){return hy(e=>e.theme)}function wl(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function kl(e){if(!("number"!=typeof e.height||e.height<=0))return e.width>=e.height?"landscape":"portrait"}function Sl(e){if(!("number"!=typeof e.height||e.height<=0))return e.width/e.height}function Ml(e,t){const{when:n}=e,r=t.width,i=t.height,o=Sl(t),a=kl(t);return!("number"==typeof n.minWidth&&r<n.minWidth||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof i||i<n.minHeight)||"number"==typeof n.maxHeight&&("number"!=typeof i||i>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof o||o<n.minAspectRatio)||"number"==typeof n.maxAspectRatio&&("number"!=typeof o||o>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function jl(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])wl(e[r])&&wl(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}function Al(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>Ml(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>jl(e,t.rule.transform),e),matches:r}}function Rl(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,i="mobile"===t.mode||"number"==typeof t.width&&t.width<=480,o=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!i&&!o)return fy;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function Cl(e,t,n){const r=py[e||"primary"],i=e&&"primary"!==e||!n?.width?r.width:n.width,o=e&&"primary"!==e||!n?.height?r.height:n.height,a=Al({...t,mode:e},{width:t.width??i,height:t.height??o}).props,s=a.mode||e||"primary",l=py[s],c="context"===s||"sparkline"===s,u="primary"===s&&n?.width?n.width:l.width,d="primary"===s&&n?.height?n.height:l.height;return{mode:s,width:a.width??u,height:a.height??d,showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:Nl(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:Rl(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function Ll(e){return e.compactMode?e.marginDefaults:my}function Nl(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Pl(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const i=Number(r);return Number.isFinite(i)?i:null}function El(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?js({...t,xValue:e.xValue},As(t)):t||{}}function Il(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Tl(e){const t=/* @__PURE__ */new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function zl(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Dl(e,t){const n=(0,yy.useContext)(vy),r=(0,yy.useId)(),i=Tl(e),o=i.map(e=>t?.(e)),a=(0,yy.useRef)({categories:[],colors:[]});zl(a.current.categories,i)&&zl(a.current.colors,o)||(a.current={categories:i,colors:o});const s=a.current;xy(()=>{if(n)return()=>n.unregisterCategories(r)},[n,r]),xy(()=>{n&&n.registerCategories(r,s)},[n,r,s])}function $l({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:i,strokeWidth:o,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==o&&(n.strokeWidth=o),n},type:"fill",items:(void 0!==a?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,o)=>{const a="function"==typeof t?e.find(e=>t(e)===i):e.find(e=>e[t]===i),s=a?r(a,t,n):n?n(i):Pf[o%Pf.length];return{label:String(i),color:s,__semioticCategory:!0}}),label:""}]}}function Fl(e,t){if(!t)return[];const n=/* @__PURE__ */new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(String(e))}return Array.from(n)}function Ol(e,t){return null!=e&&Object.hasOwn(e,t)}function _l(e,t,n){const r=Ol(n,"legendPosition"),i=Ol(n,"legendLayout");return{legendPosition:r?n?.legendPosition??"right":e??"right",legendLayout:i?n?.legendLayout:t}}function Bl({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:i,userMargin:o,defaults:a={top:50,bottom:60,left:70,right:40},categories:s,additionalLegend:l,chartWidth:c,chartHeight:u,legendLayout:d,frameLegend:h,hasTitle:f=!1,axisChrome:p}){const{legendPosition:m,legendLayout:g}=_l(i,d,h),y=Ol(h,"legend"),b=(0,yy.useContext)(by),v=null!==(0,yy.useContext)(vy),x=void 0!==r?r:!b&&!!t,w=!!t&&(x||v),k=(0,gy.useMemo)(()=>w?void 0!==s?s:Fl(e,t):[],[s,t,e,w]);Dl(v&&t?k:[],n);const S=(0,gy.useMemo)(()=>{if(!x||!t)return;const r=$l({data:e,colorBy:t,colorScale:n,getColor:Ot,categories:k});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[x,t,e,n,k]),M=(0,gy.useMemo)(()=>y?h?.legend:qn(S,l),[S,l,h?.legend,y]),{hasAxis:j,hasAxisLabel:A,rotatedTicks:R,topAxis:C,leftAxis:L,rightAxis:N}=p??{},P=void 0!==C,E=void 0!==L,I=void 0!==N,{hasAxis:T,hasAxisLabel:z,rotatedTicks:D}=C??{},{hasAxis:$,hasAxisLabel:F}=L??{},{hasAxis:O,hasAxisLabel:_}=N??{},B=(0,gy.useMemo)(()=>{const e="number"==typeof o?{top:o,bottom:o,left:o,right:o}:o??{},t=ar(a,h?.axes,f),n=n=>{const r=e[n];return"number"==typeof r?r:t[n]},r={top:n("top"),right:n("right"),bottom:n("bottom"),left:n("left")},i={...r};return M&&(nr(r,{legend:M,position:m,size:[c??600,u??400],hasTitle:f,legendLayout:g,minimumMargin:"bottom"===m?80:"top"===m?50:0,axisChrome:void 0===j?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:j,hasAxisLabel:A,rotatedTicks:R,topAxis:P?{hasAxis:T,hasAxisLabel:z,rotatedTicks:D}:void 0,leftAxis:E?{hasAxis:$,hasAxisLabel:F}:void 0,rightAxis:I?{hasAxis:O,hasAxisLabel:_}:void 0}}),null!=c&&null!=u&&Un(r,i,[c,u],m)),r},[a,h?.axes,o,M,m,c,u,g,f,j,A,R,P,T,z,D,E,$,F,I,O,_]);return{legend:M,margin:B,legendPosition:m,legendLayout:g,legendMarginReserved:void 0!==M&&!Ol(h,"margin"),hasAutomaticLegend:void 0!==S}}function Wl(e){const t=e.valueRange;return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]?[t[0],t[1]]:null}function Hl(e,t){return"string"==typeof e.interactionKey?e.interactionKey:`${t[0]}:${t[1]}`}function ql(e,t,n,r=!0,i=!1){const[o,a]=(0,gy.useState)(null),[s,l]=(0,gy.useState)(
|
|
124
|
+
/* @__PURE__ */new Set),c=(0,gy.useMemo)(()=>/* @__PURE__ */new Set,[]),u=(0,gy.useMemo)(()=>new Set(n),[n]),d=null!=o&&u.has(o)?o:null,h=(0,gy.useMemo)(()=>{if(0===s.size)return s;const e=new Set(Array.from(s).filter(e=>u.has(e)));return 0===e.size||e.size===u.size?c:e.size===s.size?s:e},[u,c,s]);(0,gy.useEffect)(()=>{r&&t&&e&&"none"!==e||(a(null),l(e=>0===e.size?e:/* @__PURE__ */new Set))},[t,r,e]),(0,gy.useEffect)(()=>{a(e=>null==e||u.has(e)?e:null),l(e=>{if(0===e.size)return e;const t=new Set(Array.from(e).filter(e=>u.has(e)));return 0===t.size||t.size===u.size?/* @__PURE__ */new Set:t.size===e.size?e:t})},[u]);const f=(0,gy.useCallback)(t=>{r&&"highlight"===e&&a(!t||!u.has(t.label)||i&&!0!==t.__semioticCategory?null:t.label)},[u,r,e,i]),p=(0,gy.useCallback)(t=>{!r||"isolate"!==e||!u.has(t.label)||i&&!0!==t.__semioticCategory||l(e=>{const n=new Set(Array.from(e).filter(e=>u.has(e)));return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===u.size?/* @__PURE__ */new Set:n})},[u,r,e,i]),m=(0,gy.useMemo)(()=>{if(!r||!e||"none"===e||!t)return null;const n=e=>{const n="function"==typeof t?t(e):e[t];return"string"==typeof n?n:String(n)};return"highlight"===e&&null!=d?{isActive:!0,predicate:e=>n(e)===d}:"isolate"===e&&h.size>0?{isActive:!0,predicate:e=>h.has(n(e))}:null},[t,r,e,d,h]);return{highlightedCategory:r&&"highlight"===e?d:null,isolatedCategories:r&&"isolate"===e?h:c,onLegendHover:f,onLegendClick:p,legendSelectionHook:m}}function Gl(e,t,n,r=5){const[i,o]=n,[a,s]=(0,gy.useState)(null),[l,c]=(0,gy.useState)(/* @__PURE__ */new Map),u=(0,gy.useMemo)(()=>/* @__PURE__ */new Set,[]);(0,gy.useEffect)(()=>{s(null),c(/* @__PURE__ */new Map)},[i,o,r,e]);const d=(0,gy.useCallback)(t=>{if("highlight"!==e||!t)return void("highlight"===e&&s(null));const n=Wl(t);n&&s({key:Hl(t,n),range:n})},[e]),h=(0,gy.useCallback)(t=>{if("isolate"!==e)return;const n=Wl(t);n&&c(e=>{const i=new Map(e),o=Hl(t,n);return i.has(o)?i.delete(o):i.set(o,n),i.size===r?/* @__PURE__ */new Map:i})},[r,e]),f=(0,gy.useMemo)(()=>{const n="highlight"===e&&a?[a.range]:"isolate"===e?[...l.values()]:[];return 0===n.length?null:{isActive:!0,predicate:e=>{const r=t(e);return Number.isFinite(r)&&n.some(([e,t])=>r>=Math.min(e,t)&&r<=Math.max(e,t))}}},[a,l,e,t]);return{highlightedCategory:"highlight"===e?a?.key??null:null,isolatedCategories:"isolate"===e?new Set(l.keys()):u,onLegendHover:d,onLegendClick:h,legendSelectionHook:f}}function Vl(){const e=xl(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Ul(){const e=xl();return e?.colors?.sequential||void 0}function Yl(e,t,n){const r=(0,oy.useChartCategoryColors)(null!=n),i=Vl();return(0,iy.useMemo)(()=>{if(!t)return;const o=r??void 0,a=n??(i&&i.length>0?i:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>String(t(e)))));if(o&&Il(o)){const e=Bt(n.map(e=>({_cat:e})),"_cat",a);return t=>_t(o,t)??e(t)}return Bt(n.map(e=>({_cat:e})),"_cat",a)}if(o&&Il(o)){const n=Bt(e,t,a);return e=>_t(o,e)??n(e)}return Bt(e,t,a)}if(o&&Il(o)){const e=Bt([{_:"a"}],"_",a);return t=>_t(o,t)??e(t)}},[e,t,n,r,i])}function Xl({selection:e,linkedHover:t,fallbackFields:n=wy,unwrapData:r=!1,onObservation:i,chartType:o,chartId:a,onClick:s,hoverHighlight:l,hoverHighlightField:c,colorByField:u,mobileInteraction:d,emitObservations:h=!0}){const f=(0,iy.useId)(),p=(0,sy.useCrosshairActions)(),{setCrosshairPosition:m,clearCrosshairPosition:g,toggleCrosshairLock:y,unlockCrosshair:b}=p,v=(0,iy.useRef)(p);v.current=p;const x=(0,iy.useMemo)(()=>ml(t,n),[t,n]),w=(0,iy.useMemo)(()=>"series"===x?.mode?[x.seriesField||u||n[0]].filter(e=>!!e):x?.fields||n,[x,u,n]),k=(0,ay.useSelection)({name:e?.name||"__unused__",fields:w}),S=(0,ay.useLinkedHover)({name:x?.name||"hover",fields:w}),M=(0,ly.useObservationSelector)(e=>e.pushObservation),j=(0,iy.useCallback)(e=>{i?.(e),M?.(e)},[i,M]),A=e?{isActive:k.isActive,predicate:k.predicate}:null,[R,C]=(0,iy.useState)(null),L=(0,iy.useRef)(!1),N=c||u||n[0],P=(0,iy.useMemo)(()=>{if(!l||null==R||!N)return null;const e=R,t=N;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:String(n[t]??""))===e}},[l,R,N]),E=(0,iy.useCallback)((e,n)=>{const r=!e&&L.current&&!!d?.enabled&&d.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===x?.mode&&x.xField){const n=Pl(e,t,x.xField);null!=n&&m(x.name||"hover",n,f)}"x-position"!==x?.mode&&S.onHover(t)}else"x-position"!==x?.mode||r||g(x.name||"hover",f),"x-position"===x?.mode||r||S.onHover(null);if(l&&N)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[N];C(null!=n?String(n):null)}else r||C(null);h&&(i||M)&&Xs({onObservation:j,datum:e?El(e):null,x:e?.x,y:e?.y,chartType:o||"unknown",chartId:a,context:n})},[t,S,x,f,i,o,a,M,j,h,l,N,d,m,g]),I=(0,iy.useCallback)((n=!0)=>{L.current=!1,t&&"x-position"!==x?.mode&&S.onHover(null),e&&d?.tapToSelect&&k.clear(),n&&l&&C(null),"x-position"===x?.mode&&(b(x.name||"hover",f),g(x.name||"hover",f))},[t,x,S,e,d,k,l,f,g,b]),T=(0,iy.useCallback)((n,r)=>{const c=!!d?.enabled&&(d.tapToLockTooltip||d.tapToSelect),u=!!d?.enabled&&"backgroundTap"===d.clearSelection;if("x-position"===x?.mode&&x.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Pl(n,e,x.xField);null!=t&&y(x.name||"hover",t,f)}if(c)if(n){L.current=!0;const r=El(n);if(t&&"x-position"!==x?.mode&&S.onHover(r),e&&d?.tapToSelect&&w.length>0){const e=Cs(r,w);Il(e)&&k.selectPoints(e)}if(l&&N){const e=r?.[N];C(null!=e?String(e):null)}}else u&&I();if(n||u){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}h&&(i||M)&&Zs({onObservation:j,datum:n?El(n):null,x:n?.x,y:n?.y,chartType:o||"unknown",chartId:a,context:r})}},[s,h,i,M,j,o,a,x,f,d,t,S,e,k,w,l,N,I,y]);(0,iy.useEffect)(()=>{if(!d?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&L.current&&I()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[d?.enabled,I]);const z=(0,iy.useRef)(I);return z.current=I,(0,iy.useEffect)(()=>()=>{L.current&&z.current(!1)},[]),(0,iy.useEffect)(()=>{if("x-position"!==x?.mode)return;const e=x.name||"hover";return()=>{v.current.releaseCrosshair(e,f)}},[x?.mode,x?.name,f]),{activeSelectionHook:A,hoverSelectionHook:P,customHoverBehavior:E,customClickBehavior:T,crosshairSourceId:f}}function Zl(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Kl(e,t,n){return Cl(e,t,n)}function Ql(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}function Jl(e,t){if(!Ql(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function ec(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>nc(t(e))}function tc(e,t){const n=ec(t??"value"),r=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{const t=r?r(e):void 0;return{value:n(e),category:null==t?void 0:String(t)}}}function nc(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function rc(e,t,n){const r=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&r!==e.eq)return!1;if(void 0!==e.ne&&r===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(r))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const i=nc(r);if(void 0===i)return!1;if(void 0!==e.gt&&!(i>e.gt))return!1;if(void 0!==e.gte&&!(i>=e.gte))return!1;if(void 0!==e.lt&&!(i<e.lt))return!1;if(void 0!==e.lte&&!(i<=e.lte))return!1;if(void 0!==e.within){const[t,n]=e.within;if(!(i>=t&&i<=n))return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(!(i<t||i>n))return!1}return!0}function ic(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):rc(r,t,n))}function oc(e,t,n){if(!t||0===t.length)return{};let r={};for(const i of t){if(!ic(i,e,n))continue;const t="function"==typeof i.style?i.style(e,n):i.style;t&&(r={...r,...t})}return r}function ac(e,t,n,r=e=>e){const i=e??(()=>({}));return t&&0!==t.length?(e,o)=>{const a=r(e),s={...i(e,o)};return Object.assign(s,oc(a,t,n(a,o))),s}:i}function sc({componentName:e,message:t,diagnosticHint:n,width:r,height:i}){/* @__PURE__ */ /* @__PURE__ */
|
|
125
|
+
return(0,ky.jsx)("div",{role:"alert",style:{width:r,height:Math.max(i,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:/* @__PURE__ */ /* @__PURE__ */(0,ky.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[
|
|
126
126
|
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */(0,
|
|
127
|
+
/* @__PURE__ */(0,ky.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),
|
|
128
128
|
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */(0,
|
|
130
|
-
return(0,
|
|
131
|
-
return(0,
|
|
132
|
-
return(0,
|
|
129
|
+
/* @__PURE__ */(0,ky.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&/* @__PURE__ */ /* @__PURE__ */(0,ky.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}function lc(e,t,n){return{width:n?.responsiveWidth?"100%":e,height:n?.responsiveHeight?"100%":t}}function cc({componentName:e,width:t,height:n,children:r}){/* @__PURE__ */ /* @__PURE__ */
|
|
130
|
+
return(0,Ay.jsx)(jy,{fallback:r=>/* @__PURE__ */ /* @__PURE__ */(0,Ay.jsx)(sc,{componentName:e,message:r.message,width:t,height:n}),children:r})}function uc(e,t,n,r,i){return!1===r||null==e?null:Array.isArray(e)?e.some(e=>null!=e&&"object"==typeof e)?null:/* @__PURE__ */ /* @__PURE__ */(0,Ay.jsx)("div",{style:{...Ry,...lc(t,n,i)},children:r||"No data available"}):null}function dc(e,t,n,r,i){if(!e)return null;if(!1===r)return null;if(null!=r)/* @__PURE__ */ /* @__PURE__ */
|
|
131
|
+
return(0,Ay.jsx)("div",{style:{...lc(t,n,i),display:"flex",flexDirection:"column",alignItems:"stretch",textAlign:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.max(1,Math.min(5,Math.floor(n/40))),a=Math.max(8,Math.floor(n/(3*o))),s=Math.max(6,Math.floor(n/(2.5*o))),l=Math.floor((n-(o*(a+s)-s))/2),c=e=>i?.responsiveHeight?100*e/Math.max(1,n)+"%":e,u=Array.from({length:o},(e,t)=>/* @__PURE__ */ /* @__PURE__ */(0,Ay.jsx)("div",{className:"semiotic-loading-bar",style:{...Cy,position:"absolute",top:c(l+t*(a+s)),left:"10%",width:30+(37*t+13)%50+"%",height:c(a),opacity:.5+t%2*.2}},t));/* @__PURE__ */ /* @__PURE__ */
|
|
132
|
+
return(0,Ay.jsx)("div",{style:{...lc(t,n,i),position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:u})}function hc(e,t,n,r){if("production"===process.env.NODE_ENV)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const i=t[0];if(!i||"object"!=typeof i)return;if(r in i)return;const o=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${o}`)}function fc(e){const t=(0,Ny.useThemeSelector)(e=>e.theme.colors.selectionOpacity);return(0,Ly.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function pc(e){return"default"in e?e.default:e}async function mc(e){try{switch(e){case"world-110m":return{topology:pc(await(import("world-atlas/countries-110m.json"))),objectName:"countries"};case"world-50m":return{topology:pc(await(import("world-atlas/countries-50m.json"))),objectName:"countries"};case"land-110m":return{topology:pc(await(import("world-atlas/land-110m.json"))),objectName:"land"};case"land-50m":return{topology:pc(await(import("world-atlas/land-50m.json"))),objectName:"land"};default:throw new Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){const n=t instanceof Error?t.message:String(t);if(/Cannot find module|Failed to resolve|world-atlas/i.test(n))throw new Error(`resolveReferenceGeography("${e}"): ${zy}`,{cause:t});throw t}}async function gc(e){const t=Ty.get(e);if(t)return t;const{topology:n,objectName:r}=await mc(e);if(!n||!n.objects)throw new Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const i=(0,Iy.feature)(n,n.objects[r]),o="features"in i?i.features:[i];return Ty.set(e,o),o}function yc(e){const t=(0,Ey.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,Ey.useState)(null);return(0,Ey.useEffect)(()=>{if(e&&!Array.isArray(e)){if("string"==typeof(t=e)&&["world-110m","world-50m","land-110m","land-50m"].includes(t)){let t=!1;return r(null),gc(e).then(e=>{t||r(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".`),r(null)}else r(null)},[e]),void 0!==t?t:n}function bc(e){const{title:t,description:n,summary:r,accessibleTable:i,className:o,animate:a,maxDevicePixelRatio:s,axisExtent:l,autoPlaceAnnotations:c}=e,u={};return t&&(u.title=t),n&&(u.description=n),r&&(u.summary=r),void 0!==i&&(u.accessibleTable=i),o&&(u.className=o),null!=a&&(u.animate=a),void 0!==s&&(u.maxDevicePixelRatio=s),void 0!==l&&(u.axisExtent=l),void 0!==c&&(u.autoPlaceAnnotations=c),u}function vc(e){const{linkedHover:t,selection:n,onObservation:r,onClick:i,hoverRadius:o,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(o??30,Math.ceil((c.targetSize||44)/2),24):o;(s||t||r||i||a)&&(f.customHoverBehavior=u);const m=h?r||i||t:r||i,g=c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||a||n);return d&&(l||m||g)&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}function xc(e){return e.properties&&"object"==typeof e.properties?{...e.properties,...e}:e}function wc(e){const{data:t,rawData:n,colorBy:r,colorScheme:i,legendInteraction:o,legendPosition:a,selection:s,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,legend:m,legendLayout:g,frameLegend:y,userMargin:b,marginDefaults:v,onClick:x,hoverHighlight:w,mobileInteraction:k,mobileSemantics:S,loading:M,loadingContent:j,emptyContent:A,width:R,height:C,hasTitle:L,axisChrome:N}=e,P=void 0===n,E=(0,Oy.useMemo)(()=>Sn(t),[t]),[I,T]=(0,Oy.useState)([]),z=(0,Oy.useCallback)(e=>{T(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),D="string"==typeof r?r:void 0,$=(0,Oy.useMemo)(()=>Rl(k,{width:R,mobileSemantics:S}),[k,R,S]),{activeSelectionHook:F,hoverSelectionHook:O,customHoverBehavior:_,customClickBehavior:B,crosshairSourceId:W}=Xl({selection:s,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:x,hoverHighlight:w,colorByField:D,mobileInteraction:$}),H=Zl(l,W),q=Yl(E,r,i),G=(0,Oy.useMemo)(()=>Fl(E,r),[E,r]),V=(0,Oy.useMemo)(()=>P&&I.length>0?I:G,[P,I,G]),U=ql(o,r,V),Y=(0,Oy.useMemo)(()=>O||(U.legendSelectionHook?U.legendSelectionHook:F),[O,U.legendSelectionHook,F]),X=fc(s),Z=Vl(),K=(0,_y.useChartCategoryColors)(null!=i),Q=(0,Oy.useMemo)(()=>{if(q&&(!P||0===V.length))return q;if(!r||0===V.length)return;const e=Array.isArray(i)&&i.length>0||"string"==typeof i&&i.length>0?i:Z&&Z.length>0?Z:Pf,t="__streamCat",n=Bt(V.map(e=>({[t]:e})),t,e);return e=>(K?_t(K,e):void 0)??(i&&"object"==typeof i&&!Array.isArray(i)?_t(i,e):void 0)??n(e)??"#999"},[q,P,r,V,i,Z,K]),{legend:J,margin:ee,legendPosition:te,legendLayout:ne,legendMarginReserved:re}=Bl({data:E,colorBy:r,colorScale:Q,showLegend:p,legendPosition:a,userMargin:b,defaults:v,categories:V,additionalLegend:m,chartWidth:R,chartHeight:C,legendLayout:g,frameLegend:y,hasTitle:L,axisChrome:N}),ie=(0,Oy.useMemo)(()=>{const e={};return J&&(e.legend=J,e.legendPosition=te,re&&(e.__legendMarginReservedFor=J),ne&&(e.legendLayout=ne)),o&&"none"!==o&&(e.legendHoverBehavior=U.onLegendHover,e.legendClickBehavior=U.onLegendClick,e.legendHighlightedCategory=U.highlightedCategory,e.legendIsolatedCategories=U.isolatedCategories),P&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=z),e},[J,te,ne,re,o,U.onLegendHover,U.onLegendClick,U.highlightedCategory,U.isolatedCategories,P,r,z]),oe=dc(M,R,C,j,e.responsive),ae=oe?null:uc(n,R,C,A,e.responsive);return{data:E,colorScale:Q,categoryColorScale:Q,allCategories:V,legendState:U,effectiveSelectionHook:Y,activeSelectionHook:F,customHoverBehavior:_,customClickBehavior:B,mobileInteraction:$,legend:J,margin:ee,legendPosition:te,earlyReturn:oe||ae||null,legendBehaviorProps:ie,crosshairProps:H,resolvedSelection:X}}function kc(e,t){const{variant:n,frameRef:r,overrides:i}=t,o=(0,By.useRef)(i);o.current=i,(0,By.useImperativeHandle)(e,()=>{const e=Sc(n,r);return new Proxy(e,{get(e,t,n){if("string"==typeof t){const e=o.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,n)},has:(e,t)=>!("string"!=typeof t||!o.current||!(t in o.current))||Reflect.has(e,t)})},[])}function Sc(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t];if(e.current?.removeNodes)return e.current.removeNodes(n);const r=e.current?.getTopology()?.nodes??[],i=[];for(const t of n){const n=r.find(e=>e.id===t);n&&i.push({...n.data??{},id:t}),e.current?.removeNode(t)}return i},update:(t,n)=>{const r=Array.isArray(t)?t:[t];return e.current?.updateNodes?e.current.updateNodes(r,n):r.flatMap(t=>{const r=e.current?.updateNode(t,n);return r?[{...r,id:t}]:[]})},clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(n(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const r=n.current?.removeLine(e)??[];for(const e of r)n.current?.pushLine(t(e));return r},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}function Mc(e,t,n){const[r,i]=n;if(!t)return r;const[o,a]=t,s=a>o?a-o:0,l=Number(e),c=Number.isFinite(l)?l:o,u=s>0?(c-o)/s:0;return r+Math.max(0,Math.min(1,u))*(i-r)}function jc(e){const{valueAccessor:t,valueDomain:n,edgeWidthRange:r,resolveStroke:i,edgeOpacity:o,edgeLinecap:a,styleRules:s}=e,l=ec(t);return ac(e=>({stroke:i(e),strokeWidth:Mc(e[t],n,r),strokeLinecap:a,opacity:o,fillOpacity:0}),s,e=>({value:l(e)}))}function Ac({bottomMargin:e,costLabel:t,layout:{cx:n,cy:r,maxCost:i,availableRadius:o,layout:a},ringStyle:s,ringValues:l,showNorth:c,showRingLabels:u,showRings:d}){const h="strip"===a,f={stroke:h?"var(--semiotic-border, #999)":"#999",strokeWidth:h?1:.8,strokeDasharray:h?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:h?8:10,...s};return h?/* @__PURE__ */ /* @__PURE__ */(0,tb.jsxs)("g",{children:[
|
|
133
133
|
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */(0,
|
|
134
|
+
/* @__PURE__ */(0,tb.jsx)("line",{x1:n,y1:r,x2:n+o,y2:r,stroke:f.stroke,strokeWidth:f.strokeWidth,strokeLinecap:"round",opacity:.85}),
|
|
135
135
|
/* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */(0,
|
|
137
|
-
return(0,
|
|
136
|
+
/* @__PURE__ */(0,tb.jsx)("line",{x1:n,y1:r-3.5,x2:n,y2:r+3.5,stroke:f.stroke,strokeWidth:f.strokeWidth,opacity:.9}),d&&l.map(a=>{const s=n+(i>0?a/i*o:0);/* @__PURE__ */ /* @__PURE__ */
|
|
137
|
+
return(0,tb.jsxs)("g",{children:[
|
|
138
138
|
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */(0,
|
|
140
|
-
return(0,
|
|
139
|
+
/* @__PURE__ */(0,tb.jsx)("line",{x1:s,y1:r-2.5,x2:s,y2:r+2.5,stroke:f.stroke,strokeWidth:.9,opacity:.65}),u&&/* @__PURE__ */ /* @__PURE__ */(0,tb.jsxs)("text",{x:s,y:r+Math.min(10,(e??2)+8),textAnchor:"middle",fontSize:f.labelSize,fill:f.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[a,t?` ${t}`:""]})]},a)})]}):/* @__PURE__ */ /* @__PURE__ */(0,tb.jsxs)("g",{children:[l.map(e=>{const a=e/i*o;/* @__PURE__ */ /* @__PURE__ */
|
|
140
|
+
return(0,tb.jsxs)("g",{children:[
|
|
141
141
|
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */(0,
|
|
142
|
+
/* @__PURE__ */(0,tb.jsx)("circle",{cx:n,cy:r,r:a,fill:"none",stroke:f.stroke,strokeWidth:f.strokeWidth,strokeDasharray:f.strokeDasharray,opacity:.5}),u&&/* @__PURE__ */ /* @__PURE__ */(0,tb.jsxs)("text",{x:n+a+3,y:r-2,fontSize:f.labelSize,fill:f.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,t?` ${t}`:""]})]},e)}),c&&/* @__PURE__ */ /* @__PURE__ */(0,tb.jsxs)("g",{transform:"translate(24, 24)",children:[
|
|
143
143
|
/* @__PURE__ */
|
|
144
|
-
/* @__PURE__ */(0,
|
|
144
|
+
/* @__PURE__ */(0,tb.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),
|
|
145
145
|
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */(0,
|
|
146
|
+
/* @__PURE__ */(0,tb.jsx)("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),
|
|
147
147
|
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */(0,
|
|
148
|
+
/* @__PURE__ */(0,tb.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:"N"}),
|
|
149
149
|
/* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */(0,
|
|
150
|
+
/* @__PURE__ */(0,tb.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),
|
|
151
151
|
/* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */(0,
|
|
152
|
+
/* @__PURE__ */(0,tb.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),
|
|
153
153
|
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */(0,
|
|
155
|
-
return(0,
|
|
156
|
-
return(0,Ty.jsx)("text",{x:e.x,y:e.y,fill:t,fontFamily:r,fontSize:n,fontWeight:i,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}function Ac(e){if(Number.isFinite(e)&&!(Number(e)<=0))return Number(e)}function Rc(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function Cc(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function Lc(e,t){const n=Cc(e);return String(e.id??n.id??n.name??`feature-${t}`)}function Pc(e,t){if(0===e.length)return null;const n={type:"FeatureCollection",features:e},r=t.bounds(n);return Number.isFinite(r[0][0])&&Number.isFinite(r[0][1])&&Number.isFinite(r[1][0])&&Number.isFinite(r[1][1])?r:null}function Nc(e,t,n,r){return[Math.ceil((e-n)/r-.5),Math.floor((t-n)/r-.5)]}function Ec(e){if(!e)return 0;const t=qy.get(e);if(t)return t;const n=Gy;return Gy+=1,qy.set(e,n),n}function Ic(e){return e.map((e,t)=>{if(Hy.has(e))return{feature:e,index:t,bounds:Hy.get(e)??null};try{const n=H(e);return Hy.set(e,n),{feature:e,index:t,bounds:n}}catch{return Hy.set(e,null),{feature:e,index:t,bounds:null}}})}function zc(e,t){return!t||e[1]>=t[0][1]&&e[1]<=t[1][1]&&(n=e[0],(r=t[0][0])<=(i=t[1][0])?n>=r&&n<=i:n>=r||n<=i);var n,r,i}function Tc(e,t){for(const n of e){const{feature:e,index:r}=n;if(e.geometry&&zc(t,n.bounds))try{if(Se(e,t))return{feature:e,index:r}}catch{}}return null}function Dc(e,t,n,r={}){const i=e.filter((e,t)=>e.geometry&&(!r.featureFilter||r.featureFilter(e,t))),o=Pc(i,t.geoPath);if(!o)return{dots:[],cellSize:_y,features:i};const a=Math.max(0,r.layoutPadding??0),s=[[Ti(o[0][0],a,Math.max(a,n.width-a)),Ti(o[0][1],a,Math.max(a,n.height-a))],[Ti(o[1][0],a,Math.max(a,n.width-a)),Ti(o[1][1],a,Math.max(a,n.height-a))]],l=Math.max(0,s[1][0]-s[0][0]),c=Math.max(0,s[1][1]-s[0][1]);if(0===l||0===c)return{dots:[],cellSize:_y,features:i};const u=Ac(r.columns);let d=Math.max(2,u?l/u:Ac(r.cellSize)??_y);const h=Math.max(100,Math.round(Ac(r.maxSamples)??Wy)),f=Math.ceil(l/d)*Math.ceil(c/d);f>h&&(d*=Math.sqrt(f/h));const p=r.gridOrigin?.[0]??0,m=r.gridOrigin?.[1]??0,[g,y]=Nc(s[0][0],s[1][0],p,d),[b,v]=Nc(s[0][1],s[1][1],m,d),x=[],w=Ic(i);for(let e=b;e<=v;e+=1){const n=m+(e+.5)*d;for(let i=g;i<=y;i+=1){const o=p+(i+.5)*d,a=t.invertedPoint(o,n);if(!a||!Number.isFinite(a[0])||!Number.isFinite(a[1]))continue;const s=Tc(w,a);if(!s)continue;const l={...Cc(s.feature),featureId:Lc(s.feature,s.index),featureIndex:s.index,gridRow:e,gridColumn:i,longitude:a[0],latitude:a[1],dotIndex:x.length};r.dotFilter&&!r.dotFilter(l,x.length)||x.push(l)}}return{dots:x,cellSize:d,features:i}}function $c(e){return Math.round(1e4*e)/1e4}function Oc(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${$c(Number(e[0]))},${$c(Number(e[1]))}`:"null"}function Fc(e,t){const n=e[t];return"function"==typeof n?n.call(e):void 0}function _c(e){return"number"==typeof e&&Number.isFinite(e)?String($c(e)):null===e?"null":"unavailable"}function Wc(e){const t=e.scales.projection;return[_c(Fc(t,"scale")),Oc(Fc(t,"translate")),Oc(Fc(t,"center")),(n=Fc(t,"rotate"),Array.isArray(n)&&n.every(Number.isFinite)?n.map(e=>$c(Number(e))).join(","):"unavailable"),_c(Fc(t,"clipAngle")),_c(Fc(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,n])=>Oc(e.scales.projectedPoint(t,n)))].join("|");var n}function Bc(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??"",Ec(t.featureFilter),Ec(t.dotFilter),Wc(e)].join("::")}function Hc(e){let t=By.get(e.areas);t||(t=/* @__PURE__ */new Map,By.set(e.areas,t));const n=Bc(e),r=t.get(n);if(r)return r;const i=Dc(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(n,i),i}function qc(e){return`${e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")}Z`}function Gc(e,t,n){return qc([[e-n,t-n],[e+n,t-n],[e+n,t+n],[e-n,t+n]])}function Vc(e,t,n){return qc(Array.from({length:6},(r,i)=>{const o=-Math.PI/2+i*(Math.PI/3);return[e+Math.cos(o)*n,t+Math.sin(o)*n]}))}function Uc(e,t,n){const{featureKey:r,dataKey:i}=n,o=/* @__PURE__ */new Map;for(const e of t){const t=String(Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0);o.set(t,e)}const a=e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;return String(n??"")};return e.map(e=>{const t=a(e),n=o.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}var Yc,Xc,Zc,Kc,Qc,Jc,eu,tu,nu,ru,iu,ou,au,su,lu,cu,uu=Object.create,du=Object.defineProperty,hu=Object.getOwnPropertyDescriptor,fu=Object.getOwnPropertyNames,pu=Object.getPrototypeOf,mu=Object.prototype.hasOwnProperty,gu=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[fu(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},yu=(e,t)=>{for(var n in t)du(e,n,{get:t[n],enumerable:!0})},bu=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of fu(t))mu.call(e,i)||i===n||du(e,i,{get:()=>t[i],enumerable:!(r=hu(t,i))||r.enumerable});return e},vu=(e,t,n)=>(n=null!=e?uu(pu(e)):{},bu(!t&&e&&e.__esModule?n:du(n,"default",{value:e,enumerable:!0}),e)),xu=gu({"src/components/stream/accessibleDataRows.ts"(){}}),wu=gu({"src/components/stream/accessibleTableStyles.ts"(){Yc=5,Xc=25,Zc="semiotic-accessible-data-table semiotic-accessible-data-table-hidden",Kc="semiotic-accessible-data-table semiotic-accessible-data-table-visible",Qc={boxSizing:"border-box",maxWidth:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},Jc={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},eu={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},tu={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},nu={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ru={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},iu={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},ou={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},au={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"}}}),ku={};yu(ku,{default:()=>s});var Su,Mu,ju,Au,Ru,Cu=gu({"src/components/stream/AccessibleTablePortalImpl.tsx"(){su=vu(require("react")),lu=require("react-dom"),cu=require("react/jsx-runtime")}}),Lu=gu({"src/components/stream/accessibleDataTableModel.ts"(){Su=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":String(t)}}}),Pu=gu({"src/components/stream/AccessibleDataRowsTable.tsx"(){Lu(),wu(),Mu=require("react/jsx-runtime")}}),Nu=gu({"src/components/stream/AccessibleTableMoreRows.tsx"(){wu(),ju=require("react/jsx-runtime")}}),Eu={};yu(Eu,{default:()=>f});var Iu,zu=gu({"src/components/stream/AccessibleDataTableContent.tsx"(){Au=vu(require("react")),Pu(),Nu(),wu(),xu(),Lu(),Ru=require("react/jsx-runtime")}}),Tu={};yu(Tu,{ChoroplethMap:()=>sy,DEFAULT_HIT_RADIUS:()=>Iy,DistanceCartogram:()=>Ry,FlowMap:()=>Sy,GeoCustomChart:()=>Ny,MultiLineTooltip:()=>bs,ProportionalSymbolMap:()=>gy,StreamGeoFrame:()=>Ag,Tooltip:()=>ys,TooltipRoot:()=>Xm,composeStyleRules:()=>Wl,geoAreaHitTarget:()=>fc,geoHitTarget:()=>hc,geographicDotGridLayout:()=>Vy,geographicGridLayout:()=>Oy,glyphExtent:()=>xo,glyphPlacement:()=>vo,gridifyGeographicPoints:()=>yc,hasOwnTooltipChrome:()=>xa,hasTooltipContent:()=>fa,hatchFillId:()=>mi,hatchPatternDef:()=>yi,hitTargetPoint:()=>dc,isHatchFill:()=>fi,makeNodeRuleContext:()=>Dl,makeRuleValueResolver:()=>Tl,markTooltipChrome:()=>ba,matchesThreshold:()=>Ol,mergeData:()=>Uc,resolveReferenceGeography:()=>Kl,resolveResponsiveRules:()=>sl,resolveStyleRules:()=>_l,resolveSvgFill:()=>bi,responsiveRuleMatches:()=>ol,ruleMatches:()=>Fl,sampleGeographicDotGrid:()=>Dc}),module.exports=(Iu=Tu,bu(du({},"__esModule",{value:!0}),Iu));var Du,$u,Ou,Fu,_u,Wu,Bu,Hu,qu,Gu,Vu,Uu,Yu,Xu,Zu,Ku,Qu=require("react"),Ju="undefined"==typeof window||"undefined"==typeof document,ed=Ju?Qu.useEffect:Qu.useLayoutEffect,td=require("react"),nd=require("d3-array"),rd=1e-6,id=1e-12,od=Math.PI,ad=od/2,sd=od/4,ld=2*od,cd=180/od,ud=od/180,dd=Math.abs,hd=Math.atan,fd=Math.atan2,pd=Math.cos,md=Math.ceil,gd=Math.exp,yd=Math.log,bd=Math.sin,vd=Math.sign||function(e){return e>0?1:e<0?-1:0},xd=Math.sqrt,wd=Math.tan,kd={Feature:function(e,t){b(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)b(n[r].geometry,t)}},Sd={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){v(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)v(n[r],t,0)},Polygon:function(e,t){x(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)x(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)b(n[r],t)}},Md=new nd.Adder,jd=new nd.Adder,Ad={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Md=new nd.Adder,Ad.lineStart=k,Ad.lineEnd=S},polygonEnd:function(){var e=+Md;jd.add(e<0?ld+e:e),this.lineStart=this.lineEnd=this.point=y},sphere:function(){jd.add(ld)}},Rd=require("d3-array"),Cd={point:I,lineStart:T,lineEnd:D,polygonStart:function(){Cd.point=$,Cd.lineStart=O,Cd.lineEnd=F,Xu=new Rd.Adder,Ad.polygonStart()},polygonEnd:function(){Ad.polygonEnd(),Cd.point=I,Cd.lineStart=T,Cd.lineEnd=D,Md<0?(Wu=-(Hu=180),Bu=-(qu=90)):Xu>rd?qu=90:Xu<-rd&&(Bu=-90),Ku[0]=Wu,Ku[1]=Hu},sphere:function(){Wu=-(Hu=180),Bu=-(qu=90)}};G.invert=G;var Ld,Pd,Nd,Ed,Id,zd,Td,Dd,$d,Od,Fd,_d,Wd=require("d3-array"),Bd=require("d3-array"),Hd=ae(function(){return!0},function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?od:-od,l=dd(o-n);dd(l-od)<rd?(e.point(n,r=(r+a)/2>0?ad:-ad),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i!==s&&l>=od&&(dd(n-i)<rd&&(n-=i*rd),dd(o-s)<rd&&(o-=s*rd),r=ce(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}},function(e,t,n,r){var i;if(null==e)i=n*ad,r.point(-od,i),r.point(0,i),r.point(od,i),r.point(od,0),r.point(od,-i),r.point(0,-i),r.point(-od,-i),r.point(-od,0),r.point(-od,i);else if(dd(e[0]-t[0])>rd){var o=e[0]<t[0]?od:-od;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])},[-od,-ad]),qd=require("d3-array"),Gd=1e9,Vd=-Gd,Ud=require("d3-array"),Yd={sphere:y,point:y,lineStart:function(){Yd.point=pe,Yd.lineEnd=fe},lineEnd:y,polygonStart:y,polygonEnd:y},Xd=[null,null],Zd={type:"LineString",coordinates:Xd},Kd={Feature:function(e,t){return ye(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)if(ye(n[r].geometry,t))return!0;return!1}},Qd={Sphere:function(){return!0},Point:function(e,t){return be(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(be(n[r],t))return!0;return!1},LineString:function(e,t){return ve(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(ve(n[r],t))return!0;return!1},Polygon:function(e,t){return xe(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(xe(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)if(ye(n[r],t))return!0;return!1}},Jd=require("d3-array"),eh=e=>e,th=require("d3-array"),nh=new th.Adder,rh=new th.Adder,ih={point:y,lineStart:y,lineEnd:y,polygonStart:function(){ih.lineStart=Ce,ih.lineEnd=Ne},polygonEnd:function(){ih.lineStart=ih.lineEnd=ih.point=y,nh.add(dd(rh)),rh=new th.Adder},result:function(){var e=nh/2;return nh=new th.Adder,e}},oh=ih,ah=1/0,sh=ah,lh=-ah,ch=lh,uh={point:function(e,t){e<ah&&(ah=e),e>lh&&(lh=e),t<sh&&(sh=t),t>ch&&(ch=t)},lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y,result:function(){var e=[[ah,sh],[lh,ch]];return lh=ch=-(sh=ah=1/0),e}},dh=0,hh=0,fh=0,ph=0,mh=0,gh=0,yh=0,bh=0,vh=0,xh={point:Ee,lineStart:Ie,lineEnd:De,polygonStart:function(){xh.lineStart=$e,xh.lineEnd=Oe},polygonEnd:function(){xh.point=Ee,xh.lineStart=Ie,xh.lineEnd=De},result:function(){var e=vh?[yh/vh,bh/vh]:gh?[ph/gh,mh/gh]:fh?[dh/fh,hh/fh]:[NaN,NaN];return dh=hh=fh=ph=mh=gh=yh=bh=vh=0,e}},wh=xh;We.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,ld)}},result:y};var kh,Sh,Mh,jh,Ah,Rh,Ch,Lh,Ph,Nh=require("d3-array"),Eh=new Nh.Adder,Ih={point:y,lineStart:function(){Ih.point=Be},lineEnd:function(){kh&&He(Sh,Mh),Ih.point=y},polygonStart:function(){kh=!0},polygonEnd:function(){kh=null},result:function(){var e=+Eh;return Eh=new Nh.Adder,e}},zh=Ih,Th=class{constructor(e){this._append=null==e?qe:Ge(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Lh||this._append!==Ch){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Lh=e,Ch=this._append,Ph=this._,this._=t}this._+=Ph}}result(){const e=this._;return this._="",e.length?e:null}};Ye.prototype={constructor:Ye,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Dh=pd(30*ud),$h=Ue({point:function(e,t){this.stream.point(e*ud,t*ud)}});dt.invert=function(e,t){return[e,2*hd(gd(t))-ad]},ft.invert=ft;var Oh,Fh=1.340264,_h=-.081106,Wh=893e-6,Bh=.003796,Hh=xd(3)/2;pt.invert=function(e,t){for(var n,r=t,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(Fh+_h*i+o*(Wh+Bh*i))-t)/(Fh+3*_h*i+o*(7*Wh+9*Bh*i)))*r)*i*i,!(dd(n)<id));++a);return[Hh*e*(Fh+3*_h*i+o*(7*Wh+9*Bh*i))/pd(r),m(bd(r)/Hh)]},gt.invert=function(e,t){var n,r=t,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(dd(n)>rd&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},yt.invert=(Oh=m,function(e,t){var n=xd(e*e+t*t),r=Oh(n),i=bd(r),o=pd(r);return[fd(e*i,n*o),m(n&&t*i/n)]});var qh,Gh,Vh=/* @__PURE__ */new WeakMap,Uh=require("d3-quadtree"),Yh=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,e<1)throw new Error("RingBuffer capacity must be at least 1");this.buffer=new Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e<0||e>=this._size)return;const t=(this.head-this._size+e+this._capacity)%this._capacity;return this.buffer[t]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>e>=this._size?{done:!0,value:void 0}:{done:!1,value:this.get(e++)}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;n<this._size;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=new Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;n<this._size;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(e<1)throw new Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=new Array(e),this.head=0,this._size=0;for(let e=n;e<t.length;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;i<this._size;i++){const o=(r+i)%this._capacity,a=this.buffer[o];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[o]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),0===n.length)return n;this.buffer=new Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=new Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},Xh=1,Zh=1.5,Kh=3,Qh=require("d3-scale"),Jh=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ef=/* @__PURE__ */zt(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),tf=/* @__PURE__ */zt(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),nf=/* @__PURE__ */zt(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),rf=/* @__PURE__ */zt(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),of=/* @__PURE__ */zt(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),af=/* @__PURE__ */zt(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),sf={blues:ef,reds:tf,greens:nf,viridis:/* @__PURE__ */zt(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:rf,purples:of,greys:af,plasma:/* @__PURE__ */zt(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:/* @__PURE__ */zt(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:/* @__PURE__ */zt(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:/* @__PURE__ */zt(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:/* @__PURE__ */zt(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},lf={category10:Jh,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...sf},cf=Jh,uf="#007bff",df=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],hf=/* @__PURE__ */new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),ff={mercator:function(){return ht(dt).scale(961/ld)},equalEarth:mt,albersUsa:function(){function e(e){var t=e[0],n=e[1];return s=null,i.point(t,n),s||(o.point(t,n),s)||(a.point(t,n),s)}function t(){return n=r=null,e}var n,r,i,o,a,s,l=ut().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7]),c=ut().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=ut().rotate([157,0]).center([-3,19.9]).parallels([8,18]),d={point:function(e,t){s=[e,t]}};return e.invert=function(e){var t=l.scale(),n=l.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?c:i>=.166&&i<.234&&r>=-.214&&r<-.115?u:l).invert(e)},e.stream=function(e){return n&&r===e?n:(t=[l.stream(r=e),c.stream(e),u.stream(e)],i=t.length,n={point:function(e,n){for(var r=-1;++r<i;)t[r].point(e,n)},sphere:function(){for(var e=-1;++e<i;)t[e].sphere()},lineStart:function(){for(var e=-1;++e<i;)t[e].lineStart()},lineEnd:function(){for(var e=-1;++e<i;)t[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<i;)t[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<i;)t[e].polygonEnd()}});var t,i},e.precision=function(e){return arguments.length?(l.precision(e),c.precision(e),u.precision(e),t()):l.precision()},e.scale=function(t){return arguments.length?(l.scale(t),c.scale(.35*t),u.scale(t),e.translate(l.translate())):l.scale()},e.translate=function(e){if(!arguments.length)return l.translate();var n=l.scale(),r=+e[0],s=+e[1];return i=l.translate(e).clipExtent([[r-.455*n,s-.238*n],[r+.455*n,s+.238*n]]).stream(d),o=c.translate([r-.307*n,s+.201*n]).clipExtent([[r-.425*n+rd,s+.12*n+rd],[r-.214*n-rd,s+.234*n-rd]]).stream(d),a=u.translate([r-.205*n,s+.212*n]).clipExtent([[r-.214*n+rd,s+.166*n+rd],[r-.115*n-rd,s+.234*n-rd]]).stream(d),t()},e.fitExtent=function(t,n){return Ze(e,t,n)},e.fitSize=function(t,n){return Ke(e,t,n)},e.fitWidth=function(t,n){return Qe(e,t,n)},e.fitHeight=function(t,n){return Je(e,t,n)},e.scale(1070)},orthographic:function(){return at(yt).scale(249.5).clipAngle(90.000001)},naturalEarth:function(){return at(gt).scale(175.295)},equirectangular:function(){return at(ft).scale(152.63)}},pf=require("d3-scale"),mf={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"},gf=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=gn({kind:"initialize"},[],this.revisions),this.listeners=/* @__PURE__ */new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=gn(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},yf=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],bf=["scene-style","data-paint","accessibility","evidence"],vf=(e,t)=>({retainedData:e,invalidations:t}),xf=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],wf=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],kf=["scene-geometry","data-paint","accessibility","evidence"],Sf=["scene-style","data-paint","accessibility","evidence"],Mf=["scene-geometry","scene-style","data-paint","accessibility","evidence"],jf=["overlay","accessibility","evidence"],Af=[],Rf={xAccessor:/* @__PURE__ */vf("rebuild",xf),yAccessor:/* @__PURE__ */vf("rebuild",xf),lineDataAccessor:/* @__PURE__ */vf("rebuild",xf),pointIdAccessor:/* @__PURE__ */vf("rebuild",kf),lineIdAccessor:/* @__PURE__ */vf("rebuild",kf),windowSize:/* @__PURE__ */vf("rebuild",xf),projection:/* @__PURE__ */vf("preserve",wf),projectionExtent:/* @__PURE__ */vf("preserve",wf),fitPadding:/* @__PURE__ */vf("preserve",wf),lineType:/* @__PURE__ */vf("preserve",wf),flowStyle:/* @__PURE__ */vf("preserve",wf),graticule:/* @__PURE__ */vf("preserve",wf),projectionTransform:/* @__PURE__ */vf("preserve",wf),customLayout:/* @__PURE__ */vf("preserve",wf),layoutConfig:/* @__PURE__ */vf("preserve",wf),layoutMargin:/* @__PURE__ */vf("preserve",wf),areaStyle:/* @__PURE__ */vf("preserve",Sf),pointStyle:/* @__PURE__ */vf("preserve",Mf),lineStyle:/* @__PURE__ */vf("preserve",Sf),colorScheme:/* @__PURE__ */vf("preserve",Sf),themeCategorical:/* @__PURE__ */vf("preserve",Sf),themeDiverging:/* @__PURE__ */vf("preserve",Sf),themeSemantic:/* @__PURE__ */vf("preserve",Sf),themeSequential:/* @__PURE__ */vf("preserve",Sf),decay:/* @__PURE__ */vf("preserve",Sf),pulse:/* @__PURE__ */vf("preserve",Sf),layoutSelection:/* @__PURE__ */vf("preserve",Sf),annotations:/* @__PURE__ */vf("preserve",jf),autoPlaceAnnotations:/* @__PURE__ */vf("preserve",jf),clock:/* @__PURE__ */vf("preserve",Af),transition:/* @__PURE__ */vf("preserve",Af),introAnimation:/* @__PURE__ */vf("preserve",Af),onLayoutError:/* @__PURE__ */vf("preserve",Af)},Cf=/* @__PURE__ */vf("preserve",wf),Lf=class{constructor(){this.tracker=new gf}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},yf)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},bf):this.recordNoop("restyle")}recordConfig(e,t={}){const n=yn(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},Pf=/* @__PURE__ */new WeakMap,Nf=class{getLastUpdateResult(){return this.updateResults.last}getUpdateSnapshot(){return this.updateResults.last}subscribeUpdateResult(e){return this.updateResults.subscribe(e)}setLayoutSelection(e){this.config.layoutSelection=e}markStylePaintPending(){Pf.set(this,!0)}consumeStylePaintPending(){const e=!0===Pf.get(this);return Pf.delete(this),e}},Ef=class extends Nf{constructor(e){super(),this.updateResults=new Lf,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=xn(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||e<1)throw new Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),i=n.slice(-r.length),o=this.currentTime();this.pointBuffer=new Yh(e),this.timestampBuffer=new Yh(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??o)})}this.retainNewestLines(e)}updateConfig(e){const t=wn(e),n=this.config,r=this.getConfiguredWindowSize(),i=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const o=this.getConfiguredWindowSize(),a=this.streaming&&o!==r;a&&(this.resizeStreamingWindow(o),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(i,{retainedDataChanged:a})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],i=n.slice(-t),o=r.slice(-i.length),a=this.currentTime();this.pointBuffer=new Yh(t),this.timestampBuffer=new Yh(t),i.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??a)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();fn(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)fn(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw new Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!r.has(String(n(e)))||(i.push(e),!1)),i.length>0?(this.version++,this.updateResults.recordData("remove",i.length)):this.updateResults.recordNoop("remove"),i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw new Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(String(n(e)));pn(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(String(n(t)))||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,i=t(n,e);n.style=i?{...r,...i}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}rebuildProjectedScene(e,t){this._customLayoutFailedThisBuild=!1;const n=this.buildSceneNodes(e);return this._customLayoutFailedThisBuild?(this.lastCustomLayoutFailure?.preservedLastGoodScene?t():(this.scene=[],this.rebuildQuadtree()),!1):(this.scene=n,this.rebuildQuadtree(),!0)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,i=this.scales,o=this.baseScale,a=[...this.baseTranslate],s=[...this.baseRotation],l=this.scene;this.projection=Zt(t.projection),this.geoPath=Ve(this.projection),this.fitProjection(e),this.geoPath=Ve(this.projection);const c=this.projection;if(this.scales=wt(c),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(e,()=>{this.projection=n,this.geoPath=r,this.scales=i,this.baseScale=o,this.baseTranslate=a,this.baseRotation=s})){if(t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],i=Kt(n.xAccessor,"lon"),o=Kt(n.yAccessor,"lat"),a=this.getPoints();if(a.length>0){const e=a.map(e=>[i(e),o(e)]).filter(e=>e.every(Number.isFinite));r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const s=Qt(n.lineDataAccessor);for(const e of this.lineData){const t=s(e);if(t&&t.length>0){const e=t.map(e=>[i(e),o(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,i],[o,a]]=n.projectionExtent,s={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,i],[r,a],[o,a],[o,i],[r,i]]]}};t.fitExtent([[0,0],[e.width,e.height]],s)}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,i=Math.min(e.width,e.height),o=i/2-i*r;t.scale(o),t.translate([e.width/2,e.height/2])}else{const i={type:"FeatureCollection",features:r},o=n.fitPadding??0,a=e.width*o,s=e.height*o;t.fitExtent([[a,s],[e.width-a,e.height-s]],i),bt(t,i,e)}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=Ve(n),this.scales=wt(n),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(t,()=>{n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i})&&(this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=Ve(n),this.scales=wt(n),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(t,()=>{n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i})&&(this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,i=this.scales,o=[...n.rotate()];n.rotate(e),this.geoPath=Ve(n),this.scales=wt(n),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(t,()=>{n.rotate(o),this.geoPath=r,this.scales=i})&&(this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&!1!==n.interactive&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,t<=500)return void(this._quadtree=null);const n=new Array(t);let r=0;for(const e of this.scene)"point"===e.type&&!1!==e.interactive&&(n[r++]=e);this._quadtree=(0,Uh.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=Dt(t.colorScheme,t.themeCategorical,df),i={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:Ht(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null},o=Xt({family:"geo",logLabel:"geo customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:t.onLayoutError,run:()=>t.customLayout(i)});if("failure"===o.kind)return this.lastCustomLayoutFailure=o.diagnostic,this._customLayoutFailedThisBuild=!0,o.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,[]);const a=o.result,s=a.nodes??[];if(this.customLayoutOverlays=a.overlays??null,this.lastCustomLayoutResult=a,this.lastCustomLayoutFailure=null,this._customRestyle=a.restyle,this.hasCustomRestyle=!!a.restyle,this._baseStyles=/* @__PURE__ */new WeakMap,this.hasCustomRestyle)for(const e of s){this._baseStyles.set(e,e.style);const n=a.restyle?.(e,t.layoutSelection??null);n&&(e.style={...e.style,...n})}return qt({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,bn({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=un(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type),r=xt(n,this.getPoints());for(let i=0;i<n.length;i++){if(r[i]<0)continue;const o=Ct(e,r[i],t);n[i]._decayOpacity=o,n[i].style={...n[i].style,opacity:o}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),i=xt(n,this.getPoints()),o=t.color||"rgba(255,255,255,0.6)",a=t.glowRadius??4;let s=!1;for(let l=0;l<n.length;l++){const c=r[i[l]];if(void 0===c)continue;const u=Lt(t,c,e);s=Pt(n[l],u,o,a)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&Nt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(t<=0)return;const n=/* @__PURE__ */new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let i=!1;for(const e of r)if(e.pointId){const t=n.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(i=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??e.style?.fillOpacity??1,e.style={...e.style,opacity:0},i=!0);i&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null;for(const e of this.scene)"point"===e.type&&(null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0),null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0))}advanceTransition(e){if(!this.activeTransition)return!1;const t=St(e,this.activeTransition),n=kt(t,this.config.transition?.easing),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.x,r=e.y;e.x=Mt(t,e._targetX,n),e.y=Mt(r,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of r)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}},If=require("react"),zf=require("d3-selection"),Tf=require("d3-zoom"),Df=Object.freeze([]),$f=require("react"),Of={sceneGeometry:0,layout:0,domain:0},Ff="production"!==process.env.NODE_ENV,_f={revisions:Of,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Wf=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Of,this.lastObserved=Of,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ff&&(this.lastObserved=An(this.lastObserved,Mn(e)))}beforeCompute(e,t){if(!Ff)return _f;const n=An(Mn(e),this.lastObserved),r=jn(n),i=(o=n,a=this.lastConsumed,!(o.sceneGeometry===a.sceneGeometry&&o.layout===a.layout&&o.domain===a.domain));var o,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:i,warnUnconsumed:!t&&i&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(Ff){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Bf=/* @__PURE__ */ /* @__PURE__ */(0,$f.memo)(function({store:e,diagnostics:t}){return(0,$f.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),Hf=vu(require("react")),qf=require("react"),Gf=require("react-dom"),Vf=require("./semiotic-client-cjs-shared.min.js"),Uf=require("react"),Yf=require("react"),Xf="undefined"==typeof window?Yf.useEffect:Yf.useLayoutEffect,Zf=/* @__PURE__ */new WeakMap,Kf=0,Qf=!1,Jf=null,ep=null,tp=null,np=null,rp=/* @__PURE__ */new Set,ip=()=>"undefined"!=typeof performance?performance.now():Date.now(),op=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=/* @__PURE__ */new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ip,this.lastWallTime=_n(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=_n(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ip;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=_n(t,this.lastWallTime))}setRandomSource(e,t){const n=Fn(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:On(n)))}},ap=34,sp=70,lp="undefined"==typeof window?qf.useEffect:qf.useLayoutEffect,cp={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)},up=require("react"),dp=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],hp={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},fp={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},pp={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:dp,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},mp=require("react"),gp={fresh:1,aging:.7,stale:.45,expired:.25},yp={alpha:1,band:"fresh",isStale:!1},bp=require("react/jsx-runtime"),vp={live:"#28a745",stale:"#dc3545",stopped:"#6c757d",failed:"#842029",settling:"#fd7e14"},xp=vu(require("react")),wp=require("./semiotic-client-cjs-shared.min.js"),kp=require("react"),Sp=/^\s*var\(\s*--[^,)\s]+\s*(?:,\s*([\s\S]*))?\)\s*$/,Mp=require("react/jsx-runtime"),jp="var(--semiotic-bg, #ffffff)",Ap=require("react/jsx-runtime"),Rp=require("react/jsx-runtime"),Cp=vu(require("react")),Lp=require("react/jsx-runtime"),Pp=require("d3-hierarchy"),Np=require("d3-shape"),Ep=require("d3-scale"),Ip=null,zp=require("react/jsx-runtime"),Tp=/* @__PURE__ */new Map,Dp=/* @__PURE__ */new Set(["top-left","top-center","top-right","middle-left","center","middle-right","bottom-left","bottom-center","bottom-right"]),$p=require("react/jsx-runtime"),Op={fill:"var(--semiotic-text, #333)",fontSize:11,fontFamily:"inherit"},Fp=require("react/jsx-runtime"),_p={secondary:0,primary:3},Wp=require("react/jsx-runtime"),Bp={linear:Np.curveLinear,monotoneX:Np.curveMonotoneX,monotoneY:Np.curveMonotoneY,step:Np.curveStep,stepAfter:Np.curveStepAfter,stepBefore:Np.curveStepBefore,basis:Np.curveBasis,cardinal:Np.curveCardinal,catmullRom:Np.curveCatmullRom},Hp=/* @__PURE__ */new Set(["label","callout","callout-circle","callout-rect","text","widget"]),qp=32,Gp=6,Vp=4,Up=8,Yp=72,Xp={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"},Zp=vu(require("react")),Kp={fontFamily:"var(--semiotic-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},Qp={fontSize:"var(--semiotic-legend-font-size, 12px)"},Jp=vu(require("react")),em=require("react/jsx-runtime"),tm=require("react/jsx-runtime"),nm=e=>e.legendGroup.items.map((t,n)=>uo(e,t,n,`translate(0,${n*e.metrics.rowHeight})`,!1)),rm=(e,t)=>{const{items:n}=e.legendGroup,r=[],{swatchSize:i,labelGap:o,itemGap:a,rowHeight:s,align:l}=e.metrics,c=n.map(e=>i+o+7*e.label.length),u=[];let d=0,h=0;c.forEach((e,n)=>{const r=0===h?e:h+a+e;t&&t>0&&h>0&&r>t?(u.push({start:d,end:n,width:h}),d=n,h=e):h=r}),n.length>0&&u.push({start:d,end:n.length,width:h}),u.forEach((i,o)=>{let u="center"===l?Math.max(0,((t??i.width)-i.width)/2):"end"===l?Math.max(0,(t??i.width)-i.width):0;for(let t=i.start;t<i.end;t++)r.push(uo(e,n[t],t,`translate(${u},${o*s})`,!0)),u+=c[t]+a});const f=u.reduce((e,t)=>Math.max(e,t.width),0),p=u.length;return{items:r,offset:f,totalRows:p,totalHeight:p*s}},im=(e,t,n)=>{const r=[],i=ir(e.map(e=>({hasLabel:Boolean(e.label),itemCount:e.items.length})),n.metrics.rowHeight);return e.forEach((e,o)=>{const a=i[o];r.push(
|
|
154
|
+
/* @__PURE__ */(0,tb.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}function Rc(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}function Cc(e){const t=(0,ob.useRef)(null);return kc(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Kl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,ob.useMemo)(()=>Rc(e.margin),[e.margin])}}function Lc(e){return null==e?void 0:String(e)}function Nc(e){const t=Lc(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??cb,style:{...lb,cursor:e.cursor},datum:e.datum,pointId:t,_transitionKey:t}}function Pc(e){return Nc(e)}function Ec(e){const[[t,n],[r,i]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(i-n)),style:{...lb,cursor:e.cursor},datum:e.datum,group:e.group,interactive:!0}}function Ic(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function Tc(e){let t=1/0,n=-1/0;for(const r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,0]:[t,n]}function zc(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Dc(e,t={}){const n=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===n.length)return[];const r=Xi(Number.isFinite(t.occupancy)?Number(t.occupancy):hb,.2,1),i=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):fb;let o=Ic(t.columns)??Math.max(1,Math.ceil(Math.sqrt(n.length*i/r))),a=Ic(t.rows)??Math.max(1,Math.ceil(n.length/(o*r)));o*a<n.length&&(null!=t.columns&&null==t.rows?a=Math.ceil(n.length/o):null!=t.rows&&null==t.columns?o=Math.ceil(n.length/a):a=Math.ceil(n.length/o));const s=Tc(n.map(e=>e.x)),l=Tc(n.map(e=>e.y)),c=n.map(e=>({...e,desiredColumn:zc(e.x,s)*Math.max(0,o-1),desiredRow:zc(e.y,l)*Math.max(0,a-1)})),u=(o-1)/2,d=(a-1)/2;c.sort((e,t)=>{const n=(e.desiredColumn-u)**2+(e.desiredRow-d)**2;return(t.desiredColumn-u)**2+(t.desiredRow-d)**2-n||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index});const h=/* @__PURE__ */new Set;for(let e=0;e<a;e+=1)for(let t=0;t<o;t+=1)h.add(e*o+t);const f=[];for(const e of c){let t=-1,n=1/0;for(const r of h){const i=Math.floor(r/o),a=(r%o-e.desiredColumn)**2+(i-e.desiredRow)**2;(a<n||a===n&&r<t)&&(t=r,n=a)}t<0||(h.delete(t),f.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/o),column:t%o,index:e.index}))}return f.sort((e,t)=>e.index-t.index),f.map(({index:e,...t})=>t)}function $c(e,t,n=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(const t of n)if(null!=e[t])return e[t]}function Fc(e,t){const n=e.properties&&"object"==typeof e.properties?e.properties:{},r=e.id??n.id??n.name??`area-${t}`;return{...n,id:String(r)}}function Oc(e){return`${e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")}Z`}function _c(e,t,n){const r=[];for(let i=0;i<6;i+=1){const o=-Math.PI/2+i*(Math.PI/3);r.push([e+Math.cos(o)*n,t+Math.sin(o)*n])}return Oc(r)}function Bc(e){return e.areas.map((t,n)=>{const r=Fc(t,n),i=e.scales.geoPath.centroid(t),o=Number.isFinite(i[0])&&Number.isFinite(i[1])?e.scales.invertedPoint(i[0],i[1]):null;return{datum:{...r,gridLongitude:o?.[0],gridLatitude:o?.[1]},x:i[0],y:i[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}function Wc(e){return e.points.map(t=>{const n=Number($c(t,e.config.longitudeAccessor,["lon","longitude"])),r=Number($c(t,e.config.latitudeAccessor,["lat","latitude"])),i=Number.isFinite(n)&&Number.isFinite(r)?e.scales.projectedPoint(n,r):null;return{datum:t,x:i?.[0]??NaN,y:i?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}function Hc(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;const n=e.map(e=>({datum:e,x:Number($c(e,t.columnAccessor)),y:Number($c(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return n.length!==e.length?null:n.map(e=>({...e,row:e.y,column:e.x}))}function qc({marks:e,color:t,fontSize:n,fontFamily:r,fontWeight:i}){const o=(0,ub.useCustomLayoutSelection)();/* @__PURE__ */ /* @__PURE__ */
|
|
155
|
+
return(0,db.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{const a=!o.isActive||o.predicate(e.datum);/* @__PURE__ */ /* @__PURE__ */
|
|
156
|
+
return(0,db.jsx)("text",{x:e.x,y:e.y,fill:t,fontFamily:r,fontSize:n,fontWeight:i,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}function Gc(e){if(Number.isFinite(e)&&!(Number(e)<=0))return Number(e)}function Vc(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function Uc(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function Yc(e,t){const n=Uc(e);return String(e.id??n.id??n.name??`feature-${t}`)}function Xc(e,t){if(0===e.length)return null;const n={type:"FeatureCollection",features:e},r=t.bounds(n);return Number.isFinite(r[0][0])&&Number.isFinite(r[0][1])&&Number.isFinite(r[1][0])&&Number.isFinite(r[1][1])?r:null}function Zc(e,t,n,r){return[Math.ceil((e-n)/r-.5),Math.floor((t-n)/r-.5)]}function Kc(e){if(!e)return 0;const t=xb.get(e);if(t)return t;const n=wb;return wb+=1,xb.set(e,n),n}function Qc(e){return e.map((e,t)=>{if(vb.has(e))return{feature:e,index:t,bounds:vb.get(e)??null};try{const n=q(e);return vb.set(e,n),{feature:e,index:t,bounds:n}}catch{return vb.set(e,null),{feature:e,index:t,bounds:null}}})}function Jc(e,t){return!t||e[1]>=t[0][1]&&e[1]<=t[1][1]&&(n=e[0],(r=t[0][0])<=(i=t[1][0])?n>=r&&n<=i:n>=r||n<=i);var n,r,i}function eu(e,t){for(const n of e){const{feature:e,index:r}=n;if(e.geometry&&Jc(t,n.bounds))try{if(Me(e,t))return{feature:e,index:r}}catch{}}return null}function tu(e,t,n,r={}){const i=e.filter((e,t)=>e.geometry&&(!r.featureFilter||r.featureFilter(e,t))),o=Xc(i,t.geoPath);if(!o)return{dots:[],cellSize:gb,features:i};const a=Math.max(0,r.layoutPadding??0),s=[[Xi(o[0][0],a,Math.max(a,n.width-a)),Xi(o[0][1],a,Math.max(a,n.height-a))],[Xi(o[1][0],a,Math.max(a,n.width-a)),Xi(o[1][1],a,Math.max(a,n.height-a))]],l=Math.max(0,s[1][0]-s[0][0]),c=Math.max(0,s[1][1]-s[0][1]);if(0===l||0===c)return{dots:[],cellSize:gb,features:i};const u=Gc(r.columns);let d=Math.max(2,u?l/u:Gc(r.cellSize)??gb);const h=Math.max(100,Math.round(Gc(r.maxSamples)??yb)),f=Math.ceil(l/d)*Math.ceil(c/d);f>h&&(d*=Math.sqrt(f/h));const p=r.gridOrigin?.[0]??0,m=r.gridOrigin?.[1]??0,[g,y]=Zc(s[0][0],s[1][0],p,d),[b,v]=Zc(s[0][1],s[1][1],m,d),x=[],w=Qc(i);for(let e=b;e<=v;e+=1){const n=m+(e+.5)*d;for(let i=g;i<=y;i+=1){const o=p+(i+.5)*d,a=t.invertedPoint(o,n);if(!a||!Number.isFinite(a[0])||!Number.isFinite(a[1]))continue;const s=eu(w,a);if(!s)continue;const l={...Uc(s.feature),featureId:Yc(s.feature,s.index),featureIndex:s.index,gridRow:e,gridColumn:i,longitude:a[0],latitude:a[1],dotIndex:x.length};r.dotFilter&&!r.dotFilter(l,x.length)||x.push(l)}}return{dots:x,cellSize:d,features:i}}function nu(e){return Math.round(1e4*e)/1e4}function ru(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${nu(Number(e[0]))},${nu(Number(e[1]))}`:"null"}function iu(e,t){const n=e[t];return"function"==typeof n?n.call(e):void 0}function ou(e){return"number"==typeof e&&Number.isFinite(e)?String(nu(e)):null===e?"null":"unavailable"}function au(e){const t=e.scales.projection;return[ou(iu(t,"scale")),ru(iu(t,"translate")),ru(iu(t,"center")),(n=iu(t,"rotate"),Array.isArray(n)&&n.every(Number.isFinite)?n.map(e=>nu(Number(e))).join(","):"unavailable"),ou(iu(t,"clipAngle")),ou(iu(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,n])=>ru(e.scales.projectedPoint(t,n)))].join("|");var n}function su(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??"",Kc(t.featureFilter),Kc(t.dotFilter),au(e)].join("::")}function lu(e){let t=bb.get(e.areas);t||(t=/* @__PURE__ */new Map,bb.set(e.areas,t));const n=su(e),r=t.get(n);if(r)return r;const i=tu(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(n,i),i}function cu(e){return`${e.map(([e,t],n)=>`${0===n?"M":"L"}${e},${t}`).join("")}Z`}function uu(e,t,n){return cu([[e-n,t-n],[e+n,t-n],[e+n,t+n],[e-n,t+n]])}function du(e,t,n){return cu(Array.from({length:6},(r,i)=>{const o=-Math.PI/2+i*(Math.PI/3);return[e+Math.cos(o)*n,t+Math.sin(o)*n]}))}function hu(e,t,n){const{featureKey:r,dataKey:i}=n,o=/* @__PURE__ */new Map;for(const e of t){const t=String(Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0);o.set(t,e)}const a=e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n&&Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;return String(n??"")};return e.map(e=>{const t=a(e),n=o.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}var fu,pu,mu,gu,yu,bu,vu,xu,wu,ku,Su,Mu,ju,Au,Ru,Cu,Lu=Object.create,Nu=Object.defineProperty,Pu=Object.getOwnPropertyDescriptor,Eu=Object.getOwnPropertyNames,Iu=Object.getPrototypeOf,Tu=Object.prototype.hasOwnProperty,zu=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[Eu(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},Du=(e,t)=>{for(var n in t)Nu(e,n,{get:t[n],enumerable:!0})},$u=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of Eu(t))Tu.call(e,i)||i===n||Nu(e,i,{get:()=>t[i],enumerable:!(r=Pu(t,i))||r.enumerable});return e},Fu=(e,t,n)=>(n=null!=e?Lu(Iu(e)):{},$u(!t&&e&&e.__esModule?n:Nu(n,"default",{value:e,enumerable:!0}),e)),Ou=zu({"src/components/stream/accessibleDataRows.ts"(){}}),_u=zu({"src/components/stream/accessibleTableStyles.ts"(){fu=5,pu=25,mu="semiotic-accessible-data-table semiotic-accessible-data-table-hidden",gu="semiotic-accessible-data-table semiotic-accessible-data-table-visible",yu={boxSizing:"border-box",maxWidth:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},bu={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},vu={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},xu={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},wu={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ku={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Su={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Mu={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ju={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"}}}),Bu=zu({"src/components/stream/countNoun.ts"(){}}),Wu={};Du(Wu,{default:()=>l});var Hu,qu,Gu,Vu,Uu,Yu=zu({"src/components/stream/AccessibleTablePortalImpl.tsx"(){Au=Fu(require("react")),Ru=require("react-dom"),Cu=require("react/jsx-runtime")}}),Xu=zu({"src/components/stream/accessibleDataTableModel.ts"(){Bu(),Hu=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":String(t)}}}),Zu=zu({"src/components/stream/AccessibleDataRowsTable.tsx"(){Xu(),_u(),qu=require("react/jsx-runtime")}}),Ku=zu({"src/components/stream/AccessibleTableMoreRows.tsx"(){_u(),Gu=require("react/jsx-runtime")}}),Qu={};Du(Qu,{default:()=>p});var Ju,ed=zu({"src/components/stream/AccessibleDataTableContent.tsx"(){Vu=Fu(require("react")),Zu(),Ku(),_u(),Ou(),Xu(),Bu(),Uu=require("react/jsx-runtime")}}),td={};Du(td,{ChoroplethMap:()=>$y,DEFAULT_HIT_RADIUS:()=>cb,DistanceCartogram:()=>rb,FlowMap:()=>Jy,GeoCustomChart:()=>sb,MultiLineTooltip:()=>$s,ProportionalSymbolMap:()=>Vy,StreamGeoFrame:()=>ny,Tooltip:()=>Ds,TooltipRoot:()=>jg,composeStyleRules:()=>ac,geoAreaHitTarget:()=>Ec,geoHitTarget:()=>Pc,geographicDotGridLayout:()=>kb,geographicGridLayout:()=>pb,glyphExtent:()=>To,glyphPlacement:()=>Io,gridifyGeographicPoints:()=>Dc,hasOwnTooltipChrome:()=>Fa,hasTooltipContent:()=>Pa,hatchFillId:()=>Ci,hatchPatternDef:()=>Ni,hitTargetPoint:()=>Nc,isHatchFill:()=>Ai,makeNodeRuleContext:()=>tc,makeRuleValueResolver:()=>ec,markTooltipChrome:()=>Da,matchesThreshold:()=>rc,mergeData:()=>hu,resolveReferenceGeography:()=>gc,resolveResponsiveRules:()=>Al,resolveStyleRules:()=>oc,resolveSvgFill:()=>Pi,responsiveRuleMatches:()=>Ml,ruleMatches:()=>ic,sampleGeographicDotGrid:()=>tu}),module.exports=(Ju=td,$u(Nu({},"__esModule",{value:!0}),Ju));var nd,rd,id,od,ad,sd,ld,cd,ud,dd,hd,fd,pd,md,gd,yd,bd=require("react"),vd="undefined"==typeof window||"undefined"==typeof document,xd=vd?bd.useEffect:bd.useLayoutEffect,wd=require("react"),kd=require("d3-array"),Sd=1e-6,Md=1e-12,jd=Math.PI,Ad=jd/2,Rd=jd/4,Cd=2*jd,Ld=180/jd,Nd=jd/180,Pd=Math.abs,Ed=Math.atan,Id=Math.atan2,Td=Math.cos,zd=Math.ceil,Dd=Math.exp,$d=Math.log,Fd=Math.sin,Od=Math.sign||function(e){return e>0?1:e<0?-1:0},_d=Math.sqrt,Bd=Math.tan,Wd={Feature:function(e,t){v(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)v(n[r].geometry,t)}},Hd={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){x(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)x(n[r],t,0)},Polygon:function(e,t){w(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)w(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)v(n[r],t)}},qd=new kd.Adder,Gd=new kd.Adder,Vd={point:b,lineStart:b,lineEnd:b,polygonStart:function(){qd=new kd.Adder,Vd.lineStart=S,Vd.lineEnd=M},polygonEnd:function(){var e=+qd;Gd.add(e<0?Cd+e:e),this.lineStart=this.lineEnd=this.point=b},sphere:function(){Gd.add(Cd)}},Ud=require("d3-array"),Yd={point:T,lineStart:D,lineEnd:$,polygonStart:function(){Yd.point=F,Yd.lineStart=O,Yd.lineEnd=_,md=new Ud.Adder,Vd.polygonStart()},polygonEnd:function(){Vd.polygonEnd(),Yd.point=T,Yd.lineStart=D,Yd.lineEnd=$,qd<0?(sd=-(cd=180),ld=-(ud=90)):md>Sd?ud=90:md<-Sd&&(ld=-90),yd[0]=sd,yd[1]=cd},sphere:function(){sd=-(cd=180),ld=-(ud=90)}};V.invert=V;var Xd,Zd,Kd,Qd,Jd,eh,th,nh,rh,ih,oh,ah,sh=require("d3-array"),lh=require("d3-array"),ch=se(function(){return!0},function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?jd:-jd,l=Pd(o-n);Pd(l-jd)<Sd?(e.point(n,r=(r+a)/2>0?Ad:-Ad),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),e.point(o,r),t=0):i!==s&&l>=jd&&(Pd(n-i)<Sd&&(n-=i*Sd),Pd(o-s)<Sd&&(o-=s*Sd),r=ue(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(s,r),t=0),e.point(n=o,r=a),i=s},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}},function(e,t,n,r){var i;if(null==e)i=n*Ad,r.point(-jd,i),r.point(0,i),r.point(jd,i),r.point(jd,0),r.point(jd,-i),r.point(0,-i),r.point(-jd,-i),r.point(-jd,0),r.point(-jd,i);else if(Pd(e[0]-t[0])>Sd){var o=e[0]<t[0]?jd:-jd;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])},[-jd,-Ad]),uh=require("d3-array"),dh=1e9,hh=-dh,fh=require("d3-array"),ph={sphere:b,point:b,lineStart:function(){ph.point=me,ph.lineEnd=pe},lineEnd:b,polygonStart:b,polygonEnd:b},mh=[null,null],gh={type:"LineString",coordinates:mh},yh={Feature:function(e,t){return be(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)if(be(n[r].geometry,t))return!0;return!1}},bh={Sphere:function(){return!0},Point:function(e,t){return ve(e.coordinates,t)},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(ve(n[r],t))return!0;return!1},LineString:function(e,t){return xe(e.coordinates,t)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(xe(n[r],t))return!0;return!1},Polygon:function(e,t){return we(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)if(we(n[r],t))return!0;return!1},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)if(be(n[r],t))return!0;return!1}},vh=require("d3-array"),xh=e=>e,wh=require("d3-array"),kh=new wh.Adder,Sh=new wh.Adder,Mh={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Mh.lineStart=Le,Mh.lineEnd=Ee},polygonEnd:function(){Mh.lineStart=Mh.lineEnd=Mh.point=b,kh.add(Pd(Sh)),Sh=new wh.Adder},result:function(){var e=kh/2;return kh=new wh.Adder,e}},jh=Mh,Ah=1/0,Rh=Ah,Ch=-Ah,Lh=Ch,Nh={point:function(e,t){e<Ah&&(Ah=e),e>Ch&&(Ch=e),t<Rh&&(Rh=t),t>Lh&&(Lh=t)},lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b,result:function(){var e=[[Ah,Rh],[Ch,Lh]];return Ch=Lh=-(Rh=Ah=1/0),e}},Ph=0,Eh=0,Ih=0,Th=0,zh=0,Dh=0,$h=0,Fh=0,Oh=0,_h={point:Ie,lineStart:Te,lineEnd:$e,polygonStart:function(){_h.lineStart=Fe,_h.lineEnd=Oe},polygonEnd:function(){_h.point=Ie,_h.lineStart=Te,_h.lineEnd=$e},result:function(){var e=Oh?[$h/Oh,Fh/Oh]:Dh?[Th/Dh,zh/Dh]:Ih?[Ph/Ih,Eh/Ih]:[NaN,NaN];return Ph=Eh=Ih=Th=zh=Dh=$h=Fh=Oh=0,e}},Bh=_h;We.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Cd)}},result:b};var Wh,Hh,qh,Gh,Vh,Uh,Yh,Xh,Zh,Kh=require("d3-array"),Qh=new Kh.Adder,Jh={point:b,lineStart:function(){Jh.point=He},lineEnd:function(){Wh&&qe(Hh,qh),Jh.point=b},polygonStart:function(){Wh=!0},polygonEnd:function(){Wh=null},result:function(){var e=+Qh;return Qh=new Kh.Adder,e}},ef=Jh,tf=class{constructor(e){this._append=null==e?Ge:Ve(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Xh||this._append!==Yh){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Xh=e,Yh=this._append,Zh=this._,this._=t}this._+=Zh}}result(){const e=this._;return this._="",e.length?e:null}};Xe.prototype={constructor:Xe,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var nf=Td(30*Nd),rf=Ye({point:function(e,t){this.stream.point(e*Nd,t*Nd)}});ht.invert=function(e,t){return[e,2*Ed(Dd(t))-Ad]},pt.invert=pt;var of,af=1.340264,sf=-.081106,lf=893e-6,cf=.003796,uf=_d(3)/2;mt.invert=function(e,t){for(var n,r=t,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(af+sf*i+o*(lf+cf*i))-t)/(af+3*sf*i+o*(7*lf+9*cf*i)))*r)*i*i,!(Pd(n)<Md));++a);return[uf*e*(af+3*sf*i+o*(7*lf+9*cf*i))/Td(r),g(Fd(r)/uf)]},yt.invert=function(e,t){var n,r=t,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Pd(n)>Sd&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},bt.invert=(of=g,function(e,t){var n=_d(e*e+t*t),r=of(n),i=Fd(r),o=Td(r);return[Id(e*i,n*o),g(n&&t*i/n)]});var df,hf,ff=/* @__PURE__ */new WeakMap,pf=require("d3-quadtree"),mf=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,e<1)throw new Error("RingBuffer capacity must be at least 1");this.buffer=new Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e<0||e>=this._size)return;const t=(this.head-this._size+e+this._capacity)%this._capacity;return this.buffer[t]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>e>=this._size?{done:!0,value:void 0}:{done:!1,value:this.get(e++)}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;n<this._size;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=new Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;n<this._size;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(e<1)throw new Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,r=[];t.length>e&&(n=t.length-e,r=t.slice(0,n)),this._capacity=e,this.buffer=new Array(e),this.head=0,this._size=0;for(let e=n;e<t.length;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;i<this._size;i++){const o=(r+i)%this._capacity,a=this.buffer[o];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},n.push(e),this.buffer[o]=t(a)}}return n}remove(e){const t=[],n=[];if(this.forEach(r=>{e(r)?n.push(r):t.push(r)}),0===n.length)return n;this.buffer=new Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=new Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},gf=1,yf=1.5,bf=3,vf=require("d3-scale"),xf=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],wf=/* @__PURE__ */zt(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),kf=/* @__PURE__ */zt(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Sf=/* @__PURE__ */zt(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Mf=/* @__PURE__ */zt(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),jf=/* @__PURE__ */zt(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),Af=/* @__PURE__ */zt(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),Rf={blues:wf,reds:kf,greens:Sf,viridis:/* @__PURE__ */zt(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),oranges:Mf,purples:jf,greys:Af,plasma:/* @__PURE__ */zt(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),inferno:/* @__PURE__ */zt(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),magma:/* @__PURE__ */zt(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),cividis:/* @__PURE__ */zt(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),turbo:/* @__PURE__ */zt(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"])},Cf={category10:xf,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Rf},Lf=xf,Nf="#007bff",Pf=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ef=/* @__PURE__ */new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),If={mercator:function(){return ft(ht).scale(961/Cd)},equalEarth:gt,albersUsa:function(){function e(e){var t=e[0],n=e[1];return s=null,i.point(t,n),s||(o.point(t,n),s)||(a.point(t,n),s)}function t(){return n=r=null,e}var n,r,i,o,a,s,l=dt().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7]),c=dt().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=dt().rotate([157,0]).center([-3,19.9]).parallels([8,18]),d={point:function(e,t){s=[e,t]}};return e.invert=function(e){var t=l.scale(),n=l.translate(),r=(e[0]-n[0])/t,i=(e[1]-n[1])/t;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?c:i>=.166&&i<.234&&r>=-.214&&r<-.115?u:l).invert(e)},e.stream=function(e){return n&&r===e?n:(t=[l.stream(r=e),c.stream(e),u.stream(e)],i=t.length,n={point:function(e,n){for(var r=-1;++r<i;)t[r].point(e,n)},sphere:function(){for(var e=-1;++e<i;)t[e].sphere()},lineStart:function(){for(var e=-1;++e<i;)t[e].lineStart()},lineEnd:function(){for(var e=-1;++e<i;)t[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<i;)t[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<i;)t[e].polygonEnd()}});var t,i},e.precision=function(e){return arguments.length?(l.precision(e),c.precision(e),u.precision(e),t()):l.precision()},e.scale=function(t){return arguments.length?(l.scale(t),c.scale(.35*t),u.scale(t),e.translate(l.translate())):l.scale()},e.translate=function(e){if(!arguments.length)return l.translate();var n=l.scale(),r=+e[0],s=+e[1];return i=l.translate(e).clipExtent([[r-.455*n,s-.238*n],[r+.455*n,s+.238*n]]).stream(d),o=c.translate([r-.307*n,s+.201*n]).clipExtent([[r-.425*n+Sd,s+.12*n+Sd],[r-.214*n-Sd,s+.234*n-Sd]]).stream(d),a=u.translate([r-.205*n,s+.212*n]).clipExtent([[r-.214*n+Sd,s+.166*n+Sd],[r-.115*n-Sd,s+.234*n-Sd]]).stream(d),t()},e.fitExtent=function(t,n){return Ke(e,t,n)},e.fitSize=function(t,n){return Qe(e,t,n)},e.fitWidth=function(t,n){return Je(e,t,n)},e.fitHeight=function(t,n){return et(e,t,n)},e.scale(1070)},orthographic:function(){return st(bt).scale(249.5).clipAngle(90.000001)},naturalEarth:function(){return st(yt).scale(175.295)},equirectangular:function(){return st(pt).scale(152.63)}},Tf=require("d3-scale"),zf={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"},Df=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=yn({kind:"initialize"},[],this.revisions),this.listeners=/* @__PURE__ */new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=yn(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},$f=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ff=["scene-style","data-paint","accessibility","evidence"],Of=(e,t)=>({retainedData:e,invalidations:t}),_f=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Bf=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Wf=["scene-geometry","data-paint","accessibility","evidence"],Hf=["scene-style","data-paint","accessibility","evidence"],qf=["scene-geometry","scene-style","data-paint","accessibility","evidence"],Gf=["overlay","accessibility","evidence"],Vf=[],Uf={xAccessor:/* @__PURE__ */Of("rebuild",_f),yAccessor:/* @__PURE__ */Of("rebuild",_f),lineDataAccessor:/* @__PURE__ */Of("rebuild",_f),pointIdAccessor:/* @__PURE__ */Of("rebuild",Wf),lineIdAccessor:/* @__PURE__ */Of("rebuild",Wf),windowSize:/* @__PURE__ */Of("rebuild",_f),projection:/* @__PURE__ */Of("preserve",Bf),projectionExtent:/* @__PURE__ */Of("preserve",Bf),fitPadding:/* @__PURE__ */Of("preserve",Bf),lineType:/* @__PURE__ */Of("preserve",Bf),flowStyle:/* @__PURE__ */Of("preserve",Bf),graticule:/* @__PURE__ */Of("preserve",Bf),projectionTransform:/* @__PURE__ */Of("preserve",Bf),customLayout:/* @__PURE__ */Of("preserve",Bf),layoutConfig:/* @__PURE__ */Of("preserve",Bf),layoutMargin:/* @__PURE__ */Of("preserve",Bf),areaStyle:/* @__PURE__ */Of("preserve",Hf),pointStyle:/* @__PURE__ */Of("preserve",qf),lineStyle:/* @__PURE__ */Of("preserve",Hf),colorScheme:/* @__PURE__ */Of("preserve",Hf),themeCategorical:/* @__PURE__ */Of("preserve",Hf),themeDiverging:/* @__PURE__ */Of("preserve",Hf),themeSemantic:/* @__PURE__ */Of("preserve",Hf),themeSequential:/* @__PURE__ */Of("preserve",Hf),decay:/* @__PURE__ */Of("preserve",Hf),pulse:/* @__PURE__ */Of("preserve",Hf),layoutSelection:/* @__PURE__ */Of("preserve",Hf),annotations:/* @__PURE__ */Of("preserve",Gf),autoPlaceAnnotations:/* @__PURE__ */Of("preserve",Gf),clock:/* @__PURE__ */Of("preserve",Vf),transition:/* @__PURE__ */Of("preserve",Vf),introAnimation:/* @__PURE__ */Of("preserve",Vf),onLayoutError:/* @__PURE__ */Of("preserve",Vf)},Yf=/* @__PURE__ */Of("preserve",Bf),Xf=class{constructor(){this.tracker=new Df}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},$f)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Ff):this.recordNoop("restyle")}recordConfig(e,t={}){const n=bn(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},Zf=/* @__PURE__ */new WeakMap,Kf=class{getLastUpdateResult(){return this.updateResults.last}getUpdateSnapshot(){return this.updateResults.last}subscribeUpdateResult(e){return this.updateResults.subscribe(e)}setLayoutSelection(e){this.config.layoutSelection=e}markStylePaintPending(){Zf.set(this,!0)}consumeStylePaintPending(){const e=!0===Zf.get(this);return Zf.delete(this),e}},Qf=class extends Kf{constructor(e){super(),this.updateResults=new Xf,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=wn(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||e<1)throw new Error("GeoPipelineStore windowSize must be a positive integer");return e}retainNewestLines(e=this.getConfiguredWindowSize()){this.lineData.length>e&&(this.lineData=this.lineData.slice(-e))}resizeStreamingWindow(e){if(this.pointBuffer){const t=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],r=t.slice(-e),i=n.slice(-r.length),o=this.currentTime();this.pointBuffer=new mf(e),this.timestampBuffer=new mf(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??o)})}this.retainNewestLines(e)}updateConfig(e){const t=kn(e),n=this.config,r=this.getConfiguredWindowSize(),i=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const o=this.getConfiguredWindowSize(),a=this.streaming&&o!==r;a&&(this.resizeStreamingWindow(o),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(i,{retainedDataChanged:a})}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setAreas(e){this.areas=e,this.updateResults.recordData("replace",e.length)}setAreasWithResult(e){return this.setAreas(e),this.updateResults.last}setPoints(e){this.pointData=e.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",e.length)}setPointsWithResult(e){return this.setPoints(e),this.updateResults.last}setLines(e){this.lineData=e.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",e.length)}setLinesWithResult(e){return this.setLines(e),this.updateResults.last}initStreaming(e){void 0!==e&&e!==this.config.windowSize&&(this.config={...this.config,windowSize:e});const t=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],i=n.slice(-t),o=r.slice(-i.length),a=this.currentTime();this.pointBuffer=new mf(t),this.timestampBuffer=new mf(t),i.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??a)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();pn(this.pointBuffer,e,this.timestampBuffer,t),this.lastIngestTime=t,this.updateResults.recordData("ingest",1)}pushPointWithResult(e){return this.pushPoint(e),this.updateResults.last}pushMany(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();for(const n of e)pn(this.pointBuffer,n,this.timestampBuffer,t);this.lastIngestTime=t,this.updateResults.recordData("ingest",e.length)}pushManyWithResult(e){return this.pushMany(e),this.updateResults.last}pushLine(e){null!=e&&"object"==typeof e?(this.streaming||this.initStreaming(),this.lineData.push(e),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(e){if(!Array.isArray(e)||0===e.length)return void this.updateResults.recordNoop("ingest");const t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(const e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}removeLine(e){const{lineIdAccessor:t}=this.config;if(!t)throw new Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),i=[];return this.lineData=this.lineData.filter(e=>!r.has(String(n(e)))||(i.push(e),!1)),i.length>0?(this.version++,this.updateResults.recordData("remove",i.length)):this.updateResults.recordNoop("remove"),i}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw new Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){const e=e=>r.has(String(n(e)));mn(this.pointBuffer,this.timestampBuffer,e);const t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{const e=[];return this.pointData=this.pointData.filter(t=>!r.has(String(n(t)))||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){const t=this._customRestyle;if(t){for(const n of this.scene){const r=this._baseStyles.get(n)??n.style,i=t(n,e);n.style=i?{...r,...i}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}rebuildProjectedScene(e,t){this._customLayoutFailedThisBuild=!1;const n=this.buildSceneNodes(e);return this._customLayoutFailedThisBuild?(this.lastCustomLayoutFailure?.preservedLastGoodScene?t():(this.scene=[],this.rebuildQuadtree()),!1):(this.scene=n,this.rebuildQuadtree(),!0)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,i=this.scales,o=this.baseScale,a=[...this.baseTranslate],s=[...this.baseRotation],l=this.scene;this.projection=Kt(t.projection),this.geoPath=Ue(this.projection),this.fitProjection(e),this.geoPath=Ue(this.projection);const c=this.projection;if(this.scales=kt(c),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(e,()=>{this.projection=n,this.geoPath=r,this.scales=i,this.baseScale=o,this.baseTranslate=a,this.baseRotation=s})){if(t.projectionTransform&&this.applyCartogramTransform(t.projectionTransform,e),t.decay&&this.streaming&&this.applyDecay(),t.pulse&&this.streaming&&this.applyPulse(),t.transition&&!this._hasRenderedOnce&&this.scene.length>0&&t.introAnimation){const t=e.width/2,n=e.height/2,r=this.scene.filter(e=>"point"===e.type).map(e=>({...e,x:t,y:n}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,t.transition&&l.length>0&&this.startTransition(l),this.version++}}fitProjection(e){const t=this.projection,n=this.config,r=[...this.areas],i=Qt(n.xAccessor,"lon"),o=Qt(n.yAccessor,"lat"),a=this.getPoints();if(a.length>0){const e=a.map(e=>[i(e),o(e)]).filter(e=>e.every(Number.isFinite));r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const s=Jt(n.lineDataAccessor);for(const e of this.lineData){const t=s(e);if(t&&t.length>0){const e=t.map(e=>[i(e),o(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,i],[o,a]]=n.projectionExtent,s={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,i],[r,a],[o,a],[o,i],[r,i]]]}};t.fitExtent([[0,0],[e.width,e.height]],s)}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,i=Math.min(e.width,e.height),o=i/2-i*r;t.scale(o),t.translate([e.width/2,e.height/2])}else{const i={type:"FeatureCollection",features:r},o=n.fitPadding??0,a=e.width*o,s=e.height*o;t.fitExtent([[a,s],[e.width-a,e.height-s]],i),vt(t,i,e)}this.baseScale=t.scale(),this.baseTranslate=t.translate(),this.baseRotation=t.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e.k),n.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=Ue(n),this.scales=kt(n),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(t,()=>{n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i})&&(this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){const n=this.projection;if(!n)return;const r=this.geoPath,i=this.scales,o=n.scale(),a=[...n.translate()],s=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=Ue(n),this.scales=kt(n),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(t,()=>{n.scale(o),n.translate(a),this.currentZoom=s,this.geoPath=r,this.scales=i})&&(this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){const n=this.projection;if(!n||!n.rotate)return;const r=this.geoPath,i=this.scales,o=[...n.rotate()];n.rotate(e),this.geoPath=Ue(n),this.scales=kt(n),this.geoPath=this.scales.geoPath,this.rebuildProjectedScene(t,()=>{n.rotate(o),this.geoPath=r,this.scales=i})&&(this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(const n of this.scene)"point"===n.type&&!1!==n.interactive&&(t++,n.r>e&&(e=n.r));if(this._maxPointRadius=e,t<=500)return void(this._quadtree=null);const n=new Array(t);let r=0;for(const e of this.scene)"point"===e.type&&!1!==e.interactive&&(n[r++]=e);this._quadtree=(0,pf.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;const{config:t}=this,n=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){const n=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=$t(t.colorScheme,t.themeCategorical,Pf),i={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:n,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:qt(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null},o=Zt({family:"geo",logLabel:"geo customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:t.onLayoutError,run:()=>t.customLayout(i)});if("failure"===o.kind)return this.lastCustomLayoutFailure=o.diagnostic,this._customLayoutFailedThisBuild=!0,o.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,[]);const a=o.result,s=a.nodes??[];if(this.customLayoutOverlays=a.overlays??null,this.lastCustomLayoutResult=a,this.lastCustomLayoutFailure=null,this._customRestyle=a.restyle,this.hasCustomRestyle=!!a.restyle,this._baseStyles=/* @__PURE__ */new WeakMap,this.hasCustomRestyle)for(const e of s){this._baseStyles.set(e,e.style);const n=a.restyle?.(e,t.layoutSelection??null);n&&(e.style={...e.style,...n})}return Gt({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,vn({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=dn(this.scene,e,t,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const e=this.config.decay;if(!e||!this.pointBuffer)return;const t=this.pointBuffer.size;if(0===t)return;const n=this.scene.filter(e=>"point"===e.type),r=wt(n,this.getPoints());for(let i=0;i<n.length;i++){if(r[i]<0)continue;const o=Lt(e,r[i],t);n[i]._decayOpacity=o,n[i].style={...n[i].style,opacity:o}}}applyPulse(e=this.currentTime()){const t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;const n=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),i=wt(n,this.getPoints()),o=t.color||"rgba(255,255,255,0.6)",a=t.glowRadius??4;let s=!1;for(let l=0;l<n.length;l++){const c=r[i[l]];if(void 0===c)continue;const u=Nt(t,c,e);s=Pt(n[l],u,o,a)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&Et(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(t<=0)return;const n=/* @__PURE__ */new Map;for(const t of e)"point"===t.type&&t.pointId&&n.set(t.pointId,[t.x,t.y]);const r=this.scene.filter(e=>"point"===e.type);let i=!1;for(const e of r)if(e.pointId){const t=n.get(e.pointId);t&&(e._targetX=e.x,e._targetY=e.y,e.x=t[0],e.y=t[1],(Math.abs(t[0]-e._targetX)>.5||Math.abs(t[1]-e._targetY)>.5)&&(i=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??e.style?.fillOpacity??1,e.style={...e.style,opacity:0},i=!0);i&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null;for(const e of this.scene)"point"===e.type&&(null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0),null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0))}advanceTransition(e){if(!this.activeTransition)return!1;const t=Mt(e,this.activeTransition),n=St(t,this.config.transition?.easing),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.x,r=e.y;e.x=jt(t,e._targetX,n),e.y=jt(r,e._targetY,n)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*n})}if(t>=1){for(const e of r)null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0),null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}},Jf=require("react"),ep=require("d3-selection"),tp=require("d3-zoom"),np=Object.freeze([]),rp=require("react"),ip={sceneGeometry:0,layout:0,domain:0},op="production"!==process.env.NODE_ENV,ap={revisions:ip,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},sp=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=ip,this.lastObserved=ip,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){op&&(this.lastObserved=Rn(this.lastObserved,jn(e)))}beforeCompute(e,t){if(!op)return ap;const n=Rn(jn(e),this.lastObserved),r=An(n),i=(o=n,a=this.lastConsumed,!(o.sceneGeometry===a.sceneGeometry&&o.layout===a.layout&&o.domain===a.domain));var o,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:i,warnUnconsumed:!t&&i&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(op){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},lp=/* @__PURE__ */ /* @__PURE__ */(0,rp.memo)(function({store:e,diagnostics:t}){return(0,rp.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),cp=Fu(require("react")),up=require("react"),dp=require("react-dom"),hp=require("./semiotic-client-cjs-shared.min.js"),fp=require("react"),pp=require("react"),mp="undefined"==typeof window?pp.useEffect:pp.useLayoutEffect,gp=/* @__PURE__ */new WeakMap,yp=0,bp=!1,vp=null,xp=null,wp=null,kp=null,Sp=/* @__PURE__ */new Set,Mp=()=>"undefined"!=typeof performance?performance.now():Date.now(),jp=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=/* @__PURE__ */new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??Mp,this.lastWallTime=Bn(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=Bn(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??Mp;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Bn(t,this.lastWallTime))}setRandomSource(e,t){const n=_n(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:On(n)))}},Ap=34,Rp=70,Cp="undefined"==typeof window?up.useEffect:up.useLayoutEffect,Lp={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)},Np=require("react"),Pp=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],Ep={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Ip={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Tp={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:Pp,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},zp=require("react"),Dp={fresh:1,aging:.7,stale:.45,expired:.25},$p={alpha:1,band:"fresh",isStale:!1},Fp=require("react/jsx-runtime"),Op={live:"#28a745",stale:"#dc3545",stopped:"#6c757d",failed:"#842029",settling:"#fd7e14"},_p=Fu(require("react")),Bp=require("./semiotic-client-cjs-shared.min.js"),Wp=require("react"),Hp=/^\s*var\(\s*--[^,)\s]+\s*(?:,\s*([\s\S]*))?\)\s*$/,qp=require("react/jsx-runtime"),Gp="var(--semiotic-bg, #ffffff)",Vp=require("react/jsx-runtime"),Up=require("react/jsx-runtime"),Yp=Fu(require("react")),Xp=require("react/jsx-runtime"),Zp=require("d3-hierarchy"),Kp=require("d3-shape"),Qp=require("d3-scale"),Jp=(/* @__PURE__ */require("d3-scale"),Symbol.for("semiotic.heatmapBandTicks")),em=/* @__PURE__ */Symbol.for("semiotic.heatmapBandKeys"),tm=/* @__PURE__ */Symbol.for("semiotic.heatmapBandKeyIndex"),nm=/* @__PURE__ */Symbol.for("semiotic.heatmapBandDirection"),rm=null,im=require("react/jsx-runtime"),om=/* @__PURE__ */new Map,am=/* @__PURE__ */new Set(["top-left","top-center","top-right","middle-left","center","middle-right","bottom-left","bottom-center","bottom-right"]),sm=require("react/jsx-runtime"),lm={fill:"var(--semiotic-text, #333)",fontSize:11,fontFamily:"inherit"},cm=require("react/jsx-runtime"),um={secondary:0,primary:3},dm=require("react/jsx-runtime"),hm={linear:Kp.curveLinear,monotoneX:Kp.curveMonotoneX,monotoneY:Kp.curveMonotoneY,step:Kp.curveStep,stepAfter:Kp.curveStepAfter,stepBefore:Kp.curveStepBefore,basis:Kp.curveBasis,cardinal:Kp.curveCardinal,catmullRom:Kp.curveCatmullRom},fm=/* @__PURE__ */new Set(["label","callout","callout-circle","callout-rect","text","widget"]),pm=32,mm=6,gm=4,ym=8,bm=72,vm={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"},xm=Fu(require("react")),wm={fontFamily:"var(--semiotic-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},km={fontSize:"var(--semiotic-legend-font-size, 12px)"},Sm=Fu(require("react")),Mm=require("react/jsx-runtime"),jm=require("react/jsx-runtime"),Am=e=>e.legendGroup.items.map((t,n)=>jo(e,t,n,`translate(0,${n*e.metrics.rowHeight})`,!1)),Rm=(e,t)=>{const{items:n}=e.legendGroup,r=[],{swatchSize:i,labelGap:o,itemGap:a,rowHeight:s,align:l}=e.metrics,c=n.map(e=>i+o+7*e.label.length),u=[];let d=0,h=0;c.forEach((e,n)=>{const r=0===h?e:h+a+e;t&&t>0&&h>0&&r>t?(u.push({start:d,end:n,width:h}),d=n,h=e):h=r}),n.length>0&&u.push({start:d,end:n.length,width:h}),u.forEach((i,o)=>{let u="center"===l?Math.max(0,((t??i.width)-i.width)/2):"end"===l?Math.max(0,(t??i.width)-i.width):0;for(let t=i.start;t<i.end;t++)r.push(jo(e,n[t],t,`translate(${u},${o*s})`,!0)),u+=c[t]+a});const f=u.reduce((e,t)=>Math.max(e,t.width),0),p=u.length;return{items:r,offset:f,totalRows:p,totalHeight:p*s}},Cm=(e,t,n)=>{const r=[],i=or(e.map(e=>({hasLabel:Boolean(e.label),itemCount:e.items.length})),n.metrics.rowHeight);return e.forEach((e,o)=>{const a=i[o];r.push(
|
|
157
157
|
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */(0,
|
|
158
|
+
/* @__PURE__ */(0,jm.jsx)("line",{"aria-hidden":"true",stroke:"var(--semiotic-border, #808080)",x1:0,y1:a.lineY,x2:t,y2:a.lineY},`legend-top-line legend-symbol-${o}`)),e.label&&null!=a.labelY&&r.push(
|
|
159
159
|
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */(0,
|
|
160
|
+
/* @__PURE__ */(0,jm.jsx)("text",{y:a.labelY,className:"legend-group-label","aria-hidden":n.interactive||void 0,fontSize:12,style:km,fill:"var(--semiotic-text, #333)",children:e.label},`legend-text-${o}`)),r.push(
|
|
161
161
|
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */(0,
|
|
162
|
+
/* @__PURE__ */(0,jm.jsx)("g",{className:"legend-item",role:n.interactive?"group":void 0,"aria-label":e.label,transform:`translate(0,${a.itemsY})`,children:Am({...n,legendGroup:e,groupIndex:o})},`legend-group-${o}`))}),r},Lm=(e,t,n,r)=>{const{metrics:i}=r;let o=0;const a=[];e.forEach((e,n)=>{let s=0;e.label&&(s+=16);const l=Rm({...r,legendGroup:e,groupIndex:n},i.maxWidth??t);s+=l.offset+5,a.push({...l,offset:s}),o+=s+12});const s=i.maxWidth??t;let l=o>s?0:"center"===i.align?Math.max(0,(s-o)/2):"end"===i.align?Math.max(0,s-o):0;const c=[];return a.forEach((t,i)=>{const o=e[i];if(o.label&&(c.push(
|
|
163
163
|
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */(0,
|
|
164
|
+
/* @__PURE__ */(0,jm.jsx)("text",{transform:`translate(${l},0) rotate(90)`,textAnchor:"start",className:"legend-group-label","aria-hidden":r.interactive||void 0,fontSize:12,style:km,fill:"var(--semiotic-text, #333)",children:o.label},`legend-text-${i}`)),l+=16),c.push(
|
|
165
165
|
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */(0,
|
|
166
|
+
/* @__PURE__ */(0,jm.jsx)("g",{className:"legend-item",role:r.interactive?"group":void 0,"aria-label":o.label,transform:`translate(${l},0)`,children:t.items},`legend-group-${i}`)),l+=t.offset+5,e[i+1]){const e=t.totalHeight||n;c.push(
|
|
167
167
|
/* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */(0,
|
|
169
|
-
return(0,
|
|
170
|
-
return(0,
|
|
168
|
+
/* @__PURE__ */(0,jm.jsx)("line",{"aria-hidden":"true",stroke:"var(--semiotic-border, #808080)",x1:l,y1:-8,x2:l,y2:e+0+8},`legend-top-line legend-symbol-${i}`))}l+=12}),/* @__PURE__ */ /* @__PURE__ */(0,jm.jsx)("g",{children:c})},Nm=require("react/jsx-runtime"),Pm=require("react/jsx-runtime"),Em=require("react/jsx-runtime"),Im=Fu(require("react")),Tm=(Fu(require("react")),[40,40]),zm=[.5,.5],Dm=null,$m=require("react/jsx-runtime"),Fm=Fu(require("react")),Om=require("react/jsx-runtime"),_m=require("react/jsx-runtime"),Bm=require("react"),Wm="undefined"!=typeof window?Bm.useLayoutEffect:Bm.useEffect,Hm=()=>()=>{},qm=()=>!1,Gm=()=>!0,Vm=require("react"),Um=require("react/jsx-runtime"),Ym="undefined"==typeof window?Vm.useEffect:Vm.useLayoutEffect,Xm=require("react"),Zm=Fu(require("react")),Km=Fu(require("react")),Qm={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},Jm={position:"absolute",top:4,left:4,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",width:"auto",height:"auto",maxWidth:"calc(100% - 8px)",overflow:"visible",whiteSpace:"normal",padding:"4px 8px",fontSize:12,background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:4};Ou();var eg=require("react/jsx-runtime");_u();var tg=Fu(require("react")),ng=/* @__PURE__ */new Map,rg=/* @__PURE__ */new Map,ig=/* @__PURE__ */tg.createContext(null),og=null,ag=!1,sg=require("react/jsx-runtime"),lg=Fu(require("react")),cg=Fu(require("react")),ug=(/* @__PURE__ */require("react/jsx-runtime"),cg.createContext(null)),dg="undefined"==typeof window?lg.useEffect:lg.useLayoutEffect;Ou(),Bu();var hg,fg=require("react/jsx-runtime"),pg=/* @__PURE__ */Zm.lazy(()=>Promise.resolve().then(()=>(Yu(),Wu))),mg=/* @__PURE__ */Zm.lazy(()=>Promise.resolve().then(()=>(ed(),Qu))),gg=require("react"),yg=require("react/jsx-runtime"),bg="var(--semiotic-focus, #005fcc)",vg=Fu(require("react")),xg=require("react-dom"),wg=Fu(require("react")),kg=require("react/jsx-runtime"),Sg={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"},Mg=/* @__PURE__ */Symbol.for("semiotic.tooltipChromeContext"),jg=/* @__PURE__ */Da(function({chrome:e,className:t="",style:n,children:r,...i}){const o=Ia(),a="default"===(e??o??"default"),s=wg.useRef(null);wg.useImperativeHandle(i.ref,()=>s.current);const l=za(s,void 0===e&&a);/* @__PURE__ */ /* @__PURE__ */
|
|
169
|
+
return(0,kg.jsx)("div",{...i,ref:s,"data-semiotic-tooltip-chrome":!0,className:l?t:`semiotic-tooltip ${t}`.trim(),style:a&&!l?{...Sg,...n}:n,children:r})}),Ag=require("react/jsx-runtime"),Rg=require("d3-zoom"),Cg=require("d3-selection"),Lg=require("d3-shape"),Ng=require("d3-shape"),Pg=/* @__PURE__ */new WeakMap,Eg=1,Ig=class{constructor(e=256){this.cache=/* @__PURE__ */new Map,this.limit=ls(e)}setLimit(e){this.limit=ls(e),this.cache.size>this.limit&&this.evict()}get(e){const t=this.cache.get(e);return t&&(t.lastUsed=performance.now()),t}set(e,t){this.cache.set(e,t),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let e,t=1/0;for(const[n,r]of this.cache)r.lastUsed<t&&(t=r.lastUsed,e=n);if(!e)break;{const t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(const e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}},Tg=class{constructor(e){this.capacity=e,this.particles=new Array(e);for(let t=0;t<e;t++)this.particles[t]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(e,t=Math.random){for(let n=0;n<this.capacity;n++){const r=this.particles[n];if(!r.active)return r.active=!0,r.t=0,r.offset=.6*(t()-.5),r.lineIndex=e,r.x=0,r.y=0,r}return null}step(e,t,n,r){for(let i=0;i<this.capacity;i++){const o=this.particles[i];if(!o.active)continue;const a=n[o.lineIndex];if(!a||a.length<2){o.active=!1;continue}if(o.t+=e*t,o.t>=1){o.active=!1;continue}const s=us(a),l=ds(a,o.t*s),c=(r[o.lineIndex]||2)/2;o.x=l.x+l.nx*o.offset*c*2,o.y=l.y+l.ny*o.offset*c*2}}countForLine(e){let t=0;for(let n=0;n<this.capacity;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;e<this.capacity;e++)this.particles[e].active=!1}},zg=Fu(require("react")),Dg=Fu(require("react")),$g=require("react/jsx-runtime"),Fg=/* @__PURE__ */new Set,Og="__semioticSelectionData",_g=["name","label","title"],Bg=["type","kind","category","group","class","status","role","shape"],Wg=["value","amount","total","count","weight","score"],Hg=/* @__PURE__ */new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]),qg=require("react/jsx-runtime"),Gg=!1,Vg=(require("react/jsx-runtime"),require("react/jsx-runtime")),Ug=/* @__PURE__ */Da(function({data:e}){if(!e)return null;if(e.properties){const t=e.properties.name||e.properties.NAME||e.properties.id||"Feature";/* @__PURE__ */ /* @__PURE__ */
|
|
170
|
+
return(0,Vg.jsx)("div",{className:"semiotic-tooltip",style:Sg,children:/* @__PURE__ */ /* @__PURE__ */(0,Vg.jsx)("div",{style:{fontWeight:600},children:t})})}const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=Es(t),r=null!=n.title?String(n.title):null;return null==r&&0===n.entries.length?null:/* @__PURE__ */ /* @__PURE__ */(0,Vg.jsxs)("div",{className:"semiotic-tooltip",style:Sg,children:[null!=r&&/* @__PURE__ */ /* @__PURE__ */(0,Vg.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{/* @__PURE__ */ /* @__PURE__ */return(0,Vg.jsxs)("div",{children:[
|
|
171
171
|
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */(0,
|
|
172
|
+
/* @__PURE__ */(0,Vg.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),
|
|
173
173
|
/* @__PURE__ */
|
|
174
|
-
/* @__PURE__ */(0,
|
|
174
|
+
/* @__PURE__ */(0,Vg.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?ks(t):t instanceof Date?Ns(t):String(t))})]},e.key);var t})]})}),Yg={top:10,right:10,bottom:10,left:10},Xg=null,Zg={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},Kg=require("react"),Qg=require("react"),Jg=Fu(require("react")),ey=require("react"),ty=require("react/jsx-runtime"),ny=/* @__PURE__ */pl(/* @__PURE__ */ /* @__PURE__ */(0,wd.memo)(
|
|
175
175
|
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */(0,td.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:i,projectionTransform:o,areas:a,points:s,lines:l,customLayout:c,layoutConfig:u,layoutSelection:d,onLayoutError:h,xAccessor:f,yAccessor:m,lineDataAccessor:g,pointIdAccessor:y,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:S,onZoom:M,dragRotate:j,showParticles:A,particleStyle:R,tileURL:C,tileAttribution:L,tileCacheSize:P,size:N,width:E,height:I,responsiveWidth:z,responsiveHeight:T,margin:D,className:$,background:O,maxDevicePixelRatio:F,runtimeMode:_,windowSize:W=500,renderMode:B,areaStyle:H,pointStyle:q,lineStyle:G,colorScheme:V,enableHover:U=!0,hoverAnnotation:Y,tooltipContent:X,allowTooltipOverflow:Z=!1,customClickBehavior:K,customHoverBehavior:Q,onObservation:J,annotationObservationCallback:ee,chartId:te,annotations:ne,onAnnotationActivate:re,autoPlaceAnnotations:ie,svgAnnotationRules:oe,decay:ae,pulse:se,transition:le,animate:ce,staleness:ue,frameScheduler:de,clock:he,random:fe,seed:pe,paused:me=!1,suspendWhenHidden:ge=!0,backgroundGraphics:ye,foregroundGraphics:be,title:ve,legend:xe,legendPosition:we,legendLayout:ke,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:je,legendIsolatedCategories:Ae,legendCategoryAccessor:Re,onCategoriesChange:Ce,showAxes:Le,accessibleTable:Pe=!0,description:Ne,summary:Ee}=e,{customHoverBehavior:Ie,customClickBehavior:ze,hasClickBehavior:Te}=Es({customHoverBehavior:Q,customClickBehavior:K,onObservation:J,chartId:te,chartType:"StreamGeoFrame"}),De=N||[E||600,I||400],$e=(0,td.useRef)(!0),Oe=sr({sizeProp:De,responsiveWidth:z,responsiveHeight:T,userMargin:D,marginDefault:bg,title:ve,legend:xe,legendPosition:we,legendLayout:ke,legendMarginReserved:e.__legendMarginReservedFor===xe,animate:ce,transitionProp:le,frameScheduler:de,clock:he,random:fe,seed:pe,paused:me,suspendWhenHidden:ge,themeDirtyRef:$e}),{reducedMotionRef:Fe,responsiveRef:_e,size:We,margin:Be,adjustedWidth:He,adjustedHeight:qe,transition:Ge,introEnabled:Ve,tableId:Ue,frameRuntime:Ye,rafRef:Xe,renderFnRef:Ze,scheduleRender:Ke,currentTheme:Qe}=Oe,Je=Do(),et=$o(),tt=(0,td.useMemo)(()=>Array.isArray(a)?kn(a):a,[a]),nt=(0,td.useMemo)(()=>kn(s),[s]),rt=(0,td.useMemo)(()=>kn(l),[l]),it=j??"orthographic"===Rs(n),ot=Zo((0,td.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:i,xAccessor:f,yAccessor:m,lineDataAccessor:g,lineType:v,flowStyle:x,areaStyle:H,pointStyle:q,lineStyle:G,colorScheme:V,themeSemantic:pr(Qe),themeSequential:Qe?.colors?.sequential,themeDiverging:Qe?.colors?.diverging,themeCategorical:Qe?.colors?.categorical,graticule:w,projectionTransform:o,windowSize:W,clock:Ye.now,decay:ae,pulse:se,transition:Ge,introAnimation:Ve,annotations:ne,pointIdAccessor:y,lineIdAccessor:b,customLayout:c,layoutConfig:u,onLayoutError:h,layoutMargin:Be}),[n,r,i,f,m,g,v,x,H,q,G,V,Qe,w,o,W,Ye.now,ae,se,Ge,Ve,ne,y,b,c,u,h,Be])),at=(0,td.useRef)(null);at.current||(at.current=new Ef(ot));const st=Ju||!Je&&et,lt=(0,td.useMemo)(()=>{if(!st)return null;const e=new Ef(ot);return tt&&e.setAreas(tt),s&&e.setPoints(nt),l&&e.setLines(rt),e.computeScene({width:He,height:qe}),e.cancelIntroAnimation(),e},[st,ot,tt,s,nt,l,rt,He,qe]);p(at,lt);const ct=lt??at.current,ut=(0,td.useRef)(null),dt=ut.current??(ut.current=qs(ct.scales)),{resolvedForeground:ht,resolvedBackground:ft,themeBackground:pt,surfaceBackground:mt}=Vs({foregroundGraphics:be,backgroundGraphics:ye,size:We,margin:Be,scales:ct.scales,background:O,themeBackgroundColor:Qe.colors.background,tracker:dt,readScales:()=>ct.scales}),gt=(0,td.useRef)(null),yt=(0,td.useRef)(null),bt=(0,td.useRef)(null);C&&!bt.current&&(bt.current=new rg(P??256)),bt.current?.setLimit(P??256);const vt=(0,td.useRef)(ne),xt=(0,td.useRef)(null),wt=(0,td.useRef)(Km.zoomIdentity),kt=(0,td.useRef)(!1),St=(0,td.useRef)(null),Mt=(0,td.useCallback)(e=>{St.current=e,_e&&"object"==typeof _e&&(_e.current=e)},[_e]),jt=(0,td.useRef)(null),At=(0,td.useRef)(null),Rt=(0,td.useRef)(null),Ct=(0,td.useRef)(0);if(A&&!Rt.current){const e=R?.maxPerLine??As();Rt.current=new ig(50*e)}const Lt=(0,td.useRef)(null),Pt=(0,td.useRef)(!1),Nt=(0,td.useRef)(null),Et=(0,td.useRef)(!1),It=(0,td.useRef)(!1),zt=(0,$f.useRef)(new Wf("StreamGeoFrame")),Tt=(0,td.useRef)(void 0),[Dt,$t]=(0,td.useState)(null),[,Ot]=(0,td.useState)(0),Ft=(0,td.useRef)(0),[_t,Wt]=(0,td.useState)(!1),Bt=da(at,Re,Ce,e=>e.getPoints());lr(at,ot,$e,Ke),cr(at,d,$e,Ke),(0,td.useEffect)(()=>{const e=at.current;e&&(tt&&e.setAreas(tt),s&&e.setPoints(nt),l&&e.setLines(rt),$e.current=!0,Ke())},[tt,s,nt,l,rt,Ke]),Sn(t,{storeRef:at,dirtyRef:$e,scheduleRender:Ke,zoomTransformRef:wt,containerRef:St,zoomBehaviorRef:xt});const{hoverHandlerRef:Ht,onPointerMove:qt,onPointerLeave:Gt,flushPointerMove:Vt,pointerStateRef:Ut}=Oe,{canvasRef:Yt,interactionCanvasRef:Xt,resolutionDirtyRef:Zt}=Go(Oe,{hydrated:Je,wasHydratingFromSSR:et,storeRef:at,dirtyRef:$e,cleanup:()=>bt.current?.clear(),maxDevicePixelRatio:F,canvasPaintDependencies:[He,qe,O,ye,B,C,P,Ke]});(0,td.useEffect)(()=>{Ht.current=e=>{const t=Yt.current;if(!t)return;const n=at.current;if(!n||!n.scene.length)return void No(t);const r=Cs({pointer:e,canvasRect:t.getBoundingClientRect(),margin:Be,width:He,height:qe,scene:n.scene,pointQuadtree:n.quadtree,maxPointRadius:n.maxPointRadius,hitCanvasRef:yt});No(t,"hit"===r.kind?Lo(r.node):void 0),U&&!1!==Y&&("hit"===r.kind?(Lt.current=r.hover,Nt.current=r.node,$t(r.hover),Ie?.(r.hover),Ke()):("outside"===r.kind||"miss"===r.kind&&Lt.current)&&(Lt.current=null,Nt.current=null,$t(null),Ie?.(null),Ke()))}},[U,Y,He,qe,Be,Ie,Ke,Ht,Yt]),Oe.hoverLeaveRef.current=()=>{No(Yt.current),U&&!1!==Y&&(Lt.current=null,Nt.current=null,$t(null),Ie?.(null),Ke())},Eo(Yt);const Kt=(0,td.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!ze)return;Vt();const n=at.current;if(!n||!n.scene.length)return void ze(null);const r=Cs({pointer:{clientX:e.clientX,clientY:e.clientY,pointerType:Tt.current},canvasRect:e.currentTarget.getBoundingClientRect(),margin:Be,width:He,height:qe,scene:n.scene,pointQuadtree:n.quadtree,maxPointRadius:n.maxPointRadius,hitCanvasRef:yt});var i;ze("hit"===r.kind?r.hover:null,{type:"activate",inputType:(i=Tt.current,"touch"===i?"touch":"pointer")})},[qe,He,ze,Be,Vt]),{kbFocusIndexRef:Qt,focusedNavPointRef:Jt,onKeyDown:en,refreshKeyboardFocus:tn}=(nn={clearPointerHover:Gt,storeRef:at,hoverRef:Lt,hoveredNodeRef:Nt,setHoverPoint:$t,customHoverBehavior:Ie,customClickBehavior:ze,scheduleRender:Ke},_s({...nn,extractPoints:Os,toHover:Ws,navigation:"linear"}));var nn;const rn=(0,td.useCallback)(e=>{var t,n,r,i,o;t=Ut,n=e,r=U&&!1!==Y,i=Pt.current,o=Yt.current,Us(t,n,void 0),(r||i)&&(r||"touch"!==t.current.pointerType||(No(o),0))&&(Tt.current=e.pointerType,Qt.current=-1,Jt.current=null,qt(e))},[Yt,U,Y,Jt,Qt,qt,Ut]),on=(0,td.useCallback)(e=>{Tt.current=e.pointerType},[]);Ze.current=()=>{if(Xe.current=null,dt.sync(at.current?.scales??null),!Ye.isActive)return;const e=Yt.current,t=at.current;if(!e||!t)return;const n=Ye.now();let r=!1;const i=At.current;let o=!1;if(i){At.current=null;const e={width:He,height:qe};t.applyRotation(i,e),o=!0}const a=null!=t.activeTransition,s=t.advanceTransition(Fe.current?n+1e6:n),l=!Fe.current&&s,c=zt.current.beforeCompute(t.getLastUpdateResult(),l);let u=!1;if($e.current&&!s){const e={width:He,height:qe},n=t.hasProjection(),r=it&&n?t.getRotation():null;t.computeScene(e);const i=wt.current,o=1!==i.k||0!==i.x||0!==i.y;it&&r?o?(t.setRotation(r),t.applyZoomScale(i.k,e)):t.applyRotation(r,e):o&&t.applyZoomTransform(i,e),tn(),$e.current=!1,u=!0,Bt()}dt.sync(t.scales),zt.current.afterCompute(c,u,!1);const d=Bo(F,We),h=Xt.current;h&&Fo(h,We,d);const f=A&&!Fe.current&&!!Rt.current,p=t.consumeStylePaintPending();(u||o||p)&&(Pt.current=Po(t.scene),Pt.current||No(e)),Pt.current&&(a||u||o||p)&&Ys({canvas:e,pointer:Ut.current,store:t,margin:Be,width:He,height:qe,hitCanvasRef:yt,geometryMoved:a||u||o});const m=Rn(t,n,u,It),g=Zt.current,y=(b={dirtyOrRebuilt:u,transitioning:a,continuous:f,liveEncoding:m.changed,forced:o||p||g},Boolean(b.dirtyOrRebuilt||b.transitioning||b.animationTicked||b.continuous||b.liveEncoding||b.forced));var b;if(Zt.current=!1,C&&bt.current){const e=gt.current;if(e&&t.scales?.projection){const n=Wo(e,We,Be,d);n&&(n.clearRect(-Be.left,-Be.top,We[0],We[1]),n.save(),n.beginPath(),n.rect(0,0,He,qe),n.clip(),qa(n,{tileURL:C,projection:t.scales.projection,width:He,height:qe,tileCache:bt.current,maxDevicePixelRatio:F,onTileLoad:()=>Ke()}),n.restore())}}if(y){const i=Wo(e,We,Be,d);if(!i)return;i.clearRect(-Be.left,-Be.top,We[0],We[1]),C||Jo(i,{background:O,themeBackground:pt,hasBackgroundGraphics:Boolean(ye),x:-Be.left,y:-Be.top,width:We[0],height:We[1]}),i.save(),i.beginPath(),i.rect(0,0,He,qe),i.clip();const o=t.scene,a=(t.scales,{width:He,height:qe});if(es({context:i,nodes:o,renderMode:B,pixelRatio:d,paintBuiltIn:e=>{Na(i,e),Ta(i,e.filter(e=>"line"===e.type),a),Da(i,e.filter(e=>"point"===e.type)),Oa(i,e.filter(e=>"glyph"===e.type))}}),f&&Rt.current){const e=Rt.current,t=o.filter(e=>"line"===e.type);if(t.length>0){const o=R||{},a=.3*(o.speedMultiplier??1),s=o.maxPerLine??As(),l=o.spawnRate??(js()?.06:.15),c=o.radius??2,u=o.opacity??.7,d=n/1e3,h=Ct.current>0?Math.min(d-Ct.current,.1):.016;Ct.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth??2);for(let n=0;n<t.length;n++)Ye.random()<l&&e.countForLine(n)<s&&e.spawn(n,Ye.random);e.step(h,a,f,p),i.globalAlpha=u;for(let n=0;n<e.particles.length;n++){const r=e.particles[n];if(!r.active)continue;const a=t[r.lineIndex],s="function"==typeof o.color?o.color(a?.datum??{}):"source"!==o.color&&o.color?o.color:a?.style.stroke||"#fff";i.beginPath(),i.arc(r.x,r.y,c,0,2*Math.PI),i.fillStyle=s,i.fill()}i.globalAlpha=1,r=!0}}i.restore()}(u||a&&!s)&&e.setAttribute("aria-label",ia(t.scene,"Geographic chart"));const v=Nt.current,x=Boolean(v&&("geoarea"===v.type||"point"===v.type)),w=(k=x,S=Et.current,k||S);var k,S;const M=Xt.current;if(M&&w){const e=Wo(M,We,Be,d);if(e){if(e.clearRect(-Be.left,-Be.top,We[0],We[1]),v&&"geoarea"===v.type){const t=new Path2D(v.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(v&&"point"===v.type){const t=v,n="object"==typeof Y?Y:void 0,r=n?.pointColor||Ua(v);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Et.current=x}const j=ne!==vt.current;j&&(vt.current=ne),(u||j||a&&ne&&ne.length>0)&&(u||j||a&&!s||n-Ft.current>=33)&&(Ot(e=>e+1),Ft.current=n),(l||null!=t.activeTransition||m.pending||r)&&Ke()},br(ue,at,$e,Ke,Ye.now,_t,Wt),(0,td.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&C){const e=Rs(n);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[C,n]),(0,td.useEffect)(()=>{const e=St.current;if(!k||!e)return xt.current&&e&&((0,Qm.select)(e).on(".zoom",null),xt.current=null),void(e&&(0,Qm.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=S||[1,8],r={width:He,height:qe};if(it){let i=wt.current.k;const o=e=>{i=Math.max(t,Math.min(n,e)),wt.current=Km.zoomIdentity.scale(i);const o=at.current;o&&(o.applyZoomScale(i,r),$e.current=!1,Ke(),o.scales?.projection&&M?.({projection:o.scales.projection,zoom:o.currentZoom}))};xt.current={scaleBy:(e,t)=>o(i*t),transform:(e,t)=>o(t?.k??1)};const a=e=>{e.preventDefault();const t=e.deltaY<0?1.1:1/1.1;o(i*t)},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),o(1.5*i))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=at.current;if(!r)return;const i=r.getRotation();jt.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=jt.current;if(!t)return;const n=e.clientX-t.x,r=e.clientY-t.y,i=[t.rotation[0]+n*l,Math.max(-90,Math.min(90,t.rotation[1]-r*l)),t.rotation[2]];At.current=i,Ke()},d=t=>{if(!jt.current)return;jt.current=null,e.releasePointerCapture(t.pointerId);const n=At.current;if(n){At.current=null;const e=at.current;e&&(e.applyRotation(n,r),Ke())}const i=at.current;i?.scales?.projection&&M?.({projection:i.scales.projection,zoom:i.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),xt.current=null}}const i=(0,Km.zoom)().scaleExtent([t,n]).extent([[0,0],[We[0],We[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;wt.current=t,kt.current=!0;const n=at.current;n&&(n.applyZoomTransform(t,r),$e.current=!1,Ke())}).on("end",e=>{wt.current=e.transform,kt.current=!1;const t=at.current;t?.scales?.projection&&M?.({projection:t.scales.projection,zoom:t.currentZoom})});return xt.current=i,(0,Qm.select)(e).call(i),()=>{(0,Qm.select)(e).on(".zoom",null)}},[k,S,it,We,He,qe,Be,M,Ke]);const an=U&&!1!==Y,sn=an&&Dt?X?X(Dt):/* @__PURE__ */ /* @__PURE__ */(0,jg.jsx)(yg,{data:Dt}):null,ln=fa(sn)?/* @__PURE__ */ /* @__PURE__ */(0,jg.jsx)(wa,{contentOwnsChrome:xa(X),x:Dt.x,y:Dt.y,containerWidth:He,containerHeight:qe,margin:Be,className:"stream-frame-tooltip",zIndex:10,children:sn}):null;if(st){const e=ct.scene;/* @__PURE__ */ /* @__PURE__ */
|
|
177
|
-
return(0,
|
|
176
|
+
/* @__PURE__ */(0,wd.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:i,projectionTransform:o,areas:a,points:s,lines:l,customLayout:c,layoutConfig:u,layoutSelection:d,onLayoutError:h,xAccessor:f,yAccessor:p,lineDataAccessor:g,pointIdAccessor:y,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:S,onZoom:M,dragRotate:j,showParticles:A,particleStyle:R,tileURL:C,tileAttribution:L,tileCacheSize:N,size:P,width:E,height:I,responsiveWidth:T,responsiveHeight:z,margin:D,className:$,background:F,maxDevicePixelRatio:O,runtimeMode:_,windowSize:B=500,renderMode:W,areaStyle:H,pointStyle:q,lineStyle:G,colorScheme:V,enableHover:U=!0,hoverAnnotation:Y,tooltipContent:X,allowTooltipOverflow:Z=!1,customClickBehavior:K,customHoverBehavior:Q,onObservation:J,annotationObservationCallback:ee,chartId:te,annotations:ne,onAnnotationActivate:re,autoPlaceAnnotations:ie,svgAnnotationRules:oe,decay:ae,pulse:se,transition:le,animate:ce,staleness:ue,frameScheduler:de,clock:he,random:fe,seed:pe,paused:me=!1,suspendWhenHidden:ge=!0,backgroundGraphics:ye,foregroundGraphics:be,title:ve,legend:xe,legendPosition:we,legendLayout:ke,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:je,legendIsolatedCategories:Ae,legendCategoryAccessor:Re,onCategoriesChange:Ce,showAxes:Le,accessibleTable:Ne=!0,description:Pe,summary:Ee}=e,{customHoverBehavior:Ie,customClickBehavior:Te,hasClickBehavior:ze}=Ks({customHoverBehavior:Q,customClickBehavior:K,onObservation:J,chartId:te,chartType:"StreamGeoFrame"}),De=P||[E||600,I||400],$e=(0,wd.useRef)(!0),Fe=lr({sizeProp:De,responsiveWidth:T,responsiveHeight:z,userMargin:D,marginDefault:Yg,title:ve,legend:xe,legendPosition:we,legendLayout:ke,legendMarginReserved:e.__legendMarginReservedFor===xe,animate:ce,transitionProp:le,frameScheduler:de,clock:he,random:fe,seed:pe,paused:me,suspendWhenHidden:ge,themeDirtyRef:$e}),{reducedMotionRef:Oe,responsiveRef:_e,size:Be,margin:We,adjustedWidth:He,adjustedHeight:qe,transition:Ge,introEnabled:Ve,tableId:Ue,frameRuntime:Ye,rafRef:Xe,renderFnRef:Ze,scheduleRender:Ke,currentTheme:Qe}=Fe,Je=Zo(),et=Ko(),tt=(0,wd.useMemo)(()=>Array.isArray(a)?Sn(a):a,[a]),nt=(0,wd.useMemo)(()=>Sn(s),[s]),rt=(0,wd.useMemo)(()=>Sn(l),[l]),it=j??"orthographic"===Vs(n),ot=ua((0,wd.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:i,xAccessor:f,yAccessor:p,lineDataAccessor:g,lineType:v,flowStyle:x,areaStyle:H,pointStyle:q,lineStyle:G,colorScheme:V,themeSemantic:mr(Qe),themeSequential:Qe?.colors?.sequential,themeDiverging:Qe?.colors?.diverging,themeCategorical:Qe?.colors?.categorical,graticule:w,projectionTransform:o,windowSize:B,clock:Ye.now,decay:ae,pulse:se,transition:Ge,introAnimation:Ve,annotations:ne,pointIdAccessor:y,lineIdAccessor:b,customLayout:c,layoutConfig:u,onLayoutError:h,layoutMargin:We}),[n,r,i,f,p,g,v,x,H,q,G,V,Qe,w,o,B,Ye.now,ae,se,Ge,Ve,ne,y,b,c,u,h,We])),at=(0,wd.useRef)(null);at.current||(at.current=new Qf(ot));const st=vd||!Je&&et,lt=(0,wd.useMemo)(()=>{if(!st)return null;const e=new Qf(ot);return tt&&e.setAreas(tt),s&&e.setPoints(nt),l&&e.setLines(rt),e.computeScene({width:He,height:qe}),e.cancelIntroAnimation(),e},[st,ot,tt,s,nt,l,rt,He,qe]);m(at,lt);const ct=lt??at.current,ut=(0,wd.useRef)(null),dt=ut.current??(ut.current=cl(ct.scales)),{resolvedForeground:ht,resolvedBackground:ft,themeBackground:pt,surfaceBackground:mt}=dl({foregroundGraphics:be,backgroundGraphics:ye,size:Be,margin:We,scales:ct.scales,background:F,themeBackgroundColor:Qe.colors.background,tracker:dt,readScales:()=>ct.scales}),gt=(0,wd.useRef)(null),yt=(0,wd.useRef)(null),bt=(0,wd.useRef)(null);C&&!bt.current&&(bt.current=new Ig(N??256)),bt.current?.setLimit(N??256);const vt=(0,wd.useRef)(ne),xt=(0,wd.useRef)(null),wt=(0,wd.useRef)(Rg.zoomIdentity),kt=(0,wd.useRef)(!1),St=(0,wd.useRef)(null),Mt=(0,wd.useCallback)(e=>{St.current=e,_e&&"object"==typeof _e&&(_e.current=e)},[_e]),jt=(0,wd.useRef)(null),At=(0,wd.useRef)(null),Rt=(0,wd.useRef)(null),Ct=(0,wd.useRef)(0);if(A&&!Rt.current){const e=R?.maxPerLine??Gs();Rt.current=new Tg(50*e)}const Lt=(0,wd.useRef)(null),Nt=(0,wd.useRef)(!1),Pt=(0,wd.useRef)(null),Et=(0,wd.useRef)(!1),It=(0,wd.useRef)(!1),Tt=(0,rp.useRef)(new sp("StreamGeoFrame")),zt=(0,wd.useRef)(void 0),[Dt,$t]=(0,wd.useState)(null),[,Ft]=(0,wd.useState)(0),Ot=(0,wd.useRef)(0),[_t,Bt]=(0,wd.useState)(!1),Wt=La(at,Re,Ce,e=>e.getPoints());cr(at,ot,$e,Ke),ur(at,d,$e,Ke),(0,wd.useEffect)(()=>{const e=at.current;e&&(tt&&e.setAreas(tt),s&&e.setPoints(nt),l&&e.setLines(rt),$e.current=!0,Ke())},[tt,s,nt,l,rt,Ke]),Mn(t,{storeRef:at,dirtyRef:$e,scheduleRender:Ke,zoomTransformRef:wt,containerRef:St,zoomBehaviorRef:xt});const{hoverHandlerRef:Ht,onPointerMove:qt,onPointerLeave:Gt,flushPointerMove:Vt,pointerStateRef:Ut}=Fe,{canvasRef:Yt,interactionCanvasRef:Xt,resolutionDirtyRef:Zt}=oa(Fe,{hydrated:Je,wasHydratingFromSSR:et,storeRef:at,dirtyRef:$e,cleanup:()=>bt.current?.clear(),maxDevicePixelRatio:O,canvasPaintDependencies:[He,qe,F,ye,W,C,N,Ke]});(0,wd.useEffect)(()=>{Ht.current=e=>{const t=Yt.current;if(!t)return;const n=at.current;if(!n||!n.scene.length)return void Go(t);const r=Us({pointer:e,canvasRect:t.getBoundingClientRect(),margin:We,width:He,height:qe,scene:n.scene,pointQuadtree:n.quadtree,maxPointRadius:n.maxPointRadius,hitCanvasRef:yt});Go(t,"hit"===r.kind?Ho(r.node):void 0),U&&!1!==Y&&("hit"===r.kind?(Lt.current=r.hover,Pt.current=r.node,$t(r.hover),Ie?.(r.hover),Ke()):("outside"===r.kind||"miss"===r.kind&&Lt.current)&&(Lt.current=null,Pt.current=null,$t(null),Ie?.(null),Ke()))}},[U,Y,He,qe,We,Ie,Ke,Ht,Yt]),Fe.hoverLeaveRef.current=()=>{Go(Yt.current),U&&!1!==Y&&(Lt.current=null,Pt.current=null,$t(null),Ie?.(null),Ke())},Vo(Yt);const Kt=(0,wd.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Te)return;Vt();const n=at.current;if(!n||!n.scene.length)return void Te(null);const r=Us({pointer:{clientX:e.clientX,clientY:e.clientY,pointerType:zt.current},canvasRect:e.currentTarget.getBoundingClientRect(),margin:We,width:He,height:qe,scene:n.scene,pointQuadtree:n.quadtree,maxPointRadius:n.maxPointRadius,hitCanvasRef:yt});var i;Te("hit"===r.kind?r.hover:null,{type:"activate",inputType:(i=zt.current,"touch"===i?"touch":"pointer")})},[qe,He,Te,We,Vt]),{kbFocusIndexRef:Qt,focusedNavPointRef:Jt,onKeyDown:en,refreshKeyboardFocus:tn}=(nn={clearPointerHover:Gt,storeRef:at,hoverRef:Lt,hoveredNodeRef:Pt,setHoverPoint:$t,customHoverBehavior:Ie,customClickBehavior:Te,scheduleRender:Ke},ol({...nn,extractPoints:rl,toHover:al,navigation:"linear"}));var nn;const rn=(0,wd.useCallback)(e=>{var t,n,r,i,o;t=Ut,n=e,r=U&&!1!==Y,i=Nt.current,o=Yt.current,hl(t,n,void 0),(r||i)&&(r||"touch"!==t.current.pointerType||(Go(o),0))&&(zt.current=e.pointerType,Qt.current=-1,Jt.current=null,qt(e))},[Yt,U,Y,Jt,Qt,qt,Ut]),on=(0,wd.useCallback)(e=>{zt.current=e.pointerType},[]);Ze.current=()=>{if(Xe.current=null,dt.sync(at.current?.scales??null),!Ye.isActive)return;const e=Yt.current,t=at.current;if(!e||!t)return;const n=Ye.now();let r=!1;const i=At.current;let o=!1;if(i){At.current=null;const e={width:He,height:qe};t.applyRotation(i,e),o=!0}const a=null!=t.activeTransition,s=t.advanceTransition(Oe.current?n+1e6:n),l=!Oe.current&&s,c=Tt.current.beforeCompute(t.getLastUpdateResult(),l);let u=!1;if($e.current&&!s){const e={width:He,height:qe},n=t.hasProjection(),r=it&&n?t.getRotation():null;t.computeScene(e);const i=wt.current,o=1!==i.k||0!==i.x||0!==i.y;it&&r?o?(t.setRotation(r),t.applyZoomScale(i.k,e)):t.applyRotation(r,e):o&&t.applyZoomTransform(i,e),tn(),$e.current=!1,u=!0,Wt()}dt.sync(t.scales),Tt.current.afterCompute(c,u,!1);const d=na(O,Be),h=Xt.current;h&&Jo(h,Be,d);const f=A&&!Oe.current&&!!Rt.current,p=t.consumeStylePaintPending();(u||o||p)&&(Nt.current=qo(t.scene),Nt.current||Go(e)),Nt.current&&(a||u||o||p)&&fl({canvas:e,pointer:Ut.current,store:t,margin:We,width:He,height:qe,hitCanvasRef:yt,geometryMoved:a||u||o});const m=Cn(t,n,u,It),g=Zt.current,y=(b={dirtyOrRebuilt:u,transitioning:a,continuous:f,liveEncoding:m.changed,forced:o||p||g},Boolean(b.dirtyOrRebuilt||b.transitioning||b.animationTicked||b.continuous||b.liveEncoding||b.forced));var b;if(Zt.current=!1,C&&bt.current){const e=gt.current;if(e&&t.scales?.projection){const n=ta(e,Be,We,d);n&&(n.clearRect(-We.left,-We.top,Be[0],Be[1]),n.save(),n.beginPath(),n.rect(0,0,He,qe),n.clip(),cs(n,{tileURL:C,projection:t.scales.projection,width:He,height:qe,tileCache:bt.current,maxDevicePixelRatio:O,onTileLoad:()=>Ke()}),n.restore())}}if(y){const i=ta(e,Be,We,d);if(!i)return;i.clearRect(-We.left,-We.top,Be[0],Be[1]),C||fa(i,{background:F,themeBackground:pt,hasBackgroundGraphics:Boolean(ye),x:-We.left,y:-We.top,width:Be[0],height:Be[1]}),i.save(),i.beginPath(),i.rect(0,0,He,qe),i.clip();const o=t.scene,a=(t.scales,{width:He,height:qe});if(vs({context:i,nodes:o,renderMode:W,pixelRatio:d,paintBuiltIn:e=>{Za(i,e),es(i,e.filter(e=>"line"===e.type),a),ts(i,e.filter(e=>"point"===e.type)),rs(i,e.filter(e=>"glyph"===e.type))}}),f&&Rt.current){const e=Rt.current,t=o.filter(e=>"line"===e.type);if(t.length>0){const o=R||{},a=.3*(o.speedMultiplier??1),s=o.maxPerLine??Gs(),l=o.spawnRate??(qs()?.06:.15),c=o.radius??2,u=o.opacity??.7,d=n/1e3,h=Ct.current>0?Math.min(d-Ct.current,.1):.016;Ct.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth??2);for(let n=0;n<t.length;n++)Ye.random()<l&&e.countForLine(n)<s&&e.spawn(n,Ye.random);e.step(h,a,f,p),i.globalAlpha=u;for(let n=0;n<e.particles.length;n++){const r=e.particles[n];if(!r.active)continue;const a=t[r.lineIndex],s="function"==typeof o.color?o.color(a?.datum??{}):"source"!==o.color&&o.color?o.color:a?.style.stroke||"#fff";i.beginPath(),i.arc(r.x,r.y,c,0,2*Math.PI),i.fillStyle=s,i.fill()}i.globalAlpha=1,r=!0}}i.restore()}(u||a&&!s)&&e.setAttribute("aria-label",ka(t.scene,"Geographic chart"));const v=Pt.current,x=Boolean(v&&("geoarea"===v.type||"point"===v.type)),w=(k=x,S=Et.current,k||S);var k,S;const M=Xt.current;if(M&&w){const e=ta(M,Be,We,d);if(e){if(e.clearRect(-We.left,-We.top,Be[0],Be[1]),v&&"geoarea"===v.type){const t=new Path2D(v.pathData);e.fillStyle="rgba(255, 255, 255, 0.3)",e.fill(t),e.strokeStyle="rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke(t)}if(v&&"point"===v.type){const t=v,n="object"==typeof Y?Y:void 0,r=n?.pointColor||hs(v);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),r?(e.save(),e.globalAlpha=.4,e.fillStyle=r,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=r||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}Et.current=x}const j=ne!==vt.current;j&&(vt.current=ne),(u||j||a&&ne&&ne.length>0)&&(u||j||a&&!s||n-Ot.current>=33)&&(Ft(e=>e+1),Ot.current=n),(l||null!=t.activeTransition||m.pending||r)&&Ke()},vr(ue,at,$e,Ke,Ye.now,_t,Bt),(0,wd.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&C){const e=Vs(n);e&&"mercator"!==e&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${e}". Raster tiles use Web Mercator and will not align with other projections.`)}},[C,n]),(0,wd.useEffect)(()=>{const e=St.current;if(!k||!e)return xt.current&&e&&((0,Cg.select)(e).on(".zoom",null),xt.current=null),void(e&&(0,Cg.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=S||[1,8],r={width:He,height:qe};if(it){let i=wt.current.k;const o=e=>{i=Math.max(t,Math.min(n,e)),wt.current=Rg.zoomIdentity.scale(i);const o=at.current;o&&(o.applyZoomScale(i,r),$e.current=!1,Ke(),o.scales?.projection&&M?.({projection:o.scales.projection,zoom:o.currentZoom}))};xt.current={scaleBy:(e,t)=>o(i*t),transform:(e,t)=>o(t?.k??1)};const a=e=>{e.preventDefault();const t=e.deltaY<0?1.1:1/1.1;o(i*t)},s=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),o(1.5*i))};e.addEventListener("wheel",a,{passive:!1}),e.addEventListener("dblclick",s);const l=.4,c=t=>{if(0!==t.button)return;const n=t.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const r=at.current;if(!r)return;const i=r.getRotation();jt.current={x:t.clientX,y:t.clientY,rotation:[...i]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=jt.current;if(!t)return;const n=e.clientX-t.x,r=e.clientY-t.y,i=[t.rotation[0]+n*l,Math.max(-90,Math.min(90,t.rotation[1]-r*l)),t.rotation[2]];At.current=i,Ke()},d=t=>{if(!jt.current)return;jt.current=null,e.releasePointerCapture(t.pointerId);const n=At.current;if(n){At.current=null;const e=at.current;e&&(e.applyRotation(n,r),Ke())}const i=at.current;i?.scales?.projection&&M?.({projection:i.scales.projection,zoom:i.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",a),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),xt.current=null}}const i=(0,Rg.zoom)().scaleExtent([t,n]).extent([[0,0],[Be[0],Be[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;wt.current=t,kt.current=!0;const n=at.current;n&&(n.applyZoomTransform(t,r),$e.current=!1,Ke())}).on("end",e=>{wt.current=e.transform,kt.current=!1;const t=at.current;t?.scales?.projection&&M?.({projection:t.scales.projection,zoom:t.currentZoom})});return xt.current=i,(0,Cg.select)(e).call(i),()=>{(0,Cg.select)(e).on(".zoom",null)}},[k,S,it,Be,He,qe,We,M,Ke]);const an=U&&!1!==Y,sn=an&&Dt?X?X(Dt):/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)(Ug,{data:Dt}):null,ln=Pa(sn)?/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)(Oa,{contentOwnsChrome:Fa(X),x:Dt.x,y:Dt.y,containerWidth:He,containerHeight:qe,margin:We,className:"stream-frame-tooltip",zIndex:10,children:sn}):null;if(st){const e=ct.scene;/* @__PURE__ */ /* @__PURE__ */
|
|
177
|
+
return(0,ty.jsxs)("div",{ref:Mt,className:"stream-geo-frame"+($?` ${$}`:""),role:"group","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:T?"100%":Be[0],height:z?"100%":Be[1]},children:[
|
|
178
178
|
/* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */(0,
|
|
179
|
+
/* @__PURE__ */(0,ty.jsx)(Sa,{accessibleTable:Ne,scene:e,chartType:"Geographic chart",tableId:Ue,chartTitle:"string"==typeof ve?ve:void 0}),
|
|
180
180
|
/* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */(0,
|
|
181
|
+
/* @__PURE__ */(0,ty.jsx)(ja,{summary:Ee}),
|
|
182
182
|
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */(0,
|
|
183
|
+
/* @__PURE__ */(0,ty.jsxs)("div",{role:"img","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),children:[
|
|
184
184
|
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */(0,
|
|
185
|
+
/* @__PURE__ */(0,ty.jsxs)("svg",{role:"presentation",xmlns:"http://www.w3.org/2000/svg",width:Be[0],height:Be[1],style:{position:"absolute",left:0,top:0},children:[mt?/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:Be[0],height:Be[1],fill:mt}):null,
|
|
186
186
|
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */(0,
|
|
187
|
+
/* @__PURE__ */(0,ty.jsx)("g",{transform:`translate(${We.left},${We.top})`,children:ft}),
|
|
188
188
|
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */(0,
|
|
189
|
+
/* @__PURE__ */(0,ty.jsx)("g",{transform:`translate(${We.left},${We.top})`,children:e.map((e,t)=>xs({node:e,index:t,renderMode:W,fallback:()=>Yo(e,t)}).element)})]}),
|
|
190
190
|
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */(0,
|
|
192
|
-
return(0,
|
|
191
|
+
/* @__PURE__ */(0,ty.jsx)(Eo,{decorative:!0,width:He,height:qe,totalWidth:Be[0],totalHeight:Be[1],margin:We,showAxes:!1,title:ve,description:Pe,legend:xe,legendPosition:we,legendLayout:ke,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:je,legendIsolatedCategories:Ae,foregroundGraphics:fs(ht,ms(ct.customLayoutOverlays,d??null)),annotations:ne,onAnnotationActivate:re,onObservation:ee??J,chartId:te,chartType:"StreamGeoFrame",autoPlaceAnnotations:ie,svgAnnotationRules:oe,pointNodes:ws(e),geoProjection:ct.scales?.projectedPoint})]})]})}/* @__PURE__ */ /* @__PURE__ */
|
|
192
|
+
return(0,ty.jsxs)("div",{ref:Mt,className:"stream-geo-frame"+($?` ${$}`:""),role:"group","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),tabIndex:0,style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:T?"100%":Be[0],height:z?"100%":Be[1],overflow:Z?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:en,children:["production"!==process.env.NODE_ENV&&at.current&&/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)(lp,{store:at.current,diagnostics:Tt.current}),
|
|
193
193
|
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */(0,
|
|
194
|
+
/* @__PURE__ */(0,ty.jsx)(Sa,{accessibleTable:Ne,sceneRevision:at.current?.getUpdateSnapshot().revisions.accessibility,scene:at.current?.scene??[],chartType:"Geographic chart",tableId:Ue,chartTitle:"string"==typeof ve?ve:void 0}),
|
|
195
195
|
/* @__PURE__ */
|
|
196
|
-
/* @__PURE__ */(0,
|
|
196
|
+
/* @__PURE__ */(0,ty.jsx)(ja,{summary:Ee}),
|
|
197
197
|
/* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */(0,
|
|
198
|
+
/* @__PURE__ */(0,ty.jsx)(pa,{active:Qt.current>=0,hoverPoint:Dt}),
|
|
199
199
|
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */(0,
|
|
200
|
+
/* @__PURE__ */(0,ty.jsxs)("div",{role:"img","aria-label":Pe||("string"==typeof ve?ve:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:rn,onPointerLeave:Gt,onPointerDown:an||ze?on:void 0,onClick:ze?Kt:void 0,children:[
|
|
201
201
|
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */(0,
|
|
202
|
+
/* @__PURE__ */(0,ty.jsx)(aa,{size:Be,margin:We,backdropFill:mt??void 0,children:ft}),C&&/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)("canvas",{ref:gt,style:{position:"absolute",left:0,top:0,width:Be[0],height:Be[1],pointerEvents:"none"}}),
|
|
203
203
|
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */(0,
|
|
204
|
+
/* @__PURE__ */(0,ty.jsx)("canvas",{"aria-hidden":"true",ref:Yt,"aria-label":ka(at.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0,width:Be[0],height:Be[1]}}),
|
|
205
205
|
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */(0,
|
|
206
|
+
/* @__PURE__ */(0,ty.jsx)("canvas",{ref:Xt,style:{position:"absolute",left:0,top:0,width:Be[0],height:Be[1],pointerEvents:"none"}}),
|
|
207
207
|
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */(0,
|
|
208
|
+
/* @__PURE__ */(0,ty.jsx)(Eo,{decorative:!0,width:He,height:qe,totalWidth:Be[0],totalHeight:Be[1],margin:We,showAxes:Le,title:ve,description:Pe,legend:xe,legendPosition:we,legendLayout:ke,legendHoverBehavior:Se,legendClickBehavior:Me,legendHighlightedCategory:je,legendIsolatedCategories:Ae,foregroundGraphics:fs(ht,ms(ct.customLayoutOverlays,d??null)),annotations:ne,onAnnotationActivate:re,onObservation:ee??J,chartId:te,chartType:"StreamGeoFrame",autoPlaceAnnotations:ie,svgAnnotationRules:oe,pointNodes:ws(at.current?.scene),geoProjection:ct.scales?.projectedPoint}),ue?.showBadge&&/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)(wr,{isStale:_t,position:ue.badgePosition,state:ue.state,settling:ue.settling}),
|
|
209
209
|
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */(0,
|
|
210
|
+
/* @__PURE__ */(0,ty.jsx)(Na,{active:Qt.current>=0,hoverPoint:Dt,margin:We,size:Be,shape:Jt.current?.shape,width:Jt.current?.w,height:Jt.current?.h,pathData:Jt.current?.pathData}),ln]}),k&&/* @__PURE__ */ /* @__PURE__ */(0,ty.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:We.bottom+8,left:We.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[
|
|
211
211
|
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */(0,
|
|
212
|
+
/* @__PURE__ */(0,ty.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=St.current,n=xt.current;t&&n?.scaleBy&&n.scaleBy((0,Cg.select)(t),1.5)},style:Zg,children:"+"}),
|
|
213
213
|
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */(0,
|
|
215
|
-
return(0,
|
|
214
|
+
/* @__PURE__ */(0,ty.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=St.current,n=xt.current;t&&n?.scaleBy&&n.scaleBy((0,Cg.select)(t),1/1.5)},style:Zg,children:"−"})]}),L&&/* @__PURE__ */ /* @__PURE__ */(0,ty.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:We.bottom+2,right:We.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:L})]})})),"StreamGeoFrame"),ry=require("react"),iy=require("react"),oy=require("./semiotic-client-cjs-shared.min.js"),ay=require("./semiotic-client-cjs-shared.min.js"),sy=require("./semiotic-client-cjs-shared.min.js"),ly=require("./semiotic-client-cjs-shared.min.js"),cy=require("react"),uy=require("react/jsx-runtime"),[dy,hy]=/* @__PURE__ */yl(e=>({theme:pr(Ep),setTheme(t){e(e=>({theme:yr(e.theme,t)}))}})),fy={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1},py={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}},my={top:10,bottom:10,left:10,right:10},gy=require("react"),yy=require("react"),by=(/* @__PURE__ */ /* @__PURE__ */require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("./semiotic-client-cjs-shared.min.js"),require("react/jsx-runtime"),(0,yy.createContext)(!1)),vy=/* @__PURE__ */ /* @__PURE__ */(0,yy.createContext)(null),xy="undefined"==typeof window?yy.useEffect:yy.useLayoutEffect,wy=[],ky=require("react/jsx-runtime"),Sy=require("react"),My=require("react/jsx-runtime"),jy=class extends Sy.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:/* @__PURE__ */ /* @__PURE__ */(0,My.jsx)(sc,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},Ay=require("react/jsx-runtime"),Ry={display:"flex",alignItems:"stretch",flexDirection:"column",textAlign:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Cy={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2},Ly=require("react"),Ny=require("./semiotic-client-cjs-shared.min.js"),Py=require("d3-scale"),Ey=require("react"),Iy=require("topojson-client"),Ty=/* @__PURE__ */new Map,zy="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.",Dy=require("react/jsx-runtime"),$y=/* @__PURE__ */pl(function(e){const t=Kl(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}),n=Ul(),{areas:r,valueAccessor:i,styleRules:o,colorScheme:a,projection:s="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:g,tooltip:y,areaOpacity:b=1,annotations:v,legendInteraction:x,legendPosition:w,margin:k,className:S,selection:M,linkedHover:j,onObservation:A,onClick:R,chartId:C,loading:L,loadingContent:N,emptyContent:P,frameProps:E={},stroke:I,strokeWidth:T,opacity:z}=e,D=u??!!p,$=yc(r),F=(0,ry.useMemo)(()=>$?Sn($):$,[$]),O=(0,ry.useMemo)(()=>"function"==typeof i?i:e=>e?.properties?.[i]??e?.[i],[i]),_=a??n??"blues",B=(0,ry.useMemo)(()=>{if(!F)return(0,Py.scaleSequential)(Dt(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of F){const r=O(n);null!=r&&isFinite(r)&&(r<e&&(e=r),r>t&&(t=r))}const n=Dt(_);return(0,Py.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[F,O,_]),W=(0,ry.useMemo)(()=>{const e=B.domain();return[e[0]??0,e[1]??1]},[B]),H=Gl(x,O,W),{activeSelectionHook:q,hoverSelectionHook:G,customHoverBehavior:V,customClickBehavior:U}=Xl({selection:M,linkedHover:j,onObservation:A,onClick:R,chartType:"ChoroplethMap",chartId:C,mobileInteraction:t.mobileInteraction}),Y=fc(M),X=G||H.legendSelectionHook||q,Z=(0,ry.useMemo)(()=>{const e=Jl(ac(e=>{const t=O(e);return{fill:null!=t&&isFinite(t)?B(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}},o,e=>({value:O(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:T,opacity:z});return X?gl(e,X,Y,xc):e},[O,B,X,Y,b,I,T,z,o]),K=(0,ry.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=O(e);/* @__PURE__ */ /* @__PURE__ */
|
|
215
|
+
return(0,Dy.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[
|
|
216
216
|
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */(0,
|
|
218
|
-
return(0,
|
|
219
|
-
return(0,
|
|
217
|
+
/* @__PURE__ */(0,Dy.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&/* @__PURE__ */ /* @__PURE__ */(0,Dy.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):String(r??""))})]});var r},[O]),Q=Ll(t),J=(0,ry.useMemo)(()=>{if(!1!==t.showLegend)return{gradient:{colorFn:e=>B(e),domain:W,label:"string"==typeof i?i:"value"}}},[B,t.showLegend,i,W]),{legend:ee,margin:te,legendPosition:ne,legendMarginReserved:re}=Bl({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:w,userMargin:k,defaults:Q,additionalLegend:J,chartWidth:t.width,chartHeight:t.height,legendLayout:E.legendLayout,frameLegend:E,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),ie=dc(L,t.width,t.height,N,e)||(F?null:dc(!0,t.width,t.height,N,e)),oe=ie?null:uc(F,t.width,t.height,P,e);if(Array.isArray(F)&&F.length>0){const e=F[0];if(!e||"object"!=typeof e||!e.geometry)/* @__PURE__ */ /* @__PURE__ */
|
|
218
|
+
return(0,Dy.jsx)(sc,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const ae={projection:s,areas:F,areaStyle:Z,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:te,enableHover:t.enableHover,...ee&&{legend:ee,legendPosition:ne},...re&&{__legendMarginReservedFor:ee},legendHoverBehavior:H.onLegendHover,legendClickBehavior:H.onLegendClick,legendHighlightedCategory:H.highlightedCategory,legendIsolatedCategories:"isolate"===x?H.isolatedCategories:void 0,tooltipContent:!1===y?()=>null:!0===y?K:Os(y)||K,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...D&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...g&&{tileCacheSize:g},...vc({linkedHover:j,selection:M,onObservation:A,onClick:R,mobileInteraction:t.mobileInteraction,customHoverBehavior:V,customClickBehavior:U,linkedHoverInClickPredicate:!1}),...v&&v.length>0&&{annotations:v},...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},...S&&{className:S},...null!=e.animate&&{animate:e.animate},...E};return ie||oe||/* @__PURE__ */ /* @__PURE__ */(0,Dy.jsx)(cc,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:/* @__PURE__ */ /* @__PURE__ */(0,Dy.jsx)(ny,{...ae})})},"ChoroplethMap"),Fy=require("react"),Oy=require("react"),_y=require("./semiotic-client-cjs-shared.min.js"),By=require("react"),Wy={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},Hy=require("react/jsx-runtime"),qy=[3,30],Gy=[1,4],Vy=/* @__PURE__ */pl(/* @__PURE__ */ /* @__PURE__ */(0,Fy.forwardRef)(function(e,t){const n=(0,Fy.useRef)(null);kc(t,{variant:"geo-points",frameRef:n});const r=Kl(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:o="lon",yAccessor:a="lat",sizeBy:s,sizeRange:l,colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:g,onZoom:y,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:S=Wy,tooltip:M,annotations:j,margin:A,className:R,selection:C,linkedHover:L,onObservation:N,onClick:P,chartId:E,loading:I,loadingContent:T,emptyContent:z,legendInteraction:D,legendPosition:$,frameProps:F={},stroke:O,strokeWidth:_,opacity:B}=e,W=l??("sparkline"===r.mode?Gy:qy),H="sparkline"===r.mode?1.5:6,q=m??!!v,G=yc(k),V=wc({responsive:e,data:i??np,rawData:i,colorBy:c,colorScheme:d,legendInteraction:D,legendPosition:$,frameLegend:F,selection:C,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:N,onClick:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:E,showLegend:r.showLegend,userMargin:A,marginDefaults:Ll(r),loading:I,loadingContent:T,emptyContent:z,width:r.width,height:r.height,hasTitle:!!r.title}),U=V.data,Y=(0,Fy.useMemo)(()=>{if(!s)return;const e="function"==typeof s?s:e=>e?.[s],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?cn(t):void 0},[U,s]),X=(0,Fy.useMemo)(()=>{const e=Jl(ac(e=>({fill:c?Ot(e,c,V.colorScale):Nf,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:s?Ht(e,s,W,Y):H}),u,tc(c,s)),{stroke:O,strokeWidth:_,opacity:B});return V.effectiveSelectionHook?gl(e,V.effectiveSelectionHook,V.resolvedSelection):e},[c,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,s,W,Y,H,O,_,B,u]),Z=(0,Fy.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof s?s:null,r=("function"==typeof s?s:e=>e[s])(e),i=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):String(e??""),o="string"==typeof c?c:null,a=o?e?.[o]:null;/* @__PURE__ */ /* @__PURE__ */
|
|
219
|
+
return(0,Hy.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&/* @__PURE__ */ /* @__PURE__ */(0,Hy.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&/* @__PURE__ */ /* @__PURE__ */(0,Hy.jsxs)("div",{children:[
|
|
220
220
|
/* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */(0,
|
|
221
|
+
/* @__PURE__ */(0,Hy.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),i(r)]}),o&&null!=a&&/* @__PURE__ */ /* @__PURE__ */(0,Hy.jsxs)("div",{children:[
|
|
222
222
|
/* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */(0,
|
|
223
|
+
/* @__PURE__ */(0,Hy.jsxs)("span",{style:{opacity:.7},children:[o,": "]}),String(a)]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>/* @__PURE__ */ /* @__PURE__ */(0,Hy.jsxs)("div",{children:[
|
|
224
224
|
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */(0,
|
|
226
|
-
return(0,
|
|
227
|
-
return(0,
|
|
228
|
-
return(0,
|
|
225
|
+
/* @__PURE__ */(0,Hy.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),i(t)]},e))]})},[s,c]);if(V.earlyReturn)return V.earlyReturn;hc("ProportionalSymbolMap",U,"xAccessor",o),hc("ProportionalSymbolMap",U,"yAccessor",a);const K={projection:h,...null!=i&&{points:U},xAccessor:o,yAccessor:a,pointStyle:X,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...G&&{areas:G,areaStyle:S},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...q&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:V.margin,enableHover:r.enableHover,tooltipContent:!1===M?()=>null:Os(M)||Z,...V.legendBehaviorProps,...vc({linkedHover:L,selection:C,onObservation:N,onClick:P,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...j&&j.length>0&&{annotations:j},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...r.title&&{title:r.title},...r.description&&{description:r.description},...r.summary&&{summary:r.summary},...void 0!==r.accessibleTable&&{accessibleTable:r.accessibleTable},...R&&{className:R},...null!=e.animate&&{animate:e.animate},...F};/* @__PURE__ */ /* @__PURE__ */
|
|
226
|
+
return(0,Hy.jsx)(cc,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:/* @__PURE__ */ /* @__PURE__ */(0,Hy.jsx)(ny,{ref:n,...K})})}),"ProportionalSymbolMap"),Uy=require("react"),Yy=require("./semiotic-client-cjs-shared.min.js"),Xy=require("./semiotic-client-cjs-shared.min.js"),Zy=require("react/jsx-runtime"),Ky="__semiotic_x",Qy="__semiotic_y",Jy=/* @__PURE__ */pl(/* @__PURE__ */ /* @__PURE__ */(0,Uy.forwardRef)(function(e,t){const n=Kl(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:r,nodes:i,nodeIdAccessor:o="id",xAccessor:a="lon",yAccessor:s="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:g,tileAttribution:y,tileCacheSize:b,lineType:v="geo",flowStyle:x="basic",areas:w,areaStyle:k=Wy,edgeColorBy:S,edgeOpacity:M=.6,edgeWidthRange:j=[1,8],pointRadius:A,edgeLinecap:R="round",colorScheme:C,styleRules:L,showParticles:N,particleStyle:P,tooltip:E,annotations:I,margin:T,className:z,selection:D,linkedHover:$,onObservation:F,onClick:O,chartId:_,loading:B,loadingContent:W,emptyContent:H,frameProps:q={},legendInteraction:G,legendPosition:V,stroke:U,strokeWidth:Y,opacity:X,lineIdAccessor:Z}=e,K=h??!!g,Q=yc(w),J=(0,Uy.useMemo)(()=>Sn(i),[i]),ee=wc({responsive:e,data:r??np,rawData:r,colorBy:S,colorScheme:C,legendInteraction:G,legendPosition:V,frameLegend:q,selection:D,linkedHover:$,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:F,onClick:O,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:_,showLegend:n.showLegend,userMargin:T,marginDefaults:Ll(n),loading:B,loadingContent:W,emptyContent:H,width:n.width,height:n.height,hasTitle:!!n.title}),te=ee.data,ne=ml($),re=(0,Yy.useLinkedHover)({name:ne?.name||"hover",fields:ne?.fields||[]}),ie=(0,Xy.useObservationSelector)(e=>e.pushObservation),oe=(0,Uy.useMemo)(()=>{const e=/* @__PURE__ */new Map;for(const t of J)e.set(String(t[o]),t);return e},[J,o]),ae=(0,Uy.useRef)(null),se=(0,Uy.useRef)(oe);se.current=oe;const le=(0,Uy.useRef)(a);le.current=a;const ce=(0,Uy.useRef)(s);ce.current=s;const ue=(0,Uy.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=se.current,n=t.get(String(e.source)),r=t.get(String(e.target));if(!n||!r)return null;const i="function"==typeof le.current?le.current:e=>e[le.current],o="function"==typeof ce.current?ce.current:e=>e[ce.current];return{...e,coordinates:[{[Ky]:i(n),[Qy]:o(n)},{[Ky]:i(r),[Qy]:o(r)}]}},[]);kc(t,{variant:"geo-lines",frameRef:ae,overrides:{push:e=>{const t=ue(e);t&&ae.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&ae.current?.pushManyLines(t)}}});const de=(0,Uy.useMemo)(()=>{const e=/* @__PURE__ */new Map;for(const t of te)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},[te]),he=(0,Uy.useCallback)(e=>{if($)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=String(t[o]),n=de.get(e);n&&re.onHover(n)}else re.onHover(t)}else re.onHover(null);if(F||ie){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:_};if(e){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]);const r={...t,type:"hover",datum:n||{},x:e.x??0,y:e.y??0};F&&F(r),ie&&ie(r)}else{const e={...t,type:"hover-end"};F&&F(e),ie&&ie(e)}}},[$,re,o,de,F,_,ie]),fe=ee.customClickBehavior,pe=(0,Uy.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a],t="function"==typeof s?s:e=>e[s];return te.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=oe.get(String(n.source)),i=oe.get(String(n.target));return r&&i?{...n,coordinates:[{[Ky]:e(r),[Qy]:t(r)},{[Ky]:e(i),[Qy]:t(i)}]}:null}).filter(Boolean)},[te,oe,a,s]),me=(0,Uy.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&Ky in t?t[Ky]:e(t)},[a]),ge=(0,Uy.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Qy in t?t[Qy]:e(t)},[s]),ye=(0,Uy.useMemo)(()=>{const e=te.filter(e=>e&&"object"==typeof e).map(e=>Number(e[l]??0)).filter(e=>Number.isFinite(e));if(0!==e.length)return cn(e)},[te,l]),be=(0,Uy.useMemo)(()=>jc({valueAccessor:l,valueDomain:ye,edgeWidthRange:j,resolveStroke:e=>S?Ot(e,S,ee.colorScale):Nf,edgeOpacity:M,edgeLinecap:R,styleRules:L}),[l,ye,j,S,ee.colorScale,M,R,L]),ve=(0,Uy.useMemo)(()=>{const e=Jl(be,{stroke:U,strokeWidth:Y,opacity:X});if(!ee.effectiveSelectionHook)return e;const t={...ee.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return gl(e,ee.effectiveSelectionHook,{...ee.resolvedSelection||{},unselectedStyle:t})},[be,ee.effectiveSelectionHook,ee.resolvedSelection,U,Y,X]),xe=A??("sparkline"===n.mode?1.5:5),we=(0,Uy.useMemo)(()=>Jl(()=>({fill:"#333",r:xe,fillOpacity:.8}),{stroke:U,strokeWidth:Y,opacity:X}),[xe,U,Y,X]),ke=(0,Uy.useMemo)(()=>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)/* @__PURE__ */ /* @__PURE__ */
|
|
227
|
+
return(0,Zy.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:/* @__PURE__ */ /* @__PURE__ */(0,Zy.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];/* @__PURE__ */ /* @__PURE__ */
|
|
228
|
+
return(0,Zy.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[
|
|
229
229
|
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */(0,
|
|
231
|
-
return(0,
|
|
232
|
-
return(0,
|
|
230
|
+
/* @__PURE__ */(0,Zy.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&/* @__PURE__ */ /* @__PURE__ */(0,Zy.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[o];return null!=t?/* @__PURE__ */ /* @__PURE__ */(0,Zy.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:/* @__PURE__ */ /* @__PURE__ */(0,Zy.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,o]);if(ee.earlyReturn)return ee.earlyReturn;const Se={projection:c,...null!=r&&{lines:pe},points:J,xAccessor:me,yAccessor:ge,lineDataAccessor:"coordinates",...null!=Z&&{lineIdAccessor:Z},lineType:v,flowStyle:x,lineStyle:ve,pointStyle:we,...Q&&{areas:Q,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...K&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...N&&{showParticles:N},...P&&{particleStyle:P},...g&&{tileURL:g},...y&&{tileAttribution:y},...b&&{tileCacheSize:b},size:[n.width,n.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ee.margin,enableHover:n.enableHover,tooltipContent:!1===E?()=>null:Os(E)||ke,...ee.legendBehaviorProps,...vc({linkedHover:$,selection:D,onObservation:F,onClick:O,mobileInteraction:ee.mobileInteraction,customHoverBehavior:he,customClickBehavior:fe,linkedHoverInClickPredicate:!1}),...I&&I.length>0&&{annotations:I},...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},...q};/* @__PURE__ */ /* @__PURE__ */
|
|
231
|
+
return(0,Zy.jsx)(cc,{componentName:"FlowMap",width:n.width,height:n.height,children:/* @__PURE__ */ /* @__PURE__ */(0,Zy.jsx)(ny,{ref:ae,...Se})})}),"FlowMap"),eb=require("react"),tb=require("react/jsx-runtime"),nb=require("react/jsx-runtime"),rb=/* @__PURE__ */pl(/* @__PURE__ */ /* @__PURE__ */(0,eb.forwardRef)(function(e,t){const n=Kl(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:r,lines:i,xAccessor:o="lon",yAccessor:a="lat",nodeIdAccessor:s="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:g,onZoom:y,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:S,styleRules:M,colorScheme:j,pointRadius:A,tooltip:R,showRings:C,showRingLabels:L,ringStyle:N,showNorth:P,costLabel:E,cartogramLayout:I,annotations:T,margin:z,className:D,selection:$,linkedHover:F,onObservation:O,onClick:_,chartId:B,loading:W,loadingContent:H,emptyContent:q,legendPosition:G,frameProps:V={},stroke:U,strokeWidth:Y,opacity:X}=e,Z="sparkline"===n.mode,K=I??(Z?"strip":"radial"),Q=A??(Z?1.5:5),J=C??!0,ee=L??("strip"!==K&&!n.compactMode),te=P??("strip"!==K&&!Z),ne=m??!!v,re=(0,eb.useMemo)(()=>Sn(r),[r]),ie=wc({responsive:e,data:re,rawData:r,colorBy:S,colorScheme:j,legendInteraction:void 0,legendPosition:G,frameLegend:V,selection:$,linkedHover:F,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:O,onClick:_,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:B,showLegend:n.showLegend,userMargin:z,marginDefaults:Ll(n),loading:W,loadingContent:H,emptyContent:q,width:n.width,height:n.height,hasTitle:!!n.title}),oe=(0,eb.useMemo)(()=>{const e=Jl(ac(e=>{const t=e?.[s],n=null!=t&&String(t)===String(l);return{fill:S?Ot(e,S,ie.colorScale):Nf,fillOpacity:n?1:.8,stroke:n?"var(--semiotic-text, #222)":"#fff",strokeWidth:n?1.25:1,r:n?1.35*Q:Q}},M,tc(S)),{stroke:U,strokeWidth:Y,opacity:X});return ie.effectiveSelectionHook?gl(e,ie.effectiveSelectionHook,ie.resolvedSelection):e},[S,ie.colorScale,ie.effectiveSelectionHook,ie.resolvedSelection,Q,U,Y,X,M,l,s]),ae=(0,eb.useMemo)(()=>({center:l,centerAccessor:s,costAccessor:c,strength:u,lineMode:d,layout:K}),[l,s,c,u,d,K]),se=(0,eb.useMemo)(()=>{if(!i)return;const e="function"==typeof o?o:e=>e[o],t="function"==typeof a?a:e=>e[a],n=/* @__PURE__ */new Map;for(const e of re)n.set(String(e[s]),e);return i.map(r=>{if(r.coordinates)return r;const i=n.get(String(r.source)),s=n.get(String(r.target));return i&&s?{...r,coordinates:[{[o]:e(i),[a]:t(i)},{[o]:e(s),[a]:t(s)}]}:null}).filter(Boolean)},[i,re,o,a,s]),le=(0,eb.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e),n=e[s]||e.name||e.id||"Point";/* @__PURE__ */ /* @__PURE__ */
|
|
232
|
+
return(0,nb.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[
|
|
233
233
|
/* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */(0,
|
|
235
|
-
return(0,
|
|
236
|
-
return(0,
|
|
234
|
+
/* @__PURE__ */(0,nb.jsx)("div",{style:{fontWeight:600},children:n}),null!=t&&/* @__PURE__ */ /* @__PURE__ */(0,nb.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,s]),ce=(0,eb.useRef)(null);kc(t,{variant:"geo-points",frameRef:ce});const[ue,de]=(0,eb.useState)(null),he=(0,eb.useCallback)(()=>{const e=ce.current?.getCartogramLayout?.();e&&de(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"})},[]);(0,eb.useEffect)(()=>{const e=requestAnimationFrame(he);return()=>cancelAnimationFrame(e)},[he,u,l,n.width,n.height,re,K]);const fe=(0,eb.useMemo)(()=>{if(!J||!ue)return[];const{maxCost:e}=ue;if(e<=0)return[];if(Array.isArray(J))return J.filter(t=>t>0&&t<=e);const t="strip"===ue.layout?3:5,n="number"==typeof J?J:Math.min(t,Math.max(2,Math.ceil(e/5))),r=e/n,i=[];for(let e=1;e<=n;e++)i.push(Math.round(r*e*10)/10);return i},[J,ue]),pe=(0,eb.useMemo)(()=>{if(!ue)return V.foregroundGraphics||null;const e=/* @__PURE__ */ /* @__PURE__ */(0,nb.jsx)(Ac,{bottomMargin:ie.margin.bottom,costLabel:E,layout:ue,ringStyle:N,ringValues:fe,showNorth:te,showRingLabels:ee,showRings:J}),t=V.foregroundGraphics;return"function"==typeof t?n=>/* @__PURE__ */ /* @__PURE__ */(0,nb.jsxs)(nb.Fragment,{children:[e,t(n)]}):/* @__PURE__ */ /* @__PURE__ */(0,nb.jsxs)(nb.Fragment,{children:[e,t]})},[ue,fe,J,ee,te,E,N,ie.margin.bottom,V.foregroundGraphics]);if(ie.earlyReturn)return ie.earlyReturn;hc("DistanceCartogram",re,"xAccessor",o),hc("DistanceCartogram",re,"yAccessor",a);const me={projection:h,...null!=r&&{points:re},...se&&{lines:se,lineDataAccessor:"coordinates"},xAccessor:o,yAccessor:a,pointIdAccessor:s,pointStyle:oe,projectionTransform:ae,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...ne&&{zoomable:!0},...g&&{zoomExtent:g},...y&&{onZoom:y},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ie.margin,enableHover:n.enableHover,tooltipContent:!1===R?()=>null:Os(R)||le,...ie.legendBehaviorProps,...vc({linkedHover:F,selection:$,onObservation:O,onClick:_,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior,linkedHoverInClickPredicate:!1}),...T&&T.length>0&&{annotations:T},...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},...D&&{className:D},...null!=e.animate&&{animate:e.animate},...V,foregroundGraphics:pe};/* @__PURE__ */ /* @__PURE__ */
|
|
235
|
+
return(0,nb.jsx)(cc,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:/* @__PURE__ */ /* @__PURE__ */(0,nb.jsx)(ny,{ref:ce,...me})})}),"DistanceCartogram"),ib=require("react"),ob=require("react"),ab=require("react/jsx-runtime"),sb=/* @__PURE__ */pl(/* @__PURE__ */ /* @__PURE__ */(0,ib.forwardRef)(function(e,t){const{points:n,areas:r,lines:i,layout:o,layoutConfig:a,onLayoutError:s,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:g,selection:y,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:S,emptyContent:M,className:j,frameProps:A={}}=e,{frameRef:R,resolved:C,normalizedMargin:L}=Cc({responsive:e,imperativeRef:t,imperativeVariant:"geo-points",margin:g,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),N=(0,ib.useMemo)(()=>Sn(n),[n]),P=(0,ib.useMemo)(()=>Sn(r),[r]),E=(0,ib.useMemo)(()=>Sn(i),[i]),I=(0,ib.useMemo)(()=>[...N,...E,...P],[N,E,P]),T=wc({responsive:e,data:I,rawData:void 0!==n||void 0!==i||void 0!==r?I:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:y,linkedHover:b,fallbackFields:"string"==typeof h?[h]:[],unwrapData:!1,onObservation:v,onClick:x,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:w,showLegend:!1,userMargin:L,marginDefaults:C.marginDefaults,loading:k,loadingContent:S,emptyContent:M,width:C.width,height:C.height,hasTitle:!!C.title}),z=T.effectiveSelectionHook,D=(0,ib.useMemo)(()=>z?.isActive?{isActive:!0,predicate:z.predicate}:null,[z?.isActive,z?.predicate]);if(T.earlyReturn)return T.earlyReturn;const{width:$,height:F,enableHover:O,title:_,description:B,summary:W,accessibleTable:H}=C,q=Os(p),G={projection:l,...null!=n&&{points:N},...null!=r&&{areas:P},...null!=i&&{lines:E},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:o,layoutConfig:a,onLayoutError:s,layoutSelection:D,colorBy:h,colorScheme:f,size:[$,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:T.margin,enableHover:O,...bc({title:_,description:B,summary:W,accessibleTable:H,className:j,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...vc({linkedHover:b,selection:y,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:T.mobileInteraction,customHoverBehavior:T.customHoverBehavior,customClickBehavior:T.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...A};/* @__PURE__ */ /* @__PURE__ */
|
|
236
|
+
return(0,ab.jsx)(cc,{componentName:"GeoCustomChart",width:$,height:F,children:/* @__PURE__ */ /* @__PURE__ */(0,ab.jsx)(ny,{ref:R,...G})})}),"GeoCustomChart"),lb={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},cb=8,ub=require("./semiotic-custom-layout-selection-cjs-shared.min.js"),db=require("react/jsx-runtime"),hb=.72,fb=1.8,pb=e=>{const t=e.config,n=t.source??"auto",r="areas"===n||"auto"===n&&e.areas.length>0,i=(r?Bc(e):e.points.map((e,t)=>({datum:e,x:t,y:t}))).filter((e,n)=>!t.filter||t.filter(e.datum,n)),o=Hc(i.map(e=>e.datum),t),a=r?i:Wc({...e,points:i.map(e=>e.datum)}),s=o??Dc(a,{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 l=Tc(s.map(e=>e.row)),c=Tc(s.map(e=>e.column)),u=Math.max(1,Math.round(l[1]-l[0])+1),d=Math.max(1,Math.round(c[1]-c[0])+1),h=Math.max(0,t.layoutPadding??8),f=Math.max(1,e.dimensions.width-2*h),p=Math.max(1,e.dimensions.height-2*h),m=f/d,g=p/u,y=m*d,b=g*u,v=(e.dimensions.width-y)/2,x=(e.dimensions.height-b)/2,w=Xi(t.cellPadding??.12,0,.8),k=Math.max(1,.5*Math.min(m,g)*(1-w)),S=t.sizeAccessor?s.map(e=>Number($c(e.datum,t.sizeAccessor))):[],M=t.sizeDomain??Tc(S),j=t.sizeRange??[.36,1],A=Xi(Math.min(j[0],j[1]),.05,1),R=Xi(Math.max(j[0],j[1]),A,1),C=s.map((n,r)=>{const i={...n.datum,gridRow:n.row,gridColumn:n.column},o=String($c(i,t.idAccessor,["id","key","name"])??`grid-${r}`),a=String($c(i,t.labelAccessor,["abbr","code","label","name","id"])??o),s=Math.max(1,t.maxLabelLength??4),u=a.length>s?a.slice(0,s):a,d=$c(i,t.categoryAccessor),h=null==d?void 0:String(d),f=$c(i,t.fillAccessor),p=null!=f?String(f):h?e.resolveColor(h):e.theme.categorical[0]??"#4f86c6",y=t.sizeAccessor?Number($c(i,t.sizeAccessor)):NaN,b=t.sizeAccessor&&Number.isFinite(y)?Math.sqrt(Xi(zc(y,M),0,1)):1,w=k*(A+b*(R-A)),S="function"==typeof t.markStyle?t.markStyle(i,r):t.markStyle;return{datum:i,id:o,label:u,category:h,row:n.row,column:n.column,x:v+(n.column-c[0]+.5)*m,y:x+(n.row-l[0]+.5)*g,radius:w,style:{fill:p,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...S}}}),L=t.shape??"circle";return{nodes:C.map(e=>{return"circle"===L?{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"===L?_c(e.x,e.y,e.radius):(t=e.x,n=e.y,r=e.radius,Oc([[t-r,n-r],[t+r,n-r],[t+r,n+r],[t-r,n+r]])),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===L?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,n,r}),overlays:!1===t.showLabels?null:/* @__PURE__ */ /* @__PURE__ */(0,db.jsx)(qc,{marks:C,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??Xi(.23*Math.min(m,g),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}}},mb=require("react/jsx-runtime"),gb=10,yb=25e3,bb=/* @__PURE__ */new WeakMap,vb=/* @__PURE__ */new WeakMap,xb=/* @__PURE__ */new WeakMap,wb=1,kb=e=>{const t=lu(e),n=e.config,r=n.shape??"circle",i=Math.max(.5,Gc(n.dotRadius)??t.cellSize*Xi(n.radiusRatio??.24,.05,.5)),o=n.gridOrigin?.[0]??0,a=n.gridOrigin?.[1]??0;return{nodes:t.dots.map((s,l)=>{const c=o+(s.gridColumn+.5)*t.cellSize,u=a+(s.gridRow+.5)*t.cellSize,d=Vc(s,n.categoryAccessor),h=Vc(s,n.fillAccessor),f={fill:null!=h?String(h):null!=d?e.resolveColor(String(d)):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof n.markStyle?n.markStyle(s,l):n.markStyle},p=`dot-${s.gridRow}-${s.gridColumn}`;return"circle"===r?{type:"point",x:c,y:u,r:i,style:f,datum:s,interactive:!1,pointId:p,_transitionKey:p}:{type:"geoarea",pathData:"hexagon"===r?du(c,u,i):uu(c,u,i),centroid:[c,u],bounds:[[c-i,u-i],[c+i,u+i]],screenArea:"hexagon"===r?3*Math.sqrt(3)*i*i/2:(2*i)**2,style:f,datum:s,group:s.featureId,interactive:!1}}),overlays:n.showOutline?/* @__PURE__ */ /* @__PURE__ */(0,mb.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,r)=>{const i=e.scales.geoPath(t);return i?/* @__PURE__ */ /* @__PURE__ */(0,mb.jsx)("path",{d:i,fill:"none",stroke:n.outlineStyle?.stroke??"currentColor",strokeOpacity:n.outlineStyle?.opacity??n.outlineStyle?.fillOpacity??.22,strokeWidth:n.outlineStyle?.strokeWidth??.7,strokeDasharray:n.outlineStyle?.strokeDasharray,strokeLinecap:n.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},Yc(t,r)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};
|