tildefriends/deps/prettier/standalone.mjs

40 lines
80 KiB
JavaScript
Raw Normal View History

var yu=Object.create;var vt=Object.defineProperty;var Au=Object.getOwnPropertyDescriptor;var vu=Object.getOwnPropertyNames;var Bu=Object.getPrototypeOf,wu=Object.prototype.hasOwnProperty;var cr=e=>{throw TypeError(e)};var fr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bt=(e,t)=>{for(var r in t)vt(e,r,{get:t[r],enumerable:!0})},_u=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of vu(t))!wu.call(e,u)&&u!==r&&vt(e,u,{get:()=>t[u],enumerable:!(n=Au(t,u))||n.enumerable});return e};var Me=(e,t,r)=>(r=e!=null?yu(Bu(e)):{},_u(t||!e||!e.__esModule?vt(r,"default",{value:e,enumerable:!0}):r,e));var xu=(e,t,r)=>t.has(e)||cr("Cannot "+r);var dr=(e,t,r)=>t.has(e)?cr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r);var pe=(e,t,r)=>(xu(e,t,"access private method"),r);var st=fr((na,Fn)=>{"use strict";var pn=new Proxy(String,{get:()=>pn});Fn.exports=pn});var Wn=fr(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});function Bi(){return new Proxy({},{get:()=>e=>e})}var Hn=/\r\n|[\n\r\u2028\u2029]/;function wi(e,t,r){let n=Object.assign({column:0,line:-1},e.start),u=Object.assign({},n,e.end),{linesAbove:i=2,linesBelow:o=3}=r||{},s=n.line,a=n.column,D=u.line,l=u.column,p=Math.max(s-(i+1),0),f=Math.min(t.length,D+o);s===-1&&(p=0),D===-1&&(f=t.length);let d=D-s,c={};if(d)for(let F=0;F<=d;F++){let m=F+s;if(!a)c[m]=!0;else if(F===0){let h=t[m-1].length;c[m]=[a,h-a+1]}else if(F===d)c[m]=[0,l];else{let h=t[m-F].length;c[m]=[0,h]}}else a===l?a?c[s]=[a,0]:c[s]=!0:c[s]=[a,l-a];return{start:p,end:f,markerLines:c}}function _i(e,t,r={}){let u=Bi(!1),i=e.split(Hn),{start:o,end:s,markerLines:a}=wi(t,i,r),D=t.start&&typeof t.start.column=="number",l=String(s).length,f=e.split(Hn,s).slice(o,s).map((d,c)=>{let F=o+1+c,h=` ${` ${F}`.slice(-l)} |`,C=a[F],v=!a[F+1];if(C){let E="";if(Array.isArray(C)){let g=d.slice(0,Math.max(C[0]-1,0)).replace(/[^\t]/g," "),j=C[1]||1;E=[`
`,u.gutter(h.replace(/\d/g," "))," ",g,u.marker("^").repeat(j)].join(""),v&&r.message&&(E+=" "+u.message(r.message))}return[u.marker(">"),u.gutter(h),d.length>0?` ${d}`:"",E].join("")}else return` ${u.gutter(h)}${d.length>0?` ${d}`:""}`}).join(`
`);return r.message&&!D&&(f=`${" ".repeat(l+1)}${r.message}
${f}`),f}rr.codeFrameColumns=_i});var lr={};Bt(lr,{__debug:()=>Do,check:()=>so,doc:()=>sr,format:()=>gu,formatWithCursor:()=>Cu,getSupportInfo:()=>ao,util:()=>Dr,version:()=>lu});var bu=(e,t,r,n)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(r,n):r.global?t.replace(r,n):t.split(r).join(n)},ne=bu;function M(){}M.prototype={diff:function(t,r){var n,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=u.callback;typeof u=="function"&&(i=u,u={});var o=this;function s(E){return E=o.postProcess(E,u),i?(setTimeout(function(){i(E)},0),!0):E}t=this.castInput(t,u),r=this.castInput(r,u),t=this.removeEmpty(this.tokenize(t,u)),r=this.removeEmpty(this.tokenize(r,u));var a=r.length,D=t.length,l=1,p=a+D;u.maxEditLength!=null&&(p=Math.min(p,u.maxEditLength));var f=(n=u.timeout)!==null&&n!==void 0?n:1/0,d=Date.now()+f,c=[{oldPos:-1,lastComponent:void 0}],F=this.extractCommon(c[0],r,t,0,u);if(c[0].oldPos+1>=D&&F+1>=a)return s(pr(o,c[0].lastComponent,r,t,o.useLongestToken));var m=-1/0,h=1/0;function C(){for(var E=Math.max(m,-l);E<=Math.min(h,l);E+=2){var g=void 0,j=c[E-1],b=c[E+1];j&&(c[E-1]=void 0);var X=!1;if(b){var ae=b.oldPos-E;X=b&&0<=ae&&ae<a}var $e=j&&j.oldPos+1<D;if(!X&&!$e){c[E]=void 0;continue}if(!$e||X&&j.oldPos<b.oldPos?g=o.addToPath(b,!0,!1,0,u):g=o.addToPath(j,!1,!0,1,u),F=o.extractCommon(g,r,t,E,u),g.oldPos+1>=D&&F+1>=a)return s(pr(o,g.lastComponent,r,t,o.useLongestToken));c[E]=g,g.oldPos+1>=D&&(h=Math.min(h,E-1)),F+1>=a&&(m=Math.max(m,E+1))}l++}if(i)(function E(){setTimeout(function(){if(l>p||Date.now()>d)return i();C()||E()},0)})();else for(;l<=p&&Date.now()<=d;){var v=C();if(v)return v}},addToPath:function(t,r,n,u,i){var o=t.lastComponent;return o&&!i.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:t.oldPos+u,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+u,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}},extractCommon:function(t,r,n,u,i){for(var o=r.length,s=n.length,a=t.oldPos,D=a-u,l=0;D+1<o&&a+1<s&&this.equals(n[a+1],r[D+1],i);)D++,a++,l++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(t.lastComponent={count:l,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,D},equals:function(t,r,n){return n.comparator?n.comparator(t,r):t===r||n.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return Array.from(t)},join:function(t){return t.join("")},postProcess:function(t){return t}};function pr(e,t,r,n,u){for(var i=[],o;t;)i.push(t),o=t.previousComponent,delete t.previousComponent,t=o;i.reverse();for(var s=0,a=i.length,D=0,l=0;s<a;s++){var p=i[s];if(p.removed)p.value=e.join(n.slice(l,l+p.count)),l+=p.count;else{if(!p.added&&u){var f=r.slice(D,D+p.count);f=f.map(function(d,c){var F=n[l+c];return F.length>d.length?F:d}),p.value=e.join(f)}else p.value=e.join(r.slice(D,D+p.count));D+=p.count,p.added||(l+=p.count)}}return i}var Fo=new M;function Fr(e,t){var r;for(r=0;r<e.length&&r<t.length;r++)if(e[r]!=t[r])return e.slice(0,r);return e.slice(0,r)}function mr(e,t){var r;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(r=0;r<e.length&&r<t.length;r++)if(e[e.length-(r+1)]!=t[t.length-(r+1)])return e.slice(-r);return e.slice(-r)}function wt(e,t,r){if(e.slice(0,t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't start with prefix ").concat(JSON.stringify(t),"; this is a bug"));return r+e.slice(t.length)}function _t(e,t,r){if(!t)return e+r;if(e.slice(-t.length)!=t)throw Error("string ".concat(JSON.stringify(e)," doesn't end with suffix ").concat(JSON.stringify(t),"; this is a bug"));return e.slice(0,-t.length)+r}function we(e,t){return wt(e,t,"")}function Ue(e,t){return _t(e,t,"")}function hr(e,t){return t.slice(0,Nu(e,t))}function Nu(e,t){var r=0;e.length>t.length&&(r=e.length-t.length);var n=t.length;e.length<t.length&&(n=e.length);var u=Array(n),i=0;u[0]=0;for(var o=1;o<n;o++){for(t[o]==
`));var r=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var u=0;u<n.length;u++){var i=n[u];u%2&&!t.newlineIsToken?r[r.length-1]+=i:r.push(i)}return r};Nt.equals=function(e,t,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
`))&&(e=e.trim()),(!r.newlineIsToken||!t.includes(`
`))&&(t=t.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),t.endsWith(`
`)&&(t=t.slice(0,-1))),M.prototype.equals.call(this,e,t,r)};var Tu=new M;Tu.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var ku=new M;ku.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function xt(e){"@babel/helpers - typeof";return xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(e)}var _e=new M;_e.useLongestToken=!0;_e.tokenize=Nt.tokenize;_e.castInput=function(e,t){var r=t.undefinedReplacement,n=t.stringifyReplacer,u=n===void 0?function(i,o){return typeof o>"u"?r:o}:n;return typeof e=="string"?e:JSON.stringify(bt(e,null,null,u),u," ")};_e.equals=function(e,t,r){return M.prototype.equals.call(_e,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),r)};function bt(e,t,r,n,u){t=t||[],r=r||[],n&&(e=n(u,e));var i;for(i=0;i<t.length;i+=1)if(t[i]===e)return r[i];var o;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),o=new Array(e.length),r.push(o),i=0;i<e.length;i+=1)o[i]=bt(e[i],t,r,n,u);return t.pop(),r.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),xt(e)==="object"&&e!==null){t.push(e),o={},r.push(o);var s=[],a;for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&s.push(a);for(s.sort(),i=0;i<s.length;i+=1)a=s[i],o[a]=bt(e[a],t,r,n,a);t.pop(),r.pop()}else o=e;return o}var ze=new M;ze.tokenize=function(e){return e.slice()};ze.join=ze.removeEmpty=function(e){return e};function Cr(e,t,r){return ze.diff(e,t,r)}function gr(e){let t=e.indexOf("\r");return t!==-1?e.charAt(t+1)===`
`?"crlf":"cr":"lf"}function xe(e){switch(e){case"cr":return"\r";case"crlf":return`\r
`;default:return`
`}}function Ot(e,t){let r;switch(t){case`
`:r=/\n/gu;break;case"\r":r=/\r/gu;break;case`\r
`:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let n=e.match(r);return n?n.length:0}function yr(e){return ne(!1,e,/\r\n?/gu,`
`)}var U="string",H="array",V="cursor",T="indent",k="align",L="trim",B="group",N="fill",w="if-break",P="indent-if-break",I="line-suffix",R="line-suffix-boundary",A="line",O="label",_="break-parent",Ke=new Set([V,T,k,L,B,N,w,P,I,R,A,O,_]);function Lu(e){if(typeof e=="string")return U;if(Array.isArray(e))return H;if(!e)return;let{type:t}=e;if(Ke.has(t))return t}var z=Lu;var Pu=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function Iu(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return`Unexpected doc '${t}',
Expected it to be 'string' or 'object'.`;if(z(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=Pu([...Ke].map(u=>`'${u}'`));return`Unexpected doc.type '${e.type}'.
Expected it to be ${n}.`}var St=class extends Error{name="InvalidDocError";constructor(t){super(Iu(t)),this.doc=t}},Q=St;var Ar={};function Ru(e,t,r,n){let u=[e];for(;u.length>0;){let i=u.pop();if(i===Ar){r(u.pop());continue}r&&u.push(i,Ar);let o=z(i);if(!o)throw new Q(i);if((t==null?void 0:t(i))!==!1)switch(o){case H:case N:{let s=o===H?i:i.parts;for(let a=s.length,D=a-1;D>=0;--D)u.push(s[D]);break}case w:u.push(i.flatContents,i.breakContents);break;case B:if(n&&i.expandedStates)for(let s=i.expandedStates.length,a=s-1;a>=0;--a)u.push(i.expandedStates[a]);else u.push(i.contents);break;case k:case T:case P:case O:case I:u.push(i.contents);break;case U:case V:case L:case R:case A:case _:break;default:throw new Q(i)}}}var be=Ru;var vr=()=>{},G=vr,Je=vr;function le(e){return G(e),{type:T,contents:e}}function De(e,t){return G(t),{type:k,contents:t,n:e}}function Tt(e,t={}){return G(e),Je(t.expandedStates,!0),{type:B,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function Br(e){return De(Number.NEGATIVE_INFINITY,e)}function wr(e){return De({type:"root"},e)}function _r(e){return De(-1,e)}function xr(e,t){return Tt(e[0],{...t,expandedStates:e})}function br(e){return Je(e),{type:N,parts:e}}function Nr(e,t="",r={}){return G(e),t!==""&&G(t),{type:w,breakContents:e,flatContents:t,groupId:r.groupId}}function Or(e,t){return G(e),{type:P,contents:e,groupId:t.groupId,negate:t.negate}}function Ne(e){return G(e),{type:I,contents:e}}var Sr={type:R},Fe={type:_},Tr={type:L},Oe={type:A,hard:!0},kt={type:A,hard:!0,literal:!0},qe={type:A},kr={type:A,soft:!0},K=[Oe,Fe],Xe=[kt,Fe],Z={type:V};function Se(e,t){G(e),Je(t);let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function Qe(e,t,r){G(e);let n=e;if(t>0){for(let u=0;u<Math.floor(t/r);++u)n=le(n);n=De(t%r,n),n=De(Number.NEGATIVE_INFINITY,n)}return n}function Lr(e,t){return G(t),e?{type:O,label:e,contents:t}:t}function ee(e){var t;if(!e)return"";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...ee(n));else{let u=ee(n);u!==""&&r.push(u)}return r}return e.type===w?{...e,breakContents:ee(e.breakContents),flatContents:ee(e.flatContents)}:e.type===B?{...e,contents:ee(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(ee)}:e.type===N?{type:"fill",parts:e.parts.map(ee)}:e.contents?{...e,contents:ee(e.contents)}:e}function Pr(e){let t=Object.create(null),r=new Set;return n(ee(e));function n(i,o,s){var a,D;if(typeof i=="string")return JSON.stringify(i);if(Array.isArray(i)){let l=i.map(n).filter(Boolean);return l.length===1?l[0]:`[${l.join(", ")}]`}if(i.type===A){let l=((a=s==null?void 0:s[o+1])==null?void 0:a.type)===_;return i.literal?l?"literalline":"literallineWithoutBreakParent":i.hard?l?"hardline":"hardlineWithoutBreakParent":i.soft?"softline":"line"}if(i.type===_)return((D=s==null?void 0:s[o-1])==null?void 0:D.type)===A&&s[o-1].hard?void 0:"breakParent";if(i.type===L)return"trim";if(i.type===T)return"indent("+n(i.contents)+")";if(i.type===k)return i.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(i.contents)+")":i.n<0?"dedent("+n(i.contents)+")":i.n.type==="root"?"markAsRoot("+n(i.contents)+")":"align("+JSON.stringify(i.n)+", "+n(i.contents)+")";if(i.type===w)return"ifBreak("+n(i.breakContents)+(i.flatContents?", "+n(i.flatContents):"")+(i.groupId?(i.flatContents?"":', ""')+`, { groupId: ${u(i.groupId)} }`:"")+")";if(i.type===P){let l=[];i.negate&&l.push("negate: true"),i.groupId&&l.push(`groupId: ${u(i.groupId)}`);let p=l.length>0?`, { ${l.join(", ")} }`:"";return`indentIfBreak(${n(i.contents)}${p})`}if(i.type===B){let l=[];i.break&&i.break!=="propagated"&&l.push("shouldBreak: true"),i.id&&l.push(`id: ${u(i.id)}`);let p=l.length>0?`, { ${l.join(", ")} }`:"";return i.expandedStates?`conditionalGroup([${i.expandedStates.map(f=>n(f)).join(",")}]${p})`:`group(${n(i.contents)}${p})`}if(i.type===N)return`fill([${i.parts.map(l=>n(l)).join(", ")}])`;if(i.type===I)return"lineSuffix("+n(i.contents)+")";if(i.type===R)return"lineSuffixBoundary";if(i.type===O)return`label(${JSON.stringify(i.label)}, ${n(i.contents)})`;t
`)):r)}function Vu(e){if(e.type===A)return!0}function zr(e){return Ze(e,Vu,!1)}function me(e,t){return e.type===O?{...e,contents:t(e.contents)}:t(e)}var Y=Symbol("MODE_BREAK"),J=Symbol("MODE_FLAT"),he=Symbol("cursor"),Gr=Symbol("DOC_FILL_PRINTED_LENGTH");function Kr(){return{value:"",length:0,queue:[]}}function zu(e,t){return Lt(e,{type:"indent"},t)}function Gu(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||Kr():t<0?Lt(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:Lt(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function Lt(e,t,r){let n=t.type==="dedent"?e.queue.slice(0,-1):[...e.queue,t],u="",i=0,o=0,s=0;for(let c of n)switch(c.type){case"indent":l(),r.useTabs?a(1):D(r.tabWidth);break;case"stringAlign":l(),u+=c.n,i+=c.n.length;break;case"numberAlign":o+=1,s+=c.n;break;default:throw new Error(`Unexpected type '${c.type}'`)}return f(),{...e,value:u,length:i,queue:n};function a(c){u+=" ".repeat(c),i+=r.tabWidth*c}function D(c){u+=" ".repeat(c),i+=c}function l(){r.useTabs?p():f()}function p(){o>0&&a(o),d()}function f(){s>0&&D(s),d()}function d(){o=0,s=0}}function Pt(e){let t=0,r=0,n=e.length;e:for(;n--;){let u=e[n];if(u===he){r++;continue}for(let i=u.length-1;i>=0;i--){let o=u[i];if(o===" "||o===" ")t++;else{e[n]=u.slice(0,i+1);break e}}}if(t>0||r>0)for(e.length=n+1;r-- >0;)e.push(he);return t}function tt(e,t,r,n,u,i){if(r===Number.POSITIVE_INFINITY)return!0;let o=t.length,s=[e],a=[];for(;r>=0;){if(s.length===0){if(o===0)return!0;s.push(t[--o]);continue}let{mode:D,doc:l}=s.pop(),p=z(l);switch(p){case U:a.push(l),r-=Te(l);break;case H:case N:{let f=p===H?l:l.parts;for(let d=f.length-1;d>=0;d--)s.push({mode:D,doc:f[d]});break}case T:case k:case P:case O:s.push({mode:D,doc:l.contents});break;case L:r+=Pt(a);break;case B:{if(i&&l.break)return!1;let f=l.break?Y:D,d=l.expandedStates&&f===Y?y(!1,l.expandedStates,-1):l.contents;s.push({mode:f,doc:d});break}case w:{let d=(l.groupId?u[l.groupId]||J:D)===Y?l.breakContents:l.flatContents;d&&s.push({mode:D,doc:d});break}case A:if(D===Y||l.hard)return!0;l.soft||(a.push(" "),r--);break;case I:n=!0;break;case R:if(n)return!1;break}}return!1}function Ee(e,t){let r={},n=t.printWidth,u=xe(t.endOfLine),i=0,o=[{ind:Kr(),mode:Y,doc:e}],s=[],a=!1,D=[],l=0;for(Mr(e);o.length>0;){let{ind:f,mode:d,doc:c}=o.pop();switch(z(c)){case U:{let F=u!==`
`?ne(!1,c,`
`,u):c;s.push(F),o.length>0&&(i+=Te(F));break}case H:for(let F=c.length-1;F>=0;F--)o.push({ind:f,mode:d,doc:c[F]});break;case V:if(l>=2)throw new Error("There are too many 'cursor' in doc.");s.push(he),l++;break;case T:o.push({ind:zu(f,t),mode:d,doc:c.contents});break;case k:o.push({ind:Gu(f,c.n,t),mode:d,doc:c.contents});break;case L:i-=Pt(s);break;case B:switch(d){case J:if(!a){o.push({ind:f,mode:c.break?Y:J,doc:c.contents});break}case Y:{a=!1;let F={ind:f,mode:J,doc:c.contents},m=n-i,h=D.length>0;if(!c.break&&tt(F,o,m,h,r))o.push(F);else if(c.expandedStates){let C=y(!1,c.expandedStates,-1);if(c.break){o.push({ind:f,mode:Y,doc:C});break}else for(let v=1;v<c.expandedStates.length+1;v++)if(v>=c.expandedStates.length){o.push({ind:f,mode:Y,doc:C});break}else{let E=c.expandedStates[v],g={ind:f,mode:J,doc:E};if(tt(g,o,m,h,r)){o.push(g);break}}}else o.push({ind:f,mode:Y,doc:c.contents});break}}c.id&&(r[c.id]=y(!1,o,-1).mode);break;case N:{let F=n-i,m=c[Gr]??0,{parts:h}=c,C=h.length-m;if(C===0)break;let v=h[m+0],E=h[m+1],g={ind:f,mode:J,doc:v},j={ind:f,mode:Y,doc:v},b=tt(g,[],F,D.length>0,r,!0);if(C===1){b?o.push(g):o.push(j);break}let X={ind:f,mode:J,doc:E},ae={ind:f,mode:Y,doc:E};if(C===2){b?o.push(X,g):o.push(ae,j);break}let $e=h[m+2],At={ind:f,mode:d,doc:{...c,[Gr]:m+2}};tt({ind:f,mode:J,doc:[v,E,$e]},[],F,D.length>0,r,!0)?o.push(At,X,g):b?o.push(At,ae,g):o.push(At,ae,j);break}case w:case P:{let F=c.groupId?r[c.groupId]:d;if(F===Y){let m=c.type===w?c.breakContents:c.negate?c.contents:le(c.contents);m&&o.push({ind:f,mode:d,doc:m})}if(F===J){let m=c.type===w?c.flatContents:c.negate?le(c.contents):c.contents;m&&o.push({ind:f,mode:d,doc:m})}break}case I:D.push({ind:f,mode:d,doc:c.contents});break;case R:D.length>0&&o.push({ind:f,mode:d,doc:Oe});break;case A:switch(d){case J:if(c.hard)a=!0;else{c.soft||(s.push(" "),i+=1);break}case Y:if(D.length>0){o.push({ind:f,mode:d,doc:c},...D.reverse()),D.length=0;break}c.literal?f.root?(s.push(u,f.root.value),i=f.root.length):(s.push(u),i=0):(i-=Pt(s),s.push(u+f.value),i=f.length);break}break;case O:o.push({ind:f,mode:d,doc:c.contents});break;case _:break;default:throw new Q(c)}o.length===0&&D.length>0&&(o.push(...D.reverse()),D.length=0)}let p=s.indexOf(he);if(p!==-1){let f=s.indexOf(he,p+1);if(f===-1)return{formatted:s.filter(m=>m!==he).join("")};let d=s.slice(0,p).join(""),c=s.slice(p+1,f).join(""),F=s.slice(f+1).join("");return{formatted:d+c+F,cursorNodeStart:d.length,cursorNodeText:c}}return{formatted:s.join("")}}function Ku(e,t,r=0){let n=0;for(let u=r;u<e.length;++u)e[u]===" "?n=n+t-n%t:n++;return n}var Ce=Ku;var te,Rt,rt,It=class{constructor(t){dr(this,te);this.stack=[t]}get key(){let{stack:t,siblings:r}=this;return y(!1,t,r===null?-2:-4)??null}get index(){return this.siblings===null?null:y(!1,this.stack,-2)}get node(){return y(!1,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:t}=this,r=y(!1,t,-3);return Array.isArray(r)?r:null}get next(){let{siblings:t}=this;return t===null?null:t[this.index+1]}get previous(){let{siblings:t}=this;return t===null?null:t[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:t,index:r}=this;return t!==null&&r===t.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...pe(this,te,rt).call(this)]}getName(){let{stack:t}=this,{length:r}=t;return r>1?y(!1,t,-2):null}getValue(){return y(!1,this.stack,-1)}getNode(t=0){let r=pe(this,te,Rt).call(this,t);return r===-1?null:this.stack[r]}getParentNode(t=0){return this.getNode(t+1)}call(t,...r){let{stack:n}=this,{length:u}=n,i=y(!1,n,-1);for(let o of r)i=i[o],n.push(o,i);try{return t(this)}finally{n.length=u}}callParent(t,r=0){let n=pe(this,te,Rt).call(this,r+1),u=this.stack.splice(n+1);try{return t(this)}finally{this.stack.push(...u)}}each(t,...r){let{stack:n}=this,{length:u}=n,i=y(!1,n,-1);for(let o of r)i=i[o],n.push(o,i);try{for(let o=0;o<i.length;++o)n.push(o,i[o]),t(this,o,i),n.length-=2}finally{n.length=u}}map(t,...r)
`)return t-2;if(u===`
`||u==="\r"||u==="\u2028"||u==="\u2029")return t-1}else{if(u==="\r"&&e.charAt(t+1)===`
`)return t+2;if(u===`
`||u==="\r"||u==="\u2028"||u==="\u2029")return t+1}return t}var W=qu;function Xu(e,t,r={}){let n=S(e,r.backwards?t-1:t,r),u=W(e,n,r);return n!==u}var $=Xu;function Qu(e){return Array.isArray(e)&&e.length>0}var Yt=Qu;var tn=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Zu=e=>Object.keys(e).filter(t=>!tn.has(t));function ei(e){return e?t=>e(t,tn):Zu}var q=ei;function ti(e){let t=e.type||e.kind||"(unknown type)",r=String(e.name||e.id&&(typeof e.id=="object"?e.id.name:e.id)||e.key&&(typeof e.key=="object"?e.key.name:e.key)||e.value&&(typeof e.value=="object"?"":String(e.value))||e.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),t+(r?" "+r:"")}function jt(e,t){(e.comments??(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=ti(e)}function ue(e,t){t.leading=!0,t.trailing=!1,jt(e,t)}function re(e,t,r){t.leading=!1,t.trailing=!1,r&&(t.marker=r),jt(e,t)}function ie(e,t){t.leading=!1,t.trailing=!0,jt(e,t)}var Ht=new WeakMap;function it(e,t){if(Ht.has(e))return Ht.get(e);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:u},locStart:i,locEnd:o}=t;if(!n)return[];let s=((r==null?void 0:r(e,t))??[...ge(e,{getVisitorKeys:q(u)})]).flatMap(a=>n(a)?[a]:it(a,t));return s.sort((a,D)=>i(a)-i(D)||o(a)-o(D)),Ht.set(e,s),s}function nn(e,t,r,n){let{locStart:u,locEnd:i}=r,o=u(t),s=i(t),a=it(e,r),D,l,p=0,f=a.length;for(;p<f;){let d=p+f>>1,c=a[d],F=u(c),m=i(c);if(F<=o&&s<=m)return nn(c,t,r,c);if(m<=o){D=c,p=d+1;continue}if(s<=F){l=c,f=d;continue}throw new Error("Comment location overlaps with node location")}if((n==null?void 0:n.type)==="TemplateLiteral"){let{quasis:d}=n,c=$t(d,t,r);D&&$t(d,D,r)!==c&&(D=null),l&&$t(d,l,r)!==c&&(l=null)}return{enclosingNode:n,precedingNode:D,followingNode:l}}var Wt=()=>!1;function un(e,t){let{comments:r}=e;if(delete e.comments,!Yt(r)||!t.printer.canAttachComment)return;let n=[],{locStart:u,locEnd:i,printer:{experimentalFeatures:{avoidAstMutation:o=!1}={},handleComments:s={}},originalText:a}=t,{ownLine:D=Wt,endOfLine:l=Wt,remaining:p=Wt}=s,f=r.map((d,c)=>({...nn(e,d,t),comment:d,text:a,options:t,ast:e,isLastComment:r.length-1===c}));for(let[d,c]of f.entries()){let{comment:F,precedingNode:m,enclosingNode:h,followingNode:C,text:v,options:E,ast:g,isLastComment:j}=c;if(E.parser==="json"||E.parser==="json5"||E.parser==="jsonc"||E.parser==="__js_expression"||E.parser==="__ts_expression"||E.parser==="__vue_expression"||E.parser==="__vue_ts_expression"){if(u(F)-u(g)<=0){ue(g,F);continue}if(i(F)-i(g)>=0){ie(g,F);continue}}let b;if(o?b=[c]:(F.enclosingNode=h,F.precedingNode=m,F.followingNode=C,b=[F,v,E,g,j]),ri(v,E,f,d))F.placement="ownLine",D(...b)||(C?ue(C,F):m?ie(m,F):h?re(h,F):re(g,F));else if(ni(v,E,f,d))F.placement="endOfLine",l(...b)||(m?ie(m,F):C?ue(C,F):h?re(h,F):re(g,F));else if(F.placement="remaining",!p(...b))if(m&&C){let X=n.length;X>0&&n[X-1].followingNode!==C&&rn(n,E),n.push(c)}else m?ie(m,F):C?ue(C,F):h?re(h,F):re(g,F)}if(rn(n,t),!o)for(let d of r)delete d.precedingNode,delete d.enclosingNode,delete d.followingNode}var on=e=>!/[\S\n\u2028\u2029]/u.test(e);function ri(e,t,r,n){let{comment:u,precedingNode:i}=r[n],{locStart:o,locEnd:s}=t,a=o(u);if(i)for(let D=n-1;D>=0;D--){let{comment:l,precedingNode:p}=r[D];if(p!==i||!on(e.slice(s(l),a)))break;a=o(l)}return $(e,a,{backwards:!0})}function ni(e,t,r,n){let{comment:u,followingNode:i}=r[n],{locStart:o,locEnd:s}=t,a=s(u);if(i)for(let D=n+1;D<r.length;D++){let{comment:l,followingNode:p}=r[D];if(p!==i||!on(e.slice(a,o(l))))break;a=s(l)}return $(e,a)}function rn(e,t){var s,a;let r=e.length;if(r===0)return;let{precedingNode:n,followingNode:u}=e[0],i=t.locStart(u),o;for(o=r;o>0;--o){let{comment:D,precedingNode:l,followingNode:p}=e[o-1];Pe.strictEqual(l,n),Pe.strictEqual(p,u);let f=t.originalText.slice(t.locEnd(D),i);if(((a=(s=t.printer).isGap)==null?void 0:a.call(s,f,t))??/^[\s(]*$/u.test(f))i=t.locStart(D);else break}for(let[D,{comment:l}]of e.entries())D<o?ie(n,l):ue(u,l);for(let D of[n,u])D.comments&&D.comments.length>1&&D.comments.sort((l,p)=>t.locStart(l)-t.locStart(p));e.length=0}function $
(mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:e=>typeof e=="string"||typeof e=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>typeof e=="string"||typeof e=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:`Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.`,cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function ot({plugins:e=[],showDeprecated:t=!1}={}){let r=e.flatMap(u=>u.languages??[]),n=[];for(let u of li(Object.assign({},...e.map(({options:i})=>i),cn)))!t&&u.deprecated||(Array.isArray(u.choices)&&(t||(u.choices=u.choices.filter(i=>!i.deprecated)),u.name==="parser"&&(u.choices=[...u.choices,...Di(u.choices,r,e)])),u.pluginDefaults=Object.fromEntries(e.filter(i=>{var o;return((o=i.defaultOptions)==null?void 0:o[u.name])!==void 0}).map(i=>[i.name,i.defaultOptions[u.name]])),n.push(u));return{languages:r,options:n}}function*Di(e,t,r){let n=new Set(e.map(u=>u.value));for(let u of t)if(u.parsers){for(let i of u.parsers)if(!n.has(i)){n.add(i);let o=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,i)),s=u.name;o!=null&&o.name&&(s+=` (plugin: ${o.name})`),yield{value:i,description:s}}}}function li(e){let t=[];for(let[r,n]of Object.entries(e)){let u={name:r,...n};Array.isArray(u.default)&&(u.default=y(!1,u.default,-1).value),t.push(u)}return t}var ci=e=>String(e).split(/[/\\]/u).pop();function fn(e,t){if(!t)return;let r=ci(t).toLowerCase();return e.find(({filenames:n})=>n==null?void 0:n.some(u=>u.toLowerCase()===r))??e.find(({extensions:n})=>n==null?void 0:n.some(u=>r.endsWith(u)))}function fi(e,t){if(t)return e.find(({name:r})=>r.toLowerCase()===t)??e.find(({aliases:r})=>r==null?void 0:r.includes(t))??e.find(({extensions:r})=>r==null?void 0:r.includes(`.${t}`))}function di(e,t){let r=e.plugins.flatMap(u=>u.languages??[]),n=fi(r,t.language)??fn(r,t.physicalFile)??fn(r,t.file)??(t.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var dn=di;var oe={key:e=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e)?e:JSON.stringify(e),value(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>oe.value(r)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(r=>`${oe.key(r)}: ${oe.value(e[r])}`).join(", ")} }`},pair:({key:e,value:t})=>oe.value({[e]:t})};var Mt=Me(st(),1),mn=(e,t,{descriptor:r})=>{let n=[`${Mt.default.yellow(typeof e=="string"?r.key(e):r.pair(e))} is deprecated`];return t&&n.push(`we now treat it as ${Mt.default.blue(typeof t=="string"?r.key(t):r.pair(t))}`),n.join("; ")+"."};var ce=Me(st(),1);var at=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ae=Symbol.for("vnopts.VALUE_UNCHANGED");var hn=" ".repeat(2),Cn=(e,t,r)=>{let{text:n,list:u}=r.normalizeExpectedResult(r.schemas[e].expected(r)),i=[];return n&&i.push(En(e,t,n,r.descriptor)),u&&i.push([En(e,t,u.title,r.descriptor)].concat(u.values.map(o=>gn(o,r.loggerPrintWidth))).join(`
`)),yn(i,r.loggerPrintWidth)};function En(e,t,r,n){return[`Invalid ${ce.default.red(n.key(e))} value.`,`Expected ${ce.default.blue(r)},`,`but received ${t===at?ce.default.gray("nothing"):ce.default.red(n.value(t))}.`].join(" ")}function gn({text:e,list:t},r){let n=[];return e&&n.push(`- ${ce.default.blue(e)}`),t&&n.push([`- ${ce.default.blue(t.title)}:`].concat(t.values.map(u=>gn(u,r-hn.length).replace(/^|\n/g,`$&${hn}`))).join(`
`)),yn(n,r)}function yn(e,t){if(e.length===1)return e[0];let[r,n]=e,[u,i]=e.map(o=>o.split(`
`,1)[0].length);return u>t&&u>i?n:r}var zt=Me(st(),1);var Ut=[],An=[];function Vt(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let n=e.length,u=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-u);)n--,u--;let i=0;for(;i<n&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(n-=i,u-=i,n===0)return u;let o,s,a,D,l=0,p=0;for(;l<n;)An[l]=e.charCodeAt(i+l),Ut[l]=++l;for(;p<u;)for(o=t.charCodeAt(i+p),a=p++,s=p,l=0;l<n;l++)D=o===An[l]?a:a+1,a=Ut[l],s=Ut[l]=a>s?D>s?s+1:D:D>a?a+1:D;return s}var Dt=(e,t,{descriptor:r,logger:n,schemas:u})=>{let i=[`Ignored unknown option ${zt.default.yellow(r.pair({key:e,value:t}))}.`],o=Object.keys(u).sort().find(s=>Vt(e,s)<3);o&&i.push(`Did you mean ${zt.default.blue(r.key(o))}?`),n.warn(i.join(" "))};var pi=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Fi(e,t){let r=new e(t),n=Object.create(r);for(let u of pi)u in t&&(n[u]=mi(t[u],r,x.prototype[u].length));return n}var x=class{static create(t){return Fi(this,t)}constructor(t){this.name=t.name}default(t){}expected(t){return"nothing"}validate(t,r){return!1}deprecated(t,r){return!1}forward(t,r){}redirect(t,r){}overlap(t,r,n){return t}preprocess(t,r){return t}postprocess(t,r){return Ae}};function mi(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var lt=class extends x{constructor(t){super(t),this._sourceName=t.sourceName}expected(t){return t.schemas[this._sourceName].expected(t)}validate(t,r){return r.schemas[this._sourceName].validate(t,r)}redirect(t,r){return this._sourceName}};var ct=class extends x{expected(){return"anything"}validate(){return!0}};var ft=class extends x{constructor({valueSchema:t,name:r=t.name,...n}){super({...n,name:r}),this._valueSchema=t}expected(t){let{text:r,list:n}=t.normalizeExpectedResult(this._valueSchema.expected(t));return{text:r&&`an array of ${r}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(t,r){if(!Array.isArray(t))return!1;let n=[];for(let u of t){let i=r.normalizeValidateResult(this._valueSchema.validate(u,r),u);i!==!0&&n.push(i.value)}return n.length===0?!0:{value:n}}deprecated(t,r){let n=[];for(let u of t){let i=r.normalizeDeprecatedResult(this._valueSchema.deprecated(u,r),u);i!==!1&&n.push(...i.map(({value:o})=>({value:[o]})))}return n}forward(t,r){let n=[];for(let u of t){let i=r.normalizeForwardResult(this._valueSchema.forward(u,r),u);n.push(...i.map(vn))}return n}redirect(t,r){let n=[],u=[];for(let i of t){let o=r.normalizeRedirectResult(this._valueSchema.redirect(i,r),i);"remain"in o&&n.push(o.remain),u.push(...o.redirect.map(vn))}return n.length===0?{redirect:u}:{redirect:u,remain:n}}overlap(t,r){return t.concat(r)}};function vn({from:e,to:t}){return{from:[e],to:t}}var dt=class extends x{expected(){return"true or false"}validate(t){return typeof t=="boolean"}};function wn(e,t){let r=Object.create(null);for(let n of e){let u=n[t];if(r[u])throw new Error(`Duplicate ${t} ${JSON.stringify(u)}`);r[u]=n}return r}function _n(e,t){let r=new Map;for(let n of e){let u=n[t];if(r.has(u))throw new Error(`Duplicate ${t} ${JSON.stringify(u)}`);r.set(u,n)}return r}function xn(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?!0:(e[r]=!0,!1)}}function bn(e,t){let r=[],n=[];for(let u of e)t(u)?r.push(u):n.push(u);return[r,n]}function Nn(e){return e===Math.floor(e)}function On(e,t){if(e===t)return 0;let r=typeof e,n=typeof t,u=["undefined","object","boolean","number","string"];return r!==n?u.indexOf(r)-u.indexOf(n):r!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Sn(e){return(...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function Gt(e){return e===void 0?{}:e}function Kt(e){if(typeof e=="string")return{text:e};let{text:t,list:r}=e;return hi((t||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:t,list:{title:r.title,values:r.values.map(Kt)}}:{text:t}}function Jt(e,t){return e===!0?!0:e===!1?{value:t}:e}function qt(e,t,r=!1){return e===!1?!1:e===!0?r?!0:[{value:t}]:"value"in e?[e]:e
`+n,e.codeFrame=n,e}throw e}var fe=xi;async function Mn(e,t,r,n,u){let{embeddedLanguageFormatting:i,printer:{embed:o,hasPrettierIgnore:s=()=>!1,getVisitorKeys:a}}=r;if(!o||i!=="auto")return;if(o.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed");let D=q(o.getVisitorKeys??a),l=[];d();let p=e.stack;for(let{print:c,node:F,pathStack:m}of l)try{e.stack=m;let h=await c(f,t,e,r);h&&u.set(F,h)}catch(h){if(globalThis.PRETTIER_DEBUG)throw h}e.stack=p;function f(c,F){return Ni(c,F,r,n)}function d(){let{node:c}=e;if(c===null||typeof c!="object"||s(e))return;for(let m of D(c))Array.isArray(c[m])?e.each(d,m):e.call(d,m);let F=o(e,r);if(F){if(typeof F=="function"){l.push({print:F,node:c,pathStack:[...e.stack]});return}u.set(c,F)}}}async function Ni(e,t,r,n){let u=await se({...r,...t,parentParser:r.parser,originalText:e},{passThrough:!0}),{ast:i}=await fe(e,u),o=await n(i,u);return et(o)}function Oi(e,t){let{originalText:r,[Symbol.for("comments")]:n,locStart:u,locEnd:i,[Symbol.for("printedComments")]:o}=t,{node:s}=e,a=u(s),D=i(s);for(let l of n)u(l)>=a&&i(l)<=D&&o.add(l);return r.slice(a,D)}var Un=Oi;async function He(e,t){({ast:e}=await nr(e,t));let r=new Map,n=new Jr(e),u=ln(t),i=new Map;await Mn(n,s,t,He,i);let o=await Vn(n,t,s,void 0,i);if(Dn(t),t.nodeAfterCursor&&!t.nodeBeforeCursor)return[Z,o];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return[o,Z];return o;function s(D,l){return D===void 0||D===n?a(l):Array.isArray(D)?n.call(()=>a(l),...D):n.call(()=>a(l),D)}function a(D){u(n);let l=n.node;if(l==null)return"";let p=l&&typeof l=="object"&&D===void 0;if(p&&r.has(l))return r.get(l);let f=Vn(n,t,s,D,i);return p&&r.set(l,f),f}}function Vn(e,t,r,n,u){var a;let{node:i}=e,{printer:o}=t,s;switch((a=o.hasPrettierIgnore)!=null&&a.call(o,e)?s=Un(e,t):u.has(i)?s=u.get(i):s=o.print(e,t,r,n),i){case t.cursorNode:s=me(s,D=>[Z,D,Z]);break;case t.nodeBeforeCursor:s=me(s,D=>[D,Z]);break;case t.nodeAfterCursor:s=me(s,D=>[Z,D]);break}return o.printComment&&(!o.willPrintOwnComments||!o.willPrintOwnComments(e,t))&&(s=an(e,s,t)),s}async function nr(e,t){let r=e.comments??[];t[Symbol.for("comments")]=r,t[Symbol.for("tokens")]=e.tokens??[],t[Symbol.for("printedComments")]=new Set,un(e,t);let{printer:{preprocess:n}}=t;return e=n?await n(e,t):e,{ast:e,comments:r}}function Si(e,t){let{cursorOffset:r,locStart:n,locEnd:u}=t,i=q(t.printer.getVisitorKeys),o=d=>n(d)<=r&&u(d)>=r,s=e,a=[e];for(let d of Qr(e,{getVisitorKeys:i,filter:o}))a.push(d),s=d;if(Zr(s,{getVisitorKeys:i}))return{cursorNode:s};let D,l,p=-1,f=Number.POSITIVE_INFINITY;for(;a.length>0&&(D===void 0||l===void 0);){s=a.pop();let d=D!==void 0,c=l!==void 0;for(let F of ge(s,{getVisitorKeys:i})){if(!d){let m=u(F);m<=r&&m>p&&(D=F,p=m)}if(!c){let m=n(F);m>=r&&m<f&&(l=F,f=m)}}}return{nodeBeforeCursor:D,nodeAfterCursor:l}}var zn=Si;function Ti(e,t){let{printer:{massageAstNode:r,getVisitorKeys:n}}=t;if(!r)return e;let u=q(n),i=r.ignoredProperties??new Set;return o(e);function o(s,a){if(!(s!==null&&typeof s=="object"))return s;if(Array.isArray(s))return s.map(f=>o(f,a)).filter(Boolean);let D={},l=new Set(u(s));for(let f in s)!Object.prototype.hasOwnProperty.call(s,f)||i.has(f)||(l.has(f)?D[f]=o(s[f],s):D[f]=s[f]);let p=r(s,D,a);if(p!==null)return p??D}}var Gn=Ti;var ki=(e,t,r)=>{if(!(e&&t==null)){if(t.findLastIndex)return t.findLastIndex(r);for(let n=t.length-1;n>=0;n--){let u=t[n];if(r(u,n,t))return n}return-1}},Kn=ki;var Li=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";function Pi(e,t){let r=[e.node,...e.parentNodes],n=new Set([t.node,...t.parentNodes]);return r.find(u=>Xn.has(u.type)&&n.has(u))}function Jn(e){let t=Kn(!1,e,r=>r.type!=="Program"&&r.type!=="File");return t===-1?e:e.slice(0,t+1)}function Ii(e,t,{locStart:r,locEnd:n}){let u=e.node,i=t.node;if(u===i)return{startNode:u,endNode:i};let o=r(e.node);for(let a of Jn(t.parentNodes))if(r(a)>=o)i=a;else break;let s=n(t.node);for(let a of Jn(e.parentNodes)){if(n(a)<=s)u=a;else break;if(u===i)brea
`,u)+1),a=n.slice(s,u).match(/^\s*/u)[0],D=Ce(a,t.tabWidth),l=await nu(o,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>u&&t.cursorOffset<=i?t.cursorOffset-u:-1,endOfLine:"lf"},D),p=l.formatted.trimEnd(),{cursorOffset:f}=t;f>i?f+=p.length-o.length:l.cursorOffset>=0&&(f=l.cursorOffset+u);let d=n.slice(0,u)+p+n.slice(i);if(t.endOfLine!=="lf"){let c=xe(t.endOfLine);f>=0&&c===`\r
`&&(f+=Ot(d.slice(0,f),`
`)),d=ne(!1,d,`
`,c)}return{formatted:d,cursorOffset:f,comments:l.comments}}function ir(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function eu(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:u}=t;return r=ir(e,r,-1),n=ir(e,n,0),u=ir(e,u,e.length),{...t,cursorOffset:r,rangeStart:n,rangeEnd:u}}function uu(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:i}=eu(e,t),o=e.charAt(0)===ru;if(o&&(e=e.slice(1),r--,n--,u--),i==="auto"&&(i=gr(e)),e.includes("\r")){let s=a=>Ot(e.slice(0,Math.max(a,0)),`\r
`);r-=s(r),n-=s(n),u-=s(u),e=yr(e)}return{hasBOM:o,text:e,options:eu(e,{...t,cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:i})}}async function tu(e,t){let r=await Ct(t);return!r.hasPragma||r.hasPragma(e)}async function or(e,t){let{hasBOM:r,text:n,options:u}=uu(e,await se(t));if(u.rangeStart>=u.rangeEnd&&n!==""||u.requirePragma&&!await tu(n,u))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let i;return u.rangeStart>0||u.rangeEnd<n.length?i=await ji(n,u):(!u.requirePragma&&u.insertPragma&&u.printer.insertPragma&&!await tu(n,u)&&(n=u.printer.insertPragma(n)),i=await nu(n,u)),r&&(i.formatted=ru+i.formatted,i.cursorOffset>=0&&i.cursorOffset++),i}async function iu(e,t,r){let{text:n,options:u}=uu(e,await se(t)),i=await fe(n,u);return r&&(r.preprocessForPrint&&(i.ast=await nr(i.ast,u)),r.massage&&(i.ast=Gn(i.ast,u))),i}async function ou(e,t){t=await se(t);let r=await He(e,t);return Ee(r,t)}async function su(e,t){let r=Pr(e),{formatted:n}=await or(r,{...t,parser:"__js_expression"});return n}async function au(e,t){t=await se(t);let{ast:r}=await fe(e,t);return He(r,t)}async function Du(e,t){return Ee(e,await se(t))}var sr={};Bt(sr,{builders:()=>Wi,printer:()=>$i,utils:()=>Mi});var Wi={join:Se,line:qe,softline:kr,hardline:K,literalline:Xe,group:Tt,conditionalGroup:xr,fill:br,lineSuffix:Ne,lineSuffixBoundary:Sr,cursor:Z,breakParent:Fe,ifBreak:Nr,trim:Tr,indent:le,indentIfBreak:Or,align:De,addAlignmentToDoc:Qe,markAsRoot:wr,dedentToRoot:Br,dedent:_r,hardlineWithoutBreakParent:Oe,literallineWithoutBreakParent:kt,label:Lr,concat:e=>e},$i={printDocToString:Ee},Mi={willBreak:$r,traverseDoc:be,findInDoc:Ze,mapDoc:Le,removeLines:Ur,stripTrailingHardline:et,replaceEndOfLine:Vr,canBreak:zr};var lu="3.4.1";var Dr={};Bt(Dr,{addDanglingComment:()=>re,addLeadingComment:()=>ue,addTrailingComment:()=>ie,getAlignmentSize:()=>Ce,getIndentSize:()=>cu,getMaxContinuousCount:()=>fu,getNextNonSpaceNonCommentCharacter:()=>du,getNextNonSpaceNonCommentCharacterIndex:()=>ro,getPreferredQuote:()=>Fu,getStringWidth:()=>Te,hasNewline:()=>$,hasNewlineInRange:()=>mu,hasSpaces:()=>hu,isNextLineEmpty:()=>oo,isNextLineEmptyAfterIndex:()=>gt,isPreviousLineEmpty:()=>uo,makeString:()=>Eu,skip:()=>ye,skipEverythingButNewLine:()=>ut,skipInlineComment:()=>ve,skipNewline:()=>W,skipSpaces:()=>S,skipToLineEnd:()=>nt,skipTrailingComment:()=>Be,skipWhitespace:()=>en});function Ui(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let r=t+2;r<e.length;++r)if(e.charAt(r)==="*"&&e.charAt(r+1)==="/")return r+2}return t}var ve=Ui;function Vi(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?ut(e,t):t}var Be=Vi;function zi(e,t){let r=null,n=t;for(;n!==r;)r=n,n=S(e,n),n=ve(e,n),n=Be(e,n),n=W(e,n);return n}var We=zi;function Gi(e,t){let r=null,n=t;for(;n!==r;)r=n,n=nt(e,n),n=ve(e,n),n=S(e,n);return n=Be(e,n),n=W(e,n),n!==!1&&$(e,n)}var gt=Gi;function Ki(e,t){let r=e.lastIndexOf(`
`);return r===-1?0:Ce(e.slice(r+1).match(/^[\t ]*/u)[0],t)}var cu=Ki;function ar(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ji(e,t){let r=e.match(new RegExp(`(${ar(t)})+`,"gu"));return r===null?0:r.reduce((n,u)=>Math.max(n,u.length/t.length),0)}var fu=Ji;function qi(e,t){let r=We(e,t);return r===!1?"":e.charAt(r)}var du=qi;var yt="'",pu='"';function Xi(e,t){let r=t===!0||t===yt?yt:pu,n=r===yt?pu:yt,u=0,i=0;for(let o of e)o===r?u++:o===n&&i++;return u>i?n:r}var Fu=Xi;function Qi(e,t,r){for(let n=t;n<r;++n)if(e.charAt(n)===`
`)return!0;return!1}var mu=Qi;function Zi(e,t,r={}){return S(e,r.backwards?t-1:t,r)!==t}var hu=Zi;function eo(e,t,r){let n=t==='"'?"'":'"',i=ne(!1,e,/\\(.)|(["'])/gsu,(o,s,a)=>s===n?s:a===t?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+i+t}var Eu=eo;function to(e,t,r){return We(e,r(t))}function ro(e,t){return arguments.length===2||typeof t=="number"?We(e,t):to(...arguments)}function no(e,t,r){return Ie(e,r(t))}function uo(e,t){return arguments.length===2||typeof t=="number"?Ie(e,t):no(...arguments)}function io(e,t,r){return gt(e,r(t))}function oo(e,t){return arguments.length===2||typeof t=="number"?gt(e,t):io(...arguments)}function de(e,t=1){return async(...r)=>{let n=r[t]??{},u=n.plugins??[];return r[t]={...n,plugins:Array.isArray(u)?u:Object.values(u)},e(...r)}}var Cu=de(or);async function gu(e,t){let{formatted:r}=await Cu(e,{...t,cursorOffset:-1});return r}async function so(e,t){return await gu(e,t)===e}var ao=de(ot,0),Do={parse:de(iu),formatAST:de(ou),formatDoc:de(su),printToDoc:de(au),printDocToString:de(Du)};var lc=lr;export{Do as __debug,so as check,lc as default,sr as doc,gu as format,Cu as formatWithCursor,ao as getSupportInfo,Dr as util,lu as version};