1import{$ as e,B as t,C as n,F as r,I as i,J as a,L as o,N as s,P as c,R as l,T as u,Tt as d,U as f,V as p,X as m,_t as h,at as g,bt as _,ct as v,dt as y,f as b,ht as x,i as S,it as C,lt as w,mt as T,o as E,pt as D,q as O,ut as k,w as A,wt as j,xt as M,y as N,z as P}from"./DLg-vmKF.js";import{o as F,p as I}from"./HZPswVe-.js";import"./xihTtKlq.js";import{t as L}from"./Pl-DEOOm.js";import{n as R}from"./BCTQZqmF.js";import{t as z}from"./Dqphup8O.js";import"./CX6j91PB.js";import{i as B,n as V,r as H,t as U}from"./yrzOVB-m.js";import{t as W}from"./D0VBjyxL.js";var G=p(`<div class="overflow-hidden flex flex-col gap-1 svelte-yayuls"><div><div class="svelte-yayuls"></div></div> <!></div>`);function K(t,r){M(r,!0);let i=E(r,`code`,15),a=E(r,`editable`,3,!1),s,c=T(null),p=T(!1);g(()=>{i()&&D(p,!0)});let x=T(y(r.initialExpanded??!1)),S=T(!1),w=h(()=>r.minHeight||450);g(()=>{if(s&&m(p)){let t=e(()=>i()),n=e(()=>r.highlight),o=a()?U(r.language,e=>{i(e)},n):V(r.language,n);return D(c,new H({state:B.create({doc:t,extensions:o}),parent:s}),!0),()=>{m(c)?.destroy(),D(c,null)}}}),g(()=>{if(s){let e=new ResizeObserver(()=>{D(S,s.scrollHeight>m(w))});return e.observe(s),()=>e.disconnect()}});let O=T(!1);g(()=>{if(m(O)||!m(c)||!r.highlight?.length||!m(S)||m(x))return;let e=m(c),t=s.parentElement,n=Math.min(...r.highlight);if(t&&n>=1&&n<=e.state.doc.lines){let r=e.lineBlockAt(e.state.doc.line(n).from);t.scrollTop=r.top+r.height/2-t.clientHeight/2,D(O,!0)}});function N(e){m(c)&&m(c).dispatch({changes:{from:0,to:m(c).state.doc.length,insert:e}})}var F={updateContent:N},I=G(),L=v(I);b(v(L),e=>s=e,()=>s),d(L);var R=k(L,2),W=e=>{z(e,{variant:`outline`,size:`sm`,onclick:()=>D(x,!m(x)),children:(e,t)=>{j();var n=f();C(()=>l(n,m(x)?`Show Less`:`Show More`)),P(e,n)},$$slots:{default:!0}})};return o(R,e=>{m(S)&&e(W)}),d(I),C(()=>{A(L,1,u(!m(x)&&m(S)?`overflow-auto`:`overflow-hidden`),`svelte-yayuls`),n(L,!m(x)&&m(S)?`max-height: ${m(w)}px`:void 0)}),P(t,I),_(F)}var q=p(`<iframe sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-downloads" title="Diagram Preview" class="w-full h-full min-h-75 lg:min-h-100"></iframe>`);function J(t,r){M(r,!0);let i=E(r,`animation`,3,!1),o=E(r,`noScaffolding`,3,!1),s=E(r,`themed`,3,!1),c=E(r,`exampleUI`,3,!1),l=E(r,`extraScripts`,19,()=>[]),u,d=T(``),f=null;g(()=>{let e=v();return f&&clearTimeout(f),f=setTimeout(()=>{D(d,e,!0)},300),()=>{f&&clearTimeout(f)}});function p(){s()&&u?.contentWindow?.postMessage({type:`setTheme`,isDark:L.isDark},`*`)}g(()=>{L.isDark,p()});function h(e){return e.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$/g,`\\$`)}function v(){let t=h(r.code),n=l().map(e=>` <script src="${e}"><\/script>`).join(` 2`),a=o()?`// goCode2: user code creates its own diagram 3 const userCode = \`${t}\`; 4 const fn = new Function('go', userCode); 5 fn(go);`:`const div = document.createElement('div'); 6 div.className = 'diagramStyling'; 7 8 ${r.parentElementId?`const parentEl = document.getElementById('${r.parentElementId}'); 9 if (parentEl) { 10 parentEl.appendChild(div); 11 } else { 12 document.body.appendChild(div); 13 }`:`document.body.appendChild(div);`} 14 15 // Create diagram and provide goCode scaffolding variables 16 const diagram = new go.Diagram(div); 17 diagram.animationManager.isInitial = ${i()}; 18 const $ = go.GraphObject.make; 19 20 // Execute user code with diagram and $ in scope 21 const userCode = \`${t}\`; 22 const fn = new Function('diagram', '$', userCode); 23 fn(diagram, $);`;return`<!DOCTYPE html> 24<html${s()&&e(()=>L.isDark)?` class="dark"`:``}> 25<head> 26 <meta charset="UTF-8"> 27 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 28 ${s()?`<link rel="stylesheet" href="${I(`/theme-tokens.css`)}">`:``} 29 <script src="${I(`/release/go.js`)}"><\/script> 30${n} 31 <style> 32 /* The iframe is its own document, so it needs its own @font-face to reach the site 33 font. Declared but not applied: examples opt in with font-family: var(--font-sans). */ 34 @font-face { 35 font-family: InterVariable; 36 font-style: normal; 37 font-weight: 100 900; 38 font-display: swap; 39 src: url('${I(`/fonts/InterVariable.woff2`)}') format('woff2'); 40 } 41 :root { 42 --font-sans: InterVariable, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 43 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; 44 } 45 ${s()?`:root { color-scheme: light; } 46 :root.dark { color-scheme: dark; }`:`:root { color-scheme: dark; }`} 47 body, html { 48 margin: 0; 49 padding: 0; 50 font-family: sans-serif; 51 height: 100%; 52 overflow: hidden; 53 } 54 .diagramStyling { 55 background: whitesmoke; 56 width: 100%; 57 height: 100%; 58 margin: -1px; 59 max-height: 700px; 60 } 61 body.has-html { 62 display: flex; 63 flex-direction: column; 64 height: 100%; 65 } 66 body.has-html .diagramStyling { 67 flex: 1; 68 height: auto; 69 } 70 .extra-html { 71 padding: 8px; 72 flex-shrink: 0; 73 } 74 button, input[type="button"] { 75 border: 1px solid rgba(255, 255, 255, 0.15); 76 padding: 6px 12px; border-radius: 6px; font: 12px sans-serif; margin: 4px; 77 } 78 </style> 79 ${s()&&c()?`<link rel="stylesheet" href="${I(`/example-ui.css`)}">`:``} 80</head> 81<body${r.html?` class="has-html"`:``}> 82 ${o()?`<div id="myDiagramDiv" class="diagramStyling"></div>`:r.parentElementId?`<div id="${r.parentElementId}"></div>`:``} 83 <script> 84 requestAnimationFrame(function() {
85 try { 86 ${a} 87 } catch (error) { 88 console.error('Error executing diagram code:', error); 89 document.body.innerHTML = '<div style="color: red; padding: 10px;">Error: ' + error.message + '</div>'; 90 } 91 }); 92 <\/script> 93 ${s()?`<script> 94 // Receive the site theme from the parent without reloading and mirror it onto 95 // <html> so the color-scheme / token variables above respond. 96 window.addEventListener('message', function(e) { 97 if (e.data && e.data.type === 'setTheme') { 98 document.documentElement.classList.toggle('dark', !!e.data.isDark); 99 } 100 }); 101 <\/script>`:``} 102 ${r.html?`<div class="extra-html">${r.html}</div>`:``} 103</body> 104</html>`}var y=q();b(y,e=>u=e,()=>u),C(()=>{N(y,`srcdoc`,m(d)),n(y,typeof r.minHeight==`number`?`min-height: ${r.minHeight}px`:``)}),O(`load`,y,p),a(y),P(t,y),_()}var Y=p(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"></path><path d="M3 3v5h5"></path></svg> <span>Reset</span>`,1),X=p(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg> <span>Download</span>`,1),Z=p(`<div class="flex items-center gap-2 bg-editor-bg"><!> <!></div>`);function Q(e,t){var n=Z(),r=v(n);z(r,{variant:`ghost`,size:`sm`,get onclick(){return t.onReset},title:`Reset to original code`,children:(e,t)=>{var n=Y();j(2),P(e,n)},$$slots:{default:!0}}),z(k(r,2),{variant:`ghost`,size:`sm`,get onclick(){return t.onDownload},title:`Download as HTML file`,children:(e,t)=>{var n=X();j(2),P(e,n)},$$slots:{default:!0}}),d(n),P(e,n)}function $(e){let t=e.match(/\/extensions\/(.+)$/);return t?`https://cdn.jsdelivr.net/npm/gojs-extensions@latest/extensions/${t[1]}`:e}function ee({code:e,noScaffolding:t=!1,parentElementId:n,animation:r=!1,html:i,extraScripts:a=[]}){let o=a.map(e=>` <script src="${$(e)}"><\/script>`).join(` 105`),s=t?` // User code creates its own diagram 106 ${e}`:` const div = document.createElement('div'); 107 div.className = 'diagramStyling'; 108 109 ${n?`const parentEl = document.getElementById('${n}'); 110 if (parentEl) { 111 parentEl.appendChild(div); 112 } else { 113 document.body.appendChild(div); 114 }`:`document.body.appendChild(div);`} 115 116 // Create diagram and provide GoJS scaffolding 117 const diagram = new go.Diagram(div); 118 ${r?`diagram.animationManager.isInitial = true;`:``}; 119 120 // User code 121 ${e}`,c=`${t?`<div id="myDiagramDiv" class="diagramStyling"></div>`:n?`<div id="${n}"></div>`:``} 122<script> 123 function init() { 124${s} 125 } 126 127 // Wait until the DOM is ready before creating the diagram 128 document.addEventListener('DOMContentLoaded', init); 129<\/script>`;return`<!DOCTYPE html> 130<html> 131<head> 132 <meta charset="UTF-8"> 133 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 134 <title>GoJS Diagram</title> 135 <script src="https://cdn.jsdelivr.net/npm/gojs@latest"><\/script>${o?`\n${o}`:``} 136 <style> 137 body, html { 138 margin: 0; 139 padding: 0; 140 font-family: sans-serif; 141 height: 100%; 142 } 143 .diagramStyling { 144 background: white; 145 width: 100%; 146 height: 100%; 147 }${i?` 148 body.has-html { 149 display: flex; 150 flex-direction: column; 151 height: 100%; 152 } 153 body.has-html .diagramStyling { 154 flex: 1; 155 height: auto; 156 } 157 .extra-html { 158 padding: 8px; 159 flex-shrink: 0; 160 }`:``} 161 </style> 162</head> 163<body${i?` class="has-html"`:``}> 164 ${c} 165 ${i?`<div class="extra-html">${i}</div>`:``} 166</body> 167</html>`}var te=p(`<div><!> <!></div>`),ne=p(`<div><!> <div><!></div></div>`);function re(e,t){M(t,!0);let r=E(t,`animation`,3,!1),a=E(t,`split`,3,60),s=E(t,`wide`,3,!1),c=E(t,`noScaffolding`,3,!1),l=E(t,`stacked`,3,!1),f=E(t,`hideCode`,3,!1),p=E(t,`themed`,3,!1),h=E(t,`exampleUI`,3,!1);E(t,`initiallyVisible`,3,!0);let y=E(t,`extraScripts`,19,()=>[]),b=T(``),S=T(``),w=T(0);g(()=>{m(b)||(D(b,t.code,!0),D(S,t.code,!0))});function O(){D(S,m(b),!0),x(w)}function j(){let e=ee({code:m(S),noScaffolding:c(),parentElementId:t.parentElementId,animation:r(),html:t.html,extraScripts:y()}),n=new Blob([e],{type:`text/html`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`diagram.html`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}var N=ne();let F;var I=v(N),L=e=>{var r=te(),o=v(r);Q(o,{onReset:O,onDownload:j}),i(k(o,2),()=>m(w),e=>{K(e,{language:`javascript`,editable:!0,get highlight(){return t.highlight},get minHeight(){return t.minHeight},get initialExpanded(){return t.expanded},get code(){return m(S)},set code(e){D(S,e,!0)}})}),d(r),C(e=>{A(r,1,e,`svelte-1x7kvj4`),n(r,l()?void 0:`flex: ${a()}`)},[()=>u(R(!l()&&`flex-[${a()}] lg:min-w-0 lg:flex lg:flex-col lg:gap-1`))]),P(e,r)};o(I,e=>{f()||e(L)});var z=k(I,2);J(v(z),{get code(){return m(S)},get parentElementId(){return t.parentElementId},get animation(){return r()},get noScaffolding(){return c()},get html(){return t.html},get themed(){return p()},get exampleUI(){return h()},get minHeight(){return t.minHeight},get extraScripts(){return y()}}),d(z),d(N),C((e,t)=>{F=A(N,1,e,`svelte-1x7kvj4`,F,{wide:s()}),A(z,1,t,`svelte-1x7kvj4`),n(z,l()||f()?void 0:`flex: ${100-a()}`)},[()=>u(R(`code-example my-4 p-2 rounded-lg flex flex-col gap-1`,p()?`bg-muted dark:bg-editor-bg`:`dark scheme-dark bg-editor-bg`,!(l()||f())&&`lg:flex-row lg:items-stretch`)),()=>u(R(`flex justify-center items-start`,!(l()||f())&&`lg:min-w-0`))]),P(e,N),_()}var ie=p(`<div class="max-w-5xl ms-0 2xl:mx-auto"></div>`),ae=p(`<div class="max-w-7xl mx-auto"></div>`);function oe(e,n){M(n,!0);let i=E(n,`extraScripts`,19,()=>[]),a=E(n,`pageScript`,3,null),l=h(()=>n.htmlContent.split(/<!-- CODE_BLOCK_(\d+) -->/)),u;function f(e){let t=e.target?.closest(`a.heading-anchor`);if(!t)return;e.preventDefault();let n=decodeURIComponent(new URL(t.href).hash.slice(1)),r=document.getElementById(n);r&&(r.scrollIntoView({behavior:`smooth`}),F(`#${n}`,{}))}S(()=>{u.addEventListener(`click`,f);let e=decodeURIComponent(location.hash.slice(1));return e&&(document.fonts?.ready??Promise.resolve()).then(()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView()}))}),()=>u.removeEventListener(`click`,f)}),S(()=>
167{if(!a())return;let e=I(`/release/go.js`),t=document.createElement(`script`);t.src=e,t.onload=()=>{let e=document.createElement(`script`);e.textContent=a(),document.body.appendChild(e)},document.head.appendChild(t)});var p=ae();c(p,21,()=>m(l),r,(e,r,a)=>{var c=t(),l=w(c),u=e=>{var t=ie();s(t,()=>m(r),!0),d(t),P(e,t)},f=e=>{let a=h(()=>parseInt(m(r))),s=h(()=>n.codeBlocks[m(a)]);var c=t(),l=w(c),u=e=>{var n=t(),r=w(n),a=e=>{{let t=h(()=>m(s).initiallyVisible??!0);re(e,{get code(){return m(s).code},get parentElementId(){return m(s).parentElementId},get animation(){return m(s).animation},get split(){return m(s).split},get expanded(){return m(s).expanded},get wide(){return m(s).wide},get noScaffolding(){return m(s).noScaffolding},get stacked(){return m(s).stacked},get html(){return m(s).html},get hideCode(){return m(s).hideCode},get themed(){return m(s).themed},get exampleUI(){return m(s).exampleUI},get minHeight(){return m(s).minHeight},get highlight(){return m(s).highlight},get initiallyVisible(){return m(t)},get extraScripts(){return i()}})}},c=e=>{W(e,{get code(){return m(s).code},get language(){return m(s).language}}
167)};o(r,e=>{m(s).isExecutable?e(a):e(c,-1)}),P(e,n)};o(l,e=>{m(s)&&e(u)}),P(e,c)};o(l,e=>{a%2==0?e(u):e(f,-1)}),P(e,c)}),d(p),b(p,e=>u=e,()=>u),P(e,p),_()}export{oe as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.