prettier 3.7.1 → 3.7.3

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.
@@ -29,7 +29,7 @@ https://evilmartians.com/chronicles/postcss-8-plugin-migration`));let u=s(...o);
29
29
  `,a+2);c=C!==-1?C-1:i}p=n.slice(a,c+1),_=p.split(`
30
30
  `),d=_.length-1,d>0?(y=u+d,v=c-_[d].length):(y=u,v=o),r.push(["comment",p,u,a-o,y,c-v,a]),o=v,u=y,a=c}else if(h===35&&!uy.test(n.slice(a+1,a+2)))c=a+1,r.push(["#",n.slice(a,c),u,a-o,u,c-o,a]),a=c-1;else if((h===117||h===85)&&n.charCodeAt(a+1)===43){c=a+2;do c+=1,h=n.charCodeAt(c);while(c<i&&ly.test(n.slice(c,c+1)));r.push(["unicoderange",n.slice(a,c),u,a-o,u,c-o,a]),a=c-1}else if(h===47)c=a+1,r.push(["operator",n.slice(a,c),u,a-o,u,c-o,a]),a=c-1;else{let S=ay;if(h>=48&&h<=57&&(S=Ye),S.lastIndex=a+1,S.test(n),S.lastIndex===0?c=n.length-1:c=S.lastIndex-2,S===Ye||h===46){let C=n.charCodeAt(c),Zs=n.charCodeAt(c+1),en=n.charCodeAt(c+2);(C===101||C===69)&&(Zs===45||Zs===43)&&en>=48&&en<=57&&(Ye.lastIndex=c+2,Ye.test(n),Ye.lastIndex===0?c=n.length-1:c=Ye.lastIndex-2)}r.push(["word",n.slice(a,c+1),u,a-o,u,c-o,a]),a=c}break}a++}return r}});var Xu=w((H_,Qu)=>{"use strict";var Ks=class extends Error{constructor(e){super(e),this.name=this.constructor.name,this.message=e||"An error ocurred while parsing.",typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}};Qu.exports=Ks});var tl=w((K_,el)=>{"use strict";var cy=wu(),fy=xu(),py=Eu(),hy=ku(),dy=Au(),my=Cu(),yy=Ru(),gy=qu(),wy=Du(),Ju=Bu(),vy=Uu(),Zu=Wu(),xy=Yu(),_y=Ku(),by=Ms(),Ey=Bs(),Sy=Fs(),ky=Xu();function Ty(t){return t.sort((e,s)=>e-s)}el.exports=class{constructor(e,s){let r={loose:!1};this.cache=[],this.input=e,this.options=Object.assign({},r,s),this.position=0,this.unbalanced=0,this.root=new cy;let n=new fy;this.root.append(n),this.current=n,this.tokens=_y(e,this.options)}parse(){return this.loop()}colon(){let e=this.currToken;this.newNode(new hy({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++}comma(){let e=this.currToken;this.newNode(new dy({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++}comment(){let e=!1,s=this.currToken[1].replace(/\/\*|\*\//g,""),r;this.options.loose&&s.startsWith("//")&&(s=s.substring(2),e=!0),r=new my({value:s,inline:e,source:{start:{line:this.currToken[2],column:this.currToken[3]},end:{line:this.currToken[4],column:this.currToken[5]}},sourceIndex:this.currToken[6]}),this.newNode(r),this.position++}error(e,s){throw new ky(e+` at line: ${s[2]}, column ${s[3]}`)}loop(){for(;this.position<this.tokens.length;)this.parseTokens();return!this.current.last&&this.spaces?this.current.raws.before+=this.spaces:this.spaces&&(this.current.last.raws.after+=this.spaces),this.spaces="",this.root}operator(){let e=this.currToken[1],s;if(e==="+"||e==="-"){if(this.options.loose||this.position>0&&(this.current.type==="func"&&this.current.value==="calc"?this.prevToken[0]!=="space"&&this.prevToken[0]!=="("?this.error("Syntax Error",this.currToken):this.nextToken[0]!=="space"&&this.nextToken[0]!=="word"?this.error("Syntax Error",this.currToken):this.nextToken[0]==="word"&&this.current.last.type!=="operator"&&this.current.last.value!=="("&&this.error("Syntax Error",this.currToken):(this.nextToken[0]==="space"||this.nextToken[0]==="operator"||this.prevToken[0]==="operator")&&this.error("Syntax Error",this.currToken)),this.options.loose){if((!this.current.nodes.length||this.current.last&&this.current.last.type==="operator")&&this.nextToken[0]==="word")return this.word()}else if(this.nextToken[0]==="word")return this.word()}return s=new wy({value:this.currToken[1],source:{start:{line:this.currToken[2],column:this.currToken[3]},end:{line:this.currToken[2],column:this.currToken[3]}},sourceIndex:this.currToken[4]}),this.position++,this.newNode(s)}parseTokens(){switch(this.currToken[0]){case"space":this.space();break;case"colon":this.colon();break;case"comma":this.comma();break;case"comment":this.comment();break;case"(":this.parenOpen();break;case")":this.parenClose();break;case"atword":case"word":this.word();break;case"operator":this.operator();break;case"string":this.string();break;case"unicoderange":this.unicodeRange();break;default:this.word();break}}parenOpen(){let e=1,s=this.position+1,r=this.currToken,n;for(;s<this.tokens.length&&e;){let i=this.tokens[s];i[0]==="("&&e++,i[0]===")"&&e--,s++}if(e&&this.error("Expected closing parenthesis",r),n=this.current.last,n&&n.type==="func"&&n.unbalanced<0&&(n.unbalanced=0,this.current=n),this.current.unbalanced++,this.newNode(new Ju({value:r[1],source:{start:{line:r[2],column:r[3]},end:{line:r[4],column:r[5]}},sourceIndex:r[6]})),this.position++,this.current.type==="func"&&this.current.unbalanced&&this.current.value==="url"&&this.currToken[0]!=="string"&&this.currToken[0]!==")"&&!this.options.loose){let i=this.nextToken,o=this.currToken[1],u={line:this.currToken[2],column:this.currToken[3]};for(;i&&i[0]!==")"&&this.current.unbalanced;)this.position++,o+=this.currToken[1],i=this.nextToken;this.position!==this.tokens.length-1&&(this.position++,this.newNode(new Zu({value:o,source:{start:u,end:{line:this.currToken[4],column:this.currToken[5]}},sourceIndex:this.currToken[6]})))}}parenClose(){let e=this.currToken;this.newNode(new Ju({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++,!(this.position>=this.tokens.length-1&&!this.current.unbalanced)&&(this.current.unbalanced--,this.current.unbalanced<0&&this.error("Expected opening parenthesis",e),!this.current.unbalanced&&this.cache.length&&(this.current=this.cache.pop()))}space(){let e=this.currToken;this.position===this.tokens.length-1||this.nextToken[0]===","||this.nextToken[0]===")"?(this.current.last.raws.after+=e[1],this.position++):(this.spaces=e[1],this.position++)}unicodeRange(){let e=this.currToken;this.newNode(new xy({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++}splitWord(){let e=this.nextToken,s=this.currToken[1],r=/^[\+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][\+\-]?\d+)?/,n=/^(?!\#([a-z0-9]+))[\#\{\}]/gi,i,o;if(!n.test(s))for(;e&&e[0]==="word";){this.position++;let u=this.currToken[1];s+=u,e=this.nextToken}i=Ey(s,"@"),o=Ty(Sy(by([[0],i]))),o.forEach((u,a)=>{let l=o[a+1]||s.length,f=s.slice(u,l),h;if(~i.indexOf(u))h=new py({value:f.slice(1),source:{start:{line:this.currToken[2],column:this.currToken[3]+u},end:{line:this.currToken[4],column:this.currToken[3]+(l-1)}},sourceIndex:this.currToken[6]+o[a]});else if(r.test(this.currToken[1])){let c=f.replace(r,"");h=new gy({value:f.replace(c,""),source:{start:{line:this.currToken[2],column:this.currToken[3]+u},end:{line:this.currToken[4],column:this.currToken[3]+(l-1)}},sourceIndex:this.currToken[6]+o[a],unit:c})}else h=new(e&&e[0]==="("?yy:Zu)({value:f,source:{start:{line:this.currToken[2],column:this.currToken[3]+u},end:{line:this.currToken[4],column:this.currToken[3]+(l-1)}},sourceIndex:this.currToken[6]+o[a]}),h.type==="word"?(h.isHex=/^#(.+)/.test(f),h.isColor=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(f)):this.cache.push(this.current);this.newNode(h)}),this.position++}string(){let e=this.currToken,s=this.currToken[1],r=/^(\"|\')/,n=r.test(s),i="",o;n&&(i=s.match(r)[0],s=s.slice(1,s.length-1)),o=new vy({value:s,source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6],quoted:n}),o.raws.quote=i,this.newNode(o),this.position++}word(){return this.splitWord()}newNode(e){return this.spaces&&(e.raws.before+=this.spaces,this.spaces=""),this.current.append(e)}get currToken(){return this.tokens[this.position]}get nextToken(){return this.tokens[this.position+1]}get prevToken(){return this.tokens[this.position-1]}}});var Gy={};tn(Gy,{languages:()=>_i,options:()=>Ei,parsers:()=>Js,printers:()=>Wy});var _t=(t,e)=>(s,r,...n)=>s|1&&r==null?void 0:(e.call(r)??r[t]).apply(r,n);var Sl=String.prototype.replaceAll??function(t,e){return t.global?this.replace(t,e):this.split(t).join(e)},kl=_t("replaceAll",function(){if(typeof this=="string")return Sl}),b=kl;function Tl(t){return this[t<0?this.length+t:t]}var Al=_t("at",function(){if(Array.isArray(this)||typeof this=="string")return Tl}),W=Al;var Ol=()=>{},j=Ol;var Ve="string",ze="array",bt="cursor",ne="indent",ke="align",Et="trim",ie="group",oe="fill",de="if-break",St="indent-if-break",Te="line-suffix",kt="line-suffix-boundary",Q="line",Tt="label",Ae="break-parent",At=new Set([bt,ne,ke,Et,ie,oe,de,St,Te,kt,Q,Tt,Ae]);function Cl(t){if(typeof t=="string")return Ve;if(Array.isArray(t))return ze;if(!t)return;let{type:e}=t;if(At.has(e))return e}var ae=Cl;var Nl=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function Pl(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
31
31
  Expected it to be 'string' or 'object'.`;if(ae(t))throw new Error("doc is valid.");let s=Object.prototype.toString.call(t);if(s!=="[object Object]")return`Unexpected doc '${s}'.`;let r=Nl([...At].map(n=>`'${n}'`));return`Unexpected doc.type '${t.type}'.
32
- Expected it to be ${r}.`}var Yr=class extends Error{name="InvalidDocError";constructor(e){super(Pl(e)),this.doc=e}},sn=Yr;function Rl(t,e){if(typeof t=="string")return e(t);let s=new Map;return r(t);function r(i){if(s.has(i))return s.get(i);let o=n(i);return s.set(i,o),o}function n(i){switch(ae(i)){case ze:return e(i.map(r));case oe:return e({...i,parts:i.parts.map(r)});case de:return e({...i,breakContents:r(i.breakContents),flatContents:r(i.flatContents)});case ie:{let{expandedStates:o,contents:u}=i;return o?(o=o.map(r),u=o[0]):u=r(u),e({...i,contents:u,expandedStates:o})}case ke:case ne:case St:case Tt:case Te:return e({...i,contents:r(i.contents)});case Ve:case bt:case Et:case kt:case Q:case Ae:return e(i);default:throw new sn(i)}}}function Il(t){return t.type===Q&&!t.hard?t.soft?"":" ":t.type===de?t.flatContents:t}function nn(t){return Rl(t,Il)}var U=j,me=j,on=j,an=j;function q(t){return U(t),{type:ne,contents:t}}function ql(t,e){return an(t),U(e),{type:ke,contents:e,n:t}}function ue(t){return ql(-1,t)}var Oe={type:Ae};function Ce(t){return on(t),{type:oe,parts:t}}function L(t,e={}){return U(t),me(e.expandedStates,!0),{type:ie,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function Ot(t,e="",s={}){return U(t),e!==""&&U(e),{type:de,breakContents:t,flatContents:e,groupId:s.groupId}}function G(t,e){U(t),me(e);let s=[];for(let r=0;r<e.length;r++)r!==0&&s.push(t),s.push(e[r]);return s}var O={type:Q},D={type:Q,soft:!0},Ll={type:Q,hard:!0},k=[Ll,Oe];function un(t){return U(t),{type:Te,contents:t}}function Dl(t){return Array.isArray(t)&&t.length>0}var le=Dl;function Bl(t,e){let s=e===!0||e==="'"?"'":'"',r=s==="'"?'"':"'",n=0,i=0;for(let o of t)o===s?n++:o===r&&i++;return n>i?r:s}var ln=Bl;var Fl=/\\?(?<quote>["'])/gu;function Ul(t,e){return e+b(0,t,Fl,(s,r)=>(r===e?"\\":"")+r)+e}var cn=Ul;function $l(t,e){j(/^(?<quote>["']).*\k<quote>$/su.test(t));let s=t.slice(1,-1),r=e.parser==="json"||e.parser==="jsonc"||e.parser==="json5"&&e.quoteProps==="preserve"&&!e.singleQuote?'"':e.__isInHtmlAttribute?"'":ln(s,e.singleQuote);return t.charAt(0)===r?t:cn(s,r)}var Ct=$l;var Vr=class extends Error{name="UnexpectedNodeError";constructor(e,s,r="type"){super(`Unexpected ${s} node ${r}: ${JSON.stringify(e[r])}.`),this.node=e}},fn=Vr;var Nt=Symbol.for("PRETTIER_IS_FRONT_MATTER");function Wl(t){return!!t?.[Nt]}var Ne=Wl;var He=3;function Gl(t){let e=t.slice(0,He);if(e!=="---"&&e!=="+++")return;let s=t.indexOf(`
32
+ Expected it to be ${r}.`}var Yr=class extends Error{name="InvalidDocError";constructor(e){super(Pl(e)),this.doc=e}},sn=Yr;function Rl(t,e){if(typeof t=="string")return e(t);let s=new Map;return r(t);function r(i){if(s.has(i))return s.get(i);let o=n(i);return s.set(i,o),o}function n(i){switch(ae(i)){case ze:return e(i.map(r));case oe:return e({...i,parts:i.parts.map(r)});case de:return e({...i,breakContents:r(i.breakContents),flatContents:r(i.flatContents)});case ie:{let{expandedStates:o,contents:u}=i;return o?(o=o.map(r),u=o[0]):u=r(u),e({...i,contents:u,expandedStates:o})}case ke:case ne:case St:case Tt:case Te:return e({...i,contents:r(i.contents)});case Ve:case bt:case Et:case kt:case Q:case Ae:return e(i);default:throw new sn(i)}}}function Il(t){return t.type===Q&&!t.hard?t.soft?"":" ":t.type===de?t.flatContents:t}function nn(t){return Rl(t,Il)}var U=j,me=j,on=j,an=j;function q(t){return U(t),{type:ne,contents:t}}function ql(t,e){return an(t),U(e),{type:ke,contents:e,n:t}}function ue(t){return ql(-1,t)}var Oe={type:Ae};function Ce(t){return on(t),{type:oe,parts:t}}function L(t,e={}){return U(t),me(e.expandedStates,!0),{type:ie,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function Ot(t,e="",s={}){return U(t),e!==""&&U(e),{type:de,breakContents:t,flatContents:e,groupId:s.groupId}}function G(t,e){U(t),me(e);let s=[];for(let r=0;r<e.length;r++)r!==0&&s.push(t),s.push(e[r]);return s}var O={type:Q},D={type:Q,soft:!0},Ll={type:Q,hard:!0},k=[Ll,Oe];function un(t){return U(t),{type:Te,contents:t}}function Dl(t){return Array.isArray(t)&&t.length>0}var le=Dl;function Bl(t,e){let s=e===!0||e==="'"?"'":'"',r=s==="'"?'"':"'",n=0,i=0;for(let o of t)o===s?n++:o===r&&i++;return n>i?r:s}var ln=Bl;var Fl=/\\(["'\\])|(["'])/gu;function Ul(t,e){let s=e==='"'?"'":'"',r=b(0,t,Fl,(n,i,o)=>i?i===s?s:n:o===e?"\\"+o:o);return e+r+e}var cn=Ul;function $l(t,e){j(/^(?<quote>["']).*\k<quote>$/su.test(t));let s=t.slice(1,-1),r=e.parser==="json"||e.parser==="jsonc"||e.parser==="json5"&&e.quoteProps==="preserve"&&!e.singleQuote?'"':e.__isInHtmlAttribute?"'":ln(s,e.singleQuote);return t.charAt(0)===r?t:cn(s,r)}var Ct=$l;var Vr=class extends Error{name="UnexpectedNodeError";constructor(e,s,r="type"){super(`Unexpected ${s} node ${r}: ${JSON.stringify(e[r])}.`),this.node=e}},fn=Vr;var Nt=Symbol.for("PRETTIER_IS_FRONT_MATTER");function Wl(t){return!!t?.[Nt]}var Ne=Wl;var He=3;function Gl(t){let e=t.slice(0,He);if(e!=="---"&&e!=="+++")return;let s=t.indexOf(`
33
33
  `,He);if(s===-1)return;let r=t.slice(He,s).trim(),n=t.indexOf(`
34
34
  ${e}`,s),i=r;if(i||(i=e==="+++"?"toml":"yaml"),n===-1&&e==="---"&&i==="yaml"&&(n=t.indexOf(`
35
35
  ...`,s)),n===-1)return;let o=n+1+He,u=t.charAt(o+1);if(!/\s?/u.test(u))return;let a=t.slice(0,o),l;return{language:i,explicitLanguage:r||null,value:t.slice(s+1,n),startDelimiter:e,endDelimiter:a.slice(-He),raw:a,start:{line:1,column:0,index:0},end:{index:a.length,get line(){return l??(l=a.split(`
@@ -29,7 +29,7 @@ https://evilmartians.com/chronicles/postcss-8-plugin-migration`));let u=s(...o);
29
29
  `,a+2);c=C!==-1?C-1:i}p=n.slice(a,c+1),_=p.split(`
30
30
  `),d=_.length-1,d>0?(y=u+d,v=c-_[d].length):(y=u,v=o),r.push(["comment",p,u,a-o,y,c-v,a]),o=v,u=y,a=c}else if(h===35&&!uy.test(n.slice(a+1,a+2)))c=a+1,r.push(["#",n.slice(a,c),u,a-o,u,c-o,a]),a=c-1;else if((h===117||h===85)&&n.charCodeAt(a+1)===43){c=a+2;do c+=1,h=n.charCodeAt(c);while(c<i&&ly.test(n.slice(c,c+1)));r.push(["unicoderange",n.slice(a,c),u,a-o,u,c-o,a]),a=c-1}else if(h===47)c=a+1,r.push(["operator",n.slice(a,c),u,a-o,u,c-o,a]),a=c-1;else{let S=ay;if(h>=48&&h<=57&&(S=Ye),S.lastIndex=a+1,S.test(n),S.lastIndex===0?c=n.length-1:c=S.lastIndex-2,S===Ye||h===46){let C=n.charCodeAt(c),Zs=n.charCodeAt(c+1),en=n.charCodeAt(c+2);(C===101||C===69)&&(Zs===45||Zs===43)&&en>=48&&en<=57&&(Ye.lastIndex=c+2,Ye.test(n),Ye.lastIndex===0?c=n.length-1:c=Ye.lastIndex-2)}r.push(["word",n.slice(a,c+1),u,a-o,u,c-o,a]),a=c}break}a++}return r}});var Qu=w((z_,Ku)=>{"use strict";var Ks=class extends Error{constructor(e){super(e),this.name=this.constructor.name,this.message=e||"An error ocurred while parsing.",typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}};Ku.exports=Ks});var el=w((j_,Zu)=>{"use strict";var cy=gu(),fy=vu(),py=bu(),hy=Su(),dy=Tu(),my=Ou(),yy=Pu(),gy=Iu(),wy=Lu(),Xu=Mu(),vy=Fu(),Ju=$u(),xy=Gu(),_y=ju(),by=Ms(),Ey=Bs(),Sy=Fs(),ky=Qu();function Ty(t){return t.sort((e,s)=>e-s)}Zu.exports=class{constructor(e,s){let r={loose:!1};this.cache=[],this.input=e,this.options=Object.assign({},r,s),this.position=0,this.unbalanced=0,this.root=new cy;let n=new fy;this.root.append(n),this.current=n,this.tokens=_y(e,this.options)}parse(){return this.loop()}colon(){let e=this.currToken;this.newNode(new hy({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++}comma(){let e=this.currToken;this.newNode(new dy({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++}comment(){let e=!1,s=this.currToken[1].replace(/\/\*|\*\//g,""),r;this.options.loose&&s.startsWith("//")&&(s=s.substring(2),e=!0),r=new my({value:s,inline:e,source:{start:{line:this.currToken[2],column:this.currToken[3]},end:{line:this.currToken[4],column:this.currToken[5]}},sourceIndex:this.currToken[6]}),this.newNode(r),this.position++}error(e,s){throw new ky(e+` at line: ${s[2]}, column ${s[3]}`)}loop(){for(;this.position<this.tokens.length;)this.parseTokens();return!this.current.last&&this.spaces?this.current.raws.before+=this.spaces:this.spaces&&(this.current.last.raws.after+=this.spaces),this.spaces="",this.root}operator(){let e=this.currToken[1],s;if(e==="+"||e==="-"){if(this.options.loose||this.position>0&&(this.current.type==="func"&&this.current.value==="calc"?this.prevToken[0]!=="space"&&this.prevToken[0]!=="("?this.error("Syntax Error",this.currToken):this.nextToken[0]!=="space"&&this.nextToken[0]!=="word"?this.error("Syntax Error",this.currToken):this.nextToken[0]==="word"&&this.current.last.type!=="operator"&&this.current.last.value!=="("&&this.error("Syntax Error",this.currToken):(this.nextToken[0]==="space"||this.nextToken[0]==="operator"||this.prevToken[0]==="operator")&&this.error("Syntax Error",this.currToken)),this.options.loose){if((!this.current.nodes.length||this.current.last&&this.current.last.type==="operator")&&this.nextToken[0]==="word")return this.word()}else if(this.nextToken[0]==="word")return this.word()}return s=new wy({value:this.currToken[1],source:{start:{line:this.currToken[2],column:this.currToken[3]},end:{line:this.currToken[2],column:this.currToken[3]}},sourceIndex:this.currToken[4]}),this.position++,this.newNode(s)}parseTokens(){switch(this.currToken[0]){case"space":this.space();break;case"colon":this.colon();break;case"comma":this.comma();break;case"comment":this.comment();break;case"(":this.parenOpen();break;case")":this.parenClose();break;case"atword":case"word":this.word();break;case"operator":this.operator();break;case"string":this.string();break;case"unicoderange":this.unicodeRange();break;default:this.word();break}}parenOpen(){let e=1,s=this.position+1,r=this.currToken,n;for(;s<this.tokens.length&&e;){let i=this.tokens[s];i[0]==="("&&e++,i[0]===")"&&e--,s++}if(e&&this.error("Expected closing parenthesis",r),n=this.current.last,n&&n.type==="func"&&n.unbalanced<0&&(n.unbalanced=0,this.current=n),this.current.unbalanced++,this.newNode(new Xu({value:r[1],source:{start:{line:r[2],column:r[3]},end:{line:r[4],column:r[5]}},sourceIndex:r[6]})),this.position++,this.current.type==="func"&&this.current.unbalanced&&this.current.value==="url"&&this.currToken[0]!=="string"&&this.currToken[0]!==")"&&!this.options.loose){let i=this.nextToken,o=this.currToken[1],u={line:this.currToken[2],column:this.currToken[3]};for(;i&&i[0]!==")"&&this.current.unbalanced;)this.position++,o+=this.currToken[1],i=this.nextToken;this.position!==this.tokens.length-1&&(this.position++,this.newNode(new Ju({value:o,source:{start:u,end:{line:this.currToken[4],column:this.currToken[5]}},sourceIndex:this.currToken[6]})))}}parenClose(){let e=this.currToken;this.newNode(new Xu({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++,!(this.position>=this.tokens.length-1&&!this.current.unbalanced)&&(this.current.unbalanced--,this.current.unbalanced<0&&this.error("Expected opening parenthesis",e),!this.current.unbalanced&&this.cache.length&&(this.current=this.cache.pop()))}space(){let e=this.currToken;this.position===this.tokens.length-1||this.nextToken[0]===","||this.nextToken[0]===")"?(this.current.last.raws.after+=e[1],this.position++):(this.spaces=e[1],this.position++)}unicodeRange(){let e=this.currToken;this.newNode(new xy({value:e[1],source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6]})),this.position++}splitWord(){let e=this.nextToken,s=this.currToken[1],r=/^[\+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][\+\-]?\d+)?/,n=/^(?!\#([a-z0-9]+))[\#\{\}]/gi,i,o;if(!n.test(s))for(;e&&e[0]==="word";){this.position++;let u=this.currToken[1];s+=u,e=this.nextToken}i=Ey(s,"@"),o=Ty(Sy(by([[0],i]))),o.forEach((u,a)=>{let l=o[a+1]||s.length,f=s.slice(u,l),h;if(~i.indexOf(u))h=new py({value:f.slice(1),source:{start:{line:this.currToken[2],column:this.currToken[3]+u},end:{line:this.currToken[4],column:this.currToken[3]+(l-1)}},sourceIndex:this.currToken[6]+o[a]});else if(r.test(this.currToken[1])){let c=f.replace(r,"");h=new gy({value:f.replace(c,""),source:{start:{line:this.currToken[2],column:this.currToken[3]+u},end:{line:this.currToken[4],column:this.currToken[3]+(l-1)}},sourceIndex:this.currToken[6]+o[a],unit:c})}else h=new(e&&e[0]==="("?yy:Ju)({value:f,source:{start:{line:this.currToken[2],column:this.currToken[3]+u},end:{line:this.currToken[4],column:this.currToken[3]+(l-1)}},sourceIndex:this.currToken[6]+o[a]}),h.type==="word"?(h.isHex=/^#(.+)/.test(f),h.isColor=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(f)):this.cache.push(this.current);this.newNode(h)}),this.position++}string(){let e=this.currToken,s=this.currToken[1],r=/^(\"|\')/,n=r.test(s),i="",o;n&&(i=s.match(r)[0],s=s.slice(1,s.length-1)),o=new vy({value:s,source:{start:{line:e[2],column:e[3]},end:{line:e[4],column:e[5]}},sourceIndex:e[6],quoted:n}),o.raws.quote=i,this.newNode(o),this.position++}word(){return this.splitWord()}newNode(e){return this.spaces&&(e.raws.before+=this.spaces,this.spaces=""),this.current.append(e)}get currToken(){return this.tokens[this.position]}get nextToken(){return this.tokens[this.position+1]}get prevToken(){return this.tokens[this.position-1]}}});var gl={};tn(gl,{languages:()=>xi,options:()=>bi,parsers:()=>Js,printers:()=>Wy});var xt=(t,e)=>(s,r,...n)=>s|1&&r==null?void 0:(e.call(r)??r[t]).apply(r,n);var Sl=String.prototype.replaceAll??function(t,e){return t.global?this.replace(t,e):this.split(t).join(e)},kl=xt("replaceAll",function(){if(typeof this=="string")return Sl}),b=kl;function Tl(t){return this[t<0?this.length+t:t]}var Al=xt("at",function(){if(Array.isArray(this)||typeof this=="string")return Tl}),W=Al;var Ol=()=>{},j=Ol;var Ve="string",ze="array",_t="cursor",ne="indent",ke="align",bt="trim",ie="group",oe="fill",de="if-break",Et="indent-if-break",Te="line-suffix",St="line-suffix-boundary",Q="line",kt="label",Ae="break-parent",Tt=new Set([_t,ne,ke,bt,ie,oe,de,Et,Te,St,Q,kt,Ae]);function Cl(t){if(typeof t=="string")return Ve;if(Array.isArray(t))return ze;if(!t)return;let{type:e}=t;if(Tt.has(e))return e}var ae=Cl;var Nl=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function Pl(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
31
31
  Expected it to be 'string' or 'object'.`;if(ae(t))throw new Error("doc is valid.");let s=Object.prototype.toString.call(t);if(s!=="[object Object]")return`Unexpected doc '${s}'.`;let r=Nl([...Tt].map(n=>`'${n}'`));return`Unexpected doc.type '${t.type}'.
32
- Expected it to be ${r}.`}var Yr=class extends Error{name="InvalidDocError";constructor(e){super(Pl(e)),this.doc=e}},rn=Yr;function Rl(t,e){if(typeof t=="string")return e(t);let s=new Map;return r(t);function r(i){if(s.has(i))return s.get(i);let o=n(i);return s.set(i,o),o}function n(i){switch(ae(i)){case ze:return e(i.map(r));case oe:return e({...i,parts:i.parts.map(r)});case de:return e({...i,breakContents:r(i.breakContents),flatContents:r(i.flatContents)});case ie:{let{expandedStates:o,contents:u}=i;return o?(o=o.map(r),u=o[0]):u=r(u),e({...i,contents:u,expandedStates:o})}case ke:case ne:case Et:case kt:case Te:return e({...i,contents:r(i.contents)});case Ve:case _t:case bt:case St:case Q:case Ae:return e(i);default:throw new rn(i)}}}function Il(t){return t.type===Q&&!t.hard?t.soft?"":" ":t.type===de?t.flatContents:t}function sn(t){return Rl(t,Il)}var U=j,me=j,nn=j,on=j;function q(t){return U(t),{type:ne,contents:t}}function ql(t,e){return on(t),U(e),{type:ke,contents:e,n:t}}function ue(t){return ql(-1,t)}var Oe={type:Ae};function Ce(t){return nn(t),{type:oe,parts:t}}function L(t,e={}){return U(t),me(e.expandedStates,!0),{type:ie,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function At(t,e="",s={}){return U(t),e!==""&&U(e),{type:de,breakContents:t,flatContents:e,groupId:s.groupId}}function G(t,e){U(t),me(e);let s=[];for(let r=0;r<e.length;r++)r!==0&&s.push(t),s.push(e[r]);return s}var O={type:Q},D={type:Q,soft:!0},Ll={type:Q,hard:!0},k=[Ll,Oe];function an(t){return U(t),{type:Te,contents:t}}function Dl(t){return Array.isArray(t)&&t.length>0}var le=Dl;function Bl(t,e){let s=e===!0||e==="'"?"'":'"',r=s==="'"?'"':"'",n=0,i=0;for(let o of t)o===s?n++:o===r&&i++;return n>i?r:s}var un=Bl;var Fl=/\\?(?<quote>["'])/gu;function Ul(t,e){return e+b(0,t,Fl,(s,r)=>(r===e?"\\":"")+r)+e}var ln=Ul;function $l(t,e){j(/^(?<quote>["']).*\k<quote>$/su.test(t));let s=t.slice(1,-1),r=e.parser==="json"||e.parser==="jsonc"||e.parser==="json5"&&e.quoteProps==="preserve"&&!e.singleQuote?'"':e.__isInHtmlAttribute?"'":un(s,e.singleQuote);return t.charAt(0)===r?t:ln(s,r)}var Ot=$l;var Vr=class extends Error{name="UnexpectedNodeError";constructor(e,s,r="type"){super(`Unexpected ${s} node ${r}: ${JSON.stringify(e[r])}.`),this.node=e}},cn=Vr;var Ct=Symbol.for("PRETTIER_IS_FRONT_MATTER");function Wl(t){return!!t?.[Ct]}var Ne=Wl;var He=3;function Gl(t){let e=t.slice(0,He);if(e!=="---"&&e!=="+++")return;let s=t.indexOf(`
32
+ Expected it to be ${r}.`}var Yr=class extends Error{name="InvalidDocError";constructor(e){super(Pl(e)),this.doc=e}},rn=Yr;function Rl(t,e){if(typeof t=="string")return e(t);let s=new Map;return r(t);function r(i){if(s.has(i))return s.get(i);let o=n(i);return s.set(i,o),o}function n(i){switch(ae(i)){case ze:return e(i.map(r));case oe:return e({...i,parts:i.parts.map(r)});case de:return e({...i,breakContents:r(i.breakContents),flatContents:r(i.flatContents)});case ie:{let{expandedStates:o,contents:u}=i;return o?(o=o.map(r),u=o[0]):u=r(u),e({...i,contents:u,expandedStates:o})}case ke:case ne:case Et:case kt:case Te:return e({...i,contents:r(i.contents)});case Ve:case _t:case bt:case St:case Q:case Ae:return e(i);default:throw new rn(i)}}}function Il(t){return t.type===Q&&!t.hard?t.soft?"":" ":t.type===de?t.flatContents:t}function sn(t){return Rl(t,Il)}var U=j,me=j,nn=j,on=j;function q(t){return U(t),{type:ne,contents:t}}function ql(t,e){return on(t),U(e),{type:ke,contents:e,n:t}}function ue(t){return ql(-1,t)}var Oe={type:Ae};function Ce(t){return nn(t),{type:oe,parts:t}}function L(t,e={}){return U(t),me(e.expandedStates,!0),{type:ie,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function At(t,e="",s={}){return U(t),e!==""&&U(e),{type:de,breakContents:t,flatContents:e,groupId:s.groupId}}function G(t,e){U(t),me(e);let s=[];for(let r=0;r<e.length;r++)r!==0&&s.push(t),s.push(e[r]);return s}var O={type:Q},D={type:Q,soft:!0},Ll={type:Q,hard:!0},k=[Ll,Oe];function an(t){return U(t),{type:Te,contents:t}}function Dl(t){return Array.isArray(t)&&t.length>0}var le=Dl;function Bl(t,e){let s=e===!0||e==="'"?"'":'"',r=s==="'"?'"':"'",n=0,i=0;for(let o of t)o===s?n++:o===r&&i++;return n>i?r:s}var un=Bl;var Fl=/\\(["'\\])|(["'])/gu;function Ul(t,e){let s=e==='"'?"'":'"',r=b(0,t,Fl,(n,i,o)=>i?i===s?s:n:o===e?"\\"+o:o);return e+r+e}var ln=Ul;function $l(t,e){j(/^(?<quote>["']).*\k<quote>$/su.test(t));let s=t.slice(1,-1),r=e.parser==="json"||e.parser==="jsonc"||e.parser==="json5"&&e.quoteProps==="preserve"&&!e.singleQuote?'"':e.__isInHtmlAttribute?"'":un(s,e.singleQuote);return t.charAt(0)===r?t:ln(s,r)}var Ot=$l;var Vr=class extends Error{name="UnexpectedNodeError";constructor(e,s,r="type"){super(`Unexpected ${s} node ${r}: ${JSON.stringify(e[r])}.`),this.node=e}},cn=Vr;var Ct=Symbol.for("PRETTIER_IS_FRONT_MATTER");function Wl(t){return!!t?.[Ct]}var Ne=Wl;var He=3;function Gl(t){let e=t.slice(0,He);if(e!=="---"&&e!=="+++")return;let s=t.indexOf(`
33
33
  `,He);if(s===-1)return;let r=t.slice(He,s).trim(),n=t.indexOf(`
34
34
  ${e}`,s),i=r;if(i||(i=e==="+++"?"toml":"yaml"),n===-1&&e==="---"&&i==="yaml"&&(n=t.indexOf(`
35
35
  ...`,s)),n===-1)return;let o=n+1+He,u=t.charAt(o+1);if(!/\s?/u.test(u))return;let a=t.slice(0,o),l;return{language:i,explicitLanguage:r||null,value:t.slice(s+1,n),startDelimiter:e,endDelimiter:a.slice(-He),raw:a,start:{line:1,column:0,index:0},end:{index:a.length,get line(){return l??(l=a.split(`
package/standalone.js CHANGED
@@ -28,6 +28,6 @@ ${d}`),d}async function pa(e,t){let u=await Ue(t),r=u.preprocess?await u.preproc
28
28
  `&&(d+=Ut(c.slice(0,d),`
29
29
  `)),c=oe(0,c,`
30
30
  `,p)}return{formatted:c,cursorOffset:d,comments:f.comments}}function Bu(e,t,u){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?u:t}function _n(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o}=t;return u=Bu(e,u,-1),r=Bu(e,r,0),o=Bu(e,o,e.length),{...t,cursorOffset:u,rangeStart:r,rangeEnd:o}}function Nn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n}=_n(e,t),a=e.charAt(0)===Bn;if(a&&(e=e.slice(1),u--,r--,o--),n==="auto"&&(n=ku(e)),e.includes("\r")){let s=i=>Ut(e.slice(0,Math.max(i,0)),`\r
31
- `);u-=s(u),r-=s(r),o-=s(o),e=vu(e)}return{hasBOM:a,text:e,options:_n(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function xn(e,t){let u=await Ue(t);return!u.hasPragma||u.hasPragma(e)}async function Na(e,t){return(await Ue(t)).hasIgnorePragma?.(e)}async function Tu(e,t){let{hasBOM:u,text:r,options:o}=Nn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await xn(r,o)||o.checkIgnorePragma&&await Na(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ta(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await xn(r,o)&&(r=o.printer.insertPragma(r)),n=await Tn(r,o)),u&&(n.formatted=Bn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function Sn(e,t,u){let{text:r,options:o}=Nn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await Au(n.ast,o)),u.massage&&(n.ast=En(n.ast,o))),n}async function wn(e,t){t=await se(t);let u=await Ke(e,t);return Ce(u,t)}async function On(e,t){let u=rr(e),{formatted:r}=await Tu(u,{...t,parser:"__js_expression"});return r}async function Pn(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,..._u(u,t)}),Ke(u,t)}async function In(e,t){return Ce(e,await se(t))}var Nu={};Mt(Nu,{builders:()=>wa,printer:()=>Oa,utils:()=>Pa});var wa={join:Pe,line:tt,softline:er,hardline:V,literalline:qe,group:$t,conditionalGroup:Xu,fill:Hu,lineSuffix:ke,lineSuffixBoundary:tr,cursor:ee,breakParent:ce,ifBreak:qu,trim:ur,indent:ae,indentIfBreak:Qu,align:De,addAlignmentToDoc:et,markAsRoot:Ze,dedentToRoot:Gu,dedent:zu,hardlineWithoutBreakParent:Ie,literallineWithoutBreakParent:Vt,label:Zu,concat:e=>e},Oa={printDocToString:Ce},Pa={willBreak:ju,traverseDoc:Se,findInDoc:He,mapDoc:Oe,removeLines:Wu,stripTrailingHardline:Xe,replaceEndOfLine:$u,canBreak:Vu};var kn="3.7.1";var wu={};Mt(wu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>vn,getMaxContinuousCount:()=>Rn,getNextNonSpaceNonCommentCharacter:()=>Ln,getNextNonSpaceNonCommentCharacterIndex:()=>Va,getPreferredQuote:()=>Mn,getStringWidth:()=>ve,hasNewline:()=>G,hasNewlineInRange:()=>Yn,hasSpaces:()=>jn,isNextLineEmpty:()=>Ha,isNextLineEmptyAfterIndex:()=>kt,isPreviousLineEmpty:()=>Ja,makeString:()=>za,skip:()=>ge,skipEverythingButNewLine:()=>nt,skipInlineComment:()=>_e,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>rt,skipTrailingComment:()=>xe,skipWhitespace:()=>fr});function Ia(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var _e=Ia;function ka(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?nt(e,t):t}var xe=ka;function va(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=_e(e,r),r=xe(e,r),r=K(e,r);return r}var Je=va;function Ra(e,t){let u=null,r=t;for(;r!==u;)u=r,r=rt(e,r),r=_e(e,r),r=Y(e,r);return r=xe(e,r),r=K(e,r),r!==!1&&G(e,r)}var kt=Ra;function La(e,t){let u=e.lastIndexOf(`
31
+ `);u-=s(u),r-=s(r),o-=s(o),e=vu(e)}return{hasBOM:a,text:e,options:_n(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function xn(e,t){let u=await Ue(t);return!u.hasPragma||u.hasPragma(e)}async function Na(e,t){return(await Ue(t)).hasIgnorePragma?.(e)}async function Tu(e,t){let{hasBOM:u,text:r,options:o}=Nn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await xn(r,o)||o.checkIgnorePragma&&await Na(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ta(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await xn(r,o)&&(r=o.printer.insertPragma(r)),n=await Tn(r,o)),u&&(n.formatted=Bn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function Sn(e,t,u){let{text:r,options:o}=Nn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await Au(n.ast,o)),u.massage&&(n.ast=En(n.ast,o))),n}async function wn(e,t){t=await se(t);let u=await Ke(e,t);return Ce(u,t)}async function On(e,t){let u=rr(e),{formatted:r}=await Tu(u,{...t,parser:"__js_expression"});return r}async function Pn(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,..._u(u,t)}),Ke(u,t)}async function In(e,t){return Ce(e,await se(t))}var Nu={};Mt(Nu,{builders:()=>wa,printer:()=>Oa,utils:()=>Pa});var wa={join:Pe,line:tt,softline:er,hardline:V,literalline:qe,group:$t,conditionalGroup:Xu,fill:Hu,lineSuffix:ke,lineSuffixBoundary:tr,cursor:ee,breakParent:ce,ifBreak:qu,trim:ur,indent:ae,indentIfBreak:Qu,align:De,addAlignmentToDoc:et,markAsRoot:Ze,dedentToRoot:Gu,dedent:zu,hardlineWithoutBreakParent:Ie,literallineWithoutBreakParent:Vt,label:Zu,concat:e=>e},Oa={printDocToString:Ce},Pa={willBreak:ju,traverseDoc:Se,findInDoc:He,mapDoc:Oe,removeLines:Wu,stripTrailingHardline:Xe,replaceEndOfLine:$u,canBreak:Vu};var kn="3.7.3";var wu={};Mt(wu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>vn,getMaxContinuousCount:()=>Rn,getNextNonSpaceNonCommentCharacter:()=>Ln,getNextNonSpaceNonCommentCharacterIndex:()=>Va,getPreferredQuote:()=>Mn,getStringWidth:()=>ve,hasNewline:()=>G,hasNewlineInRange:()=>Yn,hasSpaces:()=>jn,isNextLineEmpty:()=>Ha,isNextLineEmptyAfterIndex:()=>kt,isPreviousLineEmpty:()=>Ja,makeString:()=>za,skip:()=>ge,skipEverythingButNewLine:()=>nt,skipInlineComment:()=>_e,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>rt,skipTrailingComment:()=>xe,skipWhitespace:()=>fr});function Ia(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var _e=Ia;function ka(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?nt(e,t):t}var xe=ka;function va(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=_e(e,r),r=xe(e,r),r=K(e,r);return r}var Je=va;function Ra(e,t){let u=null,r=t;for(;r!==u;)u=r,r=rt(e,r),r=_e(e,r),r=Y(e,r);return r=xe(e,r),r=K(e,r),r!==!1&&G(e,r)}var kt=Ra;function La(e,t){let u=e.lastIndexOf(`
32
32
  `);return u===-1?0:he(e.slice(u+1).match(/^[\t ]*/u)[0],t)}var vn=La;function Su(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ma(e,t){let u=e.matchAll(new RegExp(`(?:${Su(t)})+`,"gu"));return u.reduce||(u=[...u]),u.reduce((r,[o])=>Math.max(r,o.length),0)/t.length}var Rn=Ma;function Ya(e,t){let u=Je(e,t);return u===!1?"":e.charAt(u)}var Ln=Ya;function ja(e,t){let u=t===!0||t==="'"?"'":'"',r=u==="'"?'"':"'",o=0,n=0;for(let a of e)a===u?o++:a===r&&n++;return o>n?r:u}var Mn=ja;function Ua(e,t,u){for(let r=t;r<u;++r)if(e.charAt(r)===`
33
33
  `)return!0;return!1}var Yn=Ua;function Wa(e,t,u={}){return Y(e,u.backwards?t-1:t,u)!==t}var jn=Wa;function $a(e,t,u){return Je(e,u(t))}function Va(e,t){return arguments.length===2||typeof t=="number"?Je(e,t):$a(...arguments)}function Ka(e,t,u){return Re(e,u(t))}function Ja(e,t){return arguments.length===2||typeof t=="number"?Re(e,t):Ka(...arguments)}function Ga(e,t,u){return kt(e,u(t))}function za(e,t,u){let r=t==='"'?"'":'"',n=oe(0,e,/\\(.)|(["'])/gsu,(a,s,i)=>s===r?s:i===t?"\\"+i:i||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function Ha(e,t){return arguments.length===2||typeof t=="number"?kt(e,t):Ga(...arguments)}function me(e,t=1){return async(...u)=>{let r=u[t]??{},o=r.plugins??[];return u[t]={...r,plugins:Array.isArray(o)?o:Object.values(o)},e(...u)}}var Un=me(Tu);async function Wn(e,t){let{formatted:u}=await Un(e,{...t,cursorOffset:-1});return u}async function Xa(e,t){return await Wn(e,t)===e}var qa=me(it,0),Qa={parse:me(Sn),formatAST:me(wn),formatDoc:me(On),printToDoc:me(Pn),printDocToString:me(In)};return Zn(Za);});
package/standalone.mjs CHANGED
@@ -28,6 +28,6 @@ ${d}`),d}async function pa(e,t){let u=await Ue(t),r=u.preprocess?await u.preproc
28
28
  `&&(d+=Ut(c.slice(0,d),`
29
29
  `)),c=oe(0,c,`
30
30
  `,p)}return{formatted:c,cursorOffset:d,comments:f.comments}}function Bu(e,t,u){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?u:t}function An(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o}=t;return u=Bu(e,u,-1),r=Bu(e,r,0),o=Bu(e,o,e.length),{...t,cursorOffset:u,rangeStart:r,rangeEnd:o}}function Tn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n}=An(e,t),a=e.charAt(0)===xn;if(a&&(e=e.slice(1),u--,r--,o--),n==="auto"&&(n=Iu(e)),e.includes("\r")){let s=i=>Ut(e.slice(0,Math.max(i,0)),`\r
31
- `);u-=s(u),r-=s(r),o-=s(o),e=ku(e)}return{hasBOM:a,text:e,options:An(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function _n(e,t){let u=await Ue(t);return!u.hasPragma||u.hasPragma(e)}async function Na(e,t){return(await Ue(t)).hasIgnorePragma?.(e)}async function Tu(e,t){let{hasBOM:u,text:r,options:o}=Tn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await _n(r,o)||o.checkIgnorePragma&&await Na(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ta(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await _n(r,o)&&(r=o.printer.insertPragma(r)),n=await Bn(r,o)),u&&(n.formatted=xn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function Nn(e,t,u){let{text:r,options:o}=Tn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await Au(n.ast,o)),u.massage&&(n.ast=mn(n.ast,o))),n}async function Sn(e,t){t=await se(t);let u=await Ke(e,t);return Ce(u,t)}async function wn(e,t){let u=ur(e),{formatted:r}=await Tu(u,{...t,parser:"__js_expression"});return r}async function On(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,..._u(u,t)}),Ke(u,t)}async function Pn(e,t){return Ce(e,await se(t))}var Nu={};Mt(Nu,{builders:()=>wa,printer:()=>Oa,utils:()=>Pa});var wa={join:Pe,line:et,softline:Zu,hardline:V,literalline:Xe,group:$t,conditionalGroup:Hu,fill:zu,lineSuffix:ke,lineSuffixBoundary:er,cursor:ee,breakParent:ce,ifBreak:Xu,trim:tr,indent:ae,indentIfBreak:qu,align:De,addAlignmentToDoc:Ze,markAsRoot:Qe,dedentToRoot:Ju,dedent:Gu,hardlineWithoutBreakParent:Ie,literallineWithoutBreakParent:Vt,label:Qu,concat:e=>e},Oa={printDocToString:Ce},Pa={willBreak:Yu,traverseDoc:Se,findInDoc:ze,mapDoc:Oe,removeLines:Uu,stripTrailingHardline:He,replaceEndOfLine:Wu,canBreak:$u};var In="3.7.1";var wu={};Mt(wu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>kn,getMaxContinuousCount:()=>vn,getNextNonSpaceNonCommentCharacter:()=>Rn,getNextNonSpaceNonCommentCharacterIndex:()=>Va,getPreferredQuote:()=>Ln,getStringWidth:()=>ve,hasNewline:()=>G,hasNewlineInRange:()=>Mn,hasSpaces:()=>Yn,isNextLineEmpty:()=>Ha,isNextLineEmptyAfterIndex:()=>It,isPreviousLineEmpty:()=>Ja,makeString:()=>za,skip:()=>ge,skipEverythingButNewLine:()=>rt,skipInlineComment:()=>_e,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>ut,skipTrailingComment:()=>xe,skipWhitespace:()=>cr});function Ia(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var _e=Ia;function ka(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?rt(e,t):t}var xe=ka;function va(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=_e(e,r),r=xe(e,r),r=K(e,r);return r}var Je=va;function Ra(e,t){let u=null,r=t;for(;r!==u;)u=r,r=ut(e,r),r=_e(e,r),r=Y(e,r);return r=xe(e,r),r=K(e,r),r!==!1&&G(e,r)}var It=Ra;function La(e,t){let u=e.lastIndexOf(`
31
+ `);u-=s(u),r-=s(r),o-=s(o),e=ku(e)}return{hasBOM:a,text:e,options:An(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function _n(e,t){let u=await Ue(t);return!u.hasPragma||u.hasPragma(e)}async function Na(e,t){return(await Ue(t)).hasIgnorePragma?.(e)}async function Tu(e,t){let{hasBOM:u,text:r,options:o}=Tn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await _n(r,o)||o.checkIgnorePragma&&await Na(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ta(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await _n(r,o)&&(r=o.printer.insertPragma(r)),n=await Bn(r,o)),u&&(n.formatted=xn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function Nn(e,t,u){let{text:r,options:o}=Tn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await Au(n.ast,o)),u.massage&&(n.ast=mn(n.ast,o))),n}async function Sn(e,t){t=await se(t);let u=await Ke(e,t);return Ce(u,t)}async function wn(e,t){let u=ur(e),{formatted:r}=await Tu(u,{...t,parser:"__js_expression"});return r}async function On(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,..._u(u,t)}),Ke(u,t)}async function Pn(e,t){return Ce(e,await se(t))}var Nu={};Mt(Nu,{builders:()=>wa,printer:()=>Oa,utils:()=>Pa});var wa={join:Pe,line:et,softline:Zu,hardline:V,literalline:Xe,group:$t,conditionalGroup:Hu,fill:zu,lineSuffix:ke,lineSuffixBoundary:er,cursor:ee,breakParent:ce,ifBreak:Xu,trim:tr,indent:ae,indentIfBreak:qu,align:De,addAlignmentToDoc:Ze,markAsRoot:Qe,dedentToRoot:Ju,dedent:Gu,hardlineWithoutBreakParent:Ie,literallineWithoutBreakParent:Vt,label:Qu,concat:e=>e},Oa={printDocToString:Ce},Pa={willBreak:Yu,traverseDoc:Se,findInDoc:ze,mapDoc:Oe,removeLines:Uu,stripTrailingHardline:He,replaceEndOfLine:Wu,canBreak:$u};var In="3.7.3";var wu={};Mt(wu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>kn,getMaxContinuousCount:()=>vn,getNextNonSpaceNonCommentCharacter:()=>Rn,getNextNonSpaceNonCommentCharacterIndex:()=>Va,getPreferredQuote:()=>Ln,getStringWidth:()=>ve,hasNewline:()=>G,hasNewlineInRange:()=>Mn,hasSpaces:()=>Yn,isNextLineEmpty:()=>Ha,isNextLineEmptyAfterIndex:()=>It,isPreviousLineEmpty:()=>Ja,makeString:()=>za,skip:()=>ge,skipEverythingButNewLine:()=>rt,skipInlineComment:()=>_e,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>ut,skipTrailingComment:()=>xe,skipWhitespace:()=>cr});function Ia(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var _e=Ia;function ka(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?rt(e,t):t}var xe=ka;function va(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=_e(e,r),r=xe(e,r),r=K(e,r);return r}var Je=va;function Ra(e,t){let u=null,r=t;for(;r!==u;)u=r,r=ut(e,r),r=_e(e,r),r=Y(e,r);return r=xe(e,r),r=K(e,r),r!==!1&&G(e,r)}var It=Ra;function La(e,t){let u=e.lastIndexOf(`
32
32
  `);return u===-1?0:he(e.slice(u+1).match(/^[\t ]*/u)[0],t)}var kn=La;function Su(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ma(e,t){let u=e.matchAll(new RegExp(`(?:${Su(t)})+`,"gu"));return u.reduce||(u=[...u]),u.reduce((r,[o])=>Math.max(r,o.length),0)/t.length}var vn=Ma;function Ya(e,t){let u=Je(e,t);return u===!1?"":e.charAt(u)}var Rn=Ya;function ja(e,t){let u=t===!0||t==="'"?"'":'"',r=u==="'"?'"':"'",o=0,n=0;for(let a of e)a===u?o++:a===r&&n++;return o>n?r:u}var Ln=ja;function Ua(e,t,u){for(let r=t;r<u;++r)if(e.charAt(r)===`
33
33
  `)return!0;return!1}var Mn=Ua;function Wa(e,t,u={}){return Y(e,u.backwards?t-1:t,u)!==t}var Yn=Wa;function $a(e,t,u){return Je(e,u(t))}function Va(e,t){return arguments.length===2||typeof t=="number"?Je(e,t):$a(...arguments)}function Ka(e,t,u){return Re(e,u(t))}function Ja(e,t){return arguments.length===2||typeof t=="number"?Re(e,t):Ka(...arguments)}function Ga(e,t,u){return It(e,u(t))}function za(e,t,u){let r=t==='"'?"'":'"',n=oe(0,e,/\\(.)|(["'])/gsu,(a,s,i)=>s===r?s:i===t?"\\"+i:i||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function Ha(e,t){return arguments.length===2||typeof t=="number"?It(e,t):Ga(...arguments)}function me(e,t=1){return async(...u)=>{let r=u[t]??{},o=r.plugins??[];return u[t]={...r,plugins:Array.isArray(o)?o:Object.values(o)},e(...u)}}var jn=me(Tu);async function Un(e,t){let{formatted:u}=await jn(e,{...t,cursorOffset:-1});return u}async function Xa(e,t){return await Un(e,t)===e}var qa=me(at,0),Qa={parse:me(Nn),formatAST:me(Sn),formatDoc:me(wn),printToDoc:me(On),printDocToString:me(Pn)};export{Qa as __debug,Xa as check,Wn as default,Nu as doc,Un as format,jn as formatWithCursor,qa as getSupportInfo,wu as util,In as version};