stickyflow 0.3.0 → 0.5.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 (65) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +51 -5
  3. package/dist/binding/index.cjs +34 -0
  4. package/dist/binding/index.cjs.map +1 -0
  5. package/dist/binding/index.d.cts +11 -0
  6. package/dist/binding/index.d.ts +11 -0
  7. package/dist/binding/index.js +5 -0
  8. package/dist/binding/index.js.map +1 -0
  9. package/dist/{chunk-XEN5QIIJ.js → chunk-7VW2XKVB.js} +3 -3
  10. package/dist/{chunk-XEN5QIIJ.js.map → chunk-7VW2XKVB.js.map} +1 -1
  11. package/dist/chunk-BODZN3ZI.js +1182 -0
  12. package/dist/chunk-BODZN3ZI.js.map +1 -0
  13. package/dist/{chunk-CSXQD3ON.js → chunk-G7NRK5AG.js} +1128 -1081
  14. package/dist/chunk-G7NRK5AG.js.map +1 -0
  15. package/dist/{chunk-BYMIYXP5.js → chunk-IEHE6WVN.js} +197 -19
  16. package/dist/chunk-IEHE6WVN.js.map +1 -0
  17. package/dist/{chunk-HFOGKSNU.cjs → chunk-L3VJXZFD.cjs} +15 -15
  18. package/dist/{chunk-HFOGKSNU.cjs.map → chunk-L3VJXZFD.cjs.map} +1 -1
  19. package/dist/{chunk-65IVT4GK.js → chunk-LTGF5OHP.js} +1008 -631
  20. package/dist/chunk-LTGF5OHP.js.map +1 -0
  21. package/dist/chunk-TWDLOXRM.cjs +1189 -0
  22. package/dist/chunk-TWDLOXRM.cjs.map +1 -0
  23. package/dist/{chunk-UXDWH2JC.cjs → chunk-VK3T6O5Z.cjs} +1165 -1118
  24. package/dist/chunk-VK3T6O5Z.cjs.map +1 -0
  25. package/dist/{chunk-CXL254BT.cjs → chunk-XY2GZUHC.cjs} +204 -18
  26. package/dist/chunk-XY2GZUHC.cjs.map +1 -0
  27. package/dist/{chunk-DDCTNLLD.cjs → chunk-ZMLQIMJK.cjs} +1504 -1128
  28. package/dist/chunk-ZMLQIMJK.cjs.map +1 -0
  29. package/dist/index.cjs +53 -1013
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +22 -14
  32. package/dist/index.d.ts +22 -14
  33. package/dist/index.js +6 -993
  34. package/dist/index.js.map +1 -1
  35. package/dist/interaction/index.cjs +474 -305
  36. package/dist/interaction/index.cjs.map +1 -1
  37. package/dist/interaction/index.d.cts +11 -3
  38. package/dist/interaction/index.d.ts +11 -3
  39. package/dist/interaction/index.js +255 -87
  40. package/dist/interaction/index.js.map +1 -1
  41. package/dist/{render-C5X74hds.d.cts → render-CgX_y15a.d.cts} +193 -116
  42. package/dist/{render-C5X74hds.d.ts → render-CgX_y15a.d.ts} +193 -116
  43. package/dist/runtime-DnUxca3Y.d.ts +10 -0
  44. package/dist/runtime-reWgr7MP.d.cts +10 -0
  45. package/dist/{runtimeTypes-D8hPZ62T.d.ts → runtimeTypes-CEBGueYM.d.ts} +10 -5
  46. package/dist/{runtimeTypes-yTSAvtCn.d.cts → runtimeTypes-D60w6nyF.d.cts} +10 -5
  47. package/dist/stickyflow-diagram.global.js +35 -35
  48. package/dist/stickyflow-diagram.global.js.map +1 -1
  49. package/dist/{types-BDKDf4zr.d.cts → types-DYLC_lsk.d.ts} +3 -2
  50. package/dist/{types-CdgGdtoD.d.ts → types-DvhMpqrL.d.cts} +3 -2
  51. package/dist/viewer/index.cjs +9 -9
  52. package/dist/viewer/index.d.cts +4 -4
  53. package/dist/viewer/index.d.ts +4 -4
  54. package/dist/viewer/index.js +4 -4
  55. package/dist/web-component/index.cjs +6 -6
  56. package/dist/web-component/index.d.cts +2 -2
  57. package/dist/web-component/index.d.ts +2 -2
  58. package/dist/web-component/index.js +4 -4
  59. package/package.json +6 -1
  60. package/dist/chunk-65IVT4GK.js.map +0 -1
  61. package/dist/chunk-BYMIYXP5.js.map +0 -1
  62. package/dist/chunk-CSXQD3ON.js.map +0 -1
  63. package/dist/chunk-CXL254BT.cjs.map +0 -1
  64. package/dist/chunk-DDCTNLLD.cjs.map +0 -1
  65. package/dist/chunk-UXDWH2JC.cjs.map +0 -1
@@ -1,21 +1,21 @@
1
- "use strict";var Stickyflow=(()=>{var Un=Object.defineProperty;var Fp=Object.getOwnPropertyDescriptor;var Hp=Object.getOwnPropertyNames;var Vp=Object.prototype.hasOwnProperty;var Wp=(e,t)=>{for(var r in t)Un(e,r,{get:t[r],enumerable:!0})},zp=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hp(t))!Vp.call(e,o)&&o!==r&&Un(e,o,{get:()=>t[o],enumerable:!(n=Fp(t,o))||n.enumerable});return e};var Yp=e=>zp(Un({},"__esModule",{value:!0}),e);var Gk={};Wp(Gk,{StickyflowDiagram:()=>Je,defineStickyflowDiagram:()=>ia});var la=["source","interactive","padding","diagram-id"],jp=e=>e!==null&&e!=="false";function da(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:jp(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}var ca=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Shape","Text","Isometric","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource"],Fk=[...ca,"data"],Up=["top","bottom","left","right"],ua=e=>Up.includes(e);var pr=e=>ca.includes(e);var fr=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 lo=Object.defineProperty;var Sf=Object.getOwnPropertyDescriptor;var Cf=Object.getOwnPropertyNames;var Rf=Object.prototype.hasOwnProperty;var kf=(e,t)=>{for(var r in t)lo(e,r,{get:t[r],enumerable:!0})},wf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Cf(t))!Rf.call(e,o)&&o!==r&&lo(e,o,{get:()=>t[o],enumerable:!(n=Sf(t,o))||n.enumerable});return e};var vf=e=>wf(lo({},"__esModule",{value:!0}),e);var Ow={};kf(Ow,{StickyflowDiagram:()=>st,defineStickyflowDiagram:()=>ka});var Pa=["source","interactive","padding","diagram-id"],Pf=e=>e!==null&&e!=="false";function La(e){let t=e("padding"),r=t!=null&&t!==""&&Number.isFinite(Number(t))?Number(t):void 0;return{source:e("source"),interactive:Pf(e("interactive")),padding:r,diagramId:e("diagram-id")??void 0}}function Wt(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var Ta=["rollingNumber","tickScale","ruler"];function ze(e){return e!==void 0&&Ta.includes(e)}function Pr(e){return!ze(e.type)}var $a=[{type:"rollingNumber",group:"readout",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!1,size:{width:160,height:90}},{type:"tickScale",group:"readout",value:{type:"number",writable:!1,default:0},properties:{},interaction:"none",pointerScale:!0,size:{width:200,height:200}},{type:"ruler",group:"input",value:{type:"number",writable:!1,default:0},properties:{},interaction:"scale",pointerScale:!0,size:{width:120,height:360}},{type:"switch",group:"input",value:{type:"boolean",writable:!0,default:!1},properties:{accent:{type:"color",default:"#5a6bff"},track:{type:"color",default:"#cbd5e1"},thumb:{type:"color",default:"#ffffff"}},interaction:"toggle",pointerScale:!1,size:{width:52,height:30,minWidth:36,minHeight:20,aspect:1.7333333333333334},role:"switch"},{type:"checkbox",group:"input",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}},interaction:"toggle",pointerScale:!1,size:{width:160,height:24,minWidth:18,minHeight:18},role:"checkbox"},{type:"toggleButton",group:"input",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}},interaction:"toggle",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"},{type:"button",group:"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}},interaction:"press",pointerScale:!1,size:{width:120,height:40,minWidth:40,minHeight:24},role:"button"}];var Lf=0,Ma=new Map($a.map(e=>[e.type,e]));function Lr(){return Lf}function lt(e){return e===void 0?void 0:Ma.get(e)}function co(){return[...Ma.keys()]}function uo(e){return lt(e)!==void 0}var j={color:"#000000",surface:"rgba(255, 255, 255, 0.28)",divider:"rgba(0, 0, 0, 0.2)",labelColor:"rgba(0, 0, 0, 0.62)",fontFamily:"'Roboto Mono', 'SFMono-Regular', Consolas, monospace",variant:"flip",motion:"roll",fontWeight:"300",fontSize:0};function mo(e){return{color:e.color??j.color,surface:e.surface??j.surface,divider:e.divider??j.divider,labelColor:e.labelColor??j.labelColor,fontFamily:e.fontFamily??j.fontFamily,variant:e.variant??j.variant,motion:e.motion??j.motion,fontWeight:e.fontWeight??j.fontWeight,fontSize:e.fontSize??j.fontSize}}var Aa=["Project","Model","Group","Entity","Container","Path","Chart","Widget","Component","Shape","Text","Isometric","Link","Connection","Layout","Style","Shader","Axis","Series","Rule","Net","Symbol","Port","DataSource"],Zw=[...Aa,"data"],$f=["top","bottom","left","right"],Ea=e=>$f.includes(e),zt=e=>e==="Component"||e==="Widget";var Tr=e=>Aa.includes(e);var $r=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
- `?(this.line++,this.col=1):this.col++,t}};var ge=class extends Error{constructor(r,n,o){super(`SFL lex error (${n}:${o}): ${r}`);this.line=n;this.col=o;this.name="SflLexError"}line;col};var ma=e=>e!==void 0&&/^[A-Za-z_]$/.test(e),et=e=>e!==void 0&&e>="0"&&e<="9",pa=e=>e!==void 0&&/^[A-Za-z0-9_]$/.test(e);function ee(e,t,r,n={}){return{type:e,value:t,line:r.line,col:r.col,endLine:r.line,endCol:r.col,...n}}function Xn(e,t){return{...e,endLine:t.line,endCol:t.col}}function fa(e){return ma(e.peek())}function ha(e,t){let r="";for(;pa(e.peek());)r+=e.advance();return ee("ident",r,t)}function ga(e){return e==="\r"||e===`
4
- `}function ba(e,t){return e.advance()==="\r"&&e.peek()===`
5
- `&&e.advance(),ee("newline",`
6
- `,t)}function ya(e){return e.peek()==="/"&&e.peek(1)==="/"}function xa(e){for(;!e.done&&e.peek()!==`
7
- `&&e.peek()!=="\r";)e.advance()}function Sa(e){let t=e.peek();return et(t)||t==="-"&&et(e.peek(1))}function Ca(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());et(e.peek());)r+=e.advance();if(e.peek()==="."&&et(e.peek(1)))for(r+=e.advance();et(e.peek());)r+=e.advance();return ee("number",r,t,{numberValue:Number(r)})}var Xp=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],qp=e=>e!==void 0&&/[\d.]/.test(e);function Ra(e,t){let r=Xp.find(([i])=>e.startsWith(i));if(!r)return null;let[n,o]=r;if(n==="-"&&qp(e.peek(1)))return null;for(let i=0;i<n.length;i++)e.advance();return ee(o,n,t)}var Kp={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function ka(e,t){let r=e.peek(),n=r?Kp[r]:void 0;return!r||!n||r==="&"&&e.peek(1)==="&"?null:(e.advance(),ee(n,r,t))}function wa(e){return e===" "||e===" "}function va(e){e.advance()}function Zp(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function Qp(e){let t=e.split(`
8
- `),r=1/0;for(let n of t)n.trim()&&(r=Math.min(r,Zp(n)));return!Number.isFinite(r)||r===0?e:t.map(n=>n.trim()?n.slice(r):n).join(`
9
- `)}function Jp(e,t){Pa(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return Pa(e),Qp(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new ge("unterminated long string",t.line,t.col)}function Pa(e){e.advance(),e.advance(),e.advance()}function ef(e,t){e.advance();let r="";for(;!e.done;){let n=e.advance();if(n==='"')return r;if(n===`
10
- `||n==="\r")throw new ge('newline in short string (use """ for multiline)',t.line,t.col);r+=n==="\\"?tf(e,t):n}throw new ge("unterminated string",t.line,t.col)}function tf(e,t){if(e.done)throw new ge("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 ge(`invalid escape '\\${r}'`,t.line,t.col)}}function rf(e,t){return e.startsWith('"""')?Jp(e,t):ef(e,t)}function La(e,t){return ee("string",rf(e,t),t)}function Ta(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(ga(t))return ba(e,r);if(nf(e,t))return null;let n=of(e,t,r)??af(e,r);if(n)return n;throw new ge(`unexpected character '${t}'`,r.line,r.col)}function nf(e,t){return wa(t)?(va(e),!0):ya(e)?(xa(e),!0):!1}function of(e,t,r){let n=ka(e,r);return n||(t==='"'?La(e,r):Ra(e,r))}function af(e,t){return Sa(e)?Ca(e,t):fa(e)?ha(e,t):null}function Ma(e){let t=new fr(e),r=[];for(;!t.done;){let n=Ta(t);n&&r.push(Xn(n,t))}return r.push(Xn(ee("eof","",t.position()),t)),r}var F=class extends Error{constructor(r,n,o){super(`SFL parse error (${n}:${o}): ${r}`);this.line=n;this.col=o;this.name="SflParseError"}line;col};var hr=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 n=this.peek();if(n.type!==t)throw new F(`expected ${r}, got '${n.value||n.type}'`,n.line,n.col);return this.next()}expectNumber(t){let r=this.expect("number",t);if(r.numberValue===void 0)throw new F(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function At(e){let t=[e.expect("ident","path identifier").value];for(;e.at("dot");)e.next(),t.push(e.expect("ident",'identifier after "."').value);return t}function $a(e){let t=At(e),r,n;if(e.at("comma")){e.next();let o=e.expect("ident",'side after ","');if(!ua(o.value))throw new F(`expected a side (top/right/bottom/left), got '${o.value}'`,o.line,o.col);r=o.value,e.at("lparen")&&(e.next(),n=e.expectNumber('fraction inside "("'),e.expect("rparen","')'"))}return{type:"endpoint",segments:t,side:r,fraction:n}}function sf(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(gr(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(gr(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}function gr(e,t=!0){let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return sf(e);case"number":{let n=e.expectNumber("number");if(!t||!e.at("comma"))return{type:"number",value:n};let o=[n];for(;e.at("comma");)e.next(),o.push(e.expectNumber("number in tuple"));return{type:"tuple",values:o}}case"ident":return{type:"ident",segments:At(e)};default:throw new F(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var lf=new Set([">","<",">=","<=","==","!="]);function df(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function Et(e,t,r){let n=r(e);for(;df(e,t);)n={kind:"binary",operator:e.next().value,left:n,right:r(e)};return n}var cf=new Set(["||"]),uf=new Set(["&&"]),mf=new Set(["+","-"]),pf=new Set(["*","/"]);function br(e){return Et(e,cf,ff)}function ff(e){return Et(e,uf,hf)}function hf(e){return Et(e,lf,gf)}function gf(e){return Et(e,mf,bf)}function bf(e){return Et(e,pf,Oa)}function Oa(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:Oa(e)}):xf(e)}function yf(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(br(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new F(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function xf(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=br(e);return e.expect("rparen","')'"),r}case"ident":{let r=At(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:yf(e)}:{kind:"ref",path:r}}default:throw new F(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var Sf=["bind","bind2","action"];function yr(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&Sf.includes(e.peek(2).type)}function xr(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,n=br(e),o=e.peek();if(!["newline","semi","rbrace","eof"].includes(o.type))throw new F(`unexpected '${o.value||o.type}' after binding`,o.line,o.col);return{key:t.value,operator:r,expr:n,line:t.line,col:t.col}}function Aa(e){let t=e.peek(),r=At(e);e.expect("bind","'<-'");let n=br(e);return{target:r,expr:n,line:t.line,col:t.col}}function Na(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function Ba(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(Aa(e)),Ea(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new F(`unterminated handler '${t.value}'`,t.line,t.col);r.push(Aa(e)),Ea(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function Ea(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new F(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var Sr=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 n=this.cursor.peek();throw new F("unterminated style block",n.line,n.col)}yr(this.cursor)?(r.push(xr(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"?$a(this.cursor):gr(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 n=this.cursor.peek();throw new F(`unterminated ${t} block`,n.line,n.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 F(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var Cr=class{constructor(t){this.cursor=t;this.properties=new Sr(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!pr(t.value))throw new F(`unknown block kind '${t.value}'`,t.line,t.col);let r=this.cursor.expect("ident","block name"),n=this.parseComposition(),o=this.parseBlockEntries();return{kind:t.value,name:r.value,composition:n,entries:o}}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 n=this.cursor.peek();throw new F('unterminated block (missing "}")',n.line,n.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 F(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return pr(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()}:yr(this.cursor)?{type:"binding",binding:xr(this.cursor)}:Na(this.cursor)?{type:"handler",handler:Ba(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"&&!pr(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(),n=this.parseBlockEntries();return{kind:"Series",name:t.value,composition:r,entries:n}}};var Rr=class{constructor(t){this.cursor=t;this.blocks=new Cr(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new F(`document must start with 'sfl', got '${t.value}'`,t.line,t.col);let r=this.cursor.expect("number","version number");this.cursor.skipNewlines();let n=[];for(;!this.cursor.at("eof");)n.push(this.blocks.parseBlock()),this.cursor.skipNewlines();return{version:r.value,blocks:n}}};function qn(e){return new Rr(new hr(Ma(e))).parseDocument()}function S(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 R(e){return e?.type==="number"?e.value:void 0}function we(e){return e?.type==="tuple"?e.values:void 0}function Ia(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function Cf(e,t){if(e.length<2)return null;let r=e[e.length-1],n=e[e.length-2],o=t.idByName.get(n);return(o?t.canvasObjectById.get(o):void 0)?.symbol?.ports?.some(a=>a.name===r)?{id:o,port:r}:null}function tt(e,t){if(e?.type!=="endpoint")return{};let r=Cf(e.segments,t);if(r)return r;let n=e.segments[e.segments.length-1];return{id:t.idByName.get(n)??n,side:e.side,fraction:e.fraction}}function B(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 kr(e){let t=new Map;for(let r of e.entries)if(r.type==="style")for(let n of r.style.properties)t.set(n.key,n.value);return t}function Ga(e){let t=new Map;for(let r of e.entries)if(r.type==="layout")for(let n of r.layout.properties)t.set(n.key,n.value);return t}function V(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function Da(e){for(let t of e.entries)if(t.type==="data")return t.data}function rt(e){let t=Da(e);return t?[...V(e),...V(t)]:V(e)}function _a(e,t){let r=B(e).get(t);if(r!==void 0)return r;let n=Da(e);return n?B(n).get(t):void 0}var Rf=["Entity","Shape","Text","Container","Path","Chart","Widget","Isometric"],kf=new Set(Rf);function nt(e){return kf.has(e)}function Fa(e,t){for(let r of e)nt(r.kind)&&t.set(r.name,S(B(r).get("id"))??r.name),Fa(V(r),t)}function wr(e){let t=new Map;return e&&Fa(V(e),t),t}var wf=new Set(["id","from","to","text","order","segments"]);function vr(e){let t={};for(let[r,n]of e){if(wf.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}var vf=new Set(["top","bottom","front","back","left","right"]);function Ha(e){return e!==void 0&&vf.has(e)?e:"front"}function Va(e,t,r,n,o=[]){let i={idByName:wr(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=n.mergedProps(a);return{id:S(l.get("id"))??a.name,fromId:tt(l.get("from"),i).id,toId:tt(l.get("to"),i).id,fromFace:Ha(S(l.get("fromFace"))),toFace:Ha(S(l.get("toFace"))),order:R(l.get("order")),sourceIndex:o[s],props:vr(l)}})}function Wa(e,t,r){let n=t.mergedProps(e),o=tt(n.get("from"),r),i=tt(n.get("to"),r);return{id:S(n.get("id"))??e.name,fromId:o.id,toId:i.id,text:S(n.get("text")),fromSide:o.side,fromFraction:o.fraction,toSide:i.side,toFraction:i.fraction,fromPort:o.port,toPort:i.port,order:R(n.get("order")),segments:Ia(n.get("segments")),props:vr(n)}}function za(e,t,r,n,o=[]){let i={idByName:wr(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...Wa(a,n,i),sourceIndex:o[s]}))}function Pf(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(n=>n.type==="ident"?[n.segments]:[]):[]}function Lf(e,t,r,n,o){let i=[{type:"property",property:{key:"from",value:{type:"endpoint",segments:t}}},{type:"property",property:{key:"to",value:{type:"endpoint",segments:r}}}];return o&&i.push({type:"property",property:{key:"text",value:{type:"string",value:o}}}),{kind:"Link",name:`${e.name}_${n+1}`,composition:[],entries:i}}function Ya(e,t){let r=Pf(e,t);if(r.length<2)return[];let n=S(t.mergedProps(e).get("text"));return r.slice(1).map((o,i)=>Lf(e,r[0],o,i,n))}function ja(e,t){let r=S(t.layoutProp(e,"flow")),n=R(t.layoutProp(e,"gap"))??0,o=0;return i=>{if(r!=="horizontal"&&r!=="vertical")return;let a=r==="horizontal"?[o,0]:[0,o];return o+=(r==="horizontal"?i[0]:i[1])+n,a}}var Pr=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function ot(e){return e!==void 0&&Pr.includes(e)}function ve(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let n=R(r);return n===void 0?[]:[n]});return t.length>0?t:void 0}function Ua(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=S(t);return r===void 0?[]:[r]})}function be(e){let t=S(e);if(t!==void 0)return t==="true"}function Kn(e){let t=e?B(e):new Map;return{min:R(t.get("min"))??0,max:R(t.get("max"))??10,step:R(t.get("step"))??1,label:S(t.get("label")),unit:S(t.get("unit")),thresholds:ve(t.get("thresholds"))}}function Xa(e){return rt(e).filter(t=>t.kind==="Rule").map(t=>{let r=B(t);return{id:t.name,at:R(r.get("at"))??0,text:S(r.get("text")),color:S(r.get("color")),strokeWidth:R(r.get("strokeWidth")),dash:ve(r.get("dash"))}})}function qa(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(R);return t.every(r=>r!==void 0)?t:void 0}function Ka(e){return e?.type!=="list"?[]:Tf(e.values)==="tuple"?$f(e.values):Mf(e.values)}function Tf(e){for(let t of e){if(t.type==="number")return"scalar";if(qa(t))return"tuple"}}function Mf(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function $f(e){return e.flatMap(t=>{let r=qa(t);return r?[r]:[]})}function Za(e){if(e?.type==="list")return e.values.map(Af)}function Af(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:Ef(e)}function Ef(e){if(e.type!=="list"||e.values.length<2)return null;let t=R(e.values[0]),r=R(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function Qa(e){if(e?.type==="list")return e.values.map(Of)}function Of(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:S(e)??null}function Ja(e,t){if(e?.type==="list"){let o=e.values.flatMap(Nf);return o.length>0?{points:o}:void 0}let r=S(e),n=r?t.get(r):void 0;if(n)return{points:n.points,normalized:!0,tension:n.tension}}function Nf(e){if(e.type!=="list"||e.values.length<2)return[];let t=R(e.values[0]),r=R(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function es(e,t,r){let n=r(e);return{id:e.name,label:S(n.get("label"))??e.name,color:S(n.get("color")),colors:Qa(n.get("colors")),opacity:R(n.get("opacity")),group:S(n.get("group")),values:Ka(n.get("values")),error:Za(n.get("error")),source:S(n.get("source")),target:S(n.get("target")),size:R(n.get("size")),symbol:Ja(n.get("symbol"),t),stroke:S(n.get("stroke")),strokeWidth:R(n.get("strokeWidth")),dash:ve(n.get("dash")),offset:R(n.get("offset")),labelOffsetX:R(n.get("labelOffsetX")),labelOffsetY:R(n.get("labelOffsetY"))}}function ts(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let n=S(r.values[0]);return n===void 0?[]:[{label:n,color:S(r.values[1]),offsetX:R(r.values[2]),offsetY:R(r.values[3])}]});return t.length>0?t:void 0}var Bf=["none","true","percent","waterfall"];function If(e){return ot(e)?e:"bar"}function Gf(e){return Bf.find(t=>t===e)}function rs(e,t,r,n){let o=rt(e),i=o.filter(s=>s.kind==="Axis"),a=S(t.get("stacked"));return{chartType:If(S(t.get("type"))),categories:Ua(_a(e,"categories")),areaOpacity:R(t.get("areaOpacity")),stacked:Gf(a),scale:S(t.get("scale")),interpolate:S(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:R(t.get("idwPower")),isolines:ve(t.get("isolines")),zones:ts(t.get("zones")),boxWidth:R(t.get("boxWidth")),orientation:S(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:R(t.get("lineTension")),highlightPoints:ve(t.get("highlightPoints")),barCornerRadius:R(t.get("barCornerRadius")),showBoxplotPoints:be(t.get("showBoxplotPoints")),barBorderColor:S(t.get("barBorderColor")),barBorderWidth:R(t.get("barBorderWidth")),barGroupGap:R(t.get("barGroupGap")),barGlow:R(t.get("barGlow")),barGap:R(t.get("barGap")),mekkoVaryHeight:be(t.get("mekkoVaryHeight")),hexRadius:R(t.get("hexRadius")),innerRadius:R(t.get("innerRadius")),pieCornerRadius:R(t.get("pieCornerRadius")),pieSliceGap:R(t.get("pieSliceGap")),ringThickness:R(t.get("ringThickness")),ringGap:R(t.get("ringGap")),cellGap:R(t.get("cellGap")),showValues:be(t.get("showValues")),squareCells:be(t.get("squareCells")),headerColor:S(t.get("headerColor")),tileGradient:be(t.get("tileGradient")),showColumnBackdrop:be(t.get("showColumnBackdrop")),labelPosition:S(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:S(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:S(t.get("labelColor")),linkGradient:be(t.get("linkGradient")),connectPoints:be(t.get("connectPoints")),reverseComparison:be(t.get("reverseComparison")),axisX:Kn(i.find(s=>s.name==="x")),axisY:Kn(i.find(s=>s.name==="y"||s.name==="value")),series:o.filter(s=>s.kind==="Series").map(s=>es(s,r,n)),rules:Xa(e)}}function ns(e,t,r,n,o){return{...e,objectType:"chart",chart:rs(t,r,n,o)}}function os(e,t){return{depth:t,icon:S(e.get("icon"))}}function is(e,t,r,n){let o=we(n(t,"size"));return{...e,objectType:"isometric",isometric:os(r,o?.[2]??24)}}function as(e,t){let r=e.get("points");return{points:r?.type==="list"?r.values.flatMap(o=>{if(o.type!=="list"||o.values.length<2)return[];let i=R(o.values[0]),a=R(o.values[1]);return i!==void 0&&a!==void 0?[{x:t.x+i,y:t.y+a}]:[]}):[],tension:R(e.get("tension")),startMarker:S(e.get("startMarker")),endMarker:S(e.get("endMarker")),closed:S(e.get("closed"))==="true",value:R(e.get("value"))}}function ss(e,t,r){return{...e,objectType:"path",path:as(t,r)}}function ls(e){let t=S(e.get("orientation"))==="vertical"?"vertical":"horizontal",r=e.get("lanes"),n=r?.type==="list"?r.values.flatMap((i,a)=>{if(i.type!=="list")return[];let s=S(i.values[0]),l=R(i.values[1]);if(s===void 0||l===void 0)return[];let d=S(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:n}}function ds(e,t){return{...e,objectType:"swimlane",swimlane:ls(t)}}function Df(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":e.kind==="Widget"?S(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":S(t.get("kind"))??""}function _f(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":e==="rollingNumber"||e==="tickScale"||e==="ruler"?"widget":e==="isometric"?"isometric":"shape"}function cs(e,t,r){let n=Df(e,t),o=S(t.get("shape")),i=o?r.get(o):void 0;return{objectType:e.kind==="Widget"?"widget":_f(n),kind:n,shapeType:i?"symbol":o,symbol:i}}function us(e,t,r,n){let o=n??we(r(e,"position"))??[0,0],i=we(r(e,"size"))??[0,0];return{x:t.x+(o[0]??0),y:t.y+(o[1]??0),width:i[0]??0,height:i[1]??0,rotation:R(r(e,"rotation")),order:R(r(e,"order"))}}var Ff=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function ms(e){let t={};for(let[r,n]of e){if(Ff.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}function ps(e,t,r,n,o){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=cs(e,l,s),c=us(e,t,a,o),u={id:S(l.get("id"))??e.name,kind:d.kind,text:S(l.get("text")),...c,parentFrameId:n??S(l.get("parent")),props:ms(l)};switch(d.objectType){case"chart":return ns(u,e,l,s,i);case"isometric":return is(u,e,l,a);case"path":return ss(u,l,t);case"swimlane":return ds(u,l);case"frame":return{...u,objectType:"frame"};case"widget":return{...u,objectType:"widget",widget:{type:S(l.get("type"))??"rollingNumber",value:S(l.get("value"))??"0",digits:R(l.get("digits")),duration:R(l.get("duration")),min:R(l.get("min")),max:R(l.get("max")),label:S(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function fs(e){return V(e).filter(t=>nt(t.kind)).map(t=>S(B(t).get("id"))??t.name)}var Zn=class{#e;#n=[];#t=[];#r=[];#o=[];#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.#n,groups:r,linkBlocks:this.#t,connectionBlocks:this.#r,linkSourceIndexes:this.#o,connectionSourceIndexes:this.#i}}#a(t,r){let n=[],o=ja(t,this.#e);for(let i of V(t))n.push(...this.#l(i,r,o));return n}#l(t,r,n){let o=this.#s++;if(t.kind==="Container")return this.#c(t,r,n,o);if(nt(t.kind))return this.#u(t,r,n,o),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#t.push(t),this.#o.push(o),[];case"Connection":return this.#r.push(t),this.#i.push(o),[];case"Net":{let i=Ya(t,this.#e);return this.#t.push(...i),this.#o.push(...i.map(()=>o)),[]}default:return[]}}#c(t,r,n,o){let i=this.#d(t,r,n,o);return this.#n.push(i),this.#a(t,{origin:{x:i.x,y:i.y},frameId:i.id})}#u(t,r,n,o){this.#n.push(this.#d(t,r,n,o))}#d(t,r,n,o){let i=we(this.#e.layoutProp(t,"size"))??[0,0];return{...ps(t,r.origin,this.#e,r.frameId,n(i)),sourceIndex:o}}#m(t,r){let n=this.#e.mergedProps(t);return{id:S(n.get("id"))??t.name,name:S(n.get("text"))??t.name,color:S(n.get("color")),icon:S(n.get("icon")),canvasObjectIds:fs(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??S(n.get("parent"))}}};function hs(e,t){return new Zn(t).resolve(e)}function gs(e){let t=B(e),r=S(t.get("program"));if(!r)return;let n={};for(let[o,i]of t){if(o==="program")continue;let a=R(i),s=S(i);a!==void 0?n[o]=a:s!==void 0&&(n[o]=s==="true"?!0:s==="false"?!1:s)}return{name:e.name,program:r,parameters:n}}function Hf(e){let t=B(e).get("points");return t?.type!=="list"?[]:t.values.flatMap(r=>{if(r.type!=="list"||r.values.length<2)return[];let n=R(r.values[0]),o=R(r.values[1]);return n===void 0||o===void 0?[]:[[n,o]]})}function Vf(e){let t=V(e).filter(r=>r.kind==="Port").flatMap(r=>{let n=we(B(r).get("at"));return typeof n?.[0]!="number"||typeof n[1]!="number"?[]:[{name:r.name,at:[n[0],n[1]]}]});return t.length>0?t:void 0}function bs(e){let t=Hf(e);if(!(t.length<2))return{name:e.name,points:t,tension:R(B(e).get("tension")),ports:Vf(e)}}function Wf(e){return V(e).find(t=>t.kind==="Model")}function ys(e){return{styles:Yf(e),layouts:jf(e),symbols:Uf(e),shaders:zf(e),model:Xf(e)}}function zf(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let n=gs(r);n&&t.set(r.name,n)}return t}function Yf(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function jf(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function Uf(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let n=bs(r);n&&t.set(r.name,n)}return t}function Xf(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=Wf(t);if(r)return r}}}function xs(e,t,r){let n,o;for(let i of e)t.has(i)?n=i:r.has(i)&&(o=i);return{styleRef:n,layoutRef:o}}function Ss(e,t,r,n){for(let o of e.composition)!t.has(o)&&!r.has(o)&&n.push({severity:"warning",code:"unresolved-style-or-layout",ownerId:e.name,message:`"${o}" is not a Style or Layout defined at the top level of the document \xC3\xA2\xE2\u201A\xAC\xE2\u20AC\x9D "${e.name}" gets no shape, fill, or stroke from it.`});for(let o of V(e))Ss(o,t,r,n)}function Cs(e,t,r){let n=[];for(let o of e.blocks)Ss(o,t,r,n);return n}function Jn(e,t){return new Qn(e,t).resolveAll()}var Qn=class{#e;#n;#t=new Map;constructor(t,r){this.#e=t,this.#n=r}resolveAll(){for(let t of this.#e.keys())this.#r(t,new Set);return this.#t}#r(t,r){let n=this.#t.get(t);if(n)return n;let o=this.#e.get(t);if(!o||r.has(t))return new Map;let i=this.#o(o,new Set([...r,t]));for(let[a,s]of B(o))i.set(a,s);return this.#t.set(t,i),i}#o(t,r){let n=this.#n(t);return n?new Map(this.#r(n,r)):new Map}};function Rs(e){let{styles:t,layouts:r,symbols:n,shaders:o}=e,i=c=>xs(c.composition,t,r),a=Jn(t,c=>i(c).styleRef),s=Jn(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[m,f]of B(c))u.set(m,f);for(let[m,f]of kr(c))u.set(m,f);return u},layoutProp:(c,u)=>{let m=Ga(c);if(m.has(u))return m.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:n,shaderDefs:o}}var qf=new Set(["radar","radial"]),ks=new Set(["scatter","custom","hexbin"]);function ws(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(B(n).get("type"));o!==void 0&&!ot(o)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:n.name,message:`Unsupported chart type '${o}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn as a plain series plot. Supported: ${Pr.join(", ")}.`})}for(let o of V(n))r(o)};for(let n of e.blocks)r(n);return t}function vs(e){let t=[],r=n=>{if(n.kind==="Chart")for(let o of rt(n).filter(i=>i.kind==="Series"))B(o).has("values")||t.push({severity:"warning",code:"series-without-values",ownerId:o.name,message:`Series '${o.name}' has no values. If this was meant to be an Axis or Rule, it needs that keyword in front of the name \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D inside data{}, a bare name is read as a Series.`});for(let o of V(n))r(o)};for(let n of e.blocks)r(n);return t}function Ps(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(B(n).get("type")),i=ot(o)?o:"bar";S(kr(n).get("gridShape"))==="circle"&&!ks.has(i)&&!qf.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:n.name,message:`gridShape: circle isn't supported on '${i}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn with the standard rectangular grid instead. Supported: ${[...ks].join(", ")}.`})}for(let o of V(n))r(o)};for(let n of e.blocks)r(n);return t}function Ls(e){let t=[],r=n=>{if(n.kind==="Widget"){let o=S(B(n).get("type"))??"rollingNumber";o!=="rollingNumber"&&o!=="tickScale"&&o!=="ruler"&&t.push({severity:"warning",code:"unsupported-widget-type",ownerId:n.name,message:`Unsupported widget type '${o}'. Supported: rollingNumber, tickScale, ruler.`})}for(let o of V(n))r(o)};for(let n of e.blocks)r(n);return t}function Ts(e){let t=ys(e);return{model:t.model,diagnostics:[...Cs(e,t.styles,t.layouts),...ws(e),...Ps(e),...vs(e),...Ls(e)],canvasObjectResolutionContext:Rs(t)}}function Ms(e){let t=Ts(e),{canvasObjects:r,groups:n,linkBlocks:o,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=hs(t.model,t),l=za(t.model,o,r,t.canvasObjectResolutionContext,a),d=Va(t.model,i,r,t.canvasObjectResolutionContext,s);return{canvasObjects:r,groups:n,links:l,connections:d,diagnostics:t.diagnostics,shaders:[...t.canvasObjectResolutionContext.shaderDefs.values()]}}function Ot(e){return e.objectType==="isometric"&&e.isometric!==void 0}function $s(e){return Ms(qn(e))}var Nt=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function Jf(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Nt})\\s+([-\\d.]+)%`,"g");for(let o of t[2].matchAll(n))r.push({color:o[1],position:Number(o[2])});return{type:"gradient",angle:Number(t[1]),stops:r}}function eh(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Nt})\\s+([-\\d.]+)\\s*,\\s*([-\\d.]+)`,"g"),o=0;for(let i of t[1].matchAll(n))r.push({id:`mp-${Date.now()}-${o++}`,color:i[1],x:Number(i[2]),y:Number(i[3])});return{type:"mesh",points:r}}function ae(e){if(!(e==null||e===""))return Jf(e)??eh(e)??e}function Lr(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Nt})\\s+([-\\d.]+)`,"g");for(let o of t[1].matchAll(n))r.push({color:o[1],position:Number(o[2])});return{type:"ramp",stops:r}}function th(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 ue(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 n of t[1].split(",")){let o=n.split(":");o.length===2&&th(r,o[0].trim(),o[1].trim())}return r}var y=e=>e===void 0?void 0:Number(e);function rh(e){try{return JSON.parse(e)}catch{return}}function Ae(e){if(e===void 0)return;let t=rh(e);if(!Array.isArray(t))return;let r=t.filter(n=>typeof n=="number"&&Number.isFinite(n));return r.length===t.length?r:void 0}function Pe(e){let t=ae(e);return typeof t=="string"?t:void 0}function ye(e,t,r){return t.includes(e)?e:r}var Tr=["normal","bold"],As=["normal","bold","100","200","300","400","500","600","700","800","900"],Es=["top","bottom","left","right"],eo=["none","arrow","filled_arrow"];function it(e){let t=ae(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var Os=["left","center","right"],Ns=["top","middle","bottom"],Mr=["solid","dashed","dotted"],$r=["straight","curved","orthogonal"];function se(e,t){return e!==void 0&&t.includes(e)?e:void 0}var Bs=["solid","dashed","dotted","double"],to=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function nh(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function oh(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function ih(e){return e==="dashed"||e==="dotted"?e:"solid"}function ah(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:ae(t.color),colors:t.colors?.map(r=>r===null?null:ae(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 sh(e){let t=nh(e.fill);return{fillColor:t?"#111418":ae(e.fill)??"#ffffff",fillImage:t,strokeColor:Pe(e.stroke)??"#475569",strokeWidth:y(e.strokeWidth)??1,cornerRadius:y(e.cornerRadius)??12,shadowStyle:ue(e.shadow)}}function lh(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:y(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:ih(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function dh(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:y(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:y(e.tickLength),axisFontSize:y(e.axisFontSize),axisFontFamily:e.axisFontFamily,showValueAxis:e.showValueAxis!=="false",categoryAlign:e.categoryAlign==="left"||e.categoryAlign==="inside"?e.categoryAlign:void 0,showAxisLabels:e.showAxisLabels!=="false"}}function ch(e){return{textColor:e.textColor??"#0f172a",titleSize:y(e.titleSize),titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:y(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function uh(e){return{legendColor:e.legendColor,showLegend:e.showLegend==="true",legendPosition:oh(e.legendPosition)}}function Is(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,...ah(e),...sh(t),...lh(t),...dh(t),...ch(t),...uh(t),order:e.order,sourceIndex:e.sourceIndex}}function Gs(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:ae(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:y(t.barSegments),barSegmentGap:y(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:y(t.barGlassBlur),barGlassSaturation:y(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:y(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:y(t.barTrackHatchAngle),barTrackHatchSpacing:y(t.barTrackHatchSpacing),barTrackHatchWidth:y(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:y(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:y(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function Ds(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:y(t.lineWidth),lineGlow:y(t.lineGlow),pointSize:y(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:y(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:y(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function _s(e,t){return{categories:e?.categories,pointSize:y(t.pointSize),pointOpacity:y(t.pointOpacity),pointStrokeWidth:y(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function Fs(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:y(t.boxWhiskerWidth),boxMedianWidth:y(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:y(t.boxCapSize),boxPointSize:y(t.boxPointSize),boxPointOpacity:y(t.boxPointOpacity),boxJitter:y(t.boxJitter)}}function Hs(e){return{scale:Lr(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function Vs(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:y(t.cellStrokeWidth),cellValueSize:y(t.cellValueSize),cellValueColor:t.cellValueColor}}function Ws(e,t){return{hexRadius:e?.hexRadius,scale:Lr(e?.scale),hexGap:y(t.hexGap),hexStrokeWidth:y(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:y(t.hexMinOpacity)}}function zs(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:y(t.mekkoColumnGap),mekkoSegmentGap:y(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:y(t.mekkoSegmentStrokeWidth),mekkoLabelSize:y(t.mekkoLabelSize),mekkoValueSize:y(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 Ys(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:y(t.pieStartAngle),pieSweep:y(t.pieSweep),pieExplode:y(t.pieExplode),pieGlow:y(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:y(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:y(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function js(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:y(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:y(t.pieStrokeWidth),polarTrackOpacity:y(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:y(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:y(t.polarValueSize),polarNameSize:y(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 Us(e){return{radarStrokeWidth:y(e.radarStrokeWidth),radarPointSize:y(e.radarPointSize),radarTension:y(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function Xs(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Us(t)}}function qs(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...Us(t)}}function Ks(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:y(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:y(t.ringStartAngle),ringSweep:y(t.ringSweep)}}function Zs(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:y(t.sankeyNodeWidth),sankeyNodeGap:y(t.sankeyNodeGap),sankeyLinkOpacity:y(t.sankeyLinkOpacity),sankeyLinkCurve:y(t.sankeyLinkCurve),sankeyLabelSize:y(t.sankeyLabelSize)}}function Qs(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:y(t.tileStrokeWidth),tileLabelSize:y(t.tileLabelSize),tileValueSize:y(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:y(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:y(t.headerHeight)}}function Js(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:y(t.customConnectorWidth),customConnectorOpacity:y(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:y(t.customBeforeStrokeWidth),customLabelSize:y(t.customLabelSize),customLabelColor:t.customLabelColor}}function el(e){let t=Is(e),r=e.chart,n=e.props,o=r?.chartType??"bar";switch(o){case"bar":return X(t,o,Gs(r,n));case"line":return X(t,o,Ds(r,n));case"scatter":return X(t,o,_s(r,n));case"boxplot":return X(t,o,Fs(r,n));case"field":return X(t,o,Hs(r));case"heatmap":return X(t,o,Vs(r,n));case"hexbin":return X(t,o,Ws(r,n));case"mekko":return X(t,o,zs(r,n));case"pie":return X(t,o,Ys(r,n));case"polarArea":return X(t,o,js(r,n));case"radar":return X(t,o,Xs(r,n));case"radial":return X(t,o,qs(r,n));case"radialBar":return X(t,o,Ks(r,n));case"sankey":return X(t,o,Zs(r,n));case"treemap":return X(t,o,Qs(r,n));case"custom":return X(t,o,Js(r,n))}}function X(e,t,r){return{...e,chartType:t,config:r}}function tl(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:se(t.route,$r)??"straight",color:it(t.stroke),strokeWidth:y(t.strokeWidth),strokeStyle:se(t.strokeStyle,Mr),opacity:t.opacity!==void 0?y(t.opacity):void 0}}}function rl(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:y(t.strokeWidth)??2,cornerRadius:y(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:y(t.fontSize)??14,fontWeight:ye(t.fontWeight,Tr,"bold"),fontFamily:t.fontFamily,dash:Ae(t.dash),showLabel:t.showLabel!=="false",labelPosition:ye(t.labelPosition,Es,"top"),shadow:t.shadow!=="false",order:e.order,sourceIndex:e.sourceIndex}}function nl(e){let t=e.props,r=ue(t.shadow);return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,depth:e.isometric.depth,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,text:e.text,icon:e.isometric.icon,fill:Pe(t.fill)??"#f8fafc",strokeColor:Pe(t.stroke)??"#111827",strokeWidth:y(t.strokeWidth)??1,cornerRadius:y(t.cornerRadius)??8,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:y(t.labelOffsetX)??0,labelOffsetY:y(t.labelOffsetY)??0,labelBackground:Pe(t.labelBackground),parentFrameId:e.parentFrameId}}function ol(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:y(t.weight),showWeight:t.showWeight!=="false",style:{pathType:se(t.route,$r),color:it(t.stroke),strokeWidth:y(t.strokeWidth),strokeStyle:se(t.strokeStyle,Mr),opacity:t.opacity!==void 0?y(t.opacity):void 0,fontSize:y(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:ue(t.shadow)},startMarker:se(t.markerStart,to),endMarker:se(t.markerEnd,to),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 il(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:ye(e.path?.startMarker,eo,"none"),endMarker:ye(e.path?.endMarker,eo,"none"),closed:e.path?.closed??!1,strokeColor:Pe(t.stroke)??"#7c3aed",strokeWidth:y(t.strokeWidth)??2,dash:Ae(t.dash)??[],opacity:y(t.opacity)??1,fillColor:Pe(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function mh(e){return e||"rectangle"}function al(e,t){let r=e.props,n=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:mh(e.shapeType),symbol:e.symbol,x:e.x,y:e.y,width:e.width,height:e.height,w:e.width,h:e.height,rotation:e.rotation??0,fillColor:ae(r.fill??(n?"none":void 0)),strokeColor:it(r.stroke??(n?"none":void 0)),isText:n||void 0,strokeWidth:y(r.strokeWidth),textColor:r.textColor,fontSize:y(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:ye(r.fontWeight,As,"normal"),letterSpacing:y(r.letterSpacing),lineHeight:y(r.lineHeight),fontFamily:r.fontFamily,textAlign:se(r.textAlign,Os),textVerticalAlign:se(r.verticalAlign,Ns),cornerRadius:y(r.cornerRadius),shadowStyle:ue(r.shadow),dash:Ae(r.dash),strokeStyle:se(r.strokeStyle,Bs),opacity:y(r.opacity),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function sl(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:y(t.strokeWidth)??2,cornerRadius:y(t.cornerRadius)??12,dash:Ae(t.dash),shadowStyle:ue(t.shadow),textColor:t.textColor??"#6b7280",fontSize:y(t.fontSize)??22,fontWeight:ye(t.fontWeight,Tr,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var ph=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i,fh=/^[\w\s,'"-]+$/;function Le(e){return e&&ph.test(e)?e:void 0}function ro(e){return e&&fh.test(e)?e:void 0}var hh=/^(?:[1-9]00|normal|bold)$/;function gh(e){return e==="plain"||e==="flip"?e:void 0}function bh(e){return e==="roll"||e==="fade"?e:void 0}function yh(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function no(e){return e&&hh.test(e)?e:void 0}var xh=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],Sh=["color","accent"];function Ch(e){let t=e.props,r={};for(let n of xh){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of Sh){let o=Le(t[n]);o&&(r[n]=o)}return{id:e.id,type:"tickScale",value:e.widget.value,max:e.widget.max,label:e.widget.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:Le(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:no(t.labelWeight),fontFamily:ro(t.labelFont)}:void 0}}var Rh=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],kh=["color","accent","glow"],wh={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},vh=["core","peak"];function Ph(e){let t=e.props,r={};for(let n of Rh){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of kh)r[n]=Le(t[n])??wh[n];for(let n of vh){let o=Le(t[n]);o&&(r[n]=o)}return r.axis=t.axis==="horizontal"?"horizontal":"vertical",t.knob&&(r.knob=t.knob),{id:e.id,type:"ruler",value:e.widget.value,min:e.widget.min,max:e.widget.max,label:e.widget.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:Le(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:no(t.labelWeight),fontFamily:ro(t.labelFont)}:void 0}}function ll(e){if(e.widget.type==="tickScale")return Ch(e);if(e.widget.type==="ruler")return Ph(e);let t=e.props;return{id:e.id,type:"rollingNumber",value:e.widget.value,digits:e.widget.digits,duration:e.widget.duration,label:e.widget.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:Le(t.color),surface:Le(t.surface),divider:Le(t.divider),labelColor:Le(t.labelColor),fontFamily:ro(t.fontFamily),variant:gh(t.variant),motion:bh(t.motion),fontWeight:no(t.fontWeight),fontSize:yh(t.fontSize)}}}var oo=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function dl(e){let t=oo(e.canvasObjects),r=new Map((e.shaders??[]).map(n=>[n.name,n]));return{shapes:t.filter(n=>n.objectType==="shape").map(n=>al(n,r)),frames:t.filter(n=>n.objectType==="frame").map(rl),swimlanes:t.filter(n=>n.objectType==="swimlane").map(sl),isometricObjects:t.filter(Ot).map(nl),paths:t.filter(n=>n.objectType==="path").map(il),charts:t.filter(n=>n.objectType==="chart").map(el),widgets:t.filter(n=>n.objectType==="widget"&&["rollingNumber","tickScale","ruler"].includes(n.widget?.type??"")).map(ll),links:oo(e.links).map(ol),connections:oo(e.connections).map(tl)}}var Ar=new Set(["top","front","right"]),cl=Math.PI/6,at=Math.cos(cl),Bt=Math.sin(cl);function io(e){let t=Math.max(0,e.width),r=Math.max(0,e.height),n=Math.max(0,e.depth);return{x:e.x,y:e.y,width:(t+n)*at,height:r+(t+n)*Bt}}function ao(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*at/2,y:e.y+(t+r)*Bt/2}}function Lh(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 so(e,t){return Lh(De(e)[t])}function De(e){let{x:t,y:r}=e,n=Math.max(0,e.width),o=Math.max(0,e.height),i=Math.max(0,e.depth),a={x:t+i*at,y:r},s={x:n*at,y:n*Bt},l={x:-i*at,y:i*Bt},d={x:0,y:o},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},g={x:m.x+d.x,y:m.y+d.y},b={x:u.x+d.x,y:u.y+d.y},x={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,m,u],bottom:[f,x,g,b],front:[u,m,g,b],back:[a,c,x,f],right:[m,c,x,g],left:[a,u,b,f]}}function Th(e){return Math.max(0,Math.min(255,Math.round(e)))}function Mh(e){let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return null;let r=Number.parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function $h(e,t,r){return`#${[e,t,r].map(n=>Th(n).toString(16).padStart(2,"0")).join("")}`}function ul(e,t){let r=Mh(e);if(!r)return e;let[n,o,i]=r;return $h(n*t,o*t,i*t)}function lo(e){return{topFill:e,frontFill:ul(e,.95),sideFill:ul(e,.88)}}var Ah=Math.PI/180;function Eh(e,t){let r=t*Ah,n=Math.cos(r),o=Math.sin(r);return{x:e.x*n-e.y*o,y:e.x*o+e.y*n}}function Oh(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ml(e,t){let r=Oh(e),n=e.rotation?Eh(t,e.rotation):t;return{x:r.x+n.x,y:r.y+n.y}}function co(e,t){return ml(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function st(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function uo(e,t){let r=st(e),n=st(t),o=Math.atan2(n.y-r.y,n.x-r.x);return o>=-Math.PI/4&&o<Math.PI/4?{x:e.x+e.width,y:r.y}:o>=Math.PI/4&&o<3*Math.PI/4?{x:r.x,y:e.y+e.height}:o>=-3*Math.PI/4&&o<-Math.PI/4?{x:r.x,y:e.y}:{x:e.x,y:r.y}}function Nh(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 Bh(e,t){let r=e.symbol?.ports?.find(n=>n.name===t.port);return r?co({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):st(e)}function mo(e,t,r){let n=Ih(e,t),o=Gh(n.explicit);if(o)return o;let i=pl(r,n.canvasObjectId);if(!i)return{x:0,y:0};let a=Dh(i,n.explicit);return a||_h(i,pl(r,n.oppositeCanvasObjectId))}function Ih(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function Gh(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function Dh(e,t){return t?.kind==="port"?Bh(e,t):t?.kind==="side"?Nh(e,t):null}function _h(e,t){return t?uo(e,t):st(e)}function pl(e,t){return e.find(r=>r.id===t)}var Fh=15e3;function Hh(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function fl(e,t){return e?so(e,t):{x:0,y:0}}function hl(e,t){let r=e.findIndex(o=>o.id===t);if(r<0)return;let n=e[r];return{rank:n.order??0,sequence:n.sourceIndex??Fh+r}}function Vh(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Ar.has(t.fromFace)?void 0:hl(e,t.fromId),Ar.has(t.toFace)?void 0:hl(e,t.toId)].filter(o=>o!==void 0);if(!r.length)return{sourceIndex:t.sourceIndex};let n=r.reduce((o,i)=>i.rank<o.rank||i.rank===o.rank&&i.sequence<o.sequence?i:o);return{order:n.rank,sourceIndex:n.sequence-.5}}function Wh(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,...Vh(e.isometricObjects,r)},from:fl(t.get(r.fromId??""),r.fromFace),to:fl(t.get(r.toId??""),r.toFace),kind:"connection"}))}function gl(e){let t=Hh(e);return[...e.links.map(n=>({link:n,from:mo(n,"from",t),to:mo(n,"to",t)})),...Wh(e)]}function po(e){let t=$s(e),r=dl(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,charts:r.charts,widgets:r.widgets,links:gl(r),diagnostics:t.diagnostics}}function q(e,t,r,n,o,i){return e.forEach((a,s)=>{a.identity={role:t,id:r,...n?{kind:n}:{},...s===0?{primary:!0}:{},...s===0&&o?{label:o}:{},...s===0&&i?{parentFrameId:i}:{}}}),e}var fo={minX:0,minY:0,maxX:100,maxY:100};function K(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 re(e,t,r=0){return t?jh(zh(e,t),r):K(e,r)}function zh(e,t){let r=e.x+e.width/2,n=e.y+e.height/2,o=t*Math.PI/180,i=Math.cos(o),a=Math.sin(o);return Yh(e).map(s=>({x:r+(s.x-r)*i-(s.y-n)*a,y:n+(s.x-r)*a+(s.y-n)*i}))}function Yh(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 jh(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 me(e){return e.points.length===0?"":e.points.length<3||e.tension<=0?Uh(e):Xh(e)}function Uh(e){let[t,...r]=e.points,n=r.map(o=>`L ${o.x} ${o.y}`).join(" ");return`M ${t.x} ${t.y} ${n}${e.closed?" Z":""}`}function Xh(e){let t=e.points[0],r=e.closed?e.points.length:e.points.length-1,n=[`M ${t.x} ${t.y}`];for(let o=0;o<r;o++)n.push(qh(e,o));return e.closed&&n.push("Z"),n.join(" ")}function qh(e,t){let r=Er(e,t-1),n=Er(e,t),o=Er(e,t+1),i=Er(e,t+2),a=e.tension/6,s={x:n.x+(o.x-r.x)*a,y:n.y+(o.y-r.y)*a},l={x:o.x-(i.x-n.x)*a,y:o.y-(i.y-n.y)*a};return`C ${s.x} ${s.y} ${l.x} ${l.y} ${o.x} ${o.y}`}function Er(e,t){return e.closed?e.points[(t+e.points.length)%e.points.length]:e.points[Math.max(0,Math.min(e.points.length-1,t))]}function p(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function bl(e){let t=e.order_key??e.orderKey;if(!t)return e.order??0;let r=0;for(let n=0;n<Math.min(t.length,8);n++)r=r*128+t.charCodeAt(n);return r}function yl(e,t){return e.sourceIndex??t}function k(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(n=>({offset:n.position,color:n.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(n=>({x:n.x,y:n.y,color:n.color}))}:{kind:"none"}}var N="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";function ho(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} 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+n} H ${e} Z`}function go(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t} H ${e+r} V ${t+n-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+n} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+n-i} Z`}function It(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r} V ${t+n} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+n-i} Z`}function Gt(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+n-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+n} H ${e} Z`}function xl(e,t,r,n,o){let i=Math.max(0,Math.min(r,n)/2),a=Math.max(0,Math.min(o.topLeft,i)),s=Math.max(0,Math.min(o.topRight,i)),l=Math.max(0,Math.min(o.bottomRight,i)),d=Math.max(0,Math.min(o.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+n-l} `+c(l,e+r-l,t+n)+`H ${e+d} `+c(d,e,t+n-d)+`V ${t+a} `+c(a,e+a,t)+"Z"}function Or(e,t,r,n){return{fill:{kind:"solid",color:e||"transparent"},stroke:{kind:"solid",color:t},strokeWidth:r,dash:n?.length?n:void 0}}var Nr=8;function Kh(e,t,r){let n=e.strokeWidth/2;switch(e.labelPosition){case"bottom":{let o=e.x-n,i=e.y+e.height;return{x:o,y:i,width:r,height:t,path:go(o,i,r,t,Nr)}}case"left":{let o=e.x-t,i=e.y-n;return{x:o,y:i,width:t,height:r,path:It(o,i,t,r,Nr)}}case"right":{let o=e.x+e.width,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Gt(o,i,t,r,Nr)}}default:{let o=e.x-n,i=e.y-t;return{x:o,y:i,width:r,height:t,path:ho(o,i,r,t,Nr)}}}}function Sl(e){let t=Math.max(32,e.fontSize+18),r=16,n=Math.max(120,e.title.length*e.fontSize*.62+r*2),o=Kh(e,t,n),i=K(o,6),a=e.labelPosition==="left"||e.labelPosition==="right";return[{type:"path",id:e.tabId,order:e.order+.1,bounds:i,d:o.path,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"}}},a?Qh(e,o,r,i):Zh(e,o,r,i)]}function Zh(e,t,r,n){return{type:"text",id:e.titleId,order:e.order+.2,bounds:n,x:t.x+r,y:t.y,width:Math.max(0,t.width-r*2),height:t.height,lines:[e.title],fontFamily:e.fontFamily??N,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Qh(e,t,r,n){let o=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:n,x:o-s/2,y:i-a/2,width:s,height:a,lines:[e.title],fontFamily:e.fontFamily??N,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:o,y:i}}}var Jh={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function eg(e,t,r){let n=e.shadow??!0,o=K({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(n?20:4)),i={...Or(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:n?{color:"#000000",opacity:.2,blur:12,dx:0,dy:4}:void 0};if(!r)return{type:"rect",id:`frame-${e.id}`,order:t,bounds:o,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:i};let a=Jh[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:o,d:xl(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function Cl(e,t){if(e.isVisible===!1)return[];let r=t,n=(e.showLabel??!0)&&!!e.title,o=[eg(e,r,n)];return n&&e.title&&o.push(...Sl({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})),o}function tg(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function Br(e){if(!e?.enabled)return;let t=tg(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 rg(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 Rl(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:rg(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function kl(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??N,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function ng(e,t,r){let n=e.swimlane.fontSize*1.4,o=e.swimlane.x+10+n/2,i=e.swimlane.y+t.offset+t.size/2,a=Math.max(20,t.size-16),s=o-a/2,l=i-n/2;return{...kl(e,t,r),bounds:re({x:s,y:l,width:a,height:n},-90,12),x:s,y:l,width:a,height:n,align:"center",verticalAlign:"middle",rotation:-90,rotationCenter:{x:o,y:i}}}function og(e,t,r){return{...kl(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 wl(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?ng:og;return e.lanes.map((r,n)=>t(e,r,n))}function ig(e){let t=e.orientation==="horizontal"?e.height:e.width,r=e.lanes.reduce((n,o)=>n+o.size,0);return r<=0||t<=0?e.lanes:e.lanes.map(n=>({...n,size:n.size*(t/r)}))}function ag(e){let t=0;return ig(e).map(r=>{let n={...r,offset:t};return t+=r.size,n})}function vl(e,t){return{swimlane:e,order:5e3+t,bounds:K({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:ag(e)}}function Pl(e,t){if(e.isVisible===!1)return[];let r=vl(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:{...Or(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:Br(e.shadowStyle)}},...Rl(r),...wl(r)]}function Ll(e){return[...e.frames.flatMap((t,r)=>q(Cl(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>q(Pl(t,r),"swimlane",t.id))]}function bo(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function Tl(e,t,r){let n=bo(e,t);if(n===0)return e;let o=r/n;return{x:e.x+(t.x-e.x)*o,y:e.y+(t.y-e.y)*o}}function sg(e,t,r,n){let o=Math.max(0,Math.min(n,bo(t,e)/2,bo(t,r)/2));return{vertex:t,start:Tl(t,e,o),end:Tl(t,r,o)}}function Ir(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 n=e.map((a,s)=>sg(e[(s-1+e.length)%e.length],a,e[(s+1)%e.length],r(s))),o=[`M ${n[0].end.x} ${n[0].end.y}`];for(let a=1;a<n.length;a++){let s=n[a];o.push(`L ${s.start.x} ${s.start.y}`,`Q ${s.vertex.x} ${s.vertex.y} ${s.end.x} ${s.end.y}`)}let i=n[0];return o.push(`L ${i.start.x} ${i.start.y}`,`Q ${i.vertex.x} ${i.vertex.y} ${i.end.x} ${i.end.y}`,"Z"),o.join(" ")}function lg(e,t){let r=Math.max(0,p(e.strokeWidth,1)),n=p(e.rotation,0),o=io(e),i={x:o.x+o.width/2,y:o.y+o.height/2};return{object:e,index:t,order:15e3+t,rotation:n,rotationCenter:i,box:o,strokeWidth:r,common:{type:"path",bounds:re(o,n,r+2),rotation:n,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function dg(e,t){let{object:r,index:n,rotation:o,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.top.map(b=>({x:b.x,y:b.y+l})),c={x:d.reduce((b,x)=>b+x.x,0)/d.length,y:d.reduce((b,x)=>b+x.y,0)/d.length},u=1.3,m=d.map(b=>({x:c.x+(b.x-c.x)*u,y:c.y+(b.y-c.y)*u})),f=m.map(b=>b.x),g=m.map(b=>b.y);return{type:"path",id:`isometric-${r.id}-ground-shadow`,order:14e3+n,bounds:{minX:Math.min(...f),minY:Math.min(...g),maxX:Math.max(...f),maxY:Math.max(...g)},d:Ir(m,0),rotation:o,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 cg(e,t,r){let{object:n,order:o,common:i}=e,a={...i.style,stroke:{kind:"none"}},s=lo(n.fill??"#f8fafc"),l={prop:"style.fill",propKind:"color",propSolidOnly:!0},d=(c,u,m,f)=>({...i,id:`isometric-${n.id}-${c}`,order:o+u,d:Ir(m,0),style:{...a,fill:{kind:"solid",color:f},clip:r},...l});return[d("top",0,t.top,s.topFill),d("front",.1,t.front,s.frontFill),d("side",.2,t.right,s.sideFill)]}function ug(e,t,r){let{object:n,order:o,common:i,strokeWidth:a}=e;return{...i,id:`isometric-${n.id}-seams`,order:o+.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 mg(e,t,r){let{object:n,order:o,common:i,box:a}=e;return{...i,id:`isometric-${n.id}-hull`,order:o+.24,d:t,detail:{of:"isometricGeometry",width:Math.max(0,n.width),height:Math.max(0,n.height),depth:Math.max(0,n.depth),cornerRadius:r,bounds:a,labelOffsetX:p(n.labelOffsetX,0),labelOffsetY:p(n.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}var yo=20,pg=12,fg=6,Gr=3,hg=6.5;function gg(e){let{object:t}=e,r=ao(t),n=r.y-pg+p(t.labelOffsetY,0);return{anchor:r,centerX:r.x+p(t.labelOffsetX,0),topY:n-yo,bottomY:n}}function bg(e,t,r){let{object:n,order:o,rotation:i,rotationCenter:a,box:s}=e,{centerX:l,topY:d,bottomY:c}=t;return{type:"text",id:`isometric-${n.id}-label`,order:o+.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:yo,lines:[r],fontFamily:N,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function yg(e,t){let{object:r,order:n,rotation:o,rotationCenter:i}=e,{anchor:a,centerX:s,bottomY:l}=t;return{type:"path",id:`isometric-${r.id}-label-guide`,order:n+.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:o,rotationCenter:i,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:1,lineCap:"round",pointerEvents:"none"}}}function xg(e,t,r,n){let{object:o,order:i,rotation:a}=e,{centerX:s,topY:l,bottomY:d}=t,c=Math.max(24,r.length*hg+fg*2);return{type:"rect",id:`isometric-${o.id}-label-background`,order:i+.28,x:s-c/2,y:l-Gr,width:c,height:yo+Gr*2,rx:4,bounds:{minX:s-c/2,minY:l-Gr,maxX:s+c/2,maxY:d+Gr},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:n},stroke:{kind:"none"}}}}function Sg(e,t){let r=gg(e),n=bg(e,r,t),o=yg(e,r),i=e.object.labelBackground;return i?[o,xg(e,r,t,i),n]:[o,n]}function Cg(e,t){let r=lg(e,t),n=De(e),o=Math.max(0,p(e.cornerRadius,8)),i=[n.top[0],n.top[1],n.right[2],n.front[2],n.front[3],n.top[3]],a=Ir(i,o),s={type:"path",d:a},l=dg(r,n),d=ug(r,n,s),c=mg(r,a,o),u=cg(r,n,s),m=l?[c,...u,l,d]:[c,...u,d];return e.text?[...m,...Sg(r,e.text)]:m}function Ml(e){return e.flatMap((t,r)=>q(Cg(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function Rg(e,t){let r=t==="start"?0:e.length-2,n=t==="start"?2:e.length-4,o=e[r],i=e[r+1],a=e[n]-o,s=e[n+1]-i,l=Math.hypot(a,s)||1,d=a/l,c=s/l;return{x:o+d*20-c*13,y:i+c*20+d*13}}function $l(e,t,r){let n=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!n)return[];let o=p(e.link.style?.fontSize,10),i=Rg(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-o,width:a,height:o*2,lines:[n],fontFamily:e.link.style?.fontFamily??N,fontSize:o,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function Al(e){return[...$l(e,"start",0),...$l(e,"end",1)]}function El(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??N,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var xo=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}},Ol=(e,t,r,n)=>{let o=a=>{let s=Math.max(0,Math.min(255,Math.round(a))).toString(16);return s.length===1?`0${s}`:s},i=n===void 0||n>=1?"":o(n*255);return`#${o(e)}${o(t)}${o(r)}${i}`};function kg(e,t,r){let n=xo(e),o=xo(t),i=n.a??1,a=o.a??1;return Ol(Math.round(n.r+(o.r-n.r)*r),Math.round(n.g+(o.g-n.g)*r),Math.round(n.b+(o.b-n.b)*r),i+(a-i)*r)}function Dt(e,t){let r=[...e].sort((i,a)=>i.position-a.position),n=r[0],o=r[r.length-1];if(t<=n.position)return n.color;if(t>=o.position)return o.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 kg(a.color,s.color,d)}}return o.color}function Nl(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 Bl=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function xe(e,t,r,n){let o=Math.max(1,Math.floor(t/Math.max(1,r*.58))),i=n?(s,l)=>n.measure(s,!1)+n.spaceWidth+n.measure(l,!1)<=t:(s,l)=>`${s} ${l}`.length<=o,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 Dr(e,t,r,n){if(Te(e,r,n)<=t)return e;let o=e.length;for(;o>1&&Te(`${e.slice(0,o)}\u2026`,r,n)>t;)o-=1;return`${e.slice(0,o)}\u2026`}function Te(e,t,r){return e.length*t*(r?.64:.58)}function Il(e){return{measure:(t,r)=>Te(t,e,r),spaceWidth:e*.58}}var _e=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function So(e,t,r,n,o){let i=1-o;return{x:i*i*i*e.x+3*i*i*o*t.x+3*i*o*o*r.x+o*o*o*n.x,y:i*i*i*e.y+3*i*i*o*t.y+3*i*o*o*r.y+o*o*o*n.y}}function Co(e,t,r,n,o){let i=_e(e,t,o),a=_e(t,r,o),s=_e(r,n,o),l=_e(i,a,o),d=_e(a,s,o),c=_e(l,d,o);return{left:[e,i,l,c],right:[c,d,s,n]}}function _r(e,t){let r=e.length-2;if(t<=0)return{point:{x:e[0],y:e[1]},segmentIndex:0};let n=0;for(let o=0;o<r;o+=2){let i={x:e[o],y:e[o+1]},a={x:e[o+2],y:e[o+3]},s=Math.hypot(a.x-i.x,a.y-i.y);if(n+s>=t){let l=s===0?0:(t-n)/s;return{point:_e(i,a,l),segmentIndex:o}}n+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function Fr(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 Gl(e,t,r,n,o=40){let i=0,a=e;for(let s=1;s<=o;s++){let l=So(e,t,r,n,s/o);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var lt=40;function wg(e){let t=[0],r=e[0];for(let n=1;n<=lt;n++){let o=So(...e,n/lt);t.push(t[n-1]+Math.hypot(o.x-r.x,o.y-r.y)),r=o}return t}function Dl(e,t){let r=e[lt];if(t<=0)return 0;if(t>=r)return 1;for(let n=1;n<=lt;n++)if(e[n]>=t){let o=(t-e[n-1])/(e[n]-e[n-1]||1);return(n-1+o)/lt}return 1}function vg(e,t,r){let[n,o,i,a]=e,s=.75*(o.x-n.x)+1.5*(i.x-o.x)+.75*(a.x-i.x),l=.75*(o.y-n.y)+1.5*(i.y-o.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 _l(e,t){if(e.length<8)return null;let r=Pg(e),n=wg(r),o=n[lt];if(o===0)return null;let i=o/2,a=Math.max(0,i-t.minimumVisibleStub),s=vg(r,t,a),l=Dl(n,i-s),d=Dl(n,i+s);return{before:Lg(r,l),after:Tg(r,d),bezier:!0}}function Pg(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 Lg(e,t){return t<=.01?null:Co(...e,t).left.flatMap(r=>[r.x,r.y])}function Tg(e,t){return t>=.99?null:Co(...e,t).right.flatMap(r=>[r.x,r.y])}function Fl(e,t){if(e.length<4)return null;let r=Fr(e);if(r===0)return null;let n=Mg(e,r,t);return{before:Ag(e,n.beforeLength),after:Eg(e,n.afterLength,r),bezier:!1}}function Mg(e,t,r){let n=t/2,o=_r(e,n),i={x:e[o.segmentIndex],y:e[o.segmentIndex+1]},a={x:e[o.segmentIndex+2],y:e[o.segmentIndex+3]},s=$g(i,a,r,n);return{beforeLength:n-s,afterLength:n+s}}function $g(e,t,r,n){let o=Math.hypot(t.x-e.x,t.y-e.y),i=o===0?1:Math.abs(t.x-e.x)/o,a=o===0?0:Math.abs(t.y-e.y)/o,s=r.halfWidth*i+r.halfHeight*a;return Math.min(s,Math.max(0,n-r.minimumVisibleStub))}function Ag(e,t){if(t<=.5)return null;let r=_r(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function Eg(e,t,r){if(t>=r-.5)return null;let n=_r(e,t);return[n.point.x,n.point.y,...e.slice(n.segmentIndex+2)]}var Hl=3,Og=10;function Ng(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 Ro(e,t){return t?Gl(...Ng(e)):Fr(e)}function Vl(e,t,r,n){let o={halfWidth:(r+Hl)/2,halfHeight:(n+Hl)/2,minimumVisibleStub:Og};return t==="curved"?_l(e,o):Fl(e,o)}function ko(e,t,r,n){let o=Vl(e,t,r,n);if(!o||!o.before&&!o.after)return null;let i=Ro(e,o.bezier),a=o.before?Ro(o.before,o.bezier):0,s=o.after?Ro(o.after,o.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Bg(e){let[t,r,n,o,i,a,s,l]=e,d=.5,c=1-d;return{x:c*c*c*t+3*c*c*d*n+3*c*d*d*i+d*d*d*s,y:c*c*c*r+3*c*c*d*o+3*c*d*d*a+d*d*d*l}}function Ig(e,t){let r=0,n=[];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,n.push({start:s,end:l,length:d})}let o=r/2,i=0;for(let a of n){if(i+a.length>=o){let s=(o-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 wo(e,t,r,n){if(t==="curved")return Bg(e);let o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};return t==="orthogonal"?Ig(e,o):o}function dt(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function Gg(e,t,r,n,o){let i=o?.min??50,a=o?.max??240,s=o?.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*n[0]+d*n[1]),m=Math.abs(l*r[1]-d*r[0]),f=Math.abs(l*n[1]-d*n[0]),g=r[0]===n[0]&&r[1]===n[1]||r[0]===-n[0]&&r[1]===-n[1],b=Math.max(i,Math.min(a,Math.max(c,m*s))),x=Math.max(i,Math.min(a,Math.max(u,f*s)));return g&&(b=Math.min(a,b+m*.75),x=Math.min(a,x+f*.75)),{fromDistance:b,toDistance:x}}function Wl(e,t,r,n,o){let i=dt(r),a=dt(n),{fromDistance:s,toDistance:l}=Gg(e,t,i,a,o);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 zl(e,t,r,n){let{p0:o,p1:i,p2:a,p3:s}=Wl(e,t,r,n,{min:35,max:90,perpendicularScale:.5});return{points:[...o,...i,...a,...s],segments:[]}}function jl(e,t,r,n){let i=["top","bottom"].includes(r)&&["top","bottom"].includes(n),a=["left","right"].includes(r)&&["left","right"].includes(n);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 Ul(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 Xl(e,t,r,n,o){let i=40,a=40,s=o?0:1,l=o?t.x-e.x:t.y-e.y;if(r[s]!==0&&r[s]===-n[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*-n[s];d>0&&d<a&&(a=d)}return[i,a]}function ql(e){let{fromConnection:t,toConnection:r,to:n,horizontalFirst:o}=e,i=t.stub,a=r.stub,s=(i[0]+a[0])/2,l=(i[1]+a[1])/2,d=Yl(t.side),c=Yl(r.side);return d!==c?o?s=(i[0]-n.x)*r.normal[0]>=0?i[0]:a[0]:l=(i[1]-n.y)*r.normal[1]>=0?i[1]:a[1]:t.side===r.side&&(o?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 Yl(e){return e==="left"||e==="right"}function Kl(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 Zl(e,t){let{from:r,to:n,fromConnection:o,toConnection:i,horizontalFirst:a}=e,s=o.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],n.x,n.y),d}function Ql(e,t,r){let n=e?["left","right"]:["top","bottom"];return[!n.includes(t),!n.includes(r)]}function Jl(e,t,r,n){let{from:o,to:i,fromConnection:a,toConnection:s,horizontalFirst:l}=e,d=a.stub,c=s.stub,u=n[0]&&r?.[1]||0,m=r?.[2]||0,f=n[1]&&r?.[3]||0;if(l){let C=d[1]+u,L=t[0]+m,v=c[1]+f;return[o.x,o.y,d[0],C,L,C,L,v,c[0],v,i.x,i.y]}let g=d[0]+u,b=t[1]+m,x=c[0]+f;return[o.x,o.y,g,d[1],g,b,x,b,x,c[1],i.x,i.y]}function ed(e,t,r,n){let o=(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<o-1,m=a===1?r:a===o-2?n:!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 Hr(e,t){if(e.length<6)return e;let r=Hg(e),n=[r[0]];for(let o=1;o<r.length-1;o++){let i=Dg(r[o-1],r[o],r[o+1],t);n.push(...i?Fg(i):[r[o]])}return n.push(r[r.length-1]),n.flatMap(o=>[o.x,o.y])}function Dg(e,t,r,n){let o={x:t.x-e.x,y:t.y-e.y},i={x:r.x-t.x,y:r.y-t.y},a=o.x===0||o.y===0,s=i.x===0||i.y===0,l=o.x===0&&i.x===0||o.y===0&&i.y===0;if(!a||!s||l)return null;let d=Math.min(n,td(o)*.4,td(i)*.4);if(d<=0)return null;let c=rd(o),u=rd(i),m=vo(t,c,-d),f=vo(t,u,d),g=vo(m,u,d),b=Math.atan2(m.y-g.y,m.x-g.x),x=Math.atan2(f.y-g.y,f.x-g.x);return{entry:m,exit:f,center:g,radius:d,startAngle:b,angleSweep:_g(x-b)}}function vo(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function td(e){return Math.abs(e.x)+Math.abs(e.y)}function rd(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function _g(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function Fg(e){let t=[e.entry];for(let r=1;r<7;r++){let n=r/7,o=e.startAngle+e.angleSweep*n;t.push({x:e.center.x+Math.cos(o)*e.radius,y:e.center.y+Math.sin(o)*e.radius})}return t.push(e.exit),t}function Hg(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Po(e){let t=Vg(e),r=ql(t),n=Zl(t,r),o=Kl(n),i=Ql(t.horizontalFirst,e.fromSide,e.toSide),a=Jl(t,r,e.segmentOffsets,i),s=ed(a,o,i[0],i[1]);return{points:Hr(a,10),segments:s}}function Vg(e){let[t,r]=jl(e.from,e.to,e.fromSide,e.toSide),n=dt(e.fromSide),o=dt(e.toSide),i=Ul(t,r,e.endpointEdges),[a,s]=Xl(t,r,n,o,i);return{from:t,to:r,fromConnection:nd(t,e.fromSide,n,a),toConnection:nd(r,e.toSide,o,s),horizontalFirst:i}}function nd(e,t,r,n){return{side:t,normal:r,stub:[e.x+r[0]*n,e.y+r[1]*n]}}var od=.5;function id(e,t,r){let n=[e,...t,r],o=[];for(let a of n)o.push(a.x,a.y);let i=[];for(let a=0;a<o.length-2;a+=2){let s={x:o[a],y:o[a+1]},l={x:o[a+2],y:o[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:Hr(o,10),segments:i}}function Lo(e){return e.every(t=>{let r=Math.abs(t.end.x-t.start.x),n=Math.abs(t.end.y-t.start.y);return r<=od||n<=od})}function ad(e,t,r,n,o){if(e.waypoints&&e.waypoints.length>0){let l=id(t,e.waypoints,r);if(Lo(l.segments))return l}let i={fromEdge:n,toEdge:o},a={from:t,to:r,fromSide:n,toSide:o,segmentOffsets:e.segmentOffsets,endpointEdges:i},s=Po(a);return Lo(s.segments)?s:Po({...a,segmentOffsets:void 0})}function sd(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 ld(e,t,r){let n=e.fromPoint?.kind==="side"?e.fromPoint.side:sd(t,r),o=e.toPoint?.kind==="side"?e.toPoint.side:sd(r,t);return{fromSide:n,toSide:o}}function dd(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function cd(e,t,r,n){let{fromSide:o,toSide:i}=ld(e,t,r);return n==="curved"?zl(t,r,o,i):n==="orthogonal"?ad(e,t,r,o,i):dd(t,r)}function Wg(e,t){let r=e.filter((o,i)=>i%2===0),n=e.filter((o,i)=>i%2===1);return{minX:Math.min(...r)-t,minY:Math.min(...n)-t,maxX:Math.max(...r)+t,maxY:Math.max(...n)+t}}function zg(e,t){let r=!!(e.showText&&e.text),n=p(e.style?.fontSize,10),o=Math.min(250,Math.max(n*2,(e.text?.length??0)*n*.65+10)),i=t?.(e.style?.fontFamily??N,n),a=r?xe(e.text??"",o,n,i):[];return{visible:r,fontSize:n,width:o,height:a.length*n*1.4,lines:a}}function Yg(e,t,r,n){let o=e.link,i=typeof o.style?.color=="object"&&o.style.color.type==="gradient"?{kind:"linear-gradient",angle:0,stops:o.style.color.stops.map(a=>({offset:a.position,color:a.color}))}:{kind:"solid",color:r};return{fill:{kind:"none"},stroke:i,strokeWidth:t,dash:n,lineCap:"round",lineJoin:"round",opacity:p(o.style?.opacity,1),shadow:Br(o.style?.shadow)}}function ud(e,t,r){let{link:n,from:o,to:i}=e,a=n.style?.pathType??"orthogonal",{points:s,segments:l}=cd(n,o,i,a),d=p(n.style?.strokeWidth,2),c=Nl(n.style?.color)||"#64748b",u=zg(n,r),m=Bl(d,n.style?.strokeStyle??"solid"),f=u.visible&&!m?ko(s,a,u.width,u.height):null,g=f?[f.dashBefore,f.gapLength,1e6]:m;return{link:n,pathType:a,points:s,segments:l,midpoint:wo(s,a,o,i),strokeWidth:d,bounds:Wg(s,d+14),color:c,order:2e4+t,style:Yg(e,d,c,g),label:u,hasLabelGap:!!f}}function To(e,t){let r=t==="start"?e.startMarker:e.endMarker;if(r)return r;let n=e.style?.arrowDirection??"forward";return n==="bidirectional"||t==="start"&&n==="backward"||t==="end"&&n==="forward"?"arrow":"none"}function md(e,t){if(e.length===0)return"";let r=[e[0].start,...e.map(s=>s.end)],n=r.filter((s,l)=>l===0||s.x!==r[l-1].x||s.y!==r[l-1].y),o=n.filter((s,l)=>{if(l===0||l===n.length-1)return!0;let d=n[l-1],c=n[l+1];return!(d.x===s.x&&s.x===c.x||d.y===s.y&&s.y===c.y)});if(o.length<2)return"";let i=`M ${o[0].x} ${o[0].y}`;for(let s=1;s<o.length-1;s++){let l=o[s-1],d=o[s],c=o[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),g={x:d.x+(l.x-d.x)/u*f,y:d.y+(l.y-d.y)/u*f},b={x:d.x+(c.x-d.x)/m*f,y:d.y+(c.y-d.y)/m*f};i+=` L ${g.x} ${g.y} Q ${d.x} ${d.y} ${b.x} ${b.y}`}let a=o[o.length-1];return`${i} L ${a.x} ${a.y}`}function jg(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 Ug(e,t,r,n){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?md(r,Math.max(16,n*4)):jg(e)}var ct=e=>Math.round(e*100)/100;function Xg(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:ct(r.start.x),ay:ct(r.start.y),bx:ct(r.end.x),by:ct(r.end.y),ox:ct(r.originalMidpoint.x),oy:ct(r.originalMidpoint.y),movable:r.canMove}))}function pd(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:Ug(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:To(t,"start"),markerEnd:To(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:Xg(e.pathType,e.segments)}}}function fd(e){let{link:t}=e;if(t.weight===void 0||t.weight===null||t.showWeight===!1)return[];let r=t.weight.toFixed(1),n=Math.max(30,r.length*8+12),o=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-n/2,y:i-o/2,width:n,height:o,rx:o/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-n/2,y:i-o/2,width:n,height:o,lines:[r],fontFamily:"Arial, sans-serif",fontSize:10,fontWeight:"bold",color:"#ffffff",align:"center",verticalAlign:"middle",lineHeight:1}]}function qg(e,t,r){if(e.link.isVisible===!1)return[];let n=ud(e,t,r);return[pd(n),...El(n),...fd(n),...Al(n)]}function hd(e,t){return e.flatMap((r,n)=>q(qg(r,n,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function Kg(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=p(e.strokeWidth,2),n=r+12,o={minX:Math.min(...e.points.map(s=>s.x))-n,minY:Math.min(...e.points.map(s=>s.y))-n,maxX:Math.max(...e.points.map(s=>s.x))+n,maxY:Math.max(...e.points.map(s=>s.y))+n},i=p(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:o,d:me({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 gd(e){return e.flatMap((t,r)=>q(Kg(t,r),"path",t.id,"path","Path"))}function _t(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var Zg=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],Vr=Math.PI/2,Qg=4*Vr,bd=Math.PI/2,Jg=1e-9;function Mo([e,t,r],n){return[e+r*Math.cos(n),t+r*Math.sin(n)]}function yd([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function xd(e,t,r){let n=t[0]-e[0],o=t[1]-e[1],i=Math.hypot(n,o),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*n/i,d=e[1]+a*o/i,c=[[l-s*o/i,d+s*n/i],[l+s*o/i,d-s*n/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 eb(e){let t=[e.reduce((r,n)=>r+n[0],0)/e.length,e.reduce((r,n)=>r+n[1],0)/e.length];return e.map((r,n)=>{let o=n===0?bd:yd(r,xd(e[n-1],r,t)),a=n===e.length-1?bd:yd(r,xd(r,e[n+1],t));for(;a<=o;)a+=Qg;return{lobe:r,from:o,to:a}})}function tb(e,t){let r=[];for(let n=Math.floor(e/Vr)+1;n*Vr<t-Jg;n++)r.push(n*Vr);return[...r,t]}function rb({lobe:e,from:t,to:r}){let n=Mo(e,t),o=[],i=t;for(let a of tb(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Mo(e,i),d=Mo(e,a);o.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:n,curves:o}}function nb(){let e=eb(Zg).map(rb),t=e[0].start,r=e.flatMap(d=>d.curves),n=[t,...r.map(d=>d[2])],o=Math.min(...n.map(d=>d[0])),i=Math.max(...n.map(d=>d[0])),a=Math.min(...n.map(d=>d[1])),s=Math.max(...n.map(d=>d[1])),l=d=>[(d[0]-o)/(i-o),(d[1]-a)/(s-a)];return{start:l(t),curves:r.map(([d,c,u])=>[l(d),l(c),l(u)])}}var Sd=nb();function Cd(e,t,r,n){let o=([a,s])=>`${e+a*r} ${t+s*n}`,i=Sd.curves.map(([a,s,l])=>`C ${o(a)} ${o(s)} ${o(l)}`);return`M ${o(Sd.start)} ${i.join(" ")} Z`}function Rd(e,t,r,n){let o=Math.min(n*.22,r*.2),i=r/2,a=e+i,s=e,l=e+r,d=t+o,c=t+n-o,u=`M ${s} ${d} C ${s} ${d+.5523*o} ${a-.5523*i} ${d+o} ${a} ${d+o} C ${a+.5523*i} ${d+o} ${l} ${d+.5523*o} ${l} ${d} C ${l} ${d-.5523*o} ${a+.5523*i} ${t} ${a} ${t} C ${a-.5523*i} ${t} ${s} ${d-.5523*o} ${s} ${d} Z`,m=`M ${s} ${d} L ${s} ${c} C ${s} ${c+.5523*o} ${a-.5523*i} ${t+n} ${a} ${t+n} C ${a+.5523*i} ${t+n} ${l} ${c+.5523*o} ${l} ${c} L ${l} ${d}`;return`${u} ${m}`}function kd(e,t,r,n){let o=Math.min(r/4,n/4.35),i=o,a=o*2,s=o*4.35,l=t+(n-s)/2;return{head:i,body:a,centerX:e+r/2,headCenterY:l+i,bottom:l+s}}function wd(e,t,r,n){let{body:o,centerX:i,bottom:a}=kd(e,t,r,n);return{x:i-o,y:a-o,width:o*2,height:o}}function vd(e,t,r,n){let{head:o,body:i,centerX:a,headCenterY:s,bottom:l}=kd(e,t,r,n),d=`M ${a} ${s-o} C ${a+.5523*o} ${s-o} ${a+o} ${s-.5523*o} ${a+o} ${s} C ${a+o} ${s+.5523*o} ${a+.5523*o} ${s+o} ${a} ${s+o} C ${a-.5523*o} ${s+o} ${a-o} ${s+.5523*o} ${a-o} ${s} C ${a-o} ${s-.5523*o} ${a-.5523*o} ${s-o} ${a} ${s-o} 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 ob=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,n)=>t+(n%2?` ${r}`:` L ${r}`),"")} Z`,ib=.1,ab=Math.PI/6,sb=.25,lb=.15;function Pd(e,t){return Math.min(e,t)/2}function Ld(e,t,r,n,o){let i=(...a)=>ob(a);switch(e){case"diamond":return i(t+n/2,r,t+n,r+o/2,t+n/2,r+o,t,r+o/2);case"triangle":return i(t+n/2,r,t,r+o,t+n,r+o);case"parallelogram":return i(t+n*.15,r,t+n,r,t+n*.85,r+o,t,r+o);case"trapezoid":return i(t+n*.2,r,t+n*.8,r,t+n,r+o,t,r+o);case"hexagon":{let a=Math.min(n,o)/4;return i(t+a,r,t+n-a,r,t+n,r+o/2,t+n-a,r+o,t+a,r+o,t,r+o/2)}case"document":{let a=o*ib,s=r+o-a,l=n/4,d=a*ab;return`M ${t} ${r} L ${t+n} ${r} L ${t+n} ${s} C ${t+n-l/3} ${s-d} ${t+n-l*2/3} ${s-a} ${t+n-l} ${s-a} C ${t+n-l-l/3} ${s-a} ${t+n/2+l/3} ${s-d} ${t+n/2} ${s} C ${t+n/2-l/3} ${s+d} ${t+n/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(n,o)*sb;return`M ${t} ${r} L ${t+n-a} ${r} L ${t+n} ${r+a} L ${t+n} ${r+o} L ${t} ${r+o} Z M ${t+n} ${r+a} L ${t+n-a} ${r+a} L ${t+n-a} ${r}`}case"cloud":return Cd(t,r,n,o);case"cylinder":return Rd(t,r,n,o);case"person":return vd(t,r,n,o);case"predefined_process":{let a=Math.min(n,o)*lb;return`M ${t} ${r} L ${t+n} ${r} L ${t+n} ${r+o} L ${t} ${r+o} Z M ${t+a} ${r} L ${t+a} ${r+o} M ${t+n-a} ${r} L ${t+n-a} ${r+o}`}default:return null}}function le(e){let t=Ld(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{..._t(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function Td(e){return le(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function ut(e){let t=e.shape.shapeType==="pill"?Pd(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?p(e.shape.cornerRadius,8):0;return[{..._t(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function $o(e){return[{..._t(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function Md(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return ut(e);let t=p(e.shape.symbol.tension,0),r=e.shape.symbol.points.map(([n,o])=>({x:e.x+n*e.width,y:e.y+o*e.height}));return[{..._t(e),type:"path",d:me({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 db={cloud:le,cylinder:le,diamond:le,document:le,hexagon:le,note:le,oval:$o,circle:$o,parallelogram:le,person:Td,pill:ut,predefined_process:le,rectangle:ut,rounded_rectangle:ut,symbol:Md,trapezoid:le,triangle:le};function Ft(e){return(db[e.shape.shapeType]??ut)(e)}var cb={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},j={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},$d={rectangle:j,rounded_rectangle:{...j,cornerRadius:8},triangle:{...j,rotation:0},diamond:{...j,rotation:0},hexagon:{...j,rotation:0},oval:{...j,rotation:0},circle:{...j,rotation:0},document:{...j,rotation:0},parallelogram:{...j,rotation:0},trapezoid:{...j,rotation:0},cylinder:{...j,rotation:0},note:{...j,rotation:0},cloud:{...j,rotation:0},predefined_process:{...j,rotation:0},pill:j,person:{...j,rotation:0},symbol:{...j,rotation:0}};function Ao(e,t){let r=$d[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${cb[e.shapeType]??""}, falling back to rectangle defaults.`}),$d.rectangle)}function ub(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function Ad(e,t){let r=Ao(e,t),n=p(e.strokeWidth,r.strokeWidth),o=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=p(o?.angle,45)*Math.PI/180;return{fill:k(e.fillColor,t,e.id),stroke:k(e.strokeColor,t,e.id),strokeWidth:n,dash:ub(e,n),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:p(e.opacity,r.opacity),shadow:o?.enabled?{color:o.color??"#000000",opacity:p(o.opacity,.25),blur:p(o.blur,10),dx:Math.cos(i)*p(o.distance,5),dy:Math.sin(i)*p(o.distance,5)}:void 0}}var Eo=/\*\*([^*]+)\*\*/g;function Ed(e){return/\*\*[^*]+\*\*/.test(e)}function mb(e){let t=[],r=0;Eo.lastIndex=0;let n;for(;n=Eo.exec(e);)n.index>r&&t.push({text:e.slice(r,n.index),bold:!1}),n[1]&&t.push({text:n[1],bold:!0}),r=Eo.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function pb(e){return e.split(`
13
- `).map(mb)}function fb(e){let t=[];for(let r of e)for(let n of r.text.split(/\s+/))n&&t.push({text:n,bold:r.bold});return t}function hb(e,t,r,n){let o=fb(e);if(!o.length)return[[]];let i=[],a=[],s=0;for(let l of o){let d=r(l.text,l.bold),c=a.length?n+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 Od(e,t,r,n){return pb(e).flatMap(o=>hb(o,Math.max(1,t),r,n))}function Nd(e,t,r){let{shape:n,bounds:o,order:i,rotation:a,rotationCenter:s,x:l,y:d,width:c,height:u}=e;if(!n.text)return null;let m=p(n.fontSize,Ao(n,[]).fontSize),f=n.isText?0:Math.max(8,t*2),g=n.shapeType==="person"?wd(l,d,c,u):{x:l,y:d,width:c,height:u},b=Math.max(0,g.width-f*2),x=n.fontFamily||N,C=r?.(x,m),L={type:"text",id:`shape-text-${n.id}`,order:i+.5,bounds:o,x:g.x+f,y:g.y+f,width:b,height:Math.max(0,g.height-f*2),lines:xe(n.text,b,m,C),fontFamily:x,fontSize:m,fontWeight:n.fontWeight??"normal",letterSpacing:n.letterSpacing,color:n.textColor||"#111827",align:n.textAlign??"center",verticalAlign:n.textVerticalAlign??"middle",lineHeight:p(n.lineHeight,1.3),rotation:a,rotationCenter:s};if(Ed(n.text)){let{measure:v,spaceWidth:$}=C??Il(m);L.richLines=Od(n.text,b,v,$)}return L}function gb(e,t){let r=Math.max(0,e.width-2*t),n=Math.max(0,e.height-2*t),o={...e.style,fill:{kind:"none"},strokeWidth:Math.max(1,t/3),dash:void 0,shadow:void 0},i=Ft({...e,style:o});if(r<=0||n<=0)return i;let a={...e,x:e.x+t,y:e.y+t,width:r,height:n};return i.push(...Ft({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...Ft({...a,id:`${e.id}-inner`,style:o})),i}function bb(e,t,r){let n=p(e.x,0),o=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:re({x:n,y:o,width:i,height:a},s,l+(e.hasShadow?20:2)),rotation:s,rotationCenter:{x:n+i/2,y:o+a/2},style:Ad(e,r),x:n,y:o,width:i,height:a}}}function yb(e){if(!(!e.shape.shader||e.shape.shapeType!=="circle"&&e.shape.shapeType!=="oval"))return{id:`${e.id}-shader`,type:"shader-surface",order:e.order,bounds:e.bounds,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,shader:e.shape.shader,mask:"ellipse",fillColor:e.style.fill?.kind==="solid"?e.style.fill.color:void 0}}function xb(e,t,r,n){if(e.isVisible===!1)return[];let{context:o,strokeWidth:i}=bb(e,t,r),a=e.strokeStyle==="double"?gb(o,i||1):Ft(o),s=yb(o);if(s){for(let d of a)(d.type==="ellipse"||d.type==="path"||d.type==="rect")&&(d.style={...d.style,pointerEvents:"all"});a.push(s)}let l=Nd(o,i,n);return l&&a.push(l),a}function Bd(e,t,r){return e.flatMap((n,o)=>q(xb(n,o,t,r),"shape",n.id,n.shapeType,n.text||n.shapeType,n.parentFrameId??void 0))}function Ht(e,t){let r=String(e);return t===void 0||!Number.isInteger(t)||t<1?r:r.padStart(t,"0")}var U={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 Oo(e){return{color:e.color??U.color,surface:e.surface??U.surface,divider:e.divider??U.divider,labelColor:e.labelColor??U.labelColor,fontFamily:e.fontFamily??U.fontFamily,variant:e.variant??U.variant,motion:e.motion??U.motion,fontWeight:e.fontWeight??U.fontWeight,fontSize:e.fontSize??U.fontSize}}function Sb(e,t){let r=p(e.x,0),n=p(e.y,0),o=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:re({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,value:Ht(e.value,e.digits),digits:e.digits,duration:Math.max(0,p(e.duration,420)),label:e.label,widgetStyle:Oo(e.style)}]}function Cb(e,t){let r=p(e.x,0),n=p(e.y,0),o=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:re({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,shader:{name:e.id,program:"tickScale",parameters:{...e.parameters,progress:l,max:s}},mask:"ellipse"}];return e.labels&&d.push(...Rb(e,{x:r,y:n,width:o,height:i,rotation:a,max:s,order:1e4+t})),d}function Rb(e,t){let r=e.labels??{},n=Math.max(1,p(Number(e.parameters.ticks),48)),o=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(n/o),m=[];for(let f=0;f<=u;f+=1){let g=f*o/n,b=i-g*a,x=d+Math.cos(b)*s*(t.width/2),C=c-Math.sin(b)*s*(t.height/2),L={x:x-24,y:C-l,width:48,height:l*2};m.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:re(L,0,2),...L,lines:[String(Math.round(t.max*g*10)/10)],fontFamily:r.fontFamily||N,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return m}function kb(e,t){let r=p(e.x,0),n=p(e.y,0),o=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:re({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,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(...wb(e,{x:r,y:n,width:o,height:i,min:s,max:l,order:1e4+t})),c}function wb(e,t){let r=e.labels??{},n=e.parameters.axis==="horizontal",o=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=n?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(o/i),f=[];for(let g=0;g<=m;g+=1){let b=g*i/o,x=a+(1-2*a)*b,C=n?{x:t.x+t.width*x-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-x)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${g}`,type:"text",order:t.order+.1,bounds:re(C,0,2),...C,lines:[String(Math.round((t.min+(t.max-t.min)*b)*10)/10)],fontFamily:r.fontFamily||N,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:n?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}function Id(e){return e.flatMap((t,r)=>q(t.type==="tickScale"?Cb(t,r):t.type==="ruler"?kb(t,r):Sb(t,r),"widget",t.id,t.type,t.label??t.value,t.parentFrameId))}var M=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],W="#94a3b8",Vt=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],No=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function D(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,n=[];for(let o=e.min;(t?o<=e.max+1e-9:o>=e.max-1e-9)&&n.length<1e3;o+=r)n.push(Math.round(o*1e3)/1e3);return n}function Wt(e){let t=[...e.thresholds??[]].filter(r=>r>e.min&&r<e.max).sort((r,n)=>r-n);return[e.min,...t,e.max]}function zt(e,t,r){let n=Math.max(0,t.length-1),o=r.slice(0,n).map((i,a)=>({position:t[a+1]??t[t.length-1],color:i.color??W}));return o.length?Dt(o,e):W}function de(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var ce={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function Bo(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function Io(e,t,r){let n=r?ce.padX:0,o=r?ce.padY:0,i=t*ce.lineHeight;return{width:e.length*t*ce.charWidth+n*2,height:i+o*2,lineHeight:i,padX:n,padY:o}}function Go(e,t,r,n){let o=n/2;return`M ${e+o} ${t} H ${e+r-o} A ${o} ${o} 0 0 1 ${e+r-o} ${t+n} H ${e+o} A ${o} ${o} 0 0 1 ${e+o} ${t} Z`}function Wr(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} 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+n} H ${e} Z`}function Se(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+n-i} Q ${e+r} ${t+n} ${e+r-i} ${t+n} H ${e+i} Q ${e} ${t+n} ${e} ${t+n-i} V ${t+i} Q ${e} ${t} ${e+i} ${t} Z`}function Fe(e,t,r,n,o,i){return i?Se(e,t,r,n,o):Wr(e,t,r,n,o)}function Do(e,t){if(e.length===1)return e[0];let r=(e.length-1)*t,n=Math.floor(r),o=Math.ceil(r);return n===o?e[n]:e[n]+(r-n)*(e[o]-e[n])}function _o(e){if(!e?.length)return null;let t=[...e].sort((r,n)=>r-n);return{min:t[0],q1:Do(t,.25),median:Do(t,.5),q3:Do(t,.75),max:t[t.length-1]}}function Yt(e){if(e?.[0]!=="#")return;let t=e.length===4?e.slice(1).split("").map(i=>parseInt(i+i,16)):[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)),[r,n,o]=t;return[r,n,o].some(i=>Number.isNaN(i))?void 0:[r,n,o]}function Fo(e,t){let r=Yt(e),n=Math.max(0,Math.min(1,t));if(!r)return n<=0?"transparent":e??"transparent";let[o,i,a]=r;return`rgba(${o}, ${i}, ${a}, ${n})`}function Ho(e,t,r){let n=o=>Math.round(Math.max(0,Math.min(255,o))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(r)}`}function Yr(e,t,r){let n=e/255,o=t/255,i=r/255,a=Math.max(n,o,i),s=Math.min(n,o,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===n?u=(o-i)/d%6:a===o?u=(i-n)/d+2:u=(n-o)/d+4,u*=60,u<0&&(u+=360),[u,c,l]}function Vo(e,t,r){let n=(1-Math.abs(2*r-1))*t,o=n*(1-Math.abs(e/60%2-1)),i=r-n/2,[a,s,l]=[0,0,0];return e<60?[a,s,l]=[n,o,0]:e<120?[a,s,l]=[o,n,0]:e<180?[a,s,l]=[0,n,o]:e<240?[a,s,l]=[0,o,n]:e<300?[a,s,l]=[o,0,n]:[a,s,l]=[n,0,o],[(a+i)*255,(s+i)*255,(l+i)*255]}function Gd(e,t,r){let n=o=>{let i=o/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*n(e)+.7152*n(t)+.0722*n(r)}function vb(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}var zr=.35,Dd=.08,_d=.22,Fd=.78,Hd=.92,Pb=3;function Z(e){let t=Yt(e);if(!t)return"#0f172a";let[r,n,o]=t,i=(.299*r+.587*n+.114*o)/255>.6?"#0f172a":"#ffffff",[a,s,l]=Yr(r,n,o);if(s===0)return i;let d=l>.5?Math.max(Dd,Math.min(l-zr,_d)):Math.min(Hd,Math.max(l+zr,Fd)),c=Vo(a,s,d);return vb(Gd(r,n,o),Gd(...c))>=Pb?Ho(...c):i}function mt(e,t){let r=Yt(e);if(!r)return t;let[n,o,i]=r,[a,s,l]=Yr(n,o,i);if(s===0)return t;let d=l>.5?Math.max(Dd,Math.min(l-zr,_d)):Math.min(Hd,Math.max(l+zr,Fd));return Ho(...Vo(a,s,d))}function jr(e){let t=Yt(e);return t?Yr(...t)[2]>.5:!1}function Ee(e,t){let r=Yt(e);if(!r)return;let[n,o]=Yr(...r);if(o!==0)return Ho(...Vo(n,o,t))}function E(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function jt(e,t){return Array.isArray(t)?[e-t[0],e+t[1]]:[e-t,e+t]}function Ut(e){return{type:"path",id:e.id,order:e.order,bounds:e.bounds,d:Lb(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 Lb(e){let{centerX:t,startY:r,endY:n}=e,o=t-5,i=t+5;return`M ${t} ${r} L ${t} ${n} M ${o} ${r} L ${i} ${r} M ${o} ${n} L ${i} ${n}`}function pe(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var Xr=18,Ur=e=>e.config;function Q(e){return e.chartType==="bar"&&Ur(e)?.orientation==="horizontal"}function pt(e,t){let r=de({series:e.series,config:Ur(e)}),n=t.height/r,o=Math.min(Math.max(0,p(Ur(e)?.barGroupGap,8)),Math.max(0,n-1)),i=e.categoryAlign==="left"?Xr:0,a=Math.max(1,n-o-i),s=p(Ur(e)?.barThickness,0),l=s>0?Math.min(a,s):a;return{count:r,slotHeight:n,groupGap:o,labelRow:i,barsHeight:l,offset:(a-l)/2}}function ft(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function ht(e,t){return t>0?me({points:e,tension:t,closed:!1}):`M ${e.map((n,o)=>`${o?"L":""} ${n.x} ${n.y}`).join(" ")}`}function qr(e,t,r,n){let o=Math.max(1,Math.min(e,t)/2-4),i=Math.max(0,Math.min(r??0,o-1)),a=Math.max(0,Math.min(n??0,o/2)),s=Math.max(1,o-a),l=i>0?Math.min(i+a,s-1):0;return{outerRadius:s,innerRadius:l,cornerRadius:a}}function z(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function Xt(e,t,r,n){let o=t.x-e.x,i=t.y-e.y,a=0,s=1;if(Math.abs(o)>1e-6){let d=(t.x-r-e.x)/o,c=(t.x+r-e.x)/o;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-n-e.y)/i,c=(t.y+n-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*o,y:e.y+l*i}}function bt(e,t){return Math.abs(t-e)>Math.PI?1:0}function He(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function Vd(e,t){return{start:e.start+t,end:e.end-t}}function Ve(e,t,r){if(e<=0)return 0;let n=Math.min(Math.abs(t)/2,Math.PI/2),o=Math.sin(n);return o<=1e-6?r:Math.min(e/o,r)}function Tb(e,t,r){let n=z(e,t.start,e.outerRadius),o=z(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${bt(t.start,t.end)} 1 ${o.x} ${o.y}`,"Z"].join(" ")}function Mb(e,t,r,n){let o=z(e,r.start,e.outerRadius),i=z(e,r.end,e.outerRadius),a=z(e,n.end,t),s=z(e,n.start,t);return[`M ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${bt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${bt(n.start,n.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Wd=.82;function gt(e,t,r,n,o,i){let a=Math.min(1,o/r),s=n+i*Math.asin(a),l=Math.sqrt(Math.max(0,r*r-o*o));return{lineTangent:{x:e.centerX+l*Math.cos(n),y:e.centerY+l*Math.sin(n)},arcTangent:z(e,s,t),angle:s}}function qt(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Wd),i=e*o/(1+o),a=t>0?t*o:Number.POSITIVE_INFINITY,s=t>0?(e-t)/2:e/2;return Math.max(0,Math.min(i,a,s))}function Kt(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Wd),i=e*o/(1+o),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function $b(e,t,r,n){let{outerRadius:o}=e,i=o-r,a=gt(e,o,i,t.start,r,1),s=gt(e,o,i,t.end,r,-1);return[`M ${n.x} ${n.y}`,`L ${a.lineTangent.x} ${a.lineTangent.y}`,`A ${r} ${r} 0 0 1 ${a.arcTangent.x} ${a.arcTangent.y}`,`A ${o} ${o} 0 ${bt(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 Ab(e,t,r,n,o){let{outerRadius:i}=e,a=i-o,s=gt(e,i,a,r.start,o,1),l=gt(e,i,a,r.end,o,-1),d=t+o,c=gt(e,t,d,n.start,o,1),u=gt(e,t,d,n.end,o,-1);return[`M ${s.lineTangent.x} ${s.lineTangent.y}`,`A ${o} ${o} 0 0 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${i} ${i} 0 ${bt(s.angle,l.angle)} 1 ${l.arcTangent.x} ${l.arcTangent.y}`,`A ${o} ${o} 0 0 1 ${l.lineTangent.x} ${l.lineTangent.y}`,`L ${u.lineTangent.x} ${u.lineTangent.y}`,`A ${o} ${o} 0 0 1 ${u.arcTangent.x} ${u.arcTangent.y}`,`A ${t} ${t} 0 ${bt(u.angle,c.angle)} 0 ${c.arcTangent.x} ${c.arcTangent.y}`,`A ${o} ${o} 0 0 1 ${c.lineTangent.x} ${c.lineTangent.y}`,"Z"].join(" ")}function yt(e,t,r){let n=Math.max(0,r)/2,o=Ve(n,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=o}function We(e,t,r=0,n=0){let o=Math.max(0,n)/2,i=Vd(t,He(o,e.outerRadius));if(!yt(e,t,n)){let s=Ve(o,t.end-t.start,e.outerRadius),l=z(e,(t.start+t.end)/2,s);return r>0?$b(e,i,r,l):Tb(e,i,l)}let a=Vd(t,He(o,e.innerRadius));return r>0?Ab(e,e.innerRadius,i,a,r):Mb(e,e.innerRadius,i,a)}function Me(e,t,r,n,o,i,a){let s=t==="horizontal",l=s?e.width:e.height,d=Math.max(1,(l-n*(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 g=Math.min(1,Math.max(0,u-f))*d;if(g<.5)continue;let b=f*(d+n);m.push(s?Se(e.x+b,e.y,g,e.height,o):Se(e.x,e.y+e.height-b-g,e.width,g,o))}return m.join(" ")}function O(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 Zt(e,t,r,n,o){let i=e.series[n].values[r]??0;return t==="waterfall"?Eb(e,r,n,o,i):t==="percent"?Ob(e,r,n,o,i):Nb(e,r,n,o,i)}function Eb(e,t,r,n,o){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return zd(o,i,i+o,e,n)}function Ob(e,t,r,n,o){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(o);return{value:o,pixelStart:a/i*n,pixelEnd:(a+s)/i*n}}function Nb(e,t,r,n,o){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return zd(o,i,i+o,e,n)}function zd(e,t,r,n,o){return{value:e,pixelStart:T(t,n.axisY,o),pixelEnd:T(r,n.axisY,o)}}function w(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??N,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 Bb=/^[A-Za-z_][A-Za-z0-9_]*$/;function xt(e,t,r){return Bb.test(t)?`${e}[${t}].${r}`:void 0}var Yd="text";function Wo(e){return`Axis[${e}].label`}function Kr(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function Ce(e){return xt("Series",e,"label")}function jd(e){return xt("Series",e,"color")}function J(e,t){return Number.isInteger(t)&&t>=0?xt("Series",e,`values[${t}]`):void 0}function St(e,t){return Number.isInteger(t)&&t>=0?xt("Series",e,`colors[${t}]`):void 0}function Ud(e){return xt("Rule",e,"text")}function Xd(e){return xt("Rule",e,"at")}function Ib(e,t,r){return e.axisX.label?{...w({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:Wo("x")}:null}function Gb(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...w({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:Wo("y")}}function qd(e,t,r){let n=[],o=Ib(e,t,r);o&&n.push(o);let i=Gb(e,t,r+n.length);return i&&n.push(i),n}function Kd(e,t,r){let n=Math.max(1,e.series.length),o=t.plot.height/n;return e.series.map((i,a)=>{let s=t.plot.y+(a+.5)*o;return{...w({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:Ce(i.id)}})}var Db=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function Zd(e){return _b(e.chart)?zb(e).flatMap(t=>Yb(e,t)):[]}function _b(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!Db.has(e.chartType)&&!t}function zo(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var Yo=22,Zr=16;function jo(e){return e==="bottomLeft"||e==="bottomRight"}function Uo(e){return zo(e).map(t=>Math.max(42,t.label.length*p(e.fontSize,12)*.58+22))}function Qd(e){let t=Uo(e);return t.length?Math.max(...t):0}function Fb(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function Hb(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function Vb(e){let{chart:t,plot:r,order:n}=e,o=zo(t),i=Uo(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-Zr-a:r.x+r.width+Zr,l=r.y+r.height-15;return o.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(o.length-1-c)*Yo,width:i[c],order:n+(o.length-1-c)*2}))}function Wb(e){let{chart:t,plot:r,order:n}=e,o=zo(t),i=Uo(t),a=i.reduce((d,c)=>d+c,0),s=Hb(t,r),l=Fb(t,r,a);return o.map((d,c)=>{let u=i[c],m=l;return l+=u,{series:d,seriesIndex:c,x:m,y:s,width:u,order:n+(o.length-1-c)*2}})}function zb(e){return jo(e.chart.legendPosition)?Vb(e):Wb(e)}function Yb(e,t){return[jb(e,t),Ub(e,t)]}function jb(e,t){let{chart:r,bounds:n,diagnostics:o}=e,i=M[t.seriesIndex%M.length],a=r.chartType==="line",s=a?E(t.series.color,i):t.series.color??i;return{type:"rect",id:`chart-legend-swatch-${r.id}-${t.series.id}`,order:t.order,bounds:n,x:t.x,y:t.y,width:10,height:10,rx:3,prop:jd(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:k(s,o,r.id)}}}function Ub(e,t){let{chart:r,bounds:n}=e;return{...w({role:"legend",id:`chart-legend-${r.id}-${t.series.id}`,order:t.order+1,bounds:n,frame:{x:t.x+15,y:t.y-3,width:t.width-15,height:18},text:t.series.label,chart:r}),prop:Ce(t.series.id)}}var ec=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),Xb=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function ze(e){return!Xb.has(e.chartType)}function Oe(e){return ze(e)?Math.max(0,p(e.tickLength,0)):0}function qb(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Kb(e){let t=p(e.fontSize,12);return Math.max(0,...e.series.map(n=>(n.label||n.id).length))*t*.58+16}var Jd=66;function Zb(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function Qb(e){let t=p(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(n=>n.length))*t*.58+16}function Jb(e){return qb(e)?Kb(e):Q(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:Qb(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function tc(e){let t=e.showAxisLabels!==!1,r=e.showLegend!==!1,n=e.legendPosition??"top",o=n==="top",i=r&&e.series.length>0,a=i&&jo(n),s=a?Qd(e)+Zr:0,l=Zb(e,r),d=Oe(e),c=d+(t?Jb(e):12)+(n==="bottomLeft"?s:0)+(l==="left"?Jd:0),u=24+(n==="bottomRight"?s:0)+(l==="right"?Jd:0),m=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",f=Q(e)&&e.showValueAxis!==!1,g=t?Q(e)?f?34:12:(e.axisX.label?52:34)+(m?18:0):12,b=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,x=i&&!o&&!a,C=d+g+(b?44:0)+(x?16+Yo:0),v=(e.title?Math.max(44,20+p(e.titleSize,14)*1.6):0)||(o&&i?44:24);return{bounds:K({x:e.x,y:e.y,width:e.width,height:e.height},p(e.strokeWidth,1)+2),plot:{x:e.x+c,y:e.y+v,width:Math.max(1,e.width-c-u),height:Math.max(1,e.height-v-C)},showLabels:t,showLegend:r,padLeft:c}}function ey(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,n)=>String(n+1))}function rc(e,t,r){let n=de(e),o=t.plot.width/n,i=ey(e,n),a=!!e.config?.categories?.length,s=e.categoryAlign==="left",l=s?Math.min(Math.max(0,p(e.config?.barGroupGap,8)),Math.max(0,o-1)):0;return Array.from({length:n},(d,c)=>{let u=t.plot.x+(c+.5)*o;return{...w({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+c,bounds:t.bounds,frame:{x:s?t.plot.x+c*o+l/2:u-o/2,y:t.plot.y+t.plot.height+4+Oe(e),width:s?o-l:o,height:18},text:i[c]??String(c+1),chart:e,align:s?"left":"center"}),prop:a?Kr(c):void 0}})}function nc(e,t,r){let n=Math.max(1,e.series.length),o=t.plot.width/n;return e.series.map((i,a)=>{let s=t.plot.x+(a+.5)*o;return{...w({role:"axis",id:`chart-x-tick-${e.id}-${a}`,order:r+a,bounds:t.bounds,frame:{x:s-o/2,y:t.plot.y+t.plot.height+4+Oe(e),width:o,height:18},text:i.label||i.id,chart:e,align:"center"}),prop:Ce(i.id)}})}function oc(e,t,r){return D(e.axisX).map((n,o)=>{let i=t.plot.x+T(n,e.axisX,t.plot.width);return w({role:"axis",id:`chart-x-tick-${e.id}-${n}`,order:r+o,bounds:t.bounds,frame:{x:i-20,y:t.plot.y+t.plot.height+10+Oe(e),width:40,height:18},text:String(n),chart:e,align:"center"})})}function ic(e,t,r){return D(e.axisY).map((n,o)=>{let i=t.plot.y+t.plot.height-T(n,e.axisY,t.plot.height);return w({role:"axis",id:`chart-y-tick-${e.id}-${n}`,order:r+o,bounds:t.bounds,frame:{x:e.x,y:i-6,width:t.padLeft-14-Oe(e),height:18},text:String(n),chart:e,align:"right"})})}function Xo(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function ty(e,t,r){return e.chartType==="bar"?rc(e,t,r):e.chartType==="boxplot"&&!Xo(e)?nc(e,t,r):oc(e,t,r)}function ry(e,t,r){return Xo(e)?Kd(e,t,r):e.showValueAxis===!1?[]:ic(e,t,r)}function ny(e,t){let{plot:r}=t;if(e.chartType==="bar"){let n=de(e);return Array.from({length:n},(o,i)=>r.x+(i+.5)*r.width/n)}return D(e.axisX).map(n=>r.x+T(n,e.axisX,r.width))}function oy(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function iy(e,t,r){let n=p(e.axisLineWidth,0),o=p(e.tickLength,0);if(n<=0&&o<=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:n>0?n:1,pointerEvents:"none",...oy(e,n>0?n: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(n>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}`)),o>0&&Q(e)){D(e.axisY).forEach(m=>{let f=i.x+T(m,e.axisY,i.width);c(`tick-v-${m}`,`M ${f} ${s} L ${f} ${s+o}`)});let u=pt(e,i);for(let m=0;m<u.count;m++){let f=ft(u,i,m)+u.labelRow+u.barsHeight/2;c(`tick-c-${m}`,`M ${i.x-o} ${f} L ${i.x} ${f}`)}}return o>0&&!Xo(e)&&!Q(e)&&(D(e.axisY).forEach(u=>{let m=s-T(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-o} ${m} L ${i.x} ${m}`)}),ny(e,t).forEach((u,m)=>{c(`tick-x-${m}`,`M ${u} ${s} L ${u} ${s+o}`)})),d}function ay(e,t){let r=e.config?.categories;return Array.from({length:t},(n,o)=>r?.[o]??String(o+1))}function sy(e,t,r){let{plot:n,bounds:o}=t,i=pt(e,n),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=ay(e,i.count).map((c,u)=>{let m=ft(i,n,u);return{...w({role:"axis",id:`chart-y-category-${e.id}-${u}`,order:r+u,bounds:o,frame:a?{x:n.x,y:m,width:n.width,height:i.labelRow}:s?{x:n.x+14,y:m+i.barsHeight/2-9,width:n.width-28,height:18}:{x:e.x+8,y:m+i.barsHeight/2-9,width:n.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?Kr(u):void 0}});return e.showValueAxis!==!1&&D(e.axisY).forEach((c,u)=>{let m=n.x+T(c,e.axisY,n.width);d.push(w({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+i.count+u,bounds:o,frame:{x:m-20,y:n.y+n.height+4+p(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function ac(e,t,r){if(!ze(e))return[];let n=iy(e,t,r);if(!t.showLabels)return n;if(r+=n.length,Q(e))return[...n,...sy(e,t,r)];let o=ty(e,t,r),i=ry(e,t,r+o.length),a=qd(e,t,r+o.length+i.length);return[...n,...o,...i,...a]}function sc(e,t,r,n){let o=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**(n/2);o+=c*a.value,i+=c}return i===0?0:o/i}var qo=32;function Qt(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function lc(e,t,r,n){let o=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(qo,Math.round(Math.sqrt(qo*qo*o)))),a=Math.max(2,Math.round(i/o)),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?sc(e,u,d,n):0}}return{grid:s,cols:i,rows:a}}var dc=new Set(["scatter","custom","hexbin"]);var cc=-Math.PI/2,ly=.5,dy=6;function cy(e){return Math.max(38,e*3.2)}function Qr(e,t,r,n=!0){let o=n?cy(r):dy;return Math.max(8,Math.min(e,t)/2-o)}function Jr(e,t){return Math.max(3,e||t)}function uy(e,t){return cc+t*Math.PI*2/e}function Ko(e,t,r){let n=t===e?0:(r-e)/(t-e);return cc+n*Math.PI*2}function uc(e,t,r){let n=uy(e.count,t);return{x:e.centerX+Math.cos(n)*r,y:e.centerY+Math.sin(n)*r}}function mc(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 en(e,t,r=ly){return e.length===0?"":t?me({points:e,tension:r,closed:!0}):`M ${e.map((o,i)=>`${i?"L ":""}${o.x} ${o.y}`).join(" ")} Z`}function tn(e,t,r,n,o,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:n,cx:o,cy:i,rx:l,ry:l,style:d};let c=l*2;return{type:"rect",id:t,order:r,bounds:n,x:o-l,y:i-l,width:c,height:c,style:d}}function Jt(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function pc(e,t,r,n){let o=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 my(e,r,n,o,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...Jt(e,s)},d=[];return D(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*fc(e,c);d.push({type:"ellipse",id:`chart-grid-ring-${e.id}-${c}`,order:n+d.length,bounds:r,cx:o,cy:i,rx:u,ry:u,style:l})}),D(e.axisX).forEach(c=>{let u=Ko(e.axisX.min,e.axisX.max,c),m=o+Math.cos(u)*a,f=i+Math.sin(u)*a;d.push({type:"path",id:`chart-grid-spoke-${e.id}-${c}`,order:n+d.length,bounds:r,d:`M ${o} ${i} L ${m} ${f}`,style:l})}),d}function my(e,t,r,n,o,i,a){let s=D(e.axisY).filter(c=>c>e.axisY.min),l=D(e.axisX),d=[];return s.forEach(c=>{let u=i*fc(e,c);l.forEach(m=>{let f=Ko(e.axisX.min,e.axisX.max,m),g=n+Math.cos(f)*u,b=o+Math.sin(f)*u,x=`chart-grid-dot-${e.id}-${m}-${c}`;d.push(tn(e,x,r+d.length,t,g,b,a,void 0))})}),d}function fc(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 rn(e,t,r,n){if(e.showGrid===!1||!ze(e))return[];if(e.gridShape==="circle"&&dc.has(e.chartType))return pc(e,t,r,n);let o=p(e.gridWidth,1);if(Q(e))return py(e,t,r,n,o);let i=e.chartType==="field"?Qt(e,t):void 0;if(e.gridLineStyle==="dotted")return fy(e,t,r,n,o,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...Jt(e,o),clip:i},s=[];return(e.gridAxes==="y"?[]:D(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:n+s.length,bounds:r,d:`M ${d} ${t.y} L ${d} ${t.y+t.height}`,style:a})}),(e.gridAxes==="x"?[]:D(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:n+s.length,bounds:r,d:`M ${t.x} ${d} L ${t.x+t.width} ${d}`,style:a})}),s}function py(e,t,r,n,o){if(e.gridAxes==="y")return[];let i={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...e.gridLineStyle==="dotted"?{dash:[.1,o*3],lineCap:"round"}:Jt(e,o)};return D(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:n+s,bounds:r,d:`M ${l} ${t.y} L ${l} ${t.y+t.height}`,style:i}})}function fy(e,t,r,n,o,i){let a=D(e.axisX),s=D(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(tn(e,f,n+l.length,r,c,m,o,i))})}),l}function hc(e){return e.chart.rules?.length?hy(e).flatMap(t=>gy(e,t)):[]}function hy(e){let t=e.order;return(e.chart.rules??[]).map(r=>{let n=t++,o=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:n,labelOrder:o}})}function gy(e,t){let r=[by(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(yy(e,t)),r}function by(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:Xd(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 yy(e,t){let r=Math.max(9,p(e.chart.fontSize,12)-2);return{...w({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:Ud(t.rule.id)}}function Zo(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 gc(e,t,r){if(!e.fillImage)return[];let n=Zo(e),o=[{type:"image",id:`chart-image-${e.id}`,order:r.next(),bounds:t,x:n.x,y:n.y,width:n.width,height:n.height,href:e.fillImage.url,style:{clip:{type:"rect",...n},pointerEvents:"none"}}];return e.fillImage.overlay&&o.push({type:"rect",id:`chart-image-overlay-${e.id}`,order:r.next(),bounds:t,x:n.x,y:n.y,width:n.width,height:n.height,rx:n.rx,style:{fill:{kind:"solid",color:e.fillImage.overlay},pointerEvents:"none"}}),o}function Ct(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=p(n.config?.barGlassBlur,0);if(a<=0||!n.fillImage)return[];let s=Zo(n),l=[{type:"image",id:`chart-bar-glass-${n.id}-${t}`,order:i(),bounds:o,x:s.x,y:s.y,width:s.width,height:s.height,href:n.fillImage.url,style:{blur:a,saturate:p(n.config?.barGlassSaturation,1),clip:{type:"path",d:r},pointerEvents:"none"}}];return n.fillImage.overlay&&l.push({type:"path",id:`chart-bar-glass-overlay-${n.id}-${t}`,order:i(),bounds:o,d:r,style:{fill:{kind:"solid",color:n.fillImage.overlay},pointerEvents:"none"}}),n.config?.barGlassTint&&l.push({type:"path",id:`chart-bar-glass-tint-${n.id}-${t}`,order:i(),bounds:o,d:r,style:{fill:{kind:"solid",color:n.config.barGlassTint},pointerEvents:"none"}}),l.push(...rn(n,e.plot,o,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 Rt(e,t,r,n,o,i=e.bounds){let{chart:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:t,order:l(),bounds:i,d:r,style:{fill:k(n,s,a.id),shadow:{color:E(n,"#ffffff"),opacity:.9,blur:o,dx:0,dy:0},pointerEvents:"none"}}}function kt(e){return e.chart.config?.showBarLabels===!0}function xy(e,t){let r=e.frame.height>=t.height+ce.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function Sy(e,t,r){return e==="outside"?t.y-r-ce.gap:e==="inside"?t.y+ce.gap:t.y+t.height/2-r/2}function Cy(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config;return{type:"path",id:`${t}-pill`,order:s(),bounds:i,d:Go(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?k(l.barLabelPillColor,a,o.id):{kind:"none"},stroke:k(l?.barLabelBorderColor??n,a,o.id),strokeWidth:p(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function Ry(e,t,r,n,o,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...w({id:t,order:d(),bounds:l,frame:{x:r.left,y:r.top+r.padY,width:r.width,height:r.lineHeight},text:n,chart:s,align:"center"}),mark:`bar-label|${o}|${c?.barLabelFormat??""}`,color:a,fontSize:i,fontFamily:c?.barLabelFontFamily??s.fontFamily??"Inter, sans-serif",fontWeight:c?.barLabelFontWeight??"normal"}}function ky(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=o.config,d=i.y+i.height+4+16+Math.max(0,o.tickLength??0);return{...w({id:t.id,order:s(),bounds:a,frame:t.horizontal?o.categoryAlign==="inside"?{x:i.x,y:t.frame.y+t.frame.height/2-n*.6,width:i.width-14,height:n*1.2}:{x:i.x,y:t.frame.y-Xr,width:i.width,height:n*1.2}:{x:t.frame.x,y:d,width:t.frame.width,height:n*1.2},text:r,chart:o,align:t.horizontal?"right":o.categoryAlign==="left"?"left":"center"}),mark:`bar-label|axis|${l?.barLabelFormat??""}`,color:l?.barLabelColor??o.textColor??"#0f172a",fontSize:n,fontFamily:l?.barLabelFontFamily??o.fontFamily??"Inter, sans-serif",fontWeight:l?.barLabelFontWeight??"normal"}}function wy(e,t){let r=e.placement==="axis"?"outside":e.placement,n=e.frame.width>=t.width+ce.gap*2;return r!=="outside"&&!n?"outside":r}function vy(e,t,r){let{frame:n}=e,o=r==="outside"?n.x+n.width+ce.gap:r==="inside"?n.x+n.width-t.width-ce.gap:n.x+n.width/2-t.width/2;return{...t,left:o,top:n.y+n.height/2-t.height/2}}function wt(e,t){let{chart:r}=e,n=r.config,o=Math.max(8,p(n?.barLabelFontSize,p(r.fontSize,12))),i=Bo(t.value,n?.barLabelFormat);if(t.placement==="axis")return[ky(e,t,i,o)];let a=n?.barLabelPill===!0,s=Io(i,o,a),l=t.horizontal?wy(t,s):xy(t,s),d=t.horizontal?vy(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:Sy(l,t.frame,s.height)},c=n?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(Cy(e,t.id,d,c)),u.push(Ry(e,t.id,d,i,l,o,c)),u}var Qo={angle:45,spacing:7,width:1.5},Py=2;function Ly(e,t,r,n,o,i){let a=o*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+n/2},c=Math.hypot(r,n)/2,u=[];for(let m=-c;m<=c;m+=i){let f=d.x+l.x*m,g=d.y+l.y*m;u.push(`M ${f-s.x*c} ${g-s.y*c} L ${f+s.x*c} ${g+s.y*c}`)}return u.join(" ")}function vt(e,t){if(Ye(e))return{type:"path",d:Se(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function Ye(e){return e.chart.config?.barTrack===!0}function Pt(e,t,r,n="vertical"){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config,d=l?.barCornerRadius??2,c=p(l?.barSegments,0),u=c>0?Me(r,n,c,p(l?.barSegmentGap,4),d,1,!0):Se(r.x,r.y,r.width,r.height,d),m=[{type:"path",id:`chart-bar-track-${o.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:k(l?.barTrackColor??o.gridColor??"#e2e8f0",a,o.id),pointerEvents:"none"}}];return l?.barTrackHatch&&m.push({type:"path",id:`chart-bar-track-hatch-${o.id}-${t}`,order:s(),bounds:i,d:Ly(r.x,r.y,r.width,r.height,p(l.barTrackHatchAngle,Qo.angle),Math.max(Py,p(l.barTrackHatchSpacing,Qo.spacing))),style:{fill:{kind:"none"},stroke:k(l.barTrackHatchColor??o.gridColor??"#cbd5e1",a,o.id),strokeWidth:p(l.barTrackHatchWidth,Qo.width),pointerEvents:"none",clip:{type:"path",d:u}}}),m}function bc(e){let t=Ay(e),r=e.chart.series.flatMap((a,s)=>Ey(e,t,a,s)),n=Ye(e)?r.flatMap(a=>Pt(e,`${a.seriesId}-${a.valueIndex}`,{x:a.frame.x,y:e.plot.y,width:a.frame.width,height:e.plot.height})):[],o=r.flatMap(a=>Oy(e,a)),i=kt(e)?r.flatMap(a=>My(e,a,r)):[];return[...n,...o,...r.flatMap(a=>$y(e,a)),...i]}function Ty(e,t){let r=t.filter(n=>n.seriesId===e.seriesId).map(n=>n.value);return e.value>=Math.max(...r)}function My(e,t,r){let{chart:n}=e;return n.config?.barLabelMaxOnly&&!Ty(t,r)?[]:wt(e,{id:`chart-bar-label-${n.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:n.config?.barLabelPosition??"outside"})}function yc(e,t){let{chart:r,plot:n}=e,o=r.config,i=o?.barCornerRadius??2,a=p(o?.barSegments,0);return a>0?Me({x:t.x,y:n.y,width:t.width,height:n.height},"vertical",a,p(o?.barSegmentGap,4),i,t.height/n.height,o?.barSegmentSnap!==!1):Fe(t.x,t.y,t.width,t.height,i,o?.barRoundedBottom===!0)}function $y(e,t){let{chart:r}=e,n=p(r.config?.barGlow,0);if(n<=0||t.frame.height<=0)return[];let o=yc(e,t.frame);return[Rt(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,o,t.color,n)]}function Ay(e){let{chart:t,plot:r}=e,n=de(t),o=r.width/n,i=Math.min(Math.max(0,p(t.config?.barGroupGap,8)),Math.max(0,o-1)),a=Math.max(0,p(t.config?.barGap,2));return{slotWidth:o,seriesWidth:Math.max(1,(o-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function Ey(e,t,r,n){let{chart:o,plot:i}=e,a=r.color??M[n%M.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,T(d,o.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+n*t.seriesWidth,y:i.y+i.height-c,width:Math.max(1,t.seriesWidth-t.barGap),height:c}}})}function Oy(e,t){let r=By(e,t),n=Iy(e,t);return n&&r.push(n),r}function Ny(e){let{x:t,y:r,width:n,height:o}=e;return`M ${t} ${r} H ${t+n} V ${r+o} H ${t} Z`}function By(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=r.config?.barCornerRadius??2,{x:l,width:d}=t.frame,c=yc(e,t.frame),u=k(t.color,i,r.id),m=k(r.config?.barBorderColor||"#000000",i,r.id),f=p(r.config?.barBorderWidth,0),g=O(r.shadowStyle),b=g?{type:"path",id:`chart-bar-shadow-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:o,d:c,style:{fill:u,stroke:m,strokeWidth:f,shadow:g,clip:vt(e,{x:l,y:n.y,width:d,height:n.height})??{type:"path",d:Ny(n)}}}:void 0,x={type:"path",id:`chart-bar-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:o,d:c,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex,mark:"bar",radius:s,colorProp:St(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:J(t.seriesId,t.valueIndex),style:{fill:u,stroke:m,strokeWidth:f,innerShadow:g}},C=Ct(e,`${t.seriesId}-${t.valueIndex}`,c);return b?[b,...C,x]:[...C,x]}function Iy(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=jt(t.value,t.error);return Ut({id:`chart-bar-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.frame.x+t.frame.width/2,startY:n.y+n.height-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function Gy(e,t,r,n,o){let{chart:i,plot:a}=e,s=ft(t,a,n)+t.labelRow;if(e.stackedMode){let u=Zt(i,e.stackedMode,n,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(o,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function Dy(e,t){let{chart:r,plot:n}=e,o=r.config,i=e.stackedMode&&r.series.length>1?0:p(o?.barSegments,0);return i>0?Me({x:n.x,y:t.y,width:n.width,height:t.height},"horizontal",i,p(o?.barSegmentGap,4),o?.barCornerRadius??2,t.width/n.width,o?.barSegmentSnap!==!1):Se(t.x,t.y,t.width,t.height,o?.barCornerRadius??2)}function _y(e,t,r,n,o,i){let{plot:a}=e,s=Gy(e,t,n,o,i);return{id:`${r.id}-${o}`,series:r,seriesIndex:n,valueIndex:o,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:Dy(e,s),color:r.colors?.[o]??r.color??M[n%M.length]}}function Fy(e,t){let{chart:r,diagnostics:n,nextOrder:o}=e,i=r.config,a=k(i?.barBorderColor||"#000000",n,r.id),s=p(i?.barBorderWidth,0),l=O(r.shadowStyle),d=k(t.color,n,r.id),c=[...Ct(e,t.id,t.path)];return l&&c.push({type:"path",id:`chart-bar-shadow-${r.id}-${t.id}`,order:o(),bounds:t.bounds,d:t.path,style:{fill:d,stroke:a,strokeWidth:s,shadow:l,clip:vt(e,t.trackFrame)}}),c.push({type:"path",id:`chart-bar-${r.id}-${t.id}`,order:o(),bounds:t.bounds,d:t.path,detail:{of:"chartValue",series:t.series.id,valueIndex:t.valueIndex,mark:"bar",radius:i?.barCornerRadius??2,colorProp:St(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function Hy(e,t,r){let{chart:n}=e,o=n.config,i=kt(e)&&(!o?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===n.series.length-1;return!i||e.stackedMode&&!a&&o?.barLabelPosition==="outside"?[]:wt(e,{id:`chart-bar-label-${n.id}-${t.id}`,value:t.value,frame:t.frame,placement:o?.barLabelPosition??"outside",horizontal:!0})}function Vy(e,t,r,n,o,i,a,s){let{chart:l}=e,d=_y(e,t,n,o,i,a);Ye(e)&&(!e.stackedMode||o===0)&&r.tracks.push(...Pt(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...Fy(e,d));let c=p(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(Rt(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...Hy(e,d,s))}function xc(e){let t=pt(e.chart,e.plot),r={tracks:[],bars:[],glows:[],labels:[]};return e.chart.series.forEach((n,o)=>{let i=n.values.map(s=>typeof s=="number"?s:s[1]),a=Math.max(...i);i.forEach((s,l)=>{Vy(e,t,r,n,o,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function Wy(e,t){let{chart:r,plot:n}=e,o=n.width/de(r),i=Math.min(Math.max(0,p(r.config?.barGroupGap,8)),Math.max(0,o-1));return{slotWidth:o,groupGap:i,barWidth:Math.max(1,o-i),cornerRadius:r.config?.barCornerRadius??2,outerSeriesIndex:t==="waterfall"?null:r.series.length-1}}function zy(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=a.series.length===1?p(a.config?.barSegments,0):0;return l>0?Me({x:t,y:s.y,width:o.barWidth,height:s.height},"vertical",l,p(a.config?.barSegmentGap,4),i,n/s.height,a.config?.barSegmentSnap!==!1):Fe(t,r,o.barWidth,n,i,a.config?.barRoundedBottom===!0)}function Yy(e,t,r,n,o,i,a){let{chart:s}=e,l=s.config;if(!(kt(e)&&!(l?.barLabelMaxOnly&&!qy(r.values,o))&&(l?.barLabelPosition!=="axis"||n===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[o];t.labels.push(...wt(e,{id:`chart-bar-label-${s.id}-${r.id}-${o}`,value:Array.isArray(u)?u[1]:u??0,frame:a,placement:c==="outside"&&n!==i.outerSeriesIndex?"center":c}))}function jy(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=Zt(a,t,i,o,s.height),d=r.outerSeriesIndex===null||o===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:n,valueIndex:i,radius:d,color:n.colors?.[i]??n.color??M[o%M.length],x:c,y:u,height:m,path:zy(e,c,u,m,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function Uy(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=k(t.color,i,r.id),u=k(r.config?.barBorderColor||"#000000",i,r.id),m=p(r.config?.barBorderWidth,0),f=O(r.shadowStyle),g=[];if(f){let b=`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`;g.push({type:"path",id:`chart-bar-shadow-${r.id}-${s.id}-${l}`,order:a(),bounds:o,d,style:{fill:c,stroke:u,strokeWidth:m,shadow:f,clip:vt(e,t.column)??{type:"path",d:b}}})}return g.push(...Ct(e,`${s.id}-${l}`,d)),g.push({type:"path",id:`chart-bar-${r.id}-${s.id}-${l}`,order:a(),bounds:o,d,detail:{of:"chartValue",series:s.id,valueIndex:l,mark:"bar",radius:t.radius,colorProp:St(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:J(s.id,l),style:{fill:c,stroke:u,strokeWidth:m,innerShadow:f}}),g}function Xy(e,t,r,n,o,i,a){let{chart:s}=e,l=jy(e,t,n,o,i,a);i===0&&Ye(e)&&r.tracks.push(...Pt(e,String(a),l.column)),r.bars.push(...Uy(e,l));let d={x:l.x,y:l.y,width:n.barWidth,height:l.height};Yy(e,r,o,i,a,n,d);let c=p(s.config?.barGlow,0);c>0&&r.glows.push(Rt(e,`chart-bar-glow-${s.id}-${o.id}-${a}`,l.path,l.color,c))}function Sc(e,t){let{chart:r}=e,n={tracks:[],bars:[],glows:[],labels:[]},o=Wy(e,t),i=de(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{Xy(e,t,n,o,s,l,a)});return[...n.tracks,...n.bars,...n.glows,...n.labels]}function qy(e,t){let r=e.map(n=>typeof n=="number"?n:n[1]);return r[t]>=Math.max(...r)}function Cc(e){return Q(e.chart)?xc(e):e.stackedMode?Sc(e,e.stackedMode):bc(e)}function Rc(e){let{chart:t,plot:r}=e,n=t.config?.orientation??"vertical",o=Math.max(1,t.series.length),i=(n==="horizontal"?r.height:r.width)/o,a=E(t.config?.barBorderColor,"#000000"),s=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:n,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 ne(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function kc(e,t,r,n){let{chart:o,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+T(d,o.axisX,i.width):i.y+i.height-T(d,o.axisY,i.height);return{center:i[a==="horizontal"?"y":"x"]+r*t.slotWidth+t.slotWidth/2,min:s(n.min),q1:s(n.q1),median:s(n.median),q3:s(n.q3),max:s(n.max)}}function wc(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?o.x+T(d,n.axisX,o.width):o.y+o.height-T(d,n.axisY,o.height);return t.pointSize<=0?[]:r.series.values.map((d,c)=>{let u=r.geometry.center+Ky(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:m,y:f}=ne(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:k(r.color,a,n.id),opacity:t.pointOpacity}}})}function Ky(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function Pc(e,t,r){let n=t.whiskerWidth>0?[Qy(t,r),Jy(t,r)]:[],o=t.whiskerWidth>0&&t.capSize>0?[ex(t,r),tx(t,r)]:[],i=t.medianWidth>0?[rx(t,r)]:[];return[...[...n,...o].map(a=>vc(e,t,{...a,color:Zy(t,r)})),nx(e,t,r),...i.map(a=>vc(e,t,a))]}function Zy(e,t){return e.whiskerColor==="series"?E(t.color,e.borderColor):e.whiskerColor}function Qy(e,t){let{center:r,min:n,q1:o}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:ne(e.orientation,r,n),to:ne(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function Jy(e,t){let{center:r,q3:n,max:o}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:ne(e.orientation,r,n),to:ne(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function ex(e,t){return Lc(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function tx(e,t){return Lc(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function Lc(e,t,r,n){let o=t.boxWidth*t.capSize/2;return{id:e,from:ne(t.orientation,r-o,n),to:ne(t.orientation,r+o,n),strokeWidth:t.whiskerWidth}}function rx(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:ne(e.orientation,t.geometry.center-r,t.geometry.median),to:ne(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function vc(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 nx(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=ne(t.orientation,s.center-l,s.q1),c=ne(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)),g=Math.max(1,Math.abs(c.y-d.y));return{type:"rect",id:`chart-box-${r.id}`,order:a(),bounds:o,x:u,y:m,width:f,height:g,rx:t.cornerRadius,style:{fill:k(r.color,i,n.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function Tc(e,t,r,n){let o=_o(r.values);if(!o)return[];let i=kc(e,t,n,o),a=r.color??M[n%M.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:n,color:a,geometry:i},l=Pc(e,t,s);return t.showPoints&&l.push(...wc(e,t,s)),l}function Mc(e){let t=Rc(e),r=[];return e.chart.series.forEach((n,o)=>{r.push(...Tc(e,t,n,o))}),r}var ox="#94a3b8",$c=8,Jo=140;function Ec(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?lx(e):e.chart.series.flatMap((t,r)=>ix(e,t,r))}function ix(e,t,r){let n=ax(e,t,r);return ei(e,t).map((o,i)=>{let a=ti(e,o),s={series:t,valueIndex:i,point:a,style:n};return t.symbol?.points.length?sx(e,s):ri(e,s)})}function ni(e){return e.config?.orientation==="horizontal"}function ei(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(o=>[o[0],o[1]]):ni(r)?t.values.map((o,i)=>[o,r.axisY.min+i*r.axisY.step]):t.values.map((o,i)=>[r.axisX.min+i*r.axisX.step,o])}function Ac(e,t){return ni(e)?t[0]:t[1]}function ti(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 ax(e,t,r){let n=t.color??M[r%M.length];return{fill:k(n,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 sx(e,t){let r=t.series.symbol,n=p(t.series.size,3),o=r?.normalized?n*2:1,i=r?.normalized?.5:0,a=(r?.points??[]).map(([s,l])=>({x:t.point.x+(s-i)*o,y:t.point.y+(l-i)*o}));return{type:"path",id:Oc(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:me({points:a,tension:p(r?.tension,0),closed:!0}),style:t.style}}function ri(e,t){let r=p(t.series.size,3);return{type:"ellipse",id:Oc(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 Oc(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function lx(e){let{chart:t}=e,[r,n]=t.series,o=ei(e,r),i=ei(e,n),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??W,c=!!t.config?.reverseComparison,u=Math.min(o.length,i.length),m=t.config?.categories??[],f=[];for(let g=0;g<u;g++){let b=o[g],x=i[g],C=ti(e,b),L=ti(e,x),v=Ac(t,b),$=Ac(t,x),H=c?$<v:$>v,G=c?$>v:$<v,_=H?s:G?l:d,Y=p(n.size,3);f.push(cx(e,g,C,L,_)),f.push(ri(e,{series:r,valueIndex:g,point:C,style:{fill:k(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??ox},strokeWidth:p(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(ri(e,{series:n,valueIndex:g,point:L,style:{fill:k(_,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&m[g]&&f.push(ux(e,g,C,L,Y,m[g]))}return f}function dx(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function cx(e,t,r,n,o){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 ${n.x} ${n.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:o},strokeWidth:p(i.config?.customConnectorWidth,2),opacity:i.config?.customConnectorOpacity,dash:dx(i.config?.customConnectorDash)}}}function ux(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=ni(a),c=d?{x:Math.max(r.x,n.x)+o+$c,y:Math.min(r.y,n.y)-8,width:Jo,height:16}:{x:Math.min(r.x,n.x)-Jo/2,y:Math.min(r.y,n.y)-o-$c-14,width:Jo,height:16};return{...w({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 Bc(e){let{chart:t,plot:r}=e,n=t.series.filter(a=>Nc(a.values[0])===3),o=t.series.filter(a=>Nc(a.values[0])===4);return{scalarSamples:n.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:o}}function Nc(e){return Array.isArray(e)?e.length:void 0}function Ic(e){let t=e.chart.config?.scale?.stops;if(!e.showLegend||!t?.length)return[];let r=[...t].sort((a,s)=>a.position-s.position),n=r[0].position,o=r[r.length-1].position,i=mx(e);return[px(e,r,n,o,i),...fx(e,n,o,i)]}function mx(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 px(e,t,r,n,o){let{chart:i,bounds:a,nextOrder:s}=e,l=n-r;return{type:"rect",id:`chart-field-colorbar-${i.id}`,order:s(),bounds:a,x:o.x,y:o.y,width:o.width,height:o.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 fx(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=n.y+n.height+3;return[w({id:`chart-field-colorbar-min-${o.id}`,order:a(),bounds:i,frame:{x:n.x,y:s,width:80,height:16},text:pe(t),chart:o}),w({id:`chart-field-colorbar-max-${o.id}`,order:a(),bounds:i,frame:{x:n.x+n.width-80,y:s,width:80,height:16},text:pe(r),chart:o,align:"right"})]}var hx="#94a3b8";function nn(e,t){return e?.stops.length?Dt(e.stops,t):hx}function Gc(e){if(e.length===0)return[];let t=s=>`${Math.round(s[0]*1e3)}:${Math.round(s[1]*1e3)}`,r=new Map,n=(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];n(d,c,l),n(c,d,l)});let o=new Array(e.length).fill(!1),i=(s,l)=>{let d=l;for(;;){let u=r.get(t(d))?.find(m=>!o[m.segment]);if(!u)return;o[u.segment]=!0,s.push(u.point),d=u.point}},a=[];return e.forEach((s,l)=>{if(o[l])return;o[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 Dc(e,t){let r=[];for(let n=0;n<e.rows-1;n++)for(let o=0;o<e.columns-1;o++){let i=gx(e,n,o),a=bx(i,t);a!==0&&a!==15&&r.push(...yx(i,a,t))}return r}function gx(e,t,r){return{topLeft:on(e,t,r),topRight:on(e,t,r+1),bottomRight:on(e,t+1,r+1),bottomLeft:on(e,t+1,r)}}function on(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 bx(e,t){return(an(e.topLeft,t)?8:0)|(an(e.topRight,t)?4:0)|(an(e.bottomRight,t)?2:0)|(an(e.bottomLeft,t)?1:0)}function an(e,t){return e.value>=t}function yx(e,t,r){let n=xx(e,r);switch(t){case 1:case 14:return[Re(n.left,n.bottom)];case 2:case 13:return[Re(n.bottom,n.right)];case 3:case 12:return[Re(n.left,n.right)];case 4:case 11:return[Re(n.top,n.right)];case 5:return[Re(n.left,n.top),Re(n.bottom,n.right)];case 6:case 9:return[Re(n.top,n.bottom)];case 7:case 8:return[Re(n.left,n.top)];case 10:return[Re(n.top,n.right),Re(n.left,n.bottom)];default:return[]}}function xx(e,t){return{top:sn(e.topLeft,e.topRight,t),right:sn(e.topRight,e.bottomRight,t),bottom:sn(e.bottomLeft,e.bottomRight,t),left:sn(e.topLeft,e.bottomLeft,t)}}function sn(e,t,r){let n=t.value===e.value?.5:(r-e.value)/(t.value-e.value);return[e.x+(t.x-e.x)*n,e.y+(t.y-e.y)*n]}function Re(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var Sx=.5;function _c(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=Cx(e,t);return[...Rx(e,r),...wx(e,r)]}function Cx(e,t){let{plot:r,chart:n}=e,o=lc(t,r.width,r.height,n.config?.idwPower??2);return{values:o.grid,columns:o.cols,rows:o.rows,cellWidth:r.width/Math.max(1,o.cols-1),cellHeight:r.height/Math.max(1,o.rows-1)}}function Rx(e,t){let r=[];for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)r.push(kx(e,t,n,o));return r}function kx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=i.x+i.width*(n/(t.columns-1)),d=i.y+i.height*(r/(t.rows-1)),c=nn(o.config?.scale,t.values[r*t.columns+n]);return{type:"rect",id:`chart-field-cell-${o.id}-${r}-${n}`,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:Qt(o,i)}}}function wx(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((n,o)=>{let i=vx(e,t,n,o);i&&r.push(i)}),r}function vx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=Dc({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=Gc(l).map(u=>ht(u.map(([m,f])=>({x:i.x+m,y:i.y+f})),Sx)).join(" ");return{type:"path",id:`chart-field-isoline-${o.id}-${n}`,order:s(),bounds:a,d:c,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"rgba(15, 23, 42, 0.55)"},strokeWidth:1,clip:Qt(o,i)}}}function Fc(e,t){let r=[];return t.forEach((n,o)=>{let i=n.color??M[o%M.length];n.values.forEach((a,s)=>{r.push(Px(e,n.id,a,s,i))})}),r}function Px(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,m,f]=r,g=a.x+T(c,i.axisX,a.width),b=a.y+a.height-T(u,i.axisY,a.height),x=a.x+T(c+Math.cos(m)*f,i.axisX,a.width),C=a.y+a.height-T(u+Math.sin(m)*f,i.axisY,a.height);return{type:"path",id:`chart-field-vector-${i.id}-${t}-${n}`,order:d(),bounds:s,d:`M ${g} ${b} L ${x} ${C}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:k(o,l,i.id),strokeWidth:2}}}function Hc(e){let t=Bc(e),r=[];return r.push(..._c(e,t.scalarSamples)),r.push(...Fc(e,t.vectorSeries)),r.push(...Ic(e)),r}function Vc(e,t){let r=[];return t.rows.forEach((n,o)=>{r.push(...Lx(e,t,n,o))}),r}function Lx(e,t,r,n){return t.columns.flatMap((o,i)=>{let a=Tx(t,r,n,i);return $x(e,t,a)})}function Tx(e,t,r,n){let o=t.values[n]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:n,value:o,color:Mx(o,e),frame:{x:e.grid.x+n*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 Mx(e,t){return zt(e,t.bands,t.zones)}function $x(e,t,r){let n=Ax(e,t,r);return e.chart.config?.showValues===!1?[n]:[n,Ex(e,t,r)]}function Ax(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=`chart-heatmap-cell-${n.id}-${r.seriesId}-${r.columnIndex}`,s={fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:n.config?.cellStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:p(n.config?.cellStrokeWidth,p(n.gridWidth,1))};return n.config?.cellShape==="circle"?{type:"ellipse",id:a,order:i(),bounds:o,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:o,...r.frame,rx:t.grid.cellRadius,style:s}}function Ex(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=Math.max(6,p(n.config?.cellValueSize,t.fontSize));return{...w({id:`chart-heatmap-value-${n.id}-${r.seriesId}-${r.columnIndex}`,order:i(),bounds:o,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:n,align:"center"}),...n.config?.cellValueSize===void 0?{}:{fontSize:a},color:n.config?.cellValueColor??Z(r.color)}}function Wc(e,t){return[...Ox(e,t),...Bx(e,t)]}function Ox(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,n)=>Nx(e,t,r,n))}function Nx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return w({id:`chart-heatmap-row-${o.id}-${r.id}`,order:s(),bounds:a,frame:{x:i.x,y:t.grid.y+n*t.grid.cellHeight+t.grid.cellHeight/2-t.fontSize/2,width:t.reservedSpace.rowHeaders-8,height:t.fontSize+2},text:r.label,chart:o})}function Bx(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,n)=>Ix(e,t,r,n))}function Ix(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return w({id:`chart-heatmap-col-${o.id}-${n}`,order:s(),bounds:a,frame:{x:t.grid.x+n*t.grid.cellWidth,y:i.y,width:t.grid.cellWidth,height:t.fontSize+2},text:r,chart:o,align:"center"})}function zc(e){let{chart:t}=e,r=Gx(e),n=Dx(e);return{rows:t.series,columns:r,bands:Wt(t.axisY),zones:t.config?.zones?.length?t.config.zones:Vt,fontSize:Math.max(9,p(t.fontSize,12)),reservedSpace:n,grid:_x(e,n,r.length)}}function Gx(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function Dx(e){let{chart:t}=e,r=Math.max(9,p(t.fontSize,12)),n=t.series.reduce((o,i)=>Math.max(o,Te(i.label??"",r,!1)),0);return{rowHeaders:e.showLabels?Math.min(96,n+12):0,columnHeaders:e.showLabels?24:0,legend:e.showLegend?38:0}}function _x(e,t,r){let{chart:n}=e,o=Math.max(1,e.plot.width-t.rowHeaders),i=Math.max(1,e.plot.height-t.columnHeaders-t.legend),a=n.series.length,s=Math.max(0,p(n.config?.cellGap,0)),l=r?o/r:o,d=a?i/a:i,c=o,u=i;if(n.config?.squareCells&&r&&a){let m=Math.min(l,d);l=m,d=m,c=m*r,u=m*a}return{x:e.plot.x+t.rowHeaders,y:e.plot.y+t.columnHeaders,width:c,height:u,cellWidth:l,cellHeight:d,cellGap:s,cellRadius:Math.max(0,p(n.config?.barCornerRadius,s))}}var er=10,Yc=4,Fx=2;function jc(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=t.grid.x,n=t.grid.width,o=t.fontSize+2,i=t.grid.y+t.grid.height+6,a=K({x:r,y:i,width:n,height:er});return[Hx(e,t,r,i,n,a),...Vx(e,t,r,i,n,o)]}function Uc(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function Hx(e,t,r,n,o,i){let{chart:a,nextOrder:s}=e,l=Math.max(0,t.bands.length-1),c=t.zones.slice(0,l).map((u,m)=>({offset:Uc(t,t.bands[m+1]??t.bands[t.bands.length-1])*100,color:u.color??W}));return{type:"rect",id:`chart-heatmap-legend-bar-${a.id}`,order:s(),bounds:i,x:r,y:n,width:o,height:er,rx:3,zoneGradient:{axis:"y",min:a.axisY.min,max:a.axisY.max},style:{fill:c.length?{kind:"linear-gradient",angle:0,stops:c}:{kind:"solid",color:W},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}}}function Vx(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=n+er+Yc+Fx,c=48;return t.bands.flatMap((u,m)=>{let f=r+Uc(t,u)*o,g={type:"path",id:`chart-heatmap-legend-tick-${a.id}-${m}`,order:l(),bounds:s,d:`M ${f} ${n+er} L ${f} ${n+er+Yc}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}},b=m===0,x=m===t.bands.length-1,C=b?"left":x?"right":"center",L=b?f:x?f-c:f-c/2,v=w({id:`chart-heatmap-legend-tick-label-${a.id}-${m}`,order:l(),bounds:s,frame:{x:L,y:d,width:c,height:i},text:pe(u),chart:a,align:C});return[g,v]})}function Xc(e){let t=zc(e),r=[];return r.push(...Vc(e,t)),r.push(...Wc(e,t)),r.push(...jc(e,t)),r}function oi(e,t){if(t<=0||e.length===0)return[];let r=t*1.5,n=t*Math.sqrt(3),o=new Map;for(let{x:i,y:a}of e){let s=Math.round(i/r),l=s%2!==0?n/2:0,d=Math.round((a-l)/n),c=`${s}:${d}`,u=o.get(c);u?u.count++:o.set(c,{cx:s*r,cy:d*n+l,count:1})}return[...o.values()]}function qc(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 n=!1;for(let o of e.links){let i=(t.get(o.source)??0)+1;i>(t.get(o.target)??0)&&(t.set(o.target,i),n=!0)}if(!n)break}return t}function Kc(e,t){let r=new Map;for(let n of e){let o=t.get(n)??0,i=r.get(o)??[];i.push(n),r.set(o,i)}return r}function Zc(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 n=new Map,o=new Map;for(let a of r)n.set(a,[]),o.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)o.get(a.source)?.push(a),n.get(a.target)?.push(a);return{ids:r,links:i,incoming:n,outgoing:o}}function zx(e){let t=new Map;for(let r of e.ids){let n=(e.incoming.get(r)??[]).reduce((i,a)=>i+a.value,0),o=(e.outgoing.get(r)??[]).reduce((i,a)=>i+a.value,0);t.set(r,Math.max(n,o,1e-4))}return t}function Yx(e,t,r,n){let o=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)*n,l=Math.max(1,r-s);a>0&&(o=Math.min(o,l/a))}return!Number.isFinite(o)||o<=0?1:o}function tr(e,t,r,n=18){return t<=1?0:e*(r-n)/(t-1)}function Qc(e,t,r,n=8){let o=Kc(e.ids,t),i=zx(e),a=Yx(o,i,r,n),s=new Map,l=new Map;for(let d of o.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+n}}return{columns:t,y:s,heights:l,valueScale:a,columnCount:Math.max(1,...[...t.values()].map(d=>d+1))}}function Jc(e,t,r,n,o=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=n.get(s.source),c=n.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,g=a.get(s.target)??0;return i.set(s.source,f+l),a.set(s.target,g+l),{source:s.source,target:s.target,value:s.value,color:s.color,x0:tr(t.columns.get(s.source)??0,t.columnCount,r,o)+o+(d?.x??0),x1:tr(t.columns.get(s.target)??0,t.columnCount,r,o)+(c?.x??0),sourceY0:u+f,sourceY1:u+f+l,targetY0:m+g,targetY1:m+g+l}})}function eu(e,t,r,n,o,i=18){return[...t.ids].map(a=>{let s=e.find(c=>c.id===a),l=r.columns.get(a)??0,d=o.get(a);return{id:a,label:s?.label??a,color:s?.color,x:tr(l,r.columnCount,n,i)+(d?.x??0),y:(r.y.get(a)??0)+(d?.y??0),width:i,height:r.heights.get(a)??2,column:l}})}function jx(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 ai(e,t,r,n,o={nodeWidth:18,nodeGap:8}){let i=Zc(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=qc(i),s=Qc(i,a,n,o.nodeGap),l=jx(e);return{nodes:eu(e,i,s,r,l,o.nodeWidth),links:Jc(i,s,r,l,o.nodeWidth)}}function rr(e,t){let r=Ux(e,t);if(!r.length)return[];let n=[],o=r,i=t;for(;o.length;){let a=Xx(o,Math.min(i.width,i.height)),s=qx(a,i);n.push(...s.rectangles),o=o.slice(a.items.length),i=s.remainingBounds}return n}function Ux(e,t){let r=e.filter(i=>i.value>0);if(!r.length||t.width<=0||t.height<=0)return[];let n=r.reduce((i,a)=>i+a.value,0);if(n<=0)return[];let o=t.width*t.height/n;return[...r].sort((i,a)=>a.value-i.value).map(i=>({item:i,area:i.value*o}))}function Xx(e,t){let r=[e[0]];for(let n=1;n<e.length;n++){let o=[...r,e[n]];if(tu(o,t)>tu(r,t))break;r.push(e[n])}return{items:r,area:r.reduce((n,o)=>n+o.area,0)}}function tu(e,t){let r=e.reduce((s,l)=>s+l.area,0);if(r<=0||t<=0)return 1/0;let n=e.map(s=>s.area),o=Math.max(...n),i=Math.min(...n),a=t*t;return Math.max(a*o/(r*r),r*r/(a*i))}function qx(e,t){return t.width>=t.height?Kx(e,t):Zx(e,t)}function Kx(e,t){let r=t.height>0?e.area/t.height:0,n=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:n,width:r,height:s};return n+=s,l}),remainingBounds:{x:t.x+r,y:t.y,width:t.width-r,height:t.height}}}function Zx(e,t){let r=t.width>0?e.area/t.width:0,n=t.x;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:n,y:t.y,width:s,height:r};return n+=s,l}),remainingBounds:{x:t.x,y:t.y+r,width:t.width,height:t.height-r}}}var Qx=.15,Jx=1/Math.sqrt(3);function e0(e,t,r){let n=[];for(let o=0;o<6;o++){let i=(-60+60*o)*Math.PI/180;n.push(`${o===0?"M":"L"} ${e+r*Math.cos(i)} ${t+r*Math.sin(i)}`)}return`${n.join(" ")} Z`}function ru(e){let{chart:t,plot:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??No),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*Jx),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??Qx)),m=O(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((g,b)=>{let L=(g.values.length>0&&Array.isArray(g.values[0])?g.values:g.values.map((_,Y)=>[t.axisX.min+Y*t.axisX.step,_])).map(([_,Y])=>({x:T(_,t.axisX,r.width),y:r.height-T(Y,t.axisY,r.height)})),v=oi(L,l),$=Math.max(1,...v.map(_=>_.count)),H=g.color??M[b%M.length],G=s?.scale;v.forEach((_,Y)=>{let oe=_.count/$,te=G?nn(G,oe):H;a.push({type:"path",id:`chart-hexbin-${t.id}-${g.id}-${Y}`,order:i(),bounds:n,d:e0(r.x+_.cx,r.y+_.cy,d),style:{fill:k(te,o,t.id),stroke:c>0?k(s?.hexStrokeColor??te,o,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:G?void 0:Math.max(u,oe),shadow:m,clip:f?{type:"path",d:f}:void 0}})})}),a}function je(e,t){return t.values.length>0&&Array.isArray(t.values[0])?t.values:t.values.map((r,n)=>[e.axisX.min+n*e.axisX.step,r])}function Ue(e,t){let{chart:r,plot:n}=e;return t.map(([o,i])=>({x:n.x+T(o,r.axisX,n.width),y:n.y+n.height-T(i,r.axisY,n.height)}))}function nu(e,t,r,n,o,i){let{chart:a,plot:s,nextOrder:l}=e,d=s.y+s.height,c=r[0],u=r[r.length-1],m=`${ht(r,o)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(C=>C.y)),g=(Math.min(...r.map(C=>C.x))+Math.max(...r.map(C=>C.x)))/2,b=(d-f)/2,x={minX:g-b,maxX:g+b,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:x,d:m,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:Fo(n,i)},{offset:100,color:Fo(n,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function t0(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function r0(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e;return{type:"path",id:`chart-highlight-guide-${t.key}`,order:a(),bounds:o,d:`M ${t.point.x} ${t.point.y} V ${n.y+n.height}`,style:{fill:{kind:"none"},stroke:k(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function n0(e,t){let{chart:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=r.config?.lineGlow;return{type:"ellipse",id:`chart-highlight-${t.key}`,order:i(),bounds:n,cx:t.point.x,cy:t.point.y,rx:t.radius,ry:t.radius,style:{fill:k(t.color,o,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function o0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=n.config,s=Math.max(9,n.fontSize??12),l=t0(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...w({id:`chart-highlight-label-${t.key}`,order:i(),bounds:o,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:n,align:"center"}),color:a?.highlightLabelColor??n.textColor??"#0f172a",fontWeight:"bold"}}function ou(e,t,r){let{chart:n}=e,o=n.config,i=o?.highlightPoints;if(!i?.length)return[];let a=je(n,t),s=Ue(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:`${n.id}-${t.id}-${c}`,point:u,index:c,radius:o?.highlightSize??6,color:o?.highlightColor??r};o?.highlightGuide&&l.push(r0(e,m)),l.push(n0(e,m)),o?.highlightLabels&&l.push(o0(e,m,a[c][1]))}return l}function iu(e,t,r,n){return r.map((o,i)=>({seriesId:e.id,valueIndex:i,value:t[i][1],error:e.error?.[i],position:o,color:n}))}function au(e,t){return t.flatMap(r=>i0(e,r))}function i0(e,t){let r=[],n=a0(e,t);return n&&r.push(n),r.push(s0(e,t)),r}function a0(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=jt(t.value,t.error);return Ut({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.position.x,startY:n.y+n.height-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function s0(e,t){let{chart:r,bounds:n,diagnostics:o,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:n,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?k(c,o,r.id):{kind:"none"},stroke:d&&l>0?k(t.color,o,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function su(e,t,r,n,o){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:o||void 0},d:ht(r,o),style:{fill:{kind:"none"},stroke:k(m??n,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:n,opacity:.9,blur:f,dx:0,dy:0}:O(i.shadowStyle)}}}function lu(e,t){return E(e.color,M[t%M.length])}function du(e,t,r){let n=e.chart.config?.areaOpacity;if(n===void 0||n<=0)return[];let o=lu(t,r),i=e.chart.config?.lineTension??0,a=Ue(e,je(e.chart,t));return a.length>1?[nu(e,t,a,o,i,n)]:[]}function cu(e,t,r){let n=lu(t,r),o=e.chart.config?.lineTension??0,i=je(e.chart,t),a=Ue(e,i),s=[];a.length&&s.push(su(e,t,a,n,o));let l=iu(t,i,a,n);return s.push(...au(e,l)),s.push(...ou(e,t,n)),s}function uu(e){let t=[];return e.chart.series.forEach((r,n)=>{t.push(...du(e,r,n))}),e.chart.series.forEach((r,n)=>{t.push(...cu(e,r,n))}),t}var mu=[0,25,50,75,100];function pu(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...l0(e,t)),e.showLabels&&r.push(...d0(e,t)),r}function l0(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return mu.map(i=>{let a=fu(t,i);return{type:"path",id:`chart-mekko-grid-${r.id}-${i}`,order:o(),bounds:n,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 d0(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e;return mu.map(a=>({...w({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:o,frame:{x:n.x,y:fu(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function fu(e,t){return e.grid.y+e.grid.height*(1-t/100)}function hu(e,t,r,n){if(!e.showLabels)return[];let o=u0(e,t,r,n);return e.chart.config?.showMekkoTotals===!1?[o]:[c0(e,t,r,n),o]}function c0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return{...w({id:`chart-mekko-total-${o.id}-${r}`,order:s(),bounds:a,frame:{x:n.x,y:i.y,width:n.width,height:t.smallFontSize+2},text:String(n.total),chart:o,align:"center"}),fontSize:t.smallFontSize}}function u0(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,{label:s,width:l}=n;return{...w({id:`chart-mekko-col-label-${o.id}-${r}`,order:a(),bounds:i,frame:{x:n.x,y:t.grid.y+t.grid.height+4,width:l,height:t.smallFontSize*2+4},text:s,chart:o,align:"center"}),lines:xe(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function gu(e){let t=m0(e),r=e.showLabels?30:0,n=p0(e,r),o=Math.max(9,p(e.chart.fontSize,12)),i=Math.max(0,p(e.chart.config?.mekkoColumnGap,4)),a=Math.max(8,o-1);return{columns:f0(e,n,t,i),fontSize:o,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:n}}function m0(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function p0(e,t){let r=e.showLabels?18:0,n=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-n)}}function f0(e,t,r,n){let o=r.map((d,c)=>e.chart.series.reduce((u,m)=>u+(m.values[c]??0),0)),i=o.reduce((d,c)=>d+c,0),a=Math.max(1,...o),s=Math.max(1,t.width-n*Math.max(0,r.length-1)),l=t.x;return r.map((d,c)=>{let u=o[c],m=i>0?u/i*s:s/r.length,f=e.chart.config?.mekkoVaryHeight?t.height*(u/a):t.height,g={label:d,total:u,x:l,y:t.y+t.height-f,width:m,height:f};return l+=m+n,g})}var h0=.15;function bu(e,t,r){let o=e.chart.config?.showColumnBackdrop!==!1?[g0(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=b0(e.chart.series,t,r),s=a.flatMap((l,d)=>y0(e,t,l,i?a[d+1]?.color:void 0));return[...o,...s]}function g0(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=yu(e);return{type:"path",id:`chart-mekko-column-backdrop-${n.id}-${r}`,order:a(),bounds:o,d:Wr(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:k(n.gridColor??"#e2e8f0",i,n.id),opacity:h0}}}function yu(e){return Math.max(0,p(e.chart.config?.barCornerRadius,2))}function b0(e,t,r){let n=[],o=t.columns[r],i=0;return e.forEach((a,s)=>{let l=a.values[r]??0,d=(o.total>0?l/o.total:0)*o.height,c=o.y+i;i+=d;let u=a.color??M[s%M.length];n.push({columnIndex:r,seriesId:a.id,seriesLabel:a.label,value:l,color:u,isTop:s===0,frame:{x:o.x,y:c,width:o.width,height:d}})}),n}function y0(e,t,r,n){return[x0(e,r,n),...S0(e,t,r)]}function x0(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=O(n.shadowStyle),d=l?`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`:void 0,c=n.config,u=t.isTop||c?.mekkoRoundAll?yu(e):0,{x:m,y:f,width:g,height:b}=t.frame,x=Math.max(0,p(c?.mekkoSegmentGap,0)),C="#94a3b8",L={minX:m+g/2-b/2,maxX:m+g/2+b/2,minY:f,maxY:f+b},v=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:E(t.color,C)},{offset:100,color:E(r,C)}]}:k(t.color,a,n.id);return{type:"path",id:`chart-mekko-seg-${n.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?L:i,d:Fe(m,f+x/2,g,Math.max(0,b-x),u,!!c?.mekkoRoundAll),style:{fill:v,stroke:{kind:"solid",color:c?.mekkoSegmentStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:p(c?.mekkoSegmentStrokeWidth,p(n.gridWidth,1)),shadow:l,clip:d?{type:"path",d}:void 0}}}function S0(e,t,r){let{chart:n,bounds:o,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,g=xe(r.seriesLabel,c,t.labelSize).map($=>Dr($,c,t.labelSize,!0));if(g.length*m+f>u)return[];let b=n.config?.mekkoTextColor??Z(E(r.color,"#ffffff")),x=t.columns[r.columnIndex]?.total??0,C=n.config?.mekkoValueFormat==="percent"?`${x>0?Math.round(r.value/x*100):0}%`:String(r.value),L={...w({id:`chart-mekko-seg-label-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3,width:c,height:u},text:r.seriesLabel,chart:n}),lines:g,fontSize:t.labelSize,fontWeight:"bold",color:b},v={...w({id:`chart-mekko-seg-value-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3+g.length*m,width:c,height:Math.max(1,u-g.length*m)},text:C,chart:n}),lines:[C],fontSize:t.valueSize,color:b};return[L,v]}function xu(e){let t=gu(e),r=pu(e,t);return t.columns.forEach((n,o)=>{r.push(...bu(e,t,o)),r.push(...hu(e,t,o,n))}),r}function C0(e,t){let r=t.series.map(i=>Math.max(0,p(i.values[0],0))),n=r.reduce((i,a)=>i+a,0),o=r[0]??0;return e.replace(/\{total\}/g,String(Math.round(n*100)/100)).replace(/\{percent\}/g,String(n>0?Math.round(o/n*100):0)).replace(/\{label\}/g,t.series[0]?.label??"")}function Su(e,t){let{chart:r,bounds:n,nextOrder:o}=e,i=r.config?.pieCenterText;if(!i)return[];let a=C0(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:o(),bounds:n,x:t.centerX-d/2,y:t.centerY-l*a.length/2,width:d,height:l*a.length,lines:a,fontFamily:r.fontFamily??N,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 Cu(e){let{chart:t,plot:r}=e,n=qr(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=n.outerRadius*i,s=n.innerRadius*i,l=n.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 R0=14*Math.PI/180,nr=80,k0=.62,w0=14,v0=3,P0=.32,Ru="#334155";function vu(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(n=>n.end-n.start>=R0).flatMap(n=>L0(e,t,n))}function ku(e,t,r,n,o,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=o*1.2,m=l.config?.pieLabelContent??"both",f=m==="inline"?nr*1.9:nr,g={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??N,fontSize:o,align:"center",verticalAlign:"middle",lineHeight:1.2,color:n},b=L=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...L}),x={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...g,y:m==="name"?r.y-u/2:r.y-u,lines:[m==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:b({}),prop:Ce(t.seriesId)},C={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...g,y:m==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:b({}),prop:J(t.seriesId,0),propKind:"value"};return m==="inline"||m==="name"?[x]:m==="percent"?[C]:[x,C]}function wu(e,t,r,n,o,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 ${n.x} ${n.y}`,detail:{of:"chartSeries",series:t.seriesId,mark:"pie-label-tick"},style:i?{stroke:{kind:"solid",color:o},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function L0(e,t,r){let n=e.chart.config,o={...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=z(o,i,o.outerRadius+v0),c=o.outerRadius-o.innerRadius,u=c<l*2+6,m=r.labelOffsetX!==0||r.labelOffsetY!==0,f=n?.pieLabelPosition??"auto";if(m||f==="outside"||f==="auto"&&u){let $=m?T0(z(o,i,o.outerRadius),r.labelOffsetX,r.labelOffsetY):z(o,i,o.outerRadius+w0+(f==="outside"?Math.abs(Math.cos(i))*(n?.pieLabelContent==="inline"?nr*.95:nr/2):0)),H=Xt(d,$,nr/2,l),G=n?.pieLabelColor??Ee(E(r.color,Ru),P0)??Ru;return[wu(e,r,d,H,G,!0),...ku(e,r,$,G,a,s,!0,i)]}let b=o.innerRadius+c*k0,x=z(o,i,b),C=E(r.color,"#0f172a"),L=n?.pieLabelColor??mt(C,Z(C));return[wu(e,r,d,d,L,!1),...ku(e,r,x,L,a,s,!1,i)]}function T0(e,t,r){return{x:e.x+t,y:e.y+r}}var M0=-Math.PI/2,li=Math.PI*2,$0=li*(359.999/360),si=e=>e*Math.PI/180;function Pu(e,t){let r=e.chart.config,n=E0(e.chart.series,t.total,{start:M0+si(p(r?.pieStartAngle,0)),sweep:Math.min(li,Math.max(si(1),si(p(r?.pieSweep,360)))),explode:Math.max(0,p(r?.pieExplode,0))}),o=r?.pieSliceGap??0;return[...n.flatMap(i=>G0(e,A0(t,i),i,o)),...vu(e,t,n.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:Lu(i)})))]}function Lu(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function A0(e,t){if(t.explode===0)return e;let{dx:r,dy:n}=Lu(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+n}}function E0(e,t,r){let n=[],o=r.start;return e.forEach((i,a)=>{let s=Math.max(0,p(i.values[0],0)),l=s/t*r.sweep;n.push({seriesId:i.id,label:i.label,color:i.color??M[a%M.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:o,end:o+Math.min(l,r.sweep>=li?$0:r.sweep)},explode:Math.max(0,p(i.offset,r.explode)),labelOffsetX:p(i.labelOffsetX,0),labelOffsetY:p(i.labelOffsetY,0)}),o+=l}),n}function O0(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 N0(e,t){if(t<=0)return e;let r=t/2,n=Math.min(e.blur,r*2),o=r,i=Math.hypot(e.dx,e.dy),a=i>o?o/i:1;return{...e,blur:n,dx:e.dx*a,dy:e.dy*a}}function B0(e,t,r){let n=Math.max(0,r)/2,o=t.angles.end-t.angles.start,i=yt(e,t.angles,r),a=2*He(n,e.outerRadius),s=Math.max(0,o-a);return Math.min(e.cornerRadius,i?qt(e.outerRadius,e.innerRadius,s):Kt(e.outerRadius,Ve(n,o,e.outerRadius),s))}function I0(e,t){let r=e.chart.config,n=t.stroke??r?.pieStroke;return n?{stroke:{kind:"solid",color:n},strokeWidth:p(t.strokeWidth,p(r?.pieStrokeWidth,1))}:{}}function G0(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=k(r.color,a,o.id),d=We(t,r.angles,B0(t,r,n),n),c=O(o.shadowStyle),u=I0(e,r),m=o.config?.pieGlow,f=c?{type:"path",id:`chart-pie-slice-shadow-${o.id}-${r.seriesId}`,order:s(),bounds:i,d,style:{fill:l,...u,shadow:N0(c,n),clip:{type:"path",d:O0(t.centerX,t.centerY,t.outerRadius)}}}:void 0,g={type:"path",id:`chart-pie-slice-${o.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:J(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:m?{color:E(r.color,"#ffffff"),opacity:.85,blur:m,dx:0,dy:0}:void 0}};return f?[f,g]:[g]}function Tu(e){let t=Cu(e);return[...Pu(e,t),...Su(e,t)]}var D0=-Math.PI/2,_0="#e2e8f0",F0=14*Math.PI/180,ln=80,H0=.62,V0=14,W0=3,z0=.32,Mu="#334155";function Y0(e){let{chart:t,plot:r}=e,n=Math.max(1,Math.min(r.width,r.height)/2-4),o=p(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,maxRadius:n,innerRadius:Math.max(0,Math.min(p(t.config?.innerRadius,0),n-1)),cornerRadius:Math.max(0,p(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,p(t.config?.pieSliceGap,0)),axisMin:o,range:p(t.axisY.max,100)-o,sweep:t.series.length>0?Math.PI*2/t.series.length:0,start:D0+p(t.config?.pieStartAngle,0)*Math.PI/180}}function $u(e,t,r){let{centerX:n,centerY:o,innerRadius:i,cornerRadius:a,gapPx:s}=e,l={centerX:n,centerY:o,outerRadius:t,innerRadius:i},d=Math.max(0,s)/2,c=r.end-r.start,u=Math.max(0,c-2*He(d,t));if(yt(l,r,s))return Math.min(a,qt(t,i,u));let m=Ve(d,c,t);return Math.min(a,Kt(t,m,u))}function j0(e,t,r,n,o,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:m,innerRadius:f,maxRadius:g,gapPx:b}=t,x=k(a,d,s.id),C=O(s.shadowStyle),L=We({centerX:u,centerY:m,outerRadius:g,innerRadius:f},n,$u(t,g,n),b),v={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:L,style:{fill:k(s.gridColor??_0,d,s.id),opacity:s.config?.polarTrackOpacity,...U0(e)}},$=We({centerX:u,centerY:m,outerRadius:o,innerRadius:f},n,$u(t,o,n),b),H=C?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:$,style:{fill:x,shadow:C,clip:{type:"path",d:L}}}:void 0,G={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:$,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:n.start,pieEnd:n.end,pieValue:i},prop:J(r.id,0),style:{fill:x,innerShadow:C,...X0(e)}};return H?[v,H,G]:[v,G]}function U0(e){let t=e.chart.config;if(!t?.polarTrackStroke)return{};let r=(t.polarTrackDash??"").split(/[ ,]+/).map(Number).filter(n=>Number.isFinite(n)&&n>0);return{stroke:{kind:"solid",color:t.polarTrackStroke},strokeWidth:p(t.polarTrackStrokeWidth,1),dash:r.length>0?r:void 0}}function X0(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:p(t.pieStrokeWidth,1)}:{}}function q0(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return!r.config?.polarRings||t.range<=0?[]:D(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:o(),bounds:n,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 Au(e){let t=Y0(e),{centerX:r,centerY:n,innerRadius:o,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=F0;return[...e.chart.series.flatMap((m,f)=>{let g={start:d+f*l,end:d+(f+1)*l},b=Math.max(0,p(m.values[0],0)),x=s>0?Math.min(1,Math.max(0,(b-a)/s)):0,C=Math.max(o+1,o+(i-o)*x),L=m.color??M[f%M.length],v=j0(e,t,m,g,C,b,L);if(!c)return v;let $={centerX:r,centerY:n,outerRadius:C,innerRadius:o};return[...v,...Z0(e,$,g,m,b,L)]}),...q0(e,t)]}function Eu(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 K0(e,t,r,n,o){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=Eu(e.chart),l=(a+s)*1.2/2,d=t.outerRadius-t.innerRadius,c=p(n.labelOffsetX,0),u=p(n.labelOffsetY,0),m=c!==0||u!==0,f=d<l*2+6,g=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),b=!f&&g>=ln,x=e.chart.config?.polarOutsideLabels??!1;if(!b&&!m&&!x)return;let C=m||!b,L=z(t,i,t.outerRadius+W0),v=C?m?Q0(z(t,i,t.outerRadius),c,u):z(t,i,t.outerRadius+V0):z(t,i,t.innerRadius+d*H0),$=C?x&&e.chart.textColor?e.chart.textColor:Ee(E(o,Mu),z0)??Mu:mt(E(o,"#0f172a"),Z(E(o,"#0f172a")));return{point:v,color:$,outside:C,mid:i,tickStart:L}}function Z0(e,t,r,n,o,i){let a=K0(e,t,r,n,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:m,mid:f,tickStart:g}=a,{nameSize:b,valueSize:x}=Eu(s),C=Math.max(b,x)*1.2,L=m?Xt(g,c,ln/2,C):g,v={type:"path",id:`chart-polar-area-label-tick-${s.id}-${n.id}`,order:d(),bounds:l,d:`M ${g.x} ${g.y} L ${L.x} ${L.y}`,detail:{of:"chartSeries",series:n.id,mark:"polar-area-label-tick"},style:m?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},$={of:"chartSeries",series:n.id,mark:"polar-area-label",pulled:m||void 0,midAngle:f,wedgeRadius:t.outerRadius},H={bounds:l,x:c.x-ln/2,width:ln,fontFamily:s.fontFamily??N,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},G=s.config?.polarValueFirst??!1,_=b*1.2,Y=x*1.2,oe=c.y-(_+Y)/2,te=G?oe+Y:oe,he=G?oe:oe+_,ie={type:"text",id:`chart-polar-area-label-name-${s.id}-${n.id}`,order:d(),...H,y:te,height:b*1.2,fontSize:b,lines:[n.label],fontWeight:G?"normal":"bold",detail:$,prop:Ce(n.id)},Ge={type:"text",id:`chart-polar-area-label-value-${s.id}-${n.id}`,order:d(),...H,y:he,height:x*1.2,fontSize:x,lines:[pe(o)],fontWeight:G?"bold":"normal",detail:$,prop:J(n.id,0),propKind:"value"};return[v,ie,Ge]}function Q0(e,t,r){return{x:e.x+t,y:e.y+r}}var J0=["Speed","Quality","Cost","Reliability","Usability"];function eS(e){let{chart:t,plot:r}=e,n=(t.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...t.series.map(i=>i.values.length));return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,radius:Qr(r.width,r.height,p(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:Jr(n,o),curved:t.chartType==="radial",tension:t.config?.radarTension}}function Ou(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],n=eS(e),o=tS(r,n.count),i=(a,s)=>uc(n,s,a);return{circular:n.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),strokeWidth:Math.max(0,t.config?.radarStrokeWidth??2),tension:n.tension,pointSize:Math.max(0,t.config?.radarPointSize??3),showSpokes:t.config?.radarSpokes??!0,categories:o,centerX:n.centerX,centerY:n.centerY,radius:n.radius,radiusForValue:a=>mc(n,a),pointAt:i,polygonPath:a=>en(o.map((s,l)=>i(a,l)),!1)}}function tS(e,t){return Array.from({length:t},(r,n)=>e[n]??J0[n]??`Category ${n+1}`)}function Nu(e,t){return e.chart.showGrid===!1?[]:[...rS(e,t),...t.showSpokes?oS(e,t):[]]}function rS(e,t){return D(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>nS(e,t,r))}function nS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=t.radiusForValue(r),s={fill:{kind:"none"},stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:p(n.gridWidth,1)};return t.circular?{type:"ellipse",id:`chart-radial-ring-${n.id}-${r}`,order:i(),bounds:o,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:s}:{type:"path",id:`chart-radar-ring-${n.id}-${r}`,order:i(),bounds:o,d:t.polygonPath(a),style:s}}function oS(e,t){let{chart:r,bounds:n,nextOrder:o}=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:o(),bounds:n,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 Bu(e,t){return e.showLabels?t.categories.map((r,n)=>iS(e,t,r,n)):[]}function iS(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=t.pointAt(t.radius+10,n),d=l.x-t.centerX,c=Math.max(64,Math.min(120,i.width/3));return w({id:`chart-radar-label-${o.id}-${n}`,order:s(),bounds:a,frame:{x:aS(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:o,align:sS(d)})}function aS(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function sS(e){return e>8?"left":e<-8?"right":"center"}function Iu(e,t){let r=[];return e.chart.series.forEach((n,o)=>{r.push(...lS(e,t,n,o))}),r}function lS(e,t,r,n){let o=r.color??M[n%M.length],i=dS(r,e,t),a=en(i,t.circular,t.tension);return[cS(e,t,r,a,o),...t.strokeWidth>0?[uS(e,t,r,a,o)]:[],...t.pointSize>0?mS(e,t,r,i,o):[]]}function dS(e,t,r){let n=e.values;return r.categories.map((o,i)=>r.pointAt(r.radiusForValue(n[i]??t.chart.axisY.min),i))}function cS(e,t,r,n,o){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:n,detail:{of:"chartSeries",series:r.id},style:{fill:k(o,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function uS(e,t,r,n,o){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:n,detail:{of:"chartSeries",series:r.id},style:{fill:{kind:"none"},stroke:k(o,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:O(i.shadowStyle)}}}function mS(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return n.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:J(r.id,c),style:{fill:k(o,s,i.id)}}))}function di(e){let t=Ou(e),r=[];return r.push(...Nu(e,t)),r.push(...Bu(e,t)),r.push(...Iu(e,t)),r}var pS=-Math.PI/2,fS=14,hS=4,gS=.18,ci=1e-4;function Lt(e,t,r,n){return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}}function Gu(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 bS(e,t,r,n){return`${Gu(e,t,r)} ${Gu(e,t,Math.max(0,n))}`}function Du(e,t,r,n,o){let i=Lt(e,t,r,n),a=Lt(e,t,r,o);return`M ${i.x} ${i.y} A ${r} ${r} 0 ${o-n>Math.PI?1:0} 1 ${a.x} ${a.y}`}function yS(e,t){let r=Math.min(e.blur,t*.6),n=t*.4,o=Math.hypot(e.dx,e.dy),i=o>n?n/o:1;return{...e,blur:r,dx:e.dx*i,dy:e.dy*i}}function xS(e,t,r,n,o){if(n>=Math.PI*2-ci){let l=Lt(e,t,r,o),d=Lt(e,t,r,o+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=Lt(e,t,r,o),a=Lt(e,t,r,o+n),s=n>Math.PI?1:0;return`M ${i.x} ${i.y} A ${r} ${r} 0 ${s} 1 ${a.x} ${a.y}`}function SS(e){let{chart:t,plot:r}=e,n=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,fS)),ringGap:Math.max(0,p(t.config?.ringGap,hS)),axisMin:n,range:p(t.axisY.max,100)-n,start:pS+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,gS))),cap:t.config?.ringCap??"round"}}function CS(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:m}=t,f=O(a.shadowStyle),g=o>=Math.PI*2-ci;if(!f||g)return[];let b=yS(f,u),x=Math.min(o,u/n);return[[m,m+x],[m+o-x,m+o]].map(([C,L],v)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${v}`,order:l(),bounds:s,d:Du(d,c,n,C,L),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:b,clip:{type:"path",d:bS(d,c,n+u/2,n-u/2)}}}))}function RS(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:m,axisMin:f,range:g,start:b,total:x,trackOpacity:C,cap:L}=t,v=c-n*(u+m)-u/2;if(v<=u/2)return[];let $=k(r.color??M[n%M.length],a,o.id),H=Math.max(0,p(r.values[0],0)),G=g>0?Math.min(1,Math.max(0,(H-f)/g)):0,_={fill:{kind:"none"},stroke:$,strokeWidth:u,opacity:C},Y=x>=Math.PI*2-ci?{type:"ellipse",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:v,ry:v,style:_}:{type:"path",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,d:Du(l,d,v,b,b+x),style:{..._,lineCap:L}};if(G<=0)return[Y];let oe=G*x,te=CS(e,t,r,v,oe,$),he={type:"path",id:`chart-radial-bar-ring-${o.id}-${r.id}`,order:s(),bounds:i,d:xS(l,d,v,oe,b),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:J(r.id,0),style:{fill:{kind:"none"},stroke:$,strokeWidth:u,lineCap:L}};return[Y,...te,he]}function _u(e){let t=SS(e);return e.chart.series.flatMap((r,n)=>RS(e,t,r,n))}function Fu(e,t){let r=O(e.chart.shadowStyle),n=!!e.chart.config?.linkGradient,{plot:o}=e,i=r?`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`:void 0;return t.links.map((a,s)=>{let l=kS(e,t,a,s,n);return wS(e,l,r,i,n)})}function kS(e,t,r,n,o){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)||W,d=t.nodeColors.get(r.target)||W,c=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:l},{offset:100,color:d}]}:{kind:"solid",color:r.color||d};return{linkIndex:n,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 wS(e,t,r,n,o){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:o?l:a,d:vS(t),detail:{of:"link",fromId:t.fromId,toId:t.toId},style:{fill:t.fill,opacity:t.opacity,shadow:r,clip:n?{type:"path",d:n}:void 0}}}function vS(e){let{source:t,target:r,controlX:n}=e;return[`M ${t.x} ${t.top}`,`C ${n} ${t.top} ${n} ${r.top} ${r.x} ${r.top}`,`L ${r.x} ${r.bottom}`,`C ${n} ${r.bottom} ${n} ${t.bottom} ${t.x} ${t.bottom}`,"Z"].join(" ")}var PS=.3,LS=.78;function Hu(e,t){let r=Math.max(0,p(e.chart.config?.barCornerRadius,0)),n=[];return t.nodes.forEach(o=>{n.push(TS(e,t,o,r));let i=e.showLabels?MS(e,t,o):void 0;i&&n.push(i)}),n}function TS(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d={fill:{kind:"solid",color:r.color||W},shadow:O(o.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,m={of:"chartSeries",series:r.id,mark:"sankey-node"};return n>0&&c&&u?{type:"rect",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,rx:n,style:d,detail:m}:n>0&&c?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:It(s,l,r.width,r.height,n),style:d,detail:m}:n>0&&u?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Gt(s,l,r.width,r.height,n),style:d,detail:m}:{type:"rect",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,style:d,detail:m}}function MS(e,t,r){let{chart:n}=e,o=n.config?.labelPosition??"outside",i=o==="inside"?AS(e,t,r,n.config?.labelOrientation??"horizontal"):$S(e,t,r);if(!i)return;let a=n.textColor??"#0f172a",s=o==="inside"?Z(r.color):Ee(r.color,jr(a)?LS:PS)??a,l=n.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function $S(e,t,r){let{chart:n,bounds:o,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{...w({id:`chart-sankey-label-${n.id}-${r.id}`,order:i(),bounds:o,frame:{x:d,y:l,width:t.labelGutter-12,height:Math.max(1,r.height)},text:r.label,chart:n,align:a?"right":"left"}),fontSize:t.labelSize,fontWeight:"bold",verticalAlign:"middle"}}function AS(e,t,r,n){let{chart:o,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-${o.id}-${r.id}`;if(n==="vertical"){let f=u*1.4,g=Math.max(1,r.height-8);return Te(r.label,u,!1)>g?void 0:{...w({id:m,order:a(),bounds:i,frame:{x:d-g/2,y:c-f/2,width:g,height:f},text:r.label,chart:o,align:"center",rotation:-90}),fontSize:u,fontWeight:"bold",verticalAlign:"middle",rotationCenter:{x:d,y:c}}}return{...w({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:o,align:"center"}),fontSize:u,fontWeight:"bold",verticalAlign:"middle"}}function Vu(e){let{chart:t,plot:r,showLabels:n}=e,o=n?92:0,i=Math.max(1,r.width-o*2),a=ai(ES(e),OS(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+o,baseY:r.y,labelGutter:o,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||W]))}}function ES(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function OS(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?E(r.color,W):void 0})}),t}function Wu(e){let t=Vu(e),r=[];return r.push(...Fu(e,t)),r.push(...Hu(e,t)),r}var NS=4;function zu(e){let t=[],r=O(e.chart.shadowStyle);return e.chart.series.forEach((n,o)=>{let i=n.color??M[o%M.length];Ue(e,je(e.chart,n)).forEach((s,l)=>{t.push(BS(e,n,s,l,i,r))})}),t}function BS(e,t,r,n,o,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??NS,m=c?.pointStrokeWidth??0;return{type:"ellipse",id:`chart-point-${a.id}-${t.id}-${n}`,order:d(),bounds:s,cx:r.x,cy:r.y,rx:u,ry:u,detail:{of:"chartValue",series:t.id,valueIndex:n},style:{fill:k(o,l,a.id),stroke:m>0?k(c?.pointStrokeColor??o,l,a.id):void 0,strokeWidth:m>0?m:void 0,opacity:c?.pointOpacity,shadow:i}}}function Yu(e){let{chart:t,plot:r,showLegend:n}=e,o=Math.max(9,p(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=n&&i==="bottom"?48:0,s=Math.max(0,p(t.config?.cellGap,0));return{leaves:t.series,bands:Wt(t.axisY),zones:t.config?.zones?.length?t.config.zones:Vt,fontSize:o,smallFontSize:Math.max(8,o-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,o-1))),valueSize:Math.max(6,p(t.config?.tileValueSize,Math.max(8,o-1))),labelPadding:Math.max(0,p(t.config?.tileLabelPadding,4))}}function or(e){return e.values[0]??0}function ui(e,t){return e.color??zt(or(e),t.bands,t.zones)}var $e=10,dn=4,mi=2,pi=16,ir=34;function ju(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?IS(e,t):GS(e,t)}function fi(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function Uu(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((n,o)=>({offset:fi(e,e.bands[o+1]??e.bands[e.bands.length-1])*100,color:n.color??W}))}function IS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e,a=n.x,s=t.gridWidth,l=t.fontSize+2,d=n.y+t.gridHeight+pi,c=K({x:a,y:d,width:s,height:$e}),u=Uu(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:$e,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:W},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((g,b)=>{let x=a+fi(t,g)*s,C={type:"path",id:`chart-treemap-legend-tick-${r.id}-${b}`,order:i(),bounds:o,d:`M ${x} ${d+$e} L ${x} ${d+$e+dn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},L=b===0,v=b===t.bands.length-1,$=L?"left":v?"right":"center",H=L?x:v?x-ir:x-ir/2,G=w({id:`chart-treemap-legend-tick-label-${r.id}-${b}`,order:i(),bounds:o,frame:{x:H,y:d+$e+dn+mi,width:ir,height:l},text:pe(g),chart:r,align:$});return[C,G]});return[m,...f]}function GS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e,a=t.legendPosition,s=n.y,l=t.gridHeight,d=a==="left"?n.x-pi-$e:n.x+t.gridWidth+pi,c=K({x:d,y:s,width:$e,height:l}),u=Uu(t),m={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:$e,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:W},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+$e,g=a==="left"?f-dn:f+dn,b=a==="left"?g-mi-ir:g+mi,x=t.bands.flatMap((C,L)=>{let v=s+(1-fi(t,C))*l,$={type:"path",id:`chart-treemap-legend-tick-${r.id}-${L}`,order:i(),bounds:o,d:`M ${f} ${v} L ${g} ${v}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},H=w({id:`chart-treemap-legend-tick-label-${r.id}-${L}`,order:i(),bounds:o,frame:{x:b,y:v-t.fontSize/2,width:ir,height:t.fontSize+2},text:pe(C),chart:r,align:a==="left"?"right":"left"});return[$,H]});return[m,...x]}function Xu(e,t){let{tiles:r,headers:n}=DS(e,t),o=[],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;o.push(...FS(e,t,a,c))}),n.forEach((a,s)=>{o.push(..._S(e,t,a,s))}),o}function DS(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:or(c)}));return{tiles:rr(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 n=r.map(l=>({key:l,label:l||"Other",value:t.leaves.filter(d=>(d.group??"")===l).reduce((d,c)=>d+or(c),0)})),o=rr(n,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),i=t.cellGap,a=[],s=[];return o.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:or(m)}));a.push(...rr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function _S(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=o.config?.headerColor??o.gridColor??"#e2e8f0",d={type:"rect",id:`chart-treemap-header-${o.id}-${n}`,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,o.fontSize??12)-1),u={...w({id:`chart-treemap-header-label-${o.id}-${n}`,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:o,align:"center"}),fontSize:c,color:Z(l)};return[d,u]}function FS(e,t,r,n){let o=ui(r.item.leaf,t),i=n?ui(n.item.leaf,t):void 0,a=[HS(e,t,r,o,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...VS(e,t,r,o)),a}function HS(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=O(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,g=a.y+r.y+c/2,b=Math.max(0,r.width-c),x=Math.max(0,r.height-c),C="#94a3b8",L={minX:f,maxX:f+b,minY:g+x/2-b/2,maxY:g+x/2+b/2},v=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:E(n,C)},{offset:100,color:E(o,C)}]}:k(n,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:o?L:s,x:f,y:g,width:b,height:x,rx:t.cellRadius,style:{fill:v,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 VS(e,t,r,n){let{chart:o,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),g=i.x+r.x+c/2+u,b=i.y+r.y+c/2+u*.75,x=o.config?.tileTextColor??Z(E(n,"#ffffff")),C=t.labelSize*1.2,L=Math.max(1,Math.floor(f/C)),v=xe(l.label,m,t.labelSize).slice(0,L).map(Y=>Dr(Y,m,t.labelSize,!0)),$={...w({id:`chart-treemap-label-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b,width:m,height:f},text:l.label,chart:o}),lines:v,fontSize:t.labelSize,fontWeight:"bold",color:x},H=String(d),G=v.length*C+t.valueSize*1.2<=f+2&&Te(H,t.valueSize,!1)<=m;if(o.config?.showTileValues===!1||!G)return[$];let _={...w({id:`chart-treemap-value-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b+v.length*C,width:m,height:Math.max(1,f-v.length*C)},text:String(d),chart:o}),lines:[String(d)],fontSize:t.valueSize,color:x};return[$,_]}function qu(e){let t=Yu(e),r=[];return r.push(...Xu(e,t)),r.push(...ju(e,t)),r}var WS={bar:Cc,boxplot:Mc,custom:Ec,field:Hc,heatmap:Xc,hexbin:e=>ru(e),line:uu,mekko:xu,pie:e=>Tu(e),polarArea:e=>Au(e),radar:e=>di(e),radial:e=>di(e),radialBar:e=>_u(e),sankey:Wu,scatter:zu,treemap:qu},zS=new Set(["radar","radial"]);function hi(e){return zS.has(e)}function Xe(e){return WS[e.chart.chartType](e)}function Ku(e){let{chart:t,context:r,layout:n,nodes:o,renderOrder:i}=e,a=rn(t,n.plot,n.bounds,i.current());o.push(...a),i.advance(a.length),o.push(...Xe(r));let s=hc({chart:t,plot:n.plot,bounds:n.bounds,order:i.current()});return o.push(...s),i.advance(s.length),o.push(...ac(t,n,i.current())),o}function YS(e,t){let r=Q(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function jS(e,t){let{outerRadius:r,innerRadius:n,cornerRadius:o}=qr(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},${n},${o}`}}function US(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),n=Math.max(0,Math.min(p(e.config?.innerRadius,0),r-1)),o=Math.max(0,p(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${n},${o}`}}function XS(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...e.series.map(c=>c.values.length)),o=Jr(r,n),i=Qr(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},${o},${l}${d===void 0?"":`,${d}`}`}}function qS(e,t){return e.chartType==="pie"?jS(e,t):e.chartType==="polarArea"?US(e,t):e.chartType==="radar"||e.chartType==="radial"?XS(e,t):ec.has(e.chartType)?YS(e,t):void 0}function Zu(e,t,r,n){let o={type:"rect",id:`chart-${e.id}`,order:n,bounds:t,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius??12,style:{fill:k(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:p(e.strokeWidth,1)}},i=qS(e,r);return i&&(o.detail=i),o}function Qu(e,t,r,n){let o=Zd({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:n});return r.advance(o.length),o}function Ju(e,t,r,n){return{chart:e,plot:t.plot,bounds:t.bounds,diagnostics:n,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;#n=.01;constructor(t){this.#e=t}next=()=>this.#e+this.#n++;current(){return this.#e+this.#n}advance(t){this.#n+=t}};function em(e,t,r,n){return e.title?[{...w({id:`chart-title-${e.id}`,order:n.next(),bounds:t,frame:{x:r.x,y:e.y+12,width:r.width,height:20},text:e.title,chart:e}),...e.titleColor?{color:e.titleColor}:{},fontWeight:e.titleWeight??"bold",fontSize:p(e.titleSize,Math.max(10,p(e.fontSize,12))+2),prop:Yd}]:[]}function tm(e,t,r){let n=2e4+t,o=tc(e),i=new cn(n),a=[Zu(e,o.bounds,o.plot,n)];return a.push(...gc(e,o.bounds,i)),a.push(...em(e,o.bounds,o.plot,i)),a.push(...Qu(e,o,i,r)),{chart:e,layout:o,nodes:a,renderOrder:i,context:Ju(e,o,i,r)}}function rm(e){return e.nodes.push(...Xe(e.context)),e.nodes}function nm(e){return e.nodes.push(...Xe(e.context)),e.nodes}function om(e,t,r){if(e.isVisible===!1)return[];let n=tm(e,t,r);return hi(e.chartType)?rm(n):ze(e)?Ku(n):nm(n)}function gi(e,t){return e.flatMap((r,n)=>q(om(r,n,t),"chart",r.id,r.chartType,r.title??"Chart"))}function KS(e){return e.length?{minX:Math.min(...e.map(t=>t.bounds.minX)),minY:Math.min(...e.map(t=>t.bounds.minY)),maxX:Math.max(...e.map(t=>t.bounds.maxX)),maxY:Math.max(...e.map(t=>t.bounds.maxY))}:fo}function ZS(e){let t=new Map,r=(n,o,i)=>{o.forEach((a,s)=>{t.set(`${n}:${a.id}`,{rank:bl(a),sequence:yl(a,i+s)})})};return r("frame",e.frames,0),r("swimlane",e.swimlanes,5e3),r("shape",e.shapes,1e4),r("widget",e.widgets??[],1e4),r("isometric",e.isometricObjects??[],15e3),r("link",e.links.map(n=>n.link),2e4),r("chart",e.charts??[],2e4),r("path",e.paths??[],3e4),t}function QS(e,t){let r=ZS(t);for(let n of e){let o=n.identity?r.get(`${n.identity.role}:${n.identity.id}`):void 0;n.rank=o?.rank??0,n.sequence=o?.sequence??0}}function bi(e,t={}){let{measureText:r}=t,n=[...e.diagnostics??[]],o=[...Ll(e),...gd(e.paths??[]),...gi(e.charts??[],n),...hd(e.links,r),...Bd(e.shapes,n,r),...Id(e.widgets??[]),...Ml(e.isometricObjects??[])];return QS(o,e),o.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:o,bounds:KS(o),diagnostics:n}}var P=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),h=e=>Number(e.toFixed(3)).toString(),fe=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){if(!t.clip)return;let r=JSON.stringify(t.clip),n=this.ids.get(r);if(!n){n=fe(`${this.prefix}clip-${this.ids.size}`),this.ids.set(r,n);let o=t.clip,i=o.type==="path"?`<path clip-rule="evenodd" d="${P(o.d)}"/>`:`<rect x="${h(o.x)}" y="${h(o.y)}" width="${h(o.width)}" height="${h(o.height)}" rx="${h(o.rx)}"/>`;this.addDefinition(`<clipPath id="${n}">${i}</clipPath>`)}return n}};var mn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;filter(t,r,n){if(t.innerShadow)return this.define(r,t.innerShadow,tC);if(t.shadow){let o=t.shadow.blur*1.5+Math.max(Math.abs(t.shadow.dx),Math.abs(t.shadow.dy));return this.define(r,t.shadow,JS,n&&n>0?Math.max(.5,o/n):.5)}if(t.blur||t.saturate!==void 0)return this.define(r,{blur:t.blur??0,saturate:t.saturate??1},eC)}define(t,r,n,o=.5){let i=JSON.stringify(r)+n.name+o,a=this.ids.get(i);return a||(a=fe(`${this.prefix}shadow-${t}-${this.ids.size}`),this.ids.set(i,a),this.addDefinition(`<filter id="${a}" x="${h(-o*100)}%" y="${h(-o*100)}%" width="${h((1+o*2)*100)}%" height="${h((1+o*2)*100)}%">${n(r)}</filter>`)),a}};function JS(e){return`<feDropShadow dx="${h(e.dx)}" dy="${h(e.dy)}" stdDeviation="${h(e.blur/2)}" flood-color="${P(e.color)}" flood-opacity="${h(e.opacity)}"/>`}function eC(e){let t=e.blur>0?`<feGaussianBlur stdDeviation="${h(e.blur/2)}"/>`:"",r=e.saturate===1?"":`<feColorMatrix type="saturate" values="${h(e.saturate)}"/>`;return t+r}function tC(e){return['<feComponentTransfer in="SourceAlpha" result="sf-inverted-alpha">','<feFuncA type="table" tableValues="1 0"/>',"</feComponentTransfer>",`<feGaussianBlur in="sf-inverted-alpha" stdDeviation="${h(e.blur/2)}" result="sf-blurred"/>`,`<feOffset in="sf-blurred" dx="${h(e.dx)}" dy="${h(e.dy)}" result="sf-offset"/>`,`<feFlood flood-color="${P(e.color)}" flood-opacity="${h(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 im(e,t,r,n){return{arrow:`<path d="M ${h(-t)} ${h(-t*.6)} L 0 0 L ${h(-t)} ${h(t*.6)}" fill="none" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round" stroke-linejoin="round"/>`,filled_arrow:`<path d="M ${h(-t)} ${h(-t*.6)} L 0 0 L ${h(-t)} ${h(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${h(n*.5)}" stroke-linejoin="round"/>`,circle:`<circle cx="0" cy="0" r="${h(t*.5)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/>`,filled_circle:`<circle cx="0" cy="0" r="${h(t*.5)}" fill="${r}"/>`,diamond:`<path d="M ${h(-t*.6)} 0 L 0 ${h(-t*.6)} L ${h(t*.6)} 0 L 0 ${h(t*.6)} Z" fill="white" stroke="${r}" stroke-width="${h(n)}"/>`,filled_diamond:`<path d="M ${h(-t*.6)} 0 L 0 ${h(-t*.6)} L ${h(t*.6)} 0 L 0 ${h(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${h(n*.5)}"/>`,bar:`<path d="M 0 ${h(-t*.6)} V ${h(t*.6)}" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,triangle:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 L ${h(-t)} ${h(t*.72)} Z" fill="white" stroke="${r}" stroke-width="${h(n)}" stroke-linejoin="round"/>`,one:`<path d="M 0 ${h(-t*.62)} V ${h(t*.62)} M ${h(-t*.72)} ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}"/>`,zero_one:`<circle cx="${h(-t*.8)}" cy="0" r="${h(t*.38)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/><path d="M 0 ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}"/>`,many:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,one_many:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0 M ${h(-t*1.45)} ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,zero_many:`<circle cx="${h(-t*1.45)}" cy="0" r="${h(t*.38)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/><path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`}[e]}function rC(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function nC(e,t){return`id="${e}" markerWidth="${h(t*2)}" markerHeight="${h(t*2)}" viewBox="${h(-t)} ${h(-t)} ${h(t*2)} ${h(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,n){if(!t||t==="none")return;let o=`${t}:${r}:${n}`,i=this.ids.get(o);if(i)return i;i=fe(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(o,i);let a=12+(n-2)*3,s=rC(t,a,n),l=nC(i,s);return this.addDefinition(`<marker ${l}>${im(t,a,P(r),n)}</marker>`),i}};function oC(e,t){let r=t.points.map((i,a)=>fe(`${e}-point-${a}`)),n=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="${h(s)}%" cy="${h(l)}%" r="75%"><stop offset="0%" stop-color="${P(i.color)}" stop-opacity="1"/><stop offset="100%" stop-color="${P(i.color)}" stop-opacity="0"/></radialGradient>`}).join(""),o=t.points.map((i,a)=>`<rect width="1" height="1" fill="url(#${r[a]})"/>`).join("");return`${n}<pattern id="${e}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><rect width="1" height="1" fill="${P(t.points[0]?.color??"transparent")}"/>${o}</pattern>`}function iC(e,t,r){let n=t.angle*Math.PI/180,o=(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(n)*a,l=Math.sin(n)*a,d=t.stops.map(c=>`<stop offset="${h(Math.max(0,Math.min(100,c.offset)))}%" stop-color="${P(c.color)}"/>`).join("");return`<linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${h(o-s)}" y1="${h(i-l)}" x2="${h(o+s)}" y2="${h(i+l)}">${d}</linearGradient>`}var fn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;paint(t,r,n){if(!t||t.kind==="none")return"none";if(t.kind==="solid")return t.color;let o=JSON.stringify(t)+JSON.stringify(n),i=this.ids.get(o);if(!i){i=fe(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(o,i);let a=t.kind==="mesh-gradient"?oC(i,t):iC(i,t,n);this.addDefinition(a)}return`url(#${i})`}};var hn=class{constructor(t){this.prefix=t;let r=n=>{this.entries.push(n)};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 fe(`${this.prefix}${t}`)}paint(t,r,n){return this.paints.paint(t,r,n)}filter(t,r,n){return this.filters.filter(t,r,n)}marker(t,r,n){return this.markers.marker(t,r,n)}clip(t){return this.clips.clip(t)}};function aC(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 am(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,aC(t,t.identity.id)]:[t])}function sm(e,t){let r=e.stroke;return r?.kind==="solid"?r.color:r?.kind==="linear-gradient"&&r.stops.length?(t==="start"?r.stops.reduce((o,i)=>o.offset<=i.offset?o:i):r.stops.reduce((o,i)=>o.offset>=i.offset?o:i)).color:r?.kind==="mesh-gradient"&&r.points.length?r.points[0].color:"#64748b"}function lm(e,t){let r=t.paint(e.style.stroke,`${e.id}-stroke`,e.bounds),n=t.paint(e.style.fill,`${e.id}-fill`,e.bounds),o=[`fill="${P(n)}"`,`stroke="${P(r)}"`];return sC(o,e.style),dm(o,e,t),dC(o,e,t),o.join(" ")}function sC(e,t){t.strokeWidth!==void 0&&e.push(`stroke-width="${h(t.strokeWidth)}"`),t.dash?.length&&e.push(`stroke-dasharray="${t.dash.map(h).join(" ")}"`),t.lineCap&&e.push(`stroke-linecap="${t.lineCap}"`),t.lineJoin&&e.push(`stroke-linejoin="${t.lineJoin}"`),t.opacity!==void 0&&e.push(`opacity="${h(t.opacity)}"`),t.pointerEvents&&e.push(`pointer-events="${t.pointerEvents}"`)}function lC(e){let t=e;if(t.type==="ellipse"&&t.rx!==void 0&&t.ry!==void 0)return Math.min(t.rx,t.ry)*2;if(t.type==="rect"&&t.width!==void 0&&t.height!==void 0)return Math.min(t.width,t.height)}function dm(e,t,r){let n=r.filter(t.style,t.id,lC(t));n&&e.push(`filter="url(#${n})"`);let o=r.clip(t.style);o&&e.push(`clip-path="url(#${o})"`)}function dC(e,t,r){if(t.type!=="path")return;let n=r.marker(t.markerStart,sm(t.style,"start"),t.style.strokeWidth??1),o=r.marker(t.markerEnd,sm(t.style,"end"),t.style.strokeWidth??1);n&&e.push(`marker-start="url(#${n})"`),o&&e.push(`marker-end="url(#${o})"`)}function Ne(e,t){return e&&t?` transform="rotate(${h(e)} ${h(t.x)} ${h(t.y)})"`:""}function cm(e,t){let r=[];return e.style.opacity!==void 0&&r.push(`opacity="${h(e.style.opacity)}"`),e.style.pointerEvents&&r.push(`pointer-events="${e.style.pointerEvents}"`),dm(r,e,t),r.join(" ")}var um="data-sf-symbol-points",mm="data-sf-symbol-tension",gn="data-sf-symbol-bounds",ar="data-sf-corner-radius",pm="data-sf-square-corner",bn="data-sf-path-points",yn="data-sf-path-tension",xn="data-sf-path-closed",fm="data-sf-path-point",Sn="data-sf-isometric-size",Cn="data-sf-isometric-label-offset";function cC(e){return e.role==="shape"?"entity":e.role}function uC(e){return[`data-sf-role="${cC(e)}"`,`data-sf-id="${P(e.id)}"`,e.kind?`data-sf-kind="${P(e.kind)}"`:void 0,e.primary?'data-sf-primary="true"':void 0,e.parentFrameId?`data-sf-parent-frame="${P(e.parentFrameId)}"`:void 0]}function mC(e){switch(e.of){case"chartValue":return pC(e);case"chartScale":return gC(e);case"chartSeries":return bC(e);case"pieGeometry":return fC(e);case"radarGeometry":return hC(e);case"link":return RC(e);case"frameBoundary":return yC(e);case"symbolGeometry":return xC(e);case"declaredBounds":return[yi(e.bounds)];case"pathGeometry":return SC(e);case"isometricGeometry":return CC(e)}}function pC(e){return[`data-sf-series="${P(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="${h(e.radius)}"`:void 0,e.colorProp?`data-sf-color-prop="${P(e.colorProp)}"`:void 0,e.hasColorOverride?'data-sf-color-override="true"':void 0,e.pieStart!==void 0?`data-sf-pie-start="${h(e.pieStart)}"`:void 0,e.pieEnd!==void 0?`data-sf-pie-end="${h(e.pieEnd)}"`:void 0,e.pieValue!==void 0?`data-sf-pie-value="${h(e.pieValue)}"`:void 0]}function fC(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function hC(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function gC(e){return[`data-sf-value-scale="${e.valueScale}"`]}function bC(e){return[`data-sf-series="${P(e.series)}"`,e.lineTension!==void 0?`data-sf-line-tension="${h(e.lineTension)}"`:void 0,e.mark?`data-sf-mark="${P(e.mark)}"`:void 0,e.pulled?'data-sf-label-pulled="true"':void 0,e.midAngle!==void 0?`data-sf-pie-mid-angle="${h(e.midAngle)}"`:void 0,e.wedgeRadius!==void 0?`data-sf-pie-wedge-radius="${h(e.wedgeRadius)}"`:void 0]}function yC(e){return[`${ar}="${h(e.cornerRadius)}"`,`${pm}="${e.squareCorner}"`]}function yi(e){return`${gn}="${h(e.x)},${h(e.y)},${h(e.width)},${h(e.height)}"`}function xC(e){return[`${um}="${P(JSON.stringify(e.points))}"`,`${mm}="${h(e.tension)}"`,yi(e.declaredBounds)]}function SC(e){return[`${bn}="${P(JSON.stringify(e.points))}"`,`${yn}="${h(e.tension)}"`,`${xn}="${e.closed}"`]}function CC(e){return[`${Sn}="${h(e.width)},${h(e.height)},${h(e.depth)}"`,`${ar}="${h(e.cornerRadius)}"`,yi(e.bounds),`${Cn}="${h(e.labelOffsetX)},${h(e.labelOffsetY)}"`]}function RC(e){return[e.fromId?`data-sf-from="${P(e.fromId)}"`:void 0,e.toId?`data-sf-to="${P(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="${P(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 qe(e){let t=e.identity?.label,r=[...e.identity?uC(e.identity):[],...e.detail?mC(e.detail):[],e.prop?`data-sf-prop="${P(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="${P(e.mark)}"`:void 0,e.zoneGradient?'data-sf-zone-gradient="true"':void 0,e.zoneGradient?`data-sf-zone-axis-min="${h(e.zoneGradient.min)}"`:void 0,e.zoneGradient?`data-sf-zone-axis-max="${h(e.zoneGradient.max)}"`:void 0,t?`tabindex="0" aria-label="${P(t.replace(/\s+/g," ").trim())}"`:void 0].filter(n=>n!==void 0);return r.length?` ${r.join(" ")}`:""}function kC(e,t,r,n){if(!e.length)return`<tspan x="${h(t)}"${r} font-size="${n}"></tspan>`;let o=[];for(let i of e){let a=o[o.length-1];a&&a.bold===i.bold?a.text+=` ${i.text}`:(a&&(a.text+=" "),o.push({text:i.text,bold:i.bold}))}return o.map((i,a)=>`<tspan${a===0?` x="${h(t)}"${r}`:""} font-size="${n}" font-weight="${i.bold?"bold":"normal"}">${P(i.text)}</tspan>`).join("")}function hm(e,t){let r=wC(e),n=`${h(e.fontSize)}px`,o=PC(e,r,n),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${qe(e)} x="${h(r.x)}" y="${h(r.firstY)}" font-family="${P(e.fontFamily)}" font-size="${n}" font-weight="${e.fontWeight}"${e.letterSpacing?` letter-spacing="${h(e.letterSpacing)}"`:""} fill="${P(e.color)}" text-anchor="${r.anchor}" data-sf-valign="${e.verticalAlign}" data-sf-line-height="${h(e.lineHeight)}"${i}${Ne(e.rotation,e.rotationCenter)}>${o}</text>`}function wC(e){let t=e.fontSize*e.lineHeight,n=(e.richLines?e.richLines.length:e.lines.length)*t,o=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:o,firstY:vC(e,n),linePx:t,anchor:i}}function vC(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 PC(e,t,r){return e.richLines?e.richLines.map((n,o)=>kC(n,t.x,gm(o,t.linePx),r)).join(""):e.lines.map((n,o)=>LC(n,o,t,r)).join("")}function LC(e,t,r,n){return`<tspan x="${h(r.x)}" font-size="${n}"${gm(t,r.linePx)}>${P(e)}</tspan>`}function gm(e,t){return e?` dy="${h(t)}px"`:""}function TC(e,t){let r=Ne(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=P(JSON.stringify(e.shader.parameters)),o=e.fillColor?` data-sf-shader-fill="${P(e.fillColor)}"`:"";return`<foreignObject id="${t.elementId(e.id)}"${qe(e)} data-sf-shader="${P(e.shader.program)}" data-sf-shader-name="${P(e.shader.name)}" data-sf-shader-params="${n}" data-sf-shader-mask="${e.mask}"${o} x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(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 MC(e,t){let r=t.widgetStyle;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:${P(r.color)};font-weight:${P(r.fontWeight)};line-height:1">${P(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 ${P(r.divider)};border-radius:.09em;background:${P(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:${P(r.color)};font-weight:300;line-height:1">${P(e)}</span><span style="position:absolute;z-index:2;left:0;right:0;top:50%;height:1px;background:${P(r.divider)};pointer-events:none"></span></span>`}function $C(e,t){let r=Ne(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=e.widgetStyle.fontSize>0?e.widgetStyle.fontSize:Math.max(1,Math.min(e.width,e.height)*.28),o=e.label?`<span xmlns="http://www.w3.org/1999/xhtml" style="margin-bottom:.14em;color:${P(e.widgetStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${P(e.label)}</span>`:"",i=[...e.value].map(s=>MC(s,e)).join(""),a=P(JSON.stringify(e.widgetStyle));return`<foreignObject id="${t.elementId(e.id)}"${qe(e)} data-sf-widget="rollingNumber" data-sf-widget-value="${P(e.value)}" data-sf-widget-digits="${e.digits??""}" data-sf-widget-duration="${h(e.duration)}" data-sf-widget-style="${a}" x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(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:${P(e.widgetStyle.fontFamily)};font-size:${h(n)}px">${o}<div data-sf-rolling-digits="true" aria-label="${P(e.value)}" style="display:flex;gap:${e.widgetStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function bm(e,t){if(e.type==="text")return hm(e,t);if(e.type==="shader-surface")return TC(e,t);if(e.type==="rolling-number")return $C(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${qe(e)} ${cm(e,t)} href="${P(e.href)}" x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}" preserveAspectRatio="xMidYMid slice"/>`;let r=`id="${t.elementId(e.id)}"${qe(e)} ${lm(e,t)}`;return e.type==="rect"?`<rect ${r} x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}"${e.rx?` rx="${h(e.rx)}"`:""}${Ne(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2})}/>`:e.type==="ellipse"?`<ellipse ${r} cx="${h(e.cx)}" cy="${h(e.cy)}" rx="${h(e.rx)}" ry="${h(e.ry)}"${Ne(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${P(e.d)}"${Ne(e.rotation,e.rotationCenter)}/>`}function ym(e,t={}){let r=t.padding??16,n=Math.max(1,e.bounds.maxX-e.bounds.minX+r*2),o=Math.max(1,e.bounds.maxY-e.bounds.minY+r*2),i=`${h(e.bounds.minX-r)} ${h(e.bounds.minY-r)} ${h(n)} ${h(o)}`,a=new hn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?am(e.nodes):e.nodes).map(u=>bm(u,a)).join(`
3
+ `?(this.line++,this.col=1):this.col++,t}};var ye=class extends Error{constructor(r,n,o){super(`SFL lex error (${n}:${o}): ${r}`);this.line=n;this.col=o;this.name="SflLexError"}line;col};var Na=e=>e!==void 0&&/^[A-Za-z_]$/.test(e),dt=e=>e!==void 0&&e>="0"&&e<="9",Oa=e=>e!==void 0&&/^[A-Za-z0-9_]$/.test(e);function re(e,t,r,n={}){return{type:e,value:t,line:r.line,col:r.col,endLine:r.line,endCol:r.col,...n}}function po(e,t){return{...e,endLine:t.line,endCol:t.col}}function Ba(e){return Na(e.peek())}function Ia(e,t){let r="";for(;Oa(e.peek());)r+=e.advance();return re("ident",r,t)}function Ga(e){return e==="\r"||e===`
4
+ `}function Da(e,t){return e.advance()==="\r"&&e.peek()===`
5
+ `&&e.advance(),re("newline",`
6
+ `,t)}function _a(e){return e.peek()==="/"&&e.peek(1)==="/"}function Fa(e){for(;!e.done&&e.peek()!==`
7
+ `&&e.peek()!=="\r";)e.advance()}function Ha(e){let t=e.peek();return dt(t)||t==="-"&&dt(e.peek(1))}function Va(e,t){let r="";for(e.peek()==="-"&&(r+=e.advance());dt(e.peek());)r+=e.advance();if(e.peek()==="."&&dt(e.peek(1)))for(r+=e.advance();dt(e.peek());)r+=e.advance();return re("number",r,t,{numberValue:Number(r)})}var Mf=[["<->","bind2"],["<-","bind"],["->","action"],["&&","op"],["||","op"],[">=","op"],["<=","op"],["==","op"],["!=","op"],["+","op"],["-","op"],["*","op"],["/","op"],[">","op"],["<","op"],["!","op"]],Af=e=>e!==void 0&&/[\d.]/.test(e);function Wa(e,t){let r=Mf.find(([i])=>e.startsWith(i));if(!r)return null;let[n,o]=r;if(n==="-"&&Af(e.peek(1)))return null;for(let i=0;i<n.length;i++)e.advance();return re(o,n,t)}var Ef={"{":"lbrace","}":"rbrace","[":"lbracket","]":"rbracket","(":"lparen",")":"rparen",":":"colon",",":"comma",";":"semi",".":"dot","&":"amp"};function za(e,t){let r=e.peek(),n=r?Ef[r]:void 0;return!r||!n||r==="&"&&e.peek(1)==="&"?null:(e.advance(),re(n,r,t))}function Ya(e){return e===" "||e===" "}function Ua(e){e.advance()}function Nf(e){let t=0;for(;e[t]===" "||e[t]===" ";)t++;return t}function Of(e){let t=e.split(`
8
+ `),r=1/0;for(let n of t)n.trim()&&(r=Math.min(r,Nf(n)));return!Number.isFinite(r)||r===0?e:t.map(n=>n.trim()?n.slice(r):n).join(`
9
+ `)}function Bf(e,t){ja(e);let r="";for(;!e.done;){if(e.startsWith('"""'))return ja(e),Of(r.replace(/^\r?\n/,"").replace(/\r?\n[ \t]*$/,""));r+=e.advance()}throw new ye("unterminated long string",t.line,t.col)}function ja(e){e.advance(),e.advance(),e.advance()}function If(e,t){e.advance();let r="";for(;!e.done;){let n=e.advance();if(n==='"')return r;if(n===`
10
+ `||n==="\r")throw new ye('newline in short string (use """ for multiline)',t.line,t.col);r+=n==="\\"?Gf(e,t):n}throw new ye("unterminated string",t.line,t.col)}function Gf(e,t){if(e.done)throw new ye("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 ye(`invalid escape '\\${r}'`,t.line,t.col)}}function Df(e,t){return e.startsWith('"""')?Bf(e,t):If(e,t)}function Xa(e,t){return re("string",Df(e,t),t)}function qa(e){let t=e.peek();if(t===void 0)return null;let r=e.position();if(Ga(t))return Da(e,r);if(_f(e,t))return null;let n=Ff(e,t,r)??Hf(e,r);if(n)return n;throw new ye(`unexpected character '${t}'`,r.line,r.col)}function _f(e,t){return Ya(t)?(Ua(e),!0):_a(e)?(Fa(e),!0):!1}function Ff(e,t,r){let n=za(e,r);return n||(t==='"'?Xa(e,r):Wa(e,r))}function Hf(e,t){return Ha(e)?Va(e,t):Ba(e)?Ia(e,t):null}function Ka(e){let t=new $r(e),r=[];for(;!t.done;){let n=qa(t);n&&r.push(po(n,t))}return r.push(po(re("eof","",t.position()),t)),r}var F=class extends Error{constructor(r,n,o){super(`SFL parse error (${n}:${o}): ${r}`);this.line=n;this.col=o;this.name="SflParseError"}line;col};var Mr=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 n=this.peek();if(n.type!==t)throw new F(`expected ${r}, got '${n.value||n.type}'`,n.line,n.col);return this.next()}expectNumber(t){let r=this.expect("number",t);if(r.numberValue===void 0)throw new F(`expected ${t} to contain a numeric value`,r.line,r.col);return r.numberValue}skipNewlines(){for(;this.at("newline");)this.next()}};function Yt(e){let t=[e.expect("ident","path identifier").value];for(;e.at("dot");)e.next(),t.push(e.expect("ident",'identifier after "."').value);return t}function Za(e){let t=Yt(e),r,n;if(e.at("comma")){e.next();let o=e.expect("ident",'side after ","');if(!Ea(o.value))throw new F(`expected a side (top/right/bottom/left), got '${o.value}'`,o.line,o.col);r=o.value,e.at("lparen")&&(e.next(),n=e.expectNumber('fraction inside "("'),e.expect("rparen","')'"))}return{type:"endpoint",segments:t,side:r,fraction:n}}function Vf(e){e.expect("lbracket","'['");let t=[];if(e.skipNewlines(),!e.at("rbracket"))for(t.push(Ar(e,!1)),e.skipNewlines();e.at("comma")&&(e.next(),e.skipNewlines(),!e.at("rbracket"));)t.push(Ar(e,!1)),e.skipNewlines();return e.expect("rbracket","']'"),{type:"list",values:t}}function Ar(e,t=!0){let r=e.peek();switch(r.type){case"string":return e.next(),{type:"string",value:r.value};case"lbracket":return Vf(e);case"number":{let n=e.expectNumber("number");if(!t||!e.at("comma"))return{type:"number",value:n};let o=[n];for(;e.at("comma");)e.next(),o.push(e.expectNumber("number in tuple"));return{type:"tuple",values:o}}case"ident":return{type:"ident",segments:Yt(e)};default:throw new F(`expected a value, got '${r.value||r.type}'`,r.line,r.col)}}var Wf=new Set([">","<",">=","<=","==","!="]);function zf(e,t){let r=e.peek();return r.type==="op"&&t.has(r.value)}function Ut(e,t,r){let n=r(e);for(;zf(e,t);)n={kind:"binary",operator:e.next().value,left:n,right:r(e)};return n}var Yf=new Set(["||"]),Uf=new Set(["&&"]),jf=new Set(["+","-"]),Xf=new Set(["*","/"]);function Er(e){return Ut(e,Yf,qf)}function qf(e){return Ut(e,Uf,Kf)}function Kf(e){return Ut(e,Wf,Zf)}function Zf(e){return Ut(e,jf,Qf)}function Qf(e){return Ut(e,Xf,es)}function es(e){let t=e.peek();return t.type==="op"&&(t.value==="!"||t.value==="-")?(e.next(),{kind:"unary",operator:t.value,operand:es(e)}):eh(e)}function Jf(e){e.expect("lparen","'('");let t=[];for(e.skipNewlines();!e.at("rparen");)if(t.push(Er(e)),e.skipNewlines(),e.at("comma"))e.next(),e.skipNewlines();else if(!e.at("rparen")){let r=e.peek();throw new F(`expected ',' or ')', got '${r.value||r.type}'`,r.line,r.col)}return e.expect("rparen","')'"),t}function eh(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=Er(e);return e.expect("rparen","')'"),r}case"ident":{let r=Yt(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:Jf(e)}:{kind:"ref",path:r}}default:throw new F(`expected an expression, got '${t.value||t.type}'`,t.line,t.col)}}var th=["bind","bind2","action"];function Nr(e){return e.peek().type==="ident"&&e.peek(1).type==="colon"&&th.includes(e.peek(2).type)}function Or(e){let t=e.expect("ident","bound property");e.expect("colon","':'");let r=e.next().value,n=Er(e),o=e.peek();if(!["newline","semi","rbrace","eof"].includes(o.type))throw new F(`unexpected '${o.value||o.type}' after binding`,o.line,o.col);return{key:t.value,operator:r,expr:n,line:t.line,col:t.col}}function Qa(e){let t=e.peek(),r=Yt(e);e.expect("bind","'<-'");let n=Er(e);return{target:r,expr:n,line:t.line,col:t.col}}function ts(e){let t=e.peek();return t.type==="ident"&&/^on[A-Z]/.test(t.value)&&["colon","lbrace"].includes(e.peek(1).type)}function rs(e){let t=e.expect("ident","event name"),r=[];if(e.at("colon"))e.next(),r.push(Qa(e)),Ja(e,"handler");else{for(e.expect("lbrace","'{'"),e.skipNewlines();!e.at("rbrace");){if(e.at("eof"))throw new F(`unterminated handler '${t.value}'`,t.line,t.col);r.push(Qa(e)),Ja(e,"assignment"),e.skipNewlines()}e.expect("rbrace","'}'")}return{event:t.value,assignments:r,line:t.line,col:t.col}}function Ja(e,t){let r=e.peek();if(!["newline","semi","rbrace","eof"].includes(r.type))throw new F(`unexpected '${r.value||r.type}' after ${t}`,r.line,r.col);r.type==="semi"&&e.next()}var Br=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 n=this.cursor.peek();throw new F("unterminated style block",n.line,n.col)}Nr(this.cursor)?(r.push(Or(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"?Za(this.cursor):Ar(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 n=this.cursor.peek();throw new F(`unterminated ${t} block`,n.line,n.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 F(`unexpected '${t.value||t.type}' after property value`,t.line,t.col)}};var Ir=class{constructor(t){this.cursor=t;this.properties=new Br(t)}cursor;properties;parseBlock(){let t=this.cursor.expect("ident","block kind");if(!Tr(t.value))throw new F(`unknown block kind '${t.value}'`,t.line,t.col);let r=this.cursor.expect("ident","block name"),n=this.parseComposition(),o=this.parseBlockEntries();return{kind:t.value,name:r.value,composition:n,entries:o}}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 n=this.cursor.peek();throw new F('unterminated block (missing "}")',n.line,n.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 F(`expected property, block, layout, or style \u2014 got '${t.value||t.type}'`,t.line,t.col);return Tr(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()}:Nr(this.cursor)?{type:"binding",binding:Or(this.cursor)}:ts(this.cursor)?{type:"handler",handler:rs(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"&&!Tr(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(),n=this.parseBlockEntries();return{kind:"Series",name:t.value,composition:r,entries:n}}};var Gr=class{constructor(t){this.cursor=t;this.blocks=new Ir(t)}cursor;blocks;parseDocument(){this.cursor.skipNewlines();let t=this.cursor.expect("ident","'sfl' header");if(t.value!=="sfl")throw new F(`document must start with 'sfl', got '${t.value}'`,t.line,t.col);let r=this.cursor.expect("number","version number");this.cursor.skipNewlines();let n=[];for(;!this.cursor.at("eof");)n.push(this.blocks.parseBlock()),this.cursor.skipNewlines();return{version:r.value,blocks:n}}};function fo(e){return new Gr(new Mr(Ka(e))).parseDocument()}function S(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 R(e){return e?.type==="number"?e.value:void 0}function Le(e){return e?.type==="tuple"?e.values:void 0}function ns(e){return e?.type==="list"?e.values.flatMap(t=>t.type==="number"?[t.value]:[]):void 0}function rh(e,t){if(e.length<2)return null;let r=e[e.length-1],n=e[e.length-2],o=t.idByName.get(n);return(o?t.canvasObjectById.get(o):void 0)?.symbol?.ports?.some(a=>a.name===r)?{id:o,port:r}:null}function ct(e,t){if(e?.type!=="endpoint")return{};let r=rh(e.segments,t);if(r)return r;let n=e.segments[e.segments.length-1];return{id:t.idByName.get(n)??n,side:e.side,fraction:e.fraction}}function G(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 Dr(e){let t=new Map;for(let r of e.entries)if(r.type==="style")for(let n of r.style.properties)t.set(n.key,n.value);return t}function os(e){let t=new Map;for(let r of e.entries)if(r.type==="layout")for(let n of r.layout.properties)t.set(n.key,n.value);return t}function W(e){return e.entries.flatMap(t=>t.type==="block"?[t.block]:[])}function is(e){for(let t of e.entries)if(t.type==="data")return t.data}function ut(e){let t=is(e);return t?[...W(e),...W(t)]:W(e)}function as(e,t){let r=G(e).get(t);if(r!==void 0)return r;let n=is(e);return n?G(n).get(t):void 0}var nh=["Entity","Shape","Text","Container","Path","Chart","Widget","Component","Isometric"],oh=new Set(nh);function mt(e){return oh.has(e)}function ss(e,t){for(let r of e)mt(r.kind)&&t.set(r.name,S(G(r).get("id"))??r.name),ss(W(r),t)}function _r(e){let t=new Map;return e&&ss(W(e),t),t}var ih=new Set(["id","from","to","text","order","segments"]);function Fr(e){let t={};for(let[r,n]of e){if(ih.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}var ah=new Set(["top","bottom","front","back","left","right"]);function ls(e){return e!==void 0&&ah.has(e)?e:"front"}function ds(e,t,r,n,o=[]){let i={idByName:_r(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>{let l=n.mergedProps(a);return{id:S(l.get("id"))??a.name,fromId:ct(l.get("from"),i).id,toId:ct(l.get("to"),i).id,fromFace:ls(S(l.get("fromFace"))),toFace:ls(S(l.get("toFace"))),order:R(l.get("order")),sourceIndex:o[s],props:Fr(l)}})}function cs(e,t,r){let n=t.mergedProps(e),o=ct(n.get("from"),r),i=ct(n.get("to"),r);return{id:S(n.get("id"))??e.name,fromId:o.id,toId:i.id,text:S(n.get("text")),fromSide:o.side,fromFraction:o.fraction,toSide:i.side,toFraction:i.fraction,fromPort:o.port,toPort:i.port,order:R(n.get("order")),segments:ns(n.get("segments")),props:Fr(n)}}function us(e,t,r,n,o=[]){let i={idByName:_r(e),canvasObjectById:new Map(r.map(a=>[a.id,a]))};return t.map((a,s)=>({...cs(a,n,i),sourceIndex:o[s]}))}function sh(e,t){let r=t.mergedProps(e).get("members");return r?.type==="list"?r.values.flatMap(n=>n.type==="ident"?[n.segments]:[]):[]}function lh(e,t,r,n,o){let i=[{type:"property",property:{key:"from",value:{type:"endpoint",segments:t}}},{type:"property",property:{key:"to",value:{type:"endpoint",segments:r}}}];return o&&i.push({type:"property",property:{key:"text",value:{type:"string",value:o}}}),{kind:"Link",name:`${e.name}_${n+1}`,composition:[],entries:i}}function ms(e,t){let r=sh(e,t);if(r.length<2)return[];let n=S(t.mergedProps(e).get("text"));return r.slice(1).map((o,i)=>lh(e,r[0],o,i,n))}function ps(e,t){let r=S(t.layoutProp(e,"flow")),n=R(t.layoutProp(e,"gap"))??0,o=0;return i=>{if(r!=="horizontal"&&r!=="vertical")return;let a=r==="horizontal"?[o,0]:[0,o];return o+=(r==="horizontal"?i[0]:i[1])+n,a}}var Hr=["bar","line","scatter","radar","radial","field","heatmap","boxplot","sankey","treemap","mekko","hexbin","pie","radialBar","polarArea","custom"];function pt(e){return e!==void 0&&Hr.includes(e)}function Te(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{let n=R(r);return n===void 0?[]:[n]});return t.length>0?t:void 0}function fs(e){if(e?.type==="list")return e.values.flatMap(t=>{let r=S(t);return r===void 0?[]:[r]})}function xe(e){let t=S(e);if(t!==void 0)return t==="true"}function ho(e){let t=e?G(e):new Map;return{min:R(t.get("min"))??0,max:R(t.get("max"))??10,step:R(t.get("step"))??1,label:S(t.get("label")),unit:S(t.get("unit")),thresholds:Te(t.get("thresholds"))}}function hs(e){return ut(e).filter(t=>t.kind==="Rule").map(t=>{let r=G(t);return{id:t.name,at:R(r.get("at"))??0,text:S(r.get("text")),color:S(r.get("color")),strokeWidth:R(r.get("strokeWidth")),dash:Te(r.get("dash"))}})}function gs(e){if(e.type!=="list"||e.values.length<2)return;let t=e.values.map(R);return t.every(r=>r!==void 0)?t:void 0}function bs(e){return e?.type!=="list"?[]:dh(e.values)==="tuple"?uh(e.values):ch(e.values)}function dh(e){for(let t of e){if(t.type==="number")return"scalar";if(gs(t))return"tuple"}}function ch(e){return e.flatMap(t=>t.type==="number"?[t.value]:[])}function uh(e){return e.flatMap(t=>{let r=gs(t);return r?[r]:[]})}function ys(e){if(e?.type==="list")return e.values.map(mh)}function mh(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:e.type==="number"?e.value:ph(e)}function ph(e){if(e.type!=="list"||e.values.length<2)return null;let t=R(e.values[0]),r=R(e.values[1]);return t!==void 0&&r!==void 0?[t,r]:null}function xs(e){if(e?.type==="list")return e.values.map(fh)}function fh(e){return e.type==="ident"&&e.segments.join(".")==="none"?null:S(e)??null}function Ss(e,t){if(e?.type==="list"){let o=e.values.flatMap(hh);return o.length>0?{points:o}:void 0}let r=S(e),n=r?t.get(r):void 0;if(n)return{points:n.points,normalized:!0,tension:n.tension}}function hh(e){if(e.type!=="list"||e.values.length<2)return[];let t=R(e.values[0]),r=R(e.values[1]);return t===void 0||r===void 0?[]:[[t,r]]}function Cs(e,t,r){let n=r(e);return{id:e.name,label:S(n.get("label"))??e.name,color:S(n.get("color")),colors:xs(n.get("colors")),opacity:R(n.get("opacity")),group:S(n.get("group")),values:bs(n.get("values")),error:ys(n.get("error")),source:S(n.get("source")),target:S(n.get("target")),size:R(n.get("size")),symbol:Ss(n.get("symbol"),t),stroke:S(n.get("stroke")),strokeWidth:R(n.get("strokeWidth")),dash:Te(n.get("dash")),offset:R(n.get("offset")),labelOffsetX:R(n.get("labelOffsetX")),labelOffsetY:R(n.get("labelOffsetY"))}}function Rs(e){if(e?.type!=="list")return;let t=e.values.flatMap(r=>{if(r.type!=="list")return[];let n=S(r.values[0]);return n===void 0?[]:[{label:n,color:S(r.values[1]),offsetX:R(r.values[2]),offsetY:R(r.values[3])}]});return t.length>0?t:void 0}var gh=["none","true","percent","waterfall"];function bh(e){return pt(e)?e:"bar"}function yh(e){return gh.find(t=>t===e)}function ks(e,t,r,n){let o=ut(e),i=o.filter(s=>s.kind==="Axis"),a=S(t.get("stacked"));return{chartType:bh(S(t.get("type"))),categories:fs(as(e,"categories")),areaOpacity:R(t.get("areaOpacity")),stacked:yh(a),scale:S(t.get("scale")),interpolate:S(t.get("interpolate"))==="idw"?"idw":void 0,idwPower:R(t.get("idwPower")),isolines:Te(t.get("isolines")),zones:Rs(t.get("zones")),boxWidth:R(t.get("boxWidth")),orientation:S(t.get("orientation"))==="horizontal"?"horizontal":void 0,lineTension:R(t.get("lineTension")),highlightPoints:Te(t.get("highlightPoints")),barCornerRadius:R(t.get("barCornerRadius")),showBoxplotPoints:xe(t.get("showBoxplotPoints")),barBorderColor:S(t.get("barBorderColor")),barBorderWidth:R(t.get("barBorderWidth")),barGroupGap:R(t.get("barGroupGap")),barGlow:R(t.get("barGlow")),barGap:R(t.get("barGap")),mekkoVaryHeight:xe(t.get("mekkoVaryHeight")),hexRadius:R(t.get("hexRadius")),innerRadius:R(t.get("innerRadius")),pieCornerRadius:R(t.get("pieCornerRadius")),pieSliceGap:R(t.get("pieSliceGap")),ringThickness:R(t.get("ringThickness")),ringGap:R(t.get("ringGap")),cellGap:R(t.get("cellGap")),showValues:xe(t.get("showValues")),squareCells:xe(t.get("squareCells")),headerColor:S(t.get("headerColor")),tileGradient:xe(t.get("tileGradient")),showColumnBackdrop:xe(t.get("showColumnBackdrop")),labelPosition:S(t.get("labelPosition"))==="inside"?"inside":void 0,labelOrientation:S(t.get("labelOrientation"))==="vertical"?"vertical":void 0,labelColor:S(t.get("labelColor")),linkGradient:xe(t.get("linkGradient")),connectPoints:xe(t.get("connectPoints")),reverseComparison:xe(t.get("reverseComparison")),axisX:ho(i.find(s=>s.name==="x")),axisY:ho(i.find(s=>s.name==="y"||s.name==="value")),series:o.filter(s=>s.kind==="Series").map(s=>Cs(s,r,n)),rules:hs(e)}}function ws(e,t,r,n,o){return{...e,objectType:"chart",chart:ks(t,r,n,o)}}function vs(e,t){return{depth:t,icon:S(e.get("icon"))}}function Ps(e,t,r,n){let o=Le(n(t,"size"));return{...e,objectType:"isometric",isometric:vs(r,o?.[2]??24)}}function Ls(e,t){let r=e.get("points");return{points:r?.type==="list"?r.values.flatMap(o=>{if(o.type!=="list"||o.values.length<2)return[];let i=R(o.values[0]),a=R(o.values[1]);return i!==void 0&&a!==void 0?[{x:t.x+i,y:t.y+a}]:[]}):[],tension:R(e.get("tension")),startMarker:S(e.get("startMarker")),endMarker:S(e.get("endMarker")),closed:S(e.get("closed"))==="true",value:R(e.get("value"))}}function Ts(e,t,r){return{...e,objectType:"path",path:Ls(t,r)}}function $s(e){let t=S(e.get("orientation"))==="vertical"?"vertical":"horizontal",r=e.get("lanes"),n=r?.type==="list"?r.values.flatMap((i,a)=>{if(i.type!=="list")return[];let s=S(i.values[0]),l=R(i.values[1]);if(s===void 0||l===void 0)return[];let d=S(i.values[2]);return[{id:`lane-${a+1}`,label:s,size:l,...d?{color:d}:{}}]}):[];return{orientation:t,lanes:n}}function Ms(e,t){return{...e,objectType:"swimlane",swimlane:$s(t)}}function xh(e,t){return e.kind==="Path"?"path":e.kind==="Chart"?"chart":zt(e.kind)?S(t.get("type"))??"widget":e.kind==="Text"?"text":e.kind==="Isometric"?"isometric":S(t.get("kind"))??""}function Sh(e){return e==="frame"?"frame":e==="swimlane"?"swimlane":e==="path"?"path":e==="chart"?"chart":ze(e)?"component":e==="isometric"?"isometric":"shape"}function As(e,t,r){let n=xh(e,t),o=S(t.get("shape")),i=o?r.get(o):void 0;return{objectType:zt(e.kind)?"component":Sh(n),kind:n,shapeType:i?"symbol":o,symbol:i}}function Es(e,t,r,n){let o=n??Le(r(e,"position"))??[0,0],i=Le(r(e,"size"))??[0,0];return{x:t.x+(o[0]??0),y:t.y+(o[1]??0),width:i[0]??0,height:i[1]??0,rotation:R(r(e,"rotation")),order:R(r(e,"order"))}}var Ch=new Set(["id","kind","text","shape","parent","order","orientation","lanes"]);function Ns(e){let t={};for(let[r,n]of e){if(Ch.has(r))continue;let o=S(n);o!==void 0&&(t[r]=o)}return t}function Os(e,t,r,n,o){let{mergedProps:i,layoutProp:a,symbolDefs:s}=r,l=i(e),d=As(e,l,s),c=Es(e,t,a,o),u={id:S(l.get("id"))??e.name,kind:d.kind,text:S(l.get("text")),...c,parentFrameId:n??S(l.get("parent")),props:Ns(l)};switch(d.objectType){case"chart":return ws(u,e,l,s,i);case"isometric":return Ps(u,e,l,a);case"path":return Ts(u,l,t);case"swimlane":return Ms(u,l);case"frame":return{...u,objectType:"frame"};case"component":return{...u,objectType:"component",component:{type:S(l.get("type"))??"rollingNumber",value:S(l.get("value"))??"0",digits:R(l.get("digits")),duration:R(l.get("duration")),min:R(l.get("min")),max:R(l.get("max")),label:S(l.get("label"))}};case"shape":return{...u,objectType:"shape",shapeType:d.shapeType,symbol:d.symbol}}}function Bs(e){return W(e).filter(t=>mt(t.kind)).map(t=>S(G(t).get("id"))??t.name)}var go=class{#e;#n=[];#t=[];#r=[];#o=[];#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.#n,groups:r,linkBlocks:this.#t,connectionBlocks:this.#r,linkSourceIndexes:this.#o,connectionSourceIndexes:this.#i}}#a(t,r){let n=[],o=ps(t,this.#e);for(let i of W(t))n.push(...this.#l(i,r,o));return n}#l(t,r,n){let o=this.#s++;if(t.kind==="Container")return this.#c(t,r,n,o);if(mt(t.kind))return this.#u(t,r,n,o),[];switch(t.kind){case"Group":return[this.#m(t,r)];case"Link":return this.#t.push(t),this.#o.push(o),[];case"Connection":return this.#r.push(t),this.#i.push(o),[];case"Net":{let i=ms(t,this.#e);return this.#t.push(...i),this.#o.push(...i.map(()=>o)),[]}default:return[]}}#c(t,r,n,o){let i=this.#d(t,r,n,o);return this.#n.push(i),this.#a(t,{origin:{x:i.x,y:i.y},frameId:i.id})}#u(t,r,n,o){this.#n.push(this.#d(t,r,n,o))}#d(t,r,n,o){let i=Le(this.#e.layoutProp(t,"size"))??[0,0];return{...Os(t,r.origin,this.#e,r.frameId,n(i)),sourceIndex:o}}#m(t,r){let n=this.#e.mergedProps(t);return{id:S(n.get("id"))??t.name,name:S(n.get("text"))??t.name,color:S(n.get("color")),icon:S(n.get("icon")),canvasObjectIds:Bs(t),subGroups:this.#a(t,r),parentFrameId:r.frameId??S(n.get("parent"))}}};function Is(e,t){return new go(t).resolve(e)}function Gs(e){let t=G(e),r=S(t.get("program"));if(!r)return;let n={};for(let[o,i]of t){if(o==="program")continue;let a=R(i),s=S(i);a!==void 0?n[o]=a:s!==void 0&&(n[o]=s==="true"?!0:s==="false"?!1:s)}return{name:e.name,program:r,parameters:n}}function Rh(e){let t=G(e).get("points");return t?.type!=="list"?[]:t.values.flatMap(r=>{if(r.type!=="list"||r.values.length<2)return[];let n=R(r.values[0]),o=R(r.values[1]);return n===void 0||o===void 0?[]:[[n,o]]})}function kh(e){let t=W(e).filter(r=>r.kind==="Port").flatMap(r=>{let n=Le(G(r).get("at"));return typeof n?.[0]!="number"||typeof n[1]!="number"?[]:[{name:r.name,at:[n[0],n[1]]}]});return t.length>0?t:void 0}function Ds(e){let t=Rh(e);if(!(t.length<2))return{name:e.name,points:t,tension:R(G(e).get("tension")),ports:kh(e)}}function wh(e){return W(e).find(t=>t.kind==="Model")}function _s(e){return{styles:Ph(e),layouts:Lh(e),symbols:Th(e),shaders:vh(e),model:$h(e)}}function vh(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Shader")continue;let n=Gs(r);n&&t.set(r.name,n)}return t}function Ph(e){let t=new Map;for(let r of e.blocks)r.kind==="Style"&&t.set(r.name,r);return t}function Lh(e){let t=new Map;for(let r of e.blocks)r.kind==="Layout"&&t.set(r.name,r);return t}function Th(e){let t=new Map;for(let r of e.blocks){if(r.kind!=="Symbol")continue;let n=Ds(r);n&&t.set(r.name,n)}return t}function $h(e){for(let t of e.blocks){if(t.kind==="Model")return t;if(t.kind==="Project"){let r=wh(t);if(r)return r}}}function Fs(e,t,r){let n,o;for(let i of e)t.has(i)?n=i:r.has(i)&&(o=i);return{styleRef:n,layoutRef:o}}function Hs(e,t,r,n){for(let o of e.composition)!t.has(o)&&!r.has(o)&&n.push({severity:"warning",code:"unresolved-style-or-layout",ownerId:e.name,message:`"${o}" is not a Style or Layout defined at the top level of the document \xC3\xA2\xE2\u201A\xAC\xE2\u20AC\x9D "${e.name}" gets no shape, fill, or stroke from it.`});for(let o of W(e))Hs(o,t,r,n)}function Vs(e,t,r){let n=[];for(let o of e.blocks)Hs(o,t,r,n);return n}function yo(e,t){return new bo(e,t).resolveAll()}var bo=class{#e;#n;#t=new Map;constructor(t,r){this.#e=t,this.#n=r}resolveAll(){for(let t of this.#e.keys())this.#r(t,new Set);return this.#t}#r(t,r){let n=this.#t.get(t);if(n)return n;let o=this.#e.get(t);if(!o||r.has(t))return new Map;let i=this.#o(o,new Set([...r,t]));for(let[a,s]of G(o))i.set(a,s);return this.#t.set(t,i),i}#o(t,r){let n=this.#n(t);return n?new Map(this.#r(n,r)):new Map}};function Ws(e){let{styles:t,layouts:r,symbols:n,shaders:o}=e,i=c=>Fs(c.composition,t,r),a=yo(t,c=>i(c).styleRef),s=yo(r,c=>i(c).layoutRef);return{mergedProps:c=>{let u=new Map(a.get(i(c).styleRef??"")??[]);for(let[p,f]of G(c))u.set(p,f);for(let[p,f]of Dr(c))u.set(p,f);return u},layoutProp:(c,u)=>{let p=os(c);if(p.has(u))return p.get(u);let f=i(c).layoutRef;return f?s.get(f)?.get(u):void 0},symbolDefs:n,shaderDefs:o}}var Mh=new Set(["radar","radial"]),zs=new Set(["scatter","custom","hexbin"]);function Ys(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(G(n).get("type"));o!==void 0&&!pt(o)&&t.push({severity:"warning",code:"unsupported-chart-type",ownerId:n.name,message:`Unsupported chart type '${o}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn as a plain series plot. Supported: ${Hr.join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function Us(e){let t=[],r=n=>{if(n.kind==="Chart")for(let o of ut(n).filter(i=>i.kind==="Series"))G(o).has("values")||t.push({severity:"warning",code:"series-without-values",ownerId:o.name,message:`Series '${o.name}' has no values. If this was meant to be an Axis or Rule, it needs that keyword in front of the name \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D inside data{}, a bare name is read as a Series.`});for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function js(e){let t=[],r=n=>{if(n.kind==="Chart"){let o=S(G(n).get("type")),i=pt(o)?o:"bar";S(Dr(n).get("gridShape"))==="circle"&&!zs.has(i)&&!Mh.has(i)&&t.push({severity:"warning",code:"unsupported-grid-shape",ownerId:n.name,message:`gridShape: circle isn't supported on '${i}' \xC3\u0192\xC2\xA2\xC3\xA2\xE2\u20AC\u0161\xC2\xAC\xC3\xA2\xE2\u201A\xAC\xC2\x9D drawn with the standard rectangular grid instead. Supported: ${[...zs].join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function Xs(e){let t=[],r=n=>{if(zt(n.kind)){let o=S(G(n).get("type"))??"rollingNumber";uo(o)||t.push({severity:"warning",code:"unsupported-component-type",ownerId:n.name,message:`Unsupported component type '${o}'. Supported: ${co().join(", ")}.`})}for(let o of W(n))r(o)};for(let n of e.blocks)r(n);return t}function qs(e){let t=_s(e);return{model:t.model,diagnostics:[...Vs(e,t.styles,t.layouts),...Ys(e),...js(e),...Us(e),...Xs(e)],canvasObjectResolutionContext:Ws(t)}}function Ks(e){let t=qs(e),{canvasObjects:r,groups:n,linkBlocks:o,connectionBlocks:i,linkSourceIndexes:a,connectionSourceIndexes:s}=Is(t.model,t),l=us(t.model,o,r,t.canvasObjectResolutionContext,a),d=ds(t.model,i,r,t.canvasObjectResolutionContext,s);return{canvasObjects:r,groups:n,links:l,connections:d,diagnostics:t.diagnostics,shaders:[...t.canvasObjectResolutionContext.shaderDefs.values()]}}function jt(e){return e.objectType==="isometric"&&e.isometric!==void 0}function Zs(e){return Ks(fo(e))}var Xt=String.raw`rgba?\([^)]*\)|#[0-9a-fA-F]+|[a-zA-Z][\w-]*`;function Oh(e){let t=e.match(/^gradient\(\s*([-\d.]+)\s*,\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Xt})\\s+([-\\d.]+)%`,"g");for(let o of t[2].matchAll(n))r.push({color:o[1],position:Number(o[2])});return{type:"gradient",angle:Number(t[1]),stops:r}}function Bh(e){let t=e.match(/^mesh\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Xt})\\s+([-\\d.]+)\\s*,\\s*([-\\d.]+)`,"g"),o=0;for(let i of t[1].matchAll(n))r.push({id:`mp-${Date.now()}-${o++}`,color:i[1],x:Number(i[2]),y:Number(i[3])});return{type:"mesh",points:r}}function ae(e){if(!(e==null||e===""))return Oh(e)??Bh(e)??e}function Vr(e){if(!e)return;let t=e.match(/^ramp\(\s*(.*)\)\s*$/);if(!t)return;let r=[],n=new RegExp(`(${Xt})\\s+([-\\d.]+)`,"g");for(let o of t[1].matchAll(n))r.push({color:o[1],position:Number(o[2])});return{type:"ramp",stops:r}}function Ih(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 pe(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 n of t[1].split(",")){let o=n.split(":");o.length===2&&Ih(r,o[0].trim(),o[1].trim())}return r}var y=e=>e===void 0?void 0:Number(e);function Gh(e){try{return JSON.parse(e)}catch{return}}function Be(e){if(e===void 0)return;let t=Gh(e);if(!Array.isArray(t))return;let r=t.filter(n=>typeof n=="number"&&Number.isFinite(n));return r.length===t.length?r:void 0}function $e(e){let t=ae(e);return typeof t=="string"?t:void 0}var Dh=/^(?:#[0-9a-f]{3,8}|rgba?\([\d.,%\s]+\)|[a-z][\w-]*)$/i;function se(e){return e&&Dh.test(e)?e:void 0}function Se(e,t,r){return t.includes(e)?e:r}var Wr=["normal","bold"],Qs=["normal","bold","100","200","300","400","500","600","700","800","900"],Js=["top","bottom","left","right"],xo=["none","arrow","filled_arrow"];function ft(e){let t=ae(e);return t===void 0||typeof t=="string"||t.type==="gradient"?t:void 0}var el=["left","center","right"],tl=["top","middle","bottom"],zr=["solid","dashed","dotted"],Yr=["straight","curved","orthogonal"];function le(e,t){return e!==void 0&&t.includes(e)?e:void 0}var rl=["solid","dashed","dotted","double"],So=["none","arrow","filled_arrow","circle","filled_circle","diamond","filled_diamond","bar","triangle","one","zero_one","many","one_many","zero_many"];function _h(e){let t=e?.match(/^image\(\s*([^,)]+?)\s*(?:,\s*(.+?))?\s*\)$/);return t?{url:t[1],overlay:t[2]}:void 0}function Fh(e){return e==="bottom"||e==="bottomLeft"||e==="bottomRight"||e==="left"||e==="right"?e:"top"}function Hh(e){return e==="dashed"||e==="dotted"?e:"solid"}function Vh(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:ae(t.color),colors:t.colors?.map(r=>r===null?null:ae(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 Wh(e){let t=_h(e.fill);return{fillColor:t?"#111418":ae(e.fill)??"#ffffff",fillImage:t,strokeColor:$e(e.stroke)??"#475569",strokeWidth:y(e.strokeWidth)??1,cornerRadius:y(e.cornerRadius)??12,shadowStyle:pe(e.shadow)}}function zh(e){return{gridColor:e.gridColor??"#e2e8f0",gridWidth:y(e.gridWidth)??1,gridShape:e.gridShape==="circle"?"circle":"rect",gridLineStyle:Hh(e.gridLineStyle),gridRoundedCorners:e.gridRoundedCorners==="true",gridAxes:e.gridAxes==="x"||e.gridAxes==="y"?e.gridAxes:void 0,showGrid:e.showGrid!=="false"}}function Yh(e){return{axisLabelColor:e.axisLabelColor,axisLineWidth:y(e.axisLineWidth),axisLineColor:e.axisLineColor,axisLineStyle:e.axisLineStyle==="dashed"||e.axisLineStyle==="dotted"?e.axisLineStyle:void 0,tickLength:y(e.tickLength),axisFontSize:y(e.axisFontSize),axisFontFamily:e.axisFontFamily,showValueAxis:e.showValueAxis!=="false",categoryAlign:e.categoryAlign==="left"||e.categoryAlign==="inside"?e.categoryAlign:void 0,showAxisLabels:e.showAxisLabels!=="false"}}function Uh(e){return{textColor:e.textColor??"#0f172a",titleSize:y(e.titleSize),titleWeight:e.titleWeight==="normal"?"normal":void 0,titleColor:e.titleColor,fontSize:y(e.fontSize)??12,fontFamily:e.fontFamily??"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"}}function jh(e){return{legendColor:e.legendColor,showLegend:e.showLegend==="true",legendPosition:Fh(e.legendPosition)}}function nl(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,...Vh(e),...Wh(t),...zh(t),...Yh(t),...Uh(t),...jh(t),order:e.order,sourceIndex:e.sourceIndex}}function ol(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,barBorderColor:ae(e?.barBorderColor),barBorderWidth:e?.barBorderWidth,barGroupGap:e?.barGroupGap,barGap:e?.barGap,barGlow:e?.barGlow,barSegments:y(t.barSegments),barSegmentGap:y(t.barSegmentGap),barSegmentSnap:t.barSegmentSnap==="false"?!1:void 0,barGlassBlur:y(t.barGlassBlur),barGlassSaturation:y(t.barGlassSaturation),barGlassTint:t.barGlassTint,barThickness:y(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:y(t.barTrackHatchAngle),barTrackHatchSpacing:y(t.barTrackHatchSpacing),barTrackHatchWidth:y(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:y(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:y(t.barLabelBorderWidth),barLabelFormat:t.barLabelFormat}}function il(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,lineTension:e?.lineTension,lineWidth:y(t.lineWidth),lineGlow:y(t.lineGlow),pointSize:y(t.pointSize),pointFill:t.pointFill,pointStrokeWidth:y(t.pointStrokeWidth),highlightPoints:e?.highlightPoints,highlightSize:y(t.highlightSize),highlightColor:t.highlightColor,highlightGuide:t.highlightGuide==="true",highlightLabels:t.highlightLabels==="true",highlightLabelColor:t.highlightLabelColor,highlightLabelFormat:t.highlightLabelFormat}}function al(e,t){return{categories:e?.categories,pointSize:y(t.pointSize),pointOpacity:y(t.pointOpacity),pointStrokeWidth:y(t.pointStrokeWidth),pointStrokeColor:t.pointStrokeColor}}function sl(e,t){return{boxWidth:e?.boxWidth,orientation:e?.orientation,barCornerRadius:e?.barCornerRadius,showBoxplotPoints:e?.showBoxplotPoints,barBorderColor:e?.barBorderColor,barBorderWidth:e?.barBorderWidth,boxWhiskerWidth:y(t.boxWhiskerWidth),boxMedianWidth:y(t.boxMedianWidth),boxMedianColor:t.boxMedianColor,boxWhiskerColor:t.boxWhiskerColor,boxCapSize:y(t.boxCapSize),boxPointSize:y(t.boxPointSize),boxPointOpacity:y(t.boxPointOpacity),boxJitter:y(t.boxJitter)}}function ll(e){return{scale:Vr(e?.scale),interpolate:e?.interpolate,idwPower:e?.idwPower,isolines:e?.isolines}}function dl(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:y(t.cellStrokeWidth),cellValueSize:y(t.cellValueSize),cellValueColor:t.cellValueColor}}function cl(e,t){return{hexRadius:e?.hexRadius,scale:Vr(e?.scale),hexGap:y(t.hexGap),hexStrokeWidth:y(t.hexStrokeWidth),hexStrokeColor:t.hexStrokeColor,hexMinOpacity:y(t.hexMinOpacity)}}function ul(e,t){return{categories:e?.categories,barCornerRadius:e?.barCornerRadius,mekkoVaryHeight:e?.mekkoVaryHeight,tileGradient:e?.tileGradient,showColumnBackdrop:e?.showColumnBackdrop,mekkoColumnGap:y(t.mekkoColumnGap),mekkoSegmentGap:y(t.mekkoSegmentGap),mekkoRoundAll:t.mekkoRoundAll===void 0?void 0:String(t.mekkoRoundAll)!=="false",mekkoSegmentStrokeColor:t.mekkoSegmentStrokeColor,mekkoSegmentStrokeWidth:y(t.mekkoSegmentStrokeWidth),mekkoLabelSize:y(t.mekkoLabelSize),mekkoValueSize:y(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 ml(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:y(t.pieStartAngle),pieSweep:y(t.pieSweep),pieExplode:y(t.pieExplode),pieGlow:y(t.pieGlow),pieStroke:t.pieStroke,pieStrokeWidth:y(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:y(t.pieCenterSize),pieCenterColor:t.pieCenterColor}}function pl(e,t){return{innerRadius:e?.innerRadius,pieCornerRadius:e?.pieCornerRadius,pieSliceGap:e?.pieSliceGap,pieStartAngle:y(t.pieStartAngle),pieStroke:t.pieStroke,pieStrokeWidth:y(t.pieStrokeWidth),polarTrackOpacity:y(t.polarTrackOpacity),polarRings:t.polarRings===void 0?void 0:String(t.polarRings)!=="false",polarTrackStroke:t.polarTrackStroke,polarTrackStrokeWidth:y(t.polarTrackStrokeWidth),polarTrackDash:t.polarTrackDash,polarValueSize:y(t.polarValueSize),polarNameSize:y(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 fl(e){return{radarStrokeWidth:y(e.radarStrokeWidth),radarPointSize:y(e.radarPointSize),radarTension:y(e.radarTension),radarSpokes:e.radarSpokes===void 0?void 0:String(e.radarSpokes)!=="false"}}function hl(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...fl(t)}}function gl(e,t){return{categories:e?.categories,areaOpacity:e?.areaOpacity,...fl(t)}}function bl(e,t){return{ringThickness:e?.ringThickness,ringGap:e?.ringGap,ringTrackOpacity:y(t.ringTrackOpacity),ringCap:t.ringCap==="butt"?"butt":t.ringCap==="round"?"round":void 0,ringStartAngle:y(t.ringStartAngle),ringSweep:y(t.ringSweep)}}function yl(e,t){return{zones:e?.zones,barCornerRadius:e?.barCornerRadius,labelPosition:e?.labelPosition,labelOrientation:e?.labelOrientation,labelColor:e?.labelColor,linkGradient:e?.linkGradient,sankeyNodeWidth:y(t.sankeyNodeWidth),sankeyNodeGap:y(t.sankeyNodeGap),sankeyLinkOpacity:y(t.sankeyLinkOpacity),sankeyLinkCurve:y(t.sankeyLinkCurve),sankeyLabelSize:y(t.sankeyLabelSize)}}function xl(e,t){return{zones:e?.zones,cellGap:e?.cellGap,barCornerRadius:e?.barCornerRadius,headerColor:e?.headerColor,tileGradient:e?.tileGradient,tileStrokeColor:t.tileStrokeColor,tileStrokeWidth:y(t.tileStrokeWidth),tileLabelSize:y(t.tileLabelSize),tileValueSize:y(t.tileValueSize),tileTextColor:t.tileTextColor,tileLabelPadding:y(t.tileLabelPadding),showTileValues:t.showTileValues===void 0?void 0:String(t.showTileValues)!=="false",headerHeight:y(t.headerHeight)}}function Sl(e,t){return{categories:e?.categories,zones:e?.zones,orientation:e?.orientation,connectPoints:e?.connectPoints,reverseComparison:e?.reverseComparison,customConnectorWidth:y(t.customConnectorWidth),customConnectorOpacity:y(t.customConnectorOpacity),customConnectorDash:t.customConnectorDash,customBeforeFill:t.customBeforeFill,customBeforeStroke:t.customBeforeStroke,customBeforeStrokeWidth:y(t.customBeforeStrokeWidth),customLabelSize:y(t.customLabelSize),customLabelColor:t.customLabelColor}}function Cl(e){let t=nl(e),r=e.chart,n=e.props,o=r?.chartType??"bar";switch(o){case"bar":return K(t,o,ol(r,n));case"line":return K(t,o,il(r,n));case"scatter":return K(t,o,al(r,n));case"boxplot":return K(t,o,sl(r,n));case"field":return K(t,o,ll(r));case"heatmap":return K(t,o,dl(r,n));case"hexbin":return K(t,o,cl(r,n));case"mekko":return K(t,o,ul(r,n));case"pie":return K(t,o,ml(r,n));case"polarArea":return K(t,o,pl(r,n));case"radar":return K(t,o,hl(r,n));case"radial":return K(t,o,gl(r,n));case"radialBar":return K(t,o,bl(r,n));case"sankey":return K(t,o,yl(r,n));case"treemap":return K(t,o,xl(r,n));case"custom":return K(t,o,Sl(r,n))}}function K(e,t,r){return{...e,chartType:t,config:r}}function Xh(e,t){let r=Number(t);if(t===void 0||t===""||!Number.isFinite(r))return e.default;let n=e.min===void 0?r:Math.max(e.min,r);return e.max===void 0?n:Math.min(e.max,n)}function qh(e,t){switch(e.type){case"number":return Xh(e,t);case"boolean":return t===void 0?e.default:t==="true";case"color":return se(t)??e.default;case"enum":return t!==void 0&&e.options.includes(t)?t:e.default;case"string":return t??e.default}}function Kh(e,t){let r={};for(let[n,o]of Object.entries(e?.properties??{}))r[n]=qh(o,t[n]);return r}function Zh(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 Rl(e){let t=lt(e.component.type);return{id:e.id,type:e.component.type,value:t?Zh(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:Kh(t,e.props)}}var Qh=/^[\w\s,'"-]+$/;function Co(e){return e&&Qh.test(e)?e:void 0}var Jh=/^(?:[1-9]00|normal|bold)$/;function eg(e){return e==="plain"||e==="flip"?e:void 0}function tg(e){return e==="roll"||e==="fade"?e:void 0}function rg(e){let t=Number(e);return e!==void 0&&Number.isFinite(t)&&t>0?t:void 0}function Ro(e){return e&&Jh.test(e)?e:void 0}var ng=["ticks","major","radius","length","thickness","round","start","sweep","intensity"],og=["color","accent"];function ig(e){let t=e.props,r={};for(let n of ng){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of og){let o=se(t[n]);o&&(r[n]=o)}return{id:e.id,type:"tickScale",value:e.component.value,max:e.component.max,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:Ro(t.labelWeight),fontFamily:Co(t.labelFont)}:void 0}}var ag=["ticks","major","length","thickness","round","dent","spread","inset","line","gap","intensity"],sg=["color","accent","glow"],lg={color:"#8f95c4",accent:"#d9f270",glow:"#3ddc84"},dg=["core","peak"];function cg(e){let t=e.props,r={};for(let n of ag){let o=Number(t[n]);t[n]!==void 0&&Number.isFinite(o)&&(r[n]=o)}for(let n of sg)r[n]=se(t[n])??lg[n];for(let n of dg){let o=se(t[n]);o&&(r[n]=o)}return r.axis=t.axis==="horizontal"?"horizontal":"vertical",t.knob&&(r.knob=t.knob),{id:e.id,type:"ruler",value:e.component.value,min:e.component.min,max:e.component.max,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,parameters:r,labels:t.labels==="true"?{size:Number.isFinite(Number(t.labelSize))&&t.labelSize!==void 0?Number(t.labelSize):void 0,color:se(t.labelColor),offset:Number.isFinite(Number(t.labelOffset))&&t.labelOffset!==void 0?Number(t.labelOffset):void 0,weight:Ro(t.labelWeight),fontFamily:Co(t.labelFont)}:void 0}}function ug(e){let t=e.props;return{id:e.id,type:"rollingNumber",value:e.component.value,digits:e.component.digits,duration:e.component.duration,label:e.component.label,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,parentFrameId:e.parentFrameId,style:{color:se(t.color),surface:se(t.surface),divider:se(t.divider),labelColor:se(t.labelColor),fontFamily:Co(t.fontFamily),variant:eg(t.variant),motion:tg(t.motion),fontWeight:Ro(t.fontWeight),fontSize:rg(t.fontSize)}}}var mg={rollingNumber:ug,tickScale:ig,ruler:cg};function kl(e){let t=e.component.type;return ze(t)?mg[t](e):Rl(e)}function wl(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:le(t.route,Yr)??"straight",color:ft(t.stroke),strokeWidth:y(t.strokeWidth),strokeStyle:le(t.strokeStyle,zr),opacity:t.opacity!==void 0?y(t.opacity):void 0}}}function vl(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:y(t.strokeWidth)??2,cornerRadius:y(t.cornerRadius)??12,textColor:t.textColor??"#ffffff",fontSize:y(t.fontSize)??14,fontWeight:Se(t.fontWeight,Wr,"bold"),fontFamily:t.fontFamily,dash:Be(t.dash),showLabel:t.showLabel!=="false",labelPosition:Se(t.labelPosition,Js,"top"),shadow:t.shadow!=="false",order:e.order,sourceIndex:e.sourceIndex}}function Pl(e){let t=e.props,r=pe(t.shadow);return{id:e.id,x:e.x,y:e.y,width:e.width,height:e.height,depth:e.isometric.depth,rotation:e.rotation,order:e.order,sourceIndex:e.sourceIndex,text:e.text,icon:e.isometric.icon,fill:$e(t.fill)??"#f8fafc",strokeColor:$e(t.stroke)??"#111827",strokeWidth:y(t.strokeWidth)??1,cornerRadius:y(t.cornerRadius)??8,hasShadow:r?.enabled??!1,shadowStyle:r,labelOffsetX:y(t.labelOffsetX)??0,labelOffsetY:y(t.labelOffsetY)??0,labelBackground:$e(t.labelBackground),parentFrameId:e.parentFrameId}}function Ll(e){let t=e.props;return{id:e.id,fromId:e.fromId,toId:e.toId,text:e.text??"",showText:t.showText!=="false",weight:y(t.weight),showWeight:t.showWeight!=="false",style:{pathType:le(t.route,Yr),color:ft(t.stroke),strokeWidth:y(t.strokeWidth),strokeStyle:le(t.strokeStyle,zr),opacity:t.opacity!==void 0?y(t.opacity):void 0,fontSize:y(t.fontSize),fontFamily:t.fontFamily,startLabel:t.startLabel,endLabel:t.endLabel,shadow:pe(t.shadow)},startMarker:le(t.markerStart,So),endMarker:le(t.markerEnd,So),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 Tl(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:Se(e.path?.startMarker,xo,"none"),endMarker:Se(e.path?.endMarker,xo,"none"),closed:e.path?.closed??!1,strokeColor:$e(t.stroke)??"#7c3aed",strokeWidth:y(t.strokeWidth)??2,dash:Be(t.dash)??[],opacity:y(t.opacity)??1,fillColor:$e(t.fill)??"transparent",order:e.order,sourceIndex:e.sourceIndex}}function pg(e){return e||"rectangle"}function $l(e,t){let r=e.props,n=e.kind==="text";return{id:e.id,type:"shape",text:e.text??null,shapeType:pg(e.shapeType),symbol:e.symbol,x:e.x,y:e.y,width:e.width,height:e.height,w:e.width,h:e.height,rotation:e.rotation??0,fillColor:ae(r.fill??(n?"none":void 0)),strokeColor:ft(r.stroke??(n?"none":void 0)),isText:n||void 0,strokeWidth:y(r.strokeWidth),textColor:r.textColor,fontSize:y(r.fontSize),fontWeight:r.fontWeight===void 0?void 0:Se(r.fontWeight,Qs,"normal"),letterSpacing:y(r.letterSpacing),lineHeight:y(r.lineHeight),fontFamily:r.fontFamily,textAlign:le(r.textAlign,el),textVerticalAlign:le(r.verticalAlign,tl),cornerRadius:y(r.cornerRadius),shadowStyle:pe(r.shadow),dash:Be(r.dash),strokeStyle:le(r.strokeStyle,rl),opacity:y(r.opacity),parentFrameId:e.parentFrameId,order:e.order,sourceIndex:e.sourceIndex,shader:r.shader?t.get(r.shader):void 0}}function Ml(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:y(t.strokeWidth)??2,cornerRadius:y(t.cornerRadius)??12,dash:Be(t.dash),shadowStyle:pe(t.shadow),textColor:t.textColor??"#6b7280",fontSize:y(t.fontSize)??22,fontWeight:Se(t.fontWeight,Wr,"bold"),fontFamily:t.fontFamily,showLaneLabels:t.showLaneLabels!=="false",order:e.order,sourceIndex:e.sourceIndex}}var ko=e=>[...e].sort((t,r)=>(t.order??0)-(r.order??0));function Al(e){let t=ko(e.canvasObjects),r=new Map((e.shaders??[]).map(n=>[n.name,n]));return{shapes:t.filter(n=>n.objectType==="shape").map(n=>$l(n,r)),frames:t.filter(n=>n.objectType==="frame").map(vl),swimlanes:t.filter(n=>n.objectType==="swimlane").map(Ml),isometricObjects:t.filter(jt).map(Pl),paths:t.filter(n=>n.objectType==="path").map(Tl),charts:t.filter(n=>n.objectType==="chart").map(Cl),components:t.filter(n=>n.objectType==="component"&&n.component!==void 0).map(kl),links:ko(e.links).map(Ll),connections:ko(e.connections).map(wl)}}var Ur=new Set(["top","front","right"]),El=Math.PI/6,ht=Math.cos(El),qt=Math.sin(El);function wo(e){let t=Math.max(0,e.width),r=Math.max(0,e.height),n=Math.max(0,e.depth);return{x:e.x,y:e.y,width:(t+n)*ht,height:r+(t+n)*qt}}function vo(e){let t=Math.max(0,e.width),r=Math.max(0,e.depth);return{x:e.x+(t+r)*ht/2,y:e.y+(t+r)*qt/2}}function fg(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 Po(e,t){return fg(Ye(e)[t])}function Ye(e){let{x:t,y:r}=e,n=Math.max(0,e.width),o=Math.max(0,e.height),i=Math.max(0,e.depth),a={x:t+i*ht,y:r},s={x:n*ht,y:n*qt},l={x:-i*ht,y:i*qt},d={x:0,y:o},c={x:a.x+s.x,y:a.y+s.y},u={x:a.x+l.x,y:a.y+l.y},p={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},g={x:p.x+d.x,y:p.y+d.y},b={x:u.x+d.x,y:u.y+d.y},x={x:c.x+d.x,y:c.y+d.y};return{top:[a,c,p,u],bottom:[f,x,g,b],front:[u,p,g,b],back:[a,c,x,f],right:[p,c,x,g],left:[a,u,b,f]}}function hg(e){return Math.max(0,Math.min(255,Math.round(e)))}function gg(e){let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());if(!t)return null;let r=Number.parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function bg(e,t,r){return`#${[e,t,r].map(n=>hg(n).toString(16).padStart(2,"0")).join("")}`}function Nl(e,t){let r=gg(e);if(!r)return e;let[n,o,i]=r;return bg(n*t,o*t,i*t)}function Lo(e){return{topFill:e,frontFill:Nl(e,.95),sideFill:Nl(e,.88)}}var yg=Math.PI/180;function xg(e,t){let r=t*yg,n=Math.cos(r),o=Math.sin(r);return{x:e.x*n-e.y*o,y:e.x*o+e.y*n}}function Sg(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ol(e,t){let r=Sg(e),n=e.rotation?xg(t,e.rotation):t;return{x:r.x+n.x,y:r.y+n.y}}function To(e,t){return Ol(e,{x:(t[0]-.5)*e.width,y:(t[1]-.5)*e.height})}function gt(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function $o(e,t){let r=gt(e),n=gt(t),o=Math.atan2(n.y-r.y,n.x-r.x);return o>=-Math.PI/4&&o<Math.PI/4?{x:e.x+e.width,y:r.y}:o>=Math.PI/4&&o<3*Math.PI/4?{x:r.x,y:e.y+e.height}:o>=-3*Math.PI/4&&o<-Math.PI/4?{x:r.x,y:e.y}:{x:e.x,y:r.y}}function Cg(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 Rg(e,t){let r=e.symbol?.ports?.find(n=>n.name===t.port);return r?To({x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation??void 0},r.at):gt(e)}function Mo(e,t,r){let n=kg(e,t),o=wg(n.explicit);if(o)return o;let i=Bl(r,n.canvasObjectId);if(!i)return{x:0,y:0};let a=vg(i,n.explicit);return a||Pg(i,Bl(r,n.oppositeCanvasObjectId))}function kg(e,t){return t==="from"?{canvasObjectId:e.fromId,oppositeCanvasObjectId:e.toId,explicit:e.fromPoint}:{canvasObjectId:e.toId,oppositeCanvasObjectId:e.fromId,explicit:e.toPoint}}function wg(e){return e?.kind==="absolute"?{x:e.x,y:e.y}:null}function vg(e,t){return t?.kind==="port"?Rg(e,t):t?.kind==="side"?Cg(e,t):null}function Pg(e,t){return t?$o(e,t):gt(e)}function Bl(e,t){return e.find(r=>r.id===t)}var Lg=15e3;function Tg(e){return[...e.shapes,...e.frames,...e.swimlanes,...e.paths,...e.charts]}function Il(e,t){return e?Po(e,t):{x:0,y:0}}function Gl(e,t){let r=e.findIndex(o=>o.id===t);if(r<0)return;let n=e[r];return{rank:n.order??0,sequence:n.sourceIndex??Lg+r}}function $g(e,t){if(typeof t.order=="number")return{order:t.order,sourceIndex:t.sourceIndex};let r=[Ur.has(t.fromFace)?void 0:Gl(e,t.fromId),Ur.has(t.toFace)?void 0:Gl(e,t.toId)].filter(o=>o!==void 0);if(!r.length)return{sourceIndex:t.sourceIndex};let n=r.reduce((o,i)=>i.rank<o.rank||i.rank===o.rank&&i.sequence<o.sequence?i:o);return{order:n.rank,sourceIndex:n.sequence-.5}}function Mg(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,...$g(e.isometricObjects,r)},from:Il(t.get(r.fromId??""),r.fromFace),to:Il(t.get(r.toId??""),r.toFace),kind:"connection"}))}function Dl(e){let t=Tg(e);return[...e.links.map(n=>({link:n,from:Mo(n,"from",t),to:Mo(n,"to",t)})),...Mg(e)]}function Ao(e){let t=Zs(e),r=Al(t);return{shapes:r.shapes,frames:r.frames,swimlanes:r.swimlanes,isometricObjects:r.isometricObjects,paths:r.paths,charts:r.charts,components:r.components,links:Dl(r),diagnostics:t.diagnostics}}function Z(e,t,r,n,o,i){return e.forEach((a,s)=>{a.identity={role:t,id:r,...n?{kind:n}:{},...s===0?{primary:!0}:{},...s===0&&o?{label:o}:{},...s===0&&i?{parentFrameId:i}:{}}}),e}var Eo={minX:0,minY:0,maxX:100,maxY:100};function Q(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 B(e,t,r=0){return t?Ng(Ag(e,t),r):Q(e,r)}function Ag(e,t){let r=e.x+e.width/2,n=e.y+e.height/2,o=t*Math.PI/180,i=Math.cos(o),a=Math.sin(o);return Eg(e).map(s=>({x:r+(s.x-r)*i-(s.y-n)*a,y:n+(s.x-r)*a+(s.y-n)*i}))}function Eg(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 Ng(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 fe(e){return e.points.length===0?"":e.points.length<3||e.tension<=0?Og(e):Bg(e)}function Og(e){let[t,...r]=e.points,n=r.map(o=>`L ${o.x} ${o.y}`).join(" ");return`M ${t.x} ${t.y} ${n}${e.closed?" Z":""}`}function Bg(e){let t=e.points[0],r=e.closed?e.points.length:e.points.length-1,n=[`M ${t.x} ${t.y}`];for(let o=0;o<r;o++)n.push(Ig(e,o));return e.closed&&n.push("Z"),n.join(" ")}function Ig(e,t){let r=jr(e,t-1),n=jr(e,t),o=jr(e,t+1),i=jr(e,t+2),a=e.tension/6,s={x:n.x+(o.x-r.x)*a,y:n.y+(o.y-r.y)*a},l={x:o.x-(i.x-n.x)*a,y:o.y-(i.y-n.y)*a};return`C ${s.x} ${s.y} ${l.x} ${l.y} ${o.x} ${o.y}`}function jr(e,t){return e.closed?e.points[(t+e.points.length)%e.points.length]:e.points[Math.max(0,Math.min(e.points.length-1,t))]}function m(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function _l(e){let t=e.order_key??e.orderKey;if(!t)return e.order??0;let r=0;for(let n=0;n<Math.min(t.length,8);n++)r=r*128+t.charCodeAt(n);return r}function Fl(e,t){return e.sourceIndex??t}function k(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(n=>({offset:n.position,color:n.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(n=>({x:n.x,y:n.y,color:n.color}))}:{kind:"none"}}var E="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";var Hl="#94a3b8";function Vl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,120)),i=Math.max(0,m(e.height,60)),a=m(e.rotation,0),s=1e4+t,l=B({x:r,y:n,width:o,height:i},a,2);return[{id:`widget-${e.id}`,type:"rect",order:s,bounds:l,x:r,y:n,width:o,height:i,rx:6,rotation:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:Hl},strokeWidth:1,dash:[4,3]}},{id:`widget-${e.id}-label`,type:"text",order:s+.1,bounds:l,x:r,y:n,width:o,height:i,lines:[e.type],fontFamily:E,fontSize:12,fontWeight:"normal",color:Hl,align:"center",verticalAlign:"middle",lineHeight:1.3,rotation:a}]}function Wl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,160)),i=Math.max(0,m(e.height,90)),a=m(e.rotation,0);return[{id:`widget-${e.id}`,type:"rolling-number",order:1e4+t,bounds:B({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,value:Wt(e.value,e.digits),digits:e.digits,duration:Math.max(0,m(e.duration,420)),label:e.label,componentStyle:mo(e.style)}]}function zl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,200)),i=Math.max(0,m(e.height,200)),a=m(e.rotation,0),s=m(e.max,100)||100,l=Math.min(1,Math.max(0,m(Number(e.value),0)/s)),d=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:B({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,height:i,rotation:a,shader:{name:e.id,program:"tickScale",parameters:{...e.parameters,progress:l,max:s}},mask:"ellipse"}];return e.labels&&d.push(...Gg(e,{x:r,y:n,width:o,height:i,rotation:a,max:s,order:1e4+t})),d}function Gg(e,t){let r=e.labels??{},n=Math.max(1,m(Number(e.parameters.ticks),48)),o=Math.max(1,m(Number(e.parameters.major),5)),i=m(Number(e.parameters.start),225)*Math.PI/180,a=m(Number(e.parameters.sweep),270)*Math.PI/180,s=m(Number(e.parameters.radius),.9)+m(r.offset,.08),l=m(r.size,12),d=t.x+t.width/2,c=t.y+t.height/2,u=Math.floor(n/o),p=[];for(let f=0;f<=u;f+=1){let g=f*o/n,b=i-g*a,x=d+Math.cos(b)*s*(t.width/2),C=c-Math.sin(b)*s*(t.height/2),L={x:x-24,y:C-l,width:48,height:l*2};p.push({id:`widget-${e.id}-label-${f}`,type:"text",order:t.order+.1,bounds:B(L,0,2),...L,lines:[String(Math.round(t.max*g*10)/10)],fontFamily:r.fontFamily||E,fontSize:l,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:"center",verticalAlign:"middle",lineHeight:1.3})}return p}function Yl(e,t){let r=m(e.x,0),n=m(e.y,0),o=Math.max(0,m(e.width,120)),i=Math.max(0,m(e.height,360)),a=m(e.rotation,0),s=m(e.min,0),l=m(e.max,100),d=l===s?0:Math.min(1,Math.max(0,(m(Number(e.value),s)-s)/(l-s))),c=[{id:`widget-${e.id}`,type:"shader-surface",order:1e4+t,bounds:B({x:r,y:n,width:o,height:i},a,2),x:r,y:n,width:o,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(...Dg(e,{x:r,y:n,width:o,height:i,min:s,max:l,order:1e4+t})),c}function Dg(e,t){let r=e.labels??{},n=e.parameters.axis==="horizontal",o=Math.max(1,m(Number(e.parameters.ticks),50)),i=Math.max(1,m(Number(e.parameters.major),5)),a=m(Number(e.parameters.inset),.05)>0?m(Number(e.parameters.inset),.05):.05,s=m(Number(e.parameters.line),.7)>0?m(Number(e.parameters.line),.7):.7,l=n?t.height:t.width,d=(m(Number(e.parameters.length),.1)>0?m(Number(e.parameters.length),.1):.1)*l*1.9,c=s*l-.12*l-d-m(r.offset,.04)*l,u=m(r.size,12),p=Math.floor(o/i),f=[];for(let g=0;g<=p;g+=1){let b=g*i/o,x=a+(1-2*a)*b,C=n?{x:t.x+t.width*x-24,y:t.y+c-u*2,width:48,height:u*2}:{x:t.x+c-48,y:t.y+t.height*(1-x)-u,width:48,height:u*2};f.push({id:`widget-${e.id}-label-${g}`,type:"text",order:t.order+.1,bounds:B(C,0,2),...C,lines:[String(Math.round((t.min+(t.max-t.min)*b)*10)/10)],fontFamily:r.fontFamily||E,fontSize:u,fontWeight:r.weight??"normal",color:r.color||"#8f95c4",align:n?"center":"right",verticalAlign:"middle",lineHeight:1.3})}return f}var _g="#94a3b8";function Ie(e,t,r){return{x:m(e.x,0),y:m(e.y,0),width:Math.max(1,m(e.width,r.width)),height:Math.max(1,m(e.height,r.height)),order:1e4+t}}var X=(e,t)=>String(e.properties[t]??""),Ue=(e,t)=>Number(e.properties[t]??0),de=e=>({kind:"solid",color:e}),bt=(e,t)=>e.disabled?_g:t;function Ce(e,t){return e.disabled?{...t,opacity:.4}:t}function Ge(e,t){return{id:`widget-${e.id}`,type:"rect",order:t.order,bounds:B(t,0,0),x:t.x,y:t.y,width:t.width,height:t.height,style:{fill:{kind:"none"},stroke:{kind:"none"},pointerEvents:"all"}}}function yt(e,t,r,n,o){return{id:`widget-${e.id}-${t}`,type:"text",order:o,bounds:B(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,lines:[n.text],fontFamily:E,fontSize:n.fontSize,fontWeight:"600",color:n.color,align:n.align,verticalAlign:"middle",lineHeight:1.3}}function Ul(e,t){let r=Ie(e,t,{width:120,height:40}),n=[Ge(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:B(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:Math.min(Ue(e,"radius"),r.height/2),style:Ce(e,{fill:de(X(e,"accent")),stroke:{kind:"none"}})}];if(e.label){let o={text:e.label,color:bt(e,X(e,"textColor")),fontSize:Ue(e,"fontSize"),align:"center"};n.push(yt(e,"label",r,o,r.order+.2))}return n}var Fg=.22,Hg=.5,Vg=[[.24,.52],[.43,.72],[.78,.3]];function Wg(e){let[t,...r]=Vg.map(([n,o])=>`${e.x+n*e.width} ${e.y+o*e.width}`);return`M ${t} ${r.map(n=>`L ${n}`).join(" ")}`}function zg(e,t,r){let n=e.value===!0;return{id:`widget-${e.id}-box`,type:"rect",order:t.order+.1,bounds:B(r,0,2),...r,rx:r.width*Fg,style:Ce(e,{fill:n?de(X(e,"accent")):{kind:"none"},stroke:de(n?X(e,"accent"):X(e,"stroke")),strokeWidth:1.5})}}function Yg(e,t,r){return{id:`widget-${e.id}-check`,type:"path",order:t.order+.2,bounds:B(r,0,0),d:Wg(r),style:Ce(e,{fill:{kind:"none"},stroke:de(X(e,"check")),strokeWidth:Math.max(1.5,r.width*.12),lineCap:"round",lineJoin:"round"})}}function Ug(e,t,r,n){let o=r*Hg,i={x:t.x+r+o,y:t.y,width:Math.max(0,t.width-r-o),height:t.height},a={text:n,color:bt(e,X(e,"textColor")),fontSize:Ue(e,"fontSize"),align:"left"};return yt(e,"label",i,a,t.order+.3)}function jl(e,t){let r=Ie(e,t,{width:160,height:24}),n=Math.min(r.height,r.width),o={x:r.x,y:r.y+(r.height-n)/2,width:n,height:n};return[Ge(e,r),zg(e,r,o),...e.value===!0?[Yg(e,r,o)]:[],...e.label?[Ug(e,r,n,e.label)]:[]]}var jg=.12;function Xl(e,t){let r=Ie(e,t,{width:52,height:30}),n=e.value===!0,o=r.height*jg,i=r.height/2-o,a=n?r.x+r.width-r.height/2:r.x+r.height/2,s={x:a-i,y:r.y+o,width:i*2,height:i*2};return[Ge(e,r),{id:`widget-${e.id}-track`,type:"rect",order:r.order+.1,bounds:B(r,0,0),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:Ce(e,{fill:de(X(e,n?"accent":"track")),stroke:{kind:"none"}})},{id:`widget-${e.id}-thumb`,type:"ellipse",order:r.order+.2,bounds:B(s,0,0),cx:a,cy:r.y+r.height/2,rx:i,ry:i,style:Ce(e,{fill:de(X(e,"thumb")),stroke:{kind:"none"},shadow:{color:"#000000",opacity:.25,blur:2,dx:0,dy:1}})}]}function ql(e,t){let r=Ie(e,t,{width:120,height:40}),n=e.value===!0,o=[Ge(e,r),{id:`widget-${e.id}-face`,type:"rect",order:r.order+.1,bounds:B(r,0,2),x:r.x,y:r.y,width:r.width,height:r.height,rx:r.height/2,style:Ce(e,{fill:n?de(X(e,"accent")):{kind:"none"},stroke:de(n?X(e,"accent"):X(e,"stroke")),strokeWidth:1.5})}];if(e.label){let i={text:e.label,color:bt(e,X(e,n?"onTextColor":"textColor")),fontSize:Ue(e,"fontSize"),align:"center"};o.push(yt(e,"label",r,i,r.order+.2))}return o}var je=e=>(t,r)=>e(t,r),Xg=new Map([["rollingNumber",je(Wl)],["tickScale",je(zl)],["ruler",je(Yl)],["switch",je(Xl)],["checkbox",je(jl)],["toggleButton",je(ql)],["button",je(Ul)]]);function Kl(e){return Xg.get(e)}function qg(e){let t=lt(e.type)?.role;if(!t||!Pr(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 Kg(e){return e.label??(Pr(e)?e.id:String(e.value))}function No(e){return e.flatMap((t,r)=>{let n=Kl(t.type)??Vl,o=Z(n(t,r),"widget",t.id,t.type,Kg(t),t.parentFrameId),i=qg(t),a=o.find(s=>s.identity?.primary);return i&&a?.identity&&(a.identity.aria=i),o})}function Oo(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} 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+n} H ${e} Z`}function Bo(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t} H ${e+r} V ${t+n-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+n} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+n-i} Z`}function Kt(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t+i} A ${i} ${i} 0 0 1 ${e+i} ${t} H ${e+r} V ${t+n} H ${e+i} A ${i} ${i} 0 0 1 ${e} ${t+n-i} Z`}function Zt(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e} ${t} H ${e+r-i} A ${i} ${i} 0 0 1 ${e+r} ${t+i} V ${t+n-i} A ${i} ${i} 0 0 1 ${e+r-i} ${t+n} H ${e} Z`}function Zl(e,t,r,n,o){let i=Math.max(0,Math.min(r,n)/2),a=Math.max(0,Math.min(o.topLeft,i)),s=Math.max(0,Math.min(o.topRight,i)),l=Math.max(0,Math.min(o.bottomRight,i)),d=Math.max(0,Math.min(o.bottomLeft,i)),c=(u,p,f)=>u>0?`A ${u} ${u} 0 0 1 ${p} ${f} `:"";return`M ${e+a} ${t} H ${e+r-s} `+c(s,e+r,t+s)+`V ${t+n-l} `+c(l,e+r-l,t+n)+`H ${e+d} `+c(d,e,t+n-d)+`V ${t+a} `+c(a,e+a,t)+"Z"}function Xr(e,t,r,n){return{fill:{kind:"solid",color:e||"transparent"},stroke:{kind:"solid",color:t},strokeWidth:r,dash:n?.length?n:void 0}}var qr=8;function Zg(e,t,r){let n=e.strokeWidth/2;switch(e.labelPosition){case"bottom":{let o=e.x-n,i=e.y+e.height;return{x:o,y:i,width:r,height:t,path:Bo(o,i,r,t,qr)}}case"left":{let o=e.x-t,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Kt(o,i,t,r,qr)}}case"right":{let o=e.x+e.width,i=e.y-n;return{x:o,y:i,width:t,height:r,path:Zt(o,i,t,r,qr)}}default:{let o=e.x-n,i=e.y-t;return{x:o,y:i,width:r,height:t,path:Oo(o,i,r,t,qr)}}}}function Ql(e){let t=Math.max(32,e.fontSize+18),r=16,n=Math.max(120,e.title.length*e.fontSize*.62+r*2),o=Zg(e,t,n),i=Q(o,6),a=e.labelPosition==="left"||e.labelPosition==="right";return[{type:"path",id:e.tabId,order:e.order+.1,bounds:i,d:o.path,style:{fill:{kind:"solid",color:e.color},stroke:{kind:"none"}}},a?Jg(e,o,r,i):Qg(e,o,r,i)]}function Qg(e,t,r,n){return{type:"text",id:e.titleId,order:e.order+.2,bounds:n,x:t.x+r,y:t.y,width:Math.max(0,t.width-r*2),height:t.height,lines:[e.title],fontFamily:e.fontFamily??E,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"left",verticalAlign:"middle",lineHeight:1.2}}function Jg(e,t,r,n){let o=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:n,x:o-s/2,y:i-a/2,width:s,height:a,lines:[e.title],fontFamily:e.fontFamily??E,fontSize:e.fontSize,fontWeight:e.fontWeight,color:e.textColor,align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:-90,rotationCenter:{x:o,y:i}}}var eb={top:"topLeft",bottom:"bottomLeft",left:"topLeft",right:"topRight"};function tb(e,t,r){let n=e.shadow??!0,o=Q({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+(n?20:4)),i={...Xr(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:n?{color:"#000000",opacity:.2,blur:12,dx:0,dy:4}:void 0};if(!r)return{type:"rect",id:`frame-${e.id}`,order:t,bounds:o,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius,style:i};let a=eb[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:o,d:Zl(e.x,e.y,e.width,e.height,s),detail:{of:"frameBoundary",cornerRadius:e.cornerRadius,squareCorner:a},style:i}}function Jl(e,t){if(e.isVisible===!1)return[];let r=t,n=(e.showLabel??!0)&&!!e.title,o=[tb(e,r,n)];return n&&e.title&&o.push(...Ql({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})),o}function rb(e,t){let r=e*Math.PI/180;return{x:Math.cos(r)*t,y:Math.sin(r)*t}}function Kr(e){if(!e?.enabled)return;let t=rb(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 nb(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 ed(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:nb(e,t.offset),style:{fill:{kind:"none"},stroke:{kind:"solid",color:e.swimlane.strokeColor},strokeWidth:e.swimlane.strokeWidth}}))}function td(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??E,fontSize:e.swimlane.fontSize,fontWeight:e.swimlane.fontWeight,color:e.swimlane.textColor,lineHeight:1.2}}function ob(e,t,r){let n=e.swimlane.fontSize*1.4,o=e.swimlane.x+10+n/2,i=e.swimlane.y+t.offset+t.size/2,a=Math.max(20,t.size-16),s=o-a/2,l=i-n/2;return{...td(e,t,r),bounds:B({x:s,y:l,width:a,height:n},-90,12),x:s,y:l,width:a,height:n,align:"center",verticalAlign:"middle",rotation:-90,rotationCenter:{x:o,y:i}}}function ib(e,t,r){return{...td(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 rd(e){if(!e.swimlane.showLaneLabels)return[];let t=e.swimlane.orientation==="horizontal"?ob:ib;return e.lanes.map((r,n)=>t(e,r,n))}function ab(e){let t=e.orientation==="horizontal"?e.height:e.width,r=e.lanes.reduce((n,o)=>n+o.size,0);return r<=0||t<=0?e.lanes:e.lanes.map(n=>({...n,size:n.size*(t/r)}))}function sb(e){let t=0;return ab(e).map(r=>{let n={...r,offset:t};return t+=r.size,n})}function nd(e,t){return{swimlane:e,order:5e3+t,bounds:Q({x:e.x,y:e.y,width:e.width,height:e.height},e.strokeWidth+4),lanes:sb(e)}}function od(e,t){if(e.isVisible===!1)return[];let r=nd(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:{...Xr(e.fillColor,e.strokeColor,e.strokeWidth,e.dash),shadow:Kr(e.shadowStyle)}},...ed(r),...rd(r)]}function id(e){return[...e.frames.flatMap((t,r)=>Z(Jl(t,r),"frame",t.id,void 0,t.title??void 0)),...e.swimlanes.flatMap((t,r)=>Z(od(t,r),"swimlane",t.id))]}function Io(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function ad(e,t,r){let n=Io(e,t);if(n===0)return e;let o=r/n;return{x:e.x+(t.x-e.x)*o,y:e.y+(t.y-e.y)*o}}function lb(e,t,r,n){let o=Math.max(0,Math.min(n,Io(t,e)/2,Io(t,r)/2));return{vertex:t,start:ad(t,e,o),end:ad(t,r,o)}}function Zr(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 n=e.map((a,s)=>lb(e[(s-1+e.length)%e.length],a,e[(s+1)%e.length],r(s))),o=[`M ${n[0].end.x} ${n[0].end.y}`];for(let a=1;a<n.length;a++){let s=n[a];o.push(`L ${s.start.x} ${s.start.y}`,`Q ${s.vertex.x} ${s.vertex.y} ${s.end.x} ${s.end.y}`)}let i=n[0];return o.push(`L ${i.start.x} ${i.start.y}`,`Q ${i.vertex.x} ${i.vertex.y} ${i.end.x} ${i.end.y}`,"Z"),o.join(" ")}function db(e,t){let r=Math.max(0,m(e.strokeWidth,1)),n=m(e.rotation,0),o=wo(e),i={x:o.x+o.width/2,y:o.y+o.height/2};return{object:e,index:t,order:15e3+t,rotation:n,rotationCenter:i,box:o,strokeWidth:r,common:{type:"path",bounds:B(o,n,r+2),rotation:n,rotationCenter:i,style:{stroke:{kind:"solid",color:e.strokeColor??"#111827"},strokeWidth:r,lineJoin:"round"}}}}function cb(e,t){let{object:r,index:n,rotation:o,rotationCenter:i}=e;if(!r.hasShadow)return;let a=Math.max(0,r.height),s=.6+Math.min(1,a/150)*.7,l=a+m(r.shadowStyle?.distance,0),d=t.top.map(b=>({x:b.x,y:b.y+l})),c={x:d.reduce((b,x)=>b+x.x,0)/d.length,y:d.reduce((b,x)=>b+x.y,0)/d.length},u=1.3,p=d.map(b=>({x:c.x+(b.x-c.x)*u,y:c.y+(b.y-c.y)*u})),f=p.map(b=>b.x),g=p.map(b=>b.y);return{type:"path",id:`isometric-${r.id}-ground-shadow`,order:14e3+n,bounds:{minX:Math.min(...f),minY:Math.min(...g),maxX:Math.max(...f),maxY:Math.max(...g)},d:Zr(p,0),rotation:o,rotationCenter:i,style:{fill:{kind:"solid",color:r.shadowStyle?.color??"#000000"},stroke:{kind:"none"},opacity:Math.min(1,(r.shadowStyle?.opacity??.18)*s),blur:m(r.shadowStyle?.blur,8),pointerEvents:"none"}}}function ub(e,t,r){let{object:n,order:o,common:i}=e,a={...i.style,stroke:{kind:"none"}},s=Lo(n.fill??"#f8fafc"),l={prop:"style.fill",propKind:"color",propSolidOnly:!0},d=(c,u,p,f)=>({...i,id:`isometric-${n.id}-${c}`,order:o+u,d:Zr(p,0),style:{...a,fill:{kind:"solid",color:f},clip:r},...l});return[d("top",0,t.top,s.topFill),d("front",.1,t.front,s.frontFill),d("side",.2,t.right,s.sideFill)]}function mb(e,t,r){let{object:n,order:o,common:i,strokeWidth:a}=e;return{...i,id:`isometric-${n.id}-seams`,order:o+.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 pb(e,t,r){let{object:n,order:o,common:i,box:a}=e;return{...i,id:`isometric-${n.id}-hull`,order:o+.24,d:t,detail:{of:"isometricGeometry",width:Math.max(0,n.width),height:Math.max(0,n.height),depth:Math.max(0,n.depth),cornerRadius:r,bounds:a,labelOffsetX:m(n.labelOffsetX,0),labelOffsetY:m(n.labelOffsetY,0)},style:{...i.style,fill:{kind:"none"}}}}var Go=20,fb=12,hb=6,Qr=3,gb=6.5;function bb(e){let{object:t}=e,r=vo(t),n=r.y-fb+m(t.labelOffsetY,0);return{anchor:r,centerX:r.x+m(t.labelOffsetX,0),topY:n-Go,bottomY:n}}function yb(e,t,r){let{object:n,order:o,rotation:i,rotationCenter:a,box:s}=e,{centerX:l,topY:d,bottomY:c}=t;return{type:"text",id:`isometric-${n.id}-label`,order:o+.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:Go,lines:[r],fontFamily:E,fontSize:12,fontWeight:"normal",color:"#111827",align:"center",verticalAlign:"middle",lineHeight:1.2,rotation:i,rotationCenter:a,mark:"isometric-label"}}function xb(e,t){let{object:r,order:n,rotation:o,rotationCenter:i}=e,{anchor:a,centerX:s,bottomY:l}=t;return{type:"path",id:`isometric-${r.id}-label-guide`,order:n+.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:o,rotationCenter:i,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"#cbd5e1"},strokeWidth:1,lineCap:"round",pointerEvents:"none"}}}function Sb(e,t,r,n){let{object:o,order:i,rotation:a}=e,{centerX:s,topY:l,bottomY:d}=t,c=Math.max(24,r.length*gb+hb*2);return{type:"rect",id:`isometric-${o.id}-label-background`,order:i+.28,x:s-c/2,y:l-Qr,width:c,height:Go+Qr*2,rx:4,bounds:{minX:s-c/2,minY:l-Qr,maxX:s+c/2,maxY:d+Qr},rotation:a,mark:"isometric-label",style:{fill:{kind:"solid",color:n},stroke:{kind:"none"}}}}function Cb(e,t){let r=bb(e),n=yb(e,r,t),o=xb(e,r),i=e.object.labelBackground;return i?[o,Sb(e,r,t,i),n]:[o,n]}function Rb(e,t){let r=db(e,t),n=Ye(e),o=Math.max(0,m(e.cornerRadius,8)),i=[n.top[0],n.top[1],n.right[2],n.front[2],n.front[3],n.top[3]],a=Zr(i,o),s={type:"path",d:a},l=cb(r,n),d=mb(r,n,s),c=pb(r,a,o),u=ub(r,n,s),p=l?[c,...u,l,d]:[c,...u,d];return e.text?[...p,...Cb(r,e.text)]:p}function sd(e){return e.flatMap((t,r)=>Z(Rb(t,r),"isometric",t.id,"isometric",t.text??"Isometric object",t.parentFrameId))}function kb(e,t){let r=t==="start"?0:e.length-2,n=t==="start"?2:e.length-4,o=e[r],i=e[r+1],a=e[n]-o,s=e[n+1]-i,l=Math.hypot(a,s)||1,d=a/l,c=s/l;return{x:o+d*20-c*13,y:i+c*20+d*13}}function ld(e,t,r){let n=(t==="start"?e.link.style?.startLabel:e.link.style?.endLabel)?.trim();if(!n)return[];let o=m(e.link.style?.fontSize,10),i=kb(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-o,width:a,height:o*2,lines:[n],fontFamily:e.link.style?.fontFamily??E,fontSize:o,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]}function dd(e){return[...ld(e,"start",0),...ld(e,"end",1)]}function cd(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??E,fontSize:e.label.fontSize,fontWeight:"normal",color:e.color,align:"center",verticalAlign:"middle",lineHeight:1.4}]:[]}var Do=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}},ud=(e,t,r,n)=>{let o=a=>{let s=Math.max(0,Math.min(255,Math.round(a))).toString(16);return s.length===1?`0${s}`:s},i=n===void 0||n>=1?"":o(n*255);return`#${o(e)}${o(t)}${o(r)}${i}`};function wb(e,t,r){let n=Do(e),o=Do(t),i=n.a??1,a=o.a??1;return ud(Math.round(n.r+(o.r-n.r)*r),Math.round(n.g+(o.g-n.g)*r),Math.round(n.b+(o.b-n.b)*r),i+(a-i)*r)}function Qt(e,t){let r=[...e].sort((i,a)=>i.position-a.position),n=r[0],o=r[r.length-1];if(t<=n.position)return n.color;if(t>=o.position)return o.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 wb(a.color,s.color,d)}}return o.color}function md(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 pd=(e,t)=>{switch(t){case"dashed":return[e*8,e*4];case"dotted":return[e*2,e*3];default:return}};function Re(e,t,r,n){let o=Math.max(1,Math.floor(t/Math.max(1,r*.58))),i=n?(s,l)=>n.measure(s,!1)+n.spaceWidth+n.measure(l,!1)<=t:(s,l)=>`${s} ${l}`.length<=o,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 Jr(e,t,r,n){if(Me(e,r,n)<=t)return e;let o=e.length;for(;o>1&&Me(`${e.slice(0,o)}\u2026`,r,n)>t;)o-=1;return`${e.slice(0,o)}\u2026`}function Me(e,t,r){return e.length*t*(r?.64:.58)}function fd(e){return{measure:(t,r)=>Me(t,e,r),spaceWidth:e*.58}}var Xe=(e,t,r)=>({x:e.x+(t.x-e.x)*r,y:e.y+(t.y-e.y)*r});function _o(e,t,r,n,o){let i=1-o;return{x:i*i*i*e.x+3*i*i*o*t.x+3*i*o*o*r.x+o*o*o*n.x,y:i*i*i*e.y+3*i*i*o*t.y+3*i*o*o*r.y+o*o*o*n.y}}function Fo(e,t,r,n,o){let i=Xe(e,t,o),a=Xe(t,r,o),s=Xe(r,n,o),l=Xe(i,a,o),d=Xe(a,s,o),c=Xe(l,d,o);return{left:[e,i,l,c],right:[c,d,s,n]}}function en(e,t){let r=e.length-2;if(t<=0)return{point:{x:e[0],y:e[1]},segmentIndex:0};let n=0;for(let o=0;o<r;o+=2){let i={x:e[o],y:e[o+1]},a={x:e[o+2],y:e[o+3]},s=Math.hypot(a.x-i.x,a.y-i.y);if(n+s>=t){let l=s===0?0:(t-n)/s;return{point:Xe(i,a,l),segmentIndex:o}}n+=s}return{point:{x:e[r],y:e[r+1]},segmentIndex:r}}function tn(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 hd(e,t,r,n,o=40){let i=0,a=e;for(let s=1;s<=o;s++){let l=_o(e,t,r,n,s/o);i+=Math.hypot(l.x-a.x,l.y-a.y),a=l}return i}var xt=40;function vb(e){let t=[0],r=e[0];for(let n=1;n<=xt;n++){let o=_o(...e,n/xt);t.push(t[n-1]+Math.hypot(o.x-r.x,o.y-r.y)),r=o}return t}function gd(e,t){let r=e[xt];if(t<=0)return 0;if(t>=r)return 1;for(let n=1;n<=xt;n++)if(e[n]>=t){let o=(t-e[n-1])/(e[n]-e[n-1]||1);return(n-1+o)/xt}return 1}function Pb(e,t,r){let[n,o,i,a]=e,s=.75*(o.x-n.x)+1.5*(i.x-o.x)+.75*(a.x-i.x),l=.75*(o.y-n.y)+1.5*(i.y-o.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 bd(e,t){if(e.length<8)return null;let r=Lb(e),n=vb(r),o=n[xt];if(o===0)return null;let i=o/2,a=Math.max(0,i-t.minimumVisibleStub),s=Pb(r,t,a),l=gd(n,i-s),d=gd(n,i+s);return{before:Tb(r,l),after:$b(r,d),bezier:!0}}function Lb(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 Tb(e,t){return t<=.01?null:Fo(...e,t).left.flatMap(r=>[r.x,r.y])}function $b(e,t){return t>=.99?null:Fo(...e,t).right.flatMap(r=>[r.x,r.y])}function yd(e,t){if(e.length<4)return null;let r=tn(e);if(r===0)return null;let n=Mb(e,r,t);return{before:Eb(e,n.beforeLength),after:Nb(e,n.afterLength,r),bezier:!1}}function Mb(e,t,r){let n=t/2,o=en(e,n),i={x:e[o.segmentIndex],y:e[o.segmentIndex+1]},a={x:e[o.segmentIndex+2],y:e[o.segmentIndex+3]},s=Ab(i,a,r,n);return{beforeLength:n-s,afterLength:n+s}}function Ab(e,t,r,n){let o=Math.hypot(t.x-e.x,t.y-e.y),i=o===0?1:Math.abs(t.x-e.x)/o,a=o===0?0:Math.abs(t.y-e.y)/o,s=r.halfWidth*i+r.halfHeight*a;return Math.min(s,Math.max(0,n-r.minimumVisibleStub))}function Eb(e,t){if(t<=.5)return null;let r=en(e,t);return[...e.slice(0,r.segmentIndex+2),r.point.x,r.point.y]}function Nb(e,t,r){if(t>=r-.5)return null;let n=en(e,t);return[n.point.x,n.point.y,...e.slice(n.segmentIndex+2)]}var xd=3,Ob=10;function Bb(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 Ho(e,t){return t?hd(...Bb(e)):tn(e)}function Sd(e,t,r,n){let o={halfWidth:(r+xd)/2,halfHeight:(n+xd)/2,minimumVisibleStub:Ob};return t==="curved"?bd(e,o):yd(e,o)}function Vo(e,t,r,n){let o=Sd(e,t,r,n);if(!o||!o.before&&!o.after)return null;let i=Ho(e,o.bezier),a=o.before?Ho(o.before,o.bezier):0,s=o.after?Ho(o.after,o.bezier):0,l=Math.max(0,i-a-s);return l<=0?null:{dashBefore:a,gapLength:l}}function Ib(e){let[t,r,n,o,i,a,s,l]=e,d=.5,c=1-d;return{x:c*c*c*t+3*c*c*d*n+3*c*d*d*i+d*d*d*s,y:c*c*c*r+3*c*c*d*o+3*c*d*d*a+d*d*d*l}}function Gb(e,t){let r=0,n=[];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,n.push({start:s,end:l,length:d})}let o=r/2,i=0;for(let a of n){if(i+a.length>=o){let s=(o-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 Wo(e,t,r,n){if(t==="curved")return Ib(e);let o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};return t==="orthogonal"?Gb(e,o):o}function St(e){switch(e){case"top":return[0,-1];case"right":return[1,0];case"bottom":return[0,1];case"left":return[-1,0]}}function Db(e,t,r,n,o){let i=o?.min??50,a=o?.max??240,s=o?.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*n[0]+d*n[1]),p=Math.abs(l*r[1]-d*r[0]),f=Math.abs(l*n[1]-d*n[0]),g=r[0]===n[0]&&r[1]===n[1]||r[0]===-n[0]&&r[1]===-n[1],b=Math.max(i,Math.min(a,Math.max(c,p*s))),x=Math.max(i,Math.min(a,Math.max(u,f*s)));return g&&(b=Math.min(a,b+p*.75),x=Math.min(a,x+f*.75)),{fromDistance:b,toDistance:x}}function Cd(e,t,r,n,o){let i=St(r),a=St(n),{fromDistance:s,toDistance:l}=Db(e,t,i,a,o);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 Rd(e,t,r,n){let{p0:o,p1:i,p2:a,p3:s}=Cd(e,t,r,n,{min:35,max:90,perpendicularScale:.5});return{points:[...o,...i,...a,...s],segments:[]}}function wd(e,t,r,n){let i=["top","bottom"].includes(r)&&["top","bottom"].includes(n),a=["left","right"].includes(r)&&["left","right"].includes(n);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 vd(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 Pd(e,t,r,n,o){let i=40,a=40,s=o?0:1,l=o?t.x-e.x:t.y-e.y;if(r[s]!==0&&r[s]===-n[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*-n[s];d>0&&d<a&&(a=d)}return[i,a]}function Ld(e){let{fromConnection:t,toConnection:r,to:n,horizontalFirst:o}=e,i=t.stub,a=r.stub,s=(i[0]+a[0])/2,l=(i[1]+a[1])/2,d=kd(t.side),c=kd(r.side);return d!==c?o?s=(i[0]-n.x)*r.normal[0]>=0?i[0]:a[0]:l=(i[1]-n.y)*r.normal[1]>=0?i[1]:a[1]:t.side===r.side&&(o?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 kd(e){return e==="left"||e==="right"}function Td(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 $d(e,t){let{from:r,to:n,fromConnection:o,toConnection:i,horizontalFirst:a}=e,s=o.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],n.x,n.y),d}function Md(e,t,r){let n=e?["left","right"]:["top","bottom"];return[!n.includes(t),!n.includes(r)]}function Ad(e,t,r,n){let{from:o,to:i,fromConnection:a,toConnection:s,horizontalFirst:l}=e,d=a.stub,c=s.stub,u=n[0]&&r?.[1]||0,p=r?.[2]||0,f=n[1]&&r?.[3]||0;if(l){let C=d[1]+u,L=t[0]+p,v=c[1]+f;return[o.x,o.y,d[0],C,L,C,L,v,c[0],v,i.x,i.y]}let g=d[0]+u,b=t[1]+p,x=c[0]+f;return[o.x,o.y,g,d[1],g,b,x,b,x,c[1],i.x,i.y]}function Ed(e,t,r,n){let o=(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<o-1,p=a===1?r:a===o-2?n:!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&&p&&f}})}function rn(e,t){if(e.length<6)return e;let r=Vb(e),n=[r[0]];for(let o=1;o<r.length-1;o++){let i=_b(r[o-1],r[o],r[o+1],t);n.push(...i?Hb(i):[r[o]])}return n.push(r[r.length-1]),n.flatMap(o=>[o.x,o.y])}function _b(e,t,r,n){let o={x:t.x-e.x,y:t.y-e.y},i={x:r.x-t.x,y:r.y-t.y},a=o.x===0||o.y===0,s=i.x===0||i.y===0,l=o.x===0&&i.x===0||o.y===0&&i.y===0;if(!a||!s||l)return null;let d=Math.min(n,Nd(o)*.4,Nd(i)*.4);if(d<=0)return null;let c=Od(o),u=Od(i),p=zo(t,c,-d),f=zo(t,u,d),g=zo(p,u,d),b=Math.atan2(p.y-g.y,p.x-g.x),x=Math.atan2(f.y-g.y,f.x-g.x);return{entry:p,exit:f,center:g,radius:d,startAngle:b,angleSweep:Fb(x-b)}}function zo(e,t,r){return{x:e.x+t.x*r,y:e.y+t.y*r}}function Nd(e){return Math.abs(e.x)+Math.abs(e.y)}function Od(e){return{x:e.x!==0?Math.sign(e.x):0,y:e.y!==0?Math.sign(e.y):0}}function Fb(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function Hb(e){let t=[e.entry];for(let r=1;r<7;r++){let n=r/7,o=e.startAngle+e.angleSweep*n;t.push({x:e.center.x+Math.cos(o)*e.radius,y:e.center.y+Math.sin(o)*e.radius})}return t.push(e.exit),t}function Vb(e){let t=[];for(let r=0;r<e.length;r+=2)t.push({x:e[r],y:e[r+1]});return t}function Yo(e){let t=Wb(e),r=Ld(t),n=$d(t,r),o=Td(n),i=Md(t.horizontalFirst,e.fromSide,e.toSide),a=Ad(t,r,e.segmentOffsets,i),s=Ed(a,o,i[0],i[1]);return{points:rn(a,10),segments:s}}function Wb(e){let[t,r]=wd(e.from,e.to,e.fromSide,e.toSide),n=St(e.fromSide),o=St(e.toSide),i=vd(t,r,e.endpointEdges),[a,s]=Pd(t,r,n,o,i);return{from:t,to:r,fromConnection:Bd(t,e.fromSide,n,a),toConnection:Bd(r,e.toSide,o,s),horizontalFirst:i}}function Bd(e,t,r,n){return{side:t,normal:r,stub:[e.x+r[0]*n,e.y+r[1]*n]}}var Id=.5;function Gd(e,t,r){let n=[e,...t,r],o=[];for(let a of n)o.push(a.x,a.y);let i=[];for(let a=0;a<o.length-2;a+=2){let s={x:o[a],y:o[a+1]},l={x:o[a+2],y:o[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:rn(o,10),segments:i}}function Uo(e){return e.every(t=>{let r=Math.abs(t.end.x-t.start.x),n=Math.abs(t.end.y-t.start.y);return r<=Id||n<=Id})}function Dd(e,t,r,n,o){if(e.waypoints&&e.waypoints.length>0){let l=Gd(t,e.waypoints,r);if(Uo(l.segments))return l}let i={fromEdge:n,toEdge:o},a={from:t,to:r,fromSide:n,toSide:o,segmentOffsets:e.segmentOffsets,endpointEdges:i},s=Yo(a);return Uo(s.segments)?s:Yo({...a,segmentOffsets:void 0})}function _d(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 Fd(e,t,r){let n=e.fromPoint?.kind==="side"?e.fromPoint.side:_d(t,r),o=e.toPoint?.kind==="side"?e.toPoint.side:_d(r,t);return{fromSide:n,toSide:o}}function Hd(e,t){return{points:[e.x,e.y,t.x,t.y],segments:[]}}function Vd(e,t,r,n){let{fromSide:o,toSide:i}=Fd(e,t,r);return n==="curved"?Rd(t,r,o,i):n==="orthogonal"?Dd(e,t,r,o,i):Hd(t,r)}function zb(e,t){let r=e.filter((o,i)=>i%2===0),n=e.filter((o,i)=>i%2===1);return{minX:Math.min(...r)-t,minY:Math.min(...n)-t,maxX:Math.max(...r)+t,maxY:Math.max(...n)+t}}function Yb(e,t){let r=!!(e.showText&&e.text),n=m(e.style?.fontSize,10),o=Math.min(250,Math.max(n*2,(e.text?.length??0)*n*.65+10)),i=t?.(e.style?.fontFamily??E,n),a=r?Re(e.text??"",o,n,i):[];return{visible:r,fontSize:n,width:o,height:a.length*n*1.4,lines:a}}function Ub(e,t,r,n){let o=e.link,i=typeof o.style?.color=="object"&&o.style.color.type==="gradient"?{kind:"linear-gradient",angle:0,stops:o.style.color.stops.map(a=>({offset:a.position,color:a.color}))}:{kind:"solid",color:r};return{fill:{kind:"none"},stroke:i,strokeWidth:t,dash:n,lineCap:"round",lineJoin:"round",opacity:m(o.style?.opacity,1),shadow:Kr(o.style?.shadow)}}function Wd(e,t,r){let{link:n,from:o,to:i}=e,a=n.style?.pathType??"orthogonal",{points:s,segments:l}=Vd(n,o,i,a),d=m(n.style?.strokeWidth,2),c=md(n.style?.color)||"#64748b",u=Yb(n,r),p=pd(d,n.style?.strokeStyle??"solid"),f=u.visible&&!p?Vo(s,a,u.width,u.height):null,g=f?[f.dashBefore,f.gapLength,1e6]:p;return{link:n,pathType:a,points:s,segments:l,midpoint:Wo(s,a,o,i),strokeWidth:d,bounds:zb(s,d+14),color:c,order:2e4+t,style:Ub(e,d,c,g),label:u,hasLabelGap:!!f}}function jo(e,t){let r=t==="start"?e.startMarker:e.endMarker;if(r)return r;let n=e.style?.arrowDirection??"forward";return n==="bidirectional"||t==="start"&&n==="backward"||t==="end"&&n==="forward"?"arrow":"none"}function zd(e,t){if(e.length===0)return"";let r=[e[0].start,...e.map(s=>s.end)],n=r.filter((s,l)=>l===0||s.x!==r[l-1].x||s.y!==r[l-1].y),o=n.filter((s,l)=>{if(l===0||l===n.length-1)return!0;let d=n[l-1],c=n[l+1];return!(d.x===s.x&&s.x===c.x||d.y===s.y&&s.y===c.y)});if(o.length<2)return"";let i=`M ${o[0].x} ${o[0].y}`;for(let s=1;s<o.length-1;s++){let l=o[s-1],d=o[s],c=o[s+1],u=Math.hypot(d.x-l.x,d.y-l.y),p=Math.hypot(c.x-d.x,c.y-d.y);if(u===0||p===0){i+=` L ${d.x} ${d.y}`;continue}let f=Math.min(t,u*.4,p*.4),g={x:d.x+(l.x-d.x)/u*f,y:d.y+(l.y-d.y)/u*f},b={x:d.x+(c.x-d.x)/p*f,y:d.y+(c.y-d.y)/p*f};i+=` L ${g.x} ${g.y} Q ${d.x} ${d.y} ${b.x} ${b.y}`}let a=o[o.length-1];return`${i} L ${a.x} ${a.y}`}function jb(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 Xb(e,t,r,n){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?zd(r,Math.max(16,n*4)):jb(e)}var Ct=e=>Math.round(e*100)/100;function qb(e,t){if(!(e!=="orthogonal"||!t.some(r=>r.canMove)))return t.map(r=>({ax:Ct(r.start.x),ay:Ct(r.start.y),bx:Ct(r.end.x),by:Ct(r.end.y),ox:Ct(r.originalMidpoint.x),oy:Ct(r.originalMidpoint.y),movable:r.canMove}))}function Yd(e){let{link:t}=e;return{type:"path",id:`link-${t.id}`,order:e.order,bounds:e.bounds,d:Xb(e.points,e.pathType,e.segments,e.strokeWidth),style:e.style,markerStart:jo(t,"start"),markerEnd:jo(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:qb(e.pathType,e.segments)}}}function Ud(e){let{link:t}=e;if(t.weight===void 0||t.weight===null||t.showWeight===!1)return[];let r=t.weight.toFixed(1),n=Math.max(30,r.length*8+12),o=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-n/2,y:i-o/2,width:n,height:o,rx:o/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-n/2,y:i-o/2,width:n,height:o,lines:[r],fontFamily:"Arial, sans-serif",fontSize:10,fontWeight:"bold",color:"#ffffff",align:"center",verticalAlign:"middle",lineHeight:1}]}function Kb(e,t,r){if(e.link.isVisible===!1)return[];let n=Wd(e,t,r);return[Yd(n),...cd(n),...Ud(n),...dd(n)]}function jd(e,t){return e.flatMap((r,n)=>Z(Kb(r,n,t),"link",r.link.id,r.kind,r.link.text||`${r.link.fromId} \u2192 ${r.link.toId}`))}function Zb(e,t){if(e.isVisible===!1||e.points.length<2)return[];let r=m(e.strokeWidth,2),n=r+12,o={minX:Math.min(...e.points.map(s=>s.x))-n,minY:Math.min(...e.points.map(s=>s.y))-n,maxX:Math.max(...e.points.map(s=>s.x))+n,maxY:Math.max(...e.points.map(s=>s.y))+n},i=m(e.tension,0),a=e.closed===!0;return[{type:"path",id:`path-${e.id}`,order:3e4+t,bounds:o,d:fe({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:m(e.opacity,1)}}]}function Xd(e){return e.flatMap((t,r)=>Z(Zb(t,r),"path",t.id,"path","Path"))}function Jt(e){return{id:e.id,order:e.order,bounds:e.bounds,rotation:e.rotation,style:e.style}}var Qb=[[30,64,24],[52,40,22],[86,32,28],[118,42,24],[132,64,24]],nn=Math.PI/2,Jb=4*nn,qd=Math.PI/2,ey=1e-9;function Xo([e,t,r],n){return[e+r*Math.cos(n),t+r*Math.sin(n)]}function Kd([e,t],r){return Math.atan2(r[1]-t,r[0]-e)}function Zd(e,t,r){let n=t[0]-e[0],o=t[1]-e[1],i=Math.hypot(n,o),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*n/i,d=e[1]+a*o/i,c=[[l-s*o/i,d+s*n/i],[l+s*o/i,d-s*n/i]],u=p=>Math.hypot(p[0]-r[0],p[1]-r[1]);return u(c[0])>u(c[1])?c[0]:c[1]}function ty(e){let t=[e.reduce((r,n)=>r+n[0],0)/e.length,e.reduce((r,n)=>r+n[1],0)/e.length];return e.map((r,n)=>{let o=n===0?qd:Kd(r,Zd(e[n-1],r,t)),a=n===e.length-1?qd:Kd(r,Zd(r,e[n+1],t));for(;a<=o;)a+=Jb;return{lobe:r,from:o,to:a}})}function ry(e,t){let r=[];for(let n=Math.floor(e/nn)+1;n*nn<t-ey;n++)r.push(n*nn);return[...r,t]}function ny({lobe:e,from:t,to:r}){let n=Xo(e,t),o=[],i=t;for(let a of ry(t,r)){let s=1.3333333333333333*Math.tan((a-i)/4)*e[2],l=Xo(e,i),d=Xo(e,a);o.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:n,curves:o}}function oy(){let e=ty(Qb).map(ny),t=e[0].start,r=e.flatMap(d=>d.curves),n=[t,...r.map(d=>d[2])],o=Math.min(...n.map(d=>d[0])),i=Math.max(...n.map(d=>d[0])),a=Math.min(...n.map(d=>d[1])),s=Math.max(...n.map(d=>d[1])),l=d=>[(d[0]-o)/(i-o),(d[1]-a)/(s-a)];return{start:l(t),curves:r.map(([d,c,u])=>[l(d),l(c),l(u)])}}var Qd=oy();function Jd(e,t,r,n){let o=([a,s])=>`${e+a*r} ${t+s*n}`,i=Qd.curves.map(([a,s,l])=>`C ${o(a)} ${o(s)} ${o(l)}`);return`M ${o(Qd.start)} ${i.join(" ")} Z`}function ec(e,t,r,n){let o=Math.min(n*.22,r*.2),i=r/2,a=e+i,s=e,l=e+r,d=t+o,c=t+n-o,u=`M ${s} ${d} C ${s} ${d+.5523*o} ${a-.5523*i} ${d+o} ${a} ${d+o} C ${a+.5523*i} ${d+o} ${l} ${d+.5523*o} ${l} ${d} C ${l} ${d-.5523*o} ${a+.5523*i} ${t} ${a} ${t} C ${a-.5523*i} ${t} ${s} ${d-.5523*o} ${s} ${d} Z`,p=`M ${s} ${d} L ${s} ${c} C ${s} ${c+.5523*o} ${a-.5523*i} ${t+n} ${a} ${t+n} C ${a+.5523*i} ${t+n} ${l} ${c+.5523*o} ${l} ${c} L ${l} ${d}`;return`${u} ${p}`}function tc(e,t,r,n){let o=Math.min(r/4,n/4.35),i=o,a=o*2,s=o*4.35,l=t+(n-s)/2;return{head:i,body:a,centerX:e+r/2,headCenterY:l+i,bottom:l+s}}function rc(e,t,r,n){let{body:o,centerX:i,bottom:a}=tc(e,t,r,n);return{x:i-o,y:a-o,width:o*2,height:o}}function nc(e,t,r,n){let{head:o,body:i,centerX:a,headCenterY:s,bottom:l}=tc(e,t,r,n),d=`M ${a} ${s-o} C ${a+.5523*o} ${s-o} ${a+o} ${s-.5523*o} ${a+o} ${s} C ${a+o} ${s+.5523*o} ${a+.5523*o} ${s+o} ${a} ${s+o} C ${a-.5523*o} ${s+o} ${a-o} ${s+.5523*o} ${a-o} ${s} C ${a-o} ${s-.5523*o} ${a-.5523*o} ${s-o} ${a} ${s-o} 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 iy=e=>e.length<4?"":`M ${e[0]} ${e[1]} ${e.slice(2).reduce((t,r,n)=>t+(n%2?` ${r}`:` L ${r}`),"")} Z`,ay=.1,sy=Math.PI/6,ly=.25,dy=.15;function oc(e,t){return Math.min(e,t)/2}function ic(e,t,r,n,o){let i=(...a)=>iy(a);switch(e){case"diamond":return i(t+n/2,r,t+n,r+o/2,t+n/2,r+o,t,r+o/2);case"triangle":return i(t+n/2,r,t,r+o,t+n,r+o);case"parallelogram":return i(t+n*.15,r,t+n,r,t+n*.85,r+o,t,r+o);case"trapezoid":return i(t+n*.2,r,t+n*.8,r,t+n,r+o,t,r+o);case"hexagon":{let a=Math.min(n,o)/4;return i(t+a,r,t+n-a,r,t+n,r+o/2,t+n-a,r+o,t+a,r+o,t,r+o/2)}case"document":{let a=o*ay,s=r+o-a,l=n/4,d=a*sy;return`M ${t} ${r} L ${t+n} ${r} L ${t+n} ${s} C ${t+n-l/3} ${s-d} ${t+n-l*2/3} ${s-a} ${t+n-l} ${s-a} C ${t+n-l-l/3} ${s-a} ${t+n/2+l/3} ${s-d} ${t+n/2} ${s} C ${t+n/2-l/3} ${s+d} ${t+n/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(n,o)*ly;return`M ${t} ${r} L ${t+n-a} ${r} L ${t+n} ${r+a} L ${t+n} ${r+o} L ${t} ${r+o} Z M ${t+n} ${r+a} L ${t+n-a} ${r+a} L ${t+n-a} ${r}`}case"cloud":return Jd(t,r,n,o);case"cylinder":return ec(t,r,n,o);case"person":return nc(t,r,n,o);case"predefined_process":{let a=Math.min(n,o)*dy;return`M ${t} ${r} L ${t+n} ${r} L ${t+n} ${r+o} L ${t} ${r+o} Z M ${t+a} ${r} L ${t+a} ${r+o} M ${t+n-a} ${r} L ${t+n-a} ${r+o}`}default:return null}}function ce(e){let t=ic(e.shape.shapeType,e.x,e.y,e.width,e.height);return t?[{...Jt(e),type:"path",d:t,rotationCenter:e.rotationCenter}]:[]}function ac(e){return ce(e).map(t=>({...t,detail:{of:"declaredBounds",bounds:{x:e.x,y:e.y,width:e.width,height:e.height}}}))}function Rt(e){let t=e.shape.shapeType==="pill"?oc(e.width,e.height):e.shape.shapeType==="rounded_rectangle"?m(e.shape.cornerRadius,8):0;return[{...Jt(e),type:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:t}]}function qo(e){return[{...Jt(e),type:"ellipse",cx:e.x+e.width/2,cy:e.y+e.height/2,rx:e.width/2,ry:e.height/2}]}function sc(e){if(!e.shape.symbol||e.shape.symbol.points.length<2)return Rt(e);let t=m(e.shape.symbol.tension,0),r=e.shape.symbol.points.map(([n,o])=>({x:e.x+n*e.width,y:e.y+o*e.height}));return[{...Jt(e),type:"path",d:fe({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 cy={cloud:ce,cylinder:ce,diamond:ce,document:ce,hexagon:ce,note:ce,oval:qo,circle:qo,parallelogram:ce,person:ac,pill:Rt,predefined_process:ce,rectangle:Rt,rounded_rectangle:Rt,symbol:sc,trapezoid:ce,triangle:ce};function er(e){return(cy[e.shape.shapeType]??Rt)(e)}var uy={container_rectangle:" (use 'rectangle' with strokeStyle: dashed)"},q={strokeColor:"#cbd5e1",strokeWidth:2,fillColor:"#ffffff",dash:[],strokeStyle:"solid",fontSize:14,fontWeight:"normal",textAlign:"center",textVerticalAlign:"middle",lineHeight:1.3,hasShadow:!1,opacity:1},lc={rectangle:q,rounded_rectangle:{...q,cornerRadius:8},triangle:{...q,rotation:0},diamond:{...q,rotation:0},hexagon:{...q,rotation:0},oval:{...q,rotation:0},circle:{...q,rotation:0},document:{...q,rotation:0},parallelogram:{...q,rotation:0},trapezoid:{...q,rotation:0},cylinder:{...q,rotation:0},note:{...q,rotation:0},cloud:{...q,rotation:0},predefined_process:{...q,rotation:0},pill:q,person:{...q,rotation:0},symbol:{...q,rotation:0}};function Ko(e,t){let r=lc[e.shapeType];return r||(t.push({severity:"warning",code:"unknown-shape-type",ownerId:e.id,message:`Unknown shapeType '${e.shapeType}'${uy[e.shapeType]??""}, falling back to rectangle defaults.`}),lc.rectangle)}function my(e,t){return e.strokeStyle==="dotted"?[.001,t*2]:e.strokeStyle==="dashed"?[t*4,t*2]:e.dash?.length?e.dash:void 0}function dc(e,t){let r=Ko(e,t),n=m(e.strokeWidth,r.strokeWidth),o=e.shadowStyle??(e.hasShadow?{enabled:!0,color:"#000000",opacity:.25,blur:10,angle:45,distance:5}:void 0),i=m(o?.angle,45)*Math.PI/180;return{fill:k(e.fillColor,t,e.id),stroke:k(e.strokeColor,t,e.id),strokeWidth:n,dash:my(e,n),lineCap:e.strokeStyle==="dotted"?"round":"butt",opacity:m(e.opacity,r.opacity),shadow:o?.enabled?{color:o.color??"#000000",opacity:m(o.opacity,.25),blur:m(o.blur,10),dx:Math.cos(i)*m(o.distance,5),dy:Math.sin(i)*m(o.distance,5)}:void 0}}var Zo=/\*\*([^*]+)\*\*/g;function cc(e){return/\*\*[^*]+\*\*/.test(e)}function py(e){let t=[],r=0;Zo.lastIndex=0;let n;for(;n=Zo.exec(e);)n.index>r&&t.push({text:e.slice(r,n.index),bold:!1}),n[1]&&t.push({text:n[1],bold:!0}),r=Zo.lastIndex;return r<e.length&&t.push({text:e.slice(r),bold:!1}),t.length?t:[{text:e,bold:!1}]}function fy(e){return e.split(`
13
+ `).map(py)}function hy(e){let t=[];for(let r of e)for(let n of r.text.split(/\s+/))n&&t.push({text:n,bold:r.bold});return t}function gy(e,t,r,n){let o=hy(e);if(!o.length)return[[]];let i=[],a=[],s=0;for(let l of o){let d=r(l.text,l.bold),c=a.length?n+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 uc(e,t,r,n){return fy(e).flatMap(o=>gy(o,Math.max(1,t),r,n))}function mc(e,t,r){let{shape:n,bounds:o,order:i,rotation:a,rotationCenter:s,x:l,y:d,width:c,height:u}=e;if(!n.text)return null;let p=m(n.fontSize,Ko(n,[]).fontSize),f=n.isText?0:Math.max(8,t*2),g=n.shapeType==="person"?rc(l,d,c,u):{x:l,y:d,width:c,height:u},b=Math.max(0,g.width-f*2),x=n.fontFamily||E,C=r?.(x,p),L={type:"text",id:`shape-text-${n.id}`,order:i+.5,bounds:o,x:g.x+f,y:g.y+f,width:b,height:Math.max(0,g.height-f*2),lines:Re(n.text,b,p,C),fontFamily:x,fontSize:p,fontWeight:n.fontWeight??"normal",letterSpacing:n.letterSpacing,color:n.textColor||"#111827",align:n.textAlign??"center",verticalAlign:n.textVerticalAlign??"middle",lineHeight:m(n.lineHeight,1.3),rotation:a,rotationCenter:s};if(cc(n.text)){let{measure:v,spaceWidth:M}=C??fd(p);L.richLines=uc(n.text,b,v,M)}return L}function by(e,t){let r=Math.max(0,e.width-2*t),n=Math.max(0,e.height-2*t),o={...e.style,fill:{kind:"none"},strokeWidth:Math.max(1,t/3),dash:void 0,shadow:void 0},i=er({...e,style:o});if(r<=0||n<=0)return i;let a={...e,x:e.x+t,y:e.y+t,width:r,height:n};return i.push(...er({...a,id:`${e.id}-fill`,style:{...e.style,stroke:{kind:"none"},strokeWidth:0,dash:void 0}}),...er({...a,id:`${e.id}-inner`,style:o})),i}function yy(e,t,r){let n=m(e.x,0),o=m(e.y,0),i=Math.max(0,m(e.width,100)),a=Math.max(0,m(e.height,100)),s=m(e.rotation,0),l=m(e.strokeWidth,2);return{strokeWidth:l,context:{shape:e,id:`shape-${e.id}`,order:1e4+t,bounds:B({x:n,y:o,width:i,height:a},s,l+(e.hasShadow?20:2)),rotation:s,rotationCenter:{x:n+i/2,y:o+a/2},style:dc(e,r),x:n,y:o,width:i,height:a}}}function xy(e){if(!(!e.shape.shader||e.shape.shapeType!=="circle"&&e.shape.shapeType!=="oval"))return{id:`${e.id}-shader`,type:"shader-surface",order:e.order,bounds:e.bounds,x:e.x,y:e.y,width:e.width,height:e.height,rotation:e.rotation,shader:e.shape.shader,mask:"ellipse",fillColor:e.style.fill?.kind==="solid"?e.style.fill.color:void 0}}function Sy(e,t,r,n){if(e.isVisible===!1)return[];let{context:o,strokeWidth:i}=yy(e,t,r),a=e.strokeStyle==="double"?by(o,i||1):er(o),s=xy(o);if(s){for(let d of a)(d.type==="ellipse"||d.type==="path"||d.type==="rect")&&(d.style={...d.style,pointerEvents:"all"});a.push(s)}let l=mc(o,i,n);return l&&a.push(l),a}function pc(e,t,r){return e.flatMap((n,o)=>Z(Sy(n,o,t,r),"shape",n.id,n.shapeType,n.text||n.shapeType,n.parentFrameId??void 0))}var $=["#7c3aed","#0ea5e9","#f97316","#10b981","#ec4899","#eab308"],z="#94a3b8",tr=[{label:"Low",color:"#ddd6fe"},{label:"Medium",color:"#a78bfa"},{label:"High",color:"#6d28d9"}],Qo=14;function T(e,t,r){return t.max===t.min?0:(e-t.min)/(t.max-t.min)*r}function _(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,n=[];for(let o=e.min;(t?o<=e.max+1e-9:o>=e.max-1e-9)&&n.length<1e3;o+=r)n.push(Math.round(o*1e3)/1e3);return n}function rr(e){let t=[...e.thresholds??[]].filter(r=>r>e.min&&r<e.max).sort((r,n)=>r-n);return[e.min,...t,e.max]}function nr(e,t,r){let n=Math.max(0,t.length-1),o=r.slice(0,n).map((i,a)=>({position:t[a+1]??t[t.length-1],color:i.color??z}));return o.length?Qt(o,e):z}function ue(e){return Math.max(1,e.config?.categories?.length??0,...e.series.map(t=>t.values.length))}var me={padX:8,padY:3,charWidth:.58,lineHeight:1.2,gap:4};function Jo(e,t){return(t||"{value}").replace("{value}",String(Math.round(e*100)/100))}function ei(e,t,r){let n=r?me.padX:0,o=r?me.padY:0,i=t*me.lineHeight;return{width:e.length*t*me.charWidth+n*2,height:i+o*2,lineHeight:i,padX:n,padY:o}}function ti(e,t,r,n){let o=n/2;return`M ${e+o} ${t} H ${e+r-o} A ${o} ${o} 0 0 1 ${e+r-o} ${t+n} H ${e+o} A ${o} ${o} 0 0 1 ${e+o} ${t} Z`}function on(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} 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+n} H ${e} Z`}function ke(e,t,r,n,o){let i=Math.max(0,Math.min(o,r/2,n/2));return i===0?`M ${e} ${t} H ${e+r} V ${t+n} H ${e} Z`:`M ${e+i} ${t} H ${e+r-i} Q ${e+r} ${t} ${e+r} ${t+i} V ${t+n-i} Q ${e+r} ${t+n} ${e+r-i} ${t+n} H ${e+i} Q ${e} ${t+n} ${e} ${t+n-i} V ${t+i} Q ${e} ${t} ${e+i} ${t} Z`}function qe(e,t,r,n,o,i){return i?ke(e,t,r,n,o):on(e,t,r,n,o)}function ri(e,t){if(e.length===1)return e[0];let r=(e.length-1)*t,n=Math.floor(r),o=Math.ceil(r);return n===o?e[n]:e[n]+(r-n)*(e[o]-e[n])}function ni(e){if(!e?.length)return null;let t=[...e].sort((r,n)=>r-n);return{min:t[0],q1:ri(t,.25),median:ri(t,.5),q3:ri(t,.75),max:t[t.length-1]}}function or(e){if(e?.[0]!=="#")return;let t=e.length===4?e.slice(1).split("").map(i=>parseInt(i+i,16)):[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)),[r,n,o]=t;return[r,n,o].some(i=>Number.isNaN(i))?void 0:[r,n,o]}function oi(e,t){let r=or(e),n=Math.max(0,Math.min(1,t));if(!r)return n<=0?"transparent":e??"transparent";let[o,i,a]=r;return`rgba(${o}, ${i}, ${a}, ${n})`}function ii(e,t,r){let n=o=>Math.round(Math.max(0,Math.min(255,o))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(r)}`}function sn(e,t,r){let n=e/255,o=t/255,i=r/255,a=Math.max(n,o,i),s=Math.min(n,o,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===n?u=(o-i)/d%6:a===o?u=(i-n)/d+2:u=(n-o)/d+4,u*=60,u<0&&(u+=360),[u,c,l]}function ai(e,t,r){let n=(1-Math.abs(2*r-1))*t,o=n*(1-Math.abs(e/60%2-1)),i=r-n/2,[a,s,l]=[0,0,0];return e<60?[a,s,l]=[n,o,0]:e<120?[a,s,l]=[o,n,0]:e<180?[a,s,l]=[0,n,o]:e<240?[a,s,l]=[0,o,n]:e<300?[a,s,l]=[o,0,n]:[a,s,l]=[n,0,o],[(a+i)*255,(s+i)*255,(l+i)*255]}function fc(e,t,r){let n=o=>{let i=o/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*n(e)+.7152*n(t)+.0722*n(r)}function Cy(e,t){let r=Math.max(e,t),n=Math.min(e,t);return(r+.05)/(n+.05)}var an=.35,hc=.08,gc=.22,bc=.78,yc=.92,Ry=3;function J(e){let t=or(e);if(!t)return"#0f172a";let[r,n,o]=t,i=(.299*r+.587*n+.114*o)/255>.6?"#0f172a":"#ffffff",[a,s,l]=sn(r,n,o);if(s===0)return i;let d=l>.5?Math.max(hc,Math.min(l-an,gc)):Math.min(yc,Math.max(l+an,bc)),c=ai(a,s,d);return Cy(fc(r,n,o),fc(...c))>=Ry?ii(...c):i}function kt(e,t){let r=or(e);if(!r)return t;let[n,o,i]=r,[a,s,l]=sn(n,o,i);if(s===0)return t;let d=l>.5?Math.max(hc,Math.min(l-an,gc)):Math.min(yc,Math.max(l+an,bc));return ii(...ai(a,s,d))}function ln(e){let t=or(e);return t?sn(...t)[2]>.5:!1}function De(e,t){let r=or(e);if(!r)return;let[n,o]=sn(...r);if(o!==0)return ii(...ai(n,o,t))}function N(e,t){return e?typeof e=="string"?e:e.type==="gradient"?e.stops[0]?.color??t:e.points[0]?.color??t:t}function ir(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:ky(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 ky(e){let{centerX:t,startY:r,endY:n}=e,o=t-5,i=t+5;return`M ${t} ${r} L ${t} ${n} M ${o} ${r} L ${i} ${r} M ${o} ${n} L ${i} ${n}`}function he(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}var cn=18,dn=e=>e.config;function ee(e){return e.chartType==="bar"&&dn(e)?.orientation==="horizontal"}function wt(e,t){let r=ue({series:e.series,config:dn(e)}),n=t.height/r,o=Math.min(Math.max(0,m(dn(e)?.barGroupGap,8)),Math.max(0,n-1)),i=e.categoryAlign==="left"?cn:0,a=Math.max(1,n-o-i),s=m(dn(e)?.barThickness,0),l=s>0?Math.min(a,s):a;return{count:r,slotHeight:n,groupGap:o,labelRow:i,barsHeight:l,offset:(a-l)/2}}function vt(e,t,r){return t.y+r*e.slotHeight+e.groupGap/2+e.offset}function Pt(e,t){return t>0?fe({points:e,tension:t,closed:!1}):`M ${e.map((n,o)=>`${o?"L":""} ${n.x} ${n.y}`).join(" ")}`}function un(e,t,r,n){let o=Math.max(1,Math.min(e,t)/2-4),i=Math.max(0,Math.min(r??0,o-1)),a=Math.max(0,Math.min(n??0,o/2)),s=Math.max(1,o-a),l=i>0?Math.min(i+a,s-1):0;return{outerRadius:s,innerRadius:l,cornerRadius:a}}function Y(e,t,r){return{x:e.centerX+r*Math.cos(t),y:e.centerY+r*Math.sin(t)}}function sr(e,t,r,n){let o=t.x-e.x,i=t.y-e.y,a=0,s=1;if(Math.abs(o)>1e-6){let d=(t.x-r-e.x)/o,c=(t.x+r-e.x)/o;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-n-e.y)/i,c=(t.y+n-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*o,y:e.y+l*i}}function Tt(e,t){return Math.abs(t-e)>Math.PI?1:0}function Ke(e,t){return e<=0||t<=0?0:Math.asin(Math.min(1,e/t))}function xc(e,t){return{start:e.start+t,end:e.end-t}}function Ze(e,t,r){if(e<=0)return 0;let n=Math.min(Math.abs(t)/2,Math.PI/2),o=Math.sin(n);return o<=1e-6?r:Math.min(e/o,r)}function wy(e,t,r){let n=Y(e,t.start,e.outerRadius),o=Y(e,t.end,e.outerRadius);return[`M ${r.x} ${r.y}`,`L ${n.x} ${n.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${Tt(t.start,t.end)} 1 ${o.x} ${o.y}`,"Z"].join(" ")}function vy(e,t,r,n){let o=Y(e,r.start,e.outerRadius),i=Y(e,r.end,e.outerRadius),a=Y(e,n.end,t),s=Y(e,n.start,t);return[`M ${o.x} ${o.y}`,`A ${e.outerRadius} ${e.outerRadius} 0 ${Tt(r.start,r.end)} 1 ${i.x} ${i.y}`,`L ${a.x} ${a.y}`,`A ${t} ${t} 0 ${Tt(n.start,n.end)} 0 ${s.x} ${s.y}`,"Z"].join(" ")}var Sc=.82;function Lt(e,t,r,n,o,i){let a=Math.min(1,o/r),s=n+i*Math.asin(a),l=Math.sqrt(Math.max(0,r*r-o*o));return{lineTangent:{x:e.centerX+l*Math.cos(n),y:e.centerY+l*Math.sin(n)},arcTangent:Y(e,s,t),angle:s}}function lr(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Sc),i=e*o/(1+o),a=t>0?t*o:Number.POSITIVE_INFINITY,s=t>0?(e-t)/2:e/2;return Math.max(0,Math.min(i,a,s))}function dr(e,t,r){let n=Math.min(Math.abs(r)/2,Math.PI/2),o=Math.sin(n*Sc),i=e*o/(1+o),a=(e*e-t*t)/(2*e);return Math.max(0,Math.min(i,a))}function Py(e,t,r,n){let{outerRadius:o}=e,i=o-r,a=Lt(e,o,i,t.start,r,1),s=Lt(e,o,i,t.end,r,-1);return[`M ${n.x} ${n.y}`,`L ${a.lineTangent.x} ${a.lineTangent.y}`,`A ${r} ${r} 0 0 1 ${a.arcTangent.x} ${a.arcTangent.y}`,`A ${o} ${o} 0 ${Tt(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 Ly(e,t,r,n,o){let{outerRadius:i}=e,a=i-o,s=Lt(e,i,a,r.start,o,1),l=Lt(e,i,a,r.end,o,-1),d=t+o,c=Lt(e,t,d,n.start,o,1),u=Lt(e,t,d,n.end,o,-1);return[`M ${s.lineTangent.x} ${s.lineTangent.y}`,`A ${o} ${o} 0 0 1 ${s.arcTangent.x} ${s.arcTangent.y}`,`A ${i} ${i} 0 ${Tt(s.angle,l.angle)} 1 ${l.arcTangent.x} ${l.arcTangent.y}`,`A ${o} ${o} 0 0 1 ${l.lineTangent.x} ${l.lineTangent.y}`,`L ${u.lineTangent.x} ${u.lineTangent.y}`,`A ${o} ${o} 0 0 1 ${u.arcTangent.x} ${u.arcTangent.y}`,`A ${t} ${t} 0 ${Tt(u.angle,c.angle)} 0 ${c.arcTangent.x} ${c.arcTangent.y}`,`A ${o} ${o} 0 0 1 ${c.lineTangent.x} ${c.lineTangent.y}`,"Z"].join(" ")}function $t(e,t,r){let n=Math.max(0,r)/2,o=Ze(n,t.end-t.start,e.outerRadius);return e.innerRadius>0&&e.innerRadius>=o}function Qe(e,t,r=0,n=0){let o=Math.max(0,n)/2,i=xc(t,Ke(o,e.outerRadius));if(!$t(e,t,n)){let s=Ze(o,t.end-t.start,e.outerRadius),l=Y(e,(t.start+t.end)/2,s);return r>0?Py(e,i,r,l):wy(e,i,l)}let a=xc(t,Ke(o,e.innerRadius));return r>0?Ly(e,e.innerRadius,i,a,r):vy(e,e.innerRadius,i,a)}function Ae(e,t,r,n,o,i,a){let s=t==="horizontal",l=s?e.width:e.height,d=Math.max(1,(l-n*(r-1))/r),c=Math.min(r,Math.max(0,i*r)),u=a?Math.round(c):c,p=[];for(let f=0;f<r;f++){let g=Math.min(1,Math.max(0,u-f))*d;if(g<.5)continue;let b=f*(d+n);p.push(s?ke(e.x+b,e.y,g,e.height,o):ke(e.x,e.y+e.height-b-g,e.width,g,o))}return p.join(" ")}function O(e){if(!e?.enabled)return;let t=m(e.angle,45)*Math.PI/180,r=m(e.distance,5);return{color:e.color??"#000000",opacity:m(e.opacity,.25),blur:m(e.blur,10),dx:Math.cos(t)*r,dy:Math.sin(t)*r}}function cr(e,t,r,n,o){let i=e.series[n].values[r]??0;return t==="waterfall"?Ty(e,r,n,o,i):t==="percent"?$y(e,r,n,o,i):My(e,r,n,o,i)}function Ty(e,t,r,n,o){let i=0;for(let a=0;a<t;a++)i+=e.series[r].values[a]??0;return Cc(o,i,i+o,e,n)}function $y(e,t,r,n,o){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(o);return{value:o,pixelStart:a/i*n,pixelEnd:(a+s)/i*n}}function My(e,t,r,n,o){let i=0;for(let a=0;a<r;a++)i+=e.series[a].values[t]??0;return Cc(o,i,i+o,e,n)}function Cc(e,t,r,n,o){return{value:e,pixelStart:T(t,n.axisY,o),pixelEnd:T(r,n.axisY,o)}}function w(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??E,fontSize:Math.max(9,m(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 Ay=/^[A-Za-z_][A-Za-z0-9_]*$/;function Mt(e,t,r){return Ay.test(t)?`${e}[${t}].${r}`:void 0}var Rc="text";function si(e){return`Axis[${e}].label`}function mn(e){return Number.isInteger(e)&&e>=0?`categories[${e}]`:void 0}function we(e){return Mt("Series",e,"label")}function kc(e){return Mt("Series",e,"color")}function te(e,t){return Number.isInteger(t)&&t>=0?Mt("Series",e,`values[${t}]`):void 0}function At(e,t){return Number.isInteger(t)&&t>=0?Mt("Series",e,`colors[${t}]`):void 0}function wc(e){return Mt("Rule",e,"text")}function vc(e){return Mt("Rule",e,"at")}function Ey(e,t,r){return e.axisX.label?{...w({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:si("x")}:null}function Ny(e,t,r){return!e.axisY.label||e.showValueAxis===!1?null:{...w({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:si("y")}}function Pc(e,t,r){let n=[],o=Ey(e,t,r);o&&n.push(o);let i=Ny(e,t,r+n.length);return i&&n.push(i),n}function Lc(e,t,r){let n=Math.max(1,e.series.length),o=t.plot.height/n;return e.series.map((i,a)=>{let s=t.plot.y+(a+.5)*o;return{...w({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:we(i.id)}})}var Oy=new Set(["heatmap","boxplot","sankey","treemap","mekko"]);function Tc(e){return By(e.chart)?Fy(e).flatMap(t=>Hy(e,t)):[]}function By(e){let t=e.chartType==="custom"&&!!e.config?.connectPoints;return e.showLegend!==!1&&!Oy.has(e.chartType)&&!t}function li(e){return e.chartType==="field"?e.series.filter(t=>t.values[0]?.length===4):e.series}var di=22,pn=16;function ci(e){return e==="bottomLeft"||e==="bottomRight"}function ui(e){return li(e).map(t=>Math.max(42,t.label.length*m(e.fontSize,12)*.58+22))}function $c(e){let t=ui(e);return t.length?Math.max(...t):0}function Iy(e,t,r){return e.legendPosition==="bottom"?t.x+(t.width-r)/2:t.x+t.width-r}function Gy(e,t){return(e.legendPosition??"top")==="top"?e.y+16:t.y+t.height+16}function Dy(e){let{chart:t,plot:r,order:n}=e,o=li(t),i=ui(t),a=Math.max(...i),s=t.legendPosition==="bottomLeft"?r.x-pn-a:r.x+r.width+pn,l=r.y+r.height-15;return o.map((d,c)=>({series:d,seriesIndex:c,x:s,y:l-(o.length-1-c)*di,width:i[c],order:n+(o.length-1-c)*2}))}function _y(e){let{chart:t,plot:r,order:n}=e,o=li(t),i=ui(t),a=i.reduce((d,c)=>d+c,0),s=Gy(t,r),l=Iy(t,r,a);return o.map((d,c)=>{let u=i[c],p=l;return l+=u,{series:d,seriesIndex:c,x:p,y:s,width:u,order:n+(o.length-1-c)*2}})}function Fy(e){return ci(e.chart.legendPosition)?Dy(e):_y(e)}function Hy(e,t){return[Vy(e,t),Wy(e,t)]}function Vy(e,t){let{chart:r,bounds:n,diagnostics:o}=e,i=$[t.seriesIndex%$.length],a=r.chartType==="line",s=a?N(t.series.color,i):t.series.color??i;return{type:"rect",id:`chart-legend-swatch-${r.id}-${t.series.id}`,order:t.order,bounds:n,x:t.x,y:t.y,width:10,height:10,rx:3,prop:kc(t.series.id),propKind:"color",propSolidOnly:a,style:{fill:k(s,o,r.id)}}}function Wy(e,t){let{chart:r,bounds:n}=e;return{...w({role:"legend",id:`chart-legend-${r.id}-${t.series.id}`,order:t.order+1,bounds:n,frame:{x:t.x+15,y:t.y-3,width:t.width-15,height:18},text:t.series.label,chart:r}),prop:we(t.series.id)}}var Ac=new Set(["bar","line","scatter","boxplot","hexbin","custom","field"]),zy=new Set(["heatmap","sankey","treemap","mekko","pie","radialBar","polarArea"]);function Je(e){return!zy.has(e.chartType)}function _e(e){return Je(e)?Math.max(0,m(e.tickLength,0)):0}function Yy(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Uy(e){let t=m(e.fontSize,12);return Math.max(0,...e.series.map(n=>(n.label||n.id).length))*t*.58+16}var Mc=66;function jy(e,t){return e.chartType!=="treemap"||!t?null:e.legendPosition==="left"?"left":e.legendPosition==="right"?"right":null}function Xy(e){let t=m(e.axisFontSize??e.fontSize,12),r=e.config?.categories??[];return Math.max(0,...r.map(n=>n.length))*t*.58+16}function qy(e){return Yy(e)?Uy(e):ee(e)?e.categoryAlign==="left"||e.categoryAlign==="inside"?20:Xy(e):e.showValueAxis===!1?20:e.axisY.label?60:46}function Ec(e){let t=e.showAxisLabels!==!1,r=e.showLegend!==!1,n=e.legendPosition??"top",o=n==="top",i=r&&e.series.length>0,a=i&&ci(n),s=a?$c(e)+pn:0,l=jy(e,r),d=_e(e),c=d+(t?qy(e):12)+(n==="bottomLeft"?s:0)+(l==="left"?Mc:0),u=24+(n==="bottomRight"?s:0)+(l==="right"?Mc:0),p=e.chartType==="bar"&&e.config?.showBarLabels===!0&&e.config.barLabelPosition==="axis",f=ee(e)&&e.showValueAxis!==!1,g=t?ee(e)?f?34:12:(e.axisX.label?52:34)+(p?18:0):12,b=e.chartType==="field"&&r&&!!e.config?.scale?.stops.length,x=i&&!o&&!a,C=d+g+(b?44:0)+(x?16+di:0),v=(e.title?Math.max(44,20+m(e.titleSize,14)*1.6):0)||(o&&i?44:24);return{bounds:Q({x:e.x,y:e.y,width:e.width,height:e.height},m(e.strokeWidth,1)+2),plot:{x:e.x+c,y:e.y+v,width:Math.max(1,e.width-c-u),height:Math.max(1,e.height-v-C)},showLabels:t,showLegend:r,padLeft:c}}function Ky(e,t){return e.config?.categories?.length?e.config.categories:Array.from({length:t},(r,n)=>String(n+1))}function Nc(e,t,r){let n=ue(e),o=t.plot.width/n,i=Ky(e,n),a=!!e.config?.categories?.length,s=e.categoryAlign==="left",l=s?Math.min(Math.max(0,m(e.config?.barGroupGap,8)),Math.max(0,o-1)):0;return Array.from({length:n},(d,c)=>{let u=t.plot.x+(c+.5)*o;return{...w({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+c,bounds:t.bounds,frame:{x:s?t.plot.x+c*o+l/2:u-o/2,y:t.plot.y+t.plot.height+4+_e(e),width:s?o-l:o,height:18},text:i[c]??String(c+1),chart:e,align:s?"left":"center"}),prop:a?mn(c):void 0}})}function Oc(e,t,r){let n=Math.max(1,e.series.length),o=t.plot.width/n;return e.series.map((i,a)=>{let s=t.plot.x+(a+.5)*o;return{...w({role:"axis",id:`chart-x-tick-${e.id}-${a}`,order:r+a,bounds:t.bounds,frame:{x:s-o/2,y:t.plot.y+t.plot.height+4+_e(e),width:o,height:18},text:i.label||i.id,chart:e,align:"center"}),prop:we(i.id)}})}function Bc(e,t,r){return _(e.axisX).map((n,o)=>{let i=t.plot.x+T(n,e.axisX,t.plot.width);return w({role:"axis",id:`chart-x-tick-${e.id}-${n}`,order:r+o,bounds:t.bounds,frame:{x:i-20,y:t.plot.y+t.plot.height+10+_e(e),width:40,height:18},text:String(n),chart:e,align:"center"})})}function Ic(e,t,r){return _(e.axisY).map((n,o)=>{let i=t.plot.y+t.plot.height-T(n,e.axisY,t.plot.height);return w({role:"axis",id:`chart-y-tick-${e.id}-${n}`,order:r+o,bounds:t.bounds,frame:{x:e.x,y:i-6,width:t.padLeft-14-_e(e),height:18},text:String(n),chart:e,align:"right"})})}function mi(e){return e.chartType==="boxplot"&&e.config?.orientation==="horizontal"}function Zy(e,t,r){return e.chartType==="bar"?Nc(e,t,r):e.chartType==="boxplot"&&!mi(e)?Oc(e,t,r):Bc(e,t,r)}function Qy(e,t,r){return mi(e)?Lc(e,t,r):e.showValueAxis===!1?[]:Ic(e,t,r)}function Jy(e,t){let{plot:r}=t;if(e.chartType==="bar"){let n=ue(e);return Array.from({length:n},(o,i)=>r.x+(i+.5)*r.width/n)}return _(e.axisX).map(n=>r.x+T(n,e.axisX,r.width))}function ex(e,t){return e.axisLineStyle==="dashed"?{dash:[t*3,t*2]}:e.axisLineStyle==="dotted"?{dash:[.1,t*3],lineCap:"round"}:{}}function tx(e,t,r){let n=m(e.axisLineWidth,0),o=m(e.tickLength,0);if(n<=0&&o<=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:n>0?n:1,pointerEvents:"none",...ex(e,n>0?n:1)},d=[],c=(u,p)=>d.push({type:"path",id:`chart-axis-${u}-${e.id}`,order:r+d.length,bounds:a,d:p,style:l});if(n>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}`)),o>0&&ee(e)){_(e.axisY).forEach(p=>{let f=i.x+T(p,e.axisY,i.width);c(`tick-v-${p}`,`M ${f} ${s} L ${f} ${s+o}`)});let u=wt(e,i);for(let p=0;p<u.count;p++){let f=vt(u,i,p)+u.labelRow+u.barsHeight/2;c(`tick-c-${p}`,`M ${i.x-o} ${f} L ${i.x} ${f}`)}}return o>0&&!mi(e)&&!ee(e)&&(_(e.axisY).forEach(u=>{let p=s-T(u,e.axisY,i.height);c(`tick-y-${u}`,`M ${i.x-o} ${p} L ${i.x} ${p}`)}),Jy(e,t).forEach((u,p)=>{c(`tick-x-${p}`,`M ${u} ${s} L ${u} ${s+o}`)})),d}function rx(e,t){let r=e.config?.categories;return Array.from({length:t},(n,o)=>r?.[o]??String(o+1))}function nx(e,t,r){let{plot:n,bounds:o}=t,i=wt(e,n),a=e.categoryAlign==="left",s=e.categoryAlign==="inside",l=!!e.config?.categories?.length,d=rx(e,i.count).map((c,u)=>{let p=vt(i,n,u);return{...w({role:"axis",id:`chart-y-category-${e.id}-${u}`,order:r+u,bounds:o,frame:a?{x:n.x,y:p,width:n.width,height:i.labelRow}:s?{x:n.x+14,y:p+i.barsHeight/2-9,width:n.width-28,height:18}:{x:e.x+8,y:p+i.barsHeight/2-9,width:n.x-e.x-16,height:18},text:c,chart:e,align:a||s?"left":"right"}),prop:l?mn(u):void 0}});return e.showValueAxis!==!1&&_(e.axisY).forEach((c,u)=>{let p=n.x+T(c,e.axisY,n.width);d.push(w({role:"axis",id:`chart-x-tick-${e.id}-${c}`,order:r+i.count+u,bounds:o,frame:{x:p-20,y:n.y+n.height+4+m(e.tickLength,0),width:40,height:18},text:String(c),chart:e,align:"center"}))}),d}function Gc(e,t,r){if(!Je(e))return[];let n=tx(e,t,r);if(!t.showLabels)return n;if(r+=n.length,ee(e))return[...n,...nx(e,t,r)];let o=Zy(e,t,r),i=Qy(e,t,r+o.length),a=Pc(e,t,r+o.length+i.length);return[...n,...o,...i,...a]}function Dc(e,t,r,n){let o=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**(n/2);o+=c*a.value,i+=c}return i===0?0:o/i}var pi=32;function ur(e,t){return{type:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:e.cornerRadius??12}}function _c(e,t,r,n){let o=t>0&&r>0?t/r:1,i=Math.max(2,Math.min(pi,Math.round(Math.sqrt(pi*pi*o)))),a=Math.max(2,Math.round(i/o)),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?Dc(e,u,d,n):0}}return{grid:s,cols:i,rows:a}}var Fc=new Set(["scatter","custom","hexbin"]);var Hc=-Math.PI/2,ox=.5,ix=6;function ax(e){return Math.max(38,e*3.2)}function fn(e,t,r,n=!0){let o=n?ax(r):ix;return Math.max(8,Math.min(e,t)/2-o)}function hn(e,t){return Math.max(3,e||t)}function sx(e,t){return Hc+t*Math.PI*2/e}function fi(e,t,r){let n=t===e?0:(r-e)/(t-e);return Hc+n*Math.PI*2}function Vc(e,t,r){let n=sx(e.count,t);return{x:e.centerX+Math.cos(n)*r,y:e.centerY+Math.sin(n)*r}}function Wc(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 gn(e,t,r=ox){return e.length===0?"":t?fe({points:e,tension:r,closed:!0}):`M ${e.map((o,i)=>`${i?"L ":""}${o.x} ${o.y}`).join(" ")} Z`}function bn(e,t,r,n,o,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:n,cx:o,cy:i,rx:l,ry:l,style:d};let c=l*2;return{type:"rect",id:t,order:r,bounds:n,x:o-l,y:i-l,width:c,height:c,style:d}}function mr(e,t){if(e.gridLineStyle!=="dashed")return{};let r=e.gridRoundedCorners===!0;return{dash:[t*3,t*2],lineCap:r?"round":"butt"}}function zc(e,t,r,n){let o=t.x+t.width/2,i=t.y+t.height/2,a=Math.max(0,Math.min(t.width,t.height)/2),s=m(e.gridWidth,1);if(e.gridLineStyle==="dotted")return lx(e,r,n,o,i,a,s);let l={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:s,...mr(e,s)},d=[];return _(e.axisY).filter(c=>c>e.axisY.min).forEach(c=>{let u=a*Yc(e,c);d.push({type:"ellipse",id:`chart-grid-ring-${e.id}-${c}`,order:n+d.length,bounds:r,cx:o,cy:i,rx:u,ry:u,style:l})}),_(e.axisX).forEach(c=>{let u=fi(e.axisX.min,e.axisX.max,c),p=o+Math.cos(u)*a,f=i+Math.sin(u)*a;d.push({type:"path",id:`chart-grid-spoke-${e.id}-${c}`,order:n+d.length,bounds:r,d:`M ${o} ${i} L ${p} ${f}`,style:l})}),d}function lx(e,t,r,n,o,i,a){let s=_(e.axisY).filter(c=>c>e.axisY.min),l=_(e.axisX),d=[];return s.forEach(c=>{let u=i*Yc(e,c);l.forEach(p=>{let f=fi(e.axisX.min,e.axisX.max,p),g=n+Math.cos(f)*u,b=o+Math.sin(f)*u,x=`chart-grid-dot-${e.id}-${p}-${c}`;d.push(bn(e,x,r+d.length,t,g,b,a,void 0))})}),d}function Yc(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 yn(e,t,r,n){if(e.showGrid===!1||!Je(e))return[];if(e.gridShape==="circle"&&Fc.has(e.chartType))return zc(e,t,r,n);let o=m(e.gridWidth,1);if(ee(e))return dx(e,t,r,n,o);let i=e.chartType==="field"?ur(e,t):void 0;if(e.gridLineStyle==="dotted")return cx(e,t,r,n,o,i);let a={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...mr(e,o),clip:i},s=[];return(e.gridAxes==="y"?[]:_(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:n+s.length,bounds:r,d:`M ${d} ${t.y} L ${d} ${t.y+t.height}`,style:a})}),(e.gridAxes==="x"?[]:_(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:n+s.length,bounds:r,d:`M ${t.x} ${d} L ${t.x+t.width} ${d}`,style:a})}),s}function dx(e,t,r,n,o){if(e.gridAxes==="y")return[];let i={fill:{kind:"none"},stroke:{kind:"solid",color:e.gridColor??"#e2e8f0"},strokeWidth:o,...e.gridLineStyle==="dotted"?{dash:[.1,o*3],lineCap:"round"}:mr(e,o)};return _(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:n+s,bounds:r,d:`M ${l} ${t.y} L ${l} ${t.y+t.height}`,style:i}})}function cx(e,t,r,n,o,i){let a=_(e.axisX),s=_(e.axisY),l=[];return a.forEach(d=>{let c=t.x+T(d,e.axisX,t.width);s.forEach(u=>{let p=t.y+t.height-T(u,e.axisY,t.height),f=`chart-grid-dot-${e.id}-${d}-${u}`;l.push(bn(e,f,n+l.length,r,c,p,o,i))})}),l}function Uc(e){return e.chart.rules?.length?ux(e).flatMap(t=>mx(e,t)):[]}function ux(e){let t=e.order;return(e.chart.rules??[]).map(r=>{let n=t++,o=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:n,labelOrder:o}})}function mx(e,t){let r=[px(e,t)];return t.rule.text&&t.labelOrder!==void 0&&r.push(fx(e,t)),r}function px(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:vc(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 fx(e,t){let r=Math.max(9,m(e.chart.fontSize,12)-2);return{...w({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:wc(t.rule.id)}}function hi(e){let t=m(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,m(e.cornerRadius,12)-t)}}function jc(e,t,r){if(!e.fillImage)return[];let n=hi(e),o=[{type:"image",id:`chart-image-${e.id}`,order:r.next(),bounds:t,x:n.x,y:n.y,width:n.width,height:n.height,href:e.fillImage.url,style:{clip:{type:"rect",...n},pointerEvents:"none"}}];return e.fillImage.overlay&&o.push({type:"rect",id:`chart-image-overlay-${e.id}`,order:r.next(),bounds:t,x:n.x,y:n.y,width:n.width,height:n.height,rx:n.rx,style:{fill:{kind:"solid",color:e.fillImage.overlay},pointerEvents:"none"}}),o}function Et(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=m(n.config?.barGlassBlur,0);if(a<=0||!n.fillImage)return[];let s=hi(n),l=[{type:"image",id:`chart-bar-glass-${n.id}-${t}`,order:i(),bounds:o,x:s.x,y:s.y,width:s.width,height:s.height,href:n.fillImage.url,style:{blur:a,saturate:m(n.config?.barGlassSaturation,1),clip:{type:"path",d:r},pointerEvents:"none"}}];return n.fillImage.overlay&&l.push({type:"path",id:`chart-bar-glass-overlay-${n.id}-${t}`,order:i(),bounds:o,d:r,style:{fill:{kind:"solid",color:n.fillImage.overlay},pointerEvents:"none"}}),n.config?.barGlassTint&&l.push({type:"path",id:`chart-bar-glass-tint-${n.id}-${t}`,order:i(),bounds:o,d:r,style:{fill:{kind:"solid",color:n.config.barGlassTint},pointerEvents:"none"}}),l.push(...yn(n,e.plot,o,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 Nt(e,t,r,n,o,i=e.bounds){let{chart:a,diagnostics:s,nextOrder:l}=e;return{type:"path",id:t,order:l(),bounds:i,d:r,style:{fill:k(n,s,a.id),shadow:{color:N(n,"#ffffff"),opacity:.9,blur:o,dx:0,dy:0},pointerEvents:"none"}}}function Ot(e){return e.chart.config?.showBarLabels===!0}function hx(e,t){let r=e.frame.height>=t.height+me.gap*2;return e.placement!=="outside"&&!r?"outside":e.placement}function gx(e,t,r){return e==="outside"?t.y-r-me.gap:e==="inside"?t.y+me.gap:t.y+t.height/2-r/2}function bx(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config;return{type:"path",id:`${t}-pill`,order:s(),bounds:i,d:ti(r.left,r.top,r.width,r.height),style:{fill:l?.barLabelPillColor?k(l.barLabelPillColor,a,o.id):{kind:"none"},stroke:k(l?.barLabelBorderColor??n,a,o.id),strokeWidth:m(l?.barLabelBorderWidth,1),pointerEvents:"none"}}}function yx(e,t,r,n,o,i,a){let{chart:s,bounds:l,nextOrder:d}=e,c=s.config;return{...w({id:t,order:d(),bounds:l,frame:{x:r.left,y:r.top+r.padY,width:r.width,height:r.lineHeight},text:n,chart:s,align:"center"}),mark:`bar-label|${o}|${c?.barLabelFormat??""}`,color:a,fontSize:i,fontFamily:c?.barLabelFontFamily??s.fontFamily??"Inter, sans-serif",fontWeight:c?.barLabelFontWeight??"normal"}}function xx(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=o.config,d=i.y+i.height+4+16+Math.max(0,o.tickLength??0);return{...w({id:t.id,order:s(),bounds:a,frame:t.horizontal?o.categoryAlign==="inside"?{x:i.x,y:t.frame.y+t.frame.height/2-n*.6,width:i.width-14,height:n*1.2}:{x:i.x,y:t.frame.y-cn,width:i.width,height:n*1.2}:{x:t.frame.x,y:d,width:t.frame.width,height:n*1.2},text:r,chart:o,align:t.horizontal?"right":o.categoryAlign==="left"?"left":"center"}),mark:`bar-label|axis|${l?.barLabelFormat??""}`,color:l?.barLabelColor??o.textColor??"#0f172a",fontSize:n,fontFamily:l?.barLabelFontFamily??o.fontFamily??"Inter, sans-serif",fontWeight:l?.barLabelFontWeight??"normal"}}function Sx(e,t){let r=e.placement==="axis"?"outside":e.placement,n=e.frame.width>=t.width+me.gap*2;return r!=="outside"&&!n?"outside":r}function Cx(e,t,r){let{frame:n}=e,o=r==="outside"?n.x+n.width+me.gap:r==="inside"?n.x+n.width-t.width-me.gap:n.x+n.width/2-t.width/2;return{...t,left:o,top:n.y+n.height/2-t.height/2}}function Bt(e,t){let{chart:r}=e,n=r.config,o=Math.max(8,m(n?.barLabelFontSize,m(r.fontSize,12))),i=Jo(t.value,n?.barLabelFormat);if(t.placement==="axis")return[xx(e,t,i,o)];let a=n?.barLabelPill===!0,s=ei(i,o,a),l=t.horizontal?Sx(t,s):hx(t,s),d=t.horizontal?Cx(t,s,l):{...s,left:t.frame.x+t.frame.width/2-s.width/2,top:gx(l,t.frame,s.height)},c=n?.barLabelColor??r.textColor??"#0f172a",u=[];return a&&u.push(bx(e,t.id,d,c)),u.push(yx(e,t.id,d,i,l,o,c)),u}var gi={angle:45,spacing:7,width:1.5},Rx=2;function kx(e,t,r,n,o,i){let a=o*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+n/2},c=Math.hypot(r,n)/2,u=[];for(let p=-c;p<=c;p+=i){let f=d.x+l.x*p,g=d.y+l.y*p;u.push(`M ${f-s.x*c} ${g-s.y*c} L ${f+s.x*c} ${g+s.y*c}`)}return u.join(" ")}function It(e,t){if(et(e))return{type:"path",d:ke(t.x,t.y,t.width,t.height,e.chart.config?.barCornerRadius??2)}}function et(e){return e.chart.config?.barTrack===!0}function Gt(e,t,r,n="vertical"){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=o.config,d=l?.barCornerRadius??2,c=m(l?.barSegments,0),u=c>0?Ae(r,n,c,m(l?.barSegmentGap,4),d,1,!0):ke(r.x,r.y,r.width,r.height,d),p=[{type:"path",id:`chart-bar-track-${o.id}-${t}`,order:s(),bounds:i,d:u,style:{fill:k(l?.barTrackColor??o.gridColor??"#e2e8f0",a,o.id),pointerEvents:"none"}}];return l?.barTrackHatch&&p.push({type:"path",id:`chart-bar-track-hatch-${o.id}-${t}`,order:s(),bounds:i,d:kx(r.x,r.y,r.width,r.height,m(l.barTrackHatchAngle,gi.angle),Math.max(Rx,m(l.barTrackHatchSpacing,gi.spacing))),style:{fill:{kind:"none"},stroke:k(l.barTrackHatchColor??o.gridColor??"#cbd5e1",a,o.id),strokeWidth:m(l.barTrackHatchWidth,gi.width),pointerEvents:"none",clip:{type:"path",d:u}}}),p}function Xc(e){let t=Lx(e),r=e.chart.series.flatMap((a,s)=>Tx(e,t,a,s)),n=et(e)?r.flatMap(a=>Gt(e,`${a.seriesId}-${a.valueIndex}`,{x:a.frame.x,y:e.plot.y,width:a.frame.width,height:e.plot.height})):[],o=r.flatMap(a=>$x(e,a)),i=Ot(e)?r.flatMap(a=>vx(e,a,r)):[];return[...n,...o,...r.flatMap(a=>Px(e,a)),...i]}function wx(e,t){let r=t.filter(n=>n.seriesId===e.seriesId).map(n=>n.value);return e.value>=Math.max(...r)}function vx(e,t,r){let{chart:n}=e;return n.config?.barLabelMaxOnly&&!wx(t,r)?[]:Bt(e,{id:`chart-bar-label-${n.id}-${t.seriesId}-${t.valueIndex}`,value:t.value,frame:t.frame,placement:n.config?.barLabelPosition??"outside"})}function qc(e,t){let{chart:r,plot:n}=e,o=r.config,i=o?.barCornerRadius??2,a=m(o?.barSegments,0);return a>0?Ae({x:t.x,y:n.y,width:t.width,height:n.height},"vertical",a,m(o?.barSegmentGap,4),i,t.height/n.height,o?.barSegmentSnap!==!1):qe(t.x,t.y,t.width,t.height,i,o?.barRoundedBottom===!0)}function Px(e,t){let{chart:r}=e,n=m(r.config?.barGlow,0);if(n<=0||t.frame.height<=0)return[];let o=qc(e,t.frame);return[Nt(e,`chart-bar-glow-${r.id}-${t.seriesId}-${t.valueIndex}`,o,t.color,n)]}function Lx(e){let{chart:t,plot:r}=e,n=ue(t),o=r.width/n,i=Math.min(Math.max(0,m(t.config?.barGroupGap,8)),Math.max(0,o-1)),a=Math.max(0,m(t.config?.barGap,2));return{slotWidth:o,seriesWidth:Math.max(1,(o-i)/Math.max(1,t.series.length)),groupGap:i,barGap:a}}function Tx(e,t,r,n){let{chart:o,plot:i}=e,a=r.color??$[n%$.length];return r.values.map((s,l)=>{let d=Array.isArray(s)?s[1]:s,c=Math.max(0,T(d,o.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+n*t.seriesWidth,y:i.y+i.height-c,width:Math.max(1,t.seriesWidth-t.barGap),height:c}}})}function $x(e,t){let r=Ax(e,t),n=Ex(e,t);return n&&r.push(n),r}function Mx(e){let{x:t,y:r,width:n,height:o}=e;return`M ${t} ${r} H ${t+n} V ${r+o} H ${t} Z`}function Ax(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=r.config?.barCornerRadius??2,{x:l,width:d}=t.frame,c=qc(e,t.frame),u=k(t.color,i,r.id),p=k(r.config?.barBorderColor||"#000000",i,r.id),f=m(r.config?.barBorderWidth,0),g=O(r.shadowStyle),b=g?{type:"path",id:`chart-bar-shadow-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:o,d:c,style:{fill:u,stroke:p,strokeWidth:f,shadow:g,clip:It(e,{x:l,y:n.y,width:d,height:n.height})??{type:"path",d:Mx(n)}}}:void 0,x={type:"path",id:`chart-bar-${r.id}-${t.seriesId}-${t.valueIndex}`,order:a(),bounds:o,d:c,detail:{of:"chartValue",series:t.seriesId,valueIndex:t.valueIndex,mark:"bar",radius:s,colorProp:At(t.seriesId,t.valueIndex),hasColorOverride:t.hasColorOverride},prop:te(t.seriesId,t.valueIndex),style:{fill:u,stroke:p,strokeWidth:f,innerShadow:g}},C=Et(e,`${t.seriesId}-${t.valueIndex}`,c);return b?[b,...C,x]:[...C,x]}function Ex(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=ir(t.value,t.error);return ar({id:`chart-bar-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.frame.x+t.frame.width/2,startY:n.y+n.height-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:r.textColor??"#0f172a",valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function Nx(e,t,r,n,o){let{chart:i,plot:a}=e,s=vt(t,a,n)+t.labelRow;if(e.stackedMode){let u=cr(i,e.stackedMode,n,r,a.width),p=Math.min(u.pixelStart,u.pixelEnd);return{x:a.x+p,y:s,width:Math.max(1,Math.abs(u.pixelEnd-u.pixelStart)),height:t.barsHeight}}let l=Math.max(0,m(i.config?.barGap,2)),d=t.barsHeight/Math.max(1,i.series.length),c=Math.max(0,T(o,i.axisY,a.width));return{x:a.x,y:s+r*d,width:c,height:Math.max(1,d-l)}}function Ox(e,t){let{chart:r,plot:n}=e,o=r.config,i=e.stackedMode&&r.series.length>1?0:m(o?.barSegments,0);return i>0?Ae({x:n.x,y:t.y,width:n.width,height:t.height},"horizontal",i,m(o?.barSegmentGap,4),o?.barCornerRadius??2,t.width/n.width,o?.barSegmentSnap!==!1):ke(t.x,t.y,t.width,t.height,o?.barCornerRadius??2)}function Bx(e,t,r,n,o,i){let{plot:a}=e,s=Nx(e,t,n,o,i);return{id:`${r.id}-${o}`,series:r,seriesIndex:n,valueIndex:o,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:Ox(e,s),color:r.colors?.[o]??r.color??$[n%$.length]}}function Ix(e,t){let{chart:r,diagnostics:n,nextOrder:o}=e,i=r.config,a=k(i?.barBorderColor||"#000000",n,r.id),s=m(i?.barBorderWidth,0),l=O(r.shadowStyle),d=k(t.color,n,r.id),c=[...Et(e,t.id,t.path)];return l&&c.push({type:"path",id:`chart-bar-shadow-${r.id}-${t.id}`,order:o(),bounds:t.bounds,d:t.path,style:{fill:d,stroke:a,strokeWidth:s,shadow:l,clip:It(e,t.trackFrame)}}),c.push({type:"path",id:`chart-bar-${r.id}-${t.id}`,order:o(),bounds:t.bounds,d:t.path,detail:{of:"chartValue",series:t.series.id,valueIndex:t.valueIndex,mark:"bar",radius:i?.barCornerRadius??2,colorProp:At(t.series.id,t.valueIndex),hasColorOverride:t.series.colors?.[t.valueIndex]!=null},style:{fill:d,stroke:a,strokeWidth:s,innerShadow:l}}),c}function Gx(e,t,r){let{chart:n}=e,o=n.config,i=Ot(e)&&(!o?.barLabelMaxOnly||t.value>=r),a=t.seriesIndex===n.series.length-1;return!i||e.stackedMode&&!a&&o?.barLabelPosition==="outside"?[]:Bt(e,{id:`chart-bar-label-${n.id}-${t.id}`,value:t.value,frame:t.frame,placement:o?.barLabelPosition??"outside",horizontal:!0})}function Dx(e,t,r,n,o,i,a,s){let{chart:l}=e,d=Bx(e,t,n,o,i,a);et(e)&&(!e.stackedMode||o===0)&&r.tracks.push(...Gt(e,d.id,d.trackFrame,"horizontal")),r.bars.push(...Ix(e,d));let c=m(l.config?.barGlow,0);c>0&&d.frame.width>0&&r.glows.push(Nt(e,`chart-bar-glow-${l.id}-${d.id}`,d.path,d.color,c,d.bounds)),r.labels.push(...Gx(e,d,s))}function Kc(e){let t=wt(e.chart,e.plot),r={tracks:[],bars:[],glows:[],labels:[]};return e.chart.series.forEach((n,o)=>{let i=n.values.map(s=>typeof s=="number"?s:s[1]),a=Math.max(...i);i.forEach((s,l)=>{Dx(e,t,r,n,o,l,s,a)})}),[...r.tracks,...r.bars,...r.glows,...r.labels]}function _x(e,t){let{chart:r,plot:n}=e,o=n.width/ue(r),i=Math.min(Math.max(0,m(r.config?.barGroupGap,8)),Math.max(0,o-1));return{slotWidth:o,groupGap:i,barWidth:Math.max(1,o-i),cornerRadius:r.config?.barCornerRadius??2,outerSeriesIndex:t==="waterfall"?null:r.series.length-1}}function Fx(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=a.series.length===1?m(a.config?.barSegments,0):0;return l>0?Ae({x:t,y:s.y,width:o.barWidth,height:s.height},"vertical",l,m(a.config?.barSegmentGap,4),i,n/s.height,a.config?.barSegmentSnap!==!1):qe(t,r,o.barWidth,n,i,a.config?.barRoundedBottom===!0)}function Hx(e,t,r,n,o,i,a){let{chart:s}=e,l=s.config;if(!(Ot(e)&&!(l?.barLabelMaxOnly&&!Yx(r.values,o))&&(l?.barLabelPosition!=="axis"||n===i.outerSeriesIndex)))return;let c=l?.barLabelPosition??"outside",u=r.values[o];t.labels.push(...Bt(e,{id:`chart-bar-label-${s.id}-${r.id}-${o}`,value:Array.isArray(u)?u[1]:u??0,frame:a,placement:c==="outside"&&n!==i.outerSeriesIndex?"center":c}))}function Vx(e,t,r,n,o,i){let{chart:a,plot:s}=e,l=cr(a,t,i,o,s.height),d=r.outerSeriesIndex===null||o===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),p=Math.max(1,Math.abs(l.pixelEnd-l.pixelStart));return{series:n,valueIndex:i,radius:d,color:n.colors?.[i]??n.color??$[o%$.length],x:c,y:u,height:p,path:Fx(e,c,u,p,r,d),column:{x:c,y:s.y,width:r.barWidth,height:s.height}}}function Wx(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e,{series:s,valueIndex:l,path:d}=t,c=k(t.color,i,r.id),u=k(r.config?.barBorderColor||"#000000",i,r.id),p=m(r.config?.barBorderWidth,0),f=O(r.shadowStyle),g=[];if(f){let b=`M ${n.x} ${n.y} H ${n.x+n.width} V ${n.y+n.height} H ${n.x} Z`;g.push({type:"path",id:`chart-bar-shadow-${r.id}-${s.id}-${l}`,order:a(),bounds:o,d,style:{fill:c,stroke:u,strokeWidth:p,shadow:f,clip:It(e,t.column)??{type:"path",d:b}}})}return g.push(...Et(e,`${s.id}-${l}`,d)),g.push({type:"path",id:`chart-bar-${r.id}-${s.id}-${l}`,order:a(),bounds:o,d,detail:{of:"chartValue",series:s.id,valueIndex:l,mark:"bar",radius:t.radius,colorProp:At(s.id,l),hasColorOverride:s.colors?.[l]!=null},prop:te(s.id,l),style:{fill:c,stroke:u,strokeWidth:p,innerShadow:f}}),g}function zx(e,t,r,n,o,i,a){let{chart:s}=e,l=Vx(e,t,n,o,i,a);i===0&&et(e)&&r.tracks.push(...Gt(e,String(a),l.column)),r.bars.push(...Wx(e,l));let d={x:l.x,y:l.y,width:n.barWidth,height:l.height};Hx(e,r,o,i,a,n,d);let c=m(s.config?.barGlow,0);c>0&&r.glows.push(Nt(e,`chart-bar-glow-${s.id}-${o.id}-${a}`,l.path,l.color,c))}function Zc(e,t){let{chart:r}=e,n={tracks:[],bars:[],glows:[],labels:[]},o=_x(e,t),i=ue(r);for(let a=0;a<i;a++)r.series.forEach((s,l)=>{zx(e,t,n,o,s,l,a)});return[...n.tracks,...n.bars,...n.glows,...n.labels]}function Yx(e,t){let r=e.map(n=>typeof n=="number"?n:n[1]);return r[t]>=Math.max(...r)}function Qc(e){return ee(e.chart)?Kc(e):e.stackedMode?Zc(e,e.stackedMode):Xc(e)}function Jc(e){let{chart:t,plot:r}=e,n=t.config?.orientation??"vertical",o=Math.max(1,t.series.length),i=(n==="horizontal"?r.height:r.width)/o,a=N(t.config?.barBorderColor,"#000000"),s=Math.min(1,Math.max(.05,t.config?.boxWidth??.6));return{orientation:n,slotWidth:i,boxWidth:Math.max(4,i*s),cornerRadius:t.config?.barCornerRadius??2,showPoints:t.config?.showBoxplotPoints??!0,borderColor:a,borderWidth:m(t.config?.barBorderWidth,1),whiskerWidth:Math.max(0,m(t.config?.boxWhiskerWidth,1)),medianWidth:Math.max(0,m(t.config?.boxMedianWidth,2)),medianColor:t.config?.boxMedianColor??a,whiskerColor:t.config?.boxWhiskerColor,capSize:Math.max(0,m(t.config?.boxCapSize,.4)),pointSize:Math.max(0,m(t.config?.boxPointSize,3)),pointOpacity:Math.min(1,Math.max(0,m(t.config?.boxPointOpacity,.7))),jitter:Math.max(0,m(t.config?.boxJitter,1))}}function oe(e,t,r){return e==="horizontal"?{x:r,y:t}:{x:t,y:r}}function eu(e,t,r,n){let{chart:o,plot:i}=e,{orientation:a}=t,s=d=>a==="horizontal"?i.x+T(d,o.axisX,i.width):i.y+i.height-T(d,o.axisY,i.height);return{center:i[a==="horizontal"?"y":"x"]+r*t.slotWidth+t.slotWidth/2,min:s(n.min),q1:s(n.q1),median:s(n.median),q3:s(n.q3),max:s(n.max)}}function tu(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=d=>t.orientation==="horizontal"?o.x+T(d,n.axisX,o.width):o.y+o.height-T(d,n.axisY,o.height);return t.pointSize<=0?[]:r.series.values.map((d,c)=>{let u=r.geometry.center+Ux(r.seriesIndex*1e4+c)*t.jitter*t.boxWidth,{x:p,y:f}=oe(t.orientation,u,l(d));return{type:"ellipse",id:`chart-box-point-${r.id}-${c}`,order:s(),bounds:i,cx:p,cy:f,rx:t.pointSize,ry:t.pointSize,style:{fill:k(r.color,a,n.id),opacity:t.pointOpacity}}})}function Ux(e){let t=Math.sin(e*12.9898)*43758.5453;return t-Math.floor(t)-.5}function nu(e,t,r){let n=t.whiskerWidth>0?[Xx(t,r),qx(t,r)]:[],o=t.whiskerWidth>0&&t.capSize>0?[Kx(t,r),Zx(t,r)]:[],i=t.medianWidth>0?[Qx(t,r)]:[];return[...[...n,...o].map(a=>ru(e,t,{...a,color:jx(t,r)})),Jx(e,t,r),...i.map(a=>ru(e,t,a))]}function jx(e,t){return e.whiskerColor==="series"?N(t.color,e.borderColor):e.whiskerColor}function Xx(e,t){let{center:r,min:n,q1:o}=t.geometry;return{id:`chart-box-whisker-lo-${t.id}`,from:oe(e.orientation,r,n),to:oe(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function qx(e,t){let{center:r,q3:n,max:o}=t.geometry;return{id:`chart-box-whisker-hi-${t.id}`,from:oe(e.orientation,r,n),to:oe(e.orientation,r,o),strokeWidth:e.whiskerWidth}}function Kx(e,t){return ou(`chart-box-cap-lo-${t.id}`,e,t.geometry.center,t.geometry.min)}function Zx(e,t){return ou(`chart-box-cap-hi-${t.id}`,e,t.geometry.center,t.geometry.max)}function ou(e,t,r,n){let o=t.boxWidth*t.capSize/2;return{id:e,from:oe(t.orientation,r-o,n),to:oe(t.orientation,r+o,n),strokeWidth:t.whiskerWidth}}function Qx(e,t){let r=e.boxWidth/2;return{id:`chart-box-median-${t.id}`,from:oe(e.orientation,t.geometry.center-r,t.geometry.median),to:oe(e.orientation,t.geometry.center+r,t.geometry.median),strokeWidth:e.medianWidth,color:e.medianColor}}function ru(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 Jx(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,{geometry:s}=r,l=t.boxWidth/2,d=oe(t.orientation,s.center-l,s.q1),c=oe(t.orientation,s.center+l,s.q3),u=Math.min(d.x,c.x),p=Math.min(d.y,c.y),f=Math.max(1,Math.abs(c.x-d.x)),g=Math.max(1,Math.abs(c.y-d.y));return{type:"rect",id:`chart-box-${r.id}`,order:a(),bounds:o,x:u,y:p,width:f,height:g,rx:t.cornerRadius,style:{fill:k(r.color,i,n.id),stroke:{kind:"solid",color:t.borderColor},strokeWidth:t.borderWidth}}}function iu(e,t,r,n){let o=ni(r.values);if(!o)return[];let i=eu(e,t,n,o),a=r.color??$[n%$.length],s={id:`${e.chart.id}-${r.id}`,series:r,seriesIndex:n,color:a,geometry:i},l=nu(e,t,s);return t.showPoints&&l.push(...tu(e,t,s)),l}function au(e){let t=Jc(e),r=[];return e.chart.series.forEach((n,o)=>{r.push(...iu(e,t,n,o))}),r}var e0="#94a3b8",su=8,bi=140;function du(e){return e.chart.config?.connectPoints&&e.chart.series.length>=2?o0(e):e.chart.series.flatMap((t,r)=>t0(e,t,r))}function t0(e,t,r){let n=r0(e,t,r);return yi(e,t).map((o,i)=>{let a=xi(e,o),s={series:t,valueIndex:i,point:a,style:n};return t.symbol?.points.length?n0(e,s):Si(e,s)})}function Ci(e){return e.config?.orientation==="horizontal"}function yi(e,t){let{chart:r}=e;return t.values.length>0&&Array.isArray(t.values[0])?t.values.map(o=>[o[0],o[1]]):Ci(r)?t.values.map((o,i)=>[o,r.axisY.min+i*r.axisY.step]):t.values.map((o,i)=>[r.axisX.min+i*r.axisX.step,o])}function lu(e,t){return Ci(e)?t[0]:t[1]}function xi(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 r0(e,t,r){let n=t.color??$[r%$.length];return{fill:k(n,e.diagnostics,e.chart.id),stroke:t.stroke?{kind:"solid",color:t.stroke}:void 0,strokeWidth:t.stroke?m(t.strokeWidth,1):void 0}}function n0(e,t){let r=t.series.symbol,n=m(t.series.size,3),o=r?.normalized?n*2:1,i=r?.normalized?.5:0,a=(r?.points??[]).map(([s,l])=>({x:t.point.x+(s-i)*o,y:t.point.y+(l-i)*o}));return{type:"path",id:cu(e.chart,t.series,t.valueIndex),order:e.nextOrder(),bounds:e.bounds,d:fe({points:a,tension:m(r?.tension,0),closed:!0}),style:t.style}}function Si(e,t){let r=m(t.series.size,3);return{type:"ellipse",id:cu(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 cu(e,t,r){return`chart-custom-mark-${e.id}-${t.id}-${r}`}function o0(e){let{chart:t}=e,[r,n]=t.series,o=yi(e,r),i=yi(e,n),a=t.config?.zones??[],s=a[0]?.color??"#10b981",l=a[1]?.color??"#ec4899",d=a[2]?.color??z,c=!!t.config?.reverseComparison,u=Math.min(o.length,i.length),p=t.config?.categories??[],f=[];for(let g=0;g<u;g++){let b=o[g],x=i[g],C=xi(e,b),L=xi(e,x),v=lu(t,b),M=lu(t,x),H=c?M<v:M>v,I=c?M>v:M<v,V=H?s:I?l:d,U=m(n.size,3);f.push(a0(e,g,C,L,V)),f.push(Si(e,{series:r,valueIndex:g,point:C,style:{fill:k(t.config?.customBeforeFill??t.gridColor??"#e2e8f0",e.diagnostics,t.id),stroke:{kind:"solid",color:t.config?.customBeforeStroke??e0},strokeWidth:m(t.config?.customBeforeStrokeWidth,1.5)}})),f.push(Si(e,{series:n,valueIndex:g,point:L,style:{fill:k(V,e.diagnostics,t.id),stroke:void 0,strokeWidth:void 0}})),e.showLabels&&p[g]&&f.push(s0(e,g,C,L,U,p[g]))}return f}function i0(e){let t=(e??"").split(/[ ,]+/).map(Number).filter(r=>Number.isFinite(r)&&r>0);return t.length>0?t:void 0}function a0(e,t,r,n,o){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 ${n.x} ${n.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:o},strokeWidth:m(i.config?.customConnectorWidth,2),opacity:i.config?.customConnectorOpacity,dash:i0(i.config?.customConnectorDash)}}}function s0(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=Ci(a),c=d?{x:Math.max(r.x,n.x)+o+su,y:Math.min(r.y,n.y)-8,width:bi,height:16}:{x:Math.min(r.x,n.x)-bi/2,y:Math.min(r.y,n.y)-o-su-14,width:bi,height:16};return{...w({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,m(a.config?.customLabelSize,Math.max(9,m(a.fontSize,12))-2)),...a.config?.customLabelColor?{color:a.config.customLabelColor}:{}}}function mu(e){let{chart:t,plot:r}=e,n=t.series.filter(a=>uu(a.values[0])===3),o=t.series.filter(a=>uu(a.values[0])===4);return{scalarSamples:n.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:o}}function uu(e){return Array.isArray(e)?e.length:void 0}function pu(e){let t=e.chart.config?.scale?.stops;if(!e.showLegend||!t?.length)return[];let r=[...t].sort((a,s)=>a.position-s.position),n=r[0].position,o=r[r.length-1].position,i=l0(e);return[d0(e,r,n,o,i),...c0(e,n,o,i)]}function l0(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 d0(e,t,r,n,o){let{chart:i,bounds:a,nextOrder:s}=e,l=n-r;return{type:"rect",id:`chart-field-colorbar-${i.id}`,order:s(),bounds:a,x:o.x,y:o.y,width:o.width,height:o.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 c0(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=n.y+n.height+3;return[w({id:`chart-field-colorbar-min-${o.id}`,order:a(),bounds:i,frame:{x:n.x,y:s,width:80,height:16},text:he(t),chart:o}),w({id:`chart-field-colorbar-max-${o.id}`,order:a(),bounds:i,frame:{x:n.x+n.width-80,y:s,width:80,height:16},text:he(r),chart:o,align:"right"})]}var u0="#94a3b8";function xn(e,t){return e?.stops.length?Qt(e.stops,t):u0}function fu(e){if(e.length===0)return[];let t=s=>`${Math.round(s[0]*1e3)}:${Math.round(s[1]*1e3)}`,r=new Map,n=(s,l,d)=>{let c=t(s),u=r.get(c),p={point:l,segment:d};u?u.push(p):r.set(c,[p])};e.forEach((s,l)=>{let d=[s.x1,s.y1],c=[s.x2,s.y2];n(d,c,l),n(c,d,l)});let o=new Array(e.length).fill(!1),i=(s,l)=>{let d=l;for(;;){let u=r.get(t(d))?.find(p=>!o[p.segment]);if(!u)return;o[u.segment]=!0,s.push(u.point),d=u.point}},a=[];return e.forEach((s,l)=>{if(o[l])return;o[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 hu(e,t){let r=[];for(let n=0;n<e.rows-1;n++)for(let o=0;o<e.columns-1;o++){let i=m0(e,n,o),a=p0(i,t);a!==0&&a!==15&&r.push(...f0(i,a,t))}return r}function m0(e,t,r){return{topLeft:Sn(e,t,r),topRight:Sn(e,t,r+1),bottomRight:Sn(e,t+1,r+1),bottomLeft:Sn(e,t+1,r)}}function Sn(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 p0(e,t){return(Cn(e.topLeft,t)?8:0)|(Cn(e.topRight,t)?4:0)|(Cn(e.bottomRight,t)?2:0)|(Cn(e.bottomLeft,t)?1:0)}function Cn(e,t){return e.value>=t}function f0(e,t,r){let n=h0(e,r);switch(t){case 1:case 14:return[ve(n.left,n.bottom)];case 2:case 13:return[ve(n.bottom,n.right)];case 3:case 12:return[ve(n.left,n.right)];case 4:case 11:return[ve(n.top,n.right)];case 5:return[ve(n.left,n.top),ve(n.bottom,n.right)];case 6:case 9:return[ve(n.top,n.bottom)];case 7:case 8:return[ve(n.left,n.top)];case 10:return[ve(n.top,n.right),ve(n.left,n.bottom)];default:return[]}}function h0(e,t){return{top:Rn(e.topLeft,e.topRight,t),right:Rn(e.topRight,e.bottomRight,t),bottom:Rn(e.bottomLeft,e.bottomRight,t),left:Rn(e.topLeft,e.bottomLeft,t)}}function Rn(e,t,r){let n=t.value===e.value?.5:(r-e.value)/(t.value-e.value);return[e.x+(t.x-e.x)*n,e.y+(t.y-e.y)*n]}function ve(e,t){return{x1:e[0],y1:e[1],x2:t[0],y2:t[1]}}var g0=.5;function gu(e,t){if(!t.length||e.plot.width<=0||e.plot.height<=0)return[];let r=b0(e,t);return[...y0(e,r),...S0(e,r)]}function b0(e,t){let{plot:r,chart:n}=e,o=_c(t,r.width,r.height,n.config?.idwPower??2);return{values:o.grid,columns:o.cols,rows:o.rows,cellWidth:r.width/Math.max(1,o.cols-1),cellHeight:r.height/Math.max(1,o.rows-1)}}function y0(e,t){let r=[];for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)r.push(x0(e,t,n,o));return r}function x0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=i.x+i.width*(n/(t.columns-1)),d=i.y+i.height*(r/(t.rows-1)),c=xn(o.config?.scale,t.values[r*t.columns+n]);return{type:"rect",id:`chart-field-cell-${o.id}-${r}-${n}`,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:ur(o,i)}}}function S0(e,t){let r=[];return(e.chart.config?.isolines??[]).forEach((n,o)=>{let i=C0(e,t,n,o);i&&r.push(i)}),r}function C0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=hu({values:t.values,columns:t.columns,rows:t.rows,width:i.width,height:i.height},r);if(!l.length)return null;let c=fu(l).map(u=>Pt(u.map(([p,f])=>({x:i.x+p,y:i.y+f})),g0)).join(" ");return{type:"path",id:`chart-field-isoline-${o.id}-${n}`,order:s(),bounds:a,d:c,style:{fill:{kind:"none"},stroke:{kind:"solid",color:"rgba(15, 23, 42, 0.55)"},strokeWidth:1,clip:ur(o,i)}}}function bu(e,t){let r=[];return t.forEach((n,o)=>{let i=n.color??$[o%$.length];n.values.forEach((a,s)=>{r.push(R0(e,n.id,a,s,i))})}),r}function R0(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,[c,u,p,f]=r,g=a.x+T(c,i.axisX,a.width),b=a.y+a.height-T(u,i.axisY,a.height),x=a.x+T(c+Math.cos(p)*f,i.axisX,a.width),C=a.y+a.height-T(u+Math.sin(p)*f,i.axisY,a.height);return{type:"path",id:`chart-field-vector-${i.id}-${t}-${n}`,order:d(),bounds:s,d:`M ${g} ${b} L ${x} ${C}`,markerEnd:"filled_arrow",style:{fill:{kind:"none"},stroke:k(o,l,i.id),strokeWidth:2}}}function yu(e){let t=mu(e),r=[];return r.push(...gu(e,t.scalarSamples)),r.push(...bu(e,t.vectorSeries)),r.push(...pu(e)),r}function xu(e,t){let r=[];return t.rows.forEach((n,o)=>{r.push(...k0(e,t,n,o))}),r}function k0(e,t,r,n){return t.columns.flatMap((o,i)=>{let a=w0(t,r,n,i);return P0(e,t,a)})}function w0(e,t,r,n){let o=t.values[n]??0,{cellGap:i}=e.grid;return{seriesId:t.id,columnIndex:n,value:o,color:v0(o,e),frame:{x:e.grid.x+n*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 v0(e,t){return nr(e,t.bands,t.zones)}function P0(e,t,r){let n=L0(e,t,r);return e.chart.config?.showValues===!1?[n]:[n,T0(e,t,r)]}function L0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=`chart-heatmap-cell-${n.id}-${r.seriesId}-${r.columnIndex}`,s={fill:{kind:"solid",color:r.color},stroke:{kind:"solid",color:n.config?.cellStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:m(n.config?.cellStrokeWidth,m(n.gridWidth,1))};return n.config?.cellShape==="circle"?{type:"ellipse",id:a,order:i(),bounds:o,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:o,...r.frame,rx:t.grid.cellRadius,style:s}}function T0(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=Math.max(6,m(n.config?.cellValueSize,t.fontSize));return{...w({id:`chart-heatmap-value-${n.id}-${r.seriesId}-${r.columnIndex}`,order:i(),bounds:o,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:n,align:"center"}),...n.config?.cellValueSize===void 0?{}:{fontSize:a},color:n.config?.cellValueColor??J(r.color)}}function Su(e,t){return[...$0(e,t),...A0(e,t)]}function $0(e,t){return t.reservedSpace.rowHeaders<=0?[]:t.rows.map((r,n)=>M0(e,t,r,n))}function M0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return w({id:`chart-heatmap-row-${o.id}-${r.id}`,order:s(),bounds:a,frame:{x:i.x,y:t.grid.y+n*t.grid.cellHeight+t.grid.cellHeight/2-t.fontSize/2,width:t.reservedSpace.rowHeaders-8,height:t.fontSize+2},text:r.label,chart:o})}function A0(e,t){return t.reservedSpace.columnHeaders<=0?[]:t.columns.map((r,n)=>E0(e,t,r,n))}function E0(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return w({id:`chart-heatmap-col-${o.id}-${n}`,order:s(),bounds:a,frame:{x:t.grid.x+n*t.grid.cellWidth,y:i.y,width:t.grid.cellWidth,height:t.fontSize+2},text:r,chart:o,align:"center"})}function Cu(e){let{chart:t}=e,r=N0(e),n=O0(e);return{rows:t.series,columns:r,bands:rr(t.axisY),zones:t.config?.zones?.length?t.config.zones:tr,fontSize:Math.max(9,m(t.fontSize,12)),reservedSpace:n,grid:B0(e,n,r.length)}}function N0(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function O0(e){let{chart:t}=e,r=Math.max(9,m(t.fontSize,12)),n=t.series.reduce((o,i)=>Math.max(o,Me(i.label??"",r,!1)),0);return{rowHeaders:e.showLabels?Math.min(96,n+12):0,columnHeaders:e.showLabels?24:0,legend:e.showLegend?38:0}}function B0(e,t,r){let{chart:n}=e,o=Math.max(1,e.plot.width-t.rowHeaders),i=Math.max(1,e.plot.height-t.columnHeaders-t.legend),a=n.series.length,s=Math.max(0,m(n.config?.cellGap,0)),l=r?o/r:o,d=a?i/a:i,c=o,u=i;if(n.config?.squareCells&&r&&a){let p=Math.min(l,d);l=p,d=p,c=p*r,u=p*a}return{x:e.plot.x+t.rowHeaders,y:e.plot.y+t.columnHeaders,width:c,height:u,cellWidth:l,cellHeight:d,cellGap:s,cellRadius:Math.max(0,m(n.config?.barCornerRadius,s))}}var pr=10,Ru=4,I0=2;function ku(e,t){if(t.reservedSpace.legend<=0||t.zones.length===0)return[];let r=t.grid.x,n=t.grid.width,o=t.fontSize+2,i=t.grid.y+t.grid.height+6,a=Q({x:r,y:i,width:n,height:pr});return[G0(e,t,r,i,n,a),...D0(e,t,r,i,n,o)]}function wu(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function G0(e,t,r,n,o,i){let{chart:a,nextOrder:s}=e,l=Math.max(0,t.bands.length-1),c=t.zones.slice(0,l).map((u,p)=>({offset:wu(t,t.bands[p+1]??t.bands[t.bands.length-1])*100,color:u.color??z}));return{type:"rect",id:`chart-heatmap-legend-bar-${a.id}`,order:s(),bounds:i,x:r,y:n,width:o,height:pr,rx:3,zoneGradient:{axis:"y",min:a.axisY.min,max:a.axisY.max},style:{fill:c.length?{kind:"linear-gradient",angle:0,stops:c}:{kind:"solid",color:z},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}}}function D0(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,d=n+pr+Ru+I0,c=48;return t.bands.flatMap((u,p)=>{let f=r+wu(t,u)*o,g={type:"path",id:`chart-heatmap-legend-tick-${a.id}-${p}`,order:l(),bounds:s,d:`M ${f} ${n+pr} L ${f} ${n+pr+Ru}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:a.gridColor??"#e2e8f0"},strokeWidth:1}},b=p===0,x=p===t.bands.length-1,C=b?"left":x?"right":"center",L=b?f:x?f-c:f-c/2,v=w({id:`chart-heatmap-legend-tick-label-${a.id}-${p}`,order:l(),bounds:s,frame:{x:L,y:d,width:c,height:i},text:he(u),chart:a,align:C});return[g,v]})}function vu(e){let t=Cu(e),r=[];return r.push(...xu(e,t)),r.push(...Su(e,t)),r.push(...ku(e,t)),r}function Ri(e,t){if(t<=0||e.length===0)return[];let r=t*1.5,n=t*Math.sqrt(3),o=new Map;for(let{x:i,y:a}of e){let s=Math.round(i/r),l=s%2!==0?n/2:0,d=Math.round((a-l)/n),c=`${s}:${d}`,u=o.get(c);u?u.count++:o.set(c,{cx:s*r,cy:d*n+l,count:1})}return[...o.values()]}function Pu(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 n=!1;for(let o of e.links){let i=(t.get(o.source)??0)+1;i>(t.get(o.target)??0)&&(t.set(o.target,i),n=!0)}if(!n)break}return t}function Lu(e,t){let r=new Map;for(let n of e){let o=t.get(n)??0,i=r.get(o)??[];i.push(n),r.set(o,i)}return r}function Tu(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 n=new Map,o=new Map;for(let a of r)n.set(a,[]),o.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)o.get(a.source)?.push(a),n.get(a.target)?.push(a);return{ids:r,links:i,incoming:n,outgoing:o}}function F0(e){let t=new Map;for(let r of e.ids){let n=(e.incoming.get(r)??[]).reduce((i,a)=>i+a.value,0),o=(e.outgoing.get(r)??[]).reduce((i,a)=>i+a.value,0);t.set(r,Math.max(n,o,1e-4))}return t}function H0(e,t,r,n){let o=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)*n,l=Math.max(1,r-s);a>0&&(o=Math.min(o,l/a))}return!Number.isFinite(o)||o<=0?1:o}function fr(e,t,r,n=18){return t<=1?0:e*(r-n)/(t-1)}function $u(e,t,r,n=8){let o=Lu(e.ids,t),i=F0(e),a=H0(o,i,r,n),s=new Map,l=new Map;for(let d of o.values()){let c=0;for(let u of d){let p=Math.max(2,(i.get(u)??0)*a);s.set(u,c),l.set(u,p),c+=p+n}}return{columns:t,y:s,heights:l,valueScale:a,columnCount:Math.max(1,...[...t.values()].map(d=>d+1))}}function Mu(e,t,r,n,o=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=n.get(s.source),c=n.get(s.target),u=(t.y.get(s.source)??0)+(d?.y??0),p=(t.y.get(s.target)??0)+(c?.y??0),f=i.get(s.source)??0,g=a.get(s.target)??0;return i.set(s.source,f+l),a.set(s.target,g+l),{source:s.source,target:s.target,value:s.value,color:s.color,x0:fr(t.columns.get(s.source)??0,t.columnCount,r,o)+o+(d?.x??0),x1:fr(t.columns.get(s.target)??0,t.columnCount,r,o)+(c?.x??0),sourceY0:u+f,sourceY1:u+f+l,targetY0:p+g,targetY1:p+g+l}})}function Au(e,t,r,n,o,i=18){return[...t.ids].map(a=>{let s=e.find(c=>c.id===a),l=r.columns.get(a)??0,d=o.get(a);return{id:a,label:s?.label??a,color:s?.color,x:fr(l,r.columnCount,n,i)+(d?.x??0),y:(r.y.get(a)??0)+(d?.y??0),width:i,height:r.heights.get(a)??2,column:l}})}function V0(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 wi(e,t,r,n,o={nodeWidth:18,nodeGap:8}){let i=Tu(e,t);if(i.ids.size===0)return{nodes:[],links:[]};let a=Pu(i),s=$u(i,a,n,o.nodeGap),l=V0(e);return{nodes:Au(e,i,s,r,l,o.nodeWidth),links:Mu(i,s,r,l,o.nodeWidth)}}function hr(e,t){let r=W0(e,t);if(!r.length)return[];let n=[],o=r,i=t;for(;o.length;){let a=z0(o,Math.min(i.width,i.height)),s=Y0(a,i);n.push(...s.rectangles),o=o.slice(a.items.length),i=s.remainingBounds}return n}function W0(e,t){let r=e.filter(i=>i.value>0);if(!r.length||t.width<=0||t.height<=0)return[];let n=r.reduce((i,a)=>i+a.value,0);if(n<=0)return[];let o=t.width*t.height/n;return[...r].sort((i,a)=>a.value-i.value).map(i=>({item:i,area:i.value*o}))}function z0(e,t){let r=[e[0]];for(let n=1;n<e.length;n++){let o=[...r,e[n]];if(Eu(o,t)>Eu(r,t))break;r.push(e[n])}return{items:r,area:r.reduce((n,o)=>n+o.area,0)}}function Eu(e,t){let r=e.reduce((s,l)=>s+l.area,0);if(r<=0||t<=0)return 1/0;let n=e.map(s=>s.area),o=Math.max(...n),i=Math.min(...n),a=t*t;return Math.max(a*o/(r*r),r*r/(a*i))}function Y0(e,t){return t.width>=t.height?U0(e,t):j0(e,t)}function U0(e,t){let r=t.height>0?e.area/t.height:0,n=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:n,width:r,height:s};return n+=s,l}),remainingBounds:{x:t.x+r,y:t.y,width:t.width-r,height:t.height}}}function j0(e,t){let r=t.width>0?e.area/t.width:0,n=t.x;return{rectangles:e.items.map(({item:i,area:a})=>{let s=r>0?a/r:0,l={item:i,x:n,y:t.y,width:s,height:r};return n+=s,l}),remainingBounds:{x:t.x,y:t.y+r,width:t.width,height:t.height-r}}}var X0=.15,q0=1/Math.sqrt(3);function K0(e,t,r){let n=[];for(let o=0;o<6;o++){let i=(-60+60*o)*Math.PI/180;n.push(`${o===0?"M":"L"} ${e+r*Math.cos(i)} ${t+r*Math.sin(i)}`)}return`${n.join(" ")} Z`}function Nu(e){let{chart:t,plot:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=[],s=t.config,l=Math.max(1,s?.hexRadius??Qo),d=Math.max(.5,l-Math.max(0,s?.hexGap??0)*q0),c=s?.hexStrokeWidth??0,u=Math.min(1,Math.max(0,s?.hexMinOpacity??X0)),p=O(t.shadowStyle),f=p?`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((g,b)=>{let L=(g.values.length>0&&Array.isArray(g.values[0])?g.values:g.values.map((V,U)=>[t.axisX.min+U*t.axisX.step,V])).map(([V,U])=>({x:T(V,t.axisX,r.width),y:r.height-T(U,t.axisY,r.height)})),v=Ri(L,l),M=Math.max(1,...v.map(V=>V.count)),H=g.color??$[b%$.length],I=s?.scale;v.forEach((V,U)=>{let ne=V.count/M,Ne=I?xn(I,ne):H;a.push({type:"path",id:`chart-hexbin-${t.id}-${g.id}-${U}`,order:i(),bounds:n,d:K0(r.x+V.cx,r.y+V.cy,d),style:{fill:k(Ne,o,t.id),stroke:c>0?k(s?.hexStrokeColor??Ne,o,t.id):void 0,strokeWidth:c>0?c:void 0,opacity:I?void 0:Math.max(u,ne),shadow:p,clip:f?{type:"path",d:f}:void 0}})})}),a}function tt(e,t){return t.values.length>0&&Array.isArray(t.values[0])?t.values:t.values.map((r,n)=>[e.axisX.min+n*e.axisX.step,r])}function rt(e,t){let{chart:r,plot:n}=e;return t.map(([o,i])=>({x:n.x+T(o,r.axisX,n.width),y:n.y+n.height-T(i,r.axisY,n.height)}))}function Ou(e,t,r,n,o,i){let{chart:a,plot:s,nextOrder:l}=e,d=s.y+s.height,c=r[0],u=r[r.length-1],p=`${Pt(r,o)} L ${u.x} ${d} L ${c.x} ${d} Z`,f=Math.min(...r.map(C=>C.y)),g=(Math.min(...r.map(C=>C.x))+Math.max(...r.map(C=>C.x)))/2,b=(d-f)/2,x={minX:g-b,maxX:g+b,minY:f,maxY:d};return{type:"path",id:`chart-line-area-${a.id}-${t.id}`,order:l(),bounds:x,d:p,detail:{of:"chartSeries",series:t.id},style:{fill:{kind:"linear-gradient",angle:90,stops:[{offset:0,color:oi(n,i)},{offset:100,color:oi(n,0)}]},stroke:{kind:"none"},pointerEvents:"none"}}}function Z0(e,t,r){return(e||"{value}").replace("{category}",t).replace("{value}",String(Math.round(r*100)/100))}function Q0(e,t){let{chart:r,plot:n,bounds:o,diagnostics:i,nextOrder:a}=e;return{type:"path",id:`chart-highlight-guide-${t.key}`,order:a(),bounds:o,d:`M ${t.point.x} ${t.point.y} V ${n.y+n.height}`,style:{fill:{kind:"none"},stroke:k(t.color,i,r.id),strokeWidth:1,dash:[3,4],opacity:.55,pointerEvents:"none"}}}function J0(e,t){let{chart:r,bounds:n,diagnostics:o,nextOrder:i}=e,a=r.config?.lineGlow;return{type:"ellipse",id:`chart-highlight-${t.key}`,order:i(),bounds:n,cx:t.point.x,cy:t.point.y,rx:t.radius,ry:t.radius,style:{fill:k(t.color,o,r.id),shadow:a?{color:t.color,opacity:.9,blur:a,dx:0,dy:0}:void 0,pointerEvents:"none"}}}function eS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=n.config,s=Math.max(9,n.fontSize??12),l=Z0(a?.highlightLabelFormat,a?.categories?.[t.index]??"",r),d=Math.max(48,l.length*s*.62);return{...w({id:`chart-highlight-label-${t.key}`,order:i(),bounds:o,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:n,align:"center"}),color:a?.highlightLabelColor??n.textColor??"#0f172a",fontWeight:"bold"}}function Bu(e,t,r){let{chart:n}=e,o=n.config,i=o?.highlightPoints;if(!i?.length)return[];let a=tt(n,t),s=rt(e,a),l=[];for(let d of i){let c=d<0?s.length+d:d,u=s[c];if(!u)continue;let p={key:`${n.id}-${t.id}-${c}`,point:u,index:c,radius:o?.highlightSize??6,color:o?.highlightColor??r};o?.highlightGuide&&l.push(Q0(e,p)),l.push(J0(e,p)),o?.highlightLabels&&l.push(eS(e,p,a[c][1]))}return l}function Iu(e,t,r,n){return r.map((o,i)=>({seriesId:e.id,valueIndex:i,value:t[i][1],error:e.error?.[i],position:o,color:n}))}function Gu(e,t){return t.flatMap(r=>tS(e,r))}function tS(e,t){let r=[],n=rS(e,t);return n&&r.push(n),r.push(nS(e,t)),r}function rS(e,t){if(t.error==null)return null;let{chart:r,plot:n,bounds:o,nextOrder:i}=e,[a,s]=ir(t.value,t.error);return ar({id:`chart-line-error-${r.id}-${t.seriesId}-${t.valueIndex}`,order:i(),bounds:o,geometry:{centerX:t.position.x,startY:n.y+n.height-T(a,r.axisY,n.height),endY:n.y+n.height-T(s,r.axisY,n.height)},color:t.color,valueReference:{seriesId:t.seriesId,valueIndex:t.valueIndex}})}function nS(e,t){let{chart:r,bounds:n,diagnostics:o,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:n,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?k(c,o,r.id):{kind:"none"},stroke:d&&l>0?k(t.color,o,r.id):void 0,strokeWidth:d&&l>0?l:void 0,pointerEvents:d?void 0:"all"}}}function Du(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=i.config,u=t.color,p=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:p?{minX:a.x,maxX:a.x+a.width,minY:a.y,maxY:a.y+a.height}:s,detail:{of:"chartSeries",series:t.id,lineTension:o||void 0},d:Pt(r,o),style:{fill:{kind:"none"},stroke:k(p??n,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:n,opacity:.9,blur:f,dx:0,dy:0}:O(i.shadowStyle)}}}function _u(e,t){return N(e.color,$[t%$.length])}function Fu(e,t,r){let n=e.chart.config?.areaOpacity;if(n===void 0||n<=0)return[];let o=_u(t,r),i=e.chart.config?.lineTension??0,a=rt(e,tt(e.chart,t));return a.length>1?[Ou(e,t,a,o,i,n)]:[]}function Hu(e,t,r){let n=_u(t,r),o=e.chart.config?.lineTension??0,i=tt(e.chart,t),a=rt(e,i),s=[];a.length&&s.push(Du(e,t,a,n,o));let l=Iu(t,i,a,n);return s.push(...Gu(e,l)),s.push(...Bu(e,t,n)),s}function Vu(e){let t=[];return e.chart.series.forEach((r,n)=>{t.push(...Fu(e,r,n))}),e.chart.series.forEach((r,n)=>{t.push(...Hu(e,r,n))}),t}var Wu=[0,25,50,75,100];function zu(e,t){let r=[];return e.chart.showGrid!==!1&&r.push(...oS(e,t)),e.showLabels&&r.push(...iS(e,t)),r}function oS(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return Wu.map(i=>{let a=Yu(t,i);return{type:"path",id:`chart-mekko-grid-${r.id}-${i}`,order:o(),bounds:n,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:m(r.gridWidth,1)}}})}function iS(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e;return Wu.map(a=>({...w({id:`chart-mekko-pct-${r.id}-${a}`,order:i(),bounds:o,frame:{x:n.x,y:Yu(t,a)-t.smallFontSize/2,width:t.labelGutterWidth-6,height:t.smallFontSize+2},text:`${a}%`,chart:r,align:"right"}),fontSize:t.smallFontSize}))}function Yu(e,t){return e.grid.y+e.grid.height*(1-t/100)}function Uu(e,t,r,n){if(!e.showLabels)return[];let o=sS(e,t,r,n);return e.chart.config?.showMekkoTotals===!1?[o]:[aS(e,t,r,n),o]}function aS(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e;return{...w({id:`chart-mekko-total-${o.id}-${r}`,order:s(),bounds:a,frame:{x:n.x,y:i.y,width:n.width,height:t.smallFontSize+2},text:String(n.total),chart:o,align:"center"}),fontSize:t.smallFontSize}}function sS(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,{label:s,width:l}=n;return{...w({id:`chart-mekko-col-label-${o.id}-${r}`,order:a(),bounds:i,frame:{x:n.x,y:t.grid.y+t.grid.height+4,width:l,height:t.smallFontSize*2+4},text:s,chart:o,align:"center"}),lines:Re(s,l,t.smallFontSize),fontSize:t.smallFontSize}}function ju(e){let t=lS(e),r=e.showLabels?30:0,n=dS(e,r),o=Math.max(9,m(e.chart.fontSize,12)),i=Math.max(0,m(e.chart.config?.mekkoColumnGap,4)),a=Math.max(8,o-1);return{columns:cS(e,n,t,i),fontSize:o,smallFontSize:a,labelGutterWidth:r,columnGap:i,labelSize:Math.max(6,m(e.chart.config?.mekkoLabelSize,a)),valueSize:Math.max(6,m(e.chart.config?.mekkoValueSize,a)),grid:n}}function lS(e){let{chart:t}=e;return t.config?.categories?.length?t.config.categories:t.series[0]?.values?.map((r,n)=>String(n+1))??[]}function dS(e,t){let r=e.showLabels?18:0,n=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-n)}}function cS(e,t,r,n){let o=r.map((d,c)=>e.chart.series.reduce((u,p)=>u+(p.values[c]??0),0)),i=o.reduce((d,c)=>d+c,0),a=Math.max(1,...o),s=Math.max(1,t.width-n*Math.max(0,r.length-1)),l=t.x;return r.map((d,c)=>{let u=o[c],p=i>0?u/i*s:s/r.length,f=e.chart.config?.mekkoVaryHeight?t.height*(u/a):t.height,g={label:d,total:u,x:l,y:t.y+t.height-f,width:p,height:f};return l+=p+n,g})}var uS=.15;function Xu(e,t,r){let o=e.chart.config?.showColumnBackdrop!==!1?[mS(e,t,r)]:[],i=!!e.chart.config?.tileGradient,a=pS(e.chart.series,t,r),s=a.flatMap((l,d)=>fS(e,t,l,i?a[d+1]?.color:void 0));return[...o,...s]}function mS(e,t,r){let{chart:n,bounds:o,diagnostics:i,nextOrder:a}=e,s=t.columns[r],l=qu(e);return{type:"path",id:`chart-mekko-column-backdrop-${n.id}-${r}`,order:a(),bounds:o,d:on(s.x,t.grid.y,s.width,t.grid.height,l),style:{fill:k(n.gridColor??"#e2e8f0",i,n.id),opacity:uS}}}function qu(e){return Math.max(0,m(e.chart.config?.barCornerRadius,2))}function pS(e,t,r){let n=[],o=t.columns[r],i=0;return e.forEach((a,s)=>{let l=a.values[r]??0,d=(o.total>0?l/o.total:0)*o.height,c=o.y+i;i+=d;let u=a.color??$[s%$.length];n.push({columnIndex:r,seriesId:a.id,seriesLabel:a.label,value:l,color:u,isTop:s===0,frame:{x:o.x,y:c,width:o.width,height:d}})}),n}function fS(e,t,r,n){return[hS(e,r,n),...gS(e,t,r)]}function hS(e,t,r){let{chart:n,plot:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=O(n.shadowStyle),d=l?`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`:void 0,c=n.config,u=t.isTop||c?.mekkoRoundAll?qu(e):0,{x:p,y:f,width:g,height:b}=t.frame,x=Math.max(0,m(c?.mekkoSegmentGap,0)),C="#94a3b8",L={minX:p+g/2-b/2,maxX:p+g/2+b/2,minY:f,maxY:f+b},v=r?{kind:"linear-gradient",angle:90,stops:[{offset:0,color:N(t.color,C)},{offset:100,color:N(r,C)}]}:k(t.color,a,n.id);return{type:"path",id:`chart-mekko-seg-${n.id}-${t.columnIndex}-${t.seriesId}`,order:s(),bounds:r?L:i,d:qe(p,f+x/2,g,Math.max(0,b-x),u,!!c?.mekkoRoundAll),style:{fill:v,stroke:{kind:"solid",color:c?.mekkoSegmentStrokeColor??n.gridColor??"#e2e8f0"},strokeWidth:m(c?.mekkoSegmentStrokeWidth,m(n.gridWidth,1)),shadow:l,clip:d?{type:"path",d}:void 0}}}function gS(e,t,r){let{chart:n,bounds:o,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),p=t.labelSize*1.2,f=t.valueSize*1.2,g=Re(r.seriesLabel,c,t.labelSize).map(M=>Jr(M,c,t.labelSize,!0));if(g.length*p+f>u)return[];let b=n.config?.mekkoTextColor??J(N(r.color,"#ffffff")),x=t.columns[r.columnIndex]?.total??0,C=n.config?.mekkoValueFormat==="percent"?`${x>0?Math.round(r.value/x*100):0}%`:String(r.value),L={...w({id:`chart-mekko-seg-label-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3,width:c,height:u},text:r.seriesLabel,chart:n}),lines:g,fontSize:t.labelSize,fontWeight:"bold",color:b},v={...w({id:`chart-mekko-seg-value-${n.id}-${r.columnIndex}-${r.seriesId}`,order:i(),bounds:o,frame:{x:a+4,y:s+3+g.length*p,width:c,height:Math.max(1,u-g.length*p)},text:C,chart:n}),lines:[C],fontSize:t.valueSize,color:b};return[L,v]}function Ku(e){let t=ju(e),r=zu(e,t);return t.columns.forEach((n,o)=>{r.push(...Xu(e,t,o)),r.push(...Uu(e,t,o,n))}),r}function bS(e,t){let r=t.series.map(i=>Math.max(0,m(i.values[0],0))),n=r.reduce((i,a)=>i+a,0),o=r[0]??0;return e.replace(/\{total\}/g,String(Math.round(n*100)/100)).replace(/\{percent\}/g,String(n>0?Math.round(o/n*100):0)).replace(/\{label\}/g,t.series[0]?.label??"")}function Zu(e,t){let{chart:r,bounds:n,nextOrder:o}=e,i=r.config?.pieCenterText;if(!i)return[];let a=bS(i,r).split(/\\n|\n/),s=m(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:o(),bounds:n,x:t.centerX-d/2,y:t.centerY-l*a.length/2,width:d,height:l*a.length,lines:a,fontFamily:r.fontFamily??E,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 Qu(e){let{chart:t,plot:r}=e,n=un(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=n.outerRadius*i,s=n.innerRadius*i,l=n.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,m(c.values[0],0)),0)||1}}var yS=14*Math.PI/180,gr=80,xS=.62,SS=14,CS=3,RS=.32,Ju="#334155";function rm(e,t,r){return e.chart.showAxisLabels===!1?[]:r.filter(n=>n.end-n.start>=yS).flatMap(n=>kS(e,t,n))}function em(e,t,r,n,o,i,a,s){let{chart:l,bounds:d,nextOrder:c}=e,u=o*1.2,p=l.config?.pieLabelContent??"both",f=p==="inline"?gr*1.9:gr,g={bounds:d,x:r.x-f/2,width:f,height:u,fontFamily:l.fontFamily??E,fontSize:o,align:"center",verticalAlign:"middle",lineHeight:1.2,color:n},b=L=>({of:"chartSeries",series:t.seriesId,mark:"pie-label",pulled:a||void 0,midAngle:s,...L}),x={type:"text",id:`chart-pie-label-name-${l.id}-${t.seriesId}`,order:c(),...g,y:p==="name"?r.y-u/2:r.y-u,lines:[p==="inline"?`${t.label}, ${i}%`:t.label],fontWeight:"bold",detail:b({}),prop:we(t.seriesId)},C={type:"text",id:`chart-pie-label-value-${l.id}-${t.seriesId}`,order:c(),...g,y:p==="percent"?r.y-u/2:r.y,lines:[`${i}%`],fontWeight:"normal",detail:b({}),prop:te(t.seriesId,0),propKind:"value"};return p==="inline"||p==="name"?[x]:p==="percent"?[C]:[x,C]}function tm(e,t,r,n,o,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 ${n.x} ${n.y}`,detail:{of:"chartSeries",series:t.seriesId,mark:"pie-label-tick"},style:i?{stroke:{kind:"solid",color:o},strokeWidth:1.5}:{stroke:{kind:"none"}}}}function kS(e,t,r){let n=e.chart.config,o={...t,centerX:t.centerX+r.shift.dx,centerY:t.centerY+r.shift.dy},i=(r.start+r.end)/2,a=Math.max(9,m(e.chart.fontSize,12)),s=Math.round(r.share*100),l=a*1.2,d=Y(o,i,o.outerRadius+CS),c=o.outerRadius-o.innerRadius,u=c<l*2+6,p=r.labelOffsetX!==0||r.labelOffsetY!==0,f=n?.pieLabelPosition??"auto";if(p||f==="outside"||f==="auto"&&u){let M=p?wS(Y(o,i,o.outerRadius),r.labelOffsetX,r.labelOffsetY):Y(o,i,o.outerRadius+SS+(f==="outside"?Math.abs(Math.cos(i))*(n?.pieLabelContent==="inline"?gr*.95:gr/2):0)),H=sr(d,M,gr/2,l),I=n?.pieLabelColor??De(N(r.color,Ju),RS)??Ju;return[tm(e,r,d,H,I,!0),...em(e,r,M,I,a,s,!0,i)]}let b=o.innerRadius+c*xS,x=Y(o,i,b),C=N(r.color,"#0f172a"),L=n?.pieLabelColor??kt(C,J(C));return[tm(e,r,d,d,L,!1),...em(e,r,x,L,a,s,!1,i)]}function wS(e,t,r){return{x:e.x+t,y:e.y+r}}var vS=-Math.PI/2,Pi=Math.PI*2,PS=Pi*(359.999/360),vi=e=>e*Math.PI/180;function nm(e,t){let r=e.chart.config,n=TS(e.chart.series,t.total,{start:vS+vi(m(r?.pieStartAngle,0)),sweep:Math.min(Pi,Math.max(vi(1),vi(m(r?.pieSweep,360)))),explode:Math.max(0,m(r?.pieExplode,0))}),o=r?.pieSliceGap??0;return[...n.flatMap(i=>NS(e,LS(t,i),i,o)),...rm(e,t,n.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:om(i)})))]}function om(e){let t=(e.angles.start+e.angles.end)/2;return{dx:Math.cos(t)*e.explode,dy:Math.sin(t)*e.explode}}function LS(e,t){if(t.explode===0)return e;let{dx:r,dy:n}=om(t);return{...e,centerX:e.centerX+r,centerY:e.centerY+n}}function TS(e,t,r){let n=[],o=r.start;return e.forEach((i,a)=>{let s=Math.max(0,m(i.values[0],0)),l=s/t*r.sweep;n.push({seriesId:i.id,label:i.label,color:i.color??$[a%$.length],stroke:i.stroke,strokeWidth:i.strokeWidth,value:s,share:s/t,angles:{start:o,end:o+Math.min(l,r.sweep>=Pi?PS:r.sweep)},explode:Math.max(0,m(i.offset,r.explode)),labelOffsetX:m(i.labelOffsetX,0),labelOffsetY:m(i.labelOffsetY,0)}),o+=l}),n}function $S(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 MS(e,t){if(t<=0)return e;let r=t/2,n=Math.min(e.blur,r*2),o=r,i=Math.hypot(e.dx,e.dy),a=i>o?o/i:1;return{...e,blur:n,dx:e.dx*a,dy:e.dy*a}}function AS(e,t,r){let n=Math.max(0,r)/2,o=t.angles.end-t.angles.start,i=$t(e,t.angles,r),a=2*Ke(n,e.outerRadius),s=Math.max(0,o-a);return Math.min(e.cornerRadius,i?lr(e.outerRadius,e.innerRadius,s):dr(e.outerRadius,Ze(n,o,e.outerRadius),s))}function ES(e,t){let r=e.chart.config,n=t.stroke??r?.pieStroke;return n?{stroke:{kind:"solid",color:n},strokeWidth:m(t.strokeWidth,m(r?.pieStrokeWidth,1))}:{}}function NS(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,l=k(r.color,a,o.id),d=Qe(t,r.angles,AS(t,r,n),n),c=O(o.shadowStyle),u=ES(e,r),p=o.config?.pieGlow,f=c?{type:"path",id:`chart-pie-slice-shadow-${o.id}-${r.seriesId}`,order:s(),bounds:i,d,style:{fill:l,...u,shadow:MS(c,n),clip:{type:"path",d:$S(t.centerX,t.centerY,t.outerRadius)}}}:void 0,g={type:"path",id:`chart-pie-slice-${o.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:te(r.seriesId,0),style:{fill:l,...u,innerShadow:c,shadow:p?{color:N(r.color,"#ffffff"),opacity:.85,blur:p,dx:0,dy:0}:void 0}};return f?[f,g]:[g]}function im(e){let t=Qu(e);return[...nm(e,t),...Zu(e,t)]}var OS=-Math.PI/2,BS="#e2e8f0",IS=14*Math.PI/180,kn=80,GS=.62,DS=14,_S=3,FS=.32,am="#334155";function HS(e){let{chart:t,plot:r}=e,n=Math.max(1,Math.min(r.width,r.height)/2-4),o=m(t.axisY.min,0);return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,maxRadius:n,innerRadius:Math.max(0,Math.min(m(t.config?.innerRadius,0),n-1)),cornerRadius:Math.max(0,m(t.config?.pieCornerRadius,0)),gapPx:Math.max(0,m(t.config?.pieSliceGap,0)),axisMin:o,range:m(t.axisY.max,100)-o,sweep:t.series.length>0?Math.PI*2/t.series.length:0,start:OS+m(t.config?.pieStartAngle,0)*Math.PI/180}}function sm(e,t,r){let{centerX:n,centerY:o,innerRadius:i,cornerRadius:a,gapPx:s}=e,l={centerX:n,centerY:o,outerRadius:t,innerRadius:i},d=Math.max(0,s)/2,c=r.end-r.start,u=Math.max(0,c-2*Ke(d,t));if($t(l,r,s))return Math.min(a,lr(t,i,u));let p=Ze(d,c,t);return Math.min(a,dr(t,p,u))}function VS(e,t,r,n,o,i,a){let{chart:s,bounds:l,diagnostics:d,nextOrder:c}=e,{centerX:u,centerY:p,innerRadius:f,maxRadius:g,gapPx:b}=t,x=k(a,d,s.id),C=O(s.shadowStyle),L=Qe({centerX:u,centerY:p,outerRadius:g,innerRadius:f},n,sm(t,g,n),b),v={type:"path",id:`chart-polar-area-track-${s.id}-${r.id}`,order:c(),bounds:l,d:L,style:{fill:k(s.gridColor??BS,d,s.id),opacity:s.config?.polarTrackOpacity,...WS(e)}},M=Qe({centerX:u,centerY:p,outerRadius:o,innerRadius:f},n,sm(t,o,n),b),H=C?{type:"path",id:`chart-polar-area-wedge-shadow-${s.id}-${r.id}`,order:c(),bounds:l,d:M,style:{fill:x,shadow:C,clip:{type:"path",d:L}}}:void 0,I={type:"path",id:`chart-polar-area-wedge-${s.id}-${r.id}`,order:c(),bounds:l,d:M,detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"polar-area-wedge",pieStart:n.start,pieEnd:n.end,pieValue:i},prop:te(r.id,0),style:{fill:x,innerShadow:C,...zS(e)}};return H?[v,H,I]:[v,I]}function WS(e){let t=e.chart.config;if(!t?.polarTrackStroke)return{};let r=(t.polarTrackDash??"").split(/[ ,]+/).map(Number).filter(n=>Number.isFinite(n)&&n>0);return{stroke:{kind:"solid",color:t.polarTrackStroke},strokeWidth:m(t.polarTrackStrokeWidth,1),dash:r.length>0?r:void 0}}function zS(e){let t=e.chart.config;return t?.pieStroke?{stroke:{kind:"solid",color:t.pieStroke},strokeWidth:m(t.pieStrokeWidth,1)}:{}}function YS(e,t){let{chart:r,bounds:n,nextOrder:o}=e;return!r.config?.polarRings||t.range<=0?[]:_(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:o(),bounds:n,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.textColor??"#334155"},strokeWidth:m(r.gridWidth,1),opacity:.25}}})}function lm(e){let t=HS(e),{centerX:r,centerY:n,innerRadius:o,maxRadius:i,axisMin:a,range:s,sweep:l,start:d}=t,c=e.showLabels&&l>=IS;return[...e.chart.series.flatMap((p,f)=>{let g={start:d+f*l,end:d+(f+1)*l},b=Math.max(0,m(p.values[0],0)),x=s>0?Math.min(1,Math.max(0,(b-a)/s)):0,C=Math.max(o+1,o+(i-o)*x),L=p.color??$[f%$.length],v=VS(e,t,p,g,C,b,L);if(!c)return v;let M={centerX:r,centerY:n,outerRadius:C,innerRadius:o};return[...v,...jS(e,M,g,p,b,L)]}),...YS(e,t)]}function dm(e){let t=Math.max(9,m(e.fontSize,12));return{nameSize:Math.max(6,m(e.config?.polarNameSize,t)),valueSize:Math.max(6,m(e.config?.polarValueSize,t))}}function US(e,t,r,n,o){let i=(r.start+r.end)/2,{nameSize:a,valueSize:s}=dm(e.chart),l=(a+s)*1.2/2,d=t.outerRadius-t.innerRadius,c=m(n.labelOffsetX,0),u=m(n.labelOffsetY,0),p=c!==0||u!==0,f=d<l*2+6,g=2*t.outerRadius*Math.sin(Math.abs(r.end-r.start)/2),b=!f&&g>=kn,x=e.chart.config?.polarOutsideLabels??!1;if(!b&&!p&&!x)return;let C=p||!b,L=Y(t,i,t.outerRadius+_S),v=C?p?XS(Y(t,i,t.outerRadius),c,u):Y(t,i,t.outerRadius+DS):Y(t,i,t.innerRadius+d*GS),M=C?x&&e.chart.textColor?e.chart.textColor:De(N(o,am),FS)??am:kt(N(o,"#0f172a"),J(N(o,"#0f172a")));return{point:v,color:M,outside:C,mid:i,tickStart:L}}function jS(e,t,r,n,o,i){let a=US(e,t,r,n,i);if(!a)return[];let{chart:s,bounds:l,nextOrder:d}=e,{point:c,color:u,outside:p,mid:f,tickStart:g}=a,{nameSize:b,valueSize:x}=dm(s),C=Math.max(b,x)*1.2,L=p?sr(g,c,kn/2,C):g,v={type:"path",id:`chart-polar-area-label-tick-${s.id}-${n.id}`,order:d(),bounds:l,d:`M ${g.x} ${g.y} L ${L.x} ${L.y}`,detail:{of:"chartSeries",series:n.id,mark:"polar-area-label-tick"},style:p?{stroke:{kind:"solid",color:u},strokeWidth:1.5}:{stroke:{kind:"none"}}},M={of:"chartSeries",series:n.id,mark:"polar-area-label",pulled:p||void 0,midAngle:f,wedgeRadius:t.outerRadius},H={bounds:l,x:c.x-kn/2,width:kn,fontFamily:s.fontFamily??E,align:"center",verticalAlign:"middle",lineHeight:1.2,color:u},I=s.config?.polarValueFirst??!1,V=b*1.2,U=x*1.2,ne=c.y-(V+U)/2,Ne=I?ne+U:ne,be=I?ne:ne+V,Oe={type:"text",id:`chart-polar-area-label-name-${s.id}-${n.id}`,order:d(),...H,y:Ne,height:b*1.2,fontSize:b,lines:[n.label],fontWeight:I?"normal":"bold",detail:M,prop:we(n.id)},ie={type:"text",id:`chart-polar-area-label-value-${s.id}-${n.id}`,order:d(),...H,y:be,height:x*1.2,fontSize:x,lines:[he(o)],fontWeight:I?"bold":"normal",detail:M,prop:te(n.id,0),propKind:"value"};return[v,Oe,ie]}function XS(e,t,r){return{x:e.x+t,y:e.y+r}}var qS=["Speed","Quality","Cost","Reliability","Usability"];function KS(e){let{chart:t,plot:r}=e,n=(t.config?.categories?.filter(Boolean)??[]).length,o=Math.max(0,...t.series.map(i=>i.values.length));return{centerX:r.x+r.width/2,centerY:r.y+r.height/2,radius:fn(r.width,r.height,m(t.fontSize,12),e.showLabels),min:t.axisY.min,max:t.axisY.max,count:hn(n,o),curved:t.chartType==="radial",tension:t.config?.radarTension}}function cm(e){let{chart:t}=e,r=t.config?.categories?.filter(Boolean)??[],n=KS(e),o=ZS(r,n.count),i=(a,s)=>Vc(n,s,a);return{circular:n.curved,areaOpacity:Math.max(0,Math.min(1,t.config?.areaOpacity??.16)),strokeWidth:Math.max(0,t.config?.radarStrokeWidth??2),tension:n.tension,pointSize:Math.max(0,t.config?.radarPointSize??3),showSpokes:t.config?.radarSpokes??!0,categories:o,centerX:n.centerX,centerY:n.centerY,radius:n.radius,radiusForValue:a=>Wc(n,a),pointAt:i,polygonPath:a=>gn(o.map((s,l)=>i(a,l)),!1)}}function ZS(e,t){return Array.from({length:t},(r,n)=>e[n]??qS[n]??`Category ${n+1}`)}function um(e,t){return e.chart.showGrid===!1?[]:[...QS(e,t),...t.showSpokes?eC(e,t):[]]}function QS(e,t){return _(e.chart.axisY).filter(r=>r>e.chart.axisY.min).map(r=>JS(e,t,r))}function JS(e,t,r){let{chart:n,bounds:o,nextOrder:i}=e,a=t.radiusForValue(r),s={fill:{kind:"none"},stroke:{kind:"solid",color:n.gridColor??"#e2e8f0"},strokeWidth:m(n.gridWidth,1)};return t.circular?{type:"ellipse",id:`chart-radial-ring-${n.id}-${r}`,order:i(),bounds:o,cx:t.centerX,cy:t.centerY,rx:a,ry:a,style:s}:{type:"path",id:`chart-radar-ring-${n.id}-${r}`,order:i(),bounds:o,d:t.polygonPath(a),style:s}}function eC(e,t){let{chart:r,bounds:n,nextOrder:o}=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:o(),bounds:n,d:`M ${t.centerX} ${t.centerY} L ${s.x} ${s.y}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:m(r.gridWidth,1)}}})}function mm(e,t){return e.showLabels?t.categories.map((r,n)=>tC(e,t,r,n)):[]}function tC(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=t.pointAt(t.radius+10,n),d=l.x-t.centerX,c=Math.max(64,Math.min(120,i.width/3));return w({id:`chart-radar-label-${o.id}-${n}`,order:s(),bounds:a,frame:{x:rC(l.x,d,c),y:l.y-6,width:c,height:30},text:r,chart:o,align:nC(d)})}function rC(e,t,r){return t>8?e:t<-8?e-r:e-r/2}function nC(e){return e>8?"left":e<-8?"right":"center"}function pm(e,t){let r=[];return e.chart.series.forEach((n,o)=>{r.push(...oC(e,t,n,o))}),r}function oC(e,t,r,n){let o=r.color??$[n%$.length],i=iC(r,e,t),a=gn(i,t.circular,t.tension);return[aC(e,t,r,a,o),...t.strokeWidth>0?[sC(e,t,r,a,o)]:[],...t.pointSize>0?lC(e,t,r,i,o):[]]}function iC(e,t,r){let n=e.values;return r.categories.map((o,i)=>r.pointAt(r.radiusForValue(n[i]??t.chart.axisY.min),i))}function aC(e,t,r,n,o){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:n,detail:{of:"chartSeries",series:r.id},style:{fill:k(o,s,i.id),stroke:{kind:"none"},opacity:Math.max(0,Math.min(1,r.opacity??t.areaOpacity))}}}function sC(e,t,r,n,o){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:n,detail:{of:"chartSeries",series:r.id},style:{fill:{kind:"none"},stroke:k(o,s,i.id),strokeWidth:t.strokeWidth,lineJoin:"round",shadow:O(i.shadowStyle)}}}function lC(e,t,r,n,o){let{chart:i,bounds:a,diagnostics:s,nextOrder:l}=e;return n.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:te(r.id,c),style:{fill:k(o,s,i.id)}}))}function Li(e){let t=cm(e),r=[];return r.push(...um(e,t)),r.push(...mm(e,t)),r.push(...pm(e,t)),r}var dC=-Math.PI/2,cC=14,uC=4,mC=.18,Ti=1e-4;function Dt(e,t,r,n){return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}}function fm(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 pC(e,t,r,n){return`${fm(e,t,r)} ${fm(e,t,Math.max(0,n))}`}function hm(e,t,r,n,o){let i=Dt(e,t,r,n),a=Dt(e,t,r,o);return`M ${i.x} ${i.y} A ${r} ${r} 0 ${o-n>Math.PI?1:0} 1 ${a.x} ${a.y}`}function fC(e,t){let r=Math.min(e.blur,t*.6),n=t*.4,o=Math.hypot(e.dx,e.dy),i=o>n?n/o:1;return{...e,blur:r,dx:e.dx*i,dy:e.dy*i}}function hC(e,t,r,n,o){if(n>=Math.PI*2-Ti){let l=Dt(e,t,r,o),d=Dt(e,t,r,o+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=Dt(e,t,r,o),a=Dt(e,t,r,o+n),s=n>Math.PI?1:0;return`M ${i.x} ${i.y} A ${r} ${r} 0 ${s} 1 ${a.x} ${a.y}`}function gC(e){let{chart:t,plot:r}=e,n=m(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,m(t.config?.ringThickness,cC)),ringGap:Math.max(0,m(t.config?.ringGap,uC)),axisMin:n,range:m(t.axisY.max,100)-n,start:dC+m(t.config?.ringStartAngle,0)*Math.PI/180,total:Math.min(360,Math.max(1,m(t.config?.ringSweep,360)))*Math.PI/180,trackOpacity:Math.min(1,Math.max(0,m(t.config?.ringTrackOpacity,mC))),cap:t.config?.ringCap??"round"}}function bC(e,t,r,n,o,i){let{chart:a,bounds:s,nextOrder:l}=e,{centerX:d,centerY:c,ringThickness:u,start:p}=t,f=O(a.shadowStyle),g=o>=Math.PI*2-Ti;if(!f||g)return[];let b=fC(f,u),x=Math.min(o,u/n);return[[p,p+x],[p+o-x,p+o]].map(([C,L],v)=>({type:"path",id:`chart-radial-bar-ring-end-shadow-${a.id}-${r.id}-${v}`,order:l(),bounds:s,d:hm(d,c,n,C,L),style:{fill:{kind:"none"},stroke:i,strokeWidth:u,lineCap:t.cap,shadow:b,clip:{type:"path",d:pC(d,c,n+u/2,n-u/2)}}}))}function yC(e,t,r,n){let{chart:o,bounds:i,diagnostics:a,nextOrder:s}=e,{centerX:l,centerY:d,outerRadius:c,ringThickness:u,ringGap:p,axisMin:f,range:g,start:b,total:x,trackOpacity:C,cap:L}=t,v=c-n*(u+p)-u/2;if(v<=u/2)return[];let M=k(r.color??$[n%$.length],a,o.id),H=Math.max(0,m(r.values[0],0)),I=g>0?Math.min(1,Math.max(0,(H-f)/g)):0,V={fill:{kind:"none"},stroke:M,strokeWidth:u,opacity:C},U=x>=Math.PI*2-Ti?{type:"ellipse",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,cx:l,cy:d,rx:v,ry:v,style:V}:{type:"path",id:`chart-radial-bar-track-${o.id}-${r.id}`,order:s(),bounds:i,d:hm(l,d,v,b,b+x),style:{...V,lineCap:L}};if(I<=0)return[U];let ne=I*x,Ne=bC(e,t,r,v,ne,M),be={type:"path",id:`chart-radial-bar-ring-${o.id}-${r.id}`,order:s(),bounds:i,d:hC(l,d,v,ne,b),detail:{of:"chartValue",series:r.id,valueIndex:0,mark:"radial-bar-ring"},prop:te(r.id,0),style:{fill:{kind:"none"},stroke:M,strokeWidth:u,lineCap:L}};return[U,...Ne,be]}function gm(e){let t=gC(e);return e.chart.series.flatMap((r,n)=>yC(e,t,r,n))}function bm(e,t){let r=O(e.chart.shadowStyle),n=!!e.chart.config?.linkGradient,{plot:o}=e,i=r?`M ${o.x} ${o.y} H ${o.x+o.width} V ${o.y+o.height} H ${o.x} Z`:void 0;return t.links.map((a,s)=>{let l=xC(e,t,a,s,n);return SC(e,l,r,i,n)})}function xC(e,t,r,n,o){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)||z,d=t.nodeColors.get(r.target)||z,c=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:l},{offset:100,color:d}]}:{kind:"solid",color:r.color||d};return{linkIndex:n,fromId:r.source,toId:r.target,source:i,target:a,controlX:i.x+(a.x-i.x)*Math.min(1,Math.max(0,m(s?.sankeyLinkCurve,.5))),fill:c,opacity:Math.min(1,Math.max(0,m(s?.sankeyLinkOpacity,r.color?.85:.45)))}}function SC(e,t,r,n,o){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:o?l:a,d:CC(t),detail:{of:"link",fromId:t.fromId,toId:t.toId},style:{fill:t.fill,opacity:t.opacity,shadow:r,clip:n?{type:"path",d:n}:void 0}}}function CC(e){let{source:t,target:r,controlX:n}=e;return[`M ${t.x} ${t.top}`,`C ${n} ${t.top} ${n} ${r.top} ${r.x} ${r.top}`,`L ${r.x} ${r.bottom}`,`C ${n} ${r.bottom} ${n} ${t.bottom} ${t.x} ${t.bottom}`,"Z"].join(" ")}var RC=.3,kC=.78;function ym(e,t){let r=Math.max(0,m(e.chart.config?.barCornerRadius,0)),n=[];return t.nodes.forEach(o=>{n.push(wC(e,t,o,r));let i=e.showLabels?vC(e,t,o):void 0;i&&n.push(i)}),n}function wC(e,t,r,n){let{chart:o,bounds:i,nextOrder:a}=e,s=t.baseX+r.x,l=t.baseY+r.y,d={fill:{kind:"solid",color:r.color||z},shadow:O(o.shadowStyle)},c=r.column===0,u=r.column===t.columnCount-1,p={of:"chartSeries",series:r.id,mark:"sankey-node"};return n>0&&c&&u?{type:"rect",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,rx:n,style:d,detail:p}:n>0&&c?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Kt(s,l,r.width,r.height,n),style:d,detail:p}:n>0&&u?{type:"path",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,d:Zt(s,l,r.width,r.height,n),style:d,detail:p}:{type:"rect",id:`chart-sankey-node-${o.id}-${r.id}`,order:a(),bounds:i,x:s,y:l,width:r.width,height:r.height,style:d,detail:p}}function vC(e,t,r){let{chart:n}=e,o=n.config?.labelPosition??"outside",i=o==="inside"?LC(e,t,r,n.config?.labelOrientation??"horizontal"):PC(e,t,r);if(!i)return;let a=n.textColor??"#0f172a",s=o==="inside"?J(r.color):De(r.color,ln(a)?kC:RC)??a,l=n.config?.labelColor??s;return{...i,color:l,detail:{of:"chartSeries",series:r.id,mark:"sankey-node-label"}}}function PC(e,t,r){let{chart:n,bounds:o,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{...w({id:`chart-sankey-label-${n.id}-${r.id}`,order:i(),bounds:o,frame:{x:d,y:l,width:t.labelGutter-12,height:Math.max(1,r.height)},text:r.label,chart:n,align:a?"right":"left"}),fontSize:t.labelSize,fontWeight:"bold",verticalAlign:"middle"}}function LC(e,t,r,n){let{chart:o,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,p=`chart-sankey-label-${o.id}-${r.id}`;if(n==="vertical"){let f=u*1.4,g=Math.max(1,r.height-8);return Me(r.label,u,!1)>g?void 0:{...w({id:p,order:a(),bounds:i,frame:{x:d-g/2,y:c-f/2,width:g,height:f},text:r.label,chart:o,align:"center",rotation:-90}),fontSize:u,fontWeight:"bold",verticalAlign:"middle",rotationCenter:{x:d,y:c}}}return{...w({id:p,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:o,align:"center"}),fontSize:u,fontWeight:"bold",verticalAlign:"middle"}}function xm(e){let{chart:t,plot:r,showLabels:n}=e,o=n?92:0,i=Math.max(1,r.width-o*2),a=wi(TC(e),$C(e),i,r.height,{nodeWidth:Math.max(1,m(t.config?.sankeyNodeWidth,18)),nodeGap:Math.max(0,m(t.config?.sankeyNodeGap,8))});return{...a,baseX:r.x+o,baseY:r.y,labelGutter:o,fontSize:Math.max(9,m(t.fontSize,12)),labelSize:Math.max(6,m(t.config?.sankeyLabelSize,Math.max(9,m(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||z]))}}function TC(e){return(e.chart.config?.zones??[]).map(t=>({id:t.label,label:t.label,color:t.color,offsetX:t.offsetX,offsetY:t.offsetY}))}function $C(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?N(r.color,z):void 0})}),t}function Sm(e){let t=xm(e),r=[];return r.push(...bm(e,t)),r.push(...ym(e,t)),r}var MC=4;function Cm(e){let t=[],r=O(e.chart.shadowStyle);return e.chart.series.forEach((n,o)=>{let i=n.color??$[o%$.length];rt(e,tt(e.chart,n)).forEach((s,l)=>{t.push(AC(e,n,s,l,i,r))})}),t}function AC(e,t,r,n,o,i){let{chart:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=a.config,u=c?.pointSize??MC,p=c?.pointStrokeWidth??0;return{type:"ellipse",id:`chart-point-${a.id}-${t.id}-${n}`,order:d(),bounds:s,cx:r.x,cy:r.y,rx:u,ry:u,detail:{of:"chartValue",series:t.id,valueIndex:n},style:{fill:k(o,l,a.id),stroke:p>0?k(c?.pointStrokeColor??o,l,a.id):void 0,strokeWidth:p>0?p:void 0,opacity:c?.pointOpacity,shadow:i}}}function Rm(e){let{chart:t,plot:r,showLegend:n}=e,o=Math.max(9,m(t.fontSize,12)),i=t.legendPosition==="left"?"left":t.legendPosition==="right"?"right":"bottom",a=n&&i==="bottom"?48:0,s=Math.max(0,m(t.config?.cellGap,0));return{leaves:t.series,bands:rr(t.axisY),zones:t.config?.zones?.length?t.config.zones:tr,fontSize:o,smallFontSize:Math.max(8,o-1),legendPosition:i,legendHeight:a,gridWidth:Math.max(1,r.width),gridHeight:Math.max(1,r.height-a),cellGap:s,cellRadius:Math.max(0,m(t.config?.barCornerRadius,s)),headerHeight:Math.max(0,m(t.config?.headerHeight,20)),labelSize:Math.max(6,m(t.config?.tileLabelSize,Math.max(8,o-1))),valueSize:Math.max(6,m(t.config?.tileValueSize,Math.max(8,o-1))),labelPadding:Math.max(0,m(t.config?.tileLabelPadding,4))}}function br(e){return e.values[0]??0}function $i(e,t){return e.color??nr(br(e),t.bands,t.zones)}var Ee=10,wn=4,Mi=2,Ai=16,yr=34;function km(e,t){return t.zones.length===0||t.legendPosition==="bottom"&&t.legendHeight<=0?[]:t.legendPosition==="bottom"?EC(e,t):NC(e,t)}function Ei(e,t){let r=e.bands[0],n=e.bands[e.bands.length-1];return n===r?0:(t-r)/(n-r)}function wm(e){let t=Math.max(0,e.bands.length-1);return e.zones.slice(0,t).map((n,o)=>({offset:Ei(e,e.bands[o+1]??e.bands[e.bands.length-1])*100,color:n.color??z}))}function EC(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e,a=n.x,s=t.gridWidth,l=t.fontSize+2,d=n.y+t.gridHeight+Ai,c=Q({x:a,y:d,width:s,height:Ee}),u=wm(t),p={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:a,y:d,width:s,height:Ee,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:z},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=t.bands.flatMap((g,b)=>{let x=a+Ei(t,g)*s,C={type:"path",id:`chart-treemap-legend-tick-${r.id}-${b}`,order:i(),bounds:o,d:`M ${x} ${d+Ee} L ${x} ${d+Ee+wn}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},L=b===0,v=b===t.bands.length-1,M=L?"left":v?"right":"center",H=L?x:v?x-yr:x-yr/2,I=w({id:`chart-treemap-legend-tick-label-${r.id}-${b}`,order:i(),bounds:o,frame:{x:H,y:d+Ee+wn+Mi,width:yr,height:l},text:he(g),chart:r,align:M});return[C,I]});return[p,...f]}function NC(e,t){let{chart:r,plot:n,bounds:o,nextOrder:i}=e,a=t.legendPosition,s=n.y,l=t.gridHeight,d=a==="left"?n.x-Ai-Ee:n.x+t.gridWidth+Ai,c=Q({x:d,y:s,width:Ee,height:l}),u=wm(t),p={type:"rect",id:`chart-treemap-legend-bar-${r.id}`,order:i(),bounds:c,x:d,y:s,width:Ee,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:z},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},f=a==="left"?d:d+Ee,g=a==="left"?f-wn:f+wn,b=a==="left"?g-Mi-yr:g+Mi,x=t.bands.flatMap((C,L)=>{let v=s+(1-Ei(t,C))*l,M={type:"path",id:`chart-treemap-legend-tick-${r.id}-${L}`,order:i(),bounds:o,d:`M ${f} ${v} L ${g} ${v}`,style:{fill:{kind:"none"},stroke:{kind:"solid",color:r.gridColor??"#e2e8f0"},strokeWidth:1}},H=w({id:`chart-treemap-legend-tick-label-${r.id}-${L}`,order:i(),bounds:o,frame:{x:b,y:v-t.fontSize/2,width:yr,height:t.fontSize+2},text:he(C),chart:r,align:a==="left"?"right":"left"});return[M,H]});return[p,...x]}function vm(e,t){let{tiles:r,headers:n}=OC(e,t),o=[],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;o.push(...IC(e,t,a,c))}),n.forEach((a,s)=>{o.push(...BC(e,t,a,s))}),o}function OC(e,t){if(!t.leaves.some(l=>l.group)){let l=t.leaves.map(c=>({leaf:c,value:br(c)}));return{tiles:hr(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 n=r.map(l=>({key:l,label:l||"Other",value:t.leaves.filter(d=>(d.group??"")===l).reduce((d,c)=>d+br(c),0)})),o=hr(n,{x:0,y:0,width:t.gridWidth,height:t.gridHeight}),i=t.cellGap,a=[],s=[];return o.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(p=>(p.group??"")===l.item.key).map(p=>({leaf:p,value:br(p)}));a.push(...hr(u,{x:l.x,y:l.y+d,width:l.width,height:Math.max(0,l.height-d)}))}),{tiles:a,headers:s}}function BC(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,l=o.config?.headerColor??o.gridColor??"#e2e8f0",d={type:"rect",id:`chart-treemap-header-${o.id}-${n}`,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,o.fontSize??12)-1),u={...w({id:`chart-treemap-header-label-${o.id}-${n}`,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:o,align:"center"}),fontSize:c,color:J(l)};return[d,u]}function IC(e,t,r,n){let o=$i(r.item.leaf,t),i=n?$i(n.item.leaf,t):void 0,a=[GC(e,t,r,o,i)];return e.showLabels&&r.width>=34&&r.height>=18&&a.push(...DC(e,t,r,o)),a}function GC(e,t,r,n,o){let{chart:i,plot:a,bounds:s,diagnostics:l,nextOrder:d}=e,c=t.cellGap,u=O(i.shadowStyle),p=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,g=a.y+r.y+c/2,b=Math.max(0,r.width-c),x=Math.max(0,r.height-c),C="#94a3b8",L={minX:f,maxX:f+b,minY:g+x/2-b/2,maxY:g+x/2+b/2},v=o?{kind:"linear-gradient",angle:0,stops:[{offset:0,color:N(n,C)},{offset:100,color:N(o,C)}]}:k(n,l,i.id);return{type:"rect",id:`chart-treemap-tile-${i.id}-${r.item.leaf.id}`,order:d(),bounds:o?L:s,x:f,y:g,width:b,height:x,rx:t.cellRadius,style:{fill:v,stroke:{kind:"solid",color:i.config?.tileStrokeColor??i.gridColor??"#e2e8f0"},strokeWidth:m(i.config?.tileStrokeWidth,m(i.gridWidth,1)),shadow:u,clip:p?{type:"path",d:p}:void 0}}}function DC(e,t,r,n){let{chart:o,plot:i,bounds:a,nextOrder:s}=e,{leaf:l,value:d}=r.item,c=t.cellGap,u=t.labelPadding,p=Math.max(1,r.width-c-u*2),f=Math.max(1,r.height-c-u*1.5),g=i.x+r.x+c/2+u,b=i.y+r.y+c/2+u*.75,x=o.config?.tileTextColor??J(N(n,"#ffffff")),C=t.labelSize*1.2,L=Math.max(1,Math.floor(f/C)),v=Re(l.label,p,t.labelSize).slice(0,L).map(U=>Jr(U,p,t.labelSize,!0)),M={...w({id:`chart-treemap-label-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b,width:p,height:f},text:l.label,chart:o}),lines:v,fontSize:t.labelSize,fontWeight:"bold",color:x},H=String(d),I=v.length*C+t.valueSize*1.2<=f+2&&Me(H,t.valueSize,!1)<=p;if(o.config?.showTileValues===!1||!I)return[M];let V={...w({id:`chart-treemap-value-${o.id}-${l.id}`,order:s(),bounds:a,frame:{x:g,y:b+v.length*C,width:p,height:Math.max(1,f-v.length*C)},text:String(d),chart:o}),lines:[String(d)],fontSize:t.valueSize,color:x};return[M,V]}function Pm(e){let t=Rm(e),r=[];return r.push(...vm(e,t)),r.push(...km(e,t)),r}var _C={bar:Qc,boxplot:au,custom:du,field:yu,heatmap:vu,hexbin:e=>Nu(e),line:Vu,mekko:Ku,pie:e=>im(e),polarArea:e=>lm(e),radar:e=>Li(e),radial:e=>Li(e),radialBar:e=>gm(e),sankey:Sm,scatter:Cm,treemap:Pm},FC=new Set(["radar","radial"]);function Ni(e){return FC.has(e)}function nt(e){return _C[e.chart.chartType](e)}function Lm(e){let{chart:t,context:r,layout:n,nodes:o,renderOrder:i}=e,a=yn(t,n.plot,n.bounds,i.current());o.push(...a),i.advance(a.length),o.push(...nt(r));let s=Uc({chart:t,plot:n.plot,bounds:n.bounds,order:i.current()});return o.push(...s),i.advance(s.length),o.push(...Gc(t,n,i.current())),o}function HC(e,t){let r=ee(e);return{of:"chartScale",valueScale:`${r?`${t.x},${t.width}`:`${t.y},${t.height}`},${e.axisY.min},${e.axisY.max}${r?",horizontal":""}`}}function VC(e,t){let{outerRadius:r,innerRadius:n,cornerRadius:o}=un(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},${n},${o}`}}function WC(e,t){let r=Math.max(1,Math.min(t.width,t.height)/2-4),n=Math.max(0,Math.min(m(e.config?.innerRadius,0),r-1)),o=Math.max(0,m(e.config?.pieCornerRadius,0));return{of:"pieGeometry",pieGeometry:`${t.x+t.width/2},${t.y+t.height/2},${r},${n},${o}`}}function zC(e,t){let r=(e.config?.categories?.filter(Boolean)??[]).length,n=Math.max(0,...e.series.map(c=>c.values.length)),o=hn(r,n),i=fn(t.width,t.height,m(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},${o},${l}${d===void 0?"":`,${d}`}`}}function YC(e,t){return e.chartType==="pie"?VC(e,t):e.chartType==="polarArea"?WC(e,t):e.chartType==="radar"||e.chartType==="radial"?zC(e,t):Ac.has(e.chartType)?HC(e,t):void 0}function Tm(e,t,r,n){let o={type:"rect",id:`chart-${e.id}`,order:n,bounds:t,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.cornerRadius??12,style:{fill:k(e.fillColor??"#ffffff",[],e.id),stroke:{kind:"solid",color:e.strokeColor??"#475569"},strokeWidth:m(e.strokeWidth,1)}},i=YC(e,r);return i&&(o.detail=i),o}function $m(e,t,r,n){let o=Tc({chart:e,plot:t.plot,bounds:t.bounds,order:r.current(),diagnostics:n});return r.advance(o.length),o}function Mm(e,t,r,n){return{chart:e,plot:t.plot,bounds:t.bounds,diagnostics:n,showLabels:t.showLabels,showLegend:t.showLegend,stackedMode:e.config?.stacked&&e.config.stacked!=="none"?e.config.stacked:void 0,nextOrder:r.next}}var vn=class{#e;#n=.01;constructor(t){this.#e=t}next=()=>this.#e+this.#n++;current(){return this.#e+this.#n}advance(t){this.#n+=t}};function Am(e,t,r,n){return e.title?[{...w({id:`chart-title-${e.id}`,order:n.next(),bounds:t,frame:{x:r.x,y:e.y+12,width:r.width,height:20},text:e.title,chart:e}),...e.titleColor?{color:e.titleColor}:{},fontWeight:e.titleWeight??"bold",fontSize:m(e.titleSize,Math.max(10,m(e.fontSize,12))+2),prop:Rc}]:[]}function Em(e,t,r){let n=2e4+t,o=Ec(e),i=new vn(n),a=[Tm(e,o.bounds,o.plot,n)];return a.push(...jc(e,o.bounds,i)),a.push(...Am(e,o.bounds,o.plot,i)),a.push(...$m(e,o,i,r)),{chart:e,layout:o,nodes:a,renderOrder:i,context:Mm(e,o,i,r)}}function Nm(e){return e.nodes.push(...nt(e.context)),e.nodes}function Om(e){return e.nodes.push(...nt(e.context)),e.nodes}function Bm(e,t,r){if(e.isVisible===!1)return[];let n=Em(e,t,r);return Ni(e.chartType)?Nm(n):Je(e)?Lm(n):Om(n)}function Oi(e,t){return e.flatMap((r,n)=>Z(Bm(r,n,t),"chart",r.id,r.chartType,r.title??"Chart"))}function UC(e){return e.length?{minX:Math.min(...e.map(t=>t.bounds.minX)),minY:Math.min(...e.map(t=>t.bounds.minY)),maxX:Math.max(...e.map(t=>t.bounds.maxX)),maxY:Math.max(...e.map(t=>t.bounds.maxY))}:Eo}function jC(e){let t=new Map,r=(n,o,i)=>{o.forEach((a,s)=>{t.set(`${n}:${a.id}`,{rank:_l(a),sequence:Fl(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(n=>n.link),2e4),r("chart",e.charts??[],2e4),r("path",e.paths??[],3e4),t}function XC(e,t){let r=jC(t);for(let n of e){let o=n.identity?r.get(`${n.identity.role}:${n.identity.id}`):void 0;n.rank=o?.rank??0,n.sequence=o?.sequence??0}}function Bi(e,t={}){let{measureText:r}=t,n=[...e.diagnostics??[]],o=[...id(e),...Xd(e.paths??[]),...Oi(e.charts??[],n),...jd(e.links,r),...pc(e.shapes,n,r),...No(e.components??e.widgets??[]),...sd(e.isometricObjects??[])];return XC(o,e),o.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:o,bounds:UC(o),diagnostics:n}}var P=e=>String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),h=e=>Number(e.toFixed(3)).toString(),ge=e=>`sf-${e.replace(/[^A-Za-z0-9_.:-]/g,"-")}`;var Pn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;clip(t){if(!t.clip)return;let r=JSON.stringify(t.clip),n=this.ids.get(r);if(!n){n=ge(`${this.prefix}clip-${this.ids.size}`),this.ids.set(r,n);let o=t.clip,i=o.type==="path"?`<path clip-rule="evenodd" d="${P(o.d)}"/>`:`<rect x="${h(o.x)}" y="${h(o.y)}" width="${h(o.width)}" height="${h(o.height)}" rx="${h(o.rx)}"/>`;this.addDefinition(`<clipPath id="${n}">${i}</clipPath>`)}return n}};var Ln=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;filter(t,r,n){if(t.innerShadow)return this.define(r,t.innerShadow,ZC);if(t.shadow){let o=t.shadow.blur*1.5+Math.max(Math.abs(t.shadow.dx),Math.abs(t.shadow.dy));return this.define(r,t.shadow,qC,n&&n>0?Math.max(.5,o/n):.5)}if(t.blur||t.saturate!==void 0)return this.define(r,{blur:t.blur??0,saturate:t.saturate??1},KC)}define(t,r,n,o=.5){let i=JSON.stringify(r)+n.name+o,a=this.ids.get(i);return a||(a=ge(`${this.prefix}shadow-${t}-${this.ids.size}`),this.ids.set(i,a),this.addDefinition(`<filter id="${a}" x="${h(-o*100)}%" y="${h(-o*100)}%" width="${h((1+o*2)*100)}%" height="${h((1+o*2)*100)}%">${n(r)}</filter>`)),a}};function qC(e){return`<feDropShadow dx="${h(e.dx)}" dy="${h(e.dy)}" stdDeviation="${h(e.blur/2)}" flood-color="${P(e.color)}" flood-opacity="${h(e.opacity)}"/>`}function KC(e){let t=e.blur>0?`<feGaussianBlur stdDeviation="${h(e.blur/2)}"/>`:"",r=e.saturate===1?"":`<feColorMatrix type="saturate" values="${h(e.saturate)}"/>`;return t+r}function ZC(e){return['<feComponentTransfer in="SourceAlpha" result="sf-inverted-alpha">','<feFuncA type="table" tableValues="1 0"/>',"</feComponentTransfer>",`<feGaussianBlur in="sf-inverted-alpha" stdDeviation="${h(e.blur/2)}" result="sf-blurred"/>`,`<feOffset in="sf-blurred" dx="${h(e.dx)}" dy="${h(e.dy)}" result="sf-offset"/>`,`<feFlood flood-color="${P(e.color)}" flood-opacity="${h(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 Im(e,t,r,n){return{arrow:`<path d="M ${h(-t)} ${h(-t*.6)} L 0 0 L ${h(-t)} ${h(t*.6)}" fill="none" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round" stroke-linejoin="round"/>`,filled_arrow:`<path d="M ${h(-t)} ${h(-t*.6)} L 0 0 L ${h(-t)} ${h(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${h(n*.5)}" stroke-linejoin="round"/>`,circle:`<circle cx="0" cy="0" r="${h(t*.5)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/>`,filled_circle:`<circle cx="0" cy="0" r="${h(t*.5)}" fill="${r}"/>`,diamond:`<path d="M ${h(-t*.6)} 0 L 0 ${h(-t*.6)} L ${h(t*.6)} 0 L 0 ${h(t*.6)} Z" fill="white" stroke="${r}" stroke-width="${h(n)}"/>`,filled_diamond:`<path d="M ${h(-t*.6)} 0 L 0 ${h(-t*.6)} L ${h(t*.6)} 0 L 0 ${h(t*.6)} Z" fill="${r}" stroke="${r}" stroke-width="${h(n*.5)}"/>`,bar:`<path d="M 0 ${h(-t*.6)} V ${h(t*.6)}" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,triangle:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 L ${h(-t)} ${h(t*.72)} Z" fill="white" stroke="${r}" stroke-width="${h(n)}" stroke-linejoin="round"/>`,one:`<path d="M 0 ${h(-t*.62)} V ${h(t*.62)} M ${h(-t*.72)} ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}"/>`,zero_one:`<circle cx="${h(-t*.8)}" cy="0" r="${h(t*.38)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/><path d="M 0 ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}"/>`,many:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,one_many:`<path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0 M ${h(-t*1.45)} ${h(-t*.62)} V ${h(t*.62)}" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`,zero_many:`<circle cx="${h(-t*1.45)}" cy="0" r="${h(t*.38)}" fill="white" stroke="${r}" stroke-width="${h(n)}"/><path d="M ${h(-t)} ${h(-t*.72)} L 0 0 M ${h(-t)} 0 L 0 0 M ${h(-t)} ${h(t*.72)} L 0 0" stroke="${r}" stroke-width="${h(n)}" stroke-linecap="round"/>`}[e]}function QC(e,t,r){return Math.max(t*(e==="one_many"||e==="zero_many"?2:1.4),r*2)}function JC(e,t){return`id="${e}" markerWidth="${h(t*2)}" markerHeight="${h(t*2)}" viewBox="${h(-t)} ${h(-t)} ${h(t*2)} ${h(t*2)}" refX="0" refY="0" orient="auto-start-reverse" markerUnits="userSpaceOnUse" overflow="visible"`}var Tn=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;marker(t,r,n){if(!t||t==="none")return;let o=`${t}:${r}:${n}`,i=this.ids.get(o);if(i)return i;i=ge(`${this.prefix}marker-${t}-${this.ids.size}`),this.ids.set(o,i);let a=12+(n-2)*3,s=QC(t,a,n),l=JC(i,s);return this.addDefinition(`<marker ${l}>${Im(t,a,P(r),n)}</marker>`),i}};function eR(e,t){let r=t.points.map((i,a)=>ge(`${e}-point-${a}`)),n=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="${h(s)}%" cy="${h(l)}%" r="75%"><stop offset="0%" stop-color="${P(i.color)}" stop-opacity="1"/><stop offset="100%" stop-color="${P(i.color)}" stop-opacity="0"/></radialGradient>`}).join(""),o=t.points.map((i,a)=>`<rect width="1" height="1" fill="url(#${r[a]})"/>`).join("");return`${n}<pattern id="${e}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><rect width="1" height="1" fill="${P(t.points[0]?.color??"transparent")}"/>${o}</pattern>`}function tR(e,t,r){let n=t.angle*Math.PI/180,o=(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(n)*a,l=Math.sin(n)*a,d=t.stops.map(c=>`<stop offset="${h(Math.max(0,Math.min(100,c.offset)))}%" stop-color="${P(c.color)}"/>`).join("");return`<linearGradient id="${e}" gradientUnits="userSpaceOnUse" x1="${h(o-s)}" y1="${h(i-l)}" x2="${h(o+s)}" y2="${h(i+l)}">${d}</linearGradient>`}var $n=class{constructor(t,r){this.addDefinition=t;this.prefix=r}addDefinition;prefix;ids=new Map;paint(t,r,n){if(!t||t.kind==="none")return"none";if(t.kind==="solid")return t.color;let o=JSON.stringify(t)+JSON.stringify(n),i=this.ids.get(o);if(!i){i=ge(`${this.prefix}gradient-${r}-${this.ids.size}`),this.ids.set(o,i);let a=t.kind==="mesh-gradient"?eR(i,t):tR(i,t,n);this.addDefinition(a)}return`url(#${i})`}};var Mn=class{constructor(t){this.prefix=t;let r=n=>{this.entries.push(n)};this.paints=new $n(r,t),this.filters=new Ln(r,t),this.markers=new Tn(r,t),this.clips=new Pn(r,t)}prefix;entries=[];paints;filters;markers;clips;elementId(t){return ge(`${this.prefix}${t}`)}paint(t,r,n){return this.paints.paint(t,r,n)}filter(t,r,n){return this.filters.filter(t,r,n)}marker(t,r,n){return this.markers.marker(t,r,n)}clip(t){return this.clips.clip(t)}};function rR(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 Gm(e){return e.flatMap(t=>t.type==="path"&&t.identity?.role==="link"&&t.identity.primary?[t,rR(t,t.identity.id)]:[t])}function Dm(e,t){let r=e.stroke;return r?.kind==="solid"?r.color:r?.kind==="linear-gradient"&&r.stops.length?(t==="start"?r.stops.reduce((o,i)=>o.offset<=i.offset?o:i):r.stops.reduce((o,i)=>o.offset>=i.offset?o:i)).color:r?.kind==="mesh-gradient"&&r.points.length?r.points[0].color:"#64748b"}function _m(e,t){let r=t.paint(e.style.stroke,`${e.id}-stroke`,e.bounds),n=t.paint(e.style.fill,`${e.id}-fill`,e.bounds),o=[`fill="${P(n)}"`,`stroke="${P(r)}"`];return nR(o,e.style),Fm(o,e,t),iR(o,e,t),o.join(" ")}function nR(e,t){t.strokeWidth!==void 0&&e.push(`stroke-width="${h(t.strokeWidth)}"`),t.dash?.length&&e.push(`stroke-dasharray="${t.dash.map(h).join(" ")}"`),t.lineCap&&e.push(`stroke-linecap="${t.lineCap}"`),t.lineJoin&&e.push(`stroke-linejoin="${t.lineJoin}"`),t.opacity!==void 0&&e.push(`opacity="${h(t.opacity)}"`),t.pointerEvents&&e.push(`pointer-events="${t.pointerEvents}"`)}function oR(e){let t=e;if(t.type==="ellipse"&&t.rx!==void 0&&t.ry!==void 0)return Math.min(t.rx,t.ry)*2;if(t.type==="rect"&&t.width!==void 0&&t.height!==void 0)return Math.min(t.width,t.height)}function Fm(e,t,r){let n=r.filter(t.style,t.id,oR(t));n&&e.push(`filter="url(#${n})"`);let o=r.clip(t.style);o&&e.push(`clip-path="url(#${o})"`)}function iR(e,t,r){if(t.type!=="path")return;let n=r.marker(t.markerStart,Dm(t.style,"start"),t.style.strokeWidth??1),o=r.marker(t.markerEnd,Dm(t.style,"end"),t.style.strokeWidth??1);n&&e.push(`marker-start="url(#${n})"`),o&&e.push(`marker-end="url(#${o})"`)}function Fe(e,t){return e&&t?` transform="rotate(${h(e)} ${h(t.x)} ${h(t.y)})"`:""}function Hm(e,t){let r=[];return e.style.opacity!==void 0&&r.push(`opacity="${h(e.style.opacity)}"`),e.style.pointerEvents&&r.push(`pointer-events="${e.style.pointerEvents}"`),Fm(r,e,t),r.join(" ")}var Vm="data-sf-symbol-points",Wm="data-sf-symbol-tension",An="data-sf-symbol-bounds",xr="data-sf-corner-radius",zm="data-sf-square-corner",En="data-sf-path-points",Nn="data-sf-path-tension",On="data-sf-path-closed",Ym="data-sf-path-point",Bn="data-sf-isometric-size",In="data-sf-isometric-label-offset";function aR(e){return e.role==="shape"?"entity":e.role}function sR(e){return[`role="${P(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 lR(e){return[`data-sf-role="${aR(e)}"`,`data-sf-id="${P(e.id)}"`,e.kind?`data-sf-kind="${P(e.kind)}"`:void 0,e.primary?'data-sf-primary="true"':void 0,e.parentFrameId?`data-sf-parent-frame="${P(e.parentFrameId)}"`:void 0,...e.aria?sR(e.aria):[]]}function dR(e){switch(e.of){case"chartValue":return cR(e);case"chartScale":return pR(e);case"chartSeries":return fR(e);case"pieGeometry":return uR(e);case"radarGeometry":return mR(e);case"link":return xR(e);case"frameBoundary":return hR(e);case"symbolGeometry":return gR(e);case"declaredBounds":return[Ii(e.bounds)];case"pathGeometry":return bR(e);case"isometricGeometry":return yR(e)}}function cR(e){return[`data-sf-series="${P(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="${h(e.radius)}"`:void 0,e.colorProp?`data-sf-color-prop="${P(e.colorProp)}"`:void 0,e.hasColorOverride?'data-sf-color-override="true"':void 0,e.pieStart!==void 0?`data-sf-pie-start="${h(e.pieStart)}"`:void 0,e.pieEnd!==void 0?`data-sf-pie-end="${h(e.pieEnd)}"`:void 0,e.pieValue!==void 0?`data-sf-pie-value="${h(e.pieValue)}"`:void 0]}function uR(e){return[`data-sf-pie-geometry="${e.pieGeometry}"`]}function mR(e){return[`data-sf-radar-geometry="${e.radarGeometry}"`]}function pR(e){return[`data-sf-value-scale="${e.valueScale}"`]}function fR(e){return[`data-sf-series="${P(e.series)}"`,e.lineTension!==void 0?`data-sf-line-tension="${h(e.lineTension)}"`:void 0,e.mark?`data-sf-mark="${P(e.mark)}"`:void 0,e.pulled?'data-sf-label-pulled="true"':void 0,e.midAngle!==void 0?`data-sf-pie-mid-angle="${h(e.midAngle)}"`:void 0,e.wedgeRadius!==void 0?`data-sf-pie-wedge-radius="${h(e.wedgeRadius)}"`:void 0]}function hR(e){return[`${xr}="${h(e.cornerRadius)}"`,`${zm}="${e.squareCorner}"`]}function Ii(e){return`${An}="${h(e.x)},${h(e.y)},${h(e.width)},${h(e.height)}"`}function gR(e){return[`${Vm}="${P(JSON.stringify(e.points))}"`,`${Wm}="${h(e.tension)}"`,Ii(e.declaredBounds)]}function bR(e){return[`${En}="${P(JSON.stringify(e.points))}"`,`${Nn}="${h(e.tension)}"`,`${On}="${e.closed}"`]}function yR(e){return[`${Bn}="${h(e.width)},${h(e.height)},${h(e.depth)}"`,`${xr}="${h(e.cornerRadius)}"`,Ii(e.bounds),`${In}="${h(e.labelOffsetX)},${h(e.labelOffsetY)}"`]}function xR(e){return[e.fromId?`data-sf-from="${P(e.fromId)}"`:void 0,e.toId?`data-sf-to="${P(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="${P(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 ot(e){let t=e.identity?.label,r=[...e.identity?lR(e.identity):[],...e.detail?dR(e.detail):[],e.prop?`data-sf-prop="${P(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="${P(e.mark)}"`:void 0,e.zoneGradient?'data-sf-zone-gradient="true"':void 0,e.zoneGradient?`data-sf-zone-axis-min="${h(e.zoneGradient.min)}"`:void 0,e.zoneGradient?`data-sf-zone-axis-max="${h(e.zoneGradient.max)}"`:void 0,t?`tabindex="0" aria-label="${P(t.replace(/\s+/g," ").trim())}"`:void 0].filter(n=>n!==void 0);return r.length?` ${r.join(" ")}`:""}function SR(e,t,r,n){if(!e.length)return`<tspan x="${h(t)}"${r} font-size="${n}"></tspan>`;let o=[];for(let i of e){let a=o[o.length-1];a&&a.bold===i.bold?a.text+=` ${i.text}`:(a&&(a.text+=" "),o.push({text:i.text,bold:i.bold}))}return o.map((i,a)=>`<tspan${a===0?` x="${h(t)}"${r}`:""} font-size="${n}" font-weight="${i.bold?"bold":"normal"}">${P(i.text)}</tspan>`).join("")}function Um(e,t){let r=CR(e),n=`${h(e.fontSize)}px`,o=kR(e,r,n),i=e.richLines?' xml:space="preserve"':"";return`<text id="${t.elementId(e.id)}"${ot(e)} x="${h(r.x)}" y="${h(r.firstY)}" font-family="${P(e.fontFamily)}" font-size="${n}" font-weight="${e.fontWeight}"${e.letterSpacing?` letter-spacing="${h(e.letterSpacing)}"`:""} fill="${P(e.color)}" text-anchor="${r.anchor}" data-sf-valign="${e.verticalAlign}" data-sf-line-height="${h(e.lineHeight)}"${i}${Fe(e.rotation,e.rotationCenter)}>${o}</text>`}function CR(e){let t=e.fontSize*e.lineHeight,n=(e.richLines?e.richLines.length:e.lines.length)*t,o=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:o,firstY:RR(e,n),linePx:t,anchor:i}}function RR(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 kR(e,t,r){return e.richLines?e.richLines.map((n,o)=>SR(n,t.x,jm(o,t.linePx),r)).join(""):e.lines.map((n,o)=>wR(n,o,t,r)).join("")}function wR(e,t,r,n){return`<tspan x="${h(r.x)}" font-size="${n}"${jm(t,r.linePx)}>${P(e)}</tspan>`}function jm(e,t){return e?` dy="${h(t)}px"`:""}function vR(e,t){let r=Fe(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=P(JSON.stringify(e.shader.parameters)),o=e.fillColor?` data-sf-shader-fill="${P(e.fillColor)}"`:"";return`<foreignObject id="${t.elementId(e.id)}"${ot(e)} data-sf-shader="${P(e.shader.program)}" data-sf-shader-name="${P(e.shader.name)}" data-sf-shader-params="${n}" data-sf-shader-mask="${e.mask}"${o} x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(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 PR(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:${P(r.color)};font-weight:${P(r.fontWeight)};line-height:1">${P(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 ${P(r.divider)};border-radius:.09em;background:${P(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:${P(r.color)};font-weight:300;line-height:1">${P(e)}</span><span style="position:absolute;z-index:2;left:0;right:0;top:50%;height:1px;background:${P(r.divider)};pointer-events:none"></span></span>`}function LR(e,t){let r=Fe(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2}),n=e.componentStyle.fontSize>0?e.componentStyle.fontSize:Math.max(1,Math.min(e.width,e.height)*.28),o=e.label?`<span xmlns="http://www.w3.org/1999/xhtml" style="margin-bottom:.14em;color:${P(e.componentStyle.labelColor)};font-size:.16em;font-weight:600;letter-spacing:.24em;line-height:1">${P(e.label)}</span>`:"",i=[...e.value].map(s=>PR(s,e)).join(""),a=P(JSON.stringify(e.componentStyle));return`<foreignObject id="${t.elementId(e.id)}"${ot(e)} data-sf-widget="rollingNumber" data-sf-widget-value="${P(e.value)}" data-sf-widget-digits="${e.digits??""}" data-sf-widget-duration="${h(e.duration)}" data-sf-widget-style="${a}" x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(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:${P(e.componentStyle.fontFamily)};font-size:${h(n)}px">${o}<div data-sf-rolling-digits="true" aria-label="${P(e.value)}" style="display:flex;gap:${e.componentStyle.variant==="plain"?".02em":".1em"};font-size:1em">${i}</div></div></foreignObject>`}function Xm(e,t){if(e.type==="text")return Um(e,t);if(e.type==="shader-surface")return vR(e,t);if(e.type==="rolling-number")return LR(e,t);if(e.type==="image")return`<image id="${t.elementId(e.id)}"${ot(e)} ${Hm(e,t)} href="${P(e.href)}" x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}" preserveAspectRatio="xMidYMid slice"/>`;let r=`id="${t.elementId(e.id)}"${ot(e)} ${_m(e,t)}`;return e.type==="rect"?`<rect ${r} x="${h(e.x)}" y="${h(e.y)}" width="${h(e.width)}" height="${h(e.height)}"${e.rx?` rx="${h(e.rx)}"`:""}${Fe(e.rotation,{x:e.x+e.width/2,y:e.y+e.height/2})}/>`:e.type==="ellipse"?`<ellipse ${r} cx="${h(e.cx)}" cy="${h(e.cy)}" rx="${h(e.rx)}" ry="${h(e.ry)}"${Fe(e.rotation,{x:e.cx,y:e.cy})}/>`:`<path ${r} d="${P(e.d)}"${Fe(e.rotation,e.rotationCenter)}/>`}function qm(e,t={}){let r=t.padding??16,n=Math.max(1,e.bounds.maxX-e.bounds.minX+r*2),o=Math.max(1,e.bounds.maxY-e.bounds.minY+r*2),i=`${h(e.bounds.minX-r)} ${h(e.bounds.minY-r)} ${h(n)} ${h(o)}`,a=new Mn(t.idPrefix?`${t.idPrefix}-`:""),l=(t.linkHitAreas?Gm(e.nodes):e.nodes).map(u=>Xm(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="${h(n)}px" height="${h(o)}px" viewBox="${i}" role="img" data-sf-contract="${1}">
16
16
  <defs>${a.entries.join("")}</defs>
17
17
  ${l}
18
- </svg>`,width:n,height:o,diagnostics:e.diagnostics}}function Rn(e,t={}){return ym(e,t)}function EC(e,t={}){let r=bi(e,{measureText:t.measureText}),{svg:n,width:o,height:i,diagnostics:a}=Rn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var OC=50,Ke=new Map;function NC(e){let t=Ke.get(e);if(t)return Ke.delete(e),Ke.set(e,t),t;let r=bi(po(e));if(Ke.set(e,r),Ke.size>OC){let n=Ke.keys().next().value;n!==void 0&&Ke.delete(n)}return r}function kn(e,t={}){if(t.measureText)return EC(po(e),t);let r=NC(e),{svg:n,width:o,height:i,diagnostics:a}=Rn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var xm=new Set(["viewbox","width","height"]);function Sm(e,t){for(let r of Array.from(e.attributes))xm.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))xm.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function Cm(e,t,r){let n=[],o=[],i=[];for(let a of r){let s=e.has(a),l=t.has(a);l&&!s?n.push(a):s&&!l?o.push(a):s&&l&&i.push(a)}return{added:n,removed:o,changed:i}}function Rm(e,t){let r=e.querySelector(":scope > defs"),n=t.querySelector(":scope > defs");return n?(r?r.replaceWith(n):e.insertBefore(n,e.firstChild),n):(r?.remove(),r)}function BC(e,t){let r=!1;for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||(e.removeAttribute(n.name),r=!0);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&(e.setAttribute(n.name,n.value),r=!0);return r}function wm(e,t){let r=Array.from(e.childNodes),n=Array.from(t.childNodes);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){let i=r[o],a=n[o];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(!wm(s,l))return!1}return!0}function km(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function vm(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")),n=BC(e,t),o=!1;return r&&(o=!0,km(e,t)),t.tagName.toLowerCase()==="text"&&!wm(e,t)&&(o=!0,km(e,t)),n||o}function sr(e){return e.getAttribute("data-sf-id")??e.id}function IC(e){let t=new Map;for(let r of e.querySelectorAll(":scope > [id]"))t.set(r.id,r);return t}function GC(e,t,r){return e&&e.tagName===t.tagName?(vm(e,t)&&r(sr(t)),e):(e?.remove(),r(sr(t)),t)}function DC(e,t,r){let n=r?r.nextSibling:e.firstChild;n!==t&&e.insertBefore(t,n)}function Pm(e,t){let r=Rm(e,t),n=IC(e),o=new Set,i=new Set;for(let c of n.values())i.add(sr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let c of t.querySelectorAll(":scope > [id]")){o.add(c.id),a.add(sr(c));let u=GC(n.get(c.id),c,l);DC(e,u,d),d=u}for(let[c,u]of n)o.has(c)||(s.add(sr(u)),u.remove());return Cm(i,a,s)}function Lm(e,t){return Sm(e,t),Pm(e,t)}function xi(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 lr(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 wn=class{#e;#n;#t;constructor(t,r){this.#e=t,this.#n=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.#n},this.apply()}get(){return{...this.#t}}setNatural(t){this.#n=t}#r(t,r){let n=this.#e.getScreenCTM();if(!n)return null;let o=new DOMPoint(t,r).matrixTransform(n.inverse());return{x:o.x,y:o.y}}zoomBy(t,r,n){let o=this.#e.getBoundingClientRect();if(o.width<=0||o.height<=0)return;let i=r??o.left+o.width/2,a=n??o.top+o.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 n=this.#e.getScreenCTM()?.a,o=n&&n>0?n:1;this.#t.x-=t/o,this.#t.y-=r/o,this.apply()}};function Tm(e,t){let r=xi(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let n=new wn(r,lr(r));return e.appendChild(r),n.apply(),{svg:r,fit:()=>n.fit(),getViewport:()=>n.get(),zoomBy:(o,i,a)=>n.zoomBy(o,i,a),panBy:(o,i)=>n.panBy(o,i),updateContent(o){let i=xi(o),a=Lm(r,i);return n.setNatural(lr(i)),a},destroy(){r.remove()}}}var vn=class{handlers=new Map;on(t,r){let n=this.handlers.get(t)??new Set;this.handlers.set(t,n);let o=r;return n.add(o),()=>n.delete(o)}emit(t,r){let n=this.handlers.get(t);if(n!==void 0)for(let o of[...n])try{o(r)}catch(i){queueMicrotask(()=>{throw i})}}clear(){this.handlers.clear()}};var Pn=class extends vn{};function _C(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function FC(e,t){return new Promise((r,n)=>{let o=e.defaultView?.Image;if(!o){n(new Error("viewer export: Image is unavailable in this environment."));return}let i=new o;i.onload=()=>r(i),i.onerror=()=>n(new Error("viewer export: the SVG snapshot could not be decoded.")),i.src=t})}function HC(e,t,r){return new Promise((n,o)=>{e.toBlob(i=>{i?n(i):o(new Error(`viewer export: ${t} encoding failed.`))},t,r)})}async function Si(e,t,r={}){let n=lr(e),o=_C(r.scale,1),i=Math.max(1,Math.round(n.w*o)),a=Math.max(1,Math.round(n.h*o)),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 FC(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 HC(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var Ci="http://www.w3.org/2000/svg";function VC(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function WC(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function dr(e,t,r){let n=e.createElementNS(Ci,t);for(let[o,i]of Object.entries(r))n.setAttribute(o,String(i));return n}function zC(e){try{return{...U,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return U}}function YC(e,t,r=0){let n=r>0?r:Math.max(1,Math.min(e.width,e.height)*.28);return{size:n,plain:t,cellWidth:t?n*.62:n*.72+2,cellHeight:t?n*1.1:n*1.2+2,gap:n*(t?.02:.1)}}function jC(e,t,r){let n=dr(e,"g",{"font-family":r.fontFamily});for(let o of["id","transform","data-sf-id","data-sf-role","data-sf-kind"]){let i=t.getAttribute(o);i!==null&&n.setAttribute(o,i)}return n}function UC(e,t,r,n,o,i){let a=dr(e,"text",{x:r.x+r.width/2,y:n-o.size*.14,"text-anchor":"middle","font-size":o.size*.16,"font-weight":600,"letter-spacing":o.size*.04,fill:i.labelColor});return a.textContent=t,a}function XC(e,t,r,n,o,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=o,c=[];s||c.push(dr(e,"rect",{x:r+.5,y:n+.5,width:l-1,height:d-1,rx:a*.09,fill:i.surface,stroke:i.divider,"stroke-width":1}));let u=dr(e,"text",{x:r+l/2,y:n+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(dr(e,"line",{x1:r+.5,x2:r+l-.5,y1:n+d/2,y2:n+d/2,stroke:i.divider,"stroke-width":1})),c}function qC(e){let t=e.ownerDocument;for(let r of e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')){let n={x:Number(r.getAttribute("x")),y:Number(r.getAttribute("y")),width:Number(r.getAttribute("width")),height:Number(r.getAttribute("height"))},o=r.getAttribute("data-sf-widget-value")??"",i=zC(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=YC(n,i.variant==="plain",i.fontSize),l=a?s.size*.3:0,d=o.length*s.cellWidth+Math.max(0,o.length-1)*s.gap,c=n.x+(n.width-d)/2,u=n.y+(n.height-(l+s.cellHeight))/2+l,m=jC(t,r,i);a&&m.appendChild(UC(t,a,n,u,s,i)),[...o].forEach((f,g)=>{let b=c+g*(s.cellWidth+s.gap);for(let x of XC(t,f,b,u,s,i))m.appendChild(x)}),r.replaceWith(m)}}function Mm(e,t){let r=e.cloneNode(!0);WC(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(Ci,"image");VC(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),qC(r);let o=(r.getAttribute("viewBox")??"").split(/\s+/).map(Number);return o.length===4&&o.every(Number.isFinite)&&(r.setAttribute("width",String(o[2])),r.setAttribute("height",String(o[3]))),r.setAttribute("xmlns",Ci),r}function Ri(e,t){return new XMLSerializer().serializeToString(Mm(e,t))}var $m="http://www.w3.org/2000/svg";var ki=new Set([]);function I(e,t){return e.createElementNS($m,t)}function ke(e,t,r){let n=I(e,"g");n.setAttribute("data-sf-selection-overlay",t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}var KC="data-sf-change-overlay",cr="#f59e0b",Ln=1300,wi=400;function Am(e,t,r){let n=I(e,"g");n.setAttribute(KC,t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}function vi(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:Ln,easing:"linear",fill:"forwards"})}function Pi(e,t,r,n=cr){let o=t.getBBox(),i=Am(e,r,t),a=I(e,"rect");return a.setAttribute("x",String(o.x-4)),a.setAttribute("y",String(o.y-4)),a.setAttribute("width",String(o.width+8)),a.setAttribute("height",String(o.height+8)),a.setAttribute("fill","none"),a.setAttribute("stroke",n),a.setAttribute("stroke-width","3"),i.appendChild(a),i}function Li(e,t,r,n=cr){let o=Am(e,r,t),i=I(e,"path");i.setAttribute("d",t.getAttribute("d")??""),i.setAttribute("fill","none"),i.setAttribute("stroke",n);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"),o.appendChild(i),o}function Tt(e){return e.ctrlKey||e.metaKey}function Tn(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Mn(e){return e===1}var ZC=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function QC(e){return e==="entity"?"shape":e}function Be(e){let t=e.getAttribute(gn);if(!t)return null;let[r,n,o,i]=t.split(",").map(Number);return Number.isFinite(r)&&Number.isFinite(n)&&Number.isFinite(o)&&Number.isFinite(i)?{x:r,y:n,width:o,height:i}:null}function Ti(e){let t=e.getAttribute(bn);if(!t)return null;let r;try{r=JSON.parse(t)}catch{return null}return!Array.isArray(r)||!r.every(n=>Array.isArray(n)&&n.length===2)?null:{points:r,tension:Number(e.getAttribute(yn))||0,closed:e.getAttribute(xn)==="true"}}function Mi(e){let t=e.getAttribute(Sn);if(t===null)return null;let[r,n,o]=t.split(",").map(Number);if(!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(o))return null;let i=Number(e.getAttribute(ar))||0,[a,s]=(e.getAttribute(Cn)??"0,0").split(",").map(Number);return{width:r,height:n,depth:o,cornerRadius:i,bounds:Be(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function Ie(e){let t=e?.closest("[data-sf-id]");if(!t)return null;let r=t.getAttribute("data-sf-id"),n=t.getAttribute("data-sf-role");return!r||!n||!ZC.has(n)?null:{role:QC(n),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function Ze(e,t,r){let n=e.querySelectorAll(`[data-sf-id="${CSS.escape(t)}"]`);for(let o of n)if(r(o))return o;return null}var Qe=e=>e.hasAttribute("data-sf-primary");function $i(e){let t=e.getBoundingClientRect(),{width:r,height:n}=e.viewBox.baseVal;if(t.width<=0||r<=0)return 1;let o=t.width/r;return t.height>0&&n>0?Math.min(o,t.height/n):o}function A(e,t){return t/$i(e)}var $n=6,JC=14,Ai=3,Ei=1.5;function eR(e,t){let r=e.x+e.width/2,n=e.y+e.height/2;return[[r,e.y-t,"top"],[e.x+e.width+t,n,"right"],[r,e.y+e.height+t,"bottom"],[e.x-t,n,"left"]]}function tR(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var Em="#e8e8e8",Om="#ccc",rR="#9b42df",nR="#7c2fb5",oR=1.2;function Oi(e,t,r,n,o,i){let a=I(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(n)),a.setAttribute("fill",Em),a.setAttribute("stroke",Om),a.setAttribute("stroke-width",String(o)),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(n*oR)),a.setAttribute("fill",rR),a.setAttribute("stroke",nR),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(n)),a.setAttribute("fill",Em),a.setAttribute("stroke",Om),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function Ni(e,t,r,n,o){let i=I(e,"path");return i.setAttribute("d",tR(t,r,n)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(o)),i.setAttribute("stroke-linecap","round"),i}function An(e,t,r,n){let o=ke(e,r,t),i=A(n,$n),a=i+A(n,JC),s=A(n,Ai),l=A(n,Ei),d=Be(t)??t.getBBox();for(let[c,u,m]of eR(d,a))o.append(Oi(e,c,u,i,l,m),Ni(e,c,u,s,l));return o}var Gi="#9b42df",iR=2,aR=3.25,sR=14,Bm=34,lR=10.5,dR=8.5;function Nm(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function cR(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 Di(e){let t=e.reduce((r,n)=>({x:r.x+n.x,y:r.y+n.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}var _i="data-sf-iso-halo";function uR(e,t,r,n){let o=I(e,"g");o.setAttribute("data-sf-resize-handle",`iso-${t}`),o.style.cursor=cR(r);let i=I(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(A(n,sR))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",o.appendChild(i);let a=I(e,"line");a.setAttribute("stroke",Gi),a.setAttribute("stroke-width",String(A(n,aR))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",o.appendChild(a);let s=I(e,"polygon");return s.setAttribute("fill",Gi),s.style.pointerEvents="none",o.appendChild(s),{group:o,hit:i,shaft:a,head:s}}function mR(e,t,r,n){let o=A(n,Bm),i=A(n,lR),a=A(n,dR),s={x:t.x+r.x*o,y:t.y+r.y*o},l={x:t.x+r.x*(o-i),y:t.y+r.y*(o-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 Bi(e,t,r,n,o){let i=uR(e,n,r,o);return mR(i,t,r,o),i.group}function En(e){let t=De(e),r=t.top[0],n=t.top[1],o=t.top[3],i=t.front[2];return{width:{origin:Di(t.right),direction:Nm({x:n.x-r.x,y:n.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:Di(t.front),direction:Nm({x:o.x-r.x,y:o.y-r.y})}}}var pR=Bm+$n+10;function Ii(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function Fi(e){let t=De(e),r=En(e),n=Di([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:Ii(r.width.origin,n),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:Ii(r.depth.origin,n),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:Ii(r.height.origin,n),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var Hi="data-sf-iso-duplicate-bubbles",fR=["iso-height-neg","iso-depth-pos","iso-width-pos"];function Vi(e,t,r){let n=I(e,"g");n.setAttribute(Hi,"");let o=A(r,$n),i=A(r,pR),a=A(r,Ai),s=A(r,Ei),l=Fi(t);for(let d of fR){let{origin:c,direction:u}=l[d],m=c.x+u.x*i,f=c.y+u.y*i;n.append(Oi(e,m,f,o,s,d),Ni(e,m,f,a,s))}return n}function On(e,t,r,n){let o=Be(t)??t.getBBox(),i=Mi(t),a=ke(e,r,t),s=I(e,"path");s.setAttribute(_i,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",Gi);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+A(n,iR))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=En({x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0});return a.appendChild(Bi(e,d.width.origin,d.width.direction,"width",n)),a.appendChild(Bi(e,d.height.origin,d.height.direction,"height",n)),a.appendChild(Bi(e,d.depth.origin,d.depth.direction,"depth",n)),a.appendChild(Vi(e,{x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0},n)),a}var Wi="#9b42df",hR=4,gR=5,Gm=1.5;function bR(e,t,r){let n=I(e,"path");n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",Wi);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+A(r,hR))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function Im(e,t,r,n,o){let i=t.getPointAtLength(r),a=I(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(A(o,gR))),a.setAttribute("fill",Wi),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(A(o,Gm))),a.setAttribute("data-sf-link-endpoint",n),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var yR=22,xR=8;function SR(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function CR(e,t,r){let n=[];return SR(t).forEach((o,i)=>{if(!o.movable)return;let a=Math.abs(o.bx-o.ax)>Math.abs(o.by-o.ay),s=A(r,yR),l=A(r,xR),d=a?s:l,c=a?l:s,u=I(e,"rect");u.setAttribute("x",String((o.ax+o.bx)/2-d/2)),u.setAttribute("y",String((o.ay+o.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",Wi),u.setAttribute("stroke-width",String(A(r,Gm))),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",n.push(u)}),n}function Nn(e,t,r,n){let o=ke(e,r,t),i=t.getTotalLength();return o.append(bR(e,t,n),...CR(e,t,n),Im(e,t,0,"from",n),Im(e,t,i,"to",n)),o}var Dm="#9b42df",RR=4,kR=5,wR=1.5,zi="data-sf-path-halo";function vR(e,t,r){let n=I(e,"path");n.setAttribute(zi,""),n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",Dm);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+A(r,RR))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function PR(e,t,r,n,o){let i=I(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(A(o,kR))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",Dm),i.setAttribute("stroke-width",String(A(o,wR))),i.setAttribute(fm,String(n)),i.style.pointerEvents="auto",i.style.cursor="move",i}function Bn(e,t,r,n){let o=ke(e,r,t);o.appendChild(vR(e,t,n));let i=Ti(t);for(let[a,[s,l]]of(i?.points??[]).entries())o.appendChild(PR(e,s,l,a,n));return o}var LR=6,TR=1,MR="#992dff",$R={"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 Yi(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 AR=new Set(["top","bottom"]);function _m(e,t,r,n=!1){let o=A(r,LR),i=A(r,TR);return(n?Yi(t).filter(([,,s])=>!AR.has(s)):Yi(t)).map(([s,l,d])=>{let c=I(e,"rect");return c.setAttribute("x",String(s-o/2)),c.setAttribute("y",String(l-o/2)),c.setAttribute("width",String(o)),c.setAttribute("height",String(o)),c.setAttribute("fill","white"),c.setAttribute("stroke",MR),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=n?"ew-resize":$R[d],c})}var ER="#9b42df",OR=3,NR=1;function In(e,t,r,n,o=!1){let i=Be(t)??t.getBBox(),a=ke(e,r,t),s=A(n,NR),l=I(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",ER),l.setAttribute("stroke-width",String(A(n,OR))),a.appendChild(l),a.append(..._m(e,i,n,o)),a}function Fm(e){let t=new Map;return{flash:(n,o=cr)=>{let i=[...new Set(n)];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=Ze(e,l,Qe);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"?Li(a,d,l,o):Pi(a,d,l,o);e.appendChild(u),vi(u,s);let m=s?wi:Ln;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},m))}},destroy(){for(let n of t.values())clearTimeout(n);t.clear()}}}function Hm(e,t,r){let n=o=>{r&&o.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}function ji(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function Vm(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 Wm(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var DR="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function Ui(e){return!!e?.closest(DR)}var Gn=class{#e;#n;#t;#r;constructor(t,r,n,o){this.#e=t,this.#n=r,this.#t=n,this.#r=o}hover(t){let r=Ie(t.target);this.#n.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:ji(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,n=Ie(r);if(!n){this.#o(r);return}this.#i(n,t)}#o(t){Ui(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let n=ji(r);this.#r.dispatch(Wm(t.id,n)),this.#n.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:n});let o=Ze(this.#e,t.id,Qe);o&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","-1"),o?.focus({preventScroll:!0})}};var _R=4,Xi=class{#e;#n;#t;#r=null;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=n}bind(){return this.#e.svg.addEventListener("pointerdown",this.#o),this.#e.svg.addEventListener("pointermove",this.#i),this.#e.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#o=t=>{let r=t.target,n=!!Ie(r)||Ui(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:Tt(t)||!n}};#i=t=>{this.#a(t)||this.#t&&this.#n.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#t&&this.#n.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>_R&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&Tt(t)&&this.#e.panBy(t.movementX,t.movementY),!0)}#l(){this.#e.svg.removeEventListener("pointerdown",this.#o),this.#e.svg.removeEventListener("pointermove",this.#i),this.#e.svg.removeEventListener("pointerup",this.#s)}};function zm(e){let{display:t,emitter:r,diagramId:n,selection:o,selectable:i}=e,a=new Gn(t.svg,r,n,o);return new Xi(t,a,i).bind()}function qi(e,t,r){for(let o of e.querySelectorAll("[data-sf-selection-overlay]"))o.remove();let n=e.ownerDocument;for(let o of t){let i=Ze(e,o,Qe);if(!i)continue;let a=r.get(o),s=a?.role==="link"?Nn(n,i,o,e):a?.role==="path"?Bn(n,i,o,e):a?.role==="isometric"?On(n,i,o,e):In(n,i,o,e,a?ki.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(An(n,i,o,e))}}var Dn=class{#e;#n;#t;#r=new Map;#o=new Set;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=n}getOwners(){return[...this.#o].map(t=>this.#r.get(t)).filter(t=>!!t)}remember(t){this.#r.set(t.id,t)}dispatch(t){this.#o=Vm(this.#o,t),qi(this.#e,this.#o,this.#r),this.#n.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#o.size>0&&qi(this.#e,this.#o,this.#r)}selectIds(t){for(let r of t){let n=this.#e.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),o=Ie(n);o&&this.remember(o)}this.dispatch({type:"set",ids:t})}};function Ym(e,t){let r=n=>{Tt(n)&&(n.preventDefault(),e.zoomBy(n.deltaY<0?1.1:.9090909090909091,n.clientX,n.clientY),t.repaint())};return e.svg.addEventListener("wheel",r,{passive:!1}),()=>{e.svg.removeEventListener("wheel",r)}}function jm(e,t,r,n={}){let o=n.selectable??!0,i=new Dn(e.svg,t,r),a=zm({display:e,emitter:t,diagramId:r,selection:i,selectable:o}),s=Ym(e,i),l=Hm(e.svg,i,o),d=Fm(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 Ki={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 FR=`
18
+ </svg>`,width:n,height:o,diagnostics:e.diagnostics}}function Gn(e,t={}){return qm(e,t)}function $R(e,t={}){let r=Bi(e,{measureText:t.measureText}),{svg:n,width:o,height:i,diagnostics:a}=Gn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var MR=50,He=new Map,Km=Lr();function AR(e){let t=Lr();t!==Km&&(He.clear(),Km=t);let r=He.get(e);if(r)return He.delete(e),He.set(e,r),r;let n=Bi(Ao(e));if(He.set(e,n),He.size>MR){let o=He.keys().next().value;o!==void 0&&He.delete(o)}return n}function Dn(e,t={}){if(t.measureText)return $R(Ao(e),t);let r=AR(e),{svg:n,width:o,height:i,diagnostics:a}=Gn(r,t);return{svg:n,width:o,height:i,diagnostics:a,scene:r}}var Gi="http://www.w3.org/1999/xhtml",_n=(e,t)=>{Object.assign(e.style,t)};function Fn(e,t,r){let n=e.createElementNS(Gi,"span");return n.setAttribute("data-sf-rolling-current","true"),n.textContent=t,_n(n,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),n}function ER(e,t,r){let n=e.createElementNS(Gi,"span");if(n.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return _n(n,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),n.appendChild(Fn(e,t,r)),n;_n(n,{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)"}),n.appendChild(Fn(e,t,r));let o=e.createElementNS(Gi,"span");return _n(o,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),n.appendChild(o),n}function Hn(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 NR(e,t,r,n){let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Fn(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=Hn(i,[a,s],n),d=o?Hn(o,[s,a],n):null,c=()=>{o?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function OR(e,t,r,n){if(r.motion==="fade"){NR(e,t,r,n);return}let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Fn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=Hn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],n),s=o?Hn(o,[{transform:"translateY(0)",opacity:1},{transform:"translateY(-100%)",opacity:.25}],n):null,l=()=>{o?.remove(),i.style.transform="translateY(0)",i.style.opacity="1"};a?a.finished.then(l,l):(s?.cancel(),l())}function Zm(e,t,r,n,o){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>ER(e.ownerDocument,a,n))),e.setAttribute("aria-label",r);return}let i=[...e.querySelectorAll("[data-sf-rolling-digit]")];[...r].forEach((a,s)=>{t[s]!==a&&OR(i[s],a,n,o)}),e.setAttribute("aria-label",r)}function Di(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var BR=140;function IR(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Qm(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return j;try{return{...j,...JSON.parse(t)}}catch{return j}}function GR(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function DR(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 Vn(e,t,r){let n=IR(e);if(!n)return!1;let o=e.getAttribute("data-sf-widget-value")??"",i=Wt(t,GR(e.getAttribute("data-sf-widget-digits")));return o===i||(Zm(n,o,i,Qm(e),r?DR(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function _i(e){let t=new Map,r=new Map,n=new Map;return{setValue(o,i){let a=Di(e,o);if(!a)return!1;if(t.set(o,i),Qm(a).motion!=="fade")return Vn(a,i,!0);let s=Date.now(),l=(r.get(o)??0)+BR-s;return l<=0?(r.set(o,s),Vn(a,i,!0)):(n.has(o)||n.set(o,setTimeout(()=>{n.delete(o),r.set(o,Date.now());let d=Di(e,o),c=t.get(o);d&&c!==void 0&&Vn(d,c,!0)},l)),!0)},refresh(){for(let[o,i]of t){let a=Di(e,o);a&&Vn(a,i,!1)}},clearValues(){for(let o of n.values())clearTimeout(o);n.clear(),t.clear()},destroy(){for(let o of n.values())clearTimeout(o);n.clear(),t.clear()}}}var Jm=new WeakMap,ep=new WeakMap,tp=new WeakMap;function Vi(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function rp(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function Fi(e,t){return Number(e)>0?Number(e):t}function np(e,t){let r=rp(e),n=Number(r.min)||0,o=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return Vi(o===n?0:(t-n)/(o-n))}function Hi(e,t,r){let n=e.getAttribute("transform")??"",o=n===ep.get(e)?Jm.get(e)??"":n;Jm.set(e,o);let i=`translate(${t} ${r}) ${o}`.trim();ep.set(e,i),e.setAttribute("transform",i)}function op(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}var _R=[255,255,255];function FR(e,t,r){let n=tp.get(e)??e.getAttribute("fill")??"";tp.set(e,n);let o=op(n);if(!o)return;let i=o.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 ip(e,t){let r=new Map;for(let n of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let o=rp(n),i=(typeof o.peak=="string"?op(o.peak):null)??_R,a=n.getAttribute("data-sf-id")??"",s=Number(n.getAttribute("x")),l=Number(n.getAttribute("y")),d=Number(n.getAttribute("width")),c=Number(n.getAttribute("height")),u=o.axis==="horizontal",p=Vi(t(a)??Number(o.progress)),f=Fi(o.inset,.05),g=Fi(o.line,.7),b=u?d:c,x=u?c:d,C=f+(1-2*f)*p,L=o.dent===void 0?1:Number(o.dent),v=(L<0?1:L)*.16*x,M=typeof o.knob=="string"?o.knob:"";if(M){let be=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(M)}"]`)],Oe=be.find(ie=>ie.hasAttribute("data-sf-primary"));if(Oe?.getBBox){Hi(Oe,0,0);let ie=Oe.getBBox(),Vt=(u?ie.height:ie.width)/2;r.set(a,Vt/x);let vr=(o.gap===void 0?.04:Number(o.gap))*x,wa=g*x-v+Vt+vr,va=u?{x:s+d*C,y:l+wa}:{x:s+wa,y:l+c*(1-C)},bf=va.x-(ie.x+ie.width/2),yf=va.y-(ie.y+ie.height/2);for(let xf of be)Hi(xf,bf,yf)}}let H=Number(o.min)||0,I=Number.isFinite(Number(o.max))&&o.max!==void 0?Number(o.max):100,V=Fi(o.spread,.07)*b,U=f*b,ne=(1-2*f)*b,Ne=U+ne*p;for(let be of e.querySelectorAll(`text[data-sf-id="${CSS.escape(a)}"]`)){let Oe=Number(be.textContent);if(!Number.isFinite(Oe)||I===H)continue;let ie=U+ne*Vi((Oe-H)/(I-H)),Vt=Math.exp(-(((ie-Ne)/V)**2)),vr=v*.4*Vt;Hi(be,u?0:-vr,u?-vr:0),FR(be,Vt,i)}}return r}var ap=new Set(["viewbox","width","height"]);function sp(e,t){for(let r of Array.from(e.attributes))ap.has(r.name.toLowerCase())||e.removeAttribute(r.name);for(let r of Array.from(t.attributes))ap.has(r.name.toLowerCase())||e.setAttribute(r.name,r.value)}function lp(e,t,r){let n=[],o=[],i=[];for(let a of r){let s=e.has(a),l=t.has(a);l&&!s?n.push(a):s&&!l?o.push(a):s&&l&&i.push(a)}return{added:n,removed:o,changed:i}}function dp(e,t){let r=e.querySelector(":scope > defs"),n=t.querySelector(":scope > defs");return n?(r?r.replaceWith(n):e.insertBefore(n,e.firstChild),n):(r?.remove(),r)}function HR(e,t){let r=!1;for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||(e.removeAttribute(n.name),r=!0);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&(e.setAttribute(n.name,n.value),r=!0);return r}function up(e,t){let r=Array.from(e.childNodes),n=Array.from(t.childNodes);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){let i=r[o],a=n[o];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(!up(s,l))return!1}return!0}function cp(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}function mp(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")),n=HR(e,t),o=!1;return r&&(o=!0,cp(e,t)),t.tagName.toLowerCase()==="text"&&!up(e,t)&&(o=!0,cp(e,t)),n||o}function Sr(e){return e.getAttribute("data-sf-id")??e.id}function VR(e){let t=new Map;for(let r of e.querySelectorAll(":scope > [id]"))t.set(r.id,r);return t}function WR(e,t,r){return e&&e.tagName===t.tagName?(mp(e,t)&&r(Sr(t)),e):(e?.remove(),r(Sr(t)),t)}function zR(e,t,r){let n=r?r.nextSibling:e.firstChild;n!==t&&e.insertBefore(t,n)}function pp(e,t){let r=dp(e,t),n=VR(e),o=new Set,i=new Set;for(let c of n.values())i.add(Sr(c));let a=new Set,s=new Set,l=c=>{s.add(c)},d=r;for(let c of t.querySelectorAll(":scope > [id]")){o.add(c.id),a.add(Sr(c));let u=WR(n.get(c.id),c,l);zR(e,u,d),d=u}for(let[c,u]of n)o.has(c)||(s.add(Sr(u)),u.remove());return lp(i,a,s)}function fp(e,t){return sp(e,t),pp(e,t)}function Wi(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 Cr(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 Wn=class{#e;#n;#t;constructor(t,r){this.#e=t,this.#n=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.#n},this.apply()}get(){return{...this.#t}}setNatural(t){this.#n=t}#r(t,r){let n=this.#e.getScreenCTM();if(!n)return null;let o=new DOMPoint(t,r).matrixTransform(n.inverse());return{x:o.x,y:o.y}}zoomBy(t,r,n){let o=this.#e.getBoundingClientRect();if(o.width<=0||o.height<=0)return;let i=r??o.left+o.width/2,a=n??o.top+o.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 n=this.#e.getScreenCTM()?.a,o=n&&n>0?n:1;this.#t.x-=t/o,this.#t.y-=r/o,this.apply()}};function hp(e,t){let r=Wi(t);r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.style.display="block",r.style.touchAction="none";let n=new Wn(r,Cr(r));return e.appendChild(r),n.apply(),{svg:r,fit:()=>n.fit(),getViewport:()=>n.get(),zoomBy:(o,i,a)=>n.zoomBy(o,i,a),panBy:(o,i)=>n.panBy(o,i),updateContent(o){let i=Wi(o),a=fp(r,i);return n.setNatural(Cr(i)),a},destroy(){r.remove()}}}var zn=class{handlers=new Map;on(t,r){let n=this.handlers.get(t)??new Set;this.handlers.set(t,n);let o=r;return n.add(o),()=>n.delete(o)}emit(t,r){let n=this.handlers.get(t);if(n!==void 0)for(let o of[...n])try{o(r)}catch(i){queueMicrotask(()=>{throw i})}}clear(){this.handlers.clear()}};var Yn=class extends zn{};function YR(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function UR(e,t){return new Promise((r,n)=>{let o=e.defaultView?.Image;if(!o){n(new Error("viewer export: Image is unavailable in this environment."));return}let i=new o;i.onload=()=>r(i),i.onerror=()=>n(new Error("viewer export: the SVG snapshot could not be decoded.")),i.src=t})}function jR(e,t,r){return new Promise((n,o)=>{e.toBlob(i=>{i?n(i):o(new Error(`viewer export: ${t} encoding failed.`))},t,r)})}async function zi(e,t,r={}){let n=Cr(e),o=YR(r.scale,1),i=Math.max(1,Math.round(n.w*o)),a=Math.max(1,Math.round(n.h*o)),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 UR(e.ownerDocument,c),p=r.backgroundColor??(r.format==="jpeg"?"#ffffff":void 0);p&&(l.fillStyle=p,l.fillRect(0,0,i,a)),l.drawImage(u,0,0,i,a);let f=r.format==="jpeg"?"image/jpeg":"image/png";return await jR(s,f,r.quality)}finally{URL.revokeObjectURL(c)}}var Yi="http://www.w3.org/2000/svg";function XR(e,t){for(let r of e.attributes)r.name.startsWith("data-sf-shader")||t.setAttribute(r.name,r.value)}function qR(e){for(let t of e.querySelectorAll('[data-sf-selection-overlay], [data-sf-change-overlay], [id*="link-hit-"]'))t.remove()}function Rr(e,t,r){let n=e.createElementNS(Yi,t);for(let[o,i]of Object.entries(r))n.setAttribute(o,String(i));return n}function KR(e){try{return{...j,...JSON.parse(e.getAttribute("data-sf-widget-style")??"{}")}}catch{return j}}function ZR(e,t,r=0){let n=r>0?r:Math.max(1,Math.min(e.width,e.height)*.28);return{size:n,plain:t,cellWidth:t?n*.62:n*.72+2,cellHeight:t?n*1.1:n*1.2+2,gap:n*(t?.02:.1)}}function QR(e,t,r){let n=Rr(e,"g",{"font-family":r.fontFamily});for(let o of["id","transform","data-sf-id","data-sf-role","data-sf-kind"]){let i=t.getAttribute(o);i!==null&&n.setAttribute(o,i)}return n}function JR(e,t,r,n,o,i){let a=Rr(e,"text",{x:r.x+r.width/2,y:n-o.size*.14,"text-anchor":"middle","font-size":o.size*.16,"font-weight":600,"letter-spacing":o.size*.04,fill:i.labelColor});return a.textContent=t,a}function ek(e,t,r,n,o,i){let{size:a,plain:s,cellWidth:l,cellHeight:d}=o,c=[];s||c.push(Rr(e,"rect",{x:r+.5,y:n+.5,width:l-1,height:d-1,rx:a*.09,fill:i.surface,stroke:i.divider,"stroke-width":1}));let u=Rr(e,"text",{x:r+l/2,y:n+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(Rr(e,"line",{x1:r+.5,x2:r+l-.5,y1:n+d/2,y2:n+d/2,stroke:i.divider,"stroke-width":1})),c}function tk(e){let t=e.ownerDocument;for(let r of e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')){let n={x:Number(r.getAttribute("x")),y:Number(r.getAttribute("y")),width:Number(r.getAttribute("width")),height:Number(r.getAttribute("height"))},o=r.getAttribute("data-sf-widget-value")??"",i=KR(r),a=r.querySelector("div > span:not([data-sf-rolling-digit])")?.textContent??"",s=ZR(n,i.variant==="plain",i.fontSize),l=a?s.size*.3:0,d=o.length*s.cellWidth+Math.max(0,o.length-1)*s.gap,c=n.x+(n.width-d)/2,u=n.y+(n.height-(l+s.cellHeight))/2+l,p=QR(t,r,i);a&&p.appendChild(JR(t,a,n,u,s,i)),[...o].forEach((f,g)=>{let b=c+g*(s.cellWidth+s.gap);for(let x of ek(t,f,b,u,s,i))p.appendChild(x)}),r.replaceWith(p)}}function gp(e,t){let r=e.cloneNode(!0);qR(r),[...r.querySelectorAll("foreignObject[data-sf-shader]")].forEach((i,a)=>{let s=t[a];if(!s){i.remove();return}let l=r.ownerDocument.createElementNS(Yi,"image");XR(i,l),l.setAttribute("href",s),l.setAttribute("preserveAspectRatio","none"),i.replaceWith(l)}),tk(r);let o=(r.getAttribute("viewBox")??"").split(/\s+/).map(Number);return o.length===4&&o.every(Number.isFinite)&&(r.setAttribute("width",String(o[2])),r.setAttribute("height",String(o[3]))),r.setAttribute("xmlns",Yi),r}function Ui(e,t){return new XMLSerializer().serializeToString(gp(e,t))}var bp="http://www.w3.org/2000/svg";var ji=new Set([]);function D(e,t){return e.createElementNS(bp,t)}function Pe(e,t,r){let n=D(e,"g");n.setAttribute("data-sf-selection-overlay",t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}var rk="data-sf-change-overlay",kr="#f59e0b",Un=1300,Xi=400;function yp(e,t,r){let n=D(e,"g");n.setAttribute(rk,t),n.setAttribute("pointer-events","none");let o=r.getAttribute("transform");return o&&n.setAttribute("transform",o),n}function qi(e,t){t||e.animate([{opacity:1},{opacity:0}],{duration:Un,easing:"linear",fill:"forwards"})}function Ki(e,t,r,n=kr){let o=t.getBBox(),i=yp(e,r,t),a=D(e,"rect");return a.setAttribute("x",String(o.x-4)),a.setAttribute("y",String(o.y-4)),a.setAttribute("width",String(o.width+8)),a.setAttribute("height",String(o.height+8)),a.setAttribute("fill","none"),a.setAttribute("stroke",n),a.setAttribute("stroke-width","3"),i.appendChild(a),i}function Zi(e,t,r,n=kr){let o=yp(e,r,t),i=D(e,"path");i.setAttribute("d",t.getAttribute("d")??""),i.setAttribute("fill","none"),i.setAttribute("stroke",n);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"),o.appendChild(i),o}function _t(e){return e.ctrlKey||e.metaKey}function jn(e){let t=/data-sf-contract="(\d+)"/.exec(e);return t?Number(t[1]):null}function Xn(e){return e===1}var nk=new Set(["entity","link","frame","swimlane","chart","path","widget","isometric"]);function ok(e){return e==="entity"?"shape":e}function Ve(e){let t=e.getAttribute(An);if(!t)return null;let[r,n,o,i]=t.split(",").map(Number);return Number.isFinite(r)&&Number.isFinite(n)&&Number.isFinite(o)&&Number.isFinite(i)?{x:r,y:n,width:o,height:i}:null}function Qi(e){let t=e.getAttribute(En);if(!t)return null;let r;try{r=JSON.parse(t)}catch{return null}return!Array.isArray(r)||!r.every(n=>Array.isArray(n)&&n.length===2)?null:{points:r,tension:Number(e.getAttribute(Nn))||0,closed:e.getAttribute(On)==="true"}}function Ji(e){let t=e.getAttribute(Bn);if(t===null)return null;let[r,n,o]=t.split(",").map(Number);if(!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(o))return null;let i=Number(e.getAttribute(xr))||0,[a,s]=(e.getAttribute(In)??"0,0").split(",").map(Number);return{width:r,height:n,depth:o,cornerRadius:i,bounds:Ve(e),labelOffsetX:Number.isFinite(a)?a:0,labelOffsetY:Number.isFinite(s)?s:0}}function We(e){let t=e?.closest("[data-sf-id]");if(!t)return null;let r=t.getAttribute("data-sf-id"),n=t.getAttribute("data-sf-role");return!r||!n||!nk.has(n)?null:{role:ok(n),id:r,kind:t.getAttribute("data-sf-kind")??void 0,label:t.getAttribute("aria-label")??void 0}}function it(e,t,r){let n=e.querySelectorAll(`[data-sf-id="${CSS.escape(t)}"]`);for(let o of n)if(r(o))return o;return null}var at=e=>e.hasAttribute("data-sf-primary");function ea(e){let t=e.getBoundingClientRect(),{width:r,height:n}=e.viewBox.baseVal;if(t.width<=0||r<=0)return 1;let o=t.width/r;return t.height>0&&n>0?Math.min(o,t.height/n):o}function A(e,t){return t/ea(e)}var qn=6,ik=14,ta=3,ra=1.5;function ak(e,t){let r=e.x+e.width/2,n=e.y+e.height/2;return[[r,e.y-t,"top"],[e.x+e.width+t,n,"right"],[r,e.y+e.height+t,"bottom"],[e.x-t,n,"left"]]}function sk(e,t,r){return`M ${e-r} ${t} L ${e+r} ${t} M ${e} ${t-r} L ${e} ${t+r}`}var xp="#e8e8e8",Sp="#ccc",lk="#9b42df",dk="#7c2fb5",ck=1.2;function na(e,t,r,n,o,i){let a=D(e,"circle");return a.setAttribute("cx",String(t)),a.setAttribute("cy",String(r)),a.setAttribute("r",String(n)),a.setAttribute("fill",xp),a.setAttribute("stroke",Sp),a.setAttribute("stroke-width",String(o)),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(n*ck)),a.setAttribute("fill",lk),a.setAttribute("stroke",dk),a.nextElementSibling?.setAttribute("stroke","#ffffff")}),a.addEventListener("pointerleave",()=>{a.setAttribute("r",String(n)),a.setAttribute("fill",xp),a.setAttribute("stroke",Sp),a.nextElementSibling?.setAttribute("stroke","#999")}),a}function oa(e,t,r,n,o){let i=D(e,"path");return i.setAttribute("d",sk(t,r,n)),i.setAttribute("stroke","#999"),i.setAttribute("stroke-width",String(o)),i.setAttribute("stroke-linecap","round"),i}function Kn(e,t,r,n){let o=Pe(e,r,t),i=A(n,qn),a=i+A(n,ik),s=A(n,ta),l=A(n,ra),d=Ve(t)??t.getBBox();for(let[c,u,p]of ak(d,a))o.append(na(e,c,u,i,l,p),oa(e,c,u,s,l));return o}var sa="#9b42df",uk=2,mk=3.25,pk=14,Rp=34,fk=10.5,hk=8.5;function Cp(e){let t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t}}function gk(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 la(e){let t=e.reduce((r,n)=>({x:r.x+n.x,y:r.y+n.y}),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}var da="data-sf-iso-halo";function bk(e,t,r,n){let o=D(e,"g");o.setAttribute("data-sf-resize-handle",`iso-${t}`),o.style.cursor=gk(r);let i=D(e,"line");i.setAttribute("stroke","transparent"),i.setAttribute("stroke-width",String(A(n,pk))),i.setAttribute("stroke-linecap","round"),i.style.pointerEvents="stroke",o.appendChild(i);let a=D(e,"line");a.setAttribute("stroke",sa),a.setAttribute("stroke-width",String(A(n,mk))),a.setAttribute("stroke-linecap","round"),a.style.pointerEvents="none",o.appendChild(a);let s=D(e,"polygon");return s.setAttribute("fill",sa),s.style.pointerEvents="none",o.appendChild(s),{group:o,hit:i,shaft:a,head:s}}function yk(e,t,r,n){let o=A(n,Rp),i=A(n,fk),a=A(n,hk),s={x:t.x+r.x*o,y:t.y+r.y*o},l={x:t.x+r.x*(o-i),y:t.y+r.y*(o-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 ia(e,t,r,n,o){let i=bk(e,n,r,o);return yk(i,t,r,o),i.group}function Zn(e){let t=Ye(e),r=t.top[0],n=t.top[1],o=t.top[3],i=t.front[2];return{width:{origin:la(t.right),direction:Cp({x:n.x-r.x,y:n.y-r.y})},height:{origin:i,direction:{x:0,y:1}},depth:{origin:la(t.front),direction:Cp({x:o.x-r.x,y:o.y-r.y})}}}var xk=Rp+qn+10;function aa(e,t){return{x:t.x*2-e.x,y:t.y*2-e.y}}function ca(e){let t=Ye(e),r=Zn(e),n=la([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:aa(r.width.origin,n),direction:{x:-r.width.direction.x,y:-r.width.direction.y}},"iso-depth-pos":r.depth,"iso-depth-neg":{origin:aa(r.depth.origin,n),direction:{x:-r.depth.direction.x,y:-r.depth.direction.y}},"iso-height-pos":r.height,"iso-height-neg":{origin:aa(r.height.origin,n),direction:{x:-r.height.direction.x,y:-r.height.direction.y}}}}var ua="data-sf-iso-duplicate-bubbles",Sk=["iso-height-neg","iso-depth-pos","iso-width-pos"];function ma(e,t,r){let n=D(e,"g");n.setAttribute(ua,"");let o=A(r,qn),i=A(r,xk),a=A(r,ta),s=A(r,ra),l=ca(t);for(let d of Sk){let{origin:c,direction:u}=l[d],p=c.x+u.x*i,f=c.y+u.y*i;n.append(na(e,p,f,o,s,d),oa(e,p,f,a,s))}return n}function Qn(e,t,r,n){let o=Ve(t)??t.getBBox(),i=Ji(t),a=Pe(e,r,t),s=D(e,"path");s.setAttribute(da,""),s.setAttribute("d",t.getAttribute("d")??""),s.setAttribute("fill","none"),s.setAttribute("stroke",sa);let l=Number(t.getAttribute("stroke-width"))||2;s.setAttribute("stroke-width",String(l+A(n,uk))),s.setAttribute("opacity","0.6"),s.style.pointerEvents="none",a.appendChild(s);let d=Zn({x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0});return a.appendChild(ia(e,d.width.origin,d.width.direction,"width",n)),a.appendChild(ia(e,d.height.origin,d.height.direction,"height",n)),a.appendChild(ia(e,d.depth.origin,d.depth.direction,"depth",n)),a.appendChild(ma(e,{x:o.x,y:o.y,width:i?.width??o.width,height:i?.height??o.height,depth:i?.depth??0},n)),a}var pa="#9b42df",Ck=4,Rk=5,wp=1.5;function kk(e,t,r){let n=D(e,"path");n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",pa);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+A(r,Ck))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function kp(e,t,r,n,o){let i=t.getPointAtLength(r),a=D(e,"circle");return a.setAttribute("cx",String(i.x)),a.setAttribute("cy",String(i.y)),a.setAttribute("r",String(A(o,Rk))),a.setAttribute("fill",pa),a.setAttribute("stroke","white"),a.setAttribute("stroke-width",String(A(o,wp))),a.setAttribute("data-sf-link-endpoint",n),a.style.pointerEvents="auto",a.style.cursor="crosshair",a}var wk=22,vk=8;function Pk(e){try{return JSON.parse(e.getAttribute("data-sf-link-segments")??"[]")}catch{return[]}}function Lk(e,t,r){let n=[];return Pk(t).forEach((o,i)=>{if(!o.movable)return;let a=Math.abs(o.bx-o.ax)>Math.abs(o.by-o.ay),s=A(r,wk),l=A(r,vk),d=a?s:l,c=a?l:s,u=D(e,"rect");u.setAttribute("x",String((o.ax+o.bx)/2-d/2)),u.setAttribute("y",String((o.ay+o.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",pa),u.setAttribute("stroke-width",String(A(r,wp))),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",n.push(u)}),n}function Jn(e,t,r,n){let o=Pe(e,r,t),i=t.getTotalLength();return o.append(kk(e,t,n),...Lk(e,t,n),kp(e,t,0,"from",n),kp(e,t,i,"to",n)),o}var vp="#9b42df",Tk=4,$k=5,Mk=1.5,fa="data-sf-path-halo";function Ak(e,t,r){let n=D(e,"path");n.setAttribute(fa,""),n.setAttribute("d",t.getAttribute("d")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",vp);let o=Number(t.getAttribute("stroke-width"))||2;return n.setAttribute("stroke-width",String(o+A(r,Tk))),n.setAttribute("stroke-linecap","round"),n.setAttribute("opacity","0.5"),n}function Ek(e,t,r,n,o){let i=D(e,"circle");return i.setAttribute("cx",String(t)),i.setAttribute("cy",String(r)),i.setAttribute("r",String(A(o,$k))),i.setAttribute("fill","#ffffff"),i.setAttribute("stroke",vp),i.setAttribute("stroke-width",String(A(o,Mk))),i.setAttribute(Ym,String(n)),i.style.pointerEvents="auto",i.style.cursor="move",i}function eo(e,t,r,n){let o=Pe(e,r,t);o.appendChild(Ak(e,t,n));let i=Qi(t);for(let[a,[s,l]]of(i?.points??[]).entries())o.appendChild(Ek(e,s,l,a,n));return o}var Nk=6,Ok=1,Bk="#992dff",Ik={"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 ha(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 Gk=new Set(["top","bottom"]);function Pp(e,t,r,n=!1){let o=A(r,Nk),i=A(r,Ok);return(n?ha(t).filter(([,,s])=>!Gk.has(s)):ha(t)).map(([s,l,d])=>{let c=D(e,"rect");return c.setAttribute("x",String(s-o/2)),c.setAttribute("y",String(l-o/2)),c.setAttribute("width",String(o)),c.setAttribute("height",String(o)),c.setAttribute("fill","white"),c.setAttribute("stroke",Bk),c.setAttribute("stroke-width",String(i)),c.setAttribute("data-sf-resize-handle",d),c.style.pointerEvents="auto",c.style.cursor=n?"ew-resize":Ik[d],c})}var Dk="#9b42df",_k=3,Fk=1;function to(e,t,r,n,o=!1){let i=Ve(t)??t.getBBox(),a=Pe(e,r,t),s=A(n,Fk),l=D(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",Dk),l.setAttribute("stroke-width",String(A(n,_k))),a.appendChild(l),a.append(...Pp(e,i,n,o)),a}function Lp(e){let t=new Map;return{flash:(n,o=kr)=>{let i=[...new Set(n)];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=it(e,l,at);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"?Zi(a,d,l,o):Ki(a,d,l,o);e.appendChild(u),qi(u,s);let p=s?Xi:Un;t.set(l,setTimeout(()=>{u.remove(),t.delete(l)},p))}},destroy(){for(let n of t.values())clearTimeout(n);t.clear()}}}function Tp(e,t,r){let n=o=>{r&&o.key==="Escape"&&t.dispatch({type:"clear"})};return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}function ga(e){return{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}}function $p(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 Mp(e,t){return t.ctrl||t.meta||t.shift?{type:"toggle",id:e}:{type:"select",id:e}}var zk="[data-sf-resize-handle], [data-sf-link-endpoint], [data-sf-link-segment], [data-sf-quick-duplicate]";function ba(e){return!!e?.closest(zk)}var ro=class{#e;#n;#t;#r;constructor(t,r,n,o){this.#e=t,this.#n=r,this.#t=n,this.#r=o}hover(t){let r=We(t.target);this.#n.emit("ownerHover",r?{diagramId:this.#t,owner:r,modifiers:ga(t)}:{diagramId:this.#t,owner:null})}select(t){let r=t.target,n=We(r);if(!n){this.#o(r);return}this.#i(n,t)}#o(t){ba(t)||this.#r.dispatch({type:"clear"})}#i(t,r){this.#r.remember(t);let n=ga(r);this.#r.dispatch(Mp(t.id,n)),this.#n.emit(t.role==="link"?"linkClick":"canvasObjectClick",{diagramId:this.#t,owner:t,modifiers:n});let o=it(this.#e,t.id,at);o&&!o.hasAttribute("tabindex")&&o.setAttribute("tabindex","-1"),o?.focus({preventScroll:!0})}};var Yk=4,ya=class{#e;#n;#t;#r=null;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=n}bind(){return this.#e.svg.addEventListener("pointerdown",this.#o),this.#e.svg.addEventListener("pointermove",this.#i),this.#e.svg.addEventListener("pointerup",this.#s),()=>this.#l()}#o=t=>{let r=t.target,n=!!We(r)||ba(r);this.#r={x:t.clientX,y:t.clientY,moved:!1,panable:_t(t)||!n}};#i=t=>{this.#a(t)||this.#t&&this.#n.hover(t)};#s=t=>{let r=this.#r?.moved??!1;this.#r=null,!r&&this.#t&&this.#n.select(t)};#a(t){return!this.#r||(!this.#r.moved&&Math.hypot(t.clientX-this.#r.x,t.clientY-this.#r.y)>Yk&&(this.#r.moved=!0),!this.#r.moved)?!1:(this.#r.panable&&_t(t)&&this.#e.panBy(t.movementX,t.movementY),!0)}#l(){this.#e.svg.removeEventListener("pointerdown",this.#o),this.#e.svg.removeEventListener("pointermove",this.#i),this.#e.svg.removeEventListener("pointerup",this.#s)}};function Ap(e){let{display:t,emitter:r,diagramId:n,selection:o,selectable:i}=e,a=new ro(t.svg,r,n,o);return new ya(t,a,i).bind()}function xa(e,t,r){for(let o of e.querySelectorAll("[data-sf-selection-overlay]"))o.remove();let n=e.ownerDocument;for(let o of t){let i=it(e,o,at);if(!i)continue;let a=r.get(o),s=a?.role==="link"?Jn(n,i,o,e):a?.role==="path"?eo(n,i,o,e):a?.role==="isometric"?Qn(n,i,o,e):to(n,i,o,e,a?ji.has(a.role):!1);e.appendChild(s),a?.role==="shape"&&t.size===1&&e.appendChild(Kn(n,i,o,e))}}var no=class{#e;#n;#t;#r=new Map;#o=new Set;constructor(t,r,n){this.#e=t,this.#n=r,this.#t=n}getOwners(){return[...this.#o].map(t=>this.#r.get(t)).filter(t=>!!t)}remember(t){this.#r.set(t.id,t)}dispatch(t){this.#o=$p(this.#o,t),xa(this.#e,this.#o,this.#r),this.#n.emit("selectionChange",{diagramId:this.#t,selection:this.getOwners()})}repaint(){this.#o.size>0&&xa(this.#e,this.#o,this.#r)}selectIds(t){for(let r of t){let n=this.#e.querySelector(`[data-sf-id="${CSS.escape(r)}"]`),o=We(n);o&&this.remember(o)}this.dispatch({type:"set",ids:t})}};function Ep(e,t){let r=n=>{_t(n)&&(n.preventDefault(),e.zoomBy(n.deltaY<0?1.1:.9090909090909091,n.clientX,n.clientY),t.repaint())};return e.svg.addEventListener("wheel",r,{passive:!1}),()=>{e.svg.removeEventListener("wheel",r)}}function Np(e,t,r,n={}){let o=n.selectable??!0,i=new no(e.svg,t,r),a=Ap({display:e,emitter:t,diagramId:r,selection:i,selectable:o}),s=Ep(e,i),l=Tp(e.svg,i,o),d=Lp(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 Sa={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 Uk=`
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
- `,Um={name:"button",fragmentSource:FR,replacesBaseFill:!0};var HR=`
70
+ `,Op={name:"button",fragmentSource:Uk,replacesBaseFill:!0};var jk=`
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
- `,Xm={name:"chromaticGlassPlate",fragmentSource:HR,usesBackdrop:!0,replacesBaseFill:!0};var VR=`
136
+ `,Bp={name:"chromaticGlassPlate",fragmentSource:jk,usesBackdrop:!0,replacesBaseFill:!0};var Xk=`
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
- `,qm={name:"chromaticHalo",fragmentSource:VR};var WR=`
202
+ `,Ip={name:"chromaticHalo",fragmentSource:Xk};var qk=`
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
- `,Km={name:"eclipseOrb",fragmentSource:WR};var zR=`
254
+ `,Gp={name:"eclipseOrb",fragmentSource:qk};var Kk=`
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
- `,Zm={name:"emberMatrix",fragmentSource:zR};var YR=`
326
+ `,Dp={name:"emberMatrix",fragmentSource:Kk};var Zk=`
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
- `,Qm={name:"emberSlits",fragmentSource:YR};var jR=`
391
+ `,_p={name:"emberSlits",fragmentSource:Zk};var Qk=`
392
392
  precision highp float;
393
393
 
394
394
  uniform sampler2D uBackdrop;
@@ -490,7 +490,7 @@ void main() {
490
490
  vec3 finalColor = clamp(color, 0.0, 1.0) * edgeAlpha;
491
491
  gl_FragColor = vec4(finalColor, edgeAlpha);
492
492
  }
493
- `,Jm={name:"glassRefraction",fragmentSource:jR,usesBackdrop:!0};var UR=`
493
+ `,Fp={name:"glassRefraction",fragmentSource:Qk,usesBackdrop:!0};var Jk=`
494
494
  precision highp float;
495
495
 
496
496
  uniform vec2 uResolution;
@@ -566,7 +566,7 @@ void main() {
566
566
 
567
567
  gl_FragColor = vec4(clamp(finalColor * max(uIntensity, 0.0), 0.0, 1.0), alpha);
568
568
  }
569
- `,ep={name:"halftoneHalo",fragmentSource:UR};var XR=`
569
+ `,Hp={name:"halftoneHalo",fragmentSource:Jk};var ew=`
570
570
  precision highp float;
571
571
 
572
572
  uniform vec2 uResolution;
@@ -638,7 +638,7 @@ void main() {
638
638
  float alpha = 1.0 - smoothstep(0.96, 1.0, radius);
639
639
  gl_FragColor = vec4(color, alpha);
640
640
  }
641
- `,tp={name:"halo",fragmentSource:XR};var qR=`
641
+ `,Vp={name:"halo",fragmentSource:ew};var tw=`
642
642
  precision highp float;
643
643
 
644
644
  uniform float uTime;
@@ -693,7 +693,7 @@ void main() {
693
693
  vec3 premultiplied = color * body + glowColor * (1.0 - body) * halo * breath;
694
694
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
695
695
  }
696
- `,rp={name:"lumenPortal",fragmentSource:qR};var KR=`
696
+ `,Wp={name:"lumenPortal",fragmentSource:tw};var rw=`
697
697
  precision highp float;
698
698
 
699
699
  uniform float uTime;
@@ -749,7 +749,7 @@ void main() {
749
749
  premultiplied += mix(uShadowColor, rimColor, 0.58) * (1.0 - body) * outside * breath;
750
750
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
751
751
  }
752
- `,np={name:"lumenPortalLight",fragmentSource:KR};var ZR=`
752
+ `,zp={name:"lumenPortalLight",fragmentSource:rw};var nw=`
753
753
  precision highp float;
754
754
 
755
755
  uniform vec2 uResolution;
@@ -782,7 +782,7 @@ void main() {
782
782
  float alpha = 1.0 - smoothstep(0.94, 1.0, radius);
783
783
  gl_FragColor = vec4(color, alpha);
784
784
  }
785
- `,op={name:"orb",fragmentSource:ZR};var QR=`
785
+ `,Yp={name:"orb",fragmentSource:nw};var ow=`
786
786
  precision highp float;
787
787
 
788
788
  uniform float uTime;
@@ -879,7 +879,7 @@ void main() {
879
879
  float edge = 1.0 - smoothstep(0.965, 0.997, radius);
880
880
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
881
881
  }
882
- `,ip={name:"pixelConstellation",fragmentSource:QR};var JR=`
882
+ `,Up={name:"pixelConstellation",fragmentSource:ow};var iw=`
883
883
  precision highp float;
884
884
 
885
885
  uniform vec2 uResolution;
@@ -978,7 +978,7 @@ void main() {
978
978
  float gain = max(uIntensity, 0.0) * fade;
979
979
  gl_FragColor = vec4(clamp(color * gain, 0.0, 1.0), clamp(alpha * gain, 0.0, 1.0));
980
980
  }
981
- `,ap={name:"plasmaGauge",fragmentSource:JR,replacesBaseFill:!0};var ek=`
981
+ `,jp={name:"plasmaGauge",fragmentSource:iw,replacesBaseFill:!0};var aw=`
982
982
  precision highp float;
983
983
 
984
984
  uniform vec2 uResolution;
@@ -1050,7 +1050,7 @@ void main() {
1050
1050
  float fade = 1.0 - smoothstep(0.88, 1.0, radius);
1051
1051
  gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * fade, 0.0, 1.0), fade);
1052
1052
  }
1053
- `,sp={name:"prismSlats",fragmentSource:ek};var tk=`
1053
+ `,Xp={name:"prismSlats",fragmentSource:aw};var sw=`
1054
1054
  precision highp float;
1055
1055
 
1056
1056
  uniform vec2 uResolution;
@@ -1152,7 +1152,7 @@ void main() {
1152
1152
  vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
1153
1153
  gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
1154
1154
  }
1155
- `,lp={name:"ruler",fragmentSource:tk,replacesBaseFill:!0};var rk=`
1155
+ `,qp={name:"ruler",fragmentSource:sw,replacesBaseFill:!0};var lw=`
1156
1156
  precision highp float;
1157
1157
 
1158
1158
  uniform vec2 uResolution;
@@ -1225,7 +1225,7 @@ void main() {
1225
1225
  vec3 premultiplied = orbColor * body + plumeColor * (1.0 - body) * plume;
1226
1226
  gl_FragColor = vec4(clamp(premultiplied * frameFade * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1227
1227
  }
1228
- `,dp={name:"smearOrb",fragmentSource:rk,replacesBaseFill:!0};var nk=`
1228
+ `,Kp={name:"smearOrb",fragmentSource:lw,replacesBaseFill:!0};var dw=`
1229
1229
  precision highp float;
1230
1230
 
1231
1231
  uniform vec2 uResolution;
@@ -1281,7 +1281,7 @@ void main() {
1281
1281
  float alpha = tick * mix(0.32, 1.0, lit) * max(uIntensity, 0.0);
1282
1282
  gl_FragColor = vec4(color * alpha, clamp(alpha, 0.0, 1.0));
1283
1283
  }
1284
- `,cp={name:"tickScale",fragmentSource:nk,replacesBaseFill:!0};var ok=`
1284
+ `,Zp={name:"tickScale",fragmentSource:dw,replacesBaseFill:!0};var cw=`
1285
1285
  precision highp float;
1286
1286
 
1287
1287
  uniform float uTime;
@@ -1358,7 +1358,7 @@ void main() {
1358
1358
  vec3 premultiplied = color * body + uColor * (1.0 - body) * halo * 0.48;
1359
1359
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1360
1360
  }
1361
- `,up={name:"violetGlass",fragmentSource:ok};var ik=`
1361
+ `,Qp={name:"violetGlass",fragmentSource:cw};var uw=`
1362
1362
  precision highp float;
1363
1363
 
1364
1364
  uniform float uTime;
@@ -1425,7 +1425,7 @@ void main() {
1425
1425
  premultiplied += mix(uShadowColor, uColor, 0.36) * (1.0 - body) * outside;
1426
1426
  gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1427
1427
  }
1428
- `,mp={name:"violetGlassLight",fragmentSource:ik};var ak=[op,tp,ep,qm,Xm,Jm,Qm,dp,ip,ap,cp,lp,Um,sp,Km,Zm,up,mp,rp,np],sk=new Map(ak.map(e=>[e.name,e]));function pp(e){return sk.get(e)}var lk=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function dk(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let n=t.getComputedStyle(r).backgroundColor;if(n&&!lk.test(n.trim()))return n}}function ck(e,t,r,n){let o=e.cloneNode(!0),i=[...e.children].indexOf(t);if(i>=0)for(;o.children.length>i;)o.lastElementChild?.remove();for(let s of o.querySelectorAll("foreignObject[data-sf-shader]"))s.remove();let a=dk(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),o.insertBefore(u,o.firstChild)}return o.setAttribute("width",String(r)),o.setAttribute("height",String(n)),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o}function fp(e,t){let r=Math.max(globalThis.devicePixelRatio||1,2.5),n=Math.min(r,4096/Math.max(1,Math.max(e.clientWidth,e.clientHeight))),o=Math.max(1,Math.round(e.clientWidth*n)),i=Math.max(1,Math.round(e.clientHeight*n));if(!e.ownerDocument.defaultView)return Promise.resolve(void 0);let s=new XMLSerializer().serializeToString(ck(e,t,o,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:o,height:i}),l.onerror=()=>c(void 0),l.src=d})}function ur(e,t){if(typeof e!="string")return t;let r=/^#([0-9a-f]{6})$/i.exec(e);if(!r)return t;let n=Number.parseInt(r[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function hp(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Mt(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform1f(n,r)}function _n(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform3f(n,...r)}function Zi(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform2f(n,...r)}function Fn(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function uk(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 gp(e,t){for(let[r,n]of Object.entries(e.parameters)){let o=Fn(r);if(typeof n=="number"){let a=e.parameters[`${r}Lag`];if(typeof a=="number"&&a>0){let s=e.smoothed.get(r)??n,l=s+(n-s)*(1-Math.exp(-t/a));e.smoothed.set(r,l),Mt(e,o,l);continue}Mt(e,o,n);continue}if(typeof n=="boolean"){let a=e.gl.getUniformLocation(e.program,o);a&&e.gl.uniform1i(a,n?1:0);continue}let i=uk(r,n);if(i!==void 0){Mt(e,o,i);continue}/^#[0-9a-f]{6}$/i.test(n)&&_n(e,o,ur(n,[0,0,0]))}}var mk=`
1428
+ `,Jp={name:"violetGlassLight",fragmentSource:uw};var mw=[Yp,Vp,Hp,Ip,Bp,Fp,_p,Kp,Up,jp,Zp,qp,Op,Xp,Gp,Dp,Qp,Jp,Wp,zp],pw=new Map(mw.map(e=>[e.name,e]));function ef(e){return pw.get(e)}var fw=/^rgba?(s*d+,s*d+,s*d+,s*0s*)$|^transparent$/;function hw(e){let t=e.ownerDocument.defaultView;for(let r=e.parentElement;r&&t;r=r.parentElement){let n=t.getComputedStyle(r).backgroundColor;if(n&&!fw.test(n.trim()))return n}}function gw(e,t,r,n){let o=e.cloneNode(!0),i=[...e.children].indexOf(t);if(i>=0)for(;o.children.length>i;)o.lastElementChild?.remove();for(let s of o.querySelectorAll("foreignObject[data-sf-shader]"))s.remove();let a=hw(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),o.insertBefore(u,o.firstChild)}return o.setAttribute("width",String(r)),o.setAttribute("height",String(n)),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o}function tf(e,t){let r=Math.max(globalThis.devicePixelRatio||1,2.5),n=Math.min(r,4096/Math.max(1,Math.max(e.clientWidth,e.clientHeight))),o=Math.max(1,Math.round(e.clientWidth*n)),i=Math.max(1,Math.round(e.clientHeight*n));if(!e.ownerDocument.defaultView)return Promise.resolve(void 0);let s=new XMLSerializer().serializeToString(gw(e,t,o,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:o,height:i}),l.onerror=()=>c(void 0),l.src=d})}function wr(e,t){if(typeof e!="string")return t;let r=/^#([0-9a-f]{6})$/i.exec(e);if(!r)return t;let n=Number.parseInt(r[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function rf(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Ft(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform1f(n,r)}function oo(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform3f(n,...r)}function Ca(e,t,r){let n=e.gl.getUniformLocation(e.program,t);n&&e.gl.uniform2f(n,...r)}function io(e){return`u${e.charAt(0).toUpperCase()}${e.slice(1)}`}function bw(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 nf(e,t){for(let[r,n]of Object.entries(e.parameters)){let o=io(r);if(typeof n=="number"){let a=e.parameters[`${r}Lag`];if(typeof a=="number"&&a>0){let s=e.smoothed.get(r)??n,l=s+(n-s)*(1-Math.exp(-t/a));e.smoothed.set(r,l),Ft(e,o,l);continue}Ft(e,o,n);continue}if(typeof n=="boolean"){let a=e.gl.getUniformLocation(e.program,o);a&&e.gl.uniform1i(a,n?1:0);continue}let i=bw(r,n);if(i!==void 0){Ft(e,o,i);continue}/^#[0-9a-f]{6}$/i.test(n)&&oo(e,o,wr(n,[0,0,0]))}}var yw=`
1429
1429
  attribute vec2 aPosition;
1430
1430
  varying vec2 vUv;
1431
1431
 
@@ -1433,12 +1433,12 @@ void main() {
1433
1433
  vUv = aPosition * 0.5 + 0.5;
1434
1434
  gl_Position = vec4(aPosition, 0.0, 1.0);
1435
1435
  }
1436
- `;function bp(e,t,r){let n=e.createShader(t);if(n){if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){e.deleteShader(n);return}return n}}function yp(e,t){let r=bp(e,e.VERTEX_SHADER,mk),n=bp(e,e.FRAGMENT_SHADER,t);if(!r||!n){r&&e.deleteShader(r),n&&e.deleteShader(n);return}let o=e.createProgram();if(!o){e.deleteShader(r),e.deleteShader(n);return}if(e.attachShader(o,r),e.attachShader(o,n),e.linkProgram(o),e.deleteShader(r),e.deleteShader(n),!e.getProgramParameter(o,e.LINK_STATUS)){e.deleteProgram(o);return}return o}function xp(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 pk=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function fk(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function hk(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,pk,e.STATIC_DRAW);let n=e.getAttribLocation(t,"aPosition");if(n<0){e.deleteBuffer(r);return}return e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),r}function gk(e,t){let r=e.getAttribute("data-sf-id");return!t.replacesBaseFill||!r?void 0:[...e.closest("svg")?.querySelectorAll('[data-sf-primary="true"]')??[]].find(o=>o!==e&&o.getAttribute("data-sf-id")===r)}function Sp(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),n=r?pp(r):void 0,o=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!n||!o)return;let i=yp(o,n.fragmentSource);if(!i)return;o.useProgram(i);let a=hk(o,i);if(!a){o.deleteProgram(i);return}let s=n.usesBackdrop===!0,l=gk(t,n),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{owner:t,canvas:e,gl:o,program:i,buffer:a,parameters:fk(t),smoothed:new Map,backdropTexture:s?xp(o):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:ur(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function Cp(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 Rp(e){let t=e.canvas.closest("svg");if(!t)return;let r=t.getBoundingClientRect(),n=e.canvas.getBoundingClientRect();r.width<=0||r.height<=0||(e.backdropOrigin=[(n.left-r.left)/r.width,(r.bottom-n.bottom)/r.height],e.backdropScale=[n.width/r.width,n.height/r.height])}function kp(e,t){if(!e.backdropTexture)return;Rp(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 bk=2560;function $t(e,t){let{canvas:r,gl:n,parameters:o}=e,i=r.getBoundingClientRect(),a=Math.min(globalThis.devicePixelRatio||1,3),s=Math.min(1,bk/Math.max(1,i.width*a,i.height*a)),l=Math.max(1,Math.round((i.width||r.clientWidth)*a*s)),d=Math.max(1,Math.round((i.height||r.clientHeight)*a*s));(r.width!==l||r.height!==d)&&(r.width=l,r.height=d),n.viewport(0,0,l,d),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.useProgram(e.program);let c=n.getUniformLocation(e.program,"uResolution");if(c&&n.uniform2f(c,l,d),Mt(e,"uTime",t),e.backdropTexture){Rp(e),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.backdropTexture);let m=n.getUniformLocation(e.program,"uBackdrop");m&&n.uniform1i(m,0),Zi(e,"uBackdropOrigin",e.backdropOrigin),Zi(e,"uBackdropScale",e.backdropScale)}for(let[m,f]of Object.entries(Ki.numbers))Mt(e,Fn(m),hp(o[m],f));for(let[m,f]of Object.entries(Ki.colors))_n(e,Fn(m),ur(o[m],[...f]));_n(e,"uShapeColor",e.shapeColor);let u=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,gp(e,u),n.drawArrays(n.TRIANGLES,0,6)}function wp(e){let t=null,r=0,n=()=>(e?.performance.now()??0)/1e3;return{now:()=>(t??n())-r,paused:()=>t!==null,spent:()=>r,setPaused(o){o&&t===null?t=n():!o&&t!==null&&(r+=n()-t,t=null)}}}var yk=120;function xk(e,t,r){let n=new Map(t.map(o=>[o.canvas,o]));return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].map(o=>{let i=n.get(o);if(i)try{return $t(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function Sk(e,t,r,n){let o=!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)),$t(i,n),o=!0);return o}function Ck(e,t,r){if(!t)return()=>{};let n=new t.MutationObserver(r);n.observe(e,{attributes:!0,attributeFilter:["viewBox"]});let o=t.ResizeObserver?new t.ResizeObserver(r):void 0;return o?.observe(e),()=>{n.disconnect(),o?.disconnect()}}function Qi(e){let t=[],r,n=0,o,i=e.ownerDocument.defaultView,a=wp(i),s=b=>{if(!a.paused())for(let x of t)$t(x,b/1e3-a.spent());r=i?.requestAnimationFrame(s)},l=()=>{r!==void 0&&(i?.cancelAnimationFrame(r),r=void 0);for(let b of t)Cp(b);t=[]},d=b=>{for(let x of t)x.usesBackdrop&&fp(e,x.owner).then(C=>{C&&b===n&&kp(x,C)})},c=()=>{if(!i?.requestAnimationFrame){for(let b of t)$t(b,0);return}if(a.paused())for(let b of t)$t(b,a.now());r=i.requestAnimationFrame(s)},u=()=>{l();let b=++n;t=[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(x=>{let C=Sp(x);return C?[C]:[]}),d(b),t.length>0&&c()},f=Ck(e,i,()=>{o!==void 0&&i?.clearTimeout(o),o=i?.setTimeout(()=>{o=void 0,d(n)},yk)});u();let g=()=>{n+=1,f(),o!==void 0&&i?.clearTimeout(o),l()};return{capture:()=>xk(e,t,a.now()),setParameters:(b,x)=>Sk(t,b,x,a.now()),setPaused:a.setPaused,refresh:u,destroy:g}}function Hn(e,t){let r=e.svg??(e.source!=null?kn(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 vp(e){let t=Tn(e);if(!Mn(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function Pp(e){let t=Tn(e);if(!Mn(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var Ji="http://www.w3.org/1999/xhtml",Vn=(e,t)=>{Object.assign(e.style,t)};function Wn(e,t,r){let n=e.createElementNS(Ji,"span");return n.setAttribute("data-sf-rolling-current","true"),n.textContent=t,Vn(n,{position:"absolute",inset:"0",display:"grid",placeItems:"center",color:r.color,fontWeight:r.fontWeight,lineHeight:"1"}),n}function Rk(e,t,r){let n=e.createElementNS(Ji,"span");if(n.setAttribute("data-sf-rolling-digit","true"),r.variant==="plain")return Vn(n,{position:"relative",display:"inline-block",width:"0.62em",height:"1.1em",overflow:"hidden"}),n.appendChild(Wn(e,t,r)),n;Vn(n,{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)"}),n.appendChild(Wn(e,t,r));let o=e.createElementNS(Ji,"span");return Vn(o,{position:"absolute",zIndex:"2",left:"0",right:"0",top:"50%",height:"1px",background:r.divider,pointerEvents:"none"}),n.appendChild(o),n}function zn(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 kk(e,t,r,n){let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Wn(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=zn(i,[a,s],n),d=o?zn(o,[s,a],n):null,c=()=>{o?.remove(),i.style.opacity="1"};l?l.finished.then(c,c):(d?.cancel(),c())}function wk(e,t,r,n){if(r.motion==="fade"){kk(e,t,r,n);return}let o=e.querySelector("[data-sf-rolling-current]");o?.removeAttribute("data-sf-rolling-current");let i=Wn(e.ownerDocument,t,r);i.style.transform="translateY(100%)",i.style.opacity="0.25",e.insertBefore(i,e.lastElementChild);let a=zn(i,[{transform:"translateY(100%)",opacity:.25},{transform:"translateY(0)",opacity:1}],n),s=o?zn(o,[{transform:"translateY(0)",opacity:1},{transform:"translateY(-100%)",opacity:.25}],n):null,l=()=>{o?.remove(),i.style.transform="translateY(0)",i.style.opacity="1"};a?a.finished.then(l,l):(s?.cancel(),l())}function Lp(e,t,r,n,o){if(t.length!==r.length){e.replaceChildren(...[...r].map(a=>Rk(e.ownerDocument,a,n))),e.setAttribute("aria-label",r);return}let i=[...e.querySelectorAll("[data-sf-rolling-digit]")];[...r].forEach((a,s)=>{t[s]!==a&&wk(i[s],a,n,o)}),e.setAttribute("aria-label",r)}function ea(e,t){return[...e.querySelectorAll('foreignObject[data-sf-widget="rollingNumber"]')].find(r=>r.getAttribute("data-sf-id")===t)}var vk=140;function Pk(e){return e.querySelector("[data-sf-rolling-digits]")??void 0}function Tp(e){let t=e.getAttribute("data-sf-widget-style");if(!t)return U;try{return{...U,...JSON.parse(t)}}catch{return U}}function Lk(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}function Tk(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 Yn(e,t,r){let n=Pk(e);if(!n)return!1;let o=e.getAttribute("data-sf-widget-value")??"",i=Ht(t,Lk(e.getAttribute("data-sf-widget-digits")));return o===i||(Lp(n,o,i,Tp(e),r?Tk(e):0),e.setAttribute("data-sf-widget-value",i)),!0}function ta(e){let t=new Map,r=new Map,n=new Map;return{setValue(o,i){let a=ea(e,o);if(!a)return!1;if(t.set(o,i),Tp(a).motion!=="fade")return Yn(a,i,!0);let s=Date.now(),l=(r.get(o)??0)+vk-s;return l<=0?(r.set(o,s),Yn(a,i,!0)):(n.has(o)||n.set(o,setTimeout(()=>{n.delete(o),r.set(o,Date.now());let d=ea(e,o),c=t.get(o);d&&c!==void 0&&Yn(d,c,!0)},l)),!0)},refresh(){for(let[o,i]of t){let a=ea(e,o);a&&Yn(a,i,!1)}},clearValues(){for(let o of n.values())clearTimeout(o);n.clear(),t.clear()},destroy(){for(let o of n.values())clearTimeout(o);n.clear(),t.clear()}}}var Mp=new WeakMap,$p=new WeakMap,Ap=new WeakMap;function oa(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}function Ep(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function ra(e,t){return Number(e)>0?Number(e):t}function Op(e,t){let r=Ep(e),n=Number(r.min)||0,o=Number.isFinite(Number(r.max))&&r.max!==void 0?Number(r.max):100;return oa(o===n?0:(t-n)/(o-n))}function na(e,t,r){let n=e.getAttribute("transform")??"",o=n===$p.get(e)?Mp.get(e)??"":n;Mp.set(e,o);let i=`translate(${t} ${r}) ${o}`.trim();$p.set(e,i),e.setAttribute("transform",i)}function Mk(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let r=parseInt(t[1],16);return[r>>16&255,r>>8&255,r&255]}function $k(e,t){let r=Ap.get(e)??e.getAttribute("fill")??"";Ap.set(e,r);let n=Mk(r);if(!n)return;let o=n.map(a=>Math.round(a+(255-a)*t)),i=`rgb(${o[0]}, ${o[1]}, ${o[2]})`;e.style.fill=i;for(let a of e.querySelectorAll("tspan"))a.style.fill=i}function Np(e,t){let r=new Map;for(let n of e.querySelectorAll('foreignObject[data-sf-shader="ruler"]')){let o=Ep(n),i=n.getAttribute("data-sf-id")??"",a=Number(n.getAttribute("x")),s=Number(n.getAttribute("y")),l=Number(n.getAttribute("width")),d=Number(n.getAttribute("height")),c=o.axis==="horizontal",u=oa(t(i)??Number(o.progress)),m=ra(o.inset,.05),f=ra(o.line,.7),g=c?l:d,b=c?d:l,x=m+(1-2*m)*u,C=o.dent===void 0?1:Number(o.dent),L=(C<0?1:C)*.16*b,v=typeof o.knob=="string"?o.knob:"";if(v){let te=[...e.querySelectorAll(`[data-sf-id="${CSS.escape(v)}"]`)],he=te.find(ie=>ie.hasAttribute("data-sf-primary"));if(he?.getBBox){na(he,0,0);let ie=he.getBBox(),Ge=(c?ie.height:ie.width)/2;r.set(i,Ge/b);let mr=(o.gap===void 0?.04:Number(o.gap))*b,aa=f*b-L+Ge+mr,sa=c?{x:a+l*x,y:s+aa}:{x:a+aa,y:s+d*(1-x)},Gp=sa.x-(ie.x+ie.width/2),Dp=sa.y-(ie.y+ie.height/2);for(let _p of te)na(_p,Gp,Dp)}}let $=Number(o.min)||0,H=Number.isFinite(Number(o.max))&&o.max!==void 0?Number(o.max):100,G=ra(o.spread,.07)*g,_=m*g,Y=(1-2*m)*g,oe=_+Y*u;for(let te of e.querySelectorAll(`text[data-sf-id="${CSS.escape(i)}"]`)){let he=Number(te.textContent);if(!Number.isFinite(he)||H===$)continue;let ie=_+Y*oa((he-$)/(H-$)),Ge=Math.exp(-(((ie-oe)/G)**2)),mr=L*.4*Ge;na(te,c?0:-mr,c?-mr:0),$k(te,Ge)}}return r}var jn=class{constructor(t,r,n){this.options=t;this.diagramId=n;this.display=Tm(t.container,r),this.shaderSurfaces=Qi(this.display.svg),this.documentWidgets=ta(this.display.svg),this.interaction=t.interactive?jm(this.display,this.emitter,n,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new Pn;display;interaction;shaderSurfaces;documentWidgets;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=Np(this.display.svg,r=>this.rulerProgressOverrides.get(r));for(let[r,n]of t)this.setShaderParameters(r,{knobRadius:n})}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 Ri(this.svg,this.shaderSurfaces.capture())}exportImage(t){return Si(this.svg,this.exportSvg(),t)}setShaderParameters(t,r){let n={...this.shaderParameterOverrides.get(t),...r};return this.shaderParameterOverrides.set(t,n),this.shaderSurfaces.setParameters(t,r)}setWidgetValue(t,r){if(this.documentWidgets.setValue(t,r))return!0;let n=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="ruler"]')].find(a=>a.getAttribute("data-sf-id")===t);if(n){let a=Op(n,Number(r));this.rulerProgressOverrides.set(t,a);let s=this.setShaderParameters(t,{progress:a});return this.placeKnobs(),s}let o=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="tickScale"]')].find(a=>a.getAttribute("data-sf-id")===t);if(!o)return!1;let i=100;try{i=Number(JSON.parse(o.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.documentWidgets.clearValues()}update(t){let r=Hn(t,this.options.renderOptions);Pp(r);let n=this.display.updateContent(r);this.shaderSurfaces.refresh(),this.documentWidgets.refresh(),this.placeKnobs();for(let[i,a]of this.shaderParameterOverrides)this.shaderSurfaces.setParameters(i,a);t.resetView&&this.display.fit();let o=this.interaction?.getSelection().map(i=>i.id)??[];if(o.length>0&&this.interaction?.select(o),this.emitter.emit("sceneDiff",{diagramId:this.diagramId,...n}),t.highlightChanges){let i=typeof t.highlightChanges=="object"?t.highlightChanges.color:void 0;this.interaction?.flashChanged([...n.added,...n.changed],i)}}announceReady(){queueMicrotask(()=>this.emitter.emit("ready",{diagramId:this.diagramId}))}destroy(){this.interaction?.destroy(),this.shaderSurfaces.destroy(),this.documentWidgets.destroy(),this.shaderParameterOverrides.clear(),this.display.destroy(),this.emitter.clear()}};function Bp(e){let t=e.diagramId??"diagram",r=Hn(e,e.renderOptions);vp(r);let n=new jn(e,r,t);return n.announceReady(),n}var Ak=`
1436
+ `;function of(e,t,r){let n=e.createShader(t);if(n){if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){e.deleteShader(n);return}return n}}function af(e,t){let r=of(e,e.VERTEX_SHADER,yw),n=of(e,e.FRAGMENT_SHADER,t);if(!r||!n){r&&e.deleteShader(r),n&&e.deleteShader(n);return}let o=e.createProgram();if(!o){e.deleteShader(r),e.deleteShader(n);return}if(e.attachShader(o,r),e.attachShader(o,n),e.linkProgram(o),e.deleteShader(r),e.deleteShader(n),!e.getProgramParameter(o,e.LINK_STATUS)){e.deleteProgram(o);return}return o}function sf(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 xw=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function Sw(e){try{return JSON.parse(e.getAttribute("data-sf-shader-params")??"{}")}catch{return{}}}function Cw(e,t){let r=e.createBuffer();if(!r)return;e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,xw,e.STATIC_DRAW);let n=e.getAttribLocation(t,"aPosition");if(n<0){e.deleteBuffer(r);return}return e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),r}function Rw(e,t){let r=e.getAttribute("data-sf-id");return!t.replacesBaseFill||!r?void 0:[...e.closest("svg")?.querySelectorAll('[data-sf-primary="true"]')??[]].find(o=>o!==e&&o.getAttribute("data-sf-id")===r)}function lf(e){let t=e.closest("[data-sf-shader]"),r=t?.getAttribute("data-sf-shader"),n=r?ef(r):void 0,o=e.getContext("webgl",{alpha:!0,antialias:!0,premultipliedAlpha:!0});if(!t||!n||!o)return;let i=af(o,n.fragmentSource);if(!i)return;o.useProgram(i);let a=Cw(o,i);if(!a){o.deleteProgram(i);return}let s=n.usesBackdrop===!0,l=Rw(t,n),d=l?.getAttribute("fill");return l?.setAttribute("fill","none"),{owner:t,canvas:e,gl:o,program:i,buffer:a,parameters:Sw(t),smoothed:new Map,backdropTexture:s?sf(o):void 0,backdropOrigin:[0,0],backdropScale:[1,1],usesBackdrop:s,shapeColor:wr(t.getAttribute("data-sf-shader-fill")??void 0,[1,1,1]),baseGeometry:l,baseFill:d}}function df(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 cf(e){let t=e.canvas.closest("svg");if(!t)return;let r=t.getBoundingClientRect(),n=e.canvas.getBoundingClientRect();r.width<=0||r.height<=0||(e.backdropOrigin=[(n.left-r.left)/r.width,(r.bottom-n.bottom)/r.height],e.backdropScale=[n.width/r.width,n.height/r.height])}function uf(e,t){if(!e.backdropTexture)return;cf(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 kw=2560;function Ht(e,t){let{canvas:r,gl:n,parameters:o}=e,i=r.getBoundingClientRect(),a=Math.min(globalThis.devicePixelRatio||1,3),s=Math.min(1,kw/Math.max(1,i.width*a,i.height*a)),l=Math.max(1,Math.round((i.width||r.clientWidth)*a*s)),d=Math.max(1,Math.round((i.height||r.clientHeight)*a*s));(r.width!==l||r.height!==d)&&(r.width=l,r.height=d),n.viewport(0,0,l,d),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.useProgram(e.program);let c=n.getUniformLocation(e.program,"uResolution");if(c&&n.uniform2f(c,l,d),Ft(e,"uTime",t),e.backdropTexture){cf(e),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.backdropTexture);let p=n.getUniformLocation(e.program,"uBackdrop");p&&n.uniform1i(p,0),Ca(e,"uBackdropOrigin",e.backdropOrigin),Ca(e,"uBackdropScale",e.backdropScale)}for(let[p,f]of Object.entries(Sa.numbers))Ft(e,io(p),rf(o[p],f));for(let[p,f]of Object.entries(Sa.colors))oo(e,io(p),wr(o[p],[...f]));oo(e,"uShapeColor",e.shapeColor);let u=e.lastSeconds===void 0?0:Math.max(0,Math.min(t-e.lastSeconds,.1));e.lastSeconds=t,nf(e,u),n.drawArrays(n.TRIANGLES,0,6)}function mf(e){let t=null,r=0,n=()=>(e?.performance.now()??0)/1e3;return{now:()=>(t??n())-r,paused:()=>t!==null,spent:()=>r,setPaused(o){o&&t===null?t=n():!o&&t!==null&&(r+=n()-t,t=null)}}}var ww=120;function vw(e,t,r){let n=new Map(t.map(o=>[o.canvas,o]));return[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].map(o=>{let i=n.get(o);if(i)try{return Ht(i,r),i.canvas.toDataURL("image/png")}catch{return}})}function Pw(e,t,r,n){let o=!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)),Ht(i,n),o=!0);return o}function Lw(e,t,r){if(!t)return()=>{};let n=new t.MutationObserver(r);n.observe(e,{attributes:!0,attributeFilter:["viewBox"]});let o=t.ResizeObserver?new t.ResizeObserver(r):void 0;return o?.observe(e),()=>{n.disconnect(),o?.disconnect()}}function Ra(e){let t=[],r,n=0,o,i=e.ownerDocument.defaultView,a=mf(i),s=b=>{if(!a.paused())for(let x of t)Ht(x,b/1e3-a.spent());r=i?.requestAnimationFrame(s)},l=()=>{r!==void 0&&(i?.cancelAnimationFrame(r),r=void 0);for(let b of t)df(b);t=[]},d=b=>{for(let x of t)x.usesBackdrop&&tf(e,x.owner).then(C=>{C&&b===n&&uf(x,C)})},c=()=>{if(!i?.requestAnimationFrame){for(let b of t)Ht(b,0);return}if(a.paused())for(let b of t)Ht(b,a.now());r=i.requestAnimationFrame(s)},u=()=>{l();let b=++n;t=[...e.querySelectorAll("canvas[data-sf-shader-canvas]")].flatMap(x=>{let C=lf(x);return C?[C]:[]}),d(b),t.length>0&&c()},f=Lw(e,i,()=>{o!==void 0&&i?.clearTimeout(o),o=i?.setTimeout(()=>{o=void 0,d(n)},ww)});u();let g=()=>{n+=1,f(),o!==void 0&&i?.clearTimeout(o),l()};return{capture:()=>vw(e,t,a.now()),setParameters:(b,x)=>Pw(t,b,x,a.now()),setPaused:a.setPaused,refresh:u,destroy:g}}function ao(e,t){let r=e.svg??(e.source!=null?Dn(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 pf(e){let t=jn(e);if(!Xn(t))throw new Error(`createViewer: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}function ff(e){let t=jn(e);if(!Xn(t))throw new Error(`viewer.update: incompatible DOM contract (svg=${t}). Renderer and viewer versions differ.`)}var so=class{constructor(t,r,n){this.options=t;this.diagramId=n;this.display=hp(t.container,r),this.shaderSurfaces=Ra(this.display.svg),this.documentComponents=_i(this.display.svg),this.interaction=t.interactive?Np(this.display,this.emitter,n,{selectable:t.selectable}):null,this.placeKnobs()}options;diagramId;emitter=new Yn;display;interaction;shaderSurfaces;documentComponents;shaderParameterOverrides=new Map;rulerProgressOverrides=new Map;placeKnobs(){let t=ip(this.display.svg,r=>this.rulerProgressOverrides.get(r));for(let[r,n]of t)this.setShaderParameters(r,{knobRadius:n})}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 Ui(this.svg,this.shaderSurfaces.capture())}exportImage(t){return zi(this.svg,this.exportSvg(),t)}setShaderParameters(t,r){let n={...this.shaderParameterOverrides.get(t),...r};return this.shaderParameterOverrides.set(t,n),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 n=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="ruler"]')].find(a=>a.getAttribute("data-sf-id")===t);if(n){let a=np(n,Number(r));this.rulerProgressOverrides.set(t,a);let s=this.setShaderParameters(t,{progress:a});return this.placeKnobs(),s}let o=[...this.svg.querySelectorAll('foreignObject[data-sf-shader="tickScale"]')].find(a=>a.getAttribute("data-sf-id")===t);if(!o)return!1;let i=100;try{i=Number(JSON.parse(o.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=ao(t,this.options.renderOptions);ff(r);let n=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 o=this.interaction?.getSelection().map(i=>i.id)??[];if(o.length>0&&this.interaction?.select(o),this.emitter.emit("sceneDiff",{diagramId:this.diagramId,...n}),t.highlightChanges){let i=typeof t.highlightChanges=="object"?t.highlightChanges.color:void 0;this.interaction?.flashChanged([...n.added,...n.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 hf(e){let t=e.diagramId??"diagram",r=ao(e,e.renderOptions);pf(r);let n=new so(e,r,t);return n.announceReady(),n}var Tw=`
1437
1437
  :host { display: block; position: relative; }
1438
1438
  .sf-container { width: 100%; height: 100%; }
1439
1439
  svg { display: block; max-width: 100%; }
1440
1440
  .sf-error { color: #b91c1c; font: 13px/1.4 system-ui, sans-serif; padding: 8px; white-space: pre-wrap; }
1441
1441
  [data-sf-role="entity"], [data-sf-role="link"] { cursor: pointer; }
1442
1442
  [data-sf-selected] { stroke: #2563eb !important; stroke-width: 4 !important; }
1443
- `;function Ek(e){let t=document.createElement("style");t.textContent=Ak;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function Ok(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function Nk(e,t,r){return Bp({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function Bk(e,t,r){e.innerHTML=kn(t,{padding:r.padding}).svg}function Ip(e,t){let r=Ek(e);if(t.source===null)return{viewer:null,rendered:!1};try{let n=t.interactive?Nk(r,t.source,t):null;return t.interactive||Bk(r,t.source,t),{viewer:n,rendered:!0}}catch(n){return Ok(r,n),{viewer:null,rendered:!1}}}var Ik=typeof HTMLElement>"u"?class{}:HTMLElement,Je=class extends Ik{static get observedAttributes(){return[...la]}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=da(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=Ip(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function ia(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,Je)}ia();return Yp(Gk);})();
1443
+ `;function $w(e){let t=document.createElement("style");t.textContent=Tw;let r=document.createElement("div");return r.className="sf-container",e.append(t,r),r}function Mw(e,t){let r=document.createElement("div");r.className="sf-error",r.textContent=`stickyflow: ${t.message??t}`,e.replaceChildren(r)}function Aw(e,t,r){return hf({container:e,source:t,interactive:!0,diagramId:r.diagramId,renderOptions:{padding:r.padding}})}function Ew(e,t,r){e.innerHTML=Dn(t,{padding:r.padding}).svg}function gf(e,t){let r=$w(e);if(t.source===null)return{viewer:null,rendered:!1};try{let n=t.interactive?Aw(r,t.source,t):null;return t.interactive||Ew(r,t.source,t),{viewer:n,rendered:!0}}catch(n){return Mw(r,n),{viewer:null,rendered:!1}}}var Nw=typeof HTMLElement>"u"?class{}:HTMLElement,st=class extends Nw{static get observedAttributes(){return[...Pa]}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=La(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=gf(this.root,t);this.view=r.viewer,r.rendered&&this.dispatchEvent(new CustomEvent("sf-render",{detail:{interactive:t.interactive}}))}};function ka(e="stickyflow-diagram"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,st)}ka();return vf(Ow);})();
1444
1444
  //# sourceMappingURL=stickyflow-diagram.global.js.map