@thebase/ui 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +49 -8
- package/bin/create-baseui-app.mjs +268 -0
- package/dist/baseui.esm.js +1 -1
- package/dist/baseui.min.js +1 -1
- package/dist/baseui.registry.json +2 -2
- package/dist/runtime/block-N5MIBOMO.js +1 -0
- package/dist/runtime/chunk-23NN352E.js +1 -0
- package/dist/runtime/chunk-6X7NT7KH.js +2 -0
- package/dist/runtime/chunk-7R5G6FRT.js +1 -0
- package/dist/runtime/chunk-7R75J74M.js +1 -0
- package/dist/runtime/chunk-EAFZBBCI.js +10 -0
- package/dist/runtime/chunk-GF2LJCG5.js +1 -0
- package/dist/runtime/chunk-HKUJH2VC.js +1 -0
- package/dist/runtime/chunk-KX3KYRT7.js +1 -0
- package/dist/runtime/chunk-MAWHENWJ.js +1 -0
- package/dist/runtime/chunk-OESZ7FEN.js +1 -0
- package/dist/runtime/chunk-P3WV3MLS.js +35 -0
- package/dist/runtime/chunk-SGGMD6DA.js +5 -0
- package/dist/runtime/chunk-URTGZHMG.js +3 -0
- package/dist/runtime/chunk-XLIC2WFB.js +1 -0
- package/dist/runtime/clipboard-6EHVQ6GB.js +4 -0
- package/dist/runtime/commonmark-FAT3C7WA.js +1 -0
- package/dist/runtime/core-IEFFKRMW.js +1 -0
- package/dist/runtime/cursor-3BFXMKNC.js +1 -0
- package/dist/runtime/diff-ALMDXB3Z.js +1 -0
- package/dist/runtime/gfm-JUXF3E6O.js +5 -0
- package/dist/runtime/history-OU6CQBOY.js +1 -0
- package/dist/runtime/indent-RP5Y5HNK.js +1 -0
- package/dist/runtime/lib-TTIE4EGJ.js +1 -0
- package/dist/runtime/listener-JBODN3BE.js +1 -0
- package/dist/runtime/marked.min.js +69 -0
- package/dist/runtime/mermaid.esm.min.mjs +3593 -0
- package/dist/runtime/milkdown-editor.js +1 -0
- package/dist/runtime/prosemirror-text-editor.js +1 -0
- package/dist/runtime/slash-I56NP4SS.js +1 -0
- package/dist/runtime/streaming-WPAF6YN6.js +3 -0
- package/dist/runtime/tooltip-XDWVKIO5.js +1 -0
- package/dist/runtime/upload-MYBCHYBD.js +1 -0
- package/dist/runtime/y-webrtc-WDTQEBWZ.js +1 -0
- package/dist/runtime/yjs-SRZJJJEG.js +1 -0
- package/docs/blocks.md +4 -2
- package/docs/icons.md +4 -2
- package/docs/installation.md +36 -28
- package/docs/owl-components.md +7 -5
- package/docs/theming.md +2 -2
- package/docs/usage-guide.md +64 -60
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as A,x,y as C}from"./chunk-EAFZBBCI.js";var y=200,u=function(){};u.prototype.append=function(e){return e.length?(e=u.from(e),!this.length&&e||e.length<y&&this.leafAppend(e)||this.length<y&&e.leafPrepend(this)||this.appendInner(e)):this};u.prototype.prepend=function(e){return e.length?u.from(e).append(this):this};u.prototype.appendInner=function(e){return new L(this,e)};u.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?u.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};u.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};u.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};u.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,p){return i.push(e(s,p))},t,n),i};u.from=function(e){return e instanceof u?e:e&&e.length?new D(e):u.empty};var D=(function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,p,l){for(var a=s;a<p;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,p,l){for(var a=s-1;a>=p;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=y)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=y)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(u);u.empty=new D([]);var L=(function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,p){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),p)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,p+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,p){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,p+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,p)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(u),T=u;var j=500,w=class r{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let p=e.tr,l,a,h=[],c=[];return this.items.forEach((o,f)=>{if(!o.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,c.push(o);return}if(i){c.push(new g(o.map));let d=o.step.map(i.slice(s)),v;d&&p.maybeStep(d).doc&&(v=p.mapping.maps[p.mapping.maps.length-1],h.push(new g(v,void 0,void 0,h.length+c.length))),s--,v&&i.appendMap(v,s)}else p.maybeStep(o.step);if(o.selection)return l=i?o.selection.map(i.slice(s)):o.selection,a=new r(this.items.slice(0,n).append(c.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:p,selection:l}}addTransform(e,t,n,i){let s=[],p=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let c=0;c<e.steps.length;c++){let o=e.steps[c].invert(e.docs[c]),f=new g(e.mapping.maps[c],o,t),d;(d=a&&a.merge(f))&&(f=d,c?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(p++,t=void 0),i||(a=f)}let h=p-n.depth;return h>G&&(l=F(l,h),p-=h),new r(l.append(s),p)}remapping(e,t){let n=new A;return this.items.forEach((i,s)=>{let p=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,p)},e,t),n}addMaps(e){return this.eventCount==0?this:new r(this.items.append(e.map(t=>new g(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,p=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let d=s.getMirror(--a);if(d==null)return;p=Math.min(p,d);let v=s.maps[d];if(f.step){let H=e.steps[d].invert(e.docs[d]),O=f.selection&&f.selection.map(s.slice(a+1,d));O&&l++,n.push(new g(v,H,O))}else n.push(new g(v))},i);let h=[];for(let f=t;f<p;f++)h.push(new g(s.maps[f]));let c=this.items.slice(0,i).append(h).append(n),o=new r(c,l);return o.emptyItemCount()>j&&(o=o.compress(this.items.length-n.length)),o}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((p,l)=>{if(l>=e)i.push(p),p.selection&&s++;else if(p.step){let a=p.step.map(t.slice(n)),h=a&&a.getMap();if(n--,h&&t.appendMap(h,n),a){let c=p.selection&&p.selection.map(t.slice(n));c&&s++;let o=new g(h.invert(),a,c),f,d=i.length-1;(f=i.length&&i[d].merge(o))?i[d]=f:i.push(o)}}else p.map&&n--},this.items.length,0),new r(T.from(i.reverse()),s)}};w.empty=new w(T.empty,0);function F(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}var g=class r{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new r(t.getMap().invert(),t,this.selection)}}},m=class{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}},G=20;function S(r,e,t,n){let i=t.getMeta(I),s;if(i)return i.historyState;t.getMeta(N)&&(r=new m(r.done,r.undone,null,0,-1));let p=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(p&&p.getMeta(I))return p.getMeta(I).redo?new m(r.done.addTransform(t,void 0,n,M(e)),r.undone,_(t.mapping.maps),r.prevTime,r.prevComposition):new m(r.done,r.undone.addTransform(t,void 0,n,M(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(p&&p.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!p&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!K(t,r.prevRanges)),h=p?P(r.prevRanges,t.mapping):_(t.mapping.maps);return new m(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,M(e)),w.empty,h,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new m(r.done.rebased(t,s),r.undone.rebased(t,s),P(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new m(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),P(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function K(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function _(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,p)=>e.push(s,p));return e}function P(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function B(r,e,t){let n=M(e),i=I.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let p=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new m(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(p).setMeta(I,{redo:t,historyState:a})}var b=!1,k=null;function M(r){let e=r.plugins;if(k!=e){b=!1,k=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){b=!0;break}}return b}var I=new C("history"),N=new C("closeHistory");function J(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new x({key:I,state:{init(){return new m(w.empty,w.empty,null,0,-1)},apply(e,t,n){return S(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?R:n=="historyRedo"?U:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function E(r,e){return(t,n)=>{let i=I.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=B(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}var R=E(!1,!0),U=E(!0,!0),Q=E(!1,!1),X=E(!0,!1);export{J as a,R as b,U as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ue}from"./chunk-XLIC2WFB.js";import{Ab as B,B as Se,Ba as L,Bb as ae,Cb as p,Ea as ve,Fa as se,Fb as g,Ga as le,J as Te,K as we,M as Pe,Ma as Ve,Mb as Fe,O as Ye,Oa as K,Pb as Ee,Q as Ae,Qb as De,R as Ce,Rb as q,S as k,Sa as Re,Z as re,Za as W,_ as Me,a as xe,aa as Oe,b as I,c as _e,da as H,h as _,i as Y,ka as ie,rb as ce,s as be,sa as Ne,t as j,ta as J,ua as ke,xa as z,za as A}from"./chunk-SGGMD6DA.js";import{M as ne,N as oe,a as S,c as N,t as te,u as ge,v as ye,x as P,y as X}from"./chunk-EAFZBBCI.js";var h=new X("y-sync"),y=new X("y-undo"),v=new X("yjs-cursor");var Ge=/[\uD800-\uDBFF]/,Qe=/[\uDC00-\uDFFF]/,et=(t,e)=>{let o=0,n=0;for(;o<t.length&&o<e.length&&t[o]===e[o];)o++;for(o>0&&Ge.test(t[o-1])&&o--;n+o<t.length&&n+o<e.length&&t[t.length-n-1]===e[e.length-n-1];)n++;return n>0&&Qe.test(t[t.length-n])&&n--,{index:o,remove:t.length-o-n,insert:e.slice(o,e.length-n)}},Xe=et;var V=null,rt=()=>{let t=V;V=null,t.forEach((e,o)=>{let n=o.state.tr,r=h.getState(o.state);r&&r.binding&&!r.binding.isDestroyed&&(e.forEach((c,i)=>{n.setMeta(i,c)}),o.dispatch(n))})},de=(t,e,o)=>{V||(V=new Map,k(0,rt)),I(V,t,xe).set(e,o)},T=(t,e,o)=>{if(t===0)return L(e,0,e.length===0?-1:0);let n=e._first===null?null:e._first.content.type;for(;n!==null&&e!==n;){if(n instanceof g){if(n._length>=t)return L(n,t,e.length===0?-1:0);if(t-=n._length,n._item!==null&&n._item.next!==null)n=n._item.next.content.type;else{do n=n._item===null?null:n._item.parent,t--;while(n!==e&&n!==null&&n._item!==null&&n._item.next===null);n!==null&&n!==e&&(n=n._item===null?null:n._item.next.content.type)}}else{let r=(o.get(n)||{nodeSize:0}).nodeSize;if(n._first!==null&&t<r)n=n._first.content.type,t--;else{if(t===1&&n._length===0&&r>1)return new z(n._item===null?null:n._item.id,n._item===null?J(n):null,null);if(t-=r,n._item!==null&&n._item.next!==null)n=n._item.next.content.type;else{if(t===0)return n=n._item===null?n:n._item.parent,new z(n._item===null?null:n._item.id,n._item===null?J(n):null,null);do n=n._item.parent,t--;while(n!==e&&n._item.next===null);n!==e&&(n=n._item.next.content.type)}}}if(n===null)throw j();if(t===0&&n.constructor!==g&&n!==e)return it(n._item.parent,n._item)}return L(e,e._length,e.length===0?-1:0)},it=(t,e)=>{let o=null,n=null;return t._item===null?n=J(t):o=Ne(t._item.id.client,t._item.id.clock),new z(o,n,e.id)},b=(t,e,o,n)=>{let r=ve(o,t);if(r===null||r.type!==e&&!ke(e,r.type._item))return null;let c=r.type,i=0;if(c.constructor===g)i=r.index;else if(c._item===null||!c._item.deleted){let l=c._first,f=0;for(;f<c._length&&f<r.index&&l!==null;){if(!l.deleted){let s=l.content.type;f++,s instanceof g?i+=s._length:i+=n.get(s).nodeSize}l=l.right}i+=1}for(;c!==e&&c._item!==null;){let l=c._item.parent;if(l._item===null||!l._item.deleted){i+=1;let f=l._first;for(;f!==null;){let s=f.content.type;if(s===c)break;f.deleted||(s instanceof g?i+=s._length:i+=n.get(s).nodeSize),f=f.right}}c=l}return i-1},He=(t,e)=>{let o=t.toArray().map(n=>C(n,e,je())).filter(n=>n!==null);return S.fromArray(o)},st=(t,e)=>e.topNodeType.create(null,He(t,e));function lt(t,e="prosemirror"){let o=new H,n=o.get(e,ae);return n.doc?(Je(t,n),n.doc):o}function Je(t,e){let o=e||new ae,n=o.doc?o.doc:{transact:r=>r(void 0)};return M(n,o,t,{mapping:new Map,isOMark:new Map}),o}var x=(t,e)=>t>>>e|t<<32-e,at=t=>x(t,2)^x(t,13)^x(t,22),ft=t=>x(t,6)^x(t,11)^x(t,25),dt=t=>x(t,7)^x(t,18)^t>>>3,mt=t=>x(t,17)^x(t,19)^t>>>10,ut=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ht=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),me=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(ht),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,o=this._W;for(let a=16;a<64;a++)o[a]=mt(o[a-2])+o[a-7]+dt(o[a-15])+o[a-16];let n=e[0],r=e[1],c=e[2],i=e[3],l=e[4],f=e[5],s=e[6],d=e[7];for(let a=0,m,u;a<64;a++)m=d+ft(l)+(l&f^~l&s)+ut[a]+o[a]>>>0,u=at(n)+(n&r^n&c^r&c)>>>0,d=s,s=f,f=l,l=i+m>>>0,i=c,c=r,r=n,n=m+u>>>0;e[0]+=n,e[1]+=r,e[2]+=c,e[3]+=i,e[4]+=l,e[5]+=f,e[6]+=s,e[7]+=d}digest(e){let o=0;for(;o+56<=e.length;){let i=0;for(;i<16&&o+3<e.length;i++)this._W[i]=e[o++]<<24|e[o++]<<16|e[o++]<<8|e[o++];if(o%64!==0){for(this._W.fill(0,i,16);o<e.length;)this._W[i]|=e[o]<<(3-o%4)*8,o++;this._W[i]|=128<<(3-o%4)*8}this._updateHash()}let n=o%64!==0;this._W.fill(0,0,16);let r=0;for(;o<e.length;r++)for(let i=3;i>=0&&o<e.length;i--)this._W[r]|=e[o++]<<i*8;n||(this._W[r-(o%4===0?0:1)]|=128<<(3-o%4)*8),this._W[14]=e.byteLength/536870912,this._W[15]=e.byteLength*8,this._updateHash();let c=new Uint8Array(32);for(let i=0;i<this._H.length;i++)for(let l=0;l<4;l++)c[i*4+l]=this._H[i]>>>(3-l)*8;return c}},ze=t=>new me().digest(t);var gt=t=>{for(let o=6;o<t.length;o++)t[o%6]=t[o%6]^t[o];return t.slice(0,6)},Le=t=>Ye(gt(ze(Ae(t))));var je=()=>({mapping:new Map,isOMark:new Map}),R=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Me(e.ds,t.id),_t=[{light:"#ecd44433",dark:"#ecd444"}],bt=(t,e,o)=>{if(!t.has(o)){if(t.size<e.length){let n=_e();t.forEach(r=>n.add(r)),e=e.filter(r=>!n.has(r))}t.set(o,Se(e))}return t.get(o)},St=(t,{colors:e=_t,colorMapping:o=new Map,permanentUserData:n=null,onFirstRender:r=()=>{},mapping:c}={})=>{let i=!1,l=new $(t,c),f=new P({props:{editable:s=>{let d=h.getState(s);return d.snapshot==null&&d.prevSnapshot==null}},key:h,state:{init:(s,d)=>({type:t,doc:t.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:o,permanentUserData:n}),apply:(s,d)=>{let a=s.getMeta(h);if(a!==void 0){d=Object.assign({},d);for(let m in a)d[m]=a[m]}return d.addToHistory=s.getMeta("addToHistory")!==!1,d.isChangeOrigin=a!==void 0&&!!a.isChangeOrigin,d.isUndoRedoOperation=a!==void 0&&!!a.isChangeOrigin&&!!a.isUndoRedoOperation,l.prosemirrorView!==null&&a!==void 0&&(a.snapshot!=null||a.prevSnapshot!=null)&&k(0,()=>{l.prosemirrorView!=null&&(a.restore==null?l._renderSnapshot(a.snapshot,a.prevSnapshot,d):(l._renderSnapshot(a.snapshot,a.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),d}},view:s=>(l.initView(s),c==null&&l._forceRerender(),r(),{update:()=>{let d=f.getState(s.state);if(d.snapshot==null&&d.prevSnapshot==null&&(i||s.state.doc.content.findDiffStart(s.state.doc.type.createAndFill().content)!==null)){if(i=!0,d.addToHistory===!1&&!d.isChangeOrigin){let a=y.getState(s.state),m=a&&a.undoManager;m&&m.stopCapturing()}l.mux(()=>{d.doc.transact(a=>{a.meta.set("addToHistory",d.addToHistory),l._prosemirrorChanged(s.state.doc)},h)})}},destroy:()=>{l.destroy()}})});return f},Tt=(t,e,o)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new ye(t.doc));else if(e.type==="node"){let n=b(o.doc,o.type,e.anchor,o.mapping);t.setSelection(ge.create(t.doc,n))}else{let n=b(o.doc,o.type,e.anchor,o.mapping),r=b(o.doc,o.type,e.head,o.mapping);if(n!==null&&r!==null){let c=te.between(t.doc.resolve(n),t.doc.resolve(r));t.setSelection(c)}}},F=(t,e)=>({type:e.selection.jsonID,anchor:T(e.selection.anchor,t.type,t.mapping),head:T(e.selection.head,t.type,t.mapping)}),$=class{constructor(e,o=new Map){this.type=e,this.prosemirrorView=null,this.mux=Ue(),this.mapping=o,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=F(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(Pe&&this._domSelectionInView===null&&(k(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;let o=this.prosemirrorView._root.createRange();o.setStart(e.anchorNode,e.anchorOffset),o.setEnd(e.focusNode,e.focusOffset),o.getClientRects().length===0&&o.startContainer&&o.collapsed&&o.selectNodeContents(o.startContainer);let r=o.getBoundingClientRect(),c=Ce.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||c.clientWidth||0)&&r.top<=(window.innerHeight||c.clientHeight||0)}renderSnapshot(e,o){o||(o=Ve(Oe(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(h,{snapshot:e,prevSnapshot:o}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{let e=this.type.toArray().map(n=>C(n,this.prosemirrorView.state.schema,this)).filter(n=>n!==null),o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new N(S.from(e),0,0));o.setMeta(h,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(o)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{let e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,o=this.type.toArray().map(r=>C(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new N(S.from(o),0,0));if(e){let r=_(Y(e.anchor,0),n.doc.content.size),c=_(Y(e.head,0),n.doc.content.size);n.setSelection(te.create(n.doc,r,c))}this.prosemirrorView.dispatch(n.setMeta(h,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,o,n){let r=this.doc,c=this.type;if(e||(e=K(this.doc)),e instanceof Uint8Array||o instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(o instanceof Uint8Array))&&j(),r=new H({gc:!1}),ie(r,o),o=K(r),ie(r,e),e=K(r),c._item===null){let i=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);c=r.getXmlFragment(i)}else{let i=r.store.clients.get(c._item.id.client)??[],l=Re(i,c._item.id.clock);c=i[l].content.type}this.mapping.clear(),this.mux(()=>{r.transact(i=>{let l=n.permanentUserData;l&&l.dss.forEach(a=>{re(i,a,m=>{})});let f=(a,m)=>{let u=a==="added"?l.getUserByClientId(m.client):l.getUserByDeletedId(m);return{user:u,type:a,color:bt(n.colorMapping,n.colors,u)}},s=ce(c,new le(o.ds,e.sv)).map(a=>!a._item.deleted||R(a._item,e)||R(a._item,o)?C(a,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,o,f):null).filter(a=>a!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new N(S.from(s),0,0));this.prosemirrorView.dispatch(d.setMeta(h,{isChangeOrigin:!0}))},h)})}_typeChanged(e,o){if(this.prosemirrorView==null)return;let n=h.getState(this.prosemirrorView.state);if(e.length===0||n.snapshot!=null||n.prevSnapshot!=null){this.renderSnapshot(n.snapshot,n.prevSnapshot);return}this.mux(()=>{let r=(l,f)=>this.mapping.delete(f);re(o,o.deleteSet,l=>{if(l.constructor===q){let f=l.content.type;f&&this.mapping.delete(f)}}),o.changed.forEach(r),o.changedParentTypes.forEach(r);let c=this.type.toArray().map(l=>Be(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null),i=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new N(S.from(c),0,0));Tt(i,this.beforeTransactionSelection,this),i=i.setMeta(h,{isChangeOrigin:!0,isUndoRedoOperation:o.origin instanceof W}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&i.scrollIntoView(),this.prosemirrorView.dispatch(i)})}_prosemirrorChanged(e){this.doc.transact(()=>{M(this.doc,this.type,e,this),this.beforeTransactionSelection=F(this,this.prosemirrorView.state)},h)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}},Be=(t,e,o,n,r,c)=>{let i=o.mapping.get(t);if(i===void 0){if(t instanceof p)return C(t,e,o,n,r,c);throw be()}return i},C=(t,e,o,n,r,c)=>{let i=[],l=f=>{if(f instanceof p){let s=Be(f,e,o,n,r,c);s!==null&&i.push(s)}else{let s=f._item.right?.content?.type;s instanceof B&&!s._item.deleted&&s._item.id.client===s.doc.clientID&&(f.applyDelta([{retain:f.length},...s.toDelta()]),s.doc.transact(a=>{s._item.delete(a)}));let d=wt(f,e,o,n,r,c);d!==null&&d.forEach(a=>{a!==null&&i.push(a)})}};n===void 0||r===void 0?t.toArray().forEach(l):ce(t,new le(r.ds,n.sv)).forEach(l);try{let f=t.getAttributes(n);n!==void 0&&(R(t._item,n)?R(t._item,r)||(f.ychange=c?c("added",t._item.id):{type:"added"}):f.ychange=c?c("removed",t._item.id):{type:"removed"});let s=e.node(t.nodeName,f,i);return o.mapping.set(t,s),s}catch{return t.doc.transact(s=>{t._item.delete(s)},h),o.mapping.delete(t),null}},wt=(t,e,o,n,r,c)=>{let i=[],l=t.toDelta(n,r,c);try{for(let f=0;f<l.length;f++){let s=l[f];i.push(e.text(s.insert,Ot(s.attributes,e)))}}catch{return t.doc.transact(s=>{t._item.delete(s)},h),null}return i},Pt=(t,e)=>{let o=new g,n=t.map(r=>({insert:r.text,attributes:$e(r.marks,e)}));return o.applyDelta(n),e.mapping.set(o,t),o},Yt=(t,e)=>{let o=new p(t.type.name);for(let n in t.attrs){let r=t.attrs[n];r!==null&&n!=="ychange"&&o.setAttribute(n,r)}return o.insert(0,G(t).map(n=>ue(n,e))),e.mapping.set(o,t),o},ue=(t,e)=>t instanceof Array?Pt(t,e):Yt(t,e),Ke=t=>typeof t=="object"&&t!==null,pe=(t,e)=>{let o=Object.keys(t).filter(r=>t[r]!==null),n=o.length===(e==null?0:Object.keys(e).filter(r=>e[r]!==null).length);for(let r=0;r<o.length&&n;r++){let c=o[r],i=t[c],l=e[c];n=c==="ychange"||i===l||Ke(i)&&Ke(l)&&pe(i,l)}return n},G=t=>{let e=t.content.content,o=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.isText){let c=[];for(let i=e[n];n<e.length&&i.isText;i=e[++n])c.push(i);n--,o.push(c)}else o.push(r)}return o},qe=(t,e)=>{let o=t.toDelta();return o.length===e.length&&o.every((n,r)=>n.insert===e[r].text&&Te(n.attributes||{}).length===e[r].marks.length&&we(n.attributes,(c,i)=>{let l=fe(i),f=e[r].marks;return pe(c,f.find(s=>s.type.name===l)?.attrs)}))},E=(t,e)=>{if(t instanceof p&&!(e instanceof Array)&&he(t,e)){let o=G(e);return t._length===o.length&&pe(t.getAttributes(),e.attrs)&&t.toArray().every((n,r)=>E(n,o[r]))}return t instanceof g&&e instanceof Array&&qe(t,e)},Z=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((o,n)=>e[n]===o),We=(t,e,o)=>{let n=t.toArray(),r=G(e),c=r.length,i=n.length,l=_(i,c),f=0,s=0,d=!1;for(;f<l;f++){let a=n[f],m=r[f];if(Z(o.mapping.get(a),m))d=!0;else if(!E(a,m))break}for(;f+s<l;s++){let a=n[i-s-1],m=r[c-s-1];if(Z(o.mapping.get(a),m))d=!0;else if(!E(a,m))break}return{equalityFactor:f+s,foundMappedChild:d}},At=t=>{let e="",o=t._start,n={};for(;o!==null;)o.deleted||(o.countable&&o.content instanceof Ee?e+=o.content.str:o.content instanceof Fe&&(n[o.content.key]=null)),o=o.right;return{str:e,nAttrs:n}},Ct=(t,e,o)=>{o.mapping.set(t,e);let{nAttrs:n,str:r}=At(t),c=e.map(s=>({insert:s.text,attributes:Object.assign({},n,$e(s.marks,o))})),{insert:i,remove:l,index:f}=Xe(r,c.map(s=>s.insert).join(""));t.delete(f,l),t.insert(f,i),t.applyDelta(c.map(s=>({retain:s.insert.length,attributes:s.attributes})))},Mt=/(.*)(--[a-zA-Z0-9+/=]{8})$/,fe=t=>Mt.exec(t)?.[1]??t,Ot=(t,e)=>{let o=[];for(let n in t)o.push(e.mark(fe(n),t[n]));return o},$e=(t,e)=>{let o={};return t.forEach(n=>{if(n.type.name!=="ychange"){let r=I(e.isOMark,n.type,()=>!n.type.excludes(n.type));o[r?`${n.type.name}--${Le(n.toJSON())}`:n.type.name]=n.attrs}}),o},M=(t,e,o,n)=>{if(e instanceof p&&e.nodeName!==o.type.name)throw new Error("node name mismatch!");if(n.mapping.set(e,o),e instanceof p){let a=e.getAttributes(),m=o.attrs;for(let u in m)m[u]!==null?a[u]!==m[u]&&u!=="ychange"&&e.setAttribute(u,m[u]):e.removeAttribute(u);for(let u in a)m[u]===void 0&&e.removeAttribute(u)}let r=G(o),c=r.length,i=e.toArray(),l=i.length,f=_(c,l),s=0,d=0;for(;s<f;s++){let a=i[s],m=r[s];if(!Z(n.mapping.get(a),m))if(E(a,m))n.mapping.set(a,m);else break}for(;d+s<f;d++){let a=i[l-d-1],m=r[c-d-1];if(!Z(n.mapping.get(a),m))if(E(a,m))n.mapping.set(a,m);else break}t.transact(()=>{for(;l-s-d>0&&c-s-d>0;){let m=i[s],u=r[s],w=i[l-d-1],O=r[c-d-1];if(m instanceof g&&u instanceof Array)qe(m,u)||Ct(m,u,n),s+=1;else{let D=m instanceof p&&he(m,u),U=w instanceof p&&he(w,O);if(D&&U){let Q=We(m,u,n),ee=We(w,O,n);Q.foundMappedChild&&!ee.foundMappedChild?U=!1:!Q.foundMappedChild&&ee.foundMappedChild||Q.equalityFactor<ee.equalityFactor?D=!1:U=!1}D?(M(t,m,u,n),s+=1):U?(M(t,w,O,n),d+=1):(n.mapping.delete(e.get(s)),e.delete(s,1),e.insert(s,[ue(u,n)]),s+=1)}}let a=l-s-d;if(l===1&&c===0&&i[0]instanceof g?(n.mapping.delete(i[0]),i[0].delete(0,i[0].length)):a>0&&(e.slice(s,s+a).forEach(m=>n.mapping.delete(m)),e.delete(s,a)),s+d<c){let m=[];for(let u=s;u<c-d;u++)m.push(ue(r[u],n));e.insert(s,m)}},h)},he=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;var Nt=(t,e,o)=>t!==e,kt=t=>{let e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);let o=document.createElement("div");o.setAttribute("style",`background-color: ${t.color}`),o.insertBefore(document.createTextNode(t.name),null);let n=document.createTextNode("\u2060"),r=document.createTextNode("\u2060");return e.insertBefore(n,null),e.insertBefore(o,null),e.insertBefore(r,null),e},vt=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),Vt=/^#[0-9a-fA-F]{6}$/,Ze=(t,e,o,n,r)=>{let c=h.getState(t),i=c.doc,l=[];return c.snapshot!=null||c.prevSnapshot!=null||c.binding.mapping.size===0?oe.create(t.doc,[]):(e.getStates().forEach((f,s)=>{if(o(i.clientID,s,f)&&f.cursor!=null){let d=f.user||{};d.color==null?d.color="#ffa500":Vt.test(d.color)||console.warn("A user uses an unsupported color format",d),d.name==null&&(d.name=`User: ${s}`);let a=b(i,c.type,A(f.cursor.anchor),c.binding.mapping),m=b(i,c.type,A(f.cursor.head),c.binding.mapping);if(a!==null&&m!==null){let u=Y(t.doc.content.size-1,0);a=_(a,u),m=_(m,u),l.push(ne.widget(m,()=>n(d,s),{key:s+"",side:10}));let w=_(a,m),O=Y(a,m);l.push(ne.inline(w,O,r(d,s),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),oe.create(t.doc,l))},hn=(t,{awarenessStateFilter:e=Nt,cursorBuilder:o=kt,selectionBuilder:n=vt,getSelection:r=i=>i.selection}={},c="cursor")=>new P({key:v,state:{init(i,l){return Ze(l,t,e,o,n)},apply(i,l,f,s){let d=h.getState(s),a=i.getMeta(v);return d&&d.isChangeOrigin||a&&a.awarenessUpdated?Ze(s,t,e,o,n):l.map(i.mapping,i.doc)}},props:{decorations:i=>v.getState(i)},view:i=>{let l=()=>{i.docView&&de(i,v,{awarenessUpdated:!0})},f=()=>{let s=h.getState(i.state),d=t.getLocalState()||{};if(i.hasFocus()){let a=r(i.state),m=T(a.anchor,s.type,s.binding.mapping),u=T(a.head,s.type,s.binding.mapping);(d.cursor==null||!se(A(d.cursor.anchor),m)||!se(A(d.cursor.head),u))&&t.setLocalStateField(c,{anchor:m,head:u})}else d.cursor!=null&&b(s.doc,s.type,A(d.cursor.anchor),s.binding.mapping)!==null&&t.setLocalStateField(c,null)};return t.on("change",l),i.dom.addEventListener("focusin",f),i.dom.addEventListener("focusout",f),{update:f,destroy:()=>{i.dom.removeEventListener("focusin",f),i.dom.removeEventListener("focusout",f),t.off("change",l),t.setLocalStateField(c,null)}}}});var Rt=t=>y.getState(t)?.undoManager?.undo()!=null,Ft=t=>y.getState(t)?.undoManager?.redo()!=null,bn=(t,e)=>e==null?y.getState(t)?.undoManager?.canUndo():Rt(t),Sn=(t,e)=>e==null?y.getState(t)?.undoManager?.canRedo():Ft(t),Et=new Set(["paragraph"]),Dt=(t,e)=>!(t instanceof q)||!(t.content instanceof De)||!(t.content.type instanceof B||t.content.type instanceof p&&e.has(t.content.type.nodeName))||t.content.type._length===0,Tn=({protectedNodes:t=Et,trackedOrigins:e=[],undoManager:o=null}={})=>new P({key:y,state:{init:(n,r)=>{let c=h.getState(r),i=o||new W(c.type,{trackedOrigins:new Set([h].concat(e)),deleteFilter:l=>Dt(l,t),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:i,prevSel:null,hasUndoOps:i.undoStack.length>0,hasRedoOps:i.redoStack.length>0}},apply:(n,r,c,i)=>{let l=h.getState(i).binding,f=r.undoManager,s=f.undoStack.length>0,d=f.redoStack.length>0;return l?{undoManager:f,prevSel:F(l,c),hasUndoOps:s,hasRedoOps:d}:s!==r.hasUndoOps||d!==r.hasRedoOps?Object.assign({},r,{hasUndoOps:f.undoStack.length>0,hasRedoOps:f.redoStack.length>0}):r}},view:n=>{let r=h.getState(n.state),c=y.getState(n.state).undoManager;return c.on("stack-item-added",({stackItem:i})=>{let l=r.binding;l&&i.meta.set(l,y.getState(n.state).prevSel)}),c.on("stack-item-popped",({stackItem:i})=>{let l=r.binding;l&&(l.beforeTransactionSelection=i.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{c.destroy()}}}});export{h as a,y as b,v as c,St as d,st as e,lt as f,Je as g,hn as h,Rt as i,Ft as j,bn as k,Sn as l,Tn as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=Math.min,T=Math.max,G=Math.round,J=Math.floor,L=t=>({x:t,y:t}),Yt={left:"right",right:"left",bottom:"top",top:"bottom"};function At(t,e,n){return T(t,I(e,n))}function Q(t,e){return typeof t=="function"?t(e):t}function B(t){return t.split("-")[0]}function Z(t){return t.split("-")[1]}function ut(t){return t==="x"?"y":"x"}function dt(t){return t==="y"?"height":"width"}function D(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function mt(t){return ut(D(t))}function Ot(t,e,n){n===void 0&&(n=!1);let o=Z(t),i=mt(t),s=dt(i),r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(r=U(r)),[r,U(r)]}function Rt(t){let e=U(t);return[it(t),e,it(e)]}function it(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var vt=["left","right"],bt=["right","left"],Kt=["top","bottom"],qt=["bottom","top"];function Ut(t,e,n){switch(t){case"top":case"bottom":return n?e?bt:vt:e?vt:bt;case"left":case"right":return e?Kt:qt;default:return[]}}function Ct(t,e,n,o){let i=Z(t),s=Ut(B(t),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),e&&(s=s.concat(s.map(it)))),s}function U(t){let e=B(t);return Yt[e]+t.slice(e.length)}function Gt(t){var e,n,o,i;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(i=t.left)!=null?i:0}}function St(t){return typeof t!="number"?Gt(t):{top:t,right:t,bottom:t,left:t}}function _(t){let{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Pt(t,e,n){let{reference:o,floating:i}=t,s=D(e),r=mt(e),c=dt(r),l=B(e),f=s==="y",d=o.x+o.width/2-i.width/2,a=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2,u;switch(l){case"top":u={x:d,y:o.y-i.height};break;case"bottom":u={x:d,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:a};break;case"left":u={x:o.x-i.width,y:a};break;default:u={x:o.x,y:o.y}}let g=Z(e);return g&&(u[r]+=m*(g==="end"?1:-1)*(n&&f?-1:1)),u}async function Lt(t,e){var n;e===void 0&&(e={});let{x:o,y:i,platform:s,rects:r,elements:c,strategy:l}=t,{boundary:f="clippingAncestors",rootBoundary:d="viewport",elementContext:a="floating",altBoundary:m=!1,padding:u=0}=Q(e,t),g=St(u),w=c[m?a==="floating"?"reference":"floating":a],h=_(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:d,strategy:l})),x=a==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),v=await(s.isElement==null?void 0:s.isElement(y))&&await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1},S=_(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:y,strategy:l}):x);return{top:(h.top-S.top+g.top)/v.y,bottom:(S.bottom-h.bottom+g.bottom)/v.y,left:(h.left-S.left+g.left)/v.x,right:(S.right-h.right+g.right)/v.x}}var Jt=50,Et=async(t,e,n)=>{let{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,c=r.detectOverflow?r:{...r,detectOverflow:Lt},l=await(r.isRTL==null?void 0:r.isRTL(e)),f=await r.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:a}=Pt(f,o,l),m=o,u=0,g={};for(let p=0;p<s.length;p++){let w=s[p];if(!w)continue;let{name:h,fn:x}=w,{x:y,y:v,data:S,reset:A}=await x({x:d,y:a,initialPlacement:o,placement:m,strategy:i,middlewareData:g,rects:f,platform:c,elements:{reference:t,floating:e}});d=y??d,a=v??a,g[h]={...g[h],...S},A&&u<Jt&&(u++,typeof A=="object"&&(A.placement&&(m=A.placement),A.rects&&(f=A.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:d,y:a}=Pt(f,m,l)),p=-1)}return{x:d,y:a,placement:m,strategy:i,middlewareData:g}};var Tt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;let{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:f}=e,{mainAxis:d=!0,crossAxis:a=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...w}=Q(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let h=B(i),x=D(c),y=B(c)===c,v=await(l.isRTL==null?void 0:l.isRTL(f.floating)),S=m||(y||!p?[U(c)]:Rt(c)),A=g!=="none";!m&&A&&S.push(...Ct(c,p,g,v));let ot=[c,...S],X=await l.detectOverflow(e,w),$=[],P=((o=s.flip)==null?void 0:o.overflows)||[];if(d&&$.push(X[h]),a){let N=Ot(i,r,v);$.push(X[N[0]],X[N[1]])}if(P=[...P,{placement:i,overflows:$}],!$.every(N=>N<=0)){var wt,xt;let N=(((wt=s.flip)==null?void 0:wt.index)||0)+1,at=ot[N];if(at&&(!(a==="alignment"?x!==D(at):!1)||P.every(O=>D(O.placement)===x?O.overflows[0]>0:!0)))return{data:{index:N,overflows:P},reset:{placement:at}};let q=(xt=P.filter(k=>k.overflows[0]<=0).sort((k,O)=>k.overflows[1]-O.overflows[1])[0])==null?void 0:xt.placement;if(!q)switch(u){case"bestFit":{var yt;let k=(yt=P.filter(O=>{if(A){let M=D(O.placement);return M===x||M==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(M=>M>0).reduce((M,jt)=>M+jt,0)]).sort((O,M)=>O[1]-M[1])[0])==null?void 0:yt[0];k&&(q=k);break}case"initialPlacement":q=c;break}if(i!==q)return{reset:{placement:q}}}return{}}}};var Qt=new Set(["left","top"]);async function Zt(t,e){let{placement:n,platform:o,elements:i}=t,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=B(n),c=Z(n),l=D(n)==="y",f=Qt.has(r)?-1:1,d=s&&l?-1:1,a=Q(e,t),{mainAxis:m,crossAxis:u,alignmentAxis:g}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof g=="number"&&(u=c==="end"?g*-1:g),l?{x:u*d,y:m*f}:{x:m*f,y:u*d}}var Dt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;let{x:i,y:s,placement:r,middlewareData:c}=e,l=await Zt(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},Ft=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:o,placement:i,platform:s}=e,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:x=>{let{x:y,y:v}=x;return{x:y,y:v}}},...f}=Q(t,e),d={x:n,y:o},a=await s.detectOverflow(e,f),m=D(i),u=ut(m),g=d[u],p=d[m],w=(x,y)=>At(y+a[x==="y"?"top":"left"],y,y-a[x==="y"?"bottom":"right"]);r&&(g=w(u,g)),c&&(p=w(m,p));let h=l.fn({...e,[u]:g,[m]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[u]:r,[m]:c}}}}}};function st(){return typeof window<"u"}function V(t){return Wt(t)?(t.nodeName||"").toLowerCase():"#document"}function b(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function E(t){var e;return(e=(Wt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Wt(t){return st()?t instanceof Node||t instanceof b(t).Node:!1}function R(t){return st()?t instanceof Element||t instanceof b(t).Element:!1}function F(t){return st()?t instanceof HTMLElement||t instanceof b(t).HTMLElement:!1}function Mt(t){return!st()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof b(t).ShadowRoot}function tt(t){let{overflow:e,overflowX:n,overflowY:o,display:i}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&i!=="inline"&&i!=="contents"}function $t(t){return/^(table|td|th)$/.test(V(t))}function et(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var te=/transform|translate|scale|rotate|perspective|filter/,ee=/paint|layout|strict|content/,H=t=>!!t&&t!=="none",gt;function rt(t){let e=R(t)?C(t):t;return H(e.transform)||H(e.translate)||H(e.scale)||H(e.rotate)||H(e.perspective)||!ct()&&(H(e.backdropFilter)||H(e.filter))||te.test(e.willChange||"")||ee.test(e.contain||"")}function Nt(t){let e=W(t);for(;F(e)&&!Y(e);){if(rt(e))return e;if(et(e))return null;e=W(e)}return null}function ct(){return gt==null&&(gt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gt}function Y(t){return/^(html|body|#document)$/.test(V(t))}function C(t){return b(t).getComputedStyle(t)}function nt(t){return R(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(V(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Mt(t)&&t.host||E(t);return Mt(e)?e.host:e}function kt(t){let e=W(t);return Y(e)?(t.ownerDocument||t).body:F(e)&&tt(e)?e:kt(e)}function j(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=kt(t),s=i===((o=t.ownerDocument)==null?void 0:o.body),r=b(i);if(s){let c=lt(r);return e.concat(r,r.visualViewport||[],tt(i)?i:[],c&&n?j(c):[])}else return e.concat(i,j(i,[],n))}function lt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ht(t){let e=C(t),n=parseFloat(e.width)||0,o=parseFloat(e.height)||0,i=F(t),s=i?t.offsetWidth:n,r=i?t.offsetHeight:o,c=G(n)!==s||G(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function pt(t){return R(t)?t:t.contextElement}function K(t){let e=pt(t);if(!F(e))return L(1);let n=e.getBoundingClientRect(),{width:o,height:i,$:s}=Ht(e),r=(s?G(n.width):n.width)/o,c=(s?G(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}var ne=L(0);function Vt(t){let e=b(t);return!ct()||!e.visualViewport?ne:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function oe(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===b(t)}function z(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),s=pt(t),r=L(1);e&&(o?R(o)&&(r=K(o)):r=K(t));let c=oe(s,n,o)?Vt(s):L(0),l=(i.left+c.x)/r.x,f=(i.top+c.y)/r.y,d=i.width/r.x,a=i.height/r.y;if(s&&o){let m=b(s),u=R(o)?b(o):o,g=m,p=lt(g);for(;p&&u!==g;){let w=K(p),h=p.getBoundingClientRect(),x=C(p),y=h.left+(p.clientLeft+parseFloat(x.paddingLeft))*w.x,v=h.top+(p.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,f*=w.y,d*=w.x,a*=w.y,l+=y,f+=v,g=b(p),p=lt(g)}}return _({width:d,height:a,x:l,y:f})}function ft(t,e){let n=nt(t).scrollLeft;return e?e.left+n:z(E(t)).left+n}function zt(t,e){let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-ft(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function ie(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t,s=i==="fixed",r=E(o),c=e?et(e.floating):!1;if(o===r||c&&s)return n;let l={scrollLeft:0,scrollTop:0},f=L(1),d=L(0),a=F(o);if((a||!s)&&((V(o)!=="body"||tt(r))&&(l=nt(o)),a)){let u=z(o);f=K(o),d.x=u.x+o.clientLeft,d.y=u.y+o.clientTop}let m=r&&!a&&!s?zt(r,l):L(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-l.scrollLeft*f.x+d.x+m.x,y:n.y*f.y-l.scrollTop*f.y+d.y+m.y}}function se(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function re(t){let e=nt(t),n=t.ownerDocument.body,o=T(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=T(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),s=-e.scrollLeft+ft(t),r=-e.scrollTop;return C(n).direction==="rtl"&&(s+=T(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:s,y:r}}var ce=25;function le(t,e,n){n===void 0&&(n="viewport");let o=n==="layoutViewport",i=b(t),s=E(t),r=i.visualViewport,c=s.clientWidth,l=s.clientHeight,f=0,d=0;if(r){let m=!ct()||e==="fixed";o?m||(f=-r.offsetLeft,d=-r.offsetTop):(c=r.width,l=r.height,m&&(f=r.offsetLeft,d=r.offsetTop))}if(ft(s)<=0){let m=s.ownerDocument,u=m.body,g=getComputedStyle(u),p=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,w=Math.abs(s.clientWidth-u.clientWidth-p),h=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;h<=ce&&(c-=h)}return{width:c,height:l,x:f,y:d}}function fe(t,e){let n=z(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,s=K(t),r=t.clientWidth*s.x,c=t.clientHeight*s.y,l=i*s.x,f=o*s.y;return{width:r,height:c,x:l,y:f}}function Bt(t,e,n){let o;if(e==="viewport"||e==="layoutViewport")o=le(t,n,e);else if(e==="document")o=re(E(t));else if(R(e))o=fe(e,n);else{let i=Vt(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return _(o)}function ae(t,e){let n=e.get(t);if(n)return n;let o=j(t,[],!1).filter(c=>R(c)&&V(c)!=="body"),i=null,s=C(t).position==="fixed",r=s?W(t):t;for(;R(r)&&!Y(r);){let c=C(r),l=rt(r),f=i?i.position:s?"fixed":"";!l&&(f==="fixed"||f==="absolute"&&c.position==="static")?o=o.filter(a=>a!==r):i=c,r=W(r)}return e.set(t,o),o}function ue(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t,r=[...n==="clippingAncestors"?et(e)?[]:ae(e,this._c):[].concat(n),o],c=Bt(e,r[0],i),l=c.top,f=c.right,d=c.bottom,a=c.left;for(let m=1;m<r.length;m++){let u=Bt(e,r[m],i);l=T(u.top,l),f=I(u.right,f),d=I(u.bottom,d),a=T(u.left,a)}return{width:f-a,height:d-l,x:a,y:l}}function de(t){let{width:e,height:n}=Ht(t);return{width:e,height:n}}function me(t,e,n){let o=F(e),i=E(e),s=n==="fixed",r=z(t,!0,s,e),c={scrollLeft:0,scrollTop:0},l=L(0);if((o||!s)&&((V(e)!=="body"||tt(i))&&(c=nt(e)),o)){let m=z(e,!0,s,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}!o&&i&&(l.x=ft(i));let f=i&&!o&&!s?zt(i,c):L(0),d=r.left+c.scrollLeft-l.x-f.x,a=r.top+c.scrollTop-l.y-f.y;return{x:d,y:a,width:r.width,height:r.height}}function ht(t){return C(t).position==="static"}function _t(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return E(t)===n&&(n=n.ownerDocument.body),n}function Xt(t,e){let n=b(t);if(et(t))return n;if(!F(t)){let i=W(t);for(;i&&!Y(i);){if(R(i)&&!ht(i))return i;i=W(i)}return n}let o=_t(t,e);for(;o&&$t(o)&&ht(o);)o=_t(o,e);return o&&Y(o)&&ht(o)&&!rt(o)?n:o||Nt(t)||n}var ge=async function(t){let e=this.getOffsetParent||Xt,n=this.getDimensions,o=await n(t.floating);return{reference:me(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function he(t){return C(t).direction==="rtl"}var pe={convertOffsetParentRelativeRectToViewportRelativeRect:ie,getDocumentElement:E,getClippingRect:ue,getOffsetParent:Xt,getElementRects:ge,getClientRects:se,getDimensions:de,getScale:K,isElement:R,isRTL:he};function It(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function we(t,e,n){let o=null,i,s=E(t);function r(){var d;clearTimeout(i),(d=o)==null||d.disconnect(),o=null}function c(d,a){d===void 0&&(d=!1),a===void 0&&(a=1),r();let m=t.getBoundingClientRect(),{left:u,top:g,width:p,height:w}=m;if(d||e(),!p||!w)return;let h=J(g),x=J(s.clientWidth-(u+p)),y=J(s.clientHeight-(g+w)),v=J(u),A={rootMargin:-h+"px "+-x+"px "+-y+"px "+-v+"px",threshold:T(0,I(1,a))||1},ot=!0;function X($){let P=$[0].intersectionRatio;if(!It(m,t.getBoundingClientRect()))return c();if(P!==a){if(!ot)return c();P?c(!1,P):i=setTimeout(()=>{c(!1,1e-7)},1e3)}ot=!1}try{o=new IntersectionObserver(X,{...A,root:s.ownerDocument})}catch{o=new IntersectionObserver(X,A)}o.observe(t)}let l=b(t),f=()=>c(n);return l.addEventListener("resize",f),c(!0),()=>{l.removeEventListener("resize",f),r()}}function We(t,e,n,o){o===void 0&&(o={});let{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,f=pt(t),d=i||s?[...f?j(f):[],...e?j(e):[]]:[];d.forEach(h=>{i&&h.addEventListener("scroll",n),s&&h.addEventListener("resize",n)});let a=f&&c?we(f,n,s):null,m=-1,u=null;r&&(u=new ResizeObserver(h=>{let[x]=h;x&&x.target===f&&u&&e&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=u)==null||y.observe(e)})),n()}),f&&!l&&u.observe(f),e&&u.observe(e));let g,p=l?z(t):null;l&&w();function w(){let h=z(t);p&&!It(p,h)&&n(),p=h,g=requestAnimationFrame(w)}return n(),()=>{var h;d.forEach(x=>{i&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),a?.(),(h=u)==null||h.disconnect(),u=null,l&&cancelAnimationFrame(g)}}var $e=Dt;var Ne=Ft,ke=Tt;var Be=(t,e,n)=>{let o=new Map,i=n??{},s={...pe,...i.platform,_c:o};return Et(t,e,{...i,platform:s})};export{We as a,$e as b,Ne as c,ke as d,Be as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function K(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var p=K;var _=typeof global=="object"&&global&&global.Object===Object&&global,w=_;var $=typeof self=="object"&&self&&self.Object===Object&&self,V=w||$||Function("return this")(),y=V;var X=function(){return y.Date.now()},b=X;var H=/\s/;function J(e){for(var t=e.length;t--&&H.test(e.charAt(t)););return t}var E=J;var Q=/^\s+/;function Y(e){return e&&e.slice(0,E(e)+1).replace(Q,"")}var R=Y;var Z=y.Symbol,m=Z;var A=Object.prototype,ee=A.hasOwnProperty,te=A.toString,g=m?m.toStringTag:void 0;function re(e){var t=ee.call(e,g),a=e[g];try{e[g]=void 0;var o=!0}catch{}var s=te.call(e);return o&&(t?e[g]=a:delete e[g]),s}var L=re;var ae=Object.prototype,oe=ae.toString;function fe(e){return oe.call(e)}var N=fe;var se="[object Null]",le="[object Undefined]",C=m?m.toStringTag:void 0;function ue(e){return e==null?e===void 0?le:se:C&&C in Object(e)?L(e):N(e)}var P=ue;function pe(e){return e!=null&&typeof e=="object"}var M=pe;var de="[object Symbol]";function me(e){return typeof e=="symbol"||M(e)&&P(e)==de}var z=me;var D=NaN,xe=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,ne=/^0o[0-7]+$/i,ce=parseInt;function ge(e){if(typeof e=="number")return e;if(z(e))return D;if(p(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=p(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=R(e);var a=ie.test(e);return a||ne.test(e)?ce(e.slice(2),a?2:8):xe.test(e)?D:+e}var v=ge;var he="Expected a function",ye=Math.max,be=Math.min;function Oe(e,t,a){var o,s,x,d,f,u,i=0,j=!1,n=!1,O=!0;if(typeof e!="function")throw new TypeError(he);t=v(t)||0,p(a)&&(j=!!a.leading,n="maxWait"in a,x=n?ye(v(a.maxWait)||0,t):x,O="trailing"in a?!!a.trailing:O);function I(r){var l=o,c=s;return o=s=void 0,i=r,d=e.apply(c,l),d}function F(r){return i=r,f=setTimeout(h,t),j?I(r):d}function q(r){var l=r-u,c=r-i,B=t-l;return n?be(B,x-c):B}function W(r){var l=r-u,c=r-i;return u===void 0||l>=t||l<0||n&&c>=x}function h(){var r=b();if(W(r))return k(r);f=setTimeout(h,q(r))}function k(r){return f=void 0,O&&o?I(r):(o=s=void 0,d)}function U(){f!==void 0&&clearTimeout(f),i=0,o=u=s=f=void 0}function G(){return f===void 0?d:k(b())}function T(){var r=b(),l=W(r);if(o=arguments,s=this,u=r,l){if(f===void 0)return F(u);if(n)return clearTimeout(f),f=setTimeout(h,t),I(u)}return f===void 0&&(f=setTimeout(h,t)),d}return T.cancel=U,T.flush=G,T}var S=Oe;var Ie="Expected a function";function Te(e,t,a){var o=!0,s=!0;if(typeof e!="function")throw new TypeError(Ie);return p(a)&&(o="leading"in a?!!a.leading:o,s="trailing"in a?!!a.trailing:s),S(e,t,{leading:o,maxWait:t,trailing:s})}var ve=Te;export{S as a,ve as b};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{B as Ki,C as Wi,I as Mn,J as Yi,K as Ji,O as Gi,b as Fn,e as Di,f as Vi,g as qi,n as Hi,p as $i,u as mr,w as Ui,x as Yt,y as Jt,z as Qi}from"./chunk-EAFZBBCI.js";import{b as va,c as Ta,d as Aa,f as g,g as C,h as y}from"./chunk-23NN352E.js";var Ts=va((Dg,vs)=>{"use strict";var er=Object.prototype.hasOwnProperty,Es=Object.prototype.toString,ys=Object.defineProperty,ws=Object.getOwnPropertyDescriptor,bs=function(n){return typeof Array.isArray=="function"?Array.isArray(n):Es.call(n)==="[object Array]"},Ss=function(n){if(!n||Es.call(n)!=="[object Object]")return!1;var t=er.call(n,"constructor"),r=n.constructor&&n.constructor.prototype&&er.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!t&&!r)return!1;var i;for(i in n);return typeof i>"u"||er.call(n,i)},Cs=function(n,t){ys&&t.name==="__proto__"?ys(n,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):n[t.name]=t.newValue},Is=function(n,t){if(t==="__proto__")if(er.call(n,t)){if(ws)return ws(n,t).value}else return;return n[t]};vs.exports=function e(){var n,t,r,i,o,s,a=arguments[0],u=1,l=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<l;++u)if(n=arguments[u],n!=null)for(t in n)r=Is(a,t),i=Is(n,t),a!==i&&(c&&i&&(Ss(i)||(o=bs(i)))?(o?(o=!1,s=r&&bs(r)?r:[]):s=r&&Ss(r)?r:{},Cs(a,{name:t,newValue:e(c,s,i)})):typeof i<"u"&&Cs(a,{name:t,newValue:i}));return a}});var X=(function(e){return e.docTypeError="docTypeError",e.contextNotFound="contextNotFound",e.timerNotFound="timerNotFound",e.ctxCallOutOfScope="ctxCallOutOfScope",e.createNodeInParserFail="createNodeInParserFail",e.stackOverFlow="stackOverFlow",e.parserMatchError="parserMatchError",e.serializerMatchError="serializerMatchError",e.getAtomFromSchemaFail="getAtomFromSchemaFail",e.expectDomTypeError="expectDomTypeError",e.callCommandBeforeEditorView="callCommandBeforeEditorView",e.missingRootElement="missingRootElement",e.missingNodeInSchema="missingNodeInSchema",e.missingMarkInSchema="missingMarkInSchema",e.ctxNotBind="ctxNotBind",e.missingYjsDoc="missingYjsDoc",e.aiProviderError="aiProviderError",e.aiBuildContextError="aiBuildContextError",e})({}),Z=class extends Error{constructor(e,n,t){super(n,t),this.name="MilkdownError",this.code=e,t?.cause!==void 0&&(this.cause=t.cause)}},Pa=(e,n)=>typeof n=="function"?"[Function]":n,On=e=>JSON.stringify(e,Pa);function Xi(e){return new Z(X.docTypeError,`Doc type error, unsupported type: ${On(e)}`)}function Zi(e){return new Z(X.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}function eo(e){return new Z(X.timerNotFound,`Timer "${e}" not found, do you forget to record it?`)}function pt(){return new Z(X.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function to(e,n,t){let r=`Cannot create node for ${"name"in e?e.name:e}`,i=s=>{if(s==null)return"null";if(Array.isArray(s))return`[${s.map(i).join(", ")}]`;if(typeof s=="object")return"toJSON"in s&&typeof s.toJSON=="function"?JSON.stringify(s.toJSON()):"spec"in s?JSON.stringify(s.spec):JSON.stringify(s);if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return JSON.stringify(s);if(typeof s=="function")return`[Function: ${s.name||"anonymous"}]`;try{return String(s)}catch{return"[Unserializable]"}},o=[["[Description]",r],["[Attributes]",n],["[Content]",(t??[]).map(s=>s?typeof s=="object"&&"type"in s?`${s}`:i(s):"null")]].reduce((s,[a,u])=>{let l=`${a}: ${i(u)}.`;return s.concat(l)},[]);return new Z(X.createNodeInParserFail,o.join(`
|
|
2
|
+
`))}function dr(){return new Z(X.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function no(e){return new Z(X.parserMatchError,`Cannot match target parser for node: ${On(e)}.`)}function ro(e){return new Z(X.serializerMatchError,`Cannot match target serializer for node: ${On(e)}.`)}function io(e,n){return new Z(X.getAtomFromSchemaFail,`Cannot get ${e}: ${n} from schema.`)}function za(e){return new Z(X.expectDomTypeError,`Expect to be a dom, but get: ${On(e)}.`)}function Rn(){return new Z(X.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function Ec(e){return new Z(X.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}function vc(e){return new Z(X.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)}function Tc(){return new Z(X.ctxNotBind,"Context not bind, please make sure the plugin has been initialized.")}function Ac(){return new Z(X.missingYjsDoc,"Missing yjs doc, please make sure you have bind one.")}var gr=class{constructor(){this.sliceMap=new Map,this.get=e=>{let n=typeof e=="string"?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!n){let t=typeof e=="string"?e:e.name;throw Zi(t)}return n},this.remove=e=>{let n=typeof e=="string"?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);n&&this.sliceMap.delete(n.type.id)},this.has=e=>typeof e=="string"?[...this.sliceMap.values()].some(n=>n.type.name===e):this.sliceMap.has(e.id)}},xe,Te,mt,oo,_a=(oo=class{constructor(e,n,t){C(this,xe);C(this,Te);C(this,mt);y(this,xe,[]),y(this,mt,()=>{g(this,xe).forEach(r=>r(g(this,Te)))}),this.set=r=>{y(this,Te,r),g(this,mt).call(this)},this.get=()=>g(this,Te),this.update=r=>{y(this,Te,r(g(this,Te))),g(this,mt).call(this)},this.type=t,y(this,Te,n),e.set(t.id,this)}on(e){return g(this,xe).push(e),()=>{y(this,xe,g(this,xe).filter(n=>n!==e))}}once(e){let n=this.on(t=>{e(t),n()});return n}off(e){y(this,xe,g(this,xe).filter(n=>n!==e))}offAll(){y(this,xe,[])}},xe=new WeakMap,Te=new WeakMap,mt=new WeakMap,oo),Fa=class{constructor(e,n){this.id=Symbol(`Context-${n}`),this.name=n,this._defaultValue=e,this._typeInfo=()=>{throw pt()}}create(e,n=this._defaultValue){return new _a(e,n,this)}},O=(e,n)=>new Fa(e,n),Gt,Xt,Zt,We,dt,Re,gt,xt,kt,so,Ma=(so=class{constructor(e,n,t){C(this,Gt);C(this,Xt);C(this,Zt);C(this,We);C(this,dt);C(this,Re);C(this,gt);C(this,xt);C(this,kt);y(this,We,new Set),y(this,dt,new Set),y(this,Re,new Map),y(this,gt,new Map),this.read=()=>({metadata:g(this,Gt),injectedSlices:[...g(this,We)].map(r=>({name:typeof r=="string"?r:r.name,value:g(this,xt).call(this,r)})),consumedSlices:[...g(this,dt)].map(r=>({name:typeof r=="string"?r:r.name,value:g(this,xt).call(this,r)})),recordedTimers:[...g(this,Re)].map(([r,{duration:i}])=>({name:r.name,duration:i,status:g(this,kt).call(this,r)})),waitTimers:[...g(this,gt)].map(([r,{duration:i}])=>({name:r.name,duration:i,status:g(this,kt).call(this,r)}))}),this.onRecord=r=>{g(this,Re).set(r,{start:Date.now(),duration:0})},this.onClear=r=>{g(this,Re).delete(r)},this.onDone=r=>{let i=g(this,Re).get(r);i&&(i.duration=Date.now()-i.start)},this.onWait=(r,i)=>{let o=Date.now();i.finally(()=>{g(this,gt).set(r,{duration:Date.now()-o})}).catch(console.error)},this.onInject=r=>{g(this,We).add(r)},this.onRemove=r=>{g(this,We).delete(r)},this.onUse=r=>{g(this,dt).add(r)},y(this,xt,r=>g(this,Xt).get(r).get()),y(this,kt,r=>g(this,Zt).get(r).status),y(this,Xt,e),y(this,Zt,n),y(this,Gt,t)}},Gt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,We=new WeakMap,dt=new WeakMap,Re=new WeakMap,gt=new WeakMap,xt=new WeakMap,kt=new WeakMap,so),Ae,Pe,en,he,yt,uo=(yt=class{constructor(n,t,r){C(this,Ae);C(this,Pe);C(this,en);C(this,he);this.produce=i=>i&&Object.keys(i).length?new yt(g(this,Ae),g(this,Pe),{...i}):this,this.inject=(i,o)=>{let s=i.create(g(this,Ae).sliceMap);return o!=null&&s.set(o),g(this,he)?.onInject(i),this},this.remove=i=>(g(this,Ae).remove(i),g(this,he)?.onRemove(i),this),this.record=i=>(i.create(g(this,Pe).store),g(this,he)?.onRecord(i),this),this.clearTimer=i=>(g(this,Pe).remove(i),g(this,he)?.onClear(i),this),this.isInjected=i=>g(this,Ae).has(i),this.isRecorded=i=>g(this,Pe).has(i),this.use=i=>(g(this,he)?.onUse(i),g(this,Ae).get(i)),this.get=i=>this.use(i).get(),this.set=(i,o)=>this.use(i).set(o),this.update=(i,o)=>this.use(i).update(o),this.timer=i=>g(this,Pe).get(i),this.done=i=>{this.timer(i).done(),g(this,he)?.onDone(i)},this.wait=i=>{let o=this.timer(i).start();return g(this,he)?.onWait(i,o),o},this.waitTimers=async i=>{await Promise.all(this.get(i).map(o=>this.wait(o)))},y(this,Ae,n),y(this,Pe,t),y(this,en,r),r&&y(this,he,new Ma(n,t,r))}get meta(){return g(this,en)}get inspector(){return g(this,he)}},Ae=new WeakMap,Pe=new WeakMap,en=new WeakMap,he=new WeakMap,yt),lo=class{constructor(){this.store=new Map,this.get=e=>{let n=this.store.get(e.id);if(!n)throw eo(e.name);return n},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},wt,Le,bt,ze,St,tn,ao,Oa=(ao=class{constructor(e,n){C(this,wt);C(this,Le);C(this,bt);C(this,ze);C(this,St);C(this,tn);y(this,wt,null),y(this,Le,null),y(this,ze,"pending"),this.start=()=>(g(this,wt)??y(this,wt,new Promise((t,r)=>{y(this,Le,i=>{i instanceof CustomEvent&&i.detail.id===g(this,bt)&&(y(this,ze,"resolved"),g(this,St).call(this),i.stopImmediatePropagation(),t())}),g(this,tn).call(this,()=>{g(this,ze)==="pending"&&y(this,ze,"rejected"),g(this,St).call(this),r(new Error(`Timing ${this.type.name} timeout.`))}),y(this,ze,"pending"),addEventListener(this.type.name,g(this,Le))})),g(this,wt)),this.done=()=>{let t=new CustomEvent(this.type.name,{detail:{id:g(this,bt)}});dispatchEvent(t)},y(this,St,()=>{g(this,Le)&&removeEventListener(this.type.name,g(this,Le))}),y(this,tn,t=>{setTimeout(()=>{t()},this.type.timeout)}),y(this,bt,Symbol(n.name)),this.type=n,e.set(n.id,this)}get status(){return g(this,ze)}},wt=new WeakMap,Le=new WeakMap,bt=new WeakMap,ze=new WeakMap,St=new WeakMap,tn=new WeakMap,ao),Ra=class{constructor(e,n=3e3){this.create=t=>new Oa(t,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=n}},ke=(e,n=3e3)=>new Ra(e,n);var La={};function Ye(e,n){let t=n||La,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return fo(e,r,i)}function fo(e,n,t){if(Ba(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return co(e.children,n,t)}return Array.isArray(e)?co(e,n,t):""}function co(e,n,t){let r=[],i=-1;for(;++i<e.length;)r[i]=fo(e[i],n,t);return r.join("")}function Ba(e){return!!(e&&typeof e=="object")}var ho=document.createElement("i");function Ct(e){let n="&"+e+";";ho.innerHTML=n;let t=ho.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function J(e,n,t,r){let i=e.length,o=0,s;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)s=Array.from(r),s.unshift(n,t),e.splice(...s);else for(t&&e.splice(n,t);o<r.length;)s=r.slice(o,o+1e4),s.unshift(n,0),e.splice(...s),o+=1e4,n+=1e4}function ee(e,n){return e.length>0?(J(e,e.length,0,n),e):n}var po={}.hasOwnProperty;function mo(e){let n={},t=-1;for(;++t<e.length;)Na(n,e[t]);return n}function Na(e,n){let t;for(t in n){let i=(po.call(e,t)?e[t]:void 0)||(e[t]={}),o=n[t],s;if(o)for(s in o){po.call(i,s)||(i[s]=[]);let a=o[s];ja(i[s],Array.isArray(a)?a:a?[a]:[])}}}function ja(e,n){let t=-1,r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);J(e,0,0,r)}function Ln(e,n){let t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function _e(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var ae=Be(/[A-Za-z]/),te=Be(/[\dA-Za-z]/),go=Be(/[#-'*+\--9=?A-Z^-~]/);function nn(e){return e!==null&&(e<32||e===127)}var rn=Be(/\d/),xo=Be(/[\dA-Fa-f]/),ko=Be(/[!-/:-@[-`{-~]/);function S(e){return e!==null&&e<-2}function Q(e){return e!==null&&(e<0||e===32)}function A(e){return e===-2||e===-1||e===32}var yo=Be(/\p{P}|\p{S}/u),wo=Be(/\s/);function Be(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function z(e,n,t,r){let i=r?r-1:Number.POSITIVE_INFINITY,o=0;return s;function s(u){return A(u)?(e.enter(t),a(u)):n(u)}function a(u){return A(u)&&o++<i?(e.consume(u),a):(e.exit(t),n(u))}}var bo={tokenize:Da};function Da(e){let n=e.attempt(this.parser.constructs.contentInitial,r,i),t;return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),z(e,n,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){let u=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=u),t=u,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return S(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}var Co={tokenize:Va},So={tokenize:qa};function Va(e){let n=this,t=[],r=0,i,o,s;return a;function a(E){if(r<t.length){let L=t[r];return n.containerState=L[1],e.attempt(L[0].continuation,u,l)(E)}return l(E)}function u(E){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&q();let L=n.events.length,N=L,k;for(;N--;)if(n.events[N][0]==="exit"&&n.events[N][1].type==="chunkFlow"){k=n.events[N][1].end;break}w(r);let j=L;for(;j<n.events.length;)n.events[j][1].end={...k},j++;return J(n.events,N+1,0,n.events.slice(L)),n.events.length=j,l(E)}return a(E)}function l(E){if(r===t.length){if(!i)return p(E);if(i.currentConstruct&&i.currentConstruct.concrete)return I(E);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(So,c,h)(E)}function c(E){return i&&q(),w(r),p(E)}function h(E){return n.parser.lazy[n.now().line]=r!==t.length,s=n.now().offset,I(E)}function p(E){return n.containerState={},e.attempt(So,f,I)(E)}function f(E){return r++,t.push([n.currentConstruct,n.containerState]),p(E)}function I(E){if(E===null){i&&q(),w(0),e.consume(E);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),v(E)}function v(E){if(E===null){R(e.exit("chunkFlow"),!0),w(0),e.consume(E);return}return S(E)?(e.consume(E),R(e.exit("chunkFlow")),r=0,n.interrupt=void 0,a):(e.consume(E),v)}function R(E,L){let N=n.sliceStream(E);if(L&&N.push(null),E.previous=o,o&&(o.next=E),o=E,i.defineSkip(E.start),i.write(N),n.parser.lazy[E.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<s&&(!i.events[k][1].end||i.events[k][1].end.offset>s))return;let j=n.events.length,$=j,B,H;for(;$--;)if(n.events[$][0]==="exit"&&n.events[$][1].type==="chunkFlow"){if(B){H=n.events[$][1].end;break}B=!0}for(w(r),k=j;k<n.events.length;)n.events[k][1].end={...H},k++;J(n.events,$+1,0,n.events.slice(j)),n.events.length=k}}function w(E){let L=t.length;for(;L-- >E;){let N=t[L];n.containerState=N[1],N[0].exit.call(n,e)}t.length=E}function q(){i.write([null]),o=void 0,i=void 0,n.containerState._closeFlow=void 0}}function qa(e,n,t){return z(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function It(e){if(e===null||Q(e)||wo(e))return 1;if(yo(e))return 2}function Et(e,n,t){let r=[],i=-1;for(;++i<e.length;){let o=e[i].resolveAll;o&&!r.includes(o)&&(n=o(n,t),r.push(o))}return n}var on={name:"attention",resolveAll:Ha,tokenize:$a};function Ha(e,n){let t=-1,r,i,o,s,a,u,l,c;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;let h={...e[r][1].end},p={...e[t][1].start};Io(h,-u),Io(p,u),s={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:p},o={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:u>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[t][1].start={...a.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=ee(l,[["enter",e[r][1],n],["exit",e[r][1],n]])),l=ee(l,[["enter",i,n],["enter",s,n],["exit",s,n],["enter",o,n]]),l=ee(l,Et(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),l=ee(l,[["exit",o,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(c=2,l=ee(l,[["enter",e[t][1],n],["exit",e[t][1],n]])):c=0,J(e,r-1,t-r+3,l),t=r+l.length-c-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function $a(e,n){let t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=It(r),o;return s;function s(u){return o=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===o)return e.consume(u),a;let l=e.exit("attentionSequence"),c=It(u),h=!c||c===2&&i||t.includes(u),p=!i||i===2&&c||t.includes(r);return l._open=!!(o===42?h:h&&(i||!p)),l._close=!!(o===42?p:p&&(c||!h)),n(u)}}function Io(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}var xr={name:"autolink",tokenize:Ua};function Ua(e,n,t){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(f){return ae(f)?(e.consume(f),s):f===64?t(f):l(f)}function s(f){return f===43||f===45||f===46||te(f)?(r=1,a(f)):l(f)}function a(f){return f===58?(e.consume(f),r=0,u):(f===43||f===45||f===46||te(f))&&r++<32?(e.consume(f),a):(r=0,l(f))}function u(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),n):f===null||f===32||f===60||nn(f)?t(f):(e.consume(f),u)}function l(f){return f===64?(e.consume(f),c):go(f)?(e.consume(f),l):t(f)}function c(f){return te(f)?h(f):t(f)}function h(f){return f===46?(e.consume(f),r=0,c):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),n):p(f)}function p(f){if((f===45||te(f))&&r++<63){let I=f===45?p:h;return e.consume(f),I}return t(f)}}var Ne={partial:!0,tokenize:Qa};function Qa(e,n,t){return r;function r(o){return A(o)?z(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||S(o)?n(o):t(o)}}var Bn={continuation:{tokenize:Wa},exit:Ya,name:"blockQuote",tokenize:Ka};function Ka(e,n,t){let r=this;return i;function i(s){if(s===62){let a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return t(s)}function o(s){return A(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(s))}}function Wa(e,n,t){let r=this;return i;function i(s){return A(s)?z(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(Bn,n,t)(s)}}function Ya(e){e.exit("blockQuote")}var Nn={name:"characterEscape",tokenize:Ja};function Ja(e,n,t){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return ko(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(o)}}var jn={name:"characterReference",tokenize:Ga};function Ga(e,n,t){let r=this,i=0,o,s;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),o=31,s=te,c(h))}function l(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=xo,c):(e.enter("characterReferenceValue"),o=7,s=rn,c(h))}function c(h){if(h===59&&i){let p=e.exit("characterReferenceValue");return s===te&&!Ct(r.sliceSerialize(p))?t(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return s(h)&&i++<o?(e.consume(h),c):t(h)}}var Eo={partial:!0,tokenize:Za},Dn={concrete:!0,name:"codeFenced",tokenize:Xa};function Xa(e,n,t){let r=this,i={partial:!0,tokenize:N},o=0,s=0,a;return u;function u(k){return l(k)}function l(k){let j=r.events[r.events.length-1];return o=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(k)}function c(k){return k===a?(s++,e.consume(k),c):s<3?t(k):(e.exit("codeFencedFenceSequence"),A(k)?z(e,h,"whitespace")(k):h(k))}function h(k){return k===null||S(k)?(e.exit("codeFencedFence"),r.interrupt?n(k):e.check(Eo,v,L)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||S(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):A(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),z(e,f,"whitespace")(k)):k===96&&k===a?t(k):(e.consume(k),p)}function f(k){return k===null||S(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),I(k))}function I(k){return k===null||S(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===a?t(k):(e.consume(k),I)}function v(k){return e.attempt(i,L,R)(k)}function R(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),w}function w(k){return o>0&&A(k)?z(e,q,"linePrefix",o+1)(k):q(k)}function q(k){return k===null||S(k)?e.check(Eo,v,L)(k):(e.enter("codeFlowValue"),E(k))}function E(k){return k===null||S(k)?(e.exit("codeFlowValue"),q(k)):(e.consume(k),E)}function L(k){return e.exit("codeFenced"),n(k)}function N(k,j,$){let B=0;return H;function H(_){return k.enter("lineEnding"),k.consume(_),k.exit("lineEnding"),ce}function ce(_){return k.enter("codeFencedFence"),A(_)?z(k,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):D(_)}function D(_){return _===a?(k.enter("codeFencedFenceSequence"),T(_)):$(_)}function T(_){return _===a?(B++,k.consume(_),T):B>=s?(k.exit("codeFencedFenceSequence"),A(_)?z(k,F,"whitespace")(_):F(_)):$(_)}function F(_){return _===null||S(_)?(k.exit("codeFencedFence"),j(_)):$(_)}}}function Za(e,n,t){let r=this;return i;function i(s){return s===null?t(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?t(s):n(s)}}var sn={name:"codeIndented",tokenize:tu},eu={partial:!0,tokenize:nu};function tu(e,n,t){let r=this;return i;function i(l){return e.enter("codeIndented"),z(e,o,"linePrefix",5)(l)}function o(l){let c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(l):t(l)}function s(l){return l===null?u(l):S(l)?e.attempt(eu,s,u)(l):(e.enter("codeFlowValue"),a(l))}function a(l){return l===null||S(l)?(e.exit("codeFlowValue"),s(l)):(e.consume(l),a)}function u(l){return e.exit("codeIndented"),n(l)}}function nu(e,n,t){let r=this;return i;function i(s){return r.parser.lazy[r.now().line]?t(s):S(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):z(e,o,"linePrefix",5)(s)}function o(s){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(s):S(s)?i(s):t(s)}}var kr={name:"codeText",previous:iu,resolve:ru,tokenize:ou};function ru(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function iu(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ou(e,n,t){let r=this,i=0,o,s;return a;function a(p){return e.enter("codeText"),e.enter("codeTextSequence"),u(p)}function u(p){return p===96?(e.consume(p),i++,u):(e.exit("codeTextSequence"),l(p))}function l(p){return p===null?t(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),l):p===96?(s=e.enter("codeTextSequence"),o=0,h(p)):S(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(p))}function c(p){return p===null||p===32||p===96||S(p)?(e.exit("codeTextData"),l(p)):(e.consume(p),c)}function h(p){return p===96?(e.consume(p),o++,h):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(p)):(s.type="codeTextData",c(p))}}var Vn=class{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){let r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){let i=t||0;this.setCursor(Math.trunc(n));let o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&an(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),an(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),an(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){let t=this.left.splice(n,Number.POSITIVE_INFINITY);an(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);an(this.left,t.reverse())}}};function an(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function qn(e){let n={},t=-1,r,i,o,s,a,u,l,c=new Vn(e);for(;++t<c.length;){for(;t in n;)t=n[t];if(r=c.get(t),t&&r[1].type==="chunkFlow"&&c.get(t-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,su(c,t)),t=n[t],l=!0);else if(r[1]._container){for(o=t,i=void 0;o--;)if(s=c.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...c.get(i)[1].start},a=c.slice(i,t),a.unshift(r),c.splice(i,t-i+1,a))}}return J(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!l}function su(e,n){let t=e.get(n)[1],r=e.get(n)[2],i=n-1,o=[],s=t._tokenizer;s||(s=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));let a=s.events,u=[],l={},c,h,p=-1,f=t,I=0,v=0,R=[v];for(;f;){for(;e.get(++i)[1]!==f;);o.push(i),f._tokenizer||(c=r.sliceStream(f),f.next||c.push(null),h&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=t;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(v=p+1,R.push(v),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):R.pop(),p=R.length;p--;){let w=a.slice(R[p],R[p+1]),q=o.pop();u.push([q,q+w.length-1]),e.splice(q,2,w)}for(u.reverse(),p=-1;++p<u.length;)l[I+u[p][0]]=I+u[p][1],I+=u[p][1]-u[p][0]-1;return l}var yr={resolve:uu,tokenize:lu},au={partial:!0,tokenize:cu};function uu(e){return qn(e),e}function lu(e,n){let t;return r;function r(a){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):S(a)?e.check(au,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function s(a){return e.consume(a),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function cu(e,n,t){let r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),z(e,o,"linePrefix")}function o(s){if(s===null||S(s))return t(s);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(s):e.interrupt(r.parser.constructs.flow,t,n)(s)}}function Hn(e,n,t,r,i,o,s,a,u){let l=u||Number.POSITIVE_INFINITY,c=0;return h;function h(w){return w===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(w),e.exit(o),p):w===null||w===32||w===41||nn(w)?t(w):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),v(w))}function p(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===62?(e.exit("chunkString"),e.exit(a),p(w)):w===null||w===60||S(w)?t(w):(e.consume(w),w===92?I:f)}function I(w){return w===60||w===62||w===92?(e.consume(w),f):f(w)}function v(w){return!c&&(w===null||w===41||Q(w))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),n(w)):c<l&&w===40?(e.consume(w),c++,v):w===41?(e.consume(w),c--,v):w===null||w===32||w===40||nn(w)?t(w):(e.consume(w),w===92?R:v)}function R(w){return w===40||w===41||w===92?(e.consume(w),v):v(w)}}function $n(e,n,t,r,i,o){let s=this,a=0,u;return l;function l(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(o),c}function c(f){return a>999||f===null||f===91||f===93&&!u||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?t(f):f===93?(e.exit(o),e.enter(i),e.consume(f),e.exit(i),e.exit(r),n):S(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||S(f)||a++>999?(e.exit("chunkString"),c(f)):(e.consume(f),u||(u=!A(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function Un(e,n,t,r,i,o){let s;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),s=p===40?41:p,u):t(p)}function u(p){return p===s?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),n):(e.enter(o),l(p))}function l(p){return p===s?(e.exit(o),u(s)):p===null?t(p):S(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),z(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||S(p)?(e.exit("chunkString"),l(p)):(e.consume(p),p===92?h:c)}function h(p){return p===s||p===92?(e.consume(p),c):c(p)}}function Je(e,n){let t;return r;function r(i){return S(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):A(i)?z(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}var wr={name:"definition",tokenize:hu},fu={partial:!0,tokenize:pu};function hu(e,n,t){let r=this,i;return o;function o(f){return e.enter("definition"),s(f)}function s(f){return $n.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=_e(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),u):t(f)}function u(f){return Q(f)?Je(e,l)(f):l(f)}function l(f){return Hn(e,c,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function c(f){return e.attempt(fu,h,h)(f)}function h(f){return A(f)?z(e,p,"whitespace")(f):p(f)}function p(f){return f===null||S(f)?(e.exit("definition"),r.parser.defined.push(i),n(f)):t(f)}}function pu(e,n,t){return r;function r(a){return Q(a)?Je(e,i)(a):t(a)}function i(a){return Un(e,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return A(a)?z(e,s,"whitespace")(a):s(a)}function s(a){return a===null||S(a)?n(a):t(a)}}var br={name:"hardBreakEscape",tokenize:mu};function mu(e,n,t){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return S(o)?(e.exit("hardBreakEscape"),n(o)):t(o)}}var Sr={name:"headingAtx",resolve:du,tokenize:gu};function du(e,n){let t=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},o={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},J(e,r,t-r+1,[["enter",i,n],["enter",o,n],["exit",o,n],["exit",i,n]])),e}function gu(e,n,t){let r=0;return i;function i(c){return e.enter("atxHeading"),o(c)}function o(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||Q(c)?(e.exit("atxHeadingSequence"),a(c)):t(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),u(c)):c===null||S(c)?(e.exit("atxHeading"),n(c)):A(c)?z(e,a,"whitespace")(c):(e.enter("atxHeadingText"),l(c))}function u(c){return c===35?(e.consume(c),u):(e.exit("atxHeadingSequence"),a(c))}function l(c){return c===null||c===35||Q(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),l)}}var vo=["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","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Cr=["pre","script","style","textarea"];var Ir={concrete:!0,name:"htmlFlow",resolveTo:yu,tokenize:wu},xu={partial:!0,tokenize:Su},ku={partial:!0,tokenize:bu};function yu(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function wu(e,n,t){let r=this,i,o,s,a,u;return l;function l(d){return c(d)}function c(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),h}function h(d){return d===33?(e.consume(d),p):d===47?(e.consume(d),o=!0,v):d===63?(e.consume(d),i=3,r.interrupt?n:m):ae(d)?(e.consume(d),s=String.fromCharCode(d),R):t(d)}function p(d){return d===45?(e.consume(d),i=2,f):d===91?(e.consume(d),i=5,a=0,I):ae(d)?(e.consume(d),i=4,r.interrupt?n:m):t(d)}function f(d){return d===45?(e.consume(d),r.interrupt?n:m):t(d)}function I(d){let oe="CDATA[";return d===oe.charCodeAt(a++)?(e.consume(d),a===oe.length?r.interrupt?n:D:I):t(d)}function v(d){return ae(d)?(e.consume(d),s=String.fromCharCode(d),R):t(d)}function R(d){if(d===null||d===47||d===62||Q(d)){let oe=d===47,Ue=s.toLowerCase();return!oe&&!o&&Cr.includes(Ue)?(i=1,r.interrupt?n(d):D(d)):vo.includes(s.toLowerCase())?(i=6,oe?(e.consume(d),w):r.interrupt?n(d):D(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(d):o?q(d):E(d))}return d===45||te(d)?(e.consume(d),s+=String.fromCharCode(d),R):t(d)}function w(d){return d===62?(e.consume(d),r.interrupt?n:D):t(d)}function q(d){return A(d)?(e.consume(d),q):H(d)}function E(d){return d===47?(e.consume(d),H):d===58||d===95||ae(d)?(e.consume(d),L):A(d)?(e.consume(d),E):H(d)}function L(d){return d===45||d===46||d===58||d===95||te(d)?(e.consume(d),L):N(d)}function N(d){return d===61?(e.consume(d),k):A(d)?(e.consume(d),N):E(d)}function k(d){return d===null||d===60||d===61||d===62||d===96?t(d):d===34||d===39?(e.consume(d),u=d,j):A(d)?(e.consume(d),k):$(d)}function j(d){return d===u?(e.consume(d),u=null,B):d===null||S(d)?t(d):(e.consume(d),j)}function $(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||Q(d)?N(d):(e.consume(d),$)}function B(d){return d===47||d===62||A(d)?E(d):t(d)}function H(d){return d===62?(e.consume(d),ce):t(d)}function ce(d){return d===null||S(d)?D(d):A(d)?(e.consume(d),ce):t(d)}function D(d){return d===45&&i===2?(e.consume(d),U):d===60&&i===1?(e.consume(d),K):d===62&&i===4?(e.consume(d),fe):d===63&&i===3?(e.consume(d),m):d===93&&i===5?(e.consume(d),Se):S(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(xu,Ce,T)(d)):d===null||S(d)?(e.exit("htmlFlowData"),T(d)):(e.consume(d),D)}function T(d){return e.check(ku,F,Ce)(d)}function F(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),_}function _(d){return d===null||S(d)?T(d):(e.enter("htmlFlowData"),D(d))}function U(d){return d===45?(e.consume(d),m):D(d)}function K(d){return d===47?(e.consume(d),s="",de):D(d)}function de(d){if(d===62){let oe=s.toLowerCase();return Cr.includes(oe)?(e.consume(d),fe):D(d)}return ae(d)&&s.length<8?(e.consume(d),s+=String.fromCharCode(d),de):D(d)}function Se(d){return d===93?(e.consume(d),m):D(d)}function m(d){return d===62?(e.consume(d),fe):d===45&&i===2?(e.consume(d),m):D(d)}function fe(d){return d===null||S(d)?(e.exit("htmlFlowData"),Ce(d)):(e.consume(d),fe)}function Ce(d){return e.exit("htmlFlow"),n(d)}}function bu(e,n,t){let r=this;return i;function i(s){return S(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):t(s)}function o(s){return r.parser.lazy[r.now().line]?t(s):n(s)}}function Su(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ne,n,t)}}var Er={name:"htmlText",tokenize:Cu};function Cu(e,n,t){let r=this,i,o,s;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),u}function u(m){return m===33?(e.consume(m),l):m===47?(e.consume(m),N):m===63?(e.consume(m),E):ae(m)?(e.consume(m),$):t(m)}function l(m){return m===45?(e.consume(m),c):m===91?(e.consume(m),o=0,I):ae(m)?(e.consume(m),q):t(m)}function c(m){return m===45?(e.consume(m),f):t(m)}function h(m){return m===null?t(m):m===45?(e.consume(m),p):S(m)?(s=h,K(m)):(e.consume(m),h)}function p(m){return m===45?(e.consume(m),f):h(m)}function f(m){return m===62?U(m):m===45?p(m):h(m)}function I(m){let fe="CDATA[";return m===fe.charCodeAt(o++)?(e.consume(m),o===fe.length?v:I):t(m)}function v(m){return m===null?t(m):m===93?(e.consume(m),R):S(m)?(s=v,K(m)):(e.consume(m),v)}function R(m){return m===93?(e.consume(m),w):v(m)}function w(m){return m===62?U(m):m===93?(e.consume(m),w):v(m)}function q(m){return m===null||m===62?U(m):S(m)?(s=q,K(m)):(e.consume(m),q)}function E(m){return m===null?t(m):m===63?(e.consume(m),L):S(m)?(s=E,K(m)):(e.consume(m),E)}function L(m){return m===62?U(m):E(m)}function N(m){return ae(m)?(e.consume(m),k):t(m)}function k(m){return m===45||te(m)?(e.consume(m),k):j(m)}function j(m){return S(m)?(s=j,K(m)):A(m)?(e.consume(m),j):U(m)}function $(m){return m===45||te(m)?(e.consume(m),$):m===47||m===62||Q(m)?B(m):t(m)}function B(m){return m===47?(e.consume(m),U):m===58||m===95||ae(m)?(e.consume(m),H):S(m)?(s=B,K(m)):A(m)?(e.consume(m),B):U(m)}function H(m){return m===45||m===46||m===58||m===95||te(m)?(e.consume(m),H):ce(m)}function ce(m){return m===61?(e.consume(m),D):S(m)?(s=ce,K(m)):A(m)?(e.consume(m),ce):B(m)}function D(m){return m===null||m===60||m===61||m===62||m===96?t(m):m===34||m===39?(e.consume(m),i=m,T):S(m)?(s=D,K(m)):A(m)?(e.consume(m),D):(e.consume(m),F)}function T(m){return m===i?(e.consume(m),i=void 0,_):m===null?t(m):S(m)?(s=T,K(m)):(e.consume(m),T)}function F(m){return m===null||m===34||m===39||m===60||m===61||m===96?t(m):m===47||m===62||Q(m)?B(m):(e.consume(m),F)}function _(m){return m===47||m===62||Q(m)?B(m):t(m)}function U(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),n):t(m)}function K(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),de}function de(m){return A(m)?z(e,Se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):Se(m)}function Se(m){return e.enter("htmlTextData"),s(m)}}var Ge={name:"labelEnd",resolveAll:Tu,resolveTo:Au,tokenize:Pu},Iu={tokenize:zu},Eu={tokenize:_u},vu={tokenize:Fu};function Tu(e){let n=-1,t=[];for(;++n<e.length;){let r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){let i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&J(e,0,e.length,t),e}function Au(e,n){let t=e.length,r=0,i,o,s,a;for(;t--;)if(i=e[t][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=t);let u={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},l={type:"label",start:{...e[o][1].start},end:{...e[s][1].end}},c={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",u,n],["enter",l,n]],a=ee(a,e.slice(o+1,o+r+3)),a=ee(a,[["enter",c,n]]),a=ee(a,Et(n.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),n)),a=ee(a,[["exit",c,n],e[s-2],e[s-1],["exit",l,n]]),a=ee(a,e.slice(s+1)),a=ee(a,[["exit",u,n]]),J(e,o,e.length,a),e}function Pu(e,n,t){let r=this,i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(p){return o?o._inactive?h(p):(s=r.parser.defined.includes(_e(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),u):t(p)}function u(p){return p===40?e.attempt(Iu,c,s?c:h)(p):p===91?e.attempt(Eu,c,s?l:h)(p):s?c(p):h(p)}function l(p){return e.attempt(vu,c,h)(p)}function c(p){return n(p)}function h(p){return o._balanced=!0,t(p)}}function zu(e,n,t){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Q(h)?Je(e,o)(h):o(h)}function o(h){return h===41?c(h):Hn(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return Q(h)?Je(e,u)(h):c(h)}function a(h){return t(h)}function u(h){return h===34||h===39||h===40?Un(e,l,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function l(h){return Q(h)?Je(e,c)(h):c(h)}function c(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),n):t(h)}}function _u(e,n,t){let r=this;return i;function i(a){return $n.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(_e(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(a):t(a)}function s(a){return t(a)}}function Fu(e,n,t){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),n):t(o)}}var vr={name:"labelStartImage",resolveAll:Ge.resolveAll,tokenize:Mu};function Mu(e,n,t){let r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):t(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}var Tr={name:"labelStartLink",resolveAll:Ge.resolveAll,tokenize:Ou};function Ou(e,n,t){let r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(s):n(s)}}var un={name:"lineEnding",tokenize:Ru};function Ru(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),z(e,n,"linePrefix")}}var Xe={name:"thematicBreak",tokenize:Lu};function Lu(e,n,t){let r=0,i;return o;function o(l){return e.enter("thematicBreak"),s(l)}function s(l){return i=l,a(l)}function a(l){return l===i?(e.enter("thematicBreakSequence"),u(l)):r>=3&&(l===null||S(l))?(e.exit("thematicBreak"),n(l)):t(l)}function u(l){return l===i?(e.consume(l),r++,u):(e.exit("thematicBreakSequence"),A(l)?z(e,a,"whitespace")(l):a(l))}}var G={continuation:{tokenize:Du},exit:qu,name:"list",tokenize:ju},Bu={partial:!0,tokenize:Hu},Nu={partial:!0,tokenize:Vu};function ju(e,n,t){let r=this,i=r.events[r.events.length-1],o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(f){let I=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(I==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:rn(f)){if(r.containerState.type||(r.containerState.type=I,e.enter(I,{_container:!0})),I==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Xe,t,l)(f):l(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(f)}return t(f)}function u(f){return rn(f)&&++s<10?(e.consume(f),u):(!r.interrupt||s<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),l(f)):t(f)}function l(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(Ne,r.interrupt?t:c,e.attempt(Bu,p,h))}function c(f){return r.containerState.initialBlankLine=!0,o++,p(f)}function h(f){return A(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):t(f)}function p(f){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(f)}}function Du(e,n,t){let r=this;return r.containerState._closeFlow=void 0,e.check(Ne,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,z(e,n,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!A(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Nu,n,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,z(e,e.attempt(G,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Vu(e,n,t){let r=this;return z(e,i,"listItemIndent",r.containerState.size+1);function i(o){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?n(o):t(o)}}function qu(e){e.exit(this.containerState.type)}function Hu(e,n,t){let r=this;return z(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){let s=r.events[r.events.length-1];return!A(o)&&s&&s[1].type==="listItemPrefixWhitespace"?n(o):t(o)}}var Qn={name:"setextUnderline",resolveTo:$u,tokenize:Uu};function $u(e,n){let t=e.length,r,i,o;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!o&&e[t][1].type==="definition"&&(o=t);let s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,n]),e.splice(o+1,0,["exit",e[r][1],n]),e[r][1].end={...e[o][1].end}):e[r][1]=s,e.push(["exit",s,n]),e}function Uu(e,n,t){let r=this,i;return o;function o(l){let c=r.events.length,h;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){h=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=l,s(l)):t(l)}function s(l){return e.enter("setextHeadingLineSequence"),a(l)}function a(l){return l===i?(e.consume(l),a):(e.exit("setextHeadingLineSequence"),A(l)?z(e,u,"lineSuffix")(l):u(l))}function u(l){return l===null||S(l)?(e.exit("setextHeadingLine"),n(l)):t(l)}}var To={tokenize:Qu};function Qu(e){let n=this,t=e.attempt(Ne,r,e.attempt(this.parser.constructs.flowInitial,i,z(e,e.attempt(this.parser.constructs.flow,i,e.attempt(yr,i)),"linePrefix")));return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n.currentConstruct=void 0,t}}var Ao={resolveAll:Fo()},Po=_o("string"),zo=_o("text");function _o(e){return{resolveAll:Fo(e==="text"?Ku:void 0),tokenize:n};function n(t){let r=this,i=this.parser.constructs[e],o=t.attempt(i,s,a);return s;function s(c){return l(c)?o(c):a(c)}function a(c){if(c===null){t.consume(c);return}return t.enter("data"),t.consume(c),u}function u(c){return l(c)?(t.exit("data"),o(c)):(t.consume(c),u)}function l(c){if(c===null)return!0;let h=i[c],p=-1;if(h)for(;++p<h.length;){let f=h[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Fo(e){return n;function n(t,r){let i=-1,o;for(;++i<=t.length;)o===void 0?t[i]&&t[i][1].type==="data"&&(o=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==o+2&&(t[o][1].end=t[i-1][1].end,t.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(t,r):t}}function Ku(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){let r=e[t-1][1],i=n.sliceStream(r),o=i.length,s=-1,a=0,u;for(;o--;){let l=i[o];if(typeof l=="string"){for(s=l.length;l.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(l===-2)u=!0,a++;else if(l!==-1){o++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(a=0),a){let l={type:t===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:r.start._bufferIndex+s,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...l.start},r.start.offset===r.end.offset?Object.assign(r,l):(e.splice(t,0,["enter",l,n],["exit",l,n]),t+=2)}t++}return e}var Ar={};Ta(Ar,{attentionMarkers:()=>tl,contentInitial:()=>Yu,disable:()=>nl,document:()=>Wu,flow:()=>Gu,flowInitial:()=>Ju,insideSpan:()=>el,string:()=>Xu,text:()=>Zu});var Wu={42:G,43:G,45:G,48:G,49:G,50:G,51:G,52:G,53:G,54:G,55:G,56:G,57:G,62:Bn},Yu={91:wr},Ju={[-2]:sn,[-1]:sn,32:sn},Gu={35:Sr,42:Xe,45:[Qn,Xe],60:Ir,61:Qn,95:Xe,96:Dn,126:Dn},Xu={38:jn,92:Nn},Zu={[-5]:un,[-4]:un,[-3]:un,33:vr,38:jn,42:on,60:[xr,Er],91:Tr,92:[br,Nn],93:Ge,95:on,96:kr},el={null:[on,Ao]},tl={null:[42,95]},nl={null:[]};function Mo(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0},i={},o=[],s=[],a=[],u=!0,l={attempt:B(j),check:B($),consume:L,enter:N,exit:k,interrupt:B($,{interrupt:!0})},c={code:null,containerState:{},defineSkip:w,events:[],now:R,parser:e,previous:null,sliceSerialize:I,sliceStream:v,write:f},h=n.tokenize.call(c,l),p;return n.resolveAll&&o.push(n),c;function f(T){return s=ee(s,T),q(),s[s.length-1]!==null?[]:(H(n,0),c.events=Et(o,c.events,c),c.events)}function I(T,F){return il(v(T),F)}function v(T){return rl(s,T)}function R(){let{_bufferIndex:T,_index:F,line:_,column:U,offset:K}=r;return{_bufferIndex:T,_index:F,line:_,column:U,offset:K}}function w(T){i[T.line]=T.column,D()}function q(){let T;for(;r._index<s.length;){let F=s[r._index];if(typeof F=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<F.length;)E(F.charCodeAt(r._bufferIndex));else E(F)}}function E(T){u=void 0,p=T,h=h(T)}function L(T){S(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,D()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=T,u=!0}function N(T,F){let _=F||{};return _.type=T,_.start=R(),c.events.push(["enter",_,c]),a.push(_),_}function k(T){let F=a.pop();return F.end=R(),c.events.push(["exit",F,c]),F}function j(T,F){H(T,F.from)}function $(T,F){F.restore()}function B(T,F){return _;function _(U,K,de){let Se,m,fe,Ce;return Array.isArray(U)?oe(U):"tokenize"in U?oe([U]):d(U);function d(Y){return Qt;function Qt(Ie){let Qe=Ie!==null&&Y[Ie],ft=Ie!==null&&Y.null,pr=[...Array.isArray(Qe)?Qe:Qe?[Qe]:[],...Array.isArray(ft)?ft:ft?[ft]:[]];return oe(pr)(Ie)}}function oe(Y){return Se=Y,m=0,Y.length===0?de:Ue(Y[m])}function Ue(Y){return Qt;function Qt(Ie){return Ce=ce(),fe=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?_n(Ie):Y.tokenize.call(F?Object.assign(Object.create(c),F):c,l,hr,_n)(Ie)}}function hr(Y){return u=!0,T(fe,Ce),K}function _n(Y){return u=!0,Ce.restore(),++m<Se.length?Ue(Se[m]):de}}}function H(T,F){T.resolveAll&&!o.includes(T)&&o.push(T),T.resolve&&J(c.events,F,c.events.length-F,T.resolve(c.events.slice(F),c)),T.resolveTo&&(c.events=T.resolveTo(c.events,c))}function ce(){let T=R(),F=c.previous,_=c.currentConstruct,U=c.events.length,K=Array.from(a);return{from:U,restore:de};function de(){r=T,c.previous=F,c.currentConstruct=_,c.events.length=U,a=K,D()}}function D(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function rl(e,n){let t=n.start._index,r=n.start._bufferIndex,i=n.end._index,o=n.end._bufferIndex,s;if(t===i)s=[e[t].slice(r,o)];else{if(s=e.slice(t,i),r>-1){let a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function il(e,n){let t=-1,r=[],i;for(;++t<e.length;){let o=e[t],s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
|
|
3
|
+
`;break}case-3:{s=`\r
|
|
4
|
+
`;break}case-2:{s=n?" ":" ";break}case-1:{if(!n&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}function Pr(e){let r={constructs:mo([Ar,...(e||{}).extensions||[]]),content:i(bo),defined:[],document:i(Co),flow:i(To),lazy:{},string:i(Po),text:i(zo)};return r;function i(o){return s;function s(a){return Mo(r,o,a)}}}function zr(e){for(;!qn(e););return e}var Oo=/[\0\t\n\r]/g;function _r(){let e=1,n="",t=!0,r;return i;function i(o,s,a){let u=[],l,c,h,p,f;for(o=n+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),h=0,n="",t&&(o.charCodeAt(0)===65279&&h++,t=void 0);h<o.length;){if(Oo.lastIndex=h,l=Oo.exec(o),p=l&&l.index!==void 0?l.index:o.length,f=o.charCodeAt(p),!l){n=o.slice(h);break}if(f===10&&h===p&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),h<p&&(u.push(o.slice(h,p)),e+=p-h),f){case 0:{u.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,u.push(-2);e++<c;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return a&&(r&&u.push(-5),n&&u.push(n),u.push(null)),u}}var ol=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Kn(e){return e.replace(ol,sl)}function sl(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){let i=t.charCodeAt(1),o=i===120||i===88;return Ln(t.slice(o?2:1),o?16:10)}return Ct(t)||e}function je(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ro(e.position):"start"in e||"end"in e?Ro(e):"line"in e||"column"in e?Fr(e):""}function Fr(e){return Lo(e&&e.line)+":"+Lo(e&&e.column)}function Ro(e){return Fr(e&&e.start)+"-"+Fr(e&&e.end)}function Lo(e){return e&&typeof e=="number"?e:1}var No={}.hasOwnProperty;function Mr(e,n,t){return n&&typeof n=="object"&&(t=n,n=void 0),al(t)(zr(Pr(t).document().write(_r()(e,n,!0))))}function al(e){let n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ni),autolinkProtocol:B,autolinkEmail:B,atxHeading:o(Ri),blockQuote:o(Ie),characterEscape:B,characterReference:B,codeFenced:o(Qe),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(Qe,s),codeText:o(ft,s),codeTextData:B,data:B,codeFlowValue:B,definition:o(pr),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(ya),hardBreakEscape:o(Li),hardBreakTrailing:o(Li),htmlFlow:o(Bi,s),htmlFlowData:B,htmlText:o(Bi,s),htmlTextData:B,image:o(wa),label:s,link:o(Ni),listItem:o(ba),listItemValue:p,listOrdered:o(ji,h),listUnordered:o(ji),paragraph:o(Sa),reference:d,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(Ri),strong:o(Ca),thematicBreak:o(Ea)},exit:{atxHeading:u(),atxHeadingSequence:N,autolink:u(),autolinkEmail:Qt,autolinkProtocol:Y,blockQuote:u(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:Ue,characterReferenceMarkerNumeric:Ue,characterReferenceValue:hr,characterReference:_n,codeFenced:u(R),codeFencedFence:v,codeFencedFenceInfo:f,codeFencedFenceMeta:I,codeFlowValue:H,codeIndented:u(w),codeText:u(_),codeTextData:H,data:H,definition:u(),definitionDestinationString:L,definitionLabelString:q,definitionTitleString:E,emphasis:u(),hardBreakEscape:u(D),hardBreakTrailing:u(D),htmlFlow:u(T),htmlFlowData:H,htmlText:u(F),htmlTextData:H,image:u(K),label:Se,labelText:de,lineEnding:ce,link:u(U),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:oe,resourceDestinationString:m,resourceTitleString:fe,resource:Ce,setextHeading:u($),setextHeadingLineSequence:j,setextHeadingText:k,strong:u(),thematicBreak:u()}};jo(n,(e||{}).mdastExtensions||[]);let t={};return r;function r(x){let b={type:"root",children:[]},P={stack:[b],tokenStack:[],config:n,enter:a,exit:l,buffer:s,resume:c,data:t},M=[],V=-1;for(;++V<x.length;)if(x[V][1].type==="listOrdered"||x[V][1].type==="listUnordered")if(x[V][0]==="enter")M.push(V);else{let ge=M.pop();V=i(x,ge,V)}for(V=-1;++V<x.length;){let ge=n[x[V][0]];No.call(ge,x[V][1].type)&&ge[x[V][1].type].call(Object.assign({sliceSerialize:x[V][2].sliceSerialize},P),x[V][1])}if(P.tokenStack.length>0){let ge=P.tokenStack[P.tokenStack.length-1];(ge[1]||Bo).call(P,void 0,ge[0])}for(b.position={start:De(x.length>0?x[0][1].start:{line:1,column:1,offset:0}),end:De(x.length>0?x[x.length-2][1].end:{line:1,column:1,offset:0})},V=-1;++V<n.transforms.length;)b=n.transforms[V](b)||b;return b}function i(x,b,P){let M=b-1,V=-1,ge=!1,Ke,Ee,Kt,Wt;for(;++M<=P;){let se=x[M];switch(se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{se[0]==="enter"?V++:V--,Wt=void 0;break}case"lineEndingBlank":{se[0]==="enter"&&(Ke&&!Wt&&!V&&!Kt&&(Kt=M),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!V&&se[0]==="enter"&&se[1].type==="listItemPrefix"||V===-1&&se[0]==="exit"&&(se[1].type==="listUnordered"||se[1].type==="listOrdered")){if(Ke){let ht=M;for(Ee=void 0;ht--;){let ve=x[ht];if(ve[1].type==="lineEnding"||ve[1].type==="lineEndingBlank"){if(ve[0]==="exit")continue;Ee&&(x[Ee][1].type="lineEndingBlank",ge=!0),ve[1].type="lineEnding",Ee=ht}else if(!(ve[1].type==="linePrefix"||ve[1].type==="blockQuotePrefix"||ve[1].type==="blockQuotePrefixWhitespace"||ve[1].type==="blockQuoteMarker"||ve[1].type==="listItemIndent"))break}Kt&&(!Ee||Kt<Ee)&&(Ke._spread=!0),Ke.end=Object.assign({},Ee?x[Ee][1].start:se[1].end),x.splice(Ee||M,0,["exit",Ke,se[2]]),M++,P++}if(se[1].type==="listItemPrefix"){let ht={type:"listItem",_spread:!1,start:Object.assign({},se[1].start),end:void 0};Ke=ht,x.splice(M,0,["enter",ht,se[2]]),M++,P++,Kt=void 0,Wt=!0}}}return x[b][1]._spread=ge,P}function o(x,b){return P;function P(M){a.call(this,x(M),M),b&&b.call(this,M)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(x,b,P){this.stack[this.stack.length-1].children.push(x),this.stack.push(x),this.tokenStack.push([b,P||void 0]),x.position={start:De(b.start),end:void 0}}function u(x){return b;function b(P){x&&x.call(this,P),l.call(this,P)}}function l(x,b){let P=this.stack.pop(),M=this.tokenStack.pop();if(M)M[0].type!==x.type&&(b?b.call(this,x,M[0]):(M[1]||Bo).call(this,x,M[0]));else throw new Error("Cannot close `"+x.type+"` ("+je({start:x.start,end:x.end})+"): it\u2019s not open");P.position.end=De(x.end)}function c(){return Ye(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(x){if(this.data.expectingFirstListItemValue){let b=this.stack[this.stack.length-2];b.start=Number.parseInt(this.sliceSerialize(x),10),this.data.expectingFirstListItemValue=void 0}}function f(){let x=this.resume(),b=this.stack[this.stack.length-1];b.lang=x}function I(){let x=this.resume(),b=this.stack[this.stack.length-1];b.meta=x}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function R(){let x=this.resume(),b=this.stack[this.stack.length-1];b.value=x.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){let x=this.resume(),b=this.stack[this.stack.length-1];b.value=x.replace(/(\r?\n|\r)$/g,"")}function q(x){let b=this.resume(),P=this.stack[this.stack.length-1];P.label=b,P.identifier=_e(this.sliceSerialize(x)).toLowerCase()}function E(){let x=this.resume(),b=this.stack[this.stack.length-1];b.title=x}function L(){let x=this.resume(),b=this.stack[this.stack.length-1];b.url=x}function N(x){let b=this.stack[this.stack.length-1];if(!b.depth){let P=this.sliceSerialize(x).length;b.depth=P}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function j(x){let b=this.stack[this.stack.length-1];b.depth=this.sliceSerialize(x).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function B(x){let P=this.stack[this.stack.length-1].children,M=P[P.length-1];(!M||M.type!=="text")&&(M=Ia(),M.position={start:De(x.start),end:void 0},P.push(M)),this.stack.push(M)}function H(x){let b=this.stack.pop();b.value+=this.sliceSerialize(x),b.position.end=De(x.end)}function ce(x){let b=this.stack[this.stack.length-1];if(this.data.atHardBreak){let P=b.children[b.children.length-1];P.position.end=De(x.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(b.type)&&(B.call(this,x),H.call(this,x))}function D(){this.data.atHardBreak=!0}function T(){let x=this.resume(),b=this.stack[this.stack.length-1];b.value=x}function F(){let x=this.resume(),b=this.stack[this.stack.length-1];b.value=x}function _(){let x=this.resume(),b=this.stack[this.stack.length-1];b.value=x}function U(){let x=this.stack[this.stack.length-1];if(this.data.inReference){let b=this.data.referenceType||"shortcut";x.type+="Reference",x.referenceType=b,delete x.url,delete x.title}else delete x.identifier,delete x.label;this.data.referenceType=void 0}function K(){let x=this.stack[this.stack.length-1];if(this.data.inReference){let b=this.data.referenceType||"shortcut";x.type+="Reference",x.referenceType=b,delete x.url,delete x.title}else delete x.identifier,delete x.label;this.data.referenceType=void 0}function de(x){let b=this.sliceSerialize(x),P=this.stack[this.stack.length-2];P.label=Kn(b),P.identifier=_e(b).toLowerCase()}function Se(){let x=this.stack[this.stack.length-1],b=this.resume(),P=this.stack[this.stack.length-1];if(this.data.inReference=!0,P.type==="link"){let M=x.children;P.children=M}else P.alt=b}function m(){let x=this.resume(),b=this.stack[this.stack.length-1];b.url=x}function fe(){let x=this.resume(),b=this.stack[this.stack.length-1];b.title=x}function Ce(){this.data.inReference=void 0}function d(){this.data.referenceType="collapsed"}function oe(x){let b=this.resume(),P=this.stack[this.stack.length-1];P.label=b,P.identifier=_e(this.sliceSerialize(x)).toLowerCase(),this.data.referenceType="full"}function Ue(x){this.data.characterReferenceType=x.type}function hr(x){let b=this.sliceSerialize(x),P=this.data.characterReferenceType,M;P?(M=Ln(b,P==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):M=Ct(b);let V=this.stack[this.stack.length-1];V.value+=M}function _n(x){let b=this.stack.pop();b.position.end=De(x.end)}function Y(x){H.call(this,x);let b=this.stack[this.stack.length-1];b.url=this.sliceSerialize(x)}function Qt(x){H.call(this,x);let b=this.stack[this.stack.length-1];b.url="mailto:"+this.sliceSerialize(x)}function Ie(){return{type:"blockquote",children:[]}}function Qe(){return{type:"code",lang:null,meta:null,value:""}}function ft(){return{type:"inlineCode",value:""}}function pr(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ya(){return{type:"emphasis",children:[]}}function Ri(){return{type:"heading",depth:0,children:[]}}function Li(){return{type:"break"}}function Bi(){return{type:"html",value:""}}function wa(){return{type:"image",title:null,url:"",alt:null}}function Ni(){return{type:"link",title:null,url:"",children:[]}}function ji(x){return{type:"list",ordered:x.type==="listOrdered",start:null,spread:x._spread,children:[]}}function ba(x){return{type:"listItem",spread:x._spread,checked:null,children:[]}}function Sa(){return{type:"paragraph",children:[]}}function Ca(){return{type:"strong",children:[]}}function Ia(){return{type:"text",value:""}}function Ea(){return{type:"thematicBreak"}}}function De(e){return{line:e.line,column:e.column,offset:e.offset}}function jo(e,n){let t=-1;for(;++t<n.length;){let r=n[t];Array.isArray(r)?jo(e,r):ul(e,r)}}function ul(e,n){let t;for(t in n)if(No.call(n,t))switch(t){case"canContainEols":{let r=n[t];r&&e[t].push(...r);break}case"transforms":{let r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{let r=n[t];r&&Object.assign(e[t],r);break}}}function Bo(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+je({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+je({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+je({start:n.start,end:n.end})+") is still open")}function vt(e){let n=this;n.parser=t;function t(r){return Mr(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}var Do={}.hasOwnProperty;function Vo(e,n){let t=n||{};function r(i,...o){let s=r.invalid,a=r.handlers;if(i&&Do.call(i,e)){let u=String(i[e]);s=Do.call(a,u)?a[u]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}var ll={}.hasOwnProperty;function Or(e,n){let t=-1,r;if(n.extensions)for(;++t<n.extensions.length;)Or(e,n.extensions[t]);for(r in n)if(ll.call(n,r))switch(r){case"extensions":break;case"unsafe":{qo(e[r],n[r]);break}case"join":{qo(e[r],n[r]);break}case"handlers":{cl(e[r],n[r]);break}default:e.options[r]=n[r]}return e}function qo(e,n){n&&e.push(...n)}function cl(e,n){n&&Object.assign(e,n)}function Ho(e,n,t,r){let i=t.enter("blockquote"),o=t.createTracker(r);o.move("> "),o.shift(2);let s=t.indentLines(t.containerFlow(e,o.current()),fl);return i(),s}function fl(e,n,t){return">"+(t?"":" ")+e}function Wn(e,n){return $o(e,n.inConstruct,!0)&&!$o(e,n.notInConstruct,!1)}function $o(e,n,t){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return t;let r=-1;for(;++r<n.length;)if(e.includes(n[r]))return!0;return!1}function Rr(e,n,t,r){let i=-1;for(;++i<t.unsafe.length;)if(t.unsafe[i].character===`
|
|
5
|
+
`&&Wn(t.stack,t.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
6
|
+
`}function Uo(e,n){let t=String(e),r=t.indexOf(n),i=r,o=0,s=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>s&&(s=o):o=1,i=r+n.length,r=t.indexOf(n,i);return s}function ln(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Qo(e){let n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function Ko(e,n,t,r){let i=Qo(t),o=e.value||"",s=i==="`"?"GraveAccent":"Tilde";if(ln(e,t)){let h=t.enter("codeIndented"),p=t.indentLines(o,hl);return h(),p}let a=t.createTracker(r),u=i.repeat(Math.max(Uo(o,i)+1,3)),l=t.enter("codeFenced"),c=a.move(u);if(e.lang){let h=t.enter(`codeFencedLang${s}`);c+=a.move(t.safe(e.lang,{before:c,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){let h=t.enter(`codeFencedMeta${s}`);c+=a.move(" "),c+=a.move(t.safe(e.meta,{before:c,after:`
|
|
7
|
+
`,encode:["`"],...a.current()})),h()}return c+=a.move(`
|
|
8
|
+
`),o&&(c+=a.move(o+`
|
|
9
|
+
`)),c+=a.move(u),l(),c}function hl(e,n,t){return(t?"":" ")+e}function Tt(e){let n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function Wo(e,n,t,r){let i=Tt(t),o=i==='"'?"Quote":"Apostrophe",s=t.enter("definition"),a=t.enter("label"),u=t.createTracker(r),l=u.move("[");return l+=u.move(t.safe(t.associationId(e),{before:l,after:"]",...u.current()})),l+=u.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=t.enter("destinationLiteral"),l+=u.move("<"),l+=u.move(t.safe(e.url,{before:l,after:">",...u.current()})),l+=u.move(">")):(a=t.enter("destinationRaw"),l+=u.move(t.safe(e.url,{before:l,after:e.title?" ":`
|
|
10
|
+
`,...u.current()}))),a(),e.title&&(a=t.enter(`title${o}`),l+=u.move(" "+i),l+=u.move(t.safe(e.title,{before:l,after:i,...u.current()})),l+=u.move(i),a()),s(),l}function Yo(e){let n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function ue(e){return"&#x"+e.toString(16).toUpperCase()+";"}function At(e,n,t){let r=It(e),i=It(n);return r===void 0?i===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Lr.peek=pl;function Lr(e,n,t,r){let i=Yo(t),o=t.enter("emphasis"),s=t.createTracker(r),a=s.move(i),u=s.move(t.containerPhrasing(e,{after:i,before:a,...s.current()})),l=u.charCodeAt(0),c=At(r.before.charCodeAt(r.before.length-1),l,i);c.inside&&(u=ue(l)+u.slice(1));let h=u.charCodeAt(u.length-1),p=At(r.after.charCodeAt(0),h,i);p.inside&&(u=u.slice(0,-1)+ue(h));let f=s.move(i);return o(),t.attentionEncodeSurroundingInfo={after:p.outside,before:c.outside},a+u+f}function pl(e,n,t){return t.options.emphasis||"*"}var Pt=(function(e){if(e==null)return xl;if(typeof e=="function")return Yn(e);if(typeof e=="object")return Array.isArray(e)?ml(e):dl(e);if(typeof e=="string")return gl(e);throw new Error("Expected function, string, or object as test")});function ml(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Pt(e[t]);return Yn(r);function r(...i){let o=-1;for(;++o<n.length;)if(n[o].apply(this,i))return!0;return!1}}function dl(e){let n=e;return Yn(t);function t(r){let i=r,o;for(o in e)if(i[o]!==n[o])return!1;return!0}}function gl(e){return Yn(n);function n(t){return t&&t.type===e}}function Yn(e){return n;function n(t,r,i){return!!(kl(t)&&e.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function xl(){return!0}function kl(e){return e!==null&&typeof e=="object"&&"type"in e}var Jo=[],Jn=!0,Ze=!1,Gn="skip";function Br(e,n,t,r){let i;typeof n=="function"&&typeof t!="function"?(r=t,t=n):i=n;let o=Pt(i),s=r?-1:1;a(e,void 0,[])();function a(u,l,c){let h=u&&typeof u=="object"?u:{};if(typeof h.type=="string"){let f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(u.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Jo,I,v,R;if((!n||o(u,l,c[c.length-1]||void 0))&&(f=yl(t(u,c)),f[0]===Ze))return f;if("children"in u&&u.children){let w=u;if(w.children&&f[0]!==Gn)for(v=(r?w.children.length:-1)+s,R=c.concat(w);v>-1&&v<w.children.length;){let q=w.children[v];if(I=a(q,v,R)(),I[0]===Ze)return I;v=typeof I[1]=="number"?I[1]:v+s}}return f}}}function yl(e){return Array.isArray(e)?e:typeof e=="number"?[Jn,e]:e==null?Jo:[e]}function Nr(e,n,t,r){let i,o,s;typeof n=="function"&&typeof t!="function"?(o=void 0,s=n,i=t):(o=n,s=t,i=r),Br(e,o,a,i);function a(u,l){let c=l[l.length-1],h=c?c.children.indexOf(u):void 0;return s(u,h,c)}}function Xn(e,n){let t=!1;return Nr(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return t=!0,Ze}),!!((!e.depth||e.depth<3)&&Ye(e)&&(n.options.setext||t))}function Go(e,n,t,r){let i=Math.max(Math.min(6,e.depth||1),1),o=t.createTracker(r);if(Xn(e,t)){let c=t.enter("headingSetext"),h=t.enter("phrasing"),p=t.containerPhrasing(e,{...o.current(),before:`
|
|
11
|
+
`,after:`
|
|
12
|
+
`});return h(),c(),p+`
|
|
13
|
+
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
14
|
+
`))+1))}let s="#".repeat(i),a=t.enter("headingAtx"),u=t.enter("phrasing");o.move(s+" ");let l=t.containerPhrasing(e,{before:"# ",after:`
|
|
15
|
+
`,...o.current()});return/^[\t ]/.test(l)&&(l=ue(l.charCodeAt(0))+l.slice(1)),l=l?s+" "+l:s,t.options.closeAtx&&(l+=" "+s),u(),a(),l}jr.peek=wl;function jr(e){return e.value||""}function wl(){return"<"}Dr.peek=bl;function Dr(e,n,t,r){let i=Tt(t),o=i==='"'?"Quote":"Apostrophe",s=t.enter("image"),a=t.enter("label"),u=t.createTracker(r),l=u.move("![");return l+=u.move(t.safe(e.alt,{before:l,after:"]",...u.current()})),l+=u.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=t.enter("destinationLiteral"),l+=u.move("<"),l+=u.move(t.safe(e.url,{before:l,after:">",...u.current()})),l+=u.move(">")):(a=t.enter("destinationRaw"),l+=u.move(t.safe(e.url,{before:l,after:e.title?" ":")",...u.current()}))),a(),e.title&&(a=t.enter(`title${o}`),l+=u.move(" "+i),l+=u.move(t.safe(e.title,{before:l,after:i,...u.current()})),l+=u.move(i),a()),l+=u.move(")"),s(),l}function bl(){return"!"}Vr.peek=Sl;function Vr(e,n,t,r){let i=e.referenceType,o=t.enter("imageReference"),s=t.enter("label"),a=t.createTracker(r),u=a.move("!["),l=t.safe(e.alt,{before:u,after:"]",...a.current()});u+=a.move(l+"]["),s();let c=t.stack;t.stack=[],s=t.enter("reference");let h=t.safe(t.associationId(e),{before:u,after:"]",...a.current()});return s(),t.stack=c,o(),i==="full"||!l||l!==h?u+=a.move(h+"]"):i==="shortcut"?u=u.slice(0,-1):u+=a.move("]"),u}function Sl(){return"!"}qr.peek=Cl;function qr(e,n,t){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<t.unsafe.length;){let s=t.unsafe[o],a=t.compilePattern(s),u;if(s.atBreak)for(;u=a.exec(r);){let l=u.index;r.charCodeAt(l)===10&&r.charCodeAt(l-1)===13&&l--,r=r.slice(0,l)+" "+r.slice(u.index+1)}}return i+r+i}function Cl(){return"`"}function Hr(e,n){let t=Ye(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(t===e.url||"mailto:"+t===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}$r.peek=Il;function $r(e,n,t,r){let i=Tt(t),o=i==='"'?"Quote":"Apostrophe",s=t.createTracker(r),a,u;if(Hr(e,t)){let c=t.stack;t.stack=[],a=t.enter("autolink");let h=s.move("<");return h+=s.move(t.containerPhrasing(e,{before:h,after:">",...s.current()})),h+=s.move(">"),a(),t.stack=c,h}a=t.enter("link"),u=t.enter("label");let l=s.move("[");return l+=s.move(t.containerPhrasing(e,{before:l,after:"](",...s.current()})),l+=s.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=t.enter("destinationLiteral"),l+=s.move("<"),l+=s.move(t.safe(e.url,{before:l,after:">",...s.current()})),l+=s.move(">")):(u=t.enter("destinationRaw"),l+=s.move(t.safe(e.url,{before:l,after:e.title?" ":")",...s.current()}))),u(),e.title&&(u=t.enter(`title${o}`),l+=s.move(" "+i),l+=s.move(t.safe(e.title,{before:l,after:i,...s.current()})),l+=s.move(i),u()),l+=s.move(")"),a(),l}function Il(e,n,t){return Hr(e,t)?"<":"["}Ur.peek=El;function Ur(e,n,t,r){let i=e.referenceType,o=t.enter("linkReference"),s=t.enter("label"),a=t.createTracker(r),u=a.move("["),l=t.containerPhrasing(e,{before:u,after:"]",...a.current()});u+=a.move(l+"]["),s();let c=t.stack;t.stack=[],s=t.enter("reference");let h=t.safe(t.associationId(e),{before:u,after:"]",...a.current()});return s(),t.stack=c,o(),i==="full"||!l||l!==h?u+=a.move(h+"]"):i==="shortcut"?u=u.slice(0,-1):u+=a.move("]"),u}function El(){return"["}function zt(e){let n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function Xo(e){let n=zt(e),t=e.options.bulletOther;if(!t)return n==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+t+"`) to be different");return t}function Zo(e){let n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function Zn(e){let n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function es(e,n,t,r){let i=t.enter("list"),o=t.bulletCurrent,s=e.ordered?Zo(t):zt(t),a=e.ordered?s==="."?")":".":Xo(t),u=n&&t.bulletLastUsed?s===t.bulletLastUsed:!1;if(!e.ordered){let c=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&c&&(!c.children||!c.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(u=!0),Zn(t)===s&&c){let h=-1;for(;++h<e.children.length;){let p=e.children[h];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(s=a),t.bulletCurrent=s;let l=t.containerFlow(e,r);return t.bulletLastUsed=s,t.bulletCurrent=o,i(),l}function ts(e){let n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function ns(e,n,t,r){let i=ts(t),o=t.bulletCurrent||zt(t);n&&n.type==="list"&&n.ordered&&(o=(typeof n.start=="number"&&n.start>-1?n.start:1)+(t.options.incrementListMarker===!1?0:n.children.indexOf(e))+o);let s=o.length+1;(i==="tab"||i==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(s=Math.ceil(s/4)*4);let a=t.createTracker(r);a.move(o+" ".repeat(s-o.length)),a.shift(s);let u=t.enter("listItem"),l=t.indentLines(t.containerFlow(e,a.current()),c);return u(),l;function c(h,p,f){return p?(f?"":" ".repeat(s))+h:(f?o:o+" ".repeat(s-o.length))+h}}function rs(e,n,t,r){let i=t.enter("paragraph"),o=t.enter("phrasing"),s=t.containerPhrasing(e,r);return o(),i(),s}var Qr=Pt(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function is(e,n,t,r){return(e.children.some(function(s){return Qr(s)})?t.containerPhrasing:t.containerFlow).call(t,e,r)}function os(e){let n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}Kr.peek=vl;function Kr(e,n,t,r){let i=os(t),o=t.enter("strong"),s=t.createTracker(r),a=s.move(i+i),u=s.move(t.containerPhrasing(e,{after:i,before:a,...s.current()})),l=u.charCodeAt(0),c=At(r.before.charCodeAt(r.before.length-1),l,i);c.inside&&(u=ue(l)+u.slice(1));let h=u.charCodeAt(u.length-1),p=At(r.after.charCodeAt(0),h,i);p.inside&&(u=u.slice(0,-1)+ue(h));let f=s.move(i+i);return o(),t.attentionEncodeSurroundingInfo={after:p.outside,before:c.outside},a+u+f}function vl(e,n,t){return t.options.strong||"*"}function ss(e,n,t,r){return t.safe(e.value,r)}function as(e){let n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function us(e,n,t){let r=(Zn(t)+(t.options.ruleSpaces?" ":"")).repeat(as(t));return t.options.ruleSpaces?r.slice(0,-1):r}var Wr={blockquote:Ho,break:Rr,code:Ko,definition:Wo,emphasis:Lr,hardBreak:Rr,heading:Go,html:jr,image:Dr,imageReference:Vr,inlineCode:qr,link:$r,linkReference:Ur,list:es,listItem:ns,paragraph:rs,root:is,strong:Kr,text:ss,thematicBreak:us};var ls=[Tl];function Tl(e,n,t,r){if(n.type==="code"&&ln(n,r)&&(e.type==="list"||e.type===n.type&&ln(e,r)))return!1;if("spread"in t&&typeof t.spread=="boolean")return e.type==="paragraph"&&(e.type===n.type||n.type==="definition"||n.type==="heading"&&Xn(n,r))?void 0:t.spread?1:0}var et=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],cs=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
|
16
|
+
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:et},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
17
|
+
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:et},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
18
|
+
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:et},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
19
|
+
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
|
20
|
+
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
|
21
|
+
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:et},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:et},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:et},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:et},{atBreak:!0,character:"~"}];function fs(e){return e.label||!e.identifier?e.label||"":Kn(e.identifier)}function hs(e){if(!e._compiled){let n=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((n?"("+n+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function ps(e,n,t){let r=n.indexStack,i=e.children||[],o=[],s=-1,a=t.before,u;r.push(-1);let l=n.createTracker(t);for(;++s<i.length;){let c=i[s],h;if(r[r.length-1]=s,s+1<i.length){let I=n.handle.handlers[i[s+1].type];I&&I.peek&&(I=I.peek),h=I?I(i[s+1],e,n,{before:"",after:"",...l.current()}).charAt(0):""}else h=t.after;o.length>0&&(a==="\r"||a===`
|
|
22
|
+
`)&&c.type==="html"&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),a=" ",l=n.createTracker(t),l.move(o.join("")));let p=n.handle(c,e,n,{...l.current(),after:h,before:a});u&&u===p.slice(0,1)&&(p=ue(u.charCodeAt(0))+p.slice(1));let f=n.attentionEncodeSurroundingInfo;n.attentionEncodeSurroundingInfo=void 0,u=void 0,f&&(o.length>0&&f.before&&a===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+ue(a.charCodeAt(0))),f.after&&(u=h)),l.move(p),o.push(p),a=p.slice(-1)}return r.pop(),o.join("")}function ms(e,n,t){let r=n.indexStack,i=e.children||[],o=n.createTracker(t),s=[],a=-1;for(r.push(-1);++a<i.length;){let u=i[a];r[r.length-1]=a,s.push(o.move(n.handle(u,e,n,{before:`
|
|
23
|
+
`,after:`
|
|
24
|
+
`,...o.current()}))),u.type!=="list"&&(n.bulletLastUsed=void 0),a<i.length-1&&s.push(o.move(Al(u,i[a+1],e,n)))}return r.pop(),s.join("")}function Al(e,n,t,r){let i=r.join.length;for(;i--;){let o=r.join[i](e,n,t,r);if(o===!0||o===1)break;if(typeof o=="number")return`
|
|
25
|
+
`.repeat(1+o);if(o===!1)return`
|
|
26
|
+
|
|
27
|
+
<!---->
|
|
28
|
+
|
|
29
|
+
`}return`
|
|
30
|
+
|
|
31
|
+
`}var Pl=/\r?\n|\r/g;function ds(e,n){let t=[],r=0,i=0,o;for(;o=Pl.exec(e);)s(e.slice(r,o.index)),t.push(o[0]),r=o.index+o[0].length,i++;return s(e.slice(r)),t.join("");function s(a){t.push(n(a,i,!a))}}function xs(e,n,t){let r=(t.before||"")+(n||"")+(t.after||""),i=[],o=[],s={},a=-1;for(;++a<e.unsafe.length;){let c=e.unsafe[a];if(!Wn(e.stack,c))continue;let h=e.compilePattern(c),p;for(;p=h.exec(r);){let f="before"in c||!!c.atBreak,I="after"in c,v=p.index+(f?p[1].length:0);i.includes(v)?(s[v].before&&!f&&(s[v].before=!1),s[v].after&&!I&&(s[v].after=!1)):(i.push(v),s[v]={before:f,after:I})}}i.sort(zl);let u=t.before?t.before.length:0,l=r.length-(t.after?t.after.length:0);for(a=-1;++a<i.length;){let c=i[a];c<u||c>=l||c+1<l&&i[a+1]===c+1&&s[c].after&&!s[c+1].before&&!s[c+1].after||i[a-1]===c-1&&s[c].before&&!s[c-1].before&&!s[c-1].after||(u!==c&&o.push(gs(r.slice(u,c),"\\")),u=c,/[!-/:-@[-`{-~]/.test(r.charAt(c))&&(!t.encode||!t.encode.includes(r.charAt(c)))?o.push("\\"):(o.push(ue(r.charCodeAt(c))),u++))}return o.push(gs(r.slice(u,l),t.after)),o.join("")}function zl(e,n){return e-n}function gs(e,n){let t=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],o=e+n,s=-1,a=0,u;for(;u=t.exec(o);)r.push(u.index);for(;++s<r.length;)a!==r[s]&&i.push(e.slice(a,r[s])),i.push("\\"),a=r[s];return i.push(e.slice(a)),i.join("")}function ks(e){let n=e||{},t=n.now||{},r=n.lineShift||0,i=t.line||1,o=t.column||1;return{move:u,current:s,shift:a};function s(){return{now:{line:i,column:o},lineShift:r}}function a(l){r+=l}function u(l){let c=l||"",h=c.split(/\r?\n|\r/g),p=h[h.length-1];return i+=h.length-1,o=h.length===1?o+p.length:1+p.length+r,c}}function Yr(e,n){let t=n||{},r={associationId:fs,containerPhrasing:Ol,containerFlow:Rl,createTracker:ks,compilePattern:hs,enter:o,handlers:{...Wr},handle:void 0,indentLines:ds,indexStack:[],join:[...ls],options:{},safe:Ll,stack:[],unsafe:[...cs]};Or(r,t),r.options.tightDefinitions&&r.join.push(Ml),r.handle=Vo("type",{invalid:_l,unknown:Fl,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:`
|
|
32
|
+
`,after:`
|
|
33
|
+
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
|
34
|
+
`),i;function o(s){return r.stack.push(s),a;function a(){r.stack.pop()}}}function _l(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function Fl(e){let n=e;throw new Error("Cannot handle unknown node `"+n.type+"`")}function Ml(e,n){if(e.type==="definition"&&e.type===n.type)return 0}function Ol(e,n){return ps(e,this,n)}function Rl(e,n){return ms(e,this,n)}function Ll(e,n){return xs(this,e,n)}function _t(e){let n=this;n.compiler=t;function t(r){return Yr(r,{...n.data("settings"),...e,extensions:n.data("toMarkdownExtensions")||[]})}}function Jr(e){if(e)throw e}var nr=Aa(Ts(),1);function cn(e){if(typeof e!="object"||e===null)return!1;let n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Gr(){let e=[],n={run:t,use:r};return n;function t(...i){let o=-1,s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...i);function a(u,...l){let c=e[++o],h=-1;if(u){s(u);return}for(;++h<i.length;)(l[h]===null||l[h]===void 0)&&(l[h]=i[h]);i=l,c?As(c,a)(...l):s(null,...l)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),n}}function As(e,n){let t;return r;function r(...s){let a=e.length>s.length,u;a&&s.push(i);try{u=e.apply(this,s)}catch(l){let c=l;if(a&&t)throw c;return i(c)}a||(u&&u.then&&typeof u.then=="function"?u.then(o,i):u instanceof Error?i(u):o(u))}function i(s,...a){t||(t=!0,n(s,...a))}function o(s){i(null,s)}}var W=class extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",o={},s=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof n=="string"?i=n:!o.cause&&n&&(s=!0,i=n.message,o.cause=n),!o.ruleId&&!o.source&&typeof r=="string"){let u=r.indexOf(":");u===-1?o.ruleId=r:(o.source=r.slice(0,u),o.ruleId=r.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){let u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}let a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=je(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};W.prototype.file="";W.prototype.name="";W.prototype.reason="";W.prototype.message="";W.prototype.stack="";W.prototype.column=void 0;W.prototype.line=void 0;W.prototype.ancestors=void 0;W.prototype.cause=void 0;W.prototype.fatal=void 0;W.prototype.place=void 0;W.prototype.ruleId=void 0;W.prototype.source=void 0;var ye={basename:Bl,dirname:Nl,extname:jl,join:Dl,sep:"/"};function Bl(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');fn(e);let t=0,r=-1,i=e.length,o;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){t=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let s=-1,a=n.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){t=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===n.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return t===r?r=s:r<0&&(r=e.length),e.slice(t,r)}function Nl(e){if(fn(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function jl(e){fn(e);let n=e.length,t=-1,r=0,i=-1,o=0,s;for(;n--;){let a=e.codePointAt(n);if(a===47){if(s){r=n+1;break}continue}t<0&&(s=!0,t=n+1),a===46?i<0?i=n:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||t<0||o===0||o===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function Dl(...e){let n=-1,t;for(;++n<e.length;)fn(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":Vl(t)}function Vl(e){fn(e);let n=e.codePointAt(0)===47,t=ql(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function ql(e,n){let t="",r=0,i=-1,o=0,s=-1,a,u;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(u=t.lastIndexOf("/"),u!==t.length-1){u<0?(t="",r=0):(t=t.slice(0,u),r=t.length-1-t.lastIndexOf("/")),i=s,o=0;continue}}else if(t.length>0){t="",r=0,i=s,o=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,s):t=e.slice(i+1,s),r=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return t}function fn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Ps={cwd:Hl};function Hl(){return"/"}function Ft(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function zs(e){if(typeof e=="string")e=new URL(e);else if(!Ft(e)){let n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){let n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return $l(e)}function $l(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let n=e.pathname,t=-1;for(;++t<n.length;)if(n.codePointAt(t)===37&&n.codePointAt(t+1)===50){let r=n.codePointAt(t+2);if(r===70||r===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}var Xr=["history","path","basename","stem","extname","dirname"],hn=class{constructor(n){let t;n?Ft(n)?t={path:n}:typeof n=="string"||Ul(n)?t={value:n}:t=n:t={},this.cwd="cwd"in t?"":Ps.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Xr.length;){let o=Xr[r];o in t&&t[o]!==void 0&&t[o]!==null&&(this[o]=o==="history"?[...t[o]]:t[o])}let i;for(i in t)Xr.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?ye.basename(this.path):void 0}set basename(n){ei(n,"basename"),Zr(n,"basename"),this.path=ye.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?ye.dirname(this.path):void 0}set dirname(n){_s(this.basename,"dirname"),this.path=ye.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?ye.extname(this.path):void 0}set extname(n){if(Zr(n,"extname"),_s(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ye.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Ft(n)&&(n=zs(n)),ei(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?ye.basename(this.path,this.extname):void 0}set stem(n){ei(n,"stem"),Zr(n,"stem"),this.path=ye.join(this.dirname||"",n+(this.extname||""))}fail(n,t,r){let i=this.message(n,t,r);throw i.fatal=!0,i}info(n,t,r){let i=this.message(n,t,r);return i.fatal=void 0,i}message(n,t,r){let i=new W(n,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}};function Zr(e,n){if(e&&e.includes(ye.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+ye.sep+"`")}function ei(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function _s(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Ul(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var Fs=(function(e){let r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o});var Ql={}.hasOwnProperty,ii=class e extends Fs{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Gr()}copy(){let n=new e,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];n.use(...r)}return n.data((0,nr.default)(!0,{},this.namespace)),n}data(n,t){return typeof n=="string"?arguments.length===2?(ri("data",this.frozen),this.namespace[n]=t,this):Ql.call(this.namespace,n)&&this.namespace[n]||void 0:n?(ri("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;let n=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let i=t.call(n,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();let t=tr(n),r=this.parser||this.Parser;return ti("parse",r),r(String(t),t)}process(n,t){let r=this;return this.freeze(),ti("process",this.parser||this.Parser),ni("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(o,s){let a=tr(n),u=r.parse(a);r.run(u,a,function(c,h,p){if(c||!h||!p)return l(c);let f=h,I=r.stringify(f,p);Wl(I)?p.value=I:p.result=I,l(c,p)});function l(c,h){c||!h?s(c):o?o(h):t(void 0,h)}}}processSync(n){let t=!1,r;return this.freeze(),ti("processSync",this.parser||this.Parser),ni("processSync",this.compiler||this.Compiler),this.process(n,i),Os("processSync","process",t),r;function i(o,s){t=!0,Jr(o),r=s}}run(n,t,r){Ms(n),this.freeze();let i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?o(void 0,r):new Promise(o);function o(s,a){let u=tr(t);i.run(n,u,l);function l(c,h,p){let f=h||n;c?a(c):s?s(f):r(void 0,f,p)}}}runSync(n,t){let r=!1,i;return this.run(n,t,o),Os("runSync","run",r),i;function o(s,a){Jr(s),i=a,r=!0}}stringify(n,t){this.freeze();let r=tr(t),i=this.compiler||this.Compiler;return ni("stringify",i),Ms(n),i(n,r)}use(n,...t){let r=this.attachers,i=this.namespace;if(ri("use",this.frozen),n!=null)if(typeof n=="function")u(n,t);else if(typeof n=="object")Array.isArray(n)?a(n):s(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function o(l){if(typeof l=="function")u(l,[]);else if(typeof l=="object")if(Array.isArray(l)){let[c,...h]=l;u(c,h)}else s(l);else throw new TypeError("Expected usable value, not `"+l+"`")}function s(l){if(!("plugins"in l)&&!("settings"in l))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(l.plugins),l.settings&&(i.settings=(0,nr.default)(!0,i.settings,l.settings))}function a(l){let c=-1;if(l!=null)if(Array.isArray(l))for(;++c<l.length;){let h=l[c];o(h)}else throw new TypeError("Expected a list of plugins, not `"+l+"`")}function u(l,c){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===l){p=h;break}if(p===-1)r.push([l,...c]);else if(c.length>0){let[f,...I]=c,v=r[p][1];cn(v)&&cn(f)&&(f=(0,nr.default)(!0,v,f)),r[p]=[l,f,...I]}}}},pn=new ii().freeze();function ti(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ni(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ri(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ms(e){if(!cn(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Os(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function tr(e){return Kl(e)?e:new hn(e)}function Kl(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wl(e){return typeof e=="string"||Yl(e)}function Yl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var pe=class{constructor(n,t,r={}){this.match=n,this.match=n,this.handler=typeof t=="string"?Jl(t):t,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}};function Jl(e){return function(n,t,r,i){let o=e;if(t[1]){let s=t[0].lastIndexOf(t[1]);o+=t[0].slice(s+t[1].length),r+=s;let a=r-i;a>0&&(o=t[0].slice(s-a,s)+o,r=i)}return n.tr.insertText(o,r,i)}}var Rs=(e,n)=>{let t=e.plugins;for(let r=0;r<t.length;r++){let i=t[r],o;if(i.spec.isInputRules&&(o=i.getState(e))){if(n){let s=e.tr,a=o.transform;for(let u=a.steps.length-1;u>=0;u--)s.step(a.steps[u].invert(a.docs[u]));if(o.text){let u=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,e.schema.text(o.text,u))}else s.delete(o.from,o.to);n(s)}return!0}}return!1},kx=new pe(/--$/,"\u2014",{inCodeMark:!1}),yx=new pe(/\.\.\.$/,"\u2026",{inCodeMark:!1}),wx=new pe(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),bx=new pe(/"$/,"\u201D",{inCodeMark:!1}),Sx=new pe(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),Cx=new pe(/'$/,"\u2019",{inCodeMark:!1});function Ix(e,n,t=null,r){return new pe(e,(i,o,s,a)=>{let u=t instanceof Function?t(o):t,l=i.tr.delete(s,a),c=l.doc.resolve(s),h=c.blockRange(),p=h&&Hi(h,n,u);if(!p)return null;l.wrap(h,p);let f=l.doc.resolve(s-1).nodeBefore;return f&&f.type==n&&$i(l.doc,s-1)&&(!r||r(o,f))&&l.join(s-1),l})}function Ex(e,n,t=null){return new pe(e,(r,i,o,s)=>{let a=r.doc.resolve(o),u=t instanceof Function?t(i):t;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),n)?r.tr.delete(o,s).setBlockType(o,o,n,u):null})}var Ve=typeof navigator<"u"?navigator:null,Ls=typeof document<"u"?document:null,qe=Ve&&Ve.userAgent||"",si=/Edge\/(\d+)/.exec(qe),Vs=/MSIE \d/.exec(qe),ai=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qe),rr=!!(Vs||ai||si),Gl=Vs?document.documentMode:ai?+ai[1]:si?+si[1]:0,qs=!rr&&/gecko\/(\d+)/i.test(qe),Xl=qs&&+(/Firefox\/(\d+)/.exec(qe)||[0,0])[1],ui=!rr&&/Chrome\/(\d+)/.exec(qe),Hs=!!ui,Zl=ui?+ui[1]:0,$s=!rr&&!!Ve&&/Apple Computer/.test(Ve.vendor),Us=$s&&(/Mobile\/\w+/.test(qe)||!!Ve&&Ve.maxTouchPoints>2),ec=Us||(Ve?/Mac/.test(Ve.platform):!1),Qs=/Android \d/.test(qe),Ks=!!Ls&&"webkitFontSmoothing"in Ls.documentElement.style,tc=Ks?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,_x=Object.freeze({__proto__:null,android:Qs,chrome:Hs,chrome_version:Zl,gecko:qs,gecko_version:Xl,ie:rr,ie_version:Gl,ios:Us,mac:ec,safari:$s,webkit:Ks,webkit_version:tc});function oi(e,n,t,r,i,o){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(n);if(a.parent.type.spec.code)return!1;let u=a.parent.textBetween(Math.max(0,a.parentOffset-500),a.parentOffset,void 0,"\uFFFC")+r;for(let l of i){let c=l,h=c.match.exec(u),p=h&&h[0]&&c.handler(s,h,n-(h[0].length-r.length),t);if(p)return c.undoable!==!1&&p.setMeta(o,{transform:p,from:n,to:t,text:r}),e.dispatch(p),!0}return!1}var nc=new Jt("MILKDOWN_CUSTOM_INPUTRULES");function Ws({rules:e}){let n=new Yt({key:nc,isInputRules:!0,state:{init(){return null},apply(t,r){let i=t.getMeta(this);return i||(t.selectionSet||t.docChanged?null:r)}},props:{handleTextInput(t,r,i,o){return oi(t,r,i,o,e,n)},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{let{$cursor:r}=t.state.selection;r&&oi(t,r.pos,r.pos,"",e,n)}),!1),keydown:(t,r)=>!(Qs&&Hs&&r.key==="Enter")||t.composing?!1:t.someProp("handleKeyDown",i=>i(t,r))?(r.preventDefault(),!0):!1},handleKeyDown(t,r){if(r.key!=="Enter")return!1;let{$cursor:i}=t.state.selection;return i?oi(t,i.pos,i.pos,`
|
|
35
|
+
`,e,n):!1}}});return n}function Ys(e){return e.some(n=>n.type.spec.code)}function Bs(e,n,t){if(n>=t)return!1;let r=!1;return e.doc.nodesBetween(n,t,i=>(i.isInline&&Ys(i.marks)&&(r=!0),!r)),r}function rc(e,n){var t;return Ys((t=e.storedMarks)!=null?t:e.doc.resolve(n).marks())}function Fx(e,n,t={}){return new pe(e,(r,i,o,s)=>{var a,u,l,c;let{tr:h}=r,p=i.length,f=i[p-1],I=i[0],v=[],R,w={group:f,fullMatch:I,start:o,end:s},q=(a=t.updateCaptured)==null?void 0:a.call(t,w);if(Object.assign(w,q),{group:f,fullMatch:I,start:o,end:s}=w,I===null||f?.trim()==="")return null;if(f){let E=I.search(/\S/),L=o+I.indexOf(f),N=L+f.length,k=Bs(r,o+E,L),j=N<s&&Bs(r,N,s);if(k||j||rc(r,s))return null;v=(u=h.storedMarks)!=null?u:[],N<s&&h.delete(N,s),L>o&&h.delete(o+E,L),R=o+E+f.length;let $=(l=t.getAttr)==null?void 0:l.call(t,i);h.addMark(o,R,n.create($)),h.setStoredMarks(v),(c=t.beforeDispatch)==null||c.call(t,{match:i,start:o,end:s,tr:h})}return h})}var ic=Object.defineProperty,oc=Object.defineProperties,sc=Object.getOwnPropertyDescriptors,Ns=Object.getOwnPropertySymbols,ac=Object.prototype.hasOwnProperty,uc=Object.prototype.propertyIsEnumerable,js=(e,n,t)=>n in e?ic(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,lc=(e,n)=>{for(var t in n||(n={}))ac.call(n,t)&&js(e,t,n[t]);if(Ns)for(var t of Ns(n))uc.call(n,t)&&js(e,t,n[t]);return e},cc=(e,n)=>oc(e,sc(n));function Ds(e=0,n=0,t=0){return Math.min(Math.max(e,n),t)}function Mx(e,n,t){let i=e.state.doc.content.size,o=Ds(n,0,i),s=Ds(t,0,i),a=e.coordsAtPos(o),u=e.coordsAtPos(s,-1),l=Math.min(a.top,u.top),c=Math.max(a.bottom,u.bottom),h=Math.min(a.left,u.left),p=Math.max(a.right,u.right),f=p-h,I=c-l,w={top:l,bottom:c,left:h,right:p,width:f,height:I,x:h,y:l};return cc(lc({},w),{toJSON:()=>w})}function Ox(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function fc(e,n){return Array.isArray(e)&&e.includes(n.type)||n.type===e}function Rx(e){if(e.content.childCount===1){let n=e.content.firstChild;if(n?.type.name==="text"&&n.marks.length===0)return n;if(n?.type.name==="paragraph"&&n.childCount===1){let t=n.firstChild;if(t?.type.name==="text"&&t.marks.length===0)return t}}return!1}function hc(e){return n=>{for(let t=n.depth;t>0;t-=1){let r=n.node(t);if(e(r)){let i=n.before(t),o=n.after(t);return{from:i,to:o,node:r}}}}}function Lx(e,n){return hc(t=>t.type===n)(e)}function Bx(e,n){let t=n.nodes[e];if(!t)throw io("node",e);return t}function pc(e){return n=>{for(let t=n.depth;t>0;t--){let r=n.node(t);if(e(r))return{pos:n.before(t),start:n.start(t),depth:t,node:r}}}}function Nx(e){return n=>pc(e)(n.$from)}function jx(e,n){if(!(e instanceof mr))return;let{node:t,$from:r}=e;if(fc(n,t))return{node:t,pos:r.pos,start:r.start(r.depth),depth:r.depth}}var Dx=(e,n)=>{let{selection:t,doc:r}=e;if(t instanceof mr)return{hasNode:t.node.type===n,pos:t.from,target:t.node};let{from:i,to:o}=t,s=!1,a=-1,u=null;return r.nodesBetween(i,o,(l,c)=>u?!1:l.type===n?(s=!0,a=c,u=l,!1):!0),{hasNode:s,pos:a,target:u}};var Gs=class{},Xs=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw dr();return e}}},mc=class Zs extends Gs{constructor(n,t,r){super(),this.type=n,this.content=t,this.attrs=r}push(n,...t){this.content.push(n,...t)}pop(){return this.content.pop()}static create(n,t,r){return new Zs(n,t,r)}},we,Mt,mn,dn,gn,Ot,Rt,nt,ea=(nt=class extends Xs{constructor(t){super();C(this,we);C(this,Mt);C(this,mn);C(this,dn);C(this,gn);C(this,Ot);C(this,Rt);y(this,we,Fn.none),y(this,Mt,r=>r.isText),y(this,mn,(r,i)=>{if(g(this,Mt).call(this,r)&&g(this,Mt).call(this,i)&&Fn.sameSet(r.marks,i.marks))return this.schema.text(r.text+i.text,r.marks)}),y(this,dn,r=>{let i=Object.values({...this.schema.nodes,...this.schema.marks}).find(o=>o.spec.parseMarkdown.match(r));if(!i)throw no(r);return i}),y(this,gn,r=>{let i=g(this,dn).call(this,r);i.spec.parseMarkdown.runner(this,r,i)}),this.injectRoot=(r,i,o)=>(this.openNode(i,o),this.next(r.children),this),this.openNode=(r,i)=>(this.open(mc.create(r,[],i)),this),y(this,Ot,()=>{y(this,we,Fn.none);let r=this.close();return g(this,Rt).call(this,r.type,r.attrs,r.content)}),this.closeNode=()=>{try{g(this,Ot).call(this)}catch(r){console.error(r)}return this},y(this,Rt,(r,i,o)=>{let s=r.createAndFill(i,o,g(this,we));if(!s)throw to(r,i,o);return this.push(s),s}),this.addNode=(r,i,o)=>{try{g(this,Rt).call(this,r,i,o)}catch(s){console.error(s)}return this},this.openMark=(r,i)=>{let o=r.create(i);return y(this,we,o.addToSet(g(this,we))),this},this.closeMark=r=>(y(this,we,r.removeFromSet(g(this,we))),this),this.addText=r=>{try{let i=this.top();if(!i)throw dr();let o=i.pop(),s=this.schema.text(r,g(this,we));if(!o)return i.push(s),this;let a=g(this,mn).call(this,o,s);return a?(i.push(a),this):(i.push(o,s),this)}catch(i){return console.error(i),this}},this.build=()=>{let r;do r=g(this,Ot).call(this);while(this.size());return r},this.next=(r=[])=>([r].flat().forEach(i=>g(this,gn).call(this,i)),this),this.toDoc=()=>this.build(),this.run=(r,i)=>{let o=r.runSync(r.parse(i),i);return this.next(o),this},this.schema=t}},we=new WeakMap,Mt=new WeakMap,mn=new WeakMap,dn=new WeakMap,gn=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,nt.create=(t,r)=>{let i=new nt(t);return o=>(i.run(r,o),i.toDoc())},nt),rt,Js=(rt=class extends Gs{constructor(n,t,r,i={}){super(),this.type=n,this.children=t,this.value=r,this.props=i,this.push=(o,...s)=>{this.children||(this.children=[]),this.children.push(o,...s)},this.pop=()=>this.children?.pop()}},rt.create=(n,t,r,i={})=>new rt(n,t,r,i),rt),dc=e=>Object.prototype.hasOwnProperty.call(e,"size"),ne,Lt,xn,kn,yn,wn,Bt,Nt,bn,Sn,tt,He,Cn,jt,it,ta=(it=class extends Xs{constructor(t){super();C(this,ne);C(this,Lt);C(this,xn);C(this,kn);C(this,yn);C(this,wn);C(this,Bt);C(this,Nt);C(this,bn);C(this,Sn);C(this,tt);C(this,He);C(this,Cn);C(this,jt);y(this,ne,[]),y(this,Lt,r=>{let i=Object.values({...this.schema.nodes,...this.schema.marks}).find(o=>o.spec.toMarkdown.match(r));if(!i)throw ro(r.type);return i}),y(this,xn,r=>g(this,Lt).call(this,r).spec.toMarkdown.runner(this,r)),y(this,kn,(r,i)=>g(this,Lt).call(this,r).spec.toMarkdown.runner(this,r,i)),y(this,yn,r=>{let i=a=>a.type.spec.priority??50,o=[...r].sort((a,u)=>i(a)-i(u)),s=[];return g(this,ne).forEach(({mark:a})=>{let u=o.findIndex(l=>l.eq(a));u>=0&&s.push(...o.splice(u,1))}),s.concat(o)}),y(this,wn,r=>{let i=r?.marks,o=0;for(;o<g(this,ne).length;){let{mark:s,spanning:a}=g(this,ne)[o];if(a&&i?.some(u=>u.eq(s)))o++;else break}for(let s=g(this,ne).length-1;s>=o;s--)g(this,jt).call(this,g(this,ne)[s].mark)}),y(this,Bt,(r,i)=>{g(this,yn).call(this,r.marks).every(o=>!g(this,kn).call(this,o,r))&&g(this,xn).call(this,r),g(this,wn).call(this,i)}),y(this,Nt,r=>{let{children:i}=r;return i&&(r.children=i.reduce((o,s,a)=>{if(a===0)return[s];let u=o.at(-1);if(u&&u.isMark&&s.isMark){let{children:l,...c}=s,{children:h,...p}=u;if(s.type===u.type&&l&&h&&JSON.stringify(c)===JSON.stringify(p)){let f={...p,children:[...h,...l]};return o.slice(0,-1).concat(g(this,Nt).call(this,f))}}return o.concat(s)},[])),r}),y(this,bn,r=>{let i={...r.props,type:r.type};return r.children&&(i.children=r.children),r.value&&(i.value=r.value),i}),this.openNode=(r,i,o)=>(this.open(Js.create(r,void 0,i,o)),this),y(this,Sn,(r,i)=>{let o="",s="",a=r.children;if(a){let l=a[0],c=a.at(-1);if(c&&c.type==="text"&&c.value.endsWith(" ")){let h=c.value,p=h.trimEnd();s=h.slice(p.length),c.value=p}if(l&&l.type==="text"&&l.value.startsWith(" ")){let h=l.value,p=h.trimStart();o=h.slice(0,h.length-p.length),l.value=p}}o.length&&g(this,He).call(this,"text",void 0,o);let u=i();return s.length&&g(this,He).call(this,"text",void 0,s),u}),y(this,tt,(r=!1)=>{let i=this.close(),o=()=>g(this,He).call(this,i.type,i.children,i.value,i.props);return r?g(this,Sn).call(this,i,o):o()}),this.closeNode=()=>(g(this,tt).call(this),this),y(this,He,(r,i,o,s)=>{let a=Js.create(r,i,o,s),u=g(this,Nt).call(this,g(this,bn).call(this,a));return this.push(u),u}),this.addNode=(r,i,o,s)=>(g(this,He).call(this,r,i,o,s),this),y(this,Cn,(r,i,o,s)=>g(this,ne).some(a=>a.mark.eq(r))?this:(g(this,ne).push({mark:r,spanning:o==null}),this.openNode(i,o,{...s,isMark:!0}))),y(this,jt,r=>{let i=-1;for(let o=g(this,ne).length-1;o>=0;o--)if(g(this,ne)[o].mark.eq(r)){i=o;break}i<0||(g(this,ne).splice(i,1),g(this,tt).call(this,!0))}),this.withMark=(r,i,o,s)=>(g(this,Cn).call(this,r,i,o,s),this),this.closeMark=r=>(g(this,jt).call(this,r),this),this.build=()=>{let r=null;do r=g(this,tt).call(this);while(this.size());return r},this.next=r=>dc(r)?(r.forEach((i,o,s)=>{g(this,Bt).call(this,i,r.maybeChild(s+1)??void 0)}),this):(g(this,Bt).call(this,r),this),this.toString=r=>r.stringify(this.build()),this.run=r=>(y(this,ne,[]),this.next(r),this),this.schema=t}},ne=new WeakMap,Lt=new WeakMap,xn=new WeakMap,kn=new WeakMap,yn=new WeakMap,wn=new WeakMap,Bt=new WeakMap,Nt=new WeakMap,bn=new WeakMap,Sn=new WeakMap,tt=new WeakMap,He=new WeakMap,Cn=new WeakMap,jt=new WeakMap,it.create=(t,r)=>{let i=new it(t);return o=>(i.run(o),i.toString(r))},it);function Oe(e,n){return e.meta={package:"@milkdown/core",group:"System",...n},e}var aa={text:(e,n,t,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:t.safe(i,{...r,encode:[]})},strong:(e,n,t,r)=>{let i=e.marker||t.options.strong||"*",o=t.enter("strong"),s=t.createTracker(r),a=s.move(i+i);return a+=s.move(t.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i+i),o(),a},emphasis:(e,n,t,r)=>{let i=e.marker||t.options.emphasis||"*",o=t.enter("emphasis"),s=t.createTracker(r),a=s.move(i);return a+=s.move(t.containerPhrasing(e,{before:a,after:i,...s.current()})),a+=s.move(i),o(),a}},Dt=O({},"editorView"),In=O({},"editorState"),li=O([],"initTimer"),na=O({},"editor"),Ti=O([],"inputRules"),vn=O([],"prosePlugins"),Ai=O([],"remarkPlugins"),Pi=O([],"nodeView"),zi=O([],"markView"),ct=O(pn().use(vt).use(_t),"remark"),ci=O({handlers:aa,encode:[]},"remarkStringifyOptions"),ir=ke("ConfigReady");function gc(e){let n=t=>(t.record(ir),async()=>(await e(t),t.done(ir),()=>{t.clearTimer(ir)}));return Oe(n,{displayName:"Config"}),n}var En=ke("InitReady");function xc(e){let n=t=>(t.inject(na,e).inject(vn,[]).inject(Ai,[]).inject(Ti,[]).inject(Pi,[]).inject(zi,[]).inject(ci,{handlers:aa,encode:[]}).inject(ct,pn().use(vt).use(_t)).inject(li,[ir]).record(En),async()=>{await t.waitTimers(li);let r=t.get(ci);return t.set(ct,pn().use(vt).use(_t,r)),t.done(En),()=>{t.remove(na).remove(vn).remove(Ai).remove(Ti).remove(Pi).remove(zi).remove(ci).remove(ct).remove(li).clearTimer(En)}});return Oe(n,{displayName:"Init"}),n}var be=ke("SchemaReady"),fi=O([],"schemaTimer"),Vt=O({},"schema"),hi=O([],"nodes"),pi=O([],"marks");function ra(e){return{...e,parseDOM:e.parseDOM?.map(n=>({priority:e.priority,...n}))}}var ua=e=>(e.inject(Vt,{}).inject(hi,[]).inject(pi,[]).inject(fi,[En]).record(be),async()=>{await e.waitTimers(fi);let n=e.get(ct),t=e.get(Ai).reduce((s,a)=>s.use(a.plugin,a.options),n);e.set(ct,t);let r=Object.fromEntries(e.get(hi).map(([s,a])=>[s,ra(a)])),i=Object.fromEntries(e.get(pi).map(([s,a])=>[s,ra(a)])),o=new Vi({nodes:r,marks:i});return e.set(Vt,o),e.done(be),()=>{e.remove(Vt).remove(hi).remove(pi).remove(fi).clearTimer(be)}});Oe(ua,{displayName:"Schema"});var ot,me,oa,la=(oa=class{constructor(){C(this,ot);C(this,me);y(this,ot,new gr),y(this,me,null),this.setCtx=e=>{y(this,me,e)},this.chain=()=>{if(g(this,me)==null)throw Rn();let e=g(this,me),n=[],t=this.get.bind(this),r={run:()=>{let o=Mn(...n),s=e.get(Dt);return o(s.state,s.dispatch,s)},inline:o=>(n.push(o),r),pipe:i.bind(this)};function i(o,s){let a=t(o);return n.push(a(s)),r}return r}}get ctx(){return g(this,me)}create(e,n){let t=e.create(g(this,ot).sliceMap);return t.set(n),t}get(e){return g(this,ot).get(e).get()}remove(e){return g(this,ot).remove(e)}call(e,n){if(g(this,me)==null)throw Rn();let t=this.get(e)(n),r=g(this,me).get(Dt);return t(r.state,r.dispatch,r)}inline(e){if(g(this,me)==null)throw Rn();let n=g(this,me).get(Dt);return e(n.state,n.dispatch,n)}},ot=new WeakMap,me=new WeakMap,oa);function ak(e="cmdKey"){return O((()=>()=>!1),e)}var ia=O(new la,"commands"),mi=O([be],"commandsTimer"),or=ke("CommandsReady"),ca=e=>{let n=new la;return n.setCtx(e),e.inject(ia,n).inject(mi,[be]).record(or),async()=>(await e.waitTimers(mi),e.done(or),()=>{e.remove(ia).remove(mi).clearTimer(or)})};Oe(ca,{displayName:"Commands"});function kc(e){return e.Backspace=Mn(Rs,Qi,Ki,Wi),e}var st,re,sa,fa=(sa=class{constructor(){C(this,st);C(this,re);y(this,st,null),y(this,re,[]),this.setCtx=e=>{y(this,st,e)},this.add=e=>(g(this,re).push(e),()=>{y(this,re,g(this,re).filter(n=>n!==e))}),this.addObjectKeymap=e=>{let n=[];return Object.entries(e).forEach(([t,r])=>{if(typeof r=="function"){let i={key:t,onRun:()=>r};g(this,re).push(i),n.push(()=>{y(this,re,g(this,re).filter(o=>o!==i))})}else g(this,re).push(r),n.push(()=>{y(this,re,g(this,re).filter(i=>i!==r))})}),()=>{n.forEach(t=>t())}},this.addBaseKeymap=()=>{let e=kc(Yi);return this.addObjectKeymap(e)},this.build=()=>{let e={};return g(this,re).forEach(n=>{e[n.key]=[...e[n.key]||[],n]}),Object.fromEntries(Object.entries(e).map(([n,t])=>{let r=t.sort((o,s)=>(s.priority??50)-(o.priority??50));return[n,(o,s,a)=>{let u=g(this,st);if(u==null)throw pt();let l=r.map(c=>c.onRun(u));return Mn(...l)(o,s,a)}]}))}}get ctx(){return g(this,st)}},st=new WeakMap,re=new WeakMap,sa),_i=O(new fa,"keymap"),di=O([be],"keymapTimer"),sr=ke("KeymapReady"),yc=e=>{let n=new fa;return n.setCtx(e),e.inject(_i,n).inject(di,[be]).record(sr),async()=>(await e.waitTimers(di),e.done(sr),()=>{e.remove(_i).remove(di).clearTimer(sr)})},ar=ke("ParserReady"),ha=(()=>{throw pt()}),ur=O(ha,"parser"),gi=O([],"parserTimer"),pa=e=>(e.inject(ur,ha).inject(gi,[be]).record(ar),async()=>{await e.waitTimers(gi);let n=e.get(ct),t=e.get(Vt);return e.set(ur,ea.create(t,n)),e.done(ar),()=>{e.remove(ur).remove(gi).clearTimer(ar)}});Oe(pa,{displayName:"Parser"});var lr=ke("SerializerReady"),xi=O([],"serializerTimer"),ma=(()=>{throw pt()}),ki=O(ma,"serializer"),da=e=>(e.inject(ki,ma).inject(xi,[be]).record(lr),async()=>{await e.waitTimers(xi);let n=e.get(ct),t=e.get(Vt);return e.set(ki,ta.create(t,n)),e.done(lr),()=>{e.remove(ki).remove(xi).clearTimer(lr)}});Oe(da,{displayName:"Serializer"});var yi=O("","defaultValue"),wi=O(e=>e,"stateOptions"),bi=O([],"editorStateTimer"),cr=ke("EditorStateReady");function wc(e,n,t){if(typeof e=="string")return n(e);if(e.type==="html")return qi.fromSchema(t).parse(e.dom);if(e.type==="json")return Di.fromJSON(t,e.value);throw Xi(e)}var bc=new Jt("MILKDOWN_STATE_TRACKER"),ga=e=>(e.inject(yi,"").inject(In,{}).inject(wi,n=>n).inject(bi,[ar,lr,or,sr]).record(cr),async()=>{await e.waitTimers(bi);let n=e.get(Vt),t=e.get(ur),r=e.get(Ti),i=e.get(wi),o=e.get(vn),s=wc(e.get(yi),t,n),a=e.get(_i),u=a.addBaseKeymap(),l=[...o,new Yt({key:bc,state:{init:()=>{},apply:(p,f,I,v)=>{e.set(In,v)}}}),Ws({rules:r}),Ji(a.build())];e.set(vn,l);let c=i({schema:n,doc:s,plugins:l}),h=Ui.create(c);return e.set(In,h),e.done(cr),()=>{u(),e.remove(yi).remove(In).remove(wi).remove(bi).clearTimer(cr)}});Oe(ga,{displayName:"EditorState"});var Fi=O([],"pasteRule"),Si=O([be],"pasteRuleTimer"),fr=ke("PasteRuleReady"),xa=e=>(e.inject(Fi,[]).inject(Si,[be]).record(fr),async()=>(await e.waitTimers(Si),e.done(fr),()=>{e.remove(Fi).remove(Si).clearTimer(fr)}));Oe(xa,{displayName:"PasteRule"});var Ci=ke("EditorViewReady"),Ii=O([],"editorViewTimer"),Ei=O({},"editorViewOptions"),vi=O(null,"root"),Mi=O(null,"rootDOM"),Oi=O({},"rootAttrs");function Sc(e,n){let t=document.createElement("div");t.className="milkdown",e.appendChild(t),n.set(Mi,t);let r=n.get(Oi);return Object.entries(r).forEach(([i,o])=>t.setAttribute(i,o)),t}function Cc(e){e.classList.add("editor"),e.setAttribute("role","textbox")}var Ic=new Jt("MILKDOWN_VIEW_CLEAR"),ka=e=>(e.inject(vi,document.body).inject(Dt,{}).inject(Ei,{}).inject(Mi,null).inject(Oi,{}).inject(Ii,[cr,fr]).record(Ci),async()=>{await e.wait(En);let n=e.get(vi)||document.body,t=typeof n=="string"?document.querySelector(n):n;e.update(vn,u=>[new Yt({key:Ic,view:l=>{let c=t?Sc(t,e):void 0;return(()=>{if(c&&t){let p=l.dom;t.replaceChild(c,p),c.appendChild(p)}})(),{destroy:()=>{c?.parentNode&&c?.parentNode.replaceChild(l.dom,c),c?.remove()}}}}),...u]),await e.waitTimers(Ii);let r=e.get(In),i=e.get(Ei),o=Object.fromEntries(e.get(Pi)),s=Object.fromEntries(e.get(zi)),a=new Gi(t,{state:r,nodeViews:o,markViews:s,transformPasted:(u,l,c)=>(e.get(Fi).sort((h,p)=>(p.priority??50)-(h.priority??50)).map(h=>h.run).forEach(h=>{u=h(u,l,c)}),u),...i});return Cc(a.dom),e.set(Dt,a),e.done(Ci),()=>{a?.destroy(),e.remove(vi).remove(Dt).remove(Ei).remove(Mi).remove(Oi).remove(Ii).clearTimer(Ci)}});Oe(ka,{displayName:"EditorView"});var uk=(function(e){return e.Idle="Idle",e.OnCreate="OnCreate",e.Created="Created",e.OnDestroy="OnDestroy",e.Destroyed="Destroyed",e})({}),at,le,Fe,qt,Tn,An,ie,Me,ut,Pn,lt,Ht,zn,$e,$t,Ut,lk=(Ut=class{constructor(){C(this,at);C(this,le);C(this,Fe);C(this,qt);C(this,Tn);C(this,An);C(this,ie);C(this,Me);C(this,ut);C(this,Pn);C(this,lt);C(this,Ht);C(this,zn);C(this,$e);C(this,$t);y(this,at,!1),y(this,le,"Idle"),y(this,Fe,[]),y(this,qt,()=>{}),y(this,Tn,new gr),y(this,An,new lo),y(this,ie,new Map),y(this,Me,new Map),y(this,ut,new uo(g(this,Tn),g(this,An))),y(this,Pn,()=>{let n=gc(async r=>{await Promise.all(g(this,Fe).map(i=>Promise.resolve(i(r))))}),t=[ua,pa,da,ca,yc,xa,ga,ka,xc(this),n];g(this,lt).call(this,t,g(this,Me))}),y(this,lt,(n,t)=>{n.forEach(r=>{let i=g(this,ut).produce(g(this,at)?r.meta:void 0),o=r(i);t.set(r,{ctx:i,handler:o,cleanup:void 0})})}),y(this,Ht,(n,t=!1)=>Promise.all([n].flat().map(async r=>{let i=g(this,ie).get(r)?.cleanup;return t?g(this,ie).delete(r):g(this,ie).set(r,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof i=="function"?i():i}))),y(this,zn,async()=>{await Promise.all([...g(this,Me).entries()].map(async([n,{cleanup:t}])=>typeof t=="function"?t():t)),g(this,Me).clear()}),y(this,$e,n=>{y(this,le,n),g(this,qt).call(this,n)}),y(this,$t,n=>[...n.entries()].map(async([t,r])=>{let{ctx:i,handler:o}=r;if(!o)return;let s=await o();n.set(t,{ctx:i,handler:o,cleanup:s})})),this.enableInspector=(n=!0)=>(y(this,at,n),this),this.onStatusChange=n=>(y(this,qt,n),this),this.config=n=>(g(this,Fe).push(n),this),this.removeConfig=n=>(y(this,Fe,g(this,Fe).filter(t=>t!==n)),this),this.use=n=>{let t=[n].flat();return t.flat().forEach(r=>{g(this,ie).set(r,{ctx:void 0,handler:void 0,cleanup:void 0})}),g(this,le)==="Created"&&g(this,lt).call(this,t,g(this,ie)),this},this.remove=async n=>g(this,le)==="OnCreate"?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(n))},50)})):(await g(this,Ht).call(this,[n].flat(),!0),this),this.create=async()=>g(this,le)==="OnCreate"?this:(g(this,le)==="Created"&&await this.destroy(),g(this,$e).call(this,"OnCreate"),g(this,Pn).call(this),g(this,lt).call(this,[...g(this,ie).keys()],g(this,ie)),await Promise.all([g(this,$t).call(this,g(this,Me)),g(this,$t).call(this,g(this,ie))].flat()),g(this,$e).call(this,"Created"),this),this.destroy=async(n=!1)=>g(this,le)==="Destroyed"||g(this,le)==="OnDestroy"?this:g(this,le)==="OnCreate"?new Promise(t=>{setTimeout(()=>{t(this.destroy(n))},50)}):(n&&y(this,Fe,[]),g(this,$e).call(this,"OnDestroy"),await g(this,Ht).call(this,[...g(this,ie).keys()],n),await g(this,zn).call(this),g(this,$e).call(this,"Destroyed"),this),this.action=n=>n(g(this,ut)),this.inspect=()=>g(this,at)?[...g(this,Me).values(),...g(this,ie).values()].map(({ctx:n})=>n?.inspector?.read()).filter(n=>!!n):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new Ut}get ctx(){return g(this,ut)}get status(){return g(this,le)}},at=new WeakMap,le=new WeakMap,Fe=new WeakMap,qt=new WeakMap,Tn=new WeakMap,An=new WeakMap,ie=new WeakMap,Me=new WeakMap,ut=new WeakMap,Pn=new WeakMap,lt=new WeakMap,Ht=new WeakMap,zn=new WeakMap,$e=new WeakMap,$t=new WeakMap,Ut);export{za as a,Ec as b,vc as c,Tc as d,Ac as e,O as f,ke as g,J as h,mo as i,_e as j,ae as k,te as l,nn as m,S as n,Q as o,A as p,yo as q,wo as r,z as s,It as t,Et as u,Ne as v,Pt as w,Gn as x,Br as y,Nr as z,Wr as A,pe as B,Ix as C,Ex as D,_x as E,Fx as F,Mx as G,Ox as H,Rx as I,hc as J,Lx as K,Bx as L,pc as M,Nx as N,jx as O,Dx as P,Dt as Q,In as R,li as S,na as T,Ti as U,vn as V,Ai as W,Pi as X,zi as Y,ct as Z,ci as _,ir as $,gc as aa,En as ba,xc as ca,be as da,fi as ea,Vt as fa,hi as ga,pi as ha,ua as ia,la as ja,ak as ka,ia as la,mi as ma,or as na,ca as oa,fa as pa,_i as qa,di as ra,sr as sa,yc as ta,ar as ua,ur as va,gi as wa,pa as xa,lr as ya,xi as za,ki as Aa,da as Ba,yi as Ca,wi as Da,bi as Ea,cr as Fa,wc as Ga,ga as Ha,Fi as Ia,Si as Ja,fr as Ka,xa as La,Ci as Ma,Ii as Na,Ei as Oa,vi as Pa,Mi as Qa,Oi as Ra,ka as Sa,uk as Ta,lk as Ua};
|