@inkeep/open-knowledge 0.4.0-beta.27 → 0.4.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
  2. package/dist/cli.mjs +21 -21
  3. package/dist/constants-Vc8PoRm6.mjs +2 -0
  4. package/dist/dist-Cg4a9GjH.mjs +1 -0
  5. package/dist/{dist-BY6hbGlq.mjs → dist-H3Ld-L-a.mjs} +15 -15
  6. package/dist/{dist-DNYO-J2I.mjs → dist-Va4IjzRw.mjs} +3 -3
  7. package/dist/index.d.mts +4 -3
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-B3-z2S8e.mjs +408 -0
  10. package/dist/init-BOu8bdIM.mjs +1 -0
  11. package/dist/loader-CtxyptVz.mjs +1 -0
  12. package/dist/{loader-CJZ7xojT.mjs → loader-nzXlKCaJ.mjs} +3 -3
  13. package/dist/{preview-f8NorGUB.mjs → preview-C5ZZtQhd.mjs} +2 -2
  14. package/dist/preview-smcIxud0.mjs +1 -0
  15. package/dist/public/assets/{ActivityModeContent-Dlois8m1.js → ActivityModeContent-CSzGBekb.js} +1 -1
  16. package/dist/public/assets/DocumentContext-HTIMnclU.js +37 -0
  17. package/dist/public/assets/{GraphPanel-BWlIJ3tc.js → GraphPanel-Bh6hilLJ.js} +2 -2
  18. package/dist/public/assets/McpConsentDialogBody-CYvKd5CR.js +1 -0
  19. package/dist/public/assets/SettingsDialog-Bn0Qb8Z-.js +11 -0
  20. package/dist/public/assets/{SourceEditor-BGZmwp3D.js → SourceEditor-CLnmY3Yf.js} +1 -1
  21. package/dist/public/assets/{config-validation-events-Czaccnqg.js → config-validation-events-CiSk03iO.js} +2 -2
  22. package/dist/public/assets/{doc-hash-CBF-HGTP.js → doc-hash-BSwTWr6y.js} +16 -16
  23. package/dist/public/assets/{index-CS7FfInu.js → index-BOCOmOox.js} +76 -76
  24. package/dist/public/assets/index-CjbILLtI.css +1 -0
  25. package/dist/public/assets/{checkbox-DBLbPikY.js → mcp-consent-store-DZ1pCmhN.js} +1 -1
  26. package/dist/public/assets/{target-navigation-intent-CFNdedu6.js → target-navigation-intent-BpcRYgIB.js} +1 -1
  27. package/dist/public/assets/{toggle-group-DC1U2RZo.js → toggle-group-CZU3XaIH.js} +1 -1
  28. package/dist/public/assets/{tooltip-BsZgyNLI.js → tooltip-DcfXr4mU.js} +1 -1
  29. package/dist/public/assets/{typing-burst-detector-CvoRQQEa.js → typing-burst-detector-BbQifQft.js} +1 -1
  30. package/dist/public/index.html +10 -10
  31. package/dist/{src-B4WFg5kb.mjs → src-DCHO3Oll.mjs} +2 -2
  32. package/dist/{start-CuX8s4nh.mjs → start-_HvLGlDx.mjs} +2 -2
  33. package/dist/start-e6EurRTD.mjs +1 -0
  34. package/package.json +1 -1
  35. package/dist/constants-DjLdNmzD.mjs +0 -2
  36. package/dist/dist-DKX8LweU.mjs +0 -1
  37. package/dist/init-BdDRn515.mjs +0 -408
  38. package/dist/init-CovPPI41.mjs +0 -1
  39. package/dist/loader-C4NU0t04.mjs +0 -1
  40. package/dist/preview-CA76mHAB.mjs +0 -1
  41. package/dist/public/assets/DocumentContext-B0jD_DRX.js +0 -37
  42. package/dist/public/assets/McpConsentDialogBody-8EQrQlPS.js +0 -1
  43. package/dist/public/assets/SettingsDialog-Jq0VRnPP.js +0 -11
  44. package/dist/public/assets/index-gFJyDijz.css +0 -1
  45. package/dist/start-BeA0EREH.mjs +0 -1
@@ -321,29 +321,29 @@ $2`).split(`
321
321
  `)].join(`
322
322
  `);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
323
323
  `))n.push(` ${t}`);return n.join(`
324
- `)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}const AW=`__system__`,jW=1,MW=`__config__/project`,NW=`__user__/config.yml`,PW=`__local__/project`,FW=`__config__/okignore`,IW=Object.freeze([MW,PW,NW,FW]),LW=`Ov23liqlSd0V1MwR6rhI`,RW=[`incoming`,`outgoing`,`both`];function zW(e){return RW.includes(e)}const BW=`localhost`,VW=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],HW=[`video/mp4`,`video/webm`,`video/ogg`],UW=[`audio/mpeg`,`audio/wav`,`audio/ogg`],WW=[`application/pdf`],GW=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),KW=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),qW=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),JW=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),YW=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),XW=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.csv.txt.rtf.json`.split(`.`)),ZW=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus`.split(`.`)),QW=`same-dir`,$W=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),eG=[`png`,`jpg`,`jpeg`],tG=[`mp4`];function nG(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}nG(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,eG,GW),nG(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,tG,KW),nG(`FILE_ATTACHMENT_EXTENSIONS`,[...JW],$W);const rG=new Set(eG),iG=new Set(tG);nG(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...eG,...tG])],ZW);function aG(e){let t=e.toLowerCase().replace(/^\./,``);return rG.has(t)?`image`:iG.has(t)?`video`:null}const oG=Ub.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),sG=nx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[bb({find:Zb,type:this.type,getAttributes:{sourceDelimiter:`*`}}),bb({find:$b,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),cG=Xb.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[bb({find:Gb,type:this.type,getAttributes:{sourceDelimiter:`**`}}),bb({find:qb,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),lG=$y.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),uG=ix.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),dG=ox.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1}}}}),fG=Lb.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),pG=Lb.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),mG=Lb.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),hG=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],gG=hG.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${gG}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function _G(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const vG=new Set(hG.map(e=>`${e}:`));function yG(e){try{let t=new URL(e,`https://placeholder.invalid`);return vG.has(t.protocol.toLowerCase())}catch{return!1}}const bG=vx.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:yG,validate:yG,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),xG=Lb.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function SG(e){return e.type.name===`list`&&!e.attrs.ordered}function CG(e){return e.type.name===`list`&&!!e.attrs.ordered}function wG(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function TG(e,t,n,r,i,a,o){let s=Pv(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?jf(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o??{}})}}),t(n),!0}return Of(n,a)(e,void 0)?t?Of(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}const EG=Lb.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,Wv(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:TG(e,t,n,r,e=>SG(e)&&!wG(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:TG(e,t,n,r,e=>CG(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:TG(e,t,n,r,e=>SG(e)&&wG(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Cb({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Cb({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new Gy({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Uu(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),DG=Lb.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Wv(t),0]:[`li`,Wv(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(Wv(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),OG=EG,kG=DG,AG=Lb.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),jG=Lb.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),MG=kC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),NG=NC.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),PG=Lb.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),FG=$y.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),IG=Lb.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),LG=Lb.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),RG=Lb.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}});function zG(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const BG=fT.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Wv(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=zG(t.src)),[`img`,t]}}),VG=$y.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function HG(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r?!0:UG(n)===r}function UG(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const WG=EC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),GG=dC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),KG=fC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),qG=Lb.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),JG=/^(?:---|—-|___\s|\*\*\*\s)$/;function YG(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const XG=IC.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[xb({find:JG,type:this.type,getAttributes:e=>({sourceRaw:YG(e)})})]}});function ZG(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function QG(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const $G=Lb.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:ZG(e.getAttribute(`data-alias`)),anchor:ZG(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:ZG(e.getAttribute(`data-alias`)),anchor:ZG(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=ZG(e.attrs.alias),i=ZG(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},QG({target:n,alias:r,anchor:i})]}});function eK(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function tK(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const nK=[pG,jG,mG,AG,$G,Lb.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:ZG(e.getAttribute(`data-alias`)),anchor:ZG(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=ZG(e.attrs.alias),i=ZG(e.attrs.anchor),a=ZG(e.attrs.resolvedSrc),o=eK(n);if(GW.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},tK({target:n,alias:r,anchor:i})]}}),qG,OG,kG,sG,cG,NG,oG,MG,dG,XG,bG,fG,xG,uG,lG,VG,uT.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),WG.configure({resizable:!0}),pC,KG,GG,BG.configure({inline:!0}),RG,xx,FG,PG,LG,IG],rK=/^[a-zA-Z][\w/-]*$/;function iK(e){return e.startsWith(`#`)?e.slice(1):e}function aK(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function oK(e){if(!e||e.trim()===``)return[];let{map:t}=tW(e);if(!t)return[];let n=aK(t.tags),r=[];for(let e of n){let t=iK(e);rK.test(t)?r.push(t):console.warn(`[frontmatter-tags] dropping invalid tag entry: ${JSON.stringify(e)}`)}return r}const sK=A().refine(e=>!e.includes(`..`)&&!e.startsWith(`/`)&&!e.includes(`\0`)&&!e.includes(`\\`),{message:`docName contains unsafe path characters`}).optional(),cK={agentId:A().optional(),agentName:A().optional(),colorSeed:A().optional(),clientName:A().optional(),clientVersion:A().optional(),label:A().optional()},lK=A().optional(),uK=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,dK=N({serverInstanceId:A().min(1),currentBranch:A().min(1).optional(),currentDiskAckSVs:Vs(A().min(1),A().min(1)).optional()}).loose(),fK=N({id:A().min(1),display_name:A().min(1),display_email:A(),source:Us([`git-config`,`synthesized`]),created_at:A().min(1)}).loose(),pK=Us(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed`.split(`.`));function mK(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const hK=N({type:pK,title:A().min(1),status:j().int().min(400).max(599),instance:A().regex(uK,`instance must be urn:uuid:<uuid>`).optional(),detail:A().optional()}).loose(),gK=N({parentDocName:A().min(1),agentId:A().min(1).optional(),agentName:A().min(1).optional()}).loose(),_K=N({src:A().min(1),path:A().min(1).optional(),deduped:Ss().optional()}).loose(),vK=N({url:A().min(1),dir:A().min(1)}).loose(),yK=N({type:Gs(`error`),problem:hK}).loose();function bK(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=xK(e,t);r>=0?n[r]=o:n.push(o)}return n}function xK(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function SK(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:bK(t,r),children:n.all(t),data:{}}}const CK=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],wK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:VW,autoFocus:!0},{name:`alt`,type:`string`,required:!1,defaultValue:``,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],TK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:HW,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`}],EK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:UW,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],DK=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],OK=[CK[0],CK[1],CK[4],CK[5],CK[6]],kK=[wK[0],wK[1],wK[7]],AK=[DK[0],DK[1],DK[4],DK[5]],jK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],MK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],NK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],PK=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],FK=[PK[0]],IK=[PK[0]],LK=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,language:`mermaid`,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#system-arch-diagram`)"},{name:`theme`,type:`enum`,enumValues:[`default`,`dark`,`forest`,`neutral`],defaultValue:`default`,required:!1,advanced:!0,description:"Mermaid theme — default ships only `default` styling; alternates land alongside theme-switching infrastructure"}],RK=[LK[0]],zK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],BK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],VK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:WW,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}];function HK(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function UK(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function WK(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}const GK=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:CK,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>SK(`Callout`,e,t,CK)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:wK,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>SK(`img`,e,t,wK)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:TK,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>SK(`video`,e,t,TK)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:EK,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>SK(`audio`,e,t,EK)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:VK,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>SK(`Pdf`,e,t,VK)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:BK,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>SK(`File`,e,t,BK)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:DK,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],serialize:(e,t)=>SK(`Accordion`,e,t,DK)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:PK,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>SK(`Math`,e,t,PK)},{name:`Mermaid`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:LK,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:`Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie)`,searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:(e,t)=>SK(`Mermaid`,e,t,LK)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:OK,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:kK,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:jK,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:WK},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:MK,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:WK},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:NK,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:WK},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:zK,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:WK},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:AK,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${HK(n.name)}"`:``,a=n?.id?` id="${HK(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${UK(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:FK,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:IK,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})},{name:`MermaidFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:RK,icon:`Workflow`,category:`content`,displayName:`Mermaid Fence`,description:"Mermaid diagram via ` ```mermaid ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Mermaid block for the full prop surface (id, theme).",rendersAs:`Mermaid`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})}],KK={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>SK(e.attrs.componentName||`*`,e,t)};function qK(){let e=new Map;e.set(`*`,KK);for(let t of GK)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}function JK(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const YK={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{}};function XK(){YK.parseFallback.blockLevel++}function ZK(){YK.parseFallback.wholeDoc++}function QK(){let e=JK();return{parseFallback:{...YK.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...YK.jsxRenderFailure},jsxAutoConvertFailed:{...YK.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...YK.jsxAutoConvertSucceeded},jsxPropDropped:{...YK.jsxPropDropped},jsxMoveFailed:{...YK.jsxMoveFailed},jsxStuckCopyFailed:{...YK.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...YK.jsxStuckDeleteFailed}}}const $K=/^(`{3,}|~{3,})/gm;function eq(e){let t=[],n=null;for(let r of e.matchAll($K)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function tq(e,t){return t.some(([t,n])=>e>=t&&e<n)}const nq=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function rq(e){let t=eq(e),n=[];for(let r of e.matchAll(nq))tq(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
325
- `)}\n\n`:``}function iq(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return sq(e,t.parse,0,n)}function aq(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function oq(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
324
+ `)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}const AW=`__system__`,jW=1,MW=`__config__/project`,NW=`__user__/config.yml`,PW=`__local__/project`,FW=`__config__/okignore`,IW=Object.freeze([MW,PW,NW,FW]),LW=[`claude`,`claude-desktop`,`cursor`,`codex`],RW={claude:`Claude Code`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`},zW=`Ov23liqlSd0V1MwR6rhI`,BW=[`incoming`,`outgoing`,`both`];function VW(e){return BW.includes(e)}const HW=`localhost`,UW=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],WW=[`video/mp4`,`video/webm`,`video/ogg`],GW=[`audio/mpeg`,`audio/wav`,`audio/ogg`],KW=[`application/pdf`],qW=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),JW=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),YW=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),XW=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),ZW=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),QW=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.csv.txt.rtf.json`.split(`.`)),$W=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus`.split(`.`)),eG=`same-dir`,tG=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),nG=[`png`,`jpg`,`jpeg`],rG=[`mp4`];function iG(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}iG(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,nG,qW),iG(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,rG,JW),iG(`FILE_ATTACHMENT_EXTENSIONS`,[...XW],tG);const aG=new Set(nG),oG=new Set(rG);iG(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...nG,...rG])],$W);function sG(e){let t=e.toLowerCase().replace(/^\./,``);return aG.has(t)?`image`:oG.has(t)?`video`:null}const cG=Ub.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),lG=nx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[bb({find:Zb,type:this.type,getAttributes:{sourceDelimiter:`*`}}),bb({find:$b,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),uG=Xb.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[bb({find:Gb,type:this.type,getAttributes:{sourceDelimiter:`**`}}),bb({find:qb,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),dG=$y.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),fG=ix.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),pG=ox.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1}}}}),mG=Lb.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),hG=Lb.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),gG=Lb.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),_G=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],vG=_G.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${vG}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function yG(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const bG=new Set(_G.map(e=>`${e}:`));function xG(e){try{let t=new URL(e,`https://placeholder.invalid`);return bG.has(t.protocol.toLowerCase())}catch{return!1}}const SG=vx.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:xG,validate:xG,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),CG=Lb.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function wG(e){return e.type.name===`list`&&!e.attrs.ordered}function TG(e){return e.type.name===`list`&&!!e.attrs.ordered}function EG(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function DG(e,t,n,r,i,a,o){let s=Pv(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?jf(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o??{}})}}),t(n),!0}return Of(n,a)(e,void 0)?t?Of(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}const OG=Lb.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,Wv(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:DG(e,t,n,r,e=>wG(e)&&!EG(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:DG(e,t,n,r,e=>TG(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:DG(e,t,n,r,e=>wG(e)&&EG(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Cb({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Cb({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new Gy({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Uu(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),kG=Lb.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,Wv(t),0]:[`li`,Wv(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(Wv(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),AG=OG,jG=kG,MG=Lb.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),NG=Lb.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),PG=kC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),FG=NC.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),IG=Lb.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),LG=$y.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),RG=Lb.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),zG=Lb.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),BG=Lb.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}});function VG(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const HG=fT.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Wv(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=VG(t.src)),[`img`,t]}}),UG=$y.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function WG(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r?!0:GG(n)===r}function GG(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const KG=EC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),qG=dC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),JG=fC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),YG=Lb.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),XG=/^(?:---|—-|___\s|\*\*\*\s)$/;function ZG(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const QG=IC.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[xb({find:XG,type:this.type,getAttributes:e=>({sourceRaw:ZG(e)})})]}});function $G(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function eK(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const tK=Lb.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:$G(e.getAttribute(`data-alias`)),anchor:$G(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:$G(e.getAttribute(`data-alias`)),anchor:$G(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=$G(e.attrs.alias),i=$G(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},eK({target:n,alias:r,anchor:i})]}});function nK(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function rK(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const iK=[hG,NG,gG,MG,tK,Lb.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:$G(e.getAttribute(`data-alias`)),anchor:$G(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=$G(e.attrs.alias),i=$G(e.attrs.anchor),a=$G(e.attrs.resolvedSrc),o=nK(n);if(qW.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},rK({target:n,alias:r,anchor:i})]}}),YG,AG,jG,lG,uG,FG,cG,PG,pG,QG,SG,mG,CG,fG,dG,UG,uT.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),KG.configure({resizable:!0}),pC,JG,qG,HG.configure({inline:!0}),BG,xx,LG,IG,zG,RG],aK=/^[a-zA-Z][\w/-]*$/;function oK(e){return e.startsWith(`#`)?e.slice(1):e}function sK(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function cK(e){if(!e||e.trim()===``)return[];let{map:t}=tW(e);if(!t)return[];let n=sK(t.tags),r=[];for(let e of n){let t=oK(e);aK.test(t)?r.push(t):console.warn(`[frontmatter-tags] dropping invalid tag entry: ${JSON.stringify(e)}`)}return r}const lK=A().refine(e=>!e.includes(`..`)&&!e.startsWith(`/`)&&!e.includes(`\0`)&&!e.includes(`\\`),{message:`docName contains unsafe path characters`}).optional(),uK={agentId:A().optional(),agentName:A().optional(),colorSeed:A().optional(),clientName:A().optional(),clientVersion:A().optional(),label:A().optional()},dK=A().optional(),fK=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,pK=N({serverInstanceId:A().min(1),currentBranch:A().min(1).optional(),currentDiskAckSVs:Vs(A().min(1),A().min(1)).optional()}).loose(),mK=N({id:A().min(1),display_name:A().min(1),display_email:A(),source:Us([`git-config`,`synthesized`]),created_at:A().min(1)}).loose(),hK=Us(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed`.split(`.`));function gK(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const _K=N({type:hK,title:A().min(1),status:j().int().min(400).max(599),instance:A().regex(fK,`instance must be urn:uuid:<uuid>`).optional(),detail:A().optional()}).loose(),vK=N({parentDocName:A().min(1),agentId:A().min(1).optional(),agentName:A().min(1).optional()}).loose(),yK=N({src:A().min(1),path:A().min(1).optional(),deduped:Ss().optional()}).loose(),bK=N({url:A().min(1),dir:A().min(1)}).loose(),xK=N({type:Gs(`error`),problem:_K}).loose();function SK(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=CK(e,t);r>=0?n[r]=o:n.push(o)}return n}function CK(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function wK(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:SK(t,r),children:n.all(t),data:{}}}const TK=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],EK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:UW,autoFocus:!0},{name:`alt`,type:`string`,required:!1,defaultValue:``,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],DK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:WW,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`}],OK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:GW,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],kK=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],AK=[TK[0],TK[1],TK[4],TK[5],TK[6]],jK=[EK[0],EK[1],EK[7]],MK=[kK[0],kK[1],kK[4],kK[5]],NK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],PK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],FK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],IK=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],LK=[IK[0]],RK=[IK[0]],zK=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,language:`mermaid`,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#system-arch-diagram`)"},{name:`theme`,type:`enum`,enumValues:[`default`,`dark`,`forest`,`neutral`],defaultValue:`default`,required:!1,advanced:!0,description:"Mermaid theme — default ships only `default` styling; alternates land alongside theme-switching infrastructure"}],BK=[zK[0]],VK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],HK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],UK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:KW,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}];function WK(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function GK(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function KK(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}const qK=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:TK,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>wK(`Callout`,e,t,TK)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:EK,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>wK(`img`,e,t,EK)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:DK,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>wK(`video`,e,t,DK)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:OK,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>wK(`audio`,e,t,OK)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:UK,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>wK(`Pdf`,e,t,UK)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:HK,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>wK(`File`,e,t,HK)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:kK,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],serialize:(e,t)=>wK(`Accordion`,e,t,kK)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:IK,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>wK(`Math`,e,t,IK)},{name:`Mermaid`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:zK,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:`Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie)`,searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:(e,t)=>wK(`Mermaid`,e,t,zK)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:AK,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:jK,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:NK,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:KK},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:PK,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:KK},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:FK,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:KK},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:VK,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:KK},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:MK,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${WK(n.name)}"`:``,a=n?.id?` id="${WK(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${GK(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:LK,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:RK,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})},{name:`MermaidFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:BK,icon:`Workflow`,category:`content`,displayName:`Mermaid Fence`,description:"Mermaid diagram via ` ```mermaid ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Mermaid block for the full prop surface (id, theme).",rendersAs:`Mermaid`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})}],JK={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>wK(e.attrs.componentName||`*`,e,t)};function YK(){let e=new Map;e.set(`*`,JK);for(let t of qK)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}function XK(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const ZK={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{}};function QK(){ZK.parseFallback.blockLevel++}function $K(){ZK.parseFallback.wholeDoc++}function eq(){let e=XK();return{parseFallback:{...ZK.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...ZK.jsxRenderFailure},jsxAutoConvertFailed:{...ZK.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...ZK.jsxAutoConvertSucceeded},jsxPropDropped:{...ZK.jsxPropDropped},jsxMoveFailed:{...ZK.jsxMoveFailed},jsxStuckCopyFailed:{...ZK.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...ZK.jsxStuckDeleteFailed}}}const tq=/^(`{3,}|~{3,})/gm;function nq(e){let t=[],n=null;for(let r of e.matchAll(tq)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function rq(e,t){return t.some(([t,n])=>e>=t&&e<n)}const iq=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function aq(e){let t=nq(e),n=[];for(let r of e.matchAll(iq))rq(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
325
+ `)}\n\n`:``}function oq(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return lq(e,t.parse,0,n)}function sq(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function cq(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
326
326
  `).slice(0,4).join(`
327
- `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function sq(e,t,n,r){if(n>20)return ZK(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),gq(e);if(r){if(aq(r))return ZK(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),gq(e);r.calls+=1}try{return t(e)}catch(i){let a=cq(i),o=oq(i);if(a===void 0){if(n===0){let n=hq(e,t,i,r);if(n)return n}return ZK(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),gq(e)}XK(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=pq(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?sq(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?sq(rq(s)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:c?[{type:`text`,text:c}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){ZK();let n=oq(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),gq(e)}}}function cq(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function lq(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function uq(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function dq(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(tq(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function fq(e){let t=dq(e,eq(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=uq(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=uq(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function pq(e,t){let n=fq(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:lq(e,t)??0,end:uq(e,t)??e.length}}function mq(e){let t=eq(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;tq(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function hq(e,t,n,r){let i=mq(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&aq(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=rq(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){XK();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function gq(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const _q=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,vq=/<!--[\s\S]*?-->/g,yq=/<\/([a-z][a-z0-9]*)\s*>/g,bq=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,xq=new Set([`img`,`video`,`audio`]),Sq=new Set([`mark`]),Cq=/<\/([A-Z][A-Za-z0-9.]*)>/g;function wq(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function Tq(e){let t=new Map,n=new RegExp(Cq.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function Eq(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function Dq(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function Oq(e){let t=e;t=t.replace(vq,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(_q,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(yq,(e,t)=>Sq.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(bq,(e,t)=>xq.has(t)&&e.endsWith(`/>`)||Sq.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let n=Tq(t),r=Eq(t),i=Dq(t);t=t.replace(/</g,(e,a)=>{let o=t.slice(a,a+256);if(o[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(o)?e:``;let s=/^<([a-z][a-z0-9]*)([^>]*)\/>/.exec(o);if(s&&xq.has(s[1]))return e;let c=/^<([a-z][a-z0-9]*)([\s/>])/.exec(o);if(c&&Sq.has(c[1])){let n=c[1];return o.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,a)!==-1?e:``}let l=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(o);if(!l)return``;let u=l[1],d=wq(r,a),f=wq(i,d<r.length?r[d]:t.length);if(f>0){let n=i[f-1];if(n>a){let r=a+l[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let p=n.get(u);return p&&wq(p,a)<p.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
327
+ `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function lq(e,t,n,r){if(n>20)return $K(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),vq(e);if(r){if(sq(r))return $K(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),vq(e);r.calls+=1}try{return t(e)}catch(i){let a=uq(i),o=cq(i);if(a===void 0){if(n===0){let n=_q(e,t,i,r);if(n)return n}return $K(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),vq(e)}QK(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=hq(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?lq(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?lq(aq(s)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:c?[{type:`text`,text:c}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){$K();let n=cq(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),vq(e)}}}function uq(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function dq(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function fq(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function pq(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(rq(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function mq(e){let t=pq(e,nq(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=fq(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=fq(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function hq(e,t){let n=mq(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:dq(e,t)??0,end:fq(e,t)??e.length}}function gq(e){let t=nq(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;rq(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function _q(e,t,n,r){let i=gq(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&sq(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=aq(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){QK();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function vq(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const yq=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,bq=/<!--[\s\S]*?-->/g,xq=/<\/([a-z][a-z0-9]*)\s*>/g,Sq=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,Cq=new Set([`img`,`video`,`audio`]),wq=new Set([`mark`]),Tq=/<\/([A-Z][A-Za-z0-9.]*)>/g;function Eq(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function Dq(e){let t=new Map,n=new RegExp(Tq.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function Oq(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function kq(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function Aq(e){let t=e;t=t.replace(bq,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(yq,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(xq,(e,t)=>wq.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(Sq,(e,t)=>Cq.has(t)&&e.endsWith(`/>`)||wq.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let n=Dq(t),r=Oq(t),i=kq(t);t=t.replace(/</g,(e,a)=>{let o=t.slice(a,a+256);if(o[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(o)?e:``;let s=/^<([a-z][a-z0-9]*)([^>]*)\/>/.exec(o);if(s&&Cq.has(s[1]))return e;let c=/^<([a-z][a-z0-9]*)([\s/>])/.exec(o);if(c&&wq.has(c[1])){let n=c[1];return o.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,a)!==-1?e:``}let l=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(o);if(!l)return``;let u=l[1],d=Eq(r,a),f=Eq(i,d<r.length?r[d]:t.length);if(f>0){let n=i[f-1];if(n>a){let r=a+l[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let p=n.get(u);return p&&Eq(p,a)<p.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
328
328
  `){let i=t[r+1];if(i===`
329
329
  `||i===`>`){if(e.push(...n),n.length=0,i===`
330
330
  `)for(;t[r+1]===`
331
- `;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=[...t];for(let t of e)n[t]=``;t=n.join(``)}}return t}function kq(e){return e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)}function Aq(){return e=>{KA(e,e=>{let t=e;typeof t.value==`string`&&kq(t.value)&&(t.value=jq(t.value)),typeof t.url==`string`&&kq(t.url)&&(t.url=jq(t.url)),typeof t.title==`string`&&kq(t.title)&&(t.title=jq(t.title)),typeof t.alt==`string`&&kq(t.alt)&&(t.alt=jq(t.alt))})}}function jq(e){return e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`)}const Mq=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function Nq(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function Pq(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||Nq(e,r)%2==1?t:n(t))}function Fq(e){return Pq(e,Mq,e=>`${e.slice(1,-1)}`)}const Iq=RegExp(`([^]+)`,`g`);function Lq(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;Iq.lastIndex=0;let i=Iq.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=Iq.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function Rq(){return e=>{KA(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=Lq(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=Lq(n).value)}})}}const zq=/\\</g;function Bq(e){return Pq(e,zq,e=>`${e.slice(1)}`)}function Vq(){return e=>{KA(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const Hq=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),Uq={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},Wq=`ok-alert`,Gq=RegExp(`(?:^|\\s)${Wq}-(\\w+)(?:\\s|$)`),Kq=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function qq(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
332
- `,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(Kq);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function Jq(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(Gq);return n?n[1].toLowerCase():null}function Yq(e){return Uq[e.toLowerCase()]??null}function Xq(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&Zq(o[0],s)?o.slice(1):o,position:e.position}}function Zq(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function Qq(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${Wq}-title`)}function $q(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;KA(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=Jq(e);if(!i)return;let a=Yq(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=qq(n,e.position.start.offset),s&&(o=s.title,a||=Yq(s.rawType)));let c=a??`note`,l=s&&Hq.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=qq(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!Qq(e.children[0]))return;let f=Xq(e,c,o,l,d);r.children[t]=f})}}const eJ={markers:`*`,classPrefix:Wq,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})},tJ=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,nJ=/<!--([\s\S]*?)-->/g;function rJ(){return e=>{aJ(e),KA(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`%%`)===-1&&r.indexOf(`<!--`)===-1)return;let i=iJ(r);if(i.length===0)return;let a=[],o=0;for(let e of i){e.start>o&&a.push({type:`text`,value:r.slice(o,e.start)});let t={type:`comment`,children:[{type:`text`,value:e.body}],data:{sourceForm:e.sourceForm}};a.push(t),o=e.end}return o<r.length&&a.push({type:`text`,value:r.slice(o)}),n.children.splice(t,1,...a),[UA,t+a.length]})}}function iJ(e){let t=[];tJ.lastIndex=0;let n;for(;(n=tJ.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});nJ.lastIndex=0;let r;for(;(r=nJ.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function aJ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=oJ(e);if(r!==null){let e=sJ(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=cJ(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=lJ(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=uJ(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&fJ(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&fJ(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function oJ(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function sJ(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function cJ(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function lJ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(dJ(r,`<!--`)>1||dJ(r,`-->`)>0)return null}else if(t===e.children.length-1){if(dJ(r,`<!--`)>0||dJ(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function uJ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function dJ(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function fJ(e){let t=oJ(e);return t===null?!1:t.trim()===`%%`}const pJ=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,mJ=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,hJ=/^\s*<\/details>\s*$/;function gJ(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function _J(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function vJ(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function yJ(e){return e.children[0].value??``}function bJ(e){if(!vJ(e))return null;let t=yJ(e).match(pJ);if(!t)return null;let{defaultOpen:n,name:r,id:i}=gJ(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:_J({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function xJ(e,t){let n=e[t];if(!vJ(n))return null;let r=yJ(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(mJ);if(!i)return null;let{defaultOpen:a,name:o,id:s}=gJ(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!vJ(t))continue;let r=yJ(t);if(hJ.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function SJ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(vJ(e)){let r=bJ(e);if(r){t[n]=r,n++;continue}let i=xJ(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:_J(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function CJ(){return e=>{KA(e,e=>{`children`in e&&Array.isArray(e.children)&&SJ(e)})}}const wJ=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function TJ(){return e=>{KA(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`==`)===-1)return;wJ.lastIndex=0;let i=[],a;for(;(a=wJ.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`mark`,children:[{type:`text`,value:e[1]}]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[UA,t+o.length]}),KA(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function EJ(){return e=>{KA(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=DJ(r,e);n.children[t]=i})}}function DJ(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];e.alt&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const OJ=/^( {4}|\t)/;function kJ(e){let t=e.split(`
333
- `),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!OJ.test(e)))return!1;return n}function AJ(e){return e.split(`
331
+ `;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=[...t];for(let t of e)n[t]=``;t=n.join(``)}}return t}function jq(e){return e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)||e.includes(``)}function Mq(){return e=>{KA(e,e=>{let t=e;typeof t.value==`string`&&jq(t.value)&&(t.value=Nq(t.value)),typeof t.url==`string`&&jq(t.url)&&(t.url=Nq(t.url)),typeof t.title==`string`&&jq(t.title)&&(t.title=Nq(t.title)),typeof t.alt==`string`&&jq(t.alt)&&(t.alt=Nq(t.alt))})}}function Nq(e){return e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`)}const Pq=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function Fq(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function Iq(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||Fq(e,r)%2==1?t:n(t))}function Lq(e){return Iq(e,Pq,e=>`${e.slice(1,-1)}`)}const Rq=RegExp(`([^]+)`,`g`);function zq(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;Rq.lastIndex=0;let i=Rq.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=Rq.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function Bq(){return e=>{KA(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=zq(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=zq(n).value)}})}}const Vq=/\\</g;function Hq(e){return Iq(e,Vq,e=>`${e.slice(1)}`)}function Uq(){return e=>{KA(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const Wq=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),Gq={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},Kq=`ok-alert`,qq=RegExp(`(?:^|\\s)${Kq}-(\\w+)(?:\\s|$)`),Jq=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function Yq(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
332
+ `,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(Jq);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function Xq(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(qq);return n?n[1].toLowerCase():null}function Zq(e){return Gq[e.toLowerCase()]??null}function Qq(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&$q(o[0],s)?o.slice(1):o,position:e.position}}function $q(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function eJ(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${Kq}-title`)}function tJ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;KA(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=Xq(e);if(!i)return;let a=Zq(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=Yq(n,e.position.start.offset),s&&(o=s.title,a||=Zq(s.rawType)));let c=a??`note`,l=s&&Wq.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=Yq(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!eJ(e.children[0]))return;let f=Qq(e,c,o,l,d);r.children[t]=f})}}const nJ={markers:`*`,classPrefix:Kq,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})},rJ=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,iJ=/<!--([\s\S]*?)-->/g;function aJ(){return e=>{sJ(e),KA(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`%%`)===-1&&r.indexOf(`<!--`)===-1)return;let i=oJ(r);if(i.length===0)return;let a=[],o=0;for(let e of i){e.start>o&&a.push({type:`text`,value:r.slice(o,e.start)});let t={type:`comment`,children:[{type:`text`,value:e.body}],data:{sourceForm:e.sourceForm}};a.push(t),o=e.end}return o<r.length&&a.push({type:`text`,value:r.slice(o)}),n.children.splice(t,1,...a),[UA,t+a.length]})}}function oJ(e){let t=[];rJ.lastIndex=0;let n;for(;(n=rJ.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});iJ.lastIndex=0;let r;for(;(r=iJ.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function sJ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=cJ(e);if(r!==null){let e=lJ(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=uJ(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=dJ(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=fJ(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&mJ(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&mJ(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function cJ(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function lJ(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function uJ(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function dJ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(pJ(r,`<!--`)>1||pJ(r,`-->`)>0)return null}else if(t===e.children.length-1){if(pJ(r,`<!--`)>0||pJ(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function fJ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function pJ(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function mJ(e){let t=cJ(e);return t===null?!1:t.trim()===`%%`}const hJ=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,gJ=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,_J=/^\s*<\/details>\s*$/;function vJ(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function yJ(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function bJ(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function xJ(e){return e.children[0].value??``}function SJ(e){if(!bJ(e))return null;let t=xJ(e).match(hJ);if(!t)return null;let{defaultOpen:n,name:r,id:i}=vJ(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:yJ({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function CJ(e,t){let n=e[t];if(!bJ(n))return null;let r=xJ(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(gJ);if(!i)return null;let{defaultOpen:a,name:o,id:s}=vJ(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!bJ(t))continue;let r=xJ(t);if(_J.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function wJ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(bJ(e)){let r=SJ(e);if(r){t[n]=r,n++;continue}let i=CJ(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:yJ(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function TJ(){return e=>{KA(e,e=>{`children`in e&&Array.isArray(e.children)&&wJ(e)})}}const EJ=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function DJ(){return e=>{KA(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`==`)===-1)return;EJ.lastIndex=0;let i=[],a;for(;(a=EJ.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`mark`,children:[{type:`text`,value:e[1]}]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[UA,t+o.length]}),KA(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function OJ(){return e=>{KA(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=kJ(r,e);n.children[t]=i})}}function kJ(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];e.alt&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const AJ=/^( {4}|\t)/;function jJ(e){let t=e.split(`
333
+ `),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!AJ.test(e)))return!1;return n}function MJ(e){return e.split(`
334
334
  `).map(e=>e.length===0?e:e.startsWith(` `)?e.slice(4):e.startsWith(` `)?e.slice(1):e).join(`
335
- `)}function jJ(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
336
- `;)a--;if(a===r)return null;let o=t.slice(a,r);if(!OJ.test(o))return null;let s=t.slice(a,i);if(!kJ(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:AJ(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const MJ=function(){return(e,t)=>{let n=String(t.value??``);n&&KA(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=jJ(e,n);a&&(r.children[t]=a)})}};function NJ(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function PJ(){return e=>{KA(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=NJ(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),KA(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=NJ(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const FJ=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function IJ(e){let t=[],n=!1;for(let r of e.children){if(r.type!==`text`){t.push(r);continue}let e=r.value;FJ.lastIndex=0;let i=[],a=0;for(;;){let t=FJ.exec(e);if(t===null)break;let r=t[0],o=t[1],s=t.index;s>a&&i.push({type:`text`,value:e.slice(a,s)});let c={type:`link`,url:o,title:null,children:[{type:`text`,value:o}],data:{sourceStyle:`autolink`}};i.push(c),a=s+r.length,n=!0}i.length===0?t.push(r):(a<e.length&&i.push({type:`text`,value:e.slice(a)}),t.push(...i))}n&&(e.children=t)}function LJ(e,t){if(e.children.length===0)return;let n=e.children[0];if(n.type!==`yaml`||(n.value??``).trim()!==``)return;let r=n.position?.start?.offset;if(r!==0)return;let i=n.position?.end?.offset;if(typeof i!=`number`)return;let a=typeof t.value==`string`?t.value:``;if(!a)return;let o=a.slice(r,i).split(`
337
- `),s=/^-{3,}\s*$/,c=o.filter(e=>s.test(e));if(c.length===0)return;let l=c.map(e=>({type:`thematicBreak`,data:{sourceRaw:e.replace(/\s+$/,``)}}));if(l.length>0){let e=c[0].length;l[0].position={start:{line:1,column:1,offset:0},end:{line:1,column:e+1,offset:e}}}e.children.splice(0,1,...l)}const RJ=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function zJ(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function BJ(e,t,n=!1){if(!t)return;let r=e.position;if(!r||typeof r.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let i=r.start.offset,a=r.end?.offset??i;if(i<0||a>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${i} end=${a} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(i,a),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&RJ.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[i];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(i,i+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[i],r=t.slice(i,a);if(n===`#`){e.data.sourceStyle=`atx`;let t=/^.*?[ \t](#+)[ \t]*$/.exec(r);t&&(e.data.sourceTrailingHashes=t[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(r),n=/\n(-+)[ \t]*$/.exec(r),i=t??n;i?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=i[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=i;for(;n>0&&t[n-1]!==`
335
+ `)}function NJ(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
336
+ `;)a--;if(a===r)return null;let o=t.slice(a,r);if(!AJ.test(o))return null;let s=t.slice(a,i);if(!jJ(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:MJ(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const PJ=function(){return(e,t)=>{let n=String(t.value??``);n&&KA(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=NJ(e,n);a&&(r.children[t]=a)})}};function FJ(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function IJ(){return e=>{KA(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=FJ(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),KA(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=FJ(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const LJ=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function RJ(e){let t=[],n=!1;for(let r of e.children){if(r.type!==`text`){t.push(r);continue}let e=r.value;LJ.lastIndex=0;let i=[],a=0;for(;;){let t=LJ.exec(e);if(t===null)break;let r=t[0],o=t[1],s=t.index;s>a&&i.push({type:`text`,value:e.slice(a,s)});let c={type:`link`,url:o,title:null,children:[{type:`text`,value:o}],data:{sourceStyle:`autolink`}};i.push(c),a=s+r.length,n=!0}i.length===0?t.push(r):(a<e.length&&i.push({type:`text`,value:e.slice(a)}),t.push(...i))}n&&(e.children=t)}function zJ(e,t){if(e.children.length===0)return;let n=e.children[0];if(n.type!==`yaml`||(n.value??``).trim()!==``)return;let r=n.position?.start?.offset;if(r!==0)return;let i=n.position?.end?.offset;if(typeof i!=`number`)return;let a=typeof t.value==`string`?t.value:``;if(!a)return;let o=a.slice(r,i).split(`
337
+ `),s=/^-{3,}\s*$/,c=o.filter(e=>s.test(e));if(c.length===0)return;let l=c.map(e=>({type:`thematicBreak`,data:{sourceRaw:e.replace(/\s+$/,``)}}));if(l.length>0){let e=c[0].length;l[0].position={start:{line:1,column:1,offset:0},end:{line:1,column:e+1,offset:e}}}e.children.splice(0,1,...l)}const BJ=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function VJ(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function HJ(e,t,n=!1){if(!t)return;let r=e.position;if(!r||typeof r.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let i=r.start.offset,a=r.end?.offset??i;if(i<0||a>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${i} end=${a} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(i,a),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&BJ.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[i];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(i,i+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[i],r=t.slice(i,a);if(n===`#`){e.data.sourceStyle=`atx`;let t=/^.*?[ \t](#+)[ \t]*$/.exec(r);t&&(e.data.sourceTrailingHashes=t[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(r),n=/\n(-+)[ \t]*$/.exec(r),i=t??n;i?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=i[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=i;for(;n>0&&t[n-1]!==`
338
338
  `;)n--;let r=!1;for(let e=n;e<i;e++)if(t[e]===`>`){r=!0;break}let o=t.slice(i,a).split(`
339
339
  `),s=[];for(let e=0;e<o.length;e++){let t=o[e];if(t.length===0)continue;if(r&&e>0)break;let n=t.replace(/^ {1,3}/,``);if(n[0]!==`>`||n.slice(1).trimEnd()===``)continue;let i=n[1];i===` `||i===` `?s.push(`single`):s.push(`none`)}s.length>0&&(e.data.sourceMarkerSpacings=s);break}case`list`:{let n=e.children?.[0];if(n?.position?.start?.offset!=null){let r=n.position.start.offset;if(r>=0&&r<t.length){let n=t[r];if(!e.ordered&&(n===`-`||n===`*`||n===`+`))e.data.bulletMarker=n;else if(e.ordered){let n=t.slice(r,Math.min(r+10,t.length)).match(/^\d+([.)])/);n&&(e.data.listMarkerDelimiter=n[1])}}}break}case`code`:{let n=t[i];if(n==="`"||n===`~`){e.data.sourceStyle=`fenced`,e.data.sourceFenceChar=n;let r=0;for(;i+r<t.length&&t[i+r]===n;)r++;r>=3&&(e.data.sourceFenceLength=r)}else e.data.sourceStyle=`indented`;break}case`inlineCode`:{let n=t[i];if(n==="`"||n===`~`){e.data.sourceFenceChar=n;let r=0;for(;i+r<t.length&&t[i+r]===n;)r++;r>=1&&(e.data.sourceFenceLength=r)}break}case`thematicBreak`:e.data.sourceRaw=t.slice(i,a);break;case`table`:{let n=t.slice(i,a),r=n.indexOf(`
340
340
  `);if(r===-1)break;let o=n.slice(r+1),s=o.indexOf(`
341
341
  `),c=(s===-1?o:o.slice(0,s)).trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),l=[];for(let e of c){let t=e.match(/-/g);l.push(t?t.length:0)}l.length>0&&l.some(e=>e>0)&&(e.data.sourceDashCounts=l);for(let n of e.children??[]){if(n.type!==`tableRow`||!n.position)continue;let e=n.position.start.offset,r=n.position.end.offset;if(typeof e!=`number`||typeof r!=`number`)continue;let i=t.slice(e,r),a=i.indexOf(`
342
- `);a!==-1&&(i=i.slice(0,a));let o=zJ(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(i,a)),e.type===`link`){let n=t[i];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(i,a),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
342
+ `);a!==-1&&(i=i.slice(0,a));let o=VJ(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(i,a)),e.type===`link`){let n=t[i];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(i,a),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
343
343
  `);)t--;n[t]===`"`?e.data.sourceTitleMarker=`double`:n[t]===`'`?e.data.sourceTitleMarker=`single`:n[t]===`)`&&(e.data.sourceTitleMarker=`paren`)}}}}break;case`definition`:{let n=t.slice(i,a);if(e.data.sourceLayout=n.includes(`
344
- `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(i,a);break;case`break`:t.slice(i,a).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function VJ(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const HJ=VJ();function UJ(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function WJ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;HJ.lastIndex=0;let o=[],s=0;for(;;){let n=HJ.exec(e);if(n===null)break;let i=n[1]??``,c=n[2]??``,l=n.index+i.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=l&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===l){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&UJ(t,i))continue}l>s&&o.push({type:`text`,value:e.slice(s,l)});let u={type:`tag`,value:c};o.push(u),s=l+1+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push({type:`text`,value:e.slice(s)}),n.push(...o))}r&&(e.children=n)}const GJ=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function KJ(e,t){let n=e.position?.start?.offset??0,r=e.position?.end?.offset??0,i=r>n?t.slice(n,r):``;return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:i||(e.type??`unknown`),position:e.position}}function qJ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;LJ(e,t);let r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;KA(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!GJ.has(e.type)){let r=KJ(e,n);return i.children[t]=r,UA}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(IJ(t),WJ(t,n))}if(BJ(e,n,r),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function JJ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function YJ(){return e=>{KA(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=JJ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function XJ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const ZJ=(e,t)=>{if(XJ(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},QJ=sB(),$J=Tz(),eY=Ez();function tY(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===QJ)||t.push(QJ);let n=e.fromMarkdownExtensions;n.some(e=>e===$J)||n.push($J);let r=e.toMarkdownExtensions;r.some(e=>e===eY)||r.push(eY)}const nY=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function rY(){return e=>{KA(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`$`)===-1)return;nY.lastIndex=0;let i=[],a;for(;(a=nY.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`inlineMath`,value:e[1]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[UA,t+o.length]})}}const iY={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function aY(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===iY)||e.toMarkdownExtensions.push(iY)}const oY={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},sY={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function cY(){return{text:{91:oY,33:sY}}}function lY(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function uY(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function dY(e){return e.stack[e.stack.length-1]}function fY(e){let t=dY(this);t.data.target=this.sliceSerialize(e).trim()}function pY(e){let t=dY(this),n=this.sliceSerialize(e).trim();t.data.anchor=n.length?n:null}function mY(e){let t=dY(this),n=this.sliceSerialize(e).trim();t.data.alias=n.length?n:null}function hY(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function gY(e){hY(dY(this)),this.exit(e)}function _Y(e){hY(dY(this)),this.exit(e)}const vY={enter:{wikiLink:lY,wikiLinkEmbed:uY},exit:{wikiLinkTarget:fY,wikiLinkAnchor:pY,wikiLinkAlias:mY,wikiLink:gY,wikiLinkEmbed:_Y}},yY={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},bY=cY();function xY(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===bY)||e.micromarkExtensions.push(bY),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===vY)||e.fromMarkdownExtensions.push(vY),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===yY)||e.toMarkdownExtensions.push(yY)}function SY(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const CY=[{name:`remark-parse`,plugin:zR},{name:`remark-frontmatter`,plugin:RL,options:[`yaml`]},{name:`remark-mdx-agnostic`,plugin:tY},{name:`remark-gfm`,plugin:PI},{name:`remark-math`,plugin:eR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:xY},{name:`remark-github-alerts`,plugin:HL,options:eJ},{name:`callout-transformer`,plugin:$q},{name:`restore-from-mdx`,plugin:Aq},{name:`restore-entity-refs`,plugin:Rq},{name:`restore-backslash-escapes`,plugin:Vq},{name:`details-accordion-promoter`,plugin:CJ},{name:`image-promoter`,plugin:EJ},{name:`indented-code-promoter`,plugin:MJ},{name:`math-promoter`,plugin:PJ},{name:`single-dollar-math-promoter`,plugin:rY},{name:`highlight-promoter`,plugin:TJ},{name:`mermaid-promoter`,plugin:YJ},{name:`comment-promoter`,plugin:rJ},{name:`merged-post-parse-walker`,plugin:qJ},{name:`ensure-non-empty-doc`,plugin:()=>SY}];function wY(e){let t=WI();for(let e of CY)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(mL,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function TY(e){let t=WI().use(RL,[`yaml`]).use(PI,{tablePipeAlign:!1}).use(eR,{singleDollarTextMath:!1}).use(tY).use(xY).use(aY).use(FI,{bullet:`-`,fences:!0,rule:`-`,join:[ZJ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function EY(e,t){let n=new _A(Fq(Oq(Bq(e)))),r=t.parse(n);n.value=e;let i=t.runSync(r,n);return t.stringify(i)}function DY(e,t){let n=new _A(Fq(Oq(Bq(e)))),r=t.parse(n);return n.value=e,t.runSync(r,n)}function OY(e,t,n){let r=gL(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});return String(t.stringify(r))}function kY(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function AY(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function jY(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function MY(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!_G(e))return e;let n=jY(AY(t),e);return n===``||n===`..`||n.startsWith(`../`)?(kY()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const NY={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&HG(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=RY(n,t.slice(o,e),r)),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=RY(n,t.slice(o),r)),a}return RY(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:IY(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(FY(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(IY(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
345
- `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(IY(d)),e()}if(e.title){let t=i===`multiline`?`
346
- `:` `;l+=s.move(FY(e.title,a,t))}return o(),l},thematicBreak(e,t,n){let r=e.data?.sourceRaw;return Array.isArray(n?.indexStack)&&n.indexStack.length===1&&n.indexStack[0]===0&&(!r||/^-[-\s]*-\s*$/.test(r))?`***`:r??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
344
+ `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(i,a);break;case`break`:t.slice(i,a).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function UJ(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const WJ=UJ();function GJ(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function KJ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;WJ.lastIndex=0;let o=[],s=0;for(;;){let n=WJ.exec(e);if(n===null)break;let i=n[1]??``,c=n[2]??``,l=n.index+i.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=l&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===l){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&GJ(t,i))continue}l>s&&o.push({type:`text`,value:e.slice(s,l)});let u={type:`tag`,value:c};o.push(u),s=l+1+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push({type:`text`,value:e.slice(s)}),n.push(...o))}r&&(e.children=n)}const qJ=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function JJ(e,t){let n=e.position?.start?.offset??0,r=e.position?.end?.offset??0,i=r>n?t.slice(n,r):``;return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:i||(e.type??`unknown`),position:e.position}}function YJ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;zJ(e,t);let r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;KA(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!qJ.has(e.type)){let r=JJ(e,n);return i.children[t]=r,UA}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(RJ(t),KJ(t,n))}if(HJ(e,n,r),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function XJ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function ZJ(){return e=>{KA(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=XJ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function QJ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const $J=(e,t)=>{if(QJ(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},eY=sB(),tY=Tz(),nY=Ez();function rY(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===eY)||t.push(eY);let n=e.fromMarkdownExtensions;n.some(e=>e===tY)||n.push(tY);let r=e.toMarkdownExtensions;r.some(e=>e===nY)||r.push(nY)}const iY=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function aY(){return e=>{KA(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`$`)===-1)return;iY.lastIndex=0;let i=[],a;for(;(a=iY.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`inlineMath`,value:e[1]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[UA,t+o.length]})}}const oY={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function sY(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===oY)||e.toMarkdownExtensions.push(oY)}const cY={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},lY={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function uY(){return{text:{91:cY,33:lY}}}function dY(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function fY(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function pY(e){return e.stack[e.stack.length-1]}function mY(e){let t=pY(this);t.data.target=this.sliceSerialize(e).trim()}function hY(e){let t=pY(this),n=this.sliceSerialize(e).trim();t.data.anchor=n.length?n:null}function gY(e){let t=pY(this),n=this.sliceSerialize(e).trim();t.data.alias=n.length?n:null}function _Y(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function vY(e){_Y(pY(this)),this.exit(e)}function yY(e){_Y(pY(this)),this.exit(e)}const bY={enter:{wikiLink:dY,wikiLinkEmbed:fY},exit:{wikiLinkTarget:mY,wikiLinkAnchor:hY,wikiLinkAlias:gY,wikiLink:vY,wikiLinkEmbed:yY}},xY={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},SY=uY();function CY(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===SY)||e.micromarkExtensions.push(SY),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===bY)||e.fromMarkdownExtensions.push(bY),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===xY)||e.toMarkdownExtensions.push(xY)}function wY(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const TY=[{name:`remark-parse`,plugin:zR},{name:`remark-frontmatter`,plugin:RL,options:[`yaml`]},{name:`remark-mdx-agnostic`,plugin:rY},{name:`remark-gfm`,plugin:PI},{name:`remark-math`,plugin:eR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:CY},{name:`remark-github-alerts`,plugin:HL,options:nJ},{name:`callout-transformer`,plugin:tJ},{name:`restore-from-mdx`,plugin:Mq},{name:`restore-entity-refs`,plugin:Bq},{name:`restore-backslash-escapes`,plugin:Uq},{name:`details-accordion-promoter`,plugin:TJ},{name:`image-promoter`,plugin:OJ},{name:`indented-code-promoter`,plugin:PJ},{name:`math-promoter`,plugin:IJ},{name:`single-dollar-math-promoter`,plugin:aY},{name:`highlight-promoter`,plugin:DJ},{name:`mermaid-promoter`,plugin:ZJ},{name:`comment-promoter`,plugin:aJ},{name:`merged-post-parse-walker`,plugin:YJ},{name:`ensure-non-empty-doc`,plugin:()=>wY}];function EY(e){let t=WI();for(let e of TY)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(mL,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function DY(e){let t=WI().use(RL,[`yaml`]).use(PI,{tablePipeAlign:!1}).use(eR,{singleDollarTextMath:!1}).use(rY).use(CY).use(sY).use(FI,{bullet:`-`,fences:!0,rule:`-`,join:[$J],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function OY(e,t){let n=new _A(Lq(Aq(Hq(e)))),r=t.parse(n);n.value=e;let i=t.runSync(r,n);return t.stringify(i)}function kY(e,t){let n=new _A(Lq(Aq(Hq(e)))),r=t.parse(n);return n.value=e,t.runSync(r,n)}function AY(e,t,n){let r=gL(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});return String(t.stringify(r))}function jY(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function MY(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function NY(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function PY(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!yG(e))return e;let n=NY(MY(t),e);return n===``||n===`..`||n.startsWith(`../`)?(jY()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const FY={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&WG(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=BY(n,t.slice(o,e),r)),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=BY(n,t.slice(o),r)),a}return BY(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:RY(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(LY(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(RY(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
345
+ `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(RY(d)),e()}if(e.title){let t=i===`multiline`?`
346
+ `:` `;l+=s.move(LY(e.title,a,t))}return o(),l},thematicBreak(e,t,n){let r=e.data?.sourceRaw;return Array.isArray(n?.indexStack)&&n.indexStack.length===1&&n.indexStack[0]===0&&(!r||/^-[-\s]*-\s*$/.test(r))?`***`:r??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
347
347
  `:`
348
348
  `},code(e){let t=e.value??``;if(e.data?.sourceStyle===`indented`)return t.split(`
349
349
  `).map(e=>e.length>0?` ${e}`:e).join(`
@@ -356,5 +356,5 @@ $2`).split(`
356
356
 
357
357
  `:`
358
358
  `;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length),p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}return`|${n.join(`|`)}|`},h=Array.from({length:f},()=>null);if(a.length===0)return m(p,h);let g=[];g.push(m(a[0],o[0]??[])),g.push(m(p,h));for(let e=1;e<a.length;e++)g.push(m(a[e],o[e]??[]));return g.join(`
359
- `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=PY(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=PY(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function PY(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function FY(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function IY(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function LY(e){return e.replace(/(?<!\\)&(?=[A-Za-z][A-Za-z0-9]*;|#[0-9]+;|#[xX][0-9A-Fa-f]+;)/g,`\\&`)}function RY(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return LY(i)}function zY(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var BY=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=ey(e.extensions),this.handlers=XY(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=ZY(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=wY({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=TY({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:NY})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return EY(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?DY(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?iq(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return OY(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const VY=qK();function HY(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function UY(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function WY(e){return e.attrs.sourceDirty||UY(e)}function GY(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function KY(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function qY(e,t){if(e.length===0)return KY({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return KY({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[qY(n.children,t)]}}return KY({type:`inlineCode`,value:JY(e)},t)}function JY(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=JY(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const YY=GW;function XY(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=dL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=dL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=MY(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1})]));let a=r.strike??r.delete;if(a&&(i.delete=fL(a)),r.highlight&&(i.mark=fL(r.highlight)),r.comment&&(i.comment=fL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=dL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=fL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=fL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=dL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=dL(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=dL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=VY.getOrWildcard(o),c=HY(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=MY(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=eK(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&YY.has(l)&&n.jsxComponent&&VY.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&KW.has(l)&&n.jsxComponent&&VY.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&qW.has(l)&&n.jsxComponent&&VY.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&JW.has(l)&&n.jsxComponent&&VY.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:zY(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if($W.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")});let s=t=>{let r=t.value??t.type;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},c=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),e.text(t.value??t.type));return n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``})),i.math||=s,i.inlineMath||=c,n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=c,n.footnoteDefinition&&(i.footnoteDefinition=dL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}})),i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function ZY(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=_L(`paragraph`)),r.blockquote&&(t.blockquote=_L(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=_L(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=_L(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&GY(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c=Array.isArray(s)&&s.length>0?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=_L(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=_L(`tableCell`,a)),r.tableHeader&&(t.tableHeader=_L(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!WY(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:VY.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:VY,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=vL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=vL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return qY(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=vL(`delete`)}return i.highlight&&(n.highlight=vL(`mark`)),i.comment&&(n.comment=vL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=_L(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=_L(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return HG(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const QY=/\p{M}+/gu,$Y=/[^\p{L}\p{N}]+/gu,eX=/^-+|-+$/g;function tX(e){return e.trim().normalize(`NFKD`).replace(QY,``).toLowerCase().replace($Y,`-`).replace(eX,``)}function nX(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function rX(e,t){let n=tX(e);return n?nX(n,t):``}const iX=N({docName:sK,summary:lK,content:A().optional(),...cK}).loose(),aX=N({docName:sK,summary:lK,markdown:A().min(1),position:Us([`append`,`prepend`,`replace`]).optional(),...cK}).loose(),oX=N({docName:sK,summary:lK,find:A().min(1),replace:A(),offset:j().int().nonnegative().optional(),...cK}).loose(),sX=N({docName:sK,connectionId:A().min(1),scope:Us([`last`,`session`,`file`]).optional(),...cK}).loose(),cX=N({value:A(),truncatedFrom:j().int().nonnegative().optional(),hint:A().optional()}).loose(),lX=N({type:Gs(`orphan`),parentCandidates:M(A()),message:A()}).loose(),uX=N({timestamp:A().min(1),summary:cX.optional()}).loose(),dX=N({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),hints:M(lX).optional(),summary:cX.optional()}).loose(),fX=N({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),summary:cX.optional()}).loose(),pX=N({docName:A().min(1),scope:Us([`last`,`session`]),undone:Ss()}).loose(),mX=N({docName:A().min(1),content:A()}).loose(),hX=N({documents:M(N({kind:Us([`document`,`asset`,`folder`]).default(`document`),docName:A().min(1).optional(),docExt:A().min(1).default(`.md`),size:j().int().nonnegative(),modified:A().min(1),isSymlink:Ss().default(!1),canonicalDocName:A().nullable().default(null),targetPath:A().nullable().default(null),path:A().min(1).optional(),assetExt:A().min(1).optional(),mediaKind:Us([`image`,`video`]).nullable().optional(),referencedBy:M(A().min(1)).optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`}))}).loose(),gX=N({source:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),_X=N({docName:A().min(1),backlinks:M(gX)}).loose(),vX=N({counts:Vs(A().min(1),j().int().nonnegative())}).loose(),yX=Ls(`kind`,[N({kind:Gs(`doc`),docName:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),N({kind:Gs(`external`),url:A().min(1),title:A(),snippet:A().nullable()}).loose()]),bX=N({docName:A().min(1),forwardLinks:M(yX)}).loose(),xX=Ls(`kind`,[N({id:A().min(1),kind:Gs(`doc`),docName:A().min(1),anchor:A().nullable(),label:A(),cluster:A().nullable(),category:A().nullable(),tags:M(A()).nullable()}).loose(),N({id:A().min(1),kind:Gs(`external`),url:A().min(1),label:A()}).loose()]),SX=N({source:A().min(1),target:A().min(1)}).loose(),CX=N({nodes:M(xX),links:M(SX)}).loose(),wX=N({id:A().min(1),name:A().optional(),email:A().optional()}).loose(),TX=N({name:A().optional(),email:A().optional()}).loose(),EX=N({message:A().optional(),writers:M(wX).optional(),principal:TX.optional(),...cK}).loose(),DX=N({checkpointRef:A().min(1),versionTag:A().min(1).optional()}).loose(),OX=N({v:j().int().optional(),id:A().min(1),name:A().min(1),colorSeed:A().optional(),docs:M(A()),summaries:M(A()).optional()}).loose(),kX=N({entries:M(N({sha:A().min(1),timestamp:A().min(1),author:A(),authorEmail:A(),type:Us([`checkpoint`,`wip`,`upstream`,`park`]),message:A(),contributors:M(OX),checkpoint:Os().nullable()}).loose()),total:j().int().nonnegative().optional(),truncated:Ss().optional()}).loose(),AX=N({sha:A().regex(/^[0-9a-f]{40}$/i),content:A(),timestamp:A(),author:A()}).loose(),jX=N({lines:M(N({type:Us([`added`,`removed`,`unchanged`]),text:A()}).loose()),additions:j().int().nonnegative(),deletions:j().int().nonnegative()}).loose(),MX=N({contentDir:A().min(1),pathSeparator:Us([`/`,`\\`]),symlinkResolved:Ss()}).loose(),NX=M(Ls(`source`,[N({docName:A().min(1),timestamp:A().min(1),size:j().int().nonnegative(),source:Gs(`flat`)}).loose(),N({docName:A().min(1),timestamp:A().min(1),source:Gs(`timeline`),sha:A().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),PX=N({orphans:M(N({docName:A().min(1),title:A()}).loose())}).loose(),FX=N({hubs:M(N({docName:A().min(1),title:A(),count:j().int().nonnegative()}).loose())}).loose(),IX=N({source:A().min(1),title:A(),snippet:A().nullable()}).loose(),LX=N({deadLinks:M(N({target:A().min(1),sources:M(IX)}).loose())}).loose(),RX=N({target:N({docName:A().min(1),title:A(),aliases:M(A())}).loose(),mentions:M(N({source:A().min(1),excerpt:A(),offset:j().int().nonnegative()}).loose()),truncated:Ss()}).loose(),zX=N({dir:A().min(1)}).loose(),BX=N({port:j().int().positive()}).loose(),VX=N({host:A().min(1).optional()}).loose(),HX=N({pat:A().min(1),host:A().min(1).optional()}).loose(),UX=N({name:A().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:A().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),WX=N({identity:N({name:A().min(1),email:A().min(1)}).loose().nullable()}).loose(),GX=N({authenticated:Ss()}).loose(),KX=N({type:Gs(`complete`).optional(),login:A().min(1).optional()}).loose(),qX=N({}).loose(),JX=N({stackIndex:j().int().min(0),ts:j().int().min(0),additions:j().int().min(0),deletions:j().int().min(0)}).loose(),YX=N({docName:A().min(1),additionsTotal:j().int().min(0),deletionsTotal:j().int().min(0),lastTs:j().int().min(0),bursts:M(JX)}).loose(),XX=N({displayName:A().min(1),color:A().min(1),icon:A().optional(),connectionId:A().min(1)}).loose(),ZX=N({sessionAlive:Ss(),agent:XX.nullable(),files:M(YX)}).loose(),QX=N({diff:A(),generatedAt:j().int().min(0)}).loose(),$X=N({}).loose(),eZ=N({}).loose(),tZ=N({}).loose(),nZ=N({}).loose(),rZ=N({displayName:A().min(1),icon:A(),color:A().min(1),currentDoc:A().nullable(),mode:Us([`idle`,`writing`]),ts:j().int().min(0)}).loose(),iZ=N({presence:Vs(A().min(1),rZ)}).loose(),aZ=Vs(A().min(1),Ss()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:A().min(1,`path must be non-empty`)}).loose();const oZ=N({}).loose(),sZ=N({fromDocName:A().min(1),toDocName:A().min(1)}).loose(),cZ=N({}).loose(),lZ=N({path:A().min(1),...cK,summary:lK}).loose(),uZ=N({docName:A().min(1)}).loose(),dZ=N({path:A().min(1),...cK,summary:lK}).loose(),fZ=N({path:A().min(1)}).loose(),pZ=N({pages:M(N({docName:A().min(1),title:A(),docExt:A().min(1),size:j().int().nonnegative(),modified:A().min(1)}).loose())}).loose(),mZ=N({level:j().int().min(1).max(6),text:A(),slug:A()}).loose(),hZ=N({docName:A().min(1),headings:M(mZ)}).loose();N({docName:A().min(1),newDocName:A().min(1),summary:lK,...cK}).loose();const gZ=N({docName:A().min(1),rewrites:j().int().nonnegative()}).loose();N({renamed:M(sZ),rewrittenDocs:M(gZ),summary:cX.optional()}).loose();const _Z=N({kind:Us([`file`,`folder`]),fromPath:A().min(1),toPath:A().min(1),...cK,summary:lK}).loose(),vZ=N({renamed:M(sZ),rewrittenDocs:M(gZ).optional(),summary:cX.optional()}).loose(),yZ=N({kind:Us([`file`,`folder`]),path:A().min(1),...cK}).loose(),bZ=N({deletedDocNames:M(A().min(1))}).loose(),xZ=N({docName:A().min(1),commitSha:A().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),versionTag:A().optional(),summary:lK,...cK}).loose(),SZ=N({restoredFrom:A().min(1),timestamp:A().min(1),summary:cX.optional()}).loose(),CZ=N({state:Us([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),lastSyncUtc:A().nullable(),lastFetchUtc:A().nullable(),lastPushedSha:A().nullable(),ahead:j().int().min(0),behind:j().int().min(0),consecutiveFailures:j().int().min(0),conflictCount:j().int().min(0),hasRemote:Ss(),syncEnabled:Ss(),identityUnresolved:Ss(),error:A().optional(),pausedReason:A().optional()}).loose(),wZ=N({op:Us([`sync`,`push`,`pull`]).optional()}).loose(),TZ=N({op:Us([`sync`,`push`,`pull`])}).loose(),EZ=N({conflicts:M(N({file:A().min(1),detectedAt:A().min(1),oursSha:A().optional(),theirsSha:A().optional(),baseSha:A().optional()}).loose())}).loose(),DZ=N({file:A().min(1),strategy:Us([`mine`,`theirs`,`content`]),content:A().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content is required when strategy is 'content'`,path:[`content`]}),OZ=N({}).loose(),kZ=N({file:A().min(1),base:A(),ours:A(),theirs:A()}).loose(),AZ=N({}).loose(),jZ=N({plan:pc(e=>e!==void 0,{message:`plan is required`})}).loose(),MZ=N({plan:pc(e=>e!==void 0,{message:`plan is required`})}).loose(),NZ=N({result:pc(e=>e!==void 0,{message:`result is required`})}).loose(),PZ=N({path:A().min(1),summary:A().min(1)}).loose(),FZ=N({packs:M(N({id:A().min(1),name:A().min(1),description:A().min(1),defaultSubfolder:A().optional(),folders:M(PZ)}).loose())}).loose(),IZ=N({noOpen:Ss().optional(),out:A().min(1).optional()}).loose(),LZ=N({reason:Us([`unsupported-platform`,`spawn-error`]),message:A()}).loose(),RZ=Ls(`status`,[N({status:Gs(`installed`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A()}).loose(),N({status:Gs(`built`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A(),handoffError:LZ.optional()}).loose(),N({status:Gs(`failed`),buildError:A()}).loose(),N({status:Gs(`skip-current`),skillVersion:A(),recordedAt:A().optional()}).loose()]),zZ=N({tags:M(N({name:A().min(1),count:j().int().nonnegative(),isLeaf:Ss()}).loose())}).loose(),BZ=N({docName:A().min(1),title:A(),matchingTags:M(A().min(1)),snippet:A().nullable()}).loose(),VZ=N({name:A().min(1),docs:M(BZ)}).loose(),HZ=N({folder:Os(),frontmatter_local:Vs(A(),Os()).nullable()}).loose(),UZ=N({path:A(),frontmatter:Vs(A(),Os()).optional()}).loose(),WZ=N({applied:Os()}).loose(),GZ=Vs(A(),Os()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),KZ=N({template:N({name:A().min(1),folder:A(),scope:Us([`local`,`inherited`]),path:A().min(1),frontmatter:GZ,body:A()}).loose()}).loose(),qZ=N({folder:A(),name:A(),body:A().optional(),frontmatter:GZ.optional()}).loose(),JZ=N({path:A().min(1),created:Ss(),warnings:M(A())}).loose(),YZ=N({existed:Ss(),path:A().min(1)}).loose(),XZ=N({query:A().optional(),intent:Us([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(Us([`page`,`folder`,`content`])).optional(),scope:A().optional(),limit:j().int().nonnegative().optional()}).loose(),ZZ=N({kind:Us([`page`,`folder`,`content`]),path:A().min(1),title:A(),score:j(),signals:Vs(A(),Os()),snippet:A().optional()}).loose(),QZ=N({query:A(),intent:Us([`autocomplete`,`full_text`,`omnibar`]),results:M(ZZ),elapsedMs:j().nonnegative()}).loose(),$Z=N({version:A().min(1),recordedAt:A().min(1)}).loose(),eQ=N({currentVersion:A().min(1),targets:Vs(A(),$Z.nullable())}).loose(),tQ=`server-info`,nQ=`branch-switched`,rQ=`disk-ack`,iQ=`config-validation-rejected`,aQ=`config-ignore-nested-error`,oQ=Us([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),sQ=N({v:Gs(1),ch:Gs(tQ),seq:j(),serverInstanceId:A().min(1),currentBranch:A().min(1).optional()}).loose(),cQ=N({v:Gs(1),ch:Gs(nQ),seq:j(),branch:A().min(1)}).loose(),lQ=N({v:Gs(1),ch:oQ,seq:j()}).loose(),uQ=N({v:Gs(1),ch:Gs(rQ),seq:j(),docName:A().min(1),sv:A().min(1)}).loose(),dQ=N({v:Gs(1),ch:Gs(iQ),seq:j(),docName:A().min(1),error:DW}).loose(),fQ=N({v:Gs(1),ch:Gs(aQ),seq:j(),path:A().min(1),error:A().min(1)}).loose(),pQ={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},mQ=new WeakMap;function hQ(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function gQ(e){return e.trim().toLowerCase()}function _Q(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function vQ(e){return e.split(`/`).filter(Boolean).join(` `)}function yQ(e){let t=_Q(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:vQ(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function bQ(e){let t=XH({schema:pQ});return e.length>0&&sU(t,e),t}function xQ(e){let t={documents:e};return mQ.set(t,bQ(e)),t}function SQ(e){let t=mQ.get(e);if(t)return t;let n=bQ(e.documents);return mQ.set(e,n),n}function CQ(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function wQ(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function TQ(e,t){let n=gQ(t);if(!n)return 0;let r=gQ(e.title),i=gQ(e.name),a=gQ(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function EQ(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function DQ(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function OQ(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function kQ(e,t){return gQ(t).length<4?0:e===`full_text`?1:0}function AQ(e,t,n={}){let r=n.intent??`omnibar`,i=hQ(n.limit),a=new Set(n.scopes??CQ(r)),o=e.documents.filter(e=>wQ(e,a)),s=gQ(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=LU(SQ(e),{term:s,properties:DQ(r),boost:OQ(r),tolerance:kQ(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>wQ(e.document,a)).map(e=>[e.document.id,e.score])),u=EQ(o),d=new Map;for(let e of o)TQ(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)wQ(e.document,a)&&d.set(e.document.id,e.document);return[...d.values()].map(e=>{let t=Math.max(0,TQ(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}const jQ=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),MQ=globalThis;MQ[jQ]===void 0&&(MQ[jQ]=bi());const NQ=MQ[jQ],PQ=[`.ok`,`skill-state.yml`],FQ=[`claude-cowork`,`cli-hosts`],IQ=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`],LQ=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,RQ=Ns({version:A().regex(LQ,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(NQ,{description:`Recorded skill version for this target.`}),recordedAt:Eo().register(NQ,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:Us(IQ).register(NQ,{description:`Install-source surface that recorded this entry.`}).optional()}),zQ=Ns({schema:Gs(1).register(NQ,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Ns({"claude-cowork":RQ.optional(),"cli-hosts":RQ.optional()}).register(NQ,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function BQ(){return{schema:1,targets:{}}}function VQ(){let e=!1,t=``,n=0;return r=>{let i=HQ(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function HQ(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const UQ=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],WQ={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function GQ(e,t=UQ){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const KQ={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,copilot:`github`,cline:`cline`};function qQ(e){return e?KQ[e]??`bot`:`bot`}function JQ(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`/`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of l.split(`/`))if(e===`..`){if(u.length===0)return null;u.pop()}else e!==`.`&&e!==``&&u.push(e);return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}const YQ=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function XQ(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function ZQ(e){let t=e.trim();return YQ.test(t)||t.startsWith(`//`)}function QQ(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}let r=JQ(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};if(ZQ(n)||n.startsWith(`/`))return{kind:`external`,url:n};let i=XQ(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function $Q(e,t){let n=e.trim();if(!n)return null;if(ZQ(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=XQ(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function e$(e,t){let n=e.trim();if(!n||YQ.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function t$(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function n$(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function r$(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function i$(e){return e.split(`/`).filter(e=>e!==``)}function a$(e,t){let n=r$(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function o$(e,t){let n=r$(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:i$(r).length}function s$(e,t){let n=i$(e),r=i$(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function c$(){let e=new Map;function t(t){let n=t$(t);if(n===``)return;let r=n$(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=t$(t),r=n$(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=r$(t$(n)),o=[],s=[];for(let e of i)a$(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=o$(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=o$(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=s$(a,r$(t));for(let r=1;r<e.length;r++){let i=e[r],o=s$(a,r$(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function l$(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function u$(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}export{kX as $,ey as $n,DZ as $t,FW as A,oK as An,Fs as Ar,xZ as At,BW as B,uW as Bn,Kt as Br,MZ as Bt,nQ as C,VJ as Cn,Ns as Cr,hZ as Ct,tQ as D,yW as Dn,gc as Dr,_Z as Dt,rQ as E,bW as En,Ys as Er,hK as Et,fZ as F,kW as Fn,Xi as Fr,AW as Ft,hX as G,JQ as Gn,ft as Gr,eQ as Gt,yZ as H,$U as Hn,Xt as Hr,FZ as Ht,lZ as I,qQ as In,Oa as Ir,EX as It,cZ as J,QU as Jn,et as Jr,yK as Jt,mX as K,AQ as Kn,k as Kr,zQ as Kt,uZ as L,OW as Ln,ka as Lr,DX as Lt,PW as M,rX as Mn,ts as Mr,PQ as Mt,NW as N,QK as Nn,Eo as Nr,FQ as Nt,jW as O,BQ as On,Vs as Or,vZ as Ot,dZ as P,QG as Pn,wo as Pr,LQ as Pt,bX as Q,eW as Qn,EZ as Qt,QW as R,zW as Rn,Wr as Rr,XZ as Rt,sQ as S,VQ as Sn,Gs as Sr,PX as St,iQ as T,yQ as Tn,N as Tr,fK as Tt,bZ as U,aW as Un,Qt as Ur,jZ as Ut,LX as V,vW as Vn,Jt as Vr,NZ as Vt,jX as W,e$ as Wn,wt as Wr,dK as Wt,UZ as X,sW as Xn,AZ as Xt,HZ as Y,u$ as Yn,$e as Yr,RX as Yt,WZ as Z,tX as Zn,kZ as Zt,cQ as _,mK as _n,M as _r,BY as _t,oX as a,zZ as an,Oc as ar,aZ as at,lQ as b,GQ as bn,Ls as br,tZ as bt,pX as c,qZ as cn,Ic as cr,VX as ct,iX as d,$X as dn,Dc as dr,KX as dt,OZ as en,Ud as er,AX as et,uX as f,_K as fn,vs as fr,UX as ft,pW as g,GU as gn,Es as gr,BX as gt,cW as h,KU as hn,ws as hr,zX as ht,QX as i,VZ as in,Hc as ir,RZ as it,MW as j,oW as jn,Os as jr,SZ as jt,IW as k,l$ as kn,A as kr,NX as kt,aX as l,JZ as ln,Nc as lr,WX as lt,_X as m,MX as mn,Us as mr,vK as mt,XW as n,wZ as nn,Lc as nr,ZW as nt,fX as o,YZ as on,Fc as or,CX as ot,vX as p,gK as pn,Js as pr,GX as pt,YW as q,nK as qn,O as qr,oZ as qt,ZX as r,TZ as rn,wc as rr,IZ as rt,sX as s,KZ as sn,Vc as sr,qX as st,WQ as t,CZ as tn,P as tr,FX as tt,dX as u,eZ as un,Ec as ur,HX as ut,fQ as v,QQ as vn,Ss as vr,iZ as vt,aQ as w,xQ as wn,j as wr,pZ as wt,uQ as x,c$ as xn,zs as xr,RW as xt,dQ as y,$Q as yn,pc as yr,nZ as yt,LW as z,aG as zn,rr as zr,QZ as zt};
360
- //# sourceMappingURL=dist-BY6hbGlq.mjs.map
359
+ `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=IY(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=IY(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function IY(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function LY(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function RY(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function zY(e){return e.replace(/(?<!\\)&(?=[A-Za-z][A-Za-z0-9]*;|#[0-9]+;|#[xX][0-9A-Fa-f]+;)/g,`\\&`)}function BY(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return zY(i)}function VY(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var HY=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=ey(e.extensions),this.handlers=QY(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=$Y(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=EY({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=DY({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:FY})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return OY(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?kY(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?oq(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return AY(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const UY=YK();function WY(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function GY(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function KY(e){return e.attrs.sourceDirty||GY(e)}function qY(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function JY(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function YY(e,t){if(e.length===0)return JY({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return JY({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[YY(n.children,t)]}}return JY({type:`inlineCode`,value:XY(e)},t)}function XY(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=XY(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const ZY=qW;function QY(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=dL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=dL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=PY(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1})]));let a=r.strike??r.delete;if(a&&(i.delete=fL(a)),r.highlight&&(i.mark=fL(r.highlight)),r.comment&&(i.comment=fL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=dL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=fL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=fL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=dL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=dL(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=dL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=UY.getOrWildcard(o),c=WY(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=PY(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=nK(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&ZY.has(l)&&n.jsxComponent&&UY.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&JW.has(l)&&n.jsxComponent&&UY.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&YW.has(l)&&n.jsxComponent&&UY.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&XW.has(l)&&n.jsxComponent&&UY.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:VY(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(tG.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")});let s=t=>{let r=t.value??t.type;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},c=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),e.text(t.value??t.type));return n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``})),i.math||=s,i.inlineMath||=c,n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=c,n.footnoteDefinition&&(i.footnoteDefinition=dL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}})),i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function $Y(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=_L(`paragraph`)),r.blockquote&&(t.blockquote=_L(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=_L(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=_L(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&qY(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c=Array.isArray(s)&&s.length>0?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=_L(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=_L(`tableCell`,a)),r.tableHeader&&(t.tableHeader=_L(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!KY(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:UY.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:UY,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=vL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=vL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return YY(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=vL(`delete`)}return i.highlight&&(n.highlight=vL(`mark`)),i.comment&&(n.comment=vL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=_L(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=_L(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return WG(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const eX=/\p{M}+/gu,tX=/[^\p{L}\p{N}]+/gu,nX=/^-+|-+$/g;function rX(e){return e.trim().normalize(`NFKD`).replace(eX,``).toLowerCase().replace(tX,`-`).replace(nX,``)}function iX(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function aX(e,t){let n=rX(e);return n?iX(n,t):``}const oX=N({docName:lK,summary:dK,content:A().optional(),...uK}).loose(),sX=N({docName:lK,summary:dK,markdown:A().min(1),position:Us([`append`,`prepend`,`replace`]).optional(),...uK}).loose(),cX=N({docName:lK,summary:dK,find:A().min(1),replace:A(),offset:j().int().nonnegative().optional(),...uK}).loose(),lX=N({docName:lK,connectionId:A().min(1),scope:Us([`last`,`session`,`file`]).optional(),...uK}).loose(),uX=N({value:A(),truncatedFrom:j().int().nonnegative().optional(),hint:A().optional()}).loose(),dX=N({type:Gs(`orphan`),parentCandidates:M(A()),message:A()}).loose(),fX=N({timestamp:A().min(1),summary:uX.optional()}).loose(),pX=N({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),hints:M(dX).optional(),summary:uX.optional()}).loose(),mX=N({timestamp:A().min(1),subscriberCount:j().int().nonnegative(),systemSubscriberCount:j().int().nonnegative(),summary:uX.optional()}).loose(),hX=N({docName:A().min(1),scope:Us([`last`,`session`]),undone:Ss()}).loose(),gX=N({docName:A().min(1),content:A()}).loose(),_X=N({documents:M(N({kind:Us([`document`,`asset`,`folder`]).default(`document`),docName:A().min(1).optional(),docExt:A().min(1).default(`.md`),size:j().int().nonnegative(),modified:A().min(1),isSymlink:Ss().default(!1),canonicalDocName:A().nullable().default(null),targetPath:A().nullable().default(null),path:A().min(1).optional(),assetExt:A().min(1).optional(),mediaKind:Us([`image`,`video`]).nullable().optional(),referencedBy:M(A().min(1)).optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`}))}).loose(),vX=N({source:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),yX=N({docName:A().min(1),backlinks:M(vX)}).loose(),bX=N({counts:Vs(A().min(1),j().int().nonnegative())}).loose(),xX=Ls(`kind`,[N({kind:Gs(`doc`),docName:A().min(1),anchor:A().nullable(),title:A(),snippet:A().nullable()}).loose(),N({kind:Gs(`external`),url:A().min(1),title:A(),snippet:A().nullable()}).loose()]),SX=N({docName:A().min(1),forwardLinks:M(xX)}).loose(),CX=Ls(`kind`,[N({id:A().min(1),kind:Gs(`doc`),docName:A().min(1),anchor:A().nullable(),label:A(),cluster:A().nullable(),category:A().nullable(),tags:M(A()).nullable()}).loose(),N({id:A().min(1),kind:Gs(`external`),url:A().min(1),label:A()}).loose()]),wX=N({source:A().min(1),target:A().min(1)}).loose(),TX=N({nodes:M(CX),links:M(wX)}).loose(),EX=N({id:A().min(1),name:A().optional(),email:A().optional()}).loose(),DX=N({name:A().optional(),email:A().optional()}).loose(),OX=N({message:A().optional(),writers:M(EX).optional(),principal:DX.optional(),...uK}).loose(),kX=N({checkpointRef:A().min(1),versionTag:A().min(1).optional()}).loose(),AX=N({v:j().int().optional(),id:A().min(1),name:A().min(1),colorSeed:A().optional(),docs:M(A()),summaries:M(A()).optional()}).loose(),jX=N({entries:M(N({sha:A().min(1),timestamp:A().min(1),author:A(),authorEmail:A(),type:Us([`checkpoint`,`wip`,`upstream`,`park`]),message:A(),contributors:M(AX),checkpoint:Os().nullable()}).loose()),total:j().int().nonnegative().optional(),truncated:Ss().optional()}).loose(),MX=N({sha:A().regex(/^[0-9a-f]{40}$/i),content:A(),timestamp:A(),author:A()}).loose(),NX=N({lines:M(N({type:Us([`added`,`removed`,`unchanged`]),text:A()}).loose()),additions:j().int().nonnegative(),deletions:j().int().nonnegative()}).loose(),PX=N({contentDir:A().min(1),pathSeparator:Us([`/`,`\\`]),symlinkResolved:Ss()}).loose(),FX=M(Ls(`source`,[N({docName:A().min(1),timestamp:A().min(1),size:j().int().nonnegative(),source:Gs(`flat`)}).loose(),N({docName:A().min(1),timestamp:A().min(1),source:Gs(`timeline`),sha:A().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),IX=N({orphans:M(N({docName:A().min(1),title:A()}).loose())}).loose(),LX=N({hubs:M(N({docName:A().min(1),title:A(),count:j().int().nonnegative()}).loose())}).loose(),RX=N({source:A().min(1),title:A(),snippet:A().nullable()}).loose(),zX=N({deadLinks:M(N({target:A().min(1),sources:M(RX)}).loose())}).loose(),BX=N({target:N({docName:A().min(1),title:A(),aliases:M(A())}).loose(),mentions:M(N({source:A().min(1),excerpt:A(),offset:j().int().nonnegative()}).loose()),truncated:Ss()}).loose(),VX=N({dir:A().min(1)}).loose(),HX=N({port:j().int().positive()}).loose(),UX=N({host:A().min(1).optional()}).loose(),WX=N({pat:A().min(1),host:A().min(1).optional()}).loose(),GX=N({name:A().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:A().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),KX=N({identity:N({name:A().min(1),email:A().min(1)}).loose().nullable()}).loose(),qX=N({authenticated:Ss()}).loose(),JX=N({type:Gs(`complete`).optional(),login:A().min(1).optional()}).loose(),YX=N({}).loose(),XX=N({stackIndex:j().int().min(0),ts:j().int().min(0),additions:j().int().min(0),deletions:j().int().min(0)}).loose(),ZX=N({docName:A().min(1),additionsTotal:j().int().min(0),deletionsTotal:j().int().min(0),lastTs:j().int().min(0),bursts:M(XX)}).loose(),QX=N({displayName:A().min(1),color:A().min(1),icon:A().optional(),connectionId:A().min(1)}).loose(),$X=N({sessionAlive:Ss(),agent:QX.nullable(),files:M(ZX)}).loose(),eZ=N({diff:A(),generatedAt:j().int().min(0)}).loose(),tZ=N({}).loose(),nZ=N({}).loose(),rZ=N({}).loose(),iZ=N({}).loose(),aZ=N({displayName:A().min(1),icon:A(),color:A().min(1),currentDoc:A().nullable(),mode:Us([`idle`,`writing`]),ts:j().int().min(0)}).loose(),oZ=N({presence:Vs(A().min(1),aZ)}).loose(),sZ=Vs(A().min(1),Ss()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:A().min(1,`path must be non-empty`)}).loose();const cZ=N({}).loose(),lZ=N({fromDocName:A().min(1),toDocName:A().min(1)}).loose(),uZ=N({}).loose(),dZ=N({path:A().min(1),...uK,summary:dK}).loose(),fZ=N({docName:A().min(1)}).loose(),pZ=N({path:A().min(1),...uK,summary:dK}).loose(),mZ=N({path:A().min(1)}).loose(),hZ=N({pages:M(N({docName:A().min(1),title:A(),docExt:A().min(1),size:j().int().nonnegative(),modified:A().min(1)}).loose())}).loose(),gZ=N({level:j().int().min(1).max(6),text:A(),slug:A()}).loose(),_Z=N({docName:A().min(1),headings:M(gZ)}).loose();N({docName:A().min(1),newDocName:A().min(1),summary:dK,...uK}).loose();const vZ=N({docName:A().min(1),rewrites:j().int().nonnegative()}).loose();N({renamed:M(lZ),rewrittenDocs:M(vZ),summary:uX.optional()}).loose();const yZ=N({kind:Us([`file`,`folder`]),fromPath:A().min(1),toPath:A().min(1),...uK,summary:dK}).loose(),bZ=N({renamed:M(lZ),rewrittenDocs:M(vZ).optional(),summary:uX.optional()}).loose(),xZ=N({kind:Us([`file`,`folder`]),path:A().min(1),...uK}).loose(),SZ=N({deletedDocNames:M(A().min(1))}).loose(),CZ=N({docName:A().min(1),commitSha:A().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),versionTag:A().optional(),summary:dK,...uK}).loose(),wZ=N({restoredFrom:A().min(1),timestamp:A().min(1),summary:uX.optional()}).loose(),TZ=N({state:Us([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),lastSyncUtc:A().nullable(),lastFetchUtc:A().nullable(),lastPushedSha:A().nullable(),ahead:j().int().min(0),behind:j().int().min(0),consecutiveFailures:j().int().min(0),conflictCount:j().int().min(0),hasRemote:Ss(),syncEnabled:Ss(),identityUnresolved:Ss(),error:A().optional(),pausedReason:A().optional()}).loose(),EZ=N({op:Us([`sync`,`push`,`pull`]).optional()}).loose(),DZ=N({op:Us([`sync`,`push`,`pull`])}).loose(),OZ=N({conflicts:M(N({file:A().min(1),detectedAt:A().min(1),oursSha:A().optional(),theirsSha:A().optional(),baseSha:A().optional()}).loose())}).loose(),kZ=N({file:A().min(1),strategy:Us([`mine`,`theirs`,`content`]),content:A().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content is required when strategy is 'content'`,path:[`content`]}),AZ=N({}).loose(),jZ=N({file:A().min(1),base:A(),ours:A(),theirs:A()}).loose(),MZ=N({}).loose(),NZ=N({plan:pc(e=>e!==void 0,{message:`plan is required`})}).loose(),PZ=N({plan:pc(e=>e!==void 0,{message:`plan is required`})}).loose(),FZ=N({result:pc(e=>e!==void 0,{message:`result is required`})}).loose(),IZ=N({path:A().min(1),summary:A().min(1)}).loose(),LZ=N({packs:M(N({id:A().min(1),name:A().min(1),description:A().min(1),defaultSubfolder:A().optional(),folders:M(IZ)}).loose())}).loose(),RZ=N({noOpen:Ss().optional(),out:A().min(1).optional()}).loose(),zZ=N({reason:Us([`unsupported-platform`,`spawn-error`]),message:A()}).loose(),BZ=Ls(`status`,[N({status:Gs(`installed`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A()}).loose(),N({status:Gs(`built`),outputPath:A(),size:j().int().nonnegative(),sha256:A(),skillVersion:A(),handoffError:zZ.optional()}).loose(),N({status:Gs(`failed`),buildError:A()}).loose(),N({status:Gs(`skip-current`),skillVersion:A(),recordedAt:A().optional()}).loose()]),VZ=N({tags:M(N({name:A().min(1),count:j().int().nonnegative(),isLeaf:Ss()}).loose())}).loose(),HZ=N({docName:A().min(1),title:A(),matchingTags:M(A().min(1)),snippet:A().nullable()}).loose(),UZ=N({name:A().min(1),docs:M(HZ)}).loose(),WZ=N({folder:Os(),frontmatter_local:Vs(A(),Os()).nullable()}).loose(),GZ=N({path:A(),frontmatter:Vs(A(),Os()).optional()}).loose(),KZ=N({applied:Os()}).loose(),qZ=Vs(A(),Os()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),JZ=N({template:N({name:A().min(1),folder:A(),scope:Us([`local`,`inherited`]),path:A().min(1),frontmatter:qZ,body:A()}).loose()}).loose(),YZ=N({folder:A(),name:A(),body:A().optional(),frontmatter:qZ.optional()}).loose(),XZ=N({path:A().min(1),created:Ss(),warnings:M(A())}).loose(),ZZ=N({existed:Ss(),path:A().min(1)}).loose(),QZ=N({query:A().optional(),intent:Us([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(Us([`page`,`folder`,`content`])).optional(),scope:A().optional(),limit:j().int().nonnegative().optional()}).loose(),$Z=N({kind:Us([`page`,`folder`,`content`]),path:A().min(1),title:A(),score:j(),signals:Vs(A(),Os()),snippet:A().optional()}).loose(),eQ=N({query:A(),intent:Us([`autocomplete`,`full_text`,`omnibar`]),results:M($Z),elapsedMs:j().nonnegative()}).loose(),tQ=N({version:A().min(1),recordedAt:A().min(1)}).loose(),nQ=N({currentVersion:A().min(1),targets:Vs(A(),tQ.nullable())}).loose(),rQ=`server-info`,iQ=`branch-switched`,aQ=`disk-ack`,oQ=`config-validation-rejected`,sQ=`config-ignore-nested-error`,cQ=Us([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),lQ=N({v:Gs(1),ch:Gs(rQ),seq:j(),serverInstanceId:A().min(1),currentBranch:A().min(1).optional()}).loose(),uQ=N({v:Gs(1),ch:Gs(iQ),seq:j(),branch:A().min(1)}).loose(),dQ=N({v:Gs(1),ch:cQ,seq:j()}).loose(),fQ=N({v:Gs(1),ch:Gs(aQ),seq:j(),docName:A().min(1),sv:A().min(1)}).loose(),pQ=N({v:Gs(1),ch:Gs(oQ),seq:j(),docName:A().min(1),error:DW}).loose(),mQ=N({v:Gs(1),ch:Gs(sQ),seq:j(),path:A().min(1),error:A().min(1)}).loose(),hQ={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},gQ=new WeakMap;function _Q(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function vQ(e){return e.trim().toLowerCase()}function yQ(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function bQ(e){return e.split(`/`).filter(Boolean).join(` `)}function xQ(e){let t=yQ(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:bQ(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function SQ(e){let t=XH({schema:hQ});return e.length>0&&sU(t,e),t}function CQ(e){let t={documents:e};return gQ.set(t,SQ(e)),t}function wQ(e){let t=gQ.get(e);if(t)return t;let n=SQ(e.documents);return gQ.set(e,n),n}function TQ(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function EQ(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function DQ(e,t){let n=vQ(t);if(!n)return 0;let r=vQ(e.title),i=vQ(e.name),a=vQ(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function OQ(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function kQ(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function AQ(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function jQ(e,t){return vQ(t).length<4?0:e===`full_text`?1:0}function MQ(e,t,n={}){let r=n.intent??`omnibar`,i=_Q(n.limit),a=new Set(n.scopes??TQ(r)),o=e.documents.filter(e=>EQ(e,a)),s=vQ(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=LU(wQ(e),{term:s,properties:kQ(r),boost:AQ(r),tolerance:jQ(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>EQ(e.document,a)).map(e=>[e.document.id,e.score])),u=OQ(o),d=new Map;for(let e of o)DQ(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)EQ(e.document,a)&&d.set(e.document.id,e.document);return[...d.values()].map(e=>{let t=Math.max(0,DQ(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}const NQ=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),PQ=globalThis;PQ[NQ]===void 0&&(PQ[NQ]=bi());const FQ=PQ[NQ],IQ=[`.ok`,`skill-state.yml`],LQ=[`claude-cowork`,`cli-hosts`],RQ=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`],zQ=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,BQ=Ns({version:A().regex(zQ,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(FQ,{description:`Recorded skill version for this target.`}),recordedAt:Eo().register(FQ,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:Us(RQ).register(FQ,{description:`Install-source surface that recorded this entry.`}).optional()}),VQ=Ns({schema:Gs(1).register(FQ,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Ns({"claude-cowork":BQ.optional(),"cli-hosts":BQ.optional()}).register(FQ,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function HQ(){return{schema:1,targets:{}}}function UQ(){let e=!1,t=``,n=0;return r=>{let i=WQ(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function WQ(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const GQ=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],KQ={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function qQ(e,t=GQ){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const JQ={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,copilot:`github`,cline:`cline`};function YQ(e){return e?JQ[e]??`bot`:`bot`}function XQ(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`/`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of l.split(`/`))if(e===`..`){if(u.length===0)return null;u.pop()}else e!==`.`&&e!==``&&u.push(e);return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}const ZQ=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function QQ(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function $Q(e){let t=e.trim();return ZQ.test(t)||t.startsWith(`//`)}function e$(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}let r=XQ(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};if($Q(n)||n.startsWith(`/`))return{kind:`external`,url:n};let i=QQ(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function t$(e,t){let n=e.trim();if(!n)return null;if($Q(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=QQ(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function n$(e,t){let n=e.trim();if(!n||ZQ.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function r$(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function i$(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function a$(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function o$(e){return e.split(`/`).filter(e=>e!==``)}function s$(e,t){let n=a$(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function c$(e,t){let n=a$(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:o$(r).length}function l$(e,t){let n=o$(e),r=o$(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function u$(){let e=new Map;function t(t){let n=r$(t);if(n===``)return;let r=i$(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=r$(t),r=i$(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=a$(r$(n)),o=[],s=[];for(let e of i)s$(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=c$(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=c$(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=l$(a,a$(t));for(let r=1;r<e.length;r++){let i=e[r],o=l$(a,a$(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function d$(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function f$(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}export{KZ as $,rX as $n,jZ as $t,IW as A,HQ as An,Vs as Ar,bZ as At,zW as B,VW as Bn,Wr as Br,QZ as Bt,lQ as C,u$ as Cn,zs as Cr,BW as Ct,aQ as D,xQ as Dn,N as Dr,mK as Dt,oQ as E,CQ as En,j as Er,hZ as Et,pZ as F,eq as Fn,Eo as Fr,LQ as Ft,NX as G,aW as Gn,Qt as Gr,NZ as Gt,zX as H,uW as Hn,Kt as Hr,PZ as Ht,mZ as I,eK as In,wo as Ir,zQ as It,RW as J,MQ as Jn,k as Jr,VQ as Jt,_X as K,n$ as Kn,wt as Kr,pK as Kt,dZ as L,kW as Ln,Xi as Lr,AW as Lt,MW as M,cK as Mn,Fs as Mr,CZ as Mt,PW as N,oW as Nn,Os as Nr,wZ as Nt,rQ as O,bW as On,Ys as Or,_K as Ot,NW as P,aX as Pn,ts as Pr,IQ as Pt,GZ as Q,sW as Qn,MZ as Qt,fZ as R,YQ as Rn,Oa as Rr,OX as Rt,fQ as S,qQ as Sn,Ls as Sr,rZ as St,sQ as T,UJ as Tn,Ns as Tr,_Z as Tt,xZ as U,vW as Un,Jt as Ur,FZ as Ut,HW as V,sG as Vn,rr as Vr,eQ as Vt,SZ as W,$U as Wn,Xt as Wr,LZ as Wt,uZ as X,QU as Xn,et as Xr,xK as Xt,ZW as Y,iK as Yn,O as Yr,cZ as Yt,WZ as Z,f$ as Zn,$e as Zr,BX as Zt,pW as _,KU as _n,ws as _r,VX as _t,eZ as a,DZ as an,wc as ar,RZ as at,pQ as b,e$ as bn,Ss as br,oZ as bt,lX as c,ZZ as cn,Fc as cr,TX as ct,pX as d,XZ as dn,Nc as dr,KX as dt,OZ as en,eW as er,SX as et,oX as f,nZ as fn,Ec as fr,WX as ft,cW as g,PX as gn,Us as gr,bK as gt,yX as h,vK as hn,Js as hr,qX as ht,$X as i,EZ as in,Lc as ir,$W as it,FW as j,d$ as jn,A as jr,FX as jt,jW as k,yW as kn,gc as kr,yZ as kt,hX as l,JZ as ln,Vc as lr,YX as lt,bX as m,yK as mn,vs as mr,GX as mt,LW as n,AZ as nn,Ud as nr,MX as nt,cX as o,UZ as on,Hc as or,BZ as ot,fX as p,tZ as pn,Dc as pr,JX as pt,gX as q,XQ as qn,ft as qr,nQ as qt,QW as r,TZ as rn,P as rr,LX as rt,mX as s,VZ as sn,Oc as sr,sZ as st,KQ as t,kZ as tn,ey as tr,jX as tt,sX as u,YZ as un,Ic as ur,UX as ut,uQ as v,GU as vn,Es as vr,HX as vt,iQ as w,UQ as wn,Gs as wr,IX as wt,dQ as x,t$ as xn,pc as xr,iZ as xt,mQ as y,gK as yn,M as yr,HY as yt,eG as z,OW as zn,ka as zr,kX as zt};
360
+ //# sourceMappingURL=dist-H3Ld-L-a.mjs.map