@mintlify/cli 4.1.66 → 4.1.68

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.
@@ -0,0 +1,7 @@
1
+ import { createRequire as __mintCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __mintFileURLToPath } from 'node:url';
3
+ import { dirname as __mintDirname } from 'node:path';
4
+ const require = __mintCreateRequire(import.meta.url);
5
+ const __filename = __mintFileURLToPath(import.meta.url);
6
+ const __dirname = __mintDirname(__filename);
7
+ export{t as clearConfigValue,n as getAgentSiteMetadata,r as getConfigValue,i as getUpdateState,a as hasShownPublishPrompt,o as isTelemetryEnabled,s as markPublishPromptShown,c as setAgentSiteMetadata,l as setConfigValue,u as setTelemetryEnabled,d as setUpdateState}from"./config-Cx8OxEon.js";
@@ -4,7 +4,7 @@ import { dirname as __mintDirname } from 'node:path';
4
4
  const require = __mintCreateRequire(import.meta.url);
5
5
  const __filename = __mintFileURLToPath(import.meta.url);
6
6
  const __dirname = __mintDirname(__filename);
7
- import{I as e,O as t,P as n,d as r,k as i,s as a}from"./utils-Dps9hFB1.js";import{I as o,N as s,P as c,S as l,T as u,_ as d,b as f,c as p,f as m,g as h,l as g,m as _,o as v,x as y}from"./micromark-extension-mdxjs-BEBdzW1n.js";import{n as b}from"./currencyMath-ssJIW64e.js";import{i as x,n as S,r as ee,t as te}from"./schemas-BHU5QcPi.js";import{n as ne,t as re}from"./lib-g4r7PSeX.js";function ie(){return[l(),y(),f(),d(),h()]}var ae=n();function oe(e,t){let n=e.position?.start.offset,r=e.position?.end.offset;return typeof n==`number`&&typeof r==`number`?t.slice(n,r):``}function se(e,t){if(!t)return;let n=e.at(-1);n?.type===`text`?n.value+=t:e.push({type:`text`,value:t})}const ce=/^([a-z][a-z\d+.-]*):/i,le=/* @__PURE__ */ new Set([`http`,`https`,`mailto`,`tel`]);function ue(e){let t=ce.exec(e.replace(/[\u0000- ]/g,``))?.[1];return!t||le.has(t.toLowerCase())}function de(e,t){let n=oe(e,t),r=e.url.trim();return n.startsWith(`[`)&&r.length>0&&ue(r)&&(/^(?:https?:\/\/|mailto:|tel:|\/|#|\.\.?\/)/i.test(r)||r.includes(`/`)||/^[^\s@]+\.[^\s]+$/u.test(r))}function fe(e,t){let n=[];for(let r of e)switch(r.type){case`text`:se(n,r.value.replace(/\n/g,` `));break;case`inlineCode`:n.push({type:`inlineCode`,value:r.value});break;case`strong`:case`emphasis`:case`delete`:n.push(Object.assign(Object.assign({},r),{children:fe(r.children,t)}));break;case`link`:de(r,t)?n.push(Object.assign(Object.assign({},r),{children:fe(r.children,t)})):se(n,oe(r,t));break;default:se(n,oe(r,t))}return n}const pe=/[\\&*_`[\]!<>~@\0\t\n\r]|:\/\/|www\.|\s$/i;function me(e){if(!e)return[];if(!pe.test(e))return[{type:`text`,value:e}];try{let t=`title: `,n=`${t}${e.replace(/\n/g,` `)}`,r=u(n,{extensions:[_()],mdastExtensions:[ie()]}),i=r.children.length===1?r.children[0]:void 0;if(i?.type!==`paragraph`)return[{type:`text`,value:e}];let a=fe(i.children,n),o=a[0];return o?.type!==`text`||!o.value.startsWith(t)?[{type:`text`,value:e}]:(o.value=o.value.slice(7),o.value||a.shift(),a)}catch{return[{type:`text`,value:e}]}}function he(e){return r({type:`paragraph`,children:me(e)})}function ge(e){this.content=e}ge.prototype={constructor:ge,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new ge(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new ge(n)},addToStart:function(e,t){return new ge([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ge(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new ge(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=ge.from(e),e.size?new ge(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ge.from(e),e.size?new ge(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ge.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},ge.from=function(e){if(e instanceof ge)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ge(t)};function _e(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a)n+=i.nodeSize;else{if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=_e(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}}function ve(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s)n-=c,r-=c;else{if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=ve(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}}var ye=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return _e(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ve(this,e,t,n)}findIndex(e){if(e==0)return xe(0,e);if(e==this.size)return xe(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?xe(t+1,i):xe(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};ye.empty=new ye([],0);const be={index:0,offset:0};function xe(e,t){return be.index=e,be.offset=t,be}function Se(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Se(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Se(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Ce=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Se(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Ce.none=[];var we=class extends Error{},Te=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=De(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Ee(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(ye.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};Te.empty=new Te(ye.empty,0,0);function Ee(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Ee(a.content,t-i-1,n-i-1)))}function De(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=De(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function Oe(e,t,n){if(n.openStart>e.depth)throw new we(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new we(`Inconsistent open depths`);return ke(e,t,n,0)}function ke(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ke(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Pe(a,C(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Pe(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Ie(n,e);return Pe(a,Fe(e,i,o,t,r))}}function Ae(e,t){if(!t.type.compatibleContent(e.type))throw new we(`Cannot join `+t.type.name+` onto `+e.type.name)}function je(e,t,n){let r=e.node(n);return Ae(r,t.node(n)),r}function Me(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ne(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Me(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Me(i.child(e),r);t&&t.depth==n&&t.textOffset&&Me(t.nodeBefore,r)}function Pe(e,t){return e.type.checkContent(t),e.copy(t)}function Fe(e,t,n,r,i){let a=e.depth>i&&je(e,t,i+1),o=r.depth>i&&je(n,r,i+1),s=[];return Ne(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ae(a,o),Me(Pe(a,Fe(e,t,n,r,i+1)),s)):(a&&Me(Pe(a,C(e,t,i+1)),s),Ne(t,n,i,s),o&&Me(Pe(o,C(n,r,i+1)),s)),Ne(r,null,i,s),new ye(s)}function C(e,t,n){let r=[];return Ne(null,e,n,r),e.depth>n&&Me(Pe(je(e,t,n+1),C(e,t,n+1)),r),Ne(t,null,n,r),new ye(r)}function Ie(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(ye.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Le=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ce.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive!==!1||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive!==!1||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Be(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=w.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else w.set(t,r=new Re);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%ze,i}},Re=class{constructor(){this.elts=[],this.i=0}};const ze=12,w=/* @__PURE__ */ new WeakMap;var Be=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const Ve=Object.create(null);var He=class e{constructor(e,t,n,r=Ce.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||ye.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Se(this.attrs,t||e.defaultAttrs||Ve)&&Ce.sameSet(this.marks,n||Ce.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Te.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Te(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Oe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Le.resolveCached(this,e)}resolveNoCache(e){return Le.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),We(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=ye.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ce.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ce.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=ye.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};He.prototype.text=void 0;var Ue=class e extends He{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):We(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function We(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Ge=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ke(t,n);if(r.next==null)return e.empty;let i=qe(r);r.next&&r.err(`Unexpected trailing text`);let a=tt(Qe(i));return nt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return ye.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];a.isLeaf||a.hasRequiredAttrs()||a.name in t||r.type&&!o.validEnd||(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
7
+ import{I as e,O as t,P as n,d as r,k as i,s as a}from"./utils-Dps9hFB1.js";import{I as o,N as s,P as c,S as l,T as u,_ as d,b as f,c as p,f as m,g as h,l as g,m as _,o as v,x as y}from"./micromark-extension-mdxjs-BEBdzW1n.js";import{n as b}from"./currencyMath-ssJIW64e.js";import{i as x,n as S,r as ee,t as te}from"./schemas-CVKidklE.js";import{n as ne,t as re}from"./lib-g4r7PSeX.js";function ie(){return[l(),y(),f(),d(),h()]}var ae=n();function oe(e,t){let n=e.position?.start.offset,r=e.position?.end.offset;return typeof n==`number`&&typeof r==`number`?t.slice(n,r):``}function se(e,t){if(!t)return;let n=e.at(-1);n?.type===`text`?n.value+=t:e.push({type:`text`,value:t})}const ce=/^([a-z][a-z\d+.-]*):/i,le=/* @__PURE__ */ new Set([`http`,`https`,`mailto`,`tel`]);function ue(e){let t=ce.exec(e.replace(/[\u0000- ]/g,``))?.[1];return!t||le.has(t.toLowerCase())}function de(e,t){let n=oe(e,t),r=e.url.trim();return n.startsWith(`[`)&&r.length>0&&ue(r)&&(/^(?:https?:\/\/|mailto:|tel:|\/|#|\.\.?\/)/i.test(r)||r.includes(`/`)||/^[^\s@]+\.[^\s]+$/u.test(r))}function fe(e,t){let n=[];for(let r of e)switch(r.type){case`text`:se(n,r.value.replace(/\n/g,` `));break;case`inlineCode`:n.push({type:`inlineCode`,value:r.value});break;case`strong`:case`emphasis`:case`delete`:n.push(Object.assign(Object.assign({},r),{children:fe(r.children,t)}));break;case`link`:de(r,t)?n.push(Object.assign(Object.assign({},r),{children:fe(r.children,t)})):se(n,oe(r,t));break;default:se(n,oe(r,t))}return n}const pe=/[\\&*_`[\]!<>~@\0\t\n\r]|:\/\/|www\.|\s$/i;function me(e){if(!e)return[];if(!pe.test(e))return[{type:`text`,value:e}];try{let t=`title: `,n=`${t}${e.replace(/\n/g,` `)}`,r=u(n,{extensions:[_()],mdastExtensions:[ie()]}),i=r.children.length===1?r.children[0]:void 0;if(i?.type!==`paragraph`)return[{type:`text`,value:e}];let a=fe(i.children,n),o=a[0];return o?.type!==`text`||!o.value.startsWith(t)?[{type:`text`,value:e}]:(o.value=o.value.slice(7),o.value||a.shift(),a)}catch{return[{type:`text`,value:e}]}}function he(e){return r({type:`paragraph`,children:me(e)})}function ge(e){this.content=e}ge.prototype={constructor:ge,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new ge(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new ge(n)},addToStart:function(e,t){return new ge([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ge(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new ge(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=ge.from(e),e.size?new ge(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=ge.from(e),e.size?new ge(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ge.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},ge.from=function(e){if(e instanceof ge)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ge(t)};function _e(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a)n+=i.nodeSize;else{if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=_e(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}}function ve(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s)n-=c,r-=c;else{if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=ve(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}}var ye=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return _e(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return ve(this,e,t,n)}findIndex(e){if(e==0)return xe(0,e);if(e==this.size)return xe(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?xe(t+1,i):xe(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};ye.empty=new ye([],0);const be={index:0,offset:0};function xe(e,t){return be.index=e,be.offset=t,be}function Se(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Se(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Se(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Ce=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Se(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Ce.none=[];var we=class extends Error{},Te=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=De(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Ee(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(ye.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};Te.empty=new Te(ye.empty,0,0);function Ee(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Ee(a.content,t-i-1,n-i-1)))}function De(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=De(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function Oe(e,t,n){if(n.openStart>e.depth)throw new we(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new we(`Inconsistent open depths`);return ke(e,t,n,0)}function ke(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ke(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Pe(a,C(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Pe(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Ie(n,e);return Pe(a,Fe(e,i,o,t,r))}}function Ae(e,t){if(!t.type.compatibleContent(e.type))throw new we(`Cannot join `+t.type.name+` onto `+e.type.name)}function je(e,t,n){let r=e.node(n);return Ae(r,t.node(n)),r}function Me(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ne(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Me(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Me(i.child(e),r);t&&t.depth==n&&t.textOffset&&Me(t.nodeBefore,r)}function Pe(e,t){return e.type.checkContent(t),e.copy(t)}function Fe(e,t,n,r,i){let a=e.depth>i&&je(e,t,i+1),o=r.depth>i&&je(n,r,i+1),s=[];return Ne(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Ae(a,o),Me(Pe(a,Fe(e,t,n,r,i+1)),s)):(a&&Me(Pe(a,C(e,t,i+1)),s),Ne(t,n,i,s),o&&Me(Pe(o,C(n,r,i+1)),s)),Ne(r,null,i,s),new ye(s)}function C(e,t,n){let r=[];return Ne(null,e,n,r),e.depth>n&&Me(Pe(je(e,t,n+1),C(e,t,n+1)),r),Ne(t,null,n,r),new ye(r)}function Ie(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(ye.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Le=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ce.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive!==!1||r&&i[a].isInSet(r.marks)||(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive!==!1||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Be(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=w.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else w.set(t,r=new Re);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%ze,i}},Re=class{constructor(){this.elts=[],this.i=0}};const ze=12,w=/* @__PURE__ */ new WeakMap;var Be=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const Ve=Object.create(null);var He=class e{constructor(e,t,n,r=Ce.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||ye.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Se(this.attrs,t||e.defaultAttrs||Ve)&&Ce.sameSet(this.marks,n||Ce.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Te.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Te(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Oe(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Le.resolveCached(this,e)}resolveNoCache(e){return Le.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),We(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=ye.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ce.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ce.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=ye.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};He.prototype.text=void 0;var Ue=class e extends He{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):We(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function We(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Ge=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Ke(t,n);if(r.next==null)return e.empty;let i=qe(r);r.next&&r.err(`Unexpected trailing text`);let a=tt(Qe(i));return nt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return ye.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];a.isLeaf||a.hasRequiredAttrs()||a.name in t||r.type&&!o.validEnd||(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
8
8
  `)}};Ge.empty=new Ge(!0);var Ke=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function qe(e){let t=[];do t.push(Je(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Je(e){let t=[];do t.push(Ye(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Ye(e){let t=Ze(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Xe(e,t);else break;return t}function T(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Xe(e,t){let n=T(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:T(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function E(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Ze(e){if(e.eat(`(`)){let t=qe(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=E(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Qe(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function $e(e,t){return t-e}function et(e,t){let n=[];return r(t),n.sort($e);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function tt(e){let t=Object.create(null);return n(et(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);et(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Ge(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort($e);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function nt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function rt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function it(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function at(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function ot(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new lt(e,r,t[r]);return n}var st=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=ot(e,n.attrs),this.defaultAttrs=rt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ge.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:it(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new He(this,this.computeAttrs(e),ye.from(t),Ce.setFrom(n))}createChecked(e=null,t,n){return t=ye.from(t),this.checkContent(t),new He(this,this.computeAttrs(e),t,Ce.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=ye.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(ye.empty,!0);return i?new He(this,e,t.append(i),Ce.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){at(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:Ce.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function ct(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var lt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?ct(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},ut=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=ot(e,r.attrs),this.excluded=null;let i=rt(this.attrs);this.instance=i?new Ce(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ce(this,it(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){at(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},dt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=ge.from(e.nodes),t.marks=ge.from(e.marks||{}),this.nodes=st.compile(this.spec.nodes,this),this.marks=ut.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Ge.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?ft(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:ft(this,n.split(` `))}this.nodeFromJSON=e=>He.fromJSON(this,e),this.markFromJSON=e=>Ce.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof st))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Ue(n,n.defaultAttrs,e,Ce.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function ft(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}var pt=Object.create,mt=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,gt=Object.getOwnPropertyNames,_t=Object.getPrototypeOf,vt=Object.prototype.hasOwnProperty,yt=(e,t)=>function(){return t||(0,e[gt(e)[0]])((t={exports:{}}).exports,t),t.exports},bt=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of gt(t))!vt.call(e,i)&&i!==n&&mt(e,i,{get:()=>t[i],enumerable:!(r=ht(t,i))||r.enumerable});return e},xt=(e,t,n)=>(n=e==null?{}:pt(_t(e)),bt(t||!e||!e.__esModule?mt(n,`default`,{value:e,enumerable:!0}):n,e)),St=yt({"../../node_modules/acorn-jsx/xhtml.js"(e,t){t.exports={quot:`"`,amp:`&`,apos:`'`,lt:`<`,gt:`>`,nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,fnof:`ƒ`,circ:`ˆ`,tilde:`˜`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,bull:`•`,hellip:`…`,permil:`‰`,prime:`′`,Prime:`″`,lsaquo:`‹`,rsaquo:`›`,oline:`‾`,frasl:`⁄`,euro:`€`,image:`ℑ`,weierp:`℘`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`}}}),D=yt({"../../node_modules/acorn/dist/acorn.js"(e,t){(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.acorn={}))})(e,(function(e){var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],n=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,3104,541,1507,4938,6,4191],r=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_`,i=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,a={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},o=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,s={5:o,"5module":o+` export import`,6:o+` const class extends export import super`},c=/^in(stanceof)?$/,l=RegExp(`[`+i+`]`),u=RegExp(`[`+i+r+`]`);function d(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function f(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&l.test(String.fromCharCode(e)):t!==!1&&d(e,n)}function p(e,r){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&u.test(String.fromCharCode(e)):r===!1?!1:d(e,n)||d(e,t)}var m=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function h(e,t){return new m(e,{beforeExpr:!0,binop:t})}var g={beforeExpr:!0},_={startsExpr:!0},v={};function y(e,t){return t===void 0&&(t={}),t.keyword=e,v[e]=new m(e,t)}var b={num:new m(`num`,_),regexp:new m(`regexp`,_),string:new m(`string`,_),name:new m(`name`,_),privateId:new m(`privateId`,_),eof:new m(`eof`),bracketL:new m(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new m(`]`),braceL:new m(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new m(`}`),parenL:new m(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new m(`)`),comma:new m(`,`,g),semi:new m(`;`,g),colon:new m(`:`,g),dot:new m(`.`),question:new m(`?`,g),questionDot:new m(`?.`),arrow:new m(`=>`,g),template:new m(`template`),invalidTemplate:new m(`invalidTemplate`),ellipsis:new m(`...`,g),backQuote:new m("`",_),dollarBraceL:new m("${",{beforeExpr:!0,startsExpr:!0}),eq:new m(`=`,{beforeExpr:!0,isAssign:!0}),assign:new m(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new m(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new m(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:h(`||`,1),logicalAND:h(`&&`,2),bitwiseOR:h(`|`,3),bitwiseXOR:h(`^`,4),bitwiseAND:h(`&`,5),equality:h(`==/!=/===/!==`,6),relational:h(`</>/<=/>=`,7),bitShift:h(`<</>>/>>>`,8),plusMin:new m(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:h(`%`,10),star:h(`*`,10),slash:h(`/`,10),starstar:new m(`**`,{beforeExpr:!0}),coalesce:h(`??`,1),_break:y(`break`),_case:y(`case`,g),_catch:y(`catch`),_continue:y(`continue`),_debugger:y(`debugger`),_default:y(`default`,g),_do:y(`do`,{isLoop:!0,beforeExpr:!0}),_else:y(`else`,g),_finally:y(`finally`),_for:y(`for`,{isLoop:!0}),_function:y(`function`,_),_if:y(`if`),_return:y(`return`,g),_switch:y(`switch`),_throw:y(`throw`,g),_try:y(`try`),_var:y(`var`),_const:y(`const`),_while:y(`while`,{isLoop:!0}),_with:y(`with`),_new:y(`new`,{beforeExpr:!0,startsExpr:!0}),_this:y(`this`,_),_super:y(`super`,_),_class:y(`class`,_),_extends:y(`extends`,g),_export:y(`export`),_import:y(`import`,_),_null:y(`null`,_),_true:y(`true`,_),_false:y(`false`,_),_in:y(`in`,{beforeExpr:!0,binop:7}),_instanceof:y(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:y(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:y(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:y(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},x=/\r\n?|\n|\u2028|\u2029/,S=new RegExp(x.source,`g`);function ee(e){return e===10||e===13||e===8232||e===8233}function te(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(ee(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ne=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,re=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ie=Object.prototype,ae=ie.hasOwnProperty,oe=ie.toString,se=Object.hasOwn||(function(e,t){return ae.call(e,t)}),ce=Array.isArray||(function(e){return oe.call(e)===`[object Array]`});function le(e){return RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`)}function ue(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var de=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,fe=function(e,t){this.line=e,this.column=t};fe.prototype.offset=function(e){return new fe(this.line,this.column+e)};var pe=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function me(e,t){for(var n=1,r=0;;){var i=te(e,r,t);if(i<0)return new fe(n,t-r);++n,r=i}}var he={ecmaVersion:null,sourceType:`script`,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},ge=!1;function _e(e){var t={};for(var n in he)t[n]=e&&se(e,n)?e[n]:he[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!ge&&typeof console==`object`&&console.warn&&(ge=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
9
9
  Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,e&&e.allowHashBang!=null||(t.allowHashBang=t.ecmaVersion>=14),ce(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return ce(t.onComment)&&(t.onComment=ve(t,t.onComment)),t}function ve(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new pe(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var ye=1,be=2,xe=4,Se=8,Ce=16,we=32,Te=64,Ee=128,De=256,Oe=ye|be|De;function ke(e,t){return be|(e?xe:0)|(t?Se:0)}var Ae=0,je=1,Me=2,Ne=3,Pe=4,Fe=5,C=function(e,t,n){this.options=e=_e(e),this.sourceFile=e.sourceFile,this.keywords=le(s[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=a[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=le(r);var i=(r?r+` `:``)+a.strict;this.reservedWordsStrict=le(i),this.reservedWordsStrictBind=le(i+` `+a.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
10
10
  `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(x).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=b.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=/* @__PURE__ */ Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ye),this.regexpState=null,this.privateNameStack=[]},Ie={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};C.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},Ie.inFunction.get=function(){return(this.currentVarScope().flags&be)>0},Ie.inGenerator.get=function(){return(this.currentVarScope().flags&Se)>0&&!this.currentVarScope().inClassFieldInit},Ie.inAsync.get=function(){return(this.currentVarScope().flags&xe)>0&&!this.currentVarScope().inClassFieldInit},Ie.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&De)return!1;if(t.flags&be)return(t.flags&xe)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Ie.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(t&Te)>0||n||this.options.allowSuperOutsideMethod},Ie.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ee)>0},Ie.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Ie.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(t&(be|De))>0||n},Ie.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&De)>0},C.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},C.parse=function(e,t){return new this(t,e).parse()},C.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},C.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(C.prototype,Ie);var Le=C.prototype,Re=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;Le.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){re.lastIndex=e,e+=re.exec(this.input)[0].length;var t=Re.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){re.lastIndex=e+t[0].length;var n=re.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||x.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,re.lastIndex=e,e+=re.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Le.eat=function(e){return this.type===e&&(this.next(),!0)},Le.isContextual=function(e){return this.type===b.name&&this.value===e&&!this.containsEsc},Le.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Le.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Le.canInsertSemicolon=function(){return this.type===b.eof||this.type===b.braceR||x.test(this.input.slice(this.lastTokEnd,this.start))},Le.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Le.semicolon=function(){!this.eat(b.semi)&&!this.insertSemicolon()&&this.unexpected()},Le.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Le.expect=function(e){this.eat(e)||this.unexpected()},Le.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var ze=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Le.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Le.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Le.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Le.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var w=C.prototype;w.parseTopLevel=function(e){var t=/* @__PURE__ */ Object.create(null);for(e.body||=[];this.type!==b.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var Be={kind:`loop`},Ve={kind:`switch`};w.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;re.lastIndex=this.pos;var t=re.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(f(r,!0)){for(var i=n+1;p(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!c.test(a))return!0}return!1},w.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;re.lastIndex=this.pos;var e=re.exec(this.input),t=this.pos+e[0].length,n;return!x.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(p(n=this.input.charCodeAt(t+8))||n>55295&&n<56320))},w.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=b._var,a=`let`),r){case b._break:case b._continue:return this.parseBreakContinueStatement(i,r.keyword);case b._debugger:return this.parseDebuggerStatement(i);case b._do:return this.parseDoStatement(i);case b._for:return this.parseForStatement(i);case b._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case b._class:return e&&this.unexpected(),this.parseClass(i,!0);case b._if:return this.parseIfStatement(i);case b._return:return this.parseReturnStatement(i);case b._switch:return this.parseSwitchStatement(i);case b._throw:return this.parseThrowStatement(i);case b._try:return this.parseTryStatement(i);case b._const:case b._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case b._while:return this.parseWhileStatement(i);case b._with:return this.parseWithStatement(i);case b.braceL:return this.parseBlock(!0,i);case b.semi:return this.parseEmptyStatement(i);case b._export:case b._import:if(this.options.ecmaVersion>10&&r===b._import){re.lastIndex=this.pos;var o=re.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===b._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.value,u=this.parseExpression();return r===b.name&&u.type===`Identifier`&&this.eat(b.colon)?this.parseLabeledStatement(i,l,u,e):this.parseExpressionStatement(i,u)}},w.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(b.semi)||this.insertSemicolon()?e.label=null:this.type===b.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},w.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},w.parseDoStatement=function(e){return this.next(),this.labels.push(Be),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(b._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(b.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},w.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(Be),this.enterScope(0),this.expect(b.parenL),this.type===b.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===b._var||this.type===b._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),(this.type===b._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&r.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===b._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,r)):(t>-1&&this.unexpected(t),this.parseFor(e,r))}var a=this.isContextual(`let`),o=!1,s=new ze,c=this.parseExpression(t>-1?`await`:!0,s);return this.type===b._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(this.options.ecmaVersion>=9&&(this.type===b._in?t>-1&&this.unexpected(t):e.await=t>-1),a&&o&&this.raise(c.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(c,!1,s),this.checkLValPattern(c),this.parseForIn(e,c)):(this.checkExpressionErrors(s,!0),t>-1&&this.unexpected(t),this.parseFor(e,c))},w.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Ue|(n?0:We),!1,t)},w.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(b._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},w.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,`'return' outside of function`),this.next(),this.eat(b.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},w.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(b.braceL),this.labels.push(Ve),this.enterScope(0);for(var t,n=!1;this.type!==b.braceR;)if(this.type===b._case||this.type===b._default){var r=this.type===b._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(b.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},w.parseThrowStatement=function(e){return this.next(),x.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var He=[];w.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===b._catch){var t=this.startNode();if(this.next(),this.eat(b.parenL)){t.param=this.parseBindingAtom();var n=t.param.type===`Identifier`;this.enterScope(n?we:0),this.checkLValPattern(t.param,n?Pe:Me),this.expect(b.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0);t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(b._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},w.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},w.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Be),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},w.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},w.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},w.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===b._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},w.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},w.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(b.braceL),e&&this.enterScope(0);this.type!==b.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},w.parseFor=function(e,t){return e.init=t,this.expect(b.semi),e.test=this.type===b.semi?null:this.parseExpression(),this.expect(b.semi),e.update=this.type===b.parenR?null:this.parseExpression(),this.expect(b.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},w.parseForIn=function(e,t){var n=this.type===b._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(b.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},w.parseVar=function(e,t,n){for(e.declarations=[],e.kind=n;;){var r=this.startNode();if(this.parseVarId(r,n),this.eat(b.eq)?r.init=this.parseMaybeAssign(t):n===`const`&&!(this.type===b._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():r.id.type!==`Identifier`&&(!t||this.type!==b._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):r.init=null,e.declarations.push(this.finishNode(r,`VariableDeclarator`)),!this.eat(b.comma))break}return e},w.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?je:Me,!1)};var Ue=1,We=2,Ge=4;w.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===b.star&&t&We&&this.unexpected(),e.generator=this.eat(b.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Ue&&(e.id=t&Ge&&this.type!==b.name?null:this.parseIdent(),e.id&&!(t&We)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?je:Me:Ne));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ke(e.async,e.generator)),t&Ue||(e.id=this.type===b.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Ue?`FunctionDeclaration`:`FunctionExpression`)},w.parseFunctionParams=function(e){this.expect(b.parenL),e.params=this.parseBindingList(b.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},w.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(b.braceL);this.type!==b.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raise(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Ke(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},w.parseClassElement=function(e){if(this.eat(b.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(b.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===b.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===b.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(b.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===b.parenL||o!==`method`||i||a){var l=!n.static&&qe(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},w.isClassElementNameStart=function(){return this.type===b.name||this.type===b.privateId||this.type===b.num||this.type===b.string||this.type===b.bracketL||this.type.keyword},w.parseClassElementName=function(e){this.type===b.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},w.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&qe(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},w.parseClassField=function(e){if(qe(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&qe(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(b.eq)){var t=this.currentThisScope(),n=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=n}else e.value=null;return this.semicolon(),this.finishNode(e,`PropertyDefinition`)},w.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(De|Te);this.type!==b.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},w.parseClassId=function(e,t){this.type===b.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Me,!1)):(t===!0&&this.unexpected(),e.id=null)},w.parseClassSuper=function(e){e.superClass=this.eat(b._extends)?this.parseExprSubscripts(null,!1):null},w.enterClassBody=function(){var e={declared:/* @__PURE__ */ Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},w.exitClassBody=function(){for(var e=this.privateNameStack.pop(),t=e.declared,n=e.used,r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];se(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function Ke(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function qe(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}w.parseExport=function(e,t){if(this.next(),this.eat(b.star))return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==b.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`);if(this.eat(b._default)){this.checkExport(t,`default`,this.lastTokStart);var n;if(this.type===b._function||(n=this.isAsyncFunction())){var r=this.startNode();this.next(),n&&this.next(),e.declaration=this.parseFunction(r,Ue|Ge,!1,n)}else if(this.type===b._class){var i=this.startNode();e.declaration=this.parseClass(i,`nullableID`)}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,`ExportDefaultDeclaration`)}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(null),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==b.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var a=0,o=e.specifiers;a<o.length;a+=1){var s=o[a];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type===`Literal`&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},w.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),se(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},w.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`?this.checkPatternExport(e,t.argument):n===`ParenthesizedExpression`&&this.checkPatternExport(e,t.expression)},w.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},w.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},w.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(b.braceL);!this.eat(b.braceR);){if(n)n=!1;else if(this.expect(b.comma),this.afterTrailingComma(b.braceR))break;var r=this.startNode();r.local=this.parseModuleExportName(),r.exported=this.eatContextual(`as`)?this.parseModuleExportName():r.local,this.checkExport(e,r.exported,r.exported.start),t.push(this.finishNode(r,`ExportSpecifier`))}return t},w.parseImport=function(e){return this.next(),this.type===b.string?(e.specifiers=He,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===b.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},w.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===b.name){var n=this.startNode();if(n.local=this.parseIdent(),this.checkLValSimple(n.local,Me),e.push(this.finishNode(n,`ImportDefaultSpecifier`)),!this.eat(b.comma))return e}if(this.type===b.star){var r=this.startNode();return this.next(),this.expectContextual(`as`),r.local=this.parseIdent(),this.checkLValSimple(r.local,Me),e.push(this.finishNode(r,`ImportNamespaceSpecifier`)),e}for(this.expect(b.braceL);!this.eat(b.braceR);){if(t)t=!1;else if(this.expect(b.comma),this.afterTrailingComma(b.braceR))break;var i=this.startNode();i.imported=this.parseModuleExportName(),this.eatContextual(`as`)?i.local=this.parseIdent():(this.checkUnreserved(i.imported),i.local=i.imported),this.checkLValSimple(i.local,Me),e.push(this.finishNode(i,`ImportSpecifier`))}return e},w.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===b.string){var e=this.parseLiteral(this.value);return de.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},w.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},w.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var Je=C.prototype;Je.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Je.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Je.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Je.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==b.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Je.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case b.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(b.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case b.braceL:return this.parseObj(!0)}return this.parseIdent()},Je.parseBindingList=function(e,t,n){for(var r=[],i=!0;!this.eat(e);)if(i?i=!1:this.expect(b.comma),t&&this.type===b.comma)r.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===b.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),r.push(a),this.type===b.comma&&this.raise(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else{var o=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(o),r.push(o)}return r},Je.parseBindingListItem=function(e){return e},Je.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(b.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Je.checkLValSimple=function(e,t,n){t===void 0&&(t=Ae);var r=t!==Ae;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Me&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(se(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Fe&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Je.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Ae),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Je.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Ae),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Ye=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},T={b_stat:new Ye(`{`,!1),b_expr:new Ye(`{`,!0),b_tmpl:new Ye("${",!1),p_stat:new Ye(`(`,!1),p_expr:new Ye(`(`,!0),q_tmpl:new Ye("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Ye(`function`,!1),f_expr:new Ye(`function`,!0),f_expr_gen:new Ye(`function`,!0,!1,null,!0),f_gen:new Ye(`function`,!1,!1,null,!0)},Xe=C.prototype;Xe.initialContext=function(){return[T.b_stat]},Xe.curContext=function(){return this.context[this.context.length-1]},Xe.braceIsBlock=function(e){var t=this.curContext();return t===T.f_expr||t===T.f_stat?!0:e===b.colon&&(t===T.b_stat||t===T.b_expr)?!t.isExpr:e===b._return||e===b.name&&this.exprAllowed?x.test(this.input.slice(this.lastTokEnd,this.start)):e===b._else||e===b.semi||e===b.eof||e===b.parenR||e===b.arrow?!0:e===b.braceL?t===T.b_stat:e===b._var||e===b._const||e===b.name?!1:!this.exprAllowed},Xe.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Xe.updateContext=function(e){var t,n=this.type;n.keyword&&e===b.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Xe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},b.parenR.updateContext=b.braceR.updateContext=function(){if(this.context.length===1)this.exprAllowed=!0;else{var e=this.context.pop();e===T.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}},b.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?T.b_stat:T.b_expr),this.exprAllowed=!0},b.dollarBraceL.updateContext=function(){this.context.push(T.b_tmpl),this.exprAllowed=!0},b.parenL.updateContext=function(e){var t=e===b._if||e===b._for||e===b._with||e===b._while;this.context.push(t?T.p_stat:T.p_expr),this.exprAllowed=!0},b.incDec.updateContext=function(){},b._function.updateContext=b._class.updateContext=function(e){e.beforeExpr&&e!==b._else&&(e!==b.semi||this.curContext()===T.p_stat)&&!(e===b._return&&x.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==b.colon&&e!==b.braceL||this.curContext()!==T.b_stat)?this.context.push(T.f_expr):this.context.push(T.f_stat),this.exprAllowed=!1},b.backQuote.updateContext=function(){this.curContext()===T.q_tmpl?this.context.pop():this.context.push(T.q_tmpl),this.exprAllowed=!1},b.star.updateContext=function(e){if(e===b._function){var t=this.context.length-1;this.context[t]===T.f_expr?this.context[t]=T.f_expr_gen:this.context[t]=T.f_gen}this.exprAllowed=!0},b.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==b.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var E=C.prototype;E.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);else{i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}}},E.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===b.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(b.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},E.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ze,r=!0);var s=this.start,c=this.startLoc;(this.type===b.parenL||this.type===b.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===b.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===b.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},E.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(b.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(b.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},E.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},E.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==b._in)&&a>r){var o=this.type===b.logicalOR||this.type===b.logicalAND,s=this.type===b.coalesce;s&&(a=b.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===b.coalesce||s&&(this.type===b.logicalOR||this.type===b.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},E.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},E.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===b.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&s.argument.type===`Identifier`?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&Ze(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===b.privateId)(r||this.privateNameStack.length===0)&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==b._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(b.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function Ze(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&Ze(e.expression)}E.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},E.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},E.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(b.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(b.bracketL);if(l||c&&this.type!==b.parenL&&this.type!==b.backQuote||this.eat(b.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(b.bracketR)):u.property=this.type===b.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(b.parenL)){var d=new ze,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(b.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&!this.canInsertSemicolon()&&this.eat(b.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseArrowExpression(this.startNodeAt(t,n),h,!0,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===b.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},E.parseExprAtom=function(e,t){this.type===b.slash&&this.readRegexp();var n,r=this.potentialArrowAt===this.start;switch(this.type){case b._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),n=this.startNode(),this.next(),this.type===b.parenL&&!this.allowDirectSuper&&this.raise(n.start,`super() call outside constructor of a subclass`),this.type!==b.dot&&this.type!==b.bracketL&&this.type!==b.parenL&&this.unexpected(),this.finishNode(n,`Super`);case b._this:return n=this.startNode(),this.next(),this.finishNode(n,`ThisExpression`);case b.name:var i=this.start,a=this.startLoc,o=this.containsEsc,s=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&s.name===`async`&&!this.canInsertSemicolon()&&this.eat(b._function))return this.overrideContext(T.f_expr),this.parseFunction(this.startNodeAt(i,a),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(b.arrow))return this.parseArrowExpression(this.startNodeAt(i,a),[s],!1,t);if(this.options.ecmaVersion>=8&&s.name===`async`&&this.type===b.name&&!o&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return s=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(b.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,a),[s],!0,t)}return s;case b.regexp:var c=this.value;return n=this.parseLiteral(c.value),n.regex={pattern:c.pattern,flags:c.flags},n;case b.num:case b.string:return this.parseLiteral(this.value);case b._null:case b._true:case b._false:return n=this.startNode(),n.value=this.type===b._null?null:this.type===b._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,`Literal`);case b.parenL:var l=this.start,u=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),u;case b.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(b.bracketR,!0,!0,e),this.finishNode(n,`ArrayExpression`);case b.braceL:return this.overrideContext(T.b_expr),this.parseObj(!1,e);case b._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case b._class:return this.parseClass(this.startNode(),!1);case b._new:return this.parseNew();case b.backQuote:return this.parseTemplate();case b._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}},E.parseExprImport=function(){var e=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`);var t=this.parseIdent(!0);switch(this.type){case b.parenL:return this.parseDynamicImport(e);case b.dot:return e.meta=t,this.parseImportMeta(e);default:this.unexpected()}},E.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(b.parenR)){var t=this.start;this.eat(b.comma)&&this.eat(b.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},E.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},E.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,``)),this.next(),this.finishNode(t,`Literal`)},E.parseParenExpression=function(){this.expect(b.parenL);var e=this.parseExpression();return this.expect(b.parenR),e},E.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new ze,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==b.parenR;){if(l?l=!1:this.expect(b.comma),a&&this.afterTrailingComma(b.parenR,!0)){u=!0;break}if(this.type===b.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===b.comma&&this.raise(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(b.parenR),e&&!this.canInsertSemicolon()&&this.eat(b.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},E.parseParenItem=function(e){return e},E.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var Qe=[];E.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(b.dot)){e.meta=t;var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc,a=this.type===b._import;return e.callee=this.parseSubscripts(this.parseExprAtom(),r,i,!0,!1),a&&e.callee.type===`ImportExpression`&&this.raise(r,`Cannot use new with import()`),e.arguments=this.eat(b.parenL)?this.parseExprList(b.parenR,this.options.ecmaVersion>=8,!1):Qe,this.finishNode(e,`NewExpression`)},E.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===b.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value,cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
@@ -4,4 +4,4 @@ import { dirname as __mintDirname } from 'node:path';
4
4
  const require = __mintCreateRequire(import.meta.url);
5
5
  const __filename = __mintFileURLToPath(import.meta.url);
6
6
  const __dirname = __mintDirname(__filename);
7
- export{A as AddedLog,j as BrokenLinksLog,M as DeletedLog,N as EditedLog,P as EmptyLineLog,F as ErrorLog,I as InfoLog,Qt as LOCAL_LINKED_CLI_VERSION,L as LaunchLog,R as LinksToLog,z as Logs,o as PackageIslandCollector,B as RenamedLog,V as SearchDisabledLog,H as SpinnerLog,U as SuccessLog,W as UpdateLog,G as WarningLog,g as addChangeLog,_ as addErrorLog,v as addLog,y as addLogs,b as addRawErrorLog,d as checkBuild,x as clearErrorLogs,S as clearLogs,s as collectPackageIslands,t as dev,f as downloadTargetMint,l as exportSite,h as getClientVersion,C as getCurrentErrorLogs,p as getLatestClientVersion,m as getVersionMap,i as normalizeProviderPath,a as readPackagesSetup,w as removeErrorLogs,T as removeLastLog,E as removeLog,D as removeSpinnerLogs,O as replaceLog,c as resolvePageContent,k as setLoggingCallbacks}from"./dist-DPnNfhEi.js";
7
+ export{A as AddedLog,j as BrokenLinksLog,M as DeletedLog,N as EditedLog,P as EmptyLineLog,F as ErrorLog,I as InfoLog,Qt as LOCAL_LINKED_CLI_VERSION,L as LaunchLog,R as LinksToLog,z as Logs,o as PackageIslandCollector,B as RenamedLog,V as SearchDisabledLog,H as SpinnerLog,U as SuccessLog,W as UpdateLog,G as WarningLog,g as addChangeLog,_ as addErrorLog,v as addLog,y as addLogs,b as addRawErrorLog,d as checkBuild,x as clearErrorLogs,S as clearLogs,s as collectPackageIslands,t as dev,f as downloadTargetMint,l as exportSite,h as getClientVersion,C as getCurrentErrorLogs,p as getLatestClientVersion,m as getVersionMap,i as normalizeProviderPath,a as readPackagesSetup,w as removeErrorLogs,T as removeLastLog,E as removeLog,D as removeSpinnerLogs,O as replaceLog,c as resolvePageContent,k as setLoggingCallbacks}from"./dist-qrxGNvwY.js";
@@ -1336,4 +1336,4 @@ get onmessage(){return null}get protocol(){return this._protocol}get readyState(
1336
1336
  `:`
1337
1337
  `)+n,i=r+1,r=e.indexOf(`
1338
1338
  `,i)}while(r!==-1);return a+=e.slice(i),a}const{stdout:BJe,stderr:VJe}=LJe,n9=Symbol(`GENERATOR`),r9=Symbol(`STYLER`),i9=Symbol(`IS_EMPTY`),HJe=[`ansi`,`ansi`,`ansi256`,`ansi16m`],a9=Object.create(null),UJe=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=BJe?BJe.level:0;e.level=t.level===void 0?n:t.level},WJe=e=>{let t=(...e)=>e.join(` `);return UJe(t,e),Object.setPrototypeOf(t,o9.prototype),t};function o9(e){return WJe(e)}Object.setPrototypeOf(o9.prototype,Function.prototype);for(let[e,t]of Object.entries(Q7))a9[e]={get(){let n=l9(this,c9(t.open,t.close,this[r9]),this[i9]);return Object.defineProperty(this,e,{value:n}),n}};a9.visible={get(){let e=l9(this,this[r9],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const s9=(e,t,n,...r)=>e===`rgb`?t===`ansi16m`?Q7[n].ansi16m(...r):t===`ansi256`?Q7[n].ansi256(Q7.rgbToAnsi256(...r)):Q7[n].ansi(Q7.rgbToAnsi(...r)):e===`hex`?s9(`rgb`,t,n,...Q7.hexToRgb(...r)):Q7[n][e](...r);for(let e of[`rgb`,`hex`,`ansi256`]){a9[e]={get(){let{level:t}=this;return function(...n){let r=c9(s9(e,HJe[t],`color`,...n),Q7.color.close,this[r9]);return l9(this,r,this[i9])}}};let t=`bg`+e[0].toUpperCase()+e.slice(1);a9[t]={get(){let{level:t}=this;return function(...n){let r=c9(s9(e,HJe[t],`bgColor`,...n),Q7.bgColor.close,this[r9]);return l9(this,r,this[i9])}}}}const GJe=Object.defineProperties(()=>{},{...a9,level:{enumerable:!0,get(){return this[n9].level},set(e){this[n9].level=e}}}),c9=(e,t,n)=>{let r,i;return n===void 0?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},l9=(e,t,n)=>{let r=(...e)=>KJe(r,e.length===1?``+e[0]:e.join(` `));return Object.setPrototypeOf(r,GJe),r[n9]=e,r[r9]=t,r[i9]=n,r},KJe=(e,t)=>{if(e.level<=0||!t)return e[i9]?``:t;let n=e[r9];if(n===void 0)return t;let{openAll:r,closeAll:i}=n;if(t.includes(`\x1B`))for(;n!==void 0;)t=RJe(t,n.close,n.open),n=n.parent;let a=t.indexOf(`
1339
- `);return a!==-1&&(t=zJe(t,i,r,a)),r+t+i};Object.defineProperties(o9.prototype,a9);const qJe=o9();o9({level:VJe?VJe.level:0});var JJe=/* @__PURE__ */ r(ce(),1);const u9={},d9=/* @__PURE__ */ new Set,YJe=/* @__PURE__ */ new Set([`root`,`pages`,`groups`,...A]),XJe=e=>typeof e==`object`&&!!e&&`href`in e&&typeof e.href==`string`&&`title`in e&&typeof e.title==`string`,ZJe=e=>{for(let e of d9)delete u9[e];d9.clear();let t=e=>{if(Array.isArray(e))e.forEach(t);else if(typeof e==`object`&&e){if(XJe(e)){let t=Rh(Lh(e.href));u9[t]=e,d9.add(t)}else for(let[n,r]of Object.entries(e))YJe.has(n)&&t(r)}};t(e)},QJe=e=>{let t=e.startsWith(`/`)?e.slice(1):e;return t.endsWith(`.mdx`)||t.endsWith(`.md`)?[t]:[`${t}.mdx`,`${t}.md`]},$Je=()=>{for(let e of Object.keys(u9))delete u9[e];d9.clear()},f9=(e,t)=>{u9[e]=t,d9.delete(e)},eYe=e=>{delete u9[e],d9.delete(e)},tYe=e=>{eYe(e.replace(/\.mdx?$/,``))},nYe=(e,t)=>{let{slug:n,pageMetadata:r}=OM(e,t,[],[]);return f9(n,r),r.openapi!=null||r.asyncapi!=null},rYe=async e=>{let t=FM(e.navigation);for(let e of t){let t=Rh(Lh(e));if(d9.has(t))continue;let n=u9[t];if(n){if(n.openapi!=null||n.asyncapi!=null)return!0}else for(let t of QJe(e)){let e=N.join(li,t);if(!await Z.default.pathExists(e))continue;let n=(await Z.default.readFile(e)).toString();if(nYe(t,n))return!0;break}}return!1},iYe=e=>hU(u9,e.navigation),aYe=async e=>{let t=_t($r,e);if(await Z.default.pathExists(t))return{baseDir:$r,path:t};let n=_t(li,e);return await Z.default.pathExists(n)?{baseDir:li,path:n}:null},oYe=async({filename:e,variables:t,snippetsByFilename:n})=>{let r=Ih(e);if(n.has(r))return;let i=await aYe(Lh(r));if(i==null)return;let a=xj((await Z.default.readFile(i.path)).toString(),t),o=await jQ(a,i.baseDir,i.path,u7),s=await DD(o),c={filename:r,...s};n.set(r,c),await Promise.all(Object.keys(s.importMap).map(async e=>{let i=mD(e,r);i!=null&&await oYe({filename:i,variables:t,snippetsByFilename:n})}))},sYe=async e=>{let t={};for(let n of e.values())t[n.filename]=Object.keys(n.importMap).map(e=>mD(e,n.filename)).filter(t=>t!=null&&e.has(t));let n=rO(t).reverse(),r=[];for(let t of n){let n=e.get(t);if(n==null)continue;let i=OD(n)?await nO({snippets:r,fileWithImports:n,...o7()}):n.tree;r.push({filename:n.filename,tree:i})}return r},p9=async e=>{let t=await f7(),n=/* @__PURE__ */ new Map;await Promise.all(Object.keys(e.importMap).map(async r=>{let i=mD(r,e.filename);i!=null&&await oYe({filename:i,variables:t,snippetsByFilename:n})}));let r=await sYe(n);return await nO({snippets:r,fileWithImports:e,...o7()})},m9=async e=>await p9(e),{readFile:cYe}=Vt;let lYe=()=>{};const uYe=new Promise(e=>{lYe=e}),dYe=()=>{lYe()};let h9;const fYe=e=>{h9=e},g9=e=>`/${e.replace(/\.mdx?$/,``)}`,pYe=async(e,t)=>{let n=g9(e);h9?.({path:n,active:!0});let r=!1;try{r=await t()}finally{h9?.({path:n,active:!1,error:r||void 0})}},_9=/* @__PURE__ */ new Map,mYe=[`_next/`,`_mintlify/`,`socket.io/`,`favicon`],hYe=e=>{try{return decodeURIComponent(e)}catch{return e}},gYe=/\.md$/,_Ye=/\/?rss\.xml$/,vYe=e=>{if(e.startsWith(`_mintlify/og/`)&&e.endsWith(`.png`))return e.slice(13,-4)},yYe=e=>{let t=hYe(e).replace(/^\/+/,``).replace(/\/+$/,``);if(t.startsWith(`_markdown/`)&&(t=t.slice(10)),t=t.replace(gYe,``).replace(_Ye,``),t=vYe(t)??t,t===``)return`index`;if(!(t.includes(`\0`)||t.includes(`\\`)||t.split(`/`).some(e=>e===`..`))&&!mYe.some(e=>t.startsWith(e)))return t},bYe=e=>[`${e}.mdx`,`${e}.md`,`${e}/index.mdx`,`${e}/index.md`],v9=/* @__PURE__ */ new Map,xYe=()=>Array.from(v9.keys()).map(e=>({path:g9(e),active:!1,error:!0})),SYe=e=>{v9.delete(e)&&h9?.({path:g9(e),active:!1})},CYe=e=>{v9.set(e,0),h9?.({path:g9(e),active:!1,error:!0})},wYe=async(e,t,n,r)=>{let i=p1(`compile ${e}`),a=!1,o=()=>{a=!0};try{let s=(await cYe(t)).toString(),c=await jQ(s,li,t,o),l=await DD(c);OD(l)&&(s=JE(await m9({...l,filename:e})));let{pageContent:u,pageMetadata:d,slug:f}=await k$(e,s,li,[],[],o);return await Z.default.outputFile(n,u,{flag:`w`}),f9(f,d),a?(v9.set(e,r),i(`failed`),!0):(v9.delete(e),i(),!1)}catch(t){return v9.set(e,r),u7(`Failed to compile ${e}: ${t instanceof Error?t.message:String(t)}`),i(`failed`),!0}},TYe=async(e,t={})=>{let n=yYe(e);if(n!==void 0)for(let e of bYe(n)){let n=N.join(li,e);if(!await Z.default.pathExists(n)||te(e,c7()))continue;let r=await Z.default.stat(n),i=N.join(ei,e),a=await Z.default.stat(i).catch(()=>void 0);if(v9.get(e)===r.mtimeMs){t.silent||h9?.({path:g9(e),active:!1,error:!0});return}if(a!==void 0&&a.mtimeMs>=r.mtimeMs)return;if(await uYe,uM(e,{importedFiles:y7()})!==`page`)continue;let o=_9.get(e)??wYe(e,n,i,r.mtimeMs).finally(()=>{_9.delete(e)});if(_9.set(e,o),t.silent){await o;return}return pYe(e,()=>o)}};let y9,b9,x9,S9=!1;const C9=e=>JSON.stringify(e??{}),EYe=e=>C9(e),DYe=e=>C9(e.api),OYe=e=>C9(e.navigation),kYe=e=>{y9=EYe(e.variables),b9=DYe(e),x9=OYe(e),S9=e.api!=null||w9(e.navigation)},AYe=()=>S9,w9=e=>typeof e!=`object`||!e?!1:Object.prototype.hasOwnProperty.call(e,`openapi`)||Object.prototype.hasOwnProperty.call(e,`asyncapi`)||Object.prototype.hasOwnProperty.call(e,`graphql`)?!0:Object.values(e).some(w9),jYe=e=>b9==null||b9!==e,MYe=e=>x9==null||x9!==e,NYe=e=>y9==null||y9!==e,PYe=()=>{y9=void 0,b9=void 0,x9=void 0,S9=!1},{readFile:FYe}=Vt,IYe=e=>{let t=/* @__PURE__ */ new Set([Ih(e)]),n=y7(),r=yKe(e);for(let e of r){let r=uM(e,{importedFiles:n});(r===`snippet`||r===`snippet-v2`)&&t.add(e)}return t},LYe=async(e,t)=>{try{let n=Lh(e),r=_t(li,n),i=xj((await FYe(r)).toString(),t),a=await jQ(i,li,r,u7),o=await DD(a);return{filename:Ih(e),...o}}catch(t){return console.warn(`Failed to parse snippet ${e}:`,t),null}},RYe=async(e,t)=>{let n=Ih(e),r=IYe(e),i=await f7(),a=Array.from(r).map(async e=>e===n?{...t,filename:n}:await LYe(e,i)),o=(await Promise.all(a)).filter(e=>e!=null),s={};o.forEach(e=>{s[e.filename]=Object.keys(e.importMap).map(t=>mD(t,e.filename)).filter(e=>e!=null)});let c=rO(s).reverse(),l=new Map(o.map(e=>[e.filename,e])),u=c.map(e=>l.get(e)).filter(e=>e!=null),d=[];for(let e of u){let t=e.tree;OD(e)&&(t=await p9(e));let n=Lh(e.filename),r=_t($r,n);await Z.default.outputFile(r,JE(t),{flag:`w`}),d.push(n)}return d},{readFile:zYe}=Vt,BYe=e=>{let t=y7(),n=/* @__PURE__ */ new Set;for(let r of e)for(let e of vKe(Ih(r)))uM(e,{importedFiles:t})===`page`&&n.add(Lh(e));return n},T9=async e=>{let t=BYe(e),n=t.values(),r=async()=>{for(let e of n){let t=_t(li,e),n=(await zYe(t)).toString();try{let r=await jQ(n,li,t,u7),i=await DD(r),a=await m9({...i,filename:e}),o=_t(ei,e);await(0,Z.outputFile)(o,JE(a),{flag:`w`})}catch(t){console.log(`Error generating pages with imports`),console.log(e),console.log(t)}}},i=Math.min(8,t.size);await Promise.all(Array.from({length:i},r))},E9=async(e,{contentDirectory:t=li,clientDirectory:n=Yr}={})=>{let r=await S(t),i=_t(t,`docs.json`),a=await A$(await Z.default.pathExists(i)?i:_t(t,`mint.json`)),{openApiFiles:o,asyncApiFiles:s,invalidSpecFiles:c,overlayRegistry:l}=await DU(t,r,void 0,void 0,{explicitOverlays:a}),u,d,f;try{f=await MU.getConfig(_t(t,`mint.json`),!1,t,e)}catch{let n=_t(t,`docs.json`);if(!await Z.default.pathExists(n))throw Error(`No config found`);d=await NU.getConfig(n,!1,t,e,{allowSourceRefs:!0})}if(f&&(d=ks(f),u=(await EQ(f,o,n,void 0,c)).mintConfig),!d)throw Error(`No config found`);let p=await dQ(d,e=>fQ(e,t)),{newDocsConfig:m,pagesAcc:h}=p,{newDocsConfig:g,pagesAcc:_,openApiFiles:v,flushWrites:y}=await CQ(m,o,n,void 0,c,h,!0,l),{flushWrites:b}=await nQ(g,s,n,void 0,h,!1,!0);return await Promise.all([y(),b()]),await pQ(p,n),kU(c),{mintConfig:u,pagesAcc:{..._,...h},openApiFiles:v,docsConfig:g}},VYe=(e,t)=>{if(t)return t.isDirectory();try{return Gt(e).isDirectory()}catch{return!1}},HYe=(e,t)=>{let n=w(t);return(t,r)=>{let i=N.isAbsolute(t)?N.relative(e,t):t;if(!i)return!1;let a=N.isAbsolute(t)?t:N.join(e,t);return le(i,n,VYe(a,r))}};let D9=/* @__PURE__ */ new Set,O9=/* @__PURE__ */ new Set;const k9=e=>N.normalize(Eh(e)),A9=e=>{if(Array.isArray(e))return e.flatMap(A9);if(typeof e!=`object`||!e)return[];let t=e,n=t.graphql,r=typeof n==`string`?n:typeof n==`object`&&n&&`source`in n?n.source:void 0;return[...typeof r==`string`&&!KIe(r)?[k9(r)]:[],...Object.values(t).flatMap(A9)]},j9=async()=>{try{let e=await oe(li,`docs`)??await oe(li,`mint`);if(!e){D9=/* @__PURE__ */ new Set,O9=/* @__PURE__ */ new Set;return}let t=await wn(e,`utf-8`),n=JSON.parse(t),{referencedFiles:r,resolved:i}=await ie(n,li),a=A9(i);D9=/* @__PURE__ */ new Set([...r.map(k9),...a]),O9=new Set(a)}catch{D9=/* @__PURE__ */ new Set,O9=/* @__PURE__ */ new Set}},UYe=e=>D9.has(k9(e)),WYe=(e,t=O9)=>t.has(k9(e)),{readFile:GYe}=Vt,KYe=async({contentDirectoryPath:e,contentFilenames:t,openApiFiles:n,asyncApiFiles:r,pagesAcc:i={}})=>{let a=t.values(),o=async()=>{for(let t of a){let a=_t(e,t),o=(await GYe(a)).toString(),{slug:s,pageMetadata:c}=await k$(t,o,e,n,r,u7);i[s]=c}},s=Math.min(8,t.length);return await Promise.all(Array.from({length:s},o)),i},qYe=async(e,t)=>{let n=await S(li),{contentFilenames:r,openApiFiles:i,asyncApiFiles:a}=await DU(li,n,void 0,void 0,{explicitOverlays:Ns(t)}),o=await KYe({contentDirectoryPath:li,contentFilenames:r,openApiFiles:i,asyncApiFiles:a,pagesAcc:e});return hU(o,t.navigation)},JYe=async e=>{let t=_t(ei,`generatedDocsNav.json`);await Z.default.outputFile(t,JSON.stringify(e,null,2),{flag:`w`})},M9=async(e,t)=>{let{pagesAcc:n,docsConfig:r}=t??await E9(e),i=await qYe(n,r);return await JYe(i),r},YYe=async(e,t,n={})=>{if(n.reuseGeneratedMetadata)try{let e=await s7(_t(ei,`generatedDocsNav.json`));ZJe(e)}catch(e){e instanceof Error&&`code`in e&&e.code===`ENOENT`||console.warn(`Failed to reuse generated navigation metadata: ${e instanceof Error?e.message:String(e)}`)}return await rYe(e)?await M9(t):(await JYe(iYe(e)),e)},N9=async(e,t)=>{if(e==null){let{openApiFiles:n}=await E9(t);e=n}let n=_t(ei,`openApiFiles.json`);await Z.default.outputFile(n,JSON.stringify(e,null,2),{flag:`w`})},XYe=async e=>{let t=_t(ei,`openApiFiles.json`),n=[];try{n=await s7(t)}catch{}let r=n.findIndex(t=>t.originalFileLocation===e.originalFileLocation);r>=0?n[r]=e:n.push(e),await Z.default.outputFile(t,JSON.stringify(n,null,2),{flag:`w`})},P9=async(e,t)=>{e??=(await E9(t)).docsConfig;let n=await TQ({config:e,contentDirectoryPath:li}),r=_t(ei,`customLanguages.json`);await Z.default.outputFile(r,JSON.stringify(n,null,2),{flag:`w`})},{readFile:F9}=Vt,I9=/* @__PURE__ */ new Map;let L9;const ZYe=async()=>{if(L9==null){let e=/* @__PURE__ */ new Set;try{let t=await S(li),n=await O$(li,t);for(let t of n)e.add(t.location)}catch{}L9=e}return L9},QYe=async()=>{let e=N.join(ei,`docs.json`);try{return await s7(e)}catch{}let t=N.join(li,`docs.json`);return await NU.getConfig(t,!1,li,d7,{allowSourceRefs:!0})},$Ye=async e=>{let t=N.join(ei,`docs.json`);try{let n=await s7(t);await NU.writeConfigFile({...e,navigation:n.navigation},Yr);return}catch{}await NU.writeConfigFile(e,Yr)},eXe=async()=>{let e=N.join(li,`docs.json`);if(await Z.default.pathExists(e))try{return await NU.getConfig(e,!1,li,d7,{allowSourceRefs:!0})}catch{return}},R9=e=>e.api?.openapi!=null||e.api?.asyncapi!=null||w9(e.navigation),tXe=e=>Number((process.hrtime.bigint()-e)/1000000n),nXe=e=>`${(e/1e3).toFixed(2)}s`,rXe=e=>process.env.DEV_TIMING===`true`||e>=1e3,iXe=(e,t,n)=>{if(!rXe(n))return;let r=t??`uncategorized`;n1((0,M$.jsx)(I$,{message:`processed ${e} in ${nXe(n)} (${r})`}))};let z9,B9,V9=Promise.resolve();const H9=/* @__PURE__ */ new Map,U9=/* @__PURE__ */ new Map;let W9,G9,K9=!1,q9,J9=!1,aXe=()=>{},Y9={};const X9=()=>{J9=!0},oXe=e=>/\.mdx?$/i.test(e),sXe=e=>Xt(`sha1`).update(e).digest(`hex`),cXe=async e=>{if(oXe(e))try{return sXe((await F9(N.join(li,e))).toString())}catch{return}},lXe=(e,t)=>{switch(e){case`add`:return mXe(t,X9,Y9);case`change`:return hXe(t,X9,Y9);case`unlink`:return gXe(t,X9,Y9)}},uXe=async()=>{let e=q9;if(q9=void 0,e)try{await SXe(e)}catch(e){console.error(e.message)}},dXe=async()=>{K9=!0;try{for(;H9.size>0||q9;){for(let[e,t]of H9){H9.delete(e),G9=e;try{await lXe(t,e)}catch(e){console.error(e.message)}finally{G9=void 0}}await uXe()}}finally{K9=!1,W9=void 0,J9&&(J9=!1,aXe())}},Z9=(e,t)=>{let n=H9.get(t);return H9.delete(t),H9.set(t,n===`add`&&e===`change`?`add`:e),W9??=new Promise(e=>{setTimeout(()=>void dXe().finally(e),100)}),W9},Q9=e=>(Y9=e,V9=V9.catch(()=>void 0).then(async()=>{let e=B9;B9=void 0,e&&await e.close();let t=HYe(li,c7());B9=JJe.watch(li,{ignoreInitial:!0,ignored:t,cwd:li}).on(`add`,e=>Z9(`add`,e)).on(`change`,e=>Z9(`change`,e)).on(`unlink`,e=>Z9(`unlink`,e))}),V9),fXe=(e,t={},n)=>{z9=n,aXe=e;let r={...t,allowSourceRefs:!0};Q9(r)},pXe=async(e,t,n,r)=>{if(z9&&await z9,te(e,c7()))return;let i=await cXe(e);if(i===void 0||U9.get(e)!==i)try{let a=process.hrtime.bigint(),o=await xXe(e,t,n);i!==void 0&&U9.set(e,i),iXe(e,o,tXe(a)),o!==void 0&&r(e)}catch(t){U9.delete(e),console.error(t.message)}},mXe=(e,t,n)=>pXe(e,t,n,e=>n1((0,M$.jsx)(U$,{filename:e}))),hXe=(e,t,n)=>pXe(e,t,n,e=>n1((0,M$.jsx)(W$,{filename:e}))),gXe=async(e,t,n)=>{if(z9&&await z9,!te(e,c7()))try{let r=y7(),i=uM(e,{importedFiles:r});if(await M7(e,i),I9.delete(e),U9.delete(e),tYe(e),i===`page`&&SYe(e),WYe(e)){await bXe(t,n),n1((0,M$.jsx)(G$,{filename:e}));return}if(UYe(e)){try{let{mintConfig:e,openApiFiles:t,docsConfig:n}=await E9(u7);await j9(),e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(n,Yr),await N9(t,d7),await P9(n,d7),await M9(d7)}catch(e){d1().length===0&&console.error(e)}let n=await x7();await T9(new Set(n));let r=v7(e);await b7(r),t(),n1((0,M$.jsx)(G$,{filename:e}));return}if(i==null){let t=v7(e);await b7(t);return}switch((i===`page`||i===`snippet`||i===`mintConfig`||i===`docsConfig`||i===`staticFile`||i===`snippet-v2`||i===`css`||i===`js`||i===`generatedStaticFile`||i===`skillFile`)&&await Z.default.remove(_Xe(i,e)),i){case`mintConfig`:console.error(`mint.json has been deleted.`),await vXe();break;case`docsConfig`:console.error(`docs.json has been deleted.`),await vXe();break;case`potentialYamlOpenApiSpec`:case`potentialJsonOpenApiSpec`:L9?.delete(hp(E(e)));try{let{mintConfig:e,openApiFiles:n,docsConfig:r}=await E9(u7);e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(r,Yr),await N9(n,d7),await M9(d7),t()}catch(e){d1().length===0&&console.error(e)}break;case`mintIgnore`:n1((0,M$.jsx)(z$,{message:`.mintignore has been deleted. Rebuilding...`}));try{await Z.default.emptyDir($r),await Z.default.emptyDir(ei);let e=await j$(li,n);await tqe(),await _7(li,e?.fileImportsMap),await $9(),await j9(),await Q9(n)}catch(e){console.error(`Error rebuilding after .mintignore deletion:`,e)}}let a=v7(e);await b7(a),n1((0,M$.jsx)(G$,{filename:e}))}catch(e){console.error(e.message)}},_Xe=(e,t)=>{switch(e){case`page`:return N.join(ei,t);case`mintConfig`:return N.join(ei,`mint.json`);case`docsConfig`:return N.join(ei,`docs.json`);case`potentialYamlOpenApiSpec`:case`potentialJsonOpenApiSpec`:return N.join(ei,`openApiFiles.json`);case`generatedStaticFile`:return N.join($r,t);case`mintIgnore`:return N.join(ei,`mint-ignore.json`);case`snippet`:case`staticFile`:case`snippet-v2`:case`css`:case`js`:return N.join($r,t);case`skillFile`:return N.join($r,t);default:throw Error(`Invalid category`)}},vXe=async()=>{try{let e=N.join(li,`mint.json`),t=N.join(li,`docs.json`),n=await Z.default.pathExists(e),r=await Z.default.pathExists(t);!n&&!r&&(console.error(`⚠️ Error: Neither mint.json nor docs.json found in the directory`),process.exit(1))}catch(e){console.error(`⚠️ Error validating configuration files:`,e)}},$9=async()=>{I9.clear(),U9.clear(),$Je();let e=y7(),t=FH(li,li,c7()).filter(t=>uM(t,{importedFiles:e})===`page`);await Promise.all(t.map(async e=>{try{let t=N.join(li,e),n=(await F9(t)).toString();lKe(e,n,I9,d7),U9.set(e,sXe(n)),nYe(e,n)}catch{}}));for(let e of[...H9.keys(),G9])e&&(U9.delete(e),I9.delete(e))},yXe=async()=>{PYe();let e=N.join(li,`docs.json`);try{if(await Z.default.pathExists(e)){let t=await NU.getConfig(e,!1,li,d7,{allowSourceRefs:!0});kYe(t);return}}catch{}},bXe=async(e,t)=>{let n=await j$(li,t);await _7(li,n?.fileImportsMap),await $9(),await yXe(),await j9(),e()},xXe=async(e,t,n={})=>{a1();let r=N.join(li,e);if(WYe(e))return await M7(e,uM(e,{importedFiles:y7()})),await bXe(t,n),null;let i=await _Ke(li,e);await b7(i);let a=y7(),o=uM(e,{importedFiles:a});if(await M7(e,o),oM(e))return null;if(UYe(e)){if(await Z.default.pathExists(N.join(li,`docs.json`)))return xXe(`docs.json`,t,n);try{let{mintConfig:e,openApiFiles:t,docsConfig:n,pagesAcc:r}=await E9(u7);await j9(),e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(n,Yr),await N9(t,d7),await P9(n,d7),await M9(d7,{pagesAcc:r,docsConfig:n})}catch(e){d1().length===0&&console.error(e)}let e=await x7();return await T9(new Set(e)),t(),null}if(o==null){t();return}let s=!1,c=!1,l=o===`potentialYamlOpenApiSpec`||o===`potentialJsonOpenApiSpec`?`staticFile`:o,u=_Xe(o,e);switch(o){case`page`:{let t=(await F9(r)).toString();c=await cKe(e,t,I9,u7);let n=!1,i=()=>{n=!0},a=e=>{n=!0,u7(e)};try{let n=await jQ(t,li,r,i),o=await DD(n);OD(o)&&(t=JE(await m9({...o,filename:e})));let{pageContent:s,pageMetadata:c,slug:l}=await k$(e,t,li,[],[],a);await Z.default.outputFile(u,s,{flag:`w`}),f9(l,c)}catch(t){throw CYe(e),t}n?CYe(e):SYe(e);break}case`snippet`:await Z.default.copy(r,u);break;case`snippet-v2`:{let t=await f7(),n=xj((await F9(r)).toString(),t),i=await jQ(n,li,r,u7),a=await DD(i);OD(a)&&(n=JE(await p9({...a,filename:e}))),await Z.default.outputFile(u,n,{flag:`w`});let o=await RYe(e,a);await T9(new Set(o));break}case`mintConfig`:case`docsConfig`:{let{valid:t,error:n}=sKe(r);if(!t){r1((0,M$.jsx)(H$,{message:`Syntax error in ${e}: ${n}`}));return}if(o===`docsConfig`){try{let e=await NU.getConfig(r,!1,li,u7,{allowSourceRefs:!0}),t=DYe(e),n=jYe(t),i=OYe(e),a=MYe(i),o=EYe(e.variables),s=NYe(o),c=a&&!n&&!R9(e)&&!AYe(),l=n||a&&(R9(e)||AYe());if(await j9(),c){await P9(e,d7),await uXe();let t=await YYe(e,d7,{reuseGeneratedMetadata:!0});await NU.writeConfigFile(t,Yr)}else if(l){let e=await E9(u7);await NU.writeConfigFile(e.docsConfig,Yr),await N9(e.openApiFiles,d7),await P9(e.docsConfig,d7),await M9(d7,{pagesAcc:e.pagesAcc,docsConfig:e.docsConfig})}else await P9(e,d7),await $Ye(e);if(s){let e=await x7();await T9(new Set(e))}kYe(e)}catch(e){if(d1().length>0)return;console.error(e)}break}s=!0;try{await j9();let{mintConfig:e,openApiFiles:t,docsConfig:n}=await E9(u7);e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(n,Yr),await N9(t,d7),await P9(n,d7)}catch(e){if(d1().length>0)return;console.error(e)}break}case`mintIgnore`:try{n1((0,M$.jsx)(I$,{message:`.mintignore has been updated. Rebuilding...`})),await Z.default.emptyDir($r),await Z.default.emptyDir(ei);let e=await j$(li,n);await tqe(),await _7(li,e?.fileImportsMap),await $9(),await j9(),await Q9(n)}catch(e){console.error(e.message)}break;case`potentialYamlOpenApiSpec`:case`potentialJsonOpenApiSpec`:{let t;try{t=qe.load(await Cn.readFile(r,`utf-8`))}catch{t=void 0}let n=await ZYe(),i=hp(E(e));if(Bs(t)){n.add(i),await N9(),s=!0,l=`openApi`;break}if(n.has(i)){n.delete(i),await N9(),s=!0,l=`openApi`;break}let a=typeof t==`object`&&!!t&&`openapi`in t,o;try{let{schema:e}=await bh(t);o=e}catch{o=void 0}if(o||a)o&&await XYe({filename:N.parse(e).name,originalFileLocation:`/`+e,spec:o}),await N9(),s=!0,l=`openApi`;else{let e=JSON.parse(await Cn.readFile(N.join(ei,`customLanguages.json`),`utf-8`)),t=!1;for(let[n,i]of e.entries())if(r.endsWith(i.filePath)){t=!0,e[n]={content:await Cn.readFile(r,`utf-8`),filePath:i.filePath};break}t&&await Cn.writeFile(N.join(ei,`customLanguages.json`),JSON.stringify(e,null,2))}break}case`skillFile`:case`css`:case`js`:case`generatedStaticFile`:case`staticFile`:await oKe(r,20)?await Z.default.copy(r,u):console.error(qJe.red(`🚨 The file at ${e} is too big. The maximum file size is 20 mb.`))}let d=c?`pageMetadataCache`:s?`full`:void 0;return d&&K9?q9=q9===`full`?`full`:d:d&&await SXe(d),t(),l},SXe=async e=>{if(e===`pageMetadataCache`){let e=await eXe()??await QYe();if(R9(e)){let e=await M9(d7);await NU.writeConfigFile(e,Yr)}else await YYe(e,d7)}else{let e=await M9(d7);await NU.writeConfigFile(e,Yr)}},CXe=()=>{let e=Jt.networkInterfaces();for(let t of Object.keys(e))for(let n of e[t]||[])if(n.family===`IPv4`&&!n.internal)return n.address},wXe=/* @__PURE__ */ new Set([`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`content-encoding`,`content-length`]);function TXe(e,t){let n=e.headers,r=typeof n.getSetCookie==`function`,i=r?n.getSetCookie():void 0;if(n.forEach((e,n)=>{let i=n.toLowerCase();wXe.has(i)||i===`set-cookie`&&r||t.setHeader(n,e)}),i?.length)for(let e of i)t.appendHeader(`Set-Cookie`,e)}const EXe=async e=>{let t=e.port||`3000`,n=parseInt(t,10)||3e3,r=(0,G5.default)(),i=jt(r),a=new wJe(i);process.env.LOCAL_OG_PREVIEW=`true`;let o=e.apiUrl??process.env.MINTLIFY_API_URL??`http://localhost:5000`,s=e.accessToken,c=e.subdomain;process.env.MINTLIFY_CLI_ACCESS_TOKEN=s??``,process.env.MINTLIFY_API_URL=o,c&&(process.env.MINTLIFY_CLI_SUBDOMAIN=c);let l=await m1(`setup client handler`,()=>ni===`vite`?FGe():J5()),u=CXe();r.use(nqe.prefix,nqe.handler),r.use(`/`,G5.static($r,{redirect:!1})),r.use((e,t,n)=>{if(e.method!==`GET`&&e.method!==`HEAD`){n();return}let r=e.headers[`next-router-prefetch`]!==void 0||e.headers.purpose===`prefetch`||e.headers[`sec-purpose`]===`prefetch`;TYe(e.path,{silent:r}).then(()=>n(),()=>n())}),r.post(`/_mintlify/api-public/search/:subdomain`,G5.json(),async(e,t)=>{let n=c??e.params.subdomain;try{let r=await fetch(`${o}/api/cli/${n}/search`,{method:`POST`,headers:{"Content-Type":`application/json`,...s?{Authorization:`Bearer ${s}`}:{}},body:JSON.stringify(e.body)}),i=await r.json();t.status(r.status).json(i)}catch{t.status(502).json({error:`search proxy failed`})}});let d=e=>async(t,n)=>{let r=c??t.params.subdomain;try{let i=await fetch(`${o}/api/cli/${r}/assistant/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`,...s?{Authorization:`Bearer ${s}`}:{}},body:JSON.stringify(t.body)});if(n.status(i.status),TXe(i,n),i.body){let e=i.body.getReader(),t=async()=>{let{done:r,value:i}=await e.read();if(r)n.end();else return n.write(i),t()};await t()}else n.end()}catch{n.headersSent?n.destroy():n.status(502).json({error:`assistant proxy failed`})}};for(let e of[`message`,`v2/message`])r.post(`/_mintlify/api-public/assistant/:subdomain/${e}`,G5.json({limit:`5mb`}),d(e));r.all(`*`,(e,t)=>l(e,t));let f=()=>{a.emit(`reload`)};QKe(f),fYe(e=>{a.emit(`compiling`,e)}),a.on(`connection`,e=>{for(let t of xYe())e.emit(`compiling`,t)});let p=p1(`server ready`),m=e.host===!0;i.listen(n,m?void 0:`localhost`,()=>{p(),u1(),e.needsUpdate&&t1((0,M$.jsx)(B$,{updateCommand:`${e.packageName} update`})),s||t1((0,M$.jsx)(V$,{loginCommand:`${e.packageName} login`})),t1((0,M$.jsx)(F$,{localUrl:`http://localhost:${t}`,networkUrl:m&&u?`http://${u}:${t}`:void 0})),mHe(),e.open&&(0,CJe.default)(`http://localhost:${t}`);let n=()=>{process.exit(0)};process.on(`SIGINT`,n),process.on(`SIGTERM`,n)});let h=()=>{},g=new Promise(e=>{h=e});HRe(`watching for file changes`),fXe(f,{localSchema:e[`local-schema`],groups:e.groups,disableOpenApi:e.disableOpenapi,disablePrefetch:e.disablePrefetch,allowSourceRefs:!0,lazyPages:!0,nativePackages:!0},g),await m1(`initialize import cache`,()=>_7(li,e.fileImportsMap)),dYe(),await m1(`initialize frontmatter cache`,()=>$9()),await m1(`initialize docs config cache`,()=>yXe()),await m1(`refresh referenced files`,()=>j9()),h()},DXe=[`favicons/`,`.mint-content-source`],OXe=()=>{let e;try{e=FH($r)}catch{return}for(let t of e)DXe.some(e=>t.startsWith(e))||(_D(N.extname(t))||!Z.default.existsSync(N.join(li,t)))&&Z.default.removeSync(N.join($r,t))},kXe=async e=>{let t=await m1(`check internet`,()=>g1()),n=e[`local-schema`],r=e[`client-version`],i=e[`local-client-version`],a=e.packageName,o=e.groups,s=e.cliVersion,c=e.disableOpenapi,l=e.disablePrefetch;await m1(`ensure preview directory`,()=>Z.default.ensureDir(Wr)),!i&&!r&&ni===`next`&&h1(`seed preview from shared workspace`,()=>hHe());let u=await m1(`read local client version`,async()=>await(0,Z.pathExists)(qr)?Z.default.readFileSync(qr,`utf8`):null);u||i||t||(s1(),t1((0,M$.jsx)(H$,{message:`running ${a} dev after updating requires an internet connection.`})),await new Promise(e=>setTimeout(e,50)),process.exit(1)),t1((0,M$.jsx)(R$,{message:`preparing local preview...`}));let{needsUpdate:d,error:f}=await m1(`update local client`,()=>b8({versionString:u,clientVersion:r,localClientVersion:i,cliVersion:s}));f&&(s1(),t1((0,M$.jsx)(H$,{message:f})),await new Promise(e=>setTimeout(e,50)),process.exit(1)),await m1(`ensure docs.json`,()=>nKe()),h1(`clear prebuild output`,()=>{Z.default.emptyDirSync(ei);let e=N.join($r,`.mint-content-source`),t;try{t=Z.default.readFileSync(e,`utf8`)}catch{}t===li?OXe():(Z.default.emptyDirSync($r),Z.default.outputFileSync(e,li))}),await m1(`switch to local client directory`,async()=>{await Z.default.ensureDir(Yr),process.chdir(Yr)});let p;try{p=(await m1(`prebuild content`,()=>j$(li,{localSchema:n,groups:o,disableOpenApi:c,disablePrefetch:l,allowSourceRefs:!0,lazyPages:!0,nativePackages:!0})))?.fileImportsMap}catch(e){s1();let t=e instanceof Error&&e.message?e.message:`prebuild step failed`;t1((0,M$.jsx)(H$,{message:t})),await new Promise(e=>setTimeout(e,50)),process.exit(1)}await m1(`build npm packages`,()=>eqe()),await m1(`start preview runtime`,()=>EXe({...e,needsUpdate:d,fileImportsMap:p}))},AXe=async e=>{let t=Number(e.port??3e3);ii(t,e.classic===!0?`next`:`vite`);let n=aqe(t);try{await kXe(e)}catch(e){throw n(),e}};export{tW as $,Br as $t,U$ as A,KE as At,LRe as B,bh as Bt,d1 as C,NO as Ct,u1 as D,mD as Dt,c1 as E,hD as Et,H$ as F,Lh as Ft,z$ as G,bp as Gt,R$ as H,hp as Ht,I$ as I,Rh as It,NQ as J,Hs as Jt,ARe as K,up as Kt,F$ as L,Fh as Lt,G$ as M,__ as Mt,W$ as N,p_ as Nt,l1 as O,fD as Ot,P$ as P,zh as Pt,fQ as Q,ui as Qt,IRe as R,Eh as Rt,s1 as S,kO as St,zRe as T,Ode as Tt,L$ as U,vp as Ut,V$ as V,yp as Vt,B$ as W,_p as Wt,mQ as X,Ns as Xt,bQ as Y,Bs as Yt,dQ as Z,ks as Zt,r1 as _,aj as _t,LKe as a,dU as at,i1 as b,jO as bt,AKe as c,YEe as ct,SHe as d,EM as dt,Fr as en,MU as et,h8 as f,W_e as ft,n1 as g,oj as gt,_He as h,xj as ht,FKe as i,xU as it,FRe as j,qE as jt,e1 as k,dD as kt,eKe as l,TH as lt,g8 as m,uM as mt,qJe as n,TU as nt,E7 as o,RH as ot,m8 as p,wM as pt,O$ as q,lp as qt,lqe as r,EU as rt,jKe as s,FH as st,AXe as t,sr as tn,DU as tt,D8 as u,SH as ut,t1 as v,uge as vt,o1 as w,VD as wt,a1 as x,OO as xt,RRe as y,rj as yt,K$ as z,xh as zt};
1339
+ `);return a!==-1&&(t=zJe(t,i,r,a)),r+t+i};Object.defineProperties(o9.prototype,a9);const qJe=o9();o9({level:VJe?VJe.level:0});var JJe=/* @__PURE__ */ r(ce(),1);const u9={},d9=/* @__PURE__ */ new Set,YJe=/* @__PURE__ */ new Set([`root`,`pages`,`groups`,...A]),XJe=e=>typeof e==`object`&&!!e&&`href`in e&&typeof e.href==`string`&&`title`in e&&typeof e.title==`string`,ZJe=e=>{for(let e of d9)delete u9[e];d9.clear();let t=e=>{if(Array.isArray(e))e.forEach(t);else if(typeof e==`object`&&e){if(XJe(e)){let t=Rh(Lh(e.href));u9[t]=e,d9.add(t)}else for(let[n,r]of Object.entries(e))YJe.has(n)&&t(r)}};t(e)},QJe=e=>{let t=e.startsWith(`/`)?e.slice(1):e;return t.endsWith(`.mdx`)||t.endsWith(`.md`)?[t]:[`${t}.mdx`,`${t}.md`]},$Je=()=>{for(let e of Object.keys(u9))delete u9[e];d9.clear()},f9=(e,t)=>{u9[e]=t,d9.delete(e)},eYe=e=>{delete u9[e],d9.delete(e)},tYe=e=>{eYe(e.replace(/\.mdx?$/,``))},nYe=(e,t)=>{let{slug:n,pageMetadata:r}=OM(e,t,[],[]);return f9(n,r),r.openapi!=null||r.asyncapi!=null},rYe=async e=>{let t=FM(e.navigation);for(let e of t){let t=Rh(Lh(e));if(d9.has(t))continue;let n=u9[t];if(n){if(n.openapi!=null||n.asyncapi!=null)return!0}else for(let t of QJe(e)){let e=N.join(li,t);if(!await Z.default.pathExists(e))continue;let n=(await Z.default.readFile(e)).toString();if(nYe(t,n))return!0;break}}return!1},iYe=e=>hU(u9,e.navigation),aYe=async e=>{let t=_t($r,e);if(await Z.default.pathExists(t))return{baseDir:$r,path:t};let n=_t(li,e);return await Z.default.pathExists(n)?{baseDir:li,path:n}:null},oYe=async({filename:e,variables:t,snippetsByFilename:n})=>{let r=Ih(e);if(n.has(r))return;let i=await aYe(Lh(r));if(i==null)return;let a=xj((await Z.default.readFile(i.path)).toString(),t),o=await jQ(a,i.baseDir,i.path,u7),s=await DD(o),c={filename:r,...s};n.set(r,c),await Promise.all(Object.keys(s.importMap).map(async e=>{let i=mD(e,r);i!=null&&await oYe({filename:i,variables:t,snippetsByFilename:n})}))},sYe=async e=>{let t={};for(let n of e.values())t[n.filename]=Object.keys(n.importMap).map(e=>mD(e,n.filename)).filter(t=>t!=null&&e.has(t));let n=rO(t).reverse(),r=[];for(let t of n){let n=e.get(t);if(n==null)continue;let i=OD(n)?await nO({snippets:r,fileWithImports:n,...o7()}):n.tree;r.push({filename:n.filename,tree:i})}return r},p9=async e=>{let t=await f7(),n=/* @__PURE__ */ new Map;await Promise.all(Object.keys(e.importMap).map(async r=>{let i=mD(r,e.filename);i!=null&&await oYe({filename:i,variables:t,snippetsByFilename:n})}));let r=await sYe(n);return await nO({snippets:r,fileWithImports:e,...o7()})},m9=async e=>await p9(e),{readFile:cYe}=Vt;let lYe=()=>{};const uYe=new Promise(e=>{lYe=e}),dYe=()=>{lYe()};let h9;const fYe=e=>{h9=e},g9=e=>`/${e.replace(/\.mdx?$/,``)}`,pYe=async(e,t)=>{let n=g9(e);h9?.({path:n,active:!0});let r=!1;try{r=await t()}finally{h9?.({path:n,active:!1,error:r||void 0})}},_9=/* @__PURE__ */ new Map,mYe=[`_next/`,`_mintlify/`,`socket.io/`,`favicon`],hYe=e=>{try{return decodeURIComponent(e)}catch{return e}},gYe=/\.md$/,_Ye=/\/?rss\.xml$/,vYe=e=>{if(e.startsWith(`_mintlify/og/`)&&e.endsWith(`.png`))return e.slice(13,-4)},yYe=e=>{let t=hYe(e).replace(/^\/+/,``).replace(/\/+$/,``);if(t.startsWith(`_markdown/`)&&(t=t.slice(10)),t=t.replace(gYe,``).replace(_Ye,``),t=vYe(t)??t,t===``)return`index`;if(!(t.includes(`\0`)||t.includes(`\\`)||t.split(`/`).some(e=>e===`..`))&&!mYe.some(e=>t.startsWith(e)))return t},bYe=e=>[`${e}.mdx`,`${e}.md`,`${e}/index.mdx`,`${e}/index.md`],v9=/* @__PURE__ */ new Map,xYe=()=>Array.from(v9.keys()).map(e=>({path:g9(e),active:!1,error:!0})),SYe=e=>{v9.delete(e)&&h9?.({path:g9(e),active:!1})},CYe=e=>{v9.set(e,0),h9?.({path:g9(e),active:!1,error:!0})},wYe=async(e,t,n,r)=>{let i=p1(`compile ${e}`),a=!1,o=()=>{a=!0};try{let s=(await cYe(t)).toString(),c=await jQ(s,li,t,o),l=await DD(c);OD(l)&&(s=JE(await m9({...l,filename:e})));let{pageContent:u,pageMetadata:d,slug:f}=await k$(e,s,li,[],[],o);return await Z.default.outputFile(n,u,{flag:`w`}),f9(f,d),a?(v9.set(e,r),i(`failed`),!0):(v9.delete(e),i(),!1)}catch(t){return v9.set(e,r),u7(`Failed to compile ${e}: ${t instanceof Error?t.message:String(t)}`),i(`failed`),!0}},TYe=async(e,t={})=>{let n=yYe(e);if(n!==void 0)for(let e of bYe(n)){let n=N.join(li,e);if(!await Z.default.pathExists(n)||te(e,c7()))continue;let r=await Z.default.stat(n),i=N.join(ei,e),a=await Z.default.stat(i).catch(()=>void 0);if(v9.get(e)===r.mtimeMs){t.silent||h9?.({path:g9(e),active:!1,error:!0});return}if(a!==void 0&&a.mtimeMs>=r.mtimeMs)return;if(await uYe,uM(e,{importedFiles:y7()})!==`page`)continue;let o=_9.get(e)??wYe(e,n,i,r.mtimeMs).finally(()=>{_9.delete(e)});if(_9.set(e,o),t.silent){await o;return}return pYe(e,()=>o)}};let y9,b9,x9,S9=!1;const C9=e=>JSON.stringify(e??{}),EYe=e=>C9(e),DYe=e=>C9(e.api),OYe=e=>C9(e.navigation),kYe=e=>{y9=EYe(e.variables),b9=DYe(e),x9=OYe(e),S9=e.api!=null||w9(e.navigation)},AYe=()=>S9,w9=e=>typeof e!=`object`||!e?!1:Object.prototype.hasOwnProperty.call(e,`openapi`)||Object.prototype.hasOwnProperty.call(e,`asyncapi`)||Object.prototype.hasOwnProperty.call(e,`graphql`)?!0:Object.values(e).some(w9),jYe=e=>b9==null||b9!==e,MYe=e=>x9==null||x9!==e,NYe=e=>y9==null||y9!==e,PYe=()=>{y9=void 0,b9=void 0,x9=void 0,S9=!1},{readFile:FYe}=Vt,IYe=e=>{let t=/* @__PURE__ */ new Set([Ih(e)]),n=y7(),r=yKe(e);for(let e of r){let r=uM(e,{importedFiles:n});(r===`snippet`||r===`snippet-v2`)&&t.add(e)}return t},LYe=async(e,t)=>{try{let n=Lh(e),r=_t(li,n),i=xj((await FYe(r)).toString(),t),a=await jQ(i,li,r,u7),o=await DD(a);return{filename:Ih(e),...o}}catch(t){return console.warn(`Failed to parse snippet ${e}:`,t),null}},RYe=async(e,t)=>{let n=Ih(e),r=IYe(e),i=await f7(),a=Array.from(r).map(async e=>e===n?{...t,filename:n}:await LYe(e,i)),o=(await Promise.all(a)).filter(e=>e!=null),s={};o.forEach(e=>{s[e.filename]=Object.keys(e.importMap).map(t=>mD(t,e.filename)).filter(e=>e!=null)});let c=rO(s).reverse(),l=new Map(o.map(e=>[e.filename,e])),u=c.map(e=>l.get(e)).filter(e=>e!=null),d=[];for(let e of u){let t=e.tree;OD(e)&&(t=await p9(e));let n=Lh(e.filename),r=_t($r,n);await Z.default.outputFile(r,JE(t),{flag:`w`}),d.push(n)}return d},{readFile:zYe}=Vt,BYe=e=>{let t=y7(),n=/* @__PURE__ */ new Set;for(let r of e)for(let e of vKe(Ih(r)))uM(e,{importedFiles:t})===`page`&&n.add(Lh(e));return n},T9=async e=>{let t=BYe(e),n=t.values(),r=async()=>{for(let e of n){let t=_t(li,e),n=(await zYe(t)).toString();try{let r=await jQ(n,li,t,u7),i=await DD(r),a=await m9({...i,filename:e}),o=_t(ei,e);await(0,Z.outputFile)(o,JE(a),{flag:`w`})}catch(t){console.log(`Error generating pages with imports`),console.log(e),console.log(t)}}},i=Math.min(8,t.size);await Promise.all(Array.from({length:i},r))},E9=async(e,{contentDirectory:t=li,clientDirectory:n=Yr}={})=>{let r=await S(t),i=_t(t,`docs.json`),a=await A$(await Z.default.pathExists(i)?i:_t(t,`mint.json`)),{openApiFiles:o,asyncApiFiles:s,invalidSpecFiles:c,overlayRegistry:l}=await DU(t,r,void 0,void 0,{explicitOverlays:a}),u,d,f;try{f=await MU.getConfig(_t(t,`mint.json`),!1,t,e)}catch{let n=_t(t,`docs.json`);if(!await Z.default.pathExists(n))throw Error(`No config found`);d=await NU.getConfig(n,!1,t,e,{allowSourceRefs:!0})}if(f&&(d=ks(f),u=(await EQ(f,o,n,void 0,c)).mintConfig),!d)throw Error(`No config found`);let p=await dQ(d,e=>fQ(e,t)),{newDocsConfig:m,pagesAcc:h}=p,{newDocsConfig:g,pagesAcc:_,openApiFiles:v,flushWrites:y}=await CQ(m,o,n,void 0,c,h,!0,l),{flushWrites:b}=await nQ(g,s,n,void 0,h,!1,!0);return await Promise.all([y(),b()]),await pQ(p,n),kU(c),{mintConfig:u,pagesAcc:{..._,...h},openApiFiles:v,docsConfig:g}},VYe=(e,t)=>{if(t)return t.isDirectory();try{return Gt(e).isDirectory()}catch{return!1}},HYe=(e,t)=>{let n=w(t);return(t,r)=>{let i=N.isAbsolute(t)?N.relative(e,t):t;if(!i)return!1;let a=N.isAbsolute(t)?t:N.join(e,t);return le(i,n,VYe(a,r))}};let D9=/* @__PURE__ */ new Set,O9=/* @__PURE__ */ new Set;const k9=e=>N.normalize(Eh(e)),A9=e=>{if(Array.isArray(e))return e.flatMap(A9);if(typeof e!=`object`||!e)return[];let t=e,n=t.graphql,r=typeof n==`string`?n:typeof n==`object`&&n&&`source`in n?n.source:void 0;return[...typeof r==`string`&&!KIe(r)?[k9(r)]:[],...Object.values(t).flatMap(A9)]},j9=async()=>{try{let e=await oe(li,`docs`)??await oe(li,`mint`);if(!e){D9=/* @__PURE__ */ new Set,O9=/* @__PURE__ */ new Set;return}let t=await wn(e,`utf-8`),n=JSON.parse(t),{referencedFiles:r,resolved:i}=await ie(n,li),a=A9(i);D9=/* @__PURE__ */ new Set([...r.map(k9),...a]),O9=new Set(a)}catch{D9=/* @__PURE__ */ new Set,O9=/* @__PURE__ */ new Set}},UYe=e=>D9.has(k9(e)),WYe=(e,t=O9)=>t.has(k9(e)),{readFile:GYe}=Vt,KYe=async({contentDirectoryPath:e,contentFilenames:t,openApiFiles:n,asyncApiFiles:r,pagesAcc:i={}})=>{let a=t.values(),o=async()=>{for(let t of a){let a=_t(e,t),o=(await GYe(a)).toString(),{slug:s,pageMetadata:c}=await k$(t,o,e,n,r,u7);i[s]=c}},s=Math.min(8,t.length);return await Promise.all(Array.from({length:s},o)),i},qYe=async(e,t)=>{let n=await S(li),{contentFilenames:r,openApiFiles:i,asyncApiFiles:a}=await DU(li,n,void 0,void 0,{explicitOverlays:Ns(t)}),o=await KYe({contentDirectoryPath:li,contentFilenames:r,openApiFiles:i,asyncApiFiles:a,pagesAcc:e});return hU(o,t.navigation)},JYe=async e=>{let t=_t(ei,`generatedDocsNav.json`);await Z.default.outputFile(t,JSON.stringify(e,null,2),{flag:`w`})},M9=async(e,t)=>{let{pagesAcc:n,docsConfig:r}=t??await E9(e),i=await qYe(n,r);return await JYe(i),r},YYe=async(e,t,n={})=>{if(n.reuseGeneratedMetadata)try{let e=await s7(_t(ei,`generatedDocsNav.json`));ZJe(e)}catch(e){e instanceof Error&&`code`in e&&e.code===`ENOENT`||console.warn(`Failed to reuse generated navigation metadata: ${e instanceof Error?e.message:String(e)}`)}return await rYe(e)?await M9(t):(await JYe(iYe(e)),e)},N9=async(e,t)=>{if(e==null){let{openApiFiles:n}=await E9(t);e=n}let n=_t(ei,`openApiFiles.json`);await Z.default.outputFile(n,JSON.stringify(e,null,2),{flag:`w`})},XYe=async e=>{let t=_t(ei,`openApiFiles.json`),n=[];try{n=await s7(t)}catch{}let r=n.findIndex(t=>t.originalFileLocation===e.originalFileLocation);r>=0?n[r]=e:n.push(e),await Z.default.outputFile(t,JSON.stringify(n,null,2),{flag:`w`})},P9=async(e,t)=>{e??=(await E9(t)).docsConfig;let n=await TQ({config:e,contentDirectoryPath:li}),r=_t(ei,`customLanguages.json`);await Z.default.outputFile(r,JSON.stringify(n,null,2),{flag:`w`})},{readFile:F9}=Vt,I9=/* @__PURE__ */ new Map;let L9;const ZYe=async()=>{if(L9==null){let e=/* @__PURE__ */ new Set;try{let t=await S(li),n=await O$(li,t);for(let t of n)e.add(t.location)}catch{}L9=e}return L9},QYe=async()=>{let e=N.join(ei,`docs.json`);try{return await s7(e)}catch{}let t=N.join(li,`docs.json`);return await NU.getConfig(t,!1,li,d7,{allowSourceRefs:!0})},$Ye=async e=>{let t=N.join(ei,`docs.json`);try{let n=await s7(t);await NU.writeConfigFile({...e,navigation:n.navigation},Yr);return}catch{}await NU.writeConfigFile(e,Yr)},eXe=async()=>{let e=N.join(li,`docs.json`);if(await Z.default.pathExists(e))try{return await NU.getConfig(e,!1,li,d7,{allowSourceRefs:!0})}catch{return}},R9=e=>e.api?.openapi!=null||e.api?.asyncapi!=null||w9(e.navigation),tXe=e=>Number((process.hrtime.bigint()-e)/1000000n),nXe=e=>`${(e/1e3).toFixed(2)}s`,rXe=e=>process.env.DEV_TIMING===`true`||e>=1e3,iXe=(e,t,n)=>{if(!rXe(n))return;let r=t??`uncategorized`;n1((0,M$.jsx)(I$,{message:`processed ${e} in ${nXe(n)} (${r})`}))};let z9,B9,V9=Promise.resolve();const H9=/* @__PURE__ */ new Map,U9=/* @__PURE__ */ new Map;let W9,G9,K9=!1,q9,J9=!1,aXe=()=>{},Y9={};const X9=()=>{J9=!0},oXe=e=>/\.mdx?$/i.test(e),sXe=e=>Xt(`sha1`).update(e).digest(`hex`),cXe=async e=>{if(oXe(e))try{return sXe((await F9(N.join(li,e))).toString())}catch{return}},lXe=(e,t)=>{switch(e){case`add`:return mXe(t,X9,Y9);case`change`:return hXe(t,X9,Y9);case`unlink`:return gXe(t,X9,Y9)}},uXe=async()=>{let e=q9;if(q9=void 0,e)try{await SXe(e)}catch(e){console.error(e.message)}},dXe=async()=>{K9=!0;try{for(;H9.size>0||q9;){for(let[e,t]of H9){H9.delete(e),G9=e;try{await lXe(t,e)}catch(e){console.error(e.message)}finally{G9=void 0}}await uXe()}}finally{K9=!1,W9=void 0,J9&&(J9=!1,aXe())}},Z9=(e,t)=>{let n=H9.get(t);return H9.delete(t),H9.set(t,n===`add`&&e===`change`?`add`:e),W9??=new Promise(e=>{setTimeout(()=>void dXe().finally(e),100)}),W9},Q9=e=>(Y9=e,V9=V9.catch(()=>void 0).then(async()=>{let e=B9;B9=void 0,e&&await e.close();let t=HYe(li,c7());B9=JJe.watch(li,{ignoreInitial:!0,ignored:t,cwd:li}).on(`add`,e=>Z9(`add`,e)).on(`change`,e=>Z9(`change`,e)).on(`unlink`,e=>Z9(`unlink`,e))}),V9),fXe=(e,t={},n)=>{z9=n,aXe=e;let r={...t,allowSourceRefs:!0};Q9(r)},pXe=async(e,t,n,r)=>{if(z9&&await z9,te(e,c7()))return;let i=await cXe(e);if(i===void 0||U9.get(e)!==i)try{let a=process.hrtime.bigint(),o=await xXe(e,t,n);i!==void 0&&U9.set(e,i),iXe(e,o,tXe(a)),o!==void 0&&r(e)}catch(t){U9.delete(e),console.error(t.message)}},mXe=(e,t,n)=>pXe(e,t,n,e=>n1((0,M$.jsx)(U$,{filename:e}))),hXe=(e,t,n)=>pXe(e,t,n,e=>n1((0,M$.jsx)(W$,{filename:e}))),gXe=async(e,t,n)=>{if(z9&&await z9,!te(e,c7()))try{let r=y7(),i=uM(e,{importedFiles:r});if(await M7(e,i),I9.delete(e),U9.delete(e),tYe(e),i===`page`&&SYe(e),WYe(e)){await bXe(t,n),n1((0,M$.jsx)(G$,{filename:e}));return}if(UYe(e)){try{let{mintConfig:e,openApiFiles:t,docsConfig:n}=await E9(u7);await j9(),e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(n,Yr),await N9(t,d7),await P9(n,d7),await M9(d7)}catch(e){d1().length===0&&console.error(e)}let n=await x7();await T9(new Set(n));let r=v7(e);await b7(r),t(),n1((0,M$.jsx)(G$,{filename:e}));return}if(i==null){let t=v7(e);await b7(t);return}switch((i===`page`||i===`snippet`||i===`mintConfig`||i===`docsConfig`||i===`staticFile`||i===`snippet-v2`||i===`css`||i===`js`||i===`generatedStaticFile`||i===`skillFile`)&&await Z.default.remove(_Xe(i,e)),i){case`mintConfig`:console.error(`mint.json has been deleted.`),await vXe();break;case`docsConfig`:console.error(`docs.json has been deleted.`),await vXe();break;case`potentialYamlOpenApiSpec`:case`potentialJsonOpenApiSpec`:L9?.delete(hp(E(e)));try{let{mintConfig:e,openApiFiles:n,docsConfig:r}=await E9(u7);e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(r,Yr),await N9(n,d7),await M9(d7),t()}catch(e){d1().length===0&&console.error(e)}break;case`mintIgnore`:n1((0,M$.jsx)(z$,{message:`.mintignore has been deleted. Rebuilding...`}));try{await Z.default.emptyDir($r),await Z.default.emptyDir(ei);let e=await j$(li,n);await tqe(),await _7(li,e?.fileImportsMap),await $9(),await j9(),await Q9(n)}catch(e){console.error(`Error rebuilding after .mintignore deletion:`,e)}}let a=v7(e);await b7(a),n1((0,M$.jsx)(G$,{filename:e}))}catch(e){console.error(e.message)}},_Xe=(e,t)=>{switch(e){case`page`:return N.join(ei,t);case`mintConfig`:return N.join(ei,`mint.json`);case`docsConfig`:return N.join(ei,`docs.json`);case`potentialYamlOpenApiSpec`:case`potentialJsonOpenApiSpec`:return N.join(ei,`openApiFiles.json`);case`generatedStaticFile`:return N.join($r,t);case`mintIgnore`:return N.join(ei,`mint-ignore.json`);case`snippet`:case`staticFile`:case`snippet-v2`:case`css`:case`js`:return N.join($r,t);case`skillFile`:return N.join($r,t);default:throw Error(`Invalid category`)}},vXe=async()=>{try{let e=N.join(li,`mint.json`),t=N.join(li,`docs.json`),n=await Z.default.pathExists(e),r=await Z.default.pathExists(t);!n&&!r&&(console.error(`⚠️ Error: Neither mint.json nor docs.json found in the directory`),process.exit(1))}catch(e){console.error(`⚠️ Error validating configuration files:`,e)}},$9=async()=>{I9.clear(),U9.clear(),$Je();let e=y7(),t=FH(li,li,c7()).filter(t=>uM(t,{importedFiles:e})===`page`);await Promise.all(t.map(async e=>{try{let t=N.join(li,e),n=(await F9(t)).toString();lKe(e,n,I9,d7),U9.set(e,sXe(n)),nYe(e,n)}catch{}}));for(let e of[...H9.keys(),G9])e&&(U9.delete(e),I9.delete(e))},yXe=async()=>{PYe();let e=N.join(li,`docs.json`);try{if(await Z.default.pathExists(e)){let t=await NU.getConfig(e,!1,li,d7,{allowSourceRefs:!0});kYe(t);return}}catch{}},bXe=async(e,t)=>{let n=await j$(li,t);await _7(li,n?.fileImportsMap),await $9(),await yXe(),await j9(),e()},xXe=async(e,t,n={})=>{a1();let r=N.join(li,e);if(WYe(e))return await M7(e,uM(e,{importedFiles:y7()})),await bXe(t,n),null;let i=await _Ke(li,e);await b7(i);let a=y7(),o=uM(e,{importedFiles:a});if(await M7(e,o),oM(e))return null;if(UYe(e)){if(await Z.default.pathExists(N.join(li,`docs.json`)))return xXe(`docs.json`,t,n);try{let{mintConfig:e,openApiFiles:t,docsConfig:n,pagesAcc:r}=await E9(u7);await j9(),e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(n,Yr),await N9(t,d7),await P9(n,d7),await M9(d7,{pagesAcc:r,docsConfig:n})}catch(e){d1().length===0&&console.error(e)}let e=await x7();return await T9(new Set(e)),t(),null}if(o==null){t();return}let s=!1,c=!1,l=o===`potentialYamlOpenApiSpec`||o===`potentialJsonOpenApiSpec`?`staticFile`:o,u=_Xe(o,e);switch(o){case`page`:{let t=(await F9(r)).toString();c=await cKe(e,t,I9,u7);let n=!1,i=()=>{n=!0},a=e=>{n=!0,u7(e)};try{let n=await jQ(t,li,r,i),o=await DD(n);OD(o)&&(t=JE(await m9({...o,filename:e})));let{pageContent:s,pageMetadata:c,slug:l}=await k$(e,t,li,[],[],a);await Z.default.outputFile(u,s,{flag:`w`}),f9(l,c)}catch(t){throw CYe(e),t}n?CYe(e):SYe(e);break}case`snippet`:await Z.default.copy(r,u);break;case`snippet-v2`:{let t=await f7(),n=xj((await F9(r)).toString(),t),i=await jQ(n,li,r,u7),a=await DD(i);OD(a)&&(n=JE(await p9({...a,filename:e}))),await Z.default.outputFile(u,n,{flag:`w`});let o=await RYe(e,a);await T9(new Set(o));break}case`mintConfig`:case`docsConfig`:{let{valid:t,error:n}=sKe(r);if(!t){r1((0,M$.jsx)(H$,{message:`Syntax error in ${e}: ${n}`}));return}if(o===`docsConfig`){try{let e=await NU.getConfig(r,!1,li,u7,{allowSourceRefs:!0}),t=DYe(e),n=jYe(t),i=OYe(e),a=MYe(i),o=EYe(e.variables),s=NYe(o),c=a&&!n&&!R9(e)&&!AYe(),l=n||a&&(R9(e)||AYe());if(await j9(),c){await P9(e,d7),await uXe();let t=await YYe(e,d7,{reuseGeneratedMetadata:!0});await NU.writeConfigFile(t,Yr)}else if(l){let e=await E9(u7);await NU.writeConfigFile(e.docsConfig,Yr),await N9(e.openApiFiles,d7),await P9(e.docsConfig,d7),await M9(d7,{pagesAcc:e.pagesAcc,docsConfig:e.docsConfig})}else await P9(e,d7),await $Ye(e);if(s){let e=await x7();await T9(new Set(e))}kYe(e)}catch(e){if(d1().length>0)return;console.error(e)}break}s=!0;try{await j9();let{mintConfig:e,openApiFiles:t,docsConfig:n}=await E9(u7);e&&await MU.writeConfigFile(e,Yr),await NU.writeConfigFile(n,Yr),await N9(t,d7),await P9(n,d7)}catch(e){if(d1().length>0)return;console.error(e)}break}case`mintIgnore`:try{n1((0,M$.jsx)(I$,{message:`.mintignore has been updated. Rebuilding...`})),await Z.default.emptyDir($r),await Z.default.emptyDir(ei);let e=await j$(li,n);await tqe(),await _7(li,e?.fileImportsMap),await $9(),await j9(),await Q9(n)}catch(e){console.error(e.message)}break;case`potentialYamlOpenApiSpec`:case`potentialJsonOpenApiSpec`:{let t;try{t=qe.load(await Cn.readFile(r,`utf-8`))}catch{t=void 0}let n=await ZYe(),i=hp(E(e));if(Bs(t)){n.add(i),await N9(),s=!0,l=`openApi`;break}if(n.has(i)){n.delete(i),await N9(),s=!0,l=`openApi`;break}let a=typeof t==`object`&&!!t&&`openapi`in t,o;try{let{schema:e}=await bh(t);o=e}catch{o=void 0}if(o||a)o&&await XYe({filename:N.parse(e).name,originalFileLocation:`/`+e,spec:o}),await N9(),s=!0,l=`openApi`;else{let e=JSON.parse(await Cn.readFile(N.join(ei,`customLanguages.json`),`utf-8`)),t=!1;for(let[n,i]of e.entries())if(r.endsWith(i.filePath)){t=!0,e[n]={content:await Cn.readFile(r,`utf-8`),filePath:i.filePath};break}t&&await Cn.writeFile(N.join(ei,`customLanguages.json`),JSON.stringify(e,null,2))}break}case`skillFile`:case`css`:case`js`:case`generatedStaticFile`:case`staticFile`:await oKe(r,20)?await Z.default.copy(r,u):console.error(qJe.red(`🚨 The file at ${e} is too big. The maximum file size is 20 mb.`))}let d=c?`pageMetadataCache`:s?`full`:void 0;return d&&K9?q9=q9===`full`?`full`:d:d&&await SXe(d),t(),l},SXe=async e=>{if(e===`pageMetadataCache`){let e=await eXe()??await QYe();if(R9(e)){let e=await M9(d7);await NU.writeConfigFile(e,Yr)}else await YYe(e,d7)}else{let e=await M9(d7);await NU.writeConfigFile(e,Yr)}},CXe=()=>{let e=Jt.networkInterfaces();for(let t of Object.keys(e))for(let n of e[t]||[])if(n.family===`IPv4`&&!n.internal)return n.address},wXe=/* @__PURE__ */ new Set([`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`content-encoding`,`content-length`]);function TXe(e,t){let n=e.headers,r=typeof n.getSetCookie==`function`,i=r?n.getSetCookie():void 0;if(n.forEach((e,n)=>{let i=n.toLowerCase();wXe.has(i)||i===`set-cookie`&&r||t.setHeader(n,e)}),i?.length)for(let e of i)t.appendHeader(`Set-Cookie`,e)}const EXe=async e=>{let t=e.port||`3000`,n=parseInt(t,10)||3e3,r=(0,G5.default)(),i=jt(r),a=new wJe(i);process.env.LOCAL_OG_PREVIEW=`true`;let o=e.apiUrl??process.env.MINTLIFY_API_URL??`http://localhost:5000`,s=e.accessToken,c=e.subdomain;process.env.MINTLIFY_CLI_ACCESS_TOKEN=s??``,process.env.MINTLIFY_API_URL=o,c&&(process.env.MINTLIFY_CLI_SUBDOMAIN=c);let l=await m1(`setup client handler`,()=>ni===`vite`?FGe():J5()),u=CXe();r.use(nqe.prefix,nqe.handler),r.use(`/`,G5.static($r,{redirect:!1})),r.use((e,t,n)=>{if(e.method!==`GET`&&e.method!==`HEAD`){n();return}let r=e.headers[`next-router-prefetch`]!==void 0||e.headers.purpose===`prefetch`||e.headers[`sec-purpose`]===`prefetch`;TYe(e.path,{silent:r}).then(()=>n(),()=>n())}),r.post(`/_mintlify/api-public/search/:subdomain`,G5.json(),async(e,t)=>{let n=c??e.params.subdomain;try{let r=await fetch(`${o}/api/cli/${n}/search`,{method:`POST`,headers:{"Content-Type":`application/json`,...s?{Authorization:`Bearer ${s}`}:{}},body:JSON.stringify(e.body)}),i=await r.json();t.status(r.status).json(i)}catch{t.status(502).json({error:`search proxy failed`})}});let d=e=>async(t,n)=>{let r=c??t.params.subdomain;try{let i=await fetch(`${o}/api/cli/${r}/assistant/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`,...s?{Authorization:`Bearer ${s}`}:{}},body:JSON.stringify(t.body)});if(n.status(i.status),TXe(i,n),i.body){let e=i.body.getReader(),t=async()=>{let{done:r,value:i}=await e.read();if(r)n.end();else return n.write(i),t()};await t()}else n.end()}catch{n.headersSent?n.destroy():n.status(502).json({error:`assistant proxy failed`})}};for(let e of[`message`,`v2/message`])r.post(`/_mintlify/api-public/assistant/:subdomain/${e}`,G5.json({limit:`5mb`}),d(e));r.all(`*`,(e,t)=>l(e,t));let f=()=>{a.emit(`reload`)};QKe(f),fYe(e=>{a.emit(`compiling`,e)}),a.on(`connection`,e=>{for(let t of xYe())e.emit(`compiling`,t)});let p=p1(`server ready`),m=e.host===!0;i.listen(n,m?void 0:`localhost`,()=>{p(),u1(),e.needsUpdate&&t1((0,M$.jsx)(B$,{updateCommand:`${e.packageName} update`})),s||t1((0,M$.jsx)(V$,{loginCommand:`${e.packageName} login`})),typeof e.previewReadyMessage==`string`&&t1((0,M$.jsx)(I$,{message:e.previewReadyMessage})),t1((0,M$.jsx)(F$,{localUrl:`http://localhost:${t}`,networkUrl:m&&u?`http://${u}:${t}`:void 0})),mHe(),e.open&&(0,CJe.default)(`http://localhost:${t}`);let n=e.onExit??(()=>process.exit(0));process.on(`SIGINT`,n),process.on(`SIGTERM`,n)});let h=()=>{},g=new Promise(e=>{h=e});HRe(`watching for file changes`),fXe(f,{localSchema:e[`local-schema`],groups:e.groups,disableOpenApi:e.disableOpenapi,disablePrefetch:e.disablePrefetch,allowSourceRefs:!0,lazyPages:!0,nativePackages:!0},g),await m1(`initialize import cache`,()=>_7(li,e.fileImportsMap)),dYe(),await m1(`initialize frontmatter cache`,()=>$9()),await m1(`initialize docs config cache`,()=>yXe()),await m1(`refresh referenced files`,()=>j9()),h()},DXe=[`favicons/`,`.mint-content-source`],OXe=()=>{let e;try{e=FH($r)}catch{return}for(let t of e)DXe.some(e=>t.startsWith(e))||(_D(N.extname(t))||!Z.default.existsSync(N.join(li,t)))&&Z.default.removeSync(N.join($r,t))},kXe=async e=>{let t=await m1(`check internet`,()=>g1()),n=e[`local-schema`],r=e[`client-version`],i=e[`local-client-version`],a=e.packageName,o=e.groups,s=e.cliVersion,c=e.disableOpenapi,l=e.disablePrefetch;await m1(`ensure preview directory`,()=>Z.default.ensureDir(Wr)),!i&&!r&&ni===`next`&&h1(`seed preview from shared workspace`,()=>hHe());let u=await m1(`read local client version`,async()=>await(0,Z.pathExists)(qr)?Z.default.readFileSync(qr,`utf8`):null);u||i||t||(s1(),t1((0,M$.jsx)(H$,{message:`running ${a} dev after updating requires an internet connection.`})),await new Promise(e=>setTimeout(e,50)),process.exit(1)),t1((0,M$.jsx)(R$,{message:`preparing local preview...`}));let{needsUpdate:d,error:f}=await m1(`update local client`,()=>b8({versionString:u,clientVersion:r,localClientVersion:i,cliVersion:s}));f&&(s1(),t1((0,M$.jsx)(H$,{message:f})),await new Promise(e=>setTimeout(e,50)),process.exit(1)),await m1(`ensure docs.json`,()=>nKe()),h1(`clear prebuild output`,()=>{Z.default.emptyDirSync(ei);let e=N.join($r,`.mint-content-source`),t;try{t=Z.default.readFileSync(e,`utf8`)}catch{}t===li?OXe():(Z.default.emptyDirSync($r),Z.default.outputFileSync(e,li))}),await m1(`switch to local client directory`,async()=>{await Z.default.ensureDir(Yr),process.chdir(Yr)});let p;try{p=(await m1(`prebuild content`,()=>j$(li,{localSchema:n,groups:o,disableOpenApi:c,disablePrefetch:l,allowSourceRefs:!0,lazyPages:!0,nativePackages:!0})))?.fileImportsMap}catch(e){s1();let t=e instanceof Error&&e.message?e.message:`prebuild step failed`;t1((0,M$.jsx)(H$,{message:t})),await new Promise(e=>setTimeout(e,50)),process.exit(1)}await m1(`build npm packages`,()=>eqe()),await m1(`start preview runtime`,()=>EXe({...e,needsUpdate:d,fileImportsMap:p}))},AXe=async e=>{let t=Number(e.port??3e3);ii(t,e.classic===!0?`next`:`vite`);let n=aqe(t);try{await kXe(e)}catch(e){throw n(),e}};export{tW as $,Br as $t,U$ as A,KE as At,LRe as B,bh as Bt,d1 as C,NO as Ct,u1 as D,mD as Dt,c1 as E,hD as Et,H$ as F,Lh as Ft,z$ as G,bp as Gt,R$ as H,hp as Ht,I$ as I,Rh as It,NQ as J,Hs as Jt,ARe as K,up as Kt,F$ as L,Fh as Lt,G$ as M,__ as Mt,W$ as N,p_ as Nt,l1 as O,fD as Ot,P$ as P,zh as Pt,fQ as Q,ui as Qt,IRe as R,Eh as Rt,s1 as S,kO as St,zRe as T,Ode as Tt,L$ as U,vp as Ut,V$ as V,yp as Vt,B$ as W,_p as Wt,mQ as X,Ns as Xt,bQ as Y,Bs as Yt,dQ as Z,ks as Zt,r1 as _,aj as _t,LKe as a,dU as at,i1 as b,jO as bt,AKe as c,YEe as ct,SHe as d,EM as dt,Fr as en,MU as et,h8 as f,W_e as ft,n1 as g,oj as gt,_He as h,xj as ht,FKe as i,xU as it,FRe as j,qE as jt,e1 as k,dD as kt,eKe as l,TH as lt,g8 as m,uM as mt,qJe as n,TU as nt,E7 as o,RH as ot,m8 as p,wM as pt,O$ as q,lp as qt,lqe as r,EU as rt,jKe as s,FH as st,AXe as t,sr as tn,DU as tt,D8 as u,SH as ut,t1 as v,uge as vt,o1 as w,VD as wt,a1 as x,OO as xt,RRe as y,rj as yt,K$ as z,xh as zt};
@@ -0,0 +1,18 @@
1
+ import { createRequire as __mintCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __mintFileURLToPath } from 'node:url';
3
+ import { dirname as __mintDirname } from 'node:path';
4
+ const require = __mintCreateRequire(import.meta.url);
5
+ const __filename = __mintFileURLToPath(import.meta.url);
6
+ const __dirname = __mintDirname(__filename);
7
+ import{o as e}from"./rolldown-runtime-CEAe2Uac.js";import{a as t,c as n,i as r,r as i,s as a}from"./agent-Da2kI1tZ.js";import*as o from"node:readline";import{AsyncLocalStorage as s,AsyncResource as c}from"node:async_hooks";import l from"node:process";import{stripVTControlCharacters as u}from"node:util";const d=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,f=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,p=e=>e.name===`space`,m=e=>e.name===`backspace`,h=e=>e.name===`tab`,g=e=>`1234567890`.includes(e.name),_=e=>e.name===`enter`||e.name===`return`;var v=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},y=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},b=class extends Error{name=`ExitPromptError`},x=class extends Error{name=`HookError`},S=class extends Error{name=`ValidationError`};const C=new s;function w(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function T(e,t){let n=w(e);return C.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function E(){let e=C.getStore();if(!e)throw new x(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function D(){return E().rl}function O(e){return c.bind((...t)=>{let n=E(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function k(e){let t=E(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ee(){E().handleChange()}const A={queue(e){let t=E(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(D());if(r!=null&&typeof r!=`function`)throw new S(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=E();O(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=E();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function j(e){return k(t=>{let n=c.bind(function(e){t.get()!==e&&(t.set(e),ee())});if(t.initialized)return[t.get(),n];let r=typeof e==`function`?e():e;return t.set(r),[r,n]})}function M(e,t){k(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&A.queue(e),n.set(t)})}var N=/* @__PURE__ */ e(n(),1);function te(){return l.platform===`win32`?!!l.env.WT_SESSION||!!l.env.TERMINUS_SUBLIME||l.env.ConEmuTask===`{cmd::Cmder}`||l.env.TERM_PROGRAM===`Terminus-Sublime`||l.env.TERM_PROGRAM===`vscode`||l.env.TERM===`xterm-256color`||l.env.TERM===`alacritty`||l.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:l.env.TERM!==`linux`}const P={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},F={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},ne={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},re={...P,...F},ie={...P,...ne},ae=te()?re:ie;Object.entries(F);const oe={prefix:{idle:N.default.blue(`?`),done:N.default.green(ae.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>N.default.yellow(e))},style:{answer:N.default.cyan,message:N.default.bold,error:e=>N.default.red(`> ${e}`),defaultAnswer:e=>N.default.dim(`(${e})`),help:N.default.dim,highlight:N.default.cyan,key:e=>N.default.cyan(N.default.bold(`<${e}>`))}};function I(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function L(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=I(n)&&I(r)?L(n,r):r}return t}function R(...e){return L(oe,...e.filter(e=>e!=null))}function z({status:e=`idle`,theme:t}){let[n,r]=j(!1),[i,a]=j(0),{prefix:o,spinner:s}=R(t);return M(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function B(e,t){return k(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function V(e){return j({current:e})[0]}function H(e){let t=V(e);t.current=e,M(e=>{let n=!1,r=O((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var se=/* @__PURE__ */ e(a(),1),ce=/* @__PURE__ */ e(t(),1);function U(e,t){return e.split(`
8
+ `).flatMap(e=>(0,ce.default)(e,t,{trim:!1,hard:!0}).split(`
9
+ `).map(e=>e.trimEnd())).join(`
10
+ `)}function W(){return(0,se.default)({defaultWidth:80,output:D().output})}function le({active:e,renderedItems:t,pageSize:n,loop:r}){let i=V({lastPointer:e,lastActive:void 0}),{lastPointer:a,lastActive:o}=i.current,s=Math.floor(n/2),c=t.reduce((e,t)=>e+t.length,0),l=t.slice(0,e).reduce((e,t)=>e+t.length,0),u=l;if(c>n){if(r)u=a,o!=null&&o<e&&e-o<n&&(u=Math.min(s,Math.abs(e-o)===1?Math.min(a+(t[o]?.length??0),Math.max(l,a)):a+e-o));else{let r=t.slice(e).reduce((e,t)=>e+t.length,0);u=r<n-s?n-r:Math.min(l,s)}}return i.current.lastPointer=u,i.current.lastActive=e,u}function G({items:e,active:t,renderItem:n,pageSize:r,loop:i=!0}){let a=W(),o=t=>(t%e.length+e.length)%e.length,s=e.map((e,r)=>e==null?[]:U(n({item:e,index:r,isActive:r===t}),a).split(`
11
+ `)),c=s.reduce((e,t)=>e+t.length,0),l=e=>s[e]??[],u=le({active:t,renderedItems:s,pageSize:r,loop:i}),d=l(t).slice(0,r),f=u+d.length<=r?u:r-d.length,p=Array.from({length:r});p.splice(f,d.length,...d);let m=/* @__PURE__ */ new Set([t]),h=f+d.length,g=o(t+1);for(;h<r&&!m.has(g)&&(i&&c>r?g!==t:g>t);){let e=l(g).slice(0,r-h);p.splice(h,e.length,...e),m.add(g),h+=e.length,g=o(g+1)}for(h=f-1,g=o(t-1);h>=0&&!m.has(g)&&(i&&c>r?g!==t:g<t);){let e=l(g),t=e.slice(Math.max(0,e.length-h-1));p.splice(h-t.length+1,t.length,...t),m.add(g),h-=t.length,g=o(g-1)}return p.filter(e=>typeof e==`string`).join(`
12
+ `)}var ue=/* @__PURE__ */ e(r(),1);const K=(e=1)=>e>0?`[${e}A`:``,q=(e=1)=>e>0?`[${e}B`:``,J=(e,t)=>typeof t==`number`&&!Number.isNaN(t)?`[${t+1};${e+1}H`:`[${e+1}G`,Y=e=>e>0?(`\x1B[2K`+K(1)).repeat(e-1)+`\x1B[2K\x1B[G`:``,de=e=>e.split(`
13
+ `).length,fe=e=>e.split(`
14
+ `).pop()??``;var pe=class{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(e){this.rl=e,this.cursorPos=e.getCursorPos()}write(e){this.rl.output.unmute(),this.rl.output.write(e),this.rl.output.mute()}render(e,t=``){let n=fe(e),r=u(n),i=r;this.rl.line.length>0&&(i=i.slice(0,-this.rl.line.length)),this.rl.setPrompt(i),this.cursorPos=this.rl.getCursorPos();let a=W();e=U(e,a),t=U(t,a),r.length%a===0&&(e+=`
15
+ `);let o=e+(t?`
16
+ `+t:``),s=Math.floor(r.length/a)-this.cursorPos.rows+(t?de(t):0);s>0&&(o+=K(s)),o+=J(this.cursorPos.cols),this.write(q(this.extraLinesUnderPrompt)+Y(this.height)+o),this.extraLinesUnderPrompt=s,this.height=de(o)}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(J(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt(``);let t=q(this.extraLinesUnderPrompt);t+=e?Y(this.height):`
17
+ `,t+=`\x1B[?25h`,this.write(t),this.rl.close()}},me=class extends Promise{static withResolver(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}};function he(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,n)=>{let r=n.slice(1);return t=r,r},(/* @__PURE__ */ Error()).stack}catch{return t}return Error.prepareStackTrace=e,t}function X(e){let t=he();return(n,r={})=>{let{input:a=process.stdin,signal:s}=r,l=/* @__PURE__ */ new Set,u=new ue.default;u.pipe(r.output??process.stdout);let d=o.createInterface({terminal:!0,input:a,output:u}),f=new pe(d),{promise:p,resolve:m,reject:h}=me.withResolver(),g=()=>h(new y);if(s){let e=()=>h(new v({cause:s.reason}));if(s.aborted)return e(),Object.assign(p,{cancel:g});s.addEventListener(`abort`,e),l.add(()=>s.removeEventListener(`abort`,e))}l.add(i((e,t)=>{h(new b(`User force closed the prompt with ${e} ${t}`))}));let _=()=>h(new b(`User force closed the prompt with SIGINT`));d.on(`SIGINT`,_),l.add(()=>d.removeListener(`SIGINT`,_));let x=()=>f.checkCursorPos();return d.input.on(`keypress`,x),l.add(()=>d.input.removeListener(`keypress`,x)),T(d,i=>{let a=c.bind(()=>A.clearAll());return d.on(`close`,a),l.add(()=>d.removeListener(`close`,a)),i(()=>{try{let r=e(n,e=>{setImmediate(()=>m(e))});if(r===void 0){let e=t[1]?.getFileName();throw Error(`Prompt functions must return a string.\n at ${e}`)}let[i,a]=typeof r==`string`?[r]:r;f.render(i,a),A.run()}catch(e){h(e)}}),Object.assign(p.then(e=>(A.clearAll(),e),e=>{throw A.clearAll(),e}).finally(()=>{l.forEach(e=>e()),f.done({clearContent:!!r.clearPromptOnDone}),u.end()}).then(()=>p),{cancel:g})})}}var Z=class{separator=N.default.dim(Array.from({length:15}).join(ae.line));type=`separator`;constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`separator`)}};const ge={validationFailureMode:`keep`};var _e=X((e,t)=>{let{required:n,validate:r=()=>!0,prefill:i=`tab`}=e,a=R(ge,e.theme),[o,s]=j(`idle`),[c=``,l]=j(e.default),[u,d]=j(),[f,p]=j(``),g=z({status:o,theme:a});H(async(e,i)=>{if(o===`idle`){if(_(e)){let e=f||c;s(`loading`);let o=n&&!e?`You must provide a value`:await r(e);o===!0?(p(e),s(`done`),t(e)):(a.validationFailureMode===`clear`?p(``):i.write(f),d(o||`You must provide a valid value`),s(`idle`))}else m(e)&&!f?l(void 0):h(e)&&!f?(l(void 0),i.clearLine(0),i.write(c),p(c)):(p(i.line),d(void 0))}}),M(e=>{i===`editable`&&c&&(e.write(c),p(c))},[]);let v=a.style.message(e.message,o),y=f;typeof e.transformer==`function`?y=e.transformer(f,{isFinal:o===`done`}):o===`done`&&(y=a.style.answer(f));let b;c&&o!==`done`&&!f&&(b=a.style.defaultAnswer(c));let x=``;return u&&(x=a.style.error(u)),[[g,v,b,y].filter(e=>e!==void 0).join(` `),x]});function ve(){return l.platform===`win32`?!!l.env.WT_SESSION||!!l.env.TERMINUS_SUBLIME||l.env.ConEmuTask===`{cmd::Cmder}`||l.env.TERM_PROGRAM===`Terminus-Sublime`||l.env.TERM_PROGRAM===`vscode`||l.env.TERM===`xterm-256color`||l.env.TERM===`alacritty`||l.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:l.env.TERM!==`linux`}const ye={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},Q={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},be={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},xe={...ye,...Q},Se={...ye,...be},Ce=ve()?xe:Se;Object.entries(Q);const we={icon:{cursor:Ce.pointer},style:{disabled:e=>N.default.dim(`- ${e}`),searchTerm:e=>N.default.cyan(e),description:e=>N.default.cyan(e),keysHelpTip:e=>e.map(([e,t])=>`${N.default.bold(e)} ${N.default.dim(t)}`).join(N.default.dim(` • `))},helpMode:`always`};function $(e){return!Z.isSeparator(e)&&!e.disabled}function Te(e){return e.map(e=>{if(Z.isSeparator(e))return e;if(typeof e==`string`)return{value:e,name:e,short:e,disabled:!1};let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(n.description=e.description),n})}var Ee=X((e,t)=>{let{pageSize:n=7,validate:r=()=>!0}=e,i=R(we,e.theme),[a,o]=j(`loading`),[s,c]=j(``),[l,u]=j([]),[p,m]=j(),g=z({status:a,theme:i}),v=B(()=>({first:l.findIndex($),last:l.findLastIndex($)}),[l]),[y=v.first,b]=j();M(()=>{let t=new AbortController;return o(`loading`),m(void 0),(async()=>{try{let n=await e.source(s||void 0,{signal:t.signal});t.signal.aborted||(b(void 0),m(void 0),u(Te(n)),o(`idle`))}catch(e){!t.signal.aborted&&e instanceof Error&&m(e.message)}})(),()=>{t.abort()}},[s]);let x=l[y];H(async(e,n)=>{if(_(e)){if(x){o(`loading`);let e=await r(x.value);o(`idle`),e===!0?(o(`done`),t(x.value)):x.name===s?m(e||`You must provide a valid value`):(n.write(x.name),c(x.name))}else n.write(s)}else if(h(e)&&x)n.clearLine(0),n.write(x.name),c(x.name);else if(a!==`loading`&&(d(e)||f(e))){if(n.clearLine(0),d(e)&&y!==v.first||f(e)&&y!==v.last){let t=d(e)?-1:1,n=y;do n=(n+t+l.length)%l.length;while(!$(l[n]));b(n)}}else c(n.line)});let S=i.style.message(e.message,a),C;if(i.helpMode!==`never`){if(e.instructions){let{pager:t,navigation:r}=e.instructions;C=i.style.help(l.length>n?t:r)}else C=i.style.keysHelpTip([[`↑↓`,`navigate`],[`⏎`,`select`]])}let w=G({items:l,active:y,renderItem({item:e,isActive:t}){if(Z.isSeparator(e))return` ${e.separator}`;if(e.disabled){let t=typeof e.disabled==`string`?e.disabled:`(disabled)`;return i.style.disabled(`${e.name} ${t}`)}return(t?i.style.highlight:e=>e)(`${t?i.icon.cursor:` `} ${e.name}`)},pageSize:n,loop:!1}),T;p?T=i.style.error(p):l.length===0&&s!==``&&a===`idle`&&(T=i.style.error(`No results found`));let E;if(a===`done`&&x)return[g,S,i.style.answer(x.short)].filter(Boolean).join(` `).trimEnd();E=i.style.searchTerm(s);let D=x?.description;return[[g,S,E].filter(Boolean).join(` `).trimEnd(),[T??w,` `,D?i.style.description(D):``,C].filter(Boolean).join(`
18
+ `).trimEnd()]});export{g as _,G as a,d as b,B as c,M as d,j as f,_ as g,f as h,X as i,z as l,m,_e as n,H as o,S as p,Z as r,V as s,Ee as t,R as u,p as v,h as y};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __mintCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __mintFileURLToPath } from 'node:url';
3
+ import { dirname as __mintDirname } from 'node:path';
4
+ const require = __mintCreateRequire(import.meta.url);
5
+ const __filename = __mintFileURLToPath(import.meta.url);
6
+ const __dirname = __mintDirname(__filename);
7
+ import{d as e,f as t,h as n,m as r,o as i,p as a,s as o}from"./schemas-CVKidklE.js";import s from"node:os";import{link as c,lstat as l,mkdir as u,open as d,readFile as f,readdir as p,realpath as m,rename as h,rm as g,writeFile as _}from"node:fs/promises";import v from"node:path";import{createHash as y,randomUUID as b}from"node:crypto";import{createConnection as x,createServer as S}from"node:net";var C=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const w=r().refine(e=>!!e&&!v.isAbsolute(e)&&!e.includes(`\\`)&&!e.split(`/`).some(e=>e===`..`||e===`.`)),T=t({size:e(),mtimeMs:e(),ctimeMs:e(),digest:r().optional(),outputSize:e().optional(),outputMtimeMs:e().optional(),failed:o().optional()}),E=t({config:r().optional(),files:a(r(),i(n([w,T])))});function D(e){return C(this,void 0,void 0,function*(){let t=S(t=>{t.on(`error`,()=>t.destroy()),t.setTimeout(2e3,()=>t.destroy()),t.end(e)});yield new Promise((e,n)=>{t.once(`error`,n),t.listen(0,`127.0.0.1`,e)}),t.unref();let n=t.address();if(!n||typeof n==`string`)throw t.close(),Error(`Could not create composition cache owner endpoint.`);return{port:n.port,close:()=>new Promise(e=>t.close(()=>e()))}})}function O(e,t){return C(this,void 0,void 0,function*(){return new Promise((n,r)=>{let i=x({host:`127.0.0.1`,port:e}),a=``;i.setEncoding(`utf8`),i.setTimeout(2e3,()=>{i.destroy(/* @__PURE__ */ Error(`Timed out checking composition cache owner.`))}),i.on(`data`,e=>{a+=e,a.length>t.length&&(i.destroy(),n(!1))}),i.on(`end`,()=>n(a===t)),i.on(`error`,e=>{`code`in e&&e.code===`ECONNREFUSED`?n(!1):r(e)})})})}const k=t({hostname:r(),token:r().uuid(),port:e().int().min(1).max(65535),ticket:e().int().nonnegative().max(2**53-1)});function A(e,t,n){return C(this,void 0,void 0,function*(){let r=v.join(e,`acquire.${t}.json`),i=v.join(e,`acquire.${t}.tmp`),a=e=>C(this,void 0,void 0,function*(){yield _(i,JSON.stringify({hostname:s.hostname(),token:t,port:n,ticket:e}),{flag:`wx`}),yield h(i,r)}),o=t=>C(this,void 0,void 0,function*(){let n,r=v.join(e,t);try{n=yield f(r,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let i=k.parse(JSON.parse(n));if(i.hostname!==s.hostname())throw Error(`Composition cache acquisition is locked by another host.`);if(t!==`acquire.${i.token}.json`)throw Error(`Invalid composition acquisition record: ${r}`);if(!(yield O(i.port,i.token)))yield g(r,{force:!0});else return i}),c=()=>C(this,void 0,void 0,function*(){return(yield p(e)).filter(e=>e.startsWith(`acquire.`)&&e.endsWith(`.json`)&&e!==v.basename(r))}),l=()=>C(this,void 0,void 0,function*(){yield g(r,{force:!0}),yield g(i,{force:!0})});try{yield a(0);let e=1;for(let t of yield c()){let n=yield o(t);n&&(e=Math.max(e,n.ticket+1))}yield a(e);let n=Date.now()+1e4;for(let r of yield c())for(;;){let i=yield o(r);if(!i||i.ticket!==0&&(i.ticket>e||i.ticket===e&&i.token>t))break;if(Date.now()>=n)throw Error(`Composition cache acquisition is busy. Retry starting the preview.`);yield new Promise(e=>setTimeout(e,25))}return l}catch(e){throw yield l(),e}})}function j(e){return C(this,void 0,void 0,function*(){if((yield l(e).catch(e=>{if(e.code!==`ENOENT`)throw e}))?.isSymbolicLink())throw Error(`Composition cache contains a symbolic link: ${e}. Remove the damaged cache entry and retry.`)})}function M(n,i,a){return C(this,void 0,void 0,function*(){let o=v.resolve(n);yield u(o,{recursive:!0});let l=yield m(o),p=yield Promise.all(i.map(e=>C(this,void 0,void 0,function*(){return Object.assign(Object.assign({},e),{directory:yield m(e.directory)})})));for(let e of p){let t=v.relative(e.directory,l);if(!t||!t.startsWith(`..${v.sep}`)&&t!==`..`&&!v.isAbsolute(t))throw Error(`Composition cache must be outside every source directory.`)}let x=y(`sha256`).update(JSON.stringify([`composition-v5`,a,p])).digest(`hex`),S=v.join(l,x);yield j(S),yield u(S,{recursive:!0});let w=v.join(S,`lock.json`),T=b(),k=yield D(T),M=v.join(S,`owner.${T}.tmp`),N=!1,P=yield A(S,T,k.port).catch(e=>C(this,void 0,void 0,function*(){throw yield k.close(),e}));try{yield _(M,JSON.stringify({pid:process.pid,hostname:s.hostname(),token:T,port:k.port}),{flag:`wx`});for(let n=0;n<2;n++)try{yield c(M,w),N=!0;break}catch(n){if(!(n instanceof Error)||!(`code`in n)||n.code!==`EEXIST`)throw n;let i=yield C(this,void 0,void 0,function*(){try{return t({pid:e().int().positive(),hostname:r(),token:r(),port:e().int().min(1).max(65535).optional()}).parse(JSON.parse(yield f(w,`utf8`)))}catch{throw Error(`Invalid composition cache lock: ${w}. Stop previews using this cache, remove this lock file, and retry.`)}});if(i.hostname!==s.hostname())throw Error(`Composition cache is locked by another host.`);if(i.port!==void 0){if(!(yield O(i.port,i.token))){yield g(w);continue}}else try{process.kill(i.pid,0)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ESRCH`){yield g(w);continue}throw e}throw Error(`This composition cache is already in use by another preview.`)}}finally{yield P(),N||(yield k.close()),yield g(M,{force:!0})}if(!N)throw Error(`Could not acquire composition cache lock.`);let F=()=>C(this,void 0,void 0,function*(){if(N)try{let e=JSON.parse(yield f(w,`utf8`));typeof e==`object`&&e&&`token`in e&&e.token===T&&(yield g(w))}finally{N=!1,yield k.close()}}),I=v.join(S,`content`),L=v.join(S,`index.json`);try{yield j(I),yield j(L);let e;try{e=E.parse(JSON.parse(yield f(L,`utf8`)))}catch{}return e||(yield g(I,{recursive:!0,force:!0})),yield u(I,{recursive:!0}),{directory:I,index:e,close:F,save:e=>C(this,void 0,void 0,function*(){let t=v.join(S,`index.${T}.tmp`),n=yield d(t,`w`);try{yield n.writeFile(JSON.stringify(e)),yield n.sync()}finally{yield n.close()}yield h(t,L)})}}catch(e){throw yield F(),e}})}export{M as openCompositionCache};
@@ -4,4 +4,4 @@ import { dirname as __mintDirname } from 'node:path';
4
4
  const require = __mintCreateRequire(import.meta.url);
5
5
  const __filename = __mintFileURLToPath(import.meta.url);
6
6
  const __dirname = __mintDirname(__filename);
7
- export{t as default}from"./yargs-DxgFwn6A.js";
7
+ export{t as isMultiRepoDev,n as multiRepoOptions,r as runMultiRepoDev}from"./multi-repo-command-tJDv-3QE.js";