@inkeep/open-knowledge 0.0.0-dev-20260428211426 → 0.0.0-dev-20260429030631

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 (36) hide show
  1. package/dist/cli.mjs +235 -232
  2. package/dist/constants-B-gLpuaA.mjs +2 -0
  3. package/dist/{dist-Ct-gJ7iD.mjs → dist-B7U9dfgx.mjs} +1 -1
  4. package/dist/{dist-0qFIeeXA.mjs → dist-D6sXBEzw.mjs} +11 -11
  5. package/dist/index.mjs +1 -1
  6. package/dist/{init-CMkePWjl.mjs → init-BBiPSV-w.mjs} +22 -7
  7. package/dist/init-BEo-n_Uy.mjs +1 -0
  8. package/dist/{init-D0YdyLe_.mjs → init-DktmtY_7.mjs} +4 -4
  9. package/dist/init-yNwtj9hS.mjs +1 -0
  10. package/dist/loader-CX_sYqFb.mjs +1 -0
  11. package/dist/{loader-BJU3jneI.mjs → loader-E7RjFMCP.mjs} +2 -2
  12. package/dist/paths-CIFllhl9.mjs +1 -0
  13. package/dist/{paths-CNpYe27Q.mjs → paths-t5fX6xpy.mjs} +2 -2
  14. package/dist/preview-B3wdzX-m.mjs +1 -0
  15. package/dist/{preview-CXP9kBv6.mjs → preview-CfwdEokP.mjs} +2 -2
  16. package/dist/public/assets/{ActivityModeContent-Ccu_n0bV.js → ActivityModeContent-DB-Anrff.js} +1 -1
  17. package/dist/public/assets/{DocumentContext-C1msvcHp.js → DocumentContext-BQEvrOdm.js} +1 -1
  18. package/dist/public/assets/McpConsentDialogBody-KLtPoa1G.js +1 -0
  19. package/dist/public/assets/{SourceEditor-OFesfBB2.js → SourceEditor-pg77Ty2h.js} +1 -1
  20. package/dist/public/assets/{clipboard-DAcKCHl1.js → clipboard-DO2TbwyY.js} +1 -1
  21. package/dist/public/assets/{index-CwFTGDhe.js → index-Did2wKqz.js} +63 -63
  22. package/dist/public/index.html +3 -3
  23. package/dist/src-C0IVz8Sw.mjs +1 -0
  24. package/dist/start-B8Duv9Ct.mjs +2 -0
  25. package/dist/start-BDCAyg0c.mjs +1 -0
  26. package/package.json +1 -1
  27. package/dist/constants-DCJlLBSi.mjs +0 -2
  28. package/dist/init-D-5Gc0uq.mjs +0 -1
  29. package/dist/init-DUA_XKK1.mjs +0 -1
  30. package/dist/loader-1GTY76cQ.mjs +0 -1
  31. package/dist/paths-fx16Ahvg.mjs +0 -1
  32. package/dist/preview-CHvLSbhb.mjs +0 -1
  33. package/dist/public/assets/McpConsentDialogBody-Csjet19t.js +0 -1
  34. package/dist/src-BIqAAP5m.mjs +0 -1
  35. package/dist/start-BOjBm-nL.mjs +0 -2
  36. package/dist/start-CZFHRjtT.mjs +0 -1
@@ -0,0 +1 @@
1
+ import{i as e,n as t,r as n,t as r}from"./index-Did2wKqz.js";export{r as McpConsentDialogBody,r as default,t as computeInitialSelection,n as selectedIdsOrdered,e as toggleSelectedId};
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-DlS42TIP.js","./dist-CgLbXgrr.js","./chunk-DECur_0Z.js","./w3c-keyname-CSlwavrd.js","./dist-GlH2KPqY.js","./dist-DeDgmJv2.js","./dist-DR1MrLJC.js","./dist-D2wwoXzm.js","./dist-BqO6NfD-.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./chunk-DECur_0Z.js";import{d as t}from"./propagation-api-Bugyj7xy.js";import{n,r,t as i}from"./compiler-runtime-Y11fyRVL.js";import{l as a}from"./panel-BCRdtBla.js";import{$ as o,D as s,E as c,G as l,H as u,I as d,J as f,K as p,O as m,P as h,Q as g,W as _,X as v,Y as y,Z as b,_ as x,d as S,et as C,g as w,h as T,k as E,q as D,v as ee}from"./DocumentContext-C1msvcHp.js";import{G as te,Q as O,S as ne,V as re,q as ie}from"./PageListContext-B5SWnlyE.js";import{_ as ae,a as oe,c as se,d as ce,f as le,g as ue,h as de,l as fe,m as pe,p as me,s as he,t as ge,u as _e,v as ve}from"./clipboard-DAcKCHl1.js";import{At as ye,Dt as k,Et as be,N as A,Nt as j,Pt as M,Q as xe,Tt as N,Y as P,Z as F,a as I,bt as L,ft as R,jt as z,lt as Se,q as B,wt as V}from"./dist-CgLbXgrr.js";var H=e(n(),1),Ce=i(),we=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:y(this.yanchor),yhead:y(this.yhead)}}static fromJSON(t){return new e(D(t.yanchor),D(t.yhead))}},Te=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new _(e)}toYPos(e,t=0){return f(this.ytext,e,t)}fromYPos(e){let t=p(D(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new we(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?N.cursor(n.pos,n.assoc):N.range(t.pos,n.pos)}},U=k.define({combine(e){return e[e.length-1]}}),W=L.define(),Ee=class{constructor(e){this.view=e,this.conf=e.state.facet(U),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[W.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(W)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
2
+ import{r as e}from"./chunk-DECur_0Z.js";import{d as t}from"./propagation-api-Bugyj7xy.js";import{n,r,t as i}from"./compiler-runtime-Y11fyRVL.js";import{l as a}from"./panel-BCRdtBla.js";import{$ as o,D as s,E as c,G as l,H as u,I as d,J as f,K as p,O as m,P as h,Q as g,W as _,X as v,Y as y,Z as b,_ as x,d as S,et as C,g as w,h as T,k as E,q as D,v as ee}from"./DocumentContext-BQEvrOdm.js";import{G as te,Q as O,S as ne,V as re,q as ie}from"./PageListContext-B5SWnlyE.js";import{_ as ae,a as oe,c as se,d as ce,f as le,g as ue,h as de,l as fe,m as pe,p as me,s as he,t as ge,u as _e,v as ve}from"./clipboard-DO2TbwyY.js";import{At as ye,Dt as k,Et as be,N as A,Nt as j,Pt as M,Q as xe,Tt as N,Y as P,Z as F,a as I,bt as L,ft as R,jt as z,lt as Se,q as B,wt as V}from"./dist-CgLbXgrr.js";var H=e(n(),1),Ce=i(),we=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:y(this.yanchor),yhead:y(this.yhead)}}static fromJSON(t){return new e(D(t.yanchor),D(t.yhead))}},Te=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new _(e)}toYPos(e,t=0){return f(this.ytext,e,t)}fromYPos(e){let t=p(D(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new we(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?N.cursor(n.pos,n.assoc):N.range(t.pos,n.pos)}},U=k.define({combine(e){return e[e.length-1]}}),W=L.define(),Ee=class{constructor(e){this.view=e,this.conf=e.state.facet(U),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[W.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(W)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
3
3
  `);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},De=F.fromClass(Ee),Oe=P.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),ke=L.define(),Ae=class extends xe{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return v(`span`,[g(`class`,`cm-ySelectionCaret`),g(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[b(`⁠`),v(`div`,[g(`class`,`cm-ySelectionCaretDot`)]),b(`⁠`),v(`div`,[g(`class`,`cm-ySelectionInfo`)],[b(this.name)]),b(`⁠`)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},je=class{constructor(e){this.conf=e.state.facet(U),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[ke.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=ye.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,i=[],a=this.conf.awareness.getLocalState();if(a!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,o=a.cursor==null?null:D(a.cursor.anchor),s=a.cursor==null?null:D(a.cursor.head);if(i!=null){let e=f(t,i.anchor),n=f(t,i.head);(a.cursor==null||!l(o,e)||!l(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else a.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((a,s)=>{if(s===r.doc.clientID)return;let c=a.cursor;if(c==null||c.anchor==null||c.head==null)return;let l=p(c.anchor,n),u=p(c.head,n);if(l==null||u==null||l.type!==t||u.type!==t)return;let{color:d=`#30bced`,name:f=`Anonymous`}=a.user||{},m=a.user&&a.user.colorLight||d+`33`,h=C(l.index,u.index),g=o(l.index,u.index),_=e.view.state.doc.lineAt(h),v=e.view.state.doc.lineAt(g);if(_.number===v.number)i.push({from:h,to:g,value:B.mark({attributes:{style:`background-color: ${m}`},class:`cm-ySelection`})});else{i.push({from:h,to:_.from+_.length,value:B.mark({attributes:{style:`background-color: ${m}`},class:`cm-ySelection`})}),i.push({from:v.from,to:g,value:B.mark({attributes:{style:`background-color: ${m}`},class:`cm-ySelection`})});for(let t=_.number+1;t<v.number;t++){let n=e.view.state.doc.line(t).from;i.push({from:n,to:n,value:B.line({attributes:{style:`background-color: ${m}`,class:`cm-yLineSelection`}})})}}i.push({from:u.index,to:u.index,value:B.widget({side:u.index-l.index>0?-1:1,block:!1,widget:new Ae(d,f)})})}),this.decorations=B.set(i,!0)}},Me=F.fromClass(je,{decorations:e=>e.decorations}),Ne=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},G=k.define({combine(e){return e[e.length-1]}});L.define();var Pe=class{constructor(e){this.view=e,this.conf=e.state.facet(G),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(U),this._beforeChangeSelection=null,this._mux=u(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[P.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(W)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Fe=F.fromClass(Pe),Ie=({state:e,dispatch:t})=>e.facet(G).undo()||!0,Le=({state:e,dispatch:t})=>e.facet(G).redo()||!0,Re=(e,t,{undoManager:n=new _(e)}={})=>{let r=new Te(e,t),i=[U.of(r),De];return t&&i.push(Oe,Me),n!==!1&&i.push(G.of(new Ne(n)),Fe,P.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?Ie(t):e.inputType===`historyRedo`?Le(t):!1}})),i},ze=[I.of({name:`javascript`,alias:[`js`,`jsx`],extensions:[`js`,`mjs`,`cjs`,`jsx`],load:async()=>pe({jsx:!0})}),I.of({name:`typescript`,alias:[`ts`,`tsx`],extensions:[`ts`,`mts`,`cts`,`tsx`],load:async()=>pe({typescript:!0,jsx:!0})}),I.of({name:`json`,alias:[`jsonc`],extensions:[`json`,`jsonc`],load:()=>t(()=>import(`./dist-DlS42TIP.js`).then(e=>e.json()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}),I.of({name:`yaml`,alias:[`yml`],extensions:[`yaml`,`yml`],load:()=>t(()=>import(`./dist-DeDgmJv2.js`).then(e=>e.yaml()),__vite__mapDeps([5,1,2,3,4]),import.meta.url)}),I.of({name:`css`,alias:[`scss`,`less`],extensions:[`css`,`scss`,`less`],load:async()=>de()}),I.of({name:`html`,alias:[`htm`],extensions:[`html`,`htm`],load:async()=>me()}),I.of({name:`python`,alias:[`py`],extensions:[`py`,`pyw`],load:()=>t(()=>import(`./dist-DR1MrLJC.js`).then(e=>e.python()),__vite__mapDeps([6,7,1,2,3,4]),import.meta.url)}),I.of({name:`rust`,alias:[`rs`],extensions:[`rs`],load:()=>t(()=>import(`./dist-BqO6NfD-.js`).then(e=>e.rust()),__vite__mapDeps([8,1,2,3,4]),import.meta.url)}),I.of({name:`markdown`,alias:[`md`,`mdx`],extensions:[`md`,`mdx`,`markdown`],load:async()=>ce()}),I.of({name:`bash`,alias:[`sh`,`shell`,`zsh`],extensions:[`sh`,`bash`,`zsh`],load:async()=>{let[{StreamLanguage:e,LanguageSupport:n},{shell:r}]=await Promise.all([t(()=>import(`./dist-CgLbXgrr.js`).then(e=>e.m),__vite__mapDeps([1,2,3]),import.meta.url),t(()=>import(`./shell-7yok6dsz.js`),[],import.meta.url)]);return new n(e.define(r))}}),I.of({name:`go`,alias:[`golang`],extensions:[`go`],load:async()=>{let[{StreamLanguage:e,LanguageSupport:n},{go:r}]=await Promise.all([t(()=>import(`./dist-CgLbXgrr.js`).then(e=>e.m),__vite__mapDeps([1,2,3]),import.meta.url),t(()=>import(`./go-DatQmDtN.js`),[],import.meta.url)]);return new n(e.define(r))}})],Be=j.define(),Ve=j.define(),He=B.line({class:`agent-flash`}),Ue=M.define({create(){return B.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(Be)){let{from:r,to:i}=n.value,a=[];for(let e=r;e<=i;){let n=t.state.doc.lineAt(e);a.push(He.range(n.from)),e=n.to+1}e=e.update({add:a,sort:!0})}else n.is(Ve)&&(e=B.none);return e},provide:e=>P.decorations.from(e)});function We(e){let t=e.getMap(`agent-flash`);return[Ue,F.define(e=>{let n=0,r=Date.now(),i=null,a=null,o=!1;function s(){let t=e.state.doc.length;t!==0&&(o||(e.dispatch({effects:Be.of({from:0,to:t})}),a&&clearTimeout(a),a=setTimeout(()=>{a=null,!o&&e.dispatch({effects:Ve.of(null)})},ne)))}let c=e=>{if(ie(t),!O(t,r))return;r=Date.now();let a=Date.now();if(a-n<500){if(!i){let e=500-(a-n);i=setTimeout(()=>{i=null,n=Date.now(),s()},e)}return}n=a,s()};t.observe(c);let l=()=>{document.visibilityState===`visible`?O(t,r)&&(r=Date.now(),n=Date.now(),s()):r=Date.now()};return document.addEventListener(`visibilitychange`,l),{update(e){},destroy(){o=!0,t.unobserve(c),document.removeEventListener(`visibilitychange`,l),i&&=(clearTimeout(i),null),a&&=(clearTimeout(a),null)}}})]}var K=/\[([^\]\n]*)\]\((<[^>\n]+>|[^)\s\n]+)(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?\)/g,Ge=B.mark({class:`cm-md-internal-link`});function Ke(e,t){return t>0&&e[t-1]===`!`}function qe(e){let t=e[2]??``;return t.startsWith(`<`)&&t.endsWith(`>`)?t.slice(1,-1):t}function Je(e){let t=new z;for(let{from:n,to:r}of e.visibleRanges){let i=e.state.doc.sliceString(n,r);K.lastIndex=0;let a=K.exec(i);for(;a!==null;){let e=Ke(i,a.index)?null:c(qe(a));e&&e.kind!==`external`&&t.add(n+a.index,n+a.index+a[0].length,Ge),a=K.exec(i)}}return t.finish()}var Ye=F.fromClass(class{decorations;constructor(e){this.decorations=Je(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=Je(e.view))}},{decorations:e=>e.decorations}),Xe=P.domEventHandlers({mousedown(e,t){if(!e.ctrlKey&&!e.metaKey)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n===null)return!1;let r=t.state.doc.lineAt(n);K.lastIndex=0;let i=K.exec(r.text);for(;i!==null;){let t=r.from+i.index,a=t+i[0].length;if(n>=t&&n<=a){let t=Ke(r.text,i.index)?null:c(qe(i));if(t&&t.kind!==`external`)return e.preventDefault(),t.kind===`doc`&&E(e)?(m(t),!0):(s(t),!0)}i=K.exec(r.text)}return!1}}),Ze=P.theme({".cm-md-internal-link":{color:`oklch(52.7% 0.154 228.4)`,fontWeight:`500`},".cm-md-internal-link:hover":{textDecoration:`underline`,cursor:`pointer`}});function Qe(){return[Ye,Xe,Ze]}var $e=5e3,q=null,et=0,tt=null,J=new Map;async function nt(){let e=Date.now();return q&&e-et<$e?q:(q=await w(),et=e,tt=st(q),q)}async function rt(e){let t=Date.now(),n=J.get(e);if(n!==void 0&&t-n.time<$e)return n.headings;try{let n=await T(e);return J.set(e,{headings:n,time:t}),n}catch(n){return console.warn(`[wiki-link-source] /api/page-headings fetch failed:`,n),J.set(e,{headings:[],time:t}),[]}}var Y=/\[\[[^\]]*?\]\]/g,it=B.mark({class:`cm-wiki-link`}),at=B.mark({class:`cm-wiki-link cm-wiki-link-broken`});function ot(e){let t=new Set;for(let n of e)t.add(n.docName.toLowerCase()),n.title&&t.add(n.title.toLowerCase());return t}function st(e){let t=ot(e);for(let n of e){let e=n.docName.split(`/`);e.pop();let r=``;for(let n of e)r=r?`${r}/${n}`:n,t.add(r.toLowerCase())}return t}function ct(e){return e.split(/[#|]/)[0].trim().toLowerCase()}function lt(e){let t=new z,n=q?tt:null;for(let{from:r,to:i}of e.visibleRanges){let a=e.state.doc.sliceString(r,i);Y.lastIndex=0;let o=Y.exec(a);for(;o!==null;){let e=it;if(n){let t=ct(o[0].slice(2,-2));t&&!n.has(t)&&(e=at)}t.add(r+o.index,r+o.index+o[0].length,e),o=Y.exec(a)}}return t.finish()}var ut=F.fromClass(class{decorations;cacheWarmAtBuild;constructor(e){this.cacheWarmAtBuild=q!==null,this.decorations=lt(e),this.cacheWarmAtBuild||this.warmCache(e)}update(e){let t=q!==null;(e.docChanged||e.viewportChanged||!this.cacheWarmAtBuild&&t)&&(this.cacheWarmAtBuild=t,this.decorations=lt(e.view))}warmCache(e){nt().then(()=>{try{e.dispatch({})}catch{}}).catch(e=>{console.warn(`[wiki-link-source] warmCache fetch failed:`,e)})}},{decorations:e=>e.decorations}),X=/\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/g,dt=P.domEventHandlers({mousedown(e,t){if(!e.ctrlKey&&!e.metaKey)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n===null)return!1;let r=t.state.doc.lineAt(n);X.lastIndex=0;let i=X.exec(r.text);for(;i!==null;){let t=r.from+i.index,a=t+i[0].length;if(n>=t&&n<=a){let t=i[1]?.trim(),n=i[2]?.trim()||null;if(t){let r=re(t,n);if(!r)return!1;e.preventDefault(),r.kind===`external`?window.open(r.url,`_blank`,`noopener,noreferrer`):E(e)?m(r):window.location.hash=r.anchor?`#/${r.docName}?anchor=${encodeURIComponent(r.anchor)}`:`#/${r.docName}`}return!0}i=X.exec(r.text)}return!1}});async function ft(e){let t=e.state.doc.sliceString(0,e.pos).match(/\[\[([^\]]*)$/);if(!t)return null;let n=t[1],r=e.pos-n.length,i=n.indexOf(`#`);if(i>0){let e=n.slice(0,i),t=n.slice(i+1),a=r+i+1,o=await rt(e);if(!o.length)return null;let s=x(o,t);return s.length?{from:a,filter:!1,options:s.map(e=>({label:e.text,detail:`H${e.level}`,apply(t,n,r,i){let a=t.state.doc.sliceString(i,i+2)===`]]`?``:`]]`;t.dispatch({changes:{from:r,to:i,insert:e.slug+a},selection:{anchor:r+e.slug.length+a.length}})}}))}:null}return{from:r,filter:!1,options:ee(await nt().catch(e=>(console.warn(`[wiki-link-source] Failed to fetch pages:`,e),[])),n).map(e=>({label:e.title,detail:e.title===e.docName?void 0:e.docName,apply(t,n,r,i){let a=t.state.doc.sliceString(i,i+2)===`]]`?``:`]]`;t.dispatch({changes:{from:r,to:i,insert:e.docName+a},selection:{anchor:r+e.docName.length+a.length}})}}))}}var pt=P.theme({".cm-wiki-link":{color:`oklch(52.7% 0.154 228.4)`,fontWeight:`500`},".cm-wiki-link:hover":{textDecoration:`underline`,cursor:`pointer`}});function mt(){return[ut,dt,pt,le.data.of({autocomplete:ft})]}var ht=B.mark({class:`cm-link-ref-broken`}),gt=/^\s{0,3}\[([^\]]+)\]:\s/,_t=/\[([^\]]*)\]\[([^\]]*)\]/g,vt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function Z(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function yt(e){let t=[];return A(e).iterate({enter(e){if(vt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function Q(e){let t=new Set,n=[],r=e.doc,i=yt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(Z(n.from,i))continue;let a=gt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!Z(t.from,i)&&!gt.test(t.text))for(_t.lastIndex=0;;){let e=_t.exec(t.text);if(!e)break;let r=t.from+e.index;if(Z(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(ht.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),B.set(a)}var bt=M.define({create(e){return Q(e)},update(e,t){return t.docChanged?Q(t.state):e},provide:e=>P.decorations.from(e)}),xt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,St=B.mark({class:`cm-del`}),Ct=B.line({class:`cm-table-header`}),wt=B.line({class:`cm-table-row`});function Tt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function Et(e,t){let n=[],r=A(e);for(let{from:i,to:a}of t)r.iterate({from:i,to:a,enter(t){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(St.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=xt.exec(r.text),a=i?i[1].length:2,o=B.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=Tt(r.text),a=B.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(Ct.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(wt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(wt.range(r.from)),!1}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),B.set(n)}var Dt=class{decorations;constructor(e){this.decorations=Et(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||A(e.startState)!==A(e.state))&&(this.decorations=Et(e.view.state,e.view.visibleRanges))}},Ot=F.fromClass(Dt,{decorations:e=>e.decorations});function kt(){return[Ot,bt]}var At=r(),jt=_e({settings:{background:`var(--background)`,gutterBackground:`var(--background)`}}),Mt=fe({settings:{background:`var(--background)`,gutterBackground:`var(--background)`}}),Nt=new V,Pt=new V;function $(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&n.line(1).text===`---`){for(let e=2;e<=n.lines;e++)if(n.line(e).text===`---`){r=e+1;break}}let i=te(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:N.cursor(r.from),effects:P.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Ft(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:N.cursor(r),effects:P.scrollIntoView(r,{y:`center`})}),e.focus()})}function It(e){let t=(0,Ce.c)(23),{docName:n,ytext:r,provider:i,placeholder:o,isSourceModeActive:s}=e,c=(0,H.useRef)(null),l=(0,H.useRef)(null),[u,f]=(0,H.useState)(null);if(u)throw u;let{resolvedTheme:p}=a(),m=(0,H.useRef)(null),g;t[0]!==o||t[1]!==i||t[2]!==p||t[3]!==r?(g=()=>{let e=c.current;if(!e)return;let t=i.configuration.name??``,n,a=Lt;try{n=h({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let t=ge({ydoc:i.document,ytext:r}),n=new P({state:be.create({doc:r.toString(),extensions:[he,Se.of([se]),ce({base:le,extensions:[ue],codeLanguages:ze}),Re(r,i.awareness),We(i.document),mt(),Qe(),kt(),t,Nt.of(p===`dark`?jt:Mt),Pt.of(R(o??``)),P.lineWrapping,P.theme({"&":{height:`100%`}})]}),parent:e}),s=n.contentDOM;return s.addEventListener(`keydown`,a),s.addEventListener(`paste`,a),s.addEventListener(`drop`,a),s.addEventListener(`cut`,a),{view:n,ydoc:i.document,ytext:r,provider:i}}}),m.current=n,l.current=n.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),m.current=null,l.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=m.current;e&&d(e),m.current=null,l.current=null}},t[0]=o,t[1]=i,t[2]=p,t[3]=r,t[4]=g):g=t[4];let _;t[5]!==i||t[6]!==r?(_=[r,i],t[5]=i,t[6]=r,t[7]=_):_=t[7],(0,H.useEffect)(g,_);let v,y;t[8]===p?(v=t[9],y=t[10]):(v=()=>{l.current&&l.current.dispatch({effects:Nt.reconfigure(p===`dark`?jt:Mt)})},y=[p],t[8]=p,t[9]=v,t[10]=y),(0,H.useEffect)(v,y);let b,x;t[11]===o?(b=t[12],x=t[13]):(b=()=>{l.current&&l.current.dispatch({effects:Pt.reconfigure(R(o??``))})},x=[o],t[11]=o,t[12]=b,t[13]=x),(0,H.useEffect)(b,x);let S,C;t[14]!==n||t[15]!==s?(S=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!s)return;let r=l.current;r&&($(r,t),ae(n))};return window.addEventListener(oe,e),()=>window.removeEventListener(oe,e)},C=[n,s],t[14]=n,t[15]=s,t[16]=S,t[17]=C):(S=t[16],C=t[17]),(0,H.useEffect)(S,C);let w,T;t[18]!==n||t[19]!==s?(T=()=>{if(!s)return;let e=l.current;if(!e)return;let t=ve(n);if(t){if(t.kind===`outline`){$(e,t.detail);return}Ft(e,t.detail)}},w=[n,s],t[18]=n,t[19]=s,t[20]=w,t[21]=T):(w=t[20],T=t[21]),(0,H.useEffect)(T,w);let E;return t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,At.jsx)(`div`,{ref:c,className:`source-editor h-full py-3`}),t[22]=E):E=t[22],E}function Lt(){return S()}export{It as SourceEditor};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{a as i,f as a,i as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./panel-BCRdtBla.js";import{n as p}from"./button-BPXuMr5W.js";import{J as m,K as ee,it as te,n as ne}from"./DocumentContext-C1msvcHp.js";import{x as re}from"./dialog-CtSN0d2b.js";import{$ as ie,Ht as ae,it as oe,n as se,rt as ce,w as le,x as h,z as ue,zt as de}from"./PageListContext-B5SWnlyE.js";import{$ as g,A as _,B as v,Bt as y,Ct as b,D as fe,Dt as pe,E as x,Et as me,Ft as he,G as S,H as ge,Ht as _e,I as C,It as ve,J as ye,K as be,L as w,Lt as xe,M as Se,N as T,Nt as E,P as Ce,Pt as we,Q as Te,Rt as Ee,S as De,St as Oe,T as ke,Tt as D,U as Ae,V as je,Vt as Me,W as Ne,Y as O,Z as Pe,_ as Fe,a as Ie,at as Le,b as Re,bt as ze,c as Be,ct as Ve,d as He,et as Ue,f as We,g as Ge,gt as Ke,h as qe,ht as Je,i as Ye,j as Xe,jt as Ze,k as Qe,kt as $e,l as et,lt as tt,mt as nt,n as rt,nt as it,o as at,ot,p as st,pt as ct,q as k,r as lt,s as ut,st as dt,t as ft,tt as pt,u as mt,ut as ht,v as gt,vt as A,w as _t,x as vt,xt as yt,y as bt,z as xt,zt as St}from"./dist-CgLbXgrr.js";import{a as Ct,c as j,i as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./dist-D2wwoXzm.js";import{i as At,n as M,r as jt,t as Mt}from"./dist-GlH2KPqY.js";var Nt=e(t(),1),Pt=r(),Ft=new Map;function It(e,t){Ft.set(e,t)}function Lt(e){let t=Ft.get(e)??null;return Ft.delete(e),t}function Rt(e){Ft.delete(e)}var zt=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.hashProp=[[v.contextHash,r]]}addChild(e,t){e.prop(v.contextHash)!=this.hash&&(e=new S(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new S(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new S(ge.none,e,t,n,this.hashProp)})}},N;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(N||={});var Bt=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},Vt=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Wt(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function Ht(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==N.OrderedList?Zt:Xt)(n,t,!1);return r>0&&(e.type!=N.BulletList||Jt(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var Ut={[N.Blockquote](e,t,n){return n.next==62?(n.markers.push(F(N.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(P(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[N.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[N.OrderedList]:Ht,[N.BulletList]:Ht,[N.Document](){return!0}};function P(e){return e==32||e==9||e==10||e==13}function Wt(e,t=0){for(;t<e.length&&P(e.charCodeAt(t));)t++;return t}function Gt(e,t,n){for(;t>n&&P(e.charCodeAt(t-1));)t--;return t}function Kt(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function qt(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function Jt(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!P(n))return-1}return n&&e.next==45&&$t(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(fn.SetextHeading)>-1||r<3?-1:1}function Yt(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function Xt(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||P(e.text.charCodeAt(e.pos+1)))&&(!n||Yt(t,N.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function Zt(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!P(e.text.charCodeAt(r+1))||n&&!Yt(t,N.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function Qt(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function $t(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&P(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var en=/^[ \t]*$/,tn=/-->/,nn=/\?>/,rn=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,tn],[/^\s*<\?/,nn],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,en],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,en]];function an(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=rn.length-+!!n;e<t;e++)if(rn[e][0].test(r))return e;return-1}function on(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function sn(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==N.CodeText?e[r].to=n:e.push(F(N.CodeText,t,n))}var cn={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(sn(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){sn(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==N.CodeText?sn(o,e.from,e.to):o.push(e);s=[]}sn(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&sn(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=N.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(N.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=Kt(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=Gt(t.text,t.text.length,o),c=[F(N.CodeMark,r,r+a)];o<s&&c.push(F(N.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&sn(c,e.lineStart-1,e.lineStart),c.push(F(N.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(sn(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(sn(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(N.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=qt(t);return n<0?!1:(e.startContext(N.Blockquote,t.pos),e.addNode(N.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(Jt(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(N.HorizontalRule,n),!0},BulletList(e,t){let n=Xt(t,e,!1);if(n<0)return!1;e.block.type!=N.BulletList&&e.startContext(N.BulletList,t.basePos,t.next);let r=on(t,t.pos+1);return e.startContext(N.ListItem,t.basePos,r-t.baseIndent),e.addNode(N.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=Zt(t,e,!1);if(n<0)return!1;e.block.type!=N.OrderedList&&e.startContext(N.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=on(t,t.pos+n);return e.startContext(N.ListItem,t.basePos,r-t.baseIndent),e.addNode(N.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=Qt(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=Gt(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!P(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(N.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(N.HeaderMark,o-r,a-r);let c=s.finish(N.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=an(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=rn[n][1],a=[],o=i!=en;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==tn?N.CommentBlock:i==nn?N.ProcessingInstructionBlock:N.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},ln=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
1
+ import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{a as i,f as a,i as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./panel-BCRdtBla.js";import{n as p}from"./button-BPXuMr5W.js";import{J as m,K as ee,it as te,n as ne}from"./DocumentContext-BQEvrOdm.js";import{x as re}from"./dialog-CtSN0d2b.js";import{$ as ie,Ht as ae,it as oe,n as se,rt as ce,w as le,x as h,z as ue,zt as de}from"./PageListContext-B5SWnlyE.js";import{$ as g,A as _,B as v,Bt as y,Ct as b,D as fe,Dt as pe,E as x,Et as me,Ft as he,G as S,H as ge,Ht as _e,I as C,It as ve,J as ye,K as be,L as w,Lt as xe,M as Se,N as T,Nt as E,P as Ce,Pt as we,Q as Te,Rt as Ee,S as De,St as Oe,T as ke,Tt as D,U as Ae,V as je,Vt as Me,W as Ne,Y as O,Z as Pe,_ as Fe,a as Ie,at as Le,b as Re,bt as ze,c as Be,ct as Ve,d as He,et as Ue,f as We,g as Ge,gt as Ke,h as qe,ht as Je,i as Ye,j as Xe,jt as Ze,k as Qe,kt as $e,l as et,lt as tt,mt as nt,n as rt,nt as it,o as at,ot,p as st,pt as ct,q as k,r as lt,s as ut,st as dt,t as ft,tt as pt,u as mt,ut as ht,v as gt,vt as A,w as _t,x as vt,xt as yt,y as bt,z as xt,zt as St}from"./dist-CgLbXgrr.js";import{a as Ct,c as j,i as wt,n as Tt,o as Et,r as Dt,s as Ot,t as kt}from"./dist-D2wwoXzm.js";import{i as At,n as M,r as jt,t as Mt}from"./dist-GlH2KPqY.js";var Nt=e(t(),1),Pt=r(),Ft=new Map;function It(e,t){Ft.set(e,t)}function Lt(e){let t=Ft.get(e)??null;return Ft.delete(e),t}function Rt(e){Ft.delete(e)}var zt=class e{static create(t,n,r,i,a){return new e(t,n,r,i+(i<<8)+t+(n<<4)|0,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.hashProp=[[v.contextHash,r]]}addChild(e,t){e.prop(v.contextHash)!=this.hash&&(e=new S(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new S(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new S(ge.none,e,t,n,this.hashProp)})}},N;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(N||={});var Bt=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},Vt=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Wt(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function Ht(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==N.OrderedList?Zt:Xt)(n,t,!1);return r>0&&(e.type!=N.BulletList||Jt(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var Ut={[N.Blockquote](e,t,n){return n.next==62?(n.markers.push(F(N.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(P(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0):!1},[N.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[N.OrderedList]:Ht,[N.BulletList]:Ht,[N.Document](){return!0}};function P(e){return e==32||e==9||e==10||e==13}function Wt(e,t=0){for(;t<e.length&&P(e.charCodeAt(t));)t++;return t}function Gt(e,t,n){for(;t>n&&P(e.charCodeAt(t-1));)t--;return t}function Kt(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function qt(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function Jt(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!P(n))return-1}return n&&e.next==45&&$t(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(fn.SetextHeading)>-1||r<3?-1:1}function Yt(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function Xt(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||P(e.text.charCodeAt(e.pos+1)))&&(!n||Yt(t,N.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function Zt(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!P(e.text.charCodeAt(r+1))||n&&!Yt(t,N.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function Qt(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function $t(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&P(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var en=/^[ \t]*$/,tn=/-->/,nn=/\?>/,rn=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,tn],[/^\s*<\?/,nn],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,en],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,en]];function an(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=rn.length-+!!n;e<t;e++)if(rn[e][0].test(r))return e;return-1}function on(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function sn(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==N.CodeText?e[r].to=n:e.push(F(N.CodeText,t,n))}var cn={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(sn(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){sn(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==N.CodeText?sn(o,e.from,e.to):o.push(e);s=[]}sn(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&sn(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=N.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(N.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=Kt(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=Gt(t.text,t.text.length,o),c=[F(N.CodeMark,r,r+a)];o<s&&c.push(F(N.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&sn(c,e.lineStart-1,e.lineStart),c.push(F(N.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}else{o=!0,n||(sn(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(sn(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(N.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=qt(t);return n<0?!1:(e.startContext(N.Blockquote,t.pos),e.addNode(N.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(Jt(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(N.HorizontalRule,n),!0},BulletList(e,t){let n=Xt(t,e,!1);if(n<0)return!1;e.block.type!=N.BulletList&&e.startContext(N.BulletList,t.basePos,t.next);let r=on(t,t.pos+1);return e.startContext(N.ListItem,t.basePos,r-t.baseIndent),e.addNode(N.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=Zt(t,e,!1);if(n<0)return!1;e.block.type!=N.OrderedList&&e.startContext(N.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=on(t,t.pos+n);return e.startContext(N.ListItem,t.basePos,r-t.baseIndent),e.addNode(N.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=Qt(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=Gt(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!P(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(N.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(N.HeaderMark,o-r,a-r);let c=s.finish(N.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=an(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=rn[n][1],a=[],o=i!=en;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==tn?N.CommentBlock:i==nn?N.ProcessingInstructionBlock:N.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},ln=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
2
2
  `+t.scrub(),i=this.advance(r);return i>-1&&i<r.length?this.complete(e,n,i):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Wt(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,F(N.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(In(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(F(N.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Pn(e,Wt(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Wt(e,this.pos),n=0;if(t>this.pos){let r=Fn(e,t,this.start);if(r){let t=un(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=un(e,this.pos),n>0&&n<e.length?n:-1}else return un(e,this.pos)}};function un(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!P(n))return-1}return t}var dn=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:$t(t),i=t.next;if(r<0)return!1;let a=F(N.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,F(i==61?N.SetextHeading1:N.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},fn={LinkReference(e,t){return t.content.charCodeAt(0)==91?new ln(t):null},SetextHeading(){return new dn}},pn=[(e,t)=>Qt(t)>=0,(e,t)=>Kt(t)>=0,(e,t)=>qt(t)>=0,(e,t)=>Xt(t,e,!0)>=0,(e,t)=>Zt(t,e,!0)>=0,(e,t)=>Jt(t,e,!0)>=0,(e,t)=>an(t,e,!0)>=0],mn={text:``,end:0},hn=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new Vt,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=zt.create(N.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Bn(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}let t=new Bt(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
3
3
  `+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=Vn(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=mn;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+N[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
4
4
  `?``:t;else{let e=t.indexOf(`