semiotic 3.10.2 → 3.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -26
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/behaviorContracts.cjs +15 -5
- package/ai/behaviorContracts.d.cts +3 -0
- package/ai/cli.js +17 -166
- package/ai/componentMetadata.cjs +68 -15
- package/ai/componentMetadata.d.cts +3 -0
- package/ai/dist/diagnose-operation.js +3 -0
- package/ai/dist/mcp-server.js +59 -59
- package/ai/reference.md +6 -6
- package/ai/schema.json +1 -1
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +2 -2
- package/ai/task-packets/compare-category-totals.json +7 -7
- package/ai/task-packets/compare-category-totals.md +3 -3
- package/ai/task-packets/correct-published-chart.json +7 -7
- package/ai/task-packets/correct-published-chart.md +3 -3
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +7 -7
- package/ai/task-packets/update-live-chart.md +3 -3
- package/dist/c-2MHSD3TN.min.js +209 -0
- package/dist/{c-PZ3NEGNG.min.js → c-6XGGN5OS.min.js} +1 -1
- package/dist/{c-FDUQDCBC.min.js → c-CO4NDAD6.min.js} +23 -23
- package/dist/c-EK6XI2U7.min.js +26 -0
- package/dist/c-FMCUQ6JX.min.js +1 -0
- package/dist/{c-C4KIXUWU.min.js → c-GK263BF4.min.js} +1 -1
- package/dist/{c-TTKWXGAI.min.js → c-HNHKIMIV.min.js} +3 -3
- package/dist/c-IJCZGUG6.min.js +31 -0
- package/dist/{c-4XLHPQTP.min.js → c-JBWPJNTJ.min.js} +1 -1
- package/dist/{c-4MD53L2J.min.js → c-JC76YAHB.min.js} +28 -28
- package/dist/{c-VXIYF7V2.min.js → c-JOPGDP6N.min.js} +1 -1
- package/dist/c-KWP4QTCM.min.js +4 -0
- package/dist/c-LRV7PO45.min.js +393 -0
- package/dist/c-LVHJJUOF.min.js +1 -0
- package/dist/c-M43PK7K4.min.js +1 -0
- package/dist/c-NUBZ63VU.min.js +1 -0
- package/dist/{c-7ASK4WBF.min.js → c-PITYSOPK.min.js} +1 -1
- package/dist/{c-2TW5H5PD.min.js → c-QPO24R7Q.min.js} +1 -1
- package/dist/{c-SG2Y7EBY.min.js → c-RWHLEUX6.min.js} +1 -1
- package/dist/{c-4JKDJUYD.min.js → c-S746GRV4.min.js} +1 -1
- package/dist/{c-KGROWFT2.min.js → c-SAP5KY6R.min.js} +2 -2
- package/dist/c-UMGHCBH5.min.js +114 -0
- package/dist/c-UQBWSYKI.min.js +41 -0
- package/dist/{c-6ZU3QVLB.min.js → c-VEMCBQZZ.min.js} +33 -33
- package/dist/{c-IPYGNVN6.min.js → c-WD2RL76M.min.js} +45 -45
- package/dist/{c-PQOZPM4G.min.js → c-YL7HJL5J.min.js} +1 -1
- package/dist/c-Z6GRGS53.min.js +1 -0
- package/dist/components/CategoryColors.d.ts +7 -0
- package/dist/components/LinkedCharts.d.ts +2 -1
- package/dist/components/ai/chartClinic.d.ts +1 -1
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +2 -2
- package/dist/components/charts/shared/{chartDefinitionPilot.d.ts → chartDefinition.d.ts} +30 -34
- package/dist/components/charts/shared/chartDefinitions.d.ts +10 -0
- package/dist/components/charts/shared/chartDefinitionsNetwork.d.ts +17 -0
- package/dist/components/charts/shared/chartDefinitionsOrdinal.d.ts +23 -0
- package/dist/components/charts/shared/chartDefinitionsPhysics.d.ts +17 -0
- package/dist/components/charts/shared/chartDefinitionsRealtime.d.ts +12 -0
- package/dist/components/charts/shared/chartDefinitionsXY.d.ts +26 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -1
- package/dist/components/data/transforms.d.ts +1 -0
- package/dist/components/server/serverChartConfigs.d.ts +36 -36
- package/dist/components/server/serverChartConfigsNetwork.generated.d.ts +17 -0
- package/dist/components/server/serverChartConfigsOrdinal.generated.d.ts +23 -0
- package/dist/components/server/serverChartConfigsPhysics.generated.d.ts +17 -0
- package/dist/components/server/serverChartConfigsRealtime.generated.d.ts +13 -0
- package/dist/components/server/serverChartConfigsXY.generated.d.ts +22 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +5 -0
- package/dist/geo.min.js +3 -3
- package/dist/geo.module.min.js +10 -10
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +4 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +4 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/semiotic-ai-core.min.js +3 -3
- package/dist/semiotic-ai-core.module.min.js +3 -3
- package/dist/semiotic-ai.module.min.js +7 -7
- package/dist/semiotic-artifact.min.js +1 -1
- package/dist/semiotic-artifact.module.min.js +1 -1
- package/dist/semiotic-atlas-selection.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +903 -902
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +3 -3
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +3 -3
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +13 -13
- package/dist/semiotic-server-edge-node.module.min.js +393 -391
- package/dist/semiotic-server-edge.min.js +393 -391
- package/dist/semiotic-server-edge.module.min.js +374 -372
- package/dist/semiotic-server-node.min.js +393 -391
- package/dist/semiotic-server-node.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.module.min.js +10 -10
- package/dist/server.min.js +393 -391
- package/dist/server.module.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +12 -8
- package/dist/c-3OFVBWQY.min.js +0 -1
- package/dist/c-6IVBV5NO.min.js +0 -1
- package/dist/c-72CBVNYX.min.js +0 -209
- package/dist/c-7LY46QUI.min.js +0 -41
- package/dist/c-AKLBQMQF.min.js +0 -391
- package/dist/c-F2GGJB2S.min.js +0 -31
- package/dist/c-G53AVC42.min.js +0 -113
- package/dist/c-HQ27AHMC.min.js +0 -1
- package/dist/c-IHWZ2C6D.min.js +0 -26
- package/dist/c-MOP2NGLH.min.js +0 -1
- package/dist/c-PKY4JFY5.min.js +0 -1
- package/dist/c-UBHICVSC.min.js +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
function e(e){if(!e)return qt();if("string"==typeof e){let t=Qt[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),qt())}if("object"==typeof e&&"type"in e){let t=Qt[e.type],i=t?t():qt();return e.rotate&&"rotate"in i&&i.rotate(e.rotate),e.center&&"center"in i&&i.center(e.center),i}return e}function t(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function i(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function r(e,t,i){return e?"function"==typeof e?{...i,...e(t)}:{...i,...e}:{...i}}function n(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}function a(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}function o(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}function s(e,t){if(2>e.length)return[e];let i=.4*t,r=[],n=[e[0]];for(let t=1;e.length>t;t++){let a=e[t];Math.abs(a[0]-e[t-1][0])>i?(n.length>=2&&r.push(n),n=[a]):n.push(a)}return n.length>=2&&r.push(n),r}function l(e,t,i=24){let r=t[0]-e[0],n=t[1]-e[1],a=Math.sqrt(r*r+n*n);if(0===a)return[e,t];let o=-n/a,s=r/a,l=Math.min(.3*a,80),c=(e[0]+t[0])/2+o*l,u=(e[1]+t[1])/2+s*l,h=[];for(let r=0;i>=r;r++){let n=r/i,a=1-n;h.push([a*a*e[0]+2*a*n*c+n*n*t[0],a*a*e[1]+2*a*n*u+n*n*t[1]])}return h}function c(e,t){if(2>e.length)return e;let i=t/2+1,r=[];for(let t=0;e.length>t;t++){let n,a,o=e[t];0===t?(n=e[1][0]-o[0],a=e[1][1]-o[1]):t===e.length-1?(n=o[0]-e[t-1][0],a=o[1]-e[t-1][1]):(n=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);let s=Math.sqrt(n*n+a*a)||1;r.push([o[0]+a/s*i,o[1]+-n/s*i])}return r}function u(e,t,i,r,n){let a=t[0]-e[0],o=t[1]-e[1],s=Math.sqrt(a*a+o*o);if(0===s)return[e,t];let l=o/s,c=-a/s,u=n/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}function h(e,t,i,r){let n=e.filter(e=>"point"===e.type);if(2>n.length)return null;let a=t.strength??1,o=Number.isFinite(a)?Math.max(0,Math.min(1,a)):1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===o)return null;let l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=n.find(e=>e.datum&&l(e.datum)+""==t.center+"");if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;let h=n.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),f=Bt(h,1);r>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){let i=e[t];"geoarea"===i.type&&i.interactive&&e.splice(t,1)}let m="strip"===s?p(n,u,c,f,i):d(n,u,c,f,o,i),g=e.filter(e=>"line"===e.type);if(g.length>0){let e=/* @__PURE__ */new Map;for(let t of n)null!=t.pointId&&e.set(t.pointId+"",[t.x,t.y]);for(let i of g){let r=i.datum?.source,n=i.datum?.target;if(null!=r&&null!=n){let a=e.get(r+""),o=e.get(n+"");if(a&&o)if("fractional"===t.lineMode&&i.path.length>2){let e=i.path[0],t=i.path[i.path.length-1],r=[a[0]-e[0],a[1]-e[1]],n=[o[0]-t[0],o[1]-t[1]],s=[0];for(let e=1;i.path.length>e;e++)s.push(s[e-1]+Math.hypot(i.path[e][0]-i.path[e-1][0],i.path[e][1]-i.path[e-1][1]));let l=s[s.length-1];i.path=i.path.map((e,t)=>{let a=l>0?s[t]/l:t/(i.path.length-1);return[e[0]+r[0]*(1-a)+n[0]*a,e[1]+r[1]*(1-a)+n[1]*a]})}else i.path=[a,o]}}}return m}function d(e,t,i,r,n,a){let o=t.x,s=t.y,l=a.width/2,c=a.height/2,u=Math.min(a.width,a.height)/2,h=Ut().domain([0,r]).range([0,u]);for(let a of e){if(a===t||!a.datum)continue;let e=a.x,u=a.y,d=Math.atan2(u-s,e-o),p=Math.hypot(e-o,u-s),f=Number(i(a.datum)),m=isFinite(f)&&f>=0?r>0?h(f):0:p,g=l+Math.cos(d)*m,y=c+Math.sin(d)*m;a.x=e+(g-e)*n,a.y=u+(y-u)*n}return t.x=o+(l-o)*n,t.y=s+(c-s)*n,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}function p(e,t,i,r,n){let a=Math.max(3,Math.min(8,.35*n.height)),o=Math.max(1,n.width-2*a),s=n.height/2,l=Ut().domain([0,r]).range([0,o]);t.x=a,t.y=s;let c=[];for(let n of e){if(n===t)continue;if(!n.datum){n.x=a,n.y=s;continue}let e=Number(i(n.datum)),o=a+(isFinite(e)&&e>=0&&r>0?l(e):0);n.x=o,n.y=s,c.push({node:n,x:o})}c.sort((e,t)=>e.x-t.x);let u=Math.max(0,Math.min(n.height/2-1,6)),h=0;for(;c.length>h;){let e=h+1;for(;c.length>e&&3>Math.abs(c[e].x-c[h].x);)e++;let t=e-h;if(t>1&&u>0)for(let e=0;t>e;e++)c[h+e].node.y=s+(e-(t-1)/2)*Math.min(2.5,2*u/Math.max(1,t-1));h=e}return{cx:a,cy:s,maxCost:r,availableRadius:o,layout:"strip"}}function f(e){let t="preserve",i=/* @__PURE__ */new Set;for(let r of e){let e=oi[r]??si;"rebuild"===e.retainedData&&(t="rebuild");for(let t of e.invalidations)i.add(t)}return{retainedData:t,invalidations:i}}function m({config:e,projection:h,path:d,areas:p,points:f,lines:m,layout:g}){let y=t(e.xAccessor,"lon"),v=t(e.yAccessor,"lat"),b=[],w=n(e),R=o(e),x=a(e);if(e.graticule){let t=!0===e.graticule?{}:e.graticule,i=ui();t.step&&i.step(t.step);let r=d(i())||"";r&&b.push({type:"geoarea",pathData:r,centroid:[g.width/2,g.height/2],bounds:[[0,0],[g.width,g.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth??.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(let t of p){let i=d(t);if(!i)continue;let n=d.centroid(t),a=d.bounds(t),o=d.area(t);b.push({type:"geoarea",pathData:i,centroid:n,bounds:a,screenArea:o,style:r(e.areaStyle,t,w),datum:t,interactive:!0})}let P=i(e.lineDataAccessor);for(let t of m){let i=P(t);if(!i||2>i.length)continue;let n=[];if("geo"===e.lineType){let e=Array(i.length);for(let t=0;i.length>t;t++)e[t]=[y(i[t]),v(i[t])];for(let t=0;e.length-1>t;t++){let i=e[t],r=e[t+1],a=ci(i,r)||0,o=Math.max(2,Math.ceil(a/(Math.PI/180))),s=hi(i,r);for(let e=0;o>=e;e++){if(t>0&&0===e)continue;let i=h(s(e/o));null!=i&&n.push(i)}}}else for(let e=0;i.length>e;e++){let t=i[e],r=h([y(t),v(t)]);null!=r&&n.push(r)}if(2>n.length)continue;let a=r(e.lineStyle,t,R),o="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==i.length||2>n.length||"arc"!==e.flowStyle?2===i.length&&n.length>=2&&"offset"===e.flowStyle&&(n="geo"===e.lineType?c(n,o):u(n[0],n[n.length-1],0,0,o)):n=l(n[0],n[n.length-1]);let d=s(n,g.width);if(d.length>1)for(let e of d)2>e.length||b.push({type:"line",path:e,style:{...a,_edgeFade:!0},datum:t});else b.push({type:"line",path:2>n.length&&d[0]||n,style:a,datum:t})}let k=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,S=h.clipAngle?h.clipAngle()??0:0,L=S>0?S*Math.PI/180:null,C=h.rotate?h.rotate():[0,0,0],A="function"==typeof h.center?h.center():[0,0],j=[(A[0]??0)-C[0],(A[1]??0)-C[1]];for(let t of f){let i=y(t),r=v(t);if(null!=L&&ci([i,r],j)>L)continue;let n=h([i,r]);if(!n)continue;let a=e.pointStyle?e.pointStyle(t):{...x},o={type:"point",x:n[0],y:n[1],r:a.r||4,style:a,datum:t,pointId:k?k(t)+"":void 0};b.push(o)}return b}function g(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+""}.`)}function y(e,{storeRef:t,dirtyRef:i,scheduleRender:r,zoomTransformRef:n,containerRef:a,zoomBehaviorRef:o}){let s=fi(e=>{null==e||"object"!=typeof e||(t.current?.pushPoint(e),i.current=!0,r())},[t,i,r]),l=fi(e=>{let n=tt(e);0!==n.length&&(t.current?.pushMany(n),i.current=!0,r())},[t,i,r]),c=fi(e=>{null==e||"object"!=typeof e||(t.current?.pushLine(e),i.current=!0,r())},[t,i,r]),u=fi(e=>{let n=tt(e);0!==n.length&&(t.current?.pushManyLines(n),i.current=!0,r())},[t,i,r]),h=fi(()=>{t.current?.clear(),i.current=!0,r()},[t,i,r]);mi(e,()=>({push:s,pushMany:l,removePoint:e=>{let n=t.current?.removePoint(e)??[];return n.length>0&&(i.current=!0,r()),n},pushLine:c,pushManyLines:u,removeLine:e=>{let n=t.current?.removeLine(e)??[];return n.length>0&&(i.current=!0,r()),n},getLines:()=>t.current?.getLines()??[],clear:h,getProjection:()=>t.current?.scales?.projection??null,getGeoPath:()=>t.current?.scales?.geoPath??null,getCartogramLayout:()=>t.current?.cartogramLayout??null,getCustomLayout:()=>t.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>t.current?.lastCustomLayoutFailure??null,getZoom:()=>n.current.k,resetZoom:()=>{let e=a.current;e&&o.current&&gi(e).call(o.current.transform,yi)},getData:()=>t.current?.getPoints()??[]}),[s,l,c,u,h,r,t,i,n,a,o])}function v(e,t,i,r,n,a,o=0,s=r){if(a){let e=xe(a,t,i,r,o);if(e&&!1!==e.node.interactive)return e}else{let n=null,a=1/0;for(let o of e){if("point"!==o.type||!1===o.interactive)continue;let e=o.x-t,s=o.y-i,l=Math.sqrt(e*e+s*s);Re(o.r,r)>=l&&a>l&&(n=o,a=l)}if(n)return{node:n,distance:a}}let l=null,c=1/0;for(let n of e){if("glyph"!==n.type||null==n.datum)continue;let e=Ct(n.glyph,n.size),a=n.x+e.centerDx-t,o=n.y+e.centerDy-i,s=Math.sqrt(a*a+o*o);Re(e.radius,r)>=s&&c>s&&(l=n,c=s)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){let a=e[r];if("geoarea"!==a.type)continue;let o=a;if(!1===o.interactive)continue;let[[s,l],[c,u]]=o.bounds;if(!(s>t||t>c||l>i||i>u)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),n.isPointInPath(o._cachedPath2D,t,i)))return{node:o,distance:0}}let u=null,h=1/0;for(let r of e){if("line"!==r.type)continue;let e=r,{path:n}=e,a=Math.max((e.style.strokeWidth??2)+4,5,s),o=t-a,l=t+a,c=i-a,d=i+a;for(let r=0;n.length-1>r;r++){let s=n[r],p=n[r+1],f=s[0],m=s[1],g=p[0],y=p[1];if(o>f&&o>g||f>l&&g>l||c>m&&c>y||m>d&&y>d)continue;let v=we(t,i,f,m,g,y);a>=v&&h>v&&(u=e,h=v)}}return u?{node:u,distance:h}:null}function b(e){let{width:t,height:i,totalWidth:r,totalHeight:n,margin:a,showAxes:o,title:s,description:l,idPrefix:c,legend:u,legendHoverBehavior:h,legendClickBehavior:d,legendHighlightedCategory:p,legendIsolatedCategories:f,legendPosition:m,legendLayout:g,foregroundGraphics:y,annotations:v,onAnnotationActivate:b,onObservation:w,chartId:R,chartType:x,autoPlaceAnnotations:P,svgAnnotationRules:k,pointNodes:S,geoProjection:L}=e,C=Fe({onAnnotationActivate:b,onObservation:w,chartId:R,chartType:x}),A=bi([v?.length??0,/* @__PURE__ */new Map]),j=v?.length??0;A.current[0]!==j&&(A.current=[j,/* @__PURE__ */new Map]);let D=vi(()=>{if(!v||0===v.length)return null;let e=Se(v),r=L?e.map(e=>{if(!Array.isArray(e.coordinates)||2>e.coordinates.length)return e;let t=L(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,n={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:i,frameType:"xy",pointNodes:S,stickyPositionCache:A.current[1]},a=P?$e({annotations:r,context:n,..."object"==typeof P?P:{}}):r;return qe(a,Xe("xy",C),k,n)},[v,P,k,t,i,S,C,L]),M=o||s||l||u||y||D&&D.length>0,T=wi(),{titleId:B,descId:_,labelledBy:I}=Ae(c||R||T);return M?/* @__PURE__ */xi("svg",{role:"img","aria-labelledby":I,width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[
|
|
1
|
+
function e(e){if(!e)return qt();if("string"==typeof e){let t=Qt[e];return t?t():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${e}", falling back to equalEarth`),qt())}if("object"==typeof e&&"type"in e){let t=Qt[e.type],i=t?t():qt();return e.rotate&&"rotate"in i&&i.rotate(e.rotate),e.center&&"center"in i&&i.center(e.center),i}return e}function t(e,t){return e?"function"==typeof e?e:t=>t[e]:e=>e[t]}function i(e){return e?"function"==typeof e?e:t=>t[e]:e=>e.coordinates||e.data||[]}function r(e,t,i){return e?"function"==typeof e?{...i,...e(t)}:{...i,...e}:{...i}}function n(e){return{fill:e.themeSemantic?.surface||"#e0e0e0",stroke:e.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}function a(e){return{fill:e.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}function o(e){return{stroke:e.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}function s(e,t){if(2>e.length)return[e];let i=.4*t,r=[],n=[e[0]];for(let t=1;e.length>t;t++){let a=e[t];Math.abs(a[0]-e[t-1][0])>i?(n.length>=2&&r.push(n),n=[a]):n.push(a)}return n.length>=2&&r.push(n),r}function l(e,t,i=24){let r=t[0]-e[0],n=t[1]-e[1],a=Math.sqrt(r*r+n*n);if(0===a)return[e,t];let o=-n/a,s=r/a,l=Math.min(.3*a,80),c=(e[0]+t[0])/2+o*l,u=(e[1]+t[1])/2+s*l,h=[];for(let r=0;i>=r;r++){let n=r/i,a=1-n;h.push([a*a*e[0]+2*a*n*c+n*n*t[0],a*a*e[1]+2*a*n*u+n*n*t[1]])}return h}function c(e,t){if(2>e.length)return e;let i=t/2+1,r=[];for(let t=0;e.length>t;t++){let n,a,o=e[t];0===t?(n=e[1][0]-o[0],a=e[1][1]-o[1]):t===e.length-1?(n=o[0]-e[t-1][0],a=o[1]-e[t-1][1]):(n=e[t+1][0]-e[t-1][0],a=e[t+1][1]-e[t-1][1]);let s=Math.sqrt(n*n+a*a)||1;r.push([o[0]+a/s*i,o[1]+-n/s*i])}return r}function u(e,t,i,r,n){let a=t[0]-e[0],o=t[1]-e[1],s=Math.sqrt(a*a+o*o);if(0===s)return[e,t];let l=o/s,c=-a/s,u=n/2+1;return[[e[0]+l*u,e[1]+c*u],[t[0]+l*u,t[1]+c*u]]}function h(e,t,i,r){let n=e.filter(e=>"point"===e.type);if(2>n.length)return null;let a=t.strength??1,o=Number.isFinite(a)?Math.max(0,Math.min(1,a)):1,s="strip"===t.layout?"strip":"radial";if("radial"===s&&0===o)return null;let l=t.centerAccessor?"function"==typeof t.centerAccessor?t.centerAccessor:e=>e[t.centerAccessor]:e=>e.id,c="function"==typeof t.costAccessor?t.costAccessor:e=>e[t.costAccessor],u=n.find(e=>e.datum&&l(e.datum)+""==t.center+"");if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${t.center}" not found in point data`),null;let h=n.map(e=>e.datum?Number(c(e.datum)):NaN).filter(e=>isFinite(e)&&e>=0),f=Bt(h,1);r>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let t=e.length-1;t>=0;t--){let i=e[t];"geoarea"===i.type&&i.interactive&&e.splice(t,1)}let m="strip"===s?p(n,u,c,f,i):d(n,u,c,f,o,i),g=e.filter(e=>"line"===e.type);if(g.length>0){let e=/* @__PURE__ */new Map;for(let t of n)null!=t.pointId&&e.set(t.pointId+"",[t.x,t.y]);for(let i of g){let r=i.datum?.source,n=i.datum?.target;if(null!=r&&null!=n){let a=e.get(r+""),o=e.get(n+"");if(a&&o)if("fractional"===t.lineMode&&i.path.length>2){let e=i.path[0],t=i.path[i.path.length-1],r=[a[0]-e[0],a[1]-e[1]],n=[o[0]-t[0],o[1]-t[1]],s=[0];for(let e=1;i.path.length>e;e++)s.push(s[e-1]+Math.hypot(i.path[e][0]-i.path[e-1][0],i.path[e][1]-i.path[e-1][1]));let l=s[s.length-1];i.path=i.path.map((e,t)=>{let a=l>0?s[t]/l:t/(i.path.length-1);return[e[0]+r[0]*(1-a)+n[0]*a,e[1]+r[1]*(1-a)+n[1]*a]})}else i.path=[a,o]}}}return m}function d(e,t,i,r,n,a){let o=t.x,s=t.y,l=a.width/2,c=a.height/2,u=Math.min(a.width,a.height)/2,h=Ut().domain([0,r]).range([0,u]);for(let a of e){if(a===t||!a.datum)continue;let e=a.x,u=a.y,d=Math.atan2(u-s,e-o),p=Math.hypot(e-o,u-s),f=Number(i(a.datum)),m=isFinite(f)&&f>=0?r>0?h(f):0:p,g=l+Math.cos(d)*m,y=c+Math.sin(d)*m;a.x=e+(g-e)*n,a.y=u+(y-u)*n}return t.x=o+(l-o)*n,t.y=s+(c-s)*n,{cx:t.x,cy:t.y,maxCost:r,availableRadius:u,layout:"radial"}}function p(e,t,i,r,n){let a=Math.max(3,Math.min(8,.35*n.height)),o=Math.max(1,n.width-2*a),s=n.height/2,l=Ut().domain([0,r]).range([0,o]);t.x=a,t.y=s;let c=[];for(let n of e){if(n===t)continue;if(!n.datum){n.x=a,n.y=s;continue}let e=Number(i(n.datum)),o=a+(isFinite(e)&&e>=0&&r>0?l(e):0);n.x=o,n.y=s,c.push({node:n,x:o})}c.sort((e,t)=>e.x-t.x);let u=Math.max(0,Math.min(n.height/2-1,6)),h=0;for(;c.length>h;){let e=h+1;for(;c.length>e&&3>Math.abs(c[e].x-c[h].x);)e++;let t=e-h;if(t>1&&u>0)for(let e=0;t>e;e++)c[h+e].node.y=s+(e-(t-1)/2)*Math.min(2.5,2*u/Math.max(1,t-1));h=e}return{cx:a,cy:s,maxCost:r,availableRadius:o,layout:"strip"}}function f(e){let t="preserve",i=/* @__PURE__ */new Set;for(let r of e){let e=oi[r]??si;"rebuild"===e.retainedData&&(t="rebuild");for(let t of e.invalidations)i.add(t)}return{retainedData:t,invalidations:i}}function m({config:e,projection:h,path:d,areas:p,points:f,lines:m,layout:g}){let y=t(e.xAccessor,"lon"),v=t(e.yAccessor,"lat"),b=[],w=n(e),R=o(e),P=a(e);if(e.graticule){let t=!0===e.graticule?{}:e.graticule,i=ui();t.step&&i.step(t.step);let r=d(i())||"";r&&b.push({type:"geoarea",pathData:r,centroid:[g.width/2,g.height/2],bounds:[[0,0],[g.width,g.height]],screenArea:0,style:{fill:"none",stroke:t.stroke||"#e0e0e0",strokeWidth:t.strokeWidth??.5,strokeDasharray:t.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(let t of p){let i=d(t);if(!i)continue;let n=d.centroid(t),a=d.bounds(t),o=d.area(t);b.push({type:"geoarea",pathData:i,centroid:n,bounds:a,screenArea:o,style:r(e.areaStyle,t,w),datum:t,interactive:!0})}let x=i(e.lineDataAccessor);for(let t of m){let i=x(t);if(!i||2>i.length)continue;let n=[];if("geo"===e.lineType){let e=Array(i.length);for(let t=0;i.length>t;t++)e[t]=[y(i[t]),v(i[t])];for(let t=0;e.length-1>t;t++){let i=e[t],r=e[t+1],a=ci(i,r)||0,o=Math.max(2,Math.ceil(a/(Math.PI/180))),s=hi(i,r);for(let e=0;o>=e;e++){if(t>0&&0===e)continue;let i=h(s(e/o));null!=i&&n.push(i)}}}else for(let e=0;i.length>e;e++){let t=i[e],r=h([y(t),v(t)]);null!=r&&n.push(r)}if(2>n.length)continue;let a=r(e.lineStyle,t,R),o="number"==typeof a.strokeWidth?a.strokeWidth:1;2!==i.length||2>n.length||"arc"!==e.flowStyle?2===i.length&&n.length>=2&&"offset"===e.flowStyle&&(n="geo"===e.lineType?c(n,o):u(n[0],n[n.length-1],0,0,o)):n=l(n[0],n[n.length-1]);let d=s(n,g.width);if(d.length>1)for(let e of d)2>e.length||b.push({type:"line",path:e,style:{...a,_edgeFade:!0},datum:t});else b.push({type:"line",path:2>n.length&&d[0]||n,style:a,datum:t})}let k=e.pointIdAccessor?"function"==typeof e.pointIdAccessor?e.pointIdAccessor:t=>t[e.pointIdAccessor]:null,S=h.clipAngle?h.clipAngle()??0:0,L=S>0?S*Math.PI/180:null,C=h.rotate?h.rotate():[0,0,0],A="function"==typeof h.center?h.center():[0,0],D=[(A[0]??0)-C[0],(A[1]??0)-C[1]];for(let t of f){let i=y(t),r=v(t);if(null!=L&&ci([i,r],D)>L)continue;let n=h([i,r]);if(!n)continue;let a=e.pointStyle?e.pointStyle(t):{...P},o={type:"point",x:n[0],y:n[1],r:a.r||4,style:a,datum:t,pointId:k?k(t)+"":void 0};b.push(o)}return b}function g(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+""}.`)}function y(e,{storeRef:t,dirtyRef:i,scheduleRender:r,zoomTransformRef:n,containerRef:a,zoomBehaviorRef:o}){let s=fi(e=>{null==e||"object"!=typeof e||(t.current?.pushPoint(e),i.current=!0,r())},[t,i,r]),l=fi(e=>{let n=tt(e);0!==n.length&&(t.current?.pushMany(n),i.current=!0,r())},[t,i,r]),c=fi(e=>{null==e||"object"!=typeof e||(t.current?.pushLine(e),i.current=!0,r())},[t,i,r]),u=fi(e=>{let n=tt(e);0!==n.length&&(t.current?.pushManyLines(n),i.current=!0,r())},[t,i,r]),h=fi(()=>{t.current?.clear(),i.current=!0,r()},[t,i,r]);mi(e,()=>({push:s,pushMany:l,removePoint:e=>{let n=t.current?.removePoint(e)??[];return n.length>0&&(i.current=!0,r()),n},pushLine:c,pushManyLines:u,removeLine:e=>{let n=t.current?.removeLine(e)??[];return n.length>0&&(i.current=!0,r()),n},getLines:()=>t.current?.getLines()??[],clear:h,getProjection:()=>t.current?.scales?.projection??null,getGeoPath:()=>t.current?.scales?.geoPath??null,getCartogramLayout:()=>t.current?.cartogramLayout??null,getCustomLayout:()=>t.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>t.current?.lastCustomLayoutFailure??null,getZoom:()=>n.current.k,resetZoom:()=>{let e=a.current;e&&o.current&&gi(e).call(o.current.transform,yi)},getData:()=>t.current?.getPoints()??[]}),[s,l,c,u,h,r,t,i,n,a,o])}function v(e,t,i,r,n,a,o=0,s=r){if(a){let e=Pe(a,t,i,r,o);if(e&&!1!==e.node.interactive)return e}else{let n=null,a=1/0;for(let o of e){if("point"!==o.type||!1===o.interactive)continue;let e=o.x-t,s=o.y-i,l=Math.sqrt(e*e+s*s);Re(o.r,r)>=l&&a>l&&(n=o,a=l)}if(n)return{node:n,distance:a}}let l=null,c=1/0;for(let n of e){if("glyph"!==n.type||null==n.datum)continue;let e=Ct(n.glyph,n.size),a=n.x+e.centerDx-t,o=n.y+e.centerDy-i,s=Math.sqrt(a*a+o*o);Re(e.radius,r)>=s&&c>s&&(l=n,c=s)}if(l)return{node:l,distance:c};for(let r=e.length-1;r>=0;r--){let a=e[r];if("geoarea"!==a.type)continue;let o=a;if(!1===o.interactive)continue;let[[s,l],[c,u]]=o.bounds;if(!(s>t||t>c||l>i||i>u)&&(o._cachedPath2D||(o._cachedPath2D=new Path2D(o.pathData)),n.isPointInPath(o._cachedPath2D,t,i)))return{node:o,distance:0}}let u=null,h=1/0;for(let r of e){if("line"!==r.type)continue;let e=r,{path:n}=e,a=Math.max((e.style.strokeWidth??2)+4,5,s),o=t-a,l=t+a,c=i-a,d=i+a;for(let r=0;n.length-1>r;r++){let s=n[r],p=n[r+1],f=s[0],m=s[1],g=p[0],y=p[1];if(o>f&&o>g||f>l&&g>l||c>m&&c>y||m>d&&y>d)continue;let v=we(t,i,f,m,g,y);a>=v&&h>v&&(u=e,h=v)}}return u?{node:u,distance:h}:null}function b(e){let{width:t,height:i,totalWidth:r,totalHeight:n,margin:a,showAxes:o,title:s,description:l,idPrefix:c,legend:u,legendHoverBehavior:h,legendClickBehavior:d,legendHighlightedCategory:p,legendIsolatedCategories:f,legendPosition:m,legendLayout:g,foregroundGraphics:y,annotations:v,onAnnotationActivate:b,onObservation:w,chartId:R,chartType:P,autoPlaceAnnotations:x,svgAnnotationRules:k,pointNodes:S,geoProjection:L}=e,C=Fe({onAnnotationActivate:b,onObservation:w,chartId:R,chartType:P}),A=bi([v?.length??0,/* @__PURE__ */new Map]),D=v?.length??0;A.current[0]!==D&&(A.current=[D,/* @__PURE__ */new Map]);let j=vi(()=>{if(!v||0===v.length)return null;let e=Se(v),r=L?e.map(e=>{if(!Array.isArray(e.coordinates)||2>e.coordinates.length)return e;let t=L(Number(e.coordinates[0]),Number(e.coordinates[1]));return t?{...e,x:t[0],y:t[1]}:e}):e,n={scales:{x:e=>Number(e),y:e=>Number(e)},timeAxis:"x",width:t,height:i,frameType:"xy",pointNodes:S,stickyPositionCache:A.current[1]},a=x?$e({annotations:r,context:n,..."object"==typeof x?x:{}}):r;return qe(a,Ze("xy",C),k,n)},[v,x,k,t,i,S,C,L]),M=o||s||l||u||y||j&&j.length>0,T=wi(),{titleId:B,descId:_,labelledBy:I}=Ae(c||R||T);return M?/* @__PURE__ */Pi("svg",{role:"img","aria-labelledby":I,width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[
|
|
2
2
|
/* @__PURE__ */Ri("title",{id:B,children:Le(s,"Geographic chart")}),
|
|
3
3
|
/* @__PURE__ */Ri("desc",{id:_,children:Ce(s,l,{familyPhrase:"geographic data visualization",fallback:"geographic data visualization"})}),
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */Ri(Qe,{title:s,totalWidth:r,marginTop:a.top}),Ee({legend:u,totalWidth:r,totalHeight:n,margin:a,legendPosition:m,title:s,legendLayout:g,legendHoverBehavior:h,legendClickBehavior:d,legendHighlightedCategory:p,legendIsolatedCategories:f})]}):null}function w(e,t){return ht(R(e,t),e,"geo-cursor-"+t)}function R(e,t){switch(e.type){case"geoarea":{let i=e;if(!i.pathData)return null;let r=
|
|
6
|
-
return Si(
|
|
7
|
-
/* @__PURE__ */ki("path",{d:i.pathData,fill:r?`url(#geoarea-${t}-hatch)`:
|
|
8
|
-
return Si(
|
|
9
|
-
/* @__PURE__ */ki("circle",{cx:i.x,cy:i.y,r:i.r,fill:r?`url(#geopoint-${t}-hatch)`:
|
|
10
|
-
return ki("path",{d:r,fill:"none",stroke:i.style.stroke||"#4e79a7",strokeWidth:i.style.strokeWidth??1.5,strokeDasharray:i.style.strokeDasharray,opacity:i.style.opacity??1},"line-"+t)}case"glyph":return
|
|
4
|
+
/* @__PURE__ */Pi("g",{transform:"translate("+a.left+","+a.top+")",children:[j,y]}),
|
|
5
|
+
/* @__PURE__ */Ri(Qe,{title:s,totalWidth:r,marginTop:a.top}),Ee({legend:u,totalWidth:r,totalHeight:n,margin:a,legendPosition:m,title:s,legendLayout:g,legendHoverBehavior:h,legendClickBehavior:d,legendHighlightedCategory:p,legendIsolatedCategories:f})]}):null}function w(e,t){return ht(R(e,t),e,"geo-cursor-"+t)}function R(e,t){switch(e.type){case"geoarea":{let i=e;if(!i.pathData)return null;let r=Dt(i.style.fill)?jt(i.style.fill,`geoarea-${t}-hatch`):void 0;/* @__PURE__ */
|
|
6
|
+
return Si(xi.Fragment,{children:[r&&/* @__PURE__ */ki("defs",{children:r}),
|
|
7
|
+
/* @__PURE__ */ki("path",{d:i.pathData,fill:r?`url(#geoarea-${t}-hatch)`:Je(i.style.fill,"#e0e0e0"),fillOpacity:i.style.fillOpacity??1,stroke:i.style.stroke||"none",strokeWidth:i.style.strokeWidth??.5,strokeDasharray:i.style.strokeDasharray,opacity:(i.style.opacity??1)*(i._decayOpacity??1)})]},"geoarea-"+t)}case"point":{let i=e,r=Dt(i.style.fill)?jt(i.style.fill,`geopoint-${t}-hatch`):void 0;/* @__PURE__ */
|
|
8
|
+
return Si(xi.Fragment,{children:[r&&/* @__PURE__ */ki("defs",{children:r}),
|
|
9
|
+
/* @__PURE__ */ki("circle",{cx:i.x,cy:i.y,r:i.r,fill:r?`url(#geopoint-${t}-hatch)`:Je(i.style.fill),fillOpacity:i.style.fillOpacity??.8,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i._decayOpacity??i.style.opacity??1})]},"point-"+t)}case"line":{let i=e;if(2>i.path.length)return null;let r="M"+i.path.map(e=>`${e[0]},${e[1]}`).join("L");/* @__PURE__ */
|
|
10
|
+
return ki("path",{d:r,fill:"none",stroke:i.style.stroke||"#4e79a7",strokeWidth:i.style.strokeWidth??1.5,strokeDasharray:i.style.strokeDasharray,opacity:i.style.opacity??1},"line-"+t)}case"glyph":return Ke(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}function P(e,t,i,r){let n=t.filter(e=>"geoarea"===e.type);for(let t of n){if(!t.pathData)continue;t._cachedPath2D||(t._cachedPath2D=new Path2D(t.pathData));let i=t._cachedPath2D,r=Mt(e,t.style.fill)||"#e0e0e0";"none"!==r&&(e.fillStyle=r,e.globalAlpha=(t._decayOpacity??1)*(t.style.fillOpacity??1),e.fill(i));let n=t.style.strokeWidth??.5;if(t.style.stroke&&"none"!==t.style.stroke&&n>0){if(e.strokeStyle=At(e,t.style.stroke)||t.style.stroke,e.lineWidth=n,e.globalAlpha=t._decayOpacity??1,t.style.strokeDasharray){let i=t.style.strokeDasharray.split(",").map(Number);e.setLineDash(i)}else e.setLineDash([]);e.stroke(i)}Me(e,t,i),e.globalAlpha=1,e.setLineDash([])}}function x(e){let{size:t,scale:i,translate:r,clampX:n=!0,clampY:a=!0}=e,o=Math.max(Math.log(i)/Math.LN2-8,0),s=Math.round(o),l=1<<s,c=Math.pow(2,o-s+8),u=r[0]-i/2,h=r[1]-i/2,d=Math.max(n?0:-1/0,Math.floor((0-u)/c)),p=Math.min(n?l:1/0,Math.ceil((t[0]-u)/c)),f=Math.max(a?0:-1/0,Math.floor((0-h)/c)),m=Math.min(a?l:1/0,Math.ceil((t[1]-h)/c)),g=[];for(let e=f;m>e;++e)for(let t=d;p>t;++t)g.push([t,e,s]);return{tiles:g,translate:[u/c,h/c],scale:c}}function k([e,t,i]){let r=1<<i;return[e-Math.floor(e/r)*r,t,i]}function S(e,t,i,r,n){return"function"==typeof e?e(t,i,r,n):e.replace("{z}",t+"").replace("{x}",i+"").replace("{y}",r+"").replace("{r}",n>1?"@2x":"")}function L(e){if("string"==typeof e)return"template:"+e;let t=e,i=Di.get(t);return null==i&&(i=ji++,Di.set(t,i)),"provider:"+i}function C(e){return Number.isFinite(e)?Math.max(1,Math.floor(e)):256}function A(e,t){let{tileURL:i,projection:r,width:n,height:a,tileCache:o,onTileLoad:s,maxDevicePixelRatio:l}=t,c=r.scale(),u=r.translate(),h=x({size:[n,a],scale:2*c*Math.PI,translate:u}),d=We(l,[n,a]),p=L(i),f=!0;for(let t of h.tiles){let[r,n,a]=k(t),l=S(i,a,r,n,d),c=`${p}|dpr:${d}|${a}/${r}/${n}|${l}`,u=o.get(c);if(!u){let e=new Image;e.crossOrigin="anonymous";let t={img:e,loaded:!1,failed:!1,key:c,lastUsed:performance.now()};o.set(c,t),e.onload=()=>{t.loaded=!0,s?.()},e.onerror=()=>{t.loaded=!0,t.failed=!0,s?.()},e.src=l,u=t}if(!u.loaded){f=!1;continue}if(u.failed)continue;let m=h.scale;e.drawImage(u.img,(t[0]+h.translate[0])*m-.5,(t[1]+h.translate[1])*m-.5,m+1,m+1)}return f}function D(e){let t=0;for(let i=1;e.length>i;i++){let r=e[i][0]-e[i-1][0],n=e[i][1]-e[i-1][1];t+=Math.sqrt(r*r+n*n)}return t}function j(e,t){let i=0;for(let r=1;e.length>r;r++){let n=e[r][0]-e[r-1][0],a=e[r][1]-e[r-1][1],o=Math.sqrt(n*n+a*a);if(i+o>=t||r===e.length-1){let s=o>0?(t-i)/o:0,l=o>.001?o:1;return{x:e[r-1][0]+n*s,y:e[r-1][1]+a*s,nx:-a/l,ny:n/l}}i+=o}let r=e[e.length-1];return{x:r[0],y:r[1],nx:0,ny:0}}function M(e){if(!e)return;let t=[];for(let i of e)if("point"===i.type)t.push(i);else if("glyph"===i.type){let e=i,r=Ct(e.glyph,e.size);t.push({pointId:e.pointId,x:e.x+r.centerDx,y:e.y+r.centerDy,r:r.radius})}return t}function T({data:e}){if(!e)return null;if(e.properties)/* @__PURE__ */
|
|
11
11
|
return Bi("div",{className:"semiotic-tooltip",style:St,children:/* @__PURE__ */Bi("div",{style:{fontWeight:600},children:e.properties.name||e.properties.NAME||e.properties.id||"Feature"})});let t=null!=e.data?e.data:e;if(!t||"object"!=typeof t)return null;let i=Ye(t),r=null!=i.title?i.title+"":null;return null==r&&0===i.entries.length?null:/* @__PURE__ */_i("div",{className:"semiotic-tooltip",style:St,children:[null!=r&&/* @__PURE__ */Bi("div",{style:{fontWeight:600,marginBottom:i.entries.length?2:0},children:r}),i.entries.map(e=>/* @__PURE__ */_i("div",{children:[
|
|
12
12
|
/* @__PURE__ */_i("span",{style:{opacity:.7},children:[e.key,": "]}),
|
|
13
|
-
/* @__PURE__ */Bi("span",{style:{fontWeight:600},children:ce(e.value)})]},e.key))]})}function B(){if(null!==Ei)return Ei;if(typeof window>"u")return!1;let e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="u">typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,i="u">typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Ei=e||t||i}function _(){return B()?12:30}function I(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function E(e){return e?e.getContext("2d"):null}function N(e){let t=e.pointer.clientX-e.canvasRect.left-e.margin.left,i=e.pointer.clientY-e.canvasRect.top-e.margin.top;if(0>t||t>e.width||0>i||i>e.height)return{kind:"outside"};e.hitCanvasRef.current||(e.hitCanvasRef.current="u">typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));let r=E(e.hitCanvasRef.current);if(!r)return{kind:"unavailable"};let n=v(e.scene,t,i,Ze(30,e.pointer.pointerType),r,e.pointQuadtree,e.maxPointRadius,Ze(6,e.pointer.pointerType));if(!n)return{kind:"miss"};let{node:a}=n,o=a.datum,s=Array.isArray(o)?null:o?.properties?o:o?.data||o,l="point"===a.type?a.x:"geoarea"===a.type?a.centroid[0]:t,c="point"===a.type?a.y:"geoarea"===a.type?a.centroid[1]:i;return{kind:"hit",node:a,hover:{...s,...s?.properties||{},data:s,properties:s?.properties,__semioticHoverData:!0,x:l,y:c}}}function F(e){let t=/* @__PURE__ */new Set,i=0,r=e;return{subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>i,sync(e){if(e!==r){r=e,i+=1;for(let e of t)e()}}}}function W({graphics:e,size:t,margin:i,readScales:r,tracker:n}){return Wi(n.subscribe,n.getSnapshot,n.getSnapshot),Fi.createElement(Fi.Fragment,null,ne(e,t,i,r()))}function z({tracker:e,readScales:t,...i}){let r=r=>"function"==typeof r?Fi.createElement(W,{graphics:r,size:i.size,margin:i.margin,readScales:t,tracker:e}):r;return{...ae({...i,resolveScaleAwareGraphics:!1}),resolvedForeground:r(i.foregroundGraphics),resolvedBackground:r(i.backgroundGraphics)}}import{b as O}from"./c-PQOZPM4G.min.js";import{b as H}from"./c-HQ27AHMC.min.js";import{a as G}from"./c-7FKPPCGN.min.js";import{b as q}from"./c-STHZWF3D.min.js";import{a as Z,b as X,d as Y,e as $,h as Q,i as U,j as V,k as K,n as J}from"./c-VXIYF7V2.min.js";import{a as ee}from"./c-P5NXQWIM.min.js";import{a as te,b as ie}from"./c-BYJJ7EMG.min.js";import{a as re}from"./c-3AGX252H.min.js";import{A as ne,B as ae,D as oe,E as se,F as le,I as ce,W as ue,X as he,Y as de,a as pe,d as fe,e as me,f as ge,g as ye,h as ve,i as be,j as we,l as Re,o as xe,q as Pe,r as ke,s as Se,t as Le,u as Ce,v as Ae,x as je,z as De}from"./c-KGROWFT2.min.js";import{d as Me}from"./c-V5KFJWQQ.min.js";import{c as Te}from"./c-CLLCX3PT.min.js";import{a as Be,b as _e}from"./c-N5WT7TXG.min.js";import{Ca as Ie,D as Ee,Fa as Ne,H as Fe,Ha as We,Ia as ze,J as Oe,Ja as He,Ka as Ge,L as qe,La as Ze,M as Xe,Na as Ye,R as $e,U as Qe,Va as Ue,W as Ve,Wa as Ke,Y as Je,ab as et,b as tt,c as it,ca as rt,d as nt,da as at,e as ot,ea as st,f as lt,ga as ct,ha as ut,ia as ht,ja as dt,ka as pt,o as ft,oa as mt,p as gt,q as yt,qa as vt,ra as bt,s as wt,ta as Rt,va as xt,wa as Pt,xa as kt,ya as St}from"./c-G53AVC42.min.js";import{p as Lt}from"./c-Y342FJ6K.min.js";import{i as Ct,m as At,r as jt,t as Dt,z as Mt}from"./c-3BYZXCX3.min.js";import{e as Tt}from"./c-5NYONM6V.min.js";import{c as Bt}from"./c-3PFVJFBK.min.js";import{forwardRef as _t,memo as It,useCallback as Et,useEffect as Nt,useMemo as Ft,useRef as Wt,useState as zt}from"react";import{geoPath as Ot}from"d3-geo";import{quadtree as Ht}from"d3-quadtree";import{geoMercator as Gt,geoEqualEarth as qt,geoAlbersUsa as Zt,geoOrthographic as Xt,geoNaturalEarth1 as Yt,geoEquirectangular as $t}from"d3-geo";var Qt={mercator:Gt,equalEarth:qt,albersUsa:Zt,orthographic:Xt,naturalEarth:Yt,equirectangular:$t};import{scaleLinear as Ut}from"d3-scale";var Vt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kt=["scene-style","data-paint","accessibility","evidence"],Jt=(e,t)=>({retainedData:e,invalidations:t}),ei=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ti=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ii=["scene-geometry","data-paint","accessibility","evidence"],ri=["scene-style","data-paint","accessibility","evidence"],ni=["overlay","accessibility","evidence"],ai=[],oi={xAccessor:Jt("rebuild",ei),yAccessor:Jt("rebuild",ei),lineDataAccessor:Jt("rebuild",ei),pointIdAccessor:Jt("rebuild",ii),lineIdAccessor:Jt("rebuild",ii),windowSize:Jt("rebuild",ei),projection:Jt("preserve",ti),projectionExtent:Jt("preserve",ti),fitPadding:Jt("preserve",ti),lineType:Jt("preserve",ti),flowStyle:Jt("preserve",ti),graticule:Jt("preserve",ti),projectionTransform:Jt("preserve",ti),customLayout:Jt("preserve",ti),layoutConfig:Jt("preserve",ti),layoutMargin:Jt("preserve",ti),areaStyle:Jt("preserve",ri),pointStyle:Jt("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:Jt("preserve",ri),colorScheme:Jt("preserve",ri),themeCategorical:Jt("preserve",ri),themeDiverging:Jt("preserve",ri),themeSemantic:Jt("preserve",ri),themeSequential:Jt("preserve",ri),decay:Jt("preserve",ri),pulse:Jt("preserve",ri),layoutSelection:Jt("preserve",ri),annotations:Jt("preserve",ni),autoPlaceAnnotations:Jt("preserve",ni),clock:Jt("preserve",ai),transition:Jt("preserve",ai),introAnimation:Jt("preserve",ai),onLayoutError:Jt("preserve",ai)},si=Jt("preserve",ti),li=class{constructor(){this.tracker=new gt}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}},Vt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Kt):this.recordNoop("restyle")}recordConfig(e,t={}){let i=f(e),r=new Set(i.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}};import{geoDistance as ci,geoGraticule as ui,geoInterpolate as hi}from"d3-geo";var di=class r{constructor(e){var t;this.updateResults=new li,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=(t=e,{...t,fitPadding:g(t.fitPadding)})}currentTime(){return this.config.clock?.()??lt()}getConfiguredWindowSize(){let 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){let t=this.pointBuffer.toArray(),i=this.timestampBuffer?.toArray()??[],r=t.slice(-e),n=i.slice(-r.length),a=this.currentTime();this.pointBuffer=new Z(e),this.timestampBuffer=new Z(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(n[t]??a)})}this.retainNewestLines(e)}updateConfig(e){let t="fitPadding"in(a=e)?{...a,fitPadding:g(a.fitPadding)}:a,i=this.config,r=this.getConfiguredWindowSize(),n=Object.keys(t).filter(e=>t[e]!==i[e]);var a;this.config={...this.config,...t};let o=this.getConfiguredWindowSize(),s=this.streaming&&o!==r;s&&(this.resizeStreamingWindow(o),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(n,{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});let t=this.getConfiguredWindowSize(),i=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],n=i.slice(-t),a=r.slice(-n.length),o=this.currentTime();this.pointBuffer=new Z(t),this.timestampBuffer=new Z(t),n.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(a[t]??o)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();let t=this.currentTime();Q(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();let t=this.currentTime();for(let i of e)Q(this.pointBuffer,i,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");let t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(let e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}removeLine(e){let{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");let i="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),n=[];return this.lineData=this.lineData.filter(e=>!r.has(i(e)+"")||(n.push(e),!1)),n.length>0?(this.version++,this.updateResults.recordData("remove",n.length)):this.updateResults.recordNoop("remove"),n}getLines(){return this.lineData.slice()}removePoint(e){let{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");let i="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){let e=e=>r.has(i(e)+"");U(this.pointBuffer,this.timestampBuffer,e);let t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{let e=[];return this.pointData=this.pointData.filter(t=>!r.has(i(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){let t=this._customRestyle;if(t){for(let i of this.scene){let r=this._baseStyles.get(i)??i.style,n=t(i,e);i.style=n?{...r,...n}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(t){let{config:i}=this,r=this.projection,n=this.geoPath,a=this.scales,o=this.baseScale,s=[...this.baseTranslate],l=[...this.baseRotation],c=this.scene;this.projection=e(i.projection),this.geoPath=Ot(this.projection),this.fitProjection(t),this.geoPath=Ot(this.projection);let u=this.projection;this.scales={projection:u,geoPath:this.geoPath,projectedPoint:(e,t)=>u([e,t]),invertedPoint:(e,t)=>u.invert?u.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let h=this.buildSceneNodes(t);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=r,this.geoPath=n,this.scales=a,this.baseScale=o,this.baseTranslate=s,this.baseRotation=l):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=h,this.rebuildQuadtree(),i.projectionTransform&&this.applyCartogramTransform(i.projectionTransform,t),i.decay&&this.streaming&&this.applyDecay(),i.pulse&&this.streaming&&this.applyPulse(),i.transition&&!this._hasRenderedOnce&&this.scene.length>0&&i.introAnimation){let e=t.width/2,i=t.height/2,r=this.scene.filter(e=>"point"===e.type).map(t=>({...t,x:e,y:i}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,i.transition&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(e){let r=this.projection,n=this.config,a=[...this.areas],o=t(n.xAccessor,"lon"),s=t(n.yAccessor,"lat"),l=this.getPoints();if(l.length>0){let e=l.map(e=>[o(e),s(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}let c=i(n.lineDataAccessor);for(let e of this.lineData){let t=c(e);if(t&&t.length>0){let e=t.map(e=>[o(e),s(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(n.projectionExtent){let[[t,i],[a,o]]=n.projectionExtent;r.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,i],[t,o],[a,o],[a,i],[t,i]]]}})}else if(r.clipAngle&&(r.clipAngle()??0)>0){let t=n.fitPadding??0,i=Math.min(e.width,e.height);r.scale(i/2-i*t),r.translate([e.width/2,e.height/2])}else{let t=n.fitPadding??0,i=e.width*t,o=e.height*t;r.fitExtent([[i,o],[e.width-i,e.height-o]],{type:"FeatureCollection",features:a})}this.baseScale=r.scale(),this.baseTranslate=r.translate(),this.baseRotation=r.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){let i=this.projection;if(!i)return;let r=this.geoPath,n=this.scales,a=i.scale(),o=[...i.translate()],s=this.currentZoom;i.scale(this.baseScale*e.k),i.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=Ot(i),this.scales={projection:i,geoPath:this.geoPath,projectedPoint:(e,t)=>i([e,t]),invertedPoint:(e,t)=>i.invert?i.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(i.scale(a),i.translate(o),this.currentZoom=s,this.geoPath=r,this.scales=n):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){let i=this.projection;if(!i)return;let r=this.geoPath,n=this.scales,a=i.scale(),o=[...i.translate()],s=this.currentZoom;i.scale(this.baseScale*e),i.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=Ot(i),this.scales={projection:i,geoPath:this.geoPath,projectedPoint:(e,t)=>i([e,t]),invertedPoint:(e,t)=>i.invert?i.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(i.scale(a),i.translate(o),this.currentZoom=s,this.geoPath=r,this.scales=n):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){let i=this.projection;if(!i||!i.rotate)return;let r=this.geoPath,n=this.scales,a=[...i.rotate()];i.rotate(e),this.geoPath=Ot(i),this.scales={projection:i,geoPath:this.geoPath,projectedPoint:(e,t)=>i([e,t]),invertedPoint:(e,t)=>i.invert?i.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let o=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(i.rotate(a),this.geoPath=r,this.scales=n):(this.scene=[],this.rebuildQuadtree()):(this.scene=o,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){let t=this.projection;!t||!t.rotate||t.rotate(e)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(let i of this.scene)"point"===i.type&&!1!==i.interactive&&(t++,i.r>e&&(e=i.r));if(this._maxPointRadius=e,r.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);let i=Array(t),n=0;for(let e of this.scene)"point"===e.type&&!1!==e.interactive&&(i[n++]=e);this._quadtree=Ht().x(e=>e.x).y(e=>e.y).addAll(i)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;let{config:t}=this,i=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){let i=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=Be(t.colorScheme,t.themeCategorical,Lt),n={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:i,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:_e(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null},a=me({family:"geo",logLabel:"geo customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:t.onLayoutError,run:()=>t.customLayout(n)});if("failure"===a.kind)return this.lastCustomLayoutFailure=a.diagnostic,this._customLayoutFailedThisBuild=!0,a.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,[]);let o=a.result,s=o.nodes??[];if(this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this._baseStyles=/* @__PURE__ */new WeakMap,this.hasCustomRestyle)for(let e of s){this._baseStyles.set(e,e.style);let i=o.restyle?.(e,t.layoutSelection??null);i&&(e.style={...e.style,...i})}return fe({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,m({config:t,projection:i,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){let i=h(this.scene,e,t,this.areas.length);i&&(this.cartogramLayout=i)}applyDecay(){let e=this.config.decay;if(!e||!this.pointBuffer)return;let t=this.pointBuffer.size;if(0===t)return;let i=this.scene.filter(e=>"point"===e.type);for(let r=0;i.length>r;r++){let n=pe(e,r,t);i[r]._decayOpacity=n,i[r].style={...i[r].style,opacity:n}}}applyPulse(e=this.currentTime()){let t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;let i=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),n=t.color||"rgba(255,255,255,0.6)",a=t.glowRadius??4,o=!1;for(let s=0;i.length>s&&r.length>s;s++){let l=X(t,r[s],e);o=Y(i[s],l,n,a)||o}return o}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&$(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){let t=this.config.transition?.duration??300;if(0>=t)return;let i=/* @__PURE__ */new Map;for(let t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);let r=this.scene.filter(e=>"point"===e.type),n=!1;for(let e of r)if(e.pointId){let t=i.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)&&(n=!0))}for(let e of r)e.pointId&&!i.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??e.style?.fillOpacity??1,e.style={...e.style,opacity:0},n=!0);n&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null;for(let e of this.scene)"point"===e.type&&(null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0),null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0))}advanceTransition(e){if(!this.activeTransition)return!1;let t=nt(e,this.activeTransition),i=it(t),r=this.scene.filter(e=>"point"===e.type);for(let e of r){if(null!=e._targetX&&null!=e._targetY){let t=e.y;e.x=ot(e.x,e._targetX,i),e.y=ot(t,e._targetY,i)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*i})}if(t>=1){for(let 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}};di.QUADTREE_THRESHOLD=500;var pi=di;ge(pi);import{useCallback as fi,useImperativeHandle as mi}from"react";import{select as gi}from"d3-selection";import{zoomIdentity as yi}from"d3-zoom";import{useMemo as vi,useRef as bi,useId as wi}from"react";import{jsx as Ri,jsxs as xi}from"react/jsx-runtime";import*as Pi from"react";import{jsx as ki,jsxs as Si}from"react/jsx-runtime";import{zoom as Li,zoomIdentity as Ci}from"d3-zoom";import{select as Ai}from"d3-selection";var ji=/* @__PURE__ */new WeakMap,Di=1,Mi=class{constructor(e=256){this.cache=/* @__PURE__ */new Map,this.limit=C(e)}setLimit(e){this.limit=C(e),this.cache.size>this.limit&&this.evict()}get(e){let 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(let[i,r]of this.cache)t>r.lastUsed&&(t=r.lastUsed,e=i);if(!e)break;{let t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(let e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}},Ti=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 i=0;this.capacity>i;i++){let r=this.particles[i];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,i,r){for(let n=0;this.capacity>n;n++){let a=this.particles[n];if(!a.active)continue;let o=i[a.lineIndex];if(!o||2>o.length){a.active=!1;continue}if(a.t+=e*t,a.t>=1){a.active=!1;continue}let s=j(o),l=D(o,a.t*s),c=(r[a.lineIndex]||2)/2;a.x=l.x+l.nx*a.offset*c*2,a.y=l.y+l.ny*a.offset*c*2}}countForLine(e){let t=0;for(let i=0;this.capacity>i;i++)this.particles[i].active&&this.particles[i].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};import{jsx as Bi,jsxs as _i}from"react/jsx-runtime";T.ownsChrome=!0;var Ii={top:10,right:10,bottom:10,left:10},Ei=null,Ni={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)"};import*as Fi from"react";import{useSyncExternalStore as Wi}from"react";import{jsx as zi,jsxs as Oi}from"react/jsx-runtime";var Hi=It(_t(function(e,t){let{projection:i,projectionExtent:r,fitPadding:n,projectionTransform:a,areas:o,points:s,lines:l,customLayout:c,layoutConfig:u,layoutSelection:h,onLayoutError:d,xAccessor:p,yAccessor:f,lineDataAccessor:m,pointIdAccessor:g,lineIdAccessor:R,lineType:P="geo",flowStyle:k="basic",graticule:S,zoomable:L,zoomExtent:C,onZoom:j,dragRotate:D,showParticles:W,particleStyle:O,tileURL:H,tileAttribution:Z,tileCacheSize:X,size:Y,width:$,height:Q,responsiveWidth:U,responsiveHeight:ne,margin:ae,className:ce,background:he,maxDevicePixelRatio:de,windowSize:pe=500,renderMode:fe,areaStyle:me,pointStyle:ge,lineStyle:we,colorScheme:Re,enableHover:xe=!0,hoverAnnotation:Se,tooltipContent:Le,allowTooltipOverflow:Ce=!1,customClickBehavior:Ae,customHoverBehavior:Me,onObservation:Be,annotationObservationCallback:_e,chartId:Ee,annotations:Fe,onAnnotationActivate:qe,autoPlaceAnnotations:Xe,svgAnnotationRules:Ye,decay:$e,pulse:Qe,transition:Ue,animate:Ve,staleness:Je,frameScheduler:et,clock:it,random:nt,seed:ot,paused:lt=!1,suspendWhenHidden:ht=!0,backgroundGraphics:gt,foregroundGraphics:St,title:Lt,legend:Ct,legendPosition:At,legendLayout:jt,legendHoverBehavior:Dt,legendClickBehavior:Mt,legendHighlightedCategory:Bt,legendIsolatedCategories:_t,legendCategoryAccessor:It,onCategoriesChange:Ot,showAxes:Ht,accessibleTable:Gt=!0,description:qt,summary:Zt}=e,{customHoverBehavior:Xt,customClickBehavior:Yt,hasClickBehavior:$t}=K({customHoverBehavior:Me,customClickBehavior:Ae,onObservation:Be,chartId:Ee,chartType:"StreamGeoFrame"}),Qt=Y||[$||600,Q||400],Ut=Wt(!0),Vt=Ne({sizeProp:Qt,responsiveWidth:U,responsiveHeight:ne,userMargin:ae,marginDefault:Ii,title:Lt,legend:Ct,legendPosition:At,legendLayout:jt,legendMarginReserved:e.__legendMarginReservedFor===Ct,animate:Ve,transitionProp:Ue,frameScheduler:et,clock:it,random:nt,seed:ot,paused:lt,suspendWhenHidden:ht,themeDirtyRef:Ut}),{reducedMotionRef:Kt,responsiveRef:Jt,size:ei,margin:ti,adjustedWidth:ii,adjustedHeight:ri,transition:ni,introEnabled:ai,tableId:oi,frameRuntime:si,rafRef:li,renderFnRef:ci,scheduleRender:ui,currentTheme:hi}=Vt,di=dt(),fi=pt(),mi=Ft(()=>Array.isArray(o)?tt(o):o,[o]),gi=Ft(()=>tt(s),[s]),yi=Ft(()=>tt(l),[l]),vi=D??"orthographic"===I(i),bi=Ft(()=>({projection:i,projectionExtent:r,fitPadding:n,xAccessor:p,yAccessor:f,lineDataAccessor:m,lineType:P,flowStyle:k,areaStyle:me,pointStyle:ge,lineStyle:we,colorScheme:Re,themeSemantic:Tt(hi),themeSequential:hi?.colors?.sequential,themeDiverging:hi?.colors?.diverging,themeCategorical:hi?.colors?.categorical,graticule:S,projectionTransform:a,windowSize:pe,clock:si.now,decay:$e,pulse:Qe,transition:ni,introAnimation:ai,annotations:Fe,pointIdAccessor:g,lineIdAccessor:R,customLayout:c,layoutConfig:u,onLayoutError:d,layoutMargin:ti}),[i,r,n,p,f,m,P,k,me,ge,we,Re,hi,S,a,pe,si.now,$e,Qe,ni,ai,Fe,g,R,c,u,d,ti]),wi=je(bi),Ri=Wt(null);Ri.current||(Ri.current=new pi(wi));let xi=Ri.current,Pi=Wt(null),ki=Pi.current??(Pi.current=F(xi.scales)),Si=ft||!di&&fi;Si&&(mi||s||l)&&(mi&&xi.setAreas(mi),s&&xi.setPoints(gi),l&&xi.setLines(yi),xi.computeScene({width:ii,height:ri}));let{resolvedForeground:ji,resolvedBackground:Di,themeBackground:Bi,surfaceBackground:_i}=z({foregroundGraphics:St,backgroundGraphics:gt,size:ei,margin:ti,scales:xi.scales,background:he,themeBackgroundColor:hi.colors.background,tracker:ki,readScales:()=>xi.scales}),Ei=Wt(null),Fi=Wt(null),Wi=Wt(null);H&&!Wi.current&&(Wi.current=new Mi(X??256)),Wi.current?.setLimit(X??256);let Hi=Wt(Fe),Gi=Wt(null),qi=Wt(Ci),Zi=Wt(!1),Xi=Wt(null),Yi=Et(e=>{Xi.current=e,Jt&&"object"==typeof Jt&&(Jt.current=e)},[Jt]),$i=Wt(null),Qi=Wt(null),Ui=Wt(null),Vi=Wt(0);if(W&&!Ui.current){let e=O?.maxPerLine??_();Ui.current=new Ti(50*e)}let Ki=Wt(null),Ji=Wt(!1),er=Wt(null),tr=Wt(!1),ir=Wt(!1),rr=yt("StreamGeoFrame"),nr=Wt(void 0),[ar,or]=zt(null),[,sr]=zt(0),lr=Wt(0),[cr,ur]=zt(!1),hr=oe(Ri,It,Ot,e=>e.getPoints());ve(Ri,wi,Ut,ui),be(Ri,h,Ut,ui),Nt(()=>{let e=Ri.current;e&&(mi&&e.setAreas(mi),s&&e.setPoints(gi),l&&e.setLines(yi),Ut.current=!0,ui())},[mi,s,gi,l,yi,ui]),y(t,{storeRef:Ri,dirtyRef:Ut,scheduleRender:ui,zoomTransformRef:qi,containerRef:Xi,zoomBehaviorRef:Gi});let{hoverHandlerRef:dr,onPointerMove:pr,onPointerLeave:fr,pointerStateRef:mr}=Vt,{canvasRef:gr,interactionCanvasRef:yr,resolutionDirtyRef:vr}=He(Vt,{hydrated:di,wasHydratingFromSSR:fi,storeRef:Ri,dirtyRef:Ut,cleanup:()=>Wi.current?.clear(),maxDevicePixelRatio:de,canvasPaintDependencies:[ii,ri,he,gt,fe,H,X,ui]});Nt(()=>{dr.current=e=>{let t=gr.current;if(!t)return;let i=Ri.current;if(!i||!i.scene.length)return void st(t);let r=N({pointer:e,canvasRect:t.getBoundingClientRect(),margin:ti,width:ii,height:ri,scene:i.scene,pointQuadtree:i.quadtree,maxPointRadius:i.maxPointRadius,hitCanvasRef:Fi});st(t,"hit"===r.kind?rt(r.node):void 0),xe&&!1!==Se&&("hit"===r.kind?(Ki.current=r.hover,er.current=r.node,or(r.hover),Xt?.(r.hover),ui()):("outside"===r.kind||"miss"===r.kind&&Ki.current)&&(Ki.current=null,er.current=null,or(null),Xt?.(null),ui()))}},[xe,Se,ii,ri,ti,Xt,ui,dr,gr]),Vt.hoverLeaveRef.current=()=>{st(gr.current),xe&&!1!==Se&&(Ki.current=null,er.current=null,or(null),Xt?.(null),ui())},ut(gr);let br=Et(e=>{if(Oe(e.target)||!Yt)return;let t=Ri.current;if(!t||!t.scene.length)return void Yt(null);let i=e.currentTarget.getBoundingClientRect(),r=e.clientX-i.left-ti.left,n=e.clientY-i.top-ti.top;if(0>r||r>ii||0>n||n>ri)return void Yt(null);Fi.current||(Fi.current="u">typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));let a=E(Fi.current);if(!a)return void Yt(null);let o=Ze(30,nr.current),s=Ze(6,nr.current),l=v(t.scene,r,n,o,a,t.quadtree,t.maxPointRadius,s);if(l){let e=l.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,i=t?.properties?{...t,...t.properties}:t;return void Yt({...i,data:t,properties:t?.properties,__semioticHoverData:!0,x:r,y:n,time:r,value:n},{type:"activate",inputType:Ke(nr.current)})}Yt(null)},[ri,ii,Yt,ti]),{kbFocusIndexRef:wr,focusedNavPointRef:Rr,onKeyDown:xr}=J({storeRef:Ri,hoverRef:Ki,hoveredNodeRef:er,setHoverPoint:or,customHoverBehavior:Xt,customClickBehavior:Yt,scheduleRender:ui}),Pr=Et(e=>{ue(mr,e,xe&&!1!==Se,Ji.current,gr.current)&&(nr.current=e.pointerType,wr.current=-1,Rr.current=null,pr(e))},[gr,xe,Se,Rr,wr,pr,mr]),kr=Et(e=>{nr.current=e.pointerType},[]);ci.current=()=>{if(li.current=null,ki.sync(Ri.current?.scales??null),!si.isActive)return;let e=gr.current,t=Ri.current;if(!e||!t)return;let i=si.now(),r=!1,n=Qi.current,a=!1;n&&(Qi.current=null,t.applyRotation(n,{width:ii,height:ri}),a=!0);let o=null!=t.activeTransition,s=t.advanceTransition(Kt.current?i+1e6:i),l=!Kt.current&&s,c=rr.current.beforeCompute(t.getLastUpdateResult(),l),u=!1;if(Ut.current&&!s){let e={width:ii,height:ri},i=t.hasProjection(),r=vi&&i?t.getRotation():null;t.computeScene(e);let n=qi.current,a=1!==n.k||0!==n.x||0!==n.y;vi&&r?a?(t.setRotation(r),t.applyZoomScale(n.k,e)):t.applyRotation(r,e):a&&t.applyZoomTransform(n,e),Ut.current=!1,u=!0,hr()}ki.sync(t.scales),rr.current.afterCompute(c,u,!1);let h=ze(de,ei),d=W&&!Kt.current&&!!Ui.current,p=t.consumeStylePaintPending();var f;(u||a||p)&&(Ji.current=at(t.scene),Ji.current||st(e)),Ji.current&&(o||u||a||p)&&ct((f={canvas:e,pointer:mr.current,store:t,margin:ti,width:ii,height:ri,hitCanvasRef:Fi,geometryMoved:o||u||a}).canvas,f.pointer,e=>{let t=N({pointer:e,canvasRect:f.canvas.getBoundingClientRect(),margin:f.margin,width:f.width,height:f.height,scene:f.store.scene,pointQuadtree:f.geometryMoved?null:f.store.quadtree,maxPointRadius:f.store.maxPointRadius,hitCanvasRef:f.hitCanvasRef});return"hit"===t.kind?rt(t.node):void 0});let m=V(t,i,u,ir),g=te({dirtyOrRebuilt:u,transitioning:o,continuous:d,liveEncoding:m.changed,forced:a||p||vr.current});if(vr.current=!1,H&&Wi.current){let e=Ei.current;if(e&&t.scales?.projection){let i=We(e,ei,ti,h);i&&(i.clearRect(-ti.left,-ti.top,ei[0],ei[1]),i.save(),i.beginPath(),i.rect(0,0,ii,ri),i.clip(),A(i,{tileURL:H,projection:t.scales.projection,width:ii,height:ri,tileCache:Wi.current,maxDevicePixelRatio:de,onTileLoad:()=>ui()}),i.restore())}}if(g){let n=We(e,ei,ti,h);if(!n)return;n.clearRect(-ti.left,-ti.top,ei[0],ei[1]),H||De(n,{background:he,themeBackground:Bi,hasBackgroundGraphics:!!gt,x:-ti.left,y:-ti.top,width:ei[0],height:ei[1]}),n.save(),n.beginPath(),n.rect(0,0,ii,ri),n.clip();let a=t.scene,o=t.scales,s={width:ii,height:ri};if(se({context:n,nodes:a,renderMode:fe,pixelRatio:h,paintBuiltIn:e=>{x(n,e),q(n,e,o,s),ee(n,e,o,s),re(n,e,o,s)}}),d&&Ui.current){let e=Ui.current,t=a.filter(e=>"line"===e.type);if(t.length>0){let a=O||{},o=.3*(a.speedMultiplier??1),s=a.maxPerLine??_(),l=a.spawnRate??(B()?.06:.15),c=a.radius??2,u=a.opacity??.7,h=i/1e3,d=Vi.current>0?Math.min(h-Vi.current,.1):.016;Vi.current=h;let p=t.map(e=>e.path),f=t.map(e=>e.style.strokeWidth??2);for(let i=0;t.length>i;i++)si.random()<l&&e.countForLine(i)<s&&e.spawn(i,si.random);e.step(d,o,p,f),n.globalAlpha=u;for(let i=0;e.particles.length>i;i++){let r=e.particles[i];if(!r.active)continue;let o=t[r.lineIndex],s="function"==typeof a.color?a.color(o?.datum??{}):"source"!==a.color&&a.color?a.color:o?.style.stroke||"#fff";n.beginPath(),n.arc(r.x,r.y,c,0,2*Math.PI),n.fillStyle=s,n.fill()}n.globalAlpha=1,r=!0}}n.restore()}(u||o&&!s)&&e.setAttribute("aria-label",bt(t.scene,"Geographic chart"));let y=er.current,v=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=ie(v,tr.current),w=yr.current;if(w&&b){let e=We(w,ei,ti,h);if(e){if(e.clearRect(-ti.left,-ti.top,ei[0],ei[1]),y&&"geoarea"===y.type){let 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){let t=y,i=("object"==typeof Se?Se:void 0)?.pointColor||G(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}tr.current=v}let R=Fe!==Hi.current;R&&(Hi.current=Fe),(u||R||o&&Fe&&Fe.length>0)&&(u||R||o&&!s||i-lr.current>=33)&&(sr(e=>e+1),lr.current=i),(l||null!=t.activeTransition||m.pending||r)&&ui()},Pe(Je,Ri,Ut,ui,si.now,cr,ur),Nt(()=>{if("production"!==process.env.NODE_ENV&&H){let e=I(i);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.`)}},[H,i]),Nt(()=>{let e=Xi.current;if(!L||!e)return Gi.current&&e&&(Ai(e).on(".zoom",null),Gi.current=null),void(e&&Ai(e).on("mousedown.rotate",null).on("touchstart.rotate",null));let[t,i]=C||[1,8],r={width:ii,height:ri};if(vi){let n=qi.current.k,a=e=>{n=Math.max(t,Math.min(i,e)),qi.current=Ci.scale(n);let a=Ri.current;a&&(a.applyZoomScale(n,r),Ut.current=!1,ui(),a.scales?.projection&&j?.({projection:a.scales.projection,zoom:a.currentZoom}))};Gi.current={scaleBy:(e,t)=>a(n*t),transform:(e,t)=>a(t?.k??1)};let o=e=>{e.preventDefault(),a(n*(0>e.deltaY?1.1:1/1.1))},s=e=>{let t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),a(1.5*n))};e.addEventListener("wheel",o,{passive:!1}),e.addEventListener("dblclick",s);let l=.4,c=t=>{if(0!==t.button)return;let i=t.target;if(i.closest("button")||i.closest(".stream-geo-zoom-controls"))return;let r=Ri.current;if(!r)return;let n=r.getRotation();$i.current={x:t.clientX,y:t.clientY,rotation:[...n]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{let t=$i.current;t&&(Qi.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]],ui())},h=t=>{if(!$i.current)return;$i.current=null,e.releasePointerCapture(t.pointerId);let i=Qi.current;if(i){Qi.current=null;let e=Ri.current;e&&(e.applyRotation(i,r),ui())}let n=Ri.current;n?.scales?.projection&&j?.({projection:n.scales.projection,zoom:n.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",o),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),Gi.current=null}}let n=Li().scaleExtent([t,i]).extent([[0,0],[ei[0],ei[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{let t=e.transform;qi.current=t,Zi.current=!0;let i=Ri.current;i&&(i.applyZoomTransform(t,r),Ut.current=!1,ui())}).on("end",e=>{qi.current=e.transform,Zi.current=!1;let t=Ri.current;t?.scales?.projection&&j?.({projection:t.scales.projection,zoom:t.currentZoom})});return Gi.current=n,Ai(e).call(n),()=>{Ai(e).on(".zoom",null)}},[L,C,vi,ei,ii,ri,ti,j,ui]);let Sr=xe&&!1!==Se,Lr=Sr&&ar?Le?Le(ar):/* @__PURE__ */zi(T,{data:ar}):null,Cr=Lr?/* @__PURE__ */zi(Ie,{x:ar.x,y:ar.y,containerWidth:ii,containerHeight:ri,margin:ti,className:"stream-frame-tooltip",zIndex:10,children:Lr}):null;if(Si){let e=xi.scene;/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */Bi("span",{style:{fontWeight:600},children:ce(e.value)})]},e.key))]})}function B(){if(null!==Ei)return Ei;if(typeof window>"u")return!1;let e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t="u">typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,i="u">typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Ei=e||t||i}function _(){return B()?12:30}function I(e){return"string"==typeof e?e:"object"==typeof e&&e&&"type"in e?e.type:null}function E(e){return e?e.getContext("2d"):null}function N(e){let t=e.pointer.clientX-e.canvasRect.left-e.margin.left,i=e.pointer.clientY-e.canvasRect.top-e.margin.top;if(0>t||t>e.width||0>i||i>e.height)return{kind:"outside"};e.hitCanvasRef.current||(e.hitCanvasRef.current="u">typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));let r=E(e.hitCanvasRef.current);if(!r)return{kind:"unavailable"};let n=v(e.scene,t,i,Xe(30,e.pointer.pointerType),r,e.pointQuadtree,e.maxPointRadius,Xe(6,e.pointer.pointerType));if(!n)return{kind:"miss"};let{node:a}=n,o=a.datum,s=Array.isArray(o)?null:o?.properties?o:o?.data||o,l="point"===a.type?a.x:"geoarea"===a.type?a.centroid[0]:t,c="point"===a.type?a.y:"geoarea"===a.type?a.centroid[1]:i;return{kind:"hit",node:a,hover:{...s,...s?.properties||{},data:s,properties:s?.properties,__semioticHoverData:!0,x:l,y:c}}}function F(e){let t=/* @__PURE__ */new Set,i=0,r=e;return{subscribe:e=>(t.add(e),()=>t.delete(e)),getSnapshot:()=>i,sync(e){if(e!==r){r=e,i+=1;for(let e of t)e()}}}}function z({graphics:e,size:t,margin:i,readScales:r,tracker:n}){return zi(n.subscribe,n.getSnapshot,n.getSnapshot),Fi.createElement(Fi.Fragment,null,ne(e,t,i,r()))}function W({tracker:e,readScales:t,...i}){let r=r=>"function"==typeof r?Fi.createElement(z,{graphics:r,size:i.size,margin:i.margin,readScales:t,tracker:e}):r;return{...ae({...i,resolveScaleAwareGraphics:!1}),resolvedForeground:r(i.foregroundGraphics),resolvedBackground:r(i.backgroundGraphics)}}import{b as O}from"./c-YL7HJL5J.min.js";import{b as H}from"./c-FMCUQ6JX.min.js";import{a as G}from"./c-7FKPPCGN.min.js";import{b as q}from"./c-STHZWF3D.min.js";import{a as X,b as Z,d as Y,e as $,h as Q,i as U,j as J,k as V,n as K}from"./c-JOPGDP6N.min.js";import{a as ee}from"./c-P5NXQWIM.min.js";import{a as te,b as ie}from"./c-BYJJ7EMG.min.js";import{a as re}from"./c-3AGX252H.min.js";import{A as ne,B as ae,D as oe,E as se,F as le,I as ce,W as ue,X as he,Y as de,a as pe,d as fe,e as me,f as ge,g as ye,h as ve,i as be,j as we,l as Re,o as Pe,q as xe,r as ke,s as Se,t as Le,u as Ce,v as Ae,x as De,z as je}from"./c-SAP5KY6R.min.js";import{d as Me}from"./c-V5KFJWQQ.min.js";import{c as Te}from"./c-CLLCX3PT.min.js";import{a as Be,b as _e}from"./c-N5WT7TXG.min.js";import{Ca as Ie,D as Ee,Fa as Ne,H as Fe,Ha as ze,Ia as We,J as Oe,Ja as He,Ka as Ge,L as qe,La as Xe,M as Ze,Na as Ye,R as $e,U as Qe,Va as Ue,W as Je,Wa as Ve,Y as Ke,ab as et,b as tt,c as it,ca as rt,d as nt,da as at,e as ot,ea as st,f as lt,ga as ct,ha as ut,ia as ht,ja as dt,ka as pt,o as ft,oa as mt,p as gt,q as yt,qa as vt,ra as bt,s as wt,ta as Rt,va as Pt,wa as xt,xa as kt,ya as St}from"./c-UMGHCBH5.min.js";import{p as Lt}from"./c-Y342FJ6K.min.js";import{i as Ct,m as At,r as Dt,t as jt,z as Mt}from"./c-3BYZXCX3.min.js";import{e as Tt}from"./c-5NYONM6V.min.js";import{c as Bt}from"./c-3PFVJFBK.min.js";import{forwardRef as _t,memo as It,useCallback as Et,useEffect as Nt,useMemo as Ft,useRef as zt,useState as Wt}from"react";import{geoPath as Ot}from"d3-geo";import{quadtree as Ht}from"d3-quadtree";import{geoMercator as Gt,geoEqualEarth as qt,geoAlbersUsa as Xt,geoOrthographic as Zt,geoNaturalEarth1 as Yt,geoEquirectangular as $t}from"d3-geo";var Qt={mercator:Gt,equalEarth:qt,albersUsa:Xt,orthographic:Zt,naturalEarth:Yt,equirectangular:$t};import{scaleLinear as Ut}from"d3-scale";var Jt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vt=["scene-style","data-paint","accessibility","evidence"],Kt=(e,t)=>({retainedData:e,invalidations:t}),ei=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ti=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ii=["scene-geometry","data-paint","accessibility","evidence"],ri=["scene-style","data-paint","accessibility","evidence"],ni=["overlay","accessibility","evidence"],ai=[],oi={xAccessor:Kt("rebuild",ei),yAccessor:Kt("rebuild",ei),lineDataAccessor:Kt("rebuild",ei),pointIdAccessor:Kt("rebuild",ii),lineIdAccessor:Kt("rebuild",ii),windowSize:Kt("rebuild",ei),projection:Kt("preserve",ti),projectionExtent:Kt("preserve",ti),fitPadding:Kt("preserve",ti),lineType:Kt("preserve",ti),flowStyle:Kt("preserve",ti),graticule:Kt("preserve",ti),projectionTransform:Kt("preserve",ti),customLayout:Kt("preserve",ti),layoutConfig:Kt("preserve",ti),layoutMargin:Kt("preserve",ti),areaStyle:Kt("preserve",ri),pointStyle:Kt("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:Kt("preserve",ri),colorScheme:Kt("preserve",ri),themeCategorical:Kt("preserve",ri),themeDiverging:Kt("preserve",ri),themeSemantic:Kt("preserve",ri),themeSequential:Kt("preserve",ri),decay:Kt("preserve",ri),pulse:Kt("preserve",ri),layoutSelection:Kt("preserve",ri),annotations:Kt("preserve",ni),autoPlaceAnnotations:Kt("preserve",ni),clock:Kt("preserve",ai),transition:Kt("preserve",ai),introAnimation:Kt("preserve",ai),onLayoutError:Kt("preserve",ai)},si=Kt("preserve",ti),li=class{constructor(){this.tracker=new gt}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}},Jt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vt):this.recordNoop("restyle")}recordConfig(e,t={}){let i=f(e),r=new Set(i.invalidations);return t.retainedDataChanged&&r.add("data"),this.tracker.record({kind:"config",keys:e},r)}};import{geoDistance as ci,geoGraticule as ui,geoInterpolate as hi}from"d3-geo";var di=class r{constructor(e){var t;this.updateResults=new li,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=(t=e,{...t,fitPadding:g(t.fitPadding)})}currentTime(){return this.config.clock?.()??lt()}getConfiguredWindowSize(){let 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){let t=this.pointBuffer.toArray(),i=this.timestampBuffer?.toArray()??[],r=t.slice(-e),n=i.slice(-r.length),a=this.currentTime();this.pointBuffer=new X(e),this.timestampBuffer=new X(e),r.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(n[t]??a)})}this.retainNewestLines(e)}updateConfig(e){let t="fitPadding"in(a=e)?{...a,fitPadding:g(a.fitPadding)}:a,i=this.config,r=this.getConfiguredWindowSize(),n=Object.keys(t).filter(e=>t[e]!==i[e]);var a;this.config={...this.config,...t};let o=this.getConfiguredWindowSize(),s=this.streaming&&o!==r;s&&(this.resizeStreamingWindow(o),this.version++),"customLayout"in t&&!t.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(n,{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});let t=this.getConfiguredWindowSize(),i=this.pointBuffer?this.pointBuffer.toArray():this.pointData,r=this.timestampBuffer?.toArray()??[],n=i.slice(-t),a=r.slice(-n.length),o=this.currentTime();this.pointBuffer=new X(t),this.timestampBuffer=new X(t),n.forEach((e,t)=>{this.pointBuffer.push(e),this.timestampBuffer.push(a[t]??o)}),this.pointData=[],this.retainNewestLines(t),this.streaming=!0}pushPoint(e){this.pointBuffer||this.initStreaming();let t=this.currentTime();Q(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();let t=this.currentTime();for(let i of e)Q(this.pointBuffer,i,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");let t=e.filter(e=>null!=e&&"object"==typeof e);if(0!==t.length){this.streaming||this.initStreaming();for(let e of t)this.lineData.push(e);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",t.length)}else this.updateResults.recordNoop("ingest")}removeLine(e){let{lineIdAccessor:t}=this.config;if(!t)throw Error("removeLine() requires lineIdAccessor to be configured");let i="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]),n=[];return this.lineData=this.lineData.filter(e=>!r.has(i(e)+"")||(n.push(e),!1)),n.length>0?(this.version++,this.updateResults.recordData("remove",n.length)):this.updateResults.recordNoop("remove"),n}getLines(){return this.lineData.slice()}removePoint(e){let{pointIdAccessor:t}=this.config;if(!t)throw Error("removePoint() requires pointIdAccessor to be configured");let i="function"==typeof t?t:e=>e[t],r=new Set(Array.isArray(e)?e:[e]);if(this.streaming&&this.pointBuffer){let e=e=>r.has(i(e)+"");U(this.pointBuffer,this.timestampBuffer,e);let t=this.pointBuffer.remove(e);return t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}{let e=[];return this.pointData=this.pointData.filter(t=>!r.has(i(t)+"")||(e.push(t),!1)),e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(e){let t=this._customRestyle;if(t){for(let i of this.scene){let r=this._baseStyles.get(i)??i.style,n=t(i,e);i.style=n?{...r,...n}:r}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(t){let{config:i}=this,r=this.projection,n=this.geoPath,a=this.scales,o=this.baseScale,s=[...this.baseTranslate],l=[...this.baseRotation],c=this.scene;this.projection=e(i.projection),this.geoPath=Ot(this.projection),this.fitProjection(t),this.geoPath=Ot(this.projection);let u=this.projection;this.scales={projection:u,geoPath:this.geoPath,projectedPoint:(e,t)=>u([e,t]),invertedPoint:(e,t)=>u.invert?u.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let h=this.buildSceneNodes(t);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=r,this.geoPath=n,this.scales=a,this.baseScale=o,this.baseTranslate=s,this.baseRotation=l):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=h,this.rebuildQuadtree(),i.projectionTransform&&this.applyCartogramTransform(i.projectionTransform,t),i.decay&&this.streaming&&this.applyDecay(),i.pulse&&this.streaming&&this.applyPulse(),i.transition&&!this._hasRenderedOnce&&this.scene.length>0&&i.introAnimation){let e=t.width/2,i=t.height/2,r=this.scene.filter(e=>"point"===e.type).map(t=>({...t,x:e,y:i}));r.length>0&&this.startTransition(r)}this._hasRenderedOnce=!0,i.transition&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(e){let r=this.projection,n=this.config,a=[...this.areas],o=t(n.xAccessor,"lon"),s=t(n.yAccessor,"lat"),l=this.getPoints();if(l.length>0){let e=l.map(e=>[o(e),s(e)]);a.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:e}})}let c=i(n.lineDataAccessor);for(let e of this.lineData){let t=c(e);if(t&&t.length>0){let e=t.map(e=>[o(e),s(e)]);a.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}})}}if(0!==a.length){if(n.projectionExtent){let[[t,i],[a,o]]=n.projectionExtent;r.fitExtent([[0,0],[e.width,e.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[t,i],[t,o],[a,o],[a,i],[t,i]]]}})}else if(r.clipAngle&&(r.clipAngle()??0)>0){let t=n.fitPadding??0,i=Math.min(e.width,e.height);r.scale(i/2-i*t),r.translate([e.width/2,e.height/2])}else{let t=n.fitPadding??0,i=e.width*t,o=e.height*t;r.fitExtent([[i,o],[e.width-i,e.height-o]],{type:"FeatureCollection",features:a})}this.baseScale=r.scale(),this.baseTranslate=r.translate(),this.baseRotation=r.rotate?.()??[0,0,0]}}applyZoomTransform(e,t){let i=this.projection;if(!i)return;let r=this.geoPath,n=this.scales,a=i.scale(),o=[...i.translate()],s=this.currentZoom;i.scale(this.baseScale*e.k),i.translate([this.baseTranslate[0]*e.k+e.x,this.baseTranslate[1]*e.k+e.y]),this.currentZoom=e.k,this.geoPath=Ot(i),this.scales={projection:i,geoPath:this.geoPath,projectedPoint:(e,t)=>i([e,t]),invertedPoint:(e,t)=>i.invert?i.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(i.scale(a),i.translate(o),this.currentZoom=s,this.geoPath=r,this.scales=n):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyZoomScale(e,t){let i=this.projection;if(!i)return;let r=this.geoPath,n=this.scales,a=i.scale(),o=[...i.translate()],s=this.currentZoom;i.scale(this.baseScale*e),i.translate(this.baseTranslate),this.currentZoom=e,this.geoPath=Ot(i),this.scales={projection:i,geoPath:this.geoPath,projectedPoint:(e,t)=>i([e,t]),invertedPoint:(e,t)=>i.invert?i.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let l=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(i.scale(a),i.translate(o),this.currentZoom=s,this.geoPath=r,this.scales=n):(this.scene=[],this.rebuildQuadtree()):(this.scene=l,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}applyRotation(e,t){let i=this.projection;if(!i||!i.rotate)return;let r=this.geoPath,n=this.scales,a=[...i.rotate()];i.rotate(e),this.geoPath=Ot(i),this.scales={projection:i,geoPath:this.geoPath,projectedPoint:(e,t)=>i([e,t]),invertedPoint:(e,t)=>i.invert?i.invert([e,t]):null},this._customLayoutFailedThisBuild=!1;let o=this.buildSceneNodes(t);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(i.rotate(a),this.geoPath=r,this.scales=n):(this.scene=[],this.rebuildQuadtree()):(this.scene=o,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,t),this.version++)}setRotation(e){let t=this.projection;!t||!t.rotate||t.rotate(e)}hasProjection(){return null!=this.projection}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,t=0;for(let i of this.scene)"point"===i.type&&!1!==i.interactive&&(t++,i.r>e&&(e=i.r));if(this._maxPointRadius=e,r.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);let i=Array(t),n=0;for(let e of this.scene)"point"===e.type&&!1!==e.interactive&&(i[n++]=e);this._quadtree=Ht().x(e=>e.x).y(e=>e.y).addAll(i)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(e){this._customLayoutFailedThisBuild=!1;let{config:t}=this,i=this.projection,r=this.geoPath;if(t.customLayout&&this.scales){let i=t.layoutMargin??{top:0,right:0,bottom:0,left:0},r=Be(t.colorScheme,t.themeCategorical,Lt),n={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:e.width,height:e.height,margin:i,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:t.themeSemantic??{},categorical:[...r]},resolveColor:_e(r,t.colorScheme),config:t.layoutConfig??{},selection:t.layoutSelection??null},a=me({family:"geo",logLabel:"geo customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:t.onLayoutError,run:()=>t.customLayout(n)});if("failure"===a.kind)return this.lastCustomLayoutFailure=a.diagnostic,this._customLayoutFailedThisBuild=!0,a.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,[]);let o=a.result,s=o.nodes??[];if(this.customLayoutOverlays=o.overlays??null,this.lastCustomLayoutResult=o,this.lastCustomLayoutFailure=null,this._customRestyle=o.restyle,this.hasCustomRestyle=!!o.restyle,this._baseStyles=/* @__PURE__ */new WeakMap,this.hasCustomRestyle)for(let e of s){this._baseStyles.set(e,e.style);let i=o.restyle?.(e,t.layoutSelection??null);i&&(e.style={...e.style,...i})}return fe({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,m({config:t,projection:i,path:r,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:e})}applyCartogramTransform(e,t){let i=h(this.scene,e,t,this.areas.length);i&&(this.cartogramLayout=i)}applyDecay(){let e=this.config.decay;if(!e||!this.pointBuffer)return;let t=this.pointBuffer.size;if(0===t)return;let i=this.scene.filter(e=>"point"===e.type);for(let r=0;i.length>r;r++){let n=pe(e,r,t);i[r]._decayOpacity=n,i[r].style={...i[r].style,opacity:n}}}applyPulse(e=this.currentTime()){let t=this.config.pulse;if(!t||!this.timestampBuffer)return!1;let i=this.scene.filter(e=>"point"===e.type),r=this.timestampBuffer.toArray(),n=t.color||"rgba(255,255,255,0.6)",a=t.glowRadius??4,o=!1;for(let s=0;i.length>s&&r.length>s;s++){let l=Z(t,r[s],e);o=Y(i[s],l,n,a)||o}return o}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(e)}hasActivePulsesAt(e){return!!this.config.pulse&&$(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(e){let t=this.config.transition?.duration??300;if(0>=t)return;let i=/* @__PURE__ */new Map;for(let t of e)"point"===t.type&&t.pointId&&i.set(t.pointId,[t.x,t.y]);let r=this.scene.filter(e=>"point"===e.type),n=!1;for(let e of r)if(e.pointId){let t=i.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)&&(n=!0))}for(let e of r)e.pointId&&!i.has(e.pointId)&&(e._targetOpacity=e.style?.opacity??e.style?.fillOpacity??1,e.style={...e.style,opacity:0},n=!0);n&&(this.activeTransition={startTime:this.currentTime(),duration:t})}cancelIntroAnimation(){this.activeTransition=null;for(let e of this.scene)"point"===e.type&&(null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity},e._targetOpacity=void 0),null!=e._targetX&&(e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0))}advanceTransition(e){if(!this.activeTransition)return!1;let t=nt(e,this.activeTransition),i=it(t),r=this.scene.filter(e=>"point"===e.type);for(let e of r){if(null!=e._targetX&&null!=e._targetY){let t=e.y;e.x=ot(e.x,e._targetX,i),e.y=ot(t,e._targetY,i)}null!=e._targetOpacity&&(e.style={...e.style,opacity:e._targetOpacity*i})}if(t>=1){for(let 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}};di.QUADTREE_THRESHOLD=500;var pi=di;ge(pi);import{useCallback as fi,useImperativeHandle as mi}from"react";import{select as gi}from"d3-selection";import{zoomIdentity as yi}from"d3-zoom";import{useMemo as vi,useRef as bi,useId as wi}from"react";import{jsx as Ri,jsxs as Pi}from"react/jsx-runtime";import*as xi from"react";import{jsx as ki,jsxs as Si}from"react/jsx-runtime";import{zoom as Li,zoomIdentity as Ci}from"d3-zoom";import{select as Ai}from"d3-selection";var Di=/* @__PURE__ */new WeakMap,ji=1,Mi=class{constructor(e=256){this.cache=/* @__PURE__ */new Map,this.limit=C(e)}setLimit(e){this.limit=C(e),this.cache.size>this.limit&&this.evict()}get(e){let 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(let[i,r]of this.cache)t>r.lastUsed&&(t=r.lastUsed,e=i);if(!e)break;{let t=this.cache.get(e);t&&(t.img.onload=null,t.img.onerror=null,t.img.src=""),this.cache.delete(e)}}}clear(){for(let e of this.cache.values())e.img.onload=null,e.img.onerror=null,e.img.src="";this.cache.clear()}},Ti=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 i=0;this.capacity>i;i++){let r=this.particles[i];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,i,r){for(let n=0;this.capacity>n;n++){let a=this.particles[n];if(!a.active)continue;let o=i[a.lineIndex];if(!o||2>o.length){a.active=!1;continue}if(a.t+=e*t,a.t>=1){a.active=!1;continue}let s=D(o),l=j(o,a.t*s),c=(r[a.lineIndex]||2)/2;a.x=l.x+l.nx*a.offset*c*2,a.y=l.y+l.ny*a.offset*c*2}}countForLine(e){let t=0;for(let i=0;this.capacity>i;i++)this.particles[i].active&&this.particles[i].lineIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}};import{jsx as Bi,jsxs as _i}from"react/jsx-runtime";T.ownsChrome=!0;var Ii={top:10,right:10,bottom:10,left:10},Ei=null,Ni={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)"};import*as Fi from"react";import{useSyncExternalStore as zi}from"react";import{jsx as Wi,jsxs as Oi}from"react/jsx-runtime";var Hi=It(_t(function(e,t){let{projection:i,projectionExtent:r,fitPadding:n,projectionTransform:a,areas:o,points:s,lines:l,customLayout:c,layoutConfig:u,layoutSelection:h,onLayoutError:d,xAccessor:p,yAccessor:f,lineDataAccessor:m,pointIdAccessor:g,lineIdAccessor:R,lineType:x="geo",flowStyle:k="basic",graticule:S,zoomable:L,zoomExtent:C,onZoom:D,dragRotate:j,showParticles:z,particleStyle:O,tileURL:H,tileAttribution:X,tileCacheSize:Z,size:Y,width:$,height:Q,responsiveWidth:U,responsiveHeight:ne,margin:ae,className:ce,background:he,maxDevicePixelRatio:de,windowSize:pe=500,renderMode:fe,areaStyle:me,pointStyle:ge,lineStyle:we,colorScheme:Re,enableHover:Pe=!0,hoverAnnotation:Se,tooltipContent:Le,allowTooltipOverflow:Ce=!1,customClickBehavior:Ae,customHoverBehavior:Me,onObservation:Be,annotationObservationCallback:_e,chartId:Ee,annotations:Fe,onAnnotationActivate:qe,autoPlaceAnnotations:Ze,svgAnnotationRules:Ye,decay:$e,pulse:Qe,transition:Ue,animate:Je,staleness:Ke,frameScheduler:et,clock:it,random:nt,seed:ot,paused:lt=!1,suspendWhenHidden:ht=!0,backgroundGraphics:gt,foregroundGraphics:St,title:Lt,legend:Ct,legendPosition:At,legendLayout:Dt,legendHoverBehavior:jt,legendClickBehavior:Mt,legendHighlightedCategory:Bt,legendIsolatedCategories:_t,legendCategoryAccessor:It,onCategoriesChange:Ot,showAxes:Ht,accessibleTable:Gt=!0,description:qt,summary:Xt}=e,{customHoverBehavior:Zt,customClickBehavior:Yt,hasClickBehavior:$t}=V({customHoverBehavior:Me,customClickBehavior:Ae,onObservation:Be,chartId:Ee,chartType:"StreamGeoFrame"}),Qt=Y||[$||600,Q||400],Ut=zt(!0),Jt=Ne({sizeProp:Qt,responsiveWidth:U,responsiveHeight:ne,userMargin:ae,marginDefault:Ii,title:Lt,legend:Ct,legendPosition:At,legendLayout:Dt,legendMarginReserved:e.__legendMarginReservedFor===Ct,animate:Je,transitionProp:Ue,frameScheduler:et,clock:it,random:nt,seed:ot,paused:lt,suspendWhenHidden:ht,themeDirtyRef:Ut}),{reducedMotionRef:Vt,responsiveRef:Kt,size:ei,margin:ti,adjustedWidth:ii,adjustedHeight:ri,transition:ni,introEnabled:ai,tableId:oi,frameRuntime:si,rafRef:li,renderFnRef:ci,scheduleRender:ui,currentTheme:hi}=Jt,di=dt(),fi=pt(),mi=Ft(()=>Array.isArray(o)?tt(o):o,[o]),gi=Ft(()=>tt(s),[s]),yi=Ft(()=>tt(l),[l]),vi=j??"orthographic"===I(i),bi=Ft(()=>({projection:i,projectionExtent:r,fitPadding:n,xAccessor:p,yAccessor:f,lineDataAccessor:m,lineType:x,flowStyle:k,areaStyle:me,pointStyle:ge,lineStyle:we,colorScheme:Re,themeSemantic:Tt(hi),themeSequential:hi?.colors?.sequential,themeDiverging:hi?.colors?.diverging,themeCategorical:hi?.colors?.categorical,graticule:S,projectionTransform:a,windowSize:pe,clock:si.now,decay:$e,pulse:Qe,transition:ni,introAnimation:ai,annotations:Fe,pointIdAccessor:g,lineIdAccessor:R,customLayout:c,layoutConfig:u,onLayoutError:d,layoutMargin:ti}),[i,r,n,p,f,m,x,k,me,ge,we,Re,hi,S,a,pe,si.now,$e,Qe,ni,ai,Fe,g,R,c,u,d,ti]),wi=De(bi),Ri=zt(null);Ri.current||(Ri.current=new pi(wi));let Pi=Ri.current,xi=zt(null),ki=xi.current??(xi.current=F(Pi.scales)),Si=ft||!di&&fi;Si&&(mi||s||l)&&(mi&&Pi.setAreas(mi),s&&Pi.setPoints(gi),l&&Pi.setLines(yi),Pi.computeScene({width:ii,height:ri}));let{resolvedForeground:Di,resolvedBackground:ji,themeBackground:Bi,surfaceBackground:_i}=W({foregroundGraphics:St,backgroundGraphics:gt,size:ei,margin:ti,scales:Pi.scales,background:he,themeBackgroundColor:hi.colors.background,tracker:ki,readScales:()=>Pi.scales}),Ei=zt(null),Fi=zt(null),zi=zt(null);H&&!zi.current&&(zi.current=new Mi(Z??256)),zi.current?.setLimit(Z??256);let Hi=zt(Fe),Gi=zt(null),qi=zt(Ci),Xi=zt(!1),Zi=zt(null),Yi=Et(e=>{Zi.current=e,Kt&&"object"==typeof Kt&&(Kt.current=e)},[Kt]),$i=zt(null),Qi=zt(null),Ui=zt(null),Ji=zt(0);if(z&&!Ui.current){let e=O?.maxPerLine??_();Ui.current=new Ti(50*e)}let Vi=zt(null),Ki=zt(!1),er=zt(null),tr=zt(!1),ir=zt(!1),rr=yt("StreamGeoFrame"),nr=zt(void 0),[ar,or]=Wt(null),[,sr]=Wt(0),lr=zt(0),[cr,ur]=Wt(!1),hr=oe(Ri,It,Ot,e=>e.getPoints());ve(Ri,wi,Ut,ui),be(Ri,h,Ut,ui),Nt(()=>{let e=Ri.current;e&&(mi&&e.setAreas(mi),s&&e.setPoints(gi),l&&e.setLines(yi),Ut.current=!0,ui())},[mi,s,gi,l,yi,ui]),y(t,{storeRef:Ri,dirtyRef:Ut,scheduleRender:ui,zoomTransformRef:qi,containerRef:Zi,zoomBehaviorRef:Gi});let{hoverHandlerRef:dr,onPointerMove:pr,onPointerLeave:fr,pointerStateRef:mr}=Jt,{canvasRef:gr,interactionCanvasRef:yr,resolutionDirtyRef:vr}=He(Jt,{hydrated:di,wasHydratingFromSSR:fi,storeRef:Ri,dirtyRef:Ut,cleanup:()=>zi.current?.clear(),maxDevicePixelRatio:de,canvasPaintDependencies:[ii,ri,he,gt,fe,H,Z,ui]});Nt(()=>{dr.current=e=>{let t=gr.current;if(!t)return;let i=Ri.current;if(!i||!i.scene.length)return void st(t);let r=N({pointer:e,canvasRect:t.getBoundingClientRect(),margin:ti,width:ii,height:ri,scene:i.scene,pointQuadtree:i.quadtree,maxPointRadius:i.maxPointRadius,hitCanvasRef:Fi});st(t,"hit"===r.kind?rt(r.node):void 0),Pe&&!1!==Se&&("hit"===r.kind?(Vi.current=r.hover,er.current=r.node,or(r.hover),Zt?.(r.hover),ui()):("outside"===r.kind||"miss"===r.kind&&Vi.current)&&(Vi.current=null,er.current=null,or(null),Zt?.(null),ui()))}},[Pe,Se,ii,ri,ti,Zt,ui,dr,gr]),Jt.hoverLeaveRef.current=()=>{st(gr.current),Pe&&!1!==Se&&(Vi.current=null,er.current=null,or(null),Zt?.(null),ui())},ut(gr);let br=Et(e=>{if(Oe(e.target)||!Yt)return;let t=Ri.current;if(!t||!t.scene.length)return void Yt(null);let i=e.currentTarget.getBoundingClientRect(),r=e.clientX-i.left-ti.left,n=e.clientY-i.top-ti.top;if(0>r||r>ii||0>n||n>ri)return void Yt(null);Fi.current||(Fi.current="u">typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));let a=E(Fi.current);if(!a)return void Yt(null);let o=Xe(30,nr.current),s=Xe(6,nr.current),l=v(t.scene,r,n,o,a,t.quadtree,t.maxPointRadius,s);if(l){let e=l.node.datum,t=Array.isArray(e)?null:e?.properties?e:e?.data||e,i=t?.properties?{...t,...t.properties}:t;return void Yt({...i,data:t,properties:t?.properties,__semioticHoverData:!0,x:r,y:n,time:r,value:n},{type:"activate",inputType:Ve(nr.current)})}Yt(null)},[ri,ii,Yt,ti]),{kbFocusIndexRef:wr,focusedNavPointRef:Rr,onKeyDown:Pr}=K({storeRef:Ri,hoverRef:Vi,hoveredNodeRef:er,setHoverPoint:or,customHoverBehavior:Zt,customClickBehavior:Yt,scheduleRender:ui}),xr=Et(e=>{ue(mr,e,Pe&&!1!==Se,Ki.current,gr.current)&&(nr.current=e.pointerType,wr.current=-1,Rr.current=null,pr(e))},[gr,Pe,Se,Rr,wr,pr,mr]),kr=Et(e=>{nr.current=e.pointerType},[]);ci.current=()=>{if(li.current=null,ki.sync(Ri.current?.scales??null),!si.isActive)return;let e=gr.current,t=Ri.current;if(!e||!t)return;let i=si.now(),r=!1,n=Qi.current,a=!1;n&&(Qi.current=null,t.applyRotation(n,{width:ii,height:ri}),a=!0);let o=null!=t.activeTransition,s=t.advanceTransition(Vt.current?i+1e6:i),l=!Vt.current&&s,c=rr.current.beforeCompute(t.getLastUpdateResult(),l),u=!1;if(Ut.current&&!s){let e={width:ii,height:ri},i=t.hasProjection(),r=vi&&i?t.getRotation():null;t.computeScene(e);let n=qi.current,a=1!==n.k||0!==n.x||0!==n.y;vi&&r?a?(t.setRotation(r),t.applyZoomScale(n.k,e)):t.applyRotation(r,e):a&&t.applyZoomTransform(n,e),Ut.current=!1,u=!0,hr()}ki.sync(t.scales),rr.current.afterCompute(c,u,!1);let h=We(de,ei),d=z&&!Vt.current&&!!Ui.current,p=t.consumeStylePaintPending();var f;(u||a||p)&&(Ki.current=at(t.scene),Ki.current||st(e)),Ki.current&&(o||u||a||p)&&ct((f={canvas:e,pointer:mr.current,store:t,margin:ti,width:ii,height:ri,hitCanvasRef:Fi,geometryMoved:o||u||a}).canvas,f.pointer,e=>{let t=N({pointer:e,canvasRect:f.canvas.getBoundingClientRect(),margin:f.margin,width:f.width,height:f.height,scene:f.store.scene,pointQuadtree:f.geometryMoved?null:f.store.quadtree,maxPointRadius:f.store.maxPointRadius,hitCanvasRef:f.hitCanvasRef});return"hit"===t.kind?rt(t.node):void 0});let m=J(t,i,u,ir),g=te({dirtyOrRebuilt:u,transitioning:o,continuous:d,liveEncoding:m.changed,forced:a||p||vr.current});if(vr.current=!1,H&&zi.current){let e=Ei.current;if(e&&t.scales?.projection){let i=ze(e,ei,ti,h);i&&(i.clearRect(-ti.left,-ti.top,ei[0],ei[1]),i.save(),i.beginPath(),i.rect(0,0,ii,ri),i.clip(),A(i,{tileURL:H,projection:t.scales.projection,width:ii,height:ri,tileCache:zi.current,maxDevicePixelRatio:de,onTileLoad:()=>ui()}),i.restore())}}if(g){let n=ze(e,ei,ti,h);if(!n)return;n.clearRect(-ti.left,-ti.top,ei[0],ei[1]),H||je(n,{background:he,themeBackground:Bi,hasBackgroundGraphics:!!gt,x:-ti.left,y:-ti.top,width:ei[0],height:ei[1]}),n.save(),n.beginPath(),n.rect(0,0,ii,ri),n.clip();let a=t.scene,o=t.scales,s={width:ii,height:ri};if(se({context:n,nodes:a,renderMode:fe,pixelRatio:h,paintBuiltIn:e=>{P(n,e),q(n,e,o,s),ee(n,e,o,s),re(n,e,o,s)}}),d&&Ui.current){let e=Ui.current,t=a.filter(e=>"line"===e.type);if(t.length>0){let a=O||{},o=.3*(a.speedMultiplier??1),s=a.maxPerLine??_(),l=a.spawnRate??(B()?.06:.15),c=a.radius??2,u=a.opacity??.7,h=i/1e3,d=Ji.current>0?Math.min(h-Ji.current,.1):.016;Ji.current=h;let p=t.map(e=>e.path),f=t.map(e=>e.style.strokeWidth??2);for(let i=0;t.length>i;i++)si.random()<l&&e.countForLine(i)<s&&e.spawn(i,si.random);e.step(d,o,p,f),n.globalAlpha=u;for(let i=0;e.particles.length>i;i++){let r=e.particles[i];if(!r.active)continue;let o=t[r.lineIndex],s="function"==typeof a.color?a.color(o?.datum??{}):"source"!==a.color&&a.color?a.color:o?.style.stroke||"#fff";n.beginPath(),n.arc(r.x,r.y,c,0,2*Math.PI),n.fillStyle=s,n.fill()}n.globalAlpha=1,r=!0}}n.restore()}(u||o&&!s)&&e.setAttribute("aria-label",bt(t.scene,"Geographic chart"));let y=er.current,v=!(!y||"geoarea"!==y.type&&"point"!==y.type),b=ie(v,tr.current),w=yr.current;if(w&&b){let e=ze(w,ei,ti,h);if(e){if(e.clearRect(-ti.left,-ti.top,ei[0],ei[1]),y&&"geoarea"===y.type){let 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){let t=y,i=("object"==typeof Se?Se:void 0)?.pointColor||G(y);e.beginPath(),e.arc(t.x,t.y,t.r+3,0,2*Math.PI),i?(e.save(),e.globalAlpha=.4,e.fillStyle=i,e.fill(),e.restore()):(e.fillStyle="rgba(255, 255, 255, 0.4)",e.fill()),e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineWidth=2,e.stroke()}}tr.current=v}let R=Fe!==Hi.current;R&&(Hi.current=Fe),(u||R||o&&Fe&&Fe.length>0)&&(u||R||o&&!s||i-lr.current>=33)&&(sr(e=>e+1),lr.current=i),(l||null!=t.activeTransition||m.pending||r)&&ui()},xe(Ke,Ri,Ut,ui,si.now,cr,ur),Nt(()=>{if("production"!==process.env.NODE_ENV&&H){let e=I(i);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.`)}},[H,i]),Nt(()=>{let e=Zi.current;if(!L||!e)return Gi.current&&e&&(Ai(e).on(".zoom",null),Gi.current=null),void(e&&Ai(e).on("mousedown.rotate",null).on("touchstart.rotate",null));let[t,i]=C||[1,8],r={width:ii,height:ri};if(vi){let n=qi.current.k,a=e=>{n=Math.max(t,Math.min(i,e)),qi.current=Ci.scale(n);let a=Ri.current;a&&(a.applyZoomScale(n,r),Ut.current=!1,ui(),a.scales?.projection&&D?.({projection:a.scales.projection,zoom:a.currentZoom}))};Gi.current={scaleBy:(e,t)=>a(n*t),transform:(e,t)=>a(t?.k??1)};let o=e=>{e.preventDefault(),a(n*(0>e.deltaY?1.1:1/1.1))},s=e=>{let t=e.target;t&&(t.closest("button")||t.closest(".stream-geo-zoom-controls"))||(e.preventDefault(),a(1.5*n))};e.addEventListener("wheel",o,{passive:!1}),e.addEventListener("dblclick",s);let l=.4,c=t=>{if(0!==t.button)return;let i=t.target;if(i.closest("button")||i.closest(".stream-geo-zoom-controls"))return;let r=Ri.current;if(!r)return;let n=r.getRotation();$i.current={x:t.clientX,y:t.clientY,rotation:[...n]},e.setPointerCapture(t.pointerId),t.preventDefault()},u=e=>{let t=$i.current;t&&(Qi.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]],ui())},h=t=>{if(!$i.current)return;$i.current=null,e.releasePointerCapture(t.pointerId);let i=Qi.current;if(i){Qi.current=null;let e=Ri.current;e&&(e.applyRotation(i,r),ui())}let n=Ri.current;n?.scales?.projection&&D?.({projection:n.scales.projection,zoom:n.currentZoom})};return e.addEventListener("pointerdown",c),e.addEventListener("pointermove",u),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",h),()=>{e.removeEventListener("wheel",o),e.removeEventListener("dblclick",s),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",h),Gi.current=null}}let n=Li().scaleExtent([t,i]).extent([[0,0],[ei[0],ei[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",e=>{let t=e.transform;qi.current=t,Xi.current=!0;let i=Ri.current;i&&(i.applyZoomTransform(t,r),Ut.current=!1,ui())}).on("end",e=>{qi.current=e.transform,Xi.current=!1;let t=Ri.current;t?.scales?.projection&&D?.({projection:t.scales.projection,zoom:t.currentZoom})});return Gi.current=n,Ai(e).call(n),()=>{Ai(e).on(".zoom",null)}},[L,C,vi,ei,ii,ri,ti,D,ui]);let Sr=Pe&&!1!==Se,Lr=Sr&&ar?Le?Le(ar):/* @__PURE__ */Wi(T,{data:ar}):null,Cr=Lr?/* @__PURE__ */Wi(Ie,{x:ar.x,y:ar.y,containerWidth:ii,containerHeight:ri,margin:ti,className:"stream-frame-tooltip",zIndex:10,children:Lr}):null;if(Si){let e=Pi.scene;/* @__PURE__ */
|
|
14
14
|
return Oi("div",{ref:Yi,className:"stream-geo-frame"+(ce?" "+ce:""),role:"img","aria-label":qt||("string"==typeof Lt?Lt:"Geographic chart"),style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:U?"100%":ei[0],height:ne?"100%":ei[1]},children:[
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */Oi("svg",{xmlns:"http://www.w3.org/2000/svg",width:ei[0],height:ei[1],style:{position:"absolute",left:0,top:0},children:[_i?/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
return Oi("div",{ref:Yi,className:"stream-geo-frame"+(ce?" "+ce:""),role:"group","aria-label":qt||("string"==typeof Lt?Lt:"Geographic chart"),tabIndex:0,style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:U?"100%":ei[0],height:ne?"100%":ei[1],overflow:Ce?"visible":"hidden",...L?{touchAction:"none"}:{}},onKeyDown:
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */Oi("div",{role:"img","aria-label":qt||("string"==typeof Lt?Lt:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
return
|
|
15
|
+
/* @__PURE__ */Wi(Pt,{summary:Xt}),
|
|
16
|
+
/* @__PURE__ */Oi("svg",{xmlns:"http://www.w3.org/2000/svg",width:ei[0],height:ei[1],style:{position:"absolute",left:0,top:0},children:[_i?/* @__PURE__ */Wi("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:ei[0],height:ei[1],fill:_i}):null,
|
|
17
|
+
/* @__PURE__ */Wi("g",{transform:`translate(${ti.left},${ti.top})`,children:ji}),
|
|
18
|
+
/* @__PURE__ */Wi("g",{transform:`translate(${ti.left},${ti.top})`,children:e.map((e,t)=>le({node:e,index:t,renderMode:fe,fallback:()=>w(e,t)}))})]}),
|
|
19
|
+
/* @__PURE__ */Wi(b,{width:ii,height:ri,totalWidth:ei[0],totalHeight:ei[1],margin:ti,showAxes:!1,title:Lt,description:qt,legend:Ct,legendPosition:At,legendLayout:Dt,legendHoverBehavior:jt,legendClickBehavior:Mt,legendHighlightedCategory:Bt,legendIsolatedCategories:_t,foregroundGraphics:ye(Di,Te(Ri.current?.customLayoutOverlays,h??null)),annotations:Fe,onAnnotationActivate:qe,onObservation:_e??Be,chartId:Ee,chartType:"StreamGeoFrame",autoPlaceAnnotations:Ze,svgAnnotationRules:Ye,pointNodes:M(e),geoProjection:Ri.current?.scales?.projectedPoint})]})}/* @__PURE__ */
|
|
20
|
+
return Oi("div",{ref:Yi,className:"stream-geo-frame"+(ce?" "+ce:""),role:"group","aria-label":qt||("string"==typeof Lt?Lt:"Geographic chart"),tabIndex:0,style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:U?"100%":ei[0],height:ne?"100%":ei[1],overflow:Ce?"visible":"hidden",...L?{touchAction:"none"}:{}},onKeyDown:Pr,children:["production"!==process.env.NODE_ENV&&Ri.current&&/* @__PURE__ */Wi(wt,{store:Ri.current,diagnostics:rr.current}),Gt&&/* @__PURE__ */Oi(vt,{accessibleTable:Gt,children:[
|
|
21
|
+
/* @__PURE__ */Wi(xt,{tableId:oi}),
|
|
22
|
+
/* @__PURE__ */Wi(Rt,{scene:Ri.current?.scene??[],chartType:"Geographic chart",tableId:oi,chartTitle:"string"==typeof Lt?Lt:void 0})]}),
|
|
23
|
+
/* @__PURE__ */Wi(Pt,{summary:Xt}),
|
|
24
|
+
/* @__PURE__ */Wi(mt,{hoverPoint:ar}),
|
|
25
|
+
/* @__PURE__ */Oi("div",{role:"img","aria-label":qt||("string"==typeof Lt?Lt:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:xr,onPointerLeave:fr,onPointerDown:Sr||$t?kr:void 0,onClick:$t?br:void 0,children:[
|
|
26
|
+
/* @__PURE__ */Wi(Ge,{size:ei,margin:ti,backdropFill:_i??void 0,children:ji}),H&&/* @__PURE__ */Wi("canvas",{ref:Ei,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),
|
|
27
|
+
/* @__PURE__ */Wi("canvas",{ref:gr,"aria-label":bt(Ri.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),
|
|
28
|
+
/* @__PURE__ */Wi("canvas",{ref:yr,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),
|
|
29
|
+
/* @__PURE__ */Wi(b,{width:ii,height:ri,totalWidth:ei[0],totalHeight:ei[1],margin:ti,showAxes:Ht,title:Lt,description:qt,legend:Ct,legendPosition:At,legendLayout:Dt,legendHoverBehavior:jt,legendClickBehavior:Mt,legendHighlightedCategory:Bt,legendIsolatedCategories:_t,foregroundGraphics:ye(Di,Te(Ri.current?.customLayoutOverlays,h??null)),annotations:Fe,onAnnotationActivate:qe,onObservation:_e??Be,chartId:Ee,chartType:"StreamGeoFrame",autoPlaceAnnotations:Ze,svgAnnotationRules:Ye,pointNodes:M(Ri.current?.scene),geoProjection:Ri.current?.scales?.projectedPoint}),Ke?.showBadge&&/* @__PURE__ */Wi(ke,{isStale:cr,position:Ke.badgePosition,state:Ke.state,settling:Ke.settling}),L&&/* @__PURE__ */Oi("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:ti.bottom+8,left:ti.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[
|
|
30
|
+
/* @__PURE__ */Wi("button",{type:"button","aria-label":"Zoom in",onClick:e=>{e.stopPropagation();let t=Zi.current,i=Gi.current;t&&i?.scaleBy&&i.scaleBy(Ai(t),1.5)},style:Ni,children:"+"}),
|
|
31
|
+
/* @__PURE__ */Wi("button",{type:"button","aria-label":"Zoom out",onClick:e=>{e.stopPropagation();let t=Zi.current,i=Gi.current;t&&i?.scaleBy&&i.scaleBy(Ai(t),1/1.5)},style:Ni,children:"−"})]}),X&&/* @__PURE__ */Wi("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:ti.bottom+2,right:ti.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:X}),
|
|
32
|
+
/* @__PURE__ */Wi(kt,{active:wr.current>=0,hoverPoint:ar,margin:ti,size:ei,shape:Rr.current?.shape,width:Rr.current?.w,height:Rr.current?.h,pathData:Rr.current?.pathData}),Cr]})]})}));Hi.displayName="StreamGeoFrame";var Gi=Hi;import{forwardRef as qi,useMemo as Xi}from"react";import{jsx as Zi}from"react/jsx-runtime";var Yi=qi(function(e,t){let{points:i,areas:r,lines:n,layout:a,layoutConfig:o,onLayoutError:s,projection:l="equirectangular",xAccessor:c="lon",yAccessor:u="lat",lineDataAccessor:h,colorBy:d,colorScheme:p,tooltip:f,annotations:m,margin:g,selection:y,linkedHover:v,onObservation:b,onClick:w,chartId:R,loading:P,loadingContent:x,emptyContent:k,className:S,frameProps:L={}}=e,{frameRef:C,resolved:A,normalizedMargin:D}=O({imperativeRef:t,imperativeVariant:"geo-points",margin:g,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),j=Xi(()=>tt(i),[i]),M=Xi(()=>tt(r),[r]),T=Xi(()=>tt(n),[n]),B=Xi(()=>[...j,...T,...M],[j,T,M]),_=H({data:B,rawData:void 0!==i||void 0!==n||void 0!==r?B:void 0,colorBy:d,colorScheme:p,legendInteraction:void 0,selection:y,linkedHover:v,fallbackFields:"string"==typeof d?[d]:[],unwrapData:!1,onObservation:b,onClick:w,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"GeoCustomChart",chartId:R,showLegend:!1,userMargin:D,marginDefaults:A.marginDefaults,loading:P,loadingContent:x,emptyContent:k,width:A.width,height:A.height,hasTitle:!!A.title}),I=_.effectiveSelectionHook,E=Xi(()=>I?.isActive?{isActive:!0,predicate:I.predicate}:null,[I?.isActive,I?.predicate]);if(_.earlyReturn)return _.earlyReturn;let{width:N,height:F,enableHover:z,title:W,description:G,summary:q,accessibleTable:X}=A,Z=Ue(f),Y={projection:l,...null!=i&&{points:j},...null!=r&&{areas:M},...null!=n&&{lines:T},xAccessor:c,yAccessor:u,...null!=h&&{lineDataAccessor:h},customLayout:a,layoutConfig:o,onLayoutError:s,layoutSelection:E,colorBy:d,colorScheme:p,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:_.margin,enableHover:z,...he({title:W,description:G,summary:q,accessibleTable:X,className:S,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:e.autoPlaceAnnotations}),...!1===f?{tooltipContent:()=>null}:Z?{tooltipContent:Z}:{},...de({linkedHover:v,selection:y,onObservation:b,onClick:w,hoverHighlight:!1,mobileInteraction:_.mobileInteraction,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior,linkedHoverInClickPredicate:!1}),...m&&m.length>0&&{annotations:m},...L};/* @__PURE__ */
|
|
33
|
+
return Zi(et,{componentName:"GeoCustomChart",width:N,height:F,children:/* @__PURE__ */Zi(Gi,{ref:C,...Y})})});Yi.displayName="GeoCustomChart";export{Gi as a,Yi as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t,r,i){let s=i.current,n=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!n&&e.hasActivePulsesAt(t),u=!(r||n||!a&&!s)&&e.refreshPulse(t);return i.current=a,{changed:u,pending:a}}function t({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:i,chartType:s}){let n=!(!e&&!r),a=!(!t&&!r),u=
|
|
1
|
+
function e(e,t,r,i){let s=i.current,n=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,a=!n&&e.hasActivePulsesAt(t),u=!(r||n||!a&&!s)&&e.refreshPulse(t);return i.current=a,{changed:u,pending:a}}function t({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:i,chartType:s}){let n=!(!e&&!r),a=!(!t&&!r),u=C((t,n)=>{e?.(t,n),w({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:s,chartId:i,context:n})},[i,s,e,r]),o=C((e,n)=>{t?.(e,n),x({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:s,chartId:i,context:n})},[i,s,t,r]);return{customHoverBehavior:n?u:void 0,customClickBehavior:a?o:void 0,hasClickBehavior:a}}function r({storeRef:e,hoverRef:t,hoveredNodeRef:r,setHoverPoint:i,customHoverBehavior:s,customClickBehavior:n,scheduleRender:a,extractPoints:u,toHover:o}){let c=B(-1),l=B(null),h=B(null),f=P(f=>{if(R(f))return;let p=e.current;if(!p)return;let y,d=()=>{c.current=-1,l.current=null,t.current=null,r&&(r.current=null),i(null),s?.(null),a()};if(0===p.scene.length)return void(c.current>=0&&d());if(h.current?.version===p.version)y=h.current.graph;else{let e=u(p.scene);if(0===e.length)return void(c.current>=0&&d());y=v(e),h.current={version:p.version,graph:y}}let g=c.current;if(g>=y.flat.length&&(d(),g=-1),("Enter"===f.key||" "===f.key)&&g>=0)return f.preventDefault(),void n?.(o(y.flat[g],p),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===f.key||!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(f.key))return;f.preventDefault(),c.current=0;let e=y.flat[0];l.current=e;let r=o(e,p);return t.current=r,i(r),s?.(r,{type:"focus",inputType:"keyboard"}),void a()}let b=m(f.key,_(y,g),y);if(null===b)return;if(f.preventDefault(),0>b)return void d();c.current=b;let z=y.flat[b];l.current=z;let k=o(z,p);t.current=k,i(k),s?.(k,{type:"focus",inputType:"keyboard"}),a()},[n,s,u,t,r,a,i,e,o]);return{kbFocusIndexRef:c,focusedNavPointRef:l,onKeyDown:f}}function i(e){return r({...e,extractPoints:g,toHover:(e,t)=>A({...e,datum:d(e.datum,t.resolvedRibbons)})})}function s({chartType:e,oAccessor:t,rAccessor:i,...s}){return r({...s,extractPoints:b,toHover:r=>({...A(r),__oAccessor:"string"==typeof t?t:void 0,__rAccessor:"string"==typeof i?i:void 0,__chartType:e})})}function n(e){let t=e.datum;return{...t||{},...t?.properties||{},data:t,properties:t?.properties,x:e.x,y:e.y,__semioticHoverData:!0}}function a({storeRef:e,hoverRef:t,hoveredNodeRef:r,setHoverPoint:i,customHoverBehavior:s,customClickBehavior:a,scheduleRender:u}){let o=B(-1),c=B(null),l=P(l=>{if(R(l))return;let h=e.current;if(!h)return;let f=()=>{o.current=-1,c.current=null,t.current=null,r&&(r.current=null),i(null),s?.(null),u()};if(0===h.scene.length)return void(o.current>=0&&f());let p=z(h.scene);if(0===p.length)return void(o.current>=0&&f());let y=o.current;if(y>=p.length&&(f(),y=-1),("Enter"===l.key||" "===l.key)&&y>=0)return l.preventDefault(),void a?.(n(p[y]),{type:"activate",inputType:"keyboard"});let d=k(l.key,0>y?-1:y,p.length);if(null===d)return;if(l.preventDefault(),0>d)return void f();let v=0>y?0:d;o.current=v;let _=p[v];c.current=_;let m=n(_);t.current=m,i(m),s?.(m,{type:"focus",inputType:"keyboard"}),u()},[a,s,t,r,u,i,e]);return{kbFocusIndexRef:o,focusedNavPointRef:c,onKeyDown:l}}function u(e,t,r){let i=e.duration??500,s=r-t;return i>s?1-s/i:0}function o(e,t,r,i,s,n=("u">typeof performance?performance.now():Date.now())){let a=e.color??"rgba(255,255,255,0.6)",o=e.glowRadius??4,l=!1,h=s??(()=>{let e=/* @__PURE__ */new Map;for(let t=0;r.length>t;t++)e.set(r[t],t);return e})();for(let r of t){if("line"===r.type)continue;if("area"===r.type){let t=Array.isArray(r.datum)?r.datum:[r.datum],s=0,o=!1;for(let r of t){let t=h.get(r);if(null==t)continue;o=!0;let a=i.get(t);if(null==a)continue;let c=u(e,a,n);c>s&&(s=c)}o&&(l=c(r,s,a)||l);continue}let t=h.get(r.datum);if(null==t)continue;let s=i.get(t);l=c(r,null==s?0:u(e,s,n),a,o)||l}return l}function c(e,t,r,i){let s=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,s=!0),e._pulseColor!==r&&(e._pulseColor=r,s=!0),e._pulseGlowRadius!==i&&(e._pulseGlowRadius=i,s=!0),s):(0!==e._pulseIntensity&&(e._pulseIntensity=0,s=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,s=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,s=!0),s)}function l(e,t,r=("u">typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;let i=e.duration??500,s=t.peek();return null!=s&&i>r-s}function h(e,t,r){e.capacity>=t||(e.resize(t),r&&t>r.capacity&&r.resize(t))}function f(e,t){let r=new H(e.capacity);return e.forEach(()=>r.push(t)),r}function p(e,t,r,i){let s=e.push(t);return r&&r.push(i),s}function y(e,t,r){if(!t||0===t.size)return;let i=/* @__PURE__ */new Set;if(e.forEach((e,t)=>{r(e)&&i.add(t)}),0===i.size)return;let s=t.toArray();t.clear();for(let e=0;s.length>e;e++)i.has(e)||t.push(s[e])}import{e as d}from"./c-NATWERHZ.min.js";import{M as v,N as _,O as m,P as g,Q as b,T as z,U as k,V as A}from"./c-SAP5KY6R.min.js";import{Xa as R,Ya as w,Za as x}from"./c-UMGHCBH5.min.js";var H=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){let t=[];for(let r of e){let e=this.push(r);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){let t=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)e(this.buffer[(t+r)%this._capacity],r)}toArray(){let e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++)e[r]=this.buffer[(t+r)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");let t=this.toArray(),r=0,i=[];t.length>e&&(r=t.length-e,i=t.slice(0,r)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=r;t.length>e;e++)this.push(t[e]);return i}update(e,t){let r=[],i=(this.head-this._size+this._capacity)%this._capacity;for(let s=0;this._size>s;s++){let n=(i+s)%this._capacity,a=this.buffer[n];if(e(a)){let e;e="object"!=typeof a||null===a?a:Array.isArray(a)?[...a]:{...a},r.push(e),this.buffer[n]=t(a)}}return r}remove(e){let t=[],r=[];if(this.forEach(i=>{e(i)?r.push(i):t.push(i)}),0===r.length)return r;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(let e of t)this.push(e);return r}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}};import{useCallback as C}from"react";import{useCallback as P,useRef as B}from"react";export{H as a,u as b,o as c,c as d,l as e,h as f,f as g,p as h,y as i,e as j,t as k,i as l,s as m,a as n};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function a(a,n){return new t(a,n)}async function n(n){try{return await(import(
|
|
2
|
+
/* webpackIgnore: true */
|
|
3
|
+
/* @vite-ignore */
|
|
4
|
+
n.packageName))}catch(t){throw a(n,t)}}var t=class extends Error{constructor(a,n){super(`${a.engine} is an optional Semiotic physics engine. Install ${a.packageName} to use ${a.importPath}: ${a.installCommand}`),this.name="PhysicsOptionalEngineDependencyError",this.details=a,n&&(this.cause=n)}};export{t as a,a as b,n as c};
|