svgfusion 1.15.2 → 1.16.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.mjs +85 -85
- package/dist/cli.js +91 -51
- package/dist/index.js +19 -19
- package/dist/index.mjs +19 -19
- package/package.json +1 -1
package/dist/browser.mjs
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
var Mr=Object.defineProperty;var Lr=(e,t,r)=>t in e?Mr(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var b=(e,t,r)=>Lr(e,typeof t!="symbol"?t+"":t,r);var Ce=class{parse(t){let r=this.cleanSvgContent(t),n=this.parseElement(r);return {root:n,viewBox:n.attributes.viewBox,width:n.attributes.width,height:n.attributes.height,namespace:n.attributes.xmlns}}extractColors(t){let r=[];return this.traverseElements(t.root,n=>{n.attributes.fill&&this.isValidColor(n.attributes.fill)&&r.push({value:n.attributes.fill,type:"fill",element:n,attribute:"fill"}),n.attributes.stroke&&this.isValidColor(n.attributes.stroke)&&r.push({value:n.attributes.stroke,type:"stroke",element:n,attribute:"stroke"}),n.attributes["stop-color"]&&this.isValidColor(n.attributes["stop-color"])&&r.push({value:n.attributes["stop-color"],type:"stop-color",element:n,attribute:"stop-color"});}),r}cleanSvgContent(t){return t.replace(/<\?xml[^>]*\?>/gi,"").replace(/<!--[\s\S]*?-->/g,"").trim()}parseElement(t){let r=t.match(/<svg([^>]*)>/i);if(!r)throw new Error("Invalid SVG: No svg element found");let n=this.parseAttributes(r[1]),i=this.parseChildren(t);return {tag:"svg",attributes:n,children:i}}parseAttributes(t){let r={},n=/(\w+(?:-\w+)*)=["']([^"']*)["']/g,i;for(;(i=n.exec(t))!==null;)r[i[1]]=i[2];return r}parseChildren(t){let r=[],n=t.match(/<svg[^>]*>(.*)<\/svg>/is);if(!n||!n[1])return r;let i=n[1],s=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,o;for(;(o=s.exec(i))!==null;){let[,u,a,l]=o,c=this.parseAttributes(a),d={tag:u,attributes:c,children:[]};l!==void 0&&(l.includes("<")?d.children=this.parseNestedElements(l):l.trim()&&(d.content=l.trim())),r.push(d);}return r}parseNestedElements(t){let r=[],n=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,i;for(;(i=n.exec(t))!==null;){let[,s,o,u]=i,a=this.parseAttributes(o),l={tag:s,attributes:a,children:[]};u!==void 0&&(u.includes("<")?l.children=this.parseNestedElements(u):u.trim()&&(l.content=u.trim())),r.push(l);}return r}traverseElements(t,r){r(t),t.children.forEach(n=>this.traverseElements(n,r));}isValidColor(t){return !t||t==="none"||t==="transparent"||t==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(t)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)?true:["red","green","blue","black","white","yellow","cyan","magenta"].includes(t.toLowerCase())}};var Ee=class{constructor(t={}){b(this,"options");this.options={preserveOriginalNames:t.preserveOriginalNames??false,generateClasses:t.generateClasses??true,colorPrefix:t.colorPrefix??"color"};}extractColors(t){let r=[];this.traverseElement(t,r);let n=new Map;return r.forEach(i=>{this.isValidColor(i.value)&&n.set(i.value,i);}),Array.from(n.values()).sort((i,s)=>i.value.localeCompare(s.value))}apply(t){let r=this.extractColors(t),n=this.generateColorMappings(r),i=this.replaceColorsWithVariables(t,n);return {mappings:n,processedElement:i,originalColors:r.map(s=>s.value)}}generateColorMappings(t){return t.map((r,n)=>({originalColor:r.value,variableName:n===0?this.options.colorPrefix:`${this.options.colorPrefix}${n+1}`,type:r.type}))}replaceColorsWithVariables(t,r){let n=new Map(r.map(i=>[i.originalColor,i.variableName]));return this.transformElement(t,i=>{let s={...i.attributes};if(s.fill&&n.has(s.fill)&&(s.fill=`{${n.get(s.fill)}}`),s.stroke&&n.has(s.stroke)&&(s.stroke=`{${n.get(s.stroke)}}`),s["stop-color"]&&n.has(s["stop-color"])&&(s["stop-color"]=`{${n.get(s["stop-color"])}}`),s.style){let o=s.style,u=o.match(/fill:\s*([^;]+)/);if(u){let c=u[1].trim();n.has(c)&&(o=o.replace(/fill:\s*[^;]+/,`fill: {${n.get(c)}}`));}let a=o.match(/stroke:\s*([^;]+)/);if(a){let c=a[1].trim();n.has(c)&&(o=o.replace(/stroke:\s*[^;]+/,`stroke: {${n.get(c)}}`));}let l=o.match(/stop-color:\s*([^;]+)/);if(l){let c=l[1].trim();n.has(c)&&(o=o.replace(/stop-color:\s*[^;]+/,`stop-color: {${n.get(c)}}`));}s.style=o;}if(this.isDrawableElement(i.tag)){let o=i.attributes.fill!==void 0&&i.attributes.fill!=="",u=i.attributes.stroke!==void 0&&i.attributes.stroke!=="";o&&!u&&!s.stroke&&(s.stroke="none"),u&&!o&&!s.fill&&(s.fill="none");}return {...i,attributes:s}})}traverseElement(t,r){t.attributes.fill&&r.push({value:t.attributes.fill,type:"fill",element:t,attribute:"fill"}),t.attributes.stroke&&r.push({value:t.attributes.stroke,type:"stroke",element:t,attribute:"stroke"}),t.attributes["stop-color"]&&r.push({value:t.attributes["stop-color"],type:"stop-color",element:t,attribute:"stop-color"}),t.attributes.style&&this.extractColorsFromStyle(t.attributes.style).forEach(i=>{r.push({value:i.value,type:i.type,element:t,attribute:"style"});}),t.children.forEach(n=>this.traverseElement(n,r));}transformElement(t,r){let n=r(t);return {...n,children:n.children.map(i=>this.transformElement(i,r))}}isDrawableElement(t){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(t)}isValidColor(t){return !t||t==="none"||t==="transparent"||t==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(t)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)?true:["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy"].includes(t.toLowerCase())}extractColorsFromStyle(t){let r=[],n=t.match(/fill:\s*([^;]+)/);if(n){let o=n[1].trim();this.isValidColor(o)&&r.push({value:o,type:"fill"});}let i=t.match(/stroke:\s*([^;]+)/);if(i){let o=i[1].trim();this.isValidColor(o)&&r.push({value:o,type:"stroke"});}let s=t.match(/stop-color:\s*([^;]+)/);if(s){let o=s[1].trim();this.isValidColor(o)&&r.push({value:o,type:"stop-color"});}return r}};var ye=class{constructor(t={}){b(this,"options");this.options={preserveExisting:t.preserveExisting??true,onlyIfStrokePresent:t.onlyIfStrokePresent??true};}apply(t){let r=0;return {processedElement:this.transformElement(t,i=>this.shouldAddVectorEffect(i)?(r++,{...i,attributes:{...i.attributes,"vector-effect":"non-scaling-stroke"}}):i),elementsModified:r}}shouldAddVectorEffect(t){return this.options.preserveExisting&&t.attributes["vector-effect"]?false:["path","line","polyline","polygon","rect","circle","ellipse"].includes(t.tag)}transformElement(t,r){let n=r(t);return {...n,children:n.children.map(i=>this.transformElement(i,r))}}};var ve=class{constructor(t={}){b(this,"options");this.options={preserveOriginalNames:t.preserveOriginalNames??false,strokeWidthPrefix:t.strokeWidthPrefix??"strokeWidth",generateClasses:t.generateClasses??true};}extractStrokeWidths(t){let r=[];this.traverseElement(t,r);let n=new Map;return r.forEach(i=>{this.isValidStrokeWidth(i.value)&&n.set(i.value,i);}),Array.from(n.values()).sort((i,s)=>{let o=parseFloat(i.value),u=parseFloat(s.value);return isNaN(o)&&isNaN(u)?i.value.localeCompare(s.value):isNaN(o)?1:isNaN(u)?-1:o-u})}apply(t){let r=this.extractStrokeWidths(t),n=this.generateStrokeWidthMappings(r),i=this.replaceStrokeWidthsWithVariables(t,n);return {mappings:n,processedElement:i,originalStrokeWidths:r.map(s=>s.value)}}traverseElement(t,r){if(t.attributes["stroke-width"]&&r.push({value:t.attributes["stroke-width"],element:t,attribute:"stroke-width"}),t.attributes.style){let n=this.extractStrokeWidthFromStyle(t.attributes.style);n&&r.push({value:n,element:t,attribute:"style",styleProperty:"stroke-width"});}t.children.forEach(n=>this.traverseElement(n,r));}extractStrokeWidthFromStyle(t){let r=t.match(/stroke-width\s*:\s*([^;]+)/);return r?r[1].trim():null}isValidStrokeWidth(t){return t==="inherit"||t==="none"||t==="initial"||t==="unset"||t.includes("var(")||t.includes("calc(")?false:/^[\d.]+(?:px|pt|pc|in|cm|mm|em|rem|ex|ch|vw|vh|vmin|vmax|%)?$/.test(t.trim())}generateStrokeWidthMappings(t){return t.map((r,n)=>({originalStrokeWidth:r.value,variableName:n===0?this.options.strokeWidthPrefix:`${this.options.strokeWidthPrefix}${n+1}`}))}replaceStrokeWidthsWithVariables(t,r){let n=new Map(r.map(i=>[i.originalStrokeWidth,i.variableName]));return this.transformElement(t,i=>{let s={...i.attributes};if(s["stroke-width"]&&n.has(s["stroke-width"])&&(s["stroke-width"]=`{${n.get(s["stroke-width"])}}`),s.style){let o=s.style;n.forEach((u,a)=>{let l=new RegExp(`stroke-width\\s*:\\s*${this.escapeRegExp(a)}`,"g");o=o.replace(l,`stroke-width: {${u}}`);}),s.style=o;}return {...i,attributes:s}})}transformElement(t,r){let n=r(t);return {...n,children:n.children.map(i=>this.transformElement(i,r))}}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var be=class{constructor(t={}){b(this,"options");this.options={addRole:t.addRole??true,addAriaHidden:t.addAriaHidden??false,addTitle:t.addTitle??true,addDesc:t.addDesc??true,defaultRole:t.defaultRole??"img",preserveExisting:t.preserveExisting??true};}apply(t){let r=[];if(t.tag!=="svg")return {processedElement:t,attributesAdded:r};let n={...t.attributes};return this.options.addRole&&(!this.options.preserveExisting||!n.role)&&(n.role=this.options.defaultRole,r.push("role")),this.options.addAriaHidden&&(!this.options.preserveExisting||!n["aria-hidden"])&&(n["aria-hidden"]="true",r.push("aria-hidden")),this.options.addTitle&&r.push("title-support"),this.options.addDesc&&r.push("desc-support"),this.options.addTitle&&this.options.addDesc&&(!this.options.preserveExisting||!n["aria-labelledby"])?(n["aria-labelledby"]="{titleId} {descId}",r.push("aria-labelledby")):this.options.addTitle&&(!this.options.preserveExisting||!n["aria-labelledby"])&&(n["aria-labelledby"]="{titleId}",r.push("aria-labelledby")),{processedElement:{...t,attributes:n},attributesAdded:r}}generateProps(){let t=[];return this.options.addTitle&&t.push("title?: string","titleId?: string"),this.options.addDesc&&t.push("desc?: string","descId?: string"),t}generateJSXElements(t){let r=[];return t==="react"?(this.options.addDesc&&r.push("{desc ? <desc id={descId}>{desc}</desc> : null}"),this.options.addTitle&&r.push("{title ? <title id={titleId}>{title}</title> : null}")):(this.options.addDesc&&r.push('<desc v-if="desc" :id="descId">{{ desc }}</desc>'),this.options.addTitle&&r.push('<title v-if="title" :id="titleId">{{ title }}</title>')),r.join(`
|
|
2
|
-
`)}};var
|
|
3
|
-
`,c+=o.map(
|
|
1
|
+
var Mr=Object.defineProperty;var Lr=(e,t,r)=>t in e?Mr(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var v=(e,t,r)=>Lr(e,typeof t!="symbol"?t+"":t,r);var Ee=class{parse(t){let r=this.cleanSvgContent(t),n=this.parseElement(r);return {root:n,viewBox:n.attributes.viewBox,width:n.attributes.width,height:n.attributes.height,namespace:n.attributes.xmlns}}extractColors(t){let r=[];return this.traverseElements(t.root,n=>{n.attributes.fill&&this.isValidColor(n.attributes.fill)&&r.push({value:n.attributes.fill,type:"fill",element:n,attribute:"fill"}),n.attributes.stroke&&this.isValidColor(n.attributes.stroke)&&r.push({value:n.attributes.stroke,type:"stroke",element:n,attribute:"stroke"}),n.attributes["stop-color"]&&this.isValidColor(n.attributes["stop-color"])&&r.push({value:n.attributes["stop-color"],type:"stop-color",element:n,attribute:"stop-color"});}),r}cleanSvgContent(t){return t.replace(/<\?xml[^>]*\?>/gi,"").replace(/<!--[\s\S]*?-->/g,"").trim()}parseElement(t){let r=t.match(/<svg([^>]*)>/i);if(!r)throw new Error("Invalid SVG: No svg element found");let n=this.parseAttributes(r[1]),s=this.parseChildren(t);return {tag:"svg",attributes:n,children:s}}parseAttributes(t){let r={},n=/(\w+(?:-\w+)*)=["']([^"']*)["']/g,s;for(;(s=n.exec(t))!==null;)r[s[1]]=s[2];return r}parseChildren(t){let r=[],n=t.match(/<svg[^>]*>(.*)<\/svg>/is);if(!n||!n[1])return r;let s=n[1],i=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,o;for(;(o=i.exec(s))!==null;){let[,u,a,l]=o,c=this.parseAttributes(a),f={tag:u,attributes:c,children:[]};l!==void 0&&(l.includes("<")?f.children=this.parseNestedElements(l):l.trim()&&(f.content=l.trim())),r.push(f);}return r}parseNestedElements(t){let r=[],n=/<(\w+(?::\w+)?)([^>]*?)(?:\s*\/\s*>|>(.*?)<\/\1\s*>)/gs,s;for(;(s=n.exec(t))!==null;){let[,i,o,u]=s,a=this.parseAttributes(o),l={tag:i,attributes:a,children:[]};u!==void 0&&(u.includes("<")?l.children=this.parseNestedElements(u):u.trim()&&(l.content=u.trim())),r.push(l);}return r}traverseElements(t,r){r(t),t.children.forEach(n=>this.traverseElements(n,r));}isValidColor(t){return !t||t==="none"||t==="transparent"||t==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(t)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)?true:["red","green","blue","black","white","yellow","cyan","magenta"].includes(t.toLowerCase())}};var ye=class{constructor(t={}){v(this,"options");this.options={preserveOriginalNames:t.preserveOriginalNames??false,generateClasses:t.generateClasses??true,colorPrefix:t.colorPrefix??"color"};}extractColors(t){let r=[];this.traverseElement(t,r);let n=new Map;return r.forEach(s=>{this.isValidColor(s.value)&&n.set(s.value,s);}),Array.from(n.values()).sort((s,i)=>s.value.localeCompare(i.value))}apply(t){let r=this.extractColors(t),n=this.generateColorMappings(r),s=this.replaceColorsWithVariables(t,n);return {mappings:n,processedElement:s,originalColors:r.map(i=>i.value)}}generateColorMappings(t){return t.map((r,n)=>({originalColor:r.value,variableName:n===0?this.options.colorPrefix:`${this.options.colorPrefix}${n+1}`,type:r.type}))}replaceColorsWithVariables(t,r){let n=new Map(r.map(s=>[s.originalColor,s.variableName]));return this.transformElement(t,s=>{let i={...s.attributes};if(i.fill&&n.has(i.fill)&&(i.fill=`{${n.get(i.fill)}}`),i.stroke&&n.has(i.stroke)&&(i.stroke=`{${n.get(i.stroke)}}`),i["stop-color"]&&n.has(i["stop-color"])&&(i["stop-color"]=`{${n.get(i["stop-color"])}}`),i.style){let o=i.style,u=o.match(/fill:\s*([^;]+)/);if(u){let c=u[1].trim();n.has(c)&&(o=o.replace(/fill:\s*[^;]+/,`fill: {${n.get(c)}}`));}let a=o.match(/stroke:\s*([^;]+)/);if(a){let c=a[1].trim();n.has(c)&&(o=o.replace(/stroke:\s*[^;]+/,`stroke: {${n.get(c)}}`));}let l=o.match(/stop-color:\s*([^;]+)/);if(l){let c=l[1].trim();n.has(c)&&(o=o.replace(/stop-color:\s*[^;]+/,`stop-color: {${n.get(c)}}`));}i.style=o;}if(this.isDrawableElement(s.tag)){let o=s.attributes.fill!==void 0&&s.attributes.fill!=="",u=s.attributes.stroke!==void 0&&s.attributes.stroke!=="";o&&!u&&!i.stroke&&(i.stroke="none"),u&&!o&&!i.fill&&(i.fill="none");}return {...s,attributes:i}})}traverseElement(t,r){t.attributes.fill&&r.push({value:t.attributes.fill,type:"fill",element:t,attribute:"fill"}),t.attributes.stroke&&r.push({value:t.attributes.stroke,type:"stroke",element:t,attribute:"stroke"}),t.attributes["stop-color"]&&r.push({value:t.attributes["stop-color"],type:"stop-color",element:t,attribute:"stop-color"}),t.attributes.style&&this.extractColorsFromStyle(t.attributes.style).forEach(s=>{r.push({value:s.value,type:s.type,element:t,attribute:"style"});}),t.children.forEach(n=>this.traverseElement(n,r));}transformElement(t,r){let n=r(t);return {...n,children:n.children.map(s=>this.transformElement(s,r))}}isDrawableElement(t){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(t)}isValidColor(t){return !t||t==="none"||t==="transparent"||t==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(t)||/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)||/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(?:,\s*[\d.]+\s*)?\)$/.test(t)?true:["red","green","blue","yellow","orange","purple","pink","brown","black","white","gray","grey","cyan","magenta","lime","navy"].includes(t.toLowerCase())}extractColorsFromStyle(t){let r=[],n=t.match(/fill:\s*([^;]+)/);if(n){let o=n[1].trim();this.isValidColor(o)&&r.push({value:o,type:"fill"});}let s=t.match(/stroke:\s*([^;]+)/);if(s){let o=s[1].trim();this.isValidColor(o)&&r.push({value:o,type:"stroke"});}let i=t.match(/stop-color:\s*([^;]+)/);if(i){let o=i[1].trim();this.isValidColor(o)&&r.push({value:o,type:"stop-color"});}return r}};var ve=class{constructor(t={}){v(this,"options");this.options={preserveExisting:t.preserveExisting??true,onlyIfStrokePresent:t.onlyIfStrokePresent??true};}apply(t){let r=0;return {processedElement:this.transformElement(t,s=>this.shouldAddVectorEffect(s)?(r++,{...s,attributes:{...s.attributes,"vector-effect":"non-scaling-stroke"}}):s),elementsModified:r}}shouldAddVectorEffect(t){return this.options.preserveExisting&&t.attributes["vector-effect"]?false:["path","line","polyline","polygon","rect","circle","ellipse"].includes(t.tag)}transformElement(t,r){let n=r(t);return {...n,children:n.children.map(s=>this.transformElement(s,r))}}};var be=class{constructor(t={}){v(this,"options");this.options={preserveOriginalNames:t.preserveOriginalNames??false,strokeWidthPrefix:t.strokeWidthPrefix??"strokeWidth",generateClasses:t.generateClasses??true};}extractStrokeWidths(t){let r=[];this.traverseElement(t,r);let n=new Map;return r.forEach(s=>{this.isValidStrokeWidth(s.value)&&n.set(s.value,s);}),Array.from(n.values()).sort((s,i)=>{let o=parseFloat(s.value),u=parseFloat(i.value);return isNaN(o)&&isNaN(u)?s.value.localeCompare(i.value):isNaN(o)?1:isNaN(u)?-1:o-u})}apply(t){let r=this.extractStrokeWidths(t),n=this.generateStrokeWidthMappings(r),s=this.replaceStrokeWidthsWithVariables(t,n);return {mappings:n,processedElement:s,originalStrokeWidths:r.map(i=>i.value)}}traverseElement(t,r){if(t.attributes["stroke-width"]&&r.push({value:t.attributes["stroke-width"],element:t,attribute:"stroke-width"}),t.attributes.style){let n=this.extractStrokeWidthFromStyle(t.attributes.style);n&&r.push({value:n,element:t,attribute:"style",styleProperty:"stroke-width"});}t.children.forEach(n=>this.traverseElement(n,r));}extractStrokeWidthFromStyle(t){let r=t.match(/stroke-width\s*:\s*([^;]+)/);return r?r[1].trim():null}isValidStrokeWidth(t){return t==="inherit"||t==="none"||t==="initial"||t==="unset"||t.includes("var(")||t.includes("calc(")?false:/^[\d.]+(?:px|pt|pc|in|cm|mm|em|rem|ex|ch|vw|vh|vmin|vmax|%)?$/.test(t.trim())}generateStrokeWidthMappings(t){return t.map((r,n)=>({originalStrokeWidth:r.value,variableName:n===0?this.options.strokeWidthPrefix:`${this.options.strokeWidthPrefix}${n+1}`}))}replaceStrokeWidthsWithVariables(t,r){let n=new Map(r.map(s=>[s.originalStrokeWidth,s.variableName]));return this.transformElement(t,s=>{let i={...s.attributes};if(i["stroke-width"]&&n.has(i["stroke-width"])&&(i["stroke-width"]=`{${n.get(i["stroke-width"])}}`),i.style){let o=i.style;n.forEach((u,a)=>{let l=new RegExp(`stroke-width\\s*:\\s*${this.escapeRegExp(a)}`,"g");o=o.replace(l,`stroke-width: {${u}}`);}),i.style=o;}return {...s,attributes:i}})}transformElement(t,r){let n=r(t);return {...n,children:n.children.map(s=>this.transformElement(s,r))}}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var Se=class{constructor(t={}){v(this,"options");this.options={addRole:t.addRole??true,addAriaHidden:t.addAriaHidden??false,addTitle:t.addTitle??true,addDesc:t.addDesc??true,defaultRole:t.defaultRole??"img",preserveExisting:t.preserveExisting??true};}apply(t){let r=[];if(t.tag!=="svg")return {processedElement:t,attributesAdded:r};let n={...t.attributes};return this.options.addRole&&(!this.options.preserveExisting||!n.role)&&(n.role=this.options.defaultRole,r.push("role")),this.options.addAriaHidden&&(!this.options.preserveExisting||!n["aria-hidden"])&&(n["aria-hidden"]="true",r.push("aria-hidden")),this.options.addTitle&&r.push("title-support"),this.options.addDesc&&r.push("desc-support"),this.options.addTitle&&this.options.addDesc&&(!this.options.preserveExisting||!n["aria-labelledby"])?(n["aria-labelledby"]="{titleId} {descId}",r.push("aria-labelledby")):this.options.addTitle&&(!this.options.preserveExisting||!n["aria-labelledby"])&&(n["aria-labelledby"]="{titleId}",r.push("aria-labelledby")),{processedElement:{...t,attributes:n},attributesAdded:r}}generateProps(){let t=[];return this.options.addTitle&&t.push("title?: string","titleId?: string"),this.options.addDesc&&t.push("desc?: string","descId?: string"),t}generateJSXElements(t){let r=[];return t==="react"?(this.options.addDesc&&r.push("{desc ? <desc id={descId}>{desc}</desc> : null}"),this.options.addTitle&&r.push("{title ? <title id={titleId}>{title}</title> : null}")):(this.options.addDesc&&r.push('<desc v-if="desc" :id="descId">{{ desc }}</desc>'),this.options.addTitle&&r.push('<title v-if="title" :id="titleId">{{ title }}</title>')),r.join(`
|
|
2
|
+
`)}};var xe=class{transform(t,r={}){let{optimize:n=true,splitColors:s=false,splitStrokeWidths:i=false,fixedStrokeWidth:o=false,accessibility:u=true,removeComments:a=true,removeDuplicates:l=true,minifyPaths:c=false}=r,f=this.deepCloneAst(t),p=[],d=[],D=[];return n&&(this.applyOptimizations(f,{removeComments:a,removeDuplicates:l,minifyPaths:c&&!s}),p.push("optimization")),s&&(d=this.applySplitColors(f),p.push("split-colors")),i&&(D=this.applySplitStrokeWidths(f),p.push("split-stroke-widths")),o&&(this.applyFixedStrokeWidth(f),p.push("fixed-stroke-width")),u&&(this.applyAccessibility(f),p.push("accessibility")),{ast:f,colorMappings:d,strokeWidthMappings:D,metadata:{originalColors:d.map(h=>h.originalColor),originalStrokeWidths:D.map(h=>h.originalStrokeWidth),optimizationApplied:n,features:p,hasClassAttributes:this.hasClassAttributes(f)}}}applySplitColors(t){let n=new ye({generateClasses:true,colorPrefix:"color"}).apply(t.root);return t.root=n.processedElement,n.mappings}applyFixedStrokeWidth(t){let n=new ve({onlyIfStrokePresent:false,preserveExisting:true}).apply(t.root);t.root=n.processedElement;}applyAccessibility(t){let n=new Se({addRole:true,addTitle:true,addDesc:true,defaultRole:"img",preserveExisting:true}).apply(t.root);t.root=n.processedElement;}applyOptimizations(t,r){r.removeDuplicates&&this.removeDuplicateElements(t),r.minifyPaths&&this.minifyPaths(t),this.removeEmptyGroups(t);}removeDuplicateElements(t){}minifyPaths(t){this.traverseElements(t.root,r=>{r.tag==="path"&&r.attributes.d&&(r.attributes.d=r.attributes.d.replace(/\s+/g," ").replace(/([MLHVCSQTAZ])\s+/gi,"$1").trim());});}removeEmptyGroups(t){let r=n=>(n.children=n.children.filter(r),!(n.tag==="g"&&n.children.length===0&&!n.content));t.root.children=t.root.children.filter(r);}traverseElements(t,r){r(t),t.children.forEach(n=>this.traverseElements(n,r));}isValidColor(t){return !t||t==="none"||t==="transparent"||t==="currentColor"?false:/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(t)||/^rgba?\(.+\)$/.test(t)||/^hsla?\(.+\)$/.test(t)}deepCloneAst(t){return {...t,root:this.deepCloneElement(t.root)}}deepCloneElement(t){return {...t,attributes:{...t.attributes},children:t.children.map(r=>this.deepCloneElement(r))}}hasClassAttributes(t){let r=n=>n.attributes.class||n.attributes.className?true:n.children.some(s=>r(s));return r(t.root)}applySplitStrokeWidths(t){let n=new be({generateClasses:true,strokeWidthPrefix:"strokeWidth"}).apply(t.root);return t.root=n.processedElement,n.mappings}};var ke=e=>{if(/^[A-Z][a-zA-Z0-9]*$/.test(e)&&/[a-z]/.test(e))return e.replace(/(^|[a-z])([A-Z]{3,})(?=[A-Z][a-z]|$)/g,(t,r,n)=>{let s=n.charAt(0).toUpperCase()+n.slice(1).toLowerCase();return r+s});if(/^[a-z][a-zA-Z0-9]*$/.test(e)&&/[A-Z]/.test(e)){let t=e.charAt(0).toUpperCase()+e.slice(1);return t=t.replace(/([a-z])([A-Z]{2,})$/,(r,n,s)=>n+s.charAt(0)+s.slice(1).toLowerCase()),t=t.replace(/([a-z])([A-Z]{2,})([A-Z][a-z])/g,(r,n,s,i)=>n+s.charAt(0)+s.slice(1).toLowerCase()+i),t}return e.split(/[\s\-_]+/).filter(Boolean).map((t,r,n)=>t===t.toUpperCase()&&/^[A-Z]+$/.test(t)?n.length>1?r===0&&t.length===2?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():t.length<=2?t:t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():/[a-z][A-Z]/.test(t)?/[a-z][A-Z]{2,}$/.test(t)?t.replace(/([a-z])([A-Z]{2,})$/,(s,i,o)=>i+o.charAt(0)+o.slice(1).toLowerCase()):t.charAt(0).toUpperCase()+t.slice(1):t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")},Le=e=>e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase()),vt=e=>{let t={class:"className",for:"htmlFor","accept-charset":"acceptCharset","http-equiv":"httpEquiv"};return t[e]?t[e]:e.startsWith("aria-")||e.startsWith("data-")?e:Le(e)};function ze(e,t,r){let n=e.replace(/\.svg$/i,"");return n=zr(n),St(n,t,r)}function zr(e){if(/^[a-zA-Z][a-zA-Z0-9]*$/.test(e))return e;let r=e.replace(/[^a-zA-Z0-9]/g," ");return r=r.replace(/\s+/g," ").trim(),r}function bt(e,t="main"){let r=e.replace(/=/g," ").replace(/,/g," ").replace(/[^a-zA-Z0-9]/g," ").replace(/\s+/g," ").trim();if(t==="prefix"){if(!/^[a-zA-Z]/.test(r))return ""}else t==="suffix"?r=r.replace(/^[^a-zA-Z0-9]+/,""):r=r.replace(/^[^a-zA-Z]+/,"");return ke(r)}function Jr(e){return e&&ke(e).split(/(?<=[a-z])(?=[0-9])|(?<=[0-9])(?=[A-Z])/).map(n=>n&&(/^\d/.test(n)?n.replace(/^(\d+)([a-z])/,(s,i,o)=>i+o.toUpperCase()):n)).join("")}function St(e,t,r){let n=e;t&&(n=`${t}-${n}`),r&&(n=`${n}-${r}`);let s=bt(n,"main");return Jr(s)}var ie=class{constructor(t={}){v(this,"options");this.options={typescript:true,memo:true,forwardRef:true,exportDefault:true,componentName:"Icon",prefix:"",suffix:"",includeTypes:true,...t};}astToJsx(t){return this.elementToJsx(t.root,0)}elementToJsx(t,r=0){let n=" ".repeat(r+1),{tag:s,attributes:i,children:o,content:u}=t,a=this.attributesToJsx(i),l=a.length>0?" "+a.join(" "):"";if(o.length===0&&!u)return `${n}<${s}${l} />`;let c=`${n}<${s}${l}>`;return u&&(c+=u),o.length>0&&(c+=`
|
|
3
|
+
`,c+=o.map(f=>this.elementToJsx(f,r+1)).join(`
|
|
4
4
|
`),c+=`
|
|
5
|
-
`+n),c+=`</${
|
|
6
|
-
${
|
|
7
|
-
${
|
|
8
|
-
`)}generateColorDefaults(t){return t.length===0?"":t.map(r=>{let n=r.variableName,
|
|
9
|
-
${
|
|
10
|
-
${
|
|
11
|
-
`)}generateStrokeWidthDefaults(t){return t.length===0?"":t.map(r=>{let n=r.variableName,
|
|
12
|
-
`,a.gutter(F.replace(/\d/g," "))," ",
|
|
13
|
-
`);return u.message&&!
|
|
14
|
-
${h}`),h}e.codeFrameColumns=
|
|
5
|
+
`+n),c+=`</${s}>`,c}attributesToJsx(t){return Object.entries(t).map(([r,n])=>{let s=this.convertAttributeName(r);return n.startsWith("{")&&n.endsWith("}")?`${s}=${n}`:`${s}="${n}"`})}convertAttributeName(t){let r={class:"className",for:"htmlFor",tabindex:"tabIndex",readonly:"readOnly",maxlength:"maxLength",cellpadding:"cellPadding",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"};return t.startsWith("aria-")||t.startsWith("data-")?t:t.includes("-")?t.replace(/-([a-z])/g,(n,s)=>s.toUpperCase()):r[t]||t}generateColorProps(t,r=true){return t.length===0?"":t.map(n=>{let s=n.variableName,i=`${s}Class`;if(this.options.typescript){let o=` ${s}?: string;`;return r&&(o+=`
|
|
6
|
+
${i}?: string;`),o}else {let o=` ${s}: PropTypes.string,`;return r&&(o+=`
|
|
7
|
+
${i}: PropTypes.string,`),o}}).join(`
|
|
8
|
+
`)}generateColorDefaults(t){return t.length===0?"":t.map(r=>{let n=r.variableName,s=r.originalColor;return `${n} = "${s}"`}).join(", ")}generateStrokeWidthProps(t,r=true){return t.length===0?"":t.map(n=>{let s=n.variableName,i=`${s}Class`;if(this.options.typescript){let o=` ${s}?: string | number;`;return r&&(o+=`
|
|
9
|
+
${i}?: string;`),o}else {let o=` ${s}: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),`;return r&&(o+=`
|
|
10
|
+
${i}: PropTypes.string,`),o}}).join(`
|
|
11
|
+
`)}generateStrokeWidthDefaults(t){return t.length===0?"":t.map(r=>{let n=r.variableName,s=r.originalStrokeWidth;return `${n} = "${s}"`}).join(", ")}getComponentName(){return ze(this.options.componentName,this.options.prefix,this.options.suffix)}generateFilename(t,r){return `${t}.${r}`}sanitizeComponentName(t){return t.replace(/[^a-zA-Z0-9_$]/g,"").replace(/^[0-9]/,"_$&")}};var qr=Object.create,it=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Zr=Object.getOwnPropertyNames,Hr=Object.getPrototypeOf,Kr=Object.prototype.hasOwnProperty,tr=e=>{throw TypeError(e)},Xr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ot=(e,t)=>{for(var r in t)it(e,r,{get:t[r],enumerable:true});},Yr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Zr(t))!Kr.call(e,s)&&s!==r&&it(e,s,{get:()=>t[s],enumerable:!(n=Ur(t,s))||n.enumerable});return e},Qr=(e,t,r)=>(r=e!=null?qr(Hr(e)):{},Yr(it(r,"default",{value:e,enumerable:true}),e)),en=(e,t,r)=>t.has(e)||tr("Cannot "+r),tn=(e,t,r)=>t.has(e)?tr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),fe=(e,t,r)=>(en(e,t,"access private method"),r),rn=Xr(e=>{Object.defineProperty(e,"__esModule",{value:true});function t(){return new Proxy({},{get:()=>i=>i})}var r=/\r\n|[\n\r\u2028\u2029]/;function n(i,o,u){let a=Object.assign({column:0,line:-1},i.start),l=Object.assign({},a,i.end),{linesAbove:c=2,linesBelow:f=3}=u||{},p=a.line,d=a.column,D=l.line,h=l.column,m=Math.max(p-(c+1),0),g=Math.min(o.length,D+f);p===-1&&(m=0),D===-1&&(g=o.length);let E=D-p,F={};if(E)for(let y=0;y<=E;y++){let C=y+p;if(!d)F[C]=true;else if(y===0){let b=o[C-1].length;F[C]=[d,b-d+1];}else if(y===E)F[C]=[0,h];else {let b=o[C-y].length;F[C]=[0,b];}}else d===h?d?F[p]=[d,0]:F[p]=true:F[p]=[d,h-d];return {start:m,end:g,markerLines:F}}function s(i,o,u={}){let a=t(),l=i.split(r),{start:c,end:f,markerLines:p}=n(o,l,u),d=o.start&&typeof o.start.column=="number",D=String(f).length,h=i.split(r,f).slice(c,f).map((m,g)=>{let E=c+1+g,F=` ${` ${E}`.slice(-D)} |`,y=p[E],C=!p[E+1];if(y){let b="";if(Array.isArray(y)){let O=m.slice(0,Math.max(y[0]-1,0)).replace(/[^\t]/g," "),S=y[1]||1;b=[`
|
|
12
|
+
`,a.gutter(F.replace(/\d/g," "))," ",O,a.marker("^").repeat(S)].join(""),C&&u.message&&(b+=" "+a.message(u.message));}return [a.marker(">"),a.gutter(F),m.length>0?` ${m}`:"",b].join("")}else return ` ${a.gutter(F)}${m.length>0?` ${m}`:""}`}).join(`
|
|
13
|
+
`);return u.message&&!d&&(h=`${" ".repeat(D+1)}${u.message}
|
|
14
|
+
${h}`),h}e.codeFrameColumns=s;}),nn={};ot(nn,{__debug:()=>Co,check:()=>go,doc:()=>jr,format:()=>pe,formatWithCursor:()=>_r,getSupportInfo:()=>Fo,util:()=>Gr,version:()=>zi});var sn=(e,t,r,n)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(r,n):r.global?t.replace(r,n):t.split(r).join(n)},Pe=sn,on=class{diff(e,t,r={}){let n;typeof r=="function"?(n=r,r={}):"callback"in r&&(n=r.callback);let s=this.castInput(e,r),i=this.castInput(t,r),o=this.removeEmpty(this.tokenize(s,r)),u=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(o,u,r,n)}diffWithOptionsObj(e,t,r,n){var s;let i=g=>{if(g=this.postProcess(g,r),n){setTimeout(function(){n(g);},0);return}else return g},o=t.length,u=e.length,a=1,l=o+u;r.maxEditLength!=null&&(l=Math.min(l,r.maxEditLength));let c=(s=r.timeout)!==null&&s!==void 0?s:1/0,f=Date.now()+c,p=[{oldPos:-1,lastComponent:void 0}],d=this.extractCommon(p[0],t,e,0,r);if(p[0].oldPos+1>=u&&d+1>=o)return i(this.buildValues(p[0].lastComponent,t,e));let D=-1/0,h=1/0,m=()=>{for(let g=Math.max(D,-a);g<=Math.min(h,a);g+=2){let E,F=p[g-1],y=p[g+1];F&&(p[g-1]=void 0);let C=false;if(y){let O=y.oldPos-g;C=y&&0<=O&&O<o;}let b=F&&F.oldPos+1<u;if(!C&&!b){p[g]=void 0;continue}if(!b||C&&F.oldPos<y.oldPos?E=this.addToPath(y,true,false,0,r):E=this.addToPath(F,false,true,1,r),d=this.extractCommon(E,t,e,g,r),E.oldPos+1>=u&&d+1>=o)return i(this.buildValues(E.lastComponent,t,e))||true;p[g]=E,E.oldPos+1>=u&&(h=Math.min(h,g-1)),d+1>=o&&(D=Math.max(D,g+1));}a++;};if(n)(function g(){setTimeout(function(){if(a>l||Date.now()>f)return n(void 0);m()||g();},0);})();else for(;a<=l&&Date.now()<=f;){let g=m();if(g)return g}}addToPath(e,t,r,n,s){let i=e.lastComponent;return i&&!s.oneChangePerToken&&i.added===t&&i.removed===r?{oldPos:e.oldPos+n,lastComponent:{count:i.count+1,added:t,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:t,removed:r,previousComponent:i}}}extractCommon(e,t,r,n,s){let i=t.length,o=r.length,u=e.oldPos,a=u-n,l=0;for(;a+1<i&&u+1<o&&this.equals(r[u+1],t[a+1],s);)a++,u++,l++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:false,removed:false});return l&&!s.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:false,removed:false}),e.oldPos=u,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 n=[],s;for(;e;)n.push(e),s=e.previousComponent,delete e.previousComponent,e=s;n.reverse();let i=n.length,o=0,u=0,a=0;for(;o<i;o++){let l=n[o];if(l.removed)l.value=this.join(r.slice(a,a+l.count)),a+=l.count;else {if(!l.added&&this.useLongestToken){let c=t.slice(u,u+l.count);c=c.map(function(f,p){let d=r[a+p];return d.length>f.length?d:f}),l.value=this.join(c);}else l.value=this.join(t.slice(u,u+l.count));u+=l.count,l.added||(a+=l.count);}}return n}},un=class extends on{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}},an=new un;function ln(e,t,r){return an.diff(e,t,r)}function cn(e){let t=e.indexOf("\r");return t!==-1?e.charAt(t+1)===`
|
|
15
15
|
`?"crlf":"cr":"lf"}function ut(e){switch(e){case "cr":return "\r";case "crlf":return `\r
|
|
16
16
|
`;default:return `
|
|
17
17
|
`}}function rr(e,t){let r;switch(t){case `
|
|
18
18
|
`:r=/\n/gu;break;case "\r":r=/\r/gu;break;case `\r
|
|
19
|
-
`:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let n=e.match(r);return n?n.length:0}function pn(e){return
|
|
20
|
-
`)}var
|
|
21
|
-
`);)t--;return t<e.length?e.slice(0,t):e}function
|
|
22
|
-
Expected it to be 'string' or 'object'.`;if(
|
|
23
|
-
Expected it to be ${n}.`}var gn=class extends Error{constructor(t){super(mn(t));
|
|
24
|
-
`)):r)}function wn(e){if(e.type===k)return true}function An(e){return lt(e,wn,false)}function Ae(e,t){return e.type===V?{...e,contents:t(e.contents)}:t(e)}var ct=()=>{},sr=ct;function Oe(e){return {type:I,contents:e}}function ae(e,t){return {type:j,contents:t,n:e}}function or(e,t={}){return sr(t.expandedStates),{type:A,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function $n(e){return ae(Number.NEGATIVE_INFINITY,e)}function On(e){return ae({type:"root"},e)}function Nn(e){return ae(-1,e)}function Pn(e,t){return or(e[0],{...t,expandedStates:e})}function Tn(e){return {type:T,parts:e}}function Vn(e,t="",r={}){return {type:B,breakContents:e,flatContents:t,groupId:r.groupId}}function Wn(e,t){return {type:_,contents:e,groupId:t.groupId,negate:t.negate}}function Xe(e){return {type:M,contents:e}}var Rn={type:L},Te={type:$},In={type:G},pt={type:k,hard:true},ur={type:k,hard:true,literal:true},ar={type:k},jn={type:k,soft:true},Q=[pt,Te],lr=[ur,Te],Y={type:U};function cr(e,t){let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function pr(e,t,r){let n=e;if(t>0){for(let i=0;i<Math.floor(t/r);++i)n=Oe(n);n=ae(t%r,n),n=ae(Number.NEGATIVE_INFINITY,n);}return n}function Gn(e,t){return e?{type:V,label:e,contents:t}:t}function W(e){var t;if(!e)return "";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...W(n));else {let i=W(n);i!==""&&r.push(i);}return r}return e.type===B?{...e,breakContents:W(e.breakContents),flatContents:W(e.flatContents)}:e.type===A?{...e,contents:W(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(W)}:e.type===T?{type:"fill",parts:e.parts.map(W)}:e.contents?{...e,contents:W(e.contents)}:e}function _n(e){let t=Object.create(null),r=new Set;return n(W(e));function n(s,o,u){var a,l;if(typeof s=="string")return JSON.stringify(s);if(Array.isArray(s)){let c=s.map(n).filter(Boolean);return c.length===1?c[0]:`[${c.join(", ")}]`}if(s.type===k){let c=((a=u?.[o+1])==null?void 0:a.type)===$;return s.literal?c?"literalline":"literallineWithoutBreakParent":s.hard?c?"hardline":"hardlineWithoutBreakParent":s.soft?"softline":"line"}if(s.type===$)return ((l=u?.[o-1])==null?void 0:l.type)===k&&u[o-1].hard?void 0:"breakParent";if(s.type===G)return "trim";if(s.type===I)return "indent("+n(s.contents)+")";if(s.type===j)return s.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(s.contents)+")":s.n<0?"dedent("+n(s.contents)+")":s.n.type==="root"?"markAsRoot("+n(s.contents)+")":"align("+JSON.stringify(s.n)+", "+n(s.contents)+")";if(s.type===B)return "ifBreak("+n(s.breakContents)+(s.flatContents?", "+n(s.flatContents):"")+(s.groupId?(s.flatContents?"":', ""')+`, { groupId: ${i(s.groupId)} }`:"")+")";if(s.type===_){let c=[];s.negate&&c.push("negate: true"),s.groupId&&c.push(`groupId: ${i(s.groupId)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";return `indentIfBreak(${n(s.contents)}${d})`}if(s.type===A){let c=[];s.break&&s.break!=="propagated"&&c.push("shouldBreak: true"),s.id&&c.push(`id: ${i(s.id)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";return s.expandedStates?`conditionalGroup([${s.expandedStates.map(p=>n(p)).join(",")}]${d})`:`group(${n(s.contents)}${d})`}if(s.type===T)return `fill([${s.parts.map(c=>n(c)).join(", ")}])`;if(s.type===M)return "lineSuffix("+n(s.contents)+")";if(s.type===L)return "lineSuffixBoundary";if(s.type===V)return `label(${JSON.stringify(s.label)}, ${n(s.contents)})`;if(s.type===U)return "cursor";throw new Error("Unknown doc type "+s.type)}function i(s){if(typeof s!="symbol")return JSON.stringify(String(s));if(s in t)return t[s];let o=s.description||"symbol";for(let u=0;;u++){let a=o+(u>0?` #${u}`:"");if(!r.has(a))return r.add(a),t[s]=`Symbol.for(${JSON.stringify(a)})`}}}var Mn=()=>/[#*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;function Ln(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function zn(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}var Jn=e=>!(Ln(e)||zn(e)),qn=/[^\x20-\x7F]/u;function Un(e){if(!e)return 0;if(!qn.test(e))return e.length;e=e.replace(Mn()," ");let t=0;for(let r of e){let n=r.codePointAt(0);n<=31||n>=127&&n<=159||n>=768&&n<=879||(t+=Jn(n)?1:2);}return t}var Dt=Un,w=Symbol("MODE_BREAK"),O=Symbol("MODE_FLAT"),se=Symbol("cursor"),Ye=Symbol("DOC_FILL_PRINTED_LENGTH");function Dr(){return {value:"",length:0,queue:[]}}function Hn(e,t){return Qe(e,{type:"indent"},t)}function Zn(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||Dr():t<0?Qe(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:Qe(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function Qe(e,t,r){let n=t.type==="dedent"?e.queue.slice(0,-1):[...e.queue,t],i="",s=0,o=0,u=0;for(let D of n)switch(D.type){case "indent":c(),r.useTabs?a(1):l(r.tabWidth);break;case "stringAlign":c(),i+=D.n,s+=D.n.length;break;case "numberAlign":o+=1,u+=D.n;break;default:throw new Error(`Unexpected type '${D.type}'`)}return p(),{...e,value:i,length:s,queue:n};function a(D){i+=" ".repeat(D),s+=r.tabWidth*D;}function l(D){i+=" ".repeat(D),s+=D;}function c(){r.useTabs?d():p();}function d(){o>0&&a(o),f();}function p(){u>0&&l(u),f();}function f(){o=0,u=0;}}function et(e){let t=0,r=0,n=e.length;e:for(;n--;){let i=e[n];if(i===se){r++;continue}for(let s=i.length-1;s>=0;s--){let o=i[s];if(o===" "||o===" ")t++;else {e[n]=i.slice(0,s+1);break e}}}if(t>0||r>0)for(e.length=n+1;r-- >0;)e.push(se);return t}function ke(e,t,r,n,i,s){if(r===Number.POSITIVE_INFINITY)return true;let o=t.length,u=[e],a=[];for(;r>=0;){if(u.length===0){if(o===0)return true;u.push(t[--o]);continue}let{mode:l,doc:c}=u.pop(),d=re(c);switch(d){case te:a.push(c),r-=Dt(c);break;case R:case T:{let p=d===R?c:c.parts,f=c[Ye]??0;for(let D=p.length-1;D>=f;D--)u.push({mode:l,doc:p[D]});break}case I:case j:case _:case V:u.push({mode:l,doc:c.contents});break;case G:r+=et(a);break;case A:{if(s&&c.break)return false;let p=c.break?w:l,f=c.expandedStates&&p===w?x(false,c.expandedStates,-1):c.contents;u.push({mode:p,doc:f});break}case B:{let p=(c.groupId?i[c.groupId]||O:l)===w?c.breakContents:c.flatContents;p&&u.push({mode:l,doc:p});break}case k:if(l===w||c.hard)return true;c.soft||(a.push(" "),r--);break;case M:n=true;break;case L:if(n)return false;break}}return false}function Ve(e,t){let r={},n=t.printWidth,i=ut(t.endOfLine),s=0,o=[{ind:Dr(),mode:w,doc:e}],u=[],a=false,l=[],c=0;for(yn(e);o.length>0;){let{ind:p,mode:f,doc:D}=o.pop();switch(re(D)){case te:{let h=i!==`
|
|
25
|
-
`?
|
|
26
|
-
`,
|
|
27
|
-
`)return t-2;if(
|
|
28
|
-
`||
|
|
29
|
-
`)return t+2;if(
|
|
30
|
-
`||
|
|
19
|
+
`:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let n=e.match(r);return n?n.length:0}function pn(e){return Pe(false,e,/\r\n?/gu,`
|
|
20
|
+
`)}var re="string",I="array",U="cursor",j="indent",G="align",_="trim",A="group",V="fill",B="if-break",M="indent-if-break",L="line-suffix",z="line-suffix-boundary",k="line",W="label",$="break-parent",nr=new Set([U,j,G,_,A,V,B,M,L,z,k,W,$]),Dn=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},x=Dn;function fn(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===`
|
|
21
|
+
`);)t--;return t<e.length?e.slice(0,t):e}function dn(e){if(typeof e=="string")return re;if(Array.isArray(e))return I;if(!e)return;let{type:t}=e;if(nr.has(t))return t}var ne=dn,hn=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function mn(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return `Unexpected doc '${t}',
|
|
22
|
+
Expected it to be 'string' or 'object'.`;if(ne(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return `Unexpected doc '${r}'.`;let n=hn([...nr].map(s=>`'${s}'`));return `Unexpected doc.type '${e.type}'.
|
|
23
|
+
Expected it to be ${n}.`}var gn=class extends Error{constructor(t){super(mn(t));v(this,"name","InvalidDocError");this.doc=t;}},ae=gn,xt={};function Fn(e,t,r,n){let s=[e];for(;s.length>0;){let i=s.pop();if(i===xt){r(s.pop());continue}r&&s.push(i,xt);let o=ne(i);if(!o)throw new ae(i);if(t?.(i)!==false)switch(o){case I:case V:{let u=o===I?i:i.parts;for(let a=u.length,l=a-1;l>=0;--l)s.push(u[l]);break}case B:s.push(i.flatContents,i.breakContents);break;case A:if(n&&i.expandedStates)for(let u=i.expandedStates.length,a=u-1;a>=0;--a)s.push(i.expandedStates[a]);else s.push(i.contents);break;case G:case j:case M:case W:case L:s.push(i.contents);break;case re:case U:case _:case z:case k:case $:break;default:throw new ae(i)}}}var at=Fn;function Te(e,t){if(typeof e=="string")return t(e);let r=new Map;return n(e);function n(i){if(r.has(i))return r.get(i);let o=s(i);return r.set(i,o),o}function s(i){switch(ne(i)){case I:return t(i.map(n));case V:return t({...i,parts:i.parts.map(n)});case B:return t({...i,breakContents:n(i.breakContents),flatContents:n(i.flatContents)});case A:{let{expandedStates:o,contents:u}=i;return o?(o=o.map(n),u=o[0]):u=n(u),t({...i,contents:u,expandedStates:o})}case G:case j:case M:case W:case L:return t({...i,contents:n(i.contents)});case re:case U:case _:case z:case k:case $:return t(i);default:throw new ae(i)}}}function lt(e,t,r){let n=r,s=false;function i(o){if(s)return false;let u=t(o);u!==void 0&&(s=true,n=u);}return at(e,i),n}function Cn(e){if(e.type===A&&e.break||e.type===k&&e.hard||e.type===$)return true}function En(e){return lt(e,Cn,false)}function kt(e){if(e.length>0){let t=x(false,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated");}return null}function yn(e){let t=new Set,r=[];function n(i){if(i.type===$&&kt(r),i.type===A){if(r.push(i),t.has(i))return false;t.add(i);}}function s(i){i.type===A&&r.pop().break&&kt(r);}at(e,n,s,true);}function vn(e){return e.type===k&&!e.hard?e.soft?"":" ":e.type===B?e.flatContents:e}function bn(e){return Te(e,vn)}function wt(e){for(e=[...e];e.length>=2&&x(false,e,-2).type===k&&x(false,e,-1).type===$;)e.length-=2;if(e.length>0){let t=de(x(false,e,-1));e[e.length-1]=t;}return e}function de(e){switch(ne(e)){case j:case M:case A:case L:case W:{let t=de(e.contents);return {...e,contents:t}}case B:return {...e,breakContents:de(e.breakContents),flatContents:de(e.flatContents)};case V:return {...e,parts:wt(e.parts)};case I:return wt(e);case re:return fn(e);case G:case U:case _:case z:case k:case $:break;default:throw new ae(e)}return e}function sr(e){return de(xn(e))}function Sn(e){switch(ne(e)){case V:if(e.parts.every(t=>t===""))return "";break;case A:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return "";if(e.contents.type===A&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case G:case j:case M:case L:if(!e.contents)return "";break;case B:if(!e.flatContents&&!e.breakContents)return "";break;case I:{let t=[];for(let r of e){if(!r)continue;let[n,...s]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof x(false,t,-1)=="string"?t[t.length-1]+=n:t.push(n),t.push(...s);}return t.length===0?"":t.length===1?t[0]:t}case re:case U:case _:case z:case k:case W:case $:break;default:throw new ae(e)}return e}function xn(e){return Te(e,t=>Sn(t))}function kn(e,t=lr){return Te(e,r=>typeof r=="string"?cr(t,r.split(`
|
|
24
|
+
`)):r)}function wn(e){if(e.type===k)return true}function An(e){return lt(e,wn,false)}function Be(e,t){return e.type===W?{...e,contents:t(e.contents)}:t(e)}var ct=()=>{},ir=ct;function Ne(e){return {type:j,contents:e}}function le(e,t){return {type:G,contents:t,n:e}}function or(e,t={}){return ir(t.expandedStates),{type:A,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function $n(e){return le(Number.NEGATIVE_INFINITY,e)}function On(e){return le({type:"root"},e)}function Nn(e){return le(-1,e)}function Pn(e,t){return or(e[0],{...t,expandedStates:e})}function Tn(e){return {type:V,parts:e}}function Vn(e,t="",r={}){return {type:B,breakContents:e,flatContents:t,groupId:r.groupId}}function Wn(e,t){return {type:M,contents:e,groupId:t.groupId,negate:t.negate}}function Xe(e){return {type:L,contents:e}}var Rn={type:z},Ve={type:$},In={type:_},pt={type:k,hard:true},ur={type:k,hard:true,literal:true},ar={type:k},jn={type:k,soft:true},ee=[pt,Ve],lr=[ur,Ve],Q={type:U};function cr(e,t){let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function pr(e,t,r){let n=e;if(t>0){for(let s=0;s<Math.floor(t/r);++s)n=Ne(n);n=le(t%r,n),n=le(Number.NEGATIVE_INFINITY,n);}return n}function Gn(e,t){return e?{type:W,label:e,contents:t}:t}function R(e){var t;if(!e)return "";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...R(n));else {let s=R(n);s!==""&&r.push(s);}return r}return e.type===B?{...e,breakContents:R(e.breakContents),flatContents:R(e.flatContents)}:e.type===A?{...e,contents:R(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(R)}:e.type===V?{type:"fill",parts:e.parts.map(R)}:e.contents?{...e,contents:R(e.contents)}:e}function _n(e){let t=Object.create(null),r=new Set;return n(R(e));function n(i,o,u){var a,l;if(typeof i=="string")return JSON.stringify(i);if(Array.isArray(i)){let c=i.map(n).filter(Boolean);return c.length===1?c[0]:`[${c.join(", ")}]`}if(i.type===k){let c=((a=u?.[o+1])==null?void 0:a.type)===$;return i.literal?c?"literalline":"literallineWithoutBreakParent":i.hard?c?"hardline":"hardlineWithoutBreakParent":i.soft?"softline":"line"}if(i.type===$)return ((l=u?.[o-1])==null?void 0:l.type)===k&&u[o-1].hard?void 0:"breakParent";if(i.type===_)return "trim";if(i.type===j)return "indent("+n(i.contents)+")";if(i.type===G)return i.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(i.contents)+")":i.n<0?"dedent("+n(i.contents)+")":i.n.type==="root"?"markAsRoot("+n(i.contents)+")":"align("+JSON.stringify(i.n)+", "+n(i.contents)+")";if(i.type===B)return "ifBreak("+n(i.breakContents)+(i.flatContents?", "+n(i.flatContents):"")+(i.groupId?(i.flatContents?"":', ""')+`, { groupId: ${s(i.groupId)} }`:"")+")";if(i.type===M){let c=[];i.negate&&c.push("negate: true"),i.groupId&&c.push(`groupId: ${s(i.groupId)}`);let f=c.length>0?`, { ${c.join(", ")} }`:"";return `indentIfBreak(${n(i.contents)}${f})`}if(i.type===A){let c=[];i.break&&i.break!=="propagated"&&c.push("shouldBreak: true"),i.id&&c.push(`id: ${s(i.id)}`);let f=c.length>0?`, { ${c.join(", ")} }`:"";return i.expandedStates?`conditionalGroup([${i.expandedStates.map(p=>n(p)).join(",")}]${f})`:`group(${n(i.contents)}${f})`}if(i.type===V)return `fill([${i.parts.map(c=>n(c)).join(", ")}])`;if(i.type===L)return "lineSuffix("+n(i.contents)+")";if(i.type===z)return "lineSuffixBoundary";if(i.type===W)return `label(${JSON.stringify(i.label)}, ${n(i.contents)})`;if(i.type===U)return "cursor";throw new Error("Unknown doc type "+i.type)}function s(i){if(typeof i!="symbol")return JSON.stringify(String(i));if(i in t)return t[i];let o=i.description||"symbol";for(let u=0;;u++){let a=o+(u>0?` #${u}`:"");if(!r.has(a))return r.add(a),t[i]=`Symbol.for(${JSON.stringify(a)})`}}}var Mn=()=>/[#*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;function Ln(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function zn(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}var Jn=e=>!(Ln(e)||zn(e)),qn=/[^\x20-\x7F]/u;function Un(e){if(!e)return 0;if(!qn.test(e))return e.length;e=e.replace(Mn()," ");let t=0;for(let r of e){let n=r.codePointAt(0);n<=31||n>=127&&n<=159||n>=768&&n<=879||(t+=Jn(n)?1:2);}return t}var Dt=Un,w=Symbol("MODE_BREAK"),N=Symbol("MODE_FLAT"),oe=Symbol("cursor"),Ye=Symbol("DOC_FILL_PRINTED_LENGTH");function Dr(){return {value:"",length:0,queue:[]}}function Zn(e,t){return Qe(e,{type:"indent"},t)}function Hn(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||Dr():t<0?Qe(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:Qe(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function Qe(e,t,r){let n=t.type==="dedent"?e.queue.slice(0,-1):[...e.queue,t],s="",i=0,o=0,u=0;for(let D of n)switch(D.type){case "indent":c(),r.useTabs?a(1):l(r.tabWidth);break;case "stringAlign":c(),s+=D.n,i+=D.n.length;break;case "numberAlign":o+=1,u+=D.n;break;default:throw new Error(`Unexpected type '${D.type}'`)}return p(),{...e,value:s,length:i,queue:n};function a(D){s+=" ".repeat(D),i+=r.tabWidth*D;}function l(D){s+=" ".repeat(D),i+=D;}function c(){r.useTabs?f():p();}function f(){o>0&&a(o),d();}function p(){u>0&&l(u),d();}function d(){o=0,u=0;}}function et(e){let t=0,r=0,n=e.length;e:for(;n--;){let s=e[n];if(s===oe){r++;continue}for(let i=s.length-1;i>=0;i--){let o=s[i];if(o===" "||o===" ")t++;else {e[n]=s.slice(0,i+1);break e}}}if(t>0||r>0)for(e.length=n+1;r-- >0;)e.push(oe);return t}function we(e,t,r,n,s,i){if(r===Number.POSITIVE_INFINITY)return true;let o=t.length,u=[e],a=[];for(;r>=0;){if(u.length===0){if(o===0)return true;u.push(t[--o]);continue}let{mode:l,doc:c}=u.pop(),f=ne(c);switch(f){case re:a.push(c),r-=Dt(c);break;case I:case V:{let p=f===I?c:c.parts,d=c[Ye]??0;for(let D=p.length-1;D>=d;D--)u.push({mode:l,doc:p[D]});break}case j:case G:case M:case W:u.push({mode:l,doc:c.contents});break;case _:r+=et(a);break;case A:{if(i&&c.break)return false;let p=c.break?w:l,d=c.expandedStates&&p===w?x(false,c.expandedStates,-1):c.contents;u.push({mode:p,doc:d});break}case B:{let p=(c.groupId?s[c.groupId]||N:l)===w?c.breakContents:c.flatContents;p&&u.push({mode:l,doc:p});break}case k:if(l===w||c.hard)return true;c.soft||(a.push(" "),r--);break;case L:n=true;break;case z:if(n)return false;break}}return false}function We(e,t){let r={},n=t.printWidth,s=ut(t.endOfLine),i=0,o=[{ind:Dr(),mode:w,doc:e}],u=[],a=false,l=[],c=0;for(yn(e);o.length>0;){let{ind:p,mode:d,doc:D}=o.pop();switch(ne(D)){case re:{let h=s!==`
|
|
25
|
+
`?Pe(false,D,`
|
|
26
|
+
`,s):D;u.push(h),o.length>0&&(i+=Dt(h));break}case I:for(let h=D.length-1;h>=0;h--)o.push({ind:p,mode:d,doc:D[h]});break;case U:if(c>=2)throw new Error("There are too many 'cursor' in doc.");u.push(oe),c++;break;case j:o.push({ind:Zn(p,t),mode:d,doc:D.contents});break;case G:o.push({ind:Hn(p,D.n,t),mode:d,doc:D.contents});break;case _:i-=et(u);break;case A:switch(d){case N:if(!a){o.push({ind:p,mode:D.break?w:N,doc:D.contents});break}case w:{a=false;let h={ind:p,mode:N,doc:D.contents},m=n-i,g=l.length>0;if(!D.break&&we(h,o,m,g,r))o.push(h);else if(D.expandedStates){let E=x(false,D.expandedStates,-1);if(D.break){o.push({ind:p,mode:w,doc:E});break}else for(let F=1;F<D.expandedStates.length+1;F++)if(F>=D.expandedStates.length){o.push({ind:p,mode:w,doc:E});break}else {let y=D.expandedStates[F],C={ind:p,mode:N,doc:y};if(we(C,o,m,g,r)){o.push(C);break}}}else o.push({ind:p,mode:w,doc:D.contents});break}}D.id&&(r[D.id]=x(false,o,-1).mode);break;case V:{let h=n-i,m=D[Ye]??0,{parts:g}=D,E=g.length-m;if(E===0)break;let F=g[m+0],y=g[m+1],C={ind:p,mode:N,doc:F},b={ind:p,mode:w,doc:F},O=we(C,[],h,l.length>0,r,true);if(E===1){O?o.push(C):o.push(b);break}let S={ind:p,mode:N,doc:y},H={ind:p,mode:w,doc:y};if(E===2){O?o.push(S,C):o.push(H,b);break}let Me=g[m+2],De={ind:p,mode:d,doc:{...D,[Ye]:m+2}};we({ind:p,mode:N,doc:[F,y,Me]},[],h,l.length>0,r,true)?o.push(De,S,C):O?o.push(De,H,C):o.push(De,H,b);break}case B:case M:{let h=D.groupId?r[D.groupId]:d;if(h===w){let m=D.type===B?D.breakContents:D.negate?D.contents:Ne(D.contents);m&&o.push({ind:p,mode:d,doc:m});}if(h===N){let m=D.type===B?D.flatContents:D.negate?Ne(D.contents):D.contents;m&&o.push({ind:p,mode:d,doc:m});}break}case L:l.push({ind:p,mode:d,doc:D.contents});break;case z:l.length>0&&o.push({ind:p,mode:d,doc:pt});break;case k:switch(d){case N:if(D.hard)a=true;else {D.soft||(u.push(" "),i+=1);break}case w:if(l.length>0){o.push({ind:p,mode:d,doc:D},...l.reverse()),l.length=0;break}D.literal?p.root?(u.push(s,p.root.value),i=p.root.length):(u.push(s),i=0):(i-=et(u),u.push(s+p.value),i=p.length);break}break;case W:o.push({ind:p,mode:d,doc:D.contents});break;case $:break;default:throw new ae(D)}o.length===0&&l.length>0&&(o.push(...l.reverse()),l.length=0);}let f=u.indexOf(oe);if(f!==-1){let p=u.indexOf(oe,f+1);if(p===-1)return {formatted:u.filter(m=>m!==oe).join("")};let d=u.slice(0,f).join(""),D=u.slice(f+1,p).join(""),h=u.slice(p+1).join("");return {formatted:d+D+h,cursorNodeStart:d.length,cursorNodeText:D}}return {formatted:u.join("")}}function Kn(e,t,r=0){let n=0;for(let s=r;s<e.length;++s)e[s]===" "?n=n+t-n%t:n++;return n}var ft=Kn,K,tt,$e,Xn=class{constructor(e){tn(this,K),this.stack=[e];}get key(){let{stack:e,siblings:t}=this;return x(false,e,t===null?-2:-4)??null}get index(){return this.siblings===null?null:x(false,this.stack,-2)}get node(){return x(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=x(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 [...fe(this,K,$e).call(this)]}getName(){let{stack:e}=this,{length:t}=e;return t>1?x(false,e,-2):null}getValue(){return x(false,this.stack,-1)}getNode(e=0){let t=fe(this,K,tt).call(this,e);return t===-1?null:this.stack[t]}getParentNode(e=0){return this.getNode(e+1)}call(e,...t){let{stack:r}=this,{length:n}=r,s=x(false,r,-1);for(let i of t)s=s[i],r.push(i,s);try{return e(this)}finally{r.length=n;}}callParent(e,t=0){let r=fe(this,K,tt).call(this,t+1),n=this.stack.splice(r+1);try{return e(this)}finally{this.stack.push(...n);}}each(e,...t){let{stack:r}=this,{length:n}=r,s=x(false,r,-1);for(let i of t)s=s[i],r.push(i,s);try{for(let i=0;i<s.length;++i)r.push(i,s[i]),e(this,i,s),r.length-=2;}finally{r.length=n;}}map(e,...t){let r=[];return this.each((n,s,i)=>{r[s]=e(n,s,i);},...t),r}match(...e){let t=this.stack.length-1,r=null,n=this.stack[t--];for(let s of e){if(n===void 0)return false;let i=null;if(typeof r=="number"&&(i=r,r=this.stack[t--],n=this.stack[t--]),s&&!s(n,r,i))return false;r=this.stack[t--],n=this.stack[t--];}return true}findAncestor(e){for(let t of fe(this,K,$e).call(this))if(e(t))return t}hasAncestor(e){for(let t of fe(this,K,$e).call(this))if(e(t))return true;return false}};K=new WeakSet,tt=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},$e=function*(){let{stack:e}=this;for(let t=e.length-3;t>=0;t-=2){let r=e[t];Array.isArray(r)||(yield r);}};var Yn=Xn,fr=new Proxy(()=>{},{get:()=>fr}),rt=fr;function Qn(e){return e!==null&&typeof e=="object"}var es=Qn;function*Re(e,t){let{getVisitorKeys:r,filter:n=()=>true}=t,s=i=>es(i)&&n(i);for(let i of r(e)){let o=e[i];if(Array.isArray(o))for(let u of o)s(u)&&(yield u);else s(o)&&(yield o);}}function*ts(e,t){let r=[e];for(let n=0;n<r.length;n++){let s=r[n];for(let i of Re(s,t))yield i,r.push(i);}}function rs(e,t){return Re(e,t).next().done}function ge(e){return (t,r,n)=>{let s=!!(n!=null&&n.backwards);if(r===false)return false;let{length:i}=t,o=r;for(;o>=0&&o<i;){let u=t.charAt(o);if(e instanceof RegExp){if(!e.test(u))return o}else if(!e.includes(u))return o;s?o--:o++;}return o===-1||o===i?o:false}}var ns=ge(/\s/u),q=ge(" "),dr=ge(",; "),hr=ge(/[^\n\r]/u);function ss(e,t,r){let n=!!(r!=null&&r.backwards);if(t===false)return false;let s=e.charAt(t);if(n){if(e.charAt(t-1)==="\r"&&s===`
|
|
27
|
+
`)return t-2;if(s===`
|
|
28
|
+
`||s==="\r"||s==="\u2028"||s==="\u2029")return t-1}else {if(s==="\r"&&e.charAt(t+1)===`
|
|
29
|
+
`)return t+2;if(s===`
|
|
30
|
+
`||s==="\r"||s==="\u2028"||s==="\u2029")return t+1}return t}var te=ss;function is(e,t,r={}){let n=q(e,r.backwards?t-1:t,r),s=te(e,n,r);return n!==s}var J=is;function os(e){return Array.isArray(e)&&e.length>0}var us=os,mr=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),as=e=>Object.keys(e).filter(t=>!mr.has(t));function ls(e){return e?t=>e(t,mr):as}var Ie=ls;function cs(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 dt(e,t){(e.comments??(e.comments=[])).push(t),t.printed=false,t.nodeDescription=cs(e);}function he(e,t){t.leading=true,t.trailing=false,dt(e,t);}function X(e,t,r){t.leading=false,t.trailing=false,r&&(t.marker=r),dt(e,t);}function me(e,t){t.leading=false,t.trailing=true,dt(e,t);}var Je=new WeakMap;function ht(e,t){if(Je.has(e))return Je.get(e);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:s},locStart:i,locEnd:o}=t;if(!n)return [];let u=(r?.(e,t)??[...Re(e,{getVisitorKeys:Ie(s)})]).flatMap(a=>n(a)?[a]:ht(a,t));return u.sort((a,l)=>i(a)-i(l)||o(a)-o(l)),Je.set(e,u),u}function gr(e,t,r,n){let{locStart:s,locEnd:i}=r,o=s(t),u=i(t),a=ht(e,r),l,c,f=0,p=a.length;for(;f<p;){let d=f+p>>1,D=a[d],h=s(D),m=i(D);if(h<=o&&u<=m)return gr(D,t,r,D);if(m<=o){l=D,f=d+1;continue}if(u<=h){c=D,p=d;continue}throw new Error("Comment location overlaps with node location")}if(n?.type==="TemplateLiteral"){let{quasis:d}=n,D=Ue(d,t,r);l&&Ue(d,l,r)!==D&&(l=null),c&&Ue(d,c,r)!==D&&(c=null);}return {enclosingNode:n,precedingNode:l,followingNode:c}}var qe=()=>false;function ps(e,t){let{comments:r}=e;if(delete e.comments,!us(r)||!t.printer.canAttachComment)return;let n=[],{printer:{experimentalFeatures:{avoidAstMutation:s=false}={},handleComments:i={}},originalText:o}=t,{ownLine:u=qe,endOfLine:a=qe,remaining:l=qe}=i,c=r.map((f,p)=>({...gr(e,f,t),comment:f,text:o,options:t,ast:e,isLastComment:r.length-1===p}));for(let[f,p]of c.entries()){let{comment:d,precedingNode:D,enclosingNode:h,followingNode:m,text:g,options:E,ast:F,isLastComment:y}=p,C;if(s?C=[p]:(d.enclosingNode=h,d.precedingNode=D,d.followingNode=m,C=[d,g,E,F,y]),Ds(g,E,c,f))d.placement="ownLine",u(...C)||(m?he(m,d):D?me(D,d):X(h||F,d));else if(fs(g,E,c,f))d.placement="endOfLine",a(...C)||(D?me(D,d):m?he(m,d):X(h||F,d));else if(d.placement="remaining",!l(...C))if(D&&m){let b=n.length;b>0&&n[b-1].followingNode!==m&&At(n,E),n.push(p);}else D?me(D,d):m?he(m,d):X(h||F,d);}if(At(n,t),!s)for(let f of r)delete f.precedingNode,delete f.enclosingNode,delete f.followingNode;}var Fr=e=>!/[\S\n\u2028\u2029]/u.test(e);function Ds(e,t,r,n){let{comment:s,precedingNode:i}=r[n],{locStart:o,locEnd:u}=t,a=o(s);if(i)for(let l=n-1;l>=0;l--){let{comment:c,precedingNode:f}=r[l];if(f!==i||!Fr(e.slice(u(c),a)))break;a=o(c);}return J(e,a,{backwards:true})}function fs(e,t,r,n){let{comment:s,followingNode:i}=r[n],{locStart:o,locEnd:u}=t,a=u(s);if(i)for(let l=n+1;l<r.length;l++){let{comment:c,followingNode:f}=r[l];if(f!==i||!Fr(e.slice(a,o(c))))break;a=u(c);}return J(e,a)}function At(e,t){var r,n;let s=e.length;if(s===0)return;let{precedingNode:i,followingNode:o}=e[0],u=t.locStart(o),a;for(a=s;a>0;--a){let{comment:l,precedingNode:c,followingNode:f}=e[a-1];rt.strictEqual(c,i),rt.strictEqual(f,o);let p=t.originalText.slice(t.locEnd(l),u);if(((n=(r=t.printer).isGap)==null?void 0:n.call(r,p,t))??/^[\s(]*$/u.test(p))u=t.locStart(l);else break}for(let[l,{comment:c}]of e.entries())l<a?me(i,c):he(o,c);for(let l of [i,o])l.comments&&l.comments.length>1&&l.comments.sort((c,f)=>t.locStart(c)-t.locStart(f));e.length=0;}function Ue(e,t,r){let n=r.locStart(t)-1;for(let s=1;s<e.length;++s)if(n<r.locStart(e[s]))return s-1;return 0}function ds(e,t){let r=t-1;r=q(e,r,{backwards:true}),r=te(e,r,{backwards:true}),r=q(e,r,{backwards:true});let n=te(e,r,{backwards:true});return r!==n}var mt=ds;function Cr(e,t){let r=e.node;return r.printed=true,t.printer.printComment(e,t)}function hs(e,t){var r;let n=e.node,s=[Cr(e,t)],{printer:i,originalText:o,locStart:u,locEnd:a}=t;if((r=i.isBlockComment)!=null&&r.call(i,n)){let c=J(o,a(n))?J(o,u(n),{backwards:true})?ee:ar:" ";s.push(c);}else s.push(ee);let l=te(o,q(o,a(n)));return l!==false&&J(o,l)&&s.push(ee),s}function ms(e,t,r){var n;let s=e.node,i=Cr(e,t),{printer:o,originalText:u,locStart:a}=t,l=(n=o.isBlockComment)==null?void 0:n.call(o,s);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||J(u,a(s),{backwards:true})){let c=mt(u,a(s));return {doc:Xe([ee,c?ee:"",i]),isBlock:l,hasLineSuffix:true}}return !l||r!=null&&r.hasLineSuffix?{doc:[Xe([" ",i]),Ve],isBlock:l,hasLineSuffix:true}:{doc:[" ",i],isBlock:l,hasLineSuffix:false}}function gs(e,t){let r=e.node;if(!r)return {};let n=t[Symbol.for("printedComments")];if((r.comments||[]).filter(u=>!n.has(u)).length===0)return {leading:"",trailing:""};let s=[],i=[],o;return e.each(()=>{let u=e.node;if(n!=null&&n.has(u))return;let{leading:a,trailing:l}=u;a?s.push(hs(e,t)):l&&(o=ms(e,t,o),i.push(o.doc));},"comments"),{leading:s,trailing:i}}function Fs(e,t,r){let{leading:n,trailing:s}=gs(e,r);return !n&&!s?t:Be(t,i=>[n,i,s])}function Cs(e){let{[Symbol.for("comments")]:t,[Symbol.for("printedComments")]:r}=e;for(let n of t){if(!n.printed&&!r.has(n))throw new Error('Comment "'+n.value.trim()+'" was not printed. Please report this error!');delete n.printed;}}var Er=class extends Error{constructor(){super(...arguments);v(this,"name","ConfigError");}},Bt=class extends Error{constructor(){super(...arguments);v(this,"name","UndefinedParserError");}},vs={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."}]}};function yr({plugins:e=[],showDeprecated:t=false}={}){let r=e.flatMap(
|
|
34
|
-
`)),kr(
|
|
35
|
-
`)),kr(n,r)}function kr(e,t){if(e.length===1)return e[0];let[r,n]=e,[i
|
|
36
|
-
`,1)[0].length);return i>t&&i>s?n:r}var He=[],jt=[];function Ii(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let n=e.length,i=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-i);)n--,i--;let s=0;for(;s<n&&e.charCodeAt(s)===t.charCodeAt(s);)s++;if(n-=s,i-=s,n===0)return i;let o,u,a,l,c=0,d=0;for(;c<n;)jt[c]=e.charCodeAt(s+c),He[c]=++c;for(;d<i;)for(o=t.charCodeAt(s+d),a=d++,u=d,c=0;c<n;c++)l=o===jt[c]?a:a+1,a=He[c],u=He[c]=a>u?l>u?u+1:l:l>a?a+1:l;return u}var wr=(e,t,{descriptor:r,logger:n,schemas:i})=>{let s=[`Ignored unknown option ${N.yellow(r.pair({key:e,value:t}))}.`],o=Object.keys(i).sort().find(u=>Ii(e,u)<3);o&&s.push(`Did you mean ${N.blue(r.key(o))}?`),n.warn(s.join(" "));},ji=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Gi(e,t){let r=new e(t),n=Object.create(r);for(let i of ji)i in t&&(n[i]=_i(t[i],r,H.prototype[i].length));return n}var H=class{static create(e){return Gi(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 $e}};function _i(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var Mi=class extends H{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}},Li=class extends H{expected(){return "anything"}validate(){return true}},zi=class extends H{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 n of e){let i=t.normalizeValidateResult(this._valueSchema.validate(n,t),n);i!==true&&r.push(i.value);}return r.length===0?true:{value:r}}deprecated(e,t){let r=[];for(let n of e){let i=t.normalizeDeprecatedResult(this._valueSchema.deprecated(n,t),n);i!==false&&r.push(...i.map(({value:s})=>({value:[s]})));}return r}forward(e,t){let r=[];for(let n of e){let i=t.normalizeForwardResult(this._valueSchema.forward(n,t),n);r.push(...i.map(Gt));}return r}redirect(e,t){let r=[],n=[];for(let i of e){let s=t.normalizeRedirectResult(this._valueSchema.redirect(i,t),i);"remain"in s&&r.push(s.remain),n.push(...s.redirect.map(Gt));}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(e,t){return e.concat(t)}};function Gt({from:e,to:t}){return {from:[e],to:t}}var Ji=class extends H{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};function qi(e,t){let r=Object.create(null);for(let n of e){let i=n[t];if(r[i])throw new Error(`Duplicate ${t} ${JSON.stringify(i)}`);r[i]=n;}return r}function Ui(e,t){let r=new Map;for(let n of e){let i=n[t];if(r.has(i))throw new Error(`Duplicate ${t} ${JSON.stringify(i)}`);r.set(i,n);}return r}function Hi(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?true:(e[r]=true,false)}}function Zi(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return [r,n]}function Ki(e){return e===Math.floor(e)}function Xi(e,t){if(e===t)return 0;let r=typeof e,n=typeof t,i=["undefined","object","boolean","number","string"];return r!==n?i.indexOf(r)-i.indexOf(n):r!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Yi(e){return (...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function _t(e){return e===void 0?{}:e}function Ar(e){if(typeof e=="string")return {text:e};let{text:t,list:r}=e;return Qi((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(Ar)}}:{text:t}}function Mt(e,t){return e===true?true:e===false?{value:t}:e}function Lt(e,t,r=false){return e===false?false:e===true?r?true:[{value:t}]:"value"in e?[e]:e.length===0?false:e}function zt(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 nt(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>zt(r,t)):[zt(e,t)]}function Jt(e,t){let r=nt(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 Qi(e,t){if(!e)throw new Error(t)}var es=class extends H{constructor(e){super(e),this._choices=Ui(e.choices.map(t=>t&&typeof t=="object"?t:{value:t}),"value");}expected({descriptor:e}){let t=Array.from(this._choices.keys()).map(i=>this._choices.get(i)).filter(({hidden:i})=>!i).map(i=>i.value).sort(Xi).map(e.value),r=t.slice(0,-2),n=t.slice(-2);return {text:r.concat(n.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}},ts=class extends H{expected(){return "a number"}validate(e,t){return typeof e=="number"}},rs=class extends ts{expected(){return "an integer"}validate(e,t){return t.normalizeValidateResult(super.validate(e,t),e)===true&&Ki(e)}},qt=class extends H{expected(){return "a string"}validate(e){return typeof e=="string"}},ns=oe,is=wr,ss=Ri,os=Wi,us=class{constructor(e,t){let{logger:r=console,loggerPrintWidth:n=80,descriptor:i=ns,unknown:s=is,invalid:o=ss,deprecated:u=os,missing:a=()=>false,required:l=()=>false,preprocess:c=p=>p,postprocess:d=()=>$e}=t||{};this._utils={descriptor:i,logger:r||{warn:()=>{}},loggerPrintWidth:n,schemas:qi(e,"name"),normalizeDefaultResult:_t,normalizeExpectedResult:Ar,normalizeDeprecatedResult:Lt,normalizeForwardResult:nt,normalizeRedirectResult:Jt,normalizeValidateResult:Mt},this._unknownHandler=s,this._invalidHandler=Yi(o),this._deprecatedHandler=u,this._identifyMissing=(p,f)=>!(p in f)||a(p,f),this._identifyRequired=l,this._preprocess=c,this._postprocess=d,this.cleanHistory();}cleanHistory(){this._hasDeprecationWarned=Hi();}normalize(e){let t={},r=[this._preprocess(e,this._utils)],n=()=>{for(;r.length!==0;){let i=r.shift(),s=this._applyNormalization(i,t);r.push(...s);}};n();for(let i of Object.keys(this._utils.schemas)){let s=this._utils.schemas[i];if(!(i in t)){let o=_t(s.default(this._utils));"value"in o&&r.push({[i]:o.value});}}n();for(let i of Object.keys(this._utils.schemas)){if(!(i in t))continue;let s=this._utils.schemas[i],o=t[i],u=s.postprocess(o,this._utils);u!==$e&&(this._applyValidation(u,i,s),t[i]=u);}return this._applyPostprocess(t),this._applyRequiredCheck(t),t}_applyNormalization(e,t){let r=[],{knownKeys:n,unknownKeys:i}=this._partitionOptionKeys(e);for(let s of n){let o=this._utils.schemas[s],u=o.preprocess(e[s],this._utils);this._applyValidation(u,s,o);let a=({from:d,to:p})=>{r.push(typeof p=="string"?{[p]:d}:{[p.key]:p.value});},l=({value:d,redirectTo:p})=>{let f=Lt(o.deprecated(d,this._utils),u,true);if(f!==false)if(f===true)this._hasDeprecationWarned(s)||this._utils.logger.warn(this._deprecatedHandler(s,p,this._utils));else for(let{value:D}of f){let h={key:s,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));}}};nt(o.forward(u,this._utils),u).forEach(a);let c=Jt(o.redirect(u,this._utils),u);if(c.redirect.forEach(a),"remain"in c){let d=c.remain;t[s]=s in t?o.overlap(t[s],d,this._utils):d,l({value:d});}for(let{from:d,to:p}of c.redirect)l({value:d,redirectTo:p});}for(let s of i){let o=e[s];this._applyUnknownHandler(s,o,t,(u,a)=>{r.push({[u]: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,Sr,this._utils)}_partitionOptionKeys(e){let[t,r]=Zi(Object.keys(e).filter(n=>!this._identifyMissing(n,e)),n=>n in this._utils.schemas);return {knownKeys:t,unknownKeys:r}}_applyValidation(e,t,r){let n=Mt(r.validate(e,this._utils),e);if(n!==true)throw this._invalidHandler(t,n.value,this._utils)}_applyUnknownHandler(e,t,r,n){let i=this._unknownHandler(e,t,this._utils);if(i)for(let s of Object.keys(i)){if(this._identifyMissing(s,i))continue;let o=i[s];s in this._utils.schemas?n(s,o):r[s]=o;}}_applyPostprocess(e){let t=this._postprocess(e,this._utils);if(t!==$e){if(t.delete)for(let r of t.delete)delete e[r];if(t.override){let{knownKeys:r,unknownKeys:n}=this._partitionOptionKeys(t.override);for(let i of r){let s=t.override[i];this._applyValidation(s,i,this._utils.schemas[i]),e[i]=s;}for(let i of n){let s=t.override[i];this._applyUnknownHandler(i,s,e,(o,u)=>{let a=this._utils.schemas[o];this._applyValidation(u,o,a),e[o]=u;});}}}}},Ze;function as(e,t,{logger:r=false,isCLI:n=false,passThrough:i=false,FlagSchema:s,descriptor:o}={}){if(n){if(!s)throw new Error("'FlagSchema' option is required.");if(!o)throw new Error("'descriptor' option is required.")}else o=oe;let u=i?Array.isArray(i)?(p,f)=>i.includes(p)?{[p]:f}:void 0:(p,f)=>({[p]:f}):(p,f,D)=>{let{_:h,...m}=D.schemas;return wr(p,f,{...D,schemas:m})},a=ls(t,{isCLI:n,FlagSchema:s}),l=new us(a,{logger:r,unknown:u,descriptor:o}),c=r!==false;c&&Ze&&(l._hasDeprecationWarned=Ze);let d=l.normalize(e);return c&&(Ze=l._hasDeprecationWarned),d}function ls(e,{isCLI:t,FlagSchema:r}){let n=[];t&&n.push(Li.create({name:"_"}));for(let i of e)n.push(cs(i,{isCLI:t,optionInfos:e,FlagSchema:r})),i.alias&&t&&n.push(Mi.create({name:i.alias,sourceName:i.name}));return n}function cs(e,{isCLI:t,optionInfos:r,FlagSchema:n}){let{name:i}=e,s={name:i},o,u={};switch(e.type){case "int":o=rs,t&&(s.preprocess=Number);break;case "string":o=qt;break;case "choice":o=es,s.choices=e.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:e.name,value:a.redirect}}}:a);break;case "boolean":o=Ji;break;case "flag":o=n,s.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case "path":o=qt;break;default:throw new Error(`Unexpected type ${e.type}`)}if(e.exception?s.validate=(a,l,c)=>e.exception(a)||l.validate(a,c):s.validate=(a,l,c)=>a===void 0||l.validate(a,c),e.redirect&&(u.redirect=a=>a?{to:typeof e.redirect=="string"?e.redirect:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(u.deprecated=true),t&&!e.array){let a=s.preprocess||(l=>l);s.preprocess=(l,c,d)=>c.preprocess(a(Array.isArray(l)?x(false,l,-1):l),d);}return e.array?zi.create({...t?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...u,valueSchema:o.create(s)}):o.create({...s,...u})}var ps=as,Ds=(e,t,r)=>{if(!(e&&t==null)){if(t.findLast)return t.findLast(r);for(let n=t.length-1;n>=0;n--){let i=t[n];if(r(i,n,t))return i}}},Br=Ds;function $r(e,t){if(!t)throw new Error("parserName is required.");let r=Br(false,e,i=>i.parsers&&Object.prototype.hasOwnProperty.call(i.parsers,t));if(r)return r;let n=`Couldn't resolve parser "${t}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new Er(n)}function ds(e,t){if(!t)throw new Error("astFormat is required.");let r=Br(false,e,i=>i.printers&&Object.prototype.hasOwnProperty.call(i.printers,t));if(r)return r;let n=`Couldn't find plugin for AST format "${t}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new Er(n)}function gt({plugins:e,parser:t}){let r=$r(e,t);return Or(r,t)}function Or(e,t){let r=e.parsers[t];return typeof r=="function"?r():r}function fs(e,t){let r=e.printers[t];return typeof r=="function"?r():r}var Ut={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function hs(e,t={}){var r;let n={...e};if(!n.parser)if(n.filepath){if(n.parser=Vi(n,{physicalFile:n.filepath}),!n.parser)throw new Bt(`No parser could be inferred for file "${n.filepath}".`)}else throw new Bt("No parser and no file path given, couldn't infer a parser.");let i=yr({plugins:e.plugins,showDeprecated:true}).options,s={...Ut,...Object.fromEntries(i.filter(p=>p.default!==void 0).map(p=>[p.name,p.default]))},o=$r(n.plugins,n.parser),u=await Or(o,n.parser);n.astFormat=u.astFormat,n.locEnd=u.locEnd,n.locStart=u.locStart;let a=(r=o.printers)!=null&&r[u.astFormat]?o:ds(n.plugins,u.astFormat),l=await fs(a,u.astFormat);n.printer=l;let c=a.defaultOptions?Object.fromEntries(Object.entries(a.defaultOptions).filter(([,p])=>p!==void 0)):{},d={...s,...c};for(let[p,f]of Object.entries(d))(n[p]===null||n[p]===void 0)&&(n[p]=f);return n.parser==="json"&&(n.trailingComma="none"),ps(n,i,{passThrough:Object.keys(Ut),...t})}var le=hs,ms=Qr(rn());async function gs(e,t){let r=await gt(t),n=r.preprocess?r.preprocess(e,t):e;t.originalText=n;let i;try{i=await r.parse(n,t,t);}catch(s){Fs(s,e);}return {text:n,ast:i}}function Fs(e,t){let{loc:r}=e;if(r){let n=(0, ms.codeFrameColumns)(t,r,{highlightCode:true});throw e.message+=`
|
|
37
|
-
`+n,e.codeFrame=n,e}throw e}var
|
|
38
|
-
`,
|
|
39
|
-
`&&(p+=rr(
|
|
40
|
-
`)),
|
|
41
|
-
`,D);}return {formatted:
|
|
42
|
-
`);r-=u(r),n-=u(n),
|
|
43
|
-
`);return r===-1?0:
|
|
44
|
-
`)return true;return false}var so
|
|
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."}]}};function yr({plugins:e=[],showDeprecated:t=false}={}){let r=e.flatMap(s=>s.languages??[]),n=[];for(let s of Ss(Object.assign({},...e.map(({options:i})=>i),vs)))!t&&s.deprecated||(Array.isArray(s.choices)&&(t||(s.choices=s.choices.filter(i=>!i.deprecated)),s.name==="parser"&&(s.choices=[...s.choices,...bs(s.choices,r,e)])),s.pluginDefaults=Object.fromEntries(e.filter(i=>{var o;return ((o=i.defaultOptions)==null?void 0:o[s.name])!==void 0}).map(i=>[i.name,i.defaultOptions[s.name]])),n.push(s));return {languages:r,options:n}}function*bs(e,t,r){let n=new Set(e.map(s=>s.value));for(let s of t)if(s.parsers){for(let i of s.parsers)if(!n.has(i)){n.add(i);let o=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,i)),u=s.name;o!=null&&o.name&&(u+=` (plugin: ${o.name})`),yield {value:i,description:u};}}}function Ss(e){let t=[];for(let[r,n]of Object.entries(e)){let s={name:r,...n};Array.isArray(s.default)&&(s.default=x(false,s.default,-1).value),t.push(s);}return t}var xs=(e,t)=>{if(!(e&&t==null))return t.toReversed||!Array.isArray(t)?t.toReversed():[...t].reverse()},ks=xs,$t,Ot,Nt,Pt,Tt,ws=(($t=globalThis.Deno)==null?void 0:$t.build.os)==="windows"||((Nt=(Ot=globalThis.navigator)==null?void 0:Ot.platform)==null?void 0:Nt.startsWith("Win"))||((Tt=(Pt=globalThis.process)==null?void 0:Pt.platform)==null?void 0:Tt.startsWith("win"))||false;function vr(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 As(e){return e=vr(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function Bs(e){e=vr(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 $s(e){return ws?Bs(e):As(e)}var Os=$s,Ns=e=>String(e).split(/[/\\]/u).pop();function Vt(e,t){if(!t)return;let r=Ns(t).toLowerCase();return e.find(({filenames:n})=>n?.some(s=>s.toLowerCase()===r))??e.find(({extensions:n})=>n?.some(s=>r.endsWith(s)))}function Ps(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 Wt(e,t){if(t){if(String(t).startsWith("file:"))try{t=Os(t);}catch{return}if(typeof t=="string")return e.find(({isSupported:r})=>r?.({filepath:t}))}}function Ts(e,t){let r=ks(false,e.plugins).flatMap(s=>s.languages??[]),n=Ps(r,t.language)??Vt(r,t.physicalFile)??Vt(r,t.file)??Wt(r,t.physicalFile)??Wt(r,t.file)??(t.physicalFile,void 0);return n?.parsers[0]}var Vs=Ts,ue={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=>ue.value(r)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(r=>`${ue.key(r)}: ${ue.value(e[r])}`).join(", ")} }`},pair:({key:e,value:t})=>ue.value({[e]:t})},br=new Proxy(String,{get:()=>br}),P=br,Ws=(e,t,{descriptor:r})=>{let n=[`${P.yellow(typeof e=="string"?r.key(e):r.pair(e))} is deprecated`];return t&&n.push(`we now treat it as ${P.blue(typeof t=="string"?r.key(t):r.pair(t))}`),n.join("; ")+"."},Sr=Symbol.for("vnopts.VALUE_NOT_EXIST"),Oe=Symbol.for("vnopts.VALUE_UNCHANGED"),Rt=" ".repeat(2),Rs=(e,t,r)=>{let{text:n,list:s}=r.normalizeExpectedResult(r.schemas[e].expected(r)),i=[];return n&&i.push(It(e,t,n,r.descriptor)),s&&i.push([It(e,t,s.title,r.descriptor)].concat(s.values.map(o=>xr(o,r.loggerPrintWidth))).join(`
|
|
34
|
+
`)),kr(i,r.loggerPrintWidth)};function It(e,t,r,n){return [`Invalid ${P.red(n.key(e))} value.`,`Expected ${P.blue(r)},`,`but received ${t===Sr?P.gray("nothing"):P.red(n.value(t))}.`].join(" ")}function xr({text:e,list:t},r){let n=[];return e&&n.push(`- ${P.blue(e)}`),t&&n.push([`- ${P.blue(t.title)}:`].concat(t.values.map(s=>xr(s,r-Rt.length).replace(/^|\n/g,`$&${Rt}`))).join(`
|
|
35
|
+
`)),kr(n,r)}function kr(e,t){if(e.length===1)return e[0];let[r,n]=e,[s,i]=e.map(o=>o.split(`
|
|
36
|
+
`,1)[0].length);return s>t&&s>i?n:r}var Ze=[],jt=[];function Is(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let n=e.length,s=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-s);)n--,s--;let i=0;for(;i<n&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(n-=i,s-=i,n===0)return s;let o,u,a,l,c=0,f=0;for(;c<n;)jt[c]=e.charCodeAt(i+c),Ze[c]=++c;for(;f<s;)for(o=t.charCodeAt(i+f),a=f++,u=f,c=0;c<n;c++)l=o===jt[c]?a:a+1,a=Ze[c],u=Ze[c]=a>u?l>u?u+1:l:l>a?a+1:l;return u}var wr=(e,t,{descriptor:r,logger:n,schemas:s})=>{let i=[`Ignored unknown option ${P.yellow(r.pair({key:e,value:t}))}.`],o=Object.keys(s).sort().find(u=>Is(e,u)<3);o&&i.push(`Did you mean ${P.blue(r.key(o))}?`),n.warn(i.join(" "));},js=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function Gs(e,t){let r=new e(t),n=Object.create(r);for(let s of js)s in t&&(n[s]=_s(t[s],r,Z.prototype[s].length));return n}var Z=class{static create(e){return Gs(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 Oe}};function _s(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var Ms=class extends Z{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}},Ls=class extends Z{expected(){return "anything"}validate(){return true}},zs=class extends Z{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 n of e){let s=t.normalizeValidateResult(this._valueSchema.validate(n,t),n);s!==true&&r.push(s.value);}return r.length===0?true:{value:r}}deprecated(e,t){let r=[];for(let n of e){let s=t.normalizeDeprecatedResult(this._valueSchema.deprecated(n,t),n);s!==false&&r.push(...s.map(({value:i})=>({value:[i]})));}return r}forward(e,t){let r=[];for(let n of e){let s=t.normalizeForwardResult(this._valueSchema.forward(n,t),n);r.push(...s.map(Gt));}return r}redirect(e,t){let r=[],n=[];for(let s of e){let i=t.normalizeRedirectResult(this._valueSchema.redirect(s,t),s);"remain"in i&&r.push(i.remain),n.push(...i.redirect.map(Gt));}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(e,t){return e.concat(t)}};function Gt({from:e,to:t}){return {from:[e],to:t}}var Js=class extends Z{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};function qs(e,t){let r=Object.create(null);for(let n of e){let s=n[t];if(r[s])throw new Error(`Duplicate ${t} ${JSON.stringify(s)}`);r[s]=n;}return r}function Us(e,t){let r=new Map;for(let n of e){let s=n[t];if(r.has(s))throw new Error(`Duplicate ${t} ${JSON.stringify(s)}`);r.set(s,n);}return r}function Zs(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?true:(e[r]=true,false)}}function Hs(e,t){let r=[],n=[];for(let s of e)t(s)?r.push(s):n.push(s);return [r,n]}function Ks(e){return e===Math.floor(e)}function Xs(e,t){if(e===t)return 0;let r=typeof e,n=typeof t,s=["undefined","object","boolean","number","string"];return r!==n?s.indexOf(r)-s.indexOf(n):r!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Ys(e){return (...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function _t(e){return e===void 0?{}:e}function Ar(e){if(typeof e=="string")return {text:e};let{text:t,list:r}=e;return Qs((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(Ar)}}:{text:t}}function Mt(e,t){return e===true?true:e===false?{value:t}:e}function Lt(e,t,r=false){return e===false?false:e===true?r?true:[{value:t}]:"value"in e?[e]:e.length===0?false:e}function zt(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 nt(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>zt(r,t)):[zt(e,t)]}function Jt(e,t){let r=nt(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 Qs(e,t){if(!e)throw new Error(t)}var ei=class extends Z{constructor(e){super(e),this._choices=Us(e.choices.map(t=>t&&typeof t=="object"?t:{value:t}),"value");}expected({descriptor:e}){let t=Array.from(this._choices.keys()).map(s=>this._choices.get(s)).filter(({hidden:s})=>!s).map(s=>s.value).sort(Xs).map(e.value),r=t.slice(0,-2),n=t.slice(-2);return {text:r.concat(n.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}},ti=class extends Z{expected(){return "a number"}validate(e,t){return typeof e=="number"}},ri=class extends ti{expected(){return "an integer"}validate(e,t){return t.normalizeValidateResult(super.validate(e,t),e)===true&&Ks(e)}},qt=class extends Z{expected(){return "a string"}validate(e){return typeof e=="string"}},ni=ue,si=wr,ii=Rs,oi=Ws,ui=class{constructor(e,t){let{logger:r=console,loggerPrintWidth:n=80,descriptor:s=ni,unknown:i=si,invalid:o=ii,deprecated:u=oi,missing:a=()=>false,required:l=()=>false,preprocess:c=p=>p,postprocess:f=()=>Oe}=t||{};this._utils={descriptor:s,logger:r||{warn:()=>{}},loggerPrintWidth:n,schemas:qs(e,"name"),normalizeDefaultResult:_t,normalizeExpectedResult:Ar,normalizeDeprecatedResult:Lt,normalizeForwardResult:nt,normalizeRedirectResult:Jt,normalizeValidateResult:Mt},this._unknownHandler=i,this._invalidHandler=Ys(o),this._deprecatedHandler=u,this._identifyMissing=(p,d)=>!(p in d)||a(p,d),this._identifyRequired=l,this._preprocess=c,this._postprocess=f,this.cleanHistory();}cleanHistory(){this._hasDeprecationWarned=Zs();}normalize(e){let t={},r=[this._preprocess(e,this._utils)],n=()=>{for(;r.length!==0;){let s=r.shift(),i=this._applyNormalization(s,t);r.push(...i);}};n();for(let s of Object.keys(this._utils.schemas)){let i=this._utils.schemas[s];if(!(s in t)){let o=_t(i.default(this._utils));"value"in o&&r.push({[s]:o.value});}}n();for(let s of Object.keys(this._utils.schemas)){if(!(s in t))continue;let i=this._utils.schemas[s],o=t[s],u=i.postprocess(o,this._utils);u!==Oe&&(this._applyValidation(u,s,i),t[s]=u);}return this._applyPostprocess(t),this._applyRequiredCheck(t),t}_applyNormalization(e,t){let r=[],{knownKeys:n,unknownKeys:s}=this._partitionOptionKeys(e);for(let i of n){let o=this._utils.schemas[i],u=o.preprocess(e[i],this._utils);this._applyValidation(u,i,o);let a=({from:f,to:p})=>{r.push(typeof p=="string"?{[p]:f}:{[p.key]:p.value});},l=({value:f,redirectTo:p})=>{let d=Lt(o.deprecated(f,this._utils),u,true);if(d!==false)if(d===true)this._hasDeprecationWarned(i)||this._utils.logger.warn(this._deprecatedHandler(i,p,this._utils));else for(let{value:D}of d){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));}}};nt(o.forward(u,this._utils),u).forEach(a);let c=Jt(o.redirect(u,this._utils),u);if(c.redirect.forEach(a),"remain"in c){let f=c.remain;t[i]=i in t?o.overlap(t[i],f,this._utils):f,l({value:f});}for(let{from:f,to:p}of c.redirect)l({value:f,redirectTo:p});}for(let i of s){let o=e[i];this._applyUnknownHandler(i,o,t,(u,a)=>{r.push({[u]: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,Sr,this._utils)}_partitionOptionKeys(e){let[t,r]=Hs(Object.keys(e).filter(n=>!this._identifyMissing(n,e)),n=>n in this._utils.schemas);return {knownKeys:t,unknownKeys:r}}_applyValidation(e,t,r){let n=Mt(r.validate(e,this._utils),e);if(n!==true)throw this._invalidHandler(t,n.value,this._utils)}_applyUnknownHandler(e,t,r,n){let s=this._unknownHandler(e,t,this._utils);if(s)for(let i of Object.keys(s)){if(this._identifyMissing(i,s))continue;let o=s[i];i in this._utils.schemas?n(i,o):r[i]=o;}}_applyPostprocess(e){let t=this._postprocess(e,this._utils);if(t!==Oe){if(t.delete)for(let r of t.delete)delete e[r];if(t.override){let{knownKeys:r,unknownKeys:n}=this._partitionOptionKeys(t.override);for(let s of r){let i=t.override[s];this._applyValidation(i,s,this._utils.schemas[s]),e[s]=i;}for(let s of n){let i=t.override[s];this._applyUnknownHandler(s,i,e,(o,u)=>{let a=this._utils.schemas[o];this._applyValidation(u,o,a),e[o]=u;});}}}}},He;function ai(e,t,{logger:r=false,isCLI:n=false,passThrough:s=false,FlagSchema:i,descriptor:o}={}){if(n){if(!i)throw new Error("'FlagSchema' option is required.");if(!o)throw new Error("'descriptor' option is required.")}else o=ue;let u=s?Array.isArray(s)?(p,d)=>s.includes(p)?{[p]:d}:void 0:(p,d)=>({[p]:d}):(p,d,D)=>{let{_:h,...m}=D.schemas;return wr(p,d,{...D,schemas:m})},a=li(t,{isCLI:n,FlagSchema:i}),l=new ui(a,{logger:r,unknown:u,descriptor:o}),c=r!==false;c&&He&&(l._hasDeprecationWarned=He);let f=l.normalize(e);return c&&(He=l._hasDeprecationWarned),f}function li(e,{isCLI:t,FlagSchema:r}){let n=[];t&&n.push(Ls.create({name:"_"}));for(let s of e)n.push(ci(s,{isCLI:t,optionInfos:e,FlagSchema:r})),s.alias&&t&&n.push(Ms.create({name:s.alias,sourceName:s.name}));return n}function ci(e,{isCLI:t,optionInfos:r,FlagSchema:n}){let{name:s}=e,i={name:s},o,u={};switch(e.type){case "int":o=ri,t&&(i.preprocess=Number);break;case "string":o=qt;break;case "choice":o=ei,i.choices=e.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:e.name,value:a.redirect}}}:a);break;case "boolean":o=Js;break;case "flag":o=n,i.flags=r.flatMap(a=>[a.alias,a.description&&a.name,a.oppositeDescription&&`no-${a.name}`].filter(Boolean));break;case "path":o=qt;break;default:throw new Error(`Unexpected type ${e.type}`)}if(e.exception?i.validate=(a,l,c)=>e.exception(a)||l.validate(a,c):i.validate=(a,l,c)=>a===void 0||l.validate(a,c),e.redirect&&(u.redirect=a=>a?{to:typeof e.redirect=="string"?e.redirect:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(u.deprecated=true),t&&!e.array){let a=i.preprocess||(l=>l);i.preprocess=(l,c,f)=>c.preprocess(a(Array.isArray(l)?x(false,l,-1):l),f);}return e.array?zs.create({...t?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...u,valueSchema:o.create(i)}):o.create({...i,...u})}var pi=ai,Di=(e,t,r)=>{if(!(e&&t==null)){if(t.findLast)return t.findLast(r);for(let n=t.length-1;n>=0;n--){let s=t[n];if(r(s,n,t))return s}}},Br=Di;function $r(e,t){if(!t)throw new Error("parserName is required.");let r=Br(false,e,s=>s.parsers&&Object.prototype.hasOwnProperty.call(s.parsers,t));if(r)return r;let n=`Couldn't resolve parser "${t}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new Er(n)}function fi(e,t){if(!t)throw new Error("astFormat is required.");let r=Br(false,e,s=>s.printers&&Object.prototype.hasOwnProperty.call(s.printers,t));if(r)return r;let n=`Couldn't find plugin for AST format "${t}".`;throw n+=" Plugins must be explicitly added to the standalone bundle.",new Er(n)}function gt({plugins:e,parser:t}){let r=$r(e,t);return Or(r,t)}function Or(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}var Ut={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function hi(e,t={}){var r;let n={...e};if(!n.parser)if(n.filepath){if(n.parser=Vs(n,{physicalFile:n.filepath}),!n.parser)throw new Bt(`No parser could be inferred for file "${n.filepath}".`)}else throw new Bt("No parser and no file path given, couldn't infer a parser.");let s=yr({plugins:e.plugins,showDeprecated:true}).options,i={...Ut,...Object.fromEntries(s.filter(p=>p.default!==void 0).map(p=>[p.name,p.default]))},o=$r(n.plugins,n.parser),u=await Or(o,n.parser);n.astFormat=u.astFormat,n.locEnd=u.locEnd,n.locStart=u.locStart;let a=(r=o.printers)!=null&&r[u.astFormat]?o:fi(n.plugins,u.astFormat),l=await di(a,u.astFormat);n.printer=l;let c=a.defaultOptions?Object.fromEntries(Object.entries(a.defaultOptions).filter(([,p])=>p!==void 0)):{},f={...i,...c};for(let[p,d]of Object.entries(f))(n[p]===null||n[p]===void 0)&&(n[p]=d);return n.parser==="json"&&(n.trailingComma="none"),pi(n,s,{passThrough:Object.keys(Ut),...t})}var ce=hi,mi=Qr(rn());async function gi(e,t){let r=await gt(t),n=r.preprocess?r.preprocess(e,t):e;t.originalText=n;let s;try{s=await r.parse(n,t,t);}catch(i){Fi(i,e);}return {text:n,ast:s}}function Fi(e,t){let{loc:r}=e;if(r){let n=(0, mi.codeFrameColumns)(t,r,{highlightCode:true});throw e.message+=`
|
|
37
|
+
`+n,e.codeFrame=n,e}throw e}var Fe=gi;async function Ci(e,t,r,n,s){let{embeddedLanguageFormatting:i,printer:{embed:o,hasPrettierIgnore:u=()=>false,getVisitorKeys:a}}=r;if(!o||i!=="auto")return;if(o.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let l=Ie(o.getVisitorKeys??a),c=[];d();let f=e.stack;for(let{print:D,node:h,pathStack:m}of c)try{e.stack=m;let g=await D(p,t,e,r);g&&s.set(h,g);}catch(g){if(globalThis.PRETTIER_DEBUG)throw g}e.stack=f;function p(D,h){return Ei(D,h,r,n)}function d(){let{node:D}=e;if(D===null||typeof D!="object"||u(e))return;for(let m of l(D))Array.isArray(D[m])?e.each(d,m):e.call(d,m);let h=o(e,r);if(h){if(typeof h=="function"){c.push({print:h,node:D,pathStack:[...e.stack]});return}s.set(D,h);}}}async function Ei(e,t,r,n){let s=await ce({...r,...t,parentParser:r.parser,originalText:e,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:true}),{ast:i}=await Fe(e,s),o=await n(i,s);return sr(o)}function yi(e,t){let{originalText:r,[Symbol.for("comments")]:n,locStart:s,locEnd:i,[Symbol.for("printedComments")]:o}=t,{node:u}=e,a=s(u),l=i(u);for(let c of n)s(c)>=a&&i(c)<=l&&o.add(c);return r.slice(a,l)}var vi=yi;async function je(e,t){({ast:e}=await Nr(e,t));let r=new Map,n=new Yn(e),i=new Map;await Ci(n,u,t,je,i);let o=await Zt(n,t,u,void 0,i);if(Cs(t),t.cursorOffset>=0){if(t.nodeAfterCursor&&!t.nodeBeforeCursor)return [Q,o];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return [o,Q]}return o;function u(l,c){return l===void 0||l===n?a(c):Array.isArray(l)?n.call(()=>a(c),...l):n.call(()=>a(c),l)}function a(l){let c=n.node;if(c==null)return "";let f=c&&typeof c=="object"&&l===void 0;if(f&&r.has(c))return r.get(c);let p=Zt(n,t,u,l,i);return f&&r.set(c,p),p}}function Zt(e,t,r,n,s){var i;let{node:o}=e,{printer:u}=t,a;switch((i=u.hasPrettierIgnore)!=null&&i.call(u,e)?a=vi(e,t):s.has(o)?a=s.get(o):a=u.print(e,t,r,n),o){case t.cursorNode:a=Be(a,l=>[Q,l,Q]);break;case t.nodeBeforeCursor:a=Be(a,l=>[l,Q]);break;case t.nodeAfterCursor:a=Be(a,l=>[Q,l]);break}return u.printComment&&(!u.willPrintOwnComments||!u.willPrintOwnComments(e,t))&&(a=Fs(e,a,t)),a}async function Nr(e,t){let r=e.comments??[];t[Symbol.for("comments")]=r,t[Symbol.for("printedComments")]=new Set,ps(e,t);let{printer:{preprocess:n}}=t;return e=n?await n(e,t):e,{ast:e,comments:r}}function bi(e,t){let{cursorOffset:r,locStart:n,locEnd:s}=t,i=Ie(t.printer.getVisitorKeys),o=d=>n(d)<=r&&s(d)>=r,u=e,a=[e];for(let d of ts(e,{getVisitorKeys:i,filter:o}))a.push(d),u=d;if(rs(u,{getVisitorKeys:i}))return {cursorNode:u};let l,c,f=-1,p=Number.POSITIVE_INFINITY;for(;a.length>0&&(l===void 0||c===void 0);){u=a.pop();let d=l!==void 0,D=c!==void 0;for(let h of Re(u,{getVisitorKeys:i})){if(!d){let m=s(h);m<=r&&m>f&&(l=h,f=m);}if(!D){let m=n(h);m>=r&&m<p&&(c=h,p=m);}}}return {nodeBeforeCursor:l,nodeAfterCursor:c}}var Pr=bi;function Si(e,t){let{printer:{massageAstNode:r,getVisitorKeys:n}}=t;if(!r)return e;let s=Ie(n),i=r.ignoredProperties??new Set;return o(e);function o(u,a){if(!(u!==null&&typeof u=="object"))return u;if(Array.isArray(u))return u.map(p=>o(p,a)).filter(Boolean);let l={},c=new Set(s(u));for(let p in u)!Object.prototype.hasOwnProperty.call(u,p)||i.has(p)||(c.has(p)?l[p]=o(u[p],u):l[p]=u[p]);let f=r(u,l,a);if(f!==null)return f??l}}var xi=Si,ki=(e,t,r)=>{if(!(e&&t==null)){if(t.findLastIndex)return t.findLastIndex(r);for(let n=t.length-1;n>=0;n--){let s=t[n];if(r(s,n,t))return n}return -1}},wi=ki,Ai=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";function Bi(e,t){let r=[e.node,...e.parentNodes],n=new Set([t.node,...t.parentNodes]);return r.find(s=>Tr.has(s.type)&&n.has(s))}function Ht(e){let t=wi(false,e,r=>r.type!=="Program"&&r.type!=="File");return t===-1?e:e.slice(0,t+1)}function $i(e,t,{locStart:r,locEnd:n}){let s=e.node,i=t.node;if(s===i)return {startNode:s,endNode:i};let o=r(e.node);for(let a of Ht(t.parentNodes))if(r(a)>=o)i=a;else break;let u=n(t.node);for(let a of Ht(e.parentNodes)){if(n(a)<=u)s=a;else break;if(s===i)break}return {startNode:s,endNode:i}}function st(e,t,r,n,s=[],i){let{locStart:o,locEnd:u}=r,a=o(e),l=u(e);if(!(t>l||t<a||i==="rangeEnd"&&t===a||i==="rangeStart"&&t===l)){for(let c of ht(e,r)){let f=st(c,t,r,n,[e,...s],i);if(f)return f}if(!n||n(e,s[0]))return {node:e,parentNodes:s}}}function Oi(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"))}var Tr=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),Ni=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function Kt(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 Oi(t.type,r?.type);case "json":case "json5":case "jsonc":case "json-stringify":return Tr.has(t.type);case "graphql":return Ni.has(t.kind);case "vue":return t.tag!=="root"}return false}function Pi(e,t,r){let{rangeStart:n,rangeEnd:s,locStart:i,locEnd:o}=t;rt.ok(s>n);let u=e.slice(n,s).search(/\S/u),a=u===-1;if(!a)for(n+=u;s>n&&!/\S/u.test(e[s-1]);--s);let l=st(r,n,t,(d,D)=>Kt(t,d,D),[],"rangeStart"),c=a?l:st(r,s,t,d=>Kt(t,d),[],"rangeEnd");if(!l||!c)return {rangeStart:0,rangeEnd:0};let f,p;if(Ai(t)){let d=Bi(l,c);f=d,p=d;}else ({startNode:f,endNode:p}=$i(l,c,t));return {rangeStart:Math.min(i(f),i(p)),rangeEnd:Math.max(o(f),o(p))}}var Vr="\uFEFF",Xt=Symbol("cursor");async function Wr(e,t,r=0){if(!e||e.trim().length===0)return {formatted:"",cursorOffset:-1,comments:[]};let{ast:n,text:s}=await Fe(e,t);t.cursorOffset>=0&&(t={...t,...Pr(n,t)});let i=await je(n,t);r>0&&(i=pr([ee,i],r,t.tabWidth));let o=We(i,t);if(r>0){let a=o.formatted.trim();o.cursorNodeStart!==void 0&&(o.cursorNodeStart-=o.formatted.indexOf(a),o.cursorNodeStart<0&&(o.cursorNodeStart=0,o.cursorNodeText=o.cursorNodeText.trimStart()),o.cursorNodeStart+o.cursorNodeText.length>a.length&&(o.cursorNodeText=o.cursorNodeText.trimEnd())),o.formatted=a+ut(t.endOfLine);}let u=t[Symbol.for("comments")];if(t.cursorOffset>=0){let a,l,c,f;if((t.cursorNode||t.nodeBeforeCursor||t.nodeAfterCursor)&&o.cursorNodeText)if(c=o.cursorNodeStart,f=o.cursorNodeText,t.cursorNode)a=t.locStart(t.cursorNode),l=s.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 g=t.nodeAfterCursor?t.locStart(t.nodeAfterCursor):s.length;l=s.slice(a,g);}else a=0,l=s,c=0,f=o.formatted;let p=t.cursorOffset-a;if(l===f)return {formatted:o.formatted,cursorOffset:c+p,comments:u};let d=l.split("");d.splice(p,0,Xt);let D=f.split(""),h=ln(d,D),m=c;for(let g of h)if(g.removed){if(g.value.includes(Xt))break}else m+=g.count;return {formatted:o.formatted,cursorOffset:m,comments:u}}return {formatted:o.formatted,cursorOffset:-1,comments:u}}async function Ti(e,t){let{ast:r,text:n}=await Fe(e,t),{rangeStart:s,rangeEnd:i}=Pi(n,t,r),o=n.slice(s,i),u=Math.min(s,n.lastIndexOf(`
|
|
38
|
+
`,s)+1),a=n.slice(u,s).match(/^\s*/u)[0],l=ft(a,t.tabWidth),c=await Wr(o,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>s&&t.cursorOffset<=i?t.cursorOffset-s:-1,endOfLine:"lf"},l),f=c.formatted.trimEnd(),{cursorOffset:p}=t;p>i?p+=f.length-o.length:c.cursorOffset>=0&&(p=c.cursorOffset+s);let d=n.slice(0,s)+f+n.slice(i);if(t.endOfLine!=="lf"){let D=ut(t.endOfLine);p>=0&&D===`\r
|
|
39
|
+
`&&(p+=rr(d.slice(0,p),`
|
|
40
|
+
`)),d=Pe(false,d,`
|
|
41
|
+
`,D);}return {formatted:d,cursorOffset:p,comments:c.comments}}function Ke(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function Yt(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:s}=t;return r=Ke(e,r,-1),n=Ke(e,n,0),s=Ke(e,s,e.length),{...t,cursorOffset:r,rangeStart:n,rangeEnd:s}}function Rr(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:i}=Yt(e,t),o=e.charAt(0)===Vr;if(o&&(e=e.slice(1),r--,n--,s--),i==="auto"&&(i=cn(e)),e.includes("\r")){let u=a=>rr(e.slice(0,Math.max(a,0)),`\r
|
|
42
|
+
`);r-=u(r),n-=u(n),s-=u(s),e=pn(e);}return {hasBOM:o,text:e,options:Yt(e,{...t,cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:i})}}async function Qt(e,t){let r=await gt(t);return !r.hasPragma||r.hasPragma(e)}async function Vi(e,t){var r;let n=await gt(t);return (r=n.hasIgnorePragma)==null?void 0:r.call(n,e)}async function Ir(e,t){let{hasBOM:r,text:n,options:s}=Rr(e,await ce(t));if(s.rangeStart>=s.rangeEnd&&n!==""||s.requirePragma&&!await Qt(n,s)||s.checkIgnorePragma&&await Vi(n,s))return {formatted:e,cursorOffset:t.cursorOffset,comments:[]};let i;return s.rangeStart>0||s.rangeEnd<n.length?i=await Ti(n,s):(!s.requirePragma&&s.insertPragma&&s.printer.insertPragma&&!await Qt(n,s)&&(n=s.printer.insertPragma(n)),i=await Wr(n,s)),r&&(i.formatted=Vr+i.formatted,i.cursorOffset>=0&&i.cursorOffset++),i}async function Wi(e,t,r){let{text:n,options:s}=Rr(e,await ce(t)),i=await Fe(n,s);return r&&(r.preprocessForPrint&&(i.ast=await Nr(i.ast,s)),r.massage&&(i.ast=xi(i.ast,s))),i}async function Ri(e,t){t=await ce(t);let r=await je(e,t);return We(r,t)}async function Ii(e,t){let r=_n(e),{formatted:n}=await Ir(r,{...t,parser:"__js_expression"});return n}async function ji(e,t){t=await ce(t);let{ast:r}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Pr(r,t)}),je(r,t)}async function Gi(e,t){return We(e,await ce(t))}var jr={};ot(jr,{builders:()=>_i,printer:()=>Mi,utils:()=>Li});var _i={join:cr,line:ar,softline:jn,hardline:ee,literalline:lr,group:or,conditionalGroup:Pn,fill:Tn,lineSuffix:Xe,lineSuffixBoundary:Rn,cursor:Q,breakParent:Ve,ifBreak:Vn,trim:In,indent:Ne,indentIfBreak:Wn,align:le,addAlignmentToDoc:pr,markAsRoot:On,dedentToRoot:$n,dedent:Nn,hardlineWithoutBreakParent:pt,literallineWithoutBreakParent:ur,label:Gn,concat:e=>e},Mi={printDocToString:We},Li={willBreak:En,traverseDoc:at,findInDoc:lt,mapDoc:Te,removeLines:bn,stripTrailingHardline:sr,replaceEndOfLine:kn,canBreak:An},zi="3.6.2",Gr={};ot(Gr,{addDanglingComment:()=>X,addLeadingComment:()=>he,addTrailingComment:()=>me,getAlignmentSize:()=>ft,getIndentSize:()=>Ki,getMaxContinuousCount:()=>Qi,getNextNonSpaceNonCommentCharacter:()=>to,getNextNonSpaceNonCommentCharacterIndex:()=>po,getPreferredQuote:()=>no,getStringWidth:()=>Dt,hasNewline:()=>J,hasNewlineInRange:()=>io,hasSpaces:()=>uo,isNextLineEmpty:()=>mo,isNextLineEmptyAfterIndex:()=>yt,isPreviousLineEmpty:()=>fo,makeString:()=>lo,skip:()=>ge,skipEverythingButNewLine:()=>hr,skipInlineComment:()=>Ft,skipNewline:()=>te,skipSpaces:()=>q,skipToLineEnd:()=>dr,skipTrailingComment:()=>Ct,skipWhitespace:()=>ns});function Ji(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}var Ft=Ji;function qi(e,t){return t===false?false:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?hr(e,t):t}var Ct=qi;function Ui(e,t){let r=null,n=t;for(;n!==r;)r=n,n=q(e,n),n=Ft(e,n),n=Ct(e,n),n=te(e,n);return n}var Et=Ui;function Zi(e,t){let r=null,n=t;for(;n!==r;)r=n,n=dr(e,n),n=Ft(e,n),n=q(e,n);return n=Ct(e,n),n=te(e,n),n!==false&&J(e,n)}var yt=Zi;function Hi(e,t){let r=e.lastIndexOf(`
|
|
43
|
+
`);return r===-1?0:ft(e.slice(r+1).match(/^[\t ]*/u)[0],t)}var Ki=Hi;function Xi(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Yi(e,t){let r=e.match(new RegExp(`(${Xi(t)})+`,"gu"));return r===null?0:r.reduce((n,s)=>Math.max(n,s.length/t.length),0)}var Qi=Yi;function eo(e,t){let r=Et(e,t);return r===false?"":e.charAt(r)}var to=eo,Ae="'",er='"';function ro(e,t){let r=t===true||t===Ae?Ae:er,n=r===Ae?er:Ae,s=0,i=0;for(let o of e)o===r?s++:o===n&&i++;return s>i?n:r}var no=ro;function so(e,t,r){for(let n=t;n<r;++n)if(e.charAt(n)===`
|
|
44
|
+
`)return true;return false}var io=so;function oo(e,t,r={}){return q(e,r.backwards?t-1:t,r)!==t}var uo=oo;function ao(e,t,r){let n=t==='"'?"'":'"',s=Pe(false,e,/\\(.)|(["'])/gsu,(i,o,u)=>o===n?o:u===t?"\\"+u:u||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(o)?o:"\\"+o));return t+s+t}var lo=ao;function co(e,t,r){return Et(e,r(t))}function po(e,t){return arguments.length===2||typeof t=="number"?Et(e,t):co(...arguments)}function Do(e,t,r){return mt(e,r(t))}function fo(e,t){return arguments.length===2||typeof t=="number"?mt(e,t):Do(...arguments)}function ho(e,t,r){return yt(e,r(t))}function mo(e,t){return arguments.length===2||typeof t=="number"?yt(e,t):ho(...arguments)}function Y(e,t=1){return async(...r)=>{let n=r[t]??{},s=n.plugins??[];return r[t]={...n,plugins:Array.isArray(s)?s:Object.values(s)},e(...r)}}var _r=Y(Ir);async function pe(e,t){let{formatted:r}=await _r(e,{...t,cursorOffset:-1});return r}async function go(e,t){return await pe(e,t)===e}var Fo=Y(yr,0),Co={parse:Y(Wi),formatAST:Y(Ri),formatDoc:Y(Ii),printToDoc:Y(ji),printDocToString:Y(Gi)};var Ge=class extends ie{constructor(r={}){super(r);v(this,"reactOptions");this.reactOptions={...this.options,memo:r.memo??true,forwardRef:r.forwardRef??true,propTypes:r.propTypes??false,defaultProps:r.defaultProps??false,namedExport:r.namedExport??false};}async generate(r){let n=this.getComponentName(),{colorMappings:s,strokeWidthMappings:i,metadata:o}=r,u=this.generateImports(),a=this.generateInterfaces(s,i,o.features),l=this.generateComponent(r),c=this.generateExports(n),f=[u,a,l,c].filter(Boolean).join(`
|
|
45
45
|
|
|
46
|
-
`),p=this.reactOptions.typescript?"tsx":"jsx",
|
|
47
|
-
`)}generateInterfaces(r,n,
|
|
48
|
-
${
|
|
46
|
+
`),p=this.reactOptions.typescript?"tsx":"jsx",d=this.generateFilename(n,p),D;try{D=await pe(f,{parser:p==="tsx"?"typescript":"babel",semi:!0,singleQuote:!0,trailingComma:"es5",tabWidth:2,printWidth:80,bracketSpacing:!0,arrowParens:"avoid"});}catch(h){console.warn("Prettier formatting failed, using unformatted code:",h),D=f;}return {code:D,filename:d,componentName:n,dependencies:this.getDependencies()}}generateImports(){let r=[];if(this.reactOptions.typescript){let n=[];this.reactOptions.forwardRef&&(n.push("Ref"),n.push("forwardRef")),this.reactOptions.memo&&n.push("memo"),n.length>0?r.push(`import React, { ${n.join(", ")} } from 'react';`):r.push("import React from 'react';");}else {let n=[];this.reactOptions.forwardRef&&n.push("forwardRef"),this.reactOptions.memo&&n.push("memo"),n.length>0?r.push(`import React, { ${n.join(", ")} } from 'react';`):r.push("import React from 'react';"),this.reactOptions.propTypes&&r.push("import PropTypes from 'prop-types';");}return r.join(`
|
|
47
|
+
`)}generateInterfaces(r,n,s){return !this.reactOptions.typescript&&!this.reactOptions.propTypes?"":this.reactOptions.typescript?this.generateTypeScriptInterface(r,n,s):this.generatePropTypes(r,n,s)}generateTypeScriptInterface(r,n,s){let i=["title?: string;","titleId?: string;","desc?: string;","descId?: string;","size?: string;"],o=this.generateColorProps(r);o&&i.push(o);let u=this.generateStrokeWidthProps(n);return u&&i.push(u),s.includes("fixed-stroke-width")&&i.push("isFixedStrokeWidth?: boolean;"),`interface ${this.getComponentName()}Props extends React.SVGProps<SVGSVGElement> {
|
|
48
|
+
${i.join(`
|
|
49
49
|
`)}
|
|
50
|
-
}`}generatePropTypes(r,n,
|
|
50
|
+
}`}generatePropTypes(r,n,s){let i=this.getComponentName(),o=["title: PropTypes.string,","titleId: PropTypes.string,","desc: PropTypes.string,","descId: PropTypes.string,","size: PropTypes.string,","className: PropTypes.string,","style: PropTypes.object,","width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),","height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),"],u=this.generateColorProps(r);u&&o.push(u);let a=this.generateStrokeWidthProps(n);return a&&o.push(a),s.includes("fixed-stroke-width")&&o.push("isFixedStrokeWidth: PropTypes.bool,"),`${i}.propTypes = {
|
|
51
51
|
${o.join(`
|
|
52
52
|
`)}
|
|
53
|
-
};`}generateComponent(r){let n=this.getComponentName(),{colorMappings:
|
|
54
|
-
${p.filter(
|
|
53
|
+
};`}generateComponent(r){let n=this.getComponentName(),{colorMappings:s,strokeWidthMappings:i,metadata:o}=r,u=["title","titleId","desc","descId","size"],a=s.map(S=>S.variableName),l=s.map(S=>`${S.variableName}Class`),c=i.map(S=>S.variableName),f=i.map(S=>`${S.variableName}Class`),p=[...u,...a,...l,...c,...f],d=this.generateColorDefaults(s),D=this.generateStrokeWidthDefaults(i),h='size = "20"',m=o.features.includes("fixed-stroke-width")?"isFixedStrokeWidth = true":"",g=[h,d,D,m].filter(Boolean).join(", "),E=g.split(", ").map(S=>S.split(" = ")[0]),y=`{
|
|
54
|
+
${p.filter(S=>!E.includes(S)).join(`,
|
|
55
55
|
`)},
|
|
56
|
-
${
|
|
56
|
+
${g},
|
|
57
57
|
...svgProps
|
|
58
|
-
}`,
|
|
59
|
-
`);return `const ${n} = (${
|
|
58
|
+
}`,C=this.generateSvgAttributes(r.ast),b="{title ? <title id={titleId}>{title}</title> : null}",O="{desc ? <desc id={descId}>{desc}</desc> : null}";if(this.reactOptions.typescript){let S=`${n}Props`,H=this.reactOptions.forwardRef?", ref: Ref<SVGSVGElement>":"",Me=r.ast.root.children.map(De=>this.elementToJsx(De,1)).join(`
|
|
59
|
+
`);return `const ${n} = (${y}: ${S}${H}) => {
|
|
60
60
|
const computedSize = size ? { width: size, height: size } : {};
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
63
|
<svg
|
|
64
64
|
${this.reactOptions.forwardRef?`ref={ref}
|
|
65
|
-
`:""}${
|
|
65
|
+
`:""}${C}
|
|
66
66
|
{...computedSize}
|
|
67
67
|
{...svgProps}
|
|
68
68
|
>
|
|
69
|
-
${
|
|
70
|
-
${
|
|
71
|
-
${
|
|
69
|
+
${b}
|
|
70
|
+
${O}
|
|
71
|
+
${Me}
|
|
72
72
|
</svg>
|
|
73
73
|
);
|
|
74
|
-
};`}else {let
|
|
75
|
-
`);return `const ${n} = (${
|
|
74
|
+
};`}else {let S=r.ast.root.children.map(H=>this.elementToJsx(H,1)).join(`
|
|
75
|
+
`);return `const ${n} = (${y}) => {
|
|
76
76
|
const computedSize = size ? { width: size, height: size } : {};
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
<svg ${
|
|
80
|
-
${
|
|
81
|
-
${
|
|
82
|
-
${
|
|
79
|
+
<svg ${C}{...computedSize} {...svgProps}>
|
|
80
|
+
${b}
|
|
81
|
+
${O}
|
|
82
|
+
${S}
|
|
83
83
|
</svg>
|
|
84
84
|
);
|
|
85
85
|
};`}}generateExports(r){let n=[];return this.reactOptions.forwardRef?(n.push(`const ForwardRef = forwardRef(${r});`),this.reactOptions.memo?(n.push("const Memo = memo(ForwardRef);"),this.reactOptions.exportDefault&&n.push("export default Memo;"),this.reactOptions.namedExport&&n.push(`export { Memo as ${r} };`)):(this.reactOptions.exportDefault&&n.push("export default ForwardRef;"),this.reactOptions.namedExport&&n.push(`export { ForwardRef as ${r} };`))):this.reactOptions.memo?(n.push(`const Memo = memo(${r});`),this.reactOptions.exportDefault&&n.push("export default Memo;"),this.reactOptions.namedExport&&n.push(`export { Memo as ${r} };`)):(this.reactOptions.exportDefault&&n.push(`export default ${r};`),this.reactOptions.namedExport&&n.push(`export { ${r} };`)),n.join(`
|
|
86
|
-
`)}getDependencies(){let r=["react"];return this.reactOptions.propTypes&&r.push("prop-types"),r}generateSvgAttributes(r){let n=[],
|
|
86
|
+
`)}getDependencies(){let r=["react"];return this.reactOptions.propTypes&&r.push("prop-types"),r}generateSvgAttributes(r){let n=[],s=r.root.attributes?.viewBox||r.viewBox;s&&n.push(`viewBox="${s}"`);let i=r.root.attributes?.xmlns||r.namespace;if(i&&n.push(`xmlns="${i}"`),!s){let o=r.root.attributes?.width||r.width,u=r.root.attributes?.height||r.height;o&&n.push(`width="${o}"`),u&&n.push(`height="${u}"`);}return n.length>0?n.join(`
|
|
87
87
|
`)+`
|
|
88
|
-
`:""}elementToJsx(r,n=0){let
|
|
89
|
-
`,
|
|
90
|
-
`),
|
|
91
|
-
`+
|
|
88
|
+
`:""}elementToJsx(r,n=0){let s=" ".repeat(n+1),{tag:i,attributes:o,children:u,content:a}=r,l=this.attributesToJsxWithClasses(o),c=l.length>0?" "+l.join(" "):"";if(u.length===0&&!a)return `${s}<${i}${c} />`;let f=`${s}<${i}${c}>`;return a&&(f+=a),u.length>0&&(f+=`
|
|
89
|
+
`,f+=u.map(p=>this.elementToJsx(p,n+1)).join(`
|
|
90
|
+
`),f+=`
|
|
91
|
+
`+s),f+=`</${i}>`,f}attributesToJsxWithClasses(r){let n=[],s=[],i="class"in r||"className"in r;if(Object.entries(r).forEach(([o,u])=>{let a=vt(o);if(o==="vector-effect"&&u==="non-scaling-stroke")n.push("vectorEffect={isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'}");else if((o==="fill"||o==="stroke")&&u.startsWith("{")&&u.endsWith("}")){let l=u.slice(1,-1);n.push(`${a}=${u}`);let c=`${l}Class`;s.push(c);}else if(o==="stroke-width"&&u.startsWith("{")&&u.endsWith("}")){let l=u.slice(1,-1);n.push(`${a}=${u}`);let c=`${l}Class`;s.push(c);}else if(o==="style"){let l=this.parseStyleString(u),c=Object.entries(l).map(([f,p])=>{if(typeof p=="string"&&p.startsWith("{")&&p.endsWith("}")){let d=p.slice(1,-1);if(f==="strokeWidth"){let D=`${d}Class`;s.push(D);}return `${f}: ${d}`}else return `${f}: '${p}'`});n.push(`style={{ ${c.join(", ")} }}`);}else u.startsWith("{")&&u.endsWith("}")?n.push(`${a}=${u}`):n.push(`${a}="${u}"`);}),s.length>0){let o=r.class||r.className;if(s.length===1)o?n.push(`className={\`${o} \${${s[0]}}\`}`):n.push(`className={${s[0]}}`);else {let u=s.map(a=>`\${${a}}`).join(" ");o?n.push(`className={\`${o} ${u}\`}`):n.push(`className={\`${u}\`}`);}}else if(i){let o=r.class||r.className;o&&n.push(`className="${o}"`);}return n}parseStyleString(r){let n={};return r.split(";").forEach(s=>{let i=s.indexOf(":");if(i>0){let o=s.slice(0,i).trim(),u=s.slice(i+1).trim();if(o&&u){let a=Le(o);n[a]=u;}}}),n}};var _e=class extends ie{constructor(r={}){super(r);v(this,"vueOptions");this.vueOptions={...this.options,composition:r.composition??true,scriptSetup:r.scriptSetup??true,sfc:r.sfc??true,defineComponent:r.defineComponent??false};}async generate(r){let n=this.getComponentName(),s;this.vueOptions.sfc?s=this.generateSFC(r):s=this.generateJSComponent(r);let i=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"ts":"js",o=this.generateFilename(n,i),u;try{let a=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"typescript":"babel";u=await pe(s,{parser:a,semi:!0,singleQuote:!0,trailingComma:"es5",tabWidth:2,printWidth:80,bracketSpacing:!0,arrowParens:"avoid",htmlWhitespaceSensitivity:"ignore",vueIndentScriptAndStyle:!0});}catch(a){console.warn("Prettier formatting failed, using unformatted code:",a),u=s;}return {code:u,filename:o,componentName:n,dependencies:this.getDependencies()}}generateSFC(r){let n=this.generateTemplate(r),s=this.generateScript(r),i=this.generateStyle();return `<template>
|
|
92
92
|
${n}
|
|
93
93
|
</template>
|
|
94
94
|
|
|
95
95
|
<script${this.vueOptions.scriptSetup?" setup":""}${this.vueOptions.typescript?' lang="ts"':""}>
|
|
96
96
|
${this.vueOptions.scriptSetup?`defineOptions({ inheritAttrs: false });
|
|
97
97
|
|
|
98
|
-
`:""}${
|
|
98
|
+
`:""}${s}
|
|
99
99
|
<\/script>
|
|
100
100
|
|
|
101
|
-
${
|
|
102
|
-
${
|
|
103
|
-
</style>`:""}`}generateJSComponent(r){return this.vueOptions.composition?this.generateCompositionAPI(r):this.generateOptionsAPI(r)}generateTemplate(r){let{ast:n}=r,
|
|
104
|
-
`);return ` <svg${
|
|
101
|
+
${i?`<style scoped>
|
|
102
|
+
${i}
|
|
103
|
+
</style>`:""}`}generateJSComponent(r){return this.vueOptions.composition?this.generateCompositionAPI(r):this.generateOptionsAPI(r)}generateTemplate(r){let{ast:n}=r,s=this.generateSvgAttributes(n),i=n.root.children.map(o=>this.elementToVueTemplate(o,2)).join(`
|
|
104
|
+
`);return ` <svg${s} v-bind="$attrs" :width="props.size || undefined" :height="props.size || undefined">
|
|
105
105
|
<title v-if="props.title" :id="props.titleId">{{ props.title }}</title>
|
|
106
106
|
<desc v-if="props.desc" :id="props.descId">{{ props.desc }}</desc>
|
|
107
|
-
${
|
|
108
|
-
</svg>`}elementToVueTemplate(r,n=0){let
|
|
109
|
-
`,
|
|
110
|
-
`),
|
|
111
|
-
`+
|
|
112
|
-
`)}generateCompositionAPI(r){let{colorMappings:n,strokeWidthMappings:
|
|
113
|
-
`)}generateOptionsAPI(r){let{colorMappings:n,strokeWidthMappings:
|
|
114
|
-
`)}generateStyle(){return ""}generateColorPropsInterface(r){return r.length===0?"":r.map(n=>{let
|
|
115
|
-
${
|
|
116
|
-
`)}generateStrokeWidthPropsInterface(r){return r.length===0?"":r.map(n=>{let
|
|
117
|
-
${
|
|
118
|
-
`)}parseStyleStringForVue(r){let n=[];return r.split(";").forEach(
|
|
119
|
-
`);for(let u=0;u<o.length;u++){let a=o[u].trim();if(/^[a-zA-Z-]+\s*=\s*"/.test(a)){let l=false;for(let c=u-1;c>=0;c--){let
|
|
107
|
+
${i}
|
|
108
|
+
</svg>`}elementToVueTemplate(r,n=0){let s=" ".repeat(n),{tag:i,attributes:o,children:u,content:a}=r,l=[],c=[],f="class"in o;if(Object.entries(o).forEach(([D,h])=>{if(D==="vector-effect"&&h==="non-scaling-stroke")l.push(`:vector-effect="props.isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'"`);else if(D==="style"){let m=this.parseStyleStringForVue(h);l.push(`:style="${m}"`);let g=this.extractClassVarsFromStyle(h);c.push(...g);}else if(h.startsWith("{")&&h.endsWith("}")){let m=h.slice(1,-1);if(l.push(`:${D}="props.${m}"`),D==="fill"||D==="stroke"||D==="stroke-width"){let g=`${m}Class`;c.push(`props.${g}`);}}else l.push(`${D}="${h}"`);}),c.length>0){let D=o.class;D?l.push(`:class="[${c.join(", ")}, '${D}']"`):l.push(`:class="[${c.join(", ")}]"`);}else if(f){let D=o.class;D&&l.push(`class="${D}"`);}let p=l.length>0?" "+l.join(" "):"";if(u.length===0&&!a)return `${s}<${i}${p} />`;let d=`${s}<${i}${p}>`;return a&&(d+=a),u.length>0&&(d+=`
|
|
109
|
+
`,d+=u.map(D=>this.elementToVueTemplate(D,n+1)).join(`
|
|
110
|
+
`),d+=`
|
|
111
|
+
`+s),d+=`</${i}>`,d}generateScript(r){return this.vueOptions.scriptSetup?this.generateScriptSetup(r):this.vueOptions.composition?this.generateCompositionAPI(r):this.generateOptionsAPI(r)}generateScriptSetup(r){let{colorMappings:n,strokeWidthMappings:s,metadata:i}=r,o=[];if(this.vueOptions.typescript&&(o.push('import type { SVGAttributes } from "vue";'),o.push("")),this.vueOptions.typescript){o.push("interface Props extends /* @vue-ignore */ SVGAttributes {"),o.push(" title?: string;"),o.push(" titleId?: string;"),o.push(" desc?: string;"),o.push(" descId?: string;"),o.push(" size?: string;");let u=this.generateColorPropsInterface(n);u&&o.push(u);let a=this.generateStrokeWidthPropsInterface(s);a&&o.push(a),i.features.includes("fixed-stroke-width")&&o.push(" isFixedStrokeWidth?: boolean;"),o.push("}"),o.push(""),o.push("const props = withDefaults(defineProps<Props>(), {");}else o.push("const props = defineProps({"),o.push(" title: { type: String, default: '' },"),o.push(" titleId: { type: String, default: '' },"),o.push(" desc: { type: String, default: '' },"),o.push(" descId: { type: String, default: '' },"),o.push(" class: { type: String, default: '' },"),o.push(" style: { type: Object, default: '' },"),o.push(" width: { type: [String, Number], default: '' },"),o.push(" height: { type: [String, Number], default: '' },"),o.push(' size: { type: String, default: "20" },');return this.vueOptions.typescript&&o.push(' size: "20",'),n.forEach(u=>{let a=u.variableName,l=u.originalColor,c=`${a}Class`;this.vueOptions.typescript?(o.push(` ${a}: '${l}',`),o.push(` ${c}: ""`)):(o.push(` ${a}: { type: String, default: '${l}' },`),o.push(` ${c}: { type: String, default: "" },`));}),s.forEach(u=>{let a=u.variableName,l=u.originalStrokeWidth,c=`${a}Class`;this.vueOptions.typescript?(o.push(` ${a}: '${l}',`),o.push(` ${c}: ""`)):(o.push(` ${a}: { type: [String, Number], default: '${l}' },`),o.push(` ${c}: { type: String, default: "" },`));}),i.features.includes("fixed-stroke-width")&&(this.vueOptions.typescript?o.push(" isFixedStrokeWidth: true,"):o.push(" isFixedStrokeWidth: { type: Boolean, default: true },")),o.push("});"),o.join(`
|
|
112
|
+
`)}generateCompositionAPI(r){let{colorMappings:n,strokeWidthMappings:s,metadata:i}=r,o=this.getComponentName(),u=[];return u.push("import { defineComponent } from 'vue';"),u.push(""),u.push("export default defineComponent({"),u.push(` name: '${o}',`),u.push(" props: {"),u.push(" title: { type: String, default: '' },"),u.push(" titleId: { type: String, default: '' },"),u.push(" desc: { type: String, default: '' },"),u.push(" descId: { type: String, default: '' },"),u.push(" class: { type: String, default: '' },"),u.push(" style: { type: Object, default: '' },"),u.push(" width: { type: [String, Number], default: '' },"),u.push(" height: { type: [String, Number], default: '' },"),n.forEach(a=>{let l=a.variableName,c=a.originalColor,f=`${l}Class`;u.push(` ${l}: { type: String, default: '${c}' },`),u.push(` ${f}: { type: String, default: "" },`);}),s.forEach(a=>{let l=a.variableName,c=a.originalStrokeWidth,f=`${l}Class`;u.push(` ${l}: { type: [String, Number], default: '${c}' },`),u.push(` ${f}: { type: String, default: "" },`);}),i.features.includes("fixed-stroke-width")&&u.push(" isFixedStrokeWidth: { type: Boolean, default: true },"),u.push(" },"),u.push(" setup() {"),u.push(" return {};"),u.push(" },"),u.push("});"),u.join(`
|
|
113
|
+
`)}generateOptionsAPI(r){let{colorMappings:n,strokeWidthMappings:s,metadata:i}=r,o=this.getComponentName(),u=[];return u.push("export default {"),u.push(` name: '${o}',`),u.push(" props: {"),u.push(" title: { type: String, default: '' },"),u.push(" titleId: { type: String, default: '' },"),u.push(" desc: { type: String, default: '' },"),u.push(" descId: { type: String, default: '' },"),u.push(" class: { type: String, default: '' },"),u.push(" style: { type: Object, default: '' },"),u.push(" width: { type: [String, Number], default: '' },"),u.push(" height: { type: [String, Number], default: '' },"),n.forEach(a=>{let l=a.variableName,c=a.originalColor,f=`${l}Class`;u.push(` ${l}: { type: String, default: '${c}' },`),u.push(` ${f}: { type: String, default: "" },`);}),s.forEach(a=>{let l=a.variableName,c=a.originalStrokeWidth,f=`${l}Class`;u.push(` ${l}: { type: [String, Number], default: '${c}' },`),u.push(` ${f}: { type: String, default: "" },`);}),i.features.includes("fixed-stroke-width")&&u.push(" isFixedStrokeWidth: { type: Boolean, default: true },"),u.push(" },"),u.push("};"),u.join(`
|
|
114
|
+
`)}generateStyle(){return ""}generateColorPropsInterface(r){return r.length===0?"":r.map(n=>{let s=n.variableName,i=`${s}Class`;return ` ${s}?: string;
|
|
115
|
+
${i}?: string;`}).join(`
|
|
116
|
+
`)}generateStrokeWidthPropsInterface(r){return r.length===0?"":r.map(n=>{let s=n.variableName,i=`${s}Class`;return ` ${s}?: string | number;
|
|
117
|
+
${i}?: string;`}).join(`
|
|
118
|
+
`)}parseStyleStringForVue(r){let n=[];return r.split(";").forEach(s=>{let i=s.indexOf(":");if(i>0){let o=s.slice(0,i).trim(),u=s.slice(i+1).trim();if(o&&u)if(u.startsWith("{")&&u.endsWith("}")){let a=u.slice(1,-1);n.push(`'${o}': props.${a}`);}else n.push(`'${o}': '${u}'`);}}),`{ ${n.join(", ")} }`}generateSvgAttributes(r){let n=[],s=r.root.attributes?.viewBox||r.viewBox;s&&n.push(` viewBox="${s}"`);let i=r.root.attributes?.xmlns||r.namespace||"http://www.w3.org/2000/svg";if(n.push(` xmlns="${i}"`),!s){let o=r.root.attributes?.width||r.width,u=r.root.attributes?.height||r.height;o&&n.push(` width="${o}"`),u&&n.push(` height="${u}"`);}return n.join("")}getDependencies(){return ["vue"]}extractClassVarsFromStyle(r){let n=[];return r.split(";").forEach(s=>{let i=s.indexOf(":");if(i>0){let o=s.slice(0,i).trim(),u=s.slice(i+1).trim();if(o&&u&&u.startsWith("{")&&u.endsWith("}")){let a=u.slice(1,-1);if(o==="fill"||o==="stroke"||o==="stroke-width"){let l=`props.${a}Class`;n.push(l);}}}}),n}};var Ce=class{constructor(){v(this,"parser");v(this,"transformer");this.parser=new Ee,this.transformer=new xe;}async convert(t,r){try{let n=this.parser.parse(t),s=this.transformer.transform(n,r.transformation),i;return r.framework==="react"?i=new Ge(r.generator):i=new _e(r.generator),{...await i.generate(s),metadata:s.metadata}}catch(n){throw new Error(`SVG conversion failed: ${n instanceof Error?n.message:String(n)}`)}}extractColors(t){let r=this.parser.parse(t),n=this.parser.extractColors(r);return Array.from(new Set(n.map(s=>s.value))).sort()}validate(t){let r=[];try{let n=this.parser.parse(t);n.root||r.push("No root SVG element found"),!n.viewBox&&!n.width&&!n.height&&r.push("SVG should have viewBox or width/height attributes");}catch(n){r.push(n instanceof Error?n.message:String(n));}return {valid:r.length===0,errors:r}}};var se=class{constructor(){v(this,"engine");this.engine=new Ce;}async convert(t,r){let{framework:n,typescript:s=true,componentName:i="Icon",prefix:o,suffix:u,splitColors:a=false,splitStrokeWidths:l=false,fixedStrokeWidth:c=false,memo:f=true,forwardRef:p=true,sfc:d=true,scriptSetup:D=true,optimize:h=true}=r,m={framework:n,transformation:{splitColors:a,splitStrokeWidths:l,fixedStrokeWidth:c,optimize:h},generator:n==="react"?{typescript:s,componentName:i,prefix:o,suffix:u,memo:f,forwardRef:p,exportDefault:true,namedExport:false}:{typescript:s,componentName:i,prefix:o,suffix:u,sfc:d,scriptSetup:D,composition:true,exportDefault:true}},g=await this.engine.convert(t,m);return {code:g.code,componentName:g.componentName,filename:g.filename,framework:n,typescript:s,metadata:g.metadata,dependencies:g.dependencies}}extractColors(t){return this.engine.extractColors(t)}validate(t){let r=[],n=t.trim();if(!n)return {valid:false,errors:["SVG content is empty"]};if(!n.includes("<svg"))return {valid:false,errors:["No <svg> element found"]};if(typeof DOMParser<"u"){let o=new DOMParser().parseFromString(n,"application/xml").querySelector("parsererror");if(o)return r.push("Invalid XML/SVG structure: "+(o.textContent?.trim()||"XML parsing failed")),{valid:false,errors:r};this.validateXMLStructure(n,r);}else this.validateWithRegex(n,r);return {valid:r.length===0,errors:r}}validateXMLStructure(t,r){if(/\w+\s*=\s*"[^"]*<[a-zA-Z]/g.test(t)){r.push("Invalid XML/SVG structure: Malformed attribute syntax");return}if(/\w+\s*=\s*"[^"]*"[^>\s]*<[^>]*>/g.test(t)){r.push("Invalid XML/SVG structure: Invalid characters in attributes");return}if(/^\s*[a-zA-Z-]+\s*=\s*"/gm.test(t)){let o=t.split(`
|
|
119
|
+
`);for(let u=0;u<o.length;u++){let a=o[u].trim();if(/^[a-zA-Z-]+\s*=\s*"/.test(a)){let l=false;for(let c=u-1;c>=0;c--){let f=o[c].trim();if(f.includes("<svg")||f.includes("<")&&f.includes("=")){l=true;break}if(f.includes("</")||f.includes("/>"))break}if(!l){r.push("Invalid XML/SVG structure: Malformed tag structure");return}}}}}validateWithRegex(t,r){this.validateXMLStructure(t,r);}async convertBatch(t,r){let n=[];for(let{content:s,name:i}of t){let o=await this.convert(s,{...r,componentName:i});n.push(o);}return n}generateIndexFile(t,r={}){let{exportType:n="named",typescript:s=true}=r,i=t[0]?.framework||"react",o=[...t].sort((a,l)=>a.componentName.localeCompare(l.componentName)),u="";if(n==="named"){u+=`// Auto-generated index file for tree-shaking
|
|
120
120
|
`,u+=`// This file exports all components for optimal bundling
|
|
121
121
|
|
|
122
|
-
`;for(let a of o){let l=this.getImportPath(a.filename,
|
|
123
|
-
`;}if(
|
|
122
|
+
`;for(let a of o){let l=this.getImportPath(a.filename,i);u+=`export { default as ${a.componentName} } from './${l}';
|
|
123
|
+
`;}if(s){u+=`
|
|
124
124
|
// TypeScript component types
|
|
125
|
-
`,
|
|
125
|
+
`,i==="vue"?u+=`export type IconComponent = any;
|
|
126
126
|
`:u+=`export type IconComponent = React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
127
127
|
`,u+=`export type IconComponents = {
|
|
128
128
|
`;for(let a of o)u+=` ${a.componentName}: IconComponent;
|
|
@@ -130,12 +130,12 @@ ${s}
|
|
|
130
130
|
`;}}else {u+=`// Auto-generated index file
|
|
131
131
|
`,u+=`// Warning: Default exports are less tree-shakeable
|
|
132
132
|
|
|
133
|
-
`;for(let a of o){let l=this.getImportPath(a.filename,
|
|
133
|
+
`;for(let a of o){let l=this.getImportPath(a.filename,i);u+=`import ${a.componentName} from './${l}';
|
|
134
134
|
`;}u+=`
|
|
135
135
|
export default {
|
|
136
136
|
`;for(let a of o)u+=` ${a.componentName},
|
|
137
137
|
`;u+=`};
|
|
138
138
|
`,u+=`
|
|
139
139
|
// Individual exports for flexibility
|
|
140
|
-
`;for(let a of o)u+=`export { default as ${a.componentName} } from './${this.getImportPath(a.filename,
|
|
141
|
-
`;}return u}getImportPath(t,r){return r==="vue"&&t.endsWith(".vue")?t:t.replace(/\.(tsx?|jsx?|vue)$/,"")}};async function Vu(e,t={}){return new
|
|
140
|
+
`;for(let a of o)u+=`export { default as ${a.componentName} } from './${this.getImportPath(a.filename,i)}';
|
|
141
|
+
`;}return u}getImportPath(t,r){return r==="vue"&&t.endsWith(".vue")?t:t.replace(/\.(tsx?|jsx?|vue)$/,"")}};async function Vu(e,t={}){return new se().convert(e,{...t,framework:"react"})}async function Wu(e,t={}){return new se().convert(e,{...t,framework:"vue"})}async function Ru(e,t){return new se().convertBatch(e,t)}function Iu(e){return new se().extractColors(e)}function ju(e){return new se().validate(e)}export{Ce as SVGFusion,se as SVGFusionBrowser,Ru as convertBatch,Vu as convertToReact,Wu as convertToVue,Iu as extractColors,St as formatComponentName,ke as pascalCase,bt as sanitizeComponentName,ze as svgToComponentName,ju as validateSvg};
|