Anvil/assets/formatter-2WMMO6ZP-qIuN5rxr.js

59 lines
210 KiB
JavaScript
Raw Normal View History

2024-07-05 17:21:03 +02:00
var Qi=Object.defineProperty;var Zi=(e,t,r)=>t in e?Qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _e=(e,t,r)=>Zi(e,typeof t!="symbol"?t+"":t,r);import{m as ea}from"./index-DwcZ7YyQ.js";import"./iframe-svkeyQUv.js";import"../sb-preview/runtime.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./tslib.es6-pJfR_DrR.js";import"./index-DYADbu9O.js";import"./index-B4WlZuP_.js";import"./index-DrFu-skq.js";var ta=Object.defineProperty,pu=(e,t)=>{for(var r in t)ta(e,r,{get:t[r],enumerable:!0})},hu=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},se=(e,t,r)=>(hu(e,t,"read from private field"),r?r.call(e):t.get(e)),ra=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},na=(e,t,r,n)=>(hu(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),du={};pu(du,{languages:()=>Vl,options:()=>zl,parsers:()=>Gu,printers:()=>Gl});var ua=(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)},O=ua,Br="string",xr="array",Tr="cursor",Bt="indent",xt="align",Lr="trim",Ye="group",Tt="fill",Lt="if-break",Nt="indent-if-break",Nr="line-suffix",qr="line-suffix-boundary",be="line",Pr="label",qt="break-parent",Du=new Set([Tr,Bt,xt,Lr,Ye,Tt,Lt,Nt,Nr,qr,be,Pr,qt]);function ia(e){if(typeof e=="string")return Br;if(Array.isArray(e))return xr;if(!e)return;let{type:t}=e;if(Du.has(t))return t}var Ir=ia,aa=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function sa(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return`Unexpected doc '${t}',
2024-06-16 17:30:30 +02:00
Expected it to be 'string' or 'object'.`;if(Ir(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=aa([...Du].map(u=>`'${u}'`));return`Unexpected doc.type '${e.type}'.
Expected it to be ${n}.`}var oa=class extends Error{constructor(t){super(sa(t));_e(this,"name","InvalidDocError");this.doc=t}},fu=oa,la=()=>{},ca=la;function we(e){return{type:Bt,contents:e}}function mu(e,t){return{type:xt,contents:t,n:e}}function q(e,t={}){return ca(t.expandedStates),{type:Ye,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function pa(e){return mu(Number.NEGATIVE_INFINITY,e)}function ha(e){return mu({type:"root"},e)}function gu(e){return{type:Tt,parts:e}}function bt(e,t="",r={}){return{type:Lt,breakContents:e,flatContents:t,groupId:r.groupId}}function da(e,t){return{type:Nt,contents:e,groupId:t.groupId,negate:t.negate}}var Ze={type:qt},Da={type:be,hard:!0},fa={type:be,hard:!0,literal:!0},L={type:be},I={type:be,soft:!0},A=[Da,Ze],ma=[fa,Ze];function et(e,t){let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}var ga=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},Pt=ga;function Or(e,t){if(typeof e=="string")return t(e);let r=new Map;return n(e);function n(i){if(r.has(i))return r.get(i);let a=u(i);return r.set(i,a),a}function u(i){switch(Ir(i)){case xr:return t(i.map(n));case Tt:return t({...i,parts:i.parts.map(n)});case Lt:return t({...i,breakContents:n(i.breakContents),flatContents:n(i.flatContents)});case Ye:{let{expandedStates:a,contents:s}=i;return a?(a=a.map(n),s=a[0]):s=n(s),t({...i,contents:s,expandedStates:a})}case xt:case Bt:case Nt:case Pr:case Nr:return t({...i,contents:n(i.contents)});case Br:case Tr:case Lr:case qr:case be:case qt:return t(i);default:throw new fu(i)}}}function Ca(e){switch(Ir(e)){case Tt:if(e.parts.every(t=>t===""))return"";break;case Ye:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return"";if(e.contents.type===Ye&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case xt:case Bt:case Nt:case Nr:if(!e.contents)return"";break;case Lt:if(!e.flatContents&&!e.breakContents)return"";break;case xr:{let t=[];for(let r of e){if(!r)continue;let[n,...u]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof Pt(!1,t,-1)=="string"?t[t.length-1]+=n:t.push(n),t.push(...u)}return t.length===0?"":t.length===1?t[0]:t}case Br:case Tr:case Lr:case qr:case be:case Pr:case qt:break;default:throw new fu(e)}return e}function Fa(e){return Or(e,t=>Ca(t))}function G(e,t=ma){return Or(e,r=>typeof r=="string"?et(t,r.split(`
`)):r)}var va=class extends Error{constructor(t,r,n="type"){super(`Unexpected ${r} node ${n}: ${JSON.stringify(t[n])}.`);_e(this,"name","UnexpectedNodeError");this.node=t}},ya=va,lt="'",cn='"';function Ea(e,t){let r=t===!0||t===lt?lt:cn,n=r===lt?cn:lt,u=0,i=0;for(let a of e)a===r?u++:a===n&&i++;return u>i?n:r}var ba=Ea;function wa(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var U,Sa=class{constructor(e){ra(this,U,void 0),na(this,U,new Set(e))}getLeadingWhitespaceCount(e){let t=se(this,U),r=0;for(let n=0;n<e.length&&t.has(e.charAt(n));n++)r++;return r}getTrailingWhitespaceCount(e){let t=se(this,U),r=0;for(let n=e.length-1;n>=0&&t.has(e.charAt(n));n--)r++;return r}getLeadingWhitespace(e){let t=this.getLeadingWhitespaceCount(e);return e.slice(0,t)}getTrailingWhitespace(e){let t=this.getTrailingWhitespaceCount(e);return e.slice(e.length-t)}hasLeadingWhitespace(e){return se(this,U).has(e.charAt(0))}hasTrailingWhitespace(e){return se(this,U).has(Pt(!1,e,-1))}trimStart(e){let t=this.getLeadingWhitespaceCount(e);return e.slice(t)}trimEnd(e){let t=this.getTrailingWhitespaceCount(e);return e.slice(0,e.length-t)}trim(e){return this.trimEnd(this.trimStart(e))}split(e,t=!1){let r=`[${wa([...se(this,U)].join(""))}]+`,n=new RegExp(t?`(${r})`:r);return e.split(n)}hasWhitespaceCharacter(e){let t=se(this,U);return Array.prototype.some.call(e,r=>t.has(r))}hasNonWhitespaceCharacter(e){let t=se(this,U);return Array.prototype.some.call(e,r=>!t.has(r))}isWhitespaceOnly(e){let t=se(this,U);return Array.prototype.every.call(e,r=>t.has(r))}};U=new WeakMap;var Aa=Sa,ka=[" ",`
`,"\f","\r"," "],_a=new Aa(ka),ce=_a;function Ba(e){return(e==null?void 0:e.type)==="front-matter"}var It=Ba,xa=new Set(["sourceSpan","startSourceSpan","endSourceSpan","nameSpan","valueSpan","keySpan","tagDefinition","tokens","valueTokens"]),Ta=new Set(["if","else if","for","switch","case"]);function Cu(e,t){var r;if(e.type==="text"||e.type==="comment"||It(e)||e.type==="yaml"||e.type==="toml")return null;if(e.type==="attribute"&&delete t.value,e.type==="docType"&&delete t.value,e.type==="angularControlFlowBlock"&&(r=t.parameters)!=null&&r.children)for(let n of t.parameters.children)Ta.has(e.name)?delete n.expression:n.expression=n.expression.trim()}Cu.ignoredProperties=xa;var La=Cu,Na=e=>String(e).split(/[/\\]/).pop();function pn(e,t){if(!t)return;let r=Na(t).toLowerCase();return e.find(n=>{var u,i;return((u=n.extensions)==null?void 0:u.some(a=>r.endsWith(a)))||((i=n.filenames)==null?void 0:i.some(a=>a.toLowerCase()===r))})}function qa(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 Pa(e,t){let r=e.plugins.flatMap(u=>u.languages??[]),n=qa(r,t.language)??pn(r,t.physicalFile)??pn(r,t.file)??(t.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var Ot=Pa,Ia="inline",Oa={area:"none",base:"none",basefont:"none",datalist:"none",head:"none",link:"none",meta:"none",noembed:"none",noframes:"none",param:"block",rp:"none",script:"block",style:"none",template:"inline",title:"none",html:"block",body:"block",address:"block",blockquote:"block",center:"block",dialog:"block",div:"block",figure:"block",figcaption:"block",footer:"block",form:"block",header:"block",hr:"block",legend:"block",listing:"block",main:"block",p:"block",plaintext:"block",pre:"block",search:"block",xmp:"block",slot:"contents",ruby:"ruby",rt:"ruby-text",article:"block",aside:"block",h1:"block",h2:"block",h3:"block",h4:"block",h5:"block",h6:"block",hgroup:"block",nav:"block",section:"block",dir:"block",dd:"block",dl:"block",dt:"block",menu:"block",ol:"block",ul:"block",li:"list-item",table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell",input:"inline-block",button:"inline-block",fieldset:"block",marquee:"inline-block",source:"block",track:"block",details:"block",summary:"block",meter:"inline-block",progress:"inline-block",object:"inline-block",video:"inline-block",audio:"inline-block",select:"inline-block",option:"block",optgroup:"block"},Ma="normal",Ra={listing:"pre",plaintext:"pre",pre:"pre",xmp:"pre",nobr:"nowrap",table:"initial",textarea:"pre-wrap"};function Ha(e){return e.type==="element"&&!e.hasExplicitNamespace&&!["html","svg"].includes(e.namespace)}var Xe=Ha,ja=e=>O(!1,e,/^[\t\f\r ]*\n/g,""),Fu=e=>ja(ce.trimEnd(e)),$a=e=>{let t=e,r=ce.getLeadingWhitespace(t);r&&(t=t.slice(r.length));let n=ce.getTrailingWhitespace(t);return n&&(t=t.slice(0,-n.length)),{leadingWhitespace:r,trailingWhitespace:n,text:t}};function vu(e,t){return!!(e.type==="ieConditionalComment"&&e.lastChild&&!e.lastChild.isSelfClosing&&!e.lastChild.endSourceSpan||e.type==="ieConditionalComment"&&!e.complete||Pe(e)&&e.children.some(r=>r.type!=="text"&&r.type!=="interpolation")||Hr(e,t)&&!ee(e)&&e.type!=="interpolation")}function Mr(e){return e.type==="attribute"||!e.parent||!e.prev?!1:Wa(e.prev)}function Wa(e){return e.type==="comment"&&e.value.trim()==="prettier-ignore"}function H(e){return e.type==="text"||e.type==="comment"}function ee(e){return e.type==="element"&&(e.fullName==="script"||e.fullName==="style"||e.fullName==="svg:style"||e.fullName==="svg:script"||Xe(e)&&(e.name==="script"||e.name==="style"))}function Va(e){return e.children&&!ee(e)}function Ua(e){return ee(e)||e.type==="interpolation"||yu(e)}function yu(e){return _u(e).startsWith("pre")}function za(e,t){var r,n;let u=i();if(u&&!e.prev&&(n=(r=e.parent)==null?void 0:r.tagDefinition)!=null&&n.ignoreFirstLf)return e.type==="interpolation";ret
`)){if(r.length===0)continue;let n=ce.getLeadingWhitespaceCount(r);if(n===0)return 0;r.length!==n&&n<t&&(t=n)}return t===Number.POSITIVE_INFINITY?0:t}function Bu(e,t=os(e)){return t===0?e:e.split(`
`).map(r=>r.slice(t)).join(`
`)}function xu(e){return O(!1,O(!1,e,"&apos;","'"),"&quot;",'"')}function de(e){return xu(e.value)}var ls=new Set(["template","style","script"]);function Mt(e,t){return Me(e,t)&&!ls.has(e.fullName)}function Me(e,t){return t.parser==="vue"&&e.type==="element"&&e.parent.type==="root"&&e.fullName.toLowerCase()!=="html"}function Hr(e,t){return Me(e,t)&&(Mt(e,t)||e.attrMap.lang&&e.attrMap.lang!=="html")}function cs(e){let t=e.fullName;return t.charAt(0)==="#"||t==="slot-scope"||t==="v-slot"||t.startsWith("v-slot:")}function ps(e,t){let r=e.parent;if(!Me(r,t))return!1;let n=r.fullName,u=e.fullName;return n==="script"&&u==="setup"||n==="style"&&u==="vars"}function Tu(e,t=e.value){return e.parent.isWhitespaceSensitive?e.parent.isIndentationSensitive?G(t):G(Bu(Fu(t)),A):et(L,ce.split(t))}function Lu(e,t){return Me(e,t)&&e.name==="script"}function jr(e){return e>=9&&e<=32||e==160}function Nu(e){return 48<=e&&e<=57}function $r(e){return e>=97&&e<=122||e>=65&&e<=90}function hs(e){return e>=97&&e<=102||e>=65&&e<=70||Nu(e)}function qu(e){return e===10||e===13}function dn(e){return 48<=e&&e<=55}function Dn(e){return e===39||e===34||e===96}var ds=/-+([a-z0-9])/g;function Ds(e){return e.replace(ds,(...t)=>t[1].toUpperCase())}var fr=class Pu{constructor(t,r,n,u){this.file=t,this.offset=r,this.line=n,this.col=u}toString(){return this.offset!=null?`${this.file.url}@${this.line}:${this.col}`:this.file.url}moveBy(t){let r=this.file.content,n=r.length,u=this.offset,i=this.line,a=this.col;for(;u>0&&t<0;)if(u--,t++,r.charCodeAt(u)==10){i--;let s=r.substring(0,u-1).lastIndexOf(`
`);a=s>0?u-s:u}else a--;for(;u<n&&t>0;){let s=r.charCodeAt(u);u++,t--,s==10?(i++,a=0):a++}return new Pu(this.file,u,i,a)}getContext(t,r){let n=this.file.content,u=this.offset;if(u!=null){u>n.length-1&&(u=n.length-1);let i=u,a=0,s=0;for(;a<t&&u>0&&(u--,a++,!(n[u]==`
`&&++s==r)););for(a=0,s=0;a<t&&i<n.length-1&&(i++,a++,!(n[i]==`
`&&++s==r)););return{before:n.substring(u,this.offset),after:n.substring(this.offset,i+1)}}return null}},Iu=class{constructor(e,t){this.content=e,this.url=t}},b=class{constructor(e,t,r=e,n=null){this.start=e,this.end=t,this.fullStart=r,this.details=n}toString(){return this.start.file.content.substring(this.start.offset,this.end.offset)}},wt;(function(e){e[e.WARNING=0]="WARNING",e[e.ERROR=1]="ERROR"})(wt||(wt={}));var Ou=class{constructor(e,t,r=wt.ERROR){this.span=e,this.msg=t,this.level=r}contextualMessage(){let e=this.span.start.getContext(100,3);return e?`${this.msg} ("${e.before}[${wt[this.level]} ->]${e.after}")`:this.msg}toString(){let e=this.span.details?`, ${this.span.details}`:"";return`${this.contextualMessage()}: ${this.span.start}${e}`}},fs=[gs,Cs,vs,Es,bs,As,ws,Ss,ks,ys];function ms(e,t){for(let r of fs)r(e,t);return e}function gs(e){e.walk(t=>{if(t.type==="element"&&t.tagDefinition.ignoreFirstLf&&t.children.length>0&&t.children[0].type==="text"&&t.children[0].value[0]===`
`){let r=t.children[0];r.value.length===1?t.removeChild(r):r.value=r.value.slice(1)}})}function Cs(e){let t=r=>{var n,u;return r.type==="element"&&((n=r.prev)==null?void 0:n.type)==="ieConditionalStartComment"&&r.prev.sourceSpan.end.offset===r.startSourceSpan.start.offset&&((u=r.firstChild)==null?void 0:u.type)==="ieConditionalEndComment"&&r.firstChild.sourceSpan.start.offset===r.startSourceSpan.end.offset};e.walk(r=>{if(r.children)for(let n=0;n<r.children.length;n++){let u=r.children[n];if(!t(u))continue;let i=u.prev,a=u.firstChild;r.removeChild(i),n--;let s=new b(i.sourceSpan.start,a.sourceSpan.end),o=new b(s.start,u.sourceSpan.end);u.condition=i.condition,u.sourceSpan=o,u.startSourceSpan=s,u.removeChild(a)}})}function Fs(e,t,r){e.walk(n=>{if(n.children)for(let u=0;u<n.children.length;u++){let i=n.children[u];if(i.type!=="text"&&!t(i))continue;i.type!=="text"&&(i.type="text",i.value=r(i));let a=i.prev;!a||a.type!=="text"||(a.value+=i.value,a.sourceSpan=new b(a.sourceSpan.start,i.sourceSpan.end),n.removeChild(i),u--)}})}function vs(e){return Fs(e,t=>t.type==="cdata",t=>`<![CDATA[${t.value}]]>`)}function ys(e){let t=r=>{var n,u;return r.type==="element"&&r.attrs.length===0&&r.children.length===1&&r.firstChild.type==="text"&&!ce.hasWhitespaceCharacter(r.children[0].value)&&!r.firstChild.hasLeadingSpaces&&!r.firstChild.hasTrailingSpaces&&r.isLeadingSpaceSensitive&&!r.hasLeadingSpaces&&r.isTrailingSpaceSensitive&&!r.hasTrailingSpaces&&((n=r.prev)==null?void 0:n.type)==="text"&&((u=r.next)==null?void 0:u.type)==="text"};e.walk(r=>{if(r.children)for(let n=0;n<r.children.length;n++){let u=r.children[n];if(!t(u))continue;let i=u.prev,a=u.next;i.value+=`<${u.rawName}>`+u.firstChild.value+`</${u.rawName}>`+a.value,i.sourceSpan=new b(i.sourceSpan.start,a.sourceSpan.end),i.isTrailingSpaceSensitive=a.isTrailingSpaceSensitive,i.hasTrailingSpaces=a.hasTrailingSpaces,r.removeChild(u),n--,r.removeChild(a)}})}function Es(e,t){if(t.parser==="html")return;let r=/{{(.+?)}}/s;e.walk(n=>{if(Va(n))for(let u of n.children){if(u.type!=="text")continue;let i=u.sourceSpan.start,a=null,s=u.value.split(r);for(let o=0;o<s.length;o++,i=a){let l=s[o];if(o%2===0){a=i.moveBy(l.length),l.length>0&&n.insertChildBefore(u,{type:"text",value:l,sourceSpan:new b(i,a)});continue}a=i.moveBy(l.length+4),n.insertChildBefore(u,{type:"interpolation",sourceSpan:new b(i,a),children:l.length===0?[]:[{type:"text",value:l,sourceSpan:new b(i.moveBy(2),a.moveBy(-2))}]})}n.removeChild(u)}})}function bs(e){e.walk(t=>{if(!t.children)return;if(t.children.length===0||t.children.length===1&&t.children[0].type==="text"&&ce.trim(t.children[0].value).length===0){t.hasDanglingSpaces=t.children.length>0,t.children=[];return}let r=Ua(t),n=yu(t);if(!r)for(let u=0;u<t.children.length;u++){let i=t.children[u];if(i.type!=="text")continue;let{leadingWhitespace:a,text:s,trailingWhitespace:o}=$a(i.value),l=i.prev,c=i.next;s?(i.value=s,i.sourceSpan=new b(i.sourceSpan.start.moveBy(a.length),i.sourceSpan.end.moveBy(-o.length)),a&&(l&&(l.hasTrailingSpaces=!0),i.hasLeadingSpaces=!0),o&&(i.hasTrailingSpaces=!0,c&&(c.hasLeadingSpaces=!0))):(t.removeChild(i),u--,(a||o)&&(l&&(l.hasTrailingSpaces=!0),c&&(c.hasLeadingSpaces=!0)))}t.isWhitespaceSensitive=r,t.isIndentationSensitive=n})}function ws(e){e.walk(t=>{t.isSelfClosing=!t.children||t.type==="element"&&(t.tagDefinition.isVoid||t.endSourceSpan&&t.startSourceSpan.start===t.endSourceSpan.start&&t.startSourceSpan.end===t.endSourceSpan.end)})}function Ss(e,t){e.walk(r=>{r.type==="element"&&(r.hasHtmComponentClosingTag=r.endSourceSpan&&/^<\s*\/\s*\/\s*>$/.test(t.originalText.slice(r.endSourceSpan.start.offset,r.endSourceSpan.end.offset)))})}function As(e,t){e.walk(r=>{r.cssDisplay=ss(r,t)})}function ks(e,t){e.walk(r=>{let{children:n}=r;if(n){if(n.length===0){r.isDanglingSpaceSensitive=Ka(r);return}for(let u of n)u.isLeadingSpaceSensitive=za(u,t),u.isTrailingSpaceSensitive=Ga(u,t);for(let u=0;u<n.length;u++){let i=n[u];i.isLeadingSpaceSensitive=(u===0||i.prev.isTrailingSpaceSensitive)&&i.isLeadingSpaceSensitive,i.isTrailingSpaceSensitive=(u===n.length-1|
`+e}function Rt(e){return e.sourceSpan.start.offset}function Ht(e){return e.sourceSpan.end.offset}async function Ts(e,t){if(e.lang==="yaml"){let r=e.value.trim(),n=r?await t(r,{parser:"yaml"}):"";return ha([e.startDelimiter,A,n,n?A:"",e.endDelimiter])}}var Ls=Ts,Mu=new Proxy(()=>{},{get:()=>Mu}),Ru=Mu;function Ns(e){return Array.isArray(e)&&e.length>0}var Hu=Ns;function mr(e,t){return[e.isSelfClosing?"":qs(e,t),ft(e,t)]}function qs(e,t){return e.lastChild&&Qe(e.lastChild)?"":[Ps(e,t),Wr(e,t)]}function ft(e,t){return(e.next?ve(e.next):nt(e.parent))?"":[rt(e,t),Fe(e,t)]}function Ps(e,t){return nt(e)?rt(e.lastChild,t):""}function Fe(e,t){return Qe(e)?Wr(e.parent,t):jt(e)?Vr(e.next):""}function Wr(e,t){if(Ru(!e.isSelfClosing),ju(e,t))return"";switch(e.type){case"ieConditionalComment":return"<!";case"element":if(e.hasHtmComponentClosingTag)return"<//";default:return`</${e.rawName}`}}function rt(e,t){if(ju(e,t))return"";switch(e.type){case"ieConditionalComment":case"ieConditionalEndComment":return"[endif]-->";case"ieConditionalStartComment":return"]><!-->";case"interpolation":return"}}";case"element":if(e.isSelfClosing)return"/>";default:return">"}}function ju(e,t){return!e.isSelfClosing&&!e.endSourceSpan&&(Mr(e)||vu(e.parent,t))}function ve(e){return e.prev&&e.prev.type!=="docType"&&e.type!=="angularControlFlowBlock"&&!H(e.prev)&&e.isLeadingSpaceSensitive&&!e.hasLeadingSpaces}function nt(e){var t;return((t=e.lastChild)==null?void 0:t.isTrailingSpaceSensitive)&&!e.lastChild.hasTrailingSpaces&&!H(Rr(e.lastChild))&&!Pe(e)}function Qe(e){return!e.next&&!e.hasTrailingSpaces&&e.isTrailingSpaceSensitive&&H(Rr(e))}function jt(e){return e.next&&!H(e.next)&&H(e)&&e.isTrailingSpaceSensitive&&!e.hasTrailingSpaces}function Is(e){let t=e.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/s);return t?t[1]?t[1].split(/\s+/):!0:!1}function $t(e){return!e.prev&&e.isLeadingSpaceSensitive&&!e.hasLeadingSpaces}function Os(e,t,r){var n;let{node:u}=e;if(!Hu(u.attrs))return u.isSelfClosing?" ":"";let i=((n=u.prev)==null?void 0:n.type)==="comment"&&Is(u.prev.value),a=typeof i=="boolean"?()=>i:Array.isArray(i)?D=>i.includes(D.rawName):()=>!1,s=e.map(({node:D})=>a(D)?G(t.originalText.slice(Rt(D),Ht(D))):r(),"attrs"),o=u.type==="element"&&u.fullName==="script"&&u.attrs.length===1&&u.attrs[0].fullName==="src"&&u.children.length===0,l=t.singleAttributePerLine&&u.attrs.length>1&&!Me(u,t)?A:L,c=[we([o?" ":L,et(l,s)])];return u.firstChild&&$t(u.firstChild)||u.isSelfClosing&&nt(u.parent)||o?c.push(u.isSelfClosing?" ":""):c.push(t.bracketSameLine?u.isSelfClosing?" ":"":u.isSelfClosing?L:I),c}function Ms(e){return e.firstChild&&$t(e.firstChild)?"":Ur(e)}function gr(e,t,r){let{node:n}=e;return[mt(n,t),Os(e,t,r),n.isSelfClosing?"":Ms(n)]}function mt(e,t){return e.prev&&jt(e.prev)?"":[ye(e,t),Vr(e)]}function ye(e,t){return $t(e)?Ur(e.parent):ve(e)?rt(e.prev,t):""}function Vr(e){switch(e.type){case"ieConditionalComment":case"ieConditionalStartComment":return`<!--[if ${e.condition}`;case"ieConditionalEndComment":return"<!--<!";case"interpolation":return"{{";case"docType":return e.value==="html"?"<!doctype":"<!DOCTYPE";case"element":if(e.condition)return`<!--[if ${e.condition}]><!--><${e.rawName}`;default:return`<${e.rawName}`}}function Ur(e){switch(Ru(!e.isSelfClosing),e.type){case"ieConditionalComment":return"]>";case"element":if(e.condition)return"><!--<![endif]-->";default:return">"}}var ur=new WeakMap;function Rs(e,t){let{root:r}=e;return ur.has(r)||ur.set(r,r.children.some(n=>Lu(n,t)&&["ts","typescript"].includes(n.attrMap.lang))),ur.get(r)}var zr=Rs;function Hs(e,t){if(!e.endSourceSpan)return"";let r=e.startSourceSpan.end.offset;e.firstChild&&$t(e.firstChild)&&(r-=Ur(e).length);let n=e.endSourceSpan.start.offset;return e.lastChild&&Qe(e.lastChild)?n+=Wr(e,t).length:nt(e)&&(n-=rt(e.lastChild,t).length),t.originalText.slice(r,n)}var $u=Hs;function fn(e){return e===" "||e===`
`||e==="\f"||e==="\r"||e===" "}var js=/^[ \t\n\r\u000c]+/,$s=/^[, \t\n\r\u000c]+/,Ws=/^[^ \t\n\r\u000c]+/,Vs=/[,]+$/,mn=/^\d+$/,Us=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;function zs(e){let t=e.length,r,n,u,i,a,s=0,o;function l(h){let d,m=h.exec(e.substring(s));if(m)return[d]=m,s+=d.length,d}let c=[];for(;;){if(l($s),s>=t){if(c.length===0)throw new Error("Must contain one or more image candidate strings.");return c}o=s,r=l(Ws),n=[],r.slice(-1)===","?(r=r.replace(Vs,""),p()):D()}function D(){for(l(js),u="",i="in descriptor";;){if(a=e.charAt(s),i==="in descriptor")if(fn(a))u&&(n.push(u),u="",i="after descriptor");else if(a===","){s+=1,u&&n.push(u),p();return}else if(a==="(")u+=a,i="in parens";else if(a===""){u&&n.push(u),p();return}else u+=a;else if(i==="in parens")if(a===")")u+=a,i="in descriptor";else if(a===""){n.push(u),p();return}else u+=a;else if(i==="after descriptor"&&!fn(a))if(a===""){p();return}else i="in descriptor",s-=1;s+=1}}function p(){let h=!1,d,m,g,F,f={},C,y,v,w,S;for(F=0;F<n.length;F++)C=n[F],y=C[C.length-1],v=C.substring(0,C.length-1),w=parseInt(v,10),S=parseFloat(v),mn.test(v)&&y==="w"?((d||m)&&(h=!0),w===0?h=!0:d=w):Us.test(v)&&y==="x"?((d||m||g)&&(h=!0),S<0?h=!0:m=S):mn.test(v)&&y==="h"?((g||m)&&(h=!0),w===0?h=!0:g=w):h=!0;if(!h)f.source={value:r,startOffset:o},d&&(f.width={value:d}),m&&(f.density={value:m}),g&&(f.height={value:g}),c.push(f);else throw new Error(`Invalid srcset descriptor found in "${e}" at "${C}".`)}}var Gs=zs;function Wt(e,t=!0){return[we([I,e]),t?I:""]}function Re(e,t){let r=e.type==="NGRoot"?e.node.type==="NGMicrosyntax"&&e.node.body.length===1&&e.node.body[0].type==="NGMicrosyntaxExpression"?e.node.body[0].expression:e.node:e.type==="JsExpressionRoot"?e.node:e;return r&&(r.type==="ObjectExpression"||r.type==="ArrayExpression"||(t.parser==="__vue_expression"||t.parser==="__vue_ts_expression")&&(r.type==="TemplateLiteral"||r.type==="StringLiteral"))}async function X(e,t,r,n){r={__isInHtmlAttribute:!0,__embeddedInHtml:!0,...r};let u=!0;n&&(r.__onHtmlBindingRoot=(a,s)=>{u=n(a,s)});let i=await t(e,r,t);return u?q(i):Wt(i)}function Ks(e){if(e.node.fullName==="srcset"&&(e.parent.fullName==="img"||e.parent.fullName==="source"))return()=>Ys(de(e.node))}var Wu={width:"w",height:"h",density:"x"},Js=Object.keys(Wu);function Ys(e){let t=Gs(e),r=Js.filter(c=>t.some(D=>Object.prototype.hasOwnProperty.call(D,c)));if(r.length>1)throw new Error("Mixed descriptor in srcset is not supported");let[n]=r,u=Wu[n],i=t.map(c=>c.source.value),a=Math.max(...i.map(c=>c.length)),s=t.map(c=>c[n]?String(c[n].value):""),o=s.map(c=>{let D=c.indexOf(".");return D===-1?c.length:D}),l=Math.max(...o);return Wt(et([",",L],i.map((c,D)=>{let p=[c],h=s[D];if(h){let d=a-c.length+1,m=l-o[D],g=" ".repeat(d+m);p.push(bt(g," "),h+u)}return p})))}var Xs=Ks;function Qs(e,t){let{node:r}=e,n=de(r);if(r.fullName==="class"&&!t.parentParser&&!n.includes("{{"))return()=>n.trim().split(/\s+/).join(" ")}var Zs=Qs;function eo(e,t){let{node:r}=e,n=de(e.node).trim();if(r.fullName==="style"&&!t.parentParser&&!n.includes("{{"))return async u=>Wt(await u(n,{parser:"css",__isHTMLStyleAttribute:!0}))}async function to(e,t,r,n){let u=de(r.node),{left:i,operator:a,right:s}=ro(u),o=zr(r,n);return[q(await X(`function _(${i}) {}`,e,{parser:o?"babel-ts":"babel",__isVueForBindingLeft:!0}))," ",a," ",await X(s,e,{parser:o?"__ts_expression":"__js_expression"})]}function ro(e){let t=/(.*?)\s+(in|of)\s+(.*)/s,r=/,([^,\]}]*)(?:,([^,\]}]*))?$/,n=/^\(|\)$/g,u=e.match(t);if(!u)return;let i={};if(i.for=u[3].trim(),!i.for)return;let a=O(!1,u[1].trim(),n,""),s=a.match(r);s?(i.alias=a.replace(r,""),i.iterator1=s[1].trim(),s[2]&&(i.iterator2=s[2].trim())):i.alias=a;let o=[i.alias,i.iterator1,i.iterator2];if(!o.some((l,c)=>!l&&(c===0||o.slice(c+1).some(Boolean))))return{left:o.filter(Boolean).join(","),operator:u[2],right:i.for}}function no(e,t,r){let{node:n}=r,u=de(n);return X(`type T<${u}> = any`,e,{parser:"babel-ts",__isEmbeddedTypescriptGenericParameters:!0},Re)}function uo(e,t,{parseWithTs:r}){return X(`function _(${e}) {}`,t,{parser:r?"babel-ts
If '${e}' is a directive input, make sure the directive is imported by the current module.`}:{error:!1}}validateAttribute(e){return e.toLowerCase().startsWith("on")?{error:!0,msg:`Binding to event attribute '${e}' is disallowed for security reasons, please use (${e.slice(2)})=...`}:{error:!1}}allKnownElementNames(){return Array.from(this._schema.keys())}allKnownAttributesOfElement(e){let t=this._schema.get(e.toLowerCase())||this._schema.get("unknown");return Array.from(t.keys()).map(r=>Go.get(r)??r)}allKnownEventsOfElement(e){return Array.from(this._eventSchema.get(e.toLowerCase())??[])}normalizeAnimationStyleProperty(e){return Ds(e)}normalizeAnimationStyleValue(e,t,r){let n="",u=r.toString().trim(),i=null;if(Jo(e)&&r!==0&&r!=="0")if(typeof r=="number")n="px";else{let a=r.match(/^[+-]?[\d\.]+([a-z]*)$/);a&&a[1].length==0&&(i=`Please provide a CSS unit value for ${t}:${r}`)}return{error:i,value:u+n}}};function Jo(e){switch(e){case"width":case"height":case"minWidth":case"minHeight":case"maxWidth":case"maxHeight":case"left":case"top":case"bottom":case"right":case"fontSize":case"outlineWidth":case"outlineOffset":case"paddingTop":case"paddingLeft":case"paddingBottom":case"paddingRight":case"marginTop":case"marginLeft":case"marginBottom":case"marginRight":case"borderRadius":case"borderWidth":case"borderTopWidth":case"borderLeftWidth":case"borderRightWidth":case"borderBottomWidth":case"textIndent":return!0;default:return!1}}var E=class{constructor({closedByChildren:e,implicitNamespacePrefix:t,contentType:r=z.PARSABLE_DATA,closedByParent:n=!1,isVoid:u=!1,ignoreFirstLf:i=!1,preventNamespaceInheritance:a=!1,canSelfClose:s=!1}={}){this.closedByChildren={},this.closedByParent=!1,e&&e.length>0&&e.forEach(o=>this.closedByChildren[o]=!0),this.isVoid=u,this.closedByParent=n||u,this.implicitNamespacePrefix=t||null,this.contentType=r,this.ignoreFirstLf=i,this.preventNamespaceInheritance=a,this.canSelfClose=s??u}isClosedByChild(e){return this.isVoid||e.toLowerCase()in this.closedByChildren}getContentType(e){return typeof this.contentType=="object"?(e===void 0?void 0:this.contentType[e])??this.contentType.default:this.contentType}},Sn,We;function Cr(e){return We||(Sn=new E({canSelfClose:!0}),We=Object.assign(Object.create(null),{base:new E({isVoid:!0}),meta:new E({isVoid:!0}),area:new E({isVoid:!0}),embed:new E({isVoid:!0}),link:new E({isVoid:!0}),img:new E({isVoid:!0}),input:new E({isVoid:!0}),param:new E({isVoid:!0}),hr:new E({isVoid:!0}),br:new E({isVoid:!0}),source:new E({isVoid:!0}),track:new E({isVoid:!0}),wbr:new E({isVoid:!0}),p:new E({closedByChildren:["address","article","aside","blockquote","div","dl","fieldset","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","nav","ol","p","pre","section","table","ul"],closedByParent:!0}),thead:new E({closedByChildren:["tbody","tfoot"]}),tbody:new E({closedByChildren:["tbody","tfoot"],closedByParent:!0}),tfoot:new E({closedByChildren:["tbody"],closedByParent:!0}),tr:new E({closedByChildren:["tr"],closedByParent:!0}),td:new E({closedByChildren:["td","th"],closedByParent:!0}),th:new E({closedByChildren:["td","th"],closedByParent:!0}),col:new E({isVoid:!0}),svg:new E({implicitNamespacePrefix:"svg"}),foreignObject:new E({implicitNamespacePrefix:"svg",preventNamespaceInheritance:!0}),math:new E({implicitNamespacePrefix:"math"}),li:new E({closedByChildren:["li"],closedByParent:!0}),dt:new E({closedByChildren:["dt","dd"]}),dd:new E({closedByChildren:["dt","dd"],closedByParent:!0}),rb:new E({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rt:new E({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),rtc:new E({closedByChildren:["rb","rtc","rp"],closedByParent:!0}),rp:new E({closedByChildren:["rb","rt","rtc","rp"],closedByParent:!0}),optgroup:new E({closedByChildren:["optgroup"],closedByParent:!0}),option:new E({closedByChildren:["option","optgroup"],closedByParent:!0}),pre:new E({ignoreFirstLf:!0}),listing:new E({ignoreFirstLf:!0}),style:new E({contentType:z.RAW_TEXT}),script:new E({contentType:z.RAW_TEXT}),title:new E({contentType:{default:z.ESCAPABLE_RA
`,Nfr:"𝔑",NoBreak:"",NonBreakingSpace:" ",nbsp:" ",Nopf:"",naturals:"",Not:"⫬",NotCongruent:"≢",nequiv:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",npar:"∦",nparallel:"∦",nshortparallel:"∦",nspar:"∦",NotElement:"∉",notin:"∉",notinva:"∉",NotEqual:"≠",ne:"≠",NotEqualTilde:"≂̸",nesim:"≂̸",NotExists:"∄",nexist:"∄",nexists:"∄",NotGreater:"≯",ngt:"≯",ngtr:"≯",NotGreaterEqual:"≱",nge:"≱",ngeq:"≱",NotGreaterFullEqual:"≧̸",ngE:"≧̸",ngeqq:"≧̸",NotGreaterGreater:"≫̸",nGtv:"≫̸",NotGreaterLess:"≹",ntgl:"≹",NotGreaterSlantEqual:"⩾̸",ngeqslant:"⩾̸",nges:"⩾̸",NotGreaterTilde:"≵",ngsim:"≵",NotHumpDownHump:"≎̸",nbump:"≎̸",NotHumpEqual:"≏̸",nbumpe:"≏̸",NotLeftTriangle:"⋪",nltri:"⋪",ntriangleleft:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",nltrie:"⋬",ntrianglelefteq:"⋬",NotLess:"≮",nless:"≮",nlt:"≮",NotLessEqual:"≰",nle:"≰",nleq:"≰",NotLessGreater:"≸",ntlg:"≸",NotLessLess:"≪̸",nLtv:"≪̸",NotLessSlantEqual:"⩽̸",nleqslant:"⩽̸",nles:"⩽̸",NotLessTilde:"≴",nlsim:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",NotPrecedes:"⊀",npr:"⊀",nprec:"⊀",NotPrecedesEqual:"⪯̸",npre:"⪯̸",npreceq:"⪯̸",NotPrecedesSlantEqual:"⋠",nprcue:"⋠",NotReverseElement:"∌",notni:"∌",notniva:"∌",NotRightTriangle:"⋫",nrtri:"⋫",ntriangleright:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",nrtrie:"⋭",ntrianglerighteq:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",nsqsube:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",nsqsupe:"⋣",NotSubset:"⊂⃒",nsubset:"⊂⃒",vnsub:"⊂⃒",NotSubsetEqual:"⊈",nsube:"⊈",nsubseteq:"⊈",NotSucceeds:"⊁",nsc:"⊁",nsucc:"⊁",NotSucceedsEqual:"⪰̸",nsce:"⪰̸",nsucceq:"⪰̸",NotSucceedsSlantEqual:"⋡",nsccue:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",nsupset:"⊃⃒",vnsup:"⊃⃒",NotSupersetEqual:"⊉",nsupe:"⊉",nsupseteq:"⊉",NotTilde:"≁",nsim:"≁",NotTildeEqual:"≄",nsime:"≄",nsimeq:"≄",NotTildeFullEqual:"≇",ncong:"≇",NotTildeTilde:"≉",nap:"≉",napprox:"≉",NotVerticalBar:"∤",nmid:"∤",nshortmid:"∤",nsmid:"∤",Nscr:"𝒩",Ntilde:"Ñ",Nu:"Ν",OElig:"Œ",Oacute:"Ó",Ocirc:"Ô",Ocy:"О",Odblac:"Ő",Ofr:"𝔒",Ograve:"Ò",Omacr:"Ō",Omega:"Ω",ohm:"Ω",Omicron:"Ο",Oopf:"𝕆",OpenCurlyDoubleQuote:"“",ldquo:"“",OpenCurlyQuote:"",lsquo:"",Or:"⩔",Oscr:"𝒪",Oslash:"Ø",Otilde:"Õ",Otimes:"⨷",Ouml:"Ö",OverBar:"‾",oline:"‾",OverBrace:"⏞",OverBracket:"⎴",tbrk:"⎴",OverParenthesis:"⏜",PartialD:"∂",part:"∂",Pcy:"П",Pfr:"𝔓",Phi:"Φ",Pi:"Π",PlusMinus:"±",plusmn:"±",pm:"±",Popf:"",primes:"",Pr:"⪻",Precedes:"≺",pr:"≺",prec:"≺",PrecedesEqual:"⪯",pre:"⪯",preceq:"⪯",PrecedesSlantEqual:"≼",prcue:"≼",preccurlyeq:"≼",PrecedesTilde:"≾",precsim:"≾",prsim:"≾",Prime:"″",Product:"∏",prod:"∏",Proportional:"∝",prop:"∝",propto:"∝",varpropto:"∝",vprop:"∝",Pscr:"𝒫",Psi:"Ψ",QUOT:'"',quot:'"',Qfr:"𝔔",Qopf:"",rationals:"",Qscr:"𝒬",RBarr:"⤐",drbkarow:"⤐",REG:"®",circledR:"®",reg:"®",Racute:"Ŕ",Rang:"⟫",Rarr:"↠",twoheadrightarrow:"↠",Rarrtl:"⤖",Rcaron:"Ř",Rcedil:"Ŗ",Rcy:"Р",Re:"",Rfr:"",real:"",realpart:"",ReverseElement:"∋",SuchThat:"∋",ni:"∋",niv:"∋",ReverseEquilibrium:"⇋",leftrightharpoons:"⇋",lrhar:"⇋",ReverseUpEquilibrium:"⥯",duhar:"⥯",Rho:"Ρ",RightAngleBracket:"⟩",rang:"⟩",rangle:"⟩",RightArrow:"→",ShortRightArrow:"→",rarr:"→",rightarrow:"→",srarr:"→",RightArrowBar:"⇥",rarrb:"⇥",RightArrowLeftArrow:"⇄",rightleftarrows:"⇄",rlarr:"⇄",RightCeiling:"⌉",rceil:"⌉",RightDoubleBracket:"⟧",robrk:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",dharr:"⇂",downharpoonright:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rfloor:"⌋",RightTee:"⊢",vdash:"⊢",RightTeeArrow:"↦",map:"↦",mapsto:"↦",RightTeeVector:"⥛",RightTriangle:"⊳",vartriangleright:"⊳",vrtri:"⊳",RightTriangleBar:"⧐",Ri
`)}tokenize(){for(;this._cursor.peek()!==0;){let e=this._cursor.clone();try{if(this._attemptCharCode(60))if(this._attemptCharCode(33))this._attemptStr("[CDATA[")?this._consumeCdata(e):this._attemptStr("--")?this._consumeComment(e):this._attemptStrCaseInsensitive("doctype")?this._consumeDocType(e):this._consumeBogusComment(e);else if(this._attemptCharCode(47))this._consumeTagClose(e);else{let t=this._cursor.clone();this._attemptCharCode(63)?(this._cursor=t,this._consumeBogusComment(e)):this._consumeTagOpen(e)}else this._tokenizeBlocks&&this._attemptCharCode(64)?this._consumeBlockStart(e):this._tokenizeBlocks&&!this._inInterpolation&&!this._isInExpansionCase()&&!this._isInExpansionForm()&&this._attemptCharCode(125)?this._consumeBlockEnd(e):this._tokenizeIcu&&this._tokenizeExpansionForm()||this._consumeWithInterpolation(5,8,()=>this._isTextEnd(),()=>this._isTagStart())}catch(t){this.handleError(t)}}this._beginToken(30),this._endToken([])}_getBlockName(){let e=!1,t=this._cursor.clone();return this._attemptCharCodeUntilFn(r=>jr(r)?!e:xn(r)?(e=!0,!1):!0),this._cursor.getChars(t).trim()}_consumeBlockStart(e){this._beginToken(25,e);let t=this._endToken([this._getBlockName()]);if(this._cursor.peek()===40)if(this._cursor.advance(),this._consumeBlockParameters(),this._attemptCharCodeUntilFn(_),this._attemptCharCode(41))this._attemptCharCodeUntilFn(_);else{t.type=29;return}this._attemptCharCode(123)?(this._beginToken(26),this._endToken([])):t.type=29}_consumeBlockEnd(e){this._beginToken(27,e),this._endToken([])}_consumeBlockParameters(){for(this._attemptCharCodeUntilFn(Tn);this._cursor.peek()!==41&&this._cursor.peek()!==0;){this._beginToken(28);let e=this._cursor.clone(),t=null,r=0;for(;this._cursor.peek()!==59&&this._cursor.peek()!==0||t!==null;){let n=this._cursor.peek();if(n===92)this._cursor.advance();else if(n===t)t=null;else if(t===null&&Dn(n))t=n;else if(n===40&&t===null)r++;else if(n===41&&t===null){if(r===0)break;r>0&&r--}this._cursor.advance()}this._endToken([this._cursor.getChars(e)]),this._attemptCharCodeUntilFn(Tn)}}_tokenizeExpansionForm(){if(this.isExpansionFormStart())return this._consumeExpansionFormStart(),!0;if(ml(this._cursor.peek())&&this._isInExpansionForm())return this._consumeExpansionCaseStart(),!0;if(this._cursor.peek()===125){if(this._isInExpansionCase())return this._consumeExpansionCaseEnd(),!0;if(this._isInExpansionForm())return this._consumeExpansionFormEnd(),!0}return!1}_beginToken(e,t=this._cursor.clone()){this._currentTokenStart=t,this._currentTokenType=e}_endToken(e,t){if(this._currentTokenStart===null)throw new ir("Programming error - attempted to end a token when there was no start to the token",this._currentTokenType,this._cursor.getSpan(t));if(this._currentTokenType===null)throw new ir("Programming error - attempted to end a token which has no token type",null,this._cursor.getSpan(this._currentTokenStart));let r={type:this._currentTokenType,parts:e,sourceSpan:(t??this._cursor).getSpan(this._currentTokenStart,this._leadingTriviaCodePoints)};return this.tokens.push(r),this._currentTokenStart=null,this._currentTokenType=null,r}_createError(e,t){this._isInExpansionForm()&&(e+=` (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)`);let r=new ir(e,this._currentTokenType,t);return this._currentTokenStart=null,this._currentTokenType=null,new ar(r)}handleError(e){if(e instanceof Jr&&(e=this._createError(e.msg,this._cursor.getSpan(e.cursor))),e instanceof ar)this.errors.push(e.error);else throw e}_attemptCharCode(e){return this._cursor.peek()===e?(this._cursor.advance(),!0):!1}_attemptCharCodeCaseInsensitive(e){return gl(this._cursor.peek(),e)?(this._cursor.advance(),!0):!1}_requireCharCode(e){let t=this._cursor.clone();if(!this._attemptCharCode(e))throw this._createError(xe(this._cursor.peek()),this._cursor.getSpan(t))}_attemptStr(e){let t=e.length;if(this._cursor.charsLeft()<t)return!1;let r=this._cursor.clone();for(let n=0;n<t;n++)if(!this._attemptCharCode(e.charCodeAt(n)))return this._cursor=r,!1;return!0}_attemptStrCaseInsensitive(e){for(let t=0;t<e.length;t++)if(!this._a
`){let n=this._getClosestParentElement();n!=null&&n.children.length==0&&this.getTagDefinition(n.name).ignoreFirstLf&&(r=r.substring(1))}return r}_consumeText(t){let r=[t],n=t.sourceSpan,u=t.parts[0];if(u.length>0&&u[0]===`
2024-06-24 11:39:28 +02:00
`){let i=this._getContainer();i!=null&&i.children.length===0&&this.getTagDefinition(i.name).ignoreFirstLf&&(u=u.substring(1),r[0]={type:t.type,sourceSpan:t.sourceSpan,parts:[u]})}for(;this._peek.type===8||this._peek.type===5||this._peek.type===9;)t=this._advance(),r.push(t),t.type===8?u+=t.parts.join("").replace(/&([^;]+);/g,Nn):t.type===9?u+=t.parts[0]:u+=t.parts.join("");if(u.length>0){let i=t.sourceSpan;this._addToParent(new Yo(u,new b(n.start,i.end,n.fullStart,n.details),r))}}_closeVoidElement(){let t=this._getContainer();t instanceof oe&&this.getTagDefinition(t.name).isVoid&&this._containerStack.pop()}_consumeStartTag(t){let[r,n]=t.parts,u=[];for(;this._peek.type===14;)u.push(this._consumeAttr(this._advance()));let i=this._getElementFullName(r,n,this._getClosestParentElement()),a=!1;if(this._peek.type===2){this._advance(),a=!0;let h=this.getTagDefinition(i);this.canSelfClose||h.canSelfClose||gt(i)!==null||h.isVoid||this.errors.push(R.create(i,t.sourceSpan,`Only void, custom and foreign elements can be self closed "${t.parts[1]}"`))}else this._peek.type===1&&(this._advance(),a=!1);let s=this._peek.sourceSpan.fullStart,o=new b(t.sourceSpan.start,s,t.sourceSpan.fullStart),l=new b(t.sourceSpan.start,s,t.sourceSpan.fullStart),c=new b(t.sourceSpan.start.moveBy(1),t.sourceSpan.end),D=new oe(i,u,[],o,l,void 0,c),p=this._getContainer();this._pushContainer(D,p instanceof oe&&this.getTagDefinition(p.name).isClosedByChild(D.name)),a?this._popContainer(i,oe,o):t.type===4&&(this._popContainer(i,oe,null),this.errors.push(R.create(i,o,`Opening tag "${i}" not terminated.`)))}_pushContainer(t,r){r&&this._containerStack.pop(),this._addToParent(t),this._containerStack.push(t)}_consumeEndTag(t){let r=this.allowHtmComponentClosingTags&&t.parts.length===0?null:this._getElementFullName(t.parts[0],t.parts[1],this._getClosestParentElement());if(r&&this.getTagDefinition(r).isVoid)this.errors.push(R.create(r,t.sourceSpan,`Void elements do not have end tags "${t.parts[1]}"`));else if(!this._popContainer(r,oe,t.sourceSpan)){let n=`Unexpected closing tag "${r}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;this.errors.push(R.create(r,t.sourceSpan,n))}}_popContainer(t,r,n){let u=!1;for(let i=this._containerStack.length-1;i>=0;i--){let a=this._containerStack[i];if(gt(a.name)?a.name===t:(t==null||a.name.toLowerCase()===t.toLowerCase())&&a instanceof r)return a.endSourceSpan=n,a.sourceSpan.end=n!==null?n.end:a.sourceSpan.end,this._containerStack.splice(i,this._containerStack.length-i),!u;(a instanceof Be||a instanceof oe&&!this.getTagDefinition(a.name).closedByParent)&&(u=!0)}return!1}_consumeAttr(t){let r=St(t.parts[0],t.parts[1]),n=t.sourceSpan.end,u;this._peek.type===15&&(u=this._advance());let i="",a=[],s,o;if(this._peek.type===16)for(s=this._peek.sourceSpan,o=this._peek.sourceSpan.end;this._peek.type===16||this._peek.type===17||this._peek.type===9;){let c=this._advance();a.push(c),c.type===17?i+=c.parts.join("").replace(/&([^;]+);/g,Nn):c.type===9?i+=c.parts[0]:i+=c.parts.join(""),o=n=c.sourceSpan.end}this._peek.type===15&&(o=n=this._advance().sourceSpan.end);let l=s&&o&&new b((u==null?void 0:u.sourceSpan.start)??s.start,o,(u==null?void 0:u.sourceSpan.fullStart)??s.fullStart);return new el(r,i,new b(t.sourceSpan.start,n,t.sourceSpan.fullStart),t.sourceSpan,l,a.length>0?a:void 0,void 0)}_consumeBlockOpen(t){let r=[];for(;this._peek.type===28;){let s=this._advance();r.push(new An(s.parts[0],s.sourceSpan))}this._peek.type===26&&this._advance();let n=this._peek.sourceSpan.fullStart,u=new b(t.sourceSpan.start,n,t.sourceSpan.fullStart),i=new b(t.sourceSpan.start,n,t.sourceSpan.fullStart),a=new Be(t.parts[0],r,[],u,i);this._pushContainer(a,!1)}_consumeBlockClose(t){this._popContainer(null,Be,t.sourceSpan)||this.errors.push(R.create(null,t.sourceSpan,'Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.'))}_consumeIncompleteBlock(
2024-06-16 17:30:30 +02:00
`,C(f.gutter,fe.replace(/\d/g," "))," ",Yi,C(f.marker,"^").repeat(Xi)].join(""),Ji&&m.message&&(rr+=" "+C(f.message,m.message))}return[C(f.marker,">"),C(f.gutter,fe),T.length>0?` ${T}`:"",rr].join("")}else return` ${C(f.gutter,fe)}${T.length>0?` ${T}`:""}`}).join(`
`);return m.message&&!x&&(W=`${" ".repeat(K+1)}${m.message}
2024-06-24 11:39:28 +02:00
${W}`),g?F.reset(W):W}function p(h,d,m,g={}){if(!s){s=!0;let F="Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";{let f=new Error(F);f.name="DeprecationWarning",console.warn(new Error(F))}}return m=Math.max(m,0),D(h,{start:{column:m,line:d}},g)}}),oi={};Kt(oi,{__debug:()=>rh,check:()=>eh,doc:()=>zi,format:()=>Ki,formatWithCursor:()=>Gi,getSupportInfo:()=>th,util:()=>Ui,version:()=>Z2});var sc=(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)},Yt=sc,oc=it(uc(),1),Se="string",pe="array",Ae="cursor",te="indent",re="align",ne="trim",P="group",j="fill",M="if-break",ue="indent-if-break",ie="line-suffix",ae="line-suffix-boundary",B="line",Q="label",$="break-parent",li=new Set([Ae,te,re,ne,P,j,M,ue,ie,ae,B,Q,$]);function lc(e){if(typeof e=="string")return Se;if(Array.isArray(e))return pe;if(!e)return;let{type:t}=e;if(li.has(t))return t}var ke=lc,cc=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function pc(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return`Unexpected doc '${t}',
2024-06-16 17:30:30 +02:00
Expected it to be 'string' or 'object'.`;if(ke(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=cc([...li].map(u=>`'${u}'`));return`Unexpected doc.type '${e.type}'.
Expected it to be ${n}.`}var hc=class extends Error{constructor(t){super(pc(t));_e(this,"name","InvalidDocError");this.doc=t}},Ie=hc,Hn={};function dc(e,t,r,n){let u=[e];for(;u.length>0;){let i=u.pop();if(i===Hn){r(u.pop());continue}r&&u.push(i,Hn);let a=ke(i);if(!a)throw new Ie(i);if((t==null?void 0:t(i))!==!1)switch(a){case pe:case j:{let s=a===pe?i:i.parts;for(let o=s.length,l=o-1;l>=0;--l)u.push(s[l]);break}case M:u.push(i.flatContents,i.breakContents);break;case P:if(n&&i.expandedStates)for(let s=i.expandedStates.length,o=s-1;o>=0;--o)u.push(i.expandedStates[o]);else u.push(i.contents);break;case re:case te:case ue:case Q:case ie:u.push(i.contents);break;case Se:case Ae:case ne:case ae:case B:case $:break;default:throw new Ie(i)}}}var Yr=dc,Dc=()=>{},fc=Dc;function _t(e){return{type:te,contents:e}}function Oe(e,t){return{type:re,contents:t,n:e}}function ci(e,t={}){return fc(t.expandedStates),{type:P,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function mc(e){return Oe(Number.NEGATIVE_INFINITY,e)}function gc(e){return Oe({type:"root"},e)}function Cc(e){return Oe(-1,e)}function Fc(e,t){return ci(e[0],{...t,expandedStates:e})}function pi(e){return{type:j,parts:e}}function vc(e,t="",r={}){return{type:M,breakContents:e,flatContents:t,groupId:r.groupId}}function yc(e,t){return{type:ue,contents:e,groupId:t.groupId,negate:t.negate}}function yr(e){return{type:ie,contents:e}}var Ec={type:ae},Xt={type:$},bc={type:ne},Xr={type:B,hard:!0},hi={type:B,hard:!0,literal:!0},di={type:B},wc={type:B,soft:!0},Ce=[Xr,Xt],Di=[hi,Xt],Er={type:Ae};function fi(e,t){let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function mi(e,t,r){let n=e;if(t>0){for(let u=0;u<Math.floor(t/r);++u)n=_t(n);n=Oe(t%r,n),n=Oe(Number.NEGATIVE_INFINITY,n)}return n}function Sc(e,t){return e?{type:Q,label:e,contents:t}:t}var Ac=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},k=Ac;function kc(e){let t=e.indexOf("\r");return t>=0?e.charAt(t+1)===`
`?"crlf":"cr":"lf"}function Qr(e){switch(e){case"cr":return"\r";case"crlf":return`\r
`;default:return`
`}}function gi(e,t){let r;switch(t){case`
`:r=/\n/g;break;case"\r":r=/\r/g;break;case`\r
`:r=/\r\n/g;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let n=e.match(r);return n?n.length:0}function _c(e){return Yt(!1,e,/\r\n?/g,`
`)}var Bc=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDF
`)):r)}function Vc(e){if(e.type===B)return!0}function Uc(e){return en(e,Vc,!1)}function Fi(e,t){return e.type===Q?{...e,contents:t(e.contents)}:t(e)}var N=Symbol("MODE_BREAK"),Y=Symbol("MODE_FLAT"),Je=Symbol("cursor");function vi(){return{value:"",length:0,queue:[]}}function zc(e,t){return br(e,{type:"indent"},t)}function Gc(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||vi():t<0?br(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:br(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function br(e,t,r){let n=t.type==="dedent"?e.queue.slice(0,-1):[...e.queue,t],u="",i=0,a=0,s=0;for(let d of n)switch(d.type){case"indent":c(),r.useTabs?o(1):l(r.tabWidth);break;case"stringAlign":c(),u+=d.n,i+=d.n.length;break;case"numberAlign":a+=1,s+=d.n;break;default:throw new Error(`Unexpected type '${d.type}'`)}return p(),{...e,value:u,length:i,queue:n};function o(d){u+=" ".repeat(d),i+=r.tabWidth*d}function l(d){u+=" ".repeat(d),i+=d}function c(){r.useTabs?D():p()}function D(){a>0&&o(a),h()}function p(){s>0&&l(s),h()}function h(){a=0,s=0}}function wr(e){let t=0,r=0,n=e.length;e:for(;n--;){let u=e[n];if(u===Je){r++;continue}for(let i=u.length-1;i>=0;i--){let a=u[i];if(a===" "||a===" ")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(Je);return t}function Dt(e,t,r,n,u,i){if(r===Number.POSITIVE_INFINITY)return!0;let a=t.length,s=[e],o=[];for(;r>=0;){if(s.length===0){if(a===0)return!0;s.push(t[--a]);continue}let{mode:l,doc:c}=s.pop();switch(ke(c)){case Se:o.push(c),r-=Zr(c);break;case pe:case j:{let D=Pc(c);for(let p=D.length-1;p>=0;p--)s.push({mode:l,doc:D[p]});break}case te:case re:case ue:case Q:s.push({mode:l,doc:c.contents});break;case ne:r+=wr(o);break;case P:{if(i&&c.break)return!1;let D=c.break?N:l,p=c.expandedStates&&D===N?k(!1,c.expandedStates,-1):c.contents;s.push({mode:D,doc:p});break}case M:{let D=(c.groupId?u[c.groupId]||Y:l)===N?c.breakContents:c.flatContents;D&&s.push({mode:l,doc:D});break}case B:if(l===N||c.hard)return!0;c.soft||(o.push(" "),r--);break;case ie:n=!0;break;case ae:if(n)return!1;break}}return!1}function Zt(e,t){let r={},n=t.printWidth,u=Qr(t.endOfLine),i=0,a=[{ind:vi(),mode:N,doc:e}],s=[],o=!1,l=[],c=0;for(Mc(e);a.length>0;){let{ind:p,mode:h,doc:d}=a.pop();switch(ke(d)){case Se:{let m=u!==`
`?Yt(!1,d,`
`,u):d;s.push(m),a.length>0&&(i+=Zr(m));break}case pe:for(let m=d.length-1;m>=0;m--)a.push({ind:p,mode:h,doc:d[m]});break;case Ae:if(c>=2)throw new Error("There are too many 'cursor' in doc.");s.push(Je),c++;break;case te:a.push({ind:zc(p,t),mode:h,doc:d.contents});break;case re:a.push({ind:Gc(p,d.n,t),mode:h,doc:d.contents});break;case ne:i-=wr(s);break;case P:switch(h){case Y:if(!o){a.push({ind:p,mode:d.break?N:Y,doc:d.contents});break}case N:{o=!1;let m={ind:p,mode:Y,doc:d.contents},g=n-i,F=l.length>0;if(!d.break&&Dt(m,a,g,F,r))a.push(m);else if(d.expandedStates){let f=k(!1,d.expandedStates,-1);if(d.break){a.push({ind:p,mode:N,doc:f});break}else for(let C=1;C<d.expandedStates.length+1;C++)if(C>=d.expandedStates.length){a.push({ind:p,mode:N,doc:f});break}else{let y=d.expandedStates[C],v={ind:p,mode:Y,doc:y};if(Dt(v,a,g,F,r)){a.push(v);break}}}else a.push({ind:p,mode:N,doc:d.contents});break}}d.id&&(r[d.id]=k(!1,a,-1).mode);break;case j:{let m=n-i,{parts:g}=d;if(g.length===0)break;let[F,f]=g,C={ind:p,mode:Y,doc:F},y={ind:p,mode:N,doc:F},v=Dt(C,[],m,l.length>0,r,!0);if(g.length===1){v?a.push(C):a.push(y);break}let w={ind:p,mode:Y,doc:f},S={ind:p,mode:N,doc:f};if(g.length===2){v?a.push(w,C):a.push(S,y);break}g.splice(0,2);let x={ind:p,mode:h,doc:pi(g)},K=g[0];Dt({ind:p,mode:Y,doc:[F,f,K]},[],m,l.length>0,r,!0)?a.push(x,w,C):v?a.push(x,S,C):a.push(x,S,y);break}case M:case ue:{let m=d.groupId?r[d.groupId]:h;if(m===N){let g=d.type===M?d.breakContents:d.negate?d.contents:_t(d.contents);g&&a.push({ind:p,mode:h,doc:g})}if(m===Y){let g=d.type===M?d.flatContents:d.negate?_t(d.contents):d.contents;g&&a.push({ind:p,mode:h,doc:g})}break}case ie:l.push({ind:p,mode:h,doc:d.contents});break;case ae:l.length>0&&a.push({ind:p,mode:h,doc:Xr});break;case B:switch(h){case Y:if(d.hard)o=!0;else{d.soft||(s.push(" "),i+=1);break}case N:if(l.length>0){a.push({ind:p,mode:h,doc:d},...l.reverse()),l.length=0;break}d.literal?p.root?(s.push(u,p.root.value),i=p.root.length):(s.push(u),i=0):(i-=wr(s),s.push(u+p.value),i=p.length);break}break;case Q:a.push({ind:p,mode:h,doc:d.contents});break;case $:break;default:throw new Ie(d)}a.length===0&&l.length>0&&(a.push(...l.reverse()),l.length=0)}let D=s.indexOf(Je);if(D!==-1){let p=s.indexOf(Je,D+1),h=s.slice(0,D).join(""),d=s.slice(D+1,p).join(""),m=s.slice(p+1).join("");return{formatted:h+d+m,cursorNodeStart:h.length,cursorNodeText:d}}return{formatted:s.join("")}}function Z(e){var t;if(!e)return"";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...Z(n));else{let u=Z(n);u!==""&&r.push(u)}return r}return e.type===M?{...e,breakContents:Z(e.breakContents),flatContents:Z(e.flatContents)}:e.type===P?{...e,contents:Z(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(Z)}:e.type===j?{type:"fill",parts:e.parts.map(Z)}:e.contents?{...e,contents:Z(e.contents)}:e}function Kc(e){let t=Object.create(null),r=new Set;return n(Z(e));function n(i,a,s){var o,l;if(typeof i=="string")return JSON.stringify(i);if(Array.isArray(i)){let c=i.map(n).filter(Boolean);return c.length===1?c[0]:`[${c.join(", ")}]`}if(i.type===B){let c=((o=s==null?void 0:s[a+1])==null?void 0:o.type)===$;return i.literal?c?"literalline":"literallineWithoutBreakParent":i.hard?c?"hardline":"hardlineWithoutBreakParent":i.soft?"softline":"line"}if(i.type===$)return((l=s==null?void 0:s[a-1])==null?void 0:l.type)===B&&s[a-1].hard?void 0:"breakParent";if(i.type===ne)return"trim";if(i.type===te)return"indent("+n(i.contents)+")";if(i.type===re)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===M)return"ifBreak("+n(i.breakContents)+(i.flatContents?", "+n(i.flatContents):"")+(i.groupId?(i.flatContents?"":', ""')+`, { groupId: ${u(i.groupId)} }`:"")+")";if(i.type===ue){let c=[];i.negate&&c.push("negate: true"),i.groupId&&c.push(`groupId: ${u(i.groupId)}`);let D=c.length>0?`, { ${c.join(", ")} }`:"";return`indentIfBreak(${n(i.contents)}${D})`}if(i.type===P){let c
(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:"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
2024-06-24 11:39:28 +02:00
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 Ei({plugins:e=[],showDeprecated:t=!1}={}){let r=e.flatMap(u=>u.languages??[]),n=[];for(let u of Qc(Object.assign({},...e.map(({options:i})=>i),Yc)))!t&&u.deprecated||(Array.isArray(u.choices)&&(t||(u.choices=u.choices.filter(i=>!i.deprecated)),u.name==="parser"&&(u.choices=[...u.choices,...Xc(u.choices,r,e)])),u.pluginDefaults=Object.fromEntries(e.filter(i=>{var a;return((a=i.defaultOptions)==null?void 0:a[u.name])!==void 0}).map(i=>[i.name,i.defaultOptions[u.name]])),n.push(u));return{languages:r,options:n}}function*Xc(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 a=r.find(o=>o.parsers&&Object.prototype.hasOwnProperty.call(o.parsers,i)),s=u.name;a!=null&&a.name&&(s+=` (plugin: ${a.name})`),yield{value:i,description:s}}}}function Qc(e){let t=[];for(let[r,n]of Object.entries(e)){let u={name:r,...n};Array.isArray(u.default)&&(u.default=k(!1,u.default,-1).value),t.push(u)}return t}var Zc=e=>String(e).split(/[/\\]/).pop();function Vn(e,t){if(!t)return;let r=Zc(t).toLowerCase();return e.find(n=>{var u,i;return((u=n.extensions)==null?void 0:u.some(a=>r.endsWith(a)))||((i=n.filenames)==null?void 0:i.some(a=>a.toLowerCase()===r))})}function ep(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 tp(e,t){let r=e.plugins.flatMap(u=>u.languages??[]),n=ep(r,t.language)??Vn(r,t.physicalFile)??Vn(r,t.file)??(t.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var rp=tp,Te={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=>Te.value(r)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(r=>`${Te.key(r)}: ${Te.value(e[r])}`).join(", ")} }`},pair:({key:e,value:t})=>Te.value({[e]:t})},Un=it(Jt(),1),np=(e,t,{descriptor:r})=>{let n=[`${Un.default.yellow(typeof e=="string"?r.key(e):r.pair(e))} is deprecated`];return t&&n.push(`we now treat it as ${Un.default.blue(typeof t=="string"?r.key(t):r.pair(t))}`),n.join("; ")+"."},Le=it(Jt(),1),bi=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ft=Symbol.for("vnopts.VALUE_UNCHANGED"),zn=" ".repeat(2),up=(e,t,r)=>{let{text:n,list:u}=r.normalizeExpectedResult(r.schemas[e].expected(r)),i=[];return n&&i.push(Gn(e,t,n,r.descriptor)),u&&i.push([Gn(e,t,u.title,r.descriptor)].concat(u.values.map(a=>wi(a,r.loggerPrintWidth))).join(`
2024-06-16 17:30:30 +02:00
`)),Si(i,r.loggerPrintWidth)};function Gn(e,t,r,n){return[`Invalid ${Le.default.red(n.key(e))} value.`,`Expected ${Le.default.blue(r)},`,`but received ${t===bi?Le.default.gray("nothing"):Le.default.red(n.value(t))}.`].join(" ")}function wi({text:e,list:t},r){let n=[];return e&&n.push(`- ${Le.default.blue(e)}`),t&&n.push([`- ${Le.default.blue(t.title)}:`].concat(t.values.map(u=>wi(u,r-zn.length).replace(/^|\n/g,`$&${zn}`))).join(`
`)),Si(n,r)}function Si(e,t){if(e.length===1)return e[0];let[r,n]=e,[u,i]=e.map(a=>a.split(`
2024-06-24 11:39:28 +02:00
`,1)[0].length);return u>t&&u>i?n:r}var Kn=it(Jt(),1),lr=[],Jn=[];function ip(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 a,s,o,l,c=0,D=0;for(;c<n;)Jn[c]=e.charCodeAt(i+c),lr[c]=++c;for(;D<u;)for(a=t.charCodeAt(i+D),o=D++,s=D,c=0;c<n;c++)l=a===Jn[c]?o:o+1,o=lr[c],s=lr[c]=o>s?l>s?s+1:l:l>o?o+1:l;return s}var Ai=(e,t,{descriptor:r,logger:n,schemas:u})=>{let i=[`Ignored unknown option ${Kn.default.yellow(r.pair({key:e,value:t}))}.`],a=Object.keys(u).sort().find(s=>ip(e,s)<3);a&&i.push(`Did you mean ${Kn.default.blue(r.key(a))}?`),n.warn(i.join(" "))},ap=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function sp(e,t){let r=new e(t),n=Object.create(r);for(let u of ap)u in t&&(n[u]=op(t[u],r,De.prototype[u].length));return n}var De=class{static create(e){return sp(this,e)}constructor(e){this.name=e.name}default(e){}expected(e){return"nothing"}validate(e,t){return!1}deprecated(e,t){return!1}forward(e,t){}redirect(e,t){}overlap(e,t,r){return e}preprocess(e,t){return e}postprocess(e,t){return Ft}};function op(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var lp=class extends De{constructor(e){super(e),this._sourceName=e.sourceName}expected(e){return e.schemas[this._sourceName].expected(e)}validate(e,t){return t.schemas[this._sourceName].validate(e,t)}redirect(e,t){return this._sourceName}},cp=class extends De{expected(){return"anything"}validate(){return!0}},pp=class extends De{constructor({valueSchema:e,name:t=e.name,...r}){super({...r,name:t}),this._valueSchema=e}expected(e){let{text:t,list:r}=e.normalizeExpectedResult(this._valueSchema.expected(e));return{text:t&&`an array of ${t}`,list:r&&{title:"an array of the following values",values:[{list:r}]}}}validate(e,t){if(!Array.isArray(e))return!1;let r=[];for(let n of e){let u=t.normalizeValidateResult(this._valueSchema.validate(n,t),n);u!==!0&&r.push(u.value)}return r.length===0?!0:{value:r}}deprecated(e,t){let r=[];for(let n of e){let u=t.normalizeDeprecatedResult(this._valueSchema.deprecated(n,t),n);u!==!1&&r.push(...u.map(({value:i})=>({value:[i]})))}return r}forward(e,t){let r=[];for(let n of e){let u=t.normalizeForwardResult(this._valueSchema.forward(n,t),n);r.push(...u.map(Yn))}return r}redirect(e,t){let r=[],n=[];for(let u of e){let i=t.normalizeRedirectResult(this._valueSchema.redirect(u,t),u);"remain"in i&&r.push(i.remain),n.push(...i.redirect.map(Yn))}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(e,t){return e.concat(t)}};function Yn({from:e,to:t}){return{from:[e],to:t}}var hp=class extends De{expected(){return"true or false"}validate(e){return typeof e=="boolean"}};function dp(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 Dp(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 fp(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?!0:(e[r]=!0,!1)}}function mp(e,t){let r=[],n=[];for(let u of e)t(u)?r.push(u):n.push(u);return[r,n]}function gp(e){return e===Math.floor(e)}function Cp(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 Fp(e){return(...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function Xn(e){return e===void 0?{}:e}function ki(e){if(typeof e=="string")return{text:e};let{text:t,list:r}=e;return vp((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(ki)}}:{text:t}}function Qn(e,t){return e===!0?!0:e===!1?{value:t}:e}function Zn(e,t,r=!1){return e===!1?!1:e===!0?r?!0:[{value:t}]:"value"in e?[e]:e.length===
2024-06-16 17:30:30 +02:00
`+n,e.codeFrame=n,e}throw e}var at=jp,vt,Ar,ze,yt,Wp=class{constructor(e){Rn(this,vt),Rn(this,ze),this.stack=[e]}get key(){let{stack:e,siblings:t}=this;return k(!1,e,t===null?-2:-4)??null}get index(){return this.siblings===null?null:k(!1,this.stack,-2)}get node(){return k(!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,t=k(!1,e,-3);return Array.isArray(t)?t: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:t}=this;return e!==null&&t===e.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...Ve(this,ze,yt).call(this)]}getName(){let{stack:e}=this,{length:t}=e;return t>1?k(!1,e,-2):null}getValue(){return k(!1,this.stack,-1)}getNode(e=0){let t=Ve(this,vt,Ar).call(this,e);return t===-1?null:this.stack[t]}getParentNode(e=0){return this.getNode(e+1)}call(e,...t){let{stack:r}=this,{length:n}=r,u=k(!1,r,-1);for(let i of t)u=u[i],r.push(i,u);try{return e(this)}finally{r.length=n}}callParent(e,t=0){let r=Ve(this,vt,Ar).call(this,t+1),n=this.stack.splice(r+1);try{return e(this)}finally{this.stack.push(...n)}}each(e,...t){let{stack:r}=this,{length:n}=r,u=k(!1,r,-1);for(let i of t)u=u[i],r.push(i,u);try{for(let i=0;i<u.length;++i)r.push(i,u[i]),e(this,i,u),r.length-=2}finally{r.length=n}}map(e,...t){let r=[];return this.each((n,u,i)=>{r[u]=e(n,u,i)},...t),r}match(...e){let t=this.stack.length-1,r=null,n=this.stack[t--];for(let u of e){if(n===void 0)return!1;let i=null;if(typeof r=="number"&&(i=r,r=this.stack[t--],n=this.stack[t--]),u&&!u(n,r,i))return!1;r=this.stack[t--],n=this.stack[t--]}return!0}findAncestor(e){for(let t of Ve(this,ze,yt).call(this))if(e(t))return t}hasAncestor(e){for(let t of Ve(this,ze,yt).call(this))if(e(t))return!0;return!1}};vt=new WeakSet,Ar=function(e){let{stack:t}=this;for(let r=t.length-1;r>=0;r-=2)if(!Array.isArray(t[r])&&--e<0)return r;return-1},ze=new WeakSet,yt=function*(){let{stack:e}=this;for(let t=e.length-3;t>=0;t-=2){let r=e[t];Array.isArray(r)||(yield r)}};var Vp=Wp,Li=new Proxy(()=>{},{get:()=>Li}),kr=Li;function st(e){return(t,r,n)=>{let u=!!(n!=null&&n.backwards);if(r===!1)return!1;let{length:i}=t,a=r;for(;a>=0&&a<i;){let s=t.charAt(a);if(e instanceof RegExp){if(!e.test(s))return a}else if(!e.includes(s))return a;u?a--:a++}return a===-1||a===i?a:!1}}var Up=st(/\s/),he=st(" "),Ni=st(",; "),qi=st(/[^\n\r]/);function zp(e,t,r){let n=!!(r!=null&&r.backwards);if(t===!1)return!1;let u=e.charAt(t);if(n){if(e.charAt(t-1)==="\r"&&u===`
`)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 Ee=zp;function Gp(e,t,r={}){let n=he(e,r.backwards?t-1:t,r),u=Ee(e,n,r);return n!==u}var le=Gp;function Kp(e){return Array.isArray(e)&&e.length>0}var Jp=Kp;function Yp(e){return e!==null&&typeof e=="object"}var Xp=Yp;function*Pi(e,t){let{getVisitorKeys:r,filter:n=()=>!0}=t,u=i=>Xp(i)&&n(i);for(let i of r(e)){let a=e[i];if(Array.isArray(a))for(let s of a)u(s)&&(yield s);else u(a)&&(yield a)}}function*Qp(e,t){let r=[e];for(let n=0;n<r.length;n++){let u=r[n];for(let i of Pi(u,t))yield i,r.push(i)}}function Zp(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)+"…"),t+(r?" "+r:"")}function rn(e,t){(e.comments??(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=Zp(e)}function Ne(e,t){t.leading=!0,t.trailing=!1,rn(e,t)}function Et(e,t,r){t.leading=!1,t.trailing=!1,r&&(t.marker=r),rn(e,t)}function qe(e,t){t.leading=!1,t.trailing=!0,rn(e,t)}var pr=new WeakMap;function nn(e,t){if(pr.has(e))return pr.get(e);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:u},locStart:i,locEnd:a}=t;if(!n)return[];let s=((r==null?void 0:r(e,t))??[...Pi(e,{getVisitorKeys:er(u)})]).flatMap(o=>n(o)?[o]:nn(o,t));return s.sort((o,l)=>i(o)-i(l)||a(o)-a(l)),pr.set(e,s),s}function Ii(e,t,r,n){let{locStart:u,locEnd:i}=r,a=u(t),s=i(t),o=nn(e,r),l,c,D=0,p=o.length;for(;D<p;){let h=D+p>>1,d=o[h],m=u(d),g=i(d);if(m<=a&&s<=g)return Ii(d,t,r,d);if(g<=a){l=d,D=h+1;continue}if(s<=m){c=d,p=h;continue}throw new Error("Comment location overlaps with node location")}if((n==null?void 0:n.type)==="TemplateLiteral"){let{quasis:h}=n,d=dr(h,t,r);l&&dr(h,l,r)!==d&&(l=null),c&&dr(h,c,r)!==d&&(c=null)}return{enclosingNode:n,precedingNode:l,followingNode:c}}var hr=()=>!1;function e2(e,t){let{comments:r}=e;if(delete e.comments,!Jp(r)||!t.printer.canAttachComment)return;let n=[],{locStart:u,locEnd:i,printer:{experimentalFeatures:{avoidAstMutation:a=!1}={},handleComments:s={}},originalText:o}=t,{ownLine:l=hr,endOfLine:c=hr,remaining:D=hr}=s,p=r.map((h,d)=>({...Ii(e,h,t),comment:h,text:o,options:t,ast:e,isLastComment:r.length-1===d}));for(let[h,d]of p.entries()){let{comment:m,precedingNode:g,enclosingNode:F,followingNode:f,text:C,options:y,ast:v,isLastComment:w}=d;if(y.parser==="json"||y.parser==="json5"||y.parser==="__js_expression"||y.parser==="__ts_expression"||y.parser==="__vue_expression"||y.parser==="__vue_ts_expression"){if(u(m)-u(v)<=0){Ne(v,m);continue}if(i(m)-i(v)>=0){qe(v,m);continue}}let S;if(a?S=[d]:(m.enclosingNode=F,m.precedingNode=g,m.followingNode=f,S=[m,C,y,v,w]),t2(C,y,p,h))m.placement="ownLine",l(...S)||(f?Ne(f,m):g?qe(g,m):Et(F||v,m));else if(r2(C,y,p,h))m.placement="endOfLine",c(...S)||(g?qe(g,m):f?Ne(f,m):Et(F||v,m));else if(m.placement="remaining",!D(...S))if(g&&f){let x=n.length;x>0&&n[x-1].followingNode!==f&&uu(n,y),n.push(d)}else g?qe(g,m):f?Ne(f,m):Et(F||v,m)}if(uu(n,t),!a)for(let h of r)delete h.precedingNode,delete h.enclosingNode,delete h.followingNode}var Oi=e=>!/[\S\n\u2028\u2029]/.test(e);function t2(e,t,r,n){let{comment:u,precedingNode:i}=r[n],{locStart:a,locEnd:s}=t,o=a(u);if(i)for(let l=n-1;l>=0;l--){let{comment:c,precedingNode:D}=r[l];if(D!==i||!Oi(e.slice(s(c),o)))break;o=a(c)}return le(e,o,{backwards:!0})}function r2(e,t,r,n){let{comment:u,followingNode:i}=r[n],{locStart:a,locEnd:s}=t,o=s(u);if(i)for(let l=n+1;l<r.length;l++){let{comment:c,followingNode:D}=r[l];if(D!==i||!Oi(e.slice(o,a(c))))break;o=s(c)}return le(e,o)}function uu(e,t){var r,n;let u=e.length;if(u===0)return;let{precedingNode:i,followingNode:a}=e[0],s=t.locStart(a),o;for(o=u;o>0;--o){let{comment:l,precedingNode:c,followingNode:D}=e[o-1];kr.strictEqual(c,i),kr.strictEqual(D,a);let p=t.originalText.slice(t.locEnd(l),s);if(((n=(r=t.printer).isGap)==null?void 0:n.call(r,p,t))??/^[\s(]*$/.test(p))s=t.locStart(l);else break}for(let[l,{comment:c}]of e.entries())l<o?qe(i,c):Ne(a,c);for(
`,u)+1),o=n.slice(s,u).match(/^\s*/)[0],l=tn(o,t.tabWidth),c=await $i(a,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>u&&t.cursorOffset<=i?t.cursorOffset-u:-1,endOfLine:"lf"},l),D=c.formatted.trimEnd(),{cursorOffset:p}=t;p>i?p+=D.length-a.length:c.cursorOffset>=0&&(p=c.cursorOffset+u);let h=n.slice(0,u)+D+n.slice(i);if(t.endOfLine!=="lf"){let d=Qr(t.endOfLine);p>=0&&d===`\r
`&&(p+=gi(h.slice(0,p),`
`)),h=Yt(!1,h,`
`,d)}return{formatted:h,cursorOffset:p,comments:c.comments}}function Dr(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function lu(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:u}=t;return r=Dr(e,r,-1),n=Dr(e,n,0),u=Dr(e,u,e.length),{...t,cursorOffset:r,rangeStart:n,rangeEnd:u}}function Wi(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:i}=lu(e,t),a=e.charAt(0)===ji;if(a&&(e=e.slice(1),r--,n--,u--),i==="auto"&&(i=kc(e)),e.includes("\r")){let s=o=>gi(e.slice(0,Math.max(o,0)),`\r
`);r-=s(r),n-=s(n),u-=s(u),e=_c(e)}return{hasBOM:a,text:e,options:lu(e,{...t,cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:i})}}async function cu(e,t){let r=await Bi(t);return!r.hasPragma||r.hasPragma(e)}async function Vi(e,t){let{hasBOM:r,text:n,options:u}=Wi(e,await He(t));if(u.rangeStart>=u.rangeEnd&&n!==""||u.requirePragma&&!await cu(n,u))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let i;return u.rangeStart>0||u.rangeEnd<n.length?i=await y2(n,u):(!u.requirePragma&&u.insertPragma&&u.printer.insertPragma&&!await cu(n,u)&&(n=u.printer.insertPragma(n)),i=await $i(n,u)),r&&(i.formatted=ji+i.formatted,i.cursorOffset>=0&&i.cursorOffset++),i}async function E2(e,t,r){let{text:n,options:u}=Wi(e,await He(t)),i=await at(n,u);return r&&(r.preprocessForPrint&&(i.ast=await Ri(i.ast,u)),r.massage&&(i.ast=Rp(i.ast,u))),i}async function b2(e,t){t=await He(t);let r=await tr(e,t);return Zt(r,t)}async function w2(e,t){let r=Kc(e),{formatted:n}=await Vi(r,{...t,parser:"__js_expression"});return n}async function S2(e,t){t=await He(t);let{ast:r}=await at(e,t);return tr(r,t)}async function A2(e,t){return Zt(e,await He(t))}var Ui={};Kt(Ui,{addDanglingComment:()=>Et,addLeadingComment:()=>Ne,addTrailingComment:()=>qe,getAlignmentSize:()=>tn,getIndentSize:()=>P2,getMaxContinuousCount:()=>N2,getNextNonSpaceNonCommentCharacter:()=>j2,getNextNonSpaceNonCommentCharacterIndex:()=>U2,getStringWidth:()=>Zr,hasNewline:()=>le,hasNewlineInRange:()=>O2,hasSpaces:()=>R2,isNextLineEmpty:()=>J2,isNextLineEmptyAfterIndex:()=>ln,isPreviousLineEmpty:()=>G2,makeString:()=>W2,skip:()=>st,skipEverythingButNewLine:()=>qi,skipInlineComment:()=>an,skipNewline:()=>Ee,skipSpaces:()=>he,skipToLineEnd:()=>Ni,skipTrailingComment:()=>sn,skipWhitespace:()=>Up});function k2(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 an=k2;function _2(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?qi(e,t):t}var sn=_2;function B2(e,t){let r=null,n=t;for(;n!==r;)r=n,n=he(e,n),n=an(e,n),n=sn(e,n),n=Ee(e,n);return n}var on=B2;function x2(e,t){let r=null,n=t;for(;n!==r;)r=n,n=Ni(e,n),n=an(e,n),n=he(e,n);return n=sn(e,n),n=Ee(e,n),n!==!1&&le(e,n)}var ln=x2;function T2(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function L2(e,t){let r=e.match(new RegExp(`(${T2(t)})+`,"g"));return r===null?0:r.reduce((n,u)=>Math.max(n,u.length/t.length),0)}var N2=L2;function q2(e,t){let r=e.lastIndexOf(`
`);return r===-1?0:tn(e.slice(r+1).match(/^[\t ]*/)[0],t)}var P2=q2;function I2(e,t,r){for(let n=t;n<r;++n)if(e.charAt(n)===`
`)return!0;return!1}var O2=I2;function M2(e,t,r={}){return he(e,r.backwards?t-1:t,r)!==t}var R2=M2;function H2(e,t){let r=on(e,t);return r===!1?"":e.charAt(r)}var j2=H2;function $2(e,t,r){let n=t==='"'?"'":'"',u=Yt(!1,e,/\\(.)|(["'])/gs,(i,a,s)=>a===n?a:s===t?"\\"+s:s||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(a)?a:"\\"+a));return t+u+t}var W2=$2;function V2(e,t,r){return on(e,r(t))}function U2(e,t){return arguments.length===2||typeof t=="number"?on(e,t):V2(...arguments)}function z2(e,t,r){return un(e,r(t))}function G2(e,t){return arguments.length===2||typeof t=="number"?un(e,t):z2(...arguments)}function K2(e,t,r){return ln(e,r(t))}function J2(e,t){return arguments.length===2||typeof t=="number"?ln(e,t):K2(...arguments)}var zi={};Kt(zi,{builders:()=>Y2,printer:()=>X2,utils:()=>Q2});var Y2={join:fi,line:di,softline:wc,hardline:Ce,literalline:Di,group:ci,conditionalGroup:Fc,fill:pi,lineSuffix:yr,lineSuffixBoundary:Ec,cursor:Er,breakParent:Xt,ifBreak:vc,trim:bc,indent:_t,indentIfBreak:yc,align:Oe,addAlignmentToDoc:mi,markAsRoot:gc,dedentToRoot:mc,dedent:Cc,hardlineWithoutBreakParent:Xr,literallineWithoutBreakParent:hi,label:Sc,concat:e=>e},X2={printDocToString:Zt},Q2={willBreak:Oc,traverseDoc:Yr,findInDoc:en,mapDoc:Qt,removeLines:Hc,stripTrailingHardline:Ci,replaceEndOfLine:Wc,canBreak:Uc},Z2="3.1.1";function me(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 Gi=me(Vi);async function Ki(e,t){let{formatted:r}=await Gi(e,{...t,cursorOffset:-1});return r}async function eh(e,t){return await Ki(e,t)===e}var th=me(Ei,0),rh={parse:me(E2),formatAST:me(b2),formatDoc:me(w2),printToDoc:me(S2),printDocToString:me(A2)},nh=oi;function uh(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=Array.from(typeof e=="string"?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,"");var u=n.reduce(function(s,o){var l=o.match(/\n([\t ]+|(?!\s).)/g);return l?s.concat(l.map(function(c){var D,p;return(p=(D=c.match(/[\t ]/g))===null||D===void 0?void 0:D.length)!==null&&p!==void 0?p:0})):s},[]);if(u.length){var i=new RegExp(`
[ ]{`+Math.min.apply(Math,u)+"}","g");n=n.map(function(s){return s.replace(i,`
`)})}n[0]=n[0].replace(/^\r?\n/,"");var a=n[0];return t.forEach(function(s,o){var l=a.match(/(?:^|\n)( *)$/),c=l?l[1]:"",D=s;typeof s=="string"&&s.includes(`
`)&&(D=String(s).split(`
`).map(function(p,h){return h===0?p:""+c+p}).join(`
`)),a+=D+n[o+1]}),a}var Dh=ea(2)(async(e,t)=>e===!1?t:e==="dedent"||e===!0?uh(t):(await nh.format(t,{parser:e,plugins:[Kl],htmlWhitespaceSensitivity:"ignore"})).trim());export{Dh as formatter};