semiotic 3.8.1 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +3 -1
- package/README.md +53 -52
- package/ai/behaviorContracts.cjs +9 -0
- package/ai/dist/mcp-server.js +142 -13
- package/ai/schema.json +616 -42
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +5 -2
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
- package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
- package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
- package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
- package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
- package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
- package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
- package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
- package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
- package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
- package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
- package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
- package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
- package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
- package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
- package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
- package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
- package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
- package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
- package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
- package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
- package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
- package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
- package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
- package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
- package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
- package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
- package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
- package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
- package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
- package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
- package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
- package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
- package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
- package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
- package/dist/components/server/staticSVGChrome.d.ts +3 -2
- package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
- package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
- package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +4 -4
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
- package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
package/dist/geo.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of o(t))s.call(e,l)||l===i||n(e,l,{get:()=>t[l],enumerable:!(a=r(t,l))||a.enumerable});return e},l=(e,r,o)=>(o=null!=e?t(i(e)):{},a(!r&&e&&e.__esModule?o:n(o,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ChoroplethMap:()=>Is,DEFAULT_HIT_RADIUS:()=>Js,DistanceCartogram:()=>Us,FlowMap:()=>qs,GeoCustomChart:()=>Qs,ProportionalSymbolMap:()=>Bs,StreamGeoFrame:()=>ii,composeStyleRules:()=>os,geoAreaHitTarget:()=>na,geoHitTarget:()=>ta,glyphExtent:()=>_e,glyphPlacement:()=>Be,hatchFillId:()=>mn,hatchPatternDef:()=>gn,hitTargetPoint:()=>ea,isHatchFill:()=>fn,makeNodeRuleContext:()=>Ji,makeRuleValueResolver:()=>Ki,matchesThreshold:()=>ts,mergeData:()=>ra,resolveReferenceGeography:()=>Cs,resolveResponsiveRules:()=>Ni,resolveStyleRules:()=>rs,resolveSvgFill:()=>bn,responsiveRuleMatches:()=>Oi,ruleMatches:()=>ns}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),d=require("d3-geo"),h=require("d3-quadtree"),f=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=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&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}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:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw 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=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const i=(r+o)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}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=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=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}};function p(e,t,n){return e+(t-e)*n}function m(e,t,n){if(1>=n)return 1;const r=n-1;return function(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)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function y(e,t,n){const r=e.duration??500,o=n-t;return r>o?1-o/r:0}function g(e,t,n,r){let o=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,o=!0),e._pulseColor!==n&&(e._pulseColor=n,o=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,o=!0),o):(0!==e._pulseIntensity&&(e._pulseIntensity=0,o=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,o=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,o=!0),o)}var b=require("d3-scale");function v(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function x(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return x(e,n,r)}if(e>=1){const[e,r,o]=t[n];return x(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[s,a,l]=t[o],[c,u,d]=t[o+1];return x(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],j=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),S=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),M=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),A=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),R=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),L=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),P=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),I=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),D=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),T=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),z=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),O={blues:j,reds:S,greens:M,viridis:L,oranges:C,purples:A,greys:R,plasma:P,inferno:I,magma:D,cividis:T,turbo:z};function N(e){return e&&O[e]||j}w(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),w(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),w(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),w(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),w(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var E={category10:k,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...O},B=k,_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],W=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"]);function H(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||W.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):B[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%B.length]}function F(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 $(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>F(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,b.scaleOrdinal)().domain(r).range(n).unknown("#999");const i=E[n]||E.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:B;return(0,b.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function q(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,s]=r,[a,l]=n;if(s===i)return(a+l)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function G(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&F(n,e)||"#4e79a7":t=>{if(n){const e=F(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function V(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(V))}function U(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Z=require("d3-geo"),Y={mercator:Z.geoMercator,equalEarth:Z.geoEqualEarth,albersUsa:Z.geoAlbersUsa,orthographic:Z.geoOrthographic,naturalEarth:Z.geoNaturalEarth1,equirectangular:Z.geoEquirectangular};function X(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Q(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function K(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function J(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let o=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>o.length||r.push(o),o=[i]):o.push(i)}return 2>o.length||r.push(o),r}function ee(e,t,n=24){const r=t[0]-e[0],o=t[1]-e[1],i=Math.sqrt(r*r+o*o);if(0===i)return[e,t];const s=-o/i,a=r/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let r=0;n>=r;r++){const o=r/n,i=1-o;d.push([i*i*e[0]+2*i*o*c+o*o*t[0],i*i*e[1]+2*i*o*u+o*o*t[1]])}return d}function te(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const o=e[t];let i,s;0===t?(i=e[1][0]-o[0],s=e[1][1]-o[1]):t===e.length-1?(i=o[0]-e[t-1][0],s=o[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;r.push([o[0]+s/a*n,o[1]+-i/a*n])}return r}function ne(e,t,n,r,o){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=o/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var re=require("d3-scale");function oe(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function ie(e,t,n,r){const o=e.push(t);return n&&n.push(r),o}var se={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function ae(e,t){const n={...e};for(const e of t)n[se[e]]++;return n}function le(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:ae(n,r)}}var ce=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=le({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=le(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},ue=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],de=["scene-style","data-paint","accessibility","evidence"],he=(e,t)=>({retainedData:e,invalidations:t}),fe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],pe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],me=["scene-geometry","data-paint","accessibility","evidence"],ye=["scene-style","data-paint","accessibility","evidence"],ge=["overlay","accessibility","evidence"],be=[],ve={xAccessor:he("rebuild",fe),yAccessor:he("rebuild",fe),lineDataAccessor:he("rebuild",fe),pointIdAccessor:he("rebuild",me),lineIdAccessor:he("rebuild",me),windowSize:he("rebuild",fe),projection:he("preserve",pe),projectionExtent:he("preserve",pe),fitPadding:he("preserve",pe),lineType:he("preserve",pe),flowStyle:he("preserve",pe),graticule:he("preserve",pe),projectionTransform:he("preserve",pe),customLayout:he("preserve",pe),layoutConfig:he("preserve",pe),layoutMargin:he("preserve",pe),areaStyle:he("preserve",ye),pointStyle:he("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:he("preserve",ye),colorScheme:he("preserve",ye),themeCategorical:he("preserve",ye),themeDiverging:he("preserve",ye),themeSemantic:he("preserve",ye),themeSequential:he("preserve",ye),decay:he("preserve",ye),pulse:he("preserve",ye),layoutSelection:he("preserve",ye),annotations:he("preserve",ge),autoPlaceAnnotations:he("preserve",ge),clock:he("preserve",be),transition:he("preserve",be),introAnimation:he("preserve",be),onLayoutError:he("preserve",be)},xe=he("preserve",pe),we=class{constructor(){this.tracker=new ce}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}},ue)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},de):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=ve[r]??xe;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},ke=new WeakMap;var je=require("d3-geo");function Se(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}var Me=class e{constructor(e){this.updateResults=new we,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=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=function(e){return{...e,fitPadding:Se(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw 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),o=n.slice(-r.length),i=this.currentTime();this.pointBuffer=new f(e),this.timestampBuffer=new f(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??i)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:Se(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),o=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const i=this.getConfiguredWindowSize(),s=this.streaming&&i!==r;s&&(this.resizeStreamingWindow(i),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}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()??[],o=n.slice(-t),i=r.slice(-o.length),s=this.currentTime();this.pointBuffer=new f(t),this.timestampBuffer=new f(t),o.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??s)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();ie(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)ie(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 Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),o=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(o.push(e),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw 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(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const o=t.toArray();t.clear();for(let e=0;o.length>e;e++)r.has(e)||t.push(o[e])}(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(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=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,o=t(n,e);n.style=o?{...r,...o}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,o=this.scales,i=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return(0,Z.geoEqualEarth)();if("string"==typeof e){const t=Y[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),(0,Z.geoEqualEarth)())}if("object"==typeof e&&"type"in e){const t=Y[e.type],n=t?t():(0,Z.geoEqualEarth)();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=(0,d.geoPath)(this.projection),this.fitProjection(e),this.geoPath=(0,d.geoPath)(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=o,this.baseScale=i,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),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],o=X(n.xAccessor,"lon"),i=X(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const e=s.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const a=Q(n.lineDataAccessor);for(const e of this.lineData){const t=a(e);if(t&&t.length>0){const e=t.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,o],[i,s]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,o],[i,o],[i,s],[r,s],[r,o]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,o=Math.min(e.width,e.height);t.scale(o/2-o*r),t.translate([e.width/2,e.height/2])}else{const o=n.fitPadding??0,i=e.width*o,s=e.height*o;t.fitExtent([[i,s],[e.width-i,e.height-s]],{type:"FeatureCollection",features:r})}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,o=this.scales,i=n.scale(),s=[...n.translate()],a=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=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),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,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),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,o=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}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 t=0,n=0;for(const e of this.scene)"point"===e.type&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let o=0;for(const e of this.scene)"point"===e.type&&(r[o++]=e);this._quadtree=(0,h.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}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=function(e,t,n){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=E[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,_),o={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:G(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(o)}catch(e){const n=null!==this.lastCustomLayoutResult,r=function(e,t,n,r){const o=function(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:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("geo",e,n,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:o}=e;V(r)&&0===n.length&&U(o,"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)&&U(o,"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.`)}({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=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:o,lines:i,layout:s}){const a=X(e.xAccessor,"lon"),l=X(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=(0,je.geoGraticule)();t.step&&r.step(t.step);const o=n(r())||"";o&&c.push({type:"geoarea",pathData:o,centroid:[s.width/2,s.height/2],bounds:[[0,0],[s.width,s.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 o=n.centroid(t),i=n.bounds(t),s=n.area(t);c.push({type:"geoarea",pathData:r,centroid:o,bounds:i,screenArea:s,style:K(e.areaStyle,t,u),datum:t,interactive:!0})}const f=Q(e.lineDataAccessor);for(const n of i){const r=f(n);if(!r||2>r.length)continue;let o=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[a(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],i=e[n+1],s=(0,je.geoDistance)(r,i)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),l=(0,je.geoInterpolate)(r,i);for(let e=0;a>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/a));null!=r&&o.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],i=t([a(n),l(n)]);null!=i&&o.push(i)}if(2>o.length)continue;const i=K(e.lineStyle,n,d),u="number"==typeof i.strokeWidth?i.strokeWidth:1;2!==r.length||2>o.length||"arc"!==e.flowStyle?2!==r.length||2>o.length||"offset"!==e.flowStyle||(o="geo"===e.lineType?te(o,u):ne(o[0],o[o.length-1],0,0,u)):o=ee(o[0],o[o.length-1]);const h=J(o,s.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...i,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>o.length&&h[0]||o,style:i,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,y=m>0?m*Math.PI/180:null,g=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-g[0],(b[1]??0)-g[1]];for(const n of o){const r=a(n),o=l(n);if(null!=y&&(0,je.geoDistance)([r,o],v)>y)continue;const i=t([r,o]);if(!i)continue;const s=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:i[0],y:i[1],r:s.r||4,style:s,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const i=t.strength??1;if(0===i)return null;const s=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,a="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],l=o.find(e=>e.datum&&s(e.datum)+""==t.center+"");if(!l)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const c=l.x,u=l.y,d=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(o.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),h=Math.min(n.width,n.height)/2,f=(0,re.scaleLinear)().domain([0,d]).range([0,h]);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)}for(const e of o){if(e===l)continue;if(!e.datum)continue;const t=Math.atan2(e.y-u,e.x-c),n=Math.sqrt((e.x-c)**2+(e.y-u)**2),r=a(e.datum),o=n+((isFinite(r)?f(r):n)-n)*i;e.x=c+Math.cos(t)*o,e.y=u+Math.sin(t)*o}const p=n.width/2,m=n.height/2,y=p-l.x,g=m-l.y;if(Math.abs(y)>.5||Math.abs(g)>.5)for(const e of o)e.x+=y,e.y+=g;const b={cx:p,cy:m,maxCost:d,availableRadius:h},v=e.filter(e=>"line"===e.type);if(v.length>0&&"fractional"!==t.lineMode){const e=new Map;for(const t of o)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of v){const n=t.datum?.source,r=t.datum?.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,i])}}}return b}(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);for(let r=0;n.length>r;r++){const o=m(e,r,t);n[r]._decayOpacity=o,n[r].style={...n[r].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(),o=t.color||"rgba(255,255,255,0.6)",i=t.glowRadius??4;let s=!1;for(let a=0;n.length>a&&r.length>a;a++){const l=y(t,r[a],e);s=g(n[a],l,o,i)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,o=t.peek();return null!=o&&r>n-o}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=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 o=!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)&&(o=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=p(e.x,e._targetX,n),e.y=p(t,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}};Me.QUADTREE_THRESHOLD=500;var Ce=Me;Object.assign(Ce.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){ke.set(this,!0)},consumeStylePaintPending:function(){const e=!0===ke.get(this);return ke.delete(this),e}});var Ae=require("react"),Re={sceneGeometry:0,layout:0,domain:0};function Le(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function Pe(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ie="production"!==process.env.NODE_ENV,De={revisions:Re,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Te=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Re,this.lastObserved=Re,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ie&&(this.lastObserved=Pe(this.lastObserved,Le(e)))}beforeCompute(e,t){if(!Ie)return De;const n=Pe(Le(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(Ie){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="")}}},ze=(0,Ae.memo)(function({store:e,diagnostics:t}){return(0,Ae.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function Oe(e,t=30){return Math.max((e??4)+5,12,t)}var Ne=[40,40],Ee=[.5,.5];function Be(e,t){const[n,r]=e.viewBox??Ne,[o,i]=e.anchor??Ee,s=r>0?r:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-o*l,offsetY:-i*c}}function _e(e,t){const n=Be(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 o=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>o&&(o=n)}return o}function We(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var He=null;function Fe(e){if("undefined"==typeof Path2D)return null;He||(He=new Map);const t=He.get(e);if(t)return t;const n=new Path2D(e);return He.size>1024&&He.clear(),He.set(e,n),n}function $e(e,t,n=0,r="horizontal"){const[o,i]=e.viewBox??Ne,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:o,height:i*(a-s)}:{x:o*s,y:0,width:o*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function qe(e,t){const n=Be(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 Ge(e,t,n,r,o,i=e=>e){for(const s of t.parts){const t=Fe(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=o?"none"===s.fill?void 0:o:We(s.fill,n,r);c&&(e.fillStyle=i(c),e.fill(t));const u=o?s.stroke&&"none"!==s.stroke?o:void 0:We(s.stroke??"none",n,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Ve(e,t,n,r,o,i,s=0,a=r){if(i){const e=function(e,t,n,r,o,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,o+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,o,l,m,y)=>{if(o>u||c>m||l>h||d>y)return!0;if(!e.length){let o=e;do{const e=o.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Oe(a(e),r)>=u&&p>u&&(f=e,p=u),o=o.next}while(o)}return!1}),f?{node:f,distance:p}:null}(i,t,n,r,s);if(e)return e}else{let o=null,i=r;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);Oe(s.r,r)>=l&&i>l&&(o=s,i=l)}if(o)return{node:o,distance:i}}let l=null,c=r;for(const o of e){if("glyph"!==o.type)continue;if(null==o.datum)continue;const e=qe(o.glyph,o.size),i=o.x+e.centerDx-t,s=o.y+e.centerDy-n,a=Math.sqrt(i*i+s*s);Oe(e.radius,r)>=a&&c>a&&(l=o,c=a)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const i=e[r];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let u=null,d=a;for(const r of e){if("line"!==r.type)continue;const e=r,{path:o}=e,i=Math.max((e.style.strokeWidth||2)+4,5,a);for(let r=0;o.length-1>r;r++){const[s,a]=o[r],[l,c]=o[r+1],h=Ue(t,n,s,a,l,c);i>=h&&d>h&&(u=e,d=h)}}return u?{node:u,distance:d}:null}function Ue(e,t,n,r,o,i){const s=o-n,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(r+c*a))**2)}var Ze=l(require("react")),Ye=require("react"),Xe=require("react"),Qe=require("react/jsx-runtime");function Ke(e){let t=null;const n=()=>(t||(t=(0,Xe.createContext)(null)),t),r=Je(e);return[function({children:t,initialState:r}){const o=(0,Xe.useRef)(r),i=(0,Xe.useMemo)(()=>Je(e,o.current),[]),s=n();return(0,Qe.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const o=n(),i=(0,Xe.useContext)(o)??r,s=(0,Xe.useRef)(e);s.current=e;const a=(0,Xe.useRef)({hasValue:!1,value:void 0}),l=(0,Xe.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Xe.useCallback)(()=>s.current(i.getState()),[i]);return(0,Xe.useSyncExternalStore)(i.subscribe,l,c)}]}function Je(e,t){const n=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(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 et(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 tt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:nt}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var nt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],rt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",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}},ot={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}},it={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:nt,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"};function st(e,t){if("light"===t)return rt;if("dark"===t)return ot;if("high-contrast"===t)return it;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?ot:rt;return tt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return tt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[at,lt]=Ke(e=>({theme:rt,setTheme(t){e(e=>({theme:st(e.theme,t)}))}})),ct=require("react");var ut=require("react"),dt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ht=new WeakMap,ft=0,pt=!1,mt=null,yt=null;function gt(e,t){if(!t)return t;const n=dt.exec(t);if(!n)return t;const r=e.canvas;if(!r)return n[2]?.trim()||t;!function(){if(pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;pt=!0;const e=()=>{ft++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),yt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",yt):"function"==typeof mt.addListener&&mt.addListener(yt)}catch{}}();let o=ht.get(r);o&&o.version===ft||(o={version:ft,map:new Map},ht.set(r,o));const i=o.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(r).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return o.map.set(t,s),s}var bt=()=>"undefined"!=typeof performance?performance.now():Date.now();function vt(e,t){const n=e();return Number.isFinite(n)?n:t}var xt=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??bt,this.lastWallTime=vt(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=vt(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??bt;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=vt(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(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}}(n)))}},wt="undefined"==typeof window?Ye.useEffect:Ye.useLayoutEffect,kt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function jt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function St(e){const t=function(){const[e,t]=(0,ct.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ct.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Ye.useRef)(t);n.current=t;const[r,o]=function(e,t,n){const r=(0,ut.useRef)(null),[o,i]=(0,ut.useState)(null);return(0,ut.useEffect)(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Ye.useMemo)(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=o[0]-a.left-a.right,c=o[1]-a.top-a.bottom,u=jt(e.foregroundGraphics,o,a),d=jt(e.backgroundGraphics,o,a),h=lt(e=>e.theme),{transition:f,introEnabled:p}=function(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)}}(e.animate,e.transitionProp),m="semiotic-table-"+Ze.useId(),y=(0,Ye.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new xt({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=y.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Ye.useRef)(null),v=(0,Ye.useRef)(e.frameScheduler??kt);v.current=e.frameScheduler??kt;const x=(0,Ye.useRef)(null),w=(0,Ye.useRef)(!1),k=(0,Ye.useRef)(()=>{}),j=(0,Ye.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=r,x.current=e)},[]),S=(0,Ye.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);wt(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Ye.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Ye.useEffect)(()=>()=>{S()},[S]);const M=(0,Ye.useRef)(()=>{}),C=(0,Ye.useRef)(()=>{}),A=(0,Ye.useRef)(null),R=(0,Ye.useRef)(null),L=(0,Ye.useRef)(null),P=(0,Ye.useCallback)(()=>{const e=A.current;A.current=null,e&&M.current(e)},[]),I=(0,Ye.useCallback)(e=>{if(A.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===R.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,R.current=null,L.current=null,P()});t||(R.current=n,L.current=e)}},[P]),D=(0,Ye.useCallback)(()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null),C.current()},[]);(0,Ye.useEffect)(()=>()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null)},[]);const T=e.themeDirtyRef;return wt(()=>{T&&(ft++,T.current=!0,j())},[h,j,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:g,rafRef:b,renderFnRef:k,scheduleRender:j,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:I,onPointerLeave:D}}var Mt=require("react"),Ct=require("react"),At={fresh:1,aging:.7,stale:.45,expired:.25},Rt={alpha:1,band:"fresh",isStale:!1};var Lt=require("react/jsx-runtime");function Pt({isStale:e,position:t}){return(0,Lt.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:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var It=l(require("react")),[Dt,Tt]=Ke(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function zt(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Ot=require("react"),Nt=l(require("react")),Et=require("react/jsx-runtime");function Bt(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let s="";for(const e of o)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function _t(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 Wt(e,t,n,r){if(!e)return(0,Et.jsx)("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!o&&!i)return(0,Et.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:Bt(i,l):[],m=o?c?[o]:Bt(o,l):[],y="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Et.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:(0,Et.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Et.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&(0,Et.jsx)("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(p.length>0&&(b.push((0,Et.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push((0,Et.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:g,children:m.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Et.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Et.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Ht(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Et.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Et.jsx)("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Et.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Et.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Et.jsx)("path",{d:_t(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Et.jsx)("g",{className:"annotation-subject",children:i})}function Ft(e,t,n,r,o,i){const s=[];let a=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=e-o,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;a=o+s*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,p=r+d*f,m=i+h*f;s.push((0,Et.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,Et.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Et.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return(0,Et.jsx)("g",{className:"annotation-connector",children:s})}function $t(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:y={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=r||0,k=o||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const j="string"==typeof u?u:"label";if("bracket"===j&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Et.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Ft(w,k,l,d,j,c),!x.has("subject")&&Ht(j,c,d,b,v),!x.has("note")&&Wt(a,w,k,d)]})}function qt(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Et.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",events:o,...t,type:r},s)}var Gt=require("d3-hierarchy"),Vt=require("d3-shape");function Ut(e){return Math.round(100*e)/100}function Zt(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const s=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));s.push(r)}r.push(s)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ut);return{points:e.map(([e])=>[Ut(e),Ut(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function Yt(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 Xt(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 Qt(e){return null==e?null:e+""}function Kt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Jt(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 o=n.pointNodes[r];if(o.pointId===e.pointId)return Kt(t,n,{x:o.x,y:o.y})}const r=function(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,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:o(s)}}(n);return r?Kt(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return Qt(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>Qt(e.pointId)===r);if(o)return Kt(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return Qt(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=Yt(i,n),a=Xt(i,n);return null==s||null==a?null:Kt(t,n,{x:s,y:a})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=Yt(e,n),i=Xt(e,n)),null!=o&&null!=i)return Kt(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function en(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var tn=require("react/jsx-runtime"),nn={secondary:0,primary:3};function rn(e){return!0===e?._annotationDeferred}function on(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function sn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function an(e){return Math.max(.72,.95-.06*e)}var ln=require("react/jsx-runtime"),cn="var(--semiotic-bg, #ffffff)";function un(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ln.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??cn,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,y="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*y;let v,x;return v="middle"===l?t-g/2-m:"end"===l?t-g-m:t-m,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,ln.jsxs)("g",{className:d,children:[(0,ln.jsx)("rect",{x:v,y:x,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??cn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var dn=null;var hn=require("react/jsx-runtime");function fn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function pn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function mn(e,t){let n=2166136261;const r=pn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var yn=new Map;function gn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,hn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,hn.jsx)("rect",{width:l,height:l,fill:n}),(0,hn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a}),(0,hn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a})]},t)}function bn(e,t,n="#4e79a7"){if(fn(e)){const n=mn(t,e);return{fill:`url(#${n})`,def:gn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var vn=require("react/jsx-runtime"),xn={linear:Vt.curveLinear,monotoneX:Vt.curveMonotoneX,monotoneY:Vt.curveMonotoneY,step:Vt.curveStep,stepAfter:Vt.curveStepAfter,stepBefore:Vt.curveStepBefore,basis:Vt.curveBasis,cardinal:Vt.curveCardinal,catmullRom:Vt.curveCatmullRom};var wn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function kn(e){return!!e&&"object"==typeof e&&wn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function jn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Sn(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Mn(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*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Cn=32,An=6,Rn=4,Ln=8,Pn=72;var In={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Dn(e){if(!Tn(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Tn(e){return kn(e)}function zn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function On(e,t,n,r,o){const i=e+n,s=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?s-o.height:s,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?s-o.height-4:s+4,width:o.width,height:o.height}}function Nn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function En(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 Bn(e,t,n,r,o,i,s,a){const l=Nn(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,a);for(const e of n)c+=12*En(l,e);for(const e of r)c+=4*En(l,e);return c}function _n(e){const{annotations:t,context:n,defaultOffset:r=Cn,notePadding:o=An,markPadding:i=Rn,edgePadding:s=Ln,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Pn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:y}=e,g=n.width||0,b=n.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&x>=g,k=w&&!1!==v.preferShortText?t.map(Dn):t,j=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,S=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const A=[],R=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let L=!1;const P=k.map((e,t)=>{if(!Tn(e))return e;const i=function(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 o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([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?Jt(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...zn("string"==typeof e.title?e.title:void 0,t),...zn("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return A.push(Nn(On(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Bn(On(i.x,i.y,e.dx,e.dy,u),e,A,R,g,b,o,s);f>t&&(h=e,f=t)}if(!h)return e;const p=Nn(On(i.x,i.y,h.dx,h.dy,u),o);A.push(p);const m=Math.hypot(h.dx,h.dy),y=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,...y?{connector:y}:{}}}),I=L?P:k.slice();let D=I;if(h){let e=!1;const t=I.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:I}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?In[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 o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const T=new Set;if(j){const e="object"==typeof j?j:{},t=function(e){if(!e)return 1;const t=function(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}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Sn(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=Sn(n,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,kn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>jn(e.annotation)),c=a.filter(e=>!jn(e.annotation)).sort((e,t)=>Mn(t.annotation)-Mn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:D,width:g,height:b,...n});for(const e of r)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of D)Tn(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of D)!0===e?.defensive&&T.delete(e);let z;return z=0===T.size?D:S?D.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const r=e.map(e=>Tn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(z,C):z}var Wn=l(require("react")),Hn=require("react/jsx-runtime"),Fn={fill:(e,t)=>(0,Hn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Hn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function $n(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Fn[n])(r(e,t),o),i}function qn({swatchSize:e}){return(0,Hn.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 Gn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Vn=(e,t,n,r,o,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=$n(e,c,d,h,b),w=Gn(e,r,o),k=o&&o.size>0&&o.has(e.label);p.push((0,Hn.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!1:void 0,"aria-current":y&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Hn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Hn.jsx)(qn,{swatchSize:b}),(0,Hn.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Un({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Wn.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Hn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return(0,Hn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Hn.jsx)("defs",{children:(0,Hn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Hn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Hn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Hn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])}),(0,Hn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Hn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return(0,Hn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Hn.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Hn.jsx)("defs",{children:(0,Hn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Hn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Hn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])}),(0,Hn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])})]})}function Zn(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(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}}(d),[f,p]=Wn.useState(0),[m,y]=Wn.useState(0),g=Wn.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,Hn.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,Hn.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,Hn.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:Vn(e,n,r,o,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,o,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=o,j=p.map(e=>y+g+7*e.label.length),S=[];let M=0,C=0;j.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=p[d],x=$n(e,d,h,f,y),S=Gn(e,r,o),M=o&&o.size>0&&o.has(e.label);m.push((0,Hn.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Hn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Hn.jsx)(qn,{swatchSize:y}),(0,Hn.jsx)("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=j[d]+b}});const A=Math.max(0,...S.map(e=>e.width)),R=S.length;return{items:m,offset:A,totalRows:R,totalHeight:R*v}})(e,r,o,i,s,a,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const y=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(y.push((0,Hn.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),y.push((0,Hn.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&y.push((0,Hn.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,Hn.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}),v=!(!n&&!r);return(0,Hn.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Hn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Yn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var Xn=require("react/jsx-runtime");function Qn(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,m=Math.max(0,n-o.left-o.right),y=Math.max(1,f?s?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,o.left-y-10),b=o.top):"top"===i?(g=o.left,b=p?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),(0,Xn.jsx)("g",{transform:`translate(${g}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Xn.jsx)(Un,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Yn(t)?(0,Xn.jsx)(Zn,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Kn=require("react/jsx-runtime");function Jn(e){const{width:t,height:n,totalWidth:r,totalHeight:o,margin:i,showAxes:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f,legendLayout:p,foregroundGraphics:m,annotations:y,onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x,autoPlaceAnnotations:w,pointNodes:k}=e,j=function(e){const t=Tt(e=>e.pushObservation),n=It.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return It.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x}),S=(0,Ot.useRef)([y?.length??0,new Map]),M=y?.length??0;S.current[0]!==M&&(S.current=[M,new Map]);const C=(0,Ot.useMemo)(()=>{if(!y||0===y.length)return null;const e={scales:null,timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:k,stickyPositionCache:S.current[1]};return function(e,t,n,r){const o=[];return e.forEach((e,i)=>{let s;if(n){const o=n(e,i,r);s=null!=o?o:t(e,i,r)}else s=t(e,i,r);s&&o.push({node:s,annotation:e})}),function(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:sn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>rn(e.annotation)),o=e.some(e=>null!=on(e.annotation)),i=e.some(e=>"layer"===on(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=nn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=rn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;s=(0,tn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:an(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const a=on(t.annotation);return a&&(s=(0,tn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,tn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift((0,tn.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")),i&&a.unshift((0,tn.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")),a}(o)}(w?_n({annotations:y,context:e,..."object"==typeof w?w:{}}):y,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t;if(!en(o,i,r))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,vn.jsx)(qt,{noteData:{x:o,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Yt(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const a=t>.6*(r.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)(un,{x:l,y:s,text:e.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Xt(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=t)?Math.min((r.height||0)-4,s+16):s-4;return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)(un,{x:a,y:c,text:e.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Yt({...e,type:"point"},r),y:Xt({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=(0,Gt.packEnclose)(t),i=e.padding||10;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("circle",{cx:o.x,cy:o.y,r:o.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)(un,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Yt({...e,type:"point"},r),y:Xt({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=oe(i),[c,u]=oe(s),d=a-o,h=l+o,f=c-o;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("rect",{x:d,y:f,width:h-d,height:u+o-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&&(0,vn.jsx)(un,{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-"+n)}case"highlight":{const t=r.data||[],o="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,vn.jsx)("g",{children:o.map((t,n)=>{const o=Yt(t,r),s=Xt(t,r);if(null==o||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,vn.jsx)("circle",{cx:o,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Yt(e,r),o=Xt(e,r);return(0,vn.jsx)(qt,{noteData:{x:t??0,y:o??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s="ordinal"===r.frameType,a="horizontal"===r.projection,l=s?o:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,g=p;let b;if(s)if(a){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],p+=t*o[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*p-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Zt(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ut((n*t[3]-t[0]*t[1])/r),i=Ut(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(o*e+i)]),equation:[o,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",j=x[x.length-1],[S,M]=b(j[0],j[1]);return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:S+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(r.height||0),l=bn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,vn.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,vn.jsx)("defs",{children:l.def}),(0,vn.jsx)("rect",{x:0,y:Math.min(s,a),width:r.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,vn.jsx)(un,{x:(r.width||0)-4,y:(o=s,i=a,Math.max(Math.min(o,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,o=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==o||null==i)return null;const s=bn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,vn.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,vn.jsx)("defs",{children:s.def}),(0,vn.jsx)("rect",{x:Math.min(o,i),y:0,width:Math.abs(i-o),height:r.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,vn.jsx)(un,{x:Math.min(o,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[o]-t[o]);if(2>u.length)return null;const d=xn[r.curve||"linear"]||Vt.curveLinear,h=(0,Vt.area)().x(e=>i(e[o])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,vn.jsx)("text",{x:i(u[u.length-1][o])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[o]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[o];return null!=t&&Math.abs(t-l)>d*u});return(0,vn.jsxs)("g",{children:[f&&(0,vn.jsx)("rect",{x:0,y:Math.min(b,v),width:r.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=Yt(e,r),o=Xt(e,r);return null==n||null==o?null:(0,vn.jsx)("circle",{cx:n,cy:o,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,vn.jsx)("text",{x:(r.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Zt(l,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*o-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),y=e.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,vn.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,vn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let o,i;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const t=Jt(e,n,r);if(!t)return null;o=t.x,i=t.y}if(!en(o,i,r))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,vn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,vn.jsx)("foreignObject",{x:o+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,vn.jsx)("div",{...zt(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t,s=o+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,vn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Nt.cloneElement(c,{key:"ann-text-"+n}):(0,vn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,vn.jsx)("line",{x1:o,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Nt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const o=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,s=r.scales?.x,a=r.scales?.y,l=o(i)?i:o(s)?s:o(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,vn.jsxs)("g",(r.projection?"vertical"===r.projection:l===s)?{children:[(0,vn.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,vn.jsx)(un,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,vn.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,vn.jsx)(un,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,i,s}}(0,j),void 0,e)},[y,w,t,n,k,j]);return s||a||l||m||C&&C.length>0?(0,Kn.jsxs)("svg",{role:"img",width:r,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Kn.jsx)("title",{children:"string"==typeof a?a:"XY Chart"}),(0,Kn.jsx)("desc",{children:"string"==typeof a?a+" — XY data visualization":"XY data visualization"}),(0,Kn.jsxs)("g",{transform:"translate("+i.left+","+i.top+")",children:[C,m]}),a&&"string"==typeof a?(0,Kn.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Kn.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,Qn({legend:l,totalWidth:r,totalHeight:o,margin:i,legendPosition:f,title:a,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}):null}var er=l(require("react")),tr=(require("d3-shape"),require("react/jsx-runtime"));function nr(e,t="#4e79a7"){return fn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var rr="undefined"==typeof window||"undefined"==typeof document,or=require("react"),ir="undefined"!=typeof window?or.useLayoutEffect:or.useEffect,sr=()=>()=>{},ar=()=>!1,lr=()=>!0,cr=require("react"),ur=require("react/jsx-runtime");function dr({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?(0,ur.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:(0,ur.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var hr=require("react");function fr(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function pr(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function mr(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}var yr=l(require("react")),gr=l(require("react")),br=(require("react/jsx-runtime"),gr.createContext(null)),vr=require("react/jsx-runtime"),xr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function wr({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,vr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:xr,children:t})}function kr(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]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function jr(e){return e&&"object"==typeof e?e:{}}function Sr(e){return jr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Mr=require("react/jsx-runtime");function Cr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}var Ar=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Rr="semiotic-accessible-data-table",Lr=Rr+" semiotic-accessible-data-table-hidden",Pr=Rr+" semiotic-accessible-data-table-visible",Ir={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"},Dr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Tr={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)"},zr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Or={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))"},Nr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Er={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Br={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"};function _r({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=yr.useState(!1),[s,a]=yr.useState(5),l=gr.useContext(br),c=l?.visible??!1,u=o||c,d=yr.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;yr.useEffect(()=>{u||a(5)},[u]);const f=yr.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),p=yr.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Mr.jsx)("span",{id:n,tabIndex:-1,style:xr}):null;if(!u)return(0,Mr.jsx)("div",{id:n,className:Lr,tabIndex:-1,onFocus:f,style:xr,role:"region","aria-label":h,children:(0,Mr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:kr(Sr(r))});break;case"line":case"area":{const e=Sr(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:kr(e)});break}case"rect":{const e=Sr(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,s=kr(n);null==s.category&&""!==o&&(s.category=o+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=kr(Sr(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Sr(r),n=kr(e);if(null==n.category){const t=jr(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:kr(Sr(r))});break;case"arc":t.push({label:"Arc",values:kr(Sr(r))});break;case"candlestick":t.push({label:"Candlestick",values:kr(Sr(r))});break;case"geoarea":{const e=jr(Sr(r)),n=kr(e);if(null==n.name){const t=jr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ar(e.min)} to ${Ar(e.max)}, mean ${Ar(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,Mr.jsxs)("div",{ref:d,id:n,className:Pr,tabIndex:-1,onBlur:p,style:Ir,role:"region","aria-label":h,children:[(0,Mr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Tr,children:"×"}),(0,Mr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Dr,children:g}),(0,Mr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:zr,children:[(0,Mr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Er,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Mr.jsx)("thead",{children:(0,Mr.jsxs)("tr",{children:[(0,Mr.jsx)("th",{style:Or,children:"type"}),k.map(e=>(0,Mr.jsx)("th",{style:Or,children:e},e))]})}),(0,Mr.jsx)("tbody",{children:v.map((e,t)=>(0,Mr.jsxs)("tr",{children:[(0,Mr.jsx)("td",{style:Nr,children:e.label}),k.map(t=>{return(0,Mr.jsx)("td",{style:Nr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ar(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Mr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Br,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Wr({summary:e}){return e?(0,Mr.jsx)("div",{role:"note",style:xr,children:e}):null}function Hr({tableId:e}){return(0,Mr.jsx)("a",{href:"#"+e,style:xr,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,xr)},children:"Skip to data table"})}var Fr=require("react");var $r=Object.freeze([]);function qr(e){if(!e)return $r;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var Gr=require("react/jsx-runtime"),Vr="var(--semiotic-focus, #005fcc)";function Ur({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!a)if("rect"===o&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Gr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Gr.jsx)("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Gr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Gr.jsx)("path",{d:a,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Gr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Zr=l(require("react"));function Yr(e,t){return"touch"===t?Math.max(e,24):e}var Xr=["name","label","title"],Qr=["type","kind","category","group","class","status","role","shape"],Kr=["value","amount","total","count","weight","score"],Jr=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"]);function eo(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var to=require("react/jsx-runtime"),no={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"};function ro(e,t){return"function"==typeof t?t(e):e[t]}function oo(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function io(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=ro(e,n);s=oo(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=ro(e,o);a.push({label:n,value:oo(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=oo(e[n],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=oo(e[t[0]],r))}}const l={...no,...o};return(0,to.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,to.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,to.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,to.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function so(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(r=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e)?r[0]:r;var r;if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,to.jsx)("div",{className:"semiotic-tooltip",style:no,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?io(e):io())}}var ao=require("react/jsx-runtime");function lo({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Zr.useRef(null),[u,d]=Zr.useState(null);Zr.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Zr.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),p=f?null:no;return l?(0,ao.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var co=require("d3-zoom"),uo=require("d3-selection"),ho=require("d3-shape");function fo(e){switch(e){case"monotoneX":return ho.curveMonotoneX;case"monotoneY":return ho.curveMonotoneY;case"cardinal":return ho.curveCardinal;case"catmullRom":return ho.curveCatmullRom;case"step":return ho.curveStep;case"stepBefore":return ho.curveStepBefore;case"stepAfter":return ho.curveStepAfter;case"basis":return ho.curveBasis;case"natural":return ho.curveNatural;default:return null}}function po(e,t,n){if(null==t)return n;if(fn(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${pn(e)}@${n}`,o=yn.get(r);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(dn||(dn=document.createElement("canvas")),dn.width=e,dn.height=e,dn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=r,c.lineWidth=o,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return yn.set(r,i),i}(t,e);return r||t.background&>(e,t.background)||n}return"string"!=typeof t?t:gt(e,t)||n}function mo(e,t){if(null==t)return;const n=po(e,t,"");return""===n?void 0:n}function yo(e,t,n,r,o,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,r,o,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}function go(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function bo(e,t,n=.6){if(!go(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,o=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(o,i,r,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 vo(e,t,n,r=.35){go(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var xo=require("d3-shape");function wo(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function ko(e,t,n,r,o,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=i;for(let n=0;t.length-1>n;n++){const r=(s[n]+s[n+1])/2;let i=o;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function jo(e,t,n,r,o){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Be(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=po(e,t,t);return"string"==typeof n?n:t},c=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(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=o*a*(t.style.fillOpacity??1);const u=$e(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ge(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ge(e,i,c,t.accent,void 0,l),e.restore()}function So(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),o.setTransform(a,0,0,l,0,0),o.translate(n.left,n.top),o}function Mo(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function Co([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Ao(e,t,n,r,o){return"function"==typeof e?e(t,n,r,o):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",o>1?"@2x":"")}var Ro=class{constructor(e=256){this.cache=new Map,this.limit=e}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)t>r.lastUsed&&(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()}};var Lo=class{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;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;this.capacity>n;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 o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=Po(s),l=Io(s,i.t*a),c=(r[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};function Po(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],o=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+o*o)}return t}function Io(e,t){let n=0;for(let r=1;e.length>r;r++){const o=e[r][0]-e[r-1][0],i=e[r][1]-e[r-1][1],s=Math.sqrt(o*o+i*i);if(n+s>=t||r===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[r-1][0]+o*a,y:e[r-1][1]+i*a,nx:-i/l,ny:o/l}}n+=s}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}var Do=l(require("react"));function To(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Do.createElement(Do.Fragment,null,...t)}var zo=l(require("react")),Oo=require("react/jsx-runtime"),No=zo.createContext(null);function Eo({value:e,children:t}){return(0,Oo.jsx)(No.Provider,{value:e,children:t})}function Bo(e,t){return null!=e?(0,Oo.jsx)(Eo,{value:t,children:e}):e}var _o=new Set;function Wo(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Ho(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;_o.has(n)||(_o.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Fo(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=qe(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}require("react/jsx-runtime");var $o=require("react/jsx-runtime");function qo({data:e}){if(!e)return null;if(e.properties)return(0,$o.jsx)("div",{className:"semiotic-tooltip",style:no,children:(0,$o.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&Jr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>Xr.includes(e.lower));const s=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=eo(l,Qr),u=eo(l,Kr),d=new Set(Qr),h=new Set(Kr),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,$o.jsxs)("div",{className:"semiotic-tooltip",style:no,children:[null!=r&&(0,$o.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,$o.jsxs)("div",{children:[(0,$o.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,$o.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}qo.ownsChrome=!0;var Go={top:10,right:10,bottom:10,left:10},Vo=null;function Uo(){if(null!==Vo)return Vo;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&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Vo=e||t||n}function Zo(){return Uo()?12:30}var Yo={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)"};function Xo(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Qo(e){return e?e.getContext("2d"):null}function Ko(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function Jo(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}var ei=require("react"),ti=require("react");function ni(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}var ri=require("react/jsx-runtime"),oi=(0,u.memo)((0,u.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:o,projectionTransform:i,areas:s,points:a,lines:l,customLayout:c,layoutConfig:d,layoutSelection:h,onLayoutError:f,xAccessor:p,yAccessor:m,lineDataAccessor:y,pointIdAccessor:g,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:j,onZoom:S,dragRotate:M,showParticles:C,particleStyle:A,tileURL:R,tileAttribution:L,tileCacheSize:P,size:I,width:D,height:T,responsiveWidth:z,responsiveHeight:O,margin:N,className:E,background:B,windowSize:_=500,renderMode:W,areaStyle:H,pointStyle:F,lineStyle:$,colorScheme:q,enableHover:G=!0,hoverAnnotation:V,tooltipContent:U,allowTooltipOverflow:Z=!1,customClickBehavior:Y,customHoverBehavior:X,onObservation:Q,annotationObservationCallback:K,chartId:J,annotations:ee,onAnnotationActivate:te,autoPlaceAnnotations:ne,decay:re,pulse:oe,transition:ie,animate:se,staleness:ae,frameScheduler:le,clock:ce,random:ue,seed:de,paused:he=!1,suspendWhenHidden:fe=!0,backgroundGraphics:pe,foregroundGraphics:me,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,legendCategoryAccessor:Se,onCategoriesChange:Me,showAxes:Re,accessibleTable:Le=!0,description:Pe,summary:Ie}=e,{customHoverBehavior:De,customClickBehavior:Oe,hasClickBehavior:Ne}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:o}){return{customHoverBehavior:(0,ei.useCallback)((t,i)=>{e?.(t,i),Ko({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:o,chartId:r,context:i})},[r,o,e,n]),customClickBehavior:(0,ei.useCallback)((e,i)=>{t?.(e,i),Jo({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:o,chartId:r,context:i})},[r,o,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:X,customClickBehavior:Y,onObservation:Q,chartId:J,chartType:"StreamGeoFrame"}),Ee=I||[D||600,T||400],_e=(0,u.useRef)(!0),He=St({sizeProp:Ee,responsiveWidth:z,responsiveHeight:O,userMargin:N,marginDefault:Go,title:ye,legend:ge,legendPosition:be,foregroundGraphics:me,backgroundGraphics:pe,animate:se,transitionProp:ie,frameScheduler:le,clock:ce,random:ue,seed:de,paused:he,suspendWhenHidden:fe,themeDirtyRef:_e}),{reducedMotionRef:Fe,responsiveRef:Ge,size:Ue,margin:Ze,adjustedWidth:Ye,adjustedHeight:Xe,resolvedForeground:Qe,resolvedBackground:Ke,transition:Je,introEnabled:tt,tableId:nt,frameRuntime:rt,rafRef:ot,renderFnRef:it,scheduleRender:st,currentTheme:at}=He,lt=function(){const[e,t]=(0,or.useState)(!1);return ir(()=>{t(!0)},[]),e}(),ct=function(){const e=(0,or.useSyncExternalStore)(sr,ar,lr);return(0,or.useRef)(e).current}(),ut=(0,u.useMemo)(()=>Array.isArray(s)?qr(s):s,[s]),dt=(0,u.useMemo)(()=>qr(a),[a]),ht=(0,u.useMemo)(()=>qr(l),[l]),ft=(0,u.useMemo)(()=>null!=M?M:"orthographic"===Xo(n),[M,n]),pt=function(e){const t=(0,hr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return pr(e,t);if(!mr(e)||!mr(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],o=t[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!pr(n,o))return!1}else{if(!mr(n)||!mr(o))return!1;if(!fr(n,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:o,xAccessor:p,yAccessor:m,lineDataAccessor:y,lineType:v,flowStyle:x,areaStyle:H,pointStyle:F,lineStyle:$,colorScheme:q,themeSemantic:et(at),themeSequential:at?.colors?.sequential,themeDiverging:at?.colors?.diverging,themeCategorical:at?.colors?.categorical,graticule:w,projectionTransform:i,windowSize:_,clock:rt.now,decay:re,pulse:oe,transition:Je,introAnimation:tt,annotations:ee,pointIdAccessor:g,lineIdAccessor:b,customLayout:c,layoutConfig:d,onLayoutError:f,layoutMargin:Ze}),[n,r,o,p,m,y,v,x,H,F,$,q,at,w,i,_,rt.now,re,oe,Je,tt,ee,g,b,c,d,f,Ze])),mt=(0,u.useRef)(null);mt.current||(mt.current=new Ce(pt));const yt=(0,u.useRef)(null),bt=(0,u.useRef)(null),vt=(0,u.useRef)(null);R&&!vt.current&&(vt.current=new Ro(P||256));const xt=(0,u.useRef)(ee),wt=(0,u.useRef)(null),kt=(0,u.useRef)(co.zoomIdentity),jt=(0,u.useRef)(!1),Lt=(0,u.useRef)(null),It=(0,u.useCallback)(e=>{Lt.current=e,Ge&&"object"==typeof Ge&&(Ge.current=e)},[Ge]),Dt=(0,u.useRef)(null),Tt=(0,u.useRef)(null),zt=(0,u.useRef)(null),Ot=(0,u.useRef)(0);if(C&&!zt.current){const e=A?.maxPerLine??Zo();zt.current=new Lo(50*e)}const Nt=(0,u.useRef)(null),Et=(0,u.useRef)(null),Bt=(0,u.useRef)(!1),_t=(0,u.useRef)(!1),Wt=(0,Ae.useRef)(new Te("StreamGeoFrame")),Ht=(0,u.useRef)(void 0),[Ft,$t]=(0,u.useState)(null),[,qt]=(0,u.useState)(0),Gt=(0,u.useRef)(0),[Vt,Ut]=(0,u.useState)(!1),Zt=function(e,t,n,r){const o=(0,Fr.useRef)({accessor:t,onChange:n,readData:r}),i=(0,Fr.useRef)([]);return o.current={accessor:t,onChange:n,readData:r},(0,Fr.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=o.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,r=[];for(const o of e){if(!o||"object"!=typeof o)continue;const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),r.push(i))}return r}(e.current?r(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(mt,Se,Me,e=>e.getPoints());!function(e,t,n,r){(0,Mt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(mt,pt,_e,st),function(e,t,n,r){const o=(0,Mt.useRef)(null);(0,Mt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;o.current!==s&&(o.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,r())},[t,r,e,n])}(mt,h,_e,st),(0,u.useEffect)(()=>{const e=mt.current;e&&(ut&&e.setAreas(ut),a&&e.setPoints(dt),l&&e.setLines(ht),_e.current=!0,st())},[ut,a,dt,l,ht,st]);const Yt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(mt.current?.pushPoint(e),_e.current=!0,st())},[st]),Xt=(0,u.useCallback)(e=>{const t=qr(e);0!==t.length&&(mt.current?.pushMany(t),_e.current=!0,st())},[st]),Qt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(mt.current?.pushLine(e),_e.current=!0,st())},[st]),Kt=(0,u.useCallback)(e=>{const t=qr(e);0!==t.length&&(mt.current?.pushManyLines(t),_e.current=!0,st())},[st]),Jt=(0,u.useCallback)(()=>{mt.current?.clear(),_e.current=!0,st()},[st]);(0,u.useImperativeHandle)(t,()=>({push:Yt,pushMany:Xt,removePoint:e=>{const t=mt.current?.removePoint(e)??[];return t.length>0&&(_e.current=!0,st()),t},pushLine:Qt,pushManyLines:Kt,removeLine:e=>{const t=mt.current?.removeLine(e)??[];return t.length>0&&(_e.current=!0,st()),t},getLines:()=>mt.current?.getLines()??[],clear:Jt,getProjection:()=>mt.current?.scales?.projection??null,getGeoPath:()=>mt.current?.scales?.geoPath??null,getCartogramLayout:()=>mt.current?.cartogramLayout??null,getCustomLayout:()=>mt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>mt.current?.lastCustomLayoutFailure??null,getZoom:()=>kt.current.k,resetZoom:()=>{const e=Lt.current;e&&wt.current&&(0,uo.select)(e).call(wt.current.transform,co.zoomIdentity)},getData:()=>mt.current?.getPoints()??[]}),[Yt,Xt,Qt,Kt,Jt,st]);const{hoverHandlerRef:en,onPointerMove:tn,onPointerLeave:nn}=He,{canvasRef:rn,interactionCanvasRef:on}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,s=(0,cr.useRef)(null),a=(0,cr.useRef)(null),l=(0,cr.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:s,cleanup:a}=e;ir(()=>{t&&n&&r.current?.cancelIntroAnimation?.(),o.current=!0,s?.(),i.current()},[t,n]);const l=(0,or.useRef)(a);l.current=a,(0,or.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,cr.useEffect)(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),(0,cr.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(He,{hydrated:lt,wasHydratingFromSSR:ct,storeRef:mt,dirtyRef:_e,cleanup:()=>vt.current?.clear(),canvasPaintDependencies:[Ye,Xe,B,pe,W,st]});(0,u.useEffect)(()=>{en.current=e=>{if(!G)return;const t=mt.current;if(!t||!t.scene.length)return;const n=rn.current;if(!n)return;const r=n.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Ye||0>i||i>Xe)return Nt.current=null,Et.current=null,$t(null),De?.(null),void st();bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Qo(bt.current);if(!s)return;const a=Yr(30,e.pointerType),l=Yr(6,e.pointerType),c=Ve(t.scene,o,i,a,s,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let r,s;"point"===e.type?(r=e.x,s=e.y):"geoarea"===e.type?(r=e.centroid[0],s=e.centroid[1]):(r=o,s=i);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:r,y:s};Nt.current=a,Et.current=e,$t(a),De?.(a),st()}else Nt.current&&(Nt.current=null,Et.current=null,$t(null),De?.(null),st())}},[G,Ye,Xe,Ze,De,st,en,rn]),He.hoverLeaveRef.current=()=>{Nt.current=null,Et.current=null,$t(null),De?.(null),st()};const sn=(0,u.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Oe)return;const n=mt.current;if(!n||!n.scene.length)return void Oe(null);const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Ye||0>i||i>Xe)return void Oe(null);bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Qo(bt.current);if(!s)return void Oe(null);const a=Yr(30,Ht.current),l=Yr(6,Ht.current),c=Ve(n.scene,o,i,a,s,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Oe({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i},{type:"activate",inputType:(u=Ht.current,"touch"===u?"touch":"pointer")})}var u;Oe(null)},[Xe,Ye,Oe,Ze]),{kbFocusIndexRef:an,focusedNavPointRef:ln,onKeyDown:cn}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:o,customClickBehavior:i,scheduleRender:s}){const a=(0,ti.useRef)(-1),l=(0,ti.useRef)(null),c=(0,ti.useCallback)(c=>{if(function(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']")}(c))return;const u=e.current;if(!u)return;const d=()=>{a.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),o(null),s()};if(0===u.scene.length)return void(0>a.current||d());const h=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=qe(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"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}(u.scene);if(0===h.length)return void(0>a.current||d());let f=a.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void i(ni(h[f]),{type:"activate",inputType:"keyboard"});const p=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;a.current=m;const y=h[m];l.current=y;const g=ni(y);t.current=g,r(g),o(g,{type:"focus",inputType:"keyboard"}),s()},[i,o,t,n,s,r,e]);return{kbFocusIndexRef:a,focusedNavPointRef:l,onKeyDown:c}}({storeRef:mt,hoverRef:Nt,hoveredNodeRef:Et,setHoverPoint:$t,customHoverBehavior:De,customClickBehavior:Oe,scheduleRender:st}),un=(0,u.useCallback)(e=>{Ht.current=e.pointerType,an.current=-1,ln.current=null,tn(e)},[ln,an,tn]),dn=(0,u.useCallback)(e=>{Ht.current=e.pointerType},[]);it.current=()=>{if(ot.current=null,!rt.isActive)return;const e=rn.current,t=mt.current;if(!e||!t)return;const n=rt.now();let r=!1;const o=Tt.current;let i=!1;o&&(Tt.current=null,t.applyRotation(o,{width:Ye,height:Xe}),i=!0);const s=t.advanceTransition(Fe.current?n+1e6:n),a=!Fe.current&&s,l=Wt.current.beforeCompute(t.getLastUpdateResult(),a);let c=!1;if(_e.current&&!s){const n={width:Ye,height:Xe},r=ft?t.getRotation():null;t.computeScene(n);const o=kt.current,i=1!==o.k||0!==o.x||0!==o.y;ft&&r?i?(t.setRotation(r),t.applyZoomScale(o.k,n)):t.applyRotation(r,n):i&&t.applyZoomTransform(o,n),_e.current=!1,c=!0,e.setAttribute("aria-label",Cr(t.scene,"Geographic chart")),Zt()}Wt.current.afterCompute(l,c,!1);const u=Mo(),d=C&&!Fe.current&&!!zt.current,h=t.consumeStylePaintPending(),f=function(e,t,n,r){const o=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!o)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}(t,n,c,_t),p=!!((m={dirtyOrRebuilt:c,transitioning:a,continuous:d,liveEncoding:f.changed,forced:i||h}).dirtyOrRebuilt||m.transitioning||m.animationTicked||m.continuous||m.liveEncoding||m.forced);var m;if(R&&vt.current){const e=yt.current;if(e&&t.scales?.projection){const n=So(e,Ue,Ze,u);if(n){n.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),n.save(),n.beginPath(),n.rect(0,0,Ye,Xe),n.clip();const e=function(e,t){const{tileURL:n,projection:r,width:o,height:i,tileCache:s,onTileLoad:a}=t,l=r.scale(),c=r.translate(),u=function(e){const{size:t,scale:n,translate:r,clampX:o=!0,clampY:i=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),l=1<<a,c=Math.pow(2,s-a+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(o?0:-1/0,Math.floor((0-u)/c)),f=Math.min(o?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-d)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;m>e;++e)for(let t=h;f>t;++t)y.push([t,e,a]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[o,i],scale:2*l*Math.PI,translate:c}),d=Mo();let h=!0;for(const t of u.tiles){const[r,o,i]=Co(t),l=`${i}/${r}/${o}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,a?.()},e.onerror=()=>{t.loaded=!0},e.src=Ao(n,i,r,o,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(n,{tileURL:R,projection:t.scales.projection,width:Ye,height:Xe,tileCache:vt.current,onTileLoad:()=>st()});n.restore(),e||(r=!0)}}}if(p){const o=So(e,Ue,Ze,u);if(!o)return;o.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===n)return!1;if(r)return!1;const c=n||(o&&"transparent"!==o?o:"")||null;if(!c)return!1;const u=gt(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(o,{background:B,hasBackgroundGraphics:!!pe,width:Ye,height:Xe}),o.save(),o.beginPath(),o.rect(0,0,Ye,Xe),o.clip();const i=t.scene,s={width:Ye,height:Xe};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=e;if(!r||"sketchy"===r)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Wo(r,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:o})}finally{t.restore()}l||(Ho(n.id,e.type??"unknown"),i([e]))}a()}({context:o,nodes:i,renderMode:W,pixelRatio:u,paintBuiltIn:e=>{!function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=mo(e,t.style.fill)||"#e0e0e0";if("none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=gt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,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)}vo(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(o,e),((e,t,n,r)=>{const o=t.filter(e=>"line"===e.type);for(const t of o){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const o=t.style.stroke||"#007bff",i=gt(e,o)||o,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ko(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=fo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){let n=function(t,n,r){e.beginPath(),e.strokeStyle=t,e.moveTo(n,r),d=!0},r=function(){d&&(e.stroke(),d=!1)},o=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,f]=t.path[d],p=l[d],m=wo(p,a,i);if(null!==o&&null!==u&&null!==c){if(m===u)e.lineTo(h,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=o+(h-o)*l.t,u=s+(f-s)*l.t,d=wo(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),r(),n(d,t,u)}e.lineTo(h,f)}o=h,s=f,c=p,u=m}else n(m,h,f),o=h,s=f,c=p,u=m}r()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?yo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,xo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=po(e,t.style.fill,t.style.fill),c&&!u)(0,xo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(o,e,0,s),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const r of n)e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI),e.globalAlpha=t*(r.style.opacity??r.style.fillOpacity??1),e.fillStyle=po(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&(e.strokeStyle=po(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),bo(e,r)}finally{e.restore()}}})(o,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&jo(e,r,r.x,r.y,n);e.globalAlpha=n})(o,e)}}),d&&zt.current){const e=zt.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=A||{},s=.3*(i.speedMultiplier??1),a=i.maxPerLine??Zo(),l=i.spawnRate??(Uo()?.06:.15),c=i.radius??2,u=i.opacity??.7,d=n/1e3,h=Ot.current>0?Math.min(d-Ot.current,.1):.016;Ot.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)rt.random()<l&&e.countForLine(n)<a&&e.spawn(n,rt.random);e.step(h,s,f,p),o.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const s=t[r.lineIndex],a="function"==typeof i.color?i.color(s?.datum??{}):"source"!==i.color&&i.color?i.color:s?.style.stroke||"#fff";o.beginPath(),o.arc(r.x,r.y,c,0,2*Math.PI),o.fillStyle=a,o.fill()}o.globalAlpha=1,r=!0}}o.restore()}const y=Et.current,g=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=g||Bt.current;const v=on.current;if(v&&b){const e=So(v,Ue,Ze,u);if(e){if(e.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),y&&"geoarea"===y.type){const t=new Path2D(y.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(y&&"point"===y.type){const t=y,n="object"==typeof V?V:void 0,r=n?.pointColor||function(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}(y);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()}}Bt.current=g}const x=ee!==xt.current;x&&(xt.current=ee),(c||x||a&&ee&&ee.length>0)&&(c||x||n-Gt.current>=33)&&(qt(e=>e+1),Gt.current=n),(a||null!=t.activeTransition||f.pending||r)&&st()},function(e,t,n,r,o,i){const s=(0,Ct.useRef)("fresh");(0,Ct.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return Rt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...At,...e.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Rt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&i(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(a)},[e,o,r,t,i,n])}(ae,mt,_e,st,Vt,Ut),(0,u.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Xo(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.`)}},[R,n]),(0,u.useEffect)(()=>{const e=Lt.current;if(!k||!e)return wt.current&&e&&((0,uo.select)(e).on(".zoom",null),wt.current=null),void(e&&(0,uo.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],r={width:Ye,height:Xe};if(ft){let o=kt.current.k;const i=e=>{o=Math.max(t,Math.min(n,e)),kt.current=co.zoomIdentity.scale(o);const i=mt.current;i&&(i.applyZoomScale(o,r),_e.current=!1,st(),i.scales?.projection&&S?.({projection:i.scales.projection,zoom:i.currentZoom}))};wt.current={scaleBy:(e,t)=>i(o*t),transform:(e,t)=>i(t?.k??1)};const s=e=>{e.preventDefault(),i(o*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*o))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);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=mt.current;if(!r)return;const o=r.getRotation();Dt.current={x:t.clientX,y:t.clientY,rotation:[...o]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Dt.current;t&&(Tt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],st())},d=t=>{if(!Dt.current)return;Dt.current=null,e.releasePointerCapture(t.pointerId);const n=Tt.current;if(n){Tt.current=null;const e=mt.current;e&&(e.applyRotation(n,r),st())}const o=mt.current;o?.scales?.projection&&S?.({projection:o.scales.projection,zoom:o.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),wt.current=null}}const o=(0,co.zoom)().scaleExtent([t,n]).extent([[0,0],[Ue[0],Ue[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;kt.current=t,jt.current=!0;const n=mt.current;n&&(n.applyZoomTransform(t,r),_e.current=!1,st())}).on("end",e=>{kt.current=e.transform,jt.current=!1;const t=mt.current;t?.scales?.projection&&S?.({projection:t.scales.projection,zoom:t.currentZoom})});return wt.current=o,(0,uo.select)(e).call(o),()=>{(0,uo.select)(e).on(".zoom",null)}},[k,j,ft,Ue,Ye,Xe,Ze,S,st]);const hn=G&&!1!==V,pn=hn&&Ft?U?U(Ft):(0,ri.jsx)(qo,{data:Ft}):null,mn=pn?(0,ri.jsx)(lo,{x:Ft.x,y:Ft.y,containerWidth:Ye,containerHeight:Xe,margin:Ze,className:"stream-frame-tooltip",zIndex:10,children:pn}):null;if(rr||!lt&&ct){const e=mt.current;e&&(ut||a||l)&&(ut&&e.setAreas(ut),a&&e.setPoints(dt),l&&e.setLines(ht),e.computeScene({width:Ye,height:Xe}));const t=e?.scene??[];return(0,ri.jsxs)("div",{ref:It,className:"stream-geo-frame"+(E?" "+E:""),role:"img","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:z?"100%":Ue[0],height:O?"100%":Ue[1]},children:[(0,ri.jsx)(Wr,{summary:Ie}),(0,ri.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ue[0],height:Ue[1],style:{position:"absolute",left:0,top:0},children:[(0,ri.jsx)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:Ke}),(0,ri.jsxs)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:[B&&(0,ri.jsx)("rect",{x:0,y:0,width:Ye,height:Xe,fill:B}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:r,fallback:o}=e,i=Wo(r,t);if(!i)return o();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ho(i.id,t.type??"unknown"),o())}({node:e,index:t,renderMode:W,fallback:()=>function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=fn(n.style.fill)?gn(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,tr.jsxs)(er.Fragment,{children:[r&&(0,tr.jsx)("defs",{children:r}),(0,tr.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:nr(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._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=fn(n.style.fill)?gn(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,tr.jsxs)(er.Fragment,{children:[r&&(0,tr.jsx)("defs",{children:r}),(0,tr.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:nr(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(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,tr.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":return function(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=Be(o,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=$e(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:We(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:We(n.stroke??"none",a,e.accent);return o||i?(0,tr.jsx)("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return(0,tr.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,tr.jsx)("clipPath",{id:c,children:(0,tr.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,tr.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,tr.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t)}))]})]}),(0,ri.jsx)(Jn,{width:Ye,height:Xe,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ze,showAxes:!1,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,foregroundGraphics:To(Qe,Bo(mt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,pointNodes:Fo(t)})]})}return(0,ri.jsxs)("div",{ref:It,className:"stream-geo-frame"+(E?" "+E:""),role:"group","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:{position:"relative",width:z?"100%":Ue[0],height:O?"100%":Ue[1],overflow:Z?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:cn,children:["production"!==process.env.NODE_ENV&&mt.current&&(0,ri.jsx)(ze,{store:mt.current,diagnostics:Wt.current}),Le&&(0,ri.jsx)(Hr,{tableId:nt}),Le&&(0,ri.jsx)(_r,{scene:mt.current?.scene??[],chartType:"Geographic chart",tableId:nt,chartTitle:"string"==typeof ye?ye:void 0}),(0,ri.jsx)(Wr,{summary:Ie}),(0,ri.jsx)(wr,{hoverPoint:Ft}),(0,ri.jsxs)("div",{role:"img","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:hn?un:void 0,onPointerLeave:hn?nn:void 0,onPointerDown:hn||Ne?dn:void 0,onClick:Ne?sn:void 0,children:[(0,ri.jsx)(dr,{size:Ue,margin:Ze,children:Ke}),R&&(0,ri.jsx)("canvas",{ref:yt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,ri.jsx)("canvas",{ref:rn,"aria-label":Cr(mt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,ri.jsx)("canvas",{ref:on,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,ri.jsx)(Jn,{width:Ye,height:Xe,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ze,showAxes:Re,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,foregroundGraphics:To(Qe,Bo(mt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,pointNodes:Fo(mt.current?.scene)}),ae?.showBadge&&(0,ri.jsx)(Pt,{isStale:Vt,position:ae.badgePosition}),k&&(0,ri.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ze.bottom+8,left:Ze.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,ri.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Lt.current,n=wt.current;t&&n?.scaleBy&&n.scaleBy((0,uo.select)(t),1.5)},style:Yo,children:"+"}),(0,ri.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Lt.current,n=wt.current;t&&n?.scaleBy&&n.scaleBy((0,uo.select)(t),1/1.5)},style:Yo,children:"−"})]}),L&&(0,ri.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ze.bottom+2,right:Ze.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}),(0,ri.jsx)(Ur,{active:an.current>=0,hoverPoint:Ft,margin:Ze,size:Ue,shape:ln.current?.shape,width:ln.current?.w,height:ln.current?.h,pathData:ln.current?.pathData}),mn]})]})}));oi.displayName="StreamGeoFrame";var ii=oi,si=require("react");function ai(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}var li=require("react"),ci=require("react"),ui=(require("react/jsx-runtime"),(0,ci.createContext)(null));function di(){return(0,ci.useContext)(ui)}var hi=require("react");function fi(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function pi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function mi(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[yi,gi]=Ke(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!mi(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),s=pi(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=pi(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}})),bi=require("react"),vi=(require("react"),{positions:new Map}),xi=new Set;function wi(){for(const e of xi)e()}function ki(e,t){const n=vi.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(vi.positions);r.delete(e),vi={positions:r},wi()}function ji(e,t){const n=vi.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(vi.positions);r.delete(e),vi={positions:r},wi()}function Si(e){const t=(0,bi.useId)(),n=e.clientId||t,{name:r}=e,o=gi(e=>e.selections.get(r)),i=gi(e=>e.setClause),s=gi(e=>e.clearClause),a=(0,bi.useMemo)(()=>!!o&&o.clauses.size>0,[o]);return{predicate:(0,bi.useMemo)(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(fi(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:a,selectPoints:(0,bi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:(0,bi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:(0,bi.useCallback)(()=>{s(r,n)},[s,r,n]),clientId:n}}function Mi(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:s}=Si({name:t,fields:n});return{onHover:(0,bi.useCallback)(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,s]),predicate:r,isActive:o}}require("react/jsx-runtime");var Ci=(0,hi.createContext)(!1);(0,hi.createContext)(!1);var Ai=(0,hi.createContext)(null),Ri="undefined"==typeof window?hi.useEffect:hi.useLayoutEffect;function Li(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}var Pi=.5;function Ii(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Pi;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Di=l(require("react"));function Ti(){return lt(e=>e.theme)}function zi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Oi(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Ni(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=>Oi(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)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])zi(e[r])&&zi(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}function Ei(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Bi(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?{...t,xValue:e.xValue}:t||{}}function _i(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),Di.createContext(void 0);var Wi="#007bff",Hi=[],Fi=44,$i={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Fi,snap:"nearestDatum",brushHandleSize:Fi,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function qi(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!o&&!i)return $i;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??Fi,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Fi,standardControls:a.standardControls??!1}}function Gi(){const e=Ti(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Vi({selection:e,linkedHover:t,fallbackFields:n=Hi,unwrapData:r=!1,onObservation:o,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,li.useId)(),h=(0,li.useMemo)(()=>Li(t,n),[t,n]),f=(0,li.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=Si({name:e?.name||"__unused__",fields:f}),m=Mi({name:h?.name||"hover",fields:f}),y=Tt(e=>e.pushObservation),g=(0,li.useCallback)(e=>{o?.(e),y?.(e)},[o,y]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=(0,li.useState)(null),w=(0,li.useRef)(!1),k=c||n[0],j=(0,li.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),S=(0,li.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Ei(e,t,h.xField);null!=n&&function(e,t,n){const r=vi.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(vi={positions:new Map(vi.positions).set(e,{xValue:t,sourceId:n})},wi())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||ki(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(o||y)&&Ko({onObservation:g,datum:e?Bi(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,m,h,d,o,i,s,y,g,l,k,u]),M=(0,li.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&(ji(h.name||"hover",d),ki(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),C=(0,li.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ei(n,e,h.xField);null!=t&&function(e,t,n){const r=vi.positions.get(e);if(r?.locked){const t=new Map(vi.positions);return t.delete(e),vi={positions:t},wi(),!1}vi={positions:new Map(vi.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wi()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Bi(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}_i(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(o||y)&&Jo({onObservation:g,datum:n?Bi(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:r})}},[a,o,y,g,i,s,h,d,u,t,m,e,p,f,l,k,M]);return(0,li.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,li.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,li.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{ji(e,d),ki(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:j,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function Ui({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,hi.useContext)(Ci),c=null!==(0,hi.useContext)(Ai),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=(0,li.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,d]);!function(e){const t=(0,hi.useContext)(Ai),n=(0,hi.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=(0,hi.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;Ri(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Ri(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?h:[]);const f=(0,li.useMemo)(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const s=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),a=s?r(s,t,n):n?n(o):_[i%_.length];return{label:o+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:H,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,h]),p=(0,li.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return f&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,o]);return{legend:f,margin:p,legendPosition:o}}var Zi={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}}};function Yi(e,t,n){const r=Zi[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,s=Ni({...t,mode:e},{width:t.width??o,height:t.height??i}).props,a=s.mode||e,l=Zi[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Xi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:qi(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Xi(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 Qi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(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 Ki(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>es(t(e))}function Ji(e,t){const n=Ki(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:t+""}}}function es(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 ts(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 o=es(r);if(void 0===o)return!1;if(void 0!==e.gt&&e.gt>=o)return!1;if(void 0!==e.gte&&e.gte>o)return!1;if(void 0!==e.lt&&o>=e.lt)return!1;if(void 0!==e.lte&&o>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>o||o>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(o>=t&&n>=o)return!1}return!0}function ns(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):ts(r,t,n))}function rs(e,t,n){if(!t||0===t.length)return{};let r={};for(const o of t){if(!ns(o,e,n))continue;const t="function"==typeof o.style?o.style(e,n):o.style;t&&(r={...r,...t})}return r}function os(e,t,n,r=e=>e){const o=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=r(e),a={...o(e,i)};return Object.assign(a,rs(s,t,n(s,i))),a}:o}var is=require("react/jsx-runtime");function ss({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return(0,is.jsx)("div",{role:"alert",style:{width:r,height:Math.max(o,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:(0,is.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,is.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,is.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,is.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})]})})}var as=l(require("react")),ls=require("react/jsx-runtime"),cs=class extends as.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:(0,ls.jsx)(ss,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},us=require("react/jsx-runtime"),ds="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function hs({componentName:e,width:t,height:n,children:r}){return(0,us.jsx)(cs,{fallback:r=>(0,us.jsx)(ss,{componentName:e,message:r.message,width:t,height:n}),children:r})}var fs={display:"flex",alignItems:"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"},ps={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function ms(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,us.jsx)("div",{style:{...fs,width:t,height:n},children:r||"No data available"}):null}function ys(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,us.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),s=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(i+s)-s))/2);return(0,us.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>(0,us.jsx)("div",{className:"semiotic-loading-bar",style:{...ps,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function gs(e,t,n,r){if(!ds)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}var bs=require("react");function vs(e){const t=lt(e=>e.theme.colors.selectionOpacity);return(0,bs.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var xs=require("d3-scale"),ws=require("react"),ks=require("topojson-client"),js=new Map;function Ss(e){return"default"in e?e.default:e}var Ms="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Cs(e){const t=js.get(e);if(t)return t;const{topology:n,objectName:r}=await async function(e){try{switch(e){case"world-110m":return{topology:Ss(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Ss(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Ss(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Ss(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Ms}`,{cause:t});throw t}}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const o=(0,ks.feature)(n,n.objects[r]),i="features"in o?o.features:[o];return js.set(e,i),i}function As(e){const t=(0,ws.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,ws.useState)(null);return(0,ws.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),Cs(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 Rs(e){const{title:t,description:n,summary:r,accessibleTable:o,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Ls(e){const{linkedHover:t,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||o||s)&&(f.customHoverBehavior=u),d&&(l||(h?r||o||t:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}var Ps=require("react/jsx-runtime");function Is(e){const t=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=Ti();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:o,styleRules:i,colorScheme:s,projection:a="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:y,tooltip:g,areaOpacity:b=1,annotations:v,margin:x,className:w,selection:k,linkedHover:j,onObservation:S,onClick:M,chartId:C,loading:A,loadingContent:R,emptyContent:L,frameProps:P={},stroke:I,strokeWidth:D,opacity:T}=e,z=u??!!p,O=As(r),E=(0,si.useMemo)(()=>O?qr(O):O,[O]),B=(0,si.useMemo)(()=>"function"==typeof o?o:e=>e?.properties?.[o]??e?.[o],[o]),_=s??n??"blues",W=(0,si.useMemo)(()=>{if(!E)return(0,xs.scaleSequential)(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of E){const r=B(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=N(_);return(0,xs.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[E,B,_]),{activeSelectionHook:H,customHoverBehavior:F,customClickBehavior:$}=Vi({selection:k,linkedHover:j,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C,mobileInteraction:t.mobileInteraction}),q=vs(k),G=(0,si.useMemo)(()=>{const e=Qi(os(e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?W(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}},i,e=>({value:B(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:D,opacity:T});return H?Ii(e,H,q):e},[B,W,H,q,b,I,D,T,i]),V=(0,si.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=B(e);return(0,Ps.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Ps.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,Ps.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[B]),U=(0,si.useMemo)(()=>({top:10,right:10,bottom:10,left:10,...ai(x)}),[x]),Z=ys(A,t.width,t.height,R)||(E?null:ys(!0,t.width,t.height,R)),Y=Z?null:ms(E,t.width,t.height,L);if(Array.isArray(E)&&E.length>0){const e=E[0];if(!e||"object"!=typeof e||!e.geometry)return(0,Ps.jsx)(ss,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const X={projection:a,areas:E,areaStyle:G,size:[t.width,t.height],margin:U,enableHover:!0,tooltipContent:!1===g?()=>null:!0===g?V:so(g)||V,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...z&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...y&&{tileCacheSize:y},...Ls({linkedHover:j,selection:k,onObservation:S,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:F,customClickBehavior:$,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},...w&&{className:w},...null!=e.animate&&{animate:e.animate},...P};return Z||Y||(0,Ps.jsx)(hs,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,Ps.jsx)(ii,{...X})})}Is.displayName="ChoroplethMap";var Ds=require("react"),Ts=require("react");function zs(e){const{data:t,rawData:n,colorBy:r,colorScheme:o,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,userMargin:m,marginDefaults:y,onClick:g,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:j,width:S,height:M}=e,C=void 0===n,A=(0,Ts.useMemo)(()=>qr(t),[t]),[R,L]=(0,Ts.useState)([]),P=(0,Ts.useCallback)(e=>{L(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,D=(0,Ts.useMemo)(()=>qi(v,{width:S,mobileSemantics:x}),[v,S,x]),{activeSelectionHook:T,hoverSelectionHook:z,customHoverBehavior:O,customClickBehavior:N,crosshairSourceId:E}=Vi({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:g,hoverHighlight:b,colorByField:I,mobileInteraction:D}),B=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,E),W=function(e,t,n){const r=di(),o=Gi();return(0,li.useMemo)(()=>{if(!t)return;const i=r??void 0,s=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&_i(i)){const e=$(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return $(n.map(e=>({_cat:e})),"_cat",s)}if(i&&_i(i)){const n=$(e,t,s);return e=>i[e]||n(e)}return $(e,t,s)}if(i&&_i(i)){const e=$([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,r,o])}(A,r,o),H=(0,Ts.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of A){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[A,r]),F=(0,Ts.useMemo)(()=>C&&R.length>0?R:H,[C,R,H]),q=function(e,t,n){const[r,o]=(0,li.useState)(null),[i,s]=(0,li.useState)(new Set),a=(0,li.useMemo)(()=>new Set,[]),l=(0,li.useCallback)(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=(0,li.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=(0,li.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,r,F),G=(0,Ts.useMemo)(()=>z||(q.legendSelectionHook?q.legendSelectionHook:T),[z,q.legendSelectionHook,T]),V=vs(a),U=Gi(),Z=di(),Y=(0,Ts.useMemo)(()=>{if(W)return W;if(!r||0===F.length)return;const e=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:U&&U.length>0?U:_,t="__streamCat",n=$(F.map(e=>({[t]:e})),t,e);return e=>Z?.[e]||n(e)||"#999"},[W,r,F,o,U,Z]),{legend:X,margin:Q,legendPosition:K}=Ui({data:A,colorBy:r,colorScale:Y,showLegend:p,legendPosition:s,userMargin:m,defaults:y,categories:F}),J=(0,Ts.useMemo)(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),C&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=P),e},[X,K,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,C,r,P]),ee=Array.isArray(n)?qr(n):n,te=ys(w,S,M,k),ne=te?null:ms(ee,S,M,j);return{data:A,colorScale:W,allCategories:F,legendState:q,effectiveSelectionHook:G,activeSelectionHook:T,customHoverBehavior:O,customClickBehavior:N,mobileInteraction:D,legend:X,margin:Q,legendPosition:K,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:B,resolvedSelection:V}}var Os=require("react");function Ns(e,t){const{variant:n,frameRef:r,overrides:o}=t;(0,Os.useImperativeHandle)(e,()=>{const e=function(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)??[],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],r=e.current?.getTopology()?.nodes??[],o=[];for(const t of n){const n=r.find(e=>e.id===t);n&&o.push({...n.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,n)=>(Array.isArray(t)?t:[t]).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}}(n,r);return{...e,...o}},[r,o,n])}var Es=require("react/jsx-runtime"),Bs=(0,Ds.forwardRef)(function(e,t){const n=(0,Ds.useRef)(null);Ns(t,{variant:"geo-points",frameRef:n});const r=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,xAccessor:i="lon",yAccessor:s="lat",sizeBy:a,sizeRange:l=[3,30],colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:M,margin:C,className:A,selection:R,linkedHover:L,onObservation:P,onClick:I,chartId:D,loading:T,loadingContent:z,emptyContent:O,legendInteraction:N,legendPosition:E,frameProps:B={},stroke:_,strokeWidth:W,opacity:F}=e,$=m??!!v,G=As(k),V=zs({data:o??$r,rawData:o,colorBy:c,colorScheme:d,legendInteraction:N,legendPosition:E,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:C,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:T,loadingContent:z,emptyContent:O,width:r.width,height:r.height}),U=V.data,Z=(0,Ds.useMemo)(()=>{if(!a)return;const e="function"==typeof a?a:e=>e?.[a],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?oe(t):void 0},[U,a]),Y=(0,Ds.useMemo)(()=>{const e=Qi(os(e=>({fill:c?H(e,c,V.colorScale):Wi,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:a?q(e,a,l,Z):6}),u,Ji(c,a)),{stroke:_,strokeWidth:W,opacity:F});return V.effectiveSelectionHook?Ii(e,V.effectiveSelectionHook,V.resolvedSelection):e},[c,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,a,l,Z,_,W,F,u]),X=(0,Ds.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof a?a:null,r=("function"==typeof a?a:e=>e[a])(e),o=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,s=i?e?.[i]:null;return(0,Es.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Es.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),o(r)]}),i&&null!=s&&(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[i,": "]}),s+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),o(t)]},e))]})},[a,c]);if(V.earlyReturn)return V.earlyReturn;gs("ProportionalSymbolMap",U,"xAccessor",i),gs("ProportionalSymbolMap",U,"yAccessor",s);const Q={projection:h,...null!=o&&{points:U},xAccessor:i,yAccessor:s,pointStyle:Y,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...G&&{areas:G,areaStyle:j},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...$&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],margin:V.margin,enableHover:!0,tooltipContent:!1===S?()=>null:so(S)||X,...V.legendBehaviorProps,...Ls({linkedHover:L,selection:R,onObservation:P,onClick:I,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...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},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...B};return(0,Es.jsx)(hs,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,Es.jsx)(ii,{ref:n,...Q})})});Bs.displayName="ProportionalSymbolMap";var _s=require("react"),Ws=require("d3-scale"),Hs=require("react/jsx-runtime"),Fs="__semiotic_x",$s="__semiotic_y",qs=(0,_s.forwardRef)(function(e,t){const n=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:r,nodes:o,nodeIdAccessor:i="id",xAccessor:s="lon",yAccessor:a="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:y,tileAttribution:g,tileCacheSize:b,lineType:v="geo",flowStyle:x="basic",areas:w,areaStyle:k={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:j,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:A,showParticles:R,particleStyle:L,tooltip:P,annotations:I,margin:D,className:T,selection:z,linkedHover:O,onObservation:N,onClick:E,chartId:B,loading:_,loadingContent:W,emptyContent:F,frameProps:$={},legendInteraction:q,legendPosition:G,stroke:V,strokeWidth:U,opacity:Z,lineIdAccessor:Y}=e,X=h??!!y,Q=As(w),K=(0,_s.useMemo)(()=>qr(o),[o]),J=zs({data:r??$r,rawData:r,colorBy:j,colorScheme:A,legendInteraction:q,legendPosition:G,selection:z,linkedHover:O,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:N,onClick:E,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:B,showLegend:n.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:W,emptyContent:F,width:n.width,height:n.height}),ee=J.data,te=Li(O),ne=Mi({name:te?.name||"hover",fields:te?.fields||[]}),re=Tt(e=>e.pushObservation),ie=(0,_s.useMemo)(()=>{const e=new Map;for(const t of K)e.set(t[i]+"",t);return e},[K,i]),se=(0,_s.useRef)(null),ae=(0,_s.useRef)(ie);ae.current=ie;const le=(0,_s.useRef)(s);le.current=s;const ce=(0,_s.useRef)(a);ce.current=a;const ue=(0,_s.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const o="function"==typeof le.current?le.current:e=>e[le.current],i="function"==typeof ce.current?ce.current:e=>e[ce.current];return{...e,coordinates:[{[Fs]:o(n),[$s]:i(n)},{[Fs]:o(r),[$s]:i(r)}]}},[]);Ns(t,{variant:"geo-lines",frameRef:se,overrides:{push:e=>{const t=ue(e);t&&se.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&se.current?.pushManyLines(t)}}});const de=(0,_s.useMemo)(()=>{const e=new Map;for(const t of ee)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},[ee]),he=(0,_s.useCallback)(e=>{if(O)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=de.get(t[i]+"");e&&ne.onHover(e)}else ne.onHover(t)}else ne.onHover(null);if(N||re){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:B};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};N&&N(r),re&&re(r)}else{const e={...t,type:"hover-end"};N&&N(e),re&&re(e)}}},[O,ne,i,de,N,B,re]),fe=J.customClickBehavior,pe=(0,_s.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=ie.get(n.source+""),o=ie.get(n.target+"");return r&&o?{...n,coordinates:[{[Fs]:e(r),[$s]:t(r)},{[Fs]:e(o),[$s]:t(o)}]}:null}).filter(Boolean)},[ee,ie,s,a]),me=(0,_s.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Fs in t?t[Fs]:e(t)},[s]),ye=(0,_s.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&$s in t?t[$s]:e(t)},[a]),ge=(0,_s.useMemo)(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:(0,Ws.scaleLinear)().domain(oe(e)).range(M)},[ee,l,M]),be=(0,_s.useMemo)(()=>e=>({stroke:j?H(e,j,J.colorScale):Wi,strokeWidth:ge(e[l]??0),strokeLinecap:C,opacity:S}),[j,J.colorScale,ge,l,S,C]),ve=(0,_s.useMemo)(()=>{const e=Qi(be,{stroke:V,strokeWidth:U,opacity:Z});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return Ii(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[be,J.effectiveSelectionHook,J.resolvedSelection,V,U,Z]),xe=(0,_s.useMemo)(()=>Qi(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Z}),[V,U,Z]),we=(0,_s.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)return(0,Hs.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Hs.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Hs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Hs.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Hs.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?(0,Hs.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Hs.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(J.earlyReturn)return J.earlyReturn;const ke={projection:c,...null!=r&&{lines:pe},points:K,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates",...null!=Y&&{lineIdAccessor:Y},lineType:v,flowStyle:x,lineStyle:ve,pointStyle:xe,...Q&&{areas:Q,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...X&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...R&&{showParticles:R},...L&&{particleStyle:L},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:J.margin,enableHover:!0,tooltipContent:!1===P?()=>null:so(P)||we,...J.legendBehaviorProps,...Ls({linkedHover:O,selection:z,onObservation:N,onClick:E,mobileInteraction:J.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},...T&&{className:T},...null!=e.animate&&{animate:e.animate},...$};return(0,Hs.jsx)(hs,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Hs.jsx)(ii,{ref:se,...ke})})});qs.displayName="FlowMap";var Gs=require("react"),Vs=require("react/jsx-runtime"),Us=(0,Gs.forwardRef)(function(e,t){const n=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,lines:o,xAccessor:i="lon",yAccessor:s="lat",nodeIdAccessor:a="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:j,styleRules:S,colorScheme:M,pointRadius:C=5,tooltip:A,showRings:R=!0,ringStyle:L,showNorth:P=!0,costLabel:I,annotations:D,margin:T,className:z,selection:O,linkedHover:N,onObservation:E,onClick:B,chartId:_,loading:W,loadingContent:F,emptyContent:$,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=e,Y=m??!!v,X=(0,Gs.useMemo)(()=>qr(r),[r]),Q=zs({data:X,rawData:r,colorBy:j,colorScheme:M,legendInteraction:void 0,legendPosition:q,selection:O,linkedHover:N,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:_,showLegend:n.showLegend,userMargin:T,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,loadingContent:F,emptyContent:$,width:n.width,height:n.height}),K=(0,Gs.useMemo)(()=>{const e=Qi(os(e=>({fill:j?H(e,j,Q.colorScale):Wi,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:C}),S,Ji(j)),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?Ii(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[j,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,C,V,U,Z,S]),J=(0,Gs.useMemo)(()=>({center:l,centerAccessor:a,costAccessor:c,strength:u,lineMode:d}),[l,a,c,u,d]),ee=(0,Gs.useMemo)(()=>{if(!o)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of X)n.set(e[a]+"",e);return o.map(r=>{if(r.coordinates)return r;const o=n.get(r.source+""),a=n.get(r.target+"");return o&&a?{...r,coordinates:[{[i]:e(o),[s]:t(o)},{[i]:e(a),[s]:t(a)}]}:null}).filter(Boolean)},[o,X,i,s,a]),te=(0,Gs.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,Vs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Vs.jsx)("div",{style:{fontWeight:600},children:e[a]||e.name||e.id||"Point"}),null!=t&&(0,Vs.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,a]),ne=(0,Gs.useRef)(null);Ns(t,{variant:"geo-points",frameRef:ne});const[re,oe]=(0,Gs.useState)(null),ie=(0,Gs.useCallback)(()=>{const e=ne.current?.getCartogramLayout?.();e&&oe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);(0,Gs.useEffect)(()=>{const e=requestAnimationFrame(ie);return()=>cancelAnimationFrame(e)},[ie,u,l,n.width,n.height,X]);const se=(0,Gs.useMemo)(()=>{if(!R||!re)return[];const{maxCost:e}=re;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[R,re]),ae=(0,Gs.useMemo)(()=>{if(!re)return G.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:r}=re,o={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...L},i=Q.margin.left??10,s=Q.margin.top??10;return(0,Vs.jsxs)("g",{children:[se.map(a=>{const l=a/n*r;return(0,Vs.jsxs)("g",{children:[(0,Vs.jsx)("circle",{cx:e+i,cy:t+s,r:l,fill:"none",stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.strokeDasharray,opacity:.5}),(0,Vs.jsxs)("text",{x:e+i+l+3,y:t+s-2,fontSize:o.labelSize,fill:o.labelColor,fontFamily:"system-ui, sans-serif",children:[a,I?" "+I:""]})]},a)}),P&&(0,Vs.jsxs)("g",{transform:`translate(${i+24}, ${s+24})`,children:[(0,Vs.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,Vs.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"}),(0,Vs.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,Vs.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[re,se,P,I,L,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;gs("DistanceCartogram",X,"xAccessor",i),gs("DistanceCartogram",X,"yAccessor",s);const le={projection:h,...null!=r&&{points:X},...ee&&{lines:ee,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:s,pointIdAccessor:a,pointStyle:K,projectionTransform:J,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...Y&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===A?()=>null:so(A)||te,...Q.legendBehaviorProps,...Ls({linkedHover:N,selection:O,onObservation:E,onClick:B,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...G,foregroundGraphics:ae};return(0,Vs.jsx)(hs,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,Vs.jsx)(ii,{ref:ne,...le})})});Us.displayName="DistanceCartogram";var Zs=require("react"),Ys=require("react");var Xs=require("react/jsx-runtime"),Qs=(0,Zs.forwardRef)(function(e,t){const{points:n,areas:r,lines:o,layout:i,layoutConfig:s,onLayoutError:a,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:j,emptyContent:S,className:M,frameProps:C={}}=e,{frameRef:A,resolved:R,normalizedMargin:L}=function(e){const t=(0,Ys.useRef)(null);return Ns(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Yi(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,Ys.useMemo)(()=>ai(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,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}),P=(0,Zs.useMemo)(()=>qr(n),[n]),I=(0,Zs.useMemo)(()=>qr(r),[r]),D=(0,Zs.useMemo)(()=>qr(o),[o]),T=(0,Zs.useMemo)(()=>[...P,...D,...I],[P,D,I]),z=zs({data:T,rawData:void 0!==n||void 0!==o||void 0!==r?T:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:g,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:R.marginDefaults,loading:k,loadingContent:j,emptyContent:S,width:R.width,height:R.height}),O=z.effectiveSelectionHook,N=(0,Zs.useMemo)(()=>O?.isActive?{isActive:!0,predicate:O.predicate}:null,[O?.isActive,O?.predicate]);if(z.earlyReturn)return z.earlyReturn;const{width:E,height:B,enableHover:_,title:W,description:H,summary:F,accessibleTable:$}=R,q=so(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:I},...null!=o&&{lines:D},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:i,layoutConfig:s,onLayoutError:a,layoutSelection:N,colorBy:h,colorScheme:f,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:z.margin,enableHover:_,...Rs({title:W,description:H,summary:F,accessibleTable:$,className:M,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...Ls({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return(0,Xs.jsx)(hs,{componentName:"GeoCustomChart",width:E,height:B,children:(0,Xs.jsx)(ii,{ref:A,...G})})});Qs.displayName="GeoCustomChart";var Ks={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Js=8;function ea(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Js,style:{...Ks},datum:e.datum,pointId:t,_transitionKey:t}}function ta(e){return ea(e)}function na(e){const[[t,n],[r,o]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(o-n)),style:{...Ks},datum:e.datum,group:e.group,interactive:!0}}function ra(e,t,n){const{featureKey:r,dataKey:o}=n,i=new Map;for(const e of t)i.set(e[o]+"",e);return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n?n[e]:void 0;return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}
|
|
2
|
+
var e,t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,a=(e,t,i,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of o(t))s.call(e,l)||l===i||n(e,l,{get:()=>t[l],enumerable:!(a=r(t,l))||a.enumerable});return e},l=(e,r,o)=>(o=null!=e?t(i(e)):{},a(!r&&e&&e.__esModule?o:n(o,"default",{value:e,enumerable:!0}),e)),c={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(c,{ChoroplethMap:()=>Is,DEFAULT_HIT_RADIUS:()=>Js,DistanceCartogram:()=>Us,FlowMap:()=>qs,GeoCustomChart:()=>Qs,ProportionalSymbolMap:()=>Bs,StreamGeoFrame:()=>ii,composeStyleRules:()=>os,geoAreaHitTarget:()=>na,geoHitTarget:()=>ta,glyphExtent:()=>_e,glyphPlacement:()=>Be,hatchFillId:()=>mn,hatchPatternDef:()=>gn,hitTargetPoint:()=>ea,isHatchFill:()=>fn,makeNodeRuleContext:()=>Ji,makeRuleValueResolver:()=>Ki,matchesThreshold:()=>ts,mergeData:()=>ra,resolveReferenceGeography:()=>Cs,resolveResponsiveRules:()=>Ni,resolveStyleRules:()=>rs,resolveSvgFill:()=>bn,responsiveRuleMatches:()=>Oi,ruleMatches:()=>ns}),module.exports=(e=c,a(n({},"__esModule",{value:!0}),e));var u=require("react"),d=require("d3-geo"),h=require("d3-quadtree"),f=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=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&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}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:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw 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=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return r}update(e,t){const n=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++){const i=(r+o)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}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=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=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}};function p(e,t,n){return e+(t-e)*n}function m(e,t,n){if(1>=n)return 1;const r=n-1;return function(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)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function y(e,t,n){const r=e.duration??500,o=n-t;return r>o?1-o/r:0}function g(e,t,n,r){let o=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,o=!0),e._pulseColor!==n&&(e._pulseColor=n,o=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,o=!0),o):(0!==e._pulseIntensity&&(e._pulseIntensity=0,o=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,o=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,o=!0),o)}var b=require("d3-scale");function v(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function x(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function w(e){const t=e.map(v),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return x(e,n,r)}if(e>=1){const[e,r,o]=t[n];return x(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[s,a,l]=t[o],[c,u,d]=t[o+1];return x(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var k=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],j=w(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),S=w(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),M=w(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),C=w(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),A=w(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),R=w(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),L=w(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),P=w(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),I=w(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),D=w(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),T=w(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),z=w(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),O={blues:j,reds:S,greens:M,viridis:L,oranges:C,purples:A,greys:R,plasma:P,inferno:I,magma:D,cividis:T,turbo:z};function N(e){return e&&O[e]||j}w(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),w(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),w(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),w(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),w(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),w(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var E={category10:k,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...O},B=k,_=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],W=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"]);function H(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||W.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):B[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%B.length]}function F(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 $(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>F(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,b.scaleOrdinal)().domain(r).range(n).unknown("#999");const i=E[n]||E.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:B;return(0,b.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function q(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,s]=r,[a,l]=n;if(s===i)return(a+l)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function G(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&F(n,e)||"#4e79a7":t=>{if(n){const e=F(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}function V(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(V))}function U(e,t,n){e.has(t)||(e.add(t),console.warn(n))}var Z=require("d3-geo"),Y={mercator:Z.geoMercator,equalEarth:Z.geoEqualEarth,albersUsa:Z.geoAlbersUsa,orthographic:Z.geoOrthographic,naturalEarth:Z.geoNaturalEarth1,equirectangular:Z.geoEquirectangular};function X(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function Q(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function K(e,t,n){return e?"function"==typeof e?{...n,...e(t)}:{...n,...e}:{...n}}function J(e,t){if(2>e.length)return[e];const n=.4*t,r=[];let o=[e[0]];for(let t=1;e.length>t;t++){const i=e[t];Math.abs(i[0]-e[t-1][0])>n?(2>o.length||r.push(o),o=[i]):o.push(i)}return 2>o.length||r.push(o),r}function ee(e,t,n=24){const r=t[0]-e[0],o=t[1]-e[1],i=Math.sqrt(r*r+o*o);if(0===i)return[e,t];const s=-o/i,a=r/i,l=Math.min(.3*i,80),c=(e[0]+t[0])/2+s*l,u=(e[1]+t[1])/2+a*l,d=[];for(let r=0;n>=r;r++){const o=r/n,i=1-o;d.push([i*i*e[0]+2*i*o*c+o*o*t[0],i*i*e[1]+2*i*o*u+o*o*t[1]])}return d}function te(e,t){if(2>e.length)return e;const n=t/2+1,r=[];for(let t=0;e.length>t;t++){const o=e[t];let i,s;0===t?(i=e[1][0]-o[0],s=e[1][1]-o[1]):t===e.length-1?(i=o[0]-e[t-1][0],s=o[1]-e[t-1][1]):(i=e[t+1][0]-e[t-1][0],s=e[t+1][1]-e[t-1][1]);const a=Math.sqrt(i*i+s*s)||1;r.push([o[0]+s/a*n,o[1]+-i/a*n])}return r}function ne(e,t,n,r,o){const i=t[0]-e[0],s=t[1]-e[1],a=Math.sqrt(i*i+s*s);if(0===a)return[e,t];const l=s/a,c=-i/a,u=o/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}var re=require("d3-scale");function oe(e){let t=1/0,n=-1/0;for(const r of e)t>r&&(t=r),r>n&&(n=r);return[t,n]}function ie(e,t,n,r){const o=e.push(t);return n&&n.push(r),o}var se={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function ae(e,t){const n={...e};for(const e of t)n[se[e]]++;return n}function le(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:ae(n,r)}}var ce=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=le({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=le(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},ue=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],de=["scene-style","data-paint","accessibility","evidence"],he=(e,t)=>({retainedData:e,invalidations:t}),fe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],pe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],me=["scene-geometry","data-paint","accessibility","evidence"],ye=["scene-style","data-paint","accessibility","evidence"],ge=["overlay","accessibility","evidence"],be=[],ve={xAccessor:he("rebuild",fe),yAccessor:he("rebuild",fe),lineDataAccessor:he("rebuild",fe),pointIdAccessor:he("rebuild",me),lineIdAccessor:he("rebuild",me),windowSize:he("rebuild",fe),projection:he("preserve",pe),projectionExtent:he("preserve",pe),fitPadding:he("preserve",pe),lineType:he("preserve",pe),flowStyle:he("preserve",pe),graticule:he("preserve",pe),projectionTransform:he("preserve",pe),customLayout:he("preserve",pe),layoutConfig:he("preserve",pe),layoutMargin:he("preserve",pe),areaStyle:he("preserve",ye),pointStyle:he("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:he("preserve",ye),colorScheme:he("preserve",ye),themeCategorical:he("preserve",ye),themeDiverging:he("preserve",ye),themeSemantic:he("preserve",ye),themeSequential:he("preserve",ye),decay:he("preserve",ye),pulse:he("preserve",ye),layoutSelection:he("preserve",ye),annotations:he("preserve",ge),autoPlaceAnnotations:he("preserve",ge),clock:he("preserve",be),transition:he("preserve",be),introAnimation:he("preserve",be),onLayoutError:he("preserve",be)},xe=he("preserve",pe),we=class{constructor(){this.tracker=new ce}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}},ue)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},de):this.recordNoop("restyle")}recordConfig(e,t={}){const n=function(e){let t="preserve";const n=new Set;for(const r of e){const e=ve[r]??xe;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e),r=new Set(n.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}},ke=new WeakMap;var je=require("d3-geo");function Se(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e)&&e>=0&&.5>e)return e;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${e+""}.`)}var Me=class e{constructor(e){this.updateResults=new we,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=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=function(e){return{...e,fitPadding:Se(e.fitPadding)}}(e)}currentTime(){return this.config.clock?.()??("undefined"!=typeof performance?performance.now():Date.now())}getConfiguredWindowSize(){const e=this.config.windowSize??500;if(!Number.isInteger(e)||1>e)throw 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),o=n.slice(-r.length),i=this.currentTime();this.pointBuffer=new f(e),this.timestampBuffer=new f(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(o[t]??i)})}this.retainNewestLines(e)}updateConfig(e){const t=function(e){return"fitPadding"in e?{...e,fitPadding:Se(e.fitPadding)}:e}(e),n=this.config,r=this.getConfiguredWindowSize(),o=Object.keys(t).filter(e=>t[e]!==n[e]);this.config={...this.config,...t};const i=this.getConfiguredWindowSize(),s=this.streaming&&i!==r;s&&(this.resizeStreamingWindow(i),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}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()??[],o=n.slice(-t),i=r.slice(-o.length),s=this.currentTime();this.pointBuffer=new f(t),this.timestampBuffer=new f(t),o.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(i[t]??s)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();const t=this.currentTime();ie(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)ie(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 Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),o=[];return this.lineData=this.lineData.filter(e=>!r.has(n(e)+"")||(o.push(e),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}getLines(){return this.lineData.slice()}removePoint(e){const{pointIdAccessor:t}=this.config;if(!t)throw 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(n(e)+"");!function(e,t,n){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{n(e)&&r.add(t)}),0===r.size)return;const o=t.toArray();t.clear();for(let e=0;o.length>e;e++)r.has(e)||t.push(o[e])}(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(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=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,o=t(n,e);n.style=o?{...r,...o}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(e){const{config:t}=this,n=this.projection,r=this.geoPath,o=this.scales,i=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],l=this.scene;this.projection=function(e){if(!e)return(0,Z.geoEqualEarth)();if("string"==typeof e){const t=Y[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),(0,Z.geoEqualEarth)())}if("object"==typeof e&&"type"in e){const t=Y[e.type],n=t?t():(0,Z.geoEqualEarth)();return e.rotate&&"rotate"in n&&n.rotate(e.rotate),e.center&&"center"in n&&n.center(e.center),n}return e}(t.projection),this.geoPath=(0,d.geoPath)(this.projection),this.fitProjection(e),this.geoPath=(0,d.geoPath)(this.projection);const c=this.projection;this.scales={projection:c,geoPath:this.geoPath,projectedPoint:(e,t)=>c([e,t]),invertedPoint:(e,t)=>c.invert?c.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(e);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=r,this.scales=o,this.baseScale=i,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),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],o=X(n.xAccessor,"lon"),i=X(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const e=s.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}const a=Q(n.lineDataAccessor);for(const e of this.lineData){const t=a(e);if(t&&t.length>0){const e=t.map(e=>[o(e),i(e)]);r.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==r.length){if(n.projectionExtent){const[[r,o],[i,s]]=n.projectionExtent;t.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[r,o],[i,o],[i,s],[r,s],[r,o]]]}})}else if(t.clipAngle&&(t.clipAngle()??0)>0){const r=n.fitPadding??0,o=Math.min(e.width,e.height);t.scale(o/2-o*r),t.translate([e.width/2,e.height/2])}else{const o=n.fitPadding??0,i=e.width*o,s=e.height*o;t.fitExtent([[i,s],[e.width-i,e.height-s]],{type:"FeatureCollection",features:r})}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,o=this.scales,i=n.scale(),s=[...n.translate()],a=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=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),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,o=this.scales,i=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*e),n.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(i),n.translate(s),this.currentZoom=a,this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),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,o=this.scales,i=[...n.rotate()];n.rotate(e),this.geoPath=(0,d.geoPath)(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(e,t)=>n([e,t]),invertedPoint:(e,t)=>n.invert?n.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(i),this.geoPath=r,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){const t=this.projection;t&&t.rotate&&t.rotate(e)}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 t=0,n=0;for(const e of this.scene)"point"===e.type&&(n++,e.r>t&&(t=e.r));if(this._maxPointRadius=t,e.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const r=Array(n);let o=0;for(const e of this.scene)"point"===e.type&&(r[o++]=e);this._quadtree=(0,h.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}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=function(e,t,n){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=E[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}(t.colorScheme,t.themeCategorical,_),o={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:G(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null};let i;try{i=t.customLayout(o)}catch(e){const n=null!==this.lastCustomLayoutResult,r=function(e,t,n,r){const o=function(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:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}("geo",e,n,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",e);try{t.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=i.nodes??[];if(this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const e of s)this._baseStyles.set(e,e.style);this.restyleScene(t.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:r,warned:o}=e;V(r)&&0===n.length&&U(o,"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)&&U(o,"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.`)}({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=new WeakMap,function({config:e,projection:t,path:n,areas:r,points:o,lines:i,layout:s}){const a=X(e.xAccessor,"lon"),l=X(e.yAccessor,"lat"),c=[],u=function(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(e),d=function(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(e),h=function(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(e);if(e.graticule){const t=!0===e.graticule?{}:e.graticule,r=(0,je.geoGraticule)();t.step&&r.step(t.step);const o=n(r())||"";o&&c.push({type:"geoarea",pathData:o,centroid:[s.width/2,s.height/2],bounds:[[0,0],[s.width,s.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 o=n.centroid(t),i=n.bounds(t),s=n.area(t);c.push({type:"geoarea",pathData:r,centroid:o,bounds:i,screenArea:s,style:K(e.areaStyle,t,u),datum:t,interactive:!0})}const f=Q(e.lineDataAccessor);for(const n of i){const r=f(n);if(!r||2>r.length)continue;let o=[];if("geo"===e.lineType){const e=Array(r.length);for(let t=0;r.length>t;t++)e[t]=[a(r[t]),l(r[t])];for(let n=0;e.length-1>n;n++){const r=e[n],i=e[n+1],s=(0,je.geoDistance)(r,i)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),l=(0,je.geoInterpolate)(r,i);for(let e=0;a>=e;e++){if(n>0&&0===e)continue;const r=t(l(e/a));null!=r&&o.push(r)}}}else for(let e=0;r.length>e;e++){const n=r[e],i=t([a(n),l(n)]);null!=i&&o.push(i)}if(2>o.length)continue;const i=K(e.lineStyle,n,d),u="number"==typeof i.strokeWidth?i.strokeWidth:1;2!==r.length||2>o.length||"arc"!==e.flowStyle?2!==r.length||2>o.length||"offset"!==e.flowStyle||(o="geo"===e.lineType?te(o,u):ne(o[0],o[o.length-1],0,0,u)):o=ee(o[0],o[o.length-1]);const h=J(o,s.width);if(h.length>1)for(const e of h)2>e.length||c.push({type:"line",path:e,style:{...i,_edgeFade:!0},datum:n});else c.push({type:"line",path:2>o.length&&h[0]||o,style:i,datum:n})}const p=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,m=t.clipAngle?t.clipAngle()??0:0,y=m>0?m*Math.PI/180:null,g=t.rotate?t.rotate():[0,0,0],b="function"==typeof t.center?t.center():[0,0],v=[(b[0]??0)-g[0],(b[1]??0)-g[1]];for(const n of o){const r=a(n),o=l(n);if(null!=y&&(0,je.geoDistance)([r,o],v)>y)continue;const i=t([r,o]);if(!i)continue;const s=e.pointStyle?e.pointStyle(n):{...h},u={type:"point",x:i[0],y:i[1],r:s.r||4,style:s,datum:n,pointId:p?p(n)+"":void 0};c.push(u)}return c}({config:t,projection:n,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){const n=function(e,t,n,r){const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const i=t.strength??1;if(0===i)return null;const s=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,a="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],l=o.find(e=>e.datum&&s(e.datum)+""==t.center+"");if(!l)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;const c=l.x,u=l.y,d=function(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}(o.map(e=>e.datum?a(e.datum):NaN).filter(e=>isFinite(e)&&e>=0),1),h=Math.min(n.width,n.height)/2,f=(0,re.scaleLinear)().domain([0,d]).range([0,h]);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)}for(const e of o){if(e===l)continue;if(!e.datum)continue;const t=Math.atan2(e.y-u,e.x-c),n=Math.sqrt((e.x-c)**2+(e.y-u)**2),r=a(e.datum),o=n+((isFinite(r)?f(r):n)-n)*i;e.x=c+Math.cos(t)*o,e.y=u+Math.sin(t)*o}const p=n.width/2,m=n.height/2,y=p-l.x,g=m-l.y;if(Math.abs(y)>.5||Math.abs(g)>.5)for(const e of o)e.x+=y,e.y+=g;const b={cx:p,cy:m,maxCost:d,availableRadius:h},v=e.filter(e=>"line"===e.type);if(v.length>0&&"fractional"!==t.lineMode){const e=new Map;for(const t of o)t.pointId&&e.set(t.pointId,[t.x,t.y]);for(const t of v){const n=t.datum?.source,r=t.datum?.target;if(n&&r){const o=e.get(n+""),i=e.get(r+"");o&&i&&(t.path=[o,i])}}}return b}(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);for(let r=0;n.length>r;r++){const o=m(e,r,t);n[r]._decayOpacity=o,n[r].style={...n[r].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(),o=t.color||"rgba(255,255,255,0.6)",i=t.glowRadius??4;let s=!1;for(let a=0;n.length>a&&r.length>a;a++){const l=y(t,r[a],e);s=g(n[a],l,o,i)||s}return s}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,o=t.peek();return null!=o&&r>n-o}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){const t=this.config.transition?.duration??300;if(0>=t)return;const n=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 o=!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)&&(o=!0))}for(const e of r)e.pointId&&!n.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??1,e.style={...e.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(e){if(!this.activeTransition)return!1;const t=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,this.activeTransition),n=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(t),r=this.scene.filter(e=>"point"===e.type);for(const e of r){if(null!=e._targetX&&null!=e._targetY){const t=e.y;e.x=p(e.x,e._targetX,n),e.y=p(t,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}};Me.QUADTREE_THRESHOLD=500;var Ce=Me;Object.assign(Ce.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){ke.set(this,!0)},consumeStylePaintPending:function(){const e=!0===ke.get(this);return ke.delete(this),e}});var Ae=require("react"),Re={sceneGeometry:0,layout:0,domain:0};function Le(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function Pe(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Ie="production"!==process.env.NODE_ENV,De={revisions:Re,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Te=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Re,this.lastObserved=Re,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ie&&(this.lastObserved=Pe(this.lastObserved,Le(e)))}beforeCompute(e,t){if(!Ie)return De;const n=Pe(Le(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(Ie){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="")}}},ze=(0,Ae.memo)(function({store:e,diagnostics:t}){return(0,Ae.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function Oe(e,t=30){return Math.max((e??4)+5,12,t)}var Ne=[40,40],Ee=[.5,.5];function Be(e,t){const[n,r]=e.viewBox??Ne,[o,i]=e.anchor??Ee,s=r>0?r:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-o*l,offsetY:-i*c}}function _e(e,t){const n=Be(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 o=0;for(const[e,t]of r){const n=Math.sqrt(e*e+t*t);n>o&&(o=n)}return o}function We(e,t,n,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?n:e}var He=null;function Fe(e){if("undefined"==typeof Path2D)return null;He||(He=new Map);const t=He.get(e);if(t)return t;const n=new Path2D(e);return He.size>1024&&He.clear(),He.set(e,n),n}function $e(e,t,n=0,r="horizontal"){const[o,i]=e.viewBox??Ne,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:o,height:i*(a-s)}:{x:o*s,y:0,width:o*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function qe(e,t){const n=Be(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 Ge(e,t,n,r,o,i=e=>e){for(const s of t.parts){const t=Fe(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=o?"none"===s.fill?void 0:o:We(s.fill,n,r);c&&(e.fillStyle=i(c),e.fill(t));const u=o?s.stroke&&"none"!==s.stroke?o:void 0:We(s.stroke??"none",n,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function Ve(e,t,n,r,o,i,s=0,a=r){if(i){const e=function(e,t,n,r,o,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,o+5,12),c=t-l,u=t+l,d=n-l,h=n+l;let f=null,p=1/0;return e.visit((e,o,l,m,y)=>{if(o>u||c>m||l>h||d>y)return!0;if(!e.length){let o=e;do{const e=o.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);Oe(a(e),r)>=u&&p>u&&(f=e,p=u),o=o.next}while(o)}return!1}),f?{node:f,distance:p}:null}(i,t,n,r,s);if(e)return e}else{let o=null,i=r;for(const s of e){if("point"!==s.type)continue;const e=s.x-t,a=s.y-n,l=Math.sqrt(e*e+a*a);Oe(s.r,r)>=l&&i>l&&(o=s,i=l)}if(o)return{node:o,distance:i}}let l=null,c=r;for(const o of e){if("glyph"!==o.type)continue;if(null==o.datum)continue;const e=qe(o.glyph,o.size),i=o.x+e.centerDx-t,s=o.y+e.centerDy-n,a=Math.sqrt(i*i+s*s);Oe(e.radius,r)>=a&&c>a&&(l=o,c=a)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){const i=e[r];if("geoarea"!==i.type)continue;const s=i;if(!1===s.interactive)continue;const[[a,l],[c,u]]=s.bounds;if(!(a>t||t>c||l>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,t,n)))return{node:s,distance:0}}let u=null,d=a;for(const r of e){if("line"!==r.type)continue;const e=r,{path:o}=e,i=Math.max((e.style.strokeWidth||2)+4,5,a);for(let r=0;o.length-1>r;r++){const[s,a]=o[r],[l,c]=o[r+1],h=Ue(t,n,s,a,l,c);i>=h&&d>h&&(u=e,d=h)}}return u?{node:u,distance:d}:null}function Ue(e,t,n,r,o,i){const s=o-n,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-r)**2);let c=((e-n)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(r+c*a))**2)}var Ze=l(require("react")),Ye=require("react"),Xe=require("react"),Qe=require("react/jsx-runtime");function Ke(e){let t=null;const n=()=>(t||(t=(0,Xe.createContext)(null)),t),r=Je(e);return[function({children:t,initialState:r}){const o=(0,Xe.useRef)(r),i=(0,Xe.useMemo)(()=>Je(e,o.current),[]),s=n();return(0,Qe.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const o=n(),i=(0,Xe.useContext)(o)??r,s=(0,Xe.useRef)(e);s.current=e;const a=(0,Xe.useRef)({hasValue:!1,value:void 0}),l=(0,Xe.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,Xe.useCallback)(()=>s.current(i.getState()),[i]);return(0,Xe.useSyncExternalStore)(i.subscribe,l,c)}]}function Je(e,t){const n=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(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 et(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 tt(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:nt}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var nt=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],rt={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",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}},ot={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}},it={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:nt,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"};function st(e,t){if("light"===t)return rt;if("dark"===t)return ot;if("high-contrast"===t)return it;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?ot:rt;return tt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return tt({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[at,lt]=Ke(e=>({theme:rt,setTheme(t){e(e=>({theme:st(e.theme,t)}))}})),ct=require("react");var ut=require("react"),dt=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,ht=new WeakMap,ft=0,pt=!1,mt=null,yt=null;function gt(e,t){if(!t)return t;const n=dt.exec(t);if(!n)return t;const r=e.canvas;if(!r)return n[2]?.trim()||t;!function(){if(pt)return;if("undefined"==typeof window||"undefined"==typeof document)return;pt=!0;const e=()=>{ft++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{mt=window.matchMedia("(prefers-color-scheme: dark)"),yt=e,"function"==typeof mt.addEventListener?mt.addEventListener("change",yt):"function"==typeof mt.addListener&&mt.addListener(yt)}catch{}}();let o=ht.get(r);o&&o.version===ft||(o={version:ft,map:new Map},ht.set(r,o));const i=o.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(r).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return o.map.set(t,s),s}var bt=()=>"undefined"!=typeof performance?performance.now():Date.now();function vt(e,t){const n=e();return Number.isFinite(n)?n:t}var xt=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??bt,this.lastWallTime=vt(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=vt(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??bt;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=vt(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(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}}(n)))}},wt="undefined"==typeof window?Ye.useEffect:Ye.useLayoutEffect,kt={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function jt(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function St(e){const t=function(){const[e,t]=(0,ct.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,ct.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,Ye.useRef)(t);n.current=t;const[r,o]=function(e,t,n){const r=(0,ut.useRef)(null),[o,i]=(0,ut.useState)(null);return(0,ut.useEffect)(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,Ye.useMemo)(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=o[0]-a.left-a.right,c=o[1]-a.top-a.bottom,u=jt(e.foregroundGraphics,o,a),d=jt(e.backgroundGraphics,o,a),h=lt(e=>e.theme),{transition:f,introEnabled:p}=function(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)}}(e.animate,e.transitionProp),m="semiotic-table-"+Ze.useId(),y=(0,Ye.useRef)(null);if(!y.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;y.current=new xt({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=y.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const b=(0,Ye.useRef)(null),v=(0,Ye.useRef)(e.frameScheduler??kt);v.current=e.frameScheduler??kt;const x=(0,Ye.useRef)(null),w=(0,Ye.useRef)(!1),k=(0,Ye.useRef)(()=>{}),j=(0,Ye.useCallback)(()=>{if(null!==b.current||w.current)return;const e=v.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(w.current=!0),b.current=null,x.current=null;try{k.current()}finally{e&&(w.current=!1)}});n=!0,t||(b.current=r,x.current=e)},[]),S=(0,Ye.useCallback)(()=>{null!==b.current&&((x.current??v.current).cancelAnimationFrame(b.current),b.current=null,x.current=null)},[]);wt(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,Ye.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,Ye.useEffect)(()=>()=>{S()},[S]);const M=(0,Ye.useRef)(()=>{}),C=(0,Ye.useRef)(()=>{}),A=(0,Ye.useRef)(null),R=(0,Ye.useRef)(null),L=(0,Ye.useRef)(null),P=(0,Ye.useCallback)(()=>{const e=A.current;A.current=null,e&&M.current(e)},[]),I=(0,Ye.useCallback)(e=>{if(A.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===R.current){const e=v.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,R.current=null,L.current=null,P()});t||(R.current=n,L.current=e)}},[P]),D=(0,Ye.useCallback)(()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null),C.current()},[]);(0,Ye.useEffect)(()=>()=>{A.current=null,null!==R.current&&((L.current??v.current).cancelAnimationFrame(R.current),R.current=null,L.current=null)},[]);const T=e.themeDirtyRef;return wt(()=>{T&&(ft++,T.current=!0,j())},[h,j,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:d,currentTheme:h,transition:f,introEnabled:p,tableId:m,frameRuntime:g,rafRef:b,renderFnRef:k,scheduleRender:j,cancelRender:S,hoverHandlerRef:M,hoverLeaveRef:C,onPointerMove:I,onPointerLeave:D}}var Mt=require("react"),Ct=require("react"),At={fresh:1,aging:.7,stale:.45,expired:.25},Rt={alpha:1,band:"fresh",isStale:!1};var Lt=require("react/jsx-runtime");function Pt({isStale:e,position:t}){return(0,Lt.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:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var It=l(require("react")),[Dt,Tt]=Ke(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function zt(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var Ot=require("react"),Nt=l(require("react")),Et=require("react/jsx-runtime");function Bt(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let s="";for(const e of o)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function _t(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 Wt(e,t,n,r){if(!e)return(0,Et.jsx)("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!o&&!i)return(0,Et.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:Bt(i,l):[],m=o?c?[o]:Bt(o,l):[],y="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Et.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?y-l:"middle"===h?y-l/2:y,y:-16,width:l,height:Math.max(f,(p.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:(0,Et.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Et.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&(0,Et.jsx)("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(p.length>0&&(b.push((0,Et.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:p.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),m.length>0&&b.push((0,Et.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:g,children:m.map((e,t)=>(0,Et.jsx)("tspan",{x:y,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let x=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=(0,Et.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+m.length-1)*f;let k=0;return"topBottom"===u?k=0>n?-(w+2):18:"leftRight"===u&&(k="middle"===d?-(w+f+(m.length>0&&p.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),(0,Et.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Et.jsx)("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0,children:b}),x]})}function Ht(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Et.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Et.jsx)("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Et.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Et.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Et.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Et.jsx)("path",{d:_t(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Et.jsx)("g",{className:"annotation-subject",children:i})}function Ft(e,t,n,r,o,i){const s=[];let a=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=e-o,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;a=o+s*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,f=(n?.curve??.25)*c,p=r+d*f,m=i+h*f;s.push((0,Et.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(m-l,p-a)}else s.push((0,Et.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Et.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return(0,Et.jsx)("g",{className:"annotation-connector",children:s})}function $t(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:p,strokeDasharray:m,events:y={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(f)?f:[]);let w=r||0,k=o||0;null!=i&&(w=i-b),null!=s&&(k=s-v);const j="string"==typeof u?u:"label";if("bracket"===j&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;const e=c.depth||30;k=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;w=e+(0>e?-5:5),k=c.height/2}return(0,Et.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":g,...null!=p&&{opacity:p},...m&&{strokeDasharray:m},...y,children:[!x.has("connector")&&Ft(w,k,l,d,j,c),!x.has("subject")&&Ht(j,c,d,b,v),!x.has("note")&&Wt(a,w,k,d)]})}function qt(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Et.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Et.jsx)($t,{"data-testid":"semiotic-annotation",events:o,...t,type:r},s)}var Gt=require("d3-hierarchy"),Vt=require("d3-shape");function Ut(e){return Math.round(100*e)/100}function Zt(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const s=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));s.push(r)}r.push(s)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ut);return{points:e.map(([e])=>[Ut(e),Ut(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function Yt(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 Xt(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 Qt(e){return null==e?null:e+""}function Kt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Jt(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 o=n.pointNodes[r];if(o.pointId===e.pointId)return Kt(t,n,{x:o.x,y:o.y})}const r=function(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,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:o(s)}}(n);return r?Kt(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return Qt(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>Qt(e.pointId)===r);if(o)return Kt(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return Qt(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=Yt(i,n),a=Xt(i,n);return null==s||null==a?null:Kt(t,n,{x:s,y:a})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=Yt(e,n),i=Xt(e,n)),null!=o&&null!=i)return Kt(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function en(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}var tn=require("react/jsx-runtime"),nn={secondary:0,primary:3};function rn(e){return!0===e?._annotationDeferred}function on(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function sn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function an(e){return Math.max(.72,.95-.06*e)}var ln=require("react/jsx-runtime"),cn="var(--semiotic-bg, #ffffff)";function un(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ln.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:a,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??cn,strokeWidth:h.haloWidth??3});const p=h.padding??{x:6,y:3},m="number"==typeof p?p:p.x,y="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*y;let v,x;return v="middle"===l?t-g/2-m:"end"===l?t-g-m:t-m,x="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-y:n-.8*i-y,(0,ln.jsxs)("g",{className:d,children:[(0,ln.jsx)("rect",{x:v,y:x,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??cn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var dn=null;var hn=require("react/jsx-runtime");function fn(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function pn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function mn(e,t){let n=2166136261;const r=pn(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var yn=new Map;function gn(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,hn.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,hn.jsx)("rect",{width:l,height:l,fill:n}),(0,hn.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a}),(0,hn.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:a})]},t)}function bn(e,t,n="#4e79a7"){if(fn(e)){const n=mn(t,e);return{fill:`url(#${n})`,def:gn(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var vn=require("react/jsx-runtime"),xn={linear:Vt.curveLinear,monotoneX:Vt.curveMonotoneX,monotoneY:Vt.curveMonotoneY,step:Vt.curveStep,stepAfter:Vt.curveStepAfter,stepBefore:Vt.curveStepBefore,basis:Vt.curveBasis,cardinal:Vt.curveCardinal,catmullRom:Vt.curveCatmullRom};var wn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function kn(e){return!!e&&"object"==typeof e&&wn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function jn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Sn(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function Mn(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*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Cn=32,An=6,Rn=4,Ln=8,Pn=72;var In={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Dn(e){if(!Tn(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Tn(e){return kn(e)}function zn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function On(e,t,n,r,o){const i=e+n,s=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?s-o.height:s,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?s-o.height-4:s+4,width:o.width,height:o.height}}function Nn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function En(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 Bn(e,t,n,r,o,i,s,a){const l=Nn(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,a);for(const e of n)c+=12*En(l,e);for(const e of r)c+=4*En(l,e);return c}function _n(e){const{annotations:t,context:n,defaultOffset:r=Cn,notePadding:o=An,markPadding:i=Rn,edgePadding:s=Ln,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Pn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:p,cohesion:m,audience:y}=e,g=n.width||0,b=n.height||0,v="object"==typeof p?p:{},x=v.breakpoint??480,w=!!p&&x>=g,k=w&&!1!==v.preferShortText?t.map(Dn):t,j=w&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,S=d||w&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),M=w&&!f?v.responsive??{minWidth:x}:f,C=w&&!m?v.cohesion:m;if(0===k.length||0>=g||0>=b)return k.slice();const A=[],R=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let L=!1;const P=k.map((e,t)=>{if(!Tn(e))return e;const i=function(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 o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([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?Jt(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...zn("string"==typeof e.title?e.title:void 0,t),...zn("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return A.push(Nn(On(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=Bn(On(i.x,i.y,e.dx,e.dy,u),e,A,R,g,b,o,s);f>t&&(h=e,f=t)}if(!h)return e;const p=Nn(On(i.x,i.y,h.dx,h.dy,u),o);A.push(p);const m=Math.hypot(h.dx,h.dy),y=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,...y?{connector:y}:{}}}),I=L?P:k.slice();let D=I;if(h){let e=!1;const t=I.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});D=e?t:I}{let e=!1;const t=D.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?In[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 o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});D=e?t:D}const T=new Set;if(j){const e="object"==typeof j?j:{},t=function(e){if(!e)return 1;const t=function(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}(e);return t>2?4>t?1:.6:1.5}(y),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Sn(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=Sn(n,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,kn(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>jn(e.annotation)),c=a.filter(e=>!jn(e.annotation)).sort((e,t)=>Mn(t.annotation)-Mn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:D,width:g,height:b,...n});for(const e of r)T.add(e)}if(M&&("object"==typeof M&&"number"==typeof M.minWidth?M.minWidth:480)>=g)for(const e of D)Tn(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of D)!0===e?.defensive&&T.delete(e);let z;return z=0===T.size?D:S?D.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):D.filter(e=>!T.has(e)),C?function(e,t){let n=!1;const r=e.map(e=>Tn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(z,C):z}var Wn=l(require("react")),Hn=require("react/jsx-runtime"),Fn={fill:(e,t)=>(0,Hn.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Hn.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function $n(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Fn[n])(r(e,t),o),i}function qn({swatchSize:e}){return(0,Hn.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 Gn(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Vn=(e,t,n,r,o,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,p=[];let m=0;const y=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:v,rowHeight:x}=u;return f.forEach((e,c)=>{const u=$n(e,c,d,h,b),w=Gn(e,r,o),k=o&&o.size>0&&o.has(e.label);p.push((0,Hn.jsxs)("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:y?a===i&&c===s?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&g?k||!1:void 0,"aria-current":y&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:y?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:y?t=>{l(a,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&(0,Hn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,k&&(0,Hn.jsx)(qn,{swatchSize:b}),(0,Hn.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=x}),p};function Un({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Wn.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Hn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return(0,Hn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Hn.jsx)("defs",{children:(0,Hn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Hn.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Hn.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Hn.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])}),(0,Hn.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Hn.jsx)("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return(0,Hn.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Hn.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Hn.jsx)("defs",{children:(0,Hn.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Hn.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Hn.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[1])}),(0,Hn.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(o[0])})]})}function Zn(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(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}}(d),[f,p]=Wn.useState(0),[m,y]=Wn.useState(0),g=Wn.useCallback((e,t)=>{p(e),y(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push((0,Hn.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push((0,Hn.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push((0,Hn.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:Vn(e,n,r,o,i,s,a,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const m=((e,t,n,r,o,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:p}=e,m=[],{swatchSize:y,labelGap:g,itemGap:b,rowHeight:v,align:x}=u,w=!(!t&&!n),k="isolate"===c||void 0===c&&null!=o,j=p.map(e=>y+g+7*e.label.length),S=[];let M=0,C=0;j.forEach((e,t)=>{const n=0===C?e:C+b+e;d&&d>0&&C>0&&n>d?(S.push({start:M,end:t,width:C}),M=t,C=e):C=n}),p.length>0&&S.push({start:M,end:p.length,width:C}),S.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=p[d],x=$n(e,d,h,f,y),S=Gn(e,r,o),M=o&&o.size>0&&o.has(e.label);m.push((0,Hn.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?a===i&&d===s?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&k?M||!1:void 0,"aria-current":w&&!k&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:w?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:w?t=>{l(a,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&(0,Hn.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:y+g+2+7*e.label.length,height:y+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,M&&(0,Hn.jsx)(qn,{swatchSize:y}),(0,Hn.jsx)("text",{y:y/2,x:y+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=j[d]+b}});const A=Math.max(0,...S.map(e=>e.width)),R=S.length;return{items:m,offset:A,totalRows:R,totalHeight:R*v}})(e,r,o,i,s,a,l,t,c,u,d,d.maxWidth??n);p+=m.offset+5,f.push({label:e.label,...m,offset:p,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=p+12});const p=d.maxWidth??n;let m=h>p?0:"center"===d.align?Math.max(0,(p-h)/2):"end"===d.align?Math.max(0,p-h):0;const y=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(y.push((0,Hn.jsx)("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),y.push((0,Hn.jsx)("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&y.push((0,Hn.jsx)("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),(0,Hn.jsx)("g",{children:y})})({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:s,metrics:h}),v=!(!n&&!r);return(0,Hn.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Hn.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Yn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var Xn=require("react/jsx-runtime");function Qn(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,m=Math.max(0,n-o.left-o.right),y=Math.max(1,f?s?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,o.left-y-10),b=o.top):"top"===i?(g=o.left,b=p?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),(0,Xn.jsx)("g",{transform:`translate(${g}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,Xn.jsx)(Un,{config:t.gradient,orientation:f?"horizontal":"vertical",width:y}):Yn(t)?(0,Xn.jsx)(Zn,{legendGroups:t.legendGroups,title:"",width:y,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Kn=require("react/jsx-runtime");function Jn(e){const{width:t,height:n,totalWidth:r,totalHeight:o,margin:i,showAxes:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f,legendLayout:p,foregroundGraphics:m,annotations:y,onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x,autoPlaceAnnotations:w,pointNodes:k}=e,j=function(e){const t=Tt(e=>e.pushObservation),n=It.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return It.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:g,onObservation:b,chartId:v,chartType:x}),S=(0,Ot.useRef)([y?.length??0,new Map]),M=y?.length??0;S.current[0]!==M&&(S.current=[M,new Map]);const C=(0,Ot.useMemo)(()=>{if(!y||0===y.length)return null;const e={scales:null,timeAxis:"x",width:t,height:n,frameType:"xy",pointNodes:k,stickyPositionCache:S.current[1]};return function(e,t,n,r){const o=[];return e.forEach((e,i)=>{let s;if(n){const o=n(e,i,r);s=null!=o?o:t(e,i,r)}else s=t(e,i,r);s&&o.push({node:s,annotation:e})}),function(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:sn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>rn(e.annotation)),o=e.some(e=>null!=on(e.annotation)),i=e.some(e=>"layer"===on(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=nn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=rn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;s=(0,tn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:an(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const a=on(t.annotation);return a&&(s=(0,tn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,tn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift((0,tn.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")),i&&a.unshift((0,tn.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")),a}(o)}(w?_n({annotations:y,context:e,..."object"==typeof w?w:{}}):y,function(e,t={}){return function(e,n,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t;if(!en(o,i,r))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,vn.jsx)(qt,{noteData:{x:o,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Yt(null!=e.value?{...e,x:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const a=t>.6*(r.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:t,y1:0,x2:t,y2:r.height||0,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)(un,{x:l,y:s,text:e.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Xt(null!=e.value?{...e,y:e.value}:e,r);if(null==t)return null;const o=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=t)?Math.min((r.height||0)-4,s+16):s-4;return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:0,y1:t,x2:r.width||0,y2:t,stroke:o,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)(un,{x:a,y:c,text:e.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Yt({...e,type:"point"},r),y:Xt({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=(0,Gt.packEnclose)(t),i=e.padding||10;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("circle",{cx:o.x,cy:o.y,r:o.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)(un,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Yt({...e,type:"point"},r),y:Xt({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const o=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=oe(i),[c,u]=oe(s),d=a-o,h=l+o,f=c-o;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("rect",{x:d,y:f,width:h-d,height:u+o-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&&(0,vn.jsx)(un,{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-"+n)}case"highlight":{const t=r.data||[],o="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,vn.jsx)("g",{children:o.map((t,n)=>{const o=Yt(t,r),s=Xt(t,r);if(null==o||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,vn.jsx)("circle",{cx:o,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Yt(e,r),o=Xt(e,r);return(0,vn.jsx)(qt,{noteData:{x:t??0,y:o??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s="ordinal"===r.frameType,a="horizontal"===r.projection,l=s?o:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,p=r.scales?.y??r.scales?.value;if(!f||!p)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,g=p;let b;if(s)if(a){const e=m(g);b=(t,n)=>[y(n),e(t)]}else{const e=m(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const v=e.method||"linear";let x;if("loess"===v)x=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],p+=t*o[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const m=u*f-d*d;if(1e-12>Math.abs(m))a.push([t,h/u]);else{const e=(u*p-d*h)/m;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===v?Zt(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ut((n*t[3]-t[0]*t[1])/r),i=Ut(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ut(e),Ut(o*e+i)]),equation:[o,i]}}(u);x=t.points}const w=x.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=e.color||"#6366f1",j=x[x.length-1],[S,M]=b(j[0],j[1]);return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("polyline",{points:w,fill:"none",stroke:k,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:S+4,y:M-4,fill:k,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=r.scales?.y??r.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(r.height||0),l=bn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,vn.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,vn.jsx)("defs",{children:l.def}),(0,vn.jsx)("rect",{x:0,y:Math.min(s,a),width:r.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,vn.jsx)(un,{x:(r.width||0)-4,y:(o=s,i=a,Math.max(Math.min(o,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=r.scales?.x??r.scales?.time,o=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==o||null==i)return null;const s=bn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,vn.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,vn.jsx)("defs",{children:s.def}),(0,vn.jsx)("rect",{x:Math.min(o,i),y:0,width:Math.abs(i-o),height:r.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,vn.jsx)(un,{x:Math.min(o,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=r.data||[];if(2>t.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[o]-t[o]);if(2>u.length)return null;const d=xn[r.curve||"linear"]||Vt.curveLinear,h=(0,Vt.area)().x(e=>i(e[o])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const f=e.fill||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,vn.jsx)("text",{x:i(u[u.length-1][o])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=r.data||[];if(2>t.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[o]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,f=!1!==e.showBand,p=e.fill||"#6366f1",m=e.fillOpacity??.1,y=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=t.filter(e=>{const t=e[o];return null!=t&&Math.abs(t-l)>d*u});return(0,vn.jsxs)("g",{children:[f&&(0,vn.jsx)("rect",{x:0,y:Math.min(b,v),width:r.width||0,height:Math.abs(v-b),fill:p,fillOpacity:m}),x.map((e,t)=>{const n=Yt(e,r),o=Xt(e,r);return null==n||null==o?null:(0,vn.jsx)("circle",{cx:n,cy:o,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,vn.jsx)("text",{x:(r.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=r.data||[];if(3>t.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",s=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[o],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Zt(l,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*o-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,m=l.reduce((e,t)=>e+(t[0]-p)**2,0),y=e.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=e.steps??5,v=l[u-1][0],x=(v-l[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(v+e*x);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(m>0?(e-p)**2/m:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const j=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),M=`${s(v)},${a(c(v))}`,C=e.strokeColor||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:j,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,vn.jsx)("polyline",{points:`${M} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,vn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let o,i;if(null!=e.px&&null!=e.py)o=e.px,i=e.py;else{const t=Jt(e,n,r);if(!t)return null;o=t.x,i=t.y}if(!en(o,i,r))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,vn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,vn.jsx)("foreignObject",{x:o+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,vn.jsx)("div",{...zt(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Jt(e,n,r);if(!t)return null;const{x:o,y:i}=t,s=o+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,vn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Nt.cloneElement(c,{key:"ann-text-"+n}):(0,vn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,vn.jsx)("line",{x1:o,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Nt.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const o=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=r.scales?.o,s=r.scales?.x,a=r.scales?.y,l=o(i)?i:o(s)?s:o(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return(0,vn.jsxs)("g",(r.projection?"vertical"===r.projection:l===s)?{children:[(0,vn.jsx)("rect",{x:c,y:0,width:u,height:r.height||0,fill:d,fillOpacity:h}),f&&(0,vn.jsx)(un,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,vn.jsx)("rect",{x:0,y:c,width:r.width||0,height:u,fill:d,fillOpacity:h}),f&&(0,vn.jsx)(un,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var o,i,s}}(0,j),void 0,e)},[y,w,t,n,k,j]);return s||a||l||m||C&&C.length>0?(0,Kn.jsxs)("svg",{role:"img",width:r,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Kn.jsx)("title",{children:"string"==typeof a?a:"XY Chart"}),(0,Kn.jsx)("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),(0,Kn.jsxs)("g",{transform:"translate("+i.left+","+i.top+")",children:[C,m]}),a&&"string"==typeof a?(0,Kn.jsx)("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Kn.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,Qn({legend:l,totalWidth:r,totalHeight:o,margin:i,legendPosition:f,title:a,legendLayout:p,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}):null}var er=l(require("react")),tr=(require("d3-shape"),require("react/jsx-runtime"));function nr(e,t="#4e79a7"){return fn(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var rr="undefined"==typeof window||"undefined"==typeof document,or=require("react"),ir="undefined"!=typeof window?or.useLayoutEffect:or.useEffect,sr=()=>()=>{},ar=()=>!1,lr=()=>!0,cr=require("react"),ur=require("react/jsx-runtime");function dr({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?(0,ur.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:(0,ur.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}var hr=require("react");function fr(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function pr(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function mr(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}var yr=l(require("react")),gr=l(require("react")),br=(require("react/jsx-runtime"),gr.createContext(null)),vr=require("react/jsx-runtime"),xr={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function wr({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,vr.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:xr,children:t})}function kr(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]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function jr(e){return e&&"object"==typeof e?e:{}}function Sr(e){return jr(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Mr=require("react/jsx-runtime");function Cr(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of s)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}var Ar=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Rr="semiotic-accessible-data-table",Lr=Rr+" semiotic-accessible-data-table-hidden",Pr=Rr+" semiotic-accessible-data-table-visible",Ir={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"},Dr={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Tr={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)"},zr={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Or={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))"},Nr={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Er={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Br={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"};function _r({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=yr.useState(!1),[s,a]=yr.useState(5),l=gr.useContext(br),c=l?.visible??!1,u=o||c,d=yr.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;yr.useEffect(()=>{u||a(5)},[u]);const f=yr.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),p=yr.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,Mr.jsx)("span",{id:n,tabIndex:-1,style:xr}):null;if(!u)return(0,Mr.jsx)("div",{id:n,className:Lr,tabIndex:-1,onFocus:f,style:xr,role:"region","aria-label":h,children:(0,Mr.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const m=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:kr(Sr(r))});break;case"line":case"area":{const e=Sr(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:kr(e)});break}case"rect":{const e=Sr(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,s=kr(n);null==s.category&&""!==o&&(s.category=o+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=kr(Sr(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Sr(r),n=kr(e);if(null==n.category){const t=jr(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:kr(Sr(r))});break;case"arc":t.push({label:"Arc",values:kr(Sr(r))});break;case"candlestick":t.push({label:"Candlestick",values:kr(Sr(r))});break;case"geoarea":{const e=jr(Sr(r)),n=kr(e);if(null==n.name){const t=jr(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),y=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(m),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ar(e.min)} to ${Ar(e.max)}, mean ${Ar(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(m.length,y),b=Math.min(s,m.length),v=m.slice(0,b),x=m.length-b,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const k=Array.from(w);return(0,Mr.jsxs)("div",{ref:d,id:n,className:Pr,tabIndex:-1,onBlur:p,style:Ir,role:"region","aria-label":h,children:[(0,Mr.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Tr,children:"×"}),(0,Mr.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Dr,children:g}),(0,Mr.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:zr,children:[(0,Mr.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Er,children:x>0?`First ${b} of ${m.length} data points`:`All ${m.length} data points`}),(0,Mr.jsx)("thead",{children:(0,Mr.jsxs)("tr",{children:[(0,Mr.jsx)("th",{style:Or,children:"type"}),k.map(e=>(0,Mr.jsx)("th",{style:Or,children:e},e))]})}),(0,Mr.jsx)("tbody",{children:v.map((e,t)=>(0,Mr.jsxs)("tr",{children:[(0,Mr.jsx)("td",{style:Nr,children:e.label}),k.map(t=>{return(0,Mr.jsx)("td",{style:Nr,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ar(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),x>0&&(0,Mr.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:Br,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function Wr({summary:e}){return e?(0,Mr.jsx)("div",{role:"note",style:xr,children:e}):null}function Hr({tableId:e}){return(0,Mr.jsx)("a",{href:"#"+e,style:xr,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,xr)},children:"Skip to data table"})}var Fr=require("react");var $r=Object.freeze([]);function qr(e){if(!e)return $r;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var Gr=require("react/jsx-runtime"),Vr="var(--semiotic-focus, #005fcc)";function Ur({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!a)if("rect"===o&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Gr.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Gr.jsx)("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Vr,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Gr.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Gr.jsx)("path",{d:a,fill:"none",stroke:Vr,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Gr.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Zr=l(require("react"));function Yr(e,t){return"touch"===t?Math.max(e,24):e}var Xr=["name","label","title"],Qr=["type","kind","category","group","class","status","role","shape"],Kr=["value","amount","total","count","weight","score"],Jr=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"]);function eo(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var to=require("react/jsx-runtime"),no={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"};function ro(e,t){return"function"==typeof t?t(e):e[t]}function oo(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function io(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=ro(e,n);s=oo(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=ro(e,o);a.push({label:n,value:oo(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=oo(e[n],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=oo(e[t[0]],r))}}const l={...no,...o};return(0,to.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,to.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,to.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,to.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function so(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Array.isArray(r=!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e)?r[0]:r;var r;if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,to.jsx)("div",{className:"semiotic-tooltip",style:no,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?io(e):io())}}var ao=require("react/jsx-runtime");function lo({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Zr.useRef(null),[u,d]=Zr.useState(null);Zr.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Zr.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),p=f?null:no;return l?(0,ao.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var co=require("d3-zoom"),uo=require("d3-selection"),ho=require("d3-shape");function fo(e){switch(e){case"monotoneX":return ho.curveMonotoneX;case"monotoneY":return ho.curveMonotoneY;case"cardinal":return ho.curveCardinal;case"catmullRom":return ho.curveCatmullRom;case"step":return ho.curveStep;case"stepBefore":return ho.curveStepBefore;case"stepAfter":return ho.curveStepAfter;case"basis":return ho.curveBasis;case"natural":return ho.curveNatural;default:return null}}function po(e,t,n){if(null==t)return n;if(fn(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${pn(e)}@${n}`,o=yn.get(r);if(void 0!==o)return o;const i=function(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(dn||(dn=document.createElement("canvas")),dn.width=e,dn.height=e,dn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=r,c.lineWidth=o,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return yn.set(r,i),i}(t,e);return r||t.background&>(e,t.background)||n}return"string"!=typeof t?t:gt(e,t)||n}function mo(e,t){if(null==t)return;const n=po(e,t,"");return""===n?void 0:n}function yo(e,t,n,r,o,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,r,o,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}function go(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function bo(e,t,n=.6){if(!go(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,o=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(o,i,r,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 vo(e,t,n,r=.35){go(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var xo=require("d3-shape");function wo(e,t,n){let r=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(r=n.color):e>n.value&&(r=n.color);return r}function ko(e,t,n,r,o,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=r,e.lineCap=i;for(let n=0;t.length-1>n;n++){const r=(s[n]+s[n+1])/2;let i=o;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}function jo(e,t,n,r,o){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Be(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=po(e,t,t);return"string"==typeof n?n:t},c=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(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=o*a*(t.style.fillOpacity??1);const u=$e(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&Ge(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),Ge(e,i,c,t.accent,void 0,l),e.restore()}function So(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),o.setTransform(a,0,0,l,0,0),o.translate(n.left,n.top),o}function Mo(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function Co([e,t,n]){const r=1<<n;return[e-Math.floor(e/r)*r,t,n]}function Ao(e,t,n,r,o){return"function"==typeof e?e(t,n,r,o):e.replace("{z}",t+"").replace("{x}",n+"").replace("{y}",r+"").replace("{r}",o>1?"@2x":"")}var Ro=class{constructor(e=256){this.cache=new Map,this.limit=e}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)t>r.lastUsed&&(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()}};var Lo=class{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;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;this.capacity>n;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 o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const s=n[i.lineIndex];if(!s||2>s.length){i.active=!1;continue}if(i.t+=e*t,i.t>=1){i.active=!1;continue}const a=Po(s),l=Io(s,i.t*a),c=(r[i.lineIndex]||2)/2;i.x=l.x+l.nx*i.offset*c*2,i.y=l.y+l.ny*i.offset*c*2}}countForLine(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};function Po(e){let t=0;for(let n=1;e.length>n;n++){const r=e[n][0]-e[n-1][0],o=e[n][1]-e[n-1][1];t+=Math.sqrt(r*r+o*o)}return t}function Io(e,t){let n=0;for(let r=1;e.length>r;r++){const o=e[r][0]-e[r-1][0],i=e[r][1]-e[r-1][1],s=Math.sqrt(o*o+i*i);if(n+s>=t||r===e.length-1){const a=s>0?(t-n)/s:0,l=s>.001?s:1;return{x:e[r-1][0]+o*a,y:e[r-1][1]+i*a,nx:-i/l,ny:o/l}}n+=s}const r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}var Do=l(require("react"));function To(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Do.createElement(Do.Fragment,null,...t)}var zo=l(require("react")),Oo=require("react/jsx-runtime"),No=zo.createContext(null);function Eo({value:e,children:t}){return(0,Oo.jsx)(No.Provider,{value:e,children:t})}function Bo(e,t){return null!=e?(0,Oo.jsx)(Eo,{value:t,children:e}):e}var _o=new Set;function Wo(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Ho(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;_o.has(n)||(_o.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function Fo(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=qe(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}require("react/jsx-runtime");var $o=require("react/jsx-runtime");function qo({data:e}){if(!e)return null;if(e.properties)return(0,$o.jsx)("div",{className:"semiotic-tooltip",style:no,children:(0,$o.jsx)("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});const t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;const n=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&Jr.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>Xr.includes(e.lower));const s=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=eo(l,Qr),u=eo(l,Kr),d=new Set(Qr),h=new Set(Kr),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(t),r=null!=n.title?n.title+"":null;return null==r&&0===n.entries.length?null:(0,$o.jsxs)("div",{className:"semiotic-tooltip",style:no,children:[null!=r&&(0,$o.jsx)("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:r}),n.entries.map(e=>{return(0,$o.jsxs)("div",{children:[(0,$o.jsxs)("span",{style:{opacity:.7},children:[e.key,": "]}),(0,$o.jsx)("span",{style:{fontWeight:600},children:(t=e.value,null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+"")})]},e.key);var t})]})}qo.ownsChrome=!0;var Go={top:10,right:10,bottom:10,left:10},Vo=null;function Uo(){if(null!==Vo)return Vo;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&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Vo=e||t||n}function Zo(){return Uo()?12:30}var Yo={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)"};function Xo(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function Qo(e){return e?e.getContext("2d"):null}function Ko(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function Jo(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}var ei=require("react"),ti=require("react");function ni(e){const t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}var ri=require("react/jsx-runtime"),oi=(0,u.memo)((0,u.forwardRef)(function(e,t){const{projection:n,projectionExtent:r,fitPadding:o,projectionTransform:i,areas:s,points:a,lines:l,customLayout:c,layoutConfig:d,layoutSelection:h,onLayoutError:f,xAccessor:p,yAccessor:m,lineDataAccessor:y,pointIdAccessor:g,lineIdAccessor:b,lineType:v="geo",flowStyle:x="basic",graticule:w,zoomable:k,zoomExtent:j,onZoom:S,dragRotate:M,showParticles:C,particleStyle:A,tileURL:R,tileAttribution:L,tileCacheSize:P,size:I,width:D,height:T,responsiveWidth:z,responsiveHeight:O,margin:N,className:E,background:B,windowSize:_=500,renderMode:W,areaStyle:H,pointStyle:F,lineStyle:$,colorScheme:q,enableHover:G=!0,hoverAnnotation:V,tooltipContent:U,allowTooltipOverflow:Z=!1,customClickBehavior:Y,customHoverBehavior:X,onObservation:Q,annotationObservationCallback:K,chartId:J,annotations:ee,onAnnotationActivate:te,autoPlaceAnnotations:ne,decay:re,pulse:oe,transition:ie,animate:se,staleness:ae,frameScheduler:le,clock:ce,random:ue,seed:de,paused:he=!1,suspendWhenHidden:fe=!0,backgroundGraphics:pe,foregroundGraphics:me,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,legendCategoryAccessor:Se,onCategoriesChange:Me,showAxes:Re,accessibleTable:Le=!0,description:Pe,summary:Ie}=e,{customHoverBehavior:De,customClickBehavior:Oe,hasClickBehavior:Ne}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:r,chartType:o}){return{customHoverBehavior:(0,ei.useCallback)((t,i)=>{e?.(t,i),Ko({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:o,chartId:r,context:i})},[r,o,e,n]),customClickBehavior:(0,ei.useCallback)((e,i)=>{t?.(e,i),Jo({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:o,chartId:r,context:i})},[r,o,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:X,customClickBehavior:Y,onObservation:Q,chartId:J,chartType:"StreamGeoFrame"}),Ee=I||[D||600,T||400],_e=(0,u.useRef)(!0),He=St({sizeProp:Ee,responsiveWidth:z,responsiveHeight:O,userMargin:N,marginDefault:Go,title:ye,legend:ge,legendPosition:be,foregroundGraphics:me,backgroundGraphics:pe,animate:se,transitionProp:ie,frameScheduler:le,clock:ce,random:ue,seed:de,paused:he,suspendWhenHidden:fe,themeDirtyRef:_e}),{reducedMotionRef:Fe,responsiveRef:Ge,size:Ue,margin:Ze,adjustedWidth:Ye,adjustedHeight:Xe,resolvedForeground:Qe,resolvedBackground:Ke,transition:Je,introEnabled:tt,tableId:nt,frameRuntime:rt,rafRef:ot,renderFnRef:it,scheduleRender:st,currentTheme:at}=He,lt=function(){const[e,t]=(0,or.useState)(!1);return ir(()=>{t(!0)},[]),e}(),ct=function(){const e=(0,or.useSyncExternalStore)(sr,ar,lr);return(0,or.useRef)(e).current}(),ut=(0,u.useMemo)(()=>Array.isArray(s)?qr(s):s,[s]),dt=(0,u.useMemo)(()=>qr(a),[a]),ht=(0,u.useMemo)(()=>qr(l),[l]),ft=(0,u.useMemo)(()=>null!=M?M:"orthographic"===Xo(n),[M,n]),pt=function(e){const t=(0,hr.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return pr(e,t);if(!mr(e)||!mr(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const n=e[r],o=t[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!pr(n,o))return!1}else{if(!mr(n)||!mr(o))return!1;if(!fr(n,o))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,u.useMemo)(()=>({projection:n,projectionExtent:r,fitPadding:o,xAccessor:p,yAccessor:m,lineDataAccessor:y,lineType:v,flowStyle:x,areaStyle:H,pointStyle:F,lineStyle:$,colorScheme:q,themeSemantic:et(at),themeSequential:at?.colors?.sequential,themeDiverging:at?.colors?.diverging,themeCategorical:at?.colors?.categorical,graticule:w,projectionTransform:i,windowSize:_,clock:rt.now,decay:re,pulse:oe,transition:Je,introAnimation:tt,annotations:ee,pointIdAccessor:g,lineIdAccessor:b,customLayout:c,layoutConfig:d,onLayoutError:f,layoutMargin:Ze}),[n,r,o,p,m,y,v,x,H,F,$,q,at,w,i,_,rt.now,re,oe,Je,tt,ee,g,b,c,d,f,Ze])),mt=(0,u.useRef)(null);mt.current||(mt.current=new Ce(pt));const yt=(0,u.useRef)(null),bt=(0,u.useRef)(null),vt=(0,u.useRef)(null);R&&!vt.current&&(vt.current=new Ro(P||256));const xt=(0,u.useRef)(ee),wt=(0,u.useRef)(null),kt=(0,u.useRef)(co.zoomIdentity),jt=(0,u.useRef)(!1),Lt=(0,u.useRef)(null),It=(0,u.useCallback)(e=>{Lt.current=e,Ge&&"object"==typeof Ge&&(Ge.current=e)},[Ge]),Dt=(0,u.useRef)(null),Tt=(0,u.useRef)(null),zt=(0,u.useRef)(null),Ot=(0,u.useRef)(0);if(C&&!zt.current){const e=A?.maxPerLine??Zo();zt.current=new Lo(50*e)}const Nt=(0,u.useRef)(null),Et=(0,u.useRef)(null),Bt=(0,u.useRef)(!1),_t=(0,u.useRef)(!1),Wt=(0,Ae.useRef)(new Te("StreamGeoFrame")),Ht=(0,u.useRef)(void 0),[Ft,$t]=(0,u.useState)(null),[,qt]=(0,u.useState)(0),Gt=(0,u.useRef)(0),[Vt,Ut]=(0,u.useState)(!1),Zt=function(e,t,n,r){const o=(0,Fr.useRef)({accessor:t,onChange:n,readData:r}),i=(0,Fr.useRef)([]);return o.current={accessor:t,onChange:n,readData:r},(0,Fr.useCallback)(()=>{const{accessor:t,onChange:n,readData:r}=o.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,r=[];for(const o of e){if(!o||"object"!=typeof o)continue;const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),r.push(i))}return r}(e.current?r(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(mt,Se,Me,e=>e.getPoints());!function(e,t,n,r){(0,Mt.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,r()},[t,r,e,n])}(mt,pt,_e,st),function(e,t,n,r){const o=(0,Mt.useRef)(null);(0,Mt.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;o.current!==s&&(o.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,r())},[t,r,e,n])}(mt,h,_e,st),(0,u.useEffect)(()=>{const e=mt.current;e&&(ut&&e.setAreas(ut),a&&e.setPoints(dt),l&&e.setLines(ht),_e.current=!0,st())},[ut,a,dt,l,ht,st]);const Yt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(mt.current?.pushPoint(e),_e.current=!0,st())},[st]),Xt=(0,u.useCallback)(e=>{const t=qr(e);0!==t.length&&(mt.current?.pushMany(t),_e.current=!0,st())},[st]),Qt=(0,u.useCallback)(e=>{null!=e&&"object"==typeof e&&(mt.current?.pushLine(e),_e.current=!0,st())},[st]),Kt=(0,u.useCallback)(e=>{const t=qr(e);0!==t.length&&(mt.current?.pushManyLines(t),_e.current=!0,st())},[st]),Jt=(0,u.useCallback)(()=>{mt.current?.clear(),_e.current=!0,st()},[st]);(0,u.useImperativeHandle)(t,()=>({push:Yt,pushMany:Xt,removePoint:e=>{const t=mt.current?.removePoint(e)??[];return t.length>0&&(_e.current=!0,st()),t},pushLine:Qt,pushManyLines:Kt,removeLine:e=>{const t=mt.current?.removeLine(e)??[];return t.length>0&&(_e.current=!0,st()),t},getLines:()=>mt.current?.getLines()??[],clear:Jt,getProjection:()=>mt.current?.scales?.projection??null,getGeoPath:()=>mt.current?.scales?.geoPath??null,getCartogramLayout:()=>mt.current?.cartogramLayout??null,getCustomLayout:()=>mt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>mt.current?.lastCustomLayoutFailure??null,getZoom:()=>kt.current.k,resetZoom:()=>{const e=Lt.current;e&&wt.current&&(0,uo.select)(e).call(wt.current.transform,co.zoomIdentity)},getData:()=>mt.current?.getPoints()??[]}),[Yt,Xt,Qt,Kt,Jt,st]);const{hoverHandlerRef:en,onPointerMove:tn,onPointerLeave:nn}=He,{canvasRef:rn,interactionCanvasRef:on}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,s=(0,cr.useRef)(null),a=(0,cr.useRef)(null),l=(0,cr.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:s,cleanup:a}=e;ir(()=>{t&&n&&r.current?.cancelIntroAnimation?.(),o.current=!0,s?.(),i.current()},[t,n]);const l=(0,or.useRef)(a);l.current=a,(0,or.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,cr.useEffect)(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),(0,cr.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(He,{hydrated:lt,wasHydratingFromSSR:ct,storeRef:mt,dirtyRef:_e,cleanup:()=>vt.current?.clear(),canvasPaintDependencies:[Ye,Xe,B,pe,W,st]});(0,u.useEffect)(()=>{en.current=e=>{if(!G)return;const t=mt.current;if(!t||!t.scene.length)return;const n=rn.current;if(!n)return;const r=n.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Ye||0>i||i>Xe)return Nt.current=null,Et.current=null,$t(null),De?.(null),void st();bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Qo(bt.current);if(!s)return;const a=Yr(30,e.pointerType),l=Yr(6,e.pointerType),c=Ve(t.scene,o,i,a,s,t.quadtree,t.maxPointRadius,l);if(c){const e=c.node,t=e.datum,n=Array.isArray(t)?null:t?.properties?t:t?.data||t;let r,s;"point"===e.type?(r=e.x,s=e.y):"geoarea"===e.type?(r=e.centroid[0],s=e.centroid[1]):(r=o,s=i);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:r,y:s};Nt.current=a,Et.current=e,$t(a),De?.(a),st()}else Nt.current&&(Nt.current=null,Et.current=null,$t(null),De?.(null),st())}},[G,Ye,Xe,Ze,De,st,en,rn]),He.hoverLeaveRef.current=()=>{Nt.current=null,Et.current=null,$t(null),De?.(null),st()};const sn=(0,u.useCallback)(e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Oe)return;const n=mt.current;if(!n||!n.scene.length)return void Oe(null);const r=e.currentTarget.getBoundingClientRect(),o=e.clientX-r.left-Ze.left,i=e.clientY-r.top-Ze.top;if(0>o||o>Ye||0>i||i>Xe)return void Oe(null);bt.current||(bt.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Qo(bt.current);if(!s)return void Oe(null);const a=Yr(30,Ht.current),l=Yr(6,Ht.current),c=Ve(n.scene,o,i,a,s,n.quadtree,n.maxPointRadius,l);if(c){const e=c.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,n=t?.properties?{...t,...t.properties}:t;return void Oe({...n,data:t,properties:t?.properties,__semioticHoverData:!0,x:o,y:i,time:o,value:i},{type:"activate",inputType:(u=Ht.current,"touch"===u?"touch":"pointer")})}var u;Oe(null)},[Xe,Ye,Oe,Ze]),{kbFocusIndexRef:an,focusedNavPointRef:ln,onKeyDown:cn}=function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:o,customClickBehavior:i,scheduleRender:s}){const a=(0,ti.useRef)(-1),l=(0,ti.useRef)(null),c=(0,ti.useCallback)(c=>{if(function(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']")}(c))return;const u=e.current;if(!u)return;const d=()=>{a.current=-1,l.current=null,t.current=null,n&&(n.current=null),r(null),o(null),s()};if(0===u.scene.length)return void(0>a.current||d());const h=function(e){const t=[];for(const n of e)if("point"===n.type&&null!=n.x)t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const e=qe(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"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}(u.scene);if(0===h.length)return void(0>a.current||d());let f=a.current;if(h.length>f||(d(),f=-1),("Enter"===c.key||" "===c.key)&&f>=0)return c.preventDefault(),void i(ni(h[f]),{type:"activate",inputType:"keyboard"});const p=function(e,t,n){switch(e){case"ArrowRight":case"ArrowDown":return n-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}(c.key,0>f?-1:f,h.length);if(null===p)return;if(c.preventDefault(),0>p)return void d();const m=0>f?0:p;a.current=m;const y=h[m];l.current=y;const g=ni(y);t.current=g,r(g),o(g,{type:"focus",inputType:"keyboard"}),s()},[i,o,t,n,s,r,e]);return{kbFocusIndexRef:a,focusedNavPointRef:l,onKeyDown:c}}({storeRef:mt,hoverRef:Nt,hoveredNodeRef:Et,setHoverPoint:$t,customHoverBehavior:De,customClickBehavior:Oe,scheduleRender:st}),un=(0,u.useCallback)(e=>{Ht.current=e.pointerType,an.current=-1,ln.current=null,tn(e)},[ln,an,tn]),dn=(0,u.useCallback)(e=>{Ht.current=e.pointerType},[]);it.current=()=>{if(ot.current=null,!rt.isActive)return;const e=rn.current,t=mt.current;if(!e||!t)return;const n=rt.now();let r=!1;const o=Tt.current;let i=!1;o&&(Tt.current=null,t.applyRotation(o,{width:Ye,height:Xe}),i=!0);const s=t.advanceTransition(Fe.current?n+1e6:n),a=!Fe.current&&s,l=Wt.current.beforeCompute(t.getLastUpdateResult(),a);let c=!1;if(_e.current&&!s){const n={width:Ye,height:Xe},r=ft?t.getRotation():null;t.computeScene(n);const o=kt.current,i=1!==o.k||0!==o.x||0!==o.y;ft&&r?i?(t.setRotation(r),t.applyZoomScale(o.k,n)):t.applyRotation(r,n):i&&t.applyZoomTransform(o,n),_e.current=!1,c=!0,e.setAttribute("aria-label",Cr(t.scene,"Geographic chart")),Zt()}Wt.current.afterCompute(l,c,!1);const u=Mo(),d=C&&!Fe.current&&!!zt.current,h=t.consumeStylePaintPending(),f=function(e,t,n,r){const o=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!o)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}(t,n,c,_t),p=!!((m={dirtyOrRebuilt:c,transitioning:a,continuous:d,liveEncoding:f.changed,forced:i||h}).dirtyOrRebuilt||m.transitioning||m.animationTicked||m.continuous||m.liveEncoding||m.forced);var m;if(R&&vt.current){const e=yt.current;if(e&&t.scales?.projection){const n=So(e,Ue,Ze,u);if(n){n.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),n.save(),n.beginPath(),n.rect(0,0,Ye,Xe),n.clip();const e=function(e,t){const{tileURL:n,projection:r,width:o,height:i,tileCache:s,onTileLoad:a}=t,l=r.scale(),c=r.translate(),u=function(e){const{size:t,scale:n,translate:r,clampX:o=!0,clampY:i=!0}=e,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),l=1<<a,c=Math.pow(2,s-a+8),u=r[0]-n/2,d=r[1]-n/2,h=Math.max(o?0:-1/0,Math.floor((0-u)/c)),f=Math.min(o?l:1/0,Math.ceil((t[0]-u)/c)),p=Math.max(i?0:-1/0,Math.floor((0-d)/c)),m=Math.min(i?l:1/0,Math.ceil((t[1]-d)/c)),y=[];for(let e=p;m>e;++e)for(let t=h;f>t;++t)y.push([t,e,a]);return{tiles:y,translate:[u/c,d/c],scale:c}}({size:[o,i],scale:2*l*Math.PI,translate:c}),d=Mo();let h=!0;for(const t of u.tiles){const[r,o,i]=Co(t),l=`${i}/${r}/${o}`;let c=s.get(l);if(!c){const e=new Image;e.crossOrigin="anonymous";const t={img:e,loaded:!1,key:l,lastUsed:performance.now()};s.set(l,t),e.onload=()=>{t.loaded=!0,a?.()},e.onerror=()=>{t.loaded=!0},e.src=Ao(n,i,r,o,d),c=t}if(!c.loaded){h=!1;continue}const f=u.scale;e.drawImage(c.img,(t[0]+u.translate[0])*f-.5,(t[1]+u.translate[1])*f-.5,f+1,f+1)}return h}(n,{tileURL:R,projection:t.scales.projection,width:Ye,height:Xe,tileCache:vt.current,onTileLoad:()=>st()});n.restore(),e||(r=!0)}}}if(p){const o=So(e,Ue,Ze,u);if(!o)return;o.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),R||function(e,t){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===n)return!1;if(r)return!1;const c=n||(o&&"transparent"!==o?o:"")||null;if(!c)return!1;const u=gt(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(o,{background:B,hasBackgroundGraphics:!!pe,width:Ye,height:Xe}),o.save(),o.beginPath(),o.rect(0,0,Ye,Xe),o.clip();const i=t.scene,s={width:Ye,height:Xe};if(function(e){const{context:t,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=e;if(!r||"sketchy"===r)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=Wo(r,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:o})}finally{t.restore()}l||(Ho(n.id,e.type??"unknown"),i([e]))}a()}({context:o,nodes:i,renderMode:W,pixelRatio:u,paintBuiltIn:e=>{!function(e,t){const n=t.filter(e=>"geoarea"===e.type);for(const t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));const n=t._cachedPath2D,r=mo(e,t.style.fill)||"#e0e0e0";if("none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke){if(e.strokeStyle=gt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||.5,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)}vo(e,t,n),e.globalAlpha=1,e.setLineDash([])}}(o,e),((e,t,n,r)=>{const o=t.filter(e=>"line"===e.type);for(const t of o){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const o=t.style.stroke||"#007bff",i=gt(e,o)||o,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ko(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=fo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*n,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){let n=function(t,n,r){e.beginPath(),e.strokeStyle=t,e.moveTo(n,r),d=!0},r=function(){d&&(e.stroke(),d=!1)},o=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,f]=t.path[d],p=l[d],m=wo(p,a,i);if(null!==o&&null!==u&&null!==c){if(m===u)e.lineTo(h,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=o+(h-o)*l.t,u=s+(f-s)*l.t,d=wo(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),r(),n(d,t,u)}e.lineTo(h,f)}o=h,s=f,c=p,u=m}else n(m,h,f),o=h,s=f,c=p,u=m}r()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?yo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,xo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=po(e,t.style.fill,t.style.fill),c&&!u)(0,xo.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,r]=t.path[0];e.moveTo(n,r);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(n,r.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}})(o,e,0,s),((e,t)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const r of n)e.beginPath(),e.arc(r.x,r.y,r.r,0,2*Math.PI),e.globalAlpha=t*(r.style.opacity??r.style.fillOpacity??1),e.fillStyle=po(e,r.style.fill,"#4e79a7"),e.fill(),r.style.stroke&&(e.strokeStyle=po(e,r.style.stroke,r.style.stroke),e.lineWidth=r.style.strokeWidth||1,e.stroke()),bo(e,r)}finally{e.restore()}}})(o,e),((e,t)=>{const n=e.globalAlpha;for(const r of t)"glyph"===r.type&&jo(e,r,r.x,r.y,n);e.globalAlpha=n})(o,e)}}),d&&zt.current){const e=zt.current,t=i.filter(e=>"line"===e.type);if(t.length>0){const i=A||{},s=.3*(i.speedMultiplier??1),a=i.maxPerLine??Zo(),l=i.spawnRate??(Uo()?.06:.15),c=i.radius??2,u=i.opacity??.7,d=n/1e3,h=Ot.current>0?Math.min(d-Ot.current,.1):.016;Ot.current=d;const f=t.map(e=>e.path),p=t.map(e=>e.style.strokeWidth||2);for(let n=0;t.length>n;n++)rt.random()<l&&e.countForLine(n)<a&&e.spawn(n,rt.random);e.step(h,s,f,p),o.globalAlpha=u;for(let n=0;e.particles.length>n;n++){const r=e.particles[n];if(!r.active)continue;const s=t[r.lineIndex],a="function"==typeof i.color?i.color(s?.datum??{}):"source"!==i.color&&i.color?i.color:s?.style.stroke||"#fff";o.beginPath(),o.arc(r.x,r.y,c,0,2*Math.PI),o.fillStyle=a,o.fill()}o.globalAlpha=1,r=!0}}o.restore()}const y=Et.current,g=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=g||Bt.current;const v=on.current;if(v&&b){const e=So(v,Ue,Ze,u);if(e){if(e.clearRect(-Ze.left,-Ze.top,Ue[0],Ue[1]),y&&"geoarea"===y.type){const t=new Path2D(y.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(y&&"point"===y.type){const t=y,n="object"==typeof V?V:void 0,r=n?.pointColor||function(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}(y);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()}}Bt.current=g}const x=ee!==xt.current;x&&(xt.current=ee),(c||x||a&&ee&&ee.length>0)&&(c||x||n-Gt.current>=33)&&(qt(e=>e+1),Gt.current=n),(a||null!=t.activeTransition||f.pending||r)&&st()},function(e,t,n,r,o,i){const s=(0,Ct.useRef)("fresh");(0,Ct.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=function(e,t){if(!e||0>=t)return Rt;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},o=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...At,...e.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Rt}(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&i(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(a)},[e,o,r,t,i,n])}(ae,mt,_e,st,Vt,Ut),(0,u.useEffect)(()=>{if("production"!==process.env.NODE_ENV&&R){const e=Xo(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.`)}},[R,n]),(0,u.useEffect)(()=>{const e=Lt.current;if(!k||!e)return wt.current&&e&&((0,uo.select)(e).on(".zoom",null),wt.current=null),void(e&&(0,uo.select)(e).on("mousedown.rotate",null).on("touchstart.rotate",null));const[t,n]=j||[1,8],r={width:Ye,height:Xe};if(ft){let o=kt.current.k;const i=e=>{o=Math.max(t,Math.min(n,e)),kt.current=co.zoomIdentity.scale(o);const i=mt.current;i&&(i.applyZoomScale(o,r),_e.current=!1,st(),i.scales?.projection&&S?.({projection:i.scales.projection,zoom:i.currentZoom}))};wt.current={scaleBy:(e,t)=>i(o*t),transform:(e,t)=>i(t?.k??1)};const s=e=>{e.preventDefault(),i(o*(0>e.deltaY?1.1:1/1.1))},a=e=>{const t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),i(1.5*o))};e.addEventListener("wheel",s,{passive:!1}),e.addEventListener("dblclick",a);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=mt.current;if(!r)return;const o=r.getRotation();Dt.current={x:t.clientX,y:t.clientY,rotation:[...o]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{const t=Dt.current;t&&(Tt.current=[t.rotation[0]+(e.clientX-t.x)*l,Math.max(-90,Math.min(90,t.rotation[1]-(e.clientY-t.y)*l)),t.rotation[2]],st())},d=t=>{if(!Dt.current)return;Dt.current=null,e.releasePointerCapture(t.pointerId);const n=Tt.current;if(n){Tt.current=null;const e=mt.current;e&&(e.applyRotation(n,r),st())}const o=mt.current;o?.scales?.projection&&S?.({projection:o.scales.projection,zoom:o.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",d),e.addEventListener("pointercancel",d),()=>{e.removeEventListener("wheel",s),e.removeEventListener("dblclick",a),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",d),e.removeEventListener("pointercancel",d),wt.current=null}}const o=(0,co.zoom)().scaleExtent([t,n]).extent([[0,0],[Ue[0],Ue[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{const t=e.transform;kt.current=t,jt.current=!0;const n=mt.current;n&&(n.applyZoomTransform(t,r),_e.current=!1,st())}).on("end",e=>{kt.current=e.transform,jt.current=!1;const t=mt.current;t?.scales?.projection&&S?.({projection:t.scales.projection,zoom:t.currentZoom})});return wt.current=o,(0,uo.select)(e).call(o),()=>{(0,uo.select)(e).on(".zoom",null)}},[k,j,ft,Ue,Ye,Xe,Ze,S,st]);const hn=G&&!1!==V,pn=hn&&Ft?U?U(Ft):(0,ri.jsx)(qo,{data:Ft}):null,mn=pn?(0,ri.jsx)(lo,{x:Ft.x,y:Ft.y,containerWidth:Ye,containerHeight:Xe,margin:Ze,className:"stream-frame-tooltip",zIndex:10,children:pn}):null;if(rr||!lt&&ct){const e=mt.current;e&&(ut||a||l)&&(ut&&e.setAreas(ut),a&&e.setPoints(dt),l&&e.setLines(ht),e.computeScene({width:Ye,height:Xe}));const t=e?.scene??[];return(0,ri.jsxs)("div",{ref:It,className:"stream-geo-frame"+(E?" "+E:""),role:"img","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:z?"100%":Ue[0],height:O?"100%":Ue[1]},children:[(0,ri.jsx)(Wr,{summary:Ie}),(0,ri.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ue[0],height:Ue[1],style:{position:"absolute",left:0,top:0},children:[(0,ri.jsx)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:Ke}),(0,ri.jsxs)("g",{transform:`translate(${Ze.left},${Ze.top})`,children:[B&&(0,ri.jsx)("rect",{x:0,y:0,width:Ye,height:Xe,fill:B}),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:r,fallback:o}=e,i=Wo(r,t);if(!i)return o();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(Ho(i.id,t.type??"unknown"),o())}({node:e,index:t,renderMode:W,fallback:()=>function(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=fn(n.style.fill)?gn(n.style.fill,`geoarea-${t}-hatch`):void 0;return(0,tr.jsxs)(er.Fragment,{children:[r&&(0,tr.jsx)("defs",{children:r}),(0,tr.jsx)("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:nr(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._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=fn(n.style.fill)?gn(n.style.fill,`geopoint-${t}-hatch`):void 0;return(0,tr.jsxs)(er.Fragment,{children:[r&&(0,tr.jsx)("defs",{children:r}),(0,tr.jsx)("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:nr(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(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return(0,tr.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":return function(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=Be(o,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=$e(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:We(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:We(n.stroke??"none",a,e.accent);return o||i?(0,tr.jsx)("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return(0,tr.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,tr.jsx)("clipPath",{id:c,children:(0,tr.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,tr.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,tr.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}(e,t)}))]})]}),(0,ri.jsx)(Jn,{width:Ye,height:Xe,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ze,showAxes:!1,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,foregroundGraphics:To(Qe,Bo(mt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,pointNodes:Fo(t)})]})}return(0,ri.jsxs)("div",{ref:It,className:"stream-geo-frame"+(E?" "+E:""),role:"group","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),tabIndex:0,style:{position:"relative",width:z?"100%":Ue[0],height:O?"100%":Ue[1],overflow:Z?"visible":"hidden",...k?{touchAction:"none"}:{}},onKeyDown:cn,children:["production"!==process.env.NODE_ENV&&mt.current&&(0,ri.jsx)(ze,{store:mt.current,diagnostics:Wt.current}),Le&&(0,ri.jsx)(Hr,{tableId:nt}),Le&&(0,ri.jsx)(_r,{scene:mt.current?.scene??[],chartType:"Geographic chart",tableId:nt,chartTitle:"string"==typeof ye?ye:void 0}),(0,ri.jsx)(Wr,{summary:Ie}),(0,ri.jsx)(wr,{hoverPoint:Ft}),(0,ri.jsxs)("div",{role:"img","aria-label":Pe||("string"==typeof ye?ye:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:hn?un:void 0,onPointerLeave:hn?nn:void 0,onPointerDown:hn||Ne?dn:void 0,onClick:Ne?sn:void 0,children:[(0,ri.jsx)(dr,{size:Ue,margin:Ze,children:Ke}),R&&(0,ri.jsx)("canvas",{ref:yt,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,ri.jsx)("canvas",{ref:rn,"aria-label":Cr(mt.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),(0,ri.jsx)("canvas",{ref:on,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,ri.jsx)(Jn,{width:Ye,height:Xe,totalWidth:Ue[0],totalHeight:Ue[1],margin:Ze,showAxes:Re,title:ye,legend:ge,legendPosition:be,legendLayout:ve,legendHoverBehavior:xe,legendClickBehavior:we,legendHighlightedCategory:ke,legendIsolatedCategories:je,foregroundGraphics:To(Qe,Bo(mt.current?.customLayoutOverlays,h??null)),annotations:ee,onAnnotationActivate:te,onObservation:K??Q,chartId:J,chartType:"StreamGeoFrame",autoPlaceAnnotations:ne,pointNodes:Fo(mt.current?.scene)}),ae?.showBadge&&(0,ri.jsx)(Pt,{isStale:Vt,position:ae.badgePosition}),k&&(0,ri.jsxs)("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:Ze.bottom+8,left:Ze.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[(0,ri.jsx)("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();const t=Lt.current,n=wt.current;t&&n?.scaleBy&&n.scaleBy((0,uo.select)(t),1.5)},style:Yo,children:"+"}),(0,ri.jsx)("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();const t=Lt.current,n=wt.current;t&&n?.scaleBy&&n.scaleBy((0,uo.select)(t),1/1.5)},style:Yo,children:"−"})]}),L&&(0,ri.jsx)("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:Ze.bottom+2,right:Ze.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}),(0,ri.jsx)(Ur,{active:an.current>=0,hoverPoint:Ft,margin:Ze,size:Ue,shape:ln.current?.shape,width:ln.current?.w,height:ln.current?.h,pathData:ln.current?.pathData}),mn]})]})}));oi.displayName="StreamGeoFrame";var ii=oi,si=require("react");function ai(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}var li=require("react"),ci=require("react"),ui=(require("react/jsx-runtime"),(0,ci.createContext)(null));function di(){return(0,ci.useContext)(ui)}var hi=require("react");function fi(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function pi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function mi(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[yi,gi]=Ke(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!mi(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),s=pi(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=pi(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}})),bi=require("react"),vi=(require("react"),{positions:new Map}),xi=new Set;function wi(){for(const e of xi)e()}function ki(e,t){const n=vi.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(vi.positions);r.delete(e),vi={positions:r},wi()}function ji(e,t){const n=vi.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(vi.positions);r.delete(e),vi={positions:r},wi()}function Si(e){const t=(0,bi.useId)(),n=e.clientId||t,{name:r}=e,o=gi(e=>e.selections.get(r)),i=gi(e=>e.setClause),s=gi(e=>e.clearClause),a=(0,bi.useMemo)(()=>!!o&&o.clauses.size>0,[o]);return{predicate:(0,bi.useMemo)(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(fi(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:a,selectPoints:(0,bi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:(0,bi.useCallback)(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:(0,bi.useCallback)(()=>{s(r,n)},[s,r,n]),clientId:n}}function Mi(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:s}=Si({name:t,fields:n});return{onHover:(0,bi.useCallback)(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(t)&&i(t)},[n,i,s]),predicate:r,isActive:o}}require("react/jsx-runtime");var Ci=(0,hi.createContext)(!1);(0,hi.createContext)(!1);var Ai=(0,hi.createContext)(null),Ri="undefined"==typeof window?hi.useEffect:hi.useLayoutEffect;function Li(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}var Pi=.5;function Ii(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??Pi;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var Di=l(require("react"));function Ti(){return lt(e=>e.theme)}function zi(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Oi(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function Ni(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=>Oi(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)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])zi(e[r])&&zi(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}function Ei(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Bi(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?{...t,xValue:e.xValue}:t||{}}function _i(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),Di.createContext(void 0);var Wi="#007bff",Hi=[],Fi=44,$i={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:Fi,snap:"nearestDatum",brushHandleSize:Fi,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function qi(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!o&&!i)return $i;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??Fi,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??Fi,standardControls:a.standardControls??!1}}function Gi(){const e=Ti(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function Vi({selection:e,linkedHover:t,fallbackFields:n=Hi,unwrapData:r=!1,onObservation:o,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,li.useId)(),h=(0,li.useMemo)(()=>Li(t,n),[t,n]),f=(0,li.useMemo)(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),p=Si({name:e?.name||"__unused__",fields:f}),m=Mi({name:h?.name||"hover",fields:f}),y=Tt(e=>e.pushObservation),g=(0,li.useCallback)(e=>{o?.(e),y?.(e)},[o,y]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[v,x]=(0,li.useState)(null),w=(0,li.useRef)(!1),k=c||n[0],j=(0,li.useMemo)(()=>{if(!l||null==v||!k)return null;const e=v,t=k;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,v,k]),S=(0,li.useCallback)((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=Ei(e,t,h.xField);null!=n&&function(e,t,n){const r=vi.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(vi={positions:new Map(vi.positions).set(e,{xValue:t,sourceId:n})},wi())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&m.onHover(t)}else"x-position"!==h?.mode||r||ki(h.name||"hover",d),"x-position"===h?.mode||r||m.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[k];x(null!=n?n+"":null)}else r||x(null);(o||y)&&Ko({onObservation:g,datum:e?Bi(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,m,h,d,o,i,s,y,g,l,k,u]),M=(0,li.useCallback)((n=!0)=>{w.current=!1,t&&"x-position"!==h?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&x(null),"x-position"===h?.mode&&(ji(h.name||"hover",d),ki(h.name||"hover",d))},[t,h,m,e,u,p,l,d]),C=(0,li.useCallback)((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Ei(n,e,h.xField);null!=t&&function(e,t,n){const r=vi.positions.get(e);if(r?.locked){const t=new Map(vi.positions);return t.delete(e),vi={positions:t},wi(),!1}vi={positions:new Map(vi.positions).set(e,{xValue:t,sourceId:n,locked:!0})},wi()}(h.name||"hover",t,d)}if(c)if(n){w.current=!0;const r=Bi(n);if(t&&"x-position"!==h?.mode&&m.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}_i(e)&&p.selectPoints(e)}if(l&&k){const e=r?.[k];x(null!=e?e+"":null)}}else b&&M();if(n||b){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(o||y)&&Jo({onObservation:g,datum:n?Bi(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:r})}},[a,o,y,g,i,s,h,d,u,t,m,e,p,f,l,k,M]);return(0,li.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&M()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,M]),(0,li.useEffect)(()=>()=>{w.current&&M(!1)},[M]),(0,li.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{ji(e,d),ki(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:j,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function Ui({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,hi.useContext)(Ci),c=null!==(0,hi.useContext)(Ai),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=(0,li.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,d]);!function(e){const t=(0,hi.useContext)(Ai),n=(0,hi.useId)(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=(0,hi.useRef)([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;Ri(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Ri(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?h:[]);const f=(0,li.useMemo)(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const s=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),a=s?r(s,t,n):n?n(o):_[i%_.length];return{label:o+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:H,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,h]),p=(0,li.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return f&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,o]);return{legend:f,margin:p,legendPosition:o}}var Zi={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}}};function Yi(e,t,n){const r=Zi[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,s=Ni({...t,mode:e},{width:t.width??o,height:t.height??i}).props,a=s.mode||e,l=Zi[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Xi(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:qi(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Xi(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 Qi(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(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 Ki(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>es(t(e))}function Ji(e,t){const n=Ki(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:t+""}}}function es(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 ts(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 o=es(r);if(void 0===o)return!1;if(void 0!==e.gt&&e.gt>=o)return!1;if(void 0!==e.gte&&e.gte>o)return!1;if(void 0!==e.lt&&o>=e.lt)return!1;if(void 0!==e.lte&&o>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>o||o>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(o>=t&&n>=o)return!1}return!0}function ns(e,t,n){const r=e.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(t,n):ts(r,t,n))}function rs(e,t,n){if(!t||0===t.length)return{};let r={};for(const o of t){if(!ns(o,e,n))continue;const t="function"==typeof o.style?o.style(e,n):o.style;t&&(r={...r,...t})}return r}function os(e,t,n,r=e=>e){const o=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=r(e),a={...o(e,i)};return Object.assign(a,rs(s,t,n(s,i))),a}:o}var is=require("react/jsx-runtime");function ss({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return(0,is.jsx)("div",{role:"alert",style:{width:r,height:Math.max(o,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:(0,is.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,is.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,is.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,is.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})]})})}var as=l(require("react")),ls=require("react/jsx-runtime"),cs=class extends as.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:(0,ls.jsx)(ss,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},us=require("react/jsx-runtime"),ds="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function hs({componentName:e,width:t,height:n,children:r}){return(0,us.jsx)(cs,{fallback:r=>(0,us.jsx)(ss,{componentName:e,message:r.message,width:t,height:n}),children:r})}var fs={display:"flex",alignItems:"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"},ps={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function ms(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,us.jsx)("div",{style:{...fs,width:t,height:n},children:r||"No data available"}):null}function ys(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,us.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),s=Math.max(6,Math.floor(n/(2.5*o))),a=Math.floor((n-(o*(i+s)-s))/2);return(0,us.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>(0,us.jsx)("div",{className:"semiotic-loading-bar",style:{...ps,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function gs(e,t,n,r){if(!ds)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}var bs=require("react");function vs(e){const t=lt(e=>e.theme.colors.selectionOpacity);return(0,bs.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}var xs=require("d3-scale"),ws=require("react"),ks=require("topojson-client"),js=new Map;function Ss(e){return"default"in e?e.default:e}var Ms="Install the optional peer dependency `world-atlas` (`npm install world-atlas`) to use built-in reference geographies, or pass GeoJSON Feature[] to `areas`.";async function Cs(e){const t=js.get(e);if(t)return t;const{topology:n,objectName:r}=await async function(e){try{switch(e){case"world-110m":return{topology:Ss(await import("world-atlas/countries-110m.json")),objectName:"countries"};case"world-50m":return{topology:Ss(await import("world-atlas/countries-50m.json")),objectName:"countries"};case"land-110m":return{topology:Ss(await import("world-atlas/land-110m.json")),objectName:"land"};case"land-50m":return{topology:Ss(await import("world-atlas/land-50m.json")),objectName:"land"};default:throw Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){if(/Cannot find module|Failed to resolve|world-atlas/i.test(t instanceof Error?t.message:t+""))throw Error(`resolveReferenceGeography("${e}"): ${Ms}`,{cause:t});throw t}}(e);if(!n||!n.objects)throw Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof n} with keys: ${n?Object.keys(n).join(", "):"none"}`);const o=(0,ks.feature)(n,n.objects[r]),i="features"in o?o.features:[o];return js.set(e,i),i}function As(e){const t=(0,ws.useMemo)(()=>Array.isArray(e)?e:void 0,[e]),[n,r]=(0,ws.useState)(null);return(0,ws.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),Cs(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 Rs(e){const{title:t,description:n,summary:r,accessibleTable:o,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Ls(e){const{linkedHover:t,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,f={};r&&(f.annotationObservationCallback=r);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||o||s)&&(f.customHoverBehavior=u),d&&(l||(h?r||o||t:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=d),null!=p&&(f.hoverRadius=p),f}var Ps=require("react/jsx-runtime");function Is(e){const t=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),n=function(){const e=Ti();return e?.colors?.sequential||void 0}(),{areas:r,valueAccessor:o,styleRules:i,colorScheme:s,projection:a="equalEarth",graticule:l,fitPadding:c,zoomable:u,zoomExtent:d,onZoom:h,dragRotate:f,tileURL:p,tileAttribution:m,tileCacheSize:y,tooltip:g,areaOpacity:b=1,annotations:v,margin:x,className:w,selection:k,linkedHover:j,onObservation:S,onClick:M,chartId:C,loading:A,loadingContent:R,emptyContent:L,frameProps:P={},stroke:I,strokeWidth:D,opacity:T}=e,z=u??!!p,O=As(r),E=(0,si.useMemo)(()=>O?qr(O):O,[O]),B=(0,si.useMemo)(()=>"function"==typeof o?o:e=>e?.properties?.[o]??e?.[o],[o]),_=s??n??"blues",W=(0,si.useMemo)(()=>{if(!E)return(0,xs.scaleSequential)(N(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(const n of E){const r=B(n);null!=r&&isFinite(r)&&(e>r&&(e=r),r>t&&(t=r))}const n=N(_);return(0,xs.scaleSequential)(n).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[E,B,_]),{activeSelectionHook:H,customHoverBehavior:F,customClickBehavior:$}=Vi({selection:k,linkedHover:j,onObservation:S,onClick:M,chartType:"ChoroplethMap",chartId:C,mobileInteraction:t.mobileInteraction}),q=vs(k),G=(0,si.useMemo)(()=>{const e=Qi(os(e=>{const t=B(e);return{fill:null!=t&&isFinite(t)?W(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:b}},i,e=>({value:B(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),{stroke:I,strokeWidth:D,opacity:T});return H?Ii(e,H,q):e},[B,W,H,q,b,I,D,T,i]),V=(0,si.useMemo)(()=>e=>{const t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",n=B(e);return(0,Ps.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Ps.jsx)("div",{style:{fontWeight:600},children:t}),null!=n&&(0,Ps.jsx)("div",{style:{opacity:.7},children:(r=n,"number"==typeof r&&isFinite(r)?Number.isInteger(r)?r.toLocaleString():r.toLocaleString(void 0,{maximumFractionDigits:2}):(r??"")+"")})]});var r},[B]),U=(0,si.useMemo)(()=>({top:10,right:10,bottom:10,left:10,...ai(x)}),[x]),Z=ys(A,t.width,t.height,R)||(E?null:ys(!0,t.width,t.height,R)),Y=Z?null:ms(E,t.width,t.height,L);if(Array.isArray(E)&&E.length>0){const e=E[0];if(!e||"object"!=typeof e||!e.geometry)return(0,Ps.jsx)(ss,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}const X={projection:a,areas:E,areaStyle:G,size:[t.width,t.height],margin:U,enableHover:!0,tooltipContent:!1===g?()=>null:!0===g?V:so(g)||V,...null!=l&&{graticule:l},...null!=c&&{fitPadding:c},...z&&{zoomable:!0},...d&&{zoomExtent:d},...h&&{onZoom:h},...null!=f&&{dragRotate:f},...p&&{tileURL:p},...m&&{tileAttribution:m},...y&&{tileCacheSize:y},...Ls({linkedHover:j,selection:k,onObservation:S,onClick:M,mobileInteraction:t.mobileInteraction,customHoverBehavior:F,customClickBehavior:$,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},...w&&{className:w},...null!=e.animate&&{animate:e.animate},...P};return Z||Y||(0,Ps.jsx)(hs,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:(0,Ps.jsx)(ii,{...X})})}Is.displayName="ChoroplethMap";var Ds=require("react"),Ts=require("react");function zs(e){const{data:t,rawData:n,colorBy:r,colorScheme:o,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:f,showLegend:p,userMargin:m,marginDefaults:y,onClick:g,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:w,loadingContent:k,emptyContent:j,width:S,height:M}=e,C=void 0===n,A=(0,Ts.useMemo)(()=>qr(t),[t]),[R,L]=(0,Ts.useState)([]),P=(0,Ts.useCallback)(e=>{L(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),I="string"==typeof e.colorBy?e.colorBy:void 0,D=(0,Ts.useMemo)(()=>qi(v,{width:S,mobileSemantics:x}),[v,S,x]),{activeSelectionHook:T,hoverSelectionHook:z,customHoverBehavior:O,customClickBehavior:N,crosshairSourceId:E}=Vi({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:f,onClick:g,hoverHighlight:b,colorByField:I,mobileInteraction:D}),B=function(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}(l,E),W=function(e,t,n){const r=di(),o=Gi();return(0,li.useMemo)(()=>{if(!t)return;const i=r??void 0,s=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&_i(i)){const e=$(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return $(n.map(e=>({_cat:e})),"_cat",s)}if(i&&_i(i)){const n=$(e,t,s);return e=>i[e]||n(e)}return $(e,t,s)}if(i&&_i(i)){const e=$([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,r,o])}(A,r,o),H=(0,Ts.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of A){const n="function"==typeof r?r(t):t[r];null!=n&&e.add(n+"")}return Array.from(e)},[A,r]),F=(0,Ts.useMemo)(()=>C&&R.length>0?R:H,[C,R,H]),q=function(e,t,n){const[r,o]=(0,li.useState)(null),[i,s]=(0,li.useState)(new Set),a=(0,li.useMemo)(()=>new Set,[]),l=(0,li.useCallback)(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=(0,li.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=(0,li.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}(i,r,F),G=(0,Ts.useMemo)(()=>z||(q.legendSelectionHook?q.legendSelectionHook:T),[z,q.legendSelectionHook,T]),V=vs(a),U=Gi(),Z=di(),Y=(0,Ts.useMemo)(()=>{if(W)return W;if(!r||0===F.length)return;const e=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:U&&U.length>0?U:_,t="__streamCat",n=$(F.map(e=>({[t]:e})),t,e);return e=>Z?.[e]||n(e)||"#999"},[W,r,F,o,U,Z]),{legend:X,margin:Q,legendPosition:K}=Ui({data:A,colorBy:r,colorScale:Y,showLegend:p,legendPosition:s,userMargin:m,defaults:y,categories:F}),J=(0,Ts.useMemo)(()=>{const e={};return X&&(e.legend=X,e.legendPosition=K),i&&"none"!==i&&(e.legendHoverBehavior=q.onLegendHover,e.legendClickBehavior=q.onLegendClick,e.legendHighlightedCategory=q.highlightedCategory,e.legendIsolatedCategories=q.isolatedCategories),C&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=P),e},[X,K,i,q.onLegendHover,q.onLegendClick,q.highlightedCategory,q.isolatedCategories,C,r,P]),ee=Array.isArray(n)?qr(n):n,te=ys(w,S,M,k),ne=te?null:ms(ee,S,M,j);return{data:A,colorScale:W,allCategories:F,legendState:q,effectiveSelectionHook:G,activeSelectionHook:T,customHoverBehavior:O,customClickBehavior:N,mobileInteraction:D,legend:X,margin:Q,legendPosition:K,earlyReturn:te||ne||null,legendBehaviorProps:J,crosshairProps:B,resolvedSelection:V}}var Os=require("react");function Ns(e,t){const{variant:n,frameRef:r,overrides:o}=t;(0,Os.useImperativeHandle)(e,()=>{const e=function(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)??[],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],r=e.current?.getTopology()?.nodes??[],o=[];for(const t of n){const n=r.find(e=>e.id===t);n&&o.push({...n.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,n)=>(Array.isArray(t)?t:[t]).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}}(n,r);return{...e,...o}},[r,o,n])}var Es=require("react/jsx-runtime"),Bs=(0,Ds.forwardRef)(function(e,t){const n=(0,Ds.useRef)(null);Ns(t,{variant:"geo-points",frameRef:n});const r=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,xAccessor:i="lon",yAccessor:s="lat",sizeBy:a,sizeRange:l=[3,30],colorBy:c,styleRules:u,colorScheme:d,projection:h="equalEarth",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,areas:k,areaStyle:j={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},tooltip:S,annotations:M,margin:C,className:A,selection:R,linkedHover:L,onObservation:P,onClick:I,chartId:D,loading:T,loadingContent:z,emptyContent:O,legendInteraction:N,legendPosition:E,frameProps:B={},stroke:_,strokeWidth:W,opacity:F}=e,$=m??!!v,G=As(k),V=zs({data:o??$r,rawData:o,colorBy:c,colorScheme:d,legendInteraction:N,legendPosition:E,selection:R,linkedHover:L,fallbackFields:c?["string"==typeof c?c:""]:[],unwrapData:!1,onObservation:P,onClick:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:D,showLegend:r.showLegend,userMargin:C,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:T,loadingContent:z,emptyContent:O,width:r.width,height:r.height}),U=V.data,Z=(0,Ds.useMemo)(()=>{if(!a)return;const e="function"==typeof a?a:e=>e?.[a],t=U.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?oe(t):void 0},[U,a]),Y=(0,Ds.useMemo)(()=>{const e=Qi(os(e=>({fill:c?H(e,c,V.colorScale):Wi,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:a?q(e,a,l,Z):6}),u,Ji(c,a)),{stroke:_,strokeWidth:W,opacity:F});return V.effectiveSelectionHook?Ii(e,V.effectiveSelectionHook,V.resolvedSelection):e},[c,V.colorScale,V.effectiveSelectionHook,V.resolvedSelection,a,l,Z,_,W,F,u]),X=(0,Ds.useMemo)(()=>e=>{const t=e?.name||e?.label||e?.NAME||e?.id,n="string"==typeof a?a:null,r=("function"==typeof a?a:e=>e[a])(e),o=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):(e??"")+"",i="string"==typeof c?c:null,s=i?e?.[i]:null;return(0,Es.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&(0,Es.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:t}),n&&null!=r&&(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[n,": "]}),o(r)]}),i&&null!=s&&(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[i,": "]}),s+""]}),!t&&!n&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>(0,Es.jsxs)("div",{children:[(0,Es.jsxs)("span",{style:{opacity:.7},children:[e,": "]}),o(t)]},e))]})},[a,c]);if(V.earlyReturn)return V.earlyReturn;gs("ProportionalSymbolMap",U,"xAccessor",i),gs("ProportionalSymbolMap",U,"yAccessor",s);const Q={projection:h,...null!=o&&{points:U},xAccessor:i,yAccessor:s,pointStyle:Y,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...G&&{areas:G,areaStyle:j},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...$&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[r.width,r.height],margin:V.margin,enableHover:!0,tooltipContent:!1===S?()=>null:so(S)||X,...V.legendBehaviorProps,...Ls({linkedHover:L,selection:R,onObservation:P,onClick:I,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),...M&&M.length>0&&{annotations:M},...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},...A&&{className:A},...null!=e.animate&&{animate:e.animate},...B};return(0,Es.jsx)(hs,{componentName:"ProportionalSymbolMap",width:r.width,height:r.height,children:(0,Es.jsx)(ii,{ref:n,...Q})})});Bs.displayName="ProportionalSymbolMap";var _s=require("react"),Ws=require("d3-scale"),Hs=require("react/jsx-runtime"),Fs="__semiotic_x",$s="__semiotic_y",qs=(0,_s.forwardRef)(function(e,t){const n=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:r,nodes:o,nodeIdAccessor:i="id",xAccessor:s="lon",yAccessor:a="lat",valueAccessor:l="value",projection:c="equalEarth",graticule:u,fitPadding:d,zoomable:h,zoomExtent:f,onZoom:p,dragRotate:m,tileURL:y,tileAttribution:g,tileCacheSize:b,lineType:v="geo",flowStyle:x="basic",areas:w,areaStyle:k={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5},edgeColorBy:j,edgeOpacity:S=.6,edgeWidthRange:M=[1,8],edgeLinecap:C="round",colorScheme:A,showParticles:R,particleStyle:L,tooltip:P,annotations:I,margin:D,className:T,selection:z,linkedHover:O,onObservation:N,onClick:E,chartId:B,loading:_,loadingContent:W,emptyContent:F,frameProps:$={},legendInteraction:q,legendPosition:G,stroke:V,strokeWidth:U,opacity:Z,lineIdAccessor:Y}=e,X=h??!!y,Q=As(w),K=(0,_s.useMemo)(()=>qr(o),[o]),J=zs({data:r??$r,rawData:r,colorBy:j,colorScheme:A,legendInteraction:q,legendPosition:G,selection:z,linkedHover:O,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:N,onClick:E,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"FlowMap",chartId:B,showLegend:n.showLegend,userMargin:D,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:_,loadingContent:W,emptyContent:F,width:n.width,height:n.height}),ee=J.data,te=Li(O),ne=Mi({name:te?.name||"hover",fields:te?.fields||[]}),re=Tt(e=>e.pushObservation),ie=(0,_s.useMemo)(()=>{const e=new Map;for(const t of K)e.set(t[i]+"",t);return e},[K,i]),se=(0,_s.useRef)(null),ae=(0,_s.useRef)(ie);ae.current=ie;const le=(0,_s.useRef)(s);le.current=s;const ce=(0,_s.useRef)(a);ce.current=a;const ue=(0,_s.useCallback)(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;const t=ae.current,n=t.get(e.source+""),r=t.get(e.target+"");if(!n||!r)return null;const o="function"==typeof le.current?le.current:e=>e[le.current],i="function"==typeof ce.current?ce.current:e=>e[ce.current];return{...e,coordinates:[{[Fs]:o(n),[$s]:i(n)},{[Fs]:o(r),[$s]:i(r)}]}},[]);Ns(t,{variant:"geo-lines",frameRef:se,overrides:{push:e=>{const t=ue(e);t&&se.current?.pushLine(t)},pushMany:e=>{const t=[];for(const n of e){const e=ue(n);e&&t.push(e)}t.length>0&&se.current?.pushManyLines(t)}}});const de=(0,_s.useMemo)(()=>{const e=new Map;for(const t of ee)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},[ee]),he=(0,_s.useCallback)(e=>{if(O)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){const e=de.get(t[i]+"");e&&ne.onHover(e)}else ne.onHover(t)}else ne.onHover(null);if(N||re){const t={timestamp:Date.now(),chartType:"FlowMap",chartId:B};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};N&&N(r),re&&re(r)}else{const e={...t,type:"hover-end"};N&&N(e),re&&re(e)}}},[O,ne,i,de,N,B,re]),fe=J.customClickBehavior,pe=(0,_s.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s],t="function"==typeof a?a:e=>e[a];return ee.map(n=>{if(!n||"object"!=typeof n||null==n.source||null==n.target)return null;const r=ie.get(n.source+""),o=ie.get(n.target+"");return r&&o?{...n,coordinates:[{[Fs]:e(r),[$s]:t(r)},{[Fs]:e(o),[$s]:t(o)}]}:null}).filter(Boolean)},[ee,ie,s,a]),me=(0,_s.useMemo)(()=>{const e="function"==typeof s?s:e=>e[s];return t=>null!=t&&"object"==typeof t&&Fs in t?t[Fs]:e(t)},[s]),ye=(0,_s.useMemo)(()=>{const e="function"==typeof a?a:e=>e[a];return t=>null!=t&&"object"==typeof t&&$s in t?t[$s]:e(t)},[a]),ge=(0,_s.useMemo)(()=>{const e=ee.filter(e=>e&&"object"==typeof e).map(e=>e[l]??0).filter(e=>isFinite(e));return 0===e.length?()=>M[0]:(0,Ws.scaleLinear)().domain(oe(e)).range(M)},[ee,l,M]),be=(0,_s.useMemo)(()=>e=>({stroke:j?H(e,j,J.colorScale):Wi,strokeWidth:ge(e[l]??0),strokeLinecap:C,opacity:S}),[j,J.colorScale,ge,l,S,C]),ve=(0,_s.useMemo)(()=>{const e=Qi(be,{stroke:V,strokeWidth:U,opacity:Z});if(!J.effectiveSelectionHook)return e;const t={...J.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return Ii(e,J.effectiveSelectionHook,{...J.resolvedSelection||{},unselectedStyle:t})},[be,J.effectiveSelectionHook,J.resolvedSelection,V,U,Z]),xe=(0,_s.useMemo)(()=>Qi(()=>({fill:"#333",r:5,fillOpacity:.8}),{stroke:V,strokeWidth:U,opacity:Z}),[V,U,Z]),we=(0,_s.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)return(0,Hs.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Hs.jsx)("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){const t=e[l];return(0,Hs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Hs.jsxs)("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&(0,Hs.jsx)("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}const t=e?.name||e?.label||e?.[i];return null!=t?(0,Hs.jsx)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:(0,Hs.jsx)("div",{style:{fontWeight:600},children:t})}):null},[l,i]);if(J.earlyReturn)return J.earlyReturn;const ke={projection:c,...null!=r&&{lines:pe},points:K,xAccessor:me,yAccessor:ye,lineDataAccessor:"coordinates",...null!=Y&&{lineIdAccessor:Y},lineType:v,flowStyle:x,lineStyle:ve,pointStyle:xe,...Q&&{areas:Q,areaStyle:k},...null!=u&&{graticule:u},...null!=d&&{fitPadding:d},...X&&{zoomable:!0},...f&&{zoomExtent:f},...p&&{onZoom:p},...null!=m&&{dragRotate:m},...R&&{showParticles:R},...L&&{particleStyle:L},...y&&{tileURL:y},...g&&{tileAttribution:g},...b&&{tileCacheSize:b},size:[n.width,n.height],margin:J.margin,enableHover:!0,tooltipContent:!1===P?()=>null:so(P)||we,...J.legendBehaviorProps,...Ls({linkedHover:O,selection:z,onObservation:N,onClick:E,mobileInteraction:J.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},...T&&{className:T},...null!=e.animate&&{animate:e.animate},...$};return(0,Hs.jsx)(hs,{componentName:"FlowMap",width:n.width,height:n.height,children:(0,Hs.jsx)(ii,{ref:se,...ke})})});qs.displayName="FlowMap";var Gs=require("react"),Vs=require("react/jsx-runtime"),Us=(0,Gs.forwardRef)(function(e,t){const n=Yi(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:r,lines:o,xAccessor:i="lon",yAccessor:s="lat",nodeIdAccessor:a="id",center:l,costAccessor:c,strength:u=1,lineMode:d="straight",projection:h="mercator",graticule:f,fitPadding:p,zoomable:m,zoomExtent:y,onZoom:g,dragRotate:b,tileURL:v,tileAttribution:x,tileCacheSize:w,transition:k,colorBy:j,styleRules:S,colorScheme:M,pointRadius:C=5,tooltip:A,showRings:R=!0,ringStyle:L,showNorth:P=!0,costLabel:I,annotations:D,margin:T,className:z,selection:O,linkedHover:N,onObservation:E,onClick:B,chartId:_,loading:W,loadingContent:F,emptyContent:$,legendPosition:q,frameProps:G={},stroke:V,strokeWidth:U,opacity:Z}=e,Y=m??!!v,X=(0,Gs.useMemo)(()=>qr(r),[r]),Q=zs({data:X,rawData:r,colorBy:j,colorScheme:M,legendInteraction:void 0,legendPosition:q,selection:O,linkedHover:N,fallbackFields:j?["string"==typeof j?j:""]:[],unwrapData:!1,onObservation:E,onClick:B,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DistanceCartogram",chartId:_,showLegend:n.showLegend,userMargin:T,marginDefaults:{top:10,bottom:10,left:10,right:10},loading:W,loadingContent:F,emptyContent:$,width:n.width,height:n.height}),K=(0,Gs.useMemo)(()=>{const e=Qi(os(e=>({fill:j?H(e,j,Q.colorScale):Wi,fillOpacity:.8,stroke:"#fff",strokeWidth:1,r:C}),S,Ji(j)),{stroke:V,strokeWidth:U,opacity:Z});return Q.effectiveSelectionHook?Ii(e,Q.effectiveSelectionHook,Q.resolvedSelection):e},[j,Q.colorScale,Q.effectiveSelectionHook,Q.resolvedSelection,C,V,U,Z,S]),J=(0,Gs.useMemo)(()=>({center:l,centerAccessor:a,costAccessor:c,strength:u,lineMode:d}),[l,a,c,u,d]),ee=(0,Gs.useMemo)(()=>{if(!o)return;const e="function"==typeof i?i:e=>e[i],t="function"==typeof s?s:e=>e[s],n=new Map;for(const e of X)n.set(e[a]+"",e);return o.map(r=>{if(r.coordinates)return r;const o=n.get(r.source+""),a=n.get(r.target+"");return o&&a?{...r,coordinates:[{[i]:e(o),[s]:t(o)},{[i]:e(a),[s]:t(a)}]}:null}).filter(Boolean)},[o,X,i,s,a]),te=(0,Gs.useMemo)(()=>e=>{const t=("function"==typeof c?c:e=>e[c])(e);return(0,Vs.jsxs)("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[(0,Vs.jsx)("div",{style:{fontWeight:600},children:e[a]||e.name||e.id||"Point"}),null!=t&&(0,Vs.jsxs)("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[c,a]),ne=(0,Gs.useRef)(null);Ns(t,{variant:"geo-points",frameRef:ne});const[re,oe]=(0,Gs.useState)(null),ie=(0,Gs.useCallback)(()=>{const e=ne.current?.getCartogramLayout?.();e&&oe(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius?t:e)},[]);(0,Gs.useEffect)(()=>{const e=requestAnimationFrame(ie);return()=>cancelAnimationFrame(e)},[ie,u,l,n.width,n.height,X]);const se=(0,Gs.useMemo)(()=>{if(!R||!re)return[];const{maxCost:e}=re;if(0>=e)return[];if(Array.isArray(R))return R.filter(t=>t>0&&e>=t);const t="number"==typeof R?R:Math.min(5,Math.max(2,Math.ceil(e/5))),n=e/t,r=[];for(let e=1;t>=e;e++)r.push(Math.round(n*e*10)/10);return r},[R,re]),ae=(0,Gs.useMemo)(()=>{if(!re)return G.foregroundGraphics||null;const{cx:e,cy:t,maxCost:n,availableRadius:r}=re,o={stroke:"#999",strokeWidth:.8,strokeDasharray:"4,3",labelColor:"#777",labelSize:10,...L},i=Q.margin.left??10,s=Q.margin.top??10;return(0,Vs.jsxs)("g",{children:[se.map(a=>{const l=a/n*r;return(0,Vs.jsxs)("g",{children:[(0,Vs.jsx)("circle",{cx:e+i,cy:t+s,r:l,fill:"none",stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.strokeDasharray,opacity:.5}),(0,Vs.jsxs)("text",{x:e+i+l+3,y:t+s-2,fontSize:o.labelSize,fill:o.labelColor,fontFamily:"system-ui, sans-serif",children:[a,I?" "+I:""]})]},a)}),P&&(0,Vs.jsxs)("g",{transform:`translate(${i+24}, ${s+24})`,children:[(0,Vs.jsx)("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),(0,Vs.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"}),(0,Vs.jsx)("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"system-ui, sans-serif",children:"N"}),(0,Vs.jsx)("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),(0,Vs.jsx)("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]}),G.foregroundGraphics]})},[re,se,P,I,L,Q.margin,G.foregroundGraphics]);if(Q.earlyReturn)return Q.earlyReturn;gs("DistanceCartogram",X,"xAccessor",i),gs("DistanceCartogram",X,"yAccessor",s);const le={projection:h,...null!=r&&{points:X},...ee&&{lines:ee,lineDataAccessor:"coordinates"},xAccessor:i,yAccessor:s,pointIdAccessor:a,pointStyle:K,projectionTransform:J,...k&&{transition:{duration:k}},...null!=f&&{graticule:f},...null!=p&&{fitPadding:p},...Y&&{zoomable:!0},...y&&{zoomExtent:y},...g&&{onZoom:g},...null!=b&&{dragRotate:b},...v&&{tileURL:v},...x&&{tileAttribution:x},...w&&{tileCacheSize:w},size:[n.width,n.height],margin:Q.margin,enableHover:!0,tooltipContent:!1===A?()=>null:so(A)||te,...Q.legendBehaviorProps,...Ls({linkedHover:N,selection:O,onObservation:E,onClick:B,mobileInteraction:Q.mobileInteraction,customHoverBehavior:Q.customHoverBehavior,customClickBehavior:Q.customClickBehavior,linkedHoverInClickPredicate:!1}),...D&&D.length>0&&{annotations:D},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...n.title&&{title:n.title},...n.description&&{description:n.description},...n.summary&&{summary:n.summary},...void 0!==n.accessibleTable&&{accessibleTable:n.accessibleTable},...z&&{className:z},...null!=e.animate&&{animate:e.animate},...G,foregroundGraphics:ae};return(0,Vs.jsx)(hs,{componentName:"DistanceCartogram",width:n.width,height:n.height,children:(0,Vs.jsx)(ii,{ref:ne,...le})})});Us.displayName="DistanceCartogram";var Zs=require("react"),Ys=require("react");var Xs=require("react/jsx-runtime"),Qs=(0,Zs.forwardRef)(function(e,t){const{points:n,areas:r,lines:o,layout:i,layoutConfig:s,onLayoutError:a,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:d,colorBy:h,colorScheme:f,tooltip:p,annotations:m,margin:y,selection:g,linkedHover:b,onObservation:v,onClick:x,chartId:w,loading:k,loadingContent:j,emptyContent:S,className:M,frameProps:C={}}=e,{frameRef:A,resolved:R,normalizedMargin:L}=function(e){const t=(0,Ys.useRef)(null);return Ns(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:Yi(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,Ys.useMemo)(()=>ai(e.margin),[e.margin])}}({imperativeRef:t,imperativeVariant:"geo-points",margin:y,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}),P=(0,Zs.useMemo)(()=>qr(n),[n]),I=(0,Zs.useMemo)(()=>qr(r),[r]),D=(0,Zs.useMemo)(()=>qr(o),[o]),T=(0,Zs.useMemo)(()=>[...P,...D,...I],[P,D,I]),z=zs({data:T,rawData:void 0!==n||void 0!==o||void 0!==r?T:void 0,colorBy:h,colorScheme:f,legendInteraction:void 0,selection:g,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:R.marginDefaults,loading:k,loadingContent:j,emptyContent:S,width:R.width,height:R.height}),O=z.effectiveSelectionHook,N=(0,Zs.useMemo)(()=>O?.isActive?{isActive:!0,predicate:O.predicate}:null,[O?.isActive,O?.predicate]);if(z.earlyReturn)return z.earlyReturn;const{width:E,height:B,enableHover:_,title:W,description:H,summary:F,accessibleTable:$}=R,q=so(p),G={projection:l,...null!=n&&{points:P},...null!=r&&{areas:I},...null!=o&&{lines:D},xAccessor:c,yAccessor:u,...null!=d&&{lineDataAccessor:d},customLayout:i,layoutConfig:s,onLayoutError:a,layoutSelection:N,colorBy:h,colorScheme:f,size:[E,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:z.margin,enableHover:_,...Rs({title:W,description:H,summary:F,accessibleTable:$,className:M,animate:e.animate,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===p?{tooltipContent:()=>null}:q?{tooltipContent:q}:{},...Ls({linkedHover:b,selection:g,onObservation:v,onClick:x,hoverHighlight:!1,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...C};return(0,Xs.jsx)(hs,{componentName:"GeoCustomChart",width:E,height:B,children:(0,Xs.jsx)(ii,{ref:A,...G})})});Qs.displayName="GeoCustomChart";var Ks={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Js=8;function ea(e){const t=function(e){return null==e?void 0:e+""}(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Js,style:{...Ks},datum:e.datum,pointId:t,_transitionKey:t}}function ta(e){return ea(e)}function na(e){const[[t,n],[r,o]]=e.bounds;return{type:"geoarea",pathData:e.pathData,centroid:e.centroid,bounds:e.bounds,screenArea:e.screenArea??Math.abs((r-t)*(o-n)),style:{...Ks},datum:e.datum,group:e.group,interactive:!0}}function ra(e,t,n){const{featureKey:r,dataKey:o}=n,i=new Map;for(const e of t)i.set(e[o]+"",e);return e.map(e=>{const t=(e=>{const t=r.split(".");let n=e;for(const e of t)n=null!==n&&"object"==typeof n?n[e]:void 0;return(n??"")+""})(e),n=i.get(t);return n?{...e,properties:{...e.properties,...n}}:e})}
|