living-ai-documentation 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frontend-svelte/assets/{index-DemWpj2z.css → index-CYlnVWjo.css} +1 -1
- package/dist/frontend-svelte/assets/{index-BqDe9zqT.js → index-mhoNMCKf.js} +25 -25
- package/dist/frontend-svelte/assets/{main-BIFGig6a.js → main-BIcAk_fU.js} +1 -1
- package/dist/frontend-svelte/i18n/en.json +4 -1
- package/dist/frontend-svelte/i18n/fr.json +4 -1
- package/dist/frontend-svelte/index.html +2 -2
- package/package.json +1 -1
|
@@ -26,21 +26,21 @@ import e from"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
|
|
26
26
|
`)}function Gf(e,t){let n=Number(e.slice(-1)),r=Lf(t.text&&t.text.trim(),t.fallback);return`${`#`.repeat(n)} ${r}`}function Kf(e){return`})`}function qf(e){let t=gd({style:e.style||``,border:e.bordered?`bordered`:``,color:e.color||``});return(t?t+`
|
|
27
27
|
`:``)+e.markdown}function Jf(e){return`[](/diagram?id=${e.id})`}function Yf(e){return`<span style="color:${e.color.border};">${e.content}</span>`}function Xf(e){return`<div style="background:${e.color.bg};border-left:4px solid ${e.color.border};color:${e.color.text};padding:1rem 1.25rem;border-radius:0.375rem;margin:1rem 0;">\n\n${e.content}\n\n</div>`}function Zf(e,t){switch(e){case`collapsible`:return Rf(t);case`link`:return zf(t);case`doc-link`:return Bf(t);case`anchor-link`:return Vf(t);case`anchor-doc-link`:return Hf(t);case`ordered-list`:return Ff(t.content);case`unordered-list`:return If(t.content);case`code-block`:return Uf(t);case`blockquote`:return Wf(t);case`separator`:return`
|
|
28
28
|
---
|
|
29
|
-
`;case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:return Gf(e,t);case`image`:return Kf(t);case`table`:return qf(t);case`tree`:return t.markdown;case`diagram`:return Jf(t);case`colored-text`:return Yf(t);case`colored-section`:return Xf(t);case`emojis`:return t.value;case`local-search`:return`<div data-ld-local-search></div>`;default:return``}}function Qf(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}
|
|
30
|
-
`)}function
|
|
31
|
-
`).filter(e=>/^\|.*\|$/.test(e.trim())).filter(e=>!vd(e)).map(_d),r=n.length?Math.max(...n.map(e=>e.length)):0;return n.forEach(e=>{for(;e.length<r;)e.push(``)}),{attrs:t,rows:n}}function
|
|
29
|
+
`;case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:return Gf(e,t);case`image`:return Kf(t);case`table`:return qf(t);case`tree`:return t.markdown;case`diagram`:return Jf(t);case`colored-text`:return Yf(t);case`colored-section`:return Xf(t);case`emojis`:return t.value;case`local-search`:return`<div data-ld-local-search></div>`;default:return``}}function Qf(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var $f=2,ep=2,tp=1,np=1,rp=`snip-table-context-menu`;function ip(e){return{data:[],onPreview:e}}function ap(e){e.data=[Array.from({length:ep},(e,t)=>`En-tête ${t+1}`),Array(ep).fill(``)];let t=document.getElementById(`snip-table-style`);t&&(t.value=``);let n=document.getElementById(`snip-table-bordered`);n&&(n.checked=!1);let r=document.getElementById(`snip-table-color`);r&&(r.value=``),_p(e)}function op(e){for(e.data.length||(e.data=Array.from({length:$f},(e,t)=>Array.from({length:ep},(e,n)=>t===0?`En-tête ${n+1}`:``)));e.data.length<tp;)e.data.push([]);let t=Math.max(np,...e.data.map(e=>e.length));e.data.forEach(e=>{for(;e.length<t;)e.push(``)})}function sp(e,t,n=!1){queueMicrotask(()=>{let r=document.querySelector(`#snip-table-grid input[data-tr="${e}"][data-tc="${t}"]`);if(r)if(r.focus({preventScroll:!0}),n)r.select();else{let e=r.value.length;r.setSelectionRange(e,e)}})}function cp(e,t){op(e);let n=e.data[0]?.length??np;e.data.forEach(e=>e.push(``)),_p(e),sp(t,n)}function lp(e,t,n=!1){op(e);let r=e.data.length,i=e.data[0]?.length??np;e.data.push(Array(i).fill(``)),_p(e),sp(r,Math.max(0,Math.min(t,i-1)),n)}function up(e,t,n,r=!1){op(e);let i=e.data.length,a=e.data[0]?.length??np,o=Math.max(0,Math.min(t,i-1)),s=n;s=Math.max(0,Math.min(s,a-1)),sp(o,s,r)}function dp(e,t){mp(),op(e);let n=e.data[0]?.length??np;n<=np||(e.data.forEach(e=>e.splice(t,1)),_p(e),sp(0,Math.max(0,Math.min(t,n-2))))}function fp(e,t){if(mp(),op(e),e.data.length<=tp)return;let n=e.data[0]?.length??np;e.data.splice(t,1),_p(e),sp(Math.max(0,Math.min(t,e.data.length-1)),Math.min(n-1,0))}function pp(e,t,n){mp();let r=Number(t.dataset.tr),i=Number(t.dataset.tc),a=e.data.length,o=e.data[0]?.length??np;if(n.key===`Tab`){if(n.preventDefault(),n.shiftKey){i>0?up(e,r,i-1,!0):r>0?up(e,r-1,o-1,!0):up(e,r,i,!0);return}i<o-1?up(e,r,i+1,!0):r<a-1?up(e,r+1,0,!0):lp(e,0,!0);return}if(n.key===`ArrowUp`){n.preventDefault(),up(e,r-1,i);return}if(n.key===`ArrowDown`){n.preventDefault(),r<a-1?up(e,r+1,i):lp(e,i);return}if(n.key===`ArrowLeft`){n.preventDefault(),up(e,r,i-1);return}n.key===`ArrowRight`&&(n.preventDefault(),i<o-1?up(e,r,i+1):cp(e,r))}function mp(){document.getElementById(rp)?.remove()}function hp(e,t,n){n.preventDefault(),mp(),op(e);let r=Number(t.dataset.tr),i=Number(t.dataset.tc),a=e.data.length>tp,o=(e.data[0]?.length??np)>np,s=document.createElement(`div`);s.id=rp,s.className=`fixed z-[80] min-w-44 overflow-hidden rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-lg text-sm`,s.style.left=`${n.clientX}px`,s.style.top=`${n.clientY}px`;let c=document.createElement(`button`);c.type=`button`,c.textContent=Y(`snippet.table_delete_row`),c.disabled=!a,c.className=`block w-full px-3 py-2 text-left text-gray-700 dark:text-gray-100 hover:bg-red-50 dark:hover:bg-red-900/30 disabled:opacity-40 disabled:hover:bg-transparent`,c.addEventListener(`click`,()=>fp(e,r)),s.appendChild(c);let l=document.createElement(`button`);l.type=`button`,l.textContent=Y(`snippet.table_delete_column`),l.disabled=!o,l.className=`block w-full px-3 py-2 text-left text-gray-700 dark:text-gray-100 hover:bg-red-50 dark:hover:bg-red-900/30 disabled:opacity-40 disabled:hover:bg-transparent`,l.addEventListener(`click`,()=>dp(e,i)),s.appendChild(l),document.body.appendChild(s),window.setTimeout(()=>{document.addEventListener(`click`,mp,{once:!0})},0)}function gp(){let e=document.getElementById(`snip-table-style`)?.value,t=document.getElementById(`snip-table-bordered`)?.checked,n=document.getElementById(`snip-table-color`)?.value;return[`ld-table-edit-table`,`w-full`,`table-fixed`,`border-collapse`,e?`table-style-${e}`:``,t?`table-border-bordered`:``,n?`table-color-${n}`:``].filter(Boolean).join(` `)}function _p(e){op(e);let t=e.data.length,n=e.data[0]?.length??0,r=document.getElementById(`snip-table-rows`);r&&(r.textContent=String(t));let i=document.getElementById(`snip-table-cols`);i&&(i.textContent=String(n));let a=`ld-table-edit-input block w-full min-w-[160px] bg-transparent border-0 rounded-none focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500`,o=`${a} font-semibold`,s=`${a}`,c=`<div class="ld-table-editor min-w-full overflow-x-auto rounded-md bg-white dark:bg-gray-950">`;c+=`<table class="${gp()}"><tbody>`;for(let r=0;r<t;r++){c+=`<tr>`;for(let t=0;t<n;t++){let n=r===0?o:s;c+=`<td><input type="text" value="${Qf(e.data[r][t])}" data-tr="${r}" data-tc="${t}" class="${n}" /></td>`}c+=`</tr>`}c+=`</tbody></table></div>`;let l=document.getElementById(`snip-table-grid`);l&&(l.innerHTML=c,l.querySelectorAll(`input[data-tr]`).forEach(t=>{t.addEventListener(`input`,()=>{let n=Number(t.dataset.tr),r=Number(t.dataset.tc);e.data[n][r]=t.value,e.onPreview()}),t.addEventListener(`keydown`,n=>pp(e,t,n)),t.addEventListener(`contextmenu`,n=>hp(e,t,n)),t.addEventListener(`mouseup`,n=>{n.button===2&&hp(e,t,n)})})),e.onPreview()}function vp(e){let t=e.data;if(!t.length||!t[0]?.length)return``;let n=t[0].length,r=Array(n).fill(3);t.forEach(e=>{e.forEach((e,t)=>{r[t]=Math.max(r[t],e.length)})});let i=e=>`| `+e.map((e,t)=>e.padEnd(r[t])).join(` | `)+` |`,a=`| `+r.map(e=>`-`.repeat(e)).join(` | `)+` |`;return[i(t[0]),a,...t.slice(1).map(i)].join(`
|
|
30
|
+
`)}function yp(e){let t=hd(e),n=e.split(`
|
|
31
|
+
`).filter(e=>/^\|.*\|$/.test(e.trim())).filter(e=>!vd(e)).map(_d),r=n.length?Math.max(...n.map(e=>e.length)):0;return n.forEach(e=>{for(;e.length<r;)e.push(``)}),{attrs:t,rows:n}}function bp(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function xp(e){return{items:[],onPreview:e}}function Sp(e){e.items=[{name:`dossier/`,depth:0},{name:`fichier.md`,depth:1}],Cp(e)}function Cp(e){let t=`text-xs px-1.5 py-1 rounded border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,n=document.getElementById(`snip-tree-list`);n&&(n.innerHTML=e.items.map((e,n)=>`
|
|
32
32
|
<div class="flex items-center gap-1">
|
|
33
33
|
<button data-tree-indent="${n}" data-tree-delta="-1" ${e.depth===0?`disabled`:``} class="${t}" title="Désindenter">←</button>
|
|
34
34
|
<button data-tree-indent="${n}" data-tree-delta="1" class="${t}" title="Indenter">→</button>
|
|
35
35
|
<span class="text-xs text-gray-300 dark:text-gray-600 font-mono w-4 shrink-0 text-center">${e.depth>0?e.depth:``}</span>
|
|
36
|
-
<input type="text" value="${
|
|
36
|
+
<input type="text" value="${bp(e.name)}" data-tree-name="${n}"
|
|
37
37
|
class="flex-1 px-2 py-1 text-xs rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500 font-mono" />
|
|
38
38
|
<button data-tree-remove="${n}" class="${t}" title="Supprimer">×</button>
|
|
39
|
-
</div>`).join(``),n.querySelectorAll(`button[data-tree-indent]`).forEach(t=>{t.addEventListener(`click`,()=>
|
|
40
|
-
`)+"\n```"}function
|
|
41
|
-
`).map(e=>{let t=e.match(/^((?:│ | )*)(?:├── |└── )([\s\S]+)$/);return t?{name:t[2],depth:t[1].length/4+1}:{name:e,depth:0}})}}function
|
|
39
|
+
</div>`).join(``),n.querySelectorAll(`button[data-tree-indent]`).forEach(t=>{t.addEventListener(`click`,()=>wp(e,Number(t.dataset.treeIndent),Number(t.dataset.treeDelta)))}),n.querySelectorAll(`input[data-tree-name]`).forEach(t=>{t.addEventListener(`input`,()=>{e.items[Number(t.dataset.treeName)].name=t.value,e.onPreview()})}),n.querySelectorAll(`button[data-tree-remove]`).forEach(t=>{t.addEventListener(`click`,()=>Ep(e,Number(t.dataset.treeRemove)))}),e.onPreview())}function wp(e,t,n){e.items[t].depth=Math.max(0,e.items[t].depth+n),Cp(e)}function Tp(e){let t=e.items.length?e.items[e.items.length-1].depth:0;e.items.push({name:``,depth:t}),Cp(e)}function Ep(e,t){e.items.splice(t,1),Cp(e)}function Dp(e){let t=e.items;if(!t.length)return"```text\n(vide)\n```";let n=[];for(let e=0;e<t.length;e++){let{name:r,depth:i}=t[e];if(i===0){n.push(r);continue}let a=``;for(let n=0;n<i-1;n++){let r=!1;for(let i=e+1;i<t.length;i++)if(t[i].depth<=n+1){r=t[i].depth===n+1;break}a+=r?`│ `:` `}let o=!0;for(let n=e+1;n<t.length&&!(t[n].depth<i);n++)if(t[n].depth===i){o=!1;break}n.push(a+(o?`└── `:`├── `)+r)}return"```text\n"+n.join(`
|
|
40
|
+
`)+"\n```"}function Op(e){return{items:e.replace(/^```text\n/,``).replace(/\n```$/,``).split(`
|
|
41
|
+
`).map(e=>{let t=e.match(/^((?:│ | )*)(?:├── |└── )([\s\S]+)$/);return t?{name:t[2],depth:t[1].length/4+1}:{name:e,depth:0}})}}function kp(e,t){if(!t)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`^`+n,`gm`),``)}function Ap(e){let t=e.match(/<summary>([\s\S]*?)<\/summary>/i),n=e.match(/<details\b[^>]*>[\s\S]*?<\/summary>\s*\n?([\s\S]*?)\s*<\/details>\s*$/i);return{summary:t?t[1].trim():void 0,body:n?n[1].trim():``}}function jp(e){let t=e.match(/^\[([\s\S]*?)\]\(([\s\S]*?)\)$/);return t?{text:t[1],url:t[2]}:{}}function Mp(e){let t=e.match(/^\[([\s\S]*?)\]\(\?doc=([\s\S]*?)\)$/);return t?{text:t[1],docId:decodeURIComponent(t[2])}:{}}function Np(e){let t=e.match(/^\[([\s\S]*?)\]\(#([\s\S]*?)\)$/);return t?{text:t[1],anchor:t[2]}:{}}function Pp(e){let t=e.match(/^\[([\s\S]*?)\]\(\?doc=([\s\S]*?)#([\s\S]*?)\)$/);return t?{text:t[1],docId:decodeURIComponent(t[2]),anchor:t[3]}:{}}function Fp(e,t={}){let n=e.match(/^```[ \t]*([^\n]*)\n([\s\S]*?)\n[ \t]*```$/);return n?{lang:n[1].trim(),code:kp(n[2],t.inlineIndent||``)}:{lang:``,code:``}}function Ip(e){return{content:e.split(`
|
|
42
42
|
`).map(e=>e.replace(/^>\s?/,``)).join(`
|
|
43
|
-
`)}}function Cp(e){let t=e.match(/^!\[([\s\S]*?)\]\(([\s\S]*?)\)$/);return t?{alt:t[1],url:t[2]}:{}}function wp(e,t){let n=Number(e.slice(-1)),r=t.match(RegExp(`^#{${n}}\\s+(.+)$`));return{text:r?r[1].trim():``}}function Tp(e){let t=e.match(/^<span\s[^>]*color:([^;>"]+)[^>]*>([\s\S]*)<\/span>$/);return t?{color:t[1].trim(),content:t[2]}:{}}function Ep(e){let t=e.match(/border-left:[^;]*solid\s+(#[0-9a-fA-F]{6})/),n=e.match(/^<div[^>]*>\n\n([\s\S]*?)\n\n<\/div>$/);return{borderColor:t?t[1]:void 0,content:n?n[1]:void 0}}function Dp(e,t,n={}){let r=(t||``).trim();switch(e){case`collapsible`:return gp(r);case`link`:return _p(r);case`doc-link`:return vp(r);case`anchor-link`:return yp(r);case`anchor-doc-link`:return bp(r);case`ordered-list`:case`unordered-list`:return{content:r};case`code-block`:return xp(r,n);case`blockquote`:return Sp(r);case`image`:return Cp(r);case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:return wp(e,r);case`table`:return ap(r);case`tree`:return mp(r);case`colored-text`:return Tp(r);case`colored-section`:return Ep(r);default:return{}}}function Op(e){let t=(e||``).trim();if(/^\[.*?\]\(\?doc=.+#.+\)$/.test(t))return`anchor-doc-link`;if(/^\[.*?\]\(\?doc=.+\)$/.test(t))return`doc-link`;if(/^\[.*?\]\(#.+\)$/.test(t))return`anchor-link`;if(/^!\[.*?\]\(.*?\)$/.test(t))return`image`;if(/^\[.*?\]\(.*?\)$/.test(t))return`link`;if(/^<details[\s>]/i.test(t))return`collapsible`;if(/^<span\s[^>]*color:[^>]*>[\s\S]*<\/span>$/.test(t))return`colored-text`;if(/^<div\s[^>]*border-left[^>]*>/.test(t))return`colored-section`;if(/^```text\n/.test(t)&&/[├└│]/.test(t))return`tree`;if(/^```/.test(t))return`code-block`;if(yd(t))return`table`;if(/^> /.test(t))return`blockquote`;let n=/^(#{1,4}) [^\n]+$/.exec(t);return n?`heading-${n[1].length}`:/^(---|\n---\n)$/.test(t)?`separator`:Mf(t)?`ordered-list`:Nf(t)?`unordered-list`:null}var kp=W(`<div id="snippets-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div id="snippet-modal-card" class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-6xl mx-4 p-6 space-y-5 max-h-[90vh] overflow-y-auto"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><span id="snippet-modal-title"> </span></h3> <div id="snippet-detect-msg" class="hidden rounded-lg px-3 py-2 text-xs"></div> <div id="snippet-picker" class="hidden space-y-4"><input id="snippet-picker-search" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <div id="snippet-picker-categories" class="space-y-4 max-h-[60vh] overflow-y-auto pr-1"></div> <div id="snippet-picker-no-results" class="hidden text-center text-sm text-gray-500 dark:text-gray-400 py-4"> </div></div> <button type="button" id="snippet-picker-back" class="hidden inline-flex items-center gap-2 text-xs font-medium text-blue-700 dark:text-blue-300 hover:underline"><i class="fa-solid fa-arrow-left" aria-hidden="true"></i> <span> </span></button> <div id="snippet-type-wrapper" class="hidden space-y-1.5"><label for="snippet-type" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snippet-type" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"><option selected=""> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option></select></div> <div id="snip-panel-heading" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-heading-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-heading-content" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-collapsible" class="space-y-3"><div class="space-y-1.5"><label for="snip-collapsible-summary" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-collapsible-summary" type="text" value="Details" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-collapsible-body" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-collapsible-body" rows="6" class="w-full px-3 py-2 text-sm font-mono rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea></div></div> <div id="snip-panel-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-link-text" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-link-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-link-url" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-link-url" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-doc-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-doc-select" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snip-doc-select" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <input id="snip-doc-link-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-anchor-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-anchor-text" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-anchor-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <select id="snip-anchor-id" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div></div> <div id="snip-panel-anchor-doc-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-anchor-doc-select" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snip-anchor-doc-select" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div> <div class="space-y-1.5"><label for="snip-anchor-doc-text" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-anchor-doc-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <select id="snip-anchor-doc-id" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div></div> <div id="snip-panel-ordered-list" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-ordered-list-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-ordered-list-content" rows="10" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y leading-relaxed"></textarea></div></div> <div id="snip-panel-unordered-list" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-unordered-list-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-unordered-list-content" rows="10" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y leading-relaxed"></textarea></div></div> <div id="snip-panel-code-block" class="hidden space-y-3"><div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <input id="snip-code-lang" type="text" placeholder="javascript" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-code-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-code-content" rows="12" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y font-mono leading-relaxed"></textarea></div></div> <div id="snip-panel-blockquote" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-blockquote-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-blockquote-content" rows="8" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y leading-relaxed"></textarea></div></div> <div id="snip-panel-image" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-image-alt" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-image-alt" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-image-url" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-image-url" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-table" class="hidden space-y-3"><div class="flex items-center gap-5 flex-wrap"><div class="flex items-center gap-2"><label for="snip-table-style" class="text-xs text-gray-500 dark:text-gray-400"> </label> <select id="snip-table-style" class="text-xs rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 px-2 py-1"><option> </option><option> </option><option> </option></select></div> <label class="flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"><input id="snip-table-bordered" type="checkbox" class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"/> <span> </span></label> <div class="flex items-center gap-2"><label for="snip-table-color" class="text-xs text-gray-500 dark:text-gray-400"> </label> <select id="snip-table-color" class="text-xs rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 px-2 py-1"><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option></select></div> <div class="flex items-center gap-2"><span class="text-xs text-gray-500 dark:text-gray-400"> </span> <button class="text-xs px-2 py-0.5 rounded border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">−</button> <span id="snip-table-rows" class="text-xs font-mono w-4 text-center">3</span> <button class="text-xs px-2 py-0.5 rounded border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">+</button></div> <div class="flex items-center gap-2"><span class="text-xs text-gray-500 dark:text-gray-400"> </span> <button class="text-xs px-2 py-0.5 rounded border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">−</button> <span id="snip-table-cols" class="text-xs font-mono w-4 text-center">3</span> <button class="text-xs px-2 py-0.5 rounded border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors">+</button></div></div> <div id="snip-table-grid" class="overflow-x-auto"></div></div> <div id="snip-panel-tree" class="hidden space-y-2"><p class="text-xs text-gray-400 dark:text-gray-500"> </p> <div id="snip-tree-list" class="space-y-1"></div> <button class="text-xs px-3 py-1.5 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors w-full"> </button></div> <div id="snip-panel-diagram" class="hidden space-y-3"><div class="flex gap-4 text-sm"><label class="flex items-center gap-2 cursor-pointer"><input type="radio" name="snip-diag-mode" id="snip-diag-mode-existing" value="existing" checked=""/> <span class="text-gray-700 dark:text-gray-300"> </span></label> <label class="flex items-center gap-2 cursor-pointer"><input type="radio" name="snip-diag-mode" id="snip-diag-mode-new" value="new"/> <span class="text-gray-700 dark:text-gray-300"> </span></label></div> <div id="snip-diag-existing-section" class="space-y-1.5"><label for="snip-diag-select" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snip-diag-select" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div> <div id="snip-diag-new-section" class="hidden space-y-1.5"><label for="snip-diag-new-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-diag-new-name" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-diag-img-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <input id="snip-diag-img-name" type="text" placeholder="diagram.png" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-colored-section" class="hidden space-y-3"><div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex flex-wrap gap-2"><button type="button" data-color-swatch="info" class="w-7 h-7 rounded-full border-2 border-blue-400 bg-blue-100 ring-2 ring-transparent hover:ring-blue-400 transition-all color-swatch-btn selected-swatch"></button> <button type="button" data-color-swatch="success" class="w-7 h-7 rounded-full border-2 border-green-400 bg-green-100 ring-2 ring-transparent hover:ring-green-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="warning" class="w-7 h-7 rounded-full border-2 border-amber-400 bg-amber-100 ring-2 ring-transparent hover:ring-amber-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="danger" class="w-7 h-7 rounded-full border-2 border-red-400 bg-red-100 ring-2 ring-transparent hover:ring-red-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="note" class="w-7 h-7 rounded-full border-2 border-purple-400 bg-purple-100 ring-2 ring-transparent hover:ring-purple-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="neutral" class="w-7 h-7 rounded-full border-2 border-gray-400 bg-gray-100 ring-2 ring-transparent hover:ring-gray-400 transition-all color-swatch-btn"></button></div></div> <div class="space-y-1.5"><label for="snip-colored-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-colored-content" rows="4" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y font-mono"></textarea></div></div> <div id="snip-panel-colored-text" class="hidden space-y-3"><div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex flex-wrap gap-2"><button type="button" data-color-text-swatch="info" class="w-7 h-7 rounded-full border-2 border-blue-500 bg-blue-500 ring-2 ring-transparent hover:ring-blue-400 transition-all color-text-swatch-btn selected-text-swatch"></button> <button type="button" data-color-text-swatch="success" class="w-7 h-7 rounded-full border-2 border-green-500 bg-green-500 ring-2 ring-transparent hover:ring-green-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="warning" class="w-7 h-7 rounded-full border-2 border-amber-500 bg-amber-500 ring-2 ring-transparent hover:ring-amber-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="danger" class="w-7 h-7 rounded-full border-2 border-red-500 bg-red-500 ring-2 ring-transparent hover:ring-red-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="note" class="w-7 h-7 rounded-full border-2 border-purple-500 bg-purple-500 ring-2 ring-transparent hover:ring-purple-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="neutral" class="w-7 h-7 rounded-full border-2 border-gray-500 bg-gray-500 ring-2 ring-transparent hover:ring-gray-400 transition-all color-text-swatch-btn"></button></div></div> <div class="space-y-1.5"><label for="snip-colored-text-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-colored-text-content" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-emojis" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-emoji-string" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex gap-1"><input id="snip-emoji-string" type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <button type="button" id="snip-emoji-clear" class="px-3 py-2 text-xs rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"> </button></div></div> <div class="space-y-1.5"><input id="snip-emoji-search" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div id="snip-emoji-grid" class="space-y-2 max-h-64 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-lg p-2 bg-white dark:bg-gray-900"></div></div> <div id="snip-panel-attachment" class="hidden space-y-3"><div class="rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 px-3 py-3 text-sm text-blue-900 dark:text-blue-100 space-y-2"><p></p> <p class="text-xs text-blue-700 dark:text-blue-300"></p></div></div> <div id="snippet-preview-wrap" class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <pre id="snippet-preview" class="text-xs bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 overflow-x-auto text-gray-700 dark:text-gray-300 whitespace-pre-wrap"></pre></div> <div class="flex justify-end gap-3 pt-1"><button id="snippet-delete-btn" class="hidden text-sm px-4 py-2 mr-auto rounded-lg border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button id="snippet-submit-btn" class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`),Ap=W(`<!> <!>`,1);function jp(e,t){Ge(t,!0);let n=Bi(t,`editor`,7),r=Bi(t,`mode`,3,`insert`),i=Bi(t,`content`,3,``),a=Bi(t,`range`,3,null),o=Bi(t,`insertPos`,3,0),s=Bi(t,`onsave`,3,void 0),c=0,l=0,u=``,d=F(null),f=`info`,p=`info`,m=$f(()=>A()),h=sp(()=>A());function g(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function _(e){return document.getElementById(e)}function v(e){if(!e)return``;let t=e.split(/\s+/);return t.length>1&&!/^[\p{L}\p{N}]/u.test(t[0])?t.slice(1).join(` `):e}function y(e){let t=Cf[e];return v(t?Y(t):e)}function b(){let e=_(`snippet-picker-categories`);if(e){e.innerHTML=``;for(let t of bf){let n=document.createElement(`section`);n.dataset.snippetCategory=t.key,n.className=`space-y-2`;let r=document.createElement(`h3`);r.className=`text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400`,r.textContent=Y(t.labelKey),n.appendChild(r);let i=document.createElement(`div`);i.className=`grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-7 xl:grid-cols-8 gap-2`;for(let e of t.types){let t=xf[Sf[e]||`indigo`]||xf.indigo,n=document.createElement(`button`);n.type=`button`,n.dataset.snippetType=e,n.className=`snippet-card min-h-[76px] flex flex-col items-center justify-center gap-2 p-2 rounded-lg border text-gray-800 dark:text-gray-100 transition-colors `+t.card,n.onclick=()=>E(e);let r=document.createElement(`i`);r.className=(yf[e]||`fa-solid fa-puzzle-piece`)+` text-xl `+t.icon,r.setAttribute(`aria-hidden`,`true`),n.appendChild(r);let a=document.createElement(`span`);a.className=`text-xs font-medium text-center leading-tight`,a.textContent=y(e),n.appendChild(a),i.appendChild(n)}n.appendChild(i),e.appendChild(n)}}}function x(){b(),_(`snippet-picker`)?.classList.remove(`hidden`),_(`snippet-picker-back`)?.classList.add(`hidden`),_(`snippet-submit-btn`)?.classList.add(`hidden`),gf.forEach(e=>_(`snip-panel-`+e)?.classList.add(`hidden`)),_(`snippet-preview-wrap`)?.classList.add(`hidden`);let e=_(`snippet-picker-search`);e&&(e.value=``,C(``),setTimeout(()=>e.focus(),50))}function S(e=!0){_(`snippet-picker`)?.classList.add(`hidden`),_(`snippet-submit-btn`)?.classList.remove(`hidden`),_(`snippet-picker-back`)?.classList.toggle(`hidden`,!e)}function C(e){let t=_(`snippet-picker-categories`);if(!t)return;let n=(e||``).toLowerCase().trim(),r=0;t.querySelectorAll(`[data-snippet-category]`).forEach(e=>{let t=0;e.querySelectorAll(`[data-snippet-type]`).forEach(e=>{let r=(e.querySelector(`span`)?.textContent||``).toLowerCase(),i=!n||r.includes(n);e.classList.toggle(`hidden`,!i),i&&(t+=1)}),e.classList.toggle(`hidden`,t===0),r+=t}),_(`snippet-picker-no-results`)?.classList.toggle(`hidden`,r>0)}function w(){let e=_(`snippet-picker-search`);C(e?e.value:``)}function T(e){if(e.key===`Enter`){e.preventDefault();let t=document.querySelector(`#snippet-picker-categories [data-snippet-type]:not(.hidden)`);t&&E(t.dataset.snippetType)}}function E(e){let t=_(`snippet-type`);t&&(t.value=e),ve(),S()}function D(){x()}let ee=!1;function O(e){return`<button type="button" data-emoji="${e.e}" title="${e.t.split(` `).slice(0,3).join(`, `)}" class="emoji-btn w-7 h-7 text-lg rounded hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center justify-center">${e.e}</button>`}function te(){return Tf.map(e=>`
|
|
43
|
+
`)}}function Lp(e){let t=e.match(/^!\[([\s\S]*?)\]\(([\s\S]*?)\)$/);return t?{alt:t[1],url:t[2]}:{}}function Rp(e,t){let n=Number(e.slice(-1)),r=t.match(RegExp(`^#{${n}}\\s+(.+)$`));return{text:r?r[1].trim():``}}function zp(e){let t=e.match(/^<span\s[^>]*color:([^;>"]+)[^>]*>([\s\S]*)<\/span>$/);return t?{color:t[1].trim(),content:t[2]}:{}}function Bp(e){let t=e.match(/border-left:[^;]*solid\s+(#[0-9a-fA-F]{6})/),n=e.match(/^<div[^>]*>\n\n([\s\S]*?)\n\n<\/div>$/);return{borderColor:t?t[1]:void 0,content:n?n[1]:void 0}}function Vp(e,t,n={}){let r=(t||``).trim();switch(e){case`collapsible`:return Ap(r);case`link`:return jp(r);case`doc-link`:return Mp(r);case`anchor-link`:return Np(r);case`anchor-doc-link`:return Pp(r);case`ordered-list`:case`unordered-list`:return{content:r};case`code-block`:return Fp(r,n);case`blockquote`:return Ip(r);case`image`:return Lp(r);case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:return Rp(e,r);case`table`:return yp(r);case`tree`:return Op(r);case`colored-text`:return zp(r);case`colored-section`:return Bp(r);default:return{}}}function Hp(e){let t=(e||``).trim();if(/^\[.*?\]\(\?doc=.+#.+\)$/.test(t))return`anchor-doc-link`;if(/^\[.*?\]\(\?doc=.+\)$/.test(t))return`doc-link`;if(/^\[.*?\]\(#.+\)$/.test(t))return`anchor-link`;if(/^!\[.*?\]\(.*?\)$/.test(t))return`image`;if(/^\[.*?\]\(.*?\)$/.test(t))return`link`;if(/^<details[\s>]/i.test(t))return`collapsible`;if(/^<span\s[^>]*color:[^>]*>[\s\S]*<\/span>$/.test(t))return`colored-text`;if(/^<div\s[^>]*border-left[^>]*>/.test(t))return`colored-section`;if(/^```text\n/.test(t)&&/[├└│]/.test(t))return`tree`;if(/^```/.test(t))return`code-block`;if(yd(t))return`table`;if(/^> /.test(t))return`blockquote`;let n=/^(#{1,4}) [^\n]+$/.exec(t);return n?`heading-${n[1].length}`:/^(---|\n---\n)$/.test(t)?`separator`:Mf(t)?`ordered-list`:Nf(t)?`unordered-list`:null}var Up=W(`<div id="snippets-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div id="snippet-modal-card" class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-6xl mx-4 p-6 space-y-5 max-h-[90vh] overflow-y-auto"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><span id="snippet-modal-title"> </span></h3> <div id="snippet-detect-msg" class="hidden rounded-lg px-3 py-2 text-xs"></div> <div id="snippet-picker" class="hidden space-y-4"><input id="snippet-picker-search" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <div id="snippet-picker-categories" class="space-y-4 max-h-[60vh] overflow-y-auto pr-1"></div> <div id="snippet-picker-no-results" class="hidden text-center text-sm text-gray-500 dark:text-gray-400 py-4"> </div></div> <button type="button" id="snippet-picker-back" class="hidden inline-flex items-center gap-2 text-xs font-medium text-blue-700 dark:text-blue-300 hover:underline"><i class="fa-solid fa-arrow-left" aria-hidden="true"></i> <span> </span></button> <div id="snippet-type-wrapper" class="hidden space-y-1.5"><label for="snippet-type" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snippet-type" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"><option selected=""> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option></select></div> <div id="snip-panel-heading" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-heading-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-heading-content" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-collapsible" class="space-y-3"><div class="space-y-1.5"><label for="snip-collapsible-summary" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-collapsible-summary" type="text" value="Details" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-collapsible-body" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-collapsible-body" rows="6" class="w-full px-3 py-2 text-sm font-mono rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea></div></div> <div id="snip-panel-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-link-text" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-link-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-link-url" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-link-url" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-doc-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-doc-select" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snip-doc-select" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <input id="snip-doc-link-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-anchor-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-anchor-text" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-anchor-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <select id="snip-anchor-id" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div></div> <div id="snip-panel-anchor-doc-link" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-anchor-doc-select" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snip-anchor-doc-select" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div> <div class="space-y-1.5"><label for="snip-anchor-doc-text" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-anchor-doc-text" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <select id="snip-anchor-doc-id" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div></div> <div id="snip-panel-ordered-list" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-ordered-list-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-ordered-list-content" rows="10" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y leading-relaxed"></textarea></div></div> <div id="snip-panel-unordered-list" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-unordered-list-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-unordered-list-content" rows="10" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y leading-relaxed"></textarea></div></div> <div id="snip-panel-code-block" class="hidden space-y-3"><div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <input id="snip-code-lang" type="text" placeholder="javascript" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-code-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-code-content" rows="12" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y font-mono leading-relaxed"></textarea></div></div> <div id="snip-panel-blockquote" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-blockquote-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-blockquote-content" rows="8" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y leading-relaxed"></textarea></div></div> <div id="snip-panel-image" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-image-alt" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-image-alt" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-image-url" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-image-url" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-table" class="hidden space-y-3"><div class="flex items-center gap-5 flex-wrap"><div class="flex items-center gap-2"><label for="snip-table-style" class="text-xs text-gray-500 dark:text-gray-400"> </label> <select id="snip-table-style" class="text-xs rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 px-2 py-1"><option> </option><option> </option><option> </option></select></div> <label class="flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400"><input id="snip-table-bordered" type="checkbox" class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"/> <span> </span></label> <div class="flex items-center gap-2"><label for="snip-table-color" class="text-xs text-gray-500 dark:text-gray-400"> </label> <select id="snip-table-color" class="text-xs rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 px-2 py-1"><option> </option><option> </option><option> </option><option> </option><option> </option><option> </option></select></div> <p id="snip-table-hint" class="text-xs text-gray-400 dark:text-gray-500 ml-auto"> </p></div> <div id="snip-table-grid" class="overflow-x-auto"></div></div> <div id="snip-panel-tree" class="hidden space-y-2"><p class="text-xs text-gray-400 dark:text-gray-500"> </p> <div id="snip-tree-list" class="space-y-1"></div> <button class="text-xs px-3 py-1.5 rounded-lg border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors w-full"> </button></div> <div id="snip-panel-diagram" class="hidden space-y-3"><div class="flex gap-4 text-sm"><label class="flex items-center gap-2 cursor-pointer"><input type="radio" name="snip-diag-mode" id="snip-diag-mode-existing" value="existing" checked=""/> <span class="text-gray-700 dark:text-gray-300"> </span></label> <label class="flex items-center gap-2 cursor-pointer"><input type="radio" name="snip-diag-mode" id="snip-diag-mode-new" value="new"/> <span class="text-gray-700 dark:text-gray-300"> </span></label></div> <div id="snip-diag-existing-section" class="space-y-1.5"><label for="snip-diag-select" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <select id="snip-diag-select" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"></select></div> <div id="snip-diag-new-section" class="hidden space-y-1.5"><label for="snip-diag-new-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-diag-new-name" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="snip-diag-img-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"><span> </span> <span class="font-normal text-gray-400"> </span></label> <input id="snip-diag-img-name" type="text" placeholder="diagram.png" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-colored-section" class="hidden space-y-3"><div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex flex-wrap gap-2"><button type="button" data-color-swatch="info" class="w-7 h-7 rounded-full border-2 border-blue-400 bg-blue-100 ring-2 ring-transparent hover:ring-blue-400 transition-all color-swatch-btn selected-swatch"></button> <button type="button" data-color-swatch="success" class="w-7 h-7 rounded-full border-2 border-green-400 bg-green-100 ring-2 ring-transparent hover:ring-green-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="warning" class="w-7 h-7 rounded-full border-2 border-amber-400 bg-amber-100 ring-2 ring-transparent hover:ring-amber-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="danger" class="w-7 h-7 rounded-full border-2 border-red-400 bg-red-100 ring-2 ring-transparent hover:ring-red-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="note" class="w-7 h-7 rounded-full border-2 border-purple-400 bg-purple-100 ring-2 ring-transparent hover:ring-purple-400 transition-all color-swatch-btn"></button> <button type="button" data-color-swatch="neutral" class="w-7 h-7 rounded-full border-2 border-gray-400 bg-gray-100 ring-2 ring-transparent hover:ring-gray-400 transition-all color-swatch-btn"></button></div></div> <div class="space-y-1.5"><label for="snip-colored-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <textarea id="snip-colored-content" rows="4" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y font-mono"></textarea></div></div> <div id="snip-panel-colored-text" class="hidden space-y-3"><div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex flex-wrap gap-2"><button type="button" data-color-text-swatch="info" class="w-7 h-7 rounded-full border-2 border-blue-500 bg-blue-500 ring-2 ring-transparent hover:ring-blue-400 transition-all color-text-swatch-btn selected-text-swatch"></button> <button type="button" data-color-text-swatch="success" class="w-7 h-7 rounded-full border-2 border-green-500 bg-green-500 ring-2 ring-transparent hover:ring-green-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="warning" class="w-7 h-7 rounded-full border-2 border-amber-500 bg-amber-500 ring-2 ring-transparent hover:ring-amber-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="danger" class="w-7 h-7 rounded-full border-2 border-red-500 bg-red-500 ring-2 ring-transparent hover:ring-red-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="note" class="w-7 h-7 rounded-full border-2 border-purple-500 bg-purple-500 ring-2 ring-transparent hover:ring-purple-400 transition-all color-text-swatch-btn"></button> <button type="button" data-color-text-swatch="neutral" class="w-7 h-7 rounded-full border-2 border-gray-500 bg-gray-500 ring-2 ring-transparent hover:ring-gray-400 transition-all color-text-swatch-btn"></button></div></div> <div class="space-y-1.5"><label for="snip-colored-text-content" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="snip-colored-text-content" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div></div> <div id="snip-panel-emojis" class="hidden space-y-3"><div class="space-y-1.5"><label for="snip-emoji-string" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex gap-1"><input id="snip-emoji-string" type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <button type="button" id="snip-emoji-clear" class="px-3 py-2 text-xs rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-700"> </button></div></div> <div class="space-y-1.5"><input id="snip-emoji-search" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div id="snip-emoji-grid" class="space-y-2 max-h-64 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-lg p-2 bg-white dark:bg-gray-900"></div></div> <div id="snip-panel-attachment" class="hidden space-y-3"><div class="rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 px-3 py-3 text-sm text-blue-900 dark:text-blue-100 space-y-2"><p></p> <p class="text-xs text-blue-700 dark:text-blue-300"></p></div></div> <div id="snippet-preview-wrap" class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <pre id="snippet-preview" class="text-xs bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 overflow-x-auto text-gray-700 dark:text-gray-300 whitespace-pre-wrap"></pre></div> <div class="flex justify-end gap-3 pt-1"><button id="snippet-delete-btn" class="hidden text-sm px-4 py-2 mr-auto rounded-lg border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button id="snippet-submit-btn" class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`),Wp=W(`<!> <!>`,1);function Gp(e,t){Ge(t,!0);let n=Bi(t,`editor`,7),r=Bi(t,`mode`,3,`insert`),i=Bi(t,`content`,3,``),a=Bi(t,`range`,3,null),o=Bi(t,`insertPos`,3,0),s=Bi(t,`onsave`,3,void 0),c=0,l=0,u=``,d=F(null),f=`info`,p=`info`,m=ip(()=>A()),h=xp(()=>A());function g(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function _(e){return document.getElementById(e)}function v(e){if(!e)return``;let t=e.split(/\s+/);return t.length>1&&!/^[\p{L}\p{N}]/u.test(t[0])?t.slice(1).join(` `):e}function y(e){let t=Cf[e];return v(t?Y(t):e)}function b(){let e=_(`snippet-picker-categories`);if(e){e.innerHTML=``;for(let t of bf){let n=document.createElement(`section`);n.dataset.snippetCategory=t.key,n.className=`space-y-2`;let r=document.createElement(`h3`);r.className=`text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400`,r.textContent=Y(t.labelKey),n.appendChild(r);let i=document.createElement(`div`);i.className=`grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-7 xl:grid-cols-8 gap-2`;for(let e of t.types){let t=xf[Sf[e]||`indigo`]||xf.indigo,n=document.createElement(`button`);n.type=`button`,n.dataset.snippetType=e,n.className=`snippet-card min-h-[76px] flex flex-col items-center justify-center gap-2 p-2 rounded-lg border text-gray-800 dark:text-gray-100 transition-colors `+t.card,n.onclick=()=>E(e);let r=document.createElement(`i`);r.className=(yf[e]||`fa-solid fa-puzzle-piece`)+` text-xl `+t.icon,r.setAttribute(`aria-hidden`,`true`),n.appendChild(r);let a=document.createElement(`span`);a.className=`text-xs font-medium text-center leading-tight`,a.textContent=y(e),n.appendChild(a),i.appendChild(n)}n.appendChild(i),e.appendChild(n)}}}function x(){b(),_(`snippet-picker`)?.classList.remove(`hidden`),_(`snippet-picker-back`)?.classList.add(`hidden`),_(`snippet-submit-btn`)?.classList.add(`hidden`),gf.forEach(e=>_(`snip-panel-`+e)?.classList.add(`hidden`)),_(`snippet-preview-wrap`)?.classList.add(`hidden`);let e=_(`snippet-picker-search`);e&&(e.value=``,C(``),setTimeout(()=>e.focus(),50))}function S(e=!0){_(`snippet-picker`)?.classList.add(`hidden`),_(`snippet-submit-btn`)?.classList.remove(`hidden`),_(`snippet-picker-back`)?.classList.toggle(`hidden`,!e)}function C(e){let t=_(`snippet-picker-categories`);if(!t)return;let n=(e||``).toLowerCase().trim(),r=0;t.querySelectorAll(`[data-snippet-category]`).forEach(e=>{let t=0;e.querySelectorAll(`[data-snippet-type]`).forEach(e=>{let r=(e.querySelector(`span`)?.textContent||``).toLowerCase(),i=!n||r.includes(n);e.classList.toggle(`hidden`,!i),i&&(t+=1)}),e.classList.toggle(`hidden`,t===0),r+=t}),_(`snippet-picker-no-results`)?.classList.toggle(`hidden`,r>0)}function w(){let e=_(`snippet-picker-search`);C(e?e.value:``)}function T(e){if(e.key===`Enter`){e.preventDefault();let t=document.querySelector(`#snippet-picker-categories [data-snippet-type]:not(.hidden)`);t&&E(t.dataset.snippetType)}}function E(e){let t=_(`snippet-type`);t&&(t.value=e),ve(),S()}function D(){x()}let ee=!1;function O(e){return`<button type="button" data-emoji="${e.e}" title="${e.t.split(` `).slice(0,3).join(`, `)}" class="emoji-btn w-7 h-7 text-lg rounded hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center justify-center">${e.e}</button>`}function te(){return Tf.map(e=>`
|
|
44
44
|
<div>
|
|
45
45
|
<div class="text-xs font-semibold text-gray-500 dark:text-gray-400 mb-1 px-1">${Y(e.label)}</div>
|
|
46
46
|
<div class="flex flex-wrap gap-1">
|
|
@@ -48,17 +48,17 @@ import e from"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
|
|
48
48
|
</div>
|
|
49
49
|
</div>
|
|
50
50
|
`).join(``)}function k(e){let t=e.toLowerCase().trim(),n=[];for(let r of Tf)for(let i of r.emojis)(i.t.includes(t)||i.e===e)&&n.push(i);return n.length===0?`<div class="text-xs text-gray-400 dark:text-gray-600 px-1 py-2">${Y(`snippet.emoji_no_results`)}</div>`:`<div class="flex flex-wrap gap-1">${n.map(O).join(``)}</div>`}function ne(){let e=_(`snip-emoji-grid`);if(!e)return;e.innerHTML=te(),ee||=(e.addEventListener(`click`,e=>{let t=e.target.closest(`.emoji-btn`);t&&t.dataset.emoji&&ie(t.dataset.emoji)}),_(`snip-emoji-search`)?.addEventListener(`input`,e=>re(e.target.value)),!0);let t=_(`snip-emoji-search`);t&&(t.value=``),A()}function re(e){let t=_(`snip-emoji-grid`);if(!t)return;let n=(e||``).trim();t.innerHTML=n.length<2?te():k(n)}function ie(e){let t=_(`snip-emoji-string`);t&&(t.value+=e,A())}function ae(){let e=_(`snip-emoji-string`);e&&(e.value=``,A())}let oe={info:`ring-blue-400`,success:`ring-green-400`,warning:`ring-amber-400`,danger:`ring-red-400`,note:`ring-purple-400`,neutral:`ring-gray-400`};function se(e){document.querySelectorAll(`.color-swatch-btn`).forEach(e=>{e.classList.remove(`selected-swatch`,`ring-offset-2`)}),e.classList.add(`selected-swatch`,`ring-offset-2`);let t=e.getAttribute(`data-color-swatch`)||`info`;e.classList.add(oe[t]||`ring-blue-400`),f=t,A()}function ce(e){document.querySelectorAll(`.color-text-swatch-btn`).forEach(e=>{e.classList.remove(`selected-text-swatch`,`ring-offset-2`)}),e.classList.add(`selected-text-swatch`,`ring-offset-2`);let t=e.getAttribute(`data-color-text-swatch`)||`info`;e.classList.add(oe[t]||`ring-blue-400`),p=t,A()}function le(e){return wf[e]||wf.info}function ue(e){return e.replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*([^*]+)\*\*/g,`$1`).replace(/__([^_]+)__/g,`$1`).replace(/(^|[^*])\*([^*]+)\*(?!\*)/g,`$1$2`).replace(/(^|[^_])_([^_]+)_(?!_)/g,`$1$2`).trim()}function de(e){return e.toLowerCase().replace(/[^\w\s-]/g,``).trim().replace(/\s+/g,`-`)}function fe(e){let t=[],n=(e||``).split(`
|
|
51
|
-
`),r=!1;for(let e of n){if(/^```/.test(e)){r=!r;continue}if(r)continue;let n=e.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);if(!n)continue;let i=ue(n[2]),a=de(i);a&&t.push({level:n[1].length,text:i,slug:a})}return t}function pe(){return fe(n()?n().value:``)}function me(e,t,n){if(e){if(t.length===0){e.innerHTML=`<option value="" disabled selected>${Y(n)}</option>`;return}e.innerHTML=t.map(e=>{let t=`· `.repeat(Math.max(0,e.level-1));return`<option value="${g(e.slug)}">${g(t+e.text)}</option>`}).join(``)}}function he(){me(_(`snip-anchor-id`),pe(),`snippet.link_anchor_no_headings`)}async function ge(){let e=_(`snip-anchor-doc-select`),t=_(`snip-anchor-doc-id`);if(!e||!t)return;let n=e.value;if(!n){me(t,[],`snippet.link_anchor_no_headings`),A();return}t.innerHTML=`<option value="" disabled selected>${Y(`common.loading`)}</option>`;try{me(t,fe((await fetch(`/api/documents/`+encodeURIComponent(n)).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()})).content||``),`snippet.link_anchor_no_headings`)}catch{me(t,[],`snippet.link_anchor_no_headings`)}A()}function _e(e,t){let n=_(e);n&&n.value.trim()===``&&(n.value=t)}function ve(){let e=_(`snippet-type`).value,t=vf(e);gf.forEach(e=>_(`snip-panel-`+e)?.classList.toggle(`hidden`,e!==t)),_(`snippet-preview-wrap`)?.classList.toggle(`hidden`,e===`attachment`||e===`table`||e===`code-block`||e===`blockquote`||e===`ordered-list`||e===`unordered-list`||e===`colored-section`||e===`colored-text`||e===`tree`||e===`collapsible`||e.startsWith(`heading-`)),e===`table`?
|
|
51
|
+
`),r=!1;for(let e of n){if(/^```/.test(e)){r=!r;continue}if(r)continue;let n=e.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);if(!n)continue;let i=ue(n[2]),a=de(i);a&&t.push({level:n[1].length,text:i,slug:a})}return t}function pe(){return fe(n()?n().value:``)}function me(e,t,n){if(e){if(t.length===0){e.innerHTML=`<option value="" disabled selected>${Y(n)}</option>`;return}e.innerHTML=t.map(e=>{let t=`· `.repeat(Math.max(0,e.level-1));return`<option value="${g(e.slug)}">${g(t+e.text)}</option>`}).join(``)}}function he(){me(_(`snip-anchor-id`),pe(),`snippet.link_anchor_no_headings`)}async function ge(){let e=_(`snip-anchor-doc-select`),t=_(`snip-anchor-doc-id`);if(!e||!t)return;let n=e.value;if(!n){me(t,[],`snippet.link_anchor_no_headings`),A();return}t.innerHTML=`<option value="" disabled selected>${Y(`common.loading`)}</option>`;try{me(t,fe((await fetch(`/api/documents/`+encodeURIComponent(n)).then(e=>{if(!e.ok)throw Error(e.statusText);return e.json()})).content||``),`snippet.link_anchor_no_headings`)}catch{me(t,[],`snippet.link_anchor_no_headings`)}A()}function _e(e,t){let n=_(e);n&&n.value.trim()===``&&(n.value=t)}function ve(){let e=_(`snippet-type`).value,t=vf(e);gf.forEach(e=>_(`snip-panel-`+e)?.classList.toggle(`hidden`,e!==t)),_(`snippet-preview-wrap`)?.classList.toggle(`hidden`,e===`attachment`||e===`table`||e===`code-block`||e===`blockquote`||e===`ordered-list`||e===`unordered-list`||e===`colored-section`||e===`colored-text`||e===`tree`||e===`collapsible`||e.startsWith(`heading-`)),e===`table`?ap(m):e===`tree`?Sp(h):e===`diagram`?ye():e===`emojis`?ne():e===`attachment`||(e===`ordered-list`?_e(`snip-ordered-list-content`,Of()):e===`unordered-list`&&_e(`snip-unordered-list-content`,kf()),A())}async function ye(){let e=[];try{e=await fetch(`/api/diagrams`).then(e=>e.json())}catch{e=[]}let t=_(`snip-diag-select`);t&&(t.innerHTML=e.length?e.map(e=>`<option value="${g(e.id)}">${g(e.title)}</option>`).join(``):`<option value="" disabled>${Y(`snippet.diagram_no_diagrams`)}</option>`);let n=$.currentDocId&&$.allDocs.find(e=>e.id===$.currentDocId),r=n&&n.title||``,i=r.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``),a=_(`snip-diag-img-name`);a&&(a.value=i?i+`.png`:`diagram.png`);let o=_(`snip-diag-new-name`);o&&(o.value=r?r+` Diagram`:``);let s=_(`snip-diag-mode-existing`);s&&(s.checked=!0),be()}function be(){let e=_(`snip-diag-mode-new`)?.checked??!1;_(`snip-diag-existing-section`)?.classList.toggle(`hidden`,e),_(`snip-diag-new-section`)?.classList.toggle(`hidden`,!e),xe(),A()}function xe(){let e=_(`snip-diag-mode-new`)?.checked??!1,t=``;if(e)t=_(`snip-diag-new-name`)?.value.trim()||``;else{let e=_(`snip-diag-select`);t=e?.options[e.selectedIndex]?.text??``}let n=t.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``),r=_(`snip-diag-img-name`);r&&(r.value=n?n+`.png`:`diagram.png`)}function Se(e,t){return e.options[e.selectedIndex]?.text||t}function Ce(e){return _(e)?.value??``}function we(e){switch(e){case`collapsible`:return{summary:Ce(`snip-collapsible-summary`),summaryFallback:Y(`snippet.collapsible_summary_value`),body:Ce(`snip-collapsible-body`),bodyFallback:`## Titre
|
|
52
52
|
|
|
53
|
-
Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link_text_placeholder`),url:Ce(`snip-link-url`)};case`doc-link`:{let e=_(`snip-doc-select`);return{docId:e.value,title:Se(e,e.value),text:Ce(`snip-doc-link-text`)}}case`anchor-link`:return{text:Ce(`snip-anchor-text`),textFallback:Y(`snippet.link_section_placeholder`),anchor:Ce(`snip-anchor-id`),anchorFallback:Y(`snippet.link_anchor_placeholder`)};case`anchor-doc-link`:return{docId:_(`snip-anchor-doc-select`).value,text:Ce(`snip-anchor-doc-text`),textFallback:Y(`snippet.link_section_placeholder`),anchor:Ce(`snip-anchor-doc-id`),anchorFallback:Y(`snippet.link_anchor_placeholder`)};case`ordered-list`:return{content:Ce(`snip-ordered-list-content`)};case`unordered-list`:return{content:Ce(`snip-unordered-list-content`)};case`code-block`:return{lang:Ce(`snip-code-lang`),code:Ce(`snip-code-content`),inlineIndent:u};case`blockquote`:return{content:Ce(`snip-blockquote-content`)};case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:return{text:Ce(`snip-heading-content`),fallback:Y(`snippet.heading_text_placeholder`)||`Titre`};case`image`:return{alt:Ce(`snip-image-alt`),url:Ce(`snip-image-url`)};case`table`:{let e=_(`snip-table-bordered`);return{markdown:
|
|
53
|
+
Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link_text_placeholder`),url:Ce(`snip-link-url`)};case`doc-link`:{let e=_(`snip-doc-select`);return{docId:e.value,title:Se(e,e.value),text:Ce(`snip-doc-link-text`)}}case`anchor-link`:return{text:Ce(`snip-anchor-text`),textFallback:Y(`snippet.link_section_placeholder`),anchor:Ce(`snip-anchor-id`),anchorFallback:Y(`snippet.link_anchor_placeholder`)};case`anchor-doc-link`:return{docId:_(`snip-anchor-doc-select`).value,text:Ce(`snip-anchor-doc-text`),textFallback:Y(`snippet.link_section_placeholder`),anchor:Ce(`snip-anchor-doc-id`),anchorFallback:Y(`snippet.link_anchor_placeholder`)};case`ordered-list`:return{content:Ce(`snip-ordered-list-content`)};case`unordered-list`:return{content:Ce(`snip-unordered-list-content`)};case`code-block`:return{lang:Ce(`snip-code-lang`),code:Ce(`snip-code-content`),inlineIndent:u};case`blockquote`:return{content:Ce(`snip-blockquote-content`)};case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:return{text:Ce(`snip-heading-content`),fallback:Y(`snippet.heading_text_placeholder`)||`Titre`};case`image`:return{alt:Ce(`snip-image-alt`),url:Ce(`snip-image-url`)};case`table`:{let e=_(`snip-table-bordered`);return{markdown:vp(m),style:Ce(`snip-table-style`),bordered:!!(e&&e.checked),color:Ce(`snip-table-color`)}}case`tree`:return{markdown:Dp(h)};case`diagram`:{let e=_(`snip-diag-mode-new`)?.checked??!1,t=Ce(`snip-diag-img-name`).trim()||`diagram.png`;if(e)return{id:`d`+Date.now(),label:Ce(`snip-diag-new-name`).trim()||`Diagram`,imageName:t};let n=_(`snip-diag-select`);return{id:n.value,label:Se(n,`Diagram`),imageName:t}}case`colored-text`:return{color:le(p),content:Ce(`snip-colored-text-content`)||Y(`snippet.colored_text_content_placeholder`)};case`colored-section`:return{color:le(f),content:Ce(`snip-colored-content`)||Y(`snippet.colored_section_content_placeholder`)};case`emojis`:return{value:Ce(`snip-emoji-string`)};default:return{}}}function Te(){let e=_(`snippet-type`).value;return Zf(e,we(e))}function A(){let e=_(`snippet-preview`);e&&(e.textContent=Te())}function Ee(){_p(m)}function De(){t.onclose()}function Oe(e){if(!n())return;let t=c,r=l,i=n().value.slice(0,t),a=n().value.slice(r);n().value=i+e+a,n().selectionStart=n().selectionEnd=t+e.length,n().dispatchEvent(new Event(`input`,{bubbles:!0})),n().focus()}async function ke(){let e=_(`snippet-type`).value;if(r()===`inline-edit`&&(e===`diagram`||e===`attachment`)||r()===`inline-insert`&&e===`attachment`)return;if(e===`diagram`){await je();return}if(e===`attachment`){await j();return}let t=Te();if(r()===`inline-edit`){let e=i().slice(0,c)+t+i().slice(l);try{s()&&await s()(e)}catch(e){alert(Y(`snippet.inline_save_failed`)+(e instanceof Error?e.message:String(e)))}De();return}if(r()===`inline-insert`){let e=i().slice(0,c),n=i().slice(c),r=e.length===0||/\n\n$/.test(e)?``:e.endsWith(`
|
|
54
54
|
`)?`
|
|
55
55
|
`:`
|
|
56
56
|
|
|
57
|
-
`,
|
|
57
|
+
`,a=n.length===0||/^\n\n/.test(n)?``:n.startsWith(`
|
|
58
58
|
`)?`
|
|
59
59
|
`:`
|
|
60
60
|
|
|
61
|
-
`,
|
|
61
|
+
`,o=r+t+a;try{s()&&await s()(e+o+n)}catch(e){alert(Y(`snippet.inline_insert_failed`)+(e instanceof Error?e.message:String(e)))}De();return}Oe(t),De()}async function Ae(){if(r()!==`inline-edit`||!await H(d).show({title:Y(`snippet.inline_delete_title`),message:Y(`snippet.inline_delete_message`),confirmLabel:Y(`snippet.inline_delete_confirm_btn`),cancelLabel:Y(`common.cancel`),danger:!0}))return;let e=c,t=l;try{s()&&await s()(i().slice(0,e)+i().slice(t))}catch(e){alert(Y(`snippet.inline_delete_failed`)+(e instanceof Error?e.message:String(e)))}De()}async function j(){if(!n())return;let e=document.createElement(`input`);e.type=`file`,e.onchange=async()=>{let t=e.files?.[0];if(!t)return;let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});try{let e=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:n,name:t.name})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||e.statusText)}let r=await e.json(),i=r.url||``;Oe(`[📎 ${r.originalName||r.filename||t.name}](${i})`)}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}De()},e.click()}async function je(){let e=_(`snip-diag-mode-new`)?.checked??!1,t=Ce(`snip-diag-img-name`).trim()||`diagram.png`,a,o;if(e){a=`d`+Date.now(),o=Ce(`snip-diag-new-name`).trim()||`Diagram`;try{await fetch(`/api/diagrams/${a}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:o,nodes:[],edges:[]})})}catch(e){alert(Y(`error.create_diagram`)+(e instanceof Error?e.message:String(e)));return}}else{let e=_(`snip-diag-select`);a=e.value,o=e.options[e.selectedIndex]?.text||`Diagram`}let l=`[](/diagram?id=${a})`;if(r()===`inline-insert`){let e=i().slice(0,c),t=i().slice(c),n=e.length===0||/\n\n$/.test(e)?``:e.endsWith(`
|
|
62
62
|
`)?`
|
|
63
63
|
`:`
|
|
64
64
|
|
|
@@ -66,29 +66,29 @@ Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link
|
|
|
66
66
|
`)?`
|
|
67
67
|
`:`
|
|
68
68
|
|
|
69
|
-
`,a=e+n+u+r+t;try{s()&&await s()(a)}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)));return}}else if(Ee(u),$.currentDocId&&n())try{await fetch(`/api/documents/`+$.currentDocId,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n().value})})}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)));return}t.onclose(),window.location.href=`/diagram?id=${o}&img=${encodeURIComponent(a)}`}function j(e,t){if(Array.from(e.options).some(e=>e.value===t))return;let n=document.createElement(`option`);n.value=t,n.textContent=t,e.insertBefore(n,e.firstChild)}function je(e,t){for(let n of Array.from(e.options))if(n.value===t){e.value=n.value;return}}function M(e){let t=Object.entries(wf).find(([,t])=>t.border===e);return t?t[0]:null}function Me(e){e&&(p=e,document.querySelectorAll(`.color-text-swatch-btn`).forEach(e=>{e.classList.remove(`selected-text-swatch`,`ring-offset-2`)}),document.querySelector(`[data-color-text-swatch="${p}"]`)?.classList.add(`selected-text-swatch`,`ring-offset-2`))}function Ne(e){e&&(f=e,document.querySelectorAll(`.color-swatch-btn`).forEach(e=>{e.classList.remove(`selected-swatch`,`ring-offset-2`)}),document.querySelector(`[data-color-swatch="${f}"]`)?.classList.add(`selected-swatch`,`ring-offset-2`))}function Fe(e,t){let n=Dp(t,e,{inlineIndent:u});switch(t){case`collapsible`:n.summary!==void 0&&Ie(`snip-collapsible-summary`,n.summary),Ie(`snip-collapsible-body`,n.body||``);break;case`link`:n.text!==void 0&&(Ie(`snip-link-text`,n.text),Ie(`snip-link-url`,n.url));break;case`doc-link`:if(n.docId!==void 0){let e=_(`snip-doc-select`);je(e,n.docId);let t=e.options[e.selectedIndex]?.text??``;Ie(`snip-doc-link-text`,n.text===t?``:n.text)}break;case`anchor-link`:if(n.anchor!==void 0){Ie(`snip-anchor-text`,n.text);let e=_(`snip-anchor-id`);j(e,n.anchor),e.value=n.anchor}break;case`anchor-doc-link`:n.docId!==void 0&&(je(_(`snip-anchor-doc-select`),n.docId),Ie(`snip-anchor-doc-text`,n.text),ge().then(()=>{let e=_(`snip-anchor-doc-id`);e&&(j(e,n.anchor),e.value=n.anchor,A())}));break;case`ordered-list`:Ie(`snip-ordered-list-content`,n.content);break;case`unordered-list`:Ie(`snip-unordered-list-content`,n.content);break;case`code-block`:Ie(`snip-code-lang`,n.lang),Ie(`snip-code-content`,n.code);break;case`blockquote`:Ie(`snip-blockquote-content`,n.content);break;case`image`:n.alt!==void 0&&(Ie(`snip-image-alt`,n.alt),Ie(`snip-image-url`,n.url));break;case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:Ie(`snip-heading-content`,n.text);break;case`table`:{Ie(`snip-table-style`,n.attrs.style||``);let e=_(`snip-table-bordered`);e&&(e.checked=n.attrs.border===`bordered`),Ie(`snip-table-color`,n.attrs.color||``),m.data=n.rows,tp(m);break}case`tree`:h.items=n.items,lp(h);break;case`colored-text`:n.color!==void 0&&(Me(M(n.color)),Ie(`snip-colored-text-content`,n.content));break;case`colored-section`:n.borderColor&&Ne(M(n.borderColor)),n.content!==void 0&&Ie(`snip-colored-content`,n.content);break}A()}function Ie(e,t){let n=_(e);n&&(n.value=t??``)}function Le(){let e=$.allDocs.map(e=>`<option value="${g(e.id)}">${g(e.title)}</option>`).join(``),t=_(`snip-doc-select`);t&&(t.innerHTML=e);let n=_(`snip-anchor-doc-select`);n&&(n.innerHTML=e),he(),ge()}function Re(){let e=r()===`inline-edit`,t=_(`snippet-modal-title`);if(t){let n=`snippet.modal_title`;e?n=`snippet.inline_modal_title`:r()===`inline-insert`&&(n=`snippet.inline_insert_modal_title`),t.textContent=Y(n)}let n=_(`snippet-submit-btn`);n&&(n.textContent=Y(e?`snippet.inline_save_btn`:`snippet.insert_btn`));let i=_(`snippet-type`);i&&(i.disabled=e,i.classList.toggle(`cursor-not-allowed`,e),i.classList.toggle(`opacity-70`,e));let a=_(`snippet-delete-btn`);a&&a.classList.toggle(`hidden`,!e);let o=_(`snippet-modal-card`);o&&(o.classList.toggle(`max-w-6xl`,!e),o.classList.toggle(`max-w-5xl`,e))}let ze=!1;On(()=>{t.open&&!ze?(ze=!0,u=``,r()===`inline-edit`&&a()?(c=a().start,l=a().end,u=a().indent||``):r()===`inline-insert`?c=l=Math.max(0,Math.min(i().length,Number(o())||0)):n()&&(c=n().selectionStart,l=n().selectionEnd),f=`info`,p=`info`,queueMicrotask(()=>{if(Re(),Le(),r()===`inline-edit`&&a()){let e=i().slice(c,l),t=_(`snippet-type`);t&&(t.value=a().type),ve(),Fe(e,a().type),S(!1)}else if(r()===`inline-insert`)x();else{let e=n()?n().value.slice(c,l):``,t=e?Op(e):null;if(t){let n=_(`snippet-type`);n&&(n.value=t),ve(),Fe(e,t),S()}else x()}})):t.open||(ze=!1)});var Be=Ap(),Ve=z(Be),He=e=>{var n=kp(),r=R(n),i=R(r),a=R(i),o=R(a,!0);N(a),N(i);var s=B(i,4),c=R(s),l=B(c,4),u=R(l,!0);N(l),N(s);var d=B(s,2),f=B(R(d),2),p=R(f,!0);N(f),N(d);var g=B(d,2),_=R(g),v=R(_,!0);N(_);var y=B(_,2),b=R(y),x=R(b,!0);N(b),b.value=b.__value=`diagram`;var S=B(b),C=R(S,!0);N(S),S.value=S.__value=`heading-1`;var E=B(S),ee=R(E,!0);N(E),E.value=E.__value=`heading-2`;var O=B(E),te=R(O,!0);N(O),O.value=O.__value=`heading-3`;var k=B(O),ne=R(k,!0);N(k),k.value=k.__value=`heading-4`;var re=B(k),ie=R(re,!0);N(re),re.value=re.__value=`collapsible`;var oe=B(re),le=R(oe,!0);N(oe),oe.value=oe.__value=`link`;var ue=B(oe),de=R(ue,!0);N(ue),ue.value=ue.__value=`doc-link`;var fe=B(ue),pe=R(fe,!0);N(fe),fe.value=fe.__value=`anchor-link`;var me=B(fe),he=R(me,!0);N(me),me.value=me.__value=`anchor-doc-link`;var _e=B(me),ye=R(_e,!0);N(_e),_e.value=_e.__value=`ordered-list`;var Se=B(_e),Ce=R(Se,!0);N(Se),Se.value=Se.__value=`unordered-list`;var we=B(Se),Te=R(we,!0);N(we),we.value=we.__value=`code-block`;var Ee=B(we),ke=R(Ee,!0);N(Ee),Ee.value=Ee.__value=`blockquote`;var Ae=B(Ee),j=R(Ae,!0);N(Ae),Ae.value=Ae.__value=`separator`;var je=B(Ae),M=R(je,!0);N(je),je.value=je.__value=`image`;var Me=B(je),Ne=R(Me,!0);N(Me),Me.value=Me.__value=`table`;var Fe=B(Me),Ie=R(Fe,!0);N(Fe),Fe.value=Fe.__value=`tree`;var Le=B(Fe),Re=R(Le,!0);N(Le),Le.value=Le.__value=`colored-section`;var ze=B(Le),Be=R(ze,!0);N(ze),ze.value=ze.__value=`colored-text`;var Ve=B(ze),He=R(Ve,!0);N(Ve),Ve.value=Ve.__value=`emojis`;var Ue=B(Ve),We=R(Ue,!0);N(Ue),Ue.value=Ue.__value=`attachment`;var Ge=B(Ue),Ke=R(Ge,!0);N(Ge),Ge.value=Ge.__value=`local-search`,N(y),N(g);var qe=B(g,2),Je=R(qe),Ye=R(Je),Xe=R(Ye,!0);N(Ye);var Ze=B(Ye,2);N(Je),N(qe);var Qe=B(qe,2),$e=R(Qe),et=R($e),tt=R(et,!0);N(et);var nt=B(et,2);N($e);var rt=B($e,2),it=R(rt),at=R(it,!0);N(it);var ot=B(it,2);N(rt),N(Qe);var st=B(Qe,2),ct=R(st),lt=R(ct),ut=R(lt,!0);N(lt);var dt=B(lt,2);N(ct);var ft=B(ct,2),pt=R(ft),mt=R(pt,!0);N(pt);var ht=B(pt,2);N(ft),N(st);var gt=B(st,2),_t=R(gt),vt=R(_t),yt=R(vt,!0);N(vt);var bt=B(vt,2);N(_t);var xt=B(_t,2),St=R(xt),Ct=R(St),wt=R(Ct,!0);N(Ct);var Tt=B(Ct,2),Et=R(Tt,!0);N(Tt),N(St);var Dt=B(St,2);N(xt),N(gt);var Ot=B(gt,2),kt=R(Ot),At=R(kt),jt=R(At,!0);N(At);var Mt=B(At,2);N(kt);var Nt=B(kt,2),Pt=R(Nt),Ft=R(Pt),It=R(Ft,!0);N(Ft);var Lt=B(Ft,2),Rt=R(Lt,!0);N(Lt),N(Pt);var zt=B(Pt,2);N(Nt),N(Ot);var Bt=B(Ot,2),P=R(Bt),Vt=R(P),Ht=R(Vt,!0);N(Vt);var Ut=B(Vt,2);N(P);var Wt=B(P,2),Gt=R(Wt),Kt=R(Gt,!0);N(Gt);var qt=B(Gt,2);N(Wt);var Jt=B(Wt,2),Yt=R(Jt),Xt=R(Yt),F=R(Xt,!0);N(Xt);var Zt=B(Xt,2),I=R(Zt,!0);N(Zt),N(Yt);var Qt=B(Yt,2);N(Jt),N(Bt);var $t=B(Bt,2),en=R($t),tn=R(en),L=R(tn,!0);N(tn);var nn=B(tn,2);N(en),N($t);var rn=B($t,2),an=R(rn),on=R(an),sn=R(on,!0);N(on);var cn=B(on,2);N(an),N(rn);var ln=B(rn,2),un=R(ln),dn=R(un),fn=R(dn),z=R(fn,!0);N(fn);var pn=B(fn,2),mn=R(pn,!0);N(pn),N(dn);var hn=B(dn,2);N(un);var gn=B(un,2),_n=R(gn),vn=R(_n,!0);N(_n);var yn=B(_n,2);N(gn),N(ln);var bn=B(ln,2),xn=R(bn),Sn=R(xn),Cn=R(Sn,!0);N(Sn);var wn=B(Sn,2);N(xn),N(bn);var Tn=B(bn,2),En=R(Tn),Dn=R(En),On=R(Dn,!0);N(Dn);var kn=B(Dn,2);N(En);var An=B(En,2),jn=R(An),Mn=R(jn,!0);N(jn);var Nn=B(jn,2);N(An),N(Tn);var Pn=B(Tn,2),Fn=R(Pn),In=R(Fn),Ln=R(In),Rn=R(Ln,!0);N(Ln);var zn=B(Ln,2),Bn=R(zn),Vn=R(Bn,!0);N(Bn),Bn.value=Bn.__value=``;var Hn=B(Bn),Un=R(Hn,!0);N(Hn),Hn.value=Hn.__value=`compact`;var Wn=B(Hn),Gn=R(Wn,!0);N(Wn),Wn.value=Wn.__value=`striped`,N(zn),N(In);var Kn=B(In,2),qn=R(Kn),Jn=B(qn,2),Yn=R(Jn,!0);N(Jn),N(Kn);var Xn=B(Kn,2),Zn=R(Xn),Qn=R(Zn,!0);N(Zn);var $n=B(Zn,2),er=R($n),tr=R(er,!0);N(er),er.value=er.__value=``;var nr=B(er),rr=R(nr,!0);N(nr),nr.value=nr.__value=`info`;var ir=B(nr),ar=R(ir,!0);N(ir),ir.value=ir.__value=`success`;var or=B(ir),sr=R(or,!0);N(or),or.value=or.__value=`warning`;var cr=B(or),lr=R(cr,!0);N(cr),cr.value=cr.__value=`danger`;var ur=B(cr),dr=R(ur,!0);N(ur),ur.value=ur.__value=`note`,N($n),N(Xn);var fr=B(Xn,2),pr=R(fr),mr=R(pr,!0);N(pr);var hr=B(pr,2),gr=B(hr,4);N(fr);var _r=B(fr,2),vr=R(_r),yr=R(vr,!0);N(vr);var br=B(vr,2),H=B(br,4);N(_r),N(Fn),Pe(2),N(Pn);var xr=B(Pn,2),Sr=R(xr),Cr=R(Sr,!0);N(Sr);var wr=B(Sr,4),Tr=R(wr,!0);N(wr),N(xr);var Er=B(xr,2),Dr=R(Er),Or=R(Dr),kr=R(Or);Ei(kr);var Ar=B(kr,2),jr=R(Ar,!0);N(Ar),N(Or);var Mr=B(Or,2),Nr=R(Mr),Pr=B(Nr,2),Fr=R(Pr,!0);N(Pr),N(Mr),N(Dr);var Ir=B(Dr,2),Lr=R(Ir),Rr=R(Lr,!0);N(Lr);var zr=B(Lr,2);N(Ir);var W=B(Ir,2),Br=R(W),Vr=R(Br,!0);N(Br);var Hr=B(Br,2);N(W);var Ur=B(W,2),Wr=R(Ur),Gr=R(Wr),Kr=R(Gr,!0);N(Gr);var qr=B(Gr,2),Jr=R(qr,!0);N(qr),N(Wr);var q=B(Wr,2);N(Ur),N(Er);var Yr=B(Er,2),Xr=R(Yr),Zr=R(Xr),Qr=R(Zr,!0);N(Zr);var $r=B(Zr,2),ei=R($r),ti=B(ei,2),ni=B(ti,2),ri=B(ni,2),ii=B(ri,2),oi=B(ii,2);N($r),N(Xr);var si=B(Xr,2),ci=R(si),li=R(ci,!0);N(ci);var ui=B(ci,2);N(si),N(Yr);var di=B(Yr,2),fi=R(di),pi=R(fi),mi=R(pi,!0);N(pi);var hi=B(pi,2),gi=R(hi),_i=B(gi,2),vi=B(_i,2),yi=B(vi,2),bi=B(yi,2),xi=B(bi,2);N(hi),N(fi);var Si=B(fi,2),Ci=R(Si),wi=R(Ci,!0);N(Ci);var Ti=B(Ci,2);N(Si),N(di);var Di=B(di,2),Oi=R(Di),ki=R(Oi),Ai=R(ki,!0);N(ki);var ji=B(ki,2),Mi=R(ji),Ni=B(Mi,2),Pi=R(Ni,!0);N(Ni),N(ji),N(Oi);var Fi=B(Oi,2),Ii=R(Fi);N(Fi),Pe(2),N(Di);var Li=B(Di,2),Ri=R(Li),zi=R(Ri);ai(zi,()=>Y(`snippet.attachment_help`),!0),N(zi);var Bi=B(zi,2);ai(Bi,()=>Y(`snippet.attachment_alt`),!0),N(Bi),N(Ri),N(Li);var Vi=B(Li,2),Hi=R(Vi),Ui=R(Hi,!0);N(Hi),Pe(2),N(Vi);var Wi=B(Vi,2),Gi=R(Wi),Ki=R(Gi,!0);N(Gi);var qi=B(Gi,2),Ji=R(qi,!0);N(qi);var Yi=B(qi,2),Xi=R(Yi,!0);N(Yi),N(Wi),N(r),N(n),V((e,t,n,r,i,a,s,l,d,f,m,h,g,_,y,b,S,w,T,E,D,O,k,re,ae,oe,se,ce,ue,fe,me,ge,_e,ve,be,xe,Se,we,A,Ee,De,Oe,Ae,je,Me,N,Pe,Fe,Le,ze,Ve,Ue,Ge,qe,Je,Ye,Qe,$e,et,nt,rt,it,st,ct,lt,ft,pt,gt,_t,vt,bt,xt,St,Ct,Tt,Dt,Ot,kt,At,Nt,Pt,Ft,Lt,zt,Bt,P,Vt,Ut,Wt,Gt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,rn,an,on,ln,un,dn,fn,R,B,pn,hn,gn,_n,bn,xn,Sn,Tn,En,Dn,An,jn,Pn,V,Fn,In)=>{K(o,e),J(c,`placeholder`,t),K(u,n),K(p,r),K(v,i),K(x,a),K(C,s),K(ee,l),K(te,d),K(ne,f),K(ie,m),K(le,h),K(de,g),K(pe,_),K(he,y),K(ye,b),K(Ce,S),K(Te,w),K(ke,T),K(j,E),K(M,D),K(Ne,O),K(Ie,k),K(Re,re),K(Be,ae),K(He,oe),K(We,se),K(Ke,ce),K(Xe,ue),J(Ze,`placeholder`,fe),K(tt,me),K(at,ge),J(ot,`placeholder`,_e),K(ut,ve),J(dt,`placeholder`,be),K(mt,xe),J(ht,`placeholder`,Se),K(yt,we),K(wt,A),K(Et,Ee),K(jt,De),J(Mt,`placeholder`,Oe),K(It,Ae),K(Rt,je),K(Ht,Me),K(Kt,N),J(qt,`placeholder`,Pe),K(F,Fe),K(I,Le),K(L,ze),J(nn,`placeholder`,Ve),K(sn,Ue),J(cn,`placeholder`,Ge),K(z,qe),K(mn,Je),K(vn,Ye),J(yn,`placeholder`,Qe),K(Cn,$e),J(wn,`placeholder`,et),K(On,nt),J(kn,`placeholder`,rt),K(Mn,it),J(Nn,`placeholder`,st),K(Rn,ct),K(Vn,lt),K(Un,ft),K(Gn,pt),K(Yn,gt),K(Qn,_t),K(tr,vt),K(rr,bt),K(ar,xt),K(sr,St),K(lr,Ct),K(dr,Tt),K(mr,Dt),K(yr,Ot),K(Cr,kt),K(Tr,At),K(jr,Nt),K(Fr,Pt),K(Rr,Ft),K(Vr,Lt),J(Hr,`placeholder`,zt),K(Kr,Bt),K(Jr,P),K(Qr,Vt),J(ei,`title`,Ut),J(ei,`aria-label`,Wt),J(ti,`title`,Gt),J(ti,`aria-label`,Jt),J(ni,`title`,Yt),J(ni,`aria-label`,Xt),J(ri,`title`,Zt),J(ri,`aria-label`,Qt),J(ii,`title`,$t),J(ii,`aria-label`,en),J(oi,`title`,tn),J(oi,`aria-label`,rn),K(li,an),J(ui,`placeholder`,on),K(mi,ln),J(gi,`title`,un),J(gi,`aria-label`,dn),J(_i,`title`,fn),J(_i,`aria-label`,R),J(vi,`title`,B),J(vi,`aria-label`,pn),J(yi,`title`,hn),J(yi,`aria-label`,gn),J(bi,`title`,_n),J(bi,`aria-label`,bn),J(xi,`title`,xn),J(xi,`aria-label`,Sn),K(wi,Tn),J(Ti,`placeholder`,En),K(Ai,Dn),K(Pi,An),J(Ii,`placeholder`,jn),K(Ui,Pn),K(Ki,V),K(Ji,Fn),K(Xi,In)},[()=>Y(`snippet.modal_title`),()=>Y(`snippet.picker_search_placeholder`),()=>Y(`snippet.picker_no_results`),()=>Y(`snippet.picker_back`),()=>Y(`snippet.type_label`),()=>Y(`snippet.diagram`),()=>Y(`snippet.heading_1`),()=>Y(`snippet.heading_2`),()=>Y(`snippet.heading_3`),()=>Y(`snippet.heading_4`),()=>Y(`snippet.collapsible`),()=>Y(`snippet.link`),()=>Y(`snippet.link_doc`),()=>Y(`snippet.link_anchor`),()=>Y(`snippet.link_doc_anchor`),()=>Y(`snippet.numbered_list`),()=>Y(`snippet.bullet_list`),()=>Y(`snippet.code_block`),()=>Y(`snippet.blockquote`),()=>Y(`snippet.separator`),()=>Y(`snippet.image`),()=>Y(`snippet.table`),()=>Y(`snippet.tree`),()=>Y(`snippet.colored_section`),()=>Y(`snippet.colored_text`),()=>Y(`snippet.emojis`),()=>Y(`snippet.attachment`),()=>Y(`snippet.local_search`),()=>Y(`snippet.heading_text_label`),()=>Y(`snippet.heading_text_placeholder`),()=>Y(`snippet.collapsible_summary_label`),()=>Y(`snippet.collapsible_body_label`),()=>Y(`snippet.collapsible_body_placeholder`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_text_placeholder`),()=>Y(`snippet.link_url_label`),()=>Y(`snippet.link_url_placeholder`),()=>Y(`snippet.link_doc_label`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_doc_text_hint`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_section_placeholder`),()=>Y(`snippet.link_anchor_label`),()=>Y(`snippet.link_anchor_select_hint`),()=>Y(`snippet.link_target_doc_label`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_section_placeholder`),()=>Y(`snippet.link_anchor_label`),()=>Y(`snippet.link_anchor_select_hint`),()=>Y(`snippet.ordered_list_content_label`),()=>Y(`snippet.ordered_list_content_placeholder`),()=>Y(`snippet.unordered_list_content_label`),()=>Y(`snippet.unordered_list_content_placeholder`),()=>Y(`snippet.code_lang_label`),()=>Y(`snippet.code_lang_hint`),()=>Y(`snippet.code_content_label`),()=>Y(`snippet.code_content_placeholder`),()=>Y(`snippet.blockquote_content_label`),()=>Y(`snippet.blockquote_content_placeholder`),()=>Y(`snippet.image_alt_label`),()=>Y(`snippet.image_alt_placeholder`),()=>Y(`snippet.image_url_label`),()=>Y(`snippet.image_src_placeholder`),()=>Y(`snippet.table_style_label`),()=>Y(`snippet.table_style_default`),()=>Y(`snippet.table_style_compact`),()=>Y(`snippet.table_style_striped`),()=>Y(`snippet.table_border_label`),()=>Y(`snippet.table_color_label`),()=>Y(`snippet.table_color_default`),()=>Y(`snippet.table_color_info`),()=>Y(`snippet.table_color_success`),()=>Y(`snippet.table_color_warning`),()=>Y(`snippet.table_color_danger`),()=>Y(`snippet.table_color_note`),()=>Y(`snippet.table_rows_label`),()=>Y(`snippet.table_cols_label`),()=>Y(`snippet.tree_hint`),()=>Y(`snippet.tree_add_btn`),()=>Y(`snippet.diagram_existing`),()=>Y(`snippet.diagram_new`),()=>Y(`snippet.diagram_select_label`),()=>Y(`snippet.diagram_name_label`),()=>Y(`snippet.diagram_name_placeholder`),()=>Y(`snippet.diag_img_label`),()=>Y(`snippet.diag_img_saved_hint`),()=>Y(`snippet.colored_section_color_label`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_section_content_label`),()=>Y(`snippet.colored_section_content_placeholder`),()=>Y(`snippet.colored_text_color_label`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_text_content_label`),()=>Y(`snippet.colored_text_content_placeholder`),()=>Y(`snippet.emoji_selected_label`),()=>Y(`snippet.emoji_clear_btn`),()=>Y(`snippet.emoji_search_placeholder`),()=>Y(`snippet.markdown_preview_label`),()=>Y(`snippet.inline_delete_btn`),()=>Y(`common.cancel`),()=>Y(`snippet.insert_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),U(`input`,c,w),U(`keydown`,c,T),U(`click`,d,D),U(`change`,y,ve),U(`input`,Ze,A),U(`input`,nt,A),U(`input`,ot,A),U(`input`,dt,A),U(`input`,ht,A),U(`change`,bt,A),U(`input`,Dt,A),U(`input`,Mt,A),U(`change`,zt,A),U(`change`,Ut,ge),U(`input`,qt,A),U(`change`,Qt,A),U(`input`,nn,A),U(`input`,cn,A),U(`input`,hn,A),U(`input`,yn,A),U(`input`,wn,A),U(`input`,kn,A),U(`input`,Nn,A),U(`change`,zn,A),U(`change`,qn,A),U(`change`,$n,A),U(`click`,hr,()=>np(m,-1)),U(`click`,gr,()=>np(m,1)),U(`click`,br,()=>rp(m,-1)),U(`click`,H,()=>rp(m,1)),U(`click`,wr,()=>dp(h)),U(`change`,kr,be),U(`change`,Nr,be),U(`change`,zr,()=>{xe(),A()}),U(`input`,Hr,()=>{xe(),A()}),U(`input`,q,A),U(`click`,ei,e=>se(e.currentTarget)),U(`click`,ti,e=>se(e.currentTarget)),U(`click`,ni,e=>se(e.currentTarget)),U(`click`,ri,e=>se(e.currentTarget)),U(`click`,ii,e=>se(e.currentTarget)),U(`click`,oi,e=>se(e.currentTarget)),U(`input`,ui,A),U(`click`,gi,e=>ce(e.currentTarget)),U(`click`,_i,e=>ce(e.currentTarget)),U(`click`,vi,e=>ce(e.currentTarget)),U(`click`,yi,e=>ce(e.currentTarget)),U(`click`,bi,e=>ce(e.currentTarget)),U(`click`,xi,e=>ce(e.currentTarget)),U(`input`,Ti,A),U(`input`,Mi,A),U(`click`,Ni,ae),U(`click`,Gi,Oe),U(`click`,qi,function(...e){t.onclose?.apply(this,e)}),U(`click`,Yi,De),G(e,n)};q(Ve,e=>{t.open&&e(He)}),Li(Dl(B(Ve,2),{}),e=>I(d,e,!0),()=>H(d)),G(e,Be),Ke()}Nr([`click`,`input`,`keydown`,`change`]);function Mp(e){let t=``,n=[],r=!0;for(let i=0;i<e.length;i++){let a=e[i].normalize(`NFD`);for(let e=0;e<a.length;e++){let o=a.charCodeAt(e);if(!(o>=768&&o<=879))if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122){let e=o>=65&&o<=90?o+32:o;t+=String.fromCharCode(e),n.push(i),r=!1}else r||=(t+=` `,n.push(i),!0)}}return n.push(e.length),t.endsWith(` `)&&(t=t.slice(0,-1),n.splice(n.length-2,1)),{normalized:t,map:n}}function Np(e){return Mp(e).normalized}function Pp(e,t,n){if(e===t)return 0;let r=e.length,i=t.length;if(Math.abs(r-i)>n)return n+1;let a=null,o=Array(i+1),s=Array(i+1);for(let e=0;e<=i;e++)o[e]=e;for(let c=1;c<=r;c++){s[0]=c;let r=c;for(let n=1;n<=i;n++){let i=e.charCodeAt(c-1)===t.charCodeAt(n-1)?0:1,l=Math.min(o[n]+1,s[n-1]+1,o[n-1]+i);c>1&&n>1&&e.charCodeAt(c-1)===t.charCodeAt(n-2)&&e.charCodeAt(c-2)===t.charCodeAt(n-1)&&(l=Math.min(l,a[n-2]+1)),s[n]=l,l<r&&(r=l)}if(r>n)return n+1;a=o,o=s,s=Array(i+1)}return o[i]}function Fp(e){return e>=7?2:+(e>=4)}function Ip(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Lp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Rp(e,t,n){t.innerHTML=``,t.classList.add(`hidden`);let r=e.querySelectorAll(`[data-ld-local-search]`);if(!r.length)return;r.forEach(e=>e.remove());let i=(()=>{let t=new Set;return Np(e.textContent||``).split(` `).forEach(e=>{e.length>=3&&t.add(e)}),Array.from(t)})(),a=n(`local_search.placeholder`)||`Search in this document…`,o=n(`local_search.clear`)||`Clear`,s=document.createElement(`div`);s.className=`no-print mt-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 overflow-hidden`,s.innerHTML=`
|
|
69
|
+
`,a=e+n+l+r+t;try{s()&&await s()(a)}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)));return}}else if(Oe(l),$.currentDocId&&n())try{await fetch(`/api/documents/`+$.currentDocId,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:n().value})})}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)));return}De(),window.location.href=`/diagram?id=${a}&img=${encodeURIComponent(t)}`}function M(e,t){if(Array.from(e.options).some(e=>e.value===t))return;let n=document.createElement(`option`);n.value=t,n.textContent=t,e.insertBefore(n,e.firstChild)}function Me(e,t){for(let n of Array.from(e.options))if(n.value===t){e.value=n.value;return}}function Ne(e){let t=Object.entries(wf).find(([,t])=>t.border===e);return t?t[0]:null}function Fe(e){e&&(p=e,document.querySelectorAll(`.color-text-swatch-btn`).forEach(e=>{e.classList.remove(`selected-text-swatch`,`ring-offset-2`)}),document.querySelector(`[data-color-text-swatch="${p}"]`)?.classList.add(`selected-text-swatch`,`ring-offset-2`))}function Ie(e){e&&(f=e,document.querySelectorAll(`.color-swatch-btn`).forEach(e=>{e.classList.remove(`selected-swatch`,`ring-offset-2`)}),document.querySelector(`[data-color-swatch="${f}"]`)?.classList.add(`selected-swatch`,`ring-offset-2`))}function Le(e,t){let n=Vp(t,e,{inlineIndent:u});switch(t){case`collapsible`:n.summary!==void 0&&Re(`snip-collapsible-summary`,n.summary),Re(`snip-collapsible-body`,n.body||``);break;case`link`:n.text!==void 0&&(Re(`snip-link-text`,n.text),Re(`snip-link-url`,n.url));break;case`doc-link`:if(n.docId!==void 0){let e=_(`snip-doc-select`);Me(e,n.docId);let t=e.options[e.selectedIndex]?.text??``;Re(`snip-doc-link-text`,n.text===t?``:n.text)}break;case`anchor-link`:if(n.anchor!==void 0){Re(`snip-anchor-text`,n.text);let e=_(`snip-anchor-id`);M(e,n.anchor),e.value=n.anchor}break;case`anchor-doc-link`:n.docId!==void 0&&(Me(_(`snip-anchor-doc-select`),n.docId),Re(`snip-anchor-doc-text`,n.text),ge().then(()=>{let e=_(`snip-anchor-doc-id`);e&&(M(e,n.anchor),e.value=n.anchor,A())}));break;case`ordered-list`:Re(`snip-ordered-list-content`,n.content);break;case`unordered-list`:Re(`snip-unordered-list-content`,n.content);break;case`code-block`:Re(`snip-code-lang`,n.lang),Re(`snip-code-content`,n.code);break;case`blockquote`:Re(`snip-blockquote-content`,n.content);break;case`image`:n.alt!==void 0&&(Re(`snip-image-alt`,n.alt),Re(`snip-image-url`,n.url));break;case`heading-1`:case`heading-2`:case`heading-3`:case`heading-4`:Re(`snip-heading-content`,n.text);break;case`table`:{Re(`snip-table-style`,n.attrs.style||``);let e=_(`snip-table-bordered`);e&&(e.checked=n.attrs.border===`bordered`),Re(`snip-table-color`,n.attrs.color||``),m.data=n.rows,_p(m);break}case`tree`:h.items=n.items,Cp(h);break;case`colored-text`:n.color!==void 0&&(Fe(Ne(n.color)),Re(`snip-colored-text-content`,n.content));break;case`colored-section`:n.borderColor&&Ie(Ne(n.borderColor)),n.content!==void 0&&Re(`snip-colored-content`,n.content);break}A()}function Re(e,t){let n=_(e);n&&(n.value=t??``)}function ze(){let e=$.allDocs.map(e=>`<option value="${g(e.id)}">${g(e.title)}</option>`).join(``),t=_(`snip-doc-select`);t&&(t.innerHTML=e);let n=_(`snip-anchor-doc-select`);n&&(n.innerHTML=e),he(),ge()}function Be(){let e=r()===`inline-edit`,t=_(`snippet-modal-title`);if(t){let n=`snippet.modal_title`;e?n=`snippet.inline_modal_title`:r()===`inline-insert`&&(n=`snippet.inline_insert_modal_title`),t.textContent=Y(n)}let n=_(`snippet-submit-btn`);n&&(n.textContent=Y(e?`snippet.inline_save_btn`:`snippet.insert_btn`));let i=_(`snippet-type`);i&&(i.disabled=e,i.classList.toggle(`cursor-not-allowed`,e),i.classList.toggle(`opacity-70`,e));let a=_(`snippet-delete-btn`);a&&a.classList.toggle(`hidden`,!e);let o=_(`snippet-modal-card`);o&&(o.classList.toggle(`max-w-6xl`,!e),o.classList.toggle(`max-w-5xl`,e))}let Ve=!1;On(()=>{t.open&&!Ve?(Ve=!0,u=``,r()===`inline-edit`&&a()?(c=a().start,l=a().end,u=a().indent||``):r()===`inline-insert`?c=l=Math.max(0,Math.min(i().length,Number(o())||0)):n()&&(c=n().selectionStart,l=n().selectionEnd),f=`info`,p=`info`,queueMicrotask(()=>{if(Be(),ze(),r()===`inline-edit`&&a()){let e=i().slice(c,l),t=_(`snippet-type`);t&&(t.value=a().type),ve(),Le(e,a().type),S(!1),a().type===`table`&&a().tableFocusCell&&sp(a().tableFocusCell.row,a().tableFocusCell.col,!0)}else if(r()===`inline-insert`)x();else{let e=n()?n().value.slice(c,l):``,t=e?Hp(e):null;if(t){let n=_(`snippet-type`);n&&(n.value=t),ve(),Le(e,t),S()}else x()}})):t.open||(Ve=!1)});var He=Wp(),Ue=z(He),We=e=>{var t=Up(),n=R(t),r=R(n),i=R(r),a=R(i,!0);N(i),N(r);var o=B(r,4),s=R(o),c=B(s,4),l=R(c,!0);N(c),N(o);var u=B(o,2),d=B(R(u),2),f=R(d,!0);N(d),N(u);var p=B(u,2),m=R(p),g=R(m,!0);N(m);var _=B(m,2),v=R(_),y=R(v,!0);N(v),v.value=v.__value=`diagram`;var b=B(v),x=R(b,!0);N(b),b.value=b.__value=`heading-1`;var S=B(b),C=R(S,!0);N(S),S.value=S.__value=`heading-2`;var E=B(S),ee=R(E,!0);N(E),E.value=E.__value=`heading-3`;var O=B(E),te=R(O,!0);N(O),O.value=O.__value=`heading-4`;var k=B(O),ne=R(k,!0);N(k),k.value=k.__value=`collapsible`;var re=B(k),ie=R(re,!0);N(re),re.value=re.__value=`link`;var oe=B(re),le=R(oe,!0);N(oe),oe.value=oe.__value=`doc-link`;var ue=B(oe),de=R(ue,!0);N(ue),ue.value=ue.__value=`anchor-link`;var fe=B(ue),pe=R(fe,!0);N(fe),fe.value=fe.__value=`anchor-doc-link`;var me=B(fe),he=R(me,!0);N(me),me.value=me.__value=`ordered-list`;var _e=B(me),ye=R(_e,!0);N(_e),_e.value=_e.__value=`unordered-list`;var Se=B(_e),Ce=R(Se,!0);N(Se),Se.value=Se.__value=`code-block`;var we=B(Se),Te=R(we,!0);N(we),we.value=we.__value=`blockquote`;var Oe=B(we),j=R(Oe,!0);N(Oe),Oe.value=Oe.__value=`separator`;var je=B(Oe),M=R(je,!0);N(je),je.value=je.__value=`image`;var Me=B(je),Ne=R(Me,!0);N(Me),Me.value=Me.__value=`table`;var Fe=B(Me),Ie=R(Fe,!0);N(Fe),Fe.value=Fe.__value=`tree`;var Le=B(Fe),Re=R(Le,!0);N(Le),Le.value=Le.__value=`colored-section`;var ze=B(Le),Be=R(ze,!0);N(ze),ze.value=ze.__value=`colored-text`;var Ve=B(ze),He=R(Ve,!0);N(Ve),Ve.value=Ve.__value=`emojis`;var Ue=B(Ve),We=R(Ue,!0);N(Ue),Ue.value=Ue.__value=`attachment`;var Ge=B(Ue),Ke=R(Ge,!0);N(Ge),Ge.value=Ge.__value=`local-search`,N(_),N(p);var qe=B(p,2),Je=R(qe),Ye=R(Je),Xe=R(Ye,!0);N(Ye);var Ze=B(Ye,2);N(Je),N(qe);var Qe=B(qe,2),$e=R(Qe),et=R($e),tt=R(et,!0);N(et);var nt=B(et,2);N($e);var rt=B($e,2),it=R(rt),at=R(it,!0);N(it);var ot=B(it,2);N(rt),N(Qe);var st=B(Qe,2),ct=R(st),lt=R(ct),ut=R(lt,!0);N(lt);var dt=B(lt,2);N(ct);var ft=B(ct,2),pt=R(ft),mt=R(pt,!0);N(pt);var ht=B(pt,2);N(ft),N(st);var gt=B(st,2),_t=R(gt),vt=R(_t),yt=R(vt,!0);N(vt);var bt=B(vt,2);N(_t);var xt=B(_t,2),St=R(xt),Ct=R(St),wt=R(Ct,!0);N(Ct);var Tt=B(Ct,2),Et=R(Tt,!0);N(Tt),N(St);var Dt=B(St,2);N(xt),N(gt);var Ot=B(gt,2),kt=R(Ot),At=R(kt),jt=R(At,!0);N(At);var Mt=B(At,2);N(kt);var Nt=B(kt,2),Pt=R(Nt),Ft=R(Pt),It=R(Ft,!0);N(Ft);var Lt=B(Ft,2),Rt=R(Lt,!0);N(Lt),N(Pt);var zt=B(Pt,2);N(Nt),N(Ot);var Bt=B(Ot,2),P=R(Bt),Vt=R(P),Ht=R(Vt,!0);N(Vt);var Ut=B(Vt,2);N(P);var Wt=B(P,2),Gt=R(Wt),Kt=R(Gt,!0);N(Gt);var qt=B(Gt,2);N(Wt);var Jt=B(Wt,2),Yt=R(Jt),Xt=R(Yt),F=R(Xt,!0);N(Xt);var Zt=B(Xt,2),I=R(Zt,!0);N(Zt),N(Yt);var Qt=B(Yt,2);N(Jt),N(Bt);var $t=B(Bt,2),en=R($t),tn=R(en),L=R(tn,!0);N(tn);var nn=B(tn,2);N(en),N($t);var rn=B($t,2),an=R(rn),on=R(an),sn=R(on,!0);N(on);var cn=B(on,2);N(an),N(rn);var ln=B(rn,2),un=R(ln),dn=R(un),fn=R(dn),z=R(fn,!0);N(fn);var pn=B(fn,2),mn=R(pn,!0);N(pn),N(dn);var hn=B(dn,2);N(un);var gn=B(un,2),_n=R(gn),vn=R(_n,!0);N(_n);var yn=B(_n,2);N(gn),N(ln);var bn=B(ln,2),xn=R(bn),Sn=R(xn),Cn=R(Sn,!0);N(Sn);var wn=B(Sn,2);N(xn),N(bn);var Tn=B(bn,2),En=R(Tn),Dn=R(En),On=R(Dn,!0);N(Dn);var kn=B(Dn,2);N(En);var An=B(En,2),jn=R(An),Mn=R(jn,!0);N(jn);var Nn=B(jn,2);N(An),N(Tn);var Pn=B(Tn,2),Fn=R(Pn),In=R(Fn),Ln=R(In),Rn=R(Ln,!0);N(Ln);var zn=B(Ln,2),Bn=R(zn),Vn=R(Bn,!0);N(Bn),Bn.value=Bn.__value=``;var Hn=B(Bn),Un=R(Hn,!0);N(Hn),Hn.value=Hn.__value=`compact`;var Wn=B(Hn),Gn=R(Wn,!0);N(Wn),Wn.value=Wn.__value=`striped`,N(zn),N(In);var Kn=B(In,2),qn=R(Kn),Jn=B(qn,2),Yn=R(Jn,!0);N(Jn),N(Kn);var Xn=B(Kn,2),Zn=R(Xn),Qn=R(Zn,!0);N(Zn);var $n=B(Zn,2),er=R($n),tr=R(er,!0);N(er),er.value=er.__value=``;var nr=B(er),rr=R(nr,!0);N(nr),nr.value=nr.__value=`info`;var ir=B(nr),ar=R(ir,!0);N(ir),ir.value=ir.__value=`success`;var or=B(ir),sr=R(or,!0);N(or),or.value=or.__value=`warning`;var cr=B(or),lr=R(cr,!0);N(cr),cr.value=cr.__value=`danger`;var ur=B(cr),dr=R(ur,!0);N(ur),ur.value=ur.__value=`note`,N($n),N(Xn);var fr=B(Xn,2),pr=R(fr,!0);N(fr),N(Fn),Pe(2),N(Pn);var mr=B(Pn,2),hr=R(mr),gr=R(hr,!0);N(hr);var _r=B(hr,4),vr=R(_r,!0);N(_r),N(mr);var yr=B(mr,2),br=R(yr),H=R(br),xr=R(H);Ei(xr);var Sr=B(xr,2),Cr=R(Sr,!0);N(Sr),N(H);var wr=B(H,2),Tr=R(wr),Er=B(Tr,2),Dr=R(Er,!0);N(Er),N(wr),N(br);var Or=B(br,2),kr=R(Or),Ar=R(kr,!0);N(kr);var jr=B(kr,2);N(Or);var Mr=B(Or,2),Nr=R(Mr),Pr=R(Nr,!0);N(Nr);var Fr=B(Nr,2);N(Mr);var Ir=B(Mr,2),Lr=R(Ir),Rr=R(Lr),zr=R(Rr,!0);N(Rr);var W=B(Rr,2),Br=R(W,!0);N(W),N(Lr);var Vr=B(Lr,2);N(Ir),N(yr);var Hr=B(yr,2),Ur=R(Hr),Wr=R(Ur),Gr=R(Wr,!0);N(Wr);var Kr=B(Wr,2),qr=R(Kr),Jr=B(qr,2),q=B(Jr,2),Yr=B(q,2),Xr=B(Yr,2),Zr=B(Xr,2);N(Kr),N(Ur);var Qr=B(Ur,2),$r=R(Qr),ei=R($r,!0);N($r);var ti=B($r,2);N(Qr),N(Hr);var ni=B(Hr,2),ri=R(ni),ii=R(ri),oi=R(ii,!0);N(ii);var si=B(ii,2),ci=R(si),li=B(ci,2),ui=B(li,2),di=B(ui,2),fi=B(di,2),pi=B(fi,2);N(si),N(ri);var mi=B(ri,2),hi=R(mi),gi=R(hi,!0);N(hi);var _i=B(hi,2);N(mi),N(ni);var vi=B(ni,2),yi=R(vi),bi=R(yi),xi=R(bi,!0);N(bi);var Si=B(bi,2),Ci=R(Si),wi=B(Ci,2),Ti=R(wi,!0);N(wi),N(Si),N(yi);var Di=B(yi,2),Oi=R(Di);N(Di),Pe(2),N(vi);var ki=B(vi,2),Ai=R(ki),ji=R(Ai);ai(ji,()=>Y(`snippet.attachment_help`),!0),N(ji);var Mi=B(ji,2);ai(Mi,()=>Y(`snippet.attachment_alt`),!0),N(Mi),N(Ai),N(ki);var Ni=B(ki,2),Pi=R(Ni),Fi=R(Pi,!0);N(Pi),Pe(2),N(Ni);var Ii=B(Ni,2),Li=R(Ii),Ri=R(Li,!0);N(Li);var zi=B(Li,2),Bi=R(zi,!0);N(zi);var Vi=B(zi,2),Hi=R(Vi,!0);N(Vi),N(Ii),N(n),N(t),V((e,t,n,r,i,o,c,u,d,p,m,h,_,v,b,S,w,T,E,D,O,k,re,ae,oe,se,ce,ue,fe,me,ge,_e,ve,be,xe,Se,we,A,Ee,De,Oe,ke,Ae,je,Me,N,Pe,Fe,Le,ze,Ve,Ue,Ge,qe,Je,Ye,Qe,$e,et,nt,rt,it,st,ct,lt,ft,pt,gt,_t,vt,bt,xt,St,Ct,Tt,Dt,Ot,kt,At,Nt,Pt,Ft,Lt,zt,Bt,P,Vt,Ut,Wt,Gt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,rn,an,on,ln,un,dn,fn,R,B,pn,hn,gn,_n,bn,xn,Sn,Tn,En,Dn,An,jn,Pn,V,Fn)=>{K(a,e),J(s,`placeholder`,t),K(l,n),K(f,r),K(g,i),K(y,o),K(x,c),K(C,u),K(ee,d),K(te,p),K(ne,m),K(ie,h),K(le,_),K(de,v),K(pe,b),K(he,S),K(ye,w),K(Ce,T),K(Te,E),K(j,D),K(M,O),K(Ne,k),K(Ie,re),K(Re,ae),K(Be,oe),K(He,se),K(We,ce),K(Ke,ue),K(Xe,fe),J(Ze,`placeholder`,me),K(tt,ge),K(at,_e),J(ot,`placeholder`,ve),K(ut,be),J(dt,`placeholder`,xe),K(mt,Se),J(ht,`placeholder`,we),K(yt,A),K(wt,Ee),K(Et,De),K(jt,Oe),J(Mt,`placeholder`,ke),K(It,Ae),K(Rt,je),K(Ht,Me),K(Kt,N),J(qt,`placeholder`,Pe),K(F,Fe),K(I,Le),K(L,ze),J(nn,`placeholder`,Ve),K(sn,Ue),J(cn,`placeholder`,Ge),K(z,qe),K(mn,Je),K(vn,Ye),J(yn,`placeholder`,Qe),K(Cn,$e),J(wn,`placeholder`,et),K(On,nt),J(kn,`placeholder`,rt),K(Mn,it),J(Nn,`placeholder`,st),K(Rn,ct),K(Vn,lt),K(Un,ft),K(Gn,pt),K(Yn,gt),K(Qn,_t),K(tr,vt),K(rr,bt),K(ar,xt),K(sr,St),K(lr,Ct),K(dr,Tt),K(pr,Dt),K(gr,Ot),K(vr,kt),K(Cr,At),K(Dr,Nt),K(Ar,Pt),K(Pr,Ft),J(Fr,`placeholder`,Lt),K(zr,zt),K(Br,Bt),K(Gr,P),J(qr,`title`,Vt),J(qr,`aria-label`,Ut),J(Jr,`title`,Wt),J(Jr,`aria-label`,Gt),J(q,`title`,Jt),J(q,`aria-label`,Yt),J(Yr,`title`,Xt),J(Yr,`aria-label`,Zt),J(Xr,`title`,Qt),J(Xr,`aria-label`,$t),J(Zr,`title`,en),J(Zr,`aria-label`,tn),K(ei,rn),J(ti,`placeholder`,an),K(oi,on),J(ci,`title`,ln),J(ci,`aria-label`,un),J(li,`title`,dn),J(li,`aria-label`,fn),J(ui,`title`,R),J(ui,`aria-label`,B),J(di,`title`,pn),J(di,`aria-label`,hn),J(fi,`title`,gn),J(fi,`aria-label`,_n),J(pi,`title`,bn),J(pi,`aria-label`,xn),K(gi,Sn),J(_i,`placeholder`,Tn),K(xi,En),K(Ti,Dn),J(Oi,`placeholder`,An),K(Fi,jn),K(Ri,Pn),K(Bi,V),K(Hi,Fn)},[()=>Y(`snippet.modal_title`),()=>Y(`snippet.picker_search_placeholder`),()=>Y(`snippet.picker_no_results`),()=>Y(`snippet.picker_back`),()=>Y(`snippet.type_label`),()=>Y(`snippet.diagram`),()=>Y(`snippet.heading_1`),()=>Y(`snippet.heading_2`),()=>Y(`snippet.heading_3`),()=>Y(`snippet.heading_4`),()=>Y(`snippet.collapsible`),()=>Y(`snippet.link`),()=>Y(`snippet.link_doc`),()=>Y(`snippet.link_anchor`),()=>Y(`snippet.link_doc_anchor`),()=>Y(`snippet.numbered_list`),()=>Y(`snippet.bullet_list`),()=>Y(`snippet.code_block`),()=>Y(`snippet.blockquote`),()=>Y(`snippet.separator`),()=>Y(`snippet.image`),()=>Y(`snippet.table`),()=>Y(`snippet.tree`),()=>Y(`snippet.colored_section`),()=>Y(`snippet.colored_text`),()=>Y(`snippet.emojis`),()=>Y(`snippet.attachment`),()=>Y(`snippet.local_search`),()=>Y(`snippet.heading_text_label`),()=>Y(`snippet.heading_text_placeholder`),()=>Y(`snippet.collapsible_summary_label`),()=>Y(`snippet.collapsible_body_label`),()=>Y(`snippet.collapsible_body_placeholder`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_text_placeholder`),()=>Y(`snippet.link_url_label`),()=>Y(`snippet.link_url_placeholder`),()=>Y(`snippet.link_doc_label`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_doc_text_hint`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_section_placeholder`),()=>Y(`snippet.link_anchor_label`),()=>Y(`snippet.link_anchor_select_hint`),()=>Y(`snippet.link_target_doc_label`),()=>Y(`snippet.link_text_label`),()=>Y(`snippet.link_section_placeholder`),()=>Y(`snippet.link_anchor_label`),()=>Y(`snippet.link_anchor_select_hint`),()=>Y(`snippet.ordered_list_content_label`),()=>Y(`snippet.ordered_list_content_placeholder`),()=>Y(`snippet.unordered_list_content_label`),()=>Y(`snippet.unordered_list_content_placeholder`),()=>Y(`snippet.code_lang_label`),()=>Y(`snippet.code_lang_hint`),()=>Y(`snippet.code_content_label`),()=>Y(`snippet.code_content_placeholder`),()=>Y(`snippet.blockquote_content_label`),()=>Y(`snippet.blockquote_content_placeholder`),()=>Y(`snippet.image_alt_label`),()=>Y(`snippet.image_alt_placeholder`),()=>Y(`snippet.image_url_label`),()=>Y(`snippet.image_src_placeholder`),()=>Y(`snippet.table_style_label`),()=>Y(`snippet.table_style_default`),()=>Y(`snippet.table_style_compact`),()=>Y(`snippet.table_style_striped`),()=>Y(`snippet.table_border_label`),()=>Y(`snippet.table_color_label`),()=>Y(`snippet.table_color_default`),()=>Y(`snippet.table_color_info`),()=>Y(`snippet.table_color_success`),()=>Y(`snippet.table_color_warning`),()=>Y(`snippet.table_color_danger`),()=>Y(`snippet.table_color_note`),()=>Y(`snippet.table_keyboard_hint`),()=>Y(`snippet.tree_hint`),()=>Y(`snippet.tree_add_btn`),()=>Y(`snippet.diagram_existing`),()=>Y(`snippet.diagram_new`),()=>Y(`snippet.diagram_select_label`),()=>Y(`snippet.diagram_name_label`),()=>Y(`snippet.diagram_name_placeholder`),()=>Y(`snippet.diag_img_label`),()=>Y(`snippet.diag_img_saved_hint`),()=>Y(`snippet.colored_section_color_label`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_section_content_label`),()=>Y(`snippet.colored_section_content_placeholder`),()=>Y(`snippet.colored_text_color_label`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_info`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_success`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_warning`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_danger`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_note`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_section_swatch_neutral`),()=>Y(`snippet.colored_text_content_label`),()=>Y(`snippet.colored_text_content_placeholder`),()=>Y(`snippet.emoji_selected_label`),()=>Y(`snippet.emoji_clear_btn`),()=>Y(`snippet.emoji_search_placeholder`),()=>Y(`snippet.markdown_preview_label`),()=>Y(`snippet.inline_delete_btn`),()=>Y(`common.cancel`),()=>Y(`snippet.insert_btn`)]),U(`click`,t,e=>{e.target===e.currentTarget&&De()}),U(`input`,s,w),U(`keydown`,s,T),U(`click`,u,D),U(`change`,_,ve),U(`input`,Ze,A),U(`input`,nt,A),U(`input`,ot,A),U(`input`,dt,A),U(`input`,ht,A),U(`change`,bt,A),U(`input`,Dt,A),U(`input`,Mt,A),U(`change`,zt,A),U(`change`,Ut,ge),U(`input`,qt,A),U(`change`,Qt,A),U(`input`,nn,A),U(`input`,cn,A),U(`input`,hn,A),U(`input`,yn,A),U(`input`,wn,A),U(`input`,kn,A),U(`input`,Nn,A),U(`change`,zn,Ee),U(`change`,qn,Ee),U(`change`,$n,Ee),U(`click`,_r,()=>Tp(h)),U(`change`,xr,be),U(`change`,Tr,be),U(`change`,jr,()=>{xe(),A()}),U(`input`,Fr,()=>{xe(),A()}),U(`input`,Vr,A),U(`click`,qr,e=>se(e.currentTarget)),U(`click`,Jr,e=>se(e.currentTarget)),U(`click`,q,e=>se(e.currentTarget)),U(`click`,Yr,e=>se(e.currentTarget)),U(`click`,Xr,e=>se(e.currentTarget)),U(`click`,Zr,e=>se(e.currentTarget)),U(`input`,ti,A),U(`click`,ci,e=>ce(e.currentTarget)),U(`click`,li,e=>ce(e.currentTarget)),U(`click`,ui,e=>ce(e.currentTarget)),U(`click`,di,e=>ce(e.currentTarget)),U(`click`,fi,e=>ce(e.currentTarget)),U(`click`,pi,e=>ce(e.currentTarget)),U(`input`,_i,A),U(`input`,Ci,A),U(`click`,wi,ae),U(`click`,Li,Ae),U(`click`,zi,De),U(`click`,Vi,ke),G(e,t)};q(Ue,e=>{t.open&&e(We)}),Li(Dl(B(Ue,2),{}),e=>I(d,e,!0),()=>H(d)),G(e,He),Ke()}Nr([`click`,`input`,`keydown`,`change`]);function Kp(e){let t=``,n=[],r=!0;for(let i=0;i<e.length;i++){let a=e[i].normalize(`NFD`);for(let e=0;e<a.length;e++){let o=a.charCodeAt(e);if(!(o>=768&&o<=879))if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122){let e=o>=65&&o<=90?o+32:o;t+=String.fromCharCode(e),n.push(i),r=!1}else r||=(t+=` `,n.push(i),!0)}}return n.push(e.length),t.endsWith(` `)&&(t=t.slice(0,-1),n.splice(n.length-2,1)),{normalized:t,map:n}}function qp(e){return Kp(e).normalized}function Jp(e,t,n){if(e===t)return 0;let r=e.length,i=t.length;if(Math.abs(r-i)>n)return n+1;let a=null,o=Array(i+1),s=Array(i+1);for(let e=0;e<=i;e++)o[e]=e;for(let c=1;c<=r;c++){s[0]=c;let r=c;for(let n=1;n<=i;n++){let i=e.charCodeAt(c-1)===t.charCodeAt(n-1)?0:1,l=Math.min(o[n]+1,s[n-1]+1,o[n-1]+i);c>1&&n>1&&e.charCodeAt(c-1)===t.charCodeAt(n-2)&&e.charCodeAt(c-2)===t.charCodeAt(n-1)&&(l=Math.min(l,a[n-2]+1)),s[n]=l,l<r&&(r=l)}if(r>n)return n+1;a=o,o=s,s=Array(i+1)}return o[i]}function Yp(e){return e>=7?2:+(e>=4)}function Xp(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Zp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Qp(e,t,n){t.innerHTML=``,t.classList.add(`hidden`);let r=e.querySelectorAll(`[data-ld-local-search]`);if(!r.length)return;r.forEach(e=>e.remove());let i=(()=>{let t=new Set;return qp(e.textContent||``).split(` `).forEach(e=>{e.length>=3&&t.add(e)}),Array.from(t)})(),a=n(`local_search.placeholder`)||`Search in this document…`,o=n(`local_search.clear`)||`Clear`,s=document.createElement(`div`);s.className=`no-print mt-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 overflow-hidden`,s.innerHTML=`
|
|
70
70
|
<div class="flex items-center gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50">
|
|
71
71
|
<span class="text-gray-400 select-none" aria-hidden="true">🔎</span>
|
|
72
72
|
<input type="text" id="ld-local-search-input" autocomplete="off"
|
|
73
73
|
class="flex-1 bg-transparent border-0 text-sm text-gray-700 dark:text-gray-300 placeholder:text-gray-400 focus:outline-none focus:ring-0"
|
|
74
|
-
placeholder="${
|
|
74
|
+
placeholder="${Xp(a)}" />
|
|
75
75
|
<button type="button" id="ld-local-search-clear"
|
|
76
76
|
class="hidden text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 shrink-0 px-1"
|
|
77
|
-
title="${
|
|
77
|
+
title="${Xp(o)}" aria-label="${Xp(o)}">✕</button>
|
|
78
78
|
</div>
|
|
79
79
|
<div id="ld-local-search-results" class="hidden">
|
|
80
80
|
<div id="ld-local-search-title" class="px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 border-b border-gray-100 dark:border-gray-800"></div>
|
|
81
81
|
<ol id="ld-local-search-list" class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800 list-none m-0 p-0"></ol>
|
|
82
|
-
</div>`,t.appendChild(s),t.classList.remove(`hidden`);let c=s.querySelector(`#ld-local-search-input`),l=s.querySelector(`#ld-local-search-clear`),u=s.querySelector(`#ld-local-search-results`),d=s.querySelector(`#ld-local-search-title`),f=s.querySelector(`#ld-local-search-list`),p=null;function m(){e.querySelectorAll(`mark.ld-local-mark`).forEach(e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}),e.normalize()}function h(e,t){let n=new Set;t.includes(e)&&n.add(e);let r=Fp(e.length);if(r===0)return n;let a=e[0];for(let t of i)t!==e&&(Math.abs(t.length-e.length)>r||e.length>=3&&t[0]!==a||Pp(e,t,r)<=r&&n.add(t));return n}function g(t){if(m(),!t){u.classList.add(`hidden`),l.classList.add(`hidden`),f.innerHTML=``;return}l.classList.remove(`hidden`);let r=Np(t),i=r.split(` `).filter(Boolean);if(!i.length){u.classList.add(`hidden`);return}let a=Np(e.textContent||``),o=i.map(e=>h(e,a));if(!o.some(e=>e.size>0)){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}let s=new Set;o.forEach((e,t)=>{e.forEach(e=>{let n=e===i[t];s.add(n?e:`\\b`+Lp(e)+`\\b`)})});let c=Array.from(s).sort((e,t)=>t.length-e.length),p=RegExp(`(`+c.map(e=>e.startsWith(`\\b`)?e:Lp(e)).join(`|`)+`)`,`g`),g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){return e.parentElement&&e.parentElement.closest(`mark`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),v=[];for(;g.nextNode();)v.push(g.currentNode);let y=0,b=new Map;v.forEach(e=>{let t=e.textContent||``,{normalized:n,map:r}=Mp(t);if(!n)return;let i=[],a;for(p.lastIndex=0;(a=p.exec(n))!==null;){if(a[0].length===0){p.lastIndex++;continue}i.push({start:a.index,end:a.index+a[0].length,term:a[0]})}if(!i.length)return;let s=e.parentElement?.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,c=``,l=0;i.forEach(e=>{let n=r[e.start],i=r[e.end];if(!(n<l)&&(c+=Ip(t.slice(l,n)),c+=`<mark class="ld-local-mark" id="ld-local-match-${y++}">${Ip(t.slice(n,i))}</mark>`,l=i,s)){b.has(s)||b.set(s,new Set);let t=b.get(s);o.forEach((n,r)=>{n.has(e.term)&&t.add(r)})}}),c+=Ip(t.slice(l));let u=document.createElement(`span`);u.innerHTML=c,e.parentNode.replaceChild(u,e)});let x=i.length,S=[];for(let[e,t]of b.entries())t.size===x&&S.push(e);let C;if(S.length>0){let t=new Set(S);C=Array.from(e.querySelectorAll(`mark.ld-local-mark`)).filter(e=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement;return t.has(n)})}else C=Array.from(e.querySelectorAll(`mark.ld-local-mark`));if(!C.length){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}d.textContent=(C.length===1?n(`local_search.count_singular`)||`{count} match`:n(`local_search.count_plural`)||`{count} matches`).replace(`{count}`,String(C.length)),f.innerHTML=C.map((e,t)=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,i=(n?n.textContent||``:e.textContent||``).trim(),a=Np(i),s=-1;for(let e of o)for(let t of e){let e=a.indexOf(t);e>=0&&(s<0||e<s)&&(s=e)}s<0&&(s=a.indexOf(r.split(` `)[0])),s<0&&(s=0);let c=Math.max(0,s-40),l=Math.min(i.length,s+80),u=(c>0?`…`:``)+i.slice(c,l)+(l<i.length?`…`:``);return`<li><button type="button" data-target="${e.id}" class="ld-local-item w-full text-left px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors text-xs"><span class="text-gray-400 font-mono mr-2">${t+1}.</span>${Ip(u)}</button></li>`}).join(``),u.classList.remove(`hidden`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.addEventListener(`click`,()=>_(e.dataset.target))})}function _(t){let n=document.getElementById(t),r=document.getElementById(`home-content-area`);if(!n||!r)return;let i=n.parentElement;for(;i&&i!==r;)i.tagName===`DETAILS`&&!i.open&&(i.open=!0),i=i.parentElement;e.querySelectorAll(`mark.ld-local-mark.ld-local-active`).forEach(e=>e.classList.remove(`ld-local-active`)),n.classList.add(`ld-local-active`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.classList.toggle(`ld-local-item-active`,e.dataset.target===t)});let a=document.querySelector(`#home-doc-view header`),o=a?a.getBoundingClientRect().height:0,s=n.getBoundingClientRect().top,c=r.getBoundingClientRect().top,l=o+(r.clientHeight-o)/3;r.scrollTop+=s-c-l}c.addEventListener(`input`,()=>{p&&clearTimeout(p),p=window.setTimeout(()=>g(c.value.trim()),250)}),l.addEventListener(`click`,()=>{c.value=``,g(``),c.focus()}),c.addEventListener(`keydown`,e=>{e.key===`Escape`&&(c.value=``,g(``),c.blur())})}var zp=e=>e.normalize(`NFC`).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function Bp(e,t){let n=zp(t);if(!n)return[];let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=[];for(;r.nextNode();)i.push(r.currentNode);let a=0;i.forEach(e=>{let t=(e.textContent||``).normalize(`NFC`),r=zp(t);if(!r.includes(n))return;let i=``,o=0;for(;o<=r.length;){let e=r.indexOf(n,o);if(e===-1){i+=t.slice(o);break}i+=t.slice(o,e),i+=`<mark id="match-${a++}">${t.slice(e,e+n.length)}</mark>`,o=e+n.length}let s=document.createElement(`span`);s.innerHTML=i,e.parentNode.replaceChild(s,e)});let o=[];return e.querySelectorAll(`mark[id^='match-']`).forEach(e=>{let r=((e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre`)||e.parentElement).textContent||``).trim(),i=zp(r).indexOf(n),a=Math.max(0,i-40),s=Math.min(r.length,i+t.length+40),c=(a>0?`…`:``)+r.slice(a,s)+(s<r.length?`…`:``);o.push({id:e.id,snippet:c})}),o}function Vp(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&!r.open&&(r.open=!0),r=r.parentElement;document.querySelectorAll(`mark.match-active`).forEach(e=>e.classList.remove(`match-active`)),t.classList.add(`match-active`);let i=document.querySelector(`#home-doc-view header`),a=i?i.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top,s=n.getBoundingClientRect().top,c=a+(n.clientHeight-a)/3;n.scrollTop+=o-s-c}var Hp=new Set([`anchor-doc-link`,`doc-link`,`anchor-link`,`image`,`link`,`collapsible`,`colored-text`,`colored-section`,`tree`,`code-block`,`table`,`blockquote`,`separator`,`ordered-list`,`unordered-list`,`heading-1`,`heading-2`,`heading-3`,`heading-4`]),Up={table:{labelKey:`snippet.inline_edit_btn_table`,iconClass:`fa-solid fa-table-cells`},"code-block":{labelKey:`snippet.inline_edit_btn_code_block`,iconClass:`fa-solid fa-code`},blockquote:{labelKey:`snippet.inline_edit_btn_blockquote`,iconClass:`fa-solid fa-quote-right`},"ordered-list":{labelKey:`snippet.inline_edit_btn_ordered_list`,iconClass:`fa-solid fa-list-ol`},"unordered-list":{labelKey:`snippet.inline_edit_btn_unordered_list`,iconClass:`fa-solid fa-list-ul`},tree:{labelKey:`snippet.inline_edit_btn_tree`,iconClass:`fa-solid fa-folder-tree`},"colored-section":{labelKey:`snippet.inline_edit_btn_colored_section`,iconClass:`fa-solid fa-fill-drip`},"colored-text":{labelKey:`snippet.inline_edit_btn_colored_text`,iconClass:`fa-solid fa-highlighter`},collapsible:{labelKey:`snippet.inline_edit_btn_collapsible`,iconClass:`fa-solid fa-caret-right`},link:{labelKey:`snippet.inline_edit_btn_link`,iconClass:`fa-solid fa-link`},"doc-link":{labelKey:`snippet.inline_edit_btn_doc_link`,iconClass:`fa-solid fa-file-lines`},"anchor-link":{labelKey:`snippet.inline_edit_btn_anchor_link`,iconClass:`fa-solid fa-anchor`},"anchor-doc-link":{labelKey:`snippet.inline_edit_btn_anchor_doc_link`,iconClass:`fa-solid fa-anchor`},image:{labelKey:`snippet.inline_edit_btn_image`,iconClass:`fa-solid fa-image`},separator:{labelKey:`snippet.inline_edit_btn_separator`,iconClass:`fa-solid fa-minus`},"heading-1":{labelKey:`snippet.inline_edit_btn_heading_1`,iconClass:`fa-solid fa-heading`},"heading-2":{labelKey:`snippet.inline_edit_btn_heading_2`,iconClass:`fa-solid fa-heading`},"heading-3":{labelKey:`snippet.inline_edit_btn_heading_3`,iconClass:`fa-solid fa-heading`},"heading-4":{labelKey:`snippet.inline_edit_btn_heading_4`,iconClass:`fa-solid fa-heading`}};function Wp(e){return Up[e]||{labelKey:`snippet.inline_edit_btn`,iconClass:`fa-solid fa-pen-to-square`}}var Gp={table:`snippet.inline_delete_btn_table`,"code-block":`snippet.inline_delete_btn_code_block`,blockquote:`snippet.inline_delete_btn_blockquote`,"ordered-list":`snippet.inline_delete_btn_ordered_list`,"unordered-list":`snippet.inline_delete_btn_unordered_list`,tree:`snippet.inline_delete_btn_tree`,"colored-section":`snippet.inline_delete_btn_colored_section`,"colored-text":`snippet.inline_delete_btn_colored_text`,collapsible:`snippet.inline_delete_btn_collapsible`,link:`snippet.inline_delete_btn_link`,"doc-link":`snippet.inline_delete_btn_doc_link`,"anchor-link":`snippet.inline_delete_btn_anchor_link`,"anchor-doc-link":`snippet.inline_delete_btn_anchor_doc_link`,image:`snippet.inline_delete_btn_image`,separator:`snippet.inline_delete_btn_separator`,"heading-1":`snippet.inline_delete_btn_heading_1`,"heading-2":`snippet.inline_delete_btn_heading_2`,"heading-3":`snippet.inline_delete_btn_heading_3`,"heading-4":`snippet.inline_delete_btn_heading_4`};function Kp(e){return{labelKey:Gp[e]||`snippet.inline_delete_btn`,iconClass:`fa-solid fa-trash`}}var qp=[{types:[`collapsible`],selector:`details`},{types:[`colored-section`],selector:`div[style*="border-left"]`},{types:[`colored-text`],selector:`span[style*="color"]`},{types:[`tree`,`code-block`],selector:`pre`},{types:[`table`],selector:`table`},{types:[`blockquote`],selector:`blockquote`},{types:[`separator`],selector:`hr`},{types:[`ordered-list`],selector:`ol`},{types:[`unordered-list`],selector:`ul`},{types:[`heading-1`],selector:`h1`},{types:[`heading-2`],selector:`h2`},{types:[`heading-3`],selector:`h3`},{types:[`heading-4`],selector:`h4`},{types:[`image`],selector:`img`},{types:[`anchor-doc-link`,`doc-link`,`anchor-link`,`link`],selector:`a[href]`}],Jp=null;function Yp(e,t){return e.start===t.start&&e.end===t.end?!0:e.start>=t.start&&e.end<=t.end||t.start>=e.start&&t.end<=e.end?!1:e.start<t.end&&t.start<e.end}function Xp(e,t,n){if(!n||!n.trim())return;let r=Op(n);if(!r||!Hp.has(r))return;let i={start:t,end:t+n.length,type:r};e.some(e=>Yp(e,i))||e.push(i)}function Zp(e,t,n,r=0){let i;for(;i=n.exec(t);){let t=i[r];Xp(e,i.index+(r>0?i[0].indexOf(t):0),t),i[0].length===0&&(n.lastIndex+=1)}}function Qp(e,t){let n=t;for(;n>0&&e[n-1]!==`
|
|
83
|
-
`;)--n;let r=e.slice(n,t);return/^[ \t]+$/.test(r)?r:``}function
|
|
82
|
+
</div>`,t.appendChild(s),t.classList.remove(`hidden`);let c=s.querySelector(`#ld-local-search-input`),l=s.querySelector(`#ld-local-search-clear`),u=s.querySelector(`#ld-local-search-results`),d=s.querySelector(`#ld-local-search-title`),f=s.querySelector(`#ld-local-search-list`),p=null;function m(){e.querySelectorAll(`mark.ld-local-mark`).forEach(e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}),e.normalize()}function h(e,t){let n=new Set;t.includes(e)&&n.add(e);let r=Yp(e.length);if(r===0)return n;let a=e[0];for(let t of i)t!==e&&(Math.abs(t.length-e.length)>r||e.length>=3&&t[0]!==a||Jp(e,t,r)<=r&&n.add(t));return n}function g(t){if(m(),!t){u.classList.add(`hidden`),l.classList.add(`hidden`),f.innerHTML=``;return}l.classList.remove(`hidden`);let r=qp(t),i=r.split(` `).filter(Boolean);if(!i.length){u.classList.add(`hidden`);return}let a=qp(e.textContent||``),o=i.map(e=>h(e,a));if(!o.some(e=>e.size>0)){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}let s=new Set;o.forEach((e,t)=>{e.forEach(e=>{let n=e===i[t];s.add(n?e:`\\b`+Zp(e)+`\\b`)})});let c=Array.from(s).sort((e,t)=>t.length-e.length),p=RegExp(`(`+c.map(e=>e.startsWith(`\\b`)?e:Zp(e)).join(`|`)+`)`,`g`),g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){return e.parentElement&&e.parentElement.closest(`mark`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),v=[];for(;g.nextNode();)v.push(g.currentNode);let y=0,b=new Map;v.forEach(e=>{let t=e.textContent||``,{normalized:n,map:r}=Kp(t);if(!n)return;let i=[],a;for(p.lastIndex=0;(a=p.exec(n))!==null;){if(a[0].length===0){p.lastIndex++;continue}i.push({start:a.index,end:a.index+a[0].length,term:a[0]})}if(!i.length)return;let s=e.parentElement?.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,c=``,l=0;i.forEach(e=>{let n=r[e.start],i=r[e.end];if(!(n<l)&&(c+=Xp(t.slice(l,n)),c+=`<mark class="ld-local-mark" id="ld-local-match-${y++}">${Xp(t.slice(n,i))}</mark>`,l=i,s)){b.has(s)||b.set(s,new Set);let t=b.get(s);o.forEach((n,r)=>{n.has(e.term)&&t.add(r)})}}),c+=Xp(t.slice(l));let u=document.createElement(`span`);u.innerHTML=c,e.parentNode.replaceChild(u,e)});let x=i.length,S=[];for(let[e,t]of b.entries())t.size===x&&S.push(e);let C;if(S.length>0){let t=new Set(S);C=Array.from(e.querySelectorAll(`mark.ld-local-mark`)).filter(e=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement;return t.has(n)})}else C=Array.from(e.querySelectorAll(`mark.ld-local-mark`));if(!C.length){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}d.textContent=(C.length===1?n(`local_search.count_singular`)||`{count} match`:n(`local_search.count_plural`)||`{count} matches`).replace(`{count}`,String(C.length)),f.innerHTML=C.map((e,t)=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,i=(n?n.textContent||``:e.textContent||``).trim(),a=qp(i),s=-1;for(let e of o)for(let t of e){let e=a.indexOf(t);e>=0&&(s<0||e<s)&&(s=e)}s<0&&(s=a.indexOf(r.split(` `)[0])),s<0&&(s=0);let c=Math.max(0,s-40),l=Math.min(i.length,s+80),u=(c>0?`…`:``)+i.slice(c,l)+(l<i.length?`…`:``);return`<li><button type="button" data-target="${e.id}" class="ld-local-item w-full text-left px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors text-xs"><span class="text-gray-400 font-mono mr-2">${t+1}.</span>${Xp(u)}</button></li>`}).join(``),u.classList.remove(`hidden`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.addEventListener(`click`,()=>_(e.dataset.target))})}function _(t){let n=document.getElementById(t),r=document.getElementById(`home-content-area`);if(!n||!r)return;let i=n.parentElement;for(;i&&i!==r;)i.tagName===`DETAILS`&&!i.open&&(i.open=!0),i=i.parentElement;e.querySelectorAll(`mark.ld-local-mark.ld-local-active`).forEach(e=>e.classList.remove(`ld-local-active`)),n.classList.add(`ld-local-active`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.classList.toggle(`ld-local-item-active`,e.dataset.target===t)});let a=document.querySelector(`#home-doc-view header`),o=a?a.getBoundingClientRect().height:0,s=n.getBoundingClientRect().top,c=r.getBoundingClientRect().top,l=o+(r.clientHeight-o)/3;r.scrollTop+=s-c-l}c.addEventListener(`input`,()=>{p&&clearTimeout(p),p=window.setTimeout(()=>g(c.value.trim()),250)}),l.addEventListener(`click`,()=>{c.value=``,g(``),c.focus()}),c.addEventListener(`keydown`,e=>{e.key===`Escape`&&(c.value=``,g(``),c.blur())})}var $p=e=>e.normalize(`NFC`).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function em(e,t){let n=$p(t);if(!n)return[];let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=[];for(;r.nextNode();)i.push(r.currentNode);let a=0;i.forEach(e=>{let t=(e.textContent||``).normalize(`NFC`),r=$p(t);if(!r.includes(n))return;let i=``,o=0;for(;o<=r.length;){let e=r.indexOf(n,o);if(e===-1){i+=t.slice(o);break}i+=t.slice(o,e),i+=`<mark id="match-${a++}">${t.slice(e,e+n.length)}</mark>`,o=e+n.length}let s=document.createElement(`span`);s.innerHTML=i,e.parentNode.replaceChild(s,e)});let o=[];return e.querySelectorAll(`mark[id^='match-']`).forEach(e=>{let r=((e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre`)||e.parentElement).textContent||``).trim(),i=$p(r).indexOf(n),a=Math.max(0,i-40),s=Math.min(r.length,i+t.length+40),c=(a>0?`…`:``)+r.slice(a,s)+(s<r.length?`…`:``);o.push({id:e.id,snippet:c})}),o}function tm(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&!r.open&&(r.open=!0),r=r.parentElement;document.querySelectorAll(`mark.match-active`).forEach(e=>e.classList.remove(`match-active`)),t.classList.add(`match-active`);let i=document.querySelector(`#home-doc-view header`),a=i?i.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top,s=n.getBoundingClientRect().top,c=a+(n.clientHeight-a)/3;n.scrollTop+=o-s-c}var nm=new Set([`anchor-doc-link`,`doc-link`,`anchor-link`,`image`,`link`,`collapsible`,`colored-text`,`colored-section`,`tree`,`code-block`,`table`,`blockquote`,`separator`,`ordered-list`,`unordered-list`,`heading-1`,`heading-2`,`heading-3`,`heading-4`]),rm={table:{labelKey:`snippet.inline_edit_btn_table`,iconClass:`fa-solid fa-table-cells`},"code-block":{labelKey:`snippet.inline_edit_btn_code_block`,iconClass:`fa-solid fa-code`},blockquote:{labelKey:`snippet.inline_edit_btn_blockquote`,iconClass:`fa-solid fa-quote-right`},"ordered-list":{labelKey:`snippet.inline_edit_btn_ordered_list`,iconClass:`fa-solid fa-list-ol`},"unordered-list":{labelKey:`snippet.inline_edit_btn_unordered_list`,iconClass:`fa-solid fa-list-ul`},tree:{labelKey:`snippet.inline_edit_btn_tree`,iconClass:`fa-solid fa-folder-tree`},"colored-section":{labelKey:`snippet.inline_edit_btn_colored_section`,iconClass:`fa-solid fa-fill-drip`},"colored-text":{labelKey:`snippet.inline_edit_btn_colored_text`,iconClass:`fa-solid fa-highlighter`},collapsible:{labelKey:`snippet.inline_edit_btn_collapsible`,iconClass:`fa-solid fa-caret-right`},link:{labelKey:`snippet.inline_edit_btn_link`,iconClass:`fa-solid fa-link`},"doc-link":{labelKey:`snippet.inline_edit_btn_doc_link`,iconClass:`fa-solid fa-file-lines`},"anchor-link":{labelKey:`snippet.inline_edit_btn_anchor_link`,iconClass:`fa-solid fa-anchor`},"anchor-doc-link":{labelKey:`snippet.inline_edit_btn_anchor_doc_link`,iconClass:`fa-solid fa-anchor`},image:{labelKey:`snippet.inline_edit_btn_image`,iconClass:`fa-solid fa-image`},separator:{labelKey:`snippet.inline_edit_btn_separator`,iconClass:`fa-solid fa-minus`},"heading-1":{labelKey:`snippet.inline_edit_btn_heading_1`,iconClass:`fa-solid fa-heading`},"heading-2":{labelKey:`snippet.inline_edit_btn_heading_2`,iconClass:`fa-solid fa-heading`},"heading-3":{labelKey:`snippet.inline_edit_btn_heading_3`,iconClass:`fa-solid fa-heading`},"heading-4":{labelKey:`snippet.inline_edit_btn_heading_4`,iconClass:`fa-solid fa-heading`}};function im(e){return rm[e]||{labelKey:`snippet.inline_edit_btn`,iconClass:`fa-solid fa-pen-to-square`}}var am={table:`snippet.inline_delete_btn_table`,"code-block":`snippet.inline_delete_btn_code_block`,blockquote:`snippet.inline_delete_btn_blockquote`,"ordered-list":`snippet.inline_delete_btn_ordered_list`,"unordered-list":`snippet.inline_delete_btn_unordered_list`,tree:`snippet.inline_delete_btn_tree`,"colored-section":`snippet.inline_delete_btn_colored_section`,"colored-text":`snippet.inline_delete_btn_colored_text`,collapsible:`snippet.inline_delete_btn_collapsible`,link:`snippet.inline_delete_btn_link`,"doc-link":`snippet.inline_delete_btn_doc_link`,"anchor-link":`snippet.inline_delete_btn_anchor_link`,"anchor-doc-link":`snippet.inline_delete_btn_anchor_doc_link`,image:`snippet.inline_delete_btn_image`,separator:`snippet.inline_delete_btn_separator`,"heading-1":`snippet.inline_delete_btn_heading_1`,"heading-2":`snippet.inline_delete_btn_heading_2`,"heading-3":`snippet.inline_delete_btn_heading_3`,"heading-4":`snippet.inline_delete_btn_heading_4`};function om(e){return{labelKey:am[e]||`snippet.inline_delete_btn`,iconClass:`fa-solid fa-trash`}}var sm=[{types:[`collapsible`],selector:`details`},{types:[`colored-section`],selector:`div[style*="border-left"]`},{types:[`colored-text`],selector:`span[style*="color"]`},{types:[`tree`,`code-block`],selector:`pre`},{types:[`table`],selector:`table`},{types:[`blockquote`],selector:`blockquote`},{types:[`separator`],selector:`hr`},{types:[`ordered-list`],selector:`ol`},{types:[`unordered-list`],selector:`ul`},{types:[`heading-1`],selector:`h1`},{types:[`heading-2`],selector:`h2`},{types:[`heading-3`],selector:`h3`},{types:[`heading-4`],selector:`h4`},{types:[`image`],selector:`img`},{types:[`anchor-doc-link`,`doc-link`,`anchor-link`,`link`],selector:`a[href]`}],cm=null;function lm(e,t){return e.start===t.start&&e.end===t.end?!0:e.start>=t.start&&e.end<=t.end||t.start>=e.start&&t.end<=e.end?!1:e.start<t.end&&t.start<e.end}function um(e,t,n){if(!n||!n.trim())return;let r=Hp(n);if(!r||!nm.has(r))return;let i={start:t,end:t+n.length,type:r};e.some(e=>lm(e,i))||e.push(i)}function dm(e,t,n,r=0){let i;for(;i=n.exec(t);){let t=i[r];um(e,i.index+(r>0?i[0].indexOf(t):0),t),i[0].length===0&&(n.lastIndex+=1)}}function fm(e,t){let n=t;for(;n>0&&e[n-1]!==`
|
|
83
|
+
`;)--n;let r=e.slice(n,t);return/^[ \t]+$/.test(r)?r:``}function pm(e,t){let n=/```[\s\S]*?```/g,r;for(;r=n.exec(t);){let i=r[0];if(!i.trim()){i.length===0&&(n.lastIndex+=1);continue}let a=Hp(i);if(!a||!nm.has(a))continue;let o=fm(t,r.index),s={start:r.index-o.length,end:r.index+i.length,type:a,indent:o};e.some(e=>lm(e,s))||e.push(s)}}function mm(e){let t=[];dm(t,e,/<details[\s\S]*?<\/details>/gi),dm(t,e,/<div\b[^>]*border-left[^>]*>[\s\S]*?<\/div>/gi),pm(t,e),dm(t,e,/(?:^|\n\n)(#{1,4} [^\n]+)/g,1),dm(t,e,/<span\b[^>]*color:[^>]*>[\s\S]*?<\/span>/gi),dm(t,e,RegExp(`(?:^|\\n)((`+ld()+`))`,`g`),1),dm(t,e,/^> .*(?:\n>.*)*/gm),dm(t,e,Af()),dm(t,e,jf()),dm(t,e,/!\[[^\]\n]*\]\([^)]+\)/g),dm(t,e,/\[[^\]\n]+\]\([^)]+\)/g);let n=e.match(/^---\s*\n[\s\S]*?\n---/);return dm(t,e,/^---$/gm),t.filter(e=>e.type===`separator`?!n||e.start>n[0].length:!0).sort((e,t)=>e.start-t.start)}function hm(e,t){return Array.from(e.querySelectorAll(t)).filter(e=>!e.parentElement.closest(`ol, ul`))}function gm(e,t){e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)});for(let{types:n,selector:r}of sm){let i=t.filter(e=>n.includes(e.type));if(!i.length)continue;let a=r===`ol`||r===`ul`?hm(e,r):Array.from(e.querySelectorAll(r)),o=Math.min(i.length,a.length);for(let e=0;e<o;e+=1)a[e].dataset.inlineSnippetIndex=String(t.indexOf(i[e])),a[e].classList.add(`ld-inline-snippet-target`)}}function _m(){cm&&=(cm.remove(),null)}function vm(e,t){_m();let n=Array.isArray(t)?t:[t],r=n[0]||{},i=document.createElement(`div`);i.id=`inline-snippet-popup`,r.dataAction&&(i.dataset.action=r.dataAction),r.dataType&&(i.dataset.snippetType=r.dataType),i.className=`fixed z-50 flex flex-col rounded-lg border border-blue-200 dark:border-blue-800 bg-white dark:bg-gray-900 shadow-lg p-1`,i.style.position=`fixed`,i.style.display=`flex`,i.style.flexDirection=`column`,i.style.width=`max-content`,i.style.zIndex=`50`;for(let e of n){let t=e.dataAction===`delete`,n=document.createElement(`button`);n.type=`button`,e.dataAction&&(n.dataset.action=e.dataAction),n.className=`inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-semibold `+(t?`text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30`:`text-blue-700 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/30`);let r=document.createElement(`i`);r.className=e.iconClass,r.setAttribute(`aria-hidden`,`true`);let a=document.createElement(`span`);a.textContent=Y(e.labelKey),n.append(r,a),n.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),_m(),e.onActivate()}),i.appendChild(n)}document.body.appendChild(i);let a=i.getBoundingClientRect(),o=Math.min(window.innerWidth-a.width-8,Math.max(8,e.clientX)),s=Math.max(8,e.clientY-a.height-8);i.style.left=`${o}px`,i.style.top=`${s}px`,cm=i}function ym(e,t){let n=t instanceof Element?t:null;for(;n&&n.parentElement&&n.parentElement!==e;)n=n.parentElement;return!n||n===e||n.parentElement!==e?null:n}function bm(e,t){let n=e?.closest(`th, td`);if(!n||!t.contains(n))return null;let r=n.closest(`tr`);if(!r)return null;let i=Array.from(t.querySelectorAll(`tr`)).indexOf(r),a=Array.from(r.children).indexOf(n);return i<0||a<0?null:{row:i,col:a}}function xm(e,t){if(typeof t!=`number`)return null;let n=Array.from(e.children);if(!n.length)return null;let r=null,i=null;for(let e of n){let n=e.getBoundingClientRect();if(n.bottom<t)r=e;else if(n.top>t)i||=e;else return e}return r||i}function Sm(e,t,n){if(t.matches(`[data-inline-snippet-index]`)){let e=n[Number(t.dataset.inlineSnippetIndex)];if(e)return e.end}let r=null,i=Array.from(t.querySelectorAll(`[data-inline-snippet-index]`));if(i.length>0){let e=-1;for(let t of i){let r=n[Number(t.dataset.inlineSnippetIndex)];r&&r.end>e&&(e=r.end)}e>=0&&(r=e)}else{let n=(t.textContent||``).trim();if(n){let t=n.split(`
|
|
84
84
|
`)[0].trim().slice(0,60);if(t){let n=e.indexOf(t);n>=0&&(r=n)}}}if(r===null)return null;let a=e.indexOf(`
|
|
85
85
|
|
|
86
|
-
`,r);return a>=0?a:e.length}function
|
|
87
|
-
`)[0].trim().slice(0,60);if(t){let n=e.indexOf(t);if(n>=0)return n}}return null}function
|
|
86
|
+
`,r);return a>=0?a:e.length}function Cm(e,t,n){if(t.matches(`[data-inline-snippet-index]`)){let e=n[Number(t.dataset.inlineSnippetIndex)];if(e)return e.start}let r=Array.from(t.querySelectorAll(`[data-inline-snippet-index]`));if(r.length>0){let e=1/0;for(let t of r){let r=n[Number(t.dataset.inlineSnippetIndex)];r&&r.start<e&&(e=r.start)}if(e<1/0)return e}let i=(t.textContent||``).trim();if(i){let t=i.split(`
|
|
87
|
+
`)[0].trim().slice(0,60);if(t){let n=e.indexOf(t);if(n>=0)return n}}return null}function wm(e,t,n,r,i){let a=ym(t,n)||xm(t,i);if(!a)return e.length;let o=Sm(e,a,r);if(o!==null)return o;let s=a.previousElementSibling;for(;s;){let t=Sm(e,s,r);if(t!==null){let n=e.indexOf(`
|
|
88
88
|
|
|
89
|
-
`,t+1);return n>=0?n:e.length}s=s.previousElementSibling}let c=a.nextElementSibling;for(;c;){let t=
|
|
89
|
+
`,t+1);return n>=0?n:e.length}s=s.previousElementSibling}let c=a.nextElementSibling;for(;c;){let t=Cm(e,c,r);if(t!==null){let n=e.lastIndexOf(`
|
|
90
90
|
|
|
91
|
-
`,t);return n>=0?n:0}c=c.nextElementSibling}return e.length}function um(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=em(t);nm(e,r);let i=i=>{let a=i.target?.closest(`[data-inline-snippet-index]`);if(a&&e.contains(a)){let e=r[Number(a.dataset.inlineSnippetIndex)];if(!e)return;i.preventDefault();let t=Wp(e.type),o=Kp(e.type);im(i,[{iconClass:t.iconClass,labelKey:t.labelKey,dataAction:`edit`,dataType:e.type,onActivate:()=>n.onEdit(e)},{iconClass:o.iconClass,labelKey:o.labelKey,dataAction:`delete`,dataType:e.type,onActivate:()=>n.onDelete(e)}]);return}if(!e.contains(i.target))return;let o=lm(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),im(i,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(o)}))};e.addEventListener(`contextmenu`,i);let a=e.closest(`#home-content-area`)||e.closest(`main`),o=null;a&&(o=r=>{r.defaultPrevented||e.offsetParent!==null&&(r.target?.closest(`textarea, input, [data-inline-snippet-index]`)||e.contains(r.target)||(r.preventDefault(),im(r,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(t.length)})))},a.addEventListener(`contextmenu`,o));let s=e=>{Jp&&!Jp.contains(e.target)&&rm()},c=e=>{e.key===`Escape`&&rm()};return document.addEventListener(`click`,s),document.addEventListener(`keydown`,c),()=>{e.removeEventListener(`contextmenu`,i),a&&o&&a.removeEventListener(`contextmenu`,o),document.removeEventListener(`click`,s),document.removeEventListener(`keydown`,c),rm(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var dm=W(`<span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300"> </span>`),fm=W(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),pm=W(`<span> </span>`),mm=W(`<div data-testid="edit-actions" class="flex items-center gap-2"><!> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div>`),hm=W(`<button data-testid="validate-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-green-700 bg-green-600 text-white font-semibold hover:bg-green-700 transition-colors"><i class="fa-solid fa-check" style="margin-right:4px"></i> </button>`),gm=Vr(`<g><line x1="8" y1="8" x2="92" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line><line x1="92" y1="8" x2="8" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line></g>`),_m=W(`<div data-testid="view-actions" class="flex items-center gap-2"><!> <button><svg width="18" height="18" viewBox="0 0 100 100" fill="none" style="display:inline-block;vertical-align:middle;margin-right:4px"><rect x="28" y="10" width="44" height="52" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><rect x="52" y="8" width="22" height="30" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><polygon points="28,60 10,80 30,80 38,72" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><polygon points="28,48 19,70 36,75 55,70" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><line x1="10" y1="90" x2="72" y2="90" stroke="currentColor" stroke-width="6" stroke-linecap="round"></line><!></svg> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-link"></i> </button> <button data-testid="metadata-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-code-compare"></i> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-file-pen"></i> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i> </button> <button><i class="fa-solid fa-list-ul"></i></button></div>`),vm=W(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),ym=W(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),bm=W(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),xm=W(`<li><button class="w-full text-left px-3 py-1.5 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors"><span class="text-yellow-600 dark:text-yellow-500 font-mono text-xs mr-2"> </span><span class="text-xs"> </span></button></li>`),Sm=W(`<div class="mt-4 rounded-lg bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 text-sm text-yellow-800 dark:text-yellow-300 overflow-hidden"><div class="px-3 py-2 font-medium border-b border-yellow-200 dark:border-yellow-800"> </div> <ol class="max-h-40 overflow-y-auto divide-y divide-yellow-100 dark:divide-yellow-900/40 list-none m-0 p-0"></ol></div>`),Cm=W(`<textarea id="doc-editor" data-testid="doc-editor" spellcheck="false" class="w-full min-h-[70vh] px-4 py-3 text-sm font-mono leading-relaxed rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y"></textarea>`),wm=W(`<div id="doc-content" data-testid="doc-content"></div>`),Tm=W(`<li class="m-0 p-0"><a class="block text-xs text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:underline py-0.5 leading-snug transition-colors truncate"> </a></li>`),Em=W(`<div></div> <aside class="no-print shrink-0 sticky top-0 self-start max-h-screen overflow-y-auto py-8 pr-4 pl-3 ld-toc-aside"><p class="text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-3"> </p> <nav><ul class="space-y-1 list-none m-0 p-0"></ul></nav></aside>`,1),Dm=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-5"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"> </h3> <div class="space-y-1.5"><label for="img-paste-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> <span class="font-normal text-gray-400"> </span></label> <div class="flex items-center gap-2"><input id="img-paste-name" type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="text-xs text-gray-400 shrink-0"> </span></div></div> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`),Om=W(`<div class="fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4"><div class="w-full max-w-sm bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-5 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-500 dark:text-gray-400 italic truncate"> </p> <div class="flex justify-end gap-2 mt-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div></div>`),km=W(`<div class="fixed inset-0 z-50 bg-black/90 flex items-center justify-center cursor-pointer"><img class="max-w-full max-h-full object-contain select-none"/> <button class="absolute top-4 right-4 text-white/70 hover:text-white text-2xl leading-none">×</button></div>`),Am=W(`<header id="home-doc-header" class="sticky top-0 z-10 bg-gray-50 dark:bg-gray-950 px-6 pt-8 pb-6 mb-0 border-b border-gray-300 dark:border-gray-800"><div class="flex items-start gap-4 flex-wrap"><div class="shrink min-w-0"><div class="flex items-center gap-2 mb-2 flex-wrap"><span class="flex items-center gap-2 flex-wrap"><!> <span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"> </span></span> <!></div> <div class="flex items-center gap-2"><h1 data-testid="doc-title" class="min-w-0 text-2xl font-bold text-gray-900 dark:text-gray-50 leading-tight"> </h1> <button type="button" data-testid="copy-doc-id-btn"><i aria-hidden="true"></i></button></div></div> <div class="flex items-center gap-2 flex-wrap ml-auto"><!></div></div> <!> <!> <!> <div class="hidden no-print"></div></header> <div class="flex min-h-full items-start"><article id="home-doc-view" data-testid="doc-view" class="flex-1 min-w-0 px-6 pt-8 pb-8"><!></article> <!></div> <!> <!> <!> <!> <!> <!> <!>`,1);function jm(e,t){Ge(t,!0);let n=Bi(t,`navHistory`,19,()=>[]),r=F(null),i=F(null),a=F(null),o=F(null),s=F(!1),c=F(!1),l=F(`insert`),u=F(null),d=F(0),f=null;Vi(()=>{let e=window;return e.openSnippetsModal=()=>{I(l,`insert`),I(c,!0)},e.openSnippetsModalForInlineInsert=e=>{I(l,`inline-insert`),I(d,Math.max(0,Number(e)||0),!0),I(c,!0)},()=>{delete e.openSnippetsModal,delete e.openSnippetsModalForInlineInsert}});let p=F(null),m=F(L([])),h=``,g=P(()=>H(m).length?Y(H(m).length===1?`search.notice_singular`:`search.notice_plural`).replace(`{count}`,String(H(m).length)).replace(`{query}`,$.searchQuery):``),_=P(()=>Yd(t.doc.content)),v=P(()=>(H(_)||``).toUpperCase()===`TO BE VALIDATED`),y=F(!1),b=F(``),x=F(null),S=F(!1),C=F(!1),w=F(!1),T=F(!1),E=F(``),D=F(`png`),ee=null,O=0,te=0,k=F(null),ne=F(``),re=/[̀-ͯ]/g;function ie(e){return(e||``).normalize(`NFD`).replace(re,``).toLowerCase().replace(/[^a-z0-9]/g,`_`)}function ae(e){let t=document.getElementById(`home-content-area`),n=document.getElementById(e);if(!t||!n)return;let r=document.querySelector(`#home-doc-view header`),i=r?r.getBoundingClientRect().height:0;t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-i-8}On(()=>{let e=t.doc.id,n=$.searchQuery;if(f?.(),f=null,H(y)||!H(r))return;Cd(H(r),t.doc.html,{content:t.doc.content,codeBlockMaxHeight:$.codeBlockMaxHeight,t:Y,onDocLink:(e,n)=>t.onopen(e,n),onAnchor:ae});let i=typeof n==`string`&&n.toLowerCase().startsWith(`metadata://`);I(m,n&&!i?Bp(H(r),n):[],!0),H(p)&&Rp(H(r),H(p),Y),f=um(H(r),t.doc.content,{onEdit:e=>{I(l,`inline-edit`),I(u,e,!0),I(c,!0)},onInsert:e=>{I(l,`inline-insert`),I(d,e,!0),I(c,!0)},onDelete:async e=>{await H(o).show({title:Y(`snippet.inline_delete_title`),message:Y(`snippet.inline_delete_message`),confirmLabel:Y(`snippet.inline_delete_confirm_btn`),cancelLabel:Y(`common.cancel`),danger:!0})&&await t.onsave(t.doc.content.slice(0,e.start)+t.doc.content.slice(e.end))}}),e===h?H(a)?.apply():(h=e,H(a)?.load(e),Gd.load(e)),I(ce,Array.from(H(r).querySelectorAll(`h1,h2,h3,h4,h5,h6`)).map(e=>({id:e.id,text:e.textContent?.trim()??``,level:parseInt(e.tagName[1])})).filter(e=>e.id&&e.text),!0)});async function oe(){let e=1;try{let n=await Gd.load(t.doc.id);n&&typeof n.accuracy==`number`&&(e=n.accuracy)}catch{}let n=Math.round(e*100),r=n<100,i=Zd(t.doc.id),a=Y(i?`doc.validate_worklog_message`:`doc.validate_message`),s=r?Y(`doc.validate_detail_low_accuracy`).replace(`{accuracy}`,n+`%`):void 0;if(!await H(o).show({title:Y(`doc.validate_title`),message:a,detail:s,confirmLabel:Y(`doc.validate_confirm`),cancelLabel:Y(`common.cancel`)}))return;let c=Xd(t.doc.content,i?`Done`:`Accepted`);if(c!==t.doc.content)try{await t.onsave(c),r&&await fetch(`/api/metadata/`+encodeURIComponent(t.doc.id)+`/refresh`,{method:`POST`}),await Gd.load(t.doc.id),$.docStatuses={...$.docStatuses,[t.doc.id]:i?`Done`:`Accepted`}}catch(e){I(x,{text:Y(`doc.validate_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}On(()=>{try{I(S,localStorage.getItem(`ld-full-width`)===`1`)}catch{}});let se=F(!1),ce=F(L([])),le=`ld-toc-w`,ue=F(!1),de=F(null);function fe(e){if(e.preventDefault(),!H(de))return;let t=e.clientX,n=H(de).getBoundingClientRect().width;I(ue,!0),H(de).style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{let r=Math.max(160,Math.min(400,n-(e.clientX-t)));H(de).style.width=r+`px`},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,I(ue,!1),H(de).style.transition=``;try{localStorage.setItem(le,String(parseInt(H(de).style.width,10)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}On(()=>{try{I(se,localStorage.getItem(`ld-toc-open`)===`1`)}catch{}try{let e=parseInt(localStorage.getItem(le)||``,10);H(de)&&e>=160&&e<=400&&(H(de).style.width=e+`px`)}catch{}});function pe(){I(se,!H(se));try{localStorage.setItem(`ld-toc-open`,H(se)?`1`:`0`)}catch{}}function me(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`),r=document.getElementById(`home-doc-header`);if(!t||!n)return;let i=t.parentElement;for(;i&&i!==n;)i.tagName===`DETAILS`&&(i.open=!0),i=i.parentElement;let a=r?r.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop;n.scrollTo({top:o-a-16,behavior:`smooth`})}function he(){I(b,t.doc.content,!0),I(y,!0),I(x,null),requestAnimationFrame(()=>H(i)?.focus())}function ge(){I(y,!1),I(x,null)}async function _e(){I(x,{text:Y(`doc.saving`),cls:`text-gray-400`},!0);try{await t.onsave(H(b)),I(y,!1),I(x,null)}catch(e){I(x,{text:Y(`error.save`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function ve(e){let t=Array.from(e.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(t){e.preventDefault(),O=H(i).selectionStart,te=H(i).selectionEnd,I(D,t.type.split(`/`)[1].replace(`jpeg`,`jpg`)||`png`,!0);let n=t.getAsFile();if(!n)return;ee=n,I(E,ie(Date.now().toString()),!0),I(T,!0);return}let n=Array.from(e.clipboardData?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(n.length){e.preventDefault();let t=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of n)await Ce(e,t,r)})()}}function ye(e){let t=Array.from(e.dataTransfer?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(!t.length)return;e.preventDefault(),e.stopPropagation();let n=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of t)await Ce(e,n,r)})()}function be(e){e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function xe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function Se(e,t,n){let r=H(b).slice(0,t),a=H(b).slice(n);I(b,r+e+a),requestAnimationFrame(()=>{H(i).selectionStart=H(i).selectionEnd=t+e.length,H(i).focus()})}async function Ce(e,t,n){if(e.size>19922944){I(x,{text:Y(`doc.file_too_large`)+` (${(e.size/1024/1024).toFixed(1)} MB, max 19 MB)`,cls:`text-red-500 dark:text-red-400`},!0);return}I(x,{text:Y(`doc.uploading_file`),cls:`text-gray-400`},!0);try{let r=await xe(e),i=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:r,name:e.name})});if(!i.ok){let e=``;try{e=(await i.json()).error||``}catch{e=await i.text()}throw Error(e||`HTTP ${i.status}`)}let{url:a,originalName:o}=await i.json();Se(`[📎 ${o||e.name}](${a})`,t,n),I(x,null)}catch(e){I(x,{text:Y(`doc.file_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function we(){I(T,!1),ee=null}async function Te(){let e=ie(H(E))||Date.now().toString();if(I(T,!1),ee){I(x,{text:Y(`doc.uploading_image`),cls:`text-gray-400`},!0);try{let t=await xe(ee),n=await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t,ext:H(D),name:e})});if(!n.ok)throw Error(await n.text());let{filename:r}=await n.json();Se(``,O,te),I(x,null)}catch(e){I(x,{text:Y(`doc.image_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}finally{ee=null}}}async function A(){try{await navigator.clipboard.writeText(location.href)}catch{}}async function Ee(){try{await navigator.clipboard.writeText(decodeURIComponent(t.doc.id)),I(w,!0),setTimeout(()=>I(w,!1),1800)}catch{}}function De(){window.print()}function Oe(e){let t=e.target.closest(`img`);!t||!e.shiftKey||(e.preventDefault(),e.stopPropagation(),I(k,t.src,!0),I(ne,t.alt||``,!0))}function ke(e){e.key===`Escape`&&H(k)&&I(k,null)}var Ae=Am();Mr(`keydown`,an,ke);var j=z(Ae),je=R(j),M=R(je),Me=R(M),Ne=R(Me),Pe=R(Ne);$r(Pe,17,()=>t.doc.folder||[],Yr,(e,t)=>{var n=dm(),r=R(n,!0);N(n),V(e=>{J(n,`title`,H(t)),K(r,e)},[()=>Bu(H(t))]),G(e,n)});var Fe=B(Pe,2),Ie=R(Fe,!0);N(Fe),N(Ne);var Le=B(Ne,2),Re=e=>{var n=fm(),r=R(n,!0);N(n),V(()=>K(r,t.doc.formattedDate)),G(e,n)};q(Le,e=>{t.doc.formattedDate&&e(Re)}),N(Me);var ze=B(Me,2),Be=R(ze),Ve=R(Be,!0);N(Be);var He=B(Be,2),Ue=R(He);N(He),N(ze),N(M);var We=B(M,2),qe=R(We),Je=e=>{var t=mm(),n=R(t),r=e=>{var t=pm(),n=R(t,!0);N(t),V(()=>{hi(t,1,`text-xs ${H(x).cls??``}`),K(n,H(x).text)}),G(e,t)};q(n,e=>{H(x)&&e(r)});var i=B(n,2),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var u=B(o,2),d=R(u,!0);N(u),N(t),V((e,t,n,r)=>{K(a,e),J(o,`title`,t),K(s,n),K(d,r)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),U(`click`,i,ge),U(`click`,o,()=>{I(l,`insert`),I(c,!0)}),U(`click`,u,_e),G(e,t)},Ye=e=>{let t=P(()=>$.markerActive?`#fef08a`:`#bfdbfe`),n=P(()=>$.markerActive?`#fef08a`:`#93c5fd`),r=P(()=>$.markerActive?`#fde047`:`#93c5fd`);var i=_m(),a=R(i),o=e=>{var t=hm(),n=B(R(t),1,!0);N(t),V((e,r)=>{J(t,`title`,e),K(n,r)},[()=>Y(`doc.validate_mode`),()=>Y(`doc.validate_btn`)]),U(`click`,t,oe),G(e,t)};q(a,e=>{H(v)&&e(o)});var c=B(a,2),l=R(c),u=R(l),d=B(u),f=B(d),p=B(f),m=B(p,2),h=e=>{G(e,gm())};q(m,e=>{$.markerHidden&&e(h)}),N(l);var g=B(l,1,!0);N(c);var _=B(c,2),y=R(_);N(_);var b=B(_,2),x=B(R(b));N(b);var S=B(b,2),w=B(R(S));N(S);var T=B(S,2),E=B(R(T));N(T);var D=B(T,2),ee=B(R(D));N(D);var O=B(D,2);N(i),V((e,i,a,o,s,l,m,h,v,C,te,k,ne)=>{J(c,`title`,e),hi(c,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${$.markerActive?`border-yellow-400 bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-300`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`),J(u,`fill`,H(t)),J(d,`fill`,H(n)),J(f,`fill`,H(r)),J(p,`fill`,H(r)),K(g,i),J(_,`title`,a),K(y,`📄 ${o??``}`),J(b,`title`,s),K(x,` ${l??``}`),J(S,`title`,m),K(w,` ${h??``}`),J(T,`title`,v),K(E,` ${C??``}`),J(D,`title`,te),K(ee,` ${k??``}`),J(O,`title`,ne),hi(O,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${H(se)?`border-blue-400 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`)},[()=>Y(`doc.marker_mode`),()=>Y(`doc.marker_btn`),()=>Y(`doc.export_pdf`),()=>Y(`doc.export_pdf_btn`),()=>Y(`doc.copy_link`),()=>Y(`doc.copy_link_btn`),()=>Y(`metadata.button_title`),()=>Y(`metadata.button`),()=>Y(`doc.edit`),()=>Y(`doc.edit_btn`),()=>Y(`doc.delete`),()=>Y(`doc.delete_btn`),()=>Y(`doc.toc_toggle`)]),U(`click`,c,()=>$.toggleMarker()),U(`click`,_,De),U(`click`,b,A),U(`click`,S,()=>I(s,!0)),U(`click`,T,he),U(`click`,D,()=>I(C,!0)),U(`click`,O,pe),G(e,i)};q(qe,e=>{H(y)?e(Je):e(Ye,-1)}),N(We),N(je);var Xe=B(je,2),Ze=e=>{qd(e,{onopen:()=>I(s,!0)})};q(Xe,e=>{H(y)||e(Ze)});var Qe=B(Xe,2),$e=e=>{var r=bm();$r(r,21,n,Yr,(e,n,r)=>{var i=ym(),a=z(i),o=e=>{G(e,vm())};q(a,e=>{r>0&&e(o)});var s=B(a,2),c=R(s);N(s),V(()=>K(c,`← ${H(n).title??``}`)),U(`click`,s,()=>t.ongoback?.(r)),G(e,i)}),N(r),G(e,r)};q(Qe,e=>{!H(y)&&n().length&&e($e)});var et=B(Qe,2),tt=e=>{var t=Sm(),n=R(t),r=R(n,!0);N(n);var i=B(n,2);$r(i,23,()=>H(m),e=>e.id,(e,t,n)=>{var r=xm(),i=R(r),a=R(i),o=R(a);N(a);var s=B(a),c=R(s,!0);N(s),N(i),N(r),V(()=>{K(o,`${H(n)+1}.`),K(c,H(t).snippet)}),U(`click`,i,()=>Vp(H(t).id)),G(e,r)}),N(i),N(t),V(()=>K(r,H(g))),G(e,t)};q(et,e=>{!H(y)&&H(m).length&&$.searchQuery&&e(tt)}),Li(B(et,2),e=>I(p,e),()=>H(p)),N(j);var nt=B(j,2),rt=R(nt),it=R(rt),at=e=>{var t=Cm();vn(t),Li(t,e=>I(i,e),()=>H(i)),Mr(`paste`,t,ve),Mr(`drop`,t,ye),Mr(`dragover`,t,be),Mi(t,()=>H(b),e=>I(b,e)),G(e,t)},ot=e=>{var t=wm();Li(t,e=>I(r,e),()=>H(r)),V(()=>hi(t,1,`prose prose-gray dark:prose-invert max-w-none prose-headings:scroll-mt-4 prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-code:before:content-none prose-code:after:content-none ${$.codeBlockLightTheme?`prose-pre:bg-[#f6f8fa] prose-pre:text-gray-800 prose-pre:border prose-pre:border-gray-200 prose-pre:rounded-lg dark:prose-pre:bg-[#0d1117] dark:prose-pre:text-gray-100 dark:prose-pre:border-gray-700`:`prose-pre:bg-[#0d1117] prose-pre:border prose-pre:border-gray-700`} ${$.imageRoundedCorners?`[&_img]:rounded-xl`:``} ${$.imageCentered?`[&_img]:mx-auto [&_img]:block`:``} ${$.imageBorder?`[&_img]:[box-shadow:0_0_0_1px_rgba(0,0,0,0.10),0_4px_12px_rgba(0,0,0,0.04)] dark:[&_img]:[box-shadow:0_0_0_1px_rgba(255,255,255,0.08),0_4px_12px_rgba(255,255,255,0.25)]`:``}`)),U(`click`,t,Oe),G(e,t)};q(it,e=>{H(y)?e(at):e(ot,-1)}),N(rt);var st=B(rt,2),ct=e=>{var t=Em(),n=z(t),r=B(n,2);_i(r,`width: 224px`);var i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o);$r(s,21,()=>H(ce),Yr,(e,t)=>{var n=Tm(),r=R(n),i=R(r,!0);N(r),N(n),V(()=>{_i(n,`padding-left: ${(H(t).level-1)*.75}rem`),J(r,`href`,`#${H(t).id??``}`),J(r,`title`,H(t).text),K(i,H(t).text)}),U(`click`,r,e=>{e.preventDefault(),me(H(t).id)}),G(e,n)}),N(s),N(o),N(r),Li(r,e=>I(de,e),()=>H(de)),V(e=>{hi(n,1,`no-print w-1 shrink-0 self-stretch cursor-col-resize select-none transition-colors ${H(ue)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),K(a,e)},[()=>Y(`doc.toc_title`)]),U(`mousedown`,n,fe),G(e,t)};q(st,e=>{H(se)&&H(ce).length>0&&e(ct)}),N(nt);var lt=B(nt,2);Li(zd(lt,{get contentEl(){return H(r)},get docId(){return t.doc.id}}),e=>I(a,e,!0),()=>H(a));var ut=B(lt,2);hf(ut,{get open(){return H(s)},get docId(){return t.doc.id},get content(){return t.doc.content},onclose:()=>I(s,!1)});var dt=B(ut,2);jp(dt,{get open(){return H(c)},get editor(){return H(i)},get mode(){return H(l)},get content(){return t.doc.content},get range(){return H(u)},get insertPos(){return H(d)},get onsave(){return t.onsave},onclose:()=>I(c,!1)});var ft=B(dt,2);Li(Dl(ft,{}),e=>I(o,e,!0),()=>H(o));var pt=B(ft,2),mt=e=>{var t=Dm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a),s=R(o),c=B(s),l=R(c,!0);N(c),N(o);var u=B(o,2),d=R(u);Ei(d);var f=B(d,2),p=R(f);N(f),N(u),N(a);var m=B(a,2),h=R(m),g=R(h,!0);N(h);var _=B(h,2),v=R(_,!0);N(_),N(m),N(n),N(t),V((e,t,n,r,a)=>{K(i,`🖼️ ${e??``}`),K(s,`${t??``} `),K(l,n),Di(d,H(E)),K(p,`.${H(D)??``}`),K(g,r),K(v,a)},[()=>Y(`modal.img_paste.title`),()=>Y(`modal.img_paste.filename_label`),()=>Y(`modal.img_paste.saved_hint`),()=>Y(`common.cancel`),()=>Y(`modal.img_paste.paste_btn`)]),U(`input`,d,e=>I(E,ie(e.target.value),!0)),U(`click`,h,we),U(`click`,_,Te),G(e,t)};q(pt,e=>{H(T)&&e(mt)});var ht=B(pt,2),gt=e=>{var n=Om(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=R(l,!0);N(l);var d=B(l,2),f=R(d,!0);N(d),N(c),N(r),N(n),V((e,n,r)=>{K(a,e),K(s,t.doc.title),K(u,n),K(f,r)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&I(C,!1)}),U(`click`,l,()=>I(C,!1)),U(`click`,d,async()=>{I(C,!1),await t.ondelete()}),G(e,n)};q(ht,e=>{H(C)&&e(gt)});var _t=B(ht,2),vt=e=>{var t=km(),n=R(t),r=B(n,2);N(t),V(()=>{J(n,`src`,H(k)),J(n,`alt`,H(ne))}),U(`click`,t,()=>I(k,null)),U(`click`,n,e=>e.stopPropagation()),U(`click`,r,()=>I(k,null)),G(e,t)};q(_t,e=>{H(k)&&e(vt)}),V(e=>{K(Ie,t.doc.category),K(Ve,t.doc.title),J(He,`title`,e),hi(He,1,`no-print inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-gray-200 text-gray-500 transition-colors hover:bg-gray-50 hover:text-blue-600 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-blue-400 ${H(w)?`text-green-600 dark:text-green-400`:``}`),hi(Ue,1,`fa-${H(w)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),U(`click`,He,Ee),G(e,Ae),Ke()}Nr([`click`,`mousedown`,`input`]);var Mm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Nm=W(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Pm=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Fm=W(`<button class="w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="text-gray-400 shrink-0">📁</span> <span class="truncate text-gray-700 dark:text-gray-300"> </span></button>`),Im=W(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden text-sm"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="text-xs text-gray-500 dark:text-gray-400 font-mono truncate flex-1"> </span></div> <div class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),Lm=W(`<p class="text-xs text-red-500"> </p>`),Rm=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-md mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="inline-block mr-1 align-text-bottom"><path d="M2 5a2 2 0 012-2h3.586a1 1 0 01.707.293L9.707 4.707A1 1 0 0010.414 5H16a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V5z" stroke="currentColor" stroke-width="1.5" fill="none"></path><line x1="10" y1="8" x2="10" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line><line x1="7" y1="11" x2="13" y2="11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line></svg> <span> </span></h3> <div class="space-y-1.5"><label for="new-folder-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-folder-name" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex items-center gap-2"><span class="flex-1 text-sm text-gray-600 dark:text-gray-300 font-mono truncate"> </span> <button class="text-xs px-2 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0"> </button></div> <!></div> <div class="space-y-1"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 truncate"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function zm(e,t){Ge(t,!0);let n=F(``),r=F(null),i=F(null),a=F(``),o=F(``),s=F(`/ (root)`),c=F(!1),l=F(``),u=F(L([])),d=F(!1),f=F(!1),p=F(``),m=F(!1),h=F(null),g=!1;On(()=>{t.open&&!g?(g=!0,_()):t.open||(g=!1)});async function _(){try{I(n,(await fetch(`/api/config`).then(e=>e.json())).docsFolder||``,!0)}catch{I(n,``)}let e=``;if($.currentDocId){let t=decodeURIComponent($.currentDocId);if(!t.startsWith(`/`)){let n=t.split(`/`);n.length>1&&(e=n.slice(0,-1).join(`/`))}}I(a,e?H(n)+`/`+e:H(n),!0),I(r,H(a),!0),I(i,null),I(o,``),I(s,e?`/`+e:`/ (root)`,!0),I(c,!1),I(p,``),I(m,!1),setTimeout(()=>H(h)?.focus(),50)}let v=P(()=>{let e=H(o).trim();if(!e)return Y(`modal.new_folder.enter_name`);let t=H(a)||H(n),r=t.startsWith(H(n))?t.slice(H(n).length).replace(/^\//,``):``;return(r?r+`/`:``)+e});function y(){I(c,!H(c)),H(c)&&b(H(r)||H(n))}async function b(e){I(d,!0),I(f,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(r,t.current,!0),I(i,t.parent,!0),I(a,t.current,!0),I(l,t.current,!0),I(s,(t.current.startsWith(H(n)+`/`)?t.current.slice(H(n).length):t.current===H(n)?``:t.current)||`/ (root)`,!0),I(u,t.dirs||[],!0)}catch{I(f,!0),I(u,[],!0)}finally{I(d,!1)}}let x=P(()=>H(r)===H(n));function S(){H(i)&&b(H(i))}async function C(){let e=H(o).trim();if(I(p,``),!e){I(p,Y(`modal.new_folder.error_empty`),!0);return}if(!/^[a-zA-Z0-9_\-. ]+$/.test(e)){I(p,Y(`modal.new_folder.error_invalid_chars`),!0);return}let r=H(a)||H(n);if(r===H(n)&&(e===`files`||e===`images`)){I(p,Y(`modal.new_folder.error_reserved`),!0);return}let i=r.endsWith(`/`)?r+e:r+`/`+e;I(m,!0);try{let e=await fetch(`/api/browse/mkdir`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i})});if(!e.ok)throw Error(await e.text());t.onclose(),t.onsuccess()}catch(e){I(m,!1),I(p,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}}var w=Ur(),T=z(w),E=e=>{var n=Rm(),r=R(n),i=R(r),a=B(R(i),2),g=R(a,!0);N(a),N(i);var _=B(i,2),w=R(_),T=R(w,!0);N(w);var E=B(w,2);Ei(E),Li(E,e=>I(h,e),()=>H(h)),N(_);var D=B(_,2),ee=R(D),O=R(ee,!0);N(ee);var te=B(ee,2),k=R(te),ne=R(k,!0);N(k);var re=B(k,2),ie=R(re,!0);N(re),N(te);var ae=B(te,2),oe=e=>{var t=Im(),n=R(t),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),p=e=>{var t=Mm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},m=e=>{var t=Nm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.error_loading`)]),G(e,t)},h=e=>{var t=Pm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.no_subfolders`)]),G(e,t)},g=e=>{var t=Ur();$r(z(t),17,()=>H(u),e=>e.path,(e,t)=>{var n=Fm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>b(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(d)?e(p):H(f)?e(m,1):H(u).length===0?e(h,2):e(g,-1)}),N(s),N(t),V(e=>{r.disabled=H(x),K(i,e),K(o,H(l))},[()=>Y(`common.up`)]),U(`click`,r,S),G(e,t)};q(ae,e=>{H(c)&&e(oe)}),N(D);var se=B(D,2),ce=R(se),le=R(ce,!0);N(ce);var ue=B(ce,2),de=R(ue,!0);N(ue),N(se);var fe=B(se,2),pe=e=>{var t=Lm(),n=R(t,!0);N(t),V(()=>K(n,H(p))),G(e,t)};q(fe,e=>{H(p)&&e(pe)});var me=B(fe,2),he=R(me),ge=R(he,!0);N(he);var _e=B(he,2),ve=R(_e,!0);N(_e),N(me),N(r),N(n),V((e,t,n,r,i,a,o,c)=>{K(g,e),K(T,t),J(E,`placeholder`,n),K(O,r),K(ne,H(s)),K(ie,i),K(le,a),K(de,H(v)),K(ge,o),_e.disabled=H(m),K(ve,c)},[()=>Y(`modal.new_folder.title`),()=>Y(`modal.new_folder.name_label`),()=>Y(`modal.new_folder.name_placeholder`),()=>Y(`modal.new_folder.location_label`),()=>Y(`modal.new_folder.browse_btn`),()=>Y(`modal.new_folder.will_be_created`),()=>Y(`common.cancel`),()=>H(m)?Y(`modal.new_folder.creating_btn`):Y(`modal.new_folder.create_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),Mi(E,()=>H(o),e=>I(o,e)),U(`click`,re,y),U(`click`,he,function(...e){t.onclose?.apply(this,e)}),U(`click`,_e,C),G(e,n)};q(T,e=>{t.open&&e(E)}),G(e,w),Ke()}Nr([`click`]);var Bm=W(`<option></option>`),Vm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Hm=W(`<p class="px-3 py-4 text-xs text-red-400 text-center"> </p>`),Um=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Wm=W(`<button class="w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button>`),Gm=W(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="font-mono text-xs text-gray-400 dark:text-gray-500 truncate flex-1 text-right"> </span></div> <div class="divide-y divide-gray-100 dark:divide-gray-800 max-h-40 overflow-y-auto"><!></div> <div class="border-t border-gray-200 dark:border-gray-700 flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/50"><input type="text" class="flex-1 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-400"/> <button class="text-xs px-2 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors shrink-0"> </button></div></div>`),Km=W(`<p class="text-xs text-red-500"> </p>`),qm=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-lg mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50">➕ <span> </span></h3> <div class="space-y-1.5"><label for="new-doc-title" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-title" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="new-doc-category" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-category" type="text" list="new-doc-category-options" autocomplete="off" placeholder="GENERAL" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <datalist id="new-doc-category-options"></datalist></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex items-center gap-2"><span class="flex-1 px-3 py-2 text-xs rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 font-mono truncate"> </span> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button></div> <!></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 font-mono text-gray-600 dark:text-gray-300 break-all"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function Jm(e,t){Ge(t,!0);let n=F(``),r=F(`YYYY_MM_DD_HH_mm_[Category]_title`),i=F(null),a=F(null),o=F(``),s=F(``),c=F(``),l=F(`/ (root)`),u=F(!1),d=F(``),f=F(L([])),p=F(!1),m=F(!1),h=F(``),g=F(L([])),_=F(``),v=F(!1),y=F(null);function b(e){return(e||``).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toUpperCase().replace(/[^A-Z0-9_-]/g,``)}function x(e){let t=H(n);return e===t?``:e.startsWith(t+`/`)?e.slice(t.length+1):e}let S=!1;On(()=>{t.open&&!S?(S=!0,C()):t.open||(S=!1)});async function C(){try{let e=await fetch(`/api/config`).then(e=>e.json());I(n,e.docsFolder||``,!0),I(r,e.filenamePattern||`YYYY_MM_DD_HH_mm_[Category]_title`,!0)}catch{I(n,``),I(r,`YYYY_MM_DD_HH_mm_[Category]_title`)}let e=$.currentDocId&&$.allDocs.find(e=>e.id===$.currentDocId),t=b(e&&e.category||`General`)||`GENERAL`,d=``;if($.currentDocId){let e=decodeURIComponent($.currentDocId);if(!e.startsWith(`/`)){let t=e.split(`/`);t.length>1&&(d=t.slice(0,-1).join(`/`))}}let f=d?H(n)+`/`+d:``;I(o,d,!0),I(i,f||null,!0),I(a,null),w(),I(s,``),I(c,t,!0),I(l,d?`/`+d:`/ (root)`,!0),I(u,!1),I(h,``),I(_,``),I(v,!1),setTimeout(()=>H(y)?.focus(),50)}function w(){let e=new Set;($.allDocs||[]).forEach(t=>{let n=b(t.category||``);n&&e.add(n)}),I(g,Array.from(e).sort((e,t)=>e.localeCompare(t)),!0)}function T(){let e=b(H(c));H(c)!==e&&I(c,e,!0)}let E=P(()=>{let e=H(s).trim();if(!e)return Y(`modal.new_doc.title_placeholder`);let t=b(H(c))||`GENERAL`,n=new Date,i=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,`0`),l=String(n.getDate()).padStart(2,`0`),u=String(n.getHours()).padStart(2,`0`),d=String(n.getMinutes()).padStart(2,`0`),f=e.toLowerCase().replace(/\s+/g,`_`).replace(/[^a-z0-9_]/g,``).replace(/_+/g,`_`).replace(/^_|_$/g,``)||`document`,p=H(r).replace(`YYYY`,String(i)).replace(`MM`,a).replace(`DD`,l).replace(`HH`,u).replace(`mm`,d).replace(/\[Category\]/i,`[${t}]`).replace(/(?<![a-z0-9])(?:title_words|title)(?![a-z0-9])/i,f)+`.md`;return H(o)?H(o)+`/`+p:p});function D(){I(u,!H(u)),H(u)&&ee(H(i)||H(n))}async function ee(e){I(p,!0),I(m,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(i,t.current,!0),I(a,t.parent,!0),I(o,x(t.current),!0),I(d,t.current,!0),I(l,H(o)?`/`+H(o):`/ (root)`,!0),I(f,t.dirs||[],!0)}catch{I(m,!0),I(f,[],!0)}finally{I(p,!1)}}let O=P(()=>H(i)===H(n));function te(){H(i)!==H(n)&&H(a)&&ee(H(a))}function k(){let e=H(h).trim();if(!e)return;let t=H(i)||H(n);if(t===H(n)&&(e===`files`||e===`images`)){I(_,Y(`modal.new_folder.error_reserved`),!0);return}I(_,``);let r=(x(t)?x(t)+`/`:``)+e;I(o,r),I(l,`/`+r),I(h,``)}async function ne(){let e=H(s).trim(),n=b(H(c))||`GENERAL`;if(!e){I(_,Y(`modal.new_doc.error_empty_title`),!0);return}I(_,``),I(v,!0);try{let r=await fetch(`/api/documents`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,category:n,folder:H(o)})});if(!r.ok){let e=await r.json();throw Error(e.error||`Creation failed`)}let i=await r.json();t.onclose(),t.onsuccess(i.id)}catch(e){I(_,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e))),I(v,!1)}}function re(e){e.key===`Enter`&&ne(),e.key===`Escape`&&t.onclose()}var ie=Ur(),ae=z(ie),oe=e=>{var n=qm(),r=R(n),i=R(r),a=B(R(i)),o=R(a,!0);N(a),N(i);var b=B(i,2),x=R(b),S=R(x,!0);N(x);var C=B(x,2);Ei(C),Li(C,e=>I(y,e),()=>H(y)),N(b);var w=B(b,2),ie=R(w),ae=R(ie,!0);N(ie);var oe=B(ie,2);Ei(oe);var se=B(oe,2);$r(se,20,()=>H(g),e=>e,(e,t)=>{var n=Bm(),r={};V(()=>{r!==(r=t)&&(n.value=(n.__value=t)??``)}),G(e,n)}),N(se),N(w);var ce=B(w,2),le=R(ce),ue=R(le,!0);N(le);var de=B(le,2),fe=R(de),pe=R(fe,!0);N(fe);var me=B(fe,2),he=B(R(me)),ge=R(he,!0);N(he),N(me),N(de);var _e=B(de,2),ve=e=>{var t=Gm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),l=e=>{var t=Vm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},u=e=>{var t=Hm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.cannot_read_dir`)]),G(e,t)},g=e=>{var t=Um(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_doc.no_subfolders`)]),G(e,t)},_=e=>{var t=Ur();$r(z(t),17,()=>H(f),e=>e.path,(e,t)=>{var n=Wm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>ee(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(p)?e(l):H(m)?e(u,1):H(f).length===0?e(g,2):e(_,-1)}),N(s);var v=B(s,2),y=R(v);Ei(y);var b=B(y,2),x=R(b,!0);N(b),N(v),N(t),V((e,t,n)=>{r.disabled=H(O),K(i,`↑ ${e??``}`),K(o,H(d)),J(y,`placeholder`,t),K(x,n)},[()=>Y(`common.up`),()=>Y(`modal.new_doc.new_folder_placeholder`),()=>Y(`modal.new_doc.create_folder_btn`)]),U(`click`,r,te),U(`keydown`,y,e=>{e.key===`Enter`&&k()}),Mi(y,()=>H(h),e=>I(h,e)),U(`click`,b,k),G(e,t)};q(_e,e=>{H(u)&&e(ve)}),N(ce);var ye=B(ce,2),be=R(ye),xe=R(be,!0);N(be);var Se=B(be,2),Ce=R(Se,!0);N(Se),N(ye);var we=B(ye,2),Te=e=>{var t=Km(),n=R(t,!0);N(t),V(()=>K(n,H(_))),G(e,t)};q(we,e=>{H(_)&&e(Te)});var A=B(we,2),Ee=R(A),De=R(Ee,!0);N(Ee);var Oe=B(Ee,2),ke=R(Oe,!0);N(Oe),N(A),N(r),N(n),V((e,t,n,r,i,a,s,c,u)=>{K(o,e),K(S,t),J(C,`placeholder`,n),K(ae,r),K(ue,i),K(pe,H(l)),K(ge,a),K(xe,s),K(Ce,H(E)),K(De,c),Oe.disabled=H(v),K(ke,u)},[()=>Y(`modal.new_doc.title`),()=>Y(`modal.new_doc.title_label`),()=>Y(`modal.new_doc.title_placeholder`),()=>Y(`modal.new_doc.category_label`),()=>Y(`modal.new_doc.location_label`),()=>Y(`modal.new_doc.browse_btn`),()=>Y(`modal.new_doc.filename_label`),()=>Y(`common.cancel`),()=>H(v)?Y(`modal.new_folder.creating_btn`):Y(`common.create`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),U(`keydown`,C,re),Mi(C,()=>H(s),e=>I(s,e)),U(`input`,oe,T),U(`keydown`,oe,re),Mi(oe,()=>H(c),e=>I(c,e)),U(`click`,me,D),U(`click`,Ee,function(...e){t.onclose?.apply(this,e)}),U(`click`,Oe,ne),G(e,n)};q(ae,e=>{t.open&&e(oe)}),G(e,ie),Ke()}Nr([`click`,`keydown`,`input`]);var Ym=W(`<p class="text-sm text-gray-400 py-2"> </p>`),Xm=W(`<p class="text-sm text-red-500"> </p>`),Zm=W(`<label class="flex items-center gap-3 px-1 py-1.5 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"/> <span class="text-sm text-gray-700 dark:text-gray-300"> </span></label>`),Qm=W(`<div><div class="max-h-48 overflow-y-auto space-y-0.5 border border-gray-200 dark:border-gray-700 rounded-lg p-2"><!></div></div>`),$m=W(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),eh=W(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg border border-blue-500 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 font-semibold transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),th=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-file-export mr-2 text-blue-500"></i> <span> </span></h3> <div class="flex gap-0 border-b border-gray-200 dark:border-gray-700"><button> </button> <button> </button> <button> </button></div> <!> <!> <!> <!></div></div>`);function nh(e,t){Ge(t,!0);let n=F(`markdown`),r=!1,i=F(!1),a=F(!1),o=F(L([])),s=F(L({})),c=F(!1),l=F(!1),u=F(!1),d=F(!1),f=!1;On(()=>{t.open&&!f?(f=!0,I(n,`markdown`),r=!1,I(o,[],!0),I(s,{},!0)):t.open||(f=!1)});function p(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function m(e){I(n,e,!0),e===`html`&&h()}async function h(){if(!r){I(i,!0),I(a,!1);try{let e=await fetch(`/api/documents`).then(e=>e.json()),t=new Set;e.forEach(e=>t.add(e.folder?.[0]??e.category??`General`)),I(o,[...t].sort((e,t)=>e===`General`?-1:t===`General`?1:e.localeCompare(t)),!0),r=!0}catch{I(a,!0)}finally{I(i,!1)}}}async function g(){I(c,!0);try{let e=await fetch(`/api/export/markdown`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok)throw Error(await e.text());let n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`export-markdown.zip`,i.click(),URL.revokeObjectURL(r),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{I(c,!1)}}async function _(e){let n=H(o).filter(e=>H(s)[e]);if(n.length){I(e===`confluence`?u:l,!0);try{let r=await fetch(`/api/export/html`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folders:n,mode:e})});if(!r.ok)throw Error(await r.text());let i=await r.blob(),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`export-${e}.zip`,o.click(),URL.revokeObjectURL(a),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{I(u,!1),I(l,!1)}}}async function v(){I(d,!0);try{let e=$.allDocs&&$.allDocs.length?$.allDocs:await fetch(`/api/documents`).then(e=>e.json()),n={};for(let t=0;t<e.length;t+=5){let r=e.slice(t,t+5),i=await Promise.all(r.map(e=>fetch(`/api/documents/`+e.id).then(e=>e.ok?e.json():null).catch(()=>null)));for(let r of i)r&&(n[r.id??e[t]?.id]=r);r.forEach((e,t)=>{i[t]&&(n[e.id]=i[t])})}function r(e){let t={categories:{},children:{}};for(let n of e){let e=t;for(let t of n.folder||[])e.children[t]||(e.children[t]={categories:{},children:{}}),e=e.children[t];e.categories[n.category]||(e.categories[n.category]=[]),e.categories[n.category].push(n)}return t}function i(e){let t=[];e.categories.General&&t.push(...e.categories.General);let n=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let r of n)t.push(...i(e.children[r]));let r=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let n of r)t.push(...e.categories[n]);return t}function a(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function o(e,t){let n=``,r=t*1.25,i=(e,i)=>{let a=t===0&&e===`General`?`General`:e;n+=`<li style="margin-left:${r}rem;margin-top:${t===0?`0.75`:`0.4`}rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280;">${a}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`;for(let e of i)n+=`<li style="margin-left:${r+.75}rem;padding:0.15rem 0;">`,n+=`<a href="#doc-${e.id}" style="color:#1d4ed8;text-decoration:none;font-size:0.875rem;">${p(e.title)}</a>`,e.formattedDate&&(n+=`<span style="color:#9ca3af;font-size:0.7rem;margin-left:0.5rem;">${p(e.formattedDate)}</span>`),n+=`</li>`;n+=`</ul></li>`};e.categories.General&&i(`General`,e.categories.General);let s=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let i of s)n+=`<li style="margin-left:${r}rem;margin-top:0.75rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#7c3aed;">📁 ${a(i)}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`,n+=o(e.children[i],t+1),n+=`</ul></li>`;let c=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let t of c)i(t,e.categories[t]);return n}function s(e){return e.replace(/href="[^"]*\?doc=([^"&#]+)(?:#[^"]*)?"/g,(e,t)=>`href="#doc-${t}"`)}let c=p(document.title||`Living Documentation`),l=r(e),u=i(l),d=`<!DOCTYPE html>
|
|
91
|
+
`,t);return n>=0?n:0}c=c.nextElementSibling}return e.length}function Tm(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=mm(t);gm(e,r);let i=i=>{let a=i.target?.closest(`[data-inline-snippet-index]`);if(a&&e.contains(a)){let e=r[Number(a.dataset.inlineSnippetIndex)];if(!e)return;i.preventDefault();let t=im(e.type),o=om(e.type);vm(i,[{iconClass:t.iconClass,labelKey:t.labelKey,dataAction:`edit`,dataType:e.type,onActivate:()=>n.onEdit(e)},{iconClass:o.iconClass,labelKey:o.labelKey,dataAction:`delete`,dataType:e.type,onActivate:()=>n.onDelete(e)}]);return}if(!e.contains(i.target))return;let o=wm(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),vm(i,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(o)}))};e.addEventListener(`contextmenu`,i);let a=t=>{let i=t.target?.closest(`[data-inline-snippet-index]`);if(!i||!e.contains(i))return;let a=r[Number(i.dataset.inlineSnippetIndex)];!a||a.type!==`table`||(t.preventDefault(),t.stopPropagation(),_m(),n.onEdit({...a,tableFocusCell:bm(t.target,i)||void 0}))};e.addEventListener(`dblclick`,a);let o=e.closest(`#home-content-area`)||e.closest(`main`),s=null;o&&(s=r=>{r.defaultPrevented||e.offsetParent!==null&&(r.target?.closest(`textarea, input, [data-inline-snippet-index]`)||e.contains(r.target)||(r.preventDefault(),vm(r,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(t.length)})))},o.addEventListener(`contextmenu`,s));let c=e=>{cm&&!cm.contains(e.target)&&_m()},l=e=>{e.key===`Escape`&&_m()};return document.addEventListener(`click`,c),document.addEventListener(`keydown`,l),()=>{e.removeEventListener(`contextmenu`,i),e.removeEventListener(`dblclick`,a),o&&s&&o.removeEventListener(`contextmenu`,s),document.removeEventListener(`click`,c),document.removeEventListener(`keydown`,l),_m(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var Em=W(`<span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300"> </span>`),Dm=W(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),Om=W(`<span> </span>`),km=W(`<div data-testid="edit-actions" class="flex items-center gap-2"><!> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div>`),Am=W(`<button data-testid="validate-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-green-700 bg-green-600 text-white font-semibold hover:bg-green-700 transition-colors"><i class="fa-solid fa-check" style="margin-right:4px"></i> </button>`),jm=Vr(`<g><line x1="8" y1="8" x2="92" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line><line x1="92" y1="8" x2="8" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line></g>`),Mm=W(`<div data-testid="view-actions" class="flex items-center gap-2"><!> <button><svg width="18" height="18" viewBox="0 0 100 100" fill="none" style="display:inline-block;vertical-align:middle;margin-right:4px"><rect x="28" y="10" width="44" height="52" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><rect x="52" y="8" width="22" height="30" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><polygon points="28,60 10,80 30,80 38,72" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><polygon points="28,48 19,70 36,75 55,70" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><line x1="10" y1="90" x2="72" y2="90" stroke="currentColor" stroke-width="6" stroke-linecap="round"></line><!></svg> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-link"></i> </button> <button data-testid="metadata-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-code-compare"></i> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-file-pen"></i> </button> <button class="no-print text-sm px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i> </button> <button><i class="fa-solid fa-list-ul"></i></button></div>`),Nm=W(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),Pm=W(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),Fm=W(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),Im=W(`<li><button class="w-full text-left px-3 py-1.5 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors"><span class="text-yellow-600 dark:text-yellow-500 font-mono text-xs mr-2"> </span><span class="text-xs"> </span></button></li>`),Lm=W(`<div class="mt-4 rounded-lg bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 text-sm text-yellow-800 dark:text-yellow-300 overflow-hidden"><div class="px-3 py-2 font-medium border-b border-yellow-200 dark:border-yellow-800"> </div> <ol class="max-h-40 overflow-y-auto divide-y divide-yellow-100 dark:divide-yellow-900/40 list-none m-0 p-0"></ol></div>`),Rm=W(`<textarea id="doc-editor" data-testid="doc-editor" spellcheck="false" class="w-full min-h-[70vh] px-4 py-3 text-sm font-mono leading-relaxed rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y"></textarea>`),zm=W(`<div id="doc-content" data-testid="doc-content"></div>`),Bm=W(`<li class="m-0 p-0"><a class="block text-xs text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:underline py-0.5 leading-snug transition-colors truncate"> </a></li>`),Vm=W(`<div></div> <aside class="no-print shrink-0 sticky self-start overflow-y-auto py-8 pr-4 pl-3 ld-toc-aside"><p class="text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-3"> </p> <nav><ul class="space-y-1 list-none m-0 p-0"></ul></nav></aside>`,1),Hm=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-5"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"> </h3> <div class="space-y-1.5"><label for="img-paste-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> <span class="font-normal text-gray-400"> </span></label> <div class="flex items-center gap-2"><input id="img-paste-name" type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="text-xs text-gray-400 shrink-0"> </span></div></div> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`),Um=W(`<div class="fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4"><div class="w-full max-w-sm bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-5 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-500 dark:text-gray-400 italic truncate"> </p> <div class="flex justify-end gap-2 mt-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div></div>`),Wm=W(`<div class="fixed inset-0 z-50 bg-black/90 flex items-center justify-center cursor-pointer"><img class="max-w-full max-h-full object-contain select-none"/> <button class="absolute top-4 right-4 text-white/70 hover:text-white text-2xl leading-none">×</button></div>`),Gm=W(`<header id="home-doc-header" class="sticky top-0 z-10 bg-gray-50 dark:bg-gray-950 px-6 pt-8 pb-6 border-b border-gray-300 dark:border-gray-800"><div class="flex items-start gap-4 flex-wrap"><div class="shrink min-w-0"><div class="flex items-center gap-2 mb-2 flex-wrap"><span class="flex items-center gap-2 flex-wrap"><!> <span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"> </span></span> <!></div> <div class="flex items-center gap-2"><h1 data-testid="doc-title" class="min-w-0 text-2xl font-bold text-gray-900 dark:text-gray-50 leading-tight"> </h1> <button type="button" data-testid="copy-doc-id-btn"><i aria-hidden="true"></i></button></div></div> <div class="flex items-center gap-2 flex-wrap ml-auto"><!></div></div> <!> <!> <!> <div class="hidden no-print"></div></header> <div class="flex min-h-full items-start"><article id="home-doc-view" data-testid="doc-view" class="flex-1 min-w-0 px-6 pt-8 pb-8"><!></article> <!></div> <!> <!> <!> <!> <!> <!> <!>`,1);function Km(e,t){Ge(t,!0);let n=Bi(t,`navHistory`,19,()=>[]),r=F(null),i=F(null),a=F(null),o=F(null),s=F(!1),c=F(!1),l=F(`insert`),u=F(null),d=F(0),f=null;Vi(()=>{let e=window;return e.openSnippetsModal=()=>{I(l,`insert`),I(c,!0)},e.openSnippetsModalForInlineInsert=e=>{I(l,`inline-insert`),I(d,Math.max(0,Number(e)||0),!0),I(c,!0)},()=>{delete e.openSnippetsModal,delete e.openSnippetsModalForInlineInsert}});let p=F(null),m=F(L([])),h=``,g=P(()=>H(m).length?Y(H(m).length===1?`search.notice_singular`:`search.notice_plural`).replace(`{count}`,String(H(m).length)).replace(`{query}`,$.searchQuery):``),_=P(()=>Yd(t.doc.content)),v=P(()=>(H(_)||``).toUpperCase()===`TO BE VALIDATED`),y=F(!1),b=F(``),x=F(null),S=F(!1),C=F(!1),w=F(!1),T=F(!1),E=F(``),D=F(`png`),ee=null,O=0,te=0,k=F(null),ne=F(``),re=/[̀-ͯ]/g;function ie(e){return(e||``).normalize(`NFD`).replace(re,``).toLowerCase().replace(/[^a-z0-9]/g,`_`)}function ae(e){let t=document.getElementById(`home-content-area`),n=document.getElementById(e);if(!t||!n)return;let r=document.querySelector(`#home-doc-view header`),i=r?r.getBoundingClientRect().height:0;t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-i-8}On(()=>{let e=t.doc.id,n=$.searchQuery;if(f?.(),f=null,H(y)||!H(r))return;Cd(H(r),t.doc.html,{content:t.doc.content,codeBlockMaxHeight:$.codeBlockMaxHeight,t:Y,onDocLink:(e,n)=>t.onopen(e,n),onAnchor:ae});let i=typeof n==`string`&&n.toLowerCase().startsWith(`metadata://`);I(m,n&&!i?em(H(r),n):[],!0),H(p)&&Qp(H(r),H(p),Y),f=Tm(H(r),t.doc.content,{onEdit:e=>{I(l,`inline-edit`),I(u,e,!0),I(c,!0)},onInsert:e=>{I(l,`inline-insert`),I(d,e,!0),I(c,!0)},onDelete:async e=>{await H(o).show({title:Y(`snippet.inline_delete_title`),message:Y(`snippet.inline_delete_message`),confirmLabel:Y(`snippet.inline_delete_confirm_btn`),cancelLabel:Y(`common.cancel`),danger:!0})&&await t.onsave(t.doc.content.slice(0,e.start)+t.doc.content.slice(e.end))}}),e===h?H(a)?.apply():(h=e,H(a)?.load(e),Gd.load(e)),I(ce,Array.from(H(r).querySelectorAll(`h1,h2,h3,h4,h5,h6`)).map(e=>({id:e.id,text:e.textContent?.trim()??``,level:parseInt(e.tagName[1])})).filter(e=>e.id&&e.text),!0)});async function oe(){let e=1;try{let n=await Gd.load(t.doc.id);n&&typeof n.accuracy==`number`&&(e=n.accuracy)}catch{}let n=Math.round(e*100),r=n<100,i=Zd(t.doc.id),a=Y(i?`doc.validate_worklog_message`:`doc.validate_message`),s=r?Y(`doc.validate_detail_low_accuracy`).replace(`{accuracy}`,n+`%`):void 0;if(!await H(o).show({title:Y(`doc.validate_title`),message:a,detail:s,confirmLabel:Y(`doc.validate_confirm`),cancelLabel:Y(`common.cancel`)}))return;let c=Xd(t.doc.content,i?`Done`:`Accepted`);if(c!==t.doc.content)try{await t.onsave(c),r&&await fetch(`/api/metadata/`+encodeURIComponent(t.doc.id)+`/refresh`,{method:`POST`}),await Gd.load(t.doc.id),$.docStatuses={...$.docStatuses,[t.doc.id]:i?`Done`:`Accepted`}}catch(e){I(x,{text:Y(`doc.validate_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}On(()=>{try{I(S,localStorage.getItem(`ld-full-width`)===`1`)}catch{}});let se=F(!1),ce=F(L([])),le=P(()=>H(se)&&H(ce).length>0),ue=`ld-toc-w`,de=F(!1),fe=F(null),pe=F(null),me=F(0);On(()=>{if(!H(pe))return;let e=new ResizeObserver(()=>{I(me,H(pe).offsetHeight,!0)});return e.observe(H(pe)),I(me,H(pe).offsetHeight,!0),()=>e.disconnect()});function he(e){if(e.preventDefault(),!H(fe))return;let t=e.clientX,n=H(fe).getBoundingClientRect().width;I(de,!0),H(fe).style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{let r=Math.max(160,Math.min(400,n-(e.clientX-t)));H(fe).style.width=r+`px`},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,I(de,!1),H(fe).style.transition=``;try{localStorage.setItem(ue,String(parseInt(H(fe).style.width,10)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}On(()=>{try{I(se,localStorage.getItem(`ld-toc-open`)===`1`)}catch{}try{let e=parseInt(localStorage.getItem(ue)||``,10);H(fe)&&e>=160&&e<=400&&(H(fe).style.width=e+`px`)}catch{}});function ge(){I(se,!H(se));try{localStorage.setItem(`ld-toc-open`,H(se)?`1`:`0`)}catch{}}function _e(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`),r=document.getElementById(`home-doc-header`);if(!t||!n)return;let i=t.parentElement;for(;i&&i!==n;)i.tagName===`DETAILS`&&(i.open=!0),i=i.parentElement;let a=r?r.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop;n.scrollTo({top:o-a-16,behavior:`smooth`})}function ve(){I(b,t.doc.content,!0),I(y,!0),I(x,null),requestAnimationFrame(()=>H(i)?.focus())}function ye(){I(y,!1),I(x,null)}async function be(){I(x,{text:Y(`doc.saving`),cls:`text-gray-400`},!0);try{await t.onsave(H(b)),I(y,!1),I(x,null)}catch(e){I(x,{text:Y(`error.save`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function xe(e){let t=Array.from(e.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(t){e.preventDefault(),O=H(i).selectionStart,te=H(i).selectionEnd,I(D,t.type.split(`/`)[1].replace(`jpeg`,`jpg`)||`png`,!0);let n=t.getAsFile();if(!n)return;ee=n,I(E,ie(Date.now().toString()),!0),I(T,!0);return}let n=Array.from(e.clipboardData?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(n.length){e.preventDefault();let t=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of n)await A(e,t,r)})()}}function Se(e){let t=Array.from(e.dataTransfer?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(!t.length)return;e.preventDefault(),e.stopPropagation();let n=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of t)await A(e,n,r)})()}function Ce(e){e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function we(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function Te(e,t,n){let r=H(b).slice(0,t),a=H(b).slice(n);I(b,r+e+a),requestAnimationFrame(()=>{H(i).selectionStart=H(i).selectionEnd=t+e.length,H(i).focus()})}async function A(e,t,n){if(e.size>19922944){I(x,{text:Y(`doc.file_too_large`)+` (${(e.size/1024/1024).toFixed(1)} MB, max 19 MB)`,cls:`text-red-500 dark:text-red-400`},!0);return}I(x,{text:Y(`doc.uploading_file`),cls:`text-gray-400`},!0);try{let r=await we(e),i=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:r,name:e.name})});if(!i.ok){let e=``;try{e=(await i.json()).error||``}catch{e=await i.text()}throw Error(e||`HTTP ${i.status}`)}let{url:a,originalName:o}=await i.json();Te(`[📎 ${o||e.name}](${a})`,t,n),I(x,null)}catch(e){I(x,{text:Y(`doc.file_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function Ee(){I(T,!1),ee=null}async function De(){let e=ie(H(E))||Date.now().toString();if(I(T,!1),ee){I(x,{text:Y(`doc.uploading_image`),cls:`text-gray-400`},!0);try{let t=await we(ee),n=await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t,ext:H(D),name:e})});if(!n.ok)throw Error(await n.text());let{filename:r}=await n.json();Te(``,O,te),I(x,null)}catch(e){I(x,{text:Y(`doc.image_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}finally{ee=null}}}async function Oe(){try{await navigator.clipboard.writeText(location.href)}catch{}}async function ke(){try{await navigator.clipboard.writeText(decodeURIComponent(t.doc.id)),I(w,!0),setTimeout(()=>I(w,!1),1800)}catch{}}function Ae(){window.print()}function j(e){let t=e.target.closest(`img`);!t||!e.shiftKey||(e.preventDefault(),e.stopPropagation(),I(k,t.src,!0),I(ne,t.alt||``,!0))}function je(e){e.key===`Escape`&&H(k)&&I(k,null)}var M=Gm();Mr(`keydown`,an,je);var Me=z(M),Ne=R(Me),Pe=R(Ne),Fe=R(Pe),Ie=R(Fe),Le=R(Ie);$r(Le,17,()=>t.doc.folder||[],Yr,(e,t)=>{var n=Em(),r=R(n,!0);N(n),V(e=>{J(n,`title`,H(t)),K(r,e)},[()=>Bu(H(t))]),G(e,n)});var Re=B(Le,2),ze=R(Re,!0);N(Re),N(Ie);var Be=B(Ie,2),Ve=e=>{var n=Dm(),r=R(n,!0);N(n),V(()=>K(r,t.doc.formattedDate)),G(e,n)};q(Be,e=>{t.doc.formattedDate&&e(Ve)}),N(Fe);var He=B(Fe,2),Ue=R(He),We=R(Ue,!0);N(Ue);var qe=B(Ue,2),Je=R(qe);N(qe),N(He),N(Pe);var Ye=B(Pe,2),Xe=R(Ye),Ze=e=>{var t=km(),n=R(t),r=e=>{var t=Om(),n=R(t,!0);N(t),V(()=>{hi(t,1,`text-xs ${H(x).cls??``}`),K(n,H(x).text)}),G(e,t)};q(n,e=>{H(x)&&e(r)});var i=B(n,2),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var u=B(o,2),d=R(u,!0);N(u),N(t),V((e,t,n,r)=>{K(a,e),J(o,`title`,t),K(s,n),K(d,r)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),U(`click`,i,ye),U(`click`,o,()=>{I(l,`insert`),I(c,!0)}),U(`click`,u,be),G(e,t)},Qe=e=>{let t=P(()=>$.markerActive?`#fef08a`:`#bfdbfe`),n=P(()=>$.markerActive?`#fef08a`:`#93c5fd`),r=P(()=>$.markerActive?`#fde047`:`#93c5fd`);var i=Mm(),a=R(i),o=e=>{var t=Am(),n=B(R(t),1,!0);N(t),V((e,r)=>{J(t,`title`,e),K(n,r)},[()=>Y(`doc.validate_mode`),()=>Y(`doc.validate_btn`)]),U(`click`,t,oe),G(e,t)};q(a,e=>{H(v)&&e(o)});var c=B(a,2),l=R(c),u=R(l),d=B(u),f=B(d),p=B(f),m=B(p,2),h=e=>{G(e,jm())};q(m,e=>{$.markerHidden&&e(h)}),N(l);var g=B(l,1,!0);N(c);var _=B(c,2),y=R(_);N(_);var b=B(_,2),x=B(R(b));N(b);var S=B(b,2),w=B(R(S));N(S);var T=B(S,2),E=B(R(T));N(T);var D=B(T,2),ee=B(R(D));N(D);var O=B(D,2);N(i),V((e,i,a,o,s,l,m,h,v,C,te,k,ne)=>{J(c,`title`,e),hi(c,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${$.markerActive?`border-yellow-400 bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-300`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`),J(u,`fill`,H(t)),J(d,`fill`,H(n)),J(f,`fill`,H(r)),J(p,`fill`,H(r)),K(g,i),J(_,`title`,a),K(y,`📄 ${o??``}`),J(b,`title`,s),K(x,` ${l??``}`),J(S,`title`,m),K(w,` ${h??``}`),J(T,`title`,v),K(E,` ${C??``}`),J(D,`title`,te),K(ee,` ${k??``}`),J(O,`title`,ne),hi(O,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${H(se)?`border-blue-400 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`)},[()=>Y(`doc.marker_mode`),()=>Y(`doc.marker_btn`),()=>Y(`doc.export_pdf`),()=>Y(`doc.export_pdf_btn`),()=>Y(`doc.copy_link`),()=>Y(`doc.copy_link_btn`),()=>Y(`metadata.button_title`),()=>Y(`metadata.button`),()=>Y(`doc.edit`),()=>Y(`doc.edit_btn`),()=>Y(`doc.delete`),()=>Y(`doc.delete_btn`),()=>Y(`doc.toc_toggle`)]),U(`click`,c,()=>$.toggleMarker()),U(`click`,_,Ae),U(`click`,b,Oe),U(`click`,S,()=>I(s,!0)),U(`click`,T,ve),U(`click`,D,()=>I(C,!0)),U(`click`,O,ge),G(e,i)};q(Xe,e=>{H(y)?e(Ze):e(Qe,-1)}),N(Ye),N(Ne);var $e=B(Ne,2),et=e=>{qd(e,{onopen:()=>I(s,!0)})};q($e,e=>{H(y)||e(et)});var tt=B($e,2),nt=e=>{var r=Fm();$r(r,21,n,Yr,(e,n,r)=>{var i=Pm(),a=z(i),o=e=>{G(e,Nm())};q(a,e=>{r>0&&e(o)});var s=B(a,2),c=R(s);N(s),V(()=>K(c,`← ${H(n).title??``}`)),U(`click`,s,()=>t.ongoback?.(r)),G(e,i)}),N(r),G(e,r)};q(tt,e=>{!H(y)&&n().length&&e(nt)});var rt=B(tt,2),it=e=>{var t=Lm(),n=R(t),r=R(n,!0);N(n);var i=B(n,2);$r(i,23,()=>H(m),e=>e.id,(e,t,n)=>{var r=Im(),i=R(r),a=R(i),o=R(a);N(a);var s=B(a),c=R(s,!0);N(s),N(i),N(r),V(()=>{K(o,`${H(n)+1}.`),K(c,H(t).snippet)}),U(`click`,i,()=>tm(H(t).id)),G(e,r)}),N(i),N(t),V(()=>K(r,H(g))),G(e,t)};q(rt,e=>{!H(y)&&H(m).length&&$.searchQuery&&e(it)}),Li(B(rt,2),e=>I(p,e),()=>H(p)),N(Me),Li(Me,e=>I(pe,e),()=>H(pe));var at=B(Me,2),ot=R(at),st=R(ot),ct=e=>{var t=Rm();vn(t),Li(t,e=>I(i,e),()=>H(i)),Mr(`paste`,t,xe),Mr(`drop`,t,Se),Mr(`dragover`,t,Ce),Mi(t,()=>H(b),e=>I(b,e)),G(e,t)},lt=e=>{var t=zm();Li(t,e=>I(r,e),()=>H(r)),V(()=>hi(t,1,`prose prose-gray dark:prose-invert max-w-none prose-headings:scroll-mt-4 prose-headings:font-semibold prose-h1:text-[2.1875rem] prose-h2:text-[1.8125rem] prose-h3:text-[1.5rem] prose-h4:text-[1.25rem] prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-code:before:content-none prose-code:after:content-none ${$.codeBlockLightTheme?`prose-pre:bg-[#f6f8fa] prose-pre:text-gray-800 prose-pre:border prose-pre:border-gray-200 prose-pre:rounded-lg dark:prose-pre:bg-[#0d1117] dark:prose-pre:text-gray-100 dark:prose-pre:border-gray-700`:`prose-pre:bg-[#0d1117] prose-pre:border prose-pre:border-gray-700`} ${$.imageRoundedCorners?`[&_img]:rounded-xl`:``} ${$.imageCentered?`[&_img]:mx-auto [&_img]:block`:``} ${$.imageBorder?`[&_img]:[box-shadow:0_0_0_1px_rgba(0,0,0,0.10),0_4px_12px_rgba(0,0,0,0.04)] dark:[&_img]:[box-shadow:0_0_0_1px_rgba(255,255,255,0.08),0_4px_12px_rgba(255,255,255,0.25)]`:``}`)),U(`click`,t,j),G(e,t)};q(st,e=>{H(y)?e(ct):e(lt,-1)}),N(ot);var ut=B(ot,2),dt=e=>{var t=Vm(),n=z(t),r=B(n,2),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o);$r(s,21,()=>H(ce),Yr,(e,t)=>{var n=Bm(),r=R(n),i=R(r,!0);N(r),N(n),V(()=>{_i(n,`padding-left: ${(H(t).level-1)*.75}rem`),J(r,`href`,`#${H(t).id??``}`),J(r,`title`,H(t).text),K(i,H(t).text)}),U(`mousedown`,r,e=>e.preventDefault()),U(`click`,r,e=>{e.preventDefault(),_e(H(t).id)}),G(e,n)}),N(s),N(o),N(r),Li(r,e=>I(fe,e),()=>H(fe)),V(e=>{hi(n,1,`no-print w-1 shrink-0 self-stretch cursor-col-resize select-none transition-colors ${H(de)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),_i(r,`width: 224px; top: ${H(me)??``}px; max-height: calc(100vh - ${H(me)??``}px)`),K(a,e)},[()=>Y(`doc.toc_title`)]),U(`mousedown`,n,he),G(e,t)};q(ut,e=>{H(le)&&e(dt)}),N(at);var ft=B(at,2);Li(zd(ft,{get contentEl(){return H(r)},get docId(){return t.doc.id}}),e=>I(a,e,!0),()=>H(a));var pt=B(ft,2);hf(pt,{get open(){return H(s)},get docId(){return t.doc.id},get content(){return t.doc.content},onclose:()=>I(s,!1)});var mt=B(pt,2);Gp(mt,{get open(){return H(c)},get editor(){return H(i)},get mode(){return H(l)},get content(){return t.doc.content},get range(){return H(u)},get insertPos(){return H(d)},get onsave(){return t.onsave},onclose:()=>I(c,!1)});var ht=B(mt,2);Li(Dl(ht,{}),e=>I(o,e,!0),()=>H(o));var gt=B(ht,2),_t=e=>{var t=Hm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a),s=R(o),c=B(s),l=R(c,!0);N(c),N(o);var u=B(o,2),d=R(u);Ei(d);var f=B(d,2),p=R(f);N(f),N(u),N(a);var m=B(a,2),h=R(m),g=R(h,!0);N(h);var _=B(h,2),v=R(_,!0);N(_),N(m),N(n),N(t),V((e,t,n,r,a)=>{K(i,`🖼️ ${e??``}`),K(s,`${t??``} `),K(l,n),Di(d,H(E)),K(p,`.${H(D)??``}`),K(g,r),K(v,a)},[()=>Y(`modal.img_paste.title`),()=>Y(`modal.img_paste.filename_label`),()=>Y(`modal.img_paste.saved_hint`),()=>Y(`common.cancel`),()=>Y(`modal.img_paste.paste_btn`)]),U(`input`,d,e=>I(E,ie(e.target.value),!0)),U(`click`,h,Ee),U(`click`,_,De),G(e,t)};q(gt,e=>{H(T)&&e(_t)});var vt=B(gt,2),yt=e=>{var n=Um(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=R(l,!0);N(l);var d=B(l,2),f=R(d,!0);N(d),N(c),N(r),N(n),V((e,n,r)=>{K(a,e),K(s,t.doc.title),K(u,n),K(f,r)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&I(C,!1)}),U(`click`,l,()=>I(C,!1)),U(`click`,d,async()=>{I(C,!1),await t.ondelete()}),G(e,n)};q(vt,e=>{H(C)&&e(yt)});var bt=B(vt,2),xt=e=>{var t=Wm(),n=R(t),r=B(n,2);N(t),V(()=>{J(n,`src`,H(k)),J(n,`alt`,H(ne))}),U(`click`,t,()=>I(k,null)),U(`click`,n,e=>e.stopPropagation()),U(`click`,r,()=>I(k,null)),G(e,t)};q(bt,e=>{H(k)&&e(xt)}),V(e=>{K(ze,t.doc.category),K(We,t.doc.title),J(qe,`title`,e),hi(qe,1,`no-print inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-gray-200 text-gray-500 transition-colors hover:bg-gray-50 hover:text-blue-600 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-blue-400 ${H(w)?`text-green-600 dark:text-green-400`:``}`),hi(Je,1,`fa-${H(w)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),U(`click`,qe,ke),G(e,M),Ke()}Nr([`click`,`mousedown`,`input`]);var qm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Jm=W(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Ym=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Xm=W(`<button class="w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="text-gray-400 shrink-0">📁</span> <span class="truncate text-gray-700 dark:text-gray-300"> </span></button>`),Zm=W(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden text-sm"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="text-xs text-gray-500 dark:text-gray-400 font-mono truncate flex-1"> </span></div> <div class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),Qm=W(`<p class="text-xs text-red-500"> </p>`),$m=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-md mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="inline-block mr-1 align-text-bottom"><path d="M2 5a2 2 0 012-2h3.586a1 1 0 01.707.293L9.707 4.707A1 1 0 0010.414 5H16a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V5z" stroke="currentColor" stroke-width="1.5" fill="none"></path><line x1="10" y1="8" x2="10" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line><line x1="7" y1="11" x2="13" y2="11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line></svg> <span> </span></h3> <div class="space-y-1.5"><label for="new-folder-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-folder-name" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex items-center gap-2"><span class="flex-1 text-sm text-gray-600 dark:text-gray-300 font-mono truncate"> </span> <button class="text-xs px-2 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0"> </button></div> <!></div> <div class="space-y-1"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 truncate"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function eh(e,t){Ge(t,!0);let n=F(``),r=F(null),i=F(null),a=F(``),o=F(``),s=F(`/ (root)`),c=F(!1),l=F(``),u=F(L([])),d=F(!1),f=F(!1),p=F(``),m=F(!1),h=F(null),g=!1;On(()=>{t.open&&!g?(g=!0,_()):t.open||(g=!1)});async function _(){try{I(n,(await fetch(`/api/config`).then(e=>e.json())).docsFolder||``,!0)}catch{I(n,``)}let e=``;if($.currentDocId){let t=decodeURIComponent($.currentDocId);if(!t.startsWith(`/`)){let n=t.split(`/`);n.length>1&&(e=n.slice(0,-1).join(`/`))}}I(a,e?H(n)+`/`+e:H(n),!0),I(r,H(a),!0),I(i,null),I(o,``),I(s,e?`/`+e:`/ (root)`,!0),I(c,!1),I(p,``),I(m,!1),setTimeout(()=>H(h)?.focus(),50)}let v=P(()=>{let e=H(o).trim();if(!e)return Y(`modal.new_folder.enter_name`);let t=H(a)||H(n),r=t.startsWith(H(n))?t.slice(H(n).length).replace(/^\//,``):``;return(r?r+`/`:``)+e});function y(){I(c,!H(c)),H(c)&&b(H(r)||H(n))}async function b(e){I(d,!0),I(f,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(r,t.current,!0),I(i,t.parent,!0),I(a,t.current,!0),I(l,t.current,!0),I(s,(t.current.startsWith(H(n)+`/`)?t.current.slice(H(n).length):t.current===H(n)?``:t.current)||`/ (root)`,!0),I(u,t.dirs||[],!0)}catch{I(f,!0),I(u,[],!0)}finally{I(d,!1)}}let x=P(()=>H(r)===H(n));function S(){H(i)&&b(H(i))}async function C(){let e=H(o).trim();if(I(p,``),!e){I(p,Y(`modal.new_folder.error_empty`),!0);return}if(!/^[a-zA-Z0-9_\-. ]+$/.test(e)){I(p,Y(`modal.new_folder.error_invalid_chars`),!0);return}let r=H(a)||H(n);if(r===H(n)&&(e===`files`||e===`images`)){I(p,Y(`modal.new_folder.error_reserved`),!0);return}let i=r.endsWith(`/`)?r+e:r+`/`+e;I(m,!0);try{let e=await fetch(`/api/browse/mkdir`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i})});if(!e.ok)throw Error(await e.text());t.onclose(),t.onsuccess()}catch(e){I(m,!1),I(p,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}}var w=Ur(),T=z(w),E=e=>{var n=$m(),r=R(n),i=R(r),a=B(R(i),2),g=R(a,!0);N(a),N(i);var _=B(i,2),w=R(_),T=R(w,!0);N(w);var E=B(w,2);Ei(E),Li(E,e=>I(h,e),()=>H(h)),N(_);var D=B(_,2),ee=R(D),O=R(ee,!0);N(ee);var te=B(ee,2),k=R(te),ne=R(k,!0);N(k);var re=B(k,2),ie=R(re,!0);N(re),N(te);var ae=B(te,2),oe=e=>{var t=Zm(),n=R(t),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),p=e=>{var t=qm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},m=e=>{var t=Jm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.error_loading`)]),G(e,t)},h=e=>{var t=Ym(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.no_subfolders`)]),G(e,t)},g=e=>{var t=Ur();$r(z(t),17,()=>H(u),e=>e.path,(e,t)=>{var n=Xm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>b(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(d)?e(p):H(f)?e(m,1):H(u).length===0?e(h,2):e(g,-1)}),N(s),N(t),V(e=>{r.disabled=H(x),K(i,e),K(o,H(l))},[()=>Y(`common.up`)]),U(`click`,r,S),G(e,t)};q(ae,e=>{H(c)&&e(oe)}),N(D);var se=B(D,2),ce=R(se),le=R(ce,!0);N(ce);var ue=B(ce,2),de=R(ue,!0);N(ue),N(se);var fe=B(se,2),pe=e=>{var t=Qm(),n=R(t,!0);N(t),V(()=>K(n,H(p))),G(e,t)};q(fe,e=>{H(p)&&e(pe)});var me=B(fe,2),he=R(me),ge=R(he,!0);N(he);var _e=B(he,2),ve=R(_e,!0);N(_e),N(me),N(r),N(n),V((e,t,n,r,i,a,o,c)=>{K(g,e),K(T,t),J(E,`placeholder`,n),K(O,r),K(ne,H(s)),K(ie,i),K(le,a),K(de,H(v)),K(ge,o),_e.disabled=H(m),K(ve,c)},[()=>Y(`modal.new_folder.title`),()=>Y(`modal.new_folder.name_label`),()=>Y(`modal.new_folder.name_placeholder`),()=>Y(`modal.new_folder.location_label`),()=>Y(`modal.new_folder.browse_btn`),()=>Y(`modal.new_folder.will_be_created`),()=>Y(`common.cancel`),()=>H(m)?Y(`modal.new_folder.creating_btn`):Y(`modal.new_folder.create_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),Mi(E,()=>H(o),e=>I(o,e)),U(`click`,re,y),U(`click`,he,function(...e){t.onclose?.apply(this,e)}),U(`click`,_e,C),G(e,n)};q(T,e=>{t.open&&e(E)}),G(e,w),Ke()}Nr([`click`]);var th=W(`<option></option>`),nh=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),rh=W(`<p class="px-3 py-4 text-xs text-red-400 text-center"> </p>`),ih=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),ah=W(`<button class="w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button>`),oh=W(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="font-mono text-xs text-gray-400 dark:text-gray-500 truncate flex-1 text-right"> </span></div> <div class="divide-y divide-gray-100 dark:divide-gray-800 max-h-40 overflow-y-auto"><!></div> <div class="border-t border-gray-200 dark:border-gray-700 flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/50"><input type="text" class="flex-1 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-400"/> <button class="text-xs px-2 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors shrink-0"> </button></div></div>`),sh=W(`<p class="text-xs text-red-500"> </p>`),ch=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-lg mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50">➕ <span> </span></h3> <div class="space-y-1.5"><label for="new-doc-title" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-title" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label for="new-doc-category" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-category" type="text" list="new-doc-category-options" autocomplete="off" placeholder="GENERAL" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <datalist id="new-doc-category-options"></datalist></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex items-center gap-2"><span class="flex-1 px-3 py-2 text-xs rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 font-mono truncate"> </span> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button></div> <!></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 font-mono text-gray-600 dark:text-gray-300 break-all"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function lh(e,t){Ge(t,!0);let n=F(``),r=F(`YYYY_MM_DD_HH_mm_[Category]_title`),i=F(null),a=F(null),o=F(``),s=F(``),c=F(``),l=F(`/ (root)`),u=F(!1),d=F(``),f=F(L([])),p=F(!1),m=F(!1),h=F(``),g=F(L([])),_=F(``),v=F(!1),y=F(null);function b(e){return(e||``).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toUpperCase().replace(/[^A-Z0-9_-]/g,``)}function x(e){let t=H(n);return e===t?``:e.startsWith(t+`/`)?e.slice(t.length+1):e}let S=!1;On(()=>{t.open&&!S?(S=!0,C()):t.open||(S=!1)});async function C(){try{let e=await fetch(`/api/config`).then(e=>e.json());I(n,e.docsFolder||``,!0),I(r,e.filenamePattern||`YYYY_MM_DD_HH_mm_[Category]_title`,!0)}catch{I(n,``),I(r,`YYYY_MM_DD_HH_mm_[Category]_title`)}let e=$.currentDocId&&$.allDocs.find(e=>e.id===$.currentDocId),t=b(e&&e.category||`General`)||`GENERAL`,d=``;if($.currentDocId){let e=decodeURIComponent($.currentDocId);if(!e.startsWith(`/`)){let t=e.split(`/`);t.length>1&&(d=t.slice(0,-1).join(`/`))}}let f=d?H(n)+`/`+d:``;I(o,d,!0),I(i,f||null,!0),I(a,null),w(),I(s,``),I(c,t,!0),I(l,d?`/`+d:`/ (root)`,!0),I(u,!1),I(h,``),I(_,``),I(v,!1),setTimeout(()=>H(y)?.focus(),50)}function w(){let e=new Set;($.allDocs||[]).forEach(t=>{let n=b(t.category||``);n&&e.add(n)}),I(g,Array.from(e).sort((e,t)=>e.localeCompare(t)),!0)}function T(){let e=b(H(c));H(c)!==e&&I(c,e,!0)}let E=P(()=>{let e=H(s).trim();if(!e)return Y(`modal.new_doc.title_placeholder`);let t=b(H(c))||`GENERAL`,n=new Date,i=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,`0`),l=String(n.getDate()).padStart(2,`0`),u=String(n.getHours()).padStart(2,`0`),d=String(n.getMinutes()).padStart(2,`0`),f=e.toLowerCase().replace(/\s+/g,`_`).replace(/[^a-z0-9_]/g,``).replace(/_+/g,`_`).replace(/^_|_$/g,``)||`document`,p=H(r).replace(`YYYY`,String(i)).replace(`MM`,a).replace(`DD`,l).replace(`HH`,u).replace(`mm`,d).replace(/\[Category\]/i,`[${t}]`).replace(/(?<![a-z0-9])(?:title_words|title)(?![a-z0-9])/i,f)+`.md`;return H(o)?H(o)+`/`+p:p});function D(){I(u,!H(u)),H(u)&&ee(H(i)||H(n))}async function ee(e){I(p,!0),I(m,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(i,t.current,!0),I(a,t.parent,!0),I(o,x(t.current),!0),I(d,t.current,!0),I(l,H(o)?`/`+H(o):`/ (root)`,!0),I(f,t.dirs||[],!0)}catch{I(m,!0),I(f,[],!0)}finally{I(p,!1)}}let O=P(()=>H(i)===H(n));function te(){H(i)!==H(n)&&H(a)&&ee(H(a))}function k(){let e=H(h).trim();if(!e)return;let t=H(i)||H(n);if(t===H(n)&&(e===`files`||e===`images`)){I(_,Y(`modal.new_folder.error_reserved`),!0);return}I(_,``);let r=(x(t)?x(t)+`/`:``)+e;I(o,r),I(l,`/`+r),I(h,``)}async function ne(){let e=H(s).trim(),n=b(H(c))||`GENERAL`;if(!e){I(_,Y(`modal.new_doc.error_empty_title`),!0);return}I(_,``),I(v,!0);try{let r=await fetch(`/api/documents`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,category:n,folder:H(o)})});if(!r.ok){let e=await r.json();throw Error(e.error||`Creation failed`)}let i=await r.json();t.onclose(),t.onsuccess(i.id)}catch(e){I(_,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e))),I(v,!1)}}function re(e){e.key===`Enter`&&ne(),e.key===`Escape`&&t.onclose()}var ie=Ur(),ae=z(ie),oe=e=>{var n=ch(),r=R(n),i=R(r),a=B(R(i)),o=R(a,!0);N(a),N(i);var b=B(i,2),x=R(b),S=R(x,!0);N(x);var C=B(x,2);Ei(C),Li(C,e=>I(y,e),()=>H(y)),N(b);var w=B(b,2),ie=R(w),ae=R(ie,!0);N(ie);var oe=B(ie,2);Ei(oe);var se=B(oe,2);$r(se,20,()=>H(g),e=>e,(e,t)=>{var n=th(),r={};V(()=>{r!==(r=t)&&(n.value=(n.__value=t)??``)}),G(e,n)}),N(se),N(w);var ce=B(w,2),le=R(ce),ue=R(le,!0);N(le);var de=B(le,2),fe=R(de),pe=R(fe,!0);N(fe);var me=B(fe,2),he=B(R(me)),ge=R(he,!0);N(he),N(me),N(de);var _e=B(de,2),ve=e=>{var t=oh(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),l=e=>{var t=nh(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},u=e=>{var t=rh(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.cannot_read_dir`)]),G(e,t)},g=e=>{var t=ih(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_doc.no_subfolders`)]),G(e,t)},_=e=>{var t=Ur();$r(z(t),17,()=>H(f),e=>e.path,(e,t)=>{var n=ah(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>ee(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(p)?e(l):H(m)?e(u,1):H(f).length===0?e(g,2):e(_,-1)}),N(s);var v=B(s,2),y=R(v);Ei(y);var b=B(y,2),x=R(b,!0);N(b),N(v),N(t),V((e,t,n)=>{r.disabled=H(O),K(i,`↑ ${e??``}`),K(o,H(d)),J(y,`placeholder`,t),K(x,n)},[()=>Y(`common.up`),()=>Y(`modal.new_doc.new_folder_placeholder`),()=>Y(`modal.new_doc.create_folder_btn`)]),U(`click`,r,te),U(`keydown`,y,e=>{e.key===`Enter`&&k()}),Mi(y,()=>H(h),e=>I(h,e)),U(`click`,b,k),G(e,t)};q(_e,e=>{H(u)&&e(ve)}),N(ce);var ye=B(ce,2),be=R(ye),xe=R(be,!0);N(be);var Se=B(be,2),Ce=R(Se,!0);N(Se),N(ye);var we=B(ye,2),Te=e=>{var t=sh(),n=R(t,!0);N(t),V(()=>K(n,H(_))),G(e,t)};q(we,e=>{H(_)&&e(Te)});var A=B(we,2),Ee=R(A),De=R(Ee,!0);N(Ee);var Oe=B(Ee,2),ke=R(Oe,!0);N(Oe),N(A),N(r),N(n),V((e,t,n,r,i,a,s,c,u)=>{K(o,e),K(S,t),J(C,`placeholder`,n),K(ae,r),K(ue,i),K(pe,H(l)),K(ge,a),K(xe,s),K(Ce,H(E)),K(De,c),Oe.disabled=H(v),K(ke,u)},[()=>Y(`modal.new_doc.title`),()=>Y(`modal.new_doc.title_label`),()=>Y(`modal.new_doc.title_placeholder`),()=>Y(`modal.new_doc.category_label`),()=>Y(`modal.new_doc.location_label`),()=>Y(`modal.new_doc.browse_btn`),()=>Y(`modal.new_doc.filename_label`),()=>Y(`common.cancel`),()=>H(v)?Y(`modal.new_folder.creating_btn`):Y(`common.create`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),U(`keydown`,C,re),Mi(C,()=>H(s),e=>I(s,e)),U(`input`,oe,T),U(`keydown`,oe,re),Mi(oe,()=>H(c),e=>I(c,e)),U(`click`,me,D),U(`click`,Ee,function(...e){t.onclose?.apply(this,e)}),U(`click`,Oe,ne),G(e,n)};q(ae,e=>{t.open&&e(oe)}),G(e,ie),Ke()}Nr([`click`,`keydown`,`input`]);var uh=W(`<p class="text-sm text-gray-400 py-2"> </p>`),dh=W(`<p class="text-sm text-red-500"> </p>`),fh=W(`<label class="flex items-center gap-3 px-1 py-1.5 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"/> <span class="text-sm text-gray-700 dark:text-gray-300"> </span></label>`),ph=W(`<div><div class="max-h-48 overflow-y-auto space-y-0.5 border border-gray-200 dark:border-gray-700 rounded-lg p-2"><!></div></div>`),mh=W(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),hh=W(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg border border-blue-500 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 font-semibold transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),gh=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-file-export mr-2 text-blue-500"></i> <span> </span></h3> <div class="flex gap-0 border-b border-gray-200 dark:border-gray-700"><button> </button> <button> </button> <button> </button></div> <!> <!> <!> <!></div></div>`);function _h(e,t){Ge(t,!0);let n=F(`markdown`),r=!1,i=F(!1),a=F(!1),o=F(L([])),s=F(L({})),c=F(!1),l=F(!1),u=F(!1),d=F(!1),f=!1;On(()=>{t.open&&!f?(f=!0,I(n,`markdown`),r=!1,I(o,[],!0),I(s,{},!0)):t.open||(f=!1)});function p(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function m(e){I(n,e,!0),e===`html`&&h()}async function h(){if(!r){I(i,!0),I(a,!1);try{let e=await fetch(`/api/documents`).then(e=>e.json()),t=new Set;e.forEach(e=>t.add(e.folder?.[0]??e.category??`General`)),I(o,[...t].sort((e,t)=>e===`General`?-1:t===`General`?1:e.localeCompare(t)),!0),r=!0}catch{I(a,!0)}finally{I(i,!1)}}}async function g(){I(c,!0);try{let e=await fetch(`/api/export/markdown`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok)throw Error(await e.text());let n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`export-markdown.zip`,i.click(),URL.revokeObjectURL(r),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{I(c,!1)}}async function _(e){let n=H(o).filter(e=>H(s)[e]);if(n.length){I(e===`confluence`?u:l,!0);try{let r=await fetch(`/api/export/html`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folders:n,mode:e})});if(!r.ok)throw Error(await r.text());let i=await r.blob(),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`export-${e}.zip`,o.click(),URL.revokeObjectURL(a),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{I(u,!1),I(l,!1)}}}async function v(){I(d,!0);try{let e=$.allDocs&&$.allDocs.length?$.allDocs:await fetch(`/api/documents`).then(e=>e.json()),n={};for(let t=0;t<e.length;t+=5){let r=e.slice(t,t+5),i=await Promise.all(r.map(e=>fetch(`/api/documents/`+e.id).then(e=>e.ok?e.json():null).catch(()=>null)));for(let r of i)r&&(n[r.id??e[t]?.id]=r);r.forEach((e,t)=>{i[t]&&(n[e.id]=i[t])})}function r(e){let t={categories:{},children:{}};for(let n of e){let e=t;for(let t of n.folder||[])e.children[t]||(e.children[t]={categories:{},children:{}}),e=e.children[t];e.categories[n.category]||(e.categories[n.category]=[]),e.categories[n.category].push(n)}return t}function i(e){let t=[];e.categories.General&&t.push(...e.categories.General);let n=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let r of n)t.push(...i(e.children[r]));let r=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let n of r)t.push(...e.categories[n]);return t}function a(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function o(e,t){let n=``,r=t*1.25,i=(e,i)=>{let a=t===0&&e===`General`?`General`:e;n+=`<li style="margin-left:${r}rem;margin-top:${t===0?`0.75`:`0.4`}rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280;">${a}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`;for(let e of i)n+=`<li style="margin-left:${r+.75}rem;padding:0.15rem 0;">`,n+=`<a href="#doc-${e.id}" style="color:#1d4ed8;text-decoration:none;font-size:0.875rem;">${p(e.title)}</a>`,e.formattedDate&&(n+=`<span style="color:#9ca3af;font-size:0.7rem;margin-left:0.5rem;">${p(e.formattedDate)}</span>`),n+=`</li>`;n+=`</ul></li>`};e.categories.General&&i(`General`,e.categories.General);let s=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let i of s)n+=`<li style="margin-left:${r}rem;margin-top:0.75rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#7c3aed;">📁 ${a(i)}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`,n+=o(e.children[i],t+1),n+=`</ul></li>`;let c=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let t of c)i(t,e.categories[t]);return n}function s(e){return e.replace(/href="[^"]*\?doc=([^"&#]+)(?:#[^"]*)?"/g,(e,t)=>`href="#doc-${t}"`)}let c=p(document.title||`Living Documentation`),l=r(e),u=i(l),d=`<!DOCTYPE html>
|
|
92
92
|
<html>
|
|
93
93
|
<head>
|
|
94
94
|
<meta charset="UTF-8">
|
|
@@ -131,13 +131,13 @@ Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link
|
|
|
131
131
|
setTimeout(() => window.print(), 800);
|
|
132
132
|
<\/script>
|
|
133
133
|
</body>
|
|
134
|
-
</html>`,f=window.open(``,`_blank`);if(!f){alert(Y(`error.pdf_popup`));return}f.document.write(d),f.document.close(),t.onclose()}catch(e){alert(Y(`error.pdf_export`)+(e instanceof Error?e.message:String(e)))}finally{I(d,!1)}}let y=`px-4 py-2 text-sm border-b-2 border-blue-500 text-blue-600 dark:text-blue-400 font-semibold transition-colors`,b=`px-4 py-2 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors`;var x=Ur(),S=z(x),C=e=>{var r=th(),f=R(r),p=R(f),h=B(R(p),2),x=R(h,!0);N(h),N(p);var S=B(p,2),C=R(S),w=R(C,!0);N(C);var T=B(C,2),E=R(T,!0);N(T);var D=B(T,2),ee=R(D,!0);N(D),N(S);var O=B(S,2),te=e=>{var t=Qm(),n=R(t),r=R(n),c=e=>{var t=Ym(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},l=e=>{var t=Xm(),n=R(t);N(t),V(e=>K(n,`${e??``}failed to load folders`),[()=>Y(`common.error_prefix`)]),G(e,t)},u=e=>{var t=Ur();$r(z(t),16,()=>H(o),e=>e,(e,t)=>{var n=Zm(),r=R(n);Ei(r);var i,a=B(r,2),o=R(a,!0);N(a),N(n),V(()=>{i!==(i=t)&&(r.value=(r.__value=t)??``),K(o,t)}),Ni(r,()=>H(s)[t],e=>H(s)[t]=e),G(e,n)}),G(e,t)};q(r,e=>{H(i)?e(c):H(a)?e(l,1):e(u,-1)}),N(n),N(t),G(e,t)};q(O,e=>{H(n)===`html`&&e(te)});var k=B(O,2),ne=e=>{var n=$m(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var l=B(o,2),u=R(l,!0);N(l),N(a),N(n),V((e,t,n)=>{K(i,e),K(s,t),l.disabled=H(c),K(u,n)},[()=>Y(`modal.export.markdown_hint`),()=>Y(`common.cancel`),()=>H(c)?`⏳`:Y(`modal.export.markdown_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,l,g),G(e,n)};q(k,e=>{H(n)===`markdown`&&e(ne)});var re=B(k,2),ie=e=>{var n=eh(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2),d=R(c,!0);N(c);var f=B(c,2),p=R(f,!0);N(f),N(a),N(n),V((e,t,n,r)=>{K(i,e),K(s,t),c.disabled=H(l),K(d,n),f.disabled=H(u),K(p,r)},[()=>Y(`modal.export_html.hint`),()=>Y(`common.cancel`),()=>H(l)?`⏳`:Y(`modal.export_html.notion_btn`),()=>H(u)?`⏳`:Y(`modal.export_html.confluence_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,c,()=>_(`notion`)),U(`click`,f,()=>_(`confluence`)),G(e,n)};q(re,e=>{H(n)===`html`&&e(ie)});var ae=B(re,2),oe=e=>{var n=$m(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2),l=R(c,!0);N(c),N(a),N(n),V((e,t,n)=>{K(i,e),K(s,t),c.disabled=H(d),K(l,n)},[()=>Y(`modal.export.pdf_hint`),()=>Y(`common.cancel`),()=>H(d)?`⏳`:Y(`modal.export.pdf_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,c,v),G(e,n)};q(ae,e=>{H(n)===`pdf`&&e(oe)}),N(f),N(r),V((e,t,r,i)=>{K(x,e),hi(C,1,li(H(n)===`markdown`?y:b)),K(w,t),hi(T,1,li(H(n)===`html`?y:b)),K(E,r),hi(D,1,li(H(n)===`pdf`?y:b)),K(ee,i)},[()=>Y(`modal.export.title`),()=>Y(`modal.export.tab_markdown`),()=>Y(`modal.export.tab_html`),()=>Y(`modal.export.tab_pdf`)]),U(`click`,r,e=>{e.target===e.currentTarget&&t.onclose()}),U(`click`,C,()=>m(`markdown`)),U(`click`,T,()=>m(`html`)),U(`click`,D,()=>m(`pdf`)),G(e,r)};q(S,e=>{t.open&&e(C)}),G(e,x),Ke()}Nr([`click`]);var rh=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),ih=W(`<p> </p>`),ah=W(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),oh=W(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-gray-500 dark:text-gray-400"><span class="shrink-0 opacity-40">📄</span> <span class="truncate font-mono"> </span></span> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),sh=W(`<div class="border-t border-gray-200 dark:border-gray-700"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0">↑ Up</button> <span class="font-mono text-xs text-gray-400 dark:text-gray-500 truncate flex-1 text-right"> </span></div> <div class="divide-y divide-gray-100 dark:divide-gray-800 max-h-52 overflow-y-auto"><!></div></div>`),ch=W(`<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 cursor-pointer"><input type="checkbox"/> </label>`),lh=W(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Exclude this folder" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 px-3 py-2 text-sm transition-opacity">⊖</button></div>`),uh=W(`<button class="w-full px-3 py-2 text-xs text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/30 text-left font-medium border-t border-gray-100 dark:border-gray-800">✓ Select: <span class="font-mono"> </span></button>`),dh=W(`<!> <!>`,1),fh=W(`<div> </div>`),ph=W(`<div> </div> <div> </div> <div> </div> <!>`,1),mh=W(`<div role="button" tabindex="0" class="flex items-center gap-2 px-3 py-1 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors"><span class="text-gray-400 dark:text-gray-600 w-5 text-right shrink-0 tabular-nums text-xs"></span> <div class="flex-1 min-w-0"><div class="flex items-center justify-between gap-1"><span class="text-gray-800 dark:text-gray-200 font-medium truncate text-xs"> </span> <span class="text-gray-400 dark:text-gray-600 tabular-nums shrink-0 text-xs"> </span></div> <div class="h-1 bg-gray-100 dark:bg-gray-800 rounded-full mt-0.5"><div class="h-1 bg-blue-400 dark:bg-blue-600 rounded-full"></div></div></div></div>`),hh=W(`<div class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400 space-y-0.5 border-b border-gray-100 dark:border-gray-800"><!></div> <div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center gap-2"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0 cursor-help"> </span> <input type="number" min="1" max="20" class="w-12 px-1.5 py-0.5 text-xs rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-800 dark:text-gray-200 focus:outline-none"/> <button class="text-xs text-blue-600 dark:text-blue-400 hover:underline"> </button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto"></div></div>`),gh=W(`<p class="absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-sm animate-pulse"> </p>`),_h=W(`<div class="flex items-center gap-1 group py-0.5"><span class="text-gray-600 dark:text-gray-400 break-all font-mono flex-1 text-xs"> </span> <button title="Exclude this file" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 text-xs leading-none px-1 transition-opacity">⊖</button></div>`),vh=W(`<div class="text-gray-400 text-center py-2">—</div>`),yh=W(`<div class="w-80 shrink-0 border-l border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between"><span class="font-bold text-sm text-gray-900 dark:text-gray-100"> </span> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-xs leading-none">✕</button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto px-3 py-1 space-y-1 text-xs"><!></div></div>`),bh=W(`<div class="fixed inset-0 z-50 flex flex-col bg-white dark:bg-gray-950"><div class="flex items-center justify-between px-6 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><h2 class="font-semibold text-base"> </h2> <button class="text-sm px-3 py-1.5 rounded-lg text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"> </button></div> <div class="border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><div class="flex items-center gap-3 px-6 py-3"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </label> <input type="text" readonly="" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono cursor-default focus:outline-none"/> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors shrink-0"> </button></div> <div class="flex items-start gap-3 px-6 pb-2"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0 pt-1.5"> </label> <textarea rows="3" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-1 focus:ring-blue-400 resize-y"></textarea> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button></div> <!> <div class="flex items-center gap-x-4 gap-y-2 px-6 pb-3 flex-wrap"><span class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </span> <label class="flex items-center gap-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 cursor-pointer shrink-0"><input type="checkbox"/> </label> <!></div> <!></div> <div class="flex-1 overflow-hidden flex"><!> <div class="flex-1 relative overflow-hidden"><!> <canvas style="position: absolute; inset: 0"></canvas></div> <!></div></div>`);function xh(e,t){Ge(t,!0);let n=new Set(`the.a.an.and.or.but.not.nor.so.yet.both.either.neither.is.are.was.were.be.been.being.have.has.had.do.does.did.will.would.shall.should.may.might.can.could.must.need.dare.ought.used.to.of.in.for.on.with.at.by.from.up.about.into.through.during.before.after.above.below.between.out.off.over.under.again.further.then.once.here.there.when.where.why.how.all.each.few.more.most.other.some.such.no.only.own.same.than.too.very.just.also.still.already.always.never.often.sometimes.usually.this.that.these.those.its.your.our.their.his.her.him.she.you.they.we.me.my.it.who.which.what.whose.whom.if.though.although.because.since.while.unless.until.whether.as.like.via.per.i.am.he.us.see.now.new.old.got.let.put.say.said.says.get.use.make.made.take.come.came.go.went.know.think.look.want.give.seem.back.down.even.much.well.good.work.tell.keep.hold.turn.move.play.live.help.run.start.off.way.too.few.show.hear.etc.eg.ie.one.two.three.four.five.six.seven.eight.nine.ten.le.la.les.un.une.des.du.de.d.l.au.aux.ce.ci.cet.cette.ces.mon.ma.mes.ton.ta.tes.son.sa.ses.notre.nos.votre.vos.leur.leurs.je.tu.il.elle.on.nous.vous.ils.elles.me.te.se.lui.y.en.qui.que.quoi.dont.où.et.ou.mais.donc.or.ni.car.si.ne.pas.plus.moins.très.bien.mal.peu.beaucoup.trop.assez.aussi.comme.pour.par.avec.sans.dans.sur.sous.entre.vers.chez.contre.avant.après.pendant.depuis.selon.malgré.sauf.est.sont.était.être.avoir.fait.faire.dit.dire.peut.pouvoir.doit.devoir.veut.vouloir.sait.savoir.va.aller.vient.venir.tout.tous.toute.toutes.autre.autres.même.chaque.quel.quelle.quels.quelles.aucun.aucune.certain.certaine.plusieurs.quelque.quelques.tel.telle.tels.telles.cela.ceci.ça.celui.celle.ceux.celles.ici.voici.voilà.alors.ainsi.encore.déjà.jamais.toujours.souvent.parfois.rien.personne.chose.fois.jour.temps.part.cas.point.lieu.monde.cependant.néanmoins.pourtant.toutefois.quand.lorsque.puisque.parce.afin.puis.lors.notamment.surtout.seulement.vraiment.enfin.ensuite.ailleurs.là.ici.voici.voilà.dont.lequel.laquelle.lesquels.lesquelles`.split(`.`)),r=new Set(`public.private.protected.static.void.class.interface.abstract.final.const.let.var.function.return.if.else.for.while.do.switch.case.break.continue.try.catch.throw.throws.finally.new.this.self.super.import.export.from.package.module.require.include.using.namespace.struct.enum.trait.impl.fn.def.func.fun.val.mut.async.await.yield.lambda.extends.implements.override.virtual.sealed.data.object.companion.where.when.match.guard.defer.go.chan.select.type.alias.as.is.in.of.with.true.false.null.nil.none.undefined.println.printf.fmt.log.print.main.args.argv.init.setup.teardown.describe.test.expect.assert.before.after.not.and.or.delete.typeof.instanceof.readonly.keyof.infer.never.unknown.declare.satisfies.get.set.add.remove.update.create.find.fetch.load.save.put.post.patch.list.map.filter.reduce.sort.merge.parse.format.convert.transform.validate.check.handle.process.execute.start.stop.reset.clear.close.open.read.write.send.receive.emit.trigger.dispatch.subscribe.unsubscribe.listen.notify.register.unregister.bind.apply.call.invoke.callback.handler.listener.middleware.interceptor.resolver.provider.consumer.producer.builder.factory.adapter.wrapper.proxy.decorator.observer.visitor.strategy.command.controller.service.repository.dao.dto.entity.model.schema.config.context.state.store.action.reducer.selector.hook.ref.effect.memo.component.module.plugin.extension.util.utils.helper.helpers.common.shared.base.default.index.app.core.lib.src.test.spec.mock.stub.fixture.impl.internal.api.sdk.client.server.request.response.status.code.error.exception.message.result.data.value.key.name.label.title.description.item.element.node.child.parent.root.container.wrapper.layout.view.page.screen.panel.header.footer.sidebar.navbar.body.content.section.row.col.column.grid.flex.block.inline.span.div.input.output.param.params.arg.option.options.props.attr.attrs.field.fields.property.properties.method.methods.string.number.boolean.integer.float.double.long.short.byte.char.array.object.map.set.list.vector.queue.stack.hash.table.tree.graph.pair.tuple.optional.nullable.void.unit.any.bool.bytes.none.int.str.bool.all.each.every.some.many.single.multi.first.last.next.prev.previous.current.old.temp.tmp.new.top.bottom.left.right.center.middle.start.end.begin.min.max.count.total.sum.avg.size.length.width.height.depth.flag.num.idx.id.uid.uuid.num.str.val.obj.arr.fn.cb.ctx.req.res.err.msg.src.dst.evt.doc.db.io.fs.os.env.sys.http.https.url.uri.path.port.host.tcp.udp.ssl.tls.html.css.json.xml.yml.yaml.csv.sql.regex.utf.ascii.rgb.rgba.hex.px.em.rem.vh.vw.auto.inherit.initial.application.file.local.source.messages.logging.alerting.programmed.offset.offsets.zone.zoned.decimal.big.integer.constructor.mapper.captor.publisher.verify.subscriber.org.edr.ack.ref.ssr.ssg.csr.isr.mockito.junit.vitest.jest.mocha.rspec.pytest.cypress.playwright.captor.spy.given.then.verify.times.never.invocation.argumentcaptor.inorder.donothing.doreturn.ippon.springframework.jakarta.javax.todo.fixme.hack.note.deprecated.experimental.eslint.prettier.typescript.javascript.java.kotlin.python.golang.rust.csharp.swift.ruby.spring.boot.javax.jakarta.hibernate.lombok.gradle.maven.webpack.vite.react.angular.vue.svelte.nuxt.express.fastapi.flask.django.rails.fiber.gin.actix.tokio.asyncio.junit.jest.mocha.pytest.rspec.docker.kubernetes.aws.gcp.azure.terraform.ansible.nginx.apache.linux.nextjs.remix.astro.sveltekit.gatsby.nuxtjs.qwik.solid.vercel.netlify.cloudflare.supabase.firebase.mongodb.postgres.prisma.drizzle.typeorm.sequelize.mongoose.redis.neon.trpc.graphql.grpc.rest.openapi.swagger.zod.yup.valibot.tailwind.shadcn.radix.headless.chakra.mantine.antd.mui.tanstack.tanstackquery.zustand.jotai.recoil.redux.mobx.storybook.cypress.playwright.vitest.turbopack.turborepo.getserversideprops.getstaticprops.getstaticpaths.generatestaticparams.generatemetadata.serveraction.revalidate.notfound.redirect.permanentredirect.unstablecache.unstablenostore.cookies.headers.userouter.usepathname.usesearchparams.useparams.useformstate.useformstatus.useoptimistic.useserveraction.classname.onclick.onchange.onsubmit.onfocus.onblur.onkeydown.onkeyup.onmousedown.onmouseup.defaultvalue.htmlfor.tabindex.strokewidth.viewbox.fillopacity.strokeopacity.pathdata.children.fragment.portal.suspense.errorboundary.strictmode.createelement.createcontext.createref.forwardref.usestate.useeffect.useref.usecontext.usememo.usecallback.usereducer.useid.usetransition.usedeferredvalue.useimperativehandle.mutex.lock.thread.goroutine.coroutine.channel.buffer.stream.pipe.observable.promise.future.completable.deferred.disposable.lifecycle.scope.annotation.attribute.metadata.reflection.generic.template.macro.preprocessor.compiler.runtime.debug.release.production.development.staging.build.deploy.lint.coverage.report.the.and.for.are.but.not.you.all.this.that.with.have.from.they.will.been.can.has.was.its.our.their.more.also.when.what.about.which.would.into.than.then.each.just.over.after.such.here.some.were.very.only`.split(`.`));function i(e){return n.has(e)||r.has(e)||e.length<3||/^\d+$/.test(e)||/^[^a-z]/.test(e)}function a(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).replace(/[_\-./]+/g,` `).toLowerCase().trim().split(/\s+/).filter(e=>e.length>=3)}function o(e){return e.toLowerCase().split(/[^a-zàâäéèêëïîôùûü]+/).filter(e=>e.length>=3)}let s=[{value:`adoc`,cat:`prose`},{value:`asciidoc`,cat:`prose`},{value:`asm`,cat:`code`},{value:`astro`,cat:`code`},{value:`avsc`,cat:`config`},{value:`bash`,cat:`code`},{value:`bat`,cat:`code`},{value:`bicep`,cat:`config`},{value:`c`,cat:`code`},{value:`cc`,cat:`code`},{value:`cfg`,cat:`config`},{value:`cjs`,cat:`code`},{value:`clj`,cat:`code`},{value:`cljs`,cat:`code`},{value:`cmake`,cat:`code`},{value:`cmd`,cat:`code`},{value:`conf`,cat:`config`},{value:`cpp`,cat:`code`},{value:`cql`,cat:`code`},{value:`cs`,cat:`code`},{value:`cshtml`,cat:`code`},{value:`css`,cat:`config`},{value:`cxx`,cat:`code`},{value:`dart`,cat:`code`},{value:`env`,cat:`config`},{value:`erb`,cat:`code`},{value:`erl`,cat:`code`},{value:`ex`,cat:`code`},{value:`exs`,cat:`code`},{value:`fish`,cat:`code`},{value:`fs`,cat:`code`},{value:`fsx`,cat:`code`},{value:`go`,cat:`code`},{value:`gql`,cat:`code`},{value:`gradle`,cat:`code`},{value:`graphql`,cat:`code`},{value:`groovy`,cat:`code`},{value:`h`,cat:`code`},{value:`hcl`,cat:`config`},{value:`hpp`,cat:`code`},{value:`hs`,cat:`code`},{value:`html`,cat:`config`},{value:`ini`,cat:`config`},{value:`java`,cat:`code`},{value:`jl`,cat:`code`},{value:`js`,cat:`code`},{value:`json`,cat:`config`},{value:`jsx`,cat:`code`,jsx:!0},{value:`kt`,cat:`code`},{value:`less`,cat:`config`},{value:`lua`,cat:`code`},{value:`m`,cat:`code`},{value:`md`,cat:`prose`,def:!0},{value:`mdx`,cat:`prose`},{value:`mjs`,cat:`code`},{value:`mk`,cat:`code`},{value:`ml`,cat:`code`},{value:`mli`,cat:`code`},{value:`mm`,cat:`code`},{value:`nim`,cat:`code`},{value:`php`,cat:`code`},{value:`pl`,cat:`code`},{value:`prisma`,cat:`code`},{value:`properties`,cat:`config`},{value:`proto`,cat:`code`},{value:`ps1`,cat:`code`},{value:`py`,cat:`code`},{value:`r`,cat:`code`},{value:`razor`,cat:`code`},{value:`rb`,cat:`code`},{value:`rs`,cat:`code`},{value:`rst`,cat:`prose`},{value:`s`,cat:`code`},{value:`scala`,cat:`code`},{value:`scss`,cat:`config`},{value:`sh`,cat:`code`},{value:`sol`,cat:`code`},{value:`sql`,cat:`code`},{value:`styl`,cat:`config`},{value:`svelte`,cat:`code`},{value:`swift`,cat:`code`},{value:`tex`,cat:`prose`},{value:`tf`,cat:`config`},{value:`tfvars`,cat:`config`},{value:`thrift`,cat:`code`},{value:`toml`,cat:`config`},{value:`ts`,cat:`code`},{value:`tsx`,cat:`code`,jsx:!0},{value:`txt`,cat:`prose`},{value:`v`,cat:`code`},{value:`vb`,cat:`code`},{value:`vue`,cat:`code`},{value:`xml`,cat:`config`},{value:`yaml`,cat:`config`},{value:`yml`,cat:`config`},{value:`zig`,cat:`code`},{value:`zsh`,cat:`code`}],c=new Set(s.filter(e=>e.cat===`prose`).map(e=>e.value)),l=new Set(s.filter(e=>e.cat===`code`).map(e=>e.value)),u=new Set(s.filter(e=>e.cat===`config`).map(e=>e.value)),d=new Set(s.filter(e=>e.jsx).map(e=>e.value));function f(e,t){let n=[];if(c.has(t)){let t=e.replace(/^\s*(import|export\s+\{[^}]*\}|export\s+\*|package|require|#include|from\s+['"][^'"]+['"]\s*(import)?)\b.*/gm,``).replace(/```[\s\S]*?```/g,` `).replace(/`[^`\n]+`/g,` `).replace(/!\[[^\]]*\]\([^)]*\)/g,` `).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/https?:\/\/\S+/g,` `).replace(/[#*_~>`|!\[\](){}=+\-]/g,` `);n.push(...o(t))}else l.has(t)?(d.has(t)&&(e=e.replace(/<\/?[A-Z][A-Za-z0-9.]*[^>]*>/g,` `),e=e.replace(/<\/?(div|span|main|section|article|aside|nav|header|footer|form|input|button|select|option|textarea|table|thead|tbody|tr|td|th|ul|ol|li|a|img|p|h[1-6]|label|figure|figcaption|picture|video|audio|canvas|svg|path|circle|rect|g|defs|use|link|meta|head|html|body|script|style|br|hr|strong|em|code|pre|blockquote|small|sub|sup)\b[^>]*>/gi,` `),e=e.replace(/\b(className|onClick|onChange|onSubmit|onFocus|onBlur|onKeyDown|onKeyUp|onMouseDown|onMouseUp|htmlFor|tabIndex|strokeWidth|viewBox|fillOpacity|strokeOpacity|defaultValue|placeholder|disabled|checked|readOnly|required|multiple|autoFocus|autoComplete|type|href|src|alt|width|height|style|key|ref)\s*=/g,` =`)),e=e.replace(/^\s*(import\s+[\w.*{},\s'"@/-]+;?|from\s+['"][^'"]+['"]\s*;?|package\s+[\w.]+;?|namespace\s+[\w.]+;?|using\s+[\w.]+;?|require\s*\(?\s*['"][^'"]+['"]\s*\)?;?)\s*$/gm,``),e.replace(/(?:\/\/|#(?!.*[{}[\]<>])| -- )\s*(.+)$/gm,(e,t)=>(n.push(...o(t)),e)),e.replace(/\/\*[\s\S]*?\*\//g,e=>(n.push(...o(e)),e)),e.replace(/"""[\s\S]*?"""|'''[\s\S]*?'''/g,e=>(n.push(...o(e)),e)),e.replace(/["'`]([A-Za-zÀ-ÿ][A-Za-zÀ-ÿ\s,.'éàèùâêîôûç]{3,})["'`]/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e))):u.has(t)&&(e.replace(/:\s*["']([^"']{3,})["']/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e)));return n.filter(e=>!i(e))}let p=F(``),m=F(``),h=F(1),g=F(``),_=F(!0),v=F(!1),y=F(L(s.map(e=>({value:e.value,label:`.`+e.value,checked:!!e.def}))));function b(){return H(y).filter(e=>e.checked).map(e=>e.value)}let x=P(()=>H(y).every(e=>e.checked)),S=F(null),C=F(null),w=F(0),T=F(null),E=F(L([])),D=F(L([])),ee=F(!1),O=F(``),te=F(0),k=F(L([]));function ne(){localStorage.setItem(`wc-exts`,JSON.stringify(b()))}function re(){let e=H(x);I(y,H(y).map(t=>({...t,checked:!e})),!0),ne()}function ie(){ne()}function ae(){return new Set((H(m)||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean))}function oe(e){let t=ae();t.has(e)||(t.add(e),I(m,[...t].join(`, `),!0),localStorage.setItem(`wc-exclude`,H(m)),H(de)&&ve(H(pe)),ce())}function se(){localStorage.setItem(`wc-exclude`,H(m)),H(de)&&ve(H(pe)),ce()}function ce(){H(ee)&&H(O)&&M(H(O))}function le(){H(S)&&je()}function ue(){let e=localStorage.getItem(`wc-root`);e&&(I(p,e,!0),I(Se,e,!0));let t=localStorage.getItem(`wc-exclude`);t&&I(m,t,!0);let n=localStorage.getItem(`wc-exts`);if(n)try{let e=JSON.parse(n);I(y,H(y).map(t=>({...t,checked:e.includes(t.value)})),!0)}catch{}}let de=F(!1),fe=F(null),pe=F(``),me=F(``),he=F(null),ge=F(``);function _e(){I(de,!H(de)),H(de)&&ve(H(pe)||H(p)||`/`)}async function ve(e){I(he,null),I(ge,`Loading…`);try{let t=await fetch(`/api/browse?all=1&path=`+encodeURIComponent(e)).then(e=>e.json());I(pe,t.current,!0),I(fe,t.parent,!0),I(me,t.current,!0);let n=H(p).trim(),r=(e,t)=>n&&e.startsWith(n+`/`)?e.slice(n.length+1):t,i=ae(),a=(t.dirs||[]).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`dir`,name:e.name,path:e.path,entry:r(e.path,e.name)})),o=b(),s=(t.files||[]).filter(e=>o.some(t=>e.name.endsWith(`.`+t))).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`file`,name:e.name,entry:r(e.path,e.name)})),c=[...a,...s];I(he,c,!0),I(ge,c.length?``:`Empty directory`,!0)}catch{I(he,[],!0),I(ge,`Cannot read directory`)}}function ye(){H(fe)&&ve(H(fe))}let be=F(!1),xe=F(null),Se=F(``),Ce=F(``),we=F(null),Te=F(``);function A(){I(be,!H(be)),H(be)&&Ee(H(Se)||H(p)||`/`)}async function Ee(e){I(we,null),I(Te,`Loading…`);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(Se,t.current,!0),I(xe,t.parent,!0),I(Ce,t.current,!0),I(we,(t.dirs||[]).map(e=>({name:e.name,path:e.path})),!0),I(Te,H(we).length?``:`No sub-folders`,!0)}catch{I(we,[],!0),I(Te,`Cannot read directory`)}}function De(){H(xe)&&Ee(H(xe))}function Oe(){I(p,H(Se),!0),localStorage.setItem(`wc-root`,H(Se)),I(be,!1),I(m,``),localStorage.removeItem(`wc-exclude`),I(pe,H(Se),!0)}let ke=F(null),Ae=F(null),j=F(!1);function je(){if(!H(S)||!H(C))return;let e=Math.max(1,H(h)||1),t=[...H(S).entries()].sort((e,t)=>t[1]-e[1]),n=t.filter(([t])=>(H(C).get(t)||new Set).size>=e).slice(0,150);if(!n.length){let n=t.length;I(g,n?`${n} domain word(s) found but none appear in ${e}+ file(s). Lower the "Min files" threshold to 1.`:`No domain words extracted. Try adding more file extensions or a broader folder.`,!0),I(_,!0),I(j,!1),I(v,!1);return}let r=[...H(S).keys()].filter(t=>(H(C).get(t)||new Set).size>=e).length;I(T,{scanned:H(w),unique:r,shown:n.length},!0);let i=n.slice(0,50),a=i[0][1];I(D,i.map(([e,t])=>({word:e,freq:t,pct:Math.round(t/a*100)})),!0),I(v,!0),I(_,!1);let o=document.documentElement.classList.contains(`dark`),s=o?[`#60a5fa`,`#34d399`,`#f9a8d4`,`#a78bfa`,`#fbbf24`,`#6ee7b7`,`#93c5fd`,`#fb923c`,`#4ade80`,`#f472b6`]:[`#1d4ed8`,`#047857`,`#7c3aed`,`#b45309`,`#be123c`,`#0369a1`,`#4338ca`,`#c2410c`,`#15803d`,`#9333ea`];requestAnimationFrame(()=>{if(!H(ke)||!H(Ae))return;let e=H(ke),t=H(Ae);e.width=Math.max(400,t.offsetWidth),e.height=Math.max(300,t.offsetHeight),e.style.width=e.width+`px`,e.style.height=e.height+`px`,I(j,!0);let n=Math.sqrt(e.width*e.height/(800*500)),r=Math.min(220,Math.round(72*n)),c=i.map(([e,t])=>[e,Math.max(12,Math.round(r*t/a))]);window.WordCloud?.(e,{list:c,gridSize:Math.round(4*e.width/1024),fontFamily:`ui-sans-serif, system-ui, sans-serif`,color:()=>s[Math.floor(Math.random()*s.length)],backgroundColor:o?`#030712`:`#ffffff`,rotateRatio:.2,minSize:6,shrinkToFit:!0,click:e=>M(e[0])})})}function M(e){if(!H(C)||!H(S))return;let t=[...H(C).get(e)||[]].sort(),n=H(S).get(e)||0;I(O,e,!0),I(te,n,!0),I(k,t,!0),I(ee,!0)}function Me(){I(ee,!1)}async function Ne(){let e=H(p).trim();if(!e){I(g,`Please select a root folder first.`),I(_,!0);return}let t=b();if(!t.length){I(g,`Please select at least one extension.`),I(_,!0);return}I(be,!1),I(v,!1),I(ee,!1),I(g,`Reading files…`),I(_,!0),I(j,!1);try{let n=H(m).trim(),r=n?n.split(/[\n,]/).map(e=>e.trim()).filter(Boolean):[];localStorage.setItem(`wc-exclude`,n);let i=new URLSearchParams({path:e});t.forEach(e=>i.append(`ext`,e)),r.forEach(e=>i.append(`exclude`,e));let a=await fetch(`/api/wordcloud?`+i);if(!a.ok){I(g,`Error: `+((await a.json()).error||a.statusText));return}let{files:o,fileTexts:s}=await a.json();I(g,`Analyzing ${o} file(s)…`);let c=new Map,l=new Map,u=new Set;I(w,o,!0);for(let{path:e,text:t}of s){let n=(e.split(`.`).pop()||``).toLowerCase();n&&u.add(n);let r=f(t,n),i=new Set;for(let t of r)c.set(t,(c.get(t)||0)+1),i.has(t)||(i.add(t),l.has(t)||l.set(t,new Set),l.get(t).add(e))}I(S,c,!0),I(C,l,!0),I(E,[...u].sort().map(e=>`.`+e),!0),je()}catch(e){I(g,`Error: `+e.message)}}let Pe=!1;On(()=>{t.open&&!Pe?(Pe=!0,I(g,`Choose a root folder and click Launch.`),I(_,!0),I(j,!1),I(v,!1),I(ee,!1),I(S,null),I(C,null),I(T,null),I(D,[],!0),I(be,!1),I(de,!1),I(h,1),ue(),H(p)||fetch(`/api/config`).then(e=>e.json()).then(e=>{e.docsFolder&&(I(p,e.docsFolder,!0),I(Se,e.docsFolder,!0))}).catch(()=>{})):t.open||(Pe=!1)});var Fe=Ur(),Ie=z(Fe),Le=e=>{var n=bh(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o),N(r);var c=B(r,2),l=R(c),u=R(l),d=R(u,!0);N(u);var f=B(u,2);Ei(f);var b=B(f,2),S=B(R(b)),C=R(S,!0);N(S),N(b);var w=B(b,2),ne=R(w,!0);N(w),N(l);var ae=B(l,2),ce=R(ae),ue=R(ce,!0);N(ce);var pe=B(ce,2);vn(pe);var Se=B(pe,2),je=B(R(Se)),Pe=R(je,!0);N(je),N(Se),N(ae);var Fe=B(ae,2),Ie=e=>{var t=sh(),n=R(t),r=R(n),i=B(r,2),a=R(i,!0);N(i),N(n);var o=B(n,2),s=R(o),c=e=>{var t=rh(),n=R(t,!0);N(t),V(()=>K(n,H(ge))),G(e,t)},l=e=>{var t=ih(),n=R(t,!0);N(t),V(()=>{hi(t,1,`px-3 py-3 text-xs ${H(ge)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),K(n,H(ge))}),G(e,t)},u=e=>{var t=Ur();$r(z(t),17,()=>H(he),Yr,(e,t)=>{var n=Ur(),r=z(n),i=e=>{var n=ah(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,r,()=>ve(H(t).path)),U(`click`,o,()=>oe(H(t).entry)),G(e,n)},a=e=>{var n=oh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,o,()=>oe(H(t).entry)),G(e,n)};q(r,e=>{H(t).kind===`dir`?e(i):e(a,-1)}),G(e,n)}),G(e,t)};q(s,e=>{H(he)===null?e(c):H(he).length===0?e(l,1):e(u,-1)}),N(o),N(t),V(()=>{r.disabled=!H(fe),K(a,H(me))}),U(`click`,r,ye),G(e,t)};q(Fe,e=>{H(de)&&e(Ie)});var Le=B(Fe,2),Re=R(Le),ze=R(Re,!0);N(Re);var Be=B(Re,2),Ve=R(Be);Ei(Ve);var He=B(Ve);N(Be),$r(B(Be,2),17,()=>H(y),e=>e.value,(e,t,n)=>{var r=ch(),i=R(r);Ei(i);var a=B(i);N(r),V(()=>K(a,` ${H(t).label??``}`)),U(`change`,i,ie),Ni(i,()=>H(t).checked,e=>H(t).checked=e),G(e,r)}),N(Le);var Ue=B(Le,2),We=e=>{var t=sh(),n=R(t),r=R(n),i=B(r,2),a=R(i,!0);N(i),N(n);var o=B(n,2),s=R(o),c=e=>{var t=rh(),n=R(t,!0);N(t),V(()=>K(n,H(Te))),G(e,t)},l=e=>{var t=dh(),n=z(t),r=e=>{var t=ih(),n=R(t,!0);N(t),V(()=>{hi(t,1,`px-3 py-3 text-xs ${H(Te)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),K(n,H(Te))}),G(e,t)},i=e=>{var t=Ur();$r(z(t),17,()=>H(we),Yr,(e,t)=>{var n=lh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,r,()=>Ee(H(t).path)),U(`click`,o,()=>oe(H(t).name)),G(e,n)}),G(e,t)};q(n,e=>{H(we).length===0?e(r):e(i,-1)});var a=B(n,2),o=e=>{var t=uh(),n=B(R(t)),r=R(n,!0);N(n),N(t),V(()=>K(r,H(Ce))),U(`click`,t,Oe),G(e,t)};q(a,e=>{H(Te)!==`Cannot read directory`&&e(o)}),G(e,t)};q(s,e=>{H(we)===null?e(c):e(l,-1)}),N(o),N(t),V(()=>{r.disabled=!H(xe),K(a,H(Ce))}),U(`click`,r,De),G(e,t)};q(Ue,e=>{H(be)&&e(We)}),N(c);var Ge=B(c,2),Ke=R(Ge),qe=e=>{var t=hh(),n=R(t),r=R(n),i=e=>{var t=ph(),n=z(t),r=R(n);N(n);var i=B(n,2),a=R(i);N(i);var o=B(i,2),s=R(o);N(o);var c=B(o,2),l=e=>{var t=fh(),n=R(t);N(t),V((e,r)=>{J(t,`title`,e),K(n,`${H(E).length??``} extension${H(E).length>1?`s`:``} found (${r??``})`)},[()=>H(E).join(`, `),()=>H(E).join(`, `)]),G(e,t)};q(c,e=>{H(E).length&&e(l)}),V(()=>{K(r,`${H(T).scanned??``} file(s) scanned`),K(a,`${H(T).unique??``} unique domain words`),K(s,`${H(T).shown??``} shown`)}),G(e,t)};q(r,e=>{H(T)&&e(i)}),N(n);var a=B(n,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2);Ei(c);var l=B(c,2),u=R(l,!0);N(l),N(a);var d=B(a,2),f=R(d,!0);N(d);var p=B(d,2);$r(p,21,()=>H(D),Yr,(e,t,n)=>{var r=mh(),i=R(r);i.textContent=n+1;var a=B(i,2),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,2),u=R(l,!0);N(l),N(o);var d=B(o,2),f=R(d);N(d),N(a),N(r),V(()=>{K(c,H(t).word),K(u,H(t).freq),_i(f,`width:${H(t).pct??``}%`)}),U(`click`,r,()=>M(H(t).word)),G(e,r)}),N(p),N(t),V((e,t,n,r,i,a)=>{J(o,`title`,e),K(s,t),J(c,`title`,n),J(l,`title`,r),K(u,i),K(f,a)},[()=>Y(`wc.min_files_hint`),()=>Y(`wc.min_files_label`),()=>Y(`wc.min_files_hint`),()=>Y(`wc.apply_hint`),()=>Y(`wc.apply_btn`),()=>Y(`wc.top_words`)]),Mi(c,()=>H(h),e=>I(h,e)),U(`click`,l,le),G(e,t)};q(Ke,e=>{H(v)&&e(qe)});var Je=B(Ke,2),Ye=R(Je),Xe=e=>{var t=gh(),n=R(t,!0);N(t),V(()=>K(n,H(g))),G(e,t)};q(Ye,e=>{H(_)&&e(Xe)});var Ze=B(Ye,2);let Qe;Li(Ze,e=>I(ke,e),()=>H(ke)),N(Je),Li(Je,e=>I(Ae,e),()=>H(Ae));var $e=B(Je,2),et=e=>{var t=yh(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2);N(n);var o=B(n,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=e=>{var t=Ur();$r(z(t),17,()=>H(k),Yr,(e,t)=>{var n=_h(),r=R(n),i=R(r,!0);N(r);var a=B(r,2);N(n),V(()=>K(i,H(t))),U(`click`,a,()=>oe(H(t))),G(e,n)}),G(e,t)},d=e=>{G(e,vh())};q(l,e=>{H(k).length?e(u):e(d,-1)}),N(c),N(t),V(e=>{K(i,`${H(O)??``} ×${H(te)??``}`),K(s,e)},[()=>Y(`wc.found_in`)]),U(`click`,a,Me),G(e,t)};q($e,e=>{H(ee)&&e(et)}),N(Ge),N(n),V((e,t,n,r,i,o,c,l,u,f)=>{K(a,e),K(s,t),K(d,n),K(C,r),K(ne,i),K(ue,o),J(pe,`placeholder`,c),K(Pe,l),K(ze,u),Oi(Ve,H(x)),K(He,` ${f??``}`),Qe=hi(Ze,1,``,null,Qe,{hidden:!H(j)})},[()=>Y(`wc.title`),()=>Y(`wc.close_btn`),()=>Y(`wc.search_root_label`),()=>Y(`wc.browse_btn`),()=>Y(`wc.launch_btn`),()=>Y(`wc.exclude_label`),()=>Y(`wc.exclude_placeholder`),()=>Y(`wc.browse_btn`),()=>Y(`wc.extensions_label`),()=>Y(`wc.all_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),Mi(f,()=>H(p),e=>I(p,e)),U(`click`,b,A),U(`click`,w,Ne),U(`input`,pe,se),Mi(pe,()=>H(m),e=>I(m,e)),U(`click`,Se,_e),U(`change`,Ve,re),G(e,n)};q(Ie,e=>{t.open&&e(Le)}),G(e,Fe),Ke()}Nr([`click`,`input`,`change`]);var Sh=W(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button> <button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`,1),Ch=W(`<div class="relative hidden sm:block"><input type="search" class="w-56 pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div>`),wh=W(`<p class="p-8 text-red-500"> </p>`),Th=W(`<div class="h-full flex items-center justify-center p-8"><div class="max-w-md text-center"><div class="text-5xl mb-4 select-none" aria-hidden="true">📚</div> <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-300 mb-2"> </h2> <p class="text-sm text-gray-500 dark:text-gray-500"> </p> <p class="mt-4 text-xs text-gray-400 dark:text-gray-600 font-mono bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 inline-block"> </p> <p class="mt-2 text-xs text-gray-400"> </p></div></div>`),Eh=W(`<div class="app-shell bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100"><!> <div class="flex overflow-hidden"><!> <main id="home-content-area" class="flex-1 overflow-y-auto"><!></main></div></div> <!> <!> <!> <!>`,1);function Dh(e,t){Ge(t,!0);let n=F(!1),r=F(!1),i=F(!1),a=F(!1),o=F(null),s=F(!1),c=F(``),l=F(!1),u=F(`Living AI Documentation`),d=F(`YYYY_MM_DD_HH_mm_[Category]_title.md`),f=null;function p(){try{let e=localStorage.getItem(`ld-dark`);if(e!==null)return e===`true`}catch{}return window.matchMedia(`(prefers-color-scheme: dark)`).matches}function m(e){I(l,e,!0),document.documentElement.classList.toggle(`dark`,e)}function h(){m(!H(l));try{localStorage.setItem(`ld-dark`,String(H(l)))}catch{}}On(()=>{let e=document.getElementById(`hljs-dark`),t=document.getElementById(`hljs-light`);if(!e||!t)return;let n=$.codeBlockLightTheme&&!H(l);e.disabled=n,t.disabled=!n,document.body.classList.toggle(`ld-code-light`,n)});function g(e){let t=e.trim();if(f&&clearTimeout(f),!t){$.searchQuery=``,$.searchResults=null;return}$.searchQuery=t,$.searchResults=$.allDocs.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())||e.category.toLowerCase().includes(t.toLowerCase())),f=window.setTimeout(async()=>{try{let e=await Fu(t);t===$.searchQuery&&($.searchResults=e)}catch{}},350)}let _=F(L([]));function v(e){let t=H(_)[e];t&&(I(_,H(_).slice(0,e),!0),y(t.id,!1,`restore`))}async function y(e,t=!1,n=!1,r=null){if(n===!0&&$.currentDocId&&$.currentDocId!==e){let t=H(_).findIndex(t=>t.id===e);if(t!==-1)I(_,H(_).slice(0,t),!0);else{let e=$.allDocs.find(e=>e.id===$.currentDocId);I(_,[...H(_),{id:$.currentDocId,title:e?e.title:$.currentDocId}],!0)}}else n||I(_,[],!0);$.currentDocId=e;let i=$.allDocs.find(t=>t.id===e);if(i&&$.revealDoc(i),!t){let t=new URL(location.href);t.searchParams.set(`doc`,e),t.hash=r?`#${r}`:``,history.pushState({docId:e,anchor:r||null},``,t)}I(s,!0),I(c,``);try{let t=await ju(e);t.id=e,I(o,t,!0),document.title=t.title,requestAnimationFrame(()=>{let e=document.getElementById(`home-content-area`);if(r){let t=document.getElementById(r);t&&e&&(e.scrollTop+=t.getBoundingClientRect().top-e.getBoundingClientRect().top-80)}else e&&(e.scrollTop=0)})}catch(e){I(c,Y(`doc.failed_to_load`)+(e instanceof Error?e.message:String(e)))}finally{I(s,!1)}}async function b(e){if(!H(o))return;let t=H(o).id,n=await fetch(`/api/documents/`+t,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:e})});if(!n.ok)throw Error(await n.text());let r=await ju(t);r.id=t,I(o,r,!0);let i=e.match(/\]\(\s*\.?\/files\/[^)\s]+/g),a={...$.fileAttachmentCounts};i&&i.length?a[t]=i.length:delete a[t],$.fileAttachmentCounts=a}async function x(){if(!H(o))return;let e=H(o).id;if(!(await fetch(`/api/documents/`+encodeURIComponent(e),{method:`DELETE`})).ok)return;$.allDocs=$.allDocs.filter(t=>t.id!==e),Array.isArray($.searchResults)&&($.searchResults=$.searchResults.filter(t=>t.id!==e));let t={...$.annotationCounts};delete t[e],$.annotationCounts=t;let n={...$.fileAttachmentCounts};delete n[e],$.fileAttachmentCounts=n,$.currentDocId=null,I(o,null),history.pushState({},``,location.pathname)}async function S(){let[e,t]=await Promise.all([ku(),Ou()]);if($.allDocs=e,t.docsFolder)try{$.allFolderPaths=await Au(t.docsFolder)}catch{$.allFolderPaths=[]}let[n,r,i]=await Promise.all([Mu(),Nu(),Pu()]);$.annotationCounts=n,$.fileAttachmentCounts=r,$.docStatuses=i}Vi(async()=>{m(p());let e=await Ou();await fa(e.language||`en`),e.title&&(document.title=e.title,I(u,e.title,!0)),e.filenamePattern&&I(d,e.filenamePattern+`.md`),$.exclusiveFolderExpansion=!!e.exclusiveFolderExpansion,$.exclusiveCategoryExpansion=!!e.exclusiveCategoryExpansion,$.codeBlockMaxHeight=typeof e.codeBlockMaxHeight==`number`?e.codeBlockMaxHeight:400,$.imageRoundedCorners=!!e.imageRoundedCorners,$.imageCentered=!!e.imageCentered,$.imageBorder=!!e.imageBorder,$.codeBlockLightTheme=!!e.codeBlockLightTheme,$.codeBlockMaxHeight>0&&document.documentElement.style.setProperty(`--ld-code-max-h`,$.codeBlockMaxHeight+`px`),$.expandedCategories.size===0&&($.expandedCategories=new Set([`General`])),await S();let t=new URLSearchParams(location.search).get(`doc`);if(t)y(t,!0,!1,location.hash?location.hash.slice(1):null);else{let e=$.allDocs.find(e=>e.category===`General`)??$.allDocs[0];e&&y(e.id,!0)}let n=e=>{let t=e.state?.docId||new URLSearchParams(location.search).get(`doc`),n=e.state?.anchor||(location.hash.length>1?location.hash.slice(1):null);t&&y(t,!0,!1,n)};return window.addEventListener(`popstate`,n),()=>window.removeEventListener(`popstate`,n)});var C=Eh(),w=z(C),T=R(w);ua(T,{get title(){return H(u)},subtitle:``,actions:e=>{var t=Sh(),n=z(t),r=B(n,2),i=R(r,!0);N(r),V((e,t)=>{J(n,`title`,e),J(n,`aria-label`,t),K(i,H(l)?`☀`:`☾`)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),U(`click`,n,()=>I(a,!0)),U(`click`,r,h),G(e,t)},children:(e,t)=>{var n=Ch(),r=R(n);Ei(r),Pe(2),N(n),V(e=>{J(r,`placeholder`,e),Di(r,$.searchQuery)},[()=>Y(`nav.search_placeholder`)]),U(`input`,r,e=>g(e.target.value)),G(e,n)},$$slots:{actions:!0,default:!0}});var E=B(T,2),D=R(E);sd(D,{onopen:e=>y(e),onsearch:g,onexport:()=>I(i,!0),onnewfolder:()=>I(n,!0),onnewdoc:()=>I(r,!0)});var ee=B(D,2),O=R(ee),te=e=>{var t=Ur(),n=z(t),r=e=>{var t=wh(),n=R(t,!0);N(t),V(()=>K(n,H(c))),G(e,t)},i=e=>{jm(e,{get doc(){return H(o)},get navHistory(){return H(_)},ongoback:v,onopen:(e,t)=>y(e,!1,!0,t),onsave:b,ondelete:x})};q(n,e=>{H(c)?e(r):e(i,-1)}),G(e,t)},k=e=>{var t=Th(),n=R(t),r=B(R(n),2),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a);var s=B(a,2),c=R(s,!0);N(s);var l=B(s,2),u=R(l,!0);N(l),N(n),N(t),V((e,t,n)=>{K(i,e),K(o,t),K(c,H(d)),K(u,n)},[()=>Y(`welcome.title`),()=>Y(`welcome.hint`),()=>Y(`welcome.pattern_hint`)]),G(e,t)};q(O,e=>{H(o)?e(te):e(k,-1)}),N(ee),N(E),N(w);var ne=B(w,2);zm(ne,{get open(){return H(n)},onclose:()=>I(n,!1),onsuccess:S});var re=B(ne,2);Jm(re,{get open(){return H(r)},onclose:()=>I(r,!1),onsuccess:async e=>{await S(),y(e)}});var ie=B(re,2);nh(ie,{get open(){return H(i)},onclose:()=>I(i,!1)}),xh(B(ie,2),{get open(){return H(a)},onclose:()=>I(a,!1)}),G(e,C),Ke()}Nr([`click`,`input`]);var Oh=`modulepreload`,kh=function(e){return`/`+e},Ah={},jh=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=kh(t,n),t in Ah)return;Ah[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Oh,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Mh=W(`<div class="flex flex-col h-screen overflow-hidden bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100"><header class="flex items-center gap-1 px-2 h-12 shrink-0 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm z-10"><button class="tool-btn !w-auto px-2 text-xs font-medium text-gray-500 dark:text-gray-400"> </button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSidebar" class="tool-btn">☰</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnCopyDiagramId" class="tool-btn"><svg width="15" height="15" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="9" rx="1.5"></rect><path d="M3 11V3a1 1 0 0 1 1-1h7"></path></svg></button> <button id="toolSelect" class="tool-btn tool-active"><svg width="11" height="13" viewBox="0 0 11 13" fill="currentColor" stroke="none"><path d="M1 1 L1 12 L4 9 L6.5 13 L8 12.2 L5.5 8.2 L10 8.2 Z"></path></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolBox" class="tool-btn"><svg width="15" height="10" viewBox="0 0 15 10" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="1" width="13" height="8" rx="1"></rect></svg></button> <button id="toolEllipse" class="tool-btn"><svg width="16" height="10" viewBox="0 0 16 10" fill="none" stroke="currentColor" stroke-width="1.5"><ellipse cx="8" cy="5" rx="7" ry="4"></ellipse></svg></button> <button id="toolDatabase" class="tool-btn"><svg width="12" height="16" viewBox="0 0 12 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><ellipse cx="6" cy="3" rx="5" ry="2"></ellipse><path d="M1 3v10c0 1.1 2.2 2 5 2s5-.9 5-2V3"></path><path d="M11 7.5c0 1.1-2.2 2-5 2s-5-.9-5-2"></path></svg></button> <button id="toolCircle" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="6.5" cy="6.5" r="5.5"></circle></svg></button> <button id="toolActor" class="tool-btn"><svg width="12" height="17" viewBox="0 0 12 17" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="6" cy="3" r="2.2"></circle><line x1="6" y1="5.2" x2="6" y2="10"></line><line x1="1.5" y1="7.5" x2="10.5" y2="7.5"></line><line x1="6" y1="10" x2="2.5" y2="15"></line><line x1="6" y1="10" x2="9.5" y2="15"></line></svg></button> <button id="toolPostIt" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M1 1 H9 L12 4 V12 H1 Z"></path><path d="M9 1 V4 H12" stroke-opacity="0.5"></path></svg></button> <button id="toolTextFree" class="tool-btn" style="font-size:11px; font-weight:600;">T</button> <button id="toolImage" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" rx="1.5"></rect><circle cx="4.5" cy="4.5" r="1.2"></circle><path d="M1 9.5 L4 6.5 L6.5 9 L9 7 L13 10.5"></path></svg></button> <a href="/shape-editor" class="tool-btn">✦</a> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolArrow" class="tool-btn">→</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDelete" class="tool-btn"><svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="1" y1="1" x2="10" y2="10"></line><line x1="10" y1="1" x2="1" y2="10"></line></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDiagramDefaults" class="tool-btn"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button> <button id="btnAlign" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4"><line x1="0.5" y1="7.5" x2="13.5" y2="7.5"></line><line x1="3.5" y1="0.5" x2="3.5" y2="13.5" stroke-dasharray="1.5 1.5"></line><line x1="10.5" y1="0.5" x2="10.5" y2="13.5" stroke-dasharray="1.5 1.5"></line></svg></button> <button id="btnGrid" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.2"><line x1="5" y1="1" x2="5" y2="13"></line><line x1="9" y1="1" x2="9" y2="13"></line><line x1="1" y1="5" x2="13" y2="5"></line><line x1="1" y1="9" x2="13" y2="9"></line><rect x="1" y="1" width="12" height="12" rx="1"></rect></svg></button> <button id="btnEdgeStraight" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="12" x2="12" y2="2"></line><polyline points="8,2 12,2 12,6"></polyline></svg></button> <button id="btnEvidenceMode" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 1.5 H8.5 L11 4 V12.5 H4 Z"></path><path d="M8.5 1.5 V4 H11"></path><path d="M1.5 5.5 H6.5"></path><path d="M1.5 8 H6.5"></path><path d="M1.5 10.5 H5"></path></svg></button> <button id="btnResizeMode" class="tool-btn active-tool"><svg id="icon-resize-corner" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="7,10 10,10 10,7"></polyline></svg> <svg id="icon-resize-center" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="hidden"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="4,6.5 4,4 6.5,4"></polyline><polyline points="10,7.5 10,10 7.5,10"></polyline><line x1="10" y1="4" x2="4" y2="10"></line><polyline points="7.5,4 10,4 10,6.5"></polyline><polyline points="4,7.5 4,10 6.5,10"></polyline></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <input id="diagramTitle" type="text" class="flex-1 min-w-0 px-2 py-1 text-sm bg-transparent border-0 focus:outline-none focus:ring-1 focus:ring-blue-500 rounded text-gray-700 dark:text-gray-300 placeholder:text-gray-400"/> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnZoomOut" class="tool-btn">−</button> <span id="zoomLevel" class="text-xs text-gray-500 dark:text-gray-400 w-10 text-center tabular-nums select-none">100%</span> <button id="btnZoomIn" class="tool-btn">+</button> <button id="btnZoomReset" class="tool-btn">⊡</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDark" class="tool-btn"><span id="darkIcon">☽</span></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDebug" class="hidden tool-btn text-xs font-mono">dbg</button> <div id="sepDebug" class="hidden w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnExportDrawio" class="tool-btn"><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" aria-hidden="true"><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></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSave" disabled="" class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed shrink-0 transition-colors"><span> </span></button></header> <div class="flex flex-1 overflow-hidden"><div id="sidebar" class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex flex-col overflow-hidden" style="transition: width 0.2s ease"><div class="flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700 shrink-0"><span class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider"> </span> <button id="btnNewDiagram" class="text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors"> </button></div> <div id="diagramList" class="flex-1 overflow-y-auto py-1"></div></div> <div role="separator" aria-orientation="vertical"></div> <div class="relative flex-1 overflow-hidden bg-gray-50 dark:bg-gray-950"><div id="vis-canvas" class="w-full h-full"></div> <div id="customShapeBar" class="hidden"><div id="customShapeBarBody"></div></div> <div id="debugLayer"></div> <div id="evidenceLayer" class="hidden"></div> <div id="stampOverlay" style="position:absolute;inset:0;display:none;z-index:11;cursor:crosshair;"></div> <div id="selectionOverlay"><div id="rh-tl" class="resize-handle" style="top: -5px; left: -5px; cursor: nw-resize"></div> <div id="rh-tr" class="resize-handle" style="top: -5px; right: -5px; cursor: ne-resize"></div> <div id="rh-bl" class="resize-handle" style="bottom: -5px; left: -5px; cursor: sw-resize"></div> <div id="rh-br" class="resize-handle" style="bottom: -5px; right: -5px; cursor: se-resize"></div> <div id="rh-rotate">↻</div> <div id="rh-label-rotate" style="left: 0; top: -28px;"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><g transform="rotate(25,5,5)"><line x1="2.5" y1="3" x2="7.5" y2="3"></line><line x1="5" y1="3" x2="5" y2="8"></line></g></svg></div></div> <aside id="evidencePanel" class="hidden absolute top-0 right-0 bottom-0 w-80 max-w-[85vw] z-30 bg-gray-50 dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl flex flex-col"><div class="flex items-center justify-between gap-2 px-4 py-3 border-b border-gray-200 dark:border-gray-700"><h2 id="evidencePanelTitle" class="text-sm font-semibold text-gray-800 dark:text-gray-100"> </h2> <button id="btnEvidenceClose" class="tool-btn !w-7 !h-7">×</button></div> <div id="evidencePanelBody" class="flex-1 overflow-y-auto p-3 space-y-3"></div></aside> <div id="nodePanel" class="float-panel hidden"><button id="btnNodeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="nodePanelControls" class="contents"><button id="nodeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#f5f5f4;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <input id="nodeBgOpacity" type="range" min="0" max="100" step="5" value="100" class="w-16 h-1 accent-orange-500 cursor-pointer"/> <div class="panel-sep"></div> <button id="btnNodeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnNodeLink" class="tool-btn !w-6 !h-6"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7.5a3.5 3.5 0 0 0 5 0l1.5-1.5a3.5 3.5 0 0 0-5-5L5 2.5"></path><path d="M8 5.5a3.5 3.5 0 0 0-5 0L1.5 7a3.5 3.5 0 0 0 5 5L8 10.5"></path></svg></button> <div class="panel-sep"></div> <button id="btnNodeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="nodeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">13</span> <button id="btnNodeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnAlignLeft" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="1" y1="5" x2="7" y2="5"></line><line x1="1" y1="8" x2="9" y2="8"></line></svg></button> <button id="btnAlignCenter" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="2.5" y1="5" x2="9.5" y2="5"></line><line x1="1.5" y1="8" x2="10.5" y2="8"></line></svg></button> <button id="btnAlignRight" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="5" y1="5" x2="11" y2="5"></line><line x1="3" y1="8" x2="11" y2="8"></line></svg></button> <div class="panel-sep"></div> <button id="btnValignTop" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="1.5" x2="9" y2="1.5" stroke-width="2"></line><line x1="1" y1="5" x2="8" y2="5" stroke-width="1.3"></line><line x1="1" y1="8.5" x2="6" y2="8.5" stroke-width="1.3"></line></svg></button> <button id="btnValignMiddle" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="2.5" x2="8" y2="2.5" stroke-width="1.3"></line><line x1="1" y1="6" x2="9" y2="6" stroke-width="2"></line><line x1="1" y1="9.5" x2="6" y2="9.5" stroke-width="1.3"></line></svg></button> <button id="btnValignBottom" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="3.5" x2="8" y2="3.5" stroke-width="1.3"></line><line x1="1" y1="7" x2="6" y2="7" stroke-width="1.3"></line><line x1="1" y1="10.5" x2="9" y2="10.5" stroke-width="2"></line></svg></button> <div class="panel-sep"></div> <div id="customShapeLabelPlacementControls" class="hidden"><button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="above">T↑</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="below">T↓</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="left">←T</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="right">T→</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="center">T□</button> <div class="panel-sep"></div></div> <button id="btnZOrderBack" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1"></rect><rect x="5" y="1" width="8" height="8" rx="1" stroke-opacity="0.35"></rect></svg></button> <button id="btnZOrderFront" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1" stroke-opacity="0.35"></rect><rect x="5" y="1" width="8" height="8" rx="1"></rect></svg></button> <div class="panel-sep"></div> <button id="btnStampColor" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M7 2 C7 2 3 6.5 3 9 a4 4 0 0 0 8 0 C11 6.5 7 2 7 2 Z" fill="currentColor" fill-opacity="0.25"></path></svg></button> <button id="btnStampFontSize" class="tool-btn !w-7 !h-6 font-mono text-xs font-bold">Aa</button> <button id="btnStampSize" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="6" height="6" rx="0.8" fill="currentColor" fill-opacity="0.25"></rect><path d="M10 2 L12 2 L12 4"></path><path d="M12 2 L9 5"></path><path d="M10 12 L12 12 L12 10"></path><path d="M12 12 L9 9"></path></svg></button> <div class="panel-sep"></div> <button id="btnRotateCCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↺</button> <button id="btnRotateCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↻</button> <div class="panel-sep"></div> <button id="btnCopyPng" class="tool-btn !h-6 px-1.5 font-mono text-xs font-semibold flex items-center gap-0.5"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="7" x2="5" y2="1"></line><polyline points="2,4 5,1 8,4"></polyline><line x1="1" y1="9" x2="9" y2="9"></line></svg> PNG</button> <div class="panel-sep"></div> <button id="btnGroup" class="tool-btn !w-8 !h-7"><svg width="22" height="14" viewBox="0 0 22 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="20.6" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="4" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="15" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <button id="btnUngroup" class="tool-btn !w-8 !h-7"><svg width="26" height="14" viewBox="0 0 26 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="3" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="16.3" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="19" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <div class="panel-sep"></div> <button id="btnSaveShapeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <div id="linkPanel" class="float-panel hidden" style="min-width:260px; flex-direction:column; align-items:stretch; gap:0.5rem; padding:0.75rem;"><div class="text-xs font-semibold text-gray-500 dark:text-gray-400 mb-1"> </div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeUrl" value="url" class="accent-orange-500"/> <span> </span></label> <div id="linkUrlRow"><input id="linkUrlInput" type="url" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeDiagram" value="diagram" class="accent-orange-500"/> <span> </span></label> <div id="linkDiagramRow" class="hidden"><select id="linkDiagramSelect" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"></select></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeNew" value="new" class="accent-orange-500"/> <span> </span></label> <div id="linkNewRow" class="hidden"><input id="linkNewName" type="text" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <div class="flex gap-1 mt-1"><button id="btnLinkSave" class="flex-1 text-xs bg-orange-500 hover:bg-orange-600 text-white rounded px-2 py-1"> </button> <button id="btnLinkRemove" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600"> </button> <button id="btnLinkCancel" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-700">✕</button></div></div> <div id="edgePanel" class="float-panel hidden"><button id="btnEdgeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="edgePanelControls" class="contents"><button id="edgeBtnNone" class="tool-btn !w-7 !h-6 font-mono text-xs">—</button> <button id="edgeBtnFrom" class="tool-btn !w-7 !h-6 text-xs">←</button> <button id="edgeBtnTo" class="tool-btn !w-7 !h-6 text-xs">→</button> <button id="edgeBtnBoth" class="tool-btn !w-8 !h-6 text-xs">←→</button> <div class="panel-sep"></div> <button id="edgeBtnSolid" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line></svg></button> <button id="edgeBtnDashed" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-dasharray="4,3"></line></svg></button> <div class="panel-sep"></div> <button id="btnEdgeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="edgeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">11</span> <button id="btnEdgeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnEdgeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnEdgeLabelWidthReset" class="tool-btn !w-6 !h-6 text-xs">↔</button> <div class="panel-sep"></div> <button id="btnEdgeLabelRotateCCW" class="tool-btn !w-7 !h-6 text-sm">↺</button> <button id="btnEdgeLabelRotateCW" class="tool-btn !w-7 !h-6 text-sm">↻</button> <div class="panel-sep"></div> <button id="btnEdgeLabelOffsetLeft" class="tool-btn !w-6 !h-6 text-sm">←</button> <button id="btnEdgeLabelOffsetRight" class="tool-btn !w-6 !h-6 text-sm">→</button> <button id="btnEdgeLabelOffsetUp" class="tool-btn !w-6 !h-6 text-sm">↑</button> <button id="btnEdgeLabelOffsetDown" class="tool-btn !w-6 !h-6 text-sm">↓</button> <button id="btnEdgeLabelOffsetReset" class="tool-btn !w-6 !h-6 text-xs">⊙</button> <div class="panel-sep"></div> <button id="btnEdgeWidthDecrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W−</button> <button id="btnEdgeWidthIncrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W+</button> <div class="panel-sep"></div> <button id="edgeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#a8a29e;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <button id="btnEdgeClearPorts" class="tool-btn !w-8 !h-6 text-xs">⊗</button> <div class="panel-sep"></div> <button id="btnSaveEdgeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <textarea id="labelInput" class="hidden" rows="1"></textarea> <div id="emptyState" class="absolute inset-0 flex flex-col items-center justify-center text-gray-400 dark:text-gray-600 pointer-events-none select-none"><svg width="52" height="44" viewBox="0 0 52 44" fill="none" stroke="currentColor" stroke-width="1.5" class="mb-3 opacity-50"><rect x="2" y="4" width="18" height="12" rx="2"></rect><rect x="32" y="28" width="18" height="12" rx="2"></rect><line x1="20" y1="10" x2="32" y2="34" stroke-dasharray="4,3"></line><rect x="17" y="16" width="18" height="12" rx="2"></rect><line x1="26" y1="16" x2="26" y2="10" stroke-dasharray="4,3"></line></svg> <p class="text-sm"> </p></div></div></div> <div id="toastContainer"></div> <div id="imageNameModal" style="display:none;position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,0.5);" class="flex items-center justify-center"><div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl p-6 w-80 flex flex-col gap-3"><p class="text-sm font-semibold text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-400 dark:text-gray-500">Lettres, chiffres, <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">_</code> et <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">-</code> uniquement.
|
|
134
|
+
</html>`,f=window.open(``,`_blank`);if(!f){alert(Y(`error.pdf_popup`));return}f.document.write(d),f.document.close(),t.onclose()}catch(e){alert(Y(`error.pdf_export`)+(e instanceof Error?e.message:String(e)))}finally{I(d,!1)}}let y=`px-4 py-2 text-sm border-b-2 border-blue-500 text-blue-600 dark:text-blue-400 font-semibold transition-colors`,b=`px-4 py-2 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors`;var x=Ur(),S=z(x),C=e=>{var r=gh(),f=R(r),p=R(f),h=B(R(p),2),x=R(h,!0);N(h),N(p);var S=B(p,2),C=R(S),w=R(C,!0);N(C);var T=B(C,2),E=R(T,!0);N(T);var D=B(T,2),ee=R(D,!0);N(D),N(S);var O=B(S,2),te=e=>{var t=ph(),n=R(t),r=R(n),c=e=>{var t=uh(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},l=e=>{var t=dh(),n=R(t);N(t),V(e=>K(n,`${e??``}failed to load folders`),[()=>Y(`common.error_prefix`)]),G(e,t)},u=e=>{var t=Ur();$r(z(t),16,()=>H(o),e=>e,(e,t)=>{var n=fh(),r=R(n);Ei(r);var i,a=B(r,2),o=R(a,!0);N(a),N(n),V(()=>{i!==(i=t)&&(r.value=(r.__value=t)??``),K(o,t)}),Ni(r,()=>H(s)[t],e=>H(s)[t]=e),G(e,n)}),G(e,t)};q(r,e=>{H(i)?e(c):H(a)?e(l,1):e(u,-1)}),N(n),N(t),G(e,t)};q(O,e=>{H(n)===`html`&&e(te)});var k=B(O,2),ne=e=>{var n=mh(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var l=B(o,2),u=R(l,!0);N(l),N(a),N(n),V((e,t,n)=>{K(i,e),K(s,t),l.disabled=H(c),K(u,n)},[()=>Y(`modal.export.markdown_hint`),()=>Y(`common.cancel`),()=>H(c)?`⏳`:Y(`modal.export.markdown_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,l,g),G(e,n)};q(k,e=>{H(n)===`markdown`&&e(ne)});var re=B(k,2),ie=e=>{var n=hh(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2),d=R(c,!0);N(c);var f=B(c,2),p=R(f,!0);N(f),N(a),N(n),V((e,t,n,r)=>{K(i,e),K(s,t),c.disabled=H(l),K(d,n),f.disabled=H(u),K(p,r)},[()=>Y(`modal.export_html.hint`),()=>Y(`common.cancel`),()=>H(l)?`⏳`:Y(`modal.export_html.notion_btn`),()=>H(u)?`⏳`:Y(`modal.export_html.confluence_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,c,()=>_(`notion`)),U(`click`,f,()=>_(`confluence`)),G(e,n)};q(re,e=>{H(n)===`html`&&e(ie)});var ae=B(re,2),oe=e=>{var n=mh(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2),l=R(c,!0);N(c),N(a),N(n),V((e,t,n)=>{K(i,e),K(s,t),c.disabled=H(d),K(l,n)},[()=>Y(`modal.export.pdf_hint`),()=>Y(`common.cancel`),()=>H(d)?`⏳`:Y(`modal.export.pdf_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,c,v),G(e,n)};q(ae,e=>{H(n)===`pdf`&&e(oe)}),N(f),N(r),V((e,t,r,i)=>{K(x,e),hi(C,1,li(H(n)===`markdown`?y:b)),K(w,t),hi(T,1,li(H(n)===`html`?y:b)),K(E,r),hi(D,1,li(H(n)===`pdf`?y:b)),K(ee,i)},[()=>Y(`modal.export.title`),()=>Y(`modal.export.tab_markdown`),()=>Y(`modal.export.tab_html`),()=>Y(`modal.export.tab_pdf`)]),U(`click`,r,e=>{e.target===e.currentTarget&&t.onclose()}),U(`click`,C,()=>m(`markdown`)),U(`click`,T,()=>m(`html`)),U(`click`,D,()=>m(`pdf`)),G(e,r)};q(S,e=>{t.open&&e(C)}),G(e,x),Ke()}Nr([`click`]);var vh=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),yh=W(`<p> </p>`),bh=W(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),xh=W(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-gray-500 dark:text-gray-400"><span class="shrink-0 opacity-40">📄</span> <span class="truncate font-mono"> </span></span> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),Sh=W(`<div class="border-t border-gray-200 dark:border-gray-700"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0">↑ Up</button> <span class="font-mono text-xs text-gray-400 dark:text-gray-500 truncate flex-1 text-right"> </span></div> <div class="divide-y divide-gray-100 dark:divide-gray-800 max-h-52 overflow-y-auto"><!></div></div>`),Ch=W(`<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 cursor-pointer"><input type="checkbox"/> </label>`),wh=W(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Exclude this folder" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 px-3 py-2 text-sm transition-opacity">⊖</button></div>`),Th=W(`<button class="w-full px-3 py-2 text-xs text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/30 text-left font-medium border-t border-gray-100 dark:border-gray-800">✓ Select: <span class="font-mono"> </span></button>`),Eh=W(`<!> <!>`,1),Dh=W(`<div> </div>`),Oh=W(`<div> </div> <div> </div> <div> </div> <!>`,1),kh=W(`<div role="button" tabindex="0" class="flex items-center gap-2 px-3 py-1 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors"><span class="text-gray-400 dark:text-gray-600 w-5 text-right shrink-0 tabular-nums text-xs"></span> <div class="flex-1 min-w-0"><div class="flex items-center justify-between gap-1"><span class="text-gray-800 dark:text-gray-200 font-medium truncate text-xs"> </span> <span class="text-gray-400 dark:text-gray-600 tabular-nums shrink-0 text-xs"> </span></div> <div class="h-1 bg-gray-100 dark:bg-gray-800 rounded-full mt-0.5"><div class="h-1 bg-blue-400 dark:bg-blue-600 rounded-full"></div></div></div></div>`),Ah=W(`<div class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400 space-y-0.5 border-b border-gray-100 dark:border-gray-800"><!></div> <div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center gap-2"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0 cursor-help"> </span> <input type="number" min="1" max="20" class="w-12 px-1.5 py-0.5 text-xs rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-800 dark:text-gray-200 focus:outline-none"/> <button class="text-xs text-blue-600 dark:text-blue-400 hover:underline"> </button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto"></div></div>`),jh=W(`<p class="absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-sm animate-pulse"> </p>`),Mh=W(`<div class="flex items-center gap-1 group py-0.5"><span class="text-gray-600 dark:text-gray-400 break-all font-mono flex-1 text-xs"> </span> <button title="Exclude this file" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 text-xs leading-none px-1 transition-opacity">⊖</button></div>`),Nh=W(`<div class="text-gray-400 text-center py-2">—</div>`),Ph=W(`<div class="w-80 shrink-0 border-l border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between"><span class="font-bold text-sm text-gray-900 dark:text-gray-100"> </span> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-xs leading-none">✕</button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto px-3 py-1 space-y-1 text-xs"><!></div></div>`),Fh=W(`<div class="fixed inset-0 z-50 flex flex-col bg-white dark:bg-gray-950"><div class="flex items-center justify-between px-6 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><h2 class="font-semibold text-base"> </h2> <button class="text-sm px-3 py-1.5 rounded-lg text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"> </button></div> <div class="border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><div class="flex items-center gap-3 px-6 py-3"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </label> <input type="text" readonly="" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono cursor-default focus:outline-none"/> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors shrink-0"> </button></div> <div class="flex items-start gap-3 px-6 pb-2"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0 pt-1.5"> </label> <textarea rows="3" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-1 focus:ring-blue-400 resize-y"></textarea> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button></div> <!> <div class="flex items-center gap-x-4 gap-y-2 px-6 pb-3 flex-wrap"><span class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </span> <label class="flex items-center gap-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 cursor-pointer shrink-0"><input type="checkbox"/> </label> <!></div> <!></div> <div class="flex-1 overflow-hidden flex"><!> <div class="flex-1 relative overflow-hidden"><!> <canvas style="position: absolute; inset: 0"></canvas></div> <!></div></div>`);function Ih(e,t){Ge(t,!0);let n=new Set(`the.a.an.and.or.but.not.nor.so.yet.both.either.neither.is.are.was.were.be.been.being.have.has.had.do.does.did.will.would.shall.should.may.might.can.could.must.need.dare.ought.used.to.of.in.for.on.with.at.by.from.up.about.into.through.during.before.after.above.below.between.out.off.over.under.again.further.then.once.here.there.when.where.why.how.all.each.few.more.most.other.some.such.no.only.own.same.than.too.very.just.also.still.already.always.never.often.sometimes.usually.this.that.these.those.its.your.our.their.his.her.him.she.you.they.we.me.my.it.who.which.what.whose.whom.if.though.although.because.since.while.unless.until.whether.as.like.via.per.i.am.he.us.see.now.new.old.got.let.put.say.said.says.get.use.make.made.take.come.came.go.went.know.think.look.want.give.seem.back.down.even.much.well.good.work.tell.keep.hold.turn.move.play.live.help.run.start.off.way.too.few.show.hear.etc.eg.ie.one.two.three.four.five.six.seven.eight.nine.ten.le.la.les.un.une.des.du.de.d.l.au.aux.ce.ci.cet.cette.ces.mon.ma.mes.ton.ta.tes.son.sa.ses.notre.nos.votre.vos.leur.leurs.je.tu.il.elle.on.nous.vous.ils.elles.me.te.se.lui.y.en.qui.que.quoi.dont.où.et.ou.mais.donc.or.ni.car.si.ne.pas.plus.moins.très.bien.mal.peu.beaucoup.trop.assez.aussi.comme.pour.par.avec.sans.dans.sur.sous.entre.vers.chez.contre.avant.après.pendant.depuis.selon.malgré.sauf.est.sont.était.être.avoir.fait.faire.dit.dire.peut.pouvoir.doit.devoir.veut.vouloir.sait.savoir.va.aller.vient.venir.tout.tous.toute.toutes.autre.autres.même.chaque.quel.quelle.quels.quelles.aucun.aucune.certain.certaine.plusieurs.quelque.quelques.tel.telle.tels.telles.cela.ceci.ça.celui.celle.ceux.celles.ici.voici.voilà.alors.ainsi.encore.déjà.jamais.toujours.souvent.parfois.rien.personne.chose.fois.jour.temps.part.cas.point.lieu.monde.cependant.néanmoins.pourtant.toutefois.quand.lorsque.puisque.parce.afin.puis.lors.notamment.surtout.seulement.vraiment.enfin.ensuite.ailleurs.là.ici.voici.voilà.dont.lequel.laquelle.lesquels.lesquelles`.split(`.`)),r=new Set(`public.private.protected.static.void.class.interface.abstract.final.const.let.var.function.return.if.else.for.while.do.switch.case.break.continue.try.catch.throw.throws.finally.new.this.self.super.import.export.from.package.module.require.include.using.namespace.struct.enum.trait.impl.fn.def.func.fun.val.mut.async.await.yield.lambda.extends.implements.override.virtual.sealed.data.object.companion.where.when.match.guard.defer.go.chan.select.type.alias.as.is.in.of.with.true.false.null.nil.none.undefined.println.printf.fmt.log.print.main.args.argv.init.setup.teardown.describe.test.expect.assert.before.after.not.and.or.delete.typeof.instanceof.readonly.keyof.infer.never.unknown.declare.satisfies.get.set.add.remove.update.create.find.fetch.load.save.put.post.patch.list.map.filter.reduce.sort.merge.parse.format.convert.transform.validate.check.handle.process.execute.start.stop.reset.clear.close.open.read.write.send.receive.emit.trigger.dispatch.subscribe.unsubscribe.listen.notify.register.unregister.bind.apply.call.invoke.callback.handler.listener.middleware.interceptor.resolver.provider.consumer.producer.builder.factory.adapter.wrapper.proxy.decorator.observer.visitor.strategy.command.controller.service.repository.dao.dto.entity.model.schema.config.context.state.store.action.reducer.selector.hook.ref.effect.memo.component.module.plugin.extension.util.utils.helper.helpers.common.shared.base.default.index.app.core.lib.src.test.spec.mock.stub.fixture.impl.internal.api.sdk.client.server.request.response.status.code.error.exception.message.result.data.value.key.name.label.title.description.item.element.node.child.parent.root.container.wrapper.layout.view.page.screen.panel.header.footer.sidebar.navbar.body.content.section.row.col.column.grid.flex.block.inline.span.div.input.output.param.params.arg.option.options.props.attr.attrs.field.fields.property.properties.method.methods.string.number.boolean.integer.float.double.long.short.byte.char.array.object.map.set.list.vector.queue.stack.hash.table.tree.graph.pair.tuple.optional.nullable.void.unit.any.bool.bytes.none.int.str.bool.all.each.every.some.many.single.multi.first.last.next.prev.previous.current.old.temp.tmp.new.top.bottom.left.right.center.middle.start.end.begin.min.max.count.total.sum.avg.size.length.width.height.depth.flag.num.idx.id.uid.uuid.num.str.val.obj.arr.fn.cb.ctx.req.res.err.msg.src.dst.evt.doc.db.io.fs.os.env.sys.http.https.url.uri.path.port.host.tcp.udp.ssl.tls.html.css.json.xml.yml.yaml.csv.sql.regex.utf.ascii.rgb.rgba.hex.px.em.rem.vh.vw.auto.inherit.initial.application.file.local.source.messages.logging.alerting.programmed.offset.offsets.zone.zoned.decimal.big.integer.constructor.mapper.captor.publisher.verify.subscriber.org.edr.ack.ref.ssr.ssg.csr.isr.mockito.junit.vitest.jest.mocha.rspec.pytest.cypress.playwright.captor.spy.given.then.verify.times.never.invocation.argumentcaptor.inorder.donothing.doreturn.ippon.springframework.jakarta.javax.todo.fixme.hack.note.deprecated.experimental.eslint.prettier.typescript.javascript.java.kotlin.python.golang.rust.csharp.swift.ruby.spring.boot.javax.jakarta.hibernate.lombok.gradle.maven.webpack.vite.react.angular.vue.svelte.nuxt.express.fastapi.flask.django.rails.fiber.gin.actix.tokio.asyncio.junit.jest.mocha.pytest.rspec.docker.kubernetes.aws.gcp.azure.terraform.ansible.nginx.apache.linux.nextjs.remix.astro.sveltekit.gatsby.nuxtjs.qwik.solid.vercel.netlify.cloudflare.supabase.firebase.mongodb.postgres.prisma.drizzle.typeorm.sequelize.mongoose.redis.neon.trpc.graphql.grpc.rest.openapi.swagger.zod.yup.valibot.tailwind.shadcn.radix.headless.chakra.mantine.antd.mui.tanstack.tanstackquery.zustand.jotai.recoil.redux.mobx.storybook.cypress.playwright.vitest.turbopack.turborepo.getserversideprops.getstaticprops.getstaticpaths.generatestaticparams.generatemetadata.serveraction.revalidate.notfound.redirect.permanentredirect.unstablecache.unstablenostore.cookies.headers.userouter.usepathname.usesearchparams.useparams.useformstate.useformstatus.useoptimistic.useserveraction.classname.onclick.onchange.onsubmit.onfocus.onblur.onkeydown.onkeyup.onmousedown.onmouseup.defaultvalue.htmlfor.tabindex.strokewidth.viewbox.fillopacity.strokeopacity.pathdata.children.fragment.portal.suspense.errorboundary.strictmode.createelement.createcontext.createref.forwardref.usestate.useeffect.useref.usecontext.usememo.usecallback.usereducer.useid.usetransition.usedeferredvalue.useimperativehandle.mutex.lock.thread.goroutine.coroutine.channel.buffer.stream.pipe.observable.promise.future.completable.deferred.disposable.lifecycle.scope.annotation.attribute.metadata.reflection.generic.template.macro.preprocessor.compiler.runtime.debug.release.production.development.staging.build.deploy.lint.coverage.report.the.and.for.are.but.not.you.all.this.that.with.have.from.they.will.been.can.has.was.its.our.their.more.also.when.what.about.which.would.into.than.then.each.just.over.after.such.here.some.were.very.only`.split(`.`));function i(e){return n.has(e)||r.has(e)||e.length<3||/^\d+$/.test(e)||/^[^a-z]/.test(e)}function a(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).replace(/[_\-./]+/g,` `).toLowerCase().trim().split(/\s+/).filter(e=>e.length>=3)}function o(e){return e.toLowerCase().split(/[^a-zàâäéèêëïîôùûü]+/).filter(e=>e.length>=3)}let s=[{value:`adoc`,cat:`prose`},{value:`asciidoc`,cat:`prose`},{value:`asm`,cat:`code`},{value:`astro`,cat:`code`},{value:`avsc`,cat:`config`},{value:`bash`,cat:`code`},{value:`bat`,cat:`code`},{value:`bicep`,cat:`config`},{value:`c`,cat:`code`},{value:`cc`,cat:`code`},{value:`cfg`,cat:`config`},{value:`cjs`,cat:`code`},{value:`clj`,cat:`code`},{value:`cljs`,cat:`code`},{value:`cmake`,cat:`code`},{value:`cmd`,cat:`code`},{value:`conf`,cat:`config`},{value:`cpp`,cat:`code`},{value:`cql`,cat:`code`},{value:`cs`,cat:`code`},{value:`cshtml`,cat:`code`},{value:`css`,cat:`config`},{value:`cxx`,cat:`code`},{value:`dart`,cat:`code`},{value:`env`,cat:`config`},{value:`erb`,cat:`code`},{value:`erl`,cat:`code`},{value:`ex`,cat:`code`},{value:`exs`,cat:`code`},{value:`fish`,cat:`code`},{value:`fs`,cat:`code`},{value:`fsx`,cat:`code`},{value:`go`,cat:`code`},{value:`gql`,cat:`code`},{value:`gradle`,cat:`code`},{value:`graphql`,cat:`code`},{value:`groovy`,cat:`code`},{value:`h`,cat:`code`},{value:`hcl`,cat:`config`},{value:`hpp`,cat:`code`},{value:`hs`,cat:`code`},{value:`html`,cat:`config`},{value:`ini`,cat:`config`},{value:`java`,cat:`code`},{value:`jl`,cat:`code`},{value:`js`,cat:`code`},{value:`json`,cat:`config`},{value:`jsx`,cat:`code`,jsx:!0},{value:`kt`,cat:`code`},{value:`less`,cat:`config`},{value:`lua`,cat:`code`},{value:`m`,cat:`code`},{value:`md`,cat:`prose`,def:!0},{value:`mdx`,cat:`prose`},{value:`mjs`,cat:`code`},{value:`mk`,cat:`code`},{value:`ml`,cat:`code`},{value:`mli`,cat:`code`},{value:`mm`,cat:`code`},{value:`nim`,cat:`code`},{value:`php`,cat:`code`},{value:`pl`,cat:`code`},{value:`prisma`,cat:`code`},{value:`properties`,cat:`config`},{value:`proto`,cat:`code`},{value:`ps1`,cat:`code`},{value:`py`,cat:`code`},{value:`r`,cat:`code`},{value:`razor`,cat:`code`},{value:`rb`,cat:`code`},{value:`rs`,cat:`code`},{value:`rst`,cat:`prose`},{value:`s`,cat:`code`},{value:`scala`,cat:`code`},{value:`scss`,cat:`config`},{value:`sh`,cat:`code`},{value:`sol`,cat:`code`},{value:`sql`,cat:`code`},{value:`styl`,cat:`config`},{value:`svelte`,cat:`code`},{value:`swift`,cat:`code`},{value:`tex`,cat:`prose`},{value:`tf`,cat:`config`},{value:`tfvars`,cat:`config`},{value:`thrift`,cat:`code`},{value:`toml`,cat:`config`},{value:`ts`,cat:`code`},{value:`tsx`,cat:`code`,jsx:!0},{value:`txt`,cat:`prose`},{value:`v`,cat:`code`},{value:`vb`,cat:`code`},{value:`vue`,cat:`code`},{value:`xml`,cat:`config`},{value:`yaml`,cat:`config`},{value:`yml`,cat:`config`},{value:`zig`,cat:`code`},{value:`zsh`,cat:`code`}],c=new Set(s.filter(e=>e.cat===`prose`).map(e=>e.value)),l=new Set(s.filter(e=>e.cat===`code`).map(e=>e.value)),u=new Set(s.filter(e=>e.cat===`config`).map(e=>e.value)),d=new Set(s.filter(e=>e.jsx).map(e=>e.value));function f(e,t){let n=[];if(c.has(t)){let t=e.replace(/^\s*(import|export\s+\{[^}]*\}|export\s+\*|package|require|#include|from\s+['"][^'"]+['"]\s*(import)?)\b.*/gm,``).replace(/```[\s\S]*?```/g,` `).replace(/`[^`\n]+`/g,` `).replace(/!\[[^\]]*\]\([^)]*\)/g,` `).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/https?:\/\/\S+/g,` `).replace(/[#*_~>`|!\[\](){}=+\-]/g,` `);n.push(...o(t))}else l.has(t)?(d.has(t)&&(e=e.replace(/<\/?[A-Z][A-Za-z0-9.]*[^>]*>/g,` `),e=e.replace(/<\/?(div|span|main|section|article|aside|nav|header|footer|form|input|button|select|option|textarea|table|thead|tbody|tr|td|th|ul|ol|li|a|img|p|h[1-6]|label|figure|figcaption|picture|video|audio|canvas|svg|path|circle|rect|g|defs|use|link|meta|head|html|body|script|style|br|hr|strong|em|code|pre|blockquote|small|sub|sup)\b[^>]*>/gi,` `),e=e.replace(/\b(className|onClick|onChange|onSubmit|onFocus|onBlur|onKeyDown|onKeyUp|onMouseDown|onMouseUp|htmlFor|tabIndex|strokeWidth|viewBox|fillOpacity|strokeOpacity|defaultValue|placeholder|disabled|checked|readOnly|required|multiple|autoFocus|autoComplete|type|href|src|alt|width|height|style|key|ref)\s*=/g,` =`)),e=e.replace(/^\s*(import\s+[\w.*{},\s'"@/-]+;?|from\s+['"][^'"]+['"]\s*;?|package\s+[\w.]+;?|namespace\s+[\w.]+;?|using\s+[\w.]+;?|require\s*\(?\s*['"][^'"]+['"]\s*\)?;?)\s*$/gm,``),e.replace(/(?:\/\/|#(?!.*[{}[\]<>])| -- )\s*(.+)$/gm,(e,t)=>(n.push(...o(t)),e)),e.replace(/\/\*[\s\S]*?\*\//g,e=>(n.push(...o(e)),e)),e.replace(/"""[\s\S]*?"""|'''[\s\S]*?'''/g,e=>(n.push(...o(e)),e)),e.replace(/["'`]([A-Za-zÀ-ÿ][A-Za-zÀ-ÿ\s,.'éàèùâêîôûç]{3,})["'`]/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e))):u.has(t)&&(e.replace(/:\s*["']([^"']{3,})["']/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e)));return n.filter(e=>!i(e))}let p=F(``),m=F(``),h=F(1),g=F(``),_=F(!0),v=F(!1),y=F(L(s.map(e=>({value:e.value,label:`.`+e.value,checked:!!e.def}))));function b(){return H(y).filter(e=>e.checked).map(e=>e.value)}let x=P(()=>H(y).every(e=>e.checked)),S=F(null),C=F(null),w=F(0),T=F(null),E=F(L([])),D=F(L([])),ee=F(!1),O=F(``),te=F(0),k=F(L([]));function ne(){localStorage.setItem(`wc-exts`,JSON.stringify(b()))}function re(){let e=H(x);I(y,H(y).map(t=>({...t,checked:!e})),!0),ne()}function ie(){ne()}function ae(){return new Set((H(m)||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean))}function oe(e){let t=ae();t.has(e)||(t.add(e),I(m,[...t].join(`, `),!0),localStorage.setItem(`wc-exclude`,H(m)),H(de)&&ve(H(pe)),ce())}function se(){localStorage.setItem(`wc-exclude`,H(m)),H(de)&&ve(H(pe)),ce()}function ce(){H(ee)&&H(O)&&M(H(O))}function le(){H(S)&&je()}function ue(){let e=localStorage.getItem(`wc-root`);e&&(I(p,e,!0),I(Se,e,!0));let t=localStorage.getItem(`wc-exclude`);t&&I(m,t,!0);let n=localStorage.getItem(`wc-exts`);if(n)try{let e=JSON.parse(n);I(y,H(y).map(t=>({...t,checked:e.includes(t.value)})),!0)}catch{}}let de=F(!1),fe=F(null),pe=F(``),me=F(``),he=F(null),ge=F(``);function _e(){I(de,!H(de)),H(de)&&ve(H(pe)||H(p)||`/`)}async function ve(e){I(he,null),I(ge,`Loading…`);try{let t=await fetch(`/api/browse?all=1&path=`+encodeURIComponent(e)).then(e=>e.json());I(pe,t.current,!0),I(fe,t.parent,!0),I(me,t.current,!0);let n=H(p).trim(),r=(e,t)=>n&&e.startsWith(n+`/`)?e.slice(n.length+1):t,i=ae(),a=(t.dirs||[]).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`dir`,name:e.name,path:e.path,entry:r(e.path,e.name)})),o=b(),s=(t.files||[]).filter(e=>o.some(t=>e.name.endsWith(`.`+t))).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`file`,name:e.name,entry:r(e.path,e.name)})),c=[...a,...s];I(he,c,!0),I(ge,c.length?``:`Empty directory`,!0)}catch{I(he,[],!0),I(ge,`Cannot read directory`)}}function ye(){H(fe)&&ve(H(fe))}let be=F(!1),xe=F(null),Se=F(``),Ce=F(``),we=F(null),Te=F(``);function A(){I(be,!H(be)),H(be)&&Ee(H(Se)||H(p)||`/`)}async function Ee(e){I(we,null),I(Te,`Loading…`);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(Se,t.current,!0),I(xe,t.parent,!0),I(Ce,t.current,!0),I(we,(t.dirs||[]).map(e=>({name:e.name,path:e.path})),!0),I(Te,H(we).length?``:`No sub-folders`,!0)}catch{I(we,[],!0),I(Te,`Cannot read directory`)}}function De(){H(xe)&&Ee(H(xe))}function Oe(){I(p,H(Se),!0),localStorage.setItem(`wc-root`,H(Se)),I(be,!1),I(m,``),localStorage.removeItem(`wc-exclude`),I(pe,H(Se),!0)}let ke=F(null),Ae=F(null),j=F(!1);function je(){if(!H(S)||!H(C))return;let e=Math.max(1,H(h)||1),t=[...H(S).entries()].sort((e,t)=>t[1]-e[1]),n=t.filter(([t])=>(H(C).get(t)||new Set).size>=e).slice(0,150);if(!n.length){let n=t.length;I(g,n?`${n} domain word(s) found but none appear in ${e}+ file(s). Lower the "Min files" threshold to 1.`:`No domain words extracted. Try adding more file extensions or a broader folder.`,!0),I(_,!0),I(j,!1),I(v,!1);return}let r=[...H(S).keys()].filter(t=>(H(C).get(t)||new Set).size>=e).length;I(T,{scanned:H(w),unique:r,shown:n.length},!0);let i=n.slice(0,50),a=i[0][1];I(D,i.map(([e,t])=>({word:e,freq:t,pct:Math.round(t/a*100)})),!0),I(v,!0),I(_,!1);let o=document.documentElement.classList.contains(`dark`),s=o?[`#60a5fa`,`#34d399`,`#f9a8d4`,`#a78bfa`,`#fbbf24`,`#6ee7b7`,`#93c5fd`,`#fb923c`,`#4ade80`,`#f472b6`]:[`#1d4ed8`,`#047857`,`#7c3aed`,`#b45309`,`#be123c`,`#0369a1`,`#4338ca`,`#c2410c`,`#15803d`,`#9333ea`];requestAnimationFrame(()=>{if(!H(ke)||!H(Ae))return;let e=H(ke),t=H(Ae);e.width=Math.max(400,t.offsetWidth),e.height=Math.max(300,t.offsetHeight),e.style.width=e.width+`px`,e.style.height=e.height+`px`,I(j,!0);let n=Math.sqrt(e.width*e.height/(800*500)),r=Math.min(220,Math.round(72*n)),c=i.map(([e,t])=>[e,Math.max(12,Math.round(r*t/a))]);window.WordCloud?.(e,{list:c,gridSize:Math.round(4*e.width/1024),fontFamily:`ui-sans-serif, system-ui, sans-serif`,color:()=>s[Math.floor(Math.random()*s.length)],backgroundColor:o?`#030712`:`#ffffff`,rotateRatio:.2,minSize:6,shrinkToFit:!0,click:e=>M(e[0])})})}function M(e){if(!H(C)||!H(S))return;let t=[...H(C).get(e)||[]].sort(),n=H(S).get(e)||0;I(O,e,!0),I(te,n,!0),I(k,t,!0),I(ee,!0)}function Me(){I(ee,!1)}async function Ne(){let e=H(p).trim();if(!e){I(g,`Please select a root folder first.`),I(_,!0);return}let t=b();if(!t.length){I(g,`Please select at least one extension.`),I(_,!0);return}I(be,!1),I(v,!1),I(ee,!1),I(g,`Reading files…`),I(_,!0),I(j,!1);try{let n=H(m).trim(),r=n?n.split(/[\n,]/).map(e=>e.trim()).filter(Boolean):[];localStorage.setItem(`wc-exclude`,n);let i=new URLSearchParams({path:e});t.forEach(e=>i.append(`ext`,e)),r.forEach(e=>i.append(`exclude`,e));let a=await fetch(`/api/wordcloud?`+i);if(!a.ok){I(g,`Error: `+((await a.json()).error||a.statusText));return}let{files:o,fileTexts:s}=await a.json();I(g,`Analyzing ${o} file(s)…`);let c=new Map,l=new Map,u=new Set;I(w,o,!0);for(let{path:e,text:t}of s){let n=(e.split(`.`).pop()||``).toLowerCase();n&&u.add(n);let r=f(t,n),i=new Set;for(let t of r)c.set(t,(c.get(t)||0)+1),i.has(t)||(i.add(t),l.has(t)||l.set(t,new Set),l.get(t).add(e))}I(S,c,!0),I(C,l,!0),I(E,[...u].sort().map(e=>`.`+e),!0),je()}catch(e){I(g,`Error: `+e.message)}}let Pe=!1;On(()=>{t.open&&!Pe?(Pe=!0,I(g,`Choose a root folder and click Launch.`),I(_,!0),I(j,!1),I(v,!1),I(ee,!1),I(S,null),I(C,null),I(T,null),I(D,[],!0),I(be,!1),I(de,!1),I(h,1),ue(),H(p)||fetch(`/api/config`).then(e=>e.json()).then(e=>{e.docsFolder&&(I(p,e.docsFolder,!0),I(Se,e.docsFolder,!0))}).catch(()=>{})):t.open||(Pe=!1)});var Fe=Ur(),Ie=z(Fe),Le=e=>{var n=Fh(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o),N(r);var c=B(r,2),l=R(c),u=R(l),d=R(u,!0);N(u);var f=B(u,2);Ei(f);var b=B(f,2),S=B(R(b)),C=R(S,!0);N(S),N(b);var w=B(b,2),ne=R(w,!0);N(w),N(l);var ae=B(l,2),ce=R(ae),ue=R(ce,!0);N(ce);var pe=B(ce,2);vn(pe);var Se=B(pe,2),je=B(R(Se)),Pe=R(je,!0);N(je),N(Se),N(ae);var Fe=B(ae,2),Ie=e=>{var t=Sh(),n=R(t),r=R(n),i=B(r,2),a=R(i,!0);N(i),N(n);var o=B(n,2),s=R(o),c=e=>{var t=vh(),n=R(t,!0);N(t),V(()=>K(n,H(ge))),G(e,t)},l=e=>{var t=yh(),n=R(t,!0);N(t),V(()=>{hi(t,1,`px-3 py-3 text-xs ${H(ge)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),K(n,H(ge))}),G(e,t)},u=e=>{var t=Ur();$r(z(t),17,()=>H(he),Yr,(e,t)=>{var n=Ur(),r=z(n),i=e=>{var n=bh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,r,()=>ve(H(t).path)),U(`click`,o,()=>oe(H(t).entry)),G(e,n)},a=e=>{var n=xh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,o,()=>oe(H(t).entry)),G(e,n)};q(r,e=>{H(t).kind===`dir`?e(i):e(a,-1)}),G(e,n)}),G(e,t)};q(s,e=>{H(he)===null?e(c):H(he).length===0?e(l,1):e(u,-1)}),N(o),N(t),V(()=>{r.disabled=!H(fe),K(a,H(me))}),U(`click`,r,ye),G(e,t)};q(Fe,e=>{H(de)&&e(Ie)});var Le=B(Fe,2),Re=R(Le),ze=R(Re,!0);N(Re);var Be=B(Re,2),Ve=R(Be);Ei(Ve);var He=B(Ve);N(Be),$r(B(Be,2),17,()=>H(y),e=>e.value,(e,t,n)=>{var r=Ch(),i=R(r);Ei(i);var a=B(i);N(r),V(()=>K(a,` ${H(t).label??``}`)),U(`change`,i,ie),Ni(i,()=>H(t).checked,e=>H(t).checked=e),G(e,r)}),N(Le);var Ue=B(Le,2),We=e=>{var t=Sh(),n=R(t),r=R(n),i=B(r,2),a=R(i,!0);N(i),N(n);var o=B(n,2),s=R(o),c=e=>{var t=vh(),n=R(t,!0);N(t),V(()=>K(n,H(Te))),G(e,t)},l=e=>{var t=Eh(),n=z(t),r=e=>{var t=yh(),n=R(t,!0);N(t),V(()=>{hi(t,1,`px-3 py-3 text-xs ${H(Te)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),K(n,H(Te))}),G(e,t)},i=e=>{var t=Ur();$r(z(t),17,()=>H(we),Yr,(e,t)=>{var n=wh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,r,()=>Ee(H(t).path)),U(`click`,o,()=>oe(H(t).name)),G(e,n)}),G(e,t)};q(n,e=>{H(we).length===0?e(r):e(i,-1)});var a=B(n,2),o=e=>{var t=Th(),n=B(R(t)),r=R(n,!0);N(n),N(t),V(()=>K(r,H(Ce))),U(`click`,t,Oe),G(e,t)};q(a,e=>{H(Te)!==`Cannot read directory`&&e(o)}),G(e,t)};q(s,e=>{H(we)===null?e(c):e(l,-1)}),N(o),N(t),V(()=>{r.disabled=!H(xe),K(a,H(Ce))}),U(`click`,r,De),G(e,t)};q(Ue,e=>{H(be)&&e(We)}),N(c);var Ge=B(c,2),Ke=R(Ge),qe=e=>{var t=Ah(),n=R(t),r=R(n),i=e=>{var t=Oh(),n=z(t),r=R(n);N(n);var i=B(n,2),a=R(i);N(i);var o=B(i,2),s=R(o);N(o);var c=B(o,2),l=e=>{var t=Dh(),n=R(t);N(t),V((e,r)=>{J(t,`title`,e),K(n,`${H(E).length??``} extension${H(E).length>1?`s`:``} found (${r??``})`)},[()=>H(E).join(`, `),()=>H(E).join(`, `)]),G(e,t)};q(c,e=>{H(E).length&&e(l)}),V(()=>{K(r,`${H(T).scanned??``} file(s) scanned`),K(a,`${H(T).unique??``} unique domain words`),K(s,`${H(T).shown??``} shown`)}),G(e,t)};q(r,e=>{H(T)&&e(i)}),N(n);var a=B(n,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2);Ei(c);var l=B(c,2),u=R(l,!0);N(l),N(a);var d=B(a,2),f=R(d,!0);N(d);var p=B(d,2);$r(p,21,()=>H(D),Yr,(e,t,n)=>{var r=kh(),i=R(r);i.textContent=n+1;var a=B(i,2),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,2),u=R(l,!0);N(l),N(o);var d=B(o,2),f=R(d);N(d),N(a),N(r),V(()=>{K(c,H(t).word),K(u,H(t).freq),_i(f,`width:${H(t).pct??``}%`)}),U(`click`,r,()=>M(H(t).word)),G(e,r)}),N(p),N(t),V((e,t,n,r,i,a)=>{J(o,`title`,e),K(s,t),J(c,`title`,n),J(l,`title`,r),K(u,i),K(f,a)},[()=>Y(`wc.min_files_hint`),()=>Y(`wc.min_files_label`),()=>Y(`wc.min_files_hint`),()=>Y(`wc.apply_hint`),()=>Y(`wc.apply_btn`),()=>Y(`wc.top_words`)]),Mi(c,()=>H(h),e=>I(h,e)),U(`click`,l,le),G(e,t)};q(Ke,e=>{H(v)&&e(qe)});var Je=B(Ke,2),Ye=R(Je),Xe=e=>{var t=jh(),n=R(t,!0);N(t),V(()=>K(n,H(g))),G(e,t)};q(Ye,e=>{H(_)&&e(Xe)});var Ze=B(Ye,2);let Qe;Li(Ze,e=>I(ke,e),()=>H(ke)),N(Je),Li(Je,e=>I(Ae,e),()=>H(Ae));var $e=B(Je,2),et=e=>{var t=Ph(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2);N(n);var o=B(n,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=e=>{var t=Ur();$r(z(t),17,()=>H(k),Yr,(e,t)=>{var n=Mh(),r=R(n),i=R(r,!0);N(r);var a=B(r,2);N(n),V(()=>K(i,H(t))),U(`click`,a,()=>oe(H(t))),G(e,n)}),G(e,t)},d=e=>{G(e,Nh())};q(l,e=>{H(k).length?e(u):e(d,-1)}),N(c),N(t),V(e=>{K(i,`${H(O)??``} ×${H(te)??``}`),K(s,e)},[()=>Y(`wc.found_in`)]),U(`click`,a,Me),G(e,t)};q($e,e=>{H(ee)&&e(et)}),N(Ge),N(n),V((e,t,n,r,i,o,c,l,u,f)=>{K(a,e),K(s,t),K(d,n),K(C,r),K(ne,i),K(ue,o),J(pe,`placeholder`,c),K(Pe,l),K(ze,u),Oi(Ve,H(x)),K(He,` ${f??``}`),Qe=hi(Ze,1,``,null,Qe,{hidden:!H(j)})},[()=>Y(`wc.title`),()=>Y(`wc.close_btn`),()=>Y(`wc.search_root_label`),()=>Y(`wc.browse_btn`),()=>Y(`wc.launch_btn`),()=>Y(`wc.exclude_label`),()=>Y(`wc.exclude_placeholder`),()=>Y(`wc.browse_btn`),()=>Y(`wc.extensions_label`),()=>Y(`wc.all_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),Mi(f,()=>H(p),e=>I(p,e)),U(`click`,b,A),U(`click`,w,Ne),U(`input`,pe,se),Mi(pe,()=>H(m),e=>I(m,e)),U(`click`,Se,_e),U(`change`,Ve,re),G(e,n)};q(Ie,e=>{t.open&&e(Le)}),G(e,Fe),Ke()}Nr([`click`,`input`,`change`]);var Lh=W(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button> <button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`,1),Rh=W(`<div class="relative hidden sm:block"><input type="search" class="w-56 pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div>`),zh=W(`<p class="p-8 text-red-500"> </p>`),Bh=W(`<div class="h-full flex items-center justify-center p-8"><div class="max-w-md text-center"><div class="text-5xl mb-4 select-none" aria-hidden="true">📚</div> <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-300 mb-2"> </h2> <p class="text-sm text-gray-500 dark:text-gray-500"> </p> <p class="mt-4 text-xs text-gray-400 dark:text-gray-600 font-mono bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 inline-block"> </p> <p class="mt-2 text-xs text-gray-400"> </p></div></div>`),Vh=W(`<div class="app-shell bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100"><!> <div class="flex overflow-hidden"><!> <main id="home-content-area" class="flex-1 overflow-y-auto"><!></main></div></div> <!> <!> <!> <!>`,1);function Hh(e,t){Ge(t,!0);let n=F(!1),r=F(!1),i=F(!1),a=F(!1),o=F(null),s=F(!1),c=F(``),l=F(!1),u=F(`Living AI Documentation`),d=F(`YYYY_MM_DD_HH_mm_[Category]_title.md`),f=null;function p(){try{let e=localStorage.getItem(`ld-dark`);if(e!==null)return e===`true`}catch{}return window.matchMedia(`(prefers-color-scheme: dark)`).matches}function m(e){I(l,e,!0),document.documentElement.classList.toggle(`dark`,e)}function h(){m(!H(l));try{localStorage.setItem(`ld-dark`,String(H(l)))}catch{}}On(()=>{let e=document.getElementById(`hljs-dark`),t=document.getElementById(`hljs-light`);if(!e||!t)return;let n=$.codeBlockLightTheme&&!H(l);e.disabled=n,t.disabled=!n,document.body.classList.toggle(`ld-code-light`,n)});function g(e){let t=e.trim();if(f&&clearTimeout(f),!t){$.searchQuery=``,$.searchResults=null;return}$.searchQuery=t,$.searchResults=$.allDocs.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())||e.category.toLowerCase().includes(t.toLowerCase())),f=window.setTimeout(async()=>{try{let e=await Fu(t);t===$.searchQuery&&($.searchResults=e)}catch{}},350)}let _=F(L([]));function v(e){let t=H(_)[e];t&&(I(_,H(_).slice(0,e),!0),y(t.id,!1,`restore`))}async function y(e,t=!1,n=!1,r=null){if(n===!0&&$.currentDocId&&$.currentDocId!==e){let t=H(_).findIndex(t=>t.id===e);if(t!==-1)I(_,H(_).slice(0,t),!0);else{let e=$.allDocs.find(e=>e.id===$.currentDocId);I(_,[...H(_),{id:$.currentDocId,title:e?e.title:$.currentDocId}],!0)}}else n||I(_,[],!0);$.currentDocId=e;let i=$.allDocs.find(t=>t.id===e);if(i&&$.revealDoc(i),!t){let t=new URL(location.href);t.searchParams.set(`doc`,e),t.hash=r?`#${r}`:``,history.pushState({docId:e,anchor:r||null},``,t)}I(s,!0),I(c,``);try{let t=await ju(e);t.id=e,I(o,t,!0),document.title=t.title,requestAnimationFrame(()=>{let e=document.getElementById(`home-content-area`);if(r){let t=document.getElementById(r);t&&e&&(e.scrollTop+=t.getBoundingClientRect().top-e.getBoundingClientRect().top-80)}else e&&(e.scrollTop=0)})}catch(e){I(c,Y(`doc.failed_to_load`)+(e instanceof Error?e.message:String(e)))}finally{I(s,!1)}}async function b(e){if(!H(o))return;let t=H(o).id,n=await fetch(`/api/documents/`+t,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:e})});if(!n.ok)throw Error(await n.text());let r=await ju(t);r.id=t,I(o,r,!0);let i=e.match(/\]\(\s*\.?\/files\/[^)\s]+/g),a={...$.fileAttachmentCounts};i&&i.length?a[t]=i.length:delete a[t],$.fileAttachmentCounts=a}async function x(){if(!H(o))return;let e=H(o).id;if(!(await fetch(`/api/documents/`+encodeURIComponent(e),{method:`DELETE`})).ok)return;$.allDocs=$.allDocs.filter(t=>t.id!==e),Array.isArray($.searchResults)&&($.searchResults=$.searchResults.filter(t=>t.id!==e));let t={...$.annotationCounts};delete t[e],$.annotationCounts=t;let n={...$.fileAttachmentCounts};delete n[e],$.fileAttachmentCounts=n,$.currentDocId=null,I(o,null),history.pushState({},``,location.pathname)}async function S(){let[e,t]=await Promise.all([ku(),Ou()]);if($.allDocs=e,t.docsFolder)try{$.allFolderPaths=await Au(t.docsFolder)}catch{$.allFolderPaths=[]}let[n,r,i]=await Promise.all([Mu(),Nu(),Pu()]);$.annotationCounts=n,$.fileAttachmentCounts=r,$.docStatuses=i}Vi(async()=>{m(p());let e=await Ou();await fa(e.language||`en`),e.title&&(document.title=e.title,I(u,e.title,!0)),e.filenamePattern&&I(d,e.filenamePattern+`.md`),$.exclusiveFolderExpansion=!!e.exclusiveFolderExpansion,$.exclusiveCategoryExpansion=!!e.exclusiveCategoryExpansion,$.codeBlockMaxHeight=typeof e.codeBlockMaxHeight==`number`?e.codeBlockMaxHeight:400,$.imageRoundedCorners=!!e.imageRoundedCorners,$.imageCentered=!!e.imageCentered,$.imageBorder=!!e.imageBorder,$.codeBlockLightTheme=!!e.codeBlockLightTheme,$.codeBlockMaxHeight>0&&document.documentElement.style.setProperty(`--ld-code-max-h`,$.codeBlockMaxHeight+`px`),$.expandedCategories.size===0&&($.expandedCategories=new Set([`General`])),await S();let t=new URLSearchParams(location.search).get(`doc`);if(t)y(t,!0,!1,location.hash?location.hash.slice(1):null);else{let e=$.allDocs.find(e=>e.category===`General`)??$.allDocs[0];e&&y(e.id,!0)}let n=e=>{let t=e.state?.docId||new URLSearchParams(location.search).get(`doc`),n=e.state?.anchor||(location.hash.length>1?location.hash.slice(1):null);t&&y(t,!0,!1,n)};return window.addEventListener(`popstate`,n),()=>window.removeEventListener(`popstate`,n)});var C=Vh(),w=z(C),T=R(w);ua(T,{get title(){return H(u)},subtitle:``,actions:e=>{var t=Lh(),n=z(t),r=B(n,2),i=R(r,!0);N(r),V((e,t)=>{J(n,`title`,e),J(n,`aria-label`,t),K(i,H(l)?`☀`:`☾`)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),U(`click`,n,()=>I(a,!0)),U(`click`,r,h),G(e,t)},children:(e,t)=>{var n=Rh(),r=R(n);Ei(r),Pe(2),N(n),V(e=>{J(r,`placeholder`,e),Di(r,$.searchQuery)},[()=>Y(`nav.search_placeholder`)]),U(`input`,r,e=>g(e.target.value)),G(e,n)},$$slots:{actions:!0,default:!0}});var E=B(T,2),D=R(E);sd(D,{onopen:e=>y(e),onsearch:g,onexport:()=>I(i,!0),onnewfolder:()=>I(n,!0),onnewdoc:()=>I(r,!0)});var ee=B(D,2),O=R(ee),te=e=>{var t=Ur(),n=z(t),r=e=>{var t=zh(),n=R(t,!0);N(t),V(()=>K(n,H(c))),G(e,t)},i=e=>{Km(e,{get doc(){return H(o)},get navHistory(){return H(_)},ongoback:v,onopen:(e,t)=>y(e,!1,!0,t),onsave:b,ondelete:x})};q(n,e=>{H(c)?e(r):e(i,-1)}),G(e,t)},k=e=>{var t=Bh(),n=R(t),r=B(R(n),2),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a);var s=B(a,2),c=R(s,!0);N(s);var l=B(s,2),u=R(l,!0);N(l),N(n),N(t),V((e,t,n)=>{K(i,e),K(o,t),K(c,H(d)),K(u,n)},[()=>Y(`welcome.title`),()=>Y(`welcome.hint`),()=>Y(`welcome.pattern_hint`)]),G(e,t)};q(O,e=>{H(o)?e(te):e(k,-1)}),N(ee),N(E),N(w);var ne=B(w,2);eh(ne,{get open(){return H(n)},onclose:()=>I(n,!1),onsuccess:S});var re=B(ne,2);lh(re,{get open(){return H(r)},onclose:()=>I(r,!1),onsuccess:async e=>{await S(),y(e)}});var ie=B(re,2);_h(ie,{get open(){return H(i)},onclose:()=>I(i,!1)}),Ih(B(ie,2),{get open(){return H(a)},onclose:()=>I(a,!1)}),G(e,C),Ke()}Nr([`click`,`input`]);var Uh=`modulepreload`,Wh=function(e){return`/`+e},Gh={},Kh=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Wh(t,n),t in Gh)return;Gh[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Uh,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},qh=W(`<div class="flex flex-col h-screen overflow-hidden bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100"><header class="flex items-center gap-1 px-2 h-12 shrink-0 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm z-10"><button class="tool-btn !w-auto px-2 text-xs font-medium text-gray-500 dark:text-gray-400"> </button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSidebar" class="tool-btn">☰</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnCopyDiagramId" class="tool-btn"><svg width="15" height="15" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="9" rx="1.5"></rect><path d="M3 11V3a1 1 0 0 1 1-1h7"></path></svg></button> <button id="toolSelect" class="tool-btn tool-active"><svg width="11" height="13" viewBox="0 0 11 13" fill="currentColor" stroke="none"><path d="M1 1 L1 12 L4 9 L6.5 13 L8 12.2 L5.5 8.2 L10 8.2 Z"></path></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolBox" class="tool-btn"><svg width="15" height="10" viewBox="0 0 15 10" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="1" width="13" height="8" rx="1"></rect></svg></button> <button id="toolEllipse" class="tool-btn"><svg width="16" height="10" viewBox="0 0 16 10" fill="none" stroke="currentColor" stroke-width="1.5"><ellipse cx="8" cy="5" rx="7" ry="4"></ellipse></svg></button> <button id="toolDatabase" class="tool-btn"><svg width="12" height="16" viewBox="0 0 12 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><ellipse cx="6" cy="3" rx="5" ry="2"></ellipse><path d="M1 3v10c0 1.1 2.2 2 5 2s5-.9 5-2V3"></path><path d="M11 7.5c0 1.1-2.2 2-5 2s-5-.9-5-2"></path></svg></button> <button id="toolCircle" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="6.5" cy="6.5" r="5.5"></circle></svg></button> <button id="toolActor" class="tool-btn"><svg width="12" height="17" viewBox="0 0 12 17" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="6" cy="3" r="2.2"></circle><line x1="6" y1="5.2" x2="6" y2="10"></line><line x1="1.5" y1="7.5" x2="10.5" y2="7.5"></line><line x1="6" y1="10" x2="2.5" y2="15"></line><line x1="6" y1="10" x2="9.5" y2="15"></line></svg></button> <button id="toolPostIt" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M1 1 H9 L12 4 V12 H1 Z"></path><path d="M9 1 V4 H12" stroke-opacity="0.5"></path></svg></button> <button id="toolTextFree" class="tool-btn" style="font-size:11px; font-weight:600;">T</button> <button id="toolImage" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" rx="1.5"></rect><circle cx="4.5" cy="4.5" r="1.2"></circle><path d="M1 9.5 L4 6.5 L6.5 9 L9 7 L13 10.5"></path></svg></button> <a href="/shape-editor" class="tool-btn">✦</a> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolArrow" class="tool-btn">→</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDelete" class="tool-btn"><svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="1" y1="1" x2="10" y2="10"></line><line x1="10" y1="1" x2="1" y2="10"></line></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDiagramDefaults" class="tool-btn"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button> <button id="btnAlign" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4"><line x1="0.5" y1="7.5" x2="13.5" y2="7.5"></line><line x1="3.5" y1="0.5" x2="3.5" y2="13.5" stroke-dasharray="1.5 1.5"></line><line x1="10.5" y1="0.5" x2="10.5" y2="13.5" stroke-dasharray="1.5 1.5"></line></svg></button> <button id="btnGrid" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.2"><line x1="5" y1="1" x2="5" y2="13"></line><line x1="9" y1="1" x2="9" y2="13"></line><line x1="1" y1="5" x2="13" y2="5"></line><line x1="1" y1="9" x2="13" y2="9"></line><rect x="1" y="1" width="12" height="12" rx="1"></rect></svg></button> <button id="btnEdgeStraight" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="12" x2="12" y2="2"></line><polyline points="8,2 12,2 12,6"></polyline></svg></button> <button id="btnEvidenceMode" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 1.5 H8.5 L11 4 V12.5 H4 Z"></path><path d="M8.5 1.5 V4 H11"></path><path d="M1.5 5.5 H6.5"></path><path d="M1.5 8 H6.5"></path><path d="M1.5 10.5 H5"></path></svg></button> <button id="btnResizeMode" class="tool-btn active-tool"><svg id="icon-resize-corner" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="7,10 10,10 10,7"></polyline></svg> <svg id="icon-resize-center" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="hidden"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="4,6.5 4,4 6.5,4"></polyline><polyline points="10,7.5 10,10 7.5,10"></polyline><line x1="10" y1="4" x2="4" y2="10"></line><polyline points="7.5,4 10,4 10,6.5"></polyline><polyline points="4,7.5 4,10 6.5,10"></polyline></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <input id="diagramTitle" type="text" class="flex-1 min-w-0 px-2 py-1 text-sm bg-transparent border-0 focus:outline-none focus:ring-1 focus:ring-blue-500 rounded text-gray-700 dark:text-gray-300 placeholder:text-gray-400"/> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnZoomOut" class="tool-btn">−</button> <span id="zoomLevel" class="text-xs text-gray-500 dark:text-gray-400 w-10 text-center tabular-nums select-none">100%</span> <button id="btnZoomIn" class="tool-btn">+</button> <button id="btnZoomReset" class="tool-btn">⊡</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDark" class="tool-btn"><span id="darkIcon">☽</span></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDebug" class="hidden tool-btn text-xs font-mono">dbg</button> <div id="sepDebug" class="hidden w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnExportDrawio" class="tool-btn"><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" aria-hidden="true"><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></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSave" disabled="" class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed shrink-0 transition-colors"><span> </span></button></header> <div class="flex flex-1 overflow-hidden"><div id="sidebar" class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex flex-col overflow-hidden" style="transition: width 0.2s ease"><div class="flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700 shrink-0"><span class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider"> </span> <button id="btnNewDiagram" class="text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors"> </button></div> <div id="diagramList" class="flex-1 overflow-y-auto py-1"></div></div> <div role="separator" aria-orientation="vertical"></div> <div class="relative flex-1 overflow-hidden bg-gray-50 dark:bg-gray-950"><div id="vis-canvas" class="w-full h-full"></div> <div id="customShapeBar" class="hidden"><div id="customShapeBarBody"></div></div> <div id="debugLayer"></div> <div id="evidenceLayer" class="hidden"></div> <div id="stampOverlay" style="position:absolute;inset:0;display:none;z-index:11;cursor:crosshair;"></div> <div id="selectionOverlay"><div id="rh-tl" class="resize-handle" style="top: -5px; left: -5px; cursor: nw-resize"></div> <div id="rh-tr" class="resize-handle" style="top: -5px; right: -5px; cursor: ne-resize"></div> <div id="rh-bl" class="resize-handle" style="bottom: -5px; left: -5px; cursor: sw-resize"></div> <div id="rh-br" class="resize-handle" style="bottom: -5px; right: -5px; cursor: se-resize"></div> <div id="rh-rotate">↻</div> <div id="rh-label-rotate" style="left: 0; top: -28px;"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><g transform="rotate(25,5,5)"><line x1="2.5" y1="3" x2="7.5" y2="3"></line><line x1="5" y1="3" x2="5" y2="8"></line></g></svg></div></div> <aside id="evidencePanel" class="hidden absolute top-0 right-0 bottom-0 w-80 max-w-[85vw] z-30 bg-gray-50 dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl flex flex-col"><div class="flex items-center justify-between gap-2 px-4 py-3 border-b border-gray-200 dark:border-gray-700"><h2 id="evidencePanelTitle" class="text-sm font-semibold text-gray-800 dark:text-gray-100"> </h2> <button id="btnEvidenceClose" class="tool-btn !w-7 !h-7">×</button></div> <div id="evidencePanelBody" class="flex-1 overflow-y-auto p-3 space-y-3"></div></aside> <div id="nodePanel" class="float-panel hidden"><button id="btnNodeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="nodePanelControls" class="contents"><button id="nodeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#f5f5f4;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <input id="nodeBgOpacity" type="range" min="0" max="100" step="5" value="100" class="w-16 h-1 accent-orange-500 cursor-pointer"/> <div class="panel-sep"></div> <button id="btnNodeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnNodeLink" class="tool-btn !w-6 !h-6"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7.5a3.5 3.5 0 0 0 5 0l1.5-1.5a3.5 3.5 0 0 0-5-5L5 2.5"></path><path d="M8 5.5a3.5 3.5 0 0 0-5 0L1.5 7a3.5 3.5 0 0 0 5 5L8 10.5"></path></svg></button> <div class="panel-sep"></div> <button id="btnNodeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="nodeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">13</span> <button id="btnNodeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnAlignLeft" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="1" y1="5" x2="7" y2="5"></line><line x1="1" y1="8" x2="9" y2="8"></line></svg></button> <button id="btnAlignCenter" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="2.5" y1="5" x2="9.5" y2="5"></line><line x1="1.5" y1="8" x2="10.5" y2="8"></line></svg></button> <button id="btnAlignRight" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="5" y1="5" x2="11" y2="5"></line><line x1="3" y1="8" x2="11" y2="8"></line></svg></button> <div class="panel-sep"></div> <button id="btnValignTop" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="1.5" x2="9" y2="1.5" stroke-width="2"></line><line x1="1" y1="5" x2="8" y2="5" stroke-width="1.3"></line><line x1="1" y1="8.5" x2="6" y2="8.5" stroke-width="1.3"></line></svg></button> <button id="btnValignMiddle" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="2.5" x2="8" y2="2.5" stroke-width="1.3"></line><line x1="1" y1="6" x2="9" y2="6" stroke-width="2"></line><line x1="1" y1="9.5" x2="6" y2="9.5" stroke-width="1.3"></line></svg></button> <button id="btnValignBottom" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="3.5" x2="8" y2="3.5" stroke-width="1.3"></line><line x1="1" y1="7" x2="6" y2="7" stroke-width="1.3"></line><line x1="1" y1="10.5" x2="9" y2="10.5" stroke-width="2"></line></svg></button> <div class="panel-sep"></div> <div id="customShapeLabelPlacementControls" class="hidden"><button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="above">T↑</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="below">T↓</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="left">←T</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="right">T→</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="center">T□</button> <div class="panel-sep"></div></div> <button id="btnZOrderBack" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1"></rect><rect x="5" y="1" width="8" height="8" rx="1" stroke-opacity="0.35"></rect></svg></button> <button id="btnZOrderFront" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1" stroke-opacity="0.35"></rect><rect x="5" y="1" width="8" height="8" rx="1"></rect></svg></button> <div class="panel-sep"></div> <button id="btnStampColor" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M7 2 C7 2 3 6.5 3 9 a4 4 0 0 0 8 0 C11 6.5 7 2 7 2 Z" fill="currentColor" fill-opacity="0.25"></path></svg></button> <button id="btnStampFontSize" class="tool-btn !w-7 !h-6 font-mono text-xs font-bold">Aa</button> <button id="btnStampSize" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="6" height="6" rx="0.8" fill="currentColor" fill-opacity="0.25"></rect><path d="M10 2 L12 2 L12 4"></path><path d="M12 2 L9 5"></path><path d="M10 12 L12 12 L12 10"></path><path d="M12 12 L9 9"></path></svg></button> <div class="panel-sep"></div> <button id="btnRotateCCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↺</button> <button id="btnRotateCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↻</button> <div class="panel-sep"></div> <button id="btnCopyPng" class="tool-btn !h-6 px-1.5 font-mono text-xs font-semibold flex items-center gap-0.5"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="7" x2="5" y2="1"></line><polyline points="2,4 5,1 8,4"></polyline><line x1="1" y1="9" x2="9" y2="9"></line></svg> PNG</button> <div class="panel-sep"></div> <button id="btnGroup" class="tool-btn !w-8 !h-7"><svg width="22" height="14" viewBox="0 0 22 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="20.6" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="4" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="15" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <button id="btnUngroup" class="tool-btn !w-8 !h-7"><svg width="26" height="14" viewBox="0 0 26 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="3" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="16.3" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="19" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <div class="panel-sep"></div> <button id="btnSaveShapeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <div id="linkPanel" class="float-panel hidden" style="min-width:260px; flex-direction:column; align-items:stretch; gap:0.5rem; padding:0.75rem;"><div class="text-xs font-semibold text-gray-500 dark:text-gray-400 mb-1"> </div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeUrl" value="url" class="accent-orange-500"/> <span> </span></label> <div id="linkUrlRow"><input id="linkUrlInput" type="url" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeDiagram" value="diagram" class="accent-orange-500"/> <span> </span></label> <div id="linkDiagramRow" class="hidden"><select id="linkDiagramSelect" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"></select></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeNew" value="new" class="accent-orange-500"/> <span> </span></label> <div id="linkNewRow" class="hidden"><input id="linkNewName" type="text" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <div class="flex gap-1 mt-1"><button id="btnLinkSave" class="flex-1 text-xs bg-orange-500 hover:bg-orange-600 text-white rounded px-2 py-1"> </button> <button id="btnLinkRemove" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600"> </button> <button id="btnLinkCancel" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-700">✕</button></div></div> <div id="edgePanel" class="float-panel hidden"><button id="btnEdgeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="edgePanelControls" class="contents"><button id="edgeBtnNone" class="tool-btn !w-7 !h-6 font-mono text-xs">—</button> <button id="edgeBtnFrom" class="tool-btn !w-7 !h-6 text-xs">←</button> <button id="edgeBtnTo" class="tool-btn !w-7 !h-6 text-xs">→</button> <button id="edgeBtnBoth" class="tool-btn !w-8 !h-6 text-xs">←→</button> <div class="panel-sep"></div> <button id="edgeBtnSolid" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line></svg></button> <button id="edgeBtnDashed" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-dasharray="4,3"></line></svg></button> <div class="panel-sep"></div> <button id="btnEdgeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="edgeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">11</span> <button id="btnEdgeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnEdgeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnEdgeLabelWidthReset" class="tool-btn !w-6 !h-6 text-xs">↔</button> <div class="panel-sep"></div> <button id="btnEdgeLabelRotateCCW" class="tool-btn !w-7 !h-6 text-sm">↺</button> <button id="btnEdgeLabelRotateCW" class="tool-btn !w-7 !h-6 text-sm">↻</button> <div class="panel-sep"></div> <button id="btnEdgeLabelOffsetLeft" class="tool-btn !w-6 !h-6 text-sm">←</button> <button id="btnEdgeLabelOffsetRight" class="tool-btn !w-6 !h-6 text-sm">→</button> <button id="btnEdgeLabelOffsetUp" class="tool-btn !w-6 !h-6 text-sm">↑</button> <button id="btnEdgeLabelOffsetDown" class="tool-btn !w-6 !h-6 text-sm">↓</button> <button id="btnEdgeLabelOffsetReset" class="tool-btn !w-6 !h-6 text-xs">⊙</button> <div class="panel-sep"></div> <button id="btnEdgeWidthDecrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W−</button> <button id="btnEdgeWidthIncrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W+</button> <div class="panel-sep"></div> <button id="edgeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#a8a29e;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <button id="btnEdgeClearPorts" class="tool-btn !w-8 !h-6 text-xs">⊗</button> <div class="panel-sep"></div> <button id="btnSaveEdgeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <textarea id="labelInput" class="hidden" rows="1"></textarea> <div id="emptyState" class="absolute inset-0 flex flex-col items-center justify-center text-gray-400 dark:text-gray-600 pointer-events-none select-none"><svg width="52" height="44" viewBox="0 0 52 44" fill="none" stroke="currentColor" stroke-width="1.5" class="mb-3 opacity-50"><rect x="2" y="4" width="18" height="12" rx="2"></rect><rect x="32" y="28" width="18" height="12" rx="2"></rect><line x1="20" y1="10" x2="32" y2="34" stroke-dasharray="4,3"></line><rect x="17" y="16" width="18" height="12" rx="2"></rect><line x1="26" y1="16" x2="26" y2="10" stroke-dasharray="4,3"></line></svg> <p class="text-sm"> </p></div></div></div> <div id="toastContainer"></div> <div id="imageNameModal" style="display:none;position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,0.5);" class="flex items-center justify-center"><div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl p-6 w-80 flex flex-col gap-3"><p class="text-sm font-semibold text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-400 dark:text-gray-500">Lettres, chiffres, <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">_</code> et <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">-</code> uniquement.
|
|
135
135
|
Laisser vide pour un nom automatique.</p> <div class="flex items-center gap-1"><input id="imageNameInput" type="text" autocomplete="off" spellcheck="false" class="flex-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700
|
|
136
136
|
text-gray-900 dark:text-gray-100 text-sm px-2 py-1 outline-none focus:ring-2 focus:ring-blue-400"/> <span class="text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap">.png</span></div> <p id="imageNameError" class="text-xs text-red-500 hidden"> </p> <div class="flex gap-2 justify-end"><button id="imageNameCancel" class="px-3 py-1 text-xs rounded border border-gray-300 dark:border-gray-600
|
|
137
|
-
text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"> </button> <button id="imageNameConfirm" class="px-3 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600"> </button></div></div></div></div>`);function Nh(e,t){Ge(t,!0),Vi(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await fa(t);let{initDiagram:r}=await jh(async()=>{let{initDiagram:e}=await import(`./main-BIFGig6a.js`);return{initDiagram:e}},[]);e=r();let i=document.getElementById(`sidebar`),a=parseInt(localStorage.getItem(n)||``,10);i&&Number.isFinite(a)&&(i.style.width=a+`px`)})(),()=>e?.()});let n=`ld-diagram-sidebar-w`,r=F(!1);function i(e){e.preventDefault();let t=document.getElementById(`sidebar`);if(!t)return;let i=e.clientX,a=t.getBoundingClientRect().width;I(r,!0),t.style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let o=e=>{let n=Math.max(160,Math.min(480,a+e.clientX-i));t.style.width=n+`px`},s=()=>{document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s),document.body.style.cursor=``,document.body.style.userSelect=``,I(r,!1),t.style.transition=``;try{localStorage.setItem(n,String(parseInt(t.style.width,10)))}catch{}};document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s)}var a=Mh(),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,4),u=B(l,4),d=B(u,2),f=B(d,4),p=B(f,2),m=B(p,2),h=B(m,2),g=B(h,2),_=B(g,2),v=B(_,2),y=B(v,2),b=B(y,2),x=B(b,4),S=B(x,4),C=B(S,4),w=B(C,2),T=B(w,2),E=B(T,2),D=B(E,2),ee=B(D,2),O=B(ee,4),te=B(O,4),k=B(te,4),ne=B(k,2),re=B(ne,8),ie=B(re,4),ae=B(ie,4),oe=R(ae),se=R(oe,!0);N(oe),N(ae),N(o);var ce=B(o,2),le=R(ce),ue=R(le),de=R(ue),fe=R(de,!0);N(de);var pe=B(de,2),me=R(pe,!0);N(pe),N(ue),Pe(2),N(le);var he=B(le,2),ge=B(he,2),_e=B(R(ge),10),ve=B(R(_e),8),ye=B(ve,2);N(_e);var be=B(_e,2),xe=R(be),Se=R(xe),Ce=R(Se,!0);N(Se);var we=B(Se,2);N(xe),Pe(2),N(be);var Te=B(be,2),A=R(Te),Ee=B(A,4),De=R(Ee),Oe=B(De,4),ke=B(Oe,4),Ae=B(ke,2),j=B(Ae,4),je=B(j,2),M=B(je,2),Me=B(M,4),Ne=B(Me,2),Fe=B(Ne,2),Ie=B(Fe,4),Le=B(Ie,2),Re=B(Le,2),ze=B(Re,4),Be=R(ze),Ve=B(Be,2),He=B(Ve,2),Ue=B(He,2),We=B(Ue,2);Pe(2),N(ze);var qe=B(ze,2),Je=B(qe,2),Ye=B(Je,4),Xe=B(Ye,2),Ze=B(Xe,2),Qe=B(Ze,4),$e=B(Qe,2),et=B($e,4),tt=B(et,4),nt=B(tt,2),rt=B(nt,4);N(Ee),N(Te);var it=B(Te,2),at=R(it),ot=R(at,!0);N(at);var st=B(at,2),ct=B(R(st),2),lt=R(ct,!0);N(ct),N(st);var ut=B(st,2),dt=R(ut);N(ut);var ft=B(ut,2),pt=B(R(ft),2),mt=R(pt,!0);N(pt),N(ft);var ht=B(ft,4),gt=B(R(ht),2),_t=R(gt,!0);N(gt),N(ht);var vt=B(ht,2),yt=R(vt);N(vt);var bt=B(vt,2),xt=R(bt),St=R(xt,!0);N(xt);var Ct=B(xt,2),wt=R(Ct,!0);N(Ct),Pe(2),N(bt),N(it);var Tt=B(it,2),Et=R(Tt),Dt=B(Et,4),Ot=R(Dt),kt=B(Ot,2),At=B(kt,2),jt=B(At,2),Mt=B(jt,4),Nt=B(Mt,2),Pt=B(Nt,4),Ft=B(Pt,2),It=B(Ft,2),Lt=B(It,4),Rt=B(Lt,2),zt=B(Rt,4),Bt=B(zt,2),P=B(Bt,4),Vt=B(P,2),Ht=B(Vt,2),Ut=B(Ht,2),Wt=B(Ut,2),Gt=B(Wt,4),Kt=B(Gt,2),qt=B(Kt,4),Jt=B(qt,4),Yt=B(Jt,4);N(Dt),N(Tt);var Xt=B(Tt,2),Zt=B(Xt,2),Qt=B(R(Zt),2),$t=R(Qt,!0);N(Qt),N(Zt),N(ge),N(ce);var en=B(ce,4),tn=R(en),L=R(tn),nn=R(L,!0);N(L);var rn=B(L,4),an=R(rn);Pe(2),N(rn);var on=B(rn,2),sn=R(on,!0);N(on);var cn=B(on,2),ln=R(cn),un=R(ln,!0);N(ln);var dn=B(ln,2),fn=R(dn,!0);N(dn),N(cn),N(tn),N(en),N(a),V((e,t,n,i,a,o,s,ae,oe,ce,le,ue,de,pe,ge,_e,be,xe,Se,Te,Ee,N,Pe,ze,Ge,Ke,it,at,st,ct,ut,ft,pt,ht,gt,vt,bt,xt,Ct,Tt,Dt,F,Zt,I,Qt,en,tn,L,rn,on,cn,ln,dn,R,z,B,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,V,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir)=>{K(c,e),J(l,`title`,t),J(u,`title`,n),J(d,`title`,i),J(f,`title`,a),J(p,`title`,o),J(m,`title`,s),J(h,`title`,ae),J(g,`title`,oe),J(_,`title`,ce),J(v,`title`,le),J(y,`title`,ue),J(b,`title`,de),J(x,`title`,pe),J(S,`title`,ge),J(C,`title`,_e),J(w,`title`,be),J(T,`title`,xe),J(E,`title`,Se),J(D,`title`,Te),J(ee,`title`,Ee),J(O,`placeholder`,N),J(te,`title`,Pe),J(k,`title`,ze),J(ne,`title`,Ge),J(re,`title`,Ke),J(ie,`title`,it),K(se,at),K(fe,st),K(me,ct),hi(he,1,`w-1 shrink-0 cursor-col-resize select-none transition-colors ${H(r)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),J(ve,`title`,ut),J(ye,`title`,ft),K(Ce,pt),J(we,`title`,ht),J(A,`title`,gt),J(De,`title`,vt),J(Oe,`title`,bt),J(ke,`title`,xt),J(Ae,`title`,Ct),J(j,`title`,Tt),J(je,`title`,Dt),J(M,`title`,F),J(Me,`title`,Zt),J(Ne,`title`,I),J(Fe,`title`,Qt),J(Ie,`title`,en),J(Le,`title`,tn),J(Re,`title`,L),J(Be,`title`,rn),J(Ve,`title`,on),J(He,`title`,cn),J(Ue,`title`,ln),J(We,`title`,dn),J(qe,`title`,R),J(Je,`title`,z),J(Ye,`title`,B),J(Xe,`title`,pn),J(Ze,`title`,mn),J(Qe,`title`,hn),J($e,`title`,gn),J(et,`title`,_n),J(tt,`title`,vn),J(nt,`title`,yn),J(rt,`title`,bn),K(ot,xn),K(lt,Sn),J(dt,`placeholder`,Cn),K(mt,wn),K(_t,Tn),J(yt,`placeholder`,En),K(St,Dn),K(wt,On),J(Et,`title`,kn),J(Ot,`title`,An),J(kt,`title`,jn),J(At,`title`,Mn),J(jt,`title`,Nn),J(Mt,`title`,Pn),J(Nt,`title`,V),J(Pt,`title`,Fn),J(Ft,`title`,In),J(It,`title`,Ln),J(Lt,`title`,Rn),J(Rt,`title`,zn),J(zt,`title`,Bn),J(Bt,`title`,Vn),J(P,`title`,Hn),J(Vt,`title`,Un),J(Ht,`title`,Wn),J(Ut,`title`,Gn),J(Wt,`title`,Kn),J(Gt,`title`,qn),J(Kt,`title`,Jn),J(qt,`title`,Yn),J(Jt,`title`,Xn),J(Yt,`title`,Zn),J(Xt,`placeholder`,Qn),K($t,$n),K(nn,er),J(an,`placeholder`,tr),K(sn,nr),K(un,rr),K(fn,ir)},[()=>Y(`diagram.back_btn`),()=>Y(`diagram.diagrams_list_title`),()=>Y(`diagram.toolbar.copy_mcp_id`),()=>Y(`diagram.toolbar.select`),()=>Y(`diagram.toolbar.box`),()=>Y(`diagram.toolbar.ellipse`),()=>Y(`diagram.toolbar.database`),()=>Y(`diagram.toolbar.circle`),()=>Y(`diagram.toolbar.actor`),()=>Y(`diagram.toolbar.postit`),()=>Y(`diagram.toolbar.text_free`),()=>Y(`diagram.toolbar.image`),()=>Y(`diagram.toolbar.shape_editor`),()=>Y(`diagram.toolbar.arrow`),()=>Y(`diagram.toolbar.delete`),()=>Y(`diagram.toolbar.defaults`),()=>Y(`diagram.toolbar.align_guides`),()=>Y(`diagram.toolbar.grid`),()=>Y(`diagram.toolbar.edge_style`),()=>Y(`diagram.toolbar.evidence_mode`),()=>Y(`diagram.toolbar.resize_corner`),()=>Y(`diagram.toolbar.title_placeholder`),()=>Y(`diagram.toolbar.zoom_out`),()=>Y(`diagram.toolbar.zoom_in`),()=>Y(`diagram.toolbar.fit`),()=>Y(`diagram.toolbar.debug`),()=>Y(`diagram.toolbar.export_drawio`),()=>Y(`diagram.toolbar.save`),()=>Y(`diagram.sidebar.title`),()=>Y(`diagram.sidebar.new_btn`),()=>Y(`diagram.selection.rotate_shape`),()=>Y(`diagram.selection.rotate_text`),()=>Y(`diagram.evidence.panel_title`),()=>Y(`diagram.evidence.close`),()=>Y(`diagram.node_panel.lock`),()=>Y(`diagram.node_panel.color`),()=>Y(`diagram.node_panel.bg_opacity`),()=>Y(`diagram.node_panel.edit_label`),()=>Y(`diagram.node_panel.edit_link`),()=>Y(`diagram.node_panel.font_decrease`),()=>Y(`diagram.node_panel.font_size_value`),()=>Y(`diagram.node_panel.font_increase`),()=>Y(`diagram.node_panel.align_left`),()=>Y(`diagram.node_panel.align_center`),()=>Y(`diagram.node_panel.align_right`),()=>Y(`diagram.node_panel.align_top`),()=>Y(`diagram.node_panel.align_middle`),()=>Y(`diagram.node_panel.align_bottom`),()=>Y(`diagram.node_panel.custom_label_above`),()=>Y(`diagram.node_panel.custom_label_below`),()=>Y(`diagram.node_panel.custom_label_left`),()=>Y(`diagram.node_panel.custom_label_right`),()=>Y(`diagram.node_panel.custom_label_center`),()=>Y(`diagram.node_panel.send_back`),()=>Y(`diagram.node_panel.bring_front`),()=>Y(`diagram.node_panel.stamp_color`),()=>Y(`diagram.node_panel.stamp_font`),()=>Y(`diagram.node_panel.stamp_size`),()=>Y(`diagram.node_panel.rotate_ccw`),()=>Y(`diagram.node_panel.rotate_cw`),()=>Y(`diagram.node_panel.copy_png`),()=>Y(`diagram.node_panel.group`),()=>Y(`diagram.node_panel.ungroup`),()=>Y(`diagram.node_panel.save_as_default`),()=>Y(`diagram.link_panel.title`),()=>Y(`diagram.link_panel.external`),()=>Y(`diagram.link_panel.url_placeholder`),()=>Y(`diagram.link_panel.existing_diagram`),()=>Y(`diagram.link_panel.new_diagram`),()=>Y(`diagram.link_panel.diagram_name_placeholder`),()=>Y(`diagram.link_panel.save_btn`),()=>Y(`diagram.link_panel.remove_btn`),()=>Y(`diagram.edge_panel.lock`),()=>Y(`diagram.edge_panel.no_arrow`),()=>Y(`diagram.edge_panel.arrow_from`),()=>Y(`diagram.edge_panel.arrow_to`),()=>Y(`diagram.edge_panel.arrow_both`),()=>Y(`diagram.edge_panel.solid`),()=>Y(`diagram.edge_panel.dashed`),()=>Y(`diagram.edge_panel.font_decrease`),()=>Y(`diagram.edge_panel.font_size_value`),()=>Y(`diagram.edge_panel.font_increase`),()=>Y(`diagram.edge_panel.edit_label`),()=>Y(`diagram.edge_panel.reset_label_width`),()=>Y(`diagram.edge_panel.rotate_label_ccw`),()=>Y(`diagram.edge_panel.rotate_label_cw`),()=>Y(`diagram.edge_panel.offset_label_left`),()=>Y(`diagram.edge_panel.offset_label_right`),()=>Y(`diagram.edge_panel.offset_label_up`),()=>Y(`diagram.edge_panel.offset_label_down`),()=>Y(`diagram.edge_panel.offset_label_reset`),()=>Y(`diagram.edge_panel.width_decrease`),()=>Y(`diagram.edge_panel.width_increase`),()=>Y(`diagram.edge_panel.color`),()=>Y(`diagram.edge_panel.clear_ports`),()=>Y(`diagram.edge_panel.save_as_default`),()=>Y(`diagram.label_input.placeholder`),()=>Y(`diagram.empty_state`),()=>Y(`diagram.image_modal.title`),()=>Y(`diagram.image_modal.placeholder`),()=>Y(`diagram.image_modal.error_chars`),()=>Y(`diagram.image_modal.cancel_btn`),()=>Y(`diagram.image_modal.paste_btn`)]),U(`click`,s,()=>history.back()),U(`mousedown`,he,i),G(e,a),Ke()}Nr([`click`,`mousedown`]),He();var Ph={network:null,nodes:null,edges:null,diagrams:[],currentDiagramId:null,currentTool:`select`,pendingShape:`box`,selectedNodeIds:[],selectedEdgeIds:[],alignGuides:!0,gridEnabled:!0,debugMode:!1,isDirty:!1,sidebarOpen:!0,editingNodeId:null,editingEdgeId:null,resizeDrag:null,rotateDrag:null,labelRotateDrag:null,activeStamp:null,stampTargetIds:[],clipboard:null,canonicalOrder:[],edgesStraight:!1,resizeSymmetric:!1,nodeColorOverrides:{},customShapeLibraries:[],customShapeDefs:new Map,edgeLabelCanvasPos:{},edgeLabelBBox:{},freeArrowFirstPoint:null,exportingPng:!1,evidenceMode:!1};function Fh(){Ph.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var Ih=`custom-shape`,Lh=`custom-shape:`,Rh=[{id:`N`,x:.5,y:0},{id:`NE`,x:1,y:0},{id:`E`,x:1,y:.5},{id:`SE`,x:1,y:1},{id:`S`,x:.5,y:1},{id:`SW`,x:0,y:1},{id:`W`,x:0,y:.5},{id:`NW`,x:0,y:0}];function zh(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function Bh(e){return zh(e)?e.slice(13):null}function Vh(e){return e&&Ph.customShapeDefs&&Ph.customShapeDefs.get(e)||null}function Hh(e){let t=Vh(e);return[t&&t.width||65,t&&t.height||65]}function Uh(e){let t=Vh(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:Rh}function Wh(e){let t=Vh(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function Gh(){try{let e=await fetch(`/api/shape-libraries`);if(!e.ok)throw Error(`shape libraries unavailable`);let t=await e.json(),n=Array.isArray(t.libraries)?t.libraries:[];Ph.customShapeLibraries=n,Ph.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>Ph.customShapeDefs.set(e.id,e))})}catch{Ph.customShapeLibraries=[],Ph.customShapeDefs=new Map}}function Kh(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(Ph.customShapeLibraries||[]).flatMap(e=>(e.shapes||[]).filter(e=>e.showInDiagram!==!1).map(t=>({...t,libraryName:e.name})));e.classList.toggle(`hidden`,n.length===0),n.forEach(e=>{let n=document.createElement(`button`);n.type=`button`,n.className=`custom-shape-btn`,n.title=`${e.libraryName||``}${e.libraryName?` · `:``}${e.name}`,n.dataset.customShapeId=e.id;let r=document.createElement(`img`);r.src=e.imageSrc,r.alt=``,r.draggable=!1,n.appendChild(r),n.addEventListener(`click`,()=>{window.dispatchEvent(new CustomEvent(`diagram:setTool`,{detail:{tool:`addNode`,shape:`${Lh}${e.id}`}}))}),t.appendChild(n)})}function qh(){let e={saveState:document.getElementById(`saveState`),librarySelect:document.getElementById(`librarySelect`),libraryName:document.getElementById(`libraryName`),shapeList:document.getElementById(`shapeList`),previewStage:document.getElementById(`previewStage`),previewImage:document.getElementById(`previewImage`),shapeName:document.getElementById(`shapeName`),imageFile:document.getElementById(`imageFile`),shapeWidth:document.getElementById(`shapeWidth`),shapeHeight:document.getElementById(`shapeHeight`),labelPlacement:document.getElementById(`labelPlacement`),shapeShowInDiagram:document.getElementById(`shapeShowInDiagram`),anchorList:document.getElementById(`anchorList`),anchorCount:document.getElementById(`anchorCount`)},t={libraries:[]},n=null,r=null,i=null,a=null,o=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,s=()=>t.libraries.find(e=>e.id===n)||null,c=()=>s()?.shapes.find(e=>e.id===r)||null,l=e=>Math.max(0,Math.min(1,e)),u=e=>[`below`,`above`,`right`,`left`,`center`].includes(e)?e:`below`,d=e=>String(e??``).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]);function f(t){e.saveState.textContent=t,t&&setTimeout(()=>{e.saveState.textContent===t&&(e.saveState.textContent=``)},1800)}async function p(){t=await(await fetch(`/api/shape-libraries`)).json(),Array.isArray(t.libraries)||(t.libraries=[]),t.libraries.length||t.libraries.push({id:o(`lib`),name:`My shapes`,shapes:[]}),n=t.libraries[0].id,r=t.libraries[0].shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}async function m(){t=await(await fetch(`/api/shape-libraries`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).json(),f(`Saved`)}function h(){return{id:o(`shape`),name:`New shape`,imageSrc:``,width:65,height:65,labelPlacement:`below`,showInDiagram:!0,anchors:structuredClone(Rh)}}function g(){_(),v(),y()}function _(){e.librarySelect.innerHTML=``,t.libraries.forEach(t=>{let r=document.createElement(`option`);r.value=t.id,r.textContent=t.name,r.selected=t.id===n,e.librarySelect.appendChild(r)}),e.libraryName.value=s()?.name||``}function v(){let t=s();e.shapeList.innerHTML=``,(t?.shapes||[]).forEach(t=>{let n=document.createElement(`button`);n.type=`button`,n.className=`shape-item w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm text-left hover:bg-gray-100 ${t.id===r?`active`:``}`;let a=document.createElement(`img`);a.src=t.imageSrc,a.alt=``,a.className=`w-6 h-6 object-contain shrink-0`;let o=document.createElement(`span`);o.className=`truncate`,o.textContent=t.name,n.append(a,o),n.addEventListener(`click`,()=>{r=t.id,i=structuredClone(t),g()}),e.shapeList.appendChild(n)}),t?.shapes?.length||(e.shapeList.innerHTML=`<p class="text-xs text-gray-400 px-2 py-2">No shape yet.</p>`)}function y(){i||=h(),e.previewStage.style.aspectRatio=`${Math.max(16,Number(i.width)||65)} / ${Math.max(16,Number(i.height)||65)}`,e.previewImage.src=i.imageSrc||``,e.previewImage.style.display=i.imageSrc?`block`:`none`,e.shapeName.value=i.name||``,e.shapeWidth.value=i.width||65,e.shapeHeight.value=i.height||65,e.labelPlacement.value=u(i.labelPlacement),e.shapeShowInDiagram.checked=i.showInDiagram!==!1,b()}function b(){e.previewStage.querySelectorAll(`.anchor-dot`).forEach(e=>e.remove()),e.anchorList.innerHTML=``;let t=i.anchors||[];e.anchorCount.textContent=`${t.length} anchor${t.length>1?`s`:``}`,t.forEach((t,n)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`anchor-dot`,r.style.left=`${t.x*100}%`,r.style.top=`${t.y*100}%`,r.dataset.anchorId=t.id,r.innerHTML=`<span>${t.id}</span>`,r.addEventListener(`pointerdown`,e=>{e.preventDefault(),a=t.id,r.setPointerCapture(e.pointerId)}),e.previewStage.appendChild(r);let o=document.createElement(`div`);o.className=`grid grid-cols-[4.5rem_1fr_1fr_2rem] gap-2 items-center`,o.innerHTML=`
|
|
137
|
+
text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"> </button> <button id="imageNameConfirm" class="px-3 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600"> </button></div></div></div></div>`);function Jh(e,t){Ge(t,!0),Vi(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await fa(t);let{initDiagram:r}=await Kh(async()=>{let{initDiagram:e}=await import(`./main-BIcAk_fU.js`);return{initDiagram:e}},[]);e=r();let i=document.getElementById(`sidebar`),a=parseInt(localStorage.getItem(n)||``,10);i&&Number.isFinite(a)&&(i.style.width=a+`px`)})(),()=>e?.()});let n=`ld-diagram-sidebar-w`,r=F(!1);function i(e){e.preventDefault();let t=document.getElementById(`sidebar`);if(!t)return;let i=e.clientX,a=t.getBoundingClientRect().width;I(r,!0),t.style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let o=e=>{let n=Math.max(160,Math.min(480,a+e.clientX-i));t.style.width=n+`px`},s=()=>{document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s),document.body.style.cursor=``,document.body.style.userSelect=``,I(r,!1),t.style.transition=``;try{localStorage.setItem(n,String(parseInt(t.style.width,10)))}catch{}};document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s)}var a=qh(),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,4),u=B(l,4),d=B(u,2),f=B(d,4),p=B(f,2),m=B(p,2),h=B(m,2),g=B(h,2),_=B(g,2),v=B(_,2),y=B(v,2),b=B(y,2),x=B(b,4),S=B(x,4),C=B(S,4),w=B(C,2),T=B(w,2),E=B(T,2),D=B(E,2),ee=B(D,2),O=B(ee,4),te=B(O,4),k=B(te,4),ne=B(k,2),re=B(ne,8),ie=B(re,4),ae=B(ie,4),oe=R(ae),se=R(oe,!0);N(oe),N(ae),N(o);var ce=B(o,2),le=R(ce),ue=R(le),de=R(ue),fe=R(de,!0);N(de);var pe=B(de,2),me=R(pe,!0);N(pe),N(ue),Pe(2),N(le);var he=B(le,2),ge=B(he,2),_e=B(R(ge),10),ve=B(R(_e),8),ye=B(ve,2);N(_e);var be=B(_e,2),xe=R(be),Se=R(xe),Ce=R(Se,!0);N(Se);var we=B(Se,2);N(xe),Pe(2),N(be);var Te=B(be,2),A=R(Te),Ee=B(A,4),De=R(Ee),Oe=B(De,4),ke=B(Oe,4),Ae=B(ke,2),j=B(Ae,4),je=B(j,2),M=B(je,2),Me=B(M,4),Ne=B(Me,2),Fe=B(Ne,2),Ie=B(Fe,4),Le=B(Ie,2),Re=B(Le,2),ze=B(Re,4),Be=R(ze),Ve=B(Be,2),He=B(Ve,2),Ue=B(He,2),We=B(Ue,2);Pe(2),N(ze);var qe=B(ze,2),Je=B(qe,2),Ye=B(Je,4),Xe=B(Ye,2),Ze=B(Xe,2),Qe=B(Ze,4),$e=B(Qe,2),et=B($e,4),tt=B(et,4),nt=B(tt,2),rt=B(nt,4);N(Ee),N(Te);var it=B(Te,2),at=R(it),ot=R(at,!0);N(at);var st=B(at,2),ct=B(R(st),2),lt=R(ct,!0);N(ct),N(st);var ut=B(st,2),dt=R(ut);N(ut);var ft=B(ut,2),pt=B(R(ft),2),mt=R(pt,!0);N(pt),N(ft);var ht=B(ft,4),gt=B(R(ht),2),_t=R(gt,!0);N(gt),N(ht);var vt=B(ht,2),yt=R(vt);N(vt);var bt=B(vt,2),xt=R(bt),St=R(xt,!0);N(xt);var Ct=B(xt,2),wt=R(Ct,!0);N(Ct),Pe(2),N(bt),N(it);var Tt=B(it,2),Et=R(Tt),Dt=B(Et,4),Ot=R(Dt),kt=B(Ot,2),At=B(kt,2),jt=B(At,2),Mt=B(jt,4),Nt=B(Mt,2),Pt=B(Nt,4),Ft=B(Pt,2),It=B(Ft,2),Lt=B(It,4),Rt=B(Lt,2),zt=B(Rt,4),Bt=B(zt,2),P=B(Bt,4),Vt=B(P,2),Ht=B(Vt,2),Ut=B(Ht,2),Wt=B(Ut,2),Gt=B(Wt,4),Kt=B(Gt,2),qt=B(Kt,4),Jt=B(qt,4),Yt=B(Jt,4);N(Dt),N(Tt);var Xt=B(Tt,2),Zt=B(Xt,2),Qt=B(R(Zt),2),$t=R(Qt,!0);N(Qt),N(Zt),N(ge),N(ce);var en=B(ce,4),tn=R(en),L=R(tn),nn=R(L,!0);N(L);var rn=B(L,4),an=R(rn);Pe(2),N(rn);var on=B(rn,2),sn=R(on,!0);N(on);var cn=B(on,2),ln=R(cn),un=R(ln,!0);N(ln);var dn=B(ln,2),fn=R(dn,!0);N(dn),N(cn),N(tn),N(en),N(a),V((e,t,n,i,a,o,s,ae,oe,ce,le,ue,de,pe,ge,_e,be,xe,Se,Te,Ee,N,Pe,ze,Ge,Ke,it,at,st,ct,ut,ft,pt,ht,gt,vt,bt,xt,Ct,Tt,Dt,F,Zt,I,Qt,en,tn,L,rn,on,cn,ln,dn,R,z,B,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,V,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir)=>{K(c,e),J(l,`title`,t),J(u,`title`,n),J(d,`title`,i),J(f,`title`,a),J(p,`title`,o),J(m,`title`,s),J(h,`title`,ae),J(g,`title`,oe),J(_,`title`,ce),J(v,`title`,le),J(y,`title`,ue),J(b,`title`,de),J(x,`title`,pe),J(S,`title`,ge),J(C,`title`,_e),J(w,`title`,be),J(T,`title`,xe),J(E,`title`,Se),J(D,`title`,Te),J(ee,`title`,Ee),J(O,`placeholder`,N),J(te,`title`,Pe),J(k,`title`,ze),J(ne,`title`,Ge),J(re,`title`,Ke),J(ie,`title`,it),K(se,at),K(fe,st),K(me,ct),hi(he,1,`w-1 shrink-0 cursor-col-resize select-none transition-colors ${H(r)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),J(ve,`title`,ut),J(ye,`title`,ft),K(Ce,pt),J(we,`title`,ht),J(A,`title`,gt),J(De,`title`,vt),J(Oe,`title`,bt),J(ke,`title`,xt),J(Ae,`title`,Ct),J(j,`title`,Tt),J(je,`title`,Dt),J(M,`title`,F),J(Me,`title`,Zt),J(Ne,`title`,I),J(Fe,`title`,Qt),J(Ie,`title`,en),J(Le,`title`,tn),J(Re,`title`,L),J(Be,`title`,rn),J(Ve,`title`,on),J(He,`title`,cn),J(Ue,`title`,ln),J(We,`title`,dn),J(qe,`title`,R),J(Je,`title`,z),J(Ye,`title`,B),J(Xe,`title`,pn),J(Ze,`title`,mn),J(Qe,`title`,hn),J($e,`title`,gn),J(et,`title`,_n),J(tt,`title`,vn),J(nt,`title`,yn),J(rt,`title`,bn),K(ot,xn),K(lt,Sn),J(dt,`placeholder`,Cn),K(mt,wn),K(_t,Tn),J(yt,`placeholder`,En),K(St,Dn),K(wt,On),J(Et,`title`,kn),J(Ot,`title`,An),J(kt,`title`,jn),J(At,`title`,Mn),J(jt,`title`,Nn),J(Mt,`title`,Pn),J(Nt,`title`,V),J(Pt,`title`,Fn),J(Ft,`title`,In),J(It,`title`,Ln),J(Lt,`title`,Rn),J(Rt,`title`,zn),J(zt,`title`,Bn),J(Bt,`title`,Vn),J(P,`title`,Hn),J(Vt,`title`,Un),J(Ht,`title`,Wn),J(Ut,`title`,Gn),J(Wt,`title`,Kn),J(Gt,`title`,qn),J(Kt,`title`,Jn),J(qt,`title`,Yn),J(Jt,`title`,Xn),J(Yt,`title`,Zn),J(Xt,`placeholder`,Qn),K($t,$n),K(nn,er),J(an,`placeholder`,tr),K(sn,nr),K(un,rr),K(fn,ir)},[()=>Y(`diagram.back_btn`),()=>Y(`diagram.diagrams_list_title`),()=>Y(`diagram.toolbar.copy_mcp_id`),()=>Y(`diagram.toolbar.select`),()=>Y(`diagram.toolbar.box`),()=>Y(`diagram.toolbar.ellipse`),()=>Y(`diagram.toolbar.database`),()=>Y(`diagram.toolbar.circle`),()=>Y(`diagram.toolbar.actor`),()=>Y(`diagram.toolbar.postit`),()=>Y(`diagram.toolbar.text_free`),()=>Y(`diagram.toolbar.image`),()=>Y(`diagram.toolbar.shape_editor`),()=>Y(`diagram.toolbar.arrow`),()=>Y(`diagram.toolbar.delete`),()=>Y(`diagram.toolbar.defaults`),()=>Y(`diagram.toolbar.align_guides`),()=>Y(`diagram.toolbar.grid`),()=>Y(`diagram.toolbar.edge_style`),()=>Y(`diagram.toolbar.evidence_mode`),()=>Y(`diagram.toolbar.resize_corner`),()=>Y(`diagram.toolbar.title_placeholder`),()=>Y(`diagram.toolbar.zoom_out`),()=>Y(`diagram.toolbar.zoom_in`),()=>Y(`diagram.toolbar.fit`),()=>Y(`diagram.toolbar.debug`),()=>Y(`diagram.toolbar.export_drawio`),()=>Y(`diagram.toolbar.save`),()=>Y(`diagram.sidebar.title`),()=>Y(`diagram.sidebar.new_btn`),()=>Y(`diagram.selection.rotate_shape`),()=>Y(`diagram.selection.rotate_text`),()=>Y(`diagram.evidence.panel_title`),()=>Y(`diagram.evidence.close`),()=>Y(`diagram.node_panel.lock`),()=>Y(`diagram.node_panel.color`),()=>Y(`diagram.node_panel.bg_opacity`),()=>Y(`diagram.node_panel.edit_label`),()=>Y(`diagram.node_panel.edit_link`),()=>Y(`diagram.node_panel.font_decrease`),()=>Y(`diagram.node_panel.font_size_value`),()=>Y(`diagram.node_panel.font_increase`),()=>Y(`diagram.node_panel.align_left`),()=>Y(`diagram.node_panel.align_center`),()=>Y(`diagram.node_panel.align_right`),()=>Y(`diagram.node_panel.align_top`),()=>Y(`diagram.node_panel.align_middle`),()=>Y(`diagram.node_panel.align_bottom`),()=>Y(`diagram.node_panel.custom_label_above`),()=>Y(`diagram.node_panel.custom_label_below`),()=>Y(`diagram.node_panel.custom_label_left`),()=>Y(`diagram.node_panel.custom_label_right`),()=>Y(`diagram.node_panel.custom_label_center`),()=>Y(`diagram.node_panel.send_back`),()=>Y(`diagram.node_panel.bring_front`),()=>Y(`diagram.node_panel.stamp_color`),()=>Y(`diagram.node_panel.stamp_font`),()=>Y(`diagram.node_panel.stamp_size`),()=>Y(`diagram.node_panel.rotate_ccw`),()=>Y(`diagram.node_panel.rotate_cw`),()=>Y(`diagram.node_panel.copy_png`),()=>Y(`diagram.node_panel.group`),()=>Y(`diagram.node_panel.ungroup`),()=>Y(`diagram.node_panel.save_as_default`),()=>Y(`diagram.link_panel.title`),()=>Y(`diagram.link_panel.external`),()=>Y(`diagram.link_panel.url_placeholder`),()=>Y(`diagram.link_panel.existing_diagram`),()=>Y(`diagram.link_panel.new_diagram`),()=>Y(`diagram.link_panel.diagram_name_placeholder`),()=>Y(`diagram.link_panel.save_btn`),()=>Y(`diagram.link_panel.remove_btn`),()=>Y(`diagram.edge_panel.lock`),()=>Y(`diagram.edge_panel.no_arrow`),()=>Y(`diagram.edge_panel.arrow_from`),()=>Y(`diagram.edge_panel.arrow_to`),()=>Y(`diagram.edge_panel.arrow_both`),()=>Y(`diagram.edge_panel.solid`),()=>Y(`diagram.edge_panel.dashed`),()=>Y(`diagram.edge_panel.font_decrease`),()=>Y(`diagram.edge_panel.font_size_value`),()=>Y(`diagram.edge_panel.font_increase`),()=>Y(`diagram.edge_panel.edit_label`),()=>Y(`diagram.edge_panel.reset_label_width`),()=>Y(`diagram.edge_panel.rotate_label_ccw`),()=>Y(`diagram.edge_panel.rotate_label_cw`),()=>Y(`diagram.edge_panel.offset_label_left`),()=>Y(`diagram.edge_panel.offset_label_right`),()=>Y(`diagram.edge_panel.offset_label_up`),()=>Y(`diagram.edge_panel.offset_label_down`),()=>Y(`diagram.edge_panel.offset_label_reset`),()=>Y(`diagram.edge_panel.width_decrease`),()=>Y(`diagram.edge_panel.width_increase`),()=>Y(`diagram.edge_panel.color`),()=>Y(`diagram.edge_panel.clear_ports`),()=>Y(`diagram.edge_panel.save_as_default`),()=>Y(`diagram.label_input.placeholder`),()=>Y(`diagram.empty_state`),()=>Y(`diagram.image_modal.title`),()=>Y(`diagram.image_modal.placeholder`),()=>Y(`diagram.image_modal.error_chars`),()=>Y(`diagram.image_modal.cancel_btn`),()=>Y(`diagram.image_modal.paste_btn`)]),U(`click`,s,()=>history.back()),U(`mousedown`,he,i),G(e,a),Ke()}Nr([`click`,`mousedown`]),He();var Yh={network:null,nodes:null,edges:null,diagrams:[],currentDiagramId:null,currentTool:`select`,pendingShape:`box`,selectedNodeIds:[],selectedEdgeIds:[],alignGuides:!0,gridEnabled:!0,debugMode:!1,isDirty:!1,sidebarOpen:!0,editingNodeId:null,editingEdgeId:null,resizeDrag:null,rotateDrag:null,labelRotateDrag:null,activeStamp:null,stampTargetIds:[],clipboard:null,canonicalOrder:[],edgesStraight:!1,resizeSymmetric:!1,nodeColorOverrides:{},customShapeLibraries:[],customShapeDefs:new Map,edgeLabelCanvasPos:{},edgeLabelBBox:{},freeArrowFirstPoint:null,exportingPng:!1,evidenceMode:!1};function Xh(){Yh.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var Zh=`custom-shape`,Qh=`custom-shape:`,$h=[{id:`N`,x:.5,y:0},{id:`NE`,x:1,y:0},{id:`E`,x:1,y:.5},{id:`SE`,x:1,y:1},{id:`S`,x:.5,y:1},{id:`SW`,x:0,y:1},{id:`W`,x:0,y:.5},{id:`NW`,x:0,y:0}];function eg(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function tg(e){return eg(e)?e.slice(13):null}function ng(e){return e&&Yh.customShapeDefs&&Yh.customShapeDefs.get(e)||null}function rg(e){let t=ng(e);return[t&&t.width||65,t&&t.height||65]}function ig(e){let t=ng(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:$h}function ag(e){let t=ng(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function og(){try{let e=await fetch(`/api/shape-libraries`);if(!e.ok)throw Error(`shape libraries unavailable`);let t=await e.json(),n=Array.isArray(t.libraries)?t.libraries:[];Yh.customShapeLibraries=n,Yh.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>Yh.customShapeDefs.set(e.id,e))})}catch{Yh.customShapeLibraries=[],Yh.customShapeDefs=new Map}}function sg(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(Yh.customShapeLibraries||[]).flatMap(e=>(e.shapes||[]).filter(e=>e.showInDiagram!==!1).map(t=>({...t,libraryName:e.name})));e.classList.toggle(`hidden`,n.length===0),n.forEach(e=>{let n=document.createElement(`button`);n.type=`button`,n.className=`custom-shape-btn`,n.title=`${e.libraryName||``}${e.libraryName?` · `:``}${e.name}`,n.dataset.customShapeId=e.id;let r=document.createElement(`img`);r.src=e.imageSrc,r.alt=``,r.draggable=!1,n.appendChild(r),n.addEventListener(`click`,()=>{window.dispatchEvent(new CustomEvent(`diagram:setTool`,{detail:{tool:`addNode`,shape:`${Qh}${e.id}`}}))}),t.appendChild(n)})}function cg(){let e={saveState:document.getElementById(`saveState`),librarySelect:document.getElementById(`librarySelect`),libraryName:document.getElementById(`libraryName`),shapeList:document.getElementById(`shapeList`),previewStage:document.getElementById(`previewStage`),previewImage:document.getElementById(`previewImage`),shapeName:document.getElementById(`shapeName`),imageFile:document.getElementById(`imageFile`),shapeWidth:document.getElementById(`shapeWidth`),shapeHeight:document.getElementById(`shapeHeight`),labelPlacement:document.getElementById(`labelPlacement`),shapeShowInDiagram:document.getElementById(`shapeShowInDiagram`),anchorList:document.getElementById(`anchorList`),anchorCount:document.getElementById(`anchorCount`)},t={libraries:[]},n=null,r=null,i=null,a=null,o=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,s=()=>t.libraries.find(e=>e.id===n)||null,c=()=>s()?.shapes.find(e=>e.id===r)||null,l=e=>Math.max(0,Math.min(1,e)),u=e=>[`below`,`above`,`right`,`left`,`center`].includes(e)?e:`below`,d=e=>String(e??``).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]);function f(t){e.saveState.textContent=t,t&&setTimeout(()=>{e.saveState.textContent===t&&(e.saveState.textContent=``)},1800)}async function p(){t=await(await fetch(`/api/shape-libraries`)).json(),Array.isArray(t.libraries)||(t.libraries=[]),t.libraries.length||t.libraries.push({id:o(`lib`),name:`My shapes`,shapes:[]}),n=t.libraries[0].id,r=t.libraries[0].shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}async function m(){t=await(await fetch(`/api/shape-libraries`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).json(),f(`Saved`)}function h(){return{id:o(`shape`),name:`New shape`,imageSrc:``,width:65,height:65,labelPlacement:`below`,showInDiagram:!0,anchors:structuredClone($h)}}function g(){_(),v(),y()}function _(){e.librarySelect.innerHTML=``,t.libraries.forEach(t=>{let r=document.createElement(`option`);r.value=t.id,r.textContent=t.name,r.selected=t.id===n,e.librarySelect.appendChild(r)}),e.libraryName.value=s()?.name||``}function v(){let t=s();e.shapeList.innerHTML=``,(t?.shapes||[]).forEach(t=>{let n=document.createElement(`button`);n.type=`button`,n.className=`shape-item w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm text-left hover:bg-gray-100 ${t.id===r?`active`:``}`;let a=document.createElement(`img`);a.src=t.imageSrc,a.alt=``,a.className=`w-6 h-6 object-contain shrink-0`;let o=document.createElement(`span`);o.className=`truncate`,o.textContent=t.name,n.append(a,o),n.addEventListener(`click`,()=>{r=t.id,i=structuredClone(t),g()}),e.shapeList.appendChild(n)}),t?.shapes?.length||(e.shapeList.innerHTML=`<p class="text-xs text-gray-400 px-2 py-2">No shape yet.</p>`)}function y(){i||=h(),e.previewStage.style.aspectRatio=`${Math.max(16,Number(i.width)||65)} / ${Math.max(16,Number(i.height)||65)}`,e.previewImage.src=i.imageSrc||``,e.previewImage.style.display=i.imageSrc?`block`:`none`,e.shapeName.value=i.name||``,e.shapeWidth.value=i.width||65,e.shapeHeight.value=i.height||65,e.labelPlacement.value=u(i.labelPlacement),e.shapeShowInDiagram.checked=i.showInDiagram!==!1,b()}function b(){e.previewStage.querySelectorAll(`.anchor-dot`).forEach(e=>e.remove()),e.anchorList.innerHTML=``;let t=i.anchors||[];e.anchorCount.textContent=`${t.length} anchor${t.length>1?`s`:``}`,t.forEach((t,n)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`anchor-dot`,r.style.left=`${t.x*100}%`,r.style.top=`${t.y*100}%`,r.dataset.anchorId=t.id,r.innerHTML=`<span>${t.id}</span>`,r.addEventListener(`pointerdown`,e=>{e.preventDefault(),a=t.id,r.setPointerCapture(e.pointerId)}),e.previewStage.appendChild(r);let o=document.createElement(`div`);o.className=`grid grid-cols-[4.5rem_1fr_1fr_2rem] gap-2 items-center`,o.innerHTML=`
|
|
138
138
|
<input class="field !h-7 text-xs" value="${d(t.id)}">
|
|
139
139
|
<input class="field !h-7 text-xs" type="number" min="0" max="100" step="1" value="${Math.round(t.x*100)}">
|
|
140
140
|
<input class="field !h-7 text-xs" type="number" min="0" max="100" step="1" value="${Math.round(t.y*100)}">
|
|
141
141
|
<button class="btn btn-danger !h-7 !px-0">×</button>
|
|
142
|
-
`;let[s,c,u]=o.querySelectorAll(`input`);s.addEventListener(`input`,()=>{t.id=s.value.trim()||`p${n+1}`,b()}),c.addEventListener(`input`,()=>{t.x=l(Number(c.value)/100),b()}),u.addEventListener(`input`,()=>{t.y=l(Number(u.value)/100),b()}),o.querySelector(`button`).addEventListener(`click`,()=>{i.anchors=i.anchors.filter(e=>e!==t),b()}),e.anchorList.appendChild(o)})}function x(t,n){let r=e.previewStage.getBoundingClientRect();t.x=l((n.clientX-r.left)/r.width),t.y=l((n.clientY-r.top)/r.height)}let S=[],C=(e,t,n,r)=>{e.addEventListener(t,n,r),S.push(()=>e.removeEventListener(t,n,r))};return C(e.previewStage,`pointermove`,e=>{if(!a||!i)return;let t=i.anchors.find(e=>e.id===a);t&&(x(t,e),b())}),C(window,`pointerup`,()=>{a=null}),C(e.previewStage,`click`,e=>{if(e.target.closest(`.anchor-dot`)||a||!i)return;let t={id:`p${(i.anchors||[]).length+1}`,x:.5,y:.5};x(t,e),i.anchors=[...i.anchors||[],t],b()}),C(document.getElementById(`btnAddLibrary`),`click`,async()=>{let e={id:o(`lib`),name:`New library`,shapes:[]};t.libraries.push(e),n=e.id,r=null,i=h(),g(),await m()}),C(e.librarySelect,`change`,()=>{n=e.librarySelect.value,r=s()?.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}),C(e.libraryName,`change`,async()=>{let t=s();t&&(t.name=e.libraryName.value.trim()||t.name,_(),await m())}),C(document.getElementById(`btnNewShape`),`click`,()=>{r=null,i=h(),g()}),C(document.getElementById(`btnDeleteShape`),`click`,async()=>{let e=s();!e||!r||(e.shapes=e.shapes.filter(e=>e.id!==r),r=e.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g(),await m())}),C(document.getElementById(`btnDefaultAnchors`),`click`,()=>{i.anchors=structuredClone(
|
|
143
|
-
position.</p></div> <div class="space-y-4"><div class="grid grid-cols-2 gap-3"><label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Shape name</span> <input id="shapeName" class="field w-full" placeholder="Shape name"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Image / SVG</span> <input id="imageFile" type="file" accept="image/*,.svg" class="block w-full text-sm"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Width</span> <input id="shapeWidth" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Height</span> <input id="shapeHeight" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1 col-span-2"><span class="block text-xs font-semibold text-gray-500">Text placement</span> <select id="labelPlacement" class="field w-full"><option> </option><option> </option><option> </option><option> </option><option> </option></select></label> <label class="col-span-2 flex items-start gap-2 rounded-md border border-gray-200 bg-white px-2 py-2 text-sm"><input id="shapeShowInDiagram" type="checkbox" class="mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600"/> <span class="space-y-0.5"><span class="block font-semibold text-gray-700"> </span> <span class="block text-xs text-gray-500"> </span></span></label></div> <div class="flex flex-wrap gap-2"><button id="btnDefaultAnchors" class="btn">Use 8 default anchors</button> <button id="btnClearAnchors" class="btn">Clear anchors</button> <button id="btnSaveShape" class="btn btn-primary">Save shape</button></div> <div><div class="flex items-center justify-between mb-2"><h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500">Anchors</h2> <span id="anchorCount" class="text-xs text-gray-500"></span></div> <div id="anchorList" class="space-y-1"></div></div></div></div></section></main></div>`);function
|
|
142
|
+
`;let[s,c,u]=o.querySelectorAll(`input`);s.addEventListener(`input`,()=>{t.id=s.value.trim()||`p${n+1}`,b()}),c.addEventListener(`input`,()=>{t.x=l(Number(c.value)/100),b()}),u.addEventListener(`input`,()=>{t.y=l(Number(u.value)/100),b()}),o.querySelector(`button`).addEventListener(`click`,()=>{i.anchors=i.anchors.filter(e=>e!==t),b()}),e.anchorList.appendChild(o)})}function x(t,n){let r=e.previewStage.getBoundingClientRect();t.x=l((n.clientX-r.left)/r.width),t.y=l((n.clientY-r.top)/r.height)}let S=[],C=(e,t,n,r)=>{e.addEventListener(t,n,r),S.push(()=>e.removeEventListener(t,n,r))};return C(e.previewStage,`pointermove`,e=>{if(!a||!i)return;let t=i.anchors.find(e=>e.id===a);t&&(x(t,e),b())}),C(window,`pointerup`,()=>{a=null}),C(e.previewStage,`click`,e=>{if(e.target.closest(`.anchor-dot`)||a||!i)return;let t={id:`p${(i.anchors||[]).length+1}`,x:.5,y:.5};x(t,e),i.anchors=[...i.anchors||[],t],b()}),C(document.getElementById(`btnAddLibrary`),`click`,async()=>{let e={id:o(`lib`),name:`New library`,shapes:[]};t.libraries.push(e),n=e.id,r=null,i=h(),g(),await m()}),C(e.librarySelect,`change`,()=>{n=e.librarySelect.value,r=s()?.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}),C(e.libraryName,`change`,async()=>{let t=s();t&&(t.name=e.libraryName.value.trim()||t.name,_(),await m())}),C(document.getElementById(`btnNewShape`),`click`,()=>{r=null,i=h(),g()}),C(document.getElementById(`btnDeleteShape`),`click`,async()=>{let e=s();!e||!r||(e.shapes=e.shapes.filter(e=>e.id!==r),r=e.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g(),await m())}),C(document.getElementById(`btnDefaultAnchors`),`click`,()=>{i.anchors=structuredClone($h),b()}),C(document.getElementById(`btnClearAnchors`),`click`,()=>{i.anchors=[],b()}),C(document.getElementById(`btnSaveShape`),`click`,async()=>{let t=s();if(!t||!i||!i.imageSrc)return;i.name=e.shapeName.value.trim()||`Untitled shape`,i.width=Math.max(16,Math.min(1200,Math.round(Number(e.shapeWidth.value)||65))),i.height=Math.max(16,Math.min(1200,Math.round(Number(e.shapeHeight.value)||65))),i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked;let n=t.shapes.findIndex(e=>e.id===i.id);n>=0?t.shapes[n]=structuredClone(i):t.shapes.push(structuredClone(i)),r=i.id,g(),await m()}),[`shapeName`,`shapeWidth`,`shapeHeight`,`labelPlacement`,`shapeShowInDiagram`].forEach(t=>{C(document.getElementById(t),`input`,()=>{i.name=e.shapeName.value,i.width=Number(e.shapeWidth.value)||65,i.height=Number(e.shapeHeight.value)||65,i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked})}),C(e.imageFile,`change`,async()=>{let t=e.imageFile.files&&e.imageFile.files[0];if(!t||!i)return;let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}),r=(t.name.split(`.`).pop()||`png`).toLowerCase().replace(/[^a-z0-9]/g,``)||`png`,a=t.name.replace(/\.[^.]+$/,``).slice(0,60),o=await(await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:n,ext:r,name:a})})).json();i.imageSrc=`/images/${o.filename}`,(!e.shapeName.value||e.shapeName.value===`New shape`)&&(i.name=a||i.name),y()}),p(),()=>{S.forEach(e=>e()),S.length=0}}var lg=W(`<div class="ld-shape-editor h-screen overflow-hidden bg-gray-50 text-gray-900"><header class="h-12 border-b border-gray-200 bg-white flex items-center gap-2 px-3"><button class="btn">← Back</button> <h1 class="text-sm font-semibold">Shape editor</h1> <span id="saveState" class="ml-auto text-xs text-gray-500"></span></header> <main class="h-[calc(100vh-3rem)] grid grid-cols-[17rem_1fr] overflow-hidden"><aside class="border-r border-gray-200 bg-white flex flex-col min-h-0"><div class="p-3 border-b border-gray-200 space-y-2"><label class="block text-xs font-semibold text-gray-500">Library</label> <div class="flex gap-2"><select id="librarySelect" class="field flex-1"></select> <button id="btnAddLibrary" class="btn">+</button></div> <input id="libraryName" class="field w-full" placeholder="Library name"/></div> <div class="p-3 border-b border-gray-200 flex gap-2"><button id="btnNewShape" class="btn btn-primary flex-1">New shape</button> <button id="btnDeleteShape" class="btn btn-danger">Delete</button></div> <div id="shapeList" class="flex-1 overflow-y-auto p-2 space-y-1"></div></aside> <section class="min-w-0 min-h-0 overflow-y-auto p-5"><div class="grid grid-cols-[minmax(20rem,34rem)_minmax(20rem,1fr)] gap-5 items-start"><div class="space-y-3"><div id="previewStage"><img id="previewImage" alt=""/></div> <p class="text-xs text-gray-500">Click on the image to add an anchor. Drag anchors to refine their
|
|
143
|
+
position.</p></div> <div class="space-y-4"><div class="grid grid-cols-2 gap-3"><label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Shape name</span> <input id="shapeName" class="field w-full" placeholder="Shape name"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Image / SVG</span> <input id="imageFile" type="file" accept="image/*,.svg" class="block w-full text-sm"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Width</span> <input id="shapeWidth" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Height</span> <input id="shapeHeight" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1 col-span-2"><span class="block text-xs font-semibold text-gray-500">Text placement</span> <select id="labelPlacement" class="field w-full"><option> </option><option> </option><option> </option><option> </option><option> </option></select></label> <label class="col-span-2 flex items-start gap-2 rounded-md border border-gray-200 bg-white px-2 py-2 text-sm"><input id="shapeShowInDiagram" type="checkbox" class="mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600"/> <span class="space-y-0.5"><span class="block font-semibold text-gray-700"> </span> <span class="block text-xs text-gray-500"> </span></span></label></div> <div class="flex flex-wrap gap-2"><button id="btnDefaultAnchors" class="btn">Use 8 default anchors</button> <button id="btnClearAnchors" class="btn">Clear anchors</button> <button id="btnSaveShape" class="btn btn-primary">Save shape</button></div> <div><div class="flex items-center justify-between mb-2"><h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500">Anchors</h2> <span id="anchorCount" class="text-xs text-gray-500"></span></div> <div id="anchorList" class="space-y-1"></div></div></div></div></section></main></div>`);function ug(e,t){Ge(t,!1),Vi(async()=>{try{await fa((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{await fa(`en`)}return cg()}),Ri();var n=lg(),r=R(n),i=R(r);Pe(4),N(r);var a=B(r,2),o=B(R(a),2),s=R(o),c=B(R(s),2),l=R(c),u=B(R(l),8),d=B(R(u),2),f=R(d),p=R(f,!0);N(f),f.value=f.__value=`below`;var m=B(f),h=R(m,!0);N(m),m.value=m.__value=`above`;var g=B(m),_=R(g,!0);N(g),g.value=g.__value=`right`;var v=B(g),y=R(v,!0);N(v),v.value=v.__value=`left`;var b=B(v),x=R(b,!0);N(b),b.value=b.__value=`center`,N(d),N(u);var S=B(u,2),C=B(R(S),2),w=R(C),T=R(w,!0);N(w);var E=B(w,2),D=R(E,!0);N(E),N(C),N(S),N(l),Pe(4),N(c),N(s),N(o),N(a),N(n),V((e,t,n,r,i,a,o)=>{K(p,e),K(h,t),K(_,n),K(y,r),K(x,i),K(T,a),K(D,o)},[()=>Y(`shape_editor.label_placement.below`),()=>Y(`shape_editor.label_placement.above`),()=>Y(`shape_editor.label_placement.right`),()=>Y(`shape_editor.label_placement.left`),()=>Y(`shape_editor.label_placement.center`),()=>Y(`shape_editor.show_in_diagram_label`),()=>Y(`shape_editor.show_in_diagram_hint`)]),U(`click`,i,()=>history.back()),G(e,n),Ke()}Nr([`click`]);var dg=W(`<p style="padding:2rem"> </p>`);function fg(e,t){Ge(t,!0);function n(e){return e.length>1?e.replace(/\/+$/,``):e}let r=F(L(n(window.location.pathname)));window.addEventListener(`popstate`,()=>{I(r,n(window.location.pathname),!0)}),On(()=>{H(r)===`/blueprint`?document.documentElement.setAttribute(`data-blueprint`,``):document.documentElement.removeAttribute(`data-blueprint`)});function i(e){history.pushState(null,``,e),I(r,n(e),!0)}var a=Ur(),o=z(a),s=e=>{Ca(e,{navigate:i})},c=e=>{ao(e,{})},l=e=>{Sl(e,{})},u=e=>{Fl(e,{})},d=e=>{hu(e,{navigate:i})},f=e=>{Tu(e,{})},p=e=>{Jh(e,{})},m=e=>{ug(e,{})},h=e=>{Hh(e,{})},g=e=>{var t=dg(),n=R(t);N(t),V(()=>K(n,`Route "${H(r)??``}" — not yet migrated.`)),G(e,t)};q(o,e=>{H(r)===`/admin`?e(s):H(r)===`/blueprint`?e(c,1):H(r)===`/workspace`?e(l,2):H(r)===`/files`?e(u,3):H(r)===`/context`?e(d,4):H(r)===`/agents`?e(f,5):H(r)===`/diagram`?e(p,6):H(r)===`/shape-editor`?e(m,7):H(r)===`/`?e(h,8):e(g,-1)}),G(e,a),Ke()}Wr(fg,{target:document.getElementById(`app`)});export{ng as a,og as c,Yh as d,fa as f,rg as i,sg as l,tg as n,ag as o,Y as p,ig as r,eg as s,Zh as t,Xh as u};
|