stickyflow 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/LICENSE +202 -0
  3. package/README.md +167 -2
  4. package/dist/chunk-65IVT4GK.js +8835 -0
  5. package/dist/chunk-65IVT4GK.js.map +1 -0
  6. package/dist/chunk-BYMIYXP5.js +4695 -0
  7. package/dist/chunk-BYMIYXP5.js.map +1 -0
  8. package/dist/chunk-CSXQD3ON.js +3678 -0
  9. package/dist/chunk-CSXQD3ON.js.map +1 -0
  10. package/dist/chunk-CXL254BT.cjs +4825 -0
  11. package/dist/chunk-CXL254BT.cjs.map +1 -0
  12. package/dist/chunk-DDCTNLLD.cjs +8844 -0
  13. package/dist/chunk-DDCTNLLD.cjs.map +1 -0
  14. package/dist/chunk-HFOGKSNU.cjs +842 -0
  15. package/dist/chunk-HFOGKSNU.cjs.map +1 -0
  16. package/dist/chunk-UXDWH2JC.cjs +3684 -0
  17. package/dist/chunk-UXDWH2JC.cjs.map +1 -0
  18. package/dist/chunk-XEN5QIIJ.js +801 -0
  19. package/dist/chunk-XEN5QIIJ.js.map +1 -0
  20. package/dist/index.cjs +1167 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.d.cts +335 -0
  23. package/dist/index.d.ts +335 -0
  24. package/dist/index.js +1097 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/interaction/index.cjs +7587 -0
  27. package/dist/interaction/index.cjs.map +1 -0
  28. package/dist/interaction/index.d.cts +274 -0
  29. package/dist/interaction/index.d.ts +274 -0
  30. package/dist/interaction/index.js +7562 -0
  31. package/dist/interaction/index.js.map +1 -0
  32. package/dist/render-C5X74hds.d.cts +1041 -0
  33. package/dist/render-C5X74hds.d.ts +1041 -0
  34. package/dist/runtimeTypes-D8hPZ62T.d.ts +239 -0
  35. package/dist/runtimeTypes-yTSAvtCn.d.cts +239 -0
  36. package/dist/stickyflow-diagram.global.js +1444 -0
  37. package/dist/stickyflow-diagram.global.js.map +1 -0
  38. package/dist/types-BDKDf4zr.d.cts +116 -0
  39. package/dist/types-CdgGdtoD.d.ts +116 -0
  40. package/dist/viewer/index.cjs +31 -0
  41. package/dist/viewer/index.cjs.map +1 -0
  42. package/dist/viewer/index.d.cts +44 -0
  43. package/dist/viewer/index.d.ts +44 -0
  44. package/dist/viewer/index.js +6 -0
  45. package/dist/viewer/index.js.map +1 -0
  46. package/dist/web-component/index.cjs +144 -0
  47. package/dist/web-component/index.cjs.map +1 -0
  48. package/dist/web-component/index.d.cts +31 -0
  49. package/dist/web-component/index.d.ts +31 -0
  50. package/dist/web-component/index.js +141 -0
  51. package/dist/web-component/index.js.map +1 -0
  52. package/package.json +81 -4
@@ -0,0 +1,1444 @@
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===`
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(`
14
+ `);return{svg:`${t.includeXmlDeclaration===!1?"":`<?xml version="1.0" encoding="UTF-8"?>
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
+ <defs>${a.entries.join("")}</defs>
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=`
19
+ precision highp float;
20
+
21
+ uniform vec2 uResolution;
22
+ uniform float uLight;
23
+ uniform float uGloss;
24
+ uniform float uDepth;
25
+ uniform float uRim;
26
+ uniform float uPressed;
27
+ uniform vec3 uColor;
28
+ varying vec2 vUv;
29
+
30
+ void main() {
31
+ vec2 p = vUv * 2.0 - 1.0;
32
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
33
+ float pixel = 2.0 / max(uResolution.y, 1.0);
34
+ float pressed = clamp(uPressed, 0.0, 1.0);
35
+
36
+ float radius = 0.9 * (1.0 - 0.025 * pressed);
37
+ float r = length(p);
38
+ vec2 direction = r > 0.0001 ? p / r : vec2(0.0, 1.0);
39
+ float angle = radians(uLight);
40
+ vec2 toLight = vec2(cos(angle), sin(angle));
41
+ vec3 light = normalize(vec3(toLight, 0.85));
42
+
43
+ vec3 base = dot(uColor, uColor) > 0.0 ? uColor : vec3(0.15, 0.15, 0.17);
44
+ float depth = max(uDepth, 0.0) * (1.0 - 0.65 * pressed);
45
+ float inside = clamp(r / radius, 0.0, 1.0);
46
+
47
+ vec3 normal = normalize(vec3(direction * pow(inside, 1.6) * depth * 1.4, 1.0));
48
+ float diffuse = clamp(dot(normal, light), 0.0, 1.0);
49
+ vec3 color = base * (0.5 + 0.7 * diffuse) * (1.0 - 0.18 * pressed);
50
+
51
+ vec3 reflected = reflect(-light, normal);
52
+ float specular = pow(max(reflected.z, 0.0), 26.0) * max(uGloss, 0.0) * (1.0 - 0.8 * pressed);
53
+ color += vec3(specular) * 0.9;
54
+
55
+ float lit = max(dot(direction, toLight), 0.0);
56
+ float away = max(dot(direction, -toLight), 0.0);
57
+ float edge = smoothstep(0.55, 1.0, inside);
58
+ color *= 1.0 - 0.45 * edge * away * min(depth, 1.5) - 0.12 * edge;
59
+ color += mix(base, vec3(1.0), 0.6) * max(uRim, 0.0) * smoothstep(0.9, 1.0, inside) * lit * (1.0 - 0.7 * pressed);
60
+
61
+ float disc = 1.0 - smoothstep(radius - pixel, radius + pixel, r);
62
+
63
+ vec2 shadowAt = -toLight * 0.06 * (1.0 - 0.7 * pressed);
64
+ float shadowDistance = length(p - shadowAt);
65
+ float shadow = (1.0 - smoothstep(radius * 0.55, 0.99, shadowDistance)) * 0.55 * (1.0 - 0.4 * pressed);
66
+
67
+ float alpha = clamp(disc + shadow * (1.0 - disc), 0.0, 1.0);
68
+ gl_FragColor = vec4(clamp(color * disc, 0.0, 1.0), alpha);
69
+ }
70
+ `,Um={name:"button",fragmentSource:FR,replacesBaseFill:!0};var HR=`
71
+ precision highp float;
72
+
73
+ uniform sampler2D uBackdrop;
74
+ uniform vec2 uBackdropOrigin;
75
+ uniform vec2 uBackdropScale;
76
+ uniform vec2 uResolution;
77
+ uniform float uTime;
78
+ uniform float uSpeed;
79
+ uniform float uIntensity;
80
+ uniform float uThickness;
81
+ uniform float uRefraction;
82
+ uniform vec3 uPinkColor;
83
+ uniform vec3 uVioletColor;
84
+ uniform vec3 uBlueColor;
85
+ uniform vec3 uEdgeColor;
86
+ varying vec2 vUv;
87
+
88
+ float bell(float value, float width) {
89
+ return exp(-pow(value / max(width, 0.001), 2.0));
90
+ }
91
+
92
+ void main() {
93
+ vec2 p = vUv * 2.0 - 1.0;
94
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
95
+ float time = uTime * max(uSpeed, 0.0);
96
+ float depth = mix(0.025, 0.105, clamp(uThickness, 0.0, 1.0));
97
+ float radius = 0.79;
98
+ float distance = length(p) - radius;
99
+ float pixel = 2.0 / max(min(uResolution.x, uResolution.y), 1.0);
100
+ float alpha = 1.0 - smoothstep(-pixel, pixel, distance);
101
+ if (alpha < 0.001) discard;
102
+
103
+ float edge = smoothstep(0.66, 0.995, length(p) / radius);
104
+ vec2 normal = p / max(length(p), 0.001);
105
+ vec2 opticalWarp = normal * edge * max(uRefraction, 0.0) * 0.12;
106
+ opticalWarp += vec2(sin(p.y * 8.0 + time * 0.35), cos(p.x * 7.0 - time * 0.27)) * 0.002;
107
+ vec2 backdropUv = clamp(uBackdropOrigin + (vUv + opticalWarp) * uBackdropScale, 0.001, 0.999);
108
+ vec3 backdrop = texture2D(uBackdrop, backdropUv).rgb;
109
+
110
+ float wave = sin(p.x * 3.1 - time * 0.38) * 0.025;
111
+ float pinkBand = bell(p.y - 0.42 + wave, 0.20);
112
+ float pinkShelf = smoothstep(0.16, 0.30, p.y + wave);
113
+ float whiteCap = smoothstep(0.59, 0.75, p.y + wave) * 0.95;
114
+ vec3 face = backdrop * 0.19 + vec3(0.004, 0.002, 0.011);
115
+ face += uVioletColor * bell(p.y + 0.56, 0.18) * 0.10;
116
+ face += uBlueColor * bell(p.x - 0.49, 0.18) * bell(p.y + 0.22, 0.39) * 0.09;
117
+ face += uPinkColor * pinkBand * pinkShelf * 1.05;
118
+ face += uEdgeColor * whiteCap * 0.88;
119
+
120
+ float left = 1.0 - smoothstep(-0.68, -0.34, p.x);
121
+ float right = smoothstep(0.36, 0.68, p.x);
122
+ float upper = smoothstep(0.0, 0.58, p.y);
123
+ float lower = 1.0 - smoothstep(-0.52, -0.04, p.y);
124
+ float rim = bell(distance + 0.004, 0.007);
125
+ float bevel = bell(distance + depth * 0.55, depth * 0.48);
126
+ float innerArc = bell(distance + depth * 1.13, depth * 0.23) * right * lower;
127
+ face += uEdgeColor * rim * (0.61 + 0.35 * upper);
128
+ face += uPinkColor * bevel * (0.18 + 0.58 * left * upper);
129
+ face += uBlueColor * bevel * right * lower * 0.49;
130
+ face += uVioletColor * innerArc * 0.27;
131
+ face += uEdgeColor * bell(distance + depth * 1.3, depth * 0.31) * left * upper * 0.22;
132
+ float movingGlint = bell(p.x + 0.42 - sin(time * 0.47) * 0.075, 0.055);
133
+ face += uEdgeColor * movingGlint * bell(p.y - 0.26, 0.48) * left * 0.15;
134
+ gl_FragColor = vec4(clamp(face * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
135
+ }
136
+ `,Xm={name:"chromaticGlassPlate",fragmentSource:HR,usesBackdrop:!0,replacesBaseFill:!0};var VR=`
137
+ precision highp float;
138
+
139
+ uniform vec2 uResolution;
140
+ uniform float uTime;
141
+ uniform float uSpeed;
142
+ uniform float uIntensity;
143
+ uniform float uRingRadius;
144
+ uniform float uRingWidth;
145
+ uniform float uBloom;
146
+ uniform float uMotion;
147
+ uniform bool uLightMode;
148
+ uniform vec3 uWarmColor;
149
+ uniform vec3 uCoolColor;
150
+ uniform vec3 uAccentColor;
151
+ uniform vec3 uHighlightColor;
152
+ varying vec2 vUv;
153
+
154
+ float bell(float value, float width) {
155
+ return exp(-pow(value / max(width, 0.001), 2.0));
156
+ }
157
+
158
+ float displacedRing(vec2 point, float radius, float width, float phase, float time, float motion) {
159
+ float angle = atan(point.y, point.x);
160
+ float wave = sin(angle * 2.0 + phase + time * 0.4) * 0.052;
161
+ wave += sin(angle * 3.0 - phase * 0.45 + time * 0.27) * 0.025;
162
+ wave += sin(angle * 6.0 - phase * 0.7 - time * 0.23) * 0.011;
163
+ return bell(length(point) - radius - wave * motion, width);
164
+ }
165
+
166
+ void main() {
167
+ vec2 p = vUv * 2.0 - 1.0;
168
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
169
+ float time = uTime * max(uSpeed, 0.0);
170
+ float radius = clamp(uRingRadius, 0.25, 0.88);
171
+ float width = max(uRingWidth, 0.025);
172
+ float motion = max(uMotion, 0.0);
173
+
174
+ vec2 coolOffset = vec2(-0.052, -0.012) * (0.7 + motion * 0.3);
175
+ vec2 warmOffset = vec2(0.042, 0.024) * (0.7 + motion * 0.3);
176
+ vec2 accentOffset = vec2(0.016, -0.044) * (0.7 + motion * 0.3);
177
+ float coolRing = displacedRing(p + coolOffset, radius, width * 1.18, 0.4, time, motion);
178
+ float warmRing = displacedRing(p + warmOffset, radius, width * 1.05, 2.6, time, motion);
179
+ float accentRing = displacedRing(p + accentOffset, radius, width, 4.8, time, motion);
180
+ float coreRing = displacedRing(p, radius, width * 0.48, 1.7, time, motion);
181
+
182
+ vec3 color = uCoolColor * coolRing * 0.72;
183
+ color += uWarmColor * warmRing * 0.68;
184
+ color += uAccentColor * accentRing * 0.64;
185
+ if (!uLightMode) {
186
+ color += uHighlightColor * coreRing * 1.35;
187
+ }
188
+ float broadBloom = displacedRing(p, radius, width * 2.35, 0.0, time, motion);
189
+ color += mix(uCoolColor, uWarmColor, smoothstep(-0.8, 0.8, p.y)) * broadBloom * max(uBloom, 0.0) * 0.2;
190
+
191
+ float ringAlpha = max(max(coolRing, warmRing), max(accentRing, coreRing));
192
+ float alpha = clamp(ringAlpha * 0.9 + broadBloom * max(uBloom, 0.0) * 0.18, 0.0, 1.0);
193
+ if (uLightMode) {
194
+ color = mix(color, uHighlightColor, smoothstep(0.16, 0.82, coreRing));
195
+ }
196
+ float circleMask = 1.0 - smoothstep(0.965, 1.0, length(p));
197
+ alpha *= circleMask * max(uIntensity, 0.0);
198
+ color *= circleMask * max(uIntensity, 0.0);
199
+
200
+ gl_FragColor = vec4(clamp(color, 0.0, 1.0), clamp(alpha, 0.0, 1.0));
201
+ }
202
+ `,qm={name:"chromaticHalo",fragmentSource:VR};var WR=`
203
+ precision highp float;
204
+
205
+ uniform float uTime;
206
+ uniform float uSpeed;
207
+ uniform float uIntensity;
208
+ uniform float uGlow;
209
+ uniform float uDay;
210
+ uniform vec3 uTopColor;
211
+ uniform vec3 uMiddleColor;
212
+ uniform vec3 uBottomColor;
213
+ uniform vec3 uRimColor;
214
+ varying vec2 vUv;
215
+
216
+ void main() {
217
+ vec2 p = vUv * 2.0 - 1.0;
218
+ float radius = length(p);
219
+ float time = uTime * max(uSpeed, 0.0);
220
+ float glow = max(uGlow, 0.0);
221
+ float intensity = max(uIntensity, 0.0);
222
+
223
+ float current = sin(p.x * 4.2 - time * 0.75) * 0.025;
224
+ current += sin(p.y * 5.0 + p.x * 2.3 + time * 0.55) * 0.018;
225
+ float vertical = p.y + current;
226
+ float useDay = step(0.0, uDay);
227
+ float day = clamp(uDay, 0.0, 1.0);
228
+ float capStart = mix(-0.04, -0.62 + day * 0.98, useDay);
229
+ float tone = mix(1.0, mix(0.2, 1.2, day), useDay);
230
+ vec3 bodyColor = mix(uBottomColor, uMiddleColor, smoothstep(-0.69, -0.06, vertical)) * tone;
231
+ bodyColor = mix(bodyColor, uTopColor, smoothstep(capStart, capStart + 0.42, vertical));
232
+
233
+ float side = smoothstep(0.35, 0.9, abs(p.x) / max(radius, 0.001));
234
+ float lower = 1.0 - smoothstep(-0.35, 0.38, p.y);
235
+ float ring = exp(-pow((radius - 0.765) / 0.03, 2.0));
236
+ float rimLight = ring * (0.28 + side * 0.55 + lower * 0.52) * mix(1.0, 0.35 + 0.65 * day, useDay);
237
+ float crest = ring * smoothstep(0.3, 0.68, p.y) * mix(1.0, 0.15 + 0.85 * day, useDay);
238
+ bodyColor = mix(bodyColor, uRimColor, clamp(rimLight * 0.78 * intensity, 0.0, 1.0));
239
+ bodyColor = mix(bodyColor, vec3(1.0, 0.94, 0.86), clamp(crest * 0.84 * intensity, 0.0, 1.0));
240
+
241
+ float bodyAlpha = 1.0 - smoothstep(0.758, 0.778, radius);
242
+ float halo = exp(-pow(max(radius - 0.765, 0.0) / 0.12, 2.0));
243
+ halo *= (0.14 + rimLight * 0.28 + crest * 0.2) * glow * intensity;
244
+ float crownGlow = exp(-pow(p.x / 0.48, 2.0) - pow((p.y - 0.83) / 0.16, 2.0));
245
+ halo += crownGlow * 0.16 * glow * intensity;
246
+ float outsideAlpha = clamp(halo, 0.0, 0.85) * (1.0 - smoothstep(0.84, 1.0, radius));
247
+ vec3 haloColor = mix(uRimColor, vec3(1.0, 0.91, 0.77), crest * 0.55 + crownGlow * 0.45);
248
+ float alpha = bodyAlpha + (1.0 - bodyAlpha) * outsideAlpha;
249
+ vec3 premultipliedColor = bodyColor * bodyAlpha;
250
+ premultipliedColor += haloColor * (1.0 - bodyAlpha) * outsideAlpha;
251
+
252
+ gl_FragColor = vec4(premultipliedColor, alpha);
253
+ }
254
+ `,Km={name:"eclipseOrb",fragmentSource:WR};var zR=`
255
+ precision highp float;
256
+
257
+ uniform vec2 uResolution;
258
+ uniform float uTime;
259
+ uniform float uSpeed;
260
+ uniform float uIntensity;
261
+ uniform float uCellCount;
262
+ uniform float uGrain;
263
+ uniform vec3 uBaseColor;
264
+ uniform vec3 uTopColor;
265
+ uniform vec3 uCoreColor;
266
+ uniform vec3 uBottomColor;
267
+ uniform vec3 uCoolColor;
268
+ varying vec2 vUv;
269
+
270
+ float band(float distance, float width) {
271
+ return exp(-pow(distance / width, 2.0));
272
+ }
273
+
274
+ float pixelNoise(vec2 uv) {
275
+ vec2 pixel = floor(uv * uResolution);
276
+ return fract(sin(dot(pixel, vec2(127.1, 311.7))) * 43758.5453);
277
+ }
278
+
279
+ void main() {
280
+ vec2 p = vUv * 2.0 - 1.0;
281
+ float radius = length(p);
282
+ if (radius >= 1.0) discard;
283
+
284
+ float time = uTime * max(uSpeed, 0.0);
285
+ float cells = max(uCellCount, 1.0);
286
+ vec2 grid = (p + 1.0) * cells * 0.5;
287
+ vec2 cell = fract(grid) - 0.5;
288
+ vec2 samplePoint = (floor(grid) + 0.5) * 2.0 / cells - 1.0;
289
+ vec2 q = samplePoint;
290
+ q.x += sin(samplePoint.y * 3.4 + time * 0.34) * 0.035;
291
+ q.y += sin(samplePoint.x * 4.0 - time * 0.29) * 0.045;
292
+
293
+ float upperCurve = 0.56 + 0.11 * sin(q.x * 3.1 + time * 0.41);
294
+ float topLight = band(q.y - upperCurve, 0.25) * (0.48 + 0.52 * abs(q.x));
295
+ topLight += band(q.x + 0.77, 0.28) * band(q.y - 0.46, 0.35) * 0.58;
296
+ topLight += band(q.x - 0.76, 0.28) * band(q.y - 0.43, 0.36) * 0.68;
297
+ topLight *= 1.0 - band(q.x + 0.02, 0.45) * band(q.y - 0.78, 0.28) * 0.88;
298
+
299
+ float coreLight = band(q.x + 0.02 + 0.08 * sin(time * 0.28), 0.58);
300
+ coreLight *= band(q.y + 0.19 + 0.07 * sin(q.x * 3.0 - time * 0.31), 0.44);
301
+ float bottomLight = band(q.y + 0.82, 0.38) * band(q.x - 0.02, 0.85);
302
+ float coolLight = band(q.x + 0.79, 0.31) * band(q.y + 0.03, 0.29);
303
+ coolLight += band(q.x - 0.89, 0.23) * band(q.y + 0.02, 0.25) * 0.48;
304
+
305
+ float centerCut = band(q.y - 0.12 + 0.08 * sin(q.x * 3.2 + time * 0.33), 0.16);
306
+ centerCut *= band(q.x + 0.03, 0.99);
307
+ float rightCut = band(q.x - 0.68, 0.35) * band(q.y + 0.37, 0.26);
308
+ float occlusion = clamp(centerCut * 0.78 + rightCut * 0.79, 0.0, 0.9);
309
+
310
+ vec3 color = uBaseColor;
311
+ color += uTopColor * topLight * 0.91;
312
+ color += uCoreColor * coreLight * 1.05;
313
+ color += uBottomColor * bottomLight * 0.86;
314
+ color += uCoolColor * coolLight * 0.68;
315
+ color *= 1.0 - occlusion;
316
+
317
+ float squareRadius = max(abs(cell.x), abs(cell.y));
318
+ float dot = 1.0 - smoothstep(0.23, 0.43, squareRadius);
319
+ color *= 0.21 + dot * 0.79;
320
+ float noise = (pixelNoise(vUv) - 0.5) * max(uGrain, 0.0);
321
+ color += vec3(noise) * (0.25 + dot * 0.75);
322
+
323
+ float edge = 1.0 - smoothstep(0.955, 0.995, radius);
324
+ gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
325
+ }
326
+ `,Zm={name:"emberMatrix",fragmentSource:zR};var YR=`
327
+ precision highp float;
328
+
329
+ uniform vec2 uResolution;
330
+ uniform float uTime;
331
+ uniform float uSpeed;
332
+ uniform float uIntensity;
333
+ uniform float uSlitCount;
334
+ uniform float uOrientation;
335
+ uniform bool uHole;
336
+ uniform float uHoleSize;
337
+ uniform float uGlow;
338
+ uniform float uMotion;
339
+ uniform vec3 uHotColor;
340
+ uniform vec3 uCoreColor;
341
+ uniform vec3 uHighlightColor;
342
+ varying vec2 vUv;
343
+
344
+ float bell(float value, float width) {
345
+ return exp(-pow(value / max(width, 0.001), 2.0));
346
+ }
347
+
348
+ void main() {
349
+ vec2 p = vUv * 2.0 - 1.0;
350
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
351
+ float time = uTime * max(uSpeed, 0.0);
352
+ float motion = max(uMotion, 0.0);
353
+ float radius = length(p);
354
+
355
+ float wave = sin(p.y * 6.4 - time * 0.9) * 0.04 * motion;
356
+ wave += sin(p.x * 5.1 + time * 0.6) * 0.026 * motion;
357
+ float ringRadius = length(p + vec2(wave, 0.0));
358
+ float holeSize = clamp(uHoleSize, 0.0, 0.72);
359
+ float ring = uHole ? smoothstep(holeSize - 0.08, holeSize + 0.08, ringRadius) : 1.0;
360
+ ring *= 1.0 - smoothstep(0.65, 0.83, ringRadius);
361
+ float ringCore = bell(ringRadius - 0.56, 0.19);
362
+
363
+ float count = clamp(uSlitCount, 12.0, 90.0);
364
+ vec2 slitPoint = uOrientation < 0.5 ? p : vec2(p.y, p.x);
365
+ float phase = slitPoint.x * count * 3.14159265;
366
+ phase += sin(slitPoint.y * 3.6 - time * 0.95) * 0.75 * motion;
367
+ phase += time * 2.2 * motion;
368
+ float bars = pow(0.5 + 0.5 * cos(phase), 1.9);
369
+ float slit = 0.12 + 0.88 * bars;
370
+ float sideFade = 1.0 - smoothstep(0.67, 0.91, abs(p.x));
371
+
372
+ float upperLight = bell(p.y - 0.45 - sin(time * 0.6) * 0.1 * motion, 0.21);
373
+ float lowerLight = bell(p.y + 0.48 + sin(time * 0.5 + 1.7) * 0.1 * motion, 0.24);
374
+ vec3 heat = mix(uHotColor, uCoreColor, smoothstep(-0.57, 0.55, p.y));
375
+ heat = mix(heat, uHighlightColor, upperLight * 0.45 + lowerLight * 0.28);
376
+ float molten = ring * slit * sideFade;
377
+ vec3 color = heat * molten * (0.64 + ringCore * 0.68);
378
+
379
+ float verticalTrail = bell(max(ringRadius - 0.69, 0.0), 0.24);
380
+ verticalTrail *= smoothstep(0.25, 0.75, abs(p.y));
381
+ verticalTrail *= slit * sideFade;
382
+ float bloom = bell(ringRadius - 0.57, 0.29) * ring;
383
+ float glow = max(uGlow, 0.0);
384
+ float glowMask = (verticalTrail * 0.25 + bloom * 0.17) * glow;
385
+ color += heat * glowMask;
386
+
387
+ float frameFade = 1.0 - smoothstep(0.89, 1.0, max(abs(p.x), abs(p.y)));
388
+ float alpha = clamp((molten * 0.92 + glowMask) * frameFade * max(uIntensity, 0.0), 0.0, 1.0);
389
+ gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0), 0.0, 1.0) * alpha, alpha);
390
+ }
391
+ `,Qm={name:"emberSlits",fragmentSource:YR};var jR=`
392
+ precision highp float;
393
+
394
+ uniform sampler2D uBackdrop;
395
+ uniform vec2 uBackdropOrigin;
396
+ uniform vec2 uBackdropScale;
397
+ uniform vec2 uResolution;
398
+ uniform float uTime;
399
+ uniform float uSpeed;
400
+ uniform float uIntensity;
401
+ uniform float uIor;
402
+ uniform float uRefraction;
403
+ uniform float uRoughness;
404
+ uniform float uChromaticAberration;
405
+ uniform float uEdgeLight;
406
+ uniform vec3 uTint;
407
+ uniform vec3 uEdgeColor;
408
+ varying vec2 vUv;
409
+
410
+ float hash(vec2 point) {
411
+ return fract(sin(dot(point, vec2(127.1, 311.7))) * 43758.5453123);
412
+ }
413
+
414
+ float smoothNoise(vec2 point) {
415
+ vec2 cell = floor(point);
416
+ vec2 local = fract(point);
417
+ local = local * local * (3.0 - 2.0 * local);
418
+ float a = hash(cell);
419
+ float b = hash(cell + vec2(1.0, 0.0));
420
+ float c = hash(cell + vec2(0.0, 1.0));
421
+ float d = hash(cell + vec2(1.0, 1.0));
422
+ return mix(mix(a, b, local.x), mix(c, d, local.x), local.y);
423
+ }
424
+
425
+ void main() {
426
+ float time = uTime * max(uSpeed, 0.0);
427
+ vec2 sphereOffset = vec2(
428
+ sin(time * 0.72) * 0.04,
429
+ cos(time * 0.56) * 0.026
430
+ );
431
+ float sphereScale = 0.95;
432
+ vec2 p = (vUv * 2.0 - 1.0 - sphereOffset) / sphereScale;
433
+ float radius = length(p);
434
+ if (radius >= 1.0) discard;
435
+
436
+ float roughness = max(uRoughness, 0.0);
437
+ vec2 flow = vec2(
438
+ smoothNoise(p * 2.4 + vec2(0.7, -0.3)),
439
+ smoothNoise(p * 2.8 + vec2(-0.4, 0.8))
440
+ ) - 0.5;
441
+ float sphereDepth = sqrt(max(1.0 - radius * radius, 0.0));
442
+ vec2 glassMotion = vec2(
443
+ sin(p.y * 3.2 + 0.6),
444
+ cos(p.x * 2.8 - 0.35)
445
+ ) * 0.014;
446
+ vec3 surfaceNormal = normalize(vec3(p + glassMotion + flow * roughness * 0.22, sphereDepth));
447
+ float eta = 1.0 / max(uIor, 1.001);
448
+ vec3 refracted = refract(vec3(0.0, 0.0, -1.0), surfaceNormal, eta);
449
+ vec2 distortion = refracted.xy * max(uRefraction, 0.0);
450
+ distortion += flow * (0.008 + roughness * 0.025);
451
+
452
+ vec2 backdropUv = uBackdropOrigin + vUv * uBackdropScale;
453
+ vec2 refractedUv = clamp(backdropUv + distortion * uBackdropScale, 0.001, 0.999);
454
+ float chroma = max(uChromaticAberration, 0.0) * 0.012;
455
+ vec2 chromaOffset = normalize(distortion + vec2(0.0001)) * chroma * uBackdropScale;
456
+ float red = texture2D(uBackdrop, clamp(refractedUv + chromaOffset, 0.001, 0.999)).r;
457
+ float green = texture2D(uBackdrop, refractedUv).g;
458
+ float blue = texture2D(uBackdrop, clamp(refractedUv - chromaOffset, 0.001, 0.999)).b;
459
+ vec3 sharpBackdrop = vec3(red, green, blue);
460
+ vec2 texel = uBackdropScale / max(uResolution, vec2(1.0));
461
+ vec2 blurOffset = texel * (0.65 + roughness * 5.0);
462
+ vec3 blurredBackdrop = texture2D(uBackdrop, refractedUv + vec2(blurOffset.x, 0.0)).rgb;
463
+ blurredBackdrop += texture2D(uBackdrop, refractedUv - vec2(blurOffset.x, 0.0)).rgb;
464
+ blurredBackdrop += texture2D(uBackdrop, refractedUv + vec2(0.0, blurOffset.y)).rgb;
465
+ blurredBackdrop += texture2D(uBackdrop, refractedUv - vec2(0.0, blurOffset.y)).rgb;
466
+ blurredBackdrop *= 0.25;
467
+ vec3 backdrop = mix(sharpBackdrop, blurredBackdrop, clamp(roughness * 1.15, 0.0, 1.0));
468
+
469
+ float fresnel = pow(1.0 - sphereDepth, 2.35);
470
+ float innerRim = smoothstep(0.72, 0.995, radius);
471
+ vec2 fixedLightPosition = vec2(-0.46, 0.7);
472
+ vec2 surfacePosition = sphereOffset + p * sphereScale * 0.22;
473
+ vec3 lightDirection = normalize(vec3(fixedLightPosition - surfacePosition, 0.62));
474
+ float highlight = pow(max(dot(lightDirection, surfaceNormal), 0.0), 28.0);
475
+ float hotSpot = pow(max(dot(lightDirection, surfaceNormal), 0.0), 92.0);
476
+ float angle = atan(p.y, p.x);
477
+ float lightAngle = atan(lightDirection.y, lightDirection.x);
478
+ float movingRim = 0.68 + 0.32 * sin(angle * 2.0 - lightAngle);
479
+ float rimGlint = pow(max(cos(angle - lightAngle), 0.0), 20.0) * innerRim;
480
+ vec3 color = mix(backdrop, backdrop * uTint, 0.025 + fresnel * 0.09);
481
+ color += uEdgeColor * innerRim * max(uEdgeLight, 0.0) * (0.1 + fresnel * 0.5) * movingRim;
482
+ color += uEdgeColor * rimGlint * max(uEdgeLight, 0.0) * 0.72;
483
+ color += uEdgeColor * highlight * 0.5;
484
+ color += vec3(1.0) * hotSpot * 0.58;
485
+ color += vec3(1.0) * fresnel * 0.05;
486
+ color *= max(uIntensity, 0.0);
487
+
488
+ float edgeWidth = 2.2 / max(min(uResolution.x, uResolution.y), 1.0);
489
+ float edgeAlpha = 1.0 - smoothstep(1.0 - edgeWidth, 1.0, radius);
490
+ vec3 finalColor = clamp(color, 0.0, 1.0) * edgeAlpha;
491
+ gl_FragColor = vec4(finalColor, edgeAlpha);
492
+ }
493
+ `,Jm={name:"glassRefraction",fragmentSource:jR,usesBackdrop:!0};var UR=`
494
+ precision highp float;
495
+
496
+ uniform vec2 uResolution;
497
+ uniform float uTime;
498
+ uniform float uSpeed;
499
+ uniform float uIntensity;
500
+ uniform float uDotCount;
501
+ uniform float uRingRadius;
502
+ uniform float uRingWidth;
503
+ uniform float uGlow;
504
+ uniform float uMotion;
505
+ uniform vec3 uWarmColor;
506
+ uniform vec3 uLightColor;
507
+ uniform vec3 uCoolColor;
508
+ varying vec2 vUv;
509
+
510
+ mat2 rotate(float angle) {
511
+ float sine = sin(angle);
512
+ float cosine = cos(angle);
513
+ return mat2(cosine, -sine, sine, cosine);
514
+ }
515
+
516
+ float bell(float value, float width) {
517
+ return exp(-pow(value / max(width, 0.001), 2.0));
518
+ }
519
+
520
+ void main() {
521
+ vec2 p = vUv * 2.0 - 1.0;
522
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
523
+
524
+ float speed = max(uSpeed, 0.0);
525
+ float motion = max(uMotion, 0.0);
526
+ float time = uTime * speed;
527
+ float rotation = time * 0.08 * motion;
528
+ vec2 gridPosition = rotate(rotation) * p;
529
+ float cells = max(uDotCount, 8.0);
530
+ vec2 grid = (gridPosition + 1.0) * cells * 0.5;
531
+ vec2 cell = fract(grid) - 0.5;
532
+ vec2 samplePoint = (floor(grid) + 0.5) * 2.0 / cells - 1.0;
533
+ samplePoint = rotate(-rotation) * samplePoint;
534
+
535
+ float angle = atan(samplePoint.y, samplePoint.x);
536
+ float radius = length(samplePoint);
537
+ float travelingWave = sin(angle * 3.0 - time * 0.72) * 0.024 * motion;
538
+ travelingWave += sin(angle * 7.0 + time * 0.31) * 0.009 * motion;
539
+ float ringRadius = clamp(uRingRadius, 0.2, 0.92) + travelingWave;
540
+ float ringWidth = max(uRingWidth, 0.025);
541
+ float ring = bell(radius - ringRadius, ringWidth);
542
+
543
+ float lowerBloom = bell(samplePoint.x + 0.08, 0.72) * bell(samplePoint.y + 0.56, 0.42);
544
+ float upperArc = bell(radius - ringRadius + 0.025, ringWidth * 0.7) * smoothstep(-0.18, 0.72, samplePoint.y);
545
+ float light = clamp(ring * (0.58 + lowerBloom * 0.64 + upperArc * 0.25), 0.0, 1.0);
546
+ float shimmer = 0.9 + 0.1 * sin(angle * 9.0 + time * 0.48);
547
+ float dotRadius = mix(0.055, 0.43, pow(light, 0.72) * shimmer);
548
+ float dotDistance = length(cell);
549
+ float dot = 1.0 - smoothstep(dotRadius - 0.045, dotRadius + 0.045, dotDistance);
550
+
551
+ float warmWeight = smoothstep(-0.22, 0.72, samplePoint.y);
552
+ warmWeight *= 0.76 + 0.24 * (1.0 - smoothstep(-0.45, 0.72, samplePoint.x));
553
+ float coolWeight = smoothstep(-0.85, 0.42, samplePoint.x);
554
+ coolWeight *= 1.0 - smoothstep(-0.78, 0.3, samplePoint.y);
555
+ vec3 color = mix(uLightColor, uWarmColor, clamp(warmWeight, 0.0, 1.0));
556
+ color = mix(color, uCoolColor, clamp(coolWeight * 0.72, 0.0, 0.82));
557
+ color = mix(color, uLightColor, lowerBloom * ring * 0.58);
558
+
559
+ float circleMask = 1.0 - smoothstep(0.965, 1.0, length(p));
560
+ float dotAlpha = dot * pow(light, 0.82) * smoothstep(0.06, 0.24, light) * circleMask;
561
+ float glow = bell(length(p) - ringRadius, ringWidth * 1.75) * max(uGlow, 0.0) * 0.17;
562
+ glow *= circleMask;
563
+ float alpha = clamp((dotAlpha + glow) * max(uIntensity, 0.0), 0.0, 1.0);
564
+ vec3 glowColor = mix(uWarmColor, uCoolColor, 1.0 - smoothstep(-0.75, 0.55, samplePoint.y));
565
+ vec3 finalColor = color * dotAlpha + glowColor * glow;
566
+
567
+ gl_FragColor = vec4(clamp(finalColor * max(uIntensity, 0.0), 0.0, 1.0), alpha);
568
+ }
569
+ `,ep={name:"halftoneHalo",fragmentSource:UR};var XR=`
570
+ precision highp float;
571
+
572
+ uniform vec2 uResolution;
573
+ uniform float uTime;
574
+ uniform vec3 uColor;
575
+ uniform vec3 uAccent;
576
+ uniform float uIntensity;
577
+ uniform float uSpeed;
578
+ uniform float uThickness;
579
+ uniform float uProgress;
580
+ uniform float uBoost;
581
+ varying vec2 vUv;
582
+
583
+ const float TWO_PI = 6.28318530718;
584
+
585
+ void main() {
586
+ vec2 p = vUv * 2.0 - 1.0;
587
+ float radius = length(p);
588
+ if (radius > 1.0) discard;
589
+
590
+ float angle = atan(p.y, p.x);
591
+ float time = uTime * max(uSpeed, 0.0);
592
+ float controlled = step(0.0, uProgress);
593
+ float progress = clamp(uProgress, 0.0, 1.0);
594
+ float boost = clamp(uBoost, 0.0, 1.0);
595
+ float width = max(uThickness, 0.015);
596
+ float wave = sin(angle * 2.0 - time * 2.4) * 0.5 + 0.5;
597
+ float fineWave = sin(angle * 7.0 + time * 1.15) * 0.5 + 0.5;
598
+ float ringRadius = 0.72 + sin(angle * 3.0 - time * 1.5) * (0.025 + boost * 0.012);
599
+ float ring = exp(-pow((radius - ringRadius) / width, 2.0));
600
+ float outerRim = exp(-pow((radius - 0.94) / 0.025, 2.0));
601
+
602
+ float startAngle = -2.35;
603
+ float sweep = 4.70;
604
+ float arcPosition = mod(startAngle - angle + TWO_PI, TWO_PI);
605
+ float arcHead = progress * sweep;
606
+ float idleTravel = sin(time * 0.82) * 0.025 * (1.0 - boost);
607
+ float displayedHead = clamp(arcHead + idleTravel, 0.0, sweep);
608
+ float arcEdge = 0.025;
609
+ float arcMask = (1.0 - smoothstep(displayedHead - arcEdge, displayedHead + arcEdge, arcPosition));
610
+ arcMask *= 1.0 - step(sweep, arcPosition);
611
+ float arcActive = smoothstep(0.0, 0.012, progress);
612
+ arcMask *= arcActive;
613
+
614
+ float ambientHead = -2.25 + sin(time * 0.45) * 0.35;
615
+ float progressHead = startAngle - displayedHead;
616
+ float headAngle = mix(ambientHead, progressHead, controlled);
617
+ float angleFromHead = atan(sin(angle - headAngle), cos(angle - headAngle));
618
+ float flare = exp(-pow(angleFromHead / (0.18 + boost * 0.035), 2.0));
619
+ flare *= exp(-pow((radius - 0.73) / 0.12, 2.0));
620
+ float ambientBand = ring * (0.32 + wave * 0.38);
621
+ float startDelta = atan(sin(angle - startAngle), cos(angle - startAngle));
622
+ float radialDelta = radius - ringRadius;
623
+ float startCapDistance = length(vec2(radialDelta, startDelta * ringRadius));
624
+ float endCapDistance = length(vec2(radialDelta, angleFromHead * ringRadius));
625
+ float roundedCaps = max(
626
+ exp(-pow(startCapDistance / width, 2.0)),
627
+ exp(-pow(endCapDistance / width, 2.0))
628
+ ) * arcActive;
629
+ float progressShape = max(ring * arcMask, roundedCaps);
630
+ float progressBand = progressShape * (0.72 + boost * 0.55);
631
+ float idleBand = ring * (0.16 + wave * 0.16 + fineWave * 0.06);
632
+ float band = mix(ambientBand, idleBand + progressBand, controlled);
633
+ float pulse = 1.0 + boost * (0.18 + sin(time * 8.0) * 0.08);
634
+ float energy = clamp((band + outerRim * (0.24 + boost * 0.12) + flare * (1.35 + boost * 0.55) + fineWave * ring * 0.12) * uIntensity * pulse, 0.0, 1.0);
635
+ vec3 base = uColor * (0.1 + 0.28 * (1.0 - radius));
636
+ vec3 color = mix(base, uAccent, energy);
637
+ color += uAccent * flare * (0.3 + boost * 0.35);
638
+ float alpha = 1.0 - smoothstep(0.96, 1.0, radius);
639
+ gl_FragColor = vec4(color, alpha);
640
+ }
641
+ `,tp={name:"halo",fragmentSource:XR};var qR=`
642
+ precision highp float;
643
+
644
+ uniform float uTime;
645
+ uniform float uSpeed;
646
+ uniform float uIntensity;
647
+ uniform vec3 uBaseColor;
648
+ uniform vec3 uCoolColor;
649
+ uniform vec3 uWarmColor;
650
+ varying vec2 vUv;
651
+
652
+ float band(float distance, float width) {
653
+ return exp(-pow(distance / width, 2.0));
654
+ }
655
+
656
+ void main() {
657
+ vec2 p = vUv * 2.0 - 1.0;
658
+ float time = uTime * max(uSpeed, 0.0);
659
+ vec2 q = p;
660
+ q.x += sin(p.y * 4.0 + time * 0.58) * 0.02;
661
+ q.y += sin(p.x * 3.3 - time * 0.43) * 0.013;
662
+ float distance = length(q) - 0.64;
663
+ float body = 1.0 - smoothstep(-0.012, 0.01, distance);
664
+ float nearGlow = band(max(distance, 0.0), 0.19) * 0.62;
665
+ float wideGlow = band(max(distance, 0.0), 0.48) * 0.3;
666
+ float frameFade = 1.0 - smoothstep(0.88, 1.0, length(p));
667
+ float halo = max(nearGlow, wideGlow) * frameFade;
668
+ float alpha = body + (1.0 - body) * halo;
669
+ if (alpha < 0.002) discard;
670
+
671
+ float vertical = 0.5 + 0.5 * q.y;
672
+ float warmWeight = smoothstep(-0.44, 0.42, q.x + q.y * 0.14 + sin(time * 0.62 + q.y * 3.0) * 0.065);
673
+ vec3 glowColor = mix(uCoolColor, uWarmColor, warmWeight);
674
+ float breath = 0.78 + 0.22 * sin(time * 1.12 + q.y * 3.0);
675
+ float rim = band(distance + 0.014, 0.042);
676
+ float edge = band(distance + 0.006, 0.014);
677
+ float bevel = band(distance + 0.092, 0.07);
678
+
679
+ vec3 color = uBaseColor * (0.62 + 0.23 * vertical);
680
+ color += uWarmColor * smoothstep(-0.68, 0.6, q.x) * 0.13;
681
+ color += uWarmColor * band(q.x - 0.38, 0.32) * band(q.y + 0.14, 0.74) * 0.11;
682
+ color += uCoolColor * band(q.x + 0.28, 0.42) * band(q.y - 0.47, 0.35) * 0.11;
683
+ color *= 1.0 - band(q.x - 0.06, 0.3) * band(q.y + 0.2, 0.5) * 0.46;
684
+ color += glowColor * bevel * 0.14;
685
+ color += glowColor * rim * 0.41 * breath;
686
+ color += mix(uCoolColor, vec3(1.0), 0.45) * edge * (1.0 - warmWeight) * 0.43;
687
+ color += mix(uWarmColor, vec3(1.0), 0.38) * edge * warmWeight * 0.45;
688
+
689
+ float topFlare = band(q.y - 0.6, 0.07) * band(q.x + 0.2, 0.28);
690
+ float bottomFlare = band(q.y + 0.61, 0.07) * band(q.x - 0.15, 0.35);
691
+ color += uCoolColor * topFlare * 0.39;
692
+ color += uWarmColor * bottomFlare * 0.31;
693
+ vec3 premultiplied = color * body + glowColor * (1.0 - body) * halo * breath;
694
+ gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
695
+ }
696
+ `,rp={name:"lumenPortal",fragmentSource:qR};var KR=`
697
+ precision highp float;
698
+
699
+ uniform float uTime;
700
+ uniform float uSpeed;
701
+ uniform float uIntensity;
702
+ uniform vec3 uBaseColor;
703
+ uniform vec3 uCoolColor;
704
+ uniform vec3 uWarmColor;
705
+ uniform vec3 uShadowColor;
706
+ varying vec2 vUv;
707
+
708
+ float band(float distance, float width) {
709
+ return exp(-pow(distance / width, 2.0));
710
+ }
711
+
712
+ void main() {
713
+ vec2 p = vUv * 2.0 - 1.0;
714
+ float time = uTime * max(uSpeed, 0.0);
715
+ vec2 q = p;
716
+ q.x += sin(p.y * 4.1 + time * 0.55) * 0.013;
717
+ q.y += sin(p.x * 3.4 - time * 0.41) * 0.01;
718
+ float distance = length(q) - 0.65;
719
+ float body = 1.0 - smoothstep(-0.012, 0.012, distance);
720
+ float nearHalo = band(max(distance, 0.0), 0.12) * 0.19;
721
+ float wideHalo = band(max(distance, 0.0), 0.28) * 0.055;
722
+ float frameFade = 1.0 - smoothstep(0.89, 1.0, length(p));
723
+ float outside = max(nearHalo, wideHalo) * frameFade;
724
+ float alpha = body * 0.96 + (1.0 - body) * outside;
725
+ if (alpha < 0.002) discard;
726
+
727
+ float warmWeight = smoothstep(-0.46, 0.47, q.x + q.y * 0.17 + sin(time * 0.58 + q.y * 3.0) * 0.052);
728
+ vec3 rimColor = mix(uCoolColor, uWarmColor, warmWeight);
729
+ float breath = 0.84 + 0.16 * sin(time * 0.91 + q.y * 2.5);
730
+ float innerRim = band(distance + 0.038, 0.052);
731
+ float outerRim = band(distance + 0.002, 0.025);
732
+ float fineEdge = band(distance + 0.008, 0.01);
733
+ float bevelShade = band(distance + 0.11, 0.055);
734
+
735
+ vec3 color = uBaseColor;
736
+ color = mix(color, uCoolColor, band(q.x + 0.27, 0.39) * band(q.y - 0.35, 0.43) * 0.09);
737
+ color = mix(color, uWarmColor, band(q.x - 0.31, 0.43) * band(q.y + 0.31, 0.48) * 0.085);
738
+ color = mix(color, uShadowColor, bevelShade * 0.11);
739
+ color = mix(color, rimColor, innerRim * 0.46 * breath);
740
+ color = mix(color, rimColor, outerRim * 0.62 * breath);
741
+ color = mix(color, uShadowColor, fineEdge * 0.12);
742
+
743
+ float topGlint = band(q.y - 0.6, 0.06) * band(q.x + 0.2, 0.22);
744
+ float bottomGlint = band(q.y + 0.61, 0.06) * band(q.x - 0.16, 0.29);
745
+ color += uCoolColor * topGlint * 0.12;
746
+ color += uWarmColor * bottomGlint * 0.1;
747
+
748
+ vec3 premultiplied = color * body * 0.96;
749
+ premultiplied += mix(uShadowColor, rimColor, 0.58) * (1.0 - body) * outside * breath;
750
+ gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
751
+ }
752
+ `,np={name:"lumenPortalLight",fragmentSource:KR};var ZR=`
753
+ precision highp float;
754
+
755
+ uniform vec2 uResolution;
756
+ uniform float uTime;
757
+ uniform vec3 uColor;
758
+ uniform vec3 uAccent;
759
+ uniform float uIntensity;
760
+ uniform float uSpeed;
761
+ varying vec2 vUv;
762
+
763
+ float hash(vec2 p) {
764
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
765
+ }
766
+
767
+ void main() {
768
+ vec2 p = vUv * 2.0 - 1.0;
769
+ float radius = length(p);
770
+ if (radius > 1.0) discard;
771
+
772
+ float angle = atan(p.y, p.x);
773
+ float time = uTime * max(uSpeed, 0.0);
774
+ float fold = sin(angle * 3.0 - time * 1.7 + radius * 7.0);
775
+ float ribbon = exp(-pow(radius - (0.69 + fold * 0.07), 2.0) * 95.0);
776
+ float rim = smoothstep(0.58, 0.98, radius) * (1.0 - smoothstep(0.94, 1.0, radius));
777
+ float light = exp(-length(p - vec2(-0.42, -0.34)) * 4.2);
778
+ float grain = (hash(gl_FragCoord.xy + time) - 0.5) * 0.035;
779
+ float energy = clamp((ribbon * 0.8 + rim * 0.55 + light * 0.7) * uIntensity, 0.0, 1.0);
780
+ vec3 color = mix(uColor * (0.12 + 0.32 * (1.0 - radius)), uAccent, energy);
781
+ color += grain;
782
+ float alpha = 1.0 - smoothstep(0.94, 1.0, radius);
783
+ gl_FragColor = vec4(color, alpha);
784
+ }
785
+ `,op={name:"orb",fragmentSource:ZR};var QR=`
786
+ precision highp float;
787
+
788
+ uniform float uTime;
789
+ uniform float uSpeed;
790
+ uniform float uIntensity;
791
+ uniform float uCellCount;
792
+ uniform float uDensity;
793
+ uniform vec3 uBaseColor;
794
+ uniform vec3 uTopColor;
795
+ uniform vec3 uWarmColor;
796
+ uniform vec3 uCenterColor;
797
+ uniform vec3 uVioletColor;
798
+ uniform vec3 uBottomColor;
799
+ varying vec2 vUv;
800
+
801
+ float band(float distance, float width) {
802
+ return exp(-pow(distance / width, 2.0));
803
+ }
804
+
805
+ float hash(vec2 p) {
806
+ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
807
+ }
808
+
809
+ float noise(vec2 p) {
810
+ vec2 cell = floor(p);
811
+ vec2 blend = fract(p);
812
+ blend = blend * blend * (3.0 - 2.0 * blend);
813
+ float lower = mix(hash(cell), hash(cell + vec2(1.0, 0.0)), blend.x);
814
+ float upper = mix(hash(cell + vec2(0.0, 1.0)), hash(cell + vec2(1.0, 1.0)), blend.x);
815
+ return mix(lower, upper, blend.y);
816
+ }
817
+
818
+ vec3 strandColor(float y) {
819
+ vec3 color = mix(uBottomColor, uVioletColor, smoothstep(-0.9, -0.43, y));
820
+ color = mix(color, uCenterColor, smoothstep(-0.38, 0.05, y));
821
+ color = mix(color, uWarmColor, smoothstep(0.14, 0.48, y));
822
+ return mix(color, uTopColor, smoothstep(0.64, 0.9, y));
823
+ }
824
+
825
+ void main() {
826
+ vec2 p = vUv * 2.0 - 1.0;
827
+ float radius = length(p);
828
+ if (radius >= 1.0) discard;
829
+
830
+ float time = uTime * max(uSpeed, 0.0);
831
+ float cells = max(uCellCount, 1.0);
832
+ vec2 grid = (p + 1.0) * cells * 0.5;
833
+ vec2 cellId = floor(grid);
834
+ vec2 q = (cellId + 0.5) * 2.0 / cells - 1.0;
835
+ vec2 flow = vec2(
836
+ 0.1 * sin(time * 0.48 + q.y * 2.6),
837
+ 0.08 * cos(time * 0.4 + q.x * 2.1)
838
+ );
839
+ vec2 movingQ = q + flow;
840
+
841
+ float path = -0.29 + 0.19 * sin(movingQ.y * 4.0 + time * 0.27);
842
+ path += 0.09 * sin(movingQ.y * 7.7 - time * 0.19);
843
+ float strand = band(movingQ.x - path, 0.26) * 0.11;
844
+ float top = band(movingQ.x + 0.52, 0.28) * band(movingQ.y - 0.78, 0.19) * 0.75;
845
+ float warm = band(movingQ.x + 0.46, 0.2) * band(movingQ.y - 0.47, 0.23) * 0.76;
846
+ float center = band(movingQ.x + 0.06, 0.25) * band(movingQ.y - 0.02, 0.21) * 1.14;
847
+ float lower = band(movingQ.x + 0.38, 0.32) * band(movingQ.y + 0.48, 0.27) * 0.86;
848
+ float bottom = band(movingQ.x + 0.56, 0.36) * band(movingQ.y + 0.85, 0.19) * 0.88;
849
+ float blue = band(movingQ.x - 0.28, 0.19) * band(movingQ.y + 0.64, 0.18) * 0.94;
850
+ float field = strand + top + warm + center + lower + bottom + blue;
851
+ field *= 0.35 + 1.25 * noise(movingQ * 5.1 + vec2(time * 0.075, -time * 0.04));
852
+
853
+ float chance = clamp(field * max(uDensity, 0.0), 0.0, 0.96);
854
+ float seed = hash(cellId);
855
+ float active = smoothstep(seed - 0.055, seed + 0.055, chance);
856
+ vec2 local = fract(grid) - 0.5;
857
+ local -= vec2(
858
+ 0.11 * sin(time * 0.72 + seed * 6.28318),
859
+ 0.11 * cos(time * 0.61 + seed * 4.71239)
860
+ );
861
+ float growth = 0.78 + 0.34 * (0.5 + 0.5 * sin(time * 0.83 + seed * 5.3));
862
+ float size = mix(0.27, 0.34, hash(cellId + vec2(19.3, 7.1))) * growth;
863
+ float squareRadius = max(abs(local.x), abs(local.y));
864
+ float outer = 1.0 - smoothstep(size - 0.045, size + 0.015, squareRadius);
865
+ float inner = 1.0 - smoothstep(size - 0.17, size - 0.105, squareRadius);
866
+ float outline = max(outer - inner, 0.0);
867
+ float glow = band(squareRadius - size + 0.075, 0.115) * 0.24;
868
+
869
+ float pulse = 0.76 + 0.24 * sin(time * 1.1 - q.y * 5.1 + seed * 6.28318);
870
+ float variation = 0.43 + 0.57 * hash(cellId + vec2(3.7, 27.4));
871
+ float highlight = band(movingQ.x + 0.07, 0.25) * band(movingQ.y - 0.02, 0.24);
872
+ vec3 colorSum = strandColor(movingQ.y) * strand;
873
+ colorSum += uTopColor * top + uWarmColor * warm + uCenterColor * center;
874
+ colorSum += uVioletColor * lower + uBottomColor * (bottom + blue);
875
+ vec3 cellColor = colorSum / max(strand + top + warm + center + lower + bottom + blue, 0.001);
876
+ cellColor = mix(cellColor, vec3(1.0, 0.96, 0.76), highlight * 0.54);
877
+ vec3 color = uBaseColor + cellColor * active * variation * pulse * (outline + glow);
878
+
879
+ float edge = 1.0 - smoothstep(0.965, 0.997, radius);
880
+ gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * edge, 0.0, 1.0), edge);
881
+ }
882
+ `,ip={name:"pixelConstellation",fragmentSource:QR};var JR=`
883
+ precision highp float;
884
+
885
+ uniform vec2 uResolution;
886
+ uniform float uTime;
887
+ uniform float uSpeed;
888
+ uniform float uIntensity;
889
+ uniform float uProgress;
890
+ uniform float uDent;
891
+ uniform float uBoost;
892
+ uniform float uFlare;
893
+ uniform float uStart;
894
+ uniform float uSweep;
895
+ uniform vec3 uColor;
896
+ uniform vec3 uAccent;
897
+ uniform vec3 uHot;
898
+ varying vec2 vUv;
899
+
900
+ float bell(float value, float width) {
901
+ return exp(-pow(value / max(width, 0.001), 2.0));
902
+ }
903
+
904
+ float wrap(float angle) {
905
+ return atan(sin(angle), cos(angle));
906
+ }
907
+
908
+ void main() {
909
+ vec2 p = vUv * 2.0 - 1.0;
910
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
911
+ float time = uTime * max(uSpeed, 0.0);
912
+ float radius = length(p);
913
+ float angle = atan(p.y, p.x);
914
+
915
+ float sweep = radians(uSweep > 0.0 ? uSweep : 270.0);
916
+ float start = radians(uStart != 0.0 ? uStart : 225.0);
917
+ float progress = clamp(uProgress < 0.0 ? 0.35 : uProgress, 0.0, 1.0);
918
+ float needleAngle = start - progress * sweep;
919
+ float delta = wrap(angle - needleAngle);
920
+
921
+ float dentValue = clamp(uDent < 0.0 ? progress : uDent, 0.0, 1.0);
922
+ float engage = smoothstep(0.0, 0.28, dentValue);
923
+ float boost = smoothstep(0.0, 1.0, clamp(uBoost, 0.0, 1.0));
924
+ float energy = smoothstep(0.0, 1.0, dentValue);
925
+ float level = (uFlare > 0.0 ? uFlare : 1.0) * engage * (0.45 + 0.5 * energy + 0.3 * boost);
926
+
927
+ float heat = smoothstep(0.15, 1.0, clamp(0.75 * energy + 0.5 * boost, 0.0, 1.0));
928
+ vec3 cool = mix(uAccent, vec3(0.18, 0.28, 0.95), 0.55);
929
+ vec3 hot = uHot;
930
+ vec3 tint = mix(cool, hot, heat);
931
+
932
+ float ripple = 0.5 + 0.5 * sin(delta * 9.0 - time * 1.4);
933
+ float wake = (progress - dentValue) * sweep;
934
+ float lo = min(0.0, wake);
935
+ float hi = max(0.0, wake);
936
+ float segment = delta < lo ? lo - delta : (delta > hi ? delta - hi : 0.0);
937
+ float wakePos = hi > lo ? clamp((delta - lo) / (hi - lo), 0.0, 1.0) : 0.0;
938
+ float fromNeedle = wake >= 0.0 ? wakePos : 1.0 - wakePos;
939
+ float taper = mix(1.0, 0.45, fromNeedle * smoothstep(0.02, 0.2, abs(wake)));
940
+ float dent = bell(segment, 0.13 + 0.02 * ripple) * (0.82 + 0.18 * ripple) * taper;
941
+ float shoulder = bell(delta, 0.34);
942
+ float ahead = wake >= 0.0 ? -1.0 : 1.0;
943
+ float pile = bell(delta - ahead * 0.17, 0.15) * clamp(abs(wake) * 2.2, 0.0, 1.0) * engage;
944
+ float baseRadius = 0.72;
945
+ float orbRadius = baseRadius * (1.0 - 0.32 * level * dent - 0.07 * level * shoulder + 0.13 * pile);
946
+ float body = 1.0 - smoothstep(orbRadius - 0.012, orbRadius + 0.012, radius);
947
+ float depth = clamp(radius / orbRadius, 0.0, 1.25);
948
+ float roundDepth = clamp(radius / baseRadius, 0.0, 1.2);
949
+
950
+ float local = clamp(heat * (0.7 + 0.3 * bell(delta, 0.9)) + 0.25 * heat * bell(delta, 0.3), 0.0, 1.0);
951
+ vec3 rim = mix(cool, hot, local);
952
+ vec3 bodyColor = mix(uColor, rim * (0.5 + 0.25 * energy), pow(roundDepth, 2.6));
953
+ bodyColor += mix(uAccent, hot, local) * (0.26 + 0.3 * energy) * bell(roundDepth - 0.93, 0.13);
954
+ bodyColor *= (0.82 + 0.18 * smoothstep(-0.5, 0.5, -p.x)) * (0.9 + 0.6 * energy * energy);
955
+
956
+ float ribbons = 0.5 + 0.5 * sin(depth * 24.0 - delta * 8.0 + time * 1.1);
957
+ float zone = max(bell(delta, 0.3), dent * 0.8) * bell(depth - 0.84, 0.32) * level * (1.0 + 0.9 * energy);
958
+ vec3 ribbonColor = mix(tint, hot, smoothstep(0.2, 0.9, ribbons) * (0.35 + 0.65 * heat));
959
+ bodyColor = mix(bodyColor, ribbonColor, clamp(zone * (0.4 + 0.45 * ribbons), 0.0, 1.0));
960
+ float edge = max(max(bell(delta, 0.2), dent * 0.7), pile * 0.8) * bell(depth - 0.99, 0.09) * level;
961
+ bodyColor += mix(hot, vec3(1.0, 0.92, 1.0), 0.45) * edge * (0.45 + 1.3 * energy);
962
+
963
+ float outside = max(radius - orbRadius, 0.0);
964
+ float notchLight = max(max(bell(delta, 0.2), dent * 0.8), pile * 0.6) * level;
965
+ float halo = exp(-outside * (12.0 - 6.0 * notchLight * (0.4 + energy))) * (1.0 - body) * (0.2 + 0.5 * energy * energy + 0.9 * notchLight * (0.5 + energy));
966
+ vec3 haloColor = mix(tint, hot, clamp(notchLight * 1.2, 0.0, 1.0));
967
+
968
+ float cross = abs(p.x * sin(needleAngle) - p.y * cos(needleAngle));
969
+ float along = p.x * cos(needleAngle) + p.y * sin(needleAngle);
970
+ float needleSpan = smoothstep(0.1, 0.2, along) * (1.0 - smoothstep(0.9, 0.96, along));
971
+ float needle = smoothstep(0.0055, 0.0008, cross) * needleSpan;
972
+ float needleGlow = bell(cross, 0.02) * needleSpan * (0.25 + 0.35 * energy);
973
+
974
+ vec3 color = bodyColor * body + haloColor * halo + vec3(1.0, 0.94, 1.0) * needle + hot * needleGlow;
975
+ float alpha = max(max(body, clamp(halo, 0.0, 1.0)), max(needle, needleGlow * 0.8));
976
+
977
+ float fade = 1.0 - smoothstep(0.88, 0.99, radius);
978
+ float gain = max(uIntensity, 0.0) * fade;
979
+ gl_FragColor = vec4(clamp(color * gain, 0.0, 1.0), clamp(alpha * gain, 0.0, 1.0));
980
+ }
981
+ `,ap={name:"plasmaGauge",fragmentSource:JR,replacesBaseFill:!0};var ek=`
982
+ precision highp float;
983
+
984
+ uniform vec2 uResolution;
985
+ uniform float uTime;
986
+ uniform float uSpeed;
987
+ uniform float uIntensity;
988
+ uniform float uRibCount;
989
+ uniform float uGrain;
990
+ uniform vec3 uBaseColor;
991
+ uniform vec3 uCoolColor;
992
+ uniform vec3 uWarmColor;
993
+ uniform vec3 uHighlightColor;
994
+ varying vec2 vUv;
995
+
996
+ float band(float distance, float width) {
997
+ return exp(-pow(distance / width, 2.0));
998
+ }
999
+
1000
+ float lightField(vec2 p, float time) {
1001
+ float upperCurve = 0.43 + 0.16 * sin(p.x * 2.8 + time * 0.58) - p.x * 0.08;
1002
+ float lowerCurve = -0.46 + 0.13 * sin(p.x * 2.9 - time * 0.43 + 1.4);
1003
+ float upper = band(p.y - upperCurve, 0.2) * band(p.x + 0.03, 0.88);
1004
+ float lower = band(p.y - lowerCurve, 0.19) * band(p.x - 0.05, 0.85);
1005
+ float leftColumn = band(p.x + 0.39 + 0.1 * sin(p.y * 2.9 + time * 0.5), 0.23);
1006
+ leftColumn *= band(p.y + 0.01, 0.59);
1007
+ float centerShadow = 1.0 - band(p.x - 0.35, 0.46) * band(p.y + 0.01, 0.28) * 0.9;
1008
+ float drift = 0.84 + 0.16 * sin(p.x * 3.5 - p.y * 2.2 + time * 0.72);
1009
+ return clamp((upper + lower + leftColumn * 0.74) * centerShadow * drift, 0.0, 1.5);
1010
+ }
1011
+
1012
+ float grain(vec2 uv) {
1013
+ vec2 pixel = floor(uv * uResolution);
1014
+ return fract(sin(dot(pixel, vec2(127.1, 311.7))) * 43758.5453);
1015
+ }
1016
+
1017
+ void main() {
1018
+ vec2 p = vUv * 2.0 - 1.0;
1019
+ float radius = length(p);
1020
+ if (radius >= 1.0) discard;
1021
+ float time = uTime * max(uSpeed, 0.0);
1022
+
1023
+ float field = lightField(p, time);
1024
+ float redField = lightField(p + vec2(0.027, 0.0), time);
1025
+ float blueField = lightField(p - vec2(0.027, 0.0), time);
1026
+ float coolRegion = band(p.x + 0.58, 0.38) * 0.74;
1027
+ float warmRegion = band(p.x + 0.02, 0.34) * band(p.y + 0.08, 0.75) * 0.88;
1028
+ vec3 spectralTint = mix(uHighlightColor, uCoolColor, coolRegion);
1029
+ spectralTint = mix(spectralTint, uWarmColor, warmRegion);
1030
+ vec3 light = spectralTint * field * 1.25;
1031
+ light += uWarmColor * max(redField - blueField, 0.0) * 2.6;
1032
+ light += uCoolColor * max(blueField - redField, 0.0) * 2.6;
1033
+
1034
+ float ribCoordinate = (p.x + 1.0) * max(uRibCount, 1.0) * 0.5;
1035
+ float rib = fract(ribCoordinate);
1036
+ float glassFace = smoothstep(0.08, 0.18, rib) * (1.0 - smoothstep(0.77, 0.94, rib));
1037
+ float groove = 1.0 - glassFace;
1038
+ float refraction = 0.8 + 0.2 * sin(rib * 3.14159);
1039
+ vec3 color = uBaseColor + light * (0.12 + glassFace * 0.95) * refraction;
1040
+ color *= 1.0 - groove * 0.83;
1041
+
1042
+ float leftEdge = band(rib - 0.18, 0.028);
1043
+ float rightEdge = band(rib - 0.79, 0.04);
1044
+ color += mix(uCoolColor, uHighlightColor, 0.48) * leftEdge * (0.07 + field * 0.19);
1045
+ color += uHighlightColor * rightEdge * (0.025 + field * 0.075);
1046
+ color += uCoolColor * band(p.x + 0.78, 0.28) * band(p.y, 0.7) * 0.09;
1047
+
1048
+ float noise = (grain(vUv) - 0.5) * max(uGrain, 0.0);
1049
+ color += vec3(noise) * (0.18 + field * 0.82);
1050
+ float fade = 1.0 - smoothstep(0.88, 1.0, radius);
1051
+ gl_FragColor = vec4(clamp(color * max(uIntensity, 0.0) * fade, 0.0, 1.0), fade);
1052
+ }
1053
+ `,sp={name:"prismSlats",fragmentSource:ek};var tk=`
1054
+ precision highp float;
1055
+
1056
+ uniform vec2 uResolution;
1057
+ uniform float uIntensity;
1058
+ uniform float uProgress;
1059
+ uniform float uTicks;
1060
+ uniform float uMajor;
1061
+ uniform float uLength;
1062
+ uniform float uThickness;
1063
+ uniform float uRound;
1064
+ uniform float uDent;
1065
+ uniform float uSpread;
1066
+ uniform float uInset;
1067
+ uniform float uLine;
1068
+ uniform float uGap;
1069
+ uniform float uKnobRadius;
1070
+ uniform float uAxis;
1071
+ uniform vec3 uColor;
1072
+ uniform vec3 uAccent;
1073
+ uniform vec3 uGlow;
1074
+ uniform vec3 uCore;
1075
+ uniform vec3 uPeak;
1076
+ varying vec2 vUv;
1077
+
1078
+ float wireAt(float at, float lineAt, float depth, float radius, float knob, float spread) {
1079
+ float reach = abs(at - knob);
1080
+ if (uKnobRadius > 0.0) {
1081
+ float outline = max(sqrt(max(radius * radius - reach * reach, 0.0)) - (radius - depth), 0.0);
1082
+ float shoulder = max(sqrt(2.0 * depth * radius) * 0.9, 1.0);
1083
+ float soft = depth * exp(-(reach * reach) / (shoulder * shoulder));
1084
+ float k = max(depth * 0.15, 1.0);
1085
+ float h = max(k - abs(outline - soft), 0.0) / k;
1086
+ return lineAt - (max(outline, soft) + h * h * k * 0.25);
1087
+ }
1088
+ float away = reach / spread;
1089
+ return lineAt - depth * exp(-away * away);
1090
+ }
1091
+
1092
+ void main() {
1093
+ vec2 px = vUv * uResolution;
1094
+ float horizontal = step(0.5, uAxis);
1095
+ float along = mix(px.y, px.x, horizontal);
1096
+ float across = mix(px.x, uResolution.y - px.y, horizontal);
1097
+ float extent = mix(uResolution.y, uResolution.x, horizontal);
1098
+ float width = mix(uResolution.x, uResolution.y, horizontal);
1099
+
1100
+ float inset = uInset > 0.0 ? uInset : 0.05;
1101
+ float lineAt = (uLine > 0.0 ? uLine : 0.7) * width;
1102
+ float count = max(uTicks > 0.0 ? uTicks : 50.0, 2.0);
1103
+ float every = max(uMajor > 0.0 ? uMajor : 5.0, 1.0);
1104
+ float unit = (uThickness > 0.0 ? uThickness : 0.012) * width;
1105
+ float halfLine = max(unit * 0.5, 0.75);
1106
+ float spread = (uSpread > 0.0 ? uSpread : 0.07) * extent;
1107
+ float depth = (uDent < 0.0 ? 1.0 : uDent) * 0.16 * width;
1108
+
1109
+ float start = inset * extent;
1110
+ float span = (1.0 - 2.0 * inset) * extent;
1111
+ float knob = start + span * clamp(uProgress, 0.0, 1.0);
1112
+
1113
+ float away = (along - knob) / spread;
1114
+ float bump = exp(-away * away);
1115
+ float radius = (uKnobRadius + (uGap > 0.0 ? uGap : 0.04)) * width;
1116
+ float wire = wireAt(along, lineAt, depth, radius, knob, spread);
1117
+ float slope = (wireAt(along + 1.0, lineAt, depth, radius, knob, spread) - wireAt(along - 1.0, lineAt, depth, radius, knob, spread)) * 0.5;
1118
+ float lineDistance = abs(across - wire) / sqrt(1.0 + slope * slope);
1119
+ float line = 1.0 - smoothstep(halfLine - 0.75, halfLine + 0.75, lineDistance);
1120
+ float wireDistance = abs(across - wire);
1121
+ vec3 lineColor = mix(uColor, uAccent, bump);
1122
+
1123
+ vec3 glowColor = dot(uGlow, uGlow) > 0.0 ? uGlow : uAccent;
1124
+ float glowSide = across < wire ? 1.0 : 0.35;
1125
+ float glow = bump * exp(-wireDistance / (0.1 * width)) * glowSide * 1.3 * max(uIntensity, 0.0);
1126
+ vec3 coreColor = dot(uCore, uCore) > 0.0 ? uCore : mix(glowColor, vec3(1.0), 0.55);
1127
+ float core = bump * bump * exp(-wireDistance / (0.035 * width)) * glowSide * 1.6 * max(uIntensity, 0.0);
1128
+ float reachEdge = min(min(along, extent - along), min(across, width - across));
1129
+ float fade = smoothstep(0.0, 0.14 * width, reachEdge);
1130
+ glow *= fade;
1131
+ core *= fade;
1132
+
1133
+ float spacing = span / count;
1134
+ float position = (along - start) / spacing;
1135
+ float index = floor(position + 0.5);
1136
+ float inRange = step(0.0, index) * step(index, count);
1137
+ float tickAlong = abs(position - index) * spacing;
1138
+ float major = 1.0 - step(0.5, mod(index, every));
1139
+ float tickLength = (uLength > 0.0 ? uLength : 0.1) * width * mix(1.0, 1.9, major);
1140
+ float tickDistance = (start + index * spacing - knob) / spread;
1141
+ float tickBump = exp(-tickDistance * tickDistance);
1142
+ float tickEnd = lineAt - 0.12 * width - depth * 0.4 * tickBump;
1143
+ float halfTick = halfLine * mix(0.75, 1.2, major);
1144
+ float corner = halfTick * clamp(uRound, 0.0, 1.0);
1145
+ vec2 q = abs(vec2(across - (tickEnd - tickLength * 0.5), tickAlong)) - vec2(tickLength * 0.5, halfTick) + corner;
1146
+ float edge = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - corner;
1147
+ float tick = (1.0 - smoothstep(-0.75, 0.75, edge)) * inRange * mix(0.4, 1.0, tickBump);
1148
+ vec3 peakColor = dot(uPeak, uPeak) > 0.0 ? uPeak : vec3(1.0);
1149
+ vec3 tickColor = mix(uColor, peakColor, tickBump);
1150
+
1151
+ float alpha = clamp(tick + line * 0.95 + glow + core, 0.0, 1.0);
1152
+ vec3 rgb = tickColor * tick + lineColor * line * 0.95 + glowColor * glow + coreColor * core;
1153
+ gl_FragColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
1154
+ }
1155
+ `,lp={name:"ruler",fragmentSource:tk,replacesBaseFill:!0};var rk=`
1156
+ precision highp float;
1157
+
1158
+ uniform vec2 uResolution;
1159
+ uniform float uTime;
1160
+ uniform float uSpeed;
1161
+ uniform float uIntensity;
1162
+ uniform float uBlur;
1163
+ uniform float uGlow;
1164
+ uniform float uMotion;
1165
+ uniform float uDirection;
1166
+ uniform float uReach;
1167
+ uniform vec3 uShapeColor;
1168
+ varying vec2 vUv;
1169
+
1170
+ float bell(float value, float width) {
1171
+ return exp(-pow(value / max(width, 0.001), 2.0));
1172
+ }
1173
+
1174
+ mat2 rotate(float angle) {
1175
+ float sine = sin(angle);
1176
+ float cosine = cos(angle);
1177
+ return mat2(cosine, -sine, sine, cosine);
1178
+ }
1179
+
1180
+ vec2 orient(vec2 point, float direction) {
1181
+ if (direction < 0.5) return point;
1182
+ if (direction < 1.5) return vec2(-point.x, point.y);
1183
+ if (direction < 2.5) return vec2(-point.y, point.x);
1184
+ return vec2(point.y, -point.x);
1185
+ }
1186
+
1187
+ void main() {
1188
+ vec2 p = vUv * 2.0 - 1.0;
1189
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
1190
+ float time = uTime * max(uSpeed, 0.0);
1191
+ float motion = max(uMotion, 0.0);
1192
+ float blur = clamp(uBlur, 0.02, 0.55);
1193
+
1194
+ vec2 q = orient(p, uDirection) - vec2(0.12, 0.0);
1195
+ float sweep = sin(time * 0.55) * 0.42 * motion;
1196
+ vec2 qb = rotate(sweep) * q;
1197
+ float radius = length(q);
1198
+ float reach = clamp(uReach + sin(time * 0.41 + 1.3) * 0.16 * motion, 0.0, 1.0);
1199
+ float left = 1.0 - smoothstep(-0.42, mix(-0.24, 0.46, reach), qb.x);
1200
+ float upper = smoothstep(-0.05, 0.46, qb.y);
1201
+ float lower = 1.0 - smoothstep(-0.46, 0.05, qb.y);
1202
+ float blurSide = left * (0.50 + 0.50 * max(upper, lower));
1203
+ float breathing = 1.0 + sin(time * 0.72) * 0.28 * motion;
1204
+ float edgeWidth = mix(0.015, blur * breathing, blurSide);
1205
+ float body = 1.0 - smoothstep(0.49 - edgeWidth, 0.49 + edgeWidth, radius);
1206
+
1207
+ float upperPlume = bell(qb.x + 0.33 + sin(time * 0.62) * 0.07 * motion, 0.37 + blur * 0.42);
1208
+ upperPlume *= bell(qb.y - 0.28 + sin(time * 0.47) * 0.05 * motion, 0.24 + blur * 0.5);
1209
+ float lowerPlume = bell(qb.x + 0.32 - sin(time * 0.58) * 0.07 * motion, 0.34 + blur * 0.42);
1210
+ lowerPlume *= bell(qb.y + 0.34 - sin(time * 0.44) * 0.05 * motion, 0.26 + blur * 0.5);
1211
+ float plume = (upperPlume * 0.44 + lowerPlume * 0.40) * left * max(uGlow, 0.0);
1212
+
1213
+ vec3 lightColor = mix(uShapeColor, vec3(1.0), 0.24);
1214
+ vec3 darkColor = mix(uShapeColor, vec3(0.0), 0.7);
1215
+ float vertical = smoothstep(-0.45, 0.44, q.y);
1216
+ vec3 orbColor = mix(uShapeColor * 0.82, lightColor, vertical * 0.48);
1217
+ float shade = bell(q.x + 0.22, 0.38) * bell(q.y, 0.28);
1218
+ orbColor = mix(orbColor, darkColor, shade * 0.43);
1219
+ orbColor *= 0.76 + bell(q.x - 0.27, 0.36) * 0.32;
1220
+
1221
+ vec3 plumeColor = mix(uShapeColor, lightColor, smoothstep(-0.26, 0.30, q.y) * 0.35);
1222
+ float alpha = body + (1.0 - body) * plume;
1223
+ float frameFade = 1.0 - smoothstep(0.85, 1.0, max(abs(p.x), abs(p.y)));
1224
+ alpha = clamp(alpha * frameFade * max(uIntensity, 0.0), 0.0, 1.0);
1225
+ vec3 premultiplied = orbColor * body + plumeColor * (1.0 - body) * plume;
1226
+ gl_FragColor = vec4(clamp(premultiplied * frameFade * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1227
+ }
1228
+ `,dp={name:"smearOrb",fragmentSource:rk,replacesBaseFill:!0};var nk=`
1229
+ precision highp float;
1230
+
1231
+ uniform vec2 uResolution;
1232
+ uniform float uIntensity;
1233
+ uniform float uProgress;
1234
+ uniform float uTicks;
1235
+ uniform float uMajor;
1236
+ uniform float uStart;
1237
+ uniform float uSweep;
1238
+ uniform float uRadius;
1239
+ uniform float uLength;
1240
+ uniform float uThickness;
1241
+ uniform float uRound;
1242
+ uniform vec3 uColor;
1243
+ uniform vec3 uAccent;
1244
+ varying vec2 vUv;
1245
+
1246
+ const float TAU = 6.28318530718;
1247
+
1248
+ void main() {
1249
+ vec2 p = vUv * 2.0 - 1.0;
1250
+ p.x *= uResolution.x / max(uResolution.y, 1.0);
1251
+ float radius = length(p);
1252
+ float angle = atan(p.y, p.x);
1253
+ float pixel = 2.0 / max(uResolution.y, 1.0);
1254
+
1255
+ float sweep = radians(uSweep > 0.0 ? uSweep : 270.0);
1256
+ float start = radians(uStart != 0.0 ? uStart : 225.0);
1257
+ float gap = TAU - sweep;
1258
+ float fraction = (mod(start - angle + gap * 0.5, TAU) - gap * 0.5) / sweep;
1259
+
1260
+ float count = max(uTicks, 2.0);
1261
+ float inArc = step(-0.25 / count, fraction) * step(fraction, 1.0 + 0.25 / count);
1262
+ float phase = fraction * count;
1263
+ float index = floor(phase + 0.5);
1264
+ float arcDistance = abs(fract(phase + 0.5) - 0.5) / count * sweep * radius;
1265
+ float every = max(uMajor, 1.0);
1266
+ float major = 1.0 - step(0.5, mod(index, every));
1267
+
1268
+ float outer = uRadius > 0.0 ? uRadius : 0.9;
1269
+ float tickLength = (uLength > 0.0 ? uLength : 0.05) * mix(1.0, 1.8, major);
1270
+ float halfWidth = max((uThickness > 0.0 ? uThickness : 0.003) * mix(1.0, 1.4, major), pixel * 0.9);
1271
+ float halfLength = tickLength * 0.5;
1272
+ float corner = min(halfWidth, halfLength) * clamp(uRound, 0.0, 1.0);
1273
+ vec2 q = vec2(arcDistance, abs(radius - (outer - halfLength))) - vec2(halfWidth, halfLength) + corner;
1274
+ float edge = length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - corner;
1275
+ float tick = (1.0 - smoothstep(-pixel, pixel, edge)) * inArc;
1276
+
1277
+ float progress = uProgress < 0.0 ? 1.0 : clamp(uProgress, 0.0, 1.0);
1278
+ float lit = clamp(progress * count - index + 1.0, 0.0, 1.0);
1279
+ vec3 base = uColor;
1280
+ vec3 color = mix(base, uAccent, lit);
1281
+ float alpha = tick * mix(0.32, 1.0, lit) * max(uIntensity, 0.0);
1282
+ gl_FragColor = vec4(color * alpha, clamp(alpha, 0.0, 1.0));
1283
+ }
1284
+ `,cp={name:"tickScale",fragmentSource:nk,replacesBaseFill:!0};var ok=`
1285
+ precision highp float;
1286
+
1287
+ uniform float uTime;
1288
+ uniform float uSpeed;
1289
+ uniform float uIntensity;
1290
+ uniform vec3 uBaseColor;
1291
+ uniform vec3 uColor;
1292
+ uniform vec3 uHighlightColor;
1293
+ varying vec2 vUv;
1294
+
1295
+ float band(float distance, float width) {
1296
+ return exp(-pow(distance / width, 2.0));
1297
+ }
1298
+
1299
+ float glassDistance(vec2 p, float time) {
1300
+ float angle = atan(p.y, p.x);
1301
+ float edge = 0.72;
1302
+ edge += sin(angle * 3.0 + time * 0.52) * 0.038;
1303
+ edge += sin(angle * 5.0 - time * 0.37 + 1.6) * 0.025;
1304
+ edge += sin(angle * 9.0 + time * 0.29) * 0.008;
1305
+ return length(p) - edge;
1306
+ }
1307
+
1308
+ void main() {
1309
+ vec2 p = vUv * 2.0 - 1.0;
1310
+ p.y += 0.025;
1311
+ float time = uTime * max(uSpeed, 0.0);
1312
+ float distance = glassDistance(p, time);
1313
+ float body = 1.0 - smoothstep(-0.012, 0.01, distance);
1314
+ float halo = band(max(distance, 0.0), 0.12) * 0.24;
1315
+ float alpha = body + (1.0 - body) * halo;
1316
+ if (alpha < 0.002) discard;
1317
+
1318
+ float lowerLight = 1.0 - smoothstep(-0.6, 0.45, p.y);
1319
+ float liquid = 0.5 + 0.5 * sin(p.x * 3.5 - p.y * 2.2 + time * 0.61);
1320
+ vec3 color = mix(uBaseColor, uColor, 0.17 + lowerLight * 0.3 + liquid * 0.09);
1321
+ color += uColor * band(p.x + 0.36, 0.42) * band(p.y + 0.12, 0.5) * 0.16;
1322
+ color *= 0.55 + 0.45 * smoothstep(-0.52, 0.5, p.y + 0.2);
1323
+
1324
+ float innerFold = p.y + 0.22 + 0.19 * sin(p.x * 4.0 + time * 0.53);
1325
+ float secondFold = p.y - 0.42 + 0.11 * sin(p.x * 5.5 - time * 0.42);
1326
+ float foldLight = band(innerFold, 0.041) * smoothstep(-0.65, -0.1, p.x);
1327
+ foldLight += band(secondFold, 0.027) * smoothstep(0.05, 0.6, p.x);
1328
+ color += uHighlightColor * foldLight * 0.64;
1329
+ color += uColor * band(innerFold + 0.07, 0.065) * 0.31;
1330
+ float softReflection = band(p.x + 0.3 + 0.1 * sin(p.y * 3.5 + time * 0.35), 0.2);
1331
+ softReflection *= band(p.y - 0.38, 0.35);
1332
+ color += uHighlightColor * softReflection * 0.1;
1333
+
1334
+ float dome = sqrt(max(0.04, 1.0 - dot(p, p) / 0.62));
1335
+ vec3 surfaceNormal = normalize(vec3(p.x * 1.18, p.y * 1.18, dome));
1336
+ surfaceNormal.xy += vec2(sin(p.y * 8.0 + time * 0.31), cos(p.x * 7.0 - time * 0.27)) * 0.065;
1337
+ surfaceNormal = normalize(surfaceNormal);
1338
+ vec3 reflection = reflect(vec3(0.0, 0.0, -1.0), surfaceNormal);
1339
+ float softbox = band(reflection.x + 0.42, 0.34) * band(reflection.y - 0.43, 0.24);
1340
+ float sidebox = band(reflection.x - 0.57, 0.19) * band(reflection.y + 0.11, 0.5);
1341
+ color += uHighlightColor * softbox * 0.21;
1342
+ color += uColor * sidebox * 0.22;
1343
+
1344
+ float e = 0.008;
1345
+ vec2 normal = normalize(vec2(
1346
+ glassDistance(p + vec2(e, 0.0), time) - glassDistance(p - vec2(e, 0.0), time),
1347
+ glassDistance(p + vec2(0.0, e), time) - glassDistance(p - vec2(0.0, e), time)
1348
+ ));
1349
+ float light = pow(max(0.0, dot(normal, normalize(vec2(-0.62, 0.78)))), 2.0);
1350
+ float sideLight = pow(max(0.0, dot(normal, normalize(vec2(0.8, -0.58)))), 4.0);
1351
+ float rim = band(distance + 0.012, 0.031);
1352
+ float sharpRim = band(distance + 0.004, 0.009);
1353
+ color += uColor * rim * (0.25 + light * 0.53);
1354
+ color += uHighlightColor * sharpRim * (light * 0.78 + sideLight * 0.38);
1355
+ color += uHighlightColor * band(distance + 0.09, 0.025) * light * 0.23;
1356
+ color += uColor * band(length(p - vec2(0.27, -0.31)) - 0.26, 0.09) * 0.1;
1357
+
1358
+ vec3 premultiplied = color * body + uColor * (1.0 - body) * halo * 0.48;
1359
+ gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
1360
+ }
1361
+ `,up={name:"violetGlass",fragmentSource:ok};var ik=`
1362
+ precision highp float;
1363
+
1364
+ uniform float uTime;
1365
+ uniform float uSpeed;
1366
+ uniform float uIntensity;
1367
+ uniform vec3 uBaseColor;
1368
+ uniform vec3 uColor;
1369
+ uniform vec3 uHighlightColor;
1370
+ uniform vec3 uShadowColor;
1371
+ varying vec2 vUv;
1372
+
1373
+ float band(float distance, float width) {
1374
+ return exp(-pow(distance / width, 2.0));
1375
+ }
1376
+
1377
+ float glassDistance(vec2 p, float time) {
1378
+ float angle = atan(p.y, p.x);
1379
+ float edge = 0.69;
1380
+ edge += sin(angle * 3.0 + time * 0.48) * 0.025;
1381
+ edge += sin(angle * 5.0 - time * 0.36 + 1.7) * 0.016;
1382
+ return length(p) - edge;
1383
+ }
1384
+
1385
+ void main() {
1386
+ vec2 p = vUv * 2.0 - 1.0;
1387
+ float time = uTime * max(uSpeed, 0.0);
1388
+ float distance = glassDistance(p, time);
1389
+ float body = 1.0 - smoothstep(-0.012, 0.012, distance);
1390
+ float outside = band(max(distance, 0.0), 0.13) * 0.16;
1391
+ outside *= 1.0 - smoothstep(0.86, 1.0, length(p));
1392
+ float alpha = body * 0.94 + (1.0 - body) * outside;
1393
+ if (alpha < 0.002) discard;
1394
+
1395
+ float lowerTint = 1.0 - smoothstep(-0.54, 0.46, p.y);
1396
+ float flow = 0.5 + 0.5 * sin(p.x * 3.8 - p.y * 2.4 + time * 0.57);
1397
+ vec3 color = mix(uBaseColor, uColor, 0.08 + lowerTint * 0.19 + flow * 0.045);
1398
+ color *= 1.0 - band(p.x - 0.27, 0.31) * band(p.y + 0.25, 0.48) * 0.11;
1399
+
1400
+ float fold = p.y + 0.17 + 0.15 * sin(p.x * 4.1 + time * 0.49);
1401
+ float secondFold = p.y - 0.43 + 0.08 * sin(p.x * 5.2 - time * 0.32);
1402
+ float foldShade = band(fold + 0.045, 0.055) * smoothstep(-0.55, 0.18, p.x);
1403
+ foldShade += band(secondFold + 0.03, 0.038) * smoothstep(-0.1, 0.58, p.x);
1404
+ color = mix(color, uShadowColor, foldShade * 0.13);
1405
+ color += uHighlightColor * band(fold, 0.028) * 0.11;
1406
+ color += uHighlightColor * band(secondFold, 0.019) * 0.09;
1407
+
1408
+ float dome = sqrt(max(0.04, 1.0 - dot(p, p) / 0.57));
1409
+ vec3 normal = normalize(vec3(p.x * 1.15, p.y * 1.15, dome));
1410
+ normal.xy += vec2(sin(p.y * 7.0 + time * 0.29), cos(p.x * 6.0 - time * 0.24)) * 0.04;
1411
+ vec3 reflection = reflect(vec3(0.0, 0.0, -1.0), normalize(normal));
1412
+ float softbox = band(reflection.x + 0.45, 0.28) * band(reflection.y - 0.39, 0.22);
1413
+ color += uHighlightColor * softbox * 0.12;
1414
+
1415
+ float rim = band(distance + 0.018, 0.041);
1416
+ float thinRim = band(distance + 0.004, 0.012);
1417
+ float innerShade = band(distance + 0.094, 0.055);
1418
+ float upperLight = smoothstep(-0.34, 0.78, p.y - p.x * 0.24);
1419
+ color = mix(color, uShadowColor, innerShade * (0.08 + (1.0 - upperLight) * 0.1));
1420
+ color = mix(color, uColor, rim * (0.36 + upperLight * 0.15));
1421
+ color = mix(color, uShadowColor, thinRim * (1.0 - upperLight) * 0.29);
1422
+ color += uHighlightColor * thinRim * upperLight * 0.17;
1423
+
1424
+ vec3 premultiplied = color * body * 0.94;
1425
+ premultiplied += mix(uShadowColor, uColor, 0.36) * (1.0 - body) * outside;
1426
+ gl_FragColor = vec4(clamp(premultiplied * max(uIntensity, 0.0), 0.0, 1.0), alpha);
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=`
1429
+ attribute vec2 aPosition;
1430
+ varying vec2 vUv;
1431
+
1432
+ void main() {
1433
+ vUv = aPosition * 0.5 + 0.5;
1434
+ gl_Position = vec4(aPosition, 0.0, 1.0);
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=`
1437
+ :host { display: block; position: relative; }
1438
+ .sf-container { width: 100%; height: 100%; }
1439
+ svg { display: block; max-width: 100%; }
1440
+ .sf-error { color: #b91c1c; font: 13px/1.4 system-ui, sans-serif; padding: 8px; white-space: pre-wrap; }
1441
+ [data-sf-role="entity"], [data-sf-role="link"] { cursor: pointer; }
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);})();
1444
+ //# sourceMappingURL=stickyflow-diagram.global.js.map