archyne 0.3.1-alpha.1 → 0.3.2-alpha.1
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.
- package/README.md +4 -1
- package/dist/assets/{abnfDiagram-N423BO3Z-4pyYBaTX.js → abnfDiagram-N423BO3Z-CWxCA29s.js} +1 -1
- package/dist/assets/{arc-DqyZOhUa.js → arc-BPhcgyOR.js} +1 -1
- package/dist/assets/{architectureDiagram-T3A2C74G-DIjgv-NI.js → architectureDiagram-T3A2C74G-DbJtNiJ8.js} +1 -1
- package/dist/assets/{blockDiagram-VBNYF7ZC-DAj519m0.js → blockDiagram-VBNYF7ZC-D14dxPQ6.js} +1 -1
- package/dist/assets/{c4Diagram-5PPSVZJV-BGAUz5os.js → c4Diagram-5PPSVZJV-_Ru2AQyv.js} +1 -1
- package/dist/assets/channel-x2nnREdF.js +1 -0
- package/dist/assets/{chunk-2GRJ4B5K-9riOkF0z.js → chunk-2GRJ4B5K-B45veiLl.js} +1 -1
- package/dist/assets/{chunk-2Q5K7J3B-C8-v72lU.js → chunk-2Q5K7J3B-BYEJghF5.js} +1 -1
- package/dist/assets/{chunk-5RXB4S5H-VrpO2713.js → chunk-5RXB4S5H-D6PWk-Fh.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-DJvpfjgN.js → chunk-5VM5RSS4-DkT1fHDH.js} +1 -1
- package/dist/assets/{chunk-6Q2QTUOP-sZF2zMfA.js → chunk-6Q2QTUOP-DwN_ODU0.js} +1 -1
- package/dist/assets/{chunk-GF5L2VYU-B2O8ZtG_.js → chunk-GF5L2VYU-CfLWnAFR.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-v5qnwWP9.js → chunk-JWPE2WC7-Bvoco_OT.js} +1 -1
- package/dist/assets/{chunk-KBJHAD2P-BUG-lI6Q.js → chunk-KBJHAD2P-Bl8ANVAT.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-UUOY90Sc.js → chunk-RYQCIY6F-CUFEfSAp.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BvKn-RUn.js → chunk-XXDRQBXY-CqS46WpP.js} +1 -1
- package/dist/assets/classDiagram-JCYQIIEL-Dcqht9zY.js +1 -0
- package/dist/assets/classDiagram-v2-OCEON4UE-Dcqht9zY.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-DTsJ3Tik.js → cose-bilkent-JH36ORCC-0fLdUP4n.js} +1 -1
- package/dist/assets/{cynefin-VYW2F7L2-Bme8RBBm.js → cynefin-VYW2F7L2-CB-4Q2Uq.js} +1 -1
- package/dist/assets/{cynefinDiagram-MW4NZA55-dvmfcWHC.js → cynefinDiagram-MW4NZA55-m6YSI3Bh.js} +1 -1
- package/dist/assets/{dagre-VZM6K2ZE-BsiEOoIC.js → dagre-VZM6K2ZE-BsmbvCId.js} +1 -1
- package/dist/assets/{diagram-7IWD3JNH-CHR-dtEw.js → diagram-7IWD3JNH-iTWBScbD.js} +1 -1
- package/dist/assets/{diagram-B4RE2ZJO-BzwbwtCE.js → diagram-B4RE2ZJO-DJ95aX4N.js} +1 -1
- package/dist/assets/{diagram-LBJQPF4R-CTzFBrtX.js → diagram-LBJQPF4R-D4V1ejJ0.js} +1 -1
- package/dist/assets/{diagram-Q27KOJAE-B2UEx922.js → diagram-Q27KOJAE-BJ2SnmJt.js} +1 -1
- package/dist/assets/{diagram-UB23O5K3-Hbc-yQWH.js → diagram-UB23O5K3-B33ky4tq.js} +1 -1
- package/dist/assets/{ebnfDiagram-BXEA7PRR-BME5TMIm.js → ebnfDiagram-BXEA7PRR-B8YZxzzx.js} +1 -1
- package/dist/assets/{elk-api-C7W47lSN.js → elk-api-BEoK8cSs.js} +1 -1
- package/dist/assets/{elk.bundled-B1dwyv4e.js → elk.bundled-g5J3chN5.js} +1 -1
- package/dist/assets/{erDiagram-JOGREHBK-CRNN9X8X.js → erDiagram-JOGREHBK-B7RkeG0t.js} +1 -1
- package/dist/assets/{flowDiagram-UKHOOZJN-CmMzCc2C.js → flowDiagram-UKHOOZJN-Bhg1RufJ.js} +1 -1
- package/dist/assets/{fromDot-CzRtepTT.js → fromDot-CQsAmWbW.js} +1 -1
- package/dist/assets/{fromDrawio-gSnkX-tI.js → fromDrawio-DEgkUjY8.js} +1 -1
- package/dist/assets/{fromExcalidraw-D3y-jRyG.js → fromExcalidraw-BzgOaI_g.js} +1 -1
- package/dist/assets/{fromPlantuml-Dtd5lHle.js → fromPlantuml-BXgnqEO6.js} +1 -1
- package/dist/assets/{fromSql-DRiVkm4z.js → fromSql-CgaUND0o.js} +1 -1
- package/dist/assets/{fromVsdx-BX1MgjJj.js → fromVsdx-_QnAzQCc.js} +1 -1
- package/dist/assets/{ganttDiagram-PKOTCBZU-CZ2Kw37G.js → ganttDiagram-PKOTCBZU-6q1OXMFs.js} +1 -1
- package/dist/assets/{gitGraphDiagram-DS77QQ5N-DlOq3Zfn.js → gitGraphDiagram-DS77QQ5N-DBIluxD2.js} +1 -1
- package/dist/assets/{index-8QNjiUCo.js → index-D58D9MBA.js} +5 -5
- package/dist/assets/{infoDiagram-6WML65LV-BnIs6w-Z.js → infoDiagram-6WML65LV-BogiGFsC.js} +1 -1
- package/dist/assets/{ishikawaDiagram-WSZJBQD7-D0Fonp-_.js → ishikawaDiagram-WSZJBQD7-BnuS3rDr.js} +1 -1
- package/dist/assets/{journeyDiagram-NVQOT4AX-D6T93Gjy.js → journeyDiagram-NVQOT4AX-C1LbH3qg.js} +1 -1
- package/dist/assets/{kanban-definition-27J2QSJJ-77g2fQBI.js → kanban-definition-27J2QSJJ-CC4tpXS8.js} +1 -1
- package/dist/assets/{linear-D3VG5KqI.js → linear-nPRvbK9t.js} +1 -1
- package/dist/assets/{mermaid.core-BJ8I5XuR.js → mermaid.core-d3X_EolB.js} +4 -4
- package/dist/assets/{mindmap-definition-FAOFIHXS-DJHSfRX0.js → mindmap-definition-FAOFIHXS-BKw0CExu.js} +1 -1
- package/dist/assets/{pegDiagram-VL7TDLO6-tJ_RKlAY.js → pegDiagram-VL7TDLO6-C0crO6aC.js} +1 -1
- package/dist/assets/{pieDiagram-7S7Q4E2Y-DS4KhYZF.js → pieDiagram-7S7Q4E2Y-5YsXd83r.js} +1 -1
- package/dist/assets/{plantumlFamilies-C25pY0S3.js → plantumlFamilies-BQWcuhsm.js} +1 -1
- package/dist/assets/{quadrantDiagram-CIZ2JOQS-CRUD5ZCL.js → quadrantDiagram-CIZ2JOQS-BWRDIcFE.js} +1 -1
- package/dist/assets/{railroadDiagram-AXF67PYL-HSv4pAnl.js → railroadDiagram-AXF67PYL-BeJeN8NK.js} +1 -1
- package/dist/assets/{requirementDiagram-LRYGKXZP-CMPMrByx.js → requirementDiagram-LRYGKXZP-lgxjjOkj.js} +1 -1
- package/dist/assets/{sankeyDiagram-W5VNT64P-DXdnBQ2S.js → sankeyDiagram-W5VNT64P-BdDlQIjC.js} +1 -1
- package/dist/assets/{sequenceDiagram-SI44F4Z6-ClYwQ-pe.js → sequenceDiagram-SI44F4Z6-CftqXzOB.js} +1 -1
- package/dist/assets/{sizeCapture-X5ZJPWSS-DsP_oGo9.js → sizeCapture-X5ZJPWSS-DqAD3Y1J.js} +1 -1
- package/dist/assets/{stateDiagram-OKZ733FA-DLRBTrRe.js → stateDiagram-OKZ733FA-CsK1tZu_.js} +1 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-DoKVKwvk.js +1 -0
- package/dist/assets/{swimlanes-SLNWSIFB-BAPCOVRH.js → swimlanes-SLNWSIFB-y49WYIGH.js} +2 -2
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-DdYZRZ7q.js +8 -0
- package/dist/assets/{timeline-definition-Z64GVDOM-BTlEBBOx.js → timeline-definition-Z64GVDOM-dsSDjxsB.js} +1 -1
- package/dist/assets/{vennDiagram-T6HMQDX7-V2gZScrD.js → vennDiagram-T6HMQDX7-D5ubu60T.js} +1 -1
- package/dist/assets/{wardleyDiagram-T6FBY63Y-CRuHSPEB.js → wardleyDiagram-T6FBY63Y-DqlVsICK.js} +1 -1
- package/dist/assets/{xychartDiagram-ELKLHX3M-CGkFYp8B.js → xychartDiagram-ELKLHX3M-Z5y_JujJ.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-CZ56rhQ3.js +0 -1
- package/dist/assets/classDiagram-JCYQIIEL-BDSIBEGS.js +0 -1
- package/dist/assets/classDiagram-v2-OCEON4UE-BDSIBEGS.js +0 -1
- package/dist/assets/stateDiagram-v2-UEYNNEHI-4OKtojNt.js +0 -1
- package/dist/assets/swimlanesDiagram-ULZ7WXOC-KQWQYXrW.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./elk-api-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./elk-api-BEoK8cSs.js","./_commonjs-dynamic-modules-TDtrdbi3.js","./elk.bundled-g5J3chN5.js","./fromVsdx-_QnAzQCc.js","./browser-CVIx06OT.js","./importShared-Cxa-p4D0.js","./fromDrawio-DEgkUjY8.js","./fromDot-CQsAmWbW.js","./fromExcalidraw-BzgOaI_g.js","./fromPlantuml-BXgnqEO6.js","./plantumlFamilies-BQWcuhsm.js","./fromSql-CgaUND0o.js","./pdf-DIY7PTna.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var BR=Object.defineProperty;var YR=(e,t,n)=>t in e?BR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Gv=(e,t,n)=>YR(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();var XJ=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B0={exports:{}},Uc={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -72,7 +72,7 @@ Error generating stack: `+p.message+`
|
|
|
72
72
|
M${_.x},${_.y}h${_.width}v${_.height}h${-_.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}CE.displayName="MiniMap";const t7=Y.memo(CE),e7=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,n7={[Ko.Line]:"right",[Ko.Handle]:"bottom-right"};function i7({nodeId:e,position:t,variant:n=Ko.Handle,className:i,style:s=void 0,children:r,color:l,minWidth:c=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:g,autoScale:y=!0,shouldResize:$,onResizeStart:v,onResize:S,onResizeEnd:C}){const k=XC(),O=typeof e=="string"?e:k,E=$e(),T=Y.useRef(null),j=n===Ko.Handle,N=qt(Y.useCallback(e7(j&&y),[j,y]),Oe),_=Y.useRef(null),M=t??n7[n];Y.useEffect(()=>{if(!(!T.current||!O))return _.current||(_.current=kH({domNode:T.current,nodeId:O,getStoreItems:()=>{const{nodeLookup:G,transform:I,snapGrid:Z,snapToGrid:z,nodeOrigin:B,domNode:H}=E.getState();return{nodeLookup:G,transform:I,snapGrid:Z,snapToGrid:z,nodeOrigin:B,paneDomNode:H}},onChange:(G,I)=>{const{triggerNodeChanges:Z,nodeLookup:z,parentLookup:B,nodeOrigin:H}=E.getState(),L=[],F={x:G.x,y:G.y},Q=z.get(O);if(Q&&Q.expandParent&&Q.parentId){const tt=Q.origin??H,R=G.width??Q.measured.width??0,P=G.height??Q.measured.height??0,K={id:Q.id,parentId:Q.parentId,rect:{width:R,height:P,...wC({x:G.x??Q.position.x,y:G.y??Q.position.y},{width:R,height:P},Q.parentId,z,tt)}},it=Z5([K],z,B,H);L.push(...it),F.x=G.x?Math.max(tt[0]*R,G.x):void 0,F.y=G.y?Math.max(tt[1]*P,G.y):void 0}if(F.x!==void 0&&F.y!==void 0){const tt={id:O,type:"position",position:{...F}};L.push(tt)}if(G.width!==void 0&&G.height!==void 0){const R={id:O,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:G.width,height:G.height}};L.push(R)}for(const tt of I){const R={...tt,type:"position"};L.push(R)}Z(L)},onEnd:({width:G,height:I})=>{const Z={id:O,type:"dimensions",resizing:!1,dimensions:{width:G,height:I}};E.getState().triggerNodeChanges([Z])}})),_.current.update({controlPosition:M,boundaries:{minWidth:c,minHeight:u,maxWidth:f,maxHeight:d},keepAspectRatio:m,resizeDirection:g,onResizeStart:v,onResize:S,onResizeEnd:C,shouldResize:$}),()=>{var G;(G=_.current)==null||G.destroy()}},[M,c,u,f,d,m,v,S,C,$]);const q=M.split("-");return w.jsx("div",{className:Ye(["react-flow__resize-control","nodrag",...q,n,i]),ref:T,style:{...s,scale:N,...l&&{[j?"backgroundColor":"borderColor"]:l}},children:r})}const aS=Y.memo(i7);function EE({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:i,lineClassName:s,lineStyle:r,color:l,minWidth:c=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:m=!1,autoScale:g=!0,shouldResize:y,onResizeStart:$,onResize:v,onResizeEnd:S}){return t?w.jsxs(w.Fragment,{children:[$H.map(C=>w.jsx(aS,{className:s,style:r,nodeId:e,position:C,variant:Ko.Line,color:l,minWidth:c,minHeight:u,maxWidth:f,maxHeight:d,onResizeStart:$,keepAspectRatio:m,autoScale:g,shouldResize:y,onResize:v,onResizeEnd:S},C)),xH.map(C=>w.jsx(aS,{className:n,style:i,nodeId:e,position:C,color:l,minWidth:c,minHeight:u,maxWidth:f,maxHeight:d,onResizeStart:$,keepAspectRatio:m,autoScale:g,shouldResize:y,onResize:v,onResizeEnd:S},C))]}):null}const cS=e=>{let t;const n=new Set,i=(f,d)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const g=t;t=d??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(y=>y(t,g))}},s=()=>t,c={setState:i,getState:s,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f))},u=t=e(i,s,c);return c},s7=(e=>e?cS(e):cS),r7=e=>e;function o7(e,t=r7){const n=iu.useSyncExternalStore(e.subscribe,iu.useCallback(()=>t(e.getState()),[e,t]),iu.useCallback(()=>t(e.getInitialState()),[e,t]));return iu.useDebugValue(n),n}const uS=e=>{const t=s7(e),n=i=>o7(t,i);return Object.assign(n,t),n},Ln=(e=>e?uS(e):uS),X5=["square","round","stadium","subroutine","cylinder","circle","doublecircle","diamond","hexagon","odd","trapezoid","inv_trapezoid","lean_right","lean_left"],l7={square:"Process",round:"Rounded",stadium:"Terminator",subroutine:"Subroutine",cylinder:"Database",circle:"Circle",doublecircle:"Double circle",diamond:"Decision",hexagon:"Hexagon",odd:"Flag",trapezoid:"Trapezoid",inv_trapezoid:"Trapezoid alt",lean_right:"Input/Output",lean_left:"Output/Input"},fw=["ONLY_ONE","ZERO_OR_ONE","ZERO_OR_MORE","ONE_OR_MORE"],hS={ONLY_ONE:"exactly 1",ZERO_OR_ONE:"0 or 1",ZERO_OR_MORE:"0..N",ONE_OR_MORE:"1..N"},fS=["none","extension","composition","aggregation","dependency"],Jo=60,DE=12,a7=["->>","-->>","->","-->","-x","--x","-)","--)"],c7={"->>":"Solid arrow","-->>":"Dotted arrow","->":"Solid open","-->":"Dotted open","-x":"Solid cross","--x":"Dotted cross","-)":"Async","--)":"Dotted async"},NE=["person","external_person","system","external_system","system_db","system_queue","container","external_container","container_db","container_queue","component","external_component","component_db","component_queue","external_system_db","external_system_queue","external_container_db","external_container_queue","external_component_db","external_component_queue"];function xe(e){return e.type==="group"}function TE(e){switch(e){case"circle":case"doublecircle":return{width:96,height:96};case"diamond":return{width:150,height:86};default:return{width:160,height:54}}}function u7(e){const t=n=>e==null?void 0:e.some(i=>i.replace(/\s+/g,"")===`${n}:none`);return!!(t("fill")&&t("stroke"))}function jE(e){const t=(e??[]).find(i=>i.trim().startsWith("font-size:")),n=/^(\d+(?:\.\d+)?)px$/.exec((t==null?void 0:t.slice(t.indexOf(":")+1).trim())??"");return n?Number(n[1]):DE}function h7(e){const t=e.imgWidth??Jo,n=e.imgHeight??Jo,i=jE(e.styles);return{width:Math.round(Math.max(t,e.label.length*.58*i)+16),height:Math.round(n+i+18)}}function Qo(e){switch(e.type){case"shape":return e.data.img&&u7(e.data.styles)?h7(e.data):TE(e.data.shape);case"state":{const t=e.data.stateType;return t==="normal"?{width:150,height:46}:t==="choice"?{width:40,height:40}:t==="fork"||t==="join"?{width:70,height:12}:{width:28,height:28}}case"entity":return{width:210,height:36+Math.max(1,e.data.attributes.length)*22};case"class":return{width:210,height:38+(e.data.members.length+e.data.methods.length)*20+12};case"participant":return{width:150,height:48};case"note":return{width:150,height:64};case"service":return{width:110,height:96};case"junction":return{width:16,height:16};case"c4":return{width:200,height:110};default:return{width:320,height:220}}}const f7="modulepreload",d7=function(e,t){return new URL(e,t).href},dS={},ee=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let l=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};const c=document.getElementsByTagName("link"),u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=l(n.map(d=>{if(d=d7(d,i),d in dS)return;dS[d]=!0;const m=d.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(!!i)for(let v=c.length-1;v>=0;v--){const S=c[v];if(S.href===d&&(!m||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${g}`))return;const $=document.createElement("link");if($.rel=m?"stylesheet":f7,m||($.as="script"),$.crossOrigin="",$.href=d,f&&$.setAttribute("nonce",f),document.head.appendChild($),m)return new Promise((v,S)=>{$.addEventListener("load",v),$.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function r(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&r(c.reason);return t().catch(r)})},p7=Object.freeze({left:0,top:0,width:16,height:16}),Xd=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),RE=Object.freeze({...p7,...Xd}),m7=Object.freeze({...RE,body:"",hidden:!1}),g7=Object.freeze({width:null,height:null}),y7=Object.freeze({...g7,...Xd});function w7(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const i=((e.rotate||0)+(t.rotate||0))%4;return i&&(n.rotate=i),n}function pS(e,t){const n=w7(e,t);for(const i in m7)i in Xd?i in e&&!(i in n)&&(n[i]=Xd[i]):i in t?n[i]=t[i]:i in e&&(n[i]=e[i]);return n}function x7(e,t){const n=e.icons,i=e.aliases||Object.create(null),s=Object.create(null);function r(l){if(n[l])return s[l]=[];if(!(l in s)){s[l]=null;const c=i[l]&&i[l].parent,u=c&&r(c);u&&(s[l]=[c].concat(u))}return s[l]}return(t||Object.keys(n).concat(Object.keys(i))).forEach(r),s}function mS(e,t,n){const i=e.icons,s=e.aliases||Object.create(null);let r={};function l(c){r=pS(i[c]||s[c],r)}return l(t),n.forEach(l),pS(e,r)}function gS(e,t){if(e.icons[t])return mS(e,t,[]);const n=x7(e,[t])[t];return n?mS(e,t,n):null}const $7=/(-?[0-9.]*[0-9]+[0-9.]*)/g,b7=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function yS(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const i=e.split($7);if(i===null||!i.length)return e;const s=[];let r=i.shift(),l=b7.test(r);for(;;){if(l){const c=parseFloat(r);isNaN(c)?s.push(r):s.push(Math.ceil(c*t*n)/n)}else s.push(r);if(r=i.shift(),r===void 0)return s.join("");l=!l}}function v7(e,t="defs"){let n="";const i=e.indexOf("<"+t);for(;i>=0;){const s=e.indexOf(">",i),r=e.indexOf("</"+t);if(s===-1||r===-1)break;const l=e.indexOf(">",r);if(l===-1)break;n+=e.slice(s+1,r).trim(),e=e.slice(0,i).trim()+e.slice(l+1)}return{defs:n,content:e}}function S7(e,t){return e?"<defs>"+e+"</defs>"+t:t}function O7(e,t,n){const i=v7(e);return S7(i.defs,t+i.content+n)}const k7=e=>e==="unset"||e==="undefined"||e==="none";function C7(e,t){const n={...RE,...e},i={...y7,...t},s={left:n.left,top:n.top,width:n.width,height:n.height};let r=n.body;[n,i].forEach(v=>{const S=[],C=v.hFlip,k=v.vFlip;let O=v.rotate;C?k?O+=2:(S.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),S.push("scale(-1 1)"),s.top=s.left=0):k&&(S.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),S.push("scale(1 -1)"),s.top=s.left=0);let E;switch(O<0&&(O-=Math.floor(O/4)*4),O=O%4,O){case 1:E=s.height/2+s.top,S.unshift("rotate(90 "+E.toString()+" "+E.toString()+")");break;case 2:S.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:E=s.width/2+s.left,S.unshift("rotate(-90 "+E.toString()+" "+E.toString()+")");break}O%2===1&&(s.left!==s.top&&(E=s.left,s.left=s.top,s.top=E),s.width!==s.height&&(E=s.width,s.width=s.height,s.height=E)),S.length&&(r=O7(r,'<g transform="'+S.join(" ")+'">',"</g>"))});const l=i.width,c=i.height,u=s.width,f=s.height;let d,m;l===null?(m=c===null?"1em":c==="auto"?f:c,d=yS(m,u/f)):(d=l==="auto"?u:l,m=c===null?yS(d,f/u):c==="auto"?f:c);const g={},y=(v,S)=>{k7(S)||(g[v]=S.toString())};y("width",d),y("height",m);const $=[s.left,s.top,u,f];return g.viewBox=$.join(" "),{attributes:g,viewBox:$,body:r}}const E7=/\sid="(\S+)"/g,wS=new Map;function D7(e){e=e.replace(/[0-9]+$/,"")||"a";const t=wS.get(e)||0;return wS.set(e,t+1),t?`${e}${t}`:e}function N7(e){const t=[];let n;for(;n=E7.exec(e);)t.push(n[1]);if(!t.length)return e;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(s=>{const r=D7(s),l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+r+i+"$3")}),e=e.replace(new RegExp(i,"g"),""),e}function T7(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in t)n+=" "+i+'="'+t[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}const j7=new Set(["svg","g","path","circle","ellipse","rect","line","polyline","polygon","defs","lineargradient","radialgradient","stop","clippath","mask","use","title","desc","symbol","pattern","text","tspan"]),R7=new Set(["d","fill","fill-opacity","fill-rule","clip-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","opacity","transform","viewbox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","points","offset","stop-color","stop-opacity","gradientunits","gradienttransform","spreadmethod","patternunits","clip-path","mask","id","class","xmlns","preserveaspectratio","text-anchor","font-size","font-family","font-weight","dominant-baseline"]);function M7(e){return e.trim().startsWith("#")}function _7(e){const t=e.toLowerCase();return t.includes("javascript:")||t.includes("data:text/html")?!1:[...t.matchAll(/url\(\s*['"]?([^'")]*)/g)].map(i=>i[1]).every(i=>i.trim().startsWith("#"))}function sm(e){let t;try{t=new DOMParser().parseFromString(e,"image/svg+xml")}catch{return null}if(t.getElementsByTagName("parsererror").length>0)return null;const n=t.documentElement;if(!n||n.tagName.toLowerCase()!=="svg")return null;const i=s=>{for(const r of[...s.children]){if(!j7.has(r.tagName.toLowerCase())){r.remove();continue}i(r)}for(const r of[...s.attributes]){const l=r.name.toLowerCase();if(l==="href"||l==="xlink:href"){M7(r.value)||s.removeAttribute(r.name);continue}(!R7.has(l)||!_7(r.value))&&s.removeAttribute(r.name)}};if(i(n),!n.getAttribute("viewBox")){const s=Number.parseFloat(n.getAttribute("width")??""),r=Number.parseFloat(n.getAttribute("height")??"");Number.isFinite(s)&&Number.isFinite(r)&&s>0&&r>0&&n.setAttribute("viewBox",`0 0 ${s} ${r}`)}return n.removeAttribute("width"),n.removeAttribute("height"),new XMLSerializer().serializeToString(n)}function A7(e){var f,d,m;const t=/<svg\b([^>]*)>/i.exec(e);if(!t)return null;const n=t[1],i=e.slice(t.index+t[0].length).replace(/<\/svg\s*>\s*$/i,"");if(!i.trim())return null;const s=(f=/viewBox\s*=\s*["']([^"']+)["']/i.exec(n))==null?void 0:f[1],[,,r,l]=s?s.trim().split(/[\s,]+/).map(Number):[],c=Number(r)||Number((d=/width\s*=\s*["']([\d.]+)/i.exec(n))==null?void 0:d[1]),u=Number(l)||Number((m=/height\s*=\s*["']([\d.]+)/i.exec(n))==null?void 0:m[1]);return!Number.isFinite(c)||!Number.isFinite(u)||!c||!u?null:{body:i.trim(),width:Math.round(c),height:Math.round(u)}}const Kd=/^\s*%%\s*graph:icons\s+(\{.*\})\s*$/m,as="custom";function tl(e){return(e.replace(/[?#].*$/,"").replace(/\\/g,"/").split("/").pop()??"").toLowerCase().replace(/\.svg$/,"").replace(/\(\d+\)/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/^\d{4,}-/,"").replace(/^icon-(service-|)/,"").replace(/^-+|-+$/g,"").slice(0,40)||"icon"}function z7(e){const t=e.match(Kd);if(!t)return null;try{const n=JSON.parse(t[1]),i={};for(const[s,r]of Object.entries(n)){if(typeof r!="string")continue;const l=sm(r);l&&(i[tl(s)]=l)}return i}catch{return null}}function H7(e){return e.replace(Kd,"").replace(/\n+$/,`
|
|
73
73
|
`)}function B7(e){return`%% graph:icons ${JSON.stringify(e)}`}function xS(e,t){const n=Object.entries(t).filter(([,s])=>s.length>0);if(n.length===0)return H7(e);const i=B7(Object.fromEntries(n));return Kd.test(e)?e.replace(Kd,i):`${e.replace(/\n+$/,"")}
|
|
74
74
|
${i}
|
|
75
|
-
`}function Y7(e,t){const n=new Set;for(const s of t)s.startsWith(`${as}:`)&&n.add(s.slice(as.length+1));const i={};for(const[s,r]of Object.entries(e))n.has(s)&&(i[s]=r);return i}const Mo={server:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><rect x="3" y="4" width="18" height="7" rx="1.5"/><rect x="3" y="13" width="18" height="7" rx="1.5"/><circle cx="7" cy="7.5" r="0.9" fill="currentColor"/><circle cx="7" cy="16.5" r="0.9" fill="currentColor"/></svg>',database:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><ellipse cx="12" cy="5.5" rx="8" ry="3"/><path d="M4 5.5v13c0 1.7 3.6 3 8 3s8-1.3 8-3v-13"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/></svg>',disk:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="2.6"/></svg>',cloud:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M7 18a4.5 4.5 0 1 1 .8-8.9A6 6 0 0 1 19.5 11 3.5 3.5 0 0 1 18.5 18Z"/></svg>',internet:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.5 2.4 4 5.6 4 9s-1.5 6.6-4 9c-2.5-2.4-4-5.6-4-9s1.5-6.6 4-9Z"/></svg>'},rh={azure:()=>ee(()=>import("./icons-azure.generated-FuO5QCg7.js"),[],import.meta.url).then(e=>e.default),logos:()=>ee(()=>import("./index-DV4lV1ms.js"),[],import.meta.url).then(e=>e.icons),devicon:()=>ee(()=>import("./index-C-tHkbn_.js"),[],import.meta.url).then(e=>e.icons),carbon:()=>ee(()=>import("./index-B0RN0zQN.js"),[],import.meta.url).then(e=>e.icons),tabler:()=>ee(()=>import("./index-B29u660W.js"),[],import.meta.url).then(e=>e.icons),"simple-icons":()=>ee(()=>import("./index-CjxRyQ-Z.js"),[],import.meta.url).then(e=>e.icons)},iy=new Map;function L7(e){const t=rh[e];return t?(iy.has(e)||iy.set(e,t()),iy.get(e)):null}let da={};function sy(e){da=e}let Xc=null;function P7(){if((Xc==null?void 0:Xc.from)===da)return Xc.pack;const e={};for(const[n,i]of Object.entries(da)){const s=A7(i);s&&(e[n]=s)}const t={prefix:as,icons:e};return Xc={from:da,pack:t},t}const G7=/\b([a-z][a-z0-9-]*):(\d{4,}-icon-(?:service-)?[a-z0-9-]+)/gi;function Q7(e){return e.replace(G7,(t,n,i)=>rh[n.toLowerCase()]?`${n}:${tl(i)}`:t)}async function q7(e){const t=e.indexOf(":");if(t<0)return Mo[e]??Mo.server;if(e.startsWith(`${as}:`))return da[e.slice(as.length+1)]??Mo.server;const n=L7(e.slice(0,t));if(!n)return Mo.server;try{const i=await n,s=e.slice(t+1),r=gS(i,s)??gS(i,tl(s));if(!r)return Mo.server;const l=C7(r,{height:"auto"});return T7(N7(l.body),l.attributes)}catch{return Mo.server}}const W7=new Set(["logos","devicon","carbon","tabler","simple-icons"]);function ry(e){const t=e.indexOf(":");if(t<0)return null;const n=e.slice(0,t),i=e.slice(t+1);return!W7.has(n)||!i?null:`https://api.iconify.design/${n}/${i}.svg`}let $S=null;function I7(){return $S??($S=ee(()=>import("./icon-names.generated-BV6c0TGn.js"),[],import.meta.url).then(e=>e.default)),$S}async function ME(e){return rh[e]?(await I7())[e]??[]:[]}const U7={vnet:["network","vpc","subnet"],"virtual-network":["network","vpc"],subnet:["subnet","network"],vpc:["vpc","network"],nsg:["firewall","security"],"resource-group":["group","folder"],"load-balancer":["load-balancer","balance"],appgateway:["gateway","load-balancer"],"app-service":["app","web"],aks:["kubernetes"],blob:["object-storage","storage"],"storage-account":["storage","object-storage"],cosmos:["database","document"],"key-vault":["vault","key","lock"],bastion:["terminal","ssh"],peering:["network","connect"]};function Z7(e){const t=e.replace(/[\s_]+/g,"-"),n=U7[t]??[];return[t,...n.filter(i=>i!==t)]}function dw(e,t){const n=t.split("-").filter(Boolean);return n.length>1?n.every(i=>dw(e,i)):t.length>3?e.includes(t):e===t||e.startsWith(`${t}-`)||e.includes(`-${t}`)}async function _E(e,t=60){const n=e.trim().toLowerCase();if(!n)return[];const i=Z7(n),s=Object.keys(da).filter(r=>i.some(l=>dw(r,l))).map(r=>`${as}:${r}`);for(const r of i){for(const l of Object.keys(rh)){const c=await ME(l),u=c.filter(d=>d.startsWith(r)),f=c.filter(d=>!d.startsWith(r)&&dw(d,r));for(const d of[...u,...f]){const m=`${l}:${d}`;s.includes(m)||s.push(m)}}if(s.length>=t)break}return s.slice(0,t)}async function F7(e,t,n=120){const i=await ME(e),s=i.filter(l=>t.some(c=>l.startsWith(c))),r=i.filter(l=>!t.some(c=>l.startsWith(c))&&t.some(c=>l.includes(c)));return[...s,...r].slice(0,n).map(l=>`${e}:${l}`)}const V7=Object.keys(rh),X7=Object.keys(Mo);let oy=null,bS=Promise.resolve();function AE(e,t){return zE(async n=>(n.registerIconPacks([{name:as,icons:P7()}]),n.render(e,Q7(t))))}function zE(e){const t=bS.then(async()=>e(await K7()));return bS=t.catch(()=>{}),t}function K7(){return oy||(oy=ee(()=>import("./mermaid.core-BJ8I5XuR.js").then(e=>e.bc),[],import.meta.url).then(e=>(e.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0}),e.default.registerIconPacks([{name:"azure",loader:()=>ee(()=>import("./icons-azure.generated-FuO5QCg7.js"),[],import.meta.url).then(t=>t.default)},{name:"logos",loader:()=>ee(()=>import("./index-DV4lV1ms.js"),[],import.meta.url).then(t=>t.icons)},{name:"simple-icons",loader:()=>ee(()=>import("./index-CjxRyQ-Z.js"),[],import.meta.url).then(t=>t.icons)},{name:"devicon",loader:()=>ee(()=>import("./index-C-tHkbn_.js"),[],import.meta.url).then(t=>t.icons)},{name:"carbon",loader:()=>ee(()=>import("./index-B0RN0zQN.js"),[],import.meta.url).then(t=>t.icons)},{name:"tabler",loader:()=>ee(()=>import("./index-B29u660W.js"),[],import.meta.url).then(t=>t.icons)}]),e.default))),oy}function pa(e){return`"${e.replace(/"/g,"#quot;")}"`}function HE(e){const t=typeof e=="string"?e.toUpperCase():"TB";return t==="TB"||t==="TD"||t==="LR"||t==="RL"||t==="BT"?t:"TB"}function Wr(e){return e instanceof Map?[...e.entries()]:e&&typeof e=="object"?Object.entries(e):[]}function K5(e){const t=e.styles??e.cssStyles,n=Array.isArray(t)?t.map(String).filter(Boolean):[];return n.length?{styles:n}:{}}function J5(e,t=" "){return e.filter(n=>{var i;return(((i=n.data.styles)==null?void 0:i.length)??0)>0}).map(n=>`${t}style ${n.id} ${n.data.styles.join(",")}`)}function J7(e){return typeof e=="string"&&X5.includes(e)?e:"square"}function t6(e){const t=typeof e.img=="string"&&e.img?e.img:void 0,n=typeof e.icon=="string"&&e.icon?e.icon:void 0;if(!t&&!n)return{};const i=Number(e.assetWidth),s=Number(e.assetHeight);return{...t?{img:t}:{},...n?{icon:n}:{},...e.pos==="t"||e.pos==="b"?{imgPos:e.pos}:{},...Number.isFinite(i)&&i>0?{imgWidth:i}:{},...Number.isFinite(s)&&s>0?{imgHeight:s}:{},...e.constraint==="on"?{imgConstrained:!0}:{}}}function e6(e){var m,g,y,$,v;const t=Wr((m=e.getVertices)==null?void 0:m.call(e)),n=((g=e.getEdges)==null?void 0:g.call(e))??[],i=((y=e.getSubGraphs)==null?void 0:y.call(e))??[],s=HE(($=e.getDirection)==null?void 0:$.call(e)),r=new Set(i.map(S=>String(S.id))),l=new Map;for(const S of i)for(const C of S.nodes??[])l.set(String(C),String(S.id));const c=[],u=S=>{if(c.some(E=>E.id===S))return;const C=i.find(E=>String(E.id)===S);if(!C)return;const k=l.get(S);k&&u(k);const O={id:S,type:"group",position:{x:0,y:0},data:{label:String(C.title??S),subgraphId:S},style:{width:320,height:220},...k?{parentId:k}:{}};c.push(O)};for(const S of i)u(String(S.id));const f={};for(const[S,C]of Wr((v=e.getClasses)==null?void 0:v.call(e)))S!=="default"&&(f[S]=(C.styles??[]).map(String));for(const[S,C]of t){if(r.has(S))continue;const k=l.get(S),O=(C.classes??[]).map(String).filter(j=>j!=="default"),E=(C.styles??[]).map(String),T={id:S,type:"shape",position:{x:0,y:0},data:{label:String(C.text??S),shape:J7(C.type),direction:s,...O.length?{classes:O}:{},...E.length?{styles:E}:{},...t6(C)},...k?{parentId:k}:{}};c.push(T)}const d=n.map((S,C)=>{const k=String(S.type??"arrow_point"),O=k.startsWith("double_"),E=k.replace(/^double_/,""),T=E==="arrow_open"||E==="arrow_circle"||E==="arrow_cross"?E:"arrow_point",j=String(S.stroke??"normal"),N=j==="dotted"||j==="thick"?j:"normal";return{id:`e${C}_${S.start}_${S.end}`,source:String(S.start),target:String(S.end),data:{label:String(S.text??""),stroke:N,arrow:T,...O?{both:!0}:{}}}});return{direction:s,nodes:c,edges:d,classDefs:f}}function n6(e){if(!e.img&&!e.icon)return null;const t=[e.img?`img: ${pa(e.img)}`:`icon: ${pa(e.icon??"")}`,`label: ${pa(e.label)}`];return e.imgPos&&t.push(`pos: "${e.imgPos}"`),e.img?t.push(`w: ${Math.round(e.imgWidth??Jo)}`,`h: ${Math.round(e.imgHeight??Jo)}`,'constraint: "on"'):(e.imgWidth&&t.push(`w: ${Math.round(e.imgWidth)}`),e.imgHeight&&t.push(`h: ${Math.round(e.imgHeight)}`),e.imgConstrained&&t.push('constraint: "on"')),`@{ ${t.join(", ")} }`}function i6(e,t){const n=pa(t);switch(e){case"square":return`[${n}]`;case"round":return`(${n})`;case"stadium":return`([${n}])`;case"subroutine":return`[[${n}]]`;case"cylinder":return`[(${n})]`;case"circle":return`((${n}))`;case"doublecircle":return`(((${n})))`;case"diamond":return`{${n}}`;case"hexagon":return`{{${n}}}`;case"odd":return`>${n}]`;case"trapezoid":return`[/${n}\\]`;case"inv_trapezoid":return`[\\${n}/]`;case"lean_right":return`[/${n}/]`;case"lean_left":return`[\\${n}\\]`}}function s6(e,t,n){const i=t==="arrow_point"?">":t==="arrow_circle"?"o":t==="arrow_cross"?"x":"",s=!n||!i?"":t==="arrow_point"?"<":i;switch(e){case"dotted":return i?`${s}-.-${i}`:"-.-";case"thick":return i?`${s}==${i}`:"===";default:return i?`${s}--${i}`:"---"}}function r6(e,t,n,i={}){var m;const s=[`flowchart ${e}`],r=t.filter(xe),l=new Map;for(const g of t){if(xe(g))continue;const y=l.get(g.parentId)??[];y.push(g),l.set(g.parentId,y)}const c=(g,y)=>{if(g.type!=="shape")return;const $=n6(g.data);s.push(`${y}${g.id}${$??i6(g.data.shape,g.data.label)}`)};for(const g of l.get(void 0)??[])c(g," ");const u=(g,y)=>{s.push(`${y}subgraph ${g.id} [${pa(g.data.label)}]`);for(const $ of l.get(g.id)??[])c($,y+" ");for(const $ of r.filter(v=>v.parentId===g.id))u($,y+" ");s.push(`${y}end`)};for(const g of r.filter(y=>!y.parentId))u(g," ");n.length>0&&s.push("");for(const g of n){const y=g.data,$=s6((y==null?void 0:y.stroke)??"normal",(y==null?void 0:y.arrow)??"arrow_point",y==null?void 0:y.both),v=y!=null&&y.label?`|${pa(y.label)}|`:"";s.push(` ${g.source} ${$}${v} ${g.target}`)}const f=[];for(const[g,y]of Object.entries(i))y.length&&f.push(` classDef ${g} ${y.join(",")}`);const d=new Map;for(const g of t)if(g.type==="shape"){for(const y of g.data.classes??[])d.set(y,[...d.get(y)??[],g.id]);(m=g.data.styles)!=null&&m.length&&f.push(` style ${g.id} ${g.data.styles.join(",")}`)}for(const[g,y]of d)f.push(` class ${y.join(",")} ${g}`);return f.length&&s.push("",...f),s.join(`
|
|
75
|
+
`}function Y7(e,t){const n=new Set;for(const s of t)s.startsWith(`${as}:`)&&n.add(s.slice(as.length+1));const i={};for(const[s,r]of Object.entries(e))n.has(s)&&(i[s]=r);return i}const Mo={server:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><rect x="3" y="4" width="18" height="7" rx="1.5"/><rect x="3" y="13" width="18" height="7" rx="1.5"/><circle cx="7" cy="7.5" r="0.9" fill="currentColor"/><circle cx="7" cy="16.5" r="0.9" fill="currentColor"/></svg>',database:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><ellipse cx="12" cy="5.5" rx="8" ry="3"/><path d="M4 5.5v13c0 1.7 3.6 3 8 3s8-1.3 8-3v-13"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/></svg>',disk:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="2.6"/></svg>',cloud:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M7 18a4.5 4.5 0 1 1 .8-8.9A6 6 0 0 1 19.5 11 3.5 3.5 0 0 1 18.5 18Z"/></svg>',internet:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.5 2.4 4 5.6 4 9s-1.5 6.6-4 9c-2.5-2.4-4-5.6-4-9s1.5-6.6 4-9Z"/></svg>'},rh={azure:()=>ee(()=>import("./icons-azure.generated-FuO5QCg7.js"),[],import.meta.url).then(e=>e.default),logos:()=>ee(()=>import("./index-DV4lV1ms.js"),[],import.meta.url).then(e=>e.icons),devicon:()=>ee(()=>import("./index-C-tHkbn_.js"),[],import.meta.url).then(e=>e.icons),carbon:()=>ee(()=>import("./index-B0RN0zQN.js"),[],import.meta.url).then(e=>e.icons),tabler:()=>ee(()=>import("./index-B29u660W.js"),[],import.meta.url).then(e=>e.icons),"simple-icons":()=>ee(()=>import("./index-CjxRyQ-Z.js"),[],import.meta.url).then(e=>e.icons)},iy=new Map;function L7(e){const t=rh[e];return t?(iy.has(e)||iy.set(e,t()),iy.get(e)):null}let da={};function sy(e){da=e}let Xc=null;function P7(){if((Xc==null?void 0:Xc.from)===da)return Xc.pack;const e={};for(const[n,i]of Object.entries(da)){const s=A7(i);s&&(e[n]=s)}const t={prefix:as,icons:e};return Xc={from:da,pack:t},t}const G7=/\b([a-z][a-z0-9-]*):(\d{4,}-icon-(?:service-)?[a-z0-9-]+)/gi;function Q7(e){return e.replace(G7,(t,n,i)=>rh[n.toLowerCase()]?`${n}:${tl(i)}`:t)}async function q7(e){const t=e.indexOf(":");if(t<0)return Mo[e]??Mo.server;if(e.startsWith(`${as}:`))return da[e.slice(as.length+1)]??Mo.server;const n=L7(e.slice(0,t));if(!n)return Mo.server;try{const i=await n,s=e.slice(t+1),r=gS(i,s)??gS(i,tl(s));if(!r)return Mo.server;const l=C7(r,{height:"auto"});return T7(N7(l.body),l.attributes)}catch{return Mo.server}}const W7=new Set(["logos","devicon","carbon","tabler","simple-icons"]);function ry(e){const t=e.indexOf(":");if(t<0)return null;const n=e.slice(0,t),i=e.slice(t+1);return!W7.has(n)||!i?null:`https://api.iconify.design/${n}/${i}.svg`}let $S=null;function I7(){return $S??($S=ee(()=>import("./icon-names.generated-BV6c0TGn.js"),[],import.meta.url).then(e=>e.default)),$S}async function ME(e){return rh[e]?(await I7())[e]??[]:[]}const U7={vnet:["network","vpc","subnet"],"virtual-network":["network","vpc"],subnet:["subnet","network"],vpc:["vpc","network"],nsg:["firewall","security"],"resource-group":["group","folder"],"load-balancer":["load-balancer","balance"],appgateway:["gateway","load-balancer"],"app-service":["app","web"],aks:["kubernetes"],blob:["object-storage","storage"],"storage-account":["storage","object-storage"],cosmos:["database","document"],"key-vault":["vault","key","lock"],bastion:["terminal","ssh"],peering:["network","connect"]};function Z7(e){const t=e.replace(/[\s_]+/g,"-"),n=U7[t]??[];return[t,...n.filter(i=>i!==t)]}function dw(e,t){const n=t.split("-").filter(Boolean);return n.length>1?n.every(i=>dw(e,i)):t.length>3?e.includes(t):e===t||e.startsWith(`${t}-`)||e.includes(`-${t}`)}async function _E(e,t=60){const n=e.trim().toLowerCase();if(!n)return[];const i=Z7(n),s=Object.keys(da).filter(r=>i.some(l=>dw(r,l))).map(r=>`${as}:${r}`);for(const r of i){for(const l of Object.keys(rh)){const c=await ME(l),u=c.filter(d=>d.startsWith(r)),f=c.filter(d=>!d.startsWith(r)&&dw(d,r));for(const d of[...u,...f]){const m=`${l}:${d}`;s.includes(m)||s.push(m)}}if(s.length>=t)break}return s.slice(0,t)}async function F7(e,t,n=120){const i=await ME(e),s=i.filter(l=>t.some(c=>l.startsWith(c))),r=i.filter(l=>!t.some(c=>l.startsWith(c))&&t.some(c=>l.includes(c)));return[...s,...r].slice(0,n).map(l=>`${e}:${l}`)}const V7=Object.keys(rh),X7=Object.keys(Mo);let oy=null,bS=Promise.resolve();function AE(e,t){return zE(async n=>(n.registerIconPacks([{name:as,icons:P7()}]),n.render(e,Q7(t))))}function zE(e){const t=bS.then(async()=>e(await K7()));return bS=t.catch(()=>{}),t}function K7(){return oy||(oy=ee(()=>import("./mermaid.core-d3X_EolB.js").then(e=>e.bc),[],import.meta.url).then(e=>(e.default.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0}),e.default.registerIconPacks([{name:"azure",loader:()=>ee(()=>import("./icons-azure.generated-FuO5QCg7.js"),[],import.meta.url).then(t=>t.default)},{name:"logos",loader:()=>ee(()=>import("./index-DV4lV1ms.js"),[],import.meta.url).then(t=>t.icons)},{name:"simple-icons",loader:()=>ee(()=>import("./index-CjxRyQ-Z.js"),[],import.meta.url).then(t=>t.icons)},{name:"devicon",loader:()=>ee(()=>import("./index-C-tHkbn_.js"),[],import.meta.url).then(t=>t.icons)},{name:"carbon",loader:()=>ee(()=>import("./index-B0RN0zQN.js"),[],import.meta.url).then(t=>t.icons)},{name:"tabler",loader:()=>ee(()=>import("./index-B29u660W.js"),[],import.meta.url).then(t=>t.icons)}]),e.default))),oy}function pa(e){return`"${e.replace(/"/g,"#quot;")}"`}function HE(e){const t=typeof e=="string"?e.toUpperCase():"TB";return t==="TB"||t==="TD"||t==="LR"||t==="RL"||t==="BT"?t:"TB"}function Wr(e){return e instanceof Map?[...e.entries()]:e&&typeof e=="object"?Object.entries(e):[]}function K5(e){const t=e.styles??e.cssStyles,n=Array.isArray(t)?t.map(String).filter(Boolean):[];return n.length?{styles:n}:{}}function J5(e,t=" "){return e.filter(n=>{var i;return(((i=n.data.styles)==null?void 0:i.length)??0)>0}).map(n=>`${t}style ${n.id} ${n.data.styles.join(",")}`)}function J7(e){return typeof e=="string"&&X5.includes(e)?e:"square"}function t6(e){const t=typeof e.img=="string"&&e.img?e.img:void 0,n=typeof e.icon=="string"&&e.icon?e.icon:void 0;if(!t&&!n)return{};const i=Number(e.assetWidth),s=Number(e.assetHeight);return{...t?{img:t}:{},...n?{icon:n}:{},...e.pos==="t"||e.pos==="b"?{imgPos:e.pos}:{},...Number.isFinite(i)&&i>0?{imgWidth:i}:{},...Number.isFinite(s)&&s>0?{imgHeight:s}:{},...e.constraint==="on"?{imgConstrained:!0}:{}}}function e6(e){var m,g,y,$,v;const t=Wr((m=e.getVertices)==null?void 0:m.call(e)),n=((g=e.getEdges)==null?void 0:g.call(e))??[],i=((y=e.getSubGraphs)==null?void 0:y.call(e))??[],s=HE(($=e.getDirection)==null?void 0:$.call(e)),r=new Set(i.map(S=>String(S.id))),l=new Map;for(const S of i)for(const C of S.nodes??[])l.set(String(C),String(S.id));const c=[],u=S=>{if(c.some(E=>E.id===S))return;const C=i.find(E=>String(E.id)===S);if(!C)return;const k=l.get(S);k&&u(k);const O={id:S,type:"group",position:{x:0,y:0},data:{label:String(C.title??S),subgraphId:S},style:{width:320,height:220},...k?{parentId:k}:{}};c.push(O)};for(const S of i)u(String(S.id));const f={};for(const[S,C]of Wr((v=e.getClasses)==null?void 0:v.call(e)))S!=="default"&&(f[S]=(C.styles??[]).map(String));for(const[S,C]of t){if(r.has(S))continue;const k=l.get(S),O=(C.classes??[]).map(String).filter(j=>j!=="default"),E=(C.styles??[]).map(String),T={id:S,type:"shape",position:{x:0,y:0},data:{label:String(C.text??S),shape:J7(C.type),direction:s,...O.length?{classes:O}:{},...E.length?{styles:E}:{},...t6(C)},...k?{parentId:k}:{}};c.push(T)}const d=n.map((S,C)=>{const k=String(S.type??"arrow_point"),O=k.startsWith("double_"),E=k.replace(/^double_/,""),T=E==="arrow_open"||E==="arrow_circle"||E==="arrow_cross"?E:"arrow_point",j=String(S.stroke??"normal"),N=j==="dotted"||j==="thick"?j:"normal";return{id:`e${C}_${S.start}_${S.end}`,source:String(S.start),target:String(S.end),data:{label:String(S.text??""),stroke:N,arrow:T,...O?{both:!0}:{}}}});return{direction:s,nodes:c,edges:d,classDefs:f}}function n6(e){if(!e.img&&!e.icon)return null;const t=[e.img?`img: ${pa(e.img)}`:`icon: ${pa(e.icon??"")}`,`label: ${pa(e.label)}`];return e.imgPos&&t.push(`pos: "${e.imgPos}"`),e.img?t.push(`w: ${Math.round(e.imgWidth??Jo)}`,`h: ${Math.round(e.imgHeight??Jo)}`,'constraint: "on"'):(e.imgWidth&&t.push(`w: ${Math.round(e.imgWidth)}`),e.imgHeight&&t.push(`h: ${Math.round(e.imgHeight)}`),e.imgConstrained&&t.push('constraint: "on"')),`@{ ${t.join(", ")} }`}function i6(e,t){const n=pa(t);switch(e){case"square":return`[${n}]`;case"round":return`(${n})`;case"stadium":return`([${n}])`;case"subroutine":return`[[${n}]]`;case"cylinder":return`[(${n})]`;case"circle":return`((${n}))`;case"doublecircle":return`(((${n})))`;case"diamond":return`{${n}}`;case"hexagon":return`{{${n}}}`;case"odd":return`>${n}]`;case"trapezoid":return`[/${n}\\]`;case"inv_trapezoid":return`[\\${n}/]`;case"lean_right":return`[/${n}/]`;case"lean_left":return`[\\${n}\\]`}}function s6(e,t,n){const i=t==="arrow_point"?">":t==="arrow_circle"?"o":t==="arrow_cross"?"x":"",s=!n||!i?"":t==="arrow_point"?"<":i;switch(e){case"dotted":return i?`${s}-.-${i}`:"-.-";case"thick":return i?`${s}==${i}`:"===";default:return i?`${s}--${i}`:"---"}}function r6(e,t,n,i={}){var m;const s=[`flowchart ${e}`],r=t.filter(xe),l=new Map;for(const g of t){if(xe(g))continue;const y=l.get(g.parentId)??[];y.push(g),l.set(g.parentId,y)}const c=(g,y)=>{if(g.type!=="shape")return;const $=n6(g.data);s.push(`${y}${g.id}${$??i6(g.data.shape,g.data.label)}`)};for(const g of l.get(void 0)??[])c(g," ");const u=(g,y)=>{s.push(`${y}subgraph ${g.id} [${pa(g.data.label)}]`);for(const $ of l.get(g.id)??[])c($,y+" ");for(const $ of r.filter(v=>v.parentId===g.id))u($,y+" ");s.push(`${y}end`)};for(const g of r.filter(y=>!y.parentId))u(g," ");n.length>0&&s.push("");for(const g of n){const y=g.data,$=s6((y==null?void 0:y.stroke)??"normal",(y==null?void 0:y.arrow)??"arrow_point",y==null?void 0:y.both),v=y!=null&&y.label?`|${pa(y.label)}|`:"";s.push(` ${g.source} ${$}${v} ${g.target}`)}const f=[];for(const[g,y]of Object.entries(i))y.length&&f.push(` classDef ${g} ${y.join(",")}`);const d=new Map;for(const g of t)if(g.type==="shape"){for(const y of g.data.classes??[])d.set(y,[...d.get(y)??[],g.id]);(m=g.data.styles)!=null&&m.length&&f.push(` style ${g.id} ${g.data.styles.join(",")}`)}for(const[g,y]of d)f.push(` class ${y.join(",")} ${g}`);return f.length&&s.push("",...f),s.join(`
|
|
76
76
|
`)+`
|
|
77
77
|
`}function o6(e){var f,d;const t=(f=e.getRootDocV2)==null?void 0:f.call(e),n=new Map;for(const[m,g]of Wr((d=e.getStates)==null?void 0:d.call(e))){const y=K5(g).styles;y&&n.set(m,y)}const i=[],s=[],r=new Map,l=m=>m.start===!0?"start":m.start===!1?"end":m.type==="choice"||m.type==="fork"||m.type==="join"?m.type:"normal",c=(m,g,y)=>{const $=r.get(m.id);if($){if(y&&$.type==="state"){const S={id:m.id,type:"group",position:{x:0,y:0},data:{label:$.data.label!==m.id?$.data.label:m.description||m.id,subgraphId:m.id},style:{width:320,height:220},...$.parentId?{parentId:$.parentId}:{}};r.set(m.id,S),i[i.indexOf($)]=S;return}g&&!$.parentId&&($.parentId=g),m.description&&!xe($)&&$.data.label===m.id&&($.data.label=m.description);return}const v=y?{id:m.id,type:"group",position:{x:0,y:0},data:{label:m.description||m.id,subgraphId:m.id},style:{width:320,height:220},...g?{parentId:g}:{}}:{id:m.id,type:"state",position:{x:0,y:0},data:{label:m.description||m.id,stateType:l(m),direction:"TB",...n.has(m.id)?{styles:n.get(m.id)}:{}},...g?{parentId:g}:{}};r.set(m.id,v),i.push(v)},u=(m,g)=>{var y,$;for(const v of m)if(v.stmt==="state"){const S=v;c(S,g,!!((y=S.doc)!=null&&y.length)),($=S.doc)!=null&&$.length&&u(S.doc,S.id)}else if(v.stmt==="relation"){const S=v;c(S.state1,g,!1),c(S.state2,g,!1),s.push({id:`e${s.length}_${S.state1.id}_${S.state2.id}`,source:S.state1.id,target:S.state2.id,data:{label:S.description??""}})}};return u((t==null?void 0:t.doc)??[],void 0),i.sort((m,g)=>Number(xe(g))-Number(xe(m))),{nodes:i,edges:s}}function l6(e,t,n){const i=["stateDiagram-v2"];e!=="TB"&&e!=="TD"&&i.push(` direction ${e}`);const s=new Map(t.map(d=>[d.id,d])),r=d=>{const m=s.get(d);return m&&m.type==="state"?m.data.stateType:"normal"},l=d=>{const m=r(d);return m==="start"||m==="end"?"[*]":d},c=(d,m)=>{if(d.type!=="state")return;const g=d.data.stateType;if(!(g==="start"||g==="end")){if(g==="choice"||g==="fork"||g==="join"){i.push(`${m}state ${d.id} <<${g}>>`);return}i.push(d.data.label!==d.id?`${m}${d.id} : ${d.data.label}`:`${m}${d.id}`)}},u=d=>{const m=s.get(d.source),g=s.get(d.target);return m!=null&&m.parentId&&m.parentId===(g==null?void 0:g.parentId)?m.parentId:void 0},f=(d,m)=>{var g;for(const y of t)y.parentId===d&&(xe(y)?(i.push(`${m}state ${y.id} {`),f(y.id,m+" "),i.push(`${m}}`)):c(y,m));for(const y of n){if(u(y)!==d)continue;const $=(g=y.data)!=null&&g.label?` : ${y.data.label}`:"";i.push(`${m}${l(y.source)} --> ${l(y.target)}${$}`)}};return f(void 0," "),i.push(...J5(t.filter(d=>d.type==="state"))),i.join(`
|
|
78
78
|
`)+`
|
|
@@ -103,7 +103,7 @@ ${i}
|
|
|
103
103
|
`}const Z6=["boxed","icon","solid","plain"],np=/^\s*%%\s*graph:nodes\s+(\{.*\})\s*$/m,F6=e=>typeof e=="string"&&Z6.includes(e);function tx(e){return!(e!=null&&e.look)||e.look==="boxed"}function V6(e){const t=e.match(np);if(!t)return null;try{const n=JSON.parse(t[1]),i={};for(const[s,r]of Object.entries(n)){if(typeof r!="object"||r===null)continue;const l=r.look;F6(l)&&l!=="boxed"&&(i[s]={look:l})}return i}catch{return null}}function X6(e){return e.replace(np,"").replace(/\n+$/,`
|
|
104
104
|
`)}function K6(e){const t={};for(const[n,i]of Object.entries(e))tx(i)||(t[n]={look:i.look});return`%% graph:nodes ${JSON.stringify(t)}`}function RS(e,t){const n=Object.entries(t).filter(([,s])=>!tx(s));if(n.length===0)return X6(e);const i=K6(Object.fromEntries(n));return np.test(e)?e.replace(np,i):`${e.replace(/\n+$/,"")}
|
|
105
105
|
${i}
|
|
106
|
-
`}const J6={fill:"fill",stroke:"stroke",color:"color","stroke-width":"strokeWidth","stroke-dasharray":"strokeDasharray","font-size":"fontSize","font-weight":"fontWeight","font-style":"fontStyle"};function ex(e){const t={};for(const n of e){const i=n.indexOf(":");if(i<0)continue;const s=J6[n.slice(0,i).trim()];s&&(t[s]=n.slice(i+1).trim())}return t}function nx(e){return{...e.color?{color:e.color}:{},...e.fontSize?{fontSize:e.fontSize}:{},...e.fontWeight?{fontWeight:e.fontWeight}:{},...e.fontStyle?{fontStyle:e.fontStyle}:{}}}function tY(e){return{...e.fill?{background:e.fill}:{},...e.stroke?{borderColor:e.stroke}:{},...nx(e)}}const ix=["azure","aws","gcp","kubernetes","other"],qE={azure:"Azure",aws:"AWS",gcp:"Google Cloud",kubernetes:"Kubernetes",other:""},eY=[/(^|-)vnets?($|-)/,/(^|-)virtual-networks?($|-)/,/(^|-)subnets?($|-)/,/(^|-)vpcs?($|-)/,/(^|-)resource-groups?($|-)/,/(^|-)subscriptions?($|-)/,/(^|-)management-groups?($|-)/,/(^|-)availability-zones?($|-)/,/(^|-)landing-zones?($|-)/,/(^|-)namespaces?($|-)/,/(^|-)clusters?($|-)/,/(^|-)regions?($|-)/,/(^|-)boundar(y|ies)($|-)/];function sx(e){return e.slice(e.indexOf(":")+1)}function nY(e){return eY.some(t=>t.test(e))?"group":"service"}function iY(e){const n=e.toLowerCase().split(/[/\\]/),i=n.pop()??"",s=r=>n.some(l=>r.test(l));return s(/(^|[-_])azure/)||s(/^microsoft/)?"azure":s(/(^|[-_])(aws\d*|amazon)/)?"aws":s(/(^|[-_])(gcp|google[-_]?cloud)/)?"gcp":s(/(^|[-_])(kubernetes|k8s)/)?"kubernetes":/^\d{4,}-icon-(service|)/.test(i)?"azure":"other"}const WE="graph:icon-pack",IE="graph:icon-pack-vendors",sY=3e6;function rY(){try{const e=JSON.parse(localStorage.getItem(WE)??"{}"),t={};for(const[n,i]of Object.entries(e)){if(typeof i!="string")continue;const s=sm(i);s&&(t[tl(n)]=s)}return t}catch{return{}}}function oY(){try{const e=JSON.parse(localStorage.getItem(IE)??"{}"),t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&ix.includes(i)&&(t[n]=i);return t}catch{return{}}}function MS(e,t){try{localStorage.setItem(WE,JSON.stringify(e)),t&&localStorage.setItem(IE,JSON.stringify(t))}catch{}}const mu=Ln((e,t)=>({icons:rY(),vendors:oY(),add:n=>{const i={...t().icons},s={...t().vendors},r=[];let l=JSON.stringify(i).length;for(const c of n){const u=sm(c.svg);if(!u)continue;const f=tl(c.name);if(i[f]||(l+=u.length+f.length+6),l>sY)break;i[f]=u;const d=iY(c.name);(d!=="other"||!s[f])&&(s[f]=d),r.push(`custom:${f}`)}return e({icons:i,vendors:s}),MS(i,s),r},remove:n=>{const i={...t().icons},s={...t().vendors},r=tl(n);delete i[r],delete s[r],e({icons:i,vendors:s}),MS(i,s)}})),lY=48,Ta=100,qo=44,pi=Ln(e=>({edgeId:null,from:-1,to:-1,begin:(t,n)=>e({edgeId:t,from:n,to:n}),moveTo:t=>e(n=>n.to===t?n:{...n,to:t}),end:()=>e({edgeId:null,from:-1,to:-1})}));function UE(e,t,n){return t<0||t===n?e:e===t?n:t<n?e>t&&e<=n?e-1:e:e>=n&&e<t?e+1:e}function aY(e,t,n){const i=[];for(let s=0;s<n;s++){const r=s<t?s:s+1,l=e[r];if(!l)break;l.kind==="block"?i.push(r):l.kind==="end"&&i.pop()}return i.length?i[i.length-1]:-1}let cy=null;const cY=5e3;async function uY(){if(typeof Worker<"u"){let t;try{const[{default:n},{default:i}]=await Promise.all([ee(()=>import("./elk-api-C7W47lSN.js").then(s=>s.e),__vite__mapDeps([0,1]),import.meta.url),ee(()=>import("./elk-worker.min-D32ngsh5.js"),[],import.meta.url)]);return t=new n({workerFactory:()=>new i}),await Promise.race([t.layout({id:"probe",children:[{id:"n",width:1,height:1}]}),new Promise((s,r)=>setTimeout(()=>r(new Error("ELK worker did not respond")),cY))]),t}catch(n){t==null||t.terminateWorker(),console.warn("ELK worker unavailable; laying out on the main thread instead.",n)}}const{default:e}=await ee(async()=>{const{default:t}=await import("./elk.bundled-B1dwyv4e.js").then(n=>n.e);return{default:t}},__vite__mapDeps([2,1]),import.meta.url);return new e}function hY(){return cy||(cy=uY()),cy}const fY={TD:"DOWN",TB:"DOWN",BT:"UP",LR:"RIGHT",RL:"LEFT"};function dY(e){var i,s,r,l;let t=0,n=0;for(const c of e)for(const u of[(s=(i=c.data)==null?void 0:i.arch)==null?void 0:s.lhsDir,(l=(r=c.data)==null?void 0:r.arch)==null?void 0:l.rhsDir])u==="L"||u==="R"?t++:(u==="T"||u==="B")&&n++;return t===0&&n===0?null:t>=n?"LR":"TB"}async function pw(e,t,n){const i=new Map;for(const d of e){const m=i.get(d.parentId)??[];m.push(d),i.set(d.parentId,m)}const s=d=>{var g,y;if(xe(d))return{id:d.id,children:(i.get(d.id)??[]).map(s),layoutOptions:{"elk.padding":"[top=40,left=16,bottom=16,right=16]"}};const m=Qo(d);return{id:d.id,width:((g=d.measured)==null?void 0:g.width)??d.width??m.width,height:((y=d.measured)==null?void 0:y.height)??d.height??m.height}},r={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":fY[dY(t)??n],"elk.layered.spacing.nodeNodeBetweenLayers":"70","elk.spacing.nodeNode":"40","elk.hierarchyHandling":"INCLUDE_CHILDREN"},children:(i.get(void 0)??[]).map(s),edges:t.map((d,m)=>({id:d.id||`e${m}`,sources:[d.source],targets:[d.target]}))},c=await(await hY()).layout(r),u={},f=(d,m)=>{var g;m||(u[d.id]={x:d.x??0,y:d.y??0,...(g=d.children)!=null&&g.length?{w:d.width??0,h:d.height??0}:{}});for(const y of d.children??[])f(y,!1)};return f(c,!0),u}const _S="graph:recent-icons",AS="graph:fav-icons";function zS(e){try{const t=JSON.parse(localStorage.getItem(e)??"[]");return Array.isArray(t)?t.map(String):[]}catch{return[]}}function HS(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const Mi=Ln((e,t)=>({recents:zS(_S),favorites:zS(AS),recordRecent:n=>{if(!n.includes(":"))return;const i=[n,...t().recents.filter(s=>s!==n)].slice(0,12);e({recents:i}),HS(_S,i)},toggleFavorite:n=>{const s=t().favorites.includes(n)?t().favorites.filter(r=>r!==n):[n,...t().favorites].slice(0,24);e({favorites:s}),HS(AS,s)}}));function rx(){return typeof window.acquireVsCodeApi=="function"}function ZE(){if(rx())return!0;try{return new URLSearchParams(location.search).has("embed")}catch{return!1}}function lu(){return rx()}const FE="graph:workspace",ox="graph:doc:",BS="graph:code",VE=1,oh=ZE();function pY(){return`d${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`}function La(e){try{return localStorage.getItem(ox+e)}catch{return null}}function Pa(e,t){if(!oh)try{localStorage.setItem(ox+e,t)}catch{}}function XE(e){try{localStorage.removeItem(ox+e)}catch{}}function Ga(e){if(oh)return;const t={v:VE,activeId:e.activeId,docs:e.docs.map(({handle:n,...i})=>i)};try{localStorage.setItem(FE,JSON.stringify(t))}catch{}}function ip(e){return{id:pY(),name:e,updatedAt:Date.now(),path:null,handle:null,savedCode:null}}function mY(e){var l;if(oh){const c=ip("Untitled");return{state:{docs:[c],activeId:c.id},code:e}}let t=null;try{const c=localStorage.getItem(FE);c&&(t=JSON.parse(c))}catch{}if((l=t==null?void 0:t.docs)!=null&&l.length&&t.v===VE){const c=t.docs.map(f=>({...f,handle:null})),u=c.some(f=>f.id===t.activeId)?t.activeId:c[0].id;return{state:{docs:c,activeId:u},code:La(u)??e}}let n=null;try{n=localStorage.getItem(BS)}catch{}const i=ip("Untitled"),s=n??e,r={docs:[i],activeId:i.id};if(Pa(i.id,s),Ga(r),n!==null)try{localStorage.removeItem(BS)}catch{}return{state:r,code:s}}const Ut=Ln(()=>({docs:[],activeId:""}));function gY(){const{docs:e,activeId:t}=Ut.getState();return e.find(n=>n.id===t)}function Qa(e,t){const n=Ut.getState().docs.map(i=>i.id===e?{...i,...t}:i);Ut.setState({docs:n}),Ga(Ut.getState())}function yY(){const{activeId:e}=Ut.getState();e&&Qa(e,{updatedAt:Date.now()})}const uy=e=>e==="x"?"y":"x";function Vl(e){return e==="left"||e==="right"?"x":"y"}const mw=e=>({x:e.x+e.w/2,y:e.y+e.h/2});function YS(e,t,n){const[i,s]=n==="x"?[e.x,e.x+e.w]:[e.y,e.y+e.h],[r,l]=n==="x"?[t.x,t.x+t.w]:[t.y,t.y+t.h];return i<l&&r<s}function wY(e,t){const n=mw(e),i=mw(t),s=i.x-n.x,r=i.y-n.y;return(Math.abs(s)>=Math.abs(r)?!YS(e,t,"x"):YS(e,t,"y"))?s>=0?{from:"right",to:"left"}:{from:"left",to:"right"}:r>=0?{from:"bottom",to:"top"}:{from:"top",to:"bottom"}}function Ff(e,t){const n=mw(e);switch(t){case"left":return{x:e.x,y:n.y};case"right":return{x:e.x+e.w,y:n.y};case"top":return{x:n.x,y:e.y};case"bottom":return{x:n.x,y:e.y+e.h}}}function Tu(e){switch(e){case"left":return{x:-1,y:0};case"right":return{x:1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const KE=20;function LS(e,t,n){const i=Tu(t);return(i.x!==0?i.x>0?n.x+n.w-(e.x+e.w):e.x-n.x:i.y>0?n.y+n.h-(e.y+e.h):e.y-n.y)<0}const PS=(e,t,n)=>(t.x-e.x)*n.x+(t.y-e.y)*n.y;function xY(e,t,n,i=KE){if(e.length<2)return e;const s=[...e],r=Tu(t);PS(s[0],s[1],r)<i&&s.splice(1,0,{x:s[0].x+r.x*i,y:s[0].y+r.y*i});const l=Tu(n),c=s.length-1;return PS(s[c],s[c-1],l)<i&&s.splice(c,0,{x:s[c].x+l.x*i,y:s[c].y+l.y*i}),s}function JE(e,t){return Math.abs(e.x-t.x)<.5&&Math.abs(e.y-t.y)<.5}function GS(e,t,n){return e>=Math.min(t,n)-.5&&e<=Math.max(t,n)+.5}function $Y(e,t,n){const i=Math.abs(e.y-t.y)<.5&&Math.abs(t.y-n.y)<.5&&GS(t.x,e.x,n.x),s=Math.abs(e.x-t.x)<.5&&Math.abs(t.x-n.x)<.5&&GS(t.y,e.y,n.y);return i||s}function ts(e){const t=[];for(const n of e)t.length&&JE(t[t.length-1],n)||t.push({...n});for(let n=1;n<t.length-1;)$Y(t[n-1],t[n],t[n+1])?t.splice(n,1):n++;return t}function bY(e,t,n){return Math.abs(e.x-t.x)<.5||Math.abs(e.y-t.y)<.5?null:n==="x"?{x:t.x,y:e.y}:{x:e.x,y:t.y}}function lx(e,t,n){if(e.length<2)return ts(e);if(e.length===2&&t===n){const[r,l]=e,c=Math.abs(r.x-l.x)>.5&&Math.abs(r.y-l.y)>.5;if(c&&t==="x"){const u=(r.x+l.x)/2;return ts([r,{x:u,y:r.y},{x:u,y:l.y},l])}if(c&&t==="y"){const u=(r.y+l.y)/2;return ts([r,{x:r.x,y:u},{x:l.x,y:u},l])}}const i=[{...e[0]}];let s=t;for(let r=0;r<e.length-1;r++){const l=e[r],c=e[r+1],u=r===e.length-2,f=r===0?t:uy(u?n:s),d=bY(l,c,f);d?(i.push(d),s=uy(f)):s=Math.abs(l.x-c.x)<.5?"y":"x",i.push({...c})}return ts(i)}function vY(e,t,n){const s=ju(e)[t];if(!s)return e;const r=s.axis==="x"?"y":"x",l=f=>r==="x"?{x:n,y:f.y}:{x:f.x,y:n},c=e.length-1,u=[];for(let f=0;f<=c;f++){const d=e[f];f===t&&f===0?u.push({...d},l(d)):f===t+1&&f===c?u.push(l(d),{...d}):f===t||f===t+1?u.push(l(d)):u.push({...d})}return ts(u)}function SY(e,t,n,i){const r=ju(t)[n];if(!r)return e;const l=r.axis==="x"?"y":"x",c=r.axis,u=l==="x"?r.from.x:r.from.y,f=Math.min(r.from[c],r.to[c]),d=Math.max(r.from[c],r.to[c]),m=v=>Math.abs(v[l]-u)<.5&&v[c]>=f-.5&&v[c]<=d+.5,g=e.map(v=>m(v)?l==="x"?{x:i,y:v.y}:{x:v.x,y:i}:{...v});if(e.some(m))return g;const y=t.slice(0,n+1).filter(v=>e.some(S=>Math.abs(S.x-v.x)<.5&&Math.abs(S.y-v.y)<.5)).length,$=v=>l==="x"?{x:i,y:v.y}:{x:v.x,y:i};return ts([...g.slice(0,y),$(r.from),$(r.to),...g.slice(y)])}function OY(e,t,n){return e.length===0||Math.abs(t.x)<.01&&Math.abs(t.y)<.01&&Math.abs(n.x)<.01&&Math.abs(n.y)<.01?e:e.map((s,r)=>{const l=(r+1)/(e.length+1),c=1-l;return{x:s.x+t.x*c+n.x*l,y:s.y+t.y*c+n.y*l}})}function kY(e,t){return e.length===t.length&&e.every((n,i)=>JE(n,t[i]))}function CY(e,t,n,i,s){const r=u=>lx([t,...u,n],i,s),l=r(e);let c=e;for(let u=c.length-1;u>=0;u--){const f=[...c.slice(0,u),...c.slice(u+1)];kY(r(f),l)&&(c=f)}return c}function ju(e){const t=[];for(let n=0;n<e.length-1;n++){const i=e[n],s=e[n+1];t.push({from:i,to:s,axis:Math.abs(i.y-s.y)<.5?"x":"y",index:n,mid:{x:(i.x+s.x)/2,y:(i.y+s.y)/2}})}return t}const gw={width:140,height:100},Td={width:48,height:28};function t3(e){return xe(e)?gw:Td}function e3(e){var t;return!xe(e)&&((t=e.style)==null?void 0:t.width)!==void 0}function yw(e){var n,i,s,r;const t=Qo(e);return{x:e.position.x,y:e.position.y,w:Number(((n=e.style)==null?void 0:n.width)??((i=e.measured)==null?void 0:i.width)??e.width??t.width),h:Number(((s=e.style)==null?void 0:s.height)??((r=e.measured)==null?void 0:r.height)??e.height??t.height)}}function Fr(e){const t=new Map(e.map(s=>[s.id,s])),n=new Map,i=(s,r)=>{const l=n.get(s.id);if(l)return l;const c=yw(s),u=s.parentId?t.get(s.parentId):void 0;if(u&&!r.has(u.id)){const f=i(u,new Set(r).add(s.id));c.x+=f.x,c.y+=f.y}return n.set(s.id,c),c};for(const s of e)i(s,new Set([s.id]));return n}function sp(e){const t=e.filter(i=>i.selected);if(t.length<2)return[];const n=t[0].parentId;return t.every(i=>i.parentId===n)?t:[]}const lh=`flowchart TD
|
|
106
|
+
`}const J6={fill:"fill",stroke:"stroke",color:"color","stroke-width":"strokeWidth","stroke-dasharray":"strokeDasharray","font-size":"fontSize","font-weight":"fontWeight","font-style":"fontStyle"};function ex(e){const t={};for(const n of e){const i=n.indexOf(":");if(i<0)continue;const s=J6[n.slice(0,i).trim()];s&&(t[s]=n.slice(i+1).trim())}return t}function nx(e){return{...e.color?{color:e.color}:{},...e.fontSize?{fontSize:e.fontSize}:{},...e.fontWeight?{fontWeight:e.fontWeight}:{},...e.fontStyle?{fontStyle:e.fontStyle}:{}}}function tY(e){return{...e.fill?{background:e.fill}:{},...e.stroke?{borderColor:e.stroke}:{},...nx(e)}}const ix=["azure","aws","gcp","kubernetes","other"],qE={azure:"Azure",aws:"AWS",gcp:"Google Cloud",kubernetes:"Kubernetes",other:""},eY=[/(^|-)vnets?($|-)/,/(^|-)virtual-networks?($|-)/,/(^|-)subnets?($|-)/,/(^|-)vpcs?($|-)/,/(^|-)resource-groups?($|-)/,/(^|-)subscriptions?($|-)/,/(^|-)management-groups?($|-)/,/(^|-)availability-zones?($|-)/,/(^|-)landing-zones?($|-)/,/(^|-)namespaces?($|-)/,/(^|-)clusters?($|-)/,/(^|-)regions?($|-)/,/(^|-)boundar(y|ies)($|-)/];function sx(e){return e.slice(e.indexOf(":")+1)}function nY(e){return eY.some(t=>t.test(e))?"group":"service"}function iY(e){const n=e.toLowerCase().split(/[/\\]/),i=n.pop()??"",s=r=>n.some(l=>r.test(l));return s(/(^|[-_])azure/)||s(/^microsoft/)?"azure":s(/(^|[-_])(aws\d*|amazon)/)?"aws":s(/(^|[-_])(gcp|google[-_]?cloud)/)?"gcp":s(/(^|[-_])(kubernetes|k8s)/)?"kubernetes":/^\d{4,}-icon-(service|)/.test(i)?"azure":"other"}const WE="graph:icon-pack",IE="graph:icon-pack-vendors",sY=3e6;function rY(){try{const e=JSON.parse(localStorage.getItem(WE)??"{}"),t={};for(const[n,i]of Object.entries(e)){if(typeof i!="string")continue;const s=sm(i);s&&(t[tl(n)]=s)}return t}catch{return{}}}function oY(){try{const e=JSON.parse(localStorage.getItem(IE)??"{}"),t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&ix.includes(i)&&(t[n]=i);return t}catch{return{}}}function MS(e,t){try{localStorage.setItem(WE,JSON.stringify(e)),t&&localStorage.setItem(IE,JSON.stringify(t))}catch{}}const mu=Ln((e,t)=>({icons:rY(),vendors:oY(),add:n=>{const i={...t().icons},s={...t().vendors},r=[];let l=JSON.stringify(i).length;for(const c of n){const u=sm(c.svg);if(!u)continue;const f=tl(c.name);if(i[f]||(l+=u.length+f.length+6),l>sY)break;i[f]=u;const d=iY(c.name);(d!=="other"||!s[f])&&(s[f]=d),r.push(`custom:${f}`)}return e({icons:i,vendors:s}),MS(i,s),r},remove:n=>{const i={...t().icons},s={...t().vendors},r=tl(n);delete i[r],delete s[r],e({icons:i,vendors:s}),MS(i,s)}})),lY=48,Ta=100,qo=44,pi=Ln(e=>({edgeId:null,from:-1,to:-1,begin:(t,n)=>e({edgeId:t,from:n,to:n}),moveTo:t=>e(n=>n.to===t?n:{...n,to:t}),end:()=>e({edgeId:null,from:-1,to:-1})}));function UE(e,t,n){return t<0||t===n?e:e===t?n:t<n?e>t&&e<=n?e-1:e:e>=n&&e<t?e+1:e}function aY(e,t,n){const i=[];for(let s=0;s<n;s++){const r=s<t?s:s+1,l=e[r];if(!l)break;l.kind==="block"?i.push(r):l.kind==="end"&&i.pop()}return i.length?i[i.length-1]:-1}let cy=null;const cY=5e3;async function uY(){if(typeof Worker<"u"){let t;try{const[{default:n},{default:i}]=await Promise.all([ee(()=>import("./elk-api-BEoK8cSs.js").then(s=>s.e),__vite__mapDeps([0,1]),import.meta.url),ee(()=>import("./elk-worker.min-D32ngsh5.js"),[],import.meta.url)]);return t=new n({workerFactory:()=>new i}),await Promise.race([t.layout({id:"probe",children:[{id:"n",width:1,height:1}]}),new Promise((s,r)=>setTimeout(()=>r(new Error("ELK worker did not respond")),cY))]),t}catch(n){t==null||t.terminateWorker(),console.warn("ELK worker unavailable; laying out on the main thread instead.",n)}}const{default:e}=await ee(async()=>{const{default:t}=await import("./elk.bundled-g5J3chN5.js").then(n=>n.e);return{default:t}},__vite__mapDeps([2,1]),import.meta.url);return new e}function hY(){return cy||(cy=uY()),cy}const fY={TD:"DOWN",TB:"DOWN",BT:"UP",LR:"RIGHT",RL:"LEFT"};function dY(e){var i,s,r,l;let t=0,n=0;for(const c of e)for(const u of[(s=(i=c.data)==null?void 0:i.arch)==null?void 0:s.lhsDir,(l=(r=c.data)==null?void 0:r.arch)==null?void 0:l.rhsDir])u==="L"||u==="R"?t++:(u==="T"||u==="B")&&n++;return t===0&&n===0?null:t>=n?"LR":"TB"}async function pw(e,t,n){const i=new Map;for(const d of e){const m=i.get(d.parentId)??[];m.push(d),i.set(d.parentId,m)}const s=d=>{var g,y;if(xe(d))return{id:d.id,children:(i.get(d.id)??[]).map(s),layoutOptions:{"elk.padding":"[top=40,left=16,bottom=16,right=16]"}};const m=Qo(d);return{id:d.id,width:((g=d.measured)==null?void 0:g.width)??d.width??m.width,height:((y=d.measured)==null?void 0:y.height)??d.height??m.height}},r={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":fY[dY(t)??n],"elk.layered.spacing.nodeNodeBetweenLayers":"70","elk.spacing.nodeNode":"40","elk.hierarchyHandling":"INCLUDE_CHILDREN"},children:(i.get(void 0)??[]).map(s),edges:t.map((d,m)=>({id:d.id||`e${m}`,sources:[d.source],targets:[d.target]}))},c=await(await hY()).layout(r),u={},f=(d,m)=>{var g;m||(u[d.id]={x:d.x??0,y:d.y??0,...(g=d.children)!=null&&g.length?{w:d.width??0,h:d.height??0}:{}});for(const y of d.children??[])f(y,!1)};return f(c,!0),u}const _S="graph:recent-icons",AS="graph:fav-icons";function zS(e){try{const t=JSON.parse(localStorage.getItem(e)??"[]");return Array.isArray(t)?t.map(String):[]}catch{return[]}}function HS(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}const Mi=Ln((e,t)=>({recents:zS(_S),favorites:zS(AS),recordRecent:n=>{if(!n.includes(":"))return;const i=[n,...t().recents.filter(s=>s!==n)].slice(0,12);e({recents:i}),HS(_S,i)},toggleFavorite:n=>{const s=t().favorites.includes(n)?t().favorites.filter(r=>r!==n):[n,...t().favorites].slice(0,24);e({favorites:s}),HS(AS,s)}}));function rx(){return typeof window.acquireVsCodeApi=="function"}function ZE(){if(rx())return!0;try{return new URLSearchParams(location.search).has("embed")}catch{return!1}}function lu(){return rx()}const FE="graph:workspace",ox="graph:doc:",BS="graph:code",VE=1,oh=ZE();function pY(){return`d${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`}function La(e){try{return localStorage.getItem(ox+e)}catch{return null}}function Pa(e,t){if(!oh)try{localStorage.setItem(ox+e,t)}catch{}}function XE(e){try{localStorage.removeItem(ox+e)}catch{}}function Ga(e){if(oh)return;const t={v:VE,activeId:e.activeId,docs:e.docs.map(({handle:n,...i})=>i)};try{localStorage.setItem(FE,JSON.stringify(t))}catch{}}function ip(e){return{id:pY(),name:e,updatedAt:Date.now(),path:null,handle:null,savedCode:null}}function mY(e){var l;if(oh){const c=ip("Untitled");return{state:{docs:[c],activeId:c.id},code:e}}let t=null;try{const c=localStorage.getItem(FE);c&&(t=JSON.parse(c))}catch{}if((l=t==null?void 0:t.docs)!=null&&l.length&&t.v===VE){const c=t.docs.map(f=>({...f,handle:null})),u=c.some(f=>f.id===t.activeId)?t.activeId:c[0].id;return{state:{docs:c,activeId:u},code:La(u)??e}}let n=null;try{n=localStorage.getItem(BS)}catch{}const i=ip("Untitled"),s=n??e,r={docs:[i],activeId:i.id};if(Pa(i.id,s),Ga(r),n!==null)try{localStorage.removeItem(BS)}catch{}return{state:r,code:s}}const Ut=Ln(()=>({docs:[],activeId:""}));function gY(){const{docs:e,activeId:t}=Ut.getState();return e.find(n=>n.id===t)}function Qa(e,t){const n=Ut.getState().docs.map(i=>i.id===e?{...i,...t}:i);Ut.setState({docs:n}),Ga(Ut.getState())}function yY(){const{activeId:e}=Ut.getState();e&&Qa(e,{updatedAt:Date.now()})}const uy=e=>e==="x"?"y":"x";function Vl(e){return e==="left"||e==="right"?"x":"y"}const mw=e=>({x:e.x+e.w/2,y:e.y+e.h/2});function YS(e,t,n){const[i,s]=n==="x"?[e.x,e.x+e.w]:[e.y,e.y+e.h],[r,l]=n==="x"?[t.x,t.x+t.w]:[t.y,t.y+t.h];return i<l&&r<s}function wY(e,t){const n=mw(e),i=mw(t),s=i.x-n.x,r=i.y-n.y;return(Math.abs(s)>=Math.abs(r)?!YS(e,t,"x"):YS(e,t,"y"))?s>=0?{from:"right",to:"left"}:{from:"left",to:"right"}:r>=0?{from:"bottom",to:"top"}:{from:"top",to:"bottom"}}function Ff(e,t){const n=mw(e);switch(t){case"left":return{x:e.x,y:n.y};case"right":return{x:e.x+e.w,y:n.y};case"top":return{x:n.x,y:e.y};case"bottom":return{x:n.x,y:e.y+e.h}}}function Tu(e){switch(e){case"left":return{x:-1,y:0};case"right":return{x:1,y:0};case"top":return{x:0,y:-1};case"bottom":return{x:0,y:1}}}const KE=20;function LS(e,t,n){const i=Tu(t);return(i.x!==0?i.x>0?n.x+n.w-(e.x+e.w):e.x-n.x:i.y>0?n.y+n.h-(e.y+e.h):e.y-n.y)<0}const PS=(e,t,n)=>(t.x-e.x)*n.x+(t.y-e.y)*n.y;function xY(e,t,n,i=KE){if(e.length<2)return e;const s=[...e],r=Tu(t);PS(s[0],s[1],r)<i&&s.splice(1,0,{x:s[0].x+r.x*i,y:s[0].y+r.y*i});const l=Tu(n),c=s.length-1;return PS(s[c],s[c-1],l)<i&&s.splice(c,0,{x:s[c].x+l.x*i,y:s[c].y+l.y*i}),s}function JE(e,t){return Math.abs(e.x-t.x)<.5&&Math.abs(e.y-t.y)<.5}function GS(e,t,n){return e>=Math.min(t,n)-.5&&e<=Math.max(t,n)+.5}function $Y(e,t,n){const i=Math.abs(e.y-t.y)<.5&&Math.abs(t.y-n.y)<.5&&GS(t.x,e.x,n.x),s=Math.abs(e.x-t.x)<.5&&Math.abs(t.x-n.x)<.5&&GS(t.y,e.y,n.y);return i||s}function ts(e){const t=[];for(const n of e)t.length&&JE(t[t.length-1],n)||t.push({...n});for(let n=1;n<t.length-1;)$Y(t[n-1],t[n],t[n+1])?t.splice(n,1):n++;return t}function bY(e,t,n){return Math.abs(e.x-t.x)<.5||Math.abs(e.y-t.y)<.5?null:n==="x"?{x:t.x,y:e.y}:{x:e.x,y:t.y}}function lx(e,t,n){if(e.length<2)return ts(e);if(e.length===2&&t===n){const[r,l]=e,c=Math.abs(r.x-l.x)>.5&&Math.abs(r.y-l.y)>.5;if(c&&t==="x"){const u=(r.x+l.x)/2;return ts([r,{x:u,y:r.y},{x:u,y:l.y},l])}if(c&&t==="y"){const u=(r.y+l.y)/2;return ts([r,{x:r.x,y:u},{x:l.x,y:u},l])}}const i=[{...e[0]}];let s=t;for(let r=0;r<e.length-1;r++){const l=e[r],c=e[r+1],u=r===e.length-2,f=r===0?t:uy(u?n:s),d=bY(l,c,f);d?(i.push(d),s=uy(f)):s=Math.abs(l.x-c.x)<.5?"y":"x",i.push({...c})}return ts(i)}function vY(e,t,n){const s=ju(e)[t];if(!s)return e;const r=s.axis==="x"?"y":"x",l=f=>r==="x"?{x:n,y:f.y}:{x:f.x,y:n},c=e.length-1,u=[];for(let f=0;f<=c;f++){const d=e[f];f===t&&f===0?u.push({...d},l(d)):f===t+1&&f===c?u.push(l(d),{...d}):f===t||f===t+1?u.push(l(d)):u.push({...d})}return ts(u)}function SY(e,t,n,i){const r=ju(t)[n];if(!r)return e;const l=r.axis==="x"?"y":"x",c=r.axis,u=l==="x"?r.from.x:r.from.y,f=Math.min(r.from[c],r.to[c]),d=Math.max(r.from[c],r.to[c]),m=v=>Math.abs(v[l]-u)<.5&&v[c]>=f-.5&&v[c]<=d+.5,g=e.map(v=>m(v)?l==="x"?{x:i,y:v.y}:{x:v.x,y:i}:{...v});if(e.some(m))return g;const y=t.slice(0,n+1).filter(v=>e.some(S=>Math.abs(S.x-v.x)<.5&&Math.abs(S.y-v.y)<.5)).length,$=v=>l==="x"?{x:i,y:v.y}:{x:v.x,y:i};return ts([...g.slice(0,y),$(r.from),$(r.to),...g.slice(y)])}function OY(e,t,n){return e.length===0||Math.abs(t.x)<.01&&Math.abs(t.y)<.01&&Math.abs(n.x)<.01&&Math.abs(n.y)<.01?e:e.map((s,r)=>{const l=(r+1)/(e.length+1),c=1-l;return{x:s.x+t.x*c+n.x*l,y:s.y+t.y*c+n.y*l}})}function kY(e,t){return e.length===t.length&&e.every((n,i)=>JE(n,t[i]))}function CY(e,t,n,i,s){const r=u=>lx([t,...u,n],i,s),l=r(e);let c=e;for(let u=c.length-1;u>=0;u--){const f=[...c.slice(0,u),...c.slice(u+1)];kY(r(f),l)&&(c=f)}return c}function ju(e){const t=[];for(let n=0;n<e.length-1;n++){const i=e[n],s=e[n+1];t.push({from:i,to:s,axis:Math.abs(i.y-s.y)<.5?"x":"y",index:n,mid:{x:(i.x+s.x)/2,y:(i.y+s.y)/2}})}return t}const gw={width:140,height:100},Td={width:48,height:28};function t3(e){return xe(e)?gw:Td}function e3(e){var t;return!xe(e)&&((t=e.style)==null?void 0:t.width)!==void 0}function yw(e){var n,i,s,r;const t=Qo(e);return{x:e.position.x,y:e.position.y,w:Number(((n=e.style)==null?void 0:n.width)??((i=e.measured)==null?void 0:i.width)??e.width??t.width),h:Number(((s=e.style)==null?void 0:s.height)??((r=e.measured)==null?void 0:r.height)??e.height??t.height)}}function Fr(e){const t=new Map(e.map(s=>[s.id,s])),n=new Map,i=(s,r)=>{const l=n.get(s.id);if(l)return l;const c=yw(s),u=s.parentId?t.get(s.parentId):void 0;if(u&&!r.has(u.id)){const f=i(u,new Set(r).add(s.id));c.x+=f.x,c.y+=f.y}return n.set(s.id,c),c};for(const s of e)i(s,new Set([s.id]));return n}function sp(e){const t=e.filter(i=>i.selected);if(t.length<2)return[];const n=t[0].parentId;return t.every(i=>i.parentId===n)?t:[]}const lh=`flowchart TD
|
|
107
107
|
start(["Start"])
|
|
108
108
|
input[/"User request"/]
|
|
109
109
|
check{"Valid?"}
|
|
@@ -153,10 +153,10 @@ ${i}
|
|
|
153
153
|
System(app, "Application")
|
|
154
154
|
|
|
155
155
|
Rel(user, app, "Uses")
|
|
156
|
-
`};function Ps(e,t){if(e==="sequence")return t;const n=s=>`${[s.source,s.target].sort().join("~")}|${s.sourceHandle??""}|${s.targetHandle??""}`,i=new Map;for(const s of t){const r=n(s);i.set(r,[...i.get(r)??[],s.id])}return t.map(s=>{var l,c,u;if((c=(l=s.data)==null?void 0:l.points)!=null&&c.length){if(s.type==="routed"&&!s.data.par)return s;const f={...s.data??{label:""}};return delete f.par,{...s,type:"routed",data:f}}const r=i.get(n(s));if(r.length<2){if(s.type!=="parallel"&&!((u=s.data)!=null&&u.par))return s;const f={...s.data??{label:""}};return delete f.par,{...s,type:"routed",data:f}}return{...s,type:"parallel",data:{...s.data??{label:""},par:{i:r.indexOf(s.id),n:r.length,s:s.source<=s.target?1:-1}}}})}function rp(e,t,n){if(n==="sequence"){let l=0;return e.map(c=>{const u=t[c.id],f=(u==null?void 0:u.x)??l*220;return l++,{...c,position:{x:f,y:0}}})}const i=Object.values(t);let s=i.length>0?Math.max(...i.map(l=>l.x))+260:0,r=0;return e.map(l=>{const c=t[l.id];if(!c){const u={x:s,y:r};return r+=110,r>660&&(r=0,s+=260),{...l,position:u}}return{...l,position:{x:c.x,y:c.y},...c.w!==void 0&&c.h!==void 0?{style:{...l.style,width:c.w,height:c.h},width:c.w,height:c.h}:{}}})}let QS;function na(e){if(oh)return;const{activeId:t}=Ut.getState();t&&(Pa(t,e),yY())}function EY(){let e=null;try{e=new URLSearchParams(location.search).get("code")}catch{}const{state:t,code:n}=mY(lh);return Ut.setState(t),e?(na(e),e):n}function DY(e,t,n){const i=Fr(e),s=Fr(t),r=u=>{const f=i.get(u),d=s.get(u);return f&&d?{x:d.x-f.x,y:d.y-f.y}:{x:0,y:0}};let l=!1;const c=n.map(u=>{var m;const f=(m=u.data)==null?void 0:m.points;if(!f||f.length===0)return u;const d=OY(f,r(u.source),r(u.target));return d===f?u:(l=!0,{...u,data:{...u.data??{label:""},points:d}})});return l?c:n}const ct=Ln((e,t)=>{let n=[],i=[],s=0;const r=()=>e({canUndo:n.length>0,canRedo:i.length>0}),l=new Map,c=k=>{!k||n[n.length-1]===k||(n.push(k),n.length>100&&n.shift(),i.length=0,r())};let u=null;const f=()=>{var O,E,T,j,N,_;const k={};for(const M of t().nodes)k[M.id]={x:M.position.x,y:M.position.y,...xe(M)?{w:Number(((O=M.style)==null?void 0:O.width)??((E=M.measured)==null?void 0:E.width)??320),h:Number(((T=M.style)==null?void 0:T.height)??((j=M.measured)==null?void 0:j.height)??220)}:e3(M)?{w:Number((N=M.style)==null?void 0:N.width),h:Number((_=M.style)==null?void 0:_.height)}:{}};return k},d=()=>{var E;const k=ay(t().edges),O={};for(const T of t().edges){const j=(E=T.data)==null?void 0:E.points;j!=null&&j.length&&(O[k.get(T.id)]=j)}return O},m=()=>{const k=t().nodes.map(O=>O.data.icon).filter(O=>typeof O=="string");return Y7(t().iconLibrary,k)},g=()=>{const k={};for(const O of t().nodes){const E=O.data.style;tx(E)||(k[O.id]=E)}return k},y=()=>{var E;const k=ay(t().edges),O={};for(const T of t().edges){const j=(E=T.data)==null?void 0:E.style;rm(j)||(O[k.get(T.id)]=j)}return O},$=(k,O,E=!0)=>{var N;const T=t().edges.find(_=>_.id===k);if(!T)return;const j=O(((N=T.data)==null?void 0:N.points)??[]);e({edges:Ps(t().kind,t().edges.map(_=>_.id===k?{..._,data:{..._.data??{label:""},...j.length>0?{points:j}:{points:void 0}}}:_))}),E&&S()},v=()=>{if(t().unsupported)return;c(t().code);const{kind:k,nodes:O,edges:E,direction:T,classDefs:j,c4Flavor:N,title:_,accTitle:M,accDescr:q,seqItems:G}=t(),I=z6({kind:k,direction:T,nodes:O,edges:E,classDefs:j,c4Flavor:N,title:_,accTitle:M,accDescr:q,items:G,positions:f()}),Z=xS(RS(jS(TS(I,d()),y()),g()),m());e({code:Z,parseError:null}),na(Z)},S=()=>{c(t().code);const k=xS(RS(jS(TS(M6(t().code,f()),d()),y()),g()),m());e({code:k}),na(k)},C=k=>{let O=0;const E=new RegExp(`^${k}(\\d+)$`);for(const T of t().nodes){const j=T.id.match(E);j&&(O=Math.max(O,Number(j[1])))}return`${k}${O+1}`};return{code:"",kind:"flowchart",nodes:[],edges:[],direction:"TD",classDefs:{},parseError:null,warning:null,unsupported:null,canUndo:!1,canRedo:!1,booted:!1,c4Flavor:"C4Context",title:"",accTitle:"",accDescr:"",seqItems:[],setCodeFromEditor:k=>{const O=Date.now();O-s>900&&c(t().code),s=O,e({code:k}),na(k),clearTimeout(QS),QS=setTimeout(()=>void t().applyCode(k),400)},applyCode:async(k,O)=>{O!=null&&O.record&&c(t().code);try{const E=await QE(k);let T=O!=null&&O.forceLayout?null:BE(k),j=rp(E.nodes,T??{},E.kind);!T&&E.kind!=="sequence"&&(T=await pw(j,E.edges,E.direction),j=rp(E.nodes,T,E.kind));const N=new Set(t().nodes.filter(z=>z.selected).map(z=>z.id));N.size>0&&(j=j.map(z=>N.has(z.id)?{...z,selected:!0}:z));const _={...mu.getState().icons,...z7(k)??{}};sy(_);const M=V6(k);M&&(j=j.map(z=>M[z.id]?{...z,data:{...z.data,style:M[z.id]}}:z));const q=L6(k),G=W6(k),I=ay(E.edges),Z=q||G?E.edges.map(z=>{const B=I.get(z.id),H=q==null?void 0:q[B],L=G==null?void 0:G[B];return!H&&!L?z:{...z,data:{...z.data??{label:""},...H?{points:H}:{},...L?{style:L}:{}}}}):E.edges;e({iconLibrary:_,kind:E.kind,nodes:j,edges:Ps(E.kind,Z),direction:E.direction,classDefs:E.classDefs,warning:E.warning??null,c4Flavor:E.c4Flavor??"C4Context",title:E.title??"",accTitle:E.accTitle??"",accDescr:E.accDescr??"",seqItems:E.items??[],parseError:null,unsupported:null,code:k}),na(k)}catch(E){E instanceof GE?(e({unsupported:E.diagramType,nodes:[],edges:[],seqItems:[],parseError:null,warning:null,code:k}),na(k)):e({parseError:E instanceof Error?E.message:String(E),code:k})}finally{t().booted||e({booted:!0})}},onNodesChange:k=>{if(t().kind==="sequence")for(const T of k)T.type==="position"&&T.position&&(T.position.y=0);const O=new Set(k.filter(T=>T.type==="remove").map(T=>T.id));let E=qC(k,t().nodes);if(O.size>0){E=E.map(N=>N.parentId&&O.has(N.parentId)?{...N,parentId:void 0,extent:void 0}:N);const T=new Set(E.map(N=>N.id)),j=Ps(t().kind,t().edges.filter(N=>T.has(N.source)&&T.has(N.target)));e({nodes:E,edges:j}),v()}else{const T=k.some(j=>j.type==="position"&&j.position);e({nodes:E,...T?{edges:DY(t().nodes,E,t().edges)}:{}})}},onEdgesChange:k=>{const O=k.some(j=>j.type==="remove");let E=WC(k,t().edges);O&&(E=Ps(t().kind,E));const T=new Set(E.map(j=>j.id));e({edges:E,...O?{seqItems:t().seqItems.filter(j=>j.kind!=="message"||T.has(j.edgeId))}:{}}),O&&v()},onConnect:k=>{if(!k.source||!k.target)return;const O=t().kind;if(O==="architecture"&&t().edges.some(N=>N.source===k.source&&N.target===k.target)){e({warning:`mermaid's architecture renderer allows only one connection from ${k.source} to ${k.target} — edit the existing edge instead.`});return}const E=k.source===k.target&&(O==="c4"||O==="architecture")?`mermaid's ${O==="c4"?"C4":"architecture"} renderer draws a connection from ${k.source} to itself as a stub at the corner of the node rather than as a loop — the file is valid, and Archyne draws the loop.`:null,T=B6(O);O==="architecture"&&T.arch&&(T.arch.lhsDir=k.sourceHandle||"R",T.arch.rhsDir=k.targetHandle||"L");const j=ou(O,{id:`e${t().edges.length}_${k.source}_${k.target}_${Date.now()}`,source:k.source,target:k.target,...O==="architecture"?{sourceHandle:T.arch.lhsDir,targetHandle:T.arch.rhsDir}:{},data:T});e({edges:Ps(O,[...t().edges,j]),...O==="sequence"?{seqItems:[...t().seqItems,{kind:"message",edgeId:j.id}]}:{},...E?{warning:E}:{}}),v()},onNodeDragStop:k=>{var T,j,N,_,M,q,G;const{kind:O,nodes:E}=t();if(k&&O!=="sequence"){const I=new Map(E.map(B=>[B.id,B])),Z=B=>{let H=B.position.x,L=B.position.y,F=B.parentId;for(;F;){const Q=I.get(F);if(!Q)break;H+=Q.position.x,L+=Q.position.y,F=Q.parentId}return{x:H,y:L}},z=I.get(k.id);if(z&&!xe(z)){const B=Qo(z),H=((T=z.measured)==null?void 0:T.width)??B.width,L=((j=z.measured)==null?void 0:j.height)??B.height,F={...Z(z)},Q=F.x+H/2,tt=F.y+L/2;let R,P=-1;for(const K of E){if(!xe(K))continue;const it=Z(K),ht=Number(((N=K.style)==null?void 0:N.width)??((_=K.measured)==null?void 0:_.width)??320),pt=Number(((M=K.style)==null?void 0:M.height)??((q=K.measured)==null?void 0:q.height)??220);if(Q>=it.x&&Q<=it.x+ht&&tt>=it.y&&tt<=it.y+pt){let mt=0,U=K.parentId;for(;U;)mt++,U=(G=I.get(U))==null?void 0:G.parentId;mt>P&&(P=mt,R=K)}}if(((R==null?void 0:R.id)??void 0)!==z.parentId){const K=R?Z(R):{x:0,y:0},it={...z,parentId:R==null?void 0:R.id,extent:void 0,position:{x:F.x-K.x,y:F.y-K.y}};e({nodes:[...E.filter(ht=>ht.id!==z.id),it]}),v();return}}}S()},setNodeSize:(k,O,E,T,j)=>{e({nodes:t().nodes.map(N=>N.id===k?{...N,position:{x:T,y:j},style:{...N.style,width:O,height:E},width:O,height:E}:N)})},resizeNode:(k,O,E)=>{const T=t().nodes.find(N=>N.id===k);if(!T)return;const j=t3(T);t().setNodeSize(k,Math.max(j.width,Math.round(O)),Math.max(j.height,Math.round(E)),T.position.x,T.position.y),S()},resetNodeSize:k=>{const O=t().nodes.find(E=>E.id===k);!O||xe(O)||(e({nodes:t().nodes.map(E=>E.id===k?{...E,style:{...E.style,width:void 0,height:void 0},width:void 0,height:void 0,measured:void 0}:E)}),S())},addWaypoint:(k,O,E,T=!0)=>{$(k,j=>[...j.slice(0,O),{x:Math.round(E.x),y:Math.round(E.y)},...j.slice(O)],T)},moveWaypoint:(k,O,E,T=!0)=>{$(k,j=>j.map((N,_)=>_===O?{x:Math.round(E.x),y:Math.round(E.y)}:N),T)},setWaypoints:(k,O,E=!0)=>{$(k,()=>O.map(T=>({x:Math.round(T.x),y:Math.round(T.y)})),E)},iconLibrary:{},addCustomIcons:k=>{const O=mu.getState().add(k),E=mu.getState().icons,T={...t().iconLibrary};for(const j of O){const N=j.slice(as.length+1);E[N]&&(T[N]=E[N])}return e({iconLibrary:T}),sy(T),O},addCustomIcon:(k,O)=>{const E=sm(O);if(!E)return null;const T=tl(k),j={...t().iconLibrary,[T]:E};return e({iconLibrary:j}),sy(j),`${as}:${T}`},setNodeStyle:(k,O)=>{e({nodes:t().nodes.map(E=>E.id===k?{...E,data:{...E.data,style:{...E.data.style,...O}}}:E)}),S()},setEdgeStyle:(k,O,E=!0)=>{e({edges:t().edges.map(T=>{var j;return T.id===k?{...T,data:{...T.data??{label:""},style:{...((j=T.data)==null?void 0:j.style)??{},...O}}}:T})}),E&&S()},commitWaypoints:()=>S(),removeWaypoint:(k,O)=>{$(k,E=>E.filter((T,j)=>j!==O))},appendWaypoint:k=>{var q;const O=t().edges.find(G=>G.id===k);if(!O)return;const E=Fr(t().nodes),T=G=>{const I=E.get(G);return I?{x:I.x+I.w/2,y:I.y+I.h/2}:null},j=T(O.source),N=T(O.target);if(!j||!N)return;const _=((q=O.data)==null?void 0:q.points)??[],M=_[_.length-1]??j;t().addWaypoint(k,_.length,{x:(M.x+N.x)/2,y:(M.y+N.y)/2})},clearWaypoints:k=>{$(k,()=>[])},addNode:(k,O)=>{var j,N;const{direction:E}=t();if(k.type==="seqnote"||k.type==="seqblock"){if(t().kind!=="sequence")return;const _=[...t().seqItems],M=Math.max(0,Math.min(_.length,Math.round((O.y-Ta)/qo)));if(k.type==="seqnote"){let q="",G=1/0;for(const I of t().nodes){if(I.type!=="participant")continue;const Z=((j=I.measured)==null?void 0:j.width)??Qo(I).width,z=Math.abs(I.position.x+Z/2-O.x);z<G&&(G=z,q=I.id)}if(!q)return;_.splice(M,0,{kind:"note",placement:"over",a:q,text:"Note"})}else{const q=((N=_[M])==null?void 0:N.kind)==="message"?M+1:M;_.splice(q,0,{kind:"end"}),k.op==="alt"&&_.splice(q,0,{kind:"divider",op:"else",label:""}),_.splice(M,0,{kind:"block",op:k.op,label:"condition"})}e({seqItems:_}),v();return}let T;switch(k.type){case"shape":T={id:C("n"),type:"shape",position:O,data:{label:"New node",shape:k.shape,direction:E}};break;case"state":{const _=k.stateType==="normal"?"s":k.stateType;T={id:C(_),type:"state",position:O,data:{label:k.stateType==="normal"?"NewState":"",stateType:k.stateType,direction:E}};break}case"entity":T={id:C("ENTITY"),type:"entity",position:O,data:{label:C("ENTITY"),attributes:[{type:"string",name:"id",keys:["PK"],comment:""}],direction:E}};break;case"class":T={id:C("Class"),type:"class",position:O,data:{label:C("Class"),members:[],methods:[],annotations:[],direction:E}};break;case"participant":{const _=C(k.ptype==="actor"?"actor":"p");T={id:_,type:"participant",position:{x:O.x,y:0},data:{label:_,ptype:k.ptype,direction:E}};break}case"service":{const _=C("svc");Mi.getState().recordRecent(k.icon),T={id:_,type:"service",position:O,data:{label:_,icon:k.icon,direction:E}};break}case"junction":T={id:C("j"),type:"junction",position:O,data:{}};break;case"c4":{const _=C("el");T={id:_,type:"c4",position:O,data:{label:_,c4Shape:k.c4Shape,descr:"",direction:E}};break}case"note":T={id:C("note"),type:"note",position:O,data:{text:"Note",direction:E}};break;case"group":{const _=t().kind,M=C("g");T={id:M,type:"group",position:O,data:{label:M,subgraphId:M,..._==="architecture"?{icon:k.icon??"cloud"}:{},..._==="c4"?{boundaryType:"SYSTEM"}:{}},style:{width:340,height:240}};break}}(k.type==="entity"||k.type==="class")&&(T={...T,data:{...T.data,label:T.id}}),T.selected=!0,e({nodes:[...t().nodes.map(_=>({..._,selected:!1})),T]}),v()},updateNodeData:(k,O)=>{e({nodes:t().nodes.map(E=>E.id===k?{...E,data:{...E.data,...O}}:E)}),v()},updateEdgeData:(k,O)=>{const E=t().kind,T=t().edges.map(j=>{if(j.id!==k||!j.data)return j;const N={...j.data,...O,...O.er?{er:{...j.data.er,...O.er}}:{},...O.cls?{cls:{...j.data.cls,...O.cls}}:{},...O.arch?{arch:{...j.data.arch,...O.arch}}:{}},_={...j,data:N};return N.arch&&(_.sourceHandle=N.arch.lhsDir,_.targetHandle=N.arch.rhsDir),ou(E,_)});e({edges:Ps(E,T)}),v()},setDiagramMeta:k=>{e(k),v()},setDirection:k=>{e({direction:k,nodes:t().nodes.map(O=>xe(O)?O:{...O,data:{...O.data,direction:k}})}),v()},runAutoLayout:async()=>{const{nodes:k,edges:O,direction:E,kind:T}=t();if(T==="sequence"){e({nodes:k.map((N,_)=>({...N,position:{x:_*220,y:0}}))}),S();return}const j=await pw(k,O,E);e({nodes:k.map(N=>{const _=j[N.id];return _?{...N,position:{x:_.x,y:_.y},...xe(N)&&_.w!==void 0?{style:{...N.style,width:_.w,height:_.h}}:{}}:N})}),S()},swapHistory:(k,O)=>{k&&l.set(k,{past:n,future:i});const E=l.get(O)??{past:[],future:[]};n=E.past,i=E.future,r()},newDiagram:k=>{t().applyCode(n3[k],{forceLayout:!0,record:!0})},undo:async()=>{if(n.length===0)return;i.push(t().code);const k=n.pop();r(),await t().applyCode(k)},redo:async()=>{if(i.length===0)return;n.push(t().code);const k=i.pop();r(),await t().applyCode(k)},copySelection:()=>{const k=t().nodes.filter(T=>T.selected&&!xe(T));if(k.length===0)return;const O=new Set(k.map(T=>T.id)),E=t().edges.filter(T=>O.has(T.source)&&O.has(T.target));u={nodes:structuredClone(k),edges:structuredClone(E)}},pasteClipboard:()=>{if(!u||u.nodes.length===0)return;const{kind:k}=t(),O=new Set(t().nodes.map(_=>_.id)),E=new Map,T=_=>{let M=2,q=`${_}_${M}`;for(;O.has(q);)q=`${_}_${++M}`;return O.add(q),q},j=u.nodes.map(_=>{const M=T(_.id);return E.set(_.id,M),{...structuredClone(_),id:M,parentId:void 0,extent:void 0,selected:!0,position:{x:_.position.x+36,y:k==="sequence"?0:_.position.y+36}}}),N=u.edges.map((_,M)=>ou(k,{...structuredClone(_),id:`e${Date.now()}_${M}`,source:E.get(_.source),target:E.get(_.target)}));e({nodes:[...t().nodes.map(_=>({..._,selected:!1})),...j],edges:Ps(k,[...t().edges,...N])}),v()},groupSelection:()=>{const{kind:k,nodes:O}=t();if(k!=="flowchart"&&k!=="state"&&k!=="architecture"&&k!=="c4"&&k!=="class")return;const E=O.filter(R=>R.selected),T=new Map(O.map(R=>[R.id,R])),j=(R,P)=>{var K;for(let it=R.parentId;it;it=(K=T.get(it))==null?void 0:K.parentId)if(it===P)return!0;return!1},N=E.filter(R=>!E.some(P=>P.id!==R.id&&j(R,P.id)));if(N.length===0)return;const _=N[0].parentId;if(!N.every(R=>R.parentId===_))return;const M=28,q=34,G=N.map(R=>{var pt,mt,U,ft;const P=Qo(R),K=$t=>{const Ct=Number($t);return Number.isFinite(Ct)?Ct:null},it=((pt=R.measured)==null?void 0:pt.width)??K((mt=R.style)==null?void 0:mt.width)??P.width,ht=((U=R.measured)==null?void 0:U.height)??K((ft=R.style)==null?void 0:ft.height)??P.height;return{x1:R.position.x,y1:R.position.y,x2:R.position.x+it,y2:R.position.y+ht}}),I=Math.min(...G.map(R=>R.x1))-M,Z=Math.min(...G.map(R=>R.y1))-M-q,z=Math.max(...G.map(R=>R.x2))+M,B=Math.max(...G.map(R=>R.y2))+M,H=C("g"),L={id:H,type:"group",position:{x:I,y:Z},data:{label:H,subgraphId:H,...k==="architecture"?{icon:"cloud"}:{},...k==="c4"?{boundaryType:"SYSTEM"}:{}},style:{width:z-I,height:B-Z},..._?{parentId:_}:{}},F=new Set(N.map(R=>R.id)),Q=O.map(R=>F.has(R.id)?{...R,parentId:H,position:{x:R.position.x-I,y:R.position.y-Z},selected:!1}:R),tt=Q.findIndex(R=>F.has(R.id));Q.splice(tt,0,{...L,selected:!0}),e({nodes:Q}),v()},updateSeqItem:(k,O)=>{const E=[...t().seqItems];E[k]&&(E[k]=O,e({seqItems:E}),v())},removeSeqItem:k=>{e({seqItems:b6(t().seqItems,k)}),v()},selectOnly:(k,O)=>{e({nodes:t().nodes.map(E=>({...E,selected:O==="node"&&E.id===k})),edges:t().edges.map(E=>({...E,selected:O==="edge"&&E.id===k}))})},selectAll:()=>{e({nodes:t().nodes.map(k=>({...k,selected:!0})),edges:t().edges.map(k=>({...k,selected:!0}))})},nudgeSelection:(k,O)=>{const E=t().nodes;E.some(T=>T.selected)&&(e({nodes:E.map(T=>T.selected?{...T,position:{x:T.position.x+k,y:T.position.y+O}}:T)}),S())},alignSelection:k=>{const O=sp(t().nodes);if(O.length===0)return;const E=O.map(yw),T=Math.min(...E.map(q=>q.x)),j=Math.max(...E.map(q=>q.x+q.w)),N=Math.min(...E.map(q=>q.y)),_=Math.max(...E.map(q=>q.y+q.h)),M=new Map;O.forEach((q,G)=>{const I=E[G],Z={x:I.x,y:I.y};k==="left"?Z.x=T:k==="right"?Z.x=j-I.w:k==="centerX"?Z.x=(T+j)/2-I.w/2:k==="top"?Z.y=N:k==="bottom"?Z.y=_-I.h:k==="middleY"&&(Z.y=(N+_)/2-I.h/2),M.set(q.id,{x:Math.round(Z.x),y:Math.round(Z.y)})}),e({nodes:t().nodes.map(q=>{const G=M.get(q.id);return G?{...q,position:G}:q})}),S()},distributeSelection:k=>{const O=sp(t().nodes);if(O.length<3)return;const E=O.map(I=>({n:I,b:yw(I)})).sort((I,Z)=>k==="x"?I.b.x-Z.b.x:I.b.y-Z.b.y),T=E[0].b,j=E[E.length-1].b,N=k==="x"?j.x+j.w-T.x:j.y+j.h-T.y,_=E.reduce((I,{b:Z})=>I+(k==="x"?Z.w:Z.h),0),M=(N-_)/(E.length-1),q=new Map;let G=k==="x"?T.x:T.y;for(const{n:I,b:Z}of E)q.set(I.id,{x:k==="x"?Math.round(G):Z.x,y:k==="y"?Math.round(G):Z.y}),G+=(k==="x"?Z.w:Z.h)+M;e({nodes:t().nodes.map(I=>{const Z=q.get(I.id);return Z?{...I,position:Z}:I})}),S()},refreshEdges:()=>{e({edges:Ps(t().kind,t().edges.map(k=>ou(t().kind,k)))})},deleteSelection:()=>{const k=t().nodes.filter(E=>E.selected).map(E=>({type:"remove",id:E.id})),O=t().edges.filter(E=>E.selected).map(E=>({type:"remove",id:E.id}));O.length&&t().onEdgesChange(O),k.length&&t().onNodesChange(k)},deleteElement:(k,O)=>{O==="node"?t().onNodesChange([{type:"remove",id:k}]):t().onEdgesChange([{type:"remove",id:k}])},duplicateNode:k=>{const{nodes:O,kind:E}=t(),T=O.find(q=>q.id===k);if(!T||xe(T))return;const j=new Set(O.map(q=>q.id));let N=2,_=`${k}_${N}`;for(;j.has(_);)_=`${k}_${++N}`;const M={...structuredClone(T),id:_,selected:!0,position:{x:T.position.x+36,y:E==="sequence"?0:T.position.y+36}};e({nodes:[...O.map(q=>({...q,selected:!1})),M]}),v()},removeFromGroup:k=>{const{nodes:O}=t(),E=O.find(M=>M.id===k);if(!(E!=null&&E.parentId))return;const T=new Map(O.map(M=>[M.id,M]));let j=E.position.x,N=E.position.y,_=E.parentId;for(;_;){const M=T.get(_);if(!M)break;j+=M.position.x,N+=M.position.y,_=M.parentId}e({nodes:O.map(M=>M.id===k?{...M,parentId:void 0,extent:void 0,position:{x:j,y:N}}:M)}),v()},moveMessage:(k,O)=>{const E=t().seqItems.findIndex(T=>T.kind==="message"&&T.edgeId===k);E<0||t().moveMessageTo(k,E+O)},moveMessageTo:(k,O)=>{const E=[...t().seqItems],T=E.findIndex(_=>_.kind==="message"&&_.edgeId===k);if(T<0)return;const j=Math.max(0,Math.min(E.length-1,O));if(j===T)return;const[N]=E.splice(T,1);E.splice(j,0,N),e({seqItems:E}),v()},ungroupSelection:()=>{const{nodes:k,edges:O}=t(),E=k.find(j=>j.selected&&xe(j));if(!E)return;const T=k.filter(j=>j.id!==E.id).map(j=>j.parentId===E.id?{...j,parentId:E.parentId,extent:E.parentId?"parent":void 0,position:{x:j.position.x+E.position.x,y:j.position.y+E.position.y}}:j);e({nodes:T,edges:O.filter(j=>j.source!==E.id&&j.target!==E.id)}),v()}}}),i3="graph:prefs",ww=12.5,s3=9,r3=32;function NY(){try{const e=localStorage.getItem(i3);return e?JSON.parse(e):{}}catch{return{}}}function hy(e){if(!Number.isFinite(e))return ww;const t=Math.round(e*2)/2;return Math.min(Math.max(t,s3),r3)}const fy=NY(),Hn=Ln((e,t)=>{const n=()=>{const{singleKeyShortcuts:i,editorFontSize:s,metaFolded:r}=t();try{localStorage.setItem(i3,JSON.stringify({singleKeyShortcuts:i,editorFontSize:s,metaFolded:r}))}catch{}};return{singleKeyShortcuts:fy.singleKeyShortcuts!==!1,editorFontSize:hy(fy.editorFontSize??ww),metaFolded:fy.metaFolded!==!1,setSingleKeyShortcuts:i=>{e({singleKeyShortcuts:i}),n()},setMetaFolded:i=>{t().metaFolded!==i&&(e({metaFolded:i}),n())},setEditorFontSize:i=>{e({editorFontSize:hy(i)}),n()},nudgeEditorFontSize:i=>{e({editorFontSize:hy(t().editorFontSize+i)}),n()},resetEditorFontSize:()=>{e({editorFontSize:ww}),n()}}});function o3(){return Hn.getState().singleKeyShortcuts}function l3(e){const[t,n]=Y.useState(()=>{try{return window.matchMedia(e).matches}catch{return!1}});return Y.useEffect(()=>{let i;try{i=window.matchMedia(e)}catch{return}const s=()=>n(i.matches);return s(),i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[e]),t}function TY(){return l3("(max-width: 640px), (max-height: 420px)")}function jY(){return l3("(pointer: coarse)")}const xw="graph:layout",$w=260,RY=520;function a3(e,t=window.innerWidth){const n=Math.max(t-RY,$w);return Math.round(Math.min(Math.max(e,$w),n))}function MY(){try{const e=localStorage.getItem(xw);if(!e)return null;const t=JSON.parse(e).sideWidth;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return null}}function qS(e){try{e===null?localStorage.removeItem(xw):localStorage.setItem(xw,JSON.stringify({sideWidth:e}))}catch{}}const es=Ln(e=>({paletteOpen:!1,sideOpen:!1,sideWidth:MY(),togglePalette:()=>e(t=>({paletteOpen:!t.paletteOpen,sideOpen:!1})),toggleSide:()=>e(t=>({sideOpen:!t.sideOpen,paletteOpen:!1})),closeDrawers:()=>e({paletteOpen:!1,sideOpen:!1}),setSideWidth:t=>{const n=a3(t);e({sideWidth:n}),qS(n)},resetSideWidth:()=>{e({sideWidth:null}),qS(null)}}));function ma(){return globalThis.archyne??null}function Ru(){return ma()}function bw(){return typeof globalThis.showSaveFilePicker=="function"}const vw=[{description:"Mermaid diagram",accept:{"text/plain":[".mmd",".mermaid",".txt"]}}],_Y=[{description:"Diagram",accept:{"text/plain":[".mmd",".mermaid",".txt",".dot",".gv",".sql",".ddl",".excalidraw",".puml",".plantuml",".iuml",".wsd"],"application/xml":[".drawio",".xml"],"application/vnd.ms-visio.drawing":[".vsdx"]}}];function AY(e){return e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4}async function c3(e){const t=new Uint8Array(await e.arrayBuffer());return AY(t)?{content:"",bytes:t}:{content:new TextDecoder().decode(t)}}function u3(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}async function zY(e="open"){const t=ma();if(t){const n=await t.showOpen(e);return n?{name:Sw(n.path),content:n.content,path:n.path,handle:null,...n.base64?{bytes:u3(n.base64)}:{}}:null}if(bw()){let n;try{[n]=await globalThis.showOpenFilePicker({types:e==="import"?_Y:vw})}catch{return null}const i=await c3(await n.getFile());return{name:n.name,path:null,handle:n,...i}}throw new Error("no-picker")}function Sw(e){return e.split(/[\\/]/).pop()||e}function HY(e,t){const n=new Blob([t],{type:"text/plain"}),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download=e,i.click(),URL.revokeObjectURL(i.href)}async function WS(e,t){const n=await e.createWritable();await n.write(t),await n.close()}const Be=Ln((e,t)=>({name:null,path:null,handle:null,savedCode:null,adopt:async n=>{await ct.getState().applyCode(n.content,{record:!0}),e({name:Sw(n.path),path:n.path,handle:null,savedCode:n.content})},open:async()=>{const n=ma();if(n){const i=await n.showOpen();i&&await t().adopt(i);return}if(bw()){let i;try{[i]=await globalThis.showOpenFilePicker({types:vw})}catch{return}const s=await(await i.getFile()).text();await ct.getState().applyCode(s,{record:!0}),e({name:i.name,path:null,handle:i,savedCode:s});return}throw new Error("no-picker")},save:async()=>{const{path:n,handle:i}=t(),s=ct.getState().code,r=ma();if(r&&n){await r.writeFile(n,s),e({savedCode:s});return}if(i){await WS(i,s),e({savedCode:s});return}await t().saveAs()},saveAs:async()=>{const n=ct.getState().code,i=t().name??"diagram.mmd",s=ma();if(s){const r=await s.showSave(i,n);r&&e({name:Sw(r),path:r,handle:null,savedCode:n});return}if(bw()){let r;try{r=await globalThis.showSaveFilePicker({suggestedName:i,types:vw})}catch{return}await WS(r,n),e({name:r.name,path:null,handle:r,savedCode:n});return}HY(i,n),e({savedCode:n})}}));function BY(e){const t=ma();t&&(t.openedFile().then(n=>{n&&e(n)}),t.onOpenFile(e))}function YY(e){const t=e.slice(0,4096).replace(/^\s*(?:<\?xml[^>]*\?>|<!--[\s\S]*?-->|\s)*/,"");return/^<\s*(mxfile|mxGraphModel)[\s>]/.test(t)}function LY(e){const t=e.slice(0,4096).replace(/^(?:\s|\/\/[^\n]*\n?|#[^\n]*\n?|\/\*[\s\S]*?\*\/)*/,"");return/^(strict\s+)?(di)?graph\b[^\n{]*\{/.test(t)}function PY(e){return/\bCREATE\s+(?:\w+\s+)*TABLE\b/i.test(e.slice(0,65536))}function GY(e){const t=e.slice(0,4096);return/^\s*\{/.test(t)&&/"type"\s*:\s*"excalidraw/.test(t)}function QY(e){return/^\s*@start\w+/m.test(e.slice(0,4096))}async function om(e,t){const n=e.bytes?await qY(e.bytes):await WY(e.content,t);if(!n)return{file:e,imported:null,source:e};const i=/\.(drawio\.xml|drawio|xml|vsdx|gv|dot|sql|ddl|excalidraw|puml|plantuml|iuml|wsd)$/i;return{file:{name:`${e.name.replace(i,"")}.mmd`,content:n.code,path:null,handle:null},imported:n.summary,source:e}}async function qY(e){const{vsdxToMermaid:t}=await ee(async()=>{const{vsdxToMermaid:i}=await import("./fromVsdx-BX1MgjJj.js");return{vsdxToMermaid:i}},__vite__mapDeps([3,4,5]),import.meta.url),n=t(e);return{code:n.code,summary:{format:"vsdx",choices:["flowchart"],nodes:n.nodes,edges:n.edges,pages:n.pages,dropped:n.dropped}}}async function WY(e,t){if(YY(e)){const{drawioToMermaid:n}=await ee(async()=>{const{drawioToMermaid:s}=await import("./fromDrawio-gSnkX-tI.js");return{drawioToMermaid:s}},__vite__mapDeps([6,4,5]),import.meta.url),i=n(e,t==="architecture"||t==="flowchart"?t:void 0);return{code:i.code,summary:{format:"drawio",choices:["flowchart","architecture"],nodes:i.nodes,edges:i.edges,pages:i.pages,dropped:i.dropped,...i.looksLike?{looksLike:i.looksLike}:{}}}}if(LY(e)){const{dotToMermaid:n}=await ee(async()=>{const{dotToMermaid:s}=await import("./fromDot-CzRtepTT.js");return{dotToMermaid:s}},__vite__mapDeps([7,5]),import.meta.url),i=n(e,t==="class"||t==="flowchart"?t:void 0);return{code:i.code,summary:{format:"dot",choices:["flowchart","class"],nodes:i.nodes,edges:i.edges,pages:[],dropped:i.dropped}}}if(GY(e)){const{excalidrawToMermaid:n}=await ee(async()=>{const{excalidrawToMermaid:s}=await import("./fromExcalidraw-D3y-jRyG.js");return{excalidrawToMermaid:s}},__vite__mapDeps([8,5]),import.meta.url),i=n(e);return{code:i.code,summary:{format:"excalidraw",choices:["flowchart"],nodes:i.nodes,edges:i.edges,pages:[],dropped:i.dropped}}}if(QY(e)){const{plantumlFamily:n,plantumlToMermaid:i}=await ee(async()=>{const{plantumlFamily:l,plantumlToMermaid:c}=await import("./fromPlantuml-Dtd5lHle.js");return{plantumlFamily:l,plantumlToMermaid:c}},__vite__mapDeps([9,5]),import.meta.url),s=t==="class"||t==="state"||t==="sequence"?t:n(e),r=s==="sequence"?i(e):await(async()=>{const l=await ee(()=>import("./plantumlFamilies-C25pY0S3.js"),__vite__mapDeps([10,5]),import.meta.url);return s==="class"?l.plantumlClassToMermaid(e):l.plantumlStateToMermaid(e)})();return{code:r.code,summary:{format:"plantuml",choices:["sequence","class","state"],nodes:r.nodes,edges:r.edges,pages:[],dropped:r.dropped}}}if(PY(e)){const{sqlToMermaid:n}=await ee(async()=>{const{sqlToMermaid:s}=await import("./fromSql-DRiVkm4z.js");return{sqlToMermaid:s}},__vite__mapDeps([11,5]),import.meta.url),i=n(e);return{code:i.code,summary:{format:"sql",choices:["er"],nodes:i.nodes,edges:i.edges,pages:[],dropped:i.dropped}}}return null}const op={"app.name":"Archyne","app.tagline":"visual diagram editor","app.loading":"loading diagram engine…","kind.flowchart":"Flowchart","kind.state":"State diagram","kind.er":"ER diagram","kind.class":"Class diagram","kind.sequence":"Sequence diagram","kind.architecture":"Architecture","kind.c4":"C4 model","toolbar.about":"About Archyne and licenses","toolbar.aboutTitle":"About & licenses","toolbar.shapesDrawer":"Shapes","toolbar.codeDrawer":"Code","toolbar.direction":"Direction","toolbar.dirTB":"Top → Down","toolbar.dirLR":"Left → Right","toolbar.dirBT":"Bottom → Up","toolbar.dirRL":"Right → Left","toolbar.undo":"Undo","toolbar.undoHint":"Undo (Ctrl+Z)","toolbar.redo":"Redo","toolbar.redoHint":"Redo (Ctrl+Y)","toolbar.autoLayout":"Auto-layout","toolbar.new":"New…","toolbar.newDiagram":"New diagram","toolbar.open":"Open","toolbar.import":"Import…","import.title":"Import from {source}","import.becomes":"Becomes a {kind}","import.readAs":"Read as","import.view":"How to look at it","import.view.canvas":"Canvas","import.view.mermaid":"Mermaid render","import.view.source":"Mermaid code","import.rendering":"Drawing the preview…","import.mermaidLayout":"Mermaid arranges diagrams itself and ignores the positions this file carries — this is how it renders elsewhere, not how it will look on the canvas.","import.noCanvas":"A sequence diagram is laid out from the order of its messages, which this preview cannot do — see the Mermaid render.","import.counts":"{nodes} elements, {edges} connections","import.onePage":"Only the first page, “{page}”, of {count} is converted","import.looksLike":"This looks like a {family} diagram; it converts as a flowchart","import.dropped":"Some elements had no Mermaid equivalent and were left out ({count})","import.unbound":"Arrives as {name}, unsaved. The file you chose is not touched.","import.cancel":"Cancel","import.confirm":"Import","import.previewAlt":"Preview of the converted diagram","import.zoom":"Zoom","import.zoomIn":"Zoom in","import.zoomOut":"Zoom out","import.zoomFit":"Fit to view","import.sourceAlt":"The Mermaid this converts to","toolbar.save":"Save .mmd","toolbar.export":"Export…","toolbar.copyCode":"Copy code","toolbar.copied":"Copied!","prefs.singleKeys":"Single-key shortcuts","toolbar.theme":"Theme","toolbar.themeDark":"Dark","toolbar.themeLight":"Light","toolbar.themeSystem":"System","toolbar.language":"Language","panel.sourceAndInspector":"Source and inspector","panel.mermaidSource":"Mermaid source","panel.sourceView":"Source view","panel.tabCode":"Mermaid","panel.tabPreview":"Preview","panel.cannotRender":"Cannot render: {message}","palette.shapes":"Shape palette","palette.architecture":"Architecture palette","palette.hint":"Drag onto the canvas, or click to add","palette.close":"Close panel","palette.search":"Search icons","palette.noIcons":"No icons found","palette.favorites":"Favorites","palette.addFavorite":"Add to favorites","palette.removeFavorite":"Remove from favorites","palette.add":"Add {name}","palette.addGroup":"Add {name} as a container","iconPicker.otherVendor":"Imported","iconPicker.currentIs":"on this node:","shape.square":"Process","shape.round":"Rounded","shape.stadium":"Terminator","shape.subroutine":"Subroutine","shape.cylinder":"Database","shape.circle":"Circle","shape.doublecircle":"Double circle","shape.diamond":"Decision","shape.hexagon":"Hexagon","shape.odd":"Flag","shape.trapezoid":"Trapezoid","shape.inv_trapezoid":"Trapezoid alt","shape.lean_right":"Input/Output","shape.lean_left":"Output/Input","shape.group":"Group","item.state":"State","item.start":"Start","item.end":"End","item.choice":"Choice","item.forkJoin":"Fork / Join","item.entity":"Entity","item.class":"Class","item.note":"Note","item.person":"Person","item.system":"System","item.systemExt":"System (ext)","item.systemDb":"System DB","item.container":"Container","item.component":"Component","item.participant":"Participant","item.actor":"Actor","item.loop":"Loop","item.altElse":"Alt / Else","item.opt":"Opt","item.subgraph":"Subgraph","canvas.label":"Diagram canvas","canvas.summary":"{kind}. Nodes: {nodes}. Groups: {groups}. Connections: {edges}. This canvas is visual; the Outline tab lists every node and its connections as text.","canvas.keyboardHelp":"Press Tab to move between nodes. Press C on a node to start a connection, then Enter on another node to complete it, or Escape to cancel. Press Delete to remove the selected node.","canvas.connectStart":"Connecting from {name}. Move to another node and press Enter.","canvas.connectDone":"Connected {from} to {to}.","canvas.connectCancelled":"Connection cancelled.","canvas.connectSameNode":"Pick a different node to connect to.","menu.actions":"Diagram actions","menu.rename":"Rename","menu.ungroup":"Ungroup","menu.deleteGroup":"Delete group","menu.duplicate":"Duplicate","menu.copy":"Copy","menu.removeFromGroup":"Remove from group","menu.delete":"Delete","menu.groupNodes":"Group {count} nodes","menu.deleteSelection":"Delete selection","menu.editLabel":"Edit label","menu.addNodeHere":"Add node here","menu.addCornerHere":"Add a corner here","menu.removeCorner":"Remove this corner","menu.straighten":"Straighten the line","menu.paste":"Paste","menu.autoLayout":"Auto-layout","export.title":"Export diagram","export.source":"Source","export.sourceCanvas":"Canvas (as arranged here)","export.sourceMermaid":"Mermaid renderer (standard look)","export.format":"Format","export.formatPng":"PNG","export.formatSvg":"SVG (vector)","export.formatPdf":"PDF","export.page":"Page","export.pageFit":"Fit to diagram","export.pageA4":"A4","export.pageLetter":"Letter","export.pdfHint":"The PDF holds the diagram as an image at the chosen quality. Export SVG for artwork that scales without limit.","export.copyImage":"Copy image","export.copyMarkup":"Copy markup","export.copied":"Copied","export.background":"Background","export.bgDark":"Dark","export.bgLight":"White","export.bgTransparent":"Transparent","export.mermaidTheme":"Mermaid theme","export.quality":"Quality","export.quality1":"1× (screen)","export.quality2":"2× (slides)","export.quality3":"3× (print)","export.margin":"Margin ({padding}px)","export.generating":"Generating preview…","export.previewAlt":"Preview of the exported diagram","export.cancel":"Cancel","export.confirm":"Export {format}","about.title":"About Archyne","about.trademark":"Archyne is an independent project. It is not affiliated with, endorsed by, or sponsored by Mermaid or Mermaid Chart. “Mermaid” is a trademark of its respective owner, used here only to describe the file format Archyne reads and writes.","about.close":"Close","about.version":"version {version}","inspector.diagram":"DIAGRAM","inspector.accTitle":"Accessible title (accTitle)","inspector.accDescr":"Accessible description (accDescr)","inspector.empty":"Select a node or edge to edit it. Double-click empty canvas to add a node, drag between handles to connect.","palette.sectionShapes":"Shapes","palette.sectionBase":"Base","palette.sectionPinned":"Recent & favorites","palette.sectionCarried":"In this diagram","palette.sectionVendor":"Vendor icons","palette.searchIcons":"Search 13000+ icons…","item.compositeState":"Composite state","item.boundary":"Boundary","item.namespace":"Namespace","item.junction":"junction","insp.selection":"{count} nodes selected","insp.align":"Align","insp.alignLeft":"Left","insp.alignCenterX":"Centre","insp.alignRight":"Right","insp.alignTop":"Top","insp.alignMiddleY":"Middle","insp.alignBottom":"Bottom","insp.distribute":"Distribute","insp.distributeX":"Across","insp.distributeY":"Down","insp.alignSameParent":"Select two or more nodes inside the same group to arrange them.","insp.distributeNeedsThree":"Distributing needs three or more: it arranges what lies between the outer two.","insp.label":"Label","edge.addCorner":"Drag to add a corner","edge.moveSegment":"Drag to move this run of the line","edge.moveLabel":"Drag to move the label, double-click to put it back","edge.removeCorner":"Drag to move, double-click to remove","edge.cornerNamed":"Corner {index} of {total}. Arrow keys move it, Shift for a bigger step, Delete removes it.","insp.corners":"Corners","insp.addCorner":"Add corner","insp.removeCorner":"Remove","insp.straighten":"Straighten","watch.reloaded":"{name} changed on disk — reloaded","watch.conflict":"{name} changed on disk. Your unsaved changes were kept.","menu.reloadFromDisk":"Reload from disk","toast.reloadedFromDisk":"Reloaded from disk","toast.imported":"Imported {nodes} elements and {edges} connections from {source}","toast.importedOnePage":"Converted the first page, “{page}”, of {count}","toast.importedLooksLike":"This looked like a {family} diagram; it was imported as a flowchart","toast.importedDropped":"Some elements had no Mermaid equivalent and were left out ({count})","insp.autoSize":"Automatic size","insp.width":"Width","insp.height":"Height","insp.shape":"Shape","insp.fill":"Fill","insp.border":"Border","insp.text":"Text","insp.fontSize":"Type size","insp.reset":"Reset","insp.name":"Name","insp.attributes":"Attributes — one per line:","insp.junction":"Junction — a connector waypoint.","insp.pseudoState":"{type} pseudo-state","insp.elementType":"Element type","insp.description":"Description","insp.kind":"Kind","insp.participantBox":"Participant (box)","insp.actorPerson":"Actor (person)","insp.annotations":"Annotations — e.g.","insp.annotationsHint":"(space-separated)","insp.arrow":"Arrow","insp.line":"Line","insp.lineSolid":"Solid","insp.lineDotted":"Dotted","insp.lineThick":"Thick","insp.routing":"Routing","insp.routeOrthogonal":"Right angles","insp.routeStraight":"Straight","insp.routeCurved":"Curved","insp.look":"Look","insp.lookBoxed":"Box with icon","insp.lookIcon":"Icon alone","insp.icon":'Icon — built-in (server, database, cloud…) or "logos:aws-s3"',"insp.lookDashed":"Dashed frame","insp.lookSolid":"Solid frame","insp.lookPlain":"Hairline","insp.image":"Picture (URL) — drawn on the node, and by other Mermaid tools too","insp.imagePos":"Label","insp.imagePosAbove":"Above","insp.imagePosBelow":"Below","insp.imageSize":"Size","insp.imageHint":"A picture given as a URL is the only icon other Mermaid tools also draw; names like logos:aws render here but not there.","insp.importIcon":"Import SVG…","insp.importUrl":"From a link…","iconPicker.choose":"Choose icon…","iconPicker.title":"Choose an icon","iconPicker.imported":"Imported","iconPicker.common":"Common","iconPicker.results":"Results","iconPicker.nothing":"Nothing matches that. Vendors use their own words — Azure's networks are “virtual networks”, not “vnet”.","iconPicker.none":"No icon","iconUrl.title":"Import icons from a link","iconUrl.label":"Links, one per line","iconUrl.hintWeb":"Direct links to .svg files on {hosts}. Other sites refuse to be read from a page; for a vendor's zip, use the desktop app.","iconUrl.hintDesktop":"Any https link to an .svg, or to a .zip of them — a vendor's whole pack works here.","iconUrl.hintIconify":"Any Iconify icon works too — about 200 000 of them: api.iconify.design/mdi/database.svg","iconUrl.fetch":"Import","iconUrl.fetching":"Fetching…","toast.iconsFetchFailed":"Nothing could be fetched from those links","toast.iconNotSvg":"That file is not an SVG icon","toast.iconsImported":"Imported {count} icons, skipped {skipped}","insp.arrowPoint":"Arrow","insp.arrowNone":"None","insp.arrowCircle":"Circle","insp.arrowCross":"Cross","insp.bothEnds":"Arrowheads at both ends","insp.identifying":"Identifying (solid line)","insp.technology":"Technology","insp.techPlaceholder":"e.g. HTTPS/JSON","insp.bidirectional":"Bidirectional","insp.dottedLine":"Dotted line","insp.cardOnePlaceholder":"e.g. 1","insp.cardManyPlaceholder":"e.g. many","insp.diagramTitle":"Diagram","insp.title":"Title","error.crashTitle":"Something broke while rendering","error.crashIntro":"Your diagram is safe — this is its current code. Copy it somewhere if in doubt, then try to recover:","error.reset":"Reset to sample diagram and reload","insp.groupTitle":"Group {id}","insp.nodeTitle":"Node {id}","insp.edgeTitle":"Edge {source} → {target}","seq.notePlaceholder":"Note text","seq.dragReorder":"Drag vertically to reorder","seq.delete":"Delete","seq.done":"Done","seq.over":"over","seq.leftOf":"left of","seq.rightOf":"right of","unsupported.title":"Read-only: {type} diagrams","unsupported.body":"Archyne does not have a visual editor for this diagram family yet, so the canvas is read-only. The Mermaid code is fully editable, and saving leaves your file exactly as it is.","unsupported.badge":"{type} (read-only)","unsupported.paletteHint":"This diagram family is read-only. Edit it as Mermaid code in the panel on the right.","toolbar.saveAs":"Save as…","file.unsaved":"unsaved changes","file.untitled":"Untitled diagram","file.confirmDiscard":"This diagram has unsaved changes. Leave anyway?","doc.menuLabel":"Diagram: {name} — switch or manage","doc.openDocuments":"Open diagrams","doc.closeNamed":"Close {name}","doc.tabsHint":"Diagrams open in Archyne","doc.closeAll":"Close all","doc.closeAllTitle":"Close {count} documents?","doc.closeAllBody":"Every open diagram is closed and an empty one starts.","doc.closeAllUnsaved":"These diagrams have unsaved changes, which will be lost:","doc.current":"(current)","doc.new":"New diagram","doc.rename":"Rename…","doc.duplicate":"Duplicate","doc.delete":"Delete","doc.renameTitle":"Rename diagram","doc.nameLabel":"Name","doc.renameConfirm":"Rename","doc.renameHint":"This is a label in Archyne. The file on disk is not renamed.","doc.deleteTitle":"Delete “{name}”?","doc.deleteBody":"This removes the diagram from Archyne. Any file you saved it to is untouched.","doc.deleteUnsaved":"This diagram has changes that are not saved to a file. Deleting it loses them. Any file you saved it to earlier is untouched.","doc.switchTo":"Switch to {name}","common.cancel":"Cancel","toast.dismiss":"Dismiss","toast.saved":"Saved","toast.copied":"Mermaid code copied","toast.saveFailed":"Could not save","toast.openFailed":"Could not open the file","shortcuts.title":"Keyboard shortcuts","shortcuts.file":"File","shortcuts.edit":"Edit","shortcuts.canvas":"Canvas","shortcuts.view":"View","shortcuts.selectAll":"Select all","shortcuts.nextNode":"Move between nodes","shortcuts.connect":"Start a connection from the focused node","shortcuts.completeConnect":"Complete the connection","shortcuts.labelBreak":"Line break, while renaming a node","shortcuts.cancel":"Cancel","shortcuts.nudge":"Nudge the selection","shortcuts.nudgeFar":"Nudge further","shortcuts.commandPalette":"Command palette","panel.tabOutline":"Outline","outline.filter":"Filter nodes","outline.empty":"No nodes match","outline.noNodes":"This diagram has no nodes yet.","outline.connections":"{count} outgoing","outline.select":"Select {name}","outline.summary":"{nodes} nodes, {edges} connections","palette.commandTitle":"Command palette","palette.commandFilter":"Type a command or node name","palette.commandEmpty":"Nothing matches","palette.groupCommands":"Commands","palette.groupNodes":"Go to node","palette.groupArrange":"Arrange","palette.groupDocuments":"Switch diagram","palette.groupNew":"New diagram","cmd.run":"Run","tpl.title":"Start from a template","tpl.blank":"Blank diagram","tpl.blankDesc":"An empty {kind} to build up yourself.","tpl.open":"Templates","tpl.approval":"Approval workflow","tpl.approvalDesc":"Branching decisions with two outcomes.","tpl.auth":"Sign-in flow","tpl.authDesc":"Messages between a user, an app and a service, with an alt block.","tpl.orders":"Orders schema","tpl.ordersDesc":"Customers, orders and products with crow's-foot cardinalities.","tpl.webapp":"Web application","tpl.webappDesc":"A cloud deployment with nested groups and vendor icons.","tpl.orderState":"Order lifecycle","tpl.orderStateDesc":"States and transitions from draft to delivered.","tpl.domain":"Domain model","tpl.domainDesc":"Classes with fields, methods and cardinalities.","tpl.context":"System context","tpl.contextDesc":"People and systems around one product, C4 style.","toolbar.more":"More","panel.resize":"Resize the side panel","panel.resizeHint":"Drag to resize, double-click to reset","editor.format":"Format","editor.formatHint":"Tidy the indentation (Shift+Alt+F)","editor.formatCommand":"Format the Mermaid code","editor.fontSize":"Text size","editor.fontSmaller":"Smaller text","editor.fontLarger":"Larger text","editor.fontReset":"Reset the text size","editor.metaFolded":"Layout data Archyne writes into the file. Click to open.","shortcuts.editor":"Code editor","error.title":"Something went wrong","error.reload":"Reload"},lp={en:{label:"English",dir:"ltr"},es:{label:"Español",dir:"ltr"},it:{label:"Italiano",dir:"ltr"},de:{label:"Deutsch",dir:"ltr"},ar:{label:"العربية",dir:"rtl"},zh:{label:"简体中文",dir:"ltr"},ja:{label:"日本語",dir:"ltr"}},IY={es:()=>ee(()=>import("./es-DhIKChM2.js"),[],import.meta.url),it:()=>ee(()=>import("./it-Du1X6aWm.js"),[],import.meta.url),de:()=>ee(()=>import("./de-BnB-zySU.js"),[],import.meta.url),ar:()=>ee(()=>import("./ar-BtyCldeI.js"),[],import.meta.url),zh:()=>ee(()=>import("./zh-DnDlZG1E.js"),[],import.meta.url),ja:()=>ee(()=>import("./ja-DM0AEe7d.js"),[],import.meta.url)},h3="graph:locale",f3=(()=>{try{return new URLSearchParams(location.search).has("embed")}catch{return!1}})();function UY(e){return e!==null&&e in lp}function ZY(){if(f3)return"en";try{const e=localStorage.getItem(h3);if(UY(e))return e}catch{}return"en"}const ja=Ln(e=>({locale:"en",messages:op,setLocale:async t=>{if(t==="en")e({locale:t,messages:op});else{const n=await IY[t]();e({locale:t,messages:n.messages})}d3(t);try{f3||localStorage.setItem(h3,t)}catch{}}}));function d3(e){const t=document.documentElement;t.lang=e,t.dir=lp[e].dir}function FY(){const e=ZY();d3(e),e!=="en"&&ja.getState().setLocale(e)}function p3(e,t){return t?e.replace(/\{(\w+)\}/g,(n,i)=>i in t?String(t[i]):n):e}function ge(e,t){const{messages:n}=ja.getState();return p3(n[e]??op[e],t)}function Zt(){const e=ja(t=>t.messages);return(t,n)=>p3(e[t]??op[t],n)}const IS={info:2600,error:6e3};let VY=1;const ap=Ln(e=>({toasts:[],dismiss:t=>{XY(t),e(n=>({toasts:n.toasts.filter(i=>i.id!==t)}))}})),Vr=new Map;let Mu=!1;function m3(e,t){const n=setTimeout(()=>{Vr.delete(e),ap.getState().dismiss(e)},t);Vr.set(e,{handle:n,endsAt:Date.now()+t})}function XY(e){const t=Vr.get(e);t&&(clearTimeout(t.handle),Vr.delete(e))}function US(){if(Mu)return;Mu=!0;const e=Date.now();for(const[t,n]of Vr)clearTimeout(n.handle),Vr.set(t,{handle:n.handle,endsAt:Math.max(0,n.endsAt-e)})}function ZS(){if(Mu){Mu=!1;for(const[e,t]of[...Vr])m3(e,t.endsAt)}}function g3(e,t){const n=VY++;return ap.setState(i=>({toasts:[...i.toasts,{id:n,text:e,tone:t}]})),Mu?Vr.set(n,{handle:0,endsAt:IS[t]}):m3(n,IS[t]),n}function os(e,t="info",n){return g3(ge(e,n),t)}function ga(e,t){const n=t instanceof Error?t.message:String(t);return g3(`${ge(e)}: ${n}`,"error")}async function y3(e,t){try{if(e.handle){const i=await e.handle.getFile();return i.lastModified<=t?null:{stamp:i.lastModified,content:await i.text()}}const n=Ru();if(e.path&&(n!=null&&n.statFile)&&n.readFile){const i=await n.statFile(e.path);if(!i||i.mtimeMs<=t)return null;const s=await n.readFile(e.path);return s===null?null:{stamp:i.mtimeMs,content:s}}}catch{}return null}const Ow=new Map;function w3(e){Ow.delete(e)}async function KY(){const{docs:e,activeId:t}=Ut.getState();for(const n of e){if(!n.path&&!n.handle)continue;const i=n.id===t,s=i?{path:Be.getState().path,handle:Be.getState().handle}:{path:n.path,handle:n.handle},r=await y3(s,Ow.get(n.id)??0);if(!r)continue;Ow.set(n.id,r.stamp);const l=i?Be.getState().savedCode:n.savedCode;if(r.content===l)continue;const c=i?ct.getState().code:La(n.id);if(c!==null&&l!==null&&c!==l){os("watch.conflict","error",{name:n.name});continue}i?(await ct.getState().applyCode(r.content,{record:!0}),Be.setState({savedCode:r.content})):Pa(n.id,r.content),Qa(n.id,{savedCode:r.content}),os("watch.reloaded","info",{name:n.name})}}const JY=2e3;function tL(){let e=!1;const t=()=>{e||document.visibilityState!=="visible"||(e=!0,KY().finally(()=>{e=!1}))},n=setInterval(t,JY);return document.addEventListener("visibilitychange",t),()=>{clearInterval(n),document.removeEventListener("visibilitychange",t)}}function ax(){const{activeId:e}=Ut.getState();if(!e)return;const{path:t,handle:n,savedCode:i,name:s}=Be.getState();Pa(e,ct.getState().code),Qa(e,{path:t,handle:n,savedCode:i,...s?{name:s}:{}})}function x3(e){const t=!!(e.path||e.handle);Be.setState({name:t?e.name:null,path:e.path,handle:e.handle,savedCode:e.savedCode})}async function lm(e){const{activeId:t,docs:n}=Ut.getState();if(e===t)return;const i=n.find(s=>s.id===e);i&&(ax(),Ut.setState({activeId:e}),Ga(Ut.getState()),ct.getState().swapHistory(t,e),x3(i),await ct.getState().applyCode(La(e)??lh,{record:!1}))}async function qa(e){ax();const t=ip(eL()),n=e?n3[e]:lh;Pa(t.id,n);const i=Ut.getState().activeId;return Ut.setState(s=>({docs:[...s.docs,t],activeId:t.id})),Ga(Ut.getState()),ct.getState().swapHistory(i,t.id),x3(t),await ct.getState().applyCode(n,{forceLayout:!!e,record:!1}),t.id}function eL(){const e=new Set(Ut.getState().docs.map(t=>t.name));if(!e.has("Untitled"))return"Untitled";for(let t=2;;t++){const n=`Untitled ${t}`;if(!e.has(n))return n}}function nL(e,t){const n=t.trim();n&&(Qa(e,{name:n}),e===Ut.getState().activeId&&Be.getState().name&&Be.setState({name:n}))}async function iL(e){e===Ut.getState().activeId&&ax();const t=Ut.getState().docs.find(i=>i.id===e);if(!t)return"";const n=ip(`${t.name} copy`);return Pa(n.id,La(e)??lh),Ut.setState(i=>({docs:[...i.docs,n]})),Ga(Ut.getState()),await lm(n.id),n.id}async function sL(e){const{docs:t,activeId:n}=Ut.getState();if(!t.some(s=>s.id===e))return;const i=t.filter(s=>s.id!==e);if(XE(e),w3(e),i.length===0){Ut.setState({docs:[],activeId:""}),await qa();return}if(Ut.setState({docs:i}),e===n){const s=[...i].sort((r,l)=>l.updatedAt-r.updatedAt)[0];Ut.setState({activeId:""}),await lm(s.id)}else Ga(Ut.getState())}async function rL(){const{path:e,handle:t}=Be.getState(),n=await y3({path:e,handle:t},0);return n?(await ct.getState().applyCode(n.content,{record:!0}),Be.setState({savedCode:n.content}),Qa(Ut.getState().activeId,{savedCode:n.content}),!0):!1}function oL(){const{docs:e,activeId:t}=Ut.getState();return[...e].sort((n,i)=>i.updatedAt-n.updatedAt).map(n=>({...n,active:n.id===t}))}function lL(){if(oh||!gY())return!1;const{path:e,handle:t,savedCode:n}=Be.getState(),i=!e&&!t&&n===null,s=ct.getState().code;return!(i&&(s===lh||s.trim()===""))}const au=Ln(()=>({renaming:null,deleting:null}));function aL(){return{rename:()=>au.setState({renaming:Ut.getState().activeId}),duplicate:()=>void iL(Ut.getState().activeId)}}async function $3({file:e,imported:t}){lL()&&await qa();const n=t?null:e.content;await ct.getState().applyCode(e.content,{record:!0}),Be.setState({name:e.name,path:e.path,handle:e.handle,savedCode:n}),Qa(Ut.getState().activeId,{name:e.name,path:e.path,handle:e.handle,savedCode:n}),t&&cL(t)}function cL(e){const n={dot:"Graphviz",drawio:"draw.io",sql:"SQL",excalidraw:"Excalidraw",plantuml:"PlantUML",vsdx:"Visio"}[e.format];os("toast.imported","info",{source:n,nodes:String(e.nodes),edges:String(e.edges)})}async function uL(e,t){await ux(await om({name:e,path:null,handle:null,...t}))}async function cx(e="open"){const t=await zY(e);t&&await ux(await om(t))}async function ux(e){if(!e.imported){await $3(e);return}cp.setState({pending:e})}const cp=Ln(()=>({pending:null}));async function hL(e){const t=e.path.split(/[\\/]/).pop()||e.path;return ux(await om({name:t,content:e.content,path:e.path,handle:null,...e.base64?{bytes:u3(e.base64)}:{}}))}async function fL(){const{docs:e}=Ut.getState();for(const t of e)XE(t.id),w3(t.id);Ut.setState({docs:[],activeId:""}),await qa()}function b3(){const{docs:e,activeId:t}=Ut.getState(),n=Be.getState();return e.filter(i=>{const s=i.id===t?n.savedCode:i.savedCode;if(s===null)return!1;const r=i.id===t?ct.getState().code:La(i.id);return r!==null&&r!==s})}function dL(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),i=n.createElement("base"),s=n.createElement("a");return n.head.appendChild(i),n.body.appendChild(s),t&&(i.href=t),s.href=e,s.href}const pL=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Ir(e){const t=[];for(let n=0,i=e.length;n<i;n++)t.push(e[n]);return t}let Xl=null;function v3(e={}){return Xl||(e.includeStyleProperties?(Xl=e.includeStyleProperties,Xl):(Xl=Ir(window.getComputedStyle(document.documentElement)),Xl))}function up(e,t){const i=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return i?parseFloat(i.replace("px","")):0}function mL(e){const t=up(e,"border-left-width"),n=up(e,"border-right-width");return e.clientWidth+t+n}function gL(e){const t=up(e,"border-top-width"),n=up(e,"border-bottom-width");return e.clientHeight+t+n}function S3(e,t={}){const n=t.width||mL(e),i=t.height||gL(e);return{width:n,height:i}}function yL(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const Vn=16384;function wL(e){(e.width>Vn||e.height>Vn)&&(e.width>Vn&&e.height>Vn?e.width>e.height?(e.height*=Vn/e.width,e.width=Vn):(e.width*=Vn/e.height,e.height=Vn):e.width>Vn?(e.height*=Vn/e.width,e.width=Vn):(e.width*=Vn/e.height,e.height=Vn))}function hp(e){return new Promise((t,n)=>{const i=new Image;i.onload=()=>{i.decode().then(()=>{requestAnimationFrame(()=>t(i))})},i.onerror=n,i.crossOrigin="anonymous",i.decoding="async",i.src=e})}async function xL(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function $L(e,t,n){const i="http://www.w3.org/2000/svg",s=document.createElementNS(i,"svg"),r=document.createElementNS(i,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${n}`),s.setAttribute("viewBox",`0 0 ${t} ${n}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),s.appendChild(r),r.appendChild(e),xL(s)}const Bn=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Bn(n,t)};function bL(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function vL(e,t){return v3(t).map(n=>{const i=e.getPropertyValue(n),s=e.getPropertyPriority(n);return`${n}: ${i}${s?" !important":""};`}).join(" ")}function SL(e,t,n,i){const s=`.${e}:${t}`,r=n.cssText?bL(n):vL(n,i);return document.createTextNode(`${s}{${r}}`)}function FS(e,t,n,i){const s=window.getComputedStyle(e,n),r=s.getPropertyValue("content");if(r===""||r==="none")return;const l=pL();try{t.className=`${t.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(SL(l,n,s,i)),t.appendChild(c)}function OL(e,t,n){FS(e,t,":before",n),FS(e,t,":after",n)}const VS="application/font-woff",XS="image/jpeg",kL={woff:VS,woff2:VS,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:XS,jpeg:XS,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function CL(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function hx(e){const t=CL(e).toLowerCase();return kL[t]||""}function EL(e){return e.split(/,/)[1]}function kw(e){return e.search(/^(data:)/)!==-1}function DL(e,t){return`data:${t};base64,${e}`}async function O3(e,t,n){const i=await fetch(e,t);if(i.status===404)throw new Error(`Resource "${i.url}" not found`);const s=await i.blob();return new Promise((r,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{r(n({res:i,result:c.result}))}catch(u){l(u)}},c.readAsDataURL(s)})}const dy={};function NL(e,t,n){let i=e.replace(/\?.*/,"");return n&&(i=e),/ttf|otf|eot|woff2?/i.test(i)&&(i=i.replace(/.*\//,"")),t?`[${t}]${i}`:i}async function fx(e,t,n){const i=NL(e,t,n.includeQueryParams);if(dy[i]!=null)return dy[i];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{const r=await O3(e,n.fetchRequestInit,({res:l,result:c})=>(t||(t=l.headers.get("Content-Type")||""),EL(c)));s=DL(r,t)}catch(r){s=n.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;r&&(l=typeof r=="string"?r:r.message),l&&console.warn(l)}return dy[i]=s,s}async function TL(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):hp(t)}async function jL(e,t){if(e.currentSrc){const r=document.createElement("canvas"),l=r.getContext("2d");r.width=e.clientWidth,r.height=e.clientHeight,l==null||l.drawImage(e,0,0,r.width,r.height);const c=r.toDataURL();return hp(c)}const n=e.poster,i=hx(n),s=await fx(n,i,t);return hp(s)}async function RL(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await am(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function ML(e,t){return Bn(e,HTMLCanvasElement)?TL(e):Bn(e,HTMLVideoElement)?jL(e,t):Bn(e,HTMLIFrameElement)?RL(e,t):e.cloneNode(k3(e))}const _L=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",k3=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function AL(e,t,n){var i,s;if(k3(t))return t;let r=[];return _L(e)&&e.assignedNodes?r=Ir(e.assignedNodes()):Bn(e,HTMLIFrameElement)&&(!((i=e.contentDocument)===null||i===void 0)&&i.body)?r=Ir(e.contentDocument.body.childNodes):r=Ir(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),r.length===0||Bn(e,HTMLVideoElement)||await r.reduce((l,c)=>l.then(()=>am(c,n)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function zL(e,t,n){const i=t.style;if(!i)return;const s=window.getComputedStyle(e);s.cssText?(i.cssText=s.cssText,i.transformOrigin=s.transformOrigin):v3(n).forEach(r=>{let l=s.getPropertyValue(r);r==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),Bn(e,HTMLIFrameElement)&&r==="display"&&l==="inline"&&(l="block"),r==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),i.setProperty(r,l,s.getPropertyPriority(r))})}function HL(e,t){Bn(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Bn(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function BL(e,t){if(Bn(e,HTMLSelectElement)){const i=Array.from(t.children).find(s=>e.value===s.getAttribute("value"));i&&i.setAttribute("selected","")}}function YL(e,t,n){return Bn(t,Element)&&(zL(e,t,n),OL(e,t,n),HL(e,t),BL(e,t)),t}async function LL(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const i={};for(let r=0;r<n.length;r++){const c=n[r].getAttribute("xlink:href");if(c){const u=e.querySelector(c),f=document.querySelector(c);!u&&f&&!i[c]&&(i[c]=await am(f,t,!0))}}const s=Object.values(i);if(s.length){const r="http://www.w3.org/1999/xhtml",l=document.createElementNS(r,"svg");l.setAttribute("xmlns",r),l.style.position="absolute",l.style.width="0",l.style.height="0",l.style.overflow="hidden",l.style.display="none";const c=document.createElementNS(r,"defs");l.appendChild(c);for(let u=0;u<s.length;u++)c.appendChild(s[u]);e.appendChild(l)}return e}async function am(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(i=>ML(i,t)).then(i=>AL(e,i,t)).then(i=>YL(e,i,t)).then(i=>LL(i,t))}const C3=/url\((['"]?)([^'"]+?)\1\)/g,PL=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,GL=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function QL(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function qL(e){const t=[];return e.replace(C3,(n,i,s)=>(t.push(s),n)),t.filter(n=>!kw(n))}async function WL(e,t,n,i,s){try{const r=n?dL(t,n):t,l=hx(t);let c;return s||(c=await fx(r,l,i)),e.replace(QL(t),`$1${c}$3`)}catch{}return e}function IL(e,{preferredFontFormat:t}){return t?e.replace(GL,n=>{for(;;){const[i,,s]=PL.exec(n)||[];if(!s)return"";if(s===t)return`src: ${i};`}}):e}function E3(e){return e.search(C3)!==-1}async function D3(e,t,n){if(!E3(e))return e;const i=IL(e,n);return qL(i).reduce((r,l)=>r.then(c=>WL(c,l,t,n)),Promise.resolve(i))}async function Kl(e,t,n){var i;const s=(i=t.style)===null||i===void 0?void 0:i.getPropertyValue(e);if(s){const r=await D3(s,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function UL(e,t){await Kl("background",e,t)||await Kl("background-image",e,t),await Kl("mask",e,t)||await Kl("-webkit-mask",e,t)||await Kl("mask-image",e,t)||await Kl("-webkit-mask-image",e,t)}async function ZL(e,t){const n=Bn(e,HTMLImageElement);if(!(n&&!kw(e.src))&&!(Bn(e,SVGImageElement)&&!kw(e.href.baseVal)))return;const i=n?e.src:e.href.baseVal,s=await fx(i,hx(i),t);await new Promise((r,l)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...u)=>{try{r(t.onImageErrorHandler(...u))}catch(f){l(f)}}:l;const c=e;c.decode&&(c.decode=r),c.loading==="lazy"&&(c.loading="eager"),n?(e.srcset="",e.src=s):e.href.baseVal=s})}async function FL(e,t){const i=Ir(e.childNodes).map(s=>N3(s,t));await Promise.all(i).then(()=>e)}async function N3(e,t){Bn(e,Element)&&(await UL(e,t),await ZL(e,t),await FL(e,t))}function VL(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const i=t.style;return i!=null&&Object.keys(i).forEach(s=>{n[s]=i[s]}),e}const KS={};async function JS(e){let t=KS[e];if(t!=null)return t;const i=await(await fetch(e)).text();return t={url:e,cssText:i},KS[e]=t,t}async function tO(e,t){let n=e.cssText;const i=/url\(["']?([^"')]+)["']?\)/g,r=(n.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(i,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),O3(c,t.fetchRequestInit,({result:u})=>(n=n.replace(l,`url(${u})`),[l,u]))});return Promise.all(r).then(()=>n)}function eO(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let i=e.replace(n,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=s.exec(i);if(u===null)break;t.push(u[0])}i=i.replace(s,"");const r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let u=r.exec(i);if(u===null){if(u=c.exec(i),u===null)break;r.lastIndex=c.lastIndex}else c.lastIndex=r.lastIndex;t.push(u[0])}return t}async function XL(e,t){const n=[],i=[];return e.forEach(s=>{if("cssRules"in s)try{Ir(s.cssRules||[]).forEach((r,l)=>{if(r.type===CSSRule.IMPORT_RULE){let c=l+1;const u=r.href,f=JS(u).then(d=>tO(d,t)).then(d=>eO(d).forEach(m=>{try{s.insertRule(m,m.startsWith("@import")?c+=1:s.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:m,error:g})}})).catch(d=>{console.error("Error loading remote css",d.toString())});i.push(f)}})}catch(r){const l=e.find(c=>c.href==null)||document.styleSheets[0];s.href!=null&&i.push(JS(s.href).then(c=>tO(c,t)).then(c=>eO(c).forEach(u=>{l.insertRule(u,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",r)}}),Promise.all(i).then(()=>(e.forEach(s=>{if("cssRules"in s)try{Ir(s.cssRules||[]).forEach(r=>{n.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${s.href}`,r)}}),n))}function KL(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>E3(t.style.getPropertyValue("src")))}async function JL(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=Ir(e.ownerDocument.styleSheets),i=await XL(n,t);return KL(i)}function T3(e){return e.trim().replace(/["']/g,"")}function tP(e){const t=new Set;function n(i){(i.style.fontFamily||getComputedStyle(i).fontFamily).split(",").forEach(r=>{t.add(T3(r))}),Array.from(i.children).forEach(r=>{r instanceof HTMLElement&&n(r)})}return n(e),t}async function eP(e,t){const n=await JL(e,t),i=tP(e);return(await Promise.all(n.filter(r=>i.has(T3(r.style.fontFamily))).map(r=>{const l=r.parentStyleSheet?r.parentStyleSheet.href:null;return D3(r.cssText,l,t)}))).join(`
|
|
156
|
+
`};function Ps(e,t){if(e==="sequence")return t;const n=s=>`${[s.source,s.target].sort().join("~")}|${s.sourceHandle??""}|${s.targetHandle??""}`,i=new Map;for(const s of t){const r=n(s);i.set(r,[...i.get(r)??[],s.id])}return t.map(s=>{var l,c,u;if((c=(l=s.data)==null?void 0:l.points)!=null&&c.length){if(s.type==="routed"&&!s.data.par)return s;const f={...s.data??{label:""}};return delete f.par,{...s,type:"routed",data:f}}const r=i.get(n(s));if(r.length<2){if(s.type!=="parallel"&&!((u=s.data)!=null&&u.par))return s;const f={...s.data??{label:""}};return delete f.par,{...s,type:"routed",data:f}}return{...s,type:"parallel",data:{...s.data??{label:""},par:{i:r.indexOf(s.id),n:r.length,s:s.source<=s.target?1:-1}}}})}function rp(e,t,n){if(n==="sequence"){let l=0;return e.map(c=>{const u=t[c.id],f=(u==null?void 0:u.x)??l*220;return l++,{...c,position:{x:f,y:0}}})}const i=Object.values(t);let s=i.length>0?Math.max(...i.map(l=>l.x))+260:0,r=0;return e.map(l=>{const c=t[l.id];if(!c){const u={x:s,y:r};return r+=110,r>660&&(r=0,s+=260),{...l,position:u}}return{...l,position:{x:c.x,y:c.y},...c.w!==void 0&&c.h!==void 0?{style:{...l.style,width:c.w,height:c.h},width:c.w,height:c.h}:{}}})}let QS;function na(e){if(oh)return;const{activeId:t}=Ut.getState();t&&(Pa(t,e),yY())}function EY(){let e=null;try{e=new URLSearchParams(location.search).get("code")}catch{}const{state:t,code:n}=mY(lh);return Ut.setState(t),e?(na(e),e):n}function DY(e,t,n){const i=Fr(e),s=Fr(t),r=u=>{const f=i.get(u),d=s.get(u);return f&&d?{x:d.x-f.x,y:d.y-f.y}:{x:0,y:0}};let l=!1;const c=n.map(u=>{var m;const f=(m=u.data)==null?void 0:m.points;if(!f||f.length===0)return u;const d=OY(f,r(u.source),r(u.target));return d===f?u:(l=!0,{...u,data:{...u.data??{label:""},points:d}})});return l?c:n}const ct=Ln((e,t)=>{let n=[],i=[],s=0;const r=()=>e({canUndo:n.length>0,canRedo:i.length>0}),l=new Map,c=k=>{!k||n[n.length-1]===k||(n.push(k),n.length>100&&n.shift(),i.length=0,r())};let u=null;const f=()=>{var O,E,T,j,N,_;const k={};for(const M of t().nodes)k[M.id]={x:M.position.x,y:M.position.y,...xe(M)?{w:Number(((O=M.style)==null?void 0:O.width)??((E=M.measured)==null?void 0:E.width)??320),h:Number(((T=M.style)==null?void 0:T.height)??((j=M.measured)==null?void 0:j.height)??220)}:e3(M)?{w:Number((N=M.style)==null?void 0:N.width),h:Number((_=M.style)==null?void 0:_.height)}:{}};return k},d=()=>{var E;const k=ay(t().edges),O={};for(const T of t().edges){const j=(E=T.data)==null?void 0:E.points;j!=null&&j.length&&(O[k.get(T.id)]=j)}return O},m=()=>{const k=t().nodes.map(O=>O.data.icon).filter(O=>typeof O=="string");return Y7(t().iconLibrary,k)},g=()=>{const k={};for(const O of t().nodes){const E=O.data.style;tx(E)||(k[O.id]=E)}return k},y=()=>{var E;const k=ay(t().edges),O={};for(const T of t().edges){const j=(E=T.data)==null?void 0:E.style;rm(j)||(O[k.get(T.id)]=j)}return O},$=(k,O,E=!0)=>{var N;const T=t().edges.find(_=>_.id===k);if(!T)return;const j=O(((N=T.data)==null?void 0:N.points)??[]);e({edges:Ps(t().kind,t().edges.map(_=>_.id===k?{..._,data:{..._.data??{label:""},...j.length>0?{points:j}:{points:void 0}}}:_))}),E&&S()},v=()=>{if(t().unsupported)return;c(t().code);const{kind:k,nodes:O,edges:E,direction:T,classDefs:j,c4Flavor:N,title:_,accTitle:M,accDescr:q,seqItems:G}=t(),I=z6({kind:k,direction:T,nodes:O,edges:E,classDefs:j,c4Flavor:N,title:_,accTitle:M,accDescr:q,items:G,positions:f()}),Z=xS(RS(jS(TS(I,d()),y()),g()),m());e({code:Z,parseError:null}),na(Z)},S=()=>{c(t().code);const k=xS(RS(jS(TS(M6(t().code,f()),d()),y()),g()),m());e({code:k}),na(k)},C=k=>{let O=0;const E=new RegExp(`^${k}(\\d+)$`);for(const T of t().nodes){const j=T.id.match(E);j&&(O=Math.max(O,Number(j[1])))}return`${k}${O+1}`};return{code:"",kind:"flowchart",nodes:[],edges:[],direction:"TD",classDefs:{},parseError:null,warning:null,unsupported:null,canUndo:!1,canRedo:!1,booted:!1,c4Flavor:"C4Context",title:"",accTitle:"",accDescr:"",seqItems:[],setCodeFromEditor:k=>{const O=Date.now();O-s>900&&c(t().code),s=O,e({code:k}),na(k),clearTimeout(QS),QS=setTimeout(()=>void t().applyCode(k),400)},applyCode:async(k,O)=>{O!=null&&O.record&&c(t().code);try{const E=await QE(k);let T=O!=null&&O.forceLayout?null:BE(k),j=rp(E.nodes,T??{},E.kind);!T&&E.kind!=="sequence"&&(T=await pw(j,E.edges,E.direction),j=rp(E.nodes,T,E.kind));const N=new Set(t().nodes.filter(z=>z.selected).map(z=>z.id));N.size>0&&(j=j.map(z=>N.has(z.id)?{...z,selected:!0}:z));const _={...mu.getState().icons,...z7(k)??{}};sy(_);const M=V6(k);M&&(j=j.map(z=>M[z.id]?{...z,data:{...z.data,style:M[z.id]}}:z));const q=L6(k),G=W6(k),I=ay(E.edges),Z=q||G?E.edges.map(z=>{const B=I.get(z.id),H=q==null?void 0:q[B],L=G==null?void 0:G[B];return!H&&!L?z:{...z,data:{...z.data??{label:""},...H?{points:H}:{},...L?{style:L}:{}}}}):E.edges;e({iconLibrary:_,kind:E.kind,nodes:j,edges:Ps(E.kind,Z),direction:E.direction,classDefs:E.classDefs,warning:E.warning??null,c4Flavor:E.c4Flavor??"C4Context",title:E.title??"",accTitle:E.accTitle??"",accDescr:E.accDescr??"",seqItems:E.items??[],parseError:null,unsupported:null,code:k}),na(k)}catch(E){E instanceof GE?(e({unsupported:E.diagramType,nodes:[],edges:[],seqItems:[],parseError:null,warning:null,code:k}),na(k)):e({parseError:E instanceof Error?E.message:String(E),code:k})}finally{t().booted||e({booted:!0})}},onNodesChange:k=>{if(t().kind==="sequence")for(const T of k)T.type==="position"&&T.position&&(T.position.y=0);const O=new Set(k.filter(T=>T.type==="remove").map(T=>T.id));let E=qC(k,t().nodes);if(O.size>0){E=E.map(N=>N.parentId&&O.has(N.parentId)?{...N,parentId:void 0,extent:void 0}:N);const T=new Set(E.map(N=>N.id)),j=Ps(t().kind,t().edges.filter(N=>T.has(N.source)&&T.has(N.target)));e({nodes:E,edges:j}),v()}else{const T=k.some(j=>j.type==="position"&&j.position);e({nodes:E,...T?{edges:DY(t().nodes,E,t().edges)}:{}})}},onEdgesChange:k=>{const O=k.some(j=>j.type==="remove");let E=WC(k,t().edges);O&&(E=Ps(t().kind,E));const T=new Set(E.map(j=>j.id));e({edges:E,...O?{seqItems:t().seqItems.filter(j=>j.kind!=="message"||T.has(j.edgeId))}:{}}),O&&v()},onConnect:k=>{if(!k.source||!k.target)return;const O=t().kind;if(O==="architecture"&&t().edges.some(N=>N.source===k.source&&N.target===k.target)){e({warning:`mermaid's architecture renderer allows only one connection from ${k.source} to ${k.target} — edit the existing edge instead.`});return}const E=k.source===k.target&&(O==="c4"||O==="architecture")?`mermaid's ${O==="c4"?"C4":"architecture"} renderer draws a connection from ${k.source} to itself as a stub at the corner of the node rather than as a loop — the file is valid, and Archyne draws the loop.`:null,T=B6(O);O==="architecture"&&T.arch&&(T.arch.lhsDir=k.sourceHandle||"R",T.arch.rhsDir=k.targetHandle||"L");const j=ou(O,{id:`e${t().edges.length}_${k.source}_${k.target}_${Date.now()}`,source:k.source,target:k.target,...O==="architecture"?{sourceHandle:T.arch.lhsDir,targetHandle:T.arch.rhsDir}:{},data:T});e({edges:Ps(O,[...t().edges,j]),...O==="sequence"?{seqItems:[...t().seqItems,{kind:"message",edgeId:j.id}]}:{},...E?{warning:E}:{}}),v()},onNodeDragStop:k=>{var T,j,N,_,M,q,G;const{kind:O,nodes:E}=t();if(k&&O!=="sequence"){const I=new Map(E.map(B=>[B.id,B])),Z=B=>{let H=B.position.x,L=B.position.y,F=B.parentId;for(;F;){const Q=I.get(F);if(!Q)break;H+=Q.position.x,L+=Q.position.y,F=Q.parentId}return{x:H,y:L}},z=I.get(k.id);if(z&&!xe(z)){const B=Qo(z),H=((T=z.measured)==null?void 0:T.width)??B.width,L=((j=z.measured)==null?void 0:j.height)??B.height,F={...Z(z)},Q=F.x+H/2,tt=F.y+L/2;let R,P=-1;for(const K of E){if(!xe(K))continue;const it=Z(K),ht=Number(((N=K.style)==null?void 0:N.width)??((_=K.measured)==null?void 0:_.width)??320),pt=Number(((M=K.style)==null?void 0:M.height)??((q=K.measured)==null?void 0:q.height)??220);if(Q>=it.x&&Q<=it.x+ht&&tt>=it.y&&tt<=it.y+pt){let mt=0,U=K.parentId;for(;U;)mt++,U=(G=I.get(U))==null?void 0:G.parentId;mt>P&&(P=mt,R=K)}}if(((R==null?void 0:R.id)??void 0)!==z.parentId){const K=R?Z(R):{x:0,y:0},it={...z,parentId:R==null?void 0:R.id,extent:void 0,position:{x:F.x-K.x,y:F.y-K.y}};e({nodes:[...E.filter(ht=>ht.id!==z.id),it]}),v();return}}}S()},setNodeSize:(k,O,E,T,j)=>{e({nodes:t().nodes.map(N=>N.id===k?{...N,position:{x:T,y:j},style:{...N.style,width:O,height:E},width:O,height:E}:N)})},resizeNode:(k,O,E)=>{const T=t().nodes.find(N=>N.id===k);if(!T)return;const j=t3(T);t().setNodeSize(k,Math.max(j.width,Math.round(O)),Math.max(j.height,Math.round(E)),T.position.x,T.position.y),S()},resetNodeSize:k=>{const O=t().nodes.find(E=>E.id===k);!O||xe(O)||(e({nodes:t().nodes.map(E=>E.id===k?{...E,style:{...E.style,width:void 0,height:void 0},width:void 0,height:void 0,measured:void 0}:E)}),S())},addWaypoint:(k,O,E,T=!0)=>{$(k,j=>[...j.slice(0,O),{x:Math.round(E.x),y:Math.round(E.y)},...j.slice(O)],T)},moveWaypoint:(k,O,E,T=!0)=>{$(k,j=>j.map((N,_)=>_===O?{x:Math.round(E.x),y:Math.round(E.y)}:N),T)},setWaypoints:(k,O,E=!0)=>{$(k,()=>O.map(T=>({x:Math.round(T.x),y:Math.round(T.y)})),E)},iconLibrary:{},addCustomIcons:k=>{const O=mu.getState().add(k),E=mu.getState().icons,T={...t().iconLibrary};for(const j of O){const N=j.slice(as.length+1);E[N]&&(T[N]=E[N])}return e({iconLibrary:T}),sy(T),O},addCustomIcon:(k,O)=>{const E=sm(O);if(!E)return null;const T=tl(k),j={...t().iconLibrary,[T]:E};return e({iconLibrary:j}),sy(j),`${as}:${T}`},setNodeStyle:(k,O)=>{e({nodes:t().nodes.map(E=>E.id===k?{...E,data:{...E.data,style:{...E.data.style,...O}}}:E)}),S()},setEdgeStyle:(k,O,E=!0)=>{e({edges:t().edges.map(T=>{var j;return T.id===k?{...T,data:{...T.data??{label:""},style:{...((j=T.data)==null?void 0:j.style)??{},...O}}}:T})}),E&&S()},commitWaypoints:()=>S(),removeWaypoint:(k,O)=>{$(k,E=>E.filter((T,j)=>j!==O))},appendWaypoint:k=>{var q;const O=t().edges.find(G=>G.id===k);if(!O)return;const E=Fr(t().nodes),T=G=>{const I=E.get(G);return I?{x:I.x+I.w/2,y:I.y+I.h/2}:null},j=T(O.source),N=T(O.target);if(!j||!N)return;const _=((q=O.data)==null?void 0:q.points)??[],M=_[_.length-1]??j;t().addWaypoint(k,_.length,{x:(M.x+N.x)/2,y:(M.y+N.y)/2})},clearWaypoints:k=>{$(k,()=>[])},addNode:(k,O)=>{var j,N;const{direction:E}=t();if(k.type==="seqnote"||k.type==="seqblock"){if(t().kind!=="sequence")return;const _=[...t().seqItems],M=Math.max(0,Math.min(_.length,Math.round((O.y-Ta)/qo)));if(k.type==="seqnote"){let q="",G=1/0;for(const I of t().nodes){if(I.type!=="participant")continue;const Z=((j=I.measured)==null?void 0:j.width)??Qo(I).width,z=Math.abs(I.position.x+Z/2-O.x);z<G&&(G=z,q=I.id)}if(!q)return;_.splice(M,0,{kind:"note",placement:"over",a:q,text:"Note"})}else{const q=((N=_[M])==null?void 0:N.kind)==="message"?M+1:M;_.splice(q,0,{kind:"end"}),k.op==="alt"&&_.splice(q,0,{kind:"divider",op:"else",label:""}),_.splice(M,0,{kind:"block",op:k.op,label:"condition"})}e({seqItems:_}),v();return}let T;switch(k.type){case"shape":T={id:C("n"),type:"shape",position:O,data:{label:"New node",shape:k.shape,direction:E}};break;case"state":{const _=k.stateType==="normal"?"s":k.stateType;T={id:C(_),type:"state",position:O,data:{label:k.stateType==="normal"?"NewState":"",stateType:k.stateType,direction:E}};break}case"entity":T={id:C("ENTITY"),type:"entity",position:O,data:{label:C("ENTITY"),attributes:[{type:"string",name:"id",keys:["PK"],comment:""}],direction:E}};break;case"class":T={id:C("Class"),type:"class",position:O,data:{label:C("Class"),members:[],methods:[],annotations:[],direction:E}};break;case"participant":{const _=C(k.ptype==="actor"?"actor":"p");T={id:_,type:"participant",position:{x:O.x,y:0},data:{label:_,ptype:k.ptype,direction:E}};break}case"service":{const _=C("svc");Mi.getState().recordRecent(k.icon),T={id:_,type:"service",position:O,data:{label:_,icon:k.icon,direction:E}};break}case"junction":T={id:C("j"),type:"junction",position:O,data:{}};break;case"c4":{const _=C("el");T={id:_,type:"c4",position:O,data:{label:_,c4Shape:k.c4Shape,descr:"",direction:E}};break}case"note":T={id:C("note"),type:"note",position:O,data:{text:"Note",direction:E}};break;case"group":{const _=t().kind,M=C("g");T={id:M,type:"group",position:O,data:{label:M,subgraphId:M,..._==="architecture"?{icon:k.icon??"cloud"}:{},..._==="c4"?{boundaryType:"SYSTEM"}:{}},style:{width:340,height:240}};break}}(k.type==="entity"||k.type==="class")&&(T={...T,data:{...T.data,label:T.id}}),T.selected=!0,e({nodes:[...t().nodes.map(_=>({..._,selected:!1})),T]}),v()},updateNodeData:(k,O)=>{e({nodes:t().nodes.map(E=>E.id===k?{...E,data:{...E.data,...O}}:E)}),v()},updateEdgeData:(k,O)=>{const E=t().kind,T=t().edges.map(j=>{if(j.id!==k||!j.data)return j;const N={...j.data,...O,...O.er?{er:{...j.data.er,...O.er}}:{},...O.cls?{cls:{...j.data.cls,...O.cls}}:{},...O.arch?{arch:{...j.data.arch,...O.arch}}:{}},_={...j,data:N};return N.arch&&(_.sourceHandle=N.arch.lhsDir,_.targetHandle=N.arch.rhsDir),ou(E,_)});e({edges:Ps(E,T)}),v()},setDiagramMeta:k=>{e(k),v()},setDirection:k=>{e({direction:k,nodes:t().nodes.map(O=>xe(O)?O:{...O,data:{...O.data,direction:k}})}),v()},runAutoLayout:async()=>{const{nodes:k,edges:O,direction:E,kind:T}=t();if(T==="sequence"){e({nodes:k.map((N,_)=>({...N,position:{x:_*220,y:0}}))}),S();return}const j=await pw(k,O,E);e({nodes:k.map(N=>{const _=j[N.id];return _?{...N,position:{x:_.x,y:_.y},...xe(N)&&_.w!==void 0?{style:{...N.style,width:_.w,height:_.h}}:{}}:N})}),S()},swapHistory:(k,O)=>{k&&l.set(k,{past:n,future:i});const E=l.get(O)??{past:[],future:[]};n=E.past,i=E.future,r()},newDiagram:k=>{t().applyCode(n3[k],{forceLayout:!0,record:!0})},undo:async()=>{if(n.length===0)return;i.push(t().code);const k=n.pop();r(),await t().applyCode(k)},redo:async()=>{if(i.length===0)return;n.push(t().code);const k=i.pop();r(),await t().applyCode(k)},copySelection:()=>{const k=t().nodes.filter(T=>T.selected&&!xe(T));if(k.length===0)return;const O=new Set(k.map(T=>T.id)),E=t().edges.filter(T=>O.has(T.source)&&O.has(T.target));u={nodes:structuredClone(k),edges:structuredClone(E)}},pasteClipboard:()=>{if(!u||u.nodes.length===0)return;const{kind:k}=t(),O=new Set(t().nodes.map(_=>_.id)),E=new Map,T=_=>{let M=2,q=`${_}_${M}`;for(;O.has(q);)q=`${_}_${++M}`;return O.add(q),q},j=u.nodes.map(_=>{const M=T(_.id);return E.set(_.id,M),{...structuredClone(_),id:M,parentId:void 0,extent:void 0,selected:!0,position:{x:_.position.x+36,y:k==="sequence"?0:_.position.y+36}}}),N=u.edges.map((_,M)=>ou(k,{...structuredClone(_),id:`e${Date.now()}_${M}`,source:E.get(_.source),target:E.get(_.target)}));e({nodes:[...t().nodes.map(_=>({..._,selected:!1})),...j],edges:Ps(k,[...t().edges,...N])}),v()},groupSelection:()=>{const{kind:k,nodes:O}=t();if(k!=="flowchart"&&k!=="state"&&k!=="architecture"&&k!=="c4"&&k!=="class")return;const E=O.filter(R=>R.selected),T=new Map(O.map(R=>[R.id,R])),j=(R,P)=>{var K;for(let it=R.parentId;it;it=(K=T.get(it))==null?void 0:K.parentId)if(it===P)return!0;return!1},N=E.filter(R=>!E.some(P=>P.id!==R.id&&j(R,P.id)));if(N.length===0)return;const _=N[0].parentId;if(!N.every(R=>R.parentId===_))return;const M=28,q=34,G=N.map(R=>{var pt,mt,U,ft;const P=Qo(R),K=$t=>{const Ct=Number($t);return Number.isFinite(Ct)?Ct:null},it=((pt=R.measured)==null?void 0:pt.width)??K((mt=R.style)==null?void 0:mt.width)??P.width,ht=((U=R.measured)==null?void 0:U.height)??K((ft=R.style)==null?void 0:ft.height)??P.height;return{x1:R.position.x,y1:R.position.y,x2:R.position.x+it,y2:R.position.y+ht}}),I=Math.min(...G.map(R=>R.x1))-M,Z=Math.min(...G.map(R=>R.y1))-M-q,z=Math.max(...G.map(R=>R.x2))+M,B=Math.max(...G.map(R=>R.y2))+M,H=C("g"),L={id:H,type:"group",position:{x:I,y:Z},data:{label:H,subgraphId:H,...k==="architecture"?{icon:"cloud"}:{},...k==="c4"?{boundaryType:"SYSTEM"}:{}},style:{width:z-I,height:B-Z},..._?{parentId:_}:{}},F=new Set(N.map(R=>R.id)),Q=O.map(R=>F.has(R.id)?{...R,parentId:H,position:{x:R.position.x-I,y:R.position.y-Z},selected:!1}:R),tt=Q.findIndex(R=>F.has(R.id));Q.splice(tt,0,{...L,selected:!0}),e({nodes:Q}),v()},updateSeqItem:(k,O)=>{const E=[...t().seqItems];E[k]&&(E[k]=O,e({seqItems:E}),v())},removeSeqItem:k=>{e({seqItems:b6(t().seqItems,k)}),v()},selectOnly:(k,O)=>{e({nodes:t().nodes.map(E=>({...E,selected:O==="node"&&E.id===k})),edges:t().edges.map(E=>({...E,selected:O==="edge"&&E.id===k}))})},selectAll:()=>{e({nodes:t().nodes.map(k=>({...k,selected:!0})),edges:t().edges.map(k=>({...k,selected:!0}))})},nudgeSelection:(k,O)=>{const E=t().nodes;E.some(T=>T.selected)&&(e({nodes:E.map(T=>T.selected?{...T,position:{x:T.position.x+k,y:T.position.y+O}}:T)}),S())},alignSelection:k=>{const O=sp(t().nodes);if(O.length===0)return;const E=O.map(yw),T=Math.min(...E.map(q=>q.x)),j=Math.max(...E.map(q=>q.x+q.w)),N=Math.min(...E.map(q=>q.y)),_=Math.max(...E.map(q=>q.y+q.h)),M=new Map;O.forEach((q,G)=>{const I=E[G],Z={x:I.x,y:I.y};k==="left"?Z.x=T:k==="right"?Z.x=j-I.w:k==="centerX"?Z.x=(T+j)/2-I.w/2:k==="top"?Z.y=N:k==="bottom"?Z.y=_-I.h:k==="middleY"&&(Z.y=(N+_)/2-I.h/2),M.set(q.id,{x:Math.round(Z.x),y:Math.round(Z.y)})}),e({nodes:t().nodes.map(q=>{const G=M.get(q.id);return G?{...q,position:G}:q})}),S()},distributeSelection:k=>{const O=sp(t().nodes);if(O.length<3)return;const E=O.map(I=>({n:I,b:yw(I)})).sort((I,Z)=>k==="x"?I.b.x-Z.b.x:I.b.y-Z.b.y),T=E[0].b,j=E[E.length-1].b,N=k==="x"?j.x+j.w-T.x:j.y+j.h-T.y,_=E.reduce((I,{b:Z})=>I+(k==="x"?Z.w:Z.h),0),M=(N-_)/(E.length-1),q=new Map;let G=k==="x"?T.x:T.y;for(const{n:I,b:Z}of E)q.set(I.id,{x:k==="x"?Math.round(G):Z.x,y:k==="y"?Math.round(G):Z.y}),G+=(k==="x"?Z.w:Z.h)+M;e({nodes:t().nodes.map(I=>{const Z=q.get(I.id);return Z?{...I,position:Z}:I})}),S()},refreshEdges:()=>{e({edges:Ps(t().kind,t().edges.map(k=>ou(t().kind,k)))})},deleteSelection:()=>{const k=t().nodes.filter(E=>E.selected).map(E=>({type:"remove",id:E.id})),O=t().edges.filter(E=>E.selected).map(E=>({type:"remove",id:E.id}));O.length&&t().onEdgesChange(O),k.length&&t().onNodesChange(k)},deleteElement:(k,O)=>{O==="node"?t().onNodesChange([{type:"remove",id:k}]):t().onEdgesChange([{type:"remove",id:k}])},duplicateNode:k=>{const{nodes:O,kind:E}=t(),T=O.find(q=>q.id===k);if(!T||xe(T))return;const j=new Set(O.map(q=>q.id));let N=2,_=`${k}_${N}`;for(;j.has(_);)_=`${k}_${++N}`;const M={...structuredClone(T),id:_,selected:!0,position:{x:T.position.x+36,y:E==="sequence"?0:T.position.y+36}};e({nodes:[...O.map(q=>({...q,selected:!1})),M]}),v()},removeFromGroup:k=>{const{nodes:O}=t(),E=O.find(M=>M.id===k);if(!(E!=null&&E.parentId))return;const T=new Map(O.map(M=>[M.id,M]));let j=E.position.x,N=E.position.y,_=E.parentId;for(;_;){const M=T.get(_);if(!M)break;j+=M.position.x,N+=M.position.y,_=M.parentId}e({nodes:O.map(M=>M.id===k?{...M,parentId:void 0,extent:void 0,position:{x:j,y:N}}:M)}),v()},moveMessage:(k,O)=>{const E=t().seqItems.findIndex(T=>T.kind==="message"&&T.edgeId===k);E<0||t().moveMessageTo(k,E+O)},moveMessageTo:(k,O)=>{const E=[...t().seqItems],T=E.findIndex(_=>_.kind==="message"&&_.edgeId===k);if(T<0)return;const j=Math.max(0,Math.min(E.length-1,O));if(j===T)return;const[N]=E.splice(T,1);E.splice(j,0,N),e({seqItems:E}),v()},ungroupSelection:()=>{const{nodes:k,edges:O}=t(),E=k.find(j=>j.selected&&xe(j));if(!E)return;const T=k.filter(j=>j.id!==E.id).map(j=>j.parentId===E.id?{...j,parentId:E.parentId,extent:E.parentId?"parent":void 0,position:{x:j.position.x+E.position.x,y:j.position.y+E.position.y}}:j);e({nodes:T,edges:O.filter(j=>j.source!==E.id&&j.target!==E.id)}),v()}}}),i3="graph:prefs",ww=12.5,s3=9,r3=32;function NY(){try{const e=localStorage.getItem(i3);return e?JSON.parse(e):{}}catch{return{}}}function hy(e){if(!Number.isFinite(e))return ww;const t=Math.round(e*2)/2;return Math.min(Math.max(t,s3),r3)}const fy=NY(),Hn=Ln((e,t)=>{const n=()=>{const{singleKeyShortcuts:i,editorFontSize:s,metaFolded:r}=t();try{localStorage.setItem(i3,JSON.stringify({singleKeyShortcuts:i,editorFontSize:s,metaFolded:r}))}catch{}};return{singleKeyShortcuts:fy.singleKeyShortcuts!==!1,editorFontSize:hy(fy.editorFontSize??ww),metaFolded:fy.metaFolded!==!1,setSingleKeyShortcuts:i=>{e({singleKeyShortcuts:i}),n()},setMetaFolded:i=>{t().metaFolded!==i&&(e({metaFolded:i}),n())},setEditorFontSize:i=>{e({editorFontSize:hy(i)}),n()},nudgeEditorFontSize:i=>{e({editorFontSize:hy(t().editorFontSize+i)}),n()},resetEditorFontSize:()=>{e({editorFontSize:ww}),n()}}});function o3(){return Hn.getState().singleKeyShortcuts}function l3(e){const[t,n]=Y.useState(()=>{try{return window.matchMedia(e).matches}catch{return!1}});return Y.useEffect(()=>{let i;try{i=window.matchMedia(e)}catch{return}const s=()=>n(i.matches);return s(),i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[e]),t}function TY(){return l3("(max-width: 640px), (max-height: 420px)")}function jY(){return l3("(pointer: coarse)")}const xw="graph:layout",$w=260,RY=520;function a3(e,t=window.innerWidth){const n=Math.max(t-RY,$w);return Math.round(Math.min(Math.max(e,$w),n))}function MY(){try{const e=localStorage.getItem(xw);if(!e)return null;const t=JSON.parse(e).sideWidth;return typeof t=="number"&&Number.isFinite(t)?t:null}catch{return null}}function qS(e){try{e===null?localStorage.removeItem(xw):localStorage.setItem(xw,JSON.stringify({sideWidth:e}))}catch{}}const es=Ln(e=>({paletteOpen:!1,sideOpen:!1,sideWidth:MY(),togglePalette:()=>e(t=>({paletteOpen:!t.paletteOpen,sideOpen:!1})),toggleSide:()=>e(t=>({sideOpen:!t.sideOpen,paletteOpen:!1})),closeDrawers:()=>e({paletteOpen:!1,sideOpen:!1}),setSideWidth:t=>{const n=a3(t);e({sideWidth:n}),qS(n)},resetSideWidth:()=>{e({sideWidth:null}),qS(null)}}));function ma(){return globalThis.archyne??null}function Ru(){return ma()}function bw(){return typeof globalThis.showSaveFilePicker=="function"}const vw=[{description:"Mermaid diagram",accept:{"text/plain":[".mmd",".mermaid",".txt"]}}],_Y=[{description:"Diagram",accept:{"text/plain":[".mmd",".mermaid",".txt",".dot",".gv",".sql",".ddl",".excalidraw",".puml",".plantuml",".iuml",".wsd"],"application/xml":[".drawio",".xml"],"application/vnd.ms-visio.drawing":[".vsdx"]}}];function AY(e){return e[0]===80&&e[1]===75&&e[2]===3&&e[3]===4}async function c3(e){const t=new Uint8Array(await e.arrayBuffer());return AY(t)?{content:"",bytes:t}:{content:new TextDecoder().decode(t)}}function u3(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}async function zY(e="open"){const t=ma();if(t){const n=await t.showOpen(e);return n?{name:Sw(n.path),content:n.content,path:n.path,handle:null,...n.base64?{bytes:u3(n.base64)}:{}}:null}if(bw()){let n;try{[n]=await globalThis.showOpenFilePicker({types:e==="import"?_Y:vw})}catch{return null}const i=await c3(await n.getFile());return{name:n.name,path:null,handle:n,...i}}throw new Error("no-picker")}function Sw(e){return e.split(/[\\/]/).pop()||e}function HY(e,t){const n=new Blob([t],{type:"text/plain"}),i=document.createElement("a");i.href=URL.createObjectURL(n),i.download=e,i.click(),URL.revokeObjectURL(i.href)}async function WS(e,t){const n=await e.createWritable();await n.write(t),await n.close()}const Be=Ln((e,t)=>({name:null,path:null,handle:null,savedCode:null,adopt:async n=>{await ct.getState().applyCode(n.content,{record:!0}),e({name:Sw(n.path),path:n.path,handle:null,savedCode:n.content})},open:async()=>{const n=ma();if(n){const i=await n.showOpen();i&&await t().adopt(i);return}if(bw()){let i;try{[i]=await globalThis.showOpenFilePicker({types:vw})}catch{return}const s=await(await i.getFile()).text();await ct.getState().applyCode(s,{record:!0}),e({name:i.name,path:null,handle:i,savedCode:s});return}throw new Error("no-picker")},save:async()=>{const{path:n,handle:i}=t(),s=ct.getState().code,r=ma();if(r&&n){await r.writeFile(n,s),e({savedCode:s});return}if(i){await WS(i,s),e({savedCode:s});return}await t().saveAs()},saveAs:async()=>{const n=ct.getState().code,i=t().name??"diagram.mmd",s=ma();if(s){const r=await s.showSave(i,n);r&&e({name:Sw(r),path:r,handle:null,savedCode:n});return}if(bw()){let r;try{r=await globalThis.showSaveFilePicker({suggestedName:i,types:vw})}catch{return}await WS(r,n),e({name:r.name,path:null,handle:r,savedCode:n});return}HY(i,n),e({savedCode:n})}}));function BY(e){const t=ma();t&&(t.openedFile().then(n=>{n&&e(n)}),t.onOpenFile(e))}function YY(e){const t=e.slice(0,4096).replace(/^\s*(?:<\?xml[^>]*\?>|<!--[\s\S]*?-->|\s)*/,"");return/^<\s*(mxfile|mxGraphModel)[\s>]/.test(t)}function LY(e){const t=e.slice(0,4096).replace(/^(?:\s|\/\/[^\n]*\n?|#[^\n]*\n?|\/\*[\s\S]*?\*\/)*/,"");return/^(strict\s+)?(di)?graph\b[^\n{]*\{/.test(t)}function PY(e){return/\bCREATE\s+(?:\w+\s+)*TABLE\b/i.test(e.slice(0,65536))}function GY(e){const t=e.slice(0,4096);return/^\s*\{/.test(t)&&/"type"\s*:\s*"excalidraw/.test(t)}function QY(e){return/^\s*@start\w+/m.test(e.slice(0,4096))}async function om(e,t){const n=e.bytes?await qY(e.bytes):await WY(e.content,t);if(!n)return{file:e,imported:null,source:e};const i=/\.(drawio\.xml|drawio|xml|vsdx|gv|dot|sql|ddl|excalidraw|puml|plantuml|iuml|wsd)$/i;return{file:{name:`${e.name.replace(i,"")}.mmd`,content:n.code,path:null,handle:null},imported:n.summary,source:e}}async function qY(e){const{vsdxToMermaid:t}=await ee(async()=>{const{vsdxToMermaid:i}=await import("./fromVsdx-_QnAzQCc.js");return{vsdxToMermaid:i}},__vite__mapDeps([3,4,5]),import.meta.url),n=t(e);return{code:n.code,summary:{format:"vsdx",choices:["flowchart"],nodes:n.nodes,edges:n.edges,pages:n.pages,dropped:n.dropped}}}async function WY(e,t){if(YY(e)){const{drawioToMermaid:n}=await ee(async()=>{const{drawioToMermaid:s}=await import("./fromDrawio-DEgkUjY8.js");return{drawioToMermaid:s}},__vite__mapDeps([6,4,5]),import.meta.url),i=n(e,t==="architecture"||t==="flowchart"?t:void 0);return{code:i.code,summary:{format:"drawio",choices:["flowchart","architecture"],nodes:i.nodes,edges:i.edges,pages:i.pages,dropped:i.dropped,...i.looksLike?{looksLike:i.looksLike}:{}}}}if(LY(e)){const{dotToMermaid:n}=await ee(async()=>{const{dotToMermaid:s}=await import("./fromDot-CQsAmWbW.js");return{dotToMermaid:s}},__vite__mapDeps([7,5]),import.meta.url),i=n(e,t==="class"||t==="flowchart"?t:void 0);return{code:i.code,summary:{format:"dot",choices:["flowchart","class"],nodes:i.nodes,edges:i.edges,pages:[],dropped:i.dropped}}}if(GY(e)){const{excalidrawToMermaid:n}=await ee(async()=>{const{excalidrawToMermaid:s}=await import("./fromExcalidraw-BzgOaI_g.js");return{excalidrawToMermaid:s}},__vite__mapDeps([8,5]),import.meta.url),i=n(e);return{code:i.code,summary:{format:"excalidraw",choices:["flowchart"],nodes:i.nodes,edges:i.edges,pages:[],dropped:i.dropped}}}if(QY(e)){const{plantumlFamily:n,plantumlToMermaid:i}=await ee(async()=>{const{plantumlFamily:l,plantumlToMermaid:c}=await import("./fromPlantuml-BXgnqEO6.js");return{plantumlFamily:l,plantumlToMermaid:c}},__vite__mapDeps([9,5]),import.meta.url),s=t==="class"||t==="state"||t==="sequence"?t:n(e),r=s==="sequence"?i(e):await(async()=>{const l=await ee(()=>import("./plantumlFamilies-BQWcuhsm.js"),__vite__mapDeps([10,5]),import.meta.url);return s==="class"?l.plantumlClassToMermaid(e):l.plantumlStateToMermaid(e)})();return{code:r.code,summary:{format:"plantuml",choices:["sequence","class","state"],nodes:r.nodes,edges:r.edges,pages:[],dropped:r.dropped}}}if(PY(e)){const{sqlToMermaid:n}=await ee(async()=>{const{sqlToMermaid:s}=await import("./fromSql-CgaUND0o.js");return{sqlToMermaid:s}},__vite__mapDeps([11,5]),import.meta.url),i=n(e);return{code:i.code,summary:{format:"sql",choices:["er"],nodes:i.nodes,edges:i.edges,pages:[],dropped:i.dropped}}}return null}const op={"app.name":"Archyne","app.tagline":"visual diagram editor","app.loading":"loading diagram engine…","kind.flowchart":"Flowchart","kind.state":"State diagram","kind.er":"ER diagram","kind.class":"Class diagram","kind.sequence":"Sequence diagram","kind.architecture":"Architecture","kind.c4":"C4 model","toolbar.about":"About Archyne and licenses","toolbar.aboutTitle":"About & licenses","toolbar.shapesDrawer":"Shapes","toolbar.codeDrawer":"Code","toolbar.direction":"Direction","toolbar.dirTB":"Top → Down","toolbar.dirLR":"Left → Right","toolbar.dirBT":"Bottom → Up","toolbar.dirRL":"Right → Left","toolbar.undo":"Undo","toolbar.undoHint":"Undo (Ctrl+Z)","toolbar.redo":"Redo","toolbar.redoHint":"Redo (Ctrl+Y)","toolbar.autoLayout":"Auto-layout","toolbar.new":"New…","toolbar.newDiagram":"New diagram","toolbar.open":"Open","toolbar.import":"Import…","import.title":"Import from {source}","import.becomes":"Becomes a {kind}","import.readAs":"Read as","import.view":"How to look at it","import.view.canvas":"Canvas","import.view.mermaid":"Mermaid render","import.view.source":"Mermaid code","import.rendering":"Drawing the preview…","import.mermaidLayout":"Mermaid arranges diagrams itself and ignores the positions this file carries — this is how it renders elsewhere, not how it will look on the canvas.","import.noCanvas":"A sequence diagram is laid out from the order of its messages, which this preview cannot do — see the Mermaid render.","import.counts":"{nodes} elements, {edges} connections","import.onePage":"Only the first page, “{page}”, of {count} is converted","import.looksLike":"This looks like a {family} diagram; it converts as a flowchart","import.dropped":"Some elements had no Mermaid equivalent and were left out ({count})","import.unbound":"Arrives as {name}, unsaved. The file you chose is not touched.","import.cancel":"Cancel","import.confirm":"Import","import.previewAlt":"Preview of the converted diagram","import.zoom":"Zoom","import.zoomIn":"Zoom in","import.zoomOut":"Zoom out","import.zoomFit":"Fit to view","import.sourceAlt":"The Mermaid this converts to","toolbar.save":"Save .mmd","toolbar.export":"Export…","toolbar.copyCode":"Copy code","toolbar.copied":"Copied!","prefs.singleKeys":"Single-key shortcuts","toolbar.theme":"Theme","toolbar.themeDark":"Dark","toolbar.themeLight":"Light","toolbar.themeSystem":"System","toolbar.language":"Language","panel.sourceAndInspector":"Source and inspector","panel.mermaidSource":"Mermaid source","panel.sourceView":"Source view","panel.tabCode":"Mermaid","panel.tabPreview":"Preview","panel.cannotRender":"Cannot render: {message}","palette.shapes":"Shape palette","palette.architecture":"Architecture palette","palette.hint":"Drag onto the canvas, or click to add","palette.close":"Close panel","palette.search":"Search icons","palette.noIcons":"No icons found","palette.favorites":"Favorites","palette.addFavorite":"Add to favorites","palette.removeFavorite":"Remove from favorites","palette.add":"Add {name}","palette.addGroup":"Add {name} as a container","iconPicker.otherVendor":"Imported","iconPicker.currentIs":"on this node:","shape.square":"Process","shape.round":"Rounded","shape.stadium":"Terminator","shape.subroutine":"Subroutine","shape.cylinder":"Database","shape.circle":"Circle","shape.doublecircle":"Double circle","shape.diamond":"Decision","shape.hexagon":"Hexagon","shape.odd":"Flag","shape.trapezoid":"Trapezoid","shape.inv_trapezoid":"Trapezoid alt","shape.lean_right":"Input/Output","shape.lean_left":"Output/Input","shape.group":"Group","item.state":"State","item.start":"Start","item.end":"End","item.choice":"Choice","item.forkJoin":"Fork / Join","item.entity":"Entity","item.class":"Class","item.note":"Note","item.person":"Person","item.system":"System","item.systemExt":"System (ext)","item.systemDb":"System DB","item.container":"Container","item.component":"Component","item.participant":"Participant","item.actor":"Actor","item.loop":"Loop","item.altElse":"Alt / Else","item.opt":"Opt","item.subgraph":"Subgraph","canvas.label":"Diagram canvas","canvas.summary":"{kind}. Nodes: {nodes}. Groups: {groups}. Connections: {edges}. This canvas is visual; the Outline tab lists every node and its connections as text.","canvas.keyboardHelp":"Press Tab to move between nodes. Press C on a node to start a connection, then Enter on another node to complete it, or Escape to cancel. Press Delete to remove the selected node.","canvas.connectStart":"Connecting from {name}. Move to another node and press Enter.","canvas.connectDone":"Connected {from} to {to}.","canvas.connectCancelled":"Connection cancelled.","canvas.connectSameNode":"Pick a different node to connect to.","menu.actions":"Diagram actions","menu.rename":"Rename","menu.ungroup":"Ungroup","menu.deleteGroup":"Delete group","menu.duplicate":"Duplicate","menu.copy":"Copy","menu.removeFromGroup":"Remove from group","menu.delete":"Delete","menu.groupNodes":"Group {count} nodes","menu.deleteSelection":"Delete selection","menu.editLabel":"Edit label","menu.addNodeHere":"Add node here","menu.addCornerHere":"Add a corner here","menu.removeCorner":"Remove this corner","menu.straighten":"Straighten the line","menu.paste":"Paste","menu.autoLayout":"Auto-layout","export.title":"Export diagram","export.source":"Source","export.sourceCanvas":"Canvas (as arranged here)","export.sourceMermaid":"Mermaid renderer (standard look)","export.format":"Format","export.formatPng":"PNG","export.formatSvg":"SVG (vector)","export.formatPdf":"PDF","export.page":"Page","export.pageFit":"Fit to diagram","export.pageA4":"A4","export.pageLetter":"Letter","export.pdfHint":"The PDF holds the diagram as an image at the chosen quality. Export SVG for artwork that scales without limit.","export.copyImage":"Copy image","export.copyMarkup":"Copy markup","export.copied":"Copied","export.background":"Background","export.bgDark":"Dark","export.bgLight":"White","export.bgTransparent":"Transparent","export.mermaidTheme":"Mermaid theme","export.quality":"Quality","export.quality1":"1× (screen)","export.quality2":"2× (slides)","export.quality3":"3× (print)","export.margin":"Margin ({padding}px)","export.generating":"Generating preview…","export.previewAlt":"Preview of the exported diagram","export.cancel":"Cancel","export.confirm":"Export {format}","about.title":"About Archyne","about.trademark":"Archyne is an independent project. It is not affiliated with, endorsed by, or sponsored by Mermaid or Mermaid Chart. “Mermaid” is a trademark of its respective owner, used here only to describe the file format Archyne reads and writes.","about.close":"Close","about.version":"version {version}","inspector.diagram":"DIAGRAM","inspector.accTitle":"Accessible title (accTitle)","inspector.accDescr":"Accessible description (accDescr)","inspector.empty":"Select a node or edge to edit it. Double-click empty canvas to add a node, drag between handles to connect.","palette.sectionShapes":"Shapes","palette.sectionBase":"Base","palette.sectionPinned":"Recent & favorites","palette.sectionCarried":"In this diagram","palette.sectionVendor":"Vendor icons","palette.searchIcons":"Search 13000+ icons…","item.compositeState":"Composite state","item.boundary":"Boundary","item.namespace":"Namespace","item.junction":"junction","insp.selection":"{count} nodes selected","insp.align":"Align","insp.alignLeft":"Left","insp.alignCenterX":"Centre","insp.alignRight":"Right","insp.alignTop":"Top","insp.alignMiddleY":"Middle","insp.alignBottom":"Bottom","insp.distribute":"Distribute","insp.distributeX":"Across","insp.distributeY":"Down","insp.alignSameParent":"Select two or more nodes inside the same group to arrange them.","insp.distributeNeedsThree":"Distributing needs three or more: it arranges what lies between the outer two.","insp.label":"Label","edge.addCorner":"Drag to add a corner","edge.moveSegment":"Drag to move this run of the line","edge.moveLabel":"Drag to move the label, double-click to put it back","edge.removeCorner":"Drag to move, double-click to remove","edge.cornerNamed":"Corner {index} of {total}. Arrow keys move it, Shift for a bigger step, Delete removes it.","insp.corners":"Corners","insp.addCorner":"Add corner","insp.removeCorner":"Remove","insp.straighten":"Straighten","watch.reloaded":"{name} changed on disk — reloaded","watch.conflict":"{name} changed on disk. Your unsaved changes were kept.","menu.reloadFromDisk":"Reload from disk","toast.reloadedFromDisk":"Reloaded from disk","toast.imported":"Imported {nodes} elements and {edges} connections from {source}","toast.importedOnePage":"Converted the first page, “{page}”, of {count}","toast.importedLooksLike":"This looked like a {family} diagram; it was imported as a flowchart","toast.importedDropped":"Some elements had no Mermaid equivalent and were left out ({count})","insp.autoSize":"Automatic size","insp.width":"Width","insp.height":"Height","insp.shape":"Shape","insp.fill":"Fill","insp.border":"Border","insp.text":"Text","insp.fontSize":"Type size","insp.reset":"Reset","insp.name":"Name","insp.attributes":"Attributes — one per line:","insp.junction":"Junction — a connector waypoint.","insp.pseudoState":"{type} pseudo-state","insp.elementType":"Element type","insp.description":"Description","insp.kind":"Kind","insp.participantBox":"Participant (box)","insp.actorPerson":"Actor (person)","insp.annotations":"Annotations — e.g.","insp.annotationsHint":"(space-separated)","insp.arrow":"Arrow","insp.line":"Line","insp.lineSolid":"Solid","insp.lineDotted":"Dotted","insp.lineThick":"Thick","insp.routing":"Routing","insp.routeOrthogonal":"Right angles","insp.routeStraight":"Straight","insp.routeCurved":"Curved","insp.look":"Look","insp.lookBoxed":"Box with icon","insp.lookIcon":"Icon alone","insp.icon":'Icon — built-in (server, database, cloud…) or "logos:aws-s3"',"insp.lookDashed":"Dashed frame","insp.lookSolid":"Solid frame","insp.lookPlain":"Hairline","insp.image":"Picture (URL) — drawn on the node, and by other Mermaid tools too","insp.imagePos":"Label","insp.imagePosAbove":"Above","insp.imagePosBelow":"Below","insp.imageSize":"Size","insp.imageHint":"A picture given as a URL is the only icon other Mermaid tools also draw; names like logos:aws render here but not there.","insp.importIcon":"Import SVG…","insp.importUrl":"From a link…","iconPicker.choose":"Choose icon…","iconPicker.title":"Choose an icon","iconPicker.imported":"Imported","iconPicker.common":"Common","iconPicker.results":"Results","iconPicker.nothing":"Nothing matches that. Vendors use their own words — Azure's networks are “virtual networks”, not “vnet”.","iconPicker.none":"No icon","iconUrl.title":"Import icons from a link","iconUrl.label":"Links, one per line","iconUrl.hintWeb":"Direct links to .svg files on {hosts}. Other sites refuse to be read from a page; for a vendor's zip, use the desktop app.","iconUrl.hintDesktop":"Any https link to an .svg, or to a .zip of them — a vendor's whole pack works here.","iconUrl.hintIconify":"Any Iconify icon works too — about 200 000 of them: api.iconify.design/mdi/database.svg","iconUrl.fetch":"Import","iconUrl.fetching":"Fetching…","toast.iconsFetchFailed":"Nothing could be fetched from those links","toast.iconNotSvg":"That file is not an SVG icon","toast.iconsImported":"Imported {count} icons, skipped {skipped}","insp.arrowPoint":"Arrow","insp.arrowNone":"None","insp.arrowCircle":"Circle","insp.arrowCross":"Cross","insp.bothEnds":"Arrowheads at both ends","insp.identifying":"Identifying (solid line)","insp.technology":"Technology","insp.techPlaceholder":"e.g. HTTPS/JSON","insp.bidirectional":"Bidirectional","insp.dottedLine":"Dotted line","insp.cardOnePlaceholder":"e.g. 1","insp.cardManyPlaceholder":"e.g. many","insp.diagramTitle":"Diagram","insp.title":"Title","error.crashTitle":"Something broke while rendering","error.crashIntro":"Your diagram is safe — this is its current code. Copy it somewhere if in doubt, then try to recover:","error.reset":"Reset to sample diagram and reload","insp.groupTitle":"Group {id}","insp.nodeTitle":"Node {id}","insp.edgeTitle":"Edge {source} → {target}","seq.notePlaceholder":"Note text","seq.dragReorder":"Drag vertically to reorder","seq.delete":"Delete","seq.done":"Done","seq.over":"over","seq.leftOf":"left of","seq.rightOf":"right of","unsupported.title":"Read-only: {type} diagrams","unsupported.body":"Archyne does not have a visual editor for this diagram family yet, so the canvas is read-only. The Mermaid code is fully editable, and saving leaves your file exactly as it is.","unsupported.badge":"{type} (read-only)","unsupported.paletteHint":"This diagram family is read-only. Edit it as Mermaid code in the panel on the right.","toolbar.saveAs":"Save as…","file.unsaved":"unsaved changes","file.untitled":"Untitled diagram","file.confirmDiscard":"This diagram has unsaved changes. Leave anyway?","doc.menuLabel":"Diagram: {name} — switch or manage","doc.openDocuments":"Open diagrams","doc.closeNamed":"Close {name}","doc.tabsHint":"Diagrams open in Archyne","doc.closeAll":"Close all","doc.closeAllTitle":"Close {count} documents?","doc.closeAllBody":"Every open diagram is closed and an empty one starts.","doc.closeAllUnsaved":"These diagrams have unsaved changes, which will be lost:","doc.current":"(current)","doc.new":"New diagram","doc.rename":"Rename…","doc.duplicate":"Duplicate","doc.delete":"Delete","doc.renameTitle":"Rename diagram","doc.nameLabel":"Name","doc.renameConfirm":"Rename","doc.renameHint":"This is a label in Archyne. The file on disk is not renamed.","doc.deleteTitle":"Delete “{name}”?","doc.deleteBody":"This removes the diagram from Archyne. Any file you saved it to is untouched.","doc.deleteUnsaved":"This diagram has changes that are not saved to a file. Deleting it loses them. Any file you saved it to earlier is untouched.","doc.switchTo":"Switch to {name}","common.cancel":"Cancel","toast.dismiss":"Dismiss","toast.saved":"Saved","toast.copied":"Mermaid code copied","toast.saveFailed":"Could not save","toast.openFailed":"Could not open the file","shortcuts.title":"Keyboard shortcuts","shortcuts.file":"File","shortcuts.edit":"Edit","shortcuts.canvas":"Canvas","shortcuts.view":"View","shortcuts.selectAll":"Select all","shortcuts.nextNode":"Move between nodes","shortcuts.connect":"Start a connection from the focused node","shortcuts.completeConnect":"Complete the connection","shortcuts.labelBreak":"Line break, while renaming a node","shortcuts.cancel":"Cancel","shortcuts.nudge":"Nudge the selection","shortcuts.nudgeFar":"Nudge further","shortcuts.commandPalette":"Command palette","panel.tabOutline":"Outline","outline.filter":"Filter nodes","outline.empty":"No nodes match","outline.noNodes":"This diagram has no nodes yet.","outline.connections":"{count} outgoing","outline.select":"Select {name}","outline.summary":"{nodes} nodes, {edges} connections","palette.commandTitle":"Command palette","palette.commandFilter":"Type a command or node name","palette.commandEmpty":"Nothing matches","palette.groupCommands":"Commands","palette.groupNodes":"Go to node","palette.groupArrange":"Arrange","palette.groupDocuments":"Switch diagram","palette.groupNew":"New diagram","cmd.run":"Run","tpl.title":"Start from a template","tpl.blank":"Blank diagram","tpl.blankDesc":"An empty {kind} to build up yourself.","tpl.open":"Templates","tpl.approval":"Approval workflow","tpl.approvalDesc":"Branching decisions with two outcomes.","tpl.auth":"Sign-in flow","tpl.authDesc":"Messages between a user, an app and a service, with an alt block.","tpl.orders":"Orders schema","tpl.ordersDesc":"Customers, orders and products with crow's-foot cardinalities.","tpl.webapp":"Web application","tpl.webappDesc":"A cloud deployment with nested groups and vendor icons.","tpl.orderState":"Order lifecycle","tpl.orderStateDesc":"States and transitions from draft to delivered.","tpl.domain":"Domain model","tpl.domainDesc":"Classes with fields, methods and cardinalities.","tpl.context":"System context","tpl.contextDesc":"People and systems around one product, C4 style.","toolbar.more":"More","panel.resize":"Resize the side panel","panel.resizeHint":"Drag to resize, double-click to reset","editor.format":"Format","editor.formatHint":"Tidy the indentation (Shift+Alt+F)","editor.formatCommand":"Format the Mermaid code","editor.fontSize":"Text size","editor.fontSmaller":"Smaller text","editor.fontLarger":"Larger text","editor.fontReset":"Reset the text size","editor.metaFolded":"Layout data Archyne writes into the file. Click to open.","shortcuts.editor":"Code editor","error.title":"Something went wrong","error.reload":"Reload"},lp={en:{label:"English",dir:"ltr"},es:{label:"Español",dir:"ltr"},it:{label:"Italiano",dir:"ltr"},de:{label:"Deutsch",dir:"ltr"},ar:{label:"العربية",dir:"rtl"},zh:{label:"简体中文",dir:"ltr"},ja:{label:"日本語",dir:"ltr"}},IY={es:()=>ee(()=>import("./es-DhIKChM2.js"),[],import.meta.url),it:()=>ee(()=>import("./it-Du1X6aWm.js"),[],import.meta.url),de:()=>ee(()=>import("./de-BnB-zySU.js"),[],import.meta.url),ar:()=>ee(()=>import("./ar-BtyCldeI.js"),[],import.meta.url),zh:()=>ee(()=>import("./zh-DnDlZG1E.js"),[],import.meta.url),ja:()=>ee(()=>import("./ja-DM0AEe7d.js"),[],import.meta.url)},h3="graph:locale",f3=(()=>{try{return new URLSearchParams(location.search).has("embed")}catch{return!1}})();function UY(e){return e!==null&&e in lp}function ZY(){if(f3)return"en";try{const e=localStorage.getItem(h3);if(UY(e))return e}catch{}return"en"}const ja=Ln(e=>({locale:"en",messages:op,setLocale:async t=>{if(t==="en")e({locale:t,messages:op});else{const n=await IY[t]();e({locale:t,messages:n.messages})}d3(t);try{f3||localStorage.setItem(h3,t)}catch{}}}));function d3(e){const t=document.documentElement;t.lang=e,t.dir=lp[e].dir}function FY(){const e=ZY();d3(e),e!=="en"&&ja.getState().setLocale(e)}function p3(e,t){return t?e.replace(/\{(\w+)\}/g,(n,i)=>i in t?String(t[i]):n):e}function ge(e,t){const{messages:n}=ja.getState();return p3(n[e]??op[e],t)}function Zt(){const e=ja(t=>t.messages);return(t,n)=>p3(e[t]??op[t],n)}const IS={info:2600,error:6e3};let VY=1;const ap=Ln(e=>({toasts:[],dismiss:t=>{XY(t),e(n=>({toasts:n.toasts.filter(i=>i.id!==t)}))}})),Vr=new Map;let Mu=!1;function m3(e,t){const n=setTimeout(()=>{Vr.delete(e),ap.getState().dismiss(e)},t);Vr.set(e,{handle:n,endsAt:Date.now()+t})}function XY(e){const t=Vr.get(e);t&&(clearTimeout(t.handle),Vr.delete(e))}function US(){if(Mu)return;Mu=!0;const e=Date.now();for(const[t,n]of Vr)clearTimeout(n.handle),Vr.set(t,{handle:n.handle,endsAt:Math.max(0,n.endsAt-e)})}function ZS(){if(Mu){Mu=!1;for(const[e,t]of[...Vr])m3(e,t.endsAt)}}function g3(e,t){const n=VY++;return ap.setState(i=>({toasts:[...i.toasts,{id:n,text:e,tone:t}]})),Mu?Vr.set(n,{handle:0,endsAt:IS[t]}):m3(n,IS[t]),n}function os(e,t="info",n){return g3(ge(e,n),t)}function ga(e,t){const n=t instanceof Error?t.message:String(t);return g3(`${ge(e)}: ${n}`,"error")}async function y3(e,t){try{if(e.handle){const i=await e.handle.getFile();return i.lastModified<=t?null:{stamp:i.lastModified,content:await i.text()}}const n=Ru();if(e.path&&(n!=null&&n.statFile)&&n.readFile){const i=await n.statFile(e.path);if(!i||i.mtimeMs<=t)return null;const s=await n.readFile(e.path);return s===null?null:{stamp:i.mtimeMs,content:s}}}catch{}return null}const Ow=new Map;function w3(e){Ow.delete(e)}async function KY(){const{docs:e,activeId:t}=Ut.getState();for(const n of e){if(!n.path&&!n.handle)continue;const i=n.id===t,s=i?{path:Be.getState().path,handle:Be.getState().handle}:{path:n.path,handle:n.handle},r=await y3(s,Ow.get(n.id)??0);if(!r)continue;Ow.set(n.id,r.stamp);const l=i?Be.getState().savedCode:n.savedCode;if(r.content===l)continue;const c=i?ct.getState().code:La(n.id);if(c!==null&&l!==null&&c!==l){os("watch.conflict","error",{name:n.name});continue}i?(await ct.getState().applyCode(r.content,{record:!0}),Be.setState({savedCode:r.content})):Pa(n.id,r.content),Qa(n.id,{savedCode:r.content}),os("watch.reloaded","info",{name:n.name})}}const JY=2e3;function tL(){let e=!1;const t=()=>{e||document.visibilityState!=="visible"||(e=!0,KY().finally(()=>{e=!1}))},n=setInterval(t,JY);return document.addEventListener("visibilitychange",t),()=>{clearInterval(n),document.removeEventListener("visibilitychange",t)}}function ax(){const{activeId:e}=Ut.getState();if(!e)return;const{path:t,handle:n,savedCode:i,name:s}=Be.getState();Pa(e,ct.getState().code),Qa(e,{path:t,handle:n,savedCode:i,...s?{name:s}:{}})}function x3(e){const t=!!(e.path||e.handle);Be.setState({name:t?e.name:null,path:e.path,handle:e.handle,savedCode:e.savedCode})}async function lm(e){const{activeId:t,docs:n}=Ut.getState();if(e===t)return;const i=n.find(s=>s.id===e);i&&(ax(),Ut.setState({activeId:e}),Ga(Ut.getState()),ct.getState().swapHistory(t,e),x3(i),await ct.getState().applyCode(La(e)??lh,{record:!1}))}async function qa(e){ax();const t=ip(eL()),n=e?n3[e]:lh;Pa(t.id,n);const i=Ut.getState().activeId;return Ut.setState(s=>({docs:[...s.docs,t],activeId:t.id})),Ga(Ut.getState()),ct.getState().swapHistory(i,t.id),x3(t),await ct.getState().applyCode(n,{forceLayout:!!e,record:!1}),t.id}function eL(){const e=new Set(Ut.getState().docs.map(t=>t.name));if(!e.has("Untitled"))return"Untitled";for(let t=2;;t++){const n=`Untitled ${t}`;if(!e.has(n))return n}}function nL(e,t){const n=t.trim();n&&(Qa(e,{name:n}),e===Ut.getState().activeId&&Be.getState().name&&Be.setState({name:n}))}async function iL(e){e===Ut.getState().activeId&&ax();const t=Ut.getState().docs.find(i=>i.id===e);if(!t)return"";const n=ip(`${t.name} copy`);return Pa(n.id,La(e)??lh),Ut.setState(i=>({docs:[...i.docs,n]})),Ga(Ut.getState()),await lm(n.id),n.id}async function sL(e){const{docs:t,activeId:n}=Ut.getState();if(!t.some(s=>s.id===e))return;const i=t.filter(s=>s.id!==e);if(XE(e),w3(e),i.length===0){Ut.setState({docs:[],activeId:""}),await qa();return}if(Ut.setState({docs:i}),e===n){const s=[...i].sort((r,l)=>l.updatedAt-r.updatedAt)[0];Ut.setState({activeId:""}),await lm(s.id)}else Ga(Ut.getState())}async function rL(){const{path:e,handle:t}=Be.getState(),n=await y3({path:e,handle:t},0);return n?(await ct.getState().applyCode(n.content,{record:!0}),Be.setState({savedCode:n.content}),Qa(Ut.getState().activeId,{savedCode:n.content}),!0):!1}function oL(){const{docs:e,activeId:t}=Ut.getState();return[...e].sort((n,i)=>i.updatedAt-n.updatedAt).map(n=>({...n,active:n.id===t}))}function lL(){if(oh||!gY())return!1;const{path:e,handle:t,savedCode:n}=Be.getState(),i=!e&&!t&&n===null,s=ct.getState().code;return!(i&&(s===lh||s.trim()===""))}const au=Ln(()=>({renaming:null,deleting:null}));function aL(){return{rename:()=>au.setState({renaming:Ut.getState().activeId}),duplicate:()=>void iL(Ut.getState().activeId)}}async function $3({file:e,imported:t}){lL()&&await qa();const n=t?null:e.content;await ct.getState().applyCode(e.content,{record:!0}),Be.setState({name:e.name,path:e.path,handle:e.handle,savedCode:n}),Qa(Ut.getState().activeId,{name:e.name,path:e.path,handle:e.handle,savedCode:n}),t&&cL(t)}function cL(e){const n={dot:"Graphviz",drawio:"draw.io",sql:"SQL",excalidraw:"Excalidraw",plantuml:"PlantUML",vsdx:"Visio"}[e.format];os("toast.imported","info",{source:n,nodes:String(e.nodes),edges:String(e.edges)})}async function uL(e,t){await ux(await om({name:e,path:null,handle:null,...t}))}async function cx(e="open"){const t=await zY(e);t&&await ux(await om(t))}async function ux(e){if(!e.imported){await $3(e);return}cp.setState({pending:e})}const cp=Ln(()=>({pending:null}));async function hL(e){const t=e.path.split(/[\\/]/).pop()||e.path;return ux(await om({name:t,content:e.content,path:e.path,handle:null,...e.base64?{bytes:u3(e.base64)}:{}}))}async function fL(){const{docs:e}=Ut.getState();for(const t of e)XE(t.id),w3(t.id);Ut.setState({docs:[],activeId:""}),await qa()}function b3(){const{docs:e,activeId:t}=Ut.getState(),n=Be.getState();return e.filter(i=>{const s=i.id===t?n.savedCode:i.savedCode;if(s===null)return!1;const r=i.id===t?ct.getState().code:La(i.id);return r!==null&&r!==s})}function dL(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),i=n.createElement("base"),s=n.createElement("a");return n.head.appendChild(i),n.body.appendChild(s),t&&(i.href=t),s.href=e,s.href}const pL=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Ir(e){const t=[];for(let n=0,i=e.length;n<i;n++)t.push(e[n]);return t}let Xl=null;function v3(e={}){return Xl||(e.includeStyleProperties?(Xl=e.includeStyleProperties,Xl):(Xl=Ir(window.getComputedStyle(document.documentElement)),Xl))}function up(e,t){const i=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return i?parseFloat(i.replace("px","")):0}function mL(e){const t=up(e,"border-left-width"),n=up(e,"border-right-width");return e.clientWidth+t+n}function gL(e){const t=up(e,"border-top-width"),n=up(e,"border-bottom-width");return e.clientHeight+t+n}function S3(e,t={}){const n=t.width||mL(e),i=t.height||gL(e);return{width:n,height:i}}function yL(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const Vn=16384;function wL(e){(e.width>Vn||e.height>Vn)&&(e.width>Vn&&e.height>Vn?e.width>e.height?(e.height*=Vn/e.width,e.width=Vn):(e.width*=Vn/e.height,e.height=Vn):e.width>Vn?(e.height*=Vn/e.width,e.width=Vn):(e.width*=Vn/e.height,e.height=Vn))}function hp(e){return new Promise((t,n)=>{const i=new Image;i.onload=()=>{i.decode().then(()=>{requestAnimationFrame(()=>t(i))})},i.onerror=n,i.crossOrigin="anonymous",i.decoding="async",i.src=e})}async function xL(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function $L(e,t,n){const i="http://www.w3.org/2000/svg",s=document.createElementNS(i,"svg"),r=document.createElementNS(i,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${n}`),s.setAttribute("viewBox",`0 0 ${t} ${n}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),s.appendChild(r),r.appendChild(e),xL(s)}const Bn=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Bn(n,t)};function bL(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function vL(e,t){return v3(t).map(n=>{const i=e.getPropertyValue(n),s=e.getPropertyPriority(n);return`${n}: ${i}${s?" !important":""};`}).join(" ")}function SL(e,t,n,i){const s=`.${e}:${t}`,r=n.cssText?bL(n):vL(n,i);return document.createTextNode(`${s}{${r}}`)}function FS(e,t,n,i){const s=window.getComputedStyle(e,n),r=s.getPropertyValue("content");if(r===""||r==="none")return;const l=pL();try{t.className=`${t.className} ${l}`}catch{return}const c=document.createElement("style");c.appendChild(SL(l,n,s,i)),t.appendChild(c)}function OL(e,t,n){FS(e,t,":before",n),FS(e,t,":after",n)}const VS="application/font-woff",XS="image/jpeg",kL={woff:VS,woff2:VS,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:XS,jpeg:XS,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function CL(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function hx(e){const t=CL(e).toLowerCase();return kL[t]||""}function EL(e){return e.split(/,/)[1]}function kw(e){return e.search(/^(data:)/)!==-1}function DL(e,t){return`data:${t};base64,${e}`}async function O3(e,t,n){const i=await fetch(e,t);if(i.status===404)throw new Error(`Resource "${i.url}" not found`);const s=await i.blob();return new Promise((r,l)=>{const c=new FileReader;c.onerror=l,c.onloadend=()=>{try{r(n({res:i,result:c.result}))}catch(u){l(u)}},c.readAsDataURL(s)})}const dy={};function NL(e,t,n){let i=e.replace(/\?.*/,"");return n&&(i=e),/ttf|otf|eot|woff2?/i.test(i)&&(i=i.replace(/.*\//,"")),t?`[${t}]${i}`:i}async function fx(e,t,n){const i=NL(e,t,n.includeQueryParams);if(dy[i]!=null)return dy[i];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{const r=await O3(e,n.fetchRequestInit,({res:l,result:c})=>(t||(t=l.headers.get("Content-Type")||""),EL(c)));s=DL(r,t)}catch(r){s=n.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;r&&(l=typeof r=="string"?r:r.message),l&&console.warn(l)}return dy[i]=s,s}async function TL(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):hp(t)}async function jL(e,t){if(e.currentSrc){const r=document.createElement("canvas"),l=r.getContext("2d");r.width=e.clientWidth,r.height=e.clientHeight,l==null||l.drawImage(e,0,0,r.width,r.height);const c=r.toDataURL();return hp(c)}const n=e.poster,i=hx(n),s=await fx(n,i,t);return hp(s)}async function RL(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await am(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function ML(e,t){return Bn(e,HTMLCanvasElement)?TL(e):Bn(e,HTMLVideoElement)?jL(e,t):Bn(e,HTMLIFrameElement)?RL(e,t):e.cloneNode(k3(e))}const _L=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",k3=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function AL(e,t,n){var i,s;if(k3(t))return t;let r=[];return _L(e)&&e.assignedNodes?r=Ir(e.assignedNodes()):Bn(e,HTMLIFrameElement)&&(!((i=e.contentDocument)===null||i===void 0)&&i.body)?r=Ir(e.contentDocument.body.childNodes):r=Ir(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),r.length===0||Bn(e,HTMLVideoElement)||await r.reduce((l,c)=>l.then(()=>am(c,n)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function zL(e,t,n){const i=t.style;if(!i)return;const s=window.getComputedStyle(e);s.cssText?(i.cssText=s.cssText,i.transformOrigin=s.transformOrigin):v3(n).forEach(r=>{let l=s.getPropertyValue(r);r==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),Bn(e,HTMLIFrameElement)&&r==="display"&&l==="inline"&&(l="block"),r==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),i.setProperty(r,l,s.getPropertyPriority(r))})}function HL(e,t){Bn(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Bn(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function BL(e,t){if(Bn(e,HTMLSelectElement)){const i=Array.from(t.children).find(s=>e.value===s.getAttribute("value"));i&&i.setAttribute("selected","")}}function YL(e,t,n){return Bn(t,Element)&&(zL(e,t,n),OL(e,t,n),HL(e,t),BL(e,t)),t}async function LL(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const i={};for(let r=0;r<n.length;r++){const c=n[r].getAttribute("xlink:href");if(c){const u=e.querySelector(c),f=document.querySelector(c);!u&&f&&!i[c]&&(i[c]=await am(f,t,!0))}}const s=Object.values(i);if(s.length){const r="http://www.w3.org/1999/xhtml",l=document.createElementNS(r,"svg");l.setAttribute("xmlns",r),l.style.position="absolute",l.style.width="0",l.style.height="0",l.style.overflow="hidden",l.style.display="none";const c=document.createElementNS(r,"defs");l.appendChild(c);for(let u=0;u<s.length;u++)c.appendChild(s[u]);e.appendChild(l)}return e}async function am(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(i=>ML(i,t)).then(i=>AL(e,i,t)).then(i=>YL(e,i,t)).then(i=>LL(i,t))}const C3=/url\((['"]?)([^'"]+?)\1\)/g,PL=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,GL=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function QL(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function qL(e){const t=[];return e.replace(C3,(n,i,s)=>(t.push(s),n)),t.filter(n=>!kw(n))}async function WL(e,t,n,i,s){try{const r=n?dL(t,n):t,l=hx(t);let c;return s||(c=await fx(r,l,i)),e.replace(QL(t),`$1${c}$3`)}catch{}return e}function IL(e,{preferredFontFormat:t}){return t?e.replace(GL,n=>{for(;;){const[i,,s]=PL.exec(n)||[];if(!s)return"";if(s===t)return`src: ${i};`}}):e}function E3(e){return e.search(C3)!==-1}async function D3(e,t,n){if(!E3(e))return e;const i=IL(e,n);return qL(i).reduce((r,l)=>r.then(c=>WL(c,l,t,n)),Promise.resolve(i))}async function Kl(e,t,n){var i;const s=(i=t.style)===null||i===void 0?void 0:i.getPropertyValue(e);if(s){const r=await D3(s,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function UL(e,t){await Kl("background",e,t)||await Kl("background-image",e,t),await Kl("mask",e,t)||await Kl("-webkit-mask",e,t)||await Kl("mask-image",e,t)||await Kl("-webkit-mask-image",e,t)}async function ZL(e,t){const n=Bn(e,HTMLImageElement);if(!(n&&!kw(e.src))&&!(Bn(e,SVGImageElement)&&!kw(e.href.baseVal)))return;const i=n?e.src:e.href.baseVal,s=await fx(i,hx(i),t);await new Promise((r,l)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...u)=>{try{r(t.onImageErrorHandler(...u))}catch(f){l(f)}}:l;const c=e;c.decode&&(c.decode=r),c.loading==="lazy"&&(c.loading="eager"),n?(e.srcset="",e.src=s):e.href.baseVal=s})}async function FL(e,t){const i=Ir(e.childNodes).map(s=>N3(s,t));await Promise.all(i).then(()=>e)}async function N3(e,t){Bn(e,Element)&&(await UL(e,t),await ZL(e,t),await FL(e,t))}function VL(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const i=t.style;return i!=null&&Object.keys(i).forEach(s=>{n[s]=i[s]}),e}const KS={};async function JS(e){let t=KS[e];if(t!=null)return t;const i=await(await fetch(e)).text();return t={url:e,cssText:i},KS[e]=t,t}async function tO(e,t){let n=e.cssText;const i=/url\(["']?([^"')]+)["']?\)/g,r=(n.match(/url\([^)]+\)/g)||[]).map(async l=>{let c=l.replace(i,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),O3(c,t.fetchRequestInit,({result:u})=>(n=n.replace(l,`url(${u})`),[l,u]))});return Promise.all(r).then(()=>n)}function eO(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let i=e.replace(n,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=s.exec(i);if(u===null)break;t.push(u[0])}i=i.replace(s,"");const r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(l,"gi");for(;;){let u=r.exec(i);if(u===null){if(u=c.exec(i),u===null)break;r.lastIndex=c.lastIndex}else c.lastIndex=r.lastIndex;t.push(u[0])}return t}async function XL(e,t){const n=[],i=[];return e.forEach(s=>{if("cssRules"in s)try{Ir(s.cssRules||[]).forEach((r,l)=>{if(r.type===CSSRule.IMPORT_RULE){let c=l+1;const u=r.href,f=JS(u).then(d=>tO(d,t)).then(d=>eO(d).forEach(m=>{try{s.insertRule(m,m.startsWith("@import")?c+=1:s.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:m,error:g})}})).catch(d=>{console.error("Error loading remote css",d.toString())});i.push(f)}})}catch(r){const l=e.find(c=>c.href==null)||document.styleSheets[0];s.href!=null&&i.push(JS(s.href).then(c=>tO(c,t)).then(c=>eO(c).forEach(u=>{l.insertRule(u,l.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",r)}}),Promise.all(i).then(()=>(e.forEach(s=>{if("cssRules"in s)try{Ir(s.cssRules||[]).forEach(r=>{n.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${s.href}`,r)}}),n))}function KL(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>E3(t.style.getPropertyValue("src")))}async function JL(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=Ir(e.ownerDocument.styleSheets),i=await XL(n,t);return KL(i)}function T3(e){return e.trim().replace(/["']/g,"")}function tP(e){const t=new Set;function n(i){(i.style.fontFamily||getComputedStyle(i).fontFamily).split(",").forEach(r=>{t.add(T3(r))}),Array.from(i.children).forEach(r=>{r instanceof HTMLElement&&n(r)})}return n(e),t}async function eP(e,t){const n=await JL(e,t),i=tP(e);return(await Promise.all(n.filter(r=>i.has(T3(r.style.fontFamily))).map(r=>{const l=r.parentStyleSheet?r.parentStyleSheet.href:null;return D3(r.cssText,l,t)}))).join(`
|
|
157
157
|
`)}async function nP(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await eP(e,t);if(n){const i=document.createElement("style"),s=document.createTextNode(n);i.appendChild(s),e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}}async function j3(e,t={}){const{width:n,height:i}=S3(e,t),s=await am(e,t,!0);return await nP(s,t),await N3(s,t),VL(s,t),await $L(s,n,i)}async function iP(e,t={}){const{width:n,height:i}=S3(e,t),s=await j3(e,t),r=await hp(s),l=document.createElement("canvas"),c=l.getContext("2d"),u=t.pixelRatio||yL(),f=t.canvasWidth||n,d=t.canvasHeight||i;return l.width=f*u,l.height=d*u,t.skipAutoScale||wL(l),l.style.width=`${f}`,l.style.height=`${d}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,l.width,l.height)),c.drawImage(r,0,0,l.width,l.height),l}async function sP(e,t={}){return(await iP(e,t)).toDataURL()}const R3={source:"canvas",format:"png",background:"dark",scale:2,padding:48,theme:"dark",page:"fit"},nO={png:{mime:"image/png",extension:"png"},svg:{mime:"image/svg+xml",extension:"svg"},pdf:{mime:"application/pdf",extension:"pdf"}},Cw={dark:"#12141a",light:"#ffffff",transparent:void 0};function rP(e){var l,c,u,f;const t=new Map(e.map(d=>[d.id,d]));let n=1/0,i=1/0,s=-1/0,r=-1/0;for(const d of e){let m=d.position.x,g=d.position.y,y=d.parentId;for(;y;){const C=t.get(y);if(!C)break;m+=C.position.x,g+=C.position.y,y=C.parentId}const $=Qo(d),v=((l=d.measured)==null?void 0:l.width)??(xe(d)?Number(((c=d.style)==null?void 0:c.width)??320):$.width),S=((u=d.measured)==null?void 0:u.height)??(xe(d)?Number(((f=d.style)==null?void 0:f.height)??220):$.height);n=Math.min(n,m),i=Math.min(i,g),s=Math.max(s,m+v),r=Math.max(r,g+S)}return{x:n,y:i,width:s-n,height:r-i}}function oP(e,t){const n=rP(e),i=4e3,s=Math.min(1,(i-t*2)/n.width,(i-t*2)/n.height);return{width:Math.max(240,Math.ceil(n.width*s+t*2)),height:Math.max(160,Math.ceil(n.height*s+t*2)),viewport:{x:-n.x*s+t,y:-n.y*s+t,zoom:s}}}function lP(){const e=[];for(const t of Array.from(document.styleSheets)){let n;try{n=t.cssRules}catch{continue}for(const i of Array.from(n)){if(!(i instanceof CSSStyleRule))continue;const s=i.style;(s.fill||s.stroke||s.strokeWidth)&&e.push(i.cssText)}}return e.join(`
|
|
158
158
|
`)}async function aP(e,t,n,i,s,r){const l=document.querySelector(".react-flow__viewport");if(!l)return"";const c="http://www.w3.org/2000/svg",u=document.createElementNS(c,"svg");u.setAttribute("width","0"),u.setAttribute("height","0");const f=document.createElementNS(c,"defs");document.querySelectorAll("marker").forEach(m=>f.appendChild(m.cloneNode(!0))),u.appendChild(f),l.appendChild(u);const d=document.createElement("style");d.textContent=lP(),l.appendChild(d);try{const m={...s?{backgroundColor:s}:{},width:t,height:n,style:{width:`${t}px`,height:`${n}px`,transform:`translate(${i.x}px, ${i.y}px) scale(${i.zoom})`},filter:g=>{var y,$;return!((y=g.classList)!=null&&y.contains("react-flow__handle"))&&!(($=g.classList)!=null&&$.contains("react-flow__resize-control"))},...e==="png"?{pixelRatio:r}:{}};return e==="png"?await sP(l,m):await j3(l,m)}finally{u.remove(),d.remove()}}function cP(e,t){let n=800,i=600;const s=e.match(/viewBox="([\d.\s-]+)"/);if(s){const l=s[1].trim().split(/\s+/).map(Number);l.length===4&&l[2]>0&&l[3]>0&&(n=Math.ceil(l[2]),i=Math.ceil(l[3]))}return{svg:e.replace(/<svg([^>]*)>/,(l,c)=>{const u=c.replace(/\s(width|height)="[^"]*"/g,"").replace(/\sstyle="[^"]*"/g,""),f=t?` style="background:${t}"`:"";return`<svg${u} width="${n}" height="${i}"${f}>`}),width:n,height:i}}function uP(e,t,n,i,s){return new Promise((r,l)=>{const c=new Image;c.onload=()=>{const u=document.createElement("canvas");u.width=Math.ceil(t*i),u.height=Math.ceil(n*i);const f=u.getContext("2d");s&&(f.fillStyle=s,f.fillRect(0,0,u.width,u.height)),f.drawImage(c,0,0,u.width,u.height),r(u.toDataURL("image/png"))},c.onerror=()=>l(new Error("could not rasterize the mermaid SVG")),c.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`})}async function hP(e,t){const n=`%%{init: {"theme": "${e.theme}"}}%%
|
|
159
|
-
${R6(t)}`,i=(await AE(`export-${Date.now()}`,n)).svg,{svg:s,width:r,height:l}=cP(i,Cw[e.background]);return e.format==="svg"?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`:uP(s,r,l,e.scale,Cw[e.background])}function fP(e){return new Promise((t,n)=>{const i=new Image;i.onload=()=>{const s=document.createElement("canvas");s.width=i.naturalWidth,s.height=i.naturalHeight;const r=s.getContext("2d");if(!r)return n(new Error("no 2d context to read the diagram back from"));r.drawImage(i,0,0);const{data:l}=r.getImageData(0,0,s.width,s.height),c=s.width*s.height,u=new Uint8Array(c*3),f=new Uint8Array(c);let d=!0;for(let m=0;m<c;m++)u[m*3]=l[m*4],u[m*3+1]=l[m*4+1],u[m*3+2]=l[m*4+2],f[m]=l[m*4+3],f[m]!==255&&(d=!1);t({rgb:u,width:s.width,height:s.height,...d?{}:{alpha:f}})},i.onerror=()=>n(new Error("could not read the rendered diagram back")),i.src=e})}function M3(e){return e.format==="pdf"?{...e,format:"png"}:e}async function _3(e,t){if(!e)return"";const[{buildPdf:n,pdfDataUrl:i},s]=await Promise.all([ee(()=>import("./pdf-DIY7PTna.js"),__vite__mapDeps([12,4]),import.meta.url),fP(e)]);return i(n(s,{page:t.page,pixelRatio:t.scale}))}async function dx(e,t,n){if(e.format==="pdf")return _3(await dx(M3(e),t,n),e);if(e.source==="mermaid")return hP(e,n);if(t.length===0)return"";const{width:i,height:s,viewport:r}=oP(t,e.padding);return aP(e.format,i,s,r,Cw[e.background],e.scale)}function iO(e){const t=e.indexOf(",");if(!e.startsWith("data:")||t<0)throw new Error("not a data URL");const n=e.slice(5,t),i=e.slice(t+1),s=n.split(";")[0]||"application/octet-stream";if(n.endsWith(";base64")){const r=atob(i),l=new Uint8Array(r.length);for(let c=0;c<r.length;c++)l[c]=r.charCodeAt(c);return new Blob([l],{type:s})}return new Blob([decodeURIComponent(i)],{type:s})}function dP(){var e;return typeof ClipboardItem<"u"&&typeof((e=navigator.clipboard)==null?void 0:e.write)=="function"}async function pP(e){if(e.startsWith("data:image/svg+xml")){await navigator.clipboard.writeText(await iO(e).text());return}await navigator.clipboard.write([new ClipboardItem({"image/png":iO(e)})])}function mP(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.click()}const fp="*";function gP(e){const t=new URLSearchParams(e).get("origin");if(t===null||t.trim()==="")return null;if(t.trim()===fp)return fp;const n=[];for(const i of t.split(",")){const s=i.trim();if(s)try{const r=new URL(s);if(r.origin==="null"||r.origin!==s.replace(/\/$/,""))continue;n.push(r.origin)}catch{}}return n.length>0?n:null}function yP(){if(rx()){const i=window.acquireVsCodeApi();return{post:s=>i.postMessage(s),accepts:()=>!0}}if(window.parent===window)return null;const e=window.parent,t=gP(location.search);if(t===null)return console.error("[archyne] Embed bridge disabled: no valid `origin` parameter. Load Archyne as `?embed=1&origin=https://your.app` so it knows which origin may read and write the diagram. Use `origin=*` for local development only."),null;const n=t===fp;return n&&console.warn("[archyne] Embed bridge running with `origin=*`: any page framing Archyne can read and modify the diagram. Do not use this in production."),{post:i=>{if(n){e.postMessage(i,fp);return}for(const s of t)e.postMessage(i,s)},accepts:i=>i.source===e&&(n||t.includes(i.origin))}}function wP(){const e=yP();if(!e)return;const t=e.post;window.addEventListener("message",s=>{if(!e.accepts(s))return;const r=s.data;if(!r||typeof r.type!="string")return;const l=ct.getState();(async()=>{try{switch(r.type){case"load":await l.applyCode(String(r.code??""),{record:!0}),t({type:"loaded"});break;case"getCode":t({type:"code",code:l.code});break;case"export":{const c={...R3,...r.options??{}},u=await dx(c,l.nodes,l.code);t({type:"exported",format:c.format,dataUrl:u});break}}}catch(c){t({type:"error",message:c instanceof Error?c.message:String(c)})}})()});let n=ct.getState().code,i;ct.subscribe(s=>{s.code!==n&&(n=s.code,clearTimeout(i),i=setTimeout(()=>t({type:"change",code:n}),300))}),t({type:"ready"})}const sO=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function cs({title:e,onClose:t,className:n="",hideTitle:i=!1,children:s}){const r=Y.useRef(null),l=Y.useId();return Y.useEffect(()=>{var f;const c=document.activeElement,u=r.current;return(f=(u==null?void 0:u.querySelector(sO))??u)==null||f.focus(),()=>{var d;return(d=c==null?void 0:c.focus)==null?void 0:d.call(c)}},[]),Y.useEffect(()=>{const c=r.current;if(!c)return;const u=f=>{if(f.key==="Escape"){f.stopPropagation(),t();return}if(f.key!=="Tab")return;const d=[...c.querySelectorAll(sO)].filter(y=>{var $;return(($=y.checkVisibility)==null?void 0:$.call(y))??!0});if(d.length===0){f.preventDefault();return}const m=d[0],g=d[d.length-1];f.shiftKey&&document.activeElement===m?(f.preventDefault(),g.focus()):!f.shiftKey&&document.activeElement===g&&(f.preventDefault(),m.focus())};return c.addEventListener("keydown",u),()=>c.removeEventListener("keydown",u)},[t]),w.jsx("div",{className:"modal-overlay",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&t()},children:w.jsxs("div",{ref:r,className:`modal ${n}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,children:[w.jsx("h2",{className:i?"visually-hidden":"modal-title",id:l,children:e}),s]})})}function xP({onClose:e}){const t=Zt(),n=ct(k=>k.nodes),i=ct(k=>k.code),[s,r]=Y.useState(R3),[l,c]=Y.useState(""),[u,f]=Y.useState(!0),[d,m]=Y.useState(null),[g,y]=Y.useState(!1),$=k=>r(O=>({...O,...k}));Y.useEffect(()=>{let k=!0;const O=setTimeout(()=>{k&&(f(!0),m(null),dx(M3(s),n,i).then(E=>{k&&(c(E),f(!1))}).catch(E=>{k&&(m(E instanceof Error?E.message:String(E)),f(!1))}))},350);return()=>{k=!1,clearTimeout(O)}},[s,n,i]);const v=k=>m(k instanceof Error?k.message:String(k)),S=()=>{if(!l)return e();const{extension:k}=nO[s.format],O=E=>{mP(E,`diagram.${k}`),e()};if(s.format!=="pdf")return O(l);f(!0),_3(l,s).then(O).catch(E=>{v(E),f(!1)})},C=()=>{l&&pP(l).then(()=>{y(!0),setTimeout(()=>y(!1),1500)}).catch(v)};return w.jsxs(cs,{title:t("export.title"),onClose:e,children:[w.jsxs("div",{className:"modal-body",children:[w.jsxs("div",{className:"export-opts",children:[w.jsxs("label",{children:[t("export.source"),w.jsxs("select",{value:s.source,onChange:k=>$({source:k.target.value}),children:[w.jsx("option",{value:"canvas",children:t("export.sourceCanvas")}),w.jsx("option",{value:"mermaid",children:t("export.sourceMermaid")})]})]}),w.jsxs("label",{children:[t("export.format"),w.jsxs("select",{value:s.format,onChange:k=>$({format:k.target.value}),children:[w.jsx("option",{value:"png",children:t("export.formatPng")}),w.jsx("option",{value:"svg",children:t("export.formatSvg")}),w.jsx("option",{value:"pdf",children:t("export.formatPdf")})]})]}),s.format==="pdf"&&w.jsxs("label",{children:[t("export.page"),w.jsxs("select",{value:s.page,onChange:k=>$({page:k.target.value}),children:[w.jsx("option",{value:"fit",children:t("export.pageFit")}),w.jsx("option",{value:"a4",children:t("export.pageA4")}),w.jsx("option",{value:"letter",children:t("export.pageLetter")})]})]}),w.jsxs("label",{children:[t("export.background"),w.jsxs("select",{value:s.background,onChange:k=>$({background:k.target.value}),children:[w.jsx("option",{value:"dark",children:t("export.bgDark")}),w.jsx("option",{value:"light",children:t("export.bgLight")}),w.jsx("option",{value:"transparent",children:t("export.bgTransparent")})]})]}),s.source==="mermaid"&&w.jsxs("label",{children:[t("export.mermaidTheme"),w.jsxs("select",{value:s.theme,onChange:k=>$({theme:k.target.value}),children:[w.jsx("option",{value:"dark",children:"dark"}),w.jsx("option",{value:"default",children:"default"}),w.jsx("option",{value:"neutral",children:"neutral"}),w.jsx("option",{value:"forest",children:"forest"}),w.jsx("option",{value:"base",children:"base"})]})]}),s.format!=="svg"&&w.jsxs("label",{children:[t("export.quality"),w.jsxs("select",{value:s.scale,onChange:k=>$({scale:Number(k.target.value)}),children:[w.jsx("option",{value:1,children:t("export.quality1")}),w.jsx("option",{value:2,children:t("export.quality2")}),w.jsx("option",{value:3,children:t("export.quality3")})]})]}),s.source==="canvas"&&w.jsxs("label",{children:[t("export.margin",{padding:s.padding}),w.jsx("input",{type:"range",min:0,max:160,step:8,value:s.padding,onChange:k=>$({padding:Number(k.target.value)})})]}),s.format==="pdf"&&w.jsx("p",{className:"field-hint",children:t("export.pdfHint")})]}),w.jsx("div",{className:"export-preview","aria-live":"polite","aria-busy":u,children:d?w.jsx("div",{className:"preview-error",children:d}):l?w.jsx("img",{src:l,alt:t("export.previewAlt"),className:u?"stale":""}):w.jsx("div",{className:"palette-hint",children:t("export.generating")})})]}),w.jsxs("div",{className:"modal-actions",children:[w.jsx("button",{onClick:e,children:t("export.cancel")}),dP()&&w.jsx("button",{onClick:C,disabled:u||!!d,children:g?t("export.copied"):s.format==="svg"?t("export.copyMarkup"):t("export.copyImage")}),w.jsx("button",{className:"primary",onClick:S,disabled:u||!!d,children:t("export.confirm",{format:nO[s.format].extension.toUpperCase()})})]})]})}function $P({onClose:e}){const t=Zt();return w.jsxs(cs,{title:t("about.title"),onClose:e,className:"about",hideTitle:!0,children:[w.jsxs("div",{className:"about-hero",children:[w.jsxs("div",{className:"about-lockup",children:[w.jsx("img",{className:"about-mark",src:"./logo.svg",alt:""}),w.jsx("span",{className:"about-name",children:t("app.name")})]}),w.jsx("p",{className:"about-tagline",children:t("app.tagline")})]}),w.jsxs("div",{className:"about-body about-prose",children:[w.jsxs("p",{children:["Every diagram you draw here is a standard"," ",w.jsx("a",{href:"https://github.com/mermaid-js/mermaid",target:"_blank",rel:"noreferrer",children:"Mermaid"})," ","file — portable, versionable, and readable by humans and AI agents alike. Everything runs locally: your diagrams never leave your machine, and the only request Archyne ever makes is fetching an icon from a link you paste."]}),w.jsxs("p",{children:["Archyne is free software, released under the ",w.jsx("strong",{children:"MIT License"})," — you may use, modify, and redistribute it, commercially too, as long as the license notice travels with it. It is built on the shoulders of open-source projects such as React, React Flow, Mermaid, the Eclipse Layout Kernel, and Iconify, each under a license compatible with this one. The complete inventory, with every notice, lives in"," ",w.jsx("em",{children:"THIRD-PARTY-NOTICES.md"})," alongside the source code. Icon collections are openly licensed (CC0, MIT, Apache-2.0), though the vendor logos they depict remain trademarks of their respective owners."]}),w.jsxs("p",{children:["One exception, and it is deliberate: the ",w.jsx("strong",{children:"Azure architecture icons"})," are Microsoft’s, bundled under"," ",w.jsx("a",{href:"https://learn.microsoft.com/azure/architecture/icons/",target:"_blank",rel:"noreferrer",children:"their own terms"}),", which permit use in architectural diagrams, training materials and documentation. The MIT licence above does not extend to them. ",w.jsx("em",{children:"NOTICE"}),", beside the source, states those terms in full — read it before redistributing a build."]}),w.jsx("p",{className:"about-trademark",children:t("about.trademark")}),w.jsx("p",{className:"about-version",children:t("about.version",{version:"0.3.1-alpha.1"})})]}),w.jsx("div",{className:"modal-actions",children:w.jsx("button",{onClick:e,children:t("about.close")})})]})}const bP=[{id:"approval",kind:"flowchart",nameKey:"tpl.approval",descriptionKey:"tpl.approvalDesc",code:`flowchart TD
|
|
159
|
+
${R6(t)}`,i=(await AE(`export-${Date.now()}`,n)).svg,{svg:s,width:r,height:l}=cP(i,Cw[e.background]);return e.format==="svg"?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`:uP(s,r,l,e.scale,Cw[e.background])}function fP(e){return new Promise((t,n)=>{const i=new Image;i.onload=()=>{const s=document.createElement("canvas");s.width=i.naturalWidth,s.height=i.naturalHeight;const r=s.getContext("2d");if(!r)return n(new Error("no 2d context to read the diagram back from"));r.drawImage(i,0,0);const{data:l}=r.getImageData(0,0,s.width,s.height),c=s.width*s.height,u=new Uint8Array(c*3),f=new Uint8Array(c);let d=!0;for(let m=0;m<c;m++)u[m*3]=l[m*4],u[m*3+1]=l[m*4+1],u[m*3+2]=l[m*4+2],f[m]=l[m*4+3],f[m]!==255&&(d=!1);t({rgb:u,width:s.width,height:s.height,...d?{}:{alpha:f}})},i.onerror=()=>n(new Error("could not read the rendered diagram back")),i.src=e})}function M3(e){return e.format==="pdf"?{...e,format:"png"}:e}async function _3(e,t){if(!e)return"";const[{buildPdf:n,pdfDataUrl:i},s]=await Promise.all([ee(()=>import("./pdf-DIY7PTna.js"),__vite__mapDeps([12,4]),import.meta.url),fP(e)]);return i(n(s,{page:t.page,pixelRatio:t.scale}))}async function dx(e,t,n){if(e.format==="pdf")return _3(await dx(M3(e),t,n),e);if(e.source==="mermaid")return hP(e,n);if(t.length===0)return"";const{width:i,height:s,viewport:r}=oP(t,e.padding);return aP(e.format,i,s,r,Cw[e.background],e.scale)}function iO(e){const t=e.indexOf(",");if(!e.startsWith("data:")||t<0)throw new Error("not a data URL");const n=e.slice(5,t),i=e.slice(t+1),s=n.split(";")[0]||"application/octet-stream";if(n.endsWith(";base64")){const r=atob(i),l=new Uint8Array(r.length);for(let c=0;c<r.length;c++)l[c]=r.charCodeAt(c);return new Blob([l],{type:s})}return new Blob([decodeURIComponent(i)],{type:s})}function dP(){var e;return typeof ClipboardItem<"u"&&typeof((e=navigator.clipboard)==null?void 0:e.write)=="function"}async function pP(e){if(e.startsWith("data:image/svg+xml")){await navigator.clipboard.writeText(await iO(e).text());return}await navigator.clipboard.write([new ClipboardItem({"image/png":iO(e)})])}function mP(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.click()}const fp="*";function gP(e){const t=new URLSearchParams(e).get("origin");if(t===null||t.trim()==="")return null;if(t.trim()===fp)return fp;const n=[];for(const i of t.split(",")){const s=i.trim();if(s)try{const r=new URL(s);if(r.origin==="null"||r.origin!==s.replace(/\/$/,""))continue;n.push(r.origin)}catch{}}return n.length>0?n:null}function yP(){if(rx()){const i=window.acquireVsCodeApi();return{post:s=>i.postMessage(s),accepts:()=>!0}}if(window.parent===window)return null;const e=window.parent,t=gP(location.search);if(t===null)return console.error("[archyne] Embed bridge disabled: no valid `origin` parameter. Load Archyne as `?embed=1&origin=https://your.app` so it knows which origin may read and write the diagram. Use `origin=*` for local development only."),null;const n=t===fp;return n&&console.warn("[archyne] Embed bridge running with `origin=*`: any page framing Archyne can read and modify the diagram. Do not use this in production."),{post:i=>{if(n){e.postMessage(i,fp);return}for(const s of t)e.postMessage(i,s)},accepts:i=>i.source===e&&(n||t.includes(i.origin))}}function wP(){const e=yP();if(!e)return;const t=e.post;window.addEventListener("message",s=>{if(!e.accepts(s))return;const r=s.data;if(!r||typeof r.type!="string")return;const l=ct.getState();(async()=>{try{switch(r.type){case"load":await l.applyCode(String(r.code??""),{record:!0}),t({type:"loaded"});break;case"getCode":t({type:"code",code:l.code});break;case"export":{const c={...R3,...r.options??{}},u=await dx(c,l.nodes,l.code);t({type:"exported",format:c.format,dataUrl:u});break}}}catch(c){t({type:"error",message:c instanceof Error?c.message:String(c)})}})()});let n=ct.getState().code,i;ct.subscribe(s=>{s.code!==n&&(n=s.code,clearTimeout(i),i=setTimeout(()=>t({type:"change",code:n}),300))}),t({type:"ready"})}const sO=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function cs({title:e,onClose:t,className:n="",hideTitle:i=!1,children:s}){const r=Y.useRef(null),l=Y.useId();return Y.useEffect(()=>{var f;const c=document.activeElement,u=r.current;return(f=(u==null?void 0:u.querySelector(sO))??u)==null||f.focus(),()=>{var d;return(d=c==null?void 0:c.focus)==null?void 0:d.call(c)}},[]),Y.useEffect(()=>{const c=r.current;if(!c)return;const u=f=>{if(f.key==="Escape"){f.stopPropagation(),t();return}if(f.key!=="Tab")return;const d=[...c.querySelectorAll(sO)].filter(y=>{var $;return(($=y.checkVisibility)==null?void 0:$.call(y))??!0});if(d.length===0){f.preventDefault();return}const m=d[0],g=d[d.length-1];f.shiftKey&&document.activeElement===m?(f.preventDefault(),g.focus()):!f.shiftKey&&document.activeElement===g&&(f.preventDefault(),m.focus())};return c.addEventListener("keydown",u),()=>c.removeEventListener("keydown",u)},[t]),w.jsx("div",{className:"modal-overlay",role:"presentation",onMouseDown:c=>{c.target===c.currentTarget&&t()},children:w.jsxs("div",{ref:r,className:`modal ${n}`.trim(),role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,children:[w.jsx("h2",{className:i?"visually-hidden":"modal-title",id:l,children:e}),s]})})}function xP({onClose:e}){const t=Zt(),n=ct(k=>k.nodes),i=ct(k=>k.code),[s,r]=Y.useState(R3),[l,c]=Y.useState(""),[u,f]=Y.useState(!0),[d,m]=Y.useState(null),[g,y]=Y.useState(!1),$=k=>r(O=>({...O,...k}));Y.useEffect(()=>{let k=!0;const O=setTimeout(()=>{k&&(f(!0),m(null),dx(M3(s),n,i).then(E=>{k&&(c(E),f(!1))}).catch(E=>{k&&(m(E instanceof Error?E.message:String(E)),f(!1))}))},350);return()=>{k=!1,clearTimeout(O)}},[s,n,i]);const v=k=>m(k instanceof Error?k.message:String(k)),S=()=>{if(!l)return e();const{extension:k}=nO[s.format],O=E=>{mP(E,`diagram.${k}`),e()};if(s.format!=="pdf")return O(l);f(!0),_3(l,s).then(O).catch(E=>{v(E),f(!1)})},C=()=>{l&&pP(l).then(()=>{y(!0),setTimeout(()=>y(!1),1500)}).catch(v)};return w.jsxs(cs,{title:t("export.title"),onClose:e,children:[w.jsxs("div",{className:"modal-body",children:[w.jsxs("div",{className:"export-opts",children:[w.jsxs("label",{children:[t("export.source"),w.jsxs("select",{value:s.source,onChange:k=>$({source:k.target.value}),children:[w.jsx("option",{value:"canvas",children:t("export.sourceCanvas")}),w.jsx("option",{value:"mermaid",children:t("export.sourceMermaid")})]})]}),w.jsxs("label",{children:[t("export.format"),w.jsxs("select",{value:s.format,onChange:k=>$({format:k.target.value}),children:[w.jsx("option",{value:"png",children:t("export.formatPng")}),w.jsx("option",{value:"svg",children:t("export.formatSvg")}),w.jsx("option",{value:"pdf",children:t("export.formatPdf")})]})]}),s.format==="pdf"&&w.jsxs("label",{children:[t("export.page"),w.jsxs("select",{value:s.page,onChange:k=>$({page:k.target.value}),children:[w.jsx("option",{value:"fit",children:t("export.pageFit")}),w.jsx("option",{value:"a4",children:t("export.pageA4")}),w.jsx("option",{value:"letter",children:t("export.pageLetter")})]})]}),w.jsxs("label",{children:[t("export.background"),w.jsxs("select",{value:s.background,onChange:k=>$({background:k.target.value}),children:[w.jsx("option",{value:"dark",children:t("export.bgDark")}),w.jsx("option",{value:"light",children:t("export.bgLight")}),w.jsx("option",{value:"transparent",children:t("export.bgTransparent")})]})]}),s.source==="mermaid"&&w.jsxs("label",{children:[t("export.mermaidTheme"),w.jsxs("select",{value:s.theme,onChange:k=>$({theme:k.target.value}),children:[w.jsx("option",{value:"dark",children:"dark"}),w.jsx("option",{value:"default",children:"default"}),w.jsx("option",{value:"neutral",children:"neutral"}),w.jsx("option",{value:"forest",children:"forest"}),w.jsx("option",{value:"base",children:"base"})]})]}),s.format!=="svg"&&w.jsxs("label",{children:[t("export.quality"),w.jsxs("select",{value:s.scale,onChange:k=>$({scale:Number(k.target.value)}),children:[w.jsx("option",{value:1,children:t("export.quality1")}),w.jsx("option",{value:2,children:t("export.quality2")}),w.jsx("option",{value:3,children:t("export.quality3")})]})]}),s.source==="canvas"&&w.jsxs("label",{children:[t("export.margin",{padding:s.padding}),w.jsx("input",{type:"range",min:0,max:160,step:8,value:s.padding,onChange:k=>$({padding:Number(k.target.value)})})]}),s.format==="pdf"&&w.jsx("p",{className:"field-hint",children:t("export.pdfHint")})]}),w.jsx("div",{className:"export-preview","aria-live":"polite","aria-busy":u,children:d?w.jsx("div",{className:"preview-error",children:d}):l?w.jsx("img",{src:l,alt:t("export.previewAlt"),className:u?"stale":""}):w.jsx("div",{className:"palette-hint",children:t("export.generating")})})]}),w.jsxs("div",{className:"modal-actions",children:[w.jsx("button",{onClick:e,children:t("export.cancel")}),dP()&&w.jsx("button",{onClick:C,disabled:u||!!d,children:g?t("export.copied"):s.format==="svg"?t("export.copyMarkup"):t("export.copyImage")}),w.jsx("button",{className:"primary",onClick:S,disabled:u||!!d,children:t("export.confirm",{format:nO[s.format].extension.toUpperCase()})})]})]})}function $P({onClose:e}){const t=Zt();return w.jsxs(cs,{title:t("about.title"),onClose:e,className:"about",hideTitle:!0,children:[w.jsxs("div",{className:"about-hero",children:[w.jsxs("div",{className:"about-lockup",children:[w.jsx("img",{className:"about-mark",src:"./logo.svg",alt:""}),w.jsx("span",{className:"about-name",children:t("app.name")})]}),w.jsx("p",{className:"about-tagline",children:t("app.tagline")})]}),w.jsxs("div",{className:"about-body about-prose",children:[w.jsxs("p",{children:["Every diagram you draw here is a standard"," ",w.jsx("a",{href:"https://github.com/mermaid-js/mermaid",target:"_blank",rel:"noreferrer",children:"Mermaid"})," ","file — portable, versionable, and readable by humans and AI agents alike. Everything runs locally: your diagrams never leave your machine, and the only request Archyne ever makes is fetching an icon from a link you paste."]}),w.jsxs("p",{children:["Archyne is free software, released under the ",w.jsx("strong",{children:"MIT License"})," — you may use, modify, and redistribute it, commercially too, as long as the license notice travels with it. It is built on the shoulders of open-source projects such as React, React Flow, Mermaid, the Eclipse Layout Kernel, and Iconify, each under a license compatible with this one. The complete inventory, with every notice, lives in"," ",w.jsx("em",{children:"THIRD-PARTY-NOTICES.md"})," alongside the source code. Icon collections are openly licensed (CC0, MIT, Apache-2.0), though the vendor logos they depict remain trademarks of their respective owners."]}),w.jsxs("p",{children:["One exception, and it is deliberate: the ",w.jsx("strong",{children:"Azure architecture icons"})," are Microsoft’s, bundled under"," ",w.jsx("a",{href:"https://learn.microsoft.com/azure/architecture/icons/",target:"_blank",rel:"noreferrer",children:"their own terms"}),", which permit use in architectural diagrams, training materials and documentation. The MIT licence above does not extend to them. ",w.jsx("em",{children:"NOTICE"}),", beside the source, states those terms in full — read it before redistributing a build."]}),w.jsx("p",{className:"about-trademark",children:t("about.trademark")}),w.jsx("p",{className:"about-version",children:t("about.version",{version:"0.3.2-alpha.1"})})]}),w.jsx("div",{className:"modal-actions",children:w.jsx("button",{onClick:e,children:t("about.close")})})]})}const bP=[{id:"approval",kind:"flowchart",nameKey:"tpl.approval",descriptionKey:"tpl.approvalDesc",code:`flowchart TD
|
|
160
160
|
submit[/"Submit request"/]
|
|
161
161
|
review{"Manager approves?"}
|
|
162
162
|
budget{"Over budget?"}
|