stickyflow 0.11.3 → 0.12.0

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 (52) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/binding/index.cjs +9 -9
  3. package/dist/binding/index.d.cts +3 -3
  4. package/dist/binding/index.d.ts +3 -3
  5. package/dist/binding/index.js +3 -3
  6. package/dist/{chunk-WZA3DJJH.cjs → chunk-3OF37CZX.cjs} +15 -15
  7. package/dist/{chunk-WZA3DJJH.cjs.map → chunk-3OF37CZX.cjs.map} +1 -1
  8. package/dist/{chunk-V22J7Z4H.cjs → chunk-3XPNGIMV.cjs} +37 -37
  9. package/dist/chunk-3XPNGIMV.cjs.map +1 -0
  10. package/dist/{chunk-G6IW2IX3.js → chunk-4SXXMOXR.js} +31 -5
  11. package/dist/chunk-4SXXMOXR.js.map +1 -0
  12. package/dist/{chunk-GQRJSA73.cjs → chunk-EG7VZJZX.cjs} +23 -23
  13. package/dist/{chunk-GQRJSA73.cjs.map → chunk-EG7VZJZX.cjs.map} +1 -1
  14. package/dist/{chunk-BFQWCOEC.js → chunk-FYSJMUJI.js} +3 -3
  15. package/dist/{chunk-BFQWCOEC.js.map → chunk-FYSJMUJI.js.map} +1 -1
  16. package/dist/{chunk-W25SXORW.js → chunk-LDRUTQF7.js} +4 -4
  17. package/dist/{chunk-W25SXORW.js.map → chunk-LDRUTQF7.js.map} +1 -1
  18. package/dist/{chunk-IQQ5KBL6.js → chunk-Q4OIDWT6.js} +6 -6
  19. package/dist/chunk-Q4OIDWT6.js.map +1 -0
  20. package/dist/{chunk-UHKFJBY5.cjs → chunk-SKGJXCAO.cjs} +31 -5
  21. package/dist/chunk-SKGJXCAO.cjs.map +1 -0
  22. package/dist/{chunk-EBHO2FJ5.js → chunk-UCOMSZPC.js} +10 -9
  23. package/dist/chunk-UCOMSZPC.js.map +1 -0
  24. package/dist/{chunk-K5PGMZAD.cjs → chunk-ZE2KRWOM.cjs} +663 -662
  25. package/dist/chunk-ZE2KRWOM.cjs.map +1 -0
  26. package/dist/index.cjs +36 -36
  27. package/dist/index.d.cts +3 -3
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.js +5 -5
  30. package/dist/interaction/index.cjs +275 -237
  31. package/dist/interaction/index.cjs.map +1 -1
  32. package/dist/interaction/index.js +41 -3
  33. package/dist/interaction/index.js.map +1 -1
  34. package/dist/{runtime-C-C5v9po.d.cts → runtime-BJDaqo6f.d.cts} +1 -1
  35. package/dist/{runtime-lCAfU-1Q.d.ts → runtime-DaconR36.d.ts} +1 -1
  36. package/dist/{runtimeTypes-BDA_CfWh.d.ts → runtimeTypes-BE_GI1yU.d.ts} +1 -1
  37. package/dist/{runtimeTypes-B7p6b1Bi.d.cts → runtimeTypes-BE_nllY6.d.cts} +1 -1
  38. package/dist/stickyflow-diagram.global.js +39 -39
  39. package/dist/stickyflow-diagram.global.js.map +1 -1
  40. package/dist/viewer/index.cjs +9 -9
  41. package/dist/viewer/index.d.cts +1 -1
  42. package/dist/viewer/index.d.ts +1 -1
  43. package/dist/viewer/index.js +4 -4
  44. package/dist/web-component/index.cjs +6 -6
  45. package/dist/web-component/index.js +4 -4
  46. package/package.json +1 -1
  47. package/dist/chunk-EBHO2FJ5.js.map +0 -1
  48. package/dist/chunk-G6IW2IX3.js.map +0 -1
  49. package/dist/chunk-IQQ5KBL6.js.map +0 -1
  50. package/dist/chunk-K5PGMZAD.cjs.map +0 -1
  51. package/dist/chunk-UHKFJBY5.cjs.map +0 -1
  52. package/dist/chunk-V22J7Z4H.cjs.map +0 -1
@@ -1,21 +1,21 @@
1
- "use strict";var Stickyflow=(()=>{var qn=Object.defineProperty;var Pg=Object.getOwnPropertyDescriptor;var Lg=Object.getOwnPropertyNames;var Mg=Object.prototype.hasOwnProperty;var Tg=(e,t)=>{for(var r in t)qn(e,r,{get:t[r],enumerable:!0})},$g=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Lg(t))!Mg.call(e,n)&&n!==r&&qn(e,n,{get:()=>t[n],enumerable:!(o=Pg(t,n))||o.enumerable});return e};var Ag=e=>$g(qn({},"__esModule",{value:!0}),e);var xP={};Tg(xP,{StickyflowDiagram:()=>wt,defineStickyflowDiagram:()=>Gs});var Fs=["source","interactive","padding","diagram-id"],Eg=e=>e!==null&&e!=="false";function Hs(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:Eg(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}function ur(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Vs=["rollingNumber","tickScale","ruler"];function st(e){return e!==void 0&&Vs.includes(e)}function Jr(e){return!st(e.type)}var Ws=[{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:"hand",group:"readout",category:"instrument",value:{type:"number",writable:!1,default:0},properties:{max:{type:"number",default:60,min:1,max:7200},start:{type:"number",default:0,min:-360,max:360},length:{type:"number",default:.8,min:.05,max:1,step:.01},tail:{type:"number",default:0,min:0,max:1,step:.01},gap:{type:"number",default:0,min:0,max:1,step:.01},width:{type:"number",default:6,min:.5,max:80},taper:{type:"number",default:.4,min:0,max:1,step:.05},color:{type:"color",default:"#ffffff"},root:{type:"color",default:"",optional:!0},fade:{type:"number",default:0,min:0,max:1,step:.05},tipFade:{type:"number",default:0,min:0,max:1,step:.05},soft:{type:"number",default:0,min:0,max:40},bloom:{type:"number",default:0,min:0,max:60},glow:{type:"number",default:0,min:0,max:80},glowColor:{type:"color",default:"",optional:!0},hub:{type:"number",default:0,min:0,max:80},hubFill:{type:"color",default:"#000000",optional:!0},hubRing:{type:"number",default:2,min:0,max:40},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"none",pointerScale:!1,size:{width:200,height:200,minWidth:20,minHeight:20,aspect:1}},{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 Ng=0,zs=new Map(Ws.map(e=>[e.type,e]));function eo(){return Ng}function Pt(e){return e===void 0?void 0:zs.get(e)}function Kn(){return[...zs.keys()]}function Zn(e){return Pt(e)!==void 0}var te={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 Qn(e){return{color:e.color??te.color,surface:e.surface??te.surface,divider:e.divider??te.divider,labelColor:e.labelColor??te.labelColor,fontFamily:e.fontFamily??te.fontFamily,variant:e.variant??te.variant,motion:e.motion??te.motion,fontWeight:e.fontWeight??te.fontWeight,fontSize:e.fontSize??te.fontSize}}var Ys=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Component","Shape","Text","Image","Isometric","Dimension","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource","Repeat","Template","Use"],IP=[...Ys,"data"],Bg=["top","bottom","left","right"],Us=e=>Bg.includes(e),mr=e=>e==="Component"||e==="Widget";var to=e=>Ys.includes(e);var ro=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 qn=Object.defineProperty;var Lg=Object.getOwnPropertyDescriptor;var Mg=Object.getOwnPropertyNames;var Tg=Object.prototype.hasOwnProperty;var $g=(e,t)=>{for(var r in t)qn(e,r,{get:t[r],enumerable:!0})},Ag=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Mg(t))!Tg.call(e,n)&&n!==r&&qn(e,n,{get:()=>t[n],enumerable:!(o=Lg(t,n))||o.enumerable});return e};var Eg=e=>Ag(qn({},"__esModule",{value:!0}),e);var CP={};$g(CP,{StickyflowDiagram:()=>wt,defineStickyflowDiagram:()=>Gs});var Fs=["source","interactive","padding","diagram-id"],Ng=e=>e!==null&&e!=="false";function Hs(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:Ng(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}function ur(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Vs=["rollingNumber","tickScale","ruler"];function st(e){return e!==void 0&&Vs.includes(e)}function Jr(e){return!st(e.type)}var Ws=[{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:"hand",group:"readout",category:"instrument",value:{type:"number",writable:!1,default:0},properties:{max:{type:"number",default:60,min:1,max:7200},start:{type:"number",default:0,min:-360,max:360},length:{type:"number",default:.8,min:.05,max:1,step:.01},tail:{type:"number",default:0,min:0,max:1,step:.01},gap:{type:"number",default:0,min:0,max:1,step:.01},width:{type:"number",default:6,min:.5,max:80},taper:{type:"number",default:.4,min:0,max:1,step:.05},color:{type:"color",default:"#ffffff"},root:{type:"color",default:"",optional:!0},fade:{type:"number",default:0,min:0,max:1,step:.05},tipFade:{type:"number",default:0,min:0,max:1,step:.05},soft:{type:"number",default:0,min:0,max:40},bloom:{type:"number",default:0,min:0,max:60},glow:{type:"number",default:0,min:0,max:80},glowColor:{type:"color",default:"",optional:!0},hub:{type:"number",default:0,min:0,max:80},hubFill:{type:"color",default:"#000000",optional:!0},hubRing:{type:"number",default:2,min:0,max:40},animate:{type:"number",default:0,min:0,max:2e3,step:10}},interaction:"none",pointerScale:!1,size:{width:200,height:200,minWidth:20,minHeight:20,aspect:1}},{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 Og=0,zs=new Map(Ws.map(e=>[e.type,e]));function eo(){return Og}function Pt(e){return e===void 0?void 0:zs.get(e)}function Kn(){return[...zs.keys()]}function Zn(e){return Pt(e)!==void 0}var te={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 Qn(e){return{color:e.color??te.color,surface:e.surface??te.surface,divider:e.divider??te.divider,labelColor:e.labelColor??te.labelColor,fontFamily:e.fontFamily??te.fontFamily,variant:e.variant??te.variant,motion:e.motion??te.motion,fontWeight:e.fontWeight??te.fontWeight,fontSize:e.fontSize??te.fontSize}}var Ys=["Project","Model","Group","Entity","Container","Screen","Path","Chart","Widget","Component","Shape","Text","Image","Isometric","Dimension","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource","Repeat","Template","Use"],DP=[...Ys,"data"],Ig=["top","bottom","left","right"],Us=e=>Ig.includes(e),mr=e=>e==="Component"||e==="Widget";var to=e=>Ys.includes(e);var ro=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 js=e=>e!==void 0&&/^[A-Za-z_]$/.test(e),Lt=e=>e!==void 0&&e>="0"&&e<="9",Xs=e=>e!==void 0&&/^[A-Za-z0-9_]$/.test(e);function ue(e,t,r,o={}){return{type:e,value:t,line:r.line,col:r.col,endLine:r.line,endCol:r.col,...o}}function Jn(e,t){return{...e,endLine:t.line,endCol:t.col}}function qs(e){return js(e.peek())}function Ks(e,t){let r="";for(;Xs(e.peek());)r+=e.advance();return ue("ident",r,t)}function Zs(e){return e==="\r"||e===`
4
4
  `}function Qs(e,t){return e.advance()==="\r"&&e.peek()===`
5
5
  `&&e.advance(),ue("newline",`
6
6
  `,t)}function Js(e){return e.peek()==="/"&&e.peek(1)==="/"}function el(e){for(;!e.done&&e.peek()!==`
7
- `&&e.peek()!=="\r";)e.advance()}function tl(e){let t=e.peek();return Lt(t)||t==="-"&&Lt(e.peek(1))}function rl(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());Lt(e.peek());)r+=e.advance();if(e.peek()==="."&&Lt(e.peek(1)))for(r+=e.advance();Lt(e.peek());)r+=e.advance();return ue("number",r,t,{numberValue:Number(r)})}var Ig=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],Gg=e=>e!==void 0&&/[\d.]/.test(e);function ol(e,t){let r=Ig.find(([i])=>e.startsWith(i));if(!r)return null;let[o,n]=r;if(o==="-"&&Gg(e.peek(1)))return null;for(let i=0;i<o.length;i++)e.advance();return ue(n,o,t)}var Dg={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function nl(e,t){let r=e.peek(),o=r?Dg[r]:void 0;return!r||!o||r==="&"&&e.peek(1)==="&"?null:(e.advance(),ue(o,r,t))}function il(e){return e===" "||e===" "}function al(e){e.advance()}function _g(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,_g(o)));return!Number.isFinite(r)||r===0?e:t.map(o=>o.trim()?o.slice(r):o).join(`
9
- `)}function Hg(e,t){sl(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return sl(e),Fg(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new Oe("unterminated long string",t.line,t.col)}function sl(e){e.advance(),e.advance(),e.advance()}function Vg(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==="\\"?Wg(e,t):o}throw new Oe("unterminated string",t.line,t.col)}function Wg(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 zg(e,t){return e.startsWith('"""')?Hg(e,t):Vg(e,t)}function ll(e,t){return ue("string",zg(e,t),t)}function dl(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(Zs(t))return Qs(e,r);if(Yg(e,t))return null;let o=Ug(e,t,r)??jg(e,r);if(o)return o;throw new Oe(`unexpected character '${t}'`,r.line,r.col)}function Yg(e,t){return il(t)?(al(e),!0):Js(e)?(el(e),!0):!1}function Ug(e,t,r){let o=nl(e,r);return o||(t==='"'?ll(e,r):ol(e,r))}function jg(e,t){return tl(e)?rl(e,t):qs(e)?Ks(e,t):null}function cl(e){let t=new ro(e),r=[];for(;!t.done;){let o=dl(t);o&&r.push(Jn(o,t))}return r.push(Jn(ue("eof","",t.position()),t)),r}var Y=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 oo=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 Y(`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 Y(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function Mt(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}var Xg=new Set([">","<",">=","<=","==","!="]);function qg(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function pr(e,t,r){let o=r(e);for(;qg(e,t);)o={kind:"binary",operator:e.next().value,left:o,right:r(e)};return o}var Kg=new Set(["||"]),Zg=new Set(["&&"]),Qg=new Set(["+","-"]),Jg=new Set(["*","/"]);function lt(e){return pr(e,Kg,e0)}function e0(e){return pr(e,Zg,t0)}function t0(e){return pr(e,Xg,r0)}function r0(e){return pr(e,Qg,o0)}function o0(e){return pr(e,Jg,pl)}function pl(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:pl(e)}):i0(e)}function n0(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(lt(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new Y(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function i0(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=lt(e);return e.expect("rparen","')'"),r}case"ident":{let r=Mt(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:n0(e)}:{kind:"ref",path:r}}default:throw new Y(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var a0=["bind","bind2","action"];function no(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&a0.includes(e.peek(2).type)}function io(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,o=lt(e),n=e.peek();if(!["newline","semi","rbrace","eof"].includes(n.type))throw new Y(`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 ul(e){let t=e.peek(),r=Mt(e);e.expect("bind","'<-'");let o=lt(e);return{target:r,expr:o,line:t.line,col:t.col}}function fl(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function hl(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(ul(e)),ml(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new Y(`unterminated handler '${t.value}'`,t.line,t.col);r.push(ul(e)),ml(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function ml(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new Y(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}function gl(e){let t=Mt(e),r,o;if(e.at("comma")){e.next();let n=e.expect("ident",'side after ","');if(!Us(n.value))throw new Y(`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 s0(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(ao(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(ao(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}var l0=new Set(["+","-","*","/",">","<",">=","<=","==","!=","&&","||"]);function d0(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"&&l0.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 c0(e){let t=[lt(e)];for(;e.at("comma");)e.next(),t.push(lt(e));return{type:"expr",items:t}}function ao(e,t=!0){if(t&&d0(e))return c0(e);let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return s0(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:Mt(e)};default:throw new Y(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var so=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 Y("unterminated style block",o.line,o.col)}no(this.cursor)?(r.push(io(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"?gl(this.cursor):ao(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 Y(`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 Y(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var lo=class{constructor(t){this.cursor=t;this.properties=new so(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!to(t.value))throw new Y(`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 Y('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 Y(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return to(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()}:no(this.cursor)?{type:"binding",binding:io(this.cursor)}:fl(this.cursor)?{type:"handler",handler:hl(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"&&!to(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 co=class{constructor(t){this.cursor=t;this.blocks=new lo(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new Y(`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 ei(e){return new co(new oo(cl(e))).parseDocument()}function Z(e,t){throw new Error(`${e.label}: ${t}`)}function q(e,t,r){return(typeof t!="number"||!Number.isFinite(t))&&Z(e,`${r} needs a number`),t}function ti(e,t){let r=typeof t=="string"?/^#([0-9a-f]{6})$/i.exec(t):null;r||Z(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 yl=e=>`#${e.map(t=>Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0")).join("")}`;function bl(e,t,r){let o=n=>q(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&&Z(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=ti(e,r[0]),i=ti(e,r[1]),a=Math.max(0,Math.min(1,o(2)));return yl(n.map((s,l)=>s+(i[l]-s)*a))}case"shade":{let n=o(1);return yl(ti(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 Z(e,`unknown function ${t}()`)}}function dt(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&&Z(e,`unknown name ${r}`),o}case"unary":{let r=dt(e,t.operand);return t.operator==="-"?-q(e,r,"a minus"):!r}case"call":return bl(e,t.callee.join("."),t.args.map(r=>dt(e,r)));case"binary":{let r=dt(e,t.left),o=dt(e,t.right);switch(t.operator){case"+":return typeof r=="string"||typeof o=="string"?`${r}${o}`:q(e,r,"+")+q(e,o,"+");case"-":return q(e,r,"-")-q(e,o,"-");case"*":return q(e,r,"*")*q(e,o,"*");case"/":return q(e,r,"/")/q(e,o,"/");case">":return q(e,r,">")>q(e,o,">");case"<":return q(e,r,"<")<q(e,o,"<");case">=":return q(e,r,">=")>=q(e,o,">=");case"<=":return q(e,r,"<=")<=q(e,o,"<=");case"==":return r===o;case"!=":return r!==o;case"&&":return!!r&&!!o;case"||":return!!r||!!o}}}}var fr=e=>Math.round(e*1e3)/1e3;function xl(e,t){return typeof t=="number"?{type:"number",value:fr(q(e,t,"a value"))}:typeof t=="string"?{type:"string",value:t}:{type:"ident",segments:[String(t)]}}function ct(e,t){if(e.substitute&&t.type==="ident"&&t.segments.length===1){let o=e.vars.get(t.segments[0]);if(o!==void 0)return xl(e,o)}if(t.type!=="expr")return t;let r=t.items.map(o=>dt(e,o));return r.length===1?xl(e,r[0]):{type:"tuple",values:r.map(o=>fr(q(e,o,"a tuple")))}}function Sl(e,t){return t.map(r=>({key:r.key,value:ct(e,r.value)}))}function u0(e,t,r){switch(t.type){case"property":return{type:"property",property:{key:t.property.key,value:ct(e,t.property.value)}};case"layout":return{type:"layout",layout:{properties:Sl(e,t.layout.properties)}};case"style":return{type:"style",style:{...t.style,properties:Sl(e,t.style.properties)}};case"block":return{type:"block",block:hr(e,t.block,r)};default:return t}}function hr(e,t,r){return{...t,name:r(t.name),entries:t.entries.map(o=>u0(e,o,r))}}function ri(e,t){for(let r of e.entries)if(r.type==="property"&&r.property.key===t)return r.property.value}function Se(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}}var Ze=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}};var m0=new Set(["columns","rows","count","step","origin","seed","jitter","chance","order","where"]),Cl=2e4,p0=1e6;function f0(e,t){let r=Se(e,"count")?.[0],o=Math.max(1,Math.floor(r??Se(e,"columns")?.[0]??1)),n=r===void 0?Math.max(1,Math.floor(Se(e,"rows")?.[0]??1)):1;o*n>Cl&&Z(t,`${o*n} cells are too many, the limit is ${Cl}`);let[i=0,a=i]=Se(e,"step")??[],[s=0,l=0]=Se(e,"origin")??[],d=ri(e,"order"),c=e.entries.flatMap(u=>u.type==="block"?[u.block]:[]);return c.some(u=>u.kind==="Repeat")&&Z(t,"a Repeat cannot hold another Repeat"),o*n*Math.max(1,c.length)>p0&&Z(t,"too many blocks"),{columns:o,rows:n,step:[i,a],origin:[s,l],seed:Se(e,"seed")?.[0]??0,jitter:Se(e,"jitter")?.[0]??0,chance:Se(e,"chance")?.[0]??1,diagonal:d?.type==="ident"&&d.segments[0]==="diagonal",condition:ri(e,"where"),helpers:e.entries.flatMap(u=>u.type==="property"&&u.property.value.type==="expr"&&!m0.has(u.property.key)?[u.property]:[]),templates:c}}function h0(e){let t=[];for(let r=0;r<e.rows;r++)for(let o=0;o<e.columns;o++)t.push([o,r]);return e.diagonal?t.sort((r,o)=>r[0]+r[1]-(o[0]+o[1])||r[0]-o[0]):t}function g0(e,t,r,o){let n=o*t.columns+r;if(e.random=new Ze(Math.imul(t.seed+1,2654435761)^Math.imul(n+1,2246822507)),t.chance<1&&e.random.next()>=t.chance)return!1;let i=()=>t.jitter>0?(e.random.next()*2-1)*t.jitter:0;return e.vars=new Map([["col",r],["row",o],["index",n],["count",t.columns*t.rows],["columns",t.columns],["rows",t.rows],["x",fr(t.origin[0]+r*t.step[0]+i())],["y",fr(t.origin[1]+o*t.step[1]+i())]]),!0}function y0(e,t){for(let r of t){let o=ct(e,r.value);o.type==="number"||o.type==="string"?e.vars.set(r.key,o.value):o.type==="ident"?e.vars.set(r.key,o.segments[0]==="true"?1:0):Z(e,`${r.key} needs a number`)}}function b0(e,t){return t?.type!=="expr"||!!t.items.map(r=>dt(e,r))[0]}function x0(e){let t={vars:new Map,random:new Ze(0),label:`Repeat ${e.name}`},r=f0(e,t),o=[];for(let[n,i]of h0(r)){if(!g0(t,r,n,i)||(y0(t,r.helpers),!b0(t,r.condition)))continue;let a=r.rows===1?`_${n}`:`_${n}_${i}`;for(let s of r.templates)o.push(hr(t,s,l=>`${l}${a}`))}return o}function oi(e){return e.flatMap(t=>t.kind==="Repeat"?x0(t):t.kind==="Template"||!t.entries.some(r=>r.type==="block")?[t]:[{...t,entries:t.entries.flatMap(r=>r.type==="block"?oi([r.block]).map(o=>({type:"block",block:o})):[r])}])}function ni(e){return e.some(t=>t.kind==="Repeat"||t.entries.some(r=>r.type==="block"&&ni([r.block])))}var kl=4,S0=1e5,Rl=new Set(["at","seed"]),C0=new Set(["x","y"]);function k0(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e.charCodeAt(r),16777619);return t>>>0}function wl(e,t){for(let r of e){if(r.kind==="Template"){if(t.has(r.name))throw new Error(`Template ${r.name}: there is another Template of this name`);if(r.entries.some(o=>o.type==="block"&&o.block.kind==="Repeat"))throw new Error(`Template ${r.name}: a Template cannot hold a Repeat, a Repeat can hold a Use`);t.set(r.name,r)}wl(r.entries.flatMap(o=>o.type==="block"?[o.block]:[]),t)}}var ii=class{made=0;take(t,r){this.made+=t,this.made>S0&&Z(r,"too many blocks")}};function R0(e,t,r,o){let n={vars:new Map,random:new Ze(0),label:`Use ${e.name}`,substitute:!0};r>kl&&Z(n,`Templates are nested more than ${kl} deep, which may be a Template that uses itself`),e.composition.length!==1&&Z(n,"a Use names one Template, as in Use oak : tree");let i=t.get(e.composition[0]);i||Z(n,`there is no Template ${e.composition[0]}`);let a=Se(e,"seed")?.[0]??0;n.random=new Ze(Math.imul(a+1,2654435761)^k0(e.name));let[s=0,l=0]=Se(e,"at")??[];n.vars.set("x",s),n.vars.set("y",l);let d=new Map(e.entries.flatMap(m=>m.type==="property"&&!Rl.has(m.property.key)?[[m.property.key,m.property.value]]:[]));for(let m of i.entries){if(m.type!=="property")continue;let{key:f,value:h}=m.property;(C0.has(f)||Rl.has(f))&&Z(n,`${f} is the name of something a Use sets, so it cannot be a parameter`);let y=ct(n,d.get(f)??h);d.delete(f),y.type==="number"||y.type==="string"?n.vars.set(f,y.value):y.type==="ident"?n.vars.set(f,y.segments[0]==="true"?1:y.segments[0]==="false"?0:y.segments.join(".")):Z(n,`${f} needs a number, a text or a name`)}let c=[...d.keys()][0];c!==void 0&&Z(n,`Template ${i.name} has no parameter ${c}`);let u=i.entries.flatMap(m=>m.type==="block"?[hr(n,m.block,f=>`${e.name}_${f}`)]:[]);return o.take(u.length,n),ai(u,t,r+1,o)}function ai(e,t,r,o){return e.flatMap(n=>n.kind==="Template"?[]:n.kind==="Use"?R0(n,t,r,o):n.entries.some(i=>i.type==="block")?[{...n,entries:n.entries.flatMap(i=>i.type==="block"?ai([i.block],t,r,o).map(a=>({type:"block",block:a})):[i])}]:[n])}function si(e){return e.some(t=>t.kind==="Template"||t.kind==="Use"||t.entries.some(r=>r.type==="block"&&si([r.block])))}function vl(e){let t=new Map;return wl(e,t),ai(e,t,0,new ii)}function li(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"&&li([r.block])}}function di(e){let t=ni(e.blocks);if(!t&&!si(e.blocks))return li(e.blocks),e;let r={...e,blocks:vl(t?oi(e.blocks):e.blocks)};return li(r.blocks),r}function C(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 w(e){return e?.type==="number"?e.value:void 0}function pe(e){return e?.type==="tuple"?e.values:void 0}function Pl(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function w0(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 Tt(e,t){if(e?.type!=="endpoint")return{};let r=w0(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 H(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 uo(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 Ll(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 U(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function Ml(e){for(let t of e.entries)if(t.type==="data")return t.data}function $t(e){let t=Ml(e);return t?[...U(e),...U(t)]:U(e)}function Tl(e,t){let r=H(e).get(t);if(r!==void 0)return r;let o=Ml(e);return o?H(o).get(t):void 0}var v0=["Entity","Shape","Text","Image","Container","Path","Chart","Widget","Component","Isometric","Dimension"],P0=new Set(v0);function At(e){return P0.has(e)}function $l(e,t){for(let r of e)At(r.kind)&&t.set(r.name,C(H(r).get("id"))??r.name),$l(U(r),t)}function mo(e){let t=new Map;return e&&$l(U(e),t),t}var L0=new Set(["id","from","to","text","order","segments"]);function po(e){let t={};for(let[r,o]of e){if(L0.has(r))continue;let n=C(o);n!==void 0&&(t[r]=n)}return t}var M0=new Set(["top","bottom","front","back","left","right"]);function Al(e){return e!==void 0&&M0.has(e)?e:"front"}function El(e,t,r,o,n=[]){let i={idByName:mo(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=o.mergedProps(a);return{id:C(l.get("id"))??a.name,fromId:Tt(l.get("from"),i).id,toId:Tt(l.get("to"),i).id,fromFace:Al(C(l.get("fromFace"))),toFace:Al(C(l.get("toFace"))),order:w(l.get("order")),sourceIndex:n[s],props:po(l)}})}function Nl(e,t,r){let o=t.mergedProps(e),n=Tt(o.get("from"),r),i=Tt(o.get("to"),r);return{id:C(o.get("id"))??e.name,fromId:n.id,toId:i.id,text:C(o.get("text")),fromSide:n.side,fromFraction:n.fraction,toSide:i.side,toFraction:i.fraction,fromPort:n.port,toPort:i.port,order:w(o.get("order")),segments:Pl(o.get("segments")),props:po(o)}}function Ol(e,t,r,o,n=[]){let i={idByName:mo(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...Nl(a,o,i),sourceIndex:n[s]}))}function T0(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(o=>o.type==="ident"?[o.segments]:[]):[]}function $0(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=T0(e,t);if(r.length<2)return[];let o=C(t.mergedProps(e).get("text"));return r.slice(1).map((n,i)=>$0(e,r[0],n,i,o))}function Il(e,t){let r=C(t.layoutProp(e,"flow")),o=w(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 fo=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function Et(e){return e!==void 0&&fo.includes(e)}function Ve(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let o=w(r);return o===void 0?[]:[o]});return t.length>0?t:void 0}function Gl(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=C(t);return r===void 0?[]:[r]})}function Be(e){let t=C(e);if(t!==void 0)return t==="true"}function ci(e){let t=e?H(e):new Map;return{min:w(t.get("min"))??0,max:w(t.get("max"))??10,step:w(t.get("step"))??1,label:C(t.get("label")),unit:C(t.get("unit")),thresholds:Ve(t.get("thresholds"))}}function Dl(e){return $t(e).filter(t=>t.kind==="Rule").map(t=>{let r=H(t);return{id:t.name,at:w(r.get("at"))??0,text:C(r.get("text")),color:C(r.get("color")),strokeWidth:w(r.get("strokeWidth")),dash:Ve(r.get("dash"))}})}function _l(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(w);return t.every(r=>r!==void 0)?t:void 0}function Fl(e){return e?.type!=="list"?[]:A0(e.values)==="tuple"?N0(e.values):E0(e.values)}function A0(e){for(let t of e){if(t.type==="number")return"scalar";if(_l(t))return"tuple"}}function E0(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function N0(e){return e.flatMap(t=>{let r=_l(t);return r?[r]:[]})}function Hl(e){if(e?.type==="list")return e.values.map(O0)}function O0(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:B0(e)}function B0(e){if(e.type!=="list"||e.values.length<2)return null;let t=w(e.values[0]),r=w(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function Vl(e){if(e?.type==="list")return e.values.map(I0)}function I0(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:C(e)??null}function Wl(e,t){if(e?.type==="list"){let n=e.values.flatMap(G0);return n.length>0?{points:n}:void 0}let r=C(e),o=r?t.get(r):void 0;if(o)return{points:o.points,normalized:!0,tension:o.tension}}function G0(e){if(e.type!=="list"||e.values.length<2)return[];let t=w(e.values[0]),r=w(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function zl(e,t,r){let o=r(e);return{id:e.name,label:C(o.get("label"))??e.name,color:C(o.get("color")),colors:Vl(o.get("colors")),opacity:w(o.get("opacity")),group:C(o.get("group")),values:Fl(o.get("values")),error:Hl(o.get("error")),source:C(o.get("source")),target:C(o.get("target")),size:w(o.get("size")),symbol:Wl(o.get("symbol"),t),stroke:C(o.get("stroke")),strokeWidth:w(o.get("strokeWidth")),dash:Ve(o.get("dash")),offset:w(o.get("offset")),labelOffsetX:w(o.get("labelOffsetX")),labelOffsetY:w(o.get("labelOffsetY"))}}function Yl(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let o=C(r.values[0]);return o===void 0?[]:[{label:o,color:C(r.values[1]),offsetX:w(r.values[2]),offsetY:w(r.values[3])}]});return t.length>0?t:void 0}var D0=["none","true","percent","waterfall"];function _0(e){return Et(e)?e:"bar"}function F0(e){return D0.find(t=>t===e)}function Ul(e,t,r,o){let n=$t(e),i=n.filter(s=>s.kind==="Axis"),a=C(t.get("stacked"));return{chartType:_0(C(t.get("type"))),categories:Gl(Tl(e,"categories")),areaOpacity:w(t.get("areaOpacity")),stacked:F0(a),scale:C(t.get("scale")),interpolate:C(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:w(t.get("idwPower")),isolines:Ve(t.get("isolines")),zones:Yl(t.get("zones")),boxWidth:w(t.get("boxWidth")),orientation:C(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:w(t.get("lineTension")),highlightPoints:Ve(t.get("highlightPoints")),barCornerRadius:w(t.get("barCornerRadius")),showBoxplotPoints:Be(t.get("showBoxplotPoints")),barBorderColor:C(t.get("barBorderColor")),barBorderWidth:w(t.get("barBorderWidth")),barGroupGap:w(t.get("barGroupGap")),barGlow:w(t.get("barGlow")),barGap:w(t.get("barGap")),mekkoVaryHeight:Be(t.get("mekkoVaryHeight")),hexRadius:w(t.get("hexRadius")),innerRadius:w(t.get("innerRadius")),pieCornerRadius:w(t.get("pieCornerRadius")),pieSliceGap:w(t.get("pieSliceGap")),ringThickness:w(t.get("ringThickness")),ringGap:w(t.get("ringGap")),cellGap:w(t.get("cellGap")),showValues:Be(t.get("showValues")),squareCells:Be(t.get("squareCells")),headerColor:C(t.get("headerColor")),tileGradient:Be(t.get("tileGradient")),showColumnBackdrop:Be(t.get("showColumnBackdrop")),labelPosition:C(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:C(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:C(t.get("labelColor")),linkGradient:Be(t.get("linkGradient")),connectPoints:Be(t.get("connectPoints")),reverseComparison:Be(t.get("reverseComparison")),axisX:ci(i.find(s=>s.name==="x")),axisY:ci(i.find(s=>s.name==="y"||s.name==="value")),series:n.filter(s=>s.kind==="Series").map(s=>zl(s,r,o)),rules:Dl(e)}}function jl(e,t,r,o,n){return{...e,objectType:"chart",chart:Ul(t,r,o,n)}}function Xl(e,t){let[r,o]=pe(e)??[];return{x:t.x+(r??0),y:t.y+(o??0)}}function ql(e,t){return{start:Xl(e.get("start"),t),end:Xl(e.get("end"),t),offset:w(e.get("offset"))??0,unit:C(e.get("unit"))}}function Kl(e,t,r){return{...e,objectType:"dimension",dimension:ql(t,r)}}function go(e,t){return Math.max(0,t.tension??e.tension)}function yo(e){return e.points.length<3||e.points.every(t=>go(e,t)<=0)}function ho(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 bo(e){let t=e.closed?e.points.length:e.points.length-1;return Array.from({length:Math.max(0,t)},(r,o)=>{let n=ho(e,o-1),i=ho(e,o),a=ho(e,o+1),s=ho(e,o+2),l=go(e,i)/6,d=go(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 H0(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 ui(e,t=8){if(yo(e))return e.points.map(i=>({x:i.x,y:i.y}));let r=[],o=bo(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(H0(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 V0(e){if(e.type!=="list"||e.values.length<2)return[];let t=w(e.values[0]),r=w(e.values[1]),o=e.values[2]===void 0?void 0:w(e.values[2]);return t===void 0||r===void 0?[]:[o===void 0?{x:t,y:r}:{x:t,y:r,tension:o}]}function Zl(e,t){let r=ui({points:e,tension:t,closed:!0});return r.length>=3?r.map(o=>[o.x,o.y]):void 0}function W0(e,t){if(e?.type==="list")return Zl(e.values.flatMap(V0),0);let r=C(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 Zl(n,o.tension??0)}function Ql(e,t,r){return{depth:t,icon:C(e.get("icon")),footprint:W0(e.get("symbol"),r),form:C(e.get("shape"))==="sphere"?"sphere":"box"}}function Jl(e,t,r,o,n){let i=pe(o(t,"size"));return{...e,objectType:"isometric",isometric:Ql(r,i?.[2]??24,n)}}function ed(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=w(n.values[0]),a=w(n.values[1]),s=n.values[2]===void 0?void 0:w(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:w(e.get("tension")),startMarker:C(e.get("startMarker")),endMarker:C(e.get("endMarker")),closed:C(e.get("closed"))==="true",value:w(e.get("value"))}}function td(e,t,r){return{...e,objectType:"path",path:ed(t,r)}}function rd(e){let t=C(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=C(i.values[0]),l=w(i.values[1]);if(s===void 0||l===void 0)return[];let d=C(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:o}}function od(e,t){return{...e,objectType:"swimlane",swimlane:rd(t)}}function z0(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":mr(e.kind)?C(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Image"?"image":e.kind==="Isometric"?"isometric":e.kind==="Dimension"?"dimension":C(t.get("kind"))??""}function Y0(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":st(e)?"component":e==="isometric"?"isometric":e==="dimension"?"dimension":"shape"}function nd(e,t,r){let o=z0(e,t),n=C(t.get("shape")),i=n?r.get(n):void 0;return{objectType:mr(e.kind)?"component":Y0(o),kind:o,shapeType:i?"symbol":n,symbol:i}}function id(e,t,r,o){let n=o??pe(r(e,"position"))??[0,0],i=pe(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:w(r(e,"rotation")),order:w(r(e,"order"))}}var U0=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]),j0=new Set(["crop","imageSize"]);function ad(e){let t={};for(let[r,o]of e){if(U0.has(r))continue;let n=j0.has(r)?pe(o)?.join(","):C(o);n!==void 0&&(t[r]=n)}return t}function sd(e,t,r,o,n){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=nd(e,l,s),c=id(e,t,a,n),u={id:C(l.get("id"))??e.name,kind:d.kind,text:C(l.get("text")),...c,parentFrameId:o??C(l.get("parent")),props:ad(l)};switch(d.objectType){case"chart":return jl(u,e,l,s,i);case"isometric":return Jl(u,e,l,a,s);case"path":return td(u,l,t);case"dimension":return Kl(u,l,t);case"swimlane":return od(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:C(l.get("type"))??"rollingNumber",value:C(l.get("value"))??"0",digits:w(l.get("digits")),duration:w(l.get("duration")),min:w(l.get("min")),max:w(l.get("max")),label:C(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function ld(e){return U(e).filter(t=>At(t.kind)).map(t=>C(H(t).get("id"))??t.name)}var mi=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=Il(t,this.#e);for(let i of U(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(At(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=pe(this.#e.layoutProp(t,"size"))??[0,0];return{...sd(t,r.origin,this.#e,r.frameId,o(i)),sourceIndex:n}}#m(t,r){let o=this.#e.mergedProps(t);return{id:C(o.get("id"))??t.name,name:C(o.get("text"))??t.name,color:C(o.get("color")),icon:C(o.get("icon")),canvasObjectIds:ld(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??C(o.get("parent"))}}};function dd(e,t){return new mi(t).resolve(e)}function cd(e){let t=H(e),r=C(t.get("program")),o=w(t.get("surfacePadding"));if(!r)return;let n={};for(let[i,a]of t){if(i==="program"||i==="surfacePadding")continue;let s=w(a),l=C(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 X0(e){let t=H(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=w(n.values[0]),a=w(n.values[1]);i===void 0||a===void 0||(r.push([i,a]),o.push(n.values[2]===void 0?void 0:w(n.values[2])))}return{points:r,tensions:o}}function q0(e){let t=U(e).filter(r=>r.kind==="Port").flatMap(r=>{let o=pe(H(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 ud(e){let{points:t,tensions:r}=X0(e);if(!(t.length<2))return{name:e.name,points:t,pointTensions:r.some(o=>o!==void 0)?r:void 0,tension:w(H(e).get("tension")),ports:q0(e)}}function K0(e){return U(e).find(t=>t.kind==="Model")}function md(e){return{styles:Q0(e),layouts:J0(e),symbols:ey(e),shaders:Z0(e),model:ty(e)}}function Z0(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let o=cd(r);o&&t.set(r.name,o)}return t}function Q0(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function J0(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function ey(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let o=ud(r);o&&t.set(r.name,o)}return t}function ty(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=K0(t);if(r)return r}}}function pd(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 fd(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 \u2014 "${e.name}" gets no shape, fill, or stroke from it.`});for(let n of U(e))fd(n,t,r,o)}function hd(e,t,r){let o=[];for(let n of e.blocks)fd(n,t,r,o);return o}function fi(e,t){return new pi(e,t).resolveAll()}var pi=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 H(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 gd(e){let{styles:t,layouts:r,symbols:o,shaders:n}=e,i=c=>pd(c.composition,t,r),a=fi(t,c=>i(c).styleRef),s=fi(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[m,f]of H(c))u.set(m,f);for(let[m,f]of uo(c))u.set(m,f);return u},layoutProp:(c,u)=>{let m=Ll(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 ry=new Set(["radar","radial"]),yd=new Set(["scatter","custom","hexbin"]);function bd(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=C(H(o).get("type"));n!==void 0&&!Et(n)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:o.name,message:`Unsupported chart type '${n}' \u2014 drawn as a plain series plot. Supported: ${fo.join(", ")}.`})}for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}function xd(e){let t=[],r=o=>{if(o.kind==="Chart")for(let n of $t(o).filter(i=>i.kind==="Series"))H(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 \u2014 inside data{}, a bare name is read as a Series.`});for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}function Sd(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=C(H(o).get("type")),i=Et(n)?n:"bar";C(uo(o).get("gridShape"))==="circle"&&!yd.has(i)&&!ry.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:o.name,message:`gridShape: circle isn't supported on '${i}' \u2014 drawn with the standard rectangular grid instead. Supported: ${[...yd].join(", ")}.`})}for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}function Cd(e){let t=[],r=o=>{if(mr(o.kind)){let n=C(H(o).get("type"))??"rollingNumber";Zn(n)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:o.name,message:`Unsupported component type '${n}'. Supported: ${Kn().join(", ")}.`})}for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}var oy=new Set(["Shape","Text","Image","Container","Chart","Path","Widget","Component","Entity","Isometric","Group"]),ny=new Set(["Link","Connection"]);function kd(e){let t=new Map,r=n=>{let i=oy.has(n.kind)?"object":ny.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 U(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 Rd(e){let t=md(e);return{model:t.model,diagnostics:[...hd(e,t.styles,t.layouts),...bd(e),...Sd(e),...xd(e),...Cd(e),...kd(e)],canvasObjectResolutionContext:gd(t)}}function wd(e){let t=Rd(e),{canvasObjects:r,groups:o,linkBlocks:n,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=dd(t.model,t),l=Ol(t.model,n,r,t.canvasObjectResolutionContext,a),d=El(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 gr(e){return e.objectType==="dimension"&&e.dimension!==void 0}function yr(e){return e.objectType==="isometric"&&e.isometric!==void 0}function vd(e){return wd(di(ei(e)))}var br=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function ly(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${br})\\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 dy(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${br})\\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 Ce(e){if(!(e==null||e===""))return ly(e)??dy(e)??e}function xo(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${br})\\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 cy(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 Le(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&&cy(r,n[0].trim(),n[1].trim())}return r}var x=e=>e===void 0?void 0:Number(e);function uy(e){try{return JSON.parse(e)}catch{return}}function Qe(e){if(e===void 0)return;let t=uy(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 ke(e){let t=Ce(e);return typeof t=="string"?t:void 0}var my=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function Re(e){return e&&my.test(e)?e:void 0}function Me(e,t,r){return t.includes(e)?e:r}var So=["normal","bold"],Pd=["normal","bold","100","200","300","400","500","600","700","800","900"],Ld=["top","bottom","left","right"],hi=["none","arrow","filled_arrow"];function Nt(e){let t=Ce(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var Md=["left","center","right"],Td=["top","middle","bottom"],Co=["solid","dashed","dotted"],ko=["straight","curved","orthogonal"];function fe(e,t){return e!==void 0&&t.includes(e)?e:void 0}var $d=["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ad=["solid","dashed","dotted","double"],gi=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function py(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function fy(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function hy(e){return e==="dashed"||e==="dotted"?e:"solid"}function gy(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:Ce(t.color),colors:t.colors?.map(r=>r===null?null:Ce(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 yy(e){let t=py(e.fill);return{fillColor:t?"#111418":Ce(e.fill)??"#ffffff",fillImage:t,strokeColor:ke(e.stroke)??"#475569",strokeWidth:x(e.strokeWidth)??1,cornerRadius:x(e.cornerRadius)??12,shadowStyle:Le(e.shadow)}}function by(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:x(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:hy(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function xy(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:x(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:x(e.tickLength),axisFontSize:x(e.axisFontSize),axisLabelAngle:x(e.axisLabelAngle),axisLabelSpace:x(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:x(e.xLabelGap),yLabelGap:x(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 Sy(e){return{textColor:e.textColor??"#0f172a",titleSize:x(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:x(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function Cy(e){return{legendColor:e.legendColor,legendGap:x(e.legendGap),showLegend:e.showLegend==="true",legendPosition:fy(e.legendPosition)}}function Ed(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,...gy(e),...yy(t),...by(t),...xy(t),...Sy(t),...Cy(t),order:e.order,sourceIndex:e.sourceIndex}}function Nd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:Ce(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:x(t.barSegments),barSegmentGap:x(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:x(t.barGlassBlur),barGlassSaturation:x(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:x(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:x(t.barTrackHatchAngle),barTrackHatchSpacing:x(t.barTrackHatchSpacing),barTrackHatchWidth:x(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:x(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:x(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function Od(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:x(t.lineWidth),lineGlow:x(t.lineGlow),pointSize:x(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:x(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:x(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:x(t.pointSize),pointOpacity:x(t.pointOpacity),pointStrokeWidth:x(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function Id(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:x(t.boxWhiskerWidth),boxMedianWidth:x(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:x(t.boxCapSize),boxPointSize:x(t.boxPointSize),boxPointOpacity:x(t.boxPointOpacity),boxJitter:x(t.boxJitter)}}function Gd(e){return{scale:xo(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function Dd(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:x(t.cellStrokeWidth),cellValueSize:x(t.cellValueSize),cellValueColor:t.cellValueColor}}function _d(e,t){return{hexRadius:e?.hexRadius,scale:xo(e?.scale),hexGap:x(t.hexGap),hexStrokeWidth:x(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:x(t.hexMinOpacity)}}function Fd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:x(t.mekkoColumnGap),mekkoSegmentGap:x(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:x(t.mekkoSegmentStrokeWidth),mekkoLabelSize:x(t.mekkoLabelSize),mekkoValueSize:x(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 Hd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:x(t.pieStartAngle),pieSweep:x(t.pieSweep),pieExplode:x(t.pieExplode),pieGlow:x(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:x(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:x(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function Vd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:x(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:x(t.pieStrokeWidth),polarTrackOpacity:x(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:x(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:x(t.polarValueSize),polarNameSize:x(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 Wd(e){return{radarStrokeWidth:x(e.radarStrokeWidth),radarPointSize:x(e.radarPointSize),radarTension:x(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function zd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Wd(t)}}function Yd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Wd(t)}}function Ud(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:x(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:x(t.ringStartAngle),ringSweep:x(t.ringSweep)}}function jd(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:x(t.sankeyNodeWidth),sankeyNodeGap:x(t.sankeyNodeGap),sankeyLinkOpacity:x(t.sankeyLinkOpacity),sankeyLinkCurve:x(t.sankeyLinkCurve),sankeyLabelSize:x(t.sankeyLabelSize)}}function Xd(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:x(t.tileStrokeWidth),tileLabelSize:x(t.tileLabelSize),tileValueSize:x(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:x(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:x(t.headerHeight)}}function qd(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:x(t.customConnectorWidth),customConnectorOpacity:x(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:x(t.customBeforeStrokeWidth),customLabelSize:x(t.customLabelSize),customLabelColor:t.customLabelColor}}function Kd(e){let t=Ed(e),r=e.chart,o=e.props,n=r?.chartType??"bar";switch(n){case"bar":return ie(t,n,Nd(r,o));case"line":return ie(t,n,Od(r,o));case"scatter":return ie(t,n,Bd(r,o));case"boxplot":return ie(t,n,Id(r,o));case"field":return ie(t,n,Gd(r));case"heatmap":return ie(t,n,Dd(r,o));case"hexbin":return ie(t,n,_d(r,o));case"mekko":return ie(t,n,Fd(r,o));case"pie":return ie(t,n,Hd(r,o));case"polarArea":return ie(t,n,Vd(r,o));case"radar":return ie(t,n,zd(r,o));case"radial":return ie(t,n,Yd(r,o));case"radialBar":return ie(t,n,Ud(r,o));case"sankey":return ie(t,n,jd(r,o));case"treemap":return ie(t,n,Xd(r,o));case"custom":return ie(t,n,qd(r,o))}}function ie(e,t,r){return{...e,chartType:t,config:r}}function ky(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 Ry(e,t){switch(e.type){case"number":return ky(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return e.optional&&t==="none"?"none":Re(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function wy(e,t){let r={};for(let[o,n]of Object.entries(e?.properties??{}))r[o]=Ry(n,t[o]);return r}function vy(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 Zd(e){let t=Pt(e.component.type);return{id:e.id,type:e.component.type,value:t?vy(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:wy(t,e.props)}}var Py=/^[\w\s,'"-]+$/;function yi(e){return e&&Py.test(e)?e:void 0}var Ly=/^(?:[1-9]00|normal|bold)$/;function My(e){return e==="plain"||e==="flip"?e:void 0}function Ty(e){return e==="roll"||e==="fade"?e:void 0}function $y(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function bi(e){return e&&Ly.test(e)?e:void 0}var Ay=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],Ey=["color","accent"];function Ny(e){let t=e.props,r={};for(let o of Ay){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of Ey){let n=Re(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:Re(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:bi(t.labelWeight),fontFamily:yi(t.labelFont)}:void 0}}var Oy=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],By=["color","accent","glow"],Iy={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},Gy=["core","peak"];function Dy(e){let t=e.props,r={};for(let o of Oy){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of By)r[o]=Re(t[o])??Iy[o];for(let o of Gy){let n=Re(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:Re(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:bi(t.labelWeight),fontFamily:yi(t.labelFont)}:void 0}}function _y(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:Re(t.color),surface:Re(t.surface),divider:Re(t.divider),labelColor:Re(t.labelColor),fontFamily:yi(t.fontFamily),variant:My(t.variant),motion:Ty(t.motion),fontWeight:bi(t.fontWeight),fontSize:$y(t.fontSize)}}}var Fy={rollingNumber:_y,tickScale:Ny,ruler:Dy};function Qd(e){let t=e.component.type;return st(t)?Fy[t](e):Zd(e)}function Jd(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,ko)??"straight",color:Nt(t.stroke),strokeWidth:x(t.strokeWidth),strokeStyle:fe(t.strokeStyle,Co),opacity:t.opacity!==void 0?x(t.opacity):void 0}}}function ec(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:ke(t.stroke),strokeWidth:x(t.strokeWidth),textColor:ke(t.textColor),fontSize:x(t.fontSize),order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId}}function tc(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:x(t.strokeWidth)??2,cornerRadius:x(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:x(t.fontSize)??14,fontWeight:Me(t.fontWeight,So,"bold"),fontFamily:t.fontFamily,dash:Qe(t.dash),showLabel:t.showLabel!=="false",labelPosition:Me(t.labelPosition,Ld,"top"),shadow:t.shadow!=="false",clip:t.clip==="true"||void 0,order:e.order,sourceIndex:e.sourceIndex}}function rc(e){let t=e.props,r=Le(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:ke(t.fill)??"#f8fafc",strokeColor:ke(t.stroke)??"#111827",strokeWidth:x(t.strokeWidth)??1,cornerRadius:x(t.cornerRadius)??(e.isometric.footprint?0:8),seams:t.seams==="false"?!1:void 0,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:x(t.labelOffsetX)??0,labelOffsetY:x(t.labelOffsetY)??0,labelBackground:ke(t.labelBackground),parentFrameId:e.parentFrameId}}function oc(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:x(t.weight),showWeight:t.showWeight!=="false",style:{pathType:fe(t.route,ko),color:Nt(t.stroke),strokeWidth:x(t.strokeWidth),strokeStyle:fe(t.strokeStyle,Co),opacity:t.opacity!==void 0?x(t.opacity):void 0,fontSize:x(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:Le(t.shadow)},startMarker:fe(t.markerStart,gi),endMarker:fe(t.markerEnd,gi),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 nc(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:Me(e.path?.startMarker,hi,"none"),endMarker:Me(e.path?.endMarker,hi,"none"),closed:e.path?.closed??!1,strokeColor:ke(t.stroke)??"#7c3aed",strokeWidth:x(t.strokeWidth)??2,dash:Qe(t.dash)??[],opacity:x(t.opacity)??1,fillColor:ke(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}var Hy=["cover","contain","fill"];function Vy(e){return e||"rectangle"}function ic(e,t){let r=e?.split(",").map(Number);return r?.length===t&&r.every(Number.isFinite)?r:void 0}function Wy(e){let t=ic(e.imageSize,2),r=ic(e.crop,4);return{src:e.src,fit:Me(e.fit,Hy,"cover"),pixels:t&&t[0]>0&&t[1]>0?[t[0],t[1]]:void 0,crop:r&&r[2]>0&&r[3]>0?{x:r[0],y:r[1],width:r[2],height:r[3]}:void 0}}function ac(e,t){let r=e.props,o=e.kind==="text",n=e.kind==="image",i=o||n;return{id:e.id,type:"shape",text:e.text??null,shapeType:Vy(e.shapeType??(n&&r.cornerRadius?"rounded_rectangle":void 0)),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:Ce(r.fill??(i?"none":void 0)),strokeColor:Nt(r.stroke??(i?"none":void 0)),isText:o||void 0,strokeWidth:x(r.strokeWidth),textColor:r.textColor,fontSize:x(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:Me(r.fontWeight,Pd,"normal"),letterSpacing:x(r.letterSpacing),lineHeight:x(r.lineHeight),fontFamily:r.fontFamily,textAlign:fe(r.textAlign,Md),textVerticalAlign:fe(r.verticalAlign,Td),cornerRadius:x(r.cornerRadius),shadowStyle:Le(r.shadow),dash:Qe(r.dash),strokeStyle:fe(r.strokeStyle,Ad),opacity:x(r.opacity),blur:x(r.blur),blend:fe(r.blend,$d),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0,image:n&&r.src?Wy(r):void 0}}function sc(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:x(t.strokeWidth)??2,cornerRadius:x(t.cornerRadius)??12,dash:Qe(t.dash),shadowStyle:Le(t.shadow),textColor:t.textColor??"#6b7280",fontSize:x(t.fontSize)??22,fontWeight:Me(t.fontWeight,So,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var xi=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function lc(e){let t=xi(e.canvasObjects),r=new Map((e.shaders??[]).map(o=>[o.name,o]));return{shapes:t.filter(o=>o.objectType==="shape").map(o=>ac(o,r)),frames:t.filter(o=>o.objectType==="frame").map(tc),swimlanes:t.filter(o=>o.objectType==="swimlane").map(sc),isometricObjects:t.filter(yr).map(rc),paths:t.filter(o=>o.objectType==="path").map(nc),dimensions:t.filter(gr).map(ec),charts:t.filter(o=>o.objectType==="chart").map(Kd),components:t.filter(o=>o.objectType==="component"&&o.component!==void 0).map(Qd),links:xi(e.links).map(oc),connections:xi(e.connections).map(Jd)}}var Ro=new Set(["top","front","right"]),dc=Math.PI/6,We=Math.cos(dc),ze=Math.sin(dc);function Si(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)*We,height:r+(t+o)*ze}}function Ci(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*We/2,y:e.y+(t+r)*ze/2}}function zy(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 ki(e,t){return zy(Ye(e)[t])}function Ye(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*We,y:r},s={x:o*We,y:o*ze},l={x:-i*We,y:i*ze},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},b={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,m,u],bottom:[f,b,h,y],front:[u,m,h,y],back:[a,c,b,f],right:[m,c,b,h],left:[a,u,y,f]}}function Yy(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 wo(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 Uy=Math.PI/12;function cc(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 b=Math.min(t/Math.tan(y/2),Math.min(m,f)/2),S=b*Math.tan(y/2),R={x:c.x/m,y:c.y/m},k={x:u.x/f,y:u.y/f},N={x:s.x+R.x*b,y:s.y+R.y*b},F={x:s.x+k.x*b,y:s.y+k.y*b},G={x:R.x+k.x,y:R.y+k.y},X=Math.hypot(G.x,G.y),se=S/Math.sin(y/2),xe={x:s.x+G.x/X*se,y:s.y+G.y/X*se},at=Math.atan2(N.y-xe.y,N.x-xe.x),vt=Math.atan2(F.y-xe.y,F.x-xe.x)-at;vt-=2*Math.PI*Math.round(vt/(2*Math.PI));let Ds=Math.max(2,Math.ceil(Math.abs(vt)/Uy));for(let Xn=0;Xn<=Ds;Xn+=1){let _s=at+vt*Xn/Ds;i.push([(xe.x+S*Math.cos(_s))/r,(xe.y+S*Math.sin(_s))/o])}}return i}function Ri(e,t,r=0){let o=Math.max(0,e.width),n=Math.max(0,e.depth),i=Math.max(0,e.height),a=cc(wo(t),r,o,n),s=e.x+n*We,l=([h,y],b)=>({x:s+(h*o-y*n)*We,y:e.y+(h*o+y*n)*ze+b}),d=a.map(h=>l(h,0)),c=Yy(a)>=0?1:-1,u=a.map((h,y)=>{let b=a[(y+1)%a.length],S=(b[0]-h[0])*o,R=(b[1]-h[1])*n,k=Math.hypot(S,R),N=k===0?0:R/k*c,F=k===0?0:-S/k*c;return{from:h,to:b,length:k,normalU:N,normalV:F,visible:k>0&&N+F>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 b=u[(y-1+u.length)%u.length],S=u[(y+1)%u.length],{from:R,to:k}=h;f.push({points:[l(R,0),l(k,0),l(k,i),l(R,i)],light:.72+.28*Math.max(0,Math.min(1,h.normalV/(Math.abs(h.normalU)+Math.abs(h.normalV)))),depth:(R[0]+k[0])/2+(R[1]+k[1])/2,smoothStart:m(b,h),smoothEnd:m(h,S)})}),f.sort((h,y)=>h.depth-y.depth),{top:d,sides:f}}var vo=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}},Ie=e=>{let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=t[1].length===3?[...t[1]].map(n=>n+n).join(""):t[1],o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},Ue=(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 jy(e,t,r){let o=vo(e),n=vo(t),i=o.a??1,a=n.a??1;return Ue(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 xr(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 jy(a.color,s.color,d)}}return n.color}function wi(e,t){let r=Ie(e);if(!r)return e;let[o,n,i]=r;return Ue(o*t,n*t,i*t)}function Ot(e,t){return wi(e,t)}function vi(e){return{topFill:e,frontFill:wi(e,.95),sideFill:wi(e,.88)}}var Xy=Math.PI/180;function qy(e,t){let r=t*Xy,o=Math.cos(r),n=Math.sin(r);return{x:e.x*o-e.y*n,y:e.x*n+e.y*o}}function Ky(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function uc(e,t){let r=Ky(e),o=e.rotation?qy(t,e.rotation):t;return{x:r.x+o.x,y:r.y+o.y}}function Pi(e,t){return uc(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function Bt(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Li(e,t){let r=Bt(e),o=Bt(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 Zy(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 Qy(e,t){let r=e.symbol?.ports?.find(o=>o.name===t.port);return r?Pi({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):Bt(e)}function Mi(e,t,r){let o=Jy(e,t),n=eb(o.explicit);if(n)return n;let i=mc(r,o.canvasObjectId);if(!i)return{x:0,y:0};let a=tb(i,o.explicit);return a||rb(i,mc(r,o.oppositeCanvasObjectId))}function Jy(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function eb(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function tb(e,t){return t?.kind==="port"?Qy(e,t):t?.kind==="side"?Zy(e,t):null}function rb(e,t){return t?Li(e,t):Bt(e)}function mc(e,t){return e.find(r=>r.id===t)}var ob=15e3;function nb(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function pc(e,t){return e?ki(e,t):{x:0,y:0}}function fc(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??ob+r}}function ib(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Ro.has(t.fromFace)?void 0:fc(e,t.fromId),Ro.has(t.toFace)?void 0:fc(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 ab(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,...ib(e.isometricObjects,r)},from:pc(t.get(r.fromId??""),r.fromFace),to:pc(t.get(r.toId??""),r.toFace),kind:"connection"}))}function hc(e){let t=nb(e);return[...e.links.map(o=>({link:o,from:Mi(o,"from",t),to:Mi(o,"to",t)})),...ab(e)]}function Ti(e){let t=vd(e),r=lc(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:hc(r),diagnostics:t.diagnostics}}function re(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 $i={minX:0,minY:0,maxX:100,maxY:100};function le(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 A(e,t,r=0){return t?db(sb(e,t),r):le(e,r)}function sb(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 lb(e).map(s=>({x:r+(s.x-r)*i-(s.y-o)*a,y:o+(s.x-r)*a+(s.y-o)*i}))}function lb(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 db(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(yo(e))return cb(e);let t=e.points[0],r=[`M ${t.x} ${t.y}`];for(let{to:o,controls:n}of bo(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 cb(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 gc(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 yc(e,t){return e.sourceIndex??t}function v(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 O="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var bc="#94a3b8";function xc(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=A({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:bc},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:O,fontSize:12,fontWeight:"normal",color:bc,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function Sc(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:A({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,value:ur(e.value,e.digits),digits:e.digits,duration:Math.max(0,p(e.duration,420)),label:e.label,componentStyle:Qn(e.style)}]}function Cc(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:A({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(...ub(e,{x:r,y:o,width:n,height:i,rotation:a,max:s,order:1e4+t})),d}function ub(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,b=d+Math.cos(y)*s*(t.width/2),S=c-Math.sin(y)*s*(t.height/2),R={x:b-24,y:S-l,width:48,height:l*2};m.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:A(R,0,2),...R,lines:[String(Math.round(t.max*h*10)/10)],fontFamily:r.fontFamily||O,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return m}function kc(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:A({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,b=a+(1-2*a)*y,S=o?{x:t.x+t.width*b-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-b)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${h}`,type:"text",order:t.order+.1,bounds:A(S,0,2),...S,lines:[String(Math.round((t.min+(t.max-t.min)*y)*10)/10)],fontFamily:r.fontFamily||O,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:o?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var pb="#94a3b8";function J(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 L=(e,t)=>String(e.properties[t]??""),$=(e,t)=>Number(e.properties[t]??0),_=e=>({kind:"solid",color:e}),me=(e,t)=>e.disabled?pb:t;function W(e,t){let r=Number(e.properties.animate??0),o=e.disabled?{...t,opacity:.4}:t;return r>0?{...o,transition:r}:o}function ee(e,t,r=!0){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:A(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:r?"all":"none"}}}function ae(e,t,r,o,n){return{id:`widget-${e.id}-${t}`,type:"text",order:n,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[o.text],fontFamily:O,fontSize:o.fontSize,fontWeight:"600",color:o.color,align:o.align,verticalAlign:"middle",lineHeight:1.3}}function Rc(e,t){let r=J(e,t,{width:120,height:40}),o=[ee(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min($(e,"radius"),r.height/2),style:W(e,{fill:_(L(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let n={text:e.label,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"center"};o.push(ae(e,"label",r,n,r.order+.2))}return o}var fb=.22,hb=.5,gb=[[.24,.52],[.43,.72],[.78,.3]];function yb(e){let[t,...r]=gb.map(([o,n])=>`${e.x+o*e.width} ${e.y+n*e.width}`);return`M ${t} ${r.map(o=>`L ${o}`).join(" ")}`}function bb(e,t,r){let o=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:A(r,0,2),...r,rx:r.width*fb,style:W(e,{fill:o?_(L(e,"accent")):{kind:"none"},stroke:_(o?L(e,"accent"):L(e,"stroke")),strokeWidth:1.5})}}function xb(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:A(r,0,0),d:yb(r),style:W(e,{fill:{kind:"none"},stroke:_(L(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function Sb(e,t,r,o){let n=r*hb,i={x:t.x+r+n,y:t.y,width:Math.max(0,t.width-r-n),height:t.height},a={text:o,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"left"};return ae(e,"label",i,a,t.order+.3)}function wc(e,t){let r=J(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[ee(e,r),bb(e,r,n),...e.value===!0?[xb(e,r,n)]:[],...e.label?[Sb(e,r,o,e.label)]:[]]}var vc=.25;function Lo(e,t){let r=Ie(e);return r&&t<1?`rgba(${r[0]}, ${r[1]}, ${r[2]}, ${Number(t.toFixed(3))})`:e}var j=e=>String(Number(e.toFixed(3))),It=(e,t)=>L(e,t)==="none",Mo=(e,t,r)=>It(e,t)?r:L(e,t)||r;function Cb(e,t){let r=Math.min(t.width,t.height)/2,o=Math.max(.5,$(e,"width")),n=Math.min(1,Math.max(0,$(e,"taper")));return{cx:t.x+t.width/2,cy:t.y+t.height/2,radius:r,length:Math.max(1,$(e,"length")*r),tail:Math.max(0,$(e,"tail")*r),gap:Math.max(0,$(e,"gap")*r),rootHalf:o/2,tipHalf:Math.max(vc,o*n/2)}}function Pc({cx:e,cy:t,length:r,tail:o,gap:n,rootHalf:i,tipHalf:a}){let s=n>0?t-n:t,l=n>0?0:o,d=`L${j(e-a)} ${j(t-r)}`,c=`A${j(a)} ${j(a)} 0 0 1 ${j(e+a)} ${j(t-r)}`,u=`A${j(i)} ${j(i)} 0 0 1 ${j(e-i)} ${j(s+l)}`;return n>0?`M${j(e-i)} ${j(s)}${d}${c}L${j(e+i)} ${j(s)}${u}Z`:[`M${j(e-i)} ${j(s+l)}`,`L${j(e-i)} ${j(s)}`,d,c,`L${j(e+i)} ${j(s)}`,`L${j(e+i)} ${j(s+l)}`,l>0?u:`L${j(e-i)} ${j(s)}`,"Z"].join("")}function kb(e,t){let r=e.rootHalf*t.scale,o=t.taper===void 0?e.tipHalf*t.scale:r*t.taper;return{...e,length:e.length*(t.length??1),rootHalf:r,tipHalf:Math.max(vc,o)}}function Rb(e,t,r,o){let n=e.gap>0?0:e.tail,i=l=>(n+l*e.length)/(e.length+n)*100,[,a,s]=t[0];return{kind:"linear-gradient",angle:-90,stops:[...n>0?[{offset:0,color:Lo(a,s*(o?0:1-r))}]:[],...t.map(([l,d,c],u)=>({offset:i(l),color:Lo(d,o&&u===0?0:c)}))]}}function wb(e,t,r,o){return r<=0&&o<=0&&!t.clear?_(t.color):{kind:"linear-gradient",angle:-90,stops:[{offset:0,color:Lo(t.root,t.clear?0:1-r)},...e.gap===0&&e.tail>0?[{offset:e.tail/(e.length+e.tail)*100,color:t.root}]:[],{offset:100,color:Lo(t.color,1-o)}]}}function Ai(e,t,r,o,n,i){let a=kb(r,n),s=Math.min(1,Math.max(0,$(e,"fade"))),l=Math.min(1,Math.max(0,n.tipFade??$(e,"tipFade"))),d=$(e,"glow"),c=n.blur>0,u=Math.max(a.rootHalf,a.tipHalf),m=a.gap>0?-a.gap:a.tail,f={x:a.cx-u,y:a.cy-a.length,width:u*2,height:a.length+m};return{id:`widget-${e.id}-${n.part}`,type:"path",order:t.order+i,bounds:A(f,0,0),d:Pc(a),rotation:o,rotationCenter:{x:a.cx,y:a.cy},style:W(e,{fill:n.stops?Rb(a,n.stops,s,!!n.clear):wb(a,n,s,l),stroke:{kind:"none"},...c?{blur:n.blur,opacity:n.opacity}:{},...!c&&d>0&&!It(e,"glowColor")?{shadow:{color:Mo(e,"glowColor",n.color),opacity:1,blur:d,dx:0,dy:0}}:{}})}}function vb(e,t,r,o,n,i){let a=[{part:"hand-light",scale:4.5,length:.55,taper:.15,blur:o*3,opacity:1,color:r,root:r,stops:[[0,r,.95],[.35,r,.45],[1,r,0]]},{part:"hand-body",scale:1.6,taper:.25,blur:o,opacity:1,color:e,root:t,clear:n,stops:[[0,t,1],[.18,e,1],[.6,e,.55],[1,e,0]]},{part:"hand",scale:.55,length:.8,taper:.3,blur:o*.3,opacity:1,color:t,root:t,clear:n,stops:[[0,t,1],[.45,t,.6],[1,t,0]]}];return i?a:a.slice(1)}function Pb(e,t,r,o){let n=L(e,"color"),i=Mo(e,"root",n),a=Mo(e,"glowColor",n),s=!It(e,"glowColor"),l=It(e,"root"),d=$(e,"soft"),c=$(e,"bloom");return d>0?vb(n,i,a,d,l,s).map((u,m)=>Ai(e,t,r,o,u,.26+m*.02)):[...c>0&&s?[Ai(e,t,r,o,{part:"hand-bloom",scale:4,blur:c,opacity:.9,color:a,root:a,tipFade:1},.26)]:[],Ai(e,t,r,o,{part:"hand",scale:1,blur:0,opacity:1,color:n,root:i,clear:l},.3)]}function Lb(e,t,r,o){let n=$(e,"hubRing");return{id:`widget-${e.id}-hub`,type:"ellipse",order:t.order+.4,bounds:A({x:r.cx-o,y:r.cy-o,width:o*2,height:o*2},0,n),cx:r.cx,cy:r.cy,rx:Math.max(.5,o-n/2),ry:Math.max(.5,o-n/2),style:W(e,{fill:It(e,"hubFill")?{kind:"none"}:_(L(e,"hubFill")),stroke:n>0?_(L(e,"color")):{kind:"none"},strokeWidth:n,...$(e,"glow")>0&&!It(e,"glowColor")?{shadow:{color:Mo(e,"glowColor",L(e,"color")),opacity:1,blur:$(e,"glow"),dx:0,dy:0}}:{}})}}var Po=8;function Mb(e,t,r,o){let n={...r,rootHalf:Math.max(r.rootHalf,Po),tipHalf:Math.max(r.tipHalf,Po)},i=n.gap>0?-n.gap:n.tail,a={x:n.cx-Po,y:n.cy-n.length,width:Po*2,height:n.length+i};return[ee(e,t,!1),{id:`widget-${e.id}-pick`,type:"path",order:t.order+.5,bounds:A(a,0,0),d:Pc(n),rotation:o,rotationCenter:{x:n.cx,y:n.cy},style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}]}function Lc(e,t){let r=J(e,t,{width:200,height:200}),o=Cb(e,r),n=$(e,"max")||1,i=$(e,"start")+Number(e.value)/n*360,a=$(e,"hub");return[...Mb(e,r,o,i),...Pb(e,r,o,i),...a>0?[Lb(e,r,o,a)]:[]]}var Tb=.62;function $b(e){return e>0?String(e).split(".")[1]?.length??0:0}function Ab(e,t){let r=L(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?Number(e.value).toFixed($b($(e,"step"))):""}function Eb(e,t){let r=$(e,"min"),o=$(e,"max"),n=Math.min($(e,"thickness"),Math.min(t.width,t.height)/3),i=Math.max(1,Math.min(t.width,t.height)/2-n/2);return{cx:t.x+t.width/2,cy:t.y+t.height/2,radius:i,thickness:n,fraction:Math.min(1,Math.max(0,(Number(e.value)-r)/(o-r||1))),start:$(e,"start"),sweep:Math.min(360,Math.max(1,$(e,"sweep"))),circumference:2*Math.PI*i,rounded:L(e,"rounded")!=="false"}}function Mc(e,t,r,o,n,i,a,s={}){let{cx:l,cy:d,radius:c,thickness:u}=r;return{id:`widget-${e.id}-${o}`,type:"ellipse",order:t.order+n,bounds:A({x:l-c,y:d-c,width:c*2,height:c*2},0,u),cx:l,cy:d,rx:c,ry:c,rotation:-r.start,style:W(e,{fill:{kind:"none"},stroke:_(i),strokeWidth:u,dash:[Math.max(.001,a),r.circumference],lineCap:r.rounded?"round":"butt",...s})}}function Tc(e,t,r,o,n,i,a){return{id:`widget-${e.id}-${r}`,type:"ellipse",order:t.order+o,bounds:A({x:n.x-i,y:n.y-i,width:i*2,height:i*2},0,0),cx:n.x,cy:n.y,rx:i,ry:i,style:W(e,{fill:_(a),stroke:{kind:"none"}})}}function $c(e,t){let r=J(e,t,{width:96,height:96}),o=Eb(e,r),{cx:n,cy:i,radius:a,thickness:s,fraction:l,sweep:d,circumference:c}=o,u=(o.start-l*d)*Math.PI/180,m=Math.max(1,a-s/2-Math.max(2,s*.4)),f=s/2*Tb+1,h=[ee(e,r),Mc(e,r,o,"track",.1,L(e,"track"),d/360*c),Mc(e,r,o,"fill",.2,L(e,"accent"),l*d/360*c,{opacity:l>0?1:0}),Tc(e,r,"face",.3,{x:n,y:i},m,L(e,"face")),Tc(e,r,"dot",.4,{x:n+a*Math.cos(u),y:i-a*Math.sin(u)},f,L(e,"dot"))],y=Ab(e,l);if(y){let b={text:y,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"center"};h.push(ae(e,"value",{x:n-m,y:i-m,width:m*2,height:m*2},b,r.order+.5))}return h}function Nb(e,t){let r=L(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?String(Number(e.value)):""}function Ob(e,t,r,o){let n=Math.min($(e,"thickness"),Math.min(t.width,t.height)/2),i=Math.max(1,Math.min(t.width,t.height)/2-n/2),a=2*Math.PI*i,s=t.x+t.width/2,l=t.y+t.height/2,d=(c,u,m,f)=>({id:`widget-${e.id}-${c}`,type:"ellipse",order:t.order+u,bounds:A({x:s-i,y:l-i,width:i*2,height:i*2},0,n),cx:s,cy:l,rx:i,ry:i,rotation:-90,style:W(e,{fill:{kind:"none"},stroke:_(m),strokeWidth:n,...f})});return[d("track",.1,L(e,"track"),{}),d("fill",.2,L(e,"accent"),{dash:[Math.max(.001,r*a),a],lineCap:o?"round":"butt",opacity:r>0?1:0})]}function Bb(e,t,r,o){let n=L(e,"direction")==="vertical",i=o?(n?t.width:t.height)/2:0,a=(l,d,c,u,m)=>{let f=n?{x:t.x,y:t.y+t.height-c,width:t.width,height:c}:{x:t.x,y:t.y,width:c,height:t.height};return{id:`widget-${e.id}-${l}`,type:"rect",order:t.order+d,bounds:A(f,0,0),...f,rx:i,style:W(e,{fill:_(u),stroke:{kind:"none"},...m===void 0?{}:{opacity:m}})}},s=n?t.height:t.width;return[a("track",.1,s,L(e,"track")),a("fill",.2,Math.max(0,r*s),L(e,"accent"),r>0?1:0)]}function Ac(e,t){let r=J(e,t,{width:220,height:12}),o=$(e,"min"),n=$(e,"max"),i=Math.min(1,Math.max(0,(Number(e.value)-o)/(n-o||1))),a=L(e,"rounded")!=="false",s=[ee(e,r),...L(e,"variant")==="ring"?Ob(e,r,i,a):Bb(e,r,i,a)],l=Nb(e,i);if(l){let d={text:l,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"center"};s.push(ae(e,"value",r,d,r.order+.3))}return s}function Ec(e,t){let r=J(e,t,{width:300,height:40}),o=L(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($(e,"inset"),r.height/2),s=Math.min($(e,"radius"),r.height/2),l=(r.width-a*2)/n,d={y:r.y+a,height:r.height-a*2},c=[ee(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:s,style:W(e,{fill:_(L(e,"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-active`,type:"rect",order:r.order+.2,bounds:A({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:W(e,{fill:_(L(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=me(e,L(e,m===i?"activeTextColor":"textColor"));c.push(ae(e,`option-${m}`,f,{text:u,color:h,fontSize:$(e,"fontSize"),align:"center"},r.order+.3))}),c}function Ei(e,t){return e==="field"?Math.min(8,t/2):t/2}var $e=4,Nc=12,Ni=5,Gt=1.5;function Ib(e){return e>0?String(e).split(".")[1]?.length??0:0}function Gb(e,t){let r=L(e,"display"),o=Ib($(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 Dt=(e,t,r,o,n,i,a={})=>({id:`widget-${e.id}-${r}`,type:"rect",order:t.order+o,bounds:A(n,0,0),...n,style:W(e,{fill:_(i),stroke:{kind:"none"},...a})});function Bc(e,t,r,o,n){let i=Math.round($(e,"ticks")),a=L(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)-Gt/2,width:Ni,height:Gt,rx:Gt/2}:{x:t.x+o+d*(t.width-o*2)-Gt/2,y:t.y+n,width:Gt,height:Ni,rx:Gt/2};return Dt(e,t,`tick-${l}`,.15,c,a)})}function Ic(e,t,r){return o=>r?e.y+e.height-t-o*(e.height-t*2):e.x+t+o*(e.width-t*2)}function Db(e,t,r,o){let n=Ei("line",o?t.width:t.height),i=n*$(e,"thumbSize")/100,a=Math.min($(e,"trackHeight"),o?t.width:t.height),s=o?t.x+t.width/2:t.y+t.height/2,l=Ic(t,n,o),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 b=o?s:l(h),S=o?l(h):s;return{id:`widget-${e.id}-${f}`,type:"ellipse",order:t.order+y,bounds:A({x:b-i,y:S-i,width:i*2,height:i*2},0,0),cx:b,cy:S,rx:i,ry:i,style:W(e,{fill:_(L(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:3,dx:0,dy:1}})}};return[Dt(e,t,"track",.1,c,L(e,"track")),...Bc(e,t,o,n,o?t.width/2+a/2+5:t.height/2+a/2+5),Dt(e,t,"fill",.2,u,L(e,"accent")),...r.two?[m("thumb-start",r.from,.3)]:[],m(r.two?"thumb-end":"thumb",r.to,.31)]}function _b(e,t,r,o,n,i){let a=Math.min(n,i)-(r.two?$e/2:0),s=Math.max(n,i)+$e/2;return o?{...e,y:r.two?a:i-$e/2,height:r.two?s-a:Math.max(0,t.y+t.height-i+$e/2),rx:r.two?0:e.rx}:{...e,x:r.two?a:t.x,width:r.two?s-a:Math.max(0,i+$e/2-t.x),rx:r.two?0:e.rx}}function Oc(e,t,r,o,n){let i=(r?t.width:t.height)*.5,a=r?{x:t.x+(t.width-i)/2,y:n-$e/2,width:i,height:$e,rx:$e/2}:{x:n-$e/2,y:t.y+(t.height-i)/2,width:$e,height:i,rx:$e/2};return Dt(e,t,o,.3,a,L(e,"accent"))}function Fb(e,t,r,o){let n={color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize")},i=Gb(e,r);if(o)return i?[ae(e,"value",{x:t.x,y:t.y+6,width:t.width,height:20},{...n,text:i,align:"center"},t.order+.4)]:[];let a={y:t.y,height:t.height,width:Math.max(0,t.width/2-Nc)},s=[];return e.label&&s.push(ae(e,"label",{x:t.x+Nc,...a},{...n,text:e.label,align:"left"},t.order+.4)),i&&s.push(ae(e,"value",{x:t.x+t.width/2,...a},{...n,text:i,align:"right"},t.order+.4)),s}function Hb(e,t,r,o){let n=Ei("field",o?t.width:t.height),i=Math.min($(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=Ic(t,n,o),l=r.two?s(r.from):o?t.y+t.height:t.x,d=s(r.to);return[Dt(e,t,"track",.1,a,L(e,"surface")),Dt(e,t,"fill",.2,_b(a,t,r,o,l,d),L(e,"fill")),...r.two?[Oc(e,t,o,"handle-start",l)]:[],Oc(e,t,o,r.two?"handle-end":"handle",d),...Fb(e,t,r,o),...o?[]:Bc(e,t,!1,n,t.height-Ni-5)]}function Oi(e,t){let r=L(e,"variant")==="field",o=L(e,"direction")==="vertical",i=J(e,t,o?{width:r?56:28,height:180}:{width:220,height:r?36:28}),a=$(e,"min"),s=$(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[ee(e,i),...r?Hb(e,i,m,o):Db(e,i,m,o)]}var Vb=.12;function Gc(e,t){let r=J(e,t,{width:52,height:30}),o=e.value===!0,n=r.height*Vb,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[ee(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:W(e,{fill:_(L(e,o?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:A(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:W(e,{fill:_(L(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function Dc(e,t){let r=J(e,t,{width:120,height:40}),o=e.value===!0,n=[ee(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:A(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:W(e,{fill:o?_(L(e,"accent")):{kind:"none"},stroke:_(o?L(e,"accent"):L(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:me(e,L(e,o?"onTextColor":"textColor")),fontSize:$(e,"fontSize"),align:"center"};n.push(ae(e,"label",r,i,r.order+.2))}return n}var he=e=>(t,r)=>e(t,r),Wb=new Map([["rollingNumber",he(Sc)],["tickScale",he(Cc)],["ruler",he(kc)],["switch",he(Gc)],["checkbox",he(wc)],["toggleButton",he(Dc)],["button",he(Rc)],["slider",he(Oi)],["progress",he(Ac)],["segmented",he(Ec)],["knob",he($c)],["hand",he(Lc)],["range",he(Oi)]]);function _c(e){return Wb.get(e)}function zb(e){let t=Pt(e.type)?.role;if(!t||!Jr(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 Yb(e){return e.label??(Jr(e)?e.id:String(e.value))}function Bi(e){return e.flatMap((t,r)=>{let o=_c(t.type)??xc,n=re(o(t,r),"widget",t.id,t.type,Yb(t),t.parentFrameId),i=zb(t),a=n.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),n})}function Ii(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 Gi(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 Sr(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 Cr(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 To(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 $o=8;function Ub(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:Gi(n,i,r,t,$o)}}case"left":{let n=e.x-t,i=e.y-o;return{x:n,y:i,width:t,height:r,path:Sr(n,i,t,r,$o)}}case"right":{let n=e.x+e.width,i=e.y-o;return{x:n,y:i,width:t,height:r,path:Cr(n,i,t,r,$o)}}default:{let n=e.x-o,i=e.y-t;return{x:n,y:i,width:r,height:t,path:Ii(n,i,r,t,$o)}}}}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=Ub(e,t,o),i=le(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?Xb(e,n,r,i):jb(e,n,r,i)]}function jb(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??O,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Xb(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??O,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 Kb(e,t,r){let o=e.shadow??!0,n=le({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(o?20:4)),i={...To(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 Vc(e,t){if(e.isVisible===!1)return[];let r=t,o=(e.showLabel??!0)&&!!e.title,n=[Kb(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 Zb(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function Ao(e){if(!e?.enabled)return;let t=Zb(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 Qb(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 Wc(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:Qb(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function zc(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??O,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function Jb(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{...zc(e,t,r),bounds:A({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 ex(e,t,r){return{...zc(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 Yc(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?Jb:ex;return e.lanes.map((r,o)=>t(e,r,o))}function tx(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 rx(e){let t=0;return tx(e).map(r=>{let o={...r,offset:t};return t+=r.size,o})}function Uc(e,t){return{swimlane:e,order:5e3+t,bounds:le({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:rx(e)}}function jc(e,t){if(e.isVisible===!1)return[];let r=Uc(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:{...To(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:Ao(e.shadowStyle)}},...Wc(r),...Yc(r)]}function Xc(e){return[...e.frames.flatMap((t,r)=>re(Vc(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>re(jc(t,r),"swimlane",t.id))]}var kr=(e,t,r)=>({x:e.x+t.x*r,y:e.y+t.y*r});function Di(e){return Math.hypot(e.end.x-e.start.x,e.end.y-e.start.y)}function Eo(e){return e.text!==void 0?e.text:`${Math.round(Di(e)*10)/10}${e.unit?` ${e.unit}`:""}`}function _i(e){let t=Di(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=[kr(e.start,o,e.offset),kr(e.end,o,e.offset)],a=Math.abs(e.offset)<=4?[]:[e.start,e.end].map(c=>[kr(c,o,4*n),kr(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:kr(l,o,s),angle:d}}}var Kc="#475569",ox=.6,nx=e=>e.map(([t,r])=>`M ${t.x} ${t.y} L ${r.x} ${r.y}`).join(" ");function qc(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:nx(o),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??Kc},strokeWidth:n,lineCap:"round"}}}function ix(e,t,r,o,n){let i=p(e.fontSize,11),a=Math.max(24,r.length*i*ox+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:O,fontSize:i,fontWeight:"normal",color:e.textColor??e.strokeColor??Kc,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:n,rotationCenter:o}}function ax(e,t){let r=_i(e),o=31e3+t,n={...qc(e,"line",o+.1,[r.line]),markerStart:"filled_arrow",markerEnd:"filled_arrow"},i=r.extensions.length>0?[qc(e,"extensions",o,r.extensions)]:[],a=Eo(e);return[...i,n,ix(e,o+.2,a,r.label.center,r.label.angle)]}function Zc(e){return e.flatMap((t,r)=>re(ax(t,r),"dimension",t.id,"dimension",Eo(t),t.parentFrameId))}function Fi(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Qc(e,t,r){let o=Fi(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 sx(e,t,r,o){let n=Math.max(0,Math.min(o,Fi(t,e)/2,Fi(t,r)/2));return{vertex:t,start:Qc(t,e,n),end:Qc(t,r,n)}}function ut(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)=>sx(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 lx={prop:"style.fill",propKind:"color",propSolidOnly:!0};function _t(e,t){let r=Math.max(0,p(e.strokeWidth,1)),o=p(e.rotation,0),n=Si(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:A(n,o,r+2),rotation:o,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function Rr(e,t,r,o,n){return{...e.common,id:`isometric-${e.object.id}-${t}`,order:e.order+r,d:ut([...o],0),style:n,...lx}}function Hi(e){let t=Ye(e);return[t.top[0],t.top[1],t.right[2],t.front[2],t.front[3],t.top[3]]}function Vi(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 No(e){return{...Vi(e,ut(Hi(e.object),0),0),style:{...e.common.style,fill:{kind:"none"},stroke:{kind:"none"}}}}var Wi=20,dx=12,cx=6,Oo=3,ux=6.5;function mx(e){let{object:t}=e,r=Ci(t),o=r.y-dx+p(t.labelOffsetY,0);return{anchor:r,centerX:r.x+p(t.labelOffsetX,0),topY:o-Wi,bottomY:o}}function px(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:Wi,lines:[r],fontFamily:O,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function fx(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 hx(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*ux+cx*2);return{type:"rect",id:`isometric-${n.id}-label-background`,order:i+.28,x:s-c/2,y:l-Oo,width:c,height:Wi+Oo*2,rx:4,bounds:{minX:s-c/2,minY:l-Oo,maxX:s+c/2,maxY:d+Oo},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:o},stroke:{kind:"none"}}}}function Ft(e,t){let r=mx(e),o=px(e,r,t),n=fx(e,r),i=e.object.labelBackground;return i?[n,hx(e,r,t,i),o]:[n,o]}function Bo(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,b)=>y+b.x,0)/d.length,y:d.reduce((y,b)=>y+b.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:ut(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 Jc(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)*ze/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 gx(e,t,r){let{object:o,common:n}=e,i={...n.style,stroke:{kind:"none"}},a=vi(o.fill??"#f8fafc"),s=(l,d,c,u)=>Rr(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 yx(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 eu(e,t){let r=_t(e,t),o=Ye(e),n=Math.max(0,p(e.cornerRadius,8)),i=ut(Hi(e),n),a={type:"path",d:i},s=Bo(r,o.top),l=e.seams===!1?void 0:yx(r,o,a),d=Vi(r,i,n),c=gx(r,o,a),u=s?[d,...c,s,...l?[l]:[]]:[d,...c,...l?[l]:[]];return e.text?[...u,...Ft(r,e.text)]:u}function bx(e,t,r,o){let n=Ot(o,t.light);return Rr(e,`side-${r}`,.05+r*.001,t.points,{...e.common.style,stroke:{kind:"solid",color:n},strokeWidth:.6,fill:{kind:"solid",color:n}})}function xx(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 tu(e,t,r){let o=_t(e,t),{top:n,sides:i}=Ri(e,r,Math.max(0,p(e.cornerRadius,0))),a=e.fill??"#f8fafc",s=Bo(o,n),l=Rr(o,"top",.2,n,{...o.common.style,fill:{kind:"solid",color:a}}),d=[No(o),...s?[s]:[],...i.flatMap((c,u)=>[bx(o,c,u,a),xx(o,c,u)]),l];return e.text?[...d,...Ft(o,e.text)]:d}function ru(e,t){let r=_t(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:Ot(d,1.22)},{offset:.5,color:d},{offset:1,color:Ot(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=Jc(r,a),h=[No(r),...f?[f]:[],u,m];return e.text?[...h,...Ft(r,e.text)]:h}function Sx(e,t){if(e.form==="sphere")return ru(e,t);let r=wo(e.footprint);return r.length>0?tu(e,t,r):eu(e,t)}function ou(e){return e.flatMap((t,r)=>re(Sx(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function Cx(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 nu(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=Cx(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??O,fontSize:n,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function iu(e){return[...nu(e,"start",0),...nu(e,"end",1)]}function au(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??O,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}function su(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 lu=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function Ge(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 Io(e,t,r,o){if(ge(e,r,o)<=t)return e;let n=e.length;for(;n>1&&ge(`${e.slice(0,n)}\u2026`,r,o)>t;)n-=1;return`${e.slice(0,n)}\u2026`}function ge(e,t,r){return e.length*t*(r?.64:.58)}function du(e){return{measure:(t,r)=>ge(t,e,r),spaceWidth:e*.58}}var mt=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function zi(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 Yi(e,t,r,o,n){let i=mt(e,t,n),a=mt(t,r,n),s=mt(r,o,n),l=mt(i,a,n),d=mt(a,s,n),c=mt(l,d,n);return{left:[e,i,l,c],right:[c,d,s,o]}}function Go(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:mt(i,a,l),segmentIndex:n}}o+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function Do(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 cu(e,t,r,o,n=40){let i=0,a=e;for(let s=1;s<=n;s++){let l=zi(e,t,r,o,s/n);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var Ht=40;function kx(e){let t=[0],r=e[0];for(let o=1;o<=Ht;o++){let n=zi(...e,o/Ht);t.push(t[o-1]+Math.hypot(n.x-r.x,n.y-r.y)),r=n}return t}function uu(e,t){let r=e[Ht];if(t<=0)return 0;if(t>=r)return 1;for(let o=1;o<=Ht;o++)if(e[o]>=t){let n=(t-e[o-1])/(e[o]-e[o-1]||1);return(o-1+n)/Ht}return 1}function Rx(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 mu(e,t){if(e.length<8)return null;let r=wx(e),o=kx(r),n=o[Ht];if(n===0)return null;let i=n/2,a=Math.max(0,i-t.minimumVisibleStub),s=Rx(r,t,a),l=uu(o,i-s),d=uu(o,i+s);return{before:vx(r,l),after:Px(r,d),bezier:!0}}function wx(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 vx(e,t){return t<=.01?null:Yi(...e,t).left.flatMap(r=>[r.x,r.y])}function Px(e,t){return t>=.99?null:Yi(...e,t).right.flatMap(r=>[r.x,r.y])}function pu(e,t){if(e.length<4)return null;let r=Do(e);if(r===0)return null;let o=Lx(e,r,t);return{before:Tx(e,o.beforeLength),after:$x(e,o.afterLength,r),bezier:!1}}function Lx(e,t,r){let o=t/2,n=Go(e,o),i={x:e[n.segmentIndex],y:e[n.segmentIndex+1]},a={x:e[n.segmentIndex+2],y:e[n.segmentIndex+3]},s=Mx(i,a,r,o);return{beforeLength:o-s,afterLength:o+s}}function Mx(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 Tx(e,t){if(t<=.5)return null;let r=Go(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function $x(e,t,r){if(t>=r-.5)return null;let o=Go(e,t);return[o.point.x,o.point.y,...e.slice(o.segmentIndex+2)]}var fu=3,Ax=10;function Ex(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 Ui(e,t){return t?cu(...Ex(e)):Do(e)}function hu(e,t,r,o){let n={halfWidth:(r+fu)/2,halfHeight:(o+fu)/2,minimumVisibleStub:Ax};return t==="curved"?mu(e,n):pu(e,n)}function ji(e,t,r,o){let n=hu(e,t,r,o);if(!n||!n.before&&!n.after)return null;let i=Ui(e,n.bezier),a=n.before?Ui(n.before,n.bezier):0,s=n.after?Ui(n.after,n.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Nx(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 Ox(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 Xi(e,t,r,o){if(t==="curved")return Nx(e);let n={x:(r.x+o.x)/2,y:(r.y+o.y)/2};return t==="orthogonal"?Ox(e,n):n}function Vt(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function Bx(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))),b=Math.max(i,Math.min(a,Math.max(u,f*s)));return h&&(y=Math.min(a,y+m*.75),b=Math.min(a,b+f*.75)),{fromDistance:y,toDistance:b}}function gu(e,t,r,o,n){let i=Vt(r),a=Vt(o),{fromDistance:s,toDistance:l}=Bx(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 yu(e,t,r,o){let{p0:n,p1:i,p2:a,p3:s}=gu(e,t,r,o,{min:35,max:90,perpendicularScale:.5});return{points:[...n,...i,...a,...s],segments:[]}}function xu(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 Su(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 Cu(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 ku(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=bu(t.side),c=bu(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 bu(e){return e==="left"||e==="right"}function Ru(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 wu(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 vu(e,t,r){let o=e?["left","right"]:["top","bottom"];return[!o.includes(t),!o.includes(r)]}function Pu(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 S=d[1]+u,R=t[0]+m,k=c[1]+f;return[n.x,n.y,d[0],S,R,S,R,k,c[0],k,i.x,i.y]}let h=d[0]+u,y=t[1]+m,b=c[0]+f;return[n.x,n.y,h,d[1],h,y,b,y,b,c[1],i.x,i.y]}function Lu(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 _o(e,t){if(e.length<6)return e;let r=_x(e),o=[r[0]];for(let n=1;n<r.length-1;n++){let i=Ix(r[n-1],r[n],r[n+1],t);o.push(...i?Dx(i):[r[n]])}return o.push(r[r.length-1]),o.flatMap(n=>[n.x,n.y])}function Ix(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,Mu(n)*.4,Mu(i)*.4);if(d<=0)return null;let c=Tu(n),u=Tu(i),m=qi(t,c,-d),f=qi(t,u,d),h=qi(m,u,d),y=Math.atan2(m.y-h.y,m.x-h.x),b=Math.atan2(f.y-h.y,f.x-h.x);return{entry:m,exit:f,center:h,radius:d,startAngle:y,angleSweep:Gx(b-y)}}function qi(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function Mu(e){return Math.abs(e.x)+Math.abs(e.y)}function Tu(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function Gx(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function Dx(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 _x(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Ki(e){let t=Fx(e),r=ku(t),o=wu(t,r),n=Ru(o),i=vu(t.horizontalFirst,e.fromSide,e.toSide),a=Pu(t,r,e.segmentOffsets,i),s=Lu(a,n,i[0],i[1]);return{points:_o(a,10),segments:s}}function Fx(e){let[t,r]=xu(e.from,e.to,e.fromSide,e.toSide),o=Vt(e.fromSide),n=Vt(e.toSide),i=Su(t,r,e.endpointEdges),[a,s]=Cu(t,r,o,n,i);return{from:t,to:r,fromConnection:$u(t,e.fromSide,o,a),toConnection:$u(r,e.toSide,n,s),horizontalFirst:i}}function $u(e,t,r,o){return{side:t,normal:r,stub:[e.x+r[0]*o,e.y+r[1]*o]}}var Au=.5;function Eu(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:_o(n,10),segments:i}}function Zi(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 Nu(e,t,r,o,n){if(e.waypoints&&e.waypoints.length>0){let l=Eu(t,e.waypoints,r);if(Zi(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=Ki(a);return Zi(s.segments)?s:Ki({...a,segmentOffsets:void 0})}function Ou(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 Bu(e,t,r){let o=e.fromPoint?.kind==="side"?e.fromPoint.side:Ou(t,r),n=e.toPoint?.kind==="side"?e.toPoint.side:Ou(r,t);return{fromSide:o,toSide:n}}function Iu(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function Gu(e,t,r,o){let{fromSide:n,toSide:i}=Bu(e,t,r);return o==="curved"?yu(t,r,n,i):o==="orthogonal"?Nu(e,t,r,n,i):Iu(t,r)}function Hx(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 Vx(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??O,o),a=r?Ge(e.text??"",n,o,i):[];return{visible:r,fontSize:o,width:n,height:a.length*o*1.4,lines:a}}function Wx(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:Ao(n.style?.shadow)}}function Du(e,t,r){let{link:o,from:n,to:i}=e,a=o.style?.pathType??"orthogonal",{points:s,segments:l}=Gu(o,n,i,a),d=p(o.style?.strokeWidth,2),c=su(o.style?.color)||"#64748b",u=Vx(o,r),m=lu(d,o.style?.strokeStyle??"solid"),f=u.visible&&!m?ji(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:Xi(s,a,n,i),strokeWidth:d,bounds:Hx(s,d+14),color:c,order:2e4+t,style:Wx(e,d,c,h),label:u,hasLabelGap:!!f}}function Qi(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 _u(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 zx(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 Yx(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?_u(r,Math.max(16,o*4)):zx(e)}var Wt=e=>Math.round(e*100)/100;function Ux(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:Wt(r.start.x),ay:Wt(r.start.y),bx:Wt(r.end.x),by:Wt(r.end.y),ox:Wt(r.originalMidpoint.x),oy:Wt(r.originalMidpoint.y),movable:r.canMove}))}function Fu(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:Yx(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:Qi(t,"start"),markerEnd:Qi(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:Ux(e.pathType,e.segments)}}}function Hu(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 jx(e,t,r){if(e.link.isVisible===!1)return[];let o=Du(e,t,r);return[Fu(o),...au(o),...Hu(o),...iu(o)]}function Vu(e,t){return e.flatMap((r,o)=>re(jx(r,o,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function Xx(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 Wu(e){return e.flatMap((t,r)=>re(Xx(t,r),"path",t.id,"path","Path"))}function wr(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var qx=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],Fo=Math.PI/2,Kx=4*Fo,zu=Math.PI/2,Zx=1e-9;function Ji([e,t,r],o){return[e+r*Math.cos(o),t+r*Math.sin(o)]}function Yu([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function Uu(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 Qx(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?zu:Yu(r,Uu(e[o-1],r,t)),a=o===e.length-1?zu:Yu(r,Uu(r,e[o+1],t));for(;a<=n;)a+=Kx;return{lobe:r,from:n,to:a}})}function Jx(e,t){let r=[];for(let o=Math.floor(e/Fo)+1;o*Fo<t-Zx;o++)r.push(o*Fo);return[...r,t]}function eS({lobe:e,from:t,to:r}){let o=Ji(e,t),n=[],i=t;for(let a of Jx(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Ji(e,i),d=Ji(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 tS(){let e=Qx(qx).map(eS),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 ju=tS();function Xu(e,t,r,o){let n=([a,s])=>`${e+a*r} ${t+s*o}`,i=ju.curves.map(([a,s,l])=>`C ${n(a)} ${n(s)} ${n(l)}`);return`M ${n(ju.start)} ${i.join(" ")} Z`}function qu(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 Ku(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 Zu(e,t,r,o){let{body:n,centerX:i,bottom:a}=Ku(e,t,r,o);return{x:i-n,y:a-n,width:n*2,height:n}}function Qu(e,t,r,o){let{head:n,body:i,centerX:a,headCenterY:s,bottom:l}=Ku(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 rS=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,o)=>t+(o%2?` ${r}`:` L ${r}`),"")} Z`,oS=.1,nS=Math.PI/6,iS=.25,aS=.15;function Ju(e,t){return Math.min(e,t)/2}function em(e,t,r,o,n){let i=(...a)=>rS(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*oS,s=r+n-a,l=o/4,d=a*nS;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)*iS;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 Xu(t,r,o,n);case"cylinder":return qu(t,r,o,n);case"person":return Qu(t,r,o,n);case"predefined_process":{let a=Math.min(o,n)*aS;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 we(e){let t=em(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...wr(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function tm(e){return we(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function zt(e){let t=e.shape.shapeType==="pill"?Ju(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?p(e.shape.cornerRadius,8):0;return[{...wr(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function ea(e){return[{...wr(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function rm(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return zt(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[{...wr(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 sS={cloud:we,cylinder:we,diamond:we,document:we,hexagon:we,note:we,oval:ea,circle:ea,parallelogram:we,person:tm,pill:zt,predefined_process:we,rectangle:zt,rounded_rectangle:zt,symbol:rm,trapezoid:we,triangle:we};function vr(e){return(sS[e.shape.shapeType]??zt)(e)}function lS(e,t){if(e?.type==="path")return{type:"path",d:e.d};if(e?.type==="ellipse"){let{cx:r,cy:o,rx:n,ry:i}=e;return{type:"path",d:`M${r-n} ${o}A${n} ${i} 0 1 0 ${r+n} ${o}A${n} ${i} 0 1 0 ${r-n} ${o}Z`}}return{type:"rect",...t,rx:e?.type==="rect"?e.rx??0:0}}function dS(e,t,r,o){let n=o.width/t.width,i=o.height/t.height,a=e.fit==="contain"?Math.min(n,i):Math.max(n,i),[s,l]=e.fit==="fill"?[n,i]:[a,a];return{x:o.x+(o.width-t.width*s)/2-t.x*s,y:o.y+(o.height-t.height*l)/2-t.y*l,width:r[0]*s,height:r[1]*l}}var cS={cover:"slice",contain:"meet",fill:"none"};function om(e,t,r){let o=e.shape.image;if(!o)return;o.crop&&!o.pixels&&r.push({severity:"warning",code:"image-crop-without-size",ownerId:e.shape.id,message:`The image '${e.shape.id}' has a crop but no imageSize, so it is shown uncropped. Give it the size of the file, as imageSize: width, height.`});let n={x:e.x,y:e.y,width:e.width,height:e.height},i=o.crop&&o.pixels;return{type:"image",id:`${e.id}-image`,order:e.order,bounds:e.bounds,...i?dS(o,o.crop,o.pixels,n):n,href:o.src,aspect:i?"none":cS[o.fit],rotation:e.rotation,rotationCenter:e.rotationCenter,style:{opacity:e.style.opacity,blur:e.style.blur,blend:e.style.blend,clip:lS(t,n),pointerEvents:"none"}}}var uS=new Set(["reactivePanel","ledMatrix","lightBand","silkFolds","glowCard","glassDots"]);function mS(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&&uS.has(e.shape.shader.program))return"rect"}function nm(e){if(!e.shape.shader)return;let t=mS(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:A(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 pS={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},oe={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},im={rectangle:oe,rounded_rectangle:{...oe,cornerRadius:8},triangle:{...oe,rotation:0},diamond:{...oe,rotation:0},hexagon:{...oe,rotation:0},oval:{...oe,rotation:0},circle:{...oe,rotation:0},document:{...oe,rotation:0},parallelogram:{...oe,rotation:0},trapezoid:{...oe,rotation:0},cylinder:{...oe,rotation:0},note:{...oe,rotation:0},cloud:{...oe,rotation:0},predefined_process:{...oe,rotation:0},pill:oe,person:{...oe,rotation:0},symbol:{...oe,rotation:0}};function ta(e,t){let r=im[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${pS[e.shapeType]??""}, falling back to rectangle defaults.`}),im.rectangle)}function fS(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function am(e,t){let r=ta(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:v(e.fillColor,t,e.id),stroke:v(e.strokeColor,t,e.id),strokeWidth:o,dash:fS(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 ra=/\*\*([^*]+)\*\*/g;function sm(e){return/\*\*[^*]+\*\*/.test(e)}function hS(e){let t=[],r=0;ra.lastIndex=0;let o;for(;o=ra.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=ra.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function gS(e){return e.split(`
13
- `).map(hS)}function yS(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 bS(e,t,r,o){let n=yS(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 lm(e,t,r,o){return gS(e).flatMap(n=>bS(n,Math.max(1,t),r,o))}function dm(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,ta(o,[]).fontSize),f=o.isText?0:Math.max(8,t*2),h=o.shapeType==="person"?Zu(l,d,c,u):{x:l,y:d,width:c,height:u},y=Math.max(0,h.width-f*2),b=o.fontFamily||O,S=r?.(b,m),R={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:Ge(o.text,y,m,S),fontFamily:b,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(sm(o.text)){let{measure:k,spaceWidth:N}=S??du(m);R.richLines=lm(o.text,y,k,N)}return R}function xS(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=vr({...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(...vr({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...vr({...a,id:`${e.id}-inner`,style:n})),i}function SS(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:A({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:am(e,r),x:o,y:n,width:i,height:a}}}function CS(e,t,r,o){if(e.isVisible===!1)return[];let{context:n,strokeWidth:i}=SS(e,t,r),a=e.strokeStyle==="double"?xS(n,i||1):vr(n),s=nm(n);if(s){for(let c of a)(c.type==="ellipse"||c.type==="path"||c.type==="rect")&&(c.style={...c.style,pointerEvents:"all"});a.push(s)}let l=om(n,a[0],r);if(l){for(let c of a)(c.type==="ellipse"||c.type==="path"||c.type==="rect")&&(c.style={...c.style,pointerEvents:"all"});a.push(l)}if(e.isText)for(let c of a)(c.type==="ellipse"||c.type==="path"||c.type==="rect")&&(c.style={...c.style,pointerEvents:"all"});let d=dm(n,i,o);return d&&a.push(d),a}function cm(e,t,r){return e.flatMap((o,n)=>re(CS(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",Pr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],oa=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function z(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 Lr(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 Mr(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?xr(n,e):K}function ve(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var Pe={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function na(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function ia(e,t,r){let o=r?Pe.padX:0,n=r?Pe.padY:0,i=t*Pe.lineHeight;return{width:e.length*t*Pe.charWidth+o*2,height:i+n*2,lineHeight:i,padX:o,padY:n}}function aa(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 Ho(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 De(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 pt(e,t,r,o,n,i){return i?De(e,t,r,o,n):Ho(e,t,r,o,n)}function sa(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 la(e){if(!e?.length)return null;let t=[...e].sort((r,o)=>r-o);return{min:t[0],q1:sa(t,.25),median:sa(t,.5),q3:sa(t,.75),max:t[t.length-1]}}function Tr(e){return e?.startsWith("#")?Ie(e)??void 0:void 0}function da(e,t){let r=Tr(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 Wo(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 ca(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 um(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 kS(e,t){let r=Math.max(e,t),o=Math.min(e,t);return(r+.05)/(o+.05)}var Vo=.35,mm=.08,pm=.22,fm=.78,hm=.92,RS=3;function de(e){let t=Tr(e);if(!t)return"#0f172a";let[r,o,n]=t,i=(.299*r+.587*o+.114*n)/255>.6?"#0f172a":"#ffffff",[a,s,l]=Wo(r,o,n);if(s===0)return i;let d=l>.5?Math.max(mm,Math.min(l-Vo,pm)):Math.min(hm,Math.max(l+Vo,fm)),c=ca(a,s,d);return kS(um(r,o,n),um(...c))>=RS?Ue(...c):i}function Yt(e,t){let r=Tr(e);if(!r)return t;let[o,n,i]=r,[a,s,l]=Wo(o,n,i);if(s===0)return t;let d=l>.5?Math.max(mm,Math.min(l-Vo,pm)):Math.min(hm,Math.max(l+Vo,fm));return Ue(...ca(a,s,d))}function zo(e){let t=Tr(e);return t?Wo(...t)[2]>.5:!1}function Je(e,t){let r=Tr(e);if(!r)return;let[o,n]=Wo(...r);if(n!==0)return Ue(...ca(o,n,t))}function I(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function $r(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function Ar(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:wS(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 wS(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 Uo=18,Yo=e=>e.config;function ne(e){return e.chartType==="bar"&&Yo(e)?.orientation==="horizontal"}function Ut(e,t){let r=ve({series:e.series,config:Yo(e)}),o=t.height/r,n=Math.min(Math.max(0,p(Yo(e)?.barGroupGap,8)),Math.max(0,o-1)),i=e.categoryAlign==="left"?Uo:0,a=Math.max(1,o-n-i),s=p(Yo(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 jt(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 jo=e=>e*Math.PI/180;function ua(e){return Math.max(9,p(e.axisFontSize??e.fontSize,12))}function Er(e,t,r){let o=ua(e),n=Math.max(0,...t.map(i=>ge(i,o,!1)));return Math.ceil(n*Math.sin(jo(r))+(o+2)*Math.cos(jo(r)))}function ma(e,t,r,o){let n=ua(e),i=n+2,a=Math.ceil(ge(t,n,!1))+4,s=jo(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 Xt(e,t,r,o){let n=ua(e),i=n+2,a=Math.ceil(ge(t,n,!1))+4,s=jo(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 qt(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 Xo(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 Nr(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 Zt(e,t){return Math.abs(t-e)>Math.PI?1:0}function ft(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function gm(e,t){return{start:e.start+t,end:e.end-t}}function ht(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 vS(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 ${Zt(t.start,t.end)} 1 ${n.x} ${n.y}`,"Z"].join(" ")}function PS(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 ${Zt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${Zt(o.start,o.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var ym=.82;function Kt(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 Or(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*ym),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 Br(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*ym),i=e*n/(1+n),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function LS(e,t,r,o){let{outerRadius:n}=e,i=n-r,a=Kt(e,n,i,t.start,r,1),s=Kt(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 ${Zt(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 MS(e,t,r,o,n){let{outerRadius:i}=e,a=i-n,s=Kt(e,i,a,r.start,n,1),l=Kt(e,i,a,r.end,n,-1),d=t+n,c=Kt(e,t,d,o.start,n,1),u=Kt(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 ${Zt(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 ${Zt(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 Qt(e,t,r){let o=Math.max(0,r)/2,n=ht(o,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=n}function gt(e,t,r=0,o=0){let n=Math.max(0,o)/2,i=gm(t,ft(n,e.outerRadius));if(!Qt(e,t,o)){let s=ht(n,t.end-t.start,e.outerRadius),l=Q(e,(t.start+t.end)/2,s);return r>0?LS(e,i,r,l):vS(e,i,l)}let a=gm(t,ft(n,e.innerRadius));return r>0?MS(e,e.innerRadius,i,a,r):PS(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?De(e.x+y,e.y,h,e.height,n):De(e.x,e.y+e.height-y-h,e.width,h,n))}return m.join(" ")}function D(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 Ir(e,t,r,o,n){let i=e.series[o].values[r]??0;return t==="waterfall"?TS(e,r,o,n,i):t==="percent"?$S(e,r,o,n,i):AS(e,r,o,n,i)}function TS(e,t,r,o,n){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return bm(n,i,i+n,e,o)}function $S(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 AS(e,t,r,o,n){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return bm(n,i,i+n,e,o)}function bm(e,t,r,o,n){return{value:e,pixelStart:T(t,o.axisY,n),pixelEnd:T(r,o.axisY,n)}}function P(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??O,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 ES=/^[A-Za-z_][A-Za-z0-9_]*$/;function Jt(e,t,r){return ES.test(t)?`${e}[${t}].${r}`:void 0}var xm="text";function pa(e){return`Axis[${e}].label`}function Gr(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function Ee(e){return Jt("Series",e,"label")}function Sm(e){return Jt("Series",e,"color")}function ce(e,t){return Number.isInteger(t)&&t>=0?Jt("Series",e,`values[${t}]`):void 0}function er(e,t){return Number.isInteger(t)&&t>=0?Jt("Series",e,`colors[${t}]`):void 0}function Cm(e){return Jt("Rule",e,"text")}function km(e){return Jt("Rule",e,"at")}function NS(e,t,r){return e.axisX.label?{...P({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:pa("x")}:null}function OS(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...P({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:pa("y")}}function Rm(e,t,r){let o=[],n=NS(e,t,r);n&&o.push(n);let i=OS(e,t,r+o.length);return i&&o.push(i),o}function wm(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{...P({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 BS=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function vm(e){return IS(e.chart)?HS(e).flatMap(t=>VS(e,t)):[]}function IS(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!BS.has(e.chartType)&&!t}function fa(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var ha=22,qo=16;function ga(e){return e==="bottomLeft"||e==="bottomRight"}function ya(e){return fa(e).map(t=>Math.max(42,t.label.length*p(e.fontSize,12)*.58+22))}function Pm(e){let t=ya(e);return t.length?Math.max(...t):0}function GS(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function DS(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function _S(e){let{chart:t,plot:r,order:o}=e,n=fa(t),i=ya(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-qo-a:r.x+r.width+qo,l=r.y+r.height-15;return n.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(n.length-1-c)*ha,width:i[c],order:o+(n.length-1-c)*2}))}function FS(e){let{chart:t,plot:r,order:o}=e,n=fa(t),i=ya(t),a=i.reduce((d,c)=>d+c,0),s=DS(t,r),l=GS(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 HS(e){return ga(e.chart.legendPosition)?_S(e):FS(e)}function VS(e,t){return[WS(e,t),zS(e,t)]}function WS(e,t){let{chart:r,bounds:o,diagnostics:n}=e,i=E[t.seriesIndex%E.length],a=r.chartType==="line",s=a?I(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:Sm(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:v(s,n,r.id)}}}function zS(e,t){let{chart:r,bounds:o}=e;return{...P({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 Lm=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),YS=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Xe(e){return!YS.has(e.chartType)}function Mm(e){return Xe(e)?Math.max(0,p(e.tickLength,0)):0}function et(e){return Mm(e)+(Xe(e)?Math.max(0,p(e.xLabelGap,0)):0)}function xa(e){return Mm(e)+(Xe(e)?Math.max(0,p(e.yLabelGap,0)):0)}function ba(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function US(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 jS(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function XS(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 qS(e){return e.axisLabelSpace&&e.axisLabelSpace>0&&(ba(e)||ne(e))?e.axisLabelSpace:ba(e)?US(e):ne(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:XS(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function KS(e){let t=_e(e);if(t<=0)return 0;let r=e.chartType==="bar"&&!ne(e)?e.config?.categories??[]:e.chartType==="boxplot"&&!ba(e)?e.series.map(o=>o.label||o.id):[];return r.length>0?Math.max(0,Er(e,r,t)-18):0}function ZS(e){let t=e.showLegend!==!1,r=e.legendPosition??"top",o=t&&e.series.length>0,n=o&&ga(r);return{showLegend:t,position:r,atTop:r==="top",hasItems:o,stacked:n,sideColumnWidth:n?Pm(e)+qo:0,treemapSide:jS(e,t)}}function QS(e,t,r){return xa(e)+(t?qS(e):12)+(r.position==="bottomLeft"?r.sideColumnWidth:0)+(r.treemapSide==="left"?Tm:0)}function JS(e){return 24+(e.position==="bottomRight"?e.sideColumnWidth:0)+(e.treemapSide==="right"?Tm:0)}function eC(e,t,r){let o=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",n=ne(e)&&e.showValueAxis!==!1,i=t?ne(e)?n?34:12:(e.axisX.label?52:34)+(o?18:0):12,a=e.chartType==="field"&&r.showLegend&&!!e.config?.scale?.stops.length,s=r.hasItems&&!r.atTop&&!r.stacked;return et(e)+i+(t?KS(e):0)+(a?44:0)+(s?16+ha:0)}function tC(e,t){return(e.title?Math.max(44,20+p(e.titleSize,14)*1.6):0)||(t.atTop&&t.hasItems?44:24)}function $m(e){let t=e.showAxisLabels!==!1,r=ZS(e),o=QS(e,t,r),n=JS(r),i=eC(e,t,r),a=tC(e,r);return{bounds:le({x:e.x,y:e.y,width:e.width,height:e.height},p(e.strokeWidth,1)+2),plot:{x:e.x+o,y:e.y+a,width:Math.max(1,e.width-o-n),height:Math.max(1,e.height-a-i)},showLabels:t,showLegend:r.showLegend,padLeft:o}}function rC(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=ve(e),n=t.plot.width/o,i=rC(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}=Xt(e,f,s,{x:m,y:t.plot.y+t.plot.height+4+et(e)});return{...P({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?Gr(u):void 0}}return{...P({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?Gr(u):void 0}})}function Em(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}=Xt(e,d,i,{x:l,y:t.plot.y+t.plot.height+4+et(e)});return{...P({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{...P({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 Nm(e,t,r){return z(e.axisX).map((o,n)=>{let i=t.plot.x+T(o,e.axisX,t.plot.width);return P({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 Om(e,t,r){return z(e.axisY).map((o,n)=>{let i=t.plot.y+t.plot.height-T(o,e.axisY,t.plot.height);return P({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-xa(e),height:18},text:String(o),chart:e,align:"right"})})}function Sa(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function oC(e,t,r){return e.chartType==="bar"?Am(e,t,r):e.chartType==="boxplot"&&!Sa(e)?Em(e,t,r):Nm(e,t,r)}function nC(e,t,r){return Sa(e)?wm(e,t,r):e.showValueAxis===!1?[]:Om(e,t,r)}function iC(e,t){let{plot:r}=t;if(e.chartType==="bar"){let o=ve(e);return Array.from({length:o},(n,i)=>r.x+(i+.5)*r.width/o)}return z(e.axisX).map(o=>r.x+T(o,e.axisX,r.width))}function aC(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function sC(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",...aC(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&&ne(e)){z(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=Ut(e,i);for(let m=0;m<u.count;m++){let f=jt(u,i,m)+u.labelRow+u.barsHeight/2;c(`tick-c-${m}`,`M ${i.x-n} ${f} L ${i.x} ${f}`)}}return n>0&&!Sa(e)&&!ne(e)&&(z(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}`)}),iC(e,t).forEach((u,m)=>{c(`tick-x-${m}`,`M ${u} ${s} L ${u} ${s+n}`)})),d}function lC(e,t){let r=e.config?.categories;return Array.from({length:t},(o,n)=>r?.[n]??String(n+1))}function dC(e,t,r){let{plot:o,bounds:n}=t,i=Ut(e,o),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=lC(e,i.count).map((c,u)=>{let m=jt(i,o,u);return{...P({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?Gr(u):void 0}});return e.showValueAxis!==!1&&z(e.axisY).forEach((c,u)=>{let m=o.x+T(c,e.axisY,o.width);d.push(P({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 Bm(e,t,r){if(!Xe(e))return[];let o=sC(e,t,r);if(!t.showLabels)return o;if(r+=o.length,ne(e))return[...o,...dC(e,t,r)];let n=oC(e,t,r),i=nC(e,t,r+n.length),a=Rm(e,t,r+n.length+i.length);return[...o,...n,...i,...a]}function Im(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 Dr(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function Gm(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?Im(e,u,d,o):0}}return{grid:s,cols:i,rows:a}}var Dm=new Set(["scatter","custom","hexbin"]);var _m=-Math.PI/2,cC=.5,uC=6;function mC(e){return Math.max(38,e*3.2)}function Ko(e,t,r,o=!0){let n=o?mC(r):uC;return Math.max(8,Math.min(e,t)/2-n)}function Zo(e,t){return Math.max(3,e||t)}function pC(e,t){return _m+t*Math.PI*2/e}function ka(e,t,r){let o=t===e?0:(r-e)/(t-e);return _m+o*Math.PI*2}function Fm(e,t,r){let o=pC(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 Qo(e,t,r=cC){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 _r(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function Vm(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 fC(e,r,o,n,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,..._r(e,s)},d=[];return z(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*Wm(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})}),z(e.axisX).forEach(c=>{let u=ka(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 fC(e,t,r,o,n,i,a){let s=z(e.axisY).filter(c=>c>e.axisY.min),l=z(e.axisX),d=[];return s.forEach(c=>{let u=i*Wm(e,c);l.forEach(m=>{let f=ka(e.axisX.min,e.axisX.max,m),h=o+Math.cos(f)*u,y=n+Math.sin(f)*u,b=`chart-grid-dot-${e.id}-${m}-${c}`;d.push(Jo(e,b,r+d.length,t,h,y,a,void 0))})}),d}function Wm(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 en(e,t,r,o){if(e.showGrid===!1||!Xe(e))return[];if(e.gridShape==="circle"&&Dm.has(e.chartType))return Vm(e,t,r,o);let n=p(e.gridWidth,1);if(ne(e))return hC(e,t,r,o,n);let i=e.chartType==="field"?Dr(e,t):void 0;if(e.gridLineStyle==="dotted")return gC(e,t,r,o,n,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:n,..._r(e,n),clip:i},s=[];return(e.gridAxes==="y"?[]:z(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"?[]:z(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 hC(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"}:_r(e,n)};return z(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 gC(e,t,r,o,n,i){let a=z(e.axisX),s=z(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 zm(e){return e.chart.rules?.length?yC(e).flatMap(t=>bC(e,t)):[]}function yC(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 bC(e,t){let r=[xC(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(SC(e,t)),r}function xC(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:km(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 SC(e,t){let r=Math.max(9,p(e.chart.fontSize,12)-2);return{...P({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:Cm(t.rule.id)}}function Ra(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 Ym(e,t,r){if(!e.fillImage)return[];let o=Ra(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 tr(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=Ra(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(...en(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 rr(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:v(o,s,a.id),shadow:{color:I(o,"#ffffff"),opacity:.9,blur:n,dx:0,dy:0},pointerEvents:"none"}}}function or(e){return e.chart.config?.showBarLabels===!0}function CC(e,t){let r=e.frame.height>=t.height+Pe.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function kC(e,t,r){return e==="outside"?t.y-r-Pe.gap:e==="inside"?t.y+Pe.gap:t.y+t.height/2-r/2}function RC(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:aa(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?v(l.barLabelPillColor,a,n.id):{kind:"none"},stroke:v(l?.barLabelBorderColor??o,a,n.id),strokeWidth:p(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function wC(e,t,r,o,n,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...P({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 vC(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{...P({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-Uo,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 PC(e,t){let r=e.placement==="axis"?"outside":e.placement,o=e.frame.width>=t.width+Pe.gap*2;return r!=="outside"&&!o?"outside":r}function LC(e,t,r){let{frame:o}=e,n=r==="outside"?o.x+o.width+Pe.gap:r==="inside"?o.x+o.width-t.width-Pe.gap:o.x+o.width/2-t.width/2;return{...t,left:n,top:o.y+o.height/2-t.height/2}}function nr(e,t){let{chart:r}=e,o=r.config,n=Math.max(8,p(o?.barLabelFontSize,p(r.fontSize,12))),i=na(t.value,o?.barLabelFormat);if(t.placement==="axis")return[vC(e,t,i,n)];let a=o?.barLabelPill===!0,s=ia(i,n,a),l=t.horizontal?PC(t,s):CC(t,s),d=t.horizontal?LC(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:kC(l,t.frame,s.height)},c=o?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(RC(e,t.id,d,c)),u.push(wC(e,t.id,d,i,l,n,c)),u}var wa={angle:45,spacing:7,width:1.5},MC=2;function TC(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 ir(e,t){if(yt(e))return{type:"path",d:De(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function yt(e){return e.chart.config?.barTrack===!0}function ar(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):De(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:v(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:TC(r.x,r.y,r.width,r.height,p(l.barTrackHatchAngle,wa.angle),Math.max(MC,p(l.barTrackHatchSpacing,wa.spacing))),style:{fill:{kind:"none"},stroke:v(l.barTrackHatchColor??n.gridColor??"#cbd5e1",a,n.id),strokeWidth:p(l.barTrackHatchWidth,wa.width),pointerEvents:"none",clip:{type:"path",d:u}}}),m}function Um(e){let t=NC(e),r=e.chart.series.flatMap((a,s)=>OC(e,t,a,s)),o=yt(e)?r.flatMap(a=>ar(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=>BC(e,a)),i=or(e)?r.flatMap(a=>AC(e,a,r)):[];return[...o,...n,...r.flatMap(a=>EC(e,a)),...i]}function $C(e,t){let r=t.filter(o=>o.seriesId===e.seriesId).map(o=>o.value);return e.value>=Math.max(...r)}function AC(e,t,r){let{chart:o}=e;return o.config?.barLabelMaxOnly&&!$C(t,r)?[]:nr(e,{id:`chart-bar-label-${o.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:o.config?.barLabelPosition??"outside"})}function jm(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):pt(t.x,t.y,t.width,t.height,i,n?.barRoundedBottom===!0)}function EC(e,t){let{chart:r}=e,o=p(r.config?.barGlow,0);if(o<=0||t.frame.height<=0)return[];let n=jm(e,t.frame);return[rr(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,n,t.color,o)]}function NC(e){let{chart:t,plot:r}=e,o=ve(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 OC(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 BC(e,t){let r=GC(e,t),o=DC(e,t);return o&&r.push(o),r}function IC(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 GC(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=jm(e,t.frame),u=v(t.color,i,r.id),m=v(r.config?.barBorderColor||"#000000",i,r.id),f=p(r.config?.barBorderWidth,0),h=D(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:ir(e,{x:l,y:o.y,width:d,height:o.height})??{type:"path",d:IC(o)}}}:void 0,b={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:er(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:ce(t.seriesId,t.valueIndex),style:{fill:u,stroke:m,strokeWidth:f,innerShadow:h}},S=tr(e,`${t.seriesId}-${t.valueIndex}`,c);return y?[y,...S,b]:[...S,b]}function DC(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=$r(t.value,t.error);return Ar({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 _C(e,t,r,o,n){let{chart:i,plot:a}=e,s=jt(t,a,o)+t.labelRow;if(e.stackedMode){let u=Ir(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 FC(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):De(t.x,t.y,t.width,t.height,n?.barCornerRadius??2)}function HC(e,t,r,o,n,i){let{plot:a}=e,s=_C(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:FC(e,s),color:r.colors?.[n]??r.color??E[o%E.length]}}function VC(e,t){let{chart:r,diagnostics:o,nextOrder:n}=e,i=r.config,a=v(i?.barBorderColor||"#000000",o,r.id),s=p(i?.barBorderWidth,0),l=D(r.shadowStyle),d=v(t.color,o,r.id),c=[...tr(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:ir(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:er(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function WC(e,t,r){let{chart:o}=e,n=o.config,i=or(e)&&(!n?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===o.series.length-1;return!i||e.stackedMode&&!a&&n?.barLabelPosition==="outside"?[]:nr(e,{id:`chart-bar-label-${o.id}-${t.id}`,value:t.value,frame:t.frame,placement:n?.barLabelPosition??"outside",horizontal:!0})}function zC(e,t,r,o,n,i,a,s){let{chart:l}=e,d=HC(e,t,o,n,i,a);yt(e)&&(!e.stackedMode||n===0)&&r.tracks.push(...ar(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...VC(e,d));let c=p(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(rr(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...WC(e,d,s))}function Xm(e){let t=Ut(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)=>{zC(e,t,r,o,n,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function YC(e,t){let{chart:r,plot:o}=e,n=o.width/ve(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 UC(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):pt(t,r,n.barWidth,o,i,a.config?.barRoundedBottom===!0)}function jC(e,t,r,o,n,i,a){let{chart:s}=e,l=s.config;if(!(or(e)&&!(l?.barLabelMaxOnly&&!ZC(r.values,n))&&(l?.barLabelPosition!=="axis"||o===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[n];t.labels.push(...nr(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 XC(e,t,r,o,n,i){let{chart:a,plot:s}=e,l=Ir(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:UC(e,c,u,m,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function qC(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=v(t.color,i,r.id),u=v(r.config?.barBorderColor||"#000000",i,r.id),m=p(r.config?.barBorderWidth,0),f=D(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:ir(e,t.column)??{type:"path",d:y}}})}return h.push(...tr(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:er(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:ce(s.id,l),style:{fill:c,stroke:u,strokeWidth:m,innerShadow:f}}),h}function KC(e,t,r,o,n,i,a){let{chart:s}=e,l=XC(e,t,o,n,i,a);i===0&&yt(e)&&r.tracks.push(...ar(e,String(a),l.column)),r.bars.push(...qC(e,l));let d={x:l.x,y:l.y,width:o.barWidth,height:l.height};jC(e,r,n,i,a,o,d);let c=p(s.config?.barGlow,0);c>0&&r.glows.push(rr(e,`chart-bar-glow-${s.id}-${n.id}-${a}`,l.path,l.color,c))}function qm(e,t){let{chart:r}=e,o={tracks:[],bars:[],glows:[],labels:[]},n=YC(e,t),i=ve(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{KC(e,t,o,n,s,l,a)});return[...o.tracks,...o.bars,...o.glows,...o.labels]}function ZC(e,t){let r=e.map(o=>typeof o=="number"?o:o[1]);return r[t]>=Math.max(...r)}function Km(e){return ne(e.chart)?Xm(e):e.stackedMode?qm(e,e.stackedMode):Um(e)}function Zm(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=I(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 ye(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function Qm(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 Jm(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+QC(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:m,y:f}=ye(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:v(r.color,a,o.id),opacity:t.pointOpacity}}})}function QC(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function tp(e,t,r){let o=t.whiskerWidth>0?[ek(t,r),tk(t,r)]:[],n=t.whiskerWidth>0&&t.capSize>0?[rk(t,r),ok(t,r)]:[],i=t.medianWidth>0?[nk(t,r)]:[];return[...[...o,...n].map(a=>ep(e,t,{...a,color:JC(t,r)})),ik(e,t,r),...i.map(a=>ep(e,t,a))]}function JC(e,t){return e.whiskerColor==="series"?I(t.color,e.borderColor):e.whiskerColor}function ek(e,t){let{center:r,min:o,q1:n}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ye(e.orientation,r,o),to:ye(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function tk(e,t){let{center:r,q3:o,max:n}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ye(e.orientation,r,o),to:ye(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function rk(e,t){return rp(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function ok(e,t){return rp(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function rp(e,t,r,o){let n=t.boxWidth*t.capSize/2;return{id:e,from:ye(t.orientation,r-n,o),to:ye(t.orientation,r+n,o),strokeWidth:t.whiskerWidth}}function nk(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ye(e.orientation,t.geometry.center-r,t.geometry.median),to:ye(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function ep(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 ik(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ye(t.orientation,s.center-l,s.q1),c=ye(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:v(r.color,i,o.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function op(e,t,r,o){let n=la(r.values);if(!n)return[];let i=Qm(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=tp(e,t,s);return t.showPoints&&l.push(...Jm(e,t,s)),l}function np(e){let t=Zm(e),r=[];return e.chart.series.forEach((o,n)=>{r.push(...op(e,t,o,n))}),r}var ak="#94a3b8",ip=8,va=140;function sp(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?ck(e):e.chart.series.flatMap((t,r)=>sk(e,t,r))}function sk(e,t,r){let o=lk(e,t,r);return Pa(e,t).map((n,i)=>{let a=La(e,n),s={series:t,valueIndex:i,point:a,style:o};return t.symbol?.points.length?dk(e,s):Ma(e,s)})}function Ta(e){return e.config?.orientation==="horizontal"}function Pa(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(n=>[n[0],n[1]]):Ta(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 ap(e,t){return Ta(e)?t[0]:t[1]}function La(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 lk(e,t,r){let o=t.color??E[r%E.length];return{fill:v(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 dk(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:lp(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 Ma(e,t){let r=p(t.series.size,3);return{type:"ellipse",id:lp(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 lp(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function ck(e){let{chart:t}=e,[r,o]=t.series,n=Pa(e,r),i=Pa(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],b=i[h],S=La(e,y),R=La(e,b),k=ap(t,y),N=ap(t,b),F=c?N<k:N>k,G=c?N>k:N<k,X=F?s:G?l:d,se=p(o.size,3);f.push(mk(e,h,S,R,X)),f.push(Ma(e,{series:r,valueIndex:h,point:S,style:{fill:v(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??ak},strokeWidth:p(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(Ma(e,{series:o,valueIndex:h,point:R,style:{fill:v(X,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&m[h]&&f.push(pk(e,h,S,R,se,m[h]))}return f}function uk(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function mk(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:uk(i.config?.customConnectorDash)}}}function pk(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,d=Ta(a),c=d?{x:Math.max(r.x,o.x)+n+ip,y:Math.min(r.y,o.y)-8,width:va,height:16}:{x:Math.min(r.x,o.x)-va/2,y:Math.min(r.y,o.y)-n-ip-14,width:va,height:16};return{...P({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 cp(e){let{chart:t,plot:r}=e,o=t.series.filter(a=>dp(a.values[0])===3),n=t.series.filter(a=>dp(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 dp(e){return Array.isArray(e)?e.length:void 0}function up(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=fk(e);return[hk(e,r,o,n,i),...gk(e,o,n,i)]}function fk(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 hk(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 gk(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=o.y+o.height+3;return[P({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}),P({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 yk="#94a3b8";function tn(e,t){return e?.stops.length?xr(e.stops,t):yk}function mp(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 pp(e,t){let r=[];for(let o=0;o<e.rows-1;o++)for(let n=0;n<e.columns-1;n++){let i=bk(e,o,n),a=xk(i,t);a!==0&&a!==15&&r.push(...Sk(i,a,t))}return r}function bk(e,t,r){return{topLeft:rn(e,t,r),topRight:rn(e,t,r+1),bottomRight:rn(e,t+1,r+1),bottomLeft:rn(e,t+1,r)}}function rn(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 xk(e,t){return(on(e.topLeft,t)?8:0)|(on(e.topRight,t)?4:0)|(on(e.bottomRight,t)?2:0)|(on(e.bottomLeft,t)?1:0)}function on(e,t){return e.value>=t}function Sk(e,t,r){let o=Ck(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 Ck(e,t){return{top:nn(e.topLeft,e.topRight,t),right:nn(e.topRight,e.bottomRight,t),bottom:nn(e.bottomLeft,e.bottomRight,t),left:nn(e.topLeft,e.bottomLeft,t)}}function nn(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 kk=.5;function fp(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=Rk(e,t);return[...wk(e,r),...Pk(e,r)]}function Rk(e,t){let{plot:r,chart:o}=e,n=Gm(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 wk(e,t){let r=[];for(let o=0;o<t.rows;o++)for(let n=0;n<t.columns;n++)r.push(vk(e,t,o,n));return r}function vk(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=tn(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:Dr(n,i)}}}function Pk(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((o,n)=>{let i=Lk(e,t,o,n);i&&r.push(i)}),r}function Lk(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=pp({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=mp(l).map(u=>qt(u.map(([m,f])=>({x:i.x+m,y:i.y+f})),kk)).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:Dr(n,i)}}}function hp(e,t){let r=[];return t.forEach((o,n)=>{let i=o.color??E[n%E.length];o.values.forEach((a,s)=>{r.push(Mk(e,o.id,a,s,i))})}),r}function Mk(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),b=a.x+T(c+Math.cos(m)*f,i.axisX,a.width),S=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 ${b} ${S}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:v(n,l,i.id),strokeWidth:2}}}function gp(e){let t=cp(e),r=[];return r.push(...fp(e,t.scalarSamples)),r.push(...hp(e,t.vectorSeries)),r.push(...up(e)),r}function yp(e,t){let r=[];return t.rows.forEach((o,n)=>{r.push(...Tk(e,t,o,n))}),r}function Tk(e,t,r,o){return t.columns.flatMap((n,i)=>{let a=$k(t,r,o,i);return Ek(e,t,a)})}function $k(e,t,r,o){let n=t.values[o]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:o,value:n,color:Ak(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 Ak(e,t){return Mr(e,t.bands,t.zones)}function Ek(e,t,r){let o=Nk(e,t,r);return e.chart.config?.showValues===!1?[o]:[o,Ok(e,t,r)]}function Nk(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 Ok(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=Math.max(6,p(o.config?.cellValueSize,t.fontSize));return{...P({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??de(r.color)}}function bp(e){let{chart:t}=e,r=Sp(e),o=Bk(e),n=Dk(e,o);return{rows:t.series,columns:r,bands:Lr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Pr,fontSize:Math.max(9,p(t.fontSize,12)),headerFontSize:$a(t),legendGap:xp(t),sides:o,reservedSpace:n,grid:Fk(e,n,o,r.length)}}var $a=e=>Math.max(9,p(e.axisFontSize??e.fontSize,12)),Aa=e=>Math.min(120,Math.max(0,p(e.yLabelGap,6))),an=e=>Math.min(120,Math.max(0,p(e.xLabelGap,4))),xp=e=>Math.min(80,Math.max(0,p(e.legendGap,6)));function Bk(e){let{chart:t}=e;return{rows:t.rowLabelSide==="right"?"right":"left",columns:t.columnLabelSide==="bottom"?"bottom":"top",legend:t.legendSide??"bottom"}}function Sp(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}var Ik=32,Gk=56;function Dk(e,t){let{chart:r}=e,o=$a(r),n=r.series.reduce((a,s)=>Math.max(a,ge(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+Aa(r)):0,columnHeaders:e.showLabels?_k(e):0,legend:e.showLegend?(i?Gk:Ik)+xp(r):0}}function _k(e){let{chart:t}=e,r=_e(t);return r>0?Math.min(e.plot.height*.4,Er(t,Sp(e),r)+an(t)+4):$a(t)+2+an(t)+6}function Fk(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,b=c;if(n.config?.squareCells&&o&&u){let S=Math.min(f,h);f=S,h=S,y=S*o,b=S*u}return{x:e.plot.x+i,y:e.plot.y+s,width:y,height:b,cellWidth:f,cellHeight:h,cellGap:m,cellRadius:Math.max(0,p(n.config?.barCornerRadius,m))}}function Cp(e,t){return[...Hk(e,t),...Wk(e,t)]}function Hk(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,o)=>Vk(e,t,r,o))}function Vk(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.reservedSpace.rowHeaders,l=Aa(n),d=t.sides.rows==="left"?t.grid.x-s:t.grid.x+t.grid.width+l;return P({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 Wk(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,o)=>zk(e,t,r,o))}function zk(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=an(n),u=`chart-heatmap-col-${n.id}-${o}`;if(d>0){let{frame:m,rotation:f}=s?ma(n,r,d,{x:l,y:t.grid.y-c}):Xt(n,r,d,{x:l,y:t.grid.y+t.grid.height+c});return P({id:u,order:a(),bounds:i,frame:m,text:r,chart:n,align:s?"left":"right",rotation:f,role:"axis"})}return P({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 sr=10,tt=4,sn=2,Fr=48;function Yk(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-sr,width:t.width,height:sr,vertical:!1,numbers:"top"}}case"left":return{x:t.x-(r.rows==="left"?i:0)-n-sr,y:t.y,width:sr,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:sr,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:sr,vertical:!1,numbers:"bottom"}}}}function kp(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=Yk(t),o=le({x:r.x,y:r.y,width:r.width,height:r.height});return[Uk(e,t,r,o),...jk(e,t,r)]}function Rp(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function Uk(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:Rp(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 jk(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=Rp(t,l),u=r.vertical?r.y+r.height-c*r.height:r.x+c*r.width,m=Xk(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=P({id:`chart-heatmap-legend-tick-label-${o.id}-${d}`,order:i(),bounds:n,...qk(r,u,d===0,d===s,a),text:Ae(l),chart:o});return[f,h]})}function Xk(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 qk(e,t,r,o,n){if(e.vertical){let s=e.numbers==="right";return{frame:{x:s?e.x+e.width+tt+sn:e.x-tt-sn-Fr,y:t-n/2,width:Fr,height:n},align:s?"left":"right"}}let i=e.numbers==="bottom"?e.y+e.height+tt+sn:e.y-tt-sn-n;return{frame:{x:r?t:o?t-Fr:t-Fr/2,y:i,width:Fr,height:n},align:r?"left":o?"right":"center"}}function wp(e){let t=bp(e),r=[];return r.push(...yp(e,t)),r.push(...Cp(e,t)),r.push(...kp(e,t)),r}function Ea(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 vp(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 Pp(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 Lp(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 Zk(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 Qk(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 Hr(e,t,r,o=18){return t<=1?0:e*(r-o)/(t-1)}function Mp(e,t,r,o=8){let n=Pp(e.ids,t),i=Zk(e),a=Qk(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 Tp(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:Hr(t.columns.get(s.source)??0,t.columnCount,r,n)+n+(d?.x??0),x1:Hr(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 $p(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:Hr(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 Jk(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 Oa(e,t,r,o,n={nodeWidth:18,nodeGap:8}){let i=Lp(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=vp(i),s=Mp(i,a,o,n.nodeGap),l=Jk(e);return{nodes:$p(e,i,s,r,l,n.nodeWidth),links:Tp(i,s,r,l,n.nodeWidth)}}function Vr(e,t){let r=eR(e,t);if(!r.length)return[];let o=[],n=r,i=t;for(;n.length;){let a=tR(n,Math.min(i.width,i.height)),s=rR(a,i);o.push(...s.rectangles),n=n.slice(a.items.length),i=s.remainingBounds}return o}function eR(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 tR(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 rR(e,t){return t.width>=t.height?oR(e,t):nR(e,t)}function oR(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 nR(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 iR=.15,aR=1/Math.sqrt(3);function sR(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 Ep(e){let{chart:t,plot:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??oa),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*aR),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??iR)),m=D(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 R=(h.values.length>0&&Array.isArray(h.values[0])?h.values:h.values.map((X,se)=>[t.axisX.min+se*t.axisX.step,X])).map(([X,se])=>({x:T(X,t.axisX,r.width),y:r.height-T(se,t.axisY,r.height)})),k=Ea(R,l),N=Math.max(1,...k.map(X=>X.count)),F=h.color??E[y%E.length],G=s?.scale;k.forEach((X,se)=>{let xe=X.count/N,at=G?tn(G,xe):F;a.push({type:"path",id:`chart-hexbin-${t.id}-${h.id}-${se}`,order:i(),bounds:o,d:sR(r.x+X.cx,r.y+X.cy,d),style:{fill:v(at,n,t.id),stroke:c>0?v(s?.hexStrokeColor??at,n,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:G?void 0:Math.max(u,xe),shadow:m,clip:f?{type:"path",d:f}:void 0}})})}),a}function bt(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 xt(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 Np(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=`${qt(r,n)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(S=>S.y)),h=(Math.min(...r.map(S=>S.x))+Math.max(...r.map(S=>S.x)))/2,y=(d-f)/2,b={minX:h-y,maxX:h+y,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:b,d:m,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:da(o,i)},{offset:100,color:da(o,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function lR(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function dR(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:v(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function cR(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:v(t.color,n,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function uR(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=o.config,s=Math.max(9,o.fontSize??12),l=lR(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...P({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 Op(e,t,r){let{chart:o}=e,n=o.config,i=n?.highlightPoints;if(!i?.length)return[];let a=bt(o,t),s=xt(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(dR(e,m)),l.push(cR(e,m)),n?.highlightLabels&&l.push(uR(e,m,a[c][1]))}return l}function Bp(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 Ip(e,t){return t.flatMap(r=>mR(e,r))}function mR(e,t){let r=[],o=pR(e,t);return o&&r.push(o),r.push(fR(e,t)),r}function pR(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=$r(t.value,t.error);return Ar({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 fR(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?v(c,n,r.id):{kind:"none"},stroke:d&&l>0?v(t.color,n,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function Gp(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:qt(r,n),style:{fill:{kind:"none"},stroke:v(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}:D(i.shadowStyle)}}}function Dp(e,t){return I(e.color,E[t%E.length])}function _p(e,t,r){let o=e.chart.config?.areaOpacity;if(o===void 0||o<=0)return[];let n=Dp(t,r),i=e.chart.config?.lineTension??0,a=xt(e,bt(e.chart,t));return a.length>1?[Np(e,t,a,n,i,o)]:[]}function Fp(e,t,r){let o=Dp(t,r),n=e.chart.config?.lineTension??0,i=bt(e.chart,t),a=xt(e,i),s=[];a.length&&s.push(Gp(e,t,a,o,n));let l=Bp(t,i,a,o);return s.push(...Ip(e,l)),s.push(...Op(e,t,o)),s}function Hp(e){let t=[];return e.chart.series.forEach((r,o)=>{t.push(..._p(e,r,o))}),e.chart.series.forEach((r,o)=>{t.push(...Fp(e,r,o))}),t}var Vp=[0,25,50,75,100];function Wp(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...hR(e,t)),e.showLabels&&r.push(...gR(e,t)),r}function hR(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return Vp.map(i=>{let a=zp(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 gR(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e;return Vp.map(a=>({...P({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:n,frame:{x:o.x,y:zp(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function zp(e,t){return e.grid.y+e.grid.height*(1-t/100)}function Yp(e,t,r,o){if(!e.showLabels)return[];let n=bR(e,t,r,o);return e.chart.config?.showMekkoTotals===!1?[n]:[yR(e,t,r,o),n]}function yR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e;return{...P({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 bR(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,{label:s,width:l}=o;return{...P({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:Ge(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function Up(e){let t=xR(e),r=e.showLabels?30:0,o=SR(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:CR(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 xR(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}function SR(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 CR(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 kR=.15;function jp(e,t,r){let n=e.chart.config?.showColumnBackdrop!==!1?[RR(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=wR(e.chart.series,t,r),s=a.flatMap((l,d)=>vR(e,t,l,i?a[d+1]?.color:void 0));return[...n,...s]}function RR(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=Xp(e);return{type:"path",id:`chart-mekko-column-backdrop-${o.id}-${r}`,order:a(),bounds:n,d:Ho(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:v(o.gridColor??"#e2e8f0",i,o.id),opacity:kR}}}function Xp(e){return Math.max(0,p(e.chart.config?.barCornerRadius,2))}function wR(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 vR(e,t,r,o){return[PR(e,r,o),...LR(e,t,r)]}function PR(e,t,r){let{chart:o,plot:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=D(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?Xp(e):0,{x:m,y:f,width:h,height:y}=t.frame,b=Math.max(0,p(c?.mekkoSegmentGap,0)),S="#94a3b8",R={minX:m+h/2-y/2,maxX:m+h/2+y/2,minY:f,maxY:f+y},k=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:I(t.color,S)},{offset:100,color:I(r,S)}]}:v(t.color,a,o.id);return{type:"path",id:`chart-mekko-seg-${o.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?R:i,d:pt(m,f+b/2,h,Math.max(0,y-b),u,!!c?.mekkoRoundAll),style:{fill:k,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 LR(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=Ge(r.seriesLabel,c,t.labelSize).map(N=>Io(N,c,t.labelSize,!0));if(h.length*m+f>u)return[];let y=o.config?.mekkoTextColor??de(I(r.color,"#ffffff")),b=t.columns[r.columnIndex]?.total??0,S=o.config?.mekkoValueFormat==="percent"?`${b>0?Math.round(r.value/b*100):0}%`:String(r.value),R={...P({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},k={...P({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:S,chart:o}),lines:[S],fontSize:t.valueSize,color:y};return[R,k]}function qp(e){let t=Up(e),r=Wp(e,t);return t.columns.forEach((o,n)=>{r.push(...jp(e,t,n)),r.push(...Yp(e,t,n,o))}),r}function MR(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 Kp(e,t){let{chart:r,bounds:o,nextOrder:n}=e,i=r.config?.pieCenterText;if(!i)return[];let a=MR(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??O,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 Zp(e){let{chart:t,plot:r}=e,o=Xo(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 TR=14*Math.PI/180,Wr=80,$R=.62,AR=14,ER=3,NR=.32,Qp="#334155";function tf(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(o=>o.end-o.start>=TR).flatMap(o=>OR(e,t,o))}function Jp(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"?Wr*1.9:Wr,h={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??O,fontSize:n,align:"center",verticalAlign:"middle",lineHeight:1.2,color:o},y=R=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...R}),b={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)},S={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:ce(t.seriesId,0),propKind:"value"};return m==="inline"||m==="name"?[b]:m==="percent"?[S]:[b,S]}function ef(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 OR(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+ER),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 N=m?BR(Q(n,i,n.outerRadius),r.labelOffsetX,r.labelOffsetY):Q(n,i,n.outerRadius+AR+(f==="outside"?Math.abs(Math.cos(i))*(o?.pieLabelContent==="inline"?Wr*.95:Wr/2):0)),F=Nr(d,N,Wr/2,l),G=o?.pieLabelColor??Je(I(r.color,Qp),NR)??Qp;return[ef(e,r,d,F,G,!0),...Jp(e,r,N,G,a,s,!0,i)]}let y=n.innerRadius+c*$R,b=Q(n,i,y),S=I(r.color,"#0f172a"),R=o?.pieLabelColor??Yt(S,de(S));return[ef(e,r,d,d,R,!1),...Jp(e,r,b,R,a,s,!1,i)]}function BR(e,t,r){return{x:e.x+t,y:e.y+r}}var IR=-Math.PI/2,Ia=Math.PI*2,GR=Ia*(359.999/360),Ba=e=>e*Math.PI/180;function rf(e,t){let r=e.chart.config,o=_R(e.chart.series,t.total,{start:IR+Ba(p(r?.pieStartAngle,0)),sweep:Math.min(Ia,Math.max(Ba(1),Ba(p(r?.pieSweep,360)))),explode:Math.max(0,p(r?.pieExplode,0))}),n=r?.pieSliceGap??0;return[...o.flatMap(i=>zR(e,DR(t,i),i,n)),...tf(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:of(i)})))]}function of(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function DR(e,t){if(t.explode===0)return e;let{dx:r,dy:o}=of(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+o}}function _R(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>=Ia?GR: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 FR(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 HR(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 VR(e,t,r){let o=Math.max(0,r)/2,n=t.angles.end-t.angles.start,i=Qt(e,t.angles,r),a=2*ft(o,e.outerRadius),s=Math.max(0,n-a);return Math.min(e.cornerRadius,i?Or(e.outerRadius,e.innerRadius,s):Br(e.outerRadius,ht(o,n,e.outerRadius),s))}function WR(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 zR(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=v(r.color,a,n.id),d=gt(t,r.angles,VR(t,r,o),o),c=D(n.shadowStyle),u=WR(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:HR(c,o),clip:{type:"path",d:FR(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:ce(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:m?{color:I(r.color,"#ffffff"),opacity:.85,blur:m,dx:0,dy:0}:void 0}};return f?[f,h]:[h]}function nf(e){let t=Zp(e);return[...rf(e,t),...Kp(e,t)]}var YR=-Math.PI/2,UR="#e2e8f0",jR=14*Math.PI/180,ln=80,XR=.62,qR=14,KR=3,ZR=.32,af="#334155";function QR(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:YR+p(t.config?.pieStartAngle,0)*Math.PI/180}}function sf(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*ft(d,t));if(Qt(l,r,s))return Math.min(a,Or(t,i,u));let m=ht(d,c,t);return Math.min(a,Br(t,m,u))}function JR(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,b=v(a,d,s.id),S=D(s.shadowStyle),R=gt({centerX:u,centerY:m,outerRadius:h,innerRadius:f},o,sf(t,h,o),y),k={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:R,style:{fill:v(s.gridColor??UR,d,s.id),opacity:s.config?.polarTrackOpacity,...ew(e)}},N=gt({centerX:u,centerY:m,outerRadius:n,innerRadius:f},o,sf(t,n,o),y),F=S?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:N,style:{fill:b,shadow:S,clip:{type:"path",d:R}}}:void 0,G={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:N,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:o.start,pieEnd:o.end,pieValue:i},prop:ce(r.id,0),style:{fill:b,innerShadow:S,...tw(e)}};return F?[k,F,G]:[k,G]}function ew(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 tw(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:p(t.pieStrokeWidth,1)}:{}}function rw(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return!r.config?.polarRings||t.range<=0?[]:z(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 lf(e){let t=QR(e),{centerX:r,centerY:o,innerRadius:n,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=jR;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)),b=s>0?Math.min(1,Math.max(0,(y-a)/s)):0,S=Math.max(n+1,n+(i-n)*b),R=m.color??E[f%E.length],k=JR(e,t,m,h,S,y,R);if(!c)return k;let N={centerX:r,centerY:o,outerRadius:S,innerRadius:n};return[...k,...aw(e,N,h,m,y,R)]}),...rw(e,t)]}function Ga(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 ow(e,t,r,o,n){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=Ga(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>=ln,b=e.chart.config?.polarOutsideLabels??!1;if(!y&&!m&&!b)return;let S=m||!y,R=Q(t,i,t.outerRadius+KR),k=S?m?sw(Q(t,i,t.outerRadius),c,u):Q(t,i,t.outerRadius+qR):Q(t,i,t.innerRadius+d*XR),N=S?b&&e.chart.textColor?e.chart.textColor:Je(I(n,af),ZR)??af:Yt(I(n,"#0f172a"),de(I(n,"#0f172a")));return{point:k,color:N,outside:S,mid:i,tickStart:R}}function nw(e,t,r,o){let{point:n,color:i,outside:a,tickStart:s}=r,l=a?Nr(s,n,ln/2,o):s;return{type:"path",id:`chart-polar-area-label-tick-${e.chart.id}-${t.id}`,order:e.nextOrder(),bounds:e.bounds,d:`M ${s.x} ${s.y} L ${l.x} ${l.y}`,detail:{of:"chartSeries",series:t.id,mark:"polar-area-label-tick"},style:a?{stroke:{kind:"solid",color:i},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function iw(e,t,r,o,n){let{chart:i,bounds:a,nextOrder:s}=e,{point:l,color:d,outside:c,mid:u}=n,{nameSize:m,valueSize:f}=Ga(i),h={of:"chartSeries",series:r.id,mark:"polar-area-label",pulled:c||void 0,midAngle:u,wedgeRadius:t.outerRadius},y={bounds:a,x:l.x-ln/2,width:ln,fontFamily:i.fontFamily??O,align:"center",verticalAlign:"middle",lineHeight:1.2,color:d},b=i.config?.polarValueFirst??!1,S=m*1.2,R=f*1.2,k=l.y-(S+R)/2,N=b?k+R:k,F=b?k:k+S,G={type:"text",id:`chart-polar-area-label-name-${i.id}-${r.id}`,order:s(),...y,y:N,height:m*1.2,fontSize:m,lines:[r.label],fontWeight:b?"normal":"bold",detail:h,prop:Ee(r.id)},X={type:"text",id:`chart-polar-area-label-value-${i.id}-${r.id}`,order:s(),...y,y:F,height:f*1.2,fontSize:f,lines:[Ae(o)],fontWeight:b?"bold":"normal",detail:h,prop:ce(r.id,0),propKind:"value"};return[G,X]}function aw(e,t,r,o,n,i){let a=ow(e,t,r,o,i);if(!a)return[];let{nameSize:s,valueSize:l}=Ga(e.chart);return[nw(e,o,a,Math.max(s,l)*1.2),...iw(e,t,o,n,a)]}function sw(e,t,r){return{x:e.x+t,y:e.y+r}}var lw=["Speed","Quality","Cost","Reliability","Usability"];function dw(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:Ko(r.width,r.height,p(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Zo(o,n),curved:t.chartType==="radial",tension:t.config?.radarTension}}function df(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],o=dw(e),n=cw(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=>Qo(n.map((s,l)=>i(a,l)),!1)}}function cw(e,t){return Array.from({length:t},(r,o)=>e[o]??lw[o]??`Category ${o+1}`)}function cf(e,t){return e.chart.showGrid===!1?[]:[...uw(e,t),...t.showSpokes?pw(e,t):[]]}function uw(e,t){return z(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>mw(e,t,r))}function mw(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 pw(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 uf(e,t){return e.showLabels?t.categories.map((r,o)=>fw(e,t,r,o)):[]}function fw(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 P({id:`chart-radar-label-${n.id}-${o}`,order:s(),bounds:a,frame:{x:hw(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:n,align:gw(d)})}function hw(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function gw(e){return e>8?"left":e<-8?"right":"center"}function mf(e,t){let r=[];return e.chart.series.forEach((o,n)=>{r.push(...yw(e,t,o,n))}),r}function yw(e,t,r,o){let n=r.color??E[o%E.length],i=bw(r,e,t),a=Qo(i,t.circular,t.tension);return[xw(e,t,r,a,n),...t.strokeWidth>0?[Sw(e,t,r,a,n)]:[],...t.pointSize>0?Cw(e,t,r,i,n):[]]}function bw(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 xw(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:v(n,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function Sw(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:v(n,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:D(i.shadowStyle)}}}function Cw(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:ce(r.id,c),style:{fill:v(n,s,i.id)}}))}function Da(e){let t=df(e),r=[];return r.push(...cf(e,t)),r.push(...uf(e,t)),r.push(...mf(e,t)),r}var kw=-Math.PI/2,Rw=14,ww=4,vw=.18,_a=1e-4;function lr(e,t,r,o){return{x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function pf(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 Pw(e,t,r,o){return`${pf(e,t,r)} ${pf(e,t,Math.max(0,o))}`}function ff(e,t,r,o,n){let i=lr(e,t,r,o),a=lr(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 Lw(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 Mw(e,t,r,o,n){if(o>=Math.PI*2-_a){let l=lr(e,t,r,n),d=lr(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=lr(e,t,r,n),a=lr(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 Tw(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,Rw)),ringGap:Math.max(0,p(t.config?.ringGap,ww)),axisMin:o,range:p(t.axisY.max,100)-o,start:kw+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,vw))),cap:t.config?.ringCap??"round"}}function $w(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:m}=t,f=D(a.shadowStyle),h=n>=Math.PI*2-_a;if(!f||h)return[];let y=Lw(f,u),b=Math.min(n,u/o);return[[m,m+b],[m+n-b,m+n]].map(([S,R],k)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${k}`,order:l(),bounds:s,d:ff(d,c,o,S,R),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:y,clip:{type:"path",d:Pw(d,c,o+u/2,o-u/2)}}}))}function Aw(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:b,trackOpacity:S,cap:R}=t,k=c-o*(u+m)-u/2;if(k<=u/2)return[];let N=v(r.color??E[o%E.length],a,n.id),F=Math.max(0,p(r.values[0],0)),G=h>0?Math.min(1,Math.max(0,(F-f)/h)):0,X={fill:{kind:"none"},stroke:N,strokeWidth:u,opacity:S},se=b>=Math.PI*2-_a?{type:"ellipse",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:k,ry:k,style:X}:{type:"path",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,d:ff(l,d,k,y,y+b),style:{...X,lineCap:R}};if(G<=0)return[se];let xe=G*b,at=$w(e,t,r,k,xe,N),vt={type:"path",id:`chart-radial-bar-ring-${n.id}-${r.id}`,order:s(),bounds:i,d:Mw(l,d,k,xe,y),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:ce(r.id,0),style:{fill:{kind:"none"},stroke:N,strokeWidth:u,lineCap:R}};return[se,...at,vt]}function hf(e){let t=Tw(e);return e.chart.series.flatMap((r,o)=>Aw(e,t,r,o))}function gf(e,t){let r=D(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=Ew(e,t,a,s,o);return Nw(e,l,r,i,o)})}function Ew(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 Nw(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:Ow(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 Ow(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 Bw=.3,Iw=.78;function yf(e,t){let r=Math.max(0,p(e.chart.config?.barCornerRadius,0)),o=[];return t.nodes.forEach(n=>{o.push(Gw(e,t,n,r));let i=e.showLabels?Dw(e,t,n):void 0;i&&o.push(i)}),o}function Gw(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:D(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:Sr(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:Cr(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 Dw(e,t,r){let{chart:o}=e,n=o.config?.labelPosition??"outside",i=n==="inside"?Fw(e,t,r,o.config?.labelOrientation??"horizontal"):_w(e,t,r);if(!i)return;let a=o.textColor??"#0f172a",s=n==="inside"?de(r.color):Je(r.color,zo(a)?Iw:Bw)??a,l=o.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function _w(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{...P({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 Fw(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 ge(r.label,u,!1)>h?void 0:{...P({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{...P({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 bf(e){let{chart:t,plot:r,showLabels:o}=e,n=o?92:0,i=Math.max(1,r.width-n*2),a=Oa(Hw(e),Vw(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 Hw(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function Vw(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?I(r.color,K):void 0})}),t}function xf(e){let t=bf(e),r=[];return r.push(...gf(e,t)),r.push(...yf(e,t)),r}var Ww=4;function Sf(e){let t=[],r=D(e.chart.shadowStyle);return e.chart.series.forEach((o,n)=>{let i=o.color??E[n%E.length];xt(e,bt(e.chart,o)).forEach((s,l)=>{t.push(zw(e,o,s,l,i,r))})}),t}function zw(e,t,r,o,n,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??Ww,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:v(n,l,a.id),stroke:m>0?v(c?.pointStrokeColor??n,l,a.id):void 0,strokeWidth:m>0?m:void 0,opacity:c?.pointOpacity,shadow:i}}}function Cf(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:Lr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Pr,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 zr(e){return e.values[0]??0}function Fa(e,t){return e.color??Mr(zr(e),t.bands,t.zones)}var qe=10,dn=4,Ha=2,Va=16,Yr=34;function kf(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?Yw(e,t):Uw(e,t)}function Wa(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function Rf(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((o,n)=>({offset:Wa(e,e.bands[n+1]??e.bands[e.bands.length-1])*100,color:o.color??K}))}function Yw(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+Va,c=le({x:a,y:d,width:s,height:qe}),u=Rf(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 b=a+Wa(t,h)*s,S={type:"path",id:`chart-treemap-legend-tick-${r.id}-${y}`,order:i(),bounds:n,d:`M ${b} ${d+qe} L ${b} ${d+qe+dn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},R=y===0,k=y===t.bands.length-1,N=R?"left":k?"right":"center",F=R?b:k?b-Yr:b-Yr/2,G=P({id:`chart-treemap-legend-tick-label-${r.id}-${y}`,order:i(),bounds:n,frame:{x:F,y:d+qe+dn+Ha,width:Yr,height:l},text:Ae(h),chart:r,align:N});return[S,G]});return[m,...f]}function Uw(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-Va-qe:o.x+t.gridWidth+Va,c=le({x:d,y:s,width:qe,height:l}),u=Rf(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-dn:f+dn,y=a==="left"?h-Ha-Yr:h+Ha,b=t.bands.flatMap((S,R)=>{let k=s+(1-Wa(t,S))*l,N={type:"path",id:`chart-treemap-legend-tick-${r.id}-${R}`,order:i(),bounds:n,d:`M ${f} ${k} L ${h} ${k}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},F=P({id:`chart-treemap-legend-tick-label-${r.id}-${R}`,order:i(),bounds:n,frame:{x:y,y:k-t.fontSize/2,width:Yr,height:t.fontSize+2},text:Ae(S),chart:r,align:a==="left"?"right":"left"});return[N,F]});return[m,...b]}function wf(e,t){let{tiles:r,headers:o}=jw(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(...qw(e,t,a,c))}),o.forEach((a,s)=>{n.push(...Xw(e,t,a,s))}),n}function jw(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:zr(c)}));return{tiles:Vr(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+zr(c),0)})),n=Vr(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:zr(m)}));a.push(...Vr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function Xw(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={...P({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:de(l)};return[d,u]}function qw(e,t,r,o){let n=Fa(r.item.leaf,t),i=o?Fa(o.item.leaf,t):void 0,a=[Kw(e,t,r,n,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...Zw(e,t,r,n)),a}function Kw(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=D(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),b=Math.max(0,r.height-c),S="#94a3b8",R={minX:f,maxX:f+y,minY:h+b/2-y/2,maxY:h+b/2+y/2},k=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:I(o,S)},{offset:100,color:I(n,S)}]}:v(o,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:n?R:s,x:f,y:h,width:y,height:b,rx:t.cellRadius,style:{fill:k,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 Zw(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,b=n.config?.tileTextColor??de(I(o,"#ffffff")),S=t.labelSize*1.2,R=Math.max(1,Math.floor(f/S)),k=Ge(l.label,m,t.labelSize).slice(0,R).map(se=>Io(se,m,t.labelSize,!0)),N={...P({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:k,fontSize:t.labelSize,fontWeight:"bold",color:b},F=String(d),G=k.length*S+t.valueSize*1.2<=f+2&&ge(F,t.valueSize,!1)<=m;if(n.config?.showTileValues===!1||!G)return[N];let X={...P({id:`chart-treemap-value-${n.id}-${l.id}`,order:s(),bounds:a,frame:{x:h,y:y+k.length*S,width:m,height:Math.max(1,f-k.length*S)},text:String(d),chart:n}),lines:[String(d)],fontSize:t.valueSize,color:b};return[N,X]}function vf(e){let t=Cf(e),r=[];return r.push(...wf(e,t)),r.push(...kf(e,t)),r}var Qw={bar:Km,boxplot:np,custom:sp,field:gp,heatmap:wp,hexbin:e=>Ep(e),line:Hp,mekko:qp,pie:e=>nf(e),polarArea:e=>lf(e),radar:e=>Da(e),radial:e=>Da(e),radialBar:e=>hf(e),sankey:xf,scatter:Sf,treemap:vf},Jw=new Set(["radar","radial"]);function za(e){return Jw.has(e)}function St(e){return Qw[e.chart.chartType](e)}function Pf(e){let{chart:t,context:r,layout:o,nodes:n,renderOrder:i}=e,a=en(t,o.plot,o.bounds,i.current());n.push(...a),i.advance(a.length),n.push(...St(r));let s=zm({chart:t,plot:o.plot,bounds:o.bounds,order:i.current()});return n.push(...s),i.advance(s.length),n.push(...Bm(t,o,i.current())),n}function ev(e,t){let r=ne(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function tv(e,t){let{outerRadius:r,innerRadius:o,cornerRadius:n}=Xo(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 rv(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 ov(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...e.series.map(c=>c.values.length)),n=Zo(r,o),i=Ko(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 nv(e,t){return e.chartType==="pie"?tv(e,t):e.chartType==="polarArea"?rv(e,t):e.chartType==="radar"||e.chartType==="radial"?ov(e,t):Lm.has(e.chartType)?ev(e,t):void 0}function Lf(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:v(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:p(e.strokeWidth,1)}},i=nv(e,r);return i&&(n.detail=i),n}function Mf(e,t,r,o){let n=vm({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:o});return r.advance(n.length),n}function Tf(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 cn=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 $f(e,t,r,o){return e.title?[{...P({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:xm}]:[]}function Af(e,t,r){let o=2e4+t,n=$m(e),i=new cn(o),a=[Lf(e,n.bounds,n.plot,o)];return a.push(...Ym(e,n.bounds,i)),a.push(...$f(e,n.bounds,n.plot,i)),a.push(...Mf(e,n,i,r)),{chart:e,layout:n,nodes:a,renderOrder:i,context:Tf(e,n,i,r)}}function Ef(e){return e.nodes.push(...St(e.context)),e.nodes}function Nf(e){return e.nodes.push(...St(e.context)),e.nodes}function Of(e,t,r){if(e.isVisible===!1)return[];let o=Af(e,t,r);return za(e.chartType)?Ef(o):Xe(e)?Pf(o):Nf(o)}function Ya(e,t){return e.flatMap((r,o)=>re(Of(r,o,t),"chart",r.id,r.chartType,r.title??"Chart"))}function iv(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 av(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 sv(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=av(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 Bf(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=sv(i,iv(n));a.style={...a.style,clip:a.style.clip?{...a.style.clip,within:s}:s}}}}function lv(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 dv(e){if(!e.length)return $i;let t=e.map(lv);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 cv(e){let t=new Map,r=(o,n,i)=>{n.forEach((a,s)=>{t.set(`${o}:${a.id}`,{rank:gc(a),sequence:yc(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 uv(e,t){let r=cv(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 Ua(e,t={}){let{measureText:r}=t,o=[...e.diagnostics??[]],n=[...Xc(e),...Wu(e.paths??[]),...Ya(e.charts??[],o),...Vu(e.links,r),...cm(e.shapes,o,r),...Bi(e.components??e.widgets??[]),...ou(e.isometricObjects??[]),...Zc(e.dimensions??[])];return Bf(n,e.frames),uv(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:dv(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 un=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 mn=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,fv);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,mv,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},pv,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 mv(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 pv(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 fv(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 If(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 hv(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function gv(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 pn=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=hv(t,a,o),l=gv(i,s);return this.addDefinition(`<marker ${l}>${If(t,a,M(r),o)}</marker>`),i}};function yv(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 bv(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 fn=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"?yv(i,t):bv(i,t,o);this.addDefinition(a)}return`url(#${i})`}};var hn=class{constructor(t){this.prefix=t;let r=o=>{this.entries.push(o)};this.paints=new fn(r,t),this.filters=new mn(r,t),this.markers=new pn(r,t),this.clips=new un(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 xv(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 Gf(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,xv(t,t.identity.id)]:[t])}function Df(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 _f(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 Sv(n,e.style),Ff(n,e,t),kv(n,e,t),n.join(" ")}function Sv(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 Cv(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);if(t.type==="path"&&t.bounds){let r=Math.min(t.bounds.maxX-t.bounds.minX,t.bounds.maxY-t.bounds.minY);return r>0?r:void 0}}function Ff(e,t,r){let o=r.filter(t.style,t.id,Cv(t));o&&e.push(`filter="url(#${o})"`);let n=r.clip(t.style);n&&e.push(`clip-path="url(#${n})"`)}function kv(e,t,r){if(t.type!=="path")return;let o=r.marker(t.markerStart,Df(t.style,"start"),t.style.strokeWidth??1),n=r.marker(t.markerEnd,Df(t.style,"end"),t.style.strokeWidth??1);o&&e.push(`marker-start="url(#${o})"`),n&&e.push(`marker-end="url(#${n})"`)}function Ke(e,t){return e&&t?` transform="rotate(${g(e)} ${g(t.x)} ${g(t.y)})"`:""}function Hf(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}"`),Ff(r,e,t),r.join(" ")}var Vf="data-sf-symbol-points",Wf="data-sf-symbol-tension",gn="data-sf-symbol-bounds",Ur="data-sf-corner-radius",zf="data-sf-square-corner",yn="data-sf-path-points",bn="data-sf-path-tension",xn="data-sf-path-closed",Yf="data-sf-path-point",Sn="data-sf-isometric-size",Cn="data-sf-isometric-label-offset";function Rv(e){return e.role==="shape"?"entity":e.role}function wv(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 vv(e){return[`data-sf-role="${Rv(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?wv(e.aria):[]]}function Pv(e){switch(e.of){case"chartValue":return Lv(e);case"chartScale":return $v(e);case"chartSeries":return Av(e);case"pieGeometry":return Mv(e);case"radarGeometry":return Tv(e);case"link":return Iv(e);case"frameBoundary":return Ev(e);case"symbolGeometry":return Nv(e);case"declaredBounds":return[ja(e.bounds)];case"pathGeometry":return Ov(e);case"isometricGeometry":return Bv(e)}}function Lv(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 Mv(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function Tv(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function $v(e){return[`data-sf-value-scale="${e.valueScale}"`]}function Av(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 Ev(e){return[`${Ur}="${g(e.cornerRadius)}"`,`${zf}="${e.squareCorner}"`]}function ja(e){return`${gn}="${g(e.x)},${g(e.y)},${g(e.width)},${g(e.height)}"`}function Nv(e){return[`${Vf}="${M(JSON.stringify(e.points))}"`,`${Wf}="${g(e.tension)}"`,ja(e.declaredBounds)]}function Ov(e){return[`${yn}="${M(JSON.stringify(e.points))}"`,`${bn}="${g(e.tension)}"`,`${xn}="${e.closed}"`]}function Bv(e){return[`${Sn}="${g(e.width)},${g(e.height)},${g(e.depth)}"`,`${Ur}="${g(e.cornerRadius)}"`,ja(e.bounds),`${Cn}="${g(e.labelOffsetX)},${g(e.labelOffsetY)}"`]}function Iv(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 Ct(e){let t=e.identity?.label,r=[...e.identity?vv(e.identity):[],...e.detail?Pv(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 Gv(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 Uf(e,t){let r=Dv(e),o=`${g(e.fontSize)}px`,n=Fv(e,r,o),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${Ct(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}${Ke(e.rotation,e.rotationCenter)}>${n}</text>`}function Dv(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:_v(e,o),linePx:t,anchor:i}}function _v(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 Fv(e,t,r){return e.richLines?e.richLines.map((o,n)=>Gv(o,t.x,jf(n,t.linePx),r)).join(""):e.lines.map((o,n)=>Hv(o,n,t,r)).join("")}function Hv(e,t,r,o){return`<tspan x="${g(r.x)}" font-size="${o}"${jf(t,r.linePx)}>${M(e)}</tspan>`}function jf(e,t){return e?` dy="${g(t)}px"`:""}function Vv(e,t){let r=Ke(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)}"${Ct(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 Wv(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 zv(e,t){let r=Ke(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=>Wv(s,e)).join(""),a=M(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${Ct(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 Xf(e,t){if(e.type==="text")return Uf(e,t);if(e.type==="shader-surface")return Vv(e,t);if(e.type==="rolling-number")return zv(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${Ct(e)} ${Hf(e,t)} href="${M(e.href)}" x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}" preserveAspectRatio="${e.aspect==="none"?"none":`xMidYMid ${e.aspect??"slice"}`}"${Ke(e.rotation,e.rotationCenter)}/>`;let r=`id="${t.elementId(e.id)}"${Ct(e)} ${_f(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)}"`:""}${Ke(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)}"${Ke(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${M(e.d)}"${Ke(e.rotation,e.rotationCenter)}/>`}function qf(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 hn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?Gf(e.nodes):e.nodes).map(u=>Xf(u,a)).join(`
7
+ `&&e.peek()!=="\r";)e.advance()}function tl(e){let t=e.peek();return Lt(t)||t==="-"&&Lt(e.peek(1))}function rl(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());Lt(e.peek());)r+=e.advance();if(e.peek()==="."&&Lt(e.peek(1)))for(r+=e.advance();Lt(e.peek());)r+=e.advance();return ue("number",r,t,{numberValue:Number(r)})}var Gg=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],Dg=e=>e!==void 0&&/[\d.]/.test(e);function ol(e,t){let r=Gg.find(([i])=>e.startsWith(i));if(!r)return null;let[o,n]=r;if(o==="-"&&Dg(e.peek(1)))return null;for(let i=0;i<o.length;i++)e.advance();return ue(n,o,t)}var _g={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function nl(e,t){let r=e.peek(),o=r?_g[r]:void 0;return!r||!o||r==="&"&&e.peek(1)==="&"?null:(e.advance(),ue(o,r,t))}function il(e){return e===" "||e===" "}function al(e){e.advance()}function Fg(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function Hg(e){let t=e.split(`
8
+ `),r=1/0;for(let o of t)o.trim()&&(r=Math.min(r,Fg(o)));return!Number.isFinite(r)||r===0?e:t.map(o=>o.trim()?o.slice(r):o).join(`
9
+ `)}function Vg(e,t){sl(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return sl(e),Hg(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new Oe("unterminated long string",t.line,t.col)}function sl(e){e.advance(),e.advance(),e.advance()}function Wg(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==="\\"?zg(e,t):o}throw new Oe("unterminated string",t.line,t.col)}function zg(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 Yg(e,t){return e.startsWith('"""')?Vg(e,t):Wg(e,t)}function ll(e,t){return ue("string",Yg(e,t),t)}function dl(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(Zs(t))return Qs(e,r);if(Ug(e,t))return null;let o=jg(e,t,r)??Xg(e,r);if(o)return o;throw new Oe(`unexpected character '${t}'`,r.line,r.col)}function Ug(e,t){return il(t)?(al(e),!0):Js(e)?(el(e),!0):!1}function jg(e,t,r){let o=nl(e,r);return o||(t==='"'?ll(e,r):ol(e,r))}function Xg(e,t){return tl(e)?rl(e,t):qs(e)?Ks(e,t):null}function cl(e){let t=new ro(e),r=[];for(;!t.done;){let o=dl(t);o&&r.push(Jn(o,t))}return r.push(Jn(ue("eof","",t.position()),t)),r}var Y=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 oo=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 Y(`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 Y(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function Mt(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}var qg=new Set([">","<",">=","<=","==","!="]);function Kg(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function pr(e,t,r){let o=r(e);for(;Kg(e,t);)o={kind:"binary",operator:e.next().value,left:o,right:r(e)};return o}var Zg=new Set(["||"]),Qg=new Set(["&&"]),Jg=new Set(["+","-"]),e0=new Set(["*","/"]);function lt(e){return pr(e,Zg,t0)}function t0(e){return pr(e,Qg,r0)}function r0(e){return pr(e,qg,o0)}function o0(e){return pr(e,Jg,n0)}function n0(e){return pr(e,e0,pl)}function pl(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:pl(e)}):a0(e)}function i0(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(lt(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new Y(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function a0(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=lt(e);return e.expect("rparen","')'"),r}case"ident":{let r=Mt(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:i0(e)}:{kind:"ref",path:r}}default:throw new Y(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var s0=["bind","bind2","action"];function no(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&s0.includes(e.peek(2).type)}function io(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,o=lt(e),n=e.peek();if(!["newline","semi","rbrace","eof"].includes(n.type))throw new Y(`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 ul(e){let t=e.peek(),r=Mt(e);e.expect("bind","'<-'");let o=lt(e);return{target:r,expr:o,line:t.line,col:t.col}}function fl(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function hl(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(ul(e)),ml(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new Y(`unterminated handler '${t.value}'`,t.line,t.col);r.push(ul(e)),ml(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function ml(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new Y(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}function gl(e){let t=Mt(e),r,o;if(e.at("comma")){e.next();let n=e.expect("ident",'side after ","');if(!Us(n.value))throw new Y(`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 l0(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(ao(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(ao(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}var d0=new Set(["+","-","*","/",">","<",">=","<=","==","!=","&&","||"]);function c0(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"&&d0.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 u0(e){let t=[lt(e)];for(;e.at("comma");)e.next(),t.push(lt(e));return{type:"expr",items:t}}function ao(e,t=!0){if(t&&c0(e))return u0(e);let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return l0(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:Mt(e)};default:throw new Y(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var so=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 Y("unterminated style block",o.line,o.col)}no(this.cursor)?(r.push(io(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"?gl(this.cursor):ao(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 Y(`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 Y(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var lo=class{constructor(t){this.cursor=t;this.properties=new so(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!to(t.value))throw new Y(`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 Y('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 Y(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return to(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()}:no(this.cursor)?{type:"binding",binding:io(this.cursor)}:fl(this.cursor)?{type:"handler",handler:hl(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"&&!to(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 co=class{constructor(t){this.cursor=t;this.blocks=new lo(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new Y(`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 ei(e){return new co(new oo(cl(e))).parseDocument()}function Z(e,t){throw new Error(`${e.label}: ${t}`)}function q(e,t,r){return(typeof t!="number"||!Number.isFinite(t))&&Z(e,`${r} needs a number`),t}function ti(e,t){let r=typeof t=="string"?/^#([0-9a-f]{6})$/i.exec(t):null;r||Z(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 yl=e=>`#${e.map(t=>Math.round(Math.max(0,Math.min(255,t))).toString(16).padStart(2,"0")).join("")}`;function bl(e,t,r){let o=n=>q(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&&Z(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=ti(e,r[0]),i=ti(e,r[1]),a=Math.max(0,Math.min(1,o(2)));return yl(n.map((s,l)=>s+(i[l]-s)*a))}case"shade":{let n=o(1);return yl(ti(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 Z(e,`unknown function ${t}()`)}}function dt(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&&Z(e,`unknown name ${r}`),o}case"unary":{let r=dt(e,t.operand);return t.operator==="-"?-q(e,r,"a minus"):!r}case"call":return bl(e,t.callee.join("."),t.args.map(r=>dt(e,r)));case"binary":{let r=dt(e,t.left),o=dt(e,t.right);switch(t.operator){case"+":return typeof r=="string"||typeof o=="string"?`${r}${o}`:q(e,r,"+")+q(e,o,"+");case"-":return q(e,r,"-")-q(e,o,"-");case"*":return q(e,r,"*")*q(e,o,"*");case"/":return q(e,r,"/")/q(e,o,"/");case">":return q(e,r,">")>q(e,o,">");case"<":return q(e,r,"<")<q(e,o,"<");case">=":return q(e,r,">=")>=q(e,o,">=");case"<=":return q(e,r,"<=")<=q(e,o,"<=");case"==":return r===o;case"!=":return r!==o;case"&&":return!!r&&!!o;case"||":return!!r||!!o}}}}var fr=e=>Math.round(e*1e3)/1e3;function xl(e,t){return typeof t=="number"?{type:"number",value:fr(q(e,t,"a value"))}:typeof t=="string"?{type:"string",value:t}:{type:"ident",segments:[String(t)]}}function ct(e,t){if(e.substitute&&t.type==="ident"&&t.segments.length===1){let o=e.vars.get(t.segments[0]);if(o!==void 0)return xl(e,o)}if(t.type!=="expr")return t;let r=t.items.map(o=>dt(e,o));return r.length===1?xl(e,r[0]):{type:"tuple",values:r.map(o=>fr(q(e,o,"a tuple")))}}function Sl(e,t){return t.map(r=>({key:r.key,value:ct(e,r.value)}))}function m0(e,t,r){switch(t.type){case"property":return{type:"property",property:{key:t.property.key,value:ct(e,t.property.value)}};case"layout":return{type:"layout",layout:{properties:Sl(e,t.layout.properties)}};case"style":return{type:"style",style:{...t.style,properties:Sl(e,t.style.properties)}};case"block":return{type:"block",block:hr(e,t.block,r)};default:return t}}function hr(e,t,r){return{...t,name:r(t.name),entries:t.entries.map(o=>m0(e,o,r))}}function ri(e,t){for(let r of e.entries)if(r.type==="property"&&r.property.key===t)return r.property.value}function Se(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}}var Ze=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}};var p0=new Set(["columns","rows","count","step","origin","seed","jitter","chance","order","where"]),Cl=2e4,f0=1e6;function h0(e,t){let r=Se(e,"count")?.[0],o=Math.max(1,Math.floor(r??Se(e,"columns")?.[0]??1)),n=r===void 0?Math.max(1,Math.floor(Se(e,"rows")?.[0]??1)):1;o*n>Cl&&Z(t,`${o*n} cells are too many, the limit is ${Cl}`);let[i=0,a=i]=Se(e,"step")??[],[s=0,l=0]=Se(e,"origin")??[],d=ri(e,"order"),c=e.entries.flatMap(u=>u.type==="block"?[u.block]:[]);return c.some(u=>u.kind==="Repeat")&&Z(t,"a Repeat cannot hold another Repeat"),o*n*Math.max(1,c.length)>f0&&Z(t,"too many blocks"),{columns:o,rows:n,step:[i,a],origin:[s,l],seed:Se(e,"seed")?.[0]??0,jitter:Se(e,"jitter")?.[0]??0,chance:Se(e,"chance")?.[0]??1,diagonal:d?.type==="ident"&&d.segments[0]==="diagonal",condition:ri(e,"where"),helpers:e.entries.flatMap(u=>u.type==="property"&&u.property.value.type==="expr"&&!p0.has(u.property.key)?[u.property]:[]),templates:c}}function g0(e){let t=[];for(let r=0;r<e.rows;r++)for(let o=0;o<e.columns;o++)t.push([o,r]);return e.diagonal?t.sort((r,o)=>r[0]+r[1]-(o[0]+o[1])||r[0]-o[0]):t}function y0(e,t,r,o){let n=o*t.columns+r;if(e.random=new Ze(Math.imul(t.seed+1,2654435761)^Math.imul(n+1,2246822507)),t.chance<1&&e.random.next()>=t.chance)return!1;let i=()=>t.jitter>0?(e.random.next()*2-1)*t.jitter:0;return e.vars=new Map([["col",r],["row",o],["index",n],["count",t.columns*t.rows],["columns",t.columns],["rows",t.rows],["x",fr(t.origin[0]+r*t.step[0]+i())],["y",fr(t.origin[1]+o*t.step[1]+i())]]),!0}function b0(e,t){for(let r of t){let o=ct(e,r.value);o.type==="number"||o.type==="string"?e.vars.set(r.key,o.value):o.type==="ident"?e.vars.set(r.key,o.segments[0]==="true"?1:0):Z(e,`${r.key} needs a number`)}}function x0(e,t){return t?.type!=="expr"||!!t.items.map(r=>dt(e,r))[0]}function S0(e){let t={vars:new Map,random:new Ze(0),label:`Repeat ${e.name}`},r=h0(e,t),o=[];for(let[n,i]of g0(r)){if(!y0(t,r,n,i)||(b0(t,r.helpers),!x0(t,r.condition)))continue;let a=r.rows===1?`_${n}`:`_${n}_${i}`;for(let s of r.templates)o.push(hr(t,s,l=>`${l}${a}`))}return o}function oi(e){return e.flatMap(t=>t.kind==="Repeat"?S0(t):t.kind==="Template"||!t.entries.some(r=>r.type==="block")?[t]:[{...t,entries:t.entries.flatMap(r=>r.type==="block"?oi([r.block]).map(o=>({type:"block",block:o})):[r])}])}function ni(e){return e.some(t=>t.kind==="Repeat"||t.entries.some(r=>r.type==="block"&&ni([r.block])))}var kl=4,C0=1e5,Rl=new Set(["at","seed"]),k0=new Set(["x","y"]);function R0(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e.charCodeAt(r),16777619);return t>>>0}function wl(e,t){for(let r of e){if(r.kind==="Template"){if(t.has(r.name))throw new Error(`Template ${r.name}: there is another Template of this name`);if(r.entries.some(o=>o.type==="block"&&o.block.kind==="Repeat"))throw new Error(`Template ${r.name}: a Template cannot hold a Repeat, a Repeat can hold a Use`);t.set(r.name,r)}wl(r.entries.flatMap(o=>o.type==="block"?[o.block]:[]),t)}}var ii=class{made=0;take(t,r){this.made+=t,this.made>C0&&Z(r,"too many blocks")}};function w0(e,t,r,o){let n={vars:new Map,random:new Ze(0),label:`Use ${e.name}`,substitute:!0};r>kl&&Z(n,`Templates are nested more than ${kl} deep, which may be a Template that uses itself`),e.composition.length!==1&&Z(n,"a Use names one Template, as in Use oak : tree");let i=t.get(e.composition[0]);i||Z(n,`there is no Template ${e.composition[0]}`);let a=Se(e,"seed")?.[0]??0;n.random=new Ze(Math.imul(a+1,2654435761)^R0(e.name));let[s=0,l=0]=Se(e,"at")??[];n.vars.set("x",s),n.vars.set("y",l);let d=new Map(e.entries.flatMap(m=>m.type==="property"&&!Rl.has(m.property.key)?[[m.property.key,m.property.value]]:[]));for(let m of i.entries){if(m.type!=="property")continue;let{key:f,value:h}=m.property;(k0.has(f)||Rl.has(f))&&Z(n,`${f} is the name of something a Use sets, so it cannot be a parameter`);let y=ct(n,d.get(f)??h);d.delete(f),y.type==="number"||y.type==="string"?n.vars.set(f,y.value):y.type==="ident"?n.vars.set(f,y.segments[0]==="true"?1:y.segments[0]==="false"?0:y.segments.join(".")):Z(n,`${f} needs a number, a text or a name`)}let c=[...d.keys()][0];c!==void 0&&Z(n,`Template ${i.name} has no parameter ${c}`);let u=i.entries.flatMap(m=>m.type==="block"?[hr(n,m.block,f=>`${e.name}_${f}`)]:[]);return o.take(u.length,n),ai(u,t,r+1,o)}function ai(e,t,r,o){return e.flatMap(n=>n.kind==="Template"?[]:n.kind==="Use"?w0(n,t,r,o):n.entries.some(i=>i.type==="block")?[{...n,entries:n.entries.flatMap(i=>i.type==="block"?ai([i.block],t,r,o).map(a=>({type:"block",block:a})):[i])}]:[n])}function si(e){return e.some(t=>t.kind==="Template"||t.kind==="Use"||t.entries.some(r=>r.type==="block"&&si([r.block])))}function vl(e){let t=new Map;return wl(e,t),ai(e,t,0,new ii)}function li(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"&&li([r.block])}}function di(e){let t=ni(e.blocks);if(!t&&!si(e.blocks))return li(e.blocks),e;let r={...e,blocks:vl(t?oi(e.blocks):e.blocks)};return li(r.blocks),r}function C(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 w(e){return e?.type==="number"?e.value:void 0}function pe(e){return e?.type==="tuple"?e.values:void 0}function Pl(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function v0(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 Tt(e,t){if(e?.type!=="endpoint")return{};let r=v0(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 _(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 uo(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 Ll(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 U(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function Ml(e){for(let t of e.entries)if(t.type==="data")return t.data}function $t(e){let t=Ml(e);return t?[...U(e),...U(t)]:U(e)}function Tl(e,t){let r=_(e).get(t);if(r!==void 0)return r;let o=Ml(e);return o?_(o).get(t):void 0}var P0=["Entity","Shape","Text","Image","Container","Screen","Path","Chart","Widget","Component","Isometric","Dimension"],L0=new Set(P0);function At(e){return L0.has(e)}function $l(e,t){for(let r of e)At(r.kind)&&t.set(r.name,C(_(r).get("id"))??r.name),$l(U(r),t)}function mo(e){let t=new Map;return e&&$l(U(e),t),t}var M0=new Set(["id","from","to","text","order","segments"]);function po(e){let t={};for(let[r,o]of e){if(M0.has(r))continue;let n=C(o);n!==void 0&&(t[r]=n)}return t}var T0=new Set(["top","bottom","front","back","left","right"]);function Al(e){return e!==void 0&&T0.has(e)?e:"front"}function El(e,t,r,o,n=[]){let i={idByName:mo(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=o.mergedProps(a);return{id:C(l.get("id"))??a.name,fromId:Tt(l.get("from"),i).id,toId:Tt(l.get("to"),i).id,fromFace:Al(C(l.get("fromFace"))),toFace:Al(C(l.get("toFace"))),order:w(l.get("order")),sourceIndex:n[s],props:po(l)}})}function Nl(e,t,r){let o=t.mergedProps(e),n=Tt(o.get("from"),r),i=Tt(o.get("to"),r);return{id:C(o.get("id"))??e.name,fromId:n.id,toId:i.id,text:C(o.get("text")),fromSide:n.side,fromFraction:n.fraction,toSide:i.side,toFraction:i.fraction,fromPort:n.port,toPort:i.port,order:w(o.get("order")),segments:Pl(o.get("segments")),props:po(o)}}function Ol(e,t,r,o,n=[]){let i={idByName:mo(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...Nl(a,o,i),sourceIndex:n[s]}))}function $0(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(o=>o.type==="ident"?[o.segments]:[]):[]}function A0(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=$0(e,t);if(r.length<2)return[];let o=C(t.mergedProps(e).get("text"));return r.slice(1).map((n,i)=>A0(e,r[0],n,i,o))}function Il(e,t){let r=C(t.layoutProp(e,"flow")),o=w(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 fo=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function Et(e){return e!==void 0&&fo.includes(e)}function Ve(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let o=w(r);return o===void 0?[]:[o]});return t.length>0?t:void 0}function Gl(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=C(t);return r===void 0?[]:[r]})}function Be(e){let t=C(e);if(t!==void 0)return t==="true"}function ci(e){let t=e?_(e):new Map;return{min:w(t.get("min"))??0,max:w(t.get("max"))??10,step:w(t.get("step"))??1,label:C(t.get("label")),unit:C(t.get("unit")),thresholds:Ve(t.get("thresholds"))}}function Dl(e){return $t(e).filter(t=>t.kind==="Rule").map(t=>{let r=_(t);return{id:t.name,at:w(r.get("at"))??0,text:C(r.get("text")),color:C(r.get("color")),strokeWidth:w(r.get("strokeWidth")),dash:Ve(r.get("dash"))}})}function _l(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(w);return t.every(r=>r!==void 0)?t:void 0}function Fl(e){return e?.type!=="list"?[]:E0(e.values)==="tuple"?O0(e.values):N0(e.values)}function E0(e){for(let t of e){if(t.type==="number")return"scalar";if(_l(t))return"tuple"}}function N0(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function O0(e){return e.flatMap(t=>{let r=_l(t);return r?[r]:[]})}function Hl(e){if(e?.type==="list")return e.values.map(B0)}function B0(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:I0(e)}function I0(e){if(e.type!=="list"||e.values.length<2)return null;let t=w(e.values[0]),r=w(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function Vl(e){if(e?.type==="list")return e.values.map(G0)}function G0(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:C(e)??null}function Wl(e,t){if(e?.type==="list"){let n=e.values.flatMap(D0);return n.length>0?{points:n}:void 0}let r=C(e),o=r?t.get(r):void 0;if(o)return{points:o.points,normalized:!0,tension:o.tension}}function D0(e){if(e.type!=="list"||e.values.length<2)return[];let t=w(e.values[0]),r=w(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function zl(e,t,r){let o=r(e);return{id:e.name,label:C(o.get("label"))??e.name,color:C(o.get("color")),colors:Vl(o.get("colors")),opacity:w(o.get("opacity")),group:C(o.get("group")),values:Fl(o.get("values")),error:Hl(o.get("error")),source:C(o.get("source")),target:C(o.get("target")),size:w(o.get("size")),symbol:Wl(o.get("symbol"),t),stroke:C(o.get("stroke")),strokeWidth:w(o.get("strokeWidth")),dash:Ve(o.get("dash")),offset:w(o.get("offset")),labelOffsetX:w(o.get("labelOffsetX")),labelOffsetY:w(o.get("labelOffsetY"))}}function Yl(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let o=C(r.values[0]);return o===void 0?[]:[{label:o,color:C(r.values[1]),offsetX:w(r.values[2]),offsetY:w(r.values[3])}]});return t.length>0?t:void 0}var _0=["none","true","percent","waterfall"];function F0(e){return Et(e)?e:"bar"}function H0(e){return _0.find(t=>t===e)}function Ul(e,t,r,o){let n=$t(e),i=n.filter(s=>s.kind==="Axis"),a=C(t.get("stacked"));return{chartType:F0(C(t.get("type"))),categories:Gl(Tl(e,"categories")),areaOpacity:w(t.get("areaOpacity")),stacked:H0(a),scale:C(t.get("scale")),interpolate:C(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:w(t.get("idwPower")),isolines:Ve(t.get("isolines")),zones:Yl(t.get("zones")),boxWidth:w(t.get("boxWidth")),orientation:C(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:w(t.get("lineTension")),highlightPoints:Ve(t.get("highlightPoints")),barCornerRadius:w(t.get("barCornerRadius")),showBoxplotPoints:Be(t.get("showBoxplotPoints")),barBorderColor:C(t.get("barBorderColor")),barBorderWidth:w(t.get("barBorderWidth")),barGroupGap:w(t.get("barGroupGap")),barGlow:w(t.get("barGlow")),barGap:w(t.get("barGap")),mekkoVaryHeight:Be(t.get("mekkoVaryHeight")),hexRadius:w(t.get("hexRadius")),innerRadius:w(t.get("innerRadius")),pieCornerRadius:w(t.get("pieCornerRadius")),pieSliceGap:w(t.get("pieSliceGap")),ringThickness:w(t.get("ringThickness")),ringGap:w(t.get("ringGap")),cellGap:w(t.get("cellGap")),showValues:Be(t.get("showValues")),squareCells:Be(t.get("squareCells")),headerColor:C(t.get("headerColor")),tileGradient:Be(t.get("tileGradient")),showColumnBackdrop:Be(t.get("showColumnBackdrop")),labelPosition:C(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:C(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:C(t.get("labelColor")),linkGradient:Be(t.get("linkGradient")),connectPoints:Be(t.get("connectPoints")),reverseComparison:Be(t.get("reverseComparison")),axisX:ci(i.find(s=>s.name==="x")),axisY:ci(i.find(s=>s.name==="y"||s.name==="value")),series:n.filter(s=>s.kind==="Series").map(s=>zl(s,r,o)),rules:Dl(e)}}function jl(e,t,r,o,n){return{...e,objectType:"chart",chart:Ul(t,r,o,n)}}function Xl(e,t){let[r,o]=pe(e)??[];return{x:t.x+(r??0),y:t.y+(o??0)}}function ql(e,t){return{start:Xl(e.get("start"),t),end:Xl(e.get("end"),t),offset:w(e.get("offset"))??0,unit:C(e.get("unit"))}}function Kl(e,t,r){return{...e,objectType:"dimension",dimension:ql(t,r)}}function go(e,t){return Math.max(0,t.tension??e.tension)}function yo(e){return e.points.length<3||e.points.every(t=>go(e,t)<=0)}function ho(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 bo(e){let t=e.closed?e.points.length:e.points.length-1;return Array.from({length:Math.max(0,t)},(r,o)=>{let n=ho(e,o-1),i=ho(e,o),a=ho(e,o+1),s=ho(e,o+2),l=go(e,i)/6,d=go(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 V0(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 ui(e,t=8){if(yo(e))return e.points.map(i=>({x:i.x,y:i.y}));let r=[],o=bo(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(V0(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 W0(e){if(e.type!=="list"||e.values.length<2)return[];let t=w(e.values[0]),r=w(e.values[1]),o=e.values[2]===void 0?void 0:w(e.values[2]);return t===void 0||r===void 0?[]:[o===void 0?{x:t,y:r}:{x:t,y:r,tension:o}]}function Zl(e,t){let r=ui({points:e,tension:t,closed:!0});return r.length>=3?r.map(o=>[o.x,o.y]):void 0}function z0(e,t){if(e?.type==="list")return Zl(e.values.flatMap(W0),0);let r=C(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 Zl(n,o.tension??0)}function Ql(e,t,r){return{depth:t,icon:C(e.get("icon")),footprint:z0(e.get("symbol"),r),form:C(e.get("shape"))==="sphere"?"sphere":"box"}}function Jl(e,t,r,o,n){let i=pe(o(t,"size"));return{...e,objectType:"isometric",isometric:Ql(r,i?.[2]??24,n)}}function ed(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=w(n.values[0]),a=w(n.values[1]),s=n.values[2]===void 0?void 0:w(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:w(e.get("tension")),startMarker:C(e.get("startMarker")),endMarker:C(e.get("endMarker")),closed:C(e.get("closed"))==="true",value:w(e.get("value"))}}function td(e,t,r){return{...e,objectType:"path",path:ed(t,r)}}function rd(e){let t=C(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=C(i.values[0]),l=w(i.values[1]);if(s===void 0||l===void 0)return[];let d=C(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:o}}function od(e,t){return{...e,objectType:"swimlane",swimlane:rd(t)}}function Y0(e,t){return e.kind==="Screen"?"screen":e.kind==="Path"?"path":e.kind==="Chart"?"chart":mr(e.kind)?C(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Image"?"image":e.kind==="Isometric"?"isometric":e.kind==="Dimension"?"dimension":C(t.get("kind"))??""}function U0(e){return e==="frame"||e==="screen"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":st(e)?"component":e==="isometric"?"isometric":e==="dimension"?"dimension":"shape"}function nd(e,t,r){let o=Y0(e,t),n=C(t.get("shape")),i=n?r.get(n):void 0;return{objectType:mr(e.kind)?"component":U0(o),kind:o,shapeType:i?"symbol":n,symbol:i}}function id(e,t,r,o){let n=o??pe(r(e,"position"))??[0,0],i=pe(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:w(r(e,"rotation")),order:w(r(e,"order"))}}var j0=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]),X0=new Set(["crop","imageSize"]);function ad(e){let t={};for(let[r,o]of e){if(j0.has(r))continue;let n=X0.has(r)?pe(o)?.join(","):C(o);n!==void 0&&(t[r]=n)}return t}function sd(e,t,r,o,n){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=nd(e,l,s),c=id(e,t,a,n),u={id:C(l.get("id"))??e.name,kind:d.kind,text:C(l.get("text")),...c,parentFrameId:o??C(l.get("parent")),props:ad(l)};switch(d.objectType){case"chart":return jl(u,e,l,s,i);case"isometric":return Jl(u,e,l,a,s);case"path":return td(u,l,t);case"dimension":return Kl(u,l,t);case"swimlane":return od(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:C(l.get("type"))??"rollingNumber",value:C(l.get("value"))??"0",digits:w(l.get("digits")),duration:w(l.get("duration")),min:w(l.get("min")),max:w(l.get("max")),label:C(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function ld(e){return U(e).filter(t=>At(t.kind)).map(t=>C(_(t).get("id"))??t.name)}var mi=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=Il(t,this.#e);for(let i of U(t))o.push(...this.#l(i,r,n));return o}#l(t,r,o){let n=this.#s++;if(t.kind==="Container"||t.kind==="Screen")return this.#c(t,r,o,n);if(At(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=pe(this.#e.layoutProp(t,"size"))??[0,0];return{...sd(t,r.origin,this.#e,r.frameId,o(i)),sourceIndex:n}}#m(t,r){let o=this.#e.mergedProps(t);return{id:C(o.get("id"))??t.name,name:C(o.get("text"))??t.name,color:C(o.get("color")),icon:C(o.get("icon")),canvasObjectIds:ld(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??C(o.get("parent"))}}};function dd(e,t){return new mi(t).resolve(e)}function cd(e){let t=_(e),r=C(t.get("program")),o=w(t.get("surfacePadding"));if(!r)return;let n={};for(let[i,a]of t){if(i==="program"||i==="surfacePadding")continue;let s=w(a),l=C(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 q0(e){let t=_(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=w(n.values[0]),a=w(n.values[1]);i===void 0||a===void 0||(r.push([i,a]),o.push(n.values[2]===void 0?void 0:w(n.values[2])))}return{points:r,tensions:o}}function K0(e){let t=U(e).filter(r=>r.kind==="Port").flatMap(r=>{let o=pe(_(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 ud(e){let{points:t,tensions:r}=q0(e);if(!(t.length<2))return{name:e.name,points:t,pointTensions:r.some(o=>o!==void 0)?r:void 0,tension:w(_(e).get("tension")),ports:K0(e)}}function Z0(e){return U(e).find(t=>t.kind==="Model")}function md(e){return{styles:J0(e),layouts:ey(e),symbols:ty(e),shaders:Q0(e),model:ry(e)}}function Q0(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let o=cd(r);o&&t.set(r.name,o)}return t}function J0(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function ey(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function ty(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let o=ud(r);o&&t.set(r.name,o)}return t}function ry(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=Z0(t);if(r)return r}}}function pd(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 fd(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 \u2014 "${e.name}" gets no shape, fill, or stroke from it.`});for(let n of U(e))fd(n,t,r,o)}function hd(e,t,r){let o=[];for(let n of e.blocks)fd(n,t,r,o);return o}function fi(e,t){return new pi(e,t).resolveAll()}var pi=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 _(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 gd(e){let{styles:t,layouts:r,symbols:o,shaders:n}=e,i=c=>pd(c.composition,t,r),a=fi(t,c=>i(c).styleRef),s=fi(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[m,f]of _(c))u.set(m,f);for(let[m,f]of uo(c))u.set(m,f);return u},layoutProp:(c,u)=>{let m=Ll(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 oy=new Set(["radar","radial"]),yd=new Set(["scatter","custom","hexbin"]);function bd(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=C(_(o).get("type"));n!==void 0&&!Et(n)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:o.name,message:`Unsupported chart type '${n}' \u2014 drawn as a plain series plot. Supported: ${fo.join(", ")}.`})}for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}function xd(e){let t=[],r=o=>{if(o.kind==="Chart")for(let n of $t(o).filter(i=>i.kind==="Series"))_(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 \u2014 inside data{}, a bare name is read as a Series.`});for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}function Sd(e){let t=[],r=o=>{if(o.kind==="Chart"){let n=C(_(o).get("type")),i=Et(n)?n:"bar";C(uo(o).get("gridShape"))==="circle"&&!yd.has(i)&&!oy.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:o.name,message:`gridShape: circle isn't supported on '${i}' \u2014 drawn with the standard rectangular grid instead. Supported: ${[...yd].join(", ")}.`})}for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}function Cd(e){let t=[],r=o=>{if(mr(o.kind)){let n=C(_(o).get("type"))??"rollingNumber";Zn(n)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:o.name,message:`Unsupported component type '${n}'. Supported: ${Kn().join(", ")}.`})}for(let n of U(o))r(n)};for(let o of e.blocks)r(o);return t}var ny=new Set(["Shape","Text","Image","Container","Screen","Chart","Path","Widget","Component","Entity","Isometric","Group"]),iy=new Set(["Link","Connection"]);function kd(e){let t=new Map,r=n=>{let i=ny.has(n.kind)?"object":iy.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 U(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}var ay=["device","screen","screenColor","at"];function Rd(e){return Number(e.version)<1.7?[]:e.blocks.filter(t=>t.kind==="Model").flatMap(t=>{let r=_(t);return ay.filter(o=>r.has(o)).map(o=>({severity:"warning",code:"model-screen-line",ownerId:t.name,message:`'${o}' on a Model is no longer used from sfl 1.7. Put the design into a Screen block.`}))})}function wd(e){let t=md(e);return{model:t.model,diagnostics:[...hd(e,t.styles,t.layouts),...bd(e),...Sd(e),...xd(e),...Cd(e),...kd(e),...Rd(e)],canvasObjectResolutionContext:gd(t)}}function vd(e){let t=wd(e),{canvasObjects:r,groups:o,linkBlocks:n,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=dd(t.model,t),l=Ol(t.model,n,r,t.canvasObjectResolutionContext,a),d=El(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 gr(e){return e.objectType==="dimension"&&e.dimension!==void 0}function yr(e){return e.objectType==="isometric"&&e.isometric!==void 0}function Pd(e){return vd(di(ei(e)))}var br=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function cy(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${br})\\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 uy(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${br})\\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 Ce(e){if(!(e==null||e===""))return cy(e)??uy(e)??e}function xo(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],o=new RegExp(`(${br})\\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 my(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 Le(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&&my(r,n[0].trim(),n[1].trim())}return r}var x=e=>e===void 0?void 0:Number(e);function py(e){try{return JSON.parse(e)}catch{return}}function Qe(e){if(e===void 0)return;let t=py(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 ke(e){let t=Ce(e);return typeof t=="string"?t:void 0}var fy=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function Re(e){return e&&fy.test(e)?e:void 0}function Me(e,t,r){return t.includes(e)?e:r}var So=["normal","bold"],Ld=["normal","bold","100","200","300","400","500","600","700","800","900"],Md=["top","bottom","left","right"],hi=["none","arrow","filled_arrow"];function Nt(e){let t=Ce(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var Td=["left","center","right"],$d=["top","middle","bottom"],Co=["solid","dashed","dotted"],ko=["straight","curved","orthogonal"];function fe(e,t){return e!==void 0&&t.includes(e)?e:void 0}var Ad=["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ed=["solid","dashed","dotted","double"],gi=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function hy(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function gy(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function yy(e){return e==="dashed"||e==="dotted"?e:"solid"}function by(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:Ce(t.color),colors:t.colors?.map(r=>r===null?null:Ce(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 xy(e){let t=hy(e.fill);return{fillColor:t?"#111418":Ce(e.fill)??"#ffffff",fillImage:t,strokeColor:ke(e.stroke)??"#475569",strokeWidth:x(e.strokeWidth)??1,cornerRadius:x(e.cornerRadius)??12,shadowStyle:Le(e.shadow)}}function Sy(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:x(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:yy(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function Cy(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:x(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:x(e.tickLength),axisFontSize:x(e.axisFontSize),axisLabelAngle:x(e.axisLabelAngle),axisLabelSpace:x(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:x(e.xLabelGap),yLabelGap:x(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 ky(e){return{textColor:e.textColor??"#0f172a",titleSize:x(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:x(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function Ry(e){return{legendColor:e.legendColor,legendGap:x(e.legendGap),showLegend:e.showLegend==="true",legendPosition:gy(e.legendPosition)}}function Nd(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,...by(e),...xy(t),...Sy(t),...Cy(t),...ky(t),...Ry(t),order:e.order,sourceIndex:e.sourceIndex}}function Od(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:Ce(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:x(t.barSegments),barSegmentGap:x(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:x(t.barGlassBlur),barGlassSaturation:x(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:x(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:x(t.barTrackHatchAngle),barTrackHatchSpacing:x(t.barTrackHatchSpacing),barTrackHatchWidth:x(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:x(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:x(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function Bd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:x(t.lineWidth),lineGlow:x(t.lineGlow),pointSize:x(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:x(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:x(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function Id(e,t){return{categories:e?.categories,pointSize:x(t.pointSize),pointOpacity:x(t.pointOpacity),pointStrokeWidth:x(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function Gd(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:x(t.boxWhiskerWidth),boxMedianWidth:x(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:x(t.boxCapSize),boxPointSize:x(t.boxPointSize),boxPointOpacity:x(t.boxPointOpacity),boxJitter:x(t.boxJitter)}}function Dd(e){return{scale:xo(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function _d(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:x(t.cellStrokeWidth),cellValueSize:x(t.cellValueSize),cellValueColor:t.cellValueColor}}function Fd(e,t){return{hexRadius:e?.hexRadius,scale:xo(e?.scale),hexGap:x(t.hexGap),hexStrokeWidth:x(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:x(t.hexMinOpacity)}}function Hd(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:x(t.mekkoColumnGap),mekkoSegmentGap:x(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:x(t.mekkoSegmentStrokeWidth),mekkoLabelSize:x(t.mekkoLabelSize),mekkoValueSize:x(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 Vd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:x(t.pieStartAngle),pieSweep:x(t.pieSweep),pieExplode:x(t.pieExplode),pieGlow:x(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:x(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:x(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function Wd(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:x(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:x(t.pieStrokeWidth),polarTrackOpacity:x(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:x(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:x(t.polarValueSize),polarNameSize:x(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 zd(e){return{radarStrokeWidth:x(e.radarStrokeWidth),radarPointSize:x(e.radarPointSize),radarTension:x(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function Yd(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...zd(t)}}function Ud(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...zd(t)}}function jd(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:x(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:x(t.ringStartAngle),ringSweep:x(t.ringSweep)}}function Xd(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:x(t.sankeyNodeWidth),sankeyNodeGap:x(t.sankeyNodeGap),sankeyLinkOpacity:x(t.sankeyLinkOpacity),sankeyLinkCurve:x(t.sankeyLinkCurve),sankeyLabelSize:x(t.sankeyLabelSize)}}function qd(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:x(t.tileStrokeWidth),tileLabelSize:x(t.tileLabelSize),tileValueSize:x(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:x(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:x(t.headerHeight)}}function Kd(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:x(t.customConnectorWidth),customConnectorOpacity:x(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:x(t.customBeforeStrokeWidth),customLabelSize:x(t.customLabelSize),customLabelColor:t.customLabelColor}}function Zd(e){let t=Nd(e),r=e.chart,o=e.props,n=r?.chartType??"bar";switch(n){case"bar":return ie(t,n,Od(r,o));case"line":return ie(t,n,Bd(r,o));case"scatter":return ie(t,n,Id(r,o));case"boxplot":return ie(t,n,Gd(r,o));case"field":return ie(t,n,Dd(r));case"heatmap":return ie(t,n,_d(r,o));case"hexbin":return ie(t,n,Fd(r,o));case"mekko":return ie(t,n,Hd(r,o));case"pie":return ie(t,n,Vd(r,o));case"polarArea":return ie(t,n,Wd(r,o));case"radar":return ie(t,n,Yd(r,o));case"radial":return ie(t,n,Ud(r,o));case"radialBar":return ie(t,n,jd(r,o));case"sankey":return ie(t,n,Xd(r,o));case"treemap":return ie(t,n,qd(r,o));case"custom":return ie(t,n,Kd(r,o))}}function ie(e,t,r){return{...e,chartType:t,config:r}}function wy(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 vy(e,t){switch(e.type){case"number":return wy(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return e.optional&&t==="none"?"none":Re(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function Py(e,t){let r={};for(let[o,n]of Object.entries(e?.properties??{}))r[o]=vy(n,t[o]);return r}function Ly(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 Qd(e){let t=Pt(e.component.type);return{id:e.id,type:e.component.type,value:t?Ly(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:Py(t,e.props)}}var My=/^[\w\s,'"-]+$/;function yi(e){return e&&My.test(e)?e:void 0}var Ty=/^(?:[1-9]00|normal|bold)$/;function $y(e){return e==="plain"||e==="flip"?e:void 0}function Ay(e){return e==="roll"||e==="fade"?e:void 0}function Ey(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function bi(e){return e&&Ty.test(e)?e:void 0}var Ny=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],Oy=["color","accent"];function By(e){let t=e.props,r={};for(let o of Ny){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of Oy){let n=Re(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:Re(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:bi(t.labelWeight),fontFamily:yi(t.labelFont)}:void 0}}var Iy=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],Gy=["color","accent","glow"],Dy={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},_y=["core","peak"];function Fy(e){let t=e.props,r={};for(let o of Iy){let n=Number(t[o]);t[o]!==void 0&&Number.isFinite(n)&&(r[o]=n)}for(let o of Gy)r[o]=Re(t[o])??Dy[o];for(let o of _y){let n=Re(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:Re(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:bi(t.labelWeight),fontFamily:yi(t.labelFont)}:void 0}}function Hy(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:Re(t.color),surface:Re(t.surface),divider:Re(t.divider),labelColor:Re(t.labelColor),fontFamily:yi(t.fontFamily),variant:$y(t.variant),motion:Ay(t.motion),fontWeight:bi(t.fontWeight),fontSize:Ey(t.fontSize)}}}var Vy={rollingNumber:Hy,tickScale:By,ruler:Fy};function Jd(e){let t=e.component.type;return st(t)?Vy[t](e):Qd(e)}function ec(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,ko)??"straight",color:Nt(t.stroke),strokeWidth:x(t.strokeWidth),strokeStyle:fe(t.strokeStyle,Co),opacity:t.opacity!==void 0?x(t.opacity):void 0}}}function tc(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:ke(t.stroke),strokeWidth:x(t.strokeWidth),textColor:ke(t.textColor),fontSize:x(t.fontSize),order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId}}function rc(e){let t=e.props,r=e.kind==="screen";return{id:e.id,title:e.text??null,x:e.x,y:e.y,width:e.width,height:e.height,fillColor:t.fill??(r?"rgba(0, 0, 0, 0)":"rgba(155, 66, 223, 0.05)"),strokeColor:t.stroke??(r?"rgba(0, 0, 0, 0)":"#9b42df"),strokeWidth:x(t.strokeWidth)??(r?0:2),cornerRadius:x(t.cornerRadius)??(r?0:12),textColor:t.textColor??"#ffffff",fontSize:x(t.fontSize)??14,fontWeight:Me(t.fontWeight,So,"bold"),fontFamily:t.fontFamily,dash:Qe(t.dash),showLabel:r?t.showLabel==="true":t.showLabel!=="false",labelPosition:Me(t.labelPosition,Md,"top"),shadow:r?t.shadow==="true":t.shadow!=="false",clip:t.clip==="true"||void 0,order:e.order,sourceIndex:e.sourceIndex}}function oc(e){let t=e.props,r=Le(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:ke(t.fill)??"#f8fafc",strokeColor:ke(t.stroke)??"#111827",strokeWidth:x(t.strokeWidth)??1,cornerRadius:x(t.cornerRadius)??(e.isometric.footprint?0:8),seams:t.seams==="false"?!1:void 0,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:x(t.labelOffsetX)??0,labelOffsetY:x(t.labelOffsetY)??0,labelBackground:ke(t.labelBackground),parentFrameId:e.parentFrameId}}function nc(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:x(t.weight),showWeight:t.showWeight!=="false",style:{pathType:fe(t.route,ko),color:Nt(t.stroke),strokeWidth:x(t.strokeWidth),strokeStyle:fe(t.strokeStyle,Co),opacity:t.opacity!==void 0?x(t.opacity):void 0,fontSize:x(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:Le(t.shadow)},startMarker:fe(t.markerStart,gi),endMarker:fe(t.markerEnd,gi),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 ic(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:Me(e.path?.startMarker,hi,"none"),endMarker:Me(e.path?.endMarker,hi,"none"),closed:e.path?.closed??!1,strokeColor:ke(t.stroke)??"#7c3aed",strokeWidth:x(t.strokeWidth)??2,dash:Qe(t.dash)??[],opacity:x(t.opacity)??1,fillColor:ke(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}var Wy=["cover","contain","fill"];function zy(e){return e||"rectangle"}function ac(e,t){let r=e?.split(",").map(Number);return r?.length===t&&r.every(Number.isFinite)?r:void 0}function Yy(e){let t=ac(e.imageSize,2),r=ac(e.crop,4);return{src:e.src,fit:Me(e.fit,Wy,"cover"),pixels:t&&t[0]>0&&t[1]>0?[t[0],t[1]]:void 0,crop:r&&r[2]>0&&r[3]>0?{x:r[0],y:r[1],width:r[2],height:r[3]}:void 0}}function sc(e,t){let r=e.props,o=e.kind==="text",n=e.kind==="image",i=o||n;return{id:e.id,type:"shape",text:e.text??null,shapeType:zy(e.shapeType??(n&&r.cornerRadius?"rounded_rectangle":void 0)),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:Ce(r.fill??(i?"none":void 0)),strokeColor:Nt(r.stroke??(i?"none":void 0)),isText:o||void 0,strokeWidth:x(r.strokeWidth),textColor:r.textColor,fontSize:x(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:Me(r.fontWeight,Ld,"normal"),letterSpacing:x(r.letterSpacing),lineHeight:x(r.lineHeight),fontFamily:r.fontFamily,textAlign:fe(r.textAlign,Td),textVerticalAlign:fe(r.verticalAlign,$d),cornerRadius:x(r.cornerRadius),shadowStyle:Le(r.shadow),dash:Qe(r.dash),strokeStyle:fe(r.strokeStyle,Ed),opacity:x(r.opacity),blur:x(r.blur),blend:fe(r.blend,Ad),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0,image:n&&r.src?Yy(r):void 0}}function lc(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:x(t.strokeWidth)??2,cornerRadius:x(t.cornerRadius)??12,dash:Qe(t.dash),shadowStyle:Le(t.shadow),textColor:t.textColor??"#6b7280",fontSize:x(t.fontSize)??22,fontWeight:Me(t.fontWeight,So,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var xi=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function dc(e){let t=xi(e.canvasObjects),r=new Map((e.shaders??[]).map(o=>[o.name,o]));return{shapes:t.filter(o=>o.objectType==="shape").map(o=>sc(o,r)),frames:t.filter(o=>o.objectType==="frame").map(rc),swimlanes:t.filter(o=>o.objectType==="swimlane").map(lc),isometricObjects:t.filter(yr).map(oc),paths:t.filter(o=>o.objectType==="path").map(ic),dimensions:t.filter(gr).map(tc),charts:t.filter(o=>o.objectType==="chart").map(Zd),components:t.filter(o=>o.objectType==="component"&&o.component!==void 0).map(Jd),links:xi(e.links).map(nc),connections:xi(e.connections).map(ec)}}var Ro=new Set(["top","front","right"]),cc=Math.PI/6,We=Math.cos(cc),ze=Math.sin(cc);function Si(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)*We,height:r+(t+o)*ze}}function Ci(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*We/2,y:e.y+(t+r)*ze/2}}function Uy(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 ki(e,t){return Uy(Ye(e)[t])}function Ye(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*We,y:r},s={x:o*We,y:o*ze},l={x:-i*We,y:i*ze},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},b={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,m,u],bottom:[f,b,h,y],front:[u,m,h,y],back:[a,c,b,f],right:[m,c,b,h],left:[a,u,y,f]}}function jy(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 wo(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 Xy=Math.PI/12;function uc(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 b=Math.min(t/Math.tan(y/2),Math.min(m,f)/2),S=b*Math.tan(y/2),R={x:c.x/m,y:c.y/m},k={x:u.x/f,y:u.y/f},N={x:s.x+R.x*b,y:s.y+R.y*b},H={x:s.x+k.x*b,y:s.y+k.y*b},G={x:R.x+k.x,y:R.y+k.y},X=Math.hypot(G.x,G.y),se=S/Math.sin(y/2),xe={x:s.x+G.x/X*se,y:s.y+G.y/X*se},at=Math.atan2(N.y-xe.y,N.x-xe.x),vt=Math.atan2(H.y-xe.y,H.x-xe.x)-at;vt-=2*Math.PI*Math.round(vt/(2*Math.PI));let Ds=Math.max(2,Math.ceil(Math.abs(vt)/Xy));for(let Xn=0;Xn<=Ds;Xn+=1){let _s=at+vt*Xn/Ds;i.push([(xe.x+S*Math.cos(_s))/r,(xe.y+S*Math.sin(_s))/o])}}return i}function Ri(e,t,r=0){let o=Math.max(0,e.width),n=Math.max(0,e.depth),i=Math.max(0,e.height),a=uc(wo(t),r,o,n),s=e.x+n*We,l=([h,y],b)=>({x:s+(h*o-y*n)*We,y:e.y+(h*o+y*n)*ze+b}),d=a.map(h=>l(h,0)),c=jy(a)>=0?1:-1,u=a.map((h,y)=>{let b=a[(y+1)%a.length],S=(b[0]-h[0])*o,R=(b[1]-h[1])*n,k=Math.hypot(S,R),N=k===0?0:R/k*c,H=k===0?0:-S/k*c;return{from:h,to:b,length:k,normalU:N,normalV:H,visible:k>0&&N+H>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 b=u[(y-1+u.length)%u.length],S=u[(y+1)%u.length],{from:R,to:k}=h;f.push({points:[l(R,0),l(k,0),l(k,i),l(R,i)],light:.72+.28*Math.max(0,Math.min(1,h.normalV/(Math.abs(h.normalU)+Math.abs(h.normalV)))),depth:(R[0]+k[0])/2+(R[1]+k[1])/2,smoothStart:m(b,h),smoothEnd:m(h,S)})}),f.sort((h,y)=>h.depth-y.depth),{top:d,sides:f}}var vo=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}},Ie=e=>{let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=t[1].length===3?[...t[1]].map(n=>n+n).join(""):t[1],o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},Ue=(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 qy(e,t,r){let o=vo(e),n=vo(t),i=o.a??1,a=n.a??1;return Ue(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 xr(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 qy(a.color,s.color,d)}}return n.color}function wi(e,t){let r=Ie(e);if(!r)return e;let[o,n,i]=r;return Ue(o*t,n*t,i*t)}function Ot(e,t){return wi(e,t)}function vi(e){return{topFill:e,frontFill:wi(e,.95),sideFill:wi(e,.88)}}var Ky=Math.PI/180;function Zy(e,t){let r=t*Ky,o=Math.cos(r),n=Math.sin(r);return{x:e.x*o-e.y*n,y:e.x*n+e.y*o}}function Qy(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function mc(e,t){let r=Qy(e),o=e.rotation?Zy(t,e.rotation):t;return{x:r.x+o.x,y:r.y+o.y}}function Pi(e,t){return mc(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function Bt(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Li(e,t){let r=Bt(e),o=Bt(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 Jy(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 eb(e,t){let r=e.symbol?.ports?.find(o=>o.name===t.port);return r?Pi({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):Bt(e)}function Mi(e,t,r){let o=tb(e,t),n=rb(o.explicit);if(n)return n;let i=pc(r,o.canvasObjectId);if(!i)return{x:0,y:0};let a=ob(i,o.explicit);return a||nb(i,pc(r,o.oppositeCanvasObjectId))}function tb(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function rb(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function ob(e,t){return t?.kind==="port"?eb(e,t):t?.kind==="side"?Jy(e,t):null}function nb(e,t){return t?Li(e,t):Bt(e)}function pc(e,t){return e.find(r=>r.id===t)}var ib=15e3;function ab(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function fc(e,t){return e?ki(e,t):{x:0,y:0}}function hc(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??ib+r}}function sb(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Ro.has(t.fromFace)?void 0:hc(e,t.fromId),Ro.has(t.toFace)?void 0:hc(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 lb(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,...sb(e.isometricObjects,r)},from:fc(t.get(r.fromId??""),r.fromFace),to:fc(t.get(r.toId??""),r.toFace),kind:"connection"}))}function gc(e){let t=ab(e);return[...e.links.map(o=>({link:o,from:Mi(o,"from",t),to:Mi(o,"to",t)})),...lb(e)]}function Ti(e){let t=Pd(e),r=dc(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:gc(r),diagnostics:t.diagnostics}}function re(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 $i={minX:0,minY:0,maxX:100,maxY:100};function le(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 A(e,t,r=0){return t?ub(db(e,t),r):le(e,r)}function db(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 cb(e).map(s=>({x:r+(s.x-r)*i-(s.y-o)*a,y:o+(s.x-r)*a+(s.y-o)*i}))}function cb(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 ub(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(yo(e))return mb(e);let t=e.points[0],r=[`M ${t.x} ${t.y}`];for(let{to:o,controls:n}of bo(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 mb(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 yc(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 bc(e,t){return e.sourceIndex??t}function v(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 O="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var xc="#94a3b8";function Sc(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=A({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:xc},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:O,fontSize:12,fontWeight:"normal",color:xc,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function Cc(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:A({x:r,y:o,width:n,height:i},a,2),x:r,y:o,width:n,height:i,rotation:a,value:ur(e.value,e.digits),digits:e.digits,duration:Math.max(0,p(e.duration,420)),label:e.label,componentStyle:Qn(e.style)}]}function kc(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:A({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(...pb(e,{x:r,y:o,width:n,height:i,rotation:a,max:s,order:1e4+t})),d}function pb(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,b=d+Math.cos(y)*s*(t.width/2),S=c-Math.sin(y)*s*(t.height/2),R={x:b-24,y:S-l,width:48,height:l*2};m.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:A(R,0,2),...R,lines:[String(Math.round(t.max*h*10)/10)],fontFamily:r.fontFamily||O,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return m}function Rc(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:A({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(...fb(e,{x:r,y:o,width:n,height:i,min:s,max:l,order:1e4+t})),c}function fb(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,b=a+(1-2*a)*y,S=o?{x:t.x+t.width*b-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-b)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${h}`,type:"text",order:t.order+.1,bounds:A(S,0,2),...S,lines:[String(Math.round((t.min+(t.max-t.min)*y)*10)/10)],fontFamily:r.fontFamily||O,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:o?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var hb="#94a3b8";function J(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 L=(e,t)=>String(e.properties[t]??""),$=(e,t)=>Number(e.properties[t]??0),F=e=>({kind:"solid",color:e}),me=(e,t)=>e.disabled?hb:t;function W(e,t){let r=Number(e.properties.animate??0),o=e.disabled?{...t,opacity:.4}:t;return r>0?{...o,transition:r}:o}function ee(e,t,r=!0){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:A(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:r?"all":"none"}}}function ae(e,t,r,o,n){return{id:`widget-${e.id}-${t}`,type:"text",order:n,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[o.text],fontFamily:O,fontSize:o.fontSize,fontWeight:"600",color:o.color,align:o.align,verticalAlign:"middle",lineHeight:1.3}}function wc(e,t){let r=J(e,t,{width:120,height:40}),o=[ee(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min($(e,"radius"),r.height/2),style:W(e,{fill:F(L(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let n={text:e.label,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"center"};o.push(ae(e,"label",r,n,r.order+.2))}return o}var gb=.22,yb=.5,bb=[[.24,.52],[.43,.72],[.78,.3]];function xb(e){let[t,...r]=bb.map(([o,n])=>`${e.x+o*e.width} ${e.y+n*e.width}`);return`M ${t} ${r.map(o=>`L ${o}`).join(" ")}`}function Sb(e,t,r){let o=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:A(r,0,2),...r,rx:r.width*gb,style:W(e,{fill:o?F(L(e,"accent")):{kind:"none"},stroke:F(o?L(e,"accent"):L(e,"stroke")),strokeWidth:1.5})}}function Cb(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:A(r,0,0),d:xb(r),style:W(e,{fill:{kind:"none"},stroke:F(L(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function kb(e,t,r,o){let n=r*yb,i={x:t.x+r+n,y:t.y,width:Math.max(0,t.width-r-n),height:t.height},a={text:o,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"left"};return ae(e,"label",i,a,t.order+.3)}function vc(e,t){let r=J(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[ee(e,r),Sb(e,r,n),...e.value===!0?[Cb(e,r,n)]:[],...e.label?[kb(e,r,o,e.label)]:[]]}var Pc=.25;function Lo(e,t){let r=Ie(e);return r&&t<1?`rgba(${r[0]}, ${r[1]}, ${r[2]}, ${Number(t.toFixed(3))})`:e}var j=e=>String(Number(e.toFixed(3))),It=(e,t)=>L(e,t)==="none",Mo=(e,t,r)=>It(e,t)?r:L(e,t)||r;function Rb(e,t){let r=Math.min(t.width,t.height)/2,o=Math.max(.5,$(e,"width")),n=Math.min(1,Math.max(0,$(e,"taper")));return{cx:t.x+t.width/2,cy:t.y+t.height/2,radius:r,length:Math.max(1,$(e,"length")*r),tail:Math.max(0,$(e,"tail")*r),gap:Math.max(0,$(e,"gap")*r),rootHalf:o/2,tipHalf:Math.max(Pc,o*n/2)}}function Lc({cx:e,cy:t,length:r,tail:o,gap:n,rootHalf:i,tipHalf:a}){let s=n>0?t-n:t,l=n>0?0:o,d=`L${j(e-a)} ${j(t-r)}`,c=`A${j(a)} ${j(a)} 0 0 1 ${j(e+a)} ${j(t-r)}`,u=`A${j(i)} ${j(i)} 0 0 1 ${j(e-i)} ${j(s+l)}`;return n>0?`M${j(e-i)} ${j(s)}${d}${c}L${j(e+i)} ${j(s)}${u}Z`:[`M${j(e-i)} ${j(s+l)}`,`L${j(e-i)} ${j(s)}`,d,c,`L${j(e+i)} ${j(s)}`,`L${j(e+i)} ${j(s+l)}`,l>0?u:`L${j(e-i)} ${j(s)}`,"Z"].join("")}function wb(e,t){let r=e.rootHalf*t.scale,o=t.taper===void 0?e.tipHalf*t.scale:r*t.taper;return{...e,length:e.length*(t.length??1),rootHalf:r,tipHalf:Math.max(Pc,o)}}function vb(e,t,r,o){let n=e.gap>0?0:e.tail,i=l=>(n+l*e.length)/(e.length+n)*100,[,a,s]=t[0];return{kind:"linear-gradient",angle:-90,stops:[...n>0?[{offset:0,color:Lo(a,s*(o?0:1-r))}]:[],...t.map(([l,d,c],u)=>({offset:i(l),color:Lo(d,o&&u===0?0:c)}))]}}function Pb(e,t,r,o){return r<=0&&o<=0&&!t.clear?F(t.color):{kind:"linear-gradient",angle:-90,stops:[{offset:0,color:Lo(t.root,t.clear?0:1-r)},...e.gap===0&&e.tail>0?[{offset:e.tail/(e.length+e.tail)*100,color:t.root}]:[],{offset:100,color:Lo(t.color,1-o)}]}}function Ai(e,t,r,o,n,i){let a=wb(r,n),s=Math.min(1,Math.max(0,$(e,"fade"))),l=Math.min(1,Math.max(0,n.tipFade??$(e,"tipFade"))),d=$(e,"glow"),c=n.blur>0,u=Math.max(a.rootHalf,a.tipHalf),m=a.gap>0?-a.gap:a.tail,f={x:a.cx-u,y:a.cy-a.length,width:u*2,height:a.length+m};return{id:`widget-${e.id}-${n.part}`,type:"path",order:t.order+i,bounds:A(f,0,0),d:Lc(a),rotation:o,rotationCenter:{x:a.cx,y:a.cy},style:W(e,{fill:n.stops?vb(a,n.stops,s,!!n.clear):Pb(a,n,s,l),stroke:{kind:"none"},...c?{blur:n.blur,opacity:n.opacity}:{},...!c&&d>0&&!It(e,"glowColor")?{shadow:{color:Mo(e,"glowColor",n.color),opacity:1,blur:d,dx:0,dy:0}}:{}})}}function Lb(e,t,r,o,n,i){let a=[{part:"hand-light",scale:4.5,length:.55,taper:.15,blur:o*3,opacity:1,color:r,root:r,stops:[[0,r,.95],[.35,r,.45],[1,r,0]]},{part:"hand-body",scale:1.6,taper:.25,blur:o,opacity:1,color:e,root:t,clear:n,stops:[[0,t,1],[.18,e,1],[.6,e,.55],[1,e,0]]},{part:"hand",scale:.55,length:.8,taper:.3,blur:o*.3,opacity:1,color:t,root:t,clear:n,stops:[[0,t,1],[.45,t,.6],[1,t,0]]}];return i?a:a.slice(1)}function Mb(e,t,r,o){let n=L(e,"color"),i=Mo(e,"root",n),a=Mo(e,"glowColor",n),s=!It(e,"glowColor"),l=It(e,"root"),d=$(e,"soft"),c=$(e,"bloom");return d>0?Lb(n,i,a,d,l,s).map((u,m)=>Ai(e,t,r,o,u,.26+m*.02)):[...c>0&&s?[Ai(e,t,r,o,{part:"hand-bloom",scale:4,blur:c,opacity:.9,color:a,root:a,tipFade:1},.26)]:[],Ai(e,t,r,o,{part:"hand",scale:1,blur:0,opacity:1,color:n,root:i,clear:l},.3)]}function Tb(e,t,r,o){let n=$(e,"hubRing");return{id:`widget-${e.id}-hub`,type:"ellipse",order:t.order+.4,bounds:A({x:r.cx-o,y:r.cy-o,width:o*2,height:o*2},0,n),cx:r.cx,cy:r.cy,rx:Math.max(.5,o-n/2),ry:Math.max(.5,o-n/2),style:W(e,{fill:It(e,"hubFill")?{kind:"none"}:F(L(e,"hubFill")),stroke:n>0?F(L(e,"color")):{kind:"none"},strokeWidth:n,...$(e,"glow")>0&&!It(e,"glowColor")?{shadow:{color:Mo(e,"glowColor",L(e,"color")),opacity:1,blur:$(e,"glow"),dx:0,dy:0}}:{}})}}var Po=8;function $b(e,t,r,o){let n={...r,rootHalf:Math.max(r.rootHalf,Po),tipHalf:Math.max(r.tipHalf,Po)},i=n.gap>0?-n.gap:n.tail,a={x:n.cx-Po,y:n.cy-n.length,width:Po*2,height:n.length+i};return[ee(e,t,!1),{id:`widget-${e.id}-pick`,type:"path",order:t.order+.5,bounds:A(a,0,0),d:Lc(n),rotation:o,rotationCenter:{x:n.cx,y:n.cy},style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}]}function Mc(e,t){let r=J(e,t,{width:200,height:200}),o=Rb(e,r),n=$(e,"max")||1,i=$(e,"start")+Number(e.value)/n*360,a=$(e,"hub");return[...$b(e,r,o,i),...Mb(e,r,o,i),...a>0?[Tb(e,r,o,a)]:[]]}var Ab=.62;function Eb(e){return e>0?String(e).split(".")[1]?.length??0:0}function Nb(e,t){let r=L(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?Number(e.value).toFixed(Eb($(e,"step"))):""}function Ob(e,t){let r=$(e,"min"),o=$(e,"max"),n=Math.min($(e,"thickness"),Math.min(t.width,t.height)/3),i=Math.max(1,Math.min(t.width,t.height)/2-n/2);return{cx:t.x+t.width/2,cy:t.y+t.height/2,radius:i,thickness:n,fraction:Math.min(1,Math.max(0,(Number(e.value)-r)/(o-r||1))),start:$(e,"start"),sweep:Math.min(360,Math.max(1,$(e,"sweep"))),circumference:2*Math.PI*i,rounded:L(e,"rounded")!=="false"}}function Tc(e,t,r,o,n,i,a,s={}){let{cx:l,cy:d,radius:c,thickness:u}=r;return{id:`widget-${e.id}-${o}`,type:"ellipse",order:t.order+n,bounds:A({x:l-c,y:d-c,width:c*2,height:c*2},0,u),cx:l,cy:d,rx:c,ry:c,rotation:-r.start,style:W(e,{fill:{kind:"none"},stroke:F(i),strokeWidth:u,dash:[Math.max(.001,a),r.circumference],lineCap:r.rounded?"round":"butt",...s})}}function $c(e,t,r,o,n,i,a){return{id:`widget-${e.id}-${r}`,type:"ellipse",order:t.order+o,bounds:A({x:n.x-i,y:n.y-i,width:i*2,height:i*2},0,0),cx:n.x,cy:n.y,rx:i,ry:i,style:W(e,{fill:F(a),stroke:{kind:"none"}})}}function Ac(e,t){let r=J(e,t,{width:96,height:96}),o=Ob(e,r),{cx:n,cy:i,radius:a,thickness:s,fraction:l,sweep:d,circumference:c}=o,u=(o.start-l*d)*Math.PI/180,m=Math.max(1,a-s/2-Math.max(2,s*.4)),f=s/2*Ab+1,h=[ee(e,r),Tc(e,r,o,"track",.1,L(e,"track"),d/360*c),Tc(e,r,o,"fill",.2,L(e,"accent"),l*d/360*c,{opacity:l>0?1:0}),$c(e,r,"face",.3,{x:n,y:i},m,L(e,"face")),$c(e,r,"dot",.4,{x:n+a*Math.cos(u),y:i-a*Math.sin(u)},f,L(e,"dot"))],y=Nb(e,l);if(y){let b={text:y,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"center"};h.push(ae(e,"value",{x:n-m,y:i-m,width:m*2,height:m*2},b,r.order+.5))}return h}function Bb(e,t){let r=L(e,"display");return r==="percent"?`${Math.round(t*100)}%`:r==="value"?String(Number(e.value)):""}function Ib(e,t,r,o){let n=Math.min($(e,"thickness"),Math.min(t.width,t.height)/2),i=Math.max(1,Math.min(t.width,t.height)/2-n/2),a=2*Math.PI*i,s=t.x+t.width/2,l=t.y+t.height/2,d=(c,u,m,f)=>({id:`widget-${e.id}-${c}`,type:"ellipse",order:t.order+u,bounds:A({x:s-i,y:l-i,width:i*2,height:i*2},0,n),cx:s,cy:l,rx:i,ry:i,rotation:-90,style:W(e,{fill:{kind:"none"},stroke:F(m),strokeWidth:n,...f})});return[d("track",.1,L(e,"track"),{}),d("fill",.2,L(e,"accent"),{dash:[Math.max(.001,r*a),a],lineCap:o?"round":"butt",opacity:r>0?1:0})]}function Gb(e,t,r,o){let n=L(e,"direction")==="vertical",i=o?(n?t.width:t.height)/2:0,a=(l,d,c,u,m)=>{let f=n?{x:t.x,y:t.y+t.height-c,width:t.width,height:c}:{x:t.x,y:t.y,width:c,height:t.height};return{id:`widget-${e.id}-${l}`,type:"rect",order:t.order+d,bounds:A(f,0,0),...f,rx:i,style:W(e,{fill:F(u),stroke:{kind:"none"},...m===void 0?{}:{opacity:m}})}},s=n?t.height:t.width;return[a("track",.1,s,L(e,"track")),a("fill",.2,Math.max(0,r*s),L(e,"accent"),r>0?1:0)]}function Ec(e,t){let r=J(e,t,{width:220,height:12}),o=$(e,"min"),n=$(e,"max"),i=Math.min(1,Math.max(0,(Number(e.value)-o)/(n-o||1))),a=L(e,"rounded")!=="false",s=[ee(e,r),...L(e,"variant")==="ring"?Ib(e,r,i,a):Gb(e,r,i,a)],l=Bb(e,i);if(l){let d={text:l,color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize"),align:"center"};s.push(ae(e,"value",r,d,r.order+.3))}return s}function Nc(e,t){let r=J(e,t,{width:300,height:40}),o=L(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($(e,"inset"),r.height/2),s=Math.min($(e,"radius"),r.height/2),l=(r.width-a*2)/n,d={y:r.y+a,height:r.height-a*2},c=[ee(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:s,style:W(e,{fill:F(L(e,"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-active`,type:"rect",order:r.order+.2,bounds:A({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:W(e,{fill:F(L(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=me(e,L(e,m===i?"activeTextColor":"textColor"));c.push(ae(e,`option-${m}`,f,{text:u,color:h,fontSize:$(e,"fontSize"),align:"center"},r.order+.3))}),c}function Ei(e,t){return e==="field"?Math.min(8,t/2):t/2}var $e=4,Oc=12,Ni=5,Gt=1.5;function Db(e){return e>0?String(e).split(".")[1]?.length??0:0}function _b(e,t){let r=L(e,"display"),o=Db($(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 Dt=(e,t,r,o,n,i,a={})=>({id:`widget-${e.id}-${r}`,type:"rect",order:t.order+o,bounds:A(n,0,0),...n,style:W(e,{fill:F(i),stroke:{kind:"none"},...a})});function Ic(e,t,r,o,n){let i=Math.round($(e,"ticks")),a=L(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)-Gt/2,width:Ni,height:Gt,rx:Gt/2}:{x:t.x+o+d*(t.width-o*2)-Gt/2,y:t.y+n,width:Gt,height:Ni,rx:Gt/2};return Dt(e,t,`tick-${l}`,.15,c,a)})}function Gc(e,t,r){return o=>r?e.y+e.height-t-o*(e.height-t*2):e.x+t+o*(e.width-t*2)}function Fb(e,t,r,o){let n=Ei("line",o?t.width:t.height),i=n*$(e,"thumbSize")/100,a=Math.min($(e,"trackHeight"),o?t.width:t.height),s=o?t.x+t.width/2:t.y+t.height/2,l=Gc(t,n,o),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 b=o?s:l(h),S=o?l(h):s;return{id:`widget-${e.id}-${f}`,type:"ellipse",order:t.order+y,bounds:A({x:b-i,y:S-i,width:i*2,height:i*2},0,0),cx:b,cy:S,rx:i,ry:i,style:W(e,{fill:F(L(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:3,dx:0,dy:1}})}};return[Dt(e,t,"track",.1,c,L(e,"track")),...Ic(e,t,o,n,o?t.width/2+a/2+5:t.height/2+a/2+5),Dt(e,t,"fill",.2,u,L(e,"accent")),...r.two?[m("thumb-start",r.from,.3)]:[],m(r.two?"thumb-end":"thumb",r.to,.31)]}function Hb(e,t,r,o,n,i){let a=Math.min(n,i)-(r.two?$e/2:0),s=Math.max(n,i)+$e/2;return o?{...e,y:r.two?a:i-$e/2,height:r.two?s-a:Math.max(0,t.y+t.height-i+$e/2),rx:r.two?0:e.rx}:{...e,x:r.two?a:t.x,width:r.two?s-a:Math.max(0,i+$e/2-t.x),rx:r.two?0:e.rx}}function Bc(e,t,r,o,n){let i=(r?t.width:t.height)*.5,a=r?{x:t.x+(t.width-i)/2,y:n-$e/2,width:i,height:$e,rx:$e/2}:{x:n-$e/2,y:t.y+(t.height-i)/2,width:$e,height:i,rx:$e/2};return Dt(e,t,o,.3,a,L(e,"accent"))}function Vb(e,t,r,o){let n={color:me(e,L(e,"textColor")),fontSize:$(e,"fontSize")},i=_b(e,r);if(o)return i?[ae(e,"value",{x:t.x,y:t.y+6,width:t.width,height:20},{...n,text:i,align:"center"},t.order+.4)]:[];let a={y:t.y,height:t.height,width:Math.max(0,t.width/2-Oc)},s=[];return e.label&&s.push(ae(e,"label",{x:t.x+Oc,...a},{...n,text:e.label,align:"left"},t.order+.4)),i&&s.push(ae(e,"value",{x:t.x+t.width/2,...a},{...n,text:i,align:"right"},t.order+.4)),s}function Wb(e,t,r,o){let n=Ei("field",o?t.width:t.height),i=Math.min($(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=Gc(t,n,o),l=r.two?s(r.from):o?t.y+t.height:t.x,d=s(r.to);return[Dt(e,t,"track",.1,a,L(e,"surface")),Dt(e,t,"fill",.2,Hb(a,t,r,o,l,d),L(e,"fill")),...r.two?[Bc(e,t,o,"handle-start",l)]:[],Bc(e,t,o,r.two?"handle-end":"handle",d),...Vb(e,t,r,o),...o?[]:Ic(e,t,!1,n,t.height-Ni-5)]}function Oi(e,t){let r=L(e,"variant")==="field",o=L(e,"direction")==="vertical",i=J(e,t,o?{width:r?56:28,height:180}:{width:220,height:r?36:28}),a=$(e,"min"),s=$(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[ee(e,i),...r?Wb(e,i,m,o):Fb(e,i,m,o)]}var zb=.12;function Dc(e,t){let r=J(e,t,{width:52,height:30}),o=e.value===!0,n=r.height*zb,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[ee(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:A(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:W(e,{fill:F(L(e,o?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:A(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:W(e,{fill:F(L(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function _c(e,t){let r=J(e,t,{width:120,height:40}),o=e.value===!0,n=[ee(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:A(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:W(e,{fill:o?F(L(e,"accent")):{kind:"none"},stroke:F(o?L(e,"accent"):L(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:me(e,L(e,o?"onTextColor":"textColor")),fontSize:$(e,"fontSize"),align:"center"};n.push(ae(e,"label",r,i,r.order+.2))}return n}var he=e=>(t,r)=>e(t,r),Yb=new Map([["rollingNumber",he(Cc)],["tickScale",he(kc)],["ruler",he(Rc)],["switch",he(Dc)],["checkbox",he(vc)],["toggleButton",he(_c)],["button",he(wc)],["slider",he(Oi)],["progress",he(Ec)],["segmented",he(Nc)],["knob",he(Ac)],["hand",he(Mc)],["range",he(Oi)]]);function Fc(e){return Yb.get(e)}function Ub(e){let t=Pt(e.type)?.role;if(!t||!Jr(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 jb(e){return e.label??(Jr(e)?e.id:String(e.value))}function Bi(e){return e.flatMap((t,r)=>{let o=Fc(t.type)??Sc,n=re(o(t,r),"widget",t.id,t.type,jb(t),t.parentFrameId),i=Ub(t),a=n.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),n})}function Ii(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 Gi(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 Sr(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 Cr(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 To(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 $o=8;function Xb(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:Gi(n,i,r,t,$o)}}case"left":{let n=e.x-t,i=e.y-o;return{x:n,y:i,width:t,height:r,path:Sr(n,i,t,r,$o)}}case"right":{let n=e.x+e.width,i=e.y-o;return{x:n,y:i,width:t,height:r,path:Cr(n,i,t,r,$o)}}default:{let n=e.x-o,i=e.y-t;return{x:n,y:i,width:r,height:t,path:Ii(n,i,r,t,$o)}}}}function Vc(e){let t=Math.max(32,e.fontSize+18),r=16,o=Math.max(120,e.title.length*e.fontSize*.62+r*2),n=Xb(e,t,o),i=le(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?Kb(e,n,r,i):qb(e,n,r,i)]}function qb(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??O,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Kb(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??O,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:n,y:i}}}var Zb={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function Qb(e,t,r){let o=e.shadow??!0,n=le({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(o?20:4)),i={...To(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=Zb[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 Wc(e,t){if(e.isVisible===!1)return[];let r=t,o=(e.showLabel??!0)&&!!e.title,n=[Qb(e,r,o)];return o&&e.title&&n.push(...Vc({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 Jb(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function Ao(e){if(!e?.enabled)return;let t=Jb(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 ex(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 zc(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:ex(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function Yc(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??O,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function tx(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{...Yc(e,t,r),bounds:A({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 rx(e,t,r){return{...Yc(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 Uc(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?tx:rx;return e.lanes.map((r,o)=>t(e,r,o))}function ox(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 nx(e){let t=0;return ox(e).map(r=>{let o={...r,offset:t};return t+=r.size,o})}function jc(e,t){return{swimlane:e,order:5e3+t,bounds:le({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:nx(e)}}function Xc(e,t){if(e.isVisible===!1)return[];let r=jc(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:{...To(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:Ao(e.shadowStyle)}},...zc(r),...Uc(r)]}function qc(e){return[...e.frames.flatMap((t,r)=>re(Wc(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>re(Xc(t,r),"swimlane",t.id))]}var kr=(e,t,r)=>({x:e.x+t.x*r,y:e.y+t.y*r});function Di(e){return Math.hypot(e.end.x-e.start.x,e.end.y-e.start.y)}function Eo(e){return e.text!==void 0?e.text:`${Math.round(Di(e)*10)/10}${e.unit?` ${e.unit}`:""}`}function _i(e){let t=Di(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=[kr(e.start,o,e.offset),kr(e.end,o,e.offset)],a=Math.abs(e.offset)<=4?[]:[e.start,e.end].map(c=>[kr(c,o,4*n),kr(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:kr(l,o,s),angle:d}}}var Zc="#475569",ix=.6,ax=e=>e.map(([t,r])=>`M ${t.x} ${t.y} L ${r.x} ${r.y}`).join(" ");function Kc(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:ax(o),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.strokeColor??Zc},strokeWidth:n,lineCap:"round"}}}function sx(e,t,r,o,n){let i=p(e.fontSize,11),a=Math.max(24,r.length*i*ix+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:O,fontSize:i,fontWeight:"normal",color:e.textColor??e.strokeColor??Zc,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:n,rotationCenter:o}}function lx(e,t){let r=_i(e),o=31e3+t,n={...Kc(e,"line",o+.1,[r.line]),markerStart:"filled_arrow",markerEnd:"filled_arrow"},i=r.extensions.length>0?[Kc(e,"extensions",o,r.extensions)]:[],a=Eo(e);return[...i,n,sx(e,o+.2,a,r.label.center,r.label.angle)]}function Qc(e){return e.flatMap((t,r)=>re(lx(t,r),"dimension",t.id,"dimension",Eo(t),t.parentFrameId))}function Fi(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Jc(e,t,r){let o=Fi(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 dx(e,t,r,o){let n=Math.max(0,Math.min(o,Fi(t,e)/2,Fi(t,r)/2));return{vertex:t,start:Jc(t,e,n),end:Jc(t,r,n)}}function ut(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)=>dx(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 cx={prop:"style.fill",propKind:"color",propSolidOnly:!0};function _t(e,t){let r=Math.max(0,p(e.strokeWidth,1)),o=p(e.rotation,0),n=Si(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:A(n,o,r+2),rotation:o,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function Rr(e,t,r,o,n){return{...e.common,id:`isometric-${e.object.id}-${t}`,order:e.order+r,d:ut([...o],0),style:n,...cx}}function Hi(e){let t=Ye(e);return[t.top[0],t.top[1],t.right[2],t.front[2],t.front[3],t.top[3]]}function Vi(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 No(e){return{...Vi(e,ut(Hi(e.object),0),0),style:{...e.common.style,fill:{kind:"none"},stroke:{kind:"none"}}}}var Wi=20,ux=12,mx=6,Oo=3,px=6.5;function fx(e){let{object:t}=e,r=Ci(t),o=r.y-ux+p(t.labelOffsetY,0);return{anchor:r,centerX:r.x+p(t.labelOffsetX,0),topY:o-Wi,bottomY:o}}function hx(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:Wi,lines:[r],fontFamily:O,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function gx(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 yx(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*px+mx*2);return{type:"rect",id:`isometric-${n.id}-label-background`,order:i+.28,x:s-c/2,y:l-Oo,width:c,height:Wi+Oo*2,rx:4,bounds:{minX:s-c/2,minY:l-Oo,maxX:s+c/2,maxY:d+Oo},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:o},stroke:{kind:"none"}}}}function Ft(e,t){let r=fx(e),o=hx(e,r,t),n=gx(e,r),i=e.object.labelBackground;return i?[n,yx(e,r,t,i),o]:[n,o]}function Bo(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,b)=>y+b.x,0)/d.length,y:d.reduce((y,b)=>y+b.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:ut(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 eu(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)*ze/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 bx(e,t,r){let{object:o,common:n}=e,i={...n.style,stroke:{kind:"none"}},a=vi(o.fill??"#f8fafc"),s=(l,d,c,u)=>Rr(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 xx(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 tu(e,t){let r=_t(e,t),o=Ye(e),n=Math.max(0,p(e.cornerRadius,8)),i=ut(Hi(e),n),a={type:"path",d:i},s=Bo(r,o.top),l=e.seams===!1?void 0:xx(r,o,a),d=Vi(r,i,n),c=bx(r,o,a),u=s?[d,...c,s,...l?[l]:[]]:[d,...c,...l?[l]:[]];return e.text?[...u,...Ft(r,e.text)]:u}function Sx(e,t,r,o){let n=Ot(o,t.light);return Rr(e,`side-${r}`,.05+r*.001,t.points,{...e.common.style,stroke:{kind:"solid",color:n},strokeWidth:.6,fill:{kind:"solid",color:n}})}function Cx(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 ru(e,t,r){let o=_t(e,t),{top:n,sides:i}=Ri(e,r,Math.max(0,p(e.cornerRadius,0))),a=e.fill??"#f8fafc",s=Bo(o,n),l=Rr(o,"top",.2,n,{...o.common.style,fill:{kind:"solid",color:a}}),d=[No(o),...s?[s]:[],...i.flatMap((c,u)=>[Sx(o,c,u,a),Cx(o,c,u)]),l];return e.text?[...d,...Ft(o,e.text)]:d}function ou(e,t){let r=_t(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:Ot(d,1.22)},{offset:.5,color:d},{offset:1,color:Ot(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=eu(r,a),h=[No(r),...f?[f]:[],u,m];return e.text?[...h,...Ft(r,e.text)]:h}function kx(e,t){if(e.form==="sphere")return ou(e,t);let r=wo(e.footprint);return r.length>0?ru(e,t,r):tu(e,t)}function nu(e){return e.flatMap((t,r)=>re(kx(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function Rx(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 iu(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=Rx(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??O,fontSize:n,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function au(e){return[...iu(e,"start",0),...iu(e,"end",1)]}function su(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??O,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}function lu(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 du=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function Ge(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 Io(e,t,r,o){if(ge(e,r,o)<=t)return e;let n=e.length;for(;n>1&&ge(`${e.slice(0,n)}\u2026`,r,o)>t;)n-=1;return`${e.slice(0,n)}\u2026`}function ge(e,t,r){return e.length*t*(r?.64:.58)}function cu(e){return{measure:(t,r)=>ge(t,e,r),spaceWidth:e*.58}}var mt=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function zi(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 Yi(e,t,r,o,n){let i=mt(e,t,n),a=mt(t,r,n),s=mt(r,o,n),l=mt(i,a,n),d=mt(a,s,n),c=mt(l,d,n);return{left:[e,i,l,c],right:[c,d,s,o]}}function Go(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:mt(i,a,l),segmentIndex:n}}o+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function Do(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 uu(e,t,r,o,n=40){let i=0,a=e;for(let s=1;s<=n;s++){let l=zi(e,t,r,o,s/n);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var Ht=40;function wx(e){let t=[0],r=e[0];for(let o=1;o<=Ht;o++){let n=zi(...e,o/Ht);t.push(t[o-1]+Math.hypot(n.x-r.x,n.y-r.y)),r=n}return t}function mu(e,t){let r=e[Ht];if(t<=0)return 0;if(t>=r)return 1;for(let o=1;o<=Ht;o++)if(e[o]>=t){let n=(t-e[o-1])/(e[o]-e[o-1]||1);return(o-1+n)/Ht}return 1}function vx(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 pu(e,t){if(e.length<8)return null;let r=Px(e),o=wx(r),n=o[Ht];if(n===0)return null;let i=n/2,a=Math.max(0,i-t.minimumVisibleStub),s=vx(r,t,a),l=mu(o,i-s),d=mu(o,i+s);return{before:Lx(r,l),after:Mx(r,d),bezier:!0}}function Px(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 Lx(e,t){return t<=.01?null:Yi(...e,t).left.flatMap(r=>[r.x,r.y])}function Mx(e,t){return t>=.99?null:Yi(...e,t).right.flatMap(r=>[r.x,r.y])}function fu(e,t){if(e.length<4)return null;let r=Do(e);if(r===0)return null;let o=Tx(e,r,t);return{before:Ax(e,o.beforeLength),after:Ex(e,o.afterLength,r),bezier:!1}}function Tx(e,t,r){let o=t/2,n=Go(e,o),i={x:e[n.segmentIndex],y:e[n.segmentIndex+1]},a={x:e[n.segmentIndex+2],y:e[n.segmentIndex+3]},s=$x(i,a,r,o);return{beforeLength:o-s,afterLength:o+s}}function $x(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 Ax(e,t){if(t<=.5)return null;let r=Go(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function Ex(e,t,r){if(t>=r-.5)return null;let o=Go(e,t);return[o.point.x,o.point.y,...e.slice(o.segmentIndex+2)]}var hu=3,Nx=10;function Ox(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 Ui(e,t){return t?uu(...Ox(e)):Do(e)}function gu(e,t,r,o){let n={halfWidth:(r+hu)/2,halfHeight:(o+hu)/2,minimumVisibleStub:Nx};return t==="curved"?pu(e,n):fu(e,n)}function ji(e,t,r,o){let n=gu(e,t,r,o);if(!n||!n.before&&!n.after)return null;let i=Ui(e,n.bezier),a=n.before?Ui(n.before,n.bezier):0,s=n.after?Ui(n.after,n.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Bx(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 Ix(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 Xi(e,t,r,o){if(t==="curved")return Bx(e);let n={x:(r.x+o.x)/2,y:(r.y+o.y)/2};return t==="orthogonal"?Ix(e,n):n}function Vt(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function Gx(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))),b=Math.max(i,Math.min(a,Math.max(u,f*s)));return h&&(y=Math.min(a,y+m*.75),b=Math.min(a,b+f*.75)),{fromDistance:y,toDistance:b}}function yu(e,t,r,o,n){let i=Vt(r),a=Vt(o),{fromDistance:s,toDistance:l}=Gx(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 bu(e,t,r,o){let{p0:n,p1:i,p2:a,p3:s}=yu(e,t,r,o,{min:35,max:90,perpendicularScale:.5});return{points:[...n,...i,...a,...s],segments:[]}}function Su(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 Cu(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 ku(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 Ru(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=xu(t.side),c=xu(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 xu(e){return e==="left"||e==="right"}function wu(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 vu(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 Pu(e,t,r){let o=e?["left","right"]:["top","bottom"];return[!o.includes(t),!o.includes(r)]}function Lu(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 S=d[1]+u,R=t[0]+m,k=c[1]+f;return[n.x,n.y,d[0],S,R,S,R,k,c[0],k,i.x,i.y]}let h=d[0]+u,y=t[1]+m,b=c[0]+f;return[n.x,n.y,h,d[1],h,y,b,y,b,c[1],i.x,i.y]}function Mu(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 _o(e,t){if(e.length<6)return e;let r=Hx(e),o=[r[0]];for(let n=1;n<r.length-1;n++){let i=Dx(r[n-1],r[n],r[n+1],t);o.push(...i?Fx(i):[r[n]])}return o.push(r[r.length-1]),o.flatMap(n=>[n.x,n.y])}function Dx(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,Tu(n)*.4,Tu(i)*.4);if(d<=0)return null;let c=$u(n),u=$u(i),m=qi(t,c,-d),f=qi(t,u,d),h=qi(m,u,d),y=Math.atan2(m.y-h.y,m.x-h.x),b=Math.atan2(f.y-h.y,f.x-h.x);return{entry:m,exit:f,center:h,radius:d,startAngle:y,angleSweep:_x(b-y)}}function qi(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function Tu(e){return Math.abs(e.x)+Math.abs(e.y)}function $u(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function _x(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function Fx(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 Hx(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Ki(e){let t=Vx(e),r=Ru(t),o=vu(t,r),n=wu(o),i=Pu(t.horizontalFirst,e.fromSide,e.toSide),a=Lu(t,r,e.segmentOffsets,i),s=Mu(a,n,i[0],i[1]);return{points:_o(a,10),segments:s}}function Vx(e){let[t,r]=Su(e.from,e.to,e.fromSide,e.toSide),o=Vt(e.fromSide),n=Vt(e.toSide),i=Cu(t,r,e.endpointEdges),[a,s]=ku(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 Eu=.5;function Nu(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:_o(n,10),segments:i}}function Zi(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<=Eu||o<=Eu})}function Ou(e,t,r,o,n){if(e.waypoints&&e.waypoints.length>0){let l=Nu(t,e.waypoints,r);if(Zi(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=Ki(a);return Zi(s.segments)?s:Ki({...a,segmentOffsets:void 0})}function Bu(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 Iu(e,t,r){let o=e.fromPoint?.kind==="side"?e.fromPoint.side:Bu(t,r),n=e.toPoint?.kind==="side"?e.toPoint.side:Bu(r,t);return{fromSide:o,toSide:n}}function Gu(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function Du(e,t,r,o){let{fromSide:n,toSide:i}=Iu(e,t,r);return o==="curved"?bu(t,r,n,i):o==="orthogonal"?Ou(e,t,r,n,i):Gu(t,r)}function Wx(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 zx(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??O,o),a=r?Ge(e.text??"",n,o,i):[];return{visible:r,fontSize:o,width:n,height:a.length*o*1.4,lines:a}}function Yx(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:Ao(n.style?.shadow)}}function _u(e,t,r){let{link:o,from:n,to:i}=e,a=o.style?.pathType??"orthogonal",{points:s,segments:l}=Du(o,n,i,a),d=p(o.style?.strokeWidth,2),c=lu(o.style?.color)||"#64748b",u=zx(o,r),m=du(d,o.style?.strokeStyle??"solid"),f=u.visible&&!m?ji(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:Xi(s,a,n,i),strokeWidth:d,bounds:Wx(s,d+14),color:c,order:2e4+t,style:Yx(e,d,c,h),label:u,hasLabelGap:!!f}}function Qi(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 Ux(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 jx(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)):Ux(e)}var Wt=e=>Math.round(e*100)/100;function Xx(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:Wt(r.start.x),ay:Wt(r.start.y),bx:Wt(r.end.x),by:Wt(r.end.y),ox:Wt(r.originalMidpoint.x),oy:Wt(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:jx(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:Qi(t,"start"),markerEnd:Qi(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:Xx(e.pathType,e.segments)}}}function Vu(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 qx(e,t,r){if(e.link.isVisible===!1)return[];let o=_u(e,t,r);return[Hu(o),...su(o),...Vu(o),...au(o)]}function Wu(e,t){return e.flatMap((r,o)=>re(qx(r,o,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function Kx(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 zu(e){return e.flatMap((t,r)=>re(Kx(t,r),"path",t.id,"path","Path"))}function wr(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var Zx=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],Fo=Math.PI/2,Qx=4*Fo,Yu=Math.PI/2,Jx=1e-9;function Ji([e,t,r],o){return[e+r*Math.cos(o),t+r*Math.sin(o)]}function Uu([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function ju(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 eS(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?Yu:Uu(r,ju(e[o-1],r,t)),a=o===e.length-1?Yu:Uu(r,ju(r,e[o+1],t));for(;a<=n;)a+=Qx;return{lobe:r,from:n,to:a}})}function tS(e,t){let r=[];for(let o=Math.floor(e/Fo)+1;o*Fo<t-Jx;o++)r.push(o*Fo);return[...r,t]}function rS({lobe:e,from:t,to:r}){let o=Ji(e,t),n=[],i=t;for(let a of tS(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Ji(e,i),d=Ji(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 oS(){let e=eS(Zx).map(rS),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 Xu=oS();function qu(e,t,r,o){let n=([a,s])=>`${e+a*r} ${t+s*o}`,i=Xu.curves.map(([a,s,l])=>`C ${n(a)} ${n(s)} ${n(l)}`);return`M ${n(Xu.start)} ${i.join(" ")} Z`}function Ku(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 Zu(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 Qu(e,t,r,o){let{body:n,centerX:i,bottom:a}=Zu(e,t,r,o);return{x:i-n,y:a-n,width:n*2,height:n}}function Ju(e,t,r,o){let{head:n,body:i,centerX:a,headCenterY:s,bottom:l}=Zu(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 nS=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,o)=>t+(o%2?` ${r}`:` L ${r}`),"")} Z`,iS=.1,aS=Math.PI/6,sS=.25,lS=.15;function em(e,t){return Math.min(e,t)/2}function tm(e,t,r,o,n){let i=(...a)=>nS(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*iS,s=r+n-a,l=o/4,d=a*aS;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)*sS;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 qu(t,r,o,n);case"cylinder":return Ku(t,r,o,n);case"person":return Ju(t,r,o,n);case"predefined_process":{let a=Math.min(o,n)*lS;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 we(e){let t=tm(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...wr(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function rm(e){return we(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function zt(e){let t=e.shape.shapeType==="pill"?em(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?p(e.shape.cornerRadius,8):0;return[{...wr(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function ea(e){return[{...wr(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function om(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return zt(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[{...wr(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 dS={cloud:we,cylinder:we,diamond:we,document:we,hexagon:we,note:we,oval:ea,circle:ea,parallelogram:we,person:rm,pill:zt,predefined_process:we,rectangle:zt,rounded_rectangle:zt,symbol:om,trapezoid:we,triangle:we};function vr(e){return(dS[e.shape.shapeType]??zt)(e)}function cS(e,t){if(e?.type==="path")return{type:"path",d:e.d};if(e?.type==="ellipse"){let{cx:r,cy:o,rx:n,ry:i}=e;return{type:"path",d:`M${r-n} ${o}A${n} ${i} 0 1 0 ${r+n} ${o}A${n} ${i} 0 1 0 ${r-n} ${o}Z`}}return{type:"rect",...t,rx:e?.type==="rect"?e.rx??0:0}}function uS(e,t,r,o){let n=o.width/t.width,i=o.height/t.height,a=e.fit==="contain"?Math.min(n,i):Math.max(n,i),[s,l]=e.fit==="fill"?[n,i]:[a,a];return{x:o.x+(o.width-t.width*s)/2-t.x*s,y:o.y+(o.height-t.height*l)/2-t.y*l,width:r[0]*s,height:r[1]*l}}var mS={cover:"slice",contain:"meet",fill:"none"};function nm(e,t,r){let o=e.shape.image;if(!o)return;o.crop&&!o.pixels&&r.push({severity:"warning",code:"image-crop-without-size",ownerId:e.shape.id,message:`The image '${e.shape.id}' has a crop but no imageSize, so it is shown uncropped. Give it the size of the file, as imageSize: width, height.`});let n={x:e.x,y:e.y,width:e.width,height:e.height},i=o.crop&&o.pixels;return{type:"image",id:`${e.id}-image`,order:e.order,bounds:e.bounds,...i?uS(o,o.crop,o.pixels,n):n,href:o.src,aspect:i?"none":mS[o.fit],rotation:e.rotation,rotationCenter:e.rotationCenter,style:{opacity:e.style.opacity,blur:e.style.blur,blend:e.style.blend,clip:cS(t,n),pointerEvents:"none"}}}var pS=new Set(["reactivePanel","ledMatrix","lightBand","silkFolds","glowCard","glassDots"]);function fS(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&&pS.has(e.shape.shader.program))return"rect"}function im(e){if(!e.shape.shader)return;let t=fS(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:A(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 hS={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},oe={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},am={rectangle:oe,rounded_rectangle:{...oe,cornerRadius:8},triangle:{...oe,rotation:0},diamond:{...oe,rotation:0},hexagon:{...oe,rotation:0},oval:{...oe,rotation:0},circle:{...oe,rotation:0},document:{...oe,rotation:0},parallelogram:{...oe,rotation:0},trapezoid:{...oe,rotation:0},cylinder:{...oe,rotation:0},note:{...oe,rotation:0},cloud:{...oe,rotation:0},predefined_process:{...oe,rotation:0},pill:oe,person:{...oe,rotation:0},symbol:{...oe,rotation:0}};function ta(e,t){let r=am[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${hS[e.shapeType]??""}, falling back to rectangle defaults.`}),am.rectangle)}function gS(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function sm(e,t){let r=ta(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:v(e.fillColor,t,e.id),stroke:v(e.strokeColor,t,e.id),strokeWidth:o,dash:gS(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 ra=/\*\*([^*]+)\*\*/g;function lm(e){return/\*\*[^*]+\*\*/.test(e)}function yS(e){let t=[],r=0;ra.lastIndex=0;let o;for(;o=ra.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=ra.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function bS(e){return e.split(`
13
+ `).map(yS)}function xS(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 SS(e,t,r,o){let n=xS(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 dm(e,t,r,o){return bS(e).flatMap(n=>SS(n,Math.max(1,t),r,o))}function cm(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,ta(o,[]).fontSize),f=o.isText?0:Math.max(8,t*2),h=o.shapeType==="person"?Qu(l,d,c,u):{x:l,y:d,width:c,height:u},y=Math.max(0,h.width-f*2),b=o.fontFamily||O,S=r?.(b,m),R={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:Ge(o.text,y,m,S),fontFamily:b,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(lm(o.text)){let{measure:k,spaceWidth:N}=S??cu(m);R.richLines=dm(o.text,y,k,N)}return R}function CS(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=vr({...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(...vr({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...vr({...a,id:`${e.id}-inner`,style:n})),i}function kS(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:A({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:sm(e,r),x:o,y:n,width:i,height:a}}}function RS(e,t,r,o){if(e.isVisible===!1)return[];let{context:n,strokeWidth:i}=kS(e,t,r),a=e.strokeStyle==="double"?CS(n,i||1):vr(n),s=im(n);if(s){for(let c of a)(c.type==="ellipse"||c.type==="path"||c.type==="rect")&&(c.style={...c.style,pointerEvents:"all"});a.push(s)}let l=nm(n,a[0],r);if(l){for(let c of a)(c.type==="ellipse"||c.type==="path"||c.type==="rect")&&(c.style={...c.style,pointerEvents:"all"});a.push(l)}if(e.isText)for(let c of a)(c.type==="ellipse"||c.type==="path"||c.type==="rect")&&(c.style={...c.style,pointerEvents:"all"});let d=cm(n,i,o);return d&&a.push(d),a}function um(e,t,r){return e.flatMap((o,n)=>re(RS(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",Pr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],oa=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function z(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 Lr(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 Mr(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?xr(n,e):K}function ve(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var Pe={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function na(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function ia(e,t,r){let o=r?Pe.padX:0,n=r?Pe.padY:0,i=t*Pe.lineHeight;return{width:e.length*t*Pe.charWidth+o*2,height:i+n*2,lineHeight:i,padX:o,padY:n}}function aa(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 Ho(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 De(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 pt(e,t,r,o,n,i){return i?De(e,t,r,o,n):Ho(e,t,r,o,n)}function sa(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 la(e){if(!e?.length)return null;let t=[...e].sort((r,o)=>r-o);return{min:t[0],q1:sa(t,.25),median:sa(t,.5),q3:sa(t,.75),max:t[t.length-1]}}function Tr(e){return e?.startsWith("#")?Ie(e)??void 0:void 0}function da(e,t){let r=Tr(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 Wo(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 ca(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 mm(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 wS(e,t){let r=Math.max(e,t),o=Math.min(e,t);return(r+.05)/(o+.05)}var Vo=.35,pm=.08,fm=.22,hm=.78,gm=.92,vS=3;function de(e){let t=Tr(e);if(!t)return"#0f172a";let[r,o,n]=t,i=(.299*r+.587*o+.114*n)/255>.6?"#0f172a":"#ffffff",[a,s,l]=Wo(r,o,n);if(s===0)return i;let d=l>.5?Math.max(pm,Math.min(l-Vo,fm)):Math.min(gm,Math.max(l+Vo,hm)),c=ca(a,s,d);return wS(mm(r,o,n),mm(...c))>=vS?Ue(...c):i}function Yt(e,t){let r=Tr(e);if(!r)return t;let[o,n,i]=r,[a,s,l]=Wo(o,n,i);if(s===0)return t;let d=l>.5?Math.max(pm,Math.min(l-Vo,fm)):Math.min(gm,Math.max(l+Vo,hm));return Ue(...ca(a,s,d))}function zo(e){let t=Tr(e);return t?Wo(...t)[2]>.5:!1}function Je(e,t){let r=Tr(e);if(!r)return;let[o,n]=Wo(...r);if(n!==0)return Ue(...ca(o,n,t))}function I(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function $r(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function Ar(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:PS(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 PS(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 Uo=18,Yo=e=>e.config;function ne(e){return e.chartType==="bar"&&Yo(e)?.orientation==="horizontal"}function Ut(e,t){let r=ve({series:e.series,config:Yo(e)}),o=t.height/r,n=Math.min(Math.max(0,p(Yo(e)?.barGroupGap,8)),Math.max(0,o-1)),i=e.categoryAlign==="left"?Uo:0,a=Math.max(1,o-n-i),s=p(Yo(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 jt(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 jo=e=>e*Math.PI/180;function ua(e){return Math.max(9,p(e.axisFontSize??e.fontSize,12))}function Er(e,t,r){let o=ua(e),n=Math.max(0,...t.map(i=>ge(i,o,!1)));return Math.ceil(n*Math.sin(jo(r))+(o+2)*Math.cos(jo(r)))}function ma(e,t,r,o){let n=ua(e),i=n+2,a=Math.ceil(ge(t,n,!1))+4,s=jo(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 Xt(e,t,r,o){let n=ua(e),i=n+2,a=Math.ceil(ge(t,n,!1))+4,s=jo(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 qt(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 Xo(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 Nr(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 Zt(e,t){return Math.abs(t-e)>Math.PI?1:0}function ft(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function ym(e,t){return{start:e.start+t,end:e.end-t}}function ht(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 LS(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 ${Zt(t.start,t.end)} 1 ${n.x} ${n.y}`,"Z"].join(" ")}function MS(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 ${Zt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${Zt(o.start,o.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var bm=.82;function Kt(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 Or(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*bm),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 Br(e,t,r){let o=Math.min(Math.abs(r)/2,Math.PI/2),n=Math.sin(o*bm),i=e*n/(1+n),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function TS(e,t,r,o){let{outerRadius:n}=e,i=n-r,a=Kt(e,n,i,t.start,r,1),s=Kt(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 ${Zt(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 $S(e,t,r,o,n){let{outerRadius:i}=e,a=i-n,s=Kt(e,i,a,r.start,n,1),l=Kt(e,i,a,r.end,n,-1),d=t+n,c=Kt(e,t,d,o.start,n,1),u=Kt(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 ${Zt(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 ${Zt(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 Qt(e,t,r){let o=Math.max(0,r)/2,n=ht(o,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=n}function gt(e,t,r=0,o=0){let n=Math.max(0,o)/2,i=ym(t,ft(n,e.outerRadius));if(!Qt(e,t,o)){let s=ht(n,t.end-t.start,e.outerRadius),l=Q(e,(t.start+t.end)/2,s);return r>0?TS(e,i,r,l):LS(e,i,l)}let a=ym(t,ft(n,e.innerRadius));return r>0?$S(e,e.innerRadius,i,a,r):MS(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?De(e.x+y,e.y,h,e.height,n):De(e.x,e.y+e.height-y-h,e.width,h,n))}return m.join(" ")}function D(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 Ir(e,t,r,o,n){let i=e.series[o].values[r]??0;return t==="waterfall"?AS(e,r,o,n,i):t==="percent"?ES(e,r,o,n,i):NS(e,r,o,n,i)}function AS(e,t,r,o,n){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return xm(n,i,i+n,e,o)}function ES(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 NS(e,t,r,o,n){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return xm(n,i,i+n,e,o)}function xm(e,t,r,o,n){return{value:e,pixelStart:T(t,o.axisY,n),pixelEnd:T(r,o.axisY,n)}}function P(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??O,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 OS=/^[A-Za-z_][A-Za-z0-9_]*$/;function Jt(e,t,r){return OS.test(t)?`${e}[${t}].${r}`:void 0}var Sm="text";function pa(e){return`Axis[${e}].label`}function Gr(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function Ee(e){return Jt("Series",e,"label")}function Cm(e){return Jt("Series",e,"color")}function ce(e,t){return Number.isInteger(t)&&t>=0?Jt("Series",e,`values[${t}]`):void 0}function er(e,t){return Number.isInteger(t)&&t>=0?Jt("Series",e,`colors[${t}]`):void 0}function km(e){return Jt("Rule",e,"text")}function Rm(e){return Jt("Rule",e,"at")}function BS(e,t,r){return e.axisX.label?{...P({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:pa("x")}:null}function IS(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...P({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:pa("y")}}function wm(e,t,r){let o=[],n=BS(e,t,r);n&&o.push(n);let i=IS(e,t,r+o.length);return i&&o.push(i),o}function vm(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{...P({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 GS=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function Pm(e){return DS(e.chart)?WS(e).flatMap(t=>zS(e,t)):[]}function DS(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!GS.has(e.chartType)&&!t}function fa(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var ha=22,qo=16;function ga(e){return e==="bottomLeft"||e==="bottomRight"}function ya(e){return fa(e).map(t=>Math.max(42,t.label.length*p(e.fontSize,12)*.58+22))}function Lm(e){let t=ya(e);return t.length?Math.max(...t):0}function _S(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function FS(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function HS(e){let{chart:t,plot:r,order:o}=e,n=fa(t),i=ya(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-qo-a:r.x+r.width+qo,l=r.y+r.height-15;return n.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(n.length-1-c)*ha,width:i[c],order:o+(n.length-1-c)*2}))}function VS(e){let{chart:t,plot:r,order:o}=e,n=fa(t),i=ya(t),a=i.reduce((d,c)=>d+c,0),s=FS(t,r),l=_S(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 WS(e){return ga(e.chart.legendPosition)?HS(e):VS(e)}function zS(e,t){return[YS(e,t),US(e,t)]}function YS(e,t){let{chart:r,bounds:o,diagnostics:n}=e,i=E[t.seriesIndex%E.length],a=r.chartType==="line",s=a?I(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:Cm(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:v(s,n,r.id)}}}function US(e,t){let{chart:r,bounds:o}=e;return{...P({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 Mm=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),jS=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Xe(e){return!jS.has(e.chartType)}function Tm(e){return Xe(e)?Math.max(0,p(e.tickLength,0)):0}function et(e){return Tm(e)+(Xe(e)?Math.max(0,p(e.xLabelGap,0)):0)}function xa(e){return Tm(e)+(Xe(e)?Math.max(0,p(e.yLabelGap,0)):0)}function ba(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function XS(e){let t=p(e.fontSize,12);return Math.max(0,...e.series.map(o=>(o.label||o.id).length))*t*.58+16}var $m=66;function qS(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function KS(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 ZS(e){return e.axisLabelSpace&&e.axisLabelSpace>0&&(ba(e)||ne(e))?e.axisLabelSpace:ba(e)?XS(e):ne(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:KS(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function QS(e){let t=_e(e);if(t<=0)return 0;let r=e.chartType==="bar"&&!ne(e)?e.config?.categories??[]:e.chartType==="boxplot"&&!ba(e)?e.series.map(o=>o.label||o.id):[];return r.length>0?Math.max(0,Er(e,r,t)-18):0}function JS(e){let t=e.showLegend!==!1,r=e.legendPosition??"top",o=t&&e.series.length>0,n=o&&ga(r);return{showLegend:t,position:r,atTop:r==="top",hasItems:o,stacked:n,sideColumnWidth:n?Lm(e)+qo:0,treemapSide:qS(e,t)}}function eC(e,t,r){return xa(e)+(t?ZS(e):12)+(r.position==="bottomLeft"?r.sideColumnWidth:0)+(r.treemapSide==="left"?$m:0)}function tC(e){return 24+(e.position==="bottomRight"?e.sideColumnWidth:0)+(e.treemapSide==="right"?$m:0)}function rC(e,t,r){let o=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",n=ne(e)&&e.showValueAxis!==!1,i=t?ne(e)?n?34:12:(e.axisX.label?52:34)+(o?18:0):12,a=e.chartType==="field"&&r.showLegend&&!!e.config?.scale?.stops.length,s=r.hasItems&&!r.atTop&&!r.stacked;return et(e)+i+(t?QS(e):0)+(a?44:0)+(s?16+ha:0)}function oC(e,t){return(e.title?Math.max(44,20+p(e.titleSize,14)*1.6):0)||(t.atTop&&t.hasItems?44:24)}function Am(e){let t=e.showAxisLabels!==!1,r=JS(e),o=eC(e,t,r),n=tC(r),i=rC(e,t,r),a=oC(e,r);return{bounds:le({x:e.x,y:e.y,width:e.width,height:e.height},p(e.strokeWidth,1)+2),plot:{x:e.x+o,y:e.y+a,width:Math.max(1,e.width-o-n),height:Math.max(1,e.height-a-i)},showLabels:t,showLegend:r.showLegend,padLeft:o}}function nC(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,o)=>String(o+1))}function Em(e,t,r){let o=ve(e),n=t.plot.width/o,i=nC(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}=Xt(e,f,s,{x:m,y:t.plot.y+t.plot.height+4+et(e)});return{...P({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?Gr(u):void 0}}return{...P({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?Gr(u):void 0}})}function Nm(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}=Xt(e,d,i,{x:l,y:t.plot.y+t.plot.height+4+et(e)});return{...P({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{...P({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 Om(e,t,r){return z(e.axisX).map((o,n)=>{let i=t.plot.x+T(o,e.axisX,t.plot.width);return P({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 Bm(e,t,r){return z(e.axisY).map((o,n)=>{let i=t.plot.y+t.plot.height-T(o,e.axisY,t.plot.height);return P({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-xa(e),height:18},text:String(o),chart:e,align:"right"})})}function Sa(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function iC(e,t,r){return e.chartType==="bar"?Em(e,t,r):e.chartType==="boxplot"&&!Sa(e)?Nm(e,t,r):Om(e,t,r)}function aC(e,t,r){return Sa(e)?vm(e,t,r):e.showValueAxis===!1?[]:Bm(e,t,r)}function sC(e,t){let{plot:r}=t;if(e.chartType==="bar"){let o=ve(e);return Array.from({length:o},(n,i)=>r.x+(i+.5)*r.width/o)}return z(e.axisX).map(o=>r.x+T(o,e.axisX,r.width))}function lC(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function dC(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",...lC(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&&ne(e)){z(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=Ut(e,i);for(let m=0;m<u.count;m++){let f=jt(u,i,m)+u.labelRow+u.barsHeight/2;c(`tick-c-${m}`,`M ${i.x-n} ${f} L ${i.x} ${f}`)}}return n>0&&!Sa(e)&&!ne(e)&&(z(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}`)}),sC(e,t).forEach((u,m)=>{c(`tick-x-${m}`,`M ${u} ${s} L ${u} ${s+n}`)})),d}function cC(e,t){let r=e.config?.categories;return Array.from({length:t},(o,n)=>r?.[n]??String(n+1))}function uC(e,t,r){let{plot:o,bounds:n}=t,i=Ut(e,o),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=cC(e,i.count).map((c,u)=>{let m=jt(i,o,u);return{...P({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?Gr(u):void 0}});return e.showValueAxis!==!1&&z(e.axisY).forEach((c,u)=>{let m=o.x+T(c,e.axisY,o.width);d.push(P({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 Im(e,t,r){if(!Xe(e))return[];let o=dC(e,t,r);if(!t.showLabels)return o;if(r+=o.length,ne(e))return[...o,...uC(e,t,r)];let n=iC(e,t,r),i=aC(e,t,r+n.length),a=wm(e,t,r+n.length+i.length);return[...o,...n,...i,...a]}function Gm(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 Dr(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function Dm(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?Gm(e,u,d,o):0}}return{grid:s,cols:i,rows:a}}var _m=new Set(["scatter","custom","hexbin"]);var Fm=-Math.PI/2,mC=.5,pC=6;function fC(e){return Math.max(38,e*3.2)}function Ko(e,t,r,o=!0){let n=o?fC(r):pC;return Math.max(8,Math.min(e,t)/2-n)}function Zo(e,t){return Math.max(3,e||t)}function hC(e,t){return Fm+t*Math.PI*2/e}function ka(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=hC(e.count,t);return{x:e.centerX+Math.cos(o)*r,y:e.centerY+Math.sin(o)*r}}function Vm(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 Qo(e,t,r=mC){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 _r(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function Wm(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 gC(e,r,o,n,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,..._r(e,s)},d=[];return z(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*zm(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})}),z(e.axisX).forEach(c=>{let u=ka(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 gC(e,t,r,o,n,i,a){let s=z(e.axisY).filter(c=>c>e.axisY.min),l=z(e.axisX),d=[];return s.forEach(c=>{let u=i*zm(e,c);l.forEach(m=>{let f=ka(e.axisX.min,e.axisX.max,m),h=o+Math.cos(f)*u,y=n+Math.sin(f)*u,b=`chart-grid-dot-${e.id}-${m}-${c}`;d.push(Jo(e,b,r+d.length,t,h,y,a,void 0))})}),d}function zm(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 en(e,t,r,o){if(e.showGrid===!1||!Xe(e))return[];if(e.gridShape==="circle"&&_m.has(e.chartType))return Wm(e,t,r,o);let n=p(e.gridWidth,1);if(ne(e))return yC(e,t,r,o,n);let i=e.chartType==="field"?Dr(e,t):void 0;if(e.gridLineStyle==="dotted")return bC(e,t,r,o,n,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:n,..._r(e,n),clip:i},s=[];return(e.gridAxes==="y"?[]:z(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"?[]:z(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 yC(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"}:_r(e,n)};return z(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 bC(e,t,r,o,n,i){let a=z(e.axisX),s=z(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 Ym(e){return e.chart.rules?.length?xC(e).flatMap(t=>SC(e,t)):[]}function xC(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 SC(e,t){let r=[CC(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(kC(e,t)),r}function CC(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:Rm(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 kC(e,t){let r=Math.max(9,p(e.chart.fontSize,12)-2);return{...P({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:km(t.rule.id)}}function Ra(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 Um(e,t,r){if(!e.fillImage)return[];let o=Ra(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 tr(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=Ra(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(...en(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 rr(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:v(o,s,a.id),shadow:{color:I(o,"#ffffff"),opacity:.9,blur:n,dx:0,dy:0},pointerEvents:"none"}}}function or(e){return e.chart.config?.showBarLabels===!0}function RC(e,t){let r=e.frame.height>=t.height+Pe.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function wC(e,t,r){return e==="outside"?t.y-r-Pe.gap:e==="inside"?t.y+Pe.gap:t.y+t.height/2-r/2}function vC(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:aa(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?v(l.barLabelPillColor,a,n.id):{kind:"none"},stroke:v(l?.barLabelBorderColor??o,a,n.id),strokeWidth:p(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function PC(e,t,r,o,n,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...P({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 LC(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{...P({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-Uo,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 MC(e,t){let r=e.placement==="axis"?"outside":e.placement,o=e.frame.width>=t.width+Pe.gap*2;return r!=="outside"&&!o?"outside":r}function TC(e,t,r){let{frame:o}=e,n=r==="outside"?o.x+o.width+Pe.gap:r==="inside"?o.x+o.width-t.width-Pe.gap:o.x+o.width/2-t.width/2;return{...t,left:n,top:o.y+o.height/2-t.height/2}}function nr(e,t){let{chart:r}=e,o=r.config,n=Math.max(8,p(o?.barLabelFontSize,p(r.fontSize,12))),i=na(t.value,o?.barLabelFormat);if(t.placement==="axis")return[LC(e,t,i,n)];let a=o?.barLabelPill===!0,s=ia(i,n,a),l=t.horizontal?MC(t,s):RC(t,s),d=t.horizontal?TC(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:wC(l,t.frame,s.height)},c=o?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(vC(e,t.id,d,c)),u.push(PC(e,t.id,d,i,l,n,c)),u}var wa={angle:45,spacing:7,width:1.5},$C=2;function AC(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 ir(e,t){if(yt(e))return{type:"path",d:De(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function yt(e){return e.chart.config?.barTrack===!0}function ar(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):De(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:v(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:AC(r.x,r.y,r.width,r.height,p(l.barTrackHatchAngle,wa.angle),Math.max($C,p(l.barTrackHatchSpacing,wa.spacing))),style:{fill:{kind:"none"},stroke:v(l.barTrackHatchColor??n.gridColor??"#cbd5e1",a,n.id),strokeWidth:p(l.barTrackHatchWidth,wa.width),pointerEvents:"none",clip:{type:"path",d:u}}}),m}function jm(e){let t=BC(e),r=e.chart.series.flatMap((a,s)=>IC(e,t,a,s)),o=yt(e)?r.flatMap(a=>ar(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=>GC(e,a)),i=or(e)?r.flatMap(a=>NC(e,a,r)):[];return[...o,...n,...r.flatMap(a=>OC(e,a)),...i]}function EC(e,t){let r=t.filter(o=>o.seriesId===e.seriesId).map(o=>o.value);return e.value>=Math.max(...r)}function NC(e,t,r){let{chart:o}=e;return o.config?.barLabelMaxOnly&&!EC(t,r)?[]:nr(e,{id:`chart-bar-label-${o.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:o.config?.barLabelPosition??"outside"})}function Xm(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):pt(t.x,t.y,t.width,t.height,i,n?.barRoundedBottom===!0)}function OC(e,t){let{chart:r}=e,o=p(r.config?.barGlow,0);if(o<=0||t.frame.height<=0)return[];let n=Xm(e,t.frame);return[rr(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,n,t.color,o)]}function BC(e){let{chart:t,plot:r}=e,o=ve(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 IC(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 GC(e,t){let r=_C(e,t),o=FC(e,t);return o&&r.push(o),r}function DC(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 _C(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=Xm(e,t.frame),u=v(t.color,i,r.id),m=v(r.config?.barBorderColor||"#000000",i,r.id),f=p(r.config?.barBorderWidth,0),h=D(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:ir(e,{x:l,y:o.y,width:d,height:o.height})??{type:"path",d:DC(o)}}}:void 0,b={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:er(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:ce(t.seriesId,t.valueIndex),style:{fill:u,stroke:m,strokeWidth:f,innerShadow:h}},S=tr(e,`${t.seriesId}-${t.valueIndex}`,c);return y?[y,...S,b]:[...S,b]}function FC(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=$r(t.value,t.error);return Ar({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 HC(e,t,r,o,n){let{chart:i,plot:a}=e,s=jt(t,a,o)+t.labelRow;if(e.stackedMode){let u=Ir(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 VC(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):De(t.x,t.y,t.width,t.height,n?.barCornerRadius??2)}function WC(e,t,r,o,n,i){let{plot:a}=e,s=HC(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:VC(e,s),color:r.colors?.[n]??r.color??E[o%E.length]}}function zC(e,t){let{chart:r,diagnostics:o,nextOrder:n}=e,i=r.config,a=v(i?.barBorderColor||"#000000",o,r.id),s=p(i?.barBorderWidth,0),l=D(r.shadowStyle),d=v(t.color,o,r.id),c=[...tr(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:ir(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:er(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function YC(e,t,r){let{chart:o}=e,n=o.config,i=or(e)&&(!n?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===o.series.length-1;return!i||e.stackedMode&&!a&&n?.barLabelPosition==="outside"?[]:nr(e,{id:`chart-bar-label-${o.id}-${t.id}`,value:t.value,frame:t.frame,placement:n?.barLabelPosition??"outside",horizontal:!0})}function UC(e,t,r,o,n,i,a,s){let{chart:l}=e,d=WC(e,t,o,n,i,a);yt(e)&&(!e.stackedMode||n===0)&&r.tracks.push(...ar(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...zC(e,d));let c=p(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(rr(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...YC(e,d,s))}function qm(e){let t=Ut(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)=>{UC(e,t,r,o,n,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function jC(e,t){let{chart:r,plot:o}=e,n=o.width/ve(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 XC(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):pt(t,r,n.barWidth,o,i,a.config?.barRoundedBottom===!0)}function qC(e,t,r,o,n,i,a){let{chart:s}=e,l=s.config;if(!(or(e)&&!(l?.barLabelMaxOnly&&!JC(r.values,n))&&(l?.barLabelPosition!=="axis"||o===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[n];t.labels.push(...nr(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 KC(e,t,r,o,n,i){let{chart:a,plot:s}=e,l=Ir(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:XC(e,c,u,m,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function ZC(e,t){let{chart:r,plot:o,bounds:n,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=v(t.color,i,r.id),u=v(r.config?.barBorderColor||"#000000",i,r.id),m=p(r.config?.barBorderWidth,0),f=D(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:ir(e,t.column)??{type:"path",d:y}}})}return h.push(...tr(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:er(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:ce(s.id,l),style:{fill:c,stroke:u,strokeWidth:m,innerShadow:f}}),h}function QC(e,t,r,o,n,i,a){let{chart:s}=e,l=KC(e,t,o,n,i,a);i===0&&yt(e)&&r.tracks.push(...ar(e,String(a),l.column)),r.bars.push(...ZC(e,l));let d={x:l.x,y:l.y,width:o.barWidth,height:l.height};qC(e,r,n,i,a,o,d);let c=p(s.config?.barGlow,0);c>0&&r.glows.push(rr(e,`chart-bar-glow-${s.id}-${n.id}-${a}`,l.path,l.color,c))}function Km(e,t){let{chart:r}=e,o={tracks:[],bars:[],glows:[],labels:[]},n=jC(e,t),i=ve(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{QC(e,t,o,n,s,l,a)});return[...o.tracks,...o.bars,...o.glows,...o.labels]}function JC(e,t){let r=e.map(o=>typeof o=="number"?o:o[1]);return r[t]>=Math.max(...r)}function Zm(e){return ne(e.chart)?qm(e):e.stackedMode?Km(e,e.stackedMode):jm(e)}function Qm(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=I(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 ye(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function Jm(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 ep(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+ek(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:m,y:f}=ye(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:v(r.color,a,o.id),opacity:t.pointOpacity}}})}function ek(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function rp(e,t,r){let o=t.whiskerWidth>0?[rk(t,r),ok(t,r)]:[],n=t.whiskerWidth>0&&t.capSize>0?[nk(t,r),ik(t,r)]:[],i=t.medianWidth>0?[ak(t,r)]:[];return[...[...o,...n].map(a=>tp(e,t,{...a,color:tk(t,r)})),sk(e,t,r),...i.map(a=>tp(e,t,a))]}function tk(e,t){return e.whiskerColor==="series"?I(t.color,e.borderColor):e.whiskerColor}function rk(e,t){let{center:r,min:o,q1:n}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ye(e.orientation,r,o),to:ye(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function ok(e,t){let{center:r,q3:o,max:n}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ye(e.orientation,r,o),to:ye(e.orientation,r,n),strokeWidth:e.whiskerWidth}}function nk(e,t){return op(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function ik(e,t){return op(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function op(e,t,r,o){let n=t.boxWidth*t.capSize/2;return{id:e,from:ye(t.orientation,r-n,o),to:ye(t.orientation,r+n,o),strokeWidth:t.whiskerWidth}}function ak(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ye(e.orientation,t.geometry.center-r,t.geometry.median),to:ye(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function tp(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 sk(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ye(t.orientation,s.center-l,s.q1),c=ye(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:v(r.color,i,o.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function np(e,t,r,o){let n=la(r.values);if(!n)return[];let i=Jm(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=rp(e,t,s);return t.showPoints&&l.push(...ep(e,t,s)),l}function ip(e){let t=Qm(e),r=[];return e.chart.series.forEach((o,n)=>{r.push(...np(e,t,o,n))}),r}var lk="#94a3b8",ap=8,va=140;function lp(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?mk(e):e.chart.series.flatMap((t,r)=>dk(e,t,r))}function dk(e,t,r){let o=ck(e,t,r);return Pa(e,t).map((n,i)=>{let a=La(e,n),s={series:t,valueIndex:i,point:a,style:o};return t.symbol?.points.length?uk(e,s):Ma(e,s)})}function Ta(e){return e.config?.orientation==="horizontal"}function Pa(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(n=>[n[0],n[1]]):Ta(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 sp(e,t){return Ta(e)?t[0]:t[1]}function La(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 ck(e,t,r){let o=t.color??E[r%E.length];return{fill:v(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 uk(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:dp(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 Ma(e,t){let r=p(t.series.size,3);return{type:"ellipse",id:dp(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 dp(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function mk(e){let{chart:t}=e,[r,o]=t.series,n=Pa(e,r),i=Pa(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],b=i[h],S=La(e,y),R=La(e,b),k=sp(t,y),N=sp(t,b),H=c?N<k:N>k,G=c?N>k:N<k,X=H?s:G?l:d,se=p(o.size,3);f.push(fk(e,h,S,R,X)),f.push(Ma(e,{series:r,valueIndex:h,point:S,style:{fill:v(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??lk},strokeWidth:p(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(Ma(e,{series:o,valueIndex:h,point:R,style:{fill:v(X,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&m[h]&&f.push(hk(e,h,S,R,se,m[h]))}return f}function pk(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function fk(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:pk(i.config?.customConnectorDash)}}}function hk(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,d=Ta(a),c=d?{x:Math.max(r.x,o.x)+n+ap,y:Math.min(r.y,o.y)-8,width:va,height:16}:{x:Math.min(r.x,o.x)-va/2,y:Math.min(r.y,o.y)-n-ap-14,width:va,height:16};return{...P({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 up(e){let{chart:t,plot:r}=e,o=t.series.filter(a=>cp(a.values[0])===3),n=t.series.filter(a=>cp(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 cp(e){return Array.isArray(e)?e.length:void 0}function mp(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=gk(e);return[yk(e,r,o,n,i),...bk(e,o,n,i)]}function gk(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 yk(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 bk(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=o.y+o.height+3;return[P({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}),P({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 xk="#94a3b8";function tn(e,t){return e?.stops.length?xr(e.stops,t):xk}function pp(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 fp(e,t){let r=[];for(let o=0;o<e.rows-1;o++)for(let n=0;n<e.columns-1;n++){let i=Sk(e,o,n),a=Ck(i,t);a!==0&&a!==15&&r.push(...kk(i,a,t))}return r}function Sk(e,t,r){return{topLeft:rn(e,t,r),topRight:rn(e,t,r+1),bottomRight:rn(e,t+1,r+1),bottomLeft:rn(e,t+1,r)}}function rn(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 Ck(e,t){return(on(e.topLeft,t)?8:0)|(on(e.topRight,t)?4:0)|(on(e.bottomRight,t)?2:0)|(on(e.bottomLeft,t)?1:0)}function on(e,t){return e.value>=t}function kk(e,t,r){let o=Rk(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 Rk(e,t){return{top:nn(e.topLeft,e.topRight,t),right:nn(e.topRight,e.bottomRight,t),bottom:nn(e.bottomLeft,e.bottomRight,t),left:nn(e.topLeft,e.bottomLeft,t)}}function nn(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 wk=.5;function hp(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=vk(e,t);return[...Pk(e,r),...Mk(e,r)]}function vk(e,t){let{plot:r,chart:o}=e,n=Dm(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 Pk(e,t){let r=[];for(let o=0;o<t.rows;o++)for(let n=0;n<t.columns;n++)r.push(Lk(e,t,o,n));return r}function Lk(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=tn(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:Dr(n,i)}}}function Mk(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((o,n)=>{let i=Tk(e,t,o,n);i&&r.push(i)}),r}function Tk(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e,l=fp({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=pp(l).map(u=>qt(u.map(([m,f])=>({x:i.x+m,y:i.y+f})),wk)).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:Dr(n,i)}}}function gp(e,t){let r=[];return t.forEach((o,n)=>{let i=o.color??E[n%E.length];o.values.forEach((a,s)=>{r.push($k(e,o.id,a,s,i))})}),r}function $k(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),b=a.x+T(c+Math.cos(m)*f,i.axisX,a.width),S=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 ${b} ${S}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:v(n,l,i.id),strokeWidth:2}}}function yp(e){let t=up(e),r=[];return r.push(...hp(e,t.scalarSamples)),r.push(...gp(e,t.vectorSeries)),r.push(...mp(e)),r}function bp(e,t){let r=[];return t.rows.forEach((o,n)=>{r.push(...Ak(e,t,o,n))}),r}function Ak(e,t,r,o){return t.columns.flatMap((n,i)=>{let a=Ek(t,r,o,i);return Ok(e,t,a)})}function Ek(e,t,r,o){let n=t.values[o]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:o,value:n,color:Nk(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 Nk(e,t){return Mr(e,t.bands,t.zones)}function Ok(e,t,r){let o=Bk(e,t,r);return e.chart.config?.showValues===!1?[o]:[o,Ik(e,t,r)]}function Bk(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 Ik(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=Math.max(6,p(o.config?.cellValueSize,t.fontSize));return{...P({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??de(r.color)}}function xp(e){let{chart:t}=e,r=Cp(e),o=Gk(e),n=Fk(e,o);return{rows:t.series,columns:r,bands:Lr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Pr,fontSize:Math.max(9,p(t.fontSize,12)),headerFontSize:$a(t),legendGap:Sp(t),sides:o,reservedSpace:n,grid:Vk(e,n,o,r.length)}}var $a=e=>Math.max(9,p(e.axisFontSize??e.fontSize,12)),Aa=e=>Math.min(120,Math.max(0,p(e.yLabelGap,6))),an=e=>Math.min(120,Math.max(0,p(e.xLabelGap,4))),Sp=e=>Math.min(80,Math.max(0,p(e.legendGap,6)));function Gk(e){let{chart:t}=e;return{rows:t.rowLabelSide==="right"?"right":"left",columns:t.columnLabelSide==="bottom"?"bottom":"top",legend:t.legendSide??"bottom"}}function Cp(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}var Dk=32,_k=56;function Fk(e,t){let{chart:r}=e,o=$a(r),n=r.series.reduce((a,s)=>Math.max(a,ge(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+Aa(r)):0,columnHeaders:e.showLabels?Hk(e):0,legend:e.showLegend?(i?_k:Dk)+Sp(r):0}}function Hk(e){let{chart:t}=e,r=_e(t);return r>0?Math.min(e.plot.height*.4,Er(t,Cp(e),r)+an(t)+4):$a(t)+2+an(t)+6}function Vk(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,b=c;if(n.config?.squareCells&&o&&u){let S=Math.min(f,h);f=S,h=S,y=S*o,b=S*u}return{x:e.plot.x+i,y:e.plot.y+s,width:y,height:b,cellWidth:f,cellHeight:h,cellGap:m,cellRadius:Math.max(0,p(n.config?.barCornerRadius,m))}}function kp(e,t){return[...Wk(e,t),...Yk(e,t)]}function Wk(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,o)=>zk(e,t,r,o))}function zk(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,s=t.reservedSpace.rowHeaders,l=Aa(n),d=t.sides.rows==="left"?t.grid.x-s:t.grid.x+t.grid.width+l;return P({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 Yk(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,o)=>Uk(e,t,r,o))}function Uk(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=an(n),u=`chart-heatmap-col-${n.id}-${o}`;if(d>0){let{frame:m,rotation:f}=s?ma(n,r,d,{x:l,y:t.grid.y-c}):Xt(n,r,d,{x:l,y:t.grid.y+t.grid.height+c});return P({id:u,order:a(),bounds:i,frame:m,text:r,chart:n,align:s?"left":"right",rotation:f,role:"axis"})}return P({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 sr=10,tt=4,sn=2,Fr=48;function jk(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-sr,width:t.width,height:sr,vertical:!1,numbers:"top"}}case"left":return{x:t.x-(r.rows==="left"?i:0)-n-sr,y:t.y,width:sr,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:sr,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:sr,vertical:!1,numbers:"bottom"}}}}function Rp(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=jk(t),o=le({x:r.x,y:r.y,width:r.width,height:r.height});return[Xk(e,t,r,o),...qk(e,t,r)]}function wp(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function Xk(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:wp(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 qk(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=wp(t,l),u=r.vertical?r.y+r.height-c*r.height:r.x+c*r.width,m=Kk(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=P({id:`chart-heatmap-legend-tick-label-${o.id}-${d}`,order:i(),bounds:n,...Zk(r,u,d===0,d===s,a),text:Ae(l),chart:o});return[f,h]})}function Kk(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 Zk(e,t,r,o,n){if(e.vertical){let s=e.numbers==="right";return{frame:{x:s?e.x+e.width+tt+sn:e.x-tt-sn-Fr,y:t-n/2,width:Fr,height:n},align:s?"left":"right"}}let i=e.numbers==="bottom"?e.y+e.height+tt+sn:e.y-tt-sn-n;return{frame:{x:r?t:o?t-Fr:t-Fr/2,y:i,width:Fr,height:n},align:r?"left":o?"right":"center"}}function vp(e){let t=xp(e),r=[];return r.push(...bp(e,t)),r.push(...kp(e,t)),r.push(...Rp(e,t)),r}function Ea(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 Pp(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 Lp(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 Mp(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 Jk(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 eR(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 Hr(e,t,r,o=18){return t<=1?0:e*(r-o)/(t-1)}function Tp(e,t,r,o=8){let n=Lp(e.ids,t),i=Jk(e),a=eR(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 $p(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:Hr(t.columns.get(s.source)??0,t.columnCount,r,n)+n+(d?.x??0),x1:Hr(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 Ap(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:Hr(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 tR(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 Oa(e,t,r,o,n={nodeWidth:18,nodeGap:8}){let i=Mp(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=Pp(i),s=Tp(i,a,o,n.nodeGap),l=tR(e);return{nodes:Ap(e,i,s,r,l,n.nodeWidth),links:$p(i,s,r,l,n.nodeWidth)}}function Vr(e,t){let r=rR(e,t);if(!r.length)return[];let o=[],n=r,i=t;for(;n.length;){let a=oR(n,Math.min(i.width,i.height)),s=nR(a,i);o.push(...s.rectangles),n=n.slice(a.items.length),i=s.remainingBounds}return o}function rR(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 oR(e,t){let r=[e[0]];for(let o=1;o<e.length;o++){let n=[...r,e[o]];if(Ep(n,t)>Ep(r,t))break;r.push(e[o])}return{items:r,area:r.reduce((o,n)=>o+n.area,0)}}function Ep(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 nR(e,t){return t.width>=t.height?iR(e,t):aR(e,t)}function iR(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 aR(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 sR=.15,lR=1/Math.sqrt(3);function dR(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 Np(e){let{chart:t,plot:r,bounds:o,diagnostics:n,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??oa),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*lR),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??sR)),m=D(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 R=(h.values.length>0&&Array.isArray(h.values[0])?h.values:h.values.map((X,se)=>[t.axisX.min+se*t.axisX.step,X])).map(([X,se])=>({x:T(X,t.axisX,r.width),y:r.height-T(se,t.axisY,r.height)})),k=Ea(R,l),N=Math.max(1,...k.map(X=>X.count)),H=h.color??E[y%E.length],G=s?.scale;k.forEach((X,se)=>{let xe=X.count/N,at=G?tn(G,xe):H;a.push({type:"path",id:`chart-hexbin-${t.id}-${h.id}-${se}`,order:i(),bounds:o,d:dR(r.x+X.cx,r.y+X.cy,d),style:{fill:v(at,n,t.id),stroke:c>0?v(s?.hexStrokeColor??at,n,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:G?void 0:Math.max(u,xe),shadow:m,clip:f?{type:"path",d:f}:void 0}})})}),a}function bt(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 xt(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 Op(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=`${qt(r,n)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(S=>S.y)),h=(Math.min(...r.map(S=>S.x))+Math.max(...r.map(S=>S.x)))/2,y=(d-f)/2,b={minX:h-y,maxX:h+y,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:b,d:m,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:da(o,i)},{offset:100,color:da(o,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function cR(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function uR(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:v(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function mR(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:v(t.color,n,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function pR(e,t,r){let{chart:o,bounds:n,nextOrder:i}=e,a=o.config,s=Math.max(9,o.fontSize??12),l=cR(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...P({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 Bp(e,t,r){let{chart:o}=e,n=o.config,i=n?.highlightPoints;if(!i?.length)return[];let a=bt(o,t),s=xt(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(uR(e,m)),l.push(mR(e,m)),n?.highlightLabels&&l.push(pR(e,m,a[c][1]))}return l}function Ip(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 Gp(e,t){return t.flatMap(r=>fR(e,r))}function fR(e,t){let r=[],o=hR(e,t);return o&&r.push(o),r.push(gR(e,t)),r}function hR(e,t){if(t.error==null)return null;let{chart:r,plot:o,bounds:n,nextOrder:i}=e,[a,s]=$r(t.value,t.error);return Ar({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 gR(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?v(c,n,r.id):{kind:"none"},stroke:d&&l>0?v(t.color,n,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function Dp(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:qt(r,n),style:{fill:{kind:"none"},stroke:v(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}:D(i.shadowStyle)}}}function _p(e,t){return I(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=_p(t,r),i=e.chart.config?.lineTension??0,a=xt(e,bt(e.chart,t));return a.length>1?[Op(e,t,a,n,i,o)]:[]}function Hp(e,t,r){let o=_p(t,r),n=e.chart.config?.lineTension??0,i=bt(e.chart,t),a=xt(e,i),s=[];a.length&&s.push(Dp(e,t,a,o,n));let l=Ip(t,i,a,o);return s.push(...Gp(e,l)),s.push(...Bp(e,t,o)),s}function Vp(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 Wp=[0,25,50,75,100];function zp(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...yR(e,t)),e.showLabels&&r.push(...bR(e,t)),r}function yR(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return Wp.map(i=>{let a=Yp(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 bR(e,t){let{chart:r,plot:o,bounds:n,nextOrder:i}=e;return Wp.map(a=>({...P({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:n,frame:{x:o.x,y:Yp(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function Yp(e,t){return e.grid.y+e.grid.height*(1-t/100)}function Up(e,t,r,o){if(!e.showLabels)return[];let n=SR(e,t,r,o);return e.chart.config?.showMekkoTotals===!1?[n]:[xR(e,t,r,o),n]}function xR(e,t,r,o){let{chart:n,plot:i,bounds:a,nextOrder:s}=e;return{...P({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 SR(e,t,r,o){let{chart:n,bounds:i,nextOrder:a}=e,{label:s,width:l}=o;return{...P({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:Ge(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function jp(e){let t=CR(e),r=e.showLabels?30:0,o=kR(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:RR(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 CR(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,o)=>String(o+1))??[]}function kR(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 RR(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 wR=.15;function Xp(e,t,r){let n=e.chart.config?.showColumnBackdrop!==!1?[vR(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=PR(e.chart.series,t,r),s=a.flatMap((l,d)=>LR(e,t,l,i?a[d+1]?.color:void 0));return[...n,...s]}function vR(e,t,r){let{chart:o,bounds:n,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=qp(e);return{type:"path",id:`chart-mekko-column-backdrop-${o.id}-${r}`,order:a(),bounds:n,d:Ho(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:v(o.gridColor??"#e2e8f0",i,o.id),opacity:wR}}}function qp(e){return Math.max(0,p(e.chart.config?.barCornerRadius,2))}function PR(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 LR(e,t,r,o){return[MR(e,r,o),...TR(e,t,r)]}function MR(e,t,r){let{chart:o,plot:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=D(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?qp(e):0,{x:m,y:f,width:h,height:y}=t.frame,b=Math.max(0,p(c?.mekkoSegmentGap,0)),S="#94a3b8",R={minX:m+h/2-y/2,maxX:m+h/2+y/2,minY:f,maxY:f+y},k=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:I(t.color,S)},{offset:100,color:I(r,S)}]}:v(t.color,a,o.id);return{type:"path",id:`chart-mekko-seg-${o.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?R:i,d:pt(m,f+b/2,h,Math.max(0,y-b),u,!!c?.mekkoRoundAll),style:{fill:k,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 TR(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=Ge(r.seriesLabel,c,t.labelSize).map(N=>Io(N,c,t.labelSize,!0));if(h.length*m+f>u)return[];let y=o.config?.mekkoTextColor??de(I(r.color,"#ffffff")),b=t.columns[r.columnIndex]?.total??0,S=o.config?.mekkoValueFormat==="percent"?`${b>0?Math.round(r.value/b*100):0}%`:String(r.value),R={...P({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},k={...P({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:S,chart:o}),lines:[S],fontSize:t.valueSize,color:y};return[R,k]}function Kp(e){let t=jp(e),r=zp(e,t);return t.columns.forEach((o,n)=>{r.push(...Xp(e,t,n)),r.push(...Up(e,t,n,o))}),r}function $R(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 Zp(e,t){let{chart:r,bounds:o,nextOrder:n}=e,i=r.config?.pieCenterText;if(!i)return[];let a=$R(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??O,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 Qp(e){let{chart:t,plot:r}=e,o=Xo(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 AR=14*Math.PI/180,Wr=80,ER=.62,NR=14,OR=3,BR=.32,Jp="#334155";function rf(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(o=>o.end-o.start>=AR).flatMap(o=>IR(e,t,o))}function ef(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"?Wr*1.9:Wr,h={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??O,fontSize:n,align:"center",verticalAlign:"middle",lineHeight:1.2,color:o},y=R=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...R}),b={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)},S={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:ce(t.seriesId,0),propKind:"value"};return m==="inline"||m==="name"?[b]:m==="percent"?[S]:[b,S]}function tf(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 IR(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+OR),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 N=m?GR(Q(n,i,n.outerRadius),r.labelOffsetX,r.labelOffsetY):Q(n,i,n.outerRadius+NR+(f==="outside"?Math.abs(Math.cos(i))*(o?.pieLabelContent==="inline"?Wr*.95:Wr/2):0)),H=Nr(d,N,Wr/2,l),G=o?.pieLabelColor??Je(I(r.color,Jp),BR)??Jp;return[tf(e,r,d,H,G,!0),...ef(e,r,N,G,a,s,!0,i)]}let y=n.innerRadius+c*ER,b=Q(n,i,y),S=I(r.color,"#0f172a"),R=o?.pieLabelColor??Yt(S,de(S));return[tf(e,r,d,d,R,!1),...ef(e,r,b,R,a,s,!1,i)]}function GR(e,t,r){return{x:e.x+t,y:e.y+r}}var DR=-Math.PI/2,Ia=Math.PI*2,_R=Ia*(359.999/360),Ba=e=>e*Math.PI/180;function of(e,t){let r=e.chart.config,o=HR(e.chart.series,t.total,{start:DR+Ba(p(r?.pieStartAngle,0)),sweep:Math.min(Ia,Math.max(Ba(1),Ba(p(r?.pieSweep,360)))),explode:Math.max(0,p(r?.pieExplode,0))}),n=r?.pieSliceGap??0;return[...o.flatMap(i=>UR(e,FR(t,i),i,n)),...rf(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:nf(i)})))]}function nf(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function FR(e,t){if(t.explode===0)return e;let{dx:r,dy:o}=nf(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+o}}function HR(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>=Ia?_R: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 VR(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){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 zR(e,t,r){let o=Math.max(0,r)/2,n=t.angles.end-t.angles.start,i=Qt(e,t.angles,r),a=2*ft(o,e.outerRadius),s=Math.max(0,n-a);return Math.min(e.cornerRadius,i?Or(e.outerRadius,e.innerRadius,s):Br(e.outerRadius,ht(o,n,e.outerRadius),s))}function YR(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 UR(e,t,r,o){let{chart:n,bounds:i,diagnostics:a,nextOrder:s}=e,l=v(r.color,a,n.id),d=gt(t,r.angles,zR(t,r,o),o),c=D(n.shadowStyle),u=YR(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:WR(c,o),clip:{type:"path",d:VR(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:ce(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:m?{color:I(r.color,"#ffffff"),opacity:.85,blur:m,dx:0,dy:0}:void 0}};return f?[f,h]:[h]}function af(e){let t=Qp(e);return[...of(e,t),...Zp(e,t)]}var jR=-Math.PI/2,XR="#e2e8f0",qR=14*Math.PI/180,ln=80,KR=.62,ZR=14,QR=3,JR=.32,sf="#334155";function ew(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:jR+p(t.config?.pieStartAngle,0)*Math.PI/180}}function lf(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*ft(d,t));if(Qt(l,r,s))return Math.min(a,Or(t,i,u));let m=ht(d,c,t);return Math.min(a,Br(t,m,u))}function tw(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,b=v(a,d,s.id),S=D(s.shadowStyle),R=gt({centerX:u,centerY:m,outerRadius:h,innerRadius:f},o,lf(t,h,o),y),k={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:R,style:{fill:v(s.gridColor??XR,d,s.id),opacity:s.config?.polarTrackOpacity,...rw(e)}},N=gt({centerX:u,centerY:m,outerRadius:n,innerRadius:f},o,lf(t,n,o),y),H=S?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:N,style:{fill:b,shadow:S,clip:{type:"path",d:R}}}:void 0,G={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:N,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:o.start,pieEnd:o.end,pieValue:i},prop:ce(r.id,0),style:{fill:b,innerShadow:S,...ow(e)}};return H?[k,H,G]:[k,G]}function rw(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 ow(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:p(t.pieStrokeWidth,1)}:{}}function nw(e,t){let{chart:r,bounds:o,nextOrder:n}=e;return!r.config?.polarRings||t.range<=0?[]:z(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 df(e){let t=ew(e),{centerX:r,centerY:o,innerRadius:n,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=qR;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)),b=s>0?Math.min(1,Math.max(0,(y-a)/s)):0,S=Math.max(n+1,n+(i-n)*b),R=m.color??E[f%E.length],k=tw(e,t,m,h,S,y,R);if(!c)return k;let N={centerX:r,centerY:o,outerRadius:S,innerRadius:n};return[...k,...lw(e,N,h,m,y,R)]}),...nw(e,t)]}function Ga(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 iw(e,t,r,o,n){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=Ga(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>=ln,b=e.chart.config?.polarOutsideLabels??!1;if(!y&&!m&&!b)return;let S=m||!y,R=Q(t,i,t.outerRadius+QR),k=S?m?dw(Q(t,i,t.outerRadius),c,u):Q(t,i,t.outerRadius+ZR):Q(t,i,t.innerRadius+d*KR),N=S?b&&e.chart.textColor?e.chart.textColor:Je(I(n,sf),JR)??sf:Yt(I(n,"#0f172a"),de(I(n,"#0f172a")));return{point:k,color:N,outside:S,mid:i,tickStart:R}}function aw(e,t,r,o){let{point:n,color:i,outside:a,tickStart:s}=r,l=a?Nr(s,n,ln/2,o):s;return{type:"path",id:`chart-polar-area-label-tick-${e.chart.id}-${t.id}`,order:e.nextOrder(),bounds:e.bounds,d:`M ${s.x} ${s.y} L ${l.x} ${l.y}`,detail:{of:"chartSeries",series:t.id,mark:"polar-area-label-tick"},style:a?{stroke:{kind:"solid",color:i},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function sw(e,t,r,o,n){let{chart:i,bounds:a,nextOrder:s}=e,{point:l,color:d,outside:c,mid:u}=n,{nameSize:m,valueSize:f}=Ga(i),h={of:"chartSeries",series:r.id,mark:"polar-area-label",pulled:c||void 0,midAngle:u,wedgeRadius:t.outerRadius},y={bounds:a,x:l.x-ln/2,width:ln,fontFamily:i.fontFamily??O,align:"center",verticalAlign:"middle",lineHeight:1.2,color:d},b=i.config?.polarValueFirst??!1,S=m*1.2,R=f*1.2,k=l.y-(S+R)/2,N=b?k+R:k,H=b?k:k+S,G={type:"text",id:`chart-polar-area-label-name-${i.id}-${r.id}`,order:s(),...y,y:N,height:m*1.2,fontSize:m,lines:[r.label],fontWeight:b?"normal":"bold",detail:h,prop:Ee(r.id)},X={type:"text",id:`chart-polar-area-label-value-${i.id}-${r.id}`,order:s(),...y,y:H,height:f*1.2,fontSize:f,lines:[Ae(o)],fontWeight:b?"bold":"normal",detail:h,prop:ce(r.id,0),propKind:"value"};return[G,X]}function lw(e,t,r,o,n,i){let a=iw(e,t,r,o,i);if(!a)return[];let{nameSize:s,valueSize:l}=Ga(e.chart);return[aw(e,o,a,Math.max(s,l)*1.2),...sw(e,t,o,n,a)]}function dw(e,t,r){return{x:e.x+t,y:e.y+r}}var cw=["Speed","Quality","Cost","Reliability","Usability"];function uw(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:Ko(r.width,r.height,p(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Zo(o,n),curved:t.chartType==="radial",tension:t.config?.radarTension}}function cf(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],o=uw(e),n=mw(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=>Vm(o,a),pointAt:i,polygonPath:a=>Qo(n.map((s,l)=>i(a,l)),!1)}}function mw(e,t){return Array.from({length:t},(r,o)=>e[o]??cw[o]??`Category ${o+1}`)}function uf(e,t){return e.chart.showGrid===!1?[]:[...pw(e,t),...t.showSpokes?hw(e,t):[]]}function pw(e,t){return z(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>fw(e,t,r))}function fw(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 hw(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 mf(e,t){return e.showLabels?t.categories.map((r,o)=>gw(e,t,r,o)):[]}function gw(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 P({id:`chart-radar-label-${n.id}-${o}`,order:s(),bounds:a,frame:{x:yw(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:n,align:bw(d)})}function yw(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function bw(e){return e>8?"left":e<-8?"right":"center"}function pf(e,t){let r=[];return e.chart.series.forEach((o,n)=>{r.push(...xw(e,t,o,n))}),r}function xw(e,t,r,o){let n=r.color??E[o%E.length],i=Sw(r,e,t),a=Qo(i,t.circular,t.tension);return[Cw(e,t,r,a,n),...t.strokeWidth>0?[kw(e,t,r,a,n)]:[],...t.pointSize>0?Rw(e,t,r,i,n):[]]}function Sw(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 Cw(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:v(n,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function kw(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:v(n,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:D(i.shadowStyle)}}}function Rw(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:ce(r.id,c),style:{fill:v(n,s,i.id)}}))}function Da(e){let t=cf(e),r=[];return r.push(...uf(e,t)),r.push(...mf(e,t)),r.push(...pf(e,t)),r}var ww=-Math.PI/2,vw=14,Pw=4,Lw=.18,_a=1e-4;function lr(e,t,r,o){return{x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function ff(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 Mw(e,t,r,o){return`${ff(e,t,r)} ${ff(e,t,Math.max(0,o))}`}function hf(e,t,r,o,n){let i=lr(e,t,r,o),a=lr(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 Tw(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 $w(e,t,r,o,n){if(o>=Math.PI*2-_a){let l=lr(e,t,r,n),d=lr(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=lr(e,t,r,n),a=lr(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 Aw(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,vw)),ringGap:Math.max(0,p(t.config?.ringGap,Pw)),axisMin:o,range:p(t.axisY.max,100)-o,start:ww+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,Lw))),cap:t.config?.ringCap??"round"}}function Ew(e,t,r,o,n,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:m}=t,f=D(a.shadowStyle),h=n>=Math.PI*2-_a;if(!f||h)return[];let y=Tw(f,u),b=Math.min(n,u/o);return[[m,m+b],[m+n-b,m+n]].map(([S,R],k)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${k}`,order:l(),bounds:s,d:hf(d,c,o,S,R),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:y,clip:{type:"path",d:Mw(d,c,o+u/2,o-u/2)}}}))}function Nw(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:b,trackOpacity:S,cap:R}=t,k=c-o*(u+m)-u/2;if(k<=u/2)return[];let N=v(r.color??E[o%E.length],a,n.id),H=Math.max(0,p(r.values[0],0)),G=h>0?Math.min(1,Math.max(0,(H-f)/h)):0,X={fill:{kind:"none"},stroke:N,strokeWidth:u,opacity:S},se=b>=Math.PI*2-_a?{type:"ellipse",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:k,ry:k,style:X}:{type:"path",id:`chart-radial-bar-track-${n.id}-${r.id}`,order:s(),bounds:i,d:hf(l,d,k,y,y+b),style:{...X,lineCap:R}};if(G<=0)return[se];let xe=G*b,at=Ew(e,t,r,k,xe,N),vt={type:"path",id:`chart-radial-bar-ring-${n.id}-${r.id}`,order:s(),bounds:i,d:$w(l,d,k,xe,y),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:ce(r.id,0),style:{fill:{kind:"none"},stroke:N,strokeWidth:u,lineCap:R}};return[se,...at,vt]}function gf(e){let t=Aw(e);return e.chart.series.flatMap((r,o)=>Nw(e,t,r,o))}function yf(e,t){let r=D(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=Ow(e,t,a,s,o);return Bw(e,l,r,i,o)})}function Ow(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 Bw(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:Iw(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 Iw(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 Gw=.3,Dw=.78;function bf(e,t){let r=Math.max(0,p(e.chart.config?.barCornerRadius,0)),o=[];return t.nodes.forEach(n=>{o.push(_w(e,t,n,r));let i=e.showLabels?Fw(e,t,n):void 0;i&&o.push(i)}),o}function _w(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:D(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:Sr(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:Cr(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 Fw(e,t,r){let{chart:o}=e,n=o.config?.labelPosition??"outside",i=n==="inside"?Vw(e,t,r,o.config?.labelOrientation??"horizontal"):Hw(e,t,r);if(!i)return;let a=o.textColor??"#0f172a",s=n==="inside"?de(r.color):Je(r.color,zo(a)?Dw:Gw)??a,l=o.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function Hw(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{...P({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 Vw(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 ge(r.label,u,!1)>h?void 0:{...P({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{...P({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 xf(e){let{chart:t,plot:r,showLabels:o}=e,n=o?92:0,i=Math.max(1,r.width-n*2),a=Oa(Ww(e),zw(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 Ww(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function zw(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?I(r.color,K):void 0})}),t}function Sf(e){let t=xf(e),r=[];return r.push(...yf(e,t)),r.push(...bf(e,t)),r}var Yw=4;function Cf(e){let t=[],r=D(e.chart.shadowStyle);return e.chart.series.forEach((o,n)=>{let i=o.color??E[n%E.length];xt(e,bt(e.chart,o)).forEach((s,l)=>{t.push(Uw(e,o,s,l,i,r))})}),t}function Uw(e,t,r,o,n,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??Yw,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:v(n,l,a.id),stroke:m>0?v(c?.pointStrokeColor??n,l,a.id):void 0,strokeWidth:m>0?m:void 0,opacity:c?.pointOpacity,shadow:i}}}function kf(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:Lr(t.axisY),zones:t.config?.zones?.length?t.config.zones:Pr,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 zr(e){return e.values[0]??0}function Fa(e,t){return e.color??Mr(zr(e),t.bands,t.zones)}var qe=10,dn=4,Ha=2,Va=16,Yr=34;function Rf(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?jw(e,t):Xw(e,t)}function Wa(e,t){let r=e.bands[0],o=e.bands[e.bands.length-1];return o===r?0:(t-r)/(o-r)}function wf(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((o,n)=>({offset:Wa(e,e.bands[n+1]??e.bands[e.bands.length-1])*100,color:o.color??K}))}function jw(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+Va,c=le({x:a,y:d,width:s,height:qe}),u=wf(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 b=a+Wa(t,h)*s,S={type:"path",id:`chart-treemap-legend-tick-${r.id}-${y}`,order:i(),bounds:n,d:`M ${b} ${d+qe} L ${b} ${d+qe+dn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},R=y===0,k=y===t.bands.length-1,N=R?"left":k?"right":"center",H=R?b:k?b-Yr:b-Yr/2,G=P({id:`chart-treemap-legend-tick-label-${r.id}-${y}`,order:i(),bounds:n,frame:{x:H,y:d+qe+dn+Ha,width:Yr,height:l},text:Ae(h),chart:r,align:N});return[S,G]});return[m,...f]}function Xw(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-Va-qe:o.x+t.gridWidth+Va,c=le({x:d,y:s,width:qe,height:l}),u=wf(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-dn:f+dn,y=a==="left"?h-Ha-Yr:h+Ha,b=t.bands.flatMap((S,R)=>{let k=s+(1-Wa(t,S))*l,N={type:"path",id:`chart-treemap-legend-tick-${r.id}-${R}`,order:i(),bounds:n,d:`M ${f} ${k} L ${h} ${k}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},H=P({id:`chart-treemap-legend-tick-label-${r.id}-${R}`,order:i(),bounds:n,frame:{x:y,y:k-t.fontSize/2,width:Yr,height:t.fontSize+2},text:Ae(S),chart:r,align:a==="left"?"right":"left"});return[N,H]});return[m,...b]}function vf(e,t){let{tiles:r,headers:o}=qw(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(...Zw(e,t,a,c))}),o.forEach((a,s)=>{n.push(...Kw(e,t,a,s))}),n}function qw(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:zr(c)}));return{tiles:Vr(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+zr(c),0)})),n=Vr(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:zr(m)}));a.push(...Vr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function Kw(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={...P({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:de(l)};return[d,u]}function Zw(e,t,r,o){let n=Fa(r.item.leaf,t),i=o?Fa(o.item.leaf,t):void 0,a=[Qw(e,t,r,n,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...Jw(e,t,r,n)),a}function Qw(e,t,r,o,n){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=D(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),b=Math.max(0,r.height-c),S="#94a3b8",R={minX:f,maxX:f+y,minY:h+b/2-y/2,maxY:h+b/2+y/2},k=n?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:I(o,S)},{offset:100,color:I(n,S)}]}:v(o,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:n?R:s,x:f,y:h,width:y,height:b,rx:t.cellRadius,style:{fill:k,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 Jw(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,b=n.config?.tileTextColor??de(I(o,"#ffffff")),S=t.labelSize*1.2,R=Math.max(1,Math.floor(f/S)),k=Ge(l.label,m,t.labelSize).slice(0,R).map(se=>Io(se,m,t.labelSize,!0)),N={...P({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:k,fontSize:t.labelSize,fontWeight:"bold",color:b},H=String(d),G=k.length*S+t.valueSize*1.2<=f+2&&ge(H,t.valueSize,!1)<=m;if(n.config?.showTileValues===!1||!G)return[N];let X={...P({id:`chart-treemap-value-${n.id}-${l.id}`,order:s(),bounds:a,frame:{x:h,y:y+k.length*S,width:m,height:Math.max(1,f-k.length*S)},text:String(d),chart:n}),lines:[String(d)],fontSize:t.valueSize,color:b};return[N,X]}function Pf(e){let t=kf(e),r=[];return r.push(...vf(e,t)),r.push(...Rf(e,t)),r}var ev={bar:Zm,boxplot:ip,custom:lp,field:yp,heatmap:vp,hexbin:e=>Np(e),line:Vp,mekko:Kp,pie:e=>af(e),polarArea:e=>df(e),radar:e=>Da(e),radial:e=>Da(e),radialBar:e=>gf(e),sankey:Sf,scatter:Cf,treemap:Pf},tv=new Set(["radar","radial"]);function za(e){return tv.has(e)}function St(e){return ev[e.chart.chartType](e)}function Lf(e){let{chart:t,context:r,layout:o,nodes:n,renderOrder:i}=e,a=en(t,o.plot,o.bounds,i.current());n.push(...a),i.advance(a.length),n.push(...St(r));let s=Ym({chart:t,plot:o.plot,bounds:o.bounds,order:i.current()});return n.push(...s),i.advance(s.length),n.push(...Im(t,o,i.current())),n}function rv(e,t){let r=ne(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function ov(e,t){let{outerRadius:r,innerRadius:o,cornerRadius:n}=Xo(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 nv(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 iv(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...e.series.map(c=>c.values.length)),n=Zo(r,o),i=Ko(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 av(e,t){return e.chartType==="pie"?ov(e,t):e.chartType==="polarArea"?nv(e,t):e.chartType==="radar"||e.chartType==="radial"?iv(e,t):Mm.has(e.chartType)?rv(e,t):void 0}function Mf(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:v(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:p(e.strokeWidth,1)}},i=av(e,r);return i&&(n.detail=i),n}function Tf(e,t,r,o){let n=Pm({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:o});return r.advance(n.length),n}function $f(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 cn=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?[{...P({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:Sm}]:[]}function Ef(e,t,r){let o=2e4+t,n=Am(e),i=new cn(o),a=[Mf(e,n.bounds,n.plot,o)];return a.push(...Um(e,n.bounds,i)),a.push(...Af(e,n.bounds,n.plot,i)),a.push(...Tf(e,n,i,r)),{chart:e,layout:n,nodes:a,renderOrder:i,context:$f(e,n,i,r)}}function Nf(e){return e.nodes.push(...St(e.context)),e.nodes}function Of(e){return e.nodes.push(...St(e.context)),e.nodes}function Bf(e,t,r){if(e.isVisible===!1)return[];let o=Ef(e,t,r);return za(e.chartType)?Nf(o):Xe(e)?Lf(o):Of(o)}function Ya(e,t){return e.flatMap((r,o)=>re(Bf(r,o,t),"chart",r.id,r.chartType,r.title??"Chart"))}function sv(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 lv(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 dv(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=lv(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 If(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=dv(i,sv(n));a.style={...a.style,clip:a.style.clip?{...a.style.clip,within:s}:s}}}}function cv(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 uv(e){if(!e.length)return $i;let t=e.map(cv);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 mv(e){let t=new Map,r=(o,n,i)=>{n.forEach((a,s)=>{t.set(`${o}:${a.id}`,{rank:yc(a),sequence:bc(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 pv(e,t){let r=mv(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 Ua(e,t={}){let{measureText:r}=t,o=[...e.diagnostics??[]],n=[...qc(e),...zu(e.paths??[]),...Ya(e.charts??[],o),...Wu(e.links,r),...um(e.shapes,o,r),...Bi(e.components??e.widgets??[]),...nu(e.isometricObjects??[]),...Qc(e.dimensions??[])];return If(n,e.frames),pv(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:uv(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 un=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 mn=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,gv);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,fv,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},hv,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 fv(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 hv(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 gv(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 Gf(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 yv(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function bv(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 pn=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=yv(t,a,o),l=bv(i,s);return this.addDefinition(`<marker ${l}>${Gf(t,a,M(r),o)}</marker>`),i}};function xv(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 Sv(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 fn=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"?xv(i,t):Sv(i,t,o);this.addDefinition(a)}return`url(#${i})`}};var hn=class{constructor(t){this.prefix=t;let r=o=>{this.entries.push(o)};this.paints=new fn(r,t),this.filters=new mn(r,t),this.markers=new pn(r,t),this.clips=new un(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 Cv(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 Df(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,Cv(t,t.identity.id)]:[t])}function _f(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 kv(n,e.style),Hf(n,e,t),wv(n,e,t),n.join(" ")}function kv(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 Rv(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);if(t.type==="path"&&t.bounds){let r=Math.min(t.bounds.maxX-t.bounds.minX,t.bounds.maxY-t.bounds.minY);return r>0?r:void 0}}function Hf(e,t,r){let o=r.filter(t.style,t.id,Rv(t));o&&e.push(`filter="url(#${o})"`);let n=r.clip(t.style);n&&e.push(`clip-path="url(#${n})"`)}function wv(e,t,r){if(t.type!=="path")return;let o=r.marker(t.markerStart,_f(t.style,"start"),t.style.strokeWidth??1),n=r.marker(t.markerEnd,_f(t.style,"end"),t.style.strokeWidth??1);o&&e.push(`marker-start="url(#${o})"`),n&&e.push(`marker-end="url(#${n})"`)}function Ke(e,t){return e&&t?` transform="rotate(${g(e)} ${g(t.x)} ${g(t.y)})"`:""}function Vf(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 Wf="data-sf-symbol-points",zf="data-sf-symbol-tension",gn="data-sf-symbol-bounds",Ur="data-sf-corner-radius",Yf="data-sf-square-corner",yn="data-sf-path-points",bn="data-sf-path-tension",xn="data-sf-path-closed",Uf="data-sf-path-point",Sn="data-sf-isometric-size",Cn="data-sf-isometric-label-offset";function vv(e){return e.role==="shape"?"entity":e.role}function Pv(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 Lv(e){return[`data-sf-role="${vv(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?Pv(e.aria):[]]}function Mv(e){switch(e.of){case"chartValue":return Tv(e);case"chartScale":return Ev(e);case"chartSeries":return Nv(e);case"pieGeometry":return $v(e);case"radarGeometry":return Av(e);case"link":return Dv(e);case"frameBoundary":return Ov(e);case"symbolGeometry":return Bv(e);case"declaredBounds":return[ja(e.bounds)];case"pathGeometry":return Iv(e);case"isometricGeometry":return Gv(e)}}function Tv(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 $v(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function Av(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function Ev(e){return[`data-sf-value-scale="${e.valueScale}"`]}function Nv(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 Ov(e){return[`${Ur}="${g(e.cornerRadius)}"`,`${Yf}="${e.squareCorner}"`]}function ja(e){return`${gn}="${g(e.x)},${g(e.y)},${g(e.width)},${g(e.height)}"`}function Bv(e){return[`${Wf}="${M(JSON.stringify(e.points))}"`,`${zf}="${g(e.tension)}"`,ja(e.declaredBounds)]}function Iv(e){return[`${yn}="${M(JSON.stringify(e.points))}"`,`${bn}="${g(e.tension)}"`,`${xn}="${e.closed}"`]}function Gv(e){return[`${Sn}="${g(e.width)},${g(e.height)},${g(e.depth)}"`,`${Ur}="${g(e.cornerRadius)}"`,ja(e.bounds),`${Cn}="${g(e.labelOffsetX)},${g(e.labelOffsetY)}"`]}function Dv(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 Ct(e){let t=e.identity?.label,r=[...e.identity?Lv(e.identity):[],...e.detail?Mv(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 _v(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 jf(e,t){let r=Fv(e),o=`${g(e.fontSize)}px`,n=Vv(e,r,o),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${Ct(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}${Ke(e.rotation,e.rotationCenter)}>${n}</text>`}function Fv(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:Hv(e,o),linePx:t,anchor:i}}function Hv(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 Vv(e,t,r){return e.richLines?e.richLines.map((o,n)=>_v(o,t.x,Xf(n,t.linePx),r)).join(""):e.lines.map((o,n)=>Wv(o,n,t,r)).join("")}function Wv(e,t,r,o){return`<tspan x="${g(r.x)}" font-size="${o}"${Xf(t,r.linePx)}>${M(e)}</tspan>`}function Xf(e,t){return e?` dy="${g(t)}px"`:""}function zv(e,t){let r=Ke(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)}"${Ct(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 Yv(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 Uv(e,t){let r=Ke(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=>Yv(s,e)).join(""),a=M(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${Ct(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 qf(e,t){if(e.type==="text")return jf(e,t);if(e.type==="shader-surface")return zv(e,t);if(e.type==="rolling-number")return Uv(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${Ct(e)} ${Vf(e,t)} href="${M(e.href)}" x="${g(e.x)}" y="${g(e.y)}" width="${g(e.width)}" height="${g(e.height)}" preserveAspectRatio="${e.aspect==="none"?"none":`xMidYMid ${e.aspect??"slice"}`}"${Ke(e.rotation,e.rotationCenter)}/>`;let r=`id="${t.elementId(e.id)}"${Ct(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)}"`:""}${Ke(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)}"${Ke(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${M(e.d)}"${Ke(e.rotation,e.rotationCenter)}/>`}function Kf(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 hn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?Df(e.nodes):e.nodes).map(u=>qf(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 kn(e,t={}){return qf(e,t)}function Uv(e,t={}){let r=Ua(e,{measureText:t.measureText}),{svg:o,width:n,height:i,diagnostics:a}=kn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var jv=50,rt=new Map,Kf=eo();function Xv(e){let t=eo();t!==Kf&&(rt.clear(),Kf=t);let r=rt.get(e);if(r)return rt.delete(e),rt.set(e,r),r;let o=Ua(Ti(e));if(rt.set(e,o),rt.size>jv){let n=rt.keys().next().value;n!==void 0&&rt.delete(n)}return o}function Rn(e,t={}){if(t.measureText)return Uv(Ti(e),t);let r=Xv(e),{svg:o,width:n,height:i,diagnostics:a}=kn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var Xa="http://www.w3.org/1999/xhtml",wn=(e,t)=>{Object.assign(e.style,t)};function vn(e,t,r){let o=e.createElementNS(Xa,"span");return o.setAttribute("data-sf-rolling-current","true"),o.textContent=t,wn(o,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),o}function qv(e,t,r){let o=e.createElementNS(Xa,"span");if(o.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return wn(o,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),o.appendChild(vn(e,t,r)),o;wn(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(vn(e,t,r));let n=e.createElementNS(Xa,"span");return wn(n,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),o.appendChild(n),o}function Pn(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 Kv(e,t,r,o){let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=vn(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=Pn(i,[a,s],o),d=n?Pn(n,[s,a],o):null,c=()=>{n?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function Zv(e,t,r,o){if(r.motion==="fade"){Kv(e,t,r,o);return}let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=vn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Pn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],o),s=n?Pn(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 Zf(e,t,r,o,n){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>qv(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&&Zv(i[s],a,o,n)}),e.setAttribute("aria-label",r)}function qa(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var Qv=140;function Jv(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Qf(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return te;try{return{...te,...JSON.parse(t)}}catch{return te}}function e1(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function t1(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 Ln(e,t,r){let o=Jv(e);if(!o)return!1;let n=e.getAttribute("data-sf-widget-value")??"",i=ur(t,e1(e.getAttribute("data-sf-widget-digits")));return n===i||(Zf(o,n,i,Qf(e),r?t1(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function Ka(e){let t=new Map,r=new Map,o=new Map;return{setValue(n,i){let a=qa(e,n);if(!a)return!1;if(t.set(n,i),Qf(a).motion!=="fade")return Ln(a,i,!0);let s=Date.now(),l=(r.get(n)??0)+Qv-s;return l<=0?(r.set(n,s),Ln(a,i,!0)):(o.has(n)||o.set(n,setTimeout(()=>{o.delete(n),r.set(n,Date.now());let d=qa(e,n),c=t.get(n);d&&c!==void 0&&Ln(d,c,!0)},l)),!0)},refresh(){for(let[n,i]of t){let a=qa(e,n);a&&Ln(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 Jf=new WeakMap,eh=new WeakMap,th=new WeakMap;function Qa(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function rh(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function Ja(e,t){return Number(e)>0?Number(e):t}function oh(e){return{min:Number(e.min)||0,max:Number.isFinite(Number(e.max))&&e.max!==void 0?Number(e.max):100}}function nh(e,t){let{min:r,max:o}=oh(rh(e));return Qa(o===r?0:(t-r)/(o-r))}function Za(e,t,r){let o=e.getAttribute("transform")??"",n=o===eh.get(e)?Jf.get(e)??"":o;Jf.set(e,n);let i=`translate(${t} ${r}) ${n}`.trim();eh.set(e,i),e.setAttribute("transform",i)}var r1=[255,255,255];function o1(e,t,r){let o=th.get(e)??e.getAttribute("fill")??"";th.set(e,o);let n=Ie(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 n1(e,t){let r=rh(e),o=e.getAttribute("data-sf-id")??"",n=Number(e.getAttribute("width")),i=Number(e.getAttribute("height")),a=r.axis==="horizontal",s=a?i:n,l=r.dent===void 0?1:Number(r.dent);return{id:o,params:r,x:Number(e.getAttribute("x")),y:Number(e.getAttribute("y")),width:n,height:i,horizontal:a,progress:Qa(t(o)??Number(r.progress)),inset:Ja(r.inset,.05),extent:a?n:i,across:s,depth:(l<0?1:l)*.16*s}}function i1(e,t){let{params:r,x:o,y:n,width:i,height:a,horizontal:s,across:l,depth:d}=t,c=typeof r.knob=="string"?r.knob:"";if(!c)return;let u=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(c)}"]`)],m=u.find(G=>G.hasAttribute("data-sf-primary"));if(!m?.getBBox)return;Za(m,0,0);let f=m.getBBox(),h=(s?f.height:f.width)/2,y=t.inset+(1-2*t.inset)*t.progress,b=Ja(r.line,.7),S=(r.gap===void 0?.04:Number(r.gap))*l,R=b*l-d+h+S,k=s?{x:o+i*y,y:n+R}:{x:o+R,y:n+a*(1-y)},N=k.x-(f.x+f.width/2),F=k.y-(f.y+f.height/2);for(let G of u)Za(G,N,F);return h/l}function a1(e,t){let{id:r,params:o,horizontal:n,extent:i,inset:a,progress:s,depth:l}=t,{min:d,max:c}=oh(o),u=(typeof o.peak=="string"?Ie(o.peak):null)??r1,m=Ja(o.spread,.07)*i,f=a*i,h=(1-2*a)*i,y=f+h*s;for(let b of e.querySelectorAll(`text[data-sf-id="${CSS.escape(r)}"]`)){let S=Number(b.textContent);if(!Number.isFinite(S)||c===d)continue;let R=f+h*Qa((S-d)/(c-d)),k=Math.exp(-(((R-y)/m)**2)),N=l*.4*k;Za(b,n?0:-N,n?-N:0),o1(b,k,u)}}function ih(e,t){let r=new Map;for(let o of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let n=n1(o,t),i=i1(e,n);i!==void 0&&r.set(n.id,i),a1(e,n)}return r}var ah=new Set(["viewbox","width","height"]);function sh(e,t){for(let r of Array.from(e.attributes))ah.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))ah.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function lh(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 dh(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 s1(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 uh(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(!uh(s,l))return!1}return!0}function ch(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function mh(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=s1(e,t),n=!1;return r&&(n=!0,ch(e,t)),t.tagName.toLowerCase()==="text"&&!uh(e,t)&&(n=!0,ch(e,t)),o||n}function jr(e){return e.getAttribute("data-sf-id")??e.id}function ph(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 l1(e){return new Map(ph(e))}function d1(e,t,r){return e&&e.tagName===t.tagName?(mh(e,t)&&r(jr(t)),e):(e?.remove(),r(jr(t)),t)}function c1(e,t,r){let o=r?r.nextSibling:e.firstChild;o!==t&&e.insertBefore(t,o)}function fh(e,t){let r=dh(e,t),o=l1(e),n=new Set,i=new Set;for(let c of o.values())i.add(jr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let[c,u]of ph(t)){n.add(c),a.add(jr(u));let m=d1(o.get(c),u,l);c1(e,m,d),d=m}for(let[c,u]of o)n.has(c)||(s.add(jr(u)),u.remove());return lh(i,a,s)}function hh(e,t){return sh(e,t),fh(e,t)}function es(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 Xr(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 Mn=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 gh(e,t){let r=es(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let o=new Mn(r,Xr(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=es(n),a=hh(r,i);return o.setNatural(Xr(i)),a},destroy(){r.remove()}}}var Tn=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 $n=class extends Tn{};function u1(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function m1(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 p1(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 ts(e,t,r={}){let o=Xr(e),n=u1(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 m1(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 p1(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var rs="http://www.w3.org/2000/svg";function f1(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function h1(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function qr(e,t,r){let o=e.createElementNS(rs,t);for(let[n,i]of Object.entries(r))o.setAttribute(n,String(i));return o}function g1(e){try{return{...te,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return te}}function y1(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 b1(e,t,r){let o=qr(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 x1(e,t,r,o,n,i){let a=qr(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 S1(e,t,r,o,n,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=n,c=[];s||c.push(qr(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=qr(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(qr(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 C1(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=g1(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=y1(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=b1(t,r,i);a&&m.appendChild(x1(t,a,o,u,s,i)),[...n].forEach((f,h)=>{let y=c+h*(s.cellWidth+s.gap);for(let b of S1(t,f,y,u,s,i))m.appendChild(b)}),r.replaceWith(m)}}function yh(e,t){let r=e.cloneNode(!0);h1(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(rs,"image");f1(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),C1(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",rs),r}function os(e,t){return new XMLSerializer().serializeToString(yh(e,t))}var bh="http://www.w3.org/2000/svg";var ns=new Set([]);function V(e,t){return e.createElementNS(bh,t)}function He(e,t,r){let o=V(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 k1="data-sf-change-overlay",Kr="#f59e0b",An=1300,is=400;function xh(e,t,r){let o=V(e,"g");o.setAttribute(k1,t),o.setAttribute("pointer-events","none");let n=r.getAttribute("transform");return n&&o.setAttribute("transform",n),o}function as(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:An,easing:"linear",fill:"forwards"})}function ss(e,t,r,o=Kr){let n=t.getBBox(),i=xh(e,r,t),a=V(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 ls(e,t,r,o=Kr){let n=xh(e,r,t),i=V(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 dr(e){return e.ctrlKey||e.metaKey}function En(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Nn(e){return e===1}var R1=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function w1(e){return e==="entity"?"shape":e}function ot(e){let t=e.getAttribute(gn);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 ds(e){let t=e.getAttribute(yn);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(bn))||0,closed:e.getAttribute(xn)==="true"}}function cs(e){let t=e.getAttribute(Sn);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(Ur))||0,[a,s]=(e.getAttribute(Cn)??"0,0").split(",").map(Number);return{width:r,height:o,depth:n,cornerRadius:i,bounds:ot(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function nt(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||!R1.has(o)?null:{role:w1(o),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function kt(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 Rt=e=>e.hasAttribute("data-sf-primary");function us(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 B(e,t){return t/us(e)}var On=6,v1=14,ms=3,ps=1.5;function P1(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 L1(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Sh="#e8e8e8",Ch="#ccc",M1="#9b42df",T1="#7c2fb5",$1=1.2;function fs(e,t,r,o,n,i){let a=V(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(o)),a.setAttribute("fill",Sh),a.setAttribute("stroke",Ch),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*$1)),a.setAttribute("fill",M1),a.setAttribute("stroke",T1),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(o)),a.setAttribute("fill",Sh),a.setAttribute("stroke",Ch),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function hs(e,t,r,o,n){let i=V(e,"path");return i.setAttribute("d",L1(t,r,o)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(n)),i.setAttribute("stroke-linecap","round"),i}function Bn(e,t,r,o){let n=He(e,r,t),i=B(o,On),a=i+B(o,v1),s=B(o,ms),l=B(o,ps),d=ot(t)??t.getBBox();for(let[c,u,m]of P1(d,a))n.append(fs(e,c,u,i,l,m),hs(e,c,u,s,l));return n}var bs="#9b42df",A1=2,E1=3.25,N1=14,Rh=34,O1=10.5,B1=8.5;function kh(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function I1(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 xs(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 Ss="data-sf-iso-halo";function G1(e,t,r,o){let n=V(e,"g");n.setAttribute("data-sf-resize-handle",`iso-${t}`),n.style.cursor=I1(r);let i=V(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(B(o,N1))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",n.appendChild(i);let a=V(e,"line");a.setAttribute("stroke",bs),a.setAttribute("stroke-width",String(B(o,E1))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",n.appendChild(a);let s=V(e,"polygon");return s.setAttribute("fill",bs),s.style.pointerEvents="none",n.appendChild(s),{group:n,hit:i,shaft:a,head:s}}function D1(e,t,r,o){let n=B(o,Rh),i=B(o,O1),a=B(o,B1),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 gs(e,t,r,o,n){let i=G1(e,o,r,n);return D1(i,t,r,n),i.group}function In(e){let t=Ye(e),r=t.top[0],o=t.top[1],n=t.top[3],i=t.front[2];return{width:{origin:xs(t.right),direction:kh({x:o.x-r.x,y:o.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:xs(t.front),direction:kh({x:n.x-r.x,y:n.y-r.y})}}}var _1=Rh+On+10;function ys(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function Cs(e){let t=Ye(e),r=In(e),o=xs([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:ys(r.width.origin,o),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:ys(r.depth.origin,o),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:ys(r.height.origin,o),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var ks="data-sf-iso-duplicate-bubbles",F1=["iso-height-neg","iso-depth-pos","iso-width-pos"];function Rs(e,t,r){let o=V(e,"g");o.setAttribute(ks,"");let n=B(r,On),i=B(r,_1),a=B(r,ms),s=B(r,ps),l=Cs(t);for(let d of F1){let{origin:c,direction:u}=l[d],m=c.x+u.x*i,f=c.y+u.y*i;o.append(fs(e,m,f,n,s,d),hs(e,m,f,a,s))}return o}function Gn(e,t,r,o){let n=ot(t)??t.getBBox(),i=cs(t),a=He(e,r,t),s=V(e,"path");s.setAttribute(Ss,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",bs);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+B(o,A1))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=In({x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0});return a.appendChild(gs(e,d.width.origin,d.width.direction,"width",o)),a.appendChild(gs(e,d.height.origin,d.height.direction,"height",o)),a.appendChild(gs(e,d.depth.origin,d.depth.direction,"depth",o)),a.appendChild(Rs(e,{x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0},o)),a}var ws="#9b42df",H1=4,V1=5,vh=1.5;function W1(e,t,r){let o=V(e,"path");o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",ws);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+B(r,H1))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function wh(e,t,r,o,n){let i=t.getPointAtLength(r),a=V(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(B(n,V1))),a.setAttribute("fill",ws),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(B(n,vh))),a.setAttribute("data-sf-link-endpoint",o),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var z1=22,Y1=8;function U1(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function j1(e,t,r){let o=[];return U1(t).forEach((n,i)=>{if(!n.movable)return;let a=Math.abs(n.bx-n.ax)>Math.abs(n.by-n.ay),s=B(r,z1),l=B(r,Y1),d=a?s:l,c=a?l:s,u=V(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",ws),u.setAttribute("stroke-width",String(B(r,vh))),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 Dn(e,t,r,o){let n=He(e,r,t),i=t.getTotalLength();return n.append(W1(e,t,o),...j1(e,t,o),wh(e,t,0,"from",o),wh(e,t,i,"to",o)),n}var Ph="#9b42df",X1=4,q1=5,K1=1.5,vs="data-sf-path-halo";function Z1(e,t,r){let o=V(e,"path");o.setAttribute(vs,""),o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",Ph);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+B(r,X1))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function Q1(e,t,r,o,n){let i=V(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(B(n,q1))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",Ph),i.setAttribute("stroke-width",String(B(n,K1))),i.setAttribute(Yf,String(o)),i.style.pointerEvents="auto",i.style.cursor="move",i}function _n(e,t,r,o){let n=He(e,r,t);n.appendChild(Z1(e,t,o));let i=ds(t);for(let[a,[s,l]]of(i?.points??[]).entries())n.appendChild(Q1(e,s,l,a,o));return n}var J1=6,e2=1,t2="#992dff",r2={"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 Ps(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 o2=new Set(["top","bottom"]);function Lh(e,t,r,o=!1){let n=B(r,J1),i=B(r,e2);return(o?Ps(t).filter(([,,s])=>!o2.has(s)):Ps(t)).map(([s,l,d])=>{let c=V(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",t2),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=o?"ew-resize":r2[d],c})}var n2="#9b42df",i2=3,a2=1;function Fn(e,t,r,o,n=!1){let i=ot(t)??t.getBBox(),a=He(e,r,t),s=B(o,a2),l=V(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",n2),l.setAttribute("stroke-width",String(B(o,i2))),a.appendChild(l),a.append(...Lh(e,i,o,n)),a}function Mh(e){let t=new Map;return{flash:(o,n=Kr)=>{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=kt(e,l,Rt);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"?ls(a,d,l,n):ss(a,d,l,n);e.appendChild(u),as(u,s);let m=s?is:An;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},m))}},destroy(){for(let o of t.values())clearTimeout(o);t.clear()}}}function Th(e,t,r){let o=n=>{r&&n.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}function Ls(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function $h(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 Ah(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var c2="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function Ms(e){return!!e?.closest(c2)}var Hn=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=nt(t.target);this.#o.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:Ls(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,o=nt(r);if(!o){this.#n(r);return}this.#i(o,t)}#n(t){Ms(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let o=Ls(r);this.#r.dispatch(Ah(t.id,o)),this.#o.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:o});let n=kt(this.#e,t.id,Rt);n&&!n.hasAttribute("tabindex")&&n.setAttribute("tabindex","-1"),n?.focus({preventScroll:!0})}};var u2=4,Ts=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=!!nt(r)||Ms(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:dr(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)>u2&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&dr(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 Eh(e){let{display:t,emitter:r,diagramId:o,selection:n,selectable:i}=e,a=new Hn(t.svg,r,o,n);return new Ts(t,a,i).bind()}function $s(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=kt(e,n,Rt);if(!i)continue;let a=r.get(n),s=a?.role==="link"?Dn(o,i,n,e):a?.role==="path"?_n(o,i,n,e):a?.role==="isometric"?Gn(o,i,n,e):Fn(o,i,n,e,a?ns.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(Bn(o,i,n,e))}}var Vn=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=$h(this.#n,t),$s(this.#e,this.#n,this.#r),this.#o.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#n.size>0&&$s(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=nt(o);n&&this.remember(n)}this.dispatch({type:"set",ids:t})}};function Nh(e,t){let r=o=>{dr(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 Oh(e,t,r,o={}){let n=o.selectable??!0,i=new Vn(e.svg,t,r),a=Eh({display:e,emitter:t,diagramId:r,selection:i,selectable:n}),s=Nh(e,i),l=Th(e.svg,i,n),d=Mh(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 As={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 m2=`
18
+ </svg>`,width:o,height:n,diagnostics:e.diagnostics}}function kn(e,t={}){return Kf(e,t)}function Xv(e,t={}){let r=Ua(e,{measureText:t.measureText}),{svg:o,width:n,height:i,diagnostics:a}=kn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var qv=50,rt=new Map,Zf=eo();function Kv(e){let t=eo();t!==Zf&&(rt.clear(),Zf=t);let r=rt.get(e);if(r)return rt.delete(e),rt.set(e,r),r;let o=Ua(Ti(e));if(rt.set(e,o),rt.size>qv){let n=rt.keys().next().value;n!==void 0&&rt.delete(n)}return o}function Rn(e,t={}){if(t.measureText)return Xv(Ti(e),t);let r=Kv(e),{svg:o,width:n,height:i,diagnostics:a}=kn(r,t);return{svg:o,width:n,height:i,diagnostics:a,scene:r}}var Xa="http://www.w3.org/1999/xhtml",wn=(e,t)=>{Object.assign(e.style,t)};function vn(e,t,r){let o=e.createElementNS(Xa,"span");return o.setAttribute("data-sf-rolling-current","true"),o.textContent=t,wn(o,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),o}function Zv(e,t,r){let o=e.createElementNS(Xa,"span");if(o.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return wn(o,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),o.appendChild(vn(e,t,r)),o;wn(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(vn(e,t,r));let n=e.createElementNS(Xa,"span");return wn(n,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),o.appendChild(n),o}function Pn(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 Qv(e,t,r,o){let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=vn(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=Pn(i,[a,s],o),d=n?Pn(n,[s,a],o):null,c=()=>{n?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function Jv(e,t,r,o){if(r.motion==="fade"){Qv(e,t,r,o);return}let n=e.querySelector("[data-sf-rolling-current]");n?.removeAttribute("data-sf-rolling-current");let i=vn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Pn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],o),s=n?Pn(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 Qf(e,t,r,o,n){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>Zv(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&&Jv(i[s],a,o,n)}),e.setAttribute("aria-label",r)}function qa(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var e1=140;function t1(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Jf(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return te;try{return{...te,...JSON.parse(t)}}catch{return te}}function r1(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function o1(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 Ln(e,t,r){let o=t1(e);if(!o)return!1;let n=e.getAttribute("data-sf-widget-value")??"",i=ur(t,r1(e.getAttribute("data-sf-widget-digits")));return n===i||(Qf(o,n,i,Jf(e),r?o1(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function Ka(e){let t=new Map,r=new Map,o=new Map;return{setValue(n,i){let a=qa(e,n);if(!a)return!1;if(t.set(n,i),Jf(a).motion!=="fade")return Ln(a,i,!0);let s=Date.now(),l=(r.get(n)??0)+e1-s;return l<=0?(r.set(n,s),Ln(a,i,!0)):(o.has(n)||o.set(n,setTimeout(()=>{o.delete(n),r.set(n,Date.now());let d=qa(e,n),c=t.get(n);d&&c!==void 0&&Ln(d,c,!0)},l)),!0)},refresh(){for(let[n,i]of t){let a=qa(e,n);a&&Ln(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 eh=new WeakMap,th=new WeakMap,rh=new WeakMap;function Qa(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function oh(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function Ja(e,t){return Number(e)>0?Number(e):t}function nh(e){return{min:Number(e.min)||0,max:Number.isFinite(Number(e.max))&&e.max!==void 0?Number(e.max):100}}function ih(e,t){let{min:r,max:o}=nh(oh(e));return Qa(o===r?0:(t-r)/(o-r))}function Za(e,t,r){let o=e.getAttribute("transform")??"",n=o===th.get(e)?eh.get(e)??"":o;eh.set(e,n);let i=`translate(${t} ${r}) ${n}`.trim();th.set(e,i),e.setAttribute("transform",i)}var n1=[255,255,255];function i1(e,t,r){let o=rh.get(e)??e.getAttribute("fill")??"";rh.set(e,o);let n=Ie(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 a1(e,t){let r=oh(e),o=e.getAttribute("data-sf-id")??"",n=Number(e.getAttribute("width")),i=Number(e.getAttribute("height")),a=r.axis==="horizontal",s=a?i:n,l=r.dent===void 0?1:Number(r.dent);return{id:o,params:r,x:Number(e.getAttribute("x")),y:Number(e.getAttribute("y")),width:n,height:i,horizontal:a,progress:Qa(t(o)??Number(r.progress)),inset:Ja(r.inset,.05),extent:a?n:i,across:s,depth:(l<0?1:l)*.16*s}}function s1(e,t){let{params:r,x:o,y:n,width:i,height:a,horizontal:s,across:l,depth:d}=t,c=typeof r.knob=="string"?r.knob:"";if(!c)return;let u=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(c)}"]`)],m=u.find(G=>G.hasAttribute("data-sf-primary"));if(!m?.getBBox)return;Za(m,0,0);let f=m.getBBox(),h=(s?f.height:f.width)/2,y=t.inset+(1-2*t.inset)*t.progress,b=Ja(r.line,.7),S=(r.gap===void 0?.04:Number(r.gap))*l,R=b*l-d+h+S,k=s?{x:o+i*y,y:n+R}:{x:o+R,y:n+a*(1-y)},N=k.x-(f.x+f.width/2),H=k.y-(f.y+f.height/2);for(let G of u)Za(G,N,H);return h/l}function l1(e,t){let{id:r,params:o,horizontal:n,extent:i,inset:a,progress:s,depth:l}=t,{min:d,max:c}=nh(o),u=(typeof o.peak=="string"?Ie(o.peak):null)??n1,m=Ja(o.spread,.07)*i,f=a*i,h=(1-2*a)*i,y=f+h*s;for(let b of e.querySelectorAll(`text[data-sf-id="${CSS.escape(r)}"]`)){let S=Number(b.textContent);if(!Number.isFinite(S)||c===d)continue;let R=f+h*Qa((S-d)/(c-d)),k=Math.exp(-(((R-y)/m)**2)),N=l*.4*k;Za(b,n?0:-N,n?-N:0),i1(b,k,u)}}function ah(e,t){let r=new Map;for(let o of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let n=a1(o,t),i=s1(e,n);i!==void 0&&r.set(n.id,i),l1(e,n)}return r}var sh=new Set(["viewbox","width","height"]);function lh(e,t){for(let r of Array.from(e.attributes))sh.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))sh.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function dh(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 ch(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 d1(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 mh(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(!mh(s,l))return!1}return!0}function uh(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function ph(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=d1(e,t),n=!1;return r&&(n=!0,uh(e,t)),t.tagName.toLowerCase()==="text"&&!mh(e,t)&&(n=!0,uh(e,t)),o||n}function jr(e){return e.getAttribute("data-sf-id")??e.id}function fh(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 c1(e){return new Map(fh(e))}function u1(e,t,r){return e&&e.tagName===t.tagName?(ph(e,t)&&r(jr(t)),e):(e?.remove(),r(jr(t)),t)}function m1(e,t,r){let o=r?r.nextSibling:e.firstChild;o!==t&&e.insertBefore(t,o)}function hh(e,t){let r=ch(e,t),o=c1(e),n=new Set,i=new Set;for(let c of o.values())i.add(jr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let[c,u]of fh(t)){n.add(c),a.add(jr(u));let m=u1(o.get(c),u,l);m1(e,m,d),d=m}for(let[c,u]of o)n.has(c)||(s.add(jr(u)),u.remove());return dh(i,a,s)}function gh(e,t){return lh(e,t),hh(e,t)}function es(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 Xr(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 Mn=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 yh(e,t){let r=es(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let o=new Mn(r,Xr(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=es(n),a=gh(r,i);return o.setNatural(Xr(i)),a},destroy(){r.remove()}}}var Tn=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 $n=class extends Tn{};function p1(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function f1(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 h1(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 ts(e,t,r={}){let o=Xr(e),n=p1(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 f1(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 h1(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var rs="http://www.w3.org/2000/svg";function g1(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function y1(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function qr(e,t,r){let o=e.createElementNS(rs,t);for(let[n,i]of Object.entries(r))o.setAttribute(n,String(i));return o}function b1(e){try{return{...te,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return te}}function x1(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 S1(e,t,r){let o=qr(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 C1(e,t,r,o,n,i){let a=qr(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 k1(e,t,r,o,n,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=n,c=[];s||c.push(qr(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=qr(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(qr(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 R1(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=b1(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=x1(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=S1(t,r,i);a&&m.appendChild(C1(t,a,o,u,s,i)),[...n].forEach((f,h)=>{let y=c+h*(s.cellWidth+s.gap);for(let b of k1(t,f,y,u,s,i))m.appendChild(b)}),r.replaceWith(m)}}function bh(e,t){let r=e.cloneNode(!0);y1(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(rs,"image");g1(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),R1(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",rs),r}function os(e,t){return new XMLSerializer().serializeToString(bh(e,t))}var xh="http://www.w3.org/2000/svg";var ns=new Set([]);function V(e,t){return e.createElementNS(xh,t)}function He(e,t,r){let o=V(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 w1="data-sf-change-overlay",Kr="#f59e0b",An=1300,is=400;function Sh(e,t,r){let o=V(e,"g");o.setAttribute(w1,t),o.setAttribute("pointer-events","none");let n=r.getAttribute("transform");return n&&o.setAttribute("transform",n),o}function as(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:An,easing:"linear",fill:"forwards"})}function ss(e,t,r,o=Kr){let n=t.getBBox(),i=Sh(e,r,t),a=V(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 ls(e,t,r,o=Kr){let n=Sh(e,r,t),i=V(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 dr(e){return e.ctrlKey||e.metaKey}function En(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Nn(e){return e===1}var v1=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function P1(e){return e==="entity"?"shape":e}function ot(e){let t=e.getAttribute(gn);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 ds(e){let t=e.getAttribute(yn);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(bn))||0,closed:e.getAttribute(xn)==="true"}}function cs(e){let t=e.getAttribute(Sn);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(Ur))||0,[a,s]=(e.getAttribute(Cn)??"0,0").split(",").map(Number);return{width:r,height:o,depth:n,cornerRadius:i,bounds:ot(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function nt(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||!v1.has(o)?null:{role:P1(o),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function kt(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 Rt=e=>e.hasAttribute("data-sf-primary");function us(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 B(e,t){return t/us(e)}var On=6,L1=14,ms=3,ps=1.5;function M1(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 T1(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Ch="#e8e8e8",kh="#ccc",$1="#9b42df",A1="#7c2fb5",E1=1.2;function fs(e,t,r,o,n,i){let a=V(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(o)),a.setAttribute("fill",Ch),a.setAttribute("stroke",kh),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*E1)),a.setAttribute("fill",$1),a.setAttribute("stroke",A1),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(o)),a.setAttribute("fill",Ch),a.setAttribute("stroke",kh),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function hs(e,t,r,o,n){let i=V(e,"path");return i.setAttribute("d",T1(t,r,o)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(n)),i.setAttribute("stroke-linecap","round"),i}function Bn(e,t,r,o){let n=He(e,r,t),i=B(o,On),a=i+B(o,L1),s=B(o,ms),l=B(o,ps),d=ot(t)??t.getBBox();for(let[c,u,m]of M1(d,a))n.append(fs(e,c,u,i,l,m),hs(e,c,u,s,l));return n}var bs="#9b42df",N1=2,O1=3.25,B1=14,wh=34,I1=10.5,G1=8.5;function Rh(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function D1(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 xs(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 Ss="data-sf-iso-halo";function _1(e,t,r,o){let n=V(e,"g");n.setAttribute("data-sf-resize-handle",`iso-${t}`),n.style.cursor=D1(r);let i=V(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(B(o,B1))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",n.appendChild(i);let a=V(e,"line");a.setAttribute("stroke",bs),a.setAttribute("stroke-width",String(B(o,O1))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",n.appendChild(a);let s=V(e,"polygon");return s.setAttribute("fill",bs),s.style.pointerEvents="none",n.appendChild(s),{group:n,hit:i,shaft:a,head:s}}function F1(e,t,r,o){let n=B(o,wh),i=B(o,I1),a=B(o,G1),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 gs(e,t,r,o,n){let i=_1(e,o,r,n);return F1(i,t,r,n),i.group}function In(e){let t=Ye(e),r=t.top[0],o=t.top[1],n=t.top[3],i=t.front[2];return{width:{origin:xs(t.right),direction:Rh({x:o.x-r.x,y:o.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:xs(t.front),direction:Rh({x:n.x-r.x,y:n.y-r.y})}}}var H1=wh+On+10;function ys(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function Cs(e){let t=Ye(e),r=In(e),o=xs([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:ys(r.width.origin,o),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:ys(r.depth.origin,o),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:ys(r.height.origin,o),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var ks="data-sf-iso-duplicate-bubbles",V1=["iso-height-neg","iso-depth-pos","iso-width-pos"];function Rs(e,t,r){let o=V(e,"g");o.setAttribute(ks,"");let n=B(r,On),i=B(r,H1),a=B(r,ms),s=B(r,ps),l=Cs(t);for(let d of V1){let{origin:c,direction:u}=l[d],m=c.x+u.x*i,f=c.y+u.y*i;o.append(fs(e,m,f,n,s,d),hs(e,m,f,a,s))}return o}function Gn(e,t,r,o){let n=ot(t)??t.getBBox(),i=cs(t),a=He(e,r,t),s=V(e,"path");s.setAttribute(Ss,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",bs);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+B(o,N1))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=In({x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0});return a.appendChild(gs(e,d.width.origin,d.width.direction,"width",o)),a.appendChild(gs(e,d.height.origin,d.height.direction,"height",o)),a.appendChild(gs(e,d.depth.origin,d.depth.direction,"depth",o)),a.appendChild(Rs(e,{x:n.x,y:n.y,width:i?.width??n.width,height:i?.height??n.height,depth:i?.depth??0},o)),a}var ws="#9b42df",W1=4,z1=5,Ph=1.5;function Y1(e,t,r){let o=V(e,"path");o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",ws);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+B(r,W1))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function vh(e,t,r,o,n){let i=t.getPointAtLength(r),a=V(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(B(n,z1))),a.setAttribute("fill",ws),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(B(n,Ph))),a.setAttribute("data-sf-link-endpoint",o),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var U1=22,j1=8;function X1(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function q1(e,t,r){let o=[];return X1(t).forEach((n,i)=>{if(!n.movable)return;let a=Math.abs(n.bx-n.ax)>Math.abs(n.by-n.ay),s=B(r,U1),l=B(r,j1),d=a?s:l,c=a?l:s,u=V(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",ws),u.setAttribute("stroke-width",String(B(r,Ph))),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 Dn(e,t,r,o){let n=He(e,r,t),i=t.getTotalLength();return n.append(Y1(e,t,o),...q1(e,t,o),vh(e,t,0,"from",o),vh(e,t,i,"to",o)),n}var Lh="#9b42df",K1=4,Z1=5,Q1=1.5,vs="data-sf-path-halo";function J1(e,t,r){let o=V(e,"path");o.setAttribute(vs,""),o.setAttribute("d",t.getAttribute("d")??""),o.setAttribute("fill","none"),o.setAttribute("stroke",Lh);let n=Number(t.getAttribute("stroke-width"))||2;return o.setAttribute("stroke-width",String(n+B(r,K1))),o.setAttribute("stroke-linecap","round"),o.setAttribute("opacity","0.5"),o}function e2(e,t,r,o,n){let i=V(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(B(n,Z1))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",Lh),i.setAttribute("stroke-width",String(B(n,Q1))),i.setAttribute(Uf,String(o)),i.style.pointerEvents="auto",i.style.cursor="move",i}function _n(e,t,r,o){let n=He(e,r,t);n.appendChild(J1(e,t,o));let i=ds(t);for(let[a,[s,l]]of(i?.points??[]).entries())n.appendChild(e2(e,s,l,a,o));return n}var t2=6,r2=1,o2="#992dff",n2={"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 Ps(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 i2=new Set(["top","bottom"]);function Mh(e,t,r,o=!1){let n=B(r,t2),i=B(r,r2);return(o?Ps(t).filter(([,,s])=>!i2.has(s)):Ps(t)).map(([s,l,d])=>{let c=V(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",o2),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=o?"ew-resize":n2[d],c})}var a2="#9b42df",s2=3,l2=1;function Fn(e,t,r,o,n=!1){let i=ot(t)??t.getBBox(),a=He(e,r,t),s=B(o,l2),l=V(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",a2),l.setAttribute("stroke-width",String(B(o,s2))),a.appendChild(l),a.append(...Mh(e,i,o,n)),a}function Th(e){let t=new Map;return{flash:(o,n=Kr)=>{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=kt(e,l,Rt);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"?ls(a,d,l,n):ss(a,d,l,n);e.appendChild(u),as(u,s);let m=s?is:An;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},m))}},destroy(){for(let o of t.values())clearTimeout(o);t.clear()}}}function $h(e,t,r){let o=n=>{r&&n.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",o),()=>{e.removeEventListener("keydown",o)}}function Ls(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 Eh(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var m2="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function Ms(e){return!!e?.closest(m2)}var Hn=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=nt(t.target);this.#o.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:Ls(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,o=nt(r);if(!o){this.#n(r);return}this.#i(o,t)}#n(t){Ms(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let o=Ls(r);this.#r.dispatch(Eh(t.id,o)),this.#o.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:o});let n=kt(this.#e,t.id,Rt);n&&!n.hasAttribute("tabindex")&&n.setAttribute("tabindex","-1"),n?.focus({preventScroll:!0})}};var p2=4,Ts=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=!!nt(r)||Ms(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:dr(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&&t.button===0&&this.#o.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>p2&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&dr(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 Nh(e){let{display:t,emitter:r,diagramId:o,selection:n,selectable:i}=e,a=new Hn(t.svg,r,o,n);return new Ts(t,a,i).bind()}function $s(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=kt(e,n,Rt);if(!i)continue;let a=r.get(n),s=a?.role==="link"?Dn(o,i,n,e):a?.role==="path"?_n(o,i,n,e):a?.role==="isometric"?Gn(o,i,n,e):Fn(o,i,n,e,a?ns.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(Bn(o,i,n,e))}}var Vn=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),$s(this.#e,this.#n,this.#r),this.#o.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#n.size>0&&$s(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=nt(o);n&&this.remember(n)}this.dispatch({type:"set",ids:t})}};function Oh(e,t){let r=o=>{dr(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 Bh(e,t,r,o={}){let n=o.selectable??!0,i=new Vn(e.svg,t,r),a=Nh({display:e,emitter:t,diagramId:r,selection:i,selectable:n}),s=Oh(e,i),l=$h(e.svg,i,n),d=Th(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 As={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 f2=`
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
- `,Bh={name:"button",fragmentSource:m2,replacesBaseFill:!0};var p2=`
70
+ `,Ih={name:"button",fragmentSource:f2,replacesBaseFill:!0};var h2=`
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
- `,Ih={name:"chromaticGlassPlate",fragmentSource:p2,usesBackdrop:!0,replacesBaseFill:!0};var f2=`
136
+ `,Gh={name:"chromaticGlassPlate",fragmentSource:h2,usesBackdrop:!0,replacesBaseFill:!0};var g2=`
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
- `,Gh={name:"chromaticHalo",fragmentSource:f2};var h2=`
202
+ `,Dh={name:"chromaticHalo",fragmentSource:g2};var y2=`
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
- `,Dh={name:"eclipseOrb",fragmentSource:h2};var g2=`
254
+ `,_h={name:"eclipseOrb",fragmentSource:y2};var b2=`
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
- `,_h={name:"emberMatrix",fragmentSource:g2};var y2=`
326
+ `,Fh={name:"emberMatrix",fragmentSource:b2};var x2=`
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:y2};var b2=`
391
+ `,Hh={name:"emberSlits",fragmentSource:x2};var S2=`
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:b2,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 x2=`
543
+ `,Vh={name:"glassDots",fragmentSource:S2,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 C2=`
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
- `,Vh={name:"glassRefraction",fragmentSource:x2,usesBackdrop:!0};var S2=`
645
+ `,Wh={name:"glassRefraction",fragmentSource:C2,usesBackdrop:!0};var k2=`
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
- `,Wh={name:"glowCard",fragmentSource:S2,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 C2=`
748
+ `,zh={name:"glowCard",fragmentSource:k2,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 R2=`
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
- `,zh={name:"halftoneHalo",fragmentSource:C2};var k2=`
824
+ `,Yh={name:"halftoneHalo",fragmentSource:R2};var w2=`
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
- `,Yh={name:"halo",fragmentSource:k2};var R2=`
896
+ `,Uh={name:"halo",fragmentSource:w2};var v2=`
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
- `,Uh={name:"ledMatrix",fragmentSource:R2,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 w2=`
1009
+ `,jh={name:"ledMatrix",fragmentSource:v2,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 P2=`
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
- `,jh={name:"lightBand",fragmentSource:w2,defaultParameters:{speed:.3,intensity:1,thickness:.035,bloom:1,wave:1,grain:.02,cornerRadius:.02,baseColor:"#0f0e14",colorA:"#7ea8ff",colorB:"#c13fd6",colorC:"#ff6fb8"}};var v2=`
1066
+ `,Xh={name:"lightBand",fragmentSource:P2,defaultParameters:{speed:.3,intensity:1,thickness:.035,bloom:1,wave:1,grain:.02,cornerRadius:.02,baseColor:"#0f0e14",colorA:"#7ea8ff",colorB:"#c13fd6",colorC:"#ff6fb8"}};var L2=`
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
- `,Xh={name:"lumenPortal",fragmentSource:v2};var P2=`
1121
+ `,qh={name:"lumenPortal",fragmentSource:L2};var M2=`
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
- `,qh={name:"lumenPortalLight",fragmentSource:P2};var L2=`
1177
+ `,Kh={name:"lumenPortalLight",fragmentSource:M2};var T2=`
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
- `,Kh={name:"orb",fragmentSource:L2};var M2=`
1210
+ `,Zh={name:"orb",fragmentSource:T2};var $2=`
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
- `,Zh={name:"pixelConstellation",fragmentSource:M2};var T2=`
1307
+ `,Qh={name:"pixelConstellation",fragmentSource:$2};var A2=`
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
- `,Qh={name:"plasmaGauge",fragmentSource:T2,replacesBaseFill:!0};var $2=`
1406
+ `,Jh={name:"plasmaGauge",fragmentSource:A2,replacesBaseFill:!0};var E2=`
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
- `,Jh={name:"prismSlats",fragmentSource:$2};var A2=`
1478
+ `,eg={name:"prismSlats",fragmentSource:E2};var N2=`
1479
1479
  precision highp float;
1480
1480
 
1481
1481
  uniform float uTime;
@@ -1572,7 +1572,7 @@ void main() {
1572
1572
  vec3 premultiplied = color * body * intensity + haloColor * halo;
1573
1573
  gl_FragColor = vec4(clamp(premultiplied, 0.0, 1.0), clamp(alpha, 0.0, 1.0));
1574
1574
  }
1575
- `,eg={name:"reactivePanel",fragmentSource:A2,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 E2=`
1575
+ `,tg={name:"reactivePanel",fragmentSource:N2,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 O2=`
1576
1576
  precision highp float;
1577
1577
 
1578
1578
  uniform vec2 uResolution;
@@ -1674,7 +1674,7 @@ void main() {
1674
1674
  vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
1675
1675
  gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
1676
1676
  }
1677
- `,tg={name:"ruler",fragmentSource:E2,replacesBaseFill:!0};var N2=`
1677
+ `,rg={name:"ruler",fragmentSource:O2,replacesBaseFill:!0};var B2=`
1678
1678
  precision highp float;
1679
1679
 
1680
1680
  uniform vec2 uResolution;
@@ -1756,7 +1756,7 @@ void main() {
1756
1756
  color += (hash(gl_FragCoord.xy) - 0.5) * max(uGrain, 0.0);
1757
1757
  gl_FragColor = vec4(clamp(color, 0.0, 1.0), shape);
1758
1758
  }
1759
- `,rg={name:"silkFolds",fragmentSource:N2,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 O2=`
1759
+ `,og={name:"silkFolds",fragmentSource:B2,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 I2=`
1760
1760
  precision highp float;
1761
1761
 
1762
1762
  uniform vec2 uResolution;
@@ -1829,7 +1829,7 @@ void main() {
1829
1829
  vec3 premultiplied = orbColor * body + plumeColor * (1.0 - body) * plume;
1830
1830
  gl_FragColor = vec4(clamp(premultiplied * frameFade * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1831
1831
  }
1832
- `,og={name:"smearOrb",fragmentSource:O2,replacesBaseFill:!0};var B2=`
1832
+ `,ng={name:"smearOrb",fragmentSource:I2,replacesBaseFill:!0};var G2=`
1833
1833
  precision highp float;
1834
1834
 
1835
1835
  uniform vec2 uResolution;
@@ -1885,7 +1885,7 @@ void main() {
1885
1885
  float alpha = tick * mix(0.32, 1.0, lit) * max(uIntensity, 0.0);
1886
1886
  gl_FragColor = vec4(color * alpha, clamp(alpha, 0.0, 1.0));
1887
1887
  }
1888
- `,ng={name:"tickScale",fragmentSource:B2,replacesBaseFill:!0};var I2=`
1888
+ `,ig={name:"tickScale",fragmentSource:G2,replacesBaseFill:!0};var D2=`
1889
1889
  precision highp float;
1890
1890
 
1891
1891
  uniform float uTime;
@@ -1962,7 +1962,7 @@ void main() {
1962
1962
  vec3 premultiplied = color * body + uColor * (1.0 - body) * halo * 0.48;
1963
1963
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1964
1964
  }
1965
- `,ig={name:"violetGlass",fragmentSource:I2};var G2=`
1965
+ `,ag={name:"violetGlass",fragmentSource:D2};var _2=`
1966
1966
  precision highp float;
1967
1967
 
1968
1968
  uniform float uTime;
@@ -2029,7 +2029,7 @@ void main() {
2029
2029
  premultiplied += mix(uShadowColor, uColor, 0.36) * (1.0 - body) * outside;
2030
2030
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
2031
2031
  }
2032
- `,ag={name:"violetGlassLight",fragmentSource:G2};var D2=`
2032
+ `,sg={name:"violetGlassLight",fragmentSource:_2};var F2=`
2033
2033
  precision highp float;
2034
2034
 
2035
2035
  uniform float uTime;
@@ -2116,7 +2116,7 @@ void main() {
2116
2116
  float alpha = 1.0 - smoothstep(0.985, 1.0, edge);
2117
2117
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0), 0.0, 1.0), alpha);
2118
2118
  }
2119
- `,sg={name:"vortex",fragmentSource:D2,defaultParameters:{speed:.3,intensity:1,rings:12,ringWidth:.28,twist:.6,arms:0,wobble:.12,variation:.85,offsetX:0,offsetY:0,squash:1,eye:.3,angle:215,spread:.6,glow:.6,gloss:.45,glossHeight:.4,vignette:.6,grain:.02,color:"#05060f",accent:"#e0368f",cool:"#3d4bff"}};var _2=`
2119
+ `,lg={name:"vortex",fragmentSource:F2,defaultParameters:{speed:.3,intensity:1,rings:12,ringWidth:.28,twist:.6,arms:0,wobble:.12,variation:.85,offsetX:0,offsetY:0,squash:1,eye:.3,angle:215,spread:.6,glow:.6,gloss:.45,glossHeight:.4,vignette:.6,grain:.02,color:"#05060f",accent:"#e0368f",cool:"#3d4bff"}};var H2=`
2120
2120
  precision highp float;
2121
2121
 
2122
2122
  uniform float uTime;
@@ -2184,7 +2184,7 @@ void main() {
2184
2184
  float alpha = 1.0 - smoothstep(0.985, 1.0, edge);
2185
2185
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0), 0.0, 1.0), alpha);
2186
2186
  }
2187
- `,lg={name:"waves",fragmentSource:_2,defaultParameters:{speed:.25,intensity:1,layers:5,level:0,amplitude:.14,frequency:3.2,tilt:-12,softness:.05,edge:.5,shade:.6,glow:.5,vignette:.4,grain:.02,color:"#0e0828",accent:"#6b3fd4",cool:"#2f5fe0",highlight:"#b9a0ff"}};var F2=[Kh,Yh,zh,Gh,Ih,Vh,Fh,og,Zh,Qh,ng,tg,Bh,Jh,Dh,_h,ig,ag,Xh,qh,eg,Uh,jh,rg,Wh,Hh,sg,lg],H2=new Map(F2.map(e=>[e.name,e]));function Es(e){return H2.get(e)}var V2=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function W2(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let o=t.getComputedStyle(r).backgroundColor;if(o&&!V2.test(o.trim()))return o}}function z2(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=W2(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 dg(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(z2(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 it(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 Zr(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function be(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform1f(o,r)}function Qr(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform3f(o,...r)}function Wn(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform2f(o,...r)}function zn(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function Y2(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 cg(e,t){for(let[r,o]of Object.entries(e.parameters)){let n=zn(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),be(e,n,l);continue}be(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=Y2(r,o);if(i!==void 0){be(e,n,i);continue}/^#[0-9a-f]{6}$/i.test(o)&&Qr(e,n,it(o,[0,0,0]))}}var U2=`
2187
+ `,dg={name:"waves",fragmentSource:H2,defaultParameters:{speed:.25,intensity:1,layers:5,level:0,amplitude:.14,frequency:3.2,tilt:-12,softness:.05,edge:.5,shade:.6,glow:.5,vignette:.4,grain:.02,color:"#0e0828",accent:"#6b3fd4",cool:"#2f5fe0",highlight:"#b9a0ff"}};var V2=[Zh,Uh,Yh,Dh,Gh,Wh,Hh,ng,Qh,Jh,ig,rg,Ih,eg,_h,Fh,ag,sg,qh,Kh,tg,jh,Xh,og,zh,Vh,lg,dg],W2=new Map(V2.map(e=>[e.name,e]));function Es(e){return W2.get(e)}var z2=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function Y2(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let o=t.getComputedStyle(r).backgroundColor;if(o&&!z2.test(o.trim()))return o}}function U2(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=Y2(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 cg(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(U2(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 it(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 Zr(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function be(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform1f(o,r)}function Qr(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform3f(o,...r)}function Wn(e,t,r){let o=e.gl.getUniformLocation(e.program,t);o&&e.gl.uniform2f(o,...r)}function zn(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function j2(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 ug(e,t){for(let[r,o]of Object.entries(e.parameters)){let n=zn(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),be(e,n,l);continue}be(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=j2(r,o);if(i!==void 0){be(e,n,i);continue}/^#[0-9a-f]{6}$/i.test(o)&&Qr(e,n,it(o,[0,0,0]))}}var X2=`
2188
2188
  attribute vec2 aPosition;
2189
2189
  varying vec2 vUv;
2190
2190
 
@@ -2192,12 +2192,12 @@ void main() {
2192
2192
  vUv = aPosition * 0.5 + 0.5;
2193
2193
  gl_Position = vec4(aPosition, 0.0, 1.0);
2194
2194
  }
2195
- `;function ug(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 mg(e,t){let r=ug(e,e.VERTEX_SHADER,U2),o=ug(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 pg(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 j2=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function fg(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function hg(e){let t=Number(e.getAttribute("data-sf-shader-padding"));return Number.isFinite(t)?Math.max(0,t):0}function X2(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,j2,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 q2(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 gg(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),o=r?Es(r):void 0,n=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!o||!n)return;let i=mg(n,o.fragmentSource);if(!i)return;n.useProgram(i);let a=X2(n,i);if(!a){n.deleteProgram(i);return}let s=o.usesBackdrop===!0,l=q2(t,o),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{programName:o.name,owner:t,canvas:e,gl:n,program:i,buffer:a,parameters:{...o.defaultParameters,...fg(t)},surfacePadding:hg(t),smoothed:new Map,pointer:{x:.5,y:.5},hovering:!1,hover:0,trail:[],backdropTexture:s?pg(n):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:it(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function Ns(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 yg(e,t){let r=e.canvas.closest("[data-sf-shader]"),o=r?.getAttribute("data-sf-shader"),n=o?Es(o):void 0;return!r||!t.contains(e.canvas)||!n||n.name!==e.programName||n.replacesBaseFill||e.baseGeometry?!1:(e.owner=r,e.parameters={...n.defaultParameters,...fg(r)},e.surfacePadding=hg(r),e.shapeColor=it(r.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),!0)}function K2(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:(b,S)=>{if(Math.abs(m)<1e-6)return[b,S];let R=b-c,k=S-u;return[(d*R-l*k)/m,(-s*R+a*k)/m]}}}function Os(e,t,r){return Zr(e[t],r)}function Z2(e,t,r,o,n,i){return[(e-r)/n,(t-o)/i]}function Yn(e){let t=e.filter(r=>r.owner.getAttribute("data-sf-shader")==="reactivePanel").flatMap(r=>{let o=K2(r);return o?[{surface:r,geometry:o}]:[]});for(let r of t){let o=[];for(let S of t){if(S.surface===r.surface)continue;let R=Math.max(0,S.surface.smoothed.get("emission")??Os(S.surface.parameters,"emission",0));if(R<=1e-4)continue;let k=Math.hypot(S.geometry.centerX-r.geometry.centerX,S.geometry.centerY-r.geometry.centerY);o.push({candidate:S,emission:R,weight:R/Math.max(k,1)})}let n=o.reduce((S,R)=>S+R.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 S of o){let R=S.weight/n;i+=S.candidate.geometry.centerX*R,a+=S.candidate.geometry.centerY*R,s+=S.emission,l+=Math.max(1,Os(S.candidate.surface.parameters,"glowRadius",90))*R;let k=it(S.candidate.surface.parameters.lightColor,[.35,.82,1]);d[0]+=k[0]*R,d[1]+=k[1]*R,d[2]+=k[2]*R}let c=Math.max(0,Os(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,b]=Z2(u,m,f,h,r.geometry.width,r.geometry.height);r.surface.reactiveLight={x:y,y:b,strength:s*c*1.8,radius:l,color:d}}}function xg(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 Sg(e,t){if(!e.backdropTexture)return;xg(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 Q2=2560,bg=16;function J2(e){let t=e.getBoundingClientRect(),r=Math.min(globalThis.devicePixelRatio||1,3),o=Math.min(1,Q2/Math.max(1,t.width*r,t.height*r)),n=Math.max(1,Math.round((t.width||e.clientWidth)*r*o)),i=Math.max(1,Math.round((t.height||e.clientHeight)*r*o));return(e.width!==n||e.height!==i)&&(e.width=n,e.height=i),{width:n,height:i,density:r,fit:o}}function eP(e,t){let{gl:r}=e;xg(e),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t);let o=r.getUniformLocation(e.program,"uBackdrop");o&&r.uniform1i(o,0),Wn(e,"uBackdropOrigin",e.backdropOrigin),Wn(e,"uBackdropScale",e.backdropScale)}function tP(e){let{parameters:t}=e;for(let[r,o]of Object.entries(As.numbers))be(e,zn(r),Zr(t[r],o));for(let[r,o]of Object.entries(As.colors))Qr(e,zn(r),it(t[r],[...o]));Qr(e,"uShapeColor",e.shapeColor)}function rP(e,t,r){let{gl:o,parameters:n}=e;e.hover+=((e.hovering?1:0)-e.hover)*(1-Math.exp(-r/.18)),Wn(e,"uPointer",[e.pointer.x,e.pointer.y]),be(e,"uHover",e.hover);let i=Zr(n.trail,0),a=new Float32Array(bg*3);i>0&&e.trail.slice(-bg).forEach((l,d)=>{a.set([l.x,l.y,Math.exp(-Math.max(t-l.at,0)/i)],d*3)});let s=o.getUniformLocation(e.program,"uWake[0]");s&&o.uniform3fv(s,a)}function oP(e){e.reactiveLight&&(be(e,"uLightX",e.reactiveLight.x),be(e,"uLightY",e.reactiveLight.y),be(e,"uLightStrength",e.reactiveLight.strength),be(e,"uGlowRadius",e.reactiveLight.radius),Qr(e,"uLightColor",e.reactiveLight.color))}function cr(e,t){let{canvas:r,gl:o}=e,{width:n,height:i,density:a,fit:s}=J2(r);o.viewport(0,0,n,i),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.useProgram(e.program);let l=o.getUniformLocation(e.program,"uResolution");l&&o.uniform2f(l,n,i);let d=Number(e.owner.getAttribute("width"));be(e,"uPixelScale",Number.isFinite(d)&&d>0?n/d:a*s),be(e,"uTime",t),e.backdropTexture&&eP(e,e.backdropTexture),tP(e);let c=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,cg(e,c),rP(e,t,c),oP(e),be(e,"uSurfacePadding",e.surfacePadding),o.drawArrays(o.TRIANGLES,0,6)}function Cg(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 nP=120,iP=.055,aP=16;function sP(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 cr(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function lP(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){Yn(e);for(let i of e)cr(i,o)}return n}function dP(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 cP(e){return new Map(e.flatMap(t=>{let r=t.owner.getAttribute("data-sf-id");return r?[[r,{smoothed:new Map(t.smoothed),reactiveLight:t.reactiveLight,pointer:t.pointer,hover:t.hover,hovering:t.hovering,trail:t.trail}]]:[]}))}function uP(e,t,r){return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(o=>{let n=r.get(o);if(n)return[n];let i=gg(o),a=i?.owner.getAttribute("data-sf-id"),s=a?t.get(a):void 0;return i&&s&&Object.assign(i,s),i?[i]:[]})}function mP(e,t,r){let o=e.canvas.getBoundingClientRect(),n=o.width>0&&o.height>0&&t.clientX>=o.left&&t.clientX<=o.right&&t.clientY>=o.top&&t.clientY<=o.bottom;if(e.hovering=n,!n)return;e.pointer={x:(t.clientX-o.left)/o.width,y:1-(t.clientY-o.top)/o.height};let i=e.trail[e.trail.length-1];(!i||r-i.at>=iP)&&(e.trail.push({...e.pointer,at:r}),e.trail.length>aP&&e.trail.shift())}var Bs=class{constructor(t){this.svg=t;this.view=t.ownerDocument.defaultView,this.clock=Cg(this.view),this.unwatch=dP(t,this.view,this.scheduleRecapture),t.addEventListener("pointermove",this.track),t.addEventListener("pointerleave",this.leave),this.refresh()}svg;surfaces=[];frame;backdropGeneration=0;recapture;view;clock;unwatch;capture(){return sP(this.svg,this.surfaces,this.clock.now())}setParameters(t,r){return lP(this.surfaces,t,r,this.clock.now())}setPaused(t){this.clock.setPaused(t)}refresh(){let t=cP(this.surfaces);this.cancelFrame();let r=new Map;for(let n of this.surfaces)yg(n,this.svg)&&r.set(n.canvas,n);for(let n of this.surfaces)r.has(n.canvas)||Ns(n);let o=++this.backdropGeneration;this.surfaces=uP(this.svg,t,r),Yn(this.surfaces),this.captureBackdrops(o),this.surfaces.length>0&&this.startFrames()}destroy(){this.backdropGeneration+=1,this.unwatch(),this.svg.removeEventListener("pointermove",this.track),this.svg.removeEventListener("pointerleave",this.leave),this.recapture!==void 0&&this.view?.clearTimeout(this.recapture),this.stop()}draw=t=>{if(!this.clock.paused()){Yn(this.surfaces);for(let r of this.surfaces)cr(r,t/1e3-this.clock.spent())}this.frame=this.view?.requestAnimationFrame(this.draw)};cancelFrame(){this.frame!==void 0&&(this.view?.cancelAnimationFrame(this.frame),this.frame=void 0)}stop(){this.cancelFrame();for(let t of this.surfaces)Ns(t);this.surfaces=[]}captureBackdrops(t){for(let r of this.surfaces)r.usesBackdrop&&dg(this.svg,r.owner).then(o=>{o&&t===this.backdropGeneration&&Sg(r,o)})}startFrames(){if(!this.view?.requestAnimationFrame){for(let t of this.surfaces)cr(t,0);return}if(this.clock.paused())for(let t of this.surfaces)cr(t,this.clock.now());this.frame=this.view.requestAnimationFrame(this.draw)}scheduleRecapture=()=>{this.recapture!==void 0&&this.view?.clearTimeout(this.recapture),this.recapture=this.view?.setTimeout(()=>{this.recapture=void 0,this.captureBackdrops(this.backdropGeneration)},nP)};track=t=>{let r=this.clock.now();for(let o of this.surfaces)mP(o,t,r)};leave=()=>{for(let t of this.surfaces)t.hovering=!1}};function Is(e){return new Bs(e)}function Un(e,t){let r=e.svg??(e.source!=null?Rn(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 kg(e){let t=En(e);if(!Nn(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function Rg(e){let t=En(e);if(!Nn(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var jn=class{constructor(t,r,o){this.options=t;this.diagramId=o;this.display=gh(t.container,r),this.shaderSurfaces=Is(this.display.svg),this.documentComponents=Ka(this.display.svg),this.interaction=t.interactive?Oh(this.display,this.emitter,o,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new $n;display;interaction;shaderSurfaces;documentComponents;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=ih(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 os(this.svg,this.shaderSurfaces.capture())}exportImage(t){return ts(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=nh(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=Un(t,this.options.renderOptions);Rg(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 wg(e){let t=e.diagramId??"diagram",r=Un(e,e.renderOptions);kg(r);let o=new jn(e,r,t);return o.announceReady(),o}var pP=`
2195
+ `;function mg(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 pg(e,t){let r=mg(e,e.VERTEX_SHADER,X2),o=mg(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 fg(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 q2=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function hg(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function gg(e){let t=Number(e.getAttribute("data-sf-shader-padding"));return Number.isFinite(t)?Math.max(0,t):0}function K2(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,q2,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 Z2(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 yg(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),o=r?Es(r):void 0,n=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!o||!n)return;let i=pg(n,o.fragmentSource);if(!i)return;n.useProgram(i);let a=K2(n,i);if(!a){n.deleteProgram(i);return}let s=o.usesBackdrop===!0,l=Z2(t,o),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{programName:o.name,owner:t,canvas:e,gl:n,program:i,buffer:a,parameters:{...o.defaultParameters,...hg(t)},surfacePadding:gg(t),smoothed:new Map,pointer:{x:.5,y:.5},hovering:!1,hover:0,trail:[],backdropTexture:s?fg(n):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:it(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function Ns(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 bg(e,t){let r=e.canvas.closest("[data-sf-shader]"),o=r?.getAttribute("data-sf-shader"),n=o?Es(o):void 0;return!r||!t.contains(e.canvas)||!n||n.name!==e.programName||n.replacesBaseFill||e.baseGeometry?!1:(e.owner=r,e.parameters={...n.defaultParameters,...hg(r)},e.surfacePadding=gg(r),e.shapeColor=it(r.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),!0)}function Q2(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:(b,S)=>{if(Math.abs(m)<1e-6)return[b,S];let R=b-c,k=S-u;return[(d*R-l*k)/m,(-s*R+a*k)/m]}}}function Os(e,t,r){return Zr(e[t],r)}function J2(e,t,r,o,n,i){return[(e-r)/n,(t-o)/i]}function Yn(e){let t=e.filter(r=>r.owner.getAttribute("data-sf-shader")==="reactivePanel").flatMap(r=>{let o=Q2(r);return o?[{surface:r,geometry:o}]:[]});for(let r of t){let o=[];for(let S of t){if(S.surface===r.surface)continue;let R=Math.max(0,S.surface.smoothed.get("emission")??Os(S.surface.parameters,"emission",0));if(R<=1e-4)continue;let k=Math.hypot(S.geometry.centerX-r.geometry.centerX,S.geometry.centerY-r.geometry.centerY);o.push({candidate:S,emission:R,weight:R/Math.max(k,1)})}let n=o.reduce((S,R)=>S+R.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 S of o){let R=S.weight/n;i+=S.candidate.geometry.centerX*R,a+=S.candidate.geometry.centerY*R,s+=S.emission,l+=Math.max(1,Os(S.candidate.surface.parameters,"glowRadius",90))*R;let k=it(S.candidate.surface.parameters.lightColor,[.35,.82,1]);d[0]+=k[0]*R,d[1]+=k[1]*R,d[2]+=k[2]*R}let c=Math.max(0,Os(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,b]=J2(u,m,f,h,r.geometry.width,r.geometry.height);r.surface.reactiveLight={x:y,y:b,strength:s*c*1.8,radius:l,color:d}}}function Sg(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 Cg(e,t){if(!e.backdropTexture)return;Sg(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 eP=2560,xg=16;function tP(e){let t=e.getBoundingClientRect(),r=Math.min(globalThis.devicePixelRatio||1,3),o=Math.min(1,eP/Math.max(1,t.width*r,t.height*r)),n=Math.max(1,Math.round((t.width||e.clientWidth)*r*o)),i=Math.max(1,Math.round((t.height||e.clientHeight)*r*o));return(e.width!==n||e.height!==i)&&(e.width=n,e.height=i),{width:n,height:i,density:r,fit:o}}function rP(e,t){let{gl:r}=e;Sg(e),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,t);let o=r.getUniformLocation(e.program,"uBackdrop");o&&r.uniform1i(o,0),Wn(e,"uBackdropOrigin",e.backdropOrigin),Wn(e,"uBackdropScale",e.backdropScale)}function oP(e){let{parameters:t}=e;for(let[r,o]of Object.entries(As.numbers))be(e,zn(r),Zr(t[r],o));for(let[r,o]of Object.entries(As.colors))Qr(e,zn(r),it(t[r],[...o]));Qr(e,"uShapeColor",e.shapeColor)}function nP(e,t,r){let{gl:o,parameters:n}=e;e.hover+=((e.hovering?1:0)-e.hover)*(1-Math.exp(-r/.18)),Wn(e,"uPointer",[e.pointer.x,e.pointer.y]),be(e,"uHover",e.hover);let i=Zr(n.trail,0),a=new Float32Array(xg*3);i>0&&e.trail.slice(-xg).forEach((l,d)=>{a.set([l.x,l.y,Math.exp(-Math.max(t-l.at,0)/i)],d*3)});let s=o.getUniformLocation(e.program,"uWake[0]");s&&o.uniform3fv(s,a)}function iP(e){e.reactiveLight&&(be(e,"uLightX",e.reactiveLight.x),be(e,"uLightY",e.reactiveLight.y),be(e,"uLightStrength",e.reactiveLight.strength),be(e,"uGlowRadius",e.reactiveLight.radius),Qr(e,"uLightColor",e.reactiveLight.color))}function cr(e,t){let{canvas:r,gl:o}=e,{width:n,height:i,density:a,fit:s}=tP(r);o.viewport(0,0,n,i),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.useProgram(e.program);let l=o.getUniformLocation(e.program,"uResolution");l&&o.uniform2f(l,n,i);let d=Number(e.owner.getAttribute("width"));be(e,"uPixelScale",Number.isFinite(d)&&d>0?n/d:a*s),be(e,"uTime",t),e.backdropTexture&&rP(e,e.backdropTexture),oP(e);let c=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,ug(e,c),nP(e,t,c),iP(e),be(e,"uSurfacePadding",e.surfacePadding),o.drawArrays(o.TRIANGLES,0,6)}function kg(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 aP=120,sP=.055,lP=16;function dP(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 cr(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function cP(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){Yn(e);for(let i of e)cr(i,o)}return n}function uP(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 mP(e){return new Map(e.flatMap(t=>{let r=t.owner.getAttribute("data-sf-id");return r?[[r,{smoothed:new Map(t.smoothed),reactiveLight:t.reactiveLight,pointer:t.pointer,hover:t.hover,hovering:t.hovering,trail:t.trail}]]:[]}))}function pP(e,t,r){return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(o=>{let n=r.get(o);if(n)return[n];let i=yg(o),a=i?.owner.getAttribute("data-sf-id"),s=a?t.get(a):void 0;return i&&s&&Object.assign(i,s),i?[i]:[]})}function fP(e,t,r){let o=e.canvas.getBoundingClientRect(),n=o.width>0&&o.height>0&&t.clientX>=o.left&&t.clientX<=o.right&&t.clientY>=o.top&&t.clientY<=o.bottom;if(e.hovering=n,!n)return;e.pointer={x:(t.clientX-o.left)/o.width,y:1-(t.clientY-o.top)/o.height};let i=e.trail[e.trail.length-1];(!i||r-i.at>=sP)&&(e.trail.push({...e.pointer,at:r}),e.trail.length>lP&&e.trail.shift())}var Bs=class{constructor(t){this.svg=t;this.view=t.ownerDocument.defaultView,this.clock=kg(this.view),this.unwatch=uP(t,this.view,this.scheduleRecapture),t.addEventListener("pointermove",this.track),t.addEventListener("pointerleave",this.leave),this.refresh()}svg;surfaces=[];frame;backdropGeneration=0;recapture;view;clock;unwatch;capture(){return dP(this.svg,this.surfaces,this.clock.now())}setParameters(t,r){return cP(this.surfaces,t,r,this.clock.now())}setPaused(t){this.clock.setPaused(t)}refresh(){let t=mP(this.surfaces);this.cancelFrame();let r=new Map;for(let n of this.surfaces)bg(n,this.svg)&&r.set(n.canvas,n);for(let n of this.surfaces)r.has(n.canvas)||Ns(n);let o=++this.backdropGeneration;this.surfaces=pP(this.svg,t,r),Yn(this.surfaces),this.captureBackdrops(o),this.surfaces.length>0&&this.startFrames()}destroy(){this.backdropGeneration+=1,this.unwatch(),this.svg.removeEventListener("pointermove",this.track),this.svg.removeEventListener("pointerleave",this.leave),this.recapture!==void 0&&this.view?.clearTimeout(this.recapture),this.stop()}draw=t=>{if(!this.clock.paused()){Yn(this.surfaces);for(let r of this.surfaces)cr(r,t/1e3-this.clock.spent())}this.frame=this.view?.requestAnimationFrame(this.draw)};cancelFrame(){this.frame!==void 0&&(this.view?.cancelAnimationFrame(this.frame),this.frame=void 0)}stop(){this.cancelFrame();for(let t of this.surfaces)Ns(t);this.surfaces=[]}captureBackdrops(t){for(let r of this.surfaces)r.usesBackdrop&&cg(this.svg,r.owner).then(o=>{o&&t===this.backdropGeneration&&Cg(r,o)})}startFrames(){if(!this.view?.requestAnimationFrame){for(let t of this.surfaces)cr(t,0);return}if(this.clock.paused())for(let t of this.surfaces)cr(t,this.clock.now());this.frame=this.view.requestAnimationFrame(this.draw)}scheduleRecapture=()=>{this.recapture!==void 0&&this.view?.clearTimeout(this.recapture),this.recapture=this.view?.setTimeout(()=>{this.recapture=void 0,this.captureBackdrops(this.backdropGeneration)},aP)};track=t=>{let r=this.clock.now();for(let o of this.surfaces)fP(o,t,r)};leave=()=>{for(let t of this.surfaces)t.hovering=!1}};function Is(e){return new Bs(e)}function Un(e,t){let r=e.svg??(e.source!=null?Rn(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 Rg(e){let t=En(e);if(!Nn(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function wg(e){let t=En(e);if(!Nn(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var jn=class{constructor(t,r,o){this.options=t;this.diagramId=o;this.display=yh(t.container,r),this.shaderSurfaces=Is(this.display.svg),this.documentComponents=Ka(this.display.svg),this.interaction=t.interactive?Bh(this.display,this.emitter,o,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new $n;display;interaction;shaderSurfaces;documentComponents;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=ah(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 os(this.svg,this.shaderSurfaces.capture())}exportImage(t){return ts(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=ih(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=Un(t,this.options.renderOptions);wg(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 vg(e){let t=e.diagramId??"diagram",r=Un(e,e.renderOptions);Rg(r);let o=new jn(e,r,t);return o.announceReady(),o}var hP=`
2196
2196
  :host { display: block; position: relative; }
2197
2197
  .sf-container { width: 100%; height: 100%; }
2198
2198
  svg { display: block; max-width: 100%; }
2199
2199
  .sf-error { color: #b91c1c; font: 13px/1.4 system-ui, sans-serif; padding: 8px; white-space: pre-wrap; }
2200
2200
  [data-sf-role="entity"], [data-sf-role="link"] { cursor: pointer; }
2201
2201
  [data-sf-selected] { stroke: #2563eb !important; stroke-width: 4 !important; }
2202
- `;function fP(e){let t=document.createElement("style");t.textContent=pP;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function hP(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function gP(e,t,r){return wg({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function yP(e,t,r){e.innerHTML=Rn(t,{padding:r.padding}).svg}function vg(e,t){let r=fP(e);if(t.source===null)return{viewer:null,rendered:!1};try{let o=t.interactive?gP(r,t.source,t):null;return t.interactive||yP(r,t.source,t),{viewer:o,rendered:!0}}catch(o){return hP(r,o),{viewer:null,rendered:!1}}}var bP=typeof HTMLElement>"u"?class{}:HTMLElement,wt=class extends bP{static get observedAttributes(){return[...Fs]}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=Hs(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=vg(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function Gs(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,wt)}Gs();return Ag(xP);})();
2202
+ `;function gP(e){let t=document.createElement("style");t.textContent=hP;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function yP(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function bP(e,t,r){return vg({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function xP(e,t,r){e.innerHTML=Rn(t,{padding:r.padding}).svg}function Pg(e,t){let r=gP(e);if(t.source===null)return{viewer:null,rendered:!1};try{let o=t.interactive?bP(r,t.source,t):null;return t.interactive||xP(r,t.source,t),{viewer:o,rendered:!0}}catch(o){return yP(r,o),{viewer:null,rendered:!1}}}var SP=typeof HTMLElement>"u"?class{}:HTMLElement,wt=class extends SP{static get observedAttributes(){return[...Fs]}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=Hs(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=Pg(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function Gs(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,wt)}Gs();return Eg(CP);})();
2203
2203
  //# sourceMappingURL=stickyflow-diagram.global.js.map