svgfusion 1.22.0 → 1.23.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/README.md +35 -23
- package/dist/browser.d.mts +1 -0
- package/dist/browser.mjs +45 -45
- package/dist/cli.js +56 -39
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ A powerful Node.js CLI tool and library that converts SVG files into optimized R
|
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
|
+
**Advanced Transformations**: Comprehensive transformation options including color splitting, stroke width extraction, fixed stroke width, and fill/stroke normalization
|
|
21
22
|
**Stroke Width Splitting**: Extract and convert stroke widths to props for responsive design
|
|
22
23
|
**Browser API**: Use SVGFusion directly in the browser with full feature support
|
|
23
24
|
**Smart Component Naming**: Automatic prefix/suffix handling with proper PascalCase conversion
|
|
@@ -30,25 +31,6 @@ A powerful Node.js CLI tool and library that converts SVG files into optimized R
|
|
|
30
31
|
**Production Ready**: Optimized output, error handling, and accessibility
|
|
31
32
|
**Simple CLI**: Direct, intuitive command structure
|
|
32
33
|
|
|
33
|
-
### Stroke Width Splitting
|
|
34
|
-
|
|
35
|
-
Extract stroke widths from SVG elements and convert them to component props for responsive designs:
|
|
36
|
-
|
|
37
|
-
```jsx
|
|
38
|
-
// Original SVG: <path stroke-width="2" d="..."/>
|
|
39
|
-
// Generated React component:
|
|
40
|
-
<MyIcon strokeWidth1={4} /> // Scales the stroke width
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Color Splitting (splitColors)
|
|
44
|
-
|
|
45
|
-
Extracts all unique fill, stroke, and gradient colors from your SVG and generates props for each color and color class. Automatically adds `fill="none"` or `stroke="none"` to prevent unwanted browser defaults:
|
|
46
|
-
|
|
47
|
-
- Path with only fill → gets `stroke="none"`
|
|
48
|
-
- Path with only stroke → gets `fill="none"`
|
|
49
|
-
- Path with both → keeps both as props
|
|
50
|
-
- Path with neither → stays unchanged
|
|
51
|
-
|
|
52
34
|
## Try It Live
|
|
53
35
|
|
|
54
36
|
**Experience SVGFusion instantly in your browser!**
|
|
@@ -68,7 +50,7 @@ npx svgfusion ./icons --output ./components
|
|
|
68
50
|
# Add prefixes, suffixes, and generate index file
|
|
69
51
|
npx svgfusion ./icons --prefix Icon --suffix Component --index
|
|
70
52
|
|
|
71
|
-
# Advanced: Split colors for
|
|
53
|
+
# Advanced: Split colors for Custom CSS Class with fixed stroke width
|
|
72
54
|
npx svgfusion ./icons --split-colors --fixed-stroke-width --prefix Icon
|
|
73
55
|
```
|
|
74
56
|
|
|
@@ -203,7 +185,7 @@ npx svgfusion ./assets/icons --output ./src/components --recursive --index
|
|
|
203
185
|
# Convert with custom naming
|
|
204
186
|
npx svgfusion ./assets/icons --output ./src/components --prefix Icon --suffix Component --index
|
|
205
187
|
|
|
206
|
-
# Advanced: Split colors for
|
|
188
|
+
# Advanced: Split colors for Custom CSS Class compatibility
|
|
207
189
|
npx svgfusion ./assets/icons --output ./src/components --split-colors --prefix Icon
|
|
208
190
|
|
|
209
191
|
# Advanced: Fixed stroke width with split colors
|
|
@@ -409,9 +391,31 @@ const result = await convertToReact(svgContent, {
|
|
|
409
391
|
- Empty attribute values (`fill=""`) are treated as non-existent
|
|
410
392
|
````
|
|
411
393
|
|
|
412
|
-
###
|
|
394
|
+
### Transformation Options
|
|
395
|
+
|
|
396
|
+
SVGFusion provides comprehensive transformation capabilities through the transformation options API:
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
const result = await engine.convert(svgContent, {
|
|
400
|
+
framework: 'react',
|
|
401
|
+
transformation: {
|
|
402
|
+
splitColors: true, // Extract color props
|
|
403
|
+
splitStrokeWidths: true, // Extract stroke width props
|
|
404
|
+
fixedStrokeWidth: true, // Non-scaling stroke support
|
|
405
|
+
normalizeFillStroke: true, // Normalize fill/stroke attributes
|
|
406
|
+
accessibility: true, // Add accessibility features
|
|
407
|
+
optimize: true, // Apply SVG optimizations
|
|
408
|
+
removeComments: true, // Remove XML comments
|
|
409
|
+
removeDuplicates: true, // Remove duplicate elements
|
|
410
|
+
minifyPaths: false, // Minify path data
|
|
411
|
+
},
|
|
412
|
+
generator: { componentName: 'MyIcon', typescript: true },
|
|
413
|
+
});
|
|
414
|
+
```
|
|
413
415
|
|
|
414
|
-
|
|
416
|
+
#### Fixed Stroke Width Support
|
|
417
|
+
|
|
418
|
+
The `fixedStrokeWidth` transformation adds support for non-scaling stroke width:
|
|
415
419
|
|
|
416
420
|
```typescript
|
|
417
421
|
const result = await convertToReact(svgContent, {
|
|
@@ -424,6 +428,14 @@ const result = await convertToReact(svgContent, {
|
|
|
424
428
|
// - vector-effect="non-scaling-stroke" when prop is true
|
|
425
429
|
```
|
|
426
430
|
|
|
431
|
+
#### Fill/Stroke Normalization
|
|
432
|
+
|
|
433
|
+
The `normalizeFillStroke` transformation intelligently handles fill and stroke attributes:
|
|
434
|
+
|
|
435
|
+
- Normalizes attribute values across all SVG elements
|
|
436
|
+
- Ensures consistent color and stroke width application
|
|
437
|
+
- Optimizes attribute inheritance and cascading
|
|
438
|
+
|
|
427
439
|
### Custom SVGO Configuration
|
|
428
440
|
|
|
429
441
|
```typescript
|
package/dist/browser.d.mts
CHANGED
package/dist/browser.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var zr=Object.defineProperty;var Lr=(e,t,r)=>t in e?zr(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var qr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var y=(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){if(typeof DOMParser<"u"){let n=new DOMParser().parseFromString(t,"image/svg+xml");if(n.querySelector("parsererror"))throw new Error("Invalid SVG: XML parsing failed");let i=n.documentElement;if(i.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(i)}try{let{JSDOM:r}=qr("jsdom"),s=new r(t,{contentType:"image/svg+xml"}).window.document.documentElement;if(s.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(s)}catch{return this.parseElementWithRegex(t)}}convertDOMToSVGElement(t){let r={tag:this.preserveSvgTagCase(t.tagName),attributes:{},children:[]};for(let n=0;n<t.attributes.length;n++){let s=t.attributes[n];r.attributes[s.name]=s.value;}for(let n=0;n<t.children.length;n++){let s=t.children[n];r.children.push(this.convertDOMToSVGElement(s));}return t.children.length===0&&t.textContent?.trim()&&(r.content=t.textContent.trim()),r}parseElementWithRegex(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));}preserveSvgTagCase(t){let r=t.toLowerCase();return {clippath:"clipPath",defs:"defs",foreignobject:"foreignObject",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath",use:"use"}[r]||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 ve=class{constructor(t={}){y(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 ye=class{constructor(t={}){y(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={}){y(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={}){y(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{constructor(t){this.options=t;}apply(t){return this.options.enabled?this.normalizeElements(t):t}normalizeElements(t){return t.map(r=>this.transformElement(r,n=>{let s={...n.attributes};if(this.isDrawableElement(n.tag)){let i=n.attributes.fill!==void 0&&n.attributes.fill!=="",o=n.attributes.stroke!==void 0&&n.attributes.stroke!=="";i&&!o&&(s.stroke="none"),o&&!i&&(s.fill="none");}return {...n,attributes:s}}))}transformElement(t,r){let n=r(t);return n.children&&(n.children=n.children.map(s=>this.transformElement(s,r))),n}isDrawableElement(t){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(t)}};var we=class{transform(t,r={}){let{optimize:n=true,splitColors:s=false,splitStrokeWidths:i=false,fixedStrokeWidth:o=false,normalizeFillStroke:u=false,accessibility:a=true,removeComments:l=true,removeDuplicates:c=true,minifyPaths:
|
|
3
|
-
`,c+=o.map(
|
|
1
|
+
var zr=Object.defineProperty;var Lr=(e,t,r)=>t in e?zr(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r;var qr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var y=(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){if(typeof DOMParser<"u"){let n=new DOMParser().parseFromString(t,"image/svg+xml");if(n.querySelector("parsererror"))throw new Error("Invalid SVG: XML parsing failed");let i=n.documentElement;if(i.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(i)}try{let{JSDOM:r}=qr("jsdom"),s=new r(t,{contentType:"image/svg+xml"}).window.document.documentElement;if(s.tagName.toLowerCase()!=="svg")throw new Error("Invalid SVG: No svg element found");return this.convertDOMToSVGElement(s)}catch{return this.parseElementWithRegex(t)}}convertDOMToSVGElement(t){let r={tag:this.preserveSvgTagCase(t.tagName),attributes:{},children:[]};for(let n=0;n<t.attributes.length;n++){let s=t.attributes[n];r.attributes[s.name]=s.value;}for(let n=0;n<t.children.length;n++){let s=t.children[n];r.children.push(this.convertDOMToSVGElement(s));}return t.children.length===0&&t.textContent?.trim()&&(r.content=t.textContent.trim()),r}parseElementWithRegex(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),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,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));}preserveSvgTagCase(t){let r=t.toLowerCase();return {clippath:"clipPath",defs:"defs",foreignobject:"foreignObject",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath",use:"use"}[r]||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 ve=class{constructor(t={}){y(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 ye=class{constructor(t={}){y(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={}){y(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={}){y(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{constructor(t){this.options=t;}apply(t){return this.options.enabled?this.normalizeElements(t):t}normalizeElements(t){return t.map(r=>this.transformElement(r,n=>{let s={...n.attributes};if(this.isDrawableElement(n.tag)){let i=n.attributes.fill!==void 0&&n.attributes.fill!=="",o=n.attributes.stroke!==void 0&&n.attributes.stroke!=="";i&&!o&&(s.stroke="none"),o&&!i&&(s.fill="none");}return {...n,attributes:s}}))}transformElement(t,r){let n=r(t);return n.children&&(n.children=n.children.map(s=>this.transformElement(s,r))),n}isDrawableElement(t){return ["path","circle","ellipse","line","rect","polygon","polyline","text","tspan","use"].includes(t)}};var we=class{transform(t,r={}){let{optimize:n=true,splitColors:s=false,splitStrokeWidths:i=false,fixedStrokeWidth:o=false,normalizeFillStroke:u=false,accessibility:a=true,removeComments:l=true,removeDuplicates:c=true,minifyPaths:d=false}=r,p=this.deepCloneAst(t),f=[],D=[],h=[];return n&&(this.applyOptimizations(p,{removeComments:l,removeDuplicates:c,minifyPaths:d&&!s}),f.push("optimization")),s&&(D=this.applySplitColors(p),f.push("split-colors")),i&&(h=this.applySplitStrokeWidths(p),f.push("split-stroke-widths")),o&&(this.applyFixedStrokeWidth(p),f.push("fixed-stroke-width")),u&&(this.applyFillStrokeNormalization(p),f.push("normalize-fill-stroke")),a&&(this.applyAccessibility(p),f.push("accessibility")),{ast:p,colorMappings:D,strokeWidthMappings:h,metadata:{originalColors:D.map(m=>m.originalColor),originalStrokeWidths:h.map(m=>m.originalStrokeWidth),optimizationApplied:n,features:f,hasClassAttributes:this.hasClassAttributes(p)}}}applySplitColors(t){let n=new ve({generateClasses:true,colorPrefix:"color"}).apply(t.root);return t.root=n.processedElement,n.mappings}applyFixedStrokeWidth(t){let n=new ye({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;}applyFillStrokeNormalization(t){let r=new xe({enabled:true});t.root.children=r.apply(t.root.children);}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()),bt=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 qe(e,t,r){let n=e.replace(/\.svg$/i,"");return n=Jr(n),xt(n,t,r)}function Jr(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 St(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 Ur(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 xt(e,t,r){let n=e;t&&(n=`${t}-${n}`),r&&(n=`${n}-${r}`);let s=St(n,"main");return Ur(s)}var ie=class{constructor(t={}){y(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(d=>this.elementToJsx(d,r+1)).join(`
|
|
4
4
|
`),c+=`
|
|
5
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
6
|
${i}?: string;`),o}else {let o=` ${s}: PropTypes.string,`;return r&&(o+=`
|
|
@@ -8,66 +8,66 @@ var zr=Object.defineProperty;var Lr=(e,t,r)=>t in e?zr(e,t,{enumerable:true,conf
|
|
|
8
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
9
|
${i}?: string;`),o}else {let o=` ${s}: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),`;return r&&(o+=`
|
|
10
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 qe(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 Hr=Object.create,ot=Object.defineProperty,Zr=Object.getOwnPropertyDescriptor,Kr=Object.getOwnPropertyNames,Xr=Object.getPrototypeOf,Yr=Object.prototype.hasOwnProperty,rr=e=>{throw TypeError(e)},Qr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ut=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:true});},en=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Kr(t))!Yr.call(e,s)&&s!==r&&ot(e,s,{get:()=>t[s],enumerable:!(n=Zr(t,s))||n.enumerable});return e},tn=(e,t,r)=>(r=e!=null?Hr(Xr(e)):{},en(ot(r,"default",{value:e,enumerable:true}),e)),rn=(e,t,r)=>t.has(e)||rr("Cannot "+r),nn=(e,t,r)=>t.has(e)?rr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),
|
|
12
|
-
`,a.gutter(
|
|
13
|
-
`);return u.message&&!
|
|
14
|
-
${h}`),h}e.codeFrameColumns=s;}),on={};ut(on,{__debug:()=>vo,check:()=>Co,doc:()=>jr,format:()=>pe,formatWithCursor:()=>_r,getSupportInfo:()=>Eo,util:()=>Mr,version:()=>Ji});var un=(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)},Ve=un,an=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,
|
|
11
|
+
`)}generateStrokeWidthDefaults(t){return t.length===0?"":t.map(r=>{let n=r.variableName,s=r.originalStrokeWidth;return `${n} = "${s}"`}).join(", ")}getComponentName(){return qe(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 Hr=Object.create,ot=Object.defineProperty,Zr=Object.getOwnPropertyDescriptor,Kr=Object.getOwnPropertyNames,Xr=Object.getPrototypeOf,Yr=Object.prototype.hasOwnProperty,rr=e=>{throw TypeError(e)},Qr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ut=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:true});},en=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Kr(t))!Yr.call(e,s)&&s!==r&&ot(e,s,{get:()=>t[s],enumerable:!(n=Zr(t,s))||n.enumerable});return e},tn=(e,t,r)=>(r=e!=null?Hr(Xr(e)):{},en(ot(r,"default",{value:e,enumerable:true}),e)),rn=(e,t,r)=>t.has(e)||rr("Cannot "+r),nn=(e,t,r)=>t.has(e)?rr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),de=(e,t,r)=>(rn(e,t,"access private method"),r),sn=Qr(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:d=3}=u||{},p=a.line,f=a.column,D=l.line,h=l.column,m=Math.max(p-(c+1),0),g=Math.min(o.length,D+d);p===-1&&(m=0),D===-1&&(g=o.length);let F=D-p,C={};if(F)for(let v=0;v<=F;v++){let E=v+p;if(!f)C[E]=true;else if(v===0){let b=o[E-1].length;C[E]=[f,b-f+1];}else if(v===F)C[E]=[0,h];else {let b=o[E-v].length;C[E]=[0,b];}}else f===h?f?C[p]=[f,0]:C[p]=true:C[p]=[f,h-f];return {start:m,end:g,markerLines:C}}function s(i,o,u={}){let a=t(),l=i.split(r),{start:c,end:d,markerLines:p}=n(o,l,u),f=o.start&&typeof o.start.column=="number",D=String(d).length,h=i.split(r,d).slice(c,d).map((m,g)=>{let F=c+1+g,C=` ${` ${F}`.slice(-D)} |`,v=p[F],E=!p[F+1];if(v){let b="";if(Array.isArray(v)){let O=m.slice(0,Math.max(v[0]-1,0)).replace(/[^\t]/g," "),S=v[1]||1;b=[`
|
|
12
|
+
`,a.gutter(C.replace(/\d/g," "))," ",O,a.marker("^").repeat(S)].join(""),E&&u.message&&(b+=" "+a.message(u.message));}return [a.marker(">"),a.gutter(C),m.length>0?` ${m}`:"",b].join("")}else return ` ${a.gutter(C)}${m.length>0?` ${m}`:""}`}).join(`
|
|
13
|
+
`);return u.message&&!f&&(h=`${" ".repeat(D+1)}${u.message}
|
|
14
|
+
${h}`),h}e.codeFrameColumns=s;}),on={};ut(on,{__debug:()=>vo,check:()=>Co,doc:()=>jr,format:()=>pe,formatWithCursor:()=>_r,getSupportInfo:()=>Eo,util:()=>Mr,version:()=>Ji});var un=(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)},Ve=un,an=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,d=Date.now()+c,p=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(p[0],t,e,0,r);if(p[0].oldPos+1>=u&&f+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 F,C=p[g-1],v=p[g+1];C&&(p[g-1]=void 0);let E=false;if(v){let O=v.oldPos-g;E=v&&0<=O&&O<o;}let b=C&&C.oldPos+1<u;if(!E&&!b){p[g]=void 0;continue}if(!b||E&&C.oldPos<v.oldPos?F=this.addToPath(v,true,false,0,r):F=this.addToPath(C,false,true,1,r),f=this.extractCommon(F,t,e,g,r),F.oldPos+1>=u&&f+1>=o)return i(this.buildValues(F.lastComponent,t,e))||true;p[g]=F,F.oldPos+1>=u&&(h=Math.min(h,g-1)),f+1>=o&&(D=Math.max(D,g+1));}a++;};if(n)(function g(){setTimeout(function(){if(a>l||Date.now()>d)return n(void 0);m()||g();},0);})();else for(;a<=l&&Date.now()<=d;){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(d,p){let f=r[a+p];return f.length>d.length?f:d}),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}},ln=class extends an{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}},cn=new ln;function pn(e,t,r){return cn.diff(e,t,r)}function Dn(e){let t=e.indexOf("\r");return t!==-1?e.charAt(t+1)===`
|
|
15
15
|
`?"crlf":"cr":"lf"}function at(e){switch(e){case "cr":return "\r";case "crlf":return `\r
|
|
16
16
|
`;default:return `
|
|
17
17
|
`}}function nr(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
|
|
20
|
-
`)}var re="string",R="array",U="cursor",I="indent",j="align",M="trim",A="group",T="fill",B="if-break",_="indent-if-break",z="line-suffix",L="line-suffix-boundary",w="line",W="label",$="break-parent",sr=new Set([U,I,j,M,A,T,B,_,z,L,w,W,$]),
|
|
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 dn(e){return Ve(false,e,/\r\n?/gu,`
|
|
20
|
+
`)}var re="string",R="array",U="cursor",I="indent",j="align",M="trim",A="group",T="fill",B="if-break",_="indent-if-break",z="line-suffix",L="line-suffix-boundary",w="line",W="label",$="break-parent",sr=new Set([U,I,j,M,A,T,B,_,z,L,w,W,$]),fn=(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=fn;function hn(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===`
|
|
21
21
|
`);)t--;return t<e.length?e.slice(0,t):e}function mn(e){if(typeof e=="string")return re;if(Array.isArray(e))return R;if(!e)return;let{type:t}=e;if(sr.has(t))return t}var ne=mn,gn=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function Fn(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return `Unexpected doc '${t}',
|
|
22
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=gn([...sr].map(s=>`'${s}'`));return `Unexpected doc.type '${e.type}'.
|
|
23
|
-
Expected it to be ${n}.`}var Cn=class extends Error{constructor(t){super(Fn(t));y(this,"name","InvalidDocError");this.doc=t;}},ae=Cn,wt={};function En(e,t,r,n){let s=[e];for(;s.length>0;){let i=s.pop();if(i===wt){r(s.pop());continue}r&&s.push(i,wt);let o=ne(i);if(!o)throw new ae(i);if(t?.(i)!==false)switch(o){case R:case T:{let u=o===R?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 j:case I:case _:case W:case z:s.push(i.contents);break;case re:case U:case M:case L:case w:case $:break;default:throw new ae(i)}}}var lt=En;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 R:return t(i.map(n));case T: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 j:case I:case _:case W:case z:return t({...i,contents:n(i.contents)});case re:case U:case M:case L:case w:case $:return t(i);default:throw new ae(i)}}}function ct(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 lt(e,i),n}function vn(e){if(e.type===A&&e.break||e.type===w&&e.hard||e.type===$)return true}function yn(e){return ct(e,vn,false)}function kt(e){if(e.length>0){let t=x(false,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated");}return null}function bn(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);}lt(e,n,s,true);}function Sn(e){return e.type===w&&!e.hard?e.soft?"":" ":e.type===B?e.flatContents:e}function xn(e){return Te(e,Sn)}function At(e){for(e=[...e];e.length>=2&&x(false,e,-2).type===w&&x(false,e,-1).type===$;)e.length-=2;if(e.length>0){let t=
|
|
24
|
-
`)):r)}function Bn(e){if(e.type===w)return true}function $n(e){return ct(e,Bn,false)}function $e(e,t){return e.type===W?{...e,contents:t(e.contents)}:t(e)}var pt=()=>{},or=pt;function Pe(e){return {type:I,contents:e}}function le(e,t){return {type:j,contents:t,n:e}}function ur(e,t={}){return or(t.expandedStates),{type:A,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function Nn(e){return le(Number.NEGATIVE_INFINITY,e)}function Pn(e){return le({type:"root"},e)}function Vn(e){return le(-1,e)}function Tn(e,t){return ur(e[0],{...t,expandedStates:e})}function Wn(e){return {type:T,parts:e}}function Gn(e,t="",r={}){return {type:B,breakContents:e,flatContents:t,groupId:r.groupId}}function Rn(e,t){return {type:_,contents:e,groupId:t.groupId,negate:t.negate}}function Ye(e){return {type:z,contents:e}}var In={type:L},We={type:$},jn={type:M},Dt={type:w,hard:true},ar={type:w,hard:true,literal:true},lr={type:w},Mn={type:w,soft:true},ee=[Dt,We],cr=[ar,We],Q={type:U};function pr(e,t){let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function Dr(e,t,r){let n=e;if(t>0){for(let s=0;s<Math.floor(t/r);++s)n=Pe(n);n=le(t%r,n),n=le(Number.NEGATIVE_INFINITY,n);}return n}function _n(e,t){return e?{type:W,label:e,contents:t}:t}function G(e){var t;if(!e)return "";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...G(n));else {let s=G(n);s!==""&&r.push(s);}return r}return e.type===B?{...e,breakContents:G(e.breakContents),flatContents:G(e.flatContents)}:e.type===A?{...e,contents:G(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(G)}:e.type===T?{type:"fill",parts:e.parts.map(G)}:e.contents?{...e,contents:G(e.contents)}:e}function zn(e){let t=Object.create(null),r=new Set;return n(G(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===w){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)===w&&u[o-1].hard?void 0:"breakParent";if(i.type===M)return "trim";if(i.type===I)return "indent("+n(i.contents)+")";if(i.type===j)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===_){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===T)return `fill([${i.parts.map(c=>n(c)).join(", ")}])`;if(i.type===z)return "lineSuffix("+n(i.contents)+")";if(i.type===L)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 Ln=()=>/[#*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 qn(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Jn(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 Un=e=>!(qn(e)||Jn(e)),Hn=/[^\x20-\x7F]/u;function Zn(e){if(!e)return 0;if(!Hn.test(e))return e.length;e=e.replace(Ln()," ");let t=0;for(let r of e){let n=r.codePointAt(0);n<=31||n>=127&&n<=159||n>=768&&n<=879||(t+=Un(n)?1:2);}return t}var ft=Zn,k=Symbol("MODE_BREAK"),N=Symbol("MODE_FLAT"),oe=Symbol("cursor"),Qe=Symbol("DOC_FILL_PRINTED_LENGTH");function fr(){return {value:"",length:0,queue:[]}}function Kn(e,t){return et(e,{type:"indent"},t)}function Xn(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||fr():t<0?et(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:et(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function et(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 tt(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 Ae(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-=ft(c);break;case R:case T:{let p=f===R?c:c.parts,d=c[Qe]??0;for(let D=p.length-1;D>=d;D--)u.push({mode:l,doc:p[D]});break}case I:case j:case _:case W:u.push({mode:l,doc:c.contents});break;case M:r+=tt(a);break;case A:{if(i&&c.break)return false;let p=c.break?k:l,d=c.expandedStates&&p===k?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)===k?c.breakContents:c.flatContents;p&&u.push({mode:l,doc:p});break}case w:if(l===k||c.hard)return true;c.soft||(a.push(" "),r--);break;case z:n=true;break;case L:if(n)return false;break}}return false}function Ge(e,t){let r={},n=t.printWidth,s=at(t.endOfLine),i=0,o=[{ind:fr(),mode:k,doc:e}],u=[],a=false,l=[],c=0;for(bn(e);o.length>0;){let{ind:p,mode:d,doc:D}=o.pop();switch(ne(D)){case re:{let h=s!==`
|
|
23
|
+
Expected it to be ${n}.`}var Cn=class extends Error{constructor(t){super(Fn(t));y(this,"name","InvalidDocError");this.doc=t;}},ae=Cn,wt={};function En(e,t,r,n){let s=[e];for(;s.length>0;){let i=s.pop();if(i===wt){r(s.pop());continue}r&&s.push(i,wt);let o=ne(i);if(!o)throw new ae(i);if(t?.(i)!==false)switch(o){case R:case T:{let u=o===R?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 j:case I:case _:case W:case z:s.push(i.contents);break;case re:case U:case M:case L:case w:case $:break;default:throw new ae(i)}}}var lt=En;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 R:return t(i.map(n));case T: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 j:case I:case _:case W:case z:return t({...i,contents:n(i.contents)});case re:case U:case M:case L:case w:case $:return t(i);default:throw new ae(i)}}}function ct(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 lt(e,i),n}function vn(e){if(e.type===A&&e.break||e.type===w&&e.hard||e.type===$)return true}function yn(e){return ct(e,vn,false)}function kt(e){if(e.length>0){let t=x(false,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated");}return null}function bn(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);}lt(e,n,s,true);}function Sn(e){return e.type===w&&!e.hard?e.soft?"":" ":e.type===B?e.flatContents:e}function xn(e){return Te(e,Sn)}function At(e){for(e=[...e];e.length>=2&&x(false,e,-2).type===w&&x(false,e,-1).type===$;)e.length-=2;if(e.length>0){let t=fe(x(false,e,-1));e[e.length-1]=t;}return e}function fe(e){switch(ne(e)){case I:case _:case A:case z:case W:{let t=fe(e.contents);return {...e,contents:t}}case B:return {...e,breakContents:fe(e.breakContents),flatContents:fe(e.flatContents)};case T:return {...e,parts:At(e.parts)};case R:return At(e);case re:return hn(e);case j:case U:case M:case L:case w:case $:break;default:throw new ae(e)}return e}function ir(e){return fe(kn(e))}function wn(e){switch(ne(e)){case T: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 j:case I:case _:case z:if(!e.contents)return "";break;case B:if(!e.flatContents&&!e.breakContents)return "";break;case R:{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 M:case L:case w:case W:case $:break;default:throw new ae(e)}return e}function kn(e){return Te(e,t=>wn(t))}function An(e,t=cr){return Te(e,r=>typeof r=="string"?pr(t,r.split(`
|
|
24
|
+
`)):r)}function Bn(e){if(e.type===w)return true}function $n(e){return ct(e,Bn,false)}function $e(e,t){return e.type===W?{...e,contents:t(e.contents)}:t(e)}var pt=()=>{},or=pt;function Pe(e){return {type:I,contents:e}}function le(e,t){return {type:j,contents:t,n:e}}function ur(e,t={}){return or(t.expandedStates),{type:A,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function Nn(e){return le(Number.NEGATIVE_INFINITY,e)}function Pn(e){return le({type:"root"},e)}function Vn(e){return le(-1,e)}function Tn(e,t){return ur(e[0],{...t,expandedStates:e})}function Wn(e){return {type:T,parts:e}}function Gn(e,t="",r={}){return {type:B,breakContents:e,flatContents:t,groupId:r.groupId}}function Rn(e,t){return {type:_,contents:e,groupId:t.groupId,negate:t.negate}}function Ye(e){return {type:z,contents:e}}var In={type:L},We={type:$},jn={type:M},Dt={type:w,hard:true},ar={type:w,hard:true,literal:true},lr={type:w},Mn={type:w,soft:true},ee=[Dt,We],cr=[ar,We],Q={type:U};function pr(e,t){let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function Dr(e,t,r){let n=e;if(t>0){for(let s=0;s<Math.floor(t/r);++s)n=Pe(n);n=le(t%r,n),n=le(Number.NEGATIVE_INFINITY,n);}return n}function _n(e,t){return e?{type:W,label:e,contents:t}:t}function G(e){var t;if(!e)return "";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...G(n));else {let s=G(n);s!==""&&r.push(s);}return r}return e.type===B?{...e,breakContents:G(e.breakContents),flatContents:G(e.flatContents)}:e.type===A?{...e,contents:G(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(G)}:e.type===T?{type:"fill",parts:e.parts.map(G)}:e.contents?{...e,contents:G(e.contents)}:e}function zn(e){let t=Object.create(null),r=new Set;return n(G(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===w){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)===w&&u[o-1].hard?void 0:"breakParent";if(i.type===M)return "trim";if(i.type===I)return "indent("+n(i.contents)+")";if(i.type===j)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===_){let c=[];i.negate&&c.push("negate: true"),i.groupId&&c.push(`groupId: ${s(i.groupId)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";return `indentIfBreak(${n(i.contents)}${d})`}if(i.type===A){let c=[];i.break&&i.break!=="propagated"&&c.push("shouldBreak: true"),i.id&&c.push(`id: ${s(i.id)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";return i.expandedStates?`conditionalGroup([${i.expandedStates.map(p=>n(p)).join(",")}]${d})`:`group(${n(i.contents)}${d})`}if(i.type===T)return `fill([${i.parts.map(c=>n(c)).join(", ")}])`;if(i.type===z)return "lineSuffix("+n(i.contents)+")";if(i.type===L)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 Ln=()=>/[#*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 qn(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Jn(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 Un=e=>!(qn(e)||Jn(e)),Hn=/[^\x20-\x7F]/u;function Zn(e){if(!e)return 0;if(!Hn.test(e))return e.length;e=e.replace(Ln()," ");let t=0;for(let r of e){let n=r.codePointAt(0);n<=31||n>=127&&n<=159||n>=768&&n<=879||(t+=Un(n)?1:2);}return t}var dt=Zn,k=Symbol("MODE_BREAK"),N=Symbol("MODE_FLAT"),oe=Symbol("cursor"),Qe=Symbol("DOC_FILL_PRINTED_LENGTH");function dr(){return {value:"",length:0,queue:[]}}function Kn(e,t){return et(e,{type:"indent"},t)}function Xn(e,t,r){return t===Number.NEGATIVE_INFINITY?e.root||dr():t<0?et(e,{type:"dedent"},r):t?t.type==="root"?{...e,root:e}:et(e,{type:typeof t=="string"?"stringAlign":"numberAlign",n:t},r):e}function et(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?d():p();}function d(){o>0&&a(o),f();}function p(){u>0&&l(u),f();}function f(){o=0,u=0;}}function tt(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 Ae(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(),d=ne(c);switch(d){case re:a.push(c),r-=dt(c);break;case R:case T:{let p=d===R?c:c.parts,f=c[Qe]??0;for(let D=p.length-1;D>=f;D--)u.push({mode:l,doc:p[D]});break}case I:case j:case _:case W:u.push({mode:l,doc:c.contents});break;case M:r+=tt(a);break;case A:{if(i&&c.break)return false;let p=c.break?k:l,f=c.expandedStates&&p===k?x(false,c.expandedStates,-1):c.contents;u.push({mode:p,doc:f});break}case B:{let p=(c.groupId?s[c.groupId]||N:l)===k?c.breakContents:c.flatContents;p&&u.push({mode:l,doc:p});break}case w:if(l===k||c.hard)return true;c.soft||(a.push(" "),r--);break;case z:n=true;break;case L:if(n)return false;break}}return false}function Ge(e,t){let r={},n=t.printWidth,s=at(t.endOfLine),i=0,o=[{ind:dr(),mode:k,doc:e}],u=[],a=false,l=[],c=0;for(bn(e);o.length>0;){let{ind:p,mode:f,doc:D}=o.pop();switch(ne(D)){case re:{let h=s!==`
|
|
25
25
|
`?Ve(false,D,`
|
|
26
|
-
`,s):D;u.push(h),o.length>0&&(i+=
|
|
26
|
+
`,s):D;u.push(h),o.length>0&&(i+=dt(h));break}case R:for(let h=D.length-1;h>=0;h--)o.push({ind:p,mode:f,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 I:o.push({ind:Kn(p,t),mode:f,doc:D.contents});break;case j:o.push({ind:Xn(p,D.n,t),mode:f,doc:D.contents});break;case M:i-=tt(u);break;case A:switch(f){case N:if(!a){o.push({ind:p,mode:D.break?k:N,doc:D.contents});break}case k:{a=false;let h={ind:p,mode:N,doc:D.contents},m=n-i,g=l.length>0;if(!D.break&&Ae(h,o,m,g,r))o.push(h);else if(D.expandedStates){let F=x(false,D.expandedStates,-1);if(D.break){o.push({ind:p,mode:k,doc:F});break}else for(let C=1;C<D.expandedStates.length+1;C++)if(C>=D.expandedStates.length){o.push({ind:p,mode:k,doc:F});break}else {let v=D.expandedStates[C],E={ind:p,mode:N,doc:v};if(Ae(E,o,m,g,r)){o.push(E);break}}}else o.push({ind:p,mode:k,doc:D.contents});break}}D.id&&(r[D.id]=x(false,o,-1).mode);break;case T:{let h=n-i,m=D[Qe]??0,{parts:g}=D,F=g.length-m;if(F===0)break;let C=g[m+0],v=g[m+1],E={ind:p,mode:N,doc:C},b={ind:p,mode:k,doc:C},O=Ae(E,[],h,l.length>0,r,true);if(F===1){O?o.push(E):o.push(b);break}let S={ind:p,mode:N,doc:v},Z={ind:p,mode:k,doc:v};if(F===2){O?o.push(S,E):o.push(Z,b);break}let ze=g[m+2],De={ind:p,mode:f,doc:{...D,[Qe]:m+2}};Ae({ind:p,mode:N,doc:[C,v,ze]},[],h,l.length>0,r,true)?o.push(De,S,E):O?o.push(De,Z,E):o.push(De,Z,b);break}case B:case _:{let h=D.groupId?r[D.groupId]:f;if(h===k){let m=D.type===B?D.breakContents:D.negate?D.contents:Pe(D.contents);m&&o.push({ind:p,mode:f,doc:m});}if(h===N){let m=D.type===B?D.flatContents:D.negate?Pe(D.contents):D.contents;m&&o.push({ind:p,mode:f,doc:m});}break}case z:l.push({ind:p,mode:f,doc:D.contents});break;case L:l.length>0&&o.push({ind:p,mode:f,doc:Dt});break;case w:switch(f){case N:if(D.hard)a=true;else {D.soft||(u.push(" "),i+=1);break}case k:if(l.length>0){o.push({ind:p,mode:f,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-=tt(u),u.push(s+p.value),i=p.length);break}break;case W:o.push({ind:p,mode:f,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 d=u.indexOf(oe);if(d!==-1){let p=u.indexOf(oe,d+1);if(p===-1)return {formatted:u.filter(m=>m!==oe).join("")};let f=u.slice(0,d).join(""),D=u.slice(d+1,p).join(""),h=u.slice(p+1).join("");return {formatted:f+D+h,cursorNodeStart:f.length,cursorNodeText:D}}return {formatted:u.join("")}}function Yn(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=Yn,K,rt,Oe,Qn=class{constructor(e){nn(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 [...de(this,K,Oe).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=de(this,K,rt).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=de(this,K,rt).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 de(this,K,Oe).call(this))if(e(t))return t}hasAncestor(e){for(let t of de(this,K,Oe).call(this))if(e(t))return true;return false}};K=new WeakSet,rt=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},Oe=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 es=Qn,fr=new Proxy(()=>{},{get:()=>fr}),nt=fr;function ts(e){return e!==null&&typeof e=="object"}var rs=ts;function*Re(e,t){let{getVisitorKeys:r,filter:n=()=>true}=t,s=i=>rs(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*ns(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 ss(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 is=ge(/\s/u),J=ge(" "),hr=ge(",; "),mr=ge(/[^\n\r]/u);function os(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
27
|
`)return t-2;if(s===`
|
|
28
28
|
`||s==="\r"||s==="\u2028"||s==="\u2029")return t-1}else {if(s==="\r"&&e.charAt(t+1)===`
|
|
29
29
|
`)return t+2;if(s===`
|
|
30
|
-
`||s==="\r"||s==="\u2028"||s==="\u2029")return t+1}return t}var te=os;function us(e,t,r={}){let n=J(e,r.backwards?t-1:t,r),s=te(e,n,r);return n!==s}var q=us;function as(e){return Array.isArray(e)&&e.length>0}var ls=as,gr=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),cs=e=>Object.keys(e).filter(t=>!gr.has(t));function ps(e){return e?t=>e(t,gr):cs}var Ie=ps;function Ds(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 ht(e,t){(e.comments??(e.comments=[])).push(t),t.printed=false,t.nodeDescription=Ds(e);}function he(e,t){t.leading=true,t.trailing=false,ht(e,t);}function X(e,t,r){t.leading=false,t.trailing=false,r&&(t.marker=r),ht(e,t);}function me(e,t){t.leading=false,t.trailing=true,ht(e,t);}var Je=new WeakMap;function mt(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]:mt(a,t));return u.sort((a,l)=>i(a)-i(l)||o(a)-o(l)),Je.set(e,u),u}function Fr(e,t,r,n){let{locStart:s,locEnd:i}=r,o=s(t),u=i(t),a=mt(e,r),l,c,
|
|
30
|
+
`||s==="\r"||s==="\u2028"||s==="\u2029")return t+1}return t}var te=os;function us(e,t,r={}){let n=J(e,r.backwards?t-1:t,r),s=te(e,n,r);return n!==s}var q=us;function as(e){return Array.isArray(e)&&e.length>0}var ls=as,gr=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),cs=e=>Object.keys(e).filter(t=>!gr.has(t));function ps(e){return e?t=>e(t,gr):cs}var Ie=ps;function Ds(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 ht(e,t){(e.comments??(e.comments=[])).push(t),t.printed=false,t.nodeDescription=Ds(e);}function he(e,t){t.leading=true,t.trailing=false,ht(e,t);}function X(e,t,r){t.leading=false,t.trailing=false,r&&(t.marker=r),ht(e,t);}function me(e,t){t.leading=false,t.trailing=true,ht(e,t);}var Je=new WeakMap;function mt(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]:mt(a,t));return u.sort((a,l)=>i(a)-i(l)||o(a)-o(l)),Je.set(e,u),u}function Fr(e,t,r,n){let{locStart:s,locEnd:i}=r,o=s(t),u=i(t),a=mt(e,r),l,c,d=0,p=a.length;for(;d<p;){let f=d+p>>1,D=a[f],h=s(D),m=i(D);if(h<=o&&u<=m)return Fr(D,t,r,D);if(m<=o){l=D,d=f+1;continue}if(u<=h){c=D,p=f;continue}throw new Error("Comment location overlaps with node location")}if(n?.type==="TemplateLiteral"){let{quasis:f}=n,D=He(f,t,r);l&&He(f,l,r)!==D&&(l=null),c&&He(f,c,r)!==D&&(c=null);}return {enclosingNode:n,precedingNode:l,followingNode:c}}var Ue=()=>false;function ds(e,t){let{comments:r}=e;if(delete e.comments,!ls(r)||!t.printer.canAttachComment)return;let n=[],{printer:{experimentalFeatures:{avoidAstMutation:s=false}={},handleComments:i={}},originalText:o}=t,{ownLine:u=Ue,endOfLine:a=Ue,remaining:l=Ue}=i,c=r.map((d,p)=>({...Fr(e,d,t),comment:d,text:o,options:t,ast:e,isLastComment:r.length-1===p}));for(let[d,p]of c.entries()){let{comment:f,precedingNode:D,enclosingNode:h,followingNode:m,text:g,options:F,ast:C,isLastComment:v}=p,E;if(s?E=[p]:(f.enclosingNode=h,f.precedingNode=D,f.followingNode=m,E=[f,g,F,C,v]),fs(g,F,c,d))f.placement="ownLine",u(...E)||(m?he(m,f):D?me(D,f):X(h||C,f));else if(hs(g,F,c,d))f.placement="endOfLine",a(...E)||(D?me(D,f):m?he(m,f):X(h||C,f));else if(f.placement="remaining",!l(...E))if(D&&m){let b=n.length;b>0&&n[b-1].followingNode!==m&&Bt(n,F),n.push(p);}else D?me(D,f):m?he(m,f):X(h||C,f);}if(Bt(n,t),!s)for(let d of r)delete d.precedingNode,delete d.enclosingNode,delete d.followingNode;}var Cr=e=>!/[\S\n\u2028\u2029]/u.test(e);function fs(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:d}=r[l];if(d!==i||!Cr(e.slice(u(c),a)))break;a=o(c);}return q(e,a,{backwards:true})}function hs(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:d}=r[l];if(d!==i||!Cr(e.slice(a,o(c))))break;a=u(c);}return q(e,a)}function Bt(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:d}=e[a-1];nt.strictEqual(c,i),nt.strictEqual(d,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,d)=>t.locStart(c)-t.locStart(d));e.length=0;}function He(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 ms(e,t){let r=t-1;r=J(e,r,{backwards:true}),r=te(e,r,{backwards:true}),r=J(e,r,{backwards:true});let n=te(e,r,{backwards:true});return r!==n}var gt=ms;function Er(e,t){let r=e.node;return r.printed=true,t.printer.printComment(e,t)}function gs(e,t){var r;let n=e.node,s=[Er(e,t)],{printer:i,originalText:o,locStart:u,locEnd:a}=t;if((r=i.isBlockComment)!=null&&r.call(i,n)){let c=q(o,a(n))?q(o,u(n),{backwards:true})?ee:lr:" ";s.push(c);}else s.push(ee);let l=te(o,J(o,a(n)));return l!==false&&q(o,l)&&s.push(ee),s}function Fs(e,t,r){var n;let s=e.node,i=Er(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)||q(u,a(s),{backwards:true})){let c=gt(u,a(s));return {doc:Ye([ee,c?ee:"",i]),isBlock:l,hasLineSuffix:true}}return !l||r!=null&&r.hasLineSuffix?{doc:[Ye([" ",i]),We],isBlock:l,hasLineSuffix:true}:{doc:[" ",i],isBlock:l,hasLineSuffix:false}}function Cs(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(gs(e,t)):l&&(o=Fs(e,t,o),i.push(o.doc));},"comments"),{leading:s,trailing:i}}function Es(e,t,r){let{leading:n,trailing:s}=Cs(e,r);return !n&&!s?t:$e(t,i=>[n,i,s])}function vs(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 vr=class extends Error{constructor(){super(...arguments);y(this,"name","ConfigError");}},$t=class extends Error{constructor(){super(...arguments);y(this,"name","UndefinedParserError");}},Ss={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
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 ws(Object.assign({},...e.map(({options:i})=>i),Ss)))!t&&s.deprecated||(Array.isArray(s.choices)&&(t||(s.choices=s.choices.filter(i=>!i.deprecated)),s.name==="parser"&&(s.choices=[...s.choices,...xs(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*xs(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 ws(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 ks=(e,t)=>{if(!(e&&t==null))return t.toReversed||!Array.isArray(t)?t.toReversed():[...t].reverse()},As=ks,Ot,Nt,Pt,Vt,Tt,Bs=((Ot=globalThis.Deno)==null?void 0:Ot.build.os)==="windows"||((Pt=(Nt=globalThis.navigator)==null?void 0:Nt.platform)==null?void 0:Pt.startsWith("Win"))||((Tt=(Vt=globalThis.process)==null?void 0:Vt.platform)==null?void 0:Tt.startsWith("win"))||false;function br(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 $s(e){return e=br(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function Os(e){e=br(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 Ns(e){return Bs?Os(e):$s(e)}var Ps=Ns,Vs=e=>String(e).split(/[/\\]/u).pop();function Wt(e,t){if(!t)return;let r=Vs(t).toLowerCase();return e.find(({filenames:n})=>n?.some(s=>s.toLowerCase()===r))??e.find(({extensions:n})=>n?.some(s=>r.endsWith(s)))}function Ts(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 Gt(e,t){if(t){if(String(t).startsWith("file:"))try{t=Ps(t);}catch{return}if(typeof t=="string")return e.find(({isSupported:r})=>r?.({filepath:t}))}}function Ws(e,t){let r=As(false,e.plugins).flatMap(s=>s.languages??[]),n=Ts(r,t.language)??Wt(r,t.physicalFile)??Wt(r,t.file)??Gt(r,t.physicalFile)??Gt(r,t.file)??(t.physicalFile,void 0);return n?.parsers[0]}var Gs=Ws,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})},Sr=new Proxy(String,{get:()=>Sr}),P=Sr,Rs=(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("; ")+"."},xr=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ne=Symbol.for("vnopts.VALUE_UNCHANGED"),Rt=" ".repeat(2),Is=(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=>wr(o,r.loggerPrintWidth))).join(`
|
|
34
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===xr?P.gray("nothing"):P.red(n.value(t))}.`].join(" ")}function wr({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=>wr(s,r-Rt.length).replace(/^|\n/g,`$&${Rt}`))).join(`
|
|
35
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 js(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 Ar=(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=>js(e,u)<3);o&&i.push(`Did you mean ${P.blue(r.key(o))}?`),n.warn(i.join(" "));},Ms=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function _s(e,t){let r=new e(t),n=Object.create(r);for(let s of Ms)s in t&&(n[s]=zs(t[s],r,H.prototype[s].length));return n}var H=class{static create(e){return _s(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 Ne}};function zs(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var Ls=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}},qs=class extends H{expected(){return "anything"}validate(){return true}},Js=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 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(Mt));}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(Mt));}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(e,t){return e.concat(t)}};function Mt({from:e,to:t}){return {from:[e],to:t}}var Us=class extends H{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};function Hs(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 Zs(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 Ks(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?true:(e[r]=true,false)}}function Xs(e,t){let r=[],n=[];for(let s of e)t(s)?r.push(s):n.push(s);return [r,n]}function Ys(e){return e===Math.floor(e)}function Qs(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 ei(e){return (...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function _t(e){return e===void 0?{}:e}function Br(e){if(typeof e=="string")return {text:e};let{text:t,list:r}=e;return ti((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(Br)}}:{text:t}}function zt(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 qt(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 st(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>qt(r,t)):[qt(e,t)]}function Jt(e,t){let r=st(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 ti(e,t){if(!e)throw new Error(t)}var ri=class extends H{constructor(e){super(e),this._choices=Zs(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(Qs).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}},ni=class extends H{expected(){return "a number"}validate(e,t){return typeof e=="number"}},si=class extends ni{expected(){return "an integer"}validate(e,t){return t.normalizeValidateResult(super.validate(e,t),e)===true&&Ys(e)}},Ut=class extends H{expected(){return "a string"}validate(e){return typeof e=="string"}},ii=ue,oi=Ar,ui=Is,ai=Rs,li=class{constructor(e,t){let{logger:r=console,loggerPrintWidth:n=80,descriptor:s=ii,unknown:i=oi,invalid:o=ui,deprecated:u=ai,missing:a=()=>false,required:l=()=>false,preprocess:c=p=>p,postprocess:f=()=>Ne}=t||{};this._utils={descriptor:s,logger:r||{warn:()=>{}},loggerPrintWidth:n,schemas:Hs(e,"name"),normalizeDefaultResult:_t,normalizeExpectedResult:Br,normalizeDeprecatedResult:Lt,normalizeForwardResult:st,normalizeRedirectResult:Jt,normalizeValidateResult:zt},this._unknownHandler=i,this._invalidHandler=ei(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=Ks();}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!==Ne&&(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));}}};st(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,xr,this._utils)}_partitionOptionKeys(e){let[t,r]=Xs(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=zt(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!==Ne){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;});}}}}},Ke;function ci(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 Ar(p,d,{...D,schemas:m})},a=pi(t,{isCLI:n,FlagSchema:i}),l=new li(a,{logger:r,unknown:u,descriptor:o}),c=r!==false;c&&Ke&&(l._hasDeprecationWarned=Ke);let f=l.normalize(e);return c&&(Ke=l._hasDeprecationWarned),f}function pi(e,{isCLI:t,FlagSchema:r}){let n=[];t&&n.push(qs.create({name:"_"}));for(let s of e)n.push(Di(s,{isCLI:t,optionInfos:e,FlagSchema:r})),s.alias&&t&&n.push(Ls.create({name:s.alias,sourceName:s.name}));return n}function Di(e,{isCLI:t,optionInfos:r,FlagSchema:n}){let{name:s}=e,i={name:s},o,u={};switch(e.type){case "int":o=si,t&&(i.preprocess=Number);break;case "string":o=Ut;break;case "choice":o=ri,i.choices=e.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:e.name,value:a.redirect}}}:a);break;case "boolean":o=Us;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=Ut;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?Js.create({...t?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...u,valueSchema:o.create(i)}):o.create({...i,...u})}var fi=ci,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}}},$r=di;function Or(e,t){if(!t)throw new Error("parserName is required.");let r=$r(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 vr(n)}function hi(e,t){if(!t)throw new Error("astFormat is required.");let r=$r(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 vr(n)}function Ft({plugins:e,parser:t}){let r=Or(e,t);return Nr(r,t)}function Nr(e,t){let r=e.parsers[t];return typeof r=="function"?r():r}function mi(e,t){let r=e.printers[t];return typeof r=="function"?r():r}var Ht={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function gi(e,t={}){var r;let n={...e};if(!n.parser)if(n.filepath){if(n.parser=Gs(n,{physicalFile:n.filepath}),!n.parser)throw new $t(`No parser could be inferred for file "${n.filepath}".`)}else throw new $t("No parser and no file path given, couldn't infer a parser.");let s=yr({plugins:e.plugins,showDeprecated:true}).options,i={...Ht,...Object.fromEntries(s.filter(p=>p.default!==void 0).map(p=>[p.name,p.default]))},o=Or(n.plugins,n.parser),u=await Nr(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:hi(n.plugins,u.astFormat),l=await mi(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"),fi(n,s,{passThrough:Object.keys(Ht),...t})}var ce=gi,Fi=tn(sn());async function Ci(e,t){let r=await Ft(t),n=r.preprocess?r.preprocess(e,t):e;t.originalText=n;let s;try{s=await r.parse(n,t,t);}catch(i){Ei(i,e);}return {text:n,ast:s}}function Ei(e,t){let{loc:r}=e;if(r){let n=(0, Fi.codeFrameColumns)(t,r,{highlightCode:true});throw e.message+=`
|
|
37
|
-
`+n,e.codeFrame=n,e}throw e}var Fe=Ci;async function vi(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=[];
|
|
38
|
-
`,s)+1),a=n.slice(u,s).match(/^\s*/u)[0],l=
|
|
39
|
-
`&&(p+=nr(
|
|
40
|
-
`)),
|
|
41
|
-
`,D);}return {formatted:
|
|
42
|
-
`);r-=u(r),n-=u(n),s-=u(s),e=
|
|
43
|
-
`);return r===-1?0:
|
|
44
|
-
`)return true;return false}var uo=oo;function ao(e,t,r={}){return J(e,r.backwards?t-1:t,r)!==t}var lo=ao;function co(e,t,r){let n=t==='"'?"'":'"',s=Ve(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 po=co;function Do(e,t,r){return vt(e,r(t))}function fo(e,t){return arguments.length===2||typeof t=="number"?vt(e,t):Do(...arguments)}function ho(e,t,r){return gt(e,r(t))}function mo(e,t){return arguments.length===2||typeof t=="number"?gt(e,t):ho(...arguments)}function go(e,t,r){return yt(e,r(t))}function Fo(e,t){return arguments.length===2||typeof t=="number"?yt(e,t):go(...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 Co(e,t){return await pe(e,t)===e}var Eo=Y(yr,0),vo={parse:Y(Ri),formatAST:Y(Ii),formatDoc:Y(ji),printToDoc:Y(Mi),printDocToString:Y(_i)};var Me=class extends ie{constructor(r={}){super(r);y(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),
|
|
36
|
+
`,1)[0].length);return s>t&&s>i?n:r}var Ze=[],jt=[];function js(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,d=0;for(;c<n;)jt[c]=e.charCodeAt(i+c),Ze[c]=++c;for(;d<s;)for(o=t.charCodeAt(i+d),a=d++,u=d,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 Ar=(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=>js(e,u)<3);o&&i.push(`Did you mean ${P.blue(r.key(o))}?`),n.warn(i.join(" "));},Ms=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function _s(e,t){let r=new e(t),n=Object.create(r);for(let s of Ms)s in t&&(n[s]=zs(t[s],r,H.prototype[s].length));return n}var H=class{static create(e){return _s(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 Ne}};function zs(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var Ls=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}},qs=class extends H{expected(){return "anything"}validate(){return true}},Js=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 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(Mt));}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(Mt));}return r.length===0?{redirect:n}:{redirect:n,remain:r}}overlap(e,t){return e.concat(t)}};function Mt({from:e,to:t}){return {from:[e],to:t}}var Us=class extends H{expected(){return "true or false"}validate(e){return typeof e=="boolean"}};function Hs(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 Zs(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 Ks(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?true:(e[r]=true,false)}}function Xs(e,t){let r=[],n=[];for(let s of e)t(s)?r.push(s):n.push(s);return [r,n]}function Ys(e){return e===Math.floor(e)}function Qs(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 ei(e){return (...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function _t(e){return e===void 0?{}:e}function Br(e){if(typeof e=="string")return {text:e};let{text:t,list:r}=e;return ti((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(Br)}}:{text:t}}function zt(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 qt(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 st(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>qt(r,t)):[qt(e,t)]}function Jt(e,t){let r=st(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 ti(e,t){if(!e)throw new Error(t)}var ri=class extends H{constructor(e){super(e),this._choices=Zs(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(Qs).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}},ni=class extends H{expected(){return "a number"}validate(e,t){return typeof e=="number"}},si=class extends ni{expected(){return "an integer"}validate(e,t){return t.normalizeValidateResult(super.validate(e,t),e)===true&&Ys(e)}},Ut=class extends H{expected(){return "a string"}validate(e){return typeof e=="string"}},ii=ue,oi=Ar,ui=Is,ai=Rs,li=class{constructor(e,t){let{logger:r=console,loggerPrintWidth:n=80,descriptor:s=ii,unknown:i=oi,invalid:o=ui,deprecated:u=ai,missing:a=()=>false,required:l=()=>false,preprocess:c=p=>p,postprocess:d=()=>Ne}=t||{};this._utils={descriptor:s,logger:r||{warn:()=>{}},loggerPrintWidth:n,schemas:Hs(e,"name"),normalizeDefaultResult:_t,normalizeExpectedResult:Br,normalizeDeprecatedResult:Lt,normalizeForwardResult:st,normalizeRedirectResult:Jt,normalizeValidateResult:zt},this._unknownHandler=i,this._invalidHandler=ei(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=Ks();}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!==Ne&&(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: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(i)||this._utils.logger.warn(this._deprecatedHandler(i,p,this._utils));else for(let{value:D}of f){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));}}};st(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[i]=i in t?o.overlap(t[i],d,this._utils):d,l({value:d});}for(let{from:d,to:p}of c.redirect)l({value:d,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,xr,this._utils)}_partitionOptionKeys(e){let[t,r]=Xs(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=zt(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!==Ne){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;});}}}}},Ke;function ci(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,f)=>s.includes(p)?{[p]:f}:void 0:(p,f)=>({[p]:f}):(p,f,D)=>{let{_:h,...m}=D.schemas;return Ar(p,f,{...D,schemas:m})},a=pi(t,{isCLI:n,FlagSchema:i}),l=new li(a,{logger:r,unknown:u,descriptor:o}),c=r!==false;c&&Ke&&(l._hasDeprecationWarned=Ke);let d=l.normalize(e);return c&&(Ke=l._hasDeprecationWarned),d}function pi(e,{isCLI:t,FlagSchema:r}){let n=[];t&&n.push(qs.create({name:"_"}));for(let s of e)n.push(Di(s,{isCLI:t,optionInfos:e,FlagSchema:r})),s.alias&&t&&n.push(Ls.create({name:s.alias,sourceName:s.name}));return n}function Di(e,{isCLI:t,optionInfos:r,FlagSchema:n}){let{name:s}=e,i={name:s},o,u={};switch(e.type){case "int":o=si,t&&(i.preprocess=Number);break;case "string":o=Ut;break;case "choice":o=ri,i.choices=e.choices.map(a=>a!=null&&a.redirect?{...a,redirect:{to:{key:e.name,value:a.redirect}}}:a);break;case "boolean":o=Us;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=Ut;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,d)=>c.preprocess(a(Array.isArray(l)?x(false,l,-1):l),d);}return e.array?Js.create({...t?{preprocess:a=>Array.isArray(a)?a:[a]}:{},...u,valueSchema:o.create(i)}):o.create({...i,...u})}var di=ci,fi=(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}}},$r=fi;function Or(e,t){if(!t)throw new Error("parserName is required.");let r=$r(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 vr(n)}function hi(e,t){if(!t)throw new Error("astFormat is required.");let r=$r(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 vr(n)}function Ft({plugins:e,parser:t}){let r=Or(e,t);return Nr(r,t)}function Nr(e,t){let r=e.parsers[t];return typeof r=="function"?r():r}function mi(e,t){let r=e.printers[t];return typeof r=="function"?r():r}var Ht={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null};async function gi(e,t={}){var r;let n={...e};if(!n.parser)if(n.filepath){if(n.parser=Gs(n,{physicalFile:n.filepath}),!n.parser)throw new $t(`No parser could be inferred for file "${n.filepath}".`)}else throw new $t("No parser and no file path given, couldn't infer a parser.");let s=yr({plugins:e.plugins,showDeprecated:true}).options,i={...Ht,...Object.fromEntries(s.filter(p=>p.default!==void 0).map(p=>[p.name,p.default]))},o=Or(n.plugins,n.parser),u=await Nr(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:hi(n.plugins,u.astFormat),l=await mi(a,u.astFormat);n.printer=l;let c=a.defaultOptions?Object.fromEntries(Object.entries(a.defaultOptions).filter(([,p])=>p!==void 0)):{},d={...i,...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"),di(n,s,{passThrough:Object.keys(Ht),...t})}var ce=gi,Fi=tn(sn());async function Ci(e,t){let r=await Ft(t),n=r.preprocess?r.preprocess(e,t):e;t.originalText=n;let s;try{s=await r.parse(n,t,t);}catch(i){Ei(i,e);}return {text:n,ast:s}}function Ei(e,t){let{loc:r}=e;if(r){let n=(0, Fi.codeFrameColumns)(t,r,{highlightCode:true});throw e.message+=`
|
|
37
|
+
`+n,e.codeFrame=n,e}throw e}var Fe=Ci;async function vi(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=[];f();let d=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=d;function p(D,h){return yi(D,h,r,n)}function f(){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(f,m):e.call(f,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 yi(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 ir(o)}function bi(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 Si=bi;async function je(e,t){({ast:e}=await Pr(e,t));let r=new Map,n=new es(e),i=new Map;await vi(n,u,t,je,i);let o=await Zt(n,t,u,void 0,i);if(vs(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 d=c&&typeof c=="object"&&l===void 0;if(d&&r.has(c))return r.get(c);let p=Zt(n,t,u,l,i);return d&&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=Si(e,t):s.has(o)?a=s.get(o):a=u.print(e,t,r,n),o){case t.cursorNode:a=$e(a,l=>[Q,l,Q]);break;case t.nodeBeforeCursor:a=$e(a,l=>[l,Q]);break;case t.nodeAfterCursor:a=$e(a,l=>[Q,l]);break}return u.printComment&&(!u.willPrintOwnComments||!u.willPrintOwnComments(e,t))&&(a=Es(e,a,t)),a}async function Pr(e,t){let r=e.comments??[];t[Symbol.for("comments")]=r,t[Symbol.for("printedComments")]=new Set,ds(e,t);let{printer:{preprocess:n}}=t;return e=n?await n(e,t):e,{ast:e,comments:r}}function xi(e,t){let{cursorOffset:r,locStart:n,locEnd:s}=t,i=Ie(t.printer.getVisitorKeys),o=f=>n(f)<=r&&s(f)>=r,u=e,a=[e];for(let f of ns(e,{getVisitorKeys:i,filter:o}))a.push(f),u=f;if(ss(u,{getVisitorKeys:i}))return {cursorNode:u};let l,c,d=-1,p=Number.POSITIVE_INFINITY;for(;a.length>0&&(l===void 0||c===void 0);){u=a.pop();let f=l!==void 0,D=c!==void 0;for(let h of Re(u,{getVisitorKeys:i})){if(!f){let m=s(h);m<=r&&m>d&&(l=h,d=m);}if(!D){let m=n(h);m>=r&&m<p&&(c=h,p=m);}}}return {nodeBeforeCursor:l,nodeAfterCursor:c}}var Vr=xi;function wi(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 d=r(u,l,a);if(d!==null)return d??l}}var ki=wi,Ai=(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}},Bi=Ai,$i=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";function Oi(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 Kt(e){let t=Bi(false,e,r=>r.type!=="Program"&&r.type!=="File");return t===-1?e:e.slice(0,t+1)}function Ni(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 Kt(t.parentNodes))if(r(a)>=o)i=a;else break;let u=n(t.node);for(let a of Kt(e.parentNodes)){if(n(a)<=u)s=a;else break;if(s===i)break}return {startNode:s,endNode:i}}function it(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 mt(e,r)){let d=it(c,t,r,n,[e,...s],i);if(d)return d}if(!n||n(e,s[0]))return {node:e,parentNodes:s}}}function Pi(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"]),Vi=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function Xt(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 Pi(t.type,r?.type);case "json":case "json5":case "jsonc":case "json-stringify":return Tr.has(t.type);case "graphql":return Vi.has(t.kind);case "vue":return t.tag!=="root"}return false}function Ti(e,t,r){let{rangeStart:n,rangeEnd:s,locStart:i,locEnd:o}=t;nt.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=it(r,n,t,(f,D)=>Xt(t,f,D),[],"rangeStart"),c=a?l:it(r,s,t,f=>Xt(t,f),[],"rangeEnd");if(!l||!c)return {rangeStart:0,rangeEnd:0};let d,p;if($i(t)){let f=Oi(l,c);d=f,p=f;}else ({startNode:d,endNode:p}=Ni(l,c,t));return {rangeStart:Math.min(i(d),i(p)),rangeEnd:Math.max(o(d),o(p))}}var Wr="\uFEFF",Yt=Symbol("cursor");async function Gr(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,...Vr(n,t)});let i=await je(n,t);r>0&&(i=Dr([ee,i],r,t.tabWidth));let o=Ge(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+at(t.endOfLine);}let u=t[Symbol.for("comments")];if(t.cursorOffset>=0){let a,l,c,d;if((t.cursorNode||t.nodeBeforeCursor||t.nodeAfterCursor)&&o.cursorNodeText)if(c=o.cursorNodeStart,d=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,d=o.formatted;let p=t.cursorOffset-a;if(l===d)return {formatted:o.formatted,cursorOffset:c+p,comments:u};let f=l.split("");f.splice(p,0,Yt);let D=d.split(""),h=pn(f,D),m=c;for(let g of h)if(g.removed){if(g.value.includes(Yt))break}else m+=g.count;return {formatted:o.formatted,cursorOffset:m,comments:u}}return {formatted:o.formatted,cursorOffset:-1,comments:u}}async function Wi(e,t){let{ast:r,text:n}=await Fe(e,t),{rangeStart:s,rangeEnd:i}=Ti(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 Gr(o,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>s&&t.cursorOffset<=i?t.cursorOffset-s:-1,endOfLine:"lf"},l),d=c.formatted.trimEnd(),{cursorOffset:p}=t;p>i?p+=d.length-o.length:c.cursorOffset>=0&&(p=c.cursorOffset+s);let f=n.slice(0,s)+d+n.slice(i);if(t.endOfLine!=="lf"){let D=at(t.endOfLine);p>=0&&D===`\r
|
|
39
|
+
`&&(p+=nr(f.slice(0,p),`
|
|
40
|
+
`)),f=Ve(false,f,`
|
|
41
|
+
`,D);}return {formatted:f,cursorOffset:p,comments:c.comments}}function Xe(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function Qt(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:s}=t;return r=Xe(e,r,-1),n=Xe(e,n,0),s=Xe(e,s,e.length),{...t,cursorOffset:r,rangeStart:n,rangeEnd:s}}function Rr(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:i}=Qt(e,t),o=e.charAt(0)===Wr;if(o&&(e=e.slice(1),r--,n--,s--),i==="auto"&&(i=Dn(e)),e.includes("\r")){let u=a=>nr(e.slice(0,Math.max(a,0)),`\r
|
|
42
|
+
`);r-=u(r),n-=u(n),s-=u(s),e=dn(e);}return {hasBOM:o,text:e,options:Qt(e,{...t,cursorOffset:r,rangeStart:n,rangeEnd:s,endOfLine:i})}}async function er(e,t){let r=await Ft(t);return !r.hasPragma||r.hasPragma(e)}async function Gi(e,t){var r;let n=await Ft(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 er(n,s)||s.checkIgnorePragma&&await Gi(n,s))return {formatted:e,cursorOffset:t.cursorOffset,comments:[]};let i;return s.rangeStart>0||s.rangeEnd<n.length?i=await Wi(n,s):(!s.requirePragma&&s.insertPragma&&s.printer.insertPragma&&!await er(n,s)&&(n=s.printer.insertPragma(n)),i=await Gr(n,s)),r&&(i.formatted=Wr+i.formatted,i.cursorOffset>=0&&i.cursorOffset++),i}async function Ri(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 Pr(i.ast,s)),r.massage&&(i.ast=ki(i.ast,s))),i}async function Ii(e,t){t=await ce(t);let r=await je(e,t);return Ge(r,t)}async function ji(e,t){let r=zn(e),{formatted:n}=await Ir(r,{...t,parser:"__js_expression"});return n}async function Mi(e,t){t=await ce(t);let{ast:r}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Vr(r,t)}),je(r,t)}async function _i(e,t){return Ge(e,await ce(t))}var jr={};ut(jr,{builders:()=>zi,printer:()=>Li,utils:()=>qi});var zi={join:pr,line:lr,softline:Mn,hardline:ee,literalline:cr,group:ur,conditionalGroup:Tn,fill:Wn,lineSuffix:Ye,lineSuffixBoundary:In,cursor:Q,breakParent:We,ifBreak:Gn,trim:jn,indent:Pe,indentIfBreak:Rn,align:le,addAlignmentToDoc:Dr,markAsRoot:Pn,dedentToRoot:Nn,dedent:Vn,hardlineWithoutBreakParent:Dt,literallineWithoutBreakParent:ar,label:_n,concat:e=>e},Li={printDocToString:Ge},qi={willBreak:yn,traverseDoc:lt,findInDoc:ct,mapDoc:Te,removeLines:xn,stripTrailingHardline:ir,replaceEndOfLine:An,canBreak:$n},Ji="3.6.2",Mr={};ut(Mr,{addDanglingComment:()=>X,addLeadingComment:()=>he,addTrailingComment:()=>me,getAlignmentSize:()=>ft,getIndentSize:()=>Yi,getMaxContinuousCount:()=>to,getNextNonSpaceNonCommentCharacter:()=>no,getNextNonSpaceNonCommentCharacterIndex:()=>fo,getPreferredQuote:()=>io,getStringWidth:()=>dt,hasNewline:()=>q,hasNewlineInRange:()=>uo,hasSpaces:()=>lo,isNextLineEmpty:()=>Fo,isNextLineEmptyAfterIndex:()=>yt,isPreviousLineEmpty:()=>mo,makeString:()=>po,skip:()=>ge,skipEverythingButNewLine:()=>mr,skipInlineComment:()=>Ct,skipNewline:()=>te,skipSpaces:()=>J,skipToLineEnd:()=>hr,skipTrailingComment:()=>Et,skipWhitespace:()=>is});function Ui(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 Ct=Ui;function Hi(e,t){return t===false?false:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?mr(e,t):t}var Et=Hi;function Zi(e,t){let r=null,n=t;for(;n!==r;)r=n,n=J(e,n),n=Ct(e,n),n=Et(e,n),n=te(e,n);return n}var vt=Zi;function Ki(e,t){let r=null,n=t;for(;n!==r;)r=n,n=hr(e,n),n=Ct(e,n),n=J(e,n);return n=Et(e,n),n=te(e,n),n!==false&&q(e,n)}var yt=Ki;function Xi(e,t){let r=e.lastIndexOf(`
|
|
43
|
+
`);return r===-1?0:ft(e.slice(r+1).match(/^[\t ]*/u)[0],t)}var Yi=Xi;function Qi(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function eo(e,t){let r=e.match(new RegExp(`(${Qi(t)})+`,"gu"));return r===null?0:r.reduce((n,s)=>Math.max(n,s.length/t.length),0)}var to=eo;function ro(e,t){let r=vt(e,t);return r===false?"":e.charAt(r)}var no=ro,Be="'",tr='"';function so(e,t){let r=t===true||t===Be?Be:tr,n=r===Be?tr:Be,s=0,i=0;for(let o of e)o===r?s++:o===n&&i++;return s>i?n:r}var io=so;function oo(e,t,r){for(let n=t;n<r;++n)if(e.charAt(n)===`
|
|
44
|
+
`)return true;return false}var uo=oo;function ao(e,t,r={}){return J(e,r.backwards?t-1:t,r)!==t}var lo=ao;function co(e,t,r){let n=t==='"'?"'":'"',s=Ve(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 po=co;function Do(e,t,r){return vt(e,r(t))}function fo(e,t){return arguments.length===2||typeof t=="number"?vt(e,t):Do(...arguments)}function ho(e,t,r){return gt(e,r(t))}function mo(e,t){return arguments.length===2||typeof t=="number"?gt(e,t):ho(...arguments)}function go(e,t,r){return yt(e,r(t))}function Fo(e,t){return arguments.length===2||typeof t=="number"?yt(e,t):go(...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 Co(e,t){return await pe(e,t)===e}var Eo=Y(yr,0),vo={parse:Y(Ri),formatAST:Y(Ii),formatDoc:Y(ji),printToDoc:Y(Mi),printDocToString:Y(_i)};var Me=class extends ie{constructor(r={}){super(r);y(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),d=[u,a,l,c].filter(Boolean).join(`
|
|
45
45
|
|
|
46
|
-
`),p=this.reactOptions.typescript?"tsx":"jsx",
|
|
46
|
+
`),p=this.reactOptions.typescript?"tsx":"jsx",f=this.generateFilename(n,p),D;try{D=await pe(d,{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=d;}return {code:D,filename:f,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
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 | number;"],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
48
|
${i.join(`
|
|
49
49
|
`)}
|
|
50
50
|
}`}generatePropTypes(r,n,s){let i=this.getComponentName(),o=["title: PropTypes.string,","titleId: PropTypes.string,","desc: PropTypes.string,","descId: PropTypes.string,","size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),","className: PropTypes.string,","style: PropTypes.object,","width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),","height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),"],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: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),
|
|
54
|
-
${p.filter(S=>!
|
|
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),d=i.map(S=>`${S.variableName}Class`),p=[...u,...a,...l,...c,...d],f=this.generateColorDefaults(s),D=this.generateStrokeWidthDefaults(i),h='size = "24"',m=o.features.includes("fixed-stroke-width")?"isFixedStrokeWidth = true":"",g=[h,f,D,m].filter(Boolean).join(", "),F=g.split(", ").map(S=>S.split(" = ")[0]),v=`{
|
|
54
|
+
${p.filter(S=>!F.includes(S)).join(`,
|
|
55
55
|
`)},
|
|
56
56
|
${g},
|
|
57
57
|
...svgProps
|
|
58
|
-
}`,
|
|
58
|
+
}`,E=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`,Z=this.reactOptions.forwardRef?", ref: Ref<SVGSVGElement>":"",ze=r.ast.root.children.map(De=>this.elementToJsx(De,1)).join(`
|
|
59
59
|
`);return `const ${n} = (${v}: ${S}${Z}) => {
|
|
60
60
|
const computedSize = {
|
|
61
|
-
width: svgProps.width
|
|
62
|
-
height: svgProps.height
|
|
61
|
+
width: svgProps.width || size,
|
|
62
|
+
height: svgProps.height || size
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
66
|
<svg
|
|
67
67
|
${this.reactOptions.forwardRef?`ref={ref}
|
|
68
|
-
`:""}${
|
|
69
|
-
{...computedSize}
|
|
68
|
+
`:""}${E}
|
|
70
69
|
{...svgProps}
|
|
70
|
+
{...computedSize}
|
|
71
71
|
>
|
|
72
72
|
${b}
|
|
73
73
|
${O}
|
|
@@ -79,19 +79,19 @@ ${ze}
|
|
|
79
79
|
const computedSize = size ? { width: size, height: size } : {};
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<svg ${
|
|
82
|
+
<svg ${E}{...computedSize} {...svgProps}>
|
|
83
83
|
${b}
|
|
84
84
|
${O}
|
|
85
85
|
${S}
|
|
86
86
|
</svg>
|
|
87
87
|
);
|
|
88
88
|
};`}}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(`
|
|
89
|
-
`)}getDependencies(){let r=["react"];return this.reactOptions.propTypes&&r.push("prop-types"),r}generateSvgAttributes(r){let n=[],
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
`,
|
|
93
|
-
`),
|
|
94
|
-
`+s),
|
|
89
|
+
`)}getDependencies(){let r=["react"];return this.reactOptions.propTypes&&r.push("prop-types"),r}generateSvgAttributes(r){let n=[],i={...r.root.attributes||{},...r.viewBox&&{viewBox:r.viewBox},...r.namespace&&{xmlns:r.namespace},...r.width&&{width:r.width},...r.height&&{height:r.height}},o=i.viewBox;return Object.entries(i).forEach(([u,a])=>{if(a!=null){if(o&&(u==="width"||u==="height"))return;if(u==="aria-labelledby"&&typeof a=="string"&&a.includes("{")){let l=a.replace(/\{(\w+)\}/g,"${$1}");n.push(`aria-labelledby={\`${l}\`}`);}else n.push(`${u}="${a}"`);}}),n.length>0?n.join(`
|
|
90
|
+
`)+`
|
|
91
|
+
`:""}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 d=`${s}<${i}${c}>`;return a&&(d+=a),u.length>0&&(d+=`
|
|
92
|
+
`,d+=u.map(p=>this.elementToJsx(p,n+1)).join(`
|
|
93
|
+
`),d+=`
|
|
94
|
+
`+s),d+=`</${i}>`,d}attributesToJsxWithClasses(r){let n=[],s=[],i="class"in r||"className"in r;if(Object.entries(r).forEach(([o,u])=>{let a=bt(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(([d,p])=>{if(typeof p=="string"&&p.startsWith("{")&&p.endsWith("}")){let f=p.slice(1,-1);if(d==="strokeWidth"){let D=`${f}Class`;s.push(D);}return `${d}: ${f}`}else return `${d}: '${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);y(this,"vueOptions");this.vueOptions={...this.options,composition:r.composition??true,scriptSetup:r.scriptSetup??true,sfc:r.sfc??true,defineComponent:r.defineComponent??false,useDefineOptions:r.useDefineOptions??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>
|
|
95
95
|
${n}
|
|
96
96
|
</template>
|
|
97
97
|
|
|
@@ -108,18 +108,18 @@ ${i}
|
|
|
108
108
|
<title v-if="props.title" :id="props.titleId">{{ props.title }}</title>
|
|
109
109
|
<desc v-if="props.desc" :id="props.descId">{{ props.desc }}</desc>
|
|
110
110
|
${i}
|
|
111
|
-
</svg>`}elementToVueTemplate(r,n=0){let s=" ".repeat(n),{tag:i,attributes:o,children:u,content:a}=r,l=[],c=[],
|
|
112
|
-
`,
|
|
113
|
-
`),
|
|
114
|
-
`+s),
|
|
115
|
-
`)}generateCompositionAPI(r){let{colorMappings:n,strokeWidthMappings:s,metadata:i}=r,o=this.getComponentName(),u=[];return u.push("import { defineComponent, computed } 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: '' },"),u.push(' size: { type: [String, Number], default: "24" },'),n.forEach(a=>{let l=a.variableName,c=a.originalColor,
|
|
116
|
-
`)}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: '' },"),u.push(' size: { type: [String, Number], default: "24" },'),n.forEach(a=>{let l=a.variableName,c=a.originalColor,
|
|
111
|
+
</svg>`}elementToVueTemplate(r,n=0){let s=" ".repeat(n),{tag:i,attributes:o,children:u,content:a}=r,l=[],c=[],d="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(d){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 f=`${s}<${i}${p}>`;return a&&(f+=a),u.length>0&&(f+=`
|
|
112
|
+
`,f+=u.map(D=>this.elementToVueTemplate(D,n+1)).join(`
|
|
113
|
+
`),f+=`
|
|
114
|
+
`+s),f+=`</${i}>`,f}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('import { computed } from "vue";'),o.push("")):(o.push('import { computed } 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(" width?: string | number;"),o.push(" height?: string | number;"),o.push(" size?: string | number;");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, Number], default: "24" },');return this.vueOptions.typescript&&o.push(' size: "24",'),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.push(""),o.push("const computedWidth = computed(() => props.width || props.size);"),o.push("const computedHeight = computed(() => props.height || props.size);"),o.join(`
|
|
115
|
+
`)}generateCompositionAPI(r){let{colorMappings:n,strokeWidthMappings:s,metadata:i}=r,o=this.getComponentName(),u=[];return u.push("import { defineComponent, computed } 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: '' },"),u.push(' size: { type: [String, Number], default: "24" },'),n.forEach(a=>{let l=a.variableName,c=a.originalColor,d=`${l}Class`;u.push(` ${l}: { type: String, default: '${c}' },`),u.push(` ${d}: { type: String, default: "" },`);}),s.forEach(a=>{let l=a.variableName,c=a.originalStrokeWidth,d=`${l}Class`;u.push(` ${l}: { type: [String, Number], default: '${c}' },`),u.push(` ${d}: { type: String, default: "" },`);}),i.features.includes("fixed-stroke-width")&&u.push(" isFixedStrokeWidth: { type: Boolean, default: true },"),u.push(" },"),u.push(" setup(props) {"),u.push(" const computedWidth = computed(() => props.width || props.size);"),u.push(" const computedHeight = computed(() => props.height || props.size);"),u.push(" return { computedWidth, computedHeight };"),u.push(" },"),u.push("});"),u.join(`
|
|
116
|
+
`)}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: '' },"),u.push(' size: { type: [String, Number], default: "24" },'),n.forEach(a=>{let l=a.variableName,c=a.originalColor,d=`${l}Class`;u.push(` ${l}: { type: String, default: '${c}' },`),u.push(` ${d}: { type: String, default: "" },`);}),s.forEach(a=>{let l=a.variableName,c=a.originalStrokeWidth,d=`${l}Class`;u.push(` ${l}: { type: [String, Number], default: '${c}' },`),u.push(` ${d}: { type: String, default: "" },`);}),i.features.includes("fixed-stroke-width")&&u.push(" isFixedStrokeWidth: { type: Boolean, default: true },"),u.push(" },"),u.push(" computed: {"),u.push(" computedWidth() {"),u.push(" return this.width || this.size;"),u.push(" },"),u.push(" computedHeight() {"),u.push(" return this.height || this.size;"),u.push(" },"),u.push(" },"),u.push("};"),u.join(`
|
|
117
117
|
`)}generateStyle(){return ""}generateColorPropsInterface(r){return r.length===0?"":r.map(n=>{let s=n.variableName,i=`${s}Class`;return ` ${s}?: string;
|
|
118
118
|
${i}?: string;`}).join(`
|
|
119
119
|
`)}generateStrokeWidthPropsInterface(r){return r.length===0?"":r.map(n=>{let s=n.variableName,i=`${s}Class`;return ` ${s}?: string | number;
|
|
120
120
|
${i}?: string;`}).join(`
|
|
121
|
-
`)}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=[],
|
|
122
|
-
`);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
|
|
121
|
+
`)}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=[],i={...r.root.attributes||{},...r.viewBox&&{viewBox:r.viewBox},...r.namespace&&{xmlns:r.namespace},...r.width&&{width:r.width},...r.height&&{height:r.height}};i.xmlns||(i.xmlns="http://www.w3.org/2000/svg");let o=i.viewBox;return Object.entries(i).forEach(([u,a])=>{if(a!=null){if(o&&(u==="width"||u==="height"))return;if(u==="aria-labelledby"&&typeof a=="string"&&a.includes("{")){let l=a.replace(/\{(\w+)\}/g,"${props.$1}");n.push(` :aria-labelledby="\`${l}\`"`);}else n.push(` ${u}="${a}"`);}}),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(){y(this,"parser");y(this,"transformer");this.parser=new Ee,this.transformer=new we;}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 Me(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(){y(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,normalizeFillStroke:d=false,memo:p=true,forwardRef:f=true,sfc:D=true,scriptSetup:h=true,optimize:m=true}=r,g={framework:n,transformation:{splitColors:a,splitStrokeWidths:l,fixedStrokeWidth:c,normalizeFillStroke:d,optimize:m,accessibility:true},generator:n==="react"?{typescript:s,componentName:i,prefix:o,suffix:u,memo:p,forwardRef:f,exportDefault:true,namedExport:false}:{typescript:s,componentName:i,prefix:o,suffix:u,sfc:D,scriptSetup:h,composition:true,exportDefault:true}},F=await this.engine.convert(t,g);return {code:F.code,componentName:F.componentName,filename:F.filename,framework:n,typescript:s,metadata:F.metadata,dependencies:F.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(`
|
|
122
|
+
`);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 d=o[c].trim();if(d.includes("<svg")||d.includes("<")&&d.includes("=")){l=true;break}if(d.includes("</")||d.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
|
|
123
123
|
`,u+=`// This file exports all components for optimal bundling
|
|
124
124
|
|
|
125
125
|
`;for(let a of o){let l=this.getImportPath(a.filename,i);u+=`export { default as ${a.componentName} } from './${l}';
|
package/dist/cli.js
CHANGED
|
@@ -101954,15 +101954,15 @@ var ReactGenerator = class extends ComponentGenerator {
|
|
|
101954
101954
|
const childrenJsx = result.ast.root.children.map((child) => this.elementToJsx(child, 1)).join("\n");
|
|
101955
101955
|
return `const ${componentName} = (${customPropsDestructure}: ${propsType}${refType}) => {
|
|
101956
101956
|
const computedSize = {
|
|
101957
|
-
width: svgProps.width
|
|
101958
|
-
height: svgProps.height
|
|
101957
|
+
width: svgProps.width || size,
|
|
101958
|
+
height: svgProps.height || size
|
|
101959
101959
|
};
|
|
101960
101960
|
|
|
101961
101961
|
return (
|
|
101962
101962
|
<svg
|
|
101963
101963
|
${this.reactOptions.forwardRef ? "ref={ref}\n " : ""}${rootAttributes}
|
|
101964
|
-
{...computedSize}
|
|
101965
101964
|
{...svgProps}
|
|
101965
|
+
{...computedSize}
|
|
101966
101966
|
>
|
|
101967
101967
|
${titleElement}
|
|
101968
101968
|
${descElement}
|
|
@@ -102041,25 +102041,30 @@ ${childrenJsx}
|
|
|
102041
102041
|
*/
|
|
102042
102042
|
generateSvgAttributes(ast) {
|
|
102043
102043
|
const attributes = [];
|
|
102044
|
-
const
|
|
102045
|
-
|
|
102046
|
-
|
|
102047
|
-
|
|
102048
|
-
|
|
102049
|
-
|
|
102050
|
-
|
|
102051
|
-
|
|
102052
|
-
|
|
102053
|
-
|
|
102054
|
-
|
|
102055
|
-
if (
|
|
102056
|
-
|
|
102057
|
-
|
|
102058
|
-
|
|
102059
|
-
|
|
102044
|
+
const rootAttrs = ast.root.attributes || {};
|
|
102045
|
+
const allAttributes = {
|
|
102046
|
+
...rootAttrs,
|
|
102047
|
+
// Override with AST-level attributes if present
|
|
102048
|
+
...ast.viewBox && { viewBox: ast.viewBox },
|
|
102049
|
+
...ast.namespace && { xmlns: ast.namespace },
|
|
102050
|
+
...ast.width && { width: ast.width },
|
|
102051
|
+
...ast.height && { height: ast.height }
|
|
102052
|
+
};
|
|
102053
|
+
const hasViewBox = allAttributes.viewBox;
|
|
102054
|
+
Object.entries(allAttributes).forEach(([key2, value]) => {
|
|
102055
|
+
if (value !== void 0 && value !== null) {
|
|
102056
|
+
if (hasViewBox && (key2 === "width" || key2 === "height")) {
|
|
102057
|
+
return;
|
|
102058
|
+
}
|
|
102059
|
+
if (key2 === "aria-labelledby" && typeof value === "string" && value.includes("{")) {
|
|
102060
|
+
const jsxValue = value.replace(/\{(\w+)\}/g, "${$1}");
|
|
102061
|
+
attributes.push(`aria-labelledby={\`${jsxValue}\`}`);
|
|
102062
|
+
} else {
|
|
102063
|
+
attributes.push(`${key2}="${value}"`);
|
|
102064
|
+
}
|
|
102060
102065
|
}
|
|
102061
|
-
}
|
|
102062
|
-
return attributes.length > 0 ? attributes.join("\n
|
|
102066
|
+
});
|
|
102067
|
+
return attributes.length > 0 ? attributes.join("\n ") + "\n " : "";
|
|
102063
102068
|
}
|
|
102064
102069
|
/**
|
|
102065
102070
|
* Override to add color class logic for React
|
|
@@ -102611,24 +102616,32 @@ ${children}
|
|
|
102611
102616
|
*/
|
|
102612
102617
|
generateSvgAttributes(ast) {
|
|
102613
102618
|
const attributes = [];
|
|
102614
|
-
const
|
|
102615
|
-
|
|
102616
|
-
|
|
102617
|
-
|
|
102618
|
-
|
|
102619
|
-
|
|
102620
|
-
|
|
102621
|
-
|
|
102622
|
-
|
|
102623
|
-
|
|
102624
|
-
|
|
102625
|
-
|
|
102626
|
-
|
|
102627
|
-
|
|
102628
|
-
if (
|
|
102629
|
-
|
|
102619
|
+
const rootAttrs = ast.root.attributes || {};
|
|
102620
|
+
const allAttributes = {
|
|
102621
|
+
...rootAttrs,
|
|
102622
|
+
// Override with AST-level attributes if present, fallback to default xmlns
|
|
102623
|
+
...ast.viewBox && { viewBox: ast.viewBox },
|
|
102624
|
+
...ast.namespace && { xmlns: ast.namespace },
|
|
102625
|
+
...ast.width && { width: ast.width },
|
|
102626
|
+
...ast.height && { height: ast.height }
|
|
102627
|
+
};
|
|
102628
|
+
if (!allAttributes.xmlns) {
|
|
102629
|
+
allAttributes.xmlns = "http://www.w3.org/2000/svg";
|
|
102630
|
+
}
|
|
102631
|
+
const hasViewBox = allAttributes.viewBox;
|
|
102632
|
+
Object.entries(allAttributes).forEach(([key2, value]) => {
|
|
102633
|
+
if (value !== void 0 && value !== null) {
|
|
102634
|
+
if (hasViewBox && (key2 === "width" || key2 === "height")) {
|
|
102635
|
+
return;
|
|
102636
|
+
}
|
|
102637
|
+
if (key2 === "aria-labelledby" && typeof value === "string" && value.includes("{")) {
|
|
102638
|
+
const vueValue = value.replace(/\{(\w+)\}/g, "${props.$1}");
|
|
102639
|
+
attributes.push(` :aria-labelledby="\`${vueValue}\`"`);
|
|
102640
|
+
} else {
|
|
102641
|
+
attributes.push(` ${key2}="${value}"`);
|
|
102642
|
+
}
|
|
102630
102643
|
}
|
|
102631
|
-
}
|
|
102644
|
+
});
|
|
102632
102645
|
return attributes.join("");
|
|
102633
102646
|
}
|
|
102634
102647
|
/**
|
|
@@ -102839,6 +102852,7 @@ async function convertSvgFile(filePath, options8) {
|
|
|
102839
102852
|
splitColors: options8.splitColors,
|
|
102840
102853
|
splitStrokeWidths: options8.splitStrokeWidths,
|
|
102841
102854
|
fixedStrokeWidth: options8.fixedStrokeWidth,
|
|
102855
|
+
normalizeFillStroke: options8.normalizeFillStroke,
|
|
102842
102856
|
accessibility: true
|
|
102843
102857
|
},
|
|
102844
102858
|
generator: {
|
|
@@ -102968,7 +102982,10 @@ async function main() {
|
|
|
102968
102982
|
"-f, --framework <framework>",
|
|
102969
102983
|
"Target framework: react or vue",
|
|
102970
102984
|
"react"
|
|
102971
|
-
).option("--typescript", "Generate TypeScript components").option("--javascript", "Generate JavaScript components").option("--split-colors", "Enable color splitting feature").option("--split-stroke-widths", "Enable stroke width splitting feature").option("--fixed-stroke-width", "Enable fixed stroke width feature").option("--memo", "Wrap component with React.memo").option("--no-memo", "Disable React.memo wrapping").option("--forward-ref", "Enable forwardRef support").option("--no-forward-ref", "Disable forwardRef support").option("-n, --name <name>", "Custom component name").option("--optimize", "Enable SVG optimization").option("--no-optimize", "Disable SVG optimization").option("--recursive", "Process directories recursively").option("--prefix <prefix>", "Add prefix to component names").option("--suffix <suffix>", "Add suffix to component names").option("--index", "Generate index.ts file for directory processing").
|
|
102985
|
+
).option("--typescript", "Generate TypeScript components").option("--javascript", "Generate JavaScript components").option("--split-colors", "Enable color splitting feature").option("--split-stroke-widths", "Enable stroke width splitting feature").option("--fixed-stroke-width", "Enable fixed stroke width feature").option("--memo", "Wrap component with React.memo").option("--no-memo", "Disable React.memo wrapping").option("--forward-ref", "Enable forwardRef support").option("--no-forward-ref", "Disable forwardRef support").option("-n, --name <name>", "Custom component name").option("--optimize", "Enable SVG optimization").option("--no-optimize", "Disable SVG optimization").option("--recursive", "Process directories recursively").option("--prefix <prefix>", "Add prefix to component names").option("--suffix <suffix>", "Add suffix to component names").option("--index", "Generate index.ts file for directory processing").option(
|
|
102986
|
+
"--normalize-fill-stroke",
|
|
102987
|
+
"Normalize fill and stroke attributes for consistency"
|
|
102988
|
+
).addHelpText(
|
|
102972
102989
|
"after",
|
|
102973
102990
|
`
|
|
102974
102991
|
${ansiColors.darkBlue}
|
package/dist/index.d.mts
CHANGED
|
@@ -663,6 +663,13 @@ interface ConversionOptions {
|
|
|
663
663
|
typescript?: boolean;
|
|
664
664
|
format?: 'esm' | 'cjs';
|
|
665
665
|
splitColors?: boolean;
|
|
666
|
+
splitStrokeWidths?: boolean;
|
|
667
|
+
fixedStrokeWidth?: boolean;
|
|
668
|
+
normalizeFillStroke?: boolean;
|
|
669
|
+
accessibility?: boolean;
|
|
670
|
+
removeComments?: boolean;
|
|
671
|
+
removeDuplicates?: boolean;
|
|
672
|
+
minifyPaths?: boolean;
|
|
666
673
|
isFixedStrokeWidth?: boolean;
|
|
667
674
|
}
|
|
668
675
|
interface ReactConversionOptions extends ConversionOptions {
|
|
@@ -715,6 +722,13 @@ interface CliOptions {
|
|
|
715
722
|
indexFormat?: 'ts' | 'js';
|
|
716
723
|
exportType?: 'named' | 'default';
|
|
717
724
|
splitColors?: boolean;
|
|
725
|
+
splitStrokeWidths?: boolean;
|
|
726
|
+
fixedStrokeWidth?: boolean;
|
|
727
|
+
normalizeFillStroke?: boolean;
|
|
728
|
+
accessibility?: boolean;
|
|
729
|
+
removeComments?: boolean;
|
|
730
|
+
removeDuplicates?: boolean;
|
|
731
|
+
minifyPaths?: boolean;
|
|
718
732
|
isFixedStrokeWidth?: boolean;
|
|
719
733
|
}
|
|
720
734
|
|
package/dist/index.d.ts
CHANGED
|
@@ -663,6 +663,13 @@ interface ConversionOptions {
|
|
|
663
663
|
typescript?: boolean;
|
|
664
664
|
format?: 'esm' | 'cjs';
|
|
665
665
|
splitColors?: boolean;
|
|
666
|
+
splitStrokeWidths?: boolean;
|
|
667
|
+
fixedStrokeWidth?: boolean;
|
|
668
|
+
normalizeFillStroke?: boolean;
|
|
669
|
+
accessibility?: boolean;
|
|
670
|
+
removeComments?: boolean;
|
|
671
|
+
removeDuplicates?: boolean;
|
|
672
|
+
minifyPaths?: boolean;
|
|
666
673
|
isFixedStrokeWidth?: boolean;
|
|
667
674
|
}
|
|
668
675
|
interface ReactConversionOptions extends ConversionOptions {
|
|
@@ -715,6 +722,13 @@ interface CliOptions {
|
|
|
715
722
|
indexFormat?: 'ts' | 'js';
|
|
716
723
|
exportType?: 'named' | 'default';
|
|
717
724
|
splitColors?: boolean;
|
|
725
|
+
splitStrokeWidths?: boolean;
|
|
726
|
+
fixedStrokeWidth?: boolean;
|
|
727
|
+
normalizeFillStroke?: boolean;
|
|
728
|
+
accessibility?: boolean;
|
|
729
|
+
removeComments?: boolean;
|
|
730
|
+
removeDuplicates?: boolean;
|
|
731
|
+
minifyPaths?: boolean;
|
|
718
732
|
isFixedStrokeWidth?: boolean;
|
|
719
733
|
}
|
|
720
734
|
|
package/dist/index.js
CHANGED
|
@@ -588,16 +588,16 @@ node_modules`),!r)return;let i=(0, ior.default)({allowRelativePaths:true}).add(r
|
|
|
588
588
|
}`,O=this.generateSvgAttributes(t.ast),F="{title ? <title id={titleId}>{title}</title> : null}",B="{desc ? <desc id={descId}>{desc}</desc> : null}";if(this.reactOptions.typescript){let L=`${r}Props`,q=this.reactOptions.forwardRef?", ref: Ref<SVGSVGElement>":"",H=t.ast.root.children.map(te=>this.elementToJsx(te,1)).join(`
|
|
589
589
|
`);return `const ${r} = (${T}: ${L}${q}) => {
|
|
590
590
|
const computedSize = {
|
|
591
|
-
width: svgProps.width
|
|
592
|
-
height: svgProps.height
|
|
591
|
+
width: svgProps.width || size,
|
|
592
|
+
height: svgProps.height || size
|
|
593
593
|
};
|
|
594
594
|
|
|
595
595
|
return (
|
|
596
596
|
<svg
|
|
597
597
|
${this.reactOptions.forwardRef?`ref={ref}
|
|
598
598
|
`:""}${O}
|
|
599
|
-
{...computedSize}
|
|
600
599
|
{...svgProps}
|
|
600
|
+
{...computedSize}
|
|
601
601
|
>
|
|
602
602
|
${F}
|
|
603
603
|
${B}
|
|
@@ -616,9 +616,9 @@ ${L}
|
|
|
616
616
|
</svg>
|
|
617
617
|
);
|
|
618
618
|
};`}}generateExports(t){let r=[];return this.reactOptions.forwardRef?(r.push(`const ForwardRef = forwardRef(${t});`),this.reactOptions.memo?(r.push("const Memo = memo(ForwardRef);"),this.reactOptions.exportDefault&&r.push("export default Memo;"),this.reactOptions.namedExport&&r.push(`export { Memo as ${t} };`)):(this.reactOptions.exportDefault&&r.push("export default ForwardRef;"),this.reactOptions.namedExport&&r.push(`export { ForwardRef as ${t} };`))):this.reactOptions.memo?(r.push(`const Memo = memo(${t});`),this.reactOptions.exportDefault&&r.push("export default Memo;"),this.reactOptions.namedExport&&r.push(`export { Memo as ${t} };`)):(this.reactOptions.exportDefault&&r.push(`export default ${t};`),this.reactOptions.namedExport&&r.push(`export { ${t} };`)),r.join(`
|
|
619
|
-
`)}getDependencies(){let t=["react"];return this.reactOptions.propTypes&&t.push("prop-types"),t}generateSvgAttributes(t){let r=[],
|
|
620
|
-
|
|
621
|
-
|
|
619
|
+
`)}getDependencies(){let t=["react"];return this.reactOptions.propTypes&&t.push("prop-types"),t}generateSvgAttributes(t){let r=[],a={...t.root.attributes||{},...t.viewBox&&{viewBox:t.viewBox},...t.namespace&&{xmlns:t.namespace},...t.width&&{width:t.width},...t.height&&{height:t.height}},o=a.viewBox;return Object.entries(a).forEach(([u,c])=>{if(c!=null){if(o&&(u==="width"||u==="height"))return;if(u==="aria-labelledby"&&typeof c=="string"&&c.includes("{")){let l=c.replace(/\{(\w+)\}/g,"${$1}");r.push(`aria-labelledby={\`${l}\`}`);}else r.push(`${u}="${c}"`);}}),r.length>0?r.join(`
|
|
620
|
+
`)+`
|
|
621
|
+
`:""}elementToJsx(t,r=0){let i=" ".repeat(r+1),{tag:a,attributes:o,children:u,content:c}=t,l=this.attributesToJsxWithClasses(o),h=l.length>0?" "+l.join(" "):"";if(u.length===0&&!c)return `${i}<${a}${h} />`;let p=`${i}<${a}${h}>`;return c&&(p+=c),u.length>0&&(p+=`
|
|
622
622
|
`,p+=u.map(f=>this.elementToJsx(f,r+1)).join(`
|
|
623
623
|
`),p+=`
|
|
624
624
|
`+i),p+=`</${a}>`,p}attributesToJsxWithClasses(t){let r=[],i=[],a="class"in t||"className"in t;if(Object.entries(t).forEach(([o,u])=>{let c=N1e(o);if(o==="vector-effect"&&u==="non-scaling-stroke")r.push("vectorEffect={isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'}");else if((o==="fill"||o==="stroke")&&u.startsWith("{")&&u.endsWith("}")){let l=u.slice(1,-1);r.push(`${c}=${u}`);let h=`${l}Class`;i.push(h);}else if(o==="stroke-width"&&u.startsWith("{")&&u.endsWith("}")){let l=u.slice(1,-1);r.push(`${c}=${u}`);let h=`${l}Class`;i.push(h);}else if(o==="style"){let l=this.parseStyleString(u),h=Object.entries(l).map(([p,f])=>{if(typeof f=="string"&&f.startsWith("{")&&f.endsWith("}")){let v=f.slice(1,-1);if(p==="strokeWidth"){let b=`${v}Class`;i.push(b);}return `${p}: ${v}`}else return `${p}: '${f}'`});r.push(`style={{ ${h.join(", ")} }}`);}else u.startsWith("{")&&u.endsWith("}")?r.push(`${c}=${u}`):r.push(`${c}="${u}"`);}),i.length>0){let o=t.class||t.className;if(i.length===1)o?r.push(`className={\`${o} \${${i[0]}}\`}`):r.push(`className={${i[0]}}`);else {let u=i.map(c=>`\${${c}}`).join(" ");o?r.push(`className={\`${o} ${u}\`}`):r.push(`className={\`${u}\`}`);}}else if(a){let o=t.class||t.className;o&&r.push(`className="${o}"`);}return r}parseStyleString(t){let r={};return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u){let c=yZ(o);r[c]=u;}}}),r}};Wi();var kN=class extends cC{vueOptions;constructor(t={}){super(t),this.vueOptions={...this.options,composition:t.composition??true,scriptSetup:t.scriptSetup??true,sfc:t.sfc??true,defineComponent:t.defineComponent??false,useDefineOptions:t.useDefineOptions??false};}async generate(t){let r=this.getComponentName(),i;this.vueOptions.sfc?i=this.generateSFC(t):i=this.generateJSComponent(t);let a=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"ts":"js",o=this.generateFilename(r,a),u;try{let c=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"typescript":"babel";u=await dT(i,{parser:c,semi:!0,singleQuote:!0,trailingComma:"es5",tabWidth:2,printWidth:80,bracketSpacing:!0,arrowParens:"avoid",htmlWhitespaceSensitivity:"ignore",vueIndentScriptAndStyle:!0});}catch(c){console.warn("Prettier formatting failed, using unformatted code:",c),u=i;}return {code:u,filename:o,componentName:r,dependencies:this.getDependencies()}}generateSFC(t){let r=this.generateTemplate(t),i=this.generateScript(t),a=this.generateStyle();return `<template>
|
|
@@ -648,7 +648,7 @@ ${a}
|
|
|
648
648
|
${a}?: string;`}).join(`
|
|
649
649
|
`)}generateStrokeWidthPropsInterface(t){return t.length===0?"":t.map(r=>{let i=r.variableName,a=`${i}Class`;return ` ${i}?: string | number;
|
|
650
650
|
${a}?: string;`}).join(`
|
|
651
|
-
`)}parseStyleStringForVue(t){let r=[];return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u)if(u.startsWith("{")&&u.endsWith("}")){let c=u.slice(1,-1);r.push(`'${o}': props.${c}`);}else r.push(`'${o}': '${u}'`);}}),`{ ${r.join(", ")} }`}generateSvgAttributes(t){let r=[],
|
|
651
|
+
`)}parseStyleStringForVue(t){let r=[];return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u)if(u.startsWith("{")&&u.endsWith("}")){let c=u.slice(1,-1);r.push(`'${o}': props.${c}`);}else r.push(`'${o}': '${u}'`);}}),`{ ${r.join(", ")} }`}generateSvgAttributes(t){let r=[],a={...t.root.attributes||{},...t.viewBox&&{viewBox:t.viewBox},...t.namespace&&{xmlns:t.namespace},...t.width&&{width:t.width},...t.height&&{height:t.height}};a.xmlns||(a.xmlns="http://www.w3.org/2000/svg");let o=a.viewBox;return Object.entries(a).forEach(([u,c])=>{if(c!=null){if(o&&(u==="width"||u==="height"))return;if(u==="aria-labelledby"&&typeof c=="string"&&c.includes("{")){let l=c.replace(/\{(\w+)\}/g,"${props.$1}");r.push(` :aria-labelledby="\`${l}\`"`);}else r.push(` ${u}="${c}"`);}}),r.join("")}getDependencies(){return ["vue"]}extractClassVarsFromStyle(t){let r=[];return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u&&u.startsWith("{")&&u.endsWith("}")){let c=u.slice(1,-1);if(o==="fill"||o==="stroke"||o==="stroke-width"){let l=`props.${c}Class`;r.push(l);}}}}),r}};var TN=class{parser;transformer;constructor(){this.parser=new fS,this.transformer=new vS;}async convert(t,r){try{let i=this.parser.parse(t),a=this.transformer.transform(i,r.transformation),o;return r.framework==="react"?o=new wN(r.generator):o=new kN(r.generator),{...await o.generate(a),metadata:a.metadata}}catch(i){throw new Error(`SVG conversion failed: ${i instanceof Error?i.message:String(i)}`)}}extractColors(t){let r=this.parser.parse(t),i=this.parser.extractColors(r);return Array.from(new Set(i.map(a=>a.value))).sort()}validate(t){let r=[];try{let i=this.parser.parse(t);i.root||r.push("No root SVG element found"),!i.viewBox&&!i.width&&!i.height&&r.push("SVG should have viewBox or width/height attributes");}catch(i){r.push(i instanceof Error?i.message:String(i));}return {valid:r.length===0,errors:r}}};async function Gor(e,t={}){return new TN().convert(e,{...t,framework:"react"})}async function Kor(e,t={}){return new TN().convert(e,{...t,framework:"vue"})}Wi();var Yor={plugins:[{name:"preset-default",params:{overrides:{removeViewBox:false,removeTitle:false,removeDesc:false,removeUselessStrokeAndFill:false,collapseGroups:false,convertColors:{currentColor:true,names2hex:true,rgb2hex:true,shorthex:true,shortname:true}}}},"removeDimensions","cleanupNumericValues"]};function Qor(e,t=Yor){try{return svgo.optimize(e,t).data}catch(r){throw new Error(`Failed to optimize SVG: ${r}`)}}function Zor(e){let t=[{name:"preset-default",params:{overrides:{removeViewBox:!e.removeViewBox,removeTitle:!e.removeTitle,removeDesc:!e.removeDesc,removeUselessStrokeAndFill:!e.preserveClasses,convertColors:e.preserveColors?false:{currentColor:true,names2hex:true,rgb2hex:true,shorthex:true,shortname:true}}}},"cleanupNumericValues"];return e.removeDimensions!==false&&t.push("removeDimensions"),{plugins:t}}Wi();async function our(e){try{return await zU.readFile(e,"utf-8")}catch(t){throw new Error(`Failed to read SVG file: ${e}. ${t}`)}}async function uur(e,t){try{await z9e(W4.dirname(e)),await zU.writeFile(e,t,"utf-8");}catch(r){throw new Error(`Failed to write SVG file: ${e}. ${r}`)}}async function lur(e,t){try{await z9e(W4.dirname(e)),await zU.writeFile(e,t,"utf-8");}catch(r){throw new Error(`Failed to write component file: ${e}. ${r}`)}}async function W9e(e,t=false){try{let r=await zU.readdir(e),i=[];for(let a of r){let o=W4.join(e,a),u=await zU.stat(o);if(u.isDirectory()&&t){let c=await W9e(o,t);i.push(...c);}else u.isFile()&&W4.extname(a).toLowerCase()===".svg"&&i.push(o);}return i}catch(r){throw new Error(`Failed to read directory: ${e}. ${r}`)}}async function z9e(e){_nr.existsSync(e)||await zU.mkdir(e,{recursive:true});}Wi();function cur(e,t){let{format:r,exportType:i,typescript:a}=t,o=[...e].sort((u,c)=>u.componentName.localeCompare(c.componentName));return i==="default"?_ur(o):pur(o,r,a,t.framework)}function pur(e,t,r,i){let a="";a+=`// Auto-generated index file for tree-shaking
|
|
652
652
|
`,a+=`// This file exports all components for optimal bundling
|
|
653
653
|
|
|
654
654
|
`;for(let o of e){let u=bue(o.filename,i);a+=`export { default as ${o.componentName} } from './${u}';
|
package/dist/index.mjs
CHANGED
|
@@ -588,16 +588,16 @@ node_modules`),!r)return;let i=(0, ior.default)({allowRelativePaths:true}).add(r
|
|
|
588
588
|
}`,O=this.generateSvgAttributes(t.ast),F="{title ? <title id={titleId}>{title}</title> : null}",B="{desc ? <desc id={descId}>{desc}</desc> : null}";if(this.reactOptions.typescript){let L=`${r}Props`,q=this.reactOptions.forwardRef?", ref: Ref<SVGSVGElement>":"",H=t.ast.root.children.map(te=>this.elementToJsx(te,1)).join(`
|
|
589
589
|
`);return `const ${r} = (${T}: ${L}${q}) => {
|
|
590
590
|
const computedSize = {
|
|
591
|
-
width: svgProps.width
|
|
592
|
-
height: svgProps.height
|
|
591
|
+
width: svgProps.width || size,
|
|
592
|
+
height: svgProps.height || size
|
|
593
593
|
};
|
|
594
594
|
|
|
595
595
|
return (
|
|
596
596
|
<svg
|
|
597
597
|
${this.reactOptions.forwardRef?`ref={ref}
|
|
598
598
|
`:""}${O}
|
|
599
|
-
{...computedSize}
|
|
600
599
|
{...svgProps}
|
|
600
|
+
{...computedSize}
|
|
601
601
|
>
|
|
602
602
|
${F}
|
|
603
603
|
${B}
|
|
@@ -616,9 +616,9 @@ ${L}
|
|
|
616
616
|
</svg>
|
|
617
617
|
);
|
|
618
618
|
};`}}generateExports(t){let r=[];return this.reactOptions.forwardRef?(r.push(`const ForwardRef = forwardRef(${t});`),this.reactOptions.memo?(r.push("const Memo = memo(ForwardRef);"),this.reactOptions.exportDefault&&r.push("export default Memo;"),this.reactOptions.namedExport&&r.push(`export { Memo as ${t} };`)):(this.reactOptions.exportDefault&&r.push("export default ForwardRef;"),this.reactOptions.namedExport&&r.push(`export { ForwardRef as ${t} };`))):this.reactOptions.memo?(r.push(`const Memo = memo(${t});`),this.reactOptions.exportDefault&&r.push("export default Memo;"),this.reactOptions.namedExport&&r.push(`export { Memo as ${t} };`)):(this.reactOptions.exportDefault&&r.push(`export default ${t};`),this.reactOptions.namedExport&&r.push(`export { ${t} };`)),r.join(`
|
|
619
|
-
`)}getDependencies(){let t=["react"];return this.reactOptions.propTypes&&t.push("prop-types"),t}generateSvgAttributes(t){let r=[],
|
|
620
|
-
|
|
621
|
-
|
|
619
|
+
`)}getDependencies(){let t=["react"];return this.reactOptions.propTypes&&t.push("prop-types"),t}generateSvgAttributes(t){let r=[],a={...t.root.attributes||{},...t.viewBox&&{viewBox:t.viewBox},...t.namespace&&{xmlns:t.namespace},...t.width&&{width:t.width},...t.height&&{height:t.height}},o=a.viewBox;return Object.entries(a).forEach(([u,c])=>{if(c!=null){if(o&&(u==="width"||u==="height"))return;if(u==="aria-labelledby"&&typeof c=="string"&&c.includes("{")){let l=c.replace(/\{(\w+)\}/g,"${$1}");r.push(`aria-labelledby={\`${l}\`}`);}else r.push(`${u}="${c}"`);}}),r.length>0?r.join(`
|
|
620
|
+
`)+`
|
|
621
|
+
`:""}elementToJsx(t,r=0){let i=" ".repeat(r+1),{tag:a,attributes:o,children:u,content:c}=t,l=this.attributesToJsxWithClasses(o),h=l.length>0?" "+l.join(" "):"";if(u.length===0&&!c)return `${i}<${a}${h} />`;let p=`${i}<${a}${h}>`;return c&&(p+=c),u.length>0&&(p+=`
|
|
622
622
|
`,p+=u.map(f=>this.elementToJsx(f,r+1)).join(`
|
|
623
623
|
`),p+=`
|
|
624
624
|
`+i),p+=`</${a}>`,p}attributesToJsxWithClasses(t){let r=[],i=[],a="class"in t||"className"in t;if(Object.entries(t).forEach(([o,u])=>{let c=B1e(o);if(o==="vector-effect"&&u==="non-scaling-stroke")r.push("vectorEffect={isFixedStrokeWidth ? 'non-scaling-stroke' : 'none'}");else if((o==="fill"||o==="stroke")&&u.startsWith("{")&&u.endsWith("}")){let l=u.slice(1,-1);r.push(`${c}=${u}`);let h=`${l}Class`;i.push(h);}else if(o==="stroke-width"&&u.startsWith("{")&&u.endsWith("}")){let l=u.slice(1,-1);r.push(`${c}=${u}`);let h=`${l}Class`;i.push(h);}else if(o==="style"){let l=this.parseStyleString(u),h=Object.entries(l).map(([p,f])=>{if(typeof f=="string"&&f.startsWith("{")&&f.endsWith("}")){let v=f.slice(1,-1);if(p==="strokeWidth"){let b=`${v}Class`;i.push(b);}return `${p}: ${v}`}else return `${p}: '${f}'`});r.push(`style={{ ${h.join(", ")} }}`);}else u.startsWith("{")&&u.endsWith("}")?r.push(`${c}=${u}`):r.push(`${c}="${u}"`);}),i.length>0){let o=t.class||t.className;if(i.length===1)o?r.push(`className={\`${o} \${${i[0]}}\`}`):r.push(`className={${i[0]}}`);else {let u=i.map(c=>`\${${c}}`).join(" ");o?r.push(`className={\`${o} ${u}\`}`):r.push(`className={\`${u}\`}`);}}else if(a){let o=t.class||t.className;o&&r.push(`className="${o}"`);}return r}parseStyleString(t){let r={};return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u){let c=gZ(o);r[c]=u;}}}),r}};Wi();var TN=class extends pC{vueOptions;constructor(t={}){super(t),this.vueOptions={...this.options,composition:t.composition??true,scriptSetup:t.scriptSetup??true,sfc:t.sfc??true,defineComponent:t.defineComponent??false,useDefineOptions:t.useDefineOptions??false};}async generate(t){let r=this.getComponentName(),i;this.vueOptions.sfc?i=this.generateSFC(t):i=this.generateJSComponent(t);let a=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"ts":"js",o=this.generateFilename(r,a),u;try{let c=this.vueOptions.sfc?"vue":this.vueOptions.typescript?"typescript":"babel";u=await fT(i,{parser:c,semi:!0,singleQuote:!0,trailingComma:"es5",tabWidth:2,printWidth:80,bracketSpacing:!0,arrowParens:"avoid",htmlWhitespaceSensitivity:"ignore",vueIndentScriptAndStyle:!0});}catch(c){console.warn("Prettier formatting failed, using unformatted code:",c),u=i;}return {code:u,filename:o,componentName:r,dependencies:this.getDependencies()}}generateSFC(t){let r=this.generateTemplate(t),i=this.generateScript(t),a=this.generateStyle();return `<template>
|
|
@@ -648,7 +648,7 @@ ${a}
|
|
|
648
648
|
${a}?: string;`}).join(`
|
|
649
649
|
`)}generateStrokeWidthPropsInterface(t){return t.length===0?"":t.map(r=>{let i=r.variableName,a=`${i}Class`;return ` ${i}?: string | number;
|
|
650
650
|
${a}?: string;`}).join(`
|
|
651
|
-
`)}parseStyleStringForVue(t){let r=[];return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u)if(u.startsWith("{")&&u.endsWith("}")){let c=u.slice(1,-1);r.push(`'${o}': props.${c}`);}else r.push(`'${o}': '${u}'`);}}),`{ ${r.join(", ")} }`}generateSvgAttributes(t){let r=[],
|
|
651
|
+
`)}parseStyleStringForVue(t){let r=[];return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u)if(u.startsWith("{")&&u.endsWith("}")){let c=u.slice(1,-1);r.push(`'${o}': props.${c}`);}else r.push(`'${o}': '${u}'`);}}),`{ ${r.join(", ")} }`}generateSvgAttributes(t){let r=[],a={...t.root.attributes||{},...t.viewBox&&{viewBox:t.viewBox},...t.namespace&&{xmlns:t.namespace},...t.width&&{width:t.width},...t.height&&{height:t.height}};a.xmlns||(a.xmlns="http://www.w3.org/2000/svg");let o=a.viewBox;return Object.entries(a).forEach(([u,c])=>{if(c!=null){if(o&&(u==="width"||u==="height"))return;if(u==="aria-labelledby"&&typeof c=="string"&&c.includes("{")){let l=c.replace(/\{(\w+)\}/g,"${props.$1}");r.push(` :aria-labelledby="\`${l}\`"`);}else r.push(` ${u}="${c}"`);}}),r.join("")}getDependencies(){return ["vue"]}extractClassVarsFromStyle(t){let r=[];return t.split(";").forEach(i=>{let a=i.indexOf(":");if(a>0){let o=i.slice(0,a).trim(),u=i.slice(a+1).trim();if(o&&u&&u.startsWith("{")&&u.endsWith("}")){let c=u.slice(1,-1);if(o==="fill"||o==="stroke"||o==="stroke-width"){let l=`props.${c}Class`;r.push(l);}}}}),r}};var SN=class{parser;transformer;constructor(){this.parser=new hS,this.transformer=new bS;}async convert(t,r){try{let i=this.parser.parse(t),a=this.transformer.transform(i,r.transformation),o;return r.framework==="react"?o=new kN(r.generator):o=new TN(r.generator),{...await o.generate(a),metadata:a.metadata}}catch(i){throw new Error(`SVG conversion failed: ${i instanceof Error?i.message:String(i)}`)}}extractColors(t){let r=this.parser.parse(t),i=this.parser.extractColors(r);return Array.from(new Set(i.map(a=>a.value))).sort()}validate(t){let r=[];try{let i=this.parser.parse(t);i.root||r.push("No root SVG element found"),!i.viewBox&&!i.width&&!i.height&&r.push("SVG should have viewBox or width/height attributes");}catch(i){r.push(i instanceof Error?i.message:String(i));}return {valid:r.length===0,errors:r}}};async function Gor(e,t={}){return new SN().convert(e,{...t,framework:"react"})}async function Kor(e,t={}){return new SN().convert(e,{...t,framework:"vue"})}Wi();var Yor={plugins:[{name:"preset-default",params:{overrides:{removeViewBox:false,removeTitle:false,removeDesc:false,removeUselessStrokeAndFill:false,collapseGroups:false,convertColors:{currentColor:true,names2hex:true,rgb2hex:true,shorthex:true,shortname:true}}}},"removeDimensions","cleanupNumericValues"]};function Qor(e,t=Yor){try{return optimize(e,t).data}catch(r){throw new Error(`Failed to optimize SVG: ${r}`)}}function Zor(e){let t=[{name:"preset-default",params:{overrides:{removeViewBox:!e.removeViewBox,removeTitle:!e.removeTitle,removeDesc:!e.removeDesc,removeUselessStrokeAndFill:!e.preserveClasses,convertColors:e.preserveColors?false:{currentColor:true,names2hex:true,rgb2hex:true,shorthex:true,shortname:true}}}},"cleanupNumericValues"];return e.removeDimensions!==false&&t.push("removeDimensions"),{plugins:t}}Wi();async function our(e){try{return await readFile(e,"utf-8")}catch(t){throw new Error(`Failed to read SVG file: ${e}. ${t}`)}}async function uur(e,t){try{await H9e(dirname(e)),await writeFile(e,t,"utf-8");}catch(r){throw new Error(`Failed to write SVG file: ${e}. ${r}`)}}async function lur(e,t){try{await H9e(dirname(e)),await writeFile(e,t,"utf-8");}catch(r){throw new Error(`Failed to write component file: ${e}. ${r}`)}}async function z9e(e,t=false){try{let r=await readdir(e),i=[];for(let a of r){let o=join(e,a),u=await stat(o);if(u.isDirectory()&&t){let c=await z9e(o,t);i.push(...c);}else u.isFile()&&extname(a).toLowerCase()===".svg"&&i.push(o);}return i}catch(r){throw new Error(`Failed to read directory: ${e}. ${r}`)}}async function H9e(e){existsSync(e)||await mkdir(e,{recursive:true});}Wi();function cur(e,t){let{format:r,exportType:i,typescript:a}=t,o=[...e].sort((u,c)=>u.componentName.localeCompare(c.componentName));return i==="default"?_ur(o):pur(o,r,a,t.framework)}function pur(e,t,r,i){let a="";a+=`// Auto-generated index file for tree-shaking
|
|
652
652
|
`,a+=`// This file exports all components for optimal bundling
|
|
653
653
|
|
|
654
654
|
`;for(let o of e){let u=xue(o.filename,i);a+=`export { default as ${o.componentName} } from './${u}';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svgfusion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "A powerful CLI tool and library that converts SVG files into production-ready React and Vue 3 components with native SVG props inheritance, TypeScript support, and custom SVGFusion engine.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|