agentic-mermaid 0.3.1 → 0.3.2

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 (54) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/agent-core.d.ts +2 -2
  3. package/dist/agent-core.js +2 -2
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +4 -4
  6. package/dist/agentic-mermaid-mcp.js +5 -5
  7. package/dist/am.js +6 -6
  8. package/dist/browser-lazy/chunks/{architecture-3CGEU363.js → architecture-WMSX5L4P.js} +1 -1
  9. package/dist/browser-lazy/chunks/{chunk-RVO6J7S3.js → chunk-32FWKUUV.js} +1 -1
  10. package/dist/browser-lazy/chunks/{chunk-KTTWXSIX.js → chunk-ANTNEVJC.js} +1 -1
  11. package/dist/browser-lazy/chunks/{chunk-DPSSG7LR.js → chunk-AOCFMYYH.js} +1 -1
  12. package/dist/browser-lazy/chunks/{chunk-2U4EUPSI.js → chunk-CCTZFX43.js} +1 -1
  13. package/dist/browser-lazy/chunks/{chunk-PXRUFH7U.js → chunk-EBPTM2RP.js} +1 -1
  14. package/dist/browser-lazy/chunks/{chunk-FXBBGAMJ.js → chunk-EX6TP7QM.js} +1 -1
  15. package/dist/browser-lazy/chunks/{chunk-MMWVZP6M.js → chunk-QMZ4Y6I7.js} +1 -1
  16. package/dist/browser-lazy/chunks/{chunk-4IUBLBJJ.js → chunk-QYJMRNS3.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-6UT2VTFI.js → chunk-RLS545DI.js} +1 -1
  18. package/dist/browser-lazy/chunks/{chunk-VDTSULBU.js → chunk-TBZAU7KC.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-JX5ZZY3T.js → chunk-TDGTBGV3.js} +1 -1
  20. package/dist/browser-lazy/chunks/{chunk-HZ4ADQMK.js → chunk-TEH2PRKN.js} +1 -1
  21. package/dist/browser-lazy/chunks/{chunk-CTVVJPMX.js → chunk-W6Q4PHPC.js} +1 -1
  22. package/dist/browser-lazy/chunks/{chunk-4U2TVB2S.js → chunk-WN7SFUCZ.js} +1 -1
  23. package/dist/browser-lazy/chunks/{chunk-7D24ZLOV.js → chunk-ZZECLXC3.js} +1 -1
  24. package/dist/browser-lazy/chunks/{class-B3AVLSIF.js → class-7JRALQIM.js} +1 -1
  25. package/dist/browser-lazy/chunks/{er-AF4BKKKC.js → er-UDCGHKBX.js} +1 -1
  26. package/dist/browser-lazy/chunks/{flowchart-BE6BQZLZ.js → flowchart-5FP7RRIK.js} +1 -1
  27. package/dist/browser-lazy/chunks/{gantt-U4BMMSEL.js → gantt-NTOIC5CW.js} +1 -1
  28. package/dist/browser-lazy/chunks/{gitgraph-UPSWNFRP.js → gitgraph-JYAPXUIJ.js} +1 -1
  29. package/dist/browser-lazy/chunks/{journey-PDZ7FDJR.js → journey-646EFIB6.js} +1 -1
  30. package/dist/browser-lazy/chunks/{mindmap-BFEUURLS.js → mindmap-2SBTQHQO.js} +1 -1
  31. package/dist/browser-lazy/chunks/{pie-ZFYW5JZO.js → pie-7FDXZ24K.js} +1 -1
  32. package/dist/browser-lazy/chunks/{quadrant-XJVEYYXK.js → quadrant-72UT4XAW.js} +1 -1
  33. package/dist/browser-lazy/chunks/{radar-OVXFNRNC.js → radar-SU7BO56J.js} +1 -1
  34. package/dist/browser-lazy/chunks/{render-core-R4ZGGEFS.js → render-core-Q2JWXDDL.js} +2 -2
  35. package/dist/browser-lazy/chunks/{sequence-AWY6JCSB.js → sequence-5O5ET264.js} +1 -1
  36. package/dist/browser-lazy/chunks/{state-TCE4DXKR.js → state-IWPLFQ6R.js} +1 -1
  37. package/dist/browser-lazy/chunks/{timeline-W4ZVT3FF.js → timeline-WJWYHH5Y.js} +1 -1
  38. package/dist/browser-lazy/chunks/{xychart-K3QQACKS.js → xychart-HHQVQA5O.js} +1 -1
  39. package/dist/browser-lazy/index.js +1 -1
  40. package/dist/browser.global.js +2 -2
  41. package/dist/{chunk-XVY324NY.js → chunk-3D4EHVQ4.js} +5 -3
  42. package/dist/{chunk-BSVM3VMO.js → chunk-GX7UT56Q.js} +2 -2
  43. package/dist/{chunk-JJ7JRYZV.js → chunk-IVN6KP3W.js} +2 -2
  44. package/dist/{chunk-FGO3J7RA.js → chunk-NE6JBHSE.js} +680 -42
  45. package/dist/{chunk-KQMJ37OY.js → chunk-R5U67OIW.js} +4 -4
  46. package/dist/{chunk-MBIR6S3B.js → chunk-YWKCUBQN.js} +2 -2
  47. package/dist/{index-Do8z5rPq.d.ts → index-BFg_LoZS.d.ts} +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/mcp-cli-XGZP6CMW.js +17 -0
  51. package/docs/mcp-http-transport.md +2 -0
  52. package/package.json +5 -4
  53. package/server.json +2 -2
  54. package/dist/mcp-cli-7FLGTEG3.js +0 -17
@@ -22,7 +22,7 @@ import{f as bt,g as de}from"./chunk-P7HMSKHJ.js";var xt=/<(\/)?(?:(b|strong)|(i|
22
22
  `).replace(/\\n/g,`
23
23
  `).replace(/<\/?(?:sub|sup|small|mark)\s*>/gi,"").replace(/\*\*(.+?)\*\*/g,"<b>$1</b>").replace(/(?<!\*)\*([^\s*](?:[^*]*[^\s*])?)\*(?!\*)/g,"<i>$1</i>").replace(/~~(.+?)~~/g,"<s>$1</s>")}function fa(e){return e.replace(/<\/?(?:b|strong|i|em|u|s|del)\s*>/gi,"")}function Y(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function N(e){return Y(e)}function Wt(e){if(!Ue.test(e))return Y(e);let n=Ve(e);return n.length===0?"":n.every(r=>!r.bold&&!r.italic&&!r.underline&&!r.strikethrough)?n.map(r=>Y(r.text)).join(""):n.map(r=>{let i=Y(r.text);if(!r.bold&&!r.italic&&!r.underline&&!r.strikethrough)return i;let s=[];r.bold&&s.push('font-weight="bold"'),r.italic&&s.push('font-style="italic"');let o=[];return r.underline&&o.push("underline"),r.strikethrough&&o.push("line-through"),o.length&&s.push(`text-decoration="${o.join(" ")}"`),`<tspan ${s.join(" ")}>${i}</tspan>`}).join("")}function Ni(e,n,t,r,i,s=.35){let o=e.split(`
24
24
  `);if(o.length===1){let u=r*s;return`<text x="${n}" y="${t}" ${i} dy="${u}">${Wt(e)}</text>`}let a=r*wn,c=-((o.length-1)/2)*a+r*s,d=o.map((u,f)=>`<tspan x="${n}" dy="${f===0?c:a}">${Wt(u)}</tspan>`).join("");return`<text x="${n}" y="${t}" ${i}>${d}</text>`}function pa(e,n,t,r,i,s,o,a,c){let d=r+o*2,u=i+o*2,f=`<rect x="${n-d/2}" y="${t-u/2}" width="${d}" height="${u}" ${c} />`,m=Ni(e,n,t,s,a);return`${f}
25
- ${m}`}var Gt=Object.freeze(["svg","png","ascii","unicode","html","layout"]);var Ti=1,Ri=/^[a-z][a-z0-9.-]*:[a-z0-9][a-z0-9._/-]*$/,Mi=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,vi=new Set(["required","preferred","optional"]);function qe(e){return Ri.test(e)}function $e(e){if(typeof e!="string")return;let n=e.match(Mi);if(!n)return;let t=n[4];if(!t?.split(".").some(r=>/^\d+$/.test(r)&&r.length>1&&r.startsWith("0")))return{major:n[1],minor:n[2],patch:n[3],...t?{prerelease:t}:{}}}function On(e,n){return e.length!==n.length?e.length<n.length?-1:1:e===n?0:e<n?-1:1}function Ai(e,n){return On(e.major,n.major)||On(e.minor,n.minor)||On(e.patch,n.patch)}function He(e){if(typeof e!="string")return!1;let n=e.trim();if(n==="*"||/^(0|[1-9]\d*)\.(?:x|\*)$/i.test(n))return!0;let t=n.match(/^(\^|~|>=)?(.+)$/),r=$e(t?.[2]??"");return!t||!r?!1:!r.prerelease||t[1]===void 0}function In(e,n){let t=$e(e);if(!t||!He(n))return!1;let r=n.trim();if(r==="*")return t.prerelease===void 0;let i=r.match(/^(0|[1-9]\d*)\.(?:x|\*)$/i);if(i)return t.prerelease===void 0&&t.major===i[1];let s=r.match(/^(\^|~|>=)?(.+)$/),o=$e(s?.[2]??"");if(!s||!o)return!1;let a=Ai(t,o);if(t.prerelease||o.prerelease)return s[1]===void 0&&a===0&&t.prerelease===o.prerelease;switch(s[1]){case">=":return a>=0;case"~":return a>=0&&t.major===o.major&&t.minor===o.minor;case"^":return a<0?!1:o.major!=="0"?t.major===o.major:o.minor!=="0"?t.major==="0"&&t.minor===o.minor:t.major==="0"&&t.minor==="0"&&t.patch===o.patch;default:return a===0}}function _i(e,n){if(!Array.isArray(e))throw new TypeError("Capability offers must be an array");if(!Array.isArray(n))throw new TypeError("Capability requirements must be an array");let t=new Map;for(let[o,a]of e.entries()){if(!a||typeof a!="object"||Array.isArray(a))throw new TypeError(`Capability offer at index ${o} must be an object`);if(typeof a.id!="string")throw new Error(`Invalid capability id "${String(a.id)}"`);if(!qe(a.id))throw new Error(`Invalid capability id "${a.id}"`);if(typeof a.version!="string")throw new Error(`Capability "${a.id}" has invalid semantic version "${String(a.version)}"`);if(!$e(a.version))throw new Error(`Capability "${a.id}" has invalid semantic version "${a.version}"`);if(t.has(a.id))throw new Error(`Duplicate capability offer "${a.id}"`);t.set(a.id,a.version)}let r=new Set,i=n.map((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))throw new TypeError(`Capability requirement at index ${a} must be an object`);if(typeof o.id!="string")throw new Error(`Invalid capability id "${String(o.id)}"`);if(!qe(o.id))throw new Error(`Invalid capability id "${o.id}"`);if(!vi.has(o.level))throw new Error(`Capability "${o.id}" has invalid requirement level "${String(o.level)}"`);if(!He(o.range))throw new Error(`Capability "${o.id}" has invalid semantic-version range "${String(o.range)}"`);if(r.has(o.id))throw new Error(`Duplicate capability requirement "${o.id}"`);r.add(o.id);let c=t.get(o.id),d=c===void 0?"unsupported":In(c,o.range)?"selected":"incompatible";return Object.freeze({id:o.id,range:o.range,level:o.level,status:d,...c!==void 0?{version:c}:{}})}),s=i.every(o=>o.level!=="required"||o.status==="selected");return Object.freeze({version:Ti,accepted:s,resolutions:Object.freeze(i)})}var Oi=Object.freeze([{id:"core:render-request",version:"1.0.0"},{id:"core:family-descriptor",version:"1.0.0"}].map(e=>Object.freeze(e)));function Ii(e,n,t,r){let i={id:`output:${e}`,version:"1.0.0"},s=Gt.includes(e);return _i([...Oi,...n,...!s||!r?[]:[i]],[{id:"core:render-request",range:"^1.0.0",level:"required"},...t,{id:`output:${e}`,range:"^1.0.0",level:"required"}])}function ha(e,n){return Ii(e,n.offers,n.requirements,n.outputAvailable)}var qt="2.0.0";var Ht="0.3.1";var Pi=Object.freeze({core:Ht,scene:qt});function zi(e){let n=[];for(let[t,r]of Object.entries(e.compatibility)){if(r===void 0)continue;let i=Pi[t];if(!He(r)){n.push(Object.freeze({contract:t,range:r,status:"invalid",diagnostic:`Compatibility requirement "${t}" has invalid semantic-version range "${r}".`}));continue}if(i!==void 0){let s=In(i,r);n.push(Object.freeze({contract:t,range:r,status:s?"compatible":"incompatible",version:i,...s?{}:{diagnostic:`Compatibility requirement "${t}" range "${r}" does not include host version ${i}.`}}));continue}if(!qe(t)){n.push(Object.freeze({contract:t,range:r,status:"invalid",diagnostic:`Unknown compatibility requirement "${t}" must use a namespace.`}));continue}n.push(Object.freeze({contract:t,range:r,status:"deferred"}))}return Object.freeze({accepted:n.every(t=>t.status==="compatible"||t.status==="deferred"),resolutions:Object.freeze(n)})}var Kt=/^[a-z][a-z0-9-]*$/,Xt=/^[a-z0-9][a-z0-9._/-]*$/,Yt=new WeakSet,Ke=new WeakMap;function Di(e,n){let t=Ke.get(e);if(t)throw t.reentrantAttempted=!0,new Error(`Extension registry mutation is forbidden while ${t.operation} is in progress`);let r={operation:n,reentrantAttempted:!1};return Ke.set(e,r),r}function ji(e){if(e.reentrantAttempted)throw new Error(`Extension registry mutation is forbidden after a reentrant attempt during ${e.operation}`)}function Bi(e,n){Ke.get(e)===n&&Ke.delete(e)}function Zt(e,n){if(!Kt.test(e))throw new Error(`Invalid extension kind "${e}"`);if(!Xt.test(n))throw new Error(`Invalid ${e} extension local id "${n}"`);return`${e}:${n}`}function Xe(e){let n=e.indexOf(":");if(n<=0||n===e.length-1||e.indexOf(":",n+1)!==-1)return;let t=e.slice(0,n),r=e.slice(n+1);if(!(!Kt.test(t)||!Xt.test(r)))return{kind:t,localId:r}}function Ye(e){let n=e.id,t=e.kind,r=e.version,i=e.compatibility,s=e.provenance,o=Object.freeze({...i??{}}),a=Object.freeze({...s}),c=Xe(n);if(!c||c.kind!==t)throw new Error(`Extension id "${n}" must use the "${t}:" namespace`);if(!$e(r))throw new Error(`Extension "${n}" requires a semantic version (received "${r}")`);if(a.owner.trim().length===0)throw new Error(`Extension "${n}" requires a provenance owner`);if(a.source.trim().length===0)throw new Error(`Extension "${n}" requires a provenance source`);let d=Object.freeze({id:n,kind:t,version:r,compatibility:o,provenance:a}),u=zi(d);if(!u.accepted)throw new Error(`Extension "${n}" has incompatible requirements: ${u.resolutions.filter(f=>f.status==="incompatible"||f.status==="invalid").map(f=>f.diagnostic).join("; ")}`);return Yt.add(d),d}var Pn=class extends Error{constructor(t,r){super(`Cannot register ${t.kind} "${t.id}" for owner "${t.provenance.owner}": already registered by "${r.provenance.owner}" at version ${r.version}`);this.incoming=t;this.existing=r;this.name="ExtensionCollisionError"}incoming;existing;code="EXTENSION_ID_COLLISION"};function Jt(e,n){let t=Di(e,"extension registration");try{let r=Object.freeze({identity:n.identity,value:n.value});if(!Yt.has(r.identity))throw new TypeError("Extension registration identity must be created by createExtensionIdentity()");let i=r.identity.id,s=e.get(i);if(s)throw new Pn(r.identity,s.identity);ji(t),e.set(i,r)}finally{Bi(e,t)}}var wa=Object.freeze({fontFamily:{kind:"font",description:"Safe font family/stack for roles whose descriptor exposes family-specific typography."},fontSize:{kind:"number",minimum:1,maximum:256,expected:"between 1 and 256",description:"Font size in SVG user units."},fontWeight:{kind:"number",minimum:1,maximum:1e3,expected:"between 1 and 1000",description:"CSS numeric font weight."},letterSpacing:{kind:"number",minimum:-2,maximum:4,expected:"between -2 and 4",description:"Letter spacing in SVG user units."},textTransform:{kind:"enum",values:["uppercase","lowercase","capitalize"],description:"Text transformation."},textColor:{kind:"color",description:"Text paint."},paddingX:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Horizontal role padding."},paddingY:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Vertical role padding."},cornerRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Applicable corner radius."},lineWidth:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20",description:"Border or connector width."},bendRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Applicable connector bend radius."},fillColor:{kind:"color",description:"Surface fill paint."},borderColor:{kind:"color",description:"Border paint."},strokeColor:{kind:"color",description:"Connector stroke paint."},headerFillColor:{kind:"color",description:"Group header surface paint."},cue:{kind:"enum",values:["none","outline","double-line","pattern"],description:"Non-color semantic cue on roles whose family renderer exposes a cue projection."}}),zn=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","paddingX","paddingY","cornerRadius","lineWidth","fillColor","borderColor"]),Qt=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","lineWidth","bendRadius","strokeColor"]),Li=Object.freeze([...zn,"fontFamily","headerFillColor"]),Fi=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor"]),Ui=Object.freeze(["fontFamily","fontSize","fontWeight","letterSpacing","textTransform","textColor","fillColor","borderColor","strokeColor","lineWidth","cue"]),Vi=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","cue"]),Wi=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","textColor"]),Dn=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth"]),Gi=Object.freeze(["borderColor","strokeColor","lineWidth"]),er=Object.freeze([...Dn,"cue"]);function W(e,n){return Object.freeze({properties:e,...n?{bindingFamilies:Object.freeze([...n])}:{}})}var Oe=Object.freeze({node:W(zn),edge:W(Qt),group:W(Li),"group-header":W(Ui,["journey"]),label:W(Fi),actor:W(zn,["sequence"]),relationship:W(Qt,["er"]),"pie-slice":W(Vi,["pie","radar"]),legend:W(Wi,["radar"]),bar:W(Dn,["xychart"]),series:W(Gi,["xychart"]),point:W(Dn,["radar"]),task:W(er,["gantt"]),milestone:W(er,["gantt"])}),qi=Object.freeze(Object.keys(Oe)),Hi=Object.freeze(qi.filter(e=>"bindingFamilies"in Oe[e])),Na=Object.freeze([...new Set(Hi.flatMap(e=>Oe[e].properties))]);var Z=["shape","connector","text","group","document"],pe=["shape"],Ze=["connector"],nr=["text"],Ki=["shape","text"],ee=["shape","group"],Xi=["shape","text","group"],Yi=["connector","group"],Zi=["document"],tr=["text","group"];var Ji=["shape","text","document"],Qi=["document"];function $(e,n,t,r={}){let i=Oe[e];return Object.freeze({applicableKinds:n,styleFallback:t,styleConsumption:i?"exact":"fallback-only",styleExtras:Object.freeze([]),...i?{styleProperties:i.properties}:{},styleBindingFamilies:Object.freeze([...i?.bindingFamilies??[]]),domIdentity:!1,relation:!1,sketch:"none",textHalo:!1,...r})}var Je=Object.freeze({node:$("node",ee,"node",{domIdentity:!0,sketch:"shape"}),edge:$("edge",Ze,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),"edge-label":$("edge-label",tr,"label"),group:$("group",ee,"group",{domIdentity:!0,sketch:"shape"}),"group-header":$("group-header",Z,"group",{sketch:"shape",textHalo:!0}),label:$("label",nr,"label",{textHalo:!0}),actor:$("actor",ee,"node",{domIdentity:!0,sketch:"shape"}),lifeline:$("lifeline",Ze,"edge",{sketch:"connector"}),activation:$("activation",pe,"node",{domIdentity:!0,sketch:"shape"}),message:$("message",Yi,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),block:$("block",Z,"group",{domIdentity:!0,sketch:"shape"}),note:$("note",ee,"group",{domIdentity:!0,sketch:"shape"}),"class-box":$("class-box",ee,"node",{domIdentity:!0,sketch:"shape"}),member:$("member",nr,"label",{domIdentity:!0,textHalo:!0}),entity:$("entity",ee,"node",{domIdentity:!0,sketch:"shape"}),attribute:$("attribute",tr,"label",{domIdentity:!0,textHalo:!0}),relationship:$("relationship",Ze,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),cardinality:$("cardinality",Ki,"label",{domIdentity:!0,textHalo:!0}),"pie-slice":$("pie-slice",pe,"node",{domIdentity:!0,sketch:"shape"}),legend:$("legend",Xi,"group",{textHalo:!0}),bar:$("bar",pe,"node",{domIdentity:!0,sketch:"shape"}),series:$("series",Ze,"edge",{domIdentity:!0,sketch:"connector"}),point:$("point",pe,"node",{domIdentity:!0}),axis:$("axis",Z,"label",{textHalo:!0}),grid:$("grid",Z,"edge"),plate:$("plate",pe,"node",{domIdentity:!0,sketch:"shape"}),section:$("section",Z,"group",{domIdentity:!0,sketch:"shape",textHalo:!0}),task:$("task",Z,"node",{domIdentity:!0,sketch:"shape"}),milestone:$("milestone",pe,"node",{domIdentity:!0,sketch:"shape"}),"marker-line":$("marker-line",Z,"edge"),rail:$("rail",Z,"edge",{sketch:"connector"}),period:$("period",ee,"group",{domIdentity:!0,sketch:"shape"}),event:$("event",ee,"group",{domIdentity:!0,sketch:"shape"}),score:$("score",Z,"node"),"actor-pill":$("actor-pill",pe,"node",{sketch:"shape"}),service:$("service",ee,"node",{domIdentity:!0,sketch:"shape"}),junction:$("junction",ee,"node",{domIdentity:!0}),icon:$("icon",Ji,"node"),title:$("title",Z,"label",{domIdentity:!0}),defs:$("defs",Zi,"label"),prelude:$("prelude",Qi,"label"),chrome:$("chrome",Z,"label")}),eo=Object.freeze({applicableKinds:Z,styleFallback:"label",styleConsumption:"fallback-only",styleExtras:Object.freeze([]),styleBindingFamilies:Object.freeze([]),domIdentity:!0,relation:!1,sketch:"none",textHalo:!1}),va=Object.freeze(Object.entries(Je).map(([e,n])=>Object.freeze({identity:Ye({id:`role:${e}`,kind:"role",version:"1.0.0",compatibility:{core:"^0.3.0",scene:"^2.0.0"},provenance:{owner:"agentic-mermaid",source:"built-in",reference:"src/scene/roles.ts"}}),role:e,traits:n,style:(()=>{let t=n.styleFallback;return Object.freeze({fallbackRole:t,applicableProperties:n.styleProperties??Object.freeze([])})})()})));function no(e){let n=Je[e];return n?{traits:n,source:"builtin"}:{traits:eo,source:"namespaced-safe"}}function we(e){return no(e).traits}function Ne(e){return!e.includes("->")&&!/[#:"\[\],\u0000-\u001f]/.test(e)}function Ia(e,n,t=""){let r=Ne(e)&&Ne(n)?`${e}->${n}`:`relation:${JSON.stringify([e,n])}`;return t?`${t}:${r}`:r}function Pa(e,...n){let t=n.map(String);return Ne(e)&&t.every(Ne)?[e,...t].join(":"):`part:${JSON.stringify([e,...t])}`}function za(e,n,...t){let r=t.map(String);return Ne(n)&&r.every(Ne)?[e,n,...r].join(":"):`${e}:${JSON.stringify([n,...r])}`}function to(e){return e.replace(/&quot;/g,'"').replace(/&#39;|&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function Qe(e,n){let t=e.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0]??"",r=a=>{let c=t.match(new RegExp(`\\s${a}="([^"]*)"`))?.[1];return c===void 0?void 0:to(c)},i=(r("class")??"").split(/\s+/).filter(Boolean),s=r("data-from"),o=r("data-to");return{id:r("data-id")??n.id,role:n.role,...s!==void 0?{from:s}:{},...o!==void 0?{to:o}:{},...i.length>0?{classNames:i}:{}}}function jn(e){return we(e).domIdentity}function Ie(e,n){if(!jn(n.role))return e;let t=e.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0];if(!t||t.startsWith("<style")||t.startsWith("<defs")||t.startsWith("<svg"))return e;let r=(s,o,a)=>{let c=N(a),d=new RegExp(`\\s${o}="[^"]*"`);if(d.test(s))return s.replace(d,` ${o}="${c}"`);let u=s.endsWith("/>")?"/>":">";return`${s.slice(0,-u.length).trimEnd()} ${o}="${c}"${u==="/>"?" /":""}>`},i=r(r(t,"data-id",n.id),"data-role",n.role);return n.from!==void 0&&(i=r(i,"data-from",n.from)),n.to!==void 0&&(i=r(i,"data-to",n.to)),i===t?e:e.replace(t,i)}function G(e,n,t=0){return Math.abs(e.x-n.x)<=t&&Math.abs(e.y-n.y)<=t}function Bn(e,n){let t=n.x-e.x,r=n.y-e.y,i=Math.hypot(t,r);return Number.isFinite(i)&&i>0?{x:t/i,y:r/i}:void 0}function Te(e,n){return{x:(e.x+n.x)/2,y:(e.y+n.y)/2}}function me(e,n){return Math.hypot(n.x-e.x,n.y-e.y)}function rr(e,n,t){let r=me(n,t);return r===0?me(e,n):Math.abs((t.x-n.x)*(n.y-e.y)-(n.x-e.x)*(t.y-n.y))/r}function ir(e,n,t,r,i=.5,s=12){if(!Number.isFinite(i)||i<=0)throw new TypeError("Cubic flattening tolerance must be positive and finite");if(!Number.isSafeInteger(s)||s<0)throw new TypeError("Cubic flattening maxDepth must be a non-negative safe integer");for(let c of[e,n,t,r])if(!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new TypeError("Cubic flattening points must be finite");let o=[{...e}],a=(c,d,u,f,m)=>{let p=me(c,f),g=me(c,d)+me(d,u)+me(u,f)-p;if(Math.max(rr(d,c,f),rr(u,c,f))<=i&&g<=i||m>=s){o.push({...f});return}let x=Te(c,d),v=Te(d,u),y=Te(u,f),E=Te(x,v),w=Te(v,y),j=Te(E,w);a(c,x,E,j,m+1),a(j,w,y,f,m+1)};return a(e,n,t,r,0),o}function ae(...e){let n=e[0];if(n)for(let t=1;t<e.length;t++){let r=Bn(n,e[t]);if(r)return r}}function ro(e,n){return n.kind==="line"?ae(e,n.end):n.kind==="quadratic"?ae(e,n.control,n.end):ae(e,n.control1,n.control2,n.end)}function io(e,n){return n.kind==="line"?ae(e,n.end):n.kind==="quadratic"?ae(n.control,n.end)??ae(e,n.end):ae(n.control2,n.end)??ae(n.control1,n.end)??ae(e,n.end)}function oo(e,n,t){return[{x:e.x+(n.x-e.x)*2/3,y:e.y+(n.y-e.y)*2/3},{x:t.x+(n.x-t.x)*2/3,y:t.y+(n.y-t.y)*2/3}]}function or(e,n,t,r=.5){for(let d of[n,...t.flatMap(u=>u.kind==="line"?[u.end]:u.kind==="quadratic"?[u.control,u.end]:[u.control1,u.control2,u.end])])if(!Number.isFinite(d.x)||!Number.isFinite(d.y))throw new TypeError("Connector path projection points must be finite");let i=[{...n}],s=[],o=n;for(let d of t){if(s.push(o),d.kind==="line")i.push({...d.end});else if(d.kind==="quadratic"){let[u,f]=oo(o,d.control,d.end);i.push(...ir(o,u,f,d.end,r).slice(1))}else i.push(...ir(o,d.control1,d.control2,d.end,r).slice(1));o=d.end}let a;for(let d=0;d<t.length&&!a;d++)a=ro(s[d],t[d]);let c;for(let d=t.length-1;d>=0&&!c;d--)c=io(s[d],t[d]);return{geometry:{kind:"path",d:e,points:i},contours:[{start:{...n},end:{...o},closed:!1,...a?{startTangent:a}:{},...c?{endTangent:c}:{}}]}}function Ln(e,n,t){return t==="manhattan"?Math.abs(n.x-e.x)+Math.abs(n.y-e.y):me(e,n)}function sr(e,n){if(n===void 0)return e;if(!Number.isSafeInteger(n)||n<0)throw new TypeError("Rounded connector precision must be a non-negative safe integer");let t=10**n;return Math.round(e*t)/t}function ar(e,n,t,r,i){let s=Ln(e,n,r);if(s===0)return{...e};let o=t/s;return{x:sr(e.x+(n.x-e.x)*o,i),y:sr(e.y+(n.y-e.y)*o,i)}}function ja(e,n,t={}){if(e.length===0)throw new RangeError("Rounded connector paths require at least one point");if(!Number.isFinite(n))throw new TypeError("Rounded connector radius must be finite");let r=t.metric??"euclidean",i=e[0],s=[];if(n<=0||e.length<3){for(let d=1;d<e.length;d++)s.push({kind:"line",end:e[d]});let c=`M${e.map(d=>`${d.x},${d.y}`).join(" L")}`;return or(c,i,s,t.tolerance)}let o=[`M${i.x},${i.y}`];for(let c=1;c<e.length-1;c++){let d=e[c-1],u=e[c],f=e[c+1],m=Ln(d,u,r),p=Ln(u,f,r),g=Math.min(n,m/2,p/2);if(g<=0){o.push(`L${u.x},${u.y}`),s.push({kind:"line",end:u});continue}let b=ar(u,d,g,r,t.precision),x=ar(u,f,g,r,t.precision);o.push(`L${b.x},${b.y}`),o.push(`Q${u.x},${u.y} ${x.x},${x.y}`),s.push({kind:"line",end:b}),s.push({kind:"quadratic",control:u,end:x})}let a=e.at(-1);return o.push(`L${a.x},${a.y}`),s.push({kind:"line",end:a}),or(o.join(" "),i,s,t.tolerance)}function ce(e,n=!1){return e.kind==="line"?[{points:[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],closed:!1}]:e.kind==="path"&&e.subpaths!==void 0?e.subpaths:[{points:e.points,closed:n}]}function en(e){return e.kind==="path"&&/[AaCcQqSsTt]/.test(e.d)}function nn(e,n=!1){let t=ce(e,n),r=Fn(e,n);return t.flatMap((i,s)=>{let o=i.points[0],a=i.points.at(-1);if(!o||!a)return[];let c=r.filter(f=>f.subpathIndex===s),d;for(let f=0;f<c.length&&!d;f++)d=Bn(c[f].start,c[f].end);let u;for(let f=c.length-1;f>=0&&!u;f--)u=Bn(c[f].start,c[f].end);return[{start:{...o},end:{...i.closed?o:a},closed:i.closed,...d?{startTangent:d}:{},...u?{endTangent:u}:{}}]})}function cr(e,n=!1){let t=[],r=[];return ce(e,n).forEach((i,s)=>{let o=i.points[0],a=i.closed?o:i.points.at(-1);o&&t.push({point:{...o},contourIndex:s}),a&&r.push({point:{...a},contourIndex:s})}),{starts:t,ends:r}}function tn(e,n=!1){let t=[],r=[];for(let i of ce(e,n)){let s=i.points[0],o=i.closed?s:i.points.at(-1);s&&t.push(s),o&&r.push(o)}return{starts:t,ends:r}}function Fn(e,n=!1){let t=[];for(let[r,i]of ce(e,n).entries()){for(let a=1;a<i.points.length;a++)t.push({start:i.points[a-1],end:i.points[a],subpathIndex:r,closing:!1});let s=i.points[0],o=i.points.at(-1);i.closed&&s&&o&&!G(s,o)&&t.push({start:o,end:s,subpathIndex:r,closing:!0})}return t}function rn(e,n=!1){return e.kind==="line"?[]:e.kind==="path"?e.markerMidpoints??[]:ce(e,n).flatMap(t=>{if(t.points.length<2)return[];let r=t.closed&&G(t.points[0],t.points.at(-1))?t.points.slice(0,-1):t.points;return t.closed?r.slice(1):r.slice(1,-1)})}function dr(e,n=!1){if(e.kind==="line")return[];let t=ce(e,n);return e.kind==="path"?(e.markerMidpoints??[]).map(r=>{if(t.length===1)return{point:{...r},contourIndex:0};let i=t.flatMap((s,o)=>s.points.some(a=>G(a,r))?[o]:[]);if(i.length!==1)throw new TypeError("Path marker-mid vertices on multiple subpaths must belong to exactly one typed contour");return{point:{...r},contourIndex:i[0]}}):t.flatMap((r,i)=>{if(r.points.length<2)return[];let s=r.closed&&G(r.points[0],r.points.at(-1))?r.points.slice(0,-1):r.points;return(r.closed?s.slice(1):s.slice(1,-1)).map(a=>({point:{...a},contourIndex:i}))})}function on(e){return e.match(/[Mm](?=\s*[-+.]?\d)/g)?.length??0}function Un(e){return e.replace(/&quot;/g,'"').replace(/&#39;|&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function Vn(e,n){if(!we(e.role).relation||e.from===void 0||e.to===void 0)return;let t={from:e.from,to:e.to,...n?{label:n}:{}};return{label:`${t.from} to ${t.to}${t.label?`: ${t.label}`:""}`,role:"graphics-symbol",roleDescription:"relation",relation:t}}function Wn(e,n){let r=(e.match(/^\s*<[A-Za-z][\w:-]*\b[^>]*>/)?.[0]??"").match(/\sdata-label="([^"]*)"/)?.[1];return Vn({...n,...n.from!==void 0?{from:Un(n.from)}:{},...n.to!==void 0?{to:Un(n.to)}:{}},r?Un(r):void 0)}function sn(e,n){if(!n)return e;let t=e.match(/^\s*<[A-Za-z][\w:-]*\b[^>]*>/)?.[0];if(!t)return e;let r=[];if(/\srole=/.test(t)||r.push(`role="${n.role}"`),/\saria-roledescription=/.test(t)||r.push(`aria-roledescription="${n.roleDescription}"`),/\saria-label=/.test(t)||r.push(`aria-label="${N(n.label)}"`),r.length===0)return e;let i=t.endsWith("/>")?"/>":">",s=t.slice(0,-i.length).trimEnd();return e.replace(t,`${s} ${r.join(" ")}${i==="/>"?" /":""}>`)}function Gn(e){return e?{...e,...e.geometry?{geometry:e.geometry}:{},...e.size?{size:{...e.size}}:{},...e.viewBox?{viewBox:{...e.viewBox}}:{},...e.ref?{ref:{...e.ref}}:{},...e.bounds?{bounds:{...e.bounds}}:{},...e.paint?{paint:{...e.paint}}:{}}:void 0}function so(e,n){let t=["continuous-geometry","stroke-width","stroke-cap","stroke-join"];return e.bendRadius>0&&t.push("bend-radius"),n.opacity!==void 0&&t.push("stroke-opacity"),(n.lineJoin==="miter"||n.lineJoin==="miter-clip")&&t.push("stroke-miter"),n.dash&&t.push("dash-pattern"),n.dash?.offset!==void 0&&t.push("dash-offset"),n.pathLength!==void 0&&t.push("path-length"),n.paintOrder!==void 0&&t.push("paint-order"),n.nonScaling&&t.push("non-scaling-stroke"),t}function an(e){let n=so(e.route,e.stroke),t=cr(e.geometry,e.route.closed),r=dr(e.geometry,e.route.closed),i={start:e.markers.start?t.starts.map(s=>({markerId:e.markers.start.id,point:{...s.point},contourIndex:s.contourIndex})):[],mid:e.markers.mid.length===0?[]:r.map((s,o)=>({markerId:(e.markers.mid.length===1?e.markers.mid[0]:e.markers.mid[o]).id,point:{...s.point},contourIndex:s.contourIndex})),end:e.markers.end?t.ends.map(s=>({markerId:e.markers.end.id,point:{...s.point},contourIndex:s.contourIndex})):[]};return{realization:e.lineStyle==="invisible"?"unsupported":"projected",topology:e.geometry.kind,geometry:e.geometry,direction:e.relationship.direction,relationship:e.relationship.kind,markers:{...e.markers.start?{start:Gn(e.markers.start)}:{},mid:e.markers.mid.map(s=>Gn(s)),...e.markers.end?{end:Gn(e.markers.end)}:{}},markerPlacements:i,endpoints:{...e.endpoints,...e.endpoints.start?{start:{...e.endpoints.start,...e.endpoints.start.point?{point:{...e.endpoints.start.point}}:{}}}:{},...e.endpoints.end?{end:{...e.endpoints.end,...e.endpoints.end.point?{point:{...e.endpoints.end.point}}:{}}}:{}},route:{ownership:e.route.ownership,closed:e.route.closed,bendRadius:e.route.bendRadius,contours:e.route.contours.map(s=>({...s,start:{...s.start},end:{...s.end},...s.startTangent?{startTangent:{...s.startTangent}}:{},...s.endTangent?{endTangent:{...s.endTangent}}:{}})),...e.route.startTangent?{startTangent:{...e.route.startTangent}}:{},...e.route.endTangent?{endTangent:{...e.route.endTangent}}:{},labelAnchors:e.route.labelAnchors.map(s=>({...s}))},stroke:{...e.stroke,...e.stroke.dash?{dash:{...e.stroke.dash,array:Array.isArray(e.stroke.dash.array)?[...e.stroke.dash.array]:e.stroke.dash.array}}:{}},hit:{...e.hit,geometry:e.hit.geometry},...e.transform?{transform:{...e.transform}}:{},labels:e.labels.map(s=>({...s,...s.anchor?{anchor:{...s.anchor}}:{},...s.bounds?{bounds:{...s.bounds}}:{},...s.halo?{halo:{...s.halo}}:{},...s.paint?{paint:{...s.paint}}:{},...s.visual?{visual:{...s.visual}}:{}})),lineStyle:e.lineStyle,strokeLosses:n,diagnostics:[e.lineStyle==="invisible"?"This connector affects layout but is intentionally absent from terminal output.":`The terminal grid preserves connector semantics while projecting continuous stroke fields: ${n.join(", ")}.`,...e.additionalDiagnostics??[]]}}var cn=new WeakMap;function ao(e){let n=e.match(/^<([A-Za-z_][A-Za-z0-9_.:-]*)/);if(!n||e.startsWith("</")||e.startsWith("<!")||e.startsWith("<?"))return e;let t=n[1];if(t!=="svg")return e;let r=/\/\s*>$/.test(e),i=r?e.lastIndexOf("/"):e.length-1,s=[],o=n[0].length;for(;o<i;){for(;/\s/.test(e[o]??"");)o++;if(o>=i)break;let d=e.slice(o).match(/^([^\s=<>/]+)/);if(!d)return e;let u=d[1];for(o+=d[0].length;/\s/.test(e[o]??"");)o++;if(e[o]!=="=")return e;for(o++;/\s/.test(e[o]??"");)o++;let f=e[o];if(f!=='"'&&f!=="'")return e;o++;let m=o;for(;o<i&&e[o]!==f;)o++;if(e[o]!==f)return e;let p=e.slice(m,o);o++,s.push({name:u,value:f==='"'?p:p.replaceAll('"',"&quot;"),index:s.length})}let a=new Map([["xmlns",0],["width",1],["height",2],["viewBox",3],["style",4]]);s.sort((d,u)=>{let f=a.get(d.name)??100,m=a.get(u.name)??100;return f-m||bt(d.name,u.name)||d.index-u.index});let c=s.map(d=>`${d.name}="${d.value}"`).join(" ");return`<${t}${c?` ${c}`:""}${r?" /":""}>`}function ue(e){let n="",t=0;for(;t<e.length;){let r=e.indexOf("<",t);if(r<0)return n+e.slice(t);if(n+=e.slice(t,r),e.startsWith("<!--",r)){let o=e.indexOf("-->",r+4);if(o<0)return n+e.slice(r);n+=e.slice(r,o+3),t=o+3;continue}let i,s=r+1;for(;s<e.length;s++){let o=e[s];if(i)o===i&&(i=void 0);else if(o==='"'||o==="'")i=o;else if(o===">")break}if(s>=e.length)return n+e.slice(r);n+=ao(e.slice(r,s+1)),t=s+1}return n}function ne(e,n){return cn.set(e,ue(n)),e}function R(e){let n=cn.get(e);if(n===void 0)throw new TypeError(`Scene node "${e.id}" has no admitted SVG serialization`);return n}function qn(e,n){let t=cn.get(e);t!==void 0&&cn.set(n,t)}function Pe(e,n){let t=Qe(n,e),r=Wn(n,t),i=sn(Ie(n,t),r);return ne({kind:"shape",identity:t,accessibility:r,...e},i)}function co(e,n){if(e.kind==="line")return{start:{point:{x:e.x1,y:e.y1}},end:{point:{x:e.x2,y:e.y2}}};let t=ce(e,n),r=t[0]?.points[0],i=t.at(-1),s=i?.closed?i.points[0]:i?.points.at(-1);return{...r?{start:{point:{...r}}}:{},...s?{end:{point:{...s}}}:{}}}function lo(e){let n=typeof e=="number"?e:parseFloat(e);return Number.isFinite(n)?Math.max(0,n):1}function uo(e,n,t){return e.from!==void 0&&e.from===e.to?"self":n&&t?"bidirectional":n?"reverse":t?"forward":"undirected"}function fo(e,n,t,r){if(r.length===0)return;let i=rn(n,t).length;if(i===0)throw new RangeError(`Connector "${e}" has mid markers but no typed interior route points`);if(r.length!==1&&r.length!==i)throw new RangeError(`Connector "${e}" mid markers must contain one repeated descriptor or one descriptor per interior route point`);if(new Set(r.map(o=>o.id)).size!==1)throw new RangeError(`Connector "${e}" uses distinct mid markers that one SVG marker-mid carrier cannot represent`);return r[0].id}function po(e,n){if(e==="")return e;let t=e;for(let[r,i]of Object.entries(n)){if(!i)continue;let s=`marker-${r}`,o=t.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0];!o||new RegExp(`\\s${s}=`).test(o)||(t=t.replace(o,o.replace(/\s*\/?>$/,a=>` ${s}="url(#${N(i)})"${a}`)))}return t}function mo(e,n){if(e===""||!n)return e;let t=e.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0];if(!t||/\stransform=/.test(t))return e;let r=`rotate(${n.angle} ${n.cx} ${n.cy})`;return e.replace(t,t.replace(/\s*\/?>$/,i=>` transform="${r}"${i}`))}function yo(e,n){if(e==="")return e;let t=e.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0];if(!t)return e;let r=t;for(let[i,s]of[["data-relationship",n.kind],["data-direction",n.direction]])new RegExp(`\\s${i}=`).test(r)||(r=r.replace(/\s*\/?>$/,o=>` ${i}="${N(s)}"${o}`));return e.replace(t,r)}function go(e,n,t,r){if(n.visual?.kind!=="inline")return;if(!n.anchor||!n.paint||n.fontSize===void 0||n.textAnchor===void 0)throw new TypeError(`Connector "${e}" inline label ${t+1} requires anchor, paint, fontSize, and textAnchor`);let i=[`data-id="${N(n.id??`${e}-label-${t+1}`)}"`,'data-role="label"',`data-connector-label-for="${N(e)}"`,`x="${n.anchor.x}"`,`y="${n.anchor.y-Math.max(0,n.clearance??0)}"`,`font-size="${n.fontSize}"`,`text-anchor="${n.textAnchor}"`];r?.kind==="rotate"&&i.push(`transform="rotate(${r.angle} ${r.cx} ${r.cy})"`);let s={...n.paint,...n.halo?{stroke:n.halo.color??"var(--bg)",strokeWidth:String(n.halo.width),paintOrder:"stroke fill"}:{}},o=[["fill",s.fill],["stroke",s.stroke],["stroke-width",s.strokeWidth],["stroke-dasharray",s.strokeDasharray],["stroke-dashoffset",s.strokeDashoffset],["stroke-linecap",s.strokeLinecap],["stroke-linejoin",s.strokeLinejoin],["stroke-miterlimit",s.strokeMiterlimit],["vector-effect",s.vectorEffect],["paint-order",s.paintOrder],["opacity",s.opacity]];for(let[a,c]of o)c!==void 0&&i.push(`${a}="${N(c)}"`);return`<text ${i.join(" ")}>${Y(n.text)}</text>`}function ye(e,n){if(e.geometry.kind!=="path"&&e.route?.closed===!0)throw new TypeError(`Connector "${e.id}" closed route topology requires path geometry`);if(e.geometry.kind==="path"){let S=e.geometry,O=S.subpaths,D=on(S.d);if(D>1&&!O)throw new TypeError(`Connector "${e.id}" path has multiple SVG subpaths but no typed subpaths`);if(O){if(O.length===0||O.some(X=>X.points.length<2))throw new TypeError(`Connector "${e.id}" typed subpaths must each contain at least two points`);if(D!==O.length)throw new TypeError(`Connector "${e.id}" typed subpath count disagrees with SVG path moves`);let oe=O.flatMap(X=>X.points);if(oe.length!==S.points.length||oe.some((X,Fe)=>{let Cn=S.points[Fe];return!Cn||Cn.x!==X.x||Cn.y!==X.y}))throw new TypeError(`Connector "${e.id}" typed subpaths disagree with the canonical point projection`)}}let t=ce(e.geometry,e.route?.closed??!1),r=t.length===1&&t[0].closed;if(e.geometry.kind==="path"&&e.geometry.subpaths&&e.route?.closed!==void 0&&e.route.closed!==r)throw new TypeError(`Connector "${e.id}" route.closed disagrees with typed subpath topology`);let i=e.geometry.kind==="path"&&e.geometry.subpaths?r:e.route?.closed??!1;if(e.geometry.kind==="path"){let S=e.geometry.d.match(/[Zz]/g)?.length??0,O=e.geometry.subpaths?e.geometry.subpaths.filter(D=>D.closed).length:i?1:0;if(S!==O)throw new TypeError(`Connector "${e.id}" SVG close commands disagree with typed closed-contour semantics`)}let s=e.markers?.start,o=e.markers?.end,a=e.markers?.mid??[];for(let S of[s,...a,o])if(S?.geometry?.kind==="path"&&!S.bounds&&!S.viewBox&&!S.size)throw new TypeError(`Connector "${e.id}" path marker "${S.id}" requires bounds, viewBox, or size`);let c=fo(e.id,e.geometry,i,a),d=co(e.geometry,i);for(let S of["start","end"]){let O=e.endpoints?.[S]?.point,D=d[S]?.point;if(O&&D&&!G(O,D))throw new TypeError(`Connector "${e.id}" endpoints.${S}.point disagrees with typed route geometry`)}let u={...e.endpoints??{},start:{...d.start,...e.endpoints?.start},end:{...d.end,...e.endpoints?.end}},f={kind:e.relationship?.kind??e.role,direction:e.relationship?.direction??uo(u,s,o)},m=e.labels??[],p={id:e.identity?.id??e.id,role:e.role,...e.identity?.classNames?{classNames:e.identity.classNames}:{},...e.identity?.from??u.from?{from:e.identity?.from??u.from}:{},...e.identity?.to??u.to?{to:e.identity?.to??u.to}:{}},g=Vn(p,m[0]?.text),b=po(n,{...s?{start:s.id}:{},...c?{mid:c}:{},...o?{end:o.id}:{}}),x=yo(b,f),v=mo(x,e.transform),y=sn(Ie(v,p),g),E=m.map((S,O)=>go(e.id,S,O,e.transform)).filter(S=>S!==void 0);E.length>0&&(y=[y,...E].join(`
25
+ ${m}`}var Gt=Object.freeze(["svg","png","ascii","unicode","html","layout"]);var Ti=1,Ri=/^[a-z][a-z0-9.-]*:[a-z0-9][a-z0-9._/-]*$/,Mi=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,vi=new Set(["required","preferred","optional"]);function qe(e){return Ri.test(e)}function $e(e){if(typeof e!="string")return;let n=e.match(Mi);if(!n)return;let t=n[4];if(!t?.split(".").some(r=>/^\d+$/.test(r)&&r.length>1&&r.startsWith("0")))return{major:n[1],minor:n[2],patch:n[3],...t?{prerelease:t}:{}}}function On(e,n){return e.length!==n.length?e.length<n.length?-1:1:e===n?0:e<n?-1:1}function Ai(e,n){return On(e.major,n.major)||On(e.minor,n.minor)||On(e.patch,n.patch)}function He(e){if(typeof e!="string")return!1;let n=e.trim();if(n==="*"||/^(0|[1-9]\d*)\.(?:x|\*)$/i.test(n))return!0;let t=n.match(/^(\^|~|>=)?(.+)$/),r=$e(t?.[2]??"");return!t||!r?!1:!r.prerelease||t[1]===void 0}function In(e,n){let t=$e(e);if(!t||!He(n))return!1;let r=n.trim();if(r==="*")return t.prerelease===void 0;let i=r.match(/^(0|[1-9]\d*)\.(?:x|\*)$/i);if(i)return t.prerelease===void 0&&t.major===i[1];let s=r.match(/^(\^|~|>=)?(.+)$/),o=$e(s?.[2]??"");if(!s||!o)return!1;let a=Ai(t,o);if(t.prerelease||o.prerelease)return s[1]===void 0&&a===0&&t.prerelease===o.prerelease;switch(s[1]){case">=":return a>=0;case"~":return a>=0&&t.major===o.major&&t.minor===o.minor;case"^":return a<0?!1:o.major!=="0"?t.major===o.major:o.minor!=="0"?t.major==="0"&&t.minor===o.minor:t.major==="0"&&t.minor==="0"&&t.patch===o.patch;default:return a===0}}function _i(e,n){if(!Array.isArray(e))throw new TypeError("Capability offers must be an array");if(!Array.isArray(n))throw new TypeError("Capability requirements must be an array");let t=new Map;for(let[o,a]of e.entries()){if(!a||typeof a!="object"||Array.isArray(a))throw new TypeError(`Capability offer at index ${o} must be an object`);if(typeof a.id!="string")throw new Error(`Invalid capability id "${String(a.id)}"`);if(!qe(a.id))throw new Error(`Invalid capability id "${a.id}"`);if(typeof a.version!="string")throw new Error(`Capability "${a.id}" has invalid semantic version "${String(a.version)}"`);if(!$e(a.version))throw new Error(`Capability "${a.id}" has invalid semantic version "${a.version}"`);if(t.has(a.id))throw new Error(`Duplicate capability offer "${a.id}"`);t.set(a.id,a.version)}let r=new Set,i=n.map((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))throw new TypeError(`Capability requirement at index ${a} must be an object`);if(typeof o.id!="string")throw new Error(`Invalid capability id "${String(o.id)}"`);if(!qe(o.id))throw new Error(`Invalid capability id "${o.id}"`);if(!vi.has(o.level))throw new Error(`Capability "${o.id}" has invalid requirement level "${String(o.level)}"`);if(!He(o.range))throw new Error(`Capability "${o.id}" has invalid semantic-version range "${String(o.range)}"`);if(r.has(o.id))throw new Error(`Duplicate capability requirement "${o.id}"`);r.add(o.id);let c=t.get(o.id),d=c===void 0?"unsupported":In(c,o.range)?"selected":"incompatible";return Object.freeze({id:o.id,range:o.range,level:o.level,status:d,...c!==void 0?{version:c}:{}})}),s=i.every(o=>o.level!=="required"||o.status==="selected");return Object.freeze({version:Ti,accepted:s,resolutions:Object.freeze(i)})}var Oi=Object.freeze([{id:"core:render-request",version:"1.0.0"},{id:"core:family-descriptor",version:"1.0.0"}].map(e=>Object.freeze(e)));function Ii(e,n,t,r){let i={id:`output:${e}`,version:"1.0.0"},s=Gt.includes(e);return _i([...Oi,...n,...!s||!r?[]:[i]],[{id:"core:render-request",range:"^1.0.0",level:"required"},...t,{id:`output:${e}`,range:"^1.0.0",level:"required"}])}function ha(e,n){return Ii(e,n.offers,n.requirements,n.outputAvailable)}var qt="2.0.0";var Ht="0.3.2";var Pi=Object.freeze({core:Ht,scene:qt});function zi(e){let n=[];for(let[t,r]of Object.entries(e.compatibility)){if(r===void 0)continue;let i=Pi[t];if(!He(r)){n.push(Object.freeze({contract:t,range:r,status:"invalid",diagnostic:`Compatibility requirement "${t}" has invalid semantic-version range "${r}".`}));continue}if(i!==void 0){let s=In(i,r);n.push(Object.freeze({contract:t,range:r,status:s?"compatible":"incompatible",version:i,...s?{}:{diagnostic:`Compatibility requirement "${t}" range "${r}" does not include host version ${i}.`}}));continue}if(!qe(t)){n.push(Object.freeze({contract:t,range:r,status:"invalid",diagnostic:`Unknown compatibility requirement "${t}" must use a namespace.`}));continue}n.push(Object.freeze({contract:t,range:r,status:"deferred"}))}return Object.freeze({accepted:n.every(t=>t.status==="compatible"||t.status==="deferred"),resolutions:Object.freeze(n)})}var Kt=/^[a-z][a-z0-9-]*$/,Xt=/^[a-z0-9][a-z0-9._/-]*$/,Yt=new WeakSet,Ke=new WeakMap;function Di(e,n){let t=Ke.get(e);if(t)throw t.reentrantAttempted=!0,new Error(`Extension registry mutation is forbidden while ${t.operation} is in progress`);let r={operation:n,reentrantAttempted:!1};return Ke.set(e,r),r}function ji(e){if(e.reentrantAttempted)throw new Error(`Extension registry mutation is forbidden after a reentrant attempt during ${e.operation}`)}function Bi(e,n){Ke.get(e)===n&&Ke.delete(e)}function Zt(e,n){if(!Kt.test(e))throw new Error(`Invalid extension kind "${e}"`);if(!Xt.test(n))throw new Error(`Invalid ${e} extension local id "${n}"`);return`${e}:${n}`}function Xe(e){let n=e.indexOf(":");if(n<=0||n===e.length-1||e.indexOf(":",n+1)!==-1)return;let t=e.slice(0,n),r=e.slice(n+1);if(!(!Kt.test(t)||!Xt.test(r)))return{kind:t,localId:r}}function Ye(e){let n=e.id,t=e.kind,r=e.version,i=e.compatibility,s=e.provenance,o=Object.freeze({...i??{}}),a=Object.freeze({...s}),c=Xe(n);if(!c||c.kind!==t)throw new Error(`Extension id "${n}" must use the "${t}:" namespace`);if(!$e(r))throw new Error(`Extension "${n}" requires a semantic version (received "${r}")`);if(a.owner.trim().length===0)throw new Error(`Extension "${n}" requires a provenance owner`);if(a.source.trim().length===0)throw new Error(`Extension "${n}" requires a provenance source`);let d=Object.freeze({id:n,kind:t,version:r,compatibility:o,provenance:a}),u=zi(d);if(!u.accepted)throw new Error(`Extension "${n}" has incompatible requirements: ${u.resolutions.filter(f=>f.status==="incompatible"||f.status==="invalid").map(f=>f.diagnostic).join("; ")}`);return Yt.add(d),d}var Pn=class extends Error{constructor(t,r){super(`Cannot register ${t.kind} "${t.id}" for owner "${t.provenance.owner}": already registered by "${r.provenance.owner}" at version ${r.version}`);this.incoming=t;this.existing=r;this.name="ExtensionCollisionError"}incoming;existing;code="EXTENSION_ID_COLLISION"};function Jt(e,n){let t=Di(e,"extension registration");try{let r=Object.freeze({identity:n.identity,value:n.value});if(!Yt.has(r.identity))throw new TypeError("Extension registration identity must be created by createExtensionIdentity()");let i=r.identity.id,s=e.get(i);if(s)throw new Pn(r.identity,s.identity);ji(t),e.set(i,r)}finally{Bi(e,t)}}var wa=Object.freeze({fontFamily:{kind:"font",description:"Safe font family/stack for roles whose descriptor exposes family-specific typography."},fontSize:{kind:"number",minimum:1,maximum:256,expected:"between 1 and 256",description:"Font size in SVG user units."},fontWeight:{kind:"number",minimum:1,maximum:1e3,expected:"between 1 and 1000",description:"CSS numeric font weight."},letterSpacing:{kind:"number",minimum:-2,maximum:4,expected:"between -2 and 4",description:"Letter spacing in SVG user units."},textTransform:{kind:"enum",values:["uppercase","lowercase","capitalize"],description:"Text transformation."},textColor:{kind:"color",description:"Text paint."},paddingX:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Horizontal role padding."},paddingY:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Vertical role padding."},cornerRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Applicable corner radius."},lineWidth:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20",description:"Border or connector width."},bendRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256",description:"Applicable connector bend radius."},fillColor:{kind:"color",description:"Surface fill paint."},borderColor:{kind:"color",description:"Border paint."},strokeColor:{kind:"color",description:"Connector stroke paint."},headerFillColor:{kind:"color",description:"Group header surface paint."},cue:{kind:"enum",values:["none","outline","double-line","pattern"],description:"Non-color semantic cue on roles whose family renderer exposes a cue projection."}}),zn=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","paddingX","paddingY","cornerRadius","lineWidth","fillColor","borderColor"]),Qt=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","lineWidth","bendRadius","strokeColor"]),Li=Object.freeze([...zn,"fontFamily","headerFillColor"]),Fi=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor"]),Ui=Object.freeze(["fontFamily","fontSize","fontWeight","letterSpacing","textTransform","textColor","fillColor","borderColor","strokeColor","lineWidth","cue"]),Vi=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","cue"]),Wi=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","textColor"]),Dn=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth"]),Gi=Object.freeze(["borderColor","strokeColor","lineWidth"]),er=Object.freeze([...Dn,"cue"]);function W(e,n){return Object.freeze({properties:e,...n?{bindingFamilies:Object.freeze([...n])}:{}})}var Oe=Object.freeze({node:W(zn),edge:W(Qt),group:W(Li),"group-header":W(Ui,["journey"]),label:W(Fi),actor:W(zn,["sequence"]),relationship:W(Qt,["er"]),"pie-slice":W(Vi,["pie","radar"]),legend:W(Wi,["radar"]),bar:W(Dn,["xychart"]),series:W(Gi,["xychart"]),point:W(Dn,["radar"]),task:W(er,["gantt"]),milestone:W(er,["gantt"])}),qi=Object.freeze(Object.keys(Oe)),Hi=Object.freeze(qi.filter(e=>"bindingFamilies"in Oe[e])),Na=Object.freeze([...new Set(Hi.flatMap(e=>Oe[e].properties))]);var Z=["shape","connector","text","group","document"],pe=["shape"],Ze=["connector"],nr=["text"],Ki=["shape","text"],ee=["shape","group"],Xi=["shape","text","group"],Yi=["connector","group"],Zi=["document"],tr=["text","group"];var Ji=["shape","text","document"],Qi=["document"];function $(e,n,t,r={}){let i=Oe[e];return Object.freeze({applicableKinds:n,styleFallback:t,styleConsumption:i?"exact":"fallback-only",styleExtras:Object.freeze([]),...i?{styleProperties:i.properties}:{},styleBindingFamilies:Object.freeze([...i?.bindingFamilies??[]]),domIdentity:!1,relation:!1,sketch:"none",textHalo:!1,...r})}var Je=Object.freeze({node:$("node",ee,"node",{domIdentity:!0,sketch:"shape"}),edge:$("edge",Ze,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),"edge-label":$("edge-label",tr,"label"),group:$("group",ee,"group",{domIdentity:!0,sketch:"shape"}),"group-header":$("group-header",Z,"group",{sketch:"shape",textHalo:!0}),label:$("label",nr,"label",{textHalo:!0}),actor:$("actor",ee,"node",{domIdentity:!0,sketch:"shape"}),lifeline:$("lifeline",Ze,"edge",{sketch:"connector"}),activation:$("activation",pe,"node",{domIdentity:!0,sketch:"shape"}),message:$("message",Yi,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),block:$("block",Z,"group",{domIdentity:!0,sketch:"shape"}),note:$("note",ee,"group",{domIdentity:!0,sketch:"shape"}),"class-box":$("class-box",ee,"node",{domIdentity:!0,sketch:"shape"}),member:$("member",nr,"label",{domIdentity:!0,textHalo:!0}),entity:$("entity",ee,"node",{domIdentity:!0,sketch:"shape"}),attribute:$("attribute",tr,"label",{domIdentity:!0,textHalo:!0}),relationship:$("relationship",Ze,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),cardinality:$("cardinality",Ki,"label",{domIdentity:!0,textHalo:!0}),"pie-slice":$("pie-slice",pe,"node",{domIdentity:!0,sketch:"shape"}),legend:$("legend",Xi,"group",{textHalo:!0}),bar:$("bar",pe,"node",{domIdentity:!0,sketch:"shape"}),series:$("series",Ze,"edge",{domIdentity:!0,sketch:"connector"}),point:$("point",pe,"node",{domIdentity:!0}),axis:$("axis",Z,"label",{textHalo:!0}),grid:$("grid",Z,"edge"),plate:$("plate",pe,"node",{domIdentity:!0,sketch:"shape"}),section:$("section",Z,"group",{domIdentity:!0,sketch:"shape",textHalo:!0}),task:$("task",Z,"node",{domIdentity:!0,sketch:"shape"}),milestone:$("milestone",pe,"node",{domIdentity:!0,sketch:"shape"}),"marker-line":$("marker-line",Z,"edge"),rail:$("rail",Z,"edge",{sketch:"connector"}),period:$("period",ee,"group",{domIdentity:!0,sketch:"shape"}),event:$("event",ee,"group",{domIdentity:!0,sketch:"shape"}),score:$("score",Z,"node"),"actor-pill":$("actor-pill",pe,"node",{sketch:"shape"}),service:$("service",ee,"node",{domIdentity:!0,sketch:"shape"}),junction:$("junction",ee,"node",{domIdentity:!0}),icon:$("icon",Ji,"node"),title:$("title",Z,"label",{domIdentity:!0}),defs:$("defs",Zi,"label"),prelude:$("prelude",Qi,"label"),chrome:$("chrome",Z,"label")}),eo=Object.freeze({applicableKinds:Z,styleFallback:"label",styleConsumption:"fallback-only",styleExtras:Object.freeze([]),styleBindingFamilies:Object.freeze([]),domIdentity:!0,relation:!1,sketch:"none",textHalo:!1}),va=Object.freeze(Object.entries(Je).map(([e,n])=>Object.freeze({identity:Ye({id:`role:${e}`,kind:"role",version:"1.0.0",compatibility:{core:"^0.3.0",scene:"^2.0.0"},provenance:{owner:"agentic-mermaid",source:"built-in",reference:"src/scene/roles.ts"}}),role:e,traits:n,style:(()=>{let t=n.styleFallback;return Object.freeze({fallbackRole:t,applicableProperties:n.styleProperties??Object.freeze([])})})()})));function no(e){let n=Je[e];return n?{traits:n,source:"builtin"}:{traits:eo,source:"namespaced-safe"}}function we(e){return no(e).traits}function Ne(e){return!e.includes("->")&&!/[#:"\[\],\u0000-\u001f]/.test(e)}function Ia(e,n,t=""){let r=Ne(e)&&Ne(n)?`${e}->${n}`:`relation:${JSON.stringify([e,n])}`;return t?`${t}:${r}`:r}function Pa(e,...n){let t=n.map(String);return Ne(e)&&t.every(Ne)?[e,...t].join(":"):`part:${JSON.stringify([e,...t])}`}function za(e,n,...t){let r=t.map(String);return Ne(n)&&r.every(Ne)?[e,n,...r].join(":"):`${e}:${JSON.stringify([n,...r])}`}function to(e){return e.replace(/&quot;/g,'"').replace(/&#39;|&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function Qe(e,n){let t=e.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0]??"",r=a=>{let c=t.match(new RegExp(`\\s${a}="([^"]*)"`))?.[1];return c===void 0?void 0:to(c)},i=(r("class")??"").split(/\s+/).filter(Boolean),s=r("data-from"),o=r("data-to");return{id:r("data-id")??n.id,role:n.role,...s!==void 0?{from:s}:{},...o!==void 0?{to:o}:{},...i.length>0?{classNames:i}:{}}}function jn(e){return we(e).domIdentity}function Ie(e,n){if(!jn(n.role))return e;let t=e.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0];if(!t||t.startsWith("<style")||t.startsWith("<defs")||t.startsWith("<svg"))return e;let r=(s,o,a)=>{let c=N(a),d=new RegExp(`\\s${o}="[^"]*"`);if(d.test(s))return s.replace(d,` ${o}="${c}"`);let u=s.endsWith("/>")?"/>":">";return`${s.slice(0,-u.length).trimEnd()} ${o}="${c}"${u==="/>"?" /":""}>`},i=r(r(t,"data-id",n.id),"data-role",n.role);return n.from!==void 0&&(i=r(i,"data-from",n.from)),n.to!==void 0&&(i=r(i,"data-to",n.to)),i===t?e:e.replace(t,i)}function G(e,n,t=0){return Math.abs(e.x-n.x)<=t&&Math.abs(e.y-n.y)<=t}function Bn(e,n){let t=n.x-e.x,r=n.y-e.y,i=Math.hypot(t,r);return Number.isFinite(i)&&i>0?{x:t/i,y:r/i}:void 0}function Te(e,n){return{x:(e.x+n.x)/2,y:(e.y+n.y)/2}}function me(e,n){return Math.hypot(n.x-e.x,n.y-e.y)}function rr(e,n,t){let r=me(n,t);return r===0?me(e,n):Math.abs((t.x-n.x)*(n.y-e.y)-(n.x-e.x)*(t.y-n.y))/r}function ir(e,n,t,r,i=.5,s=12){if(!Number.isFinite(i)||i<=0)throw new TypeError("Cubic flattening tolerance must be positive and finite");if(!Number.isSafeInteger(s)||s<0)throw new TypeError("Cubic flattening maxDepth must be a non-negative safe integer");for(let c of[e,n,t,r])if(!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new TypeError("Cubic flattening points must be finite");let o=[{...e}],a=(c,d,u,f,m)=>{let p=me(c,f),g=me(c,d)+me(d,u)+me(u,f)-p;if(Math.max(rr(d,c,f),rr(u,c,f))<=i&&g<=i||m>=s){o.push({...f});return}let x=Te(c,d),v=Te(d,u),y=Te(u,f),E=Te(x,v),w=Te(v,y),j=Te(E,w);a(c,x,E,j,m+1),a(j,w,y,f,m+1)};return a(e,n,t,r,0),o}function ae(...e){let n=e[0];if(n)for(let t=1;t<e.length;t++){let r=Bn(n,e[t]);if(r)return r}}function ro(e,n){return n.kind==="line"?ae(e,n.end):n.kind==="quadratic"?ae(e,n.control,n.end):ae(e,n.control1,n.control2,n.end)}function io(e,n){return n.kind==="line"?ae(e,n.end):n.kind==="quadratic"?ae(n.control,n.end)??ae(e,n.end):ae(n.control2,n.end)??ae(n.control1,n.end)??ae(e,n.end)}function oo(e,n,t){return[{x:e.x+(n.x-e.x)*2/3,y:e.y+(n.y-e.y)*2/3},{x:t.x+(n.x-t.x)*2/3,y:t.y+(n.y-t.y)*2/3}]}function or(e,n,t,r=.5){for(let d of[n,...t.flatMap(u=>u.kind==="line"?[u.end]:u.kind==="quadratic"?[u.control,u.end]:[u.control1,u.control2,u.end])])if(!Number.isFinite(d.x)||!Number.isFinite(d.y))throw new TypeError("Connector path projection points must be finite");let i=[{...n}],s=[],o=n;for(let d of t){if(s.push(o),d.kind==="line")i.push({...d.end});else if(d.kind==="quadratic"){let[u,f]=oo(o,d.control,d.end);i.push(...ir(o,u,f,d.end,r).slice(1))}else i.push(...ir(o,d.control1,d.control2,d.end,r).slice(1));o=d.end}let a;for(let d=0;d<t.length&&!a;d++)a=ro(s[d],t[d]);let c;for(let d=t.length-1;d>=0&&!c;d--)c=io(s[d],t[d]);return{geometry:{kind:"path",d:e,points:i},contours:[{start:{...n},end:{...o},closed:!1,...a?{startTangent:a}:{},...c?{endTangent:c}:{}}]}}function Ln(e,n,t){return t==="manhattan"?Math.abs(n.x-e.x)+Math.abs(n.y-e.y):me(e,n)}function sr(e,n){if(n===void 0)return e;if(!Number.isSafeInteger(n)||n<0)throw new TypeError("Rounded connector precision must be a non-negative safe integer");let t=10**n;return Math.round(e*t)/t}function ar(e,n,t,r,i){let s=Ln(e,n,r);if(s===0)return{...e};let o=t/s;return{x:sr(e.x+(n.x-e.x)*o,i),y:sr(e.y+(n.y-e.y)*o,i)}}function ja(e,n,t={}){if(e.length===0)throw new RangeError("Rounded connector paths require at least one point");if(!Number.isFinite(n))throw new TypeError("Rounded connector radius must be finite");let r=t.metric??"euclidean",i=e[0],s=[];if(n<=0||e.length<3){for(let d=1;d<e.length;d++)s.push({kind:"line",end:e[d]});let c=`M${e.map(d=>`${d.x},${d.y}`).join(" L")}`;return or(c,i,s,t.tolerance)}let o=[`M${i.x},${i.y}`];for(let c=1;c<e.length-1;c++){let d=e[c-1],u=e[c],f=e[c+1],m=Ln(d,u,r),p=Ln(u,f,r),g=Math.min(n,m/2,p/2);if(g<=0){o.push(`L${u.x},${u.y}`),s.push({kind:"line",end:u});continue}let b=ar(u,d,g,r,t.precision),x=ar(u,f,g,r,t.precision);o.push(`L${b.x},${b.y}`),o.push(`Q${u.x},${u.y} ${x.x},${x.y}`),s.push({kind:"line",end:b}),s.push({kind:"quadratic",control:u,end:x})}let a=e.at(-1);return o.push(`L${a.x},${a.y}`),s.push({kind:"line",end:a}),or(o.join(" "),i,s,t.tolerance)}function ce(e,n=!1){return e.kind==="line"?[{points:[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],closed:!1}]:e.kind==="path"&&e.subpaths!==void 0?e.subpaths:[{points:e.points,closed:n}]}function en(e){return e.kind==="path"&&/[AaCcQqSsTt]/.test(e.d)}function nn(e,n=!1){let t=ce(e,n),r=Fn(e,n);return t.flatMap((i,s)=>{let o=i.points[0],a=i.points.at(-1);if(!o||!a)return[];let c=r.filter(f=>f.subpathIndex===s),d;for(let f=0;f<c.length&&!d;f++)d=Bn(c[f].start,c[f].end);let u;for(let f=c.length-1;f>=0&&!u;f--)u=Bn(c[f].start,c[f].end);return[{start:{...o},end:{...i.closed?o:a},closed:i.closed,...d?{startTangent:d}:{},...u?{endTangent:u}:{}}]})}function cr(e,n=!1){let t=[],r=[];return ce(e,n).forEach((i,s)=>{let o=i.points[0],a=i.closed?o:i.points.at(-1);o&&t.push({point:{...o},contourIndex:s}),a&&r.push({point:{...a},contourIndex:s})}),{starts:t,ends:r}}function tn(e,n=!1){let t=[],r=[];for(let i of ce(e,n)){let s=i.points[0],o=i.closed?s:i.points.at(-1);s&&t.push(s),o&&r.push(o)}return{starts:t,ends:r}}function Fn(e,n=!1){let t=[];for(let[r,i]of ce(e,n).entries()){for(let a=1;a<i.points.length;a++)t.push({start:i.points[a-1],end:i.points[a],subpathIndex:r,closing:!1});let s=i.points[0],o=i.points.at(-1);i.closed&&s&&o&&!G(s,o)&&t.push({start:o,end:s,subpathIndex:r,closing:!0})}return t}function rn(e,n=!1){return e.kind==="line"?[]:e.kind==="path"?e.markerMidpoints??[]:ce(e,n).flatMap(t=>{if(t.points.length<2)return[];let r=t.closed&&G(t.points[0],t.points.at(-1))?t.points.slice(0,-1):t.points;return t.closed?r.slice(1):r.slice(1,-1)})}function dr(e,n=!1){if(e.kind==="line")return[];let t=ce(e,n);return e.kind==="path"?(e.markerMidpoints??[]).map(r=>{if(t.length===1)return{point:{...r},contourIndex:0};let i=t.flatMap((s,o)=>s.points.some(a=>G(a,r))?[o]:[]);if(i.length!==1)throw new TypeError("Path marker-mid vertices on multiple subpaths must belong to exactly one typed contour");return{point:{...r},contourIndex:i[0]}}):t.flatMap((r,i)=>{if(r.points.length<2)return[];let s=r.closed&&G(r.points[0],r.points.at(-1))?r.points.slice(0,-1):r.points;return(r.closed?s.slice(1):s.slice(1,-1)).map(a=>({point:{...a},contourIndex:i}))})}function on(e){return e.match(/[Mm](?=\s*[-+.]?\d)/g)?.length??0}function Un(e){return e.replace(/&quot;/g,'"').replace(/&#39;|&apos;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function Vn(e,n){if(!we(e.role).relation||e.from===void 0||e.to===void 0)return;let t={from:e.from,to:e.to,...n?{label:n}:{}};return{label:`${t.from} to ${t.to}${t.label?`: ${t.label}`:""}`,role:"graphics-symbol",roleDescription:"relation",relation:t}}function Wn(e,n){let r=(e.match(/^\s*<[A-Za-z][\w:-]*\b[^>]*>/)?.[0]??"").match(/\sdata-label="([^"]*)"/)?.[1];return Vn({...n,...n.from!==void 0?{from:Un(n.from)}:{},...n.to!==void 0?{to:Un(n.to)}:{}},r?Un(r):void 0)}function sn(e,n){if(!n)return e;let t=e.match(/^\s*<[A-Za-z][\w:-]*\b[^>]*>/)?.[0];if(!t)return e;let r=[];if(/\srole=/.test(t)||r.push(`role="${n.role}"`),/\saria-roledescription=/.test(t)||r.push(`aria-roledescription="${n.roleDescription}"`),/\saria-label=/.test(t)||r.push(`aria-label="${N(n.label)}"`),r.length===0)return e;let i=t.endsWith("/>")?"/>":">",s=t.slice(0,-i.length).trimEnd();return e.replace(t,`${s} ${r.join(" ")}${i==="/>"?" /":""}>`)}function Gn(e){return e?{...e,...e.geometry?{geometry:e.geometry}:{},...e.size?{size:{...e.size}}:{},...e.viewBox?{viewBox:{...e.viewBox}}:{},...e.ref?{ref:{...e.ref}}:{},...e.bounds?{bounds:{...e.bounds}}:{},...e.paint?{paint:{...e.paint}}:{}}:void 0}function so(e,n){let t=["continuous-geometry","stroke-width","stroke-cap","stroke-join"];return e.bendRadius>0&&t.push("bend-radius"),n.opacity!==void 0&&t.push("stroke-opacity"),(n.lineJoin==="miter"||n.lineJoin==="miter-clip")&&t.push("stroke-miter"),n.dash&&t.push("dash-pattern"),n.dash?.offset!==void 0&&t.push("dash-offset"),n.pathLength!==void 0&&t.push("path-length"),n.paintOrder!==void 0&&t.push("paint-order"),n.nonScaling&&t.push("non-scaling-stroke"),t}function an(e){let n=so(e.route,e.stroke),t=cr(e.geometry,e.route.closed),r=dr(e.geometry,e.route.closed),i={start:e.markers.start?t.starts.map(s=>({markerId:e.markers.start.id,point:{...s.point},contourIndex:s.contourIndex})):[],mid:e.markers.mid.length===0?[]:r.map((s,o)=>({markerId:(e.markers.mid.length===1?e.markers.mid[0]:e.markers.mid[o]).id,point:{...s.point},contourIndex:s.contourIndex})),end:e.markers.end?t.ends.map(s=>({markerId:e.markers.end.id,point:{...s.point},contourIndex:s.contourIndex})):[]};return{realization:e.lineStyle==="invisible"?"unsupported":"projected",topology:e.geometry.kind,geometry:e.geometry,direction:e.relationship.direction,relationship:e.relationship.kind,markers:{...e.markers.start?{start:Gn(e.markers.start)}:{},mid:e.markers.mid.map(s=>Gn(s)),...e.markers.end?{end:Gn(e.markers.end)}:{}},markerPlacements:i,endpoints:{...e.endpoints,...e.endpoints.start?{start:{...e.endpoints.start,...e.endpoints.start.point?{point:{...e.endpoints.start.point}}:{}}}:{},...e.endpoints.end?{end:{...e.endpoints.end,...e.endpoints.end.point?{point:{...e.endpoints.end.point}}:{}}}:{}},route:{ownership:e.route.ownership,closed:e.route.closed,bendRadius:e.route.bendRadius,contours:e.route.contours.map(s=>({...s,start:{...s.start},end:{...s.end},...s.startTangent?{startTangent:{...s.startTangent}}:{},...s.endTangent?{endTangent:{...s.endTangent}}:{}})),...e.route.startTangent?{startTangent:{...e.route.startTangent}}:{},...e.route.endTangent?{endTangent:{...e.route.endTangent}}:{},labelAnchors:e.route.labelAnchors.map(s=>({...s}))},stroke:{...e.stroke,...e.stroke.dash?{dash:{...e.stroke.dash,array:Array.isArray(e.stroke.dash.array)?[...e.stroke.dash.array]:e.stroke.dash.array}}:{}},hit:{...e.hit,geometry:e.hit.geometry},...e.transform?{transform:{...e.transform}}:{},labels:e.labels.map(s=>({...s,...s.anchor?{anchor:{...s.anchor}}:{},...s.bounds?{bounds:{...s.bounds}}:{},...s.halo?{halo:{...s.halo}}:{},...s.paint?{paint:{...s.paint}}:{},...s.visual?{visual:{...s.visual}}:{}})),lineStyle:e.lineStyle,strokeLosses:n,diagnostics:[e.lineStyle==="invisible"?"This connector affects layout but is intentionally absent from terminal output.":`The terminal grid preserves connector semantics while projecting continuous stroke fields: ${n.join(", ")}.`,...e.additionalDiagnostics??[]]}}var cn=new WeakMap;function ao(e){let n=e.match(/^<([A-Za-z_][A-Za-z0-9_.:-]*)/);if(!n||e.startsWith("</")||e.startsWith("<!")||e.startsWith("<?"))return e;let t=n[1];if(t!=="svg")return e;let r=/\/\s*>$/.test(e),i=r?e.lastIndexOf("/"):e.length-1,s=[],o=n[0].length;for(;o<i;){for(;/\s/.test(e[o]??"");)o++;if(o>=i)break;let d=e.slice(o).match(/^([^\s=<>/]+)/);if(!d)return e;let u=d[1];for(o+=d[0].length;/\s/.test(e[o]??"");)o++;if(e[o]!=="=")return e;for(o++;/\s/.test(e[o]??"");)o++;let f=e[o];if(f!=='"'&&f!=="'")return e;o++;let m=o;for(;o<i&&e[o]!==f;)o++;if(e[o]!==f)return e;let p=e.slice(m,o);o++,s.push({name:u,value:f==='"'?p:p.replaceAll('"',"&quot;"),index:s.length})}let a=new Map([["xmlns",0],["width",1],["height",2],["viewBox",3],["style",4]]);s.sort((d,u)=>{let f=a.get(d.name)??100,m=a.get(u.name)??100;return f-m||bt(d.name,u.name)||d.index-u.index});let c=s.map(d=>`${d.name}="${d.value}"`).join(" ");return`<${t}${c?` ${c}`:""}${r?" /":""}>`}function ue(e){let n="",t=0;for(;t<e.length;){let r=e.indexOf("<",t);if(r<0)return n+e.slice(t);if(n+=e.slice(t,r),e.startsWith("<!--",r)){let o=e.indexOf("-->",r+4);if(o<0)return n+e.slice(r);n+=e.slice(r,o+3),t=o+3;continue}let i,s=r+1;for(;s<e.length;s++){let o=e[s];if(i)o===i&&(i=void 0);else if(o==='"'||o==="'")i=o;else if(o===">")break}if(s>=e.length)return n+e.slice(r);n+=ao(e.slice(r,s+1)),t=s+1}return n}function ne(e,n){return cn.set(e,ue(n)),e}function R(e){let n=cn.get(e);if(n===void 0)throw new TypeError(`Scene node "${e.id}" has no admitted SVG serialization`);return n}function qn(e,n){let t=cn.get(e);t!==void 0&&cn.set(n,t)}function Pe(e,n){let t=Qe(n,e),r=Wn(n,t),i=sn(Ie(n,t),r);return ne({kind:"shape",identity:t,accessibility:r,...e},i)}function co(e,n){if(e.kind==="line")return{start:{point:{x:e.x1,y:e.y1}},end:{point:{x:e.x2,y:e.y2}}};let t=ce(e,n),r=t[0]?.points[0],i=t.at(-1),s=i?.closed?i.points[0]:i?.points.at(-1);return{...r?{start:{point:{...r}}}:{},...s?{end:{point:{...s}}}:{}}}function lo(e){let n=typeof e=="number"?e:parseFloat(e);return Number.isFinite(n)?Math.max(0,n):1}function uo(e,n,t){return e.from!==void 0&&e.from===e.to?"self":n&&t?"bidirectional":n?"reverse":t?"forward":"undirected"}function fo(e,n,t,r){if(r.length===0)return;let i=rn(n,t).length;if(i===0)throw new RangeError(`Connector "${e}" has mid markers but no typed interior route points`);if(r.length!==1&&r.length!==i)throw new RangeError(`Connector "${e}" mid markers must contain one repeated descriptor or one descriptor per interior route point`);if(new Set(r.map(o=>o.id)).size!==1)throw new RangeError(`Connector "${e}" uses distinct mid markers that one SVG marker-mid carrier cannot represent`);return r[0].id}function po(e,n){if(e==="")return e;let t=e;for(let[r,i]of Object.entries(n)){if(!i)continue;let s=`marker-${r}`,o=t.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0];!o||new RegExp(`\\s${s}=`).test(o)||(t=t.replace(o,o.replace(/\s*\/?>$/,a=>` ${s}="url(#${N(i)})"${a}`)))}return t}function mo(e,n){if(e===""||!n)return e;let t=e.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0];if(!t||/\stransform=/.test(t))return e;let r=`rotate(${n.angle} ${n.cx} ${n.cy})`;return e.replace(t,t.replace(/\s*\/?>$/,i=>` transform="${r}"${i}`))}function yo(e,n){if(e==="")return e;let t=e.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0];if(!t)return e;let r=t;for(let[i,s]of[["data-relationship",n.kind],["data-direction",n.direction]])new RegExp(`\\s${i}=`).test(r)||(r=r.replace(/\s*\/?>$/,o=>` ${i}="${N(s)}"${o}`));return e.replace(t,r)}function go(e,n,t,r){if(n.visual?.kind!=="inline")return;if(!n.anchor||!n.paint||n.fontSize===void 0||n.textAnchor===void 0)throw new TypeError(`Connector "${e}" inline label ${t+1} requires anchor, paint, fontSize, and textAnchor`);let i=[`data-id="${N(n.id??`${e}-label-${t+1}`)}"`,'data-role="label"',`data-connector-label-for="${N(e)}"`,`x="${n.anchor.x}"`,`y="${n.anchor.y-Math.max(0,n.clearance??0)}"`,`font-size="${n.fontSize}"`,`text-anchor="${n.textAnchor}"`];r?.kind==="rotate"&&i.push(`transform="rotate(${r.angle} ${r.cx} ${r.cy})"`);let s={...n.paint,...n.halo?{stroke:n.halo.color??"var(--bg)",strokeWidth:String(n.halo.width),paintOrder:"stroke fill"}:{}},o=[["fill",s.fill],["stroke",s.stroke],["stroke-width",s.strokeWidth],["stroke-dasharray",s.strokeDasharray],["stroke-dashoffset",s.strokeDashoffset],["stroke-linecap",s.strokeLinecap],["stroke-linejoin",s.strokeLinejoin],["stroke-miterlimit",s.strokeMiterlimit],["vector-effect",s.vectorEffect],["paint-order",s.paintOrder],["opacity",s.opacity]];for(let[a,c]of o)c!==void 0&&i.push(`${a}="${N(c)}"`);return`<text ${i.join(" ")}>${Y(n.text)}</text>`}function ye(e,n){if(e.geometry.kind!=="path"&&e.route?.closed===!0)throw new TypeError(`Connector "${e.id}" closed route topology requires path geometry`);if(e.geometry.kind==="path"){let S=e.geometry,O=S.subpaths,D=on(S.d);if(D>1&&!O)throw new TypeError(`Connector "${e.id}" path has multiple SVG subpaths but no typed subpaths`);if(O){if(O.length===0||O.some(X=>X.points.length<2))throw new TypeError(`Connector "${e.id}" typed subpaths must each contain at least two points`);if(D!==O.length)throw new TypeError(`Connector "${e.id}" typed subpath count disagrees with SVG path moves`);let oe=O.flatMap(X=>X.points);if(oe.length!==S.points.length||oe.some((X,Fe)=>{let Cn=S.points[Fe];return!Cn||Cn.x!==X.x||Cn.y!==X.y}))throw new TypeError(`Connector "${e.id}" typed subpaths disagree with the canonical point projection`)}}let t=ce(e.geometry,e.route?.closed??!1),r=t.length===1&&t[0].closed;if(e.geometry.kind==="path"&&e.geometry.subpaths&&e.route?.closed!==void 0&&e.route.closed!==r)throw new TypeError(`Connector "${e.id}" route.closed disagrees with typed subpath topology`);let i=e.geometry.kind==="path"&&e.geometry.subpaths?r:e.route?.closed??!1;if(e.geometry.kind==="path"){let S=e.geometry.d.match(/[Zz]/g)?.length??0,O=e.geometry.subpaths?e.geometry.subpaths.filter(D=>D.closed).length:i?1:0;if(S!==O)throw new TypeError(`Connector "${e.id}" SVG close commands disagree with typed closed-contour semantics`)}let s=e.markers?.start,o=e.markers?.end,a=e.markers?.mid??[];for(let S of[s,...a,o])if(S?.geometry?.kind==="path"&&!S.bounds&&!S.viewBox&&!S.size)throw new TypeError(`Connector "${e.id}" path marker "${S.id}" requires bounds, viewBox, or size`);let c=fo(e.id,e.geometry,i,a),d=co(e.geometry,i);for(let S of["start","end"]){let O=e.endpoints?.[S]?.point,D=d[S]?.point;if(O&&D&&!G(O,D))throw new TypeError(`Connector "${e.id}" endpoints.${S}.point disagrees with typed route geometry`)}let u={...e.endpoints??{},start:{...d.start,...e.endpoints?.start},end:{...d.end,...e.endpoints?.end}},f={kind:e.relationship?.kind??e.role,direction:e.relationship?.direction??uo(u,s,o)},m=e.labels??[],p={id:e.identity?.id??e.id,role:e.role,...e.identity?.classNames?{classNames:e.identity.classNames}:{},...e.identity?.from??u.from?{from:e.identity?.from??u.from}:{},...e.identity?.to??u.to?{to:e.identity?.to??u.to}:{}},g=Vn(p,m[0]?.text),b=po(n,{...s?{start:s.id}:{},...c?{mid:c}:{},...o?{end:o.id}:{}}),x=yo(b,f),v=mo(x,e.transform),y=sn(Ie(v,p),g),E=m.map((S,O)=>go(e.id,S,O,e.transform)).filter(S=>S!==void 0);E.length>0&&(y=[y,...E].join(`
26
26
  `));let w=e.stroke?.width??e.paint.strokeWidth??"1",j=e.stroke?.dash??(e.paint.strokeDasharray?{array:e.paint.strokeDasharray,...e.paint.strokeDashoffset!==void 0?{offset:e.paint.strokeDashoffset}:{}}:void 0),F=e.stroke?.opacity??e.paint.opacity,h=e.stroke?.paintOrder??e.paint.paintOrder,B={color:e.stroke?.color??e.paint.stroke??"var(--_line)",width:w,...F!==void 0?{opacity:F}:{},...j?{dash:j}:{},lineCap:e.stroke?.lineCap??e.paint.strokeLinecap??"butt",lineJoin:e.stroke?.lineJoin??e.paint.strokeLinejoin??"miter",miterLimit:e.stroke?.miterLimit??Number(e.paint.strokeMiterlimit??4),...e.stroke?.pathLength!==void 0?{pathLength:e.stroke.pathLength}:{},...h!==void 0?{paintOrder:h}:{},nonScaling:e.stroke?.nonScaling??e.paint.vectorEffect==="non-scaling-stroke"},ie=nn(e.geometry,i),V=e.route?.contours;if(V&&(V.length!==ie.length||V.some((S,O)=>{let D=ie[O];return!D||S.start.x!==D.start.x||S.start.y!==D.start.y||S.end.x!==D.end.x||S.end.y!==D.end.y||S.closed!==D.closed})))throw new TypeError(`Connector "${e.id}" route contours disagree with typed subpath endpoint topology`);if(!en(e.geometry)&&V)for(let[S,O]of V.entries()){let D=ie[S];for(let oe of["startTangent","endTangent"]){let X=O[oe],Fe=D[oe];if(X&&(!Fe||!G(X,Fe,1e-9)))throw new TypeError(`Connector "${e.id}" route.contours[${S}].${oe} disagrees with linear route geometry`)}}let z=ie.map((S,O)=>{let D=V?.[O],oe=D?.startTangent??S.startTangent,X=D?.endTangent??S.endTangent;return{start:{...S.start},end:{...S.end},closed:S.closed,...oe?{startTangent:oe}:{},...X?{endTangent:X}:{}}});for(let S of z)for(let O of[S.startTangent,S.endTangent]){if(!O)continue;let D=Math.hypot(O.x,O.y);if(!Number.isFinite(D)||Math.abs(D-1)>1e-9)throw new TypeError(`Connector "${e.id}" contour tangents must be finite unit vectors`)}for(let S of[e.route?.startTangent,e.route?.endTangent]){if(!S)continue;let O=Math.hypot(S.x,S.y);if(!Number.isFinite(O)||Math.abs(O-1)>1e-9)throw new TypeError(`Connector "${e.id}" route tangents must be finite unit vectors`)}for(let[S,O,D]of[["startTangent",e.route?.startTangent,z[0]?.startTangent],["endTangent",e.route?.endTangent,z.at(-1)?.endTangent]])if(O&&D&&!G(O,D,1e-9))throw new TypeError(`Connector "${e.id}" route.${S} disagrees with its contour tangent authority`);let Ae={geometry:e.geometry,ownership:e.route?.ownership??"family",closed:i,bendRadius:e.route?.bendRadius??0,contours:z,...(()=>{let S={start:z[0]?.startTangent,end:z.at(-1)?.endTangent};return{...e.route?.startTangent??S.start?{startTangent:e.route?.startTangent??S.start}:{},...e.route?.endTangent??S.end?{endTangent:e.route?.endTangent??S.end}:{}}})(),labelAnchors:e.route?.labelAnchors??m.flatMap(S=>S.anchor?[S.anchor]:[])};if(e.hit?.closed!==void 0&&e.hit.closed!==i)throw new TypeError(`Connector "${e.id}" hit.closed must match route.closed topology`);let ht={geometry:e.hit?.geometry??e.geometry,closed:e.hit?.closed??i,strokeWidth:e.hit?.strokeWidth??Math.max(6,lo(w)),pointerEvents:e.hit?.pointerEvents??(e.lineStyle==="invisible"?"none":"stroke")},Qr=an({geometry:e.geometry,lineStyle:e.lineStyle,endpoints:u,relationship:f,route:Ae,stroke:B,markers:{...s?{start:s}:{},mid:a,...o?{end:o}:{}},labels:m,hit:ht,...e.transform?{transform:e.transform}:{},additionalDiagnostics:e.terminalProjection?.diagnostics}),ei={kind:"connector",id:e.id,role:e.role,lineStyle:e.lineStyle,endpoints:u,relationship:f,route:Ae,stroke:B,markers:{...s?{start:s}:{},mid:a,...o?{end:o}:{}},labels:m,hit:ht,terminalProjection:Qr,identity:p,...g?{accessibility:g}:{},...e.channels?{channels:e.channels}:{},...e.transform?{transform:e.transform}:{}};return ne(ei,y)}function dn(e,n){let t=Qe(n,e),r=Wn(n,t),i=sn(Ie(n,t),r);return ne({kind:"text",identity:t,accessibility:r,...e},i)}function Qa(e,n){return ne({kind:"document",element:"content",...e},n)}function Hn(e){let n=e.element==="title"?"title":"desc",t=e.domId?` id="${N(e.domId)}"`:"";return ne({kind:"document",role:"chrome",...e},`<${n}${t}>${Y(e.text)}</${n}>`)}function lr(e,n){return ne({kind:"document",role:"defs",element:"definitions",...e},n)}function ur(){return ne({kind:"document",id:"svg-close",role:"chrome",element:"close"},"</svg>")}function Kn(e,n){if(n<=0||e==="")return e;let t=" ".repeat(n);return t+e.replace(/\n/g,`
27
27
  ${t}`)}function ln(e){let n=e.join??`
28
28
  `,t=Qe(e.open,e),r=ue(Ie(e.open,t)),i=[r];for(let s of e.children)i.push(Kn(R(s.node),s.indent));return i.push(e.close),ne({kind:"group",id:e.id,role:e.role,open:r,close:e.close,children:e.children,join:n,channels:e.channels,identity:t},i.join(n))}function fr(e,n){return ne({kind:"document",element:"open",id:e.id,role:"prelude"},n)}function Qn(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\(?:\r\n|[\n\r\f])/g,"").replace(/\\([0-9a-fA-F]{1,6})\s?/g,(n,t)=>{let r=Number.parseInt(t,16);return Number.isFinite(r)?String.fromCodePoint(r):""}).replace(/\\([^\n\r\f])/g,"$1")}var gr=/\s([^\s=<>]+)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/g,hr=/<(?:[^\s<>/:]+:)?(?:animate(?:Motion|Transform)?|set)\b/i;function br(e){let n=[];for(let t=e.indexOf("<");t>=0;t=e.indexOf("<",t+1)){let r=e[t+1];if(!r||r==="/"||r==="!"||r==="?"||!/[^\s<>]/.test(r))continue;let i;for(let s=t+1;s<e.length;s++){let o=e[s];if(i)o===i&&(i=void 0);else if(o==='"'||o==="'")i=o;else if(o===">"){n.push(e.slice(t,s+1)),t=s;break}}}return n}var bo=new Set(["amp","lt","gt","quot","apos"]);function ze(e){return e===" "||e===" "||e===`
@@ -1 +1 @@
1
- import{a as d,f as V}from"./chunk-FFOHLPDA.js";import{B as P,C as q,E as J,T as B,U as G,V as X,W as g,X as I,Y as h,Z as j,_ as R}from"./chunk-FXBBGAMJ.js";var x=Object.freeze({contrast:Object.freeze({properties:Object.freeze({role:Object.freeze({kind:"role"}),minimum:Object.freeze({kind:"number",minimum:1,maximum:21})}),recovery:"Choose an authored text/surface pair that meets the requested ratio, or remove the rule; the renderer will not repaint it."}),"accent-area":Object.freeze({properties:Object.freeze({maxFraction:Object.freeze({kind:"number",minimum:0,maximum:1,required:!0})}),recovery:"Reduce authored accent-filled area or raise the declared maximum; the renderer will not rewrite fills."}),"mono-role":Object.freeze({properties:Object.freeze({role:Object.freeze({kind:"role",required:!0})}),recovery:"Use measurable monochrome paint for the named role or remove the rule; the renderer will not rewrite paint."})}),k=Object.freeze(Object.keys(x));function w(e){return x[e].properties}function U(e){return Object.freeze(["kind","action",...Object.keys(x[e].properties)])}function H(e){let n=w(e);return Object.freeze(["kind","action",...Object.entries(n).filter(([,t])=>t.required===!0).map(([t])=>t)])}var We=Object.freeze({warn:Object.freeze({code:"BRAND_CONSTRAINT_WARNING",severity:"warning",tier:"lint"}),error:Object.freeze({code:"BRAND_CONSTRAINT_ERROR",severity:"error",tier:"lint"})});var O=1;function D(e){if(typeof e!="object"||e===null||Object.isFrozen(e))return e;for(let n of Object.values(e))D(n);return Object.freeze(e)}var v=D({bg:{description:"Diagram page background."},fg:{description:"Primary text and foreground paint."},line:{description:"Connector and secondary line paint."},accent:{description:"Accent paint for emphasis and data series."},muted:{description:"Muted text and secondary data paint."},surface:{description:"Node and group surface fill."},border:{description:"Node and group border paint."}}),$=Object.freeze(["category"]),T=D({formatVersion:{kind:"const",value:O,group:"metadata",description:"Persisted wire-format version. Optional on input and normalized to 1 on output."},$schema:{kind:"string",group:"metadata",description:"Optional JSON Schema pointer for file-backed styles; ignored while rendering."},name:{kind:"string",group:"metadata",description:"Canonical look:name or palette:name identity; required only when registering a style."},blurb:{kind:"string",group:"metadata",description:"Short human-readable description used by discovery surfaces."},colors:{kind:"colors",group:"palette",description:"Partial palette of safe, non-fetching CSS color tokens."},font:{kind:"string",runtimeValidator:"safeCssFontFamily",group:"typography",description:"Safe, non-fetching CSS font family or stack; the rendering environment supplies the font face."},roles:{kind:"roles",group:"roles",description:"Partial semantic SceneRole defaults. Family-authored styling remains authoritative."},semanticSlots:{kind:"semanticSlots",group:"policy",description:"Named brand-neutral role-style slots selected by semantic bindings."},bindings:{kind:"bindings",group:"policy",description:"Ordered equality bindings from authored/domain meaning to semantic slots."},constraints:{kind:"constraints",group:"policy",description:"Closed inspect-only brand constraints with warn or error actions."},stroke:{kind:"enum",values:["crisp","jittered","freehand"],group:"stroke",description:"Stroke treatment; crisp is the default renderer."},roughness:{kind:"number",minimum:0,maximum:10,expected:"between 0 and 10",group:"stroke",description:"Rough.js stroke irregularity."},bowing:{kind:"number",minimum:0,maximum:10,expected:"between 0 and 10",group:"stroke",description:"Rough.js line bowing."},passes:{kind:"integer",minimum:1,maximum:8,expected:"an integer from 1 through 8",group:"stroke",description:"Number of sketch strokes; 1 is single-pass and 2 is the usual double stroke."},strokeWidth:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20",group:"stroke",description:"Base stroke width in SVG user units."},fill:{kind:"enum",values:["none","hachure","solid","wash"],group:"fill",description:"Fill policy for rough/hybrid rendering; none and solid require a final stack that activates one of those backends."},hachureAngle:{kind:"number",minimum:-360,maximum:360,expected:"between -360 and 360",group:"fill",description:"Hachure line angle in degrees; requires fill hachure in the final stack."},hachureGap:{kind:"number",exclusiveMinimum:0,maximum:100,expected:"greater than 0 and at most 100",group:"fill",description:"Gap between hachure lines; requires fill hachure in the final stack."},fillWeight:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20",group:"fill",description:"Hachure line weight; requires fill hachure in the final stack."},washOpacity:{kind:"number",minimum:0,maximum:1,expected:"between 0 and 1",group:"fill",description:"Watercolor glaze opacity; requires fill wash in the final stack."},washEdge:{kind:"number",minimum:0,maximum:1,expected:"between 0 and 1",group:"fill",description:"Watercolor edge-darkening opacity; requires fill wash in the final stack."},backdrop:{kind:"enum",values:["plain","paper-ruled","grid"],group:"page",description:"Flat page furniture drawn behind the diagram."},intent:{kind:"enum",values:["premium","draft","lofi"],group:"advisory",description:"Advisory intent metadata for pickers and quality tooling."},mono:{kind:"boolean",group:"advisory",description:"Advisory monochrome contract: express tone through shading and weight."}});function S(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function z(e,n){return!(typeof e!="number"||!Number.isFinite(e)||n.kind==="integer"&&!Number.isInteger(e)||n.minimum!==void 0&&e<n.minimum||n.exclusiveMinimum!==void 0&&e<=n.exclusiveMinimum||n.maximum!==void 0&&e>n.maximum)}var me=Object.freeze(["--bg","--fg","--_text","--_text-sec","--_text-muted","--_text-faint","--_line","--_arrow","--_node-fill","--_node-stroke","--_group-fill","--_group-hdr","--_inner-stroke","--_key-badge"]),ye=new Set(me);function ge(e){return typeof e!="string"||J(e)===void 0?!1:[...e.matchAll(/var\(\s*(--[a-z0-9_-]+)/gi)].map(t=>t[1]).every(t=>ye.has(t))}var W=new Map(R.map(e=>[e.role,e])),ee=I.map(e=>W.get(e)),Se=new Set(h),be=/^[A-Za-z][A-Za-z0-9._-]{0,63}$/,L=new Set(["__proto__","constructor","prototype"]);function ne(e,n,t){if(!S(e))return[`"${n}" must be an object`];let i=[];for(let[r,o]of Object.entries(e)){if(!Object.hasOwn(g,r)){i.push(`unknown role style field "${n.slice(n.indexOf(".")+1)}.${r}"`);continue}if(t&&!t.has(r)){i.push(`role style field "${n}.${r}" is not applicable`);continue}let s=g[r],a=`${n}.${r}`;o!==void 0&&(s.kind==="number"&&!z(o,s)?i.push(`"${a}" must be ${s.expected}`):s.kind==="font"&&(typeof o!="string"||P(o)===void 0)?i.push(`"${a}" must be a safe non-fetching CSS font family or stack`):s.kind==="color"&&!ge(o)?i.push(`"${a}" must be a safe non-fetching CSS paint`):s.kind==="enum"&&(typeof o!="string"||!s.values.includes(o))&&i.push(`"${a}" must be one of ${s.values.join(" | ")}`))}return i}function he(e){if(!S(e))return['"roles" must be an object of SceneRole records'];let n=[];for(let[t,i]of Object.entries(e)){let r=W.get(t);if(!r){n.push(`unknown scene role "${t}"`);continue}if(r.traits.styleConsumption==="fallback-only"){n.push(`scene role "${t}" is fallback-only; set roles.${r.style.fallbackRole} instead`);continue}let o=new Set(r.style.applicableProperties),s=ne(i,`roles.${t}`,o).map(a=>a===`"roles.${t}" must be an object`?a:a.replace(`role style field "roles.${t}.`,`role style field "${t}.`).replace('" is not applicable',`" is not applicable to ${t} roles`));n.push(...s)}return n}function te(e){return typeof e=="string"&&be.test(e)&&!L.has(e)}function Re(e){if(!S(e))return['"semanticSlots" must be an object of named role-style slots'];if(Object.keys(e).length>d.maxItemsPerContainer)return[`"semanticSlots" must contain at most ${d.maxItemsPerContainer} slots`];let n=[];for(let[t,i]of Object.entries(e)){if(!te(t)){n.push(`invalid semantic slot name "${t}"`);continue}n.push(...ne(i,`semanticSlots.${t}`))}return n}function ke(e){if(!Array.isArray(e))return['"bindings" must be an array'];if(e.length>d.maxItemsPerContainer)return[`"bindings" must contain at most ${d.maxItemsPerContainer} entries`];let n=[];return e.forEach((t,i)=>{let r=`bindings[${i}]`;if(!S(t)){n.push(`"${r}" must be an object`);return}for(let o of Object.keys(t))["channel","value","slot","role"].includes(o)||n.push(`unknown binding field "${r}.${o}"`);(typeof t.channel!="string"||!$.includes(t.channel))&&n.push(`"${r}.channel" must be one of ${$.join(" | ")}`),(typeof t.value!="string"||t.value.length===0||t.value.length>256||/[\r\n\0]/.test(t.value))&&n.push(`"${r}.value" must be a non-empty single-line string of at most 256 characters`),te(t.slot)||n.push(`"${r}.slot" must be a valid semantic slot name`),t.role!==void 0&&!Se.has(t.role)&&n.push(`"${r}.role" must be a SceneRole with an executable category-binding consumer (${h.join(" | ")})`)}),n}function Oe(e){if(!Array.isArray(e))return['"constraints" must be an array'];if(e.length>d.maxItemsPerContainer)return[`"constraints" must contain at most ${d.maxItemsPerContainer} entries`];let n=[];return e.forEach((t,i)=>{let r=`constraints[${i}]`;if(!S(t)){n.push(`"${r}" must be an object`);return}if(typeof t.kind!="string"||!k.includes(t.kind)){n.push(`"${r}.kind" must be one of ${k.join(" | ")}`);return}let o=t.kind,s=w(o),a=new Set(U(o));for(let l of Object.keys(t))a.has(l)||n.push(`unknown constraint field "${r}.${l}"`);t.action!=="warn"&&t.action!=="error"&&n.push(`"${r}.action" must be one of warn | error`);for(let[l,c]of Object.entries(s)){let f=t[l];if(f===void 0){c.required&&n.push(`"${r}.${l}" is required for ${o}`);continue}c.kind==="role"&&!W.has(f)?n.push(`"${r}.${l}" must be a registered built-in SceneRole`):c.kind==="number"&&!z(f,c)&&n.push(`"${r}.${l}" must be between ${c.minimum} and ${c.maximum}`)}}),n}function A(e){if(!S(e))return["style spec must be a plain object"];if(Object.keys(e).length>d.maxItemsPerContainer)return[`style spec must contain at most ${d.maxItemsPerContainer} fields`];let n=[];for(let[t,i]of Object.entries(e)){if(!Object.hasOwn(T,t)){n.push(`unknown field "${t}"`);continue}let r=T[t];if(i!==void 0)switch(r.kind){case"const":i!==r.value&&n.push(`"${t}" must be ${r.value}`);break;case"string":typeof i!="string"?n.push(`"${t}" must be a string`):r.runtimeValidator==="safeCssFontFamily"&&P(i)===void 0&&n.push(`"${t}" must be a safe non-fetching CSS font family or stack`);break;case"boolean":typeof i!="boolean"&&n.push(`"${t}" must be a boolean`);break;case"number":case"integer":z(i,r)||n.push(`"${t}" must be ${r.expected}`);break;case"enum":(typeof i!="string"||!r.values.includes(i))&&n.push(`"${t}" must be one of ${r.values.join(" | ")}`);break;case"roles":n.push(...he(i));break;case"semanticSlots":n.push(...Re(i));break;case"bindings":n.push(...ke(i));break;case"constraints":n.push(...Oe(i));break;case"colors":{if(!S(i)){n.push('"colors" must be an object of color tokens');break}for(let[o,s]of Object.entries(i))Object.hasOwn(v,o)?s!==void 0&&typeof s!="string"?n.push(`color token "${o}" must be a string`):s!==void 0&&q(s)===void 0&&n.push(`color token "${o}" must be a safe non-fetching CSS color`):n.push(`unknown color token "${o}"`);break}}}return V(n,"Style validation")}function Ce(){return Object.fromEntries(Object.entries(g).map(([e,n])=>{if(n.kind==="number"){let t=n;return[e,{type:"number",...t.minimum!==void 0?{minimum:t.minimum}:{},...t.exclusiveMinimum!==void 0?{exclusiveMinimum:t.exclusiveMinimum}:{},...t.maximum!==void 0?{maximum:t.maximum}:{},description:t.description}]}return n.kind==="enum"?[e,{type:"string",enum:[...n.values],description:n.description}]:[e,{type:"string",description:n.description,"x-agentic-mermaid-runtime-validator":n.kind==="font"?"safeCssFontFamily":"safeStylePaint"}]}))}function Z(e=Object.keys(g)){let n=Ce();return{type:"object",additionalProperties:!1,maxProperties:e.length,properties:Object.fromEntries(e.map(t=>[t,n[t]]))}}function re(e){return`roleStyle-${e.role}`}var Q="^[A-Za-z][A-Za-z0-9._-]{0,63}$";function Ee(e){switch(e.kind){case"const":return{const:e.value,description:e.description};case"string":return{type:"string",description:e.description,...e.runtimeValidator?{"x-agentic-mermaid-runtime-validator":e.runtimeValidator}:{}};case"boolean":return{type:"boolean",description:e.description};case"enum":return{type:"string",enum:[...e.values],description:e.description};case"number":case"integer":return{type:e.kind,...e.minimum!==void 0?{minimum:e.minimum}:{},...e.exclusiveMinimum!==void 0?{exclusiveMinimum:e.exclusiveMinimum}:{},...e.maximum!==void 0?{maximum:e.maximum}:{},description:e.description};case"roles":return{type:"object",additionalProperties:!1,description:e.description,properties:Object.fromEntries(ee.map(n=>[n.role,{$ref:`#/$defs/${re(n)}`}]))};case"semanticSlots":return{type:"object",description:e.description,maxProperties:d.maxItemsPerContainer,propertyNames:{pattern:Q,not:{enum:[...L]}},additionalProperties:{$ref:"#/$defs/roleStyle-any"}};case"bindings":return{type:"array",description:e.description,maxItems:d.maxItemsPerContainer,items:{type:"object",additionalProperties:!1,maxProperties:4,required:["channel","value","slot"],properties:{channel:{type:"string",enum:[...$]},value:{type:"string",minLength:1,maxLength:256,pattern:"^[^\\r\\n\\u0000]+$"},slot:{type:"string",pattern:Q,not:{enum:[...L]}},role:{type:"string",enum:[...h]}}}};case"constraints":{let n={type:"string",enum:["warn","error"]},t={type:"string",enum:R.map(r=>r.role)},i=k.map(r=>{let o=w(r),s=Object.fromEntries(Object.entries(o).map(([a,l])=>[a,l.kind==="role"?t:{type:"number",minimum:l.minimum,maximum:l.maximum}]));return{type:"object",additionalProperties:!1,required:[...H(r)],properties:{kind:{const:r},action:n,...s}}});return{type:"array",description:e.description,maxItems:d.maxItemsPerContainer,items:{oneOf:i}}}case"colors":return{type:"object",additionalProperties:!1,maxProperties:Object.keys(v).length,description:`${e.description} Runtime validation applies the stricter safe-color policy.`,properties:Object.fromEntries(Object.entries(v).map(([n,t])=>[n,{type:"string",description:`${t.description} Must be a safe, non-fetching CSS color.`,"x-agentic-mermaid-runtime-validator":"safeCssColor"}]))}}}function xe(){let e=Object.fromEntries(ee.map(n=>[re(n),Z(n.style.applicableProperties)]));return{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://agentic-mermaid.dev/schemas/style-spec.schema.json",title:"Agentic Mermaid StyleSpec",description:"A partial declarative style record for Agentic Mermaid rendering. All fields, including formatVersion, are optional on input; resolved and registered specs normalize formatVersion to 1.",type:"object",additionalProperties:!1,maxProperties:Object.keys(T).length,properties:Object.fromEntries(Object.entries(T).map(([n,t])=>[n,Ee(t)])),$defs:{...e,"roleStyle-any":Z()}}}var ie=Object.freeze([{id:"palette:paper",inputName:"paper",displayLabel:"Paper",colors:{bg:"#F5F0E4",fg:"#221E16",accent:"#9A4A24"}},{id:"palette:dusk",inputName:"dusk",displayLabel:"Dusk",colors:{bg:"#2A2521",fg:"#E9DFCC",accent:"#CC8A57"}},{id:"palette:zinc-light",inputName:"zinc-light",displayLabel:"Zinc Light",colors:{bg:"#FFFFFF",fg:"#27272A"}},{id:"palette:zinc-dark",inputName:"zinc-dark",displayLabel:"Zinc Dark",colors:{bg:"#18181B",fg:"#FAFAFA"}},{id:"palette:tokyo-night",inputName:"tokyo-night",displayLabel:"Tokyo Night",colors:{bg:"#1a1b26",fg:"#a9b1d6",line:"#3d59a1",accent:"#7aa2f7",muted:"#565f89"}},{id:"palette:tokyo-night-storm",inputName:"tokyo-night-storm",displayLabel:"Tokyo Night Storm",colors:{bg:"#24283b",fg:"#a9b1d6",line:"#3d59a1",accent:"#7aa2f7",muted:"#565f89"}},{id:"palette:tokyo-night-light",inputName:"tokyo-night-light",displayLabel:"Tokyo Night Light",colors:{bg:"#d5d6db",fg:"#343b58",line:"#34548a",accent:"#34548a",muted:"#9699a3"}},{id:"palette:catppuccin-mocha",inputName:"catppuccin-mocha",displayLabel:"Catppuccin Mocha",colors:{bg:"#1e1e2e",fg:"#cdd6f4",line:"#585b70",accent:"#cba6f7",muted:"#6c7086"}},{id:"palette:catppuccin-latte",inputName:"catppuccin-latte",displayLabel:"Catppuccin Latte",colors:{bg:"#eff1f5",fg:"#4c4f69",line:"#9ca0b0",accent:"#8839ef",muted:"#9ca0b0"}},{id:"palette:nord",inputName:"nord",displayLabel:"Nord",colors:{bg:"#2e3440",fg:"#d8dee9",line:"#4c566a",accent:"#88c0d0",muted:"#616e88"}},{id:"palette:nord-light",inputName:"nord-light",displayLabel:"Nord Light",colors:{bg:"#eceff4",fg:"#2e3440",line:"#aab1c0",accent:"#5e81ac",muted:"#7b88a1"}},{id:"palette:dracula",inputName:"dracula",displayLabel:"Dracula",colors:{bg:"#282a36",fg:"#f8f8f2",line:"#6272a4",accent:"#bd93f9",muted:"#6272a4"}},{id:"palette:github-light",inputName:"github-light",displayLabel:"GitHub Light",colors:{bg:"#ffffff",fg:"#1f2328",line:"#d1d9e0",accent:"#0969da",muted:"#59636e"}},{id:"palette:github-dark",inputName:"github-dark",displayLabel:"GitHub Dark",colors:{bg:"#0d1117",fg:"#e6edf3",line:"#3d444d",accent:"#4493f8",muted:"#9198a1"}},{id:"palette:solarized-light",inputName:"solarized-light",displayLabel:"Solarized Light",colors:{bg:"#fdf6e3",fg:"#657b83",line:"#93a1a1",accent:"#268bd2",muted:"#93a1a1"}},{id:"palette:solarized-dark",inputName:"solarized-dark",displayLabel:"Solarized Dark",colors:{bg:"#002b36",fg:"#839496",line:"#586e75",accent:"#268bd2",muted:"#586e75"}},{id:"palette:one-dark",inputName:"one-dark",displayLabel:"One Dark",colors:{bg:"#282c34",fg:"#abb2bf",line:"#4b5263",accent:"#c678dd",muted:"#5c6370"}},{id:"palette:salmon",inputName:"salmon",displayLabel:"Salmon",colors:{bg:"#FFFBF5",fg:"#521000",line:"#C9A88A",accent:"#FF4801",muted:"#85532E",surface:"#FFFDFB",border:"#D4B89E"}},{id:"palette:salmon-dark",inputName:"salmon-dark",displayLabel:"Salmon Dark",colors:{bg:"#1F1008",fg:"#F5DCC8",line:"#6B4A2E",accent:"#FF6B35",muted:"#A07858",surface:"#2A1810",border:"#5A3A22"}},{id:"palette:tufte-dark",inputName:"tufte-dark",displayLabel:"Tufte Dark",colors:{bg:"#1C1C1A",fg:"#E8E4DC",line:"#666660",accent:"#C87070",muted:"#908880",surface:"#2A2926",border:"#444440"}}]);var F=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor"]),oe=Object.freeze(["paddingX","paddingY","cornerRadius","lineWidth","fillColor","borderColor"]),un=Object.freeze({text:Object.freeze({sourceRole:"label",fields:F}),node:Object.freeze({sourceRole:"node",fields:Object.freeze([...F,...oe])}),edge:Object.freeze({sourceRole:"edge",fields:Object.freeze([...F,"lineWidth","bendRadius","strokeColor"])}),group:Object.freeze({sourceRole:"group",fields:Object.freeze([...F,...oe,"fontFamily","headerFillColor"])})}),se="1.0.0",le=Object.freeze({core:"^0.3.0"}),Te=Object.freeze({owner:"agentic-mermaid",source:"built-in",reference:"src/scene/style-registry.ts"}),_e=Object.freeze({owner:"host",source:"in-process"}),m=new Map,C=new Map,Y=0;function Ne(){if(Y>0)throw new Error("Style registry mutation is forbidden while a Style input is undergoing admission")}function de(e){Y++;try{return e()}finally{Y--}}function Ie(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function je(e){let n=new WeakMap,t=new WeakSet,i=new Set(["__proto__","prototype","constructor"]),r=0,o=0,s=(a,l)=>{if(l>d.maxDepth)throw new TypeError(`Style input exceeds maximum nesting depth ${d.maxDepth}`);if(r++,r>d.maxNodes)throw new TypeError(`Style input exceeds the ${d.maxNodes}-node limit`);if(typeof a=="string"){if(o+=a.length,o>d.maxAggregateTextCharacters)throw new TypeError(`Style input exceeds the ${d.maxAggregateTextCharacters}-character text limit`);return a}if(typeof a!="object"||a===null)return a;if(t.has(a))throw new TypeError("Style input must be acyclic");let c=n.get(a);if(c!==void 0)return c;if(Array.isArray(a)){if(a.length>d.maxItemsPerContainer)throw new TypeError(`Style array must contain at most ${d.maxItemsPerContainer} items`);let p=[];n.set(a,p),t.add(a);for(let y=0;y<a.length;y++){if(!Object.prototype.hasOwnProperty.call(a,y))throw new TypeError("Style arrays must not be sparse");p.push(s(a[y],l+1))}return t.delete(a),Object.freeze(p)}if(!Ie(a))return a;let f=Object.entries(a);if(f.length>d.maxItemsPerContainer)throw new TypeError(`Style object must contain at most ${d.maxItemsPerContainer} properties`);let b=Object.create(null);n.set(a,b),t.add(a);for(let[p,y]of f){if(i.has(p))throw new TypeError(`Style input uses forbidden key "${p}"`);if(o+=p.length,o>d.maxAggregateTextCharacters)throw new TypeError(`Style input exceeds the ${d.maxAggregateTextCharacters}-character text limit`);Object.defineProperty(b,p,{value:s(y,l+1),enumerable:!0,writable:!1,configurable:!1})}return t.delete(a),Object.freeze(b)};return s(e,0)}function we(e){let n=je(e),t=A(n);if(t.length)throw new Error(`Invalid style spec: ${t.join("; ")}`);return n}function K(e){if(e)return Object.freeze(Object.fromEntries(Object.entries(e).map(([n,t])=>[n,Object.freeze({...t})])))}function M(e){if(e)return Object.freeze(Object.fromEntries(Object.entries(e).map(([n,t])=>[n,Object.freeze({...t})])))}function E(e){return e?Object.freeze(e.map(n=>Object.freeze({...n}))):void 0}function N(e){if(!e)return;let{displayLabel:n,...t}=e;return Object.freeze({...t,formatVersion:O,...t.colors?{colors:Object.freeze({...t.colors})}:{},...t.roles?{roles:K(t.roles)}:{},...t.semanticSlots?{semanticSlots:M(t.semanticSlots)}:{},...t.bindings?{bindings:E(t.bindings)}:{},...t.constraints?{constraints:E(t.constraints)}:{}})}function ve(e,n,t){return G({id:e,kind:n,version:t.version??se,compatibility:{...le,...t.compatibility},provenance:t.provenance??_e})}function $e(e,n,t,i){let r=e.name,o=Object.freeze({...e,formatVersion:O,...e.colors?{colors:Object.freeze({...e.colors})}:{},...e.roles?{roles:K(e.roles)}:{},...e.semanticSlots?{semanticSlots:M(e.semanticSlots)}:{},...e.bindings?{bindings:E(e.bindings)}:{},...e.constraints?{constraints:E(e.constraints)}:{}}),s=ve(r,n,t);if(X(m,{identity:s,value:o}),i!==void 0){let a=C.get(i),l=m.has(i)&&i!==r?i:void 0;if(a!==void 0||l!==void 0)throw m.delete(r),new Error(`Style input name "${i}" already selects "${a??l}"`);C.set(i,r)}return()=>{if(Ne(),m.get(r)?.identity!==s)return!1;let l=m.delete(r);return l&&i!==void 0&&C.get(i)===r&&C.delete(i),l}}function u(e,n="look",t=e.name??""){if(!e.name)throw new Error("registerBuiltInStyle requires a name");let i=e.name,r=B(n,i),o=A(N({...e,name:r}));if(o.length)throw new Error(`Invalid built-in style "${r}": ${o.join("; ")}`);$e({...e,name:r},n,{version:se,compatibility:le,provenance:Te},t)}function ce(e){return m.has(e)?e:C.get(e)}function fn(e){let n=ce(e);if(!n)return;let t=N(m.get(n)?.value);if(t)return Object.freeze({canonicalId:n,spec:t})}function Ae(){return Fe().map(e=>e.inputName)}function Fe(){return Object.freeze(Array.from(m.values(),({identity:e,value:n})=>{let t=Array.from(C.entries()).find(([,o])=>o===e.id)?.[0]??e.id,i=e.id.slice(e.id.indexOf(":")+1),r=n.displayLabel??i.split("-").filter(Boolean).map(o=>o==="ops"?"OPS":o.charAt(0).toUpperCase()+o.slice(1)).join(" ");return Object.freeze({identity:e,spec:N(n),inputName:t,displayLabel:r,kind:e.kind,isDefault:e.id==="look:crisp"})}))}function _(e){return e.stroke==="freehand"||e.fill==="wash"?"hybrid":e.stroke==="jittered"||e.fill==="hachure"||e.backdrop!==void 0&&e.backdrop!=="plain"||e.roughness!==void 0||e.bowing!==void 0||e.passes!==void 0||e.hachureGap!==void 0||e.hachureAngle!==void 0||e.fillWeight!==void 0?"rough":"default"}function Pe(e,n){if(!e&&!n)return;let t={...e},i=t;for(let[r,o]of Object.entries(n??{}))o!==void 0&&(i[r]={...i[r],...o});return t}function Be(e,n){if(!e&&!n)return;let t={...e};for(let[i,r]of Object.entries(n??{}))t[i]={...t[i],...r};return t}function ae(e,n){if(!e&&!n)return;let t=[],i=new Set;for(let r of[...e??[],...n??[]]){let o=JSON.stringify(r);i.has(o)||(i.add(o),t.push(r))}return t}function ue(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],t=[];for(let r of n)if(typeof r=="string"){let o=ce(r);if(o==="look:crisp")continue;let s=o?m.get(o)?.value:void 0;if(!s)throw new Error(`Unknown style "${r}". Known styles: ${Ae().join(", ")}`);t.push(s)}else t.push(we(r));if(t.length===0)return;let i={formatVersion:O};for(let r of t)for(let[o,s]of Object.entries(r))if(s!==void 0)if(o==="colors"){let a={...i.colors};for(let[l,c]of Object.entries(r.colors??{}))c!==void 0&&(a[l]=c);i.colors=a}else o==="roles"?i.roles=Pe(i.roles,r.roles):o==="semanticSlots"?i.semanticSlots=Be(i.semanticSlots,r.semanticSlots):o==="bindings"?i.bindings=ae(i.bindings,r.bindings):o==="constraints"?i.constraints=ae(i.constraints,r.constraints):i[o]=s;return i}function pn(e){return de(()=>{let n=ue(e);return n&&fe(n),N(n)})}function Le(e){return e?{...e}:void 0}function De(e){let n=e.strokeWidth,t=e.roles?Object.fromEntries(Object.entries(e.roles).map(([s,a])=>[s,Le(a)])):void 0,i={...n!==void 0&&n>0&&_(e)==="default"?{lineWidth:n}:{},...t?.node},r={...n!==void 0&&n>0&&_(e)==="default"?{lineWidth:n}:{},...t?.edge},o={...n!==void 0&&n>0&&_(e)==="default"?{lineWidth:n}:{},...t?.group};if(!(!t&&!e.semanticSlots&&!e.bindings&&!e.constraints&&Object.keys(i).length===0&&Object.keys(r).length===0&&Object.keys(o).length===0))return{...t?{roles:K(t)}:{},...e.semanticSlots?{semanticSlots:M(e.semanticSlots)}:{},...e.bindings?{bindings:E(e.bindings)}:{},...e.constraints?{constraints:E(e.constraints)}:{},...t?.label?{text:{...t.label}}:{},...Object.keys(i).length?{node:i}:{},...Object.keys(r).length?{edge:r}:{},...Object.keys(o).length?{group:o}:{}}}function ze(e,n){let t=n[e.channel];return Array.isArray(t)?t.includes(e.value):String(t??"")===e.value}function mn(e,n,t={},i={}){let r=R.find(f=>f.role===n),o=e?.roles,s=i.includeFallback===!1?void 0:r?o?.[r.style.fallbackRole]:void 0,a=o?.[n],l=s||a?{...s,...a}:void 0,c=new Set(r?.style.applicableProperties??[]);for(let f of e?.bindings??[]){if(f.role!==void 0&&f.role!==n||!ze(f,t))continue;let b=e?.semanticSlots?.[f.slot];if(!b)continue;let p=Object.fromEntries(Object.entries(b).filter(([y])=>c.has(y)));l={...l,...p}}return l?Object.freeze(l):void 0}function fe(e){for(let[o,s]of(e.bindings??[]).entries()){let a=e.semanticSlots?.[s.slot];if(!a)throw new Error(`Invalid style spec: binding ${o+1} references missing semantic slot "${s.slot}"`);let l=s.role===void 0?new Set(j):new Set(R.find(c=>c.role===s.role).style.applicableProperties);if(!Object.keys(a).some(c=>l.has(c)))throw new Error(s.role===void 0?`Invalid style spec: semantic slot "${s.slot}" has no field applicable to any executable category-binding role`:`Invalid style spec: semantic slot "${s.slot}" has no field applicable to role "${s.role}"`)}let t=["hachureAngle","hachureGap","fillWeight"].filter(o=>e[o]!==void 0&&e.fill!=="hachure");if(t.length>0)throw new Error(`Invalid style spec: ${t.map(o=>`"${o}"`).join(", ")} require fill "hachure" in the final Style stack`);let r=["washOpacity","washEdge"].filter(o=>e[o]!==void 0&&e.fill!=="wash");if(r.length>0)throw new Error(`Invalid style spec: ${r.map(o=>`"${o}"`).join(", ")} require fill "wash" in the final Style stack`);if(e.fill!==void 0&&_(e)==="default")throw new Error('Invalid style spec: "fill" has no crisp/default backend projection; combine it with stroke "jittered"/"freehand" or another rough/hybrid backend field')}function yn(e){return de(()=>{let n=ue(e);if(n===void 0)return{};fe(n);let t=N(n),i=De(n);return{...t?{style:t}:{},...i?{face:i}:{}}})}function gn(e){return _(e)!=="default"||e.colors!==void 0||e.font!==void 0||e.strokeWidth!==void 0||e.roles!==void 0||e.semanticSlots!==void 0||e.bindings!==void 0||e.constraints!==void 0}u({name:"crisp",displayLabel:"Crisp",blurb:"The default renderer with precise SVG geometry.",stroke:"crisp"},"look");for(let e of ie){let{inputName:n,colors:t}=e;if(B("palette",n)!==e.id)throw new Error(`Built-in palette identity mismatch: ${e.id}`);u({name:n,displayLabel:e.displayLabel,blurb:`Palette: ${n}.`,colors:{bg:t.bg,fg:t.fg,line:t.line,accent:t.accent,muted:t.muted,surface:t.surface,border:t.border}},"palette",n)}u({name:"hand-drawn",displayLabel:"Hand-drawn",blurb:"Black ink on ruled paper \u2014 wobbly double strokes, unfilled boxes.",intent:"draft",colors:{bg:"#f7f5ef",fg:"#1a1a1e",line:"#26262b",accent:"#26262b",border:"#26262b"},font:"Caveat",stroke:"jittered",roughness:1,bowing:1,passes:2,strokeWidth:1.8,fill:"none",backdrop:"paper-ruled",mono:!0});u({name:"excalidraw",displayLabel:"Excalidraw",blurb:"Virtual whiteboard style \u2014 rough strokes, pastel hachure fills.",intent:"draft",colors:{bg:"#ffffff",fg:"#1e1e1e",line:"#1e1e1e",accent:"#4263eb",surface:"#f1f3f5"},font:"Caveat",stroke:"jittered",roughness:1.1,bowing:1.2,passes:2,strokeWidth:1.6,fill:"hachure",hachureAngle:-41,hachureGap:5.5,fillWeight:.9});u({name:"pen-and-ink",displayLabel:"Pen & ink",blurb:"Fine single-pass linework on warm cream \u2014 no interior hatching.",intent:"premium",colors:{bg:"#faf6ec",fg:"#241f1a",line:"#2b241d",accent:"#2b241d",border:"#2b241d"},font:"EB Garamond",stroke:"jittered",roughness:.5,bowing:.6,passes:1,strokeWidth:1.5,fill:"none",mono:!0});u({name:"freehand",displayLabel:"Freehand",blurb:"Pressure-sensitive marker ribbons \u2014 variable-width filled strokes.",intent:"draft",colors:{bg:"#fbfaf7",fg:"#16161a",line:"#1d1d22",accent:"#1d1d22",border:"#1d1d22"},font:"Architects Daughter",stroke:"freehand",roughness:.9,passes:1,strokeWidth:1.6,fill:"none",mono:!0});u({name:"watercolor",displayLabel:"Watercolor",blurb:"Rough outlines over translucent glazes with pigment-pooled edges.",intent:"premium",colors:{bg:"#fdfbf6",fg:"#31302c",line:"#4d4a44",accent:"#7a6a52",surface:"#ead9b9",border:"#5a564e"},font:"Caveat",stroke:"jittered",roughness:.9,bowing:.8,passes:1,strokeWidth:1.5,fill:"wash",washOpacity:.3,washEdge:.34});u({name:"blueprint",displayLabel:"Blueprint",blurb:"Cyanotype: white linework on Prussian blue with a drafting grid.",intent:"premium",colors:{bg:"#123a63",fg:"#eaf2fb",line:"#dbe9f7",accent:"#ffffff",muted:"#b8cfe6",surface:"#1c4a78",border:"#dbe9f7"},font:"Share Tech Mono",stroke:"jittered",roughness:.4,bowing:.4,passes:1,strokeWidth:1.4,fill:"none",backdrop:"grid",mono:!0});u({name:"tufte",displayLabel:"Tufte",blurb:"Maximal data-ink: crisp hairlines, warm paper, one red accent.",intent:"premium",colors:{bg:"#fffff8",fg:"#111111",line:"#4a4a45",accent:"#a00000",muted:"#6b6b64",border:"#8a8a80"},font:"EB Garamond",roles:{node:{lineWidth:.8,cornerRadius:0},edge:{lineWidth:.8},group:{lineWidth:.8}},mono:!0},"look","look:tufte");u({name:"accessible-high-contrast",displayLabel:"Accessible Contrast",blurb:"Accessibility-first: large labels, heavy strokes, white ground, colorblind-safe blue accent.",intent:"premium",colors:{bg:"#ffffff",fg:"#050505",line:"#111111",accent:"#005fcc",muted:"#333333",surface:"#ffffff",border:"#050505"},roles:{node:{fontSize:17,fontWeight:700,textColor:"var(--fg)",paddingX:28,paddingY:16,cornerRadius:8,lineWidth:2.4,borderColor:"var(--fg)"},edge:{fontSize:14,fontWeight:700,textColor:"var(--fg)",lineWidth:2.6,bendRadius:10,strokeColor:"var(--fg)"},group:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:22,cornerRadius:8,lineWidth:2.2,borderColor:"var(--fg)"}}});u({name:"patent-drawing",displayLabel:"Patent Hatching",blurb:"Print-safe patent figure: uniform ink, strong outlines, tone via oblique hatching.",intent:"premium",colors:{bg:"#ffffff",fg:"#111111",line:"#111111",accent:"#111111",muted:"#444444",surface:"#ffffff",border:"#111111"},font:"EB Garamond",stroke:"jittered",roughness:.3,bowing:.2,passes:1,strokeWidth:1.35,fill:"hachure",hachureAngle:-50,hachureGap:7,fillWeight:.65,roles:{node:{fontSize:14,fontWeight:600,textColor:"var(--fg)",paddingX:24,paddingY:13,lineWidth:1.35,cornerRadius:0,borderColor:"var(--fg)"},edge:{fontSize:12,textColor:"var(--fg)",lineWidth:1.45,bendRadius:0,strokeColor:"var(--fg)"},group:{fontSize:12,fontWeight:700,textColor:"var(--fg)",paddingX:22,paddingY:18,lineWidth:1.35,cornerRadius:0,borderColor:"var(--fg)"}},mono:!0});u({name:"status-dashboard",displayLabel:"Dark Ops Dashboard",blurb:"Operational dashboard: dark surface, rounded modules, bright status-friendly accent.",intent:"premium",colors:{bg:"#08111f",fg:"#e6f4ff",line:"#5a7c99",accent:"#2dd4bf",muted:"#8aa6bf",surface:"#102033",border:"#2e4c63"},roles:{node:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:13,cornerRadius:10,lineWidth:1.4,borderColor:"var(--fg)"},edge:{fontSize:12,fontWeight:600,textColor:"var(--fg)",lineWidth:2,bendRadius:14,strokeColor:"var(--fg)"},group:{fontSize:13,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.06,paddingX:22,paddingY:20,cornerRadius:10,lineWidth:1.3,borderColor:"var(--fg)"}}});u({name:"ops-schematic",displayLabel:"Compact Trace Map",blurb:"Dense operational schematic: compact mono labels, sturdy traces, theme-friendly geometry.",intent:"lofi",colors:{bg:"#f8faf7",fg:"#17211c",line:"#24523b",accent:"#0f766e",muted:"#4f665a",surface:"#f0f5ef",border:"#24523b"},font:"Share Tech Mono",stroke:"jittered",roughness:.18,bowing:.2,passes:1,strokeWidth:1.6,fill:"none",roles:{node:{fontSize:12,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",paddingX:16,paddingY:8,cornerRadius:2,lineWidth:1.6,borderColor:"var(--fg)"},edge:{fontSize:10,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",lineWidth:1.8,bendRadius:0,strokeColor:"var(--fg)"},group:{fontSize:11,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.05,paddingX:16,paddingY:16,cornerRadius:2,lineWidth:1.5,borderColor:"var(--fg)"}}});u({name:"chalkboard",displayLabel:"Chalkboard",blurb:"Classroom chalkboard: dusty off-white strokes on green slate.",intent:"draft",colors:{bg:"#17362f",fg:"#f5f1df",line:"#ece6cf",accent:"#ffe08a",muted:"#c7d2c4",surface:"#17362f",border:"#f3ecd5"},font:"Caveat",stroke:"jittered",roughness:1.25,bowing:1,passes:2,strokeWidth:1.9,fill:"none",roles:{node:{fontSize:16,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:12,borderColor:"var(--fg)"},edge:{fontSize:13,textColor:"var(--fg)",lineWidth:1.8,strokeColor:"var(--fg)"},group:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:20,paddingY:20,lineWidth:1.7,borderColor:"var(--fg)"}},mono:!0});u({name:"risograph",displayLabel:"Riso Print",blurb:"Two-ink poster print: warm stock, offset blue linework, coral accent, coarse hachure.",intent:"premium",colors:{bg:"#fff5df",fg:"#2b2725",line:"#1f3d5a",accent:"#ff5a5f",muted:"#876a52",surface:"#ffd166",border:"#1f3d5a"},font:"EB Garamond",stroke:"jittered",roughness:.7,bowing:.55,passes:1,strokeWidth:1.5,fill:"hachure",hachureAngle:18,hachureGap:6.5,fillWeight:.75,roles:{node:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:13,cornerRadius:3,borderColor:"var(--fg)"},edge:{fontSize:12,textColor:"var(--fg)",lineWidth:1.5,strokeColor:"var(--fg)"},group:{fontSize:13,fontWeight:700,textColor:"var(--fg)",paddingX:22,paddingY:18,cornerRadius:3,borderColor:"var(--fg)"}}});u({name:"architectural-plan",displayLabel:"Plan Drafting",blurb:"Architectural plan: square technical linework, uppercase mono labels, room-like frames.",intent:"premium",colors:{bg:"#fbf7ea",fg:"#202a2f",line:"#38535e",accent:"#1f6f8b",muted:"#60727a",surface:"#fffaf0",border:"#38535e"},font:"Share Tech Mono",stroke:"jittered",roughness:.18,bowing:.25,passes:1,strokeWidth:1.45,fill:"none",roles:{node:{fontSize:12,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",paddingX:20,paddingY:10,cornerRadius:0,lineWidth:1.45,borderColor:"var(--fg)"},edge:{fontSize:10,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",lineWidth:1.55,bendRadius:0,strokeColor:"var(--fg)"},group:{fontSize:11,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.06,paddingX:20,paddingY:20,cornerRadius:0,lineWidth:1.45,borderColor:"var(--fg)"}}});u({name:"publication-figure",displayLabel:"Report Figure",blurb:"Polished publication figure: serif labels, confident rules, rounded boxes, one quiet accent.",intent:"premium",colors:{bg:"#fffdf8",fg:"#171512",line:"#24211d",accent:"#1d4ed8",muted:"#5f5a52",surface:"#faf5ea",border:"#24211d"},font:"EB Garamond",strokeWidth:1.45,roles:{node:{fontSize:15,fontWeight:700,textColor:"var(--fg)",paddingX:26,paddingY:14,cornerRadius:7,lineWidth:1.45,borderColor:"var(--fg)"},edge:{fontSize:12,fontWeight:600,textColor:"var(--fg)",lineWidth:1.45,bendRadius:8,strokeColor:"var(--fg)"},group:{fontSize:12,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.08,paddingX:24,paddingY:22,cornerRadius:7,lineWidth:1.35,borderColor:"var(--fg)"}}});export{xe as a,fn as b,_ as c,pn as d,mn as e,yn as f,gn as g};
1
+ import{a as d,f as V}from"./chunk-FFOHLPDA.js";import{B as P,C as q,E as J,T as B,U as G,V as X,W as g,X as I,Y as h,Z as j,_ as R}from"./chunk-EX6TP7QM.js";var x=Object.freeze({contrast:Object.freeze({properties:Object.freeze({role:Object.freeze({kind:"role"}),minimum:Object.freeze({kind:"number",minimum:1,maximum:21})}),recovery:"Choose an authored text/surface pair that meets the requested ratio, or remove the rule; the renderer will not repaint it."}),"accent-area":Object.freeze({properties:Object.freeze({maxFraction:Object.freeze({kind:"number",minimum:0,maximum:1,required:!0})}),recovery:"Reduce authored accent-filled area or raise the declared maximum; the renderer will not rewrite fills."}),"mono-role":Object.freeze({properties:Object.freeze({role:Object.freeze({kind:"role",required:!0})}),recovery:"Use measurable monochrome paint for the named role or remove the rule; the renderer will not rewrite paint."})}),k=Object.freeze(Object.keys(x));function w(e){return x[e].properties}function U(e){return Object.freeze(["kind","action",...Object.keys(x[e].properties)])}function H(e){let n=w(e);return Object.freeze(["kind","action",...Object.entries(n).filter(([,t])=>t.required===!0).map(([t])=>t)])}var We=Object.freeze({warn:Object.freeze({code:"BRAND_CONSTRAINT_WARNING",severity:"warning",tier:"lint"}),error:Object.freeze({code:"BRAND_CONSTRAINT_ERROR",severity:"error",tier:"lint"})});var O=1;function D(e){if(typeof e!="object"||e===null||Object.isFrozen(e))return e;for(let n of Object.values(e))D(n);return Object.freeze(e)}var v=D({bg:{description:"Diagram page background."},fg:{description:"Primary text and foreground paint."},line:{description:"Connector and secondary line paint."},accent:{description:"Accent paint for emphasis and data series."},muted:{description:"Muted text and secondary data paint."},surface:{description:"Node and group surface fill."},border:{description:"Node and group border paint."}}),$=Object.freeze(["category"]),T=D({formatVersion:{kind:"const",value:O,group:"metadata",description:"Persisted wire-format version. Optional on input and normalized to 1 on output."},$schema:{kind:"string",group:"metadata",description:"Optional JSON Schema pointer for file-backed styles; ignored while rendering."},name:{kind:"string",group:"metadata",description:"Canonical look:name or palette:name identity; required only when registering a style."},blurb:{kind:"string",group:"metadata",description:"Short human-readable description used by discovery surfaces."},colors:{kind:"colors",group:"palette",description:"Partial palette of safe, non-fetching CSS color tokens."},font:{kind:"string",runtimeValidator:"safeCssFontFamily",group:"typography",description:"Safe, non-fetching CSS font family or stack; the rendering environment supplies the font face."},roles:{kind:"roles",group:"roles",description:"Partial semantic SceneRole defaults. Family-authored styling remains authoritative."},semanticSlots:{kind:"semanticSlots",group:"policy",description:"Named brand-neutral role-style slots selected by semantic bindings."},bindings:{kind:"bindings",group:"policy",description:"Ordered equality bindings from authored/domain meaning to semantic slots."},constraints:{kind:"constraints",group:"policy",description:"Closed inspect-only brand constraints with warn or error actions."},stroke:{kind:"enum",values:["crisp","jittered","freehand"],group:"stroke",description:"Stroke treatment; crisp is the default renderer."},roughness:{kind:"number",minimum:0,maximum:10,expected:"between 0 and 10",group:"stroke",description:"Rough.js stroke irregularity."},bowing:{kind:"number",minimum:0,maximum:10,expected:"between 0 and 10",group:"stroke",description:"Rough.js line bowing."},passes:{kind:"integer",minimum:1,maximum:8,expected:"an integer from 1 through 8",group:"stroke",description:"Number of sketch strokes; 1 is single-pass and 2 is the usual double stroke."},strokeWidth:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20",group:"stroke",description:"Base stroke width in SVG user units."},fill:{kind:"enum",values:["none","hachure","solid","wash"],group:"fill",description:"Fill policy for rough/hybrid rendering; none and solid require a final stack that activates one of those backends."},hachureAngle:{kind:"number",minimum:-360,maximum:360,expected:"between -360 and 360",group:"fill",description:"Hachure line angle in degrees; requires fill hachure in the final stack."},hachureGap:{kind:"number",exclusiveMinimum:0,maximum:100,expected:"greater than 0 and at most 100",group:"fill",description:"Gap between hachure lines; requires fill hachure in the final stack."},fillWeight:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20",group:"fill",description:"Hachure line weight; requires fill hachure in the final stack."},washOpacity:{kind:"number",minimum:0,maximum:1,expected:"between 0 and 1",group:"fill",description:"Watercolor glaze opacity; requires fill wash in the final stack."},washEdge:{kind:"number",minimum:0,maximum:1,expected:"between 0 and 1",group:"fill",description:"Watercolor edge-darkening opacity; requires fill wash in the final stack."},backdrop:{kind:"enum",values:["plain","paper-ruled","grid"],group:"page",description:"Flat page furniture drawn behind the diagram."},intent:{kind:"enum",values:["premium","draft","lofi"],group:"advisory",description:"Advisory intent metadata for pickers and quality tooling."},mono:{kind:"boolean",group:"advisory",description:"Advisory monochrome contract: express tone through shading and weight."}});function S(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function z(e,n){return!(typeof e!="number"||!Number.isFinite(e)||n.kind==="integer"&&!Number.isInteger(e)||n.minimum!==void 0&&e<n.minimum||n.exclusiveMinimum!==void 0&&e<=n.exclusiveMinimum||n.maximum!==void 0&&e>n.maximum)}var me=Object.freeze(["--bg","--fg","--_text","--_text-sec","--_text-muted","--_text-faint","--_line","--_arrow","--_node-fill","--_node-stroke","--_group-fill","--_group-hdr","--_inner-stroke","--_key-badge"]),ye=new Set(me);function ge(e){return typeof e!="string"||J(e)===void 0?!1:[...e.matchAll(/var\(\s*(--[a-z0-9_-]+)/gi)].map(t=>t[1]).every(t=>ye.has(t))}var W=new Map(R.map(e=>[e.role,e])),ee=I.map(e=>W.get(e)),Se=new Set(h),be=/^[A-Za-z][A-Za-z0-9._-]{0,63}$/,L=new Set(["__proto__","constructor","prototype"]);function ne(e,n,t){if(!S(e))return[`"${n}" must be an object`];let i=[];for(let[r,o]of Object.entries(e)){if(!Object.hasOwn(g,r)){i.push(`unknown role style field "${n.slice(n.indexOf(".")+1)}.${r}"`);continue}if(t&&!t.has(r)){i.push(`role style field "${n}.${r}" is not applicable`);continue}let s=g[r],a=`${n}.${r}`;o!==void 0&&(s.kind==="number"&&!z(o,s)?i.push(`"${a}" must be ${s.expected}`):s.kind==="font"&&(typeof o!="string"||P(o)===void 0)?i.push(`"${a}" must be a safe non-fetching CSS font family or stack`):s.kind==="color"&&!ge(o)?i.push(`"${a}" must be a safe non-fetching CSS paint`):s.kind==="enum"&&(typeof o!="string"||!s.values.includes(o))&&i.push(`"${a}" must be one of ${s.values.join(" | ")}`))}return i}function he(e){if(!S(e))return['"roles" must be an object of SceneRole records'];let n=[];for(let[t,i]of Object.entries(e)){let r=W.get(t);if(!r){n.push(`unknown scene role "${t}"`);continue}if(r.traits.styleConsumption==="fallback-only"){n.push(`scene role "${t}" is fallback-only; set roles.${r.style.fallbackRole} instead`);continue}let o=new Set(r.style.applicableProperties),s=ne(i,`roles.${t}`,o).map(a=>a===`"roles.${t}" must be an object`?a:a.replace(`role style field "roles.${t}.`,`role style field "${t}.`).replace('" is not applicable',`" is not applicable to ${t} roles`));n.push(...s)}return n}function te(e){return typeof e=="string"&&be.test(e)&&!L.has(e)}function Re(e){if(!S(e))return['"semanticSlots" must be an object of named role-style slots'];if(Object.keys(e).length>d.maxItemsPerContainer)return[`"semanticSlots" must contain at most ${d.maxItemsPerContainer} slots`];let n=[];for(let[t,i]of Object.entries(e)){if(!te(t)){n.push(`invalid semantic slot name "${t}"`);continue}n.push(...ne(i,`semanticSlots.${t}`))}return n}function ke(e){if(!Array.isArray(e))return['"bindings" must be an array'];if(e.length>d.maxItemsPerContainer)return[`"bindings" must contain at most ${d.maxItemsPerContainer} entries`];let n=[];return e.forEach((t,i)=>{let r=`bindings[${i}]`;if(!S(t)){n.push(`"${r}" must be an object`);return}for(let o of Object.keys(t))["channel","value","slot","role"].includes(o)||n.push(`unknown binding field "${r}.${o}"`);(typeof t.channel!="string"||!$.includes(t.channel))&&n.push(`"${r}.channel" must be one of ${$.join(" | ")}`),(typeof t.value!="string"||t.value.length===0||t.value.length>256||/[\r\n\0]/.test(t.value))&&n.push(`"${r}.value" must be a non-empty single-line string of at most 256 characters`),te(t.slot)||n.push(`"${r}.slot" must be a valid semantic slot name`),t.role!==void 0&&!Se.has(t.role)&&n.push(`"${r}.role" must be a SceneRole with an executable category-binding consumer (${h.join(" | ")})`)}),n}function Oe(e){if(!Array.isArray(e))return['"constraints" must be an array'];if(e.length>d.maxItemsPerContainer)return[`"constraints" must contain at most ${d.maxItemsPerContainer} entries`];let n=[];return e.forEach((t,i)=>{let r=`constraints[${i}]`;if(!S(t)){n.push(`"${r}" must be an object`);return}if(typeof t.kind!="string"||!k.includes(t.kind)){n.push(`"${r}.kind" must be one of ${k.join(" | ")}`);return}let o=t.kind,s=w(o),a=new Set(U(o));for(let l of Object.keys(t))a.has(l)||n.push(`unknown constraint field "${r}.${l}"`);t.action!=="warn"&&t.action!=="error"&&n.push(`"${r}.action" must be one of warn | error`);for(let[l,c]of Object.entries(s)){let f=t[l];if(f===void 0){c.required&&n.push(`"${r}.${l}" is required for ${o}`);continue}c.kind==="role"&&!W.has(f)?n.push(`"${r}.${l}" must be a registered built-in SceneRole`):c.kind==="number"&&!z(f,c)&&n.push(`"${r}.${l}" must be between ${c.minimum} and ${c.maximum}`)}}),n}function A(e){if(!S(e))return["style spec must be a plain object"];if(Object.keys(e).length>d.maxItemsPerContainer)return[`style spec must contain at most ${d.maxItemsPerContainer} fields`];let n=[];for(let[t,i]of Object.entries(e)){if(!Object.hasOwn(T,t)){n.push(`unknown field "${t}"`);continue}let r=T[t];if(i!==void 0)switch(r.kind){case"const":i!==r.value&&n.push(`"${t}" must be ${r.value}`);break;case"string":typeof i!="string"?n.push(`"${t}" must be a string`):r.runtimeValidator==="safeCssFontFamily"&&P(i)===void 0&&n.push(`"${t}" must be a safe non-fetching CSS font family or stack`);break;case"boolean":typeof i!="boolean"&&n.push(`"${t}" must be a boolean`);break;case"number":case"integer":z(i,r)||n.push(`"${t}" must be ${r.expected}`);break;case"enum":(typeof i!="string"||!r.values.includes(i))&&n.push(`"${t}" must be one of ${r.values.join(" | ")}`);break;case"roles":n.push(...he(i));break;case"semanticSlots":n.push(...Re(i));break;case"bindings":n.push(...ke(i));break;case"constraints":n.push(...Oe(i));break;case"colors":{if(!S(i)){n.push('"colors" must be an object of color tokens');break}for(let[o,s]of Object.entries(i))Object.hasOwn(v,o)?s!==void 0&&typeof s!="string"?n.push(`color token "${o}" must be a string`):s!==void 0&&q(s)===void 0&&n.push(`color token "${o}" must be a safe non-fetching CSS color`):n.push(`unknown color token "${o}"`);break}}}return V(n,"Style validation")}function Ce(){return Object.fromEntries(Object.entries(g).map(([e,n])=>{if(n.kind==="number"){let t=n;return[e,{type:"number",...t.minimum!==void 0?{minimum:t.minimum}:{},...t.exclusiveMinimum!==void 0?{exclusiveMinimum:t.exclusiveMinimum}:{},...t.maximum!==void 0?{maximum:t.maximum}:{},description:t.description}]}return n.kind==="enum"?[e,{type:"string",enum:[...n.values],description:n.description}]:[e,{type:"string",description:n.description,"x-agentic-mermaid-runtime-validator":n.kind==="font"?"safeCssFontFamily":"safeStylePaint"}]}))}function Z(e=Object.keys(g)){let n=Ce();return{type:"object",additionalProperties:!1,maxProperties:e.length,properties:Object.fromEntries(e.map(t=>[t,n[t]]))}}function re(e){return`roleStyle-${e.role}`}var Q="^[A-Za-z][A-Za-z0-9._-]{0,63}$";function Ee(e){switch(e.kind){case"const":return{const:e.value,description:e.description};case"string":return{type:"string",description:e.description,...e.runtimeValidator?{"x-agentic-mermaid-runtime-validator":e.runtimeValidator}:{}};case"boolean":return{type:"boolean",description:e.description};case"enum":return{type:"string",enum:[...e.values],description:e.description};case"number":case"integer":return{type:e.kind,...e.minimum!==void 0?{minimum:e.minimum}:{},...e.exclusiveMinimum!==void 0?{exclusiveMinimum:e.exclusiveMinimum}:{},...e.maximum!==void 0?{maximum:e.maximum}:{},description:e.description};case"roles":return{type:"object",additionalProperties:!1,description:e.description,properties:Object.fromEntries(ee.map(n=>[n.role,{$ref:`#/$defs/${re(n)}`}]))};case"semanticSlots":return{type:"object",description:e.description,maxProperties:d.maxItemsPerContainer,propertyNames:{pattern:Q,not:{enum:[...L]}},additionalProperties:{$ref:"#/$defs/roleStyle-any"}};case"bindings":return{type:"array",description:e.description,maxItems:d.maxItemsPerContainer,items:{type:"object",additionalProperties:!1,maxProperties:4,required:["channel","value","slot"],properties:{channel:{type:"string",enum:[...$]},value:{type:"string",minLength:1,maxLength:256,pattern:"^[^\\r\\n\\u0000]+$"},slot:{type:"string",pattern:Q,not:{enum:[...L]}},role:{type:"string",enum:[...h]}}}};case"constraints":{let n={type:"string",enum:["warn","error"]},t={type:"string",enum:R.map(r=>r.role)},i=k.map(r=>{let o=w(r),s=Object.fromEntries(Object.entries(o).map(([a,l])=>[a,l.kind==="role"?t:{type:"number",minimum:l.minimum,maximum:l.maximum}]));return{type:"object",additionalProperties:!1,required:[...H(r)],properties:{kind:{const:r},action:n,...s}}});return{type:"array",description:e.description,maxItems:d.maxItemsPerContainer,items:{oneOf:i}}}case"colors":return{type:"object",additionalProperties:!1,maxProperties:Object.keys(v).length,description:`${e.description} Runtime validation applies the stricter safe-color policy.`,properties:Object.fromEntries(Object.entries(v).map(([n,t])=>[n,{type:"string",description:`${t.description} Must be a safe, non-fetching CSS color.`,"x-agentic-mermaid-runtime-validator":"safeCssColor"}]))}}}function xe(){let e=Object.fromEntries(ee.map(n=>[re(n),Z(n.style.applicableProperties)]));return{$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://agentic-mermaid.dev/schemas/style-spec.schema.json",title:"Agentic Mermaid StyleSpec",description:"A partial declarative style record for Agentic Mermaid rendering. All fields, including formatVersion, are optional on input; resolved and registered specs normalize formatVersion to 1.",type:"object",additionalProperties:!1,maxProperties:Object.keys(T).length,properties:Object.fromEntries(Object.entries(T).map(([n,t])=>[n,Ee(t)])),$defs:{...e,"roleStyle-any":Z()}}}var ie=Object.freeze([{id:"palette:paper",inputName:"paper",displayLabel:"Paper",colors:{bg:"#F5F0E4",fg:"#221E16",accent:"#9A4A24"}},{id:"palette:dusk",inputName:"dusk",displayLabel:"Dusk",colors:{bg:"#2A2521",fg:"#E9DFCC",accent:"#CC8A57"}},{id:"palette:zinc-light",inputName:"zinc-light",displayLabel:"Zinc Light",colors:{bg:"#FFFFFF",fg:"#27272A"}},{id:"palette:zinc-dark",inputName:"zinc-dark",displayLabel:"Zinc Dark",colors:{bg:"#18181B",fg:"#FAFAFA"}},{id:"palette:tokyo-night",inputName:"tokyo-night",displayLabel:"Tokyo Night",colors:{bg:"#1a1b26",fg:"#a9b1d6",line:"#3d59a1",accent:"#7aa2f7",muted:"#565f89"}},{id:"palette:tokyo-night-storm",inputName:"tokyo-night-storm",displayLabel:"Tokyo Night Storm",colors:{bg:"#24283b",fg:"#a9b1d6",line:"#3d59a1",accent:"#7aa2f7",muted:"#565f89"}},{id:"palette:tokyo-night-light",inputName:"tokyo-night-light",displayLabel:"Tokyo Night Light",colors:{bg:"#d5d6db",fg:"#343b58",line:"#34548a",accent:"#34548a",muted:"#9699a3"}},{id:"palette:catppuccin-mocha",inputName:"catppuccin-mocha",displayLabel:"Catppuccin Mocha",colors:{bg:"#1e1e2e",fg:"#cdd6f4",line:"#585b70",accent:"#cba6f7",muted:"#6c7086"}},{id:"palette:catppuccin-latte",inputName:"catppuccin-latte",displayLabel:"Catppuccin Latte",colors:{bg:"#eff1f5",fg:"#4c4f69",line:"#9ca0b0",accent:"#8839ef",muted:"#9ca0b0"}},{id:"palette:nord",inputName:"nord",displayLabel:"Nord",colors:{bg:"#2e3440",fg:"#d8dee9",line:"#4c566a",accent:"#88c0d0",muted:"#616e88"}},{id:"palette:nord-light",inputName:"nord-light",displayLabel:"Nord Light",colors:{bg:"#eceff4",fg:"#2e3440",line:"#aab1c0",accent:"#5e81ac",muted:"#7b88a1"}},{id:"palette:dracula",inputName:"dracula",displayLabel:"Dracula",colors:{bg:"#282a36",fg:"#f8f8f2",line:"#6272a4",accent:"#bd93f9",muted:"#6272a4"}},{id:"palette:github-light",inputName:"github-light",displayLabel:"GitHub Light",colors:{bg:"#ffffff",fg:"#1f2328",line:"#d1d9e0",accent:"#0969da",muted:"#59636e"}},{id:"palette:github-dark",inputName:"github-dark",displayLabel:"GitHub Dark",colors:{bg:"#0d1117",fg:"#e6edf3",line:"#3d444d",accent:"#4493f8",muted:"#9198a1"}},{id:"palette:solarized-light",inputName:"solarized-light",displayLabel:"Solarized Light",colors:{bg:"#fdf6e3",fg:"#657b83",line:"#93a1a1",accent:"#268bd2",muted:"#93a1a1"}},{id:"palette:solarized-dark",inputName:"solarized-dark",displayLabel:"Solarized Dark",colors:{bg:"#002b36",fg:"#839496",line:"#586e75",accent:"#268bd2",muted:"#586e75"}},{id:"palette:one-dark",inputName:"one-dark",displayLabel:"One Dark",colors:{bg:"#282c34",fg:"#abb2bf",line:"#4b5263",accent:"#c678dd",muted:"#5c6370"}},{id:"palette:salmon",inputName:"salmon",displayLabel:"Salmon",colors:{bg:"#FFFBF5",fg:"#521000",line:"#C9A88A",accent:"#FF4801",muted:"#85532E",surface:"#FFFDFB",border:"#D4B89E"}},{id:"palette:salmon-dark",inputName:"salmon-dark",displayLabel:"Salmon Dark",colors:{bg:"#1F1008",fg:"#F5DCC8",line:"#6B4A2E",accent:"#FF6B35",muted:"#A07858",surface:"#2A1810",border:"#5A3A22"}},{id:"palette:tufte-dark",inputName:"tufte-dark",displayLabel:"Tufte Dark",colors:{bg:"#1C1C1A",fg:"#E8E4DC",line:"#666660",accent:"#C87070",muted:"#908880",surface:"#2A2926",border:"#444440"}}]);var F=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor"]),oe=Object.freeze(["paddingX","paddingY","cornerRadius","lineWidth","fillColor","borderColor"]),un=Object.freeze({text:Object.freeze({sourceRole:"label",fields:F}),node:Object.freeze({sourceRole:"node",fields:Object.freeze([...F,...oe])}),edge:Object.freeze({sourceRole:"edge",fields:Object.freeze([...F,"lineWidth","bendRadius","strokeColor"])}),group:Object.freeze({sourceRole:"group",fields:Object.freeze([...F,...oe,"fontFamily","headerFillColor"])})}),se="1.0.0",le=Object.freeze({core:"^0.3.0"}),Te=Object.freeze({owner:"agentic-mermaid",source:"built-in",reference:"src/scene/style-registry.ts"}),_e=Object.freeze({owner:"host",source:"in-process"}),m=new Map,C=new Map,Y=0;function Ne(){if(Y>0)throw new Error("Style registry mutation is forbidden while a Style input is undergoing admission")}function de(e){Y++;try{return e()}finally{Y--}}function Ie(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function je(e){let n=new WeakMap,t=new WeakSet,i=new Set(["__proto__","prototype","constructor"]),r=0,o=0,s=(a,l)=>{if(l>d.maxDepth)throw new TypeError(`Style input exceeds maximum nesting depth ${d.maxDepth}`);if(r++,r>d.maxNodes)throw new TypeError(`Style input exceeds the ${d.maxNodes}-node limit`);if(typeof a=="string"){if(o+=a.length,o>d.maxAggregateTextCharacters)throw new TypeError(`Style input exceeds the ${d.maxAggregateTextCharacters}-character text limit`);return a}if(typeof a!="object"||a===null)return a;if(t.has(a))throw new TypeError("Style input must be acyclic");let c=n.get(a);if(c!==void 0)return c;if(Array.isArray(a)){if(a.length>d.maxItemsPerContainer)throw new TypeError(`Style array must contain at most ${d.maxItemsPerContainer} items`);let p=[];n.set(a,p),t.add(a);for(let y=0;y<a.length;y++){if(!Object.prototype.hasOwnProperty.call(a,y))throw new TypeError("Style arrays must not be sparse");p.push(s(a[y],l+1))}return t.delete(a),Object.freeze(p)}if(!Ie(a))return a;let f=Object.entries(a);if(f.length>d.maxItemsPerContainer)throw new TypeError(`Style object must contain at most ${d.maxItemsPerContainer} properties`);let b=Object.create(null);n.set(a,b),t.add(a);for(let[p,y]of f){if(i.has(p))throw new TypeError(`Style input uses forbidden key "${p}"`);if(o+=p.length,o>d.maxAggregateTextCharacters)throw new TypeError(`Style input exceeds the ${d.maxAggregateTextCharacters}-character text limit`);Object.defineProperty(b,p,{value:s(y,l+1),enumerable:!0,writable:!1,configurable:!1})}return t.delete(a),Object.freeze(b)};return s(e,0)}function we(e){let n=je(e),t=A(n);if(t.length)throw new Error(`Invalid style spec: ${t.join("; ")}`);return n}function K(e){if(e)return Object.freeze(Object.fromEntries(Object.entries(e).map(([n,t])=>[n,Object.freeze({...t})])))}function M(e){if(e)return Object.freeze(Object.fromEntries(Object.entries(e).map(([n,t])=>[n,Object.freeze({...t})])))}function E(e){return e?Object.freeze(e.map(n=>Object.freeze({...n}))):void 0}function N(e){if(!e)return;let{displayLabel:n,...t}=e;return Object.freeze({...t,formatVersion:O,...t.colors?{colors:Object.freeze({...t.colors})}:{},...t.roles?{roles:K(t.roles)}:{},...t.semanticSlots?{semanticSlots:M(t.semanticSlots)}:{},...t.bindings?{bindings:E(t.bindings)}:{},...t.constraints?{constraints:E(t.constraints)}:{}})}function ve(e,n,t){return G({id:e,kind:n,version:t.version??se,compatibility:{...le,...t.compatibility},provenance:t.provenance??_e})}function $e(e,n,t,i){let r=e.name,o=Object.freeze({...e,formatVersion:O,...e.colors?{colors:Object.freeze({...e.colors})}:{},...e.roles?{roles:K(e.roles)}:{},...e.semanticSlots?{semanticSlots:M(e.semanticSlots)}:{},...e.bindings?{bindings:E(e.bindings)}:{},...e.constraints?{constraints:E(e.constraints)}:{}}),s=ve(r,n,t);if(X(m,{identity:s,value:o}),i!==void 0){let a=C.get(i),l=m.has(i)&&i!==r?i:void 0;if(a!==void 0||l!==void 0)throw m.delete(r),new Error(`Style input name "${i}" already selects "${a??l}"`);C.set(i,r)}return()=>{if(Ne(),m.get(r)?.identity!==s)return!1;let l=m.delete(r);return l&&i!==void 0&&C.get(i)===r&&C.delete(i),l}}function u(e,n="look",t=e.name??""){if(!e.name)throw new Error("registerBuiltInStyle requires a name");let i=e.name,r=B(n,i),o=A(N({...e,name:r}));if(o.length)throw new Error(`Invalid built-in style "${r}": ${o.join("; ")}`);$e({...e,name:r},n,{version:se,compatibility:le,provenance:Te},t)}function ce(e){return m.has(e)?e:C.get(e)}function fn(e){let n=ce(e);if(!n)return;let t=N(m.get(n)?.value);if(t)return Object.freeze({canonicalId:n,spec:t})}function Ae(){return Fe().map(e=>e.inputName)}function Fe(){return Object.freeze(Array.from(m.values(),({identity:e,value:n})=>{let t=Array.from(C.entries()).find(([,o])=>o===e.id)?.[0]??e.id,i=e.id.slice(e.id.indexOf(":")+1),r=n.displayLabel??i.split("-").filter(Boolean).map(o=>o==="ops"?"OPS":o.charAt(0).toUpperCase()+o.slice(1)).join(" ");return Object.freeze({identity:e,spec:N(n),inputName:t,displayLabel:r,kind:e.kind,isDefault:e.id==="look:crisp"})}))}function _(e){return e.stroke==="freehand"||e.fill==="wash"?"hybrid":e.stroke==="jittered"||e.fill==="hachure"||e.backdrop!==void 0&&e.backdrop!=="plain"||e.roughness!==void 0||e.bowing!==void 0||e.passes!==void 0||e.hachureGap!==void 0||e.hachureAngle!==void 0||e.fillWeight!==void 0?"rough":"default"}function Pe(e,n){if(!e&&!n)return;let t={...e},i=t;for(let[r,o]of Object.entries(n??{}))o!==void 0&&(i[r]={...i[r],...o});return t}function Be(e,n){if(!e&&!n)return;let t={...e};for(let[i,r]of Object.entries(n??{}))t[i]={...t[i],...r};return t}function ae(e,n){if(!e&&!n)return;let t=[],i=new Set;for(let r of[...e??[],...n??[]]){let o=JSON.stringify(r);i.has(o)||(i.add(o),t.push(r))}return t}function ue(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],t=[];for(let r of n)if(typeof r=="string"){let o=ce(r);if(o==="look:crisp")continue;let s=o?m.get(o)?.value:void 0;if(!s)throw new Error(`Unknown style "${r}". Known styles: ${Ae().join(", ")}`);t.push(s)}else t.push(we(r));if(t.length===0)return;let i={formatVersion:O};for(let r of t)for(let[o,s]of Object.entries(r))if(s!==void 0)if(o==="colors"){let a={...i.colors};for(let[l,c]of Object.entries(r.colors??{}))c!==void 0&&(a[l]=c);i.colors=a}else o==="roles"?i.roles=Pe(i.roles,r.roles):o==="semanticSlots"?i.semanticSlots=Be(i.semanticSlots,r.semanticSlots):o==="bindings"?i.bindings=ae(i.bindings,r.bindings):o==="constraints"?i.constraints=ae(i.constraints,r.constraints):i[o]=s;return i}function pn(e){return de(()=>{let n=ue(e);return n&&fe(n),N(n)})}function Le(e){return e?{...e}:void 0}function De(e){let n=e.strokeWidth,t=e.roles?Object.fromEntries(Object.entries(e.roles).map(([s,a])=>[s,Le(a)])):void 0,i={...n!==void 0&&n>0&&_(e)==="default"?{lineWidth:n}:{},...t?.node},r={...n!==void 0&&n>0&&_(e)==="default"?{lineWidth:n}:{},...t?.edge},o={...n!==void 0&&n>0&&_(e)==="default"?{lineWidth:n}:{},...t?.group};if(!(!t&&!e.semanticSlots&&!e.bindings&&!e.constraints&&Object.keys(i).length===0&&Object.keys(r).length===0&&Object.keys(o).length===0))return{...t?{roles:K(t)}:{},...e.semanticSlots?{semanticSlots:M(e.semanticSlots)}:{},...e.bindings?{bindings:E(e.bindings)}:{},...e.constraints?{constraints:E(e.constraints)}:{},...t?.label?{text:{...t.label}}:{},...Object.keys(i).length?{node:i}:{},...Object.keys(r).length?{edge:r}:{},...Object.keys(o).length?{group:o}:{}}}function ze(e,n){let t=n[e.channel];return Array.isArray(t)?t.includes(e.value):String(t??"")===e.value}function mn(e,n,t={},i={}){let r=R.find(f=>f.role===n),o=e?.roles,s=i.includeFallback===!1?void 0:r?o?.[r.style.fallbackRole]:void 0,a=o?.[n],l=s||a?{...s,...a}:void 0,c=new Set(r?.style.applicableProperties??[]);for(let f of e?.bindings??[]){if(f.role!==void 0&&f.role!==n||!ze(f,t))continue;let b=e?.semanticSlots?.[f.slot];if(!b)continue;let p=Object.fromEntries(Object.entries(b).filter(([y])=>c.has(y)));l={...l,...p}}return l?Object.freeze(l):void 0}function fe(e){for(let[o,s]of(e.bindings??[]).entries()){let a=e.semanticSlots?.[s.slot];if(!a)throw new Error(`Invalid style spec: binding ${o+1} references missing semantic slot "${s.slot}"`);let l=s.role===void 0?new Set(j):new Set(R.find(c=>c.role===s.role).style.applicableProperties);if(!Object.keys(a).some(c=>l.has(c)))throw new Error(s.role===void 0?`Invalid style spec: semantic slot "${s.slot}" has no field applicable to any executable category-binding role`:`Invalid style spec: semantic slot "${s.slot}" has no field applicable to role "${s.role}"`)}let t=["hachureAngle","hachureGap","fillWeight"].filter(o=>e[o]!==void 0&&e.fill!=="hachure");if(t.length>0)throw new Error(`Invalid style spec: ${t.map(o=>`"${o}"`).join(", ")} require fill "hachure" in the final Style stack`);let r=["washOpacity","washEdge"].filter(o=>e[o]!==void 0&&e.fill!=="wash");if(r.length>0)throw new Error(`Invalid style spec: ${r.map(o=>`"${o}"`).join(", ")} require fill "wash" in the final Style stack`);if(e.fill!==void 0&&_(e)==="default")throw new Error('Invalid style spec: "fill" has no crisp/default backend projection; combine it with stroke "jittered"/"freehand" or another rough/hybrid backend field')}function yn(e){return de(()=>{let n=ue(e);if(n===void 0)return{};fe(n);let t=N(n),i=De(n);return{...t?{style:t}:{},...i?{face:i}:{}}})}function gn(e){return _(e)!=="default"||e.colors!==void 0||e.font!==void 0||e.strokeWidth!==void 0||e.roles!==void 0||e.semanticSlots!==void 0||e.bindings!==void 0||e.constraints!==void 0}u({name:"crisp",displayLabel:"Crisp",blurb:"The default renderer with precise SVG geometry.",stroke:"crisp"},"look");for(let e of ie){let{inputName:n,colors:t}=e;if(B("palette",n)!==e.id)throw new Error(`Built-in palette identity mismatch: ${e.id}`);u({name:n,displayLabel:e.displayLabel,blurb:`Palette: ${n}.`,colors:{bg:t.bg,fg:t.fg,line:t.line,accent:t.accent,muted:t.muted,surface:t.surface,border:t.border}},"palette",n)}u({name:"hand-drawn",displayLabel:"Hand-drawn",blurb:"Black ink on ruled paper \u2014 wobbly double strokes, unfilled boxes.",intent:"draft",colors:{bg:"#f7f5ef",fg:"#1a1a1e",line:"#26262b",accent:"#26262b",border:"#26262b"},font:"Caveat",stroke:"jittered",roughness:1,bowing:1,passes:2,strokeWidth:1.8,fill:"none",backdrop:"paper-ruled",mono:!0});u({name:"excalidraw",displayLabel:"Excalidraw",blurb:"Virtual whiteboard style \u2014 rough strokes, pastel hachure fills.",intent:"draft",colors:{bg:"#ffffff",fg:"#1e1e1e",line:"#1e1e1e",accent:"#4263eb",surface:"#f1f3f5"},font:"Caveat",stroke:"jittered",roughness:1.1,bowing:1.2,passes:2,strokeWidth:1.6,fill:"hachure",hachureAngle:-41,hachureGap:5.5,fillWeight:.9});u({name:"pen-and-ink",displayLabel:"Pen & ink",blurb:"Fine single-pass linework on warm cream \u2014 no interior hatching.",intent:"premium",colors:{bg:"#faf6ec",fg:"#241f1a",line:"#2b241d",accent:"#2b241d",border:"#2b241d"},font:"EB Garamond",stroke:"jittered",roughness:.5,bowing:.6,passes:1,strokeWidth:1.5,fill:"none",mono:!0});u({name:"freehand",displayLabel:"Freehand",blurb:"Pressure-sensitive marker ribbons \u2014 variable-width filled strokes.",intent:"draft",colors:{bg:"#fbfaf7",fg:"#16161a",line:"#1d1d22",accent:"#1d1d22",border:"#1d1d22"},font:"Architects Daughter",stroke:"freehand",roughness:.9,passes:1,strokeWidth:1.6,fill:"none",mono:!0});u({name:"watercolor",displayLabel:"Watercolor",blurb:"Rough outlines over translucent glazes with pigment-pooled edges.",intent:"premium",colors:{bg:"#fdfbf6",fg:"#31302c",line:"#4d4a44",accent:"#7a6a52",surface:"#ead9b9",border:"#5a564e"},font:"Caveat",stroke:"jittered",roughness:.9,bowing:.8,passes:1,strokeWidth:1.5,fill:"wash",washOpacity:.3,washEdge:.34});u({name:"blueprint",displayLabel:"Blueprint",blurb:"Cyanotype: white linework on Prussian blue with a drafting grid.",intent:"premium",colors:{bg:"#123a63",fg:"#eaf2fb",line:"#dbe9f7",accent:"#ffffff",muted:"#b8cfe6",surface:"#1c4a78",border:"#dbe9f7"},font:"Share Tech Mono",stroke:"jittered",roughness:.4,bowing:.4,passes:1,strokeWidth:1.4,fill:"none",backdrop:"grid",mono:!0});u({name:"tufte",displayLabel:"Tufte",blurb:"Maximal data-ink: crisp hairlines, warm paper, one red accent.",intent:"premium",colors:{bg:"#fffff8",fg:"#111111",line:"#4a4a45",accent:"#a00000",muted:"#6b6b64",border:"#8a8a80"},font:"EB Garamond",roles:{node:{lineWidth:.8,cornerRadius:0},edge:{lineWidth:.8},group:{lineWidth:.8}},mono:!0},"look","look:tufte");u({name:"accessible-high-contrast",displayLabel:"Accessible Contrast",blurb:"Accessibility-first: large labels, heavy strokes, white ground, colorblind-safe blue accent.",intent:"premium",colors:{bg:"#ffffff",fg:"#050505",line:"#111111",accent:"#005fcc",muted:"#333333",surface:"#ffffff",border:"#050505"},roles:{node:{fontSize:17,fontWeight:700,textColor:"var(--fg)",paddingX:28,paddingY:16,cornerRadius:8,lineWidth:2.4,borderColor:"var(--fg)"},edge:{fontSize:14,fontWeight:700,textColor:"var(--fg)",lineWidth:2.6,bendRadius:10,strokeColor:"var(--fg)"},group:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:22,cornerRadius:8,lineWidth:2.2,borderColor:"var(--fg)"}}});u({name:"patent-drawing",displayLabel:"Patent Hatching",blurb:"Print-safe patent figure: uniform ink, strong outlines, tone via oblique hatching.",intent:"premium",colors:{bg:"#ffffff",fg:"#111111",line:"#111111",accent:"#111111",muted:"#444444",surface:"#ffffff",border:"#111111"},font:"EB Garamond",stroke:"jittered",roughness:.3,bowing:.2,passes:1,strokeWidth:1.35,fill:"hachure",hachureAngle:-50,hachureGap:7,fillWeight:.65,roles:{node:{fontSize:14,fontWeight:600,textColor:"var(--fg)",paddingX:24,paddingY:13,lineWidth:1.35,cornerRadius:0,borderColor:"var(--fg)"},edge:{fontSize:12,textColor:"var(--fg)",lineWidth:1.45,bendRadius:0,strokeColor:"var(--fg)"},group:{fontSize:12,fontWeight:700,textColor:"var(--fg)",paddingX:22,paddingY:18,lineWidth:1.35,cornerRadius:0,borderColor:"var(--fg)"}},mono:!0});u({name:"status-dashboard",displayLabel:"Dark Ops Dashboard",blurb:"Operational dashboard: dark surface, rounded modules, bright status-friendly accent.",intent:"premium",colors:{bg:"#08111f",fg:"#e6f4ff",line:"#5a7c99",accent:"#2dd4bf",muted:"#8aa6bf",surface:"#102033",border:"#2e4c63"},roles:{node:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:13,cornerRadius:10,lineWidth:1.4,borderColor:"var(--fg)"},edge:{fontSize:12,fontWeight:600,textColor:"var(--fg)",lineWidth:2,bendRadius:14,strokeColor:"var(--fg)"},group:{fontSize:13,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.06,paddingX:22,paddingY:20,cornerRadius:10,lineWidth:1.3,borderColor:"var(--fg)"}}});u({name:"ops-schematic",displayLabel:"Compact Trace Map",blurb:"Dense operational schematic: compact mono labels, sturdy traces, theme-friendly geometry.",intent:"lofi",colors:{bg:"#f8faf7",fg:"#17211c",line:"#24523b",accent:"#0f766e",muted:"#4f665a",surface:"#f0f5ef",border:"#24523b"},font:"Share Tech Mono",stroke:"jittered",roughness:.18,bowing:.2,passes:1,strokeWidth:1.6,fill:"none",roles:{node:{fontSize:12,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",paddingX:16,paddingY:8,cornerRadius:2,lineWidth:1.6,borderColor:"var(--fg)"},edge:{fontSize:10,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",lineWidth:1.8,bendRadius:0,strokeColor:"var(--fg)"},group:{fontSize:11,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.05,paddingX:16,paddingY:16,cornerRadius:2,lineWidth:1.5,borderColor:"var(--fg)"}}});u({name:"chalkboard",displayLabel:"Chalkboard",blurb:"Classroom chalkboard: dusty off-white strokes on green slate.",intent:"draft",colors:{bg:"#17362f",fg:"#f5f1df",line:"#ece6cf",accent:"#ffe08a",muted:"#c7d2c4",surface:"#17362f",border:"#f3ecd5"},font:"Caveat",stroke:"jittered",roughness:1.25,bowing:1,passes:2,strokeWidth:1.9,fill:"none",roles:{node:{fontSize:16,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:12,borderColor:"var(--fg)"},edge:{fontSize:13,textColor:"var(--fg)",lineWidth:1.8,strokeColor:"var(--fg)"},group:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:20,paddingY:20,lineWidth:1.7,borderColor:"var(--fg)"}},mono:!0});u({name:"risograph",displayLabel:"Riso Print",blurb:"Two-ink poster print: warm stock, offset blue linework, coral accent, coarse hachure.",intent:"premium",colors:{bg:"#fff5df",fg:"#2b2725",line:"#1f3d5a",accent:"#ff5a5f",muted:"#876a52",surface:"#ffd166",border:"#1f3d5a"},font:"EB Garamond",stroke:"jittered",roughness:.7,bowing:.55,passes:1,strokeWidth:1.5,fill:"hachure",hachureAngle:18,hachureGap:6.5,fillWeight:.75,roles:{node:{fontSize:14,fontWeight:700,textColor:"var(--fg)",paddingX:24,paddingY:13,cornerRadius:3,borderColor:"var(--fg)"},edge:{fontSize:12,textColor:"var(--fg)",lineWidth:1.5,strokeColor:"var(--fg)"},group:{fontSize:13,fontWeight:700,textColor:"var(--fg)",paddingX:22,paddingY:18,cornerRadius:3,borderColor:"var(--fg)"}}});u({name:"architectural-plan",displayLabel:"Plan Drafting",blurb:"Architectural plan: square technical linework, uppercase mono labels, room-like frames.",intent:"premium",colors:{bg:"#fbf7ea",fg:"#202a2f",line:"#38535e",accent:"#1f6f8b",muted:"#60727a",surface:"#fffaf0",border:"#38535e"},font:"Share Tech Mono",stroke:"jittered",roughness:.18,bowing:.25,passes:1,strokeWidth:1.45,fill:"none",roles:{node:{fontSize:12,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",paddingX:20,paddingY:10,cornerRadius:0,lineWidth:1.45,borderColor:"var(--fg)"},edge:{fontSize:10,fontWeight:700,textTransform:"uppercase",textColor:"var(--fg)",lineWidth:1.55,bendRadius:0,strokeColor:"var(--fg)"},group:{fontSize:11,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.06,paddingX:20,paddingY:20,cornerRadius:0,lineWidth:1.45,borderColor:"var(--fg)"}}});u({name:"publication-figure",displayLabel:"Report Figure",blurb:"Polished publication figure: serif labels, confident rules, rounded boxes, one quiet accent.",intent:"premium",colors:{bg:"#fffdf8",fg:"#171512",line:"#24211d",accent:"#1d4ed8",muted:"#5f5a52",surface:"#faf5ea",border:"#24211d"},font:"EB Garamond",strokeWidth:1.45,roles:{node:{fontSize:15,fontWeight:700,textColor:"var(--fg)",paddingX:26,paddingY:14,cornerRadius:7,lineWidth:1.45,borderColor:"var(--fg)"},edge:{fontSize:12,fontWeight:600,textColor:"var(--fg)",lineWidth:1.45,bendRadius:8,strokeColor:"var(--fg)"},group:{fontSize:12,fontWeight:700,textColor:"var(--fg)",textTransform:"uppercase",letterSpacing:.08,paddingX:24,paddingY:22,cornerRadius:7,lineWidth:1.35,borderColor:"var(--fg)"}}});export{xe as a,fn as b,_ as c,pn as d,mn as e,yn as f,gn as g};
@@ -1,4 +1,4 @@
1
- import{a as ne}from"./chunk-5Q4S74UO.js";import{g as I}from"./chunk-PXRUFH7U.js";import{a as q}from"./chunk-M6BT2HIP.js";import{e as A,g as R,h as W,j as L,k as N}from"./chunk-RVO6J7S3.js";import{G as Q,H as O,I as G,N as X,O as p,P as z,Q as K,ea as U,fa as Y,i as E,ia as C,ja as T,ka as P,la as _,na as J,oa as ee,pa as v,qa as te,v as V,xa as re,y as Z,z as B}from"./chunk-FXBBGAMJ.js";function Je(e){let{positioned:s,colors:n,resolved:o}=e,t=o.renderOptions,r=n.font??"Inter",i=t.transparent??!1,$=[],c=o.familyAppearance?.visual??t.stateVisual,a=N(t,c?.styleDefaults,o.styleFace);$.push(te({id:"prelude",width:s.width,height:s.height,colors:n,transparent:i,font:r,hasMonoFont:!1},G(s.width,s.height,n,i)+`
1
+ import{a as ne}from"./chunk-5Q4S74UO.js";import{g as I}from"./chunk-EBPTM2RP.js";import{a as q}from"./chunk-M6BT2HIP.js";import{e as A,g as R,h as W,j as L,k as N}from"./chunk-32FWKUUV.js";import{G as Q,H as O,I as G,N as X,O as p,P as z,Q as K,ea as U,fa as Y,i as E,ia as C,ja as T,ka as P,la as _,na as J,oa as ee,pa as v,qa as te,v as V,xa as re,y as Z,z as B}from"./chunk-EX6TP7QM.js";function Je(e){let{positioned:s,colors:n,resolved:o}=e,t=o.renderOptions,r=n.font??"Inter",i=t.transparent??!1,$=[],c=o.familyAppearance?.visual??t.stateVisual,a=N(t,c?.styleDefaults,o.styleFace);$.push(te({id:"prelude",width:s.width,height:s.height,colors:n,transparent:i,font:r,hasMonoFont:!1},G(s.width,s.height,n,i)+`
2
2
  `+O(r,!1,n.shadow,n.embedFontImport)));let d=[];d.push("<defs>");let l=Q(n);l&&d.push(l);let h=new Set;a.edgeStrokeColor&&h.add(a.edgeStrokeColor);let u=!1,f=!1;for(let m of s.edges)m.inlineStyle?.stroke&&h.add(m.inlineStyle.stroke),(m.startMarker==="circle"||m.endMarker==="circle")&&(u=!0),(m.startMarker==="cross"||m.endMarker==="cross")&&(f=!0);let g=pe(h,u,f);d.splice(1,0,re(g)),d.push("</defs>"),$.push(J({id:"defs",markerResources:g},d.join(`
3
3
  `)));for(let m of s.groups)$.push(j(m,r,a));let x=new Map,S=new Map;for(let m of s.edges){if(m.points.length<2)continue;let y=`${m.source}->${m.target}`,k=x.get(y)??0;x.set(y,k+1);let b=`edge:${y}#${k}`;S.set(m,b),$.push(fe(m,a,b,g))}for(let m of s.edges){let y=S.get(m);m.label&&y&&$.push(ke(m,r,a,he(y)))}for(let m of s.nodes)$.push(be(m,r,a,t.security!=="strict"));for(let m of s.notes??[])$.push(ge(m,r,a));return $.push(ee()),{family:"flowchart",width:s.width,height:s.height,colors:n,transparent:i,parts:$}}function oe(e){let s=R.width,n=R.height,o=s-1,t=e??"var(--_arrow)",r=e?`-${H(e)}`:"",i={fill:t,stroke:t,strokeWidth:"0.75",strokeLinejoin:"round"};return[{id:`arrowhead${r}`,shape:"arrow",size:{width:s,height:n},ref:{x:o,y:n/2},orient:"auto",geometry:{kind:"polygon",points:[{x:0,y:0},{x:s,y:n/2},{x:0,y:n}]},paint:i},{id:`arrowhead-start${r}`,shape:"arrow",size:{width:s,height:n},ref:{x:1,y:n/2},orient:"auto",geometry:{kind:"polygon",points:[{x:s,y:0},{x:0,y:n/2},{x:s,y:n}]},paint:i}]}function ie(e){let s=R.width,n=e?`-${H(e)}`:"",o=e??"var(--_arrow)",t=s/2-.75,r={shape:"circle",size:{width:s,height:s},orient:"auto",geometry:{kind:"circle",cx:s/2,cy:s/2,r:t},paint:{fill:"none",stroke:o,strokeWidth:"1"}};return[{...r,id:`circlehead${n}`,ref:{x:s-.5,y:s/2}},{...r,id:`circlehead-start${n}`,ref:{x:.5,y:s/2}}]}function se(e){let s=R.width,n=e?`-${H(e)}`:"",o=e??"var(--_arrow)",t=1.25,r=t,i=s-t,$={shape:"cross",size:{width:s,height:s},orient:"auto",geometry:{kind:"compound",children:[{kind:"line",x1:r,y1:r,x2:i,y2:i},{kind:"line",x1:r,y1:i,x2:i,y2:r}]},paint:{stroke:o,strokeWidth:"1.25",strokeLinecap:"round"}};return[{...$,id:`crosshead${n}`,ref:{x:i,y:s/2}},{...$,id:`crosshead-start${n}`,ref:{x:t,y:s/2}}]}function pe(e,s,n){let o=[...oe()];s&&o.push(...ie()),n&&o.push(...se());for(let t of e)o.push(...oe(t)),s&&o.push(...ie(t)),n&&o.push(...se(t));return o}function ae(e){return e==="circle"?"circlehead":e==="cross"?"crosshead":"arrowhead"}function H(e){return e.replace(/[^a-zA-Z0-9]/g,s=>s.charCodeAt(0).toString(16))}function j(e,s,n,o){if(e.concurrencyRegion)return v({id:`group:${e.id}`,role:"group",open:`<g class="concurrency-region" data-id="${p(e.id)}"${o?` data-parent-id="${p(o)}"`:""}>`,close:"</g>",children:e.children.map(u=>({indent:0,node:j(u,s,n,e.id)}))});let t=n.groupHeaderFontSize+16,r=[],i=`<g class="subgraph" data-id="${p(e.id)}" data-region="subgraph" data-label="${p(e.label)}"${o?` data-parent-id="${p(o)}"`:""}>`,$=n.groupFillColor??"var(--_group-fill)",c=n.groupBorderColor??"var(--_node-stroke)";r.push({indent:2,node:C({id:`group-rect:${e.id}`,role:"group",geometry:{kind:"rect",x:e.x,y:e.y,width:e.width,height:e.height,rx:n.groupCornerRadius,ry:n.groupCornerRadius},paint:{fill:$,stroke:c,strokeWidth:String(n.groupLineWidth)}},`<rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="${n.groupCornerRadius}" ry="${n.groupCornerRadius}" fill="${p($)}" stroke="${p(c)}" stroke-width="${n.groupLineWidth}" />`)});let a=n.groupHeaderFillColor??"var(--_group-hdr)",d=q(e.x,e.y,e.width,t,n.groupCornerRadius);r.push({indent:2,node:C({id:`group-header:${e.id}`,role:"group-header",geometry:{kind:"path",d},paint:{fill:a,stroke:c,strokeWidth:String(n.groupLineWidth)}},`<path d="${d}" fill="${p(a)}" stroke="${p(c)}" stroke-width="${n.groupLineWidth}" />`)});let l=L(e.label,n.groupTextTransform),h=n.groupTextColor??"var(--_text-sec)";r.push({indent:2,node:P({id:`group-label:${e.id}`,role:"group-header",text:l,x:e.x+n.groupLabelPaddingX,y:e.y+t/2,fontSize:n.groupHeaderFontSize,anchor:"start",paint:{fill:h}},z(l,e.x+n.groupLabelPaddingX,e.y+t/2,n.groupHeaderFontSize,`font-size="${n.groupHeaderFontSize}" font-weight="${n.groupHeaderFontWeight}"${n.groupFont?` font-family="${p(n.groupFont)}"`:""}${n.groupLetterSpacing!==0?` letter-spacing="${n.groupLetterSpacing}"`:""} fill="${p(h)}"`))});for(let u of me(e,t))r.push({indent:2,node:C({id:`region-separator:${e.id}:${u.index}`,role:"group",geometry:{kind:"line",x1:u.x1,y1:u.y1,x2:u.x2,y2:u.y2},paint:{stroke:c,strokeWidth:String(n.groupLineWidth),strokeDasharray:"6 4"}},`<line class="region-separator" x1="${u.x1}" y1="${u.y1}" x2="${u.x2}" y2="${u.y2}" stroke="${p(c)}" stroke-width="${n.groupLineWidth}" stroke-dasharray="6 4" />`)});for(let u of e.children)r.push({indent:0,node:j(u,s,n,e.id)});return v({id:`group:${e.id}`,role:"group",open:i,close:"</g>",children:r})}function me(e,s){let n=e.children.filter(c=>c.concurrencyRegion);if(n.length<2)return[];let o=c=>Math.max(...n.map(c))-Math.min(...n.map(c)),t=o(c=>c.x+c.width/2)>=o(c=>c.y+c.height/2),r=[...n].sort((c,a)=>t?c.x-a.x:c.y-a.y),i=4,$=[];for(let c=1;c<r.length;c++){let a=r[c-1],d=r[c];if(t){let l=(a.x+a.width+d.x)/2;$.push({index:c-1,x1:l,y1:e.y+s+i,x2:l,y2:e.y+e.height-i})}else{let l=(a.y+a.height+d.y)/2;$.push({index:c-1,x1:e.x+i,y1:l,x2:e.x+e.width-i,y2:l})}}return $}function ge(e,s,n){let{x:o,y:t,width:r,height:i}=e,$=n.groupHeaderFillColor??"var(--_group-hdr)",c=n.groupBorderColor??"var(--_node-stroke)",a=n.edgeTextColor??"var(--_text-sec)",d=L(e.text,n.nodeTextTransform),l=`state-note:${e.id}`;return v({id:l,role:"note",open:`<g class="state-note" data-id="${p(e.id)}" data-target="${p(e.target)}" data-side="${e.side}">`,close:"</g>",children:[{indent:2,node:C({id:`${l}:rect`,role:"note",geometry:{kind:"rect",x:o,y:t,width:r,height:i,rx:4,ry:4},paint:{fill:$,stroke:c,strokeWidth:String(A.innerBox)}},`<rect x="${o}" y="${t}" width="${r}" height="${i}" rx="4" ry="4" fill="${p($)}" stroke="${p(c)}" stroke-width="${A.innerBox}" />`)},{indent:2,node:P({id:`${l}:text`,role:"label",text:d,x:o+r/2,y:t+i/2,fontSize:n.edgeLabelFontSize,anchor:"middle",paint:{fill:a}},z(d,o+r/2,t+i/2,n.edgeLabelFontSize,`text-anchor="middle" font-size="${n.edgeLabelFontSize}" font-weight="${n.edgeLabelFontWeight}"${n.edgeLetterSpacing!==0?` letter-spacing="${n.edgeLetterSpacing}"`:""} fill="${p(a)}"`))}]})}function fe(e,s,n,o){let t=e.style==="dotted"?"dotted":e.style==="thick"?"thick":e.style==="invisible"?"invisible":"solid",r=he(n),i=e.labelPosition??ue(e.points),$=s.edgeTextColor??"var(--_text-sec)",c=e.label?[{id:`${n}:label`,text:e.label,anchor:i,paint:{fill:$},fontSize:s.edgeLabelFontSize,textAnchor:"middle",visual:{kind:"companion",markId:`${r}:text`}}]:[],a={identity:{id:e.id??n},endpoints:{from:e.source,to:e.target},relationship:{kind:"flowchart-edge",direction:e.source===e.target?"self":e.hasArrowStart&&e.hasArrowEnd?"bidirectional":e.hasArrowStart?"reverse":e.hasArrowEnd?"forward":"undirected"},route:{ownership:"layout",bendRadius:s.edgeBendRadius,labelAnchors:e.labelPosition?[e.labelPosition]:[]},labels:c};if(e.style==="invisible")return T({id:n,role:"edge",geometry:{kind:"polyline",points:e.points},lineStyle:"invisible",paint:{},...a},"");let d=e.curve?xe(e.points):s.edgeBendRadius>0?Y(e.points,s.edgeBendRadius,{precision:3}):void 0,l=d?.geometry.d??ye(e.points),h=e.style==="dotted"?`${W.dash} ${W.gap}`:e.animate?"8 4":void 0,u=h?` stroke-dasharray="${h}"`:"",f=e.style==="thick"?s.lineWidth*2:s.lineWidth,g=e.inlineStyle?.stroke??s.edgeStrokeColor,x=p(g??"var(--_line)"),S=p(e.inlineStyle?.["stroke-width"]??String(f)),m=g?`-${H(g)}`:"",y="",k,b;if(e.hasArrowEnd){let M=ae(e.endMarker??"arrow");if(k=o.find(F=>F.id===`${M}${m}`),!k)throw new Error(`Missing marker resource "${M}${m}"`);y+=` marker-end="url(#${M}${m})"`}if(e.hasArrowStart){let M=ae(e.startMarker??"arrow");if(b=o.find(F=>F.id===`${M}-start${m}`),!b)throw new Error(`Missing marker resource "${M}-start${m}"`);y+=` marker-start="url(#${M}-start${m})"`}let w=['class="edge"',...e.id?[`data-id="${p(e.id)}"`]:[],`data-from="${p(e.source)}"`,`data-to="${p(e.target)}"`,`data-style="${e.style}"`,`data-arrow-start="${e.hasArrowStart}"`,`data-arrow-end="${e.hasArrowEnd}"`];e.hasArrowStart&&w.push(`data-marker-start="${e.startMarker??"arrow"}"`),e.hasArrowEnd&&w.push(`data-marker-end="${e.endMarker??"arrow"}"`),e.label&&w.push(`data-label="${p(e.label)}"`),e.curve&&w.push(`data-curve="${p(e.curve)}"`),e.animate&&w.push('data-animate="true"',`data-animation="${e.animation??"slow"}"`);let D={stroke:g??"var(--_line)",strokeWidth:e.inlineStyle?.["stroke-width"]??String(f),...h?{strokeDasharray:h}:{}};if(s.edgeBendRadius>0||e.curve){if(!d)throw new Error(`Missing path projection for flowchart edge "${n}"`);return T({id:n,role:"edge",geometry:d.geometry,lineStyle:t,paint:D,markers:{...b?{start:b}:{},mid:[],...k?{end:k}:{}},...a,route:{...a.route,contours:d.contours}},`<path ${w.join(" ")} d="${l}" fill="none" stroke="${x}" stroke-width="${S}"${u}${y} />`)}return T({id:n,role:"edge",geometry:{kind:"polyline",points:e.points},lineStyle:t,paint:D,markers:{...b?{start:b}:{},mid:[],...k?{end:k}:{}},...a},`<polyline ${w.join(" ")} points="${l}" fill="none" stroke="${x}" stroke-width="${S}"${u}${y} />`)}function he(e){return e.startsWith("edge:")?`edge-label:${e.slice(5)}`:`${e}:label`}function xe(e){let s=e[0],n=`M ${s.x} ${s.y}`,o=[];for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],$=(r.x+i.x)/2;n+=` C ${$} ${r.y}, ${$} ${i.y}, ${i.x} ${i.y}`,o.push({kind:"cubic",control1:{x:$,y:r.y},control2:{x:$,y:i.y},end:i})}return U(n,s,o)}function ye(e){return e.map(s=>`${s.x},${s.y}`).join(" ")}function et(e){let s=/<((?:[A-Za-z_][\w.-]*:)?(?:style|text|title|desc|metadata))\b[\s\S]*?<\/\1>/gi,n=[],o=0,t;for(;(t=s.exec(e))!==null;)t.index>o&&n.push({kind:"plain",text:e.slice(o,t.index)}),n.push({kind:"protected",text:t[0]}),o=t.index+t[0].length;return o<e.length&&n.push({kind:"plain",text:e.slice(o)}),n.map(r=>r.kind==="protected"?r.text:r.text.replace(/>\s*\r?\n\s*</g,"><")).join("")}function tt(e,s){if(!/^[A-Za-z0-9_.:-]+$/.test(s))throw new Error("idPrefix must be non-empty and contain only ASCII letters, digits, underscore, hyphen, dot, and colon");let n=new Set;for(let r of V(e))for(let i of r.attributes)i.name==="id"&&n.add(i.value);let o=r=>r.startsWith(s)?r:`${s}${r}`,t=Z(e,r=>{if(r.name==="id")return o(r.value);if(r.name==="aria-labelledby"||r.name==="aria-describedby")return r.value.split(/\s+/).map(i=>n.has(i)?o(i):i).join(" ");if((r.name==="href"||r.name==="xlink:href")&&r.value.startsWith("#")){let i=r.value.slice(1);return n.has(i)?`#${o(i)}`:r.value}});return B(t,r=>r.replace(/url\(#([^)]+)\)/g,(i,$)=>n.has($)?`url(#${o($)})`:i))}function ke(e,s,n,o){let t=e.labelPosition??ue(e.points),r=L(e.label,n.edgeTextTransform),i=8,$=e.style==="thick"?n.lineWidth*2:n.lineWidth,c=i+Math.max(4,$*2),a=E(r,n.edgeLabelFontSize,n.edgeLabelFontWeight),d=a.width+c*2,l=a.height+c*2,h=t.x-d/2,u=t.y-l/2,f=C({id:`${o}:halo`,role:"chrome",geometry:{kind:"rect",x:h,y:u,width:d,height:l,rx:4,ry:4},paint:{fill:"var(--bg)",stroke:"none"}},`<rect class="edge-label-halo" x="${h}" y="${u}" width="${d}" height="${l}" rx="4" ry="4" fill="var(--bg)" stroke="none" />`),g=n.edgeTextColor??"var(--_text-sec)",x=P({id:`${o}:text`,role:"label",text:r,x:t.x,y:t.y,fontSize:n.edgeLabelFontSize,anchor:"middle",paint:{fill:g}},K(r,t.x,t.y,a.width,a.height,n.edgeLabelFontSize,i,`text-anchor="middle" font-size="${n.edgeLabelFontSize}" font-weight="${n.edgeLabelFontWeight}"${n.edgeLetterSpacing!==0?` letter-spacing="${n.edgeLetterSpacing}"`:""} fill="${p(g)}"`,'rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"'));return v({id:o,role:"edge-label",open:`<g class="edge-label" data-from="${p(e.source)}" data-to="${p(e.target)}" data-label="${p(e.label)}">`,close:"</g>",children:[{indent:2,node:f},{indent:2,node:x}]})}function ue(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let s=0;for(let o=1;o<e.length;o++)s+=ce(e[o-1],e[o]);let n=s/2;for(let o=1;o<e.length;o++){let t=ce(e[o-1],e[o]);if(n<=t){let r=n/t;return{x:e[o-1].x+r*(e[o].x-e[o-1].x),y:e[o-1].y+r*(e[o].y-e[o-1].y)}}n-=t}return e[e.length-1]}function ce(e,s){return Math.sqrt((s.x-e.x)**2+(s.y-e.y)**2)}function be(e,s,n,o){let t=Me(e,n),r=Ee(e,s,n),$=["node",...(e.classNames??[]).map(u=>u.replace(/[^A-Za-z0-9_-]/g,"")).filter(Boolean)].join(" "),c=e.shape==="state-start"?{status:"start"}:e.shape==="state-end"?{status:"end"}:void 0,a=[{indent:2,node:t}],d=we(e,n);d&&a.push({indent:2,node:d}),r&&a.push({indent:2,node:r});let l=e.semanticShape?` data-semantic-shape="${p(e.semanticShape)}"`:"",h=o&&e.href?` data-href="${p(e.href)}" role="link" tabindex="0"`:"";return v({id:`node:${e.id}`,role:"node",open:`<g class="${$}" data-id="${p(e.id)}" data-label="${p(e.label)}" data-shape="${e.shape}"${l}${h}>`,close:"</g>",children:a,channels:c})}function Se(e,s,n,o){let{x:t,y:r,width:i,height:$}=e,c=t+i,a=r+$,d=t+i/2,l=r+$/2,h=(f,g="")=>({geometry:{kind:"path",d:f},crisp:`<path d="${f}" fill="${g.includes('fill="none"')?"none":s}" stroke="${n}" stroke-width="${o}" />`}),u=f=>({geometry:{kind:"polygon",points:f},crisp:`<polygon points="${f.map(g=>`${g.x},${g.y}`).join(" ")}" fill="${s}" stroke="${n}" stroke-width="${o}" />`});switch(e.semanticShape){case"bang":{let f=Array.from({length:16},(g,x)=>{let S=-Math.PI/2+x*Math.PI/8,m=x%2===0?1:.62;return{x:d+Math.cos(S)*i/2*m,y:l+Math.sin(S)*$/2*m}});return u(f)}case"notch-rect":return u([{x:t+10,y:r},{x:c,y:r},{x:c,y:a},{x:t,y:a},{x:t,y:r+10}]);case"cloud":return h(`M${t+i*.18} ${a}C${t-4} ${a} ${t-4} ${l} ${t+i*.12} ${l}C${t+i*.08} ${r+$*.15} ${t+i*.38} ${r-4} ${t+i*.48} ${r+$*.18}C${t+i*.65} ${r-5} ${c} ${r+$*.16} ${t+i*.88} ${l}C${c+5} ${l} ${c+5} ${a} ${t+i*.72} ${a}Z`);case"hourglass":return u([{x:t,y:r},{x:c,y:r},{x:t+i*.62,y:l},{x:c,y:a},{x:t,y:a},{x:t+i*.38,y:l}]);case"bolt":return u([{x:t+i*.55,y:r},{x:t+i*.25,y:l},{x:t+i*.48,y:l},{x:t+i*.35,y:a},{x:t+i*.78,y:r+$*.4},{x:t+i*.55,y:r+$*.4}]);case"brace":return h(`M${c} ${r}C${t+i*.4} ${r} ${t+i*.7} ${l} ${t} ${l}C${t+i*.7} ${l} ${t+i*.4} ${a} ${c} ${a}`,' fill="none"');case"brace-r":return h(`M${t} ${r}C${t+i*.6} ${r} ${t+i*.3} ${l} ${c} ${l}C${t+i*.3} ${l} ${t+i*.6} ${a} ${t} ${a}`,' fill="none"');case"braces":return h(`M${t+i*.25} ${r}C${t} ${r} ${t+i*.15} ${l} ${t} ${l}C${t+i*.15} ${l} ${t} ${a} ${t+i*.25} ${a}M${t+i*.75} ${r}C${c} ${r} ${t+i*.85} ${l} ${c} ${l}C${t+i*.85} ${l} ${c} ${a} ${t+i*.75} ${a}`,' fill="none"');case"datastore":return h(`M${t+8} ${r}H${c}V${a}H${t+8}M${t+8} ${r}C${t-2} ${r+$*.2} ${t-2} ${a-$*.2} ${t+8} ${a}`,' fill="none"');case"delay":return h(`M${t} ${r}H${c-$/2}A${$/2} ${$/2} 0 0 1 ${c-$/2} ${a}H${t}Z`);case"h-cyl":return h(`M${t+10} ${r}H${c-10}A10 ${$/2} 0 0 1 ${c-10} ${a}H${t+10}A10 ${$/2} 0 0 1 ${t+10} ${r}Z M${c-10} ${r}A10 ${$/2} 0 0 0 ${c-10} ${a}`);case"lin-cyl":return h(`M${t} ${r+8}A${i/2} 8 0 0 1 ${c} ${r+8}V${a-8}A${i/2} 8 0 0 1 ${t} ${a-8}Z M${t} ${r+8}A${i/2} 8 0 0 0 ${c} ${r+8}M${t} ${a-16}A${i/2} 8 0 0 0 ${c} ${a-16}`);case"curv-trap":return h(`M${t+12} ${r}Q${d} ${r+8} ${c-12} ${r}L${c} ${a}Q${d} ${a-8} ${t} ${a}Z`);case"div-rect":return h(`M${t} ${r}H${c}V${a}H${t}ZM${t} ${l}H${c}`);case"doc":return h(`M${t} ${r}H${c}V${a-8}Q${t+i*.75} ${a+2} ${d} ${a-8}Q${t+i*.25} ${a-18} ${t} ${a-8}Z`);case"tri":return u([{x:d,y:r},{x:c,y:a},{x:t,y:a}]);case"fork":return{geometry:{kind:"rect",x:t,y:l-4,width:i,height:8},crisp:`<rect x="${t}" y="${l-4}" width="${i}" height="8" fill="${n}" stroke="${n}" stroke-width="${o}" />`};case"win-pane":return h(`M${t} ${r}H${c}V${a}H${t}ZM${t+i*.28} ${r}V${a}M${t} ${r+$*.32}H${c}`);case"f-circ":return{geometry:{kind:"circle",cx:d,cy:l,r:Math.min(i,$)/2},crisp:`<circle cx="${d}" cy="${l}" r="${Math.min(i,$)/2}" fill="${n}" stroke="${n}" stroke-width="${o}" />`};case"lin-doc":return h(`M${t} ${r}H${c}V${a-8}Q${t+i*.75} ${a+2} ${d} ${a-8}Q${t+i*.25} ${a-18} ${t} ${a-8}ZM${t+8} ${r+8}H${c-8}`);case"lin-rect":return h(`M${t} ${r}H${c}V${a}H${t}ZM${t+6} ${r}V${a}M${c-6} ${r}V${a}`);case"notch-pent":return u([{x:t,y:r},{x:c-10,y:r},{x:c,y:l},{x:c-10,y:a},{x:t,y:a},{x:t+8,y:l}]);case"flip-tri":return u([{x:t,y:r},{x:c,y:r},{x:d,y:a}]);case"docs":return h(`M${t+8} ${r}H${c}V${a-8}Q${t+i*.7} ${a} ${t+i*.45} ${a-8}Q${t+i*.22} ${a-16} ${t+8} ${a-8}ZM${t} ${r+8}H${t+8}M${t} ${r+8}V${a}`);case"st-rect":return h(`M${t+8} ${r}H${c}V${a-8}H${t+8}ZM${t} ${r+8}H${c-8}V${a}H${t}Z`);case"flag":return h(`M${t} ${r+6}Q${t+i*.25} ${r-4} ${d} ${r+6}Q${t+i*.75} ${r+16} ${c} ${r+6}V${a-6}Q${t+i*.75} ${a+4} ${d} ${a-6}Q${t+i*.25} ${a-16} ${t} ${a-6}Z`);case"sm-circ":return{geometry:{kind:"circle",cx:d,cy:l,r:Math.min(i,$)*.22},crisp:`<circle cx="${d}" cy="${l}" r="${Math.min(i,$)*.22}" fill="${s}" stroke="${n}" stroke-width="${o}" />`};case"cross-circ":return h(`M${d} ${r}A${i/2} ${$/2} 0 1 1 ${d-.01} ${r}M${t+i*.28} ${r+$*.28}L${t+i*.72} ${r+$*.72}M${t+i*.72} ${r+$*.28}L${t+i*.28} ${r+$*.72}`);case"bow-rect":return h(`M${t} ${r}Q${t+12} ${l} ${t} ${a}H${c}Q${c-12} ${l} ${c} ${r}Z`);case"tag-doc":return h(`M${t+10} ${r}H${c}V${a-8}Q${t+i*.7} ${a} ${d} ${a-8}Q${t+i*.25} ${a-16} ${t} ${a-8}V${r+10}ZM${t} ${r+10}L${t+10} ${r}`);case"tag-rect":return u([{x:t+10,y:r},{x:c,y:r},{x:c,y:a},{x:t,y:a},{x:t,y:r+10}]);case"text":return{geometry:{kind:"path",d:`M${t} ${r}`},crisp:`<path d="M${t} ${r}" fill="none" stroke="none" />`};default:return null}}function we(e,s){let n=p(s.nodeTextColor??"var(--_text)"),o=Math.min(28,e.height*.4),t=e.x+e.width/2,r=e.y+6;if(e.icon){let i=ne(e.icon);if(i){let c=o/24,a=i.paths.map(d=>`<path d="${d}"/>`).join("");return _({id:`node:${e.id}:icon`,role:"icon"},`<g class="flowchart-icon" data-icon="${p(e.icon)}" transform="translate(${t-o/2} ${r}) scale(${c})" fill="${n}" stroke="${n}" stroke-width="0.8">${a}</g>`)}let $=e.icon.split(/[:/\s-]+/).filter(Boolean).at(-1)?.slice(0,2).toUpperCase()||"?";return P({id:`node:${e.id}:icon`,role:"icon",text:$,x:t,y:r+o/2,fontSize:10,anchor:"middle",paint:{fill:n}},`<text class="flowchart-icon-fallback" data-icon="${p(e.icon)}" x="${t}" y="${r+o/2}" text-anchor="middle" font-size="10" fill="${n}">${X($)}</text>`)}if(e.image){let i=t-o/2;return _({id:`node:${e.id}:image`,role:"icon"},`<g class="flowchart-image-placeholder" data-image-src="${p(e.image)}" fill="none" stroke="${n}" stroke-width="1.2"><rect x="${i}" y="${r}" width="${o}" height="${o*.72}" rx="2"/><circle cx="${i+o*.72}" cy="${r+o*.2}" r="${o*.08}"/><path d="M${i+2} ${r+o*.66}L${i+o*.36} ${r+o*.36}L${i+o*.52} ${r+o*.5}L${i+o*.7} ${r+o*.32}L${i+o-2} ${r+o*.66}"/></g>`)}return null}function Me(e,s){let{x:n,y:o,width:t,height:r,shape:i,inlineStyle:$}=e,c=$?.fill??s.nodeFillColor??"var(--_node-fill)",a=$?.stroke??s.nodeBorderColor??"var(--_node-stroke)",d=$?.["stroke-width"]??String(s.nodeLineWidth),l=p(c),h=p(a),u=p(d),f=(()=>{let x=Se(e,l,h,u);if(x)return x;switch(i){case"service":return $e(n,o,t,r,l,h,u,s.cornerRadius??0);case"diamond":return le(n,o,t,r,l,h,u);case"rounded":return Ce(n,o,t,r,l,h,u,s.cornerRadius??6);case"stadium":return Pe(n,o,t,r,l,h,u);case"circle":return de(n,o,t,r,l,h,u);case"subroutine":return ve(n,o,t,r,l,h,u,s.cornerRadius??0);case"doublecircle":return Re(n,o,t,r,l,h,u);case"hexagon":return Le(n,o,t,r,l,h,u);case"cylinder":return Ae(n,o,t,r,l,h,u);case"asymmetric":return ze(n,o,t,r,l,h,u);case"trapezoid":return Te(n,o,t,r,l,h,u);case"trapezoid-alt":return He(n,o,t,r,l,h,u);case"lean-r":return Fe(n,o,t,r,l,h,u);case"lean-l":return We(n,o,t,r,l,h,u);case"state-start":return _e(n,o,t,r);case"state-end":return je(n,o,t,r);case"state-fork":case"state-join":return De(n,o,t,r);case"state-choice":return le(n,o,t,r,l,h,u);case"state-history":return de(n,o,t,r,l,h,u);default:return $e(n,o,t,r,l,h,u,s.cornerRadius??0)}})(),g=i==="state-start"||i==="state-fork"||i==="state-join"?{fill:"var(--_text)",stroke:"none"}:i==="state-end"?{fill:"var(--_text)",stroke:"var(--_text)"}:{fill:c,stroke:a,strokeWidth:d};return C({id:`node-shape:${e.id}`,role:"node",geometry:f.geometry,paint:g},f.crisp)}function $e(e,s,n,o,t,r,i,$=0){return{geometry:{kind:"rect",x:e,y:s,width:n,height:o,rx:$,ry:$},crisp:`<rect x="${e}" y="${s}" width="${n}" height="${o}" rx="${$}" ry="${$}" fill="${t}" stroke="${r}" stroke-width="${i}" />`}}function Ce(e,s,n,o,t,r,i,$=6){return{geometry:{kind:"rect",x:e,y:s,width:n,height:o,rx:$,ry:$},crisp:`<rect x="${e}" y="${s}" width="${n}" height="${o}" rx="${$}" ry="${$}" fill="${t}" stroke="${r}" stroke-width="${i}" />`}}function Pe(e,s,n,o,t,r,i){let $=o/2;return{geometry:{kind:"rect",x:e,y:s,width:n,height:o,rx:$,ry:$},crisp:`<rect x="${e}" y="${s}" width="${n}" height="${o}" rx="${$}" ry="${$}" fill="${t}" stroke="${r}" stroke-width="${i}" />`}}function de(e,s,n,o,t,r,i){let $=e+n/2,c=s+o/2,a=Math.min(n,o)/2;return{geometry:{kind:"circle",cx:$,cy:c,r:a},crisp:`<circle cx="${$}" cy="${c}" r="${a}" fill="${t}" stroke="${r}" stroke-width="${i}" />`}}function le(e,s,n,o,t,r,i){let $=e+n/2,c=s+o/2,a=n/2,d=o/2,l=[{x:$,y:c-d},{x:$+a,y:c},{x:$,y:c+d},{x:$-a,y:c}],h=l.map(u=>`${u.x},${u.y}`).join(" ");return{geometry:{kind:"polygon",points:l},crisp:`<polygon points="${h}" fill="${t}" stroke="${r}" stroke-width="${i}" />`}}function ve(e,s,n,o,t,r,i,$=0){return{geometry:{kind:"compound",children:[{kind:"rect",x:e,y:s,width:n,height:o,rx:$,ry:$},{kind:"line",x1:e+8,y1:s,x2:e+8,y2:s+o},{kind:"line",x1:e+n-8,y1:s,x2:e+n-8,y2:s+o}]},crisp:`<rect x="${e}" y="${s}" width="${n}" height="${o}" rx="${$}" ry="${$}" fill="${t}" stroke="${r}" stroke-width="${i}" />
4
4
  <line x1="${e+8}" y1="${s}" x2="${e+8}" y2="${s+o}" stroke="${r}" stroke-width="${i}" />
@@ -1 +1 @@
1
- import{c as d,d as o}from"./chunk-A7L4WWVW.js";import{C as u}from"./chunk-FXBBGAMJ.js";var C=["axisColor","axisStrokeWidth","axisLabelFontSize","curveOpacity","curveStrokeWidth","graticuleColor","graticuleStrokeWidth","graticuleOpacity","legendBoxSize","legendFontSize"],L=["width","height","axisScaleFactor"],r=Object.freeze({dimension:4096,margin:4096,factor:8,axisLabelFactorMin:1.1,fontSize:256,lineWidth:64,legendBoxSize:512}),z=["marginTop","marginRight","marginBottom","marginLeft"];function W(a={}){let n=d(a,["radar"])??{},i={};for(let t of L){let e=o(n,[t]),f=t==="width"||t==="height"?r.dimension:r.factor;typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=f&&(i[t]=e)}let s=o(n,["axisLabelFactor"]);typeof s=="number"&&Number.isFinite(s)&&s>=r.axisLabelFactorMin&&s<=r.factor&&(i.axisLabelFactor=s);for(let t of z){let e=o(n,[t]);typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=r.margin&&(i[t]=e)}let c=o(n,["curveTension"]);typeof c=="number"&&Number.isFinite(c)&&c>=0&&c<=1&&(i.curveTension=c);let g=o(n,["useMaxWidth"]);typeof g=="boolean"&&(i.useMaxWidth=g);let F=o(n,["tickLabels"]);typeof F=="boolean"&&(i.tickLabels=F);let b=d(a,["themeVariables","radar"])??{},p=["axisStrokeWidth","axisLabelFontSize","curveStrokeWidth","graticuleStrokeWidth","legendBoxSize","legendFontSize"];for(let t of p){let e=o(b,[t]),f=t==="legendBoxSize"?r.legendBoxSize:t.endsWith("FontSize")?r.fontSize:r.lineWidth;typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=f&&(i[t]=e)}for(let t of["curveOpacity","graticuleOpacity"]){let e=o(b,[t]);typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1&&(i[t]=e)}for(let t of["axisColor","graticuleColor"]){let e=u(o(b,[t]));e&&(i[t]=e)}let S=u(o(a,["themeVariables","titleColor"]));S&&(i.titleColor=S);let l=o(a,["themeVariables","fontSize"]),m=typeof l=="number"?l:typeof l=="string"&&/^\d+(?:\.\d+)?(?:px)?$/i.test(l.trim())?Number.parseFloat(l):Number.NaN;Number.isFinite(m)&&m>0&&m<=r.fontSize&&(i.titleFontSize=m);let h=[],x=!1;for(let t=0;t<12;t++){let e=u(o(a,["themeVariables",`cScale${t}`]));e&&(h[t]=e,x=!0)}return x&&(i.paletteOverrides=h),i}export{C as a,r as b,W as c};
1
+ import{c as d,d as o}from"./chunk-A7L4WWVW.js";import{C as u}from"./chunk-EX6TP7QM.js";var C=["axisColor","axisStrokeWidth","axisLabelFontSize","curveOpacity","curveStrokeWidth","graticuleColor","graticuleStrokeWidth","graticuleOpacity","legendBoxSize","legendFontSize"],L=["width","height","axisScaleFactor"],r=Object.freeze({dimension:4096,margin:4096,factor:8,axisLabelFactorMin:1.1,fontSize:256,lineWidth:64,legendBoxSize:512}),z=["marginTop","marginRight","marginBottom","marginLeft"];function W(a={}){let n=d(a,["radar"])??{},i={};for(let t of L){let e=o(n,[t]),f=t==="width"||t==="height"?r.dimension:r.factor;typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=f&&(i[t]=e)}let s=o(n,["axisLabelFactor"]);typeof s=="number"&&Number.isFinite(s)&&s>=r.axisLabelFactorMin&&s<=r.factor&&(i.axisLabelFactor=s);for(let t of z){let e=o(n,[t]);typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=r.margin&&(i[t]=e)}let c=o(n,["curveTension"]);typeof c=="number"&&Number.isFinite(c)&&c>=0&&c<=1&&(i.curveTension=c);let g=o(n,["useMaxWidth"]);typeof g=="boolean"&&(i.useMaxWidth=g);let F=o(n,["tickLabels"]);typeof F=="boolean"&&(i.tickLabels=F);let b=d(a,["themeVariables","radar"])??{},p=["axisStrokeWidth","axisLabelFontSize","curveStrokeWidth","graticuleStrokeWidth","legendBoxSize","legendFontSize"];for(let t of p){let e=o(b,[t]),f=t==="legendBoxSize"?r.legendBoxSize:t.endsWith("FontSize")?r.fontSize:r.lineWidth;typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=f&&(i[t]=e)}for(let t of["curveOpacity","graticuleOpacity"]){let e=o(b,[t]);typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1&&(i[t]=e)}for(let t of["axisColor","graticuleColor"]){let e=u(o(b,[t]));e&&(i[t]=e)}let S=u(o(a,["themeVariables","titleColor"]));S&&(i.titleColor=S);let l=o(a,["themeVariables","fontSize"]),m=typeof l=="number"?l:typeof l=="string"&&/^\d+(?:\.\d+)?(?:px)?$/i.test(l.trim())?Number.parseFloat(l):Number.NaN;Number.isFinite(m)&&m>0&&m<=r.fontSize&&(i.titleFontSize=m);let h=[],x=!1;for(let t=0;t<12;t++){let e=u(o(a,["themeVariables",`cScale${t}`]));e&&(h[t]=e,x=!0)}return x&&(i.paletteOverrides=h),i}export{C as a,r as b,W as c};
@@ -1,4 +1,4 @@
1
- import{a as h,f as a}from"./chunk-RVO6J7S3.js";import{N as c}from"./chunk-FXBBGAMJ.js";var i={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function n(t){return(Math.round(t*100)/100).toString()}function Y(t,e,$,s){let p=h(s,i.fontSize,i.fontWeight)+i.padX*2,l=e-p/2,o=$-i.offsetY-i.height,r=o+i.height;o<i.minY&&(o=i.minY,r=o+i.height);let m=e,f=o+i.height/2,g=i.pointerSize,u=`M${n(e-g)},${n(r)} L${n(e+g)},${n(r)} L${n(e)},${n(r+g)} Z`;return`<g class="${t}-tip"><rect x="${n(l)}" y="${n(o)}" width="${n(p)}" height="${i.height}" rx="${i.rx}" class="${t}-tip ${t}-tip-bg"/><path d="${u}" class="${t}-tip ${t}-tip-ptr"/><text x="${n(m)}" y="${n(f)}" text-anchor="middle" dy="${a}" class="${t}-tip ${t}-tip-text">${c(s)}</text></g>`}function W(t,e){let $=e.map(s=>`.${s}:hover .${t}-tip`).join(`,
1
+ import{a as h,f as a}from"./chunk-32FWKUUV.js";import{N as c}from"./chunk-EX6TP7QM.js";var i={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function n(t){return(Math.round(t*100)/100).toString()}function Y(t,e,$,s){let p=h(s,i.fontSize,i.fontWeight)+i.padX*2,l=e-p/2,o=$-i.offsetY-i.height,r=o+i.height;o<i.minY&&(o=i.minY,r=o+i.height);let m=e,f=o+i.height/2,g=i.pointerSize,u=`M${n(e-g)},${n(r)} L${n(e+g)},${n(r)} L${n(e)},${n(r+g)} Z`;return`<g class="${t}-tip"><rect x="${n(l)}" y="${n(o)}" width="${n(p)}" height="${i.height}" rx="${i.rx}" class="${t}-tip ${t}-tip-bg"/><path d="${u}" class="${t}-tip ${t}-tip-ptr"/><text x="${n(m)}" y="${n(f)}" text-anchor="middle" dy="${a}" class="${t}-tip ${t}-tip-text">${c(s)}</text></g>`}function W(t,e){let $=e.map(s=>`.${s}:hover .${t}-tip`).join(`,
2
2
  `);return`
3
3
  .${t}-tip { opacity: 0; pointer-events: none; }
4
4
  .${t}-tip-bg { fill: var(--_text); }
@@ -1 +1 @@
1
- import{a as c,d as r,f as o}from"./chunk-7D24ZLOV.js";function f(a,e={}){let i=a<=6?{accent:e.accent&&r(e.accent)?e.accent:c,bg:e.bg&&r(e.bg)?e.bg:void 0}:e,n=o(a,i),t=e.overrides;return!t||t.length===0?n:n.map((l,d)=>t[d%12]??l)}export{f as a};
1
+ import{a as c,d as r,f as o}from"./chunk-ZZECLXC3.js";function f(a,e={}){let i=a<=6?{accent:e.accent&&r(e.accent)?e.accent:c,bg:e.bg&&r(e.bg)?e.bg:void 0}:e,n=o(a,i),t=e.overrides;return!t||t.length===0?n:n.map((l,d)=>t[d%12]??l)}export{f as a};
@@ -1 +1 @@
1
- import{a as $,b as X}from"./chunk-CTVVJPMX.js";import{d as D}from"./chunk-A7L4WWVW.js";import{a as I,b as Y,c as T,d as O,e as F,j as E,k as W}from"./chunk-RVO6J7S3.js";import{i as R}from"./chunk-FXBBGAMJ.js";var f={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,minWidth:120,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60},A={nodeLabelFontSize:T.nodeLabel,edgeLabelFontSize:T.edgeLabel,groupHeaderFontSize:T.groupHeader,nodeLabelFontWeight:700,edgeLabelFontWeight:O.edgeLabel,groupHeaderFontWeight:O.groupHeader,nodePaddingX:f.boxPadX,nodePaddingY:f.sectionPadY,nodeCornerRadius:0,nodeLineWidth:F.outerBox,edgeLineWidth:F.connector,groupCornerRadius:0,groupPaddingX:f.boxPadX,groupPaddingY:f.sectionPadY,groupLineWidth:F.outerBox};function oe(o,t){if(!o)return t;let u=v(o,"class","nodeSpacing"),s=v(o,"class","rankSpacing"),x=D(o,["class","hierarchicalNamespaces"]),b=t.class?.hierarchicalNamespaces??(typeof x=="boolean"?x:void 0);return u===void 0&&s===void 0&&b===void 0?t:{...t,nodeSpacing:t.nodeSpacing??u,layerSpacing:t.layerSpacing??s,...b!==void 0?{class:{...t.class,hierarchicalNamespaces:b}}:{}}}function v(o,t,u){let s=D(o,[t,u]);return typeof s=="number"&&Number.isFinite(s)&&s>=0?s:void 0}var B="ns:";function z(o,t,u=!0){let s=[];for(let x of o){let b=t?`${t}.${x.name}`:x.name;s.push({path:b,...u&&t?{parentPath:t}:{},ns:x}),s.push(...z(x.children,b,u))}return s}function j(o,t,u){let s=W(t,A,u),x=new Map;for(let d of o.classes){let p=E(d.label,s.nodeTextTransform),S=Math.max(f.headerBaseHeight,R(p,s.nodeLabelFontSize,s.nodeLabelFontWeight).height+s.nodePaddingY*2),n=d.annotation?S+f.annotationHeight:S,l=d.attributes.length>0?d.attributes.length*f.memberRowHeight+s.nodePaddingY:f.emptySectionHeight,h=d.methods.length>0?d.methods.length*f.memberRowHeight+s.nodePaddingY:f.emptySectionHeight,a=I(p,s.nodeLabelFontSize,s.nodeLabelFontWeight),e=_(d.attributes),g=_(d.methods),r=Math.max(f.minWidth,a+s.nodePaddingX*2,e+s.nodePaddingX*2,g+s.nodePaddingX*2),c=n+l+h;x.set(d.id,{width:r,height:c,headerHeight:n,attrHeight:l,methodHeight:h})}let b=t.nodeSpacing??f.nodeSpacing,N=t.layerSpacing??f.layerSpacing,H=t.class?.hierarchicalNamespaces!==!1,i=z(o.namespaces,void 0,H),m=i.length>0,k={"elk.algorithm":"layered","elk.direction":X(o.direction??"TB"),"elk.spacing.nodeNode":String(b),"elk.layered.spacing.nodeNodeBetweenLayers":String(N),"elk.padding":`[top=${f.padding},left=${f.padding},bottom=${f.padding},right=${f.padding}]`,"elk.edgeRouting":"ORTHOGONAL","elk.edgeLabels.placement":"CENTER"};m&&(k["elk.hierarchyHandling"]="INCLUDE_CHILDREN");let w={id:"root",layoutOptions:k,children:[],edges:[]},P=new Map;for(let d of i)for(let p of d.ns.classIds)P.has(p)||P.set(p,d.path);let C=new Map,M=s.groupHeaderFontSize+16;for(let d of i){let p={id:B+d.path,layoutOptions:{"elk.padding":`[top=${M+s.groupPaddingY},left=${s.groupPaddingX+8},bottom=${s.groupPaddingY+8},right=${s.groupPaddingX+8}]`,"elk.spacing.nodeNode":String(b),"elk.layered.spacing.nodeNodeBetweenLayers":String(N),"elk.edgeRouting":"ORTHOGONAL","elk.edgeLabels.placement":"CENTER"},children:[],edges:[]};C.set(d.path,p),(d.parentPath?C.get(d.parentPath):w).children.push(p)}for(let d of o.classes){let p=x.get(d.id),S={id:d.id,width:p.width,height:p.height},n=P.get(d.id);(n?C.get(n):w).children.push(S)}let L=d=>{let p=P.get(d);if(!p)return[];if(!H)return[p];let S=p.split(".");return S.map((n,l)=>S.slice(0,l+1).join("."))};for(let d=0;d<o.relationships.length;d++){let p=o.relationships[d],S={id:`e${d}`,sources:[p.from],targets:[p.to]};if(p.label){let a=E(p.label,s.edgeTextTransform),e=R(a,s.edgeLabelFontSize,s.edgeLabelFontWeight);S.labels=[{text:a,width:e.width+8,height:e.height+6}]}let n=L(p.from),l=L(p.to),h;for(let a=0;a<Math.min(n.length,l.length)&&n[a]===l[a];a++)h=n[a];(h?C.get(h):w).edges.push(S)}return{elkGraph:w,classSizes:x}}function U(o,t,u,s,x){let b=new Map;for(let n of t.classes)b.set(n.id,n);let N=new Map(z(t.namespaces,void 0,x).map(n=>[n.path,n])),H=s.groupHeaderFontSize+16,i=[],m=[],k=new Map,w=(n,l,h)=>{for(let a of n.edges??[]){let e=[];if(a.sections&&a.sections.length>0){let c=a.sections[0];e.push({x:c.startPoint.x+l,y:c.startPoint.y+h});for(let y of c.bendPoints??[])e.push({x:y.x+l,y:y.y+h});e.push({x:c.endPoint.x+l,y:c.endPoint.y+h})}let g,r=a.labels?.[0];r&&r.x!=null&&r.y!=null&&(g={x:r.x+(r.width??0)/2+l,y:r.y+(r.height??0)/2+h}),k.set(a.id,{points:e,labelPosition:g})}for(let a of n.children??[]){let e=(a.x??0)+l,g=(a.y??0)+h;if(a.id.startsWith(B)){let c=a.id.slice(B.length),y=N.get(c);m.push({id:c,name:y?.ns.name??c,label:y?.ns.label??y?.ns.name??c,parentId:y?.parentPath,classIds:y?[...y.ns.classIds]:[],x:e,y:g,width:a.width??0,height:a.height??0,headerHeight:H}),w(a,e,g);continue}let r=b.get(a.id);if(r){let c=u.get(r.id);i.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e,y:g,width:a.width??c.width,height:a.height??c.height,headerHeight:c.headerHeight,attrHeight:c.attrHeight,methodHeight:c.methodHeight,...r.className?{className:r.className}:{},...r.href?{href:r.href}:{},...r.className&&t.classDefs.get(r.className)||r.inlineStyle?{inlineStyle:{...r.className?t.classDefs.get(r.className):{},...r.inlineStyle}}:{}})}}};w(o,0,0);let P=[];for(let n=0;n<t.relationships.length;n++){let l=t.relationships[n],h=k.get(`e${n}`);P.push({from:l.from,to:l.to,type:l.type,markerAt:l.markerAt,fromType:l.fromType,toType:l.toType,label:l.label,fromCardinality:l.fromCardinality,toCardinality:l.toCardinality,points:h?.points??[],labelPosition:h?.labelPosition})}let C=o.width??600,M=o.height??400;K(P,i,s,C,M);let L=i.map(n=>({x:n.x,y:n.y,width:n.width,height:n.height})),d=(n,l,h=8)=>n.x<l.x+l.width+h&&n.x+n.width+h>l.x&&n.y<l.y+l.height+h&&n.y+n.height+h>l.y,p=M+16,S=t.notes.map(n=>{let l=R(n.text,12,400),h=Math.max(90,l.width+24),a=Math.max(40,l.height+18),e=n.for?i.find(r=>r.id===n.for):void 0,g;if(e){let r=[];for(let c=0;c<Math.max(4,t.notes.length+1);c++){let y=c*(a+12);r.push({x:e.x+e.width+24,y:e.y+y,width:h,height:a,targetX:e.x+e.width,targetY:e.y+e.height/2,noteX:e.x+e.width+24,noteY:e.y+y+a/2},{x:e.x-h-24,y:e.y+y,width:h,height:a,targetX:e.x,targetY:e.y+e.height/2,noteX:e.x-24,noteY:e.y+y+a/2},{x:e.x,y:e.y+e.height+24+y,width:h,height:a,targetX:e.x+e.width/2,targetY:e.y+e.height,noteX:e.x+h/2,noteY:e.y+e.height+24+y})}g=r.find(c=>c.x>=f.padding&&c.y>=f.padding&&!L.some(y=>d(c,y)))??{x:C+24,y:e.y,width:h,height:a,targetX:e.x+e.width,targetY:e.y+e.height/2,noteX:C+24,noteY:e.y+a/2}}else g={x:f.padding,y:p,width:h,height:a},p+=a+12;return L.push(g),C=Math.max(C,g.x+h+f.padding),M=Math.max(M,g.y+a+f.padding),{text:n.text,...n.for?{for:n.for}:{},...g}});return{width:C,height:M,accessibilityTitle:t.accessibilityTitle,accessibilityDescription:t.accessibilityDescription,classes:i,relationships:P,notes:S,namespaces:m}}function K(o,t,u,s,x){let b=(i,m)=>Math.min(i.x1,m.x1)-Math.max(i.x0,m.x0)>.5&&Math.min(i.y1,m.y1)-Math.max(i.y0,m.y0)>.5,N=t.map(i=>({x0:i.x-1,y0:i.y-1,x1:i.x+i.width+1,y1:i.y+i.height+1}));for(let i of o){if(!i.label||!i.labelPosition)continue;let m=R(E(i.label,u.edgeTextTransform),u.edgeLabelFontSize,u.edgeLabelFontWeight);N.push({x0:i.labelPosition.x-m.width/2-2,y0:i.labelPosition.y-8-m.height/2-2,x1:i.labelPosition.x+m.width/2+2,y1:i.labelPosition.y-8+m.height/2+2})}let H=(i,m,k)=>{let w=R(i,u.edgeLabelFontSize,u.edgeLabelFontWeight),P=w.width/2+2,C=w.height/2+2,M=k.x-m.x,L=k.y-m.y,d=Math.abs(M)>=Math.abs(L),p=d?Math.sign(M||1):0,S=d?0:Math.sign(L||1),n=-S,l=p,h=[];for(let g=10;g<=190;g+=12)h.push(-g,g);let a=[];for(let g=14;g<=150;g+=10)for(let r of h){let c={x:m.x+p*g+n*r,y:m.y+S*g+l*r},y={x0:c.x-P,y0:c.y-C,x1:c.x+P,y1:c.y+C};if(a.push({point:c,box:y}),!(y.x0<0||y.y0<0||y.x1>s||y.y1>x)&&N.every(G=>!b(y,G)))return N.push(y),c}let e=a.map(g=>({...g,collisions:N.filter(r=>b(g.box,r)).length})).sort((g,r)=>g.collisions-r.collisions||g.point.y-r.point.y||g.point.x-r.point.x)[0]??{point:m,box:{x0:m.x,y0:m.y,x1:m.x,y1:m.y}};return N.push(e.box),e.point};for(let i of o)if(!(i.points.length<2)&&(i.fromCardinality&&(i.fromCardinalityPosition=H(i.fromCardinality,i.points[0],i.points[1])),i.toCardinality)){let m=i.points.length-1;i.toCardinalityPosition=H(i.toCardinality,i.points[m],i.points[m-1])}}function se(o,t={},u){if(o.classes.length===0)return{width:0,height:0,accessibilityTitle:o.accessibilityTitle,accessibilityDescription:o.accessibilityDescription,classes:[],relationships:[],notes:[],namespaces:[]};let{elkGraph:s,classSizes:x}=j(o,t,u),b=$(s);return U(b,o,x,W(t,A,u),t.class?.hierarchicalNamespaces!==!1)}function _(o){if(o.length===0)return 0;let t=0;for(let u of o){let s=Z(u),x=Y(s,f.memberFontSize);x>t&&(t=x)}return t}function Z(o){let t=o.visibility?`${o.visibility} `:"",u=o.isMethod?`${o.name}(${o.params||""})`:o.name,s=o.type?`: ${o.type}`:"";return`${t}${u}${s}`}var q=/^direction\s+(TB|TD|BT|LR|RL)\s*$/i;function re(o){let t=o.match(q);return t?t[1].toUpperCase():void 0}export{A as a,oe as b,v as c,se as d,re as e};
1
+ import{a as $,b as X}from"./chunk-W6Q4PHPC.js";import{d as D}from"./chunk-A7L4WWVW.js";import{a as I,b as Y,c as T,d as O,e as F,j as E,k as W}from"./chunk-32FWKUUV.js";import{i as R}from"./chunk-EX6TP7QM.js";var f={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,minWidth:120,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60},A={nodeLabelFontSize:T.nodeLabel,edgeLabelFontSize:T.edgeLabel,groupHeaderFontSize:T.groupHeader,nodeLabelFontWeight:700,edgeLabelFontWeight:O.edgeLabel,groupHeaderFontWeight:O.groupHeader,nodePaddingX:f.boxPadX,nodePaddingY:f.sectionPadY,nodeCornerRadius:0,nodeLineWidth:F.outerBox,edgeLineWidth:F.connector,groupCornerRadius:0,groupPaddingX:f.boxPadX,groupPaddingY:f.sectionPadY,groupLineWidth:F.outerBox};function oe(o,t){if(!o)return t;let u=v(o,"class","nodeSpacing"),s=v(o,"class","rankSpacing"),x=D(o,["class","hierarchicalNamespaces"]),b=t.class?.hierarchicalNamespaces??(typeof x=="boolean"?x:void 0);return u===void 0&&s===void 0&&b===void 0?t:{...t,nodeSpacing:t.nodeSpacing??u,layerSpacing:t.layerSpacing??s,...b!==void 0?{class:{...t.class,hierarchicalNamespaces:b}}:{}}}function v(o,t,u){let s=D(o,[t,u]);return typeof s=="number"&&Number.isFinite(s)&&s>=0?s:void 0}var B="ns:";function z(o,t,u=!0){let s=[];for(let x of o){let b=t?`${t}.${x.name}`:x.name;s.push({path:b,...u&&t?{parentPath:t}:{},ns:x}),s.push(...z(x.children,b,u))}return s}function j(o,t,u){let s=W(t,A,u),x=new Map;for(let d of o.classes){let p=E(d.label,s.nodeTextTransform),S=Math.max(f.headerBaseHeight,R(p,s.nodeLabelFontSize,s.nodeLabelFontWeight).height+s.nodePaddingY*2),n=d.annotation?S+f.annotationHeight:S,l=d.attributes.length>0?d.attributes.length*f.memberRowHeight+s.nodePaddingY:f.emptySectionHeight,h=d.methods.length>0?d.methods.length*f.memberRowHeight+s.nodePaddingY:f.emptySectionHeight,a=I(p,s.nodeLabelFontSize,s.nodeLabelFontWeight),e=_(d.attributes),g=_(d.methods),r=Math.max(f.minWidth,a+s.nodePaddingX*2,e+s.nodePaddingX*2,g+s.nodePaddingX*2),c=n+l+h;x.set(d.id,{width:r,height:c,headerHeight:n,attrHeight:l,methodHeight:h})}let b=t.nodeSpacing??f.nodeSpacing,N=t.layerSpacing??f.layerSpacing,H=t.class?.hierarchicalNamespaces!==!1,i=z(o.namespaces,void 0,H),m=i.length>0,k={"elk.algorithm":"layered","elk.direction":X(o.direction??"TB"),"elk.spacing.nodeNode":String(b),"elk.layered.spacing.nodeNodeBetweenLayers":String(N),"elk.padding":`[top=${f.padding},left=${f.padding},bottom=${f.padding},right=${f.padding}]`,"elk.edgeRouting":"ORTHOGONAL","elk.edgeLabels.placement":"CENTER"};m&&(k["elk.hierarchyHandling"]="INCLUDE_CHILDREN");let w={id:"root",layoutOptions:k,children:[],edges:[]},P=new Map;for(let d of i)for(let p of d.ns.classIds)P.has(p)||P.set(p,d.path);let C=new Map,M=s.groupHeaderFontSize+16;for(let d of i){let p={id:B+d.path,layoutOptions:{"elk.padding":`[top=${M+s.groupPaddingY},left=${s.groupPaddingX+8},bottom=${s.groupPaddingY+8},right=${s.groupPaddingX+8}]`,"elk.spacing.nodeNode":String(b),"elk.layered.spacing.nodeNodeBetweenLayers":String(N),"elk.edgeRouting":"ORTHOGONAL","elk.edgeLabels.placement":"CENTER"},children:[],edges:[]};C.set(d.path,p),(d.parentPath?C.get(d.parentPath):w).children.push(p)}for(let d of o.classes){let p=x.get(d.id),S={id:d.id,width:p.width,height:p.height},n=P.get(d.id);(n?C.get(n):w).children.push(S)}let L=d=>{let p=P.get(d);if(!p)return[];if(!H)return[p];let S=p.split(".");return S.map((n,l)=>S.slice(0,l+1).join("."))};for(let d=0;d<o.relationships.length;d++){let p=o.relationships[d],S={id:`e${d}`,sources:[p.from],targets:[p.to]};if(p.label){let a=E(p.label,s.edgeTextTransform),e=R(a,s.edgeLabelFontSize,s.edgeLabelFontWeight);S.labels=[{text:a,width:e.width+8,height:e.height+6}]}let n=L(p.from),l=L(p.to),h;for(let a=0;a<Math.min(n.length,l.length)&&n[a]===l[a];a++)h=n[a];(h?C.get(h):w).edges.push(S)}return{elkGraph:w,classSizes:x}}function U(o,t,u,s,x){let b=new Map;for(let n of t.classes)b.set(n.id,n);let N=new Map(z(t.namespaces,void 0,x).map(n=>[n.path,n])),H=s.groupHeaderFontSize+16,i=[],m=[],k=new Map,w=(n,l,h)=>{for(let a of n.edges??[]){let e=[];if(a.sections&&a.sections.length>0){let c=a.sections[0];e.push({x:c.startPoint.x+l,y:c.startPoint.y+h});for(let y of c.bendPoints??[])e.push({x:y.x+l,y:y.y+h});e.push({x:c.endPoint.x+l,y:c.endPoint.y+h})}let g,r=a.labels?.[0];r&&r.x!=null&&r.y!=null&&(g={x:r.x+(r.width??0)/2+l,y:r.y+(r.height??0)/2+h}),k.set(a.id,{points:e,labelPosition:g})}for(let a of n.children??[]){let e=(a.x??0)+l,g=(a.y??0)+h;if(a.id.startsWith(B)){let c=a.id.slice(B.length),y=N.get(c);m.push({id:c,name:y?.ns.name??c,label:y?.ns.label??y?.ns.name??c,parentId:y?.parentPath,classIds:y?[...y.ns.classIds]:[],x:e,y:g,width:a.width??0,height:a.height??0,headerHeight:H}),w(a,e,g);continue}let r=b.get(a.id);if(r){let c=u.get(r.id);i.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e,y:g,width:a.width??c.width,height:a.height??c.height,headerHeight:c.headerHeight,attrHeight:c.attrHeight,methodHeight:c.methodHeight,...r.className?{className:r.className}:{},...r.href?{href:r.href}:{},...r.className&&t.classDefs.get(r.className)||r.inlineStyle?{inlineStyle:{...r.className?t.classDefs.get(r.className):{},...r.inlineStyle}}:{}})}}};w(o,0,0);let P=[];for(let n=0;n<t.relationships.length;n++){let l=t.relationships[n],h=k.get(`e${n}`);P.push({from:l.from,to:l.to,type:l.type,markerAt:l.markerAt,fromType:l.fromType,toType:l.toType,label:l.label,fromCardinality:l.fromCardinality,toCardinality:l.toCardinality,points:h?.points??[],labelPosition:h?.labelPosition})}let C=o.width??600,M=o.height??400;K(P,i,s,C,M);let L=i.map(n=>({x:n.x,y:n.y,width:n.width,height:n.height})),d=(n,l,h=8)=>n.x<l.x+l.width+h&&n.x+n.width+h>l.x&&n.y<l.y+l.height+h&&n.y+n.height+h>l.y,p=M+16,S=t.notes.map(n=>{let l=R(n.text,12,400),h=Math.max(90,l.width+24),a=Math.max(40,l.height+18),e=n.for?i.find(r=>r.id===n.for):void 0,g;if(e){let r=[];for(let c=0;c<Math.max(4,t.notes.length+1);c++){let y=c*(a+12);r.push({x:e.x+e.width+24,y:e.y+y,width:h,height:a,targetX:e.x+e.width,targetY:e.y+e.height/2,noteX:e.x+e.width+24,noteY:e.y+y+a/2},{x:e.x-h-24,y:e.y+y,width:h,height:a,targetX:e.x,targetY:e.y+e.height/2,noteX:e.x-24,noteY:e.y+y+a/2},{x:e.x,y:e.y+e.height+24+y,width:h,height:a,targetX:e.x+e.width/2,targetY:e.y+e.height,noteX:e.x+h/2,noteY:e.y+e.height+24+y})}g=r.find(c=>c.x>=f.padding&&c.y>=f.padding&&!L.some(y=>d(c,y)))??{x:C+24,y:e.y,width:h,height:a,targetX:e.x+e.width,targetY:e.y+e.height/2,noteX:C+24,noteY:e.y+a/2}}else g={x:f.padding,y:p,width:h,height:a},p+=a+12;return L.push(g),C=Math.max(C,g.x+h+f.padding),M=Math.max(M,g.y+a+f.padding),{text:n.text,...n.for?{for:n.for}:{},...g}});return{width:C,height:M,accessibilityTitle:t.accessibilityTitle,accessibilityDescription:t.accessibilityDescription,classes:i,relationships:P,notes:S,namespaces:m}}function K(o,t,u,s,x){let b=(i,m)=>Math.min(i.x1,m.x1)-Math.max(i.x0,m.x0)>.5&&Math.min(i.y1,m.y1)-Math.max(i.y0,m.y0)>.5,N=t.map(i=>({x0:i.x-1,y0:i.y-1,x1:i.x+i.width+1,y1:i.y+i.height+1}));for(let i of o){if(!i.label||!i.labelPosition)continue;let m=R(E(i.label,u.edgeTextTransform),u.edgeLabelFontSize,u.edgeLabelFontWeight);N.push({x0:i.labelPosition.x-m.width/2-2,y0:i.labelPosition.y-8-m.height/2-2,x1:i.labelPosition.x+m.width/2+2,y1:i.labelPosition.y-8+m.height/2+2})}let H=(i,m,k)=>{let w=R(i,u.edgeLabelFontSize,u.edgeLabelFontWeight),P=w.width/2+2,C=w.height/2+2,M=k.x-m.x,L=k.y-m.y,d=Math.abs(M)>=Math.abs(L),p=d?Math.sign(M||1):0,S=d?0:Math.sign(L||1),n=-S,l=p,h=[];for(let g=10;g<=190;g+=12)h.push(-g,g);let a=[];for(let g=14;g<=150;g+=10)for(let r of h){let c={x:m.x+p*g+n*r,y:m.y+S*g+l*r},y={x0:c.x-P,y0:c.y-C,x1:c.x+P,y1:c.y+C};if(a.push({point:c,box:y}),!(y.x0<0||y.y0<0||y.x1>s||y.y1>x)&&N.every(G=>!b(y,G)))return N.push(y),c}let e=a.map(g=>({...g,collisions:N.filter(r=>b(g.box,r)).length})).sort((g,r)=>g.collisions-r.collisions||g.point.y-r.point.y||g.point.x-r.point.x)[0]??{point:m,box:{x0:m.x,y0:m.y,x1:m.x,y1:m.y}};return N.push(e.box),e.point};for(let i of o)if(!(i.points.length<2)&&(i.fromCardinality&&(i.fromCardinalityPosition=H(i.fromCardinality,i.points[0],i.points[1])),i.toCardinality)){let m=i.points.length-1;i.toCardinalityPosition=H(i.toCardinality,i.points[m],i.points[m-1])}}function se(o,t={},u){if(o.classes.length===0)return{width:0,height:0,accessibilityTitle:o.accessibilityTitle,accessibilityDescription:o.accessibilityDescription,classes:[],relationships:[],notes:[],namespaces:[]};let{elkGraph:s,classSizes:x}=j(o,t,u),b=$(s);return U(b,o,x,W(t,A,u),t.class?.hierarchicalNamespaces!==!1)}function _(o){if(o.length===0)return 0;let t=0;for(let u of o){let s=Z(u),x=Y(s,f.memberFontSize);x>t&&(t=x)}return t}function Z(o){let t=o.visibility?`${o.visibility} `:"",u=o.isMethod?`${o.name}(${o.params||""})`:o.name,s=o.type?`: ${o.type}`:"";return`${t}${u}${s}`}var q=/^direction\s+(TB|TD|BT|LR|RL)\s*$/i;function re(o){let t=o.match(q);return t?t[1].toUpperCase():void 0}export{A as a,oe as b,v as c,se as d,re as e};