and --range-end.`,cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing (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:t=>typeof t=="string"||typeof t=="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:"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:t=>typeof t=="string"||typeof t=="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. This option cannot be used with --cursor-offset.`,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. This option cannot be used with --cursor-offset.`,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 et({plugins:t=[],showDeprecated:e=!1}={}){let r=t.flatMap(o=>o.languages??[]),n=[];for(let o of Yu(Object.assign({},...t.map(({options:u})=>u),vr)))!e&&o.deprecated||(Array.isArray(o.choices)&&(e||(o.choices=o.choices.filter(u=>!u.deprecated)),o.name==="parser"&&(o.choices=[...o.choices,...Ru(o.choices,r,t)])),o.pluginDefaults=Object.fromEntries(t.filter(u=>{var i;return((i=u.defaultOptions)==null?void 0:i[o.name])!==void 0}).map(u=>[u.name,u.defaultOptions[o.name]])),n.push(o));return{languages:r,options:n}}function*Ru(t,e,r){let n=new Set(t.map(o=>o.value));for(let o of e)if(o.parsers){for(let u of o.parsers)if(!n.has(u)){n.add(u);let i=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,u)),s=o.name;i!=null&&i.name&&(s+=` (plugin: ${i.name})`),yield{value:u,description:s}}}}function Yu(t){let e=[];for(let[r,n]of Object.entries(t)){let o={name:r,...n};Array.isArray(o.default)&&(o.default=y(!1,o.default,-1).value),e.push(o)}return e}var ju=t=>t.split(/[/\\]/).pop();function Pr(t,e){if(!e)return;let r=ju(e).toLowerCase();return t.find(n=>{var o,u;return((o=n.extensions)==null?void 0:o.some(i=>r.endsWith(i)))||((u=n.filenames)==null?void 0:u.some(i=>i.toLowerCase()===r))})}function Vu(t,e){if(e)return t.find(({name:r})=>r.toLowerCase()===e)??t.find(({aliases:r})=>r==null?void 0:r.includes(e))??t.find(({extensions:r})=>r==null?void 0:r.includes(`.${e}`))}function $u(t,e){let r=t.plugins.flatMap(o=>o.languages??[]),n=Vu(r,e.language)??Pr(r,e.physicalFile)??Pr(r,e.file)??(e.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var Lr=$u;var te={key:t=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?t:JSON.stringify(t),value(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(r=>te.value(r)).join(", ")}]`;let e=Object.keys(t);return e.length===0?"{}":`{ ${e.map(r=>`${te.key(r)}: ${te.value(t[r])}`).join(", ")} }`},pair:({key:t,value:e})=>te.value({[t]:e})};var bt=Ce(Pe(),1),Yr=(t,e,{descriptor:r})=>{let n=[`${bt.default.yellow(typeof t=="string"?r.key(t):r.pair(t))} is deprecated`];return e&&n.push(`we now treat it as ${bt.default.blue(typeof e=="string"?r.key(e):r.pair(e))}`),n.join("; ")+"."};var se=Ce(Pe(),1);var tt=Symbol.for("vnopts.VALUE_NOT_EXIST"),de=Symbol.for("vnopts.VALUE_UNCHANGED");var jr=" ".repeat(2),$r=(t,e,r)=>{let{text:n,list:o}=r.normalizeExpectedResult(r.schemas[t].expected(r)),u=[];return n&&u.push(Vr(t,e,n,r.descriptor)),o&&u.push([Vr(t,e,o.title,r.descriptor)].concat(o.values.map(i=>Ur(i,r.loggerPrintWidth))).join(` `)),Mr(u,r.loggerPrintWidth)};function Vr(t,e,r,n){return[`Invalid ${se.default.red(n.key(t))} value.`,`Expected ${se.default.blue(r)},`,`but received ${e===tt?se.default.gray("nothing"):se.default.red(n.value(e))}.`].join(" ")}function Ur({text:t,list:e},r){let n=[];return t&&n.push(`- ${se.default.blue(t)}`),e&&n.push([`- ${se.default.blue(e.title)}:`].concat(e.values.map(o=>Ur(o,r-jr.length).replace(/^|\n/g,`$&${jr}`))).join(` `)),Mr(n,r)}function Mr(t,e){if(t.length===1)return t[0];let[r,n]=t,[o,u]=t.map(i=>i.split(` `,1)[0].length);return o>e&&o>u?n:r}var Nt=Ce(Pe(),1);var wt=[],Wr=[];function Ot(t,e){if(t===e)return 0;let r=t;t.length>e.length&&(t=e,e=r);let n=t.length,o=e.length;for(;n>0&&t.charCodeAt(~-n)===e.charCodeAt(~-o);)n--,o--;let u=0;for(;us?D>s?s+1:D:D>a?a+1:D;return s}var rt=(t,e,{descriptor:r,logger:n,schemas:o})=>{let u=[`Ignored unknown option ${Nt.default.yellow(r.pair({key:t,value:e}))}.`],i=Object.keys(o).sort().find(s=>Ot(t,s)<3);i&&u.push(`Did you mean ${Nt.default.blue(r.key(i))}?`),n.warn(u.join(" "))};var Uu=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Mu(t,e){let r=new t(e),n=Object.create(r);for(let o of Uu)o in e&&(n[o]=Wu(e[o],r,w.prototype[o].length));return n}var w=class{static create(e){return Mu(this,e)}constructor(e){this.name=e.name}default(e){}expected(e){return"nothing"}validate(e,r){return!1}deprecated(e,r){return!1}forward(e,r){}redirect(e,r){}overlap(e,r,n){return e}preprocess(e,r){return e}postprocess(e,r){return de}};function Wu(t,e,r){return typeof t=="function"?(...n)=>t(...n.slice(0,r-1),e,...n.slice(r-1)):()=>t}var nt=class extends w{constructor(e){super(e),this._sourceName=e.sourceName}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,r){return r.schemas[this._sourceName].validate(e,r)}redirect(e,r){return this._sourceName}};var ut=class extends w{expected(){return"anything"}validate(){return!0}};var ot=class extends w{constructor({valueSchema:e,name:r=e.name,...n}){super({...n,name:r}),this._valueSchema=e}expected(e){let{text:r,list:n}=e.normalizeExpectedResult(this._valueSchema.expected(e));return{text:r&&`an array of ${r}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(e,r){if(!Array.isArray(e))return!1;let n=[];for(let o of e){let u=r.normalizeValidateResult(this._valueSchema.validate(o,r),o);u!==!0&&n.push(u.value)}return n.length===0?!0:{value:n}}deprecated(e,r){let n=[];for(let o of e){let u=r.normalizeDeprecatedResult(this._valueSchema.deprecated(o,r),o);u!==!1&&n.push(...u.map(({value:i})=>({value:[i]})))}return n}forward(e,r){let n=[];for(let o of e){let u=r.normalizeForwardResult(this._valueSchema.forward(o,r),o);n.push(...u.map(zr))}return n}redirect(e,r){let n=[],o=[];for(let u of e){let i=r.normalizeRedirectResult(this._valueSchema.redirect(u,r),u);"remain"in i&&n.push(i.remain),o.push(...i.redirect.map(zr))}return n.length===0?{redirect:o}:{redirect:o,remain:n}}overlap(e,r){return e.concat(r)}};function zr({from:t,to:e}){return{from:[t],to:e}}var it=class extends w{expected(){return"true or false"}validate(e){return typeof e=="boolean"}};function Kr(t,e){let r=Object.create(null);for(let n of t){let o=n[e];if(r[o])throw new Error(`Duplicate ${e} ${JSON.stringify(o)}`);r[o]=n}return r}function Hr(t,e){let r=new Map;for(let n of t){let o=n[e];if(r.has(o))throw new Error(`Duplicate ${e} ${JSON.stringify(o)}`);r.set(o,n)}return r}function qr(){let t=Object.create(null);return e=>{let r=JSON.stringify(e);return t[r]?!0:(t[r]=!0,!1)}}function Jr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}function Xr(t){return t===Math.floor(t)}function Zr(t,e){if(t===e)return 0;let r=typeof t,n=typeof e,o=["undefined","object","boolean","number","string"];return r!==n?o.indexOf(r)-o.indexOf(n):r!=="string"?Number(t)-Number(e):t.localeCompare(e)}function Qr(t){return(...e)=>{let r=t(...e);return typeof r=="string"?new Error(r):r}}function Tt(t){return t===void 0?{}:t}function St(t){if(typeof t=="string")return{text:t};let{text:e,list:r}=t;return zu((e||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:e,list:{title:r.title,values:r.values.map(St)}}:{text:e}}function vt(t,e){return t===!0?!0:t===!1?{value:e}:t}function Pt(t,e,r=!1){return t===!1?!1:t===!0?r?!0:[{value:e}]:"value"in t?[t]:t.length===0?!1:t}function Gr(t,e){return typeof t=="string"||"key"in t?{from:e,to:t}:"from"in t?{from:t.from,to:t.to}:{from:e,to:t.to}}function st(t,e){return t===void 0?[]:Array.isArray(t)?t.map(r=>Gr(r,e)):[Gr(t,e)]}function Lt(t,e){let r=st(typeof t=="object"&&"redirect"in t?t.redirect:t,e);return r.length===0?{remain:e,redirect:r}:typeof t=="object"&&"remain"in t?{remain:t.remain,redirect:r}:{redirect:r}}function zu(t,e){if(!t)throw new Error(e)}var at=class extends w{constructor(e){super(e),this._choices=Hr(e.choices.map(r=>r&&typeof r=="object"?r:{value:r}),"value")}expected({descriptor:e}){let r=Array.from(this._choices.keys()).map(i=>this._choices.get(i)).filter(({hidden:i})=>!i).map(i=>i.value).sort(Zr).map(e.value),n=r.slice(0,-2),o=r.slice(-2);return{text:n.concat(o.join(" or ")).join(", "),list:{title:"one of the following values",values:r}}}validate(e){return this._choices.has(e)}deprecated(e){let r=this._choices.get(e);return r&&r.deprecated?{value:e}:!1}forward(e){let r=this._choices.get(e);return r?r.forward:void 0}redirect(e){let r=this._choices.get(e);return r?r.redirect:void 0}};var Dt=class extends w{expected(){return"a number"}validate(e,r){return typeof e=="number"}};var ct=class extends Dt{expected(){return"an integer"}validate(e,r){return r.normalizeValidateResult(super.validate(e,r),e)===!0&&Xr(e)}};var Le=class extends w{expected(){return"a string"}validate(e){return typeof e=="string"}};var en=te,tn=rt,rn=$r,nn=Yr;var lt=class{constructor(e,r){let{logger:n=console,loggerPrintWidth:o=80,descriptor:u=en,unknown:i=tn,invalid:s=rn,deprecated:a=nn,missing:D=()=>!1,required:c=()=>!1,preprocess:F=d=>d,postprocess:f=()=>de}=r||{};this._utils={descriptor:u,logger:n||{warn:()=>{}},loggerPrintWidth:o,schemas:Kr(e,"name"),normalizeDefaultResult:Tt,normalizeExpectedResult:St,normalizeDeprecatedResult:Pt,normalizeForwardResult:st,normalizeRedirectResult:Lt,normalizeValidateResult:vt},this._unknownHandler=i,this._invalidHandler=Qr(s),this._deprecatedHandler=a,this._identifyMissing=(d,l)=>!(d in l)||D(d,l),this._identifyRequired=c,this._preprocess=F,this._postprocess=f,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=qr()}normalize(e){let r={},o=[this._preprocess(e,this._utils)],u=()=>{for(;o.length!==0;){let i=o.shift(),s=this._applyNormalization(i,r);o.push(...s)}};u();for(let i of Object.keys(this._utils.schemas)){let s=this._utils.schemas[i];if(!(i in r)){let a=Tt(s.default(this._utils));"value"in a&&o.push({[i]:a.value})}}u();for(let i of Object.keys(this._utils.schemas)){if(!(i in r))continue;let s=this._utils.schemas[i],a=r[i],D=s.postprocess(a,this._utils);D!==de&&(this._applyValidation(D,i,s),r[i]=D)}return this._applyPostprocess(r),this._applyRequiredCheck(r),r}_applyNormalization(e,r){let n=[],{knownKeys:o,unknownKeys:u}=this._partitionOptionKeys(e);for(let i of o){let s=this._utils.schemas[i],a=s.preprocess(e[i],this._utils);this._applyValidation(a,i,s);let D=({from:d,to:l})=>{n.push(typeof l=="string"?{[l]:d}:{[l.key]:l.value})},c=({value:d,redirectTo:l})=>{let p=Pt(s.deprecated(d,this._utils),a,!0);if(p!==!1)if(p===!0)this._hasDeprecationWarned(i)||this._utils.logger.warn(this._deprecatedHandler(i,l,this._utils));else for(let{value:m}of p){let E={key:i,value:m};if(!this._hasDeprecationWarned(E)){let h=typeof l=="string"?{key:l,value:m}:l;this._utils.logger.warn(this._deprecatedHandler(E,h,this._utils))}}};st(s.forward(a,this._utils),a).forEach(D);let f=Lt(s.redirect(a,this._utils),a);if(f.redirect.forEach(D),"remain"in f){let d=f.remain;r[i]=i in r?s.overlap(r[i],d,this._utils):d,c({value:d})}for(let{from:d,to:l}of f.redirect)c({value:d,redirectTo:l})}for(let i of u){let s=e[i];this._applyUnknownHandler(i,s,r,(a,D)=>{n.push({[a]:D})})}return n}_applyRequiredCheck(e){for(let r of Object.keys(this._utils.schemas))if(this._identifyMissing(r,e)&&this._identifyRequired(r))throw this._invalidHandler(r,tt,this._utils)}_partitionOptionKeys(e){let[r,n]=Jr(Object.keys(e).filter(o=>!this._identifyMissing(o,e)),o=>o in this._utils.schemas);return{knownKeys:r,unknownKeys:n}}_applyValidation(e,r,n){let o=vt(n.validate(e,this._utils),e);if(o!==!0)throw this._invalidHandler(r,o.value,this._utils)}_applyUnknownHandler(e,r,n,o){let u=this._unknownHandler(e,r,this._utils);if(u)for(let i of Object.keys(u)){if(this._identifyMissing(i,u))continue;let s=u[i];i in this._utils.schemas?o(i,s):n[i]=s}}_applyPostprocess(e){let r=this._postprocess(e,this._utils);if(r!==de){if(r.delete)for(let n of r.delete)delete e[n];if(r.override){let{knownKeys:n,unknownKeys:o}=this._partitionOptionKeys(r.override);for(let u of n){let i=r.override[u];this._applyValidation(i,u,this._utils.schemas[u]),e[u]=i}for(let u of o){let i=r.override[u];this._applyUnknownHandler(u,i,e,(s,a)=>{let D=this._utils.schemas[s];this._applyValidation(a,s,D),e[s]=a})}}}}};var It;function Ku(t,e,{logger:r=!1,isCLI:n=!1,passThrough:o=!1,FlagSchema:u,descriptor:i}={}){if(n){if(!u)throw new Error("'FlagSchema' option is required.");if(!i)throw new Error("'descriptor' option is required.")}else i=te;let s=o?Array.isArray(o)?(f,d)=>o.includes(f)?{[f]:d}:void 0:(f,d)=>({[f]:d}):(f,d,l)=>{let{_:p,...m}=l.schemas;return rt(f,d,{...l,schemas:m})},a=Hu(e,{isCLI:n,FlagSchema:u}),D=new lt(a,{logger:r,unknown:s,descriptor:i}),c=r!==!1;c&&It&&(D._hasDeprecationWarned=It);let F=D.normalize(t);return c&&(It=D._hasDeprecationWarned),F}function Hu(t,{isCLI:e,FlagSchema:r}){let n=[];e&&n.push(ut.create({name:"_"}));for(let o of t)n.push(qu(o,{isCLI:e,optionInfos:t,FlagSchema:r})),o.alias&&e&&n.push(nt.create({name:o.alias,sourceName:o.name}));return n}function qu(t,{isCLI:e,optionInfos:r,FlagSchema:n}){let{name:o}=t,u={name:o},i,s={};switch(t.type){case"int":i=ct,e&&(u.preprocess=Number);break;case"string":i=Le;break;case"choice":i=at,u.choices=t.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:t.name,value:a.redirect}}}:a);break;case"boolean":i=it;break;case"flag":i=n,u.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case"path":i=Le;break;default:throw new Error(`Unexpected type ${t.type}`)}if(t.exception?u.validate=(a,D,c)=>t.exception(a)||D.validate(a,c):u.validate=(a,D,c)=>a===void 0||D.validate(a,c),t.redirect&&(s.redirect=a=>a?{to:{key:t.redirect.option,value:t.redirect.value}}:void 0),t.deprecated&&(s.deprecated=!0),e&&!t.array){let a=u.preprocess||(D=>D);u.preprocess=(D,c,F)=>c.preprocess(a(Array.isArray(D)?y(!1,D,-1):D),F)}return t.array?ot.create({...e?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...s,valueSchema:i.create(u)}):i.create({...u,...s})}var un=Ku;function Rt(t,e){if(!e)throw new Error("parserName is required.");for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.parsers&&Object.prototype.hasOwnProperty.call(o.parsers,e))return o}let r=`Couldn't resolve parser "${e}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Se(r)}function on(t,e){if(!e)throw new Error("astFormat is required.");for(let n=t.length-1;n>=0;n--){let o=t[n];if(o.printers&&Object.prototype.hasOwnProperty.call(o.printers,e))return o}let r=`Couldn't find plugin for AST format "${e}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Se(r)}function ft({plugins:t,parser:e}){let r=Rt(t,e);return Yt(r,e)}function Yt(t,e){let r=t.parsers[e];return typeof r=="function"?r():r}function sn(t,e){let r=t.printers[e];return typeof r=="function"?r():r}var an={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function Ju(t,e={}){var F;let r={...t};if(!r.parser)if(r.filepath){if(r.parser=Lr(r,{physicalFile:r.filepath}),!r.parser)throw new ve(`No parser could be inferred for file "${r.filepath}".`)}else throw new ve("No parser and no file path given, couldn't infer a parser.");let n=et({plugins:t.plugins,showDeprecated:!0}).options,o={...an,...Object.fromEntries(n.filter(f=>f.default!==void 0).map(f=>[f.name,f.default]))},u=Rt(r.plugins,r.parser),i=await Yt(u,r.parser);r.astFormat=i.astFormat,r.locEnd=i.locEnd,r.locStart=i.locStart;let s=(F=u.printers)!=null&&F[i.astFormat]?u:on(r.plugins,i.astFormat),a=await sn(s,i.astFormat);r.printer=a;let D=s.defaultOptions?Object.fromEntries(Object.entries(s.defaultOptions).filter(([,f])=>f!==void 0)):{},c={...o,...D};for(let[f,d]of Object.entries(c))(r[f]===null||r[f]===void 0)&&(r[f]=d);return r.parser==="json"&&(r.trailingComma="none"),un(r,n,{passThrough:Object.keys(an),...e})}var re=Ju;var Dn=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Xu=t=>Object.keys(t).filter(e=>!Dn.has(e));function Zu(t){return t?e=>t(e,Dn):Xu}var H=Zu;function Qu(t,e){let{printer:{massageAstNode:r,getVisitorKeys:n}}=e;if(!r)return t;let o=H(n),u=r.ignoredProperties??new Set;return i(t);function i(s,a){if(!(s!==null&&typeof s=="object"))return s;if(Array.isArray(s))return s.map(f=>i(f,a)).filter(Boolean);let D={},c=new Set(o(s));for(let f in s)!Object.prototype.hasOwnProperty.call(s,f)||u.has(f)||(c.has(f)?D[f]=i(s[f],s):D[f]=s[f]);let F=r(s,D,a);if(F!==null)return F??D}}var cn=Qu;var Cn=Ce(hn(),1);async function so(t,e){let r=await ft(e),n=r.preprocess?r.preprocess(t,e):t;e.originalText=n;let o;try{o=await r.parse(n,e,e)}catch(u){ao(u,t)}return{text:n,ast:o}}function ao(t,e){let{loc:r}=t;if(r){let n=(0,Cn.codeFrameColumns)(e,r,{highlightCode:!0});throw t.message+=` `+n,t.codeFrame=n,t}throw t}var ae=so;var Ie,$t,Fe,dt,Vt=class{constructor(e){Ct(this,Ie);Ct(this,Fe);this.stack=[e]}get key(){let{stack:e,siblings:r}=this;return y(!1,e,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:e}=this,r=y(!1,e,-3);return Array.isArray(r)?r:null}get next(){let{siblings:e}=this;return e===null?null:e[this.index+1]}get previous(){let{siblings:e}=this;return e===null?null:e[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:e,index:r}=this;return e!==null&&r===e.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...ce(this,Fe,dt).call(this)]}getName(){let{stack:e}=this,{length:r}=e;return r>1?y(!1,e,-2):null}getValue(){return y(!1,this.stack,-1)}getNode(e=0){let r=ce(this,Ie,$t).call(this,e);return r===-1?null:this.stack[r]}getParentNode(e=0){return this.getNode(e+1)}call(e,...r){let{stack:n}=this,{length:o}=n,u=y(!1,n,-1);for(let i of r)u=u[i],n.push(i,u);try{return e(this)}finally{n.length=o}}callParent(e,r=0){let n=ce(this,Ie,$t).call(this,r+1),o=this.stack.splice(n+1);try{return e(this)}finally{this.stack.push(...o)}}each(e,...r){let{stack:n}=this,{length:o}=n,u=y(!1,n,-1);for(let i of r)u=u[i],n.push(i,u);try{for(let i=0;i{n[u]=e(o,u,i)},...r),n}match(...e){let r=this.stack.length-1,n=null,o=this.stack[r--];for(let u of e){if(o===void 0)return!1;let i=null;if(typeof n=="number"&&(i=n,n=this.stack[r--],o=this.stack[r--]),u&&!u(o,n,i))return!1;n=this.stack[r--],o=this.stack[r--]}return!0}findAncestor(e){for(let r of ce(this,Fe,dt).call(this))if(e(r))return r}hasAncestor(e){for(let r of ce(this,Fe,dt).call(this))if(e(r))return!0;return!1}};Ie=new WeakSet,$t=function(e){let{stack:r}=this;for(let n=r.length-1;n>=0;n-=2)if(!Array.isArray(r[n])&&--e<0)return n;return-1},Fe=new WeakSet,dt=function*(){let{stack:e}=this;for(let r=e.length-3;r>=0;r-=2){let n=e[r];Array.isArray(n)||(yield n)}};var gn=Vt;var yn=new Proxy(()=>{},{get:()=>yn}),Re=yn;function me(t){return(e,r,n)=>{let o=!!(n!=null&&n.backwards);if(r===!1)return!1;let{length:u}=e,i=r;for(;i>=0&&i0}var Ut=lo;function fo(t){return t!==null&&typeof t=="object"}var _n=fo;function*Mt(t,e){let{getVisitorKeys:r,filter:n=()=>!0}=e,o=u=>_n(u)&&n(u);for(let u of r(t)){let i=t[u];if(Array.isArray(i))for(let s of i)o(s)&&(yield s);else o(i)&&(yield i)}}function*An(t,e){let r=[t];for(let n=0;n20&&(r=r.slice(0,19)+"\u2026"),e+(r?" "+r:"")}function Wt(t,e){(t.comments??(t.comments=[])).push(e),e.printed=!1,e.nodeDescription=po(t)}function ne(t,e){e.leading=!0,e.trailing=!1,Wt(t,e)}function X(t,e,r){e.leading=!1,e.trailing=!1,r&&(e.marker=r),Wt(t,e)}function ue(t,e){e.leading=!1,e.trailing=!0,Wt(t,e)}var zt=new WeakMap;function Et(t,e){if(zt.has(t))return zt.get(t);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:o},locStart:u,locEnd:i}=e;if(!n)return[];let s=((r==null?void 0:r(t,e))??[...Mt(t,{getVisitorKeys:H(o)})]).flatMap(a=>n(a)?[a]:Et(a,e));return s.sort((a,D)=>u(a)-u(D)||i(a)-i(D)),zt.set(t,s),s}function kn(t,e,r,n){let{locStart:o,locEnd:u}=r,i=o(e),s=u(e),a=Et(t,r),D,c,F=0,f=a.length;for(;F>1,l=a[d],p=o(l),m=u(l);if(p<=i&&s<=m)return kn(l,e,r,l);if(m<=i){D=l,F=d+1;continue}if(s<=p){c=l,f=d;continue}throw new Error("Comment location overlaps with node location")}if((n==null?void 0:n.type)==="TemplateLiteral"){let{quasis:d}=n,l=Kt(d,e,r);D&&Kt(d,D,r)!==l&&(D=null),c&&Kt(d,c,r)!==l&&(c=null)}return{enclosingNode:n,precedingNode:D,followingNode:c}}var Gt=()=>!1;function bn(t,e){let{comments:r}=t;if(delete t.comments,!Ut(r)||!e.printer.canAttachComment)return;let n=[],{locStart:o,locEnd:u,printer:{experimentalFeatures:{avoidAstMutation:i=!1}={},handleComments:s={}},originalText:a}=e,{ownLine:D=Gt,endOfLine:c=Gt,remaining:F=Gt}=s,f=r.map((d,l)=>({...kn(t,d,e),comment:d,text:a,options:e,ast:t,isLastComment:r.length-1===l}));for(let[d,l]of f.entries()){let{comment:p,precedingNode:m,enclosingNode:E,followingNode:h,text:g,options:C,ast:_,isLastComment:Z}=l;if(C.parser==="json"||C.parser==="json5"||C.parser==="__js_expression"||C.parser==="__ts_expression"||C.parser==="__vue_expression"||C.parser==="__vue_ts_expression"){if(o(p)-o(_)<=0){ne(_,p);continue}if(u(p)-u(_)>=0){ue(_,p);continue}}let $;if(i?$=[l]:(p.enclosingNode=E,p.precedingNode=m,p.followingNode=h,$=[p,g,C,_,Z]),Fo(g,C,f,d))p.placement="ownLine",D(...$)||(h?ne(h,p):m?ue(m,p):E?X(E,p):X(_,p));else if(mo(g,C,f,d))p.placement="endOfLine",c(...$)||(m?ue(m,p):h?ne(h,p):E?X(E,p):X(_,p));else if(p.placement="remaining",!F(...$))if(m&&h){let Q=n.length;Q>0&&n[Q-1].followingNode!==h&&Bn(n,C),n.push(l)}else m?ue(m,p):h?ne(h,p):E?X(E,p):X(_,p)}if(Bn(n,e),!i)for(let d of r)delete d.precedingNode,delete d.enclosingNode,delete d.followingNode}var wn=t=>!/[\S\n\u2028\u2029]/.test(t);function Fo(t,e,r,n){let{comment:o,precedingNode:u}=r[n],{locStart:i,locEnd:s}=e,a=i(o);if(u)for(let D=n-1;D>=0;D--){let{comment:c,precedingNode:F}=r[D];if(F!==u||!wn(t.slice(s(c),a)))break;a=i(c)}return V(t,a,{backwards:!0})}function mo(t,e,r,n){let{comment:o,followingNode:u}=r[n],{locStart:i,locEnd:s}=e,a=s(o);if(u)for(let D=n+1;D0;--i){let{comment:D,precedingNode:c,followingNode:F}=t[i-1];Re.strictEqual(c,n),Re.strictEqual(F,o);let f=e.originalText.slice(e.locEnd(D),u);if(((a=(s=e.printer).isGap)==null?void 0:a.call(s,f,e))??/^[\s(]*$/.test(f))u=e.locStart(D);else break}for(let[D,{comment:c}]of t.entries())D1&&D.comments.sort((c,F)=>e.locStart(c)-e.locStart(F));t.length=0}function Kt(t,e,r){let n=r.locStart(e)-1;for(let o=1;o!n.has(a)).length===0)return{leading:"",trailing:""};let u=[],i=[],s;return t.each(()=>{let a=t.node;if(n!=null&&n.has(a))return;let{leading:D,trailing:c}=a;D?u.push(ho(t,e)):c&&(s=Co(t,e,s),i.push(s.doc))},"comments"),{leading:u,trailing:i}}function Nn(t,e,r){let{leading:n,trailing:o}=go(t,r);return!n&&!o?e:Ze(e,u=>[n,u,o])}function Tn(t){let{[Symbol.for("comments")]:e,[Symbol.for("printedComments")]:r}=t;for(let n of e){if(!n.printed&&!r.has(n))throw new Error('Comment "'+n.value.trim()+'" was not printed. Please report this error!');delete n.printed}}async function Sn(t,e,r,n,o){let{embeddedLanguageFormatting:u,printer:{embed:i,hasPrettierIgnore:s=()=>!1,getVisitorKeys:a}}=r;if(!i||u!=="auto")return;if(i.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=H(i.getVisitorKeys??a),c=[];d();let F=t.stack;for(let{print:l,node:p,pathStack:m}of c)try{t.stack=m;let E=await l(f,e,t,r);E&&o.set(p,E)}catch(E){if(globalThis.PRETTIER_DEBUG)throw E}t.stack=F;function f(l,p){return yo(l,p,r,n)}function d(){let{node:l}=t;if(l===null||typeof l!="object"||s(t))return;for(let m of D(l))Array.isArray(l[m])?t.each(d,m):t.call(d,m);let p=i(t,r);if(p){if(typeof p=="function"){c.push({print:p,node:l,pathStack:[...t.stack]});return}o.set(l,p)}}}async function yo(t,e,r,n){let o=await re({...r,...e,parentParser:r.parser,originalText:t},{passThrough:!0}),{ast:u}=await ae(t,o),i=await n(u,o);return Xe(i)}function xo(t){return()=>{}}var vn=xo;function _o(t,e){let{originalText:r,[Symbol.for("comments")]:n,locStart:o,locEnd:u,[Symbol.for("printedComments")]:i}=e,{node:s}=t,a=o(s),D=u(s);for(let c of n)o(c)>=a&&u(c)<=D&&i.add(c);return r.slice(a,D)}var Pn=_o;async function je(t,e){({ast:t}=await Ht(t,e));let r=new Map,n=new gn(t),o=vn(e),u=new Map;await Sn(n,s,e,je,u);let i=await Ln(n,e,s,void 0,u);return Tn(e),i;function s(D,c){return D===void 0||D===n?a(c):Array.isArray(D)?n.call(()=>a(c),...D):n.call(()=>a(c),D)}function a(D){o(n);let c=n.node;if(c==null)return"";let F=c&&typeof c=="object"&&D===void 0;if(F&&r.has(c))return r.get(c);let f=Ln(n,e,s,D,u);return F&&r.set(c,f),f}}function Ln(t,e,r,n,o){var a;let{node:u}=t,{printer:i}=e,s;return(a=i.hasPrettierIgnore)!=null&&a.call(i,t)?s=Pn(t,e):o.has(u)?s=o.get(u):s=i.print(t,e,r,n),u===e.cursorNode&&(s=Ze(s,D=>[Be,D,Be])),i.printComment&&(!i.willPrintOwnComments||!i.willPrintOwnComments(t,e))&&(s=Nn(t,s,e)),s}async function Ht(t,e){let r=t.comments??[];e[Symbol.for("comments")]=r,e[Symbol.for("tokens")]=t.tokens??[],e[Symbol.for("printedComments")]=new Set,bn(t,e);let{printer:{preprocess:n}}=e;return t=n?await n(t,e):t,{ast:t,comments:r}}var Ao=({parser:t})=>t==="json"||t==="json5"||t==="json-stringify";function Bo(t,e){let r=[t.node,...t.parentNodes],n=new Set([e.node,...e.parentNodes]);return r.find(o=>Yn.has(o.type)&&n.has(o))}function In(t){let e=t.length-1;for(;;){let r=t[e];if((r==null?void 0:r.type)==="Program"||(r==null?void 0:r.type)==="File")e--;else break}return t.slice(0,e+1)}function ko(t,e,{locStart:r,locEnd:n}){let o=t.node,u=e.node;if(o===u)return{startNode:o,endNode:u};let i=r(t.node);for(let a of In(e.parentNodes))if(r(a)>=i)u=a;else break;let s=n(e.node);for(let a of In(t.parentNodes)){if(n(a)<=s)o=a;else break;if(o===u)break}return{startNode:o,endNode:u}}function qt(t,e,r,n,o=[],u){let{locStart:i,locEnd:s}=r,a=i(t),D=s(t);if(!(e>D||en);let s=t.slice(n,o).search(/\S/),a=s===-1;if(!a)for(n+=s;o>n&&!/\S/.test(t[o-1]);--o);let D=qt(r,n,e,(d,l)=>Rn(e,d,l),[],"rangeStart"),c=a?D:qt(r,o,e,d=>Rn(e,d),[],"rangeEnd");if(!D||!c)return{rangeStart:0,rangeEnd:0};let F,f;if(Ao(e)){let d=Bo(D,c);F=d,f=d}else({startNode:F,endNode:f}=ko(D,c,e));return{rangeStart:Math.min(u(F),u(f)),rangeEnd:Math.max(i(F),i(f))}}function Oo(t,e){let{cursorOffset:r,locStart:n,locEnd:o}=e,u=H(e.printer.getVisitorKeys),i=a=>n(a)<=r&&o(a)>=r,s=t;for(let a of An(t,{getVisitorKeys:u,filter:i}))s=a;return s}var Vn=Oo;var zn="\uFEFF",$n=Symbol("cursor");async function Gn(t,e,r=0){if(!t||t.trim().length===0)return{formatted:"",cursorOffset:-1,comments:[]};let{ast:n,text:o}=await ae(t,e);e.cursorOffset>=0&&(e.cursorNode=Vn(n,e));let u=await je(n,e,r);r>0&&(u=qe([G,u],r,e.tabWidth));let i=fe(u,e);if(r>0){let a=i.formatted.trim();i.cursorNodeStart!==void 0&&(i.cursorNodeStart-=i.formatted.indexOf(a)),i.formatted=a+be(e.endOfLine)}let s=e[Symbol.for("comments")];if(e.cursorOffset>=0){let a,D,c,F,f;if(e.cursorNode&&i.cursorNodeText?(a=e.locStart(e.cursorNode),D=o.slice(a,e.locEnd(e.cursorNode)),c=e.cursorOffset-a,F=i.cursorNodeStart,f=i.cursorNodeText):(a=0,D=o,c=e.cursorOffset,F=0,f=i.formatted),D===f)return{formatted:i.formatted,cursorOffset:F+c,comments:s};let d=D.split("");d.splice(c,0,$n);let l=f.split(""),p=(0,Wn.diffArrays)(d,l),m=F;for(let E of p)if(E.removed){if(E.value.includes($n))break}else m+=E.count;return{formatted:i.formatted,cursorOffset:m,comments:s}}return{formatted:i.formatted,cursorOffset:-1,comments:s}}async function No(t,e){let{ast:r,text:n}=await ae(t,e),{rangeStart:o,rangeEnd:u}=jn(n,e,r),i=n.slice(o,u),s=Math.min(o,n.lastIndexOf(` `,o)+1),a=n.slice(s,o).match(/^\s*/)[0],D=pe(a,e.tabWidth),c=await Gn(i,{...e,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:e.cursorOffset>o&&e.cursorOffset<=u?e.cursorOffset-o:-1,endOfLine:"lf"},D),F=c.formatted.trimEnd(),{cursorOffset:f}=e;f>u?f+=F.length-i.length:c.cursorOffset>=0&&(f=c.cursorOffset+o);let d=n.slice(0,o)+F+n.slice(u);if(e.endOfLine!=="lf"){let l=be(e.endOfLine);f>=0&&l===`\r `&&(f+=At(d.slice(0,f),` `)),d=ee(!1,d,` `,l)}return{formatted:d,cursorOffset:f,comments:c.comments}}function Jt(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function Un(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o}=e;return r=Jt(t,r,-1),n=Jt(t,n,0),o=Jt(t,o,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:o}}function Kn(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u}=Un(t,e),i=t.charAt(0)===zn;if(i&&(t=t.slice(1),r--,n--,o--),u==="auto"&&(u=Cr(t)),t.includes("\r")){let s=a=>At(t.slice(0,Math.max(a,0)),`\r `);r-=s(r),n-=s(n),o-=s(o),t=gr(t)}return{hasBOM:i,text:t,options:Un(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u})}}async function Mn(t,e){let r=await ft(e);return!r.hasPragma||r.hasPragma(t)}async function Xt(t,e){let{hasBOM:r,text:n,options:o}=Kn(t,await re(e));if(o.rangeStart>=o.rangeEnd&&n!==""||o.requirePragma&&!await Mn(n,o))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let u;return o.rangeStart>0||o.rangeEnd=0&&u.cursorOffset++),u}async function Hn(t,e,r){let{text:n,options:o}=Kn(t,await re(e)),u=await ae(n,o);return r&&(r.preprocessForPrint&&(u.ast=await Ht(u.ast,o)),r.massage&&(u.ast=cn(u.ast,o))),u}async function qn(t,e){e=await re(e);let r=await je(t,e);return fe(r,e)}async function Jn(t,e){let r=Sr(t),{formatted:n}=await Xt(r,{...e,parser:"__js_expression"});return n}async function Xn(t,e){e=await re(e);let{ast:r}=await ae(t,e);return je(r,e)}async function Zn(t,e){return fe(t,await re(e))}var Qt={};Me(Qt,{addDanglingComment:()=>X,addLeadingComment:()=>ne,addTrailingComment:()=>ue,getAlignmentSize:()=>pe,getIndentSize:()=>eu,getMaxContinuousCount:()=>Qn,getNextNonSpaceNonCommentCharacter:()=>nu,getNextNonSpaceNonCommentCharacterIndex:()=>Mo,getStringWidth:()=>we,hasNewline:()=>V,hasNewlineInRange:()=>tu,hasSpaces:()=>ru,isNextLineEmpty:()=>Ko,isNextLineEmptyAfterIndex:()=>ht,isPreviousLineEmpty:()=>zo,makeString:()=>uu,skip:()=>me,skipEverythingButNewLine:()=>mt,skipInlineComment:()=>Ee,skipNewline:()=>Y,skipSpaces:()=>N,skipToLineEnd:()=>Ft,skipTrailingComment:()=>he,skipWhitespace:()=>xn});function So(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;rMath.max(n,o.length/e.length),0)}var Qn=Io;function Ro(t,e){let r=t.lastIndexOf(` `);return r===-1?0:pe(t.slice(r+1).match(/^[\t ]*/)[0],e)}var eu=Ro;function Yo(t,e,r){for(let n=e;ns===n?s:a===e?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(s)?s:"\\"+s));return e+u+e}var uu=$o;function Uo(t,e,r){return Ve(t,r(e))}function Mo(t,e){return arguments.length===2||typeof e=="number"?Ve(t,e):Uo(...arguments)}function Wo(t,e,r){return Ye(t,r(e))}function zo(t,e){return arguments.length===2||typeof e=="number"?Ye(t,e):Wo(...arguments)}function Go(t,e,r){return ht(t,r(e))}function Ko(t,e){return arguments.length===2||typeof e=="number"?ht(t,e):Go(...arguments)}var er={};Me(er,{builders:()=>Ho,printer:()=>qo,utils:()=>Jo});var Ho={join:ke,line:Ke,softline:Er,hardline:G,literalline:He,group:xt,conditionalGroup:fr,fill:Ge,lineSuffix:_e,lineSuffixBoundary:Fr,cursor:Be,breakParent:le,ifBreak:pr,trim:mr,indent:ie,indentIfBreak:dr,align:oe,addAlignmentToDoc:qe,markAsRoot:cr,dedentToRoot:Dr,dedent:lr,hardlineWithoutBreakParent:Ae,literallineWithoutBreakParent:_t,label:hr,concat:t=>t},qo={printDocToString:fe},Jo={willBreak:kr,traverseDoc:xe,findInDoc:Je,mapDoc:Ne,removeLines:wr,stripTrailingHardline:Xe,replaceEndOfLine:Or,canBreak:Nr};var ou="3.0.3";function De(t,e=1){return async(...r)=>{let n=r[e]??{},o=n.plugins??[];return r[e]={...n,plugins:Array.isArray(o)?o:Object.values(o)},t(...r)}}var iu=De(Xt);async function su(t,e){let{formatted:r}=await iu(t,{...e,cursorOffset:-1});return r}async function Xo(t,e){return await su(t,e)===t}var Zo=De(et,0),Qo={parse:De(Hn),formatAST:De(qn),formatDoc:De(Jn),printToDoc:De(Xn),printDocToString:De(Zn)};var Uc=tr;export{Qo as __debug,Xo as check,Uc as default,er as doc,su as format,iu as formatWithCursor,Zo as getSupportInfo,Qt as util,ou as version};