svgfusion 1.36.0 → 1.37.0
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.
- package/dist/browser.js +35 -35
- package/dist/cli.cjs +9202 -9168
- package/dist/index.cjs +270 -270
- package/dist/index.js +270 -270
- package/package.json +7 -7
package/dist/browser.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {toReactProp,camelCase}from'svgfusion-utils';export{formatComponentName,pascalCase,sanitizeComponentName,svgToComponentName}from'svgfusion-utils';import {ComponentGenerator}from'svgfusion-core';var mt=Object.defineProperty;var Mr=(e,t,r)=>t in e?mt(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var H=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var
|
|
1
|
+
import {toReactProp,camelCase}from'svgfusion-utils';export{formatComponentName,pascalCase,sanitizeComponentName,svgToComponentName}from'svgfusion-utils';import {ComponentGenerator}from'svgfusion-core';var mt=Object.defineProperty;var Mr=(e,t,r)=>t in e?mt(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var H=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Lr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Rr=(e,t)=>{for(var r in t)mt(e,r,{get:t[r],enumerable:true});};var ge=(e,t,r)=>Mr(e,t+"",r);var ft={};Rr(ft,{__debug:()=>Ir,check:()=>Pr,default:()=>ps,doc:()=>st,format:()=>dt,formatWithCursor:()=>ct,getSupportInfo:()=>Tr,util:()=>ot,version:()=>Or});function nu(e,t,r){return uu.diff(e,t,r)}function iu(e){let t=e.indexOf("\r");return t!==-1?e.charAt(t+1)===`
|
|
2
2
|
`?"crlf":"cr":"lf"}function Ke(e){switch(e){case "cr":return "\r";case "crlf":return `\r
|
|
3
3
|
`;default:return `
|
|
4
4
|
`}}function Kt(e,t){let r;switch(t){case `
|
|
5
5
|
`:r=/\n/gu;break;case "\r":r=/\r/gu;break;case `\r
|
|
6
|
-
`:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let u=e.match(r);return u?u.length:0}function
|
|
7
|
-
`)}function
|
|
8
|
-
`);)t--;return t<e.length?e.slice(0,t):e}function
|
|
9
|
-
Expected it to be 'string' or 'object'.`;if(re(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return `Unexpected doc '${r}'.`;let u=
|
|
10
|
-
Expected it to be ${u}.`}function
|
|
11
|
-
`)):r)}function
|
|
12
|
-
`?ke(false,
|
|
13
|
-
`,n):
|
|
6
|
+
`:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let u=e.match(r);return u?u.length:0}function su(e){return ke(false,e,/\r\n?/gu,`
|
|
7
|
+
`)}function au(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===`
|
|
8
|
+
`);)t--;return t<e.length?e.slice(0,t):e}function lu(e){if(typeof e=="string")return te;if(Array.isArray(e))return j;if(!e)return;let{type:t}=e;if(Xt.has(t))return t}function pu(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return `Unexpected doc '${t}',
|
|
9
|
+
Expected it to be 'string' or 'object'.`;if(re(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return `Unexpected doc '${r}'.`;let u=Du([...Xt].map(n=>`'${n}'`));return `Unexpected doc.type '${e.type}'.
|
|
10
|
+
Expected it to be ${u}.`}function du(e,t,r,u){let n=[e];for(;n.length>0;){let i=n.pop();if(i===Ft){r(n.pop());continue}r&&n.push(i,Ft);let s=re(i);if(!s)throw new ie(i);if(t?.(i)!==false)switch(s){case j:case P:{let o=s===j?i:i.parts;for(let a=o.length,l=a-1;l>=0;--l)n.push(o[l]);break}case x:n.push(i.flatContents,i.breakContents);break;case S:if(u&&i.expandedStates)for(let o=i.expandedStates.length,a=o-1;a>=0;--a)n.push(i.expandedStates[a]);else n.push(i.contents);break;case _:case W:case M:case T:case L:n.push(i.contents);break;case te:case q:case V:case R:case w:case A:break;default:throw new ie(i)}}}function Se(e,t){if(typeof e=="string")return t(e);let r=new Map;return u(e);function u(i){if(r.has(i))return r.get(i);let s=n(i);return r.set(i,s),s}function n(i){switch(re(i)){case j:return t(i.map(u));case P:return t({...i,parts:i.parts.map(u)});case x:return t({...i,breakContents:u(i.breakContents),flatContents:u(i.flatContents)});case S:{let{expandedStates:s,contents:o}=i;return s?(s=s.map(u),o=s[0]):o=u(o),t({...i,contents:o,expandedStates:s})}case _:case W:case M:case T:case L:return t({...i,contents:u(i.contents)});case te:case q:case V:case R:case w:case A:return t(i);default:throw new ie(i)}}}function Ye(e,t,r){let u=r,n=false;function i(s){if(n)return false;let o=t(s);o!==void 0&&(n=true,u=o);}return Xe(e,i),u}function fu(e){if(e.type===S&&e.break||e.type===w&&e.hard||e.type===A)return true}function hu(e){return Ye(e,fu,false)}function gt(e){if(e.length>0){let t=b(false,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated");}return null}function mu(e){let t=new Set,r=[];function u(i){if(i.type===A&>(r),i.type===S){if(r.push(i),t.has(i))return false;t.add(i);}}function n(i){i.type===S&&r.pop().break&>(r);}Xe(e,u,n,true);}function Fu(e){return e.type===w&&!e.hard?e.soft?"":" ":e.type===x?e.flatContents:e}function gu(e){return Se(e,Fu)}function Ct(e){for(e=[...e];e.length>=2&&b(false,e,-2).type===w&&b(false,e,-1).type===A;)e.length-=2;if(e.length>0){let t=ce(b(false,e,-1));e[e.length-1]=t;}return e}function ce(e){switch(re(e)){case W:case M:case S:case L:case T:{let t=ce(e.contents);return {...e,contents:t}}case x:return {...e,breakContents:ce(e.breakContents),flatContents:ce(e.flatContents)};case P:return {...e,parts:Ct(e.parts)};case j:return Ct(e);case te:return au(e);case _:case q:case V:case R:case w:case A:break;default:throw new ie(e)}return e}function Yt(e){return ce(yu(e))}function Cu(e){switch(re(e)){case P:if(e.parts.every(t=>t===""))return "";break;case S:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return "";if(e.contents.type===S&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case _:case W:case M:case L:if(!e.contents)return "";break;case x:if(!e.flatContents&&!e.breakContents)return "";break;case j:{let t=[];for(let r of e){if(!r)continue;let[u,...n]=Array.isArray(r)?r:[r];typeof u=="string"&&typeof b(false,t,-1)=="string"?t[t.length-1]+=u:t.push(u),t.push(...n);}return t.length===0?"":t.length===1?t[0]:t}case te:case q:case V:case R:case w:case T:case A:break;default:throw new ie(e)}return e}function yu(e){return Se(e,t=>Cu(t))}function Eu(e,t=rr){return Se(e,r=>typeof r=="string"?ur(t,r.split(`
|
|
11
|
+
`)):r)}function vu(e){if(e.type===w)return true}function bu(e){return Ye(e,vu,false)}function Ee(e,t){return e.type===T?{...e,contents:t(e.contents)}:t(e)}function we(e){return O(e),{type:W,contents:e}}function se(e,t){return O(t),{type:_,contents:t,n:e}}function Qt(e,t={}){return O(e),Zt(t.expandedStates,true),{type:S,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function ku(e){return se(Number.NEGATIVE_INFINITY,e)}function Su(e){return se({type:"root"},e)}function xu(e){return se(-1,e)}function Bu(e,t){return Qt(e[0],{...t,expandedStates:e})}function Au(e){return wu(e),{type:P,parts:e}}function $u(e,t="",r={}){return O(e),t!==""&&O(t),{type:x,breakContents:e,flatContents:t,groupId:r.groupId}}function Nu(e,t){return O(e),{type:M,contents:e,groupId:t.groupId,negate:t.negate}}function Ve(e){return O(e),{type:L,contents:e}}function ur(e,t){O(e),Zt(t);let r=[];for(let u=0;u<t.length;u++)u!==0&&r.push(e),r.push(t[u]);return r}function nr(e,t,r){O(e);let u=e;if(t>0){for(let n=0;n<Math.floor(t/r);++n)u=we(u);u=se(t%r,u),u=se(Number.NEGATIVE_INFINITY,u);}return u}function Iu(e,t){return O(t),e?{type:T,label:e,contents:t}:t}function I(e){var t;if(!e)return "";if(Array.isArray(e)){let r=[];for(let u of e)if(Array.isArray(u))r.push(...I(u));else {let n=I(u);n!==""&&r.push(n);}return r}return e.type===x?{...e,breakContents:I(e.breakContents),flatContents:I(e.flatContents)}:e.type===S?{...e,contents:I(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(I)}:e.type===P?{type:"fill",parts:e.parts.map(I)}:e.contents?{...e,contents:I(e.contents)}:e}function ju(e){let t=Object.create(null),r=new Set;return u(I(e));function u(i,s,o){var a,l;if(typeof i=="string")return JSON.stringify(i);if(Array.isArray(i)){let D=i.map(u).filter(Boolean);return D.length===1?D[0]:`[${D.join(", ")}]`}if(i.type===w){let D=((a=o?.[s+1])==null?void 0:a.type)===A;return i.literal?D?"literalline":"literallineWithoutBreakParent":i.hard?D?"hardline":"hardlineWithoutBreakParent":i.soft?"softline":"line"}if(i.type===A)return ((l=o?.[s-1])==null?void 0:l.type)===w&&o[s-1].hard?void 0:"breakParent";if(i.type===V)return "trim";if(i.type===W)return "indent("+u(i.contents)+")";if(i.type===_)return i.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+u(i.contents)+")":i.n<0?"dedent("+u(i.contents)+")":i.n.type==="root"?"markAsRoot("+u(i.contents)+")":"align("+JSON.stringify(i.n)+", "+u(i.contents)+")";if(i.type===x)return "ifBreak("+u(i.breakContents)+(i.flatContents?", "+u(i.flatContents):"")+(i.groupId?(i.flatContents?"":', ""')+`, { groupId: ${n(i.groupId)} }`:"")+")";if(i.type===M){let D=[];i.negate&&D.push("negate: true"),i.groupId&&D.push(`groupId: ${n(i.groupId)}`);let f=D.length>0?`, { ${D.join(", ")} }`:"";return `indentIfBreak(${u(i.contents)}${f})`}if(i.type===S){let D=[];i.break&&i.break!=="propagated"&&D.push("shouldBreak: true"),i.id&&D.push(`id: ${n(i.id)}`);let f=D.length>0?`, { ${D.join(", ")} }`:"";return i.expandedStates?`conditionalGroup([${i.expandedStates.map(p=>u(p)).join(",")}]${f})`:`group(${u(i.contents)}${f})`}if(i.type===P)return `fill([${i.parts.map(D=>u(D)).join(", ")}])`;if(i.type===L)return "lineSuffix("+u(i.contents)+")";if(i.type===R)return "lineSuffixBoundary";if(i.type===T)return `label(${JSON.stringify(i.label)}, ${u(i.contents)})`;if(i.type===q)return "cursor";throw new Error("Unknown doc type "+i.type)}function n(i){if(typeof i!="symbol")return JSON.stringify(String(i));if(i in t)return t[i];let s=i.description||"symbol";for(let o=0;;o++){let a=s+(o>0?` #${o}`:"");if(!r.has(a))return r.add(a),t[i]=`Symbol.for(${JSON.stringify(a)})`}}}function _u(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Vu(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function Ru(e){if(!e)return 0;if(!Lu.test(e))return e.length;e=e.replace(Wu()," ");let t=0;for(let r of e){let u=r.codePointAt(0);u<=31||u>=127&&u<=159||u>=768&&u<=879||(t+=Mu(u)?1:2);}return t}function ir(){return {value:"",length:0,queue:[]}}function zu(e,t){return Le(e,{type:"indent"},t)}function Gu(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||ir():t<0?Le(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:Le(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function Le(e,t,r){let u=t.type==="dedent"?e.queue.slice(0,-1):[...e.queue,t],n="",i=0,s=0,o=0;for(let d of u)switch(d.type){case "indent":D(),r.useTabs?a(1):l(r.tabWidth);break;case "stringAlign":D(),n+=d.n,i+=d.n.length;break;case "numberAlign":s+=1,o+=d.n;break;default:throw new Error(`Unexpected type '${d.type}'`)}return p(),{...e,value:n,length:i,queue:u};function a(d){n+=" ".repeat(d),i+=r.tabWidth*d;}function l(d){n+=" ".repeat(d),i+=d;}function D(){r.useTabs?f():p();}function f(){s>0&&a(s),c();}function p(){o>0&&l(o),c();}function c(){s=0,o=0;}}function Re(e){let t=0,r=0,u=e.length;e:for(;u--;){let n=e[u];if(n===ue){r++;continue}for(let i=n.length-1;i>=0;i--){let s=n[i];if(s===" "||s===" ")t++;else {e[u]=n.slice(0,i+1);break e}}}if(t>0||r>0)for(e.length=u+1;r-- >0;)e.push(ue);return t}function Ce(e,t,r,u,n,i){if(r===Number.POSITIVE_INFINITY)return true;let s=t.length,o=[e],a=[];for(;r>=0;){if(o.length===0){if(s===0)return true;o.push(t[--s]);continue}let{mode:l,doc:D}=o.pop(),f=re(D);switch(f){case te:a.push(D),r-=et(D);break;case j:case P:{let p=f===j?D:D.parts,c=D[Me]??0;for(let d=p.length-1;d>=c;d--)o.push({mode:l,doc:p[d]});break}case W:case _:case M:case T:o.push({mode:l,doc:D.contents});break;case V:r+=Re(a);break;case S:{if(i&&D.break)return false;let p=D.break?k:l,c=D.expandedStates&&p===k?b(false,D.expandedStates,-1):D.contents;o.push({mode:p,doc:c});break}case x:{let p=(D.groupId?n[D.groupId]||$:l)===k?D.breakContents:D.flatContents;p&&o.push({mode:l,doc:p});break}case w:if(l===k||D.hard)return true;D.soft||(a.push(" "),r--);break;case L:u=true;break;case R:if(u)return false;break}}return false}function Be(e,t){let r={},u=t.printWidth,n=Ke(t.endOfLine),i=0,s=[{ind:ir(),mode:k,doc:e}],o=[],a=false,l=[],D=0;for(mu(e);s.length>0;){let{ind:p,mode:c,doc:d}=s.pop();switch(re(d)){case te:{let h=n!==`
|
|
12
|
+
`?ke(false,d,`
|
|
13
|
+
`,n):d;o.push(h),s.length>0&&(i+=et(h));break}case j:for(let h=d.length-1;h>=0;h--)s.push({ind:p,mode:c,doc:d[h]});break;case q:if(D>=2)throw new Error("There are too many 'cursor' in doc.");o.push(ue),D++;break;case W:s.push({ind:zu(p,t),mode:c,doc:d.contents});break;case _:s.push({ind:Gu(p,d.n,t),mode:c,doc:d.contents});break;case V:i-=Re(o);break;case S:switch(c){case $:if(!a){s.push({ind:p,mode:d.break?k:$,doc:d.contents});break}case k:{a=false;let h={ind:p,mode:$,doc:d.contents},m=u-i,F=l.length>0;if(!d.break&&Ce(h,s,m,F,r))s.push(h);else if(d.expandedStates){let y=b(false,d.expandedStates,-1);if(d.break){s.push({ind:p,mode:k,doc:y});break}else for(let C=1;C<d.expandedStates.length+1;C++)if(C>=d.expandedStates.length){s.push({ind:p,mode:k,doc:y});break}else {let E=d.expandedStates[C],g={ind:p,mode:$,doc:E};if(Ce(g,s,m,F,r)){s.push(g);break}}}else s.push({ind:p,mode:k,doc:d.contents});break}}d.id&&(r[d.id]=b(false,s,-1).mode);break;case P:{let h=u-i,m=d[Me]??0,{parts:F}=d,y=F.length-m;if(y===0)break;let C=F[m+0],E=F[m+1],g={ind:p,mode:$,doc:C},v={ind:p,mode:k,doc:C},B=Ce(g,[],h,l.length>0,r,true);if(y===1){B?s.push(g):s.push(v);break}let U={ind:p,mode:$,doc:E},De={ind:p,mode:k,doc:E};if(y===2){B?s.push(U,g):s.push(De,v);break}let Vr=F[m+2],Oe={ind:p,mode:c,doc:{...d,[Me]:m+2}};Ce({ind:p,mode:$,doc:[C,E,Vr]},[],h,l.length>0,r,true)?s.push(Oe,U,g):B?s.push(Oe,De,g):s.push(Oe,De,v);break}case x:case M:{let h=d.groupId?r[d.groupId]:c;if(h===k){let m=d.type===x?d.breakContents:d.negate?d.contents:we(d.contents);m&&s.push({ind:p,mode:c,doc:m});}if(h===$){let m=d.type===x?d.flatContents:d.negate?we(d.contents):d.contents;m&&s.push({ind:p,mode:c,doc:m});}break}case L:l.push({ind:p,mode:c,doc:d.contents});break;case R:l.length>0&&s.push({ind:p,mode:c,doc:Qe});break;case w:switch(c){case $:if(d.hard)a=true;else {d.soft||(o.push(" "),i+=1);break}case k:if(l.length>0){s.push({ind:p,mode:c,doc:d},...l.reverse()),l.length=0;break}d.literal?p.root?(o.push(n,p.root.value),i=p.root.length):(o.push(n),i=0):(i-=Re(o),o.push(n+p.value),i=p.length);break}break;case T:s.push({ind:p,mode:c,doc:d.contents});break;case A:break;default:throw new ie(d)}s.length===0&&l.length>0&&(s.push(...l.reverse()),l.length=0);}let f=o.indexOf(ue);if(f!==-1){let p=o.indexOf(ue,f+1);if(p===-1)return {formatted:o.filter(m=>m!==ue).join("")};let c=o.slice(0,f).join(""),d=o.slice(f+1,p).join(""),h=o.slice(p+1).join("");return {formatted:c+d+h,cursorNodeStart:c.length,cursorNodeText:d}}return {formatted:o.join("")}}function qu(e,t,r=0){let u=0;for(let n=r;n<e.length;++n)e[n]===" "?u=u+t-u%t:u++;return u}function Hu(e){return e!==null&&typeof e=="object"}function*Ae(e,t){let{getVisitorKeys:r,filter:u=()=>true}=t,n=i=>Ku(i)&&u(i);for(let i of r(e)){let s=e[i];if(Array.isArray(s))for(let o of s)n(o)&&(yield o);else n(s)&&(yield s);}}function*Xu(e,t){let r=[e];for(let u=0;u<r.length;u++){let n=r[u];for(let i of Ae(n,t))yield i,r.push(i);}}function Yu(e,t){return Ae(e,t).next().done}function he(e){return (t,r,u)=>{let n=!!(u!=null&&u.backwards);if(r===false)return false;let{length:i}=t,s=r;for(;s>=0&&s<i;){let o=t.charAt(s);if(e instanceof RegExp){if(!e.test(o))return s}else if(!e.includes(o))return s;n?s--:s++;}return s===-1||s===i?s:false}}function Qu(e,t,r){let u=!!(r!=null&&r.backwards);if(t===false)return false;let n=e.charAt(t);if(u){if(e.charAt(t-1)==="\r"&&n===`
|
|
14
14
|
`)return t-2;if(n===`
|
|
15
15
|
`||n==="\r"||n==="\u2028"||n==="\u2029")return t-1}else {if(n==="\r"&&e.charAt(t+1)===`
|
|
16
16
|
`)return t+2;if(n===`
|
|
17
|
-
`||n==="\r"||n==="\u2028"||n==="\u2029")return t+1}return t}function
|
|
17
|
+
`||n==="\r"||n==="\u2028"||n==="\u2029")return t+1}return t}function en(e,t,r={}){let u=G(e,r.backwards?t-1:t,r),n=ee(e,u,r);return u!==n}function tn(e){return Array.isArray(e)&&e.length>0}function nn(e){return e?t=>e(t,lr):un}function sn(e){let t=e.type||e.kind||"(unknown type)",r=String(e.name||e.id&&(typeof e.id=="object"?e.id.name:e.id)||e.key&&(typeof e.key=="object"?e.key.name:e.key)||e.value&&(typeof e.value=="object"?"":String(e.value))||e.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),t+(r?" "+r:"")}function rt(e,t){(e.comments??(e.comments=[])).push(t),t.printed=false,t.nodeDescription=sn(e);}function de(e,t){t.leading=true,t.trailing=false,rt(e,t);}function X(e,t,r){t.leading=false,t.trailing=false,r&&(t.marker=r),rt(e,t);}function fe(e,t){t.leading=false,t.trailing=true,rt(e,t);}function ut(e,t){if(Pe.has(e))return Pe.get(e);let{printer:{getCommentChildNodes:r,canAttachComment:u,getVisitorKeys:n},locStart:i,locEnd:s}=t;if(!u)return [];let o=(r?.(e,t)??[...Ae(e,{getVisitorKeys:$e(n)})]).flatMap(a=>u(a)?[a]:ut(a,t));return o.sort((a,l)=>i(a)-i(l)||s(a)-s(l)),Pe.set(e,o),o}function Dr(e,t,r,u){let{locStart:n,locEnd:i}=r,s=n(t),o=i(t),a=ut(e,r),l,D,f=0,p=a.length;for(;f<p;){let c=f+p>>1,d=a[c],h=n(d),m=i(d);if(h<=s&&o<=m)return Dr(d,t,r,d);if(m<=s){l=d,f=c+1;continue}if(o<=h){D=d,p=c;continue}throw new Error("Comment location overlaps with node location")}if(u?.type==="TemplateLiteral"){let{quasis:c}=u,d=Ie(c,t,r);l&&Ie(c,l,r)!==d&&(l=null),D&&Ie(c,D,r)!==d&&(D=null);}return {enclosingNode:u,precedingNode:l,followingNode:D}}function on(e,t){let{comments:r}=e;if(delete e.comments,!rn(r)||!t.printer.canAttachComment)return;let u=[],{printer:{experimentalFeatures:{avoidAstMutation:n=false}={},handleComments:i={}},originalText:s}=t,{ownLine:o=Te,endOfLine:a=Te,remaining:l=Te}=i,D=r.map((f,p)=>({...Dr(e,f,t),comment:f,text:s,options:t,ast:e,isLastComment:r.length-1===p}));for(let[f,p]of D.entries()){let{comment:c,precedingNode:d,enclosingNode:h,followingNode:m,text:F,options:y,ast:C,isLastComment:E}=p,g;if(n?g=[p]:(c.enclosingNode=h,c.precedingNode=d,c.followingNode=m,g=[c,F,y,C,E]),an(F,y,D,f))c.placement="ownLine",o(...g)||(m?de(m,c):d?fe(d,c):X(h||C,c));else if(ln(F,y,D,f))c.placement="endOfLine",a(...g)||(d?fe(d,c):m?de(m,c):X(h||C,c));else if(c.placement="remaining",!l(...g))if(d&&m){let v=u.length;v>0&&u[v-1].followingNode!==m&&yt(u,y),u.push(p);}else d?fe(d,c):m?de(m,c):X(h||C,c);}if(yt(u,t),!n)for(let f of r)delete f.precedingNode,delete f.enclosingNode,delete f.followingNode;}function an(e,t,r,u){let{comment:n,precedingNode:i}=r[u],{locStart:s,locEnd:o}=t,a=s(n);if(i)for(let l=u-1;l>=0;l--){let{comment:D,precedingNode:f}=r[l];if(f!==i||!pr(e.slice(o(D),a)))break;a=s(D);}return z(e,a,{backwards:true})}function ln(e,t,r,u){let{comment:n,followingNode:i}=r[u],{locStart:s,locEnd:o}=t,a=o(n);if(i)for(let l=u+1;l<r.length;l++){let{comment:D,followingNode:f}=r[l];if(f!==i||!pr(e.slice(a,s(D))))break;a=o(D);}return z(e,a)}function yt(e,t){var r,u;let n=e.length;if(n===0)return;let{precedingNode:i,followingNode:s}=e[0],o=t.locStart(s),a;for(a=n;a>0;--a){let{comment:l,precedingNode:D,followingNode:f}=e[a-1];Ge.strictEqual(D,i),Ge.strictEqual(f,s);let p=t.originalText.slice(t.locEnd(l),o);if(((u=(r=t.printer).isGap)==null?void 0:u.call(r,p,t))??/^[\s(]*$/u.test(p))o=t.locStart(l);else break}for(let[l,{comment:D}]of e.entries())l<a?fe(i,D):de(s,D);for(let l of [i,s])l.comments&&l.comments.length>1&&l.comments.sort((D,f)=>t.locStart(D)-t.locStart(f));e.length=0;}function Ie(e,t,r){let u=r.locStart(t)-1;for(let n=1;n<e.length;++n)if(u<r.locStart(e[n]))return n-1;return 0}function Dn(e,t){let r=t-1;r=G(e,r,{backwards:true}),r=ee(e,r,{backwards:true}),r=G(e,r,{backwards:true});let u=ee(e,r,{backwards:true});return r!==u}function cr(e,t){let r=e.node;return r.printed=true,t.printer.printComment(e,t)}function pn(e,t){var r;let u=e.node,n=[cr(e,t)],{printer:i,originalText:s,locStart:o,locEnd:a}=t;if((r=i.isBlockComment)!=null&&r.call(i,u)){let D=z(s,a(u))?z(s,o(u),{backwards:true})?Q:tr:" ";n.push(D);}else n.push(Q);let l=ee(s,G(s,a(u)));return l!==false&&z(s,l)&&n.push(Q),n}function cn(e,t,r){var u;let n=e.node,i=cr(e,t),{printer:s,originalText:o,locStart:a}=t,l=(u=s.isBlockComment)==null?void 0:u.call(s,n);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||z(o,a(n),{backwards:true})){let D=nt(o,a(n));return {doc:Ve([Q,D?Q:"",i]),isBlock:l,hasLineSuffix:true}}return !l||r!=null&&r.hasLineSuffix?{doc:[Ve([" ",i]),xe],isBlock:l,hasLineSuffix:true}:{doc:[" ",i],isBlock:l,hasLineSuffix:false}}function dn(e,t){let r=e.node;if(!r)return {};let u=t[Symbol.for("printedComments")];if((r.comments||[]).filter(o=>!u.has(o)).length===0)return {leading:"",trailing:""};let n=[],i=[],s;return e.each(()=>{let o=e.node;if(u!=null&&u.has(o))return;let{leading:a,trailing:l}=o;a?n.push(pn(e,t)):l&&(s=cn(e,t,s),i.push(s.doc));},"comments"),{leading:n,trailing:i}}function fn(e,t,r){let{leading:u,trailing:n}=dn(e,r);return !u&&!n?t:Ee(t,i=>[u,i,n])}function hn(e){let{[Symbol.for("comments")]:t,[Symbol.for("printedComments")]:r}=e;for(let u of t){if(!u.printed&&!r.has(u))throw new Error('Comment "'+u.value.trim()+'" was not printed. Please report this error!');delete u.printed;}}function mn(e){return ()=>{}}function fr({plugins:e=[],showDeprecated:t=false}={}){let r=e.flatMap(n=>n.languages??[]),u=[];for(let n of yn(Object.assign({},...e.map(({options:i})=>i),gn)))!t&&n.deprecated||(Array.isArray(n.choices)&&(t||(n.choices=n.choices.filter(i=>!i.deprecated)),n.name==="parser"&&(n.choices=[...n.choices,...Cn(n.choices,r,e)])),n.pluginDefaults=Object.fromEntries(e.filter(i=>{var s;return ((s=i.defaultOptions)==null?void 0:s[n.name])!==void 0}).map(i=>[i.name,i.defaultOptions[n.name]])),u.push(n));return {languages:r,options:u}}function*Cn(e,t,r){let u=new Set(e.map(n=>n.value));for(let n of t)if(n.parsers){for(let i of n.parsers)if(!u.has(i)){u.add(i);let s=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,i)),o=n.name;s!=null&&s.name&&(o+=` (plugin: ${s.name})`),yield {value:i,description:o};}}}function yn(e){let t=[];for(let[r,u]of Object.entries(e)){let n={name:r,...u};Array.isArray(n.default)&&(n.default=b(false,n.default,-1).value),t.push(n);}return t}function hr(e){if(e=e instanceof URL?e:new URL(e),e.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}function wn(e){return e=hr(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function kn(e){e=hr(e);let t=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!==""&&(t=`\\\\${e.hostname}${t}`),t}function Sn(e){return bn?kn(e):wn(e)}function xt(e,t){if(!t)return;let r=Bn(t).toLowerCase();return e.find(({filenames:u})=>u?.some(n=>n.toLowerCase()===r))??e.find(({extensions:u})=>u?.some(n=>r.endsWith(n)))}function An(e,t){if(t)return e.find(({name:r})=>r.toLowerCase()===t)??e.find(({aliases:r})=>r?.includes(t))??e.find(({extensions:r})=>r?.includes(`.${t}`))}function Bt(e,t){if(t){if(String(t).startsWith("file:"))try{t=xn(t);}catch{return}if(typeof t=="string")return e.find(({isSupported:r})=>r?.({filepath:t}))}}function $n(e,t){let r=vn(false,e.plugins).flatMap(n=>n.languages??[]),u=An(r,t.language)??xt(r,t.physicalFile)??xt(r,t.file)??Bt(r,t.physicalFile)??Bt(r,t.file)??(t.physicalFile,void 0);return u?.parsers[0]}function $t(e,t,r,u){return [`Invalid ${N.red(u.key(e))} value.`,`Expected ${N.blue(r)},`,`but received ${t===Fr?N.gray("nothing"):N.red(u.value(t))}.`].join(" ")}function gr({text:e,list:t},r){let u=[];return e&&u.push(`- ${N.blue(e)}`),t&&u.push([`- ${N.blue(t.title)}:`].concat(t.values.map(n=>gr(n,r-At.length).replace(/^|\n/g,`$&${At}`))).join(`
|
|
18
18
|
`)),Cr(u,r)}function Cr(e,t){if(e.length===1)return e[0];let[r,u]=e,[n,i]=e.map(s=>s.split(`
|
|
19
|
-
`,1)[0].length);return n>t&&n>i?u:r}function
|
|
20
|
-
`+u,e.codeFrame=u,e}throw e}async function
|
|
21
|
-
`,n)+1),a=u.slice(o,n).match(/^\s*/u)[0],l=tt(a,t.tabWidth),D=await Ar(s,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>n&&t.cursorOffset<=i?t.cursorOffset-n:-1,endOfLine:"lf"},l),f=D.formatted.trimEnd(),{cursorOffset:p}=t;p>i?p+=f.length-s.length:D.cursorOffset>=0&&(p=D.cursorOffset+n);let
|
|
22
|
-
`&&(p+=Kt(
|
|
23
|
-
`)),
|
|
24
|
-
`,
|
|
25
|
-
`);r-=o(r),u-=o(u),n-=o(n),e=
|
|
26
|
-
`);return r===-1?0:tt(e.slice(r+1).match(/^[\t ]*/u)[0],t)}function
|
|
27
|
-
`)return true;return false}function
|
|
28
|
-
`,a.gutter(
|
|
29
|
-
`);return o.message&&!
|
|
30
|
-
${h}`),h}e.codeFrameColumns=n;}),Ht={};He(Ht,{__debug:()=>Ir,check:()=>Pr,doc:()=>st,format:()=>dt,formatWithCursor:()=>ct,getSupportInfo:()=>Tr,util:()=>ot,version:()=>Or});Qr=(e,t,r,u)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(r,u):r.global?t.replace(r,u):t.split(r).join(u)},ke=Qr,eu=class{diff(e,t,r={}){let u;typeof r=="function"?(u=r,r={}):"callback"in r&&(u=r.callback);let n=this.castInput(e,r),i=this.castInput(t,r),s=this.removeEmpty(this.tokenize(n,r)),o=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(s,o,r,u)}diffWithOptionsObj(e,t,r,u){var n;let i=F=>{if(F=this.postProcess(F,r),u){setTimeout(function(){u(F);},0);return}else return F},s=t.length,o=e.length,a=1,l=s+o;r.maxEditLength!=null&&(l=Math.min(l,r.maxEditLength));let D=(n=r.timeout)!==null&&n!==void 0?n:1/0,f=Date.now()+D,p=[{oldPos:-1,lastComponent:void 0}],d=this.extractCommon(p[0],t,e,0,r);if(p[0].oldPos+1>=o&&d+1>=s)return i(this.buildValues(p[0].lastComponent,t,e));let c=-1/0,h=1/0,m=()=>{for(let F=Math.max(c,-a);F<=Math.min(h,a);F+=2){let C,y=p[F-1],E=p[F+1];y&&(p[F-1]=void 0);let g=false;if(E){let B=E.oldPos-F;g=E&&0<=B&&B<s;}let v=y&&y.oldPos+1<o;if(!g&&!v){p[F]=void 0;continue}if(!v||g&&y.oldPos<E.oldPos?C=this.addToPath(E,true,false,0,r):C=this.addToPath(y,false,true,1,r),d=this.extractCommon(C,t,e,F,r),C.oldPos+1>=o&&d+1>=s)return i(this.buildValues(C.lastComponent,t,e))||true;p[F]=C,C.oldPos+1>=o&&(h=Math.min(h,F-1)),d+1>=s&&(c=Math.max(c,F+1));}a++;};if(u)(function F(){setTimeout(function(){if(a>l||Date.now()>f)return u(void 0);m()||F();},0);})();else for(;a<=l&&Date.now()<=f;){let F=m();if(F)return F}}addToPath(e,t,r,u,n){let i=e.lastComponent;return i&&!n.oneChangePerToken&&i.added===t&&i.removed===r?{oldPos:e.oldPos+u,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+u,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}}extractCommon(e,t,r,u,n){let i=t.length,s=r.length,o=e.oldPos,a=o-u,l=0;for(;a+1<i&&o+1<s&&this.equals(r[o+1],t[a+1],n);)a++,o++,l++,n.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:false,removed:false});return l&&!n.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:false,removed:false}),e.oldPos=o,a}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return false}buildValues(e,t,r){let u=[],n;for(;e;)u.push(e),n=e.previousComponent,delete e.previousComponent,e=n;u.reverse();let i=u.length,s=0,o=0,a=0;for(;s<i;s++){let l=u[s];if(l.removed)l.value=this.join(r.slice(a,a+l.count)),a+=l.count;else {if(!l.added&&this.useLongestToken){let D=t.slice(o,o+l.count);D=D.map(function(f,p){let d=r[a+p];return d.length>f.length?d:f}),l.value=this.join(D);}else l.value=this.join(t.slice(o,o+l.count));o+=l.count,l.added||(a+=l.count);}}return u}},tu=class extends eu{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}},ru=new tu;te="string",j="array",q="cursor",W="indent",_="align",M="trim",S="group",P="fill",x="if-break",V="indent-if-break",L="line-suffix",R="line-suffix-boundary",w="line",T="label",A="break-parent",Xt=new Set([q,W,_,M,S,P,x,V,L,R,w,T,A]),su=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},b=su;re=au,lu=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);pu=class extends Error{constructor(t){super(Du(t));ge(this,"name","InvalidDocError");this.doc=t;}},ie=pu,Ft={};Xe=cu;Ze=()=>{},O=Ze,Zt=Ze,bu=Ze;Nu={type:R},xe={type:A},Ou={type:M},Qe={type:w,hard:true},er={type:w,hard:true,literal:true},tr={type:w},Pu={type:w,soft:true},Q=[Qe,xe],rr=[er,xe],Z={type:q};ju=()=>/[#*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](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\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(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\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](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\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-\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[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;Mu=e=>!(Wu(e)||_u(e)),Vu=/[^\x20-\x7F]/u;et=Lu,k=Symbol("MODE_BREAK"),$=Symbol("MODE_FLAT"),ue=Symbol("cursor"),Ve=Symbol("DOC_FILL_PRINTED_LENGTH");tt=Gu,qu=class{constructor(e){Yr(this,K),this.stack=[e];}get key(){let{stack:e,siblings:t}=this;return b(false,e,t===null?-2:-4)??null}get index(){return this.siblings===null?null:b(false,this.stack,-2)}get node(){return b(false,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=b(false,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 [...pe(this,K,ve).call(this)]}getName(){let{stack:e}=this,{length:t}=e;return t>1?b(false,e,-2):null}getValue(){return b(false,this.stack,-1)}getNode(e=0){let t=pe(this,K,ze).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:u}=r,n=b(false,r,-1);for(let i of t)n=n[i],r.push(i,n);try{return e(this)}finally{r.length=u;}}callParent(e,t=0){let r=pe(this,K,ze).call(this,t+1),u=this.stack.splice(r+1);try{return e(this)}finally{this.stack.push(...u);}}each(e,...t){let{stack:r}=this,{length:u}=r,n=b(false,r,-1);for(let i of t)n=n[i],r.push(i,n);try{for(let i=0;i<n.length;++i)r.push(i,n[i]),e(this,i,n),r.length-=2;}finally{r.length=u;}}map(e,...t){let r=[];return this.each((u,n,i)=>{r[n]=e(u,n,i);},...t),r}match(...e){let t=this.stack.length-1,r=null,u=this.stack[t--];for(let n of e){if(u===void 0)return false;let i=null;if(typeof r=="number"&&(i=r,r=this.stack[t--],u=this.stack[t--]),n&&!n(u,r,i))return false;r=this.stack[t--],u=this.stack[t--];}return true}findAncestor(e){for(let t of pe(this,K,ve).call(this))if(e(t))return t}hasAncestor(e){for(let t of pe(this,K,ve).call(this))if(e(t))return true;return false}};K=new WeakSet,ze=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},ve=function*(){let{stack:e}=this;for(let t=e.length-3;t>=0;t-=2){let r=e[t];Array.isArray(r)||(yield r);}};Ju=qu,sr=new Proxy(()=>{},{get:()=>sr}),Ge=sr;Hu=Uu;Yu=he(/\s/u),G=he(" "),or=he(",; "),ar=he(/[^\n\r]/u);ee=Zu;z=Qu;tn=en,lr=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),rn=e=>Object.keys(e).filter(t=>!lr.has(t));$e=un;Pe=new WeakMap;Te=()=>false;pr=e=>!/[\S\n\u2028\u2029]/u.test(e);nt=ln;mn=hn,dr=class extends Error{constructor(){super(...arguments);ge(this,"name","ConfigError");}},Et=class extends Error{constructor(){super(...arguments);ge(this,"name","UndefinedParserError");}},Fn={checkIgnorePragma:{category:"Special",type:"boolean",default:false,description:"Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",cliCategory:"Other"},cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:"Print (to stderr) where a cursor at the given position would move to after formatting.",cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
|
|
19
|
+
`,1)[0].length);return n>t&&n>i?u:r}function Tn(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let u=e.length,n=t.length;for(;u>0&&e.charCodeAt(~-u)===t.charCodeAt(~-n);)u--,n--;let i=0;for(;i<u&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(u-=i,n-=i,u===0)return n;let s,o,a,l,D=0,f=0;for(;D<u;)Nt[D]=e.charCodeAt(i+D),je[D]=++D;for(;f<n;)for(s=t.charCodeAt(i+f),a=f++,o=f,D=0;D<u;D++)l=s===Nt[D]?a:a+1,a=je[D],o=je[D]=a>o?l>o?o+1:l:l>a?a+1:l;return o}function jn(e,t){let r=new e(t),u=Object.create(r);for(let n of In)n in t&&(u[n]=Wn(t[n],r,J.prototype[n].length));return u}function Wn(e,t,r){return typeof e=="function"?(...u)=>e(...u.slice(0,r-1),t,...u.slice(r-1)):()=>e}function Ot({from:e,to:t}){return {from:[e],to:t}}function Rn(e,t){let r=Object.create(null);for(let u of e){let n=u[t];if(r[n])throw new Error(`Duplicate ${t} ${JSON.stringify(n)}`);r[n]=u;}return r}function zn(e,t){let r=new Map;for(let u of e){let n=u[t];if(r.has(n))throw new Error(`Duplicate ${t} ${JSON.stringify(n)}`);r.set(n,u);}return r}function Gn(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?true:(e[r]=true,false)}}function qn(e,t){let r=[],u=[];for(let n of e)t(n)?r.push(n):u.push(n);return [r,u]}function Jn(e){return e===Math.floor(e)}function Un(e,t){if(e===t)return 0;let r=typeof e,u=typeof t,n=["undefined","object","boolean","number","string"];return r!==u?n.indexOf(r)-n.indexOf(u):r!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Hn(e){return (...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function Pt(e){return e===void 0?{}:e}function Er(e){if(typeof e=="string")return {text:e};let{text:t,list:r}=e;return Kn((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(Er)}}:{text:t}}function Tt(e,t){return e===true?true:e===false?{value:t}:e}function It(e,t,r=false){return e===false?false:e===true?r?true:[{value:t}]:"value"in e?[e]:e.length===0?false:e}function jt(e,t){return typeof e=="string"||"key"in e?{from:t,to:e}:"from"in e?{from:e.from,to:e.to}:{from:t,to:e.to}}function qe(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>jt(r,t)):[jt(e,t)]}function Wt(e,t){let r=qe(typeof e=="object"&&"redirect"in e?e.redirect:e,t);return r.length===0?{remain:t,redirect:r}:typeof e=="object"&&"remain"in e?{remain:e.remain,redirect:r}:{redirect:r}}function Kn(e,t){if(!e)throw new Error(t)}function ni(e,t,{logger:r=false,isCLI:u=false,passThrough:n=false,FlagSchema:i,descriptor:s}={}){if(u){if(!i)throw new Error("'FlagSchema' option is required.");if(!s)throw new Error("'descriptor' option is required.")}else s=ne;let o=n?Array.isArray(n)?(p,c)=>n.includes(p)?{[p]:c}:void 0:(p,c)=>({[p]:c}):(p,c,d)=>{let{_:h,...m}=d.schemas;return yr(p,c,{...d,schemas:m})},a=ii(t,{isCLI:u,FlagSchema:i}),l=new ui(a,{logger:r,unknown:o,descriptor:s}),D=r!==false;D&&We&&(l._hasDeprecationWarned=We);let f=l.normalize(e);return D&&(We=l._hasDeprecationWarned),f}function ii(e,{isCLI:t,FlagSchema:r}){let u=[];t&&u.push(Vn.create({name:"_"}));for(let n of e)u.push(si(n,{isCLI:t,optionInfos:e,FlagSchema:r})),n.alias&&t&&u.push(_n.create({name:n.alias,sourceName:n.name}));return u}function si(e,{isCLI:t,optionInfos:r,FlagSchema:u}){let{name:n}=e,i={name:n},s,o={};switch(e.type){case "int":s=Zn,t&&(i.preprocess=Number);break;case "string":s=_t;break;case "choice":s=Xn,i.choices=e.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:e.name,value:a.redirect}}}:a);break;case "boolean":s=Ln;break;case "flag":s=u,i.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case "path":s=_t;break;default:throw new Error(`Unexpected type ${e.type}`)}if(e.exception?i.validate=(a,l,D)=>e.exception(a)||l.validate(a,D):i.validate=(a,l,D)=>a===void 0||l.validate(a,D),e.redirect&&(o.redirect=a=>a?{to:typeof e.redirect=="string"?e.redirect:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(o.deprecated=true),t&&!e.array){let a=i.preprocess||(l=>l);i.preprocess=(l,D,f)=>D.preprocess(a(Array.isArray(l)?b(false,l,-1):l),f);}return e.array?Mn.create({...t?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...o,valueSchema:s.create(i)}):s.create({...i,...o})}function br(e,t){if(!t)throw new Error("parserName is required.");let r=vr(false,e,n=>n.parsers&&Object.prototype.hasOwnProperty.call(n.parsers,t));if(r)return r;let u=`Couldn't resolve parser "${t}".`;throw u+=" Plugins must be explicitly added to the standalone bundle.",new dr(u)}function li(e,t){if(!t)throw new Error("astFormat is required.");let r=vr(false,e,n=>n.printers&&Object.prototype.hasOwnProperty.call(n.printers,t));if(r)return r;let u=`Couldn't find plugin for AST format "${t}".`;throw u+=" Plugins must be explicitly added to the standalone bundle.",new dr(u)}function it({plugins:e,parser:t}){let r=br(e,t);return wr(r,t)}function wr(e,t){let r=e.parsers[t];return typeof r=="function"?r():r}function Di(e,t){let r=e.printers[t];return typeof r=="function"?r():r}async function pi(e,t={}){var r;let u={...e};if(!u.parser)if(u.filepath){if(u.parser=Nn(u,{physicalFile:u.filepath}),!u.parser)throw new Et(`No parser could be inferred for file "${u.filepath}".`)}else throw new Et("No parser and no file path given, couldn't infer a parser.");let n=fr({plugins:e.plugins,showDeprecated:true}).options,i={...Vt,...Object.fromEntries(n.filter(p=>p.default!==void 0).map(p=>[p.name,p.default]))},s=br(u.plugins,u.parser),o=await wr(s,u.parser);u.astFormat=o.astFormat,u.locEnd=o.locEnd,u.locStart=o.locStart;let a=(r=s.printers)!=null&&r[o.astFormat]?s:li(u.plugins,o.astFormat),l=await Di(a,o.astFormat);u.printer=l;let D=a.defaultOptions?Object.fromEntries(Object.entries(a.defaultOptions).filter(([,p])=>p!==void 0)):{},f={...i,...D};for(let[p,c]of Object.entries(f))(u[p]===null||u[p]===void 0)&&(u[p]=c);return u.parser==="json"&&(u.trailingComma="none"),oi(u,n,{passThrough:Object.keys(Vt),...t})}async function di(e,t){let r=await it(t),u=r.preprocess?r.preprocess(e,t):e;t.originalText=u;let n;try{n=await r.parse(u,t,t);}catch(i){fi(i,e);}return {text:u,ast:n}}function fi(e,t){let{loc:r}=e;if(r){let u=(0, ci.codeFrameColumns)(t,r,{highlightCode:true});throw e.message+=`
|
|
20
|
+
`+u,e.codeFrame=u,e}throw e}async function hi(e,t,r,u,n){let{embeddedLanguageFormatting:i,printer:{embed:s,hasPrettierIgnore:o=()=>false,getVisitorKeys:a}}=r;if(!s||i!=="auto")return;if(s.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let l=$e(s.getVisitorKeys??a),D=[];c();let f=e.stack;for(let{print:d,node:h,pathStack:m}of D)try{e.stack=m;let F=await d(p,t,e,r);F&&n.set(h,F);}catch(F){if(globalThis.PRETTIER_DEBUG)throw F}e.stack=f;function p(d,h){return mi(d,h,r,u)}function c(){let{node:d}=e;if(d===null||typeof d!="object"||o(e))return;for(let m of l(d))Array.isArray(d[m])?e.each(c,m):e.call(c,m);let h=s(e,r);if(h){if(typeof h=="function"){D.push({print:h,node:d,pathStack:[...e.stack]});return}n.set(d,h);}}}async function mi(e,t,r,u){let n=await oe({...r,...t,parentParser:r.parser,originalText:e,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:true}),{ast:i}=await me(e,n),s=await u(i,n);return Yt(s)}function Fi(e,t){let{originalText:r,[Symbol.for("comments")]:u,locStart:n,locEnd:i,[Symbol.for("printedComments")]:s}=t,{node:o}=e,a=n(o),l=i(o);for(let D of u)n(D)>=a&&i(D)<=l&&s.add(D);return r.slice(a,l)}async function Ne(e,t){({ast:e}=await kr(e,t));let r=new Map,u=new Uu(e),n=Fn(t),i=new Map;await hi(u,o,t,Ne,i);let s=await Mt(u,t,o,void 0,i);if(hn(t),t.cursorOffset>=0){if(t.nodeAfterCursor&&!t.nodeBeforeCursor)return [Z,s];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return [s,Z]}return s;function o(l,D){return l===void 0||l===u?a(D):Array.isArray(l)?u.call(()=>a(D),...l):u.call(()=>a(D),l)}function a(l){n(u);let D=u.node;if(D==null)return "";let f=D&&typeof D=="object"&&l===void 0;if(f&&r.has(D))return r.get(D);let p=Mt(u,t,o,l,i);return f&&r.set(D,p),p}}function Mt(e,t,r,u,n){var i;let{node:s}=e,{printer:o}=t,a;switch((i=o.hasPrettierIgnore)!=null&&i.call(o,e)?a=gi(e,t):n.has(s)?a=n.get(s):a=o.print(e,t,r,u),s){case t.cursorNode:a=Ee(a,l=>[Z,l,Z]);break;case t.nodeBeforeCursor:a=Ee(a,l=>[l,Z]);break;case t.nodeAfterCursor:a=Ee(a,l=>[Z,l]);break}return o.printComment&&(!o.willPrintOwnComments||!o.willPrintOwnComments(e,t))&&(a=fn(e,a,t)),a}async function kr(e,t){let r=e.comments??[];t[Symbol.for("comments")]=r,t[Symbol.for("printedComments")]=new Set,on(e,t);let{printer:{preprocess:u}}=t;return e=u?await u(e,t):e,{ast:e,comments:r}}function Ci(e,t){let{cursorOffset:r,locStart:u,locEnd:n}=t,i=$e(t.printer.getVisitorKeys),s=c=>u(c)<=r&&n(c)>=r,o=e,a=[e];for(let c of Xu(e,{getVisitorKeys:i,filter:s}))a.push(c),o=c;if(Yu(o,{getVisitorKeys:i}))return {cursorNode:o};let l,D,f=-1,p=Number.POSITIVE_INFINITY;for(;a.length>0&&(l===void 0||D===void 0);){o=a.pop();let c=l!==void 0,d=D!==void 0;for(let h of Ae(o,{getVisitorKeys:i})){if(!c){let m=n(h);m<=r&&m>f&&(l=h,f=m);}if(!d){let m=u(h);m>=r&&m<p&&(D=h,p=m);}}}return {nodeBeforeCursor:l,nodeAfterCursor:D}}function yi(e,t){let{printer:{massageAstNode:r,getVisitorKeys:u}}=t;if(!r)return e;let n=$e(u),i=r.ignoredProperties??new Set;return s(e);function s(o,a){if(!(o!==null&&typeof o=="object"))return o;if(Array.isArray(o))return o.map(p=>s(p,a)).filter(Boolean);let l={},D=new Set(n(o));for(let p in o)!Object.prototype.hasOwnProperty.call(o,p)||i.has(p)||(D.has(p)?l[p]=s(o[p],o):l[p]=o[p]);let f=r(o,l,a);if(f!==null)return f??l}}function ki(e,t){let r=[e.node,...e.parentNodes],u=new Set([t.node,...t.parentNodes]);return r.find(n=>xr.has(n.type)&&u.has(n))}function Lt(e){let t=bi(false,e,r=>r.type!=="Program"&&r.type!=="File");return t===-1?e:e.slice(0,t+1)}function Si(e,t,{locStart:r,locEnd:u}){let n=e.node,i=t.node;if(n===i)return {startNode:n,endNode:i};let s=r(e.node);for(let a of Lt(t.parentNodes))if(r(a)>=s)i=a;else break;let o=u(t.node);for(let a of Lt(e.parentNodes)){if(u(a)<=o)n=a;else break;if(n===i)break}return {startNode:n,endNode:i}}function Je(e,t,r,u,n=[],i){let{locStart:s,locEnd:o}=r,a=s(e),l=o(e);if(!(t>l||t<a||i==="rangeEnd"&&t===a||i==="rangeStart"&&t===l)){for(let D of ut(e,r)){let f=Je(D,t,r,u,[e,...n],i);if(f)return f}if(!u||u(e,n[0]))return {node:e,parentNodes:n}}}function xi(e,t){return t!=="DeclareExportDeclaration"&&e!=="TypeParameterDeclaration"&&(e==="Directive"||e==="TypeAlias"||e==="TSExportAssignment"||e.startsWith("Declare")||e.startsWith("TSDeclare")||e.endsWith("Statement")||e.endsWith("Declaration"))}function Rt(e,t,r){if(!t)return false;switch(e.parser){case "flow":case "hermes":case "babel":case "babel-flow":case "babel-ts":case "typescript":case "acorn":case "espree":case "meriyah":case "oxc":case "oxc-ts":case "__babel_estree":return xi(t.type,r?.type);case "json":case "json5":case "jsonc":case "json-stringify":return xr.has(t.type);case "graphql":return Bi.has(t.kind);case "vue":return t.tag!=="root"}return false}function Ai(e,t,r){let{rangeStart:u,rangeEnd:n,locStart:i,locEnd:s}=t;Ge.ok(n>u);let o=e.slice(u,n).search(/\S/u),a=o===-1;if(!a)for(u+=o;n>u&&!/\S/u.test(e[n-1]);--n);let l=Je(r,u,t,(c,d)=>Rt(t,c,d),[],"rangeStart"),D=a?l:Je(r,n,t,c=>Rt(t,c),[],"rangeEnd");if(!l||!D)return {rangeStart:0,rangeEnd:0};let f,p;if(wi(t)){let c=ki(l,D);f=c,p=c;}else ({startNode:f,endNode:p}=Si(l,D,t));return {rangeStart:Math.min(i(f),i(p)),rangeEnd:Math.max(s(f),s(p))}}async function Ar(e,t,r=0){if(!e||e.trim().length===0)return {formatted:"",cursorOffset:-1,comments:[]};let{ast:u,text:n}=await me(e,t);t.cursorOffset>=0&&(t={...t,...Sr(u,t)});let i=await Ne(u,t);r>0&&(i=nr([Q,i],r,t.tabWidth));let s=Be(i,t);if(r>0){let a=s.formatted.trim();s.cursorNodeStart!==void 0&&(s.cursorNodeStart-=s.formatted.indexOf(a),s.cursorNodeStart<0&&(s.cursorNodeStart=0,s.cursorNodeText=s.cursorNodeText.trimStart()),s.cursorNodeStart+s.cursorNodeText.length>a.length&&(s.cursorNodeText=s.cursorNodeText.trimEnd())),s.formatted=a+Ke(t.endOfLine);}let o=t[Symbol.for("comments")];if(t.cursorOffset>=0){let a,l,D,f;if((t.cursorNode||t.nodeBeforeCursor||t.nodeAfterCursor)&&s.cursorNodeText)if(D=s.cursorNodeStart,f=s.cursorNodeText,t.cursorNode)a=t.locStart(t.cursorNode),l=n.slice(a,t.locEnd(t.cursorNode));else {if(!t.nodeBeforeCursor&&!t.nodeAfterCursor)throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");a=t.nodeBeforeCursor?t.locEnd(t.nodeBeforeCursor):0;let F=t.nodeAfterCursor?t.locStart(t.nodeAfterCursor):n.length;l=n.slice(a,F);}else a=0,l=n,D=0,f=s.formatted;let p=t.cursorOffset-a;if(l===f)return {formatted:s.formatted,cursorOffset:D+p,comments:o};let c=l.split("");c.splice(p,0,zt);let d=f.split(""),h=nu(c,d),m=D;for(let F of h)if(F.removed){if(F.value.includes(zt))break}else m+=F.count;return {formatted:s.formatted,cursorOffset:m,comments:o}}return {formatted:s.formatted,cursorOffset:-1,comments:o}}async function $i(e,t){let{ast:r,text:u}=await me(e,t),{rangeStart:n,rangeEnd:i}=Ai(u,t,r),s=u.slice(n,i),o=Math.min(n,u.lastIndexOf(`
|
|
21
|
+
`,n)+1),a=u.slice(o,n).match(/^\s*/u)[0],l=tt(a,t.tabWidth),D=await Ar(s,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>n&&t.cursorOffset<=i?t.cursorOffset-n:-1,endOfLine:"lf"},l),f=D.formatted.trimEnd(),{cursorOffset:p}=t;p>i?p+=f.length-s.length:D.cursorOffset>=0&&(p=D.cursorOffset+n);let c=u.slice(0,n)+f+u.slice(i);if(t.endOfLine!=="lf"){let d=Ke(t.endOfLine);p>=0&&d===`\r
|
|
22
|
+
`&&(p+=Kt(c.slice(0,p),`
|
|
23
|
+
`)),c=ke(false,c,`
|
|
24
|
+
`,d);}return {formatted:c,cursorOffset:p,comments:D.comments}}function _e(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function Gt(e,t){let{cursorOffset:r,rangeStart:u,rangeEnd:n}=t;return r=_e(e,r,-1),u=_e(e,u,0),n=_e(e,n,e.length),{...t,cursorOffset:r,rangeStart:u,rangeEnd:n}}function $r(e,t){let{cursorOffset:r,rangeStart:u,rangeEnd:n,endOfLine:i}=Gt(e,t),s=e.charAt(0)===Br;if(s&&(e=e.slice(1),r--,u--,n--),i==="auto"&&(i=iu(e)),e.includes("\r")){let o=a=>Kt(e.slice(0,Math.max(a,0)),`\r
|
|
25
|
+
`);r-=o(r),u-=o(u),n-=o(n),e=su(e);}return {hasBOM:s,text:e,options:Gt(e,{...t,cursorOffset:r,rangeStart:u,rangeEnd:n,endOfLine:i})}}async function qt(e,t){let r=await it(t);return !r.hasPragma||r.hasPragma(e)}async function Ni(e,t){var r;let u=await it(t);return (r=u.hasIgnorePragma)==null?void 0:r.call(u,e)}async function Nr(e,t){let{hasBOM:r,text:u,options:n}=$r(e,await oe(t));if(n.rangeStart>=n.rangeEnd&&u!==""||n.requirePragma&&!await qt(u,n)||n.checkIgnorePragma&&await Ni(u,n))return {formatted:e,cursorOffset:t.cursorOffset,comments:[]};let i;return n.rangeStart>0||n.rangeEnd<u.length?i=await $i(u,n):(!n.requirePragma&&n.insertPragma&&n.printer.insertPragma&&!await qt(u,n)&&(u=n.printer.insertPragma(u)),i=await Ar(u,n)),r&&(i.formatted=Br+i.formatted,i.cursorOffset>=0&&i.cursorOffset++),i}async function Oi(e,t,r){let{text:u,options:n}=$r(e,await oe(t)),i=await me(u,n);return r&&(r.preprocessForPrint&&(i.ast=await kr(i.ast,n)),r.massage&&(i.ast=Ei(i.ast,n))),i}async function Pi(e,t){t=await oe(t);let r=await Ne(e,t);return Be(r,t)}async function Ti(e,t){let r=ju(e),{formatted:u}=await Nr(r,{...t,parser:"__js_expression"});return u}async function Ii(e,t){t=await oe(t);let{ast:r}=await me(e,t);return t.cursorOffset>=0&&(t={...t,...Sr(r,t)}),Ne(r,t)}async function ji(e,t){return Be(e,await oe(t))}function Mi(e,t){if(t===false)return false;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}function Li(e,t){return t===false?false:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?ar(e,t):t}function Ri(e,t){let r=null,u=t;for(;u!==r;)r=u,u=G(e,u),u=at(e,u),u=lt(e,u),u=ee(e,u);return u}function zi(e,t){let r=null,u=t;for(;u!==r;)r=u,u=or(e,u),u=at(e,u),u=G(e,u);return u=lt(e,u),u=ee(e,u),u!==false&&z(e,u)}function Gi(e,t){let r=e.lastIndexOf(`
|
|
26
|
+
`);return r===-1?0:tt(e.slice(r+1).match(/^[\t ]*/u)[0],t)}function Ji(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ui(e,t){let r=e.match(new RegExp(`(${Ji(t)})+`,"gu"));return r===null?0:r.reduce((u,n)=>Math.max(u,n.length/t.length),0)}function Ki(e,t){let r=Dt(e,t);return r===false?"":e.charAt(r)}function Yi(e,t){let r=t===true||t===ye?ye:Jt,u=r===ye?Jt:ye,n=0,i=0;for(let s of e)s===r?n++:s===u&&i++;return n>i?u:r}function Qi(e,t,r){for(let u=t;u<r;++u)if(e.charAt(u)===`
|
|
27
|
+
`)return true;return false}function ts(e,t,r={}){return G(e,r.backwards?t-1:t,r)!==t}function us(e,t,r){let u=t==='"'?"'":'"',n=ke(false,e,/\\(.)|(["'])/gsu,(i,s,o)=>s===u?s:o===t?"\\"+o:o||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function is(e,t,r){return Dt(e,r(t))}function ss(e,t){return arguments.length===2||typeof t=="number"?Dt(e,t):is(...arguments)}function os(e,t,r){return nt(e,r(t))}function as(e,t){return arguments.length===2||typeof t=="number"?nt(e,t):os(...arguments)}function ls(e,t,r){return pt(e,r(t))}function Ds(e,t){return arguments.length===2||typeof t=="number"?pt(e,t):ls(...arguments)}function Y(e,t=1){return async(...r)=>{let u=r[t]??{},n=u.plugins??[];return r[t]={...u,plugins:Array.isArray(n)?n:Object.values(n)},e(...r)}}async function dt(e,t){let{formatted:r}=await ct(e,{...t,cursorOffset:-1});return r}async function Pr(e,t){return await dt(e,t)===e}var zr,Ue,Gr,qr,Jr,Ur,Ut,Hr,He,Kr,Xr,Yr,Zr,pe,Qr,Ht,eu,ke,tu,ru,uu,te,j,q,W,_,V,S,P,x,M,L,R,w,T,A,Xt,ou,b,re,Du,cu,ie,Ft,Xe,Ze,O,Zt,wu,Ou,xe,Pu,Qe,er,tr,Tu,Q,rr,Z,Wu,Mu,Lu,et,k,$,ue,Me,tt,K,ze,ve,Ju,Uu,sr,Ge,Ku,Zu,G,or,ar,ee,z,rn,lr,un,$e,Pe,Te,pr,nt,Fn,dr,Et,gn,En,vn,vt,bt,wt,kt,St,bn,xn,Bn,Nn,ne,mr,N,On,Fr,be,At,Pn,je,Nt,yr,In,J,_n,Vn,Mn,Ln,Xn,Yn,Zn,_t,Qn,ei,ti,ri,ui,We,oi,ai,vr,Vt,oe,ci,me,gi,Sr,Ei,vi,bi,wi,xr,Bi,Br,zt,st,Wi,_i,Vi,Or,ot,at,lt,Dt,pt,qi,Hi,Xi,ye,Jt,Zi,es,rs,ns,ct,Tr,Ir,ps,ht=Lr(()=>{zr=Object.create,Ue=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,qr=Object.getOwnPropertyNames,Jr=Object.getPrototypeOf,Ur=Object.prototype.hasOwnProperty,Ut=e=>{throw TypeError(e)},Hr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),He=(e,t)=>{for(var r in t)Ue(e,r,{get:t[r],enumerable:true});},Kr=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of qr(t))!Ur.call(e,n)&&n!==r&&Ue(e,n,{get:()=>t[n],enumerable:!(u=Gr(t,n))||u.enumerable});return e},Xr=(e,t,r)=>(r=e!=null?zr(Jr(e)):{},Kr(t||!e||!e.__esModule?Ue(r,"default",{value:e,enumerable:true}):r,e)),Yr=(e,t,r)=>t.has(e)||Ut("Cannot "+r),Zr=(e,t,r)=>t.has(e)?Ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),pe=(e,t,r)=>(Yr(e,t,"access private method"),r),Qr=Hr(e=>{Object.defineProperty(e,"__esModule",{value:true});function t(){return new Proxy({},{get:()=>i=>i})}var r=/\r\n|[\n\r\u2028\u2029]/;function u(i,s,o){let a=Object.assign({column:0,line:-1},i.start),l=Object.assign({},a,i.end),{linesAbove:D=2,linesBelow:f=3}=o||{},p=a.line,c=a.column,d=l.line,h=l.column,m=Math.max(p-(D+1),0),F=Math.min(s.length,d+f);p===-1&&(m=0),d===-1&&(F=s.length);let y=d-p,C={};if(y)for(let E=0;E<=y;E++){let g=E+p;if(!c)C[g]=true;else if(E===0){let v=s[g-1].length;C[g]=[c,v-c+1];}else if(E===y)C[g]=[0,h];else {let v=s[g-E].length;C[g]=[0,v];}}else c===h?c?C[p]=[c,0]:C[p]=true:C[p]=[c,h-c];return {start:m,end:F,markerLines:C}}function n(i,s,o={}){let a=t(),l=i.split(r),{start:D,end:f,markerLines:p}=u(s,l,o),c=s.start&&typeof s.start.column=="number",d=String(f).length,h=i.split(r,f).slice(D,f).map((m,F)=>{let y=D+1+F,C=` ${` ${y}`.slice(-d)} |`,E=p[y],g=!p[y+1];if(E){let v="";if(Array.isArray(E)){let B=m.slice(0,Math.max(E[0]-1,0)).replace(/[^\t]/g," "),U=E[1]||1;v=[`
|
|
28
|
+
`,a.gutter(C.replace(/\d/g," "))," ",B,a.marker("^").repeat(U)].join(""),g&&o.message&&(v+=" "+a.message(o.message));}return [a.marker(">"),a.gutter(C),m.length>0?` ${m}`:"",v].join("")}else return ` ${a.gutter(C)}${m.length>0?` ${m}`:""}`}).join(`
|
|
29
|
+
`);return o.message&&!c&&(h=`${" ".repeat(d+1)}${o.message}
|
|
30
|
+
${h}`),h}e.codeFrameColumns=n;}),Ht={};He(Ht,{__debug:()=>Ir,check:()=>Pr,doc:()=>st,format:()=>dt,formatWithCursor:()=>ct,getSupportInfo:()=>Tr,util:()=>ot,version:()=>Or});eu=(e,t,r,u)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(r,u):r.global?t.replace(r,u):t.split(r).join(u)},ke=eu,tu=class{diff(e,t,r={}){let u;typeof r=="function"?(u=r,r={}):"callback"in r&&(u=r.callback);let n=this.castInput(e,r),i=this.castInput(t,r),s=this.removeEmpty(this.tokenize(n,r)),o=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(s,o,r,u)}diffWithOptionsObj(e,t,r,u){var n;let i=F=>{if(F=this.postProcess(F,r),u){setTimeout(function(){u(F);},0);return}else return F},s=t.length,o=e.length,a=1,l=s+o;r.maxEditLength!=null&&(l=Math.min(l,r.maxEditLength));let D=(n=r.timeout)!==null&&n!==void 0?n:1/0,f=Date.now()+D,p=[{oldPos:-1,lastComponent:void 0}],c=this.extractCommon(p[0],t,e,0,r);if(p[0].oldPos+1>=o&&c+1>=s)return i(this.buildValues(p[0].lastComponent,t,e));let d=-1/0,h=1/0,m=()=>{for(let F=Math.max(d,-a);F<=Math.min(h,a);F+=2){let y,C=p[F-1],E=p[F+1];C&&(p[F-1]=void 0);let g=false;if(E){let B=E.oldPos-F;g=E&&0<=B&&B<s;}let v=C&&C.oldPos+1<o;if(!g&&!v){p[F]=void 0;continue}if(!v||g&&C.oldPos<E.oldPos?y=this.addToPath(E,true,false,0,r):y=this.addToPath(C,false,true,1,r),c=this.extractCommon(y,t,e,F,r),y.oldPos+1>=o&&c+1>=s)return i(this.buildValues(y.lastComponent,t,e))||true;p[F]=y,y.oldPos+1>=o&&(h=Math.min(h,F-1)),c+1>=s&&(d=Math.max(d,F+1));}a++;};if(u)(function F(){setTimeout(function(){if(a>l||Date.now()>f)return u(void 0);m()||F();},0);})();else for(;a<=l&&Date.now()<=f;){let F=m();if(F)return F}}addToPath(e,t,r,u,n){let i=e.lastComponent;return i&&!n.oneChangePerToken&&i.added===t&&i.removed===r?{oldPos:e.oldPos+u,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+u,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}}extractCommon(e,t,r,u,n){let i=t.length,s=r.length,o=e.oldPos,a=o-u,l=0;for(;a+1<i&&o+1<s&&this.equals(r[o+1],t[a+1],n);)a++,o++,l++,n.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:false,removed:false});return l&&!n.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:false,removed:false}),e.oldPos=o,a}equals(e,t,r){return r.comparator?r.comparator(e,t):e===t||!!r.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let r=0;r<e.length;r++)e[r]&&t.push(e[r]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return false}buildValues(e,t,r){let u=[],n;for(;e;)u.push(e),n=e.previousComponent,delete e.previousComponent,e=n;u.reverse();let i=u.length,s=0,o=0,a=0;for(;s<i;s++){let l=u[s];if(l.removed)l.value=this.join(r.slice(a,a+l.count)),a+=l.count;else {if(!l.added&&this.useLongestToken){let D=t.slice(o,o+l.count);D=D.map(function(f,p){let c=r[a+p];return c.length>f.length?c:f}),l.value=this.join(D);}else l.value=this.join(t.slice(o,o+l.count));o+=l.count,l.added||(a+=l.count);}}return u}},ru=class extends tu{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}},uu=new ru;te="string",j="array",q="cursor",W="indent",_="align",V="trim",S="group",P="fill",x="if-break",M="indent-if-break",L="line-suffix",R="line-suffix-boundary",w="line",T="label",A="break-parent",Xt=new Set([q,W,_,V,S,P,x,M,L,R,w,T,A]),ou=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},b=ou;re=lu,Du=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);cu=class extends Error{constructor(t){super(pu(t));ge(this,"name","InvalidDocError");this.doc=t;}},ie=cu,Ft={};Xe=du;Ze=()=>{},O=Ze,Zt=Ze,wu=Ze;Ou={type:R},xe={type:A},Pu={type:V},Qe={type:w,hard:true},er={type:w,hard:true,literal:true},tr={type:w},Tu={type:w,soft:true},Q=[Qe,xe],rr=[er,xe],Z={type:q};Wu=()=>/[#*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](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\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(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\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](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\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-\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[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;Mu=e=>!(_u(e)||Vu(e)),Lu=/[^\x20-\x7F]/u;et=Ru,k=Symbol("MODE_BREAK"),$=Symbol("MODE_FLAT"),ue=Symbol("cursor"),Me=Symbol("DOC_FILL_PRINTED_LENGTH");tt=qu,Ju=class{constructor(e){Zr(this,K),this.stack=[e];}get key(){let{stack:e,siblings:t}=this;return b(false,e,t===null?-2:-4)??null}get index(){return this.siblings===null?null:b(false,this.stack,-2)}get node(){return b(false,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=b(false,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 [...pe(this,K,ve).call(this)]}getName(){let{stack:e}=this,{length:t}=e;return t>1?b(false,e,-2):null}getValue(){return b(false,this.stack,-1)}getNode(e=0){let t=pe(this,K,ze).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:u}=r,n=b(false,r,-1);for(let i of t)n=n[i],r.push(i,n);try{return e(this)}finally{r.length=u;}}callParent(e,t=0){let r=pe(this,K,ze).call(this,t+1),u=this.stack.splice(r+1);try{return e(this)}finally{this.stack.push(...u);}}each(e,...t){let{stack:r}=this,{length:u}=r,n=b(false,r,-1);for(let i of t)n=n[i],r.push(i,n);try{for(let i=0;i<n.length;++i)r.push(i,n[i]),e(this,i,n),r.length-=2;}finally{r.length=u;}}map(e,...t){let r=[];return this.each((u,n,i)=>{r[n]=e(u,n,i);},...t),r}match(...e){let t=this.stack.length-1,r=null,u=this.stack[t--];for(let n of e){if(u===void 0)return false;let i=null;if(typeof r=="number"&&(i=r,r=this.stack[t--],u=this.stack[t--]),n&&!n(u,r,i))return false;r=this.stack[t--],u=this.stack[t--];}return true}findAncestor(e){for(let t of pe(this,K,ve).call(this))if(e(t))return t}hasAncestor(e){for(let t of pe(this,K,ve).call(this))if(e(t))return true;return false}};K=new WeakSet,ze=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},ve=function*(){let{stack:e}=this;for(let t=e.length-3;t>=0;t-=2){let r=e[t];Array.isArray(r)||(yield r);}};Uu=Ju,sr=new Proxy(()=>{},{get:()=>sr}),Ge=sr;Ku=Hu;Zu=he(/\s/u),G=he(" "),or=he(",; "),ar=he(/[^\n\r]/u);ee=Qu;z=en;rn=tn,lr=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),un=e=>Object.keys(e).filter(t=>!lr.has(t));$e=nn;Pe=new WeakMap;Te=()=>false;pr=e=>!/[\S\n\u2028\u2029]/u.test(e);nt=Dn;Fn=mn,dr=class extends Error{constructor(){super(...arguments);ge(this,"name","ConfigError");}},Et=class extends Error{constructor(){super(...arguments);ge(this,"name","UndefinedParserError");}},gn={checkIgnorePragma:{category:"Special",type:"boolean",default:false,description:"Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",cliCategory:"Other"},cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:"Print (to stderr) where a cursor at the given position would move to after formatting.",cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
|
|
31
31
|
(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:false,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:e=>typeof e=="string"||typeof e=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"},{value:"mjml",description:"MJML"}]},plugins:{type:"path",array:true,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).
|
|
32
32
|
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.
|
|
33
|
-
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:false,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:false,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."}]}};
|
|
34
|
-
`)),Cr(i,r.loggerPrintWidth)};je=[],Nt=[];yr=(e,t,{descriptor:r,logger:u,schemas:n})=>{let i=[`Ignored unknown option ${N.yellow(r.pair({key:e,value:t}))}.`],s=Object.keys(n).sort().find(o=>Pn(e,o)<3);s&&i.push(`Did you mean ${N.blue(r.key(s))}?`),u.warn(i.join(" "));},Tn=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];J=class{static create(e){return In(this,e)}constructor(e){this.name=e.name;}default(e){}expected(e){return "nothing"}validate(e,t){return false}deprecated(e,t){return false}forward(e,t){}redirect(e,t){}overlap(e,t,r){return e}preprocess(e,t){return e}postprocess(e,t){return be}};Wn=class extends J{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}},_n=class extends J{expected(){return "anything"}validate(){return true}},Mn=class extends J{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 false;let r=[];for(let u of e){let n=t.normalizeValidateResult(this._valueSchema.validate(u,t),u);n!==true&&r.push(n.value);}return r.length===0?true:{value:r}}deprecated(e,t){let r=[];for(let u of e){let n=t.normalizeDeprecatedResult(this._valueSchema.deprecated(u,t),u);n!==false&&r.push(...n.map(({value:i})=>({value:[i]})));}return r}forward(e,t){let r=[];for(let u of e){let n=t.normalizeForwardResult(this._valueSchema.forward(u,t),u);r.push(...n.map(Ot));}return r}redirect(e,t){let r=[],u=[];for(let n of e){let i=t.normalizeRedirectResult(this._valueSchema.redirect(n,t),n);"remain"in i&&r.push(i.remain),u.push(...i.redirect.map(Ot));}return r.length===0?{redirect:u}:{redirect:u,remain:r}}overlap(e,t){return e.concat(t)}};Vn=class extends J{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};Kn=class extends J{constructor(e){super(e),this._choices=Rn(e.choices.map(t=>t&&typeof t=="object"?t:{value:t}),"value");}expected({descriptor:e}){let t=Array.from(this._choices.keys()).map(n=>this._choices.get(n)).filter(({hidden:n})=>!n).map(n=>n.value).sort(Jn).map(e.value),r=t.slice(0,-2),u=t.slice(-2);return {text:r.concat(u.join(" or ")).join(", "),list:{title:"one of the following values",values:t}}}validate(e){return this._choices.has(e)}deprecated(e){let t=this._choices.get(e);return t&&t.deprecated?{value:e}:false}forward(e){let t=this._choices.get(e);return t?t.forward:void 0}redirect(e){let t=this._choices.get(e);return t?t.redirect:void 0}},Xn=class extends J{expected(){return "a number"}validate(e,t){return typeof e=="number"}},Yn=class extends Xn{expected(){return "an integer"}validate(e,t){return t.normalizeValidateResult(super.validate(e,t),e)===true&&qn(e)}},_t=class extends J{expected(){return "a string"}validate(e){return typeof e=="string"}},Zn=ne,Qn=yr,ei=On,ti=Nn,ri=class{constructor(e,t){let{logger:r=console,loggerPrintWidth:u=80,descriptor:n=Zn,unknown:i=Qn,invalid:s=ei,deprecated:o=ti,missing:a=()=>false,required:l=()=>false,preprocess:D=p=>p,postprocess:f=()=>be}=t||{};this._utils={descriptor:n,logger:r||{warn:()=>{}},loggerPrintWidth:u,schemas:Ln(e,"name"),normalizeDefaultResult:Pt,normalizeExpectedResult:Er,normalizeDeprecatedResult:It,normalizeForwardResult:qe,normalizeRedirectResult:Wt,normalizeValidateResult:Tt},this._unknownHandler=i,this._invalidHandler=Un(s),this._deprecatedHandler=o,this._identifyMissing=(p,d)=>!(p in d)||a(p,d),this._identifyRequired=l,this._preprocess=D,this._postprocess=f,this.cleanHistory();}cleanHistory(){this._hasDeprecationWarned=zn();}normalize(e){let t={},r=[this._preprocess(e,this._utils)],u=()=>{for(;r.length!==0;){let n=r.shift(),i=this._applyNormalization(n,t);r.push(...i);}};u();for(let n of Object.keys(this._utils.schemas)){let i=this._utils.schemas[n];if(!(n in t)){let s=Pt(i.default(this._utils));"value"in s&&r.push({[n]:s.value});}}u();for(let n of Object.keys(this._utils.schemas)){if(!(n in t))continue;let i=this._utils.schemas[n],s=t[n],o=i.postprocess(s,this._utils);o!==be&&(this._applyValidation(o,n,i),t[n]=o);}return this._applyPostprocess(t),this._applyRequiredCheck(t),t}_applyNormalization(e,t){let r=[],{knownKeys:u,unknownKeys:n}=this._partitionOptionKeys(e);for(let i of u){let s=this._utils.schemas[i],o=s.preprocess(e[i],this._utils);this._applyValidation(o,i,s);let a=({from:f,to:p})=>{r.push(typeof p=="string"?{[p]:f}:{[p.key]:p.value});},l=({value:f,redirectTo:p})=>{let d=It(s.deprecated(f,this._utils),o,true);if(d!==false)if(d===true)this._hasDeprecationWarned(i)||this._utils.logger.warn(this._deprecatedHandler(i,p,this._utils));else for(let{value:c}of d){let h={key:i,value:c};if(!this._hasDeprecationWarned(h)){let m=typeof p=="string"?{key:p,value:c}:p;this._utils.logger.warn(this._deprecatedHandler(h,m,this._utils));}}};qe(s.forward(o,this._utils),o).forEach(a);let D=Wt(s.redirect(o,this._utils),o);if(D.redirect.forEach(a),"remain"in D){let f=D.remain;t[i]=i in t?s.overlap(t[i],f,this._utils):f,l({value:f});}for(let{from:f,to:p}of D.redirect)l({value:f,redirectTo:p});}for(let i of n){let s=e[i];this._applyUnknownHandler(i,s,t,(o,a)=>{r.push({[o]:a});});}return r}_applyRequiredCheck(e){for(let t of Object.keys(this._utils.schemas))if(this._identifyMissing(t,e)&&this._identifyRequired(t))throw this._invalidHandler(t,Fr,this._utils)}_partitionOptionKeys(e){let[t,r]=Gn(Object.keys(e).filter(u=>!this._identifyMissing(u,e)),u=>u in this._utils.schemas);return {knownKeys:t,unknownKeys:r}}_applyValidation(e,t,r){let u=Tt(r.validate(e,this._utils),e);if(u!==true)throw this._invalidHandler(t,u.value,this._utils)}_applyUnknownHandler(e,t,r,u){let n=this._unknownHandler(e,t,this._utils);if(n)for(let i of Object.keys(n)){if(this._identifyMissing(i,n))continue;let s=n[i];i in this._utils.schemas?u(i,s):r[i]=s;}}_applyPostprocess(e){let t=this._postprocess(e,this._utils);if(t!==be){if(t.delete)for(let r of t.delete)delete e[r];if(t.override){let{knownKeys:r,unknownKeys:u}=this._partitionOptionKeys(t.override);for(let n of r){let i=t.override[n];this._applyValidation(i,n,this._utils.schemas[n]),e[n]=i;}for(let n of u){let i=t.override[n];this._applyUnknownHandler(n,i,e,(s,o)=>{let a=this._utils.schemas[s];this._applyValidation(o,s,a),e[s]=o;});}}}}};si=ui,oi=(e,t,r)=>{if(!(e&&t==null)){if(t.findLast)return t.findLast(r);for(let u=t.length-1;u>=0;u--){let n=t[u];if(r(n,u,t))return n}}},vr=oi;Mt={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};oe=Di,pi=Kr(Zr(),1);me=ci;Fi=mi;Sr=gi;yi=Ci,Ei=(e,t,r)=>{if(!(e&&t==null)){if(t.findLastIndex)return t.findLastIndex(r);for(let u=t.length-1;u>=0;u--){let n=t[u];if(r(n,u,t))return u}return -1}},vi=Ei,bi=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";xr=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),xi=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);Br="\uFEFF",zt=Symbol("cursor");st={};He(st,{builders:()=>ji,printer:()=>Wi,utils:()=>_i});ji={join:ur,line:tr,softline:Pu,hardline:Q,literalline:rr,group:Qt,conditionalGroup:xu,fill:Bu,lineSuffix:Me,lineSuffixBoundary:Nu,cursor:Z,breakParent:xe,ifBreak:Au,trim:Ou,indent:we,indentIfBreak:$u,align:se,addAlignmentToDoc:nr,markAsRoot:ku,dedentToRoot:wu,dedent:Su,hardlineWithoutBreakParent:Qe,literallineWithoutBreakParent:er,label:Tu,concat:e=>e},Wi={printDocToString:Be},_i={willBreak:fu,traverseDoc:Xe,findInDoc:Ye,mapDoc:Se,removeLines:Fu,stripTrailingHardline:Yt,replaceEndOfLine:yu,canBreak:vu},Or="3.6.2",ot={};He(ot,{addDanglingComment:()=>X,addLeadingComment:()=>de,addTrailingComment:()=>fe,getAlignmentSize:()=>tt,getIndentSize:()=>Gi,getMaxContinuousCount:()=>Ui,getNextNonSpaceNonCommentCharacter:()=>Ki,getNextNonSpaceNonCommentCharacterIndex:()=>is,getPreferredQuote:()=>Yi,getStringWidth:()=>et,hasNewline:()=>z,hasNewlineInRange:()=>Qi,hasSpaces:()=>ts,isNextLineEmpty:()=>ls,isNextLineEmptyAfterIndex:()=>pt,isPreviousLineEmpty:()=>os,makeString:()=>us,skip:()=>he,skipEverythingButNewLine:()=>ar,skipInlineComment:()=>at,skipNewline:()=>ee,skipSpaces:()=>G,skipToLineEnd:()=>or,skipTrailingComment:()=>lt,skipWhitespace:()=>Yu});at=Mi;lt=Vi;Dt=Li;pt=Ri;Gi=zi;Ui=Ji;Ki=Hi,ye="'",Jt='"';Yi=Xi;Qi=Zi;ts=es;us=rs;ct=Y(Nr);Tr=Y(fr,0),Ir={parse:Y(Ni),formatAST:Y(Oi),formatDoc:Y(Pi),printToDoc:Y(Ti),printDocToString:Y(Ii)},Ds=Ht;});var ds=Object.defineProperty,fs=(e,t,r)=>t in e?ds(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,ae=(e=>typeof H<"u"?H:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof H<"u"?H:t)[r]}):e)(function(e){if(typeof H<"u")return H.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),hs=(e,t,r)=>fs(e,t+"",r),ms=Object.defineProperty,Fs=(e,t,r)=>t in e?ms(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,jr=(e=>typeof ae<"u"?ae:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof ae<"u"?ae:t)[r]}):e)(function(e){if(typeof ae<"u")return ae.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),le=(e,t,r)=>Fs(e,typeof t!="symbol"?t+"":t,r),gs=class{parse(e){let t=this.cleanSvgContent(e),r=this.parseElement(t);return {root:r,viewBox:r.attributes.viewBox,width:r.attributes.width,height:r.attributes.height,namespace:r.attributes.xmlns}}extractColors(e){let t=[];return this.traverseElements(e.root,r=>{r.attributes.fill&&this.isValidColor(r.attributes.fill)&&t.push({value:r.attributes.fill,type:"fill",element:r,attribute:"fill"}),r.attributes.stroke&&this.isValidColor(r.attributes.stroke)&&t.push({value:r.attributes.stroke,type:"stroke",element:r,attribute:"stroke"}),r.attributes["stop-color"]&&this.isValidColor(r.attributes["stop-color"])&&t.push({value:r.attributes["stop-color"],type:"stop-color",element:r,attribute:"stop-color"});}),t}cleanSvgContent(e){return e.replace(/<\?xml[^>]*\?>/gi,"").replace(/<!--[\s\S]*?-->/g,"").trim()}parseElement(e){if(typeof globalThis.DOMParser<"u"){let t=new globalThis.DOMParser().parseFromString(e,"image/svg+xml");if(t.querySelector("parsererror"))throw new Error("Invalid SVG: XML parsing failed");let r=t.documentElement;if(r.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(r)}try{let t=(typeof jr<"u"?jr:function(){throw new Error("require not available")}())("jsdom"),{JSDOM:r}=t,u=new r(e,{contentType:"image/svg+xml"}).window.document.documentElement;if(u.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(u)}catch{return this.parseElementWithRegex(e)}}convertDOMToSVGElement(e){let t={tag:this.preserveSvgTagCase(e.tagName),attributes:{},children:[]};for(let r=0;r<e.attributes.length;r++){let u=e.attributes[r];t.attributes[u.name]=u.value;}for(let r=0;r<e.children.length;r++){let u=e.children[r];t.children.push(this.convertDOMToSVGElement(u));}return e.children.length===0&&e.textContent?.trim()&&(t.content=e.textContent.trim()),t}parseElementWithRegex(e){let t=e.match(/<svg([^>]*)>/i);if(!t)throw new Error("Invalid SVG: No svg element found");let r=this.parseAttributes(t[1]),u=this.parseChildren(e);return {tag:"svg",attributes:r,children:u}}parseAttributes(e){let t={},r=/(\w+(?:-\w+)*)=["']([^"']*)["']/g,u;for(;(u=r.exec(e))!==null;)t[u[1]]=u[2];return t}parseChildren(e){let t=[],r=e.match(/<svg[^>]*>(.*)<\/svg>/is);if(!r||!r[1])return t;let u=r[1],n=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,i;for(;(i=n.exec(u))!==null;){let[,s,o,a]=i,l=this.parseAttributes(o),D={tag:s,attributes:l,children:[]};a!==void 0&&(a.includes("<")?D.children=this.parseNestedElements(a):a.trim()&&(D.content=a.trim())),t.push(D);}return t}parseNestedElements(e){let t=[],r=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,u;for(;(u=r.exec(e))!==null;){let[,n,i,s]=u,o=this.parseAttributes(i),a={tag:n,attributes:o,children:[]};s!==void 0&&(s.includes("<")?a.children=this.parseNestedElements(s):s.trim()&&(a.content=s.trim())),t.push(a);}return t}traverseElements(e,t){t(e),e.children.forEach(r=>this.traverseElements(r,t));}preserveSvgTagCase(e){let t=e.toLowerCase();return {clippath:"clipPath",defs:"defs",foreignobject:"foreignObject",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath",use:"use",feblend:"feBlend",feflood:"feFlood",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedropshadow:"feDropShadow",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fespecularlighting:"feSpecularLighting",fetile:"feTile",feturbulence:"feTurbulence",filter:"filter",g:"g",image:"image",line:"line",marker:"marker",mask:"mask",metadata:"metadata",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan",view:"view",circle:"circle",ellipse:"ellipse"}[t]||t}isValidColor(e){return !e||e==="none"||e==="transparent"||e==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)?true:["red","green","blue","black","white","yellow","cyan","magenta"].includes(e.toLowerCase())}},Cs=class{constructor(e={}){le(this,"options"),this.options={preserveOriginalNames:e.preserveOriginalNames??false,generateClasses:e.generateClasses??true,colorPrefix:e.colorPrefix??"color"};}extractColors(e){let t=[];this.traverseElement(e,t);let r=new Map;return t.forEach(u=>{this.isValidColor(u.value)&&r.set(u.value,u);}),Array.from(r.values()).sort((u,n)=>u.value.localeCompare(n.value))}apply(e){let t=this.extractColors(e),r=this.generateColorMappings(t),u=this.replaceColorsWithVariables(e,r);return {mappings:r,processedElement:u,originalColors:t.map(n=>n.value)}}generateColorMappings(e){return e.map((t,r)=>({originalColor:t.value,variableName:r===0?this.options.colorPrefix:`${this.options.colorPrefix}${r+1}`,type:t.type}))}replaceColorsWithVariables(e,t){let r=new Map(t.map(u=>[u.originalColor,u.variableName]));return this.transformElement(e,u=>{let n={...u.attributes};if(n.fill&&r.has(n.fill)&&(n.fill=`{${r.get(n.fill)}}`),n.stroke&&r.has(n.stroke)&&(n.stroke=`{${r.get(n.stroke)}}`),n["stop-color"]&&r.has(n["stop-color"])&&(n["stop-color"]=`{${r.get(n["stop-color"])}}`),n.style){let i=n.style,s=i.match(/fill:\s*([^;]+)/);if(s){let l=s[1].trim();r.has(l)&&(i=i.replace(/fill:\s*[^;]+/,`fill: {${r.get(l)}}`));}let o=i.match(/stroke:\s*([^;]+)/);if(o){let l=o[1].trim();r.has(l)&&(i=i.replace(/stroke:\s*[^;]+/,`stroke: {${r.get(l)}}`));}let a=i.match(/stop-color:\s*([^;]+)/);if(a){let l=a[1].trim();r.has(l)&&(i=i.replace(/stop-color:\s*[^;]+/,`stop-color: {${r.get(l)}}`));}n.style=i;}if(this.isDrawableElement(u.tag)){let i=u.attributes.fill!==void 0&&u.attributes.fill!=="",s=u.attributes.stroke!==void 0&&u.attributes.stroke!=="";i&&!s&&!n.stroke&&(n.stroke="none"),s&&!i&&!n.fill&&(n.fill="none");}return {...u,attributes:n}})}traverseElement(e,t){e.attributes.fill&&t.push({value:e.attributes.fill,type:"fill",element:e,attribute:"fill"}),e.attributes.stroke&&t.push({value:e.attributes.stroke,type:"stroke",element:e,attribute:"stroke"}),e.attributes["stop-color"]&&t.push({value:e.attributes["stop-color"],type:"stop-color",element:e,attribute:"stop-color"}),e.attributes.style&&this.extractColorsFromStyle(e.attributes.style).forEach(r=>{t.push({value:r.value,type:r.type,element:e,attribute:"style"});}),e.children.forEach(r=>this.traverseElement(r,t));}transformElement(e,t){let r=t(e);return {...r,children:r.children.map(u=>this.transformElement(u,t))}}isDrawableElement(e){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(e)}isValidColor(e){return !e||e==="none"||e==="transparent"||e==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)?true:["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy"].includes(e.toLowerCase())}extractColorsFromStyle(e){let t=[],r=e.match(/fill:\s*([^;]+)/);if(r){let i=r[1].trim();this.isValidColor(i)&&t.push({value:i,type:"fill"});}let u=e.match(/stroke:\s*([^;]+)/);if(u){let i=u[1].trim();this.isValidColor(i)&&t.push({value:i,type:"stroke"});}let n=e.match(/stop-color:\s*([^;]+)/);if(n){let i=n[1].trim();this.isValidColor(i)&&t.push({value:i,type:"stop-color"});}return t}},ys=class{constructor(e={}){le(this,"options"),this.options={preserveExisting:e.preserveExisting??true,onlyIfStrokePresent:e.onlyIfStrokePresent??true};}apply(e){let t=0;return {processedElement:this.transformElement(e,r=>this.shouldAddVectorEffect(r)?(t++,{...r,attributes:{...r.attributes,"vector-effect":"non-scaling-stroke"}}):r),elementsModified:t}}shouldAddVectorEffect(e){return this.options.preserveExisting&&e.attributes["vector-effect"]?false:["path","line","polyline","polygon","rect","circle","ellipse"].includes(e.tag)}transformElement(e,t){let r=t(e);return {...r,children:r.children.map(u=>this.transformElement(u,t))}}},Es=class{constructor(e={}){le(this,"options"),this.options={preserveOriginalNames:e.preserveOriginalNames??false,strokeWidthPrefix:e.strokeWidthPrefix??"strokeWidth",generateClasses:e.generateClasses??true};}extractStrokeWidths(e){let t=[];this.traverseElement(e,t);let r=new Map;return t.forEach(u=>{this.isValidStrokeWidth(u.value)&&r.set(u.value,u);}),Array.from(r.values()).sort((u,n)=>{let i=parseFloat(u.value),s=parseFloat(n.value);return isNaN(i)&&isNaN(s)?u.value.localeCompare(n.value):isNaN(i)?1:isNaN(s)?-1:i-s})}apply(e){let t=this.extractStrokeWidths(e),r=this.generateStrokeWidthMappings(t),u=this.replaceStrokeWidthsWithVariables(e,r);return {mappings:r,processedElement:u,originalStrokeWidths:t.map(n=>n.value)}}traverseElement(e,t){if(e.attributes["stroke-width"]&&t.push({value:e.attributes["stroke-width"],element:e,attribute:"stroke-width"}),e.attributes.style){let r=this.extractStrokeWidthFromStyle(e.attributes.style);r&&t.push({value:r,element:e,attribute:"style",styleProperty:"stroke-width"});}e.children.forEach(r=>this.traverseElement(r,t));}extractStrokeWidthFromStyle(e){let t=e.match(/stroke-width\s*:\s*([^;]+)/);return t?t[1].trim():null}isValidStrokeWidth(e){return e==="inherit"||e==="none"||e==="initial"||e==="unset"||e.includes("var(")||e.includes("calc(")?false:/^[\d.]+(?:px|pt|pc|in|cm|mm|em|rem|ex|ch|vw|vh|vmin|vmax|%)?$/.test(e.trim())}generateStrokeWidthMappings(e){return e.map((t,r)=>({originalStrokeWidth:t.value,variableName:r===0?this.options.strokeWidthPrefix:`${this.options.strokeWidthPrefix}${r+1}`}))}replaceStrokeWidthsWithVariables(e,t){let r=new Map(t.map(u=>[u.originalStrokeWidth,u.variableName]));return this.transformElement(e,u=>{let n={...u.attributes};if(n["stroke-width"]&&r.has(n["stroke-width"])&&(n["stroke-width"]=`{${r.get(n["stroke-width"])}}`),n.style){let i=n.style;r.forEach((s,o)=>{let a=new RegExp(`stroke-width\\s*:\\s*${this.escapeRegExp(o)}`,"g");i=i.replace(a,`stroke-width: {${s}}`);}),n.style=i;}return {...u,attributes:n}})}transformElement(e,t){let r=t(e);return {...r,children:r.children.map(u=>this.transformElement(u,t))}}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}},vs=class{constructor(e={}){le(this,"options"),this.options={addRole:e.addRole??true,addAriaHidden:e.addAriaHidden??false,addTitle:e.addTitle??true,addDesc:e.addDesc??true,defaultRole:e.defaultRole??"img",preserveExisting:e.preserveExisting??true};}apply(e){let t=[];if(e.tag!=="svg")return {processedElement:e,attributesAdded:t};let r={...e.attributes};return this.options.addRole&&(!this.options.preserveExisting||!r.role)&&(r.role=this.options.defaultRole,t.push("role")),this.options.addAriaHidden&&(!this.options.preserveExisting||!r["aria-hidden"])&&(r["aria-hidden"]="true",t.push("aria-hidden")),this.options.addTitle&&t.push("title-support"),this.options.addDesc&&t.push("desc-support"),this.options.addTitle&&this.options.addDesc&&(!this.options.preserveExisting||!r["aria-labelledby"])?(r["aria-labelledby"]="{titleId} {descId}",t.push("aria-labelledby")):this.options.addTitle&&(!this.options.preserveExisting||!r["aria-labelledby"])&&(r["aria-labelledby"]="{titleId}",t.push("aria-labelledby")),{processedElement:{...e,attributes:r},attributesAdded:t}}generateProps(){let e=[];return this.options.addTitle&&e.push("title?: string","titleId?: string"),this.options.addDesc&&e.push("desc?: string","descId?: string"),e}generateJSXElements(e){let t=[];return e==="react"?(this.options.addDesc&&t.push("{desc ? <desc id={descId}>{desc}</desc> : null}"),this.options.addTitle&&t.push("{title ? <title id={titleId}>{title}</title> : null}")):(this.options.addDesc&&t.push('<desc v-if="desc" :id="descId">{{ desc }}</desc>'),this.options.addTitle&&t.push('<title v-if="title" :id="titleId">{{ title }}</title>')),t.join(`
|
|
35
|
-
`)}},
|
|
33
|
+
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:false,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:false,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."}]}};En=(e,t)=>{if(!(e&&t==null))return t.toReversed||!Array.isArray(t)?t.toReversed():[...t].reverse()},vn=En,bn=((vt=globalThis.Deno)==null?void 0:vt.build.os)==="windows"||((wt=(bt=globalThis.navigator)==null?void 0:bt.platform)==null?void 0:wt.startsWith("Win"))||((St=(kt=globalThis.process)==null?void 0:kt.platform)==null?void 0:St.startsWith("win"))||false;xn=Sn,Bn=e=>String(e).split(/[/\\]/u).pop();Nn=$n,ne={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=>ne.value(r)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(r=>`${ne.key(r)}: ${ne.value(e[r])}`).join(", ")} }`},pair:({key:e,value:t})=>ne.value({[e]:t})},mr=new Proxy(String,{get:()=>mr}),N=mr,On=(e,t,{descriptor:r})=>{let u=[`${N.yellow(typeof e=="string"?r.key(e):r.pair(e))} is deprecated`];return t&&u.push(`we now treat it as ${N.blue(typeof t=="string"?r.key(t):r.pair(t))}`),u.join("; ")+"."},Fr=Symbol.for("vnopts.VALUE_NOT_EXIST"),be=Symbol.for("vnopts.VALUE_UNCHANGED"),At=" ".repeat(2),Pn=(e,t,r)=>{let{text:u,list:n}=r.normalizeExpectedResult(r.schemas[e].expected(r)),i=[];return u&&i.push($t(e,t,u,r.descriptor)),n&&i.push([$t(e,t,n.title,r.descriptor)].concat(n.values.map(s=>gr(s,r.loggerPrintWidth))).join(`
|
|
34
|
+
`)),Cr(i,r.loggerPrintWidth)};je=[],Nt=[];yr=(e,t,{descriptor:r,logger:u,schemas:n})=>{let i=[`Ignored unknown option ${N.yellow(r.pair({key:e,value:t}))}.`],s=Object.keys(n).sort().find(o=>Tn(e,o)<3);s&&i.push(`Did you mean ${N.blue(r.key(s))}?`),u.warn(i.join(" "));},In=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];J=class{static create(e){return jn(this,e)}constructor(e){this.name=e.name;}default(e){}expected(e){return "nothing"}validate(e,t){return false}deprecated(e,t){return false}forward(e,t){}redirect(e,t){}overlap(e,t,r){return e}preprocess(e,t){return e}postprocess(e,t){return be}};_n=class extends J{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}},Vn=class extends J{expected(){return "anything"}validate(){return true}},Mn=class extends J{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 false;let r=[];for(let u of e){let n=t.normalizeValidateResult(this._valueSchema.validate(u,t),u);n!==true&&r.push(n.value);}return r.length===0?true:{value:r}}deprecated(e,t){let r=[];for(let u of e){let n=t.normalizeDeprecatedResult(this._valueSchema.deprecated(u,t),u);n!==false&&r.push(...n.map(({value:i})=>({value:[i]})));}return r}forward(e,t){let r=[];for(let u of e){let n=t.normalizeForwardResult(this._valueSchema.forward(u,t),u);r.push(...n.map(Ot));}return r}redirect(e,t){let r=[],u=[];for(let n of e){let i=t.normalizeRedirectResult(this._valueSchema.redirect(n,t),n);"remain"in i&&r.push(i.remain),u.push(...i.redirect.map(Ot));}return r.length===0?{redirect:u}:{redirect:u,remain:r}}overlap(e,t){return e.concat(t)}};Ln=class extends J{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};Xn=class extends J{constructor(e){super(e),this._choices=zn(e.choices.map(t=>t&&typeof t=="object"?t:{value:t}),"value");}expected({descriptor:e}){let t=Array.from(this._choices.keys()).map(n=>this._choices.get(n)).filter(({hidden:n})=>!n).map(n=>n.value).sort(Un).map(e.value),r=t.slice(0,-2),u=t.slice(-2);return {text:r.concat(u.join(" or ")).join(", "),list:{title:"one of the following values",values:t}}}validate(e){return this._choices.has(e)}deprecated(e){let t=this._choices.get(e);return t&&t.deprecated?{value:e}:false}forward(e){let t=this._choices.get(e);return t?t.forward:void 0}redirect(e){let t=this._choices.get(e);return t?t.redirect:void 0}},Yn=class extends J{expected(){return "a number"}validate(e,t){return typeof e=="number"}},Zn=class extends Yn{expected(){return "an integer"}validate(e,t){return t.normalizeValidateResult(super.validate(e,t),e)===true&&Jn(e)}},_t=class extends J{expected(){return "a string"}validate(e){return typeof e=="string"}},Qn=ne,ei=yr,ti=Pn,ri=On,ui=class{constructor(e,t){let{logger:r=console,loggerPrintWidth:u=80,descriptor:n=Qn,unknown:i=ei,invalid:s=ti,deprecated:o=ri,missing:a=()=>false,required:l=()=>false,preprocess:D=p=>p,postprocess:f=()=>be}=t||{};this._utils={descriptor:n,logger:r||{warn:()=>{}},loggerPrintWidth:u,schemas:Rn(e,"name"),normalizeDefaultResult:Pt,normalizeExpectedResult:Er,normalizeDeprecatedResult:It,normalizeForwardResult:qe,normalizeRedirectResult:Wt,normalizeValidateResult:Tt},this._unknownHandler=i,this._invalidHandler=Hn(s),this._deprecatedHandler=o,this._identifyMissing=(p,c)=>!(p in c)||a(p,c),this._identifyRequired=l,this._preprocess=D,this._postprocess=f,this.cleanHistory();}cleanHistory(){this._hasDeprecationWarned=Gn();}normalize(e){let t={},r=[this._preprocess(e,this._utils)],u=()=>{for(;r.length!==0;){let n=r.shift(),i=this._applyNormalization(n,t);r.push(...i);}};u();for(let n of Object.keys(this._utils.schemas)){let i=this._utils.schemas[n];if(!(n in t)){let s=Pt(i.default(this._utils));"value"in s&&r.push({[n]:s.value});}}u();for(let n of Object.keys(this._utils.schemas)){if(!(n in t))continue;let i=this._utils.schemas[n],s=t[n],o=i.postprocess(s,this._utils);o!==be&&(this._applyValidation(o,n,i),t[n]=o);}return this._applyPostprocess(t),this._applyRequiredCheck(t),t}_applyNormalization(e,t){let r=[],{knownKeys:u,unknownKeys:n}=this._partitionOptionKeys(e);for(let i of u){let s=this._utils.schemas[i],o=s.preprocess(e[i],this._utils);this._applyValidation(o,i,s);let a=({from:f,to:p})=>{r.push(typeof p=="string"?{[p]:f}:{[p.key]:p.value});},l=({value:f,redirectTo:p})=>{let c=It(s.deprecated(f,this._utils),o,true);if(c!==false)if(c===true)this._hasDeprecationWarned(i)||this._utils.logger.warn(this._deprecatedHandler(i,p,this._utils));else for(let{value:d}of c){let h={key:i,value:d};if(!this._hasDeprecationWarned(h)){let m=typeof p=="string"?{key:p,value:d}:p;this._utils.logger.warn(this._deprecatedHandler(h,m,this._utils));}}};qe(s.forward(o,this._utils),o).forEach(a);let D=Wt(s.redirect(o,this._utils),o);if(D.redirect.forEach(a),"remain"in D){let f=D.remain;t[i]=i in t?s.overlap(t[i],f,this._utils):f,l({value:f});}for(let{from:f,to:p}of D.redirect)l({value:f,redirectTo:p});}for(let i of n){let s=e[i];this._applyUnknownHandler(i,s,t,(o,a)=>{r.push({[o]:a});});}return r}_applyRequiredCheck(e){for(let t of Object.keys(this._utils.schemas))if(this._identifyMissing(t,e)&&this._identifyRequired(t))throw this._invalidHandler(t,Fr,this._utils)}_partitionOptionKeys(e){let[t,r]=qn(Object.keys(e).filter(u=>!this._identifyMissing(u,e)),u=>u in this._utils.schemas);return {knownKeys:t,unknownKeys:r}}_applyValidation(e,t,r){let u=Tt(r.validate(e,this._utils),e);if(u!==true)throw this._invalidHandler(t,u.value,this._utils)}_applyUnknownHandler(e,t,r,u){let n=this._unknownHandler(e,t,this._utils);if(n)for(let i of Object.keys(n)){if(this._identifyMissing(i,n))continue;let s=n[i];i in this._utils.schemas?u(i,s):r[i]=s;}}_applyPostprocess(e){let t=this._postprocess(e,this._utils);if(t!==be){if(t.delete)for(let r of t.delete)delete e[r];if(t.override){let{knownKeys:r,unknownKeys:u}=this._partitionOptionKeys(t.override);for(let n of r){let i=t.override[n];this._applyValidation(i,n,this._utils.schemas[n]),e[n]=i;}for(let n of u){let i=t.override[n];this._applyUnknownHandler(n,i,e,(s,o)=>{let a=this._utils.schemas[s];this._applyValidation(o,s,a),e[s]=o;});}}}}};oi=ni,ai=(e,t,r)=>{if(!(e&&t==null)){if(t.findLast)return t.findLast(r);for(let u=t.length-1;u>=0;u--){let n=t[u];if(r(n,u,t))return n}}},vr=ai;Vt={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};oe=pi,ci=Xr(Qr(),1);me=di;gi=Fi;Sr=Ci;Ei=yi,vi=(e,t,r)=>{if(!(e&&t==null)){if(t.findLastIndex)return t.findLastIndex(r);for(let u=t.length-1;u>=0;u--){let n=t[u];if(r(n,u,t))return u}return -1}},bi=vi,wi=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";xr=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),Bi=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);Br="\uFEFF",zt=Symbol("cursor");st={};He(st,{builders:()=>Wi,printer:()=>_i,utils:()=>Vi});Wi={join:ur,line:tr,softline:Tu,hardline:Q,literalline:rr,group:Qt,conditionalGroup:Bu,fill:Au,lineSuffix:Ve,lineSuffixBoundary:Ou,cursor:Z,breakParent:xe,ifBreak:$u,trim:Pu,indent:we,indentIfBreak:Nu,align:se,addAlignmentToDoc:nr,markAsRoot:Su,dedentToRoot:ku,dedent:xu,hardlineWithoutBreakParent:Qe,literallineWithoutBreakParent:er,label:Iu,concat:e=>e},_i={printDocToString:Be},Vi={willBreak:hu,traverseDoc:Xe,findInDoc:Ye,mapDoc:Se,removeLines:gu,stripTrailingHardline:Yt,replaceEndOfLine:Eu,canBreak:bu},Or="3.6.2",ot={};He(ot,{addDanglingComment:()=>X,addLeadingComment:()=>de,addTrailingComment:()=>fe,getAlignmentSize:()=>tt,getIndentSize:()=>qi,getMaxContinuousCount:()=>Hi,getNextNonSpaceNonCommentCharacter:()=>Xi,getNextNonSpaceNonCommentCharacterIndex:()=>ss,getPreferredQuote:()=>Zi,getStringWidth:()=>et,hasNewline:()=>z,hasNewlineInRange:()=>es,hasSpaces:()=>rs,isNextLineEmpty:()=>Ds,isNextLineEmptyAfterIndex:()=>pt,isPreviousLineEmpty:()=>as,makeString:()=>ns,skip:()=>he,skipEverythingButNewLine:()=>ar,skipInlineComment:()=>at,skipNewline:()=>ee,skipSpaces:()=>G,skipToLineEnd:()=>or,skipTrailingComment:()=>lt,skipWhitespace:()=>Zu});at=Mi;lt=Li;Dt=Ri;pt=zi;qi=Gi;Hi=Ui;Xi=Ki,ye="'",Jt='"';Zi=Yi;es=Qi;rs=ts;ns=us;ct=Y(Nr);Tr=Y(fr,0),Ir={parse:Y(Oi),formatAST:Y(Pi),formatDoc:Y(Ti),printToDoc:Y(Ii),printDocToString:Y(ji)},ps=Ht;});var fs=Object.defineProperty,hs=(e,t,r)=>t in e?fs(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,ae=(e=>typeof H<"u"?H:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof H<"u"?H:t)[r]}):e)(function(e){if(typeof H<"u")return H.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ms=(e,t,r)=>hs(e,t+"",r),Fs=Object.defineProperty,gs=(e,t,r)=>t in e?Fs(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,jr=(e=>typeof ae<"u"?ae:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof ae<"u"?ae:t)[r]}):e)(function(e){if(typeof ae<"u")return ae.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),le=(e,t,r)=>gs(e,typeof t!="symbol"?t+"":t,r),Cs=class{parse(e){let t=this.cleanSvgContent(e),r=this.parseElement(t);return {root:r,viewBox:r.attributes.viewBox,width:r.attributes.width,height:r.attributes.height,namespace:r.attributes.xmlns}}extractColors(e){let t=[];return this.traverseElements(e.root,r=>{r.attributes.fill&&this.isValidColor(r.attributes.fill)&&t.push({value:r.attributes.fill,type:"fill",element:r,attribute:"fill"}),r.attributes.stroke&&this.isValidColor(r.attributes.stroke)&&t.push({value:r.attributes.stroke,type:"stroke",element:r,attribute:"stroke"}),r.attributes["stop-color"]&&this.isValidColor(r.attributes["stop-color"])&&t.push({value:r.attributes["stop-color"],type:"stop-color",element:r,attribute:"stop-color"});}),t}cleanSvgContent(e){return e.replace(/<\?xml[^>]*\?>/gi,"").replace(/<!--[\s\S]*?-->/g,"").trim()}parseElement(e){if(typeof globalThis.DOMParser<"u"){let t=new globalThis.DOMParser().parseFromString(e,"image/svg+xml");if(t.querySelector("parsererror"))throw new Error("Invalid SVG: XML parsing failed");let r=t.documentElement;if(r.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(r)}try{let t=(typeof jr<"u"?jr:function(){throw new Error("require not available")}())("jsdom"),{JSDOM:r}=t,u=new r(e,{contentType:"image/svg+xml"}).window.document.documentElement;if(u.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(u)}catch{return this.parseElementWithRegex(e)}}convertDOMToSVGElement(e){let t={tag:this.preserveSvgTagCase(e.tagName),attributes:{},children:[]};for(let r=0;r<e.attributes.length;r++){let u=e.attributes[r];t.attributes[u.name]=u.value;}for(let r=0;r<e.children.length;r++){let u=e.children[r];t.children.push(this.convertDOMToSVGElement(u));}return e.children.length===0&&e.textContent?.trim()&&(t.content=e.textContent.trim()),t}parseElementWithRegex(e){let t=e.match(/<svg([^>]*)>/i);if(!t)throw new Error("Invalid SVG: No svg element found");let r=this.parseAttributes(t[1]),u=this.parseChildren(e);return {tag:"svg",attributes:r,children:u}}parseAttributes(e){let t={},r=/(\w+(?:-\w+)*)=["']([^"']*)["']/g,u;for(;(u=r.exec(e))!==null;)t[u[1]]=u[2];return t}parseChildren(e){let t=[],r=e.match(/<svg[^>]*>(.*)<\/svg>/is);if(!r||!r[1])return t;let u=r[1],n=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,i;for(;(i=n.exec(u))!==null;){let[,s,o,a]=i,l=this.parseAttributes(o),D={tag:s,attributes:l,children:[]};a!==void 0&&(a.includes("<")?D.children=this.parseNestedElements(a):a.trim()&&(D.content=a.trim())),t.push(D);}return t}parseNestedElements(e){let t=[],r=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,u;for(;(u=r.exec(e))!==null;){let[,n,i,s]=u,o=this.parseAttributes(i),a={tag:n,attributes:o,children:[]};s!==void 0&&(s.includes("<")?a.children=this.parseNestedElements(s):s.trim()&&(a.content=s.trim())),t.push(a);}return t}traverseElements(e,t){t(e),e.children.forEach(r=>this.traverseElements(r,t));}preserveSvgTagCase(e){let t=e.toLowerCase();return {clippath:"clipPath",defs:"defs",foreignobject:"foreignObject",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath",use:"use",feblend:"feBlend",feflood:"feFlood",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedropshadow:"feDropShadow",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fespecularlighting:"feSpecularLighting",fetile:"feTile",feturbulence:"feTurbulence",filter:"filter",g:"g",image:"image",line:"line",marker:"marker",mask:"mask",metadata:"metadata",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan",view:"view",circle:"circle",ellipse:"ellipse"}[t]||t}isValidColor(e){return !e||e==="none"||e==="transparent"||e==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)?true:["red","green","blue","black","white","yellow","cyan","magenta"].includes(e.toLowerCase())}},ys=class{constructor(e={}){le(this,"options"),this.options={preserveOriginalNames:e.preserveOriginalNames??false,generateClasses:e.generateClasses??true,colorPrefix:e.colorPrefix??"color"};}extractColors(e){let t=[];this.traverseElement(e,t);let r=new Map;return t.forEach(u=>{this.isValidColor(u.value)&&r.set(u.value,u);}),Array.from(r.values()).sort((u,n)=>u.value.localeCompare(n.value))}apply(e){let t=this.extractColors(e),r=this.generateColorMappings(t),u=this.replaceColorsWithVariables(e,r);return {mappings:r,processedElement:u,originalColors:t.map(n=>n.value)}}generateColorMappings(e){return e.map((t,r)=>({originalColor:t.value,variableName:r===0?this.options.colorPrefix:`${this.options.colorPrefix}${r+1}`,type:t.type}))}replaceColorsWithVariables(e,t){let r=new Map(t.map(u=>[u.originalColor,u.variableName]));return this.transformElement(e,u=>{let n={...u.attributes};if(n.fill&&r.has(n.fill)&&(n.fill=`{${r.get(n.fill)}}`),n.stroke&&r.has(n.stroke)&&(n.stroke=`{${r.get(n.stroke)}}`),n["stop-color"]&&r.has(n["stop-color"])&&(n["stop-color"]=`{${r.get(n["stop-color"])}}`),n.style){let i=n.style,s=i.match(/fill:\s*([^;]+)/);if(s){let l=s[1].trim();r.has(l)&&(i=i.replace(/fill:\s*[^;]+/,`fill: {${r.get(l)}}`));}let o=i.match(/stroke:\s*([^;]+)/);if(o){let l=o[1].trim();r.has(l)&&(i=i.replace(/stroke:\s*[^;]+/,`stroke: {${r.get(l)}}`));}let a=i.match(/stop-color:\s*([^;]+)/);if(a){let l=a[1].trim();r.has(l)&&(i=i.replace(/stop-color:\s*[^;]+/,`stop-color: {${r.get(l)}}`));}n.style=i;}if(this.isDrawableElement(u.tag)){let i=u.attributes.fill!==void 0&&u.attributes.fill!=="",s=u.attributes.stroke!==void 0&&u.attributes.stroke!=="";i&&!s&&!n.stroke&&(n.stroke="none"),s&&!i&&!n.fill&&(n.fill="none");}return {...u,attributes:n}})}traverseElement(e,t){e.attributes.fill&&t.push({value:e.attributes.fill,type:"fill",element:e,attribute:"fill"}),e.attributes.stroke&&t.push({value:e.attributes.stroke,type:"stroke",element:e,attribute:"stroke"}),e.attributes["stop-color"]&&t.push({value:e.attributes["stop-color"],type:"stop-color",element:e,attribute:"stop-color"}),e.attributes.style&&this.extractColorsFromStyle(e.attributes.style).forEach(r=>{t.push({value:r.value,type:r.type,element:e,attribute:"style"});}),e.children.forEach(r=>this.traverseElement(r,t));}transformElement(e,t){let r=t(e);return {...r,children:r.children.map(u=>this.transformElement(u,t))}}isDrawableElement(e){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(e)}isValidColor(e){return !e||e==="none"||e==="transparent"||e==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(e)?true:["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy"].includes(e.toLowerCase())}extractColorsFromStyle(e){let t=[],r=e.match(/fill:\s*([^;]+)/);if(r){let i=r[1].trim();this.isValidColor(i)&&t.push({value:i,type:"fill"});}let u=e.match(/stroke:\s*([^;]+)/);if(u){let i=u[1].trim();this.isValidColor(i)&&t.push({value:i,type:"stroke"});}let n=e.match(/stop-color:\s*([^;]+)/);if(n){let i=n[1].trim();this.isValidColor(i)&&t.push({value:i,type:"stop-color"});}return t}},Es=class{constructor(e={}){le(this,"options"),this.options={preserveExisting:e.preserveExisting??true,onlyIfStrokePresent:e.onlyIfStrokePresent??true};}apply(e){let t=0;return {processedElement:this.transformElement(e,r=>this.shouldAddVectorEffect(r)?(t++,{...r,attributes:{...r.attributes,"vector-effect":"non-scaling-stroke"}}):r),elementsModified:t}}shouldAddVectorEffect(e){return this.options.preserveExisting&&e.attributes["vector-effect"]?false:["path","line","polyline","polygon","rect","circle","ellipse"].includes(e.tag)}transformElement(e,t){let r=t(e);return {...r,children:r.children.map(u=>this.transformElement(u,t))}}},vs=class{constructor(e={}){le(this,"options"),this.options={preserveOriginalNames:e.preserveOriginalNames??false,strokeWidthPrefix:e.strokeWidthPrefix??"strokeWidth",generateClasses:e.generateClasses??true};}extractStrokeWidths(e){let t=[];this.traverseElement(e,t);let r=new Map;return t.forEach(u=>{this.isValidStrokeWidth(u.value)&&r.set(u.value,u);}),Array.from(r.values()).sort((u,n)=>{let i=parseFloat(u.value),s=parseFloat(n.value);return isNaN(i)&&isNaN(s)?u.value.localeCompare(n.value):isNaN(i)?1:isNaN(s)?-1:i-s})}apply(e){let t=this.extractStrokeWidths(e),r=this.generateStrokeWidthMappings(t),u=this.replaceStrokeWidthsWithVariables(e,r);return {mappings:r,processedElement:u,originalStrokeWidths:t.map(n=>n.value)}}traverseElement(e,t){if(e.attributes["stroke-width"]&&t.push({value:e.attributes["stroke-width"],element:e,attribute:"stroke-width"}),e.attributes.style){let r=this.extractStrokeWidthFromStyle(e.attributes.style);r&&t.push({value:r,element:e,attribute:"style",styleProperty:"stroke-width"});}e.children.forEach(r=>this.traverseElement(r,t));}extractStrokeWidthFromStyle(e){let t=e.match(/stroke-width\s*:\s*([^;]+)/);return t?t[1].trim():null}isValidStrokeWidth(e){return e==="inherit"||e==="none"||e==="initial"||e==="unset"||e.includes("var(")||e.includes("calc(")?false:/^[\d.]+(?:px|pt|pc|in|cm|mm|em|rem|ex|ch|vw|vh|vmin|vmax|%)?$/.test(e.trim())}generateStrokeWidthMappings(e){return e.map((t,r)=>({originalStrokeWidth:t.value,variableName:r===0?this.options.strokeWidthPrefix:`${this.options.strokeWidthPrefix}${r+1}`}))}replaceStrokeWidthsWithVariables(e,t){let r=new Map(t.map(u=>[u.originalStrokeWidth,u.variableName]));return this.transformElement(e,u=>{let n={...u.attributes};if(n["stroke-width"]&&r.has(n["stroke-width"])&&(n["stroke-width"]=`{${r.get(n["stroke-width"])}}`),n.style){let i=n.style;r.forEach((s,o)=>{let a=new RegExp(`stroke-width\\s*:\\s*${this.escapeRegExp(o)}`,"g");i=i.replace(a,`stroke-width: {${s}}`);}),n.style=i;}return {...u,attributes:n}})}transformElement(e,t){let r=t(e);return {...r,children:r.children.map(u=>this.transformElement(u,t))}}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}},bs=class{constructor(e={}){le(this,"options"),this.options={addRole:e.addRole??true,addAriaHidden:e.addAriaHidden??false,addTitle:e.addTitle??true,addDesc:e.addDesc??true,defaultRole:e.defaultRole??"img",preserveExisting:e.preserveExisting??true};}apply(e){let t=[];if(e.tag!=="svg")return {processedElement:e,attributesAdded:t};let r={...e.attributes};return this.options.addRole&&(!this.options.preserveExisting||!r.role)&&(r.role=this.options.defaultRole,t.push("role")),this.options.addAriaHidden&&(!this.options.preserveExisting||!r["aria-hidden"])&&(r["aria-hidden"]="true",t.push("aria-hidden")),this.options.addTitle&&t.push("title-support"),this.options.addDesc&&t.push("desc-support"),this.options.addTitle&&this.options.addDesc&&(!this.options.preserveExisting||!r["aria-labelledby"])?(r["aria-labelledby"]="{titleId} {descId}",t.push("aria-labelledby")):this.options.addTitle&&(!this.options.preserveExisting||!r["aria-labelledby"])&&(r["aria-labelledby"]="{titleId}",t.push("aria-labelledby")),{processedElement:{...e,attributes:r},attributesAdded:t}}generateProps(){let e=[];return this.options.addTitle&&e.push("title?: string","titleId?: string"),this.options.addDesc&&e.push("desc?: string","descId?: string"),e}generateJSXElements(e){let t=[];return e==="react"?(this.options.addDesc&&t.push("{desc ? <desc id={descId}>{desc}</desc> : null}"),this.options.addTitle&&t.push("{title ? <title id={titleId}>{title}</title> : null}")):(this.options.addDesc&&t.push('<desc v-if="desc" :id="descId">{{ desc }}</desc>'),this.options.addTitle&&t.push('<title v-if="title" :id="titleId">{{ title }}</title>')),t.join(`
|
|
35
|
+
`)}},ws=class{constructor(e){this.options=e;}apply(e){return this.options.enabled?this.normalizeElements(e):e}normalizeElements(e){return e.map(t=>this.transformElement(t,r=>{let u={...r.attributes};if(this.isDrawableElement(r.tag)){let n=r.attributes.fill!==void 0&&r.attributes.fill!=="",i=r.attributes.stroke!==void 0&&r.attributes.stroke!=="";n&&!i&&(u.stroke="none"),i&&!n&&(u.fill="none");}return {...r,attributes:u}}))}transformElement(e,t){let r=t(e);return r.children&&(r.children=r.children.map(u=>this.transformElement(u,t))),r}isDrawableElement(e){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(e)}};function _r(e){let t={tag:e.tag,attributes:{...e.attributes},children:[],content:e.content};return e.tag==="defs"?t.children=e.children.filter(r=>r.tag!=="filter"):t.children=e.children.map(r=>_r(r)),t.attributes.filter&&delete t.attributes.filter,t}function ks(e,t){return t.removeFilters?{root:_r(e.root)}:e}var Ss=class{transform(e,t={}){let{optimize:r=true,splitColors:u=false,splitStrokeWidths:n=false,fixedStrokeWidth:i=false,normalizeFillStroke:s=false,accessibility:o=true,removeComments:a=true,removeDuplicates:l=true,minifyPaths:D=false,removeFilters:f=false}=t,p=this.deepCloneAst(e),c=[],d=[],h=[];return r&&(this.applyOptimizations(p,{removeComments:a,removeDuplicates:l,minifyPaths:D&&!u}),c.push("optimization")),u&&(d=this.applySplitColors(p),c.push("split-colors")),n&&(h=this.applySplitStrokeWidths(p),c.push("split-stroke-widths")),i&&(this.applyFixedStrokeWidth(p),c.push("fixed-stroke-width")),s&&(this.applyFillStrokeNormalization(p),c.push("normalize-fill-stroke")),o&&(this.applyAccessibility(p),c.push("accessibility")),f&&(p=ks(p,{removeFilters:f}),c.push("remove-filters")),{ast:p,colorMappings:d,strokeWidthMappings:h,metadata:{originalColors:d.map(m=>m.originalColor),originalStrokeWidths:h.map(m=>m.originalStrokeWidth),optimizationApplied:r,features:c,hasClassAttributes:this.hasClassAttributes(p)}}}applySplitColors(e){let t=new ys({generateClasses:true,colorPrefix:"color"}).apply(e.root);return e.root=t.processedElement,t.mappings}applyFixedStrokeWidth(e){let t=new Es({onlyIfStrokePresent:false,preserveExisting:true}).apply(e.root);e.root=t.processedElement;}applyAccessibility(e){let t=new bs({addRole:true,addTitle:true,addDesc:true,defaultRole:"img",preserveExisting:true}).apply(e.root);e.root=t.processedElement;}applyFillStrokeNormalization(e){let t=new ws({enabled:true});e.root.children=t.apply(e.root.children);}applyOptimizations(e,t){t.removeDuplicates&&this.removeDuplicateElements(e),t.minifyPaths&&this.minifyPaths(e),this.removeEmptyGroups(e);}removeDuplicateElements(e){}minifyPaths(e){this.traverseElements(e.root,t=>{t.tag==="path"&&t.attributes.d&&(t.attributes.d=t.attributes.d.replace(/\s+/g," ").replace(/([MLHVCSQTAZ])\s+/gi,"$1").trim());});}removeEmptyGroups(e){let t=r=>(r.children=r.children.filter(t),!(r.tag==="g"&&r.children.length===0&&!r.content));e.root.children=e.root.children.filter(t);}traverseElements(e,t){t(e),e.children.forEach(r=>this.traverseElements(r,t));}isValidColor(e){return !e||e==="none"||e==="transparent"||e==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(e)||/^rgba?\(.+\)$/.test(e)||/^hsla?\(.+\)$/.test(e)}deepCloneAst(e){return {...e,root:this.deepCloneElement(e.root)}}deepCloneElement(e){return {...e,attributes:{...e.attributes},children:e.children.map(t=>this.deepCloneElement(t))}}hasClassAttributes(e){let t=r=>r.attributes.class||r.attributes.className?true:r.children.some(u=>t(u));return t(e.root)}applySplitStrokeWidths(e){let t=new vs({generateClasses:true,strokeWidthPrefix:"strokeWidth"}).apply(e.root);return e.root=t.processedElement,t.mappings}},xs=class{constructor(){le(this,"parser"),le(this,"transformer"),this.parser=new Cs,this.transformer=new Ss;}extractColors(e){let t=this.parser.parse(e),r=this.parser.extractColors(t);return Array.from(new Set(r.map(u=>u.value))).sort()}validate(e){let t=[];try{let r=this.parser.parse(e);r.root||t.push("No root SVG element found"),!r.viewBox&&!r.width&&!r.height&&t.push("SVG should have viewBox or width/height attributes");}catch(r){t.push(r instanceof Error?r.message:String(r));}return {valid:t.length===0,errors:t}}async convert(e,t,r){try{let u=this.parser.parse(e),n=this.transformer.transform(u,t.transformation);return {...await new r(t.generator).generate(n),metadata:n.metadata}}catch(u){throw new Error(`SVG conversion failed: ${u instanceof Error?u.message:String(u)}`)}}},Bs=Object.defineProperty,As=(e,t,r)=>t in e?Bs(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,$s=(e,t,r)=>As(e,t+"",r),Ns=class extends ComponentGenerator{constructor(e={}){super(e),$s(this,"reactOptions"),this.reactOptions={...this.options,memo:e.memo??true,forwardRef:e.forwardRef??true,propTypes:e.propTypes??false,defaultProps:e.defaultProps??false,namedExport:e.namedExport??false};}async formatCode(e,t){try{let{format:r}=await Promise.resolve().then(()=>(ht(),ft));return await r(e,{parser:t,semi:!0,singleQuote:!0,trailingComma:"es5",tabWidth:2,printWidth:80,bracketSpacing:!0,arrowParens:"avoid"})}catch(r){return console.warn("Prettier formatting failed or not available, using unformatted code:",r),e}}async generate(e){let t=this.getComponentName(),{colorMappings:r,strokeWidthMappings:u,metadata:n}=e,i=this.generateImports(),s=this.generateInterfaces(r,u,n.features),o=this.generateComponent(e),a=this.generateExports(t),l=[i,s,o,a].filter(Boolean).join(`
|
|
36
36
|
|
|
37
37
|
`),D=this.reactOptions.typescript?"tsx":"jsx",f=this.generateFilename(t,D),p=D==="tsx"?"typescript":"babel";return {code:await this.formatCode(l,p),filename:f,componentName:t,dependencies:this.getDependencies()}}generateImports(){let e=[];if(this.reactOptions.typescript){let t=[];this.reactOptions.forwardRef&&(t.push("Ref"),t.push("forwardRef")),this.reactOptions.memo&&t.push("memo"),t.length>0?e.push(`import React, { ${t.join(", ")} } from 'react';`):e.push("import React from 'react';");}else {let t=[];this.reactOptions.forwardRef&&t.push("forwardRef"),this.reactOptions.memo&&t.push("memo"),t.length>0?e.push(`import React, { ${t.join(", ")} } from 'react';`):e.push("import React from 'react';"),this.reactOptions.propTypes&&e.push("import PropTypes from 'prop-types';");}return e.join(`
|
|
38
38
|
`)}generateInterfaces(e,t,r){return !this.reactOptions.typescript&&!this.reactOptions.propTypes?"":this.reactOptions.typescript?this.generateTypeScriptInterface(e,t,r):this.generatePropTypes(e,t,r)}generateTypeScriptInterface(e,t,r){let u=["title?: string;","titleId?: string;","desc?: string;","descId?: string;","size?: string | number;"],n=this.generateColorProps(e);n&&u.push(n);let i=this.generateStrokeWidthProps(t);return i&&u.push(i),r.includes("fixed-stroke-width")&&u.push("isFixedStrokeWidth?: boolean;"),`interface ${this.getComponentName()}Props extends React.SVGProps<SVGSVGElement> {
|
|
@@ -41,12 +41,12 @@ The range will extend backwards to the start of the first line containing the se
|
|
|
41
41
|
}`}generatePropTypes(e,t,r){let u=this.getComponentName(),n=["title: PropTypes.string,","titleId: PropTypes.string,","desc: PropTypes.string,","descId: PropTypes.string,","size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),","className: PropTypes.string,","style: PropTypes.object,","width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),","height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),"],i=this.generateColorProps(e);i&&n.push(i);let s=this.generateStrokeWidthProps(t);return s&&n.push(s),r.includes("fixed-stroke-width")&&n.push("isFixedStrokeWidth: PropTypes.bool,"),`${u}.propTypes = {
|
|
42
42
|
${n.join(`
|
|
43
43
|
`)}
|
|
44
|
-
};`}generateComponent(e){let t=this.getComponentName(),{colorMappings:r,strokeWidthMappings:u,metadata:n}=e,i=["title","titleId","desc","descId","size"],s=r.map(g=>g.variableName),o=r.map(g=>`${g.variableName}Class`),a=u.map(g=>g.variableName),l=u.map(g=>`${g.variableName}Class`),D=[...i,...s,...o,...a,...l],f=this.generateColorDefaults(r),p=this.generateStrokeWidthDefaults(u),
|
|
44
|
+
};`}generateComponent(e){let t=this.getComponentName(),{colorMappings:r,strokeWidthMappings:u,metadata:n}=e,i=["title","titleId","desc","descId","size"],s=r.map(g=>g.variableName),o=r.map(g=>`${g.variableName}Class`),a=u.map(g=>g.variableName),l=u.map(g=>`${g.variableName}Class`),D=[...i,...s,...o,...a,...l],f=this.generateColorDefaults(r),p=this.generateStrokeWidthDefaults(u),c='size = ""',d=n.features.includes("fixed-stroke-width")?"isFixedStrokeWidth = true":"",h=[c,f,p,d].filter(Boolean).join(", "),m=h.split(", ").map(g=>g.split(" = ")[0]),F=`{
|
|
45
45
|
${D.filter(g=>!m.includes(g)).join(`,
|
|
46
46
|
`)},
|
|
47
47
|
${h},
|
|
48
48
|
...svgProps
|
|
49
|
-
}`,
|
|
49
|
+
}`,y=this.generateSvgAttributes(e.ast),C="{title ? <title id={titleId}>{title}</title> : null}",E="{desc ? <desc id={descId}>{desc}</desc> : null}";if(this.reactOptions.typescript){let g=`${t}Props`,v=this.reactOptions.forwardRef?", ref: Ref<SVGSVGElement>":"",B=e.ast.root.children.map(De=>this.elementToJsx(De,1)).join(`
|
|
50
50
|
`),U=this.getViewBoxDimensions(e.ast);return `const ${t} = (${F}: ${g}${v}) => {
|
|
51
51
|
const computedSize = {
|
|
52
52
|
width: svgProps.width || size || '${U.width}',
|
|
@@ -56,11 +56,11 @@ The range will extend backwards to the start of the first line containing the se
|
|
|
56
56
|
return (
|
|
57
57
|
<svg
|
|
58
58
|
${this.reactOptions.forwardRef?`ref={ref}
|
|
59
|
-
`:""}${
|
|
59
|
+
`:""}${y}
|
|
60
60
|
{...svgProps}
|
|
61
61
|
{...computedSize}
|
|
62
62
|
>
|
|
63
|
-
${
|
|
63
|
+
${C}
|
|
64
64
|
${E}
|
|
65
65
|
${B}
|
|
66
66
|
</svg>
|
|
@@ -73,8 +73,8 @@ ${B}
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
|
-
<svg ${
|
|
77
|
-
${
|
|
76
|
+
<svg ${y}{...svgProps} {...computedSize}>
|
|
77
|
+
${C}
|
|
78
78
|
${E}
|
|
79
79
|
${g}
|
|
80
80
|
</svg>
|
|
@@ -85,7 +85,7 @@ ${g}
|
|
|
85
85
|
`:""}elementToJsx(e,t=0){let r=" ".repeat(t+1),{tag:u,attributes:n,children:i,content:s}=e,o=this.attributesToJsxWithClasses(n),a=o.length>0?" "+o.join(" "):"";if(i.length===0&&!s)return `${r}<${u}${a} />`;let l=`${r}<${u}${a}>`;return s&&(l+=s),i.length>0&&(l+=`
|
|
86
86
|
`,l+=i.map(D=>this.elementToJsx(D,t+1)).join(`
|
|
87
87
|
`),l+=`
|
|
88
|
-
`+r),l+=`</${u}>`,l}attributesToJsxWithClasses(e){let t=[],r=[],u="class"in e||"className"in e;if(Object.entries(e).forEach(([n,i])=>{let s=toReactProp(n);if(n==="vector-effect"&&i==="non-scaling-stroke")t.push("vectorEffect={isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'}");else if((n==="fill"||n==="stroke")&&i.startsWith("{")&&i.endsWith("}")){let o=i.slice(1,-1);t.push(`${s}=${i}`);let a=`${o}Class`;r.push(a);}else if(n==="stroke-width"&&i.startsWith("{")&&i.endsWith("}")){let o=i.slice(1,-1);t.push(`${s}=${i}`);let a=`${o}Class`;r.push(a);}else if(n==="style"){let o=this.parseStyleString(i),a=Object.entries(o).map(([l,D])=>{if(typeof D=="string"&&D.startsWith("{")&&D.endsWith("}")){let f=D.slice(1,-1);if(l==="strokeWidth"){let p=`${f}Class`;r.push(p);}return `${l}: ${f}`}else return `${l}: '${D}'`});t.push(`style={{ ${a.join(", ")} }}`);}else i.startsWith("{")&&i.endsWith("}")?t.push(`${s}=${i}`):t.push(`${s}="${i}"`);}),r.length>0){let n=e.class||e.className;if(r.length===1)n?t.push(`className={\`${n} \${${r[0]}}\`}`):t.push(`className={${r[0]}}`);else {let i=r.map(s=>`\${${s}}`).join(" ");n?t.push(`className={\`${n} ${i}\`}`):t.push(`className={\`${i}\`}`);}}else if(u){let n=e.class||e.className;n&&t.push(`className="${n}"`);}return t}getViewBoxDimensions(e){let{width:t,height:r,viewBox:u}=e;if(t&&r)return {width:t,height:r};if(u){let n=u.split(" ");if(n.length===4)return {width:n[2],height:n[3]}}return {width:"24",height:"24"}}parseStyleString(e){let t={};return e.split(";").forEach(r=>{let u=r.indexOf(":");if(u>0){let n=r.slice(0,u).trim(),i=r.slice(u+1).trim();if(n&&i){let s=camelCase(n);t[s]=i;}}}),t}}
|
|
88
|
+
`+r),l+=`</${u}>`,l}attributesToJsxWithClasses(e){let t=[],r=[],u="class"in e||"className"in e;if(Object.entries(e).forEach(([n,i])=>{let s=toReactProp(n);if(n==="vector-effect"&&i==="non-scaling-stroke")t.push("vectorEffect={isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'}");else if((n==="fill"||n==="stroke")&&i.startsWith("{")&&i.endsWith("}")){let o=i.slice(1,-1);t.push(`${s}=${i}`);let a=`${o}Class`;r.push(a);}else if(n==="stroke-width"&&i.startsWith("{")&&i.endsWith("}")){let o=i.slice(1,-1);t.push(`${s}=${i}`);let a=`${o}Class`;r.push(a);}else if(n==="style"){let o=this.parseStyleString(i),a=Object.entries(o).map(([l,D])=>{if(typeof D=="string"&&D.startsWith("{")&&D.endsWith("}")){let f=D.slice(1,-1);if(l==="strokeWidth"){let p=`${f}Class`;r.push(p);}return `${l}: ${f}`}else return `${l}: '${D}'`});t.push(`style={{ ${a.join(", ")} }}`);}else i.startsWith("{")&&i.endsWith("}")?t.push(`${s}=${i}`):t.push(`${s}="${i}"`);}),r.length>0){let n=e.class||e.className;if(r.length===1)n?t.push(`className={\`${n} \${${r[0]}}\`}`):t.push(`className={${r[0]}}`);else {let i=r.map(s=>`\${${s}}`).join(" ");n?t.push(`className={\`${n} ${i}\`}`):t.push(`className={\`${i}\`}`);}}else if(u){let n=e.class||e.className;n&&t.push(`className="${n}"`);}return t}getViewBoxDimensions(e){let{width:t,height:r,viewBox:u}=e;if(t&&r)return {width:t,height:r};if(u){let n=u.split(" ");if(n.length===4)return {width:n[2],height:n[3]}}return {width:"24",height:"24"}}parseStyleString(e){let t={};return e.split(";").forEach(r=>{let u=r.indexOf(":");if(u>0){let n=r.slice(0,u).trim(),i=r.slice(u+1).trim();if(n&&i){let s=camelCase(n);t[s]=i;}}}),t}},Os=Object.defineProperty,Ps=(e,t,r)=>t in e?Os(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,Ts=(e,t,r)=>Ps(e,t+"",r),Is=class extends ComponentGenerator{constructor(e={}){super(e),Ts(this,"vueOptions"),this.vueOptions={...this.options,composition:e.composition??true,scriptSetup:e.scriptSetup??true,sfc:e.sfc??true,defineComponent:e.defineComponent??false,useDefineOptions:e.useDefineOptions??false};}async formatCode(e,t){try{let{format:r}=await Promise.resolve().then(()=>(ht(),ft));return await r(e,{parser:t,semi:!0,singleQuote:!0,trailingComma:"es5",tabWidth:2,printWidth:80,bracketSpacing:!0,arrowParens:"avoid",htmlWhitespaceSensitivity:"ignore",vueIndentScriptAndStyle:!0})}catch(r){return console.warn("Prettier formatting failed or not available, using unformatted code:",r),e}}async generate(e){let t=this.getComponentName(),r;this.vueOptions.sfc?r=this.generateSFC(e):r=this.generateJSComponent(e);let u=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"ts":"js",n=this.generateFilename(t,u),i=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"typescript":"babel";return {code:await this.formatCode(r,i),filename:n,componentName:t,dependencies:this.getDependencies()}}generateSFC(e){let t=this.generateTemplate(e),r=this.generateScript(e),u=this.generateStyle();return `<template>
|
|
89
89
|
${t}
|
|
90
90
|
</template>
|
|
91
91
|
|
|
@@ -102,7 +102,7 @@ ${u}
|
|
|
102
102
|
<title v-if="props.title" :id="props.titleId">{{ props.title }}</title>
|
|
103
103
|
<desc v-if="props.desc" :id="props.descId">{{ props.desc }}</desc>
|
|
104
104
|
${u}
|
|
105
|
-
</svg>`}elementToVueTemplate(e,t=0){let r=" ".repeat(t),{tag:u,attributes:n,children:i,content:s}=e,o=[],a=[],l="class"in n;if(Object.entries(n).forEach(([p,
|
|
105
|
+
</svg>`}elementToVueTemplate(e,t=0){let r=" ".repeat(t),{tag:u,attributes:n,children:i,content:s}=e,o=[],a=[],l="class"in n;if(Object.entries(n).forEach(([p,c])=>{if(p==="vector-effect"&&c==="non-scaling-stroke")o.push(`:vector-effect="props.isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'"`);else if(p==="style"){let d=this.parseStyleStringForVue(c);o.push(`:style="${d}"`);let h=this.extractClassVarsFromStyle(c);a.push(...h);}else if(c.startsWith("{")&&c.endsWith("}")){let d=c.slice(1,-1);if(o.push(`:${p}="props.${d}"`),p==="fill"||p==="stroke"||p==="stroke-width"){let h=`${d}Class`;a.push(`props.${h}`);}}else o.push(`${p}="${c}"`);}),a.length>0){let p=n.class;p?o.push(`:class="[${a.join(", ")}, '${p}']"`):o.push(`:class="[${a.join(", ")}]"`);}else if(l){let p=n.class;p&&o.push(`class="${p}"`);}let D=o.length>0?" "+o.join(" "):"";if(i.length===0&&!s)return `${r}<${u}${D} />`;let f=`${r}<${u}${D}>`;return s&&(f+=s),i.length>0&&(f+=`
|
|
106
106
|
`,f+=i.map(p=>this.elementToVueTemplate(p,t+1)).join(`
|
|
107
107
|
`),f+=`
|
|
108
108
|
`+r),f+=`</${u}>`,f}generateScript(e){return this.vueOptions.scriptSetup?this.generateScriptSetup(e):this.vueOptions.composition?this.generateCompositionAPI(e):this.generateOptionsAPI(e)}generateScriptSetup(e){let{colorMappings:t,strokeWidthMappings:r,metadata:u}=e,n=[];if(this.vueOptions.typescript?(n.push('import type { SVGAttributes } from "vue";'),n.push('import { computed } from "vue";'),n.push("")):(n.push('import { computed } from "vue";'),n.push("")),this.vueOptions.typescript){n.push("interface Props extends /* @vue-ignore */ SVGAttributes {"),n.push(" title?: string;"),n.push(" titleId?: string;"),n.push(" desc?: string;"),n.push(" descId?: string;"),n.push(" width?: string | number;"),n.push(" height?: string | number;"),n.push(" size?: string | number;");let s=this.generateColorPropsInterface(t);s&&n.push(s);let o=this.generateStrokeWidthPropsInterface(r);o&&n.push(o),u.features.includes("fixed-stroke-width")&&n.push(" isFixedStrokeWidth?: boolean;"),n.push("}"),n.push(""),n.push("const props = withDefaults(defineProps<Props>(), {");}else n.push("const props = defineProps({"),n.push(" title: { type: String, default: '' },"),n.push(" titleId: { type: String, default: '' },"),n.push(" desc: { type: String, default: '' },"),n.push(" descId: { type: String, default: '' },"),n.push(" class: { type: String, default: '' },"),n.push(" style: { type: Object, default: '' },"),n.push(" width: { type: [String, Number], default: '' },"),n.push(" height: { type: [String, Number], default: '' },"),n.push(' size: { type: [String, Number], default: "" },');this.vueOptions.typescript&&n.push(' size: "",'),t.forEach(s=>{let o=s.variableName,a=s.originalColor,l=`${o}Class`;this.vueOptions.typescript?(n.push(` ${o}: '${a}',`),n.push(` ${l}: "",`)):(n.push(` ${o}: { type: String, default: '${a}' },`),n.push(` ${l}: { type: String, default: "" },`));}),r.forEach(s=>{let o=s.variableName,a=s.originalStrokeWidth,l=`${o}Class`;this.vueOptions.typescript?(n.push(` ${o}: '${a}',`),n.push(` ${l}: "",`)):(n.push(` ${o}: { type: [String, Number], default: '${a}' },`),n.push(` ${l}: { type: String, default: "" },`));}),u.features.includes("fixed-stroke-width")&&(this.vueOptions.typescript?n.push(" isFixedStrokeWidth: true,"):n.push(" isFixedStrokeWidth: { type: Boolean, default: true },")),n.push("});"),n.push("");let i=this.getViewBoxDimensions(e.ast);return n.push("const computedSize = computed(() => ({"),n.push(` width: props.width || props.size || '${i.width}',`),n.push(` height: props.height || props.size || '${i.height}'`),n.push("}));"),n.join(`
|
|
@@ -112,7 +112,7 @@ ${u}
|
|
|
112
112
|
${u}?: string;`}).join(`
|
|
113
113
|
`)}generateStrokeWidthPropsInterface(e){return e.length===0?"":e.map(t=>{let r=t.variableName,u=`${r}Class`;return ` ${r}?: string | number;
|
|
114
114
|
${u}?: string;`}).join(`
|
|
115
|
-
`)}parseStyleStringForVue(e){let t=[];return e.split(";").forEach(r=>{let u=r.indexOf(":");if(u>0){let n=r.slice(0,u).trim(),i=r.slice(u+1).trim();if(n&&i)if(i.startsWith("{")&&i.endsWith("}")){let s=i.slice(1,-1);t.push(`'${n}': props.${s}`);}else t.push(`'${n}': '${i}'`);}}),`{ ${t.join(", ")} }`}generateSvgAttributes(e){let t=[],r={...e.root.attributes||{},...e.viewBox&&{viewBox:e.viewBox},...e.namespace&&{xmlns:e.namespace},...e.width&&{width:e.width},...e.height&&{height:e.height}};r.xmlns||(r.xmlns="http://www.w3.org/2000/svg");let u=r.viewBox;return Object.entries(r).forEach(([n,i])=>{if(i!=null){if(u&&(n==="width"||n==="height"))return;if(n==="aria-labelledby"&&typeof i=="string"&&i.includes("{")){let s=i.replace(/\{(\w+)\}/g,"${props.$1}");t.push(` :aria-labelledby="\`${s}\`"`);}else t.push(` ${n}="${i}"`);}}),t.join("")}getDependencies(){return ["vue"]}extractClassVarsFromStyle(e){let t=[];return e.split(";").forEach(r=>{let u=r.indexOf(":");if(u>0){let n=r.slice(0,u).trim(),i=r.slice(u+1).trim();if(n&&i&&i.startsWith("{")&&i.endsWith("}")){let s=i.slice(1,-1);if(n==="fill"||n==="stroke"||n==="stroke-width"){let o=`props.${s}Class`;t.push(o);}}}}),t}},Fe=class{constructor(){
|
|
115
|
+
`)}parseStyleStringForVue(e){let t=[];return e.split(";").forEach(r=>{let u=r.indexOf(":");if(u>0){let n=r.slice(0,u).trim(),i=r.slice(u+1).trim();if(n&&i)if(i.startsWith("{")&&i.endsWith("}")){let s=i.slice(1,-1);t.push(`'${n}': props.${s}`);}else t.push(`'${n}': '${i}'`);}}),`{ ${t.join(", ")} }`}generateSvgAttributes(e){let t=[],r={...e.root.attributes||{},...e.viewBox&&{viewBox:e.viewBox},...e.namespace&&{xmlns:e.namespace},...e.width&&{width:e.width},...e.height&&{height:e.height}};r.xmlns||(r.xmlns="http://www.w3.org/2000/svg");let u=r.viewBox;return Object.entries(r).forEach(([n,i])=>{if(i!=null){if(u&&(n==="width"||n==="height"))return;if(n==="aria-labelledby"&&typeof i=="string"&&i.includes("{")){let s=i.replace(/\{(\w+)\}/g,"${props.$1}");t.push(` :aria-labelledby="\`${s}\`"`);}else t.push(` ${n}="${i}"`);}}),t.join("")}getDependencies(){return ["vue"]}extractClassVarsFromStyle(e){let t=[];return e.split(";").forEach(r=>{let u=r.indexOf(":");if(u>0){let n=r.slice(0,u).trim(),i=r.slice(u+1).trim();if(n&&i&&i.startsWith("{")&&i.endsWith("}")){let s=i.slice(1,-1);if(n==="fill"||n==="stroke"||n==="stroke-width"){let o=`props.${s}Class`;t.push(o);}}}}),t}},Fe=class{constructor(){ms(this,"engine"),this.engine=new xs;}async convert(e,t){let{framework:r,typescript:u=true,componentName:n="Icon",prefix:i,suffix:s,splitColors:o=false,splitStrokeWidths:a=false,fixedStrokeWidth:l=false,normalizeFillStroke:D=false,removeFilters:f=false,memo:p=true,forwardRef:c=true,sfc:d=true,scriptSetup:h=true,optimize:m=true}=t,F={framework:r,transformation:{splitColors:o,splitStrokeWidths:a,fixedStrokeWidth:l,normalizeFillStroke:D,removeFilters:f,optimize:m,accessibility:true},generator:r==="react"?{typescript:u,componentName:n,prefix:i,suffix:s,memo:p,forwardRef:c,exportDefault:true,namedExport:false}:{typescript:u,componentName:n,prefix:i,suffix:s,sfc:d,scriptSetup:h,composition:true,exportDefault:true}},y={react:Ns,vue:Is},C=await this.engine.convert(e,F,y[r]);return {code:C.code,componentName:C.componentName,filename:C.filename,framework:r,typescript:u,metadata:C.metadata,dependencies:C.dependencies}}extractColors(e){return this.engine.extractColors(e)}validate(e){let t=[],r=e.trim();if(!r)return {valid:false,errors:["SVG content is empty"]};if(!r.includes("<svg"))return {valid:false,errors:["No <svg> element found"]};if(typeof DOMParser<"u"){let u=new DOMParser().parseFromString(r,"application/xml").querySelector("parsererror");if(u)return t.push("Invalid XML/SVG structure: "+(u.textContent?.trim()||"XML parsing failed")),{valid:false,errors:t};this.validateXMLStructure(r,t);}else this.validateWithRegex(r,t);return {valid:t.length===0,errors:t}}validateXMLStructure(e,t){if(/\w+\s*=\s*"[^"]*<[a-zA-Z]/g.test(e)){t.push("Invalid XML/SVG structure: Malformed attribute syntax");return}if(/\w+\s*=\s*"[^"]*"[^>\s]*<[^>]*>/g.test(e)){t.push("Invalid XML/SVG structure: Invalid characters in attributes");return}if(/^\s*[a-zA-Z-]+\s*=\s*"/gm.test(e)){let r=e.split(`
|
|
116
116
|
`);for(let u=0;u<r.length;u++){let n=r[u].trim();if(/^[a-zA-Z-]+\s*=\s*"/.test(n)){let i=false;for(let s=u-1;s>=0;s--){let o=r[s].trim();if(o.includes("<svg")||o.includes("<")&&o.includes("=")){i=true;break}if(o.includes("</")||o.includes("/>"))break}if(!i){t.push("Invalid XML/SVG structure: Malformed tag structure");return}}}}}validateWithRegex(e,t){this.validateXMLStructure(e,t);}async convertBatch(e,t){let r=[];for(let{content:u,name:n}of e){let i=await this.convert(u,{...t,componentName:n});r.push(i);}return r}generateIndexFile(e,t={}){let{exportType:r="named",typescript:u=true}=t,n=e[0]?.framework||"react",i=[...e].sort((o,a)=>o.componentName.localeCompare(a.componentName)),s="";if(r==="named"){s+=`// Auto-generated index file for tree-shaking
|
|
117
117
|
`,s+=`// This file exports all components for optimal bundling
|
|
118
118
|
|
|
@@ -135,4 +135,4 @@ export default {
|
|
|
135
135
|
`,s+=`
|
|
136
136
|
// Individual exports for flexibility
|
|
137
137
|
`;for(let o of i)s+=`export { default as ${o.componentName} } from './${this.getImportPath(o.filename,n)}';
|
|
138
|
-
`;}return s}getImportPath(e,t){return t==="vue"&&e.endsWith(".vue")?e:e.replace(/\.(tsx?|jsx?|vue)$/,"")}};async function
|
|
138
|
+
`;}return s}getImportPath(e,t){return t==="vue"&&e.endsWith(".vue")?e:e.replace(/\.(tsx?|jsx?|vue)$/,"")}};async function ro(e,t={}){return new Fe().convert(e,{...t,framework:"react"})}async function uo(e,t={}){return new Fe().convert(e,{...t,framework:"vue"})}async function no(e,t){return new Fe().convertBatch(e,t)}function io(e){return new Fe().extractColors(e)}function so(e){return new Fe().validate(e)}export{Fe as SVGFusionBrowser,no as convertBatch,ro as convertToReact,uo as convertToVue,io as extractColors,so as validateSvg};
|