stickyflow 0.9.1 → 0.9.3

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/binding/index.cjs +9 -9
  3. package/dist/binding/index.js +3 -3
  4. package/dist/{chunk-BL5NCXS4.cjs → chunk-2GKXPZRL.cjs} +23 -23
  5. package/dist/{chunk-BL5NCXS4.cjs.map → chunk-2GKXPZRL.cjs.map} +1 -1
  6. package/dist/{chunk-RUSNRDLI.cjs → chunk-3EOG34QN.cjs} +48 -44
  7. package/dist/chunk-3EOG34QN.cjs.map +1 -0
  8. package/dist/{chunk-CM35H45Z.js → chunk-AAP24GBG.js} +3 -3
  9. package/dist/{chunk-CM35H45Z.js.map → chunk-AAP24GBG.js.map} +1 -1
  10. package/dist/{chunk-QL7MNEMT.cjs → chunk-C25NWWIH.cjs} +48 -3
  11. package/dist/chunk-C25NWWIH.cjs.map +1 -0
  12. package/dist/{chunk-7ZEC7AB4.js → chunk-C3LVKPWQ.js} +19 -15
  13. package/dist/chunk-C3LVKPWQ.js.map +1 -0
  14. package/dist/{chunk-5EY7EK5V.cjs → chunk-EURX7QT3.cjs} +653 -653
  15. package/dist/{chunk-5EY7EK5V.cjs.map → chunk-EURX7QT3.cjs.map} +1 -1
  16. package/dist/{chunk-TH2HFMEL.js → chunk-G2N3KJYJ.js} +3 -3
  17. package/dist/{chunk-TH2HFMEL.js.map → chunk-G2N3KJYJ.js.map} +1 -1
  18. package/dist/{chunk-OUWGWDJ2.cjs → chunk-MR32IJQO.cjs} +15 -15
  19. package/dist/{chunk-OUWGWDJ2.cjs.map → chunk-MR32IJQO.cjs.map} +1 -1
  20. package/dist/{chunk-D2266VBZ.js → chunk-Q6FBISNP.js} +48 -3
  21. package/dist/chunk-Q6FBISNP.js.map +1 -0
  22. package/dist/{chunk-IKTSCLIK.js → chunk-XNNNIOJU.js} +4 -4
  23. package/dist/{chunk-IKTSCLIK.js.map → chunk-XNNNIOJU.js.map} +1 -1
  24. package/dist/index.cjs +36 -36
  25. package/dist/index.js +5 -5
  26. package/dist/interaction/index.cjs +288 -231
  27. package/dist/interaction/index.cjs.map +1 -1
  28. package/dist/interaction/index.js +60 -3
  29. package/dist/interaction/index.js.map +1 -1
  30. package/dist/stickyflow-diagram.global.js +37 -37
  31. package/dist/stickyflow-diagram.global.js.map +1 -1
  32. package/dist/viewer/index.cjs +9 -9
  33. package/dist/viewer/index.js +4 -4
  34. package/dist/web-component/index.cjs +6 -6
  35. package/dist/web-component/index.js +4 -4
  36. package/package.json +1 -1
  37. package/dist/chunk-7ZEC7AB4.js.map +0 -1
  38. package/dist/chunk-D2266VBZ.js.map +0 -1
  39. package/dist/chunk-QL7MNEMT.cjs.map +0 -1
  40. package/dist/chunk-RUSNRDLI.cjs.map +0 -1
@@ -1,21 +1,21 @@
1
- "use strict";var Stickyflow=(()=>{var Vn=Object.defineProperty;var eg=Object.getOwnPropertyDescriptor;var tg=Object.getOwnPropertyNames;var rg=Object.prototype.hasOwnProperty;var og=(e,t)=>{for(var r in t)Vn(e,r,{get:t[r],enumerable:!0})},ng=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of tg(t))!rg.call(e,n)&&n!==r&&Vn(e,n,{get:()=>t[n],enumerable:!(o=eg(t,n))||o.enumerable});return e};var ig=e=>ng(Vn({},"__esModule",{value:!0}),e);var r2={};og(r2,{StickyflowDiagram:()=>kt,defineStickyflowDiagram:()=>ks});var vs=["source","interactive","padding","diagram-id"],ag=e=>e!==null&&e!=="false";function Ps(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:ag(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}function sr(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Ls=["rollingNumber","tickScale","ruler"];function at(e){return e!==void 0&&Ls.includes(e)}function qr(e){return!at(e.type)}var Ms=[{type:"rollingNumber",group:"readout",category:"indicator",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!1,size:{width:160,height:90}},{type:"tickScale",group:"readout",category:"instrument",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!0,size:{width:200,height:200}},{type:"ruler",group:"input",category:"instrument",value:{type:"number",writable:!1,default:0},properties:{},interaction:"scale",pointerScale:!0,size:{width:120,height:360}},{type:"switch",group:"input",category:"selection",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"toggle",pointerScale:!1,size:{width:52,height:30,minWidth:36,minHeight:20,aspect:1.7333333333333334},role:"switch"},{type:"checkbox",group:"input",category:"selection",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},stroke:{type:"color",default:"#94a3b8"},check:{type:"color",default:"#ffffff"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"toggle",pointerScale:!1,size:{width:160,height:24,minWidth:18,minHeight:18},role:"checkbox"},{type:"toggleButton",group:"input",category:"action",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},stroke:{type:"color",default:"#94a3b8"},textColor:{type:"color",default:"#0f172a"},onTextColor:{type:"color",default:"#ffffff"},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"toggle",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"},{type:"button",group:"action",category:"action",properties:{accent:{type:"color",default:"#5a6bff"},textColor:{type:"color",default:"#ffffff"},radius:{type:"number",default:8,min:0,max:200},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"press",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"},{type:"slider",group:"input",category:"value",value:{type:"number",writable:!0,default:40},properties:{variant:{type:"enum",default:"line",options:["line","field"]},direction:{type:"enum",default:"horizontal",options:["horizontal","vertical"]},ticks:{type:"number",default:0,min:0,max:200},tickColor:{type:"color",default:"#94a3b8"},min:{type:"number",default:0},max:{type:"number",default:100},step:{type:"number",default:0,min:0},surface:{type:"color",default:"#eef1f6"},fill:{type:"color",default:"#cbd5e1"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},display:{type:"enum",default:"value",options:["none","value","percent"]},radius:{type:"number",default:10,min:0,max:200},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"},trackHeight:{type:"number",default:6,min:1,max:80},thumbSize:{type:"number",default:56,min:20,max:100,step:5},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"slide",pointerScale:!1,size:{width:220,height:28,minWidth:60,minHeight:12},role:"slider"},{type:"range",group:"input",category:"value",value:{type:"number",writable:!0,default:25},properties:{variant:{type:"enum",default:"line",options:["line","field"]},direction:{type:"enum",default:"horizontal",options:["horizontal","vertical"]},ticks:{type:"number",default:0,min:0,max:200},tickColor:{type:"color",default:"#94a3b8"},valueEnd:{type:"number",default:75},min:{type:"number",default:0},max:{type:"number",default:100},step:{type:"number",default:0,min:0},surface:{type:"color",default:"#eef1f6"},fill:{type:"color",default:"#cbd5e1"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},display:{type:"enum",default:"value",options:["none","value","percent"]},radius:{type:"number",default:10,min:0,max:200},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"},trackHeight:{type:"number",default:6,min:1,max:80},thumbSize:{type:"number",default:56,min:20,max:100,step:5},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"range",pointerScale:!1,size:{width:220,height:28,minWidth:60,minHeight:12},role:"slider"},{type:"progress",group:"readout",category:"indicator",value:{type:"number",writable:!1,default:60},properties:{min:{type:"number",default:0},max:{type:"number",default:100},variant:{type:"enum",default:"bar",options:["bar","ring"]},direction:{type:"enum",default:"horizontal",options:["horizontal","vertical"]},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#e2e8f0"},thickness:{type:"number",default:10,min:1,max:80},rounded:{type:"boolean",default:!0},display:{type:"enum",default:"none",options:["none","percent","value"]},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:300,min:0,max:2e3,step:10}},interaction:"none",pointerScale:!1,size:{width:220,height:12,minWidth:20,minHeight:4},role:"progressbar"},{type:"segmented",group:"input",category:"selection",value:{type:"number",writable:!0,default:0},properties:{options:{type:"string",default:"Day,Week,Month"},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#e2e8f0"},textColor:{type:"color",default:"#475569"},activeTextColor:{type:"color",default:"#ffffff"},radius:{type:"number",default:200,min:0,max:200},inset:{type:"number",default:3,min:0,max:20},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:200,min:0,max:2e3,step:10}},interaction:"pick",pointerScale:!1,size:{width:300,height:40,minWidth:80,minHeight:20},role:"radiogroup"},{type:"knob",group:"input",category:"value",value:{type:"number",writable:!0,default:40},properties:{min:{type:"number",default:0},max:{type:"number",default:100},step:{type:"number",default:0,min:0},start:{type:"number",default:225,min:0,max:360},sweep:{type:"number",default:270,min:30,max:360},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},face:{type:"color",default:"#f1f5f9"},dot:{type:"color",default:"#0f172a"},thickness:{type:"number",default:8,min:1,max:80},rounded:{type:"boolean",default:!0},display:{type:"enum",default:"value",options:["none","value","percent"]},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:16,min:6,max:200},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"turn",pointerScale:!1,size:{width:96,height:96,minWidth:40,minHeight:40,aspect:1},role:"slider"}];var sg=0,Ts=new Map(Ms.map(e=>[e.type,e]));function Kr(){return sg}function Rt(e){return e===void 0?void 0:Ts.get(e)}function Wn(){return[...Ts.keys()]}function zn(e){return Rt(e)!==void 0}var J={color:"#000000",surface:"rgba(255, 255, 255, 0.28)",divider:"rgba(0, 0, 0, 0.2)",labelColor:"rgba(0, 0, 0, 0.62)",fontFamily:"'Roboto Mono', 'SFMono-Regular', Consolas, monospace",variant:"flip",motion:"roll",fontWeight:"300",fontSize:0};function Yn(e){return{color:e.color??J.color,surface:e.surface??J.surface,divider:e.divider??J.divider,labelColor:e.labelColor??J.labelColor,fontFamily:e.fontFamily??J.fontFamily,variant:e.variant??J.variant,motion:e.motion??J.motion,fontWeight:e.fontWeight??J.fontWeight,fontSize:e.fontSize??J.fontSize}}var $s=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Component","Shape","Text","Isometric","Dimension","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource","Repeat"],x2=[...$s,"data"],dg=["top","bottom","left","right"],As=e=>dg.includes(e),lr=e=>e==="Component"||e==="Widget";var Zr=e=>$s.includes(e);var Qr=class{constructor(t){this.input=t}input;offset=0;line=1;col=1;get done(){return this.offset>=this.input.length}peek(t=0){return this.input[this.offset+t]}startsWith(t){return this.input.startsWith(t,this.offset)}position(){return{line:this.line,col:this.col}}advance(){let t=this.input[this.offset];if(t===void 0)throw new Error("Cannot advance beyond the end of the SFL source.");return this.offset++,t===`
1
+ "use strict";var Stickyflow=(()=>{var Vn=Object.defineProperty;var rg=Object.getOwnPropertyDescriptor;var og=Object.getOwnPropertyNames;var ng=Object.prototype.hasOwnProperty;var ig=(e,t)=>{for(var r in t)Vn(e,r,{get:t[r],enumerable:!0})},ag=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of og(t))!ng.call(e,n)&&n!==r&&Vn(e,n,{get:()=>t[n],enumerable:!(o=rg(t,n))||o.enumerable});return e};var sg=e=>ag(Vn({},"__esModule",{value:!0}),e);var a2={};ig(a2,{StickyflowDiagram:()=>kt,defineStickyflowDiagram:()=>ks});var vs=["source","interactive","padding","diagram-id"],lg=e=>e!==null&&e!=="false";function Ps(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:lg(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}function sr(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Ls=["rollingNumber","tickScale","ruler"];function at(e){return e!==void 0&&Ls.includes(e)}function qr(e){return!at(e.type)}var Ms=[{type:"rollingNumber",group:"readout",category:"indicator",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!1,size:{width:160,height:90}},{type:"tickScale",group:"readout",category:"instrument",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!0,size:{width:200,height:200}},{type:"ruler",group:"input",category:"instrument",value:{type:"number",writable:!1,default:0},properties:{},interaction:"scale",pointerScale:!0,size:{width:120,height:360}},{type:"switch",group:"input",category:"selection",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"toggle",pointerScale:!1,size:{width:52,height:30,minWidth:36,minHeight:20,aspect:1.7333333333333334},role:"switch"},{type:"checkbox",group:"input",category:"selection",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},stroke:{type:"color",default:"#94a3b8"},check:{type:"color",default:"#ffffff"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"toggle",pointerScale:!1,size:{width:160,height:24,minWidth:18,minHeight:18},role:"checkbox"},{type:"toggleButton",group:"input",category:"action",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},stroke:{type:"color",default:"#94a3b8"},textColor:{type:"color",default:"#0f172a"},onTextColor:{type:"color",default:"#ffffff"},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"toggle",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"},{type:"button",group:"action",category:"action",properties:{accent:{type:"color",default:"#5a6bff"},textColor:{type:"color",default:"#ffffff"},radius:{type:"number",default:8,min:0,max:200},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:160,min:0,max:2e3,step:10}},interaction:"press",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"},{type:"slider",group:"input",category:"value",value:{type:"number",writable:!0,default:40},properties:{variant:{type:"enum",default:"line",options:["line","field"]},direction:{type:"enum",default:"horizontal",options:["horizontal","vertical"]},ticks:{type:"number",default:0,min:0,max:200},tickColor:{type:"color",default:"#94a3b8"},min:{type:"number",default:0},max:{type:"number",default:100},step:{type:"number",default:0,min:0},surface:{type:"color",default:"#eef1f6"},fill:{type:"color",default:"#cbd5e1"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},display:{type:"enum",default:"value",options:["none","value","percent"]},radius:{type:"number",default:10,min:0,max:200},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"},trackHeight:{type:"number",default:6,min:1,max:80},thumbSize:{type:"number",default:56,min:20,max:100,step:5},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"slide",pointerScale:!1,size:{width:220,height:28,minWidth:60,minHeight:12},role:"slider"},{type:"range",group:"input",category:"value",value:{type:"number",writable:!0,default:25},properties:{variant:{type:"enum",default:"line",options:["line","field"]},direction:{type:"enum",default:"horizontal",options:["horizontal","vertical"]},ticks:{type:"number",default:0,min:0,max:200},tickColor:{type:"color",default:"#94a3b8"},valueEnd:{type:"number",default:75},min:{type:"number",default:0},max:{type:"number",default:100},step:{type:"number",default:0,min:0},surface:{type:"color",default:"#eef1f6"},fill:{type:"color",default:"#cbd5e1"},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},display:{type:"enum",default:"value",options:["none","value","percent"]},radius:{type:"number",default:10,min:0,max:200},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"},trackHeight:{type:"number",default:6,min:1,max:80},thumbSize:{type:"number",default:56,min:20,max:100,step:5},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"range",pointerScale:!1,size:{width:220,height:28,minWidth:60,minHeight:12},role:"slider"},{type:"progress",group:"readout",category:"indicator",value:{type:"number",writable:!1,default:60},properties:{min:{type:"number",default:0},max:{type:"number",default:100},variant:{type:"enum",default:"bar",options:["bar","ring"]},direction:{type:"enum",default:"horizontal",options:["horizontal","vertical"]},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#e2e8f0"},thickness:{type:"number",default:10,min:1,max:80},rounded:{type:"boolean",default:!0},display:{type:"enum",default:"none",options:["none","percent","value"]},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:300,min:0,max:2e3,step:10}},interaction:"none",pointerScale:!1,size:{width:220,height:12,minWidth:20,minHeight:4},role:"progressbar"},{type:"segmented",group:"input",category:"selection",value:{type:"number",writable:!0,default:0},properties:{options:{type:"string",default:"Day,Week,Month"},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#e2e8f0"},textColor:{type:"color",default:"#475569"},activeTextColor:{type:"color",default:"#ffffff"},radius:{type:"number",default:200,min:0,max:200},inset:{type:"number",default:3,min:0,max:20},fontSize:{type:"number",default:14,min:6,max:200},animate:{type:"number",default:200,min:0,max:2e3,step:10}},interaction:"pick",pointerScale:!1,size:{width:300,height:40,minWidth:80,minHeight:20},role:"radiogroup"},{type:"knob",group:"input",category:"value",value:{type:"number",writable:!0,default:40},properties:{min:{type:"number",default:0},max:{type:"number",default:100},step:{type:"number",default:0,min:0},start:{type:"number",default:225,min:0,max:360},sweep:{type:"number",default:270,min:30,max:360},accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},face:{type:"color",default:"#f1f5f9"},dot:{type:"color",default:"#0f172a"},thickness:{type:"number",default:8,min:1,max:80},rounded:{type:"boolean",default:!0},display:{type:"enum",default:"value",options:["none","value","percent"]},textColor:{type:"color",default:"#0f172a"},fontSize:{type:"number",default:16,min:6,max:200},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"turn",pointerScale:!1,size:{width:96,height:96,minWidth:40,minHeight:40,aspect:1},role:"slider"}];var dg=0,Ts=new Map(Ms.map(e=>[e.type,e]));function Kr(){return dg}function Rt(e){return e===void 0?void 0:Ts.get(e)}function Wn(){return[...Ts.keys()]}function zn(e){return Rt(e)!==void 0}var J={color:"#000000",surface:"rgba(255, 255, 255, 0.28)",divider:"rgba(0, 0, 0, 0.2)",labelColor:"rgba(0, 0, 0, 0.62)",fontFamily:"'Roboto Mono', 'SFMono-Regular', Consolas, monospace",variant:"flip",motion:"roll",fontWeight:"300",fontSize:0};function Yn(e){return{color:e.color??J.color,surface:e.surface??J.surface,divider:e.divider??J.divider,labelColor:e.labelColor??J.labelColor,fontFamily:e.fontFamily??J.fontFamily,variant:e.variant??J.variant,motion:e.motion??J.motion,fontWeight:e.fontWeight??J.fontWeight,fontSize:e.fontSize??J.fontSize}}var $s=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Component","Shape","Text","Isometric","Dimension","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource","Repeat"],R2=[...$s,"data"],ug=["top","bottom","left","right"],As=e=>ug.includes(e),lr=e=>e==="Component"||e==="Widget";var Zr=e=>$s.includes(e);var Qr=class{constructor(t){this.input=t}input;offset=0;line=1;col=1;get done(){return this.offset>=this.input.length}peek(t=0){return this.input[this.offset+t]}startsWith(t){return this.input.startsWith(t,this.offset)}position(){return{line:this.line,col:this.col}}advance(){let t=this.input[this.offset];if(t===void 0)throw new Error("Cannot advance beyond the end of the SFL source.");return this.offset++,t===`
2
2
  `||t==="\r"&&this.peek()!==`
3
3
  `?(this.line++,this.col=1):this.col++,t}};var Oe=class extends Error{constructor(r,o,n){super(`SFL lex error (${o}:${n}): ${r}`);this.line=o;this.col=n;this.name="SflLexError"}line;col};var Es=e=>e!==void 0&&/^[A-Za-z_]$/.test(e),wt=e=>e!==void 0&&e>="0"&&e<="9",Ns=e=>e!==void 0&&/^[A-Za-z0-9_]$/.test(e);function me(e,t,r,o={}){return{type:e,value:t,line:r.line,col:r.col,endLine:r.line,endCol:r.col,...o}}function Un(e,t){return{...e,endLine:t.line,endCol:t.col}}function Os(e){return Es(e.peek())}function Bs(e,t){let r="";for(;Ns(e.peek());)r+=e.advance();return me("ident",r,t)}function Is(e){return e==="\r"||e===`
4
4
  `}function Ds(e,t){return e.advance()==="\r"&&e.peek()===`
5
5
  `&&e.advance(),me("newline",`
6
6
  `,t)}function Gs(e){return e.peek()==="/"&&e.peek(1)==="/"}function _s(e){for(;!e.done&&e.peek()!==`
7
- `&&e.peek()!=="\r";)e.advance()}function Fs(e){let t=e.peek();return wt(t)||t==="-"&&wt(e.peek(1))}function Hs(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());wt(e.peek());)r+=e.advance();if(e.peek()==="."&&wt(e.peek(1)))for(r+=e.advance();wt(e.peek());)r+=e.advance();return me("number",r,t,{numberValue:Number(r)})}var cg=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],ug=e=>e!==void 0&&/[\d.]/.test(e);function Vs(e,t){let r=cg.find(([i])=>e.startsWith(i));if(!r)return null;let[o,n]=r;if(o==="-"&&ug(e.peek(1)))return null;for(let i=0;i<o.length;i++)e.advance();return me(n,o,t)}var mg={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function Ws(e,t){let r=e.peek(),o=r?mg[r]:void 0;return!r||!o||r==="&"&&e.peek(1)==="&"?null:(e.advance(),me(o,r,t))}function zs(e){return e===" "||e===" "}function Ys(e){e.advance()}function pg(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function fg(e){let t=e.split(`
8
- `),r=1/0;for(let o of t)o.trim()&&(r=Math.min(r,pg(o)));return!Number.isFinite(r)||r===0?e:t.map(o=>o.trim()?o.slice(r):o).join(`
9
- `)}function hg(e,t){Us(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return Us(e),fg(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new Oe("unterminated long string",t.line,t.col)}function Us(e){e.advance(),e.advance(),e.advance()}function gg(e,t){e.advance();let r="";for(;!e.done;){let o=e.advance();if(o==='"')return r;if(o===`
10
- `||o==="\r")throw new Oe('newline in short string (use """ for multiline)',t.line,t.col);r+=o==="\\"?yg(e,t):o}throw new Oe("unterminated string",t.line,t.col)}function yg(e,t){if(e.done)throw new Oe("unterminated escape sequence",t.line,t.col);let r=e.advance();switch(r){case'"':return'"';case"\\":return"\\";case"n":return`
11
- `;case"t":return" ";default:throw new Oe(`invalid escape '\\${r}'`,t.line,t.col)}}function bg(e,t){return e.startsWith('"""')?hg(e,t):gg(e,t)}function js(e,t){return me("string",bg(e,t),t)}function Xs(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(Is(t))return Ds(e,r);if(xg(e,t))return null;let o=Sg(e,t,r)??Cg(e,r);if(o)return o;throw new Oe(`unexpected character '${t}'`,r.line,r.col)}function xg(e,t){return zs(t)?(Ys(e),!0):Gs(e)?(_s(e),!0):!1}function Sg(e,t,r){let o=Ws(e,r);return o||(t==='"'?js(e,r):Vs(e,r))}function Cg(e,t){return Fs(e)?Hs(e,t):Os(e)?Bs(e,t):null}function qs(e){let t=new Qr(e),r=[];for(;!t.done;){let o=Xs(t);o&&r.push(Un(o,t))}return r.push(Un(me("eof","",t.position()),t)),r}var j=class extends Error{constructor(r,o,n){super(`SFL parse error (${o}:${n}): ${r}`);this.line=o;this.col=n;this.name="SflParseError"}line;col};var Jr=class{constructor(t){this.tokens=t}tokens;position=0;peek(t=0){return this.tokens[Math.min(this.position+t,this.tokens.length-1)]}at(t){return this.peek().type===t}next(){return this.tokens[this.position++]}expect(t,r){let o=this.peek();if(o.type!==t)throw new j(`expected ${r}, got '${o.value||o.type}'`,o.line,o.col);return this.next()}expectNumber(t){let r=this.expect("number",t);if(r.numberValue===void 0)throw new j(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function dr(e){let t=[e.expect("ident","path identifier").value];for(;e.at("dot");)e.next(),t.push(e.expect("ident",'identifier after "."').value);return t}function Ks(e){let t=dr(e),r,o;if(e.at("comma")){e.next();let n=e.expect("ident",'side after ","');if(!As(n.value))throw new j(`expected a side (top/right/bottom/left), got '${n.value}'`,n.line,n.col);r=n.value,e.at("lparen")&&(e.next(),o=e.expectNumber('fraction inside "("'),e.expect("rparen","')'"))}return{type:"endpoint",segments:t,side:r,fraction:o}}function kg(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(eo(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(eo(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}var Rg=new Set(["+","-","*","/",">","<",">=","<=","==","!=","&&","||"]);function wg(e){let t=e.peek();if(t.type==="op"&&t.value==="-")return!0;if(t.type!=="number"&&t.type!=="ident"&&t.type!=="lparen")return!1;for(let r=0;;r++){let o=e.peek(r);if(o.type==="newline"||o.type==="semi"||o.type==="rbrace"||o.type==="eof")return!1;if(o.type==="lparen"||o.type==="op"&&Rg.has(o.value)||o.type==="ident"&&e.peek(r-1).type==="comma"||r===0&&o.type==="ident"&&e.peek(1).type==="comma")return!0}}function vg(e){let t=[st(e)];for(;e.at("comma");)e.next(),t.push(st(e));return{type:"expr",items:t}}function eo(e,t=!0){if(t&&wg(e))return vg(e);let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return kg(e);case"number":{let o=e.expectNumber("number");if(!t||!e.at("comma"))return{type:"number",value:o};let n=[o];for(;e.at("comma");)e.next(),n.push(e.expectNumber("number in tuple"));return{type:"tuple",values:n}}case"ident":return{type:"ident",segments:dr(e)};default:throw new j(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var Pg=new Set([">","<",">=","<=","==","!="]);function Lg(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function cr(e,t,r){let o=r(e);for(;Lg(e,t);)o={kind:"binary",operator:e.next().value,left:o,right:r(e)};return o}var Mg=new Set(["||"]),Tg=new Set(["&&"]),$g=new Set(["+","-"]),Ag=new Set(["*","/"]);function st(e){return cr(e,Mg,Eg)}function Eg(e){return cr(e,Tg,Ng)}function Ng(e){return cr(e,Pg,Og)}function Og(e){return cr(e,$g,Bg)}function Bg(e){return cr(e,Ag,Js)}function Js(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:Js(e)}):Dg(e)}function Ig(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(st(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new j(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function Dg(e){let t=e.peek();switch(t.type){case"number":return{kind:"number",value:e.expectNumber("number")};case"string":return e.next(),{kind:"string",value:t.value};case"lparen":{e.next();let r=st(e);return e.expect("rparen","')'"),r}case"ident":{let r=dr(e);return r.length===1&&(r[0]==="true"||r[0]==="false")?{kind:"boolean",value:r[0]==="true"}:e.at("lparen")?{kind:"call",callee:r,args:Ig(e)}:{kind:"ref",path:r}}default:throw new j(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var Gg=["bind","bind2","action"];function to(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&Gg.includes(e.peek(2).type)}function ro(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,o=st(e),n=e.peek();if(!["newline","semi","rbrace","eof"].includes(n.type))throw new j(`unexpected '${n.value||n.type}' after binding`,n.line,n.col);return{key:t.value,operator:r,expr:o,line:t.line,col:t.col}}function Zs(e){let t=e.peek(),r=dr(e);e.expect("bind","'<-'");let o=st(e);return{target:r,expr:o,line:t.line,col:t.col}}function el(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function tl(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(Zs(e)),Qs(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new j(`unterminated handler '${t.value}'`,t.line,t.col);r.push(Zs(e)),Qs(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function Qs(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new j(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var oo=class{constructor(t){this.cursor=t}cursor;parseLayout(){return this.cursor.next(),{properties:this.parsePropertyBlock("layout")}}parseStyle(){this.cursor.next(),this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let t=[],r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let o=this.cursor.peek();throw new j("unterminated style block",o.line,o.col)}to(this.cursor)?(r.push(ro(this.cursor)),(this.cursor.at("newline")||this.cursor.at("semi"))&&this.cursor.next()):t.push(this.parseProperty()),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r.length?{properties:t,bindings:r}:{properties:t}}parseFields(){return this.cursor.next(),this.parsePropertyBlock("fields")}parseProperty(){let t=this.cursor.expect("ident","property key").value;this.cursor.expect("colon","':'");let r=t==="from"||t==="to"?Ks(this.cursor):eo(this.cursor);return this.consumeTerminator(),{key:t,value:r}}parsePropertyBlock(t){this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let o=this.cursor.peek();throw new j(`unterminated ${t} block`,o.line,o.col)}r.push(this.parseProperty()),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r}consumeTerminator(){if(this.cursor.at("newline")||this.cursor.at("semi")){this.cursor.next();return}if(this.cursor.at("rbrace")||this.cursor.at("eof"))return;let t=this.cursor.peek();throw new j(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var no=class{constructor(t){this.cursor=t;this.properties=new oo(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!Zr(t.value))throw new j(`unknown block kind '${t.value}'`,t.line,t.col);let r=this.cursor.expect("ident","block name"),o=this.parseComposition(),n=this.parseBlockEntries();return{kind:t.value,name:r.value,composition:o,entries:n}}parseComposition(){if(!this.cursor.at("colon"))return[];this.cursor.next();let t=[this.cursor.expect("ident",'reference name after ":"').value];for(;this.cursor.at("amp");)this.cursor.next(),t.push(this.cursor.expect("ident",'reference name after "&"').value);return t}parseBlockEntries(){return this.parseEntries(()=>this.parseBlockEntry())}parseDataEntries(){return this.parseEntries(()=>this.parseDataEntry())}parseEntries(t){this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let o=this.cursor.peek();throw new j('unterminated block (missing "}")',o.line,o.col)}r.push(t()),this.cursor.at("semi")&&this.cursor.next(),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r}parseBlockEntry(){let t=this.cursor.peek();if(t.type!=="ident")throw new j(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return Zr(t.value)&&this.cursor.peek(1).type==="ident"?{type:"block",block:this.parseBlock()}:t.value==="layout"&&this.cursor.peek(1).type==="lbrace"?{type:"layout",layout:this.properties.parseLayout()}:t.value==="style"&&this.cursor.peek(1).type==="lbrace"?{type:"style",style:this.properties.parseStyle()}:t.value==="fields"&&this.cursor.peek(1).type==="lbrace"?{type:"fields",fields:this.properties.parseFields()}:to(this.cursor)?{type:"binding",binding:ro(this.cursor)}:el(this.cursor)?{type:"handler",handler:tl(this.cursor)}:t.value==="data"&&this.cursor.peek(1).type==="lbrace"?{type:"data",data:this.parseDataBlock()}:{type:"property",property:this.properties.parseProperty()}}parseDataEntry(){let t=this.cursor.peek();return t.type==="ident"&&!Zr(t.value)&&this.looksLikeSeriesEntry()?{type:"block",block:this.parseSeriesEntry()}:this.parseBlockEntry()}parseDataBlock(){return this.cursor.next(),{kind:"data",name:"",composition:[],entries:this.parseDataEntries()}}looksLikeSeriesEntry(){if(this.cursor.peek(1).type==="lbrace")return!0;if(this.cursor.peek(1).type!=="colon")return!1;let t=2;if(this.cursor.peek(t).type!=="ident")return!1;for(t++;this.cursor.peek(t).type==="amp";){if(t++,this.cursor.peek(t).type!=="ident")return!1;t++}return this.cursor.peek(t).type==="lbrace"}parseSeriesEntry(){let t=this.cursor.expect("ident","series name"),r=this.parseComposition(),o=this.parseBlockEntries();return{kind:"Series",name:t.value,composition:r,entries:o}}};var io=class{constructor(t){this.cursor=t;this.blocks=new no(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new j(`document must start with 'sfl', got '${t.value}'`,t.line,t.col);let r=this.cursor.expect("number","version number");this.cursor.skipNewlines();let o=[];for(;!this.cursor.at("eof");)o.push(this.blocks.parseBlock()),this.cursor.skipNewlines();return{version:r.value,blocks:o}}};function jn(e){return new io(new Jr(qs(e))).parseDocument()}var _g=new Set(["columns","rows","count","step","origin","seed","jitter","chance","order","where"]),rl=2e4,Fg=1e6,ao=class{state;constructor(t){this.state=t>>>0}next(){this.state=this.state+1831565813>>>0;let t=this.state;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}};function Ve(e,t){throw new Error(`Repeat ${e.repeat}: ${t}`)}function Z(e,t,r){return(typeof t!="number"||!Number.isFinite(t))&&Ve(e,`${r} needs a number`),t}function Xn(e,t){let r=typeof t=="string"?/^#([0-9a-f]{6})$/i.exec(t):null;r||Ve(e,'a color has to be written as "#rrggbb"');let o=Number.parseInt(r[1],16);return[o>>16&255,o>>8&255,o&255]}var ol=e=>`#${e.map(t=>Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0")).join("")}`;function Hg(e,t,r){let o=n=>Z(e,r[n],`${t}()`);switch(t){case"random":{if(r.length===0)return e.random.next();let n=r.length===1?0:o(0),i=r.length===1?o(0):o(1);return n+e.random.next()*(i-n)}case"pick":return r.length===0&&Ve(e,"pick() needs at least one value"),r[Math.floor(e.random.next()*r.length)];case"exp":return Math.exp(o(0));case"pow":return o(0)**o(1);case"dist":return Math.hypot(o(0)-o(2),o(1)-o(3));case"mix":{let n=Xn(e,r[0]),i=Xn(e,r[1]),a=Math.max(0,Math.min(1,o(2)));return ol(n.map((s,l)=>s+(i[l]-s)*a))}case"shade":{let n=o(1);return ol(Xn(e,r[0]).map(i=>i*n))}case"floor":return Math.floor(o(0));case"ceil":return Math.ceil(o(0));case"round":return Math.round(o(0));case"abs":return Math.abs(o(0));case"sqrt":return Math.sqrt(o(0));case"sin":return Math.sin(o(0));case"cos":return Math.cos(o(0));case"min":return Math.min(...r.map((n,i)=>o(i)));case"max":return Math.max(...r.map((n,i)=>o(i)));case"when":return r[0]?r[1]:r[2];default:return Ve(e,`unknown function ${t}()`)}}function vt(e,t){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"ref":{let r=t.path.join("."),o=e.vars.get(r);return o===void 0&&Ve(e,`unknown name ${r}`),o}case"unary":{let r=vt(e,t.operand);return t.operator==="-"?-Z(e,r,"a minus"):!r}case"call":return Hg(e,t.callee.join("."),t.args.map(r=>vt(e,r)));case"binary":{let r=vt(e,t.left),o=vt(e,t.right);switch(t.operator){case"+":return typeof r=="string"||typeof o=="string"?`${r}${o}`:Z(e,r,"+")+Z(e,o,"+");case"-":return Z(e,r,"-")-Z(e,o,"-");case"*":return Z(e,r,"*")*Z(e,o,"*");case"/":return Z(e,r,"/")/Z(e,o,"/");case">":return Z(e,r,">")>Z(e,o,">");case"<":return Z(e,r,"<")<Z(e,o,"<");case">=":return Z(e,r,">=")>=Z(e,o,">=");case"<=":return Z(e,r,"<=")<=Z(e,o,"<=");case"==":return r===o;case"!=":return r!==o;case"&&":return!!r&&!!o;case"||":return!!r||!!o}}}}var so=e=>Math.round(e*1e3)/1e3;function Zn(e,t){if(t.type!=="expr")return t;let r=t.items.map(o=>vt(e,o));if(r.length===1){let[o]=r;return typeof o=="number"?{type:"number",value:so(Z(e,o,"a value"))}:typeof o=="string"?{type:"string",value:o}:{type:"ident",segments:[String(o)]}}return{type:"tuple",values:r.map(o=>so(Z(e,o,"a tuple")))}}function nl(e,t){return t.map(r=>({key:r.key,value:Zn(e,r.value)}))}function Vg(e,t,r){switch(t.type){case"property":return{type:"property",property:{key:t.property.key,value:Zn(e,t.property.value)}};case"layout":return{type:"layout",layout:{properties:nl(e,t.layout.properties)}};case"style":return{type:"style",style:{...t.style,properties:nl(e,t.style.properties)}};case"block":return{type:"block",block:al(e,t.block,r)};default:return t}}function al(e,t,r){return{...t,name:`${t.name}${r}`,entries:t.entries.map(o=>Vg(e,o,r))}}function qn(e,t){for(let r of e.entries)if(r.type==="property"&&r.property.key===t)return r.property.value}function Ze(e,t){for(let r of e.entries)if(r.type==="property"&&r.property.key===t){let o=r.property.value;if(o.type==="number")return[o.value];if(o.type==="tuple")return o.values}}function il(e){let t={vars:new Map,random:new ao(0),repeat:e.name},r=Ze(e,"count")?.[0],o=Math.max(1,Math.floor(r??Ze(e,"columns")?.[0]??1)),n=r===void 0?Math.max(1,Math.floor(Ze(e,"rows")?.[0]??1)):1,i=o*n;i>rl&&Ve(t,`${i} cells are too many, the limit is ${rl}`);let[a=0,s=a]=Ze(e,"step")??[],[l=0,d=0]=Ze(e,"origin")??[],c=Ze(e,"seed")?.[0]??0,u=Ze(e,"jitter")?.[0]??0,m=Ze(e,"chance")?.[0]??1,f=qn(e,"order")?.type==="ident"&&qn(e,"order").segments[0]==="diagonal",h=qn(e,"where"),y=e.entries.flatMap(S=>S.type==="property"&&S.property.value.type==="expr"&&!_g.has(S.property.key)?[S.property]:[]),x=e.entries.flatMap(S=>S.type==="block"?[S.block]:[]);x.some(S=>S.kind==="Repeat")&&Ve(t,"a Repeat cannot hold another Repeat"),i*Math.max(1,x.length)>Fg&&Ve(t,"too many blocks");let b=[];for(let S=0;S<n;S++)for(let w=0;w<o;w++)b.push([w,S]);f&&b.sort((S,w)=>S[0]+S[1]-(w[0]+w[1])||S[0]-w[0]);let C=[];for(let[S,w]of b){let O=w*o+S;if(t.random=new ao(Math.imul(c+1,2654435761)^Math.imul(O+1,2246822507)),m<1&&t.random.next()>=m)continue;let A=()=>u>0?(t.random.next()*2-1)*u:0;t.vars=new Map([["col",S],["row",w],["index",O],["count",i],["columns",o],["rows",n],["x",so(l+S*a+A())],["y",so(d+w*s+A())]]);for(let G of y){let V=Zn(t,G.value);V.type==="number"||V.type==="string"?t.vars.set(G.key,V.value):V.type==="ident"?t.vars.set(G.key,V.segments[0]==="true"?1:0):Ve(t,`${G.key} needs a number`)}if(h&&h.type==="expr"&&!h.items.map(V=>vt(t,V))[0])continue;let _=n===1?`_${S}`:`_${S}_${w}`;for(let G of x)C.push(al(t,G,_))}return C}function sl(e){return e.flatMap(t=>t.kind==="Repeat"?il(t):t.entries.some(r=>r.type==="block")?[{...t,entries:t.entries.flatMap(r=>r.type==="block"?(r.block.kind==="Repeat"?il(r.block):sl([r.block])).map(o=>({type:"block",block:o})):[r])}]:[t])}function Kn(e){for(let t of e)for(let r of t.entries){let o=r.type==="property"?[r.property]:r.type==="layout"?r.layout.properties:r.type==="style"?r.style.properties:[];for(let n of o)if(n.value.type==="expr")throw new Error(`${t.kind} ${t.name}: ${n.key} is computed, and only a Repeat can work out a computed value`);r.type==="block"&&Kn([r.block])}}function ll(e){let t=o=>o.some(n=>n.kind==="Repeat"||n.entries.some(i=>i.type==="block"?t([i.block]):!1));if(!t(e.blocks))return Kn(e.blocks),e;let r={...e,blocks:sl(e.blocks)};return Kn(r.blocks),r}function R(e){if(e){if(e.type==="string")return e.value;if(e.type==="ident")return e.segments.join(".");if(e.type==="number")return String(e.value)}}function v(e){return e?.type==="number"?e.value:void 0}function Le(e){return e?.type==="tuple"?e.values:void 0}function dl(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function Wg(e,t){if(e.length<2)return null;let r=e[e.length-1],o=e[e.length-2],n=t.idByName.get(o);return(n?t.canvasObjectById.get(n):void 0)?.symbol?.ports?.some(a=>a.name===r)?{id:n,port:r}:null}function Pt(e,t){if(e?.type!=="endpoint")return{};let r=Wg(e.segments,t);if(r)return r;let o=e.segments[e.segments.length-1];return{id:t.idByName.get(o)??o,side:e.side,fraction:e.fraction}}function W(e){let t=new Map;for(let r of e.entries)r.type==="property"&&t.set(r.property.key,r.property.value);return t}function lo(e){let t=new Map;for(let r of e.entries)if(r.type==="style")for(let o of r.style.properties)t.set(o.key,o.value);return t}function cl(e){let t=new Map;for(let r of e.entries)if(r.type==="layout")for(let o of r.layout.properties)t.set(o.key,o.value);return t}function q(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function ul(e){for(let t of e.entries)if(t.type==="data")return t.data}function Lt(e){let t=ul(e);return t?[...q(e),...q(t)]:q(e)}function ml(e,t){let r=W(e).get(t);if(r!==void 0)return r;let o=ul(e);return o?W(o).get(t):void 0}var zg=["Entity","Shape","Text","Container","Path","Chart","Widget","Component","Isometric","Dimension"],Yg=new Set(zg);function Mt(e){return Yg.has(e)}function pl(e,t){for(let r of e)Mt(r.kind)&&t.set(r.name,R(W(r).get("id"))??r.name),pl(q(r),t)}function co(e){let t=new Map;return e&&pl(q(e),t),t}var Ug=new Set(["id","from","to","text","order","segments"]);function uo(e){let t={};for(let[r,o]of e){if(Ug.has(r))continue;let n=R(o);n!==void 0&&(t[r]=n)}return t}var jg=new Set(["top","bottom","front","back","left","right"]);function fl(e){return e!==void 0&&jg.has(e)?e:"front"}function hl(e,t,r,o,n=[]){let i={idByName:co(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=o.mergedProps(a);return{id:R(l.get("id"))??a.name,fromId:Pt(l.get("from"),i).id,toId:Pt(l.get("to"),i).id,fromFace:fl(R(l.get("fromFace"))),toFace:fl(R(l.get("toFace"))),order:v(l.get("order")),sourceIndex:n[s],props:uo(l)}})}function gl(e,t,r){let o=t.mergedProps(e),n=Pt(o.get("from"),r),i=Pt(o.get("to"),r);return{id:R(o.get("id"))??e.name,fromId:n.id,toId:i.id,text:R(o.get("text")),fromSide:n.side,fromFraction:n.fraction,toSide:i.side,toFraction:i.fraction,fromPort:n.port,toPort:i.port,order:v(o.get("order")),segments:dl(o.get("segments")),props:uo(o)}}function yl(e,t,r,o,n=[]){let i={idByName:co(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...gl(a,o,i),sourceIndex:n[s]}))}function Xg(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(o=>o.type==="ident"?[o.segments]:[]):[]}function qg(e,t,r,o,n){let i=[{type:"property",property:{key:"from",value:{type:"endpoint",segments:t}}},{type:"property",property:{key:"to",value:{type:"endpoint",segments:r}}}];return n&&i.push({type:"property",property:{key:"text",value:{type:"string",value:n}}}),{kind:"Link",name:`${e.name}_${o+1}`,composition:[],entries:i}}function bl(e,t){let r=Xg(e,t);if(r.length<2)return[];let o=R(t.mergedProps(e).get("text"));return r.slice(1).map((n,i)=>qg(e,r[0],n,i,o))}function xl(e,t){let r=R(t.layoutProp(e,"flow")),o=v(t.layoutProp(e,"gap"))??0,n=0;return i=>{if(r!=="horizontal"&&r!=="vertical")return;let a=r==="horizontal"?[n,0]:[0,n];return n+=(r==="horizontal"?i[0]:i[1])+o,a}}var mo=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function Tt(e){return e!==void 0&&mo.includes(e)}function We(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let o=v(r);return o===void 0?[]:[o]});return t.length>0?t:void 0}function Sl(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=R(t);return r===void 0?[]:[r]})}function Be(e){let t=R(e);if(t!==void 0)return t==="true"}function Qn(e){let t=e?W(e):new Map;return{min:v(t.get("min"))??0,max:v(t.get("max"))??10,step:v(t.get("step"))??1,label:R(t.get("label")),unit:R(t.get("unit")),thresholds:We(t.get("thresholds"))}}function Cl(e){return Lt(e).filter(t=>t.kind==="Rule").map(t=>{let r=W(t);return{id:t.name,at:v(r.get("at"))??0,text:R(r.get("text")),color:R(r.get("color")),strokeWidth:v(r.get("strokeWidth")),dash:We(r.get("dash"))}})}function kl(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(v);return t.every(r=>r!==void 0)?t:void 0}function Rl(e){return e?.type!=="list"?[]:Kg(e.values)==="tuple"?Qg(e.values):Zg(e.values)}function Kg(e){for(let t of e){if(t.type==="number")return"scalar";if(kl(t))return"tuple"}}function Zg(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function Qg(e){return e.flatMap(t=>{let r=kl(t);return r?[r]:[]})}function wl(e){if(e?.type==="list")return e.values.map(Jg)}function Jg(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:ey(e)}function ey(e){if(e.type!=="list"||e.values.length<2)return null;let t=v(e.values[0]),r=v(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function vl(e){if(e?.type==="list")return e.values.map(ty)}function ty(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:R(e)??null}function Pl(e,t){if(e?.type==="list"){let n=e.values.flatMap(ry);return n.length>0?{points:n}:void 0}let r=R(e),o=r?t.get(r):void 0;if(o)return{points:o.points,normalized:!0,tension:o.tension}}function ry(e){if(e.type!=="list"||e.values.length<2)return[];let t=v(e.values[0]),r=v(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function Ll(e,t,r){let o=r(e);return{id:e.name,label:R(o.get("label"))??e.name,color:R(o.get("color")),colors:vl(o.get("colors")),opacity:v(o.get("opacity")),group:R(o.get("group")),values:Rl(o.get("values")),error:wl(o.get("error")),source:R(o.get("source")),target:R(o.get("target")),size:v(o.get("size")),symbol:Pl(o.get("symbol"),t),stroke:R(o.get("stroke")),strokeWidth:v(o.get("strokeWidth")),dash:We(o.get("dash")),offset:v(o.get("offset")),labelOffsetX:v(o.get("labelOffsetX")),labelOffsetY:v(o.get("labelOffsetY"))}}function Ml(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let o=R(r.values[0]);return o===void 0?[]:[{label:o,color:R(r.values[1]),offsetX:v(r.values[2]),offsetY:v(r.values[3])}]});return t.length>0?t:void 0}var oy=["none","true","percent","waterfall"];function ny(e){return Tt(e)?e:"bar"}function iy(e){return oy.find(t=>t===e)}function Tl(e,t,r,o){let n=Lt(e),i=n.filter(s=>s.kind==="Axis"),a=R(t.get("stacked"));return{chartType:ny(R(t.get("type"))),categories:Sl(ml(e,"categories")),areaOpacity:v(t.get("areaOpacity")),stacked:iy(a),scale:R(t.get("scale")),interpolate:R(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:v(t.get("idwPower")),isolines:We(t.get("isolines")),zones:Ml(t.get("zones")),boxWidth:v(t.get("boxWidth")),orientation:R(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:v(t.get("lineTension")),highlightPoints:We(t.get("highlightPoints")),barCornerRadius:v(t.get("barCornerRadius")),showBoxplotPoints:Be(t.get("showBoxplotPoints")),barBorderColor:R(t.get("barBorderColor")),barBorderWidth:v(t.get("barBorderWidth")),barGroupGap:v(t.get("barGroupGap")),barGlow:v(t.get("barGlow")),barGap:v(t.get("barGap")),mekkoVaryHeight:Be(t.get("mekkoVaryHeight")),hexRadius:v(t.get("hexRadius")),innerRadius:v(t.get("innerRadius")),pieCornerRadius:v(t.get("pieCornerRadius")),pieSliceGap:v(t.get("pieSliceGap")),ringThickness:v(t.get("ringThickness")),ringGap:v(t.get("ringGap")),cellGap:v(t.get("cellGap")),showValues:Be(t.get("showValues")),squareCells:Be(t.get("squareCells")),headerColor:R(t.get("headerColor")),tileGradient:Be(t.get("tileGradient")),showColumnBackdrop:Be(t.get("showColumnBackdrop")),labelPosition:R(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:R(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:R(t.get("labelColor")),linkGradient:Be(t.get("linkGradient")),connectPoints:Be(t.get("connectPoints")),reverseComparison:Be(t.get("reverseComparison")),axisX:Qn(i.find(s=>s.name==="x")),axisY:Qn(i.find(s=>s.name==="y"||s.name==="value")),series:n.filter(s=>s.kind==="Series").map(s=>Ll(s,r,o)),rules:Cl(e)}}function $l(e,t,r,o,n){return{...e,objectType:"chart",chart:Tl(t,r,o,n)}}function Al(e,t){let[r,o]=Le(e)??[];return{x:t.x+(r??0),y:t.y+(o??0)}}function El(e,t){return{start:Al(e.get("start"),t),end:Al(e.get("end"),t),offset:v(e.get("offset"))??0,unit:R(e.get("unit"))}}function Nl(e,t,r){return{...e,objectType:"dimension",dimension:El(t,r)}}function fo(e,t){return Math.max(0,t.tension??e.tension)}function ho(e){return e.points.length<3||e.points.every(t=>fo(e,t)<=0)}function po(e,t){let{points:r}=e;return e.closed?r[(t+r.length)%r.length]:r[Math.max(0,Math.min(r.length-1,t))]}function go(e){let t=e.closed?e.points.length:e.points.length-1;return Array.from({length:Math.max(0,t)},(r,o)=>{let n=po(e,o-1),i=po(e,o),a=po(e,o+1),s=po(e,o+2),l=fo(e,i)/6,d=fo(e,a)/6;if(l===0&&d===0)return{from:i,to:a,controls:null};let c={x:i.x+(a.x-n.x)*l,y:i.y+(a.y-n.y)*l},u={x:a.x-(s.x-i.x)*d,y:a.y-(s.y-i.y)*d};return{from:i,to:a,controls:[c,u]}})}function ay(e,t){let{from:r,to:o,controls:n}=e,i=1-t,a=[i*i*i,3*i*i*t,3*i*t*t,t*t*t],s=[r,n[0],n[1],o];return{x:s.reduce((l,d,c)=>l+d.x*a[c],0),y:s.reduce((l,d,c)=>l+d.y*a[c],0)}}function Jn(e,t=8){if(ho(e))return e.points.map(i=>({x:i.x,y:i.y}));let r=[],o=go(e);o.forEach(i=>{if(r.push({x:i.from.x,y:i.from.y}),i.controls){let a={...i,controls:i.controls};for(let s=1;s<t;s++)r.push(ay(a,s/t))}});let n=o[o.length-1];return!e.closed&&n&&r.push({x:n.to.x,y:n.to.y}),r}function sy(e){if(e.type!=="list"||e.values.length<2)return[];let t=v(e.values[0]),r=v(e.values[1]),o=e.values[2]===void 0?void 0:v(e.values[2]);return t===void 0||r===void 0?[]:[o===void 0?{x:t,y:r}:{x:t,y:r,tension:o}]}function Ol(e,t){let r=Jn({points:e,tension:t,closed:!0});return r.length>=3?r.map(o=>[o.x,o.y]):void 0}function ly(e,t){if(e?.type==="list")return Ol(e.values.flatMap(sy),0);let r=R(e),o=r?t.get(r):void 0;if(!o)return;let n=o.points.map(([i,a],s)=>{let l=o.pointTensions?.[s];return l===void 0?{x:i,y:a}:{x:i,y:a,tension:l}});return Ol(n,o.tension??0)}function Bl(e,t,r){return{depth:t,icon:R(e.get("icon")),footprint:ly(e.get("symbol"),r),form:R(e.get("shape"))==="sphere"?"sphere":"box"}}function Il(e,t,r,o,n){let i=Le(o(t,"size"));return{...e,objectType:"isometric",isometric:Bl(r,i?.[2]??24,n)}}function Dl(e,t){let r=e.get("points");return{points:r?.type==="list"?r.values.flatMap(n=>{if(n.type!=="list"||n.values.length<2)return[];let i=v(n.values[0]),a=v(n.values[1]),s=n.values[2]===void 0?void 0:v(n.values[2]);if(i===void 0||a===void 0)return[];let l={x:t.x+i,y:t.y+a};return[s===void 0?l:{...l,tension:s}]}):[],tension:v(e.get("tension")),startMarker:R(e.get("startMarker")),endMarker:R(e.get("endMarker")),closed:R(e.get("closed"))==="true",value:v(e.get("value"))}}function Gl(e,t,r){return{...e,objectType:"path",path:Dl(t,r)}}function _l(e){let t=R(e.get("orientation"))==="vertical"?"vertical":"horizontal",r=e.get("lanes"),o=r?.type==="list"?r.values.flatMap((i,a)=>{if(i.type!=="list")return[];let s=R(i.values[0]),l=v(i.values[1]);if(s===void 0||l===void 0)return[];let d=R(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:o}}function Fl(e,t){return{...e,objectType:"swimlane",swimlane:_l(t)}}function dy(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":lr(e.kind)?R(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":e.kind==="Dimension"?"dimension":R(t.get("kind"))??""}function cy(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":at(e)?"component":e==="isometric"?"isometric":e==="dimension"?"dimension":"shape"}function Hl(e,t,r){let o=dy(e,t),n=R(t.get("shape")),i=n?r.get(n):void 0;return{objectType:lr(e.kind)?"component":cy(o),kind:o,shapeType:i?"symbol":n,symbol:i}}function Vl(e,t,r,o){let n=o??Le(r(e,"position"))??[0,0],i=Le(r(e,"size"))??[0,0];return{x:t.x+(n[0]??0),y:t.y+(n[1]??0),width:i[0]??0,height:i[1]??0,rotation:v(r(e,"rotation")),order:v(r(e,"order"))}}var uy=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function Wl(e){let t={};for(let[r,o]of e){if(uy.has(r))continue;let n=R(o);n!==void 0&&(t[r]=n)}return t}function zl(e,t,r,o,n){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=Hl(e,l,s),c=Vl(e,t,a,n),u={id:R(l.get("id"))??e.name,kind:d.kind,text:R(l.get("text")),...c,parentFrameId:o??R(l.get("parent")),props:Wl(l)};switch(d.objectType){case"chart":return $l(u,e,l,s,i);case"isometric":return Il(u,e,l,a,s);case"path":return Gl(u,l,t);case"dimension":return Nl(u,l,t);case"swimlane":return Fl(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:R(l.get("type"))??"rollingNumber",value:R(l.get("value"))??"0",digits:v(l.get("digits")),duration:v(l.get("duration")),min:v(l.get("min")),max:v(l.get("max")),label:R(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function Yl(e){return q(e).filter(t=>Mt(t.kind)).map(t=>R(W(t).get("id"))??t.name)}var ei=class{#e;#o=[];#t=[];#r=[];#n=[];#i=[];#s=0;constructor(t){this.#e=t.canvasObjectResolutionContext}resolve(t){let r=t?this.#a(t,{origin:{x:0,y:0}}):[];return{canvasObjects:this.#o,groups:r,linkBlocks:this.#t,connectionBlocks:this.#r,linkSourceIndexes:this.#n,connectionSourceIndexes:this.#i}}#a(t,r){let o=[],n=xl(t,this.#e);for(let i of q(t))o.push(...this.#l(i,r,n));return o}#l(t,r,o){let n=this.#s++;if(t.kind==="Container")return this.#c(t,r,o,n);if(Mt(t.kind))return this.#u(t,r,o,n),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#t.push(t),this.#n.push(n),[];case"Connection":return this.#r.push(t),this.#i.push(n),[];case"Net":{let i=bl(t,this.#e);return this.#t.push(...i),this.#n.push(...i.map(()=>n)),[]}default:return[]}}#c(t,r,o,n){let i=this.#d(t,r,o,n);return this.#o.push(i),this.#a(t,{origin:{x:i.x,y:i.y},frameId:i.id})}#u(t,r,o,n){this.#o.push(this.#d(t,r,o,n))}#d(t,r,o,n){let i=Le(this.#e.layoutProp(t,"size"))??[0,0];return{...zl(t,r.origin,this.#e,r.frameId,o(i)),sourceIndex:n}}#m(t,r){let o=this.#e.mergedProps(t);return{id:R(o.get("id"))??t.name,name:R(o.get("text"))??t.name,color:R(o.get("color")),icon:R(o.get("icon")),canvasObjectIds:Yl(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??R(o.get("parent"))}}};function Ul(e,t){return new ei(t).resolve(e)}function jl(e){let t=W(e),r=R(t.get("program")),o=v(t.get("surfacePadding"));if(!r)return;let n={};for(let[i,a]of t){if(i==="program"||i==="surfacePadding")continue;let s=v(a),l=R(a);s!==void 0?n[i]=s:l!==void 0&&(n[i]=l==="true"?!0:l==="false"?!1:l)}return{name:e.name,program:r,...o===void 0?{}:{surfacePadding:Math.max(0,o)},parameters:n}}function my(e){let t=W(e).get("points"),r=[],o=[];if(t?.type!=="list")return{points:r,tensions:o};for(let n of t.values){if(n.type!=="list"||n.values.length<2)continue;let i=v(n.values[0]),a=v(n.values[1]);i===void 0||a===void 0||(r.push([i,a]),o.push(n.values[2]===void 0?void 0:v(n.values[2])))}return{points:r,tensions:o}}function py(e){let t=q(e).filter(r=>r.kind==="Port").flatMap(r=>{let o=Le(W(r).get("at"));return typeof o?.[0]!="number"||typeof o[1]!="number"?[]:[{name:r.name,at:[o[0],o[1]]}]});return t.length>0?t:void 0}function Xl(e){let{points:t,tensions:r}=my(e);if(!(t.length<2))return{name:e.name,points:t,pointTensions:r.some(o=>o!==void 0)?r:void 0,tension:v(W(e).get("tension")),ports:py(e)}}function fy(e){return q(e).find(t=>t.kind==="Model")}function ql(e){return{styles:gy(e),layouts:yy(e),symbols:by(e),shaders:hy(e),model:xy(e)}}function hy(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let o=jl(r);o&&t.set(r.name,o)}return t}function gy(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function yy(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function by(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let o=Xl(r);o&&t.set(r.name,o)}return t}function xy(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=fy(t);if(r)return r}}}function Kl(e,t,r){let o,n;for(let i of e)t.has(i)?o=i:r.has(i)&&(n=i);return{styleRef:o,layoutRef:n}}function Zl(e,t,r,o){for(let n of e.composition)!t.has(n)&&!r.has(n)&&o.push({severity:"warning",code:"unresolved-style-or-layout",ownerId:e.name,message:`"${n}" is not a Style or Layout defined at the top level of the document \xC3\xA2\xE2\u201A\xAC\xE2\u20AC\x9D "${e.name}" gets no shape, fill, or stroke from it.`});for(let n of q(e))Zl(n,t,r,o)}function Ql(e,t,r){let o=[];for(let n of e.blocks)Zl(n,t,r,o);return o}function ri(e,t){return new ti(e,t).resolveAll()}var ti=class{#e;#o;#t=new Map;constructor(t,r){this.#e=t,this.#o=r}resolveAll(){for(let t of this.#e.keys())this.#r(t,new Set);return this.#t}#r(t,r){let o=this.#t.get(t);if(o)return o;let n=this.#e.get(t);if(!n||r.has(t))return new Map;let i=this.#n(n,new Set([...r,t]));for(let[a,s]of W(n))i.set(a,s);return this.#t.set(t,i),i}#n(t,r){let o=this.#o(t);return o?new Map(this.#r(o,r)):new Map}};function Jl(e){let{styles:t,layouts:r,symbols:o,shaders:n}=e,i=c=>Kl(c.composition,t,r),a=ri(t,c=>i(c).styleRef),s=ri(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[m,f]of W(c))u.set(m,f);for(let[m,f]of lo(c))u.set(m,f);return u},layoutProp:(c,u)=>{let m=cl(c);if(m.has(u))return m.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:o,shaderDefs:n}}var Sy=new Set(["radar","radial"]),ed=new Set(["scatter","custom","hexbin"]);function td(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=R(W(o).get("type"));n!==void 0&&!Tt(n)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:o.name,message:`Unsupported chart type '${n}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn as a plain series plot. Supported: ${mo.join(", ")}.`})}for(let n of q(o))r(n)};for(let o of e.blocks)r(o);return t}function rd(e){let t=[],r=o=>{if(o.kind==="Chart")for(let n of Lt(o).filter(i=>i.kind==="Series"))W(n).has("values")||t.push({severity:"warning",code:"series-without-values",ownerId:n.name,message:`Series '${n.name}' has no values. If this was meant to be an Axis or Rule, it needs that keyword in front of the name \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D inside data{}, a bare name is read as a Series.`});for(let n of q(o))r(n)};for(let o of e.blocks)r(o);return t}function od(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=R(W(o).get("type")),i=Tt(n)?n:"bar";R(lo(o).get("gridShape"))==="circle"&&!ed.has(i)&&!Sy.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:o.name,message:`gridShape: circle isn't supported on '${i}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn with the standard rectangular grid instead. Supported: ${[...ed].join(", ")}.`})}for(let n of q(o))r(n)};for(let o of e.blocks)r(o);return t}function nd(e){let t=[],r=o=>{if(lr(o.kind)){let n=R(W(o).get("type"))??"rollingNumber";zn(n)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:o.name,message:`Unsupported component type '${n}'. Supported: ${Wn().join(", ")}.`})}for(let n of q(o))r(n)};for(let o of e.blocks)r(o);return t}function id(e){let t=ql(e);return{model:t.model,diagnostics:[...Ql(e,t.styles,t.layouts),...td(e),...od(e),...rd(e),...nd(e)],canvasObjectResolutionContext:Jl(t)}}function ad(e){let t=id(e),{canvasObjects:r,groups:o,linkBlocks:n,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=Ul(t.model,t),l=yl(t.model,n,r,t.canvasObjectResolutionContext,a),d=hl(t.model,i,r,t.canvasObjectResolutionContext,s);return{canvasObjects:r,groups:o,links:l,connections:d,diagnostics:t.diagnostics,shaders:[...t.canvasObjectResolutionContext.shaderDefs.values()]}}function ur(e){return e.objectType==="dimension"&&e.dimension!==void 0}function mr(e){return e.objectType==="isometric"&&e.isometric!==void 0}function sd(e){return ad(ll(jn(e)))}var pr=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function wy(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${pr})\\s+([-\\d.]+)%`,"g");for(let n of t[2].matchAll(o))r.push({color:n[1],position:Number(n[2])});return{type:"gradient",angle:Number(t[1]),stops:r}}function vy(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${pr})\\s+([-\\d.]+)\\s*,\\s*([-\\d.]+)`,"g"),n=0;for(let i of t[1].matchAll(o))r.push({id:`mp-${Date.now()}-${n++}`,color:i[1],x:Number(i[2]),y:Number(i[3])});return{type:"mesh",points:r}}function be(e){if(!(e==null||e===""))return wy(e)??vy(e)??e}function yo(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${pr})\\s+([-\\d.]+)`,"g");for(let n of t[1].matchAll(o))r.push({color:n[1],position:Number(n[2])});return{type:"ramp",stops:r}}function Py(e,t,r){switch(t){case"color":e.color=r;break;case"opacity":e.opacity=Number(r);break;case"blur":e.blur=Number(r);break;case"angle":e.angle=Number(r);break;case"distance":e.distance=Number(r);break}}function Me(e){if(!e)return;if(e==="on")return{enabled:!0};let t=e.match(/^shadow\((.*)\)\s*$/);if(!t)return;let r={enabled:!0};for(let o of t[1].split(",")){let n=o.split(":");n.length===2&&Py(r,n[0].trim(),n[1].trim())}return r}var k=e=>e===void 0?void 0:Number(e);function Ly(e){try{return JSON.parse(e)}catch{return}}function Qe(e){if(e===void 0)return;let t=Ly(e);if(!Array.isArray(t))return;let r=t.filter(o=>typeof o=="number"&&Number.isFinite(o));return r.length===t.length?r:void 0}function xe(e){let t=be(e);return typeof t=="string"?t:void 0}var My=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function Se(e){return e&&My.test(e)?e:void 0}function Ie(e,t,r){return t.includes(e)?e:r}var bo=["normal","bold"],ld=["normal","bold","100","200","300","400","500","600","700","800","900"],dd=["top","bottom","left","right"],oi=["none","arrow","filled_arrow"];function $t(e){let t=be(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var cd=["left","center","right"],ud=["top","middle","bottom"],xo=["solid","dashed","dotted"],So=["straight","curved","orthogonal"];function fe(e,t){return e!==void 0&&t.includes(e)?e:void 0}var md=["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pd=["solid","dashed","dotted","double"],ni=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function Ty(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function $y(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function Ay(e){return e==="dashed"||e==="dotted"?e:"solid"}function Ey(e){return{axisX:e.chart?.axisX??{min:0,max:4,step:1},axisY:e.chart?.axisY??{min:0,max:500,step:100},series:(e.chart?.series??[]).map(t=>({...t,color:be(t.color),colors:t.colors?.map(r=>r===null?null:be(r)??null),strokeWidth:t.strokeWidth})),rules:(e.chart?.rules??[]).map(t=>({id:t.id,at:t.at,text:t.text,color:t.color,strokeWidth:t.strokeWidth,dash:t.dash}))}}function Ny(e){let t=Ty(e.fill);return{fillColor:t?"#111418":be(e.fill)??"#ffffff",fillImage:t,strokeColor:xe(e.stroke)??"#475569",strokeWidth:k(e.strokeWidth)??1,cornerRadius:k(e.cornerRadius)??12,shadowStyle:Me(e.shadow)}}function Oy(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:k(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:Ay(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function By(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:k(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:k(e.tickLength),axisFontSize:k(e.axisFontSize),axisLabelAngle:k(e.axisLabelAngle),axisLabelSpace:k(e.axisLabelSpace),rowLabelSide:e.rowLabelSide==="left"||e.rowLabelSide==="right"?e.rowLabelSide:void 0,columnLabelSide:e.columnLabelSide==="top"||e.columnLabelSide==="bottom"?e.columnLabelSide:void 0,legendSide:e.legendSide==="top"||e.legendSide==="bottom"||e.legendSide==="left"||e.legendSide==="right"?e.legendSide:void 0,xLabelGap:k(e.xLabelGap),yLabelGap:k(e.yLabelGap),axisLabelAlign:e.axisLabelAlign==="left"||e.axisLabelAlign==="center"||e.axisLabelAlign==="right"?e.axisLabelAlign:void 0,axisFontFamily:e.axisFontFamily,showValueAxis:e.showValueAxis!=="false",categoryAlign:e.categoryAlign==="left"||e.categoryAlign==="inside"?e.categoryAlign:void 0,showAxisLabels:e.showAxisLabels!=="false"}}function Iy(e){return{textColor:e.textColor??"#0f172a",titleSize:k(e.titleSize),titleAlign:e.titleAlign==="left"||e.titleAlign==="center"||e.titleAlign==="right"?e.titleAlign:void 0,titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:k(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function Dy(e){return{legendColor:e.legendColor,legendGap:k(e.legendGap),showLegend:e.showLegend==="true",legendPosition:$y(e.legendPosition)}}function fd(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,...Ey(e),...Ny(t),...Oy(t),...By(t),...Iy(t),...Dy(t),order:e.order,sourceIndex:e.sourceIndex}}function hd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:be(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:k(t.barSegments),barSegmentGap:k(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:k(t.barGlassBlur),barGlassSaturation:k(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:k(t.barThickness),orientation:e?.orientation,barTrack:t.barTrack==="true",barRoundedBottom:t.barRoundedBottom==="true",barLabelMaxOnly:t.barLabelMaxOnly==="true",barTrackColor:t.barTrackColor,barTrackHatch:t.barTrackHatch==="true",barTrackHatchColor:t.barTrackHatchColor,barTrackHatchAngle:k(t.barTrackHatchAngle),barTrackHatchSpacing:k(t.barTrackHatchSpacing),barTrackHatchWidth:k(t.barTrackHatchWidth),stacked:e?.stacked??"true",showBarLabels:t.showBarLabels==="true",barLabelPosition:t.barLabelPosition==="inside"||t.barLabelPosition==="center"||t.barLabelPosition==="axis"?t.barLabelPosition:void 0,barLabelFontSize:k(t.barLabelFontSize),barLabelFontFamily:t.barLabelFontFamily,barLabelFontWeight:t.barLabelFontWeight==="bold"?"bold":void 0,barLabelColor:t.barLabelColor,barLabelPill:t.barLabelPill==="true",barLabelPillColor:t.barLabelPillColor,barLabelBorderColor:t.barLabelBorderColor,barLabelBorderWidth:k(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function gd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:k(t.lineWidth),lineGlow:k(t.lineGlow),pointSize:k(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:k(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:k(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function yd(e,t){return{categories:e?.categories,pointSize:k(t.pointSize),pointOpacity:k(t.pointOpacity),pointStrokeWidth:k(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function bd(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:k(t.boxWhiskerWidth),boxMedianWidth:k(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:k(t.boxCapSize),boxPointSize:k(t.boxPointSize),boxPointOpacity:k(t.boxPointOpacity),boxJitter:k(t.boxJitter)}}function xd(e){return{scale:yo(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function Sd(e,t){return{categories:e?.categories,zones:e?.zones,cellGap:e?.cellGap,showValues:e?.showValues,squareCells:e?.squareCells,barCornerRadius:e?.barCornerRadius,cellShape:t.cellShape==="circle"?"circle":t.cellShape==="square"?"square":void 0,cellStrokeColor:t.cellStrokeColor,cellStrokeWidth:k(t.cellStrokeWidth),cellValueSize:k(t.cellValueSize),cellValueColor:t.cellValueColor}}function Cd(e,t){return{hexRadius:e?.hexRadius,scale:yo(e?.scale),hexGap:k(t.hexGap),hexStrokeWidth:k(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:k(t.hexMinOpacity)}}function kd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:k(t.mekkoColumnGap),mekkoSegmentGap:k(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:k(t.mekkoSegmentStrokeWidth),mekkoLabelSize:k(t.mekkoLabelSize),mekkoValueSize:k(t.mekkoValueSize),mekkoTextColor:t.mekkoTextColor,showMekkoTotals:t.showMekkoTotals===void 0?void 0:String(t.showMekkoTotals)!=="false",mekkoValueFormat:t.mekkoValueFormat==="percent"?"percent":t.mekkoValueFormat==="value"?"value":void 0}}function Rd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:k(t.pieStartAngle),pieSweep:k(t.pieSweep),pieExplode:k(t.pieExplode),pieGlow:k(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:k(t.pieStrokeWidth),pieLabelPosition:t.pieLabelPosition==="inside"||t.pieLabelPosition==="outside"?t.pieLabelPosition:void 0,pieLabelContent:t.pieLabelContent==="percent"||t.pieLabelContent==="name"||t.pieLabelContent==="inline"?t.pieLabelContent:void 0,pieLabelColor:t.pieLabelColor,pieCenterText:t.pieCenterText,pieCenterSize:k(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function wd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:k(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:k(t.pieStrokeWidth),polarTrackOpacity:k(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:k(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:k(t.polarValueSize),polarNameSize:k(t.polarNameSize),polarValueFirst:t.polarValueFirst===void 0?void 0:String(t.polarValueFirst)!=="false",polarOutsideLabels:t.polarOutsideLabels===void 0?void 0:String(t.polarOutsideLabels)!=="false"}}function vd(e){return{radarStrokeWidth:k(e.radarStrokeWidth),radarPointSize:k(e.radarPointSize),radarTension:k(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function Pd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...vd(t)}}function Ld(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...vd(t)}}function Md(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:k(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:k(t.ringStartAngle),ringSweep:k(t.ringSweep)}}function Td(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:k(t.sankeyNodeWidth),sankeyNodeGap:k(t.sankeyNodeGap),sankeyLinkOpacity:k(t.sankeyLinkOpacity),sankeyLinkCurve:k(t.sankeyLinkCurve),sankeyLabelSize:k(t.sankeyLabelSize)}}function $d(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:k(t.tileStrokeWidth),tileLabelSize:k(t.tileLabelSize),tileValueSize:k(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:k(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:k(t.headerHeight)}}function Ad(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:k(t.customConnectorWidth),customConnectorOpacity:k(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:k(t.customBeforeStrokeWidth),customLabelSize:k(t.customLabelSize),customLabelColor:t.customLabelColor}}function Ed(e){let t=fd(e),r=e.chart,o=e.props,n=r?.chartType??"bar";switch(n){case"bar":return ne(t,n,hd(r,o));case"line":return ne(t,n,gd(r,o));case"scatter":return ne(t,n,yd(r,o));case"boxplot":return ne(t,n,bd(r,o));case"field":return ne(t,n,xd(r));case"heatmap":return ne(t,n,Sd(r,o));case"hexbin":return ne(t,n,Cd(r,o));case"mekko":return ne(t,n,kd(r,o));case"pie":return ne(t,n,Rd(r,o));case"polarArea":return ne(t,n,wd(r,o));case"radar":return ne(t,n,Pd(r,o));case"radial":return ne(t,n,Ld(r,o));case"radialBar":return ne(t,n,Md(r,o));case"sankey":return ne(t,n,Td(r,o));case"treemap":return ne(t,n,$d(r,o));case"custom":return ne(t,n,Ad(r,o))}}function ne(e,t,r){return{...e,chartType:t,config:r}}function Gy(e,t){let r=Number(t);if(t===void 0||t===""||!Number.isFinite(r))return e.default;let o=e.min===void 0?r:Math.max(e.min,r);return e.max===void 0?o:Math.min(e.max,o)}function _y(e,t){switch(e.type){case"number":return Gy(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return Se(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function Fy(e,t){let r={};for(let[o,n]of Object.entries(e?.properties??{}))r[o]=_y(n,t[o]);return r}function Hy(e,t){if(!e)return"";if(e.type==="boolean")return t==="true";if(e.type==="number"){let r=Number(t);return Number.isFinite(r)?r:e.default}return t}function Nd(e){let t=Rt(e.component.type);return{id:e.id,type:e.component.type,value:t?Hy(t.value,e.component.value):e.component.value,disabled:e.props.disabled==="true",label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,properties:Fy(t,e.props)}}var Vy=/^[\w\s,'"-]+$/;function ii(e){return e&&Vy.test(e)?e:void 0}var Wy=/^(?:[1-9]00|normal|bold)$/;function zy(e){return e==="plain"||e==="flip"?e:void 0}function Yy(e){return e==="roll"||e==="fade"?e:void 0}function Uy(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function ai(e){return e&&Wy.test(e)?e:void 0}var jy=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],Xy=["color","accent"];function qy(e){let t=e.props,r={};for(let o of jy){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of Xy){let n=Se(t[o]);n&&(r[o]=n)}return{id:e.id,type:"tickScale",value:e.component.value,max:e.component.max,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:Se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:ai(t.labelWeight),fontFamily:ii(t.labelFont)}:void 0}}var Ky=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],Zy=["color","accent","glow"],Qy={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},Jy=["core","peak"];function eb(e){let t=e.props,r={};for(let o of Ky){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of Zy)r[o]=Se(t[o])??Qy[o];for(let o of Jy){let n=Se(t[o]);n&&(r[o]=n)}return r.axis=t.axis==="horizontal"?"horizontal":"vertical",t.knob&&(r.knob=t.knob),{id:e.id,type:"ruler",value:e.component.value,min:e.component.min,max:e.component.max,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:Se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:ai(t.labelWeight),fontFamily:ii(t.labelFont)}:void 0}}function tb(e){let t=e.props;return{id:e.id,type:"rollingNumber",value:e.component.value,digits:e.component.digits,duration:e.component.duration,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,style:{color:Se(t.color),surface:Se(t.surface),divider:Se(t.divider),labelColor:Se(t.labelColor),fontFamily:ii(t.fontFamily),variant:zy(t.variant),motion:Yy(t.motion),fontWeight:ai(t.fontWeight),fontSize:Uy(t.fontSize)}}}var rb={rollingNumber:tb,tickScale:qy,ruler:eb};function Od(e){let t=e.component.type;return at(t)?rb[t](e):Nd(e)}function Bd(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,fromFace:e.fromFace,toFace:e.toFace,order:e.order,sourceIndex:e.sourceIndex,style:{pathType:fe(t.route,So)??"straight",color:$t(t.stroke),strokeWidth:k(t.strokeWidth),strokeStyle:fe(t.strokeStyle,xo),opacity:t.opacity!==void 0?k(t.opacity):void 0}}}function Id(e){let t=e.props;return{id:e.id,start:e.dimension.start,end:e.dimension.end,offset:e.dimension.offset,text:e.text,unit:e.dimension.unit,strokeColor:xe(t.stroke),strokeWidth:k(t.strokeWidth),textColor:xe(t.textColor),fontSize:k(t.fontSize),order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId}}function Dd(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,fillColor:t.fill??"rgba(155, 66, 223, 0.05)",strokeColor:t.stroke??"#9b42df",strokeWidth:k(t.strokeWidth)??2,cornerRadius:k(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:k(t.fontSize)??14,fontWeight:Ie(t.fontWeight,bo,"bold"),fontFamily:t.fontFamily,dash:Qe(t.dash),showLabel:t.showLabel!=="false",labelPosition:Ie(t.labelPosition,dd,"top"),shadow:t.shadow!=="false",clip:t.clip==="true"||void 0,order:e.order,sourceIndex:e.sourceIndex}}function Gd(e){let t=e.props,r=Me(t.shadow);return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,depth:e.isometric.depth,footprint:e.isometric.footprint,form:e.isometric.form,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,text:e.text,icon:e.isometric.icon,fill:xe(t.fill)??"#f8fafc",strokeColor:xe(t.stroke)??"#111827",strokeWidth:k(t.strokeWidth)??1,cornerRadius:k(t.cornerRadius)??(e.isometric.footprint?0:8),seams:t.seams==="false"?!1:void 0,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:k(t.labelOffsetX)??0,labelOffsetY:k(t.labelOffsetY)??0,labelBackground:xe(t.labelBackground),parentFrameId:e.parentFrameId}}function _d(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:k(t.weight),showWeight:t.showWeight!=="false",style:{pathType:fe(t.route,So),color:$t(t.stroke),strokeWidth:k(t.strokeWidth),strokeStyle:fe(t.strokeStyle,xo),opacity:t.opacity!==void 0?k(t.opacity):void 0,fontSize:k(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:Me(t.shadow)},startMarker:fe(t.markerStart,ni),endMarker:fe(t.markerEnd,ni),segmentOffsets:e.segments,fromPoint:e.fromPort?{kind:"port",port:e.fromPort}:e.fromSide?{kind:"side",side:e.fromSide,offset:e.fromFraction}:void 0,toPoint:e.toPort?{kind:"port",port:e.toPort}:e.toSide?{kind:"side",side:e.toSide,offset:e.toFraction}:void 0,order:e.order,sourceIndex:e.sourceIndex}}function Fd(e){let t=e.props;return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,points:e.path?.points??[],value:e.path?.value,tension:e.path?.tension??0,startMarker:Ie(e.path?.startMarker,oi,"none"),endMarker:Ie(e.path?.endMarker,oi,"none"),closed:e.path?.closed??!1,strokeColor:xe(t.stroke)??"#7c3aed",strokeWidth:k(t.strokeWidth)??2,dash:Qe(t.dash)??[],opacity:k(t.opacity)??1,fillColor:xe(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function ob(e){return e||"rectangle"}function Hd(e,t){let r=e.props,o=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:ob(e.shapeType),symbol:e.symbol,x:e.x,y:e.y,width:e.width,height:e.height,w:e.width,h:e.height,rotation:e.rotation??0,fillColor:be(r.fill??(o?"none":void 0)),strokeColor:$t(r.stroke??(o?"none":void 0)),isText:o||void 0,strokeWidth:k(r.strokeWidth),textColor:r.textColor,fontSize:k(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:Ie(r.fontWeight,ld,"normal"),letterSpacing:k(r.letterSpacing),lineHeight:k(r.lineHeight),fontFamily:r.fontFamily,textAlign:fe(r.textAlign,cd),textVerticalAlign:fe(r.verticalAlign,ud),cornerRadius:k(r.cornerRadius),shadowStyle:Me(r.shadow),dash:Qe(r.dash),strokeStyle:fe(r.strokeStyle,pd),opacity:k(r.opacity),blur:k(r.blur),blend:fe(r.blend,md),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function Vd(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,orientation:e.swimlane?.orientation??"horizontal",lanes:e.swimlane?.lanes??[],fillColor:t.fill??"rgba(107, 114, 128, 0.05)",strokeColor:t.stroke??"#6b7280",strokeWidth:k(t.strokeWidth)??2,cornerRadius:k(t.cornerRadius)??12,dash:Qe(t.dash),shadowStyle:Me(t.shadow),textColor:t.textColor??"#6b7280",fontSize:k(t.fontSize)??22,fontWeight:Ie(t.fontWeight,bo,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var si=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function Wd(e){let t=si(e.canvasObjects),r=new Map((e.shaders??[]).map(o=>[o.name,o]));return{shapes:t.filter(o=>o.objectType==="shape").map(o=>Hd(o,r)),frames:t.filter(o=>o.objectType==="frame").map(Dd),swimlanes:t.filter(o=>o.objectType==="swimlane").map(Vd),isometricObjects:t.filter(mr).map(Gd),paths:t.filter(o=>o.objectType==="path").map(Fd),dimensions:t.filter(ur).map(Id),charts:t.filter(o=>o.objectType==="chart").map(Ed),components:t.filter(o=>o.objectType==="component"&&o.component!==void 0).map(Od),links:si(e.links).map(_d),connections:si(e.connections).map(Bd)}}var Co=new Set(["top","front","right"]),zd=Math.PI/6,ze=Math.cos(zd),Ye=Math.sin(zd);function li(e){let t=Math.max(0,e.width),r=Math.max(0,e.height),o=Math.max(0,e.depth);return{x:e.x,y:e.y,width:(t+o)*ze,height:r+(t+o)*Ye}}function di(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*ze/2,y:e.y+(t+r)*Ye/2}}function nb(e){return{x:(e[0].x+e[1].x+e[2].x+e[3].x)/4,y:(e[0].y+e[1].y+e[2].y+e[3].y)/4}}function ci(e,t){return nb(Ue(e)[t])}function Ue(e){let{x:t,y:r}=e,o=Math.max(0,e.width),n=Math.max(0,e.height),i=Math.max(0,e.depth),a={x:t+i*ze,y:r},s={x:o*ze,y:o*Ye},l={x:-i*ze,y:i*Ye},d={x:0,y:n},c={x:a.x+s.x,y:a.y+s.y},u={x:a.x+l.x,y:a.y+l.y},m={x:a.x+s.x+l.x,y:a.y+s.y+l.y},f={x:a.x+d.x,y:a.y+d.y},h={x:m.x+d.x,y:m.y+d.y},y={x:u.x+d.x,y:u.y+d.y},x={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,m,u],bottom:[f,x,h,y],front:[u,m,h,y],back:[a,c,x,f],right:[m,c,x,h],left:[a,u,y,f]}}function ib(e){let t=0;for(let r=0;r<e.length;r+=1){let[o,n]=e[r],[i,a]=e[(r+1)%e.length];t+=o*a-i*n}return t/2}function ko(e){let t=(e??[]).filter(o=>Array.isArray(o)&&Number.isFinite(o[0])&&Number.isFinite(o[1])),r=t.filter((o,n)=>{let i=t[(n+1)%t.length];return o[0]!==i[0]||o[1]!==i[1]});return r.length>=3?r:[]}var ab=Math.PI/12;function Yd(e,t,r,o){if(!(t>0)||r<=0||o<=0)return[...e];let n=e.map(([a,s])=>({x:a*r,y:s*o})),i=[];for(let a=0;a<n.length;a+=1){let s=n[a],l=n[(a-1+n.length)%n.length],d=n[(a+1)%n.length],c={x:l.x-s.x,y:l.y-s.y},u={x:d.x-s.x,y:d.y-s.y},m=Math.hypot(c.x,c.y),f=Math.hypot(u.x,u.y),h=(c.x*u.x+c.y*u.y)/(m*f),y=Math.acos(Math.max(-1,Math.min(1,h)));if(!Number.isFinite(y)||y<.001||Math.PI-y<.001){i.push(e[a]);continue}let x=Math.min(t/Math.tan(y/2),Math.min(m,f)/2),b=x*Math.tan(y/2),C={x:c.x/m,y:c.y/m},S={x:u.x/f,y:u.y/f},w={x:s.x+C.x*x,y:s.y+C.y*x},O={x:s.x+S.x*x,y:s.y+S.y*x},A={x:C.x+S.x,y:C.y+S.y},_=Math.hypot(A.x,A.y),G=b/Math.sin(y/2),V={x:s.x+A.x/_*G,y:s.y+A.y/_*G},ve=Math.atan2(w.y-V.y,w.x-V.x),le=Math.atan2(O.y-V.y,O.x-V.x)-ve;le-=2*Math.PI*Math.round(le/(2*Math.PI));let Pe=Math.max(2,Math.ceil(Math.abs(le)/ab));for(let oe=0;oe<=Pe;oe+=1){let Ke=ve+le*oe/Pe;i.push([(V.x+b*Math.cos(Ke))/r,(V.y+b*Math.sin(Ke))/o])}}return i}function ui(e,t,r=0){let o=Math.max(0,e.width),n=Math.max(0,e.depth),i=Math.max(0,e.height),a=Yd(ko(t),r,o,n),s=e.x+n*ze,l=([h,y],x)=>({x:s+(h*o-y*n)*ze,y:e.y+(h*o+y*n)*Ye+x}),d=a.map(h=>l(h,0)),c=ib(a)>=0?1:-1,u=a.map((h,y)=>{let x=a[(y+1)%a.length],b=(x[0]-h[0])*o,C=(x[1]-h[1])*n,S=Math.hypot(b,C),w=S===0?0:C/S*c,O=S===0?0:-b/S*c;return{from:h,to:x,length:S,normalU:w,normalV:O,visible:S>0&&w+O>1e-9}}),m=(h,y)=>h.visible&&y.visible&&h.normalU*y.normalU+h.normalV*y.normalV>Math.cos(.5),f=[];return u.forEach((h,y)=>{if(!h.visible)return;let x=u[(y-1+u.length)%u.length],b=u[(y+1)%u.length],{from:C,to:S}=h;f.push({points:[l(C,0),l(S,0),l(S,i),l(C,i)],light:.72+.28*Math.max(0,Math.min(1,h.normalV/(Math.abs(h.normalU)+Math.abs(h.normalV)))),depth:(C[0]+S[0])/2+(C[1]+S[1])/2,smoothStart:m(x,h),smoothEnd:m(h,b)})}),f.sort((h,y)=>h.depth-y.depth),{top:d,sides:f}}function sb(e){return Math.max(0,Math.min(255,Math.round(e)))}function lb(e){let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return null;let r=Number.parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function db(e,t,r){return`#${[e,t,r].map(o=>sb(o).toString(16).padStart(2,"0")).join("")}`}function mi(e,t){let r=lb(e);if(!r)return e;let[o,n,i]=r;return db(o*t,n*t,i*t)}function At(e,t){return mi(e,t)}function pi(e){return{topFill:e,frontFill:mi(e,.95),sideFill:mi(e,.88)}}var cb=Math.PI/180;function ub(e,t){let r=t*cb,o=Math.cos(r),n=Math.sin(r);return{x:e.x*o-e.y*n,y:e.x*n+e.y*o}}function mb(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ud(e,t){let r=mb(e),o=e.rotation?ub(t,e.rotation):t;return{x:r.x+o.x,y:r.y+o.y}}function fi(e,t){return Ud(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function Et(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function hi(e,t){let r=Et(e),o=Et(t),n=Math.atan2(o.y-r.y,o.x-r.x);return n>=-Math.PI/4&&n<Math.PI/4?{x:e.x+e.width,y:r.y}:n>=Math.PI/4&&n<3*Math.PI/4?{x:r.x,y:e.y+e.height}:n>=-3*Math.PI/4&&n<-Math.PI/4?{x:r.x,y:e.y}:{x:e.x,y:r.y}}function pb(e,t){let r=t.offset??.5;switch(t.side){case"top":return{x:e.x+e.width*r,y:e.y};case"right":return{x:e.x+e.width,y:e.y+e.height*r};case"bottom":return{x:e.x+e.width*r,y:e.y+e.height};case"left":return{x:e.x,y:e.y+e.height*r}}}function fb(e,t){let r=e.symbol?.ports?.find(o=>o.name===t.port);return r?fi({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):Et(e)}function gi(e,t,r){let o=hb(e,t),n=gb(o.explicit);if(n)return n;let i=jd(r,o.canvasObjectId);if(!i)return{x:0,y:0};let a=yb(i,o.explicit);return a||bb(i,jd(r,o.oppositeCanvasObjectId))}function hb(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function gb(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function yb(e,t){return t?.kind==="port"?fb(e,t):t?.kind==="side"?pb(e,t):null}function bb(e,t){return t?hi(e,t):Et(e)}function jd(e,t){return e.find(r=>r.id===t)}var xb=15e3;function Sb(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function Xd(e,t){return e?ci(e,t):{x:0,y:0}}function qd(e,t){let r=e.findIndex(n=>n.id===t);if(r<0)return;let o=e[r];return{rank:o.order??0,sequence:o.sourceIndex??xb+r}}function Cb(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Co.has(t.fromFace)?void 0:qd(e,t.fromId),Co.has(t.toFace)?void 0:qd(e,t.toId)].filter(n=>n!==void 0);if(!r.length)return{sourceIndex:t.sourceIndex};let o=r.reduce((n,i)=>i.rank<n.rank||i.rank===n.rank&&i.sequence<n.sequence?i:n);return{order:o.rank,sourceIndex:o.sequence-.5}}function kb(e){let t=new Map(e.isometricObjects.map(r=>[r.id,r]));return e.connections.map(r=>({link:{id:r.id,fromId:r.fromId,toId:r.toId,fromPoint:{kind:"face",face:r.fromFace},toPoint:{kind:"face",face:r.toFace},style:r.style,...Cb(e.isometricObjects,r)},from:Xd(t.get(r.fromId??""),r.fromFace),to:Xd(t.get(r.toId??""),r.toFace),kind:"connection"}))}function Kd(e){let t=Sb(e);return[...e.links.map(o=>({link:o,from:gi(o,"from",t),to:gi(o,"to",t)})),...kb(e)]}function yi(e){let t=sd(e),r=Wd(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,dimensions:r.dimensions,charts:r.charts,components:r.components,links:Kd(r),diagnostics:t.diagnostics}}function ee(e,t,r,o,n,i){return e.forEach((a,s)=>{a.identity={role:t,id:r,...o?{kind:o}:{},...s===0?{primary:!0}:{},...s===0&&n?{label:n}:{},...s===0&&i?{parentFrameId:i}:{}}}),e}var bi={minX:0,minY:0,maxX:100,maxY:100};function de(e,t=0){return{minX:e.x-t,minY:e.y-t,maxX:e.x+e.width+t,maxY:e.y+e.height+t}}function N(e,t,r=0){return t?vb(Rb(e,t),r):de(e,r)}function Rb(e,t){let r=e.x+e.width/2,o=e.y+e.height/2,n=t*Math.PI/180,i=Math.cos(n),a=Math.sin(n);return wb(e).map(s=>({x:r+(s.x-r)*i-(s.y-o)*a,y:o+(s.x-r)*a+(s.y-o)*i}))}function wb(e){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]}function vb(e,t){return{minX:Math.min(...e.map(r=>r.x))-t,minY:Math.min(...e.map(r=>r.y))-t,maxX:Math.max(...e.map(r=>r.x))+t,maxY:Math.max(...e.map(r=>r.y))+t}}function Te(e){if(e.points.length===0)return"";if(ho(e))return Pb(e);let t=e.points[0],r=[`M ${t.x} ${t.y}`];for(let{to:o,controls:n}of go(e))r.push(n?`C ${n[0].x} ${n[0].y} ${n[1].x} ${n[1].y} ${o.x} ${o.y}`:`L ${o.x} ${o.y}`);return e.closed&&r.push("Z"),r.join(" ")}function Pb(e){let[t,...r]=e.points,o=r.map(n=>`L ${n.x} ${n.y}`).join(" ");return`M ${t.x} ${t.y} ${o}${e.closed?" Z":""}`}function p(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Zd(e){let t=e.order_key??e.orderKey;if(!t)return e.order??0;let r=0;for(let o=0;o<Math.min(t.length,8);o++)r=r*128+t.charCodeAt(o);return r}function Qd(e,t){return e.sourceIndex??t}function P(e,t,r){return e?typeof e=="string"?{kind:"solid",color:e}:e.type==="gradient"?{kind:"linear-gradient",angle:e.angle,stops:e.stops.map(o=>({offset:o.position,color:o.color}))}:e.points.length===0?(t.push({severity:"warning",code:"empty-mesh-gradient",ownerId:r,message:"Mesh gradient has no color points."}),{kind:"none"}):{kind:"mesh-gradient",points:e.points.map(o=>({x:o.x,y:o.y,color:o.color}))}:{kind:"none"}}var B="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var Jd="#94a3b8";function ec(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,120)),i=Math.max(0,p(e.height,60)),a=p(e.rotation,0),s=1e4+t,l=N({x:r,y:o,width:n,height:i},a,2);return[{id:`widget-${e.id}`,type:"rect",order:s,bounds:l,x:r,y:o,width:n,height:i,rx:6,rotation:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:Jd},strokeWidth:1,dash:[4,3]}},{id:`widget-${e.id}-label`,type:"text",order:s+.1,bounds:l,x:r,y:o,width:n,height:i,lines:[e.type],fontFamily:B,fontSize:12,fontWeight:"normal",color:Jd,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function tc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,160)),i=Math.max(0,p(e.height,90)),a=p(e.rotation,0);return[{id:`widget-${e.id}`,type:"rolling-number",order:1e4+t,bounds:N({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,value:sr(e.value,e.digits),digits:e.digits,duration:Math.max(0,p(e.duration,420)),label:e.label,componentStyle:Yn(e.style)}]}function rc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,200)),i=Math.max(0,p(e.height,200)),a=p(e.rotation,0),s=p(e.max,100)||100,l=Math.min(1,Math.max(0,p(Number(e.value),0)/s)),d=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:N({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,shader:{name:e.id,program:"tickScale",parameters:{...e.parameters,progress:l,max:s}},mask:"ellipse"}];return e.labels&&d.push(...Lb(e,{x:r,y:o,width:n,height:i,rotation:a,max:s,order:1e4+t})),d}function Lb(e,t){let r=e.labels??{},o=Math.max(1,p(Number(e.parameters.ticks),48)),n=Math.max(1,p(Number(e.parameters.major),5)),i=p(Number(e.parameters.start),225)*Math.PI/180,a=p(Number(e.parameters.sweep),270)*Math.PI/180,s=p(Number(e.parameters.radius),.9)+p(r.offset,.08),l=p(r.size,12),d=t.x+t.width/2,c=t.y+t.height/2,u=Math.floor(o/n),m=[];for(let f=0;f<=u;f+=1){let h=f*n/o,y=i-h*a,x=d+Math.cos(y)*s*(t.width/2),b=c-Math.sin(y)*s*(t.height/2),C={x:x-24,y:b-l,width:48,height:l*2};m.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:N(C,0,2),...C,lines:[String(Math.round(t.max*h*10)/10)],fontFamily:r.fontFamily||B,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return m}function oc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,120)),i=Math.max(0,p(e.height,360)),a=p(e.rotation,0),s=p(e.min,0),l=p(e.max,100),d=l===s?0:Math.min(1,Math.max(0,(p(Number(e.value),s)-s)/(l-s))),c=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:N({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,shader:{name:e.id,program:"ruler",parameters:{...e.parameters,progress:d,min:s,max:l}},mask:"rect"}];return e.labels&&c.push(...Mb(e,{x:r,y:o,width:n,height:i,min:s,max:l,order:1e4+t})),c}function Mb(e,t){let r=e.labels??{},o=e.parameters.axis==="horizontal",n=Math.max(1,p(Number(e.parameters.ticks),50)),i=Math.max(1,p(Number(e.parameters.major),5)),a=p(Number(e.parameters.inset),.05)>0?p(Number(e.parameters.inset),.05):.05,s=p(Number(e.parameters.line),.7)>0?p(Number(e.parameters.line),.7):.7,l=o?t.height:t.width,d=(p(Number(e.parameters.length),.1)>0?p(Number(e.parameters.length),.1):.1)*l*1.9,c=s*l-.12*l-d-p(r.offset,.04)*l,u=p(r.size,12),m=Math.floor(n/i),f=[];for(let h=0;h<=m;h+=1){let y=h*i/n,x=a+(1-2*a)*y,b=o?{x:t.x+t.width*x-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-x)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${h}`,type:"text",order:t.order+.1,bounds:N(b,0,2),...b,lines:[String(Math.round((t.min+(t.max-t.min)*y)*10)/10)],fontFamily:r.fontFamily||B,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:o?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var Tb="#94a3b8";function ie(e,t,r){return{x:p(e.x,0),y:p(e.y,0),width:Math.max(1,p(e.width,r.width)),height:Math.max(1,p(e.height,r.height)),order:1e4+t}}var $=(e,t)=>String(e.properties[t]??""),I=(e,t)=>Number(e.properties[t]??0),Y=e=>({kind:"solid",color:e}),pe=(e,t)=>e.disabled?Tb:t;function X(e,t){let r=Number(e.properties.animate??0),o=e.disabled?{...t,opacity:.4}:t;return r>0?{...o,transition:r}:o}function ae(e,t){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:N(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}}function se(e,t,r,o,n){return{id:`widget-${e.id}-${t}`,type:"text",order:n,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[o.text],fontFamily:B,fontSize:o.fontSize,fontWeight:"600",color:o.color,align:o.align,verticalAlign:"middle",lineHeight:1.3}}function nc(e,t){let r=ie(e,t,{width:120,height:40}),o=[ae(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min(I(e,"radius"),r.height/2),style:X(e,{fill:Y($(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let n={text:e.label,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"center"};o.push(se(e,"label",r,n,r.order+.2))}return o}var $b=.22,Ab=.5,Eb=[[.24,.52],[.43,.72],[.78,.3]];function Nb(e){let[t,...r]=Eb.map(([o,n])=>`${e.x+o*e.width} ${e.y+n*e.width}`);return`M ${t} ${r.map(o=>`L ${o}`).join(" ")}`}function Ob(e,t,r){let o=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:N(r,0,2),...r,rx:r.width*$b,style:X(e,{fill:o?Y($(e,"accent")):{kind:"none"},stroke:Y(o?$(e,"accent"):$(e,"stroke")),strokeWidth:1.5})}}function Bb(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:N(r,0,0),d:Nb(r),style:X(e,{fill:{kind:"none"},stroke:Y($(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function Ib(e,t,r,o){let n=r*Ab,i={x:t.x+r+n,y:t.y,width:Math.max(0,t.width-r-n),height:t.height},a={text:o,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"left"};return se(e,"label",i,a,t.order+.3)}function ic(e,t){let r=ie(e,t,{width:160,height:24}),o=Math.min(r.height,r.width),n={x:r.x,y:r.y+(r.height-o)/2,width:o,height:o};return[ae(e,r),Ob(e,r,n),...e.value===!0?[Bb(e,r,n)]:[],...e.label?[Ib(e,r,o,e.label)]:[]]}var Db=.62;function Gb(e){return e>0?String(e).split(".")[1]?.length??0:0}function _b(e,t){let r=$(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?Number(e.value).toFixed(Gb(I(e,"step"))):""}function ac(e,t){let r=ie(e,t,{width:96,height:96}),o=I(e,"min"),n=I(e,"max"),i=Math.min(1,Math.max(0,(Number(e.value)-o)/(n-o||1))),a=I(e,"start"),s=Math.min(360,Math.max(1,I(e,"sweep"))),l=Math.min(I(e,"thickness"),Math.min(r.width,r.height)/3),d=r.x+r.width/2,c=r.y+r.height/2,u=Math.max(1,Math.min(r.width,r.height)/2-l/2),m=2*Math.PI*u,f=$(e,"rounded")!=="false",h=(a-i*s)*Math.PI/180,y=(w,O,A,_,G={})=>({id:`widget-${e.id}-${w}`,type:"ellipse",order:r.order+O,bounds:N({x:d-u,y:c-u,width:u*2,height:u*2},0,l),cx:d,cy:c,rx:u,ry:u,rotation:-a,style:X(e,{fill:{kind:"none"},stroke:Y(A),strokeWidth:l,dash:[Math.max(.001,_),m],lineCap:f?"round":"butt",...G})}),x=Math.max(1,u-l/2-Math.max(2,l*.4)),b=l/2*Db+1,C=[ae(e,r),y("track",.1,$(e,"track"),s/360*m),y("fill",.2,$(e,"accent"),i*s/360*m,{opacity:i>0?1:0}),{id:`widget-${e.id}-face`,type:"ellipse",order:r.order+.3,bounds:N({x:d-x,y:c-x,width:x*2,height:x*2},0,0),cx:d,cy:c,rx:x,ry:x,style:X(e,{fill:Y($(e,"face")),stroke:{kind:"none"}})},{id:`widget-${e.id}-dot`,type:"ellipse",order:r.order+.4,bounds:N({x:d+u*Math.cos(h)-b,y:c-u*Math.sin(h)-b,width:b*2,height:b*2},0,0),cx:d+u*Math.cos(h),cy:c-u*Math.sin(h),rx:b,ry:b,style:X(e,{fill:Y($(e,"dot")),stroke:{kind:"none"}})}],S=_b(e,i);if(S){let w={text:S,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"center"};C.push(se(e,"value",{x:d-x,y:c-x,width:x*2,height:x*2},w,r.order+.5))}return C}function Fb(e,t){let r=$(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?String(Number(e.value)):""}function sc(e,t){let r=ie(e,t,{width:220,height:12}),o=I(e,"min"),n=I(e,"max"),i=Math.min(1,Math.max(0,(Number(e.value)-o)/(n-o||1))),a=$(e,"rounded")!=="false",s=[ae(e,r)];if($(e,"variant")==="ring"){let d=Math.min(I(e,"thickness"),Math.min(r.width,r.height)/2),c=Math.max(1,Math.min(r.width,r.height)/2-d/2),u=2*Math.PI*c,m=r.x+r.width/2,f=r.y+r.height/2,h=(y,x,b,C)=>({id:`widget-${e.id}-${y}`,type:"ellipse",order:r.order+x,bounds:N({x:m-c,y:f-c,width:c*2,height:c*2},0,d),cx:m,cy:f,rx:c,ry:c,rotation:-90,style:X(e,{fill:{kind:"none"},stroke:Y(b),strokeWidth:d,...C})});s.push(h("track",.1,$(e,"track"),{})),s.push(h("fill",.2,$(e,"accent"),{dash:[Math.max(.001,i*u),u],lineCap:a?"round":"butt",opacity:i>0?1:0}))}else{let d=$(e,"direction")==="vertical",c=a?(d?r.width:r.height)/2:0,u=(f,h,y,x,b)=>{let C=d?{x:r.x,y:r.y+r.height-y,width:r.width,height:y}:{x:r.x,y:r.y,width:y,height:r.height};return{id:`widget-${e.id}-${f}`,type:"rect",order:r.order+h,bounds:N(C,0,0),...C,rx:c,style:X(e,{fill:Y(x),stroke:{kind:"none"},...b===void 0?{}:{opacity:b}})}},m=d?r.height:r.width;s.push(u("track",.1,m,$(e,"track"))),s.push(u("fill",.2,Math.max(0,i*m),$(e,"accent"),i>0?1:0))}let l=Fb(e,i);if(l){let d={text:l,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"center"};s.push(se(e,"value",r,d,r.order+.3))}return s}function lc(e,t){let r=ie(e,t,{width:300,height:40}),o=$(e,"options").split(",").map(u=>u.trim()).filter(Boolean),n=Math.max(1,o.length),i=Math.min(n-1,Math.max(0,Math.round(Number(e.value))||0)),a=Math.min(I(e,"inset"),r.height/2),s=Math.min(I(e,"radius"),r.height/2),l=(r.width-a*2)/n,d={y:r.y+a,height:r.height-a*2},c=[ae(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:s,style:X(e,{fill:Y($(e,"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-active`,type:"rect",order:r.order+.2,bounds:N({x:r.x+a+i*l,width:l,...d},0,0),x:r.x+a+i*l,y:d.y,width:l,height:d.height,rx:Math.max(0,s-a),style:X(e,{fill:Y($(e,"accent")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.18,blur:3,dx:0,dy:1}})}];return o.forEach((u,m)=>{let f={x:r.x+a+m*l,width:l,...d},h=pe(e,$(e,m===i?"activeTextColor":"textColor"));c.push(se(e,`option-${m}`,f,{text:u,color:h,fontSize:I(e,"fontSize"),align:"center"},r.order+.3))}),c}function xi(e,t){return e==="field"?Math.min(8,t/2):t/2}var $e=4,dc=12,Si=5,Nt=1.5;function Hb(e){return e>0?String(e).split(".")[1]?.length??0:0}function Vb(e,t){let r=$(e,"display"),o=Hb(I(e,"step"));return(r==="percent"?t.two?[t.from,t.to].map(i=>`${Math.round(i*100)}%`):[`${Math.round(t.to*100)}%`]:r==="value"?t.values.map(i=>i.toFixed(o)):[]).join(" \u2013 ")}var Ot=(e,t,r,o,n,i,a={})=>({id:`widget-${e.id}-${r}`,type:"rect",order:t.order+o,bounds:N(n,0,0),...n,style:X(e,{fill:Y(i),stroke:{kind:"none"},...a})});function cc(e,t,r,o,n){let i=Math.round(I(e,"ticks")),a=$(e,"tickColor");return Array.from({length:i>=2?i:0},(s,l)=>{let d=l/(i-1),c=r?{x:t.x+n,y:t.y+t.height-o-d*(t.height-o*2)-Nt/2,width:Si,height:Nt,rx:Nt/2}:{x:t.x+o+d*(t.width-o*2)-Nt/2,y:t.y+n,width:Nt,height:Si,rx:Nt/2};return Ot(e,t,`tick-${l}`,.15,c,a)})}function Wb(e,t,r,o){let n=xi("line",o?t.width:t.height),i=n*I(e,"thumbSize")/100,a=Math.min(I(e,"trackHeight"),o?t.width:t.height),s=o?t.x+t.width/2:t.y+t.height/2,l=f=>o?t.y+t.height-n-f*(t.height-n*2):t.x+n+f*(t.width-n*2),d=(f,h)=>o?{x:s-a/2,y:Math.min(f,h),width:a,height:Math.abs(h-f),rx:a/2}:{x:Math.min(f,h),y:s-a/2,width:Math.abs(h-f),height:a,rx:a/2},c=o?d(t.y,t.y+t.height):d(t.x,t.x+t.width),u=d(r.two?l(r.from):o?t.y+t.height:t.x,l(r.to)),m=(f,h,y)=>{let x=o?s:l(h),b=o?l(h):s;return{id:`widget-${e.id}-${f}`,type:"ellipse",order:t.order+y,bounds:N({x:x-i,y:b-i,width:i*2,height:i*2},0,0),cx:x,cy:b,rx:i,ry:i,style:X(e,{fill:Y($(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:3,dx:0,dy:1}})}};return[Ot(e,t,"track",.1,c,$(e,"track")),...cc(e,t,o,n,o?t.width/2+a/2+5:t.height/2+a/2+5),Ot(e,t,"fill",.2,u,$(e,"accent")),...r.two?[m("thumb-start",r.from,.3)]:[],m(r.two?"thumb-end":"thumb",r.to,.31)]}function zb(e,t,r,o){let n=xi("field",o?t.width:t.height),i=Math.min(I(e,"radius"),Math.min(t.width,t.height)/2),a={x:t.x,y:t.y,width:t.width,height:t.height,rx:i},s=S=>o?t.y+t.height-n-S*(t.height-n*2):t.x+n+S*(t.width-n*2),l=r.two?s(r.from):o?t.y+t.height:t.x,d=s(r.to),c=Math.min(l,d)-(r.two?$e/2:0),u=Math.max(l,d)+$e/2,m=o?{...a,y:r.two?c:d-$e/2,height:r.two?u-c:Math.max(0,t.y+t.height-d+$e/2),rx:r.two?0:i}:{...a,x:r.two?c:t.x,width:r.two?u-c:Math.max(0,d+$e/2-t.x),rx:r.two?0:i},f=(o?t.width:t.height)*.5,h=(S,w)=>{let O=o?{x:t.x+(t.width-f)/2,y:w-$e/2,width:f,height:$e,rx:$e/2}:{x:w-$e/2,y:t.y+(t.height-f)/2,width:$e,height:f,rx:$e/2};return Ot(e,t,S,.3,O,$(e,"accent"))},y=[Ot(e,t,"track",.1,a,$(e,"surface")),Ot(e,t,"fill",.2,m,$(e,"fill")),...r.two?[h("handle-start",l)]:[],h(r.two?"handle-end":"handle",d)],x={color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize")},b=Vb(e,r);if(o)return b&&y.push(se(e,"value",{x:t.x,y:t.y+6,width:t.width,height:20},{...x,text:b,align:"center"},t.order+.4)),y;let C={y:t.y,height:t.height,width:Math.max(0,t.width/2-dc)};return e.label&&y.push(se(e,"label",{x:t.x+dc,...C},{...x,text:e.label,align:"left"},t.order+.4)),b&&y.push(se(e,"value",{x:t.x+t.width/2,...C},{...x,text:b,align:"right"},t.order+.4)),y.push(...cc(e,t,!1,n,t.height-Si-5)),y}function Ci(e,t){let r=$(e,"variant")==="field",o=$(e,"direction")==="vertical",i=ie(e,t,o?{width:r?56:28,height:180}:{width:220,height:r?36:28}),a=I(e,"min"),s=I(e,"max"),l=f=>Math.min(1,Math.max(0,(f-a)/(s-a||1))),d=e.type==="range",c=Number(e.value),u=d?Number(e.properties.valueEnd??s):c,m={from:l(d?Math.min(c,u):a),to:l(d?Math.max(c,u):c),values:d?[Math.min(c,u),Math.max(c,u)]:[c],two:d};return[ae(e,i),...r?zb(e,i,m,o):Wb(e,i,m,o)]}var Yb=.12;function uc(e,t){let r=ie(e,t,{width:52,height:30}),o=e.value===!0,n=r.height*Yb,i=r.height/2-n,a=o?r.x+r.width-r.height/2:r.x+r.height/2,s={x:a-i,y:r.y+n,width:i*2,height:i*2};return[ae(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:X(e,{fill:Y($(e,o?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:N(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:X(e,{fill:Y($(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function mc(e,t){let r=ie(e,t,{width:120,height:40}),o=e.value===!0,n=[ae(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:N(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:X(e,{fill:o?Y($(e,"accent")):{kind:"none"},stroke:Y(o?$(e,"accent"):$(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:pe(e,$(e,o?"onTextColor":"textColor")),fontSize:I(e,"fontSize"),align:"center"};n.push(se(e,"label",r,i,r.order+.2))}return n}var Ce=e=>(t,r)=>e(t,r),Ub=new Map([["rollingNumber",Ce(tc)],["tickScale",Ce(rc)],["ruler",Ce(oc)],["switch",Ce(uc)],["checkbox",Ce(ic)],["toggleButton",Ce(mc)],["button",Ce(nc)],["slider",Ce(Ci)],["progress",Ce(sc)],["segmented",Ce(lc)],["knob",Ce(ac)],["range",Ce(Ci)]]);function pc(e){return Ub.get(e)}function jb(e){let t=Rt(e.type)?.role;if(!t||!qr(e))return;let r=typeof e.value=="boolean"?e.value:void 0;return{role:t,...r===void 0?{}:t==="button"?{pressed:r}:{checked:r},...e.disabled?{disabled:!0}:{}}}function Xb(e){return e.label??(qr(e)?e.id:String(e.value))}function ki(e){return e.flatMap((t,r)=>{let o=pc(t.type)??ec,n=ee(o(t,r),"widget",t.id,t.type,Xb(t),t.parentFrameId),i=jb(t),a=n.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),n})}function Ri(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+o} H ${e} Z`}function wi(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t} H ${e+r} V ${t+o-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+o} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+o-i} Z`}function fr(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r} V ${t+o} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+o-i} Z`}function hr(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+o-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+o} H ${e} Z`}function fc(e,t,r,o,n){let i=Math.max(0,Math.min(r,o)/2),a=Math.max(0,Math.min(n.topLeft,i)),s=Math.max(0,Math.min(n.topRight,i)),l=Math.max(0,Math.min(n.bottomRight,i)),d=Math.max(0,Math.min(n.bottomLeft,i)),c=(u,m,f)=>u>0?`A ${u} ${u} 0 0 1 ${m} ${f} `:"";return`M ${e+a} ${t} H ${e+r-s} `+c(s,e+r,t+s)+`V ${t+o-l} `+c(l,e+r-l,t+o)+`H ${e+d} `+c(d,e,t+o-d)+`V ${t+a} `+c(a,e+a,t)+"Z"}function Ro(e,t,r,o){return{fill:{kind:"solid",color:e||"transparent"},stroke:{kind:"solid",color:t},strokeWidth:r,dash:o?.length?o:void 0}}var wo=8;function qb(e,t,r){let o=e.strokeWidth/2;switch(e.labelPosition){case"bottom":{let n=e.x-o,i=e.y+e.height;return{x:n,y:i,width:r,height:t,path:wi(n,i,r,t,wo)}}case"left":{let n=e.x-t,i=e.y-o;return{x:n,y:i,width:t,height:r,path:fr(n,i,t,r,wo)}}case"right":{let n=e.x+e.width,i=e.y-o;return{x:n,y:i,width:t,height:r,path:hr(n,i,t,r,wo)}}default:{let n=e.x-o,i=e.y-t;return{x:n,y:i,width:r,height:t,path:Ri(n,i,r,t,wo)}}}}function hc(e){let t=Math.max(32,e.fontSize+18),r=16,o=Math.max(120,e.title.length*e.fontSize*.62+r*2),n=qb(e,t,o),i=de(n,6),a=e.labelPosition==="left"||e.labelPosition==="right";return[{type:"path",id:e.tabId,order:e.order+.1,bounds:i,d:n.path,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"}}},a?Zb(e,n,r,i):Kb(e,n,r,i)]}function Kb(e,t,r,o){return{type:"text",id:e.titleId,order:e.order+.2,bounds:o,x:t.x+r,y:t.y,width:Math.max(0,t.width-r*2),height:t.height,lines:[e.title],fontFamily:e.fontFamily??B,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Zb(e,t,r,o){let n=t.x+t.width/2,i=t.y+t.height/2,a=e.fontSize*1.4,s=Math.max(1,t.height-r*2);return{type:"text",id:e.titleId,order:e.order+.2,bounds:o,x:n-s/2,y:i-a/2,width:s,height:a,lines:[e.title],fontFamily:e.fontFamily??B,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:n,y:i}}}var Qb={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function Jb(e,t,r){let o=e.shadow??!0,n=de({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(o?20:4)),i={...Ro(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:o?{color:"#000000",opacity:.2,blur:12,dx:0,dy:4}:void 0};if(!r)return{type:"rect",id:`frame-${e.id}`,order:t,bounds:n,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:i};let a=Qb[e.labelPosition??"top"],s={topLeft:e.cornerRadius,topRight:e.cornerRadius,bottomRight:e.cornerRadius,bottomLeft:e.cornerRadius,[a]:0};return{type:"path",id:`frame-${e.id}`,order:t,bounds:n,d:fc(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function gc(e,t){if(e.isVisible===!1)return[];let r=t,o=(e.showLabel??!0)&&!!e.title,n=[Jb(e,r,o)];return o&&e.title&&n.push(...hc({tabId:`frame-tab-${e.id}`,titleId:`frame-title-${e.id}`,x:e.x,y:e.y,width:e.width,height:e.height,cornerRadius:e.cornerRadius,strokeWidth:e.strokeWidth,title:e.title,color:e.strokeColor,textColor:e.textColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,labelPosition:e.labelPosition??"top",order:r})),n}function e0(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function vo(e){if(!e?.enabled)return;let t=e0(e.angle??45,e.distance??5);return{color:e.color??"#000000",opacity:e.opacity??.25,blur:e.blur??10,dx:t.x,dy:t.y}}function t0(e,t){let{swimlane:r}=e;return r.orientation==="horizontal"?`M ${r.x} ${r.y+t} H ${r.x+r.width}`:`M ${r.x+t} ${r.y} V ${r.y+r.height}`}function yc(e){return e.lanes.slice(1).map((t,r)=>({type:"path",id:`swimlane-divider-${e.swimlane.id}-${r}`,order:e.order+.1+r/100,bounds:e.bounds,d:t0(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function bc(e,t,r){return{type:"text",id:`swimlane-label-${e.swimlane.id}-${t.id}`,order:e.order+.5+r/100,lines:[t.label],fontFamily:e.swimlane.fontFamily??B,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function r0(e,t,r){let o=e.swimlane.fontSize*1.4,n=e.swimlane.x+10+o/2,i=e.swimlane.y+t.offset+t.size/2,a=Math.max(20,t.size-16),s=n-a/2,l=i-o/2;return{...bc(e,t,r),bounds:N({x:s,y:l,width:a,height:o},-90,12),x:s,y:l,width:a,height:o,align:"center",verticalAlign:"middle",rotation:-90,rotationCenter:{x:n,y:i}}}function o0(e,t,r){return{...bc(e,t,r),bounds:e.bounds,x:e.swimlane.x+t.offset+8,y:e.swimlane.y+8,width:Math.max(0,t.size-16),height:Math.max(0,e.swimlane.height-16),align:"left",verticalAlign:"top"}}function xc(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?r0:o0;return e.lanes.map((r,o)=>t(e,r,o))}function n0(e){let t=e.orientation==="horizontal"?e.height:e.width,r=e.lanes.reduce((o,n)=>o+n.size,0);return r<=0||t<=0?e.lanes:e.lanes.map(o=>({...o,size:o.size*(t/r)}))}function i0(e){let t=0;return n0(e).map(r=>{let o={...r,offset:t};return t+=r.size,o})}function Sc(e,t){return{swimlane:e,order:5e3+t,bounds:de({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:i0(e)}}function Cc(e,t){if(e.isVisible===!1)return[];let r=Sc(e,t);return[{type:"rect",id:`swimlane-${e.id}`,order:r.order,bounds:r.bounds,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:{...Ro(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:vo(e.shadowStyle)}},...yc(r),...xc(r)]}function kc(e){return[...e.frames.flatMap((t,r)=>ee(gc(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>ee(Cc(t,r),"swimlane",t.id))]}var gr=(e,t,r)=>({x:e.x+t.x*r,y:e.y+t.y*r});function vi(e){return Math.hypot(e.end.x-e.start.x,e.end.y-e.start.y)}function Po(e){return e.text!==void 0?e.text:`${Math.round(vi(e)*10)/10}${e.unit?` ${e.unit}`:""}`}function Pi(e){let t=vi(e),r=t===0?{x:1,y:0}:{x:(e.end.x-e.start.x)/t,y:(e.end.y-e.start.y)/t},o={x:r.y,y:-r.x},n=e.offset<0?-1:1,i=[gr(e.start,o,e.offset),gr(e.end,o,e.offset)],a=Math.abs(e.offset)<=4?[]:[e.start,e.end].map(c=>[gr(c,o,4*n),gr(c,o,e.offset+6*n)]),s=((e.fontSize??11)*.75+2)*n,l={x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2},d=Math.atan2(r.y,r.x)*180/Math.PI;return d>90?d-=180:d<=-90&&(d+=180),{length:t,line:i,extensions:a,label:{center:gr(l,o,s),angle:d}}}var wc="#475569",a0=.6,s0=e=>e.map(([t,r])=>`M ${t.x} ${t.y} L ${r.x} ${r.y}`).join(" ");function Rc(e,t,r,o){let n=Math.max(0,p(e.strokeWidth,1)),i=o.flat();return{type:"path",id:`dimension-${e.id}-${t}`,order:r,bounds:{minX:Math.min(...i.map(a=>a.x))-n,minY:Math.min(...i.map(a=>a.y))-n,maxX:Math.max(...i.map(a=>a.x))+n,maxY:Math.max(...i.map(a=>a.y))+n},d:s0(o),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??wc},strokeWidth:n,lineCap:"round"}}}function l0(e,t,r,o,n){let i=p(e.fontSize,11),a=Math.max(24,r.length*i*a0+8),s=i*1.3;return{type:"text",id:`dimension-${e.id}-label`,order:t,bounds:{minX:o.x-a/2,minY:o.y-s/2,maxX:o.x+a/2,maxY:o.y+s/2},x:o.x-a/2,y:o.y-s/2,width:a,height:s,lines:[r],fontFamily:B,fontSize:i,fontWeight:"normal",color:e.textColor??e.strokeColor??wc,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:n,rotationCenter:o}}function d0(e,t){let r=Pi(e),o=31e3+t,n={...Rc(e,"line",o+.1,[r.line]),markerStart:"filled_arrow",markerEnd:"filled_arrow"},i=r.extensions.length>0?[Rc(e,"extensions",o,r.extensions)]:[],a=Po(e);return[...i,n,l0(e,o+.2,a,r.label.center,r.label.angle)]}function vc(e){return e.flatMap((t,r)=>ee(d0(t,r),"dimension",t.id,"dimension",Po(t),t.parentFrameId))}function Li(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Pc(e,t,r){let o=Li(e,t);if(o===0)return e;let n=r/o;return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function c0(e,t,r,o){let n=Math.max(0,Math.min(o,Li(t,e)/2,Li(t,r)/2));return{vertex:t,start:Pc(t,e,n),end:Pc(t,r,n)}}function lt(e,t){if(e.length<3)return"";let r=a=>typeof t=="number"?t:t[a]??0;if(e.every((a,s)=>r(s)<=0)){let[a,...s]=e;return`M ${a.x} ${a.y} ${s.map(l=>`L ${l.x} ${l.y}`).join(" ")} Z`}let o=e.map((a,s)=>c0(e[(s-1+e.length)%e.length],a,e[(s+1)%e.length],r(s))),n=[`M ${o[0].end.x} ${o[0].end.y}`];for(let a=1;a<o.length;a++){let s=o[a];n.push(`L ${s.start.x} ${s.start.y}`,`Q ${s.vertex.x} ${s.vertex.y} ${s.end.x} ${s.end.y}`)}let i=o[0];return n.push(`L ${i.start.x} ${i.start.y}`,`Q ${i.vertex.x} ${i.vertex.y} ${i.end.x} ${i.end.y}`,"Z"),n.join(" ")}var u0={prop:"style.fill",propKind:"color",propSolidOnly:!0};function Bt(e,t){let r=Math.max(0,p(e.strokeWidth,1)),o=p(e.rotation,0),n=li(e),i={x:n.x+n.width/2,y:n.y+n.height/2};return{object:e,index:t,order:15e3+t,rotation:o,rotationCenter:i,box:n,strokeWidth:r,common:{type:"path",bounds:N(n,o,r+2),rotation:o,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function yr(e,t,r,o,n){return{...e.common,id:`isometric-${e.object.id}-${t}`,order:e.order+r,d:lt([...o],0),style:n,...u0}}function Mi(e){let t=Ue(e);return[t.top[0],t.top[1],t.right[2],t.front[2],t.front[3],t.top[3]]}function Ti(e,t,r){let{object:o,order:n,common:i,box:a}=e;return{...i,id:`isometric-${o.id}-hull`,order:n+.24,d:t,detail:{of:"isometricGeometry",width:Math.max(0,o.width),height:Math.max(0,o.height),depth:Math.max(0,o.depth),cornerRadius:r,bounds:a,labelOffsetX:p(o.labelOffsetX,0),labelOffsetY:p(o.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}function Lo(e){return{...Ti(e,lt(Mi(e.object),0),0),style:{...e.common.style,fill:{kind:"none"},stroke:{kind:"none"}}}}var $i=20,m0=12,p0=6,Mo=3,f0=6.5;function h0(e){let{object:t}=e,r=di(t),o=r.y-m0+p(t.labelOffsetY,0);return{anchor:r,centerX:r.x+p(t.labelOffsetX,0),topY:o-$i,bottomY:o}}function g0(e,t,r){let{object:o,order:n,rotation:i,rotationCenter:a,box:s}=e,{centerX:l,topY:d,bottomY:c}=t;return{type:"text",id:`isometric-${o.id}-label`,order:n+.3,bounds:{minX:l-s.width/2,minY:d,maxX:l+s.width/2,maxY:c},x:l-s.width/2,y:d,width:s.width,height:$i,lines:[r],fontFamily:B,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function y0(e,t){let{object:r,order:o,rotation:n,rotationCenter:i}=e,{anchor:a,centerX:s,bottomY:l}=t;return{type:"path",id:`isometric-${r.id}-label-guide`,order:o+.25,bounds:{minX:Math.min(a.x,s),minY:Math.min(a.y,l),maxX:Math.max(a.x,s),maxY:Math.max(a.y,l)},d:`M ${a.x} ${a.y} L ${s} ${l}`,rotation:n,rotationCenter:i,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:1,lineCap:"round",pointerEvents:"none"}}}function b0(e,t,r,o){let{object:n,order:i,rotation:a}=e,{centerX:s,topY:l,bottomY:d}=t,c=Math.max(24,r.length*f0+p0*2);return{type:"rect",id:`isometric-${n.id}-label-background`,order:i+.28,x:s-c/2,y:l-Mo,width:c,height:$i+Mo*2,rx:4,bounds:{minX:s-c/2,minY:l-Mo,maxX:s+c/2,maxY:d+Mo},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:o},stroke:{kind:"none"}}}}function It(e,t){let r=h0(e),o=g0(e,r,t),n=y0(e,r),i=e.object.labelBackground;return i?[n,b0(e,r,t,i),o]:[n,o]}function To(e,t){let{object:r,index:o,rotation:n,rotationCenter:i}=e;if(!r.hasShadow)return;let a=Math.max(0,r.height),s=.6+Math.min(1,a/150)*.7,l=a+p(r.shadowStyle?.distance,0),d=t.map(y=>({x:y.x,y:y.y+l})),c={x:d.reduce((y,x)=>y+x.x,0)/d.length,y:d.reduce((y,x)=>y+x.y,0)/d.length},u=1.3,m=d.map(y=>({x:c.x+(y.x-c.x)*u,y:c.y+(y.y-c.y)*u})),f=m.map(y=>y.x),h=m.map(y=>y.y);return{type:"path",id:`isometric-${r.id}-ground-shadow`,order:14e3+o,bounds:{minX:Math.min(...f),minY:Math.min(...h),maxX:Math.max(...f),maxY:Math.max(...h)},d:lt(m,0),rotation:n,rotationCenter:i,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:Math.min(1,(r.shadowStyle?.opacity??.18)*s),blur:p(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function Lc(e,t){let{object:r,index:o,box:n}=e;if(!r.hasShadow)return;let i=Math.max(0,r.width),a=Math.max(0,r.depth),s={x:n.x+n.width/2,y:r.y+Math.max(0,r.height)+(i+a)*Ye/2};return{type:"ellipse",id:`isometric-${r.id}-ground-shadow`,order:14e3+o,bounds:{minX:s.x-t*1.1,minY:s.y-t*.6,maxX:s.x+t*1.1,maxY:s.y+t*.6},cx:s.x,cy:s.y,rx:t*1.05,ry:t*.52,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:r.shadowStyle?.opacity??.2,blur:p(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function x0(e,t,r){let{object:o,common:n}=e,i={...n.style,stroke:{kind:"none"}},a=pi(o.fill??"#f8fafc"),s=(l,d,c,u)=>yr(e,l,d,c,{...i,fill:{kind:"solid",color:u},clip:r});return[s("top",0,t.top,a.topFill),s("front",.1,t.front,a.frontFill),s("side",.2,t.right,a.sideFill)]}function S0(e,t,r){let{object:o,order:n,common:i,strokeWidth:a}=e;return{...i,id:`isometric-${o.id}-seams`,order:n+.22,d:`M ${t.top[3].x} ${t.top[3].y} L ${t.top[2].x} ${t.top[2].y} L ${t.top[1].x} ${t.top[1].y} M ${t.top[2].x} ${t.top[2].y} L ${t.front[2].x} ${t.front[2].y}`,style:{...i.style,fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:Math.min(a,1),clip:r}}}function Mc(e,t){let r=Bt(e,t),o=Ue(e),n=Math.max(0,p(e.cornerRadius,8)),i=lt(Mi(e),n),a={type:"path",d:i},s=To(r,o.top),l=e.seams===!1?void 0:S0(r,o,a),d=Ti(r,i,n),c=x0(r,o,a),u=s?[d,...c,s,...l?[l]:[]]:[d,...c,...l?[l]:[]];return e.text?[...u,...It(r,e.text)]:u}function C0(e,t,r,o){let n=At(o,t.light);return yr(e,`side-${r}`,.05+r*.001,t.points,{...e.common.style,stroke:{kind:"solid",color:n},strokeWidth:.6,fill:{kind:"solid",color:n}})}function k0(e,t,r){let[o,n,i,a]=t.points,s=[`M ${a.x} ${a.y} L ${i.x} ${i.y}`,...t.smoothStart?[]:[`M ${o.x} ${o.y} L ${a.x} ${a.y}`],...t.smoothEnd?[]:[`M ${n.x} ${n.y} L ${i.x} ${i.y}`]];return{...e.common,id:`isometric-${e.object.id}-side-${r}-edges`,order:e.order+.0505+r*.001,d:s.join(" "),style:{...e.common.style,fill:{kind:"none"}}}}function Tc(e,t,r){let o=Bt(e,t),{top:n,sides:i}=ui(e,r,Math.max(0,p(e.cornerRadius,0))),a=e.fill??"#f8fafc",s=To(o,n),l=yr(o,"top",.2,n,{...o.common.style,fill:{kind:"solid",color:a}}),d=[Lo(o),...s?[s]:[],...i.flatMap((c,u)=>[C0(o,c,u,a),k0(o,c,u)]),l];return e.text?[...d,...It(o,e.text)]:d}function $c(e,t){let r=Bt(e,t),{order:o,common:n,box:i}=r,a=Math.max(0,Math.min(e.width,e.height,e.depth))/2,s=i.x+i.width/2,l=i.y+i.height/2,d=e.fill??"#f8fafc",c={minX:s-a,minY:l-a,maxX:s+a,maxY:l+a},u={type:"ellipse",id:`isometric-${e.id}-sphere`,order:o+.1,bounds:c,cx:s,cy:l,rx:a,ry:a,style:{...n.style,fill:{kind:"linear-gradient",angle:135,stops:[{offset:0,color:At(d,1.22)},{offset:.5,color:d},{offset:1,color:At(d,.82)}]}},prop:"style.fill",propKind:"color",propSolidOnly:!0},m={type:"ellipse",id:`isometric-${e.id}-highlight`,order:o+.2,bounds:c,cx:s-a*.32,cy:l-a*.38,rx:a*.26,ry:a*.18,rotation:-35,style:{fill:{kind:"solid",color:"#ffffff"},stroke:{kind:"none"},opacity:.45,blur:a*.1,pointerEvents:"none"}},f=Lc(r,a),h=[Lo(r),...f?[f]:[],u,m];return e.text?[...h,...It(r,e.text)]:h}function R0(e,t){if(e.form==="sphere")return $c(e,t);let r=ko(e.footprint);return r.length>0?Tc(e,t,r):Mc(e,t)}function Ac(e){return e.flatMap((t,r)=>ee(R0(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function w0(e,t){let r=t==="start"?0:e.length-2,o=t==="start"?2:e.length-4,n=e[r],i=e[r+1],a=e[o]-n,s=e[o+1]-i,l=Math.hypot(a,s)||1,d=a/l,c=s/l;return{x:n+d*20-c*13,y:i+c*20+d*13}}function Ec(e,t,r){let o=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!o)return[];let n=p(e.link.style?.fontSize,10),i=w0(e.points,t),a=90;return[{type:"text",id:`link-${t}-label-${e.link.id}`,order:e.order+.55+r*.01,bounds:e.bounds,x:i.x-a/2,y:i.y-n,width:a,height:n*2,lines:[o],fontFamily:e.link.style?.fontFamily??B,fontSize:n,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function Nc(e){return[...Ec(e,"start",0),...Ec(e,"end",1)]}function Oc(e){return e.label.visible?[{type:"text",id:`link-text-${e.link.id}`,order:e.order+.5,bounds:e.bounds,x:e.midpoint.x-e.label.width/2,y:e.midpoint.y-e.label.fontSize,width:e.label.width,height:e.label.fontSize*2,lines:e.label.lines,fontFamily:e.link.style?.fontFamily??B,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var Ai=e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:t[4]===void 0?1:parseInt(t[4],16)/255}:{r:255,g:255,b:255,a:1}},Bc=(e,t,r,o)=>{let n=a=>{let s=Math.max(0,Math.min(255,Math.round(a))).toString(16);return s.length===1?`0${s}`:s},i=o===void 0||o>=1?"":n(o*255);return`#${n(e)}${n(t)}${n(r)}${i}`};function v0(e,t,r){let o=Ai(e),n=Ai(t),i=o.a??1,a=n.a??1;return Bc(Math.round(o.r+(n.r-o.r)*r),Math.round(o.g+(n.g-o.g)*r),Math.round(o.b+(n.b-o.b)*r),i+(a-i)*r)}function br(e,t){let r=[...e].sort((i,a)=>i.position-a.position),o=r[0],n=r[r.length-1];if(t<=o.position)return o.color;if(t>=n.position)return n.color;for(let i=0;i<r.length-1;i++){let a=r[i],s=r[i+1];if(t>=a.position&&t<=s.position){let l=s.position-a.position,d=l===0?0:(t-a.position)/l;return v0(a.color,s.color,d)}}return n.color}function Ic(e){if(e){if(typeof e=="string")return e;if(e.type==="gradient")return e.stops?.[0]?.color;if(e.type==="solid")return e.color}}var Dc=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function De(e,t,r,o){let n=Math.max(1,Math.floor(t/Math.max(1,r*.58))),i=o?(s,l)=>o.measure(s,!1)+o.spaceWidth+o.measure(l,!1)<=t:(s,l)=>`${s} ${l}`.length<=n,a=[];for(let s of e.split(`
12
- `)){let l=s.split(/\s+/).filter(Boolean);if(!l.length){a.push("");continue}let d="";for(let c of l)d?i(d,c)?d+=` ${c}`:(a.push(d),d=c):d=c;a.push(d)}return a}function $o(e,t,r,o){if(he(e,r,o)<=t)return e;let n=e.length;for(;n>1&&he(`${e.slice(0,n)}\u2026`,r,o)>t;)n-=1;return`${e.slice(0,n)}\u2026`}function he(e,t,r){return e.length*t*(r?.64:.58)}function Gc(e){return{measure:(t,r)=>he(t,e,r),spaceWidth:e*.58}}var dt=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function Ei(e,t,r,o,n){let i=1-n;return{x:i*i*i*e.x+3*i*i*n*t.x+3*i*n*n*r.x+n*n*n*o.x,y:i*i*i*e.y+3*i*i*n*t.y+3*i*n*n*r.y+n*n*n*o.y}}function Ni(e,t,r,o,n){let i=dt(e,t,n),a=dt(t,r,n),s=dt(r,o,n),l=dt(i,a,n),d=dt(a,s,n),c=dt(l,d,n);return{left:[e,i,l,c],right:[c,d,s,o]}}function Ao(e,t){let r=e.length-2;if(t<=0)return{point:{x:e[0],y:e[1]},segmentIndex:0};let o=0;for(let n=0;n<r;n+=2){let i={x:e[n],y:e[n+1]},a={x:e[n+2],y:e[n+3]},s=Math.hypot(a.x-i.x,a.y-i.y);if(o+s>=t){let l=s===0?0:(t-o)/s;return{point:dt(i,a,l),segmentIndex:n}}o+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function Eo(e){let t=0;for(let r=0;r<e.length-2;r+=2)t+=Math.hypot(e[r+2]-e[r],e[r+3]-e[r+1]);return t}function _c(e,t,r,o,n=40){let i=0,a=e;for(let s=1;s<=n;s++){let l=Ei(e,t,r,o,s/n);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var Dt=40;function P0(e){let t=[0],r=e[0];for(let o=1;o<=Dt;o++){let n=Ei(...e,o/Dt);t.push(t[o-1]+Math.hypot(n.x-r.x,n.y-r.y)),r=n}return t}function Fc(e,t){let r=e[Dt];if(t<=0)return 0;if(t>=r)return 1;for(let o=1;o<=Dt;o++)if(e[o]>=t){let n=(t-e[o-1])/(e[o]-e[o-1]||1);return(o-1+n)/Dt}return 1}function L0(e,t,r){let[o,n,i,a]=e,s=.75*(n.x-o.x)+1.5*(i.x-n.x)+.75*(a.x-i.x),l=.75*(n.y-o.y)+1.5*(i.y-n.y)+.75*(a.y-i.y),d=Math.hypot(s,l),c=d===0?1:Math.abs(s)/d,u=d===0?0:Math.abs(l)/d;return Math.min(t.halfWidth*c+t.halfHeight*u,r)}function Hc(e,t){if(e.length<8)return null;let r=M0(e),o=P0(r),n=o[Dt];if(n===0)return null;let i=n/2,a=Math.max(0,i-t.minimumVisibleStub),s=L0(r,t,a),l=Fc(o,i-s),d=Fc(o,i+s);return{before:T0(r,l),after:$0(r,d),bezier:!0}}function M0(e){return[{x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},{x:e[6],y:e[7]}]}function T0(e,t){return t<=.01?null:Ni(...e,t).left.flatMap(r=>[r.x,r.y])}function $0(e,t){return t>=.99?null:Ni(...e,t).right.flatMap(r=>[r.x,r.y])}function Vc(e,t){if(e.length<4)return null;let r=Eo(e);if(r===0)return null;let o=A0(e,r,t);return{before:N0(e,o.beforeLength),after:O0(e,o.afterLength,r),bezier:!1}}function A0(e,t,r){let o=t/2,n=Ao(e,o),i={x:e[n.segmentIndex],y:e[n.segmentIndex+1]},a={x:e[n.segmentIndex+2],y:e[n.segmentIndex+3]},s=E0(i,a,r,o);return{beforeLength:o-s,afterLength:o+s}}function E0(e,t,r,o){let n=Math.hypot(t.x-e.x,t.y-e.y),i=n===0?1:Math.abs(t.x-e.x)/n,a=n===0?0:Math.abs(t.y-e.y)/n,s=r.halfWidth*i+r.halfHeight*a;return Math.min(s,Math.max(0,o-r.minimumVisibleStub))}function N0(e,t){if(t<=.5)return null;let r=Ao(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function O0(e,t,r){if(t>=r-.5)return null;let o=Ao(e,t);return[o.point.x,o.point.y,...e.slice(o.segmentIndex+2)]}var Wc=3,B0=10;function I0(e){return[{x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},{x:e[6],y:e[7]}]}function Oi(e,t){return t?_c(...I0(e)):Eo(e)}function zc(e,t,r,o){let n={halfWidth:(r+Wc)/2,halfHeight:(o+Wc)/2,minimumVisibleStub:B0};return t==="curved"?Hc(e,n):Vc(e,n)}function Bi(e,t,r,o){let n=zc(e,t,r,o);if(!n||!n.before&&!n.after)return null;let i=Oi(e,n.bezier),a=n.before?Oi(n.before,n.bezier):0,s=n.after?Oi(n.after,n.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function D0(e){let[t,r,o,n,i,a,s,l]=e,d=.5,c=1-d;return{x:c*c*c*t+3*c*c*d*o+3*c*d*d*i+d*d*d*s,y:c*c*c*r+3*c*c*d*n+3*c*d*d*a+d*d*d*l}}function G0(e,t){let r=0,o=[];for(let a=0;a<e.length-2;a+=2){let s={x:e[a],y:e[a+1]},l={x:e[a+2],y:e[a+3]},d=Math.sqrt((l.x-s.x)**2+(l.y-s.y)**2);r+=d,o.push({start:s,end:l,length:d})}let n=r/2,i=0;for(let a of o){if(i+a.length>=n){let s=(n-i)/a.length;return{x:a.start.x+s*(a.end.x-a.start.x),y:a.start.y+s*(a.end.y-a.start.y)}}i+=a.length}return t}function Ii(e,t,r,o){if(t==="curved")return D0(e);let n={x:(r.x+o.x)/2,y:(r.y+o.y)/2};return t==="orthogonal"?G0(e,n):n}function Gt(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function _0(e,t,r,o,n){let i=n?.min??50,a=n?.max??240,s=n?.perpendicularScale??.9,l=t.x-e.x,d=t.y-e.y,c=Math.abs(l*r[0]+d*r[1]),u=Math.abs(l*o[0]+d*o[1]),m=Math.abs(l*r[1]-d*r[0]),f=Math.abs(l*o[1]-d*o[0]),h=r[0]===o[0]&&r[1]===o[1]||r[0]===-o[0]&&r[1]===-o[1],y=Math.max(i,Math.min(a,Math.max(c,m*s))),x=Math.max(i,Math.min(a,Math.max(u,f*s)));return h&&(y=Math.min(a,y+m*.75),x=Math.min(a,x+f*.75)),{fromDistance:y,toDistance:x}}function Yc(e,t,r,o,n){let i=Gt(r),a=Gt(o),{fromDistance:s,toDistance:l}=_0(e,t,i,a,n);return{p0:[e.x,e.y],p1:[e.x+i[0]*s,e.y+i[1]*s],p2:[t.x+a[0]*l,t.y+a[1]*l],p3:[t.x,t.y]}}function Uc(e,t,r,o){let{p0:n,p1:i,p2:a,p3:s}=Yc(e,t,r,o,{min:35,max:90,perpendicularScale:.5});return{points:[...n,...i,...a,...s],segments:[]}}function Xc(e,t,r,o){let i=["top","bottom"].includes(r)&&["top","bottom"].includes(o),a=["left","right"].includes(r)&&["left","right"].includes(o);return i&&Math.abs(t.x-e.x)<6?[e,{...t,x:e.x}]:a&&Math.abs(t.y-e.y)<6?[e,{...t,y:e.y}]:[e,t]}function qc(e,t,r){return r?.toEdge?r.toEdge==="left"||r.toEdge==="right":r?.fromEdge?r.fromEdge==="left"||r.fromEdge==="right":Math.abs(t.x-e.x)>Math.abs(t.y-e.y)}function Kc(e,t,r,o,n){let i=40,a=40,s=n?0:1,l=n?t.x-e.x:t.y-e.y;if(r[s]!==0&&r[s]===-o[s]){let d=l*r[s];d>0&&d<i+a&&(i=d/2,a=d/2)}else if(r[s]===0){let d=l*-o[s];d>0&&d<a&&(a=d)}return[i,a]}function Zc(e){let{fromConnection:t,toConnection:r,to:o,horizontalFirst:n}=e,i=t.stub,a=r.stub,s=(i[0]+a[0])/2,l=(i[1]+a[1])/2,d=jc(t.side),c=jc(r.side);return d!==c?n?s=(i[0]-o.x)*r.normal[0]>=0?i[0]:a[0]:l=(i[1]-o.y)*r.normal[1]>=0?i[1]:a[1]:t.side===r.side&&(n?s=t.normal[0]<0?Math.min(i[0],a[0]):Math.max(i[0],a[0]):l=t.normal[1]<0?Math.min(i[1],a[1]):Math.max(i[1],a[1])),[s,l]}function jc(e){return e==="left"||e==="right"}function Qc(e){let t=[];for(let r=0;r<e.length-2;r+=2)t.push({x:(e[r]+e[r+2])/2,y:(e[r+1]+e[r+3])/2});return t}function Jc(e,t){let{from:r,to:o,fromConnection:n,toConnection:i,horizontalFirst:a}=e,s=n.stub,l=i.stub,d=[r.x,r.y,s[0],s[1]];return a?d.push(t[0],s[1],t[0],l[1]):d.push(s[0],t[1],l[0],t[1]),d.push(l[0],l[1],o.x,o.y),d}function eu(e,t,r){let o=e?["left","right"]:["top","bottom"];return[!o.includes(t),!o.includes(r)]}function tu(e,t,r,o){let{from:n,to:i,fromConnection:a,toConnection:s,horizontalFirst:l}=e,d=a.stub,c=s.stub,u=o[0]&&r?.[1]||0,m=r?.[2]||0,f=o[1]&&r?.[3]||0;if(l){let b=d[1]+u,C=t[0]+m,S=c[1]+f;return[n.x,n.y,d[0],b,C,b,C,S,c[0],S,i.x,i.y]}let h=d[0]+u,y=t[1]+m,x=c[0]+f;return[n.x,n.y,h,d[1],h,y,x,y,x,c[1],i.x,i.y]}function ru(e,t,r,o){let n=(e.length-2)/2;return t.map((i,a)=>{let s=a*2,l={x:e[s],y:e[s+1]},d={x:e[s+2],y:e[s+3]},c={x:(l.x+d.x)/2,y:(l.y+d.y)/2},u=a>0&&a<n-1,m=a===1?r:a===n-2?o:!0,f=Math.hypot(d.x-l.x,d.y-l.y)>=1;return{start:l,end:d,midpoint:c,originalMidpoint:i,isHorizontal:Math.abs(d.x-l.x)>Math.abs(d.y-l.y),canMove:u&&m&&f}})}function No(e,t){if(e.length<6)return e;let r=W0(e),o=[r[0]];for(let n=1;n<r.length-1;n++){let i=F0(r[n-1],r[n],r[n+1],t);o.push(...i?V0(i):[r[n]])}return o.push(r[r.length-1]),o.flatMap(n=>[n.x,n.y])}function F0(e,t,r,o){let n={x:t.x-e.x,y:t.y-e.y},i={x:r.x-t.x,y:r.y-t.y},a=n.x===0||n.y===0,s=i.x===0||i.y===0,l=n.x===0&&i.x===0||n.y===0&&i.y===0;if(!a||!s||l)return null;let d=Math.min(o,ou(n)*.4,ou(i)*.4);if(d<=0)return null;let c=nu(n),u=nu(i),m=Di(t,c,-d),f=Di(t,u,d),h=Di(m,u,d),y=Math.atan2(m.y-h.y,m.x-h.x),x=Math.atan2(f.y-h.y,f.x-h.x);return{entry:m,exit:f,center:h,radius:d,startAngle:y,angleSweep:H0(x-y)}}function Di(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function ou(e){return Math.abs(e.x)+Math.abs(e.y)}function nu(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function H0(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function V0(e){let t=[e.entry];for(let r=1;r<7;r++){let o=r/7,n=e.startAngle+e.angleSweep*o;t.push({x:e.center.x+Math.cos(n)*e.radius,y:e.center.y+Math.sin(n)*e.radius})}return t.push(e.exit),t}function W0(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Gi(e){let t=z0(e),r=Zc(t),o=Jc(t,r),n=Qc(o),i=eu(t.horizontalFirst,e.fromSide,e.toSide),a=tu(t,r,e.segmentOffsets,i),s=ru(a,n,i[0],i[1]);return{points:No(a,10),segments:s}}function z0(e){let[t,r]=Xc(e.from,e.to,e.fromSide,e.toSide),o=Gt(e.fromSide),n=Gt(e.toSide),i=qc(t,r,e.endpointEdges),[a,s]=Kc(t,r,o,n,i);return{from:t,to:r,fromConnection:iu(t,e.fromSide,o,a),toConnection:iu(r,e.toSide,n,s),horizontalFirst:i}}function iu(e,t,r,o){return{side:t,normal:r,stub:[e.x+r[0]*o,e.y+r[1]*o]}}var au=.5;function su(e,t,r){let o=[e,...t,r],n=[];for(let a of o)n.push(a.x,a.y);let i=[];for(let a=0;a<n.length-2;a+=2){let s={x:n[a],y:n[a+1]},l={x:n[a+2],y:n[a+3]},d={x:(s.x+l.x)/2,y:(s.y+l.y)/2};i.push({start:s,end:l,midpoint:d,originalMidpoint:d,isHorizontal:Math.abs(l.x-s.x)>Math.abs(l.y-s.y),canMove:!1})}return{points:No(n,10),segments:i}}function _i(e){return e.every(t=>{let r=Math.abs(t.end.x-t.start.x),o=Math.abs(t.end.y-t.start.y);return r<=au||o<=au})}function lu(e,t,r,o,n){if(e.waypoints&&e.waypoints.length>0){let l=su(t,e.waypoints,r);if(_i(l.segments))return l}let i={fromEdge:o,toEdge:n},a={from:t,to:r,fromSide:o,toSide:n,segmentOffsets:e.segmentOffsets,endpointEdges:i},s=Gi(a);return _i(s.segments)?s:Gi({...a,segmentOffsets:void 0})}function du(e,t){let r=Math.atan2(t.y-e.y,t.x-e.x);return r>=-Math.PI/4&&r<Math.PI/4?"right":r>=Math.PI/4&&r<3*Math.PI/4?"bottom":r>=-3*Math.PI/4&&r<-Math.PI/4?"top":"left"}function cu(e,t,r){let o=e.fromPoint?.kind==="side"?e.fromPoint.side:du(t,r),n=e.toPoint?.kind==="side"?e.toPoint.side:du(r,t);return{fromSide:o,toSide:n}}function uu(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function mu(e,t,r,o){let{fromSide:n,toSide:i}=cu(e,t,r);return o==="curved"?Uc(t,r,n,i):o==="orthogonal"?lu(e,t,r,n,i):uu(t,r)}function Y0(e,t){let r=e.filter((n,i)=>i%2===0),o=e.filter((n,i)=>i%2===1);return{minX:Math.min(...r)-t,minY:Math.min(...o)-t,maxX:Math.max(...r)+t,maxY:Math.max(...o)+t}}function U0(e,t){let r=!!(e.showText&&e.text),o=p(e.style?.fontSize,10),n=Math.min(250,Math.max(o*2,(e.text?.length??0)*o*.65+10)),i=t?.(e.style?.fontFamily??B,o),a=r?De(e.text??"",n,o,i):[];return{visible:r,fontSize:o,width:n,height:a.length*o*1.4,lines:a}}function j0(e,t,r,o){let n=e.link,i=typeof n.style?.color=="object"&&n.style.color.type==="gradient"?{kind:"linear-gradient",angle:0,stops:n.style.color.stops.map(a=>({offset:a.position,color:a.color}))}:{kind:"solid",color:r};return{fill:{kind:"none"},stroke:i,strokeWidth:t,dash:o,lineCap:"round",lineJoin:"round",opacity:p(n.style?.opacity,1),shadow:vo(n.style?.shadow)}}function pu(e,t,r){let{link:o,from:n,to:i}=e,a=o.style?.pathType??"orthogonal",{points:s,segments:l}=mu(o,n,i,a),d=p(o.style?.strokeWidth,2),c=Ic(o.style?.color)||"#64748b",u=U0(o,r),m=Dc(d,o.style?.strokeStyle??"solid"),f=u.visible&&!m?Bi(s,a,u.width,u.height):null,h=f?[f.dashBefore,f.gapLength,1e6]:m;return{link:o,pathType:a,points:s,segments:l,midpoint:Ii(s,a,n,i),strokeWidth:d,bounds:Y0(s,d+14),color:c,order:2e4+t,style:j0(e,d,c,h),label:u,hasLabelGap:!!f}}function Fi(e,t){let r=t==="start"?e.startMarker:e.endMarker;if(r)return r;let o=e.style?.arrowDirection??"forward";return o==="bidirectional"||t==="start"&&o==="backward"||t==="end"&&o==="forward"?"arrow":"none"}function fu(e,t){if(e.length===0)return"";let r=[e[0].start,...e.map(s=>s.end)],o=r.filter((s,l)=>l===0||s.x!==r[l-1].x||s.y!==r[l-1].y),n=o.filter((s,l)=>{if(l===0||l===o.length-1)return!0;let d=o[l-1],c=o[l+1];return!(d.x===s.x&&s.x===c.x||d.y===s.y&&s.y===c.y)});if(n.length<2)return"";let i=`M ${n[0].x} ${n[0].y}`;for(let s=1;s<n.length-1;s++){let l=n[s-1],d=n[s],c=n[s+1],u=Math.hypot(d.x-l.x,d.y-l.y),m=Math.hypot(c.x-d.x,c.y-d.y);if(u===0||m===0){i+=` L ${d.x} ${d.y}`;continue}let f=Math.min(t,u*.4,m*.4),h={x:d.x+(l.x-d.x)/u*f,y:d.y+(l.y-d.y)/u*f},y={x:d.x+(c.x-d.x)/m*f,y:d.y+(c.y-d.y)/m*f};i+=` L ${h.x} ${h.y} Q ${d.x} ${d.y} ${y.x} ${y.y}`}let a=n[n.length-1];return`${i} L ${a.x} ${a.y}`}function X0(e){let t=`M ${e[0]} ${e[1]}`;for(let r=2;r<e.length;r+=2)t+=` L ${e[r]} ${e[r+1]}`;return t}function q0(e,t,r,o){return e.length<4?"":t==="curved"&&e.length>=8?`M ${e[0]} ${e[1]} C ${e[2]} ${e[3]} ${e[4]} ${e[5]} ${e[6]} ${e[7]}`:t==="orthogonal"&&r.length>0?fu(r,Math.max(16,o*4)):X0(e)}var _t=e=>Math.round(e*100)/100;function K0(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:_t(r.start.x),ay:_t(r.start.y),bx:_t(r.end.x),by:_t(r.end.y),ox:_t(r.originalMidpoint.x),oy:_t(r.originalMidpoint.y),movable:r.canMove}))}function hu(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:q0(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:Fi(t,"start"),markerEnd:Fi(t,"end"),detail:{of:"link",fromId:t.fromId,toId:t.toId,route:e.pathType,fromSide:t.fromPoint?.kind==="side"?t.fromPoint.side:void 0,toSide:t.toPoint?.kind==="side"?t.toPoint.side:void 0,fromFace:t.fromPoint?.kind==="face"?t.fromPoint.face:void 0,toFace:t.toPoint?.kind==="face"?t.toPoint.face:void 0,labelGap:e.hasLabelGap,segments:K0(e.pathType,e.segments)}}}function gu(e){let{link:t}=e;if(t.weight===void 0||t.weight===null||t.showWeight===!1)return[];let r=t.weight.toFixed(1),o=Math.max(30,r.length*8+12),n=16,i=e.midpoint.y+(e.label.visible?e.label.height/2+10:0);return[{type:"rect",id:`link-weight-badge-${t.id}`,order:e.order+.6,bounds:e.bounds,x:e.midpoint.x-o/2,y:i-n/2,width:o,height:n,rx:n/2,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"},opacity:.92}},{type:"text",id:`link-weight-${t.id}`,order:e.order+.61,bounds:e.bounds,x:e.midpoint.x-o/2,y:i-n/2,width:o,height:n,lines:[r],fontFamily:"Arial, sans-serif",fontSize:10,fontWeight:"bold",color:"#ffffff",align:"center",verticalAlign:"middle",lineHeight:1}]}function Z0(e,t,r){if(e.link.isVisible===!1)return[];let o=pu(e,t,r);return[hu(o),...Oc(o),...gu(o),...Nc(o)]}function yu(e,t){return e.flatMap((r,o)=>ee(Z0(r,o,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function Q0(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=p(e.strokeWidth,2),o=r+12,n={minX:Math.min(...e.points.map(s=>s.x))-o,minY:Math.min(...e.points.map(s=>s.y))-o,maxX:Math.max(...e.points.map(s=>s.x))+o,maxY:Math.max(...e.points.map(s=>s.y))+o},i=p(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:n,d:Te({points:e.points,tension:i,closed:a}),markerStart:e.startMarker,markerEnd:e.endMarker,detail:{of:"pathGeometry",points:e.points.map(s=>[s.x,s.y]),tension:i,closed:a},style:{fill:e.closed?{kind:"solid",color:e.fillColor??"transparent"}:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??"#7c3aed"},strokeWidth:r,dash:e.dash?.length?e.dash:void 0,lineCap:"round",lineJoin:"round",opacity:p(e.opacity,1)}}]}function bu(e){return e.flatMap((t,r)=>ee(Q0(t,r),"path",t.id,"path","Path"))}function xr(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var J0=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],Oo=Math.PI/2,ex=4*Oo,xu=Math.PI/2,tx=1e-9;function Hi([e,t,r],o){return[e+r*Math.cos(o),t+r*Math.sin(o)]}function Su([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function Cu(e,t,r){let o=t[0]-e[0],n=t[1]-e[1],i=Math.hypot(o,n),a=(e[2]**2-t[2]**2+i**2)/(2*i),s=Math.sqrt(Math.max(0,e[2]**2-a**2)),l=e[0]+a*o/i,d=e[1]+a*n/i,c=[[l-s*n/i,d+s*o/i],[l+s*n/i,d-s*o/i]],u=m=>Math.hypot(m[0]-r[0],m[1]-r[1]);return u(c[0])>u(c[1])?c[0]:c[1]}function rx(e){let t=[e.reduce((r,o)=>r+o[0],0)/e.length,e.reduce((r,o)=>r+o[1],0)/e.length];return e.map((r,o)=>{let n=o===0?xu:Su(r,Cu(e[o-1],r,t)),a=o===e.length-1?xu:Su(r,Cu(r,e[o+1],t));for(;a<=n;)a+=ex;return{lobe:r,from:n,to:a}})}function ox(e,t){let r=[];for(let o=Math.floor(e/Oo)+1;o*Oo<t-tx;o++)r.push(o*Oo);return[...r,t]}function nx({lobe:e,from:t,to:r}){let o=Hi(e,t),n=[],i=t;for(let a of ox(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Hi(e,i),d=Hi(e,a);n.push([[l[0]-s*Math.sin(i),l[1]+s*Math.cos(i)],[d[0]+s*Math.sin(a),d[1]-s*Math.cos(a)],d]),i=a}return{start:o,curves:n}}function ix(){let e=rx(J0).map(nx),t=e[0].start,r=e.flatMap(d=>d.curves),o=[t,...r.map(d=>d[2])],n=Math.min(...o.map(d=>d[0])),i=Math.max(...o.map(d=>d[0])),a=Math.min(...o.map(d=>d[1])),s=Math.max(...o.map(d=>d[1])),l=d=>[(d[0]-n)/(i-n),(d[1]-a)/(s-a)];return{start:l(t),curves:r.map(([d,c,u])=>[l(d),l(c),l(u)])}}var ku=ix();function Ru(e,t,r,o){let n=([a,s])=>`${e+a*r} ${t+s*o}`,i=ku.curves.map(([a,s,l])=>`C ${n(a)} ${n(s)} ${n(l)}`);return`M ${n(ku.start)} ${i.join(" ")} Z`}function wu(e,t,r,o){let n=Math.min(o*.22,r*.2),i=r/2,a=e+i,s=e,l=e+r,d=t+n,c=t+o-n,u=`M ${s} ${d} C ${s} ${d+.5523*n} ${a-.5523*i} ${d+n} ${a} ${d+n} C ${a+.5523*i} ${d+n} ${l} ${d+.5523*n} ${l} ${d} C ${l} ${d-.5523*n} ${a+.5523*i} ${t} ${a} ${t} C ${a-.5523*i} ${t} ${s} ${d-.5523*n} ${s} ${d} Z`,m=`M ${s} ${d} L ${s} ${c} C ${s} ${c+.5523*n} ${a-.5523*i} ${t+o} ${a} ${t+o} C ${a+.5523*i} ${t+o} ${l} ${c+.5523*n} ${l} ${c} L ${l} ${d}`;return`${u} ${m}`}function vu(e,t,r,o){let n=Math.min(r/4,o/4.35),i=n,a=n*2,s=n*4.35,l=t+(o-s)/2;return{head:i,body:a,centerX:e+r/2,headCenterY:l+i,bottom:l+s}}function Pu(e,t,r,o){let{body:n,centerX:i,bottom:a}=vu(e,t,r,o);return{x:i-n,y:a-n,width:n*2,height:n}}function Lu(e,t,r,o){let{head:n,body:i,centerX:a,headCenterY:s,bottom:l}=vu(e,t,r,o),d=`M ${a} ${s-n} C ${a+.5523*n} ${s-n} ${a+n} ${s-.5523*n} ${a+n} ${s} C ${a+n} ${s+.5523*n} ${a+.5523*n} ${s+n} ${a} ${s+n} C ${a-.5523*n} ${s+n} ${a-n} ${s+.5523*n} ${a-n} ${s} C ${a-n} ${s-.5523*n} ${a-.5523*n} ${s-n} ${a} ${s-n} Z`,c=`M ${a-i} ${l} C ${a-i} ${l-.5523*i} ${a-.5523*i} ${l-i} ${a} ${l-i} C ${a+.5523*i} ${l-i} ${a+i} ${l-.5523*i} ${a+i} ${l} Z`;return`${d} ${c}`}var ax=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,o)=>t+(o%2?` ${r}`:` L ${r}`),"")} Z`,sx=.1,lx=Math.PI/6,dx=.25,cx=.15;function Mu(e,t){return Math.min(e,t)/2}function Tu(e,t,r,o,n){let i=(...a)=>ax(a);switch(e){case"diamond":return i(t+o/2,r,t+o,r+n/2,t+o/2,r+n,t,r+n/2);case"triangle":return i(t+o/2,r,t,r+n,t+o,r+n);case"parallelogram":return i(t+o*.15,r,t+o,r,t+o*.85,r+n,t,r+n);case"trapezoid":return i(t+o*.2,r,t+o*.8,r,t+o,r+n,t,r+n);case"hexagon":{let a=Math.min(o,n)/4;return i(t+a,r,t+o-a,r,t+o,r+n/2,t+o-a,r+n,t+a,r+n,t,r+n/2)}case"document":{let a=n*sx,s=r+n-a,l=o/4,d=a*lx;return`M ${t} ${r} L ${t+o} ${r} L ${t+o} ${s} C ${t+o-l/3} ${s-d} ${t+o-l*2/3} ${s-a} ${t+o-l} ${s-a} C ${t+o-l-l/3} ${s-a} ${t+o/2+l/3} ${s-d} ${t+o/2} ${s} C ${t+o/2-l/3} ${s+d} ${t+o/2-l*2/3} ${s+a} ${t+l} ${s+a} C ${t+l-l/3} ${s+a} ${t+l/3} ${s+d} ${t} ${s} Z`}case"note":{let a=Math.min(o,n)*dx;return`M ${t} ${r} L ${t+o-a} ${r} L ${t+o} ${r+a} L ${t+o} ${r+n} L ${t} ${r+n} Z M ${t+o} ${r+a} L ${t+o-a} ${r+a} L ${t+o-a} ${r}`}case"cloud":return Ru(t,r,o,n);case"cylinder":return wu(t,r,o,n);case"person":return Lu(t,r,o,n);case"predefined_process":{let a=Math.min(o,n)*cx;return`M ${t} ${r} L ${t+o} ${r} L ${t+o} ${r+n} L ${t} ${r+n} Z M ${t+a} ${r} L ${t+a} ${r+n} M ${t+o-a} ${r} L ${t+o-a} ${r+n}`}default:return null}}function ke(e){let t=Tu(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...xr(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function $u(e){return ke(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function Ft(e){let t=e.shape.shapeType==="pill"?Mu(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?p(e.shape.cornerRadius,8):0;return[{...xr(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function Vi(e){return[{...xr(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function Au(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return Ft(e);let t=p(e.shape.symbol.tension,0),r=e.shape.symbol.points.map(([o,n])=>({x:e.x+o*e.width,y:e.y+n*e.height}));return[{...xr(e),type:"path",d:Te({points:r,tension:t,closed:!0}),rotationCenter:e.rotationCenter,detail:{of:"symbolGeometry",points:e.shape.symbol.points,tension:t,declaredBounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}]}var ux={cloud:ke,cylinder:ke,diamond:ke,document:ke,hexagon:ke,note:ke,oval:Vi,circle:Vi,parallelogram:ke,person:$u,pill:Ft,predefined_process:ke,rectangle:Ft,rounded_rectangle:Ft,symbol:Au,trapezoid:ke,triangle:ke};function Sr(e){return(ux[e.shape.shapeType]??Ft)(e)}var mx=new Set(["reactivePanel","ledMatrix","lightBand","silkFolds","glowCard","glassDots"]);function px(e){if(e.shape.shapeType==="circle"||e.shape.shapeType==="oval")return"ellipse";if((e.shape.shapeType==="rectangle"||e.shape.shapeType==="rounded_rectangle")&&e.shape.shader&&mx.has(e.shape.shader.program))return"rect"}function Eu(e){if(!e.shape.shader)return;let t=px(e);if(!t)return;let r=t==="rect"?Math.max(0,e.shape.shader.surfacePadding??0):0,o={x:e.x-r,y:e.y-r,width:e.width+r*2,height:e.height+r*2};return{id:`${e.id}-shader`,type:"shader-surface",order:e.order,bounds:N(o,e.rotation,0),...o,rotation:e.rotation,shader:e.shape.shader,mask:t,fillColor:e.style.fill?.kind==="solid"?e.style.fill.color:void 0}}var fx={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},te={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},Nu={rectangle:te,rounded_rectangle:{...te,cornerRadius:8},triangle:{...te,rotation:0},diamond:{...te,rotation:0},hexagon:{...te,rotation:0},oval:{...te,rotation:0},circle:{...te,rotation:0},document:{...te,rotation:0},parallelogram:{...te,rotation:0},trapezoid:{...te,rotation:0},cylinder:{...te,rotation:0},note:{...te,rotation:0},cloud:{...te,rotation:0},predefined_process:{...te,rotation:0},pill:te,person:{...te,rotation:0},symbol:{...te,rotation:0}};function Wi(e,t){let r=Nu[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${fx[e.shapeType]??""}, falling back to rectangle defaults.`}),Nu.rectangle)}function hx(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function Ou(e,t){let r=Wi(e,t),o=p(e.strokeWidth,r.strokeWidth),n=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=p(n?.angle,45)*Math.PI/180;return{fill:P(e.fillColor,t,e.id),stroke:P(e.strokeColor,t,e.id),strokeWidth:o,dash:hx(e,o),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:p(e.opacity,r.opacity),blur:e.blur!==void 0&&e.blur>0?e.blur:void 0,blend:e.blend,shadow:n?.enabled?{color:n.color??"#000000",opacity:p(n.opacity,.25),blur:p(n.blur,10),dx:Math.cos(i)*p(n.distance,5),dy:Math.sin(i)*p(n.distance,5)}:void 0}}var zi=/\*\*([^*]+)\*\*/g;function Bu(e){return/\*\*[^*]+\*\*/.test(e)}function gx(e){let t=[],r=0;zi.lastIndex=0;let o;for(;o=zi.exec(e);)o.index>r&&t.push({text:e.slice(r,o.index),bold:!1}),o[1]&&t.push({text:o[1],bold:!0}),r=zi.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function yx(e){return e.split(`
13
- `).map(gx)}function bx(e){let t=[];for(let r of e)for(let o of r.text.split(/\s+/))o&&t.push({text:o,bold:r.bold});return t}function xx(e,t,r,o){let n=bx(e);if(!n.length)return[[]];let i=[],a=[],s=0;for(let l of n){let d=r(l.text,l.bold),c=a.length?o+d:d;a.length&&s+c>t?(i.push(a),a=[l],s=d):(a.push(l),s+=c)}return i.push(a),i}function Iu(e,t,r,o){return yx(e).flatMap(n=>xx(n,Math.max(1,t),r,o))}function Du(e,t,r){let{shape:o,bounds:n,order:i,rotation:a,rotationCenter:s,x:l,y:d,width:c,height:u}=e;if(!o.text)return null;let m=p(o.fontSize,Wi(o,[]).fontSize),f=o.isText?0:Math.max(8,t*2),h=o.shapeType==="person"?Pu(l,d,c,u):{x:l,y:d,width:c,height:u},y=Math.max(0,h.width-f*2),x=o.fontFamily||B,b=r?.(x,m),C={type:"text",id:`shape-text-${o.id}`,order:i+.5,bounds:n,x:h.x+f,y:h.y+f,width:y,height:Math.max(0,h.height-f*2),lines:De(o.text,y,m,b),fontFamily:x,fontSize:m,fontWeight:o.fontWeight??"normal",letterSpacing:o.letterSpacing,color:o.textColor||"#111827",align:o.textAlign??"center",verticalAlign:o.textVerticalAlign??"middle",lineHeight:p(o.lineHeight,1.3),rotation:a,rotationCenter:s};if(Bu(o.text)){let{measure:S,spaceWidth:w}=b??Gc(m);C.richLines=Iu(o.text,y,S,w)}return C}function Sx(e,t){let r=Math.max(0,e.width-2*t),o=Math.max(0,e.height-2*t),n={...e.style,fill:{kind:"none"},strokeWidth:Math.max(1,t/3),dash:void 0,shadow:void 0},i=Sr({...e,style:n});if(r<=0||o<=0)return i;let a={...e,x:e.x+t,y:e.y+t,width:r,height:o};return i.push(...Sr({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...Sr({...a,id:`${e.id}-inner`,style:n})),i}function Cx(e,t,r){let o=p(e.x,0),n=p(e.y,0),i=Math.max(0,p(e.width,100)),a=Math.max(0,p(e.height,100)),s=p(e.rotation,0),l=p(e.strokeWidth,2);return{strokeWidth:l,context:{shape:e,id:`shape-${e.id}`,order:1e4+t,bounds:N({x:o,y:n,width:i,height:a},s,l+(e.hasShadow?20:2)),rotation:s,rotationCenter:{x:o+i/2,y:n+a/2},style:Ou(e,r),x:o,y:n,width:i,height:a}}}function kx(e,t,r,o){if(e.isVisible===!1)return[];let{context:n,strokeWidth:i}=Cx(e,t,r),a=e.strokeStyle==="double"?Sx(n,i||1):Sr(n),s=Eu(n);if(s){for(let d of a)(d.type==="ellipse"||d.type==="path"||d.type==="rect")&&(d.style={...d.style,pointerEvents:"all"});a.push(s)}let l=Du(n,i,o);return l&&a.push(l),a}function Gu(e,t,r){return e.flatMap((o,n)=>ee(kx(o,n,t,r),"shape",o.id,o.shapeType,o.text||o.shapeType,o.parentFrameId??void 0))}var E=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],K="#94a3b8",Cr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],Yi=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function U(e){if(!(e.step>0))return e.min===e.max?[e.min]:[e.min,e.max];let t=e.min<=e.max,r=t?e.step:-e.step,o=[];for(let n=e.min;(t?n<=e.max+1e-9:n>=e.max-1e-9)&&o.length<1e3;n+=r)o.push(Math.round(n*1e3)/1e3);return o}function kr(e){let t=[...e.thresholds??[]].filter(r=>r>e.min&&r<e.max).sort((r,o)=>r-o);return[e.min,...t,e.max]}function Rr(e,t,r){let o=Math.max(0,t.length-1),n=r.slice(0,o).map((i,a)=>({position:t[a+1]??t[t.length-1],color:i.color??K}));return n.length?br(n,e):K}function Re(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var we={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function Ui(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function ji(e,t,r){let o=r?we.padX:0,n=r?we.padY:0,i=t*we.lineHeight;return{width:e.length*t*we.charWidth+o*2,height:i+n*2,lineHeight:i,padX:o,padY:n}}function Xi(e,t,r,o){let n=o/2;return`M ${e+n} ${t} H ${e+r-n} A ${n} ${n} 0 0 1 ${e+r-n} ${t+o} H ${e+n} A ${n} ${n} 0 0 1 ${e+n} ${t} Z`}function Bo(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t+i} Q ${e} ${t} ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+o} H ${e} Z`}function Ge(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+o-i} Q ${e+r} ${t+o} ${e+r-i} ${t+o} H ${e+i} Q ${e} ${t+o} ${e} ${t+o-i} V ${t+i} Q ${e} ${t} ${e+i} ${t} Z`}function ct(e,t,r,o,n,i){return i?Ge(e,t,r,o,n):Bo(e,t,r,o,n)}function qi(e,t){if(e.length===1)return e[0];let r=(e.length-1)*t,o=Math.floor(r),n=Math.ceil(r);return o===n?e[o]:e[o]+(r-o)*(e[n]-e[o])}function Ki(e){if(!e?.length)return null;let t=[...e].sort((r,o)=>r-o);return{min:t[0],q1:qi(t,.25),median:qi(t,.5),q3:qi(t,.75),max:t[t.length-1]}}function wr(e){if(e?.[0]!=="#")return;let t=e.length===4?e.slice(1).split("").map(i=>parseInt(i+i,16)):[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)),[r,o,n]=t;return[r,o,n].some(i=>Number.isNaN(i))?void 0:[r,o,n]}function Zi(e,t){let r=wr(e),o=Math.max(0,Math.min(1,t));if(!r)return o<=0?"transparent":e??"transparent";let[n,i,a]=r;return`rgba(${n}, ${i}, ${a}, ${o})`}function Qi(e,t,r){let o=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(r)}`}function Do(e,t,r){let o=e/255,n=t/255,i=r/255,a=Math.max(o,n,i),s=Math.min(o,n,i),l=(a+s)/2,d=a-s;if(d===0)return[0,0,l];let c=d/(1-Math.abs(2*l-1)),u;return a===o?u=(n-i)/d%6:a===n?u=(i-o)/d+2:u=(o-n)/d+4,u*=60,u<0&&(u+=360),[u,c,l]}function Ji(e,t,r){let o=(1-Math.abs(2*r-1))*t,n=o*(1-Math.abs(e/60%2-1)),i=r-o/2,[a,s,l]=[0,0,0];return e<60?[a,s,l]=[o,n,0]:e<120?[a,s,l]=[n,o,0]:e<180?[a,s,l]=[0,o,n]:e<240?[a,s,l]=[0,n,o]:e<300?[a,s,l]=[n,0,o]:[a,s,l]=[o,0,n],[(a+i)*255,(s+i)*255,(l+i)*255]}function _u(e,t,r){let o=n=>{let i=n/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(r)}function Rx(e,t){let r=Math.max(e,t),o=Math.min(e,t);return(r+.05)/(o+.05)}var Io=.35,Fu=.08,Hu=.22,Vu=.78,Wu=.92,wx=3;function ce(e){let t=wr(e);if(!t)return"#0f172a";let[r,o,n]=t,i=(.299*r+.587*o+.114*n)/255>.6?"#0f172a":"#ffffff",[a,s,l]=Do(r,o,n);if(s===0)return i;let d=l>.5?Math.max(Fu,Math.min(l-Io,Hu)):Math.min(Wu,Math.max(l+Io,Vu)),c=Ji(a,s,d);return Rx(_u(r,o,n),_u(...c))>=wx?Qi(...c):i}function Ht(e,t){let r=wr(e);if(!r)return t;let[o,n,i]=r,[a,s,l]=Do(o,n,i);if(s===0)return t;let d=l>.5?Math.max(Fu,Math.min(l-Io,Hu)):Math.min(Wu,Math.max(l+Io,Vu));return Qi(...Ji(a,s,d))}function Go(e){let t=wr(e);return t?Do(...t)[2]>.5:!1}function Je(e,t){let r=wr(e);if(!r)return;let[o,n]=Do(...r);if(n!==0)return Qi(...Ji(o,n,t))}function F(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function vr(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function Pr(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:vx(e.geometry),detail:{of:"chartValue",series:e.valueReference.seriesId,valueIndex:e.valueReference.valueIndex},style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.color},strokeWidth:1}}}function vx(e){let{centerX:t,startY:r,endY:o}=e,n=t-5,i=t+5;return`M ${t} ${r} L ${t} ${o} M ${n} ${r} L ${i} ${r} M ${n} ${o} L ${i} ${o}`}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var Fo=18,_o=e=>e.config;function re(e){return e.chartType==="bar"&&_o(e)?.orientation==="horizontal"}function Vt(e,t){let r=Re({series:e.series,config:_o(e)}),o=t.height/r,n=Math.min(Math.max(0,p(_o(e)?.barGroupGap,8)),Math.max(0,o-1)),i=e.categoryAlign==="left"?Fo:0,a=Math.max(1,o-n-i),s=p(_o(e)?.barThickness,0),l=s>0?Math.min(a,s):a;return{count:r,slotHeight:o,groupGap:n,labelRow:i,barsHeight:l,offset:(a-l)/2}}function Wt(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function _e(e){return Math.min(90,Math.max(0,p(e.axisLabelAngle,0)))}var Ho=e=>e*Math.PI/180;function ea(e){return Math.max(9,p(e.axisFontSize??e.fontSize,12))}function Lr(e,t,r){let o=ea(e),n=Math.max(0,...t.map(i=>he(i,o,!1)));return Math.ceil(n*Math.sin(Ho(r))+(o+2)*Math.cos(Ho(r)))}function ta(e,t,r,o){let n=ea(e),i=n+2,a=Math.ceil(he(t,n,!1))+4,s=Ho(r);return{frame:{x:o.x-i/2*Math.sin(s),y:o.y-i/2*Math.cos(s),width:a,height:i},rotation:-r}}function zt(e,t,r,o){let n=ea(e),i=n+2,a=Math.ceil(he(t,n,!1))+4,s=Ho(r);return{frame:{x:o.x-(a*Math.cos(s)+i/2*Math.sin(s)),y:o.y+a*Math.sin(s)-i/2*Math.cos(s),width:a,height:i},rotation:-r}}function Yt(e,t){return t>0?Te({points:e,tension:t,closed:!1}):`M ${e.map((o,n)=>`${n?"L":""} ${o.x} ${o.y}`).join(" ")}`}function Vo(e,t,r,o){let n=Math.max(1,Math.min(e,t)/2-4),i=Math.max(0,Math.min(r??0,n-1)),a=Math.max(0,Math.min(o??0,n/2)),s=Math.max(1,n-a),l=i>0?Math.min(i+a,s-1):0;return{outerRadius:s,innerRadius:l,cornerRadius:a}}function Q(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function Mr(e,t,r,o){let n=t.x-e.x,i=t.y-e.y,a=0,s=1;if(Math.abs(n)>1e-6){let d=(t.x-r-e.x)/n,c=(t.x+r-e.x)/n;a=Math.max(a,Math.min(d,c)),s=Math.min(s,Math.max(d,c))}if(Math.abs(i)>1e-6){let d=(t.y-o-e.y)/i,c=(t.y+o-e.y)/i;a=Math.max(a,Math.min(d,c)),s=Math.min(s,Math.max(d,c))}let l=a<=s?a:1;return{x:e.x+l*n,y:e.y+l*i}}function jt(e,t){return Math.abs(t-e)>Math.PI?1:0}function ut(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function zu(e,t){return{start:e.start+t,end:e.end-t}}function mt(e,t,r){if(e<=0)return 0;let o=Math.min(Math.abs(t)/2,Math.PI/2),n=Math.sin(o);return n<=1e-6?r:Math.min(e/n,r)}function Px(e,t,r){let o=Q(e,t.start,e.outerRadius),n=Q(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${jt(t.start,t.end)} 1 ${n.x} ${n.y}`,"Z"].join(" ")}function Lx(e,t,r,o){let n=Q(e,r.start,e.outerRadius),i=Q(e,r.end,e.outerRadius),a=Q(e,o.end,t),s=Q(e,o.start,t);return[`M ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${jt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${jt(o.start,o.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Yu=.82;function Ut(e,t,r,o,n,i){let a=Math.min(1,n/r),s=o+i*Math.asin(a),l=Math.sqrt(Math.max(0,r*r-n*n));return{lineTangent:{x:e.centerX+l*Math.cos(o),y:e.centerY+l*Math.sin(o)},arcTangent:Q(e,s,t),angle:s}}function Tr(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*Yu),i=e*n/(1+n),a=t>0?t*n:Number.POSITIVE_INFINITY,s=t>0?(e-t)/2:e/2;return Math.max(0,Math.min(i,a,s))}function $r(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*Yu),i=e*n/(1+n),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function Mx(e,t,r,o){let{outerRadius:n}=e,i=n-r,a=Ut(e,n,i,t.start,r,1),s=Ut(e,n,i,t.end,r,-1);return[`M ${o.x} ${o.y}`,`L ${a.lineTangent.x} ${a.lineTangent.y}`,`A ${r} ${r} 0 0 1 ${a.arcTangent.x} ${a.arcTangent.y}`,`A ${n} ${n} 0 ${jt(a.angle,s.angle)} 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${r} ${r} 0 0 1 ${s.lineTangent.x} ${s.lineTangent.y}`,"Z"].join(" ")}function Tx(e,t,r,o,n){let{outerRadius:i}=e,a=i-n,s=Ut(e,i,a,r.start,n,1),l=Ut(e,i,a,r.end,n,-1),d=t+n,c=Ut(e,t,d,o.start,n,1),u=Ut(e,t,d,o.end,n,-1);return[`M ${s.lineTangent.x} ${s.lineTangent.y}`,`A ${n} ${n} 0 0 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${i} ${i} 0 ${jt(s.angle,l.angle)} 1 ${l.arcTangent.x} ${l.arcTangent.y}`,`A ${n} ${n} 0 0 1 ${l.lineTangent.x} ${l.lineTangent.y}`,`L ${u.lineTangent.x} ${u.lineTangent.y}`,`A ${n} ${n} 0 0 1 ${u.arcTangent.x} ${u.arcTangent.y}`,`A ${t} ${t} 0 ${jt(u.angle,c.angle)} 0 ${c.arcTangent.x} ${c.arcTangent.y}`,`A ${n} ${n} 0 0 1 ${c.lineTangent.x} ${c.lineTangent.y}`,"Z"].join(" ")}function Xt(e,t,r){let o=Math.max(0,r)/2,n=mt(o,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=n}function pt(e,t,r=0,o=0){let n=Math.max(0,o)/2,i=zu(t,ut(n,e.outerRadius));if(!Xt(e,t,o)){let s=mt(n,t.end-t.start,e.outerRadius),l=Q(e,(t.start+t.end)/2,s);return r>0?Mx(e,i,r,l):Px(e,i,l)}let a=zu(t,ut(n,e.innerRadius));return r>0?Tx(e,e.innerRadius,i,a,r):Lx(e,e.innerRadius,i,a)}function je(e,t,r,o,n,i,a){let s=t==="horizontal",l=s?e.width:e.height,d=Math.max(1,(l-o*(r-1))/r),c=Math.min(r,Math.max(0,i*r)),u=a?Math.round(c):c,m=[];for(let f=0;f<r;f++){let h=Math.min(1,Math.max(0,u-f))*d;if(h<.5)continue;let y=f*(d+o);m.push(s?Ge(e.x+y,e.y,h,e.height,n):Ge(e.x,e.y+e.height-y-h,e.width,h,n))}return m.join(" ")}function H(e){if(!e?.enabled)return;let t=p(e.angle,45)*Math.PI/180,r=p(e.distance,5);return{color:e.color??"#000000",opacity:p(e.opacity,.25),blur:p(e.blur,10),dx:Math.cos(t)*r,dy:Math.sin(t)*r}}function Ar(e,t,r,o,n){let i=e.series[o].values[r]??0;return t==="waterfall"?$x(e,r,o,n,i):t==="percent"?Ax(e,r,o,n,i):Ex(e,r,o,n,i)}function $x(e,t,r,o,n){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return Uu(n,i,i+n,e,o)}function Ax(e,t,r,o,n){let i=e.series.reduce((l,d)=>l+Math.abs(d.values[t]??0),0)||1,a=0;for(let l=0;l<r;l++)a+=Math.abs(e.series[l].values[t]??0);let s=Math.abs(n);return{value:n,pixelStart:a/i*o,pixelEnd:(a+s)/i*o}}function Ex(e,t,r,o,n){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return Uu(n,i,i+n,e,o)}function Uu(e,t,r,o,n){return{value:e,pixelStart:T(t,o.axisY,n),pixelEnd:T(r,o.axisY,n)}}function L(e){let{chart:t,frame:r}=e;return{type:"text",id:e.id,order:e.order,bounds:e.bounds,...r,lines:[e.text],fontFamily:(e.role==="axis"?t.axisFontFamily:void 0)??t.fontFamily??B,fontSize:Math.max(9,p(e.role==="axis"?t.axisFontSize??t.fontSize:t.fontSize,12)),fontWeight:"normal",color:(e.role==="axis"?t.axisLabelColor:e.role==="legend"?t.legendColor:void 0)??t.textColor??"#0f172a",align:e.align??"left",verticalAlign:"top",lineHeight:1.2,rotation:e.rotation,rotationCenter:e.rotation?{x:r.x,y:r.y}:void 0}}var Nx=/^[A-Za-z_][A-Za-z0-9_]*$/;function qt(e,t,r){return Nx.test(t)?`${e}[${t}].${r}`:void 0}var ju="text";function ra(e){return`Axis[${e}].label`}function Er(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function Ee(e){return qt("Series",e,"label")}function Xu(e){return qt("Series",e,"color")}function ue(e,t){return Number.isInteger(t)&&t>=0?qt("Series",e,`values[${t}]`):void 0}function Kt(e,t){return Number.isInteger(t)&&t>=0?qt("Series",e,`colors[${t}]`):void 0}function qu(e){return qt("Rule",e,"text")}function Ku(e){return qt("Rule",e,"at")}function Ox(e,t,r){return e.axisX.label?{...L({role:"axis",id:`chart-x-label-${e.id}`,order:r,bounds:t.bounds,frame:{x:t.plot.x,y:e.y+e.height-18,width:t.plot.width,height:18},text:e.axisX.label,chart:e,align:"center"}),prop:ra("x")}:null}function Bx(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...L({role:"axis",id:`chart-y-label-${e.id}`,order:r,bounds:t.bounds,frame:{x:e.x+12,y:t.plot.y+t.plot.height,width:t.plot.height,height:18},text:e.axisY.label,chart:e,align:"center",rotation:-90}),prop:ra("y")}}function Zu(e,t,r){let o=[],n=Ox(e,t,r);n&&o.push(n);let i=Bx(e,t,r+o.length);return i&&o.push(i),o}function Qu(e,t,r){let o=Math.max(1,e.series.length),n=t.plot.height/o;return e.series.map((i,a)=>{let s=t.plot.y+(a+.5)*n;return{...L({role:"axis",id:`chart-y-tick-${e.id}-${a}`,order:r+a,bounds:t.bounds,frame:{x:e.x,y:s-9,width:t.padLeft-8,height:18},text:i.label||i.id,chart:e,align:"right"}),prop:Ee(i.id)}})}var Ix=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function Ju(e){return Dx(e.chart)?Vx(e).flatMap(t=>Wx(e,t)):[]}function Dx(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!Ix.has(e.chartType)&&!t}function oa(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var na=22,Wo=16;function ia(e){return e==="bottomLeft"||e==="bottomRight"}function aa(e){return oa(e).map(t=>Math.max(42,t.label.length*p(e.fontSize,12)*.58+22))}function em(e){let t=aa(e);return t.length?Math.max(...t):0}function Gx(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function _x(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function Fx(e){let{chart:t,plot:r,order:o}=e,n=oa(t),i=aa(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-Wo-a:r.x+r.width+Wo,l=r.y+r.height-15;return n.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(n.length-1-c)*na,width:i[c],order:o+(n.length-1-c)*2}))}function Hx(e){let{chart:t,plot:r,order:o}=e,n=oa(t),i=aa(t),a=i.reduce((d,c)=>d+c,0),s=_x(t,r),l=Gx(t,r,a);return n.map((d,c)=>{let u=i[c],m=l;return l+=u,{series:d,seriesIndex:c,x:m,y:s,width:u,order:o+(n.length-1-c)*2}})}function Vx(e){return ia(e.chart.legendPosition)?Fx(e):Hx(e)}function Wx(e,t){return[zx(e,t),Yx(e,t)]}function zx(e,t){let{chart:r,bounds:o,diagnostics:n}=e,i=E[t.seriesIndex%E.length],a=r.chartType==="line",s=a?F(t.series.color,i):t.series.color??i;return{type:"rect",id:`chart-legend-swatch-${r.id}-${t.series.id}`,order:t.order,bounds:o,x:t.x,y:t.y,width:10,height:10,rx:3,prop:Xu(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:P(s,n,r.id)}}}function Yx(e,t){let{chart:r,bounds:o}=e;return{...L({role:"legend",id:`chart-legend-${r.id}-${t.series.id}`,order:t.order+1,bounds:o,frame:{x:t.x+15,y:t.y-3,width:t.width-15,height:18},text:t.series.label,chart:r}),prop:Ee(t.series.id)}}var rm=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),Ux=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Xe(e){return!Ux.has(e.chartType)}function om(e){return Xe(e)?Math.max(0,p(e.tickLength,0)):0}function et(e){return om(e)+(Xe(e)?Math.max(0,p(e.xLabelGap,0)):0)}function la(e){return om(e)+(Xe(e)?Math.max(0,p(e.yLabelGap,0)):0)}function sa(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function jx(e){let t=p(e.fontSize,12);return Math.max(0,...e.series.map(o=>(o.label||o.id).length))*t*.58+16}var tm=66;function Xx(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function qx(e){let t=p(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(o=>o.length))*t*.58+16}function Kx(e){return e.axisLabelSpace&&e.axisLabelSpace>0&&(sa(e)||re(e))?e.axisLabelSpace:sa(e)?jx(e):re(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:qx(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function Zx(e){let t=_e(e);if(t<=0)return 0;let r=e.chartType==="bar"&&!re(e)?e.config?.categories??[]:e.chartType==="boxplot"&&!sa(e)?e.series.map(o=>o.label||o.id):[];return r.length>0?Math.max(0,Lr(e,r,t)-18):0}function nm(e){let t=e.showAxisLabels!==!1,r=e.showLegend!==!1,o=e.legendPosition??"top",n=o==="top",i=r&&e.series.length>0,a=i&&ia(o),s=a?em(e)+Wo:0,l=Xx(e,r),d=et(e),u=la(e)+(t?Kx(e):12)+(o==="bottomLeft"?s:0)+(l==="left"?tm:0),m=24+(o==="bottomRight"?s:0)+(l==="right"?tm:0),f=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",h=re(e)&&e.showValueAxis!==!1,y=t?re(e)?h?34:12:(e.axisX.label?52:34)+(f?18:0):12,x=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,b=i&&!n&&!a,C=d+y+(t?Zx(e):0)+(x?44:0)+(b?16+na:0),w=(e.title?Math.max(44,20+p(e.titleSize,14)*1.6):0)||(n&&i?44:24);return{bounds:de({x:e.x,y:e.y,width:e.width,height:e.height},p(e.strokeWidth,1)+2),plot:{x:e.x+u,y:e.y+w,width:Math.max(1,e.width-u-m),height:Math.max(1,e.height-w-C)},showLabels:t,showLegend:r,padLeft:u}}function Qx(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,o)=>String(o+1))}function im(e,t,r){let o=Re(e),n=t.plot.width/o,i=Qx(e,o),a=!!e.config?.categories?.length,s=_e(e),l=e.categoryAlign==="left",d=l?Math.min(Math.max(0,p(e.config?.barGroupGap,8)),Math.max(0,n-1)):0;return Array.from({length:o},(c,u)=>{let m=t.plot.x+(u+.5)*n;if(s>0){let f=i[u]??String(u+1),{frame:h,rotation:y}=zt(e,f,s,{x:m,y:t.plot.y+t.plot.height+4+et(e)});return{...L({role:"axis",id:`chart-x-tick-${e.id}-${u}`,order:r+u,bounds:t.bounds,frame:h,text:f,chart:e,align:"right",rotation:y}),prop:a?Er(u):void 0}}return{...L({role:"axis",id:`chart-x-tick-${e.id}-${u}`,order:r+u,bounds:t.bounds,frame:{x:l?t.plot.x+u*n+d/2:m-n/2,y:t.plot.y+t.plot.height+4+et(e),width:l?n-d:n,height:18},text:i[u]??String(u+1),chart:e,align:l?"left":"center"}),prop:a?Er(u):void 0}})}function am(e,t,r){let o=Math.max(1,e.series.length),n=t.plot.width/o,i=_e(e);return e.series.map((a,s)=>{let l=t.plot.x+(s+.5)*n;if(i>0){let d=a.label||a.id,{frame:c,rotation:u}=zt(e,d,i,{x:l,y:t.plot.y+t.plot.height+4+et(e)});return{...L({role:"axis",id:`chart-x-tick-${e.id}-${s}`,order:r+s,bounds:t.bounds,frame:c,text:d,chart:e,align:"right",rotation:u}),prop:Ee(a.id)}}return{...L({role:"axis",id:`chart-x-tick-${e.id}-${s}`,order:r+s,bounds:t.bounds,frame:{x:l-n/2,y:t.plot.y+t.plot.height+4+et(e),width:n,height:18},text:a.label||a.id,chart:e,align:"center"}),prop:Ee(a.id)}})}function sm(e,t,r){return U(e.axisX).map((o,n)=>{let i=t.plot.x+T(o,e.axisX,t.plot.width);return L({role:"axis",id:`chart-x-tick-${e.id}-${o}`,order:r+n,bounds:t.bounds,frame:{x:i-20,y:t.plot.y+t.plot.height+10+et(e),width:40,height:18},text:String(o),chart:e,align:"center"})})}function lm(e,t,r){return U(e.axisY).map((o,n)=>{let i=t.plot.y+t.plot.height-T(o,e.axisY,t.plot.height);return L({role:"axis",id:`chart-y-tick-${e.id}-${o}`,order:r+n,bounds:t.bounds,frame:{x:e.x,y:i-6,width:t.padLeft-14-la(e),height:18},text:String(o),chart:e,align:"right"})})}function da(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Jx(e,t,r){return e.chartType==="bar"?im(e,t,r):e.chartType==="boxplot"&&!da(e)?am(e,t,r):sm(e,t,r)}function eS(e,t,r){return da(e)?Qu(e,t,r):e.showValueAxis===!1?[]:lm(e,t,r)}function tS(e,t){let{plot:r}=t;if(e.chartType==="bar"){let o=Re(e);return Array.from({length:o},(n,i)=>r.x+(i+.5)*r.width/o)}return U(e.axisX).map(o=>r.x+T(o,e.axisX,r.width))}function rS(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function oS(e,t,r){let o=p(e.axisLineWidth,0),n=p(e.tickLength,0);if(o<=0&&n<=0)return[];let{plot:i,bounds:a}=t,s=i.y+i.height,l={fill:{kind:"none"},stroke:{kind:"solid",color:e.axisLineColor??e.gridColor??"#94a3b8"},strokeWidth:o>0?o:1,pointerEvents:"none",...rS(e,o>0?o:1)},d=[],c=(u,m)=>d.push({type:"path",id:`chart-axis-${u}-${e.id}`,order:r+d.length,bounds:a,d:m,style:l});if(o>0&&(e.showValueAxis!==!1&&c("line-y",`M ${i.x} ${i.y} L ${i.x} ${s}`),c("line-x",`M ${i.x} ${s} L ${i.x+i.width} ${s}`)),n>0&&re(e)){U(e.axisY).forEach(m=>{let f=i.x+T(m,e.axisY,i.width);c(`tick-v-${m}`,`M ${f} ${s} L ${f} ${s+n}`)});let u=Vt(e,i);for(let m=0;m<u.count;m++){let f=Wt(u,i,m)+u.labelRow+u.barsHeight/2;c(`tick-c-${m}`,`M ${i.x-n} ${f} L ${i.x} ${f}`)}}return n>0&&!da(e)&&!re(e)&&(U(e.axisY).forEach(u=>{let m=s-T(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-n} ${m} L ${i.x} ${m}`)}),tS(e,t).forEach((u,m)=>{c(`tick-x-${m}`,`M ${u} ${s} L ${u} ${s+n}`)})),d}function nS(e,t){let r=e.config?.categories;return Array.from({length:t},(o,n)=>r?.[n]??String(n+1))}function iS(e,t,r){let{plot:o,bounds:n}=t,i=Vt(e,o),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=nS(e,i.count).map((c,u)=>{let m=Wt(i,o,u);return{...L({role:"axis",id:`chart-y-category-${e.id}-${u}`,order:r+u,bounds:n,frame:a?{x:o.x,y:m,width:o.width,height:i.labelRow}:s?{x:o.x+14,y:m+i.barsHeight/2-9,width:o.width-28,height:18}:{x:e.x+8,y:m+i.barsHeight/2-9,width:o.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?Er(u):void 0}});return e.showValueAxis!==!1&&U(e.axisY).forEach((c,u)=>{let m=o.x+T(c,e.axisY,o.width);d.push(L({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+i.count+u,bounds:n,frame:{x:m-20,y:o.y+o.height+4+p(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function dm(e,t,r){if(!Xe(e))return[];let o=oS(e,t,r);if(!t.showLabels)return o;if(r+=o.length,re(e))return[...o,...iS(e,t,r)];let n=Jx(e,t,r),i=eS(e,t,r+n.length),a=Zu(e,t,r+n.length+i.length);return[...o,...n,...i,...a]}function cm(e,t,r,o){let n=0,i=0;for(let a of e){let s=a.x-t,l=a.y-r,d=s*s+l*l;if(d===0)return a.value;let c=1/d**(o/2);n+=c*a.value,i+=c}return i===0?0:n/i}var ca=32;function Nr(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function um(e,t,r,o){let n=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(ca,Math.round(Math.sqrt(ca*ca*n)))),a=Math.max(2,Math.round(i/n)),s=new Float32Array(i*a);for(let l=0;l<a;l++){let d=r*(l/(a-1));for(let c=0;c<i;c++){let u=t*(c/(i-1));s[l*i+c]=e.length?cm(e,u,d,o):0}}return{grid:s,cols:i,rows:a}}var mm=new Set(["scatter","custom","hexbin"]);var pm=-Math.PI/2,aS=.5,sS=6;function lS(e){return Math.max(38,e*3.2)}function zo(e,t,r,o=!0){let n=o?lS(r):sS;return Math.max(8,Math.min(e,t)/2-n)}function Yo(e,t){return Math.max(3,e||t)}function dS(e,t){return pm+t*Math.PI*2/e}function ua(e,t,r){let o=t===e?0:(r-e)/(t-e);return pm+o*Math.PI*2}function fm(e,t,r){let o=dS(e.count,t);return{x:e.centerX+Math.cos(o)*r,y:e.centerY+Math.sin(o)*r}}function hm(e,t){let r=e.max-e.min;return(r===0?0:Math.max(0,Math.min(1,(t-e.min)/r)))*e.radius}function Uo(e,t,r=aS){return e.length===0?"":t?Te({points:e,tension:r,closed:!0}):`M ${e.map((n,i)=>`${i?"L ":""}${n.x} ${n.y}`).join(" ")} Z`}function jo(e,t,r,o,n,i,a,s){let l=Math.max(1,a*1.5),d={fill:{kind:"solid",color:e.gridColor??"#e2e8f0"},clip:s};if(e.gridRoundedCorners===!0)return{type:"ellipse",id:t,order:r,bounds:o,cx:n,cy:i,rx:l,ry:l,style:d};let c=l*2;return{type:"rect",id:t,order:r,bounds:o,x:n-l,y:i-l,width:c,height:c,style:d}}function Or(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function gm(e,t,r,o){let n=t.x+t.width/2,i=t.y+t.height/2,a=Math.max(0,Math.min(t.width,t.height)/2),s=p(e.gridWidth,1);if(e.gridLineStyle==="dotted")return cS(e,r,o,n,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...Or(e,s)},d=[];return U(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*ym(e,c);d.push({type:"ellipse",id:`chart-grid-ring-${e.id}-${c}`,order:o+d.length,bounds:r,cx:n,cy:i,rx:u,ry:u,style:l})}),U(e.axisX).forEach(c=>{let u=ua(e.axisX.min,e.axisX.max,c),m=n+Math.cos(u)*a,f=i+Math.sin(u)*a;d.push({type:"path",id:`chart-grid-spoke-${e.id}-${c}`,order:o+d.length,bounds:r,d:`M ${n} ${i} L ${m} ${f}`,style:l})}),d}function cS(e,t,r,o,n,i,a){let s=U(e.axisY).filter(c=>c>e.axisY.min),l=U(e.axisX),d=[];return s.forEach(c=>{let u=i*ym(e,c);l.forEach(m=>{let f=ua(e.axisX.min,e.axisX.max,m),h=o+Math.cos(f)*u,y=n+Math.sin(f)*u,x=`chart-grid-dot-${e.id}-${m}-${c}`;d.push(jo(e,x,r+d.length,t,h,y,a,void 0))})}),d}function ym(e,t){let r=e.axisY.max-e.axisY.min;return r===0?0:Math.max(0,Math.min(1,(t-e.axisY.min)/r))}function Xo(e,t,r,o){if(e.showGrid===!1||!Xe(e))return[];if(e.gridShape==="circle"&&mm.has(e.chartType))return gm(e,t,r,o);let n=p(e.gridWidth,1);if(re(e))return uS(e,t,r,o,n);let i=e.chartType==="field"?Nr(e,t):void 0;if(e.gridLineStyle==="dotted")return mS(e,t,r,o,n,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:n,...Or(e,n),clip:i},s=[];return(e.gridAxes==="y"?[]:U(e.axisX)).forEach(l=>{let d=t.x+T(l,e.axisX,t.width);s.push({type:"path",id:`chart-grid-x-${e.id}-${l}`,order:o+s.length,bounds:r,d:`M ${d} ${t.y} L ${d} ${t.y+t.height}`,style:a})}),(e.gridAxes==="x"?[]:U(e.axisY)).forEach(l=>{let d=t.y+t.height-T(l,e.axisY,t.height);s.push({type:"path",id:`chart-grid-y-${e.id}-${l}`,order:o+s.length,bounds:r,d:`M ${t.x} ${d} L ${t.x+t.width} ${d}`,style:a})}),s}function uS(e,t,r,o,n){if(e.gridAxes==="y")return[];let i={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:n,...e.gridLineStyle==="dotted"?{dash:[.1,n*3],lineCap:"round"}:Or(e,n)};return U(e.axisY).map((a,s)=>{let l=t.x+T(a,e.axisY,t.width);return{type:"path",id:`chart-grid-x-${e.id}-${a}`,order:o+s,bounds:r,d:`M ${l} ${t.y} L ${l} ${t.y+t.height}`,style:i}})}function mS(e,t,r,o,n,i){let a=U(e.axisX),s=U(e.axisY),l=[];return a.forEach(d=>{let c=t.x+T(d,e.axisX,t.width);s.forEach(u=>{let m=t.y+t.height-T(u,e.axisY,t.height),f=`chart-grid-dot-${e.id}-${d}-${u}`;l.push(jo(e,f,o+l.length,r,c,m,n,i))})}),l}function bm(e){return e.chart.rules?.length?pS(e).flatMap(t=>fS(e,t)):[]}function pS(e){let t=e.order;return(e.chart.rules??[]).map(r=>{let o=t++,n=r.text?t++:void 0;return{rule:r,color:r.color||e.chart.strokeColor||"#475569",y:e.plot.y+e.plot.height-T(r.at,e.chart.axisY,e.plot.height),lineOrder:o,labelOrder:n}})}function fS(e,t){let r=[hS(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(gS(e,t)),r}function hS(e,t){return{type:"path",id:`chart-rule-${e.chart.id}-${t.rule.id}`,order:t.lineOrder,bounds:e.bounds,d:`M ${e.plot.x} ${t.y} L ${e.plot.x+e.plot.width} ${t.y}`,prop:Ku(t.rule.id),propKind:"value",style:{fill:{kind:"none"},stroke:{kind:"solid",color:t.color},strokeWidth:t.rule.strokeWidth??1,dash:t.rule.dash}}}function gS(e,t){let r=Math.max(9,p(e.chart.fontSize,12)-2);return{...L({id:`chart-rule-label-${e.chart.id}-${t.rule.id}`,order:t.labelOrder??t.lineOrder+1,bounds:e.bounds,frame:{x:e.plot.x+4,y:t.y-r-2,width:160,height:r+2},text:t.rule.text??"",chart:e.chart}),color:t.color,prop:qu(t.rule.id)}}function ma(e){let t=p(e.strokeWidth,1)/2;return{x:e.x+t,y:e.y+t,width:Math.max(1,e.width-t*2),height:Math.max(1,e.height-t*2),rx:Math.max(0,p(e.cornerRadius,12)-t)}}function xm(e,t,r){if(!e.fillImage)return[];let o=ma(e),n=[{type:"image",id:`chart-image-${e.id}`,order:r.next(),bounds:t,x:o.x,y:o.y,width:o.width,height:o.height,href:e.fillImage.url,style:{clip:{type:"rect",...o},pointerEvents:"none"}}];return e.fillImage.overlay&&n.push({type:"rect",id:`chart-image-overlay-${e.id}`,order:r.next(),bounds:t,x:o.x,y:o.y,width:o.width,height:o.height,rx:o.rx,style:{fill:{kind:"solid",color:e.fillImage.overlay},pointerEvents:"none"}}),n}function Zt(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=p(o.config?.barGlassBlur,0);if(a<=0||!o.fillImage)return[];let s=ma(o),l=[{type:"image",id:`chart-bar-glass-${o.id}-${t}`,order:i(),bounds:n,x:s.x,y:s.y,width:s.width,height:s.height,href:o.fillImage.url,style:{blur:a,saturate:p(o.config?.barGlassSaturation,1),clip:{type:"path",d:r},pointerEvents:"none"}}];return o.fillImage.overlay&&l.push({type:"path",id:`chart-bar-glass-overlay-${o.id}-${t}`,order:i(),bounds:n,d:r,style:{fill:{kind:"solid",color:o.fillImage.overlay},pointerEvents:"none"}}),o.config?.barGlassTint&&l.push({type:"path",id:`chart-bar-glass-tint-${o.id}-${t}`,order:i(),bounds:n,d:r,style:{fill:{kind:"solid",color:o.config.barGlassTint},pointerEvents:"none"}}),l.push(...Xo(o,e.plot,n,0).map(d=>({...d,id:`${d.id}-glass-${t}`,order:i(),style:{..."style"in d?d.style:{},clip:{type:"path",d:r},pointerEvents:"none"}}))),l}function Qt(e,t,r,o,n,i=e.bounds){let{chart:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:t,order:l(),bounds:i,d:r,style:{fill:P(o,s,a.id),shadow:{color:F(o,"#ffffff"),opacity:.9,blur:n,dx:0,dy:0},pointerEvents:"none"}}}function Jt(e){return e.chart.config?.showBarLabels===!0}function yS(e,t){let r=e.frame.height>=t.height+we.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function bS(e,t,r){return e==="outside"?t.y-r-we.gap:e==="inside"?t.y+we.gap:t.y+t.height/2-r/2}function xS(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=n.config;return{type:"path",id:`${t}-pill`,order:s(),bounds:i,d:Xi(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?P(l.barLabelPillColor,a,n.id):{kind:"none"},stroke:P(l?.barLabelBorderColor??o,a,n.id),strokeWidth:p(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function SS(e,t,r,o,n,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...L({id:t,order:d(),bounds:l,frame:{x:r.left,y:r.top+r.padY,width:r.width,height:r.lineHeight},text:o,chart:s,align:"center"}),mark:`bar-label|${n}|${c?.barLabelFormat??""}`,color:a,fontSize:i,fontFamily:c?.barLabelFontFamily??s.fontFamily??"Inter, sans-serif",fontWeight:c?.barLabelFontWeight??"normal"}}function CS(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=n.config,d=i.y+i.height+4+16+Math.max(0,n.tickLength??0);return{...L({id:t.id,order:s(),bounds:a,frame:t.horizontal?n.categoryAlign==="inside"?{x:i.x,y:t.frame.y+t.frame.height/2-o*.6,width:i.width-14,height:o*1.2}:{x:i.x,y:t.frame.y-Fo,width:i.width,height:o*1.2}:{x:t.frame.x,y:d,width:t.frame.width,height:o*1.2},text:r,chart:n,align:t.horizontal?"right":n.categoryAlign==="left"?"left":"center"}),mark:`bar-label|axis|${l?.barLabelFormat??""}`,color:l?.barLabelColor??n.textColor??"#0f172a",fontSize:o,fontFamily:l?.barLabelFontFamily??n.fontFamily??"Inter, sans-serif",fontWeight:l?.barLabelFontWeight??"normal"}}function kS(e,t){let r=e.placement==="axis"?"outside":e.placement,o=e.frame.width>=t.width+we.gap*2;return r!=="outside"&&!o?"outside":r}function RS(e,t,r){let{frame:o}=e,n=r==="outside"?o.x+o.width+we.gap:r==="inside"?o.x+o.width-t.width-we.gap:o.x+o.width/2-t.width/2;return{...t,left:n,top:o.y+o.height/2-t.height/2}}function er(e,t){let{chart:r}=e,o=r.config,n=Math.max(8,p(o?.barLabelFontSize,p(r.fontSize,12))),i=Ui(t.value,o?.barLabelFormat);if(t.placement==="axis")return[CS(e,t,i,n)];let a=o?.barLabelPill===!0,s=ji(i,n,a),l=t.horizontal?kS(t,s):yS(t,s),d=t.horizontal?RS(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:bS(l,t.frame,s.height)},c=o?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(xS(e,t.id,d,c)),u.push(SS(e,t.id,d,i,l,n,c)),u}var pa={angle:45,spacing:7,width:1.5},wS=2;function vS(e,t,r,o,n,i){let a=n*Math.PI/180,s={x:Math.cos(a),y:Math.sin(a)},l={x:-s.y,y:s.x},d={x:e+r/2,y:t+o/2},c=Math.hypot(r,o)/2,u=[];for(let m=-c;m<=c;m+=i){let f=d.x+l.x*m,h=d.y+l.y*m;u.push(`M ${f-s.x*c} ${h-s.y*c} L ${f+s.x*c} ${h+s.y*c}`)}return u.join(" ")}function tr(e,t){if(ft(e))return{type:"path",d:Ge(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function ft(e){return e.chart.config?.barTrack===!0}function rr(e,t,r,o="vertical"){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=n.config,d=l?.barCornerRadius??2,c=p(l?.barSegments,0),u=c>0?je(r,o,c,p(l?.barSegmentGap,4),d,1,!0):Ge(r.x,r.y,r.width,r.height,d),m=[{type:"path",id:`chart-bar-track-${n.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:P(l?.barTrackColor??n.gridColor??"#e2e8f0",a,n.id),pointerEvents:"none"}}];return l?.barTrackHatch&&m.push({type:"path",id:`chart-bar-track-hatch-${n.id}-${t}`,order:s(),bounds:i,d:vS(r.x,r.y,r.width,r.height,p(l.barTrackHatchAngle,pa.angle),Math.max(wS,p(l.barTrackHatchSpacing,pa.spacing))),style:{fill:{kind:"none"},stroke:P(l.barTrackHatchColor??n.gridColor??"#cbd5e1",a,n.id),strokeWidth:p(l.barTrackHatchWidth,pa.width),pointerEvents:"none",clip:{type:"path",d:u}}}),m}function Sm(e){let t=TS(e),r=e.chart.series.flatMap((a,s)=>$S(e,t,a,s)),o=ft(e)?r.flatMap(a=>rr(e,`${a.seriesId}-${a.valueIndex}`,{x:a.frame.x,y:e.plot.y,width:a.frame.width,height:e.plot.height})):[],n=r.flatMap(a=>AS(e,a)),i=Jt(e)?r.flatMap(a=>LS(e,a,r)):[];return[...o,...n,...r.flatMap(a=>MS(e,a)),...i]}function PS(e,t){let r=t.filter(o=>o.seriesId===e.seriesId).map(o=>o.value);return e.value>=Math.max(...r)}function LS(e,t,r){let{chart:o}=e;return o.config?.barLabelMaxOnly&&!PS(t,r)?[]:er(e,{id:`chart-bar-label-${o.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:o.config?.barLabelPosition??"outside"})}function Cm(e,t){let{chart:r,plot:o}=e,n=r.config,i=n?.barCornerRadius??2,a=p(n?.barSegments,0);return a>0?je({x:t.x,y:o.y,width:t.width,height:o.height},"vertical",a,p(n?.barSegmentGap,4),i,t.height/o.height,n?.barSegmentSnap!==!1):ct(t.x,t.y,t.width,t.height,i,n?.barRoundedBottom===!0)}function MS(e,t){let{chart:r}=e,o=p(r.config?.barGlow,0);if(o<=0||t.frame.height<=0)return[];let n=Cm(e,t.frame);return[Qt(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,n,t.color,o)]}function TS(e){let{chart:t,plot:r}=e,o=Re(t),n=r.width/o,i=Math.min(Math.max(0,p(t.config?.barGroupGap,8)),Math.max(0,n-1)),a=Math.max(0,p(t.config?.barGap,2));return{slotWidth:n,seriesWidth:Math.max(1,(n-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function $S(e,t,r,o){let{chart:n,plot:i}=e,a=r.color??E[o%E.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,T(d,n.axisY,i.height));return{seriesId:r.id,valueIndex:l,value:d,error:r.error?.[l],color:r.colors?.[l]??a,hasColorOverride:r.colors?.[l]!=null,frame:{x:i.x+l*t.slotWidth+t.groupGap/2+o*t.seriesWidth,y:i.y+i.height-c,width:Math.max(1,t.seriesWidth-t.barGap),height:c}}})}function AS(e,t){let r=NS(e,t),o=OS(e,t);return o&&r.push(o),r}function ES(e){let{x:t,y:r,width:o,height:n}=e;return`M ${t} ${r} H ${t+o} V ${r+n} H ${t} Z`}function NS(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e,s=r.config?.barCornerRadius??2,{x:l,width:d}=t.frame,c=Cm(e,t.frame),u=P(t.color,i,r.id),m=P(r.config?.barBorderColor||"#000000",i,r.id),f=p(r.config?.barBorderWidth,0),h=H(r.shadowStyle),y=h?{type:"path",id:`chart-bar-shadow-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:n,d:c,style:{fill:u,stroke:m,strokeWidth:f,shadow:h,clip:tr(e,{x:l,y:o.y,width:d,height:o.height})??{type:"path",d:ES(o)}}}:void 0,x={type:"path",id:`chart-bar-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:n,d:c,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex,mark:"bar",radius:s,colorProp:Kt(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:ue(t.seriesId,t.valueIndex),style:{fill:u,stroke:m,strokeWidth:f,innerShadow:h}},b=Zt(e,`${t.seriesId}-${t.valueIndex}`,c);return y?[y,...b,x]:[...b,x]}function OS(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=vr(t.value,t.error);return Pr({id:`chart-bar-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:n,geometry:{centerX:t.frame.x+t.frame.width/2,startY:o.y+o.height-T(a,r.axisY,o.height),endY:o.y+o.height-T(s,r.axisY,o.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function BS(e,t,r,o,n){let{chart:i,plot:a}=e,s=Wt(t,a,o)+t.labelRow;if(e.stackedMode){let u=Ar(i,e.stackedMode,o,r,a.width),m=Math.min(u.pixelStart,u.pixelEnd);return{x:a.x+m,y:s,width:Math.max(1,Math.abs(u.pixelEnd-u.pixelStart)),height:t.barsHeight}}let l=Math.max(0,p(i.config?.barGap,2)),d=t.barsHeight/Math.max(1,i.series.length),c=Math.max(0,T(n,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function IS(e,t){let{chart:r,plot:o}=e,n=r.config,i=e.stackedMode&&r.series.length>1?0:p(n?.barSegments,0);return i>0?je({x:o.x,y:t.y,width:o.width,height:t.height},"horizontal",i,p(n?.barSegmentGap,4),n?.barCornerRadius??2,t.width/o.width,n?.barSegmentSnap!==!1):Ge(t.x,t.y,t.width,t.height,n?.barCornerRadius??2)}function DS(e,t,r,o,n,i){let{plot:a}=e,s=BS(e,t,o,n,i);return{id:`${r.id}-${n}`,series:r,seriesIndex:o,valueIndex:n,value:i,frame:s,trackFrame:{x:a.x,y:s.y,width:a.width,height:s.height},bounds:{minX:s.x,maxX:s.x+Math.max(s.width,1),minY:s.y,maxY:s.y+s.height},path:IS(e,s),color:r.colors?.[n]??r.color??E[o%E.length]}}function GS(e,t){let{chart:r,diagnostics:o,nextOrder:n}=e,i=r.config,a=P(i?.barBorderColor||"#000000",o,r.id),s=p(i?.barBorderWidth,0),l=H(r.shadowStyle),d=P(t.color,o,r.id),c=[...Zt(e,t.id,t.path)];return l&&c.push({type:"path",id:`chart-bar-shadow-${r.id}-${t.id}`,order:n(),bounds:t.bounds,d:t.path,style:{fill:d,stroke:a,strokeWidth:s,shadow:l,clip:tr(e,t.trackFrame)}}),c.push({type:"path",id:`chart-bar-${r.id}-${t.id}`,order:n(),bounds:t.bounds,d:t.path,detail:{of:"chartValue",series:t.series.id,valueIndex:t.valueIndex,mark:"bar",radius:i?.barCornerRadius??2,colorProp:Kt(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function _S(e,t,r){let{chart:o}=e,n=o.config,i=Jt(e)&&(!n?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===o.series.length-1;return!i||e.stackedMode&&!a&&n?.barLabelPosition==="outside"?[]:er(e,{id:`chart-bar-label-${o.id}-${t.id}`,value:t.value,frame:t.frame,placement:n?.barLabelPosition??"outside",horizontal:!0})}function FS(e,t,r,o,n,i,a,s){let{chart:l}=e,d=DS(e,t,o,n,i,a);ft(e)&&(!e.stackedMode||n===0)&&r.tracks.push(...rr(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...GS(e,d));let c=p(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(Qt(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(..._S(e,d,s))}function km(e){let t=Vt(e.chart,e.plot),r={tracks:[],bars:[],glows:[],labels:[]};return e.chart.series.forEach((o,n)=>{let i=o.values.map(s=>typeof s=="number"?s:s[1]),a=Math.max(...i);i.forEach((s,l)=>{FS(e,t,r,o,n,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function HS(e,t){let{chart:r,plot:o}=e,n=o.width/Re(r),i=Math.min(Math.max(0,p(r.config?.barGroupGap,8)),Math.max(0,n-1));return{slotWidth:n,groupGap:i,barWidth:Math.max(1,n-i),cornerRadius:r.config?.barCornerRadius??2,outerSeriesIndex:t==="waterfall"?null:r.series.length-1}}function VS(e,t,r,o,n,i){let{chart:a,plot:s}=e,l=a.series.length===1?p(a.config?.barSegments,0):0;return l>0?je({x:t,y:s.y,width:n.barWidth,height:s.height},"vertical",l,p(a.config?.barSegmentGap,4),i,o/s.height,a.config?.barSegmentSnap!==!1):ct(t,r,n.barWidth,o,i,a.config?.barRoundedBottom===!0)}function WS(e,t,r,o,n,i,a){let{chart:s}=e,l=s.config;if(!(Jt(e)&&!(l?.barLabelMaxOnly&&!jS(r.values,n))&&(l?.barLabelPosition!=="axis"||o===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[n];t.labels.push(...er(e,{id:`chart-bar-label-${s.id}-${r.id}-${n}`,value:Array.isArray(u)?u[1]:u??0,frame:a,placement:c==="outside"&&o!==i.outerSeriesIndex?"center":c}))}function zS(e,t,r,o,n,i){let{chart:a,plot:s}=e,l=Ar(a,t,i,n,s.height),d=r.outerSeriesIndex===null||n===r.outerSeriesIndex?r.cornerRadius:0,c=s.x+i*r.slotWidth+r.groupGap/2,u=s.y+s.height-Math.max(l.pixelStart,l.pixelEnd),m=Math.max(1,Math.abs(l.pixelEnd-l.pixelStart));return{series:o,valueIndex:i,radius:d,color:o.colors?.[i]??o.color??E[n%E.length],x:c,y:u,height:m,path:VS(e,c,u,m,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function YS(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=P(t.color,i,r.id),u=P(r.config?.barBorderColor||"#000000",i,r.id),m=p(r.config?.barBorderWidth,0),f=H(r.shadowStyle),h=[];if(f){let y=`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`;h.push({type:"path",id:`chart-bar-shadow-${r.id}-${s.id}-${l}`,order:a(),bounds:n,d,style:{fill:c,stroke:u,strokeWidth:m,shadow:f,clip:tr(e,t.column)??{type:"path",d:y}}})}return h.push(...Zt(e,`${s.id}-${l}`,d)),h.push({type:"path",id:`chart-bar-${r.id}-${s.id}-${l}`,order:a(),bounds:n,d,detail:{of:"chartValue",series:s.id,valueIndex:l,mark:"bar",radius:t.radius,colorProp:Kt(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:ue(s.id,l),style:{fill:c,stroke:u,strokeWidth:m,innerShadow:f}}),h}function US(e,t,r,o,n,i,a){let{chart:s}=e,l=zS(e,t,o,n,i,a);i===0&&ft(e)&&r.tracks.push(...rr(e,String(a),l.column)),r.bars.push(...YS(e,l));let d={x:l.x,y:l.y,width:o.barWidth,height:l.height};WS(e,r,n,i,a,o,d);let c=p(s.config?.barGlow,0);c>0&&r.glows.push(Qt(e,`chart-bar-glow-${s.id}-${n.id}-${a}`,l.path,l.color,c))}function Rm(e,t){let{chart:r}=e,o={tracks:[],bars:[],glows:[],labels:[]},n=HS(e,t),i=Re(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{US(e,t,o,n,s,l,a)});return[...o.tracks,...o.bars,...o.glows,...o.labels]}function jS(e,t){let r=e.map(o=>typeof o=="number"?o:o[1]);return r[t]>=Math.max(...r)}function wm(e){return re(e.chart)?km(e):e.stackedMode?Rm(e,e.stackedMode):Sm(e)}function vm(e){let{chart:t,plot:r}=e,o=t.config?.orientation??"vertical",n=Math.max(1,t.series.length),i=(o==="horizontal"?r.height:r.width)/n,a=F(t.config?.barBorderColor,"#000000"),s=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:o,slotWidth:i,boxWidth:Math.max(4,i*s),cornerRadius:t.config?.barCornerRadius??2,showPoints:t.config?.showBoxplotPoints??!0,borderColor:a,borderWidth:p(t.config?.barBorderWidth,1),whiskerWidth:Math.max(0,p(t.config?.boxWhiskerWidth,1)),medianWidth:Math.max(0,p(t.config?.boxMedianWidth,2)),medianColor:t.config?.boxMedianColor??a,whiskerColor:t.config?.boxWhiskerColor,capSize:Math.max(0,p(t.config?.boxCapSize,.4)),pointSize:Math.max(0,p(t.config?.boxPointSize,3)),pointOpacity:Math.min(1,Math.max(0,p(t.config?.boxPointOpacity,.7))),jitter:Math.max(0,p(t.config?.boxJitter,1))}}function ge(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function Pm(e,t,r,o){let{chart:n,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+T(d,n.axisX,i.width):i.y+i.height-T(d,n.axisY,i.height);return{center:i[a==="horizontal"?"y":"x"]+r*t.slotWidth+t.slotWidth/2,min:s(o.min),q1:s(o.q1),median:s(o.median),q3:s(o.q3),max:s(o.max)}}function Lm(e,t,r){let{chart:o,plot:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?n.x+T(d,o.axisX,n.width):n.y+n.height-T(d,o.axisY,n.height);return t.pointSize<=0?[]:r.series.values.map((d,c)=>{let u=r.geometry.center+XS(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:m,y:f}=ge(t.orientation,u,l(d));return{type:"ellipse",id:`chart-box-point-${r.id}-${c}`,order:s(),bounds:i,cx:m,cy:f,rx:t.pointSize,ry:t.pointSize,style:{fill:P(r.color,a,o.id),opacity:t.pointOpacity}}})}function XS(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function Tm(e,t,r){let o=t.whiskerWidth>0?[KS(t,r),ZS(t,r)]:[],n=t.whiskerWidth>0&&t.capSize>0?[QS(t,r),JS(t,r)]:[],i=t.medianWidth>0?[eC(t,r)]:[];return[...[...o,...n].map(a=>Mm(e,t,{...a,color:qS(t,r)})),tC(e,t,r),...i.map(a=>Mm(e,t,a))]}function qS(e,t){return e.whiskerColor==="series"?F(t.color,e.borderColor):e.whiskerColor}function KS(e,t){let{center:r,min:o,q1:n}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ge(e.orientation,r,o),to:ge(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function ZS(e,t){let{center:r,q3:o,max:n}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ge(e.orientation,r,o),to:ge(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function QS(e,t){return $m(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function JS(e,t){return $m(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function $m(e,t,r,o){let n=t.boxWidth*t.capSize/2;return{id:e,from:ge(t.orientation,r-n,o),to:ge(t.orientation,r+n,o),strokeWidth:t.whiskerWidth}}function eC(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ge(e.orientation,t.geometry.center-r,t.geometry.median),to:ge(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function Mm(e,t,r){return{type:"path",id:r.id,order:e.nextOrder(),bounds:e.bounds,d:`M ${r.from.x} ${r.from.y} L ${r.to.x} ${r.to.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.color??t.borderColor},strokeWidth:r.strokeWidth}}}function tC(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ge(t.orientation,s.center-l,s.q1),c=ge(t.orientation,s.center+l,s.q3),u=Math.min(d.x,c.x),m=Math.min(d.y,c.y),f=Math.max(1,Math.abs(c.x-d.x)),h=Math.max(1,Math.abs(c.y-d.y));return{type:"rect",id:`chart-box-${r.id}`,order:a(),bounds:n,x:u,y:m,width:f,height:h,rx:t.cornerRadius,style:{fill:P(r.color,i,o.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function Am(e,t,r,o){let n=Ki(r.values);if(!n)return[];let i=Pm(e,t,o,n),a=r.color??E[o%E.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:o,color:a,geometry:i},l=Tm(e,t,s);return t.showPoints&&l.push(...Lm(e,t,s)),l}function Em(e){let t=vm(e),r=[];return e.chart.series.forEach((o,n)=>{r.push(...Am(e,t,o,n))}),r}var rC="#94a3b8",Nm=8,fa=140;function Bm(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?aC(e):e.chart.series.flatMap((t,r)=>oC(e,t,r))}function oC(e,t,r){let o=nC(e,t,r);return ha(e,t).map((n,i)=>{let a=ga(e,n),s={series:t,valueIndex:i,point:a,style:o};return t.symbol?.points.length?iC(e,s):ya(e,s)})}function ba(e){return e.config?.orientation==="horizontal"}function ha(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(n=>[n[0],n[1]]):ba(r)?t.values.map((n,i)=>[n,r.axisY.min+i*r.axisY.step]):t.values.map((n,i)=>[r.axisX.min+i*r.axisX.step,n])}function Om(e,t){return ba(e)?t[0]:t[1]}function ga(e,t){return{x:e.plot.x+T(t[0],e.chart.axisX,e.plot.width),y:e.plot.y+e.plot.height-T(t[1],e.chart.axisY,e.plot.height)}}function nC(e,t,r){let o=t.color??E[r%E.length];return{fill:P(o,e.diagnostics,e.chart.id),stroke:t.stroke?{kind:"solid",color:t.stroke}:void 0,strokeWidth:t.stroke?p(t.strokeWidth,1):void 0}}function iC(e,t){let r=t.series.symbol,o=p(t.series.size,3),n=r?.normalized?o*2:1,i=r?.normalized?.5:0,a=(r?.points??[]).map(([s,l])=>({x:t.point.x+(s-i)*n,y:t.point.y+(l-i)*n}));return{type:"path",id:Im(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:Te({points:a,tension:p(r?.tension,0),closed:!0}),style:t.style}}function ya(e,t){let r=p(t.series.size,3);return{type:"ellipse",id:Im(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,cx:t.point.x,cy:t.point.y,rx:r,ry:r,style:t.style}}function Im(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function aC(e){let{chart:t}=e,[r,o]=t.series,n=ha(e,r),i=ha(e,o),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??K,c=!!t.config?.reverseComparison,u=Math.min(n.length,i.length),m=t.config?.categories??[],f=[];for(let h=0;h<u;h++){let y=n[h],x=i[h],b=ga(e,y),C=ga(e,x),S=Om(t,y),w=Om(t,x),O=c?w<S:w>S,A=c?w>S:w<S,_=O?s:A?l:d,G=p(o.size,3);f.push(lC(e,h,b,C,_)),f.push(ya(e,{series:r,valueIndex:h,point:b,style:{fill:P(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??rC},strokeWidth:p(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(ya(e,{series:o,valueIndex:h,point:C,style:{fill:P(_,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&m[h]&&f.push(dC(e,h,b,C,G,m[h]))}return f}function sC(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function lC(e,t,r,o,n){let{chart:i}=e;return{type:"path",id:`chart-custom-connector-${i.id}-${t}`,order:e.nextOrder(),bounds:e.bounds,d:`M ${r.x} ${r.y} L ${o.x} ${o.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:n},strokeWidth:p(i.config?.customConnectorWidth,2),opacity:i.config?.customConnectorOpacity,dash:sC(i.config?.customConnectorDash)}}}function dC(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,d=ba(a),c=d?{x:Math.max(r.x,o.x)+n+Nm,y:Math.min(r.y,o.y)-8,width:fa,height:16}:{x:Math.min(r.x,o.x)-fa/2,y:Math.min(r.y,o.y)-n-Nm-14,width:fa,height:16};return{...L({id:`chart-custom-label-${a.id}-${t}`,order:l(),bounds:s,frame:c,text:i,chart:a,align:d?"left":"center"}),fontSize:Math.max(6,p(a.config?.customLabelSize,Math.max(9,p(a.fontSize,12))-2)),...a.config?.customLabelColor?{color:a.config.customLabelColor}:{}}}function Gm(e){let{chart:t,plot:r}=e,o=t.series.filter(a=>Dm(a.values[0])===3),n=t.series.filter(a=>Dm(a.values[0])===4);return{scalarSamples:o.flatMap(a=>a.values.map(([s,l,d])=>({x:T(s,t.axisX,r.width),y:r.height-T(l,t.axisY,r.height),value:d}))),vectorSeries:n}}function Dm(e){return Array.isArray(e)?e.length:void 0}function _m(e){let t=e.chart.config?.scale?.stops;if(!e.showLegend||!t?.length)return[];let r=[...t].sort((a,s)=>a.position-s.position),o=r[0].position,n=r[r.length-1].position,i=cC(e);return[uC(e,r,o,n,i),...mC(e,o,n,i)]}function cC(e){let{plot:t}=e,r=Math.min(220,t.width);return{x:t.x+(t.width-r)/2,y:t.y+t.height+46,width:r,height:8}}function uC(e,t,r,o,n){let{chart:i,bounds:a,nextOrder:s}=e,l=o-r;return{type:"rect",id:`chart-field-colorbar-${i.id}`,order:s(),bounds:a,x:n.x,y:n.y,width:n.width,height:n.height,rx:2,style:{fill:{kind:"linear-gradient",angle:0,stops:t.map(d=>({offset:l===0?0:(d.position-r)/l*100,color:d.color}))}}}}function mC(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=o.y+o.height+3;return[L({id:`chart-field-colorbar-min-${n.id}`,order:a(),bounds:i,frame:{x:o.x,y:s,width:80,height:16},text:Ae(t),chart:n}),L({id:`chart-field-colorbar-max-${n.id}`,order:a(),bounds:i,frame:{x:o.x+o.width-80,y:s,width:80,height:16},text:Ae(r),chart:n,align:"right"})]}var pC="#94a3b8";function qo(e,t){return e?.stops.length?br(e.stops,t):pC}function Fm(e){if(e.length===0)return[];let t=s=>`${Math.round(s[0]*1e3)}:${Math.round(s[1]*1e3)}`,r=new Map,o=(s,l,d)=>{let c=t(s),u=r.get(c),m={point:l,segment:d};u?u.push(m):r.set(c,[m])};e.forEach((s,l)=>{let d=[s.x1,s.y1],c=[s.x2,s.y2];o(d,c,l),o(c,d,l)});let n=new Array(e.length).fill(!1),i=(s,l)=>{let d=l;for(;;){let u=r.get(t(d))?.find(m=>!n[m.segment]);if(!u)return;n[u.segment]=!0,s.push(u.point),d=u.point}},a=[];return e.forEach((s,l)=>{if(n[l])return;n[l]=!0;let d=[[s.x1,s.y1],[s.x2,s.y2]];i(d,d[d.length-1]);let c=[];i(c,d[0]),c.reverse(),a.push([...c,...d])}),a}function Hm(e,t){let r=[];for(let o=0;o<e.rows-1;o++)for(let n=0;n<e.columns-1;n++){let i=fC(e,o,n),a=hC(i,t);a!==0&&a!==15&&r.push(...gC(i,a,t))}return r}function fC(e,t,r){return{topLeft:Ko(e,t,r),topRight:Ko(e,t,r+1),bottomRight:Ko(e,t+1,r+1),bottomLeft:Ko(e,t+1,r)}}function Ko(e,t,r){return{x:e.width*(r/(e.columns-1)),y:e.height*(t/(e.rows-1)),value:e.values[t*e.columns+r]}}function hC(e,t){return(Zo(e.topLeft,t)?8:0)|(Zo(e.topRight,t)?4:0)|(Zo(e.bottomRight,t)?2:0)|(Zo(e.bottomLeft,t)?1:0)}function Zo(e,t){return e.value>=t}function gC(e,t,r){let o=yC(e,r);switch(t){case 1:case 14:return[Fe(o.left,o.bottom)];case 2:case 13:return[Fe(o.bottom,o.right)];case 3:case 12:return[Fe(o.left,o.right)];case 4:case 11:return[Fe(o.top,o.right)];case 5:return[Fe(o.left,o.top),Fe(o.bottom,o.right)];case 6:case 9:return[Fe(o.top,o.bottom)];case 7:case 8:return[Fe(o.left,o.top)];case 10:return[Fe(o.top,o.right),Fe(o.left,o.bottom)];default:return[]}}function yC(e,t){return{top:Qo(e.topLeft,e.topRight,t),right:Qo(e.topRight,e.bottomRight,t),bottom:Qo(e.bottomLeft,e.bottomRight,t),left:Qo(e.topLeft,e.bottomLeft,t)}}function Qo(e,t,r){let o=t.value===e.value?.5:(r-e.value)/(t.value-e.value);return[e.x+(t.x-e.x)*o,e.y+(t.y-e.y)*o]}function Fe(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var bC=.5;function Vm(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=xC(e,t);return[...SC(e,r),...kC(e,r)]}function xC(e,t){let{plot:r,chart:o}=e,n=um(t,r.width,r.height,o.config?.idwPower??2);return{values:n.grid,columns:n.cols,rows:n.rows,cellWidth:r.width/Math.max(1,n.cols-1),cellHeight:r.height/Math.max(1,n.rows-1)}}function SC(e,t){let r=[];for(let o=0;o<t.rows;o++)for(let n=0;n<t.columns;n++)r.push(CC(e,t,o,n));return r}function CC(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=i.x+i.width*(o/(t.columns-1)),d=i.y+i.height*(r/(t.rows-1)),c=qo(n.config?.scale,t.values[r*t.columns+o]);return{type:"rect",id:`chart-field-cell-${n.id}-${r}-${o}`,order:s(),bounds:a,x:l-t.cellWidth/2,y:d-t.cellHeight/2,width:t.cellWidth,height:t.cellHeight,style:{fill:{kind:"solid",color:c},clip:Nr(n,i)}}}function kC(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((o,n)=>{let i=RC(e,t,o,n);i&&r.push(i)}),r}function RC(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=Hm({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=Fm(l).map(u=>Yt(u.map(([m,f])=>({x:i.x+m,y:i.y+f})),bC)).join(" ");return{type:"path",id:`chart-field-isoline-${n.id}-${o}`,order:s(),bounds:a,d:c,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"rgba(15, 23, 42, 0.55)"},strokeWidth:1,clip:Nr(n,i)}}}function Wm(e,t){let r=[];return t.forEach((o,n)=>{let i=o.color??E[n%E.length];o.values.forEach((a,s)=>{r.push(wC(e,o.id,a,s,i))})}),r}function wC(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,m,f]=r,h=a.x+T(c,i.axisX,a.width),y=a.y+a.height-T(u,i.axisY,a.height),x=a.x+T(c+Math.cos(m)*f,i.axisX,a.width),b=a.y+a.height-T(u+Math.sin(m)*f,i.axisY,a.height);return{type:"path",id:`chart-field-vector-${i.id}-${t}-${o}`,order:d(),bounds:s,d:`M ${h} ${y} L ${x} ${b}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:P(n,l,i.id),strokeWidth:2}}}function zm(e){let t=Gm(e),r=[];return r.push(...Vm(e,t.scalarSamples)),r.push(...Wm(e,t.vectorSeries)),r.push(..._m(e)),r}function Ym(e,t){let r=[];return t.rows.forEach((o,n)=>{r.push(...vC(e,t,o,n))}),r}function vC(e,t,r,o){return t.columns.flatMap((n,i)=>{let a=PC(t,r,o,i);return MC(e,t,a)})}function PC(e,t,r,o){let n=t.values[o]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:o,value:n,color:LC(n,e),frame:{x:e.grid.x+o*e.grid.cellWidth+i/2,y:e.grid.y+r*e.grid.cellHeight+i/2,width:Math.max(0,e.grid.cellWidth-i),height:Math.max(0,e.grid.cellHeight-i)}}}function LC(e,t){return Rr(e,t.bands,t.zones)}function MC(e,t,r){let o=TC(e,t,r);return e.chart.config?.showValues===!1?[o]:[o,$C(e,t,r)]}function TC(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=`chart-heatmap-cell-${o.id}-${r.seriesId}-${r.columnIndex}`,s={fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:o.config?.cellStrokeColor??o.gridColor??"#e2e8f0"},strokeWidth:p(o.config?.cellStrokeWidth,p(o.gridWidth,1))};return o.config?.cellShape==="circle"?{type:"ellipse",id:a,order:i(),bounds:n,cx:r.frame.x+r.frame.width/2,cy:r.frame.y+r.frame.height/2,rx:r.frame.width/2,ry:r.frame.height/2,style:s}:{type:"rect",id:a,order:i(),bounds:n,...r.frame,rx:t.grid.cellRadius,style:s}}function $C(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=Math.max(6,p(o.config?.cellValueSize,t.fontSize));return{...L({id:`chart-heatmap-value-${o.id}-${r.seriesId}-${r.columnIndex}`,order:i(),bounds:n,frame:{x:r.frame.x,y:r.frame.y+r.frame.height/2-a/2,width:r.frame.width,height:a+2},text:String(r.value),chart:o,align:"center"}),...o.config?.cellValueSize===void 0?{}:{fontSize:a},color:o.config?.cellValueColor??ce(r.color)}}function Um(e){let{chart:t}=e,r=Xm(e),o=AC(e),n=OC(e,o);return{rows:t.series,columns:r,bands:kr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Cr,fontSize:Math.max(9,p(t.fontSize,12)),headerFontSize:xa(t),legendGap:jm(t),sides:o,reservedSpace:n,grid:IC(e,n,o,r.length)}}var xa=e=>Math.max(9,p(e.axisFontSize??e.fontSize,12)),Sa=e=>Math.min(120,Math.max(0,p(e.yLabelGap,6))),Jo=e=>Math.min(120,Math.max(0,p(e.xLabelGap,4))),jm=e=>Math.min(80,Math.max(0,p(e.legendGap,6)));function AC(e){let{chart:t}=e;return{rows:t.rowLabelSide==="right"?"right":"left",columns:t.columnLabelSide==="bottom"?"bottom":"top",legend:t.legendSide??"bottom"}}function Xm(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}var EC=32,NC=56;function OC(e,t){let{chart:r}=e,o=xa(r),n=r.series.reduce((a,s)=>Math.max(a,he(s.label??"",o,!1)),0),i=t.legend==="left"||t.legend==="right";return{rowHeaders:e.showLabels?Math.min(e.plot.width*.7,r.axisLabelSpace&&r.axisLabelSpace>0?r.axisLabelSpace:n+6+Sa(r)):0,columnHeaders:e.showLabels?BC(e):0,legend:e.showLegend?(i?NC:EC)+jm(r):0}}function BC(e){let{chart:t}=e,r=_e(t);return r>0?Math.min(e.plot.height*.4,Lr(t,Xm(e),r)+Jo(t)+4):xa(t)+2+Jo(t)+6}function IC(e,t,r,o){let{chart:n}=e,i=(r.rows==="left"?t.rowHeaders:0)+(r.legend==="left"?t.legend:0),a=(r.rows==="right"?t.rowHeaders:0)+(r.legend==="right"?t.legend:0),s=(r.columns==="top"?t.columnHeaders:0)+(r.legend==="top"?t.legend:0),l=(r.columns==="bottom"?t.columnHeaders:0)+(r.legend==="bottom"?t.legend:0),d=Math.max(1,e.plot.width-i-a),c=Math.max(1,e.plot.height-s-l),u=n.series.length,m=Math.max(0,p(n.config?.cellGap,0)),f=o?d/o:d,h=u?c/u:c,y=d,x=c;if(n.config?.squareCells&&o&&u){let b=Math.min(f,h);f=b,h=b,y=b*o,x=b*u}return{x:e.plot.x+i,y:e.plot.y+s,width:y,height:x,cellWidth:f,cellHeight:h,cellGap:m,cellRadius:Math.max(0,p(n.config?.barCornerRadius,m))}}function qm(e,t){return[...DC(e,t),..._C(e,t)]}function DC(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,o)=>GC(e,t,r,o))}function GC(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.reservedSpace.rowHeaders,l=Sa(n),d=t.sides.rows==="left"?t.grid.x-s:t.grid.x+t.grid.width+l;return L({id:`chart-heatmap-row-${n.id}-${r.id}`,order:a(),bounds:i,frame:{x:d,y:t.grid.y+o*t.grid.cellHeight+t.grid.cellHeight/2-t.headerFontSize/2,width:Math.max(1,s-l),height:t.headerFontSize+2},text:r.label,chart:n,align:n.axisLabelAlign??"left",role:"axis"})}function _C(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,o)=>FC(e,t,r,o))}function FC(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.sides.columns==="top",l=t.grid.x+(o+.5)*t.grid.cellWidth,d=_e(n),c=Jo(n),u=`chart-heatmap-col-${n.id}-${o}`;if(d>0){let{frame:m,rotation:f}=s?ta(n,r,d,{x:l,y:t.grid.y-c}):zt(n,r,d,{x:l,y:t.grid.y+t.grid.height+c});return L({id:u,order:a(),bounds:i,frame:m,text:r,chart:n,align:s?"left":"right",rotation:f,role:"axis"})}return L({id:u,order:a(),bounds:i,frame:{x:t.grid.x+o*t.grid.cellWidth,y:s?t.grid.y-c-(t.headerFontSize+2):t.grid.y+t.grid.height+c,width:t.grid.cellWidth,height:t.headerFontSize+2},text:r,chart:n,align:"center",role:"axis"})}var or=10,tt=4,en=2,Br=48;function HC(e){let{grid:t,sides:r,reservedSpace:o,legendGap:n}=e,i=o.rowHeaders,a=o.columnHeaders;switch(r.legend){case"top":{let s=t.y-(r.columns==="top"?a:0);return{x:t.x,y:s-n-or,width:t.width,height:or,vertical:!1,numbers:"top"}}case"left":return{x:t.x-(r.rows==="left"?i:0)-n-or,y:t.y,width:or,height:t.height,vertical:!0,numbers:"left"};case"right":return{x:t.x+t.width+(r.rows==="right"?i:0)+n,y:t.y,width:or,height:t.height,vertical:!0,numbers:"right"};default:{let s=t.y+t.height+(r.columns==="bottom"?a:0);return{x:t.x,y:s+n,width:t.width,height:or,vertical:!1,numbers:"bottom"}}}}function Km(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=HC(t),o=de({x:r.x,y:r.y,width:r.width,height:r.height});return[VC(e,t,r,o),...WC(e,t,r)]}function Zm(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function VC(e,t,r,o){let{chart:n,nextOrder:i}=e,a=Math.max(0,t.bands.length-1),l=t.zones.slice(0,a).map((d,c)=>({offset:Zm(t,t.bands[c+1]??t.bands[t.bands.length-1])*100,color:d.color??K}));return{type:"rect",id:`chart-heatmap-legend-bar-${n.id}`,order:i(),bounds:o,x:r.x,y:r.y,width:r.width,height:r.height,rx:3,zoneGradient:{axis:"y",min:n.axisY.min,max:n.axisY.max},style:{fill:l.length?{kind:"linear-gradient",angle:r.vertical?270:0,stops:l}:{kind:"solid",color:K},stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:1}}}function WC(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=t.fontSize+2,s=t.bands.length-1;return t.bands.flatMap((l,d)=>{let c=Zm(t,l),u=r.vertical?r.y+r.height-c*r.height:r.x+c*r.width,m=zC(r,u),f={type:"path",id:`chart-heatmap-legend-tick-${o.id}-${d}`,order:i(),bounds:n,d:m,style:{fill:{kind:"none"},stroke:{kind:"solid",color:o.gridColor??"#e2e8f0"},strokeWidth:1}},h=L({id:`chart-heatmap-legend-tick-label-${o.id}-${d}`,order:i(),bounds:n,...YC(r,u,d===0,d===s,a),text:Ae(l),chart:o});return[f,h]})}function zC(e,t){if(e.vertical){let n=e.numbers==="right"?e.x+e.width:e.x,i=e.numbers==="right"?n+tt:n-tt;return`M ${n} ${t} L ${i} ${t}`}let r=e.numbers==="bottom"?e.y+e.height:e.y,o=e.numbers==="bottom"?r+tt:r-tt;return`M ${t} ${r} L ${t} ${o}`}function YC(e,t,r,o,n){if(e.vertical){let s=e.numbers==="right";return{frame:{x:s?e.x+e.width+tt+en:e.x-tt-en-Br,y:t-n/2,width:Br,height:n},align:s?"left":"right"}}let i=e.numbers==="bottom"?e.y+e.height+tt+en:e.y-tt-en-n;return{frame:{x:r?t:o?t-Br:t-Br/2,y:i,width:Br,height:n},align:r?"left":o?"right":"center"}}function Qm(e){let t=Um(e),r=[];return r.push(...Ym(e,t)),r.push(...qm(e,t)),r.push(...Km(e,t)),r}function Ca(e,t){if(t<=0||e.length===0)return[];let r=t*1.5,o=t*Math.sqrt(3),n=new Map;for(let{x:i,y:a}of e){let s=Math.round(i/r),l=s%2!==0?o/2:0,d=Math.round((a-l)/o),c=`${s}:${d}`,u=n.get(c);u?u.count++:n.set(c,{cx:s*r,cy:d*o+l,count:1})}return[...n.values()]}function Jm(e){let t=new Map;for(let r of e.ids)t.set(r,0);for(let r=0;r<e.ids.size;r++){let o=!1;for(let n of e.links){let i=(t.get(n.source)??0)+1;i>(t.get(n.target)??0)&&(t.set(n.target,i),o=!0)}if(!o)break}return t}function ep(e,t){let r=new Map;for(let o of e){let n=t.get(o)??0,i=r.get(n)??[];i.push(o),r.set(n,i)}return r}function tp(e,t){let r=new Set(e.map(a=>a.id));for(let a of t)r.add(a.source),r.add(a.target);let o=new Map,n=new Map;for(let a of r)o.set(a,[]),n.set(a,[]);let i=t.filter(a=>r.has(a.source)&&r.has(a.target)&&a.value>0&&a.source!==a.target);for(let a of i)n.get(a.source)?.push(a),o.get(a.target)?.push(a);return{ids:r,links:i,incoming:o,outgoing:n}}function jC(e){let t=new Map;for(let r of e.ids){let o=(e.incoming.get(r)??[]).reduce((i,a)=>i+a.value,0),n=(e.outgoing.get(r)??[]).reduce((i,a)=>i+a.value,0);t.set(r,Math.max(o,n,1e-4))}return t}function XC(e,t,r,o){let n=1/0;for(let i of e.values()){let a=i.reduce((d,c)=>d+(t.get(c)??0),0),s=Math.max(0,i.length-1)*o,l=Math.max(1,r-s);a>0&&(n=Math.min(n,l/a))}return!Number.isFinite(n)||n<=0?1:n}function Ir(e,t,r,o=18){return t<=1?0:e*(r-o)/(t-1)}function rp(e,t,r,o=8){let n=ep(e.ids,t),i=jC(e),a=XC(n,i,r,o),s=new Map,l=new Map;for(let d of n.values()){let c=0;for(let u of d){let m=Math.max(2,(i.get(u)??0)*a);s.set(u,c),l.set(u,m),c+=m+o}}return{columns:t,y:s,heights:l,valueScale:a,columnCount:Math.max(1,...[...t.values()].map(d=>d+1))}}function op(e,t,r,o,n=18){let i=new Map,a=new Map;for(let s of e.ids)i.set(s,0),a.set(s,0);return e.links.map(s=>{let l=Math.max(.5,s.value*t.valueScale),d=o.get(s.source),c=o.get(s.target),u=(t.y.get(s.source)??0)+(d?.y??0),m=(t.y.get(s.target)??0)+(c?.y??0),f=i.get(s.source)??0,h=a.get(s.target)??0;return i.set(s.source,f+l),a.set(s.target,h+l),{source:s.source,target:s.target,value:s.value,color:s.color,x0:Ir(t.columns.get(s.source)??0,t.columnCount,r,n)+n+(d?.x??0),x1:Ir(t.columns.get(s.target)??0,t.columnCount,r,n)+(c?.x??0),sourceY0:u+f,sourceY1:u+f+l,targetY0:m+h,targetY1:m+h+l}})}function np(e,t,r,o,n,i=18){return[...t.ids].map(a=>{let s=e.find(c=>c.id===a),l=r.columns.get(a)??0,d=n.get(a);return{id:a,label:s?.label??a,color:s?.color,x:Ir(l,r.columnCount,o,i)+(d?.x??0),y:(r.y.get(a)??0)+(d?.y??0),width:i,height:r.heights.get(a)??2,column:l}})}function qC(e){let t=new Map;for(let r of e)(r.offsetX||r.offsetY)&&t.set(r.id,{x:r.offsetX??0,y:r.offsetY??0});return t}function Ra(e,t,r,o,n={nodeWidth:18,nodeGap:8}){let i=tp(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=Jm(i),s=rp(i,a,o,n.nodeGap),l=qC(e);return{nodes:np(e,i,s,r,l,n.nodeWidth),links:op(i,s,r,l,n.nodeWidth)}}function Dr(e,t){let r=KC(e,t);if(!r.length)return[];let o=[],n=r,i=t;for(;n.length;){let a=ZC(n,Math.min(i.width,i.height)),s=QC(a,i);o.push(...s.rectangles),n=n.slice(a.items.length),i=s.remainingBounds}return o}function KC(e,t){let r=e.filter(i=>i.value>0);if(!r.length||t.width<=0||t.height<=0)return[];let o=r.reduce((i,a)=>i+a.value,0);if(o<=0)return[];let n=t.width*t.height/o;return[...r].sort((i,a)=>a.value-i.value).map(i=>({item:i,area:i.value*n}))}function ZC(e,t){let r=[e[0]];for(let o=1;o<e.length;o++){let n=[...r,e[o]];if(ip(n,t)>ip(r,t))break;r.push(e[o])}return{items:r,area:r.reduce((o,n)=>o+n.area,0)}}function ip(e,t){let r=e.reduce((s,l)=>s+l.area,0);if(r<=0||t<=0)return 1/0;let o=e.map(s=>s.area),n=Math.max(...o),i=Math.min(...o),a=t*t;return Math.max(a*n/(r*r),r*r/(a*i))}function QC(e,t){return t.width>=t.height?JC(e,t):ek(e,t)}function JC(e,t){let r=t.height>0?e.area/t.height:0,o=t.y;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:t.x,y:o,width:r,height:s};return o+=s,l}),remainingBounds:{x:t.x+r,y:t.y,width:t.width-r,height:t.height}}}function ek(e,t){let r=t.width>0?e.area/t.width:0,o=t.x;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:o,y:t.y,width:s,height:r};return o+=s,l}),remainingBounds:{x:t.x,y:t.y+r,width:t.width,height:t.height-r}}}var tk=.15,rk=1/Math.sqrt(3);function ok(e,t,r){let o=[];for(let n=0;n<6;n++){let i=(-60+60*n)*Math.PI/180;o.push(`${n===0?"M":"L"} ${e+r*Math.cos(i)} ${t+r*Math.sin(i)}`)}return`${o.join(" ")} Z`}function ap(e){let{chart:t,plot:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??Yi),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*rk),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??tk)),m=H(t.shadowStyle),f=m?`M ${r.x} ${r.y} H ${r.x+r.width} V ${r.y+r.height} H ${r.x} Z`:void 0;return t.series.forEach((h,y)=>{let C=(h.values.length>0&&Array.isArray(h.values[0])?h.values:h.values.map((_,G)=>[t.axisX.min+G*t.axisX.step,_])).map(([_,G])=>({x:T(_,t.axisX,r.width),y:r.height-T(G,t.axisY,r.height)})),S=Ca(C,l),w=Math.max(1,...S.map(_=>_.count)),O=h.color??E[y%E.length],A=s?.scale;S.forEach((_,G)=>{let V=_.count/w,ve=A?qo(A,V):O;a.push({type:"path",id:`chart-hexbin-${t.id}-${h.id}-${G}`,order:i(),bounds:o,d:ok(r.x+_.cx,r.y+_.cy,d),style:{fill:P(ve,n,t.id),stroke:c>0?P(s?.hexStrokeColor??ve,n,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:A?void 0:Math.max(u,V),shadow:m,clip:f?{type:"path",d:f}:void 0}})})}),a}function ht(e,t){return t.values.length>0&&Array.isArray(t.values[0])?t.values:t.values.map((r,o)=>[e.axisX.min+o*e.axisX.step,r])}function gt(e,t){let{chart:r,plot:o}=e;return t.map(([n,i])=>({x:o.x+T(n,r.axisX,o.width),y:o.y+o.height-T(i,r.axisY,o.height)}))}function sp(e,t,r,o,n,i){let{chart:a,plot:s,nextOrder:l}=e,d=s.y+s.height,c=r[0],u=r[r.length-1],m=`${Yt(r,n)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(b=>b.y)),h=(Math.min(...r.map(b=>b.x))+Math.max(...r.map(b=>b.x)))/2,y=(d-f)/2,x={minX:h-y,maxX:h+y,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:x,d:m,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:Zi(o,i)},{offset:100,color:Zi(o,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function nk(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function ik(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e;return{type:"path",id:`chart-highlight-guide-${t.key}`,order:a(),bounds:n,d:`M ${t.point.x} ${t.point.y} V ${o.y+o.height}`,style:{fill:{kind:"none"},stroke:P(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function ak(e,t){let{chart:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=r.config?.lineGlow;return{type:"ellipse",id:`chart-highlight-${t.key}`,order:i(),bounds:o,cx:t.point.x,cy:t.point.y,rx:t.radius,ry:t.radius,style:{fill:P(t.color,n,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function sk(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=o.config,s=Math.max(9,o.fontSize??12),l=nk(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...L({id:`chart-highlight-label-${t.key}`,order:i(),bounds:n,frame:{x:t.point.x-d/2,y:t.point.y-t.radius-6-s*1.2,width:d,height:s*1.2},text:l,chart:o,align:"center"}),color:a?.highlightLabelColor??o.textColor??"#0f172a",fontWeight:"bold"}}function lp(e,t,r){let{chart:o}=e,n=o.config,i=n?.highlightPoints;if(!i?.length)return[];let a=ht(o,t),s=gt(e,a),l=[];for(let d of i){let c=d<0?s.length+d:d,u=s[c];if(!u)continue;let m={key:`${o.id}-${t.id}-${c}`,point:u,index:c,radius:n?.highlightSize??6,color:n?.highlightColor??r};n?.highlightGuide&&l.push(ik(e,m)),l.push(ak(e,m)),n?.highlightLabels&&l.push(sk(e,m,a[c][1]))}return l}function dp(e,t,r,o){return r.map((n,i)=>({seriesId:e.id,valueIndex:i,value:t[i][1],error:e.error?.[i],position:n,color:o}))}function cp(e,t){return t.flatMap(r=>lk(e,r))}function lk(e,t){let r=[],o=dk(e,t);return o&&r.push(o),r.push(ck(e,t)),r}function dk(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=vr(t.value,t.error);return Pr({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:n,geometry:{centerX:t.position.x,startY:o.y+o.height-T(a,r.axisY,o.height),endY:o.y+o.height-T(s,r.axisY,o.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function ck(e,t){let{chart:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=r.config,s=a?.pointSize??3,l=a?.pointStrokeWidth??0,d=s>0,c=a?.pointFill&&a.pointFill!=="series"?a.pointFill:t.color;return{type:"ellipse",id:`chart-point-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,cx:t.position.x,cy:t.position.y,rx:d?s:6,ry:d?s:6,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex},style:{fill:d?P(c,n,r.id):{kind:"none"},stroke:d&&l>0?P(t.color,n,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function up(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=i.config,u=t.color,m=u&&typeof u!="string"&&u.type==="gradient"?u:void 0,f=c?.lineGlow;return{type:"path",id:`chart-line-${i.id}-${t.id}`,order:d(),bounds:m?{minX:a.x,maxX:a.x+a.width,minY:a.y,maxY:a.y+a.height}:s,detail:{of:"chartSeries",series:t.id,lineTension:n||void 0},d:Yt(r,n),style:{fill:{kind:"none"},stroke:P(m??o,l,i.id),strokeWidth:t.strokeWidth??c?.lineWidth??2,dash:t.dash,lineCap:c?.lineWidth===void 0?void 0:"round",lineJoin:"round",shadow:f?{color:o,opacity:.9,blur:f,dx:0,dy:0}:H(i.shadowStyle)}}}function mp(e,t){return F(e.color,E[t%E.length])}function pp(e,t,r){let o=e.chart.config?.areaOpacity;if(o===void 0||o<=0)return[];let n=mp(t,r),i=e.chart.config?.lineTension??0,a=gt(e,ht(e.chart,t));return a.length>1?[sp(e,t,a,n,i,o)]:[]}function fp(e,t,r){let o=mp(t,r),n=e.chart.config?.lineTension??0,i=ht(e.chart,t),a=gt(e,i),s=[];a.length&&s.push(up(e,t,a,o,n));let l=dp(t,i,a,o);return s.push(...cp(e,l)),s.push(...lp(e,t,o)),s}function hp(e){let t=[];return e.chart.series.forEach((r,o)=>{t.push(...pp(e,r,o))}),e.chart.series.forEach((r,o)=>{t.push(...fp(e,r,o))}),t}var gp=[0,25,50,75,100];function yp(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...uk(e,t)),e.showLabels&&r.push(...mk(e,t)),r}function uk(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return gp.map(i=>{let a=bp(t,i);return{type:"path",id:`chart-mekko-grid-${r.id}-${i}`,order:n(),bounds:o,d:`M ${t.grid.x} ${a} L ${t.grid.x+t.grid.width} ${a}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:p(r.gridWidth,1)}}})}function mk(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e;return gp.map(a=>({...L({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:n,frame:{x:o.x,y:bp(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function bp(e,t){return e.grid.y+e.grid.height*(1-t/100)}function xp(e,t,r,o){if(!e.showLabels)return[];let n=fk(e,t,r,o);return e.chart.config?.showMekkoTotals===!1?[n]:[pk(e,t,r,o),n]}function pk(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e;return{...L({id:`chart-mekko-total-${n.id}-${r}`,order:s(),bounds:a,frame:{x:o.x,y:i.y,width:o.width,height:t.smallFontSize+2},text:String(o.total),chart:n,align:"center"}),fontSize:t.smallFontSize}}function fk(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,{label:s,width:l}=o;return{...L({id:`chart-mekko-col-label-${n.id}-${r}`,order:a(),bounds:i,frame:{x:o.x,y:t.grid.y+t.grid.height+4,width:l,height:t.smallFontSize*2+4},text:s,chart:n,align:"center"}),lines:De(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function Sp(e){let t=hk(e),r=e.showLabels?30:0,o=gk(e,r),n=Math.max(9,p(e.chart.fontSize,12)),i=Math.max(0,p(e.chart.config?.mekkoColumnGap,4)),a=Math.max(8,n-1);return{columns:yk(e,o,t,i),fontSize:n,smallFontSize:a,labelGutterWidth:r,columnGap:i,labelSize:Math.max(6,p(e.chart.config?.mekkoLabelSize,a)),valueSize:Math.max(6,p(e.chart.config?.mekkoValueSize,a)),grid:o}}function hk(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}function gk(e,t){let r=e.showLabels?18:0,o=e.showLabels?32:0;return{x:e.plot.x+t,y:e.plot.y+r,width:Math.max(1,e.plot.width-t),height:Math.max(1,e.plot.height-r-o)}}function yk(e,t,r,o){let n=r.map((d,c)=>e.chart.series.reduce((u,m)=>u+(m.values[c]??0),0)),i=n.reduce((d,c)=>d+c,0),a=Math.max(1,...n),s=Math.max(1,t.width-o*Math.max(0,r.length-1)),l=t.x;return r.map((d,c)=>{let u=n[c],m=i>0?u/i*s:s/r.length,f=e.chart.config?.mekkoVaryHeight?t.height*(u/a):t.height,h={label:d,total:u,x:l,y:t.y+t.height-f,width:m,height:f};return l+=m+o,h})}var bk=.15;function Cp(e,t,r){let n=e.chart.config?.showColumnBackdrop!==!1?[xk(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=Sk(e.chart.series,t,r),s=a.flatMap((l,d)=>Ck(e,t,l,i?a[d+1]?.color:void 0));return[...n,...s]}function xk(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=kp(e);return{type:"path",id:`chart-mekko-column-backdrop-${o.id}-${r}`,order:a(),bounds:n,d:Bo(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:P(o.gridColor??"#e2e8f0",i,o.id),opacity:bk}}}function kp(e){return Math.max(0,p(e.chart.config?.barCornerRadius,2))}function Sk(e,t,r){let o=[],n=t.columns[r],i=0;return e.forEach((a,s)=>{let l=a.values[r]??0,d=(n.total>0?l/n.total:0)*n.height,c=n.y+i;i+=d;let u=a.color??E[s%E.length];o.push({columnIndex:r,seriesId:a.id,seriesLabel:a.label,value:l,color:u,isTop:s===0,frame:{x:n.x,y:c,width:n.width,height:d}})}),o}function Ck(e,t,r,o){return[kk(e,r,o),...Rk(e,t,r)]}function kk(e,t,r){let{chart:o,plot:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=H(o.shadowStyle),d=l?`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`:void 0,c=o.config,u=t.isTop||c?.mekkoRoundAll?kp(e):0,{x:m,y:f,width:h,height:y}=t.frame,x=Math.max(0,p(c?.mekkoSegmentGap,0)),b="#94a3b8",C={minX:m+h/2-y/2,maxX:m+h/2+y/2,minY:f,maxY:f+y},S=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:F(t.color,b)},{offset:100,color:F(r,b)}]}:P(t.color,a,o.id);return{type:"path",id:`chart-mekko-seg-${o.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?C:i,d:ct(m,f+x/2,h,Math.max(0,y-x),u,!!c?.mekkoRoundAll),style:{fill:S,stroke:{kind:"solid",color:c?.mekkoSegmentStrokeColor??o.gridColor??"#e2e8f0"},strokeWidth:p(c?.mekkoSegmentStrokeWidth,p(o.gridWidth,1)),shadow:l,clip:d?{type:"path",d}:void 0}}}function Rk(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,{x:a,y:s,width:l,height:d}=r.frame;if(!e.showLegend||l<34)return[];let c=Math.max(1,l-8),u=Math.max(1,d-6),m=t.labelSize*1.2,f=t.valueSize*1.2,h=De(r.seriesLabel,c,t.labelSize).map(w=>$o(w,c,t.labelSize,!0));if(h.length*m+f>u)return[];let y=o.config?.mekkoTextColor??ce(F(r.color,"#ffffff")),x=t.columns[r.columnIndex]?.total??0,b=o.config?.mekkoValueFormat==="percent"?`${x>0?Math.round(r.value/x*100):0}%`:String(r.value),C={...L({id:`chart-mekko-seg-label-${o.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:n,frame:{x:a+4,y:s+3,width:c,height:u},text:r.seriesLabel,chart:o}),lines:h,fontSize:t.labelSize,fontWeight:"bold",color:y},S={...L({id:`chart-mekko-seg-value-${o.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:n,frame:{x:a+4,y:s+3+h.length*m,width:c,height:Math.max(1,u-h.length*m)},text:b,chart:o}),lines:[b],fontSize:t.valueSize,color:y};return[C,S]}function Rp(e){let t=Sp(e),r=yp(e,t);return t.columns.forEach((o,n)=>{r.push(...Cp(e,t,n)),r.push(...xp(e,t,n,o))}),r}function wk(e,t){let r=t.series.map(i=>Math.max(0,p(i.values[0],0))),o=r.reduce((i,a)=>i+a,0),n=r[0]??0;return e.replace(/\{total\}/g,String(Math.round(o*100)/100)).replace(/\{percent\}/g,String(o>0?Math.round(n/o*100):0)).replace(/\{label\}/g,t.series[0]?.label??"")}function wp(e,t){let{chart:r,bounds:o,nextOrder:n}=e,i=r.config?.pieCenterText;if(!i)return[];let a=wk(i,r).split(/\\n|\n/),s=p(r.config?.pieCenterSize,Math.max(14,Math.min(40,t.outerRadius*.3))),l=s*1.2,d=Math.max(40,(t.innerRadius>0?t.innerRadius:t.outerRadius*.6)*2);return[{type:"text",id:`chart-pie-center-${r.id}`,order:n(),bounds:o,x:t.centerX-d/2,y:t.centerY-l*a.length/2,width:d,height:l*a.length,lines:a,fontFamily:r.fontFamily??B,fontSize:s,fontWeight:"bold",align:"center",verticalAlign:"middle",lineHeight:1.2,color:r.config?.pieCenterColor??r.textColor??"#0f172a",detail:{of:"chartSeries",series:r.series[0]?.id??"",mark:"pie-center"}}]}function vp(e){let{chart:t,plot:r}=e,o=Vo(r.width,r.height,t.config?.innerRadius,t.config?.pieCornerRadius),i=t.config?.pieLabelPosition==="outside"&&t.showAxisLabels!==!1?t.config?.pieLabelContent==="inline"?.6:.7:1,a=o.outerRadius*i,s=o.innerRadius*i,l=o.cornerRadius;return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,outerRadius:a,innerRadius:s,cornerRadius:l,total:t.series.reduce((d,c)=>d+Math.max(0,p(c.values[0],0)),0)||1}}var vk=14*Math.PI/180,Gr=80,Pk=.62,Lk=14,Mk=3,Tk=.32,Pp="#334155";function Tp(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(o=>o.end-o.start>=vk).flatMap(o=>$k(e,t,o))}function Lp(e,t,r,o,n,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=n*1.2,m=l.config?.pieLabelContent??"both",f=m==="inline"?Gr*1.9:Gr,h={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??B,fontSize:n,align:"center",verticalAlign:"middle",lineHeight:1.2,color:o},y=C=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...C}),x={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...h,y:m==="name"?r.y-u/2:r.y-u,lines:[m==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:y({}),prop:Ee(t.seriesId)},b={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...h,y:m==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:y({}),prop:ue(t.seriesId,0),propKind:"value"};return m==="inline"||m==="name"?[x]:m==="percent"?[b]:[x,b]}function Mp(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e;return{type:"path",id:`chart-pie-label-tick-${a.id}-${t.seriesId}`,order:l(),bounds:s,d:`M ${r.x} ${r.y} L ${o.x} ${o.y}`,detail:{of:"chartSeries",series:t.seriesId,mark:"pie-label-tick"},style:i?{stroke:{kind:"solid",color:n},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function $k(e,t,r){let o=e.chart.config,n={...t,centerX:t.centerX+r.shift.dx,centerY:t.centerY+r.shift.dy},i=(r.start+r.end)/2,a=Math.max(9,p(e.chart.fontSize,12)),s=Math.round(r.share*100),l=a*1.2,d=Q(n,i,n.outerRadius+Mk),c=n.outerRadius-n.innerRadius,u=c<l*2+6,m=r.labelOffsetX!==0||r.labelOffsetY!==0,f=o?.pieLabelPosition??"auto";if(m||f==="outside"||f==="auto"&&u){let w=m?Ak(Q(n,i,n.outerRadius),r.labelOffsetX,r.labelOffsetY):Q(n,i,n.outerRadius+Lk+(f==="outside"?Math.abs(Math.cos(i))*(o?.pieLabelContent==="inline"?Gr*.95:Gr/2):0)),O=Mr(d,w,Gr/2,l),A=o?.pieLabelColor??Je(F(r.color,Pp),Tk)??Pp;return[Mp(e,r,d,O,A,!0),...Lp(e,r,w,A,a,s,!0,i)]}let y=n.innerRadius+c*Pk,x=Q(n,i,y),b=F(r.color,"#0f172a"),C=o?.pieLabelColor??Ht(b,ce(b));return[Mp(e,r,d,d,C,!1),...Lp(e,r,x,C,a,s,!1,i)]}function Ak(e,t,r){return{x:e.x+t,y:e.y+r}}var Ek=-Math.PI/2,va=Math.PI*2,Nk=va*(359.999/360),wa=e=>e*Math.PI/180;function $p(e,t){let r=e.chart.config,o=Bk(e.chart.series,t.total,{start:Ek+wa(p(r?.pieStartAngle,0)),sweep:Math.min(va,Math.max(wa(1),wa(p(r?.pieSweep,360)))),explode:Math.max(0,p(r?.pieExplode,0))}),n=r?.pieSliceGap??0;return[...o.flatMap(i=>Fk(e,Ok(t,i),i,n)),...Tp(e,t,o.map(i=>({seriesId:i.seriesId,label:i.label,color:i.color,share:i.share,start:i.angles.start,end:i.angles.end,labelOffsetX:i.labelOffsetX,labelOffsetY:i.labelOffsetY,shift:Ap(i)})))]}function Ap(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function Ok(e,t){if(t.explode===0)return e;let{dx:r,dy:o}=Ap(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+o}}function Bk(e,t,r){let o=[],n=r.start;return e.forEach((i,a)=>{let s=Math.max(0,p(i.values[0],0)),l=s/t*r.sweep;o.push({seriesId:i.id,label:i.label,color:i.color??E[a%E.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:n,end:n+Math.min(l,r.sweep>=va?Nk:r.sweep)},explode:Math.max(0,p(i.offset,r.explode)),labelOffsetX:p(i.labelOffsetX,0),labelOffsetY:p(i.labelOffsetY,0)}),n+=l}),o}function Ik(e,t,r){return`M ${e-r} ${t} A ${r} ${r} 0 1 0 ${e+r} ${t} A ${r} ${r} 0 1 0 ${e-r} ${t} Z`}function Dk(e,t){if(t<=0)return e;let r=t/2,o=Math.min(e.blur,r*2),n=r,i=Math.hypot(e.dx,e.dy),a=i>n?n/i:1;return{...e,blur:o,dx:e.dx*a,dy:e.dy*a}}function Gk(e,t,r){let o=Math.max(0,r)/2,n=t.angles.end-t.angles.start,i=Xt(e,t.angles,r),a=2*ut(o,e.outerRadius),s=Math.max(0,n-a);return Math.min(e.cornerRadius,i?Tr(e.outerRadius,e.innerRadius,s):$r(e.outerRadius,mt(o,n,e.outerRadius),s))}function _k(e,t){let r=e.chart.config,o=t.stroke??r?.pieStroke;return o?{stroke:{kind:"solid",color:o},strokeWidth:p(t.strokeWidth,p(r?.pieStrokeWidth,1))}:{}}function Fk(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=P(r.color,a,n.id),d=pt(t,r.angles,Gk(t,r,o),o),c=H(n.shadowStyle),u=_k(e,r),m=n.config?.pieGlow,f=c?{type:"path",id:`chart-pie-slice-shadow-${n.id}-${r.seriesId}`,order:s(),bounds:i,d,style:{fill:l,...u,shadow:Dk(c,o),clip:{type:"path",d:Ik(t.centerX,t.centerY,t.outerRadius)}}}:void 0,h={type:"path",id:`chart-pie-slice-${n.id}-${r.seriesId}`,order:s(),bounds:i,d,detail:{of:"chartValue",series:r.seriesId,valueIndex:0,mark:"pie-slice",pieStart:r.angles.start,pieEnd:r.angles.end,pieValue:r.value},prop:ue(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:m?{color:F(r.color,"#ffffff"),opacity:.85,blur:m,dx:0,dy:0}:void 0}};return f?[f,h]:[h]}function Ep(e){let t=vp(e);return[...$p(e,t),...wp(e,t)]}var Hk=-Math.PI/2,Vk="#e2e8f0",Wk=14*Math.PI/180,tn=80,zk=.62,Yk=14,Uk=3,jk=.32,Np="#334155";function Xk(e){let{chart:t,plot:r}=e,o=Math.max(1,Math.min(r.width,r.height)/2-4),n=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,maxRadius:o,innerRadius:Math.max(0,Math.min(p(t.config?.innerRadius,0),o-1)),cornerRadius:Math.max(0,p(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,p(t.config?.pieSliceGap,0)),axisMin:n,range:p(t.axisY.max,100)-n,sweep:t.series.length>0?Math.PI*2/t.series.length:0,start:Hk+p(t.config?.pieStartAngle,0)*Math.PI/180}}function Op(e,t,r){let{centerX:o,centerY:n,innerRadius:i,cornerRadius:a,gapPx:s}=e,l={centerX:o,centerY:n,outerRadius:t,innerRadius:i},d=Math.max(0,s)/2,c=r.end-r.start,u=Math.max(0,c-2*ut(d,t));if(Xt(l,r,s))return Math.min(a,Tr(t,i,u));let m=mt(d,c,t);return Math.min(a,$r(t,m,u))}function qk(e,t,r,o,n,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:m,innerRadius:f,maxRadius:h,gapPx:y}=t,x=P(a,d,s.id),b=H(s.shadowStyle),C=pt({centerX:u,centerY:m,outerRadius:h,innerRadius:f},o,Op(t,h,o),y),S={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:C,style:{fill:P(s.gridColor??Vk,d,s.id),opacity:s.config?.polarTrackOpacity,...Kk(e)}},w=pt({centerX:u,centerY:m,outerRadius:n,innerRadius:f},o,Op(t,n,o),y),O=b?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:w,style:{fill:x,shadow:b,clip:{type:"path",d:C}}}:void 0,A={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:w,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:o.start,pieEnd:o.end,pieValue:i},prop:ue(r.id,0),style:{fill:x,innerShadow:b,...Zk(e)}};return O?[S,O,A]:[S,A]}function Kk(e){let t=e.chart.config;if(!t?.polarTrackStroke)return{};let r=(t.polarTrackDash??"").split(/[ ,]+/).map(Number).filter(o=>Number.isFinite(o)&&o>0);return{stroke:{kind:"solid",color:t.polarTrackStroke},strokeWidth:p(t.polarTrackStrokeWidth,1),dash:r.length>0?r:void 0}}function Zk(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:p(t.pieStrokeWidth,1)}:{}}function Qk(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return!r.config?.polarRings||t.range<=0?[]:U(r.axisY).filter(i=>i>t.axisMin&&i<t.axisMin+t.range).map(i=>{let a=t.innerRadius+(t.maxRadius-t.innerRadius)*(i-t.axisMin)/t.range;return{type:"ellipse",id:`chart-polar-area-ring-${r.id}-${i}`,order:n(),bounds:o,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.textColor??"#334155"},strokeWidth:p(r.gridWidth,1),opacity:.25}}})}function Bp(e){let t=Xk(e),{centerX:r,centerY:o,innerRadius:n,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=Wk;return[...e.chart.series.flatMap((m,f)=>{let h={start:d+f*l,end:d+(f+1)*l},y=Math.max(0,p(m.values[0],0)),x=s>0?Math.min(1,Math.max(0,(y-a)/s)):0,b=Math.max(n+1,n+(i-n)*x),C=m.color??E[f%E.length],S=qk(e,t,m,h,b,y,C);if(!c)return S;let w={centerX:r,centerY:o,outerRadius:b,innerRadius:n};return[...S,...eR(e,w,h,m,y,C)]}),...Qk(e,t)]}function Ip(e){let t=Math.max(9,p(e.fontSize,12));return{nameSize:Math.max(6,p(e.config?.polarNameSize,t)),valueSize:Math.max(6,p(e.config?.polarValueSize,t))}}function Jk(e,t,r,o,n){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=Ip(e.chart),l=(a+s)*1.2/2,d=t.outerRadius-t.innerRadius,c=p(o.labelOffsetX,0),u=p(o.labelOffsetY,0),m=c!==0||u!==0,f=d<l*2+6,h=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),y=!f&&h>=tn,x=e.chart.config?.polarOutsideLabels??!1;if(!y&&!m&&!x)return;let b=m||!y,C=Q(t,i,t.outerRadius+Uk),S=b?m?tR(Q(t,i,t.outerRadius),c,u):Q(t,i,t.outerRadius+Yk):Q(t,i,t.innerRadius+d*zk),w=b?x&&e.chart.textColor?e.chart.textColor:Je(F(n,Np),jk)??Np:Ht(F(n,"#0f172a"),ce(F(n,"#0f172a")));return{point:S,color:w,outside:b,mid:i,tickStart:C}}function eR(e,t,r,o,n,i){let a=Jk(e,t,r,o,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:m,mid:f,tickStart:h}=a,{nameSize:y,valueSize:x}=Ip(s),b=Math.max(y,x)*1.2,C=m?Mr(h,c,tn/2,b):h,S={type:"path",id:`chart-polar-area-label-tick-${s.id}-${o.id}`,order:d(),bounds:l,d:`M ${h.x} ${h.y} L ${C.x} ${C.y}`,detail:{of:"chartSeries",series:o.id,mark:"polar-area-label-tick"},style:m?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},w={of:"chartSeries",series:o.id,mark:"polar-area-label",pulled:m||void 0,midAngle:f,wedgeRadius:t.outerRadius},O={bounds:l,x:c.x-tn/2,width:tn,fontFamily:s.fontFamily??B,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},A=s.config?.polarValueFirst??!1,_=y*1.2,G=x*1.2,V=c.y-(_+G)/2,ve=A?V+G:V,le=A?V:V+_,Pe={type:"text",id:`chart-polar-area-label-name-${s.id}-${o.id}`,order:d(),...O,y:ve,height:y*1.2,fontSize:y,lines:[o.label],fontWeight:A?"normal":"bold",detail:w,prop:Ee(o.id)},oe={type:"text",id:`chart-polar-area-label-value-${s.id}-${o.id}`,order:d(),...O,y:le,height:x*1.2,fontSize:x,lines:[Ae(n)],fontWeight:A?"bold":"normal",detail:w,prop:ue(o.id,0),propKind:"value"};return[S,Pe,oe]}function tR(e,t,r){return{x:e.x+t,y:e.y+r}}var rR=["Speed","Quality","Cost","Reliability","Usability"];function oR(e){let{chart:t,plot:r}=e,o=(t.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...t.series.map(i=>i.values.length));return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,radius:zo(r.width,r.height,p(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Yo(o,n),curved:t.chartType==="radial",tension:t.config?.radarTension}}function Dp(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],o=oR(e),n=nR(r,o.count),i=(a,s)=>fm(o,s,a);return{circular:o.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),strokeWidth:Math.max(0,t.config?.radarStrokeWidth??2),tension:o.tension,pointSize:Math.max(0,t.config?.radarPointSize??3),showSpokes:t.config?.radarSpokes??!0,categories:n,centerX:o.centerX,centerY:o.centerY,radius:o.radius,radiusForValue:a=>hm(o,a),pointAt:i,polygonPath:a=>Uo(n.map((s,l)=>i(a,l)),!1)}}function nR(e,t){return Array.from({length:t},(r,o)=>e[o]??rR[o]??`Category ${o+1}`)}function Gp(e,t){return e.chart.showGrid===!1?[]:[...iR(e,t),...t.showSpokes?sR(e,t):[]]}function iR(e,t){return U(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>aR(e,t,r))}function aR(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=t.radiusForValue(r),s={fill:{kind:"none"},stroke:{kind:"solid",color:o.gridColor??"#e2e8f0"},strokeWidth:p(o.gridWidth,1)};return t.circular?{type:"ellipse",id:`chart-radial-ring-${o.id}-${r}`,order:i(),bounds:n,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:s}:{type:"path",id:`chart-radar-ring-${o.id}-${r}`,order:i(),bounds:n,d:t.polygonPath(a),style:s}}function sR(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return t.categories.map((i,a)=>{let s=t.pointAt(t.radius,a);return{type:"path",id:`chart-radar-spoke-${r.id}-${a}`,order:n(),bounds:o,d:`M ${t.centerX} ${t.centerY} L ${s.x} ${s.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:p(r.gridWidth,1)}}})}function _p(e,t){return e.showLabels?t.categories.map((r,o)=>lR(e,t,r,o)):[]}function lR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=t.pointAt(t.radius+10,o),d=l.x-t.centerX,c=Math.max(64,Math.min(120,i.width/3));return L({id:`chart-radar-label-${n.id}-${o}`,order:s(),bounds:a,frame:{x:dR(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:n,align:cR(d)})}function dR(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function cR(e){return e>8?"left":e<-8?"right":"center"}function Fp(e,t){let r=[];return e.chart.series.forEach((o,n)=>{r.push(...uR(e,t,o,n))}),r}function uR(e,t,r,o){let n=r.color??E[o%E.length],i=mR(r,e,t),a=Uo(i,t.circular,t.tension);return[pR(e,t,r,a,n),...t.strokeWidth>0?[fR(e,t,r,a,n)]:[],...t.pointSize>0?hR(e,t,r,i,n):[]]}function mR(e,t,r){let o=e.values;return r.categories.map((n,i)=>r.pointAt(r.radiusForValue(o[i]??t.chart.axisY.min),i))}function pR(e,t,r,o,n){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-fill-${i.id}-${r.id}`,order:l(),bounds:a,d:o,detail:{of:"chartSeries",series:r.id},style:{fill:P(n,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function fR(e,t,r,o,n){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-series-${i.id}-${r.id}`,order:l(),bounds:a,d:o,detail:{of:"chartSeries",series:r.id},style:{fill:{kind:"none"},stroke:P(n,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:H(i.shadowStyle)}}}function hR(e,t,r,o,n){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return o.map((d,c)=>({type:"ellipse",id:`chart-radar-point-${i.id}-${r.id}-${c}`,order:l(),bounds:a,cx:d.x,cy:d.y,rx:t.pointSize,ry:t.pointSize,detail:{of:"chartValue",series:r.id,valueIndex:c,mark:"radar-vertex"},prop:ue(r.id,c),style:{fill:P(n,s,i.id)}}))}function Pa(e){let t=Dp(e),r=[];return r.push(...Gp(e,t)),r.push(..._p(e,t)),r.push(...Fp(e,t)),r}var gR=-Math.PI/2,yR=14,bR=4,xR=.18,La=1e-4;function nr(e,t,r,o){return{x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function Hp(e,t,r){return`M ${e-r} ${t} A ${r} ${r} 0 1 0 ${e+r} ${t} A ${r} ${r} 0 1 0 ${e-r} ${t} Z`}function SR(e,t,r,o){return`${Hp(e,t,r)} ${Hp(e,t,Math.max(0,o))}`}function Vp(e,t,r,o,n){let i=nr(e,t,r,o),a=nr(e,t,r,n);return`M ${i.x} ${i.y} A ${r} ${r} 0 ${n-o>Math.PI?1:0} 1 ${a.x} ${a.y}`}function CR(e,t){let r=Math.min(e.blur,t*.6),o=t*.4,n=Math.hypot(e.dx,e.dy),i=n>o?o/n:1;return{...e,blur:r,dx:e.dx*i,dy:e.dy*i}}function kR(e,t,r,o,n){if(o>=Math.PI*2-La){let l=nr(e,t,r,n),d=nr(e,t,r,n+Math.PI);return`M ${l.x} ${l.y} A ${r} ${r} 0 1 1 ${d.x} ${d.y} A ${r} ${r} 0 1 1 ${l.x} ${l.y}`}let i=nr(e,t,r,n),a=nr(e,t,r,n+o),s=o>Math.PI?1:0;return`M ${i.x} ${i.y} A ${r} ${r} 0 ${s} 1 ${a.x} ${a.y}`}function RR(e){let{chart:t,plot:r}=e,o=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,outerRadius:Math.max(1,Math.min(r.width,r.height)/2-4),ringThickness:Math.max(1,p(t.config?.ringThickness,yR)),ringGap:Math.max(0,p(t.config?.ringGap,bR)),axisMin:o,range:p(t.axisY.max,100)-o,start:gR+p(t.config?.ringStartAngle,0)*Math.PI/180,total:Math.min(360,Math.max(1,p(t.config?.ringSweep,360)))*Math.PI/180,trackOpacity:Math.min(1,Math.max(0,p(t.config?.ringTrackOpacity,xR))),cap:t.config?.ringCap??"round"}}function wR(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:m}=t,f=H(a.shadowStyle),h=n>=Math.PI*2-La;if(!f||h)return[];let y=CR(f,u),x=Math.min(n,u/o);return[[m,m+x],[m+n-x,m+n]].map(([b,C],S)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${S}`,order:l(),bounds:s,d:Vp(d,c,o,b,C),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:y,clip:{type:"path",d:SR(d,c,o+u/2,o-u/2)}}}))}function vR(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:m,axisMin:f,range:h,start:y,total:x,trackOpacity:b,cap:C}=t,S=c-o*(u+m)-u/2;if(S<=u/2)return[];let w=P(r.color??E[o%E.length],a,n.id),O=Math.max(0,p(r.values[0],0)),A=h>0?Math.min(1,Math.max(0,(O-f)/h)):0,_={fill:{kind:"none"},stroke:w,strokeWidth:u,opacity:b},G=x>=Math.PI*2-La?{type:"ellipse",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:S,ry:S,style:_}:{type:"path",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,d:Vp(l,d,S,y,y+x),style:{..._,lineCap:C}};if(A<=0)return[G];let V=A*x,ve=wR(e,t,r,S,V,w),le={type:"path",id:`chart-radial-bar-ring-${n.id}-${r.id}`,order:s(),bounds:i,d:kR(l,d,S,V,y),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:ue(r.id,0),style:{fill:{kind:"none"},stroke:w,strokeWidth:u,lineCap:C}};return[G,...ve,le]}function Wp(e){let t=RR(e);return e.chart.series.flatMap((r,o)=>vR(e,t,r,o))}function zp(e,t){let r=H(e.chart.shadowStyle),o=!!e.chart.config?.linkGradient,{plot:n}=e,i=r?`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`:void 0;return t.links.map((a,s)=>{let l=PR(e,t,a,s,o);return LR(e,l,r,i,o)})}function PR(e,t,r,o,n){let i={x:t.baseX+r.x0,top:t.baseY+r.sourceY0,bottom:t.baseY+r.sourceY1},a={x:t.baseX+r.x1,top:t.baseY+r.targetY0,bottom:t.baseY+r.targetY1},s=e.chart.config,l=r.color||t.nodeColors.get(r.source)||K,d=t.nodeColors.get(r.target)||K,c=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:l},{offset:100,color:d}]}:{kind:"solid",color:r.color||d};return{linkIndex:o,fromId:r.source,toId:r.target,source:i,target:a,controlX:i.x+(a.x-i.x)*Math.min(1,Math.max(0,p(s?.sankeyLinkCurve,.5))),fill:c,opacity:Math.min(1,Math.max(0,p(s?.sankeyLinkOpacity,r.color?.85:.45)))}}function LR(e,t,r,o,n){let{chart:i,bounds:a,nextOrder:s}=e,l={minX:Math.min(t.source.x,t.target.x),maxX:Math.max(t.source.x,t.target.x),minY:Math.min(t.source.top,t.target.top),maxY:Math.max(t.source.bottom,t.target.bottom)};return{type:"path",id:`chart-sankey-link-${i.id}-${t.linkIndex}`,order:s(),bounds:n?l:a,d:MR(t),detail:{of:"link",fromId:t.fromId,toId:t.toId},style:{fill:t.fill,opacity:t.opacity,shadow:r,clip:o?{type:"path",d:o}:void 0}}}function MR(e){let{source:t,target:r,controlX:o}=e;return[`M ${t.x} ${t.top}`,`C ${o} ${t.top} ${o} ${r.top} ${r.x} ${r.top}`,`L ${r.x} ${r.bottom}`,`C ${o} ${r.bottom} ${o} ${t.bottom} ${t.x} ${t.bottom}`,"Z"].join(" ")}var TR=.3,$R=.78;function Yp(e,t){let r=Math.max(0,p(e.chart.config?.barCornerRadius,0)),o=[];return t.nodes.forEach(n=>{o.push(AR(e,t,n,r));let i=e.showLabels?ER(e,t,n):void 0;i&&o.push(i)}),o}function AR(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d={fill:{kind:"solid",color:r.color||K},shadow:H(n.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,m={of:"chartSeries",series:r.id,mark:"sankey-node"};return o>0&&c&&u?{type:"rect",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,rx:o,style:d,detail:m}:o>0&&c?{type:"path",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,d:fr(s,l,r.width,r.height,o),style:d,detail:m}:o>0&&u?{type:"path",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,d:hr(s,l,r.width,r.height,o),style:d,detail:m}:{type:"rect",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,style:d,detail:m}}function ER(e,t,r){let{chart:o}=e,n=o.config?.labelPosition??"outside",i=n==="inside"?OR(e,t,r,o.config?.labelOrientation??"horizontal"):NR(e,t,r);if(!i)return;let a=o.textColor??"#0f172a",s=n==="inside"?ce(r.color):Je(r.color,Go(a)?$R:TR)??a,l=o.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function NR(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=r.column===t.columnCount-1,s=t.baseX+r.x,l=t.baseY+r.y,d=a?s-t.labelGutter+8:s+r.width+6;return{...L({id:`chart-sankey-label-${o.id}-${r.id}`,order:i(),bounds:n,frame:{x:d,y:l,width:t.labelGutter-12,height:Math.max(1,r.height)},text:r.label,chart:o,align:a?"right":"left"}),fontSize:t.labelSize,fontWeight:"bold",verticalAlign:"middle"}}function OR(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d=s+r.width/2,c=l+r.height/2,u=t.labelSize,m=`chart-sankey-label-${n.id}-${r.id}`;if(o==="vertical"){let f=u*1.4,h=Math.max(1,r.height-8);return he(r.label,u,!1)>h?void 0:{...L({id:m,order:a(),bounds:i,frame:{x:d-h/2,y:c-f/2,width:h,height:f},text:r.label,chart:n,align:"center",rotation:-90}),fontSize:u,fontWeight:"bold",verticalAlign:"middle",rotationCenter:{x:d,y:c}}}return{...L({id:m,order:a(),bounds:i,frame:{x:s+4,y:c-u/2-2,width:Math.max(1,r.width-8),height:u+4},text:r.label,chart:n,align:"center"}),fontSize:u,fontWeight:"bold",verticalAlign:"middle"}}function Up(e){let{chart:t,plot:r,showLabels:o}=e,n=o?92:0,i=Math.max(1,r.width-n*2),a=Ra(BR(e),IR(e),i,r.height,{nodeWidth:Math.max(1,p(t.config?.sankeyNodeWidth,18)),nodeGap:Math.max(0,p(t.config?.sankeyNodeGap,8))});return{...a,baseX:r.x+n,baseY:r.y,labelGutter:n,fontSize:Math.max(9,p(t.fontSize,12)),labelSize:Math.max(6,p(t.config?.sankeyLabelSize,Math.max(9,p(t.fontSize,12))-2)),columnCount:Math.max(1,...a.nodes.map(s=>s.column+1)),nodeColors:new Map(a.nodes.map(s=>[s.id,s.color||K]))}}function BR(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function IR(e){let t=[];return e.chart.series.forEach(r=>{!r.source||!r.target||t.push({source:r.source,target:r.target,value:r.values[0]??0,color:r.color?F(r.color,K):void 0})}),t}function jp(e){let t=Up(e),r=[];return r.push(...zp(e,t)),r.push(...Yp(e,t)),r}var DR=4;function Xp(e){let t=[],r=H(e.chart.shadowStyle);return e.chart.series.forEach((o,n)=>{let i=o.color??E[n%E.length];gt(e,ht(e.chart,o)).forEach((s,l)=>{t.push(GR(e,o,s,l,i,r))})}),t}function GR(e,t,r,o,n,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??DR,m=c?.pointStrokeWidth??0;return{type:"ellipse",id:`chart-point-${a.id}-${t.id}-${o}`,order:d(),bounds:s,cx:r.x,cy:r.y,rx:u,ry:u,detail:{of:"chartValue",series:t.id,valueIndex:o},style:{fill:P(n,l,a.id),stroke:m>0?P(c?.pointStrokeColor??n,l,a.id):void 0,strokeWidth:m>0?m:void 0,opacity:c?.pointOpacity,shadow:i}}}function qp(e){let{chart:t,plot:r,showLegend:o}=e,n=Math.max(9,p(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=o&&i==="bottom"?48:0,s=Math.max(0,p(t.config?.cellGap,0));return{leaves:t.series,bands:kr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Cr,fontSize:n,smallFontSize:Math.max(8,n-1),legendPosition:i,legendHeight:a,gridWidth:Math.max(1,r.width),gridHeight:Math.max(1,r.height-a),cellGap:s,cellRadius:Math.max(0,p(t.config?.barCornerRadius,s)),headerHeight:Math.max(0,p(t.config?.headerHeight,20)),labelSize:Math.max(6,p(t.config?.tileLabelSize,Math.max(8,n-1))),valueSize:Math.max(6,p(t.config?.tileValueSize,Math.max(8,n-1))),labelPadding:Math.max(0,p(t.config?.tileLabelPadding,4))}}function _r(e){return e.values[0]??0}function Ma(e,t){return e.color??Rr(_r(e),t.bands,t.zones)}var qe=10,rn=4,Ta=2,$a=16,Fr=34;function Kp(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?_R(e,t):FR(e,t)}function Aa(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function Zp(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((o,n)=>({offset:Aa(e,e.bands[n+1]??e.bands[e.bands.length-1])*100,color:o.color??K}))}function _R(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e,a=o.x,s=t.gridWidth,l=t.fontSize+2,d=o.y+t.gridHeight+$a,c=de({x:a,y:d,width:s,height:qe}),u=Zp(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:qe,rx:3,zoneGradient:{axis:"y",min:r.axisY.min,max:r.axisY.max},style:{fill:u.length?{kind:"linear-gradient",angle:0,stops:u}:{kind:"solid",color:K},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((h,y)=>{let x=a+Aa(t,h)*s,b={type:"path",id:`chart-treemap-legend-tick-${r.id}-${y}`,order:i(),bounds:n,d:`M ${x} ${d+qe} L ${x} ${d+qe+rn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},C=y===0,S=y===t.bands.length-1,w=C?"left":S?"right":"center",O=C?x:S?x-Fr:x-Fr/2,A=L({id:`chart-treemap-legend-tick-label-${r.id}-${y}`,order:i(),bounds:n,frame:{x:O,y:d+qe+rn+Ta,width:Fr,height:l},text:Ae(h),chart:r,align:w});return[b,A]});return[m,...f]}function FR(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e,a=t.legendPosition,s=o.y,l=t.gridHeight,d=a==="left"?o.x-$a-qe:o.x+t.gridWidth+$a,c=de({x:d,y:s,width:qe,height:l}),u=Zp(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:qe,height:l,rx:3,zoneGradient:{axis:"y",min:r.axisY.min,max:r.axisY.max},style:{fill:u.length?{kind:"linear-gradient",angle:270,stops:u}:{kind:"solid",color:K},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+qe,h=a==="left"?f-rn:f+rn,y=a==="left"?h-Ta-Fr:h+Ta,x=t.bands.flatMap((b,C)=>{let S=s+(1-Aa(t,b))*l,w={type:"path",id:`chart-treemap-legend-tick-${r.id}-${C}`,order:i(),bounds:n,d:`M ${f} ${S} L ${h} ${S}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},O=L({id:`chart-treemap-legend-tick-label-${r.id}-${C}`,order:i(),bounds:n,frame:{x:y,y:S-t.fontSize/2,width:Fr,height:t.fontSize+2},text:Ae(b),chart:r,align:a==="left"?"right":"left"});return[w,O]});return[m,...x]}function Qp(e,t){let{tiles:r,headers:o}=HR(e,t),n=[],i=!!e.chart.config?.tileGradient;return r.forEach((a,s)=>{let l=r[s+1],d=l&&(a.item.leaf.group??"")===(l.item.leaf.group??""),c=i&&d?l:void 0;n.push(...WR(e,t,a,c))}),o.forEach((a,s)=>{n.push(...VR(e,t,a,s))}),n}function HR(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:_r(c)}));return{tiles:Dr(l,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),headers:[]}}let r=[];for(let l of t.leaves){let d=l.group??"";r.includes(d)||r.push(d)}let o=r.map(l=>({key:l,label:l||"Other",value:t.leaves.filter(d=>(d.group??"")===l).reduce((d,c)=>d+_r(c),0)})),n=Dr(o,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),i=t.cellGap,a=[],s=[];return n.forEach(l=>{let d=e.showLabels?Math.min(t.headerHeight,l.height):0;e.showLabels&&s.push({key:l.item.key,label:l.item.label,x:l.x+i/2,y:l.y,width:Math.max(0,l.width-i)});let u=t.leaves.filter(m=>(m.group??"")===l.item.key).map(m=>({leaf:m,value:_r(m)}));a.push(...Dr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function VR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=n.config?.headerColor??n.gridColor??"#e2e8f0",d={type:"rect",id:`chart-treemap-header-${n.id}-${o}`,order:s(),bounds:a,x:i.x+r.x,y:i.y+r.y,width:r.width,height:t.headerHeight,rx:t.cellRadius,style:{fill:{kind:"solid",color:l}}},c=Math.max(8,Math.max(9,n.fontSize??12)-1),u={...L({id:`chart-treemap-header-label-${n.id}-${o}`,order:s(),bounds:a,frame:{x:i.x+r.x,y:i.y+r.y+(t.headerHeight-c)/2,width:r.width,height:c+2},text:r.label,chart:n,align:"center"}),fontSize:c,color:ce(l)};return[d,u]}function WR(e,t,r,o){let n=Ma(r.item.leaf,t),i=o?Ma(o.item.leaf,t):void 0,a=[zR(e,t,r,n,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...YR(e,t,r,n)),a}function zR(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=H(i.shadowStyle),m=u?`M ${a.x} ${a.y} H ${a.x+a.width} V ${a.y+a.height} H ${a.x} Z`:void 0,f=a.x+r.x+c/2,h=a.y+r.y+c/2,y=Math.max(0,r.width-c),x=Math.max(0,r.height-c),b="#94a3b8",C={minX:f,maxX:f+y,minY:h+x/2-y/2,maxY:h+x/2+y/2},S=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:F(o,b)},{offset:100,color:F(n,b)}]}:P(o,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:n?C:s,x:f,y:h,width:y,height:x,rx:t.cellRadius,style:{fill:S,stroke:{kind:"solid",color:i.config?.tileStrokeColor??i.gridColor??"#e2e8f0"},strokeWidth:p(i.config?.tileStrokeWidth,p(i.gridWidth,1)),shadow:u,clip:m?{type:"path",d:m}:void 0}}}function YR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,{leaf:l,value:d}=r.item,c=t.cellGap,u=t.labelPadding,m=Math.max(1,r.width-c-u*2),f=Math.max(1,r.height-c-u*1.5),h=i.x+r.x+c/2+u,y=i.y+r.y+c/2+u*.75,x=n.config?.tileTextColor??ce(F(o,"#ffffff")),b=t.labelSize*1.2,C=Math.max(1,Math.floor(f/b)),S=De(l.label,m,t.labelSize).slice(0,C).map(G=>$o(G,m,t.labelSize,!0)),w={...L({id:`chart-treemap-label-${n.id}-${l.id}`,order:s(),bounds:a,frame:{x:h,y,width:m,height:f},text:l.label,chart:n}),lines:S,fontSize:t.labelSize,fontWeight:"bold",color:x},O=String(d),A=S.length*b+t.valueSize*1.2<=f+2&&he(O,t.valueSize,!1)<=m;if(n.config?.showTileValues===!1||!A)return[w];let _={...L({id:`chart-treemap-value-${n.id}-${l.id}`,order:s(),bounds:a,frame:{x:h,y:y+S.length*b,width:m,height:Math.max(1,f-S.length*b)},text:String(d),chart:n}),lines:[String(d)],fontSize:t.valueSize,color:x};return[w,_]}function Jp(e){let t=qp(e),r=[];return r.push(...Qp(e,t)),r.push(...Kp(e,t)),r}var UR={bar:wm,boxplot:Em,custom:Bm,field:zm,heatmap:Qm,hexbin:e=>ap(e),line:hp,mekko:Rp,pie:e=>Ep(e),polarArea:e=>Bp(e),radar:e=>Pa(e),radial:e=>Pa(e),radialBar:e=>Wp(e),sankey:jp,scatter:Xp,treemap:Jp},jR=new Set(["radar","radial"]);function Ea(e){return jR.has(e)}function yt(e){return UR[e.chart.chartType](e)}function ef(e){let{chart:t,context:r,layout:o,nodes:n,renderOrder:i}=e,a=Xo(t,o.plot,o.bounds,i.current());n.push(...a),i.advance(a.length),n.push(...yt(r));let s=bm({chart:t,plot:o.plot,bounds:o.bounds,order:i.current()});return n.push(...s),i.advance(s.length),n.push(...dm(t,o,i.current())),n}function XR(e,t){let r=re(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function qR(e,t){let{outerRadius:r,innerRadius:o,cornerRadius:n}=Vo(t.width,t.height,e.config?.innerRadius,e.config?.pieCornerRadius);return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${o},${n}`}}function KR(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),o=Math.max(0,Math.min(p(e.config?.innerRadius,0),r-1)),n=Math.max(0,p(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${o},${n}`}}function ZR(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...e.series.map(c=>c.values.length)),n=Yo(r,o),i=zo(t.width,t.height,p(e.fontSize,12),e.showAxisLabels!==!1),a=t.x+t.width/2,s=t.y+t.height/2,l=e.chartType==="radial"?1:0,d=e.config?.radarTension;return{of:"radarGeometry",radarGeometry:`${a},${s},${i},${e.axisY.min},${e.axisY.max},${n},${l}${d===void 0?"":`,${d}`}`}}function QR(e,t){return e.chartType==="pie"?qR(e,t):e.chartType==="polarArea"?KR(e,t):e.chartType==="radar"||e.chartType==="radial"?ZR(e,t):rm.has(e.chartType)?XR(e,t):void 0}function tf(e,t,r,o){let n={type:"rect",id:`chart-${e.id}`,order:o,bounds:t,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius??12,style:{fill:P(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:p(e.strokeWidth,1)}},i=QR(e,r);return i&&(n.detail=i),n}function rf(e,t,r,o){let n=Ju({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:o});return r.advance(n.length),n}function of(e,t,r,o){return{chart:e,plot:t.plot,bounds:t.bounds,diagnostics:o,showLabels:t.showLabels,showLegend:t.showLegend,stackedMode:e.config?.stacked&&e.config.stacked!=="none"?e.config.stacked:void 0,nextOrder:r.next}}var on=class{#e;#o=.01;constructor(t){this.#e=t}next=()=>this.#e+this.#o++;current(){return this.#e+this.#o}advance(t){this.#o+=t}};function nf(e,t,r,o){return e.title?[{...L({id:`chart-title-${e.id}`,order:o.next(),bounds:t,frame:{x:r.x,y:e.y+12,width:r.width,height:20},text:e.title,chart:e,align:e.titleAlign??"left"}),...e.titleColor?{color:e.titleColor}:{},fontWeight:e.titleWeight??"bold",fontSize:p(e.titleSize,Math.max(10,p(e.fontSize,12))+2),prop:ju}]:[]}function af(e,t,r){let o=2e4+t,n=nm(e),i=new on(o),a=[tf(e,n.bounds,n.plot,o)];return a.push(...xm(e,n.bounds,i)),a.push(...nf(e,n.bounds,n.plot,i)),a.push(...rf(e,n,i,r)),{chart:e,layout:n,nodes:a,renderOrder:i,context:of(e,n,i,r)}}function sf(e){return e.nodes.push(...yt(e.context)),e.nodes}function lf(e){return e.nodes.push(...yt(e.context)),e.nodes}function df(e,t,r){if(e.isVisible===!1)return[];let o=af(e,t,r);return Ea(e.chartType)?sf(o):Xe(e)?ef(o):lf(o)}function Na(e,t){return e.flatMap((r,o)=>ee(df(r,o,t),"chart",r.id,r.chartType,r.title??"Chart"))}function JR(e){let t=e;if(t.rotation){if(t.rotationCenter)return{angle:t.rotation,x:t.rotationCenter.x,y:t.rotationCenter.y};if(t.cx!==void 0&&t.cy!==void 0)return{angle:t.rotation,x:t.cx,y:t.cy};if(t.x!==void 0&&t.y!==void 0&&t.width!==void 0&&t.height!==void 0)return{angle:t.rotation,x:t.x+t.width/2,y:t.y+t.height/2}}}function ew(e){let{x:t,y:r,width:o,height:n}=e,i=Math.max(0,Math.min(e.cornerRadius,o/2,n/2));return i===0?[[t,r],[t+o,r],[t+o,r+n],[t,r+n]]:[[t+o-i,r+i,-90],[t+o-i,r+n-i,0],[t+i,r+n-i,90],[t+i,r+i,180]].flatMap(([s,l,d])=>Array.from({length:9},(c,u)=>{let m=(d+90*u/8)*Math.PI/180;return[s+i*Math.cos(m),l+i*Math.sin(m)]}))}function tw(e,t){if(!t)return{type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius};let r=-t.angle*Math.PI/180,o=Math.cos(r),n=Math.sin(r),i=ew(e).map(([s,l])=>{let d=s-t.x,c=l-t.y;return[t.x+d*o-c*n,t.y+d*n+c*o]}),a=s=>Math.round(s*100)/100;return{type:"path",d:`M${i.map(([s,l])=>`${a(s)} ${a(l)}`).join("L")}Z`}}function cf(e,t){let r=new Map(t.filter(n=>n.clip).map(n=>[n.id,n]));if(r.size===0)return;let o=new Map;for(let n of e){let i=n.identity?.parentFrameId,a=i?r.get(i):void 0;n.identity&&a&&o.set(`${n.identity.role}:${n.identity.id}`,a)}for(let n of e){let i=n.identity?o.get(`${n.identity.role}:${n.identity.id}`):void 0,a=n;if(i&&a.style){let s=tw(i,JR(n));a.style={...a.style,clip:a.style.clip?{...a.style.clip,within:s}:s}}}}function rw(e){let{minX:t,minY:r,maxX:o,maxY:n}=e.bounds,i="style"in e?e.style?.clip:void 0;for(;i;)i.type==="rect"&&(t=Math.max(t,i.x),r=Math.max(r,i.y),o=Math.min(o,i.x+i.width),n=Math.min(n,i.y+i.height)),i=i.within;return t<=o&&r<=n?{minX:t,minY:r,maxX:o,maxY:n}:e.bounds}function ow(e){if(!e.length)return bi;let t=e.map(rw);return{minX:Math.min(...t.map(r=>r.minX)),minY:Math.min(...t.map(r=>r.minY)),maxX:Math.max(...t.map(r=>r.maxX)),maxY:Math.max(...t.map(r=>r.maxY))}}function nw(e){let t=new Map,r=(o,n,i)=>{n.forEach((a,s)=>{t.set(`${o}:${a.id}`,{rank:Zd(a),sequence:Qd(a,i+s)})})};return r("frame",e.frames,0),r("swimlane",e.swimlanes,5e3),r("shape",e.shapes,1e4),r("widget",e.components??e.widgets??[],1e4),r("isometric",e.isometricObjects??[],15e3),r("link",e.links.map(o=>o.link),2e4),r("chart",e.charts??[],2e4),r("path",e.paths??[],3e4),r("dimension",e.dimensions??[],31e3),t}function iw(e,t){let r=nw(t);for(let o of e){let n=o.identity?r.get(`${o.identity.role}:${o.identity.id}`):void 0;o.rank=n?.rank??0,o.sequence=n?.sequence??0}}function Oa(e,t={}){let{measureText:r}=t,o=[...e.diagnostics??[]],n=[...kc(e),...bu(e.paths??[]),...Na(e.charts??[],o),...yu(e.links,r),...Gu(e.shapes,o,r),...ki(e.components??e.widgets??[]),...Ac(e.isometricObjects??[]),...vc(e.dimensions??[])];return cf(n,e.frames),iw(n,e),n.sort((i,a)=>(i.rank??0)-(a.rank??0)||(i.sequence??0)-(a.sequence??0)||i.order-a.order||(i.id<a.id?-1:i.id>a.id?1:0)),{nodes:n,bounds:ow(n),diagnostics:o}}var M=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),g=e=>Number(e.toFixed(3)).toString(),Ne=e=>`sf-${e.replace(/[^A-Za-z0-9_.:-]/g,"-")}`;var nn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;clip(t){return t.clip?this.define(t.clip):void 0}define(t){let r=JSON.stringify(t),o=this.ids.get(r);if(!o){let n=t.within?this.define(t.within):void 0;o=Ne(`${this.prefix}clip-${this.ids.size}`),this.ids.set(r,o);let i=t.type==="path"?`<path clip-rule="evenodd" d="${M(t.d)}"/>`:`<rect x="${g(t.x)}" y="${g(t.y)}" width="${g(t.width)}" height="${g(t.height)}" rx="${g(t.rx)}"/>`;this.addDefinition(`<clipPath id="${o}"${n?` clip-path="url(#${n})"`:""}>${i}</clipPath>`)}return o}};var an=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;filter(t,r,o){if(t.innerShadow)return this.define(r,t.innerShadow,lw);if(t.shadow){let n=t.shadow.blur*1.5+Math.max(Math.abs(t.shadow.dx),Math.abs(t.shadow.dy));return this.define(r,t.shadow,aw,o&&o>0?Math.max(.5,n/o):.5)}if(t.blur||t.saturate!==void 0){let n=o&&o>0&&t.blur?Math.max(.5,t.blur*1.5/o):.5;return this.define(r,{blur:t.blur??0,saturate:t.saturate??1},sw,n)}}define(t,r,o,n=.5){let i=JSON.stringify(r)+o.name+n,a=this.ids.get(i);return a||(a=Ne(`${this.prefix}shadow-${t}-${this.ids.size}`),this.ids.set(i,a),this.addDefinition(`<filter id="${a}" x="${g(-n*100)}%" y="${g(-n*100)}%" width="${g((1+n*2)*100)}%" height="${g((1+n*2)*100)}%">${o(r)}</filter>`)),a}};function aw(e){return`<feDropShadow dx="${g(e.dx)}" dy="${g(e.dy)}" stdDeviation="${g(e.blur/2)}" flood-color="${M(e.color)}" flood-opacity="${g(e.opacity)}"/>`}function sw(e){let t=e.blur>0?`<feGaussianBlur stdDeviation="${g(e.blur/2)}"/>`:"",r=e.saturate===1?"":`<feColorMatrix type="saturate" values="${g(e.saturate)}"/>`;return t+r}function lw(e){return['<feComponentTransfer in="SourceAlpha" result="sf-inverted-alpha">','<feFuncA type="table" tableValues="1 0"/>',"</feComponentTransfer>",`<feGaussianBlur in="sf-inverted-alpha" stdDeviation="${g(e.blur/2)}" result="sf-blurred"/>`,`<feOffset in="sf-blurred" dx="${g(e.dx)}" dy="${g(e.dy)}" result="sf-offset"/>`,`<feFlood flood-color="${M(e.color)}" flood-opacity="${g(e.opacity)}" result="sf-color"/>`,'<feComposite in="sf-color" in2="sf-offset" operator="in" result="sf-halo"/>','<feComposite in="sf-halo" in2="SourceGraphic" operator="in" result="sf-inset"/>','<feComposite in="sf-inset" in2="SourceGraphic" operator="over"/>'].join("")}function uf(e,t,r,o){return{arrow:`<path d="M ${g(-t)} ${g(-t*.6)} L 0 0 L ${g(-t)} ${g(t*.6)}" fill="none" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round" stroke-linejoin="round"/>`,filled_arrow:`<path d="M ${g(-t)} ${g(-t*.6)} L 0 0 L ${g(-t)} ${g(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${g(o*.5)}" stroke-linejoin="round"/>`,circle:`<circle cx="0" cy="0" r="${g(t*.5)}" fill="white" stroke="${r}" stroke-width="${g(o)}"/>`,filled_circle:`<circle cx="0" cy="0" r="${g(t*.5)}" fill="${r}"/>`,diamond:`<path d="M ${g(-t*.6)} 0 L 0 ${g(-t*.6)} L ${g(t*.6)} 0 L 0 ${g(t*.6)} Z" fill="white" stroke="${r}" stroke-width="${g(o)}"/>`,filled_diamond:`<path d="M ${g(-t*.6)} 0 L 0 ${g(-t*.6)} L ${g(t*.6)} 0 L 0 ${g(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${g(o*.5)}"/>`,bar:`<path d="M 0 ${g(-t*.6)} V ${g(t*.6)}" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`,triangle:`<path d="M ${g(-t)} ${g(-t*.72)} L 0 0 L ${g(-t)} ${g(t*.72)} Z" fill="white" stroke="${r}" stroke-width="${g(o)}" stroke-linejoin="round"/>`,one:`<path d="M 0 ${g(-t*.62)} V ${g(t*.62)} M ${g(-t*.72)} ${g(-t*.62)} V ${g(t*.62)}" stroke="${r}" stroke-width="${g(o)}"/>`,zero_one:`<circle cx="${g(-t*.8)}" cy="0" r="${g(t*.38)}" fill="white" stroke="${r}" stroke-width="${g(o)}"/><path d="M 0 ${g(-t*.62)} V ${g(t*.62)}" stroke="${r}" stroke-width="${g(o)}"/>`,many:`<path d="M ${g(-t)} ${g(-t*.72)} L 0 0 M ${g(-t)} 0 L 0 0 M ${g(-t)} ${g(t*.72)} L 0 0" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`,one_many:`<path d="M ${g(-t)} ${g(-t*.72)} L 0 0 M ${g(-t)} 0 L 0 0 M ${g(-t)} ${g(t*.72)} L 0 0 M ${g(-t*1.45)} ${g(-t*.62)} V ${g(t*.62)}" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`,zero_many:`<circle cx="${g(-t*1.45)}" cy="0" r="${g(t*.38)}" fill="white" stroke="${r}" stroke-width="${g(o)}"/><path d="M ${g(-t)} ${g(-t*.72)} L 0 0 M ${g(-t)} 0 L 0 0 M ${g(-t)} ${g(t*.72)} L 0 0" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`}[e]}function dw(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function cw(e,t){return`id="${e}" markerWidth="${g(t*2)}" markerHeight="${g(t*2)}" viewBox="${g(-t)} ${g(-t)} ${g(t*2)} ${g(t*2)}" refX="0" refY="0" orient="auto-start-reverse" markerUnits="userSpaceOnUse" overflow="visible"`}var sn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;marker(t,r,o){if(!t||t==="none")return;let n=`${t}:${r}:${o}`,i=this.ids.get(n);if(i)return i;i=Ne(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(n,i);let a=12+(o-2)*3,s=dw(t,a,o),l=cw(i,s);return this.addDefinition(`<marker ${l}>${uf(t,a,M(r),o)}</marker>`),i}};function uw(e,t){let r=t.points.map((i,a)=>Ne(`${e}-point-${a}`)),o=t.points.map((i,a)=>{let s=Math.max(0,Math.min(100,i.x)),l=Math.max(0,Math.min(100,i.y));return`<radialGradient id="${r[a]}" gradientUnits="objectBoundingBox" cx="${g(s)}%" cy="${g(l)}%" r="75%"><stop offset="0%" stop-color="${M(i.color)}" stop-opacity="1"/><stop offset="100%" stop-color="${M(i.color)}" stop-opacity="0"/></radialGradient>`}).join(""),n=t.points.map((i,a)=>`<rect width="1" height="1" fill="url(#${r[a]})"/>`).join("");return`${o}<pattern id="${e}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><rect width="1" height="1" fill="${M(t.points[0]?.color??"transparent")}"/>${n}</pattern>`}function mw(e,t,r){let o=t.angle*Math.PI/180,n=(r.minX+r.maxX)/2,i=(r.minY+r.maxY)/2,a=Math.max(r.maxX-r.minX,r.maxY-r.minY)/2,s=Math.cos(o)*a,l=Math.sin(o)*a,d=t.stops.map(c=>`<stop offset="${g(Math.max(0,Math.min(100,c.offset)))}%" stop-color="${M(c.color)}"/>`).join("");return`<linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${g(n-s)}" y1="${g(i-l)}" x2="${g(n+s)}" y2="${g(i+l)}">${d}</linearGradient>`}var ln=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;paint(t,r,o){if(!t||t.kind==="none")return"none";if(t.kind==="solid")return t.color;let n=JSON.stringify(t)+JSON.stringify(o),i=this.ids.get(n);if(!i){i=Ne(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(n,i);let a=t.kind==="mesh-gradient"?uw(i,t):mw(i,t,o);this.addDefinition(a)}return`url(#${i})`}};var dn=class{constructor(t){this.prefix=t;let r=o=>{this.entries.push(o)};this.paints=new ln(r,t),this.filters=new an(r,t),this.markers=new sn(r,t),this.clips=new nn(r,t)}prefix;entries=[];paints;filters;markers;clips;elementId(t){return Ne(`${this.prefix}${t}`)}paint(t,r,o){return this.paints.paint(t,r,o)}filter(t,r,o){return this.filters.filter(t,r,o)}marker(t,r,o){return this.markers.marker(t,r,o)}clip(t){return this.clips.clip(t)}};function pw(e,t){return{type:"path",id:`link-hit-${t}`,order:e.order,rank:e.rank,sequence:e.sequence,bounds:e.bounds,d:e.d,identity:{role:"link",id:t},style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#000000"},strokeWidth:16,opacity:0,pointerEvents:"stroke"}}}function mf(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,pw(t,t.identity.id)]:[t])}function pf(e,t){let r=e.stroke;return r?.kind==="solid"?r.color:r?.kind==="linear-gradient"&&r.stops.length?(t==="start"?r.stops.reduce((n,i)=>n.offset<=i.offset?n:i):r.stops.reduce((n,i)=>n.offset>=i.offset?n:i)).color:r?.kind==="mesh-gradient"&&r.points.length?r.points[0].color:"#64748b"}function ff(e,t){let r=t.paint(e.style.stroke,`${e.id}-stroke`,e.bounds),o=t.paint(e.style.fill,`${e.id}-fill`,e.bounds),n=[`fill="${M(o)}"`,`stroke="${M(r)}"`];return fw(n,e.style),hf(n,e,t),gw(n,e,t),n.join(" ")}function fw(e,t){t.strokeWidth!==void 0&&e.push(`stroke-width="${g(t.strokeWidth)}"`),t.dash?.length&&e.push(`stroke-dasharray="${t.dash.map(g).join(" ")}"`),t.lineCap&&e.push(`stroke-linecap="${t.lineCap}"`),t.lineJoin&&e.push(`stroke-linejoin="${t.lineJoin}"`),t.opacity!==void 0&&e.push(`opacity="${g(t.opacity)}"`),t.pointerEvents&&e.push(`pointer-events="${t.pointerEvents}"`);let r=[];if(t.transition&&t.transition>0){let o=`${g(t.transition)}ms ease`;r.push(`transition: x ${o}, y ${o}, width ${o}, height ${o}, cx ${o}, cy ${o}, rx ${o}, ry ${o}, fill ${o}, stroke ${o}, stroke-width ${o}, stroke-dasharray ${o}, opacity ${o}`)}t.blend&&r.push(`mix-blend-mode: ${M(t.blend)}`),r.length>0&&e.push(`style="${r.join("; ")}"`)}function hw(e){let t=e;if(t.type==="ellipse"&&t.rx!==void 0&&t.ry!==void 0)return Math.min(t.rx,t.ry)*2;if(t.type==="rect"&&t.width!==void 0&&t.height!==void 0)return Math.min(t.width,t.height)}function hf(e,t,r){let o=r.filter(t.style,t.id,hw(t));o&&e.push(`filter="url(#${o})"`);let n=r.clip(t.style);n&&e.push(`clip-path="url(#${n})"`)}function gw(e,t,r){if(t.type!=="path")return;let o=r.marker(t.markerStart,pf(t.style,"start"),t.style.strokeWidth??1),n=r.marker(t.markerEnd,pf(t.style,"end"),t.style.strokeWidth??1);o&&e.push(`marker-start="url(#${o})"`),n&&e.push(`marker-end="url(#${n})"`)}function rt(e,t){return e&&t?` transform="rotate(${g(e)} ${g(t.x)} ${g(t.y)})"`:""}function gf(e,t){let r=[];return e.style.opacity!==void 0&&r.push(`opacity="${g(e.style.opacity)}"`),e.style.pointerEvents&&r.push(`pointer-events="${e.style.pointerEvents}"`),hf(r,e,t),r.join(" ")}var yf="data-sf-symbol-points",bf="data-sf-symbol-tension",cn="data-sf-symbol-bounds",Hr="data-sf-corner-radius",xf="data-sf-square-corner",un="data-sf-path-points",mn="data-sf-path-tension",pn="data-sf-path-closed",Sf="data-sf-path-point",fn="data-sf-isometric-size",hn="data-sf-isometric-label-offset";function yw(e){return e.role==="shape"?"entity":e.role}function bw(e){return[`role="${M(e.role)}"`,e.checked===void 0?void 0:`aria-checked="${e.checked}"`,e.pressed===void 0?void 0:`aria-pressed="${e.pressed}"`,e.disabled?'aria-disabled="true"':void 0]}function xw(e){return[`data-sf-role="${yw(e)}"`,`data-sf-id="${M(e.id)}"`,e.kind?`data-sf-kind="${M(e.kind)}"`:void 0,e.primary?'data-sf-primary="true"':void 0,e.parentFrameId?`data-sf-parent-frame="${M(e.parentFrameId)}"`:void 0,...e.aria?bw(e.aria):[]]}function Sw(e){switch(e.of){case"chartValue":return Cw(e);case"chartScale":return ww(e);case"chartSeries":return vw(e);case"pieGeometry":return kw(e);case"radarGeometry":return Rw(e);case"link":return $w(e);case"frameBoundary":return Pw(e);case"symbolGeometry":return Lw(e);case"declaredBounds":return[Ba(e.bounds)];case"pathGeometry":return Mw(e);case"isometricGeometry":return Tw(e)}}function Cw(e){return[`data-sf-series="${M(e.series)}"`,`data-sf-value-index="${e.valueIndex}"`,e.mark?`data-sf-mark="${e.mark}"`:void 0,e.radius!==void 0?`data-sf-bar-radius="${g(e.radius)}"`:void 0,e.colorProp?`data-sf-color-prop="${M(e.colorProp)}"`:void 0,e.hasColorOverride?'data-sf-color-override="true"':void 0,e.pieStart!==void 0?`data-sf-pie-start="${g(e.pieStart)}"`:void 0,e.pieEnd!==void 0?`data-sf-pie-end="${g(e.pieEnd)}"`:void 0,e.pieValue!==void 0?`data-sf-pie-value="${g(e.pieValue)}"`:void 0]}function kw(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function Rw(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function ww(e){return[`data-sf-value-scale="${e.valueScale}"`]}function vw(e){return[`data-sf-series="${M(e.series)}"`,e.lineTension!==void 0?`data-sf-line-tension="${g(e.lineTension)}"`:void 0,e.mark?`data-sf-mark="${M(e.mark)}"`:void 0,e.pulled?'data-sf-label-pulled="true"':void 0,e.midAngle!==void 0?`data-sf-pie-mid-angle="${g(e.midAngle)}"`:void 0,e.wedgeRadius!==void 0?`data-sf-pie-wedge-radius="${g(e.wedgeRadius)}"`:void 0]}function Pw(e){return[`${Hr}="${g(e.cornerRadius)}"`,`${xf}="${e.squareCorner}"`]}function Ba(e){return`${cn}="${g(e.x)},${g(e.y)},${g(e.width)},${g(e.height)}"`}function Lw(e){return[`${yf}="${M(JSON.stringify(e.points))}"`,`${bf}="${g(e.tension)}"`,Ba(e.declaredBounds)]}function Mw(e){return[`${un}="${M(JSON.stringify(e.points))}"`,`${mn}="${g(e.tension)}"`,`${pn}="${e.closed}"`]}function Tw(e){return[`${fn}="${g(e.width)},${g(e.height)},${g(e.depth)}"`,`${Hr}="${g(e.cornerRadius)}"`,Ba(e.bounds),`${hn}="${g(e.labelOffsetX)},${g(e.labelOffsetY)}"`]}function $w(e){return[e.fromId?`data-sf-from="${M(e.fromId)}"`:void 0,e.toId?`data-sf-to="${M(e.toId)}"`:void 0,e.route?`data-sf-route="${e.route}"`:void 0,e.fromSide?`data-sf-from-side="${e.fromSide}"`:void 0,e.toSide?`data-sf-to-side="${e.toSide}"`:void 0,e.segments?`data-sf-link-segments="${M(JSON.stringify(e.segments))}"`:void 0,e.fromFace?`data-sf-from-face="${e.fromFace}"`:void 0,e.toFace?`data-sf-to-face="${e.toFace}"`:void 0,e.labelGap?'data-sf-label-gap="true"':void 0]}function bt(e){let t=e.identity?.label,r=[...e.identity?xw(e.identity):[],...e.detail?Sw(e.detail):[],e.prop?`data-sf-prop="${M(e.prop)}"`:void 0,e.propKind?`data-sf-prop-kind="${e.propKind}"`:void 0,e.propSolidOnly?'data-sf-prop-solid-only="true"':void 0,e.mark?`data-sf-mark="${M(e.mark)}"`:void 0,e.zoneGradient?'data-sf-zone-gradient="true"':void 0,e.zoneGradient?`data-sf-zone-axis-min="${g(e.zoneGradient.min)}"`:void 0,e.zoneGradient?`data-sf-zone-axis-max="${g(e.zoneGradient.max)}"`:void 0,t?`tabindex="0" aria-label="${M(t.replace(/\s+/g," ").trim())}"`:void 0].filter(o=>o!==void 0);return r.length?` ${r.join(" ")}`:""}function Aw(e,t,r,o){if(!e.length)return`<tspan x="${g(t)}"${r} font-size="${o}"></tspan>`;let n=[];for(let i of e){let a=n[n.length-1];a&&a.bold===i.bold?a.text+=` ${i.text}`:(a&&(a.text+=" "),n.push({text:i.text,bold:i.bold}))}return n.map((i,a)=>`<tspan${a===0?` x="${g(t)}"${r}`:""} font-size="${o}" font-weight="${i.bold?"bold":"normal"}">${M(i.text)}</tspan>`).join("")}function Cf(e,t){let r=Ew(e),o=`${g(e.fontSize)}px`,n=Ow(e,r,o),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${bt(e)} x="${g(r.x)}" y="${g(r.firstY)}" font-family="${M(e.fontFamily)}" font-size="${o}" font-weight="${e.fontWeight}"${e.letterSpacing?` letter-spacing="${g(e.letterSpacing)}"`:""} fill="${M(e.color)}" text-anchor="${r.anchor}" data-sf-valign="${e.verticalAlign}" data-sf-line-height="${g(e.lineHeight)}"${i}${rt(e.rotation,e.rotationCenter)}>${n}</text>`}function Ew(e){let t=e.fontSize*e.lineHeight,o=(e.richLines?e.richLines.length:e.lines.length)*t,n=e.align==="left"?e.x:e.align==="right"?e.x+e.width:e.x+e.width/2,i=e.align==="left"?"start":e.align==="right"?"end":"middle";return{x:n,firstY:Nw(e,o),linePx:t,anchor:i}}function Nw(e,t){return e.verticalAlign==="top"?e.y+e.fontSize:e.verticalAlign==="bottom"?e.y+e.height-t+e.fontSize:e.y+(e.height-t)/2+e.fontSize}function Ow(e,t,r){return e.richLines?e.richLines.map((o,n)=>Aw(o,t.x,kf(n,t.linePx),r)).join(""):e.lines.map((o,n)=>Bw(o,n,t,r)).join("")}function Bw(e,t,r,o){return`<tspan x="${g(r.x)}" font-size="${o}"${kf(t,r.linePx)}>${M(e)}</tspan>`}function kf(e,t){return e?` dy="${g(t)}px"`:""}function Iw(e,t){let r=rt(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),o=M(JSON.stringify(e.shader.parameters)),n=e.shader.surfacePadding??0,i=e.fillColor?` data-sf-shader-fill="${M(e.fillColor)}"`:"";return`<foreignObject id="${t.elementId(e.id)}"${bt(e)} data-sf-shader="${M(e.shader.program)}" data-sf-shader-name="${M(e.shader.name)}" data-sf-shader-params="${o}" data-sf-shader-mask="${e.mask}" data-sf-shader-padding="${g(n)}"${i} x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}"${r} pointer-events="${e.shader.program==="ruler"||e.identity?.role==="widget"?"all":"none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`}function Dw(e,t){let r=t.componentStyle;return r.variant==="plain"?`<span xmlns="http://www.w3.org/1999/xhtml" data-sf-rolling-digit="true" style="position:relative;display:inline-block;width:.62em;height:1.1em;overflow:hidden"><span data-sf-rolling-current="true" style="position:absolute;inset:0;display:grid;place-items:center;color:${M(r.color)};font-weight:${M(r.fontWeight)};line-height:1">${M(e)}</span></span>`:`<span xmlns="http://www.w3.org/1999/xhtml" data-sf-rolling-digit="true" style="position:relative;display:inline-block;width:.72em;height:1.2em;overflow:hidden;border:1px solid ${M(r.divider)};border-radius:.09em;background:${M(r.surface)};box-shadow:inset 0 1px 0 rgba(255,255,255,.7),inset 0 -.16em .38em rgba(0,0,0,.12)"><span data-sf-rolling-current="true" style="position:absolute;inset:0;display:grid;place-items:center;color:${M(r.color)};font-weight:300;line-height:1">${M(e)}</span><span style="position:absolute;z-index:2;left:0;right:0;top:50%;height:1px;background:${M(r.divider)};pointer-events:none"></span></span>`}function Gw(e,t){let r=rt(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),o=e.componentStyle.fontSize>0?e.componentStyle.fontSize:Math.max(1,Math.min(e.width,e.height)*.28),n=e.label?`<span xmlns="http://www.w3.org/1999/xhtml" style="margin-bottom:.14em;color:${M(e.componentStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${M(e.label)}</span>`:"",i=[...e.value].map(s=>Dw(s,e)).join(""),a=M(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${bt(e)} data-sf-widget="rollingNumber" data-sf-widget-value="${M(e.value)}" data-sf-widget-digits="${e.digits??""}" data-sf-widget-duration="${g(e.duration)}" data-sf-widget-style="${a}" x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}"${r}><div xmlns="http://www.w3.org/1999/xhtml" style="width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:${M(e.componentStyle.fontFamily)};font-size:${g(o)}px">${n}<div data-sf-rolling-digits="true" aria-label="${M(e.value)}" style="display:flex;gap:${e.componentStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function Rf(e,t){if(e.type==="text")return Cf(e,t);if(e.type==="shader-surface")return Iw(e,t);if(e.type==="rolling-number")return Gw(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${bt(e)} ${gf(e,t)} href="${M(e.href)}" x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}" preserveAspectRatio="xMidYMid slice"/>`;let r=`id="${t.elementId(e.id)}"${bt(e)} ${ff(e,t)}`;return e.type==="rect"?`<rect ${r} x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}"${e.rx?` rx="${g(e.rx)}"`:""}${rt(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2})}/>`:e.type==="ellipse"?`<ellipse ${r} cx="${g(e.cx)}" cy="${g(e.cy)}" rx="${g(e.rx)}" ry="${g(e.ry)}"${rt(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${M(e.d)}"${rt(e.rotation,e.rotationCenter)}/>`}function wf(e,t={}){let r=t.padding??16,o=Math.max(1,e.bounds.maxX-e.bounds.minX+r*2),n=Math.max(1,e.bounds.maxY-e.bounds.minY+r*2),i=`${g(e.bounds.minX-r)} ${g(e.bounds.minY-r)} ${g(o)} ${g(n)}`,a=new dn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?mf(e.nodes):e.nodes).map(u=>Rf(u,a)).join(`
7
+ `&&e.peek()!=="\r";)e.advance()}function Fs(e){let t=e.peek();return wt(t)||t==="-"&&wt(e.peek(1))}function Hs(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());wt(e.peek());)r+=e.advance();if(e.peek()==="."&&wt(e.peek(1)))for(r+=e.advance();wt(e.peek());)r+=e.advance();return me("number",r,t,{numberValue:Number(r)})}var mg=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],pg=e=>e!==void 0&&/[\d.]/.test(e);function Vs(e,t){let r=mg.find(([i])=>e.startsWith(i));if(!r)return null;let[o,n]=r;if(o==="-"&&pg(e.peek(1)))return null;for(let i=0;i<o.length;i++)e.advance();return me(n,o,t)}var fg={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function Ws(e,t){let r=e.peek(),o=r?fg[r]:void 0;return!r||!o||r==="&"&&e.peek(1)==="&"?null:(e.advance(),me(o,r,t))}function zs(e){return e===" "||e===" "}function Ys(e){e.advance()}function hg(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function gg(e){let t=e.split(`
8
+ `),r=1/0;for(let o of t)o.trim()&&(r=Math.min(r,hg(o)));return!Number.isFinite(r)||r===0?e:t.map(o=>o.trim()?o.slice(r):o).join(`
9
+ `)}function yg(e,t){Us(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return Us(e),gg(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new Oe("unterminated long string",t.line,t.col)}function Us(e){e.advance(),e.advance(),e.advance()}function bg(e,t){e.advance();let r="";for(;!e.done;){let o=e.advance();if(o==='"')return r;if(o===`
10
+ `||o==="\r")throw new Oe('newline in short string (use """ for multiline)',t.line,t.col);r+=o==="\\"?xg(e,t):o}throw new Oe("unterminated string",t.line,t.col)}function xg(e,t){if(e.done)throw new Oe("unterminated escape sequence",t.line,t.col);let r=e.advance();switch(r){case'"':return'"';case"\\":return"\\";case"n":return`
11
+ `;case"t":return" ";default:throw new Oe(`invalid escape '\\${r}'`,t.line,t.col)}}function Sg(e,t){return e.startsWith('"""')?yg(e,t):bg(e,t)}function js(e,t){return me("string",Sg(e,t),t)}function Xs(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(Is(t))return Ds(e,r);if(Cg(e,t))return null;let o=kg(e,t,r)??Rg(e,r);if(o)return o;throw new Oe(`unexpected character '${t}'`,r.line,r.col)}function Cg(e,t){return zs(t)?(Ys(e),!0):Gs(e)?(_s(e),!0):!1}function kg(e,t,r){let o=Ws(e,r);return o||(t==='"'?js(e,r):Vs(e,r))}function Rg(e,t){return Fs(e)?Hs(e,t):Os(e)?Bs(e,t):null}function qs(e){let t=new Qr(e),r=[];for(;!t.done;){let o=Xs(t);o&&r.push(Un(o,t))}return r.push(Un(me("eof","",t.position()),t)),r}var j=class extends Error{constructor(r,o,n){super(`SFL parse error (${o}:${n}): ${r}`);this.line=o;this.col=n;this.name="SflParseError"}line;col};var Jr=class{constructor(t){this.tokens=t}tokens;position=0;peek(t=0){return this.tokens[Math.min(this.position+t,this.tokens.length-1)]}at(t){return this.peek().type===t}next(){return this.tokens[this.position++]}expect(t,r){let o=this.peek();if(o.type!==t)throw new j(`expected ${r}, got '${o.value||o.type}'`,o.line,o.col);return this.next()}expectNumber(t){let r=this.expect("number",t);if(r.numberValue===void 0)throw new j(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function dr(e){let t=[e.expect("ident","path identifier").value];for(;e.at("dot");)e.next(),t.push(e.expect("ident",'identifier after "."').value);return t}function Ks(e){let t=dr(e),r,o;if(e.at("comma")){e.next();let n=e.expect("ident",'side after ","');if(!As(n.value))throw new j(`expected a side (top/right/bottom/left), got '${n.value}'`,n.line,n.col);r=n.value,e.at("lparen")&&(e.next(),o=e.expectNumber('fraction inside "("'),e.expect("rparen","')'"))}return{type:"endpoint",segments:t,side:r,fraction:o}}function wg(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(eo(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(eo(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}var vg=new Set(["+","-","*","/",">","<",">=","<=","==","!=","&&","||"]);function Pg(e){let t=e.peek();if(t.type==="op"&&t.value==="-")return!0;if(t.type!=="number"&&t.type!=="ident"&&t.type!=="lparen")return!1;for(let r=0;;r++){let o=e.peek(r);if(o.type==="newline"||o.type==="semi"||o.type==="rbrace"||o.type==="eof")return!1;if(o.type==="lparen"||o.type==="op"&&vg.has(o.value)||o.type==="ident"&&e.peek(r-1).type==="comma"||r===0&&o.type==="ident"&&e.peek(1).type==="comma")return!0}}function Lg(e){let t=[st(e)];for(;e.at("comma");)e.next(),t.push(st(e));return{type:"expr",items:t}}function eo(e,t=!0){if(t&&Pg(e))return Lg(e);let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return wg(e);case"number":{let o=e.expectNumber("number");if(!t||!e.at("comma"))return{type:"number",value:o};let n=[o];for(;e.at("comma");)e.next(),n.push(e.expectNumber("number in tuple"));return{type:"tuple",values:n}}case"ident":return{type:"ident",segments:dr(e)};default:throw new j(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var Mg=new Set([">","<",">=","<=","==","!="]);function Tg(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function cr(e,t,r){let o=r(e);for(;Tg(e,t);)o={kind:"binary",operator:e.next().value,left:o,right:r(e)};return o}var $g=new Set(["||"]),Ag=new Set(["&&"]),Eg=new Set(["+","-"]),Ng=new Set(["*","/"]);function st(e){return cr(e,$g,Og)}function Og(e){return cr(e,Ag,Bg)}function Bg(e){return cr(e,Mg,Ig)}function Ig(e){return cr(e,Eg,Dg)}function Dg(e){return cr(e,Ng,Js)}function Js(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:Js(e)}):_g(e)}function Gg(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(st(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new j(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function _g(e){let t=e.peek();switch(t.type){case"number":return{kind:"number",value:e.expectNumber("number")};case"string":return e.next(),{kind:"string",value:t.value};case"lparen":{e.next();let r=st(e);return e.expect("rparen","')'"),r}case"ident":{let r=dr(e);return r.length===1&&(r[0]==="true"||r[0]==="false")?{kind:"boolean",value:r[0]==="true"}:e.at("lparen")?{kind:"call",callee:r,args:Gg(e)}:{kind:"ref",path:r}}default:throw new j(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var Fg=["bind","bind2","action"];function to(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&Fg.includes(e.peek(2).type)}function ro(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,o=st(e),n=e.peek();if(!["newline","semi","rbrace","eof"].includes(n.type))throw new j(`unexpected '${n.value||n.type}' after binding`,n.line,n.col);return{key:t.value,operator:r,expr:o,line:t.line,col:t.col}}function Zs(e){let t=e.peek(),r=dr(e);e.expect("bind","'<-'");let o=st(e);return{target:r,expr:o,line:t.line,col:t.col}}function el(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function tl(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(Zs(e)),Qs(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new j(`unterminated handler '${t.value}'`,t.line,t.col);r.push(Zs(e)),Qs(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function Qs(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new j(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var oo=class{constructor(t){this.cursor=t}cursor;parseLayout(){return this.cursor.next(),{properties:this.parsePropertyBlock("layout")}}parseStyle(){this.cursor.next(),this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let t=[],r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let o=this.cursor.peek();throw new j("unterminated style block",o.line,o.col)}to(this.cursor)?(r.push(ro(this.cursor)),(this.cursor.at("newline")||this.cursor.at("semi"))&&this.cursor.next()):t.push(this.parseProperty()),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r.length?{properties:t,bindings:r}:{properties:t}}parseFields(){return this.cursor.next(),this.parsePropertyBlock("fields")}parseProperty(){let t=this.cursor.expect("ident","property key").value;this.cursor.expect("colon","':'");let r=t==="from"||t==="to"?Ks(this.cursor):eo(this.cursor);return this.consumeTerminator(),{key:t,value:r}}parsePropertyBlock(t){this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let o=this.cursor.peek();throw new j(`unterminated ${t} block`,o.line,o.col)}r.push(this.parseProperty()),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r}consumeTerminator(){if(this.cursor.at("newline")||this.cursor.at("semi")){this.cursor.next();return}if(this.cursor.at("rbrace")||this.cursor.at("eof"))return;let t=this.cursor.peek();throw new j(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var no=class{constructor(t){this.cursor=t;this.properties=new oo(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!Zr(t.value))throw new j(`unknown block kind '${t.value}'`,t.line,t.col);let r=this.cursor.expect("ident","block name"),o=this.parseComposition(),n=this.parseBlockEntries();return{kind:t.value,name:r.value,composition:o,entries:n}}parseComposition(){if(!this.cursor.at("colon"))return[];this.cursor.next();let t=[this.cursor.expect("ident",'reference name after ":"').value];for(;this.cursor.at("amp");)this.cursor.next(),t.push(this.cursor.expect("ident",'reference name after "&"').value);return t}parseBlockEntries(){return this.parseEntries(()=>this.parseBlockEntry())}parseDataEntries(){return this.parseEntries(()=>this.parseDataEntry())}parseEntries(t){this.cursor.skipNewlines(),this.cursor.expect("lbrace","'{'");let r=[];for(this.cursor.skipNewlines();!this.cursor.at("rbrace");){if(this.cursor.at("eof")){let o=this.cursor.peek();throw new j('unterminated block (missing "}")',o.line,o.col)}r.push(t()),this.cursor.at("semi")&&this.cursor.next(),this.cursor.skipNewlines()}return this.cursor.expect("rbrace","'}'"),r}parseBlockEntry(){let t=this.cursor.peek();if(t.type!=="ident")throw new j(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return Zr(t.value)&&this.cursor.peek(1).type==="ident"?{type:"block",block:this.parseBlock()}:t.value==="layout"&&this.cursor.peek(1).type==="lbrace"?{type:"layout",layout:this.properties.parseLayout()}:t.value==="style"&&this.cursor.peek(1).type==="lbrace"?{type:"style",style:this.properties.parseStyle()}:t.value==="fields"&&this.cursor.peek(1).type==="lbrace"?{type:"fields",fields:this.properties.parseFields()}:to(this.cursor)?{type:"binding",binding:ro(this.cursor)}:el(this.cursor)?{type:"handler",handler:tl(this.cursor)}:t.value==="data"&&this.cursor.peek(1).type==="lbrace"?{type:"data",data:this.parseDataBlock()}:{type:"property",property:this.properties.parseProperty()}}parseDataEntry(){let t=this.cursor.peek();return t.type==="ident"&&!Zr(t.value)&&this.looksLikeSeriesEntry()?{type:"block",block:this.parseSeriesEntry()}:this.parseBlockEntry()}parseDataBlock(){return this.cursor.next(),{kind:"data",name:"",composition:[],entries:this.parseDataEntries()}}looksLikeSeriesEntry(){if(this.cursor.peek(1).type==="lbrace")return!0;if(this.cursor.peek(1).type!=="colon")return!1;let t=2;if(this.cursor.peek(t).type!=="ident")return!1;for(t++;this.cursor.peek(t).type==="amp";){if(t++,this.cursor.peek(t).type!=="ident")return!1;t++}return this.cursor.peek(t).type==="lbrace"}parseSeriesEntry(){let t=this.cursor.expect("ident","series name"),r=this.parseComposition(),o=this.parseBlockEntries();return{kind:"Series",name:t.value,composition:r,entries:o}}};var io=class{constructor(t){this.cursor=t;this.blocks=new no(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new j(`document must start with 'sfl', got '${t.value}'`,t.line,t.col);let r=this.cursor.expect("number","version number");this.cursor.skipNewlines();let o=[];for(;!this.cursor.at("eof");)o.push(this.blocks.parseBlock()),this.cursor.skipNewlines();return{version:r.value,blocks:o}}};function jn(e){return new io(new Jr(qs(e))).parseDocument()}var Hg=new Set(["columns","rows","count","step","origin","seed","jitter","chance","order","where"]),rl=2e4,Vg=1e6,ao=class{state;constructor(t){this.state=t>>>0}next(){this.state=this.state+1831565813>>>0;let t=this.state;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}};function Ve(e,t){throw new Error(`Repeat ${e.repeat}: ${t}`)}function Z(e,t,r){return(typeof t!="number"||!Number.isFinite(t))&&Ve(e,`${r} needs a number`),t}function Xn(e,t){let r=typeof t=="string"?/^#([0-9a-f]{6})$/i.exec(t):null;r||Ve(e,'a color has to be written as "#rrggbb"');let o=Number.parseInt(r[1],16);return[o>>16&255,o>>8&255,o&255]}var ol=e=>`#${e.map(t=>Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0")).join("")}`;function Wg(e,t,r){let o=n=>Z(e,r[n],`${t}()`);switch(t){case"random":{if(r.length===0)return e.random.next();let n=r.length===1?0:o(0),i=r.length===1?o(0):o(1);return n+e.random.next()*(i-n)}case"pick":return r.length===0&&Ve(e,"pick() needs at least one value"),r[Math.floor(e.random.next()*r.length)];case"exp":return Math.exp(o(0));case"pow":return o(0)**o(1);case"dist":return Math.hypot(o(0)-o(2),o(1)-o(3));case"mix":{let n=Xn(e,r[0]),i=Xn(e,r[1]),a=Math.max(0,Math.min(1,o(2)));return ol(n.map((s,l)=>s+(i[l]-s)*a))}case"shade":{let n=o(1);return ol(Xn(e,r[0]).map(i=>i*n))}case"floor":return Math.floor(o(0));case"ceil":return Math.ceil(o(0));case"round":return Math.round(o(0));case"abs":return Math.abs(o(0));case"sqrt":return Math.sqrt(o(0));case"sin":return Math.sin(o(0));case"cos":return Math.cos(o(0));case"min":return Math.min(...r.map((n,i)=>o(i)));case"max":return Math.max(...r.map((n,i)=>o(i)));case"when":return r[0]?r[1]:r[2];default:return Ve(e,`unknown function ${t}()`)}}function vt(e,t){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"ref":{let r=t.path.join("."),o=e.vars.get(r);return o===void 0&&Ve(e,`unknown name ${r}`),o}case"unary":{let r=vt(e,t.operand);return t.operator==="-"?-Z(e,r,"a minus"):!r}case"call":return Wg(e,t.callee.join("."),t.args.map(r=>vt(e,r)));case"binary":{let r=vt(e,t.left),o=vt(e,t.right);switch(t.operator){case"+":return typeof r=="string"||typeof o=="string"?`${r}${o}`:Z(e,r,"+")+Z(e,o,"+");case"-":return Z(e,r,"-")-Z(e,o,"-");case"*":return Z(e,r,"*")*Z(e,o,"*");case"/":return Z(e,r,"/")/Z(e,o,"/");case">":return Z(e,r,">")>Z(e,o,">");case"<":return Z(e,r,"<")<Z(e,o,"<");case">=":return Z(e,r,">=")>=Z(e,o,">=");case"<=":return Z(e,r,"<=")<=Z(e,o,"<=");case"==":return r===o;case"!=":return r!==o;case"&&":return!!r&&!!o;case"||":return!!r||!!o}}}}var so=e=>Math.round(e*1e3)/1e3;function Zn(e,t){if(t.type!=="expr")return t;let r=t.items.map(o=>vt(e,o));if(r.length===1){let[o]=r;return typeof o=="number"?{type:"number",value:so(Z(e,o,"a value"))}:typeof o=="string"?{type:"string",value:o}:{type:"ident",segments:[String(o)]}}return{type:"tuple",values:r.map(o=>so(Z(e,o,"a tuple")))}}function nl(e,t){return t.map(r=>({key:r.key,value:Zn(e,r.value)}))}function zg(e,t,r){switch(t.type){case"property":return{type:"property",property:{key:t.property.key,value:Zn(e,t.property.value)}};case"layout":return{type:"layout",layout:{properties:nl(e,t.layout.properties)}};case"style":return{type:"style",style:{...t.style,properties:nl(e,t.style.properties)}};case"block":return{type:"block",block:al(e,t.block,r)};default:return t}}function al(e,t,r){return{...t,name:`${t.name}${r}`,entries:t.entries.map(o=>zg(e,o,r))}}function qn(e,t){for(let r of e.entries)if(r.type==="property"&&r.property.key===t)return r.property.value}function Ze(e,t){for(let r of e.entries)if(r.type==="property"&&r.property.key===t){let o=r.property.value;if(o.type==="number")return[o.value];if(o.type==="tuple")return o.values}}function il(e){let t={vars:new Map,random:new ao(0),repeat:e.name},r=Ze(e,"count")?.[0],o=Math.max(1,Math.floor(r??Ze(e,"columns")?.[0]??1)),n=r===void 0?Math.max(1,Math.floor(Ze(e,"rows")?.[0]??1)):1,i=o*n;i>rl&&Ve(t,`${i} cells are too many, the limit is ${rl}`);let[a=0,s=a]=Ze(e,"step")??[],[l=0,d=0]=Ze(e,"origin")??[],c=Ze(e,"seed")?.[0]??0,u=Ze(e,"jitter")?.[0]??0,m=Ze(e,"chance")?.[0]??1,f=qn(e,"order")?.type==="ident"&&qn(e,"order").segments[0]==="diagonal",h=qn(e,"where"),y=e.entries.flatMap(S=>S.type==="property"&&S.property.value.type==="expr"&&!Hg.has(S.property.key)?[S.property]:[]),x=e.entries.flatMap(S=>S.type==="block"?[S.block]:[]);x.some(S=>S.kind==="Repeat")&&Ve(t,"a Repeat cannot hold another Repeat"),i*Math.max(1,x.length)>Vg&&Ve(t,"too many blocks");let b=[];for(let S=0;S<n;S++)for(let w=0;w<o;w++)b.push([w,S]);f&&b.sort((S,w)=>S[0]+S[1]-(w[0]+w[1])||S[0]-w[0]);let C=[];for(let[S,w]of b){let O=w*o+S;if(t.random=new ao(Math.imul(c+1,2654435761)^Math.imul(O+1,2246822507)),m<1&&t.random.next()>=m)continue;let A=()=>u>0?(t.random.next()*2-1)*u:0;t.vars=new Map([["col",S],["row",w],["index",O],["count",i],["columns",o],["rows",n],["x",so(l+S*a+A())],["y",so(d+w*s+A())]]);for(let G of y){let V=Zn(t,G.value);V.type==="number"||V.type==="string"?t.vars.set(G.key,V.value):V.type==="ident"?t.vars.set(G.key,V.segments[0]==="true"?1:0):Ve(t,`${G.key} needs a number`)}if(h&&h.type==="expr"&&!h.items.map(V=>vt(t,V))[0])continue;let _=n===1?`_${S}`:`_${S}_${w}`;for(let G of x)C.push(al(t,G,_))}return C}function sl(e){return e.flatMap(t=>t.kind==="Repeat"?il(t):t.entries.some(r=>r.type==="block")?[{...t,entries:t.entries.flatMap(r=>r.type==="block"?(r.block.kind==="Repeat"?il(r.block):sl([r.block])).map(o=>({type:"block",block:o})):[r])}]:[t])}function Kn(e){for(let t of e)for(let r of t.entries){let o=r.type==="property"?[r.property]:r.type==="layout"?r.layout.properties:r.type==="style"?r.style.properties:[];for(let n of o)if(n.value.type==="expr")throw new Error(`${t.kind} ${t.name}: ${n.key} is computed, and only a Repeat can work out a computed value`);r.type==="block"&&Kn([r.block])}}function ll(e){let t=o=>o.some(n=>n.kind==="Repeat"||n.entries.some(i=>i.type==="block"?t([i.block]):!1));if(!t(e.blocks))return Kn(e.blocks),e;let r={...e,blocks:sl(e.blocks)};return Kn(r.blocks),r}function R(e){if(e){if(e.type==="string")return e.value;if(e.type==="ident")return e.segments.join(".");if(e.type==="number")return String(e.value)}}function v(e){return e?.type==="number"?e.value:void 0}function Le(e){return e?.type==="tuple"?e.values:void 0}function dl(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function Yg(e,t){if(e.length<2)return null;let r=e[e.length-1],o=e[e.length-2],n=t.idByName.get(o);return(n?t.canvasObjectById.get(n):void 0)?.symbol?.ports?.some(a=>a.name===r)?{id:n,port:r}:null}function Pt(e,t){if(e?.type!=="endpoint")return{};let r=Yg(e.segments,t);if(r)return r;let o=e.segments[e.segments.length-1];return{id:t.idByName.get(o)??o,side:e.side,fraction:e.fraction}}function W(e){let t=new Map;for(let r of e.entries)r.type==="property"&&t.set(r.property.key,r.property.value);return t}function lo(e){let t=new Map;for(let r of e.entries)if(r.type==="style")for(let o of r.style.properties)t.set(o.key,o.value);return t}function cl(e){let t=new Map;for(let r of e.entries)if(r.type==="layout")for(let o of r.layout.properties)t.set(o.key,o.value);return t}function X(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function ul(e){for(let t of e.entries)if(t.type==="data")return t.data}function Lt(e){let t=ul(e);return t?[...X(e),...X(t)]:X(e)}function ml(e,t){let r=W(e).get(t);if(r!==void 0)return r;let o=ul(e);return o?W(o).get(t):void 0}var Ug=["Entity","Shape","Text","Container","Path","Chart","Widget","Component","Isometric","Dimension"],jg=new Set(Ug);function Mt(e){return jg.has(e)}function pl(e,t){for(let r of e)Mt(r.kind)&&t.set(r.name,R(W(r).get("id"))??r.name),pl(X(r),t)}function co(e){let t=new Map;return e&&pl(X(e),t),t}var Xg=new Set(["id","from","to","text","order","segments"]);function uo(e){let t={};for(let[r,o]of e){if(Xg.has(r))continue;let n=R(o);n!==void 0&&(t[r]=n)}return t}var qg=new Set(["top","bottom","front","back","left","right"]);function fl(e){return e!==void 0&&qg.has(e)?e:"front"}function hl(e,t,r,o,n=[]){let i={idByName:co(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=o.mergedProps(a);return{id:R(l.get("id"))??a.name,fromId:Pt(l.get("from"),i).id,toId:Pt(l.get("to"),i).id,fromFace:fl(R(l.get("fromFace"))),toFace:fl(R(l.get("toFace"))),order:v(l.get("order")),sourceIndex:n[s],props:uo(l)}})}function gl(e,t,r){let o=t.mergedProps(e),n=Pt(o.get("from"),r),i=Pt(o.get("to"),r);return{id:R(o.get("id"))??e.name,fromId:n.id,toId:i.id,text:R(o.get("text")),fromSide:n.side,fromFraction:n.fraction,toSide:i.side,toFraction:i.fraction,fromPort:n.port,toPort:i.port,order:v(o.get("order")),segments:dl(o.get("segments")),props:uo(o)}}function yl(e,t,r,o,n=[]){let i={idByName:co(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...gl(a,o,i),sourceIndex:n[s]}))}function Kg(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(o=>o.type==="ident"?[o.segments]:[]):[]}function Zg(e,t,r,o,n){let i=[{type:"property",property:{key:"from",value:{type:"endpoint",segments:t}}},{type:"property",property:{key:"to",value:{type:"endpoint",segments:r}}}];return n&&i.push({type:"property",property:{key:"text",value:{type:"string",value:n}}}),{kind:"Link",name:`${e.name}_${o+1}`,composition:[],entries:i}}function bl(e,t){let r=Kg(e,t);if(r.length<2)return[];let o=R(t.mergedProps(e).get("text"));return r.slice(1).map((n,i)=>Zg(e,r[0],n,i,o))}function xl(e,t){let r=R(t.layoutProp(e,"flow")),o=v(t.layoutProp(e,"gap"))??0,n=0;return i=>{if(r!=="horizontal"&&r!=="vertical")return;let a=r==="horizontal"?[n,0]:[0,n];return n+=(r==="horizontal"?i[0]:i[1])+o,a}}var mo=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function Tt(e){return e!==void 0&&mo.includes(e)}function We(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let o=v(r);return o===void 0?[]:[o]});return t.length>0?t:void 0}function Sl(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=R(t);return r===void 0?[]:[r]})}function Be(e){let t=R(e);if(t!==void 0)return t==="true"}function Qn(e){let t=e?W(e):new Map;return{min:v(t.get("min"))??0,max:v(t.get("max"))??10,step:v(t.get("step"))??1,label:R(t.get("label")),unit:R(t.get("unit")),thresholds:We(t.get("thresholds"))}}function Cl(e){return Lt(e).filter(t=>t.kind==="Rule").map(t=>{let r=W(t);return{id:t.name,at:v(r.get("at"))??0,text:R(r.get("text")),color:R(r.get("color")),strokeWidth:v(r.get("strokeWidth")),dash:We(r.get("dash"))}})}function kl(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(v);return t.every(r=>r!==void 0)?t:void 0}function Rl(e){return e?.type!=="list"?[]:Qg(e.values)==="tuple"?ey(e.values):Jg(e.values)}function Qg(e){for(let t of e){if(t.type==="number")return"scalar";if(kl(t))return"tuple"}}function Jg(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function ey(e){return e.flatMap(t=>{let r=kl(t);return r?[r]:[]})}function wl(e){if(e?.type==="list")return e.values.map(ty)}function ty(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:ry(e)}function ry(e){if(e.type!=="list"||e.values.length<2)return null;let t=v(e.values[0]),r=v(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function vl(e){if(e?.type==="list")return e.values.map(oy)}function oy(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:R(e)??null}function Pl(e,t){if(e?.type==="list"){let n=e.values.flatMap(ny);return n.length>0?{points:n}:void 0}let r=R(e),o=r?t.get(r):void 0;if(o)return{points:o.points,normalized:!0,tension:o.tension}}function ny(e){if(e.type!=="list"||e.values.length<2)return[];let t=v(e.values[0]),r=v(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function Ll(e,t,r){let o=r(e);return{id:e.name,label:R(o.get("label"))??e.name,color:R(o.get("color")),colors:vl(o.get("colors")),opacity:v(o.get("opacity")),group:R(o.get("group")),values:Rl(o.get("values")),error:wl(o.get("error")),source:R(o.get("source")),target:R(o.get("target")),size:v(o.get("size")),symbol:Pl(o.get("symbol"),t),stroke:R(o.get("stroke")),strokeWidth:v(o.get("strokeWidth")),dash:We(o.get("dash")),offset:v(o.get("offset")),labelOffsetX:v(o.get("labelOffsetX")),labelOffsetY:v(o.get("labelOffsetY"))}}function Ml(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let o=R(r.values[0]);return o===void 0?[]:[{label:o,color:R(r.values[1]),offsetX:v(r.values[2]),offsetY:v(r.values[3])}]});return t.length>0?t:void 0}var iy=["none","true","percent","waterfall"];function ay(e){return Tt(e)?e:"bar"}function sy(e){return iy.find(t=>t===e)}function Tl(e,t,r,o){let n=Lt(e),i=n.filter(s=>s.kind==="Axis"),a=R(t.get("stacked"));return{chartType:ay(R(t.get("type"))),categories:Sl(ml(e,"categories")),areaOpacity:v(t.get("areaOpacity")),stacked:sy(a),scale:R(t.get("scale")),interpolate:R(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:v(t.get("idwPower")),isolines:We(t.get("isolines")),zones:Ml(t.get("zones")),boxWidth:v(t.get("boxWidth")),orientation:R(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:v(t.get("lineTension")),highlightPoints:We(t.get("highlightPoints")),barCornerRadius:v(t.get("barCornerRadius")),showBoxplotPoints:Be(t.get("showBoxplotPoints")),barBorderColor:R(t.get("barBorderColor")),barBorderWidth:v(t.get("barBorderWidth")),barGroupGap:v(t.get("barGroupGap")),barGlow:v(t.get("barGlow")),barGap:v(t.get("barGap")),mekkoVaryHeight:Be(t.get("mekkoVaryHeight")),hexRadius:v(t.get("hexRadius")),innerRadius:v(t.get("innerRadius")),pieCornerRadius:v(t.get("pieCornerRadius")),pieSliceGap:v(t.get("pieSliceGap")),ringThickness:v(t.get("ringThickness")),ringGap:v(t.get("ringGap")),cellGap:v(t.get("cellGap")),showValues:Be(t.get("showValues")),squareCells:Be(t.get("squareCells")),headerColor:R(t.get("headerColor")),tileGradient:Be(t.get("tileGradient")),showColumnBackdrop:Be(t.get("showColumnBackdrop")),labelPosition:R(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:R(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:R(t.get("labelColor")),linkGradient:Be(t.get("linkGradient")),connectPoints:Be(t.get("connectPoints")),reverseComparison:Be(t.get("reverseComparison")),axisX:Qn(i.find(s=>s.name==="x")),axisY:Qn(i.find(s=>s.name==="y"||s.name==="value")),series:n.filter(s=>s.kind==="Series").map(s=>Ll(s,r,o)),rules:Cl(e)}}function $l(e,t,r,o,n){return{...e,objectType:"chart",chart:Tl(t,r,o,n)}}function Al(e,t){let[r,o]=Le(e)??[];return{x:t.x+(r??0),y:t.y+(o??0)}}function El(e,t){return{start:Al(e.get("start"),t),end:Al(e.get("end"),t),offset:v(e.get("offset"))??0,unit:R(e.get("unit"))}}function Nl(e,t,r){return{...e,objectType:"dimension",dimension:El(t,r)}}function fo(e,t){return Math.max(0,t.tension??e.tension)}function ho(e){return e.points.length<3||e.points.every(t=>fo(e,t)<=0)}function po(e,t){let{points:r}=e;return e.closed?r[(t+r.length)%r.length]:r[Math.max(0,Math.min(r.length-1,t))]}function go(e){let t=e.closed?e.points.length:e.points.length-1;return Array.from({length:Math.max(0,t)},(r,o)=>{let n=po(e,o-1),i=po(e,o),a=po(e,o+1),s=po(e,o+2),l=fo(e,i)/6,d=fo(e,a)/6;if(l===0&&d===0)return{from:i,to:a,controls:null};let c={x:i.x+(a.x-n.x)*l,y:i.y+(a.y-n.y)*l},u={x:a.x-(s.x-i.x)*d,y:a.y-(s.y-i.y)*d};return{from:i,to:a,controls:[c,u]}})}function ly(e,t){let{from:r,to:o,controls:n}=e,i=1-t,a=[i*i*i,3*i*i*t,3*i*t*t,t*t*t],s=[r,n[0],n[1],o];return{x:s.reduce((l,d,c)=>l+d.x*a[c],0),y:s.reduce((l,d,c)=>l+d.y*a[c],0)}}function Jn(e,t=8){if(ho(e))return e.points.map(i=>({x:i.x,y:i.y}));let r=[],o=go(e);o.forEach(i=>{if(r.push({x:i.from.x,y:i.from.y}),i.controls){let a={...i,controls:i.controls};for(let s=1;s<t;s++)r.push(ly(a,s/t))}});let n=o[o.length-1];return!e.closed&&n&&r.push({x:n.to.x,y:n.to.y}),r}function dy(e){if(e.type!=="list"||e.values.length<2)return[];let t=v(e.values[0]),r=v(e.values[1]),o=e.values[2]===void 0?void 0:v(e.values[2]);return t===void 0||r===void 0?[]:[o===void 0?{x:t,y:r}:{x:t,y:r,tension:o}]}function Ol(e,t){let r=Jn({points:e,tension:t,closed:!0});return r.length>=3?r.map(o=>[o.x,o.y]):void 0}function cy(e,t){if(e?.type==="list")return Ol(e.values.flatMap(dy),0);let r=R(e),o=r?t.get(r):void 0;if(!o)return;let n=o.points.map(([i,a],s)=>{let l=o.pointTensions?.[s];return l===void 0?{x:i,y:a}:{x:i,y:a,tension:l}});return Ol(n,o.tension??0)}function Bl(e,t,r){return{depth:t,icon:R(e.get("icon")),footprint:cy(e.get("symbol"),r),form:R(e.get("shape"))==="sphere"?"sphere":"box"}}function Il(e,t,r,o,n){let i=Le(o(t,"size"));return{...e,objectType:"isometric",isometric:Bl(r,i?.[2]??24,n)}}function Dl(e,t){let r=e.get("points");return{points:r?.type==="list"?r.values.flatMap(n=>{if(n.type!=="list"||n.values.length<2)return[];let i=v(n.values[0]),a=v(n.values[1]),s=n.values[2]===void 0?void 0:v(n.values[2]);if(i===void 0||a===void 0)return[];let l={x:t.x+i,y:t.y+a};return[s===void 0?l:{...l,tension:s}]}):[],tension:v(e.get("tension")),startMarker:R(e.get("startMarker")),endMarker:R(e.get("endMarker")),closed:R(e.get("closed"))==="true",value:v(e.get("value"))}}function Gl(e,t,r){return{...e,objectType:"path",path:Dl(t,r)}}function _l(e){let t=R(e.get("orientation"))==="vertical"?"vertical":"horizontal",r=e.get("lanes"),o=r?.type==="list"?r.values.flatMap((i,a)=>{if(i.type!=="list")return[];let s=R(i.values[0]),l=v(i.values[1]);if(s===void 0||l===void 0)return[];let d=R(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:o}}function Fl(e,t){return{...e,objectType:"swimlane",swimlane:_l(t)}}function uy(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":lr(e.kind)?R(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":e.kind==="Dimension"?"dimension":R(t.get("kind"))??""}function my(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":at(e)?"component":e==="isometric"?"isometric":e==="dimension"?"dimension":"shape"}function Hl(e,t,r){let o=uy(e,t),n=R(t.get("shape")),i=n?r.get(n):void 0;return{objectType:lr(e.kind)?"component":my(o),kind:o,shapeType:i?"symbol":n,symbol:i}}function Vl(e,t,r,o){let n=o??Le(r(e,"position"))??[0,0],i=Le(r(e,"size"))??[0,0];return{x:t.x+(n[0]??0),y:t.y+(n[1]??0),width:i[0]??0,height:i[1]??0,rotation:v(r(e,"rotation")),order:v(r(e,"order"))}}var py=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function Wl(e){let t={};for(let[r,o]of e){if(py.has(r))continue;let n=R(o);n!==void 0&&(t[r]=n)}return t}function zl(e,t,r,o,n){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=Hl(e,l,s),c=Vl(e,t,a,n),u={id:R(l.get("id"))??e.name,kind:d.kind,text:R(l.get("text")),...c,parentFrameId:o??R(l.get("parent")),props:Wl(l)};switch(d.objectType){case"chart":return $l(u,e,l,s,i);case"isometric":return Il(u,e,l,a,s);case"path":return Gl(u,l,t);case"dimension":return Nl(u,l,t);case"swimlane":return Fl(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:R(l.get("type"))??"rollingNumber",value:R(l.get("value"))??"0",digits:v(l.get("digits")),duration:v(l.get("duration")),min:v(l.get("min")),max:v(l.get("max")),label:R(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function Yl(e){return X(e).filter(t=>Mt(t.kind)).map(t=>R(W(t).get("id"))??t.name)}var ei=class{#e;#o=[];#t=[];#r=[];#n=[];#i=[];#s=0;constructor(t){this.#e=t.canvasObjectResolutionContext}resolve(t){let r=t?this.#a(t,{origin:{x:0,y:0}}):[];return{canvasObjects:this.#o,groups:r,linkBlocks:this.#t,connectionBlocks:this.#r,linkSourceIndexes:this.#n,connectionSourceIndexes:this.#i}}#a(t,r){let o=[],n=xl(t,this.#e);for(let i of X(t))o.push(...this.#l(i,r,n));return o}#l(t,r,o){let n=this.#s++;if(t.kind==="Container")return this.#c(t,r,o,n);if(Mt(t.kind))return this.#u(t,r,o,n),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#t.push(t),this.#n.push(n),[];case"Connection":return this.#r.push(t),this.#i.push(n),[];case"Net":{let i=bl(t,this.#e);return this.#t.push(...i),this.#n.push(...i.map(()=>n)),[]}default:return[]}}#c(t,r,o,n){let i=this.#d(t,r,o,n);return this.#o.push(i),this.#a(t,{origin:{x:i.x,y:i.y},frameId:i.id})}#u(t,r,o,n){this.#o.push(this.#d(t,r,o,n))}#d(t,r,o,n){let i=Le(this.#e.layoutProp(t,"size"))??[0,0];return{...zl(t,r.origin,this.#e,r.frameId,o(i)),sourceIndex:n}}#m(t,r){let o=this.#e.mergedProps(t);return{id:R(o.get("id"))??t.name,name:R(o.get("text"))??t.name,color:R(o.get("color")),icon:R(o.get("icon")),canvasObjectIds:Yl(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??R(o.get("parent"))}}};function Ul(e,t){return new ei(t).resolve(e)}function jl(e){let t=W(e),r=R(t.get("program")),o=v(t.get("surfacePadding"));if(!r)return;let n={};for(let[i,a]of t){if(i==="program"||i==="surfacePadding")continue;let s=v(a),l=R(a);s!==void 0?n[i]=s:l!==void 0&&(n[i]=l==="true"?!0:l==="false"?!1:l)}return{name:e.name,program:r,...o===void 0?{}:{surfacePadding:Math.max(0,o)},parameters:n}}function fy(e){let t=W(e).get("points"),r=[],o=[];if(t?.type!=="list")return{points:r,tensions:o};for(let n of t.values){if(n.type!=="list"||n.values.length<2)continue;let i=v(n.values[0]),a=v(n.values[1]);i===void 0||a===void 0||(r.push([i,a]),o.push(n.values[2]===void 0?void 0:v(n.values[2])))}return{points:r,tensions:o}}function hy(e){let t=X(e).filter(r=>r.kind==="Port").flatMap(r=>{let o=Le(W(r).get("at"));return typeof o?.[0]!="number"||typeof o[1]!="number"?[]:[{name:r.name,at:[o[0],o[1]]}]});return t.length>0?t:void 0}function Xl(e){let{points:t,tensions:r}=fy(e);if(!(t.length<2))return{name:e.name,points:t,pointTensions:r.some(o=>o!==void 0)?r:void 0,tension:v(W(e).get("tension")),ports:hy(e)}}function gy(e){return X(e).find(t=>t.kind==="Model")}function ql(e){return{styles:by(e),layouts:xy(e),symbols:Sy(e),shaders:yy(e),model:Cy(e)}}function yy(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let o=jl(r);o&&t.set(r.name,o)}return t}function by(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function xy(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function Sy(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let o=Xl(r);o&&t.set(r.name,o)}return t}function Cy(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=gy(t);if(r)return r}}}function Kl(e,t,r){let o,n;for(let i of e)t.has(i)?o=i:r.has(i)&&(n=i);return{styleRef:o,layoutRef:n}}function Zl(e,t,r,o){for(let n of e.composition)!t.has(n)&&!r.has(n)&&o.push({severity:"warning",code:"unresolved-style-or-layout",ownerId:e.name,message:`"${n}" is not a Style or Layout defined at the top level of the document \xC3\xA2\xE2\u201A\xAC\xE2\u20AC\x9D "${e.name}" gets no shape, fill, or stroke from it.`});for(let n of X(e))Zl(n,t,r,o)}function Ql(e,t,r){let o=[];for(let n of e.blocks)Zl(n,t,r,o);return o}function ri(e,t){return new ti(e,t).resolveAll()}var ti=class{#e;#o;#t=new Map;constructor(t,r){this.#e=t,this.#o=r}resolveAll(){for(let t of this.#e.keys())this.#r(t,new Set);return this.#t}#r(t,r){let o=this.#t.get(t);if(o)return o;let n=this.#e.get(t);if(!n||r.has(t))return new Map;let i=this.#n(n,new Set([...r,t]));for(let[a,s]of W(n))i.set(a,s);return this.#t.set(t,i),i}#n(t,r){let o=this.#o(t);return o?new Map(this.#r(o,r)):new Map}};function Jl(e){let{styles:t,layouts:r,symbols:o,shaders:n}=e,i=c=>Kl(c.composition,t,r),a=ri(t,c=>i(c).styleRef),s=ri(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[m,f]of W(c))u.set(m,f);for(let[m,f]of lo(c))u.set(m,f);return u},layoutProp:(c,u)=>{let m=cl(c);if(m.has(u))return m.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:o,shaderDefs:n}}var ky=new Set(["radar","radial"]),ed=new Set(["scatter","custom","hexbin"]);function td(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=R(W(o).get("type"));n!==void 0&&!Tt(n)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:o.name,message:`Unsupported chart type '${n}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn as a plain series plot. Supported: ${mo.join(", ")}.`})}for(let n of X(o))r(n)};for(let o of e.blocks)r(o);return t}function rd(e){let t=[],r=o=>{if(o.kind==="Chart")for(let n of Lt(o).filter(i=>i.kind==="Series"))W(n).has("values")||t.push({severity:"warning",code:"series-without-values",ownerId:n.name,message:`Series '${n.name}' has no values. If this was meant to be an Axis or Rule, it needs that keyword in front of the name \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D inside data{}, a bare name is read as a Series.`});for(let n of X(o))r(n)};for(let o of e.blocks)r(o);return t}function od(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=R(W(o).get("type")),i=Tt(n)?n:"bar";R(lo(o).get("gridShape"))==="circle"&&!ed.has(i)&&!ky.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:o.name,message:`gridShape: circle isn't supported on '${i}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn with the standard rectangular grid instead. Supported: ${[...ed].join(", ")}.`})}for(let n of X(o))r(n)};for(let o of e.blocks)r(o);return t}function nd(e){let t=[],r=o=>{if(lr(o.kind)){let n=R(W(o).get("type"))??"rollingNumber";zn(n)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:o.name,message:`Unsupported component type '${n}'. Supported: ${Wn().join(", ")}.`})}for(let n of X(o))r(n)};for(let o of e.blocks)r(o);return t}var Ry=new Set(["Shape","Text","Container","Chart","Path","Widget","Component","Entity","Isometric","Group"]),wy=new Set(["Link","Connection"]);function id(e){let t=new Map,r=n=>{let i=Ry.has(n.kind)?"object":wy.has(n.kind)?"link":void 0;if(i){let a=`${i}:${n.name}`;t.set(a,(t.get(a)??0)+1)}for(let a of X(n))r(a)};for(let n of e.blocks)r(n);let o=[];for(let[n,i]of t)if(i>1){let a=n.slice(n.indexOf(":")+1);o.push({severity:"warning",code:"duplicate-name",ownerId:a,message:`The name '${a}' is used ${i} times. A name must be unique in a document, so give each block its own.`})}return o}function ad(e){let t=ql(e);return{model:t.model,diagnostics:[...Ql(e,t.styles,t.layouts),...td(e),...od(e),...rd(e),...nd(e),...id(e)],canvasObjectResolutionContext:Jl(t)}}function sd(e){let t=ad(e),{canvasObjects:r,groups:o,linkBlocks:n,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=Ul(t.model,t),l=yl(t.model,n,r,t.canvasObjectResolutionContext,a),d=hl(t.model,i,r,t.canvasObjectResolutionContext,s);return{canvasObjects:r,groups:o,links:l,connections:d,diagnostics:t.diagnostics,shaders:[...t.canvasObjectResolutionContext.shaderDefs.values()]}}function ur(e){return e.objectType==="dimension"&&e.dimension!==void 0}function mr(e){return e.objectType==="isometric"&&e.isometric!==void 0}function ld(e){return sd(ll(jn(e)))}var pr=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function My(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${pr})\\s+([-\\d.]+)%`,"g");for(let n of t[2].matchAll(o))r.push({color:n[1],position:Number(n[2])});return{type:"gradient",angle:Number(t[1]),stops:r}}function Ty(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${pr})\\s+([-\\d.]+)\\s*,\\s*([-\\d.]+)`,"g"),n=0;for(let i of t[1].matchAll(o))r.push({id:`mp-${Date.now()}-${n++}`,color:i[1],x:Number(i[2]),y:Number(i[3])});return{type:"mesh",points:r}}function be(e){if(!(e==null||e===""))return My(e)??Ty(e)??e}function yo(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${pr})\\s+([-\\d.]+)`,"g");for(let n of t[1].matchAll(o))r.push({color:n[1],position:Number(n[2])});return{type:"ramp",stops:r}}function $y(e,t,r){switch(t){case"color":e.color=r;break;case"opacity":e.opacity=Number(r);break;case"blur":e.blur=Number(r);break;case"angle":e.angle=Number(r);break;case"distance":e.distance=Number(r);break}}function Me(e){if(!e)return;if(e==="on")return{enabled:!0};let t=e.match(/^shadow\((.*)\)\s*$/);if(!t)return;let r={enabled:!0};for(let o of t[1].split(",")){let n=o.split(":");n.length===2&&$y(r,n[0].trim(),n[1].trim())}return r}var k=e=>e===void 0?void 0:Number(e);function Ay(e){try{return JSON.parse(e)}catch{return}}function Qe(e){if(e===void 0)return;let t=Ay(e);if(!Array.isArray(t))return;let r=t.filter(o=>typeof o=="number"&&Number.isFinite(o));return r.length===t.length?r:void 0}function xe(e){let t=be(e);return typeof t=="string"?t:void 0}var Ey=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function Se(e){return e&&Ey.test(e)?e:void 0}function Ie(e,t,r){return t.includes(e)?e:r}var bo=["normal","bold"],dd=["normal","bold","100","200","300","400","500","600","700","800","900"],cd=["top","bottom","left","right"],oi=["none","arrow","filled_arrow"];function $t(e){let t=be(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var ud=["left","center","right"],md=["top","middle","bottom"],xo=["solid","dashed","dotted"],So=["straight","curved","orthogonal"];function fe(e,t){return e!==void 0&&t.includes(e)?e:void 0}var pd=["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fd=["solid","dashed","dotted","double"],ni=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function Ny(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function Oy(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function By(e){return e==="dashed"||e==="dotted"?e:"solid"}function Iy(e){return{axisX:e.chart?.axisX??{min:0,max:4,step:1},axisY:e.chart?.axisY??{min:0,max:500,step:100},series:(e.chart?.series??[]).map(t=>({...t,color:be(t.color),colors:t.colors?.map(r=>r===null?null:be(r)??null),strokeWidth:t.strokeWidth})),rules:(e.chart?.rules??[]).map(t=>({id:t.id,at:t.at,text:t.text,color:t.color,strokeWidth:t.strokeWidth,dash:t.dash}))}}function Dy(e){let t=Ny(e.fill);return{fillColor:t?"#111418":be(e.fill)??"#ffffff",fillImage:t,strokeColor:xe(e.stroke)??"#475569",strokeWidth:k(e.strokeWidth)??1,cornerRadius:k(e.cornerRadius)??12,shadowStyle:Me(e.shadow)}}function Gy(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:k(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:By(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function _y(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:k(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:k(e.tickLength),axisFontSize:k(e.axisFontSize),axisLabelAngle:k(e.axisLabelAngle),axisLabelSpace:k(e.axisLabelSpace),rowLabelSide:e.rowLabelSide==="left"||e.rowLabelSide==="right"?e.rowLabelSide:void 0,columnLabelSide:e.columnLabelSide==="top"||e.columnLabelSide==="bottom"?e.columnLabelSide:void 0,legendSide:e.legendSide==="top"||e.legendSide==="bottom"||e.legendSide==="left"||e.legendSide==="right"?e.legendSide:void 0,xLabelGap:k(e.xLabelGap),yLabelGap:k(e.yLabelGap),axisLabelAlign:e.axisLabelAlign==="left"||e.axisLabelAlign==="center"||e.axisLabelAlign==="right"?e.axisLabelAlign:void 0,axisFontFamily:e.axisFontFamily,showValueAxis:e.showValueAxis!=="false",categoryAlign:e.categoryAlign==="left"||e.categoryAlign==="inside"?e.categoryAlign:void 0,showAxisLabels:e.showAxisLabels!=="false"}}function Fy(e){return{textColor:e.textColor??"#0f172a",titleSize:k(e.titleSize),titleAlign:e.titleAlign==="left"||e.titleAlign==="center"||e.titleAlign==="right"?e.titleAlign:void 0,titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:k(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function Hy(e){return{legendColor:e.legendColor,legendGap:k(e.legendGap),showLegend:e.showLegend==="true",legendPosition:Oy(e.legendPosition)}}function hd(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,...Iy(e),...Dy(t),...Gy(t),..._y(t),...Fy(t),...Hy(t),order:e.order,sourceIndex:e.sourceIndex}}function gd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:be(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:k(t.barSegments),barSegmentGap:k(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:k(t.barGlassBlur),barGlassSaturation:k(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:k(t.barThickness),orientation:e?.orientation,barTrack:t.barTrack==="true",barRoundedBottom:t.barRoundedBottom==="true",barLabelMaxOnly:t.barLabelMaxOnly==="true",barTrackColor:t.barTrackColor,barTrackHatch:t.barTrackHatch==="true",barTrackHatchColor:t.barTrackHatchColor,barTrackHatchAngle:k(t.barTrackHatchAngle),barTrackHatchSpacing:k(t.barTrackHatchSpacing),barTrackHatchWidth:k(t.barTrackHatchWidth),stacked:e?.stacked??"true",showBarLabels:t.showBarLabels==="true",barLabelPosition:t.barLabelPosition==="inside"||t.barLabelPosition==="center"||t.barLabelPosition==="axis"?t.barLabelPosition:void 0,barLabelFontSize:k(t.barLabelFontSize),barLabelFontFamily:t.barLabelFontFamily,barLabelFontWeight:t.barLabelFontWeight==="bold"?"bold":void 0,barLabelColor:t.barLabelColor,barLabelPill:t.barLabelPill==="true",barLabelPillColor:t.barLabelPillColor,barLabelBorderColor:t.barLabelBorderColor,barLabelBorderWidth:k(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function yd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:k(t.lineWidth),lineGlow:k(t.lineGlow),pointSize:k(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:k(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:k(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function bd(e,t){return{categories:e?.categories,pointSize:k(t.pointSize),pointOpacity:k(t.pointOpacity),pointStrokeWidth:k(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function xd(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:k(t.boxWhiskerWidth),boxMedianWidth:k(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:k(t.boxCapSize),boxPointSize:k(t.boxPointSize),boxPointOpacity:k(t.boxPointOpacity),boxJitter:k(t.boxJitter)}}function Sd(e){return{scale:yo(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function Cd(e,t){return{categories:e?.categories,zones:e?.zones,cellGap:e?.cellGap,showValues:e?.showValues,squareCells:e?.squareCells,barCornerRadius:e?.barCornerRadius,cellShape:t.cellShape==="circle"?"circle":t.cellShape==="square"?"square":void 0,cellStrokeColor:t.cellStrokeColor,cellStrokeWidth:k(t.cellStrokeWidth),cellValueSize:k(t.cellValueSize),cellValueColor:t.cellValueColor}}function kd(e,t){return{hexRadius:e?.hexRadius,scale:yo(e?.scale),hexGap:k(t.hexGap),hexStrokeWidth:k(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:k(t.hexMinOpacity)}}function Rd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:k(t.mekkoColumnGap),mekkoSegmentGap:k(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:k(t.mekkoSegmentStrokeWidth),mekkoLabelSize:k(t.mekkoLabelSize),mekkoValueSize:k(t.mekkoValueSize),mekkoTextColor:t.mekkoTextColor,showMekkoTotals:t.showMekkoTotals===void 0?void 0:String(t.showMekkoTotals)!=="false",mekkoValueFormat:t.mekkoValueFormat==="percent"?"percent":t.mekkoValueFormat==="value"?"value":void 0}}function wd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:k(t.pieStartAngle),pieSweep:k(t.pieSweep),pieExplode:k(t.pieExplode),pieGlow:k(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:k(t.pieStrokeWidth),pieLabelPosition:t.pieLabelPosition==="inside"||t.pieLabelPosition==="outside"?t.pieLabelPosition:void 0,pieLabelContent:t.pieLabelContent==="percent"||t.pieLabelContent==="name"||t.pieLabelContent==="inline"?t.pieLabelContent:void 0,pieLabelColor:t.pieLabelColor,pieCenterText:t.pieCenterText,pieCenterSize:k(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function vd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:k(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:k(t.pieStrokeWidth),polarTrackOpacity:k(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:k(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:k(t.polarValueSize),polarNameSize:k(t.polarNameSize),polarValueFirst:t.polarValueFirst===void 0?void 0:String(t.polarValueFirst)!=="false",polarOutsideLabels:t.polarOutsideLabels===void 0?void 0:String(t.polarOutsideLabels)!=="false"}}function Pd(e){return{radarStrokeWidth:k(e.radarStrokeWidth),radarPointSize:k(e.radarPointSize),radarTension:k(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function Ld(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Pd(t)}}function Md(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Pd(t)}}function Td(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:k(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:k(t.ringStartAngle),ringSweep:k(t.ringSweep)}}function $d(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:k(t.sankeyNodeWidth),sankeyNodeGap:k(t.sankeyNodeGap),sankeyLinkOpacity:k(t.sankeyLinkOpacity),sankeyLinkCurve:k(t.sankeyLinkCurve),sankeyLabelSize:k(t.sankeyLabelSize)}}function Ad(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:k(t.tileStrokeWidth),tileLabelSize:k(t.tileLabelSize),tileValueSize:k(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:k(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:k(t.headerHeight)}}function Ed(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:k(t.customConnectorWidth),customConnectorOpacity:k(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:k(t.customBeforeStrokeWidth),customLabelSize:k(t.customLabelSize),customLabelColor:t.customLabelColor}}function Nd(e){let t=hd(e),r=e.chart,o=e.props,n=r?.chartType??"bar";switch(n){case"bar":return ne(t,n,gd(r,o));case"line":return ne(t,n,yd(r,o));case"scatter":return ne(t,n,bd(r,o));case"boxplot":return ne(t,n,xd(r,o));case"field":return ne(t,n,Sd(r));case"heatmap":return ne(t,n,Cd(r,o));case"hexbin":return ne(t,n,kd(r,o));case"mekko":return ne(t,n,Rd(r,o));case"pie":return ne(t,n,wd(r,o));case"polarArea":return ne(t,n,vd(r,o));case"radar":return ne(t,n,Ld(r,o));case"radial":return ne(t,n,Md(r,o));case"radialBar":return ne(t,n,Td(r,o));case"sankey":return ne(t,n,$d(r,o));case"treemap":return ne(t,n,Ad(r,o));case"custom":return ne(t,n,Ed(r,o))}}function ne(e,t,r){return{...e,chartType:t,config:r}}function Vy(e,t){let r=Number(t);if(t===void 0||t===""||!Number.isFinite(r))return e.default;let o=e.min===void 0?r:Math.max(e.min,r);return e.max===void 0?o:Math.min(e.max,o)}function Wy(e,t){switch(e.type){case"number":return Vy(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return Se(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function zy(e,t){let r={};for(let[o,n]of Object.entries(e?.properties??{}))r[o]=Wy(n,t[o]);return r}function Yy(e,t){if(!e)return"";if(e.type==="boolean")return t==="true";if(e.type==="number"){let r=Number(t);return Number.isFinite(r)?r:e.default}return t}function Od(e){let t=Rt(e.component.type);return{id:e.id,type:e.component.type,value:t?Yy(t.value,e.component.value):e.component.value,disabled:e.props.disabled==="true",label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,properties:zy(t,e.props)}}var Uy=/^[\w\s,'"-]+$/;function ii(e){return e&&Uy.test(e)?e:void 0}var jy=/^(?:[1-9]00|normal|bold)$/;function Xy(e){return e==="plain"||e==="flip"?e:void 0}function qy(e){return e==="roll"||e==="fade"?e:void 0}function Ky(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function ai(e){return e&&jy.test(e)?e:void 0}var Zy=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],Qy=["color","accent"];function Jy(e){let t=e.props,r={};for(let o of Zy){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of Qy){let n=Se(t[o]);n&&(r[o]=n)}return{id:e.id,type:"tickScale",value:e.component.value,max:e.component.max,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:Se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:ai(t.labelWeight),fontFamily:ii(t.labelFont)}:void 0}}var eb=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],tb=["color","accent","glow"],rb={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},ob=["core","peak"];function nb(e){let t=e.props,r={};for(let o of eb){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of tb)r[o]=Se(t[o])??rb[o];for(let o of ob){let n=Se(t[o]);n&&(r[o]=n)}return r.axis=t.axis==="horizontal"?"horizontal":"vertical",t.knob&&(r.knob=t.knob),{id:e.id,type:"ruler",value:e.component.value,min:e.component.min,max:e.component.max,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:Se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:ai(t.labelWeight),fontFamily:ii(t.labelFont)}:void 0}}function ib(e){let t=e.props;return{id:e.id,type:"rollingNumber",value:e.component.value,digits:e.component.digits,duration:e.component.duration,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,style:{color:Se(t.color),surface:Se(t.surface),divider:Se(t.divider),labelColor:Se(t.labelColor),fontFamily:ii(t.fontFamily),variant:Xy(t.variant),motion:qy(t.motion),fontWeight:ai(t.fontWeight),fontSize:Ky(t.fontSize)}}}var ab={rollingNumber:ib,tickScale:Jy,ruler:nb};function Bd(e){let t=e.component.type;return at(t)?ab[t](e):Od(e)}function Id(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,fromFace:e.fromFace,toFace:e.toFace,order:e.order,sourceIndex:e.sourceIndex,style:{pathType:fe(t.route,So)??"straight",color:$t(t.stroke),strokeWidth:k(t.strokeWidth),strokeStyle:fe(t.strokeStyle,xo),opacity:t.opacity!==void 0?k(t.opacity):void 0}}}function Dd(e){let t=e.props;return{id:e.id,start:e.dimension.start,end:e.dimension.end,offset:e.dimension.offset,text:e.text,unit:e.dimension.unit,strokeColor:xe(t.stroke),strokeWidth:k(t.strokeWidth),textColor:xe(t.textColor),fontSize:k(t.fontSize),order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId}}function Gd(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,fillColor:t.fill??"rgba(155, 66, 223, 0.05)",strokeColor:t.stroke??"#9b42df",strokeWidth:k(t.strokeWidth)??2,cornerRadius:k(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:k(t.fontSize)??14,fontWeight:Ie(t.fontWeight,bo,"bold"),fontFamily:t.fontFamily,dash:Qe(t.dash),showLabel:t.showLabel!=="false",labelPosition:Ie(t.labelPosition,cd,"top"),shadow:t.shadow!=="false",clip:t.clip==="true"||void 0,order:e.order,sourceIndex:e.sourceIndex}}function _d(e){let t=e.props,r=Me(t.shadow);return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,depth:e.isometric.depth,footprint:e.isometric.footprint,form:e.isometric.form,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,text:e.text,icon:e.isometric.icon,fill:xe(t.fill)??"#f8fafc",strokeColor:xe(t.stroke)??"#111827",strokeWidth:k(t.strokeWidth)??1,cornerRadius:k(t.cornerRadius)??(e.isometric.footprint?0:8),seams:t.seams==="false"?!1:void 0,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:k(t.labelOffsetX)??0,labelOffsetY:k(t.labelOffsetY)??0,labelBackground:xe(t.labelBackground),parentFrameId:e.parentFrameId}}function Fd(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:k(t.weight),showWeight:t.showWeight!=="false",style:{pathType:fe(t.route,So),color:$t(t.stroke),strokeWidth:k(t.strokeWidth),strokeStyle:fe(t.strokeStyle,xo),opacity:t.opacity!==void 0?k(t.opacity):void 0,fontSize:k(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:Me(t.shadow)},startMarker:fe(t.markerStart,ni),endMarker:fe(t.markerEnd,ni),segmentOffsets:e.segments,fromPoint:e.fromPort?{kind:"port",port:e.fromPort}:e.fromSide?{kind:"side",side:e.fromSide,offset:e.fromFraction}:void 0,toPoint:e.toPort?{kind:"port",port:e.toPort}:e.toSide?{kind:"side",side:e.toSide,offset:e.toFraction}:void 0,order:e.order,sourceIndex:e.sourceIndex}}function Hd(e){let t=e.props;return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,points:e.path?.points??[],value:e.path?.value,tension:e.path?.tension??0,startMarker:Ie(e.path?.startMarker,oi,"none"),endMarker:Ie(e.path?.endMarker,oi,"none"),closed:e.path?.closed??!1,strokeColor:xe(t.stroke)??"#7c3aed",strokeWidth:k(t.strokeWidth)??2,dash:Qe(t.dash)??[],opacity:k(t.opacity)??1,fillColor:xe(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function sb(e){return e||"rectangle"}function Vd(e,t){let r=e.props,o=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:sb(e.shapeType),symbol:e.symbol,x:e.x,y:e.y,width:e.width,height:e.height,w:e.width,h:e.height,rotation:e.rotation??0,fillColor:be(r.fill??(o?"none":void 0)),strokeColor:$t(r.stroke??(o?"none":void 0)),isText:o||void 0,strokeWidth:k(r.strokeWidth),textColor:r.textColor,fontSize:k(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:Ie(r.fontWeight,dd,"normal"),letterSpacing:k(r.letterSpacing),lineHeight:k(r.lineHeight),fontFamily:r.fontFamily,textAlign:fe(r.textAlign,ud),textVerticalAlign:fe(r.verticalAlign,md),cornerRadius:k(r.cornerRadius),shadowStyle:Me(r.shadow),dash:Qe(r.dash),strokeStyle:fe(r.strokeStyle,fd),opacity:k(r.opacity),blur:k(r.blur),blend:fe(r.blend,pd),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function Wd(e){let t=e.props;return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,orientation:e.swimlane?.orientation??"horizontal",lanes:e.swimlane?.lanes??[],fillColor:t.fill??"rgba(107, 114, 128, 0.05)",strokeColor:t.stroke??"#6b7280",strokeWidth:k(t.strokeWidth)??2,cornerRadius:k(t.cornerRadius)??12,dash:Qe(t.dash),shadowStyle:Me(t.shadow),textColor:t.textColor??"#6b7280",fontSize:k(t.fontSize)??22,fontWeight:Ie(t.fontWeight,bo,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var si=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function zd(e){let t=si(e.canvasObjects),r=new Map((e.shaders??[]).map(o=>[o.name,o]));return{shapes:t.filter(o=>o.objectType==="shape").map(o=>Vd(o,r)),frames:t.filter(o=>o.objectType==="frame").map(Gd),swimlanes:t.filter(o=>o.objectType==="swimlane").map(Wd),isometricObjects:t.filter(mr).map(_d),paths:t.filter(o=>o.objectType==="path").map(Hd),dimensions:t.filter(ur).map(Dd),charts:t.filter(o=>o.objectType==="chart").map(Nd),components:t.filter(o=>o.objectType==="component"&&o.component!==void 0).map(Bd),links:si(e.links).map(Fd),connections:si(e.connections).map(Id)}}var Co=new Set(["top","front","right"]),Yd=Math.PI/6,ze=Math.cos(Yd),Ye=Math.sin(Yd);function li(e){let t=Math.max(0,e.width),r=Math.max(0,e.height),o=Math.max(0,e.depth);return{x:e.x,y:e.y,width:(t+o)*ze,height:r+(t+o)*Ye}}function di(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*ze/2,y:e.y+(t+r)*Ye/2}}function lb(e){return{x:(e[0].x+e[1].x+e[2].x+e[3].x)/4,y:(e[0].y+e[1].y+e[2].y+e[3].y)/4}}function ci(e,t){return lb(Ue(e)[t])}function Ue(e){let{x:t,y:r}=e,o=Math.max(0,e.width),n=Math.max(0,e.height),i=Math.max(0,e.depth),a={x:t+i*ze,y:r},s={x:o*ze,y:o*Ye},l={x:-i*ze,y:i*Ye},d={x:0,y:n},c={x:a.x+s.x,y:a.y+s.y},u={x:a.x+l.x,y:a.y+l.y},m={x:a.x+s.x+l.x,y:a.y+s.y+l.y},f={x:a.x+d.x,y:a.y+d.y},h={x:m.x+d.x,y:m.y+d.y},y={x:u.x+d.x,y:u.y+d.y},x={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,m,u],bottom:[f,x,h,y],front:[u,m,h,y],back:[a,c,x,f],right:[m,c,x,h],left:[a,u,y,f]}}function db(e){let t=0;for(let r=0;r<e.length;r+=1){let[o,n]=e[r],[i,a]=e[(r+1)%e.length];t+=o*a-i*n}return t/2}function ko(e){let t=(e??[]).filter(o=>Array.isArray(o)&&Number.isFinite(o[0])&&Number.isFinite(o[1])),r=t.filter((o,n)=>{let i=t[(n+1)%t.length];return o[0]!==i[0]||o[1]!==i[1]});return r.length>=3?r:[]}var cb=Math.PI/12;function Ud(e,t,r,o){if(!(t>0)||r<=0||o<=0)return[...e];let n=e.map(([a,s])=>({x:a*r,y:s*o})),i=[];for(let a=0;a<n.length;a+=1){let s=n[a],l=n[(a-1+n.length)%n.length],d=n[(a+1)%n.length],c={x:l.x-s.x,y:l.y-s.y},u={x:d.x-s.x,y:d.y-s.y},m=Math.hypot(c.x,c.y),f=Math.hypot(u.x,u.y),h=(c.x*u.x+c.y*u.y)/(m*f),y=Math.acos(Math.max(-1,Math.min(1,h)));if(!Number.isFinite(y)||y<.001||Math.PI-y<.001){i.push(e[a]);continue}let x=Math.min(t/Math.tan(y/2),Math.min(m,f)/2),b=x*Math.tan(y/2),C={x:c.x/m,y:c.y/m},S={x:u.x/f,y:u.y/f},w={x:s.x+C.x*x,y:s.y+C.y*x},O={x:s.x+S.x*x,y:s.y+S.y*x},A={x:C.x+S.x,y:C.y+S.y},_=Math.hypot(A.x,A.y),G=b/Math.sin(y/2),V={x:s.x+A.x/_*G,y:s.y+A.y/_*G},ve=Math.atan2(w.y-V.y,w.x-V.x),le=Math.atan2(O.y-V.y,O.x-V.x)-ve;le-=2*Math.PI*Math.round(le/(2*Math.PI));let Pe=Math.max(2,Math.ceil(Math.abs(le)/cb));for(let oe=0;oe<=Pe;oe+=1){let Ke=ve+le*oe/Pe;i.push([(V.x+b*Math.cos(Ke))/r,(V.y+b*Math.sin(Ke))/o])}}return i}function ui(e,t,r=0){let o=Math.max(0,e.width),n=Math.max(0,e.depth),i=Math.max(0,e.height),a=Ud(ko(t),r,o,n),s=e.x+n*ze,l=([h,y],x)=>({x:s+(h*o-y*n)*ze,y:e.y+(h*o+y*n)*Ye+x}),d=a.map(h=>l(h,0)),c=db(a)>=0?1:-1,u=a.map((h,y)=>{let x=a[(y+1)%a.length],b=(x[0]-h[0])*o,C=(x[1]-h[1])*n,S=Math.hypot(b,C),w=S===0?0:C/S*c,O=S===0?0:-b/S*c;return{from:h,to:x,length:S,normalU:w,normalV:O,visible:S>0&&w+O>1e-9}}),m=(h,y)=>h.visible&&y.visible&&h.normalU*y.normalU+h.normalV*y.normalV>Math.cos(.5),f=[];return u.forEach((h,y)=>{if(!h.visible)return;let x=u[(y-1+u.length)%u.length],b=u[(y+1)%u.length],{from:C,to:S}=h;f.push({points:[l(C,0),l(S,0),l(S,i),l(C,i)],light:.72+.28*Math.max(0,Math.min(1,h.normalV/(Math.abs(h.normalU)+Math.abs(h.normalV)))),depth:(C[0]+S[0])/2+(C[1]+S[1])/2,smoothStart:m(x,h),smoothEnd:m(h,b)})}),f.sort((h,y)=>h.depth-y.depth),{top:d,sides:f}}function ub(e){return Math.max(0,Math.min(255,Math.round(e)))}function mb(e){let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return null;let r=Number.parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function pb(e,t,r){return`#${[e,t,r].map(o=>ub(o).toString(16).padStart(2,"0")).join("")}`}function mi(e,t){let r=mb(e);if(!r)return e;let[o,n,i]=r;return pb(o*t,n*t,i*t)}function At(e,t){return mi(e,t)}function pi(e){return{topFill:e,frontFill:mi(e,.95),sideFill:mi(e,.88)}}var fb=Math.PI/180;function hb(e,t){let r=t*fb,o=Math.cos(r),n=Math.sin(r);return{x:e.x*o-e.y*n,y:e.x*n+e.y*o}}function gb(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function jd(e,t){let r=gb(e),o=e.rotation?hb(t,e.rotation):t;return{x:r.x+o.x,y:r.y+o.y}}function fi(e,t){return jd(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function Et(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function hi(e,t){let r=Et(e),o=Et(t),n=Math.atan2(o.y-r.y,o.x-r.x);return n>=-Math.PI/4&&n<Math.PI/4?{x:e.x+e.width,y:r.y}:n>=Math.PI/4&&n<3*Math.PI/4?{x:r.x,y:e.y+e.height}:n>=-3*Math.PI/4&&n<-Math.PI/4?{x:r.x,y:e.y}:{x:e.x,y:r.y}}function yb(e,t){let r=t.offset??.5;switch(t.side){case"top":return{x:e.x+e.width*r,y:e.y};case"right":return{x:e.x+e.width,y:e.y+e.height*r};case"bottom":return{x:e.x+e.width*r,y:e.y+e.height};case"left":return{x:e.x,y:e.y+e.height*r}}}function bb(e,t){let r=e.symbol?.ports?.find(o=>o.name===t.port);return r?fi({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):Et(e)}function gi(e,t,r){let o=xb(e,t),n=Sb(o.explicit);if(n)return n;let i=Xd(r,o.canvasObjectId);if(!i)return{x:0,y:0};let a=Cb(i,o.explicit);return a||kb(i,Xd(r,o.oppositeCanvasObjectId))}function xb(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function Sb(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function Cb(e,t){return t?.kind==="port"?bb(e,t):t?.kind==="side"?yb(e,t):null}function kb(e,t){return t?hi(e,t):Et(e)}function Xd(e,t){return e.find(r=>r.id===t)}var Rb=15e3;function wb(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function qd(e,t){return e?ci(e,t):{x:0,y:0}}function Kd(e,t){let r=e.findIndex(n=>n.id===t);if(r<0)return;let o=e[r];return{rank:o.order??0,sequence:o.sourceIndex??Rb+r}}function vb(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Co.has(t.fromFace)?void 0:Kd(e,t.fromId),Co.has(t.toFace)?void 0:Kd(e,t.toId)].filter(n=>n!==void 0);if(!r.length)return{sourceIndex:t.sourceIndex};let o=r.reduce((n,i)=>i.rank<n.rank||i.rank===n.rank&&i.sequence<n.sequence?i:n);return{order:o.rank,sourceIndex:o.sequence-.5}}function Pb(e){let t=new Map(e.isometricObjects.map(r=>[r.id,r]));return e.connections.map(r=>({link:{id:r.id,fromId:r.fromId,toId:r.toId,fromPoint:{kind:"face",face:r.fromFace},toPoint:{kind:"face",face:r.toFace},style:r.style,...vb(e.isometricObjects,r)},from:qd(t.get(r.fromId??""),r.fromFace),to:qd(t.get(r.toId??""),r.toFace),kind:"connection"}))}function Zd(e){let t=wb(e);return[...e.links.map(o=>({link:o,from:gi(o,"from",t),to:gi(o,"to",t)})),...Pb(e)]}function yi(e){let t=ld(e),r=zd(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,dimensions:r.dimensions,charts:r.charts,components:r.components,links:Zd(r),diagnostics:t.diagnostics}}function ee(e,t,r,o,n,i){return e.forEach((a,s)=>{a.identity={role:t,id:r,...o?{kind:o}:{},...s===0?{primary:!0}:{},...s===0&&n?{label:n}:{},...s===0&&i?{parentFrameId:i}:{}}}),e}var bi={minX:0,minY:0,maxX:100,maxY:100};function de(e,t=0){return{minX:e.x-t,minY:e.y-t,maxX:e.x+e.width+t,maxY:e.y+e.height+t}}function N(e,t,r=0){return t?Tb(Lb(e,t),r):de(e,r)}function Lb(e,t){let r=e.x+e.width/2,o=e.y+e.height/2,n=t*Math.PI/180,i=Math.cos(n),a=Math.sin(n);return Mb(e).map(s=>({x:r+(s.x-r)*i-(s.y-o)*a,y:o+(s.x-r)*a+(s.y-o)*i}))}function Mb(e){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]}function Tb(e,t){return{minX:Math.min(...e.map(r=>r.x))-t,minY:Math.min(...e.map(r=>r.y))-t,maxX:Math.max(...e.map(r=>r.x))+t,maxY:Math.max(...e.map(r=>r.y))+t}}function Te(e){if(e.points.length===0)return"";if(ho(e))return $b(e);let t=e.points[0],r=[`M ${t.x} ${t.y}`];for(let{to:o,controls:n}of go(e))r.push(n?`C ${n[0].x} ${n[0].y} ${n[1].x} ${n[1].y} ${o.x} ${o.y}`:`L ${o.x} ${o.y}`);return e.closed&&r.push("Z"),r.join(" ")}function $b(e){let[t,...r]=e.points,o=r.map(n=>`L ${n.x} ${n.y}`).join(" ");return`M ${t.x} ${t.y} ${o}${e.closed?" Z":""}`}function p(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Qd(e){let t=e.order_key??e.orderKey;if(!t)return e.order??0;let r=0;for(let o=0;o<Math.min(t.length,8);o++)r=r*128+t.charCodeAt(o);return r}function Jd(e,t){return e.sourceIndex??t}function P(e,t,r){return e?typeof e=="string"?{kind:"solid",color:e}:e.type==="gradient"?{kind:"linear-gradient",angle:e.angle,stops:e.stops.map(o=>({offset:o.position,color:o.color}))}:e.points.length===0?(t.push({severity:"warning",code:"empty-mesh-gradient",ownerId:r,message:"Mesh gradient has no color points."}),{kind:"none"}):{kind:"mesh-gradient",points:e.points.map(o=>({x:o.x,y:o.y,color:o.color}))}:{kind:"none"}}var B="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var ec="#94a3b8";function tc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,120)),i=Math.max(0,p(e.height,60)),a=p(e.rotation,0),s=1e4+t,l=N({x:r,y:o,width:n,height:i},a,2);return[{id:`widget-${e.id}`,type:"rect",order:s,bounds:l,x:r,y:o,width:n,height:i,rx:6,rotation:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:ec},strokeWidth:1,dash:[4,3]}},{id:`widget-${e.id}-label`,type:"text",order:s+.1,bounds:l,x:r,y:o,width:n,height:i,lines:[e.type],fontFamily:B,fontSize:12,fontWeight:"normal",color:ec,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function rc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,160)),i=Math.max(0,p(e.height,90)),a=p(e.rotation,0);return[{id:`widget-${e.id}`,type:"rolling-number",order:1e4+t,bounds:N({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,value:sr(e.value,e.digits),digits:e.digits,duration:Math.max(0,p(e.duration,420)),label:e.label,componentStyle:Yn(e.style)}]}function oc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,200)),i=Math.max(0,p(e.height,200)),a=p(e.rotation,0),s=p(e.max,100)||100,l=Math.min(1,Math.max(0,p(Number(e.value),0)/s)),d=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:N({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,shader:{name:e.id,program:"tickScale",parameters:{...e.parameters,progress:l,max:s}},mask:"ellipse"}];return e.labels&&d.push(...Ab(e,{x:r,y:o,width:n,height:i,rotation:a,max:s,order:1e4+t})),d}function Ab(e,t){let r=e.labels??{},o=Math.max(1,p(Number(e.parameters.ticks),48)),n=Math.max(1,p(Number(e.parameters.major),5)),i=p(Number(e.parameters.start),225)*Math.PI/180,a=p(Number(e.parameters.sweep),270)*Math.PI/180,s=p(Number(e.parameters.radius),.9)+p(r.offset,.08),l=p(r.size,12),d=t.x+t.width/2,c=t.y+t.height/2,u=Math.floor(o/n),m=[];for(let f=0;f<=u;f+=1){let h=f*n/o,y=i-h*a,x=d+Math.cos(y)*s*(t.width/2),b=c-Math.sin(y)*s*(t.height/2),C={x:x-24,y:b-l,width:48,height:l*2};m.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:N(C,0,2),...C,lines:[String(Math.round(t.max*h*10)/10)],fontFamily:r.fontFamily||B,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return m}function nc(e,t){let r=p(e.x,0),o=p(e.y,0),n=Math.max(0,p(e.width,120)),i=Math.max(0,p(e.height,360)),a=p(e.rotation,0),s=p(e.min,0),l=p(e.max,100),d=l===s?0:Math.min(1,Math.max(0,(p(Number(e.value),s)-s)/(l-s))),c=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:N({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,shader:{name:e.id,program:"ruler",parameters:{...e.parameters,progress:d,min:s,max:l}},mask:"rect"}];return e.labels&&c.push(...Eb(e,{x:r,y:o,width:n,height:i,min:s,max:l,order:1e4+t})),c}function Eb(e,t){let r=e.labels??{},o=e.parameters.axis==="horizontal",n=Math.max(1,p(Number(e.parameters.ticks),50)),i=Math.max(1,p(Number(e.parameters.major),5)),a=p(Number(e.parameters.inset),.05)>0?p(Number(e.parameters.inset),.05):.05,s=p(Number(e.parameters.line),.7)>0?p(Number(e.parameters.line),.7):.7,l=o?t.height:t.width,d=(p(Number(e.parameters.length),.1)>0?p(Number(e.parameters.length),.1):.1)*l*1.9,c=s*l-.12*l-d-p(r.offset,.04)*l,u=p(r.size,12),m=Math.floor(n/i),f=[];for(let h=0;h<=m;h+=1){let y=h*i/n,x=a+(1-2*a)*y,b=o?{x:t.x+t.width*x-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-x)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${h}`,type:"text",order:t.order+.1,bounds:N(b,0,2),...b,lines:[String(Math.round((t.min+(t.max-t.min)*y)*10)/10)],fontFamily:r.fontFamily||B,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:o?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var Nb="#94a3b8";function ie(e,t,r){return{x:p(e.x,0),y:p(e.y,0),width:Math.max(1,p(e.width,r.width)),height:Math.max(1,p(e.height,r.height)),order:1e4+t}}var $=(e,t)=>String(e.properties[t]??""),I=(e,t)=>Number(e.properties[t]??0),Y=e=>({kind:"solid",color:e}),pe=(e,t)=>e.disabled?Nb:t;function q(e,t){let r=Number(e.properties.animate??0),o=e.disabled?{...t,opacity:.4}:t;return r>0?{...o,transition:r}:o}function ae(e,t){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:N(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}}function se(e,t,r,o,n){return{id:`widget-${e.id}-${t}`,type:"text",order:n,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[o.text],fontFamily:B,fontSize:o.fontSize,fontWeight:"600",color:o.color,align:o.align,verticalAlign:"middle",lineHeight:1.3}}function ic(e,t){let r=ie(e,t,{width:120,height:40}),o=[ae(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min(I(e,"radius"),r.height/2),style:q(e,{fill:Y($(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let n={text:e.label,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"center"};o.push(se(e,"label",r,n,r.order+.2))}return o}var Ob=.22,Bb=.5,Ib=[[.24,.52],[.43,.72],[.78,.3]];function Db(e){let[t,...r]=Ib.map(([o,n])=>`${e.x+o*e.width} ${e.y+n*e.width}`);return`M ${t} ${r.map(o=>`L ${o}`).join(" ")}`}function Gb(e,t,r){let o=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:N(r,0,2),...r,rx:r.width*Ob,style:q(e,{fill:o?Y($(e,"accent")):{kind:"none"},stroke:Y(o?$(e,"accent"):$(e,"stroke")),strokeWidth:1.5})}}function _b(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:N(r,0,0),d:Db(r),style:q(e,{fill:{kind:"none"},stroke:Y($(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function Fb(e,t,r,o){let n=r*Bb,i={x:t.x+r+n,y:t.y,width:Math.max(0,t.width-r-n),height:t.height},a={text:o,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"left"};return se(e,"label",i,a,t.order+.3)}function ac(e,t){let r=ie(e,t,{width:160,height:24}),o=Math.min(r.height,r.width),n={x:r.x,y:r.y+(r.height-o)/2,width:o,height:o};return[ae(e,r),Gb(e,r,n),...e.value===!0?[_b(e,r,n)]:[],...e.label?[Fb(e,r,o,e.label)]:[]]}var Hb=.62;function Vb(e){return e>0?String(e).split(".")[1]?.length??0:0}function Wb(e,t){let r=$(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?Number(e.value).toFixed(Vb(I(e,"step"))):""}function sc(e,t){let r=ie(e,t,{width:96,height:96}),o=I(e,"min"),n=I(e,"max"),i=Math.min(1,Math.max(0,(Number(e.value)-o)/(n-o||1))),a=I(e,"start"),s=Math.min(360,Math.max(1,I(e,"sweep"))),l=Math.min(I(e,"thickness"),Math.min(r.width,r.height)/3),d=r.x+r.width/2,c=r.y+r.height/2,u=Math.max(1,Math.min(r.width,r.height)/2-l/2),m=2*Math.PI*u,f=$(e,"rounded")!=="false",h=(a-i*s)*Math.PI/180,y=(w,O,A,_,G={})=>({id:`widget-${e.id}-${w}`,type:"ellipse",order:r.order+O,bounds:N({x:d-u,y:c-u,width:u*2,height:u*2},0,l),cx:d,cy:c,rx:u,ry:u,rotation:-a,style:q(e,{fill:{kind:"none"},stroke:Y(A),strokeWidth:l,dash:[Math.max(.001,_),m],lineCap:f?"round":"butt",...G})}),x=Math.max(1,u-l/2-Math.max(2,l*.4)),b=l/2*Hb+1,C=[ae(e,r),y("track",.1,$(e,"track"),s/360*m),y("fill",.2,$(e,"accent"),i*s/360*m,{opacity:i>0?1:0}),{id:`widget-${e.id}-face`,type:"ellipse",order:r.order+.3,bounds:N({x:d-x,y:c-x,width:x*2,height:x*2},0,0),cx:d,cy:c,rx:x,ry:x,style:q(e,{fill:Y($(e,"face")),stroke:{kind:"none"}})},{id:`widget-${e.id}-dot`,type:"ellipse",order:r.order+.4,bounds:N({x:d+u*Math.cos(h)-b,y:c-u*Math.sin(h)-b,width:b*2,height:b*2},0,0),cx:d+u*Math.cos(h),cy:c-u*Math.sin(h),rx:b,ry:b,style:q(e,{fill:Y($(e,"dot")),stroke:{kind:"none"}})}],S=Wb(e,i);if(S){let w={text:S,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"center"};C.push(se(e,"value",{x:d-x,y:c-x,width:x*2,height:x*2},w,r.order+.5))}return C}function zb(e,t){let r=$(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?String(Number(e.value)):""}function lc(e,t){let r=ie(e,t,{width:220,height:12}),o=I(e,"min"),n=I(e,"max"),i=Math.min(1,Math.max(0,(Number(e.value)-o)/(n-o||1))),a=$(e,"rounded")!=="false",s=[ae(e,r)];if($(e,"variant")==="ring"){let d=Math.min(I(e,"thickness"),Math.min(r.width,r.height)/2),c=Math.max(1,Math.min(r.width,r.height)/2-d/2),u=2*Math.PI*c,m=r.x+r.width/2,f=r.y+r.height/2,h=(y,x,b,C)=>({id:`widget-${e.id}-${y}`,type:"ellipse",order:r.order+x,bounds:N({x:m-c,y:f-c,width:c*2,height:c*2},0,d),cx:m,cy:f,rx:c,ry:c,rotation:-90,style:q(e,{fill:{kind:"none"},stroke:Y(b),strokeWidth:d,...C})});s.push(h("track",.1,$(e,"track"),{})),s.push(h("fill",.2,$(e,"accent"),{dash:[Math.max(.001,i*u),u],lineCap:a?"round":"butt",opacity:i>0?1:0}))}else{let d=$(e,"direction")==="vertical",c=a?(d?r.width:r.height)/2:0,u=(f,h,y,x,b)=>{let C=d?{x:r.x,y:r.y+r.height-y,width:r.width,height:y}:{x:r.x,y:r.y,width:y,height:r.height};return{id:`widget-${e.id}-${f}`,type:"rect",order:r.order+h,bounds:N(C,0,0),...C,rx:c,style:q(e,{fill:Y(x),stroke:{kind:"none"},...b===void 0?{}:{opacity:b}})}},m=d?r.height:r.width;s.push(u("track",.1,m,$(e,"track"))),s.push(u("fill",.2,Math.max(0,i*m),$(e,"accent"),i>0?1:0))}let l=zb(e,i);if(l){let d={text:l,color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize"),align:"center"};s.push(se(e,"value",r,d,r.order+.3))}return s}function dc(e,t){let r=ie(e,t,{width:300,height:40}),o=$(e,"options").split(",").map(u=>u.trim()).filter(Boolean),n=Math.max(1,o.length),i=Math.min(n-1,Math.max(0,Math.round(Number(e.value))||0)),a=Math.min(I(e,"inset"),r.height/2),s=Math.min(I(e,"radius"),r.height/2),l=(r.width-a*2)/n,d={y:r.y+a,height:r.height-a*2},c=[ae(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:s,style:q(e,{fill:Y($(e,"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-active`,type:"rect",order:r.order+.2,bounds:N({x:r.x+a+i*l,width:l,...d},0,0),x:r.x+a+i*l,y:d.y,width:l,height:d.height,rx:Math.max(0,s-a),style:q(e,{fill:Y($(e,"accent")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.18,blur:3,dx:0,dy:1}})}];return o.forEach((u,m)=>{let f={x:r.x+a+m*l,width:l,...d},h=pe(e,$(e,m===i?"activeTextColor":"textColor"));c.push(se(e,`option-${m}`,f,{text:u,color:h,fontSize:I(e,"fontSize"),align:"center"},r.order+.3))}),c}function xi(e,t){return e==="field"?Math.min(8,t/2):t/2}var $e=4,cc=12,Si=5,Nt=1.5;function Yb(e){return e>0?String(e).split(".")[1]?.length??0:0}function Ub(e,t){let r=$(e,"display"),o=Yb(I(e,"step"));return(r==="percent"?t.two?[t.from,t.to].map(i=>`${Math.round(i*100)}%`):[`${Math.round(t.to*100)}%`]:r==="value"?t.values.map(i=>i.toFixed(o)):[]).join(" \u2013 ")}var Ot=(e,t,r,o,n,i,a={})=>({id:`widget-${e.id}-${r}`,type:"rect",order:t.order+o,bounds:N(n,0,0),...n,style:q(e,{fill:Y(i),stroke:{kind:"none"},...a})});function uc(e,t,r,o,n){let i=Math.round(I(e,"ticks")),a=$(e,"tickColor");return Array.from({length:i>=2?i:0},(s,l)=>{let d=l/(i-1),c=r?{x:t.x+n,y:t.y+t.height-o-d*(t.height-o*2)-Nt/2,width:Si,height:Nt,rx:Nt/2}:{x:t.x+o+d*(t.width-o*2)-Nt/2,y:t.y+n,width:Nt,height:Si,rx:Nt/2};return Ot(e,t,`tick-${l}`,.15,c,a)})}function jb(e,t,r,o){let n=xi("line",o?t.width:t.height),i=n*I(e,"thumbSize")/100,a=Math.min(I(e,"trackHeight"),o?t.width:t.height),s=o?t.x+t.width/2:t.y+t.height/2,l=f=>o?t.y+t.height-n-f*(t.height-n*2):t.x+n+f*(t.width-n*2),d=(f,h)=>o?{x:s-a/2,y:Math.min(f,h),width:a,height:Math.abs(h-f),rx:a/2}:{x:Math.min(f,h),y:s-a/2,width:Math.abs(h-f),height:a,rx:a/2},c=o?d(t.y,t.y+t.height):d(t.x,t.x+t.width),u=d(r.two?l(r.from):o?t.y+t.height:t.x,l(r.to)),m=(f,h,y)=>{let x=o?s:l(h),b=o?l(h):s;return{id:`widget-${e.id}-${f}`,type:"ellipse",order:t.order+y,bounds:N({x:x-i,y:b-i,width:i*2,height:i*2},0,0),cx:x,cy:b,rx:i,ry:i,style:q(e,{fill:Y($(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:3,dx:0,dy:1}})}};return[Ot(e,t,"track",.1,c,$(e,"track")),...uc(e,t,o,n,o?t.width/2+a/2+5:t.height/2+a/2+5),Ot(e,t,"fill",.2,u,$(e,"accent")),...r.two?[m("thumb-start",r.from,.3)]:[],m(r.two?"thumb-end":"thumb",r.to,.31)]}function Xb(e,t,r,o){let n=xi("field",o?t.width:t.height),i=Math.min(I(e,"radius"),Math.min(t.width,t.height)/2),a={x:t.x,y:t.y,width:t.width,height:t.height,rx:i},s=S=>o?t.y+t.height-n-S*(t.height-n*2):t.x+n+S*(t.width-n*2),l=r.two?s(r.from):o?t.y+t.height:t.x,d=s(r.to),c=Math.min(l,d)-(r.two?$e/2:0),u=Math.max(l,d)+$e/2,m=o?{...a,y:r.two?c:d-$e/2,height:r.two?u-c:Math.max(0,t.y+t.height-d+$e/2),rx:r.two?0:i}:{...a,x:r.two?c:t.x,width:r.two?u-c:Math.max(0,d+$e/2-t.x),rx:r.two?0:i},f=(o?t.width:t.height)*.5,h=(S,w)=>{let O=o?{x:t.x+(t.width-f)/2,y:w-$e/2,width:f,height:$e,rx:$e/2}:{x:w-$e/2,y:t.y+(t.height-f)/2,width:$e,height:f,rx:$e/2};return Ot(e,t,S,.3,O,$(e,"accent"))},y=[Ot(e,t,"track",.1,a,$(e,"surface")),Ot(e,t,"fill",.2,m,$(e,"fill")),...r.two?[h("handle-start",l)]:[],h(r.two?"handle-end":"handle",d)],x={color:pe(e,$(e,"textColor")),fontSize:I(e,"fontSize")},b=Ub(e,r);if(o)return b&&y.push(se(e,"value",{x:t.x,y:t.y+6,width:t.width,height:20},{...x,text:b,align:"center"},t.order+.4)),y;let C={y:t.y,height:t.height,width:Math.max(0,t.width/2-cc)};return e.label&&y.push(se(e,"label",{x:t.x+cc,...C},{...x,text:e.label,align:"left"},t.order+.4)),b&&y.push(se(e,"value",{x:t.x+t.width/2,...C},{...x,text:b,align:"right"},t.order+.4)),y.push(...uc(e,t,!1,n,t.height-Si-5)),y}function Ci(e,t){let r=$(e,"variant")==="field",o=$(e,"direction")==="vertical",i=ie(e,t,o?{width:r?56:28,height:180}:{width:220,height:r?36:28}),a=I(e,"min"),s=I(e,"max"),l=f=>Math.min(1,Math.max(0,(f-a)/(s-a||1))),d=e.type==="range",c=Number(e.value),u=d?Number(e.properties.valueEnd??s):c,m={from:l(d?Math.min(c,u):a),to:l(d?Math.max(c,u):c),values:d?[Math.min(c,u),Math.max(c,u)]:[c],two:d};return[ae(e,i),...r?Xb(e,i,m,o):jb(e,i,m,o)]}var qb=.12;function mc(e,t){let r=ie(e,t,{width:52,height:30}),o=e.value===!0,n=r.height*qb,i=r.height/2-n,a=o?r.x+r.width-r.height/2:r.x+r.height/2,s={x:a-i,y:r.y+n,width:i*2,height:i*2};return[ae(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:N(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:q(e,{fill:Y($(e,o?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:N(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:q(e,{fill:Y($(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function pc(e,t){let r=ie(e,t,{width:120,height:40}),o=e.value===!0,n=[ae(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:N(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:q(e,{fill:o?Y($(e,"accent")):{kind:"none"},stroke:Y(o?$(e,"accent"):$(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:pe(e,$(e,o?"onTextColor":"textColor")),fontSize:I(e,"fontSize"),align:"center"};n.push(se(e,"label",r,i,r.order+.2))}return n}var Ce=e=>(t,r)=>e(t,r),Kb=new Map([["rollingNumber",Ce(rc)],["tickScale",Ce(oc)],["ruler",Ce(nc)],["switch",Ce(mc)],["checkbox",Ce(ac)],["toggleButton",Ce(pc)],["button",Ce(ic)],["slider",Ce(Ci)],["progress",Ce(lc)],["segmented",Ce(dc)],["knob",Ce(sc)],["range",Ce(Ci)]]);function fc(e){return Kb.get(e)}function Zb(e){let t=Rt(e.type)?.role;if(!t||!qr(e))return;let r=typeof e.value=="boolean"?e.value:void 0;return{role:t,...r===void 0?{}:t==="button"?{pressed:r}:{checked:r},...e.disabled?{disabled:!0}:{}}}function Qb(e){return e.label??(qr(e)?e.id:String(e.value))}function ki(e){return e.flatMap((t,r)=>{let o=fc(t.type)??tc,n=ee(o(t,r),"widget",t.id,t.type,Qb(t),t.parentFrameId),i=Zb(t),a=n.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),n})}function Ri(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+o} H ${e} Z`}function wi(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t} H ${e+r} V ${t+o-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+o} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+o-i} Z`}function fr(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r} V ${t+o} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+o-i} Z`}function hr(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+o-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+o} H ${e} Z`}function hc(e,t,r,o,n){let i=Math.max(0,Math.min(r,o)/2),a=Math.max(0,Math.min(n.topLeft,i)),s=Math.max(0,Math.min(n.topRight,i)),l=Math.max(0,Math.min(n.bottomRight,i)),d=Math.max(0,Math.min(n.bottomLeft,i)),c=(u,m,f)=>u>0?`A ${u} ${u} 0 0 1 ${m} ${f} `:"";return`M ${e+a} ${t} H ${e+r-s} `+c(s,e+r,t+s)+`V ${t+o-l} `+c(l,e+r-l,t+o)+`H ${e+d} `+c(d,e,t+o-d)+`V ${t+a} `+c(a,e+a,t)+"Z"}function Ro(e,t,r,o){return{fill:{kind:"solid",color:e||"transparent"},stroke:{kind:"solid",color:t},strokeWidth:r,dash:o?.length?o:void 0}}var wo=8;function Jb(e,t,r){let o=e.strokeWidth/2;switch(e.labelPosition){case"bottom":{let n=e.x-o,i=e.y+e.height;return{x:n,y:i,width:r,height:t,path:wi(n,i,r,t,wo)}}case"left":{let n=e.x-t,i=e.y-o;return{x:n,y:i,width:t,height:r,path:fr(n,i,t,r,wo)}}case"right":{let n=e.x+e.width,i=e.y-o;return{x:n,y:i,width:t,height:r,path:hr(n,i,t,r,wo)}}default:{let n=e.x-o,i=e.y-t;return{x:n,y:i,width:r,height:t,path:Ri(n,i,r,t,wo)}}}}function gc(e){let t=Math.max(32,e.fontSize+18),r=16,o=Math.max(120,e.title.length*e.fontSize*.62+r*2),n=Jb(e,t,o),i=de(n,6),a=e.labelPosition==="left"||e.labelPosition==="right";return[{type:"path",id:e.tabId,order:e.order+.1,bounds:i,d:n.path,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"}}},a?t0(e,n,r,i):e0(e,n,r,i)]}function e0(e,t,r,o){return{type:"text",id:e.titleId,order:e.order+.2,bounds:o,x:t.x+r,y:t.y,width:Math.max(0,t.width-r*2),height:t.height,lines:[e.title],fontFamily:e.fontFamily??B,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function t0(e,t,r,o){let n=t.x+t.width/2,i=t.y+t.height/2,a=e.fontSize*1.4,s=Math.max(1,t.height-r*2);return{type:"text",id:e.titleId,order:e.order+.2,bounds:o,x:n-s/2,y:i-a/2,width:s,height:a,lines:[e.title],fontFamily:e.fontFamily??B,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:n,y:i}}}var r0={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function o0(e,t,r){let o=e.shadow??!0,n=de({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(o?20:4)),i={...Ro(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:o?{color:"#000000",opacity:.2,blur:12,dx:0,dy:4}:void 0};if(!r)return{type:"rect",id:`frame-${e.id}`,order:t,bounds:n,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:i};let a=r0[e.labelPosition??"top"],s={topLeft:e.cornerRadius,topRight:e.cornerRadius,bottomRight:e.cornerRadius,bottomLeft:e.cornerRadius,[a]:0};return{type:"path",id:`frame-${e.id}`,order:t,bounds:n,d:hc(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function yc(e,t){if(e.isVisible===!1)return[];let r=t,o=(e.showLabel??!0)&&!!e.title,n=[o0(e,r,o)];return o&&e.title&&n.push(...gc({tabId:`frame-tab-${e.id}`,titleId:`frame-title-${e.id}`,x:e.x,y:e.y,width:e.width,height:e.height,cornerRadius:e.cornerRadius,strokeWidth:e.strokeWidth,title:e.title,color:e.strokeColor,textColor:e.textColor,fontFamily:e.fontFamily,fontSize:e.fontSize,fontWeight:e.fontWeight,labelPosition:e.labelPosition??"top",order:r})),n}function n0(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function vo(e){if(!e?.enabled)return;let t=n0(e.angle??45,e.distance??5);return{color:e.color??"#000000",opacity:e.opacity??.25,blur:e.blur??10,dx:t.x,dy:t.y}}function i0(e,t){let{swimlane:r}=e;return r.orientation==="horizontal"?`M ${r.x} ${r.y+t} H ${r.x+r.width}`:`M ${r.x+t} ${r.y} V ${r.y+r.height}`}function bc(e){return e.lanes.slice(1).map((t,r)=>({type:"path",id:`swimlane-divider-${e.swimlane.id}-${r}`,order:e.order+.1+r/100,bounds:e.bounds,d:i0(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function xc(e,t,r){return{type:"text",id:`swimlane-label-${e.swimlane.id}-${t.id}`,order:e.order+.5+r/100,lines:[t.label],fontFamily:e.swimlane.fontFamily??B,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function a0(e,t,r){let o=e.swimlane.fontSize*1.4,n=e.swimlane.x+10+o/2,i=e.swimlane.y+t.offset+t.size/2,a=Math.max(20,t.size-16),s=n-a/2,l=i-o/2;return{...xc(e,t,r),bounds:N({x:s,y:l,width:a,height:o},-90,12),x:s,y:l,width:a,height:o,align:"center",verticalAlign:"middle",rotation:-90,rotationCenter:{x:n,y:i}}}function s0(e,t,r){return{...xc(e,t,r),bounds:e.bounds,x:e.swimlane.x+t.offset+8,y:e.swimlane.y+8,width:Math.max(0,t.size-16),height:Math.max(0,e.swimlane.height-16),align:"left",verticalAlign:"top"}}function Sc(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?a0:s0;return e.lanes.map((r,o)=>t(e,r,o))}function l0(e){let t=e.orientation==="horizontal"?e.height:e.width,r=e.lanes.reduce((o,n)=>o+n.size,0);return r<=0||t<=0?e.lanes:e.lanes.map(o=>({...o,size:o.size*(t/r)}))}function d0(e){let t=0;return l0(e).map(r=>{let o={...r,offset:t};return t+=r.size,o})}function Cc(e,t){return{swimlane:e,order:5e3+t,bounds:de({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:d0(e)}}function kc(e,t){if(e.isVisible===!1)return[];let r=Cc(e,t);return[{type:"rect",id:`swimlane-${e.id}`,order:r.order,bounds:r.bounds,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:{...Ro(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:vo(e.shadowStyle)}},...bc(r),...Sc(r)]}function Rc(e){return[...e.frames.flatMap((t,r)=>ee(yc(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>ee(kc(t,r),"swimlane",t.id))]}var gr=(e,t,r)=>({x:e.x+t.x*r,y:e.y+t.y*r});function vi(e){return Math.hypot(e.end.x-e.start.x,e.end.y-e.start.y)}function Po(e){return e.text!==void 0?e.text:`${Math.round(vi(e)*10)/10}${e.unit?` ${e.unit}`:""}`}function Pi(e){let t=vi(e),r=t===0?{x:1,y:0}:{x:(e.end.x-e.start.x)/t,y:(e.end.y-e.start.y)/t},o={x:r.y,y:-r.x},n=e.offset<0?-1:1,i=[gr(e.start,o,e.offset),gr(e.end,o,e.offset)],a=Math.abs(e.offset)<=4?[]:[e.start,e.end].map(c=>[gr(c,o,4*n),gr(c,o,e.offset+6*n)]),s=((e.fontSize??11)*.75+2)*n,l={x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2},d=Math.atan2(r.y,r.x)*180/Math.PI;return d>90?d-=180:d<=-90&&(d+=180),{length:t,line:i,extensions:a,label:{center:gr(l,o,s),angle:d}}}var vc="#475569",c0=.6,u0=e=>e.map(([t,r])=>`M ${t.x} ${t.y} L ${r.x} ${r.y}`).join(" ");function wc(e,t,r,o){let n=Math.max(0,p(e.strokeWidth,1)),i=o.flat();return{type:"path",id:`dimension-${e.id}-${t}`,order:r,bounds:{minX:Math.min(...i.map(a=>a.x))-n,minY:Math.min(...i.map(a=>a.y))-n,maxX:Math.max(...i.map(a=>a.x))+n,maxY:Math.max(...i.map(a=>a.y))+n},d:u0(o),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??vc},strokeWidth:n,lineCap:"round"}}}function m0(e,t,r,o,n){let i=p(e.fontSize,11),a=Math.max(24,r.length*i*c0+8),s=i*1.3;return{type:"text",id:`dimension-${e.id}-label`,order:t,bounds:{minX:o.x-a/2,minY:o.y-s/2,maxX:o.x+a/2,maxY:o.y+s/2},x:o.x-a/2,y:o.y-s/2,width:a,height:s,lines:[r],fontFamily:B,fontSize:i,fontWeight:"normal",color:e.textColor??e.strokeColor??vc,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:n,rotationCenter:o}}function p0(e,t){let r=Pi(e),o=31e3+t,n={...wc(e,"line",o+.1,[r.line]),markerStart:"filled_arrow",markerEnd:"filled_arrow"},i=r.extensions.length>0?[wc(e,"extensions",o,r.extensions)]:[],a=Po(e);return[...i,n,m0(e,o+.2,a,r.label.center,r.label.angle)]}function Pc(e){return e.flatMap((t,r)=>ee(p0(t,r),"dimension",t.id,"dimension",Po(t),t.parentFrameId))}function Li(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Lc(e,t,r){let o=Li(e,t);if(o===0)return e;let n=r/o;return{x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}}function f0(e,t,r,o){let n=Math.max(0,Math.min(o,Li(t,e)/2,Li(t,r)/2));return{vertex:t,start:Lc(t,e,n),end:Lc(t,r,n)}}function lt(e,t){if(e.length<3)return"";let r=a=>typeof t=="number"?t:t[a]??0;if(e.every((a,s)=>r(s)<=0)){let[a,...s]=e;return`M ${a.x} ${a.y} ${s.map(l=>`L ${l.x} ${l.y}`).join(" ")} Z`}let o=e.map((a,s)=>f0(e[(s-1+e.length)%e.length],a,e[(s+1)%e.length],r(s))),n=[`M ${o[0].end.x} ${o[0].end.y}`];for(let a=1;a<o.length;a++){let s=o[a];n.push(`L ${s.start.x} ${s.start.y}`,`Q ${s.vertex.x} ${s.vertex.y} ${s.end.x} ${s.end.y}`)}let i=o[0];return n.push(`L ${i.start.x} ${i.start.y}`,`Q ${i.vertex.x} ${i.vertex.y} ${i.end.x} ${i.end.y}`,"Z"),n.join(" ")}var h0={prop:"style.fill",propKind:"color",propSolidOnly:!0};function Bt(e,t){let r=Math.max(0,p(e.strokeWidth,1)),o=p(e.rotation,0),n=li(e),i={x:n.x+n.width/2,y:n.y+n.height/2};return{object:e,index:t,order:15e3+t,rotation:o,rotationCenter:i,box:n,strokeWidth:r,common:{type:"path",bounds:N(n,o,r+2),rotation:o,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function yr(e,t,r,o,n){return{...e.common,id:`isometric-${e.object.id}-${t}`,order:e.order+r,d:lt([...o],0),style:n,...h0}}function Mi(e){let t=Ue(e);return[t.top[0],t.top[1],t.right[2],t.front[2],t.front[3],t.top[3]]}function Ti(e,t,r){let{object:o,order:n,common:i,box:a}=e;return{...i,id:`isometric-${o.id}-hull`,order:n+.24,d:t,detail:{of:"isometricGeometry",width:Math.max(0,o.width),height:Math.max(0,o.height),depth:Math.max(0,o.depth),cornerRadius:r,bounds:a,labelOffsetX:p(o.labelOffsetX,0),labelOffsetY:p(o.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}function Lo(e){return{...Ti(e,lt(Mi(e.object),0),0),style:{...e.common.style,fill:{kind:"none"},stroke:{kind:"none"}}}}var $i=20,g0=12,y0=6,Mo=3,b0=6.5;function x0(e){let{object:t}=e,r=di(t),o=r.y-g0+p(t.labelOffsetY,0);return{anchor:r,centerX:r.x+p(t.labelOffsetX,0),topY:o-$i,bottomY:o}}function S0(e,t,r){let{object:o,order:n,rotation:i,rotationCenter:a,box:s}=e,{centerX:l,topY:d,bottomY:c}=t;return{type:"text",id:`isometric-${o.id}-label`,order:n+.3,bounds:{minX:l-s.width/2,minY:d,maxX:l+s.width/2,maxY:c},x:l-s.width/2,y:d,width:s.width,height:$i,lines:[r],fontFamily:B,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function C0(e,t){let{object:r,order:o,rotation:n,rotationCenter:i}=e,{anchor:a,centerX:s,bottomY:l}=t;return{type:"path",id:`isometric-${r.id}-label-guide`,order:o+.25,bounds:{minX:Math.min(a.x,s),minY:Math.min(a.y,l),maxX:Math.max(a.x,s),maxY:Math.max(a.y,l)},d:`M ${a.x} ${a.y} L ${s} ${l}`,rotation:n,rotationCenter:i,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:1,lineCap:"round",pointerEvents:"none"}}}function k0(e,t,r,o){let{object:n,order:i,rotation:a}=e,{centerX:s,topY:l,bottomY:d}=t,c=Math.max(24,r.length*b0+y0*2);return{type:"rect",id:`isometric-${n.id}-label-background`,order:i+.28,x:s-c/2,y:l-Mo,width:c,height:$i+Mo*2,rx:4,bounds:{minX:s-c/2,minY:l-Mo,maxX:s+c/2,maxY:d+Mo},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:o},stroke:{kind:"none"}}}}function It(e,t){let r=x0(e),o=S0(e,r,t),n=C0(e,r),i=e.object.labelBackground;return i?[n,k0(e,r,t,i),o]:[n,o]}function To(e,t){let{object:r,index:o,rotation:n,rotationCenter:i}=e;if(!r.hasShadow)return;let a=Math.max(0,r.height),s=.6+Math.min(1,a/150)*.7,l=a+p(r.shadowStyle?.distance,0),d=t.map(y=>({x:y.x,y:y.y+l})),c={x:d.reduce((y,x)=>y+x.x,0)/d.length,y:d.reduce((y,x)=>y+x.y,0)/d.length},u=1.3,m=d.map(y=>({x:c.x+(y.x-c.x)*u,y:c.y+(y.y-c.y)*u})),f=m.map(y=>y.x),h=m.map(y=>y.y);return{type:"path",id:`isometric-${r.id}-ground-shadow`,order:14e3+o,bounds:{minX:Math.min(...f),minY:Math.min(...h),maxX:Math.max(...f),maxY:Math.max(...h)},d:lt(m,0),rotation:n,rotationCenter:i,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:Math.min(1,(r.shadowStyle?.opacity??.18)*s),blur:p(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function Mc(e,t){let{object:r,index:o,box:n}=e;if(!r.hasShadow)return;let i=Math.max(0,r.width),a=Math.max(0,r.depth),s={x:n.x+n.width/2,y:r.y+Math.max(0,r.height)+(i+a)*Ye/2};return{type:"ellipse",id:`isometric-${r.id}-ground-shadow`,order:14e3+o,bounds:{minX:s.x-t*1.1,minY:s.y-t*.6,maxX:s.x+t*1.1,maxY:s.y+t*.6},cx:s.x,cy:s.y,rx:t*1.05,ry:t*.52,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:r.shadowStyle?.opacity??.2,blur:p(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function R0(e,t,r){let{object:o,common:n}=e,i={...n.style,stroke:{kind:"none"}},a=pi(o.fill??"#f8fafc"),s=(l,d,c,u)=>yr(e,l,d,c,{...i,fill:{kind:"solid",color:u},clip:r});return[s("top",0,t.top,a.topFill),s("front",.1,t.front,a.frontFill),s("side",.2,t.right,a.sideFill)]}function w0(e,t,r){let{object:o,order:n,common:i,strokeWidth:a}=e;return{...i,id:`isometric-${o.id}-seams`,order:n+.22,d:`M ${t.top[3].x} ${t.top[3].y} L ${t.top[2].x} ${t.top[2].y} L ${t.top[1].x} ${t.top[1].y} M ${t.top[2].x} ${t.top[2].y} L ${t.front[2].x} ${t.front[2].y}`,style:{...i.style,fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:Math.min(a,1),clip:r}}}function Tc(e,t){let r=Bt(e,t),o=Ue(e),n=Math.max(0,p(e.cornerRadius,8)),i=lt(Mi(e),n),a={type:"path",d:i},s=To(r,o.top),l=e.seams===!1?void 0:w0(r,o,a),d=Ti(r,i,n),c=R0(r,o,a),u=s?[d,...c,s,...l?[l]:[]]:[d,...c,...l?[l]:[]];return e.text?[...u,...It(r,e.text)]:u}function v0(e,t,r,o){let n=At(o,t.light);return yr(e,`side-${r}`,.05+r*.001,t.points,{...e.common.style,stroke:{kind:"solid",color:n},strokeWidth:.6,fill:{kind:"solid",color:n}})}function P0(e,t,r){let[o,n,i,a]=t.points,s=[`M ${a.x} ${a.y} L ${i.x} ${i.y}`,...t.smoothStart?[]:[`M ${o.x} ${o.y} L ${a.x} ${a.y}`],...t.smoothEnd?[]:[`M ${n.x} ${n.y} L ${i.x} ${i.y}`]];return{...e.common,id:`isometric-${e.object.id}-side-${r}-edges`,order:e.order+.0505+r*.001,d:s.join(" "),style:{...e.common.style,fill:{kind:"none"}}}}function $c(e,t,r){let o=Bt(e,t),{top:n,sides:i}=ui(e,r,Math.max(0,p(e.cornerRadius,0))),a=e.fill??"#f8fafc",s=To(o,n),l=yr(o,"top",.2,n,{...o.common.style,fill:{kind:"solid",color:a}}),d=[Lo(o),...s?[s]:[],...i.flatMap((c,u)=>[v0(o,c,u,a),P0(o,c,u)]),l];return e.text?[...d,...It(o,e.text)]:d}function Ac(e,t){let r=Bt(e,t),{order:o,common:n,box:i}=r,a=Math.max(0,Math.min(e.width,e.height,e.depth))/2,s=i.x+i.width/2,l=i.y+i.height/2,d=e.fill??"#f8fafc",c={minX:s-a,minY:l-a,maxX:s+a,maxY:l+a},u={type:"ellipse",id:`isometric-${e.id}-sphere`,order:o+.1,bounds:c,cx:s,cy:l,rx:a,ry:a,style:{...n.style,fill:{kind:"linear-gradient",angle:135,stops:[{offset:0,color:At(d,1.22)},{offset:.5,color:d},{offset:1,color:At(d,.82)}]}},prop:"style.fill",propKind:"color",propSolidOnly:!0},m={type:"ellipse",id:`isometric-${e.id}-highlight`,order:o+.2,bounds:c,cx:s-a*.32,cy:l-a*.38,rx:a*.26,ry:a*.18,rotation:-35,style:{fill:{kind:"solid",color:"#ffffff"},stroke:{kind:"none"},opacity:.45,blur:a*.1,pointerEvents:"none"}},f=Mc(r,a),h=[Lo(r),...f?[f]:[],u,m];return e.text?[...h,...It(r,e.text)]:h}function L0(e,t){if(e.form==="sphere")return Ac(e,t);let r=ko(e.footprint);return r.length>0?$c(e,t,r):Tc(e,t)}function Ec(e){return e.flatMap((t,r)=>ee(L0(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function M0(e,t){let r=t==="start"?0:e.length-2,o=t==="start"?2:e.length-4,n=e[r],i=e[r+1],a=e[o]-n,s=e[o+1]-i,l=Math.hypot(a,s)||1,d=a/l,c=s/l;return{x:n+d*20-c*13,y:i+c*20+d*13}}function Nc(e,t,r){let o=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!o)return[];let n=p(e.link.style?.fontSize,10),i=M0(e.points,t),a=90;return[{type:"text",id:`link-${t}-label-${e.link.id}`,order:e.order+.55+r*.01,bounds:e.bounds,x:i.x-a/2,y:i.y-n,width:a,height:n*2,lines:[o],fontFamily:e.link.style?.fontFamily??B,fontSize:n,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function Oc(e){return[...Nc(e,"start",0),...Nc(e,"end",1)]}function Bc(e){return e.label.visible?[{type:"text",id:`link-text-${e.link.id}`,order:e.order+.5,bounds:e.bounds,x:e.midpoint.x-e.label.width/2,y:e.midpoint.y-e.label.fontSize,width:e.label.width,height:e.label.fontSize*2,lines:e.label.lines,fontFamily:e.link.style?.fontFamily??B,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var Ai=e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:t[4]===void 0?1:parseInt(t[4],16)/255}:{r:255,g:255,b:255,a:1}},Ic=(e,t,r,o)=>{let n=a=>{let s=Math.max(0,Math.min(255,Math.round(a))).toString(16);return s.length===1?`0${s}`:s},i=o===void 0||o>=1?"":n(o*255);return`#${n(e)}${n(t)}${n(r)}${i}`};function T0(e,t,r){let o=Ai(e),n=Ai(t),i=o.a??1,a=n.a??1;return Ic(Math.round(o.r+(n.r-o.r)*r),Math.round(o.g+(n.g-o.g)*r),Math.round(o.b+(n.b-o.b)*r),i+(a-i)*r)}function br(e,t){let r=[...e].sort((i,a)=>i.position-a.position),o=r[0],n=r[r.length-1];if(t<=o.position)return o.color;if(t>=n.position)return n.color;for(let i=0;i<r.length-1;i++){let a=r[i],s=r[i+1];if(t>=a.position&&t<=s.position){let l=s.position-a.position,d=l===0?0:(t-a.position)/l;return T0(a.color,s.color,d)}}return n.color}function Dc(e){if(e){if(typeof e=="string")return e;if(e.type==="gradient")return e.stops?.[0]?.color;if(e.type==="solid")return e.color}}var Gc=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function De(e,t,r,o){let n=Math.max(1,Math.floor(t/Math.max(1,r*.58))),i=o?(s,l)=>o.measure(s,!1)+o.spaceWidth+o.measure(l,!1)<=t:(s,l)=>`${s} ${l}`.length<=n,a=[];for(let s of e.split(`
12
+ `)){let l=s.split(/\s+/).filter(Boolean);if(!l.length){a.push("");continue}let d="";for(let c of l)d?i(d,c)?d+=` ${c}`:(a.push(d),d=c):d=c;a.push(d)}return a}function $o(e,t,r,o){if(he(e,r,o)<=t)return e;let n=e.length;for(;n>1&&he(`${e.slice(0,n)}\u2026`,r,o)>t;)n-=1;return`${e.slice(0,n)}\u2026`}function he(e,t,r){return e.length*t*(r?.64:.58)}function _c(e){return{measure:(t,r)=>he(t,e,r),spaceWidth:e*.58}}var dt=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function Ei(e,t,r,o,n){let i=1-n;return{x:i*i*i*e.x+3*i*i*n*t.x+3*i*n*n*r.x+n*n*n*o.x,y:i*i*i*e.y+3*i*i*n*t.y+3*i*n*n*r.y+n*n*n*o.y}}function Ni(e,t,r,o,n){let i=dt(e,t,n),a=dt(t,r,n),s=dt(r,o,n),l=dt(i,a,n),d=dt(a,s,n),c=dt(l,d,n);return{left:[e,i,l,c],right:[c,d,s,o]}}function Ao(e,t){let r=e.length-2;if(t<=0)return{point:{x:e[0],y:e[1]},segmentIndex:0};let o=0;for(let n=0;n<r;n+=2){let i={x:e[n],y:e[n+1]},a={x:e[n+2],y:e[n+3]},s=Math.hypot(a.x-i.x,a.y-i.y);if(o+s>=t){let l=s===0?0:(t-o)/s;return{point:dt(i,a,l),segmentIndex:n}}o+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function Eo(e){let t=0;for(let r=0;r<e.length-2;r+=2)t+=Math.hypot(e[r+2]-e[r],e[r+3]-e[r+1]);return t}function Fc(e,t,r,o,n=40){let i=0,a=e;for(let s=1;s<=n;s++){let l=Ei(e,t,r,o,s/n);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var Dt=40;function $0(e){let t=[0],r=e[0];for(let o=1;o<=Dt;o++){let n=Ei(...e,o/Dt);t.push(t[o-1]+Math.hypot(n.x-r.x,n.y-r.y)),r=n}return t}function Hc(e,t){let r=e[Dt];if(t<=0)return 0;if(t>=r)return 1;for(let o=1;o<=Dt;o++)if(e[o]>=t){let n=(t-e[o-1])/(e[o]-e[o-1]||1);return(o-1+n)/Dt}return 1}function A0(e,t,r){let[o,n,i,a]=e,s=.75*(n.x-o.x)+1.5*(i.x-n.x)+.75*(a.x-i.x),l=.75*(n.y-o.y)+1.5*(i.y-n.y)+.75*(a.y-i.y),d=Math.hypot(s,l),c=d===0?1:Math.abs(s)/d,u=d===0?0:Math.abs(l)/d;return Math.min(t.halfWidth*c+t.halfHeight*u,r)}function Vc(e,t){if(e.length<8)return null;let r=E0(e),o=$0(r),n=o[Dt];if(n===0)return null;let i=n/2,a=Math.max(0,i-t.minimumVisibleStub),s=A0(r,t,a),l=Hc(o,i-s),d=Hc(o,i+s);return{before:N0(r,l),after:O0(r,d),bezier:!0}}function E0(e){return[{x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},{x:e[6],y:e[7]}]}function N0(e,t){return t<=.01?null:Ni(...e,t).left.flatMap(r=>[r.x,r.y])}function O0(e,t){return t>=.99?null:Ni(...e,t).right.flatMap(r=>[r.x,r.y])}function Wc(e,t){if(e.length<4)return null;let r=Eo(e);if(r===0)return null;let o=B0(e,r,t);return{before:D0(e,o.beforeLength),after:G0(e,o.afterLength,r),bezier:!1}}function B0(e,t,r){let o=t/2,n=Ao(e,o),i={x:e[n.segmentIndex],y:e[n.segmentIndex+1]},a={x:e[n.segmentIndex+2],y:e[n.segmentIndex+3]},s=I0(i,a,r,o);return{beforeLength:o-s,afterLength:o+s}}function I0(e,t,r,o){let n=Math.hypot(t.x-e.x,t.y-e.y),i=n===0?1:Math.abs(t.x-e.x)/n,a=n===0?0:Math.abs(t.y-e.y)/n,s=r.halfWidth*i+r.halfHeight*a;return Math.min(s,Math.max(0,o-r.minimumVisibleStub))}function D0(e,t){if(t<=.5)return null;let r=Ao(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function G0(e,t,r){if(t>=r-.5)return null;let o=Ao(e,t);return[o.point.x,o.point.y,...e.slice(o.segmentIndex+2)]}var zc=3,_0=10;function F0(e){return[{x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},{x:e[6],y:e[7]}]}function Oi(e,t){return t?Fc(...F0(e)):Eo(e)}function Yc(e,t,r,o){let n={halfWidth:(r+zc)/2,halfHeight:(o+zc)/2,minimumVisibleStub:_0};return t==="curved"?Vc(e,n):Wc(e,n)}function Bi(e,t,r,o){let n=Yc(e,t,r,o);if(!n||!n.before&&!n.after)return null;let i=Oi(e,n.bezier),a=n.before?Oi(n.before,n.bezier):0,s=n.after?Oi(n.after,n.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function H0(e){let[t,r,o,n,i,a,s,l]=e,d=.5,c=1-d;return{x:c*c*c*t+3*c*c*d*o+3*c*d*d*i+d*d*d*s,y:c*c*c*r+3*c*c*d*n+3*c*d*d*a+d*d*d*l}}function V0(e,t){let r=0,o=[];for(let a=0;a<e.length-2;a+=2){let s={x:e[a],y:e[a+1]},l={x:e[a+2],y:e[a+3]},d=Math.sqrt((l.x-s.x)**2+(l.y-s.y)**2);r+=d,o.push({start:s,end:l,length:d})}let n=r/2,i=0;for(let a of o){if(i+a.length>=n){let s=(n-i)/a.length;return{x:a.start.x+s*(a.end.x-a.start.x),y:a.start.y+s*(a.end.y-a.start.y)}}i+=a.length}return t}function Ii(e,t,r,o){if(t==="curved")return H0(e);let n={x:(r.x+o.x)/2,y:(r.y+o.y)/2};return t==="orthogonal"?V0(e,n):n}function Gt(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function W0(e,t,r,o,n){let i=n?.min??50,a=n?.max??240,s=n?.perpendicularScale??.9,l=t.x-e.x,d=t.y-e.y,c=Math.abs(l*r[0]+d*r[1]),u=Math.abs(l*o[0]+d*o[1]),m=Math.abs(l*r[1]-d*r[0]),f=Math.abs(l*o[1]-d*o[0]),h=r[0]===o[0]&&r[1]===o[1]||r[0]===-o[0]&&r[1]===-o[1],y=Math.max(i,Math.min(a,Math.max(c,m*s))),x=Math.max(i,Math.min(a,Math.max(u,f*s)));return h&&(y=Math.min(a,y+m*.75),x=Math.min(a,x+f*.75)),{fromDistance:y,toDistance:x}}function Uc(e,t,r,o,n){let i=Gt(r),a=Gt(o),{fromDistance:s,toDistance:l}=W0(e,t,i,a,n);return{p0:[e.x,e.y],p1:[e.x+i[0]*s,e.y+i[1]*s],p2:[t.x+a[0]*l,t.y+a[1]*l],p3:[t.x,t.y]}}function jc(e,t,r,o){let{p0:n,p1:i,p2:a,p3:s}=Uc(e,t,r,o,{min:35,max:90,perpendicularScale:.5});return{points:[...n,...i,...a,...s],segments:[]}}function qc(e,t,r,o){let i=["top","bottom"].includes(r)&&["top","bottom"].includes(o),a=["left","right"].includes(r)&&["left","right"].includes(o);return i&&Math.abs(t.x-e.x)<6?[e,{...t,x:e.x}]:a&&Math.abs(t.y-e.y)<6?[e,{...t,y:e.y}]:[e,t]}function Kc(e,t,r){return r?.toEdge?r.toEdge==="left"||r.toEdge==="right":r?.fromEdge?r.fromEdge==="left"||r.fromEdge==="right":Math.abs(t.x-e.x)>Math.abs(t.y-e.y)}function Zc(e,t,r,o,n){let i=40,a=40,s=n?0:1,l=n?t.x-e.x:t.y-e.y;if(r[s]!==0&&r[s]===-o[s]){let d=l*r[s];d>0&&d<i+a&&(i=d/2,a=d/2)}else if(r[s]===0){let d=l*-o[s];d>0&&d<a&&(a=d)}return[i,a]}function Qc(e){let{fromConnection:t,toConnection:r,to:o,horizontalFirst:n}=e,i=t.stub,a=r.stub,s=(i[0]+a[0])/2,l=(i[1]+a[1])/2,d=Xc(t.side),c=Xc(r.side);return d!==c?n?s=(i[0]-o.x)*r.normal[0]>=0?i[0]:a[0]:l=(i[1]-o.y)*r.normal[1]>=0?i[1]:a[1]:t.side===r.side&&(n?s=t.normal[0]<0?Math.min(i[0],a[0]):Math.max(i[0],a[0]):l=t.normal[1]<0?Math.min(i[1],a[1]):Math.max(i[1],a[1])),[s,l]}function Xc(e){return e==="left"||e==="right"}function Jc(e){let t=[];for(let r=0;r<e.length-2;r+=2)t.push({x:(e[r]+e[r+2])/2,y:(e[r+1]+e[r+3])/2});return t}function eu(e,t){let{from:r,to:o,fromConnection:n,toConnection:i,horizontalFirst:a}=e,s=n.stub,l=i.stub,d=[r.x,r.y,s[0],s[1]];return a?d.push(t[0],s[1],t[0],l[1]):d.push(s[0],t[1],l[0],t[1]),d.push(l[0],l[1],o.x,o.y),d}function tu(e,t,r){let o=e?["left","right"]:["top","bottom"];return[!o.includes(t),!o.includes(r)]}function ru(e,t,r,o){let{from:n,to:i,fromConnection:a,toConnection:s,horizontalFirst:l}=e,d=a.stub,c=s.stub,u=o[0]&&r?.[1]||0,m=r?.[2]||0,f=o[1]&&r?.[3]||0;if(l){let b=d[1]+u,C=t[0]+m,S=c[1]+f;return[n.x,n.y,d[0],b,C,b,C,S,c[0],S,i.x,i.y]}let h=d[0]+u,y=t[1]+m,x=c[0]+f;return[n.x,n.y,h,d[1],h,y,x,y,x,c[1],i.x,i.y]}function ou(e,t,r,o){let n=(e.length-2)/2;return t.map((i,a)=>{let s=a*2,l={x:e[s],y:e[s+1]},d={x:e[s+2],y:e[s+3]},c={x:(l.x+d.x)/2,y:(l.y+d.y)/2},u=a>0&&a<n-1,m=a===1?r:a===n-2?o:!0,f=Math.hypot(d.x-l.x,d.y-l.y)>=1;return{start:l,end:d,midpoint:c,originalMidpoint:i,isHorizontal:Math.abs(d.x-l.x)>Math.abs(d.y-l.y),canMove:u&&m&&f}})}function No(e,t){if(e.length<6)return e;let r=j0(e),o=[r[0]];for(let n=1;n<r.length-1;n++){let i=z0(r[n-1],r[n],r[n+1],t);o.push(...i?U0(i):[r[n]])}return o.push(r[r.length-1]),o.flatMap(n=>[n.x,n.y])}function z0(e,t,r,o){let n={x:t.x-e.x,y:t.y-e.y},i={x:r.x-t.x,y:r.y-t.y},a=n.x===0||n.y===0,s=i.x===0||i.y===0,l=n.x===0&&i.x===0||n.y===0&&i.y===0;if(!a||!s||l)return null;let d=Math.min(o,nu(n)*.4,nu(i)*.4);if(d<=0)return null;let c=iu(n),u=iu(i),m=Di(t,c,-d),f=Di(t,u,d),h=Di(m,u,d),y=Math.atan2(m.y-h.y,m.x-h.x),x=Math.atan2(f.y-h.y,f.x-h.x);return{entry:m,exit:f,center:h,radius:d,startAngle:y,angleSweep:Y0(x-y)}}function Di(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function nu(e){return Math.abs(e.x)+Math.abs(e.y)}function iu(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function Y0(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function U0(e){let t=[e.entry];for(let r=1;r<7;r++){let o=r/7,n=e.startAngle+e.angleSweep*o;t.push({x:e.center.x+Math.cos(n)*e.radius,y:e.center.y+Math.sin(n)*e.radius})}return t.push(e.exit),t}function j0(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Gi(e){let t=X0(e),r=Qc(t),o=eu(t,r),n=Jc(o),i=tu(t.horizontalFirst,e.fromSide,e.toSide),a=ru(t,r,e.segmentOffsets,i),s=ou(a,n,i[0],i[1]);return{points:No(a,10),segments:s}}function X0(e){let[t,r]=qc(e.from,e.to,e.fromSide,e.toSide),o=Gt(e.fromSide),n=Gt(e.toSide),i=Kc(t,r,e.endpointEdges),[a,s]=Zc(t,r,o,n,i);return{from:t,to:r,fromConnection:au(t,e.fromSide,o,a),toConnection:au(r,e.toSide,n,s),horizontalFirst:i}}function au(e,t,r,o){return{side:t,normal:r,stub:[e.x+r[0]*o,e.y+r[1]*o]}}var su=.5;function lu(e,t,r){let o=[e,...t,r],n=[];for(let a of o)n.push(a.x,a.y);let i=[];for(let a=0;a<n.length-2;a+=2){let s={x:n[a],y:n[a+1]},l={x:n[a+2],y:n[a+3]},d={x:(s.x+l.x)/2,y:(s.y+l.y)/2};i.push({start:s,end:l,midpoint:d,originalMidpoint:d,isHorizontal:Math.abs(l.x-s.x)>Math.abs(l.y-s.y),canMove:!1})}return{points:No(n,10),segments:i}}function _i(e){return e.every(t=>{let r=Math.abs(t.end.x-t.start.x),o=Math.abs(t.end.y-t.start.y);return r<=su||o<=su})}function du(e,t,r,o,n){if(e.waypoints&&e.waypoints.length>0){let l=lu(t,e.waypoints,r);if(_i(l.segments))return l}let i={fromEdge:o,toEdge:n},a={from:t,to:r,fromSide:o,toSide:n,segmentOffsets:e.segmentOffsets,endpointEdges:i},s=Gi(a);return _i(s.segments)?s:Gi({...a,segmentOffsets:void 0})}function cu(e,t){let r=Math.atan2(t.y-e.y,t.x-e.x);return r>=-Math.PI/4&&r<Math.PI/4?"right":r>=Math.PI/4&&r<3*Math.PI/4?"bottom":r>=-3*Math.PI/4&&r<-Math.PI/4?"top":"left"}function uu(e,t,r){let o=e.fromPoint?.kind==="side"?e.fromPoint.side:cu(t,r),n=e.toPoint?.kind==="side"?e.toPoint.side:cu(r,t);return{fromSide:o,toSide:n}}function mu(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function pu(e,t,r,o){let{fromSide:n,toSide:i}=uu(e,t,r);return o==="curved"?jc(t,r,n,i):o==="orthogonal"?du(e,t,r,n,i):mu(t,r)}function q0(e,t){let r=e.filter((n,i)=>i%2===0),o=e.filter((n,i)=>i%2===1);return{minX:Math.min(...r)-t,minY:Math.min(...o)-t,maxX:Math.max(...r)+t,maxY:Math.max(...o)+t}}function K0(e,t){let r=!!(e.showText&&e.text),o=p(e.style?.fontSize,10),n=Math.min(250,Math.max(o*2,(e.text?.length??0)*o*.65+10)),i=t?.(e.style?.fontFamily??B,o),a=r?De(e.text??"",n,o,i):[];return{visible:r,fontSize:o,width:n,height:a.length*o*1.4,lines:a}}function Z0(e,t,r,o){let n=e.link,i=typeof n.style?.color=="object"&&n.style.color.type==="gradient"?{kind:"linear-gradient",angle:0,stops:n.style.color.stops.map(a=>({offset:a.position,color:a.color}))}:{kind:"solid",color:r};return{fill:{kind:"none"},stroke:i,strokeWidth:t,dash:o,lineCap:"round",lineJoin:"round",opacity:p(n.style?.opacity,1),shadow:vo(n.style?.shadow)}}function fu(e,t,r){let{link:o,from:n,to:i}=e,a=o.style?.pathType??"orthogonal",{points:s,segments:l}=pu(o,n,i,a),d=p(o.style?.strokeWidth,2),c=Dc(o.style?.color)||"#64748b",u=K0(o,r),m=Gc(d,o.style?.strokeStyle??"solid"),f=u.visible&&!m?Bi(s,a,u.width,u.height):null,h=f?[f.dashBefore,f.gapLength,1e6]:m;return{link:o,pathType:a,points:s,segments:l,midpoint:Ii(s,a,n,i),strokeWidth:d,bounds:q0(s,d+14),color:c,order:2e4+t,style:Z0(e,d,c,h),label:u,hasLabelGap:!!f}}function Fi(e,t){let r=t==="start"?e.startMarker:e.endMarker;if(r)return r;let o=e.style?.arrowDirection??"forward";return o==="bidirectional"||t==="start"&&o==="backward"||t==="end"&&o==="forward"?"arrow":"none"}function hu(e,t){if(e.length===0)return"";let r=[e[0].start,...e.map(s=>s.end)],o=r.filter((s,l)=>l===0||s.x!==r[l-1].x||s.y!==r[l-1].y),n=o.filter((s,l)=>{if(l===0||l===o.length-1)return!0;let d=o[l-1],c=o[l+1];return!(d.x===s.x&&s.x===c.x||d.y===s.y&&s.y===c.y)});if(n.length<2)return"";let i=`M ${n[0].x} ${n[0].y}`;for(let s=1;s<n.length-1;s++){let l=n[s-1],d=n[s],c=n[s+1],u=Math.hypot(d.x-l.x,d.y-l.y),m=Math.hypot(c.x-d.x,c.y-d.y);if(u===0||m===0){i+=` L ${d.x} ${d.y}`;continue}let f=Math.min(t,u*.4,m*.4),h={x:d.x+(l.x-d.x)/u*f,y:d.y+(l.y-d.y)/u*f},y={x:d.x+(c.x-d.x)/m*f,y:d.y+(c.y-d.y)/m*f};i+=` L ${h.x} ${h.y} Q ${d.x} ${d.y} ${y.x} ${y.y}`}let a=n[n.length-1];return`${i} L ${a.x} ${a.y}`}function Q0(e){let t=`M ${e[0]} ${e[1]}`;for(let r=2;r<e.length;r+=2)t+=` L ${e[r]} ${e[r+1]}`;return t}function J0(e,t,r,o){return e.length<4?"":t==="curved"&&e.length>=8?`M ${e[0]} ${e[1]} C ${e[2]} ${e[3]} ${e[4]} ${e[5]} ${e[6]} ${e[7]}`:t==="orthogonal"&&r.length>0?hu(r,Math.max(16,o*4)):Q0(e)}var _t=e=>Math.round(e*100)/100;function ex(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:_t(r.start.x),ay:_t(r.start.y),bx:_t(r.end.x),by:_t(r.end.y),ox:_t(r.originalMidpoint.x),oy:_t(r.originalMidpoint.y),movable:r.canMove}))}function gu(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:J0(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:Fi(t,"start"),markerEnd:Fi(t,"end"),detail:{of:"link",fromId:t.fromId,toId:t.toId,route:e.pathType,fromSide:t.fromPoint?.kind==="side"?t.fromPoint.side:void 0,toSide:t.toPoint?.kind==="side"?t.toPoint.side:void 0,fromFace:t.fromPoint?.kind==="face"?t.fromPoint.face:void 0,toFace:t.toPoint?.kind==="face"?t.toPoint.face:void 0,labelGap:e.hasLabelGap,segments:ex(e.pathType,e.segments)}}}function yu(e){let{link:t}=e;if(t.weight===void 0||t.weight===null||t.showWeight===!1)return[];let r=t.weight.toFixed(1),o=Math.max(30,r.length*8+12),n=16,i=e.midpoint.y+(e.label.visible?e.label.height/2+10:0);return[{type:"rect",id:`link-weight-badge-${t.id}`,order:e.order+.6,bounds:e.bounds,x:e.midpoint.x-o/2,y:i-n/2,width:o,height:n,rx:n/2,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"},opacity:.92}},{type:"text",id:`link-weight-${t.id}`,order:e.order+.61,bounds:e.bounds,x:e.midpoint.x-o/2,y:i-n/2,width:o,height:n,lines:[r],fontFamily:"Arial, sans-serif",fontSize:10,fontWeight:"bold",color:"#ffffff",align:"center",verticalAlign:"middle",lineHeight:1}]}function tx(e,t,r){if(e.link.isVisible===!1)return[];let o=fu(e,t,r);return[gu(o),...Bc(o),...yu(o),...Oc(o)]}function bu(e,t){return e.flatMap((r,o)=>ee(tx(r,o,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function rx(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=p(e.strokeWidth,2),o=r+12,n={minX:Math.min(...e.points.map(s=>s.x))-o,minY:Math.min(...e.points.map(s=>s.y))-o,maxX:Math.max(...e.points.map(s=>s.x))+o,maxY:Math.max(...e.points.map(s=>s.y))+o},i=p(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:n,d:Te({points:e.points,tension:i,closed:a}),markerStart:e.startMarker,markerEnd:e.endMarker,detail:{of:"pathGeometry",points:e.points.map(s=>[s.x,s.y]),tension:i,closed:a},style:{fill:e.closed?{kind:"solid",color:e.fillColor??"transparent"}:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??"#7c3aed"},strokeWidth:r,dash:e.dash?.length?e.dash:void 0,lineCap:"round",lineJoin:"round",opacity:p(e.opacity,1)}}]}function xu(e){return e.flatMap((t,r)=>ee(rx(t,r),"path",t.id,"path","Path"))}function xr(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var ox=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],Oo=Math.PI/2,nx=4*Oo,Su=Math.PI/2,ix=1e-9;function Hi([e,t,r],o){return[e+r*Math.cos(o),t+r*Math.sin(o)]}function Cu([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function ku(e,t,r){let o=t[0]-e[0],n=t[1]-e[1],i=Math.hypot(o,n),a=(e[2]**2-t[2]**2+i**2)/(2*i),s=Math.sqrt(Math.max(0,e[2]**2-a**2)),l=e[0]+a*o/i,d=e[1]+a*n/i,c=[[l-s*n/i,d+s*o/i],[l+s*n/i,d-s*o/i]],u=m=>Math.hypot(m[0]-r[0],m[1]-r[1]);return u(c[0])>u(c[1])?c[0]:c[1]}function ax(e){let t=[e.reduce((r,o)=>r+o[0],0)/e.length,e.reduce((r,o)=>r+o[1],0)/e.length];return e.map((r,o)=>{let n=o===0?Su:Cu(r,ku(e[o-1],r,t)),a=o===e.length-1?Su:Cu(r,ku(r,e[o+1],t));for(;a<=n;)a+=nx;return{lobe:r,from:n,to:a}})}function sx(e,t){let r=[];for(let o=Math.floor(e/Oo)+1;o*Oo<t-ix;o++)r.push(o*Oo);return[...r,t]}function lx({lobe:e,from:t,to:r}){let o=Hi(e,t),n=[],i=t;for(let a of sx(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Hi(e,i),d=Hi(e,a);n.push([[l[0]-s*Math.sin(i),l[1]+s*Math.cos(i)],[d[0]+s*Math.sin(a),d[1]-s*Math.cos(a)],d]),i=a}return{start:o,curves:n}}function dx(){let e=ax(ox).map(lx),t=e[0].start,r=e.flatMap(d=>d.curves),o=[t,...r.map(d=>d[2])],n=Math.min(...o.map(d=>d[0])),i=Math.max(...o.map(d=>d[0])),a=Math.min(...o.map(d=>d[1])),s=Math.max(...o.map(d=>d[1])),l=d=>[(d[0]-n)/(i-n),(d[1]-a)/(s-a)];return{start:l(t),curves:r.map(([d,c,u])=>[l(d),l(c),l(u)])}}var Ru=dx();function wu(e,t,r,o){let n=([a,s])=>`${e+a*r} ${t+s*o}`,i=Ru.curves.map(([a,s,l])=>`C ${n(a)} ${n(s)} ${n(l)}`);return`M ${n(Ru.start)} ${i.join(" ")} Z`}function vu(e,t,r,o){let n=Math.min(o*.22,r*.2),i=r/2,a=e+i,s=e,l=e+r,d=t+n,c=t+o-n,u=`M ${s} ${d} C ${s} ${d+.5523*n} ${a-.5523*i} ${d+n} ${a} ${d+n} C ${a+.5523*i} ${d+n} ${l} ${d+.5523*n} ${l} ${d} C ${l} ${d-.5523*n} ${a+.5523*i} ${t} ${a} ${t} C ${a-.5523*i} ${t} ${s} ${d-.5523*n} ${s} ${d} Z`,m=`M ${s} ${d} L ${s} ${c} C ${s} ${c+.5523*n} ${a-.5523*i} ${t+o} ${a} ${t+o} C ${a+.5523*i} ${t+o} ${l} ${c+.5523*n} ${l} ${c} L ${l} ${d}`;return`${u} ${m}`}function Pu(e,t,r,o){let n=Math.min(r/4,o/4.35),i=n,a=n*2,s=n*4.35,l=t+(o-s)/2;return{head:i,body:a,centerX:e+r/2,headCenterY:l+i,bottom:l+s}}function Lu(e,t,r,o){let{body:n,centerX:i,bottom:a}=Pu(e,t,r,o);return{x:i-n,y:a-n,width:n*2,height:n}}function Mu(e,t,r,o){let{head:n,body:i,centerX:a,headCenterY:s,bottom:l}=Pu(e,t,r,o),d=`M ${a} ${s-n} C ${a+.5523*n} ${s-n} ${a+n} ${s-.5523*n} ${a+n} ${s} C ${a+n} ${s+.5523*n} ${a+.5523*n} ${s+n} ${a} ${s+n} C ${a-.5523*n} ${s+n} ${a-n} ${s+.5523*n} ${a-n} ${s} C ${a-n} ${s-.5523*n} ${a-.5523*n} ${s-n} ${a} ${s-n} Z`,c=`M ${a-i} ${l} C ${a-i} ${l-.5523*i} ${a-.5523*i} ${l-i} ${a} ${l-i} C ${a+.5523*i} ${l-i} ${a+i} ${l-.5523*i} ${a+i} ${l} Z`;return`${d} ${c}`}var cx=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,o)=>t+(o%2?` ${r}`:` L ${r}`),"")} Z`,ux=.1,mx=Math.PI/6,px=.25,fx=.15;function Tu(e,t){return Math.min(e,t)/2}function $u(e,t,r,o,n){let i=(...a)=>cx(a);switch(e){case"diamond":return i(t+o/2,r,t+o,r+n/2,t+o/2,r+n,t,r+n/2);case"triangle":return i(t+o/2,r,t,r+n,t+o,r+n);case"parallelogram":return i(t+o*.15,r,t+o,r,t+o*.85,r+n,t,r+n);case"trapezoid":return i(t+o*.2,r,t+o*.8,r,t+o,r+n,t,r+n);case"hexagon":{let a=Math.min(o,n)/4;return i(t+a,r,t+o-a,r,t+o,r+n/2,t+o-a,r+n,t+a,r+n,t,r+n/2)}case"document":{let a=n*ux,s=r+n-a,l=o/4,d=a*mx;return`M ${t} ${r} L ${t+o} ${r} L ${t+o} ${s} C ${t+o-l/3} ${s-d} ${t+o-l*2/3} ${s-a} ${t+o-l} ${s-a} C ${t+o-l-l/3} ${s-a} ${t+o/2+l/3} ${s-d} ${t+o/2} ${s} C ${t+o/2-l/3} ${s+d} ${t+o/2-l*2/3} ${s+a} ${t+l} ${s+a} C ${t+l-l/3} ${s+a} ${t+l/3} ${s+d} ${t} ${s} Z`}case"note":{let a=Math.min(o,n)*px;return`M ${t} ${r} L ${t+o-a} ${r} L ${t+o} ${r+a} L ${t+o} ${r+n} L ${t} ${r+n} Z M ${t+o} ${r+a} L ${t+o-a} ${r+a} L ${t+o-a} ${r}`}case"cloud":return wu(t,r,o,n);case"cylinder":return vu(t,r,o,n);case"person":return Mu(t,r,o,n);case"predefined_process":{let a=Math.min(o,n)*fx;return`M ${t} ${r} L ${t+o} ${r} L ${t+o} ${r+n} L ${t} ${r+n} Z M ${t+a} ${r} L ${t+a} ${r+n} M ${t+o-a} ${r} L ${t+o-a} ${r+n}`}default:return null}}function ke(e){let t=$u(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...xr(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function Au(e){return ke(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function Ft(e){let t=e.shape.shapeType==="pill"?Tu(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?p(e.shape.cornerRadius,8):0;return[{...xr(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function Vi(e){return[{...xr(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function Eu(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return Ft(e);let t=p(e.shape.symbol.tension,0),r=e.shape.symbol.points.map(([o,n])=>({x:e.x+o*e.width,y:e.y+n*e.height}));return[{...xr(e),type:"path",d:Te({points:r,tension:t,closed:!0}),rotationCenter:e.rotationCenter,detail:{of:"symbolGeometry",points:e.shape.symbol.points,tension:t,declaredBounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}]}var hx={cloud:ke,cylinder:ke,diamond:ke,document:ke,hexagon:ke,note:ke,oval:Vi,circle:Vi,parallelogram:ke,person:Au,pill:Ft,predefined_process:ke,rectangle:Ft,rounded_rectangle:Ft,symbol:Eu,trapezoid:ke,triangle:ke};function Sr(e){return(hx[e.shape.shapeType]??Ft)(e)}var gx=new Set(["reactivePanel","ledMatrix","lightBand","silkFolds","glowCard","glassDots"]);function yx(e){if(e.shape.shapeType==="circle"||e.shape.shapeType==="oval")return"ellipse";if((e.shape.shapeType==="rectangle"||e.shape.shapeType==="rounded_rectangle")&&e.shape.shader&&gx.has(e.shape.shader.program))return"rect"}function Nu(e){if(!e.shape.shader)return;let t=yx(e);if(!t)return;let r=t==="rect"?Math.max(0,e.shape.shader.surfacePadding??0):0,o={x:e.x-r,y:e.y-r,width:e.width+r*2,height:e.height+r*2};return{id:`${e.id}-shader`,type:"shader-surface",order:e.order,bounds:N(o,e.rotation,0),...o,rotation:e.rotation,shader:e.shape.shader,mask:t,fillColor:e.style.fill?.kind==="solid"?e.style.fill.color:void 0}}var bx={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},te={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},Ou={rectangle:te,rounded_rectangle:{...te,cornerRadius:8},triangle:{...te,rotation:0},diamond:{...te,rotation:0},hexagon:{...te,rotation:0},oval:{...te,rotation:0},circle:{...te,rotation:0},document:{...te,rotation:0},parallelogram:{...te,rotation:0},trapezoid:{...te,rotation:0},cylinder:{...te,rotation:0},note:{...te,rotation:0},cloud:{...te,rotation:0},predefined_process:{...te,rotation:0},pill:te,person:{...te,rotation:0},symbol:{...te,rotation:0}};function Wi(e,t){let r=Ou[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${bx[e.shapeType]??""}, falling back to rectangle defaults.`}),Ou.rectangle)}function xx(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function Bu(e,t){let r=Wi(e,t),o=p(e.strokeWidth,r.strokeWidth),n=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=p(n?.angle,45)*Math.PI/180;return{fill:P(e.fillColor,t,e.id),stroke:P(e.strokeColor,t,e.id),strokeWidth:o,dash:xx(e,o),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:p(e.opacity,r.opacity),blur:e.blur!==void 0&&e.blur>0?e.blur:void 0,blend:e.blend,shadow:n?.enabled?{color:n.color??"#000000",opacity:p(n.opacity,.25),blur:p(n.blur,10),dx:Math.cos(i)*p(n.distance,5),dy:Math.sin(i)*p(n.distance,5)}:void 0}}var zi=/\*\*([^*]+)\*\*/g;function Iu(e){return/\*\*[^*]+\*\*/.test(e)}function Sx(e){let t=[],r=0;zi.lastIndex=0;let o;for(;o=zi.exec(e);)o.index>r&&t.push({text:e.slice(r,o.index),bold:!1}),o[1]&&t.push({text:o[1],bold:!0}),r=zi.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function Cx(e){return e.split(`
13
+ `).map(Sx)}function kx(e){let t=[];for(let r of e)for(let o of r.text.split(/\s+/))o&&t.push({text:o,bold:r.bold});return t}function Rx(e,t,r,o){let n=kx(e);if(!n.length)return[[]];let i=[],a=[],s=0;for(let l of n){let d=r(l.text,l.bold),c=a.length?o+d:d;a.length&&s+c>t?(i.push(a),a=[l],s=d):(a.push(l),s+=c)}return i.push(a),i}function Du(e,t,r,o){return Cx(e).flatMap(n=>Rx(n,Math.max(1,t),r,o))}function Gu(e,t,r){let{shape:o,bounds:n,order:i,rotation:a,rotationCenter:s,x:l,y:d,width:c,height:u}=e;if(!o.text)return null;let m=p(o.fontSize,Wi(o,[]).fontSize),f=o.isText?0:Math.max(8,t*2),h=o.shapeType==="person"?Lu(l,d,c,u):{x:l,y:d,width:c,height:u},y=Math.max(0,h.width-f*2),x=o.fontFamily||B,b=r?.(x,m),C={type:"text",id:`shape-text-${o.id}`,order:i+.5,bounds:n,x:h.x+f,y:h.y+f,width:y,height:Math.max(0,h.height-f*2),lines:De(o.text,y,m,b),fontFamily:x,fontSize:m,fontWeight:o.fontWeight??"normal",letterSpacing:o.letterSpacing,color:o.textColor||"#111827",align:o.textAlign??"center",verticalAlign:o.textVerticalAlign??"middle",lineHeight:p(o.lineHeight,1.3),rotation:a,rotationCenter:s};if(Iu(o.text)){let{measure:S,spaceWidth:w}=b??_c(m);C.richLines=Du(o.text,y,S,w)}return C}function wx(e,t){let r=Math.max(0,e.width-2*t),o=Math.max(0,e.height-2*t),n={...e.style,fill:{kind:"none"},strokeWidth:Math.max(1,t/3),dash:void 0,shadow:void 0},i=Sr({...e,style:n});if(r<=0||o<=0)return i;let a={...e,x:e.x+t,y:e.y+t,width:r,height:o};return i.push(...Sr({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...Sr({...a,id:`${e.id}-inner`,style:n})),i}function vx(e,t,r){let o=p(e.x,0),n=p(e.y,0),i=Math.max(0,p(e.width,100)),a=Math.max(0,p(e.height,100)),s=p(e.rotation,0),l=p(e.strokeWidth,2);return{strokeWidth:l,context:{shape:e,id:`shape-${e.id}`,order:1e4+t,bounds:N({x:o,y:n,width:i,height:a},s,l+(e.hasShadow?20:2)),rotation:s,rotationCenter:{x:o+i/2,y:n+a/2},style:Bu(e,r),x:o,y:n,width:i,height:a}}}function Px(e,t,r,o){if(e.isVisible===!1)return[];let{context:n,strokeWidth:i}=vx(e,t,r),a=e.strokeStyle==="double"?wx(n,i||1):Sr(n),s=Nu(n);if(s){for(let d of a)(d.type==="ellipse"||d.type==="path"||d.type==="rect")&&(d.style={...d.style,pointerEvents:"all"});a.push(s)}let l=Gu(n,i,o);return l&&a.push(l),a}function _u(e,t,r){return e.flatMap((o,n)=>ee(Px(o,n,t,r),"shape",o.id,o.shapeType,o.text||o.shapeType,o.parentFrameId??void 0))}var E=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],K="#94a3b8",Cr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],Yi=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function U(e){if(!(e.step>0))return e.min===e.max?[e.min]:[e.min,e.max];let t=e.min<=e.max,r=t?e.step:-e.step,o=[];for(let n=e.min;(t?n<=e.max+1e-9:n>=e.max-1e-9)&&o.length<1e3;n+=r)o.push(Math.round(n*1e3)/1e3);return o}function kr(e){let t=[...e.thresholds??[]].filter(r=>r>e.min&&r<e.max).sort((r,o)=>r-o);return[e.min,...t,e.max]}function Rr(e,t,r){let o=Math.max(0,t.length-1),n=r.slice(0,o).map((i,a)=>({position:t[a+1]??t[t.length-1],color:i.color??K}));return n.length?br(n,e):K}function Re(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var we={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function Ui(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function ji(e,t,r){let o=r?we.padX:0,n=r?we.padY:0,i=t*we.lineHeight;return{width:e.length*t*we.charWidth+o*2,height:i+n*2,lineHeight:i,padX:o,padY:n}}function Xi(e,t,r,o){let n=o/2;return`M ${e+n} ${t} H ${e+r-n} A ${n} ${n} 0 0 1 ${e+r-n} ${t+o} H ${e+n} A ${n} ${n} 0 0 1 ${e+n} ${t} Z`}function Bo(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e} ${t+i} Q ${e} ${t} ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+o} H ${e} Z`}function Ge(e,t,r,o,n){let i=Math.max(0,Math.min(n,r/2,o/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+o} H ${e} Z`:`M ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+o-i} Q ${e+r} ${t+o} ${e+r-i} ${t+o} H ${e+i} Q ${e} ${t+o} ${e} ${t+o-i} V ${t+i} Q ${e} ${t} ${e+i} ${t} Z`}function ct(e,t,r,o,n,i){return i?Ge(e,t,r,o,n):Bo(e,t,r,o,n)}function qi(e,t){if(e.length===1)return e[0];let r=(e.length-1)*t,o=Math.floor(r),n=Math.ceil(r);return o===n?e[o]:e[o]+(r-o)*(e[n]-e[o])}function Ki(e){if(!e?.length)return null;let t=[...e].sort((r,o)=>r-o);return{min:t[0],q1:qi(t,.25),median:qi(t,.5),q3:qi(t,.75),max:t[t.length-1]}}function wr(e){if(e?.[0]!=="#")return;let t=e.length===4?e.slice(1).split("").map(i=>parseInt(i+i,16)):[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)),[r,o,n]=t;return[r,o,n].some(i=>Number.isNaN(i))?void 0:[r,o,n]}function Zi(e,t){let r=wr(e),o=Math.max(0,Math.min(1,t));if(!r)return o<=0?"transparent":e??"transparent";let[n,i,a]=r;return`rgba(${n}, ${i}, ${a}, ${o})`}function Qi(e,t,r){let o=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(r)}`}function Do(e,t,r){let o=e/255,n=t/255,i=r/255,a=Math.max(o,n,i),s=Math.min(o,n,i),l=(a+s)/2,d=a-s;if(d===0)return[0,0,l];let c=d/(1-Math.abs(2*l-1)),u;return a===o?u=(n-i)/d%6:a===n?u=(i-o)/d+2:u=(o-n)/d+4,u*=60,u<0&&(u+=360),[u,c,l]}function Ji(e,t,r){let o=(1-Math.abs(2*r-1))*t,n=o*(1-Math.abs(e/60%2-1)),i=r-o/2,[a,s,l]=[0,0,0];return e<60?[a,s,l]=[o,n,0]:e<120?[a,s,l]=[n,o,0]:e<180?[a,s,l]=[0,o,n]:e<240?[a,s,l]=[0,n,o]:e<300?[a,s,l]=[n,0,o]:[a,s,l]=[o,0,n],[(a+i)*255,(s+i)*255,(l+i)*255]}function Fu(e,t,r){let o=n=>{let i=n/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(r)}function Lx(e,t){let r=Math.max(e,t),o=Math.min(e,t);return(r+.05)/(o+.05)}var Io=.35,Hu=.08,Vu=.22,Wu=.78,zu=.92,Mx=3;function ce(e){let t=wr(e);if(!t)return"#0f172a";let[r,o,n]=t,i=(.299*r+.587*o+.114*n)/255>.6?"#0f172a":"#ffffff",[a,s,l]=Do(r,o,n);if(s===0)return i;let d=l>.5?Math.max(Hu,Math.min(l-Io,Vu)):Math.min(zu,Math.max(l+Io,Wu)),c=Ji(a,s,d);return Lx(Fu(r,o,n),Fu(...c))>=Mx?Qi(...c):i}function Ht(e,t){let r=wr(e);if(!r)return t;let[o,n,i]=r,[a,s,l]=Do(o,n,i);if(s===0)return t;let d=l>.5?Math.max(Hu,Math.min(l-Io,Vu)):Math.min(zu,Math.max(l+Io,Wu));return Qi(...Ji(a,s,d))}function Go(e){let t=wr(e);return t?Do(...t)[2]>.5:!1}function Je(e,t){let r=wr(e);if(!r)return;let[o,n]=Do(...r);if(n!==0)return Qi(...Ji(o,n,t))}function F(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function vr(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function Pr(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:Tx(e.geometry),detail:{of:"chartValue",series:e.valueReference.seriesId,valueIndex:e.valueReference.valueIndex},style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.color},strokeWidth:1}}}function Tx(e){let{centerX:t,startY:r,endY:o}=e,n=t-5,i=t+5;return`M ${t} ${r} L ${t} ${o} M ${n} ${r} L ${i} ${r} M ${n} ${o} L ${i} ${o}`}function Ae(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var Fo=18,_o=e=>e.config;function re(e){return e.chartType==="bar"&&_o(e)?.orientation==="horizontal"}function Vt(e,t){let r=Re({series:e.series,config:_o(e)}),o=t.height/r,n=Math.min(Math.max(0,p(_o(e)?.barGroupGap,8)),Math.max(0,o-1)),i=e.categoryAlign==="left"?Fo:0,a=Math.max(1,o-n-i),s=p(_o(e)?.barThickness,0),l=s>0?Math.min(a,s):a;return{count:r,slotHeight:o,groupGap:n,labelRow:i,barsHeight:l,offset:(a-l)/2}}function Wt(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function _e(e){return Math.min(90,Math.max(0,p(e.axisLabelAngle,0)))}var Ho=e=>e*Math.PI/180;function ea(e){return Math.max(9,p(e.axisFontSize??e.fontSize,12))}function Lr(e,t,r){let o=ea(e),n=Math.max(0,...t.map(i=>he(i,o,!1)));return Math.ceil(n*Math.sin(Ho(r))+(o+2)*Math.cos(Ho(r)))}function ta(e,t,r,o){let n=ea(e),i=n+2,a=Math.ceil(he(t,n,!1))+4,s=Ho(r);return{frame:{x:o.x-i/2*Math.sin(s),y:o.y-i/2*Math.cos(s),width:a,height:i},rotation:-r}}function zt(e,t,r,o){let n=ea(e),i=n+2,a=Math.ceil(he(t,n,!1))+4,s=Ho(r);return{frame:{x:o.x-(a*Math.cos(s)+i/2*Math.sin(s)),y:o.y+a*Math.sin(s)-i/2*Math.cos(s),width:a,height:i},rotation:-r}}function Yt(e,t){return t>0?Te({points:e,tension:t,closed:!1}):`M ${e.map((o,n)=>`${n?"L":""} ${o.x} ${o.y}`).join(" ")}`}function Vo(e,t,r,o){let n=Math.max(1,Math.min(e,t)/2-4),i=Math.max(0,Math.min(r??0,n-1)),a=Math.max(0,Math.min(o??0,n/2)),s=Math.max(1,n-a),l=i>0?Math.min(i+a,s-1):0;return{outerRadius:s,innerRadius:l,cornerRadius:a}}function Q(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function Mr(e,t,r,o){let n=t.x-e.x,i=t.y-e.y,a=0,s=1;if(Math.abs(n)>1e-6){let d=(t.x-r-e.x)/n,c=(t.x+r-e.x)/n;a=Math.max(a,Math.min(d,c)),s=Math.min(s,Math.max(d,c))}if(Math.abs(i)>1e-6){let d=(t.y-o-e.y)/i,c=(t.y+o-e.y)/i;a=Math.max(a,Math.min(d,c)),s=Math.min(s,Math.max(d,c))}let l=a<=s?a:1;return{x:e.x+l*n,y:e.y+l*i}}function jt(e,t){return Math.abs(t-e)>Math.PI?1:0}function ut(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function Yu(e,t){return{start:e.start+t,end:e.end-t}}function mt(e,t,r){if(e<=0)return 0;let o=Math.min(Math.abs(t)/2,Math.PI/2),n=Math.sin(o);return n<=1e-6?r:Math.min(e/n,r)}function $x(e,t,r){let o=Q(e,t.start,e.outerRadius),n=Q(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${jt(t.start,t.end)} 1 ${n.x} ${n.y}`,"Z"].join(" ")}function Ax(e,t,r,o){let n=Q(e,r.start,e.outerRadius),i=Q(e,r.end,e.outerRadius),a=Q(e,o.end,t),s=Q(e,o.start,t);return[`M ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${jt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${jt(o.start,o.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Uu=.82;function Ut(e,t,r,o,n,i){let a=Math.min(1,n/r),s=o+i*Math.asin(a),l=Math.sqrt(Math.max(0,r*r-n*n));return{lineTangent:{x:e.centerX+l*Math.cos(o),y:e.centerY+l*Math.sin(o)},arcTangent:Q(e,s,t),angle:s}}function Tr(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*Uu),i=e*n/(1+n),a=t>0?t*n:Number.POSITIVE_INFINITY,s=t>0?(e-t)/2:e/2;return Math.max(0,Math.min(i,a,s))}function $r(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*Uu),i=e*n/(1+n),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function Ex(e,t,r,o){let{outerRadius:n}=e,i=n-r,a=Ut(e,n,i,t.start,r,1),s=Ut(e,n,i,t.end,r,-1);return[`M ${o.x} ${o.y}`,`L ${a.lineTangent.x} ${a.lineTangent.y}`,`A ${r} ${r} 0 0 1 ${a.arcTangent.x} ${a.arcTangent.y}`,`A ${n} ${n} 0 ${jt(a.angle,s.angle)} 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${r} ${r} 0 0 1 ${s.lineTangent.x} ${s.lineTangent.y}`,"Z"].join(" ")}function Nx(e,t,r,o,n){let{outerRadius:i}=e,a=i-n,s=Ut(e,i,a,r.start,n,1),l=Ut(e,i,a,r.end,n,-1),d=t+n,c=Ut(e,t,d,o.start,n,1),u=Ut(e,t,d,o.end,n,-1);return[`M ${s.lineTangent.x} ${s.lineTangent.y}`,`A ${n} ${n} 0 0 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${i} ${i} 0 ${jt(s.angle,l.angle)} 1 ${l.arcTangent.x} ${l.arcTangent.y}`,`A ${n} ${n} 0 0 1 ${l.lineTangent.x} ${l.lineTangent.y}`,`L ${u.lineTangent.x} ${u.lineTangent.y}`,`A ${n} ${n} 0 0 1 ${u.arcTangent.x} ${u.arcTangent.y}`,`A ${t} ${t} 0 ${jt(u.angle,c.angle)} 0 ${c.arcTangent.x} ${c.arcTangent.y}`,`A ${n} ${n} 0 0 1 ${c.lineTangent.x} ${c.lineTangent.y}`,"Z"].join(" ")}function Xt(e,t,r){let o=Math.max(0,r)/2,n=mt(o,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=n}function pt(e,t,r=0,o=0){let n=Math.max(0,o)/2,i=Yu(t,ut(n,e.outerRadius));if(!Xt(e,t,o)){let s=mt(n,t.end-t.start,e.outerRadius),l=Q(e,(t.start+t.end)/2,s);return r>0?Ex(e,i,r,l):$x(e,i,l)}let a=Yu(t,ut(n,e.innerRadius));return r>0?Nx(e,e.innerRadius,i,a,r):Ax(e,e.innerRadius,i,a)}function je(e,t,r,o,n,i,a){let s=t==="horizontal",l=s?e.width:e.height,d=Math.max(1,(l-o*(r-1))/r),c=Math.min(r,Math.max(0,i*r)),u=a?Math.round(c):c,m=[];for(let f=0;f<r;f++){let h=Math.min(1,Math.max(0,u-f))*d;if(h<.5)continue;let y=f*(d+o);m.push(s?Ge(e.x+y,e.y,h,e.height,n):Ge(e.x,e.y+e.height-y-h,e.width,h,n))}return m.join(" ")}function H(e){if(!e?.enabled)return;let t=p(e.angle,45)*Math.PI/180,r=p(e.distance,5);return{color:e.color??"#000000",opacity:p(e.opacity,.25),blur:p(e.blur,10),dx:Math.cos(t)*r,dy:Math.sin(t)*r}}function Ar(e,t,r,o,n){let i=e.series[o].values[r]??0;return t==="waterfall"?Ox(e,r,o,n,i):t==="percent"?Bx(e,r,o,n,i):Ix(e,r,o,n,i)}function Ox(e,t,r,o,n){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return ju(n,i,i+n,e,o)}function Bx(e,t,r,o,n){let i=e.series.reduce((l,d)=>l+Math.abs(d.values[t]??0),0)||1,a=0;for(let l=0;l<r;l++)a+=Math.abs(e.series[l].values[t]??0);let s=Math.abs(n);return{value:n,pixelStart:a/i*o,pixelEnd:(a+s)/i*o}}function Ix(e,t,r,o,n){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return ju(n,i,i+n,e,o)}function ju(e,t,r,o,n){return{value:e,pixelStart:T(t,o.axisY,n),pixelEnd:T(r,o.axisY,n)}}function L(e){let{chart:t,frame:r}=e;return{type:"text",id:e.id,order:e.order,bounds:e.bounds,...r,lines:[e.text],fontFamily:(e.role==="axis"?t.axisFontFamily:void 0)??t.fontFamily??B,fontSize:Math.max(9,p(e.role==="axis"?t.axisFontSize??t.fontSize:t.fontSize,12)),fontWeight:"normal",color:(e.role==="axis"?t.axisLabelColor:e.role==="legend"?t.legendColor:void 0)??t.textColor??"#0f172a",align:e.align??"left",verticalAlign:"top",lineHeight:1.2,rotation:e.rotation,rotationCenter:e.rotation?{x:r.x,y:r.y}:void 0}}var Dx=/^[A-Za-z_][A-Za-z0-9_]*$/;function qt(e,t,r){return Dx.test(t)?`${e}[${t}].${r}`:void 0}var Xu="text";function ra(e){return`Axis[${e}].label`}function Er(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function Ee(e){return qt("Series",e,"label")}function qu(e){return qt("Series",e,"color")}function ue(e,t){return Number.isInteger(t)&&t>=0?qt("Series",e,`values[${t}]`):void 0}function Kt(e,t){return Number.isInteger(t)&&t>=0?qt("Series",e,`colors[${t}]`):void 0}function Ku(e){return qt("Rule",e,"text")}function Zu(e){return qt("Rule",e,"at")}function Gx(e,t,r){return e.axisX.label?{...L({role:"axis",id:`chart-x-label-${e.id}`,order:r,bounds:t.bounds,frame:{x:t.plot.x,y:e.y+e.height-18,width:t.plot.width,height:18},text:e.axisX.label,chart:e,align:"center"}),prop:ra("x")}:null}function _x(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...L({role:"axis",id:`chart-y-label-${e.id}`,order:r,bounds:t.bounds,frame:{x:e.x+12,y:t.plot.y+t.plot.height,width:t.plot.height,height:18},text:e.axisY.label,chart:e,align:"center",rotation:-90}),prop:ra("y")}}function Qu(e,t,r){let o=[],n=Gx(e,t,r);n&&o.push(n);let i=_x(e,t,r+o.length);return i&&o.push(i),o}function Ju(e,t,r){let o=Math.max(1,e.series.length),n=t.plot.height/o;return e.series.map((i,a)=>{let s=t.plot.y+(a+.5)*n;return{...L({role:"axis",id:`chart-y-tick-${e.id}-${a}`,order:r+a,bounds:t.bounds,frame:{x:e.x,y:s-9,width:t.padLeft-8,height:18},text:i.label||i.id,chart:e,align:"right"}),prop:Ee(i.id)}})}var Fx=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function em(e){return Hx(e.chart)?Ux(e).flatMap(t=>jx(e,t)):[]}function Hx(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!Fx.has(e.chartType)&&!t}function oa(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var na=22,Wo=16;function ia(e){return e==="bottomLeft"||e==="bottomRight"}function aa(e){return oa(e).map(t=>Math.max(42,t.label.length*p(e.fontSize,12)*.58+22))}function tm(e){let t=aa(e);return t.length?Math.max(...t):0}function Vx(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function Wx(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function zx(e){let{chart:t,plot:r,order:o}=e,n=oa(t),i=aa(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-Wo-a:r.x+r.width+Wo,l=r.y+r.height-15;return n.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(n.length-1-c)*na,width:i[c],order:o+(n.length-1-c)*2}))}function Yx(e){let{chart:t,plot:r,order:o}=e,n=oa(t),i=aa(t),a=i.reduce((d,c)=>d+c,0),s=Wx(t,r),l=Vx(t,r,a);return n.map((d,c)=>{let u=i[c],m=l;return l+=u,{series:d,seriesIndex:c,x:m,y:s,width:u,order:o+(n.length-1-c)*2}})}function Ux(e){return ia(e.chart.legendPosition)?zx(e):Yx(e)}function jx(e,t){return[Xx(e,t),qx(e,t)]}function Xx(e,t){let{chart:r,bounds:o,diagnostics:n}=e,i=E[t.seriesIndex%E.length],a=r.chartType==="line",s=a?F(t.series.color,i):t.series.color??i;return{type:"rect",id:`chart-legend-swatch-${r.id}-${t.series.id}`,order:t.order,bounds:o,x:t.x,y:t.y,width:10,height:10,rx:3,prop:qu(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:P(s,n,r.id)}}}function qx(e,t){let{chart:r,bounds:o}=e;return{...L({role:"legend",id:`chart-legend-${r.id}-${t.series.id}`,order:t.order+1,bounds:o,frame:{x:t.x+15,y:t.y-3,width:t.width-15,height:18},text:t.series.label,chart:r}),prop:Ee(t.series.id)}}var om=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),Kx=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Xe(e){return!Kx.has(e.chartType)}function nm(e){return Xe(e)?Math.max(0,p(e.tickLength,0)):0}function et(e){return nm(e)+(Xe(e)?Math.max(0,p(e.xLabelGap,0)):0)}function la(e){return nm(e)+(Xe(e)?Math.max(0,p(e.yLabelGap,0)):0)}function sa(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Zx(e){let t=p(e.fontSize,12);return Math.max(0,...e.series.map(o=>(o.label||o.id).length))*t*.58+16}var rm=66;function Qx(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function Jx(e){let t=p(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(o=>o.length))*t*.58+16}function eS(e){return e.axisLabelSpace&&e.axisLabelSpace>0&&(sa(e)||re(e))?e.axisLabelSpace:sa(e)?Zx(e):re(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:Jx(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function tS(e){let t=_e(e);if(t<=0)return 0;let r=e.chartType==="bar"&&!re(e)?e.config?.categories??[]:e.chartType==="boxplot"&&!sa(e)?e.series.map(o=>o.label||o.id):[];return r.length>0?Math.max(0,Lr(e,r,t)-18):0}function im(e){let t=e.showAxisLabels!==!1,r=e.showLegend!==!1,o=e.legendPosition??"top",n=o==="top",i=r&&e.series.length>0,a=i&&ia(o),s=a?tm(e)+Wo:0,l=Qx(e,r),d=et(e),u=la(e)+(t?eS(e):12)+(o==="bottomLeft"?s:0)+(l==="left"?rm:0),m=24+(o==="bottomRight"?s:0)+(l==="right"?rm:0),f=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",h=re(e)&&e.showValueAxis!==!1,y=t?re(e)?h?34:12:(e.axisX.label?52:34)+(f?18:0):12,x=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,b=i&&!n&&!a,C=d+y+(t?tS(e):0)+(x?44:0)+(b?16+na:0),w=(e.title?Math.max(44,20+p(e.titleSize,14)*1.6):0)||(n&&i?44:24);return{bounds:de({x:e.x,y:e.y,width:e.width,height:e.height},p(e.strokeWidth,1)+2),plot:{x:e.x+u,y:e.y+w,width:Math.max(1,e.width-u-m),height:Math.max(1,e.height-w-C)},showLabels:t,showLegend:r,padLeft:u}}function rS(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,o)=>String(o+1))}function am(e,t,r){let o=Re(e),n=t.plot.width/o,i=rS(e,o),a=!!e.config?.categories?.length,s=_e(e),l=e.categoryAlign==="left",d=l?Math.min(Math.max(0,p(e.config?.barGroupGap,8)),Math.max(0,n-1)):0;return Array.from({length:o},(c,u)=>{let m=t.plot.x+(u+.5)*n;if(s>0){let f=i[u]??String(u+1),{frame:h,rotation:y}=zt(e,f,s,{x:m,y:t.plot.y+t.plot.height+4+et(e)});return{...L({role:"axis",id:`chart-x-tick-${e.id}-${u}`,order:r+u,bounds:t.bounds,frame:h,text:f,chart:e,align:"right",rotation:y}),prop:a?Er(u):void 0}}return{...L({role:"axis",id:`chart-x-tick-${e.id}-${u}`,order:r+u,bounds:t.bounds,frame:{x:l?t.plot.x+u*n+d/2:m-n/2,y:t.plot.y+t.plot.height+4+et(e),width:l?n-d:n,height:18},text:i[u]??String(u+1),chart:e,align:l?"left":"center"}),prop:a?Er(u):void 0}})}function sm(e,t,r){let o=Math.max(1,e.series.length),n=t.plot.width/o,i=_e(e);return e.series.map((a,s)=>{let l=t.plot.x+(s+.5)*n;if(i>0){let d=a.label||a.id,{frame:c,rotation:u}=zt(e,d,i,{x:l,y:t.plot.y+t.plot.height+4+et(e)});return{...L({role:"axis",id:`chart-x-tick-${e.id}-${s}`,order:r+s,bounds:t.bounds,frame:c,text:d,chart:e,align:"right",rotation:u}),prop:Ee(a.id)}}return{...L({role:"axis",id:`chart-x-tick-${e.id}-${s}`,order:r+s,bounds:t.bounds,frame:{x:l-n/2,y:t.plot.y+t.plot.height+4+et(e),width:n,height:18},text:a.label||a.id,chart:e,align:"center"}),prop:Ee(a.id)}})}function lm(e,t,r){return U(e.axisX).map((o,n)=>{let i=t.plot.x+T(o,e.axisX,t.plot.width);return L({role:"axis",id:`chart-x-tick-${e.id}-${o}`,order:r+n,bounds:t.bounds,frame:{x:i-20,y:t.plot.y+t.plot.height+10+et(e),width:40,height:18},text:String(o),chart:e,align:"center"})})}function dm(e,t,r){return U(e.axisY).map((o,n)=>{let i=t.plot.y+t.plot.height-T(o,e.axisY,t.plot.height);return L({role:"axis",id:`chart-y-tick-${e.id}-${o}`,order:r+n,bounds:t.bounds,frame:{x:e.x,y:i-6,width:t.padLeft-14-la(e),height:18},text:String(o),chart:e,align:"right"})})}function da(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function oS(e,t,r){return e.chartType==="bar"?am(e,t,r):e.chartType==="boxplot"&&!da(e)?sm(e,t,r):lm(e,t,r)}function nS(e,t,r){return da(e)?Ju(e,t,r):e.showValueAxis===!1?[]:dm(e,t,r)}function iS(e,t){let{plot:r}=t;if(e.chartType==="bar"){let o=Re(e);return Array.from({length:o},(n,i)=>r.x+(i+.5)*r.width/o)}return U(e.axisX).map(o=>r.x+T(o,e.axisX,r.width))}function aS(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function sS(e,t,r){let o=p(e.axisLineWidth,0),n=p(e.tickLength,0);if(o<=0&&n<=0)return[];let{plot:i,bounds:a}=t,s=i.y+i.height,l={fill:{kind:"none"},stroke:{kind:"solid",color:e.axisLineColor??e.gridColor??"#94a3b8"},strokeWidth:o>0?o:1,pointerEvents:"none",...aS(e,o>0?o:1)},d=[],c=(u,m)=>d.push({type:"path",id:`chart-axis-${u}-${e.id}`,order:r+d.length,bounds:a,d:m,style:l});if(o>0&&(e.showValueAxis!==!1&&c("line-y",`M ${i.x} ${i.y} L ${i.x} ${s}`),c("line-x",`M ${i.x} ${s} L ${i.x+i.width} ${s}`)),n>0&&re(e)){U(e.axisY).forEach(m=>{let f=i.x+T(m,e.axisY,i.width);c(`tick-v-${m}`,`M ${f} ${s} L ${f} ${s+n}`)});let u=Vt(e,i);for(let m=0;m<u.count;m++){let f=Wt(u,i,m)+u.labelRow+u.barsHeight/2;c(`tick-c-${m}`,`M ${i.x-n} ${f} L ${i.x} ${f}`)}}return n>0&&!da(e)&&!re(e)&&(U(e.axisY).forEach(u=>{let m=s-T(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-n} ${m} L ${i.x} ${m}`)}),iS(e,t).forEach((u,m)=>{c(`tick-x-${m}`,`M ${u} ${s} L ${u} ${s+n}`)})),d}function lS(e,t){let r=e.config?.categories;return Array.from({length:t},(o,n)=>r?.[n]??String(n+1))}function dS(e,t,r){let{plot:o,bounds:n}=t,i=Vt(e,o),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=lS(e,i.count).map((c,u)=>{let m=Wt(i,o,u);return{...L({role:"axis",id:`chart-y-category-${e.id}-${u}`,order:r+u,bounds:n,frame:a?{x:o.x,y:m,width:o.width,height:i.labelRow}:s?{x:o.x+14,y:m+i.barsHeight/2-9,width:o.width-28,height:18}:{x:e.x+8,y:m+i.barsHeight/2-9,width:o.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?Er(u):void 0}});return e.showValueAxis!==!1&&U(e.axisY).forEach((c,u)=>{let m=o.x+T(c,e.axisY,o.width);d.push(L({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+i.count+u,bounds:n,frame:{x:m-20,y:o.y+o.height+4+p(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function cm(e,t,r){if(!Xe(e))return[];let o=sS(e,t,r);if(!t.showLabels)return o;if(r+=o.length,re(e))return[...o,...dS(e,t,r)];let n=oS(e,t,r),i=nS(e,t,r+n.length),a=Qu(e,t,r+n.length+i.length);return[...o,...n,...i,...a]}function um(e,t,r,o){let n=0,i=0;for(let a of e){let s=a.x-t,l=a.y-r,d=s*s+l*l;if(d===0)return a.value;let c=1/d**(o/2);n+=c*a.value,i+=c}return i===0?0:n/i}var ca=32;function Nr(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function mm(e,t,r,o){let n=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(ca,Math.round(Math.sqrt(ca*ca*n)))),a=Math.max(2,Math.round(i/n)),s=new Float32Array(i*a);for(let l=0;l<a;l++){let d=r*(l/(a-1));for(let c=0;c<i;c++){let u=t*(c/(i-1));s[l*i+c]=e.length?um(e,u,d,o):0}}return{grid:s,cols:i,rows:a}}var pm=new Set(["scatter","custom","hexbin"]);var fm=-Math.PI/2,cS=.5,uS=6;function mS(e){return Math.max(38,e*3.2)}function zo(e,t,r,o=!0){let n=o?mS(r):uS;return Math.max(8,Math.min(e,t)/2-n)}function Yo(e,t){return Math.max(3,e||t)}function pS(e,t){return fm+t*Math.PI*2/e}function ua(e,t,r){let o=t===e?0:(r-e)/(t-e);return fm+o*Math.PI*2}function hm(e,t,r){let o=pS(e.count,t);return{x:e.centerX+Math.cos(o)*r,y:e.centerY+Math.sin(o)*r}}function gm(e,t){let r=e.max-e.min;return(r===0?0:Math.max(0,Math.min(1,(t-e.min)/r)))*e.radius}function Uo(e,t,r=cS){return e.length===0?"":t?Te({points:e,tension:r,closed:!0}):`M ${e.map((n,i)=>`${i?"L ":""}${n.x} ${n.y}`).join(" ")} Z`}function jo(e,t,r,o,n,i,a,s){let l=Math.max(1,a*1.5),d={fill:{kind:"solid",color:e.gridColor??"#e2e8f0"},clip:s};if(e.gridRoundedCorners===!0)return{type:"ellipse",id:t,order:r,bounds:o,cx:n,cy:i,rx:l,ry:l,style:d};let c=l*2;return{type:"rect",id:t,order:r,bounds:o,x:n-l,y:i-l,width:c,height:c,style:d}}function Or(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function ym(e,t,r,o){let n=t.x+t.width/2,i=t.y+t.height/2,a=Math.max(0,Math.min(t.width,t.height)/2),s=p(e.gridWidth,1);if(e.gridLineStyle==="dotted")return fS(e,r,o,n,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...Or(e,s)},d=[];return U(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*bm(e,c);d.push({type:"ellipse",id:`chart-grid-ring-${e.id}-${c}`,order:o+d.length,bounds:r,cx:n,cy:i,rx:u,ry:u,style:l})}),U(e.axisX).forEach(c=>{let u=ua(e.axisX.min,e.axisX.max,c),m=n+Math.cos(u)*a,f=i+Math.sin(u)*a;d.push({type:"path",id:`chart-grid-spoke-${e.id}-${c}`,order:o+d.length,bounds:r,d:`M ${n} ${i} L ${m} ${f}`,style:l})}),d}function fS(e,t,r,o,n,i,a){let s=U(e.axisY).filter(c=>c>e.axisY.min),l=U(e.axisX),d=[];return s.forEach(c=>{let u=i*bm(e,c);l.forEach(m=>{let f=ua(e.axisX.min,e.axisX.max,m),h=o+Math.cos(f)*u,y=n+Math.sin(f)*u,x=`chart-grid-dot-${e.id}-${m}-${c}`;d.push(jo(e,x,r+d.length,t,h,y,a,void 0))})}),d}function bm(e,t){let r=e.axisY.max-e.axisY.min;return r===0?0:Math.max(0,Math.min(1,(t-e.axisY.min)/r))}function Xo(e,t,r,o){if(e.showGrid===!1||!Xe(e))return[];if(e.gridShape==="circle"&&pm.has(e.chartType))return ym(e,t,r,o);let n=p(e.gridWidth,1);if(re(e))return hS(e,t,r,o,n);let i=e.chartType==="field"?Nr(e,t):void 0;if(e.gridLineStyle==="dotted")return gS(e,t,r,o,n,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:n,...Or(e,n),clip:i},s=[];return(e.gridAxes==="y"?[]:U(e.axisX)).forEach(l=>{let d=t.x+T(l,e.axisX,t.width);s.push({type:"path",id:`chart-grid-x-${e.id}-${l}`,order:o+s.length,bounds:r,d:`M ${d} ${t.y} L ${d} ${t.y+t.height}`,style:a})}),(e.gridAxes==="x"?[]:U(e.axisY)).forEach(l=>{let d=t.y+t.height-T(l,e.axisY,t.height);s.push({type:"path",id:`chart-grid-y-${e.id}-${l}`,order:o+s.length,bounds:r,d:`M ${t.x} ${d} L ${t.x+t.width} ${d}`,style:a})}),s}function hS(e,t,r,o,n){if(e.gridAxes==="y")return[];let i={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:n,...e.gridLineStyle==="dotted"?{dash:[.1,n*3],lineCap:"round"}:Or(e,n)};return U(e.axisY).map((a,s)=>{let l=t.x+T(a,e.axisY,t.width);return{type:"path",id:`chart-grid-x-${e.id}-${a}`,order:o+s,bounds:r,d:`M ${l} ${t.y} L ${l} ${t.y+t.height}`,style:i}})}function gS(e,t,r,o,n,i){let a=U(e.axisX),s=U(e.axisY),l=[];return a.forEach(d=>{let c=t.x+T(d,e.axisX,t.width);s.forEach(u=>{let m=t.y+t.height-T(u,e.axisY,t.height),f=`chart-grid-dot-${e.id}-${d}-${u}`;l.push(jo(e,f,o+l.length,r,c,m,n,i))})}),l}function xm(e){return e.chart.rules?.length?yS(e).flatMap(t=>bS(e,t)):[]}function yS(e){let t=e.order;return(e.chart.rules??[]).map(r=>{let o=t++,n=r.text?t++:void 0;return{rule:r,color:r.color||e.chart.strokeColor||"#475569",y:e.plot.y+e.plot.height-T(r.at,e.chart.axisY,e.plot.height),lineOrder:o,labelOrder:n}})}function bS(e,t){let r=[xS(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(SS(e,t)),r}function xS(e,t){return{type:"path",id:`chart-rule-${e.chart.id}-${t.rule.id}`,order:t.lineOrder,bounds:e.bounds,d:`M ${e.plot.x} ${t.y} L ${e.plot.x+e.plot.width} ${t.y}`,prop:Zu(t.rule.id),propKind:"value",style:{fill:{kind:"none"},stroke:{kind:"solid",color:t.color},strokeWidth:t.rule.strokeWidth??1,dash:t.rule.dash}}}function SS(e,t){let r=Math.max(9,p(e.chart.fontSize,12)-2);return{...L({id:`chart-rule-label-${e.chart.id}-${t.rule.id}`,order:t.labelOrder??t.lineOrder+1,bounds:e.bounds,frame:{x:e.plot.x+4,y:t.y-r-2,width:160,height:r+2},text:t.rule.text??"",chart:e.chart}),color:t.color,prop:Ku(t.rule.id)}}function ma(e){let t=p(e.strokeWidth,1)/2;return{x:e.x+t,y:e.y+t,width:Math.max(1,e.width-t*2),height:Math.max(1,e.height-t*2),rx:Math.max(0,p(e.cornerRadius,12)-t)}}function Sm(e,t,r){if(!e.fillImage)return[];let o=ma(e),n=[{type:"image",id:`chart-image-${e.id}`,order:r.next(),bounds:t,x:o.x,y:o.y,width:o.width,height:o.height,href:e.fillImage.url,style:{clip:{type:"rect",...o},pointerEvents:"none"}}];return e.fillImage.overlay&&n.push({type:"rect",id:`chart-image-overlay-${e.id}`,order:r.next(),bounds:t,x:o.x,y:o.y,width:o.width,height:o.height,rx:o.rx,style:{fill:{kind:"solid",color:e.fillImage.overlay},pointerEvents:"none"}}),n}function Zt(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=p(o.config?.barGlassBlur,0);if(a<=0||!o.fillImage)return[];let s=ma(o),l=[{type:"image",id:`chart-bar-glass-${o.id}-${t}`,order:i(),bounds:n,x:s.x,y:s.y,width:s.width,height:s.height,href:o.fillImage.url,style:{blur:a,saturate:p(o.config?.barGlassSaturation,1),clip:{type:"path",d:r},pointerEvents:"none"}}];return o.fillImage.overlay&&l.push({type:"path",id:`chart-bar-glass-overlay-${o.id}-${t}`,order:i(),bounds:n,d:r,style:{fill:{kind:"solid",color:o.fillImage.overlay},pointerEvents:"none"}}),o.config?.barGlassTint&&l.push({type:"path",id:`chart-bar-glass-tint-${o.id}-${t}`,order:i(),bounds:n,d:r,style:{fill:{kind:"solid",color:o.config.barGlassTint},pointerEvents:"none"}}),l.push(...Xo(o,e.plot,n,0).map(d=>({...d,id:`${d.id}-glass-${t}`,order:i(),style:{..."style"in d?d.style:{},clip:{type:"path",d:r},pointerEvents:"none"}}))),l}function Qt(e,t,r,o,n,i=e.bounds){let{chart:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:t,order:l(),bounds:i,d:r,style:{fill:P(o,s,a.id),shadow:{color:F(o,"#ffffff"),opacity:.9,blur:n,dx:0,dy:0},pointerEvents:"none"}}}function Jt(e){return e.chart.config?.showBarLabels===!0}function CS(e,t){let r=e.frame.height>=t.height+we.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function kS(e,t,r){return e==="outside"?t.y-r-we.gap:e==="inside"?t.y+we.gap:t.y+t.height/2-r/2}function RS(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=n.config;return{type:"path",id:`${t}-pill`,order:s(),bounds:i,d:Xi(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?P(l.barLabelPillColor,a,n.id):{kind:"none"},stroke:P(l?.barLabelBorderColor??o,a,n.id),strokeWidth:p(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function wS(e,t,r,o,n,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...L({id:t,order:d(),bounds:l,frame:{x:r.left,y:r.top+r.padY,width:r.width,height:r.lineHeight},text:o,chart:s,align:"center"}),mark:`bar-label|${n}|${c?.barLabelFormat??""}`,color:a,fontSize:i,fontFamily:c?.barLabelFontFamily??s.fontFamily??"Inter, sans-serif",fontWeight:c?.barLabelFontWeight??"normal"}}function vS(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=n.config,d=i.y+i.height+4+16+Math.max(0,n.tickLength??0);return{...L({id:t.id,order:s(),bounds:a,frame:t.horizontal?n.categoryAlign==="inside"?{x:i.x,y:t.frame.y+t.frame.height/2-o*.6,width:i.width-14,height:o*1.2}:{x:i.x,y:t.frame.y-Fo,width:i.width,height:o*1.2}:{x:t.frame.x,y:d,width:t.frame.width,height:o*1.2},text:r,chart:n,align:t.horizontal?"right":n.categoryAlign==="left"?"left":"center"}),mark:`bar-label|axis|${l?.barLabelFormat??""}`,color:l?.barLabelColor??n.textColor??"#0f172a",fontSize:o,fontFamily:l?.barLabelFontFamily??n.fontFamily??"Inter, sans-serif",fontWeight:l?.barLabelFontWeight??"normal"}}function PS(e,t){let r=e.placement==="axis"?"outside":e.placement,o=e.frame.width>=t.width+we.gap*2;return r!=="outside"&&!o?"outside":r}function LS(e,t,r){let{frame:o}=e,n=r==="outside"?o.x+o.width+we.gap:r==="inside"?o.x+o.width-t.width-we.gap:o.x+o.width/2-t.width/2;return{...t,left:n,top:o.y+o.height/2-t.height/2}}function er(e,t){let{chart:r}=e,o=r.config,n=Math.max(8,p(o?.barLabelFontSize,p(r.fontSize,12))),i=Ui(t.value,o?.barLabelFormat);if(t.placement==="axis")return[vS(e,t,i,n)];let a=o?.barLabelPill===!0,s=ji(i,n,a),l=t.horizontal?PS(t,s):CS(t,s),d=t.horizontal?LS(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:kS(l,t.frame,s.height)},c=o?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(RS(e,t.id,d,c)),u.push(wS(e,t.id,d,i,l,n,c)),u}var pa={angle:45,spacing:7,width:1.5},MS=2;function TS(e,t,r,o,n,i){let a=n*Math.PI/180,s={x:Math.cos(a),y:Math.sin(a)},l={x:-s.y,y:s.x},d={x:e+r/2,y:t+o/2},c=Math.hypot(r,o)/2,u=[];for(let m=-c;m<=c;m+=i){let f=d.x+l.x*m,h=d.y+l.y*m;u.push(`M ${f-s.x*c} ${h-s.y*c} L ${f+s.x*c} ${h+s.y*c}`)}return u.join(" ")}function tr(e,t){if(ft(e))return{type:"path",d:Ge(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function ft(e){return e.chart.config?.barTrack===!0}function rr(e,t,r,o="vertical"){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=n.config,d=l?.barCornerRadius??2,c=p(l?.barSegments,0),u=c>0?je(r,o,c,p(l?.barSegmentGap,4),d,1,!0):Ge(r.x,r.y,r.width,r.height,d),m=[{type:"path",id:`chart-bar-track-${n.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:P(l?.barTrackColor??n.gridColor??"#e2e8f0",a,n.id),pointerEvents:"none"}}];return l?.barTrackHatch&&m.push({type:"path",id:`chart-bar-track-hatch-${n.id}-${t}`,order:s(),bounds:i,d:TS(r.x,r.y,r.width,r.height,p(l.barTrackHatchAngle,pa.angle),Math.max(MS,p(l.barTrackHatchSpacing,pa.spacing))),style:{fill:{kind:"none"},stroke:P(l.barTrackHatchColor??n.gridColor??"#cbd5e1",a,n.id),strokeWidth:p(l.barTrackHatchWidth,pa.width),pointerEvents:"none",clip:{type:"path",d:u}}}),m}function Cm(e){let t=NS(e),r=e.chart.series.flatMap((a,s)=>OS(e,t,a,s)),o=ft(e)?r.flatMap(a=>rr(e,`${a.seriesId}-${a.valueIndex}`,{x:a.frame.x,y:e.plot.y,width:a.frame.width,height:e.plot.height})):[],n=r.flatMap(a=>BS(e,a)),i=Jt(e)?r.flatMap(a=>AS(e,a,r)):[];return[...o,...n,...r.flatMap(a=>ES(e,a)),...i]}function $S(e,t){let r=t.filter(o=>o.seriesId===e.seriesId).map(o=>o.value);return e.value>=Math.max(...r)}function AS(e,t,r){let{chart:o}=e;return o.config?.barLabelMaxOnly&&!$S(t,r)?[]:er(e,{id:`chart-bar-label-${o.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:o.config?.barLabelPosition??"outside"})}function km(e,t){let{chart:r,plot:o}=e,n=r.config,i=n?.barCornerRadius??2,a=p(n?.barSegments,0);return a>0?je({x:t.x,y:o.y,width:t.width,height:o.height},"vertical",a,p(n?.barSegmentGap,4),i,t.height/o.height,n?.barSegmentSnap!==!1):ct(t.x,t.y,t.width,t.height,i,n?.barRoundedBottom===!0)}function ES(e,t){let{chart:r}=e,o=p(r.config?.barGlow,0);if(o<=0||t.frame.height<=0)return[];let n=km(e,t.frame);return[Qt(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,n,t.color,o)]}function NS(e){let{chart:t,plot:r}=e,o=Re(t),n=r.width/o,i=Math.min(Math.max(0,p(t.config?.barGroupGap,8)),Math.max(0,n-1)),a=Math.max(0,p(t.config?.barGap,2));return{slotWidth:n,seriesWidth:Math.max(1,(n-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function OS(e,t,r,o){let{chart:n,plot:i}=e,a=r.color??E[o%E.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,T(d,n.axisY,i.height));return{seriesId:r.id,valueIndex:l,value:d,error:r.error?.[l],color:r.colors?.[l]??a,hasColorOverride:r.colors?.[l]!=null,frame:{x:i.x+l*t.slotWidth+t.groupGap/2+o*t.seriesWidth,y:i.y+i.height-c,width:Math.max(1,t.seriesWidth-t.barGap),height:c}}})}function BS(e,t){let r=DS(e,t),o=GS(e,t);return o&&r.push(o),r}function IS(e){let{x:t,y:r,width:o,height:n}=e;return`M ${t} ${r} H ${t+o} V ${r+n} H ${t} Z`}function DS(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e,s=r.config?.barCornerRadius??2,{x:l,width:d}=t.frame,c=km(e,t.frame),u=P(t.color,i,r.id),m=P(r.config?.barBorderColor||"#000000",i,r.id),f=p(r.config?.barBorderWidth,0),h=H(r.shadowStyle),y=h?{type:"path",id:`chart-bar-shadow-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:n,d:c,style:{fill:u,stroke:m,strokeWidth:f,shadow:h,clip:tr(e,{x:l,y:o.y,width:d,height:o.height})??{type:"path",d:IS(o)}}}:void 0,x={type:"path",id:`chart-bar-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:n,d:c,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex,mark:"bar",radius:s,colorProp:Kt(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:ue(t.seriesId,t.valueIndex),style:{fill:u,stroke:m,strokeWidth:f,innerShadow:h}},b=Zt(e,`${t.seriesId}-${t.valueIndex}`,c);return y?[y,...b,x]:[...b,x]}function GS(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=vr(t.value,t.error);return Pr({id:`chart-bar-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:n,geometry:{centerX:t.frame.x+t.frame.width/2,startY:o.y+o.height-T(a,r.axisY,o.height),endY:o.y+o.height-T(s,r.axisY,o.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function _S(e,t,r,o,n){let{chart:i,plot:a}=e,s=Wt(t,a,o)+t.labelRow;if(e.stackedMode){let u=Ar(i,e.stackedMode,o,r,a.width),m=Math.min(u.pixelStart,u.pixelEnd);return{x:a.x+m,y:s,width:Math.max(1,Math.abs(u.pixelEnd-u.pixelStart)),height:t.barsHeight}}let l=Math.max(0,p(i.config?.barGap,2)),d=t.barsHeight/Math.max(1,i.series.length),c=Math.max(0,T(n,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function FS(e,t){let{chart:r,plot:o}=e,n=r.config,i=e.stackedMode&&r.series.length>1?0:p(n?.barSegments,0);return i>0?je({x:o.x,y:t.y,width:o.width,height:t.height},"horizontal",i,p(n?.barSegmentGap,4),n?.barCornerRadius??2,t.width/o.width,n?.barSegmentSnap!==!1):Ge(t.x,t.y,t.width,t.height,n?.barCornerRadius??2)}function HS(e,t,r,o,n,i){let{plot:a}=e,s=_S(e,t,o,n,i);return{id:`${r.id}-${n}`,series:r,seriesIndex:o,valueIndex:n,value:i,frame:s,trackFrame:{x:a.x,y:s.y,width:a.width,height:s.height},bounds:{minX:s.x,maxX:s.x+Math.max(s.width,1),minY:s.y,maxY:s.y+s.height},path:FS(e,s),color:r.colors?.[n]??r.color??E[o%E.length]}}function VS(e,t){let{chart:r,diagnostics:o,nextOrder:n}=e,i=r.config,a=P(i?.barBorderColor||"#000000",o,r.id),s=p(i?.barBorderWidth,0),l=H(r.shadowStyle),d=P(t.color,o,r.id),c=[...Zt(e,t.id,t.path)];return l&&c.push({type:"path",id:`chart-bar-shadow-${r.id}-${t.id}`,order:n(),bounds:t.bounds,d:t.path,style:{fill:d,stroke:a,strokeWidth:s,shadow:l,clip:tr(e,t.trackFrame)}}),c.push({type:"path",id:`chart-bar-${r.id}-${t.id}`,order:n(),bounds:t.bounds,d:t.path,detail:{of:"chartValue",series:t.series.id,valueIndex:t.valueIndex,mark:"bar",radius:i?.barCornerRadius??2,colorProp:Kt(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function WS(e,t,r){let{chart:o}=e,n=o.config,i=Jt(e)&&(!n?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===o.series.length-1;return!i||e.stackedMode&&!a&&n?.barLabelPosition==="outside"?[]:er(e,{id:`chart-bar-label-${o.id}-${t.id}`,value:t.value,frame:t.frame,placement:n?.barLabelPosition??"outside",horizontal:!0})}function zS(e,t,r,o,n,i,a,s){let{chart:l}=e,d=HS(e,t,o,n,i,a);ft(e)&&(!e.stackedMode||n===0)&&r.tracks.push(...rr(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...VS(e,d));let c=p(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(Qt(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...WS(e,d,s))}function Rm(e){let t=Vt(e.chart,e.plot),r={tracks:[],bars:[],glows:[],labels:[]};return e.chart.series.forEach((o,n)=>{let i=o.values.map(s=>typeof s=="number"?s:s[1]),a=Math.max(...i);i.forEach((s,l)=>{zS(e,t,r,o,n,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function YS(e,t){let{chart:r,plot:o}=e,n=o.width/Re(r),i=Math.min(Math.max(0,p(r.config?.barGroupGap,8)),Math.max(0,n-1));return{slotWidth:n,groupGap:i,barWidth:Math.max(1,n-i),cornerRadius:r.config?.barCornerRadius??2,outerSeriesIndex:t==="waterfall"?null:r.series.length-1}}function US(e,t,r,o,n,i){let{chart:a,plot:s}=e,l=a.series.length===1?p(a.config?.barSegments,0):0;return l>0?je({x:t,y:s.y,width:n.barWidth,height:s.height},"vertical",l,p(a.config?.barSegmentGap,4),i,o/s.height,a.config?.barSegmentSnap!==!1):ct(t,r,n.barWidth,o,i,a.config?.barRoundedBottom===!0)}function jS(e,t,r,o,n,i,a){let{chart:s}=e,l=s.config;if(!(Jt(e)&&!(l?.barLabelMaxOnly&&!ZS(r.values,n))&&(l?.barLabelPosition!=="axis"||o===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[n];t.labels.push(...er(e,{id:`chart-bar-label-${s.id}-${r.id}-${n}`,value:Array.isArray(u)?u[1]:u??0,frame:a,placement:c==="outside"&&o!==i.outerSeriesIndex?"center":c}))}function XS(e,t,r,o,n,i){let{chart:a,plot:s}=e,l=Ar(a,t,i,n,s.height),d=r.outerSeriesIndex===null||n===r.outerSeriesIndex?r.cornerRadius:0,c=s.x+i*r.slotWidth+r.groupGap/2,u=s.y+s.height-Math.max(l.pixelStart,l.pixelEnd),m=Math.max(1,Math.abs(l.pixelEnd-l.pixelStart));return{series:o,valueIndex:i,radius:d,color:o.colors?.[i]??o.color??E[n%E.length],x:c,y:u,height:m,path:US(e,c,u,m,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function qS(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=P(t.color,i,r.id),u=P(r.config?.barBorderColor||"#000000",i,r.id),m=p(r.config?.barBorderWidth,0),f=H(r.shadowStyle),h=[];if(f){let y=`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`;h.push({type:"path",id:`chart-bar-shadow-${r.id}-${s.id}-${l}`,order:a(),bounds:n,d,style:{fill:c,stroke:u,strokeWidth:m,shadow:f,clip:tr(e,t.column)??{type:"path",d:y}}})}return h.push(...Zt(e,`${s.id}-${l}`,d)),h.push({type:"path",id:`chart-bar-${r.id}-${s.id}-${l}`,order:a(),bounds:n,d,detail:{of:"chartValue",series:s.id,valueIndex:l,mark:"bar",radius:t.radius,colorProp:Kt(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:ue(s.id,l),style:{fill:c,stroke:u,strokeWidth:m,innerShadow:f}}),h}function KS(e,t,r,o,n,i,a){let{chart:s}=e,l=XS(e,t,o,n,i,a);i===0&&ft(e)&&r.tracks.push(...rr(e,String(a),l.column)),r.bars.push(...qS(e,l));let d={x:l.x,y:l.y,width:o.barWidth,height:l.height};jS(e,r,n,i,a,o,d);let c=p(s.config?.barGlow,0);c>0&&r.glows.push(Qt(e,`chart-bar-glow-${s.id}-${n.id}-${a}`,l.path,l.color,c))}function wm(e,t){let{chart:r}=e,o={tracks:[],bars:[],glows:[],labels:[]},n=YS(e,t),i=Re(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{KS(e,t,o,n,s,l,a)});return[...o.tracks,...o.bars,...o.glows,...o.labels]}function ZS(e,t){let r=e.map(o=>typeof o=="number"?o:o[1]);return r[t]>=Math.max(...r)}function vm(e){return re(e.chart)?Rm(e):e.stackedMode?wm(e,e.stackedMode):Cm(e)}function Pm(e){let{chart:t,plot:r}=e,o=t.config?.orientation??"vertical",n=Math.max(1,t.series.length),i=(o==="horizontal"?r.height:r.width)/n,a=F(t.config?.barBorderColor,"#000000"),s=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:o,slotWidth:i,boxWidth:Math.max(4,i*s),cornerRadius:t.config?.barCornerRadius??2,showPoints:t.config?.showBoxplotPoints??!0,borderColor:a,borderWidth:p(t.config?.barBorderWidth,1),whiskerWidth:Math.max(0,p(t.config?.boxWhiskerWidth,1)),medianWidth:Math.max(0,p(t.config?.boxMedianWidth,2)),medianColor:t.config?.boxMedianColor??a,whiskerColor:t.config?.boxWhiskerColor,capSize:Math.max(0,p(t.config?.boxCapSize,.4)),pointSize:Math.max(0,p(t.config?.boxPointSize,3)),pointOpacity:Math.min(1,Math.max(0,p(t.config?.boxPointOpacity,.7))),jitter:Math.max(0,p(t.config?.boxJitter,1))}}function ge(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function Lm(e,t,r,o){let{chart:n,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+T(d,n.axisX,i.width):i.y+i.height-T(d,n.axisY,i.height);return{center:i[a==="horizontal"?"y":"x"]+r*t.slotWidth+t.slotWidth/2,min:s(o.min),q1:s(o.q1),median:s(o.median),q3:s(o.q3),max:s(o.max)}}function Mm(e,t,r){let{chart:o,plot:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?n.x+T(d,o.axisX,n.width):n.y+n.height-T(d,o.axisY,n.height);return t.pointSize<=0?[]:r.series.values.map((d,c)=>{let u=r.geometry.center+QS(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:m,y:f}=ge(t.orientation,u,l(d));return{type:"ellipse",id:`chart-box-point-${r.id}-${c}`,order:s(),bounds:i,cx:m,cy:f,rx:t.pointSize,ry:t.pointSize,style:{fill:P(r.color,a,o.id),opacity:t.pointOpacity}}})}function QS(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function $m(e,t,r){let o=t.whiskerWidth>0?[eC(t,r),tC(t,r)]:[],n=t.whiskerWidth>0&&t.capSize>0?[rC(t,r),oC(t,r)]:[],i=t.medianWidth>0?[nC(t,r)]:[];return[...[...o,...n].map(a=>Tm(e,t,{...a,color:JS(t,r)})),iC(e,t,r),...i.map(a=>Tm(e,t,a))]}function JS(e,t){return e.whiskerColor==="series"?F(t.color,e.borderColor):e.whiskerColor}function eC(e,t){let{center:r,min:o,q1:n}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ge(e.orientation,r,o),to:ge(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function tC(e,t){let{center:r,q3:o,max:n}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ge(e.orientation,r,o),to:ge(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function rC(e,t){return Am(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function oC(e,t){return Am(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function Am(e,t,r,o){let n=t.boxWidth*t.capSize/2;return{id:e,from:ge(t.orientation,r-n,o),to:ge(t.orientation,r+n,o),strokeWidth:t.whiskerWidth}}function nC(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ge(e.orientation,t.geometry.center-r,t.geometry.median),to:ge(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function Tm(e,t,r){return{type:"path",id:r.id,order:e.nextOrder(),bounds:e.bounds,d:`M ${r.from.x} ${r.from.y} L ${r.to.x} ${r.to.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.color??t.borderColor},strokeWidth:r.strokeWidth}}}function iC(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ge(t.orientation,s.center-l,s.q1),c=ge(t.orientation,s.center+l,s.q3),u=Math.min(d.x,c.x),m=Math.min(d.y,c.y),f=Math.max(1,Math.abs(c.x-d.x)),h=Math.max(1,Math.abs(c.y-d.y));return{type:"rect",id:`chart-box-${r.id}`,order:a(),bounds:n,x:u,y:m,width:f,height:h,rx:t.cornerRadius,style:{fill:P(r.color,i,o.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function Em(e,t,r,o){let n=Ki(r.values);if(!n)return[];let i=Lm(e,t,o,n),a=r.color??E[o%E.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:o,color:a,geometry:i},l=$m(e,t,s);return t.showPoints&&l.push(...Mm(e,t,s)),l}function Nm(e){let t=Pm(e),r=[];return e.chart.series.forEach((o,n)=>{r.push(...Em(e,t,o,n))}),r}var aC="#94a3b8",Om=8,fa=140;function Im(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?cC(e):e.chart.series.flatMap((t,r)=>sC(e,t,r))}function sC(e,t,r){let o=lC(e,t,r);return ha(e,t).map((n,i)=>{let a=ga(e,n),s={series:t,valueIndex:i,point:a,style:o};return t.symbol?.points.length?dC(e,s):ya(e,s)})}function ba(e){return e.config?.orientation==="horizontal"}function ha(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(n=>[n[0],n[1]]):ba(r)?t.values.map((n,i)=>[n,r.axisY.min+i*r.axisY.step]):t.values.map((n,i)=>[r.axisX.min+i*r.axisX.step,n])}function Bm(e,t){return ba(e)?t[0]:t[1]}function ga(e,t){return{x:e.plot.x+T(t[0],e.chart.axisX,e.plot.width),y:e.plot.y+e.plot.height-T(t[1],e.chart.axisY,e.plot.height)}}function lC(e,t,r){let o=t.color??E[r%E.length];return{fill:P(o,e.diagnostics,e.chart.id),stroke:t.stroke?{kind:"solid",color:t.stroke}:void 0,strokeWidth:t.stroke?p(t.strokeWidth,1):void 0}}function dC(e,t){let r=t.series.symbol,o=p(t.series.size,3),n=r?.normalized?o*2:1,i=r?.normalized?.5:0,a=(r?.points??[]).map(([s,l])=>({x:t.point.x+(s-i)*n,y:t.point.y+(l-i)*n}));return{type:"path",id:Dm(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:Te({points:a,tension:p(r?.tension,0),closed:!0}),style:t.style}}function ya(e,t){let r=p(t.series.size,3);return{type:"ellipse",id:Dm(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,cx:t.point.x,cy:t.point.y,rx:r,ry:r,style:t.style}}function Dm(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function cC(e){let{chart:t}=e,[r,o]=t.series,n=ha(e,r),i=ha(e,o),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??K,c=!!t.config?.reverseComparison,u=Math.min(n.length,i.length),m=t.config?.categories??[],f=[];for(let h=0;h<u;h++){let y=n[h],x=i[h],b=ga(e,y),C=ga(e,x),S=Bm(t,y),w=Bm(t,x),O=c?w<S:w>S,A=c?w>S:w<S,_=O?s:A?l:d,G=p(o.size,3);f.push(mC(e,h,b,C,_)),f.push(ya(e,{series:r,valueIndex:h,point:b,style:{fill:P(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??aC},strokeWidth:p(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(ya(e,{series:o,valueIndex:h,point:C,style:{fill:P(_,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&m[h]&&f.push(pC(e,h,b,C,G,m[h]))}return f}function uC(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function mC(e,t,r,o,n){let{chart:i}=e;return{type:"path",id:`chart-custom-connector-${i.id}-${t}`,order:e.nextOrder(),bounds:e.bounds,d:`M ${r.x} ${r.y} L ${o.x} ${o.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:n},strokeWidth:p(i.config?.customConnectorWidth,2),opacity:i.config?.customConnectorOpacity,dash:uC(i.config?.customConnectorDash)}}}function pC(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,d=ba(a),c=d?{x:Math.max(r.x,o.x)+n+Om,y:Math.min(r.y,o.y)-8,width:fa,height:16}:{x:Math.min(r.x,o.x)-fa/2,y:Math.min(r.y,o.y)-n-Om-14,width:fa,height:16};return{...L({id:`chart-custom-label-${a.id}-${t}`,order:l(),bounds:s,frame:c,text:i,chart:a,align:d?"left":"center"}),fontSize:Math.max(6,p(a.config?.customLabelSize,Math.max(9,p(a.fontSize,12))-2)),...a.config?.customLabelColor?{color:a.config.customLabelColor}:{}}}function _m(e){let{chart:t,plot:r}=e,o=t.series.filter(a=>Gm(a.values[0])===3),n=t.series.filter(a=>Gm(a.values[0])===4);return{scalarSamples:o.flatMap(a=>a.values.map(([s,l,d])=>({x:T(s,t.axisX,r.width),y:r.height-T(l,t.axisY,r.height),value:d}))),vectorSeries:n}}function Gm(e){return Array.isArray(e)?e.length:void 0}function Fm(e){let t=e.chart.config?.scale?.stops;if(!e.showLegend||!t?.length)return[];let r=[...t].sort((a,s)=>a.position-s.position),o=r[0].position,n=r[r.length-1].position,i=fC(e);return[hC(e,r,o,n,i),...gC(e,o,n,i)]}function fC(e){let{plot:t}=e,r=Math.min(220,t.width);return{x:t.x+(t.width-r)/2,y:t.y+t.height+46,width:r,height:8}}function hC(e,t,r,o,n){let{chart:i,bounds:a,nextOrder:s}=e,l=o-r;return{type:"rect",id:`chart-field-colorbar-${i.id}`,order:s(),bounds:a,x:n.x,y:n.y,width:n.width,height:n.height,rx:2,style:{fill:{kind:"linear-gradient",angle:0,stops:t.map(d=>({offset:l===0?0:(d.position-r)/l*100,color:d.color}))}}}}function gC(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=o.y+o.height+3;return[L({id:`chart-field-colorbar-min-${n.id}`,order:a(),bounds:i,frame:{x:o.x,y:s,width:80,height:16},text:Ae(t),chart:n}),L({id:`chart-field-colorbar-max-${n.id}`,order:a(),bounds:i,frame:{x:o.x+o.width-80,y:s,width:80,height:16},text:Ae(r),chart:n,align:"right"})]}var yC="#94a3b8";function qo(e,t){return e?.stops.length?br(e.stops,t):yC}function Hm(e){if(e.length===0)return[];let t=s=>`${Math.round(s[0]*1e3)}:${Math.round(s[1]*1e3)}`,r=new Map,o=(s,l,d)=>{let c=t(s),u=r.get(c),m={point:l,segment:d};u?u.push(m):r.set(c,[m])};e.forEach((s,l)=>{let d=[s.x1,s.y1],c=[s.x2,s.y2];o(d,c,l),o(c,d,l)});let n=new Array(e.length).fill(!1),i=(s,l)=>{let d=l;for(;;){let u=r.get(t(d))?.find(m=>!n[m.segment]);if(!u)return;n[u.segment]=!0,s.push(u.point),d=u.point}},a=[];return e.forEach((s,l)=>{if(n[l])return;n[l]=!0;let d=[[s.x1,s.y1],[s.x2,s.y2]];i(d,d[d.length-1]);let c=[];i(c,d[0]),c.reverse(),a.push([...c,...d])}),a}function Vm(e,t){let r=[];for(let o=0;o<e.rows-1;o++)for(let n=0;n<e.columns-1;n++){let i=bC(e,o,n),a=xC(i,t);a!==0&&a!==15&&r.push(...SC(i,a,t))}return r}function bC(e,t,r){return{topLeft:Ko(e,t,r),topRight:Ko(e,t,r+1),bottomRight:Ko(e,t+1,r+1),bottomLeft:Ko(e,t+1,r)}}function Ko(e,t,r){return{x:e.width*(r/(e.columns-1)),y:e.height*(t/(e.rows-1)),value:e.values[t*e.columns+r]}}function xC(e,t){return(Zo(e.topLeft,t)?8:0)|(Zo(e.topRight,t)?4:0)|(Zo(e.bottomRight,t)?2:0)|(Zo(e.bottomLeft,t)?1:0)}function Zo(e,t){return e.value>=t}function SC(e,t,r){let o=CC(e,r);switch(t){case 1:case 14:return[Fe(o.left,o.bottom)];case 2:case 13:return[Fe(o.bottom,o.right)];case 3:case 12:return[Fe(o.left,o.right)];case 4:case 11:return[Fe(o.top,o.right)];case 5:return[Fe(o.left,o.top),Fe(o.bottom,o.right)];case 6:case 9:return[Fe(o.top,o.bottom)];case 7:case 8:return[Fe(o.left,o.top)];case 10:return[Fe(o.top,o.right),Fe(o.left,o.bottom)];default:return[]}}function CC(e,t){return{top:Qo(e.topLeft,e.topRight,t),right:Qo(e.topRight,e.bottomRight,t),bottom:Qo(e.bottomLeft,e.bottomRight,t),left:Qo(e.topLeft,e.bottomLeft,t)}}function Qo(e,t,r){let o=t.value===e.value?.5:(r-e.value)/(t.value-e.value);return[e.x+(t.x-e.x)*o,e.y+(t.y-e.y)*o]}function Fe(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var kC=.5;function Wm(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=RC(e,t);return[...wC(e,r),...PC(e,r)]}function RC(e,t){let{plot:r,chart:o}=e,n=mm(t,r.width,r.height,o.config?.idwPower??2);return{values:n.grid,columns:n.cols,rows:n.rows,cellWidth:r.width/Math.max(1,n.cols-1),cellHeight:r.height/Math.max(1,n.rows-1)}}function wC(e,t){let r=[];for(let o=0;o<t.rows;o++)for(let n=0;n<t.columns;n++)r.push(vC(e,t,o,n));return r}function vC(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=i.x+i.width*(o/(t.columns-1)),d=i.y+i.height*(r/(t.rows-1)),c=qo(n.config?.scale,t.values[r*t.columns+o]);return{type:"rect",id:`chart-field-cell-${n.id}-${r}-${o}`,order:s(),bounds:a,x:l-t.cellWidth/2,y:d-t.cellHeight/2,width:t.cellWidth,height:t.cellHeight,style:{fill:{kind:"solid",color:c},clip:Nr(n,i)}}}function PC(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((o,n)=>{let i=LC(e,t,o,n);i&&r.push(i)}),r}function LC(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=Vm({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=Hm(l).map(u=>Yt(u.map(([m,f])=>({x:i.x+m,y:i.y+f})),kC)).join(" ");return{type:"path",id:`chart-field-isoline-${n.id}-${o}`,order:s(),bounds:a,d:c,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"rgba(15, 23, 42, 0.55)"},strokeWidth:1,clip:Nr(n,i)}}}function zm(e,t){let r=[];return t.forEach((o,n)=>{let i=o.color??E[n%E.length];o.values.forEach((a,s)=>{r.push(MC(e,o.id,a,s,i))})}),r}function MC(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,m,f]=r,h=a.x+T(c,i.axisX,a.width),y=a.y+a.height-T(u,i.axisY,a.height),x=a.x+T(c+Math.cos(m)*f,i.axisX,a.width),b=a.y+a.height-T(u+Math.sin(m)*f,i.axisY,a.height);return{type:"path",id:`chart-field-vector-${i.id}-${t}-${o}`,order:d(),bounds:s,d:`M ${h} ${y} L ${x} ${b}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:P(n,l,i.id),strokeWidth:2}}}function Ym(e){let t=_m(e),r=[];return r.push(...Wm(e,t.scalarSamples)),r.push(...zm(e,t.vectorSeries)),r.push(...Fm(e)),r}function Um(e,t){let r=[];return t.rows.forEach((o,n)=>{r.push(...TC(e,t,o,n))}),r}function TC(e,t,r,o){return t.columns.flatMap((n,i)=>{let a=$C(t,r,o,i);return EC(e,t,a)})}function $C(e,t,r,o){let n=t.values[o]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:o,value:n,color:AC(n,e),frame:{x:e.grid.x+o*e.grid.cellWidth+i/2,y:e.grid.y+r*e.grid.cellHeight+i/2,width:Math.max(0,e.grid.cellWidth-i),height:Math.max(0,e.grid.cellHeight-i)}}}function AC(e,t){return Rr(e,t.bands,t.zones)}function EC(e,t,r){let o=NC(e,t,r);return e.chart.config?.showValues===!1?[o]:[o,OC(e,t,r)]}function NC(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=`chart-heatmap-cell-${o.id}-${r.seriesId}-${r.columnIndex}`,s={fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:o.config?.cellStrokeColor??o.gridColor??"#e2e8f0"},strokeWidth:p(o.config?.cellStrokeWidth,p(o.gridWidth,1))};return o.config?.cellShape==="circle"?{type:"ellipse",id:a,order:i(),bounds:n,cx:r.frame.x+r.frame.width/2,cy:r.frame.y+r.frame.height/2,rx:r.frame.width/2,ry:r.frame.height/2,style:s}:{type:"rect",id:a,order:i(),bounds:n,...r.frame,rx:t.grid.cellRadius,style:s}}function OC(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=Math.max(6,p(o.config?.cellValueSize,t.fontSize));return{...L({id:`chart-heatmap-value-${o.id}-${r.seriesId}-${r.columnIndex}`,order:i(),bounds:n,frame:{x:r.frame.x,y:r.frame.y+r.frame.height/2-a/2,width:r.frame.width,height:a+2},text:String(r.value),chart:o,align:"center"}),...o.config?.cellValueSize===void 0?{}:{fontSize:a},color:o.config?.cellValueColor??ce(r.color)}}function jm(e){let{chart:t}=e,r=qm(e),o=BC(e),n=GC(e,o);return{rows:t.series,columns:r,bands:kr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Cr,fontSize:Math.max(9,p(t.fontSize,12)),headerFontSize:xa(t),legendGap:Xm(t),sides:o,reservedSpace:n,grid:FC(e,n,o,r.length)}}var xa=e=>Math.max(9,p(e.axisFontSize??e.fontSize,12)),Sa=e=>Math.min(120,Math.max(0,p(e.yLabelGap,6))),Jo=e=>Math.min(120,Math.max(0,p(e.xLabelGap,4))),Xm=e=>Math.min(80,Math.max(0,p(e.legendGap,6)));function BC(e){let{chart:t}=e;return{rows:t.rowLabelSide==="right"?"right":"left",columns:t.columnLabelSide==="bottom"?"bottom":"top",legend:t.legendSide??"bottom"}}function qm(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}var IC=32,DC=56;function GC(e,t){let{chart:r}=e,o=xa(r),n=r.series.reduce((a,s)=>Math.max(a,he(s.label??"",o,!1)),0),i=t.legend==="left"||t.legend==="right";return{rowHeaders:e.showLabels?Math.min(e.plot.width*.7,r.axisLabelSpace&&r.axisLabelSpace>0?r.axisLabelSpace:n+6+Sa(r)):0,columnHeaders:e.showLabels?_C(e):0,legend:e.showLegend?(i?DC:IC)+Xm(r):0}}function _C(e){let{chart:t}=e,r=_e(t);return r>0?Math.min(e.plot.height*.4,Lr(t,qm(e),r)+Jo(t)+4):xa(t)+2+Jo(t)+6}function FC(e,t,r,o){let{chart:n}=e,i=(r.rows==="left"?t.rowHeaders:0)+(r.legend==="left"?t.legend:0),a=(r.rows==="right"?t.rowHeaders:0)+(r.legend==="right"?t.legend:0),s=(r.columns==="top"?t.columnHeaders:0)+(r.legend==="top"?t.legend:0),l=(r.columns==="bottom"?t.columnHeaders:0)+(r.legend==="bottom"?t.legend:0),d=Math.max(1,e.plot.width-i-a),c=Math.max(1,e.plot.height-s-l),u=n.series.length,m=Math.max(0,p(n.config?.cellGap,0)),f=o?d/o:d,h=u?c/u:c,y=d,x=c;if(n.config?.squareCells&&o&&u){let b=Math.min(f,h);f=b,h=b,y=b*o,x=b*u}return{x:e.plot.x+i,y:e.plot.y+s,width:y,height:x,cellWidth:f,cellHeight:h,cellGap:m,cellRadius:Math.max(0,p(n.config?.barCornerRadius,m))}}function Km(e,t){return[...HC(e,t),...WC(e,t)]}function HC(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,o)=>VC(e,t,r,o))}function VC(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.reservedSpace.rowHeaders,l=Sa(n),d=t.sides.rows==="left"?t.grid.x-s:t.grid.x+t.grid.width+l;return L({id:`chart-heatmap-row-${n.id}-${r.id}`,order:a(),bounds:i,frame:{x:d,y:t.grid.y+o*t.grid.cellHeight+t.grid.cellHeight/2-t.headerFontSize/2,width:Math.max(1,s-l),height:t.headerFontSize+2},text:r.label,chart:n,align:n.axisLabelAlign??"left",role:"axis"})}function WC(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,o)=>zC(e,t,r,o))}function zC(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.sides.columns==="top",l=t.grid.x+(o+.5)*t.grid.cellWidth,d=_e(n),c=Jo(n),u=`chart-heatmap-col-${n.id}-${o}`;if(d>0){let{frame:m,rotation:f}=s?ta(n,r,d,{x:l,y:t.grid.y-c}):zt(n,r,d,{x:l,y:t.grid.y+t.grid.height+c});return L({id:u,order:a(),bounds:i,frame:m,text:r,chart:n,align:s?"left":"right",rotation:f,role:"axis"})}return L({id:u,order:a(),bounds:i,frame:{x:t.grid.x+o*t.grid.cellWidth,y:s?t.grid.y-c-(t.headerFontSize+2):t.grid.y+t.grid.height+c,width:t.grid.cellWidth,height:t.headerFontSize+2},text:r,chart:n,align:"center",role:"axis"})}var or=10,tt=4,en=2,Br=48;function YC(e){let{grid:t,sides:r,reservedSpace:o,legendGap:n}=e,i=o.rowHeaders,a=o.columnHeaders;switch(r.legend){case"top":{let s=t.y-(r.columns==="top"?a:0);return{x:t.x,y:s-n-or,width:t.width,height:or,vertical:!1,numbers:"top"}}case"left":return{x:t.x-(r.rows==="left"?i:0)-n-or,y:t.y,width:or,height:t.height,vertical:!0,numbers:"left"};case"right":return{x:t.x+t.width+(r.rows==="right"?i:0)+n,y:t.y,width:or,height:t.height,vertical:!0,numbers:"right"};default:{let s=t.y+t.height+(r.columns==="bottom"?a:0);return{x:t.x,y:s+n,width:t.width,height:or,vertical:!1,numbers:"bottom"}}}}function Zm(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=YC(t),o=de({x:r.x,y:r.y,width:r.width,height:r.height});return[UC(e,t,r,o),...jC(e,t,r)]}function Qm(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function UC(e,t,r,o){let{chart:n,nextOrder:i}=e,a=Math.max(0,t.bands.length-1),l=t.zones.slice(0,a).map((d,c)=>({offset:Qm(t,t.bands[c+1]??t.bands[t.bands.length-1])*100,color:d.color??K}));return{type:"rect",id:`chart-heatmap-legend-bar-${n.id}`,order:i(),bounds:o,x:r.x,y:r.y,width:r.width,height:r.height,rx:3,zoneGradient:{axis:"y",min:n.axisY.min,max:n.axisY.max},style:{fill:l.length?{kind:"linear-gradient",angle:r.vertical?270:0,stops:l}:{kind:"solid",color:K},stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:1}}}function jC(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=t.fontSize+2,s=t.bands.length-1;return t.bands.flatMap((l,d)=>{let c=Qm(t,l),u=r.vertical?r.y+r.height-c*r.height:r.x+c*r.width,m=XC(r,u),f={type:"path",id:`chart-heatmap-legend-tick-${o.id}-${d}`,order:i(),bounds:n,d:m,style:{fill:{kind:"none"},stroke:{kind:"solid",color:o.gridColor??"#e2e8f0"},strokeWidth:1}},h=L({id:`chart-heatmap-legend-tick-label-${o.id}-${d}`,order:i(),bounds:n,...qC(r,u,d===0,d===s,a),text:Ae(l),chart:o});return[f,h]})}function XC(e,t){if(e.vertical){let n=e.numbers==="right"?e.x+e.width:e.x,i=e.numbers==="right"?n+tt:n-tt;return`M ${n} ${t} L ${i} ${t}`}let r=e.numbers==="bottom"?e.y+e.height:e.y,o=e.numbers==="bottom"?r+tt:r-tt;return`M ${t} ${r} L ${t} ${o}`}function qC(e,t,r,o,n){if(e.vertical){let s=e.numbers==="right";return{frame:{x:s?e.x+e.width+tt+en:e.x-tt-en-Br,y:t-n/2,width:Br,height:n},align:s?"left":"right"}}let i=e.numbers==="bottom"?e.y+e.height+tt+en:e.y-tt-en-n;return{frame:{x:r?t:o?t-Br:t-Br/2,y:i,width:Br,height:n},align:r?"left":o?"right":"center"}}function Jm(e){let t=jm(e),r=[];return r.push(...Um(e,t)),r.push(...Km(e,t)),r.push(...Zm(e,t)),r}function Ca(e,t){if(t<=0||e.length===0)return[];let r=t*1.5,o=t*Math.sqrt(3),n=new Map;for(let{x:i,y:a}of e){let s=Math.round(i/r),l=s%2!==0?o/2:0,d=Math.round((a-l)/o),c=`${s}:${d}`,u=n.get(c);u?u.count++:n.set(c,{cx:s*r,cy:d*o+l,count:1})}return[...n.values()]}function ep(e){let t=new Map;for(let r of e.ids)t.set(r,0);for(let r=0;r<e.ids.size;r++){let o=!1;for(let n of e.links){let i=(t.get(n.source)??0)+1;i>(t.get(n.target)??0)&&(t.set(n.target,i),o=!0)}if(!o)break}return t}function tp(e,t){let r=new Map;for(let o of e){let n=t.get(o)??0,i=r.get(n)??[];i.push(o),r.set(n,i)}return r}function rp(e,t){let r=new Set(e.map(a=>a.id));for(let a of t)r.add(a.source),r.add(a.target);let o=new Map,n=new Map;for(let a of r)o.set(a,[]),n.set(a,[]);let i=t.filter(a=>r.has(a.source)&&r.has(a.target)&&a.value>0&&a.source!==a.target);for(let a of i)n.get(a.source)?.push(a),o.get(a.target)?.push(a);return{ids:r,links:i,incoming:o,outgoing:n}}function ZC(e){let t=new Map;for(let r of e.ids){let o=(e.incoming.get(r)??[]).reduce((i,a)=>i+a.value,0),n=(e.outgoing.get(r)??[]).reduce((i,a)=>i+a.value,0);t.set(r,Math.max(o,n,1e-4))}return t}function QC(e,t,r,o){let n=1/0;for(let i of e.values()){let a=i.reduce((d,c)=>d+(t.get(c)??0),0),s=Math.max(0,i.length-1)*o,l=Math.max(1,r-s);a>0&&(n=Math.min(n,l/a))}return!Number.isFinite(n)||n<=0?1:n}function Ir(e,t,r,o=18){return t<=1?0:e*(r-o)/(t-1)}function op(e,t,r,o=8){let n=tp(e.ids,t),i=ZC(e),a=QC(n,i,r,o),s=new Map,l=new Map;for(let d of n.values()){let c=0;for(let u of d){let m=Math.max(2,(i.get(u)??0)*a);s.set(u,c),l.set(u,m),c+=m+o}}return{columns:t,y:s,heights:l,valueScale:a,columnCount:Math.max(1,...[...t.values()].map(d=>d+1))}}function np(e,t,r,o,n=18){let i=new Map,a=new Map;for(let s of e.ids)i.set(s,0),a.set(s,0);return e.links.map(s=>{let l=Math.max(.5,s.value*t.valueScale),d=o.get(s.source),c=o.get(s.target),u=(t.y.get(s.source)??0)+(d?.y??0),m=(t.y.get(s.target)??0)+(c?.y??0),f=i.get(s.source)??0,h=a.get(s.target)??0;return i.set(s.source,f+l),a.set(s.target,h+l),{source:s.source,target:s.target,value:s.value,color:s.color,x0:Ir(t.columns.get(s.source)??0,t.columnCount,r,n)+n+(d?.x??0),x1:Ir(t.columns.get(s.target)??0,t.columnCount,r,n)+(c?.x??0),sourceY0:u+f,sourceY1:u+f+l,targetY0:m+h,targetY1:m+h+l}})}function ip(e,t,r,o,n,i=18){return[...t.ids].map(a=>{let s=e.find(c=>c.id===a),l=r.columns.get(a)??0,d=n.get(a);return{id:a,label:s?.label??a,color:s?.color,x:Ir(l,r.columnCount,o,i)+(d?.x??0),y:(r.y.get(a)??0)+(d?.y??0),width:i,height:r.heights.get(a)??2,column:l}})}function JC(e){let t=new Map;for(let r of e)(r.offsetX||r.offsetY)&&t.set(r.id,{x:r.offsetX??0,y:r.offsetY??0});return t}function Ra(e,t,r,o,n={nodeWidth:18,nodeGap:8}){let i=rp(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=ep(i),s=op(i,a,o,n.nodeGap),l=JC(e);return{nodes:ip(e,i,s,r,l,n.nodeWidth),links:np(i,s,r,l,n.nodeWidth)}}function Dr(e,t){let r=ek(e,t);if(!r.length)return[];let o=[],n=r,i=t;for(;n.length;){let a=tk(n,Math.min(i.width,i.height)),s=rk(a,i);o.push(...s.rectangles),n=n.slice(a.items.length),i=s.remainingBounds}return o}function ek(e,t){let r=e.filter(i=>i.value>0);if(!r.length||t.width<=0||t.height<=0)return[];let o=r.reduce((i,a)=>i+a.value,0);if(o<=0)return[];let n=t.width*t.height/o;return[...r].sort((i,a)=>a.value-i.value).map(i=>({item:i,area:i.value*n}))}function tk(e,t){let r=[e[0]];for(let o=1;o<e.length;o++){let n=[...r,e[o]];if(ap(n,t)>ap(r,t))break;r.push(e[o])}return{items:r,area:r.reduce((o,n)=>o+n.area,0)}}function ap(e,t){let r=e.reduce((s,l)=>s+l.area,0);if(r<=0||t<=0)return 1/0;let o=e.map(s=>s.area),n=Math.max(...o),i=Math.min(...o),a=t*t;return Math.max(a*n/(r*r),r*r/(a*i))}function rk(e,t){return t.width>=t.height?ok(e,t):nk(e,t)}function ok(e,t){let r=t.height>0?e.area/t.height:0,o=t.y;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:t.x,y:o,width:r,height:s};return o+=s,l}),remainingBounds:{x:t.x+r,y:t.y,width:t.width-r,height:t.height}}}function nk(e,t){let r=t.width>0?e.area/t.width:0,o=t.x;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:o,y:t.y,width:s,height:r};return o+=s,l}),remainingBounds:{x:t.x,y:t.y+r,width:t.width,height:t.height-r}}}var ik=.15,ak=1/Math.sqrt(3);function sk(e,t,r){let o=[];for(let n=0;n<6;n++){let i=(-60+60*n)*Math.PI/180;o.push(`${n===0?"M":"L"} ${e+r*Math.cos(i)} ${t+r*Math.sin(i)}`)}return`${o.join(" ")} Z`}function sp(e){let{chart:t,plot:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??Yi),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*ak),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??ik)),m=H(t.shadowStyle),f=m?`M ${r.x} ${r.y} H ${r.x+r.width} V ${r.y+r.height} H ${r.x} Z`:void 0;return t.series.forEach((h,y)=>{let C=(h.values.length>0&&Array.isArray(h.values[0])?h.values:h.values.map((_,G)=>[t.axisX.min+G*t.axisX.step,_])).map(([_,G])=>({x:T(_,t.axisX,r.width),y:r.height-T(G,t.axisY,r.height)})),S=Ca(C,l),w=Math.max(1,...S.map(_=>_.count)),O=h.color??E[y%E.length],A=s?.scale;S.forEach((_,G)=>{let V=_.count/w,ve=A?qo(A,V):O;a.push({type:"path",id:`chart-hexbin-${t.id}-${h.id}-${G}`,order:i(),bounds:o,d:sk(r.x+_.cx,r.y+_.cy,d),style:{fill:P(ve,n,t.id),stroke:c>0?P(s?.hexStrokeColor??ve,n,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:A?void 0:Math.max(u,V),shadow:m,clip:f?{type:"path",d:f}:void 0}})})}),a}function ht(e,t){return t.values.length>0&&Array.isArray(t.values[0])?t.values:t.values.map((r,o)=>[e.axisX.min+o*e.axisX.step,r])}function gt(e,t){let{chart:r,plot:o}=e;return t.map(([n,i])=>({x:o.x+T(n,r.axisX,o.width),y:o.y+o.height-T(i,r.axisY,o.height)}))}function lp(e,t,r,o,n,i){let{chart:a,plot:s,nextOrder:l}=e,d=s.y+s.height,c=r[0],u=r[r.length-1],m=`${Yt(r,n)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(b=>b.y)),h=(Math.min(...r.map(b=>b.x))+Math.max(...r.map(b=>b.x)))/2,y=(d-f)/2,x={minX:h-y,maxX:h+y,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:x,d:m,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:Zi(o,i)},{offset:100,color:Zi(o,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function lk(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function dk(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e;return{type:"path",id:`chart-highlight-guide-${t.key}`,order:a(),bounds:n,d:`M ${t.point.x} ${t.point.y} V ${o.y+o.height}`,style:{fill:{kind:"none"},stroke:P(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function ck(e,t){let{chart:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=r.config?.lineGlow;return{type:"ellipse",id:`chart-highlight-${t.key}`,order:i(),bounds:o,cx:t.point.x,cy:t.point.y,rx:t.radius,ry:t.radius,style:{fill:P(t.color,n,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function uk(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=o.config,s=Math.max(9,o.fontSize??12),l=lk(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...L({id:`chart-highlight-label-${t.key}`,order:i(),bounds:n,frame:{x:t.point.x-d/2,y:t.point.y-t.radius-6-s*1.2,width:d,height:s*1.2},text:l,chart:o,align:"center"}),color:a?.highlightLabelColor??o.textColor??"#0f172a",fontWeight:"bold"}}function dp(e,t,r){let{chart:o}=e,n=o.config,i=n?.highlightPoints;if(!i?.length)return[];let a=ht(o,t),s=gt(e,a),l=[];for(let d of i){let c=d<0?s.length+d:d,u=s[c];if(!u)continue;let m={key:`${o.id}-${t.id}-${c}`,point:u,index:c,radius:n?.highlightSize??6,color:n?.highlightColor??r};n?.highlightGuide&&l.push(dk(e,m)),l.push(ck(e,m)),n?.highlightLabels&&l.push(uk(e,m,a[c][1]))}return l}function cp(e,t,r,o){return r.map((n,i)=>({seriesId:e.id,valueIndex:i,value:t[i][1],error:e.error?.[i],position:n,color:o}))}function up(e,t){return t.flatMap(r=>mk(e,r))}function mk(e,t){let r=[],o=pk(e,t);return o&&r.push(o),r.push(fk(e,t)),r}function pk(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=vr(t.value,t.error);return Pr({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:n,geometry:{centerX:t.position.x,startY:o.y+o.height-T(a,r.axisY,o.height),endY:o.y+o.height-T(s,r.axisY,o.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function fk(e,t){let{chart:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=r.config,s=a?.pointSize??3,l=a?.pointStrokeWidth??0,d=s>0,c=a?.pointFill&&a.pointFill!=="series"?a.pointFill:t.color;return{type:"ellipse",id:`chart-point-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,cx:t.position.x,cy:t.position.y,rx:d?s:6,ry:d?s:6,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex},style:{fill:d?P(c,n,r.id):{kind:"none"},stroke:d&&l>0?P(t.color,n,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function mp(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=i.config,u=t.color,m=u&&typeof u!="string"&&u.type==="gradient"?u:void 0,f=c?.lineGlow;return{type:"path",id:`chart-line-${i.id}-${t.id}`,order:d(),bounds:m?{minX:a.x,maxX:a.x+a.width,minY:a.y,maxY:a.y+a.height}:s,detail:{of:"chartSeries",series:t.id,lineTension:n||void 0},d:Yt(r,n),style:{fill:{kind:"none"},stroke:P(m??o,l,i.id),strokeWidth:t.strokeWidth??c?.lineWidth??2,dash:t.dash,lineCap:c?.lineWidth===void 0?void 0:"round",lineJoin:"round",shadow:f?{color:o,opacity:.9,blur:f,dx:0,dy:0}:H(i.shadowStyle)}}}function pp(e,t){return F(e.color,E[t%E.length])}function fp(e,t,r){let o=e.chart.config?.areaOpacity;if(o===void 0||o<=0)return[];let n=pp(t,r),i=e.chart.config?.lineTension??0,a=gt(e,ht(e.chart,t));return a.length>1?[lp(e,t,a,n,i,o)]:[]}function hp(e,t,r){let o=pp(t,r),n=e.chart.config?.lineTension??0,i=ht(e.chart,t),a=gt(e,i),s=[];a.length&&s.push(mp(e,t,a,o,n));let l=cp(t,i,a,o);return s.push(...up(e,l)),s.push(...dp(e,t,o)),s}function gp(e){let t=[];return e.chart.series.forEach((r,o)=>{t.push(...fp(e,r,o))}),e.chart.series.forEach((r,o)=>{t.push(...hp(e,r,o))}),t}var yp=[0,25,50,75,100];function bp(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...hk(e,t)),e.showLabels&&r.push(...gk(e,t)),r}function hk(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return yp.map(i=>{let a=xp(t,i);return{type:"path",id:`chart-mekko-grid-${r.id}-${i}`,order:n(),bounds:o,d:`M ${t.grid.x} ${a} L ${t.grid.x+t.grid.width} ${a}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:p(r.gridWidth,1)}}})}function gk(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e;return yp.map(a=>({...L({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:n,frame:{x:o.x,y:xp(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function xp(e,t){return e.grid.y+e.grid.height*(1-t/100)}function Sp(e,t,r,o){if(!e.showLabels)return[];let n=bk(e,t,r,o);return e.chart.config?.showMekkoTotals===!1?[n]:[yk(e,t,r,o),n]}function yk(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e;return{...L({id:`chart-mekko-total-${n.id}-${r}`,order:s(),bounds:a,frame:{x:o.x,y:i.y,width:o.width,height:t.smallFontSize+2},text:String(o.total),chart:n,align:"center"}),fontSize:t.smallFontSize}}function bk(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,{label:s,width:l}=o;return{...L({id:`chart-mekko-col-label-${n.id}-${r}`,order:a(),bounds:i,frame:{x:o.x,y:t.grid.y+t.grid.height+4,width:l,height:t.smallFontSize*2+4},text:s,chart:n,align:"center"}),lines:De(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function Cp(e){let t=xk(e),r=e.showLabels?30:0,o=Sk(e,r),n=Math.max(9,p(e.chart.fontSize,12)),i=Math.max(0,p(e.chart.config?.mekkoColumnGap,4)),a=Math.max(8,n-1);return{columns:Ck(e,o,t,i),fontSize:n,smallFontSize:a,labelGutterWidth:r,columnGap:i,labelSize:Math.max(6,p(e.chart.config?.mekkoLabelSize,a)),valueSize:Math.max(6,p(e.chart.config?.mekkoValueSize,a)),grid:o}}function xk(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}function Sk(e,t){let r=e.showLabels?18:0,o=e.showLabels?32:0;return{x:e.plot.x+t,y:e.plot.y+r,width:Math.max(1,e.plot.width-t),height:Math.max(1,e.plot.height-r-o)}}function Ck(e,t,r,o){let n=r.map((d,c)=>e.chart.series.reduce((u,m)=>u+(m.values[c]??0),0)),i=n.reduce((d,c)=>d+c,0),a=Math.max(1,...n),s=Math.max(1,t.width-o*Math.max(0,r.length-1)),l=t.x;return r.map((d,c)=>{let u=n[c],m=i>0?u/i*s:s/r.length,f=e.chart.config?.mekkoVaryHeight?t.height*(u/a):t.height,h={label:d,total:u,x:l,y:t.y+t.height-f,width:m,height:f};return l+=m+o,h})}var kk=.15;function kp(e,t,r){let n=e.chart.config?.showColumnBackdrop!==!1?[Rk(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=wk(e.chart.series,t,r),s=a.flatMap((l,d)=>vk(e,t,l,i?a[d+1]?.color:void 0));return[...n,...s]}function Rk(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=Rp(e);return{type:"path",id:`chart-mekko-column-backdrop-${o.id}-${r}`,order:a(),bounds:n,d:Bo(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:P(o.gridColor??"#e2e8f0",i,o.id),opacity:kk}}}function Rp(e){return Math.max(0,p(e.chart.config?.barCornerRadius,2))}function wk(e,t,r){let o=[],n=t.columns[r],i=0;return e.forEach((a,s)=>{let l=a.values[r]??0,d=(n.total>0?l/n.total:0)*n.height,c=n.y+i;i+=d;let u=a.color??E[s%E.length];o.push({columnIndex:r,seriesId:a.id,seriesLabel:a.label,value:l,color:u,isTop:s===0,frame:{x:n.x,y:c,width:n.width,height:d}})}),o}function vk(e,t,r,o){return[Pk(e,r,o),...Lk(e,t,r)]}function Pk(e,t,r){let{chart:o,plot:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=H(o.shadowStyle),d=l?`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`:void 0,c=o.config,u=t.isTop||c?.mekkoRoundAll?Rp(e):0,{x:m,y:f,width:h,height:y}=t.frame,x=Math.max(0,p(c?.mekkoSegmentGap,0)),b="#94a3b8",C={minX:m+h/2-y/2,maxX:m+h/2+y/2,minY:f,maxY:f+y},S=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:F(t.color,b)},{offset:100,color:F(r,b)}]}:P(t.color,a,o.id);return{type:"path",id:`chart-mekko-seg-${o.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?C:i,d:ct(m,f+x/2,h,Math.max(0,y-x),u,!!c?.mekkoRoundAll),style:{fill:S,stroke:{kind:"solid",color:c?.mekkoSegmentStrokeColor??o.gridColor??"#e2e8f0"},strokeWidth:p(c?.mekkoSegmentStrokeWidth,p(o.gridWidth,1)),shadow:l,clip:d?{type:"path",d}:void 0}}}function Lk(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,{x:a,y:s,width:l,height:d}=r.frame;if(!e.showLegend||l<34)return[];let c=Math.max(1,l-8),u=Math.max(1,d-6),m=t.labelSize*1.2,f=t.valueSize*1.2,h=De(r.seriesLabel,c,t.labelSize).map(w=>$o(w,c,t.labelSize,!0));if(h.length*m+f>u)return[];let y=o.config?.mekkoTextColor??ce(F(r.color,"#ffffff")),x=t.columns[r.columnIndex]?.total??0,b=o.config?.mekkoValueFormat==="percent"?`${x>0?Math.round(r.value/x*100):0}%`:String(r.value),C={...L({id:`chart-mekko-seg-label-${o.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:n,frame:{x:a+4,y:s+3,width:c,height:u},text:r.seriesLabel,chart:o}),lines:h,fontSize:t.labelSize,fontWeight:"bold",color:y},S={...L({id:`chart-mekko-seg-value-${o.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:n,frame:{x:a+4,y:s+3+h.length*m,width:c,height:Math.max(1,u-h.length*m)},text:b,chart:o}),lines:[b],fontSize:t.valueSize,color:y};return[C,S]}function wp(e){let t=Cp(e),r=bp(e,t);return t.columns.forEach((o,n)=>{r.push(...kp(e,t,n)),r.push(...Sp(e,t,n,o))}),r}function Mk(e,t){let r=t.series.map(i=>Math.max(0,p(i.values[0],0))),o=r.reduce((i,a)=>i+a,0),n=r[0]??0;return e.replace(/\{total\}/g,String(Math.round(o*100)/100)).replace(/\{percent\}/g,String(o>0?Math.round(n/o*100):0)).replace(/\{label\}/g,t.series[0]?.label??"")}function vp(e,t){let{chart:r,bounds:o,nextOrder:n}=e,i=r.config?.pieCenterText;if(!i)return[];let a=Mk(i,r).split(/\\n|\n/),s=p(r.config?.pieCenterSize,Math.max(14,Math.min(40,t.outerRadius*.3))),l=s*1.2,d=Math.max(40,(t.innerRadius>0?t.innerRadius:t.outerRadius*.6)*2);return[{type:"text",id:`chart-pie-center-${r.id}`,order:n(),bounds:o,x:t.centerX-d/2,y:t.centerY-l*a.length/2,width:d,height:l*a.length,lines:a,fontFamily:r.fontFamily??B,fontSize:s,fontWeight:"bold",align:"center",verticalAlign:"middle",lineHeight:1.2,color:r.config?.pieCenterColor??r.textColor??"#0f172a",detail:{of:"chartSeries",series:r.series[0]?.id??"",mark:"pie-center"}}]}function Pp(e){let{chart:t,plot:r}=e,o=Vo(r.width,r.height,t.config?.innerRadius,t.config?.pieCornerRadius),i=t.config?.pieLabelPosition==="outside"&&t.showAxisLabels!==!1?t.config?.pieLabelContent==="inline"?.6:.7:1,a=o.outerRadius*i,s=o.innerRadius*i,l=o.cornerRadius;return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,outerRadius:a,innerRadius:s,cornerRadius:l,total:t.series.reduce((d,c)=>d+Math.max(0,p(c.values[0],0)),0)||1}}var Tk=14*Math.PI/180,Gr=80,$k=.62,Ak=14,Ek=3,Nk=.32,Lp="#334155";function $p(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(o=>o.end-o.start>=Tk).flatMap(o=>Ok(e,t,o))}function Mp(e,t,r,o,n,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=n*1.2,m=l.config?.pieLabelContent??"both",f=m==="inline"?Gr*1.9:Gr,h={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??B,fontSize:n,align:"center",verticalAlign:"middle",lineHeight:1.2,color:o},y=C=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...C}),x={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...h,y:m==="name"?r.y-u/2:r.y-u,lines:[m==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:y({}),prop:Ee(t.seriesId)},b={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...h,y:m==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:y({}),prop:ue(t.seriesId,0),propKind:"value"};return m==="inline"||m==="name"?[x]:m==="percent"?[b]:[x,b]}function Tp(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e;return{type:"path",id:`chart-pie-label-tick-${a.id}-${t.seriesId}`,order:l(),bounds:s,d:`M ${r.x} ${r.y} L ${o.x} ${o.y}`,detail:{of:"chartSeries",series:t.seriesId,mark:"pie-label-tick"},style:i?{stroke:{kind:"solid",color:n},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function Ok(e,t,r){let o=e.chart.config,n={...t,centerX:t.centerX+r.shift.dx,centerY:t.centerY+r.shift.dy},i=(r.start+r.end)/2,a=Math.max(9,p(e.chart.fontSize,12)),s=Math.round(r.share*100),l=a*1.2,d=Q(n,i,n.outerRadius+Ek),c=n.outerRadius-n.innerRadius,u=c<l*2+6,m=r.labelOffsetX!==0||r.labelOffsetY!==0,f=o?.pieLabelPosition??"auto";if(m||f==="outside"||f==="auto"&&u){let w=m?Bk(Q(n,i,n.outerRadius),r.labelOffsetX,r.labelOffsetY):Q(n,i,n.outerRadius+Ak+(f==="outside"?Math.abs(Math.cos(i))*(o?.pieLabelContent==="inline"?Gr*.95:Gr/2):0)),O=Mr(d,w,Gr/2,l),A=o?.pieLabelColor??Je(F(r.color,Lp),Nk)??Lp;return[Tp(e,r,d,O,A,!0),...Mp(e,r,w,A,a,s,!0,i)]}let y=n.innerRadius+c*$k,x=Q(n,i,y),b=F(r.color,"#0f172a"),C=o?.pieLabelColor??Ht(b,ce(b));return[Tp(e,r,d,d,C,!1),...Mp(e,r,x,C,a,s,!1,i)]}function Bk(e,t,r){return{x:e.x+t,y:e.y+r}}var Ik=-Math.PI/2,va=Math.PI*2,Dk=va*(359.999/360),wa=e=>e*Math.PI/180;function Ap(e,t){let r=e.chart.config,o=_k(e.chart.series,t.total,{start:Ik+wa(p(r?.pieStartAngle,0)),sweep:Math.min(va,Math.max(wa(1),wa(p(r?.pieSweep,360)))),explode:Math.max(0,p(r?.pieExplode,0))}),n=r?.pieSliceGap??0;return[...o.flatMap(i=>zk(e,Gk(t,i),i,n)),...$p(e,t,o.map(i=>({seriesId:i.seriesId,label:i.label,color:i.color,share:i.share,start:i.angles.start,end:i.angles.end,labelOffsetX:i.labelOffsetX,labelOffsetY:i.labelOffsetY,shift:Ep(i)})))]}function Ep(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function Gk(e,t){if(t.explode===0)return e;let{dx:r,dy:o}=Ep(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+o}}function _k(e,t,r){let o=[],n=r.start;return e.forEach((i,a)=>{let s=Math.max(0,p(i.values[0],0)),l=s/t*r.sweep;o.push({seriesId:i.id,label:i.label,color:i.color??E[a%E.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:n,end:n+Math.min(l,r.sweep>=va?Dk:r.sweep)},explode:Math.max(0,p(i.offset,r.explode)),labelOffsetX:p(i.labelOffsetX,0),labelOffsetY:p(i.labelOffsetY,0)}),n+=l}),o}function Fk(e,t,r){return`M ${e-r} ${t} A ${r} ${r} 0 1 0 ${e+r} ${t} A ${r} ${r} 0 1 0 ${e-r} ${t} Z`}function Hk(e,t){if(t<=0)return e;let r=t/2,o=Math.min(e.blur,r*2),n=r,i=Math.hypot(e.dx,e.dy),a=i>n?n/i:1;return{...e,blur:o,dx:e.dx*a,dy:e.dy*a}}function Vk(e,t,r){let o=Math.max(0,r)/2,n=t.angles.end-t.angles.start,i=Xt(e,t.angles,r),a=2*ut(o,e.outerRadius),s=Math.max(0,n-a);return Math.min(e.cornerRadius,i?Tr(e.outerRadius,e.innerRadius,s):$r(e.outerRadius,mt(o,n,e.outerRadius),s))}function Wk(e,t){let r=e.chart.config,o=t.stroke??r?.pieStroke;return o?{stroke:{kind:"solid",color:o},strokeWidth:p(t.strokeWidth,p(r?.pieStrokeWidth,1))}:{}}function zk(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=P(r.color,a,n.id),d=pt(t,r.angles,Vk(t,r,o),o),c=H(n.shadowStyle),u=Wk(e,r),m=n.config?.pieGlow,f=c?{type:"path",id:`chart-pie-slice-shadow-${n.id}-${r.seriesId}`,order:s(),bounds:i,d,style:{fill:l,...u,shadow:Hk(c,o),clip:{type:"path",d:Fk(t.centerX,t.centerY,t.outerRadius)}}}:void 0,h={type:"path",id:`chart-pie-slice-${n.id}-${r.seriesId}`,order:s(),bounds:i,d,detail:{of:"chartValue",series:r.seriesId,valueIndex:0,mark:"pie-slice",pieStart:r.angles.start,pieEnd:r.angles.end,pieValue:r.value},prop:ue(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:m?{color:F(r.color,"#ffffff"),opacity:.85,blur:m,dx:0,dy:0}:void 0}};return f?[f,h]:[h]}function Np(e){let t=Pp(e);return[...Ap(e,t),...vp(e,t)]}var Yk=-Math.PI/2,Uk="#e2e8f0",jk=14*Math.PI/180,tn=80,Xk=.62,qk=14,Kk=3,Zk=.32,Op="#334155";function Qk(e){let{chart:t,plot:r}=e,o=Math.max(1,Math.min(r.width,r.height)/2-4),n=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,maxRadius:o,innerRadius:Math.max(0,Math.min(p(t.config?.innerRadius,0),o-1)),cornerRadius:Math.max(0,p(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,p(t.config?.pieSliceGap,0)),axisMin:n,range:p(t.axisY.max,100)-n,sweep:t.series.length>0?Math.PI*2/t.series.length:0,start:Yk+p(t.config?.pieStartAngle,0)*Math.PI/180}}function Bp(e,t,r){let{centerX:o,centerY:n,innerRadius:i,cornerRadius:a,gapPx:s}=e,l={centerX:o,centerY:n,outerRadius:t,innerRadius:i},d=Math.max(0,s)/2,c=r.end-r.start,u=Math.max(0,c-2*ut(d,t));if(Xt(l,r,s))return Math.min(a,Tr(t,i,u));let m=mt(d,c,t);return Math.min(a,$r(t,m,u))}function Jk(e,t,r,o,n,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:m,innerRadius:f,maxRadius:h,gapPx:y}=t,x=P(a,d,s.id),b=H(s.shadowStyle),C=pt({centerX:u,centerY:m,outerRadius:h,innerRadius:f},o,Bp(t,h,o),y),S={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:C,style:{fill:P(s.gridColor??Uk,d,s.id),opacity:s.config?.polarTrackOpacity,...eR(e)}},w=pt({centerX:u,centerY:m,outerRadius:n,innerRadius:f},o,Bp(t,n,o),y),O=b?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:w,style:{fill:x,shadow:b,clip:{type:"path",d:C}}}:void 0,A={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:w,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:o.start,pieEnd:o.end,pieValue:i},prop:ue(r.id,0),style:{fill:x,innerShadow:b,...tR(e)}};return O?[S,O,A]:[S,A]}function eR(e){let t=e.chart.config;if(!t?.polarTrackStroke)return{};let r=(t.polarTrackDash??"").split(/[ ,]+/).map(Number).filter(o=>Number.isFinite(o)&&o>0);return{stroke:{kind:"solid",color:t.polarTrackStroke},strokeWidth:p(t.polarTrackStrokeWidth,1),dash:r.length>0?r:void 0}}function tR(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:p(t.pieStrokeWidth,1)}:{}}function rR(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return!r.config?.polarRings||t.range<=0?[]:U(r.axisY).filter(i=>i>t.axisMin&&i<t.axisMin+t.range).map(i=>{let a=t.innerRadius+(t.maxRadius-t.innerRadius)*(i-t.axisMin)/t.range;return{type:"ellipse",id:`chart-polar-area-ring-${r.id}-${i}`,order:n(),bounds:o,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.textColor??"#334155"},strokeWidth:p(r.gridWidth,1),opacity:.25}}})}function Ip(e){let t=Qk(e),{centerX:r,centerY:o,innerRadius:n,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=jk;return[...e.chart.series.flatMap((m,f)=>{let h={start:d+f*l,end:d+(f+1)*l},y=Math.max(0,p(m.values[0],0)),x=s>0?Math.min(1,Math.max(0,(y-a)/s)):0,b=Math.max(n+1,n+(i-n)*x),C=m.color??E[f%E.length],S=Jk(e,t,m,h,b,y,C);if(!c)return S;let w={centerX:r,centerY:o,outerRadius:b,innerRadius:n};return[...S,...nR(e,w,h,m,y,C)]}),...rR(e,t)]}function Dp(e){let t=Math.max(9,p(e.fontSize,12));return{nameSize:Math.max(6,p(e.config?.polarNameSize,t)),valueSize:Math.max(6,p(e.config?.polarValueSize,t))}}function oR(e,t,r,o,n){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=Dp(e.chart),l=(a+s)*1.2/2,d=t.outerRadius-t.innerRadius,c=p(o.labelOffsetX,0),u=p(o.labelOffsetY,0),m=c!==0||u!==0,f=d<l*2+6,h=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),y=!f&&h>=tn,x=e.chart.config?.polarOutsideLabels??!1;if(!y&&!m&&!x)return;let b=m||!y,C=Q(t,i,t.outerRadius+Kk),S=b?m?iR(Q(t,i,t.outerRadius),c,u):Q(t,i,t.outerRadius+qk):Q(t,i,t.innerRadius+d*Xk),w=b?x&&e.chart.textColor?e.chart.textColor:Je(F(n,Op),Zk)??Op:Ht(F(n,"#0f172a"),ce(F(n,"#0f172a")));return{point:S,color:w,outside:b,mid:i,tickStart:C}}function nR(e,t,r,o,n,i){let a=oR(e,t,r,o,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:m,mid:f,tickStart:h}=a,{nameSize:y,valueSize:x}=Dp(s),b=Math.max(y,x)*1.2,C=m?Mr(h,c,tn/2,b):h,S={type:"path",id:`chart-polar-area-label-tick-${s.id}-${o.id}`,order:d(),bounds:l,d:`M ${h.x} ${h.y} L ${C.x} ${C.y}`,detail:{of:"chartSeries",series:o.id,mark:"polar-area-label-tick"},style:m?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},w={of:"chartSeries",series:o.id,mark:"polar-area-label",pulled:m||void 0,midAngle:f,wedgeRadius:t.outerRadius},O={bounds:l,x:c.x-tn/2,width:tn,fontFamily:s.fontFamily??B,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},A=s.config?.polarValueFirst??!1,_=y*1.2,G=x*1.2,V=c.y-(_+G)/2,ve=A?V+G:V,le=A?V:V+_,Pe={type:"text",id:`chart-polar-area-label-name-${s.id}-${o.id}`,order:d(),...O,y:ve,height:y*1.2,fontSize:y,lines:[o.label],fontWeight:A?"normal":"bold",detail:w,prop:Ee(o.id)},oe={type:"text",id:`chart-polar-area-label-value-${s.id}-${o.id}`,order:d(),...O,y:le,height:x*1.2,fontSize:x,lines:[Ae(n)],fontWeight:A?"bold":"normal",detail:w,prop:ue(o.id,0),propKind:"value"};return[S,Pe,oe]}function iR(e,t,r){return{x:e.x+t,y:e.y+r}}var aR=["Speed","Quality","Cost","Reliability","Usability"];function sR(e){let{chart:t,plot:r}=e,o=(t.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...t.series.map(i=>i.values.length));return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,radius:zo(r.width,r.height,p(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Yo(o,n),curved:t.chartType==="radial",tension:t.config?.radarTension}}function Gp(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],o=sR(e),n=lR(r,o.count),i=(a,s)=>hm(o,s,a);return{circular:o.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),strokeWidth:Math.max(0,t.config?.radarStrokeWidth??2),tension:o.tension,pointSize:Math.max(0,t.config?.radarPointSize??3),showSpokes:t.config?.radarSpokes??!0,categories:n,centerX:o.centerX,centerY:o.centerY,radius:o.radius,radiusForValue:a=>gm(o,a),pointAt:i,polygonPath:a=>Uo(n.map((s,l)=>i(a,l)),!1)}}function lR(e,t){return Array.from({length:t},(r,o)=>e[o]??aR[o]??`Category ${o+1}`)}function _p(e,t){return e.chart.showGrid===!1?[]:[...dR(e,t),...t.showSpokes?uR(e,t):[]]}function dR(e,t){return U(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>cR(e,t,r))}function cR(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=t.radiusForValue(r),s={fill:{kind:"none"},stroke:{kind:"solid",color:o.gridColor??"#e2e8f0"},strokeWidth:p(o.gridWidth,1)};return t.circular?{type:"ellipse",id:`chart-radial-ring-${o.id}-${r}`,order:i(),bounds:n,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:s}:{type:"path",id:`chart-radar-ring-${o.id}-${r}`,order:i(),bounds:n,d:t.polygonPath(a),style:s}}function uR(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return t.categories.map((i,a)=>{let s=t.pointAt(t.radius,a);return{type:"path",id:`chart-radar-spoke-${r.id}-${a}`,order:n(),bounds:o,d:`M ${t.centerX} ${t.centerY} L ${s.x} ${s.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:p(r.gridWidth,1)}}})}function Fp(e,t){return e.showLabels?t.categories.map((r,o)=>mR(e,t,r,o)):[]}function mR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=t.pointAt(t.radius+10,o),d=l.x-t.centerX,c=Math.max(64,Math.min(120,i.width/3));return L({id:`chart-radar-label-${n.id}-${o}`,order:s(),bounds:a,frame:{x:pR(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:n,align:fR(d)})}function pR(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function fR(e){return e>8?"left":e<-8?"right":"center"}function Hp(e,t){let r=[];return e.chart.series.forEach((o,n)=>{r.push(...hR(e,t,o,n))}),r}function hR(e,t,r,o){let n=r.color??E[o%E.length],i=gR(r,e,t),a=Uo(i,t.circular,t.tension);return[yR(e,t,r,a,n),...t.strokeWidth>0?[bR(e,t,r,a,n)]:[],...t.pointSize>0?xR(e,t,r,i,n):[]]}function gR(e,t,r){let o=e.values;return r.categories.map((n,i)=>r.pointAt(r.radiusForValue(o[i]??t.chart.axisY.min),i))}function yR(e,t,r,o,n){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-fill-${i.id}-${r.id}`,order:l(),bounds:a,d:o,detail:{of:"chartSeries",series:r.id},style:{fill:P(n,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function bR(e,t,r,o,n){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:`chart-radar-series-${i.id}-${r.id}`,order:l(),bounds:a,d:o,detail:{of:"chartSeries",series:r.id},style:{fill:{kind:"none"},stroke:P(n,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:H(i.shadowStyle)}}}function xR(e,t,r,o,n){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return o.map((d,c)=>({type:"ellipse",id:`chart-radar-point-${i.id}-${r.id}-${c}`,order:l(),bounds:a,cx:d.x,cy:d.y,rx:t.pointSize,ry:t.pointSize,detail:{of:"chartValue",series:r.id,valueIndex:c,mark:"radar-vertex"},prop:ue(r.id,c),style:{fill:P(n,s,i.id)}}))}function Pa(e){let t=Gp(e),r=[];return r.push(..._p(e,t)),r.push(...Fp(e,t)),r.push(...Hp(e,t)),r}var SR=-Math.PI/2,CR=14,kR=4,RR=.18,La=1e-4;function nr(e,t,r,o){return{x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function Vp(e,t,r){return`M ${e-r} ${t} A ${r} ${r} 0 1 0 ${e+r} ${t} A ${r} ${r} 0 1 0 ${e-r} ${t} Z`}function wR(e,t,r,o){return`${Vp(e,t,r)} ${Vp(e,t,Math.max(0,o))}`}function Wp(e,t,r,o,n){let i=nr(e,t,r,o),a=nr(e,t,r,n);return`M ${i.x} ${i.y} A ${r} ${r} 0 ${n-o>Math.PI?1:0} 1 ${a.x} ${a.y}`}function vR(e,t){let r=Math.min(e.blur,t*.6),o=t*.4,n=Math.hypot(e.dx,e.dy),i=n>o?o/n:1;return{...e,blur:r,dx:e.dx*i,dy:e.dy*i}}function PR(e,t,r,o,n){if(o>=Math.PI*2-La){let l=nr(e,t,r,n),d=nr(e,t,r,n+Math.PI);return`M ${l.x} ${l.y} A ${r} ${r} 0 1 1 ${d.x} ${d.y} A ${r} ${r} 0 1 1 ${l.x} ${l.y}`}let i=nr(e,t,r,n),a=nr(e,t,r,n+o),s=o>Math.PI?1:0;return`M ${i.x} ${i.y} A ${r} ${r} 0 ${s} 1 ${a.x} ${a.y}`}function LR(e){let{chart:t,plot:r}=e,o=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,outerRadius:Math.max(1,Math.min(r.width,r.height)/2-4),ringThickness:Math.max(1,p(t.config?.ringThickness,CR)),ringGap:Math.max(0,p(t.config?.ringGap,kR)),axisMin:o,range:p(t.axisY.max,100)-o,start:SR+p(t.config?.ringStartAngle,0)*Math.PI/180,total:Math.min(360,Math.max(1,p(t.config?.ringSweep,360)))*Math.PI/180,trackOpacity:Math.min(1,Math.max(0,p(t.config?.ringTrackOpacity,RR))),cap:t.config?.ringCap??"round"}}function MR(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:m}=t,f=H(a.shadowStyle),h=n>=Math.PI*2-La;if(!f||h)return[];let y=vR(f,u),x=Math.min(n,u/o);return[[m,m+x],[m+n-x,m+n]].map(([b,C],S)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${S}`,order:l(),bounds:s,d:Wp(d,c,o,b,C),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:y,clip:{type:"path",d:wR(d,c,o+u/2,o-u/2)}}}))}function TR(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:m,axisMin:f,range:h,start:y,total:x,trackOpacity:b,cap:C}=t,S=c-o*(u+m)-u/2;if(S<=u/2)return[];let w=P(r.color??E[o%E.length],a,n.id),O=Math.max(0,p(r.values[0],0)),A=h>0?Math.min(1,Math.max(0,(O-f)/h)):0,_={fill:{kind:"none"},stroke:w,strokeWidth:u,opacity:b},G=x>=Math.PI*2-La?{type:"ellipse",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:S,ry:S,style:_}:{type:"path",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,d:Wp(l,d,S,y,y+x),style:{..._,lineCap:C}};if(A<=0)return[G];let V=A*x,ve=MR(e,t,r,S,V,w),le={type:"path",id:`chart-radial-bar-ring-${n.id}-${r.id}`,order:s(),bounds:i,d:PR(l,d,S,V,y),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:ue(r.id,0),style:{fill:{kind:"none"},stroke:w,strokeWidth:u,lineCap:C}};return[G,...ve,le]}function zp(e){let t=LR(e);return e.chart.series.flatMap((r,o)=>TR(e,t,r,o))}function Yp(e,t){let r=H(e.chart.shadowStyle),o=!!e.chart.config?.linkGradient,{plot:n}=e,i=r?`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`:void 0;return t.links.map((a,s)=>{let l=$R(e,t,a,s,o);return AR(e,l,r,i,o)})}function $R(e,t,r,o,n){let i={x:t.baseX+r.x0,top:t.baseY+r.sourceY0,bottom:t.baseY+r.sourceY1},a={x:t.baseX+r.x1,top:t.baseY+r.targetY0,bottom:t.baseY+r.targetY1},s=e.chart.config,l=r.color||t.nodeColors.get(r.source)||K,d=t.nodeColors.get(r.target)||K,c=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:l},{offset:100,color:d}]}:{kind:"solid",color:r.color||d};return{linkIndex:o,fromId:r.source,toId:r.target,source:i,target:a,controlX:i.x+(a.x-i.x)*Math.min(1,Math.max(0,p(s?.sankeyLinkCurve,.5))),fill:c,opacity:Math.min(1,Math.max(0,p(s?.sankeyLinkOpacity,r.color?.85:.45)))}}function AR(e,t,r,o,n){let{chart:i,bounds:a,nextOrder:s}=e,l={minX:Math.min(t.source.x,t.target.x),maxX:Math.max(t.source.x,t.target.x),minY:Math.min(t.source.top,t.target.top),maxY:Math.max(t.source.bottom,t.target.bottom)};return{type:"path",id:`chart-sankey-link-${i.id}-${t.linkIndex}`,order:s(),bounds:n?l:a,d:ER(t),detail:{of:"link",fromId:t.fromId,toId:t.toId},style:{fill:t.fill,opacity:t.opacity,shadow:r,clip:o?{type:"path",d:o}:void 0}}}function ER(e){let{source:t,target:r,controlX:o}=e;return[`M ${t.x} ${t.top}`,`C ${o} ${t.top} ${o} ${r.top} ${r.x} ${r.top}`,`L ${r.x} ${r.bottom}`,`C ${o} ${r.bottom} ${o} ${t.bottom} ${t.x} ${t.bottom}`,"Z"].join(" ")}var NR=.3,OR=.78;function Up(e,t){let r=Math.max(0,p(e.chart.config?.barCornerRadius,0)),o=[];return t.nodes.forEach(n=>{o.push(BR(e,t,n,r));let i=e.showLabels?IR(e,t,n):void 0;i&&o.push(i)}),o}function BR(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d={fill:{kind:"solid",color:r.color||K},shadow:H(n.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,m={of:"chartSeries",series:r.id,mark:"sankey-node"};return o>0&&c&&u?{type:"rect",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,rx:o,style:d,detail:m}:o>0&&c?{type:"path",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,d:fr(s,l,r.width,r.height,o),style:d,detail:m}:o>0&&u?{type:"path",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,d:hr(s,l,r.width,r.height,o),style:d,detail:m}:{type:"rect",id:`chart-sankey-node-${n.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,style:d,detail:m}}function IR(e,t,r){let{chart:o}=e,n=o.config?.labelPosition??"outside",i=n==="inside"?GR(e,t,r,o.config?.labelOrientation??"horizontal"):DR(e,t,r);if(!i)return;let a=o.textColor??"#0f172a",s=n==="inside"?ce(r.color):Je(r.color,Go(a)?OR:NR)??a,l=o.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function DR(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=r.column===t.columnCount-1,s=t.baseX+r.x,l=t.baseY+r.y,d=a?s-t.labelGutter+8:s+r.width+6;return{...L({id:`chart-sankey-label-${o.id}-${r.id}`,order:i(),bounds:n,frame:{x:d,y:l,width:t.labelGutter-12,height:Math.max(1,r.height)},text:r.label,chart:o,align:a?"right":"left"}),fontSize:t.labelSize,fontWeight:"bold",verticalAlign:"middle"}}function GR(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d=s+r.width/2,c=l+r.height/2,u=t.labelSize,m=`chart-sankey-label-${n.id}-${r.id}`;if(o==="vertical"){let f=u*1.4,h=Math.max(1,r.height-8);return he(r.label,u,!1)>h?void 0:{...L({id:m,order:a(),bounds:i,frame:{x:d-h/2,y:c-f/2,width:h,height:f},text:r.label,chart:n,align:"center",rotation:-90}),fontSize:u,fontWeight:"bold",verticalAlign:"middle",rotationCenter:{x:d,y:c}}}return{...L({id:m,order:a(),bounds:i,frame:{x:s+4,y:c-u/2-2,width:Math.max(1,r.width-8),height:u+4},text:r.label,chart:n,align:"center"}),fontSize:u,fontWeight:"bold",verticalAlign:"middle"}}function jp(e){let{chart:t,plot:r,showLabels:o}=e,n=o?92:0,i=Math.max(1,r.width-n*2),a=Ra(_R(e),FR(e),i,r.height,{nodeWidth:Math.max(1,p(t.config?.sankeyNodeWidth,18)),nodeGap:Math.max(0,p(t.config?.sankeyNodeGap,8))});return{...a,baseX:r.x+n,baseY:r.y,labelGutter:n,fontSize:Math.max(9,p(t.fontSize,12)),labelSize:Math.max(6,p(t.config?.sankeyLabelSize,Math.max(9,p(t.fontSize,12))-2)),columnCount:Math.max(1,...a.nodes.map(s=>s.column+1)),nodeColors:new Map(a.nodes.map(s=>[s.id,s.color||K]))}}function _R(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function FR(e){let t=[];return e.chart.series.forEach(r=>{!r.source||!r.target||t.push({source:r.source,target:r.target,value:r.values[0]??0,color:r.color?F(r.color,K):void 0})}),t}function Xp(e){let t=jp(e),r=[];return r.push(...Yp(e,t)),r.push(...Up(e,t)),r}var HR=4;function qp(e){let t=[],r=H(e.chart.shadowStyle);return e.chart.series.forEach((o,n)=>{let i=o.color??E[n%E.length];gt(e,ht(e.chart,o)).forEach((s,l)=>{t.push(VR(e,o,s,l,i,r))})}),t}function VR(e,t,r,o,n,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??HR,m=c?.pointStrokeWidth??0;return{type:"ellipse",id:`chart-point-${a.id}-${t.id}-${o}`,order:d(),bounds:s,cx:r.x,cy:r.y,rx:u,ry:u,detail:{of:"chartValue",series:t.id,valueIndex:o},style:{fill:P(n,l,a.id),stroke:m>0?P(c?.pointStrokeColor??n,l,a.id):void 0,strokeWidth:m>0?m:void 0,opacity:c?.pointOpacity,shadow:i}}}function Kp(e){let{chart:t,plot:r,showLegend:o}=e,n=Math.max(9,p(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=o&&i==="bottom"?48:0,s=Math.max(0,p(t.config?.cellGap,0));return{leaves:t.series,bands:kr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Cr,fontSize:n,smallFontSize:Math.max(8,n-1),legendPosition:i,legendHeight:a,gridWidth:Math.max(1,r.width),gridHeight:Math.max(1,r.height-a),cellGap:s,cellRadius:Math.max(0,p(t.config?.barCornerRadius,s)),headerHeight:Math.max(0,p(t.config?.headerHeight,20)),labelSize:Math.max(6,p(t.config?.tileLabelSize,Math.max(8,n-1))),valueSize:Math.max(6,p(t.config?.tileValueSize,Math.max(8,n-1))),labelPadding:Math.max(0,p(t.config?.tileLabelPadding,4))}}function _r(e){return e.values[0]??0}function Ma(e,t){return e.color??Rr(_r(e),t.bands,t.zones)}var qe=10,rn=4,Ta=2,$a=16,Fr=34;function Zp(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?WR(e,t):zR(e,t)}function Aa(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function Qp(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((o,n)=>({offset:Aa(e,e.bands[n+1]??e.bands[e.bands.length-1])*100,color:o.color??K}))}function WR(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e,a=o.x,s=t.gridWidth,l=t.fontSize+2,d=o.y+t.gridHeight+$a,c=de({x:a,y:d,width:s,height:qe}),u=Qp(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:qe,rx:3,zoneGradient:{axis:"y",min:r.axisY.min,max:r.axisY.max},style:{fill:u.length?{kind:"linear-gradient",angle:0,stops:u}:{kind:"solid",color:K},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((h,y)=>{let x=a+Aa(t,h)*s,b={type:"path",id:`chart-treemap-legend-tick-${r.id}-${y}`,order:i(),bounds:n,d:`M ${x} ${d+qe} L ${x} ${d+qe+rn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},C=y===0,S=y===t.bands.length-1,w=C?"left":S?"right":"center",O=C?x:S?x-Fr:x-Fr/2,A=L({id:`chart-treemap-legend-tick-label-${r.id}-${y}`,order:i(),bounds:n,frame:{x:O,y:d+qe+rn+Ta,width:Fr,height:l},text:Ae(h),chart:r,align:w});return[b,A]});return[m,...f]}function zR(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e,a=t.legendPosition,s=o.y,l=t.gridHeight,d=a==="left"?o.x-$a-qe:o.x+t.gridWidth+$a,c=de({x:d,y:s,width:qe,height:l}),u=Qp(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:qe,height:l,rx:3,zoneGradient:{axis:"y",min:r.axisY.min,max:r.axisY.max},style:{fill:u.length?{kind:"linear-gradient",angle:270,stops:u}:{kind:"solid",color:K},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+qe,h=a==="left"?f-rn:f+rn,y=a==="left"?h-Ta-Fr:h+Ta,x=t.bands.flatMap((b,C)=>{let S=s+(1-Aa(t,b))*l,w={type:"path",id:`chart-treemap-legend-tick-${r.id}-${C}`,order:i(),bounds:n,d:`M ${f} ${S} L ${h} ${S}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},O=L({id:`chart-treemap-legend-tick-label-${r.id}-${C}`,order:i(),bounds:n,frame:{x:y,y:S-t.fontSize/2,width:Fr,height:t.fontSize+2},text:Ae(b),chart:r,align:a==="left"?"right":"left"});return[w,O]});return[m,...x]}function Jp(e,t){let{tiles:r,headers:o}=YR(e,t),n=[],i=!!e.chart.config?.tileGradient;return r.forEach((a,s)=>{let l=r[s+1],d=l&&(a.item.leaf.group??"")===(l.item.leaf.group??""),c=i&&d?l:void 0;n.push(...jR(e,t,a,c))}),o.forEach((a,s)=>{n.push(...UR(e,t,a,s))}),n}function YR(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:_r(c)}));return{tiles:Dr(l,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),headers:[]}}let r=[];for(let l of t.leaves){let d=l.group??"";r.includes(d)||r.push(d)}let o=r.map(l=>({key:l,label:l||"Other",value:t.leaves.filter(d=>(d.group??"")===l).reduce((d,c)=>d+_r(c),0)})),n=Dr(o,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),i=t.cellGap,a=[],s=[];return n.forEach(l=>{let d=e.showLabels?Math.min(t.headerHeight,l.height):0;e.showLabels&&s.push({key:l.item.key,label:l.item.label,x:l.x+i/2,y:l.y,width:Math.max(0,l.width-i)});let u=t.leaves.filter(m=>(m.group??"")===l.item.key).map(m=>({leaf:m,value:_r(m)}));a.push(...Dr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function UR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=n.config?.headerColor??n.gridColor??"#e2e8f0",d={type:"rect",id:`chart-treemap-header-${n.id}-${o}`,order:s(),bounds:a,x:i.x+r.x,y:i.y+r.y,width:r.width,height:t.headerHeight,rx:t.cellRadius,style:{fill:{kind:"solid",color:l}}},c=Math.max(8,Math.max(9,n.fontSize??12)-1),u={...L({id:`chart-treemap-header-label-${n.id}-${o}`,order:s(),bounds:a,frame:{x:i.x+r.x,y:i.y+r.y+(t.headerHeight-c)/2,width:r.width,height:c+2},text:r.label,chart:n,align:"center"}),fontSize:c,color:ce(l)};return[d,u]}function jR(e,t,r,o){let n=Ma(r.item.leaf,t),i=o?Ma(o.item.leaf,t):void 0,a=[XR(e,t,r,n,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...qR(e,t,r,n)),a}function XR(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=H(i.shadowStyle),m=u?`M ${a.x} ${a.y} H ${a.x+a.width} V ${a.y+a.height} H ${a.x} Z`:void 0,f=a.x+r.x+c/2,h=a.y+r.y+c/2,y=Math.max(0,r.width-c),x=Math.max(0,r.height-c),b="#94a3b8",C={minX:f,maxX:f+y,minY:h+x/2-y/2,maxY:h+x/2+y/2},S=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:F(o,b)},{offset:100,color:F(n,b)}]}:P(o,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:n?C:s,x:f,y:h,width:y,height:x,rx:t.cellRadius,style:{fill:S,stroke:{kind:"solid",color:i.config?.tileStrokeColor??i.gridColor??"#e2e8f0"},strokeWidth:p(i.config?.tileStrokeWidth,p(i.gridWidth,1)),shadow:u,clip:m?{type:"path",d:m}:void 0}}}function qR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,{leaf:l,value:d}=r.item,c=t.cellGap,u=t.labelPadding,m=Math.max(1,r.width-c-u*2),f=Math.max(1,r.height-c-u*1.5),h=i.x+r.x+c/2+u,y=i.y+r.y+c/2+u*.75,x=n.config?.tileTextColor??ce(F(o,"#ffffff")),b=t.labelSize*1.2,C=Math.max(1,Math.floor(f/b)),S=De(l.label,m,t.labelSize).slice(0,C).map(G=>$o(G,m,t.labelSize,!0)),w={...L({id:`chart-treemap-label-${n.id}-${l.id}`,order:s(),bounds:a,frame:{x:h,y,width:m,height:f},text:l.label,chart:n}),lines:S,fontSize:t.labelSize,fontWeight:"bold",color:x},O=String(d),A=S.length*b+t.valueSize*1.2<=f+2&&he(O,t.valueSize,!1)<=m;if(n.config?.showTileValues===!1||!A)return[w];let _={...L({id:`chart-treemap-value-${n.id}-${l.id}`,order:s(),bounds:a,frame:{x:h,y:y+S.length*b,width:m,height:Math.max(1,f-S.length*b)},text:String(d),chart:n}),lines:[String(d)],fontSize:t.valueSize,color:x};return[w,_]}function ef(e){let t=Kp(e),r=[];return r.push(...Jp(e,t)),r.push(...Zp(e,t)),r}var KR={bar:vm,boxplot:Nm,custom:Im,field:Ym,heatmap:Jm,hexbin:e=>sp(e),line:gp,mekko:wp,pie:e=>Np(e),polarArea:e=>Ip(e),radar:e=>Pa(e),radial:e=>Pa(e),radialBar:e=>zp(e),sankey:Xp,scatter:qp,treemap:ef},ZR=new Set(["radar","radial"]);function Ea(e){return ZR.has(e)}function yt(e){return KR[e.chart.chartType](e)}function tf(e){let{chart:t,context:r,layout:o,nodes:n,renderOrder:i}=e,a=Xo(t,o.plot,o.bounds,i.current());n.push(...a),i.advance(a.length),n.push(...yt(r));let s=xm({chart:t,plot:o.plot,bounds:o.bounds,order:i.current()});return n.push(...s),i.advance(s.length),n.push(...cm(t,o,i.current())),n}function QR(e,t){let r=re(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function JR(e,t){let{outerRadius:r,innerRadius:o,cornerRadius:n}=Vo(t.width,t.height,e.config?.innerRadius,e.config?.pieCornerRadius);return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${o},${n}`}}function ew(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),o=Math.max(0,Math.min(p(e.config?.innerRadius,0),r-1)),n=Math.max(0,p(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${o},${n}`}}function tw(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...e.series.map(c=>c.values.length)),n=Yo(r,o),i=zo(t.width,t.height,p(e.fontSize,12),e.showAxisLabels!==!1),a=t.x+t.width/2,s=t.y+t.height/2,l=e.chartType==="radial"?1:0,d=e.config?.radarTension;return{of:"radarGeometry",radarGeometry:`${a},${s},${i},${e.axisY.min},${e.axisY.max},${n},${l}${d===void 0?"":`,${d}`}`}}function rw(e,t){return e.chartType==="pie"?JR(e,t):e.chartType==="polarArea"?ew(e,t):e.chartType==="radar"||e.chartType==="radial"?tw(e,t):om.has(e.chartType)?QR(e,t):void 0}function rf(e,t,r,o){let n={type:"rect",id:`chart-${e.id}`,order:o,bounds:t,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius??12,style:{fill:P(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:p(e.strokeWidth,1)}},i=rw(e,r);return i&&(n.detail=i),n}function of(e,t,r,o){let n=em({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:o});return r.advance(n.length),n}function nf(e,t,r,o){return{chart:e,plot:t.plot,bounds:t.bounds,diagnostics:o,showLabels:t.showLabels,showLegend:t.showLegend,stackedMode:e.config?.stacked&&e.config.stacked!=="none"?e.config.stacked:void 0,nextOrder:r.next}}var on=class{#e;#o=.01;constructor(t){this.#e=t}next=()=>this.#e+this.#o++;current(){return this.#e+this.#o}advance(t){this.#o+=t}};function af(e,t,r,o){return e.title?[{...L({id:`chart-title-${e.id}`,order:o.next(),bounds:t,frame:{x:r.x,y:e.y+12,width:r.width,height:20},text:e.title,chart:e,align:e.titleAlign??"left"}),...e.titleColor?{color:e.titleColor}:{},fontWeight:e.titleWeight??"bold",fontSize:p(e.titleSize,Math.max(10,p(e.fontSize,12))+2),prop:Xu}]:[]}function sf(e,t,r){let o=2e4+t,n=im(e),i=new on(o),a=[rf(e,n.bounds,n.plot,o)];return a.push(...Sm(e,n.bounds,i)),a.push(...af(e,n.bounds,n.plot,i)),a.push(...of(e,n,i,r)),{chart:e,layout:n,nodes:a,renderOrder:i,context:nf(e,n,i,r)}}function lf(e){return e.nodes.push(...yt(e.context)),e.nodes}function df(e){return e.nodes.push(...yt(e.context)),e.nodes}function cf(e,t,r){if(e.isVisible===!1)return[];let o=sf(e,t,r);return Ea(e.chartType)?lf(o):Xe(e)?tf(o):df(o)}function Na(e,t){return e.flatMap((r,o)=>ee(cf(r,o,t),"chart",r.id,r.chartType,r.title??"Chart"))}function ow(e){let t=e;if(t.rotation){if(t.rotationCenter)return{angle:t.rotation,x:t.rotationCenter.x,y:t.rotationCenter.y};if(t.cx!==void 0&&t.cy!==void 0)return{angle:t.rotation,x:t.cx,y:t.cy};if(t.x!==void 0&&t.y!==void 0&&t.width!==void 0&&t.height!==void 0)return{angle:t.rotation,x:t.x+t.width/2,y:t.y+t.height/2}}}function nw(e){let{x:t,y:r,width:o,height:n}=e,i=Math.max(0,Math.min(e.cornerRadius,o/2,n/2));return i===0?[[t,r],[t+o,r],[t+o,r+n],[t,r+n]]:[[t+o-i,r+i,-90],[t+o-i,r+n-i,0],[t+i,r+n-i,90],[t+i,r+i,180]].flatMap(([s,l,d])=>Array.from({length:9},(c,u)=>{let m=(d+90*u/8)*Math.PI/180;return[s+i*Math.cos(m),l+i*Math.sin(m)]}))}function iw(e,t){if(!t)return{type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius};let r=-t.angle*Math.PI/180,o=Math.cos(r),n=Math.sin(r),i=nw(e).map(([s,l])=>{let d=s-t.x,c=l-t.y;return[t.x+d*o-c*n,t.y+d*n+c*o]}),a=s=>Math.round(s*100)/100;return{type:"path",d:`M${i.map(([s,l])=>`${a(s)} ${a(l)}`).join("L")}Z`}}function uf(e,t){let r=new Map(t.filter(n=>n.clip).map(n=>[n.id,n]));if(r.size===0)return;let o=new Map;for(let n of e){let i=n.identity?.parentFrameId,a=i?r.get(i):void 0;n.identity&&a&&o.set(`${n.identity.role}:${n.identity.id}`,a)}for(let n of e){let i=n.identity?o.get(`${n.identity.role}:${n.identity.id}`):void 0,a=n;if(i&&a.style){let s=iw(i,ow(n));a.style={...a.style,clip:a.style.clip?{...a.style.clip,within:s}:s}}}}function aw(e){let{minX:t,minY:r,maxX:o,maxY:n}=e.bounds,i="style"in e?e.style?.clip:void 0;for(;i;)i.type==="rect"&&(t=Math.max(t,i.x),r=Math.max(r,i.y),o=Math.min(o,i.x+i.width),n=Math.min(n,i.y+i.height)),i=i.within;return t<=o&&r<=n?{minX:t,minY:r,maxX:o,maxY:n}:e.bounds}function sw(e){if(!e.length)return bi;let t=e.map(aw);return{minX:Math.min(...t.map(r=>r.minX)),minY:Math.min(...t.map(r=>r.minY)),maxX:Math.max(...t.map(r=>r.maxX)),maxY:Math.max(...t.map(r=>r.maxY))}}function lw(e){let t=new Map,r=(o,n,i)=>{n.forEach((a,s)=>{t.set(`${o}:${a.id}`,{rank:Qd(a),sequence:Jd(a,i+s)})})};return r("frame",e.frames,0),r("swimlane",e.swimlanes,5e3),r("shape",e.shapes,1e4),r("widget",e.components??e.widgets??[],1e4),r("isometric",e.isometricObjects??[],15e3),r("link",e.links.map(o=>o.link),2e4),r("chart",e.charts??[],2e4),r("path",e.paths??[],3e4),r("dimension",e.dimensions??[],31e3),t}function dw(e,t){let r=lw(t);for(let o of e){let n=o.identity?r.get(`${o.identity.role}:${o.identity.id}`):void 0;o.rank=n?.rank??0,o.sequence=n?.sequence??0}}function Oa(e,t={}){let{measureText:r}=t,o=[...e.diagnostics??[]],n=[...Rc(e),...xu(e.paths??[]),...Na(e.charts??[],o),...bu(e.links,r),..._u(e.shapes,o,r),...ki(e.components??e.widgets??[]),...Ec(e.isometricObjects??[]),...Pc(e.dimensions??[])];return uf(n,e.frames),dw(n,e),n.sort((i,a)=>(i.rank??0)-(a.rank??0)||(i.sequence??0)-(a.sequence??0)||i.order-a.order||(i.id<a.id?-1:i.id>a.id?1:0)),{nodes:n,bounds:sw(n),diagnostics:o}}var M=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),g=e=>Number(e.toFixed(3)).toString(),Ne=e=>`sf-${e.replace(/[^A-Za-z0-9_.:-]/g,"-")}`;var nn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;clip(t){return t.clip?this.define(t.clip):void 0}define(t){let r=JSON.stringify(t),o=this.ids.get(r);if(!o){let n=t.within?this.define(t.within):void 0;o=Ne(`${this.prefix}clip-${this.ids.size}`),this.ids.set(r,o);let i=t.type==="path"?`<path clip-rule="evenodd" d="${M(t.d)}"/>`:`<rect x="${g(t.x)}" y="${g(t.y)}" width="${g(t.width)}" height="${g(t.height)}" rx="${g(t.rx)}"/>`;this.addDefinition(`<clipPath id="${o}"${n?` clip-path="url(#${n})"`:""}>${i}</clipPath>`)}return o}};var an=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;filter(t,r,o){if(t.innerShadow)return this.define(r,t.innerShadow,mw);if(t.shadow){let n=t.shadow.blur*1.5+Math.max(Math.abs(t.shadow.dx),Math.abs(t.shadow.dy));return this.define(r,t.shadow,cw,o&&o>0?Math.max(.5,n/o):.5)}if(t.blur||t.saturate!==void 0){let n=o&&o>0&&t.blur?Math.max(.5,t.blur*1.5/o):.5;return this.define(r,{blur:t.blur??0,saturate:t.saturate??1},uw,n)}}define(t,r,o,n=.5){let i=JSON.stringify(r)+o.name+n,a=this.ids.get(i);return a||(a=Ne(`${this.prefix}shadow-${t}-${this.ids.size}`),this.ids.set(i,a),this.addDefinition(`<filter id="${a}" x="${g(-n*100)}%" y="${g(-n*100)}%" width="${g((1+n*2)*100)}%" height="${g((1+n*2)*100)}%">${o(r)}</filter>`)),a}};function cw(e){return`<feDropShadow dx="${g(e.dx)}" dy="${g(e.dy)}" stdDeviation="${g(e.blur/2)}" flood-color="${M(e.color)}" flood-opacity="${g(e.opacity)}"/>`}function uw(e){let t=e.blur>0?`<feGaussianBlur stdDeviation="${g(e.blur/2)}"/>`:"",r=e.saturate===1?"":`<feColorMatrix type="saturate" values="${g(e.saturate)}"/>`;return t+r}function mw(e){return['<feComponentTransfer in="SourceAlpha" result="sf-inverted-alpha">','<feFuncA type="table" tableValues="1 0"/>',"</feComponentTransfer>",`<feGaussianBlur in="sf-inverted-alpha" stdDeviation="${g(e.blur/2)}" result="sf-blurred"/>`,`<feOffset in="sf-blurred" dx="${g(e.dx)}" dy="${g(e.dy)}" result="sf-offset"/>`,`<feFlood flood-color="${M(e.color)}" flood-opacity="${g(e.opacity)}" result="sf-color"/>`,'<feComposite in="sf-color" in2="sf-offset" operator="in" result="sf-halo"/>','<feComposite in="sf-halo" in2="SourceGraphic" operator="in" result="sf-inset"/>','<feComposite in="sf-inset" in2="SourceGraphic" operator="over"/>'].join("")}function mf(e,t,r,o){return{arrow:`<path d="M ${g(-t)} ${g(-t*.6)} L 0 0 L ${g(-t)} ${g(t*.6)}" fill="none" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round" stroke-linejoin="round"/>`,filled_arrow:`<path d="M ${g(-t)} ${g(-t*.6)} L 0 0 L ${g(-t)} ${g(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${g(o*.5)}" stroke-linejoin="round"/>`,circle:`<circle cx="0" cy="0" r="${g(t*.5)}" fill="white" stroke="${r}" stroke-width="${g(o)}"/>`,filled_circle:`<circle cx="0" cy="0" r="${g(t*.5)}" fill="${r}"/>`,diamond:`<path d="M ${g(-t*.6)} 0 L 0 ${g(-t*.6)} L ${g(t*.6)} 0 L 0 ${g(t*.6)} Z" fill="white" stroke="${r}" stroke-width="${g(o)}"/>`,filled_diamond:`<path d="M ${g(-t*.6)} 0 L 0 ${g(-t*.6)} L ${g(t*.6)} 0 L 0 ${g(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${g(o*.5)}"/>`,bar:`<path d="M 0 ${g(-t*.6)} V ${g(t*.6)}" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`,triangle:`<path d="M ${g(-t)} ${g(-t*.72)} L 0 0 L ${g(-t)} ${g(t*.72)} Z" fill="white" stroke="${r}" stroke-width="${g(o)}" stroke-linejoin="round"/>`,one:`<path d="M 0 ${g(-t*.62)} V ${g(t*.62)} M ${g(-t*.72)} ${g(-t*.62)} V ${g(t*.62)}" stroke="${r}" stroke-width="${g(o)}"/>`,zero_one:`<circle cx="${g(-t*.8)}" cy="0" r="${g(t*.38)}" fill="white" stroke="${r}" stroke-width="${g(o)}"/><path d="M 0 ${g(-t*.62)} V ${g(t*.62)}" stroke="${r}" stroke-width="${g(o)}"/>`,many:`<path d="M ${g(-t)} ${g(-t*.72)} L 0 0 M ${g(-t)} 0 L 0 0 M ${g(-t)} ${g(t*.72)} L 0 0" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`,one_many:`<path d="M ${g(-t)} ${g(-t*.72)} L 0 0 M ${g(-t)} 0 L 0 0 M ${g(-t)} ${g(t*.72)} L 0 0 M ${g(-t*1.45)} ${g(-t*.62)} V ${g(t*.62)}" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`,zero_many:`<circle cx="${g(-t*1.45)}" cy="0" r="${g(t*.38)}" fill="white" stroke="${r}" stroke-width="${g(o)}"/><path d="M ${g(-t)} ${g(-t*.72)} L 0 0 M ${g(-t)} 0 L 0 0 M ${g(-t)} ${g(t*.72)} L 0 0" stroke="${r}" stroke-width="${g(o)}" stroke-linecap="round"/>`}[e]}function pw(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function fw(e,t){return`id="${e}" markerWidth="${g(t*2)}" markerHeight="${g(t*2)}" viewBox="${g(-t)} ${g(-t)} ${g(t*2)} ${g(t*2)}" refX="0" refY="0" orient="auto-start-reverse" markerUnits="userSpaceOnUse" overflow="visible"`}var sn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;marker(t,r,o){if(!t||t==="none")return;let n=`${t}:${r}:${o}`,i=this.ids.get(n);if(i)return i;i=Ne(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(n,i);let a=12+(o-2)*3,s=pw(t,a,o),l=fw(i,s);return this.addDefinition(`<marker ${l}>${mf(t,a,M(r),o)}</marker>`),i}};function hw(e,t){let r=t.points.map((i,a)=>Ne(`${e}-point-${a}`)),o=t.points.map((i,a)=>{let s=Math.max(0,Math.min(100,i.x)),l=Math.max(0,Math.min(100,i.y));return`<radialGradient id="${r[a]}" gradientUnits="objectBoundingBox" cx="${g(s)}%" cy="${g(l)}%" r="75%"><stop offset="0%" stop-color="${M(i.color)}" stop-opacity="1"/><stop offset="100%" stop-color="${M(i.color)}" stop-opacity="0"/></radialGradient>`}).join(""),n=t.points.map((i,a)=>`<rect width="1" height="1" fill="url(#${r[a]})"/>`).join("");return`${o}<pattern id="${e}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><rect width="1" height="1" fill="${M(t.points[0]?.color??"transparent")}"/>${n}</pattern>`}function gw(e,t,r){let o=t.angle*Math.PI/180,n=(r.minX+r.maxX)/2,i=(r.minY+r.maxY)/2,a=Math.max(r.maxX-r.minX,r.maxY-r.minY)/2,s=Math.cos(o)*a,l=Math.sin(o)*a,d=t.stops.map(c=>`<stop offset="${g(Math.max(0,Math.min(100,c.offset)))}%" stop-color="${M(c.color)}"/>`).join("");return`<linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${g(n-s)}" y1="${g(i-l)}" x2="${g(n+s)}" y2="${g(i+l)}">${d}</linearGradient>`}var ln=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;paint(t,r,o){if(!t||t.kind==="none")return"none";if(t.kind==="solid")return t.color;let n=JSON.stringify(t)+JSON.stringify(o),i=this.ids.get(n);if(!i){i=Ne(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(n,i);let a=t.kind==="mesh-gradient"?hw(i,t):gw(i,t,o);this.addDefinition(a)}return`url(#${i})`}};var dn=class{constructor(t){this.prefix=t;let r=o=>{this.entries.push(o)};this.paints=new ln(r,t),this.filters=new an(r,t),this.markers=new sn(r,t),this.clips=new nn(r,t)}prefix;entries=[];paints;filters;markers;clips;elementId(t){return Ne(`${this.prefix}${t}`)}paint(t,r,o){return this.paints.paint(t,r,o)}filter(t,r,o){return this.filters.filter(t,r,o)}marker(t,r,o){return this.markers.marker(t,r,o)}clip(t){return this.clips.clip(t)}};function yw(e,t){return{type:"path",id:`link-hit-${t}`,order:e.order,rank:e.rank,sequence:e.sequence,bounds:e.bounds,d:e.d,identity:{role:"link",id:t},style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#000000"},strokeWidth:16,opacity:0,pointerEvents:"stroke"}}}function pf(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,yw(t,t.identity.id)]:[t])}function ff(e,t){let r=e.stroke;return r?.kind==="solid"?r.color:r?.kind==="linear-gradient"&&r.stops.length?(t==="start"?r.stops.reduce((n,i)=>n.offset<=i.offset?n:i):r.stops.reduce((n,i)=>n.offset>=i.offset?n:i)).color:r?.kind==="mesh-gradient"&&r.points.length?r.points[0].color:"#64748b"}function hf(e,t){let r=t.paint(e.style.stroke,`${e.id}-stroke`,e.bounds),o=t.paint(e.style.fill,`${e.id}-fill`,e.bounds),n=[`fill="${M(o)}"`,`stroke="${M(r)}"`];return bw(n,e.style),gf(n,e,t),Sw(n,e,t),n.join(" ")}function bw(e,t){t.strokeWidth!==void 0&&e.push(`stroke-width="${g(t.strokeWidth)}"`),t.dash?.length&&e.push(`stroke-dasharray="${t.dash.map(g).join(" ")}"`),t.lineCap&&e.push(`stroke-linecap="${t.lineCap}"`),t.lineJoin&&e.push(`stroke-linejoin="${t.lineJoin}"`),t.opacity!==void 0&&e.push(`opacity="${g(t.opacity)}"`),t.pointerEvents&&e.push(`pointer-events="${t.pointerEvents}"`);let r=[];if(t.transition&&t.transition>0){let o=`${g(t.transition)}ms ease`;r.push(`transition: x ${o}, y ${o}, width ${o}, height ${o}, cx ${o}, cy ${o}, rx ${o}, ry ${o}, fill ${o}, stroke ${o}, stroke-width ${o}, stroke-dasharray ${o}, opacity ${o}`)}t.blend&&r.push(`mix-blend-mode: ${M(t.blend)}`),r.length>0&&e.push(`style="${r.join("; ")}"`)}function xw(e){let t=e;if(t.type==="ellipse"&&t.rx!==void 0&&t.ry!==void 0)return Math.min(t.rx,t.ry)*2;if(t.type==="rect"&&t.width!==void 0&&t.height!==void 0)return Math.min(t.width,t.height)}function gf(e,t,r){let o=r.filter(t.style,t.id,xw(t));o&&e.push(`filter="url(#${o})"`);let n=r.clip(t.style);n&&e.push(`clip-path="url(#${n})"`)}function Sw(e,t,r){if(t.type!=="path")return;let o=r.marker(t.markerStart,ff(t.style,"start"),t.style.strokeWidth??1),n=r.marker(t.markerEnd,ff(t.style,"end"),t.style.strokeWidth??1);o&&e.push(`marker-start="url(#${o})"`),n&&e.push(`marker-end="url(#${n})"`)}function rt(e,t){return e&&t?` transform="rotate(${g(e)} ${g(t.x)} ${g(t.y)})"`:""}function yf(e,t){let r=[];return e.style.opacity!==void 0&&r.push(`opacity="${g(e.style.opacity)}"`),e.style.pointerEvents&&r.push(`pointer-events="${e.style.pointerEvents}"`),gf(r,e,t),r.join(" ")}var bf="data-sf-symbol-points",xf="data-sf-symbol-tension",cn="data-sf-symbol-bounds",Hr="data-sf-corner-radius",Sf="data-sf-square-corner",un="data-sf-path-points",mn="data-sf-path-tension",pn="data-sf-path-closed",Cf="data-sf-path-point",fn="data-sf-isometric-size",hn="data-sf-isometric-label-offset";function Cw(e){return e.role==="shape"?"entity":e.role}function kw(e){return[`role="${M(e.role)}"`,e.checked===void 0?void 0:`aria-checked="${e.checked}"`,e.pressed===void 0?void 0:`aria-pressed="${e.pressed}"`,e.disabled?'aria-disabled="true"':void 0]}function Rw(e){return[`data-sf-role="${Cw(e)}"`,`data-sf-id="${M(e.id)}"`,e.kind?`data-sf-kind="${M(e.kind)}"`:void 0,e.primary?'data-sf-primary="true"':void 0,e.parentFrameId?`data-sf-parent-frame="${M(e.parentFrameId)}"`:void 0,...e.aria?kw(e.aria):[]]}function ww(e){switch(e.of){case"chartValue":return vw(e);case"chartScale":return Mw(e);case"chartSeries":return Tw(e);case"pieGeometry":return Pw(e);case"radarGeometry":return Lw(e);case"link":return Ow(e);case"frameBoundary":return $w(e);case"symbolGeometry":return Aw(e);case"declaredBounds":return[Ba(e.bounds)];case"pathGeometry":return Ew(e);case"isometricGeometry":return Nw(e)}}function vw(e){return[`data-sf-series="${M(e.series)}"`,`data-sf-value-index="${e.valueIndex}"`,e.mark?`data-sf-mark="${e.mark}"`:void 0,e.radius!==void 0?`data-sf-bar-radius="${g(e.radius)}"`:void 0,e.colorProp?`data-sf-color-prop="${M(e.colorProp)}"`:void 0,e.hasColorOverride?'data-sf-color-override="true"':void 0,e.pieStart!==void 0?`data-sf-pie-start="${g(e.pieStart)}"`:void 0,e.pieEnd!==void 0?`data-sf-pie-end="${g(e.pieEnd)}"`:void 0,e.pieValue!==void 0?`data-sf-pie-value="${g(e.pieValue)}"`:void 0]}function Pw(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function Lw(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function Mw(e){return[`data-sf-value-scale="${e.valueScale}"`]}function Tw(e){return[`data-sf-series="${M(e.series)}"`,e.lineTension!==void 0?`data-sf-line-tension="${g(e.lineTension)}"`:void 0,e.mark?`data-sf-mark="${M(e.mark)}"`:void 0,e.pulled?'data-sf-label-pulled="true"':void 0,e.midAngle!==void 0?`data-sf-pie-mid-angle="${g(e.midAngle)}"`:void 0,e.wedgeRadius!==void 0?`data-sf-pie-wedge-radius="${g(e.wedgeRadius)}"`:void 0]}function $w(e){return[`${Hr}="${g(e.cornerRadius)}"`,`${Sf}="${e.squareCorner}"`]}function Ba(e){return`${cn}="${g(e.x)},${g(e.y)},${g(e.width)},${g(e.height)}"`}function Aw(e){return[`${bf}="${M(JSON.stringify(e.points))}"`,`${xf}="${g(e.tension)}"`,Ba(e.declaredBounds)]}function Ew(e){return[`${un}="${M(JSON.stringify(e.points))}"`,`${mn}="${g(e.tension)}"`,`${pn}="${e.closed}"`]}function Nw(e){return[`${fn}="${g(e.width)},${g(e.height)},${g(e.depth)}"`,`${Hr}="${g(e.cornerRadius)}"`,Ba(e.bounds),`${hn}="${g(e.labelOffsetX)},${g(e.labelOffsetY)}"`]}function Ow(e){return[e.fromId?`data-sf-from="${M(e.fromId)}"`:void 0,e.toId?`data-sf-to="${M(e.toId)}"`:void 0,e.route?`data-sf-route="${e.route}"`:void 0,e.fromSide?`data-sf-from-side="${e.fromSide}"`:void 0,e.toSide?`data-sf-to-side="${e.toSide}"`:void 0,e.segments?`data-sf-link-segments="${M(JSON.stringify(e.segments))}"`:void 0,e.fromFace?`data-sf-from-face="${e.fromFace}"`:void 0,e.toFace?`data-sf-to-face="${e.toFace}"`:void 0,e.labelGap?'data-sf-label-gap="true"':void 0]}function bt(e){let t=e.identity?.label,r=[...e.identity?Rw(e.identity):[],...e.detail?ww(e.detail):[],e.prop?`data-sf-prop="${M(e.prop)}"`:void 0,e.propKind?`data-sf-prop-kind="${e.propKind}"`:void 0,e.propSolidOnly?'data-sf-prop-solid-only="true"':void 0,e.mark?`data-sf-mark="${M(e.mark)}"`:void 0,e.zoneGradient?'data-sf-zone-gradient="true"':void 0,e.zoneGradient?`data-sf-zone-axis-min="${g(e.zoneGradient.min)}"`:void 0,e.zoneGradient?`data-sf-zone-axis-max="${g(e.zoneGradient.max)}"`:void 0,t?`tabindex="0" aria-label="${M(t.replace(/\s+/g," ").trim())}"`:void 0].filter(o=>o!==void 0);return r.length?` ${r.join(" ")}`:""}function Bw(e,t,r,o){if(!e.length)return`<tspan x="${g(t)}"${r} font-size="${o}"></tspan>`;let n=[];for(let i of e){let a=n[n.length-1];a&&a.bold===i.bold?a.text+=` ${i.text}`:(a&&(a.text+=" "),n.push({text:i.text,bold:i.bold}))}return n.map((i,a)=>`<tspan${a===0?` x="${g(t)}"${r}`:""} font-size="${o}" font-weight="${i.bold?"bold":"normal"}">${M(i.text)}</tspan>`).join("")}function kf(e,t){let r=Iw(e),o=`${g(e.fontSize)}px`,n=Gw(e,r,o),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${bt(e)} x="${g(r.x)}" y="${g(r.firstY)}" font-family="${M(e.fontFamily)}" font-size="${o}" font-weight="${e.fontWeight}"${e.letterSpacing?` letter-spacing="${g(e.letterSpacing)}"`:""} fill="${M(e.color)}" text-anchor="${r.anchor}" data-sf-valign="${e.verticalAlign}" data-sf-line-height="${g(e.lineHeight)}"${i}${rt(e.rotation,e.rotationCenter)}>${n}</text>`}function Iw(e){let t=e.fontSize*e.lineHeight,o=(e.richLines?e.richLines.length:e.lines.length)*t,n=e.align==="left"?e.x:e.align==="right"?e.x+e.width:e.x+e.width/2,i=e.align==="left"?"start":e.align==="right"?"end":"middle";return{x:n,firstY:Dw(e,o),linePx:t,anchor:i}}function Dw(e,t){return e.verticalAlign==="top"?e.y+e.fontSize:e.verticalAlign==="bottom"?e.y+e.height-t+e.fontSize:e.y+(e.height-t)/2+e.fontSize}function Gw(e,t,r){return e.richLines?e.richLines.map((o,n)=>Bw(o,t.x,Rf(n,t.linePx),r)).join(""):e.lines.map((o,n)=>_w(o,n,t,r)).join("")}function _w(e,t,r,o){return`<tspan x="${g(r.x)}" font-size="${o}"${Rf(t,r.linePx)}>${M(e)}</tspan>`}function Rf(e,t){return e?` dy="${g(t)}px"`:""}function Fw(e,t){let r=rt(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),o=M(JSON.stringify(e.shader.parameters)),n=e.shader.surfacePadding??0,i=e.fillColor?` data-sf-shader-fill="${M(e.fillColor)}"`:"";return`<foreignObject id="${t.elementId(e.id)}"${bt(e)} data-sf-shader="${M(e.shader.program)}" data-sf-shader-name="${M(e.shader.name)}" data-sf-shader-params="${o}" data-sf-shader-mask="${e.mask}" data-sf-shader-padding="${g(n)}"${i} x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}"${r} pointer-events="${e.shader.program==="ruler"||e.identity?.role==="widget"?"all":"none"}"><canvas xmlns="http://www.w3.org/1999/xhtml" data-sf-shader-canvas="true" style="display:block;width:100%;height:100%;pointer-events:none"></canvas></foreignObject>`}function Hw(e,t){let r=t.componentStyle;return r.variant==="plain"?`<span xmlns="http://www.w3.org/1999/xhtml" data-sf-rolling-digit="true" style="position:relative;display:inline-block;width:.62em;height:1.1em;overflow:hidden"><span data-sf-rolling-current="true" style="position:absolute;inset:0;display:grid;place-items:center;color:${M(r.color)};font-weight:${M(r.fontWeight)};line-height:1">${M(e)}</span></span>`:`<span xmlns="http://www.w3.org/1999/xhtml" data-sf-rolling-digit="true" style="position:relative;display:inline-block;width:.72em;height:1.2em;overflow:hidden;border:1px solid ${M(r.divider)};border-radius:.09em;background:${M(r.surface)};box-shadow:inset 0 1px 0 rgba(255,255,255,.7),inset 0 -.16em .38em rgba(0,0,0,.12)"><span data-sf-rolling-current="true" style="position:absolute;inset:0;display:grid;place-items:center;color:${M(r.color)};font-weight:300;line-height:1">${M(e)}</span><span style="position:absolute;z-index:2;left:0;right:0;top:50%;height:1px;background:${M(r.divider)};pointer-events:none"></span></span>`}function Vw(e,t){let r=rt(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),o=e.componentStyle.fontSize>0?e.componentStyle.fontSize:Math.max(1,Math.min(e.width,e.height)*.28),n=e.label?`<span xmlns="http://www.w3.org/1999/xhtml" style="margin-bottom:.14em;color:${M(e.componentStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${M(e.label)}</span>`:"",i=[...e.value].map(s=>Hw(s,e)).join(""),a=M(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${bt(e)} data-sf-widget="rollingNumber" data-sf-widget-value="${M(e.value)}" data-sf-widget-digits="${e.digits??""}" data-sf-widget-duration="${g(e.duration)}" data-sf-widget-style="${a}" x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}"${r}><div xmlns="http://www.w3.org/1999/xhtml" style="width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:${M(e.componentStyle.fontFamily)};font-size:${g(o)}px">${n}<div data-sf-rolling-digits="true" aria-label="${M(e.value)}" style="display:flex;gap:${e.componentStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function wf(e,t){if(e.type==="text")return kf(e,t);if(e.type==="shader-surface")return Fw(e,t);if(e.type==="rolling-number")return Vw(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${bt(e)} ${yf(e,t)} href="${M(e.href)}" x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}" preserveAspectRatio="xMidYMid slice"/>`;let r=`id="${t.elementId(e.id)}"${bt(e)} ${hf(e,t)}`;return e.type==="rect"?`<rect ${r} x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}"${e.rx?` rx="${g(e.rx)}"`:""}${rt(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2})}/>`:e.type==="ellipse"?`<ellipse ${r} cx="${g(e.cx)}" cy="${g(e.cy)}" rx="${g(e.rx)}" ry="${g(e.ry)}"${rt(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${M(e.d)}"${rt(e.rotation,e.rotationCenter)}/>`}function vf(e,t={}){let r=t.padding??16,o=Math.max(1,e.bounds.maxX-e.bounds.minX+r*2),n=Math.max(1,e.bounds.maxY-e.bounds.minY+r*2),i=`${g(e.bounds.minX-r)} ${g(e.bounds.minY-r)} ${g(o)} ${g(n)}`,a=new dn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?pf(e.nodes):e.nodes).map(u=>wf(u,a)).join(`
14
14
  `);return{svg:`${t.includeXmlDeclaration===!1?"":`<?xml version="1.0" encoding="UTF-8"?>
15
15
  `}<svg xmlns="http://www.w3.org/2000/svg" width="${g(o)}px" height="${g(n)}px" viewBox="${i}" role="img" data-sf-contract="${1}">
16
16
  <defs>${a.entries.join("")}</defs>
17
17
  ${l}
18
- </svg>`,width:o,height:n,diagnostics:e.diagnostics}}function gn(e,t={}){return wf(e,t)}function Fw(e,t={}){let r=Oa(e,{measureText:t.measureText}),{svg:o,width:n,height:i,diagnostics:a}=gn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var Hw=50,ot=new Map,vf=Kr();function Vw(e){let t=Kr();t!==vf&&(ot.clear(),vf=t);let r=ot.get(e);if(r)return ot.delete(e),ot.set(e,r),r;let o=Oa(yi(e));if(ot.set(e,o),ot.size>Hw){let n=ot.keys().next().value;n!==void 0&&ot.delete(n)}return o}function yn(e,t={}){if(t.measureText)return Fw(yi(e),t);let r=Vw(e),{svg:o,width:n,height:i,diagnostics:a}=gn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var Ia="http://www.w3.org/1999/xhtml",bn=(e,t)=>{Object.assign(e.style,t)};function xn(e,t,r){let o=e.createElementNS(Ia,"span");return o.setAttribute("data-sf-rolling-current","true"),o.textContent=t,bn(o,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),o}function Ww(e,t,r){let o=e.createElementNS(Ia,"span");if(o.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return bn(o,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),o.appendChild(xn(e,t,r)),o;bn(o,{position:"relative",display:"inline-block",width:"0.72em",height:"1.2em",overflow:"hidden",border:`1px solid ${r.divider}`,borderRadius:"0.09em",background:r.surface,boxShadow:"inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -0.16em 0.38em rgba(0,0,0,0.12)"}),o.appendChild(xn(e,t,r));let n=e.createElementNS(Ia,"span");return bn(n,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),o.appendChild(n),o}function Sn(e,t,r){return r===0||typeof e.animate!="function"?null:e.animate(t,{duration:r,easing:"cubic-bezier(0.22, 1, 0.36, 1)",fill:"forwards"})}function zw(e,t,r,o){let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=xn(e.ownerDocument,t,r);i.style.opacity="0",e.insertBefore(i,e.lastElementChild??null);let a={opacity:0,filter:"blur(0.025em)",transform:"scale(0.985)"},s={opacity:1,filter:"blur(0)",transform:"scale(1)"},l=Sn(i,[a,s],o),d=n?Sn(n,[s,a],o):null,c=()=>{n?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function Yw(e,t,r,o){if(r.motion==="fade"){zw(e,t,r,o);return}let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=xn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Sn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],o),s=n?Sn(n,[{transform:"translateY(0)",opacity:1},{transform:"translateY(-100%)",opacity:.25}],o):null,l=()=>{n?.remove(),i.style.transform="translateY(0)",i.style.opacity="1"};a?a.finished.then(l,l):(s?.cancel(),l())}function Pf(e,t,r,o,n){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>Ww(e.ownerDocument,a,o))),e.setAttribute("aria-label",r);return}let i=[...e.querySelectorAll("[data-sf-rolling-digit]")];[...r].forEach((a,s)=>{t[s]!==a&&Yw(i[s],a,o,n)}),e.setAttribute("aria-label",r)}function Da(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var Uw=140;function jw(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Lf(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return J;try{return{...J,...JSON.parse(t)}}catch{return J}}function Xw(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function qw(e){let t=Number(e.getAttribute("data-sf-widget-duration"));return!Number.isFinite(t)||t<0?420:e.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches?0:t}function Cn(e,t,r){let o=jw(e);if(!o)return!1;let n=e.getAttribute("data-sf-widget-value")??"",i=sr(t,Xw(e.getAttribute("data-sf-widget-digits")));return n===i||(Pf(o,n,i,Lf(e),r?qw(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function Ga(e){let t=new Map,r=new Map,o=new Map;return{setValue(n,i){let a=Da(e,n);if(!a)return!1;if(t.set(n,i),Lf(a).motion!=="fade")return Cn(a,i,!0);let s=Date.now(),l=(r.get(n)??0)+Uw-s;return l<=0?(r.set(n,s),Cn(a,i,!0)):(o.has(n)||o.set(n,setTimeout(()=>{o.delete(n),r.set(n,Date.now());let d=Da(e,n),c=t.get(n);d&&c!==void 0&&Cn(d,c,!0)},l)),!0)},refresh(){for(let[n,i]of t){let a=Da(e,n);a&&Cn(a,i,!1)}},clearValues(){for(let n of o.values())clearTimeout(n);o.clear(),t.clear()},destroy(){for(let n of o.values())clearTimeout(n);o.clear(),t.clear()}}}var Mf=new WeakMap,Tf=new WeakMap,$f=new WeakMap;function Ha(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Af(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function _a(e,t){return Number(e)>0?Number(e):t}function Ef(e,t){let r=Af(e),o=Number(r.min)||0,n=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return Ha(n===o?0:(t-o)/(n-o))}function Fa(e,t,r){let o=e.getAttribute("transform")??"",n=o===Tf.get(e)?Mf.get(e)??"":o;Mf.set(e,n);let i=`translate(${t} ${r}) ${n}`.trim();Tf.set(e,i),e.setAttribute("transform",i)}function Nf(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}var Kw=[255,255,255];function Zw(e,t,r){let o=$f.get(e)??e.getAttribute("fill")??"";$f.set(e,o);let n=Nf(o);if(!n)return;let i=n.map((s,l)=>Math.round(s+(r[l]-s)*t)),a=`rgb(${i[0]}, ${i[1]}, ${i[2]})`;e.style.fill=a;for(let s of e.querySelectorAll("tspan"))s.style.fill=a}function Of(e,t){let r=new Map;for(let o of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let n=Af(o),i=(typeof n.peak=="string"?Nf(n.peak):null)??Kw,a=o.getAttribute("data-sf-id")??"",s=Number(o.getAttribute("x")),l=Number(o.getAttribute("y")),d=Number(o.getAttribute("width")),c=Number(o.getAttribute("height")),u=n.axis==="horizontal",m=Ha(t(a)??Number(n.progress)),f=_a(n.inset,.05),h=_a(n.line,.7),y=u?d:c,x=u?c:d,b=f+(1-2*f)*m,C=n.dent===void 0?1:Number(n.dent),S=(C<0?1:C)*.16*x,w=typeof n.knob=="string"?n.knob:"";if(w){let le=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(w)}"]`)],Pe=le.find(oe=>oe.hasAttribute("data-sf-primary"));if(Pe?.getBBox){Fa(Pe,0,0);let oe=Pe.getBBox(),Ke=(u?oe.height:oe.width)/2;r.set(a,Ke/x);let Xr=(n.gap===void 0?.04:Number(n.gap))*x,Rs=h*x-S+Ke+Xr,ws=u?{x:s+d*b,y:l+Rs}:{x:s+Rs,y:l+c*(1-b)},Zh=ws.x-(oe.x+oe.width/2),Qh=ws.y-(oe.y+oe.height/2);for(let Jh of le)Fa(Jh,Zh,Qh)}}let O=Number(n.min)||0,A=Number.isFinite(Number(n.max))&&n.max!==void 0?Number(n.max):100,_=_a(n.spread,.07)*y,G=f*y,V=(1-2*f)*y,ve=G+V*m;for(let le of e.querySelectorAll(`text[data-sf-id="${CSS.escape(a)}"]`)){let Pe=Number(le.textContent);if(!Number.isFinite(Pe)||A===O)continue;let oe=G+V*Ha((Pe-O)/(A-O)),Ke=Math.exp(-(((oe-ve)/_)**2)),Xr=S*.4*Ke;Fa(le,u?0:-Xr,u?-Xr:0),Zw(le,Ke,i)}}return r}var Bf=new Set(["viewbox","width","height"]);function If(e,t){for(let r of Array.from(e.attributes))Bf.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))Bf.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function Df(e,t,r){let o=[],n=[],i=[];for(let a of r){let s=e.has(a),l=t.has(a);l&&!s?o.push(a):s&&!l?n.push(a):s&&l&&i.push(a)}return{added:o,removed:n,changed:i}}function Gf(e,t){let r=e.querySelector(":scope > defs"),o=t.querySelector(":scope > defs");return o?(r?r.replaceWith(o):e.insertBefore(o,e.firstChild),o):(r?.remove(),r)}function Qw(e,t){let r=!1;for(let o of Array.from(e.attributes))t.hasAttribute(o.name)||(e.removeAttribute(o.name),r=!0);for(let o of Array.from(t.attributes))e.getAttribute(o.name)!==o.value&&(e.setAttribute(o.name,o.value),r=!0);return r}function Ff(e,t){let r=Array.from(e.childNodes),o=Array.from(t.childNodes);if(r.length!==o.length)return!1;for(let n=0;n<r.length;n++){let i=r[n],a=o[n];if(i.nodeType!==a.nodeType)return!1;if(i.nodeType===Node.TEXT_NODE){if(i.textContent!==a.textContent)return!1;continue}if(i.nodeType!==Node.ELEMENT_NODE)continue;let s=i,l=a;if(s.tagName!==l.tagName||s.attributes.length!==l.attributes.length)return!1;for(let d of Array.from(s.attributes))if(l.getAttribute(d.name)!==d.value)return!1;if(!Ff(s,l))return!1}return!0}function _f(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function Hf(e,t){let r=t.hasAttribute("data-sf-widget")&&(e.getAttribute("data-sf-widget-style")!==t.getAttribute("data-sf-widget-style")||e.getAttribute("data-sf-widget-value")!==t.getAttribute("data-sf-widget-value")),o=Qw(e,t),n=!1;return r&&(n=!0,_f(e,t)),t.tagName.toLowerCase()==="text"&&!Ff(e,t)&&(n=!0,_f(e,t)),o||n}function Vr(e){return e.getAttribute("data-sf-id")??e.id}function Jw(e){let t=new Map;for(let r of e.querySelectorAll(":scope > [id]"))t.set(r.id,r);return t}function ev(e,t,r){return e&&e.tagName===t.tagName?(Hf(e,t)&&r(Vr(t)),e):(e?.remove(),r(Vr(t)),t)}function tv(e,t,r){let o=r?r.nextSibling:e.firstChild;o!==t&&e.insertBefore(t,o)}function Vf(e,t){let r=Gf(e,t),o=Jw(e),n=new Set,i=new Set;for(let c of o.values())i.add(Vr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let c of t.querySelectorAll(":scope > [id]")){n.add(c.id),a.add(Vr(c));let u=ev(o.get(c.id),c,l);tv(e,u,d),d=u}for(let[c,u]of o)n.has(c)||(s.add(Vr(u)),u.remove());return Df(i,a,s)}function Wf(e,t){return If(e,t),Vf(e,t)}function Va(e){let r=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(r.nodeName.toLowerCase()!=="svg")throw new Error("viewer: source did not parse to an <svg> root");return r}function Wr(e){let t=(e.getAttribute("viewBox")??"0 0 100 100").split(/\s+/).map(Number);return{x:t[0],y:t[1],w:t[2],h:t[3]}}var kn=class{#e;#o;#t;constructor(t,r){this.#e=t,this.#o=r,this.#t={...r}}apply(){this.#e.setAttribute("viewBox",`${this.#t.x} ${this.#t.y} ${this.#t.w} ${this.#t.h}`)}fit(){this.#t={...this.#o},this.apply()}get(){return{...this.#t}}setNatural(t){this.#o=t}#r(t,r){let o=this.#e.getScreenCTM();if(!o)return null;let n=new DOMPoint(t,r).matrixTransform(o.inverse());return{x:n.x,y:n.y}}zoomBy(t,r,o){let n=this.#e.getBoundingClientRect();if(n.width<=0||n.height<=0)return;let i=r??n.left+n.width/2,a=o??n.top+n.height/2,s=this.#r(i,a);this.#t={...this.#t,w:this.#t.w/t,h:this.#t.h/t},this.apply();let l=s?this.#r(i,a):null;s&&l&&(this.#t.x+=s.x-l.x,this.#t.y+=s.y-l.y),this.apply()}panBy(t,r){let o=this.#e.getScreenCTM()?.a,n=o&&o>0?o:1;this.#t.x-=t/n,this.#t.y-=r/n,this.apply()}};function zf(e,t){let r=Va(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let o=new kn(r,Wr(r));return e.appendChild(r),o.apply(),{svg:r,fit:()=>o.fit(),getViewport:()=>o.get(),zoomBy:(n,i,a)=>o.zoomBy(n,i,a),panBy:(n,i)=>o.panBy(n,i),updateContent(n){let i=Va(n),a=Wf(r,i);return o.setNatural(Wr(i)),a},destroy(){r.remove()}}}var Rn=class{handlers=new Map;on(t,r){let o=this.handlers.get(t)??new Set;this.handlers.set(t,o);let n=r;return o.add(n),()=>o.delete(n)}emit(t,r){let o=this.handlers.get(t);if(o!==void 0)for(let n of[...o])try{n(r)}catch(i){queueMicrotask(()=>{throw i})}}clear(){this.handlers.clear()}};var wn=class extends Rn{};function rv(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function ov(e,t){return new Promise((r,o)=>{let n=e.defaultView?.Image;if(!n){o(new Error("viewer export: Image is unavailable in this environment."));return}let i=new n;i.onload=()=>r(i),i.onerror=()=>o(new Error("viewer export: the SVG snapshot could not be decoded.")),i.src=t})}function nv(e,t,r){return new Promise((o,n)=>{e.toBlob(i=>{i?o(i):n(new Error(`viewer export: ${t} encoding failed.`))},t,r)})}async function Wa(e,t,r={}){let o=Wr(e),n=rv(r.scale,1),i=Math.max(1,Math.round(o.w*n)),a=Math.max(1,Math.round(o.h*n)),s=e.ownerDocument.createElement("canvas");s.width=i,s.height=a;let l=s.getContext("2d");if(!l)throw new Error("viewer export: a 2D canvas context is unavailable.");let d=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(d);try{let u=await ov(e.ownerDocument,c),m=r.backgroundColor??(r.format==="jpeg"?"#ffffff":void 0);m&&(l.fillStyle=m,l.fillRect(0,0,i,a)),l.drawImage(u,0,0,i,a);let f=r.format==="jpeg"?"image/jpeg":"image/png";return await nv(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var za="http://www.w3.org/2000/svg";function iv(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function av(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function zr(e,t,r){let o=e.createElementNS(za,t);for(let[n,i]of Object.entries(r))o.setAttribute(n,String(i));return o}function sv(e){try{return{...J,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return J}}function lv(e,t,r=0){let o=r>0?r:Math.max(1,Math.min(e.width,e.height)*.28);return{size:o,plain:t,cellWidth:t?o*.62:o*.72+2,cellHeight:t?o*1.1:o*1.2+2,gap:o*(t?.02:.1)}}function dv(e,t,r){let o=zr(e,"g",{"font-family":r.fontFamily});for(let n of["id","transform","data-sf-id","data-sf-role","data-sf-kind"]){let i=t.getAttribute(n);i!==null&&o.setAttribute(n,i)}return o}function cv(e,t,r,o,n,i){let a=zr(e,"text",{x:r.x+r.width/2,y:o-n.size*.14,"text-anchor":"middle","font-size":n.size*.16,"font-weight":600,"letter-spacing":n.size*.04,fill:i.labelColor});return a.textContent=t,a}function uv(e,t,r,o,n,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=n,c=[];s||c.push(zr(e,"rect",{x:r+.5,y:o+.5,width:l-1,height:d-1,rx:a*.09,fill:i.surface,stroke:i.divider,"stroke-width":1}));let u=zr(e,"text",{x:r+l/2,y:o+d/2,"text-anchor":"middle","dominant-baseline":"central","font-size":a,"font-weight":i.fontWeight,fill:i.color});return u.textContent=t,c.push(u),s||c.push(zr(e,"line",{x1:r+.5,x2:r+l-.5,y1:o+d/2,y2:o+d/2,stroke:i.divider,"stroke-width":1})),c}function mv(e){let t=e.ownerDocument;for(let r of e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')){let o={x:Number(r.getAttribute("x")),y:Number(r.getAttribute("y")),width:Number(r.getAttribute("width")),height:Number(r.getAttribute("height"))},n=r.getAttribute("data-sf-widget-value")??"",i=sv(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=lv(o,i.variant==="plain",i.fontSize),l=a?s.size*.3:0,d=n.length*s.cellWidth+Math.max(0,n.length-1)*s.gap,c=o.x+(o.width-d)/2,u=o.y+(o.height-(l+s.cellHeight))/2+l,m=dv(t,r,i);a&&m.appendChild(cv(t,a,o,u,s,i)),[...n].forEach((f,h)=>{let y=c+h*(s.cellWidth+s.gap);for(let x of uv(t,f,y,u,s,i))m.appendChild(x)}),r.replaceWith(m)}}function Yf(e,t){let r=e.cloneNode(!0);av(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(za,"image");iv(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),mv(r);let n=(r.getAttribute("viewBox")??"").split(/\s+/).map(Number);return n.length===4&&n.every(Number.isFinite)&&(r.setAttribute("width",String(n[2])),r.setAttribute("height",String(n[3]))),r.setAttribute("xmlns",za),r}function Ya(e,t){return new XMLSerializer().serializeToString(Yf(e,t))}var Uf="http://www.w3.org/2000/svg";var Ua=new Set([]);function z(e,t){return e.createElementNS(Uf,t)}function He(e,t,r){let o=z(e,"g");o.setAttribute("data-sf-selection-overlay",t),o.setAttribute("pointer-events","none");let n=r.getAttribute("transform");return n&&o.setAttribute("transform",n),o}var pv="data-sf-change-overlay",Yr="#f59e0b",vn=1300,ja=400;function jf(e,t,r){let o=z(e,"g");o.setAttribute(pv,t),o.setAttribute("pointer-events","none");let n=r.getAttribute("transform");return n&&o.setAttribute("transform",n),o}function Xa(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:vn,easing:"linear",fill:"forwards"})}function qa(e,t,r,o=Yr){let n=t.getBBox(),i=jf(e,r,t),a=z(e,"rect");return a.setAttribute("x",String(n.x-4)),a.setAttribute("y",String(n.y-4)),a.setAttribute("width",String(n.width+8)),a.setAttribute("height",String(n.height+8)),a.setAttribute("fill","none"),a.setAttribute("stroke",o),a.setAttribute("stroke-width","3"),i.appendChild(a),i}function Ka(e,t,r,o=Yr){let n=jf(e,r,t),i=z(e,"path");i.setAttribute("d",t.getAttribute("d")??""),i.setAttribute("fill","none"),i.setAttribute("stroke",o);let a=Number(t.getAttribute("stroke-width"))||2;return i.setAttribute("stroke-width",String(a+6)),i.setAttribute("stroke-linecap","round"),i.setAttribute("opacity","0.6"),n.appendChild(i),n}function ir(e){return e.ctrlKey||e.metaKey}function Pn(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Ln(e){return e===1}var fv=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function hv(e){return e==="entity"?"shape":e}function nt(e){let t=e.getAttribute(cn);if(!t)return null;let[r,o,n,i]=t.split(",").map(Number);return Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(n)&&Number.isFinite(i)?{x:r,y:o,width:n,height:i}:null}function Za(e){let t=e.getAttribute(un);if(!t)return null;let r;try{r=JSON.parse(t)}catch{return null}return!Array.isArray(r)||!r.every(o=>Array.isArray(o)&&o.length===2)?null:{points:r,tension:Number(e.getAttribute(mn))||0,closed:e.getAttribute(pn)==="true"}}function Qa(e){let t=e.getAttribute(fn);if(t===null)return null;let[r,o,n]=t.split(",").map(Number);if(!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(n))return null;let i=Number(e.getAttribute(Hr))||0,[a,s]=(e.getAttribute(hn)??"0,0").split(",").map(Number);return{width:r,height:o,depth:n,cornerRadius:i,bounds:nt(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function it(e){let t=e?.closest("[data-sf-id]");if(!t)return null;let r=t.getAttribute("data-sf-id"),o=t.getAttribute("data-sf-role");return!r||!o||!fv.has(o)?null:{role:hv(o),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function xt(e,t,r){let o=e.querySelectorAll(`[data-sf-id="${CSS.escape(t)}"]`);for(let n of o)if(r(n))return n;return null}var St=e=>e.hasAttribute("data-sf-primary");function Ja(e){let t=e.getBoundingClientRect(),{width:r,height:o}=e.viewBox.baseVal;if(t.width<=0||r<=0)return 1;let n=t.width/r;return t.height>0&&o>0?Math.min(n,t.height/o):n}function D(e,t){return t/Ja(e)}var Mn=6,gv=14,es=3,ts=1.5;function yv(e,t){let r=e.x+e.width/2,o=e.y+e.height/2;return[[r,e.y-t,"top"],[e.x+e.width+t,o,"right"],[r,e.y+e.height+t,"bottom"],[e.x-t,o,"left"]]}function bv(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Xf="#e8e8e8",qf="#ccc",xv="#9b42df",Sv="#7c2fb5",Cv=1.2;function rs(e,t,r,o,n,i){let a=z(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(o)),a.setAttribute("fill",Xf),a.setAttribute("stroke",qf),a.setAttribute("stroke-width",String(n)),a.setAttribute("data-sf-quick-duplicate",i),a.style.pointerEvents="auto",a.style.cursor="pointer",a.style.transition="r 120ms ease, fill 120ms ease, stroke 120ms ease",a.addEventListener("pointerenter",()=>{a.setAttribute("r",String(o*Cv)),a.setAttribute("fill",xv),a.setAttribute("stroke",Sv),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(o)),a.setAttribute("fill",Xf),a.setAttribute("stroke",qf),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function os(e,t,r,o,n){let i=z(e,"path");return i.setAttribute("d",bv(t,r,o)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(n)),i.setAttribute("stroke-linecap","round"),i}function Tn(e,t,r,o){let n=He(e,r,t),i=D(o,Mn),a=i+D(o,gv),s=D(o,es),l=D(o,ts),d=nt(t)??t.getBBox();for(let[c,u,m]of yv(d,a))n.append(rs(e,c,u,i,l,m),os(e,c,u,s,l));return n}var as="#9b42df",kv=2,Rv=3.25,wv=14,Zf=34,vv=10.5,Pv=8.5;function Kf(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function Lv(e){let r=`<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"><g transform="rotate(${Math.atan2(e.y,e.x)*180/Math.PI} 13 13)" stroke-linejoin="round" stroke-linecap="round"><line x1="4" y1="13" x2="22" y2="13" stroke="white" stroke-width="4.5"/><line x1="4" y1="13" x2="22" y2="13" stroke="black" stroke-width="1.6"/><path d="M4 13 L9.5 8.5 L9.5 17.5 Z" fill="black" stroke="white" stroke-width="1.5"/><path d="M22 13 L16.5 8.5 L16.5 17.5 Z" fill="black" stroke="white" stroke-width="1.5"/></g></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(r)}") 13 13, pointer`}function ss(e){let t=e.reduce((r,o)=>({x:r.x+o.x,y:r.y+o.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}var ls="data-sf-iso-halo";function Mv(e,t,r,o){let n=z(e,"g");n.setAttribute("data-sf-resize-handle",`iso-${t}`),n.style.cursor=Lv(r);let i=z(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(D(o,wv))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",n.appendChild(i);let a=z(e,"line");a.setAttribute("stroke",as),a.setAttribute("stroke-width",String(D(o,Rv))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",n.appendChild(a);let s=z(e,"polygon");return s.setAttribute("fill",as),s.style.pointerEvents="none",n.appendChild(s),{group:n,hit:i,shaft:a,head:s}}function Tv(e,t,r,o){let n=D(o,Zf),i=D(o,vv),a=D(o,Pv),s={x:t.x+r.x*n,y:t.y+r.y*n},l={x:t.x+r.x*(n-i),y:t.y+r.y*(n-i)},d={x:-r.y,y:r.x},c={x:l.x+d.x*a/2,y:l.y+d.y*a/2},u={x:l.x-d.x*a/2,y:l.y-d.y*a/2};e.hit.setAttribute("x1",String(t.x)),e.hit.setAttribute("y1",String(t.y)),e.hit.setAttribute("x2",String(s.x)),e.hit.setAttribute("y2",String(s.y)),e.shaft.setAttribute("x1",String(t.x)),e.shaft.setAttribute("y1",String(t.y)),e.shaft.setAttribute("x2",String(l.x)),e.shaft.setAttribute("y2",String(l.y)),e.head.setAttribute("points",`${s.x},${s.y} ${c.x},${c.y} ${u.x},${u.y}`)}function ns(e,t,r,o,n){let i=Mv(e,o,r,n);return Tv(i,t,r,n),i.group}function $n(e){let t=Ue(e),r=t.top[0],o=t.top[1],n=t.top[3],i=t.front[2];return{width:{origin:ss(t.right),direction:Kf({x:o.x-r.x,y:o.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:ss(t.front),direction:Kf({x:n.x-r.x,y:n.y-r.y})}}}var $v=Zf+Mn+10;function is(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function ds(e){let t=Ue(e),r=$n(e),o=ss([t.top[0],t.top[1],t.top[2],t.top[3],t.front[2],t.front[3],t.right[2]]);return{"iso-width-pos":r.width,"iso-width-neg":{origin:is(r.width.origin,o),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:is(r.depth.origin,o),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:is(r.height.origin,o),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var cs="data-sf-iso-duplicate-bubbles",Av=["iso-height-neg","iso-depth-pos","iso-width-pos"];function us(e,t,r){let o=z(e,"g");o.setAttribute(cs,"");let n=D(r,Mn),i=D(r,$v),a=D(r,es),s=D(r,ts),l=ds(t);for(let d of Av){let{origin:c,direction:u}=l[d],m=c.x+u.x*i,f=c.y+u.y*i;o.append(rs(e,m,f,n,s,d),os(e,m,f,a,s))}return o}function An(e,t,r,o){let n=nt(t)??t.getBBox(),i=Qa(t),a=He(e,r,t),s=z(e,"path");s.setAttribute(ls,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",as);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+D(o,kv))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=$n({x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0});return a.appendChild(ns(e,d.width.origin,d.width.direction,"width",o)),a.appendChild(ns(e,d.height.origin,d.height.direction,"height",o)),a.appendChild(ns(e,d.depth.origin,d.depth.direction,"depth",o)),a.appendChild(us(e,{x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0},o)),a}var ms="#9b42df",Ev=4,Nv=5,Jf=1.5;function Ov(e,t,r){let o=z(e,"path");o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",ms);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+D(r,Ev))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function Qf(e,t,r,o,n){let i=t.getPointAtLength(r),a=z(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(D(n,Nv))),a.setAttribute("fill",ms),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(D(n,Jf))),a.setAttribute("data-sf-link-endpoint",o),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var Bv=22,Iv=8;function Dv(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function Gv(e,t,r){let o=[];return Dv(t).forEach((n,i)=>{if(!n.movable)return;let a=Math.abs(n.bx-n.ax)>Math.abs(n.by-n.ay),s=D(r,Bv),l=D(r,Iv),d=a?s:l,c=a?l:s,u=z(e,"rect");u.setAttribute("x",String((n.ax+n.bx)/2-d/2)),u.setAttribute("y",String((n.ay+n.by)/2-c/2)),u.setAttribute("width",String(d)),u.setAttribute("height",String(c)),u.setAttribute("rx",String(l/2)),u.setAttribute("fill","white"),u.setAttribute("stroke",ms),u.setAttribute("stroke-width",String(D(r,Jf))),u.setAttribute("data-sf-link-segment",String(i)),u.setAttribute("data-sf-link-segment-axis",a?"y":"x"),u.style.pointerEvents="auto",u.style.cursor=a?"ns-resize":"ew-resize",o.push(u)}),o}function En(e,t,r,o){let n=He(e,r,t),i=t.getTotalLength();return n.append(Ov(e,t,o),...Gv(e,t,o),Qf(e,t,0,"from",o),Qf(e,t,i,"to",o)),n}var eh="#9b42df",_v=4,Fv=5,Hv=1.5,ps="data-sf-path-halo";function Vv(e,t,r){let o=z(e,"path");o.setAttribute(ps,""),o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",eh);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+D(r,_v))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function Wv(e,t,r,o,n){let i=z(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(D(n,Fv))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",eh),i.setAttribute("stroke-width",String(D(n,Hv))),i.setAttribute(Sf,String(o)),i.style.pointerEvents="auto",i.style.cursor="move",i}function Nn(e,t,r,o){let n=He(e,r,t);n.appendChild(Vv(e,t,o));let i=Za(t);for(let[a,[s,l]]of(i?.points??[]).entries())n.appendChild(Wv(e,s,l,a,o));return n}var zv=6,Yv=1,Uv="#992dff",jv={"top-left":"nwse-resize",top:"ns-resize","top-right":"nesw-resize",right:"ew-resize","bottom-right":"nwse-resize",bottom:"ns-resize","bottom-left":"nesw-resize",left:"ew-resize"};function fs(e){let t=e.x+e.width/2,r=e.y+e.height/2;return[[e.x,e.y,"top-left"],[t,e.y,"top"],[e.x+e.width,e.y,"top-right"],[e.x+e.width,r,"right"],[e.x+e.width,e.y+e.height,"bottom-right"],[t,e.y+e.height,"bottom"],[e.x,e.y+e.height,"bottom-left"],[e.x,r,"left"]]}var Xv=new Set(["top","bottom"]);function th(e,t,r,o=!1){let n=D(r,zv),i=D(r,Yv);return(o?fs(t).filter(([,,s])=>!Xv.has(s)):fs(t)).map(([s,l,d])=>{let c=z(e,"rect");return c.setAttribute("x",String(s-n/2)),c.setAttribute("y",String(l-n/2)),c.setAttribute("width",String(n)),c.setAttribute("height",String(n)),c.setAttribute("fill","white"),c.setAttribute("stroke",Uv),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=o?"ew-resize":jv[d],c})}var qv="#9b42df",Kv=3,Zv=1;function On(e,t,r,o,n=!1){let i=nt(t)??t.getBBox(),a=He(e,r,t),s=D(o,Zv),l=z(e,"rect");return l.setAttribute("x",String(i.x-s)),l.setAttribute("y",String(i.y-s)),l.setAttribute("width",String(i.width+s*2)),l.setAttribute("height",String(i.height+s*2)),l.setAttribute("fill","none"),l.setAttribute("stroke",qv),l.setAttribute("stroke-width",String(D(o,Kv))),a.appendChild(l),a.append(...th(e,i,o,n)),a}function rh(e){let t=new Map;return{flash:(o,n=Yr)=>{let i=[...new Set(o)];if(i.length===0)return;let a=e.ownerDocument,s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;for(let l of i){let d=xt(e,l,St);if(!d)continue;let c=t.get(l);c&&clearTimeout(c);for(let f of e.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(l)}"]`))f.remove();let u=d.getAttribute("data-sf-role")==="link"?Ka(a,d,l,n):qa(a,d,l,n);e.appendChild(u),Xa(u,s);let m=s?ja:vn;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},m))}},destroy(){for(let o of t.values())clearTimeout(o);t.clear()}}}function oh(e,t,r){let o=n=>{r&&n.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}function hs(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function nh(e,t){switch(t.type){case"clear":return new Set;case"set":return new Set(t.ids);case"select":return new Set([t.id]);case"add":return new Set([...e,t.id]);case"toggle":{let r=new Set(e);return r.has(t.id)?r.delete(t.id):r.add(t.id),r}}}function ih(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var t1="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function gs(e){return!!e?.closest(t1)}var Bn=class{#e;#o;#t;#r;constructor(t,r,o,n){this.#e=t,this.#o=r,this.#t=o,this.#r=n}hover(t){let r=it(t.target);this.#o.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:hs(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,o=it(r);if(!o){this.#n(r);return}this.#i(o,t)}#n(t){gs(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let o=hs(r);this.#r.dispatch(ih(t.id,o)),this.#o.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:o});let n=xt(this.#e,t.id,St);n&&!n.hasAttribute("tabindex")&&n.setAttribute("tabindex","-1"),n?.focus({preventScroll:!0})}};var r1=4,ys=class{#e;#o;#t;#r=null;constructor(t,r,o){this.#e=t,this.#o=r,this.#t=o}bind(){return this.#e.svg.addEventListener("pointerdown",this.#n),this.#e.svg.addEventListener("pointermove",this.#i),this.#e.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#n=t=>{let r=t.target,o=!!it(r)||gs(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:ir(t)||!o}};#i=t=>{this.#a(t)||this.#t&&this.#o.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#t&&this.#o.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>r1&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&ir(t)&&this.#e.panBy(t.movementX,t.movementY),!0)}#l(){this.#e.svg.removeEventListener("pointerdown",this.#n),this.#e.svg.removeEventListener("pointermove",this.#i),this.#e.svg.removeEventListener("pointerup",this.#s)}};function ah(e){let{display:t,emitter:r,diagramId:o,selection:n,selectable:i}=e,a=new Bn(t.svg,r,o,n);return new ys(t,a,i).bind()}function bs(e,t,r){for(let n of e.querySelectorAll("[data-sf-selection-overlay]"))n.remove();let o=e.ownerDocument;for(let n of t){let i=xt(e,n,St);if(!i)continue;let a=r.get(n),s=a?.role==="link"?En(o,i,n,e):a?.role==="path"?Nn(o,i,n,e):a?.role==="isometric"?An(o,i,n,e):On(o,i,n,e,a?Ua.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(Tn(o,i,n,e))}}var In=class{#e;#o;#t;#r=new Map;#n=new Set;constructor(t,r,o){this.#e=t,this.#o=r,this.#t=o}getOwners(){return[...this.#n].map(t=>this.#r.get(t)).filter(t=>!!t)}remember(t){this.#r.set(t.id,t)}dispatch(t){this.#n=nh(this.#n,t),bs(this.#e,this.#n,this.#r),this.#o.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#n.size>0&&bs(this.#e,this.#n,this.#r)}selectIds(t){for(let r of t){let o=this.#e.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),n=it(o);n&&this.remember(n)}this.dispatch({type:"set",ids:t})}};function sh(e,t){let r=o=>{ir(o)&&(o.preventDefault(),e.zoomBy(o.deltaY<0?1.1:.9090909090909091,o.clientX,o.clientY),t.repaint())};return e.svg.addEventListener("wheel",r,{passive:!1}),()=>{e.svg.removeEventListener("wheel",r)}}function lh(e,t,r,o={}){let n=o.selectable??!0,i=new In(e.svg,t,r),a=ah({display:e,emitter:t,diagramId:r,selection:i,selectable:n}),s=sh(e,i),l=oh(e.svg,i,n),d=rh(e.svg);return{getSelection:()=>i.getOwners(),select:c=>i.selectIds(c),repaint:()=>i.repaint(),flashChanged:(c,u)=>d.flash(c,u),destroy(){a(),s(),l(),d.destroy()}}}var xs={numbers:{intensity:.85,speed:.18,progress:-1,boost:0,dent:-1,day:-1,light:135,gloss:.15,depth:.4,rim:.2},colors:{color:[.08,.02,.22],accent:[.58,.31,1],hot:[1,.45,.82]}};var o1=`
18
+ </svg>`,width:o,height:n,diagnostics:e.diagnostics}}function gn(e,t={}){return vf(e,t)}function zw(e,t={}){let r=Oa(e,{measureText:t.measureText}),{svg:o,width:n,height:i,diagnostics:a}=gn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var Yw=50,ot=new Map,Pf=Kr();function Uw(e){let t=Kr();t!==Pf&&(ot.clear(),Pf=t);let r=ot.get(e);if(r)return ot.delete(e),ot.set(e,r),r;let o=Oa(yi(e));if(ot.set(e,o),ot.size>Yw){let n=ot.keys().next().value;n!==void 0&&ot.delete(n)}return o}function yn(e,t={}){if(t.measureText)return zw(yi(e),t);let r=Uw(e),{svg:o,width:n,height:i,diagnostics:a}=gn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var Ia="http://www.w3.org/1999/xhtml",bn=(e,t)=>{Object.assign(e.style,t)};function xn(e,t,r){let o=e.createElementNS(Ia,"span");return o.setAttribute("data-sf-rolling-current","true"),o.textContent=t,bn(o,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),o}function jw(e,t,r){let o=e.createElementNS(Ia,"span");if(o.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return bn(o,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),o.appendChild(xn(e,t,r)),o;bn(o,{position:"relative",display:"inline-block",width:"0.72em",height:"1.2em",overflow:"hidden",border:`1px solid ${r.divider}`,borderRadius:"0.09em",background:r.surface,boxShadow:"inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -0.16em 0.38em rgba(0,0,0,0.12)"}),o.appendChild(xn(e,t,r));let n=e.createElementNS(Ia,"span");return bn(n,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),o.appendChild(n),o}function Sn(e,t,r){return r===0||typeof e.animate!="function"?null:e.animate(t,{duration:r,easing:"cubic-bezier(0.22, 1, 0.36, 1)",fill:"forwards"})}function Xw(e,t,r,o){let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=xn(e.ownerDocument,t,r);i.style.opacity="0",e.insertBefore(i,e.lastElementChild??null);let a={opacity:0,filter:"blur(0.025em)",transform:"scale(0.985)"},s={opacity:1,filter:"blur(0)",transform:"scale(1)"},l=Sn(i,[a,s],o),d=n?Sn(n,[s,a],o):null,c=()=>{n?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function qw(e,t,r,o){if(r.motion==="fade"){Xw(e,t,r,o);return}let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=xn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Sn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],o),s=n?Sn(n,[{transform:"translateY(0)",opacity:1},{transform:"translateY(-100%)",opacity:.25}],o):null,l=()=>{n?.remove(),i.style.transform="translateY(0)",i.style.opacity="1"};a?a.finished.then(l,l):(s?.cancel(),l())}function Lf(e,t,r,o,n){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>jw(e.ownerDocument,a,o))),e.setAttribute("aria-label",r);return}let i=[...e.querySelectorAll("[data-sf-rolling-digit]")];[...r].forEach((a,s)=>{t[s]!==a&&qw(i[s],a,o,n)}),e.setAttribute("aria-label",r)}function Da(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var Kw=140;function Zw(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Mf(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return J;try{return{...J,...JSON.parse(t)}}catch{return J}}function Qw(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function Jw(e){let t=Number(e.getAttribute("data-sf-widget-duration"));return!Number.isFinite(t)||t<0?420:e.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches?0:t}function Cn(e,t,r){let o=Zw(e);if(!o)return!1;let n=e.getAttribute("data-sf-widget-value")??"",i=sr(t,Qw(e.getAttribute("data-sf-widget-digits")));return n===i||(Lf(o,n,i,Mf(e),r?Jw(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function Ga(e){let t=new Map,r=new Map,o=new Map;return{setValue(n,i){let a=Da(e,n);if(!a)return!1;if(t.set(n,i),Mf(a).motion!=="fade")return Cn(a,i,!0);let s=Date.now(),l=(r.get(n)??0)+Kw-s;return l<=0?(r.set(n,s),Cn(a,i,!0)):(o.has(n)||o.set(n,setTimeout(()=>{o.delete(n),r.set(n,Date.now());let d=Da(e,n),c=t.get(n);d&&c!==void 0&&Cn(d,c,!0)},l)),!0)},refresh(){for(let[n,i]of t){let a=Da(e,n);a&&Cn(a,i,!1)}},clearValues(){for(let n of o.values())clearTimeout(n);o.clear(),t.clear()},destroy(){for(let n of o.values())clearTimeout(n);o.clear(),t.clear()}}}var Tf=new WeakMap,$f=new WeakMap,Af=new WeakMap;function Ha(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Ef(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function _a(e,t){return Number(e)>0?Number(e):t}function Nf(e,t){let r=Ef(e),o=Number(r.min)||0,n=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return Ha(n===o?0:(t-o)/(n-o))}function Fa(e,t,r){let o=e.getAttribute("transform")??"",n=o===$f.get(e)?Tf.get(e)??"":o;Tf.set(e,n);let i=`translate(${t} ${r}) ${n}`.trim();$f.set(e,i),e.setAttribute("transform",i)}function Of(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}var ev=[255,255,255];function tv(e,t,r){let o=Af.get(e)??e.getAttribute("fill")??"";Af.set(e,o);let n=Of(o);if(!n)return;let i=n.map((s,l)=>Math.round(s+(r[l]-s)*t)),a=`rgb(${i[0]}, ${i[1]}, ${i[2]})`;e.style.fill=a;for(let s of e.querySelectorAll("tspan"))s.style.fill=a}function Bf(e,t){let r=new Map;for(let o of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let n=Ef(o),i=(typeof n.peak=="string"?Of(n.peak):null)??ev,a=o.getAttribute("data-sf-id")??"",s=Number(o.getAttribute("x")),l=Number(o.getAttribute("y")),d=Number(o.getAttribute("width")),c=Number(o.getAttribute("height")),u=n.axis==="horizontal",m=Ha(t(a)??Number(n.progress)),f=_a(n.inset,.05),h=_a(n.line,.7),y=u?d:c,x=u?c:d,b=f+(1-2*f)*m,C=n.dent===void 0?1:Number(n.dent),S=(C<0?1:C)*.16*x,w=typeof n.knob=="string"?n.knob:"";if(w){let le=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(w)}"]`)],Pe=le.find(oe=>oe.hasAttribute("data-sf-primary"));if(Pe?.getBBox){Fa(Pe,0,0);let oe=Pe.getBBox(),Ke=(u?oe.height:oe.width)/2;r.set(a,Ke/x);let Xr=(n.gap===void 0?.04:Number(n.gap))*x,Rs=h*x-S+Ke+Xr,ws=u?{x:s+d*b,y:l+Rs}:{x:s+Rs,y:l+c*(1-b)},Jh=ws.x-(oe.x+oe.width/2),eg=ws.y-(oe.y+oe.height/2);for(let tg of le)Fa(tg,Jh,eg)}}let O=Number(n.min)||0,A=Number.isFinite(Number(n.max))&&n.max!==void 0?Number(n.max):100,_=_a(n.spread,.07)*y,G=f*y,V=(1-2*f)*y,ve=G+V*m;for(let le of e.querySelectorAll(`text[data-sf-id="${CSS.escape(a)}"]`)){let Pe=Number(le.textContent);if(!Number.isFinite(Pe)||A===O)continue;let oe=G+V*Ha((Pe-O)/(A-O)),Ke=Math.exp(-(((oe-ve)/_)**2)),Xr=S*.4*Ke;Fa(le,u?0:-Xr,u?-Xr:0),tv(le,Ke,i)}}return r}var If=new Set(["viewbox","width","height"]);function Df(e,t){for(let r of Array.from(e.attributes))If.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))If.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function Gf(e,t,r){let o=[],n=[],i=[];for(let a of r){let s=e.has(a),l=t.has(a);l&&!s?o.push(a):s&&!l?n.push(a):s&&l&&i.push(a)}return{added:o,removed:n,changed:i}}function _f(e,t){let r=e.querySelector(":scope > defs"),o=t.querySelector(":scope > defs");return o?(r?r.replaceWith(o):e.insertBefore(o,e.firstChild),o):(r?.remove(),r)}function rv(e,t){let r=!1;for(let o of Array.from(e.attributes))t.hasAttribute(o.name)||(e.removeAttribute(o.name),r=!0);for(let o of Array.from(t.attributes))e.getAttribute(o.name)!==o.value&&(e.setAttribute(o.name,o.value),r=!0);return r}function Hf(e,t){let r=Array.from(e.childNodes),o=Array.from(t.childNodes);if(r.length!==o.length)return!1;for(let n=0;n<r.length;n++){let i=r[n],a=o[n];if(i.nodeType!==a.nodeType)return!1;if(i.nodeType===Node.TEXT_NODE){if(i.textContent!==a.textContent)return!1;continue}if(i.nodeType!==Node.ELEMENT_NODE)continue;let s=i,l=a;if(s.tagName!==l.tagName||s.attributes.length!==l.attributes.length)return!1;for(let d of Array.from(s.attributes))if(l.getAttribute(d.name)!==d.value)return!1;if(!Hf(s,l))return!1}return!0}function Ff(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function Vf(e,t){let r=t.hasAttribute("data-sf-widget")&&(e.getAttribute("data-sf-widget-style")!==t.getAttribute("data-sf-widget-style")||e.getAttribute("data-sf-widget-value")!==t.getAttribute("data-sf-widget-value")),o=rv(e,t),n=!1;return r&&(n=!0,Ff(e,t)),t.tagName.toLowerCase()==="text"&&!Hf(e,t)&&(n=!0,Ff(e,t)),o||n}function Vr(e){return e.getAttribute("data-sf-id")??e.id}function Wf(e){let t=new Map;return Array.from(e.querySelectorAll(":scope > [id]"),r=>{let o=t.get(r.id)??0;return t.set(r.id,o+1),[`${r.id}#${o}`,r]})}function ov(e){return new Map(Wf(e))}function nv(e,t,r){return e&&e.tagName===t.tagName?(Vf(e,t)&&r(Vr(t)),e):(e?.remove(),r(Vr(t)),t)}function iv(e,t,r){let o=r?r.nextSibling:e.firstChild;o!==t&&e.insertBefore(t,o)}function zf(e,t){let r=_f(e,t),o=ov(e),n=new Set,i=new Set;for(let c of o.values())i.add(Vr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let[c,u]of Wf(t)){n.add(c),a.add(Vr(u));let m=nv(o.get(c),u,l);iv(e,m,d),d=m}for(let[c,u]of o)n.has(c)||(s.add(Vr(u)),u.remove());return Gf(i,a,s)}function Yf(e,t){return Df(e,t),zf(e,t)}function Va(e){let r=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(r.nodeName.toLowerCase()!=="svg")throw new Error("viewer: source did not parse to an <svg> root");return r}function Wr(e){let t=(e.getAttribute("viewBox")??"0 0 100 100").split(/\s+/).map(Number);return{x:t[0],y:t[1],w:t[2],h:t[3]}}var kn=class{#e;#o;#t;constructor(t,r){this.#e=t,this.#o=r,this.#t={...r}}apply(){this.#e.setAttribute("viewBox",`${this.#t.x} ${this.#t.y} ${this.#t.w} ${this.#t.h}`)}fit(){this.#t={...this.#o},this.apply()}get(){return{...this.#t}}setNatural(t){this.#o=t}#r(t,r){let o=this.#e.getScreenCTM();if(!o)return null;let n=new DOMPoint(t,r).matrixTransform(o.inverse());return{x:n.x,y:n.y}}zoomBy(t,r,o){let n=this.#e.getBoundingClientRect();if(n.width<=0||n.height<=0)return;let i=r??n.left+n.width/2,a=o??n.top+n.height/2,s=this.#r(i,a);this.#t={...this.#t,w:this.#t.w/t,h:this.#t.h/t},this.apply();let l=s?this.#r(i,a):null;s&&l&&(this.#t.x+=s.x-l.x,this.#t.y+=s.y-l.y),this.apply()}panBy(t,r){let o=this.#e.getScreenCTM()?.a,n=o&&o>0?o:1;this.#t.x-=t/n,this.#t.y-=r/n,this.apply()}};function Uf(e,t){let r=Va(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let o=new kn(r,Wr(r));return e.appendChild(r),o.apply(),{svg:r,fit:()=>o.fit(),getViewport:()=>o.get(),zoomBy:(n,i,a)=>o.zoomBy(n,i,a),panBy:(n,i)=>o.panBy(n,i),updateContent(n){let i=Va(n),a=Yf(r,i);return o.setNatural(Wr(i)),a},destroy(){r.remove()}}}var Rn=class{handlers=new Map;on(t,r){let o=this.handlers.get(t)??new Set;this.handlers.set(t,o);let n=r;return o.add(n),()=>o.delete(n)}emit(t,r){let o=this.handlers.get(t);if(o!==void 0)for(let n of[...o])try{n(r)}catch(i){queueMicrotask(()=>{throw i})}}clear(){this.handlers.clear()}};var wn=class extends Rn{};function av(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function sv(e,t){return new Promise((r,o)=>{let n=e.defaultView?.Image;if(!n){o(new Error("viewer export: Image is unavailable in this environment."));return}let i=new n;i.onload=()=>r(i),i.onerror=()=>o(new Error("viewer export: the SVG snapshot could not be decoded.")),i.src=t})}function lv(e,t,r){return new Promise((o,n)=>{e.toBlob(i=>{i?o(i):n(new Error(`viewer export: ${t} encoding failed.`))},t,r)})}async function Wa(e,t,r={}){let o=Wr(e),n=av(r.scale,1),i=Math.max(1,Math.round(o.w*n)),a=Math.max(1,Math.round(o.h*n)),s=e.ownerDocument.createElement("canvas");s.width=i,s.height=a;let l=s.getContext("2d");if(!l)throw new Error("viewer export: a 2D canvas context is unavailable.");let d=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(d);try{let u=await sv(e.ownerDocument,c),m=r.backgroundColor??(r.format==="jpeg"?"#ffffff":void 0);m&&(l.fillStyle=m,l.fillRect(0,0,i,a)),l.drawImage(u,0,0,i,a);let f=r.format==="jpeg"?"image/jpeg":"image/png";return await lv(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var za="http://www.w3.org/2000/svg";function dv(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function cv(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function zr(e,t,r){let o=e.createElementNS(za,t);for(let[n,i]of Object.entries(r))o.setAttribute(n,String(i));return o}function uv(e){try{return{...J,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return J}}function mv(e,t,r=0){let o=r>0?r:Math.max(1,Math.min(e.width,e.height)*.28);return{size:o,plain:t,cellWidth:t?o*.62:o*.72+2,cellHeight:t?o*1.1:o*1.2+2,gap:o*(t?.02:.1)}}function pv(e,t,r){let o=zr(e,"g",{"font-family":r.fontFamily});for(let n of["id","transform","data-sf-id","data-sf-role","data-sf-kind"]){let i=t.getAttribute(n);i!==null&&o.setAttribute(n,i)}return o}function fv(e,t,r,o,n,i){let a=zr(e,"text",{x:r.x+r.width/2,y:o-n.size*.14,"text-anchor":"middle","font-size":n.size*.16,"font-weight":600,"letter-spacing":n.size*.04,fill:i.labelColor});return a.textContent=t,a}function hv(e,t,r,o,n,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=n,c=[];s||c.push(zr(e,"rect",{x:r+.5,y:o+.5,width:l-1,height:d-1,rx:a*.09,fill:i.surface,stroke:i.divider,"stroke-width":1}));let u=zr(e,"text",{x:r+l/2,y:o+d/2,"text-anchor":"middle","dominant-baseline":"central","font-size":a,"font-weight":i.fontWeight,fill:i.color});return u.textContent=t,c.push(u),s||c.push(zr(e,"line",{x1:r+.5,x2:r+l-.5,y1:o+d/2,y2:o+d/2,stroke:i.divider,"stroke-width":1})),c}function gv(e){let t=e.ownerDocument;for(let r of e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')){let o={x:Number(r.getAttribute("x")),y:Number(r.getAttribute("y")),width:Number(r.getAttribute("width")),height:Number(r.getAttribute("height"))},n=r.getAttribute("data-sf-widget-value")??"",i=uv(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=mv(o,i.variant==="plain",i.fontSize),l=a?s.size*.3:0,d=n.length*s.cellWidth+Math.max(0,n.length-1)*s.gap,c=o.x+(o.width-d)/2,u=o.y+(o.height-(l+s.cellHeight))/2+l,m=pv(t,r,i);a&&m.appendChild(fv(t,a,o,u,s,i)),[...n].forEach((f,h)=>{let y=c+h*(s.cellWidth+s.gap);for(let x of hv(t,f,y,u,s,i))m.appendChild(x)}),r.replaceWith(m)}}function jf(e,t){let r=e.cloneNode(!0);cv(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(za,"image");dv(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),gv(r);let n=(r.getAttribute("viewBox")??"").split(/\s+/).map(Number);return n.length===4&&n.every(Number.isFinite)&&(r.setAttribute("width",String(n[2])),r.setAttribute("height",String(n[3]))),r.setAttribute("xmlns",za),r}function Ya(e,t){return new XMLSerializer().serializeToString(jf(e,t))}var Xf="http://www.w3.org/2000/svg";var Ua=new Set([]);function z(e,t){return e.createElementNS(Xf,t)}function He(e,t,r){let o=z(e,"g");o.setAttribute("data-sf-selection-overlay",t),o.setAttribute("pointer-events","none");let n=r.getAttribute("transform");return n&&o.setAttribute("transform",n),o}var yv="data-sf-change-overlay",Yr="#f59e0b",vn=1300,ja=400;function qf(e,t,r){let o=z(e,"g");o.setAttribute(yv,t),o.setAttribute("pointer-events","none");let n=r.getAttribute("transform");return n&&o.setAttribute("transform",n),o}function Xa(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:vn,easing:"linear",fill:"forwards"})}function qa(e,t,r,o=Yr){let n=t.getBBox(),i=qf(e,r,t),a=z(e,"rect");return a.setAttribute("x",String(n.x-4)),a.setAttribute("y",String(n.y-4)),a.setAttribute("width",String(n.width+8)),a.setAttribute("height",String(n.height+8)),a.setAttribute("fill","none"),a.setAttribute("stroke",o),a.setAttribute("stroke-width","3"),i.appendChild(a),i}function Ka(e,t,r,o=Yr){let n=qf(e,r,t),i=z(e,"path");i.setAttribute("d",t.getAttribute("d")??""),i.setAttribute("fill","none"),i.setAttribute("stroke",o);let a=Number(t.getAttribute("stroke-width"))||2;return i.setAttribute("stroke-width",String(a+6)),i.setAttribute("stroke-linecap","round"),i.setAttribute("opacity","0.6"),n.appendChild(i),n}function ir(e){return e.ctrlKey||e.metaKey}function Pn(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Ln(e){return e===1}var bv=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function xv(e){return e==="entity"?"shape":e}function nt(e){let t=e.getAttribute(cn);if(!t)return null;let[r,o,n,i]=t.split(",").map(Number);return Number.isFinite(r)&&Number.isFinite(o)&&Number.isFinite(n)&&Number.isFinite(i)?{x:r,y:o,width:n,height:i}:null}function Za(e){let t=e.getAttribute(un);if(!t)return null;let r;try{r=JSON.parse(t)}catch{return null}return!Array.isArray(r)||!r.every(o=>Array.isArray(o)&&o.length===2)?null:{points:r,tension:Number(e.getAttribute(mn))||0,closed:e.getAttribute(pn)==="true"}}function Qa(e){let t=e.getAttribute(fn);if(t===null)return null;let[r,o,n]=t.split(",").map(Number);if(!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(n))return null;let i=Number(e.getAttribute(Hr))||0,[a,s]=(e.getAttribute(hn)??"0,0").split(",").map(Number);return{width:r,height:o,depth:n,cornerRadius:i,bounds:nt(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function it(e){let t=e?.closest("[data-sf-id]");if(!t)return null;let r=t.getAttribute("data-sf-id"),o=t.getAttribute("data-sf-role");return!r||!o||!bv.has(o)?null:{role:xv(o),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function xt(e,t,r){let o=e.querySelectorAll(`[data-sf-id="${CSS.escape(t)}"]`);for(let n of o)if(r(n))return n;return null}var St=e=>e.hasAttribute("data-sf-primary");function Ja(e){let t=e.getBoundingClientRect(),{width:r,height:o}=e.viewBox.baseVal;if(t.width<=0||r<=0)return 1;let n=t.width/r;return t.height>0&&o>0?Math.min(n,t.height/o):n}function D(e,t){return t/Ja(e)}var Mn=6,Sv=14,es=3,ts=1.5;function Cv(e,t){let r=e.x+e.width/2,o=e.y+e.height/2;return[[r,e.y-t,"top"],[e.x+e.width+t,o,"right"],[r,e.y+e.height+t,"bottom"],[e.x-t,o,"left"]]}function kv(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Kf="#e8e8e8",Zf="#ccc",Rv="#9b42df",wv="#7c2fb5",vv=1.2;function rs(e,t,r,o,n,i){let a=z(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(o)),a.setAttribute("fill",Kf),a.setAttribute("stroke",Zf),a.setAttribute("stroke-width",String(n)),a.setAttribute("data-sf-quick-duplicate",i),a.style.pointerEvents="auto",a.style.cursor="pointer",a.style.transition="r 120ms ease, fill 120ms ease, stroke 120ms ease",a.addEventListener("pointerenter",()=>{a.setAttribute("r",String(o*vv)),a.setAttribute("fill",Rv),a.setAttribute("stroke",wv),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(o)),a.setAttribute("fill",Kf),a.setAttribute("stroke",Zf),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function os(e,t,r,o,n){let i=z(e,"path");return i.setAttribute("d",kv(t,r,o)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(n)),i.setAttribute("stroke-linecap","round"),i}function Tn(e,t,r,o){let n=He(e,r,t),i=D(o,Mn),a=i+D(o,Sv),s=D(o,es),l=D(o,ts),d=nt(t)??t.getBBox();for(let[c,u,m]of Cv(d,a))n.append(rs(e,c,u,i,l,m),os(e,c,u,s,l));return n}var as="#9b42df",Pv=2,Lv=3.25,Mv=14,Jf=34,Tv=10.5,$v=8.5;function Qf(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function Av(e){let r=`<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"><g transform="rotate(${Math.atan2(e.y,e.x)*180/Math.PI} 13 13)" stroke-linejoin="round" stroke-linecap="round"><line x1="4" y1="13" x2="22" y2="13" stroke="white" stroke-width="4.5"/><line x1="4" y1="13" x2="22" y2="13" stroke="black" stroke-width="1.6"/><path d="M4 13 L9.5 8.5 L9.5 17.5 Z" fill="black" stroke="white" stroke-width="1.5"/><path d="M22 13 L16.5 8.5 L16.5 17.5 Z" fill="black" stroke="white" stroke-width="1.5"/></g></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(r)}") 13 13, pointer`}function ss(e){let t=e.reduce((r,o)=>({x:r.x+o.x,y:r.y+o.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}var ls="data-sf-iso-halo";function Ev(e,t,r,o){let n=z(e,"g");n.setAttribute("data-sf-resize-handle",`iso-${t}`),n.style.cursor=Av(r);let i=z(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(D(o,Mv))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",n.appendChild(i);let a=z(e,"line");a.setAttribute("stroke",as),a.setAttribute("stroke-width",String(D(o,Lv))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",n.appendChild(a);let s=z(e,"polygon");return s.setAttribute("fill",as),s.style.pointerEvents="none",n.appendChild(s),{group:n,hit:i,shaft:a,head:s}}function Nv(e,t,r,o){let n=D(o,Jf),i=D(o,Tv),a=D(o,$v),s={x:t.x+r.x*n,y:t.y+r.y*n},l={x:t.x+r.x*(n-i),y:t.y+r.y*(n-i)},d={x:-r.y,y:r.x},c={x:l.x+d.x*a/2,y:l.y+d.y*a/2},u={x:l.x-d.x*a/2,y:l.y-d.y*a/2};e.hit.setAttribute("x1",String(t.x)),e.hit.setAttribute("y1",String(t.y)),e.hit.setAttribute("x2",String(s.x)),e.hit.setAttribute("y2",String(s.y)),e.shaft.setAttribute("x1",String(t.x)),e.shaft.setAttribute("y1",String(t.y)),e.shaft.setAttribute("x2",String(l.x)),e.shaft.setAttribute("y2",String(l.y)),e.head.setAttribute("points",`${s.x},${s.y} ${c.x},${c.y} ${u.x},${u.y}`)}function ns(e,t,r,o,n){let i=Ev(e,o,r,n);return Nv(i,t,r,n),i.group}function $n(e){let t=Ue(e),r=t.top[0],o=t.top[1],n=t.top[3],i=t.front[2];return{width:{origin:ss(t.right),direction:Qf({x:o.x-r.x,y:o.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:ss(t.front),direction:Qf({x:n.x-r.x,y:n.y-r.y})}}}var Ov=Jf+Mn+10;function is(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function ds(e){let t=Ue(e),r=$n(e),o=ss([t.top[0],t.top[1],t.top[2],t.top[3],t.front[2],t.front[3],t.right[2]]);return{"iso-width-pos":r.width,"iso-width-neg":{origin:is(r.width.origin,o),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:is(r.depth.origin,o),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:is(r.height.origin,o),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var cs="data-sf-iso-duplicate-bubbles",Bv=["iso-height-neg","iso-depth-pos","iso-width-pos"];function us(e,t,r){let o=z(e,"g");o.setAttribute(cs,"");let n=D(r,Mn),i=D(r,Ov),a=D(r,es),s=D(r,ts),l=ds(t);for(let d of Bv){let{origin:c,direction:u}=l[d],m=c.x+u.x*i,f=c.y+u.y*i;o.append(rs(e,m,f,n,s,d),os(e,m,f,a,s))}return o}function An(e,t,r,o){let n=nt(t)??t.getBBox(),i=Qa(t),a=He(e,r,t),s=z(e,"path");s.setAttribute(ls,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",as);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+D(o,Pv))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=$n({x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0});return a.appendChild(ns(e,d.width.origin,d.width.direction,"width",o)),a.appendChild(ns(e,d.height.origin,d.height.direction,"height",o)),a.appendChild(ns(e,d.depth.origin,d.depth.direction,"depth",o)),a.appendChild(us(e,{x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0},o)),a}var ms="#9b42df",Iv=4,Dv=5,th=1.5;function Gv(e,t,r){let o=z(e,"path");o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",ms);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+D(r,Iv))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function eh(e,t,r,o,n){let i=t.getPointAtLength(r),a=z(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(D(n,Dv))),a.setAttribute("fill",ms),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(D(n,th))),a.setAttribute("data-sf-link-endpoint",o),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var _v=22,Fv=8;function Hv(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function Vv(e,t,r){let o=[];return Hv(t).forEach((n,i)=>{if(!n.movable)return;let a=Math.abs(n.bx-n.ax)>Math.abs(n.by-n.ay),s=D(r,_v),l=D(r,Fv),d=a?s:l,c=a?l:s,u=z(e,"rect");u.setAttribute("x",String((n.ax+n.bx)/2-d/2)),u.setAttribute("y",String((n.ay+n.by)/2-c/2)),u.setAttribute("width",String(d)),u.setAttribute("height",String(c)),u.setAttribute("rx",String(l/2)),u.setAttribute("fill","white"),u.setAttribute("stroke",ms),u.setAttribute("stroke-width",String(D(r,th))),u.setAttribute("data-sf-link-segment",String(i)),u.setAttribute("data-sf-link-segment-axis",a?"y":"x"),u.style.pointerEvents="auto",u.style.cursor=a?"ns-resize":"ew-resize",o.push(u)}),o}function En(e,t,r,o){let n=He(e,r,t),i=t.getTotalLength();return n.append(Gv(e,t,o),...Vv(e,t,o),eh(e,t,0,"from",o),eh(e,t,i,"to",o)),n}var rh="#9b42df",Wv=4,zv=5,Yv=1.5,ps="data-sf-path-halo";function Uv(e,t,r){let o=z(e,"path");o.setAttribute(ps,""),o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",rh);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+D(r,Wv))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function jv(e,t,r,o,n){let i=z(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(D(n,zv))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",rh),i.setAttribute("stroke-width",String(D(n,Yv))),i.setAttribute(Cf,String(o)),i.style.pointerEvents="auto",i.style.cursor="move",i}function Nn(e,t,r,o){let n=He(e,r,t);n.appendChild(Uv(e,t,o));let i=Za(t);for(let[a,[s,l]]of(i?.points??[]).entries())n.appendChild(jv(e,s,l,a,o));return n}var Xv=6,qv=1,Kv="#992dff",Zv={"top-left":"nwse-resize",top:"ns-resize","top-right":"nesw-resize",right:"ew-resize","bottom-right":"nwse-resize",bottom:"ns-resize","bottom-left":"nesw-resize",left:"ew-resize"};function fs(e){let t=e.x+e.width/2,r=e.y+e.height/2;return[[e.x,e.y,"top-left"],[t,e.y,"top"],[e.x+e.width,e.y,"top-right"],[e.x+e.width,r,"right"],[e.x+e.width,e.y+e.height,"bottom-right"],[t,e.y+e.height,"bottom"],[e.x,e.y+e.height,"bottom-left"],[e.x,r,"left"]]}var Qv=new Set(["top","bottom"]);function oh(e,t,r,o=!1){let n=D(r,Xv),i=D(r,qv);return(o?fs(t).filter(([,,s])=>!Qv.has(s)):fs(t)).map(([s,l,d])=>{let c=z(e,"rect");return c.setAttribute("x",String(s-n/2)),c.setAttribute("y",String(l-n/2)),c.setAttribute("width",String(n)),c.setAttribute("height",String(n)),c.setAttribute("fill","white"),c.setAttribute("stroke",Kv),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=o?"ew-resize":Zv[d],c})}var Jv="#9b42df",e1=3,t1=1;function On(e,t,r,o,n=!1){let i=nt(t)??t.getBBox(),a=He(e,r,t),s=D(o,t1),l=z(e,"rect");return l.setAttribute("x",String(i.x-s)),l.setAttribute("y",String(i.y-s)),l.setAttribute("width",String(i.width+s*2)),l.setAttribute("height",String(i.height+s*2)),l.setAttribute("fill","none"),l.setAttribute("stroke",Jv),l.setAttribute("stroke-width",String(D(o,e1))),a.appendChild(l),a.append(...oh(e,i,o,n)),a}function nh(e){let t=new Map;return{flash:(o,n=Yr)=>{let i=[...new Set(o)];if(i.length===0)return;let a=e.ownerDocument,s=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;for(let l of i){let d=xt(e,l,St);if(!d)continue;let c=t.get(l);c&&clearTimeout(c);for(let f of e.querySelectorAll(`[data-sf-change-overlay="${CSS.escape(l)}"]`))f.remove();let u=d.getAttribute("data-sf-role")==="link"?Ka(a,d,l,n):qa(a,d,l,n);e.appendChild(u),Xa(u,s);let m=s?ja:vn;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},m))}},destroy(){for(let o of t.values())clearTimeout(o);t.clear()}}}function ih(e,t,r){let o=n=>{r&&n.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}function hs(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function ah(e,t){switch(t.type){case"clear":return new Set;case"set":return new Set(t.ids);case"select":return new Set([t.id]);case"add":return new Set([...e,t.id]);case"toggle":{let r=new Set(e);return r.has(t.id)?r.delete(t.id):r.add(t.id),r}}}function sh(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var i1="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function gs(e){return!!e?.closest(i1)}var Bn=class{#e;#o;#t;#r;constructor(t,r,o,n){this.#e=t,this.#o=r,this.#t=o,this.#r=n}hover(t){let r=it(t.target);this.#o.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:hs(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,o=it(r);if(!o){this.#n(r);return}this.#i(o,t)}#n(t){gs(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let o=hs(r);this.#r.dispatch(sh(t.id,o)),this.#o.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:o});let n=xt(this.#e,t.id,St);n&&!n.hasAttribute("tabindex")&&n.setAttribute("tabindex","-1"),n?.focus({preventScroll:!0})}};var a1=4,ys=class{#e;#o;#t;#r=null;constructor(t,r,o){this.#e=t,this.#o=r,this.#t=o}bind(){return this.#e.svg.addEventListener("pointerdown",this.#n),this.#e.svg.addEventListener("pointermove",this.#i),this.#e.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#n=t=>{let r=t.target,o=!!it(r)||gs(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:ir(t)||!o}};#i=t=>{this.#a(t)||this.#t&&this.#o.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#t&&this.#o.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>a1&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&ir(t)&&this.#e.panBy(t.movementX,t.movementY),!0)}#l(){this.#e.svg.removeEventListener("pointerdown",this.#n),this.#e.svg.removeEventListener("pointermove",this.#i),this.#e.svg.removeEventListener("pointerup",this.#s)}};function lh(e){let{display:t,emitter:r,diagramId:o,selection:n,selectable:i}=e,a=new Bn(t.svg,r,o,n);return new ys(t,a,i).bind()}function bs(e,t,r){for(let n of e.querySelectorAll("[data-sf-selection-overlay]"))n.remove();let o=e.ownerDocument;for(let n of t){let i=xt(e,n,St);if(!i)continue;let a=r.get(n),s=a?.role==="link"?En(o,i,n,e):a?.role==="path"?Nn(o,i,n,e):a?.role==="isometric"?An(o,i,n,e):On(o,i,n,e,a?Ua.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(Tn(o,i,n,e))}}var In=class{#e;#o;#t;#r=new Map;#n=new Set;constructor(t,r,o){this.#e=t,this.#o=r,this.#t=o}getOwners(){return[...this.#n].map(t=>this.#r.get(t)).filter(t=>!!t)}remember(t){this.#r.set(t.id,t)}dispatch(t){this.#n=ah(this.#n,t),bs(this.#e,this.#n,this.#r),this.#o.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#n.size>0&&bs(this.#e,this.#n,this.#r)}selectIds(t){for(let r of t){let o=this.#e.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),n=it(o);n&&this.remember(n)}this.dispatch({type:"set",ids:t})}};function dh(e,t){let r=o=>{ir(o)&&(o.preventDefault(),e.zoomBy(o.deltaY<0?1.1:.9090909090909091,o.clientX,o.clientY),t.repaint())};return e.svg.addEventListener("wheel",r,{passive:!1}),()=>{e.svg.removeEventListener("wheel",r)}}function ch(e,t,r,o={}){let n=o.selectable??!0,i=new In(e.svg,t,r),a=lh({display:e,emitter:t,diagramId:r,selection:i,selectable:n}),s=dh(e,i),l=ih(e.svg,i,n),d=nh(e.svg);return{getSelection:()=>i.getOwners(),select:c=>i.selectIds(c),repaint:()=>i.repaint(),flashChanged:(c,u)=>d.flash(c,u),destroy(){a(),s(),l(),d.destroy()}}}var xs={numbers:{intensity:.85,speed:.18,progress:-1,boost:0,dent:-1,day:-1,light:135,gloss:.15,depth:.4,rim:.2},colors:{color:[.08,.02,.22],accent:[.58,.31,1],hot:[1,.45,.82]}};var s1=`
19
19
  precision highp float;
20
20
 
21
21
  uniform vec2 uResolution;
@@ -67,7 +67,7 @@ void main() {
67
67
  float alpha = clamp(disc + shadow * (1.0 - disc), 0.0, 1.0);
68
68
  gl_FragColor = vec4(clamp(color * disc, 0.0, 1.0), alpha);
69
69
  }
70
- `,dh={name:"button",fragmentSource:o1,replacesBaseFill:!0};var n1=`
70
+ `,uh={name:"button",fragmentSource:s1,replacesBaseFill:!0};var l1=`
71
71
  precision highp float;
72
72
 
73
73
  uniform sampler2D uBackdrop;
@@ -133,7 +133,7 @@ void main() {
133
133
  face += uEdgeColor * movingGlint * bell(p.y - 0.26, 0.48) * left * 0.15;
134
134
  gl_FragColor = vec4(clamp(face * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
135
135
  }
136
- `,ch={name:"chromaticGlassPlate",fragmentSource:n1,usesBackdrop:!0,replacesBaseFill:!0};var i1=`
136
+ `,mh={name:"chromaticGlassPlate",fragmentSource:l1,usesBackdrop:!0,replacesBaseFill:!0};var d1=`
137
137
  precision highp float;
138
138
 
139
139
  uniform vec2 uResolution;
@@ -199,7 +199,7 @@ void main() {
199
199
 
200
200
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), clamp(alpha, 0.0, 1.0));
201
201
  }
202
- `,uh={name:"chromaticHalo",fragmentSource:i1};var a1=`
202
+ `,ph={name:"chromaticHalo",fragmentSource:d1};var c1=`
203
203
  precision highp float;
204
204
 
205
205
  uniform float uTime;
@@ -251,7 +251,7 @@ void main() {
251
251
 
252
252
  gl_FragColor = vec4(premultipliedColor, alpha);
253
253
  }
254
- `,mh={name:"eclipseOrb",fragmentSource:a1};var s1=`
254
+ `,fh={name:"eclipseOrb",fragmentSource:c1};var u1=`
255
255
  precision highp float;
256
256
 
257
257
  uniform vec2 uResolution;
@@ -323,7 +323,7 @@ void main() {
323
323
  float edge = 1.0 - smoothstep(0.955, 0.995, radius);
324
324
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
325
325
  }
326
- `,ph={name:"emberMatrix",fragmentSource:s1};var l1=`
326
+ `,hh={name:"emberMatrix",fragmentSource:u1};var m1=`
327
327
  precision highp float;
328
328
 
329
329
  uniform vec2 uResolution;
@@ -388,7 +388,7 @@ void main() {
388
388
  float alpha = clamp((molten * 0.92 + glowMask) * frameFade * max(uIntensity, 0.0), 0.0, 1.0);
389
389
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
390
390
  }
391
- `,fh={name:"emberSlits",fragmentSource:l1};var d1=`
391
+ `,gh={name:"emberSlits",fragmentSource:m1};var p1=`
392
392
  precision highp float;
393
393
 
394
394
  uniform vec2 uResolution;
@@ -540,7 +540,7 @@ void main() {
540
540
  color += (hash(gl_FragCoord.xy + t) - 0.5) * max(uGrain, 0.0);
541
541
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), edge);
542
542
  }
543
- `,hh={name:"glassDots",fragmentSource:d1,defaultParameters:{speed:0,intensity:1,dots:13,dotSize:.5,stagger:0,sphere:0,angle:0,spread:.86,warp:1,glow:.75,round:0,scatter:.45,lens:.75,grain:.06,baseColor:"#121212",colorA:"#f4b49c",colorB:"#4a9c93",colorC:"#34559c",colorD:"#ec3f93",rimColor:"#d93a24"}};var c1=`
543
+ `,yh={name:"glassDots",fragmentSource:p1,defaultParameters:{speed:0,intensity:1,dots:13,dotSize:.5,stagger:0,sphere:0,angle:0,spread:.86,warp:1,glow:.75,round:0,scatter:.45,lens:.75,grain:.06,baseColor:"#121212",colorA:"#f4b49c",colorB:"#4a9c93",colorC:"#34559c",colorD:"#ec3f93",rimColor:"#d93a24"}};var f1=`
544
544
  precision highp float;
545
545
 
546
546
  uniform sampler2D uBackdrop;
@@ -642,7 +642,7 @@ void main() {
642
642
  vec3 finalColor = clamp(color, 0.0, 1.0) * edgeAlpha;
643
643
  gl_FragColor = vec4(finalColor, edgeAlpha);
644
644
  }
645
- `,gh={name:"glassRefraction",fragmentSource:c1,usesBackdrop:!0};var u1=`
645
+ `,bh={name:"glassRefraction",fragmentSource:f1,usesBackdrop:!0};var h1=`
646
646
  precision highp float;
647
647
 
648
648
  uniform vec2 uResolution;
@@ -745,7 +745,7 @@ void main() {
745
745
  color += grit * max(uGrain, 0.0) * (0.3 + 2.2 * lit * (1.0 - 0.5 * lit));
746
746
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), shape);
747
747
  }
748
- `,yh={name:"glowCard",fragmentSource:u1,defaultParameters:{speed:.12,intensity:1,glowHeight:.55,glowSpread:1,core:.7,rim:.55,grain:.12,warp:1,angle:0,cornerRadius:.08,baseColor:"#0b0b12",colorA:"#2f6bff",colorB:"#9d5cff",colorC:"#34d3c4"}};var m1=`
748
+ `,xh={name:"glowCard",fragmentSource:h1,defaultParameters:{speed:.12,intensity:1,glowHeight:.55,glowSpread:1,core:.7,rim:.55,grain:.12,warp:1,angle:0,cornerRadius:.08,baseColor:"#0b0b12",colorA:"#2f6bff",colorB:"#9d5cff",colorC:"#34d3c4"}};var g1=`
749
749
  precision highp float;
750
750
 
751
751
  uniform vec2 uResolution;
@@ -821,7 +821,7 @@ void main() {
821
821
 
822
822
  gl_FragColor = vec4(clamp(finalColor * max(uIntensity, 0.0), 0.0, 1.0), alpha);
823
823
  }
824
- `,bh={name:"halftoneHalo",fragmentSource:m1};var p1=`
824
+ `,Sh={name:"halftoneHalo",fragmentSource:g1};var y1=`
825
825
  precision highp float;
826
826
 
827
827
  uniform vec2 uResolution;
@@ -893,7 +893,7 @@ void main() {
893
893
  float alpha = 1.0 - smoothstep(0.96, 1.0, radius);
894
894
  gl_FragColor = vec4(color, alpha);
895
895
  }
896
- `,xh={name:"halo",fragmentSource:p1};var f1=`
896
+ `,Ch={name:"halo",fragmentSource:y1};var b1=`
897
897
  precision highp float;
898
898
 
899
899
  uniform vec2 uResolution;
@@ -1006,7 +1006,7 @@ void main() {
1006
1006
  color += (hash(gl_FragCoord.xy) - 0.5) * max(uGrain, 0.0) * 0.2;
1007
1007
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), shape);
1008
1008
  }
1009
- `,Sh={name:"ledMatrix",fragmentSource:f1,defaultParameters:{speed:.25,intensity:1,columns:44,cellAspect:1.7,gap:.3,originX:.42,originY:.04,spread:1,drift:.2,depth:.5,glow:1,grain:.2,rotation:0,ripple:.3,wave:1,variation:.2,fade:.3,reaction:1,pointerSize:.17,trail:1.4,cornerRadius:.025,baseColor:"#050505",offColor:"#262626",color:"#a3a3a3",hotColor:"#ffffff"}};var h1=`
1009
+ `,kh={name:"ledMatrix",fragmentSource:b1,defaultParameters:{speed:.25,intensity:1,columns:44,cellAspect:1.7,gap:.3,originX:.42,originY:.04,spread:1,drift:.2,depth:.5,glow:1,grain:.2,rotation:0,ripple:.3,wave:1,variation:.2,fade:.3,reaction:1,pointerSize:.17,trail:1.4,cornerRadius:.025,baseColor:"#050505",offColor:"#262626",color:"#a3a3a3",hotColor:"#ffffff"}};var x1=`
1010
1010
  precision highp float;
1011
1011
 
1012
1012
  uniform vec2 uResolution;
@@ -1063,7 +1063,7 @@ void main() {
1063
1063
  color += (hash(gl_FragCoord.xy + t) - 0.5) * max(uGrain, 0.0);
1064
1064
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), shape);
1065
1065
  }
1066
- `,Ch={name:"lightBand",fragmentSource:h1,defaultParameters:{speed:.3,intensity:1,thickness:.035,bloom:1,wave:1,grain:.02,cornerRadius:.02,baseColor:"#0f0e14",colorA:"#7ea8ff",colorB:"#c13fd6",colorC:"#ff6fb8"}};var g1=`
1066
+ `,Rh={name:"lightBand",fragmentSource:x1,defaultParameters:{speed:.3,intensity:1,thickness:.035,bloom:1,wave:1,grain:.02,cornerRadius:.02,baseColor:"#0f0e14",colorA:"#7ea8ff",colorB:"#c13fd6",colorC:"#ff6fb8"}};var S1=`
1067
1067
  precision highp float;
1068
1068
 
1069
1069
  uniform float uTime;
@@ -1118,7 +1118,7 @@ void main() {
1118
1118
  vec3 premultiplied = color * body + glowColor * (1.0 - body) * halo * breath;
1119
1119
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1120
1120
  }
1121
- `,kh={name:"lumenPortal",fragmentSource:g1};var y1=`
1121
+ `,wh={name:"lumenPortal",fragmentSource:S1};var C1=`
1122
1122
  precision highp float;
1123
1123
 
1124
1124
  uniform float uTime;
@@ -1174,7 +1174,7 @@ void main() {
1174
1174
  premultiplied += mix(uShadowColor, rimColor, 0.58) * (1.0 - body) * outside * breath;
1175
1175
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1176
1176
  }
1177
- `,Rh={name:"lumenPortalLight",fragmentSource:y1};var b1=`
1177
+ `,vh={name:"lumenPortalLight",fragmentSource:C1};var k1=`
1178
1178
  precision highp float;
1179
1179
 
1180
1180
  uniform vec2 uResolution;
@@ -1207,7 +1207,7 @@ void main() {
1207
1207
  float alpha = 1.0 - smoothstep(0.94, 1.0, radius);
1208
1208
  gl_FragColor = vec4(color, alpha);
1209
1209
  }
1210
- `,wh={name:"orb",fragmentSource:b1};var x1=`
1210
+ `,Ph={name:"orb",fragmentSource:k1};var R1=`
1211
1211
  precision highp float;
1212
1212
 
1213
1213
  uniform float uTime;
@@ -1304,7 +1304,7 @@ void main() {
1304
1304
  float edge = 1.0 - smoothstep(0.965, 0.997, radius);
1305
1305
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
1306
1306
  }
1307
- `,vh={name:"pixelConstellation",fragmentSource:x1};var S1=`
1307
+ `,Lh={name:"pixelConstellation",fragmentSource:R1};var w1=`
1308
1308
  precision highp float;
1309
1309
 
1310
1310
  uniform vec2 uResolution;
@@ -1403,7 +1403,7 @@ void main() {
1403
1403
  float gain = max(uIntensity, 0.0) * fade;
1404
1404
  gl_FragColor = vec4(clamp(color * gain, 0.0, 1.0), clamp(alpha * gain, 0.0, 1.0));
1405
1405
  }
1406
- `,Ph={name:"plasmaGauge",fragmentSource:S1,replacesBaseFill:!0};var C1=`
1406
+ `,Mh={name:"plasmaGauge",fragmentSource:w1,replacesBaseFill:!0};var v1=`
1407
1407
  precision highp float;
1408
1408
 
1409
1409
  uniform vec2 uResolution;
@@ -1475,7 +1475,7 @@ void main() {
1475
1475
  float fade = 1.0 - smoothstep(0.88, 1.0, radius);
1476
1476
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * fade, 0.0, 1.0), fade);
1477
1477
  }
1478
- `,Lh={name:"prismSlats",fragmentSource:C1};var k1=`
1478
+ `,Th={name:"prismSlats",fragmentSource:v1};var P1=`
1479
1479
  precision highp float;
1480
1480
 
1481
1481
  uniform float uTime;
@@ -1574,7 +1574,7 @@ void main() {
1574
1574
  vec3 premultiplied = color * body * intensity + haloColor * halo;
1575
1575
  gl_FragColor = vec4(clamp(premultiplied, 0.0, 1.0), clamp(alpha, 0.0, 1.0));
1576
1576
  }
1577
- `,Mh={name:"reactivePanel",fragmentSource:k1,defaultParameters:{intensity:.5,speed:.18,emission:0,reception:.85,emitterFill:0,grain:0,grainScale:1.5,cornerRadius:18,borderWidth:2,glowRadius:90,lightX:.5,lightY:.5,lightStrength:0,baseColor:"#09101c",edgeColor:"#33b8ff",lightColor:"#59d1ff"},replacesBaseFill:!0};var R1=`
1577
+ `,$h={name:"reactivePanel",fragmentSource:P1,defaultParameters:{intensity:.5,speed:.18,emission:0,reception:.85,emitterFill:0,grain:0,grainScale:1.5,cornerRadius:18,borderWidth:2,glowRadius:90,lightX:.5,lightY:.5,lightStrength:0,baseColor:"#09101c",edgeColor:"#33b8ff",lightColor:"#59d1ff"},replacesBaseFill:!0};var L1=`
1578
1578
  precision highp float;
1579
1579
 
1580
1580
  uniform vec2 uResolution;
@@ -1676,7 +1676,7 @@ void main() {
1676
1676
  vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
1677
1677
  gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
1678
1678
  }
1679
- `,Th={name:"ruler",fragmentSource:R1,replacesBaseFill:!0};var w1=`
1679
+ `,Ah={name:"ruler",fragmentSource:L1,replacesBaseFill:!0};var M1=`
1680
1680
  precision highp float;
1681
1681
 
1682
1682
  uniform vec2 uResolution;
@@ -1758,7 +1758,7 @@ void main() {
1758
1758
  color += (hash(gl_FragCoord.xy) - 0.5) * max(uGrain, 0.0);
1759
1759
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), shape);
1760
1760
  }
1761
- `,$h={name:"silkFolds",fragmentSource:w1,defaultParameters:{speed:.2,intensity:1,scale:2.2,sharpness:5,depth:.5,glow:.3,grain:.08,rotation:0,ripple:.3,wave:1,variation:0,fade:.3,reaction:1,cornerRadius:.02,baseColor:"#030303",color:"#4d4d4d",highlightColor:"#ffffff"}};var v1=`
1761
+ `,Eh={name:"silkFolds",fragmentSource:M1,defaultParameters:{speed:.2,intensity:1,scale:2.2,sharpness:5,depth:.5,glow:.3,grain:.08,rotation:0,ripple:.3,wave:1,variation:0,fade:.3,reaction:1,cornerRadius:.02,baseColor:"#030303",color:"#4d4d4d",highlightColor:"#ffffff"}};var T1=`
1762
1762
  precision highp float;
1763
1763
 
1764
1764
  uniform vec2 uResolution;
@@ -1831,7 +1831,7 @@ void main() {
1831
1831
  vec3 premultiplied = orbColor * body + plumeColor * (1.0 - body) * plume;
1832
1832
  gl_FragColor = vec4(clamp(premultiplied * frameFade * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1833
1833
  }
1834
- `,Ah={name:"smearOrb",fragmentSource:v1,replacesBaseFill:!0};var P1=`
1834
+ `,Nh={name:"smearOrb",fragmentSource:T1,replacesBaseFill:!0};var $1=`
1835
1835
  precision highp float;
1836
1836
 
1837
1837
  uniform vec2 uResolution;
@@ -1887,7 +1887,7 @@ void main() {
1887
1887
  float alpha = tick * mix(0.32, 1.0, lit) * max(uIntensity, 0.0);
1888
1888
  gl_FragColor = vec4(color * alpha, clamp(alpha, 0.0, 1.0));
1889
1889
  }
1890
- `,Eh={name:"tickScale",fragmentSource:P1,replacesBaseFill:!0};var L1=`
1890
+ `,Oh={name:"tickScale",fragmentSource:$1,replacesBaseFill:!0};var A1=`
1891
1891
  precision highp float;
1892
1892
 
1893
1893
  uniform float uTime;
@@ -1964,7 +1964,7 @@ void main() {
1964
1964
  vec3 premultiplied = color * body + uColor * (1.0 - body) * halo * 0.48;
1965
1965
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1966
1966
  }
1967
- `,Nh={name:"violetGlass",fragmentSource:L1};var M1=`
1967
+ `,Bh={name:"violetGlass",fragmentSource:A1};var E1=`
1968
1968
  precision highp float;
1969
1969
 
1970
1970
  uniform float uTime;
@@ -2031,7 +2031,7 @@ void main() {
2031
2031
  premultiplied += mix(uShadowColor, uColor, 0.36) * (1.0 - body) * outside;
2032
2032
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
2033
2033
  }
2034
- `,Oh={name:"violetGlassLight",fragmentSource:M1};var T1=[wh,xh,bh,uh,ch,gh,fh,Ah,vh,Ph,Eh,Th,dh,Lh,mh,ph,Nh,Oh,kh,Rh,Mh,Sh,Ch,$h,yh,hh],$1=new Map(T1.map(e=>[e.name,e]));function Bh(e){return $1.get(e)}var A1=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function E1(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let o=t.getComputedStyle(r).backgroundColor;if(o&&!A1.test(o.trim()))return o}}function N1(e,t,r,o){let n=e.cloneNode(!0),i=[...e.children].indexOf(t);if(i>=0)for(;n.children.length>i;)n.lastElementChild?.remove();for(let s of n.querySelectorAll("foreignObject[data-sf-shader]"))s.remove();let a=E1(e);if(a){let{x:s,y:l,width:d,height:c}=e.viewBox.baseVal,u=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect");u.setAttribute("x",String(s)),u.setAttribute("y",String(l)),u.setAttribute("width",String(d)),u.setAttribute("height",String(c)),u.setAttribute("fill",a),n.insertBefore(u,n.firstChild)}return n.setAttribute("width",String(r)),n.setAttribute("height",String(o)),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n}function Ih(e,t){let r=Math.max(globalThis.devicePixelRatio||1,2.5),o=Math.min(r,4096/Math.max(1,Math.max(e.clientWidth,e.clientHeight))),n=Math.max(1,Math.round(e.clientWidth*o)),i=Math.max(1,Math.round(e.clientHeight*o));if(!e.ownerDocument.defaultView)return Promise.resolve(void 0);let s=new XMLSerializer().serializeToString(N1(e,t,n,i)),l=e.ownerDocument.createElement("img"),d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return new Promise(c=>{l.onload=()=>c({image:l,width:n,height:i}),l.onerror=()=>c(void 0),l.src=d})}function Ct(e,t){if(typeof e!="string")return t;let r=/^#([0-9a-f]{6})$/i.exec(e);if(!r)return t;let o=Number.parseInt(r[1],16);return[(o>>16&255)/255,(o>>8&255)/255,(o&255)/255]}function Ur(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function ye(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform1f(o,r)}function jr(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform3f(o,...r)}function Dn(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform2f(o,...r)}function Gn(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function O1(e,t){return{direction:{left:0,right:1,top:2,bottom:3},orientation:{vertical:0,horizontal:1},axis:{vertical:0,horizontal:1}}[e]?.[t]}function Dh(e,t){for(let[r,o]of Object.entries(e.parameters)){let n=Gn(r);if(typeof o=="number"){let a=e.parameters[`${r}Lag`];if(typeof a=="number"&&a>0){let s=e.smoothed.get(r)??o,l=s+(o-s)*(1-Math.exp(-t/a));e.smoothed.set(r,l),ye(e,n,l);continue}ye(e,n,o);continue}if(typeof o=="boolean"){let a=e.gl.getUniformLocation(e.program,n);a&&e.gl.uniform1i(a,o?1:0);continue}let i=O1(r,o);if(i!==void 0){ye(e,n,i);continue}/^#[0-9a-f]{6}$/i.test(o)&&jr(e,n,Ct(o,[0,0,0]))}}var B1=`
2034
+ `,Ih={name:"violetGlassLight",fragmentSource:E1};var N1=[Ph,Ch,Sh,ph,mh,bh,gh,Nh,Lh,Mh,Oh,Ah,uh,Th,fh,hh,Bh,Ih,wh,vh,$h,kh,Rh,Eh,xh,yh],O1=new Map(N1.map(e=>[e.name,e]));function Dh(e){return O1.get(e)}var B1=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function I1(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let o=t.getComputedStyle(r).backgroundColor;if(o&&!B1.test(o.trim()))return o}}function D1(e,t,r,o){let n=e.cloneNode(!0),i=[...e.children].indexOf(t);if(i>=0)for(;n.children.length>i;)n.lastElementChild?.remove();for(let s of n.querySelectorAll("foreignObject[data-sf-shader]"))s.remove();let a=I1(e);if(a){let{x:s,y:l,width:d,height:c}=e.viewBox.baseVal,u=e.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect");u.setAttribute("x",String(s)),u.setAttribute("y",String(l)),u.setAttribute("width",String(d)),u.setAttribute("height",String(c)),u.setAttribute("fill",a),n.insertBefore(u,n.firstChild)}return n.setAttribute("width",String(r)),n.setAttribute("height",String(o)),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n}function Gh(e,t){let r=Math.max(globalThis.devicePixelRatio||1,2.5),o=Math.min(r,4096/Math.max(1,Math.max(e.clientWidth,e.clientHeight))),n=Math.max(1,Math.round(e.clientWidth*o)),i=Math.max(1,Math.round(e.clientHeight*o));if(!e.ownerDocument.defaultView)return Promise.resolve(void 0);let s=new XMLSerializer().serializeToString(D1(e,t,n,i)),l=e.ownerDocument.createElement("img"),d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`;return new Promise(c=>{l.onload=()=>c({image:l,width:n,height:i}),l.onerror=()=>c(void 0),l.src=d})}function Ct(e,t){if(typeof e!="string")return t;let r=/^#([0-9a-f]{6})$/i.exec(e);if(!r)return t;let o=Number.parseInt(r[1],16);return[(o>>16&255)/255,(o>>8&255)/255,(o&255)/255]}function Ur(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function ye(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform1f(o,r)}function jr(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform3f(o,...r)}function Dn(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform2f(o,...r)}function Gn(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function G1(e,t){return{direction:{left:0,right:1,top:2,bottom:3},orientation:{vertical:0,horizontal:1},axis:{vertical:0,horizontal:1}}[e]?.[t]}function _h(e,t){for(let[r,o]of Object.entries(e.parameters)){let n=Gn(r);if(typeof o=="number"){let a=e.parameters[`${r}Lag`];if(typeof a=="number"&&a>0){let s=e.smoothed.get(r)??o,l=s+(o-s)*(1-Math.exp(-t/a));e.smoothed.set(r,l),ye(e,n,l);continue}ye(e,n,o);continue}if(typeof o=="boolean"){let a=e.gl.getUniformLocation(e.program,n);a&&e.gl.uniform1i(a,o?1:0);continue}let i=G1(r,o);if(i!==void 0){ye(e,n,i);continue}/^#[0-9a-f]{6}$/i.test(o)&&jr(e,n,Ct(o,[0,0,0]))}}var _1=`
2035
2035
  attribute vec2 aPosition;
2036
2036
  varying vec2 vUv;
2037
2037
 
@@ -2039,12 +2039,12 @@ void main() {
2039
2039
  vUv = aPosition * 0.5 + 0.5;
2040
2040
  gl_Position = vec4(aPosition, 0.0, 1.0);
2041
2041
  }
2042
- `;function Gh(e,t,r){let o=e.createShader(t);if(o){if(e.shaderSource(o,r),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS)){e.deleteShader(o);return}return o}}function _h(e,t){let r=Gh(e,e.VERTEX_SHADER,B1),o=Gh(e,e.FRAGMENT_SHADER,t);if(!r||!o){r&&e.deleteShader(r),o&&e.deleteShader(o);return}let n=e.createProgram();if(!n){e.deleteShader(r),e.deleteShader(o);return}if(e.attachShader(n,r),e.attachShader(n,o),e.linkProgram(n),e.deleteShader(r),e.deleteShader(o),!e.getProgramParameter(n,e.LINK_STATUS)){e.deleteProgram(n);return}return n}function Fh(e){let t=e.createTexture();if(t)return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),t}var I1=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function D1(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function G1(e){let t=Number(e.getAttribute("data-sf-shader-padding"));return Number.isFinite(t)?Math.max(0,t):0}function _1(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,I1,e.STATIC_DRAW);let o=e.getAttribLocation(t,"aPosition");if(o<0){e.deleteBuffer(r);return}return e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),r}function F1(e,t){let r=e.getAttribute("data-sf-id");return!t.replacesBaseFill||!r?void 0:[...e.closest("svg")?.querySelectorAll('[data-sf-primary="true"]')??[]].find(n=>n!==e&&n.getAttribute("data-sf-id")===r)}function Hh(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),o=r?Bh(r):void 0,n=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!o||!n)return;let i=_h(n,o.fragmentSource);if(!i)return;n.useProgram(i);let a=_1(n,i);if(!a){n.deleteProgram(i);return}let s=o.usesBackdrop===!0,l=F1(t,o),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{owner:t,canvas:e,gl:n,program:i,buffer:a,parameters:{...o.defaultParameters,...D1(t)},surfacePadding:G1(t),smoothed:new Map,pointer:{x:.5,y:.5},hovering:!1,hover:0,trail:[],backdropTexture:s?Fh(n):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:Ct(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function Vh(e){e.backdropTexture&&e.gl.deleteTexture(e.backdropTexture),e.gl.deleteBuffer(e.buffer),e.gl.deleteProgram(e.program),e.baseGeometry&&(e.baseFill===null||e.baseFill===void 0?e.baseGeometry.removeAttribute("fill"):e.baseGeometry.setAttribute("fill",e.baseFill))}function H1(e){let t=Number(e.owner.getAttribute("x")),r=Number(e.owner.getAttribute("y")),o=Number(e.owner.getAttribute("width")),n=Number(e.owner.getAttribute("height"));if(![t,r,o,n].every(Number.isFinite)||o<=0||n<=0)return;let i=e.owner.getCTM?.(),a=i?.a??1,s=i?.b??0,l=i?.c??0,d=i?.d??1,c=i?.e??0,u=i?.f??0,m=a*d-s*l,f=a*(t+o/2)+l*(r+n/2)+c,h=s*(t+o/2)+d*(r+n/2)+u;return{width:o,height:n,centerX:f,centerY:h,localPoint:(x,b)=>{if(Math.abs(m)<1e-6)return[x,b];let C=x-c,S=b-u;return[(d*C-l*S)/m,(-s*C+a*S)/m]}}}function Ss(e,t,r){return Ur(e[t],r)}function V1(e,t,r,o,n,i){return[(e-r)/n,(t-o)/i]}function _n(e){let t=e.filter(r=>r.owner.getAttribute("data-sf-shader")==="reactivePanel").flatMap(r=>{let o=H1(r);return o?[{surface:r,geometry:o}]:[]});for(let r of t){let o=[];for(let b of t){if(b.surface===r.surface)continue;let C=Math.max(0,b.surface.smoothed.get("emission")??Ss(b.surface.parameters,"emission",0));if(C<=1e-4)continue;let S=Math.hypot(b.geometry.centerX-r.geometry.centerX,b.geometry.centerY-r.geometry.centerY);o.push({candidate:b,emission:C,weight:C/Math.max(S,1)})}let n=o.reduce((b,C)=>b+C.weight,0);if(n<=0){r.surface.reactiveLight=void 0;continue}let i=0,a=0,s=0,l=0,d=[0,0,0];for(let b of o){let C=b.weight/n;i+=b.candidate.geometry.centerX*C,a+=b.candidate.geometry.centerY*C,s+=b.emission,l+=Math.max(1,Ss(b.candidate.surface.parameters,"glowRadius",90))*C;let S=Ct(b.candidate.surface.parameters.lightColor,[.35,.82,1]);d[0]+=S[0]*C,d[1]+=S[1]*C,d[2]+=S[2]*C}let c=Math.max(0,Ss(r.surface.parameters,"lightStrength",1)),[u,m]=r.geometry.localPoint(i,a),f=Number(r.surface.owner.getAttribute("x")),h=Number(r.surface.owner.getAttribute("y")),[y,x]=V1(u,m,f,h,r.geometry.width,r.geometry.height);r.surface.reactiveLight={x:y,y:x,strength:s*c*1.8,radius:l,color:d}}}function zh(e){let t=e.canvas.closest("svg");if(!t)return;let r=t.getBoundingClientRect(),o=e.canvas.getBoundingClientRect();r.width<=0||r.height<=0||(e.backdropOrigin=[(o.left-r.left)/r.width,(r.bottom-o.bottom)/r.height],e.backdropScale=[o.width/r.width,o.height/r.height])}function Yh(e,t){if(!e.backdropTexture)return;zh(e);let{gl:r}=e;r.bindTexture(r.TEXTURE_2D,e.backdropTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t.image)}var W1=2560,Wh=16;function ar(e,t){let{canvas:r,gl:o,parameters:n}=e,i=r.getBoundingClientRect(),a=Math.min(globalThis.devicePixelRatio||1,3),s=Math.min(1,W1/Math.max(1,i.width*a,i.height*a)),l=Math.max(1,Math.round((i.width||r.clientWidth)*a*s)),d=Math.max(1,Math.round((i.height||r.clientHeight)*a*s));(r.width!==l||r.height!==d)&&(r.width=l,r.height=d),o.viewport(0,0,l,d),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.useProgram(e.program);let c=o.getUniformLocation(e.program,"uResolution");c&&o.uniform2f(c,l,d);let u=Number(e.owner.getAttribute("width"));if(ye(e,"uPixelScale",Number.isFinite(u)&&u>0?l/u:a*s),ye(e,"uTime",t),e.backdropTexture){zh(e),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e.backdropTexture);let x=o.getUniformLocation(e.program,"uBackdrop");x&&o.uniform1i(x,0),Dn(e,"uBackdropOrigin",e.backdropOrigin),Dn(e,"uBackdropScale",e.backdropScale)}for(let[x,b]of Object.entries(xs.numbers))ye(e,Gn(x),Ur(n[x],b));for(let[x,b]of Object.entries(xs.colors))jr(e,Gn(x),Ct(n[x],[...b]));jr(e,"uShapeColor",e.shapeColor);let m=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,Dh(e,m),e.hover+=((e.hovering?1:0)-e.hover)*(1-Math.exp(-m/.18)),Dn(e,"uPointer",[e.pointer.x,e.pointer.y]),ye(e,"uHover",e.hover);let f=Ur(n.trail,0),h=new Float32Array(Wh*3);f>0&&e.trail.slice(-Wh).forEach((x,b)=>{h.set([x.x,x.y,Math.exp(-Math.max(t-x.at,0)/f)],b*3)});let y=o.getUniformLocation(e.program,"uWake[0]");y&&o.uniform3fv(y,h),e.reactiveLight&&(ye(e,"uLightX",e.reactiveLight.x),ye(e,"uLightY",e.reactiveLight.y),ye(e,"uLightStrength",e.reactiveLight.strength),ye(e,"uGlowRadius",e.reactiveLight.radius),jr(e,"uLightColor",e.reactiveLight.color)),ye(e,"uSurfacePadding",e.surfacePadding),o.drawArrays(o.TRIANGLES,0,6)}function Uh(e){let t=null,r=0,o=()=>(e?.performance.now()??0)/1e3;return{now:()=>(t??o())-r,paused:()=>t!==null,spent:()=>r,setPaused(n){n&&t===null?t=o():!n&&t!==null&&(r+=o()-t,t=null)}}}var z1=120,Y1=.055,U1=16;function j1(e,t,r){let o=new Map(t.map(n=>[n.canvas,n]));return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].map(n=>{let i=o.get(n);if(i)try{return ar(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function X1(e,t,r,o){let n=!1;for(let i of e)i.owner.getAttribute("data-sf-id")===t&&(Object.assign(i.parameters,r),i.owner.setAttribute("data-sf-shader-params",JSON.stringify(i.parameters)),n=!0);if(n){_n(e);for(let i of e)ar(i,o)}return n}function q1(e,t,r){if(!t)return()=>{};let o=new t.MutationObserver(r);o.observe(e,{attributes:!0,attributeFilter:["viewBox"]});let n=t.ResizeObserver?new t.ResizeObserver(r):void 0;return n?.observe(e),()=>{o.disconnect(),n?.disconnect()}}function Cs(e){let t=[],r,o=0,n,i=e.ownerDocument.defaultView,a=Uh(i),s=b=>{if(!a.paused()){_n(t);for(let C of t)ar(C,b/1e3-a.spent())}r=i?.requestAnimationFrame(s)},l=()=>{r!==void 0&&(i?.cancelAnimationFrame(r),r=void 0);for(let b of t)Vh(b);t=[]},d=b=>{for(let C of t)C.usesBackdrop&&Ih(e,C.owner).then(S=>{S&&b===o&&Yh(C,S)})},c=()=>{if(!i?.requestAnimationFrame){for(let b of t)ar(b,0);return}if(a.paused())for(let b of t)ar(b,a.now());r=i.requestAnimationFrame(s)},u=()=>{let b=new Map(t.flatMap(S=>{let w=S.owner.getAttribute("data-sf-id");return w?[[w,{smoothed:new Map(S.smoothed),reactiveLight:S.reactiveLight,pointer:S.pointer,hover:S.hover,hovering:S.hovering,trail:S.trail}]]:[]}));l();let C=++o;t=[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(S=>{let w=Hh(S),O=w?.owner.getAttribute("data-sf-id"),A=O?b.get(O):void 0;return w&&A&&(w.smoothed=A.smoothed,w.reactiveLight=A.reactiveLight,w.pointer=A.pointer,w.hover=A.hover,w.hovering=A.hovering,w.trail=A.trail),w?[w]:[]}),_n(t),d(C),t.length>0&&c()},f=q1(e,i,()=>{n!==void 0&&i?.clearTimeout(n),n=i?.setTimeout(()=>{n=void 0,d(o)},z1)}),h=b=>{for(let C of t){let S=C.canvas.getBoundingClientRect(),w=S.width>0&&S.height>0&&b.clientX>=S.left&&b.clientX<=S.right&&b.clientY>=S.top&&b.clientY<=S.bottom;if(C.hovering=w,w){C.pointer={x:(b.clientX-S.left)/S.width,y:1-(b.clientY-S.top)/S.height};let O=a.now(),A=C.trail[C.trail.length-1];(!A||O-A.at>=Y1)&&(C.trail.push({...C.pointer,at:O}),C.trail.length>U1&&C.trail.shift())}}},y=()=>{for(let b of t)b.hovering=!1};e.addEventListener("pointermove",h),e.addEventListener("pointerleave",y),u();let x=()=>{o+=1,f(),e.removeEventListener("pointermove",h),e.removeEventListener("pointerleave",y),n!==void 0&&i?.clearTimeout(n),l()};return{capture:()=>j1(e,t,a.now()),setParameters:(b,C)=>X1(t,b,C,a.now()),setPaused:a.setPaused,refresh:u,destroy:x}}function Fn(e,t){let r=e.svg??(e.source!=null?yn(e.source,{...e.renderOptions??t,linkHitAreas:!0}).svg:null);if(r==null)throw new Error("createViewer: provide either `source` (SFL) or `svg`.");return r}function jh(e){let t=Pn(e);if(!Ln(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function Xh(e){let t=Pn(e);if(!Ln(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var Hn=class{constructor(t,r,o){this.options=t;this.diagramId=o;this.display=zf(t.container,r),this.shaderSurfaces=Cs(this.display.svg),this.documentComponents=Ga(this.display.svg),this.interaction=t.interactive?lh(this.display,this.emitter,o,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new wn;display;interaction;shaderSurfaces;documentComponents;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=Of(this.display.svg,r=>this.rulerProgressOverrides.get(r));for(let[r,o]of t)this.setShaderParameters(r,{knobRadius:o})}get svg(){return this.display.svg}on(t,r){return this.emitter.on(t,r)}getSelection(){return this.interaction?.getSelection()??[]}select(t){this.interaction?.select(t)}fit(){this.display.fit(),this.interaction?.repaint()}getViewport(){return this.display.getViewport()}exportSvg(){return Ya(this.svg,this.shaderSurfaces.capture())}exportImage(t){return Wa(this.svg,this.exportSvg(),t)}setShaderParameters(t,r){let o={...this.shaderParameterOverrides.get(t),...r};return this.shaderParameterOverrides.set(t,o),this.shaderSurfaces.setParameters(t,r)}setWidgetValue(t,r){return this.setComponentValue(t,r)}setComponentValue(t,r){if(this.documentComponents.setValue(t,r))return!0;let o=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="ruler"]')].find(a=>a.getAttribute("data-sf-id")===t);if(o){let a=Ef(o,Number(r));this.rulerProgressOverrides.set(t,a);let s=this.setShaderParameters(t,{progress:a});return this.placeKnobs(),s}let n=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="tickScale"]')].find(a=>a.getAttribute("data-sf-id")===t);if(!n)return!1;let i=100;try{i=Number(JSON.parse(n.getAttribute("data-sf-shader-params")??"{}").max)||100}catch{i=100}return this.setShaderParameters(t,{progress:Math.min(1,Math.max(0,Number(r)/i))})}setPaused(t){this.shaderSurfaces.setPaused(t)}clearOverrides(){this.shaderParameterOverrides.clear(),this.rulerProgressOverrides.clear(),this.documentComponents.clearValues()}update(t){let r=Fn(t,this.options.renderOptions);Xh(r);let o=this.display.updateContent(r);this.shaderSurfaces.refresh(),this.documentComponents.refresh(),this.placeKnobs();for(let[i,a]of this.shaderParameterOverrides)this.shaderSurfaces.setParameters(i,a);t.resetView&&this.display.fit();let n=this.interaction?.getSelection().map(i=>i.id)??[];if(n.length>0&&this.interaction?.select(n),this.emitter.emit("sceneDiff",{diagramId:this.diagramId,...o}),t.highlightChanges){let i=typeof t.highlightChanges=="object"?t.highlightChanges.color:void 0;this.interaction?.flashChanged([...o.added,...o.changed],i)}}announceReady(){queueMicrotask(()=>this.emitter.emit("ready",{diagramId:this.diagramId}))}destroy(){this.interaction?.destroy(),this.shaderSurfaces.destroy(),this.documentComponents.destroy(),this.shaderParameterOverrides.clear(),this.display.destroy(),this.emitter.clear()}};function qh(e){let t=e.diagramId??"diagram",r=Fn(e,e.renderOptions);jh(r);let o=new Hn(e,r,t);return o.announceReady(),o}var K1=`
2042
+ `;function Fh(e,t,r){let o=e.createShader(t);if(o){if(e.shaderSource(o,r),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS)){e.deleteShader(o);return}return o}}function Hh(e,t){let r=Fh(e,e.VERTEX_SHADER,_1),o=Fh(e,e.FRAGMENT_SHADER,t);if(!r||!o){r&&e.deleteShader(r),o&&e.deleteShader(o);return}let n=e.createProgram();if(!n){e.deleteShader(r),e.deleteShader(o);return}if(e.attachShader(n,r),e.attachShader(n,o),e.linkProgram(n),e.deleteShader(r),e.deleteShader(o),!e.getProgramParameter(n,e.LINK_STATUS)){e.deleteProgram(n);return}return n}function Vh(e){let t=e.createTexture();if(t)return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),t}var F1=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function H1(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function V1(e){let t=Number(e.getAttribute("data-sf-shader-padding"));return Number.isFinite(t)?Math.max(0,t):0}function W1(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,F1,e.STATIC_DRAW);let o=e.getAttribLocation(t,"aPosition");if(o<0){e.deleteBuffer(r);return}return e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),r}function z1(e,t){let r=e.getAttribute("data-sf-id");return!t.replacesBaseFill||!r?void 0:[...e.closest("svg")?.querySelectorAll('[data-sf-primary="true"]')??[]].find(n=>n!==e&&n.getAttribute("data-sf-id")===r)}function Wh(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),o=r?Dh(r):void 0,n=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!o||!n)return;let i=Hh(n,o.fragmentSource);if(!i)return;n.useProgram(i);let a=W1(n,i);if(!a){n.deleteProgram(i);return}let s=o.usesBackdrop===!0,l=z1(t,o),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{owner:t,canvas:e,gl:n,program:i,buffer:a,parameters:{...o.defaultParameters,...H1(t)},surfacePadding:V1(t),smoothed:new Map,pointer:{x:.5,y:.5},hovering:!1,hover:0,trail:[],backdropTexture:s?Vh(n):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:Ct(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function zh(e){e.backdropTexture&&e.gl.deleteTexture(e.backdropTexture),e.gl.deleteBuffer(e.buffer),e.gl.deleteProgram(e.program),e.baseGeometry&&(e.baseFill===null||e.baseFill===void 0?e.baseGeometry.removeAttribute("fill"):e.baseGeometry.setAttribute("fill",e.baseFill))}function Y1(e){let t=Number(e.owner.getAttribute("x")),r=Number(e.owner.getAttribute("y")),o=Number(e.owner.getAttribute("width")),n=Number(e.owner.getAttribute("height"));if(![t,r,o,n].every(Number.isFinite)||o<=0||n<=0)return;let i=e.owner.getCTM?.(),a=i?.a??1,s=i?.b??0,l=i?.c??0,d=i?.d??1,c=i?.e??0,u=i?.f??0,m=a*d-s*l,f=a*(t+o/2)+l*(r+n/2)+c,h=s*(t+o/2)+d*(r+n/2)+u;return{width:o,height:n,centerX:f,centerY:h,localPoint:(x,b)=>{if(Math.abs(m)<1e-6)return[x,b];let C=x-c,S=b-u;return[(d*C-l*S)/m,(-s*C+a*S)/m]}}}function Ss(e,t,r){return Ur(e[t],r)}function U1(e,t,r,o,n,i){return[(e-r)/n,(t-o)/i]}function _n(e){let t=e.filter(r=>r.owner.getAttribute("data-sf-shader")==="reactivePanel").flatMap(r=>{let o=Y1(r);return o?[{surface:r,geometry:o}]:[]});for(let r of t){let o=[];for(let b of t){if(b.surface===r.surface)continue;let C=Math.max(0,b.surface.smoothed.get("emission")??Ss(b.surface.parameters,"emission",0));if(C<=1e-4)continue;let S=Math.hypot(b.geometry.centerX-r.geometry.centerX,b.geometry.centerY-r.geometry.centerY);o.push({candidate:b,emission:C,weight:C/Math.max(S,1)})}let n=o.reduce((b,C)=>b+C.weight,0);if(n<=0){r.surface.reactiveLight=void 0;continue}let i=0,a=0,s=0,l=0,d=[0,0,0];for(let b of o){let C=b.weight/n;i+=b.candidate.geometry.centerX*C,a+=b.candidate.geometry.centerY*C,s+=b.emission,l+=Math.max(1,Ss(b.candidate.surface.parameters,"glowRadius",90))*C;let S=Ct(b.candidate.surface.parameters.lightColor,[.35,.82,1]);d[0]+=S[0]*C,d[1]+=S[1]*C,d[2]+=S[2]*C}let c=Math.max(0,Ss(r.surface.parameters,"lightStrength",1)),[u,m]=r.geometry.localPoint(i,a),f=Number(r.surface.owner.getAttribute("x")),h=Number(r.surface.owner.getAttribute("y")),[y,x]=U1(u,m,f,h,r.geometry.width,r.geometry.height);r.surface.reactiveLight={x:y,y:x,strength:s*c*1.8,radius:l,color:d}}}function Uh(e){let t=e.canvas.closest("svg");if(!t)return;let r=t.getBoundingClientRect(),o=e.canvas.getBoundingClientRect();r.width<=0||r.height<=0||(e.backdropOrigin=[(o.left-r.left)/r.width,(r.bottom-o.bottom)/r.height],e.backdropScale=[o.width/r.width,o.height/r.height])}function jh(e,t){if(!e.backdropTexture)return;Uh(e);let{gl:r}=e;r.bindTexture(r.TEXTURE_2D,e.backdropTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,1),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t.image)}var j1=2560,Yh=16;function ar(e,t){let{canvas:r,gl:o,parameters:n}=e,i=r.getBoundingClientRect(),a=Math.min(globalThis.devicePixelRatio||1,3),s=Math.min(1,j1/Math.max(1,i.width*a,i.height*a)),l=Math.max(1,Math.round((i.width||r.clientWidth)*a*s)),d=Math.max(1,Math.round((i.height||r.clientHeight)*a*s));(r.width!==l||r.height!==d)&&(r.width=l,r.height=d),o.viewport(0,0,l,d),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.useProgram(e.program);let c=o.getUniformLocation(e.program,"uResolution");c&&o.uniform2f(c,l,d);let u=Number(e.owner.getAttribute("width"));if(ye(e,"uPixelScale",Number.isFinite(u)&&u>0?l/u:a*s),ye(e,"uTime",t),e.backdropTexture){Uh(e),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,e.backdropTexture);let x=o.getUniformLocation(e.program,"uBackdrop");x&&o.uniform1i(x,0),Dn(e,"uBackdropOrigin",e.backdropOrigin),Dn(e,"uBackdropScale",e.backdropScale)}for(let[x,b]of Object.entries(xs.numbers))ye(e,Gn(x),Ur(n[x],b));for(let[x,b]of Object.entries(xs.colors))jr(e,Gn(x),Ct(n[x],[...b]));jr(e,"uShapeColor",e.shapeColor);let m=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,_h(e,m),e.hover+=((e.hovering?1:0)-e.hover)*(1-Math.exp(-m/.18)),Dn(e,"uPointer",[e.pointer.x,e.pointer.y]),ye(e,"uHover",e.hover);let f=Ur(n.trail,0),h=new Float32Array(Yh*3);f>0&&e.trail.slice(-Yh).forEach((x,b)=>{h.set([x.x,x.y,Math.exp(-Math.max(t-x.at,0)/f)],b*3)});let y=o.getUniformLocation(e.program,"uWake[0]");y&&o.uniform3fv(y,h),e.reactiveLight&&(ye(e,"uLightX",e.reactiveLight.x),ye(e,"uLightY",e.reactiveLight.y),ye(e,"uLightStrength",e.reactiveLight.strength),ye(e,"uGlowRadius",e.reactiveLight.radius),jr(e,"uLightColor",e.reactiveLight.color)),ye(e,"uSurfacePadding",e.surfacePadding),o.drawArrays(o.TRIANGLES,0,6)}function Xh(e){let t=null,r=0,o=()=>(e?.performance.now()??0)/1e3;return{now:()=>(t??o())-r,paused:()=>t!==null,spent:()=>r,setPaused(n){n&&t===null?t=o():!n&&t!==null&&(r+=o()-t,t=null)}}}var X1=120,q1=.055,K1=16;function Z1(e,t,r){let o=new Map(t.map(n=>[n.canvas,n]));return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].map(n=>{let i=o.get(n);if(i)try{return ar(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function Q1(e,t,r,o){let n=!1;for(let i of e)i.owner.getAttribute("data-sf-id")===t&&(Object.assign(i.parameters,r),i.owner.setAttribute("data-sf-shader-params",JSON.stringify(i.parameters)),n=!0);if(n){_n(e);for(let i of e)ar(i,o)}return n}function J1(e,t,r){if(!t)return()=>{};let o=new t.MutationObserver(r);o.observe(e,{attributes:!0,attributeFilter:["viewBox"]});let n=t.ResizeObserver?new t.ResizeObserver(r):void 0;return n?.observe(e),()=>{o.disconnect(),n?.disconnect()}}function Cs(e){let t=[],r,o=0,n,i=e.ownerDocument.defaultView,a=Xh(i),s=b=>{if(!a.paused()){_n(t);for(let C of t)ar(C,b/1e3-a.spent())}r=i?.requestAnimationFrame(s)},l=()=>{r!==void 0&&(i?.cancelAnimationFrame(r),r=void 0);for(let b of t)zh(b);t=[]},d=b=>{for(let C of t)C.usesBackdrop&&Gh(e,C.owner).then(S=>{S&&b===o&&jh(C,S)})},c=()=>{if(!i?.requestAnimationFrame){for(let b of t)ar(b,0);return}if(a.paused())for(let b of t)ar(b,a.now());r=i.requestAnimationFrame(s)},u=()=>{let b=new Map(t.flatMap(S=>{let w=S.owner.getAttribute("data-sf-id");return w?[[w,{smoothed:new Map(S.smoothed),reactiveLight:S.reactiveLight,pointer:S.pointer,hover:S.hover,hovering:S.hovering,trail:S.trail}]]:[]}));l();let C=++o;t=[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(S=>{let w=Wh(S),O=w?.owner.getAttribute("data-sf-id"),A=O?b.get(O):void 0;return w&&A&&(w.smoothed=A.smoothed,w.reactiveLight=A.reactiveLight,w.pointer=A.pointer,w.hover=A.hover,w.hovering=A.hovering,w.trail=A.trail),w?[w]:[]}),_n(t),d(C),t.length>0&&c()},f=J1(e,i,()=>{n!==void 0&&i?.clearTimeout(n),n=i?.setTimeout(()=>{n=void 0,d(o)},X1)}),h=b=>{for(let C of t){let S=C.canvas.getBoundingClientRect(),w=S.width>0&&S.height>0&&b.clientX>=S.left&&b.clientX<=S.right&&b.clientY>=S.top&&b.clientY<=S.bottom;if(C.hovering=w,w){C.pointer={x:(b.clientX-S.left)/S.width,y:1-(b.clientY-S.top)/S.height};let O=a.now(),A=C.trail[C.trail.length-1];(!A||O-A.at>=q1)&&(C.trail.push({...C.pointer,at:O}),C.trail.length>K1&&C.trail.shift())}}},y=()=>{for(let b of t)b.hovering=!1};e.addEventListener("pointermove",h),e.addEventListener("pointerleave",y),u();let x=()=>{o+=1,f(),e.removeEventListener("pointermove",h),e.removeEventListener("pointerleave",y),n!==void 0&&i?.clearTimeout(n),l()};return{capture:()=>Z1(e,t,a.now()),setParameters:(b,C)=>Q1(t,b,C,a.now()),setPaused:a.setPaused,refresh:u,destroy:x}}function Fn(e,t){let r=e.svg??(e.source!=null?yn(e.source,{...e.renderOptions??t,linkHitAreas:!0}).svg:null);if(r==null)throw new Error("createViewer: provide either `source` (SFL) or `svg`.");return r}function qh(e){let t=Pn(e);if(!Ln(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function Kh(e){let t=Pn(e);if(!Ln(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var Hn=class{constructor(t,r,o){this.options=t;this.diagramId=o;this.display=Uf(t.container,r),this.shaderSurfaces=Cs(this.display.svg),this.documentComponents=Ga(this.display.svg),this.interaction=t.interactive?ch(this.display,this.emitter,o,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new wn;display;interaction;shaderSurfaces;documentComponents;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=Bf(this.display.svg,r=>this.rulerProgressOverrides.get(r));for(let[r,o]of t)this.setShaderParameters(r,{knobRadius:o})}get svg(){return this.display.svg}on(t,r){return this.emitter.on(t,r)}getSelection(){return this.interaction?.getSelection()??[]}select(t){this.interaction?.select(t)}fit(){this.display.fit(),this.interaction?.repaint()}getViewport(){return this.display.getViewport()}exportSvg(){return Ya(this.svg,this.shaderSurfaces.capture())}exportImage(t){return Wa(this.svg,this.exportSvg(),t)}setShaderParameters(t,r){let o={...this.shaderParameterOverrides.get(t),...r};return this.shaderParameterOverrides.set(t,o),this.shaderSurfaces.setParameters(t,r)}setWidgetValue(t,r){return this.setComponentValue(t,r)}setComponentValue(t,r){if(this.documentComponents.setValue(t,r))return!0;let o=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="ruler"]')].find(a=>a.getAttribute("data-sf-id")===t);if(o){let a=Nf(o,Number(r));this.rulerProgressOverrides.set(t,a);let s=this.setShaderParameters(t,{progress:a});return this.placeKnobs(),s}let n=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="tickScale"]')].find(a=>a.getAttribute("data-sf-id")===t);if(!n)return!1;let i=100;try{i=Number(JSON.parse(n.getAttribute("data-sf-shader-params")??"{}").max)||100}catch{i=100}return this.setShaderParameters(t,{progress:Math.min(1,Math.max(0,Number(r)/i))})}setPaused(t){this.shaderSurfaces.setPaused(t)}clearOverrides(){this.shaderParameterOverrides.clear(),this.rulerProgressOverrides.clear(),this.documentComponents.clearValues()}update(t){let r=Fn(t,this.options.renderOptions);Kh(r);let o=this.display.updateContent(r);this.shaderSurfaces.refresh(),this.documentComponents.refresh(),this.placeKnobs();for(let[i,a]of this.shaderParameterOverrides)this.shaderSurfaces.setParameters(i,a);t.resetView&&this.display.fit();let n=this.interaction?.getSelection().map(i=>i.id)??[];if(n.length>0&&this.interaction?.select(n),this.emitter.emit("sceneDiff",{diagramId:this.diagramId,...o}),t.highlightChanges){let i=typeof t.highlightChanges=="object"?t.highlightChanges.color:void 0;this.interaction?.flashChanged([...o.added,...o.changed],i)}}announceReady(){queueMicrotask(()=>this.emitter.emit("ready",{diagramId:this.diagramId}))}destroy(){this.interaction?.destroy(),this.shaderSurfaces.destroy(),this.documentComponents.destroy(),this.shaderParameterOverrides.clear(),this.display.destroy(),this.emitter.clear()}};function Zh(e){let t=e.diagramId??"diagram",r=Fn(e,e.renderOptions);qh(r);let o=new Hn(e,r,t);return o.announceReady(),o}var e2=`
2043
2043
  :host { display: block; position: relative; }
2044
2044
  .sf-container { width: 100%; height: 100%; }
2045
2045
  svg { display: block; max-width: 100%; }
2046
2046
  .sf-error { color: #b91c1c; font: 13px/1.4 system-ui, sans-serif; padding: 8px; white-space: pre-wrap; }
2047
2047
  [data-sf-role="entity"], [data-sf-role="link"] { cursor: pointer; }
2048
2048
  [data-sf-selected] { stroke: #2563eb !important; stroke-width: 4 !important; }
2049
- `;function Z1(e){let t=document.createElement("style");t.textContent=K1;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function Q1(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function J1(e,t,r){return qh({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function e2(e,t,r){e.innerHTML=yn(t,{padding:r.padding}).svg}function Kh(e,t){let r=Z1(e);if(t.source===null)return{viewer:null,rendered:!1};try{let o=t.interactive?J1(r,t.source,t):null;return t.interactive||e2(r,t.source,t),{viewer:o,rendered:!0}}catch(o){return Q1(r,o),{viewer:null,rendered:!1}}}var t2=typeof HTMLElement>"u"?class{}:HTMLElement,kt=class extends t2{static get observedAttributes(){return[...vs]}root;view=null;sourceProp=null;constructor(){super(),this.root=this.attachShadow({mode:"open"})}connectedCallback(){this.rerender()}disconnectedCallback(){this.teardown()}attributeChangedCallback(){this.isConnected&&this.rerender()}set source(t){this.sourceProp=t,this.isConnected&&this.rerender()}get source(){return this.sourceProp??this.getAttribute("source")}get viewer(){return this.view}config(){let t=Ps(r=>this.getAttribute(r));return{...t,source:this.sourceProp??t.source}}teardown(){this.view?.destroy(),this.view=null,this.root.replaceChildren()}rerender(){this.teardown();let t=this.config(),r=Kh(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function ks(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,kt)}ks();return ig(r2);})();
2049
+ `;function t2(e){let t=document.createElement("style");t.textContent=e2;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function r2(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function o2(e,t,r){return Zh({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function n2(e,t,r){e.innerHTML=yn(t,{padding:r.padding}).svg}function Qh(e,t){let r=t2(e);if(t.source===null)return{viewer:null,rendered:!1};try{let o=t.interactive?o2(r,t.source,t):null;return t.interactive||n2(r,t.source,t),{viewer:o,rendered:!0}}catch(o){return r2(r,o),{viewer:null,rendered:!1}}}var i2=typeof HTMLElement>"u"?class{}:HTMLElement,kt=class extends i2{static get observedAttributes(){return[...vs]}root;view=null;sourceProp=null;constructor(){super(),this.root=this.attachShadow({mode:"open"})}connectedCallback(){this.rerender()}disconnectedCallback(){this.teardown()}attributeChangedCallback(){this.isConnected&&this.rerender()}set source(t){this.sourceProp=t,this.isConnected&&this.rerender()}get source(){return this.sourceProp??this.getAttribute("source")}get viewer(){return this.view}config(){let t=Ps(r=>this.getAttribute(r));return{...t,source:this.sourceProp??t.source}}teardown(){this.view?.destroy(),this.view=null,this.root.replaceChildren()}rerender(){this.teardown();let t=this.config(),r=Qh(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function ks(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,kt)}ks();return sg(a2);})();
2050
2050
  //# sourceMappingURL=stickyflow-diagram.global.js.map