semiotic 3.13.0 → 3.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -41
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/dist/mcp-server.js +132 -106
- package/ai/reference.md +12 -4
- package/ai/schema.json +16 -2
- package/ai/surface-manifest.json +1 -1
- package/ai/task-packets/compare-category-totals.json +5 -5
- package/ai/task-packets/compare-category-totals.md +2 -2
- package/ai/task-packets/correct-published-chart.json +5 -5
- package/ai/task-packets/correct-published-chart.md +2 -2
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +5 -5
- package/ai/task-packets/update-live-chart.md +2 -2
- package/dist/{c-CRKR5M42.min.js → c-2M2OPWVA.min.js} +37 -37
- package/dist/c-3GIPT46Z.min.js +1 -0
- package/dist/c-3UXQGCQT.min.js +1 -0
- package/dist/{c-MHNU6KYQ.min.js → c-4P2EM44G.min.js} +3 -3
- package/dist/c-4RVDKSMQ.min.js +1 -0
- package/dist/{c-6MEEA5VY.min.js → c-4YPPVFZH.min.js} +1 -1
- package/dist/{c-6MPP6QF5.min.js → c-62JIVHK5.min.js} +1 -1
- package/dist/{c-KYRH3XKJ.min.js → c-6QCSRJSC.min.js} +1 -1
- package/dist/c-6WJKNYIG.min.js +1 -0
- package/dist/c-7BVQDXFU.min.js +1 -0
- package/dist/c-7UN2WUMI.min.js +1 -0
- package/dist/c-AQUX6L2O.min.js +1 -0
- package/dist/c-BR5QDUCR.min.js +1 -0
- package/dist/c-C3YQVUB6.min.js +1 -0
- package/dist/{c-RQ2XZHWY.min.js → c-COP4OISO.min.js} +1 -1
- package/dist/c-ENRZPF5E.min.js +1 -0
- package/dist/c-HBLICBM6.min.js +1 -0
- package/dist/{c-EQVM754Z.min.js → c-HGWITEJI.min.js} +1 -1
- package/dist/{c-3K2FJDLE.min.js → c-I54V24WG.min.js} +1 -1
- package/dist/c-IDCFMBA4.min.js +2 -0
- package/dist/{c-TPL7X32J.min.js → c-ISHYKYII.min.js} +1 -1
- package/dist/c-KSSS3HSA.min.js +1 -0
- package/dist/c-LEICSI5V.min.js +1 -0
- package/dist/c-LJ4XY3Z3.min.js +1 -0
- package/dist/c-MBE6PPHN.min.js +1 -0
- package/dist/c-MOK4RWNO.min.js +1 -0
- package/dist/c-N2TVSOYL.min.js +2 -0
- package/dist/{c-EAAKQIUZ.min.js → c-NHZ2E3CI.min.js} +1 -1
- package/dist/{c-MDY3ULP6.min.js → c-OBA7XSLH.min.js} +1 -1
- package/dist/c-OIJL2WZH.min.js +1 -0
- package/dist/c-ONOWKUUZ.min.js +1 -0
- package/dist/{c-CPJR4LHF.min.js → c-OSLNYZ3Q.min.js} +17 -17
- package/dist/c-PBFRYNKM.min.js +1 -0
- package/dist/c-QUAEYF34.min.js +1 -0
- package/dist/c-RDFFLRKC.min.js +1 -0
- package/dist/c-SDGGMIYI.min.js +1 -0
- package/dist/c-SQQZPFVY.min.js +1 -0
- package/dist/c-SU6Z75M2.min.js +1 -0
- package/dist/{c-BWM7MU2Y.min.js → c-SX4TPG3Z.min.js} +1 -1
- package/dist/{c-DTYG34WG.min.js → c-VGHU2LTF.min.js} +2 -2
- package/dist/c-VLWWXOM5.min.js +1 -0
- package/dist/c-VZNIIKL6.min.js +1 -0
- package/dist/{c-GBO32OML.min.js → c-W5ATXREF.min.js} +1 -1
- package/dist/c-WSWMQDFZ.min.js +1 -0
- package/dist/{c-3SDC7AQQ.min.js → c-XM76UG3P.min.js} +1 -1
- package/dist/c-XORVM6C5.min.js +1 -0
- package/dist/{c-MYRI7NF2.min.js → c-XZJWL7UL.min.js} +1 -1
- package/dist/c-Y43GTKGR.min.js +1 -0
- package/dist/c-YGTMWEEF.min.js +1 -0
- package/dist/c-ZFIURPZA.min.js +1 -0
- package/dist/c-ZWJDTDEV.min.js +1 -0
- package/dist/c-ZYMXDR42.min.js +1 -0
- package/dist/components/ai/chartClinic.d.ts +4 -0
- package/dist/components/ai/evaluateChart.d.ts +3 -1
- package/dist/components/ai/generativeChart.d.ts +13 -0
- package/dist/components/ai/renderEvidenceMemoKey.d.ts +9 -0
- package/dist/components/ai/reportRenderError.d.ts +2 -0
- package/dist/components/charts/physics/eventDropSources.d.ts +1 -1
- package/dist/components/evidence/claimReferences.d.ts +9 -0
- package/dist/components/realtime/BinAccumulator.d.ts +5 -0
- package/dist/components/recipes/atlas/dependencyEvidence.d.ts +5 -0
- package/dist/components/recipes/atlas/support.d.ts +5 -0
- package/dist/components/server/staticXYAxisTicks.d.ts +1 -1
- package/dist/components/stream/MarginalGraphics.d.ts +4 -2
- package/dist/components/stream/PipelineStore.d.ts +6 -18
- package/dist/components/stream/axisTickUtils.d.ts +1 -1
- package/dist/components/stream/countNoun.d.ts +2 -0
- package/dist/components/stream/heatmapBandTicks.d.ts +68 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +52 -3
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +8 -0
- package/dist/components/stream/uniqueRegionLabel.d.ts +6 -0
- package/dist/components/stream/xyAxisTicks.d.ts +8 -1
- package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -0
- package/dist/geo.min.js +152 -152
- package/dist/geo.module.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -1
- package/dist/semiotic-access.module.min.js +2 -2
- package/dist/semiotic-ai-core.min.js +5 -5
- package/dist/semiotic-ai-core.module.min.js +4 -4
- package/dist/semiotic-ai.module.min.js +2 -2
- package/dist/semiotic-artifact.min.js +6 -6
- package/dist/semiotic-artifact.module.min.js +2 -2
- package/dist/semiotic-atlas-core.min.js +1 -1
- package/dist/semiotic-atlas-core.module.min.js +1 -1
- package/dist/semiotic-atlas-selection.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1023 -1023
- package/dist/semiotic-evidence.min.js +4 -4
- package/dist/semiotic-evidence.module.min.js +3 -3
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +101 -101
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +3 -3
- package/dist/semiotic-server-edge.min.js +397 -397
- package/dist/semiotic-server-edge.module.min.js +3 -3
- package/dist/semiotic-server-node.min.js +397 -397
- package/dist/semiotic-utils-core.min.js +11 -11
- package/dist/semiotic-utils-core.module.min.js +3 -3
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +397 -397
- package/dist/server.module.min.js +3 -3
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/c-3OBJLOXI.min.js +0 -1
- package/dist/c-4VFGNUWG.min.js +0 -1
- package/dist/c-5BN7GWJH.min.js +0 -1
- package/dist/c-65GMYND6.min.js +0 -1
- package/dist/c-AGRMJIUH.min.js +0 -1
- package/dist/c-BJKGYOPX.min.js +0 -1
- package/dist/c-C332PFY6.min.js +0 -1
- package/dist/c-DDZ5TZ7P.min.js +0 -1
- package/dist/c-F4DZ3NMI.min.js +0 -1
- package/dist/c-GZJ2XEQ5.min.js +0 -1
- package/dist/c-HFQ3Z65X.min.js +0 -1
- package/dist/c-HNW73MXJ.min.js +0 -1
- package/dist/c-HWFZB7SD.min.js +0 -1
- package/dist/c-IIV4DB7T.min.js +0 -1
- package/dist/c-J2QH3PEI.min.js +0 -1
- package/dist/c-JZNWRFVJ.min.js +0 -2
- package/dist/c-KHLBCSIO.min.js +0 -1
- package/dist/c-L7FQHKGH.min.js +0 -1
- package/dist/c-LYPOBMKC.min.js +0 -1
- package/dist/c-NGMMPKNJ.min.js +0 -1
- package/dist/c-NOME4L5M.min.js +0 -1
- package/dist/c-OKIJBK5K.min.js +0 -2
- package/dist/c-OXV4W7YX.min.js +0 -1
- package/dist/c-P73SQZEP.min.js +0 -1
- package/dist/c-PD5EZI24.min.js +0 -1
- package/dist/c-RAL7HCTV.min.js +0 -1
- package/dist/c-S4OGXAVO.min.js +0 -1
- package/dist/c-UWE3VZEO.min.js +0 -1
- package/dist/c-VP7WX6QI.min.js +0 -1
- package/dist/c-VW7ZSLDC.min.js +0 -1
- package/dist/c-WDVYLMCM.min.js +0 -1
- package/dist/c-XEACLH4B.min.js +0 -1
- package/dist/c-YJDGSPNB.min.js +0 -1
- package/dist/c-ZYBEKQCT.min.js +0 -1
package/dist/c-VW7ZSLDC.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t,n={}){if(!Number.isFinite(t)||t<=0||Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(e<0)return"fresh";let i=n.fresh??eo.fresh,r=n.aging??eo.aging,o=n.stale??eo.stale;return e<t*i?"fresh":e<t*r?"aging":e<t*o?"stale":"expired"}function t(e,t,n){if(null!=e)return"function"==typeof e?e(t,n):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function n(e){let{data:n,encoding:i}=e,r=[],o=new Map;return n.forEach((e,n)=>{let l=t(i.id,e,n);if(null==l||""===l)throw new Error(`[semiotic] Motion encoding row ${n} resolved an empty id.`);let a=String(l);if(o.has(a))throw new Error(`[semiotic] Duplicate motion encoding id "${a}".`);let s=t(i.process?.group,e,n),c=t(i.process?.stage,e,n),u=t(i.accessible?.group,e,n)??(null!=s?String(s):null!=c?String(c):void 0),d={};for(let r of Object.keys(i.evidence??{}))d[r]=t(i.evidence?.[r],e,n);let h={id:a,datum:e,time:{arrival:t(i.time?.arrival,e,n),basis:i.time?.basis,unit:i.time?.unit},placement:{x:t(i.placement?.x,e,n),y:t(i.placement?.y,e,n),lane:t(i.placement?.lane,e,n),space:i.placement?.space},kinematics:{velocityX:t(i.kinematics?.velocityX,e,n),velocityY:t(i.kinematics?.velocityY,e,n),space:i.kinematics?.space},process:{group:s,stage:c,target:t(i.process?.target,e,n),work:t(i.process?.work,e,n)},evidence:d,accessible:{description:t(i.accessible?.description,e,n),group:u,label:t(i.accessible?.label,e,n)??a}};r.push(h),o.set(a,h)}),{rows:r,byId:o}}function i(t){let n=t.now-t.arrival;return{age:n,progress:Number.isFinite(n)&&Number.isFinite(t.ttl)&&t.ttl>0?Math.max(0,n)/t.ttl:n===1/0&&Number.isFinite(t.ttl)&&t.ttl>0?1/0:0,lifecycle:e(n,t.ttl,t.thresholds)}}function r(e){let t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||e.extent<=0)return 1;let n=Math.max(0,e.age);if("step"===e.type)return n<(e.threshold??.5*e.extent)?1:t;if("exponential"===e.type){let i=e.halfLife??e.extent/2,r=i>0?i:e.extent/2;return t+Math.pow(.5,n/r)*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}function o(e,t){let n=Number.isFinite(e)?e:0,i=Number.isFinite(t)?t:0;return{velocityX:n,velocityY:i,speed:Math.hypot(n,i),direction:Math.atan2(i,n)}}function l(e,t,n){return!Number.isFinite(n)||n<=0?o(0,0):o((t.x-e.x)/n,(t.y-e.y)/n)}function a(e){return"string"==typeof e&&e.includes("var(")}function s(e){let t=to.exec(e);if(!t)return a(e)?void 0:e;let n=t[1]?.trim();return n?s(n):void 0}function c(e,t){return String(e).length*t*.6}function u(e){let{x:t,y:n,text:i,fill:r,fontSize:o=12,fontWeight:l,fontFamily:u,textAnchor:d="start",dominantBaseline:h,background:f,className:m}=e,y=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{...e,type:e.type??"halo"}}(f),p=e=>Mr("text",{x:t,y:n,textAnchor:d,dominantBaseline:h,fill:r,fontSize:o,fontWeight:l,fontFamily:u,className:m,...e?{style:{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}}:{},children:i});if(!y)return p();if("halo"===y.type)return p({stroke:y.fill??no,strokeWidth:y.haloWidth??3});let g,b,x=y.padding??{x:6,y:3},v="number"==typeof x?x:x.x,w="number"==typeof x?x:x.y,k=c(i,o),M=k+2*v,A=o+2*w;g="middle"===d?t-k/2-v:"end"===d?t-k-v:t-v,b="middle"===h||"central"===h?n-A/2:"hanging"===h||"text-before-edge"===h?n-w:n-.8*o-w;let S=y.fill??no,$={};return a(S)&&($.fill=S),a(y.stroke)&&($.stroke=y.stroke),Ar("g",{className:m,children:[Mr("rect",{x:g,y:b,width:M,height:A,rx:y.radius??3,ry:y.radius??3,fill:a(S)?s(S):S,fillOpacity:y.opacity??.85,stroke:a(y.stroke)?s(y.stroke):y.stroke,strokeWidth:y.strokeWidth,...$.fill||$.stroke?{style:$}:{}}),p()]})}function d(e){let t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:String(n)}function h(e){let t=er(e=>e.pushObservation),n=$r.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return $r.useMemo(()=>({...e,onObservation:n}),[n,e])}function f(e,t={}){let n=d(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(i){let r=function(e){let t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(i);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function m(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}function y(e,t){return e===t||!(!e||!t||e.xValue!==t.xValue||e.sourceId!==t.sourceId||!!e.locked!=!!t.locked)}function p(e){return e&&Number.isFinite(e.xValue)?{...e,sourceId:e.sourceId??"external"}:null}function g(){let e=new Map,t=new Set;return{getSnapshot:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),set:(n,i)=>{if(!y(e.get(n)??null,i)){e=new Map(e),i?e.set(n,i):e.delete(n);for(let e of t)e()}}}}function b(){return Jr??(Jr=g())}function x({children:e,control:t}){let[n]=Lr(g),i=zr(()=>({store:n,control:t}),[n,t]);return Nr(()=>{let e=v(n,t),i=i=>{if("Escape"===i.key){t&&e.unlockCrosshair(t.name);for(let i of n.getSnapshot().keys())i!==t?.name&&e.unlockCrosshair(i)}};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[n,t]),Mr(io.Provider,{value:i,children:e})}function v(e,t){let n=e=>t?.name===e&&void 0!==t.position,i=i=>n(i)?p(t.position):e.getSnapshot().get(i)??null,r=(r,o)=>{let l=p(o);y(i(r),l)||(n(r)||e.set(r,l),t?.name===r&&t.onPositionChange?.(l))};return{setPosition:r,setCrosshairPosition(e,t,n){i(e)?.locked||r(e,{xValue:t,sourceId:n})},clearCrosshairPosition(e,t){let n=i(e);n&&!n.locked&&n.sourceId===t&&r(e,null)},toggleCrosshairLock:(e,t,n)=>i(e)?.locked?(r(e,null),!1):(r(e,{xValue:t,sourceId:n,locked:!0}),!0),unlockCrosshair(e,t){let n=i(e);n?.locked&&(!t||n.sourceId===t)&&r(e,null)},releaseCrosshair(e,t){!n(e)&&i(e)?.sourceId===t&&r(e,null)}}}function w(){let e=Ir(io),t=e?.store??b(),n=null!==e;return zr(()=>({...v(t,e?.control),handlesEscape:n}),[t,e?.control,n])}function k(e){let t=Ir(io),n=t?.store??b(),i=Or(e?n.subscribe:lo,n.getSnapshot,oo),r=t?.control,o=null!=r&&r.name===e&&void 0!==r.position,l=o?r.position??null:null,a=zr(()=>p(l),[l]);return o?a:e?i.get(e)??null:null}function M(e){let t=k(e),n=w();return{position:t,setPosition:jr(t=>n.setPosition(e,t),[n,e])}}function A(e,t){for(let n of t){let t=e.find(e=>e.lower===n);if(t)return t}}function S(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};let n=t.maxEntries??6,i=!1!==t.skipPositional,r=[];for(let[t,n]of Object.entries(e)){if(t.startsWith("_")||"data"===t)continue;let e=t.toLowerCase();if(i&&uo.has(e)||null==n)continue;let o=typeof n;"string"!==o&&"number"!==o&&"boolean"!==o&&!(n instanceof Date)||r.push({key:t,lower:e,value:n})}if(0===r.length)return{entries:[]};let o=r.findIndex(e=>ao.includes(e.lower)),l=o>=0;o<0&&(o=r.findIndex(e=>"id"===e.lower)),o<0&&(o=r.findIndex(e=>"string"==typeof e.value));let a=o>=0?r[o]:void 0,s=r.filter((e,t)=>t!==o&&(!l||"id"!==e.lower)),c=A(s,so),u=A(s,co),d=[];c&&d.push({key:c.key,value:c.value}),u&&d.push({key:u.key,value:u.value});for(let e of s){if(d.length>=n)break;so.includes(e.lower)||co.includes(e.lower)||d.push({key:e.key,value:e.value})}return{titleKey:a?.key,title:a?.value,entries:d}}function $(e){if(!Number.isFinite(e))return String(e);let t=Number.isInteger(e)?e:Number(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():String(t)}function C(e){return e.getHours()||e.getMinutes()||e.getSeconds()||e.getMilliseconds()?e.toLocaleString():e.toLocaleDateString()}function L(e,t){return"function"==typeof t?t(e):e[t]}function z(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e)return Number.isFinite(e)?$(e):String(e);if(e instanceof Date)return C(e);if("object"==typeof e&&null!==e){let t=e;if(void 0!==t.id)return String(t.id);if(void 0!==t.name)return String(t.name);try{return JSON.stringify(e)}catch{return Array.isArray(e)?`[Array(${e.length})]`:"[Object]"}}return String(e)}function N(e,t,n){let i="string"==typeof t?t:t.accessor||t.key||"";return{label:"string"==typeof t?t:t.label,value:z(L(e,i),"string"==typeof t?n:t.format||n)}}function I(e={}){let{fields:t,chrome:n,title:i,format:r,style:o={},className:l=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a,s=[];if(i){let t=L(e,i);a=z(t,r)}if(t&&t.length>0)s.push(...t.map(t=>N(e,t,r)));else if(!i){let t=["value","y","name","id","label"];for(let n of t)if(void 0!==e[n]){a=z(e[n],r);break}if(!a){let t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=z(e[t[0]],r))}}return Ar(tr,{chrome:n,className:l,style:o,children:[a&&Mr("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Ar("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Ar("span",{children:[e.label,": "]}),e.value]},t))]})}}function O(e={}){let{fields:t=[],chrome:n,title:i,format:r,style:o={},className:l="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;let c=[];if(i){let t=L(e,i);c.push({value:z(t,r)})}if(t&&Array.isArray(t)&&t.length>0)for(let n of t){let t=N(e,n,r);c.push({...t,label:a?t.label:void 0})}else{let t=S(e,{skipPositional:!1});null!=t.title&&c.push({label:void 0,value:z(t.title,r),bold:!0}),t.entries.forEach(e=>{c.push({label:a?e.key:void 0,value:z(e.value,r)})})}return Array.isArray(c)&&0!==c.length?Mr(tr,{chrome:n,className:`semiotic-tooltip-multiline ${l}`.trim(),style:o,children:c.map((e,t)=>Ar("div",{style:{marginBottom:t<c.length-1?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&Ar("strong",{children:[e.label,s]}),e.value]},t))}):null}}function j(e){return"multi"===e||R(e)}function R(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&"mode"in e&&"multi"===e.mode}function T(e){let{tooltip:t,defaultTooltipContent:n,multiDefaultContent:i=F(),customFunctionContext:r="datum"}=e,o=t;if(!1===t)return{tooltipContent:()=>null};if(j(o)){let e=R(o)&&"function"==typeof o.content?E(void 0===o.chrome?o.content:{content:o.content,chrome:o.chrome}):void 0,t=R(o)?o.chrome:void 0;return{tooltipContent:e||(void 0===t?i:e=>{let n=i(e);return nr(n)?Mr(ir,{chrome:t,children:n}):null}),tooltipMode:"multi"}}return"hover"===r&&"function"==typeof t?{tooltipContent:t}:{tooltipContent:E(o)||n}}function W(e){let{tooltip:t,defaultTooltipContent:n,customFunctionContext:i="datum"}=e;return!1===t?{tooltipContent:()=>null}:"hover"===i&&"function"==typeof t?{tooltipContent:t}:{tooltipContent:E(t)||n}}function F({xFormat:e,yFormat:t}={}){function n(e,t){if(t)try{let n=t(e);if(null!=n)return n}catch{}return z(e)}return i=>{let r=i.allSeries;if(!r||0===r.length){let e=i.data?.value??i.data?.y;return Mr(tr,{children:Mr("div",{children:n(e,t)})})}let o=i.xValue??i.data?.time??i.data?.x;return Ar(tr,{children:[null!=o&&Mr("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:n(o,e)}),r.map((e,i)=>Ar("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[Mr("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),Mr("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),Mr("span",{style:{fontWeight:500,fontSize:"0.85em"},children:n(e.value,t&&(n=>t(n,e.group)))})]},i))]})}}function E(e){if(!0!==e){if("function"==typeof e||"object"==typeof e&&null!==e&&"content"in e&&"function"==typeof e.content&&!R(e)){let t="function"==typeof e?e:e.content,n="function"==typeof e?void 0:e.chrome,i=e=>{let i=function(e){let t=!0===e?.__semioticHoverData,n=e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType),i=t||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&n,r=$i(i?e.data??{}:e);if(!r||(("node"===e?.nodeOrEdge&&"number"==typeof r?.x0&&"number"==typeof r?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof r?.sankeyWidth)&&r.data&&"object"==typeof r.data&&(r=r.data),!r))return null;if(i&&(void 0!==e.allSeries||void 0!==e.xValue)){let t=br({...r},xr(r));void 0!==e.allSeries&&void 0===t.allSeries&&(t.allSeries=e.allSeries),void 0!==e.xValue&&void 0===t.xValue&&(t.xValue=e.xValue),r=t}return r}(e);if(!i)return null;let r=t(i);return nr(r)?void 0===n&&(rr(t)||rr(r))?r:Mr(tr,{chrome:n,children:r}):null};return void 0===n&&rr(t)?or(i):i}if(!1===e||void 0===e)return!1;if(R(e)){if("function"==typeof e.content)return!ho&&"production"!==process.env.NODE_ENV&&(ho=!0,console.warn('[semiotic] tooltip={{ mode: "multi", content }} reached a chart without multi-series hover. content receives one datum and no allSeries.')),E(void 0===e.chrome?e.content:{content:e.content,chrome:e.chrome});"production"!==process.env.NODE_ENV&&console.warn('[semiotic] tooltip={{ mode: "multi" }} reached normalizeTooltip without a chart that wires tooltipMode. Use a line/area-family chart with multi support, or pass frameProps.tooltipMode: "multi" to StreamXYFrame.');let t=O({chrome:e.chrome});return E(e=>t(e))}if("object"==typeof e&&null!==e&&("fields"in e||"title"in e||"chrome"in e)){let t=I(e);return E(e=>t(e))}if("multi"===e){"production"!==process.env.NODE_ENV&&console.warn('[semiotic] tooltip="multi" reached normalizeTooltip on a single-tooltip chart. Rendering multi-field content as a backward-compatible fallback.');let e=O();return E(t=>e(t))}return I()}}function D({componentName:e,message:t,diagnosticHint:n,width:i,height:r}){return Mr("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Ar("div",{style:{textAlign:"center",maxWidth:400},children:[Mr("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Mr("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&Mr("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}function P(e,t){return e.displayName=t,e}function H({colors:e,children:t}){return Mr(mo.Provider,{value:e,children:t})}function B(e){let t=Ir(mo),n=Ir(yo);return e?n:t}function G(){return Ir(mo)}function _(e){let t=Tr(),n=e.clientId||t,{name:i}=e,r=lr(e=>e.selections.get(i)),o=lr(e=>e.setClause),l=lr(e=>e.clearClause),a=zr(()=>!!r&&r.clauses.size>0,[r]);return{predicate:zr(()=>r&&0!==r.clauses.size?ar(r,n):()=>!0,[r,n]),isActive:a,selectPoints:jr(e=>{let t={},r=!1;for(let[n,i]of Object.entries(e))t[n]={type:"point",values:new Set(i)},r=!0;r&&o(i,{clientId:n,type:"point",fields:t})},[n,i,o]),selectInterval:jr(e=>{let t={},r=!1;for(let[n,i]of Object.entries(e))t[n]={type:"interval",range:i},r=!0;r&&o(i,{clientId:n,type:"interval",fields:t})},[n,i,o]),clear:jr(()=>{l(i,n)},[l,i,n]),clientId:n}}function V(e,t){let n=Tr(),i=t||n,r=lr(e=>e.setClause),o=lr(e=>e.clearClause);return{selectPoints:jr(t=>{let n={},o=!1;for(let[e,i]of Object.entries(t))n[e]={type:"point",values:new Set(i)},o=!0;o&&r(e,{clientId:i,type:"point",fields:n})},[e,i,r]),clear:jr(()=>o(e,i),[e,i,o]),clientId:i}}function Y(e){let t=e.name||"hover",{fields:n}=e,{predicate:i,isActive:r,selectPoints:o,clear:l}=_({name:t,fields:n});return{onHover:jr(e=>{if(!e)return void l();let t=vr(e,n);sr(t)?o(t):l()},[n,o,l]),predicate:i,isActive:r}}function U(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function X(e){let{name:t,xField:n,yField:i}=e,{predicate:r,isActive:o,selectInterval:l,clear:a}=_({name:t,fields:[n,i].filter(Boolean)}),s=n&&i?"xyBrush":n?"xBrush":"yBrush",c=jr(e=>{if(!e)return void a();let t={};"xyBrush"===s&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===s&&U(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===s&&U(e)&&i&&(t[i]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),sr(t)&&l(t)},[s,n,i,l,a]);return{brushInteraction:zr(()=>({brush:s,during:c,end:c}),[s,c]),predicate:r,isActive:o,clear:a}}function q(e,t,n){let i=lr(e=>e.selections.get(t));return zr(()=>{if(!i||0===i.clauses.size)return e;let t=ar(i,n);return e.filter(t)},[e,i,n])}function K(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function J(e,t){let{when:n}=e,i=t.width,r=t.height,o=function(e){if(!("number"!=typeof e.height||e.height<=0))return e.width/e.height}(t),l=function(e){if(!("number"!=typeof e.height||e.height<=0))return e.width>=e.height?"landscape":"portrait"}(t);return!("number"==typeof n.minWidth&&i<n.minWidth||"number"==typeof n.maxWidth&&i>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||r<n.minHeight)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof o||o<n.minAspectRatio)||"number"==typeof n.maxAspectRatio&&("number"!=typeof o||o>n.maxAspectRatio)||n.orientation&&l!==n.orientation)}function Q(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};let i=n.map((e,t)=>({rule:e,index:t})).filter(e=>J(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:i.reduce((e,t)=>function(e,t){let n={...e,...t};for(let i of["margin","frameProps","mobileSemantics","style"])K(e[i])&&K(t[i])&&(n[i]={...e[i],...t[i]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:i}}function Z(e={}){let{limit:t=50,types:n,chartId:i}=e,r=er(e=>e.version),o=er(e=>e.observations),l=er(e=>e.clearObservations),a=zr(()=>{let e=o;if(n&&n.length>0){let t=new Set(n);e=e.filter(e=>t.has(e.type))}return i&&(e=e.filter(e=>e.chartId===i)),e.length>t&&(e=e.slice(e.length-t)),e},[o,n,i,t,r]);return{observations:a,latest:a.length>0?a[a.length-1]:null,clear:l}}function ee(e,t){let n=e.get(t);if(void 0!==n)return n;if(e.size>=4096)return ji(t);let i=e.size;return e.set(t,i),i}function te(e,t){let{key:n,currentTarget:i}=e,r=t?"ArrowRight":"ArrowDown";if(n!==(t?"ArrowLeft":"ArrowUp")&&n!==r&&"Home"!==n&&"End"!==n)return;e.preventDefault();let o=Array.from(i.closest("[role='listbox']")?.querySelectorAll("[role='option']")??[]),l="Home"===n?0:"End"===n?o.length-1:(o.indexOf(i)+(n===r?1:-1)+o.length)%o.length;o[l]?.focus()}function ne(e){let t=e?.find(e=>"bottom"===e.orient),n=e?.find(e=>"top"===e.orient),i=e?.find(e=>"left"===e.orient),r=e?.find(e=>"right"===e.orient);return{bottomAxis:t,topAxis:n,leftAxis:i,rightAxis:r,xAxis:t??n,yAxis:i??r,xOrient:t||!n?"bottom":"top",yOrient:i||!r?"left":"right"}}function ie(e){let t=6;for(let n=1;n<e.length;n++){let i=Math.abs(e[n]-e[n-1]);if(i>0&&Number.isFinite(i)){let r=Math.max(Math.abs(e[n]),Math.abs(e[n-1]));t=Math.max(t,Math.ceil(Math.log10(r/i))+1)}}let n=Math.min(17,t);return e=>Number.isInteger(e)?String(e):String(Number(e.toPrecision(n)))}function re(...e){let t;for(let n of e)n&&(t=oe(t)&&oe(n)?{legendGroups:[...t.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??t.legendDistance}:n);return t}function oe(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function le(e){return"object"==typeof e&&null!==e&&"gradient"in e}function ae(e,t,n,i,r=8){let o="left"===i||"right"===i,l=i,a="left"===i?"right":"right"===i?"left":"top"===i?"bottom":"top",s=Math.max(0,(o?n[0]:n[1])-r),c=Math.max(t[l],s-e[a]);e[l]>c&&(e[l]=c)}function se(e){return Math.ceil(7*e.length)}function ce(e,t){if(oe(e)){let n=ve(t),i=100;for(let t of e.legendGroups){t.label&&(i=Math.max(i,se(t.label)));for(let e of t.items)i=Math.max(i,n.swatchSize+n.labelGap+se(e.label))}return i}if(le(e)){let{gradient:t}=e,n=t.format||ie(t.domain),i=Math.max(se(n(t.domain[0])),se(n(t.domain[1]))),r=t.label?se(t.label):0;return Math.max(100,19+i,r)}return 100}function ue(e){return(oe(e)||le(e))&&Number.isFinite(e.legendDistance)?Math.max(0,e.legendDistance):10}function de(e,t){return null!=e?.sideGutter?Math.max(0,e.sideGutter):t?.hasAxis?t.hasAxisLabel?vo:xo:0}function he(e){return Math.max(0,e?.edgeGutter??3)}function fe(e,t){return null!=t?.axisGutter?Math.max(0,t.axisGutter):e?.hasAxis?e.hasAxisLabel?e.rotatedTicks?64:46:22:0}function me(e){let{bottomAxis:t,topAxis:n,leftAxis:i,rightAxis:r}=ne(e.axes),o=!(n&&!t||!1===t?.visible),l=!!n&&!t&&!1!==n.visible,a=!(r&&!i||!1===i?.visible),s=!!r&&!1!==r.visible,c=!1!==e.showAxes;return{hasAxis:c&&o,hasAxisLabel:c&&o&&!!(t?.label??e.xLabel),rotatedTicks:c&&o&&(e.rotatedTicks??!!t?.autoRotate),topAxis:l?{hasAxis:c,hasAxisLabel:c&&!!(n?.label??e.xLabel),rotatedTicks:c&&(e.rotatedTicks??!!n?.autoRotate)}:void 0,leftAxis:a?{hasAxis:c,hasAxisLabel:c&&!!(i?.label??e.yLabel)}:void 0,rightAxis:s?{hasAxis:c,hasAxisLabel:c&&!!(r?.label??e.yLabelRight??e.yLabel)}:void 0}}function ye(e,t){return me({showAxes:e.showAxes??t.showAxes,xLabel:e.xLabel??t.xLabel,yLabel:e.yLabel??t.yLabel,yLabelRight:e.yLabelRight??t.yLabelRight,axes:e.axes??t.axes})}function pe(e){let t=e.projection??"vertical",n=!1!==e.showAxes&&"radial"!==t;return{hasAxis:n,hasAxisLabel:n&&("horizontal"===t?e.hasValueLabel:e.hasCategoryLabel),leftAxis:{hasAxis:n,hasAxisLabel:n&&("horizontal"===t?e.hasCategoryLabel:e.hasValueLabel)}}}function ge(e,t,n){if(le(e))return e.gradient.label?46:26;if(!oe(e))return 20;let i=ve(n),r=Math.max(1,n?.maxWidth??t),o=i.rowHeight;for(let t of e.legendGroups){let e=0,n=0;for(let o of t.items){let t=i.swatchSize+i.labelGap+se(o.label),l=0===n?t:n+i.itemGap+t;n>0&&l>r?(e+=1,n=t):n=l}t.items.length>0&&(e+=1),o=Math.max(o,e*i.rowHeight,t.label?se(t.label):0)}return o+(e.legendGroups.length>1?16:0)}function be(e,t,n){return ce(e,t)+ue(e)+de(t,n)+he(t)}function xe(e,t){let{legend:n}=t;if(!n)return;let i=t.position??"right",r=ge(n,Math.max(1,t.size[0]-e.left-e.right),t.legendLayout)+ue(n)+fe("bottom"===i?t.axisChrome:"top"===i?t.axisChrome?.topAxis:void 0,t.legendLayout)+("top"===i&&t.hasTitle?24:0),o=Math.max(t.minimumMargin??0,"top"===i?t.hasTitle?58:34:0);"right"===i?e.right=Math.max(e.right,o,be(n,t.legendLayout,t.axisChrome?.rightAxis)):"left"===i?e.left=Math.max(e.left,o,be(n,t.legendLayout,t.axisChrome?.leftAxis)):"top"===i?e.top=Math.max(e.top,o,r):e.bottom=Math.max(e.bottom,o,r)}function ve(e){let t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function we(e,t,n=!1){let i={...e};for(let e of t??[])!1===e.visible&&("top"!==e.orient||!n)&&(i[e.orient]=0);return i}function ke({config:e,orientation:t="vertical",width:n=100,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:l,legendInteraction:a}){let{colorFn:s,domain:c,label:u,format:d}=e,h="horizontal"===t,f=d||ie(c),m=`grad-legend-${$r.useId()}`,y=!(!i&&!r),p="isolate"===a||void 0===a&&null!=l,[g,b]=$r.useState(0),[x,v]=$r.useState(null),[w,k]=c,M=$r.useMemo(()=>Array.from({length:65},(e,t)=>{let n=t/64;return Mr("stop",{offset:n,stopColor:s(h?w+n*(k-w):k-n*(k-w))},t)}),[s,w,k,h]),A=h?Math.min(n,200):14,S=h?12:100,$=h?Math.max(0,(n-A)/2):0,C=u?18:0;return Ar("g",{"aria-label":u||"Gradient legend",role:y?"listbox":void 0,"aria-orientation":y?t:void 0,"aria-multiselectable":!(!y||!p)||void 0,style:go,children:[Mr("defs",{children:Mr("linearGradient",{id:m,x1:"0%",y1:"0%",x2:h?"100%":"0%",y2:h?"0%":"100%",children:M})}),u&&Mr("text",{x:h?$+A/2:0,y:12,textAnchor:h?"middle":"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:u}),Mr("rect",{x:$,y:C,width:A,height:S,fill:`url(#${m})`,rx:2}),y&&Array.from({length:5},(e,t)=>((e,t,n)=>{let a="string"==typeof e.interactionKey?e.interactionKey:e.label,s=l?.has(a)??!1,c=o===a,u=x===n;return Mr("rect",{className:"semiotic-gradient-legend-bin",...t,fill:l?.size&&!s||null!=o&&!c?"rgba(255,255,255,0.65)":"transparent",stroke:u||s||c?"var(--semiotic-focus, #005fcc)":"transparent",strokeWidth:u?3:2,tabIndex:n===g?0:-1,role:"option","aria-label":e.label,"aria-selected":p?s:void 0,"aria-current":!(p||!c)||void 0,onClick:i?()=>i(e):void 0,onMouseEnter:r?()=>r(e):void 0,onMouseLeave:r?()=>r(null):void 0,onFocus:()=>{b(n),v(n),r?.(e)},onBlur:()=>{v(null),r?.(null)},onKeyDown:t=>{if(("Enter"===t.key||" "===t.key)&&i)return t.preventDefault(),void i(e);te(t,h)},style:{cursor:"pointer",pointerEvents:"all"}},`gradient-interaction-${n}`)})((e=>{let t=h?e:5-e-1,n=c[0]+t/5*(c[1]-c[0]),i=c[0]+(t+1)/5*(c[1]-c[0]);return{label:`${f(n)} – ${f(i)}`,valueRange:[n,i],interactionKey:`${n}:${i}`}})(t),{x:h?$+t*A/5:0,y:h?C:C+t*S/5,width:h?A/5:A,height:h?S:S/5},t)),[0,1].map(e=>Mr("text",{x:h?$+e*A:A+5,y:C+(h?S+12:e?S:10),textAnchor:h?e?"end":"start":void 0,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:f(c[h?e:1-e])},e))]})}function Me(e,t,n,i,r){if("function"==typeof n)return n(e);let o=i(e,t);return"fill"===n?Mr("rect",{style:o,width:r,height:r}):Mr("line",{style:o,x1:0,y1:0,x2:r,y2:r})}function Ae({swatchSize:e}){return Mr("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Se(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}function $e(e,t,n,i,r){let{legendGroup:{type:o="fill",styleFn:l},customClickBehavior:a,customHoverBehavior:s,highlightedCategory:c,isolatedCategories:u,focusedGroupIndex:d,focusedItemIndex:h,groupIndex:f,onFocusedIndexChange:m,interactive:y,useIsolateAria:p,metrics:{swatchSize:g,labelGap:b}}=e,x=!!u?.size&&u.has(t.label);return Ar("g",{transform:i,onClick:a?()=>a(t):void 0,onMouseEnter:s?()=>s(t):void 0,onMouseLeave:s?()=>s(null):void 0,tabIndex:y?f===d&&n===h?0:-1:void 0,role:y?"option":void 0,"aria-selected":y&&p?x:void 0,"aria-label":t.label,onKeyDown:y?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),a?.(t)),te(e,r)}:void 0,onFocus:y?e=>{m(f,n),s?.(t),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","visible")}:void 0,onBlur:y?e=>{s?.(null),e.currentTarget.querySelector(".semiotic-legend-focus-ring")?.setAttribute("visibility","hidden")}:void 0,style:{cursor:y?"pointer":"default",opacity:Se(t,c,u),transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[y&&Mr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+b+2+7*t.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),Me(t,n,o,l,g),x&&Mr(Ae,{swatchSize:g}),Mr("text",{y:g/2,x:g+b,dominantBaseline:"central",fontSize:12,style:bo,fill:"var(--semiotic-text, #333)",children:t.label})]},`legend-item-${n}`)}function Ce(e){let{legendGroups:t,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:o,legendInteraction:l,title:a="Legend",width:s=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=ve(d),[f,m]=$r.useState({group:0,item:0}),y=$r.useRef(null),p=$r.useRef(null),g=t||[],b=g[f.group]?.items.length?f.group:g.findIndex(e=>e.items.length>0),x=Math.min(f.item,(g[b]?.items.length??1)-1);$r.useEffect(()=>{let e=p.current;e&&!e.isConnected&&document.activeElement===document.body&&y.current?.querySelector("[tabindex='0']")?.focus()});let v=!(!n&&!i),w={customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:o,focusedGroupIndex:b,focusedItemIndex:x,onFocusedIndexChange:$r.useCallback((e,t)=>{m({group:e,item:t})},[]),interactive:v,useIsolateAria:"isolate"===l||void 0===l&&null!=o,metrics:h},k="vertical"===u?((e,t,n)=>{let i=[],r=function(e,t){let n=24;return e.map(({hasLabel:e,itemCount:i})=>{n+=5;let r,o=n;n+=8,e&&(n+=16,r=n,n+=8);let l=n;return n+=i*t+8,{lineY:o,labelY:r,itemsY:l,endY:n}})}(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),n.metrics.rowHeight);return e.forEach((e,o)=>{let l=r[o];i.push(Mr("line",{"aria-hidden":"true",stroke:"var(--semiotic-border, #808080)",x1:0,y1:l.lineY,x2:t,y2:l.lineY},`legend-top-line legend-symbol-${o}`)),e.label&&null!=l.labelY&&i.push(Mr("text",{y:l.labelY,className:"legend-group-label","aria-hidden":n.interactive||void 0,fontSize:12,style:bo,fill:"var(--semiotic-text, #333)",children:e.label},`legend-text-${o}`)),i.push(Mr("g",{className:"legend-item",role:n.interactive?"group":void 0,"aria-label":e.label,transform:`translate(0,${l.itemsY})`,children:wo({...n,legendGroup:e,groupIndex:o})},`legend-group-${o}`))}),i})(g,s,w):((e,t,n,i)=>{let{metrics:r}=i,o=0,l=[];e.forEach((e,n)=>{let a=0;e.label&&(a+=16);let s=((e,t)=>{let{items:n}=e.legendGroup,i=[],{swatchSize:r,labelGap:o,itemGap:l,rowHeight:a,align:s}=e.metrics,c=n.map(e=>r+o+7*e.label.length),u=[],d=0,h=0;c.forEach((e,n)=>{let i=0===h?e:h+l+e;t&&t>0&&h>0&&i>t?(u.push({start:d,end:n,width:h}),d=n,h=e):h=i}),n.length>0&&u.push({start:d,end:n.length,width:h}),u.forEach((r,o)=>{let u="center"===s?Math.max(0,((t??r.width)-r.width)/2):"end"===s?Math.max(0,(t??r.width)-r.width):0;for(let t=r.start;t<r.end;t++)i.push($e(e,n[t],t,`translate(${u},${o*a})`,!0)),u+=c[t]+l});let f=u.reduce((e,t)=>Math.max(e,t.width),0),m=u.length;return{items:i,offset:f,totalRows:m,totalHeight:m*a}})({...i,legendGroup:e,groupIndex:n},r.maxWidth??t);a+=s.offset+5,l.push({...s,offset:a}),o+=a+12});let a=r.maxWidth??t,s=o>a?0:"center"===r.align?Math.max(0,(a-o)/2):"end"===r.align?Math.max(0,a-o):0,c=[];return l.forEach((t,r)=>{let o=e[r];if(o.label&&(c.push(Mr("text",{transform:`translate(${s},0) rotate(90)`,textAnchor:"start",className:"legend-group-label","aria-hidden":i.interactive||void 0,fontSize:12,style:bo,fill:"var(--semiotic-text, #333)",children:o.label},`legend-text-${r}`)),s+=16),c.push(Mr("g",{className:"legend-item",role:i.interactive?"group":void 0,"aria-label":o.label,transform:`translate(${s},0)`,children:t.items},`legend-group-${r}`)),s+=t.offset+5,e[r+1]){let e=t.totalHeight||n;c.push(Mr("line",{"aria-hidden":"true",stroke:"var(--semiotic-border, #808080)",x1:s,y1:-8,x2:s,y2:e+0+8},`legend-top-line legend-symbol-${r}`))}s+=12}),Mr("g",{children:c})})(g,s,c,w);return Ar("g",{ref:y,onFocusCapture:e=>{e.target instanceof SVGElement&&"option"===e.target.getAttribute("role")&&(p.current=e.target)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(p.current=null)},role:v?"listbox":void 0,"aria-multiselectable":!(!v||!w.useIsolateAria)||void 0,"aria-label":"string"==typeof a&&a?a:"Chart legend","aria-orientation":v?"vertical"===u?"vertical":"horizontal":void 0,style:go,children:[void 0!==a&&""!==a&&"vertical"===u&&Mr("text",{className:"legend-title","aria-hidden":v||void 0,y:16,x:s/2,textAnchor:"middle",fontSize:12,style:bo,fill:"var(--semiotic-text, #333)",children:a}),k]})}function Le(e,t=0,n=1/0,i=0){let r=Number.isFinite(t)?t:0,o=Number.isFinite(n)?Math.max(r,n):1/0,l=Number.isFinite(e)?Math.floor(e):r,a=Math.max(r,Math.min(o,l));return i>0&&Number.isFinite(i)?Math.max(r,Math.min(o,Math.round(a/i)*i)):a}function ze(e,t,n,i={}){let r=Fr(null),[o,l]=Lr(null);ko(()=>{if(!t&&!n)return;let e=r.current;if(!e||typeof ResizeObserver>"u")return;let o=(e,t)=>({w:Le(e,i.minWidth,i.maxWidth,i.widthStep),h:Le(t,i.minHeight,i.maxHeight,i.heightStep)}),a=e.getBoundingClientRect();(a.width>0||a.height>0)&&l(o(a.width,a.height));let s=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect,i=o(e,n);l(e=>e&&e.w===i.w&&e.h===i.h?e:i)}});return s.observe(e),()=>s.disconnect()},[t,n,i.minWidth,i.maxWidth,i.widthStep,i.minHeight,i.maxHeight,i.heightStep]);let a=[t&&o?o.w:e[0],n&&o?o.h:e[1]];return[r,a]}function Ne(){return Ir(Ao)}function Ie(e){let t=new Set,n=[];for(let i of e)t.has(i)||(t.add(i),n.push(i));return n}function Oe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function je(e,t){let n=Ir(So),i=Tr(),r=Ie(e),o=r.map(e=>t?.(e)),l=Fr({categories:[],colors:[]});(!Oe(l.current.categories,r)||!Oe(l.current.colors,o))&&(l.current={categories:r,colors:o});let a=l.current;$o(()=>{if(n)return()=>n.unregisterCategories(i)},[n,i]),$o(()=>{n&&n.registerCategories(i,a)},[n,i,a])}function Re(){return null!==Ir(So)}function Te({categoryColors:e,interaction:t,selectionName:n,field:i}){let r=Object.entries(e),o=r.map(([e])=>e),l=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:s}=_({name:n,fields:[i],clientId:Co}),{selectPoints:c,clear:u}=_({name:n,fields:[i],clientId:Lo}),d=lr(e=>e.selections.get(n)),{isolatedCategories:h,highlightedCategory:f}=zr(()=>{let e=new Set,t=null,n=d?.clauses.get(Co)?.fields[i];if("point"===n?.type)for(let t of n.values)e.add(String(t));let r=d?.clauses.get(Lo)?.fields[i];if("point"===r?.type){let e=r.values.values().next().value;null!=e&&(t=String(e))}return{isolatedCategories:e,highlightedCategory:t}},[d,i]),m=jr(e=>{"highlight"===t&&(e?c({[i]:[e.label]}):u())},[t,i,c,u]),y=jr(e=>{if("isolate"!==t)return;let n=new Set(h);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===o.length?s():a({[i]:Array.from(n)})},[t,i,h,o.length,a,s]),[p,[g]]=ze([0,0],!0,!1),b=zr(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,i=1;for(let r of e){let e=26+7*r.length;n>0&&n+e>t&&(i++,n=0),n+=e}return i}(r.map(([e])=>e),g),[r,g]),x=Math.max(30,22*b+8);return 0===r.length?null:Mr("div",{ref:p,style:{width:"100%",display:"block"},children:Mr("svg",{width:"100%",height:x,style:{display:"block",overflow:"visible"},children:Mr(Ce,{legendGroups:l,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?m:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:h})})})}function We({children:e,crosshair:t,selections:n,showLegend:i,legendPosition:r="top",legendInteraction:o="none",legendSelectionName:l="legend",legendField:a="category"}){let s=zr(()=>{if(!n)return;let e=new Map;for(let[t,i]of Object.entries(n))i.resolution&&e.set(t,{name:t,resolution:i.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[n]),c=G(),u=cr(e=>e.theme.colors.categorical),d=u.length>0?u:Ci,[h,f]=Lr({}),m=Fr(new Map),y=zr(()=>({registerCategories:(e,t)=>{f(n=>Oe(n[e]?.categories??[],t.categories)&&Oe(n[e]?.colors??[],t.colors)?n:{...n,[e]:t})},unregisterCategories:e=>{f(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n})}}),[]),p=zr(()=>{let e=[];for(let{categories:t}of Object.values(h))for(let n of t)e.push(n);return Ie(e)},[h]),g=zr(()=>{let e=c??{},t=new Map(m.current),n=Object.entries(e).filter(e=>"string"==typeof e[1]&&e[1].length>0),i=p.map(n=>{let i=ee(t,n);return[n,Li(e,n)??d[i%d.length]]});return{categoryIndexes:t,colors:Object.fromEntries([...n,...i])}},[c,p,d]);$o(()=>{m.current=g.categoryIndexes},[g]);let b=g.colors,v=zr(()=>{let e=new Map,t=!1;for(let{categories:n,colors:i}of Object.values(h))n.forEach((n,r)=>{let o=i[r];o&&(e.has(n)&&e.get(n)!==o&&(t=!0),e.set(n,o))});return{colors:{...b,...Object.fromEntries(e)},conflicting:t}},[b,h]),w=(i??!0)&&!v.conflicting,k=Object.keys(b).length>0,M=w&&k;return Mr(x,{control:t,children:Mr(ur,{initialState:s,children:Mr(dr,{children:Mr(Ao.Provider,{value:!0,children:Mr(So.Provider,{value:y,children:Mr(H,{colors:b,children:Ar(Mo.Provider,{value:M,children:[w&&"top"===r&&Mr(Te,{categoryColors:v.colors,interaction:o,selectionName:l,field:a}),e,w&&"bottom"===r&&Mr(Te,{categoryColors:v.colors,interaction:o,selectionName:l,field:a})]})})})})})})})}function Fe(e){if(null==e)return()=>{};let t="function"==typeof e?e:t=>t[e];return e=>Pe(t(e))}function Ee(e,t){let n=Fe(e),i=Fe(t);return(e,t)=>{let r=i(e);return{value:r,x:n(e),y:r,category:t}}}function De(e,t){let n=Fe(t??"value"),i=null==e?void 0:"function"==typeof e?e:t=>t[e];return e=>{let t=i?i(e):void 0;return{value:n(e),category:null==t?void 0:String(t)}}}function Pe(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){let t=Number(e);return Number.isFinite(t)?t:void 0}}function He(e,t,n){let i=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&i!==e.eq||void 0!==e.ne&&i===e.ne||void 0!==e.in&&!e.in.includes(i))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;let r=Pe(i);if(!(void 0!==r&&(void 0===e.gt||r>e.gt)&&(void 0===e.gte||r>=e.gte)&&(void 0===e.lt||r<e.lt)&&(void 0===e.lte||r<=e.lte)))return!1;if(void 0!==e.within){let[t,n]=e.within;if(!(r>=t&&r<=n))return!1}if(void 0!==e.outside){let[t,n]=e.outside;if(!(r<t||r>n))return!1}return!0}function Be(e,t,n){let i=e.when;return void 0===i||!0===i||!1!==i&&("function"==typeof i?i(t,n):He(i,t,n))}function Ge(e,t,n){if(!t||0===t.length)return{};let i={};for(let r of t){if(!Be(r,e,n))continue;let t="function"==typeof r.style?r.style(e,n):r.style;t&&(i={...i,...t})}return i}function _e(e,t,n,i=e=>e){let r=e??(()=>({}));return t&&0!==t.length?(e,o)=>{let l=i(e),a={...r(e,o)};return Object.assign(a,Ge(l,t,n(l,o))),a}:r}function Ve(e,t,n){return e&&0!==e.length?(i,r)=>{let o=Ge(i,e,t(i,r)),l=n?n(i,r):void 0;return l?{...o,...l}:o}:n}function Ye(e,t,n,i){if(!e||0===e.length)return i;let r=De(t,n);return(t,n)=>{let o=t&&t.data||t,l=Ge(o,e,r(o)),a=i?i(t,n):void 0;return a?{...l,...a}:l}}function Ue(e,t,n,i){return Ve(e,Ee(t,n),i)}function Xe(e,t,n){let i=Fe(t);return Ve(e,(e,t)=>({value:i(e),category:t}),n)}function qe(e){if(!e)return zo;for(let t of e)if(null==t||"object"!=typeof t)return e.filter(e=>null!=e&&"object"==typeof e);return e}function Ke(e,t){let n={...e};for(let e of t)n[Io[e]]++;return n}function Je(e,t,n){let i=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:i,revisions:Ke(n,i)}}function Qe(e){let{domain:t,layout:n,sceneGeometry:i}=e.revisions;return{domain:t,layout:n,sceneGeometry:i}}function Ze(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}function et(e){return Fr(new Wo(e))}function tt(e,t,n,i=!1,r=!1){let o=e.beforeCompute(t.getLastUpdateResult(),i);n(),e.afterCompute(o,!0,r)}function nt(e){let{legend:t,totalWidth:n,totalHeight:i,margin:r,legendPosition:o="right",legendLayout:l,legendHoverBehavior:a,legendClickBehavior:s,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:d}=e;if(!t)return null;let{x:h,y:f,width:m}=function(e,t){let n=t.position??"right",i="top"===n||"bottom"===n,r=Math.max(0,t.totalWidth-t.margin.left-t.margin.right),o=Math.max(1,i?t.legendLayout?.maxWidth??r:t.reservedWidth??ce(e,t.legendLayout)),l=ue(e),a=de(t.legendLayout,"left"===n?t.axisChrome?.leftAxis:t.axisChrome?.rightAxis),s=he(t.legendLayout),c=ge(e,r,t.legendLayout),u=fe(t.axisChrome,t.legendLayout),d=fe(t.axisChrome?.topAxis,t.legendLayout);if("left"===n)return{x:Math.max(s,t.margin.left-a-o-l),y:t.margin.top,width:o,height:c};if("top"===n)return{x:t.margin.left,y:t.margin.top-d-l-c,width:o,height:c};if("bottom"===n){let e=t.totalHeight-t.margin.bottom;return{x:t.margin.left,y:Math.max(e+l,Math.min(e+u+l,t.totalHeight-c)),width:o,height:c}}return{x:Math.min(t.totalWidth-o-s,t.totalWidth-t.margin.right+a+l),y:t.margin.top,width:o,height:c}}(t,{totalWidth:n,totalHeight:i,margin:r,position:o,legendLayout:l,axisChrome:e.axisChrome}),y="top"===o||"bottom"===o;return Mr("g",{transform:`translate(${h}, ${f})`,children:le(t)?Mr(ke,{config:t.gradient,orientation:y?"horizontal":"vertical",width:m,customHoverBehavior:a,customClickBehavior:s,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):oe(t)?Mr(Ce,{legendGroups:t.legendGroups,title:"",width:m,orientation:y?"horizontal":"vertical",legendLayout:l,customHoverBehavior:a,customClickBehavior:s,highlightedCategory:c,isolatedCategories:u,legendInteraction:d}):t})}function it(e){return!0===e?._annotationDeferred}function rt(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function ot(e){let t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function lt(e){return Math.max(.72,.95-.06*e)}function at(e){let t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:ot(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),i=e.some(e=>it(e.annotation)),r=e.some(e=>null!=rt(e.annotation)),o=e.some(e=>"layer"===rt(e.annotation));if(!n&&!i&&!r)return e.map(e=>e.node);let l=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(let e of t)e.emphasis&&(e.rank=Eo[e.emphasis]);let a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{let{p:t,i:n,emphasis:i,readingOrder:r}=e,o=it(t.annotation),l=t.node;if("primary"===i||"secondary"===i||null!=r){let e=null==i&&null!=r;l=Mr("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":`annotation-emphasis annotation-emphasis--${i}`,..."secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:lt(r),"data-annotation-reading-order":r}:{},children:t.node},`annotation-emphasis-${n}`)}let a=rt(t.annotation);return a&&(l=Mr("g",{className:`annotation-cohesion--${a}`,children:l},`annotation-cohesion-${n}`)),o&&(l=Mr("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},`annotation-deferred-${n}`)),l});return i&&a.unshift(Mr("style",{children:Do},"annotation-disclosure-style")),o&&a.unshift(Mr("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}function st(e,t,n,i){return function(e,t,n,i){let r=[];return e.forEach((e,o)=>{let l;l=n?n(e,o,i)??t(e,o,i):t(e,o,i),l&&r.push({node:l,annotation:e})}),{nodes:at(r),renderedAnnotations:r.map(e=>e.annotation)}}(e,t,n,i).nodes}function ct(e,t,n){if(!e)return null;let i="object"==typeof e?e:{};return Mr("circle",{className:"semiotic-threshold-end-cap",cx:t[0],cy:t[1],r:Math.max(0,i.radius??4),fill:i.fill??n})}function ut({ann:e,position:t,vertical:n,width:i,height:r,color:o,fontSize:l=12,fontFamily:a,bold:s,background:c,dash:d="6,3",labelGap:h=4}){let f=e.labelPosition,m=t>.6*i,y=n?t+(m?-4:4):"left"===f?4:"center"===f?i/2:i-4,p=n?"bottom"===f?r-4:"center"===f?r/2:16:t<20?Math.min(r-4,t+16):t-h,g=n?m?"end":"start":"left"===f?"start":"center"===f?"middle":"end",b=n?[t,0]:[0,t],x=n?[t,r]:[i,t];return Ar("g",{opacity:e.opacity,children:[Mr("line",{x1:b[0],y1:b[1],x2:x[0],y2:x[1],stroke:o,strokeWidth:e.strokeWidth??1.5,strokeDasharray:e.strokeDasharray||d}),ct(e.endCap,b,o),e.label&&Mr(u,{x:y,y:p,text:e.label,textAnchor:g,fill:e.labelColor??o,fontSize:l,fontFamily:a,fontWeight:s?"bold":void 0,background:c??e.labelBackground??"halo"})]})}function dt(e){return{label:e.label,title:e.title,wrap:e.wrap||120,noWrap:"function"==typeof e._noteLayout?e.noWrap:void 0,_noteLayout:e._noteLayout}}function ht(e){return"function"==typeof e._noteLayout?e._noteLayout(e):void 0}function ft(e,t,n){if(!e)return[];let i=Math.max(1,Math.floor(t/n)),r=[],o="";for(let t of e.split(/\s+/))t&&(o&&o.length+1+t.length>i?(r.push(o),o=t):o=o?`${o} ${t}`:t);return o&&r.push(o),r}function mt(e,t,n,i){return"curly"===e?i?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:i?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function yt(e,t,n,i){if(!e)return Mr("g",{className:"annotation-note"});let{label:r,title:o,orientation:l,align:a,wrap:s=120,noWrap:c}=e;if(!r&&!o)return Mr("g",{className:"annotation-note"});let u=l;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d="topBottom"===u,h="leftRight"===u,f=a;(!f||"dynamic"===f)&&(f=d?t>=0?"left":"right":n>=0?"top":"bottom");let m="start";d?"right"===f?m="end":"middle"===f&&(m="middle"):m=t>=0?"start":"end";let y=e.useHTML||e.html,p=y?void 0:ht(e),g=p?.lineHeight??16,b=p?.titleLines??(o?c?[o]:ft(o,s,8):[]),x=p?.labelLines??(r?c?[r]:ft(r,s,8):[]),v=b.length+x.length,w=h?"end"===m?-4:4:0,k=[],M=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";if(y){let e=s,t=Math.max(g,v*g+(o&&r?2:0)),n="end"===m?w-e:"middle"===m?w-e/2:w,i="end"===m?"right":"middle"===m?"center":"left";k.push(Mr("foreignObject",{className:"annotation-note-html",x:n,y:-g,width:e,height:t+g,style:{overflow:"visible"},children:Ar("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:M,fontSize:"12px",lineHeight:`${g}px`,overflow:"visible",textAlign:i,whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[o&&Mr("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:o}),r&&Mr("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html"))}else for(let e of[!0,!1]){let t=e?b:x;if(0===t.length)continue;let n="annotation-note-"+(e?"title":"label");k.push(Mr("text",{className:n,fill:M,textAnchor:m,fontWeight:e?p?.titleFontWeight??"bold":void 0,y:e?void 0:b.length*g,children:t.map((e,t)=>Mr("tspan",{x:w,dy:0===t?0:g,children:e},t))},n))}let A=null;if((o||r)&&(0!==t||0!==n)){let e=d?p?p.width:Math.min(s,120):(b.length+x.length+(x.length>0?1:0))*g,t=d?m:f,n="end"===t||"bottom"===t?-e:"middle"===t?-e/2:0;A=Mr("line",{className:"note-line",x1:d?n:0,x2:d?n+e:0,y1:d?0:n,y2:d?0:n+e,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}let S=Math.max(0,v-1)*g,$=x.length>0&&b.length>0?2:0,C=0;(d||h)&&(C=h&&"middle"===f?-(S+g+$)/2+g/2:n<0||h&&"bottom"===f?-(S+2):2+g);let L=0!==C?`translate(0,${C})`:void 0;return Ar("g",{className:"annotation-note",transform:`translate(${t},${n})`,...p?.textProps,children:[Mr("g",{className:"annotation-note-content",transform:L,children:k}),A]})}function pt(e,t,n,i,r){let o=null,l=n||"var(--semiotic-text-secondary, currentColor)";switch(e){case"callout-circle":{let e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&(o=Mr("circle",{r:e,fill:"none",stroke:l},"subject-circle"));break}case"callout-rect":{let e=t?.width||0,n=t?.height||0;(e>0||n>0)&&(o=Mr("rect",{width:e,height:n,fill:"none",stroke:l},"subject-rect"));break}case"callout-custom":o=t?.custom;break;case"xy-threshold":{let e=i||0,n=r||0,a=0,s=0,c=0,u=0;if(void 0!==t?.x)a=s=(t.x||0)-e,c=(t.y1||0)-n,u=(t.y2||0)-n;else if(void 0!==t?.y)c=u=(t.y||0)-n,a=(t.x1||0)-e,s=(t.x2||0)-e;else if(void 0!==t?.x1||void 0!==t?.x2)a=(t.x1||0)-e,s=(t.x2||0)-e;else{if(void 0===t?.y1&&void 0===t?.y2)break;c=(t.y1||0)-n,u=(t.y2||0)-n}o=Mr("line",{x1:a,y1:c,x2:s,y2:u,stroke:l,strokeDasharray:"5,5"},"threshold-line");break}case"bracket":{let e=t?.type||"curly",n=t?.width??t?.height;void 0!==n&&(o=Mr("path",{d:mt(e,n,t?.depth||30,void 0===t?.width),fill:"none",stroke:l},"bracket-path"));break}}return Mr("g",{className:"annotation-subject",children:o})}function gt(e,t,n,i,r,o){let l,a,s=0,c=0;if("callout-circle"!==r&&"label"!==r||!o?.radius){if("callout-rect"===r&&o){let n=o.width||0,i=o.height||0;if(n>0||i>0){let r=n/2,o=i/2,l=e-r,a=t-o;if(0!==l||0!==a){let e=Math.abs(l),t=Math.abs(a),u=n/2,d=i/2,h=e*d>t*u?u/e:d/t;s=r+l*h,c=o+a*h}}}else if("bracket"===r&&o){let e=o.width,t=o.height,n=o.depth||30;void 0!==e?(s=e/2,c=n):void 0!==t&&(s=n,c=t/2)}}else{let n=(o.radius||0)+(o.radiusPadding||0);if(n>0&&(0!==e||0!==t)){let i=Math.atan2(t,e);s=Math.cos(i)*n,c=Math.sin(i)*n}}let u=e-s,d=t-c,h=Math.hypot(u,d);if(h>.5){let r=i||"var(--semiotic-text-secondary, currentColor)",o="curve"===n?.type,f=Math.atan2(d,u);if(o){let i=(s+e)/2,o=(c+t)/2,a=-d/h,m=u/h,y=(n?.curve??.25)*h,p=i+a*y,g=o+m*y;l=Mr("path",{className:"connector-curve",d:`M${s},${c}Q${p},${g} ${e},${t}`,fill:"none",stroke:r},"connector-line"),f=Math.atan2(g-c,p-s)}else l=Mr("line",{x1:s,y1:c,x2:e,y2:t,stroke:r},"connector-line");if("arrow"===n?.end){let e=.08888888888888889*Math.PI,t=s+10*Math.cos(f+e),n=c+10*Math.sin(f+e),i=s+10*Math.cos(f-e),o=c+10*Math.sin(f-e);a=Mr("path",{d:`M${s},${c}L${t},${n}L${i},${o}Z`,fill:r,stroke:"none"},"connector-arrow")}}return Ar("g",{className:"annotation-connector",children:[l,a]})}function bt(e){let{x:t=0,y:n=0,dx:i,dy:r,nx:o,ny:l,note:a,connector:s,subject:c,type:u,color:d,className:h,disable:f,opacity:m,strokeDasharray:y,events:p={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=Array.isArray(f)?f:[],w=i||0,k=r||0;null!=o&&(w=o-b),null!=l&&(k=l-x);let M="string"==typeof u?u:"label";if("bracket"===M&&c&&0===w&&0===k)if(void 0!==c.width){w=c.width/2;let e=c.depth||30;k=e+(e>=0?5:-5)}else if(void 0!==c.height){let e=c.depth||30;w=e+(e>=0?5:-5),k=c.height/2}return Ar("g",{className:`annotation ${h||""}`.trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=m&&{opacity:m},...y&&{strokeDasharray:y},...p,children:[!v.includes("connector")&>(w,k,s,d,M,c),!v.includes("subject")&&pt(M,c,d,b,x),!v.includes("note")&&yt(a,w,k,d)]})}function xt(e){let{noteData:t}=e,{screenCoordinates:n}=t,i="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){let e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),o=n.map((n,o)=>{let l=Object.assign({},t,{note:0===o?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return Mr(bt,{"data-testid":"semiotic-annotation",...l,type:i},`multi-annotation-${o}`)});return Mr("g",{children:o})}let o=t.note||{title:"none",label:t.label},l=`${o.label}-${o.title}-${t.i}`;return Mr(bt,{"data-testid":"semiotic-annotation",events:r,...t,type:i},l)}function vt(e,t){let n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function wt(e,t){let n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function kt(e){return null==e?null:String(e)}function Mt(e,t,n){return t.stickyPositionCache?.set(e,n),n}function At(e,t,n){let i=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===i){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let i=n.pointNodes.length-1;i>=0;i--){let r=n.pointNodes[i];if(r.pointId===e.pointId)return Mt(t,n,{x:r.x,y:r.y})}let i=function(e){let t=e.data;if(!t||0===t.length)return null;let n=t[t.length-1],i=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!i||!r)return null;let o=e.xAccessor||"x",l=e.yAccessor||"y",a=n[o],s=n[l];return null==a||null==s?null:{x:i(a),y:r(s)}}(n);return i?Mt(t,n,i):null}if("semantic"===i){let i=function(e,t,n){let i=function(e){return kt(e.provenance?.stableId??e.stableId)}(e);if(!i)return null;let r=n.pointNodes?.find(e=>kt(e.pointId)===i);if(r)return Mt(t,n,{x:r.x,y:r.y});let o=n.data?.find(e=>function(e){return kt(e.stableId??e.id??e.provenance?.stableId)}(e)===i);if(!o)return null;let l=vt(o,n),a=wt(o,n);return null==l||null==a?null:Mt(t,n,{x:l,y:a})}(e,t,n);if(i)return i}let r=null,o=null;if(null!=e.pointId&&n.pointNodes){let t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,o=t.y)}if((null==r||null==o)&&(r=vt(e,n),o=wt(e,n)),null!=r&&null!=o)return Mt(t,n,{x:r,y:o});if("sticky"===i){let e=n.stickyPositionCache?.get(t);if(e)return e}return null}function St(e,t,n,i=50){let r=n.width||0,o=n.height||0;return e>=-i&&e<=r+i&&t>=-i&&t<=o+i}function $t(e,t,n,i){let r=Ri(e.fill??e.color,t,i),o="string"==typeof e.fill&&e.fill?e.fill:"string"==typeof e.color&&e.color?e.color:i;return Ti(e.gradient,t,n,o)??r}function Ct(e,t,n){let i=e.position,r="string"==typeof i&&Po.has(i)?i:"bottom-left",o=r.endsWith("left")?"left":r.endsWith("right")?"right":"center",l=r.startsWith("top")?"top":r.startsWith("bottom")?"bottom":"middle",a="top"===l?0:"bottom"===l?n:n/2;return{x:("left"===o?0:"right"===o?t:t/2)+("number"==typeof e.dx&&Number.isFinite(e.dx)?e.dx:0),y:a+("number"==typeof e.dy&&Number.isFinite(e.dy)?e.dy:0),textAnchor:"start"===e.textAnchor||"middle"===e.textAnchor||"end"===e.textAnchor?e.textAnchor:"left"===o?"start":"right"===o?"end":"middle",dominantBaseline:"auto"===e.dominantBaseline||"middle"===e.dominantBaseline||"hanging"===e.dominantBaseline?e.dominantBaseline:"top"===l?"hanging":"bottom"===l?"auto":"middle"}}function Lt(e,t,n,i){return{...Ct(e,t,n),fill:e.fill??e.color??i.fill,fontSize:e.fontSize??i.fontSize,fontFamily:e.fontFamily??i.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,letterSpacing:e.letterSpacing,opacity:e.opacity,className:e.className,style:{pointerEvents:"none"}}}function zt({annotation:e,width:t,height:n,defaults:i=Ho}){let r=e.label??e.text;return null==r?null:Mr("text",{...Lt(e,t,n,i),children:r})}function Nt(e,t={},n=!1){return function(e,i,r){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{let t=At(e,i,r);if(!t)return null;let{x:n,y:o}=t;if(!St(n,o,r))return null;let l="callout"===e.type?"callout-circle":e.type,a="callout-circle"===l?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===l?{width:e.width,height:e.height}:void 0;return Mr(xt,{noteData:{x:n,y:o,dx:e.dx??30,dy:e.dy??-30,note:dt(e),type:l,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},`ann-${i}`)}case"x-threshold":case"y-threshold":{let t="x-threshold"===e.type,n=null!=e.value?{...e,[t?"x":"y"]:e.value}:e,o=t?vt(n,r):wt(n,r);return null==o?null:Mr(ut,{ann:e,position:o,vertical:t,width:r.width||0,height:r.height||0,color:e.color||"#f97316",bold:!0},`ann-${i}`)}case"enclose":{let t=(e.coordinates||[]).map(e=>({x:vt({...e,type:"point"},r),y:wt({...e,type:"point"},r),r:1})).filter(e=>null!=e.x&&null!=e.y);if(t.length<2)return null;let n=Dr(t),o=e.padding||10;return Ar("g",{children:[Mr("circle",{cx:n.x,cy:n.y,r:n.r+o,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&Mr(u,{x:n.x,y:n.y-n.r-o-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},`ann-${i}`)}case"rect-enclose":{let t=(e.coordinates||[]).map(e=>({x:vt({...e,type:"point"},r),y:wt({...e,type:"point"},r)})).filter(e=>null!=e.x&&null!=e.y);if(t.length<2)return null;let n=e.padding||10,o=t.map(e=>e.x),l=t.map(e=>e.y),[a,s]=kr(o),[c,d]=kr(l),h=a-n,f=s+n,m=c-n;return Ar("g",{children:[Mr("rect",{x:h,y:m,width:f-h,height:d+n-m,fill:e.fill||"none",fillOpacity:e.fillOpacity??.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&Mr(u,{x:(h+f)/2,y:m-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},`ann-${i}`)}case"highlight":{let t=r.data||[],n="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],o={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return Mr("g",{children:n.map((t,n)=>{let i=vt(t,r),l=wt(t,r);if(null==i||null==l)return null;let a="function"==typeof e.r?e.r(t):e.r||6,s="function"==typeof e.style?e.style(t):e.style||o;return Mr("circle",{cx:i,cy:l,r:a,...s},`hl-${n}`)})},`ann-${i}`)}case"bracket":{let t=vt(e,r),n=wt(e,r);return Mr(xt,{noteData:{x:t??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:dt(e),type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},`ann-${i}`)}case"trend":{let t=function(e,t){let n=t.scales?.x??t.scales?.time,i=t.scales?.y??t.scales?.value;if(!n||!i)return[];let r=t.data||[],o=t.xAccessor||"x",l=t.yAccessor||"y",a="horizontal"===t.projection,s="ordinal"===t.frameType;s&&a&&([o,l]=[l,o]);let c=n,u=i,d=a?u:c,h=s?t.scales?.o?.domain().map(String)??[...new Set(r.filter(e=>null!=e[o]).map(e=>String(e[o])))].sort((e,t)=>d(e)-d(t)):[],f=new Map(h.map((e,t)=>[e,t])),m=bi(r.map(e=>[s?null==e[o]?void 0:f.get(String(e[o])):e[o],e[l]]));return m.length<2?[]:("loess"===e.method?xi(m,e.bandwidth??.3):("polynomial"===e.method?vi(m,e.order??2):wi(m)).points).map(([e,t])=>{if(!s)return[c(e),u(t)];let n=d(h[e]);return a?[c(t),n]:[n,u(t)]}).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t))}(e,r);if(t.length<2)return null;let n=t.map(([e,t])=>`${e},${t}`).join(" "),o=e.color||"#6366f1",[l,a]=t[t.length-1];return Ar("g",{children:[Mr("polyline",{points:n,fill:"none",stroke:o,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&Mr("text",{x:l+4,y:a-4,fill:o,fontSize:11,children:e.label})]},`ann-${i}`)}case"band":{let t=r.scales?.y??r.scales?.value,a=t?.domain?.(),s=e.y0??a?.[0],c=e.y1??a?.[1],d=null!=s&&t?t(s):0,h=null!=c&&t?t(c):r.height||0,f=$t(e,`ann-${i}`,"vertical","var(--semiotic-primary, #6366f1)"),m=n&&"under"===e.layer;return Ar("g",{opacity:e.opacity,children:[!m&&f.def&&Mr("defs",{children:f.def}),!m&&Mr("rect",{x:0,y:Math.min(d,h),width:r.width||0,height:Math.abs(h-d),fill:f.fill,fillOpacity:e.fillOpacity??.1}),e.label&&Mr(u,{x:(r.width||0)-4,y:(o=d,l=h,Math.max(Math.min(o,l),0)+16),textAnchor:"end",fill:e.labelColor??(e.color||"var(--semiotic-primary, #6366f1)"),fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},`ann-${i}`)}case"x-band":{let t=r.scales?.x??r.scales?.time,o=t?.domain?.(),l=e.x0??o?.[0],a=e.x1??o?.[1],s=null!=l&&t?t(l):null,c=null!=a&&t?t(a):null;if(null==s||null==c)return null;let d=$t(e,`ann-${i}`,"horizontal","var(--semiotic-primary, #6366f1)"),h=n&&"under"===e.layer;return Ar("g",{opacity:e.opacity,children:[!h&&d.def&&Mr("defs",{children:d.def}),!h&&Mr("rect",{x:Math.min(s,c),y:0,width:Math.abs(c-s),height:r.height||0,fill:d.fill,fillOpacity:e.fillOpacity??.1}),e.label&&Mr(u,{x:Math.min(s,c)+4,y:16,textAnchor:"start",fill:e.labelColor??(e.color||"var(--semiotic-primary, #6366f1)"),fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},`ann-${i}`)}case"envelope":{let t=r.data||[];if(t.length<2)return null;let n=r.xAccessor||"x",o=r.scales?.x??r.scales?.time,l=r.scales?.y??r.scales?.value;if(!o||!l)return null;let a=e.upperAccessor||"upperBounds",s=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>!(null==e[a]||null==e[s]||c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(u.length<2)return null;let d=Bo[r.curve||"linear"]||Xr,h=qr().x(e=>o(e[n])).y0(e=>l(e[s])).y1(e=>l(e[a])).curve(d)(u);if(!h)return null;let f=e.fill||"#6366f1";return Ar("g",{children:[Mr("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&Mr("text",{x:o(u[u.length-1][n])+4,y:l(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},`ann-${i}`)}case"anomaly-band":{let t=(r.data||[]).filter(t=>!e.filter||e.filter(t));if(t.length<2)return null;let n=r.yAccessor||"y",o=r.scales?.x??r.scales?.time,l=r.scales?.y??r.scales?.value;if(!o||!l)return null;let a=t.map(e=>Mi(e[n])).filter(e=>null!==e);if(a.length<2)return null;let s=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-s)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=s+d*u,f=s-d*u,m=!1!==e.showBand,y=e.fill||"#6366f1",p=e.fillOpacity??.1,g=e.anomalyColor||"#ef4444",b=e.anomalyRadius??6,x=l(h),v=l(f),w=t.filter(e=>{let t=Mi(e[n]);return null!=t&&Math.abs(t-s)>d*u});return Ar("g",{children:[m&&Mr("rect",{x:0,y:Math.min(x,v),width:r.width||0,height:Math.abs(v-x),fill:y,fillOpacity:p}),w.map((e,t)=>{let n=vt(e,r),i=wt(e,r);return null==n||null==i?null:Mr("circle",{cx:n,cy:i,r:b,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},`anomaly-${t}`)}),e.label&&Mr("text",{x:(r.width||0)-4,y:Math.min(x,v)-4,textAnchor:"end",fill:y,fontSize:11,children:e.label})]},`ann-${i}`)}case"forecast":{let t=r.data||[],n=r.xAccessor||"x",o=r.yAccessor||"y",l=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!l||!a)return null;let s=bi(t.map(e=>[e[n],e[o]])),c=ki(s,e);if(!c)return null;let{predict:u}=c,d=s[s.length-1][0],h=c.forecast(e.steps??5);if(!h.length)return null;let f=qr().x(e=>l(e.x)).y0(e=>a(e.lower)).y1(e=>a(e.upper))(h);if(!f)return null;let m=h.map(e=>`${l(e.x)},${a(e.y)}`).join(" "),y=`${l(d)},${a(u(d))}`,p=e.fill||"#6366f1",g=e.strokeColor||"#6366f1";return Ar("g",{children:[Mr("path",{d:f,fill:p,fillOpacity:e.fillOpacity??.15,stroke:"none"}),Mr("polyline",{points:`${y} ${m}`,fill:"none",stroke:g,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&h.length>0&&Mr("text",{x:l(h[h.length-1].x)+4,y:a(h[h.length-1].y)-4,fill:g,fontSize:11,children:e.label})]},`ann-${i}`)}case"widget":{let n,o;if(null!=e.px&&null!=e.py)n=e.px,o=e.py;else{let t=At(e,i,r);if(!t)return null;n=t.x,o=t.y}if(!St(n,o,r))return null;let l=e.dx??0,a=e.dy??0,s=e.width??32,c=e.height??32,u=e.content??Mr("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return Mr("foreignObject",{x:n+l-s/2,y:o+a-c/2,width:s,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:Mr("div",{...f(e,t),style:{width:s,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},`ann-${i}`)}case"text":{let t=At(e,i,r);if(!t)return null;let{x:n,y:o}=t,l=n+(e.dx||0),a=o+(e.dy||0),s=e.color||"var(--semiotic-text, #333)",c=Mr("text",{x:l,y:a,fill:s,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?$r.cloneElement(c,{key:`ann-text-${i}`}):Ar("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[Mr("line",{x1:n,y1:o,x2:l,y2:a,stroke:s,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),$r.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},`ann-text-${i}`)}case"frame-text":return Mr(zt,{annotation:e,width:r.width||0,height:r.height||0},`ann-frame-text-${i}`);case"category-highlight":{let t=e.category;if(null==t)return null;let n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,o=r.scales?.o,l=r.scales?.x,a=r.scales?.y,s=n(o)?o:n(l)?l:n(a)?a:null;if(!s)return null;let c=s(String(t));if(null==c)return null;let d=s.bandwidth(),h=r.projection?"vertical"===r.projection:s===l,f=e.color||"var(--semiotic-primary, #4589ff)",m=e.opacity??.15,y=e.label;return Ar("g",h?{children:[Mr("rect",{x:c,y:0,width:d,height:r.height||0,fill:f,fillOpacity:m}),y&&Mr(u,{x:c+d/2,y:16,textAnchor:"middle",fill:f,fontSize:12,fontWeight:"bold",text:y,background:e.labelBackground??"none"})]}:{children:[Mr("rect",{x:0,y:c,width:r.width||0,height:d,fill:f,fillOpacity:m}),y&&Mr(u,{x:12,y:c+d/2,dominantBaseline:"middle",fill:f,fontSize:12,fontWeight:"bold",text:y,background:e.labelBackground??"none"})]},`ann-${i}`)}default:return null}var o,l}}function It(e){return"string"==typeof e?.type?e.type:""}function Ot(e){return!!e&&"object"==typeof e&&_o.has(It(e))}function jt(e){return Vo.has(It(e))&&!function(e){return Array.isArray(e?.disable)&&e.disable.includes("connector")}(e)}function Rt(e,t,n){return Math.max(t,Math.min(n,e))}function Tt(e){return Ot(e)}function Wt(e){return"primary"===e?.emphasis||!0===e?.defensive}function Ft(e,t,n={}){if("number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations))return Math.max(0,Math.floor(n.maxAnnotations));if(!(e>0&&t>0))return 1/0;let i=n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4;return Math.max(1,Math.round(e*t/i))}function Et(e){let t,n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;let i=e?.provenance?.confidence;switch("number"==typeof i&&Number.isFinite(i)&&(t+=15*Rt(i,0,1)),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}function Dt(e){let t=e?.provenance;if(!t||"object"!=typeof t)return e;let n="string"==typeof t.source?Object.prototype.hasOwnProperty.call(Jo,t.source)?Jo[t.source]:t.source:null,i="number"==typeof t.confidence&&Number.isFinite(t.confidence)?`${Math.round(100*Math.max(0,Math.min(1,t.confidence)))}%`:null;if(!n&&!i||null!=e.label&&"string"!=typeof e.label)return e;let r=[n,i].filter(Boolean).join(" · "),o="string"==typeof e.label?e.label:"";return o.includes(`(${r})`)?e:{...e,label:o?`${o} (${r})`:`(${r})`}}function Pt(e){if(!Ht(e))return e;let t="string"==typeof e.mobileText?e.mobileText:void 0,n="string"==typeof e.shortText?e.shortText:void 0,i=t??n;return!i||"string"!=typeof e.label&&null!=e.label?e:{...e,label:i}}function Ht(e){return Ot(e)}function Bt(e,t,n,i,r){let o=e+n,l=t+i;return Math.abs(n)>Math.abs(i)?{x:n>=0?o+4:o-r.width-4,y:i<0?l-r.height:l,width:r.width,height:r.height}:{x:n>=0?o:o-r.width,y:i<0?l-r.height-4:l+4,width:r.width,height:r.height}}function Gt(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function _t(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Vt(e,t,n,i,r,o,l,a){let s=Gt(e,l),c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,i){let r=Math.max(0,i-e.x),o=Math.max(0,i-e.y),l=Math.max(0,e.x+e.width-(t-i)),a=Math.max(0,e.y+e.height-(n-i));return(r+l)*e.height+(o+a)*e.width}(s,r,o,a);for(let e of n)c+=12*_t(s,e);for(let e of i)c+=4*_t(s,e);return c}function Yt(e){let{annotations:t,context:n,defaultOffset:i=Yo,notePadding:r=Uo,markPadding:o=Xo,edgePadding:l=qo,preserveManualOffsets:a=!0,routeLongConnectors:s=!0,connectorThreshold:c=Ko,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:m,cohesion:y,audience:p}=e,g=n.width||0,b=n.height||0,x="object"==typeof m?m:{},v=x.breakpoint??480,w=!!m&&g<=v,k=w&&!1!==x.preferShortText?t.map(Pt):t,M=w&&!u?{maxAnnotations:x.maxAnnotations??("callout-list"===x.strategy?1:2),minVisible:x.minVisible??1}:u,A=d||w&&(!1!==x.progressiveDisclosure||"callout-list"===x.strategy),S=w&&!f?x.responsive??{minWidth:v}:f,$=w&&!y?x.cohesion:y;if(0===k.length||g<=0||b<=0)return k.slice();let C=[],L=function(e,t){return(e.pointNodes||[]).map(e=>{let n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,o),z=!1,N=k.map((e,t)=>{if(!Ht(e))return e;let o=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};let i=e.pointId??e.nodeId;if(null!=i&&n.pointNodes){let e=n.pointNodes.find(e=>e.pointId===i);if(e)return{x:e.x,y:e.y}}let r=e.coordinates,o=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&o){let e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){let n=o([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?At(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!o)return e;let u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};let t=ht(e);if(t)return{width:Math.max(24,t.width+10),height:Math.max(18,t.height+6)};let n="number"==typeof e.wrap?e.wrap:120,i=[...ft("string"==typeof e.title?e.title:void 0,n,7),...ft("string"==typeof e.label?e.label:void 0,n,7)],r=i.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(n,7*r)+10),height:Math.max(18,16*i.length+6)}}(!0===e.defensive?Dt(e):e);if(a&&function(e){return"number"==typeof e.dx||"number"==typeof e.dy}(e)){let t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e),n="number"==typeof e.dx?e.dx:t.dx,i="number"==typeof e.dy?e.dy:t.dy;return C.push(Gt(Bt(o.x,o.y,n,i,u),r)),e}let d=null,h=1/0;for(let e of function(e){let t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){let t=Vt(Bt(o.x,o.y,e.dx,e.dy,u),e,C,L,g,b,r,l);t<h&&(d=e,h=t)}if(!d)return e;let f=Gt(Bt(o.x,o.y,d.dx,d.dy,u),r);C.push(f);let m=Math.hypot(d.dx,d.dy),y=s&&m>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return z=!0,{...e,dx:d.dx,dy:d.dy,...y?{connector:y}:{}}}),I=z?N:k.slice(),O=I;if(h){let e=!1,t=I.map(t=>{let n=function(e){if("text"!==e.type||"string"!=typeof e.color)return e;let t="number"==typeof e.dx?e.dx:0,n="number"==typeof e.dy?e.dy:0;return Math.hypot(t,n)<8?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});O=e?t:I}{let e=!1,t=O.map(t=>{if(!0!==t?.defensive)return t;let n=Dt(t);return n!==t&&(e=!0),n});O=e?t:O}let j,R=new Set;if(M){let e="object"==typeof M?M:{},t=function(e){if(!e)return 1;let t=function(e){let t=e?.familiarity;if(!t)return 3;let n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t<=2?1.5:t>=4?.6:1}(p),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Ft(g,b,e))*t))},{deferred:i}=function(e){let{annotations:t,width:n,height:i}=e,r=Math.max(0,e.minVisible??1),o=Ft(n,i,e),l=t.map((e,t)=>({annotation:e,index:t,note:Tt(e)})),a=l.filter(e=>e.note);if(0===a.length||a.length<=o)return{visible:t.slice(),deferred:[],budget:o};let s=a.filter(e=>Wt(e.annotation)),c=a.filter(e=>!Wt(e.annotation)).sort((e,t)=>Et(t.annotation)-Et(e.annotation)||e.index-t.index),u=Math.max(0,o-s.length),d=Math.max(0,r-s.length),h=Math.min(c.length,Math.max(u,d)),f=new Set([...s.map(e=>e.index),...c.slice(0,h).map(e=>e.index)]),m=[],y=[];for(let{annotation:e,index:t,note:n}of l)!n||f.has(t)?m.push(e):y.push(e);return{visible:m,deferred:y,budget:o}}({annotations:O,width:g,height:b,...n});for(let e of i)R.add(e)}if(S){let e="object"==typeof S&&"number"==typeof S.minWidth?S.minWidth:480;if(g<=e)for(let e of O)Ht(e)&&"secondary"===e.emphasis&&R.add(e)}if(R.size>0)for(let e of O)!0===e?.defensive&&R.delete(e);return j=0===R.size?O:A?O.map(e=>R.has(e)?{...e,_annotationDeferred:!0}:e):O.filter(e=>!R.has(e)),$?function(e,t){let n=!1,i=e.map(e=>Ht(e)&&"blended"!==e.cohesion&&"layer"!==e.cohesion?(n=!0,{...e,cohesion:t}):e);return n?i:e}(j,$):j}function Ut({title:e,totalWidth:t,marginTop:n}){return e?"string"!=typeof e?Mr("foreignObject",{x:0,y:0,width:t,height:n,children:e}):Mr("text",{x:t/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)",fontFamily:"var(--semiotic-title-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-title-font-weight, bold)"},children:e}):null}function Xt(e){if(!1!==e?.interactive)return e?.style?.cursor}function qt(e){if(!e)return!1;for(let t of e)if(Xt(t))return!0;return!1}function Kt(e,t){if(!e)return;let n=t??"";e.style.cursor!==n&&(e.style.cursor=n)}function Jt(e,t){return Kt(e),qt(t)}function Qt(e,t,n){if(e){if(!t.inside||"touch"===t.pointerType)return void Kt(e);Kt(e,n(t))}}function Zt(e){let t=$r.useRef(null);$r.useEffect(()=>{e.current&&(t.current=e.current)}),$r.useEffect(()=>()=>Kt(t.current),[])}function en(e,t,n){let i=Xt(t);return i&&null!=e&&!1!==e?Mr("g",{style:{cursor:i},"data-semiotic-mark-cursor":i,children:e},n):e}function tn(){let e=Or(Zo,el,tl),[t,n]=Lr(()=>!e);return Qo(()=>{n(!0)},[]),t}function nn(){let e=Or(Zo,el,tl);return Fr(e).current}function rn(e,t){return on(e,t,2)}function on(e,t,n){if(Object.is(e,t))return!0;if(0===n)return!1;if(Array.isArray(e)&&Array.isArray(t))return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}(e,t);if(!ln(e)||!ln(t))return!1;let i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(let r of i)if(!Object.prototype.hasOwnProperty.call(t,r)||!on(e[r],t[r],n-1))return!1;return!0}function ln(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function an(e){let t=Fr(e);return rn(t.current,e)||(t.current=e),t.current}function sn({hoverPoint:e,scene:t,active:n=!0}){let i="";if(n&&e){let n=e.data??e,r="stats"in e?e.stats:void 0,o=r&&t?.find(e=>e.stats===r)||t?.find(e=>e.datum===n)||t?.find(e=>Array.isArray(e.datum)&&e.datum.includes(n)),l=o?Vi(o):n,a=r&&o&&("boxplot"===o.type||"violin"===o.type)&&Array.isArray(l)?{category:o.category,...Yi(o.stats)}:l;if(null!=a&&"object"==typeof a){let e=(Array.isArray(a)?a:[a]).map(e=>Object.entries(Yi(e)).map(([e,t])=>`${e}: ${t}`).join(", ")).filter(Boolean);i=e.length>0?`Data point: ${e.join("; ")}`:""}else i=`Data point: ${String(a)}`}return Mr("div",{"aria-live":"polite","aria-atomic":"true",style:Ai,children:i})}function cn({children:e}){let[t,n]=$r.useState(!1),i=$r.useCallback(()=>n(e=>!e),[]),r=$r.useMemo(()=>({visible:t,setVisible:n,toggle:i}),[t,i]);return Mr(nl.Provider,{value:r,children:e})}function un(){let e=$r.useContext(nl);return e?e.toggle:null}function dn({interaction:e,tableId:t,regionLabel:n,countLabel:i,summary:r,children:o,className:l=Ji}){let{isExpanded:a,containerRef:s,triggerRef:c,open:u,handleFocus:d,handleBlur:h,dismiss:f,announcement:m}=e,[y,p]=$r.useState(!1);return Mr("div",{ref:s,id:t,className:a?l:Qi,tabIndex:-1,onFocus:a?void 0:d,onBlur:a?h:void 0,style:a?Ki:y?Si:Ai,role:"region","aria-label":n,children:a?Ar(Sr,{children:[Mr("div",{role:"status","aria-atomic":"true",style:Ai,children:m}),Mr("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:f,"aria-label":"Close data summary",style:Ui,children:"×"}),r&&Mr("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Xi,children:r}),o]}):Ar("button",{ref:c,type:"button",onClick:u,onFocus:()=>p(!0),onBlur:()=>p(!1),style:qi,children:["View data summary (",i,")"]})})}function hn(){let[e,t]=$r.useState(!1),[n,i]=$r.useState(""),r=$r.useContext(nl),o=r?.visible??!1,l=e||o,a=$r.useRef(null),s=$r.useRef(null),c=$r.useRef(null),u=$r.useRef(!1),d=$r.useRef(!1),h=$r.useRef(null);il(()=>{if(l&&!d.current){let e=document.activeElement;e instanceof HTMLElement&&e!==document.body&&!a.current?.contains(e)&&(c.current=e),a.current?.focus()}else!l&&d.current&&(u.current&&(c.current?.isConnected?c.current:s.current)?.focus(),u.current=!1,c.current=null,h.current=null,i(""));d.current=l;let e=h.current;l&&e&&(e.table.querySelectorAll("tbody tr")[e.index]?.focus(),h.current=null)});let f=()=>t(!0);return{isExpanded:l,containerRef:a,triggerRef:s,open:f,handleFocus:e=>{e.target!==e.currentTarget||l||(e.relatedTarget instanceof HTMLElement&&(c.current=e.relatedTarget),f())},handleBlur:e=>{o||a.current?.contains(e.relatedTarget)||t(!1)},dismiss:()=>{u.current=!0,o&&r?.setVisible(!1),t(!1)},revealRows:(e,t,n,r,o="rows")=>{let l=e.previousElementSibling;l&&(h.current={table:l,index:t}),i(`${n} of ${r} ${o} shown.`)},announcement:n}}function fn({accessibleTable:e,children:t}){let n=tn();return"object"!=typeof e?t:n?Mr($r.Suspense,{fallback:null,children:Mr(rl,{target:e.portalTarget,children:t})}):null}function mn(e,t){if(!e||0===e.length)return`${t}, empty`;let n={};for(let t of e){if(null===t?.datum)continue;let e=String(t.type);n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return`${t}, empty`;let i=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},o=Object.keys(r),l=Object.keys(n).sort((e,t)=>{let n=o.indexOf(e),i=o.indexOf(t);return(-1===n?999:n)-(-1===i?999:i)});for(let e of l){let t=r[e]||e;i.push(`${n[e]} ${t}`)}return`${t}, ${i.join(", ")}`}function yn(e,t,n){let i=[];return e>0&&i.push(`${e} nodes`),t>0&&i.push(`${t} edges`),0===i.length?`${n}, empty`:`${n}, ${i.join(", ")}`}function pn({accessibleTable:e,...t}){return e?Ar(fn,{accessibleTable:e,children:[Mr(xn,{tableId:t.tableId}),Mr(gn,{...t})]}):null}function gn(e){let{scene:t,chartType:n,tableId:i,chartTitle:r}=e,o=hn(),l=r?`Data summary for ${r}`:i?`Data summary for ${n} ${i}`:`Data summary for ${n}`;return t&&0!==t.length?Mr(dn,{interaction:o,tableId:i,regionLabel:l,countLabel:`${Zi(t)} elements`,children:o.isExpanded&&Mr($r.Suspense,{fallback:Mr("div",{role:"status",children:"Loading data summary…"}),children:Mr(ol,{...e,revealRows:o.revealRows})})}):i?Mr("span",{id:i,tabIndex:-1,style:Ai}):null}function bn({summary:e}){return e?Mr("div",{role:"note",style:Ai,children:e}):null}function xn({tableId:e}){let[t,n]=$r.useState(!1);return Mr("a",{href:`#${e}`,style:t?Si:Ai,onClick:t=>{t.preventDefault();let n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:()=>n(!0),onBlur:()=>n(!1),children:"Skip to data table"})}function vn({active:e,hoverPoint:t,margin:n,size:i,shape:r="circle",width:o,height:l,pathData:a}){if(!e||!t)return null;let s,c=t.x+n.left,u=t.y+n.top;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=o&&null!=l){let e=Math.max(o,4),t=Math.max(l,4);s=Mr("rect",{x:c-e/2-3,y:u-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ll,strokeWidth:2,strokeDasharray:"4,2"})}else s=Mr("circle","wedge"===r?{cx:c,cy:u,r:12,fill:"none",stroke:ll,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:c,cy:u,r:8,fill:"none",stroke:ll,strokeWidth:2,strokeDasharray:"4,2"});else s=Mr("g",{transform:`translate(${n.left},${n.top})`,children:Mr("path",{d:a,fill:"none",stroke:ll,strokeWidth:2.5,strokeDasharray:"6,3"})});return Mr("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:s})}function wn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function kn(e){let t=hr(),n=Fr(t);n.current=t;let[i,r]=ze(e.sizeProp,e.responsiveWidth,e.responsiveHeight),o=r[0],l=r[1],a=zr(()=>[o,l],[o,l]),s=!!e.title,c=zr(()=>{let t=function(e,t){let n=t?36:0;return e.top>=n?e:{...e,top:n}}({...e.marginDefault,...e.userMargin},s);if(e.legend&&!e.legendMarginReserved){let n={...t},i=e.legendPosition??"right";xe(t,{legend:e.legend,position:i,size:a,hasTitle:s,legendLayout:e.legendLayout,axisChrome:e.axisChrome}),ae(t,n,a,i)}return t},[e.marginDefault,e.userMargin,e.legend,e.legendPosition,e.legendLayout,e.axisChrome,e.legendMarginReserved,s,a]),u=Math.max(1,r[0]-c.left-c.right),d=Math.max(1,r[1]-c.top-c.bottom),h=wn(e.foregroundGraphics,r,c),f=wn(e.backgroundGraphics,r,c),m=cr(e=>e.theme),{transition:y,introEnabled:p}=wr(e.animate,e.transitionProp),g=`semiotic-table-${$r.useId()}`,b=Fr(null);if(!b.current){let t=!e.suspendWhenHidden||typeof document>"u"||!document.hidden;b.current=new pi({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}let x=b.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});let v=Fr(null),w=Fr(e.frameScheduler??sl);w.current=e.frameScheduler??sl;let k=Fr(null),M=Fr(!1),A=Fr(()=>{}),S=jr(()=>{if(null!==v.current||M.current)return;let e=w.current,t=!1,n=!1,i=e.requestAnimationFrame(()=>{t=!0;let e=!n;e&&(M.current=!0),v.current=null,k.current=null;try{e?A.current():Kr(A.current)}finally{e&&(M.current=!1)}});n=!0,t||(v.current=i,k.current=e)},[]),$=jr(()=>{null!==v.current&&((k.current??w.current).cancelAnimationFrame(v.current),v.current=null,k.current=null)},[]),C=jr(()=>{null!==v.current&&($(),A.current())},[$]);al(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),Nr(()=>{if(!e.suspendWhenHidden||typeof document>"u")return void x.setVisible(!0);let t=()=>x.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[x,e.suspendWhenHidden]),Nr(()=>()=>{$()},[$]);let L=Fr(()=>{}),z=Fr(()=>{}),N=Fr({inside:!1,clientX:0,clientY:0,pointerType:void 0}),I=Fr(null),O=Fr(null),j=Fr(null),R=jr(()=>{let e=I.current;I.current=null,e&&L.current(e)},[]),T=jr(e=>{let t=N.current;if(t.inside=!0,t.clientX=e.clientX,t.clientY=e.clientY,t.pointerType=e.pointerType,I.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===O.current){let e=w.current,t=!1,n=e.requestAnimationFrame(()=>{t=!0,O.current=null,j.current=null,R()});t||(O.current=n,j.current=e)}},[R]),W=jr(()=>{null!==O.current&&((j.current??w.current).cancelAnimationFrame(O.current),O.current=null,j.current=null),R()},[R]),F=jr(()=>{N.current.inside=!1,I.current=null,W(),z.current()},[W]);Nr(()=>{if(typeof document>"u")return;let e=e=>{"Escape"===e.key&&N.current.inside&&F()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[F]),Nr(()=>()=>{I.current=null,null!==O.current&&((j.current??w.current).cancelAnimationFrame(O.current),O.current=null,j.current=null)},[]);let E=e.themeDirtyRef,D=Fr(!1);return al(()=>{if(!E)return;let t=!D.current;D.current=!0,(!t||!e.skipInitialThemeInvalidation)&&(Wi(),E.current=!0,S())},[m,e.skipInitialThemeInvalidation,S,E]),Nr(()=>{if(E)return Fi(()=>i.current,()=>{E.current=!0,S()})},[i,S,E]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:i,size:r,margin:c,adjustedWidth:u,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:m,transition:y,introEnabled:p,tableId:g,frameRuntime:x,rafRef:v,renderFnRef:A,scheduleRender:S,cancelRender:$,flushRender:C,hoverHandlerRef:L,hoverLeaveRef:z,onPointerMove:T,flushPointerMove:W,onPointerLeave:F,pointerStateRef:N}}function Mn(e,t,n){let i=Math.round(t[0]*n),r=Math.round(t[1]*n),o=0===t[0]?n:i/t[0],l=0===t[1]?n:r/t[1],a=`${t[0]}px`,s=`${t[1]}px`;e.style.width!==a&&(e.style.width=a),e.style.height!==s&&(e.style.height=s);let c=e.width!==i||e.height!==r;return e.width!==i&&(e.width=i),e.height!==r&&(e.height=r),{effectiveDprX:o,effectiveDprY:l,resized:c}}function An(){if(!(typeof window>"u"||"function"!=typeof window.matchMedia))return Zr!==window.matchMedia&&(Zr=window.matchMedia,Qr=window.matchMedia("(pointer: coarse)")),Qr}function Sn(e,t,n,i){let r=e.getContext("2d");if(!r)return null;let{effectiveDprX:o,effectiveDprY:l}=Mn(e,t,i);return r.setTransform(o,0,0,l,0,0),r.translate(n.left,n.top),r}function $n(e,t){if(typeof window>"u")return 1;let n=window.devicePixelRatio||1,i=typeof window>"u"||!(!0===An()?.matches||Math.min(window.innerWidth||1/0,window.innerHeight||1/0)<768)?3:2,r="number"==typeof e&&e>0?e:i;if(!t)return Math.max(1,Math.min(n,r));let[o,l]=t,a=Math.min(Math.sqrt(8388608/(o*l)),16384/Math.max(o,l));return Math.max(a<1?0:1,Math.min(n,r,a))}function Cn(e,t){return function(e){let{cancelRender:t,dirtyRef:n,frameRuntime:i,manageFrameRuntime:r,maxDevicePixelRatio:o,scheduleRender:l}=e,a=Fr(null),s=Fr(null),c=Fr(!1),u=Fr(!1),d=Fr(!1);return cl(()=>{if(!e.size)return;let t=$n(o,e.size);for(let n of[a.current,s.current])n&&Mn(n,e.size,t)},[e.size?.[0],e.size?.[1],o,e.hydrated]),cl(()=>{!u.current&&(u.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.canvasPaintInvalidator?e.canvasPaintInvalidator():e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),function(e){let{hydrated:t,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:o,cancelRender:l,flushRender:a,cleanup:s}=e;Qo(()=>{t&&n&&(i.current?.cancelIntroAnimation?.(),r.current=!0,l?.(),o.current())},[t,n]);let c=Fr(a);c.current=a;let[u,d]=Lr(!1);Qo(()=>{!n&&c.current&&d(!0)},[n]),Qo(()=>{u&&c.current?.()},[u]);let h=Fr(s);h.current=s,Nr(()=>()=>h.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,flushRender:e.flushRender,cleanup:e.cleanup}),Nr(()=>{if(!1!==r)return i.subscribe(()=>{i.isActive?(n.current=!0,l()):t()})},[t,n,i,r,l]),Nr(()=>function(e){function t(){i||(n(),r=$n(),e(),queueMicrotask(()=>{i||o()}))}if(typeof window>"u")return()=>{};let n=()=>{},i=!1,r=0,o=()=>{if("function"!=typeof window.matchMedia)return;let e=`(resolution: ${window.devicePixelRatio||1}dppx)`,i=window.matchMedia(e);i.media.includes("resolution")&&(n=fr(i,t))};o(),r=$n();let l=An(),a=()=>{if(i)return;let t=$n();t!==r&&(r=t,e())};window.addEventListener("resize",a);let s=fr(l,a);return()=>{i=!0,window.removeEventListener("resize",a),s(),n()}}(()=>{c.current=!0,l()}),[l]),Nr(()=>{d.current?(c.current=!0,l()):d.current=!0},[o,l]),{canvasRef:a,interactionCanvasRef:s,resolutionDirtyRef:c}}({...t,size:e.size,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,flushRender:e.flushRender,frameRuntime:e.frameRuntime})}function Ln({children:e,size:t,margin:n,backdropFill:i,overflowVisible:r=!1}){return e||i?Ar("svg",{role:"presentation",style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:[i&&"transparent"!==i?Mr("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:t[0],height:t[1],fill:i}):null,Mr("g",{transform:`translate(${n.left},${n.top})`,children:e})]}):null}function zn({x:e,y:t,containerWidth:n,containerHeight:i,margin:r,children:o,contentOwnsChrome:l=!1,className:a="stream-frame-tooltip",zIndex:s=1}){let c=mr(),u=Number.isFinite(e)&&Number.isFinite(t),d=nr(o),h=$r.useRef(null),f="none"===c||l||rr(o),m=yr(h,!f&&u&&d),y=f||m,[p,g]=$r.useState(null);$r.useLayoutEffect(()=>{let e=h.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=getComputedStyle(e),i=parseFloat(n.width)||t.width,r=parseFloat(n.height)||t.height;!Number.isFinite(i)||!Number.isFinite(r)||g(e=>e&&e.ownsChrome===y&&Math.abs(e.width-i)<.5&&Math.abs(e.height-r)<.5?e:{width:i,height:r,ownsChrome:y})};if(t(),typeof ResizeObserver>"u")return;let n=new ResizeObserver(()=>Kr(t));return n.observe(e),()=>n.disconnect()},[a,n,i,u,d,y]);let b,x=$r.useRef(null),v=p?.ownsChrome===y?p:null,w=e,k=t,M=!1,A=!1;if(v){let r=i-t;M=n-e<v.width+12,A=r<v.height+12,w=Math.max(0,Math.min(e+(M?-v.width-12:12),n-v.width)),k=Math.max(0,Math.min(t+(A?-v.height-4:4),i-v.height)),b="none"}else b=`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${t<.3*i?"4px":"calc(-100% - 4px)"})`;let S=v?{flipX:M,flipY:A}:null,$=x.current,C=!S||!$||$.flipX!==S.flipX||$.flipY!==S.flipY;$r.useLayoutEffect(()=>{x.current=S});let L=y?null:pr,z=y?a:`${a} semiotic-tooltip`.trim();return u&&d?Mr("div",{ref:h,className:z,"data-placement":S?"placed":"pending","data-flip-x":M?"true":"false","data-flip-y":A?"true":"false",style:{...L||{},position:"absolute",left:r.left+w,top:r.top+k,transform:b,...C&&{transition:"none"},pointerEvents:"none",zIndex:s,width:"max-content",maxWidth:y?n:`min(${n}px, ${pr.maxWidth})`,boxSizing:"border-box"},children:o}):null}function Nn(e){return"touch"===e?"touch":"pointer"}function In(e){let t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function On(e){let{onObservation:t,datum:n,x:i=0,y:r=0,chartType:o,chartId:l,context:a,timestamp:s=Date.now()}=e;if(t){if(!n)return void t({type:"hover-end",timestamp:s,chartType:o,chartId:l});t({type:"hover",datum:n,x:i,y:r,timestamp:s,chartType:o,chartId:l}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:s,chartType:o,chartId:l})}}function jn(e){let{onObservation:t,datum:n,x:i=0,y:r=0,chartType:o,chartId:l,context:a,timestamp:s=Date.now()}=e;if(t){if(!n)return void t({type:"click-end",timestamp:s,chartType:o,chartId:l});t({type:"click",datum:n,x:i,y:r,timestamp:s,chartType:o,chartId:l}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:s,chartType:o,chartId:l})}}function Rn(e,t,n){return{width:n?.responsiveWidth?"100%":e,height:n?.responsiveHeight?"100%":t}}function Tn({componentName:e,width:t,height:n,children:i}){return Mr(fo,{fallback:i=>Mr(D,{componentName:e,message:i.message,width:t,height:n}),children:i})}function Wn(e,t,n,i,r){return!1===i||null==e||!Array.isArray(e)||e.some(e=>null!=e&&"object"==typeof e)?null:Mr("div",{style:{...ul,...Rn(t,n,r)},children:i||"No data available"})}function Fn(e,t,n,i,r){if(!e||!1===i)return null;if(null!=i)return Mr("div",{style:{...Rn(t,n,r),display:"flex",flexDirection:"column",alignItems:"stretch",textAlign:"center",justifyContent:"center",boxSizing:"border-box"},children:i});let o=Math.max(1,Math.min(5,Math.floor(n/40))),l=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(l+a)-a))/2),c=e=>r?.responsiveHeight?100*e/Math.max(1,n)+"%":e,u=Array.from({length:o},(e,t)=>Mr("div",{className:"semiotic-loading-bar",style:{...dl,position:"absolute",top:c(s+t*(l+a)),left:"10%",width:30+(37*t+13)%50+"%",height:c(l),opacity:.5+t%2*.2}},t));return Mr("div",{style:{...Rn(t,n,r),position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:u})}function En(e,t,n,i){if("production"===process.env.NODE_ENV||!t||0===t.length||"string"!=typeof i)return;let r=t[0];if(!r||"object"!=typeof r||i in r)return;let o=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${i}" not found in data. Available keys: ${o}`)}function Dn(e,t={}){let n=t.mobileSemantics?.interaction,i="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&t.width<=480,o=!!n||void 0!==i,l=e&&"object"==typeof e?e:void 0;if(!1===e||!1===l?.enabled||void 0===e&&!r&&!o)return hl;let a=l??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??i??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}function Pn(e,t,n){let i=fl[e||"primary"],r=e&&"primary"!==e||!n?.width?i.width:n.width,o=e&&"primary"!==e||!n?.height?i.height:n.height,l=Q({...t,mode:e},{width:t.width??r,height:t.height??o}).props,a=l.mode||e||"primary",s=fl[a],c="context"===a||"sparkline"===a,u="primary"===a&&n?.width?n.width:s.width,d="primary"===a&&n?.height?n.height:s.height;return{mode:a,width:l.width??u,height:l.height??d,showAxes:l.showAxes??s.showAxes,showGrid:l.showGrid??s.showGrid,enableHover:l.enableHover??(!!l.linkedHover||s.enableHover),showLegend:l.showLegend??s.showLegend,showLabels:l.showLabels??s.showLabels,title:c?void 0:l.title,description:l.description,summary:l.summary,accessibleTable:l.accessibleTable,xLabel:c?void 0:l.xLabel,yLabel:c?void 0:l.yLabel,categoryLabel:c?void 0:l.categoryLabel,valueLabel:c?void 0:l.valueLabel,marginDefaults:Bn(s.marginDefaults,l.showCategoryTicks,l.orientation),compactMode:c,mobileInteraction:Dn(l.mobileInteraction,{mode:a,width:l.width??u,mobileSemantics:l.mobileSemantics}),mobileSemantics:l.mobileSemantics}}function Hn(e){return e.compactMode?e.marginDefaults:ml}function Bn(e,t,n){if(!1!==t)return e;let i={...e};return"horizontal"===n?i.left=Math.min(i.left,15):i.bottom=Math.min(i.bottom,15),i}function Gn({data:e,colorBy:t,colorScale:n,getColor:i,strokeColor:r,strokeWidth:o,categories:l}){let a=(void 0!==l?l:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,o)=>{let l="function"==typeof t?e.find(e=>t(e)===r):e.find(e=>e[t]===r),a=l?i(l,t,n):n?n(r):Ni[o%Ni.length];return{label:String(r),color:a,__semioticCategory:!0}});return{legendGroups:[{styleFn:e=>{let t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==o&&(n.strokeWidth=o),n},type:"fill",items:a,label:""}]}}function _n(e,t){if(!t)return[];let n=new Set;for(let i of e){let e="function"==typeof t?t(i):i[t];null!=e&&n.add(String(e))}return Array.from(n)}function Vn(e,t){return null!=e&&Object.hasOwn(e,t)}function Yn({data:e,colorBy:t,colorScale:n,showLegend:i,legendPosition:r,userMargin:o,defaults:l={top:50,bottom:60,left:70,right:40},categories:a,additionalLegend:s,chartWidth:c,chartHeight:u,legendLayout:d,frameLegend:h,hasTitle:f=!1,axisChrome:m}){let{legendPosition:y,legendLayout:p}=function(e,t,n){let i=Vn(n,"legendPosition"),r=Vn(n,"legendLayout");return{legendPosition:i?n?.legendPosition??"right":e??"right",legendLayout:r?n?.legendLayout:t}}(r,d,h),g=Vn(h,"legend"),b=Ir(Mo),x=Re(),v=void 0!==i?i:!b&&!!t,w=!!t&&(v||x),k=zr(()=>w?void 0!==a?a:_n(e,t):[],[a,t,e,w]);je(x&&t?k:[],n);let M=zr(()=>{if(!v||!t)return;let i=Gn({data:e,colorBy:t,colorScale:n,getColor:Ii,categories:k});return 0!==i.legendGroups.reduce((e,t)=>e+t.items.length,0)?i:void 0},[v,t,e,n,k]),A=zr(()=>g?h?.legend:re(M,s),[M,s,h?.legend,g]),{hasAxis:S,hasAxisLabel:$,rotatedTicks:C,topAxis:L,leftAxis:z,rightAxis:N}=m??{},I=void 0!==L,O=void 0!==z,j=void 0!==N,{hasAxis:R,hasAxisLabel:T,rotatedTicks:W}=L??{},{hasAxis:F,hasAxisLabel:E}=z??{},{hasAxis:D,hasAxisLabel:P}=N??{},H=zr(()=>{let e="number"==typeof o?{top:o,bottom:o,left:o,right:o}:o??{},t=we(l,h?.axes,f),n=n=>{let i=e[n];return"number"==typeof i?i:t[n]},i={top:n("top"),right:n("right"),bottom:n("bottom"),left:n("left")},r={...i};return A&&(xe(i,{legend:A,position:y,size:[c??600,u??400],hasTitle:f,legendLayout:p,minimumMargin:"bottom"===y?80:"top"===y?50:0,axisChrome:void 0===S?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:S,hasAxisLabel:$,rotatedTicks:C,topAxis:I?{hasAxis:R,hasAxisLabel:T,rotatedTicks:W}:void 0,leftAxis:O?{hasAxis:F,hasAxisLabel:E}:void 0,rightAxis:j?{hasAxis:D,hasAxisLabel:P}:void 0}}),null!=c&&null!=u&&ae(i,r,[c,u],y)),i},[l,h?.axes,o,A,y,c,u,p,f,S,$,C,I,R,T,W,O,F,E,j,D,P]);return{legend:A,margin:H,legendPosition:y,legendLayout:p,legendMarginReserved:void 0!==A&&!Vn(h,"margin"),hasAutomaticLegend:void 0!==M}}function Un(e){let t=e.valueRange;return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]?[t[0],t[1]]:null}function Xn(e,t){return"string"==typeof e.interactionKey?e.interactionKey:`${t[0]}:${t[1]}`}function qn(e,t,n,i=!0,r=!1){let[o,l]=Lr(null),[a,s]=Lr(new Set),c=zr(()=>new Set,[]),u=zr(()=>new Set(n),[n]),d=null!=o&&u.has(o)?o:null,h=zr(()=>{if(0===a.size)return a;let e=new Set(Array.from(a).filter(e=>u.has(e)));return 0===e.size||e.size===u.size?c:e.size===a.size?a:e},[u,c,a]);Nr(()=>{(!i||!t||!e||"none"===e)&&(l(null),s(e=>0===e.size?e:new Set))},[t,i,e]),Nr(()=>{l(e=>null==e||u.has(e)?e:null),s(e=>{if(0===e.size)return e;let t=new Set(Array.from(e).filter(e=>u.has(e)));return 0===t.size||t.size===u.size?new Set:t.size===e.size?e:t})},[u]);let f=jr(t=>{!i||"highlight"!==e||l(!t||!u.has(t.label)||r&&!0!==t.__semioticCategory?null:t.label)},[u,i,e,r]),m=jr(t=>{!i||"isolate"!==e||!u.has(t.label)||r&&!0!==t.__semioticCategory||s(e=>{let n=new Set(Array.from(e).filter(e=>u.has(e)));return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===u.size?new Set:n})},[u,i,e,r]),y=zr(()=>{if(!i||!e||"none"===e||!t)return null;let n=e=>{let n="function"==typeof t?t(e):e[t];return"string"==typeof n?n:String(n)};return"highlight"===e&&null!=d?{isActive:!0,predicate:e=>n(e)===d}:"isolate"===e&&h.size>0?{isActive:!0,predicate:e=>h.has(n(e))}:null},[t,i,e,d,h]);return{highlightedCategory:i&&"highlight"===e?d:null,isolatedCategories:i&&"isolate"===e?h:c,onLegendHover:f,onLegendClick:m,legendSelectionHook:y}}function Kn(e,t,n,i=5){let[r,o]=n,[l,a]=Lr(null),[s,c]=Lr(new Map),u=zr(()=>new Set,[]);Nr(()=>{a(null),c(new Map)},[r,o,i,e]);let d=jr(t=>{if("highlight"!==e||!t)return void("highlight"===e&&a(null));let n=Un(t);n&&a({key:Xn(t,n),range:n})},[e]),h=jr(t=>{if("isolate"!==e)return;let n=Un(t);n&&c(e=>{let r=new Map(e),o=Xn(t,n);return r.has(o)?r.delete(o):r.set(o,n),r.size===i?new Map:r})},[i,e]),f=zr(()=>{let n="highlight"===e&&l?[l.range]:"isolate"===e?[...s.values()]:[];return 0===n.length?null:{isActive:!0,predicate:e=>{let i=t(e);return Number.isFinite(i)&&n.some(([e,t])=>i>=Math.min(e,t)&&i<=Math.max(e,t))}}},[l,s,e,t]);return{highlightedCategory:"highlight"===e?l?.key??null:null,isolatedCategories:"isolate"===e?new Set(s.keys()):u,onLegendHover:d,onLegendClick:h,legendSelectionHook:f}}function Jn(e,t,n){let i=e.xValue??t?.[n];if(null==i)return null;let r=Number(i);return Number.isFinite(r)?r:null}function Qn(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?br({...t,xValue:e.xValue},xr(t)):t||{}}function Zn(e){if(!e)return!1;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function ei(){let e=gr()?.colors?.categorical;return e&&e.length>0?e:void 0}function ti(){return gr()?.colors?.sequential||void 0}function ni(){return gr()?.colors?.diverging||void 0}function ii(e,t,n){let i=B(null!=n),r=ei();return zr(()=>{if(!t)return;let o=i??void 0,l=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){let n=Array.from(new Set(e.map(e=>String(t(e)))));if(o&&Zn(o)){let e=n.map(e=>({_cat:e})),t=Oi(e,"_cat",l);return e=>Li(o,e)??t(e)}let i=n.map(e=>({_cat:e}));return Oi(i,"_cat",l)}if(o&&Zn(o)){let n=Oi(e,t,l);return e=>Li(o,e)??n(e)}return Oi(e,t,l)}if(o&&Zn(o)){let e=Oi([{_:"a"}],"_",l);return t=>Li(o,t)??e(t)}},[e,t,n,i,r])}function ri(e,t,n){return zr(()=>{if(!t||"auto"===t||"function"==typeof t)return e;let i=[...e],r="function"==typeof(o=n)?o:e=>e[o];var o;return"asc"===t?i.sort((e,t)=>r(e)-r(t)):i.sort((e,t)=>r(t)-r(e))},[e,t,n])}function oi({selection:e,linkedHover:t,fallbackFields:n=yl,unwrapData:i=!1,onObservation:r,chartType:o,chartId:l,onClick:a,hoverHighlight:s,hoverHighlightField:c,colorByField:u,mobileInteraction:d,emitObservations:h=!0}){let f=Tr(),m=w(),{setCrosshairPosition:y,clearCrosshairPosition:p,toggleCrosshairLock:g,unlockCrosshair:b}=m,x=Fr(m);x.current=m;let v=zr(()=>gi(t,n),[t,n]),k=zr(()=>"series"===v?.mode?[v.seriesField||u||n[0]].filter(e=>!!e):v?.fields||n,[v,u,n]),M=_({name:e?.name||"__unused__",fields:k}),A=Y({name:v?.name||"hover",fields:k}),S=er(e=>e.pushObservation),$=jr(e=>{r?.(e),S?.(e)},[r,S]),C=e?{isActive:M.isActive,predicate:M.predicate}:null,[L,z]=Lr(null),N=Fr(!1),I=c||u||n[0],O=zr(()=>{if(!s||null==L||!I)return null;let e=L,t=I;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:String(n[t]??""))===e}},[s,L,I]),j=jr((e,n)=>{let i=!e&&N.current&&!!d?.enabled&&d.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===v?.mode&&v.xField){let n=Jn(e,t,v.xField);null!=n&&y(v.name||"hover",n,f)}"x-position"!==v?.mode&&A.onHover(t)}else"x-position"===v?.mode&&!i&&p(v.name||"hover",f),"x-position"!==v?.mode&&!i&&A.onHover(null);if(s&&I)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);let n=t?.[I];z(null!=n?String(n):null)}else i||z(null);h&&(r||S)&&On({onObservation:$,datum:e?Qn(e):null,x:e?.x,y:e?.y,chartType:o||"unknown",chartId:l,context:n})},[t,A,v,f,r,o,l,S,$,h,s,I,d,y,p]),R=jr((n=!0)=>{N.current=!1,t&&"x-position"!==v?.mode&&A.onHover(null),e&&d?.tapToSelect&&M.clear(),n&&s&&z(null),"x-position"===v?.mode&&(b(v.name||"hover",f),p(v.name||"hover",f))},[t,v,A,e,d,M,s,f,p,b]),T=jr((n,i)=>{let c=!!d?.enabled&&(d.tapToLockTooltip||d.tapToSelect),u=!!d?.enabled&&"backgroundTap"===d.clearSelection;if("x-position"===v?.mode&&v.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);let t=Jn(n,e,v.xField);null!=t&&g(v.name||"hover",t,f)}if(c)if(n){N.current=!0;let i=Qn(n);if(t&&"x-position"!==v?.mode&&A.onHover(i),e&&d?.tapToSelect&&k.length>0){let e=vr(i,k);Zn(e)&&M.selectPoints(e)}if(s&&I){let e=i?.[I];z(null!=e?String(e):null)}}else u&&R();if(n||u){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}h&&(r||S)&&jn({onObservation:$,datum:n?Qn(n):null,x:n?.x,y:n?.y,chartType:o||"unknown",chartId:l,context:i})}},[a,h,r,S,$,o,l,v,f,d,t,A,e,M,k,s,I,R,g]);Nr(()=>{if(!d?.enabled||typeof document>"u")return;let e=e=>{"Escape"===e.key&&N.current&&R()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[d?.enabled,R]);let W=Fr(R);return W.current=R,Nr(()=>()=>{N.current&&W.current(!1)},[]),Nr(()=>{if("x-position"!==v?.mode)return;let e=v.name||"hover";return()=>{x.current.releaseCrosshair(e,f)}},[v?.mode,v?.name,f]),{activeSelectionHook:C,hoverSelectionHook:O,customHoverBehavior:j,customClickBehavior:T,crosshairSourceId:f}}function li(e,t){let n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function ai(e,t,n){return Pn(e,t,n)}function si(e,t="#4e79a7"){return Ei(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function ci(e){let t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?`s_${t}`:t}function ui(e,t,n,i){let r=e.glyph;if(!r?.parts?.length||e.size<=0)return null;let o=Hi(r,e.size);if(o.scale<=0)return null;let l=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${o.offsetX},${o.offsetY}) scale(${o.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),s=Bi(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=s?ci(`${i}-clip`):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>r.parts.map((n,i)=>{let r=t?"none"===n.fill?void 0:t:Gi(n.fill,a,e.accent),o=t?n.stroke&&"none"!==n.stroke?t:void 0:Gi(n.stroke??"none",a,e.accent);return r||o?Mr("path",{d:n.d,fill:r??"none",stroke:o,strokeWidth:o?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},i):null});return Ar("g",{transform:l,opacity:1===u?void 0:u,children:[s&&c&&Mr("clipPath",{id:c,children:Mr("rect",{x:s.x,y:s.y,width:s.width,height:s.height})}),s&&e.ghostColor?Mr("g",{children:d(e.ghostColor)}):null,s&&c?Mr("g",{clipPath:`url(#${c})`,children:d()}):d()]},i)}function di(e,t){let n=e.filter(e=>Number.isFinite(e.offset)&&(null==e.opacity||Number.isFinite(e.opacity))).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color??t,opacity:null==e.opacity?void 0:Math.max(0,Math.min(1,e.opacity))}));return n.length<2?null:n.map((e,t)=>Mr("stop",{offset:e.offset,stopColor:e.color,stopOpacity:e.opacity},t))}function hi(e,t){let n=e.fillGradient;if(!n||"object"!=typeof n)return null;let i=e.x,r=e.y,o=e.x,l=e.y+e.h;"bottom"===e.roundedEdge?(r=e.y+e.h,l=e.y):"right"===e.roundedEdge?(i=e.x+e.w,r=e.y,o=e.x,l=e.y):"left"===e.roundedEdge&&(i=e.x,r=e.y,o=e.x+e.w,l=e.y);let a=di(n.stops,si(e.style.fill));return a?Mr("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:o,y2:l,children:a}):null}function fi(e){let{x:t,y:n,w:i,h:r}=e,{tl:o,tr:l,br:a,bl:s}=Di(e),c=`M${t+o},${n}`;return c+=` L${t+i-l},${n}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t+i},${n+l}`),c+=` L${t+i},${n+r-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+i-a},${n+r}`),c+=` L${t+s},${n+r}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t},${n+r-s}`),c+=` L${t},${n+o}`,o>0&&(c+=` A${o},${o} 0 0 1 ${t+o},${n}`),c+=" Z",c}function mi(e,t,n){let i=_i(e.symbolType,e.size,e.path),r=e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`;return Mr("path",{d:i,transform:r,fill:e.style.fill?si(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}function yi(e,t,n){let i="point"===e.type,r=i?"circle":"rect",o=i?{cx:e.x,cy:e.y,r:e.r}:{x:e.x,y:e.y,width:e.w,height:e.h},l=`${n?`${n}-`:""}${i?"point":"xyrect"}-${t}-hatch`;if(!i&&e.fillBands&&e.fillBands.length>0)return function(e,t,n){let i=e.y,r=e.y+e.h,o=[],l=[];e.fillBands.forEach((t,a)=>{let s,c=Math.max(Math.min(t.y0,t.y1),i),u=Math.min(Math.max(t.y0,t.y1),r);if(u>c){if(Ei(t.fill)){let e=`${n}-band-${a}`;o.push(Pi(t.fill,e)),s=`url(#${e})`}else s=si(t.fill);l.push(Mr("rect",{x:e.x,y:c,width:e.w,height:u-c,fill:s},a))}});let a=e.style.stroke&&"none"!==e.style.stroke;return Ar("g",{opacity:e.style.opacity,children:[o.length>0&&Mr("defs",{children:o}),l,a&&Mr("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},`rect-${t}`)}(e,t,l);let a=Ei(e.style.fill)?Pi(e.style.fill,l):void 0;return Ar($r.Fragment,{children:[a&&Mr("defs",{children:a}),$r.createElement(r,{...o,fill:a?`url(#${l})`:si(e.style.fill),opacity:i?e.style.opacity??e.style.fillOpacity??.8:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},`${e.type}-${t}`)}import{b as pi,c as gi}from"./c-KLJDKRD5.min.js";import{b as bi,e as xi,d as vi,c as wi,f as ki,a as Mi}from"./c-GHJ27Q4I.min.js";import{a as Ai,b as Si}from"./c-WUAFPLTD.min.js";import{b as $i}from"./c-SIQVOV6A.min.js";import{m as Ci,s as Li,o as zi,p as Ni,r as Ii,t as Oi}from"./c-WPL6PGP3.min.js";import{g as ji,l as Ri,n as Ti,d as Wi,b as Fi,i as Ei,x as Di,k as Pi}from"./c-BJKGYOPX.min.js";import{d as Hi,h as Bi,f as Gi,a as _i}from"./c-ELGOCAEY.min.js";import{b as Vi,a as Yi,l as Ui,k as Xi,i as qi,j as Ki,g as Ji,f as Qi,d as Zi}from"./c-LYPOBMKC.min.js";import{o as er,w as tr,s as nr,v as ir,z as rr,y as or,C as lr,A as ar,k as sr,m as cr,B as ur,n as dr,q as hr,p as fr,u as mr,x as yr,t as pr,D as gr}from"./c-TC47SNSI.min.js";import{a as br,b as xr,i as vr}from"./c-5PCO2P5Q.min.js";import{e as wr}from"./c-I4BEWAKT.min.js";import{a as kr}from"./c-GRTKU3C7.min.js";import{jsx as Mr,jsxs as Ar,Fragment as Sr}from"react/jsx-runtime";import*as $r from"react";import{createContext as Cr,useState as Lr,useMemo as zr,useEffect as Nr,useContext as Ir,useSyncExternalStore as Or,useCallback as jr,Component as Rr,useId as Tr,useLayoutEffect as Wr,useRef as Fr,memo as Er}from"react";import{packEnclose as Dr}from"d3-hierarchy";import{curveCatmullRom as Pr,curveCardinal as Hr,curveBasis as Br,curveStepBefore as Gr,curveStepAfter as _r,curveStep as Vr,curveMonotoneY as Yr,curveMonotoneX as Ur,curveLinear as Xr,area as qr}from"d3-shape";import{flushSync as Kr}from"react-dom";var Jr,Qr,Zr,eo={fresh:1,aging:1.5,stale:3},to=/^\s*var\(\s*--[^,)\s]+\s*(?:,\s*([\s\S]*))?\)\s*$/,no="var(--semiotic-bg, #ffffff)",io=/*#__PURE__*/Cr(null),ro=/*#__PURE__*/new Map,oo=()=>ro,lo=()=>()=>{},ao=["name","label","title"],so=["type","kind","category","group","class","status","role","shape"],co=["value","amount","total","count","weight","score"],uo=/*#__PURE__*/new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]),ho=!1,fo=class extends Rr{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){let{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:Mr(D,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},mo=/*#__PURE__*/Cr(null),yo=/*#__PURE__*/Cr(null),po=/*#__PURE__*/P(function({colors:e,categories:t,colorScheme:n="category10",children:i}){let r=zr(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){let e=n,i=0;return Object.fromEntries(t.map(t=>[t,Li(e,t)??Ci[i++%Ci.length]]))}let e=Array.isArray(n)?n:zi(n,void 0);return Object.fromEntries(t.map((t,n)=>[t,e[n%e.length]]))}return{}},[e,t,n]);return Mr(yo.Provider,{value:r,children:Mr(mo.Provider,{value:r,children:i})})},"CategoryColorProvider"),go={fontFamily:"var(--semiotic-legend-font-family, var(--semiotic-font-family, sans-serif))",fontWeight:"var(--semiotic-legend-font-weight, normal)"},bo={fontSize:"var(--semiotic-legend-font-size, 12px)"},xo=34,vo=70,wo=e=>e.legendGroup.items.map((t,n)=>$e(e,t,n,`translate(0,${n*e.metrics.rowHeight})`,!1)),ko=typeof window>"u"?Nr:Wr,Mo=/*#__PURE__*/Cr(!1),Ao=/*#__PURE__*/Cr(!1),So=/*#__PURE__*/Cr(null),$o=typeof window>"u"?Nr:Wr,Co="__linked-legend-isolate__",Lo="__linked-legend-highlight__",zo=Object.freeze([]),No=typeof window>"u"||typeof document>"u",Io={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"},Oo=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Je({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){let n=Je(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(let e of[...this.listeners])e();return n}},jo={sceneGeometry:0,layout:0,domain:0},Ro="production"!==process.env.NODE_ENV,To={revisions:jo,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Wo=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=jo,this.lastObserved=jo,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Ro&&(this.lastObserved=Ze(this.lastObserved,Qe(e)))}beforeCompute(e,t){if(!Ro)return To;let n=Ze(Qe(e),this.lastObserved),i=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!function(e,t){return e.sceneGeometry===t.sceneGeometry&&e.layout===t.layout&&e.domain===t.domain}(n,this.lastConsumed);return{revisions:n,signature:i,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==i}}afterCompute(e,t,n){if(Ro){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Fo=/*#__PURE__*/Er(function({store:e,diagnostics:t}){return Nr(()=>{let n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),Eo={secondary:0,primary:3},Do=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}",Po=/*#__PURE__*/new Set(["top-left","top-center","top-right","middle-left","center","middle-right","bottom-left","bottom-center","bottom-right"]),Ho={fill:"var(--semiotic-text, #333)",fontSize:11,fontFamily:"inherit"},Bo={linear:Xr,monotoneX:Ur,monotoneY:Yr,step:Vr,stepAfter:_r,stepBefore:Gr,basis:Br,cardinal:Hr,catmullRom:Pr},Go=["label","callout","callout-circle","callout-rect"],_o=/*#__PURE__*/new Set(["label","callout","callout-circle","callout-rect","text","widget"]),Vo=/*#__PURE__*/new Set(Go),Yo=32,Uo=6,Xo=4,qo=8,Ko=72,Jo={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"},Qo=typeof window<"u"?Wr:Nr,Zo=()=>()=>{},el=()=>!1,tl=()=>!0,nl=/*#__PURE__*/$r.createContext(null),il=typeof window>"u"?$r.useEffect:$r.useLayoutEffect,rl=/*#__PURE__*/$r.lazy(()=>import("./c-E4JDJH4I.min.js")),ol=/*#__PURE__*/$r.lazy(()=>import("./c-OXV4W7YX.min.js")),ll="var(--semiotic-focus, #005fcc)",al=typeof window>"u"?Nr:Wr,sl={requestAnimationFrame:e=>(typeof window>"u"?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>(typeof window>"u"?globalThis:window).cancelAnimationFrame(e)},cl=typeof window>"u"?Nr:Wr,ul={display:"flex",alignItems:"stretch",flexDirection:"column",textAlign:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},dl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2},hl={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1},fl={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}},ml={top:10,bottom:10,left:10,right:10},yl=[],pl={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};export{hi as $,nt as A,c as B,u as C,d as D,h as E,f as F,m as G,$t as H,Do as I,st as J,Nt as K,It as L,Ot as M,jt as N,Rt as O,Ft as P,Yt as Q,w as R,k as S,M as T,Ut as U,pl as V,si as W,ci as X,ui as Y,di as Z,fi as _,zo as a,Tn as a$,ze as aA,kn as aB,Mn as aC,Sn as aD,$n as aE,Cn as aF,Ln as aG,$ as aH,C as aI,S as aJ,I as aK,O as aL,j as aM,R as aN,T as aO,W as aP,F as aQ,E as aR,zn as aS,Nn as aT,In as aU,On as aV,jn as aW,P as aX,D as aY,fo as aZ,Wn as a_,mi as aa,yi as ab,Xt as ac,qt as ad,Kt as ae,Jt as af,Qt as ag,Zt as ah,en as ai,tn as aj,nn as ak,rn as al,an as am,sn as an,dn as ao,cn as ap,un as aq,hn as ar,fn as as,mn as at,yn as au,pn as av,gn as aw,bn as ax,xn as ay,vn as az,qe as b,ei as bA,ti as bB,ni as bC,ii as bD,ri as bE,oi as bF,li as bG,ai as bH,Fe as bI,Ee as bJ,De as bK,He as bL,Be as bM,Ge as bN,_e as bO,Ve as bP,Ye as bQ,Ue as bR,Xe as bS,Fn as ba,En as bb,B as bc,po as bd,G as be,_ as bf,V as bg,Y as bh,X as bi,q as bj,J as bk,Q as bl,Dn as bm,Pn as bn,Hn as bo,ee as bp,Z as bq,Ne as br,je as bs,Re as bt,We as bu,Gn as bv,_n as bw,Yn as bx,qn as by,Kn as bz,eo as c,e as d,t as e,n as f,i as g,r as h,o as i,l as j,No as k,Oo as l,et as m,tt as n,Fo as o,ne as p,ie as q,re as r,ae as s,de as t,me as u,ye as v,pe as w,be as x,xe as y,we as z};
|
package/dist/c-WDVYLMCM.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as registerBuiltInXYPlugins}from"./c-HFQ3Z65X.min.js";import"./c-NOME4L5M.min.js";import"./c-NGMMPKNJ.min.js";
|
package/dist/c-XEACLH4B.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,b as t}from"./c-DEWMXCOF.min.js";import{c as r,b as i,d as n}from"./c-6X7RO4GU.min.js";import{a as s}from"./c-WC7UNQPQ.min.js";import{a as o}from"./c-TSMTCW2K.min.js";import{b as a,c as l}from"./c-PTFHNN34.min.js";import{a as c}from"./c-FBV4S363.min.js";import{a as d}from"./c-V4XMSLC3.min.js";import{b as u}from"./c-VP7WX6QI.min.js";import{c as h}from"./c-3OBJLOXI.min.js";import{b as y}from"./c-2N7IU2NY.min.js";import{a as g,e as p,f,d as m,M as v,K as k,N as b,L as x,G as w,s as _,v as S,t as C,u as E,g as N,D as R,x as T,C as A,o as I,l as D,k as M,n as P,z as L,B as O,i as W,O as F,q as B,r as z}from"./c-GBO32OML.min.js";import{b as $,c as j}from"./c-SWVXFUDL.min.js";import{a as Y,c as H}from"./c-363Q2L4Z.min.js";import{a as X,b as V}from"./c-O7SPJAUO.min.js";import{k as G,l as Q,al as K,b as q,aJ as U,an as Z,az as J,aS as ee,ai as te,Y as re,W as ie,V as ne,F as se,aX as oe,E as ae,Q as le,K as ce,J as de,I as ue,U as he,A as ye,ar as ge,ao as pe,ay as fe,as as me,ax as ve,au as ke,aE as be,aD as xe,aV as we,aW as _e,ad as Se,ag as Ce,ac as Ee,aB as Ne,aj as Re,ak as Te,am as Ae,m as Ie,n as De,aF as Me,ae as Pe,G as Le,aT as Oe,ah as We,o as Fe,ba as Be,aG as ze}from"./c-VW7ZSLDC.min.js";import{a as $e}from"./c-WUAFPLTD.min.js";import{c as je}from"./c-SIQVOV6A.min.js";import{a as Ye,m as He}from"./c-WPL6PGP3.min.js";import{i as Xe,k as Ve,c as Ge,p as Qe,t as Ke,u as qe,v as Ue}from"./c-BJKGYOPX.min.js";import{a as Ze,i as Je,b as et}from"./c-ELGOCAEY.min.js";import{h as tt}from"./c-LYPOBMKC.min.js";import{y as rt,t as it,z as nt,h as st}from"./c-TC47SNSI.min.js";import{c as ot,d as at,b as lt,a as ct}from"./c-I4BEWAKT.min.js";import*as dt from"react";import{useRef as ut,useCallback as ht,useSyncExternalStore as yt,useLayoutEffect as gt,useId as pt,useState as ft,useReducer as mt,useEffect as vt,memo as kt,forwardRef as bt,useMemo as xt,useImperativeHandle as wt}from"react";import{jsx as _t,Fragment as St,jsxs as Ct}from"react/jsx-runtime";import{quadtree as Et}from"d3-quadtree";import{interpolateNumber as Nt}from"d3-interpolate";import{arc as Rt}from"d3-shape";var Tt={type:"flat",matrix:[1,0,0,1,0,0],lift:0,scale:1,bounds:null,project:(e,t)=>[e,t],unproject:(e,t)=>[e,t],depth:(e,t)=>t,groundTransform:"matrix(1 0 0 1 0 0)",billboardTransform:(e,t)=>`translate(${e},${t})`},At=/*#__PURE__*/Symbol.for("semiotic.networkPerspectiveContext");function It(){let e=globalThis;return e[At]??(e[At]=dt.createContext(Tt))}function Dt(){return dt.useContext(It())}function Mt(e,t,r){return t&&null!=e&&!1!==e?_t(Pt,{frame:t,mode:r,children:e}):e}function Pt({frame:e,mode:t,children:r}){if(!e)return _t(St,{children:r});let i=It();return _t(i.Provider,{value:e,children:"ground"===t?_t("g",{transform:e.groundTransform,children:r}):r})}function Lt(e,t,r){return"function"==typeof t?t(e):e[t??r]}function Ot(e,t){let r=Lt(e,t.edgeIdAccessor,"id");if("string"!=typeof r||!r)throw new Error("IDENTITY_EDGE_ID: edgeIdentity=id requires nonempty string edge IDs.");return JSON.stringify(["id",r])}function Wt(e){let t=null==e?NaN:Number(e);return Number.isFinite(t)?t:1}function Ft(e,t){return null!=e?String(e):("production"!==process.env.NODE_ENV&&console.warn(`[Semiotic] Missing network ${t} ID; skipping this datum.`),null)}function Bt(e,t){let r=Ft(Lt(e,t.sourceAccessor,"source"),"source"),i=Ft(Lt(e,t.targetAccessor,"target"),"target");if(null===r||null===i){if("id"===t.edgeIdentity)throw new Error("ENDPOINT_OWNER: explicit-ID edges require both owners.");return null}return{source:r,target:i,value:Wt(Lt(e,t.valueAccessor,"value")),data:e}}function zt(e,t,r){if("id"!==r.edgeIdentity)return;let i=Bt(t,r),n="string"==typeof e.source?e.source:e.source.id,s="string"==typeof e.target?e.target:e.target.id;if(Ot(t,r)!==e._edgeKey||!i||i.source!==n||i.target!==s)throw new Error("IDENTITY_EDGE_UPDATE: update cannot change edge ID or owners; remove and reinsert the edge.")}var $t=/*#__PURE__*/new Set(["tree","cluster","treemap","circlepack","partition","orbit"]),jt=/*#__PURE__*/new Set(["sankey","tree","cluster","treemap","circlepack","partition"]),Yt=class{constructor(e){this.capacity=e,this.particles=new Array(e),this._freeIndices=new Array(e);for(let t=0;t<e;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){let r=this._freeIndices.pop();if(void 0===r)return null;let i=this.particles[r];return i.active=!0,i.t=0,i.offset=t()-.5,i.edgeIndex=e,i.x=0,i.y=0,i}step(e,t,r,i){for(let n=0;n<this.capacity;n++){let s=this.particles[n];if(!s.active)continue;let o=r[s.edgeIndex];if(!o||!o.bezier){s.active=!1,this._freeIndices.push(n);continue}let a=i?i[s.edgeIndex]??1:1,l=o.bezier.circular?.3:1;s.t+=e*t*a*l,s.t>=1?(s.active=!1,this._freeIndices.push(n)):Ht(o.bezier,s.t,s.offset,s)}}countForEdge(e){let t=0;for(let r=0;r<this.capacity;r++)this.particles[r].active&&this.particles[r].edgeIndex===e&&t++;return t}clear(){for(let e=0;e<this.capacity;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(e<=this.capacity)return;let t=this.particles;this.particles=new Array(e);for(let r=0;r<e;r++)r<t.length?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}};function Ht(e,t,r,i){if(e.circular&&e.segments)return void function(e,t,r,i,n){let s=e.length,o=t*s,a=Math.min(Math.floor(o),s-1),l=o-a,[c,d,u,h]=e[a];Xt(c,d,u,h,l,n);let y=h.x-c.x,g=h.y-c.y,p=Math.sqrt(y*y+g*g);if(p>.001){let e=-g/p,t=y/p;n.x+=e*r*i*2,n.y+=t*r*i*2}}(e.segments,t,r,e.halfWidth,i);if(!e.points)return i.x=0,void(i.y=0);let[n,s,o,a]=e.points;Xt(n,s,o,a,t,i);let l=a.x-n.x,c=a.y-n.y,d=Math.sqrt(l*l+c*c);if(d>.001){let t=-c/d,n=l/d;i.x+=t*r*e.halfWidth*2,i.y+=n*r*e.halfWidth*2}}function Xt(e,t,r,i,n,s){let o=1-n,a=o*o,l=a*o,c=n*n,d=c*n;s.x=l*e.x+3*a*n*t.x+3*o*c*r.x+d*i.x,s.y=l*e.y+3*a*n*t.y+3*o*c*r.y+d*i.y}var Vt=/*#__PURE__*/new Set(["sankey","force","chord","tree","cluster","treemap","circlepack","partition","orbit"]);function Gt(e){return Vt.has(e)}var Qt=!1;function Kt(t){e(t)||!G&&Gt(t)||"production"===process.env.NODE_ENV||Qt||(Qt=!0,console.warn(`[semiotic] StreamNetworkFrame: no layout plugin registered for "${t}". Import the matching chart HOC (which registers its plugin), or call registerBuiltInNetworkLayouts() from "semiotic/network".`))}function qt(e){return{id:e,x0:0,x1:0,y0:0,y1:0,__hasPosition:!1,x:0,y:0,width:0,height:0,value:0,data:{id:e},createdByFrame:!0}}function Ut(e){if(!e||"object"!=typeof e)return!1;let t=e;if("boolean"!=typeof t.circular||"number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(let e of t.segments)if(!Zt(e))return!1;return!0}return Zt(t.points)}function Zt(e){if(!Array.isArray(e)||4!==e.length)return!1;for(let t of e){if(!t||"object"!=typeof t)return!1;let e=t;if("number"!=typeof e.x||!Number.isFinite(e.x)||"number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}var Jt="rgba(34, 197, 94, 0.7)",er=2e3,tr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},rr={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},ir=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],nr=["scene-style","data-paint","accessibility","evidence"],sr=(e,t)=>({retainedData:e,invalidations:t}),or=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ar=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],lr=["scene-geometry","data-paint","overlay","accessibility","evidence"],cr=["scene-style","data-paint","accessibility","evidence"],dr=["scene-geometry","data-paint","overlay","accessibility","evidence"],ur=[],hr={chartType:/*#__PURE__*/sr("rebuild",or),nodeIDAccessor:/*#__PURE__*/sr("rebuild",or),sourceAccessor:/*#__PURE__*/sr("rebuild",or),targetAccessor:/*#__PURE__*/sr("rebuild",or),valueAccessor:/*#__PURE__*/sr("rebuild",or),edgeIdentity:/*#__PURE__*/sr("rebuild",or),edgeIdAccessor:/*#__PURE__*/sr("rebuild",or),childrenAccessor:/*#__PURE__*/sr("rebuild",or),hierarchySum:/*#__PURE__*/sr("rebuild",or),orientation:/*#__PURE__*/sr("preserve",ar),nodeAlign:/*#__PURE__*/sr("preserve",ar),nodePaddingRatio:/*#__PURE__*/sr("preserve",ar),nodeWidth:/*#__PURE__*/sr("preserve",ar),edgeSort:/*#__PURE__*/sr("preserve",ar),iterations:/*#__PURE__*/sr("preserve",ar),forceStrength:/*#__PURE__*/sr("preserve",ar),padAngle:/*#__PURE__*/sr("preserve",ar),groupWidth:/*#__PURE__*/sr("preserve",ar),sortGroups:/*#__PURE__*/sr("preserve",ar),treeOrientation:/*#__PURE__*/sr("preserve",ar),edgeType:/*#__PURE__*/sr("preserve",ar),padding:/*#__PURE__*/sr("preserve",ar),paddingTop:/*#__PURE__*/sr("preserve",ar),orbitMode:/*#__PURE__*/sr("preserve",ar),orbitSize:/*#__PURE__*/sr("preserve",ar),orbitSpeed:/*#__PURE__*/sr("preserve",ar),orbitRevolution:/*#__PURE__*/sr("preserve",ar),orbitRevolutionStyle:/*#__PURE__*/sr("preserve",ar),orbitEccentricity:/*#__PURE__*/sr("preserve",ar),orbitShowRings:/*#__PURE__*/sr("preserve",ar),orbitAnimated:/*#__PURE__*/sr("preserve",ar),customNetworkLayout:/*#__PURE__*/sr("preserve",ar),layoutConfig:/*#__PURE__*/sr("preserve",ar),perspective:/*#__PURE__*/sr("preserve",lr),nodeSize:/*#__PURE__*/sr("preserve",lr),nodeSizeRange:/*#__PURE__*/sr("preserve",lr),colorByDepth:/*#__PURE__*/sr("preserve",lr),nodeLabel:/*#__PURE__*/sr("preserve",dr),showLabels:/*#__PURE__*/sr("preserve",dr),labelMode:/*#__PURE__*/sr("preserve",dr),nodeStyle:/*#__PURE__*/sr("preserve",cr),edgeStyle:/*#__PURE__*/sr("preserve",cr),colorBy:/*#__PURE__*/sr("preserve",cr),colorScheme:/*#__PURE__*/sr("preserve",cr),themeCategorical:/*#__PURE__*/sr("preserve",cr),themeSequential:/*#__PURE__*/sr("preserve",cr),themeSelectionOpacity:/*#__PURE__*/sr("preserve",cr),themeSemantic:/*#__PURE__*/sr("preserve",cr),edgeColorBy:/*#__PURE__*/sr("preserve",cr),edgeOpacity:/*#__PURE__*/sr("preserve",cr),showParticles:/*#__PURE__*/sr("preserve",cr),particleStyle:/*#__PURE__*/sr("preserve",cr),decay:/*#__PURE__*/sr("preserve",cr),pulse:/*#__PURE__*/sr("preserve",cr),thresholds:/*#__PURE__*/sr("preserve",cr),staleness:/*#__PURE__*/sr("preserve",cr),layoutSelection:/*#__PURE__*/sr("preserve",cr),clock:/*#__PURE__*/sr("preserve",ur),random:/*#__PURE__*/sr("preserve",ur),seed:/*#__PURE__*/sr("preserve",ur),tensionConfig:/*#__PURE__*/sr("preserve",ur),transition:/*#__PURE__*/sr("preserve",ur),introAnimation:/*#__PURE__*/sr("preserve",ur),onLayoutError:/*#__PURE__*/sr("preserve",ur),__skipForceSimulation:/*#__PURE__*/sr("preserve",ur),__hierarchyRoot:/*#__PURE__*/sr("preserve",ur),__orbitState:/*#__PURE__*/sr("preserve",ur),__previousPositions:/*#__PURE__*/sr("preserve",ur)},yr=/*#__PURE__*/sr("preserve",ar),gr=class{constructor(){this.tracker=new Q}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}},ir)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},nr):this.recordNoop("restyle")}recordConfig(e,t){let r=function(e,t){let r="preserve",i=new Set;for(let n of e){let e="force"!==t||"nodeSize"!==n&&"nodeSizeRange"!==n?Object.prototype.hasOwnProperty.call(hr,n)?hr[n]:yr:sr("preserve",ar);"rebuild"===e.retainedData&&(r="rebuild");for(let t of e.invalidations)i.add(t)}return{retainedData:r,invalidations:i}}(e,t);return this.tracker.record({kind:"config",keys:e},r.invalidations)}};function pr(e){return e._edgeKey?.startsWith('["id",')?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`}function fr(e){return{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth,circularPathData:e.circular&&e.circularPathData?{...e.circularPathData}:void 0}}function mr(e,t=fr(e)){e._prevY0=t.y0,e._prevY1=t.y1,e._prevSankeyWidth=t.sankeyWidth,e._prevCircularPathData=t.circularPathData,e._introFromZero=!1}function vr(e){e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth,e._targetCircularPathData=fr(e).circularPathData;let t=e._targetCircularPathData,r=e._prevCircularPathData;t&&(!r||Math.sign(r.verticalFullExtent-r.sourceY)!==Math.sign(t.verticalFullExtent-t.sourceY))&&(e._prevSankeyWidth||(e._prevY0=kr(e.source,e.y0),e._prevY1=kr(e.target,e.y1)),e._prevCircularPathData={...t},e._prevSankeyWidth=0,e._introFromZero=!0)}function kr(e,t){if("string"==typeof e||void 0===e._prevY0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1)return t;let r=e.y1>e.y0?(t-e.y0)/(e.y1-e.y0):.5;return ot(e._prevY0,e._prevY1,r)}function br(e,t){if(void 0===e._targetY0||void 0===e._prevY0||void 0===e._prevSankeyWidth||!(e._prevSankeyWidth>0||e._introFromZero))return;e.y0=ot(e._prevY0,e._targetY0,t),e.y1=ot(e._prevY1,e._targetY1,t),e.sankeyWidth=ot(e._prevSankeyWidth,e._targetSankeyWidth,t);let r=e._targetCircularPathData,i=e._prevCircularPathData;if(!r||!i)return;let n={...r};for(let e of Object.keys(r))n[e]=ot(i[e]??r[e],r[e],t);if("string"!=typeof e.source){let t=e.source.x1-n.sourceX;n.sourceX=e.source.x1,n.rightInnerExtent+=t,n.rightFullExtent+=t,n.sourceWidth=e.source.x1-e.source.x0}if("string"!=typeof e.target){let t=e.target.x0-n.targetX;n.targetX=e.target.x0,n.leftInnerExtent+=t,n.leftFullExtent+=t}n.sourceY=e.y0,n.targetY=e.y1,e.circularPathData=n,e._circularWidth=e.sankeyWidth}function xr(e){void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth,e._targetCircularPathData&&(e.circularPathData={...e._targetCircularPathData},e._circularWidth=e.sankeyWidth)),e._introFromZero=void 0}function wr(e){let t="string"==typeof e?{type:e}:e;return t&&"flat"!==t.type?t:null}var _r=class{constructor(e){this.restyle=e,this.key=null,this.pending=null}reuse(e,t,r,i,n){let s=function(e,t,r,i){return{geometry:[r,i,...t,e.customNetworkLayout,e.layoutConfig,e.perspective],colors:{semantic:e.themeSemantic,sequential:e.themeSequential,selectionOpacity:e.themeSelectionOpacity,categorical:e.themeCategorical,colorScheme:e.colorScheme},selection:[e.layoutSelection?.isActive??!1,e.layoutSelection?.predicate,null!=e.layoutSelection]}}(e,t,r,i),o=null!==this.key&&K(this.key.selection,s.selection);return this.key&&K(this.key.geometry,s.geometry)&&K(this.key.colors,s.colors)&&(n||o)?(o||this.restyle(e.layoutSelection??null),this.key=s,!0):(this.key=null,this.pending=s,!1)}commit(){this.key=this.pending,this.pending=null}clear(){this.key=null,this.pending=null}};function Sr(e){e.customLayoutBackgrounds=null,e.customLayoutOverlays=null,e.customLayoutHtmlMarks=[],e.lastCustomLayoutResult=null}function Cr(e,t){let r=new WeakMap;for(let t of e)r.set(t,t.style);for(let e of t)r.set(e,e.style);return r}var Er=class{constructor(){this.frame=null,this.underlay=[],this.edgeLift=0,this.onExtrasReady=null,this.needsRebuild=!1,this.internal=null,this.builds=0,this.warnedFlatDecorations=!1}warnFlatDecorations(e){if("production"===process.env.NODE_ENV||this.warnedFlatDecorations||e.perspective)return;let t=e=>Array.isArray(e)?e.some(t):null!=e&&!1!==e&&""!==e;!t(e.backgrounds)&&!t(e.overlays)||(this.warnedFlatDecorations=!0,console.warn('[semiotic] customNetworkLayout backgrounds/overlays stay flat. Use perspective: "ground", or NetworkPerspectiveGround/Billboard with perspective: "manual".'))}label(e){let t=this.frame?.type;return t&&"flat"!==t?`${e} (${t} perspective)`:e}get transitioning(){return null!=this.internal?.tween}advance(e,t=!1){let r=null!=this.internal?.tween&&(a()?.advance(this,e,t)??!1);return r&&(this.needsRebuild=!0),r}extrasReady(){this.needsRebuild=!0,this.onExtrasReady?.()}reset(){this.frame=null,this.underlay=[],this.edgeLift=0,this.projectParticle=void 0,this.internal=null,this.builds=0,this.needsRebuild=!1}project(e,t,r){this.needsRebuild=!1;let i=0===this.builds++;if(!(e.perspective&&"flat"!==e.perspective||this.internal))return null;let n=a();return n?n.project(this,e,t,r,i):(l().then(()=>this.extrasReady(),()=>{}),null)}},Nr=class extends f{constructor(e){super(),this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutBackgrounds=null,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customLayoutCache=new _r(e=>this.restyleScene(e)),this.perspective=new Er,this._rawCustomResult=null,this.customLayoutRevision=0,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.incidentEdges=null,this.updateResults=new gr,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this.config={...e},this.tensionConfig={...tr,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Yt(2e3))}get customLayoutRun(){return this._rawCustomResult}edgeIncidence(){if(this.incidentEdges)return this.incidentEdges;let e=new Map;for(let[t,r]of this.edges){let i="string"==typeof r.source?r.source:r.source.id,n="string"==typeof r.target?r.target:r.target.id;for(let r of[i,n])e.has(r)||e.set(r,new Set),e.get(r).add(t)}return this.incidentEdges=e,e}deleteIndexedEdge(e){let t=this.edges.get(e);if(!t)return;let r="string"==typeof t.source?t.source:t.source.id,i="string"==typeof t.target?t.target:t.target.id;this.incidentEdges?.get(r)?.delete(e),this.incidentEdges?.get(i)?.delete(e),this.edges.delete(e),this.edgeTimestamps.delete(e)}currentTime(){return this.config.clock?.()??at()}updateConfig(e){this.applyConfig(e)}hasEdgeIdentityChange(e){return r=e,((t=this.config).edgeIdentity??"pair")!==(r.edgeIdentity??"pair")||"id"===r.edgeIdentity&&t.edgeIdAccessor!==r.edgeIdAccessor;var t,r}applyConfig(e,r=!1){let i=this.config,n={...i,...e};if(!r&&this.edges.size&&"id"===i.edgeIdentity&&"id"!==n.edgeIdentity)throw new Error("IDENTITY_EDGE_MODE: clear or replace retained edges before switching to pair identity.");if(!r&&"id"===n.edgeIdentity&&("id"!==i.edgeIdentity||i.edgeIdAccessor!==n.edgeIdAccessor)){let e=function(e,t){let r=new Set;return[...e].map(([e,i])=>{let n=Ot(i.data??{},t);if(r.has(n))throw new Error("IDENTITY_DUPLICATE_EDGE: cannot adopt an accessor that repeats existing IDs.");return r.add(n),{previous:e,key:n,edge:i}})}(this.edges,n),t=new Map;for(let{previous:r,key:i}of e){let e=this.edgeTimestamps.get(r);void 0!==e&&t.set(i,e)}this.edges.clear();for(let{key:t,edge:r}of e)r._edgeKey=t,this.edges.set(t,r);this.edgeTimestamps=t,this.incidentEdges=null,this._arrCacheVersion=-1}t(i,n),i.__hierarchyRoot&&(n.__hierarchyRoot=i.__hierarchyRoot),void 0===e.layoutSelection&&null!=i.layoutSelection&&(n.layoutSelection=i.layoutSelection);let s=[...new Set([...Object.keys(i),...Object.keys(n)])].filter(e=>i[e]!==n[e]);this.config=n,this.tensionConfig={...tr,...n.tensionConfig},n.showParticles&&("sankey"===n.chartType||n.customNetworkLayout)&&!this.particlePool&&(this.particlePool=new Yt(2e3)),this.updateResults.recordConfig(s,n.chartType)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t,r){r&&this.applyConfig(r,!0),this._boundedPrevSnapshot=new Map;for(let[e,t]of this.nodes)(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)&&this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.incidentEdges=null,this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,r,i){let n=function(e,t,r){let i=new Map;for(let t of e){let e=Ft(Lt(t,r.nodeIDAccessor,"id"),"node");null!==e&&(i.has(e)&&"production"!==process.env.NODE_ENV&&console.warn(`[Semiotic] Duplicate network node ID "${e}"; using the last datum.`),i.set(e,t))}let n=[],s=new Set;return t.forEach((e,t)=>{let o="id"===r.edgeIdentity?Ot(e,r):void 0;if(o&&s.has(o))throw new Error("IDENTITY_DUPLICATE_EDGE: repeated edge ID in bounded graph.");o&&s.add(o);let a=Bt(e,r);if(a){for(let e of[a.source,a.target])i.has(e)||i.set(e,{id:e});n.push({...a,_edgeKey:o??`${a.source}\0${a.target}\0${t}`})}}),{nodes:i,edges:n}}(e,t,{...this.config,...i?.config});i?.config&&this.applyConfig(i.config,!0),this._boundedPrevSnapshot=new Map;for(let[e,t]of this.nodes)(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)&&this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=function(e){let t=new Map;for(let r of e){let e=pr(r),i=t.get(e)??[];i.push(fr(r)),t.set(e,i)}return t}(this.edges.values()),this.nodes.clear(),this.incidentEdges=null,this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._arrCacheVersion=-1;for(let[e,t]of n.nodes){let r=qt(e);r.data=t,"force"===this.config.chartType&&!this.config.customNetworkLayout&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&(r.x=t.x,r.y=t.y,r.__hasPosition=!0),this.nodes.set(e,r)}for(let e of n.edges){let t=e.data,r={...e,y0:0,y1:0,sankeyWidth:0};t&&"object"==typeof t&&Ut(t.bezier)&&(r.bezier=t.bezier),this.edges.set(e._edgeKey,r)}i?.deferLayout||this.runLayout(r),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,r,i){return this.ingestBounded(e,t,r,i),this.updateResults.last}applyForceLayoutPositions(e,t){for(let[t,r]of Object.entries(e)){let e=this.nodes.get(t);e&&(e.x=r.x,e.y=r.y,e.__hasPosition=!0)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){let t=Bt(e,this.config);if(!t)return this.updateResults.recordNoop("ingest"),!1;let{source:r,target:i,value:n}=t,s="id"===this.config.edgeIdentity?Ot(e,this.config):this.edgeKey(r,i),o=this.edges.get(s);o&&zt(o,e,this.config);let a=0===this.nodes.size,l=!1,c=this.currentTime();this.lastIngestTime=c,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(r)||(this.nodes.set(r,qt(r)),this.nodeTimestamps.set(r,c),this.tension+=this.tensionConfig.newNode,l=!0),this.nodes.has(i)||(this.nodes.set(i,qt(i)),this.nodeTimestamps.set(i,c),this.tension+=this.tensionConfig.newNode,l=!0);let d=!1;o?(o.value="id"===this.config.edgeIdentity?n:o.value+n,o.data="id"===this.config.edgeIdentity?e:{...o.data,...e},this.edgeTimestamps.set(s,c),this.tension+=this.tensionConfig.weightChange,d=!0):(this.incidentEdges=null,this.edges.set(s,{...t,y0:0,y1:0,sankeyWidth:0,_edgeKey:s}),this.edgeTimestamps.set(s,c),this.tension+=this.tensionConfig.newEdge,l=!0);let u=a||l||d||this.tension>=this.tensionConfig.threshold;return l&&(this._arrCacheVersion=-1),this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(t){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;let r=e(this.config.chartType);if(!r)return void Kt(this.config.chartType);let i=Array.from(this.nodes.values()),n=Array.from(this.edges.values());if(0===i.length&&!r.hierarchical)return;if(this.prepareForRelayout(),r.supportsStreaming&&!r.hierarchical&&(this.config.__previousPositions=this._lastPositionSnapshot??void 0),r.computeLayout(i,n,this.config,t),this.config.__previousPositions=void 0,r.hierarchical&&i.length>0){this.nodes.clear(),this.incidentEdges=null,this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(let e of i)this.nodes.set(e.id,e);for(let e=0;e<n.length;e++){let t=n[e],r="string"==typeof t.source?t.source:t.source.id,i="string"==typeof t.target?t.target:t.target.id,s=t._edgeKey||`${r}\0${i}\0${e}`;t._edgeKey=s,this.edges.set(s,t)}let e=this._boundedPrevSnapshot;if(e&&e.size>0)for(let t of this.nodes.values()){let r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,i=Array.from(this.nodes.values())}this.finalizeLayout();let s=new Map;for(let e of this.nodes.values())Number.isFinite(e.x)&&Number.isFinite(e.y)&&s.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=s,this.saveTargetPositions();let o=i.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),a=this.config.transition?.duration??this.tensionConfig.transitionDuration,l=jt.has(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&l&&i.length>0&&a>0){let e="sankey"===this.config.chartType&&"vertical"===this.config.orientation,r=t[e?1:0]/2,i=t[e?0:1]/2;for(let e of this.nodes.values())e._prevX0=r,e._prevX1=r,e._prevY0=i,e._prevY1=i;for(let e of this.edges.values())e._prevY0=i,e._prevY1=i,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a}}else o&&a>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){let e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(let t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(let t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(let e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(let e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){let t=function({nodes:e,edges:t,restyle:r,restyleEdge:i,baseStyles:n,selection:s}){let o=!(!r&&!i);if(r)for(let t of e){let e=n.get(t)??t.style,i=r(t,s);t.style=i?{...e,...i}:e}if(i)for(let e of t){let t=n.get(e)??e.style,r=i(e,s);e.style=r?{...t,...r}:t}return o}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(t){if(this.config.customNetworkLayout){if(this._customLayoutCache.reuse(this.config,t,this.getUpdateSnapshot().revisions.data,this.layoutVersion,this.hasCustomRestyle))return void(this.perspective.needsRebuild&&this._rawCustomResult&&(this.commitCustomScene(this._rawCustomResult,t),this._sceneNodesRevision++,this.hasCustomRestyle&&(this._baseStyles=Cr(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null))));let e=function({config:e,customLayout:t,size:r,nodes:i,edges:n,previousResult:s,revision:o}){let a=X(e.colorScheme,e.themeCategorical,Ye),l={nodes:i,edges:n,dimensions:{width:r[0],height:r[1],plot:{x:0,y:0,width:r[0],height:r[1]}},theme:{semantic:e.themeSemantic??{},sequential:e.themeSequential,selectionOpacity:e.themeSelectionOpacity,categorical:[...a]},resolveColor:V(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null,perspective:wr(e.perspective)};return p({family:"network",logLabel:"customNetworkLayout",revision:o,hasPreviousResult:null!==s,onLayoutError:e.onLayoutError,run:()=>t(l)})}({config:this.config,customLayout:this.config.customNetworkLayout,size:t,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===e.kind)return this.lastCustomLayoutFailure=e.diagnostic,void(e.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.perspective.underlay=[],Sr(this),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));let r=e.result;return this._customLayoutCache.commit(),this._rawCustomResult=r,this.commitCustomScene(r,t),this.customLayoutRevision++,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=r.restyle,this._customRestyleEdge=r.restyleEdge,this.hasCustomRestyle=!(!r.restyle&&!r.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=Cr(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void m({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customLayoutCache.clear(),this._rawCustomResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,Sr(this),this.lastCustomLayoutFailure=null;let r=e(this.config.chartType);if(!r)return Kt(this.config.chartType),void this._sceneNodesRevision++;let i=r.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=r.hierarchical?Array.from(this.edges.values()):this.edgesArray,s=r.buildScene(i,n,this.config,t),o=this.perspective.project(this.config,t,s);this.sceneNodes=o?.sceneNodes??s.sceneNodes,this.sceneEdges=o?.sceneEdges??s.sceneEdges,this.labels=o?.labels??s.labels,this._sceneNodesRevision++}commitCustomScene(e,t){let r=this.perspective.project(this.config,t,{sceneNodes:e.sceneNodes??[],sceneEdges:e.sceneEdges??[],labels:e.labels??[],htmlMarks:e.htmlMarks,bounds:e.perspectiveBounds});r&&this.perspective.warnFlatDecorations(e);let i=r?{...e,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,labels:r.labels,htmlMarks:e.htmlMarks?r.htmlMarks:void 0}:e;this.sceneNodes=i.sceneNodes??[],this.sceneEdges=i.sceneEdges??[],this.labels=i.labels??[],function(e,t){e.customLayoutBackgrounds=t.backgrounds??null,e.customLayoutOverlays=t.overlays??null,e.customLayoutHtmlMarks=t.htmlMarks??[],e.lastCustomLayoutResult=t}(this,i)}advancePerspectiveTransition(e,t=!1){return this.perspective.advance(e,t)}rebuildNodeQuadtree(){let e=0,t=0,r=!1;for(let i of this.sceneNodes)"circle"===i.type&&i.datum&&(e++,i.r>t&&(t=i.r),i.pathD&&!i._perspectiveToken&&(r=!0));if(this._maxNodeRadius=t,r||e<=500)return void(this._nodeQuadtree=null);let i=[];for(let e of this.sceneNodes)"circle"===e.type&&e.datum&&i.push(e);this._nodeQuadtree=Et().x(e=>e.cx).y(e=>e.cy).addAll(i)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this.nodeQuadtree,this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache??[]}get edgesArray(){return this._ensureArrays(),this._edgesArrCache??[]}get isAnimating(){return!(!e(this.config.chartType)?.supportsAnimation||!1===this.config.orbitAnimated)}tickAnimation(t,r){let i=e(this.config.chartType);if(!i?.tick)return!1;let n=i.hierarchical?Array.from(this.nodes.values()):this.nodesArray,s=i.hierarchical?Array.from(this.edges.values()):this.edgesArray;return i.tick(n,s,this.config,t,r)}cancelIntroAnimation(){this.transition&&this.snapToTargets(),this.transition=null;for(let e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(let e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._prevCircularPathData=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;let t=lt(e,this.transition),r=ct(t,this.config.transition?.easing);for(let e of this.nodes.values())void 0!==e._targetX0&&void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1)&&(e.x0=ot(e._prevX0,e._targetX0,r),e.x1=ot(e._prevX1,e._targetX1,r),e.y0=ot(e._prevY0,e._targetY0,r),e.y1=ot(e._prevY1,e._targetY1,r));for(let e of this.edges.values())br(e,r);return this.rebuildAllBeziers(),!(t>=1&&(this.snapToTargets(),this.transition=null,1))}prepareForRelayout(){let e=this._boundedPrevSnapshot;for(let t of this.nodes.values()){let r=e?.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}(function(e,t){for(let r of e){let e=t?.get(pr(r))?.shift();mr(r,0===r.sankeyWidth?e:void 0)}})(this.edges.values(),this._boundedEdgeSnapshot),this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){let e="vertical"===this.config.orientation?"down":"right";for(let e of this.nodes.values())"treemap"===this.config.chartType||"partition"===this.config.chartType||0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1?(e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2):(e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10);for(let t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(let e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(let e of this.edges.values())vr(e)}restorePreviousPositions(){for(let e of this.nodes.values())void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1)&&(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(let e of this.edges.values())br(e,0);this.rebuildAllBeziers()}snapToTargets(){for(let e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(let e of this.edges.values())xr(e);this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,r=.5){let i="string"==typeof e.source?t.get(e.source):e.source,n="string"==typeof e.target?t.get(e.target):e.target;!i||!n||(e.circular&&e.circularPathData?e.bezier=function(e){let t,r=(e._circularWidth||e.sankeyWidth||1)/2,i=e.circularPathData;if(!i)throw new Error("buildCircularBezier requires circularPathData");if(e._circularStub){let e=Math.max(15,Math.min(40,.33*(i.rightFullExtent-i.sourceX))),t=Math.max(15,Math.min(40,.33*(i.targetX-i.leftFullExtent)));return{circular:!0,segments:[[{x:i.sourceX,y:i.sourceY},{x:i.sourceX+.33*e,y:i.sourceY},{x:i.sourceX+.66*e,y:i.sourceY},{x:i.sourceX+e,y:i.sourceY}],[{x:i.targetX-t,y:i.targetY},{x:i.targetX-.66*t,y:i.targetY},{x:i.targetX-.33*t,y:i.targetY},{x:i.targetX,y:i.targetY}]],halfWidth:r}}t="down"===e.direction?[{x:i.sourceY,y:i.sourceX},{x:i.sourceY,y:i.rightFullExtent},{x:i.verticalFullExtent,y:i.rightFullExtent},{x:i.verticalFullExtent,y:i.leftFullExtent},{x:i.targetY,y:i.leftFullExtent},{x:i.targetY,y:i.targetX}]:[{x:i.sourceX,y:i.sourceY},{x:i.rightFullExtent,y:i.sourceY},{x:i.rightFullExtent,y:i.verticalFullExtent},{x:i.leftFullExtent,y:i.verticalFullExtent},{x:i.leftFullExtent,y:i.targetY},{x:i.targetX,y:i.targetY}];let n=[];for(let e=0;e<t.length-1;e++){let r=t[e],i=t[e+1],s=i.x-r.x,o=i.y-r.y;n.push([r,{x:r.x+s/3,y:r.y+o/3},{x:r.x+2*s/3,y:r.y+2*o/3},i])}return{circular:!0,segments:n,halfWidth:r}}(e):e.bezier=function(e,t,r,i=.5){let n=(e.sankeyWidth||1)/2;if("down"===e.direction){let s=t.x1,o=r.x0,a=Nt(s,o);return{circular:!1,points:[{x:e.y0,y:s},{x:e.y0,y:a(i)},{x:e.y1,y:a(1-i)},{x:e.y1,y:o}],halfWidth:n}}let s=t.x1,o=r.x0,a=Nt(s,o);return{circular:!1,points:[{x:s,y:e.y0},{x:a(i),y:e.y0},{x:a(1-i),y:e.y1},{x:o,y:e.y1}],halfWidth:n}}(e,i,n,r))}(e,this.nodes,.5)}rebuildAllBeziers(){for(let e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(let e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){!function(e){let t=e.pulse;if(!t)return;let r=t.duration??500,i=t.color??"rgba(255,255,255,0.6)",n=t.glowRadius??4,{now:s}=e;for(let t of e.sceneNodes){let o=t.id;if(!o)continue;let a=e.nodeTimestamps.get(o);if(!a)continue;let l=s-a;if(l>=r)continue;let c=1-l/r;t._pulseIntensity=c,t._pulseColor=i,t._pulseGlowRadius=n}for(let t of e.sceneEdges){let n=t.datum;if(!n)continue;let o="object"==typeof n.source?n.source?.id:n.source,a="object"==typeof n.target?n.target?.id:n.target;if(!o||!a)continue;let l=`${o}\0${a}`,c=e.edgeTimestamps.get(l);if(!c)continue;let d=s-c;if(d>=r)continue;let u=1-d/r;t._pulseIntensity=u,t._pulseColor=i}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){let t=e.decay;if(!t)return;let r=e.nodeTimestamps.size;if(r<=1)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);let t=new Map;for(let r=0;r<e.cache.sortedNodes.length;r++)t.set(e.cache.sortedNodes[r][0],r);e.cache.ageMap=t}let i=e.cache.ageMap;for(let n of e.sceneNodes){let e=n.id;if(!e)continue;let s=i.get(e);if(void 0===s)continue;let o=g(t,s,r),a=n.style?.opacity??1;n.style={...n.style,opacity:a*o}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(let t of e.sceneNodes)t._pulseColor===Jt&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;let t=e.now-e.lastTopologyChangeTime;if(t>=er)return;let r=1-t/er;for(let t of e.sceneNodes){let i=t.id;!i||!e.addedNodes.has(i)||(t._pulseIntensity=Math.max(t._pulseIntensity??0,r),t._pulseColor=Jt,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,r=(typeof performance<"u"?performance.now():Date.now())){return 0!==e.size&&r-t<er}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){let t=e.thresholds;if(!t)return;let r=t.warningColor??"#f59e0b",i=t.criticalColor??"#ef4444",n=!1!==t.pulse;for(let s of e.sceneNodes){let o=s.id;if(!o)continue;let a=e.nodes.get(o);if(!a)continue;let l=t.metric(a),c=null;void 0!==t.critical&&l>=t.critical?c=i:void 0!==t.warning&&l>=t.warning&&(c=r),c&&(s.style={...s.style,fill:c},n&&(s._pulseIntensity=.6+.4*Math.sin(e.now/300),s._pulseColor=c,s._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(let r of e){let e=t.metric(r);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){let t=e.pulse;if(!t||0===e.lastIngestTime)return!1;let r=e.now??(typeof performance<"u"?performance.now():Date.now()),i=t.duration??500;return r-e.lastIngestTime<i}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){let r=this.nodes.get(e);if(!r)return this.updateResults.recordNoop("update"),null;let i=r.data?{...r.data}:{};return r.data=t(r.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),i}updateEdge(e,t,r){return this.replaceEdgeData([...this.edges.values()].filter(r=>{let i="string"==typeof r.source?r.source:r.source.id,n="string"==typeof r.target?r.target:r.target.id;return i===e&&n===t}),r)}replaceEdgeData(e,t){let r=[],i=[];for(let r of e){let e=t({...r.data});zt(r,e,this.config),i.push({edge:r,data:e})}for(let{edge:e,data:t}of i){let i=Lt(e.data??{},this.config.valueAccessor,"value");r.push({...e.data}),e.data=t;let n=Lt(t,this.config.valueAccessor,"value");Object.is(i,n)||(e.value=Wt(n))}return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",r.length)):this.updateResults.recordNoop("update"),r}updateEdgeById(e,t){if("id"!==this.config.edgeIdentity)throw new Error("updateEdgeById requires edgeIdentity=id.");let r=this.edges.get(JSON.stringify(["id",e]));return this.replaceEdgeData(r?[r]:[],t)[0]??null}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(let t of this.edgeIncidence().get(e)??[])this.deleteIndexedEdge(t);return this.incidentEdges?.delete(e),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){let r=[];if(void 0===t){let t=this.config.edgeIdAccessor??("id"===this.config.edgeIdentity?"id":void 0);if(!t)throw new Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");let i="function"==typeof t?t:e=>e?.[t];for(let[t,n]of this.edges)n.data&&i(n.data)===e&&r.push(t)}else for(let[i,n]of this.edges){let s="string"==typeof n.source?n.source:n.source.id,o="string"==typeof n.target?n.target:n.target.id;s===e&&o===t&&r.push(i)}for(let e of r)this.deleteIndexedEdge(e);return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length)):this.updateResults.recordNoop("remove"),r.length>0}clear(){this._customLayoutCache.clear(),this._rawCustomResult=null,this.perspective.underlay=[],this.nodes.clear(),this.incidentEdges=null,this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],Sr(this),this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};function Rr(e,t,r,i,n){return{id:t,className:"stream-network-frame"+(e.className?` ${e.className}`:""),role:"group","aria-busy":i||void 0,"aria-label":e.description||("string"==typeof e.title?e.title:"Network chart"),style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:e.responsiveWidth?"100%":r[0],height:e.responsiveHeight?"100%":r[1],overflow:e.viewTransform?"clip":n}}}function Tr(e){return je(e.datum||{},e.x,e.y,{nodeOrEdge:"node"})}var Ar=/^(value|amount|total|count|weight|score)$/i,Ir=/*#__PURE__*/rt(function({data:e}){if("edge"===e.nodeOrEdge){let t=e.data;if(!t)return null;let r="object"==typeof t.source?t.source.id:t.source,i="object"==typeof t.target?t.target.id:t.target,n=t.__chordEdges;return n&&n.length>1?Ct("div",{className:"semiotic-tooltip",style:it,children:[Ct("div",{style:{fontWeight:600},children:["Connections: ",n.length]}),n.map((e,t)=>Ct("div",{style:{marginTop:4,opacity:.8},children:["object"==typeof e.source?e.source.id:e.source," → ","object"==typeof e.target?e.target.id:e.target,": ",e.value.toLocaleString()]},e._edgeKey??t))]}):Ct("div",{className:"semiotic-tooltip",style:it,children:[Ct("div",{style:{fontWeight:600},children:[r," → ",i]}),null!=t.value&&Ct("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():String(t.value)]})]})}let t=e.data;if(!t)return null;let r=t.__hierarchyNode;if(r){let e=[],i=r;for(;i;){let r=i.data?.name??i.data?.id??t.id;null!=r&&e.unshift(String(r)),i=i.parent}e.length>1&&e.shift();let n=e.length-1;return Ct("div",{className:"semiotic-tooltip",style:it,children:[_t("div",{children:e.map((e,t)=>Ct("span",{children:[t>0&&_t("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===n?_t("strong",{children:e}):_t("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&_t("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():String(t.value)})]})}let i=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),n=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),s=t.data??t,o=U(s),a=null!=o.title?String(o.title):t.id,l=o.entries.some(e=>Ar.test(e.key));return Ct("div",{className:"semiotic-tooltip",style:it,children:[_t("div",{style:{fontWeight:600},children:a}),o.entries.map(e=>Ct("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",w(e.value)]},e.key)),!l&&null!=t.value&&t.value>0&&Ct("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():String(t.value)]}),i>0&&Ct("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",i,n!==i&&` (weighted: ${n.toLocaleString()})`]})]})});function Dr(e){return e?._semioticCamera}function Mr(e,t=!1){return Dr(e)?.transformRef(t)}var Pr={x:0,y:0,k:1};function Lr(e){return e&&Number.isFinite(e.k)&&e.k>0&&Number.isFinite(e.x)&&Number.isFinite(e.y)?e:Pr}function Or(e,t){return{...e,x:e.x*t.k+t.x,y:e.y*t.k+t.y}}function Wr(e,t){return{x:(e.x-t.x)/t.k,y:(e.y-t.y)/t.k,width:e.width/t.k,height:e.height/t.k}}function Fr({view:e,width:t,height:r,children:i}){if(!e)return i;let{x:n,y:s,k:o}=Lr(e);return _t("svg",{role:"presentation",width:t,height:r,overflow:"hidden","data-network-view":"",children:_t("g",{ref:Mr(e),transform:`translate(${n},${s}) scale(${o})`,children:i})})}var Br=()=>()=>{};function zr(e,t=!0){let r=t?Dr(e):void 0,i=r?.getSnapshot??(()=>Lr(e));return yt(r?.subscribe??Br,i,i)}function $r(e,t=e.getSnapshot){return dt.useSyncExternalStore(e.subscribe,t,e.getServerSnapshot)}function jr({hoverStore:e,kbFocusIndexRef:t,store:r}){let i=$r(e,()=>t.current>=0?e.getSnapshot():null);return _t(Z,{hoverPoint:i,scene:"edge"===i?.nodeOrEdge?r.sceneEdges:r.sceneNodes})}function Yr({viewTransform:e,hoverStore:t,kbFocusIndexRef:r,focusedNavPointRef:i,enableHover:n,tooltipContent:s,margin:o,size:a,adjustedWidth:l,adjustedHeight:c}){let d=$r(t),u=r.current>=0,h=i.current,y=zr(e,!!d),g=d?Or(d,y):null;return Ct(St,{children:[_t(J,{active:u,hoverPoint:g,margin:o,size:a,shape:h?.shape,width:null==h?.w?void 0:h.w*y.k,height:null==h?.h?void 0:h.h*y.k}),n&&_t(ee,{contentOwnsChrome:nt(s),x:g?.x??0,y:g?.y??0,containerWidth:l,containerHeight:c,margin:o,className:"stream-network-tooltip",zIndex:2,children:null==d?null:s?s(d):_t(Ir,{data:d})})]})}function Hr(){let e=null,t=new Set;return{getSnapshot:()=>e,getServerSnapshot:()=>null,subscribe:e=>(t.add(e),()=>{t.delete(e)}),set(r){let i="function"==typeof r?r(e):r;e!==i&&(e=i,t.forEach(e=>e()))}}}function Xr(e,t,r="slab-face"){let i=e.style.fill;return(e.style.opacity??1)<=0||(e.style.fillOpacity??1)<=0||"string"==typeof i&&/^\s*(none|transparent)\s*$|^rgba\(.*,\s*0(\.0+)?\s*\)$|^#[\da-f]{3}0$|^#[\da-f]{6}00$/i.test(i)?null:e.faces?.map((i,n)=>_t("path",{"data-perspective-part":r,"data-perspective-face":n,d:i.pathD,fill:"string"==typeof e.style.fill?o(e.style.fill,i.shade):t,fillOpacity:e.style.fillOpacity,opacity:e.style.opacity},`face-${n}`))}function Vr(e,t){switch(e.type){case"circle":{let r=e,i=Xe(r.style.fill)?Ve(r.style.fill,`net-circle-${t}-hatch`):void 0,n={fill:i?`url(#net-circle-${t}-hatch)`:ie(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,fillOpacity:r.style.fillOpacity,strokeOpacity:r.style.strokeOpacity,opacity:r.style.opacity};return Ct(dt.Fragment,{children:[i&&_t("defs",{children:i}),r.pathD&&Xr(r,n.fill,r._perspectiveToken?"token-rim":"slab-face"),r.pathD?_t("path",{"data-perspective-part":r._perspectiveToken?"token-top":"slab-top",d:r.pathD,...n}):_t("circle",{cx:r.cx,cy:r.cy,r:r.r,...n})]},`net-circle-${t}`)}case"rect":{let r=e,i=Xe(r.style.fill)?Ve(r.style.fill,`net-rect-${t}-hatch`):void 0,n={fill:i?`url(#net-rect-${t}-hatch)`:ie(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,fillOpacity:r.style.fillOpacity,strokeOpacity:r.style.strokeOpacity,opacity:r.style.opacity};return Ct(dt.Fragment,{children:[i&&_t("defs",{children:i}),r.pathD&&Xr(r,n.fill),r.pathD?_t("path",{"data-perspective-part":"slab-top",d:r.pathD,...n}):_t("rect",{x:r.x,y:r.y,width:r.w,height:r.h,...n})]},`net-rect-${t}`)}case"arc":{let r=e,i=r.pathD?"":Rt().innerRadius(r.innerR).outerRadius(r.outerR).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2)(ne)||"",n=Xe(r.style.fill)?Ve(r.style.fill,`net-arc-${t}-hatch`):void 0;return Ct(dt.Fragment,{children:[n&&_t("defs",{children:n}),r.pathD&&Xr(r,n?`url(#net-arc-${t}-hatch)`:ie(r.style.fill)),_t("path",{d:r.pathD??i,"data-perspective-part":r.pathD?"slab-top":void 0,transform:r.pathD?void 0:`translate(${r.cx},${r.cy})`,fill:n?`url(#net-arc-${t}-hatch)`:ie(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,fillOpacity:r.style.fillOpacity,strokeOpacity:r.style.strokeOpacity,opacity:r.style.opacity})]},`net-arc-${t}`)}case"symbol":{let r=e,i=Ze(r.symbolType,r.size,r.path),n=r.rotation?`translate(${r.cx},${r.cy}) rotate(${180*r.rotation/Math.PI})`:`translate(${r.cx},${r.cy})`,s=_t("path",{"data-perspective-part":r._perspectiveToken?"token-top":void 0,d:i,transform:n,fill:r.style.fill?ie(r.style.fill):"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,fillOpacity:r.style.fillOpacity,strokeOpacity:r.style.strokeOpacity,opacity:r.style.opacity},`net-symbol-${t}`);return r.faces?.length?Ct(dt.Fragment,{children:[Xr(r,r.style.fill?ie(r.style.fill):void 0,"token-rim"),s]},`net-symbol-${t}`):s}case"glyph":{let r=e;return re(r,r.cx,r.cy,`net-glyph-${r.id??t}`)}default:return null}}function Gr(e,t){return te(Qr(e,t),e,`network-edge-cursor-${t}`)}function Qr(e,t){switch(e.type){case"line":{let r=e;return _t("line",{"data-perspective-part":r._perspectivePart,x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,stroke:r.style.stroke||"#999",strokeOpacity:r.style.strokeOpacity,strokeWidth:r.style.strokeWidth??1,strokeDasharray:r.style.strokeDasharray,strokeLinecap:r.style.strokeLinecap,opacity:r.style.opacity},`net-edge-${t}`)}case"bezier":{let r=e,i=`net-bezier-${t}-hatch`,n=Xe(r.style.fill)?Ve(r.style.fill,i):void 0;return Ct(dt.Fragment,{children:[n&&_t("defs",{children:n}),_t("path",{d:r.pathD,"data-perspective-part":r._perspectivePart,fill:n?`url(#${i})`:ie(r.style.fill,"#999"),fillOpacity:r.style.fillOpacity,stroke:r.style.stroke||"none",strokeOpacity:r.style.strokeOpacity,strokeWidth:r.style.strokeWidth,strokeDasharray:r.style.strokeDasharray,strokeLinecap:r.style.strokeLinecap,opacity:r.style.opacity})]},`net-edge-${t}`)}case"ribbon":{let r=e,i=`net-ribbon-${t}-hatch`,n=Xe(r.style.fill)?Ve(r.style.fill,i):void 0;return Ct(dt.Fragment,{children:[n&&_t("defs",{children:n}),_t("path",{d:r.pathD,"data-perspective-part":r._perspectivePart,fill:n?`url(#${i})`:ie(r.style.fill,"#999"),fillOpacity:r.style.fillOpacity,stroke:r.style.stroke||"none",strokeOpacity:r.style.strokeOpacity,strokeWidth:r.style.strokeWidth,strokeDasharray:r.style.strokeDasharray,strokeLinecap:r.style.strokeLinecap,opacity:r.style.opacity})]},`net-edge-${t}`)}case"curved":{let r=e;return _t("path",{d:r.pathD,"data-perspective-part":r._perspectivePart,fill:ie(r.style.fill,"none"),fillOpacity:r.style.fill&&"none"!==r.style.fill?r.style.fillOpacity??.1:void 0,stroke:r.style.stroke||"#999",strokeOpacity:r.style.strokeOpacity,strokeWidth:r.style.strokeWidth??1,strokeDasharray:r.style.strokeDasharray,strokeLinecap:r.style.strokeLinecap,opacity:r.style.opacity},`net-edge-${t}`)}default:return null}}function Kr(e){let t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:String(t)}function qr(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){let t=e.cx??e.x,r=e.cy??e.y;if("number"!=typeof t||"number"!=typeof r)return null;let i=Je(e.glyph,e.size);return{x:t+i.centerDx,y:r+i.centerDy,r:Math.max(1,i.radius)}}let t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),r=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof r?null:{x:t,y:r,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,et(e.size)):Math.max(1,e.w??0,e.h??0)/2}}function Ur({annotations:e,sceneNodes:t,viewTransform:r,margin:i,width:n,height:s,activation:o}){let a=zr(r,e?.some(e=>"widget"===e.type)??!1);return e?.filter(e=>"widget"===e.type&&(null!=e.pointId||null!=e.nodeId)&&t).map((e,l)=>{let c=!0===e._annotationDeferred,d=e.pointId??e.nodeId,u=t.find(e=>e.id===d||e.datum?.id===d||e.datum?.data?.id===d||e.datum?.data?.name===d),h=u&&qr(u);if(!h)return null;let y=Or(h,a);if(r&&(y.x<0||y.y<0||y.x>n||y.y>s))return null;let g=i.left+y.x,p=i.top+y.y,f=e.dx??0,m=e.dy??-16,v=e.width??32,k=e.height??32,b=e.content??_t("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return _t("div",{...se(e,o),className:c?"annotation-deferred":void 0,"data-annotation-disclosure":c?"deferred":void 0,style:{position:"absolute",left:g+f-v/2,top:p+m-k/2,width:v,height:k,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:b},`widget-${l}`)})??null}var Zr=/*#__PURE__*/oe(function(e){let{width:t,height:r,totalWidth:i,totalHeight:n,margin:s,labels:o,title:a,description:l,idPrefix:c,decorative:d=!1,legend:u,legendHoverBehavior:h,legendClickBehavior:y,legendHighlightedCategory:g,legendIsolatedCategories:p,legendPosition:f="right",legendLayout:m,foregroundGraphics:v,sceneNodes:k,annotations:b,onAnnotationActivate:x,onObservation:w,chartId:N,chartType:R,autoPlaceAnnotations:T,svgAnnotationRules:A,annotationFrame:I}=e,D=ae({onAnnotationActivate:x,onObservation:w,chartId:N,chartType:R}),M=dt.useMemo(()=>{let e=function(e){if(!e)return;let t=[];for(let r of e){let e=qr(r);e&&t.push({pointId:Kr(r),...e})}return t}(k)??[];return{scales:null,width:t,height:r,frameType:"network",pointNodes:e,sceneNodes:k}},[r,k,t]),P=dt.useMemo(()=>{if(!b)return b;let e=_(b);return T?le({annotations:e,context:M,..."object"==typeof T?T:{}}):e},[b,T,M]),L=dt.useMemo(()=>ce("network"),[]),O=P?de(P.filter(e=>"widget"!==e.type),L,A,M):null,W=!0===P?.some(e=>"widget"===e.type&&!0===e._annotationDeferred),F=pt(),{titleId:B,descId:z,labelledBy:$}=S(c||N||F);return Ct(St,{children:[W&&_t("style",{children:ue},"annotation-widget-disclosure-style"),Ct("svg",{"data-semiotic-overlay":"",role:d?"presentation":"img","aria-labelledby":d?void 0:$,width:i,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[!d&&Ct(St,{children:[_t("title",{id:B,children:C(a,"Network Chart")}),_t("desc",{id:z,children:E(a,l,{familyPhrase:"network data visualization",fallback:"Network data visualization"})})]}),_t("g",{transform:`translate(${s.left},${s.top})`,children:Ct(Fr,{view:e.viewTransform,width:t,height:r,children:[o.map((e,t)=>function(e,t,r="middle",i="auto"){return _t("text",{x:e.x,y:e.y,textAnchor:e.anchor||r,dominantBaseline:e.baseline||i,fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,transform:e.rotate?`rotate(${Math.round(180*e.rotate/Math.PI*100)/100} ${e.x} ${e.y})`:void 0,style:{pointerEvents:"none"},children:e.text},`net-label-${t}`)}(e,t,"start","middle")),O,v]})}),_t(he,{title:a,totalWidth:i,marginTop:s.top}),ye({legend:u,totalWidth:i,totalHeight:n,margin:s,legendPosition:f,title:a,legendLayout:m,legendHoverBehavior:h,legendClickBehavior:y,legendHighlightedCategory:g,legendIsolatedCategories:p})]}),_t(Ur,{annotations:P,sceneNodes:k,viewTransform:e.viewTransform,margin:s,width:t,height:r,activation:D})]})},"NetworkSVGOverlay");function Jr(e){return e&&{...e,sceneNodes:e.sceneNodes?.map(e=>({...e})),htmlMarks:e.htmlMarks?.map(e=>({...e}))}}function ei(e){let t=e.getBoundingClientRect();return{x:t.left+e.clientLeft,y:t.top+e.clientTop,width:e.clientWidth,height:e.clientHeight}}function ti(e,t){let r=Math.max(e.x,t.x),i=Math.max(e.y,t.y);return{x:r,y:i,width:Math.max(0,Math.min(e.x+e.width,t.x+t.width)-r),height:Math.max(0,Math.min(e.y+e.height,t.y+t.height)-i)}}function ri(e,t){return e.width>0&&e.height>0&&t.x+t.width>=e.x&&t.x<=e.x+e.width&&t.y+t.height>=e.y&&t.y<=e.y+e.height}var ii=[],ni=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]),si={position:"absolute",top:0,left:0,pointerEvents:"none"},oi=/*#__PURE__*/dt.memo(function({marks:e}){return _t(St,{children:e.map(e=>_t("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))})},(e,t)=>e.marks.length===t.marks.length&&e.marks.every((e,r)=>{let i=t.marks[r];return e.id===i.id&&e.x===i.x&&e.y===i.y&&e.width===i.width&&e.height===i.height&&e.content===i.content}));function ai({marks:e,margin:t,selection:r=null,width:i,height:n,viewTransform:s,viewport:o,htmlMarkCulling:a,onViewportChange:l}){let c=dt.useRef(null),[d,u]=dt.useState(null),h=function({containerRef:e,marks:t,width:r,height:i,margin:n,focusedId:s,viewTransform:o,viewport:a,htmlMarkCulling:l,onViewportChange:c}){let d=t??ii,[u,h]=ft(null),y=ut(null);gt(()=>{y.current?.schedule()},[d,r,i,n.left,n.top]),gt(()=>{let t=e.current,r=t?o?t.closest(".stream-network-frame"):function(e,t){if(void 0!==t?.scrollContainer)return t.scrollContainer;if(t?.scrollContainerRef)return t.scrollContainerRef.current;let r=e.ownerDocument.defaultView;for(let t=e.parentElement;t&&r;t=t.parentElement){let e=r.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e.overflow} ${e.overflowX} ${e.overflowY}`))return t}return null}(t,a):null,i=t&&r?function(e,t){let r=e.ownerDocument.defaultView,i=new Map;for(let n of[e.parentElement,t.parentElement])for(let e=n;e;e=e.parentElement){if(e===t||i.has(e))continue;let n=r.getComputedStyle(e),s=/(auto|scroll|overlay|hidden|clip)/.test(n.overflowX||n.overflow),o=/(auto|scroll|overlay|hidden|clip)/.test(n.overflowY||n.overflow);(s||o)&&i.set(e,{element:e,x:s,y:o})}return[...i.values()]}(t,r):[],n=y.current;if(n?.layer!==t||n?.root!==r||n.clips.length!==i.length||!i.every((e,t)=>K(e,n.clips[t])))if(n?.dispose(),y.current=null,t&&r){let e=t.ownerDocument.defaultView,n=null,s=()=>{n=null;let e=function(e,t,r){let i=ei(t);if(i.width<=0||i.height<=0)return null;let n=e.ownerDocument.defaultView,s=ti(i,{x:0,y:0,width:n.innerWidth,height:n.innerHeight});for(let e of r){let t=ei(e.element);s=ti(s,{x:e.x?t.x:s.x,y:e.y?t.y:s.y,width:e.x?t.width:s.width,height:e.y?t.height:s.height})}let o=e.getBoundingClientRect();return{...s,x:s.x-o.left,y:s.y-o.top}}(t,r,i);h(t=>K(t,e)?t:e)},o=()=>{null===n&&(n=e.requestAnimationFrame(s))};t.ownerDocument.addEventListener("scroll",o,{passive:!0,capture:!0}),e.addEventListener("resize",o,{passive:!0});let a=new ResizeObserver(o),l=new Set([r,t.parentElement,...i.map(e=>e.element)]);for(let e of l)a.observe(e);let c=()=>{null!==n&&e.cancelAnimationFrame(n),a.disconnect(),t.ownerDocument.removeEventListener("scroll",o,!0),e.removeEventListener("resize",o)};y.current={layer:t,root:r,clips:i,schedule:o,dispose:c},s()}else null!==u&&h(null)}),gt(()=>()=>{y.current?.dispose(),y.current=null},[]);let g=Number.isFinite(l?.overscan)&&l.overscan>=0?l.overscan:400,p=ht(()=>{let e=null!=r&&null!=i?{x:0,y:0,width:r,height:i}:null,t=u&&e?ti(u,e):u,a=o?t??e:u,c=o&&(t??e)?Wr(t??e,Lr(o)):t,h=a?{x:a.x-g,y:a.y-g,width:a.width+2*g,height:a.height+2*g}:null,y=o&&h?Wr(h,Lr(o)):h&&e?ti(h,e):h,p=new Set(l?.pinnedIds);null!==s&&p.add(s);let f=!1!==l?.enabled&&y?d.filter(e=>p.has(e.id)||ri(y,e)):d,m={...e?{plotRect:{...e,x:n.left,y:n.top}}:{},visibleRect:c,renderRect:y,visibleMarkIds:c?d.filter(e=>ri(c,e)).map(e=>e.id):null,mountedMarkIds:f.map(e=>e.id)};return{mounted:f,snapshot:m}},[d,u,r,i,g,l?.enabled,l?.pinnedIds,s,o,n.left,n.top]),f=p(),[,m]=mt(e=>e+1,0),v=ut(void 0),k=ht(e=>{c?K(v.current,e)||(v.current=e,c(e)):v.current=void 0},[c]);return vt(()=>{let e=p();ni(e.mounted,f.mounted)&&k(e.snapshot)},[p,k,f.mounted]),gt(()=>Dr(o)?.subscribe(()=>{let e=p();ni(e.mounted,f.mounted)?k(e.snapshot):m()},!0),[p,k,f.mounted,o]),f.mounted}({containerRef:c,marks:e,width:i,height:n,focusedId:d,viewTransform:s,viewport:o,htmlMarkCulling:a,onViewportChange:l,margin:t});if(dt.useLayoutEffect(()=>{if(null===d||e?.some(e=>e.id===d))return;let t=c.current,r=t?.ownerDocument;r?.activeElement===r?.body&&t?.closest(".stream-network-frame")?.focus({preventScroll:!0}),u(null)},[e,d]),!(e&&0!==e.length||l||null!==d))return null;let y=Lr(s),g=_t("div",{className:"semiotic-network-html-marks",ref:c,onFocusCapture:e=>{let t=e.target.closest("[data-mark-id]");t&&e.currentTarget.contains(t)&&u(t.dataset.markId??null)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||u(null)},style:{...si,transform:`translate(${t.left}px, ${t.top}px)`,...s?{width:i,height:n,overflow:"clip"}:{}},children:_t("div",{ref:Mr(s,!0),style:{transformOrigin:"0 0",transform:`translate(${y.x}px, ${y.y}px) scale(${y.k})`},children:_t(oi,{marks:h.map(e=>({...e}))})})});return _t(Y,{value:r,children:g})}var li=/*#__PURE__*/dt.lazy(()=>import("./c-GZJ2XEQ5.min.js"));function ci(e){let{nodes:t,edges:r,chartTitle:i,chartType:n,tableId:s}=e,o=ge(),{nodeCount:a,edgeCount:l}=function(e,t){let r=0,i=0;for(let t of e)t&&"object"==typeof t&&null!==t.datum&&r++;for(let e of t){if(!e||"object"!=typeof e)continue;let t=e.datum,r=t&&"object"==typeof t&&!Array.isArray(t)&&"__chordEdges"in t?t.__chordEdges:void 0;i+=Array.isArray(r)?r.length:1}return{nodeCount:r,edgeCount:i}}(t,r);return a||l?_t(pe,{interaction:o,tableId:s,regionLabel:`Data summary for ${i||(s?`${n} ${s}`:n)}`,countLabel:`${a} nodes, ${l} edges`,className:tt,children:o.isExpanded&&_t(dt.Suspense,{fallback:_t("div",{role:"status",children:"Loading data summary…"}),children:_t(li,{...e,revealRows:o.revealRows})})}):s?_t("span",{id:s,tabIndex:-1,style:$e}):null}function di(e){return Ct(St,{children:[_t(fe,{tableId:e.tableId}),_t(ci,{...e})]})}function ui(e,t,r,i){let{accessibleTable:n=!0,summary:s,title:o}=e;return Ct(St,{children:[n&&_t(me,{accessibleTable:n,children:_t(di,{sceneRevision:i,nodes:t.sceneNodes,edges:t.sceneEdges,chartType:"Network chart",tableId:r,chartTitle:"string"==typeof o?o:void 0})}),_t(ve,{summary:s})]})}function hi(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function yi(e,t){let r="source-over"===e.globalCompositeOperation;for(let i of t)if(!r||0!==i.style.opacity&&0!==i.style.strokeOpacity||i.style.fill&&"none"!==i.style.fill&&0!==(i.style.fillOpacity??("curved"===i.type?.1:i.style.opacity))||"_pulseIntensity"in i&&i._pulseIntensity)switch(i.type){case"bezier":gi(e,i);break;case"line":pi(e,i);break;case"ribbon":fi(e,i);break;case"curved":mi(e,i)}}function gi(e,t){if(!t.pathD)return;e.save(),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.style.strokeLinecap&&(e.lineCap=t.style.strokeLinecap);let r=hi(t);if(t.style.fill&&"none"!==t.style.fill){let i=t._gradient;if(i){let r=e.createLinearGradient(i.x0,i.y0??0,i.x1,i.y1??0),n=t.style.fillOpacity??t.style.opacity??.5,s="string"==typeof t.style.fill?t.style.fill:"#999",o=Ge(e,s)||s;r.addColorStop(0,1===i.from?o:"transparent"),r.addColorStop(1,1===i.to?o:"transparent"),e.fillStyle=r,e.globalAlpha=n}else e.fillStyle=Qe(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(r)}t.style.stroke&&"none"!==t.style.stroke&&(t.style.strokeWidth??.5)>0&&(e.strokeStyle=Ge(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=(t.style.opacity??1)*(t.style.strokeOpacity??1)*.5,e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(r)),e.restore()}function pi(e,t){if("none"===t.style.stroke||(t.style.strokeWidth??1)<=0)return;e.save(),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.style.strokeLinecap&&(e.lineCap=t.style.strokeLinecap);let r=t.style.stroke||"#999";e.strokeStyle=Ge(e,r)||r,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=(t.style.opacity??e.globalAlpha)*(t.style.strokeOpacity??1),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function fi(e,t){if(!t.pathD)return;e.save(),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.style.strokeLinecap&&(e.lineCap=t.style.strokeLinecap);let r=hi(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Qe(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(t.style.strokeWidth??.5)>0&&(e.strokeStyle=Ge(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=(t.style.opacity??1)*(t.style.strokeOpacity??1)*.3,e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(r)),e.restore()}function mi(e,t){if(!t.pathD)return;e.save(),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),t.style.strokeLinecap&&(e.lineCap=t.style.strokeLinecap);let r=hi(t);if("none"!==t.style.stroke&&(t.style.strokeWidth??1)>0){let i=t.style.stroke||"#999";e.strokeStyle=Ge(e,i)||i,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=(t.style.opacity??e.globalAlpha)*(t.style.strokeOpacity??1),e.stroke(r)}t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=Qe(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(r)),e.restore()}var vi=null;function ki(e){if(typeof Path2D>"u"||!e)return null;vi||(vi=new Map);let t=vi.get(e);return t||(t=new Path2D(e),vi.size>2048&&vi.clear(),vi.set(e,t)),t}function bi(e,t,r,i){if(!r?.length||!t.fill)return;let n=e.globalAlpha,s=(t.opacity??n)*(t.fillOpacity??1);if(!(s>0))return;let a=Qe(e,t.fill,i),l=a;if("string"!=typeof a||!/^\s*(none|transparent)\s*$/i.test(a)&&(e.fillStyle=a,l=e.fillStyle,!/^rgba\(.*,\s*0(\.0+)?\s*\)$/.test(l))){e.globalAlpha=s;for(let t of r){let r=ki(t.pathD);r&&(e.fillStyle="string"==typeof l?o(l,t.shade):l,e.fill(r))}e.globalAlpha=n}}function xi(e,t){let r="source-over"===e.globalCompositeOperation;for(let i of t){if("rect"!==i.type)continue;let t=i;if(t.w<=0||t.h<=0||r&&Ke(t.style,t._pulseIntensity))continue;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity);let n=t.pathD?ki(t.pathD):null;n?(bi(e,t.style,t.faces,"#007bff"),qe(e,t.style,"#007bff",()=>e.fill(n)),Ue(e,t.style,()=>e.stroke(n)),$(e,t,.3,n)):(qe(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),Ue(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),$(e,t)),e.restore()}}function wi(e,t){let r="source-over"===e.globalCompositeOperation;for(let i of t){if("circle"!==i.type)continue;let t=i;if(t.r<=0||r&&Ke(t.style,t._pulseIntensity))continue;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity);let n=t.pathD?ki(t.pathD):null;n?(bi(e,t.style,t.faces,"#007bff"),qe(e,t.style,"#007bff",()=>e.fill(n)),Ue(e,t.style,()=>e.stroke(n))):(e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),qe(e,t.style,"#007bff",()=>e.fill()),Ue(e,t.style,()=>e.stroke())),j(e,t),e.restore()}}function _i(e,t){let r="source-over"===e.globalCompositeOperation;for(let i of t){if("arc"!==i.type)continue;let t=i;if(r&&Ke(t.style))continue;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity);let n=t.pathD?ki(t.pathD):null;n?(bi(e,t.style,t.faces,"#007bff"),qe(e,t.style,"#007bff",()=>e.fill(n)),Ue(e,t.style,()=>e.stroke(n))):(e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),qe(e,t.style,"#007bff",()=>e.fill()),Ue(e,t.style,()=>e.stroke())),e.restore()}}var Si={rect:xi,circle:wi,arc:_i,symbol:function(e,t){if(!t.some(e=>"symbol"===e.type&&e.faces))return void u(e,t);let r=e.globalAlpha;for(let i of t)"symbol"===i.type&&(i.faces&&(bi(e,{...i.style,opacity:r*(i.style.opacity??1)},i.faces,"#007bff"),e.globalAlpha=r),u(e,[i]))},glyph:h};function Ci(e){return ke(e.sceneNodes.length,e.sceneEdges.length,e.perspective.label("Network chart"))}var Ei=2*Math.PI,Ni=e=>(e%Ei+Ei)%Ei;function Ri(e,t){let r=1-t;return r**3*e[0]+3*r*r*t*e[1]+3*r*t*t*e[2]+t**3*e[3]}function Ti(e,t){let r=e.map(e=>e[0]),i=e.map(e=>e[1]);t(r[0],i[0]),t(r[3],i[3]);for(let e of[r,i]){let n=-e[0]+3*e[1]-3*e[2]+e[3],s=2*(e[0]-2*e[1]+e[2]),o=e[1]-e[0],a=Math.abs(n)<1e-12?0===s?[]:[-o/s]:s*s-4*n*o<0?[]:[(-s+Math.sqrt(s*s-4*n*o))/(2*n),(-s-Math.sqrt(s*s-4*n*o))/(2*n)];for(let e of a)e>0&&e<1&&t(Ri(r,e),Ri(i,e))}}function Ai(e,t,r,i){let[n,s]=r.map(Math.abs);if(i(...e),i(...t),0===n||0===s||e[0]===t[0]&&e[1]===t[1])return;let o=r[2]*Math.PI/180,a=Math.cos(o),l=Math.sin(o),c=(e[0]-t[0])/2,d=(e[1]-t[1])/2,u=a*c+l*d,h=-l*c+a*d,y=Math.hypot(u/n,h/s);y>1&&(n*=y,s*=y);let g=(u/n)**2+(h/s)**2,p=(r[3]===r[4]?-1:1)*Math.sqrt(Math.max(0,(1-g)/g)),f=p*n*h/s,m=-p*s*u/n,v=a*f-l*m+(e[0]+t[0])/2,k=l*f+a*m+(e[1]+t[1])/2,b=Math.atan2((h-m)/s,(u-f)/n),x=Math.atan2((-h-m)/s,(-u-f)/n),w=r[4]?Ni(x-b):-Ni(b-x),_=Math.atan2(-s*l,n*a),S=Math.atan2(s*a,n*l);for(let e of[_,_+Math.PI,S,S+Math.PI])Ni(w>=0?e-b:b-e)<=Math.abs(w)+1e-12&&i(v+n*a*Math.cos(e)-s*l*Math.sin(e),k+n*l*Math.cos(e)+s*a*Math.sin(e))}function Ii(e){let t=0,r="",i="",n=[0,0],s=[0,0],o=[0,0],a=1/0,l=1/0,c=-1/0,d=-1/0,u=(e,t)=>{a=Math.min(a,e),l=Math.min(l,t),c=Math.max(c,e),d=Math.max(d,t)},h=()=>{for(;t<e.length&&/[\s,]/.test(e[t]);)t++},y=(r=!1)=>{h();let i=r?/^[01]/.exec(e.slice(t)):/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(t));return i?(t+=i[0].length,Number(i[0])):NaN};for(;t<e.length&&(h(),t!==e.length);){/[a-z]/i.test(e[t])&&(r=e[t++]);let a=r.toUpperCase(),l=r!==a;if(!i&&"M"!==a)return null;if("Z"===a){u(...n),u(...s),n=[...s],i="Z",r="";continue}let c={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7}[a];if(!c)return null;let d=Array.from({length:c},(e,t)=>y("A"===a&&(3===t||4===t)));if(!d.every(Number.isFinite))return null;let h=e=>[d[e]+(l?n[0]:0),d[e+1]+(l?n[1]:0)],g="H"===a?[d[0]+(l?n[0]:0),n[1]]:"V"===a?[n[0],d[0]+(l?n[1]:0)]:h(c-2),p=[2*n[0]-o[0],2*n[1]-o[1]];if("C"===a||"S"===a){let e="C"===a?h(0):/[CS]/.test(i)?p:n;o=h(c-4),Ti([n,e,o,g],u)}else"Q"===a||"T"===a?(o="Q"===a?h(0):/[QT]/.test(i)?p:n,Ti([n,[n[0]+2*(o[0]-n[0])/3,n[1]+2*(o[1]-n[1])/3],[g[0]+2*(o[0]-g[0])/3,g[1]+2*(o[1]-g[1])/3],g],u)):"A"===a?Ai(n,g,d,u):"M"!==a&&(u(...n),u(...g));n=g,"M"===a&&(s=[...g],r=l?"l":"L"),i=a}return[a,l,c,d].every(Number.isFinite)?{x:a,y:l,w:c-a,h:d-l}:null}var Di=/*#__PURE__*/new WeakMap;function Mi(e){let t=Di.get(e);return(!t||t.source!==e.pathD)&&(t={source:e.pathD,box:Ii(e.pathD)},Di.set(e,t)),t.box}function Pi(e){if(1===e.length)return e[0];let t={x0:1/0,y0:1/0,x1:-1/0,y1:-1/0,radius:0,order:-1};for(let r of e)t.x0=Math.min(t.x0,r.x0),t.y0=Math.min(t.y0,r.y0),t.x1=Math.max(t.x1,r.x1),t.y1=Math.max(t.y1,r.y1),t.radius=Math.max(t.radius,r.radius),t.order=Math.max(t.order,r.order);if(e.length<=8)t.children=e.sort((e,t)=>t.order-e.order);else{let r=t.x1-t.x0>=t.y1-t.y0;e.sort((e,t)=>r?e.x0+e.x1-(t.x0+t.x1):e.y0+e.y1-(t.y0+t.y1));let i=e.length>>1;t.children=[Pi(e.slice(0,i)),Pi(e.slice(i))].sort((e,t)=>t.order-e.order)}return t}function Li(e,t,r,i,n){let s=null,o=-1,a=e=>{if(e.order<=o)return;let l=10*Math.max(i,e.radius)+1e-7;if(!(t<e.x0-l||t>e.x1+l||r<e.y0-l||r>e.y1+l))if(e.children)e.children.forEach(a);else{let t=n(e.order);t&&(s=t,o=e.order)}};return a(e),s}function Oi(e){let t=e.style.strokeWidth??1;return Number.isFinite(t)?Math.max(0,t/2):1/0}var Wi=/*#__PURE__*/new WeakMap;function Fi(e){return[e,null!=e.datum&&!1!==e.interactive,e.style.strokeWidth,!!e.style.fill&&"none"!==e.style.fill,..."line"===e.type?[e.x1,e.y1,e.x2,e.y2]:[e.pathD]]}function Bi(e){let t=e.map(Fi),r=Wi.get(e);if(r&&r.signatures.length===t.length&&t.every((e,t)=>e.length===r.signatures[t].length&&e.every((e,i)=>2===i||Object.is(e,r.signatures[t][i])))){if(t.some((e,t)=>!Object.is(e[2],r.signatures[t][2]))){let t=r=>(r.radius=r.children?Math.max(0,...r.children.map(t)):Oi(e[r.order]),r.radius);t(r.index.root)}return r.signatures=t,r.index}let i=[];e.forEach((e,t)=>{if(null==e.datum||!1===e.interactive)return;let r="line"===e.type?{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}:Mi(e),n=Oi(e);for(let s of function(e,t){if(!t||t.w<256||t.h<256||"line"===e.type||e.style.fill&&"none"!==e.style.fill)return null;let r=e.pathD.match(/[a-zA-Z]|[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g);if(!r||10!==r.length||"M"!==r[0]||"C"!==r[3])return null;let i=[1,4,6,8].map(e=>[Number(r[e]),Number(r[e+1])]),n=[],s=(e,t)=>{let r=e.map(e=>e[0]),i=e.map(e=>e[1]),o=Math.min(...r),a=Math.min(...i),l=Math.max(...r)-o,c=Math.max(...i)-a;if(!t||l<4||c<4)return void n.push({x:o,y:a,w:l,h:c});let d=[e[0]],u=[e[3]];for(;e.length>1;)e=e.slice(1).map((t,r)=>[(t[0]+e[r][0])/2,(t[1]+e[r][1])/2]),d.push(e[0]),u.unshift(e[e.length-1]);s(d,t-1),s(u,t-1)};return s(i,2),n}(e,r)??[r])i.push({x0:s?.x??-1/0,y0:s?.y??-1/0,x1:s?s.x+s.w:1/0,y1:s?s.y+s.h:1/0,radius:n,order:t})});let n={edges:e,root:Pi(i)};return Wi.set(e,{index:n,signatures:t}),n}function zi(e){if(!e.length||e.some(e=>"rect"!==e.type||![e.x,e.y,e.w,e.h,e.x+e.w,e.y+e.h].every(e=>Number.isFinite(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER)))return;let t=e;return{nodes:e,root:Pi(t.map((e,t)=>({x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y+e.h,radius:0,order:t}))),paintOrder:t.some(e=>!!e._hitPath)}}function $i(e,t){return(e.depth??-1)>(t?.depth??-1)}function ji(e,t,r,i){let n=r<=e.r,s=i<=t.r;if(n!==s)return n;if(n&&s){let r=t.r-e.r;if(r&&Math.hypot(e.cx-t.cx,e.cy-t.cy)<=Math.abs(r)+1e-6)return r>0}return r<i||r===i&&$i(e,t)}var Yi={rect:0,circle:1,arc:2,symbol:3,glyph:4};function Hi(e,t){let r=e.w*e.h,i=t.w*t.h;return r<i||r===i&&$i(e,t)}function Xi(e,t,r,i,n=0){return{type:e,mark:t,datum:t.datum,x:r,y:i,distance:n}}function Vi(e,t,r,i,n){if(!e.datum)return null;switch(e.type){case"circle":return e.pathD&&!e._perspectiveToken?Qi(e,t,r,e.cx,e.cy):Gi(e,t,r,e.cx,e.cy,e.r,i,n);case"rect":{let i=function(e,t,r){let i=M(t,r,e);return i.hit?Xi("node",e,i.cx,i.cy):null}(e,t,r);if(!i||!e._hitPath)return i;let n=e._hitPath,[s,o,a,l]=n.transform,c=Ui(n),d=qi();if(!c||!d||0===a||0===l)return null;let u=(t-s)/a,h=(r-o)/l;if(n.fill&&d.isPointInPath(c,u,h))return i;if(n.strokeWidth>0){let e=d.lineWidth;d.lineWidth=n.strokeWidth;let t=d.isPointInStroke(c,u,h);if(d.lineWidth=e,t)return i}return null}case"arc":return function(e,t,r,i){if(e.pathD)return Qi(e,t,r,t,r);let n=t-e.cx,s=r-e.cy,o=Math.sqrt(n*n+s*s),a=2/i;if(o<e.innerR-a||o>e.outerR+a)return null;let l=P(Math.atan2(s,n)),c=P(e.startAngle),d=P(e.endAngle);if(c<=d?l>=c&&l<=d:l>=c||l<=d){let t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return Xi("node",e,e.cx+r*Math.cos(t),e.cy+r*Math.sin(t))}return null}(e,t,r,n);case"symbol":return Gi(e,t,r,e.cx,e.cy,et(e.size),i,n);case"glyph":{let s=Je(e.glyph,e.size);return Gi(e,t,r,e.cx+s.centerDx,e.cy+s.centerDy,s.radius,i,n)}default:return null}}function Gi(e,t,r,i,n,s,o,a){let l=t-i,c=r-n,d=Math.sqrt(l*l+c*c);return d<=D(s,o,a)?Xi("node",e,i,n,d):null}function Qi(e,t,r,i,n){let s=Ui(e),o=qi();return s&&o&&o.isPointInPath(s,t,r)?Xi("node",e,i,n):null}var Ki=null;function qi(){if(!Ki){let e=document.createElement("canvas");e.width=e.height=1,Ki=e.getContext("2d")}return Ki}function Ui(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function Zi(e,t,r,i){switch(e.type){case"bezier":case"ribbon":case"curved":return function(e,t,r,i){if(!e.pathD)return null;if(function(e,t,r,i){let n=Mi(e);return!!n&&(t<n.x-i||t>n.x+n.w+i||r<n.y-i||r>n.y+n.h+i)}(e,t,r,10*Math.max(i,(e.style.strokeWidth??1)/2)+1e-7))return null;let n=Ui(e),s=qi();if(!n||!s)return null;try{if(e.style.fill&&"none"!==e.style.fill&&s.isPointInPath(n,t,r))return Xi("edge",e,t,r);if("none"===e.style.stroke||(e.style.strokeWidth??1)<=0)return null;let o,a=s.lineWidth;try{s.lineWidth=Math.max(2*i,e.style.strokeWidth??1),o=s.isPointInStroke(n,t,r)}finally{s.lineWidth=a}if(o)return Xi("edge",e,t,r,4)}catch{}return null}(e,t,r,i);case"line":return function(e,t,r,i){if("none"===e.style.stroke||(e.style.strokeWidth??1)<=0)return null;i=Math.max(i,(e.style.strokeWidth??1)/2);let n=e.x2-e.x1,s=e.y2-e.y1,o=n*n+s*s;if(0===o)return null;let a=((t-e.x1)*n+(r-e.y1)*s)/o;a=Math.max(0,Math.min(1,a));let l=e.x1+a*n,c=e.y1+a*s,d=Math.sqrt((t-l)**2+(r-c)**2);return d<=i?Xi("edge",e,l,c,d):null}(e,t,r,i);default:return null}}function Ji(e){let{clientX:t,clientY:r,canvasRect:i,margin:n,adjustedWidth:s,adjustedHeight:o,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:d,hitRadius:u=12,includeEdges:h=!0}=e,y=t-i.left-n.left,g=r-i.top-n.top;if(y<0||y>s||g<0||g>o)return{kind:"miss-outside"};let p=Lr(e.viewTransform),f=function(e,t,r,i,n=12,s,o=0,a=!0,l=1,c,d){let u=null,h=d?.nodes===e?d:void 0,y=h?h.paintOrder:e.some(e=>"rect"===e.type&&e._hitPath);if(y&&(s=null),s){let e=I(s,r,i,n,o,e=>e.cx,e=>e.cy,e=>e.r,ji,l);e&&(u=Xi("node",e.node,e.node.cx,e.node.cy,e.distance))}for(let t of h?function(e,t,r){let i=[];return Li(e.root,t,r,0,e=>(i.push(e),null)),i.sort((e,t)=>e-t).map(t=>e.nodes[t])}(h,r,i):e){if(s&&"circle"===t.type)continue;let e=Vi(t,r,i,n,l);if(!e)continue;if(!u||y){u=e;continue}let o=u.mark;(t.type!==o.type?Yi[t.type]>Yi[o.type]:"rect"===t.type?Hi(t,o):"circle"===t.type?ji(t,o,e.distance,u.distance):e.distance<u.distance)&&(u=e)}if(u)return u;if(!a)return null;if(c?.edges===t)return function(e,t,n,s){return Li(e.root,t,n,s,t=>Zi(e.edges[t],r,i,5/l))}(c,r,i,5/l);for(let e=t.length-1;e>=0;e--){let n=t[e];if(null==n.datum||!1===n.interactive)continue;let s=Zi(n,r,i,5/l);if(s)return s}return null}(a,l,(y-p.x)/p.k,(g-p.y)/p.k,u/p.k,c,d,h,p.k,e.edgeIndex,e.rectIndex);if(!f)return{kind:"miss"};let m=f.datum||{};return{kind:"hit",hover:je(m,f.x,f.y,{nodeOrEdge:f.type}),mark:f.mark}}var en="StreamNetworkFrame";function tn(e,t,r){return e.nodes=Se(t),e.edges=Se(r),e.nodes||e.edges}var rn=/*#__PURE__*/new WeakMap;function nn(e){let t=e.lastCustomLayoutResult;if(!t)return void rn.delete(e);let r=e.getUpdateSnapshot().revisions;rn.set(e,{hits:{edgeIndex:!1===t.edgeHitTesting?void 0:Bi(e.sceneEdges),rectIndex:zi(e.sceneNodes)},nodes:e.sceneNodes,edges:e.sceneEdges,geometry:r.sceneGeometry,style:r.sceneStyle})}function sn(e){let t=rn.get(e);if(!t)return;let r=e.getUpdateSnapshot().revisions;return t.geometry===r.sceneGeometry&&t.style===r.sceneStyle&&t.nodes===e.sceneNodes&&t.edges===e.sceneEdges?t.hits:void 0}var on=[800,600],an=/*#__PURE__*/oe(/*#__PURE__*/kt(/*#__PURE__*/bt(function(t,o){let{chartType:a,nodes:l,edges:g,data:p,initialEdges:f,nodeIDAccessor:m="id",sourceAccessor:w="source",targetAccessor:_="target",valueAccessor:S="value",edgeIdAccessor:C,edgeIdentity:E,childrenAccessor:I,hierarchySum:D,orientation:M="horizontal",nodeAlign:P="justify",nodePaddingRatio:$=.05,nodeWidth:j=15,iterations:Y=300,forceStrength:X=.1,layoutExecution:V="auto",layoutLoadingContent:Q,onLayoutStateChange:K,padAngle:U=.01,groupWidth:Z=20,sortGroups:J,edgeSort:ee,treeOrientation:re="vertical",edgeType:ie="curve",padding:ne,paddingTop:se,tensionConfig:oe,showParticles:ae=!1,particleStyle:le,renderMode:ce,perspective:de,nodeStyle:ue,edgeStyle:he,colorBy:ye,colorScheme:ge="category10",edgeColorBy:pe="source",edgeOpacity:fe=.5,colorByDepth:me=!1,nodeSize:ve=8,nodeSizeRange:ke=[5,20],nodeLabel:Se,showLabels:$e=!0,labelMode:je,size:Ye=on,responsiveWidth:Xe,responsiveHeight:Ve,margin:Qe,background:Ke,maxDevicePixelRatio:qe,enableHover:Ue=!0,tooltipContent:Ze,customHoverBehavior:Je,customClickBehavior:et,onObservation:tt,annotationObservationCallback:rt,chartId:it,onTopologyChange:nt,annotations:ot,onAnnotationActivate:at,autoPlaceAnnotations:lt,svgAnnotationRules:ct,legend:yt,legendPosition:pt,legendLayout:mt,legendHoverBehavior:kt,legendClickBehavior:bt,legendHighlightedCategory:Et,legendIsolatedCategories:Nt,legendCategoryAccessor:Rt,onCategoriesChange:Tt,title:At,foregroundGraphics:It,backgroundGraphics:Dt,decay:Pt,pulse:Lt,transition:Ot,animate:Wt,staleness:Ft,frameScheduler:Bt,clock:zt,random:jt,seed:Yt,paused:Ht=!1,suspendWhenHidden:Xt=!0,thresholds:Vt,description:Qt,orbitMode:Kt,orbitSize:qt,orbitSpeed:Ut,orbitRevolution:Zt,orbitRevolutionStyle:Jt,orbitEccentricity:er,orbitShowRings:ir,orbitAnimated:nr,customNetworkLayout:sr,onLayoutError:or,layoutConfig:ar,layoutSelection:lr}=t,cr=y(a),dr=ut(!0),ur=Ne({sizeProp:Ye,responsiveWidth:Xe,responsiveHeight:Ve,userMargin:Qe,marginDefault:cr,title:At,legend:yt,legendPosition:pt,legendLayout:mt,legendMarginReserved:t.__legendMarginReservedFor===yt,animate:Wt,transitionProp:Ot,frameScheduler:Bt,clock:zt,random:jt,seed:Yt,paused:Ht,suspendWhenHidden:Xt,themeDirtyRef:dr}),{reducedMotionRef:hr,responsiveRef:yr,size:gr,margin:pr,adjustedWidth:fr,adjustedHeight:mr,transition:vr,introEnabled:kr,tableId:br,rafRef:xr,renderFnRef:wr,scheduleRender:_r,frameRuntime:Sr,currentTheme:Cr}=ur,{resolvedForeground:Er,resolvedBackground:Ar,themeBackground:Ir,surfaceBackground:Mr}=L({foregroundGraphics:It,backgroundGraphics:Dt,size:gr,margin:pr,scales:null,background:Ke,themeBackgroundColor:Cr.colors.background}),Pr=Re(),Or=Te(),Wr=`${br}-frame`,[Br,zr]=ft(()=>!G&&Or?document.getElementById(Wr)?.innerHTML??0:0),$r="string"==typeof Br?Br:null,Xr=$t.has(a),Qr=Xr?p||(Array.isArray(g)?void 0:g):void 0,Kr=null!=l||null!=g,qr=!1===Wt,Ur=xt(()=>({...tr,...oe,...qr?{transitionDuration:0}:{}}),[oe,qr]),ei=xt(()=>({...rr,...le}),[le]),ti=function(e){let t=dt.useRef(null),r=s(e);return(!t.current||t.current.key!==r)&&(t.current={key:r,value:e}),t.current.value}(de),ri=xt(()=>function(e){let{currentTheme:t,...r}=e;return{...r,themeCategorical:t?.colors?.categorical,themeSequential:t?.colors?.sequential,themeSelectionOpacity:t?.colors?.selectionOpacity,themeSemantic:st(t)}}({chartType:a,clock:Sr.now,random:jt,seed:Yt,nodeIDAccessor:m,sourceAccessor:w,targetAccessor:_,valueAccessor:S,edgeIdAccessor:C,edgeIdentity:E,childrenAccessor:I,hierarchySum:D,orientation:M,nodeAlign:P,nodePaddingRatio:$,nodeWidth:j,iterations:Y,forceStrength:X,padAngle:U,groupWidth:Z,sortGroups:J,edgeSort:ee,treeOrientation:re,edgeType:ie,padding:ne,paddingTop:se,tensionConfig:Ur,showParticles:ae,particleStyle:ei,nodeStyle:ue,edgeStyle:he,nodeLabel:Se,showLabels:$e,labelMode:je,colorBy:ye,colorScheme:ge,edgeColorBy:pe,edgeOpacity:fe,colorByDepth:me,nodeSize:ve,nodeSizeRange:ke,decay:Pt,pulse:Lt,transition:vr,introAnimation:kr,staleness:Ft,thresholds:Vt,orbitMode:Kt,orbitSize:qt,orbitSpeed:Ut,orbitRevolution:Zt,orbitRevolutionStyle:Jt,orbitEccentricity:er,orbitShowRings:ir,orbitAnimated:nr,customNetworkLayout:sr,onLayoutError:or,layoutConfig:ar,perspective:ti,currentTheme:Cr}),[ti,a,Sr.now,jt,Yt,m,w,_,S,C,E,I,D,M,P,$,j,Y,X,U,Z,J,ee,re,ie,ne,se,Ur,ae,ei,ue,he,Se,$e,je,ye,ge,pe,fe,me,ve,ke,Pt,Lt,vr,kr,Ft,Vt,Kt,qt,Ut,Zt,Jt,er,ir,nr,sr,or,ar,Cr]),ii=Ae(ri),ni=Ae({chartType:a,nodeIDAccessor:m,sourceAccessor:w,targetAccessor:_,valueAccessor:S,edgeIdAccessor:C,edgeIdentity:E,childrenAccessor:I,hierarchySum:D,orientation:M,nodeAlign:P,nodePaddingRatio:$,nodeWidth:j,iterations:Y,forceStrength:X,nodeSize:"force"===a?ve:void 0,nodeSizeRange:"force"===a?ke:void 0,padAngle:U,groupWidth:Z,sortGroups:J,edgeSort:ee,treeOrientation:re,edgeType:ie,padding:ne,paddingTop:se,random:jt,seed:Yt,tensionConfig:Ur,customNetworkLayout:sr,orbitMode:Kt,orbitSize:qt,orbitEccentricity:er}),si=ut(0),oi=ut(0),li=ut(!1),ci=ut(null);ci.current||(ci.current=new Nr(ii));let di=G||!Pr&&Or||null!==$r,hi=di&&null===$r?function(e,{nodes:t,edges:r,hierarchy:i},n){let s=new Nr(e);return i?s.ingestHierarchy(i,n):s.ingestBounded(q(t),q(r),n),s.cancelIntroAnimation(),s.buildScene(n),s}(ii,{nodes:l,edges:Array.isArray(g)?g:void 0,hierarchy:Qr},[fr,mr]):null,gi=O(ci,Rt,Tt,e=>Array.from(e.nodes.values()).map(e=>e.data?{id:e.id,...e.data}:e)),pi=Ie("StreamNetworkFrame"),fi=ht((e,t,r=!1)=>De(pi.current,e,()=>e.buildScene(t),r),[pi]),[mi]=ft(Hr),vi=mi.set,[ki,bi]=ft(0),[Ei,Ni]=ft(!1),[Ri,Ti]=ft(!1),Ai=ut(0),Ii=ut(null),Di=ut(K);Di.current=K;let Mi=ht((e,t="ready")=>{zr(e.layoutVersion),Ti(!1),Di.current?.(t)},[]),Pi=ut(ii);Pi.current=ii;let Li=ut(null),{customHoverBehavior:Oi,customClickBehavior:Wi}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:i}){return{customHoverBehavior:ht((t,n)=>{e?.(t,n),we({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:en,chartId:i,context:n})},[e,r,i]),customClickBehavior:ht((e,n)=>{t?.(e,n),_e({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:en,chartId:i,context:n})},[t,r,i])}}({customHoverBehavior:Je,customClickBehavior:et,onObservation:tt,chartId:it}),{hoverHandlerRef:Fi,hoverLeaveRef:Bi,onPointerMove:zi,onPointerLeave:$i,pointerStateRef:ji}=ur,{kbFocusIndexRef:Yi,focusedNavPointRef:Hi,neighborIndexRef:Xi,onKeyDown:Vi,refreshKeyboardFocus:Gi}=function(e){let{storeRef:t}=e,r=ut({get scene(){return t.current?.sceneNodes??[]},get version(){return t.current?.layoutVersion??-1}}),i=ht((e,r,i,n)=>v(e,k(r,i),r,t.current?.sceneEdges??[],n),[t]);return b({...e,storeRef:r,extractPoints:x,toHover:Tr,nextConnected:i})}({storeRef:ci,hoverRef:Li,setHoverPoint:vi,customHoverBehavior:Oi,customClickBehavior:Wi,scheduleRender:_r,clearPointerHover:$i}),Qi=ut({nodes:!1,edges:!1}),Ki=ut(new Map),qi=ut(0),Ui=ut(ge);Ui.current=ge;let Zi=ht(e=>function(e){let{node:t,colorBy:r,colorScheme:i,nodeColorMap:n,colorIndexRef:s}=e;if("function"==typeof r)return String(r(t));if("string"==typeof r&&t.data){let e=t.data[r];if(void 0!==e){if(!n.has(String(e))){let t=Array.isArray(i)?i:He;n.set(String(e),t[s.current++%t.length])}return n.get(String(e))}}if(n.has(t.id))return n.get(t.id);let o=Array.isArray(i)?i:He,a=r?o[s.current++%o.length]:o[0];return n.set(t.id,a),a}({node:e,colorBy:ye,colorScheme:ge,nodeColorMap:Ki.current,colorIndexRef:qi}),[ye,ge]),rn=ht(e=>{qi.current=function(e){let{sceneNodes:t,nodes:r,nodeColorMap:i,colorScheme:n}=e;for(let e of t)e.id&&"string"==typeof e.style?.fill&&i.set(e.id,e.style.fill);let s=Array.isArray(n)?n:He,o=Array.from(r);for(let e=0;e<o.length;e++){let t=o[e];i.has(t.id)||i.set(t.id,s[e%s.length])}return o.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Ki.current,colorScheme:Ui.current})},[]),an=ut(null),ln=ht((e,t)=>{fi(e,t),nn(e),Gi(),an.current=t,gi(),rn(e),tn(Qi.current,e.sceneNodes,e.sceneEdges),dr.current=!1,e.markStylePaintPending()},[fi,gi,rn,Gi]),cn=ht(()=>{ci.current?.markStylePaintPending()},[]),{canvasRef:dn,resolutionDirtyRef:un}=Me(ur,{hydrated:Pr&&null===$r,wasHydratingFromSSR:Or,storeRef:ci,dirtyRef:dr,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:cn,maxDevicePixelRatio:qe,canvasPaintDependencies:[a,fr,mr,Ke,Dt,ce,_r]}),hn=(vn=Cr,vn?.colors?.border||vn?.colors?.secondary||vn?.colors?.primary||"#999"),yn=ht(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,ci.current?.nodes),[]),gn=ht(e=>function(e){let{edge:t,edgeColorBy:r,getNodeColor:i,resolveEndpoint:n,fallback:s}=e;if("function"==typeof r)return r(t);let o=n(t.source),a=n(t.target);return"target"===r&&a?i(a):o?i(o):s}({edge:e,edgeColorBy:pe,getNodeColor:Zi,resolveEndpoint:yn,fallback:hn}),[pe,Zi,hn,yn]),pn=ht(e=>function(e){let{edge:t,particleStyleColor:r,particleColorBy:i,hasExplicitParticleColorBy:n,getEdgeColor:s,getNodeColor:o,resolveEndpoint:a,fallback:l}=e;if("function"==typeof r){let e=a(t.source);return e?r(t,e):l}if(!n)return s(t);let c=i,d=a(t.source),u=a(t.target);return"target"===c&&u?o(u):d?o(d):l}({edge:e,particleStyleColor:ei.color,particleColorBy:ei.colorBy,hasExplicitParticleColorBy:!!le?.colorBy,getEdgeColor:gn,getNodeColor:Zi,resolveEndpoint:yn,fallback:hn}),[le?.colorBy,ei.color,ei.colorBy,Zi,gn,hn,yn]),fn=function(e,t,r,i,n){return("sankey"===e||t)&&r||i||n}(a,!!sr,ae,!!Lt,ci.current?.isAnimating??!1),mn=ut(void 0);var vn;vt(()=>{let e=ci.current;e&&((Kr||Xr&&Qr)&&e.hasEdgeIdentityChange(ii)?mn.current=ii:(e.updateConfig(ii),mn.current=void 0),dr.current=!0,_r())},[ii,Kr,Xr,Qr,_r]),function(e,t){dt.useEffect(()=>{if(e)return e.perspective.onExtrasReady=t,()=>{e.perspective.onExtrasReady=null}},[e,t])}(ci.current,ht(()=>{dr.current=!0,_r()},[_r])),W(ci,lr,dr,_r);let kn=ht(()=>{let e=ci.current;if(!e)return;let t=++Ai.current;Ii.current?.abort(),Ii.current=null;let s=[fr,mr],o=(t,r=!1)=>{if(ln(e,s),Mi(e,t),nt){let{nodes:t,edges:r}=e.getLayoutData();nt(t,r)}r&&_r()};if("force"===a&&!sr&&!jt&&r()&&i(V,e.nodes.size,e.edges.size,Y)){let r=new AbortController;Ii.current=r;let i=e.getLayoutData(),a=n(i.nodes,i.edges,Pi.current,s,e._lastPositionSnapshot);return Ti(!0),Di.current?.("pending"),import("./c-G3SM44T7.min.js").then(({runForceLayoutWorker:e})=>e(a,r.signal)).then(({positions:i})=>{r.signal.aborted||t!==Ai.current||(Ii.current=null,e.applyForceLayoutPositions(i,s),o("ready",!0))}).catch(i=>{r.signal.aborted||t!==Ai.current||"AbortError"===i.name||(Ii.current=null,e.runLayout(s),o("error",!0))}),r}e.runLayout(s),o("ready")},[fr,mr,ln,Mi,nt,_r,a,sr,jt,V,Y]),bn=ut(kn);bn.current=kn,function(t,r,i){let n=ut(i);n.current=i,vt(()=>{if(!r&&Gt(t)&&!e(t))return c(()=>import("./c-OWRVBUSL.min.js").then(e=>{e.registerBuiltInNetworkLayouts()}),()=>n.current(),`StreamNetworkFrame layout "${t}"`)},[t,r])}(a,!!sr,()=>{bn.current(),_r()}),vt(()=>()=>{++Ai.current,Ii.current?.abort()},[]);let xn=ut(!1),wn=ht((e=!1)=>!(!e&&!xn.current||(xn.current=!1,kn(),0)),[kn]),_n=ht(()=>wn(!1),[wn]),Sn=ht(e=>{let t=ci.current;if(!t)return!1;let r=!1,i=xn.current;for(let n of e)null==n||"object"!=typeof n||(r=!0,t.ingestEdge(n)&&(i=!0));let n=wn(i);return r||n},[wn]),Cn=ht(e=>{if(null==e||"object"!=typeof e)return;let t=ci.current;if(t){if(t.ingestEdge(e)&&(xn.current=!0),Ii.current&&(++Ai.current,Ii.current.abort(),Ii.current=null,xn.current=!0),!Sr.isActive)return void _n();_r()}},[_n,Sr,_r]),En=ht(e=>{Sn(e)&&_r()},[Sn,_r]);vt(()=>Sr.subscribe(()=>{Sr.isActive||_n()}),[_n,Sr]);let Nn=ht(()=>{xn.current=!1,++Ai.current,Ii.current?.abort(),Ii.current=null,Ti(!1),Di.current?.("ready"),ci.current?.clear(),gi(),Ki.current.clear(),qi.current=0,zr(ci.current?.layoutVersion??0),vi(null),Li.current=null,Yi.current=-1,Hi.current=null,Xi.current=-1,dr.current=!0,_r()},[gi,_r,Yi,Hi,Xi,vi]),Rn=ht(()=>{ci.current&&(wn(!0),_r())},[wn,_r]),Tn=ht(e=>{let t=ci.current;if(!t)return[];let r=[];for(let i of e){let e=t.nodes.get(i);e&&(r.push({...e.data??{},id:i}),t.removeNode(i),Ki.current.delete(i))}if(r.length&&Li.current){let e=new Set(r.map(e=>e.id)),t=Li.current,i=t.data,n=e=>e&&"object"==typeof e?e.id:e;("node"===t.nodeOrEdge?e.has("function"==typeof m?m(i??{}):i?.[m]):e.has(n(i?.source))||e.has(n(i?.target)))&&(Li.current=null,vi(null))}return wn(r.length>0)&&_r(),r},[wn,_r,m,vi]),An=ht((e,t)=>{let r=[];try{for(let i of e){let e=ci.current?.updateNode(i,t);null!=e&&r.push({...e,id:i})}}finally{wn(r.length>0)&&_r()}return r},[wn,_r]);wt(o,()=>({push:Cn,pushMany:En,removeNode:e=>Tn([e]).length>0,removeNodes:Tn,updateNodes:An,removeEdge:(e,t)=>{let r=ci.current?.removeEdge(e,t)??!1;if(r&&Li.current&&"edge"===Li.current.nodeOrEdge){let r,i=Li.current.data,n="object"==typeof i?.source?i.source.id:i?.source,s="object"==typeof i?.target?i.target.id:i?.target;r=void 0!==t?n===e&&s===t:!C&&"id"!==E||!i||("function"==typeof C?C:e=>e?.[C??"id"])(i.data??i)===e,r&&(Li.current=null,vi(null))}return wn(r)&&_r(),r},updateNode:(e,t)=>{let r=ci.current?.updateNode(e,t)??null;return wn(null!==r)&&_r(),r},updateEdge:(e,t,r)=>{let i=ci.current?.updateEdge(e,t,r)??[];return wn(i.length>0)&&_r(),i},updateEdgeById:(e,t)=>{let r=ci.current?.updateEdgeById(e,t)??null;return wn(null!==r)&&_r(),r},clear:Nn,getTopology:()=>(_n(),ci.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(_n(),ci.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(_n(),ci.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{_n();let e=ci.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Rn,getTension:()=>(_n(),ci.current?.tension??0)}),[Cn,En,Nn,Rn,_n,wn,Tn,An,_r,C,E,vi]),vt(()=>{let e=ci.current;if(!e)return;++Ai.current,Ii.current?.abort(),Ii.current=null;let t=mn.current;if(Xr&&Qr)xn.current=!1,e.ingestHierarchy(Qr,[fr,mr],t),mn.current=void 0,ln(e,[fr,mr]),Mi(e),_r();else{let n=q(l),s=Array.isArray(g)?q(g):[];if(Kr&&(xn.current=!1),0===n.length&&0===s.length){if(Kr&&(e.nodes.size>0||e.edges.size>0)&&Nn(),t&&(e.updateConfig(t),mn.current=void 0),"force"===a&&!Kr&&e.nodes.size>0){xn.current=!1;let e=bn.current();return()=>e?.abort()}return void Mi(e)}let o=[fr,mr];if("force"===a&&!sr&&r()&&!jt&&i(V,n.length,s.length,Y)){e.ingestBounded(n,s,o,{deferLayout:!0,config:t}),mn.current=void 0;let r=bn.current();return()=>r?.abort()}e.ingestBounded(n,s,o,{config:t}),mn.current=void 0,ln(e,o),Mi(e),_r()}},[l,g,Kr,Qr,Xr,fr,mr,ni,V,Y,a,sr,jt,_r,Nn,ln,Mi]);let In=dt.useRef(!1);vt(()=>{In.current||f&&f.length>0&&(In.current=!0,En(f))},[f,En]),vt(()=>{let e=ci.current;if(!e||Ii.current)return;let t=an.current,r=null!==t&&(t[0]!==fr||t[1]!==mr);!dr.current&&!r||(r&&e.runLayout([fr,mr]),ln(e,[fr,mr]),zr(e=>"number"==typeof e?e+1:0),_r())},[Cr,fr,mr,ln,_r]);let Dn=()=>!sr||(ci.current?.hasCustomRestyle??!1);Fi.current=e=>{let r=Dn(),i=dn.current;if(!i)return;let n=ci.current;if(!n)return void Pe(i);let s=Ji({viewTransform:t.viewTransform,clientX:e.clientX,clientY:e.clientY,canvasRect:i.getBoundingClientRect(),margin:pr,adjustedWidth:fr,adjustedHeight:mr,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,...sn(n),nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius,includeEdges:!1!==n.lastCustomLayoutResult?.edgeHitTesting&&(Ue||Qi.current.edges)});if(Pe(i,"hit"===s.kind?Ee(s.mark):void 0),Ue){if("hit"!==s.kind)return void(Li.current&&(Li.current=null,vi(null),Oi?.(null),r&&_r()));Li.current=s.hover,vi(s.hover),Oi?.(s.hover),r&&_r()}},Bi.current=()=>{if(Pe(dn.current),Li.current){let e=Dn();Li.current=null,vi(null),Oi?.(null),e&&_r()}};let Mn=ut(()=>{});Mn.current=e=>{if(ur.flushPointerMove(),Le(e.target)||!et&&!tt)return;let r=dn.current;if(!r)return;let i=ci.current;if(!i)return;let n=Ji({viewTransform:t.viewTransform,clientX:e.clientX,clientY:e.clientY,canvasRect:r.getBoundingClientRect(),margin:pr,adjustedWidth:fr,adjustedHeight:mr,sceneNodes:i.sceneNodes,sceneEdges:i.sceneEdges,...sn(i),nodeQuadtree:i.nodeQuadtree,maxNodeRadius:i.maxNodeRadius,includeEdges:!1!==i.lastCustomLayoutResult?.edgeHitTesting});"hit"===n.kind?Wi(n.hover,{type:"activate",inputType:Oe(e.nativeEvent.pointerType)}):"miss"===n.kind&&Wi(null)};let Pn=ht(e=>Mn.current(e),[]),Ln=ht(e=>{F(ji,e,Ue,Qi.current.nodes||Qi.current.edges,dn.current,"mouse")&&(Yi.current=-1,Hi.current=null,zi(e))},[dn,Ue,zi,ji,Yi,Hi]),On=ut(null),Wn=ht(e=>{(e.target===dn.current||e.target===On.current)&&Ln(e)},[dn,Ln]),Fn=ht(e=>{On.current?.removeEventListener("mousemove",Wn),On.current=e,e?.addEventListener("mousemove",Wn)},[Wn]),Bn=function(e,t,r,i){let n=ut(!1),s=ut(!1);return gt(()=>{let o=()=>{i.current<0&&r.current?.(),n.current=!0;try{t.current?.()}finally{n.current=!1}};return(e||s.current)&&o(),s.current=!!e,Dr(e)?.subscribe(o)},[e,t,r,i]),n}(t.viewTransform,wr,Bi,Yi),zn=function(e,t){let r=t?.lastCustomLayoutResult?t.customLayoutRevision:null,i=t?.lastCustomLayoutResult??null,n=ut(null);return n.current??(n.current={store:t,run:r,result:Jr(i),output:i}),gt(()=>{let s=n.current,o=s.store!==t||s.run!==r;(o||s.output!==i)&&(n.current={store:t,run:r,result:Jr(i),output:i}),o&&Dr(e)?.layoutCommitted?.(i,s.result)}),ht(e=>e!==n.current.store||(e.lastCustomLayoutResult?e.customLayoutRevision:null)!==n.current.run,[])}(t.viewTransform,ci.current);if(wr.current=()=>{if(Bn.current||(xr.current=null,_n()),!Sr.isActive&&!Bn.current||Ii.current&&!Bn.current)return;let e=dn.current;if(!e)return;let r=ci.current;r&&function(e){let{canvas:t,store:r,sceneRevisionDiagnostics:i,size:n,margin:s,adjustedWidth:o,adjustedHeight:a,background:l,themeBackground:c,maxDevicePixelRatio:y,renderMode:g,hasBackgroundGraphics:p=!1,dirtyRef:f,resolutionDirtyRef:m,lastFrameTimeRef:v,now:k,random:b,reducedMotion:x,showParticles:w,isContinuous:_,animate:S,decay:C,pulse:E,thresholds:N,staleness:R,particleStyle:I,getParticleColor:D,pendingAnnotationFrameRef:M,lastAnnotationFrameTimeRef:P,setAnnotationFrame:L,scheduleNextFrame:O,syncColorMap:W,onSceneOrStyleChange:F}=e,B=t.getContext("2d");if(!B)return;let z=v.current?Math.min((k-v.current)/1e3,.1):.016;e.cameraOnly||(v.current=k);let $=!e.cameraOnly&&null!=r.transition,j=!e.cameraOnly&&r.advanceTransition(x?k+1e6:k),Y=!x&&j,H=$&&!j,X=!x&&!e.cameraOnly&&r.tickAnimation([o,a],z),V=!e.cameraOnly&&r.advancePerspectiveTransition(k,x),G=!e.cameraOnly&&f.current,Q=!e.cameraOnly&&i?.beforeCompute(r.getLastUpdateResult(),Y),K=$||G||X||V;K&&(r.buildScene([o,a]),t.setAttribute("aria-label",Ci(r)),G&&W?.()),Q&&i?.afterCompute(Q,K,!0);let q=w&&!x&&!!r.particlePool,U=!!C||!!E||!!N||!1!==S&&r.hasActiveTopologyDiff||r.hasActivePulses||r.hasActiveThresholds,Z=r.consumeStylePaintPending();(K||Z||e.cameraOnly)&&F?.({inventoryChanged:G||Z,geometryChanged:K});let J=d({dirtyOrRebuilt:K,transitioning:Y,animationTicked:X,continuous:q||_,liveEncoding:U,forced:Z||!0===m?.current||e.cameraOnly});m&&(m.current=!1);let ee=R?.threshold??5e3,te=!!R&&r.lastIngestTime>0&&k-r.lastIngestTime>ee;if(J){let i=be(y,n);if(!xe(t,n,s,i))return;if(B.clearRect(-s.left,-s.top,n[0],n[1]),T(B,{background:l,themeBackground:c,hasBackgroundGraphics:p,x:-s.left,y:-s.top,width:n[0],height:n[1]}),B.save(),e.viewTransform){let t=Lr(e.viewTransform);B.beginPath(),B.rect(0,0,o,a),B.clip(),B.translate(t.x,t.y),B.scale(t.k,t.k)}if(e.cameraOnly||(C&&r.applyDecay(),E&&r.applyPulse(k),N&&r.applyThresholds(k),!1!==S&&r.applyTopologyDiff(k)),te&&(B.globalAlpha=R?.dimOpacity??.5),r.perspective.underlay.length&&yi(B,r.perspective.underlay),A({context:B,nodes:r.sceneEdges,renderMode:g,pixelRatio:i,paintBuiltIn:e=>yi(B,e)}),A({context:B,nodes:r.sceneNodes,renderMode:g,pixelRatio:i,paintBuiltIn:e=>{let t=e;r.perspective.frame?function(e,t){let r=0;for(let i=1;i<=t.length;i++){if(i<t.length&&t[i].type===t[r].type)continue;let n=Si[t[r]?.type];n&&n(e,0===r&&i===t.length?t:t.slice(r,i)),r=i}}(B,t):(xi(B,t),wi(B,t),_i(B,t),u(B,t),h(B,t))}}),q&&!te){let t=r.edgesArray;if(t.length>0){e.cameraOnly||function(e,t,r,i,n=Math.random){let s=i.spawnRate??rr.spawnRate,o=i.maxPerEdge??rr.maxPerEdge;for(let i=0;i<t.length;i++){let a=t[i];if(!a.bezier||e.countForEdge(i)>=o)continue;let l=a.bezier.circular?.3:1,c=a.value*s*r*l,d=Math.floor(c),u=c-d,h=d;n()<u&&h++;for(let t=0;t<h&&!(e.countForEdge(i)>=o);t++)e.spawn(i,n)}}(r.particlePool,t,z,I,b);let i,n=.5*(I.speedMultiplier??1);if(I.proportionalSpeed){let e=t.reduce((e,t)=>Math.max(e,t.value||1),1);i=t.map(t=>.3+(t.value||1)/e*1.7)}e.cameraOnly||r.particlePool.step(z,n,t,i),function(e,t,r,i,n,s){let o=i.radius??rr.radius,a=i.opacity??rr.opacity;e.globalAlpha=a;for(let a=0;a<t.particles.length;a++){let l=t.particles[a];if(!l.active)continue;let c,d=r[l.edgeIndex];if(d){if(c="string"==typeof i.color&&"inherit"!==i.color?i.color:n(d),e.fillStyle=Ge(e,c)||c,e.beginPath(),s){let[t,r]=s(l.x,l.y,d,l.t);e.arc(t,r,o,0,2*Math.PI)}else e.arc(l.x,l.y,o,0,2*Math.PI);e.fill()}}e.globalAlpha=1}(B,r.particlePool,t,I,D,r.perspective.projectParticle)}}te&&(B.globalAlpha=1),B.restore()}if(e.cameraOnly)return;f.current=!1;let re=G||!!e.layoutCommitPending,ie=K||re||M.current;ie&&(re||H||k-P.current>=33)?(L(e=>e+1),P.current=k,M.current=!1):M.current=!!ie,(_||Y||null!=r.transition||r.perspective.transitioning||X||r.hasActivePulses||r.hasActiveThresholds||!1!==S&&r.hasActiveTopologyDiff||M.current)&&O()}({canvas:e,store:r,sceneRevisionDiagnostics:pi.current,size:gr,margin:pr,adjustedWidth:fr,adjustedHeight:mr,background:Ke,themeBackground:Ir,maxDevicePixelRatio:qe,renderMode:ce,viewTransform:t.viewTransform,cameraOnly:Bn.current,layoutCommitPending:zn(r),hasBackgroundGraphics:!(!Dt&&!r.customLayoutBackgrounds),dirtyRef:dr,resolutionDirtyRef:un,lastFrameTimeRef:si,now:Sr.now(),random:Sr.random,reducedMotion:!!hr.current,showParticles:ae,isContinuous:fn,animate:Wt,decay:Pt,pulse:Lt,thresholds:Vt,staleness:Ft,particleStyle:ei,getParticleColor:pn,pendingAnnotationFrameRef:li,lastAnnotationFrameTimeRef:oi,setAnnotationFrame:bi,scheduleNextFrame:()=>{_r()},syncColorMap:()=>rn(r),onSceneOrStyleChange:({inventoryChanged:i,geometryChanged:n})=>{var s;(i||n)&&nn(r),!1===r.lastCustomLayoutResult?.edgeHitTesting&&"edge"===Li.current?.nodeOrEdge&&Bi.current(),(i||n)&&Gi(),i&&(tn(Qi.current,r.sceneNodes,r.sceneEdges)||Pe(e)),(Qi.current.nodes||Qi.current.edges)&&(i||n||Bn.current)&&(s={canvas:e,pointer:ji.current,store:r,margin:pr,viewTransform:t.viewTransform,width:fr,height:mr,geometryMoved:n,cursorInventory:Qi.current},Ce(s.canvas,s.pointer,e=>{let t=Ji({clientX:e.clientX,clientY:e.clientY,canvasRect:s.canvas.getBoundingClientRect(),margin:s.margin,adjustedWidth:s.width,adjustedHeight:s.height,sceneNodes:s.store.sceneNodes,sceneEdges:s.store.sceneEdges,...sn(s.store),nodeQuadtree:s.geometryMoved?null:s.store.nodeQuadtree,maxNodeRadius:s.geometryMoved?0:s.store.maxNodeRadius,includeEdges:s.cursorInventory.edges&&!1!==s.store.lastCustomLayoutResult?.edgeHitTesting,viewTransform:s.viewTransform});return"hit"===t.kind?Ee(t.mark):void 0}))}})},We(dn),B(Ft,ci,dr,_r,Sr.now,Ei,Ni),di)return function({hydrationMarkup:e=null,layoutPending:t,tableId:r,props:i,store:n,responsiveRef:s,size:o,margin:a,adjustedWidth:l,adjustedHeight:c,surfaceBackground:d,resolvedBackground:u,resolvedForeground:h}){let{description:y,title:g,renderMode:p,legend:f,legendPosition:m,legendLayout:v,legendHoverBehavior:k,legendClickBehavior:b,legendHighlightedCategory:x,legendIsolatedCategories:w,layoutSelection:_,annotations:S,onAnnotationActivate:C,annotationObservationCallback:E,onObservation:T,chartId:A,autoPlaceAnnotations:I,svgAnnotationRules:D}=i,M=n.sceneNodes,P=n.sceneEdges,L=n.labels,O=n.perspective.frame,W=n.lastCustomLayoutResult?.perspective,F=n.perspective.underlay,B=Rr(i,`${r}-frame`,o,t);return _t("div",{...B,ref:s,dangerouslySetInnerHTML:null===e?void 0:{__html:e},children:null===e?Ct(St,{children:[ui(i,n,r),Ct("div",{role:n.customLayoutHtmlMarks?.length?"group":"img","aria-label":B["aria-label"],children:[Ct("svg",{role:"presentation",xmlns:"http://www.w3.org/2000/svg",width:o[0],height:o[1],style:{position:"absolute",left:0,top:0},children:[d?_t("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:o[0],height:o[1],fill:d}):null,_t("g",{transform:`translate(${a.left},${a.top})`,children:_t(Fr,{view:i.viewTransform,width:l,height:c,children:N(u,Mt(n.customLayoutBackgrounds,O,W))})}),_t("g",{transform:`translate(${a.left},${a.top})`,children:Ct(Fr,{view:i.viewTransform,width:l,height:c,children:[F.map((e,t)=>Gr(e,t+P.length+M.length)),P.map((e,t)=>R({node:e,index:t,renderMode:p,fallback:()=>Gr(e,t)})).filter(Boolean),M.map((e,t)=>R({node:e,index:t,renderMode:p,fallback:()=>function(e,t){return te(Vr(e,t),e,`network-node-cursor-${t}`)}(e,t)})).filter(Boolean)]})})]}),_t(Zr,{decorative:!0,viewTransform:i.viewTransform,width:l,height:c,totalWidth:o[0],totalHeight:o[1],margin:a,labels:L,sceneNodes:M,title:g,description:y,legend:f,legendPosition:m,legendLayout:v,legendHoverBehavior:k,legendClickBehavior:b,legendHighlightedCategory:x,legendIsolatedCategories:w,foregroundGraphics:Mt(N(h,Mt(H(n.customLayoutOverlays,_??null),O,W)),O),annotations:S,onAnnotationActivate:C,onObservation:E??T,chartId:A,chartType:"StreamNetworkFrame",autoPlaceAnnotations:I,svgAnnotationRules:D,annotationFrame:0}),_t(ai,{viewTransform:i.viewTransform,marks:n.customLayoutHtmlMarks,margin:a,selection:_??null,width:l,height:c,viewport:i.viewport,htmlMarkCulling:i.htmlMarkCulling,onViewportChange:i.onViewportChange})]})]}):void 0})}({hydrationMarkup:$r,layoutPending:Ri,tableId:br,props:t,store:hi??ci.current,responsiveRef:yr,size:gr,margin:pr,adjustedWidth:fr,adjustedHeight:mr,surfaceBackground:Mr,resolvedBackground:Ar,resolvedForeground:Er});let $n=ci.current,jn=Rr(t,Wr,gr,Ri,"visible"),Yn=$n.perspective.frame,Hn=$n.lastCustomLayoutResult?.perspective;return Ct("div",{...jn,ref:yr,tabIndex:0,onKeyDown:Vi,children:["production"!==process.env.NODE_ENV&&ci.current&&_t(Fe,{store:ci.current,diagnostics:pi.current}),ui(t,$n,br,Ri?void 0:$n.getUpdateSnapshot().revisions.accessibility),_t(jr,{hoverStore:mi,kbFocusIndexRef:Yi,store:$n}),Ct("div",{role:$n.customLayoutHtmlMarks?.length?"group":"img","aria-label":jn["aria-label"],style:{position:"relative",width:"100%",height:"100%"},ref:Fn,onMouseLeave:$i,onClick:et||tt?Pn:void 0,children:[Ct("div",{style:{display:"contents"},onMouseMove:Ln,children:[Ri&&!1!==Q&&_t("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Be(!0,gr[0],gr[1],Q)}),_t(ze,{size:gr,margin:pr,backdropFill:Mr??void 0,overflowVisible:!0,children:_t(Fr,{view:t.viewTransform,width:fr,height:mr,children:N(Ar,Mt($n.customLayoutBackgrounds,Yn,Hn))})})]}),_t("canvas",{"aria-hidden":"true",ref:dn,"aria-label":Ci($n),style:{position:"absolute",top:0,left:0}}),Ct("div",{style:{display:"contents"},onMouseMove:Ln,children:[_t(Zr,{decorative:!0,viewTransform:t.viewTransform,width:fr,height:mr,totalWidth:gr[0],totalHeight:gr[1],margin:pr,labels:$n.labels,sceneNodes:$n.sceneNodes,title:At,description:Qt,legend:yt,legendPosition:pt,legendLayout:mt,legendHoverBehavior:kt,legendClickBehavior:bt,legendHighlightedCategory:Et,legendIsolatedCategories:Nt,foregroundGraphics:Mt(N(Er,Mt(H($n.customLayoutOverlays,lr??null),Yn,Hn)),Yn),annotations:ot,onAnnotationActivate:at,onObservation:rt??tt,chartId:it,chartType:"StreamNetworkFrame",autoPlaceAnnotations:lt,svgAnnotationRules:ct,annotationFrame:ki}),_t(ai,{viewTransform:t.viewTransform,marks:$n.customLayoutHtmlMarks,margin:pr,selection:lr??null,width:fr,height:mr,viewport:t.viewport,htmlMarkCulling:t.htmlMarkCulling,onViewportChange:t.onViewportChange}),_t(Yr,{viewTransform:t.viewTransform,hoverStore:mi,kbFocusIndexRef:Yi,focusedNavPointRef:Hi,enableHover:Ue,tooltipContent:Ze,adjustedWidth:fr,adjustedHeight:mr,margin:pr,size:gr}),Ft?.showBadge&&_t(z,{isStale:Ei,position:Ft.badgePosition,state:Ft.state,settling:Ft.settling})]})]})]})})),"StreamNetworkFrame"),ln=an;export{Dt as a,ln as b};
|